diff --git a/lazproj/coedit.lpi b/lazproj/coedit.lpi index 9dbad959..4ccdf378 100644 --- a/lazproj/coedit.lpi +++ b/lazproj/coedit.lpi @@ -135,7 +135,7 @@ - + @@ -276,6 +276,11 @@ + + + + + diff --git a/src/ce_customtools.pas b/src/ce_customtools.pas new file mode 100644 index 00000000..2cc064e2 --- /dev/null +++ b/src/ce_customtools.pas @@ -0,0 +1,85 @@ +unit ce_customtools; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, process, ce_common; + +type + + TCEToolItem = class(TCollectionItem) + private + fExecutable: string; + fWorkingDir: string; + fShowWin: TShowWindowOptions; + fProcess: TProcess; + function getParameters: TStringList; + procedure setParameters(const aValue: TStringList); + published + property executable: string read fExecutable write fExecutable; + property workingDirectory: string read fWorkingDir write fWorkingDir; + property parameters: TStringList read getParameters write setParameters; + property showWindows: TShowWindowOptions read fShowWin write fShowWin; + public + constructor create(ACollection: TCollection); override; + destructor destroy; override; + // + property process: TProcess read fProcess; + procedure execute; + end; + + TCETools = class(TCollection) + private + function getItem(index: Integer): TCEToolItem; + public + constructor create(itemClass: TCollectionItem) override; + // + property tool[index: integer]: TCEToolItem read getItem; + end; + +implementation + +uses + CEMainForm; + +constructor TCEToolItem.create(ACollection: TCollection); +begin + inherited; + fProcess := TProcess.Create(nil); +end; + +destructor TCEToolItem.destroy; +begin + fProcess.Free; + inherited; +end; + +function TCEToolItem.getParameters: TStringList; +begin + result := fProcess.Parameters; +end; + +procedure TCEToolItem.setParameters(const aValue: TStringList); +begin + fProcess.Parameters.Assign(aValue); +end; + +procedure TCEToolItem.execute; +begin + +end; + +constructor TCETools.create(itemClass: TCollectionItem) override; +begin + inherited create(itemClass); +end; + +function TCETools.getItem(index: Integer): TCEToolItem; +begin + exit(TCEToolItem(Items[index])); +end; + +end. + diff --git a/src/ce_dcd.pas b/src/ce_dcd.pas index adb76107..c7fda59e 100644 --- a/src/ce_dcd.pas +++ b/src/ce_dcd.pas @@ -8,12 +8,12 @@ uses (** - * Stops the server: e.g: to remove some bugy imports from the libman. + * frees the server: e.g: to remove some bugy imports from the libman. *) procedure freeServer; (** - * Starts the server immediatly and not lazily. + * recreates the server. *) procedure createServer; diff --git a/src/ce_main.pas b/src/ce_main.pas index bc4e472f..a6bff238 100644 --- a/src/ce_main.pas +++ b/src/ce_main.pas @@ -16,7 +16,6 @@ type TCEMainForm = class; - //TODO-cfeature: switches -f, -p, -noplug //TODO-cfeature: options //TODO-cwidget: options editor (** @@ -226,6 +225,7 @@ type fLibMan: TLibraryManager; //Init - Fina + procedure getCMdParams; procedure checkCompilo; procedure InitLibMan; procedure InitMRUs; @@ -311,8 +311,9 @@ begin InitSettings; // newProj; - InitPlugins; checkCompilo; + getCMdParams; + end; procedure TCEMainForm.checkCompilo; @@ -326,6 +327,52 @@ begin close; end; +procedure TCEMainForm.getCMdParams; +var + value: string; + str: TStringList; +begin + if application.ParamCount > 0 then + begin + value := application.Params[1]; + if value <> '' then + begin + str := TStringList.Create; + try + str.DelimitedText := value; + for value in str do + begin + if fileExists(value) then + openFile(value); + end; + finally + str.Free; + end; + end; + end; + value := application.GetOptionValue('plugs'); + if value <> 'OFF' then + InitPlugins; + value := application.GetOptionValue('p', 'project'); + if (value <> '') and fileExists(value) then + openProj(value); + value := application.GetOptionValue('f', 'files'); + if value <> '' then + begin + str := TStringList.Create; + try + str.DelimitedText := value; + for value in str do + begin + if fileExists(value) then + openFile(value); + end; + finally + str.Free; + end; + end; +end; + procedure TCEMainForm.InitLibMan; var fname: string; @@ -1427,9 +1474,9 @@ label begin if fProject.currentConfiguration.outputOptions.binaryKind <> executable then begin - // TODO:-cfeature: define an alternative exe name for shared lib: + // TODO-cfeature: define an alternative exe name for shared lib: // e.g: the dll produced by the proj. is the input filename of an host app. - dlgOkInfo('Non executable project cant be run'); + dlgOkInfo('Non executable projects cant be run'); exit; end; if not fileExists(fProject.outputFilename) then