dcd integration, also works with dub projects

curr proj source + imports
This commit is contained in:
Basile Burg 2015-09-18 05:34:19 +02:00
parent 911a183c0b
commit f82e39bd71
1 changed files with 9 additions and 15 deletions

View File

@ -9,7 +9,7 @@ uses
{$IFDEF WINDOWS} {$IFDEF WINDOWS}
windows, windows,
{$ENDIF} {$ENDIF}
ce_common, ce_writableComponent, ce_interfaces, ce_observer, ce_synmemo, ce_nativeproject; ce_common, ce_writableComponent, ce_interfaces, ce_observer, ce_synmemo;
type type
(** (**
@ -30,7 +30,7 @@ type
fAvailable: boolean; fAvailable: boolean;
fServerListening: boolean; fServerListening: boolean;
fDoc: TCESynMemo; fDoc: TCESynMemo;
fProj: TCENativeProject; fProj: ICECommonProject;
procedure killServer; procedure killServer;
procedure terminateClient; inline; procedure terminateClient; inline;
procedure waitClient; inline; procedure waitClient; inline;
@ -125,10 +125,7 @@ end;
{$REGION ICEProjectObserver ----------------------------------------------------} {$REGION ICEProjectObserver ----------------------------------------------------}
procedure TCEDcdWrapper.projNew(aProject: ICECommonProject); procedure TCEDcdWrapper.projNew(aProject: ICECommonProject);
begin begin
case aProject.getFormat of fProj := aProject;
pfNative: fProj := TCENativeProject(aProject.getProject);
pfDub:fProj := nil;
end;
end; end;
procedure TCEDcdWrapper.projChanged(aProject: ICECommonProject); procedure TCEDcdWrapper.projChanged(aProject: ICECommonProject);
@ -137,22 +134,22 @@ var
fold: string; fold: string;
folds: TStringList; folds: TStringList;
begin begin
if fProj <> aProject.getProject then if fProj <> aProject then
exit; exit;
if fProj = nil then if fProj = nil then
exit; exit;
// //
folds := TStringList.Create; folds := TStringList.Create;
try try
for i:= 0 to fProj.Sources.Count-1 do for i:= 0 to fProj.sourcesCount-1 do
begin begin
fold := extractFilePath(fProj.sourceAbsolute(i)); fold := extractFilePath(fProj.sourceAbsolute(i));
if folds.IndexOf(fold) = -1 then if folds.IndexOf(fold) = -1 then
folds.Add(fold); folds.Add(fold);
end; end;
for i := 0 to fProj.currentConfiguration.pathsOptions.importModulePaths.Count-1 do for i := 0 to fProj.importsPathCount-1 do
begin begin
fold := fProj.currentConfiguration.pathsOptions.importModulePaths.Strings[i]; fold := fProj.importPath(i);
if DirectoryExists(fold) and (folds.IndexOf(fold) = -1) then if DirectoryExists(fold) and (folds.IndexOf(fold) = -1) then
folds.Add(fold); folds.Add(fold);
end; end;
@ -164,17 +161,14 @@ end;
procedure TCEDcdWrapper.projClosing(aProject: ICECommonProject); procedure TCEDcdWrapper.projClosing(aProject: ICECommonProject);
begin begin
if fProj <> aProject.getProject then if fProj <> aProject then
exit; exit;
fProj := nil; fProj := nil;
end; end;
procedure TCEDcdWrapper.projFocused(aProject: ICECommonProject); procedure TCEDcdWrapper.projFocused(aProject: ICECommonProject);
begin begin
case aProject.getFormat of fProj := aProject;
pfNative: fProj := TCENativeProject(aProject.getProject);
pfDub:fProj := nil;
end;
end; end;
procedure TCEDcdWrapper.projCompiling(aProject: ICECommonProject); procedure TCEDcdWrapper.projCompiling(aProject: ICECommonProject);