Changeset 61 for branches/Transpascal/Forms/UMainForm.pas
- Timestamp:
- Oct 14, 2010, 2:30:40 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Transpascal/Forms/UMainForm.pas
r60 r61 7 7 uses 8 8 SysUtils, Variants, Classes, Graphics, Controls, Forms, 9 Dialogs, StdCtrls, U SourceCode, UCompiler, UProducerAsm8051,9 Dialogs, StdCtrls, UCompiler, UProducerAsm8051, 10 10 UProducerC, ComCtrls, ExtCtrls, SynEdit, SynHighlighterPas, UProducerTreeView, 11 UProducerPascal, Contnrs, UProject, FileUtil, Menus, ActnList ;11 UProducerPascal, Contnrs, UProject, FileUtil, Menus, ActnList, UCoolDocking; 12 12 13 13 const … … 18 18 19 19 TMainForm = class(TForm) 20 ABuild: TAction; 20 21 AProjectNew: TAction; 21 22 AProjectOpen: TAction; … … 24 25 AProjectClose: TAction; 25 26 ActionList1: TActionList; 26 Button Compile: TButton;27 Button1: TButton; 27 28 ComboBox1: TComboBox; 28 ListBoxMessages: TListBox; 29 CoolDockClient1: TCoolDockClient; 30 CoolDockMaster1: TCoolDockMaster; 29 31 MainMenu1: TMainMenu; 30 32 MenuItem1: TMenuItem; … … 34 36 MenuItem5: TMenuItem; 35 37 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; 41 41 Splitter3: TSplitter; 42 SynEditSource: TSynEdit; 43 SynPasSyn1: TSynPasSyn; 44 TreeViewProject: TTreeView; 42 ToolBar1: TToolBar; 45 43 procedure ComboBox1Change(Sender: TObject); 46 44 procedure FormShow(Sender: TObject); … … 59 57 procedure UpdateProjectGroup(Node: TTreeNode; Group: TProjectGroup); 60 58 function GetSource(Name: string; Source: TStringList): Boolean; 59 procedure DockInit; 61 60 public 62 61 Project: TProject; … … 72 71 {$R *.lfm} 73 72 73 uses 74 UMessagesForm, UCodeForm, UProjectManager; 75 74 76 { TMainForm } 75 77 … … 95 97 Compiler.Producer := TProducerTreeView.Create; 96 98 ProducerControl := TTreeView.Create(Self); 97 ProducerControl.Parent := Panel1;99 ProducerControl.Parent := DockPanel; 98 100 ProducerControl.Align := alClient; 99 101 // TProducerTreeView(Compiler.Producer).TreeView := TTreeView(ProducerControl); … … 109 111 if ComboBox1.ItemIndex = 0 then begin 110 112 ProducerControl := TMemo.Create(Self); 111 ProducerControl.Parent := Panel1;113 ProducerControl.Parent := DockPanel; 112 114 ProducerControl.Align := alClient; 113 115 ProducerControl.Font.Name := 'Courier New'; … … 116 118 if ComboBox1.ItemIndex = 1 then begin 117 119 ProducerControl := TMemo.Create(Self); 118 ProducerControl.Parent := Panel1;120 ProducerControl.Parent := DockPanel; 119 121 ProducerControl.Align := alClient; 120 122 ProducerControl.Font.Name := 'Courier New'; … … 123 125 if ComboBox1.ItemIndex = 2 then begin 124 126 ProducerControl := TMemo.Create(Self); 125 ProducerControl.Parent := Panel1;127 ProducerControl.Parent := DockPanel; 126 128 ProducerControl.Align := alClient; 127 129 ProducerControl.Font.Name := 'Courier New'; … … 138 140 ProjectFile: TProjectFile; 139 141 begin 142 with MessagesForm, CodeForm do 140 143 if ListBoxMessages.ItemIndex <> -1 then 141 144 with TErrorMessage(Compiler.ErrorMessages[ListBoxMessages.ItemIndex]) do begin … … 163 166 I: Integer; 164 167 begin 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); 188 174 end; 189 175 end; … … 193 179 NewNode: TTreeNode; 194 180 begin 195 with TreeViewProject, Items do begin181 with ProjectManager, TreeViewProject, Items do begin 196 182 BeginUpdate; 197 183 Clear; … … 200 186 NewNode.Expand(True); 201 187 EndUpdate; 202 end;203 TreeViewProject.TopItem.Items[0].Selected := True;188 TreeViewProject.TopItem.Items[0].Selected := True; 189 end; 204 190 end; 205 191 … … 209 195 NewNode: TTreeNode; 210 196 begin 197 with ProjectManager do 211 198 for I := 0 to Group.Items.Count - 1 do begin 212 199 NewNode := TreeViewProject.Items.AddChild(Node, … … 229 216 end; 230 217 218 procedure TMainForm.DockInit; 219 var 220 Container1: TCoolDockConjoinForm; 221 begin 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; 237 end; 238 231 239 procedure TMainForm.FormClose(Sender: TObject; var Action: TCloseAction); 232 240 begin … … 250 258 NewProjectFile: TProjectFile; 251 259 begin 260 DockInit; 261 252 262 Project.RootDir := '../../Project/'; 253 263 Project.Name := 'Project';
Note:
See TracChangeset
for help on using the changeset viewer.