common project interface - part 2

This commit is contained in:
Basile Burg 2015-06-21 03:55:48 +02:00
parent 9139d8eef7
commit 3a28c54c26
12 changed files with 88 additions and 97 deletions

View File

@ -143,7 +143,6 @@
<Unit1>
<Filename Value="..\src\ce_common.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ce_common"/>
</Unit1>
<Unit2>
<Filename Value="..\src\ce_d2syn.pas"/>
@ -176,7 +175,6 @@
<ComponentName Value="CEEditorWidget"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="ce_editor"/>
</Unit8>
<Unit9>
<Filename Value="..\src\ce_editoroptions.pas"/>
@ -194,7 +192,6 @@
<Unit12>
<Filename Value="..\src\ce_libman.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ce_libman"/>
</Unit12>
<Unit13>
<Filename Value="..\src\ce_libmaneditor.pas"/>
@ -249,7 +246,6 @@
<ComponentName Value="CEProcInputWidget"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="ce_procinput"/>
</Unit20>
<Unit21>
<Filename Value="..\src\ce_projconf.pas"/>
@ -260,9 +256,9 @@
<UnitName Value="ce_projconf"/>
</Unit21>
<Unit22>
<Filename Value="..\src\ce_project.pas"/>
<Filename Value="..\src\ce_nativeproject.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ce_project"/>
<UnitName Value="ce_nativeproject"/>
</Unit22>
<Unit23>
<Filename Value="..\src\ce_projinspect.pas"/>
@ -296,7 +292,6 @@
<ComponentName Value="CESymbolListWidget"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="ce_symlist"/>
</Unit27>
<Unit28>
<Filename Value="..\src\ce_symstring.pas"/>
@ -306,7 +301,6 @@
<Unit29>
<Filename Value="..\src\ce_synmemo.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ce_synmemo"/>
</Unit29>
<Unit30>
<Filename Value="..\src\ce_todolist.pas"/>
@ -338,7 +332,6 @@
<Unit35>
<Filename Value="..\src\ce_sharedres.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ce_sharedres"/>
</Unit35>
<Unit36>
<Filename Value="..\src\ce_widget.pas"/>

View File

