This commit is contained in:
Basile Burg 2014-07-13 03:11:44 +02:00
parent be13cda15b
commit f46eb70a58
18 changed files with 437 additions and 99 deletions

View File

@ -0,0 +1,2 @@
echo 'has compiled'
pause

View File

@ -0,0 +1,2 @@
echo 'will compile'
pause

View File

@ -24,13 +24,24 @@ object _1: TCEProject
outputOptions.binaryKind = executable outputOptions.binaryKind = executable
outputOptions.inlining = False outputOptions.inlining = False
outputOptions.noBoundsCheck = False outputOptions.noBoundsCheck = False
outputOptions.boundsCheck = onAlways
outputOptions.optimizations = False outputOptions.optimizations = False
outputOptions.generateStackFrame = False outputOptions.generateStackFrame = False
outputOptions.addMain = False outputOptions.addMain = False
outputOptions.release = False outputOptions.release = False
outputOptions.unittest = True outputOptions.unittest = True
outputOptions.versionIdentifier = 'revision_1' outputOptions.versionIdentifiers.Strings = (
'revision_1'
)
pathsOptions.outputFilename = '..\output\main.exe' 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 end
item item
name = 'alternative' name = 'alternative'
@ -53,6 +64,7 @@ object _1: TCEProject
outputOptions.binaryKind = executable outputOptions.binaryKind = executable
outputOptions.inlining = True outputOptions.inlining = True
outputOptions.noBoundsCheck = True outputOptions.noBoundsCheck = True
outputOptions.boundsCheck = onAlways
outputOptions.optimizations = True outputOptions.optimizations = True
outputOptions.generateStackFrame = False outputOptions.generateStackFrame = False
outputOptions.addMain = False outputOptions.addMain = False
@ -60,11 +72,17 @@ object _1: TCEProject
outputOptions.unittest = True outputOptions.unittest = True
outputOptions.versionIdentifier = 'revision_1' outputOptions.versionIdentifier = 'revision_1'
pathsOptions.outputFilename = '..\output\main.exe' pathsOptions.outputFilename = '..\output\main.exe'
preBuildProcess.options = []
preBuildProcess.showWindow = swoNone
postBuildProcess.options = []
postBuildProcess.showWindow = swoNone
runOptions.options = []
runOptions.showWindow = swoNone
end> end>
Sources.Strings = ( Sources.Strings = (
'..\src\main.d' '..\src\main.d'
'..\src\bar.d' '..\src\barclass.d'
'..\src\foo.d' '..\src\fooclass.d'
) )
ConfigurationIndex = 0 ConfigurationIndex = 0
end end

View File

@ -1,4 +1,4 @@
module bar; module barclass;
import std.stdio; import std.stdio;

View File

@ -1,4 +1,4 @@
module foo; module fooclass;
import std.stdio; import std.stdio;

View File

