mirror of https://gitlab.com/basile.b/dexed.git
add option to save project file before compiling, close #75
This commit is contained in:
parent
b64d891023
commit
3b6c080bf2
|
@ -14,7 +14,7 @@ uses
|
||||||
ce_search, ce_miniexplorer, ce_libman, ce_libmaneditor, ce_todolist, ce_observer,
|
ce_search, ce_miniexplorer, ce_libman, ce_libmaneditor, ce_todolist, ce_observer,
|
||||||
ce_toolseditor, ce_procinput, ce_optionseditor, ce_symlist, ce_mru, ce_processes,
|
ce_toolseditor, ce_procinput, ce_optionseditor, ce_symlist, ce_mru, ce_processes,
|
||||||
ce_infos, ce_dubproject, ce_dialogs, ce_dubprojeditor, (*ce_gdb,*) ce_dfmt,
|
ce_infos, ce_dubproject, ce_dialogs, ce_dubprojeditor, (*ce_gdb,*) ce_dfmt,
|
||||||
ce_lcldragdrop, ce_projgroup;
|
ce_lcldragdrop, ce_projgroup, ce_projutils;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
|
@ -450,6 +450,7 @@ type
|
||||||
fRunnableDest: TCEPathname;
|
fRunnableDest: TCEPathname;
|
||||||
fAlwaysUseDest: boolean;
|
fAlwaysUseDest: boolean;
|
||||||
fDscanUnittests: boolean;
|
fDscanUnittests: boolean;
|
||||||
|
fAutoSaveProjectFiles: boolean;
|
||||||
function getAdditionalPATH: string;
|
function getAdditionalPATH: string;
|
||||||
procedure setAdditionalPATH(const value: string);
|
procedure setAdditionalPATH(const value: string);
|
||||||
function getDubCompiler: TCECompiler;
|
function getDubCompiler: TCECompiler;
|
||||||
|
@ -472,6 +473,7 @@ type
|
||||||
property runnableDestination: TCEPathname read fRunnableDest write setRunnableDestination;
|
property runnableDestination: TCEPathname read fRunnableDest write setRunnableDestination;
|
||||||
property runnableDestinationAlways: boolean read fAlwaysUseDest write fAlwaysUseDest;
|
property runnableDestinationAlways: boolean read fAlwaysUseDest write fAlwaysUseDest;
|
||||||
property dscanUnittests: boolean read fDscanUnittests write fDscanUnittests default true;
|
property dscanUnittests: boolean read fDscanUnittests write fDscanUnittests default true;
|
||||||
|
property autoSaveProjectFiles: boolean read fAutoSaveProjectFiles write fAutoSaveProjectFiles default false;
|
||||||
|
|
||||||
// published for ICEEditableOptions but stored by DCD wrapper since it reloads before CEMainForm
|
// published for ICEEditableOptions but stored by DCD wrapper since it reloads before CEMainForm
|
||||||
property dcdPort: word read fDcdPort write fDcdPort stored false;
|
property dcdPort: word read fDcdPort write fDcdPort stored false;
|
||||||
|
@ -2460,12 +2462,16 @@ end;
|
||||||
|
|
||||||
procedure TCEMainForm.actProjCompileExecute(Sender: TObject);
|
procedure TCEMainForm.actProjCompileExecute(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
|
if fAppliOpts.autoSaveProjectFiles then
|
||||||
|
saveModifiedProjectFiles(fProject);
|
||||||
fProject.compile;
|
fProject.compile;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEMainForm.actProjCompileAndRunExecute(Sender: TObject);
|
procedure TCEMainForm.actProjCompileAndRunExecute(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
fRunProjAfterCompile := true;
|
fRunProjAfterCompile := true;
|
||||||
|
if fAppliOpts.autoSaveProjectFiles then
|
||||||
|
saveModifiedProjectFiles(fProject);
|
||||||
fProject.compile;
|
fProject.compile;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -2483,7 +2489,11 @@ begin
|
||||||
end;
|
end;
|
||||||
if (not fProject.targetUpToDate) then if
|
if (not fProject.targetUpToDate) then if
|
||||||
dlgYesNo('The project output is not up-to-date, rebuild ?') = mrYes then
|
dlgYesNo('The project output is not up-to-date, rebuild ?') = mrYes then
|
||||||
|
begin
|
||||||
|
if fAppliOpts.autoSaveProjectFiles then
|
||||||
|
saveModifiedProjectFiles(fProject);
|
||||||
fProject.compile;
|
fProject.compile;
|
||||||
|
end;
|
||||||
if fProject.outputFilename.fileExists
|
if fProject.outputFilename.fileExists
|
||||||
or (fProject.getFormat = pfDub) then
|
or (fProject.getFormat = pfDub) then
|
||||||
fProject.run;
|
fProject.run;
|
||||||
|
|
|
@ -5,7 +5,7 @@ interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils,
|
Classes, SysUtils,
|
||||||
ce_nativeproject, ce_dubproject, ce_interfaces, ce_common, ce_observer;
|
ce_nativeproject, ce_dubproject, ce_interfaces, ce_common, ce_observer, ce_synmemo;
|
||||||
|
|
||||||
type
|
type
|
||||||
TCEProjectFileFormat = (pffNone, pffCe, pffDub);
|
TCEProjectFileFormat = (pffNone, pffCe, pffDub);
|
||||||
|
@ -28,6 +28,11 @@ function isProject(const filename: string): boolean;
|
||||||
*)
|
*)
|
||||||
function projectFormat(const filename: string): TCEProjectFileFormat;
|
function projectFormat(const filename: string): TCEProjectFileFormat;
|
||||||
|
|
||||||
|
(**
|
||||||
|
* Saves all the project files that are being edited and if they're modified.
|
||||||
|
*)
|
||||||
|
procedure saveModifiedProjectFiles(project: ICECommonProject);
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
function isProject(const filename: string): boolean;
|
function isProject(const filename: string): boolean;
|
||||||
|
@ -87,5 +92,20 @@ begin
|
||||||
EntitiesConnector.endUpdate;
|
EntitiesConnector.endUpdate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure saveModifiedProjectFiles(project: ICECommonProject);
|
||||||
|
var
|
||||||
|
mdh: ICEMultiDocHandler;
|
||||||
|
doc: TCESynMemo;
|
||||||
|
i: integer;
|
||||||
|
begin
|
||||||
|
mdh := getMultiDocHandler;
|
||||||
|
for i:= 0 to project.sourcesCount-1 do
|
||||||
|
begin
|
||||||
|
doc := mdh.findDocument(project.sourceAbsolute(i));
|
||||||
|
if doc.isNotNil and doc.modified then
|
||||||
|
doc.save;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue