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_toolseditor, ce_procinput, ce_optionseditor, ce_symlist, ce_mru, ce_processes,
|
||||
ce_infos, ce_dubproject, ce_dialogs, ce_dubprojeditor, (*ce_gdb,*) ce_dfmt,
|
||||
ce_lcldragdrop, ce_projgroup;
|
||||
ce_lcldragdrop, ce_projgroup, ce_projutils;
|
||||
|
||||
type
|
||||
|
||||
|
@ -450,6 +450,7 @@ type
|
|||
fRunnableDest: TCEPathname;
|
||||
fAlwaysUseDest: boolean;
|
||||
fDscanUnittests: boolean;
|
||||
fAutoSaveProjectFiles: boolean;
|
||||
function getAdditionalPATH: string;
|
||||
procedure setAdditionalPATH(const value: string);
|
||||
function getDubCompiler: TCECompiler;
|
||||
|
@ -472,6 +473,7 @@ type
|
|||
property runnableDestination: TCEPathname read fRunnableDest write setRunnableDestination;
|
||||
property runnableDestinationAlways: boolean read fAlwaysUseDest write fAlwaysUseDest;
|
||||
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
|
||||
property dcdPort: word read fDcdPort write fDcdPort stored false;
|
||||
|
@ -2460,12 +2462,16 @@ end;
|
|||
|
||||
procedure TCEMainForm.actProjCompileExecute(Sender: TObject);
|
||||
begin
|
||||
if fAppliOpts.autoSaveProjectFiles then
|
||||
saveModifiedProjectFiles(fProject);
|
||||
fProject.compile;
|
||||
end;
|
||||
|
||||
procedure TCEMainForm.actProjCompileAndRunExecute(Sender: TObject);
|
||||
begin
|
||||
fRunProjAfterCompile := true;
|
||||
if fAppliOpts.autoSaveProjectFiles then
|
||||
saveModifiedProjectFiles(fProject);
|
||||
fProject.compile;
|
||||
end;
|
||||
|
||||
|
@ -2483,7 +2489,11 @@ begin
|
|||
end;
|
||||
if (not fProject.targetUpToDate) then if
|
||||
dlgYesNo('The project output is not up-to-date, rebuild ?') = mrYes then
|
||||
begin
|
||||
if fAppliOpts.autoSaveProjectFiles then
|
||||
saveModifiedProjectFiles(fProject);
|
||||
fProject.compile;
|
||||
end;
|
||||
if fProject.outputFilename.fileExists
|
||||
or (fProject.getFormat = pfDub) then
|
||||
fProject.run;
|
||||
|
|
|
@ -5,7 +5,7 @@ interface
|
|||
|
||||
uses
|
||||
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
|
||||
TCEProjectFileFormat = (pffNone, pffCe, pffDub);
|
||||
|
@ -28,6 +28,11 @@ function isProject(const filename: string): boolean;
|
|||
*)
|
||||
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
|
||||
|
||||
function isProject(const filename: string): boolean;
|
||||
|
@ -87,5 +92,20 @@ begin
|
|||
EntitiesConnector.endUpdate;
|
||||
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.
|
||||
|
||||
|
|
Loading…
Reference in New Issue