mirror of https://gitlab.com/basile.b/dexed.git
fix, when opening a project from the explorer, the previous project was not freed
This commit is contained in:
parent
69ea68117f
commit
17f639d416
|
@ -33,7 +33,7 @@ type
|
||||||
|
|
||||||
{ TCEMiniExplorerWidget }
|
{ TCEMiniExplorerWidget }
|
||||||
|
|
||||||
TCEMiniExplorerWidget = class(TCEWidget)
|
TCEMiniExplorerWidget = class(TCEWidget, ICEProjectObserver)
|
||||||
btnAddFav: TBitBtn;
|
btnAddFav: TBitBtn;
|
||||||
btnEdit: TBitBtn;
|
btnEdit: TBitBtn;
|
||||||
btnShellOpen: TBitBtn;
|
btnShellOpen: TBitBtn;
|
||||||
|
@ -56,6 +56,7 @@ type
|
||||||
procedure lstFilesEnter(Sender: TObject);
|
procedure lstFilesEnter(Sender: TObject);
|
||||||
procedure TreeEnter(Sender: TObject);
|
procedure TreeEnter(Sender: TObject);
|
||||||
private
|
private
|
||||||
|
fProj: ICECommonProject;
|
||||||
fFavorites: TStringList;
|
fFavorites: TStringList;
|
||||||
fLastFold: string;
|
fLastFold: string;
|
||||||
fLastListOrTree: TControl;
|
fLastListOrTree: TControl;
|
||||||
|
@ -75,6 +76,12 @@ type
|
||||||
procedure lstFavSelect(Sender: TObject; Item: TListItem; Selected: Boolean);
|
procedure lstFavSelect(Sender: TObject; Item: TListItem; Selected: Boolean);
|
||||||
procedure shellOpenSelected;
|
procedure shellOpenSelected;
|
||||||
procedure lstFilterChange(sender: TObject);
|
procedure lstFilterChange(sender: TObject);
|
||||||
|
//
|
||||||
|
procedure projNew(aProject: ICECommonProject);
|
||||||
|
procedure projChanged(aProject: ICECommonProject);
|
||||||
|
procedure projClosing(aProject: ICECommonProject);
|
||||||
|
procedure projFocused(aProject: ICECommonProject);
|
||||||
|
procedure projCompiling(aProject: ICECommonProject);
|
||||||
public
|
public
|
||||||
constructor create(aIwner: TComponent); override;
|
constructor create(aIwner: TComponent); override;
|
||||||
destructor destroy; override;
|
destructor destroy; override;
|
||||||
|
@ -178,10 +185,13 @@ begin
|
||||||
finally
|
finally
|
||||||
free;
|
free;
|
||||||
end;
|
end;
|
||||||
|
//
|
||||||
|
EntitiesConnector.addObserver(self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TCEMiniExplorerWidget.destroy;
|
destructor TCEMiniExplorerWidget.destroy;
|
||||||
begin
|
begin
|
||||||
|
EntitiesConnector.removeObserver(self);
|
||||||
with TCEMiniExplorerOptions.create(nil) do
|
with TCEMiniExplorerOptions.create(nil) do
|
||||||
try
|
try
|
||||||
assign(self);
|
assign(self);
|
||||||
|
@ -201,6 +211,32 @@ begin
|
||||||
end;
|
end;
|
||||||
{$ENDREGION}
|
{$ENDREGION}
|
||||||
|
|
||||||
|
{$REGION ICEProjectObserver ----------------------------------------------------}
|
||||||
|
procedure TCEMiniExplorerWidget.projNew(aProject: ICECommonProject);
|
||||||
|
begin
|
||||||
|
fProj := aProject;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEMiniExplorerWidget.projChanged(aProject: ICECommonProject);
|
||||||
|
begin
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEMiniExplorerWidget.projClosing(aProject: ICECommonProject);
|
||||||
|
begin
|
||||||
|
if fProj = aProject then
|
||||||
|
fProj := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEMiniExplorerWidget.projFocused(aProject: ICECommonProject);
|
||||||
|
begin
|
||||||
|
fProj := aProject;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEMiniExplorerWidget.projCompiling(aProject: ICECommonProject);
|
||||||
|
begin
|
||||||
|
end;
|
||||||
|
{$ENDREGION}
|
||||||
|
|
||||||
{$REGION Favorites -------------------------------------------------------------}
|
{$REGION Favorites -------------------------------------------------------------}
|
||||||
procedure TCEMiniExplorerWidget.favStringsChange(sender: TObject);
|
procedure TCEMiniExplorerWidget.favStringsChange(sender: TObject);
|
||||||
begin
|
begin
|
||||||
|
@ -304,7 +340,6 @@ end;
|
||||||
procedure TCEMiniExplorerWidget.btnEditClick(Sender: TObject);
|
procedure TCEMiniExplorerWidget.btnEditClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
fname: string;
|
fname: string;
|
||||||
proj: ICECommonProject = nil;
|
|
||||||
begin
|
begin
|
||||||
if lstFiles.Selected = nil then exit;
|
if lstFiles.Selected = nil then exit;
|
||||||
if lstFiles.Selected.Data = nil then exit;
|
if lstFiles.Selected.Data = nil then exit;
|
||||||
|
@ -314,11 +349,17 @@ begin
|
||||||
fname := fname[2..length(fname)];
|
fname := fname[2..length(fname)];
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
if isValidNativeProject(fname) then
|
if isValidNativeProject(fname) then
|
||||||
proj := TCENativeProject.create(nil) as ICECommonProject
|
begin
|
||||||
|
if assigned(fProj) then fProj.getProject.Free;
|
||||||
|
TCENativeProject.create(nil);
|
||||||
|
end
|
||||||
else if isValidDubProject(fname) then
|
else if isValidDubProject(fname) then
|
||||||
proj := TCEDubProject.create(nil) as ICECommonProject;
|
begin
|
||||||
if assigned(proj) then
|
if assigned(fProj) then fProj.getProject.Free;
|
||||||
proj.loadFromFile(fname)
|
TCEDubProject.create(nil);
|
||||||
|
end;
|
||||||
|
if assigned(fProj) then
|
||||||
|
fProj.loadFromFile(fname)
|
||||||
else
|
else
|
||||||
getMultiDocHandler.openDocument(fname);
|
getMultiDocHandler.openDocument(fname);
|
||||||
end;
|
end;
|
||||||
|
|
Loading…
Reference in New Issue