symbol list, CPP is working to make DUB messages clickable.
still TODO in ce_dubproject to expose fsources file names
This commit is contained in:
Basile Burg 2015-09-01 16:37:51 +02:00
parent d373a15012
commit d1c255d44b
1 changed files with 35 additions and 60 deletions

View File

@ -145,72 +145,57 @@ end;
{$REGION Symbol things ---------------------------------------------------------} {$REGION Symbol things ---------------------------------------------------------}
procedure TCESymbolExpander.updateSymbols; procedure TCESymbolExpander.updateSymbols;
var var
hasProj: boolean; hasNativeProj: boolean;
hasProjItf: boolean;
hasDoc: boolean; hasDoc: boolean;
fname: string; fname: string;
i: Integer; i: Integer;
e: TCESymbol;
str: TStringList; str: TStringList;
const const
na = '``'; na = '``';
begin begin
if not fNeedUpdate then exit; if not fNeedUpdate then exit;
fNeedUpdate := false; fNeedUpdate := false;
hasProj := fProj <> nil; //
hasNativeProj := fProj <> nil;
hasProjItf := fProjInterface <> nil;
hasDoc := fDoc <> nil; hasDoc := fDoc <> nil;
//
for e := low(TCESymbol) to high(TCESymbol) do
fSymbols[e] := na;
//
// application // application
fSymbols[CAF] := Application.ExeName; fSymbols[CAF] := Application.ExeName;
fSymbols[CAP] := ExtractFilePath(Application.ExeName); fSymbols[CAP] := ExtractFilePath(fSymbols[CAF]);
// document // document
if hasDoc then if hasDoc then
begin begin
if fileExists(fDoc.fileName) then if not fileExists(fDoc.fileName) then
begin fDoc.saveTempFile;
fSymbols[CFF] := fDoc.fileName; fSymbols[CFF] := fDoc.fileName;
fSymbols[CFP] := ExtractFilePath(fDoc.fileName); fSymbols[CFP] := ExtractFilePath(fDoc.fileName);
end
else
begin
fSymbols[CFF] := na;
fSymbols[CFP] := na;
end;
if fDoc.Identifier <> '' then if fDoc.Identifier <> '' then
fSymbols[CI] := fDoc.Identifier fSymbols[CI] := fDoc.Identifier;
else
fSymbols[CI] := na;
end
else
begin
fSymbols[CFF] := na;
fSymbols[CFP] := na;
fSymbols[CI] := na;
end; end;
// project // project interface
if hasProj then if hasProjItf then
begin
fSymbols[CPF] := fProjInterface.getFilename;
fSymbols[CPP] := ExtractFilePath(fSymbols[CPF]);
fSymbols[CPN] := stripFileExt(extractFileName(fSymbols[CPF]));
end;
// TODO-cDUB: move to upper block expansion of CPO, CPFS & CPCD when implemented in ICECOmmonProject
if hasNativeProj then
begin begin
if fileExists(fProj.fileName) then if fileExists(fProj.fileName) then
begin begin
fSymbols[CPF] := fProjInterface.getFilename;
fSymbols[CPP] := ExtractFilePath(fProjInterface.getFilename);
fSymbols[CPR] := fProj.getAbsoluteFilename(fProj.RootFolder); fSymbols[CPR] := fProj.getAbsoluteFilename(fProj.RootFolder);
fSymbols[CPN] := stripFileExt(extractFileName(fProj.fileName));
fSymbols[CPO] := fProj.getOutputFilename; fSymbols[CPO] := fProj.getOutputFilename;
if fSymbols[CPR] = '' then if fSymbols[CPR] = '' then
fSymbols[CPR] := fSymbols[CPP]; fSymbols[CPR] := fSymbols[CPP];
end
else
begin
fSymbols[CPF] := na;
fSymbols[CPP] := na;
fSymbols[CPR] := na;
fSymbols[CPN] := na;
fSymbols[CPO] := na;
end; end;
if fProj.Sources.Count = 0 then if fProj.Sources.Count <> 0 then
begin
fSymbols[CPFS] := na;
fSymbols[CPCD] := na;
end
else
begin begin
str := TStringList.Create; str := TStringList.Create;
try try
@ -230,16 +215,6 @@ begin
str.Free; str.Free;
end; end;
end; end;
end
else
begin
fSymbols[CPF] := na;
fSymbols[CPP] := na;
fSymbols[CPR] := na;
fSymbols[CPN] := na;
fSymbols[CPO] := na;
fSymbols[CPFS] := na;
fSymbols[CPCD] := na;
end; end;
end; end;
@ -292,16 +267,16 @@ begin
'CAF', 'CoeditApplicationFile': Result += fSymbols[CAF]; 'CAF', 'CoeditApplicationFile': Result += fSymbols[CAF];
'CAP', 'CoeditApplicationPath': Result += fSymbols[CAP]; 'CAP', 'CoeditApplicationPath': Result += fSymbols[CAP];
// //
'CFF', 'CurrentFileFile': Result += fSymbols[CFF]; 'CFF', 'CurrentFileFile' : Result += fSymbols[CFF];
'CFP', 'CurrentFilePath': Result += fSymbols[CFP]; 'CFP', 'CurrentFilePath' : Result += fSymbols[CFP];
'CI', 'CurrentIdentifier': Result += fSymbols[CI]; 'CI', 'CurrentIdentifier' : Result += fSymbols[CI];
// //
'CPF', 'CurrentProjectFile': Result += fSymbols[CPF]; 'CPF', 'CurrentProjectFile' : Result += fSymbols[CPF];
'CPFS', 'CurrentProjectFiles': Result += fSymbols[CPFS]; 'CPFS', 'CurrentProjectFiles' : Result += fSymbols[CPFS];
'CPN', 'CurrentProjectName': Result += fSymbols[CPN]; 'CPN', 'CurrentProjectName' : Result += fSymbols[CPN];
'CPO', 'CurrentProjectOutput': Result += fSymbols[CPO]; 'CPO', 'CurrentProjectOutput' : Result += fSymbols[CPO];
'CPP', 'CurrentProjectPath': Result += fSymbols[CPP]; 'CPP', 'CurrentProjectPath' : Result += fSymbols[CPP];
'CPR', 'CurrentProjectRoot': Result += fSymbols[CPR]; 'CPR', 'CurrentProjectRoot' : Result += fSymbols[CPR];
'CPCD','CurrentProjectCommonDirectory': Result += fSymbols[CPCD]; 'CPCD','CurrentProjectCommonDirectory': Result += fSymbols[CPCD];
end; end;
end; end;