IDE: designer: menu templates: simplified cfgpath

git-svn-id: trunk@53227 -
This commit is contained in:
mattias 2016-10-26 16:45:22 +00:00
parent 557e4c9757
commit 4bb3ff1725

View File

@ -143,6 +143,7 @@ function SavedTemplatesExist: boolean;
function GetSavedTemplatesCount: integer; function GetSavedTemplatesCount: integer;
function InsertMenuTemplateDlg: TMenuItem; function InsertMenuTemplateDlg: TMenuItem;
function DeleteMenuTemplateDlg: boolean; function DeleteMenuTemplateDlg: boolean;
function GetCfgPath: string;
const const
MenuBar_Height = 20; MenuBar_Height = 20;
@ -193,7 +194,7 @@ var
XMLConfig: TXMLConfig; XMLConfig: TXMLConfig;
cfgPath, s, templateCfgName: string; cfgPath, s, templateCfgName: string;
begin begin
cfgPath:=SetDirSeparators(ExtractFilePath(ChompPathDelim(SysToUTF8(GetAppConfigDir(False)))) + 'lazarus'); cfgPath:=GetCfgPath;
templateCfgName:=cfgPath + DirectorySeparator + MenuTemplatesFilename; templateCfgName:=cfgPath + DirectorySeparator + MenuTemplatesFilename;
if not FileExistsUTF8(templateCfgName) then if not FileExistsUTF8(templateCfgName) then
Exit(False); Exit(False);
@ -263,6 +264,11 @@ begin
end; end;
end; end;
function GetCfgPath: string;
begin
Result:=ExtractFilePath(ChompPathDelim(GetAppConfigDirUTF8(False)))+'lazarus';
end;
{ TMenuTemplate } { TMenuTemplate }
@ -423,7 +429,7 @@ var
i, j: integer; i, j: integer;
cfgPath, s, sc, sText, tmp: string; cfgPath, s, sc, sText, tmp: string;
begin begin
cfgPath:=SetDirSeparators(ExtractFilePath(ChompPathDelim(SysToUTF8(GetAppConfigDir(False)))) + 'lazarus'); cfgPath:=GetCfgPath;
XMLConfig:=TXMLConfig.Create(cfgPath + DirectorySeparator + MenuTemplatesFilename); XMLConfig:=TXMLConfig.Create(cfgPath + DirectorySeparator + MenuTemplatesFilename);
try try
i:=1; i:=1;
@ -504,7 +510,7 @@ var
i, j: integer; i, j: integer;
cfgPath, s: string; cfgPath, s: string;
begin begin
cfgPath:=SetDirSeparators(ExtractFilePath(ChompPathDelim(SysToUTF8(GetAppConfigDir(False)))) + 'lazarus'); cfgPath:=GetCfgPath;
XMLConfig:=TXMLConfig.Create(cfgPath + DirectorySeparator + MenuTemplatesFilename); XMLConfig:=TXMLConfig.Create(cfgPath + DirectorySeparator + MenuTemplatesFilename);
try try
i:=1; i:=1;
@ -879,7 +885,7 @@ var
cfgPath, s, desc, currDesc: string; cfgPath, s, desc, currDesc: string;
begin begin
desc:=TMenuTemplate(FTVTemplates.Selected.Data).Description; desc:=TMenuTemplate(FTVTemplates.Selected.Data).Description;
cfgPath:=SetDirSeparators(ExtractFilePath(ChompPathDelim(SysToUTF8(GetAppConfigDir(False)))) + 'lazarus'); cfgPath:=GetCfgPath;
XMLConfig:=TXMLConfig.Create(cfgPath + DirectorySeparator + MenuTemplatesFilename); XMLConfig:=TXMLConfig.Create(cfgPath + DirectorySeparator + MenuTemplatesFilename);
try try
i:=0; i:=0;