diff --git a/lazproj/test/coeditproj/post.bat b/lazproj/test/coeditproj/post.bat new file mode 100644 index 00000000..ca62f993 --- /dev/null +++ b/lazproj/test/coeditproj/post.bat @@ -0,0 +1,2 @@ +echo 'has compiled' +pause \ No newline at end of file diff --git a/lazproj/test/coeditproj/pre.bat b/lazproj/test/coeditproj/pre.bat new file mode 100644 index 00000000..b52cd74f --- /dev/null +++ b/lazproj/test/coeditproj/pre.bat @@ -0,0 +1,2 @@ +echo 'will compile' +pause \ No newline at end of file diff --git a/lazproj/test/coeditproj/test.coedit b/lazproj/test/coeditproj/test.coedit index 202879d0..8c56682a 100644 --- a/lazproj/test/coeditproj/test.coedit +++ b/lazproj/test/coeditproj/test.coedit @@ -24,13 +24,24 @@ object _1: TCEProject outputOptions.binaryKind = executable outputOptions.inlining = False outputOptions.noBoundsCheck = False + outputOptions.boundsCheck = onAlways outputOptions.optimizations = False outputOptions.generateStackFrame = False outputOptions.addMain = False outputOptions.release = False outputOptions.unittest = True - outputOptions.versionIdentifier = 'revision_1' + outputOptions.versionIdentifiers.Strings = ( + 'revision_1' + ) pathsOptions.outputFilename = '..\output\main.exe' + preBuildProcess.executable = 'C:\Dev\pasproj\Coedit\lazproj\test\coeditproj\pre.bat' + preBuildProcess.options = [poWaitOnExit] + preBuildProcess.showWindow = swoNone + postBuildProcess.executable = 'C:\Dev\pasproj\Coedit\lazproj\test\coeditproj\post.bat' + postBuildProcess.options = [poWaitOnExit] + postBuildProcess.showWindow = swoNone + runOptions.options = [] + runOptions.showWindow = swoNone end item name = 'alternative' @@ -53,6 +64,7 @@ object _1: TCEProject outputOptions.binaryKind = executable outputOptions.inlining = True outputOptions.noBoundsCheck = True + outputOptions.boundsCheck = onAlways outputOptions.optimizations = True outputOptions.generateStackFrame = False outputOptions.addMain = False @@ -60,11 +72,17 @@ object _1: TCEProject outputOptions.unittest = True outputOptions.versionIdentifier = 'revision_1' pathsOptions.outputFilename = '..\output\main.exe' + preBuildProcess.options = [] + preBuildProcess.showWindow = swoNone + postBuildProcess.options = [] + postBuildProcess.showWindow = swoNone + runOptions.options = [] + runOptions.showWindow = swoNone end> Sources.Strings = ( '..\src\main.d' - '..\src\bar.d' - '..\src\foo.d' + '..\src\barclass.d' + '..\src\fooclass.d' ) ConfigurationIndex = 0 end diff --git a/lazproj/test/src/bar.d b/lazproj/test/src/barclass.d similarity index 97% rename from lazproj/test/src/bar.d rename to lazproj/test/src/barclass.d index 8521aec8..27a58666 100644 --- a/lazproj/test/src/bar.d +++ b/lazproj/test/src/barclass.d @@ -1,4 +1,4 @@ -module bar; +module barclass; import std.stdio; diff --git a/lazproj/test/src/foo.d b/lazproj/test/src/fooclass.d similarity index 96% rename from lazproj/test/src/foo.d rename to lazproj/test/src/fooclass.d index 00e51d6a..59a6a07f 100644 --- a/lazproj/test/src/foo.d +++ b/lazproj/test/src/fooclass.d @@ -1,4 +1,4 @@ -module foo; +module fooclass; import std.stdio; diff --git a/lazproj/test/src/main.d b/lazproj/test/src/main.d index 84c5701b..217e998f 100644 --- a/lazproj/test/src/main.d +++ b/lazproj/test/src/main.d @@ -10,18 +10,24 @@ Test: module main; import std.stdio; -import foo; -import bar; +import fooclass; +import barclass; void main(string args[]) { - auto ffoo = new Foo; - auto bbar = new Bar; + auto foo = new Foo; + auto bar = new Bar; scope(exit) { - delete ffoo; - delete bbar; + delete foo; + delete bar; } - readln; + // if not UsePipes in RunOptions + // then: + // readln; + // (input is passed thru the new console) + + // else: input is not handled so readln will hang Coedit until + // the new process is manually killed } diff --git a/src/ce_common.pas b/src/ce_common.pas index 8a6f1eb1..a4125d39 100644 --- a/src/ce_common.pas +++ b/src/ce_common.pas @@ -5,7 +5,7 @@ unit ce_common; interface uses - Classes, SysUtils, ActnList, dialogs, forms, controls; + Classes, SysUtils, ActnList, dialogs, forms, process; const @@ -42,6 +42,14 @@ type function checkItem(const S: string): boolean; override; end; + (** + * TProcess with assign() overriden. + *) + TProcessEx = class helper for TProcess + public + procedure Assign(aValue: TPersistent); + end; + (** * Save a component with a readable aspect. *) @@ -50,7 +58,8 @@ type (** * Load a component. *) - procedure loadCompFromTxtFile(const aComp: TComponent; const aFilename: string); + procedure loadCompFromTxtFile(const aComp: TComponent; const aFilename: string; + aPropNotFoundHandler: TPropertyNotFoundEvent = nil; anErrorHandler: TReaderError = nil); (** * Converts a relative path to an absolute path. @@ -62,32 +71,63 @@ type * This is used to ensure that a project saved on a platform can be loaded * on another one. *) - function patchPlateformPath(const aPath: string): string; - procedure patchPlateformPaths(const sPaths: TStrings); + function patchPlateformPath(const aPath: string): string; + procedure patchPlateformPaths(const sPaths: TStrings); - (** - * Ok/Cancel modal dialog - *) - function dlgOkCancel(const aMsg: string): TModalResult; + (** + * Ok/Cancel modal dialog + *) + function dlgOkCancel(const aMsg: string): TModalResult; - (** - * Info dialog - *) - function dlgOkInfo(const aMsg: string): TModalResult; + (** + * Info dialog + *) + function dlgOkInfo(const aMsg: string): TModalResult; - (** - * Returns an unique object identifier, based on its heap address. - *) - function uniqueObjStr(const aObject: Tobject): string; + (** + * Returns an unique object identifier, based on its heap address. + *) + function uniqueObjStr(const aObject: Tobject): string; - (** - * Reduce a filename if its length is over the threshold defined by charThresh. - * Even if the result is not usable anymore, it avoids any "visually-overloaded" MRU menus. - *) - function displayShortFilename(const aPath: string; charThresh: Word = 80): string; + (** + * Reduces a filename if its length is over the threshold defined by charThresh. + * Even if the result is not usable anymore, it avoids any "visually-overloaded" MRU menu. + *) + function shortenPath(const aPath: string; charThresh: Word = 80): string; implementation +procedure TProcessEx.Assign(aValue: TPersistent); +var + src: TProcess; +begin + if aValue is TProcess then + begin + src := TProcess(aValue); + PipeBufferSize := src.PipeBufferSize; + Active := src.Active; + Executable := src.Executable; + Parameters := src.Parameters; + ConsoleTitle := src.ConsoleTitle; + CurrentDirectory := src.CurrentDirectory; + Desktop := src.Desktop; + Environment := src.Environment; + Options := src.Options; + Priority := src.Priority; + StartupOptions := src.StartupOptions; + ShowWindow := src.ShowWindow; + WindowColumns := src.WindowColumns; + WindowHeight := src.WindowHeight; + WindowLeft := src.WindowLeft; + WindowRows := src.WindowRows; + WindowTop := src.WindowTop; + WindowWidth := src.WindowWidth; + FillAttribute := src.FillAttribute; + XTermProgram := src.XTermProgram; + end + else inherited; +end; + constructor TMRUList.Create; begin fMaxCount := 10; @@ -153,9 +193,11 @@ begin end; end; -procedure loadCompFromTxtFile(const aComp: TComponent; const aFilename: string); +procedure loadCompFromTxtFile(const aComp: TComponent; const aFilename: string; + aPropNotFoundHandler: TPropertyNotFoundEvent = nil; anErrorHandler: TReaderError = nil); var str1, str2: TMemoryStream; + rdr: TReader; begin str1 := TMemoryStream.Create; str2 := TMemoryStream.Create; @@ -165,7 +207,14 @@ begin ObjectTextToBinary(str1,str2); str2.Position := 0; try - str2.ReadComponent(aComp); + rdr := TReader.Create(str2, 4096); + try + rdr.OnPropertyNotFound := aPropNotFoundHandler; + rdr.OnError := anErrorHandler; + rdr.ReadRootComponent(aComp); + finally + rdr.Free; + end; except end; finally @@ -260,7 +309,7 @@ begin {$HINTS ON}{$WARNINGS ON} end; -function displayShortFilename(const aPath: string; charThresh: Word = 80): string; +function shortenPath(const aPath: string; charThresh: Word = 80): string; var i: NativeInt; sepCnt: NativeInt; diff --git a/src/ce_dmdwrap.pas b/src/ce_dmdwrap.pas index a987d3cb..0e5029a9 100644 --- a/src/ce_dmdwrap.pas +++ b/src/ce_dmdwrap.pas @@ -5,7 +5,7 @@ unit ce_dmdwrap; interface uses - classes, sysutils; + classes, sysutils, process; (* @@ -238,6 +238,55 @@ type procedure getOpts(const aList: TStrings); override; end; + (***************************************************************************** + * Encapsulates the most common TProcess options. + * Used to simplify pre/post-compilation and run process options. + *) + TCustomProcOptions = class(TOptsGroup) + private + fExecutable: string; + fOptions: TProcessOptions; + fParameters: TStringList; + fShowWin: TShowWindowOptions; + procedure setExecutable(const aValue: string); + procedure setOptions(const aValue: TProcessOptions); + procedure setParameters(const aValue: TStringList); + procedure setShowWin(const aValue: TShowWindowOptions); + protected + property executable: string read fExecutable write setExecutable; + property options: TProcessOptions read fOptions write setOptions; + property parameters: TStringList read fParameters write setParameters; + property showWindow: TShowWindowOptions read fShowWin write setShowWin; + public + constructor create; + destructor destroy; override; + procedure assign(source: TPersistent); override; + procedure getOpts(const aList: TStrings); override; + procedure setProcess(const aProcess: TProcess); + end; + + (***************************************************************************** + * Encapsulates the options for the pre/post compilation processes + *) + TCompileProcOptions = class(TCustomProcOptions) + published + property executable; + property options; + property parameters; + property showWindow; + end; + + (***************************************************************************** + * Encapsulates the options for the project run process. + * 'executable' prop is hidden since it's defined by the project. + *) + TProjectRunOptions = class(TCustomProcOptions) + published + property options; + property parameters; + property showWindow; + end; + (***************************************************************************** * Encapsulates all the contextual options/args *) @@ -251,6 +300,9 @@ type fOutputOpts: TOutputOpts; fPathsOpts: TPathsOpts; fOthers: TOtherOpts; + fPreProcOpt: TCompileProcOptions; + fPostProcOpt: TCompileProcOptions; + fRunProjOpt: TProjectRunOptions; procedure doChanged; procedure subOptsChanged(sender: TObject); procedure setName(const aValue: string); @@ -260,6 +312,9 @@ type procedure setOutputOpts(const aValue: TOutputOpts); procedure setPathsOpts(const aValue: TPathsOpts); procedure setOthers(const aValue: TOtherOpts); + procedure setPreProcOpt(const aValue: TCompileProcOptions); + procedure setPostProcOpt(const aValue: TCompileProcOptions); + procedure setRunProjOpt(const aValue: TProjectRunOptions); protected function nameFromID: string; published @@ -270,6 +325,9 @@ type property outputOptions: TOutputOpts read fOutputOpts write setOutputOpts; property pathsOptions: TPathsOpts read fPathsOpts write setPathsOpts; property otherOptions: TOtherOpts read fOthers write setOthers; + property preBuildProcess: TCompileProcOptions read fPreProcOpt write setPreProcOpt; + property postBuildProcess: TCompileProcOptions read fPostProcOpt write setPostProcOpt; + property runOptions: TProjectRunOptions read fRunProjOpt write setRunProjOpt; public constructor create(aCollection: TCollection); override; destructor destroy; override; @@ -281,7 +339,7 @@ type implementation uses - ce_common; + ce_common, ce_main; procedure TOptsGroup.doChanged; begin @@ -851,6 +909,74 @@ begin end; {$ENDREGION} +{$REGION TCustomProcOptions ****************************************************} +constructor TCustomProcOptions.create; +begin + fParameters := TStringList.Create; +end; + +destructor TCustomProcOptions.destroy; +begin + fParameters.Free; + inherited; +end; + +procedure TCustomProcOptions.assign(source: TPersistent); +var + src: TCustomProcOptions; +begin + if source is TCustomProcOptions then + begin + src := TCustomProcOptions(source); + fParameters.Assign(src.fParameters); + fOptions := src.fOptions; + fExecutable := src.fExecutable; + fShowWin := src.fShowWin; + end + else inherited; +end; + +procedure TCustomProcOptions.getOpts(const aList: TStrings); +begin +end; + +procedure TCustomProcOptions.setProcess(const aProcess: TProcess); +begin + aProcess.Parameters := fParameters; + aProcess.Executable := fExecutable; + aProcess.ShowWindow := fShowWin; + aProcess.Options := fOptions; + aProcess.StartupOptions := aProcess.StartupOptions + [suoUseShowWindow]; +end; + +procedure TCustomProcOptions.setExecutable(const aValue: string); +begin + if fExecutable = aValue then exit; + fExecutable := aValue; + doChanged; +end; + +procedure TCustomProcOptions.setOptions(const aValue: TProcessOptions); +begin + if fOptions = aValue then exit; + fOptions := aValue; + doChanged; +end; + +procedure TCustomProcOptions.setParameters(const aValue: TStringList); +begin + fParameters.Assign(aValue); + doChanged; +end; + +procedure TCustomProcOptions.setShowWin(const aValue: TShowWindowOptions); +begin + if fShowWin = aValue then exit; + fShowWin := aValue; + doChanged; +end; +{$ENDREGION} + {$REGION TCompilerConfiguration ************************************************} constructor TCompilerConfiguration.create(aCollection: TCollection); begin @@ -862,6 +988,9 @@ begin fOutputOpts := TOutputOpts.create; fPathsOpts := TPathsOpts.create; fOthers := TOtherOpts.create; + fPreProcOpt := TCompileProcOptions.create; + fPostProcOpt:= TCompileProcOptions.create; + fRunProjOpt := TProjectRunOptions.create; fDocOpts.onChange := @subOptsChanged; fDebugOpts.onChange := @subOptsChanged; @@ -869,6 +998,9 @@ begin fOutputOpts.onChange := @subOptsChanged; fPathsOpts.onChange := @subOptsChanged; fOthers.onChange := @subOptsChanged; + fPreProcOpt.onChange := @subOptsChanged; + fPostProcOpt.onChange := @subOptsChanged; + fRunProjOpt.onChange := @subOptsChanged; fName := nameFromID; end; @@ -882,6 +1014,9 @@ begin fOutputOpts.free; fPathsOpts.free; fOthers.free; + fPreProcOpt.free; + fPostProcOpt.free; + fRunProjOpt.Free; inherited; end; @@ -898,6 +1033,9 @@ begin fOutputOpts.assign(src.fOutputOpts); fPathsOpts.assign(src.fPathsOpts); fOthers.assign(src.fOthers); + fPreProcOpt.assign(src.fPreProcOpt); + fPostProcOpt.assign(src.fPostProcOpt); + fRunProjOpt.assign(src.fRunProjOpt); end else inherited; end; @@ -966,9 +1104,24 @@ procedure TCompilerConfiguration.setOthers(const aValue: TOtherOpts); begin fOthers.Assign(aValue); end; + +procedure TCompilerConfiguration.setPreProcOpt(const aValue: TCompileProcOptions); +begin + fPreProcOpt.assign(aValue); +end; + +procedure TCompilerConfiguration.setPostProcOpt(const aValue: TCompileProcOptions); +begin + fPostProcOpt.assign(aValue); +end; + +procedure TCompilerConfiguration.setRunProjOpt(const aValue: TProjectRunOptions); +begin + fRunProjOpt.assign(aValue); +end; {$ENDREGION} initialization - RegisterClasses([TCompilerConfiguration, TOtherOpts, TPathsOpts, - TDebugOpts, TOutputOpts, TMsgOpts, TDocOpts]); + RegisterClasses([TOtherOpts, TPathsOpts, TDebugOpts, TOutputOpts, TMsgOpts, + TDocOpts, TCompileProcOptions, TProjectRunOptions, TCompilerConfiguration]); end. diff --git a/src/ce_editor.lfm b/src/ce_editor.lfm index 3cd8f14e..f66539e6 100644 --- a/src/ce_editor.lfm +++ b/src/ce_editor.lfm @@ -1,5 +1,7 @@ inherited CEEditorWidget: TCEEditorWidget + Left = 1324 Height = 382 + Top = 92 Width = 465 Caption = 'Source editor' ClientHeight = 382 diff --git a/src/ce_editor.pas b/src/ce_editor.pas index 196cae67..65bbded2 100644 --- a/src/ce_editor.pas +++ b/src/ce_editor.pas @@ -161,6 +161,7 @@ begin memo.OnMouseMove := @memoMouseMove; // pageControl.ActivePage := sheet; + //http://bugs.freepascal.org/view.php?id=26320 focusedEditorChanged; end; diff --git a/src/ce_main.lfm b/src/ce_main.lfm index 9a98130f..86662859 100644 --- a/src/ce_main.lfm +++ b/src/ce_main.lfm @@ -1,5 +1,5 @@ object CEMainForm: TCEMainForm - Left = 1113 + Left = 1122 Height = 53 Top = 26 Width = 745 @@ -1142,6 +1142,42 @@ object CEMainForm: TCEMainForm end object MenuItem55: TMenuItem Action = actProjOptView + Bitmap.Data = { + 36040000424D3604000000000000360000002800000010000000100000000100 + 2000000000000004000064000000640000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000020000 + 00260000003300000033000000330000002600000003000000007E7B79007370 + 6F00000000310000002B797675000000002B0000002FB85F12002313053DA456 + 15CAAE5A13FFAD5912FFAE5A13FFA45615CA2514053D000000037D7A7800726F + 6E00726F6EF66E6B6AE0000000266D6C6CDF6C7177EF00000021AF5B13FFCD8E + 4CFFE5B676FFE3B271FFE5B676FFCD8E4CFFAE5B15FF2F190731000000300000 + 002C6F6C6CE473706FFF6B6867CB727071FF6A6E75DAA3510CB9CC8844FFDEA9 + 68FFDAA05BFFFFFFFFFFDAA05BFFDEA968FFCB8846FFA55716CA7B7876F57673 + 71E3908D8AF9BFBCBAFFC4C1BEFFBEBCBBFF83888DF3B25608FFDBA25EFFD69C + 58FFD3944CFFFFFFFFFFD3944CFFD69C58FFDBA360FFAF5B15FF7F7C7BFF7C79 + 78FFC6C5C2FFAAA8A6FF8A8686FFA9A8A7FFC1C7CBFFAF5203FFDEAC73FFD191 + 49FFCF8C41FFFFFFFFFFCF8C41FFD19149FFDEAD75FFAE5A13FF000000337D7A + 79EBD4D2D1FF908C8BFF000000338F8D8DFFCFD4DAFFAE5000FFEACCA6FFCC8B + 40FFC98335FFC8802FFFC98335FFCC8B40FFEACEAAFFAE5912FF8A8785FF8582 + 80FFD7D5D4FFB7B6B4FF94928FFFB7B6B5FFD4D7DAFF9F6029FFD49C68FFE6C2 + 9BFFCF924EFFFFFFFFFFCF924EFFE6C39BFFD39F6EFFB05B13BB8D8A88F48A87 + 85B3A5A2A1FBDFDEDDFFE4E4E3FFDFDEDDFFA4A4A5F3877C75CEB0580BFFD199 + 63FFEBCDABFFE9C9A7FFEBCDABFFD19A64FFB15608FC0000002F8D8A88008B88 + 8600848180C28D8989FF8C8987E68D8A89FF838181B2707071D57B716CF3A768 + 31FFB05100FFAF5100FFB05100FFA76832FF7B7370F9747A7FEE8D8A88009794 + 9200969391F4969391FF908D8B00969391FF989593E17C7A7AFF7A7A7BFFC4C7 + CAFFA8ACB1FF888C92FFA8ACB1FFC4C7CAFF7A7A7CFF7E7D7DD68C8987009794 + 92009693910096939100918E8C009794920099969400000000337D7A7AE9D4D3 + D2FF8F8D8DFF000000338F8D8DFFD4D3D2FF777474CA0000002B8C8987009794 + 92009693910096939100928F8D009895930088858300898684FF858280FFD7D5 + D4FFB7B6B4FF94928FFFB7B6B4FFD7D5D4FF858280FF868381DF8C8987009794 + 920096939100979492008C8987008D8A88008D8A88008D8A88F48A8785B3A5A2 + A1FBDFDEDDFFE4E4E3FFDFDEDDFFA5A2A1F98A8785DE8D8A88F58C8987009794 + 920096939100979492008C8987008D8A88008D8A88008D8A88008B8886008481 + 80C28D8989FF8C8987E68D8989FF848180C18B8886008D8A88008C8987009794 + 920096939100979492008C8987008D8A88008D8A88008D8A8800979492009693 + 91F4969391FF908D8B00969391FF969391F4979492008D8A8800 + } end object MenuItem40: TMenuItem Caption = '-' diff --git a/src/ce_main.pas b/src/ce_main.pas index f32d9d79..33651a58 100644 --- a/src/ce_main.pas +++ b/src/ce_main.pas @@ -7,7 +7,7 @@ interface uses Classes, SysUtils, FileUtil, SynEditKeyCmds, SynHighlighterLFM, Forms, AnchorDocking, AnchorDockStorage, AnchorDockOptionsDlg, Controls, Graphics, - Dialogs, Menus, ActnList, ExtCtrls, process, XMLPropStorage, + Dialogs, Menus, ActnList, ExtCtrls, process, XMLPropStorage, asyncprocess, ce_common, ce_dmdwrap, ce_project, ce_synmemo, ce_widget, ce_messages, ce_editor, ce_projinspect, ce_projconf, ce_staticexplorer, ce_search; @@ -239,6 +239,7 @@ type property MessageWidget: TCEMessagesWidget read fMesgWidg; property EditWidget: TCEEditorWidget read fEditWidg; property ProjectWidget: TCEProjectInspectWidget read fProjWidg; + property ProjectConfWidget: TCEProjectConfigurationWidget read fPrjCfWidg; end; var @@ -482,7 +483,7 @@ begin begin itm := TMenuItem.Create(trgMnu); itm.Hint := fname; - itm.Caption := displayShortFilename(fname, 50); + itm.Caption := shortenPath(fname, 50); itm.OnClick := clickTrg; trgMnu.Add(itm); end; @@ -924,21 +925,40 @@ end; procedure TCEMainForm.compileProject(const aProject: TCEProject); var dmdproc: TProcess; + ppproc: TProcess; olddir, prjpath: string; begin + fMesgWidg.Clear; + if aProject.Sources.Count = 0 then begin fMesgWidg.addCeErr( aProject.fileName + ' has no source files' ); exit; end; + with fProject.currentConfiguration do + begin + if preBuildProcess.executable <> '' then + if fileExists(preBuildProcess.Executable) then + begin + ppproc := TProcess.Create(nil); + try + preBuildProcess.setProcess(ppproc); + ppproc.Execute; + finally + ppproc.Free; + end; + end + else fMesgWidg.addCeWarn('the pre-compilation executable does not exist'); + end; + olddir := ''; dmdproc := TProcess.Create(nil); getDir(0, olddir); try - fMesgWidg.Clear; + fMesgWidg.addCeInf( 'compiling ' + aProject.fileName ); prjpath := extractFilePath(aProject.fileName); @@ -968,6 +988,22 @@ begin + ' has not been compiled' ); end; + with fProject.currentConfiguration do + begin + if postBuildProcess.executable <> '' then + if fileExists(postBuildProcess.Executable) then + begin + ppproc := TProcess.Create(nil); + try + postBuildProcess.setProcess(ppproc); + ppproc.Execute; + finally + ppproc.Free; + end; + end + else fMesgWidg.addCeWarn('the post-compilation executable does not exist'); + end; + finally dmdproc.Free; chDir(olddir); @@ -984,7 +1020,10 @@ begin runproc := TProcess.Create(nil); try - runproc.Options := [poNewConsole, poStdErrToOutput]; + runproc.Options := aProject.currentConfiguration.runOptions.options; + runproc.Parameters := aProject.currentConfiguration.runOptions.parameters; + runproc.ShowWindow := aProject.currentConfiguration.runOptions.showWindow; + runproc.Parameters.AddText(runArgs); procname := aProject.currentConfiguration.pathsOptions.outputFilename; if procname <> '' then procname := aProject.getAbsoluteFilename(procname) @@ -1006,9 +1045,10 @@ begin end; runproc.Executable := procname; - runproc.Parameters.Text := runArgs; + //runproc.Parameters.Text := runArgs; runproc.Execute; while runproc.Running do if runproc.ExitStatus <> 0 then break; + ProcessOutputToMsg(runproc); finally runproc.Free; @@ -1104,7 +1144,7 @@ begin // aEditor.modified := false; aEditor.Lines.SaveToFile(fProject.fileName); - self.openProj(fProject.fileName); + openProj(fProject.fileName); end; procedure TCEMainForm.closeProj; @@ -1361,4 +1401,6 @@ begin end; {$ENDREGION} +initialization + RegisterClasses([TCEOptions]); end. diff --git a/src/ce_messages.lfm b/src/ce_messages.lfm index 66c92354..2fab7e34 100644 --- a/src/ce_messages.lfm +++ b/src/ce_messages.lfm @@ -1,7 +1,7 @@ inherited CEMessagesWidget: TCEMessagesWidget - Left = 1143 + Left = 621 Height = 172 - Top = 511 + Top = 659 Width = 744 Caption = 'Messages' ClientHeight = 172 diff --git a/src/ce_projconf.lfm b/src/ce_projconf.lfm index 1b271e5a..5e88ab19 100644 --- a/src/ce_projconf.lfm +++ b/src/ce_projconf.lfm @@ -1,24 +1,24 @@ inherited CEProjectConfigurationWidget: TCEProjectConfigurationWidget - Left = 1323 - Height = 277 - Top = 600 - Width = 450 + Left = 1394 + Height = 383 + Top = 480 + Width = 445 Caption = 'Project configuration' - ClientHeight = 277 - ClientWidth = 450 + ClientHeight = 383 + ClientWidth = 445 inherited Back: TPanel - Height = 277 - Width = 450 - ClientHeight = 277 - ClientWidth = 450 + Height = 383 + Width = 445 + ClientHeight = 383 + ClientWidth = 445 inherited Content: TPanel - Height = 277 - Width = 450 - ClientHeight = 277 - ClientWidth = 450 + Height = 383 + Width = 445 + ClientHeight = 383 + ClientWidth = 445 object Tree: TTreeView[0] Left = 4 - Height = 243 + Height = 349 Hint = 'filter configuration elements' Top = 30 Width = 125 @@ -37,7 +37,7 @@ inherited CEProjectConfigurationWidget: TCEProjectConfigurationWidget Options = [tvoAutoExpand, tvoAutoItemHeight, tvoKeepCollapsedNodes, tvoReadOnly, tvoShowButtons, tvoShowLines, tvoToolTips, tvoThemedDraw] Items.Data = { F9FFFFFF020003000000FFFFFFFFFFFFFFFF01000000FFFFFFFF000000000000 - 0000000700000047656E6572616CFFFFFFFFFFFFFFFF02000000FFFFFFFF0600 + 0000000700000047656E6572616CFFFFFFFFFFFFFFFF02000000FFFFFFFF0900 000000000000010A00000043617465676F72696573FFFFFFFFFFFFFFFF020000 00FFFFFFFF000000000000000000080000004D65737361676573FFFFFFFFFFFF FFFF03000000FFFFFFFF000000000000000000080000004465627567696E67FF @@ -46,26 +46,33 @@ inherited CEProjectConfigurationWidget: TCEProjectConfigurationWidget 0000060000004F7574707574FFFFFFFFFFFFFFFF06000000FFFFFFFF00000000 0000000000060000004F7468657273FFFFFFFFFFFFFFFF07000000FFFFFFFF00 0000000000000000050000005061746873FFFFFFFFFFFFFFFF08000000FFFFFF - FF0000000000000000000E000000416C6C2063617465676F72696573 + FF000000000000000000110000005072652D6275696C642070726F63657373FF + FFFFFFFFFFFFFF09000000FFFFFFFF00000000000000000012000000506F7374 + 2D6275696C642070726F63657373FFFFFFFFFFFFFFFF0A000000FFFFFFFF0000 + 000000000000000B00000052756E206F7074696F6E73FFFFFFFFFFFFFFFF0B00 + 0000FFFFFFFF0000000000000000000E000000416C6C2063617465676F726965 + 73 } end object Panel1: TPanel[1] - Left = 2 + Left = 4 Height = 24 Top = 2 - Width = 446 + Width = 437 Align = alTop + BorderSpacing.Left = 2 + BorderSpacing.Right = 2 BorderSpacing.Around = 2 BevelOuter = bvNone ClientHeight = 24 - ClientWidth = 446 + ClientWidth = 437 TabOrder = 1 object selConf: TComboBox Left = 0 Height = 23 Hint = 'select a configuration' Top = 1 - Width = 355 + Width = 346 Align = alClient BorderSpacing.Top = 1 BorderSpacing.Right = 1 @@ -75,7 +82,7 @@ inherited CEProjectConfigurationWidget: TCEProjectConfigurationWidget TabOrder = 0 end object btnAddConf: TSpeedButton - Left = 356 + Left = 347 Height = 24 Hint = 'add an empty configuration' Top = 0 @@ -121,7 +128,7 @@ inherited CEProjectConfigurationWidget: TCEProjectConfigurationWidget ShowCaption = False end object btnDelConf: TSpeedButton - Left = 386 + Left = 377 Height = 24 Hint = 'remove selected configuration' Top = 0 @@ -167,7 +174,7 @@ inherited CEProjectConfigurationWidget: TCEProjectConfigurationWidget ShowCaption = False end object btnCloneConf: TSpeedButton - Left = 416 + Left = 407 Height = 24 Hint = 'clone selected configuration' Top = 0 @@ -215,15 +222,15 @@ inherited CEProjectConfigurationWidget: TCEProjectConfigurationWidget end object Splitter1: TSplitter[2] Left = 129 - Height = 249 + Height = 355 Top = 28 Width = 5 end object Grid: TTIPropertyGrid[3] Left = 134 - Height = 243 + Height = 349 Top = 30 - Width = 312 + Width = 307 Align = alClient BorderSpacing.Top = 4 BorderSpacing.Right = 4 diff --git a/src/ce_projconf.pas b/src/ce_projconf.pas index 5f01958b..e2d3bea4 100644 --- a/src/ce_projconf.pas +++ b/src/ce_projconf.pas @@ -157,7 +157,10 @@ begin 5: exit( fProj.currentConfiguration.outputOptions ); 6: exit( fProj.currentConfiguration.otherOptions ); 7: exit( fProj.currentConfiguration.pathsOptions ); - 8: exit( fProj.currentConfiguration ); + 8: exit( fProj.currentConfiguration.preBuildProcess ); + 9: exit( fProj.currentConfiguration.postBuildProcess ); + 10: exit( fProj.currentConfiguration.runOptions ); + 11: exit( fProj.currentConfiguration ); else result := nil; end; end; diff --git a/src/ce_project.pas b/src/ce_project.pas index 778b1b29..e4b42a29 100644 --- a/src/ce_project.pas +++ b/src/ce_project.pas @@ -4,8 +4,6 @@ unit ce_project; interface -// TODO: pre/post compilation shell-script / process -// TODO: run opts, newConsole, catch output, etc // TODO: configuration templates uses @@ -39,6 +37,10 @@ type procedure setConfIx(aValue: Integer); function getConfig(const ix: integer): TCompilerConfiguration; function getCurrConf: TCompilerConfiguration; + procedure readerPropNoFound(Reader: TReader; Instance: TPersistent; + var PropName: string; IsPath: boolean; var Handled, Skip: Boolean); + procedure readerError(Reader: TReader; const Message: string; + var Handled: Boolean); published property OptionsCollection: TCollection read fOptsColl write setOptsColl; property Sources: TStringList read fSrcs write setSrcs; // 'read' should return a copy to avoid abs/rel errors @@ -67,7 +69,7 @@ type implementation uses - ce_common; + ce_common, dialogs; constructor TCEProject.create(aOwner: TComponent); begin @@ -264,12 +266,26 @@ end; procedure TCEProject.loadFromFile(const aFilename: string); begin Filename := aFilename; - loadCompFromTxtFile(self, aFilename); + loadCompFromTxtFile(self, aFilename, @readerPropNoFound, @readerError); patchPlateformPaths(fSrcs); doChanged; fModified := false; end; +procedure TCEProject.readerPropNoFound(Reader: TReader; Instance: TPersistent; + var PropName: string; IsPath: boolean; var Handled, Skip: Boolean); +begin + // continue loading: this method grants the project compat. in case of drastical changes. + Skip := true; + Handled := true; +end; + +procedure TCEProject.readerError(Reader: TReader; const Message: string; + var Handled: Boolean); +begin + Handled := true; +end; + initialization RegisterClasses([TCEProject]); end. diff --git a/src/ce_search.lfm b/src/ce_search.lfm index 6be72a81..57587d7a 100644 --- a/src/ce_search.lfm +++ b/src/ce_search.lfm @@ -1,20 +1,20 @@ inherited CESearchWidget: TCESearchWidget - Left = 1492 - Height = 239 - Top = 468 + Left = 1486 + Height = 238 + Top = 327 Width = 394 Caption = 'Search & replace' - ClientHeight = 239 + ClientHeight = 238 ClientWidth = 394 inherited Back: TPanel - Height = 239 + Height = 238 Width = 394 - ClientHeight = 239 + ClientHeight = 238 ClientWidth = 394 inherited Content: TPanel - Height = 239 + Height = 238 Width = 394 - ClientHeight = 239 + ClientHeight = 238 ClientWidth = 394 object cbToFind: TComboBox[0] Left = 4 @@ -22,6 +22,7 @@ inherited CESearchWidget: TCESearchWidget Top = 4 Width = 386 Align = alTop + Anchors = [akTop, akLeft, akRight, akBottom] BorderSpacing.Around = 4 ItemHeight = 15 OnChange = cbToFindChange @@ -30,7 +31,7 @@ inherited CESearchWidget: TCESearchWidget object btnFind: TBitBtn[1] Left = 4 Height = 24 - Top = 155 + Top = 154 Width = 386 Align = alBottom BorderSpacing.Around = 4 @@ -76,7 +77,7 @@ inherited CESearchWidget: TCESearchWidget object btnReplace: TBitBtn[2] Left = 4 Height = 24 - Top = 183 + Top = 182 Width = 386 Align = alBottom BorderSpacing.Around = 4 @@ -121,13 +122,13 @@ inherited CESearchWidget: TCESearchWidget end object grpOpts: TGroupBox[3] Left = 4 - Height = 90 - Top = 61 + Height = 92 + Top = 58 Width = 386 Align = alClient BorderSpacing.Around = 4 Caption = 'Options' - ClientHeight = 72 + ClientHeight = 74 ClientWidth = 382 TabOrder = 3 object chkWWord: TCheckBox @@ -176,7 +177,7 @@ inherited CESearchWidget: TCESearchWidget object btnReplaceAll: TBitBtn[4] Left = 4 Height = 24 - Top = 211 + Top = 210 Width = 386 Align = alBottom BorderSpacing.Around = 4 @@ -221,13 +222,13 @@ inherited CESearchWidget: TCESearchWidget end object Panel1: TPanel[5] Left = 4 - Height = 26 + Height = 23 Top = 31 Width = 386 Align = alTop BorderSpacing.Around = 4 BevelOuter = bvNone - ClientHeight = 26 + ClientHeight = 23 ClientWidth = 386 TabOrder = 5 object cbReplaceWth: TComboBox @@ -236,13 +237,14 @@ inherited CESearchWidget: TCESearchWidget Top = 0 Width = 296 Align = alClient + Anchors = [akTop, akLeft, akBottom] ItemHeight = 15 OnChange = cbReplaceWthChange TabOrder = 0 end object chkEnableRep: TCheckBox Left = 0 - Height = 26 + Height = 23 Top = 0 Width = 90 Align = alLeft diff --git a/src/ce_search.pas b/src/ce_search.pas index eae3d8c8..7e21e9bb 100644 --- a/src/ce_search.pas +++ b/src/ce_search.pas @@ -12,7 +12,6 @@ uses type { TCESearchWidget } - TCESearchWidget = class(TCEWidget) btnFind: TBitBtn; btnReplace: TBitBtn;