Changeset 12


Ignore:
Timestamp:
Aug 3, 2012, 3:17:28 PM (12 years ago)
Author:
chronos
Message:
  • Modified: Some base project manager actions handling.
Location:
trunk/StudioModules
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/StudioModules/LDModuleDebug/ULDModuleDebug.pas

    r11 r12  
    4747  Identification := 'Debug';
    4848  Title := SDebug;
     49  Version := '0.1';
     50  License := 'GNU/LGPLv3';
    4951end;
    5052
  • trunk/StudioModules/LDModulePascal/ULDModulePascal.pas

    r11 r12  
    3838  Title := SPascal;
    3939  Version := '0.1';
     40  License := 'GNU/LGPLv3';
    4041end;
    4142
  • trunk/StudioModules/LDModuleProject/ULDModuleProject.lfm

    r11 r12  
    11object DataModuleProject: TDataModuleProject
     2  OnDestroy = DataModuleDestroy
    23  OldCreateOrder = False
    34  Height = 328
     
    78  object ActionList1: TActionList
    89    left = 208
    9     top = 176
     10    top = 171
    1011    object ANew: TAction
    1112      Caption = 'New'
     13      OnExecute = ANewExecute
    1214    end
    1315    object AOpen: TAction
    1416      Caption = 'Open...'
     17      OnExecute = AOpenExecute
    1518    end
    1619    object AOpenRecent: TAction
     
    1922    object ASave: TAction
    2023      Caption = 'Save'
     24      OnExecute = ASaveExecute
    2125    end
    2226    object ASaveAs: TAction
    2327      Caption = 'Save as...'
     28      OnExecute = ASaveAsExecute
    2429    end
    2530    object AClose: TAction
    2631      Caption = 'Close'
     32      OnExecute = ACloseExecute
    2733    end
    2834    object AProjectManager: TAction
    2935      Caption = 'Project manager'
     36      OnExecute = AProjectManagerExecute
    3037    end
    3138  end
     
    5865    end
    5966  end
     67  object OpenDialog1: TOpenDialog
     68    left = 125
     69    top = 120
     70  end
     71  object SaveDialog1: TSaveDialog
     72    left = 208
     73    top = 120
     74  end
    6075end
  • trunk/StudioModules/LDModuleProject/ULDModuleProject.pas

    r11 r12  
    66
    77uses
    8   Classes, SysUtils, FileUtil, ActnList, Menus, UModularSystem;
     8  Classes, SysUtils, FileUtil, ActnList, Menus, Dialogs, UModularSystem,
     9  UProject;
    910
    1011type
     
    2930    MenuItem7: TMenuItem;
    3031    MenuItem8: TMenuItem;
     32    OpenDialog1: TOpenDialog;
    3133    PopupMenu1: TPopupMenu;
     34    SaveDialog1: TSaveDialog;
     35    procedure ACloseExecute(Sender: TObject);
     36    procedure ANewExecute(Sender: TObject);
     37    procedure AOpenExecute(Sender: TObject);
     38    procedure AProjectManagerExecute(Sender: TObject);
     39    procedure ASaveAsExecute(Sender: TObject);
     40    procedure ASaveExecute(Sender: TObject);
     41    procedure DataModuleDestroy(Sender: TObject);
    3242  private
    3343    { private declarations }
    3444  public
    35     { public declarations }
     45    Project: TProject;
     46    procedure UpdateInterface;
    3647  end;
    3748
     
    5869  SProject = 'Project';
    5970
     71{ TDataModuleProject }
     72
     73procedure TDataModuleProject.AProjectManagerExecute(Sender: TObject);
     74begin
     75  FormProject.Show;
     76end;
     77
     78procedure TDataModuleProject.ASaveAsExecute(Sender: TObject);
     79begin
     80  SaveDialog1.FileName := Project.FileName;
     81  if SaveDialog1.Execute then begin
     82    Project.FileName := SaveDialog1.FileName;
     83    Project.Save;
     84    UpdateInterface;
     85  end;
     86end;
     87
     88procedure TDataModuleProject.ASaveExecute(Sender: TObject);
     89begin
     90  if Project.Modified then ASaveAs.Execute
     91    else Project.Save;
     92  UpdateInterface;
     93end;
     94
     95procedure TDataModuleProject.DataModuleDestroy(Sender: TObject);
     96begin
     97  AClose.Execute;
     98end;
     99
     100procedure TDataModuleProject.UpdateInterface;
     101begin
     102  ASave.Enabled := Assigned(Project) and Project.Modified;
     103  ASaveAs.Enabled := Assigned(Project);
     104  AClose.Enabled := Assigned(Project);
     105end;
     106
     107procedure TDataModuleProject.ACloseExecute(Sender: TObject);
     108begin
     109  if Project.Modified then ASaveAs.Execute;
     110  FreeAndNil(Project);
     111  UpdateInterface;
     112end;
     113
     114procedure TDataModuleProject.ANewExecute(Sender: TObject);
     115begin
     116  Project := TProject.Create;
     117  UpdateInterface;
     118end;
     119
     120procedure TDataModuleProject.AOpenExecute(Sender: TObject);
     121begin
     122  OpenDialog1.FileName := Project.FileName;
     123  if OpenDialog1.Execute then begin
     124    Project.FileName := OpenDialog1.FileName;
     125    Project.Load;
     126    UpdateInterface;
     127  end;
     128end;
     129
    60130{ TLDModuleProject }
    61131
     
    74144    DataModuleProject := TDataModuleProject.Create(nil);
    75145    FormProject := TFormProject.Create(nil);
     146    FormProject.API := TLDStudioAPI(API);
    76147    DataModuleProject.PopupMenu1.Items.Caption := SProject;
    77148    RegisterMainMenuItem(DataModuleProject.PopupMenu1.Items, nil, 1);
Note: See TracChangeset for help on using the changeset viewer.