@ -10,18 +10,24 @@ Test:
module main; module main;
import std.stdio; import std.stdio;
import foo; import fooclass;
import bar; import barclass;
void main(string args[]) void main(string args[])
{ {
auto ffoo = new Foo; auto foo = new Foo;
auto bbar = new Bar; auto bar = new Bar;
scope(exit) scope(exit)
{ {
delete ffoo; delete foo;
delete bbar; 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
} }

View File

@ -5,7 +5,7 @@ unit ce_common;
interface interface
uses uses
Classes, SysUtils, ActnList, dialogs, forms, controls; Classes, SysUtils, ActnList, dialogs, forms, process;
const const
@ -42,6 +42,14 @@ type
function checkItem(const S: string): boolean; override; function checkItem(const S: string): boolean; override;
end; end;
(**
* TProcess with assign() overriden.
*)
TProcessEx = class helper for TProcess
public
procedure Assign(aValue: TPersistent);
end;
(** (**
* Save a component with a readable aspect. * Save a component with a readable aspect.
*) *)
@ -50,7 +58,8 @@ type
(** (**
* Load a component. * 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. * 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 * This is used to ensure that a project saved on a platform can be loaded
* on another one. * on another one.
*) *)
function patchPlateformPath(const aPath: string): string; function patchPlateformPath(const aPath: string): string;
procedure patchPlateformPaths(const sPaths: TStrings); procedure patchPlateformPaths(const sPaths: TStrings);
(** (**
* Ok/Cancel modal dialog * Ok/Cancel modal dialog
*) *)
function dlgOkCancel(const aMsg: string): TModalResult; function dlgOkCancel(const aMsg: string): TModalResult;
(** (**
* Info dialog * Info dialog
*) *)
function dlgOkInfo(const aMsg: string): TModalResult; function dlgOkInfo(const aMsg: string): TModalResult;
(** (**
* Returns an unique object identifier, based on its heap address. * Returns an unique object identifier, based on its heap address.
*) *)
function uniqueObjStr(const aObject: Tobject): string; function uniqueObjStr(const aObject: Tobject): string;
(** (**
* Reduce a filename if its length is over the threshold defined by charThresh. * 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 menus. * Even if the result is not usable anymore, it avoids any "visually-overloaded" MRU menu.
*) *)
function displayShortFilename(const aPath: string; charThresh: Word = 80): string; function shortenPath(const aPath: string; charThresh: Word = 80): string;
implementation 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; constructor TMRUList.Create;
begin begin
fMaxCount := 10; fMaxCount := 10;
@ -153,9 +193,11 @@ begin
end; end;
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 var
str1, str2: TMemoryStream; str1, str2: TMemoryStream;
rdr: TReader;
begin begin
str1 := TMemoryStream.Create; str1 := TMemoryStream.Create;
str2 := TMemoryStream.Create; str2 := TMemoryStream.Create;
@ -165,7 +207,14 @@ begin
ObjectTextToBinary(str1,str2); ObjectTextToBinary(str1,str2);
str2.Position := 0; str2.Position := 0;
try try
str2.ReadComponent(aComp); rdr := TReader.Create(str2, 4096);
try
rdr.OnPropertyNotFound := aPropNotFoundHandler;
rdr.OnError := anErrorHandler;
rdr.ReadRootComponent(aComp);
finally
rdr.Free;
end;
except except
end; end;
finally finally
@ -260,7 +309,7 @@ begin
{$HINTS ON}{$WARNINGS ON} {$HINTS ON}{$WARNINGS ON}
end; end;
function displayShortFilename(const aPath: string; charThresh: Word = 80): string; function shortenPath(const aPath: string; charThresh: Word = 80): string;
var var
i: NativeInt; i: NativeInt;
sepCnt: NativeInt; sepCnt: NativeInt;

View File

@ -5,7 +5,7 @@ unit ce_dmdwrap;
interface interface
uses uses
classes, sysutils; classes, sysutils, process;
(* (*
@ -238,6 +238,55 @@ type
procedure getOpts(const aList: TStrings); override; procedure getOpts(const aList: TStrings); override;
end; 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 * Encapsulates all the contextual options/args
*) *)
@ -251,6 +300,9 @@ type
fOutputOpts: TOutputOpts; fOutputOpts: TOutputOpts;
fPathsOpts: TPathsOpts; fPathsOpts: TPathsOpts;
fOthers: TOtherOpts; fOthers: TOtherOpts;
fPreProcOpt: TCompileProcOptions;
fPostProcOpt: TCompileProcOptions;
fRunProjOpt: TProjectRunOptions;
procedure doChanged; procedure doChanged;
procedure subOptsChanged(sender: TObject); procedure subOptsChanged(sender: TObject);
procedure setName(const aValue: string); procedure setName(const aValue: string);
@ -260,6 +312,9 @@ type
procedure setOutputOpts(const aValue: TOutputOpts); procedure setOutputOpts(const aValue: TOutputOpts);
procedure setPathsOpts(const aValue: TPathsOpts); procedure setPathsOpts(const aValue: TPathsOpts);
procedure setOthers(const aValue: TOtherOpts); procedure setOthers(const aValue: TOtherOpts);
procedure setPreProcOpt(const aValue: TCompileProcOptions);
procedure setPostProcOpt(const aValue: TCompileProcOptions);
procedure setRunProjOpt(const aValue: TProjectRunOptions);
protected protected
function nameFromID: string; function nameFromID: string;
published published
@ -270,6 +325,9 @@ type
property outputOptions: TOutputOpts read fOutputOpts write setOutputOpts; property outputOptions: TOutputOpts read fOutputOpts write setOutputOpts;
property pathsOptions: TPathsOpts read fPathsOpts write setPathsOpts; property pathsOptions: TPathsOpts read fPathsOpts write setPathsOpts;
property otherOptions: TOtherOpts read fOthers write setOthers; 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 public
constructor create(aCollection: TCollection); override; constructor create(aCollection: TCollection); override;
destructor destroy; override; destructor destroy; override;
@ -281,7 +339,7 @@ type
implementation implementation
uses uses
ce_common; ce_common, ce_main;
procedure TOptsGroup.doChanged; procedure TOptsGroup.doChanged;
begin begin
@ -851,6 +909,74 @@ begin
end; end;
{$ENDREGION} {$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 ************************************************} {$REGION TCompilerConfiguration ************************************************}
constructor TCompilerConfiguration.create(aCollection: TCollection); constructor TCompilerConfiguration.create(aCollection: TCollection);
begin begin
@ -862,6 +988,9 @@ begin
fOutputOpts := TOutputOpts.create; fOutputOpts := TOutputOpts.create;
fPathsOpts := TPathsOpts.create; fPathsOpts := TPathsOpts.create;
fOthers := TOtherOpts.create; fOthers := TOtherOpts.create;
fPreProcOpt := TCompileProcOptions.create;
fPostProcOpt:= TCompileProcOptions.create;
fRunProjOpt := TProjectRunOptions.create;
fDocOpts.onChange := @subOptsChanged; fDocOpts.onChange := @subOptsChanged;
fDebugOpts.onChange := @subOptsChanged; fDebugOpts.onChange := @subOptsChanged;
@ -869,6 +998,9 @@ begin
fOutputOpts.onChange := @subOptsChanged; fOutputOpts.onChange := @subOptsChanged;
fPathsOpts.onChange := @subOptsChanged; fPathsOpts.onChange := @subOptsChanged;
fOthers.onChange := @subOptsChanged; fOthers.onChange := @subOptsChanged;
fPreProcOpt.onChange := @subOptsChanged;
fPostProcOpt.onChange := @subOptsChanged;
fRunProjOpt.onChange := @subOptsChanged;
fName := nameFromID; fName := nameFromID;
end; end;
@ -882,6 +1014,9 @@ begin
fOutputOpts.free; fOutputOpts.free;
fPathsOpts.free; fPathsOpts.free;
fOthers.free; fOthers.free;
fPreProcOpt.free;
fPostProcOpt.free;
fRunProjOpt.Free;
inherited; inherited;
end; end;
@ -898,6 +1033,9 @@ begin
fOutputOpts.assign(src.fOutputOpts); fOutputOpts.assign(src.fOutputOpts);
fPathsOpts.assign(src.fPathsOpts); fPathsOpts.assign(src.fPathsOpts);
fOthers.assign(src.fOthers); fOthers.assign(src.fOthers);
fPreProcOpt.assign(src.fPreProcOpt);
fPostProcOpt.assign(src.fPostProcOpt);
fRunProjOpt.assign(src.fRunProjOpt);
end end
else inherited; else inherited;
end; end;
@ -966,9 +1104,24 @@ procedure TCompilerConfiguration.setOthers(const aValue: TOtherOpts);
begin begin
fOthers.Assign(aValue); fOthers.Assign(aValue);
end; 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} {$ENDREGION}
initialization initialization
RegisterClasses([TCompilerConfiguration, TOtherOpts, TPathsOpts, RegisterClasses([TOtherOpts, TPathsOpts, TDebugOpts, TOutputOpts, TMsgOpts,
TDebugOpts, TOutputOpts, TMsgOpts, TDocOpts]); TDocOpts, TCompileProcOptions, TProjectRunOptions, TCompilerConfiguration]);
end. end.

View File

@ -1,5 +1,7 @@
inherited CEEditorWidget: TCEEditorWidget inherited CEEditorWidget: TCEEditorWidget
Left = 1324
Height = 382 Height = 382
Top = 92
Width = 465 Width = 465
Caption = 'Source editor' Caption = 'Source editor'
ClientHeight = 382 ClientHeight = 382

View File

@ -161,6 +161,7 @@ begin
memo.OnMouseMove := @memoMouseMove; memo.OnMouseMove := @memoMouseMove;
// //
pageControl.ActivePage := sheet; pageControl.ActivePage := sheet;
//http://bugs.freepascal.org/view.php?id=26320 //http://bugs.freepascal.org/view.php?id=26320
focusedEditorChanged; focusedEditorChanged;
end; end;

View File

@ -1,5 +1,5 @@
object CEMainForm: TCEMainForm object CEMainForm: TCEMainForm
Left = 1113 Left = 1122
Height = 53 Height = 53
Top = 26 Top = 26
Width = 745 Width = 745
@ -1142,6 +1142,42 @@ object CEMainForm: TCEMainForm
end end
object MenuItem55: TMenuItem object MenuItem55: TMenuItem
Action = actProjOptView 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 end
object MenuItem40: TMenuItem object MenuItem40: TMenuItem
Caption = '-' Caption = '-'

View File

@ -7,7 +7,7 @@ interface
uses uses
Classes, SysUtils, FileUtil, SynEditKeyCmds, SynHighlighterLFM, Forms, Classes, SysUtils, FileUtil, SynEditKeyCmds, SynHighlighterLFM, Forms,
AnchorDocking, AnchorDockStorage, AnchorDockOptionsDlg, Controls, Graphics, 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_common, ce_dmdwrap, ce_project, ce_synmemo, ce_widget, ce_messages,
ce_editor, ce_projinspect, ce_projconf, ce_staticexplorer, ce_search; ce_editor, ce_projinspect, ce_projconf, ce_staticexplorer, ce_search;
@ -239,6 +239,7 @@ type
property MessageWidget: TCEMessagesWidget read fMesgWidg; property MessageWidget: TCEMessagesWidget read fMesgWidg;
property EditWidget: TCEEditorWidget read fEditWidg; property EditWidget: TCEEditorWidget read fEditWidg;
property ProjectWidget: TCEProjectInspectWidget read fProjWidg; property ProjectWidget: TCEProjectInspectWidget read fProjWidg;
property ProjectConfWidget: TCEProjectConfigurationWidget read fPrjCfWidg;
end; end;
var var
@ -482,7 +483,7 @@ begin
begin begin
itm := TMenuItem.Create(trgMnu); itm := TMenuItem.Create(trgMnu);
itm.Hint := fname; itm.Hint := fname;
itm.Caption := displayShortFilename(fname, 50); itm.Caption := shortenPath(fname, 50);
itm.OnClick := clickTrg; itm.OnClick := clickTrg;
trgMnu.Add(itm); trgMnu.Add(itm);
end; end;
@ -924,21 +925,40 @@ end;
procedure TCEMainForm.compileProject(const aProject: TCEProject); procedure TCEMainForm.compileProject(const aProject: TCEProject);
var var
dmdproc: TProcess; dmdproc: TProcess;
ppproc: TProcess;
olddir, prjpath: string; olddir, prjpath: string;
begin begin
fMesgWidg.Clear;
if aProject.Sources.Count = 0 then if aProject.Sources.Count = 0 then
begin begin
fMesgWidg.addCeErr( aProject.fileName + ' has no source files' ); fMesgWidg.addCeErr( aProject.fileName + ' has no source files' );
exit; exit;
end; 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 := ''; olddir := '';
dmdproc := TProcess.Create(nil); dmdproc := TProcess.Create(nil);
getDir(0, olddir); getDir(0, olddir);
try try
fMesgWidg.Clear;
fMesgWidg.addCeInf( 'compiling ' + aProject.fileName ); fMesgWidg.addCeInf( 'compiling ' + aProject.fileName );
prjpath := extractFilePath(aProject.fileName); prjpath := extractFilePath(aProject.fileName);
@ -968,6 +988,22 @@ begin
+ ' has not been compiled' ); + ' has not been compiled' );
end; 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 finally
dmdproc.Free; dmdproc.Free;
chDir(olddir); chDir(olddir);
@ -984,7 +1020,10 @@ begin
runproc := TProcess.Create(nil); runproc := TProcess.Create(nil);
try 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; procname := aProject.currentConfiguration.pathsOptions.outputFilename;
if procname <> '' then procname := aProject.getAbsoluteFilename(procname) if procname <> '' then procname := aProject.getAbsoluteFilename(procname)
@ -1006,9 +1045,10 @@ begin
end; end;
runproc.Executable := procname; runproc.Executable := procname;
runproc.Parameters.Text := runArgs; //runproc.Parameters.Text := runArgs;
runproc.Execute; runproc.Execute;
while runproc.Running do if runproc.ExitStatus <> 0 then break; while runproc.Running do if runproc.ExitStatus <> 0 then break;
ProcessOutputToMsg(runproc);
finally finally
runproc.Free; runproc.Free;
@ -1104,7 +1144,7 @@ begin
// //
aEditor.modified := false; aEditor.modified := false;
aEditor.Lines.SaveToFile(fProject.fileName); aEditor.Lines.SaveToFile(fProject.fileName);
self.openProj(fProject.fileName); openProj(fProject.fileName);
end; end;
procedure TCEMainForm.closeProj; procedure TCEMainForm.closeProj;
@ -1361,4 +1401,6 @@ begin
end; end;
{$ENDREGION} {$ENDREGION}
initialization
RegisterClasses([TCEOptions]);
end. end.

