mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-09 23:08:05 +02:00
IDE: Allow user to create own custom IDE macros and install them to IDE by using packages. Issue #23502, patch from Cyrax
git-svn-id: trunk@39909 -
This commit is contained in:
parent
e03de76fde
commit
d451ec6672
@ -9,7 +9,8 @@ uses
|
||||
Dialogs, Buttons, ExtCtrls, StdCtrls, FileUtil, ButtonPanel,
|
||||
BasicCodeTools,
|
||||
IDEHelpIntf,
|
||||
IDEProcs, InputHistory, LazarusIDEStrConsts, EnvironmentOpts, TransferMacros;
|
||||
IDEProcs, InputHistory, LazarusIDEStrConsts, EnvironmentOpts, TransferMacros,
|
||||
MacroDefIntf;
|
||||
|
||||
type
|
||||
TIDEDirective = (
|
||||
|
@ -41,7 +41,7 @@ uses
|
||||
FileProcs, CodeToolsCfgScript, CodeToolsStructs,
|
||||
// IDEIntf
|
||||
SrcEditorIntf, ProjectIntf, MacroIntf, IDEDialogs, IDEExternToolIntf,
|
||||
CompOptsIntf, LazIDEIntf,
|
||||
CompOptsIntf, LazIDEIntf, MacroDefIntf,
|
||||
// IDE
|
||||
LazarusIDEStrConsts, DialogProcs, IDEProcs, CodeToolsOptions, InputHistory,
|
||||
EditDefineTree, ProjectResources, MiscOptions, LazConf, EnvironmentOpts,
|
||||
|
@ -41,7 +41,7 @@ uses
|
||||
Dialogs, LazConfigStorage, Laz2_XMLCfg, LazUTF8,
|
||||
// IDEIntf
|
||||
ProjectIntf, ObjectInspector, IDEWindowIntf, IDEOptionsIntf,
|
||||
CompOptsIntf, IDEExternToolIntf, IDEDialogs,
|
||||
CompOptsIntf, IDEExternToolIntf, IDEDialogs, MacroDefIntf,
|
||||
// IDE
|
||||
IDEProcs, LazarusIDEStrConsts, IDETranslations, LazConf,
|
||||
IDEOptionDefs, TransferMacros, Debugger;
|
||||
|
@ -44,7 +44,7 @@ interface
|
||||
uses
|
||||
Classes, SysUtils, strutils, contnrs, LCLProc, Forms, Controls, Buttons,
|
||||
Dialogs, FileUtil, Laz2_XMLCfg, lazutf8classes, Graphics, ComCtrls, ExtCtrls,
|
||||
StdCtrls, DefineTemplates, CodeToolManager, TransferMacros,
|
||||
StdCtrls, DefineTemplates, CodeToolManager, TransferMacros, MacroDefIntf,
|
||||
LazarusIDEStrConsts, LazConf, EnvironmentOpts, IDEProcs, AboutFrm;
|
||||
|
||||
type
|
||||
|
@ -54,7 +54,7 @@ uses
|
||||
CodeToolsConfig, ExprEval, FileProcs, DefineTemplates,
|
||||
BasicCodeTools, CodeToolsCfgScript, CodeToolManager, CodeCache,
|
||||
// IDEIntf
|
||||
PropEdits, CompOptsIntf, ProjectIntf, MacroIntf, LazIDEIntf,
|
||||
PropEdits, CompOptsIntf, ProjectIntf, MacroIntf, MacroDefIntf, LazIDEIntf,
|
||||
// IDE
|
||||
CompOptsModes, ProjectResources, LazConf, W32Manifest, ProjectIcon,
|
||||
LazarusIDEStrConsts, CompilerOptions,
|
||||
|
@ -57,7 +57,7 @@ uses
|
||||
SynExportHTML, SynHighlighterPas,
|
||||
// Intf
|
||||
SrcEditorIntf, MenuIntf, LazIDEIntf, PackageIntf, IDEHelpIntf, IDEImagesIntf,
|
||||
IDEWindowIntf, ProjectIntf,
|
||||
IDEWindowIntf, ProjectIntf, MacroDefIntf,
|
||||
// IDE units
|
||||
IDEDialogs, LazarusIDEStrConsts, IDECommands, EditorOptions,
|
||||
EnvironmentOpts, WordCompletion, FindReplaceDialog, IDEProcs, IDEOptionDefs,
|
||||
|
@ -46,33 +46,9 @@ unit TransferMacros;
|
||||
interface
|
||||
|
||||
uses Classes, SysUtils, LCLProc, FileUtil, FileProcs, LazarusIDEStrConsts,
|
||||
MacroIntf;
|
||||
MacroIntf, MacroDefIntf;
|
||||
|
||||
type
|
||||
TTransferMacro = class;
|
||||
|
||||
TOnSubstitution = procedure(TheMacro: TTransferMacro; const MacroName: string;
|
||||
var s:string; const Data: PtrInt; var Handled, Abort: boolean;
|
||||
Depth: integer) of object;
|
||||
|
||||
TMacroFunction = function(const s: string; const Data: PtrInt;
|
||||
var Abort: boolean): string of object;
|
||||
|
||||
TTransferMacroFlag = (
|
||||
tmfInteractive
|
||||
);
|
||||
TTransferMacroFlags = set of TTransferMacroFlag;
|
||||
|
||||
TTransferMacro = class
|
||||
public
|
||||
Name: string;
|
||||
Value: string;
|
||||
Description: string;
|
||||
MacroFunction: TMacroFunction;
|
||||
Flags: TTransferMacroFlags;
|
||||
constructor Create(AName, AValue, ADescription:string;
|
||||
AMacroFunction: TMacroFunction; TheFlags: TTransferMacroFlags);
|
||||
end;
|
||||
|
||||
{ TTransferMacroList }
|
||||
|
||||
@ -130,6 +106,7 @@ type
|
||||
function StrHasMacros(const s: string): boolean; override;
|
||||
function SubstituteMacros(var s: string): boolean; override;
|
||||
function IsMacro(const Name: string): boolean; override;
|
||||
procedure Add(NewMacro: TTransferMacro);override;
|
||||
end;
|
||||
|
||||
var
|
||||
@ -165,18 +142,6 @@ begin
|
||||
CTIncreaseChangeStamp(BuildMacroChangeStamp);
|
||||
end;
|
||||
|
||||
{ TTransferMacro }
|
||||
|
||||
constructor TTransferMacro.Create(AName, AValue, ADescription:string;
|
||||
AMacroFunction: TMacroFunction; TheFlags: TTransferMacroFlags);
|
||||
begin
|
||||
Name:=AName;
|
||||
Value:=AValue;
|
||||
Description:=ADescription;
|
||||
MacroFunction:=AMacroFunction;
|
||||
Flags:=TheFlags;
|
||||
end;
|
||||
|
||||
{ TTransferMacroList }
|
||||
|
||||
constructor TTransferMacroList.Create;
|
||||
@ -578,6 +543,11 @@ begin
|
||||
Result:=GlobalMacroList.FindByName(Name)<>nil;
|
||||
end;
|
||||
|
||||
procedure TLazIDEMacros.Add(NewMacro: TTransferMacro);
|
||||
Begin
|
||||
GlobalMacroList.Add(NewMacro);
|
||||
end;
|
||||
|
||||
procedure InternalInit;
|
||||
var
|
||||
c: char;
|
||||
|
@ -22,7 +22,7 @@
|
||||
<Description Value="IDEIntf - the interface units for the Lazarus IDE"/>
|
||||
<License Value="Modified LPGL2"/>
|
||||
<Version Major="1"/>
|
||||
<Files Count="69">
|
||||
<Files Count="70">
|
||||
<Item1>
|
||||
<Filename Value="actionseditor.lfm"/>
|
||||
<Type Value="LFM"/>
|
||||
@ -300,6 +300,10 @@
|
||||
<Filename Value="oifavoriteproperties.pas"/>
|
||||
<UnitName Value="OIFavouriteProperties"/>
|
||||
</Item69>
|
||||
<Item70>
|
||||
<Filename Value="macrodefintf.pas"/>
|
||||
<UnitName Value="macrodefintf"/>
|
||||
</Item70>
|
||||
</Files>
|
||||
<LazDoc Paths="docs"/>
|
||||
<i18n>
|
||||
|
@ -18,7 +18,7 @@ uses
|
||||
newfield, NewItemIntf, ObjectInspector, ObjInspStrConsts, PackageIntf,
|
||||
ProjectIntf, ProjectResourcesIntf, PropEdits, PropEditUtils, SrcEditorIntf,
|
||||
StatusBarPropEdit, StringsPropEditDlg, TextTools, TreeViewPropEdit,
|
||||
CompOptsIntf, OIFavoriteProperties, LazarusPackageIntf;
|
||||
CompOptsIntf, OIFavoriteProperties, MacroDefIntf, LazarusPackageIntf;
|
||||
|
||||
implementation
|
||||
|
||||
|
@ -21,7 +21,7 @@ unit MacroIntf;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LazFileUtils;
|
||||
Classes, SysUtils, LazFileUtils, MacroDefIntf;
|
||||
|
||||
type
|
||||
{ TIDEMacros - macros for paths and compiler settings }
|
||||
@ -41,6 +41,7 @@ type
|
||||
// file utility functions
|
||||
function CreateAbsoluteSearchPath(var SearchPath: string;
|
||||
const BaseDirectory: string): boolean;
|
||||
procedure Add(NewMacro: TTransferMacro);virtual;
|
||||
end;
|
||||
|
||||
var
|
||||
@ -136,5 +137,9 @@ begin
|
||||
SearchPath:=MinimizeSearchPath(LazFileUtils.CreateAbsoluteSearchPath(SearchPath,BaseDir));
|
||||
end;
|
||||
|
||||
procedure TIDEMacros.Add(NewMacro: TTransferMacro);
|
||||
Begin
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
@ -48,7 +48,7 @@ uses
|
||||
Forms, FileProcs, FileUtil, AVL_Tree, LazConfigStorage, Laz2_XMLCfg,
|
||||
BasicCodeTools, CodeToolsCfgScript, DefineTemplates, CodeToolManager,
|
||||
CodeCache, CodeToolsStructs,
|
||||
PropEdits, LazIDEIntf, MacroIntf, PackageIntf, IDEOptionsIntf,
|
||||
PropEdits, LazIDEIntf, MacroIntf, MacroDefIntf, PackageIntf, IDEOptionsIntf,
|
||||
EditDefineTree, CompilerOptions, CompOptsModes, IDEOptionDefs,
|
||||
LazarusIDEStrConsts, IDEProcs, ComponentReg,
|
||||
TransferMacros, FileReferenceList, PublishModule;
|
||||
|
@ -53,7 +53,7 @@ uses
|
||||
CodeToolManager, DirectoryCacher,
|
||||
// IDEIntf,
|
||||
SrcEditorIntf, IDEExternToolIntf, IDEDialogs, IDEMsgIntf, PackageIntf,
|
||||
CompOptsIntf, LazIDEIntf,
|
||||
CompOptsIntf, LazIDEIntf, MacroDefIntf,
|
||||
// package registration
|
||||
LazarusPackageIntf,
|
||||
// IDE
|
||||
|
Loading…
Reference in New Issue
Block a user