The Lazarus IDE: How the program is being built
1 General ideas
The program uses as the programs in itself the LCL or Lazarus Component Library, which can be seen as the replacement of the VCL or Visual Component Library in Delphi/Kylix. Also, some extra file extensions are necessary: the .lfm-file or Lazarus Form, the .lpr-file or Lazarus Project file, the .lrs or Lazarus Resource file.
2How the program starts
2.1 The program lazarus.pp
The program starts from the file lazarus.pp. In that file, you can find between begin and end. how the application starts. The program is a typical LCL program. As lots of you will know how such an application starts, we describe these details in Appendix A. Generally speaking, the command-line options are parsed, the Splash form is shown(afterwards removed), and four Forms are created: MainIDE, MessagesView, FindReplaceDlg and FindInFilesDlg. Interesting is also the inheritance scheme of TMainIDE: TObject -> TCustomForm -> TForm -> TMainIDEBar -> TMainIDE
2.2 main.pp: the TMainIDE class and TMainIDE.Create
As you would scroll through main.pp, you would notice that the unit is built around the one big class TMainIDE. TMainIDEcompromises as it name implies, the main pieces of the IDE and all other pieces are indirectly related to it. So, the constructor of TMainIDE can be seen as the real start of the program. After the command-line options are parsed and the config path is initialized, the global options are loaded into their data structures: - EnvironmentOptions (TEnvironmentOptions) from the unit EnvironmentOpts containsgeneral environment options. - EditorOptions (TEditorOptions) from the unit editoroptions contains options for the unit editor. - CodeToolOpts (TCodeToolOpts) from the unit codetoolsoptions contains code tool options. - InputHistories (TInputHistories) will keep track of what has already been done, so it can be undone, ... After that ToolStatus, which sets the IDE mode, is set into editable mode.(other modes will include compiling mode, I presume)
InitCodeToolBoss initializes the CodeToolBoss, which is the frontend for the codetools. The frontend for the codetools still needs to be developed, but the procedure already sets a basic set of compiler macros. Thereafter, the MainIDE form is built and positioned.
Fig. 1: Speed Buttons and Component Notebook
ifLazarusResources.Find(ClassName)=nil then begin SetupMainMenu; // Creates menu as in fig 1 SetupSpeedButtons; // see fig1 SetupComponentNoteBook; // see fig 1 ConnectMainBarEvents; SetupHints; //Setting up the Hints window, which shows text when you pass somewhere by. It's actually a timer being set up end; DebugBoss:=TDebugManager.Create(Self); DebugBoss.ConnectMainBarEvents; --> Starting the debug manager: boxLoadMenuShortCuts; SetupComponentTabs; SetupOutputFilter; SetupCompilerInterface; SetupObjectInspector; SetupFormEditor; SetupSourceNotebook; SetupTransferMacros; SetupControlSelection;
SetupStartProject; The Project unit It contains the TProject and TUnitInfo classes. They keep information about the project and its associated units. The LazConf unit It manages OS specific configuration paths,... and isused in LoadGlobalOptions above. The CompReg unit All units viable to the IDE must register themselves. The Compreg unit has the classes through which that happens. These classes are the TRegisteredComponent, TRegisteredComponentList The MsgView unit The TMessageview class (=TForm) is responsible for displaying the PPC386 compiler messages. It's a little form you can see while compiling.
TheIDEComp unit Contains TIDEComponent. The LazarusIDEStrConst unit All strings are put into constants in this units. Can be handy if you want to make a version in another language. The Compiler unit The TCompiler class has the methods to start the compiler and let it compile the program. The UnitEditor unit This unit builds the TSourceNotebook (=form) that the editors are held on. It also has a...
Ler documento completo
Por favor, assinar para o acesso.