View File

@ -1,7 +1,7 @@
inherited CEMessagesWidget: TCEMessagesWidget inherited CEMessagesWidget: TCEMessagesWidget
Left = 1143 Left = 621
Height = 172 Height = 172
Top = 511 Top = 659
Width = 744 Width = 744
Caption = 'Messages' Caption = 'Messages'
ClientHeight = 172 ClientHeight = 172

View File

@ -1,24 +1,24 @@
inherited CEProjectConfigurationWidget: TCEProjectConfigurationWidget inherited CEProjectConfigurationWidget: TCEProjectConfigurationWidget
Left = 1323 Left = 1394
Height = 277 Height = 383
Top = 600 Top = 480
Width = 450 Width = 445
Caption = 'Project configuration' Caption = 'Project configuration'
ClientHeight = 277 ClientHeight = 383
ClientWidth = 450 ClientWidth = 445
inherited Back: TPanel inherited Back: TPanel
Height = 277 Height = 383
Width = 450 Width = 445
ClientHeight = 277 ClientHeight = 383
ClientWidth = 450 ClientWidth = 445
inherited Content: TPanel inherited Content: TPanel
Height = 277 Height = 383
Width = 450 Width = 445
ClientHeight = 277 ClientHeight = 383
ClientWidth = 450 ClientWidth = 445
object Tree: TTreeView[0] object Tree: TTreeView[0]
Left = 4 Left = 4
Height = 243 Height = 349
Hint = 'filter configuration elements' Hint = 'filter configuration elements'
Top = 30 Top = 30
Width = 125 Width = 125
@ -37,7 +37,7 @@ inherited CEProjectConfigurationWidget: TCEProjectConfigurationWidget
Options = [tvoAutoExpand, tvoAutoItemHeight, tvoKeepCollapsedNodes, tvoReadOnly, tvoShowButtons, tvoShowLines, tvoToolTips, tvoThemedDraw] Options = [tvoAutoExpand, tvoAutoItemHeight, tvoKeepCollapsedNodes, tvoReadOnly, tvoShowButtons, tvoShowLines, tvoToolTips, tvoThemedDraw]
Items.Data = { Items.Data = {
F9FFFFFF020003000000FFFFFFFFFFFFFFFF01000000FFFFFFFF000000000000 F9FFFFFF020003000000FFFFFFFFFFFFFFFF01000000FFFFFFFF000000000000
0000000700000047656E6572616CFFFFFFFFFFFFFFFF02000000FFFFFFFF0600 0000000700000047656E6572616CFFFFFFFFFFFFFFFF02000000FFFFFFFF0900
000000000000010A00000043617465676F72696573FFFFFFFFFFFFFFFF020000 000000000000010A00000043617465676F72696573FFFFFFFFFFFFFFFF020000
00FFFFFFFF000000000000000000080000004D65737361676573FFFFFFFFFFFF 00FFFFFFFF000000000000000000080000004D65737361676573FFFFFFFFFFFF
FFFF03000000FFFFFFFF000000000000000000080000004465627567696E67FF FFFF03000000FFFFFFFF000000000000000000080000004465627567696E67FF
@ -46,26 +46,33 @@ inherited CEProjectConfigurationWidget: TCEProjectConfigurationWidget
0000060000004F7574707574FFFFFFFFFFFFFFFF06000000FFFFFFFF00000000 0000060000004F7574707574FFFFFFFFFFFFFFFF06000000FFFFFFFF00000000
0000000000060000004F7468657273FFFFFFFFFFFFFFFF07000000FFFFFFFF00 0000000000060000004F7468657273FFFFFFFFFFFFFFFF07000000FFFFFFFF00
0000000000000000050000005061746873FFFFFFFFFFFFFFFF08000000FFFFFF 0000000000000000050000005061746873FFFFFFFFFFFFFFFF08000000FFFFFF
FF0000000000000000000E000000416C6C2063617465676F72696573 FF000000000000000000110000005072652D6275696C642070726F63657373FF
FFFFFFFFFFFFFF09000000FFFFFFFF00000000000000000012000000506F7374
2D6275696C642070726F63657373FFFFFFFFFFFFFFFF0A000000FFFFFFFF0000
000000000000000B00000052756E206F7074696F6E73FFFFFFFFFFFFFFFF0B00
0000FFFFFFFF0000000000000000000E000000416C6C2063617465676F726965
73
} }
end end
object Panel1: TPanel[1] object Panel1: TPanel[1]
Left = 2 Left = 4
Height = 24 Height = 24
Top = 2 Top = 2
Width = 446 Width = 437
Align = alTop Align = alTop
BorderSpacing.Left = 2
BorderSpacing.Right = 2
BorderSpacing.Around = 2 BorderSpacing.Around = 2
BevelOuter = bvNone BevelOuter = bvNone
ClientHeight = 24 ClientHeight = 24
ClientWidth = 446 ClientWidth = 437
TabOrder = 1 TabOrder = 1
object selConf: TComboBox object selConf: TComboBox
Left = 0 Left = 0
Height = 23 Height = 23
Hint = 'select a configuration' Hint = 'select a configuration'
Top = 1 Top = 1
Width = 355 Width = 346
Align = alClient Align = alClient
BorderSpacing.Top = 1 BorderSpacing.Top = 1
BorderSpacing.Right = 1 BorderSpacing.Right = 1
@ -75,7 +82,7 @@ inherited CEProjectConfigurationWidget: TCEProjectConfigurationWidget
TabOrder = 0 TabOrder = 0
end end
object btnAddConf: TSpeedButton object btnAddConf: TSpeedButton
Left = 356 Left = 347
Height = 24 Height = 24
Hint = 'add an empty configuration' Hint = 'add an empty configuration'
Top = 0 Top = 0
@ -121,7 +128,7 @@ inherited CEProjectConfigurationWidget: TCEProjectConfigurationWidget
ShowCaption = False ShowCaption = False
end end
object btnDelConf: TSpeedButton object btnDelConf: TSpeedButton
Left = 386 Left = 377
Height = 24 Height = 24
Hint = 'remove selected configuration' Hint = 'remove selected configuration'
Top = 0 Top = 0
@ -167,7 +174,7 @@ inherited CEProjectConfigurationWidget: TCEProjectConfigurationWidget
ShowCaption = False ShowCaption = False
end end
object btnCloneConf: TSpeedButton object btnCloneConf: TSpeedButton
Left = 416 Left = 407
Height = 24 Height = 24
Hint = 'clone selected configuration' Hint = 'clone selected configuration'
Top = 0 Top = 0
@ -215,15 +222,15 @@ inherited CEProjectConfigurationWidget: TCEProjectConfigurationWidget
end end
object Splitter1: TSplitter[2] object Splitter1: TSplitter[2]
Left = 129 Left = 129
Height = 249 Height = 355
Top = 28 Top = 28
Width = 5 Width = 5
end end
object Grid: TTIPropertyGrid[3] object Grid: TTIPropertyGrid[3]
Left = 134 Left = 134
Height = 243 Height = 349
Top = 30 Top = 30
Width = 312 Width = 307
Align = alClient Align = alClient
BorderSpacing.Top = 4 BorderSpacing.Top = 4
BorderSpacing.Right = 4 BorderSpacing.Right = 4