@ -9,7 +9,7 @@ uses
{$IFDEF WINDOWS}
windows,
{$ENDIF}
ce_common, ce_writableComponent, ce_interfaces, ce_observer, ce_synmemo, ce_project;
ce_common, ce_writableComponent, ce_interfaces, ce_observer, ce_synmemo, ce_nativeproject;
type
(**
@ -114,9 +114,9 @@ end;
{$REGION ICEProjectObserver ----------------------------------------------------}
procedure TCEDcdWrapper.projNew(aProject: ICECommonProject);
begin
case aProject.getKind of
pkNative: fProj := TCENativeProject(aProject.getProject);
pkDub:fProj := nil;
case aProject.getFormat of
pfNative: fProj := TCENativeProject(aProject.getProject);
pfDub:fProj := nil;
end;
end;
@ -160,9 +160,9 @@ end;
procedure TCEDcdWrapper.projFocused(aProject: ICECommonProject);
begin
case aProject.getKind of
pkNative: fProj := TCENativeProject(aProject.getProject);
pkDub:fProj := nil;
case aProject.getFormat of
pfNative: fProj := TCENativeProject(aProject.getProject);
pfDub:fProj := nil;
end;
end;

View File

@ -11,15 +11,16 @@ uses
type
// describes the project kind. Used as a hint to cast ICECommonProject.getProject()
TCEProjectKind = (pkNative, pkDub);
TCEProjectFormat = (pfNative, pfDub);
(**
* Common project interface
*)
ICECommonProject = interface
['ICECommonProject']
function getKind: TCEProjectKind;
// returns an untyped object that can be casted using getSpecialization()
// indicates the project format
function getFormat: TCEProjectFormat;
// returns an untyped object that can be casted using getFormat()
function getProject: TObject;
//// project file
@ -38,11 +39,6 @@ type
//function configurationCount: integer;
//function configuration(index: integer): string;
//function outputFilename: string;
//
//// common actions
//function compile: boolean;
end;
(**

View File

@ -6,7 +6,7 @@ interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
Menus, ComCtrls, Buttons, ce_widget, ce_interfaces, ce_project, ce_dmdwrap,
Menus, ComCtrls, Buttons, ce_widget, ce_interfaces, ce_nativeproject, ce_dmdwrap,
ce_common;
type
@ -96,36 +96,40 @@ procedure TCELibManEditorWidget.updateRegistrable;
begin
btnReg.Enabled := (fProj <> nil) and
(fProj.currentConfiguration.outputOptions.binaryKind = staticlib) and
(FileExists(fProj.Filename))
(FileExists(fProj.Filename))
end;
procedure TCELibManEditorWidget.projNew(aProject: ICECommonProject);
begin
if aProject.getKind <> pkNative then
exit;
fProj := TCENativeProject(aProject.getProject);
case aProject.getFormat of
pfNative: fProj := TCENativeProject(aProject.getProject);
pfDub:fProj := nil;
end;
end;
procedure TCELibManEditorWidget.projChanged(aProject: ICECommonProject);
begin
if fProj = nil then exit;
if fProj <> aProject.getProject then exit;
if fProj <> aProject.getProject then
exit;
//
updateRegistrable;
end;
procedure TCELibManEditorWidget.projClosing(aProject: ICECommonProject);
begin
if fProj <> aProject.getProject then exit;
if fProj <> aProject.getProject then
exit;
fProj := nil;
updateRegistrable;
end;
procedure TCELibManEditorWidget.projFocused(aProject: ICECommonProject);
begin
if aProject.getKind <> pkNative then
exit;
fProj := TCENativeProject(aProject.getProject);
case aProject.getFormat of
pfNative: fProj := TCENativeProject(aProject.getProject);
pfDub:fProj := nil;
end;
updateRegistrable;
end;
@ -133,7 +137,6 @@ procedure TCELibManEditorWidget.projCompiling(aProject: ICECommonProject);
begin
end;
procedure TCELibManEditorWidget.ListEdited(Sender: TObject; Item: TListItem; var AValue: string);
begin
gridToData;

View File

@ -8,7 +8,7 @@ uses
Classes, SysUtils, FileUtil, SynEditKeyCmds, SynHighlighterLFM, Forms, StdCtrls,
AnchorDocking, AnchorDockStorage, AnchorDockOptionsDlg, Controls, Graphics, strutils,
Dialogs, Menus, ActnList, ExtCtrls, process, XMLPropStorage, SynExportHTML,
ce_common, ce_dmdwrap, ce_project, ce_dcd, ce_synmemo, ce_writableComponent,
ce_common, ce_dmdwrap, ce_nativeproject, ce_dcd, ce_synmemo, ce_writableComponent,
ce_widget, ce_messages, ce_interfaces, ce_editor, ce_projinspect, ce_projconf,
ce_search, ce_miniexplorer, ce_libman, ce_libmaneditor, ce_todolist, ce_observer,
ce_toolseditor, ce_procinput, ce_optionseditor, ce_symlist, ce_mru;

View File

@ -7,7 +7,7 @@ interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, ComCtrls,
lcltype, ce_widget, ActnList, Menus, clipbrd, AnchorDocking, TreeFilterEdit,
Buttons, math,ce_writableComponent, ce_common, ce_project, ce_synmemo, GraphType,
Buttons, math,ce_writableComponent, ce_common, ce_nativeproject, ce_synmemo, GraphType,
ce_dlangutils, ce_interfaces, ce_observer;
type
@ -586,9 +586,9 @@ end;
{$REGION ICEProjectObserver ----------------------------------------------------}
procedure TCEMessagesWidget.projNew(aProject: ICECommonProject);
begin
case aProject.getKind of
pkNative: fProj := TCENativeProject(aProject.getProject);
pkDub:fProj := nil;
case aProject.getFormat of
pfNative: fProj := TCENativeProject(aProject.getProject);
pfDub:fProj := nil;
end;
filterMessages(fCtxt);
end;
@ -606,9 +606,9 @@ end;
procedure TCEMessagesWidget.projFocused(aProject: ICECommonProject);
begin
if fProj = aProject.getProject then exit;
case aProject.getKind of
pkNative: fProj := TCENativeProject(aProject.getProject);
pkDub:fProj := nil;
case aProject.getFormat of
pfNative: fProj := TCENativeProject(aProject.getProject);
pfDub:fProj := nil;
end;
filterMessages(fCtxt);
end;

View File

@ -6,7 +6,7 @@ interface
uses
Classes, SysUtils, ce_interfaces, ce_observer,
ce_project, ce_synmemo;
ce_nativeproject, ce_synmemo;
type
@ -212,7 +212,7 @@ procedure TCEMRUProjectList.projClosing(aProject: ICECommonProject);
var
natProj: TCENativeProject;
begin
if aProject.getProject is TCENativeProject then
if aProject.getFormat = pfNative then
begin
natProj := TCENativeProject(aProject.getProject);
if FileExists(natProj.fileName) then

View File

@ -1,4 +1,4 @@
unit ce_project;
unit ce_nativeproject;
{$I ce_defines.inc}
@ -32,7 +32,7 @@ type
fSrcs, fSrcsCop: TStringList;
fConfIx: Integer;
fUpdateCount: NativeInt;
fProjectSubject: TCECustomSubject;
fProjectSubject: TCEProjectSubject;
fRunner: TCheckedAsyncProcess;
fOutputFilename: string;
fCanBeRun: boolean;
@ -52,7 +52,7 @@ type
// passes compilation message as "to be guessed"
procedure compProcOutput(proc: TProcess);
//
function getKind: TCEProjectKind;
function getFormat: TCEProjectFormat;
function getProject: TObject;
protected
procedure beforeLoad; override;
@ -110,8 +110,8 @@ begin
//
reset;
addDefaults;
subjProjNew(TCEProjectSubject(fProjectSubject), self);
subjProjChanged(TCEProjectSubject(fProjectSubject), self);
subjProjNew(fProjectSubject, self);
subjProjChanged(fProjectSubject, self);
//
{$IFDEF LINUX}
fBasePath := '/';
@ -122,7 +122,7 @@ end;
destructor TCENativeProject.destroy;
begin
subjProjClosing(TCEProjectSubject(fProjectSubject), self);
subjProjClosing(fProjectSubject, self);
fProjectSubject.Free;
//
fOnChange := nil;
@ -134,9 +134,9 @@ begin
inherited;
end;
function TCENativeProject.getKind: TCEProjectKind;
function TCENativeProject.getFormat: TCEProjectFormat;
begin
exit(pkNative);
exit(pfNative);
end;
function TCENativeProject.getProject: TObject;
@ -265,7 +265,7 @@ var
begin
fModified := true;
updateOutFilename;
subjProjChanged(TCEProjectSubject(fProjectSubject), self);
subjProjChanged(fProjectSubject, self);
if assigned(fOnChange) then fOnChange(Self);
{$IFDEF DEBUG}
lst := TStringList.Create;
@ -640,7 +640,7 @@ begin
end;
//
msgs.clearByData(Self);
subjProjCompiling(TCEProjectSubject(fProjectSubject), Self);
subjProjCompiling(fProjectSubject, Self);
//
if not runPrePostProcess(config.preBuildProcess) then
msgs.message('project warning: the pre-compilation process has not been properly executed',

View File

@ -7,7 +7,7 @@ interface
uses
Classes, SysUtils, FileUtil, RTTIGrids, RTTICtrls, Forms, Controls, Graphics,
Dialogs, ExtCtrls, ComCtrls, StdCtrls, Menus, Buttons, rttiutils, typinfo,
PropEdits, ObjectInspector, ce_dmdwrap, ce_project, ce_widget, ce_interfaces,
PropEdits, ObjectInspector, ce_dmdwrap, ce_nativeproject, ce_widget, ce_interfaces,
ce_observer;
type
@ -103,20 +103,19 @@ begin
inherited;
if Visible then updateImperative;
end;
{$ENDREGION --------------------------------------------------------------------}
{$REGION ICEProjectObserver ----------------------------------------------------}
procedure TCEProjectConfigurationWidget.projNew(aProject: ICECommonProject);
begin
beginImperativeUpdate;
case aProject.getKind of
pkNative: fProj := TCENativeProject(aProject.getProject);
pkDub:fProj := nil;
end;
fProj := nil;
if aProject.getFormat <> pfNative then
exit;
//
fProj := TCENativeProject(aProject.getProject);
if Visible then updateImperative;
syncroMode := false;
pnlToolBar.Enabled:=true;
pnlToolBar.Enabled :=true;
end;
procedure TCEProjectConfigurationWidget.projClosing(aProject: ICECommonProject);
@ -125,7 +124,7 @@ begin
exit;
inspector.TIObject := nil;
inspector.ItemIndex := -1;
self.selConf.Clear;
selConf.Clear;
syncroMode := false;
pnlToolBar.Enabled:=false;
fProj := nil;
@ -133,20 +132,18 @@ end;
procedure TCEProjectConfigurationWidget.projChanged(aProject: ICECommonProject);
begin
if fProj <> aProject.getProject then exit;
case aProject.getKind of
pkNative: fProj := TCENativeProject(aProject.getProject);
pkDub:fProj := nil;
end;
if fProj <> aProject.getProject then
exit;
if Visible then updateImperative;
end;
procedure TCEProjectConfigurationWidget.projFocused(aProject: ICECommonProject);
begin
case aProject.getKind of
pkNative: fProj := TCENativeProject(aProject.getProject);
pkDub: fProj := nil;
end;
fProj := nil;
if aProject.getFormat <> pfNative then
exit;
//
fProj := TCENativeProject(aProject.getProject);
pnlToolBar.Enabled:=true;
if Visible then updateImperative;
end;

View File

@ -6,7 +6,7 @@ interface
uses
Classes, SysUtils, FileUtil, TreeFilterEdit, Forms, Controls, Graphics, actnlist,
Dialogs, ExtCtrls, ComCtrls, Menus, Buttons, lcltype, ce_project, ce_interfaces,
Dialogs, ExtCtrls, ComCtrls, Menus, Buttons, lcltype, ce_nativeproject, ce_interfaces,
ce_common, ce_widget, ce_observer;
type
@ -148,11 +148,12 @@ end;
{$REGION ICEProjectMonitor -----------------------------------------------------}
procedure TCEProjectInspectWidget.projNew(aProject: ICECommonProject);
begin
case aProject.getKind of
pkNative: fProject := TCENativeProject(aProject.getProject);
pkDub:fProject := nil;
end;
fProject := nil;
fLastFileOrFolder := '';
if aProject.getFormat <> pfNative then
exit;
//
fProject := TCENativeProject(aProject.getProject);
if Visible then updateImperative;
end;
@ -167,16 +168,19 @@ end;
procedure TCEProjectInspectWidget.projFocused(aProject: ICECommonProject);
begin
case aProject.getKind of
pkNative: fProject := TCENativeProject(aProject.getProject);
pkDub:fProject := nil;
end;
fProject := nil;
fLastFileOrFolder := '';
if aProject.getFormat <> pfNative then
exit;
//
fProject := TCENativeProject(aProject.getProject);
if Visible then beginDelayedUpdate;
end;
procedure TCEProjectInspectWidget.projChanged(aProject: ICECommonProject);
begin
if fProject <> aProject.getProject then exit;
if fProject <> aProject.getProject then
exit;
if Visible then beginDelayedUpdate;
end;

View File

@ -5,7 +5,7 @@ unit ce_symstring;
interface
uses
ce_observer, ce_interfaces, ce_project, ce_synmemo, ce_common;
ce_observer, ce_interfaces, ce_nativeproject, ce_synmemo, ce_common;
type
@ -64,15 +64,14 @@ begin
EntitiesConnector.removeObserver(self);
inherited;
end;
{$ENDREGION}
{$REGION ICEProjectObserver ----------------------------------------------------}
procedure TCESymbolExpander.projNew(aProject: ICECommonProject);
begin
case aProject.getKind of
pkNative: fProj := TCENativeProject(aProject.getProject);
pkDub:fProj := nil;
case aProject.getFormat of
pfNative: fProj := TCENativeProject(aProject.getProject);
pfDub: fProj := nil;
end;
fNeedUpdate := true;
end;
@ -87,9 +86,9 @@ end;
procedure TCESymbolExpander.projFocused(aProject: ICECommonProject);
begin
case aProject.getKind of
pkNative: fProj := TCENativeProject(aProject.getProject);
pkDub:fProj := nil;
case aProject.getFormat of
pfNative: fProj := TCENativeProject(aProject.getProject);
pfDub: fProj := nil;
end;
fNeedUpdate := true;
end;
@ -104,7 +103,6 @@ end;
procedure TCESymbolExpander.projCompiling(aProject: ICECommonProject);
begin
end;
{$ENDREGION}
{$REGION ICEMultiDocObserver ---------------------------------------------------}

View File

@ -8,7 +8,7 @@ uses
Classes, SysUtils, FileUtil, ListFilterEdit, Forms, Controls,
strutils, Graphics, Dialogs, ExtCtrls, Menus, Buttons, ComCtrls,
ce_widget, process, ce_common, ce_interfaces, ce_synmemo,
ce_project, ce_symstring, ce_writableComponent, ce_observer;
ce_nativeproject, ce_symstring, ce_writableComponent, ce_observer;
type
@ -340,7 +340,8 @@ end;
{$REGION ICEProjectObserver ----------------------------------------------------}
procedure TCETodoListWidget.projNew(aProject: ICECommonProject);
begin
if aProject.getKind <> pkNative then
fProj := nil;
if aProject.getFormat <> pfNative then
exit;
fProj := TCENativeProject(aProject.getProject);
end;
@ -366,10 +367,10 @@ procedure TCETodoListWidget.projFocused(aProject: ICECommonProject);
begin
if aProject.getProject = fProj then
exit;
if aProject.getKind <> pkNative then
fProj := nil;
if aProject.getFormat <> pfNative then
exit;
fProj := TCENativeProject(aProject.getProject);
if Visible and fAutoRefresh then
callToolProcess;
end;
@ -377,7 +378,6 @@ end;
procedure TCETodoListWidget.projCompiling(aProject: ICECommonProject);
begin
end;
{$ENDREGION}
{$REGION Todo list things ------------------------------------------------------}