Ignore:
Timestamp:
Oct 14, 2010, 2:30:40 PM (14 years ago)
Author:
george
Message:
  • Added: Separated dockable windows.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/Transpascal/Forms/UMainForm.pas

    r60 r61  
    77uses
    88  SysUtils, Variants, Classes, Graphics, Controls, Forms,
    9   Dialogs, StdCtrls, USourceCode, UCompiler, UProducerAsm8051,
     9  Dialogs, StdCtrls, UCompiler, UProducerAsm8051,
    1010  UProducerC, ComCtrls, ExtCtrls, SynEdit, SynHighlighterPas, UProducerTreeView,
    11   UProducerPascal, Contnrs, UProject, FileUtil, Menus, ActnList;
     11  UProducerPascal, Contnrs, UProject, FileUtil, Menus, ActnList, UCoolDocking;
    1212
    1313const
     
    1818
    1919  TMainForm = class(TForm)
     20    ABuild: TAction;
    2021    AProjectNew: TAction;
    2122    AProjectOpen: TAction;
     
    2425    AProjectClose: TAction;
    2526    ActionList1: TActionList;
    26     ButtonCompile: TButton;
     27    Button1: TButton;
    2728    ComboBox1: TComboBox;
    28     ListBoxMessages: TListBox;
     29    CoolDockClient1: TCoolDockClient;
     30    CoolDockMaster1: TCoolDockMaster;
    2931    MainMenu1: TMainMenu;
    3032    MenuItem1: TMenuItem;
     
    3436    MenuItem5: TMenuItem;
    3537    MenuItem6: TMenuItem;
    36     Panel1: TPanel;
    37     Panel2: TPanel;
    38     Panel3: TPanel;
    39     Splitter1: TSplitter;
    40     Splitter2: TSplitter;
     38    MenuItem7: TMenuItem;
     39    MenuItem8: TMenuItem;
     40    DockPanel: TPanel;
    4141    Splitter3: TSplitter;
    42     SynEditSource: TSynEdit;
    43     SynPasSyn1: TSynPasSyn;
    44     TreeViewProject: TTreeView;
     42    ToolBar1: TToolBar;
    4543    procedure ComboBox1Change(Sender: TObject);
    4644    procedure FormShow(Sender: TObject);
     
    5957    procedure UpdateProjectGroup(Node: TTreeNode; Group: TProjectGroup);
    6058    function GetSource(Name: string; Source: TStringList): Boolean;
     59    procedure DockInit;
    6160  public
    6261    Project: TProject;
     
    7271{$R *.lfm}
    7372
     73uses
     74  UMessagesForm, UCodeForm, UProjectManager;
     75
    7476{ TMainForm }
    7577
     
    9597    Compiler.Producer := TProducerTreeView.Create;
    9698    ProducerControl := TTreeView.Create(Self);
    97     ProducerControl.Parent := Panel1;
     99    ProducerControl.Parent := DockPanel;
    98100    ProducerControl.Align := alClient;
    99101//    TProducerTreeView(Compiler.Producer).TreeView := TTreeView(ProducerControl);
     
    109111  if ComboBox1.ItemIndex = 0 then begin
    110112    ProducerControl := TMemo.Create(Self);
    111     ProducerControl.Parent := Panel1;
     113    ProducerControl.Parent := DockPanel;
    112114    ProducerControl.Align := alClient;
    113115    ProducerControl.Font.Name := 'Courier New';
     
    116118  if ComboBox1.ItemIndex = 1 then begin
    117119    ProducerControl := TMemo.Create(Self);
    118     ProducerControl.Parent := Panel1;
     120    ProducerControl.Parent := DockPanel;
    119121    ProducerControl.Align := alClient;
    120122    ProducerControl.Font.Name := 'Courier New';
     
    123125  if ComboBox1.ItemIndex = 2 then begin
    124126    ProducerControl := TMemo.Create(Self);
    125     ProducerControl.Parent := Panel1;
     127    ProducerControl.Parent := DockPanel;
    126128    ProducerControl.Align := alClient;
    127129    ProducerControl.Font.Name := 'Courier New';
     
    138140  ProjectFile: TProjectFile;
    139141begin
     142  with MessagesForm, CodeForm do
    140143  if ListBoxMessages.ItemIndex <> -1 then
    141144  with TErrorMessage(Compiler.ErrorMessages[ListBoxMessages.ItemIndex]) do begin
     
    163166  I: Integer;
    164167begin
    165   ListBoxMessages.Clear;
    166   for I := 0 to Compiler.ErrorMessages.Count - 1 do
    167   with TErrorMessage(Compiler.ErrorMessages[I]) do
    168     MainForm.ListBoxMessages.Items.Add(FileName + '(' + IntToStr(Position.X) +
    169       ',' + IntToStr(Position.Y) + ') ' + Text);
    170 end;
    171 
    172 procedure TMainForm.TreeViewProjectChange(Sender: TObject; Node: TTreeNode);
    173 var
    174   FileName: string;
    175 begin
    176   if Assigned(Node) then begin
    177     if TProjectNode(Node.Data) is TProjectFile then begin
    178       SynEditSource.Lines.Assign(TProjectFile(Node.Data).Source);
    179       FileName := Compiler.CompiledFolder + DirectorySeparator +
    180         Compiler.Producer.ClassName + DirectorySeparator + ExtractFileNameOnly(TProjectFile(Node.Data).Name) + Compiler.Producer.FileExtension;
    181       if ProducerControl is TMemo then
    182         if FileExists(FileName) then
    183         TMemo(ProducerControl).Lines.LoadFromFile(FileName) else
    184           TMemo(ProducerControl).Lines.Clear;
    185       //if ProducerControl is TTreeView then
    186       //  TTreeView(ProducerControl).Assign(TProjectFile(Node.Data).ProducedCode);
    187     end;
     168  with MessagesForm do begin
     169    ListBoxMessages.Clear;
     170    for I := 0 to Compiler.ErrorMessages.Count - 1 do
     171    with TErrorMessage(Compiler.ErrorMessages[I]) do
     172      ListBoxMessages.Items.Add(FileName + '(' + IntToStr(Position.X) +
     173        ',' + IntToStr(Position.Y) + ') ' + Text);
    188174  end;
    189175end;
     
    193179  NewNode: TTreeNode;
    194180begin
    195   with TreeViewProject, Items do begin
     181  with ProjectManager, TreeViewProject, Items do begin
    196182    BeginUpdate;
    197183    Clear;
     
    200186    NewNode.Expand(True);
    201187    EndUpdate;
    202   end;
    203   TreeViewProject.TopItem.Items[0].Selected := True;
     188    TreeViewProject.TopItem.Items[0].Selected := True;
     189  end;
    204190end;
    205191
     
    209195  NewNode: TTreeNode;
    210196begin
     197  with ProjectManager do
    211198  for I := 0 to Group.Items.Count - 1 do begin
    212199    NewNode := TreeViewProject.Items.AddChild(Node,
     
    229216end;
    230217
     218procedure TMainForm.DockInit;
     219var
     220  Container1: TCoolDockConjoinForm;
     221begin
     222  ProjectManager.ManualDock(DockPanel, nil, alLeft);
     223  ProjectManager.Show;
     224
     225  Container1 := TCoolDockManager(DockPanel.DockManager).CreateContainer(alRight);
     226  Container1.Caption := 'Tools';
     227  Container1.Name := 'Tools';
     228  Container1.ManualDock(DockPanel, nil, alRight);
     229
     230  CodeForm.ManualDock(Container1.Panel, nil, alTop);
     231  CodeForm.Show;
     232  MessagesForm.ManualDock(Container1.Panel, nil, alBottom);
     233  MessagesForm.Show;
     234
     235  ProjectManager.Parent.Parent.Width := 200;
     236  CodeForm.Parent.Parent.Height := MainForm.Height;
     237end;
     238
    231239procedure TMainForm.FormClose(Sender: TObject; var Action: TCloseAction);
    232240begin
     
    250258  NewProjectFile: TProjectFile;
    251259begin
     260  DockInit;
     261
    252262  Project.RootDir := '../../Project/';
    253263  Project.Name := 'Project';
Note: See TracChangeset for help on using the changeset viewer.