mirror of https://gitlab.com/basile.b/dexed.git
fix useless burst of updates when loading project from file
This commit is contained in:
parent
0881fe9cec
commit
3870020ad1
|
|
@ -31,7 +31,7 @@ type
|
||||||
fOptsColl: TCollection;
|
fOptsColl: TCollection;
|
||||||
fSrcs, fSrcsCop: TStringList;
|
fSrcs, fSrcsCop: TStringList;
|
||||||
fConfIx: Integer;
|
fConfIx: Integer;
|
||||||
fChangedCount: NativeInt;
|
fUpdateCount: NativeInt;
|
||||||
fProjectSubject: TCECustomSubject;
|
fProjectSubject: TCECustomSubject;
|
||||||
fRunner: TCheckedAsyncProcess;
|
fRunner: TCheckedAsyncProcess;
|
||||||
fLogMessager: TCECustomSubject;
|
fLogMessager: TCECustomSubject;
|
||||||
|
|
@ -53,6 +53,7 @@ type
|
||||||
// passes compilation message as "to be guessed"
|
// passes compilation message as "to be guessed"
|
||||||
procedure compProcOutput(proc: TProcess);
|
procedure compProcOutput(proc: TProcess);
|
||||||
protected
|
protected
|
||||||
|
procedure beforeLoad; override;
|
||||||
procedure afterSave; override;
|
procedure afterSave; override;
|
||||||
procedure afterLoad; override;
|
procedure afterLoad; override;
|
||||||
procedure setFilename(const aValue: string); override;
|
procedure setFilename(const aValue: string); override;
|
||||||
|
|
@ -67,8 +68,8 @@ type
|
||||||
public
|
public
|
||||||
constructor create(aOwner: TComponent); override;
|
constructor create(aOwner: TComponent); override;
|
||||||
destructor destroy; override;
|
destructor destroy; override;
|
||||||
procedure beforeChanged;
|
procedure beginUpdate;
|
||||||
procedure afterChanged;
|
procedure endUpdate;
|
||||||
procedure reset;
|
procedure reset;
|
||||||
procedure addDefaults;
|
procedure addDefaults;
|
||||||
function isProjectSource(const aFilename: string): boolean;
|
function isProjectSource(const aFilename: string): boolean;
|
||||||
|
|
@ -159,9 +160,9 @@ end;
|
||||||
procedure TCEProject.setRoot(const aValue: string);
|
procedure TCEProject.setRoot(const aValue: string);
|
||||||
begin
|
begin
|
||||||
if fRootFolder = aValue then exit;
|
if fRootFolder = aValue then exit;
|
||||||
beforeChanged;
|
beginUpdate;
|
||||||
fRootFolder := aValue;
|
fRootFolder := aValue;
|
||||||
afterChanged;
|
endUpdate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEProject.setFilename(const aValue: string);
|
procedure TCEProject.setFilename(const aValue: string);
|
||||||
|
|
@ -171,7 +172,7 @@ var
|
||||||
begin
|
begin
|
||||||
if fFilename = aValue then exit;
|
if fFilename = aValue then exit;
|
||||||
//
|
//
|
||||||
beforeChanged;
|
beginUpdate;
|
||||||
|
|
||||||
fFilename := aValue;
|
fFilename := aValue;
|
||||||
oldBase := fBasePath;
|
oldBase := fBasePath;
|
||||||
|
|
@ -184,56 +185,56 @@ begin
|
||||||
fSrcs[i] := newRel;
|
fSrcs[i] := newRel;
|
||||||
end;
|
end;
|
||||||
//
|
//
|
||||||
afterChanged;
|
endUpdate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEProject.setLibAliases(const aValue: TStringList);
|
procedure TCEProject.setLibAliases(const aValue: TStringList);
|
||||||
begin
|
begin
|
||||||
beforeChanged;
|
beginUpdate;
|
||||||
fLibAliases.Assign(aValue);
|
fLibAliases.Assign(aValue);
|
||||||
afterChanged;
|
endUpdate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEProject.setSrcs(const aValue: TStringList);
|
procedure TCEProject.setSrcs(const aValue: TStringList);
|
||||||
begin
|
begin
|
||||||
beforeChanged;
|
beginUpdate;
|
||||||
fSrcs.Assign(aValue);
|
fSrcs.Assign(aValue);
|
||||||
patchPlateformPaths(fSrcs);
|
patchPlateformPaths(fSrcs);
|
||||||
afterChanged;
|
endUpdate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEProject.setConfIx(aValue: Integer);
|
procedure TCEProject.setConfIx(aValue: Integer);
|
||||||
begin
|
begin
|
||||||
beforeChanged;
|
beginUpdate;
|
||||||
if aValue < 0 then aValue := 0;
|
if aValue < 0 then aValue := 0;
|
||||||
if aValue > fOptsColl.Count-1 then aValue := fOptsColl.Count-1;
|
if aValue > fOptsColl.Count-1 then aValue := fOptsColl.Count-1;
|
||||||
fConfIx := aValue;
|
fConfIx := aValue;
|
||||||
afterChanged;
|
endUpdate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEProject.subMemberChanged(sender : TObject);
|
procedure TCEProject.subMemberChanged(sender : TObject);
|
||||||
begin
|
begin
|
||||||
beforeChanged;
|
beginUpdate;
|
||||||
fModified := true;
|
fModified := true;
|
||||||
afterChanged;
|
endUpdate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEProject.beforeChanged;
|
procedure TCEProject.beginUpdate;
|
||||||
begin
|
begin
|
||||||
Inc(fChangedCount);
|
Inc(fUpdateCount);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEProject.afterChanged;
|
procedure TCEProject.endUpdate;
|
||||||
begin
|
begin
|
||||||
Dec(fChangedCount);
|
Dec(fUpdateCount);
|
||||||
if fChangedCount > 0 then
|
if fUpdateCount > 0 then
|
||||||
begin
|
begin
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF DEBUG}
|
||||||
DebugLn('project update count > 0');
|
DebugLn('project update count > 0');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
fChangedCount := 0;
|
fUpdateCount := 0;
|
||||||
doChanged;
|
doChanged;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
@ -300,14 +301,14 @@ procedure TCEProject.reset;
|
||||||
var
|
var
|
||||||
defConf: TCompilerConfiguration;
|
defConf: TCompilerConfiguration;
|
||||||
begin
|
begin
|
||||||
beforeChanged;
|
beginUpdate;
|
||||||
fConfIx := 0;
|
fConfIx := 0;
|
||||||
fOptsColl.Clear;
|
fOptsColl.Clear;
|
||||||
defConf := addConfiguration;
|
defConf := addConfiguration;
|
||||||
defConf.name := 'default';
|
defConf.name := 'default';
|
||||||
fSrcs.Clear;
|
fSrcs.Clear;
|
||||||
fFilename := '';
|
fFilename := '';
|
||||||
afterChanged;
|
endUpdate;
|
||||||
fModified := false;
|
fModified := false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
@ -356,6 +357,12 @@ begin
|
||||||
updateOutFilename;
|
updateOutFilename;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCEProject.beforeLoad;
|
||||||
|
begin
|
||||||
|
beginUpdate;
|
||||||
|
Inherited;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCEProject.afterLoad;
|
procedure TCEProject.afterLoad;
|
||||||
var
|
var
|
||||||
i, j: Integer;
|
i, j: Integer;
|
||||||
|
|
@ -409,6 +416,8 @@ begin
|
||||||
'paths may still exists (-of, -od, etc.) but cannot be automatically handled');
|
'paths may still exists (-of, -od, etc.) but cannot be automatically handled');
|
||||||
end;
|
end;
|
||||||
updateOutFilename;
|
updateOutFilename;
|
||||||
|
endUpdate;
|
||||||
|
fModified := false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEProject.readerPropNoFound(Reader: TReader; Instance: TPersistent;
|
procedure TCEProject.readerPropNoFound(Reader: TReader; Instance: TPersistent;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue