Changeset 9


Ignore:
Timestamp:
Aug 3, 2012, 1:34:09 PM (12 years ago)
Author:
chronos
Message:
  • Added: Form for application runtime module management.
Location:
trunk
Files:
5 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Studio/UCore.pas

    r8 r9  
    1818    procedure RegisterModules;
    1919  public
    20     ModuleManager: TModuleManager;
    21     API: TLDStudioAPI;
    2220    procedure Init;
    2321  end;
     
    3836begin
    3937  DataModule1 := TDataModule1.Create(nil);
    40   API := TLDStudioAPI.Create;
    41   ModuleManager := TModuleManager.Create(nil);
    42   ModuleManager.API := API;
    4338end;
    4439
    4540procedure TCore.DataModuleDestroy(Sender: TObject);
    4641begin
    47   FreeAndNil(ModuleManager);
    48   FreeAndNil(API);
    4942  FreeAndNil(DataModule1);
    5043end;
     
    5245procedure TCore.RegisterModules;
    5346begin
    54   ModuleManager.RegisterModule(TLDModuleDebug.Create, True);
    55   ModuleManager.RegisterModule(TLDModuleBrainfuck.Create, True);
    56   ModuleManager.RegisterModule(TLDModulePascal.Create, True);
    57   ModuleManager.InstallMarked;
     47  with DataModule1.ModuleManager do begin
     48    RegisterModule(TLDModuleDebug.Create, True);
     49    RegisterModule(TLDModuleBrainfuck.Create, True);
     50    RegisterModule(TLDModulePascal.Create, True);
     51    InstallMarked;
     52  end;
    5853end;
    5954
    6055procedure TCore.Init;
    6156begin
    62   TLDStudioAPI(ModuleManager.API).MainForm := FormMain;
    63   TLDStudioAPI(ModuleManager.API).MainMenu := FormMain.MainMenu;
    64   TLDStudioAPI(ModuleManager.API).FileTypes := DataModule1.FileTypes;
    6557  RegisterModules;
    6658end;
  • trunk/StudioPackage/Forms/UFormMain.lfm

    r8 r9  
    11object FormMain: TFormMain
    2   Left = 265
     2  Left = 256
    33  Height = 520
    4   Top = 144
     4  Top = 122
    55  Width = 747
    66  Caption = 'LibreDevelop Studio'
     
    391391    object MenuItem2: TMenuItem
    392392      Caption = 'Edit'
     393      object MenuItem36: TMenuItem
     394        Action = AUndo
     395      end
     396      object MenuItem35: TMenuItem
     397        Action = ARedo
     398      end
     399      object MenuItem18: TMenuItem
     400        Caption = '-'
     401      end
    393402      object MenuItem4: TMenuItem
    394403        Action = AClipboardCopy
     
    508517        }
    509518      end
     519      object MenuItem47: TMenuItem
     520        Action = ADelete
     521      end
    510522      object MenuItem7: TMenuItem
    511523        Action = ASelectAll
     524      end
     525    end
     526    object MenuItem37: TMenuItem
     527      Caption = 'Search'
     528      object MenuItem38: TMenuItem
     529        Action = ASearch
     530      end
     531      object MenuItem39: TMenuItem
     532        Action = ASearchInFiles
     533      end
     534      object MenuItem40: TMenuItem
     535        Action = AFindNext
     536      end
     537      object MenuItem41: TMenuItem
     538        Action = AFindPrevious
     539      end
     540      object MenuItem42: TMenuItem
     541        Caption = '-'
     542      end
     543      object MenuItem43: TMenuItem
     544        Action = AReplace
     545      end
     546      object MenuItem44: TMenuItem
     547        Action = AReplaceInFiles
     548      end
     549      object MenuItem45: TMenuItem
     550        Caption = '-'
     551      end
     552      object MenuItem46: TMenuItem
     553        Action = AGoToLineNumber
    512554      end
    513555    end
     
    571613        }
    572614      end
     615      object MenuItem48: TMenuItem
     616        Action = AViewModules
     617      end
    573618    end
    574619    object MenuItem17: TMenuItem
     
    718763      Caption = 'Close'
    719764      ImageIndex = 3
     765      OnExecute = AFileCloseExecute
     766    end
     767    object AUndo: TAction
     768      Category = 'File'
     769      Caption = 'Undo'
     770    end
     771    object ARedo: TAction
     772      Category = 'File'
     773      Caption = 'Redo'
     774    end
     775    object ASearch: TAction
     776      Category = 'Search'
     777      Caption = 'Search'
     778    end
     779    object AReplace: TAction
     780      Category = 'Search'
     781      Caption = 'Replace'
     782    end
     783    object ASearchInFiles: TAction
     784      Category = 'Search'
     785      Caption = 'Search in files'
     786    end
     787    object AGoToLineNumber: TAction
     788      Category = 'Search'
     789      Caption = 'Go to line number...'
     790    end
     791    object AReplaceInFiles: TAction
     792      Category = 'Search'
     793      Caption = 'Replace in files'
     794    end
     795    object AFindNext: TAction
     796      Category = 'Search'
     797      Caption = 'Find next'
     798      ShortCut = 114
     799    end
     800    object AFindPrevious: TAction
     801      Category = 'Search'
     802      Caption = 'Find previous'
     803      ShortCut = 8306
     804    end
     805    object ADelete: TAction
     806      Category = 'Edit'
     807      Caption = 'Delete'
     808    end
     809    object AViewModules: TAction
     810      Caption = 'Modules'
     811      OnExecute = AViewModulesExecute
    720812    end
    721813  end
  • trunk/StudioPackage/Forms/UFormMain.lrt

    r7 r9  
    1010TFORMMAIN.MENUITEM13.CAPTION=-
    1111TFORMMAIN.MENUITEM2.CAPTION=Edit
     12TFORMMAIN.MENUITEM18.CAPTION=-
     13TFORMMAIN.MENUITEM37.CAPTION=Search
     14TFORMMAIN.MENUITEM42.CAPTION=-
     15TFORMMAIN.MENUITEM45.CAPTION=-
    1216TFORMMAIN.MENUITEM20.CAPTION=Build
    1317TFORMMAIN.MENUITEM16.CAPTION=Tools
     
    4953TFORMMAIN.AFILESAVEAS.CAPTION=Save as...
    5054TFORMMAIN.AFILECLOSE.CAPTION=Close
     55TFORMMAIN.AUNDO.CAPTION=Undo
     56TFORMMAIN.AREDO.CAPTION=Redo
     57TFORMMAIN.ASEARCH.CAPTION=Search
     58TFORMMAIN.AREPLACE.CAPTION=Replace
     59TFORMMAIN.ASEARCHINFILES.CAPTION=Search in files
     60TFORMMAIN.AGOTOLINENUMBER.CAPTION=Go to line number...
     61TFORMMAIN.AREPLACEINFILES.CAPTION=Replace in files
     62TFORMMAIN.AFINDNEXT.CAPTION=Find next
     63TFORMMAIN.AFINDPREVIOUS.CAPTION=Find previous
     64TFORMMAIN.ADELETE.CAPTION=Delete
     65TFORMMAIN.AVIEWMODULES.CAPTION=Modules
  • trunk/StudioPackage/Forms/UFormMain.pas

    r8 r9  
    1818    ABuild: TAction;
    1919    ABuildClean: TAction;
     20    AViewModules: TAction;
     21    ADelete: TAction;
     22    AFindNext: TAction;
     23    AFindPrevious: TAction;
     24    AReplaceInFiles: TAction;
     25    AGoToLineNumber: TAction;
     26    ASearchInFiles: TAction;
     27    ASearch: TAction;
     28    AReplace: TAction;
     29    AUndo: TAction;
     30    ARedo: TAction;
    2031    AFileOpenRecent: TAction;
    2132    AFileNew: TAction;
     
    5061    MenuItem16: TMenuItem;
    5162    MenuItem17: TMenuItem;
     63    MenuItem18: TMenuItem;
    5264    MenuItem19: TMenuItem;
    5365    MenuItem2: TMenuItem;
     
    6880    MenuItem33: TMenuItem;
    6981    MenuItem34: TMenuItem;
     82    MenuItem35: TMenuItem;
     83    MenuItem36: TMenuItem;
     84    MenuItem37: TMenuItem;
     85    MenuItem38: TMenuItem;
     86    MenuItem39: TMenuItem;
    7087    MenuItem4: TMenuItem;
     88    MenuItem40: TMenuItem;
     89    MenuItem41: TMenuItem;
     90    MenuItem42: TMenuItem;
     91    MenuItem43: TMenuItem;
     92    MenuItem44: TMenuItem;
     93    MenuItem45: TMenuItem;
     94    MenuItem46: TMenuItem;
     95    MenuItem47: TMenuItem;
     96    MenuItem48: TMenuItem;
    7197    MenuItem5: TMenuItem;
    7298    MenuItem6: TMenuItem;
     
    93119    ToolButton4: TToolButton;
    94120    procedure AExitExecute(Sender: TObject);
     121    procedure AFileCloseExecute(Sender: TObject);
    95122    procedure AFileOpenExecute(Sender: TObject);
     123    procedure AViewModulesExecute(Sender: TObject);
    96124    procedure AViewProjectManagerExecute(Sender: TObject);
    97125    procedure AViewSettingsExecute(Sender: TObject);
     
    112140
    113141uses
    114   UFormProject, UFormSourceCode, UFormSettings;
     142  UFormProject, UFormSourceCode, UFormSettings, UFormModuleList;
    115143
    116144{ TFormMain }
     
    119147begin
    120148  Application.Terminate;
     149end;
     150
     151procedure TFormMain.AFileCloseExecute(Sender: TObject);
     152begin
     153//  DataModule1.OpenedFiles.Close(DataModule1.OpenedFiles.Selected);
    121154end;
    122155
     
    127160    DataModule1.OpenedFiles.OpenFile(OpenDialogFile.FileName);
    128161  end;
     162end;
     163
     164procedure TFormMain.AViewModulesExecute(Sender: TObject);
     165begin
     166  FormModuleList.ModuleManager := DataModule1.ModuleManager;
     167  FormModuleList.Show;
    129168end;
    130169
  • trunk/StudioPackage/LibreDevelopStudio.lpk

    r6 r9  
    2323      </Other>
    2424    </CompilerOptions>
    25     <Files Count="6">
     25    <Files Count="7">
    2626      <Item1>
    2727        <Filename Value="Forms\UFormMain.pas"/>
     
    4848        <UnitName Value="UFormSettings"/>
    4949      </Item6>
     50      <Item7>
     51        <Filename Value="Forms\UFormModuleList.pas"/>
     52        <UnitName Value="UFormModuleList"/>
     53      </Item7>
    5054    </Files>
    5155    <i18n>
  • trunk/StudioPackage/LibreDevelopStudio.pas

    r6 r9  
    99uses
    1010  UFormMain, UProject, UDataModule, UFormProject, UFormSourceCode,
    11   UFormSettings, LazarusPackageIntf;
     11  UFormSettings, UFormModuleList, LazarusPackageIntf;
    1212
    1313implementation
  • trunk/StudioPackage/UDataModule.pas

    r8 r9  
    66
    77uses
    8   Classes, SysUtils, FileUtil, UProject, Forms, SpecializedList, USource;
     8  Classes, SysUtils, FileUtil, UProject, Forms, SpecializedList, USource,
     9  UModularSystem, ULDStudioAPI;
    910
    1011type
     
    3031    FOnOpenFile: TOpenFileEvent;
    3132  public
     33    Selected: TOpenedFile;
     34    procedure CloseFile(OpenedFile: TOpenedFile);
    3235    procedure OpenFile(FileName: string);
    3336    procedure NewFile;
     
    4144    procedure DataModuleDestroy(Sender: TObject);
    4245  private
    43     { private declarations }
     46    API: TLDStudioAPI;
    4447  public
     48    ModuleManager: TModuleManager;
    4549    Project: TProject;
    4650    FileTypes: TFileTypes;
     
    5761
    5862uses
    59   UFormSourceCode, UFormMain, UFormProject, UFormSettings;
     63  UFormSourceCode, UFormMain, UFormProject, UFormSettings, UFormModuleList;
    6064
    6165procedure TOpenedFile.SetFileName(AValue: string);
     
    6973{ TOpenedFiles }
    7074
     75procedure TOpenedFiles.CloseFile(OpenedFile: TOpenedFile);
     76begin
     77  FreeAndNil(OpenedFile.Form);
     78end;
     79
    7180procedure TOpenedFiles.OpenFile(FileName: string);
    7281var
     
    7887  NewFile.Form.Caption := ExtractFileName(NewFile.FileName);
    7988  NewFile.Form.Visible := True;
     89  Selected := NewFile;
    8090  if Assigned(FOnOpenFile) then
    8191    FOnOpenFile(NewFile);
     
    94104  FileTypes.OwnsObjects := False;
    95105  OpenedFiles := TOpenedFiles.Create;
     106  API := TLDStudioAPI.Create;
     107  ModuleManager := TModuleManager.Create(nil);
     108  ModuleManager.API := API;
    96109
    97110  Application.CreateForm(TFormMain, FormMain);
     
    100113  Application.CreateForm(TFormSourceCode, FormSourceCode);
    101114  Application.CreateForm(TFormSettings, FormSettings);
     115  Application.CreateForm(TFormModuleList, FormModuleList);
     116
     117  TLDStudioAPI(ModuleManager.API).MainForm := FormMain;
     118  TLDStudioAPI(ModuleManager.API).MainMenu := FormMain.MainMenu;
     119  TLDStudioAPI(ModuleManager.API).FileTypes := FileTypes;
    102120end;
    103121
    104122procedure TDataModule1.DataModuleDestroy(Sender: TObject);
    105123begin
     124  FreeAndNil(ModuleManager);
     125  FreeAndNil(API);
    106126  FreeAndNil(OpenedFiles);
    107127  FreeAndNil(FileTypes);
Note: See TracChangeset for help on using the changeset viewer.