main, observe ICECOmmonProject so that other widget can create a project

This commit is contained in:
Basile Burg 2015-10-25 18:49:55 +01:00
parent 9b2ea82c3c
commit b576f85cfe
1 changed files with 45 additions and 1 deletions

View File

@ -19,7 +19,7 @@ type
TCEApplicationOptions = class;
{ TCEMainForm }
TCEMainForm = class(TForm, ICEMultiDocObserver, ICEEditableShortCut)
TCEMainForm = class(TForm, ICEMultiDocObserver, ICEEditableShortCut, ICEProjectObserver)
actFileCompAndRun: TAction;
actFileSaveAll: TAction;
actFileClose: TAction;
@ -237,6 +237,13 @@ type
procedure docFocused(aDoc: TCESynMemo);
procedure docChanged(aDoc: TCESynMemo);
// ICEProjectObserver
procedure projNew(aProject: ICECommonProject);
procedure projChanged(aProject: ICECommonProject);
procedure projClosing(aProject: ICECommonProject);
procedure projFocused(aProject: ICECommonProject);
procedure projCompiling(aProject: ICECommonProject);
// ICEEditableShortcut
function scedWantFirst: boolean;
function scedWantNext(out category, identifier: string; out aShortcut: TShortcut): boolean;
@ -1214,6 +1221,43 @@ begin
end;
{$ENDREGION}
{$REGION ICEProjectObserver ----------------------------------------------------}
procedure TCEMainForm.projNew(aProject: ICECommonProject);
begin
fProjectInterface := aProject;
case fProjectInterface.getFormat of
pfNative: fNativeProject := TCENativeProject(fProjectInterface.getProject);
pfDub: fDubProject := TCEDubProject(fProjectInterface.getProject);
end;
end;
procedure TCEMainForm.projChanged(aProject: ICECommonProject);
begin
end;
procedure TCEMainForm.projClosing(aProject: ICECommonProject);
begin
if fProjectInterface <> aProject then
exit;
fProjectInterface := nil;
fDubProject := nil;
fNativeProject := nil;
end;
procedure TCEMainForm.projFocused(aProject: ICECommonProject);
begin
fProjectInterface := aProject;
case fProjectInterface.getFormat of
pfNative: fNativeProject := TCENativeProject(fProjectInterface.getProject);
pfDub: fDubProject := TCEDubProject(fProjectInterface.getProject);
end;
end;
procedure TCEMainForm.projCompiling(aProject: ICECommonProject);
begin
end;
{$ENDREGION}
{$REGION ICEEditableShortCut ---------------------------------------------------}
function TCEMainForm.scedWantFirst: boolean;
begin