mirror of https://gitlab.com/basile.b/dexed.git
projects group, attach the FSP to the new group when it contains the the FSP
This commit is contained in:
parent
c46e7fa7ad
commit
18dbf04d22
|
@ -14,9 +14,6 @@ type
|
||||||
|
|
||||||
TProjectGroup = class;
|
TProjectGroup = class;
|
||||||
|
|
||||||
//TODO-projectgroups: bug, load a free standing project, load a group that contains a link to the FSP.
|
|
||||||
//=> the FSP should be either closed or the lazy loader should trap the FSP
|
|
||||||
|
|
||||||
(**
|
(**
|
||||||
* Represents a project in a project group
|
* Represents a project in a project group
|
||||||
*)
|
*)
|
||||||
|
@ -37,19 +34,26 @@ type
|
||||||
(**
|
(**
|
||||||
* Collection that handles several project at once.
|
* Collection that handles several project at once.
|
||||||
*)
|
*)
|
||||||
TProjectGroup = class(TWritableLfmTextComponent, ICEProjectGroup, IFPObserver)
|
TProjectGroup = class(TWritableLfmTextComponent, ICEProjectGroup, IFPObserver, ICEProjectObserver)
|
||||||
private
|
private
|
||||||
fProjectIndex: integer;
|
fProjectIndex: integer;
|
||||||
fItems: TCollection;
|
fItems: TCollection;
|
||||||
fModified: boolean;
|
fModified: boolean;
|
||||||
fOnChanged: TNotifyEvent;
|
fOnChanged: TNotifyEvent;
|
||||||
fBasePath: string;
|
fBasePath: string;
|
||||||
|
fFreeStanding: ICECommonProject;
|
||||||
procedure setItems(value: TCollection);
|
procedure setItems(value: TCollection);
|
||||||
function getItem(index: integer): TProjectGroupItem;
|
function getItem(index: integer): TProjectGroupItem;
|
||||||
procedure doChanged;
|
procedure doChanged;
|
||||||
//
|
//
|
||||||
procedure FPOObservedChanged(ASender : TObject; Operation :
|
procedure FPOObservedChanged(ASender : TObject; Operation :
|
||||||
TFPObservedOperation; Data : Pointer);
|
TFPObservedOperation; Data : Pointer);
|
||||||
|
procedure projNew(aProject: ICECommonProject);
|
||||||
|
procedure projChanged(aProject: ICECommonProject);
|
||||||
|
procedure projClosing(aProject: ICECommonProject);
|
||||||
|
procedure projFocused(aProject: ICECommonProject);
|
||||||
|
procedure projCompiling(aProject: ICECommonProject);
|
||||||
|
procedure projCompiled(aProject: ICECommonProject; success: boolean);
|
||||||
protected
|
protected
|
||||||
procedure afterLoad; override;
|
procedure afterLoad; override;
|
||||||
procedure afterSave; override;
|
procedure afterSave; override;
|
||||||
|
@ -137,10 +141,12 @@ begin
|
||||||
fItems := TCollection.Create(TProjectGroupItem);
|
fItems := TCollection.Create(TProjectGroupItem);
|
||||||
fItems.FPOAttachObserver(self);
|
fItems.FPOAttachObserver(self);
|
||||||
EntitiesConnector.addSingleService(self);
|
EntitiesConnector.addSingleService(self);
|
||||||
|
EntitiesConnector.addObserver(self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TProjectGroup.destroy;
|
destructor TProjectGroup.destroy;
|
||||||
begin
|
begin
|
||||||
|
EntitiesConnector.removeObserver(self);
|
||||||
fItems.Clear;
|
fItems.Clear;
|
||||||
fItems.Free;
|
fItems.Free;
|
||||||
inherited;
|
inherited;
|
||||||
|
@ -163,6 +169,36 @@ begin
|
||||||
fModified := true;
|
fModified := true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TProjectGroup.projNew(aProject: ICECommonProject);
|
||||||
|
begin
|
||||||
|
if (aProject <> nil) and not aProject.inGroup then
|
||||||
|
fFreeStanding := aProject;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TProjectGroup.projChanged(aProject: ICECommonProject);
|
||||||
|
begin
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TProjectGroup.projClosing(aProject: ICECommonProject);
|
||||||
|
begin
|
||||||
|
if (aProject <> nil) and (aProject = fFreeStanding) then
|
||||||
|
fFreeStanding := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TProjectGroup.projFocused(aProject: ICECommonProject);
|
||||||
|
begin
|
||||||
|
if (aProject <> nil) and not aProject.inGroup then
|
||||||
|
fFreeStanding := aProject;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TProjectGroup.projCompiling(aProject: ICECommonProject);
|
||||||
|
begin
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TProjectGroup.projCompiled(aProject: ICECommonProject; success: boolean);
|
||||||
|
begin
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TProjectGroup.doChanged;
|
procedure TProjectGroup.doChanged;
|
||||||
begin
|
begin
|
||||||
if assigned(fOnChanged) then
|
if assigned(fOnChanged) then
|
||||||
|
@ -231,6 +267,13 @@ begin
|
||||||
begin
|
begin
|
||||||
p := item[i];
|
p := item[i];
|
||||||
p.fGroup := self;
|
p.fGroup := self;
|
||||||
|
if assigned(fFreeStanding) and (p.absoluteFilename = fFreeStanding.filename) then
|
||||||
|
begin
|
||||||
|
p.fProj := fFreeStanding;
|
||||||
|
fFreeStanding.inGroup(true);
|
||||||
|
fFreeStanding := nil;
|
||||||
|
p.fProj.activate;
|
||||||
|
end;
|
||||||
if not p.absoluteFilename.fileExists then
|
if not p.absoluteFilename.fileExists then
|
||||||
begin
|
begin
|
||||||
f += LineEnding + '"' + p.absoluteFilename + '"';
|
f += LineEnding + '"' + p.absoluteFilename + '"';
|
||||||
|
|
Loading…
Reference in New Issue