View File

@ -157,7 +157,10 @@ begin
5: exit( fProj.currentConfiguration.outputOptions ); 5: exit( fProj.currentConfiguration.outputOptions );
6: exit( fProj.currentConfiguration.otherOptions ); 6: exit( fProj.currentConfiguration.otherOptions );
7: exit( fProj.currentConfiguration.pathsOptions ); 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; else result := nil;
end; end;
end; end;

View File

@ -4,8 +4,6 @@ unit ce_project;
interface interface
// TODO: pre/post compilation shell-script / process
// TODO: run opts, newConsole, catch output, etc
// TODO: configuration templates // TODO: configuration templates
uses uses
@ -39,6 +37,10 @@ type
procedure setConfIx(aValue: Integer); procedure setConfIx(aValue: Integer);
function getConfig(const ix: integer): TCompilerConfiguration; function getConfig(const ix: integer): TCompilerConfiguration;
function getCurrConf: 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 published
property OptionsCollection: TCollection read fOptsColl write setOptsColl; property OptionsCollection: TCollection read fOptsColl write setOptsColl;
property Sources: TStringList read fSrcs write setSrcs; // 'read' should return a copy to avoid abs/rel errors property Sources: TStringList read fSrcs write setSrcs; // 'read' should return a copy to avoid abs/rel errors
@ -67,7 +69,7 @@ type
implementation implementation
uses uses
ce_common; ce_common, dialogs;
constructor TCEProject.create(aOwner: TComponent); constructor TCEProject.create(aOwner: TComponent);
begin begin
@ -264,12 +266,26 @@ end;
procedure TCEProject.loadFromFile(const aFilename: string); procedure TCEProject.loadFromFile(const aFilename: string);
begin begin
Filename := aFilename; Filename := aFilename;
loadCompFromTxtFile(self, aFilename); loadCompFromTxtFile(self, aFilename, @readerPropNoFound, @readerError);
patchPlateformPaths(fSrcs); patchPlateformPaths(fSrcs);
doChanged; doChanged;
fModified := false; fModified := false;
end; 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 initialization
RegisterClasses([TCEProject]); RegisterClasses([TCEProject]);
end. end.

