From 9f2e572f6df217689d6a327e887b50ae425f29f6 Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Mon, 16 Jun 2014 09:15:11 +0200 Subject: [PATCH] r6 --- lazproj/test/coeditproj/test.coedit | 3 +- lazproj/test/src/bar.d | 1 + lazproj/test/src/foo.d | 1 + lazproj/test/src/main.d | 2 + src/ce_common.pas | 14 ++- src/ce_dmdwrap.pas | 1 + src/ce_editor.lfm | 44 +++---- src/ce_main.lfm | 56 +++++++-- src/ce_main.pas | 119 ++++++++++++++++--- src/ce_messages.lfm | 42 +++---- src/ce_messages.pas | 7 -- src/ce_projconf.lfm | 96 +++++++++------- src/ce_projconf.pas | 37 +++++- src/ce_project.lfm | 170 +++++++++++++++++----------- src/ce_project.pas | 26 ++++- src/ce_widget.lfm | 4 +- 16 files changed, 426 insertions(+), 197 deletions(-) diff --git a/lazproj/test/coeditproj/test.coedit b/lazproj/test/coeditproj/test.coedit index 1f6679be..6d59de15 100644 --- a/lazproj/test/coeditproj/test.coedit +++ b/lazproj/test/coeditproj/test.coedit @@ -34,7 +34,7 @@ object TCEProject documentationOptions.generateJSON = False documentationOptions.DocumentationDirectory = '..\doc' debugingOptions.debug = True - debugingOptions.debugIdentifier = '2' + debugingOptions.debugIdentifier = '1' debugingOptions.addDInformations = False debugingOptions.addCInformations = False debugingOptions.generateMapFile = False @@ -54,7 +54,6 @@ object TCEProject outputOptions.release = False outputOptions.unittest = True outputOptions.versionIdentifier = 'revision_1' - pathsOptions.outputFilename = '..\output\main.exe' end> Sources.Strings = ( '..\src\main.d' diff --git a/lazproj/test/src/bar.d b/lazproj/test/src/bar.d index 197dde19..27e6fcf6 100644 --- a/lazproj/test/src/bar.d +++ b/lazproj/test/src/bar.d @@ -12,5 +12,6 @@ class Bar{ debug(1) writeln("bar says: debug level < 2"); debug(2) writeln("bar says: debug level < 3"); debug(3) writeln("bar says: debug level < 4"); + } } diff --git a/lazproj/test/src/foo.d b/lazproj/test/src/foo.d index 59a6a07f..daad463c 100644 --- a/lazproj/test/src/foo.d +++ b/lazproj/test/src/foo.d @@ -12,5 +12,6 @@ class Foo{ debug(1) writeln("foo says: debug level < 2"); debug(2) writeln("foo says: debug level < 3"); debug(3) writeln("foo says: debug level < 4"); + } } diff --git a/lazproj/test/src/main.d b/lazproj/test/src/main.d index 0e15710f..d128ae53 100644 --- a/lazproj/test/src/main.d +++ b/lazproj/test/src/main.d @@ -17,4 +17,6 @@ void main(string args[]) { auto foo = new Foo; auto bar = new Bar; + + readln; } diff --git a/src/ce_common.pas b/src/ce_common.pas index 964b0b1f..7566976e 100644 --- a/src/ce_common.pas +++ b/src/ce_common.pas @@ -70,6 +70,7 @@ type procedure afterChanged; procedure reset; function getAbsoluteSourceName(const aIndex: integer): string; + function getAbsoluteFilename(const aFilename: string): string; procedure addSource(const aFilename: string); function addConfiguration: TCompilerConfiguration; function getOpts: string; @@ -222,8 +223,12 @@ begin end; procedure TCEProject.setOptsColl(const aValue: TCollection); +var + i: nativeInt; begin fOptsColl.Assign(aValue); + for i:= 0 to self.fOptsColl.Count-1 do + Configuration[i].onChanged := @subMemberChanged; end; procedure TCEProject.addSource(const aFilename: string); @@ -314,7 +319,7 @@ end; function TCEProject.getConfig(const ix: integer): TCompilerConfiguration; begin result := TCompilerConfiguration(fOptsColl.Items[ix]); - //result.onChanged := @subMemberChanged; + result.onChanged := @subMemberChanged; end; function TCEProject.getCurrConf: TCompilerConfiguration; @@ -374,7 +379,12 @@ function TCEProject.getAbsoluteSourceName(const aIndex: integer): string; begin if aIndex < 0 then exit; if aIndex > fSrcs.Count-1 then exit; - result := expandFileNameEx(fBasePath,fSrcs.Strings[aIndex]); + result := expandFileNameEx(fBasePath, fSrcs.Strings[aIndex]); +end; + +function TCEProject.getAbsoluteFilename(const aFilename: string): string; +begin + result := expandFileNameEx(fBasePath, aFilename); end; end. diff --git a/src/ce_dmdwrap.pas b/src/ce_dmdwrap.pas index aee0b484..16e6123c 100644 --- a/src/ce_dmdwrap.pas +++ b/src/ce_dmdwrap.pas @@ -713,6 +713,7 @@ end; destructor TCompilerConfiguration.destroy; begin + fOnChanged := nil; fDocOpts.free; fDebugOpts.free; fMsgOpts.free; diff --git a/src/ce_editor.lfm b/src/ce_editor.lfm index b6124ab2..9d942d2d 100644 --- a/src/ce_editor.lfm +++ b/src/ce_editor.lfm @@ -1,27 +1,27 @@ inherited CEEditorWidget: TCEEditorWidget - Left = 1167 - Height = 336 + Left = 1098 + Height = 405 Top = 89 - Width = 508 + Width = 556 BorderIcons = [biSystemMenu, biMinimize, biMaximize] - Caption = 'EditorWidget' - ClientHeight = 336 - ClientWidth = 508 + Caption = 'Source editor' + ClientHeight = 405 + ClientWidth = 556 inherited Back: TPanel - Height = 336 - Width = 508 - ClientHeight = 336 - ClientWidth = 508 + Height = 405 + Width = 556 + ClientHeight = 405 + ClientWidth = 556 inherited Content: TPanel - Height = 310 - Width = 508 - ClientHeight = 306 - ClientWidth = 504 + Height = 379 + Width = 556 + ClientHeight = 379 + ClientWidth = 556 object PageControl: TExtendedNotebook[0] - Left = 2 - Height = 279 - Top = 2 - Width = 500 + Left = 3 + Height = 350 + Top = 3 + Width = 550 Align = alClient BorderSpacing.Around = 2 TabOrder = 0 @@ -30,10 +30,10 @@ inherited CEEditorWidget: TCEEditorWidget TabDragAcceptMode = dmAutomatic end object editorStatus: TStatusBar[1] - Left = 0 + Left = 1 Height = 23 - Top = 283 - Width = 504 + Top = 355 + Width = 554 Panels = < item Width = 100 @@ -48,7 +48,7 @@ inherited CEEditorWidget: TCEEditorWidget end end inherited Header: TPanel - Width = 508 + Width = 556 end end object macRecorder: TSynMacroRecorder[2] diff --git a/src/ce_main.lfm b/src/ce_main.lfm index 6cbc2be4..f27f3204 100644 --- a/src/ce_main.lfm +++ b/src/ce_main.lfm @@ -1,8 +1,8 @@ object CEMainForm: TCEMainForm - Left = 1167 + Left = 1098 Height = 52 Top = 0 - Width = 736 + Width = 805 Caption = 'Coedit' DockSite = True DragMode = dmAutomatic @@ -250,6 +250,9 @@ object CEMainForm: TCEMainForm 27EAB9872E00BB893200BB8A3300BB8A3500BB871D00BB871F00 } end + object MenuItem50: TMenuItem + Action = actFileSaveAll + end object MenuItem25: TMenuItem Caption = '-' end @@ -578,7 +581,7 @@ object CEMainForm: TCEMainForm Caption = '-' end object MenuItem22: TMenuItem - Action = actMacStartStop + Action = actEdMacStartStop Bitmap.Data = { 36040000424D3604000000000000360000002800000010000000100000000100 2000000000000004000064000000640000000000000000000000FFFFFF00FFFF @@ -617,7 +620,7 @@ object CEMainForm: TCEMainForm } end object MenuItem23: TMenuItem - Action = actMacPlay + Action = actEdMacPlay Bitmap.Data = { 36040000424D3604000000000000360000002800000010000000100000000100 2000000000000004000064000000640000000000000000000000FFFFFF00FFFF @@ -1018,6 +1021,15 @@ object CEMainForm: TCEMainForm 0000000000000000000000000000000000000000000000000000 } end + object MenuItem47: TMenuItem + Caption = '-' + end + object MenuItem48: TMenuItem + Action = actProjRun + end + object MenuItem49: TMenuItem + Action = actProjRunWithArgs + end end object MenuItem8: TMenuItem Caption = 'Run' @@ -1219,6 +1231,15 @@ object CEMainForm: TCEMainForm 0000000000000000000000000000000000000000000000000000 } end + object MenuItem44: TMenuItem + Caption = '-' + end + object MenuItem45: TMenuItem + Action = actProjRun + end + object MenuItem46: TMenuItem + Action = actProjRunWithArgs + end end object mnuItemWin: TMenuItem Caption = 'Window' @@ -1263,18 +1284,18 @@ object CEMainForm: TCEMainForm OnExecute = actEdRedoExecute ShortCut = 24666 end - object actMacStartStop: TAction + object actEdMacStartStop: TAction Category = 'Edit' Caption = 'Start/stop macro recording' ImageIndex = 10 - OnExecute = actMacStartStopExecute + OnExecute = actEdMacStartStopExecute ShortCut = 24658 end - object actMacPlay: TAction + object actEdMacPlay: TAction Category = 'Edit' Caption = 'Play macro' ImageIndex = 11 - OnExecute = actMacPlayExecute + OnExecute = actEdMacPlayExecute ShortCut = 24656 end object actFileSave: TAction @@ -1383,11 +1404,25 @@ object CEMainForm: TCEMainForm Category = 'Project' Caption = 'Compile and run project' ImageIndex = 21 + OnExecute = actProjCompileAndRunExecute end object actProjCompAndRunWithArgs: TAction Category = 'Project' Caption = 'Compile and run project...' ImageIndex = 21 + OnExecute = actProjCompAndRunWithArgsExecute + end + object actProjRun: TAction + Category = 'Project' + Caption = 'Run project' + ImageIndex = 21 + OnExecute = actProjRunExecute + end + object actProjRunWithArgs: TAction + Category = 'Project' + Caption = 'Run project...' + ImageIndex = 21 + OnExecute = actProjRunWithArgsExecute end end object imgList: TImageList @@ -2292,4 +2327,9 @@ object CEMainForm: TCEMainForm 003300000023FFFFFF00FFFFFF00 } end + object ApplicationProperties1: TApplicationProperties + HintPause = 2 + HintShortPause = 2 + left = 96 + end end diff --git a/src/ce_main.pas b/src/ce_main.pas index a3966927..73ae8c47 100644 --- a/src/ce_main.pas +++ b/src/ce_main.pas @@ -22,9 +22,11 @@ type actFileOpen: TAction; actFileSaveAs: TAction; actFileSave: TAction; + actFileCompAndRunWithArgs: TAction; + actProjRun: TAction; + actProjRunWithArgs: TAction; actProjCompile: TAction; actProjCompileAndRun: TAction; - ActFileCompAndRunWithArgs: TAction; actProjCompAndRunWithArgs: TAction; actProjClose: TAction; actProjOpts: TAction; @@ -32,14 +34,15 @@ type actProjOpen: TAction; actProjSave: TAction; actProjSaveAs: TAction; - actMacPlay: TAction; - actMacStartStop: TAction; + actEdMacPlay: TAction; + actEdMacStartStop: TAction; actEdCut: TAction; actEdRedo: TAction; actEdUndo: TAction; actEdPaste: TAction; actEdCopy: TAction; Actions: TActionList; + ApplicationProperties1: TApplicationProperties; imgList: TImageList; mainMenu: TMainMenu; MenuItem1: TMenuItem; @@ -79,6 +82,13 @@ type MenuItem41: TMenuItem; MenuItem42: TMenuItem; MenuItem43: TMenuItem; + MenuItem44: TMenuItem; + MenuItem45: TMenuItem; + MenuItem46: TMenuItem; + MenuItem47: TMenuItem; + MenuItem48: TMenuItem; + MenuItem49: TMenuItem; + MenuItem50: TMenuItem; mnuItemWin: TMenuItem; MenuItem4: TMenuItem; MenuItem5: TMenuItem; @@ -89,14 +99,16 @@ type procedure actFileAddToProjExecute(Sender: TObject); procedure actFileCloseExecute(Sender: TObject); procedure actFileCompAndRunExecute(Sender: TObject); - procedure ActFileCompAndRunWithArgsExecute(Sender: TObject); + procedure actFileCompAndRunWithArgsExecute(Sender: TObject); procedure actFileSaveAllExecute(Sender: TObject); + procedure actProjCompAndRunWithArgsExecute(Sender: TObject); + procedure actProjCompileAndRunExecute(Sender: TObject); procedure actProjCompileExecute(Sender: TObject); procedure actEdCopyExecute(Sender: TObject); procedure actEdCutExecute(Sender: TObject); procedure ActionsUpdate(AAction: TBasicAction; var Handled: Boolean); - procedure actMacPlayExecute(Sender: TObject); - procedure actMacStartStopExecute(Sender: TObject); + procedure actEdMacPlayExecute(Sender: TObject); + procedure actEdMacStartStopExecute(Sender: TObject); procedure actFileNewExecute(Sender: TObject); procedure actProjNewExecute(Sender: TObject); procedure actFileNewRunExecute(Sender: TObject); @@ -108,6 +120,8 @@ type procedure actEdRedoExecute(Sender: TObject); procedure actFileSaveAsExecute(Sender: TObject); procedure actFileSaveExecute(Sender: TObject); + procedure actProjRunExecute(Sender: TObject); + procedure actProjRunWithArgsExecute(Sender: TObject); procedure actProjSaveAsExecute(Sender: TObject); procedure actProjSaveExecute(Sender: TObject); procedure actEdUndoExecute(Sender: TObject); @@ -128,7 +142,7 @@ type procedure ProcessOutputToMsg(const aProcess: TProcess); procedure compileAndRunFile(const edIndex: NativeInt; const runArgs: string = ''); procedure compileProject(const aProject: TCEProject); - procedure runProject(const aProject: TCEProject); + procedure runProject(const aProject: TCEProject; const runArgs: string = ''); // file sub routines procedure newFile; @@ -166,6 +180,8 @@ implementation uses SynMacroRecorder; +// TODO: warnings, OkCancel dialogs + {$REGION std comp methods ******************************************************} constructor TCEMainForm.create(aOwner: TComponent); var @@ -235,15 +251,15 @@ begin actEdPaste.Enabled := curr.CanPaste; actEdUndo.Enabled := curr.CanUndo; actEdRedo.Enabled := curr.CanRedo; - actMacPlay.Enabled := true; - actMacStartStop.Enabled := true; + actEdMacPlay.Enabled := true; + actEdMacStartStop.Enabled := true; // actFileCompAndRun.Enabled := true; actFileCompAndRunWithArgs.Enabled := true; actFileSave.Enabled := true; actFileSaveAs.Enabled := true; - actFileClose.Enabled:=true; - actFileSaveAll.Enabled:=true; + actFileClose.Enabled := true; + actFileSaveAll.Enabled := true; end else begin actEdCopy.Enabled := false; @@ -251,8 +267,8 @@ begin actEdPaste.Enabled := false ; actEdUndo.Enabled := false ; actEdRedo.Enabled := false ; - actMacPlay.Enabled := false; - actMacStartStop.Enabled := false; + actEdMacPlay.Enabled := false; + actEdMacStartStop.Enabled := false; // actFileCompAndRun.Enabled := false; actFileCompAndRunWithArgs.Enabled := false; @@ -270,6 +286,8 @@ begin actProjCompile.Enabled := hasProj; actProjCompileAndRun.Enabled := hasProj; actProjCompAndRunWithArgs.Enabled := hasProj; + actProjRun.Enabled := hasProj; + actProjRunWithArgs.Enabled := hasProj; actFileAddToProj.Enabled := hasEd and hasProj; @@ -518,7 +536,7 @@ begin if assigned(curr) then curr.Redo; end; -procedure TCEMainForm.actMacPlayExecute(Sender: TObject); +procedure TCEMainForm.actEdMacPlayExecute(Sender: TObject); var curr: TCESynMemo; begin @@ -526,7 +544,7 @@ begin if assigned(curr) then fEditWidg.macRecorder.PlaybackMacro(curr); end; -procedure TCEMainForm.actMacStartStopExecute(Sender: TObject); +procedure TCEMainForm.actEdMacStartStopExecute(Sender: TObject); var curr: TCESynMemo; begin @@ -576,6 +594,7 @@ begin end; end; +// TODO: input handling procedure TCEMainForm.compileAndRunFile(const edIndex: NativeInt; const runArgs: string = ''); var dmdproc: TProcess; @@ -685,10 +704,45 @@ begin end; end; -procedure TCEMainForm.runProject(const aProject: TCEProject); +procedure TCEMainForm.runProject(const aProject: TCEProject; const runArgs: string = ''); +var + runproc: TProcess; + procname: string; begin if aProject.currentConfiguration.outputOptions.binaryKind <> executable then exit; + + runproc := TProcess.Create(nil); + try + runproc.Options:= [poNewConsole]; + + procname := aProject.currentConfiguration.pathsOptions.outputFilename; + if procname <> '' then procname := aProject.getAbsoluteFilename(procname) + else + begin + procname := extractFilename(aProject.Sources.Strings[0]); + procname := procname[1..length(procname)-2]; + procname := extractFilePath(aProject.fileName) + + DirectorySeparator + procname; + {$IFDEF MSWINDOWS} + procname += '.exe'; + {$ENDIF} + end; + + if not fileExists(procname) then + begin + fMesgWidg.addCeErr('output executable missing: ' + procname); + exit; + end; + + runproc.Executable := procname; + runproc.Parameters.Text := runArgs; + runproc.Execute; + + finally + runproc.Free; + end; + end; procedure TCEMainForm.actFileCompAndRunExecute(Sender: TObject); @@ -699,7 +753,7 @@ begin compileAndRunFile(fEditWidg.editorIndex); end; -procedure TCEMainForm.ActFileCompAndRunWithArgsExecute(Sender: TObject); +procedure TCEMainForm.actFileCompAndRunWithArgsExecute(Sender: TObject); var runargs: string; begin @@ -715,6 +769,37 @@ procedure TCEMainForm.actProjCompileExecute(Sender: TObject); begin compileProject(fProject); end; + +procedure TCEMainForm.actProjCompileAndRunExecute(Sender: TObject); +begin + compileProject(fProject); + runProject(fProject); +end; + +procedure TCEMainForm.actProjCompAndRunWithArgsExecute(Sender: TObject); +var + runargs: string; +begin + compileProject(fProject); + // + runargs := ''; + if InputQuery('Execution arguments', 'enter switches and arguments', + runargs) then runProject(fProject, runargs); +end; + +procedure TCEMainForm.actProjRunExecute(Sender: TObject); +begin + runProject(fProject); +end; + +procedure TCEMainForm.actProjRunWithArgsExecute(Sender: TObject); +var + runargs: string; +begin + runargs := ''; + if InputQuery('Execution arguments', 'enter switches and arguments', + runargs) then runProject(fProject, runargs); +end; {$ENDREGION} {$REGION view ******************************************************************} diff --git a/src/ce_messages.lfm b/src/ce_messages.lfm index c5d74270..12be6870 100644 --- a/src/ce_messages.lfm +++ b/src/ce_messages.lfm @@ -1,33 +1,33 @@ inherited CEMessagesWidget: TCEMessagesWidget - Left = 1168 - Height = 220 - Top = 463 - Width = 737 - Caption = 'MessagesWidget' - ClientHeight = 220 - ClientWidth = 737 + Left = 1098 + Height = 152 + Top = 531 + Width = 807 + Caption = 'Messages' + ClientHeight = 152 + ClientWidth = 807 inherited Back: TPanel - Height = 220 - Width = 737 - ClientHeight = 220 - ClientWidth = 737 + Height = 152 + Width = 807 + ClientHeight = 152 + ClientWidth = 807 inherited Content: TPanel - Height = 194 - Width = 737 - ClientHeight = 190 - ClientWidth = 733 + Height = 126 + Width = 807 + ClientHeight = 126 + ClientWidth = 807 object List: TListView[0] - Left = 2 - Height = 186 - Top = 2 - Width = 729 + Left = 3 + Height = 120 + Top = 3 + Width = 801 Align = alClient AutoSort = False AutoWidthLastColumn = True BorderSpacing.Around = 2 Columns = < item - Width = 725 + Width = 797 end> HideSelection = False ReadOnly = True @@ -39,7 +39,7 @@ inherited CEMessagesWidget: TCEMessagesWidget end end inherited Header: TPanel - Width = 737 + Width = 807 end end object imgList: TImageList[2] diff --git a/src/ce_messages.pas b/src/ce_messages.pas index 455fc965..904e94bb 100644 --- a/src/ce_messages.pas +++ b/src/ce_messages.pas @@ -21,7 +21,6 @@ type procedure actSaveMsgExecute(Sender: TObject); public constructor create(aOwner: TComponent); override; - destructor destroy; override; // procedure scrollToBack; procedure addMessage(const aMsg: string); @@ -71,11 +70,6 @@ begin contextMenu.Items.Add(itm); end; -destructor TCEMessagesWidget.destroy; -begin - inherited; -end; - procedure TCEMessagesWidget.scrollToBack; begin if not Visible then exit; @@ -212,4 +206,3 @@ begin end; end. - diff --git a/src/ce_projconf.lfm b/src/ce_projconf.lfm index 930385fa..d2db6b8f 100644 --- a/src/ce_projconf.lfm +++ b/src/ce_projconf.lfm @@ -1,68 +1,70 @@ inherited CEProjectConfigurationWidget: TCEProjectConfigurationWidget - Left = 1170 + Left = 1098 Height = 278 - Top = 722 - Width = 445 + Width = 448 BorderIcons = [biSystemMenu, biMinimize, biMaximize] - Caption = 'ProjectConfigurationWidget' + Caption = 'Project configuration' ClientHeight = 278 - ClientWidth = 445 + ClientWidth = 448 inherited Back: TPanel Height = 278 - Width = 445 + Width = 448 ClientHeight = 278 - ClientWidth = 445 - DragKind = dkDrag - DragMode = dmManual + ClientWidth = 448 inherited Content: TPanel Height = 252 - Width = 445 - ClientHeight = 248 - ClientWidth = 441 + Width = 448 + ClientHeight = 252 + ClientWidth = 448 object Tree: TTreeView[0] - Left = 4 - Height = 214 - Top = 30 + Left = 5 + Height = 216 + Top = 31 Width = 190 Align = alLeft AutoExpand = True - BorderSpacing.Around = 4 + BorderSpacing.Left = 4 + BorderSpacing.Top = 4 + BorderSpacing.Bottom = 4 DefaultItemHeight = 18 + HideSelection = False ReadOnly = True ScrollBars = ssAutoBoth ShowRoot = False TabOrder = 0 - Options = [tvoAutoExpand, tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoShowButtons, tvoShowLines, tvoToolTips, tvoThemedDraw] + OnChange = TreeChange + Options = [tvoAutoExpand, tvoAutoItemHeight, tvoKeepCollapsedNodes, tvoReadOnly, tvoShowButtons, tvoShowLines, tvoToolTips, tvoThemedDraw] Items.Data = { - F9FFFFFF020003000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000 - 0000000700000047656E6572616CFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0500 - 000000000000010A00000043617465676F72696573FFFFFFFFFFFFFFFFFFFFFF - FFFFFFFFFF000000000000000000080000004D65737361676573FFFFFFFFFFFF - FFFFFFFFFFFFFFFFFFFF000000000000000000080000004465627567696E67FF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000D000000446F6375 - 6D656E746174696F6EFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000 - 0000060000004F7574707574FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000 - 0000000000060000004F7468657273FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 - 00000000000000000E000000416C6C2063617465676F72696573 + F9FFFFFF020003000000FFFFFFFFFFFFFFFF01000000FFFFFFFF000000000000 + 0000000700000047656E6572616CFFFFFFFFFFFFFFFF02000000FFFFFFFF0600 + 000000000000010A00000043617465676F72696573FFFFFFFFFFFFFFFF020000 + 00FFFFFFFF000000000000000000080000004D65737361676573FFFFFFFFFFFF + FFFF03000000FFFFFFFF000000000000000000080000004465627567696E67FF + FFFFFFFFFFFFFF04000000FFFFFFFF0000000000000000000D000000446F6375 + 6D656E746174696F6EFFFFFFFFFFFFFFFF05000000FFFFFFFF00000000000000 + 0000060000004F7574707574FFFFFFFFFFFFFFFF06000000FFFFFFFF00000000 + 0000000000060000004F7468657273FFFFFFFFFFFFFFFF07000000FFFFFFFF00 + 0000000000000000050000005061746873FFFFFFFFFFFFFFFF08000000FFFFFF + FF0000000000000000000E000000416C6C2063617465676F72696573 } end inline frameEditAll: TCEProjConfAll[1] - Left = 198 - Height = 218 - Top = 28 - Width = 241 + Left = 202 + Height = 220 + Top = 29 + Width = 243 Align = alClient BorderSpacing.Around = 2 - ClientHeight = 218 - ClientWidth = 241 + ClientHeight = 220 + ClientWidth = 243 TabOrder = 1 DesignLeft = 1406 DesignTop = 572 inherited Grid: TTIPropertyGrid Left = 2 - Height = 214 + Height = 216 Top = 2 - Width = 237 + Width = 239 BackgroundColor = clDefault BorderSpacing.Around = 2 DefaultItemHeight = 22 @@ -71,21 +73,21 @@ inherited CEProjectConfigurationWidget: TCEProjectConfigurationWidget end end object Panel1: TPanel[2] - Left = 2 + Left = 3 Height = 24 - Top = 2 - Width = 437 + Top = 3 + Width = 442 Align = alTop BorderSpacing.Around = 2 BevelOuter = bvNone ClientHeight = 24 - ClientWidth = 437 + ClientWidth = 442 TabOrder = 2 object selConf: TComboBox Left = 0 Height = 23 Top = 1 - Width = 346 + Width = 351 Align = alClient BorderSpacing.Top = 1 BorderSpacing.Right = 1 @@ -95,7 +97,7 @@ inherited CEProjectConfigurationWidget: TCEProjectConfigurationWidget TabOrder = 0 end object btnAddConf: TSpeedButton - Left = 347 + Left = 352 Height = 24 Top = 0 Width = 30 @@ -140,7 +142,7 @@ inherited CEProjectConfigurationWidget: TCEProjectConfigurationWidget ShowCaption = False end object btnDelConf: TSpeedButton - Left = 377 + Left = 382 Height = 24 Top = 0 Width = 30 @@ -185,7 +187,7 @@ inherited CEProjectConfigurationWidget: TCEProjectConfigurationWidget ShowCaption = False end object btnCloneConf: TSpeedButton - Left = 407 + Left = 412 Height = 24 Top = 0 Width = 30 @@ -230,9 +232,15 @@ inherited CEProjectConfigurationWidget: TCEProjectConfigurationWidget ShowCaption = False end end + object Splitter1: TSplitter[3] + Left = 195 + Height = 222 + Top = 29 + Width = 5 + end end inherited Header: TPanel - Width = 445 + Width = 448 end end object imgList: TImageList[2] diff --git a/src/ce_projconf.pas b/src/ce_projconf.pas index 87b82aa0..e7b42f3f 100644 --- a/src/ce_projconf.pas +++ b/src/ce_projconf.pas @@ -20,17 +20,20 @@ type btnAddConf: TSpeedButton; btnDelConf: TSpeedButton; btnCloneConf: TSpeedButton; + Splitter1: TSplitter; Tree: TTreeView; procedure btnAddConfClick(Sender: TObject); procedure btnDelConfClick(Sender: TObject); procedure btnCloneCurrClick(Sender: TObject); procedure selConfChange(Sender: TObject); - procedure SpeedButton1Click(Sender: TObject); + procedure TreeChange(Sender: TObject; Node: TTreeNode); private fProj: TCEProject; + function getGridTarget: TPersistent; protected procedure manualWidgetUpdate; override; public + constructor create(aOwner: TComponent); override; procedure projNew(const aProject: TCEProject); override; procedure projChange(const aProject: TCEProject); override; procedure projClose(const aProject: TCEProject); override; @@ -40,6 +43,12 @@ type implementation {$R *.lfm} +constructor TCEProjectConfigurationWidget.create(aOwner: TComponent); +begin + inherited; + Tree.Selected := Tree.Items.GetLastNode; +end; + procedure TCEProjectConfigurationWidget.projNew(const aProject: TCEProject); begin beginManualWidgetUpdate; @@ -72,9 +81,10 @@ begin endManualWidgetUpdate; end; -procedure TCEProjectConfigurationWidget.SpeedButton1Click(Sender: TObject); +procedure TCEProjectConfigurationWidget.TreeChange(Sender: TObject; + Node: TTreeNode); begin - + frameEditAll.Grid.TIObject := getGridTarget; end; procedure TCEProjectConfigurationWidget.btnAddConfClick(Sender: TObject); @@ -123,6 +133,24 @@ begin endManualWidgetUpdate; end; +function TCEProjectConfigurationWidget.getGridTarget: TPersistent; +begin + if fProj = nil then exit(nil); + if fProj.ConfigurationIndex = -1 then exit(nil); + if Tree.Selected = nil then exit(nil); + case Tree.Selected.StateIndex of + 1: exit( fProj ); + 2: exit( fProj.currentConfiguration.messagesOptions ); + 3: exit( fProj.currentConfiguration.debugingOptions ); + 4: exit( fProj.currentConfiguration.documentationOptions ); + 5: exit( fProj.currentConfiguration.outputOptions ); + 6: exit( fProj.currentConfiguration.otherOptions ); + 7: exit( fProj.currentConfiguration.pathsOptions ); + 8: exit( fProj.currentConfiguration ); + else result := nil; + end; +end; + procedure TCEProjectConfigurationWidget.manualWidgetUpdate; var i: NativeInt; @@ -133,8 +161,7 @@ begin selConf.Items.Add(fProj.configuration[i].name); selConf.ItemIndex := fProj.ConfigurationIndex; - frameEditAll.Grid.TIObject := - fProj.configuration[fProj.ConfigurationIndex]; + frameEditAll.Grid.TIObject := getGridTarget; end; end. diff --git a/src/ce_project.lfm b/src/ce_project.lfm index 741b94de..eb026956 100644 --- a/src/ce_project.lfm +++ b/src/ce_project.lfm @@ -1,26 +1,26 @@ inherited CEProjectWidget: TCEProjectWidget - Left = 1691 - Height = 336 + Left = 1670 + Height = 405 Top = 89 - Width = 217 - Caption = 'ProjectWidget' - ClientHeight = 336 - ClientWidth = 217 + Width = 238 + Caption = 'Project inspector' + ClientHeight = 405 + ClientWidth = 238 inherited Back: TPanel - Height = 336 - Width = 217 - ClientHeight = 336 - ClientWidth = 217 + Height = 405 + Width = 238 + ClientHeight = 405 + ClientWidth = 238 inherited Content: TPanel - Height = 310 - Width = 217 - ClientHeight = 306 - ClientWidth = 213 + Height = 379 + Width = 238 + ClientHeight = 379 + ClientWidth = 238 object Tree: TTreeView[0] - Left = 2 - Height = 276 - Top = 28 - Width = 209 + Left = 3 + Height = 347 + Top = 29 + Width = 232 Align = alClient AutoExpand = True BorderSpacing.Around = 2 @@ -38,66 +38,66 @@ inherited CEProjectWidget: TCEProjectWidget } end object Panel1: TPanel[1] - Left = 2 + Left = 3 Height = 24 - Top = 2 - Width = 209 + Top = 3 + Width = 232 Align = alTop BorderSpacing.Around = 2 BevelOuter = bvNone ClientHeight = 24 - ClientWidth = 209 + ClientWidth = 232 TabOrder = 1 object btnAddFile: TSpeedButton Left = 0 Height = 24 Top = 0 - Width = 30 + Width = 28 Align = alLeft Glyph.Data = { 36040000424D3604000000000000360000002800000010000000100000000100 - 2000000000000004000064000000640000000000000000000000FFFFFF00FFFF - FF0000000000000000000000000000000000000000000000002A000000330000 - 00330000003300000033000000330000003300000023FFFFFF00FFFFFF00FFFF - FF0000000030000000330000003300000033000000333E7F42DB4A854CFF4B84 - 4CFF4C844CFF4B844CFF4B844BFF4B854DFF477D49C0FFFFFF00FFFFFF00FFFF - FF00B1B1AFF2AFAFADFFAEAEABFFAFAFADFFBAB3B7FF3F7F41FF4EC592FF45BF - 89FF47BF8AFF45BE89FF44BE89FF5DCB9CFF4B854DFFFFFFFF00FFFFFF00FFFF - FF00B0B0ADFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF397A3AFF50C191FFFFFF - FFFF2CAE74FF8CD3B4FFFFFFFFFF54C395FF4A844AFFFFFFFF00FFFFFF00FFFF - FF00AEAEABFFFFFFFFFFFDFDFCFFFFFEFEFFFFFFFFFF367737FF59C095FFFFFF - FFFF73C7A2FFFFFFFFFF81CDACFF64C69EFF49844AFFFFFFFF00FFFFFF00FFFF - FF00ADADABFFFFFFFFFFF8F8F8FFFBFAFBFFFFFFFFFF357736FF68C5A1FFFFFF - FFFFFFFFFFFF69C29CFF0F9D62FF76CBABFF488449FFFFFFFF00FFFFFF00FFFF - FF00ADADABFFFFFFFFFFF6F5F5FFF9F7F8FFFFFFFFFF347736FF7FCDB0FFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFF87D1B6FF478349FFFFFFFF00FFFFFF00FFFF - FF00ADADABFFFFFFFFFFF3F2F2FFF5F3F4FFFFFBFFFF327736FF8FD5BCFF89D1 - B6FF86CFB3FF87CFB4FF8CD2B8FF95D9C2FF47854AFFFFFFFF00FFFFFF00FFFF - FF00ADADABFFFFFFFFFFF0F0EFFFF1F1F0FFFAF6F8FF7DA780FF327736FF3478 - 36FF337736FF337736FF357938FF3D7F41FF47864BA8FFFFFF00FFFFFF00FFFF - FF00ADADABFFFFFFFFFFEEECEBFFEEEDECFFF1EFEFFFF7F3F5FFFCF5F9FFFDF5 - FAFFFDF5FAFFFDF5FAFFFFFFFFFFBEB5BBFF00000000FFFFFF00FFFFFF00FFFF - FF00ADADABFFFFFFFFFFEAE9E9FFEBEAEAFFEBEAEAFFEBEAEAFFF6F5F5FFFFFF - FFFFFFFFFFFFFFFFFFFFFFFFFFFFB2B0B0FF00000000FFFFFF00FFFFFF00FFFF - FF00ADADABFFFFFFFFFFE7E7E6FFE8E8E7FFE8E8E7FFE6E7E5FFFFFFFFFFCBCB - CAFFA6A6A4FFA5A5A2FFFFFFFFFFAFAFADFF00000000FFFFFF00FFFFFF00FFFF - FF00AEAEABFFFFFFFFFFE4E3E2FFE5E4E3FFE5E4E3FFE4E3E2FFFFFFFFFFA6A6 - A4FFFBFBFAFFFFFFFFFFE9E9E9FFB0B0AEAC00000000FFFFFF00FFFFFF00FFFF - FF00AEAEACFFFFFFFFFFE0DFDEFFE1DFDEFFE1DFDEFFE0DFDEFFFFFFFFFFA5A5 - A2FFFFFFFFFFE7E7E8FFAFAFACA70000000000000000FFFFFF00FFFFFF00FFFF - FF00AFAFADFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - FFFFE9E9E9FFAEAEACA6000000000000000000000000FFFFFF00FFFFFF00FFFF - FF00B3B3B1EFB0B0ADFFAEAEACFFAEAEABFFAEAEABFFADAEABFFAEAEABFFAFAF - ADFFB0B0AEEA00000000000000000000000000000000FFFFFF00 + 2000000000000004000064000000640000000000000000000000FFFFFF000000 + 001D000000340000003600000036000000360000003600000036000000360000 + 0036155A2EA1196A36F5196B37FF196A36F517613296FFFFFF00FFFFFF000000 + 0034F9F9F9F5FCFCFCFDFCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFF86B1 + 96FF288C53FF64BA8DFF95D2B2FF64BA8DFF288C53FF196B378C000000010000 + 0036FCFCFCFEFCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFF2271 + 3FFF62BA8BFF60BA87FFFFFFFFFF60B987FF67BC8FFF196B37F7000000010000 + 0036FCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFFFBFBFBFFFBFBFBFF317B + 4CFF9CD4B6FFFFFFFFFFFFFFFFFFFFFFFFFF95D2B2FF196B37FF000000010000 + 0036FCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFFFBFBFBFFFBFBFBFFFAFAFAFF4A8B + 62FF90D3B1FF92D6B1FFFFFFFFFF65BC8CFF67BC8FFF196B37F7000000010000 + 0036FCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFFFBFBFBFFFBFBFBFFFBFBFBFFA5C4 + B1FF61AB81FF95D4B4FFBAE6D0FF6ABB8FFF2D8F57FF196B378C000000010000 + 0036FCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFFFBFB + FBFFABC8B6FF609975FF4F8E66FF4A8A61FF26623C9800000001000000010000 + 0036FCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFFFAFA + FAFFF9F9F9FFF6F6F6FFF6F6F6FFFCFCFCFF0000003600000001000000010000 + 0036FCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFFFBFBFBFFF8F8 + F8FFF6F6F6FFF3F3F3FFF2F2F2FFFCFCFCFF0000003600000001000000010000 + 0036FCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFFFBFBFBFFF8F8F8FFF5F5 + F5FFF2F2F2FFEFEFEFFFEDEDEDFFFCFCFCFF0000003600000001000000010000 + 0036FCFCFCFFFBFBFBFFFCFCFCFFFCFCFCFFFBFBFBFFF8F8F8FFF5F5F5FFF1F1 + F1FFECECECFFEAEAEAFFE6E6E6FFFCFCFCFF0000003600000001000000010000 + 0036FCFCFCFFF9F9F9FFF9F9F9FFF9F9F9FFF7F7F7FFF6F6F6FFF2F2F2FFEBEB + EBFFFCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFF0000003600000001000000010000 + 0036FCFCFCFFF7F7F7FFF9F9F9FFF7F7F7FFF7F7F7FFF3F3F3FFF0F0F0FFEAEA + EAFFFCFCFCFFF6F6F6FFF4F4F4FF9999999100000020FFFFFF00FFFFFF000000 + 0036FBFBFBFDF4F4F4FFF5F5F5FFF5F5F5FFF5F5F5FFF1F1F1FFEFEFEFFFE9E9 + E9FFFCFCFCFFE7E7E7FF959595910000002000000002FFFFFF00FFFFFF000000 + 0033F8F8F8F0FBFBFBFDFCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFFFCFC + FCFFF8F8F8FF949494910000002000000002FFFFFF00FFFFFF00FFFFFF000000 + 001C000000330000003600000036000000360000003600000036000000360000 + 0036000000360000002000000002FFFFFF00FFFFFF00FFFFFF00 } OnClick = btnAddFileClick ShowCaption = False end object btnProjOpts: TSpeedButton - Left = 60 + Left = 84 Height = 24 Top = 0 - Width = 30 + Width = 28 Action = CEMainForm.actProjOpts Align = alLeft Glyph.Data = { @@ -139,10 +139,10 @@ inherited CEProjectWidget: TCEProjectWidget ShowCaption = False end object btnAddFold: TSpeedButton - Left = 30 + Left = 56 Height = 24 Top = 0 - Width = 30 + Width = 28 Align = alLeft Glyph.Data = { 36040000424D3604000000000000360000002800000010000000100000000100 @@ -184,10 +184,10 @@ inherited CEProjectWidget: TCEProjectWidget ShowCaption = False end object TreeFilterEdit1: TTreeFilterEdit - Left = 92 + Left = 114 Height = 20 Top = 2 - Width = 115 + Width = 116 ButtonWidth = 30 NumGlyphs = 1 Align = alClient @@ -197,10 +197,54 @@ inherited CEProjectWidget: TCEProjectWidget FilteredTreeview = Tree ExpandAllInitially = True end + object btnRemFile: TSpeedButton + Left = 28 + Height = 24 + Top = 0 + Width = 28 + Align = alLeft + Glyph.Data = { + 36040000424D3604000000000000360000002800000010000000100000000100 + 2000000000000004000064000000640000000000000000000000FFFFFF000000 + 001D000000340000003600000036000000360000003600000036000000360000 + 003617469E950343B3E60442BCFE0343B4E9033DA489FFFFFF00FFFFFF000000 + 0034F9F9F9F5FCFCFCFDFCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFF8BA9 + DFFF2866CAFF2177E6FF0579EAFF0164DDFF044DBCFD0345B87A000000010000 + 0036FCFCFCFEFCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFF1E59 + C0FF639DF4FF187FFFFF0076F8FF0076EEFF0368E1FF0345B9E4000000010000 + 0036FCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFFFBFBFBFFFBFBFBFF0543 + BCFFAECDFEFFFFFFFFFFFFFFFFFFFFFFFFFF187FEFFF0442BCFE000000010000 + 0036FCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFFFBFBFBFFFBFBFBFFFAFAFAFF245C + C2FF8DB5F6FF4D92FFFF1177FFFF2186FFFF408AEBFF0344B9DE000000010000 + 0036FCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFFFBFBFBFFFBFBFBFFFBFBFBFF93AE + E1FF3D76D2FF8DB5F7FFB8D6FEFF72A8F5FF2D6BCAFD0442B96E000000010000 + 0036FCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFFFBFB + FBFF92ADE0FF2A61C7FF0543BCFF1F5AC1FF0237959500000001000000010000 + 0036FCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFFFAFA + FAFFF9F9F9FFF6F6F6FFF6F6F6FFFCFCFCFF0000003600000001000000010000 + 0036FCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFFFBFBFBFFF8F8 + F8FFF6F6F6FFF3F3F3FFF2F2F2FFFCFCFCFF0000003600000001000000010000 + 0036FCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFFFBFBFBFFF8F8F8FFF5F5 + F5FFF2F2F2FFEFEFEFFFEDEDEDFFFCFCFCFF0000003600000001000000010000 + 0036FCFCFCFFFBFBFBFFFCFCFCFFFCFCFCFFFBFBFBFFF8F8F8FFF5F5F5FFF1F1 + F1FFECECECFFEAEAEAFFE6E6E6FFFCFCFCFF0000003600000001000000010000 + 0036FCFCFCFFF9F9F9FFF9F9F9FFF9F9F9FFF7F7F7FFF6F6F6FFF2F2F2FFEBEB + EBFFFCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFF0000003600000001000000010000 + 0036FCFCFCFFF7F7F7FFF9F9F9FFF7F7F7FFF7F7F7FFF3F3F3FFF0F0F0FFEAEA + EAFFFCFCFCFFF6F6F6FFF4F4F4FF9999999100000020FFFFFF00FFFFFF000000 + 0036FBFBFBFDF4F4F4FFF5F5F5FFF5F5F5FFF5F5F5FFF1F1F1FFEFEFEFFFE9E9 + E9FFFCFCFCFFE7E7E7FF959595910000002000000002FFFFFF00FFFFFF000000 + 0033F8F8F8F0FBFBFBFDFCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFFFCFCFCFFFCFC + FCFFF8F8F8FF949494910000002000000002FFFFFF00FFFFFF00FFFFFF000000 + 001C000000330000003600000036000000360000003600000036000000360000 + 0036000000360000002000000002FFFFFF00FFFFFF00FFFFFF00 + } + OnClick = btnRemFileClick + end end end inherited Header: TPanel - Width = 217 + Width = 238 end end object imgList: TImageList[2] diff --git a/src/ce_project.pas b/src/ce_project.pas index badcb555..79358936 100644 --- a/src/ce_project.pas +++ b/src/ce_project.pas @@ -16,10 +16,12 @@ type btnAddFile: TSpeedButton; btnProjOpts: TSpeedButton; btnAddFold: TSpeedButton; + btnRemFile: TSpeedButton; Tree: TTreeView; TreeFilterEdit1: TTreeFilterEdit; procedure btnAddFileClick(Sender: TObject); procedure btnAddFoldClick(Sender: TObject); + procedure btnRemFileClick(Sender: TObject); protected procedure manualWidgetUpdate; override; private @@ -100,7 +102,7 @@ begin // with TOpenDialog.Create(nil) do try - filter := 'd source|*.d|d interface|*.di|all files|*.*'; + filter := 'D source|*.d|D interface|*.di|all files|*.*'; if execute then fProject.addSource(filename); finally @@ -116,8 +118,8 @@ var begin if fProject = nil then exit; // - if fileexists(fProject.fileName) then - dir := extractfilePath(fProject.fileName) + if fileExists(fProject.fileName) then + dir := extractFilePath(fProject.fileName) else dir := ''; if selectDirectory(dir, [], 0) then begin @@ -141,6 +143,23 @@ begin end; end; +procedure TCEProjectWidget.btnRemFileClick(Sender: TObject); +var + fname: string; + i: NativeInt; +begin + if fProject = nil then exit; + if Tree.Selected = nil then exit; + // + if Tree.Selected.Parent = fFileNode then + begin + fname := Tree.Selected.Text; + i := fProject.Sources.IndexOf(fname); + if i > -1 then fProject.Sources.Delete(i); + manualWidgetUpdate; + end +end; + procedure TCEProjectWidget.manualWidgetUpdate; var src, conf: string; @@ -168,4 +187,3 @@ begin end; end. - diff --git a/src/ce_widget.lfm b/src/ce_widget.lfm index a5b03396..3ce9655b 100644 --- a/src/ce_widget.lfm +++ b/src/ce_widget.lfm @@ -1,7 +1,7 @@ object CEWidget: TCEWidget - Left = 1538 + Left = 1628 Height = 121 - Top = 735 + Top = 721 Width = 320 BorderIcons = [biMinimize, biMaximize] Caption = 'CEWidget'