Changeset 54 for trunk/IDE/Forms


Ignore:
Timestamp:
Jun 26, 2012, 7:41:11 AM (12 years ago)
Author:
chronos
Message:
  • Modified: Project instance is now freed in closed state.
  • Added: Toolbar button Open now provide dropdown list of recent opened projects.
Location:
trunk/IDE/Forms
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/IDE/Forms/UFormMain.lfm

    r53 r54  
    4343      Top = 2
    4444      Action = AProjectOpen
     45      DropdownMenu = PopupMenu1
     46      Style = tbsDropDown
    4547    end
    4648    object ToolButton3: TToolButton
    47       Left = 47
     49      Left = 59
    4850      Top = 2
    4951      Action = AProjectSave
    5052    end
    5153    object ToolButton4: TToolButton
    52       Left = 70
     54      Left = 82
    5355      Top = 2
    5456      Action = AProjectClose
    5557    end
    5658    object ToolButton5: TToolButton
    57       Left = 93
     59      Left = 105
    5860      Top = 2
    5961      Width = 10
     
    6163    end
    6264    object ToolButton6: TToolButton
    63       Left = 103
     65      Left = 115
    6466      Top = 2
    6567      Action = AViewOptions
    6668    end
    6769    object ToolButton7: TToolButton
    68       Left = 126
     70      Left = 138
    6971      Top = 2
    7072      Action = ABuild
    7173    end
    7274    object ToolButton8: TToolButton
    73       Left = 149
     75      Left = 161
    7476      Top = 2
    7577      Action = ARun
    7678    end
    7779    object ToolButton9: TToolButton
    78       Left = 172
     80      Left = 184
    7981      Top = 2
    8082      Action = APause
    8183    end
    8284    object ToolButton10: TToolButton
    83       Left = 195
     85      Left = 207
    8486      Top = 2
    8587      Action = AStop
     
    869871  end
    870872  object ImageList1: TImageList
    871     left = 344
    872     top = 184
     873    left = 112
     874    top = 272
    873875    Bitmap = {
    874876      4C690E0000001000000010000000000000000000000000000000000000000000
     
    13231325    }
    13241326  end
     1327  object PopupMenu1: TPopupMenu
     1328    left = 196
     1329    top = 54
     1330  end
    13251331end
  • trunk/IDE/Forms/UFormMain.pas

    r53 r54  
    8888    PageControlRight: TPageControl;
    8989    PageControlBottom: TPageControl;
     90    PopupMenu1: TPopupMenu;
    9091    SaveDialog1: TSaveDialog;
    9192    Splitter1: TSplitter;
     
    144145    procedure DockInit;
    145146    procedure UpdateMenu;
    146     procedure UpdateToolbar;
     147    procedure UpdateTitle;
    147148  public
    148149    procedure LoadFromRegistry(Root: HKEY; Key: string);
     
    290291
    291292procedure TFormMain.UpdateInterface;
    292 var
    293   I: Integer;
    294   Title: string;
    295293begin
    296294  with Core do begin
    297   Title := ApplicationInfo.Name;
    298   if Project.FileName <> '' then Title := Project.FileName + ' - ' + Title;
    299   if Project.Modified then Title := Title + ' *';
    300   Caption := Title;
    301   AProjectClose.Enabled := Project.Active;
    302   AProjectSave.Enabled := Project.Active and Project.Modified;
    303   AProjectSaveAs.Enabled := Project.Active;
     295  UpdateTitle;
     296  AProjectClose.Enabled := Assigned(Project);
     297  AProjectSave.Enabled := Assigned(Project) and Project.Modified;
     298  AProjectSaveAs.Enabled := Assigned(Project);
    304299  (*AProgramRun.Enabled := Project.Active and (BrainFuckInterpreter.State = rsStopped);
    305300  AProgramPause.Enabled := Project.Active and (BrainFuckInterpreter.State = rsRunning);
    306301  AProgramStop.Enabled := Project.Active and (BrainFuckInterpreter.State <> rsStopped);*)
    307   ABuild.Enabled := Project.Active and Assigned(Compiler.Target) and
     302  ABuild.Enabled := Assigned(Project) and Assigned(Compiler.Target) and
    308303    Assigned(Compiler.Target.Producer);
    309   APause.Enabled := Project.Active and Assigned(Compiler.Target) and
     304  APause.Enabled := Assigned(Project) and Assigned(Compiler.Target) and
    310305    Assigned(Compiler.Target.Executor) and (Compiler.Target.Executor.State = rsRunning);
    311   ARun.Enabled := Project.Active and Assigned(Compiler.Target) and
     306  ARun.Enabled := Assigned(Project) and Assigned(Compiler.Target) and
    312307    Assigned(Compiler.Target.Executor) and ((Compiler.Target.Executor.State = rsStopped) or
    313308    (Compiler.Target.Executor.State = rsPaused));
    314   AStop.Enabled := Project.Active and Assigned(Compiler.Target) and
     309  AStop.Enabled := Assigned(Project) and Assigned(Compiler.Target) and
    315310    Assigned(Compiler.Target.Executor) and ((Compiler.Target.Executor.State = rsRunning) or
    316311    (Compiler.Target.Executor.State = rsPaused));
    317   AStepIn.Enabled := Project.Active and Assigned(Compiler.Target) and
     312  AStepIn.Enabled := Assigned(Project) and Assigned(Compiler.Target) and
    318313    Assigned(Compiler.Target.Executor) and ((Compiler.Target.Executor.State = rsRunning) or
    319314    (Compiler.Target.Executor.State = rsPaused));
     
    324319
    325320  UpdateMenu;
    326   UpdateToolbar;
    327321  FormSourceCode.UpdateInterface;
    328322  FormTargetCode.UpdateInterface;
     
    443437end;
    444438
    445 procedure TFormMain.UpdateToolbar;
    446 var
    447   I: Integer;
    448 begin
    449   for I := 0 to ToolBar1.ButtonCount - 1 do
    450     TToolButton(ToolBar1.Buttons[I]).Hint := TToolButton(ToolBar1.Buttons[I]).Caption;
     439procedure TFormMain.UpdateTitle;
     440var
     441  Title: string;
     442begin
     443  Title := ApplicationInfo.Name;
     444  if Assigned(Core.Project) then begin
     445    if Core.Project.FileName <> '' then Title := Core.Project.FileName + ' - ' + Title;
     446    if Core.Project.Modified then Title := Title + ' *';
     447  end;
     448  Caption := Title;
    451449end;
    452450
     
    503501begin
    504502  //if Project.Modified then ;
    505   Core.Project.Active := False;
     503  FreeAndNil(Core.Project);
    506504  UpdateInterface;
    507505end;
     
    532530begin
    533531  if FormProjectNew.ShowModal = mrOk then begin
    534     if Assigned(FormProjectNew.ListView1.Selected) then
     532    if Assigned(FormProjectNew.ListView1.Selected) then begin
     533      Core.ProjectNew;
    535534      TProjectTemplate(FormProjectNew.ListView1.Selected.Data).InitProject(Core.Project);
     535    end;
    536536  end;
    537537  UpdateInterface;
     
    540540procedure TFormMain.AProjectSaveAsExecute(Sender: TObject);
    541541begin
     542  if Assigned(Core.Project) then
    542543  if SaveDialog1.Execute then begin
    543     Core.Project.Active := True;
    544544    Core.Project.SaveToFile(SaveDialog1.FileName);
    545545    FormSourceCode.Save;
  • trunk/IDE/Forms/UFormProject.pas

    r53 r54  
    7474    BeginUpdate;
    7575    Clear;
    76     if Project.Active then begin
     76    if Assigned(Project) then begin
    7777      NewNode := AddChild(nil, ExtractFileNameOnly(Project.FileName));
    7878      UpdateProjectFiles(NewNode, Project.Files);
  • trunk/IDE/Forms/UFormSourceCode.pas

    r53 r54  
    4040procedure TFormSourceCode.SynEditSourceChange(Sender: TObject);
    4141begin
    42   if Core.Project.Active then
     42  if Assigned(Core.Project) then
    4343    ProjectFile.Modified := True;
    4444end;
     
    6161procedure TFormSourceCode.UpdateInterface;
    6262begin
    63   SynEditSource.Enabled := Core.Project.Active;
    64   if not Core.Project.Active then SynEditSource.ClearAll;
     63  SynEditSource.Enabled := Assigned(Core.Project);
     64  if not Assigned(Core.Project) then SynEditSource.ClearAll;
    6565end;
    6666
  • trunk/IDE/Forms/UFormTargetCode.pas

    r53 r54  
    4848procedure TFormTargetCode.UpdateInterface;
    4949begin
    50   SynEdit1.Enabled := Core.Project.Active;
    51   if not Core.Project.Active then SynEdit1.ClearAll;
     50  SynEdit1.Enabled := Assigned(Core.Project);
     51  if not Assigned(Core.Project) then SynEdit1.ClearAll;
    5252end;
    5353
  • trunk/IDE/Forms/UFormTargetProject.pas

    r53 r54  
    4141    BeginUpdate;
    4242    Clear;
    43     if Project.Active then begin
     43    if Assigned(Project) then begin
    4444      NewNode := AddChild(nil, ExtractFileNameOnly(TargetProject.FileName));
    4545      UpdateProjectFiles(NewNode, TargetProject.Files);
Note: See TracChangeset for help on using the changeset viewer.