View File

@ -1,20 +1,20 @@
inherited CESearchWidget: TCESearchWidget inherited CESearchWidget: TCESearchWidget
Left = 1492 Left = 1486
Height = 239 Height = 238
Top = 468 Top = 327
Width = 394 Width = 394
Caption = 'Search & replace' Caption = 'Search & replace'
ClientHeight = 239 ClientHeight = 238
ClientWidth = 394 ClientWidth = 394
inherited Back: TPanel inherited Back: TPanel
Height = 239 Height = 238
Width = 394 Width = 394
ClientHeight = 239 ClientHeight = 238
ClientWidth = 394 ClientWidth = 394
inherited Content: TPanel inherited Content: TPanel
Height = 239 Height = 238
Width = 394 Width = 394
ClientHeight = 239 ClientHeight = 238
ClientWidth = 394 ClientWidth = 394
object cbToFind: TComboBox[0] object cbToFind: TComboBox[0]
Left = 4 Left = 4
@ -22,6 +22,7 @@ inherited CESearchWidget: TCESearchWidget
Top = 4 Top = 4
Width = 386 Width = 386
Align = alTop Align = alTop
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Around = 4 BorderSpacing.Around = 4
ItemHeight = 15 ItemHeight = 15
OnChange = cbToFindChange OnChange = cbToFindChange
@ -30,7 +31,7 @@ inherited CESearchWidget: TCESearchWidget
object btnFind: TBitBtn[1] object btnFind: TBitBtn[1]
Left = 4 Left = 4
Height = 24 Height = 24
Top = 155 Top = 154
Width = 386 Width = 386
Align = alBottom Align = alBottom
BorderSpacing.Around = 4 BorderSpacing.Around = 4
@ -76,7 +77,7 @@ inherited CESearchWidget: TCESearchWidget
object btnReplace: TBitBtn[2] object btnReplace: TBitBtn[2]
Left = 4 Left = 4
Height = 24 Height = 24
Top = 183 Top = 182
Width = 386 Width = 386
Align = alBottom Align = alBottom
BorderSpacing.Around = 4 BorderSpacing.Around = 4
@ -121,13 +122,13 @@ inherited CESearchWidget: TCESearchWidget
end end
object grpOpts: TGroupBox[3] object grpOpts: TGroupBox[3]
Left = 4 Left = 4
Height = 90 Height = 92
Top = 61 Top = 58
Width = 386 Width = 386
Align = alClient Align = alClient
BorderSpacing.Around = 4 BorderSpacing.Around = 4
Caption = 'Options' Caption = 'Options'
ClientHeight = 72 ClientHeight = 74
ClientWidth = 382 ClientWidth = 382
TabOrder = 3 TabOrder = 3
object chkWWord: TCheckBox object chkWWord: TCheckBox
@ -176,7 +177,7 @@ inherited CESearchWidget: TCESearchWidget
object btnReplaceAll: TBitBtn[4] object btnReplaceAll: TBitBtn[4]
Left = 4 Left = 4
Height = 24 Height = 24
Top = 211 Top = 210
Width = 386 Width = 386
Align = alBottom Align = alBottom
BorderSpacing.Around = 4 BorderSpacing.Around = 4
@ -221,13 +222,13 @@ inherited CESearchWidget: TCESearchWidget
end end
object Panel1: TPanel[5] object Panel1: TPanel[5]
Left = 4 Left = 4
Height = 26 Height = 23
Top = 31 Top = 31
Width = 386 Width = 386
Align = alTop Align = alTop
BorderSpacing.Around = 4 BorderSpacing.Around = 4
BevelOuter = bvNone BevelOuter = bvNone
ClientHeight = 26 ClientHeight = 23
ClientWidth = 386 ClientWidth = 386
TabOrder = 5 TabOrder = 5
object cbReplaceWth: TComboBox object cbReplaceWth: TComboBox
@ -236,13 +237,14 @@ inherited CESearchWidget: TCESearchWidget
Top = 0 Top = 0
Width = 296 Width = 296
Align = alClient Align = alClient
Anchors = [akTop, akLeft, akBottom]
ItemHeight = 15 ItemHeight = 15
OnChange = cbReplaceWthChange OnChange = cbReplaceWthChange
TabOrder = 0 TabOrder = 0
end end
object chkEnableRep: TCheckBox object chkEnableRep: TCheckBox
Left = 0 Left = 0
Height = 26 Height = 23
Top = 0 Top = 0
Width = 90 Width = 90
Align = alLeft Align = alLeft

View File

@ -12,7 +12,6 @@ uses
type type
{ TCESearchWidget } { TCESearchWidget }
TCESearchWidget = class(TCEWidget) TCESearchWidget = class(TCEWidget)
btnFind: TBitBtn; btnFind: TBitBtn;
btnReplace: TBitBtn; btnReplace: TBitBtn;