mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 17:29:31 +02:00
IDE: started fallback define templates
git-svn-id: trunk@26281 -
This commit is contained in:
parent
2bd8a3a414
commit
4abd567ce9
@ -437,6 +437,7 @@ type
|
|||||||
procedure Add(ADefineTemplate: TDefineTemplate);
|
procedure Add(ADefineTemplate: TDefineTemplate);
|
||||||
procedure AddChild(ParentTemplate, NewDefineTemplate: TDefineTemplate);
|
procedure AddChild(ParentTemplate, NewDefineTemplate: TDefineTemplate);
|
||||||
procedure AddFirst(ADefineTemplate: TDefineTemplate);
|
procedure AddFirst(ADefineTemplate: TDefineTemplate);
|
||||||
|
procedure MoveToLast(ADefineTemplate: TDefineTemplate);
|
||||||
procedure Assign(SrcDefineTree: TDefineTree);
|
procedure Assign(SrcDefineTree: TDefineTree);
|
||||||
procedure AssignNonAutoCreated(SrcDefineTree: TDefineTree);
|
procedure AssignNonAutoCreated(SrcDefineTree: TDefineTree);
|
||||||
procedure Clear;
|
procedure Clear;
|
||||||
@ -3781,6 +3782,14 @@ begin
|
|||||||
ClearCache;
|
ClearCache;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TDefineTree.MoveToLast(ADefineTemplate: TDefineTemplate);
|
||||||
|
begin
|
||||||
|
if (ADefineTemplate.Next=nil) and (ADefineTemplate.Parent=nil) then exit;
|
||||||
|
ADefineTemplate.Unbind;
|
||||||
|
if FFirstDefineTemplate=ADefineTemplate then FFirstDefineTemplate:=nil;
|
||||||
|
Add(ADefineTemplate);
|
||||||
|
end;
|
||||||
|
|
||||||
function TDefineTree.FindDefineTemplateByName(
|
function TDefineTree.FindDefineTemplateByName(
|
||||||
const AName: string; OnlyRoots: boolean): TDefineTemplate;
|
const AName: string; OnlyRoots: boolean): TDefineTemplate;
|
||||||
begin
|
begin
|
||||||
|
@ -29,15 +29,18 @@
|
|||||||
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
||||||
</local>
|
</local>
|
||||||
</RunParams>
|
</RunParams>
|
||||||
<RequiredPackages Count="2">
|
<RequiredPackages Count="3">
|
||||||
<Item1>
|
<Item1>
|
||||||
|
<PackageName Value="CodeTools"/>
|
||||||
|
</Item1>
|
||||||
|
<Item2>
|
||||||
<PackageName Value="AnchorDocking"/>
|
<PackageName Value="AnchorDocking"/>
|
||||||
<MinVersion Valid="True"/>
|
<MinVersion Valid="True"/>
|
||||||
<DefaultFilename Value="../anchordocking.lpk"/>
|
<DefaultFilename Value="../anchordocking.lpk"/>
|
||||||
</Item1>
|
|
||||||
<Item2>
|
|
||||||
<PackageName Value="LCL"/>
|
|
||||||
</Item2>
|
</Item2>
|
||||||
|
<Item3>
|
||||||
|
<PackageName Value="LCL"/>
|
||||||
|
</Item3>
|
||||||
</RequiredPackages>
|
</RequiredPackages>
|
||||||
<Units Count="3">
|
<Units Count="3">
|
||||||
<Unit0>
|
<Unit0>
|
||||||
|
@ -7,7 +7,8 @@ interface
|
|||||||
uses
|
uses
|
||||||
Classes, SysUtils, LCLProc, FileUtil, Forms, Controls, Graphics, Dialogs,
|
Classes, SysUtils, LCLProc, FileUtil, Forms, Controls, Graphics, Dialogs,
|
||||||
Menus, ExtCtrls, Buttons, ComCtrls, SimpleFrm,
|
Menus, ExtCtrls, Buttons, ComCtrls, SimpleFrm,
|
||||||
AnchorDocking, AnchorDockStorage, XMLPropStorage, AnchorDockOptionsDlg;
|
AnchorDocking, AnchorDockStorage, XMLPropStorage, AnchorDockOptionsDlg,
|
||||||
|
DefineTemplates;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
|
@ -39,9 +39,23 @@ uses
|
|||||||
DefineTemplates, CompilerOptions, TransferMacros, LinkScanner,
|
DefineTemplates, CompilerOptions, TransferMacros, LinkScanner,
|
||||||
LazarusIDEStrConsts;
|
LazarusIDEStrConsts;
|
||||||
|
|
||||||
|
|
||||||
// global
|
// global
|
||||||
|
function FindRootTemplate(AName: string): TDefineTemplate;
|
||||||
procedure SetAdditionalGlobalSrcPathToCodeToolBoss(const SrcPath: string);
|
procedure SetAdditionalGlobalSrcPathToCodeToolBoss(const SrcPath: string);
|
||||||
|
|
||||||
|
// global defaults
|
||||||
|
function FindNotUsedDirectoryTemplate: TDefineTemplate;
|
||||||
|
function CreateNotUsedDirectoryTemplate: TDefineTemplate;
|
||||||
|
function FindFallBackTemplate: TDefineTemplate;
|
||||||
|
function CreateFallBackTemplate: TDefineTemplate;
|
||||||
|
|
||||||
|
// FPC sources
|
||||||
|
function CreateFPCSourceTemplate(const FPCSrcDir, UnitSearchPath, PPUExt,
|
||||||
|
DefaultTargetOS, DefaultProcessorName: string;
|
||||||
|
UnitLinkListValid: boolean; var UnitLinkList: string;
|
||||||
|
Owner: TObject): TDefineTemplate;
|
||||||
|
|
||||||
// projects
|
// projects
|
||||||
function FindProjectsTemplate: TDefineTemplate;
|
function FindProjectsTemplate: TDefineTemplate;
|
||||||
function FindProjectTemplateWithID(const ProjectID: string): TDefineTemplate;
|
function FindProjectTemplateWithID(const ProjectID: string): TDefineTemplate;
|
||||||
@ -65,6 +79,9 @@ function RemoveAutoGeneratedDefine(ParentTemplate: TDefineTemplate;
|
|||||||
|
|
||||||
|
|
||||||
const
|
const
|
||||||
|
NotUsedDirectoryFlagTemplName = 'DirectoryNotUsed';
|
||||||
|
FallBackTemplName = 'FallBack';
|
||||||
|
|
||||||
ProjectDefTemplName = 'Current Project';
|
ProjectDefTemplName = 'Current Project';
|
||||||
ProjectDirDefTemplName = 'Current Project Directory';
|
ProjectDirDefTemplName = 'Current Project Directory';
|
||||||
ProjectsDefTemplName = 'Projects';
|
ProjectsDefTemplName = 'Projects';
|
||||||
@ -89,11 +106,7 @@ implementation
|
|||||||
|
|
||||||
function FindPackagesTemplate: TDefineTemplate;
|
function FindPackagesTemplate: TDefineTemplate;
|
||||||
begin
|
begin
|
||||||
if (CodeToolBoss<>nil) then
|
Result:=FindRootTemplate(PackagesDefTemplName);
|
||||||
Result:=CodeToolBoss.DefineTree.FindDefineTemplateByName(
|
|
||||||
PackagesDefTemplName,true)
|
|
||||||
else
|
|
||||||
Result:=nil;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function FindPackageTemplateWithID(const PkgID: string): TDefineTemplate;
|
function FindPackageTemplateWithID(const PkgID: string): TDefineTemplate;
|
||||||
@ -107,13 +120,20 @@ begin
|
|||||||
Result:=PkgTempl.FindChildByName(PkgID);
|
Result:=PkgTempl.FindChildByName(PkgID);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function CreateFPCSourceTemplate(const FPCSrcDir, UnitSearchPath, PPUExt,
|
||||||
|
DefaultTargetOS, DefaultProcessorName: string; UnitLinkListValid: boolean;
|
||||||
|
var UnitLinkList: string; Owner: TObject): TDefineTemplate;
|
||||||
|
begin
|
||||||
|
Result:=CodeToolBoss.DefinePool.CreateFPCSrcTemplate(FPCSrcDir,
|
||||||
|
UnitSearchPath, PPUExt,
|
||||||
|
DefaultTargetOS, DefaultProcessorName,
|
||||||
|
UnitLinkListValid, UnitLinkList, Owner);
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
function FindProjectsTemplate: TDefineTemplate;
|
function FindProjectsTemplate: TDefineTemplate;
|
||||||
begin
|
begin
|
||||||
if (CodeToolBoss<>nil) then
|
Result:=FindRootTemplate(ProjectsDefTemplName);
|
||||||
Result:=CodeToolBoss.DefineTree.FindDefineTemplateByName(
|
|
||||||
ProjectsDefTemplName,true)
|
|
||||||
else
|
|
||||||
Result:=nil;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function FindProjectTemplateWithID(const ProjectID: string): TDefineTemplate;
|
function FindProjectTemplateWithID(const ProjectID: string): TDefineTemplate;
|
||||||
@ -136,6 +156,8 @@ begin
|
|||||||
Result.Flags:=[dtfAutoGenerated];
|
Result.Flags:=[dtfAutoGenerated];
|
||||||
// insert behind all
|
// insert behind all
|
||||||
CodeToolBoss.DefineTree.ReplaceRootSameName(Result);
|
CodeToolBoss.DefineTree.ReplaceRootSameName(Result);
|
||||||
|
// make sure the fallback comes last
|
||||||
|
CreateFallBackTemplate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function CreateProjectTemplateWithID(const ProjectID: string): TDefineTemplate;
|
function CreateProjectTemplateWithID(const ProjectID: string): TDefineTemplate;
|
||||||
@ -159,6 +181,8 @@ begin
|
|||||||
Result.Flags:=[dtfAutoGenerated];
|
Result.Flags:=[dtfAutoGenerated];
|
||||||
// insert behind all
|
// insert behind all
|
||||||
CodeToolBoss.DefineTree.ReplaceRootSameName(Result);
|
CodeToolBoss.DefineTree.ReplaceRootSameName(Result);
|
||||||
|
// make sure the fallback comes last
|
||||||
|
CreateFallBackTemplate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function CreatePackageTemplateWithID(const PkgID: string): TDefineTemplate;
|
function CreatePackageTemplateWithID(const PkgID: string): TDefineTemplate;
|
||||||
@ -382,6 +406,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function FindRootTemplate(AName: string): TDefineTemplate;
|
||||||
|
begin
|
||||||
|
if (CodeToolBoss<>nil) then
|
||||||
|
Result:=CodeToolBoss.DefineTree.FindDefineTemplateByName(AName,true)
|
||||||
|
else
|
||||||
|
Result:=nil;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure SetAdditionalGlobalSrcPathToCodeToolBoss(const SrcPath: string);
|
procedure SetAdditionalGlobalSrcPathToCodeToolBoss(const SrcPath: string);
|
||||||
var DefTempl: TDefineTemplate;
|
var DefTempl: TDefineTemplate;
|
||||||
begin
|
begin
|
||||||
@ -398,6 +430,43 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function FindNotUsedDirectoryTemplate: TDefineTemplate;
|
||||||
|
begin
|
||||||
|
Result:=FindRootTemplate(NotUsedDirectoryFlagTemplName);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function CreateNotUsedDirectoryTemplate: TDefineTemplate;
|
||||||
|
begin
|
||||||
|
Result:=FindNotUsedDirectoryTemplate;
|
||||||
|
if Result<>nil then exit;
|
||||||
|
Result:=TDefineTemplate.Create(NotUsedDirectoryFlagTemplName, 'Not used directory flag',
|
||||||
|
'', '', da_DefineRecurse);
|
||||||
|
Result.Flags:=[dtfAutoGenerated];
|
||||||
|
// insert in front of all
|
||||||
|
CodeToolBoss.DefineTree.ReplaceRootSameNameAddFirst(Result);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function FindFallBackTemplate: TDefineTemplate;
|
||||||
|
begin
|
||||||
|
Result:=FindRootTemplate(FallBackTemplName);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function CreateFallBackTemplate: TDefineTemplate;
|
||||||
|
begin
|
||||||
|
Result:=FindFallBackTemplate;
|
||||||
|
if Result<>nil then begin
|
||||||
|
// make sure it is at the end
|
||||||
|
if Result.Next<>nil then
|
||||||
|
CodeToolBoss.DefineTree.MoveToLast(Result);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
Result:=TDefineTemplate.Create(FallBackTemplName, 'Definitions for all other directories',
|
||||||
|
'', '', da_Block);
|
||||||
|
Result.Flags:=[dtfAutoGenerated];
|
||||||
|
// insert behind all
|
||||||
|
CodeToolBoss.DefineTree.ReplaceRootSameName(Result);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
17
ide/main.pp
17
ide/main.pp
@ -102,10 +102,7 @@ uses
|
|||||||
SourceEditProcs, MsgQuickFixes, ViewUnit_dlg, FPDocEditWindow,
|
SourceEditProcs, MsgQuickFixes, ViewUnit_dlg, FPDocEditWindow,
|
||||||
// converter
|
// converter
|
||||||
ChgEncodingDlg, ConvertDelphi, MissingPropertiesDlg, LazXMLForms,
|
ChgEncodingDlg, ConvertDelphi, MissingPropertiesDlg, LazXMLForms,
|
||||||
// rest of the ide
|
// environment option frames
|
||||||
Splash, IDEDefs, LazarusIDEStrConsts, LazConf, MsgView, SearchResultView,
|
|
||||||
CodeTemplatesDlg, CodeBrowser, FindUnitDlg, IdeOptionsDlg,
|
|
||||||
// environment options
|
|
||||||
editor_general_options, formed_options, OI_options,
|
editor_general_options, formed_options, OI_options,
|
||||||
files_options, desktop_options, window_options,
|
files_options, desktop_options, window_options,
|
||||||
Backup_Options, naming_options, fpdoc_options,
|
Backup_Options, naming_options, fpdoc_options,
|
||||||
@ -123,16 +120,19 @@ uses
|
|||||||
codeexplorer_update_options, codeexplorer_categories_options,
|
codeexplorer_update_options, codeexplorer_categories_options,
|
||||||
codeobserver_options,
|
codeobserver_options,
|
||||||
help_general_options,
|
help_general_options,
|
||||||
// project options
|
// project option frames
|
||||||
project_application_options, project_forms_options, project_lazdoc_options,
|
project_application_options, project_forms_options, project_lazdoc_options,
|
||||||
project_save_options, project_versioninfo_options, project_i18n_options,
|
project_save_options, project_versioninfo_options, project_i18n_options,
|
||||||
project_misc_options,
|
project_misc_options,
|
||||||
// project compiler options
|
// project compiler option frames
|
||||||
compiler_path_options, compiler_parsing_options, compiler_codegen_options,
|
compiler_path_options, compiler_parsing_options, compiler_codegen_options,
|
||||||
compiler_linking_options, compiler_verbosity_options, compiler_messages_options,
|
compiler_linking_options, compiler_verbosity_options, compiler_messages_options,
|
||||||
compiler_other_options, compiler_inherited_options, compiler_compilation_options,
|
compiler_other_options, compiler_inherited_options, compiler_compilation_options,
|
||||||
BuildModesEditor,
|
BuildModesEditor,
|
||||||
|
|
||||||
|
// rest of the ide
|
||||||
|
Splash, IDEDefs, LazarusIDEStrConsts, LazConf, MsgView, SearchResultView,
|
||||||
|
CodeTemplatesDlg, CodeBrowser, FindUnitDlg, IdeOptionsDlg, EditDefineTree,
|
||||||
PublishModule, EnvironmentOpts, TransferMacros, KeyMapping, IDETranslations,
|
PublishModule, EnvironmentOpts, TransferMacros, KeyMapping, IDETranslations,
|
||||||
IDEProcs, ExtToolDialog, ExtToolEditDlg, OutputFilter, JumpHistoryView,
|
IDEProcs, ExtToolDialog, ExtToolEditDlg, OutputFilter, JumpHistoryView,
|
||||||
BuildLazDialog, MiscOptions, InputHistory, UnitDependencies, ClipBoardHistory,
|
BuildLazDialog, MiscOptions, InputHistory, UnitDependencies, ClipBoardHistory,
|
||||||
@ -13365,6 +13365,9 @@ begin
|
|||||||
MainBuildBoss.GetFPCCompilerParamsForEnvironmentTest(
|
MainBuildBoss.GetFPCCompilerParamsForEnvironmentTest(
|
||||||
MainBuildBoss.CurDefinesCompilerOptions);
|
MainBuildBoss.CurDefinesCompilerOptions);
|
||||||
//DebugLn('TMainIDE.InitCodeToolBoss CurDefinesCompilerOptions="',CurDefinesCompilerOptions,'"');
|
//DebugLn('TMainIDE.InitCodeToolBoss CurDefinesCompilerOptions="',CurDefinesCompilerOptions,'"');
|
||||||
|
CreateNotUsedDirectoryTemplate;
|
||||||
|
CreateFallBackTemplate;
|
||||||
|
|
||||||
ADefTempl:=CreateFPCTemplate(MainBuildBoss.CurDefinesCompilerFilename,
|
ADefTempl:=CreateFPCTemplate(MainBuildBoss.CurDefinesCompilerFilename,
|
||||||
MainBuildBoss.CurDefinesCompilerOptions,
|
MainBuildBoss.CurDefinesCompilerOptions,
|
||||||
CreateCompilerTestPascalFilename,CompilerUnitSearchPath,
|
CreateCompilerTestPascalFilename,CompilerUnitSearchPath,
|
||||||
@ -13383,7 +13386,7 @@ begin
|
|||||||
CompilerUnitLinks:=InputHistories.FPCConfigCache.GetUnitLinks('');
|
CompilerUnitLinks:=InputHistories.FPCConfigCache.GetUnitLinks('');
|
||||||
UnitLinksChanged:=InputHistories.LastFPCUnitLinksNeedsUpdate('',
|
UnitLinksChanged:=InputHistories.LastFPCUnitLinksNeedsUpdate('',
|
||||||
CompilerUnitSearchPath,EnvironmentOptions.GetFPCSourceDirectory);
|
CompilerUnitSearchPath,EnvironmentOptions.GetFPCSourceDirectory);
|
||||||
ADefTempl:=CreateFPCSrcTemplate(
|
ADefTempl:=CreateFPCSourceTemplate(
|
||||||
CodeToolBoss.GlobalValues.Variables[ExternalMacroStart+'FPCSrcDir'],
|
CodeToolBoss.GlobalValues.Variables[ExternalMacroStart+'FPCSrcDir'],
|
||||||
CompilerUnitSearchPath,
|
CompilerUnitSearchPath,
|
||||||
CodeToolBoss.GetCompiledSrcExtForDirectory(''),
|
CodeToolBoss.GetCompiledSrcExtForDirectory(''),
|
||||||
|
Loading…
Reference in New Issue
Block a user