mirror of https://gitlab.com/basile.b/dexed.git
added custom property editors for filenames and paths
activated in - custom tools editor: working dir + executable - project conf: doc output, object dir, output filename, etc
This commit is contained in:
parent
4241c7325a
commit
0395b36035
|
@ -140,7 +140,7 @@
|
|||
<PackageName Value="LCL"/>
|
||||
</Item6>
|
||||
</RequiredPackages>
|
||||
<Units Count="35">
|
||||
<Units Count="36">
|
||||
<Unit0>
|
||||
<Filename Value="coedit.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
|
@ -358,6 +358,11 @@
|
|||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="ce_dubwrap"/>
|
||||
</Unit34>
|
||||
<Unit35>
|
||||
<Filename Value="..\src\ce_inspectors.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="ce_inspectors"/>
|
||||
</Unit35>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
|
|
|
@ -8,7 +8,7 @@ uses
|
|||
{$ENDIF}{$ENDIF}
|
||||
Interfaces, Forms, lazcontrols, runtimetypeinfocontrols, ce_observer, ce_libman,
|
||||
ce_tools, ce_dcd, ce_main, ce_writableComponent, ce_options, ce_symstring,
|
||||
ce_staticmacro, ce_icons, ce_dubwrap;
|
||||
ce_staticmacro, ce_icons, ce_dubwrap, ce_inspectors;
|
||||
|
||||
{$R *.res}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ unit ce_dmdwrap;
|
|||
interface
|
||||
|
||||
uses
|
||||
classes, sysutils, process, asyncprocess, ce_common;
|
||||
classes, sysutils, process, asyncprocess, ce_common, ce_inspectors;
|
||||
|
||||
(*
|
||||
|
||||
|
@ -39,18 +39,18 @@ type
|
|||
TDocOpts = class(TOptsGroup)
|
||||
private
|
||||
fGenDoc: boolean;
|
||||
fDocDir: string;
|
||||
fDocDir: TCEPathname;
|
||||
fGenJson: boolean;
|
||||
fJsonFname: string;
|
||||
fJsonFname: TCEFilename;
|
||||
procedure setGenDoc(const aValue: boolean);
|
||||
procedure setGenJSON(const aValue: boolean);
|
||||
procedure setDocDir(const aValue: string);
|
||||
procedure setJSONFile(const aValue: string);
|
||||
procedure setDocDir(const aValue: TCEPathname);
|
||||
procedure setJSONFile(const aValue: TCEFilename);
|
||||
published
|
||||
property generateDocumentation: boolean read fGenDoc write setGenDoc default false;
|
||||
property generateJSON: boolean read fGenJson write setGenJSON default false;
|
||||
property DocumentationDirectory: string read fDocDir write setDocDir;
|
||||
property JSONFilename: string read fJsonFname write setJSONFile;
|
||||
property DocumentationDirectory: TCEPathname read fDocDir write setDocDir;
|
||||
property JSONFilename: TCEFilename read fJsonFname write setJSONFile;
|
||||
public
|
||||
procedure assign(aValue: TPersistent); override;
|
||||
procedure getOpts(const aList: TStrings); override;
|
||||
|
@ -208,18 +208,18 @@ type
|
|||
fIncl: TStringList;
|
||||
fImpt: TStringList;
|
||||
fExcl: TStringList;
|
||||
fFname: string;
|
||||
fObjDir: string;
|
||||
procedure setFname(const aValue: string);
|
||||
procedure setObjDir(const aValue: string);
|
||||
fFname: TCEFilename;
|
||||
fObjDir: TCEPathname;
|
||||
procedure setFname(const aValue: TCEFilename);
|
||||
procedure setObjDir(const aValue: TCEPathname);
|
||||
procedure setSrcs(aValue: TStringList);
|
||||
procedure setIncl(aValue: TStringList);
|
||||
procedure setImpt(aValue: TStringList);
|
||||
procedure setExcl(aValue: TStringList);
|
||||
procedure strLstChange(sender: TObject);
|
||||
published
|
||||
property outputFilename: string read fFname write setFname;
|
||||
property objectDirectory: string read fObjDir write setObjDir;
|
||||
property outputFilename: TCEFilename read fFname write setFname;
|
||||
property objectDirectory: TCEPathname read fObjDir write setObjDir;
|
||||
property Sources: TStringList read fExtraSrcs write setSrcs stored false; deprecated;
|
||||
property exclusions: TStringList read fExcl write setExcl;
|
||||
property extraSources: TStringList read fExtraSrcs write setSrcs;
|
||||
|
@ -254,19 +254,19 @@ type
|
|||
*)
|
||||
TCustomProcOptions = class(TOptsGroup)
|
||||
private
|
||||
fExecutable: string;
|
||||
fWorkDir: string;
|
||||
fExecutable: TCEFilename;
|
||||
fWorkDir: TCEPathname;
|
||||
fOptions: TProcessOptions;
|
||||
fParameters: TStringList;
|
||||
fShowWin: TShowWindowOptions;
|
||||
procedure setExecutable(const aValue: string);
|
||||
procedure setWorkDir(const aValue: string);
|
||||
procedure setExecutable(const aValue: TCEFilename);
|
||||
procedure setWorkDir(const aValue: TCEPathname);
|
||||
procedure setOptions(const aValue: TProcessOptions);
|
||||
procedure setParameters(aValue: TStringList);
|
||||
procedure setShowWin(const aValue: TShowWindowOptions);
|
||||
protected
|
||||
property executable: string read fExecutable write setExecutable;
|
||||
property workingDirectory: string read fWorkDir write setWorkDir;
|
||||
property executable: TCEFilename read fExecutable write setExecutable;
|
||||
property workingDirectory: TCEPathname read fWorkDir write setWorkDir;
|
||||
property options: TProcessOptions read fOptions write setOptions;
|
||||
property parameters: TStringList read fParameters write setParameters;
|
||||
property showWindow: TShowWindowOptions read fShowWin write setShowWin;
|
||||
|
@ -422,7 +422,7 @@ begin
|
|||
doChanged;
|
||||
end;
|
||||
|
||||
procedure TDocOpts.setDocDir(const aValue: string);
|
||||
procedure TDocOpts.setDocDir(const aValue: TCEPathname);
|
||||
begin
|
||||
if fDocDir = aValue then
|
||||
exit;
|
||||
|
@ -432,7 +432,7 @@ begin
|
|||
doChanged;
|
||||
end;
|
||||
|
||||
procedure TDocOpts.setJSONFile(const aValue: string);
|
||||
procedure TDocOpts.setJSONFile(const aValue: TCEFilename);
|
||||
begin
|
||||
if fJsonFname = aValue then
|
||||
exit;
|
||||
|
@ -887,7 +887,7 @@ begin
|
|||
inherited;
|
||||
end;
|
||||
|
||||
procedure TPathsOpts.setFname(const aValue: string);
|
||||
procedure TPathsOpts.setFname(const aValue: TCEFilename);
|
||||
begin
|
||||
if fFname = aValue then exit;
|
||||
fFname := patchPlateformPath(aValue);
|
||||
|
@ -895,7 +895,7 @@ begin
|
|||
doChanged;
|
||||
end;
|
||||
|
||||
procedure TPathsOpts.setObjDir(const aValue: string);
|
||||
procedure TPathsOpts.setObjDir(const aValue: TCEPathname);
|
||||
begin
|
||||
if fObjDir = aValue then exit;
|
||||
fObjDir := patchPlateformPath(aValue);
|
||||
|
@ -1045,14 +1045,14 @@ begin
|
|||
aProcess.StartupOptions := aProcess.StartupOptions + [suoUseShowWindow];
|
||||
end;
|
||||
|
||||
procedure TCustomProcOptions.setExecutable(const aValue: string);
|
||||
procedure TCustomProcOptions.setExecutable(const aValue: TCEFilename);
|
||||
begin
|
||||
if fExecutable = aValue then exit;
|
||||
fExecutable := aValue;
|
||||
doChanged;
|
||||
end;
|
||||
|
||||
procedure TCustomProcOptions.setWorkDir(const aValue: string);
|
||||
procedure TCustomProcOptions.setWorkDir(const aValue: TCEPathname);
|
||||
begin
|
||||
if fWorkDir = aValue then exit;
|
||||
fWorkDir := aValue;
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
unit ce_inspectors;
|
||||
|
||||
{$I ce_defines.inc}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Dialogs, PropEdits;
|
||||
|
||||
type
|
||||
|
||||
TCEPathname = type string;
|
||||
TCEFilename = type string;
|
||||
|
||||
TCustomPathType = (ptFile, ptFolder);
|
||||
|
||||
TCECustomPathEditor = class(TStringPropertyEditor)
|
||||
private
|
||||
fType: TCustomPathType;
|
||||
public
|
||||
function GetAttributes: TPropertyAttributes; override;
|
||||
procedure Edit; override;
|
||||
end;
|
||||
|
||||
TCEPathnameEditor = class(TCECustomPathEditor)
|
||||
constructor Create(Hook: TPropertyEditorHook; APropCount: Integer); override;
|
||||
end;
|
||||
|
||||
TCEFilenameEditor = class(TCECustomPathEditor)
|
||||
constructor Create(Hook: TPropertyEditorHook; APropCount: Integer); override;
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
function TCECustomPathEditor.GetAttributes: TPropertyAttributes;
|
||||
begin
|
||||
exit( inherited GetAttributes() + [paDialog]);
|
||||
end;
|
||||
|
||||
procedure TCECustomPathEditor.Edit;
|
||||
var
|
||||
newValue: string;
|
||||
begin
|
||||
case fType of
|
||||
ptFile:
|
||||
with TOpenDialog.create(nil) do try
|
||||
InitialDir := ExtractFileName(GetValue);
|
||||
FileName := GetValue;
|
||||
if Execute then SetValue(FileName);
|
||||
finally
|
||||
free;
|
||||
end;
|
||||
ptFolder:
|
||||
if SelectDirectory(GetPropInfo^.Name, GetValue, newValue) then
|
||||
SetValue(newValue);
|
||||
end;
|
||||
end;
|
||||
|
||||
constructor TCEPathnameEditor.Create(Hook: TPropertyEditorHook; APropCount: Integer);
|
||||
begin
|
||||
inherited;
|
||||
fType := ptFolder;
|
||||
end;
|
||||
|
||||
constructor TCEFilenameEditor.Create(Hook: TPropertyEditorHook; APropCount: Integer);
|
||||
begin
|
||||
inherited;
|
||||
fType := ptFile;
|
||||
end;
|
||||
|
||||
initialization
|
||||
RegisterPropertyEditor(TypeInfo(TCEPathname), nil, '', TCEPathnameEditor);
|
||||
RegisterPropertyEditor(TypeInfo(TCEFilename), nil, '', TCEfilenameEditor);
|
||||
end.
|
||||
|
|
@ -6,15 +6,15 @@ interface
|
|||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, process, menus,
|
||||
ce_common, ce_writableComponent, ce_interfaces, ce_observer;
|
||||
ce_common, ce_writableComponent, ce_interfaces, ce_observer, ce_inspectors;
|
||||
|
||||
type
|
||||
|
||||
TCEToolItem = class(TCollectionItem)
|
||||
private
|
||||
fProcess: TCheckedAsyncProcess;
|
||||
fExecutable: string;
|
||||
fWorkingDir: string;
|
||||
fExecutable: TCEFilename;
|
||||
fWorkingDir: TCEPathname;
|
||||
fShowWin: TShowWindowOptions;
|
||||
fOpts: TProcessOptions;
|
||||
fParameters: TStringList;
|
||||
|
@ -32,8 +32,8 @@ type
|
|||
published
|
||||
property toolAlias: string read fToolAlias write fToolAlias;
|
||||
property options: TProcessOptions read fOpts write fOpts;
|
||||
property executable: string read fExecutable write fExecutable;
|
||||
property workingDirectory: string read fWorkingDir write fWorkingDir;
|
||||
property executable: TCEFilename read fExecutable write fExecutable;
|
||||
property workingDirectory: TCEPathname read fWorkingDir write fWorkingDir;
|
||||
property parameters: TStringList read fParameters write setParameters;
|
||||
property showWindows: TShowWindowOptions read fShowWin write fShowWin;
|
||||
property queryParameters: boolean read fQueryParams write fQueryParams;
|
||||
|
|
Loading…
Reference in New Issue