mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-12 16:40:18 +02:00
IDE: edit build macros
git-svn-id: trunk@27003 -
This commit is contained in:
parent
812335d701
commit
4400804029
@ -42,20 +42,27 @@
|
||||
- remove TBuildMode
|
||||
- remove TDefaultBuildModeGraph
|
||||
- project can define values for build macros
|
||||
- load/save to xmlconfig
|
||||
- load/save to xmlconfig
|
||||
- project can define values for build macros
|
||||
- edit them in the compiler options
|
||||
- edit name
|
||||
- edit value
|
||||
- Every package and project can define a list of build macros.
|
||||
- load/save to xmlconfig
|
||||
- Every package and project can define a list of build macros.
|
||||
- edit in compiler options:
|
||||
- new
|
||||
- rename
|
||||
- delete
|
||||
- add value
|
||||
- delete value
|
||||
- edit default value
|
||||
|
||||
ToDo:
|
||||
- Every package and project can define a list of build macros.
|
||||
- load/save to xmlconfig
|
||||
- edit in compiler options:
|
||||
- new
|
||||
- rename
|
||||
- delete
|
||||
- add value
|
||||
- delete value
|
||||
- edit default value
|
||||
- project can define values for build macros
|
||||
- edit them in the compiler options
|
||||
- edit them in the compiler options
|
||||
- add value
|
||||
- delete value
|
||||
- every package/project needs a function to compute all values of its build macros
|
||||
- build macros depend on used packages and project build macro values
|
||||
- add a changestamp for this
|
||||
@ -126,6 +133,7 @@ type
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
procedure Assign(Source: TLazBuildMacro); override;
|
||||
function Equals(Other: TLazBuildMacro): boolean; reintroduce;
|
||||
procedure LoadFromXMLConfig(aXMLConfig: TXMLConfig; const Path: string;
|
||||
DoSwitchPathDelims: boolean);
|
||||
procedure SaveToXMLConfig(aXMLConfig: TXMLConfig; const Path: string;
|
||||
@ -3668,15 +3676,26 @@ begin
|
||||
Values:=Source.Values;
|
||||
end;
|
||||
|
||||
function TIDEBuildMacro.Equals(Other: TLazBuildMacro): boolean;
|
||||
begin
|
||||
Result:=false;
|
||||
if Identifier<>Other.Identifier then exit;
|
||||
if Description<>Other.Description then exit;
|
||||
if not Values.Equals(Other.Values) then exit;
|
||||
if not ValueDescriptions.Equals(Other.ValueDescriptions) then exit;
|
||||
if DefaultValue<>Other.DefaultValue then exit;
|
||||
Result:=true;
|
||||
end;
|
||||
|
||||
procedure TIDEBuildMacro.LoadFromXMLConfig(AXMLConfig: TXMLConfig;
|
||||
const Path: string; DoSwitchPathDelims: boolean);
|
||||
begin
|
||||
FIdentifier:=AXMLConfig.GetValue(Path+'Identifier/Value','');
|
||||
if not IsValidIdent(FIdentifier) then FIdentifier:='';
|
||||
FDescription:=AXMLConfig.GetValue(Path+'Description/Value','');
|
||||
FDescription:=ConvertLineEndings(AXMLConfig.GetValue(Path+'Description/Value',''));
|
||||
LoadStringList(AXMLConfig,FValues,Path+'Values/');
|
||||
LoadStringList(AXMLConfig,FValueDescriptions,Path+'ValueDescriptions/');
|
||||
FDefaultValue:=AXMLConfig.GetValue(Path+'Default/Value','');
|
||||
FDefaultValue:=ConvertLineEndings(AXMLConfig.GetValue(Path+'Default/Value',''));
|
||||
|
||||
while ValueDescriptions.Count>Values.Count do
|
||||
ValueDescriptions.Delete(ValueDescriptions.Count-1);
|
||||
@ -3688,10 +3707,12 @@ procedure TIDEBuildMacro.SaveToXMLConfig(AXMLConfig: TXMLConfig;
|
||||
const Path: string; UsePathDelim: TPathDelimSwitch);
|
||||
begin
|
||||
AXMLConfig.SetDeleteValue(Path+'Identifier/Value',FIdentifier,'');
|
||||
AXMLConfig.SetDeleteValue(Path+'Description/Value',FDescription,'');
|
||||
AXMLConfig.SetDeleteValue(Path+'Description/Value',
|
||||
LineBreaksToDelimiter(FDescription,#10),'');
|
||||
SaveStringList(AXMLConfig,FValues,Path+'Values/');
|
||||
SaveStringList(AXMLConfig,FValueDescriptions,Path+'ValueDescriptions/');
|
||||
AXMLConfig.SetDeleteValue(Path+'DefaultValue/Value',FDefaultValue,'');
|
||||
AXMLConfig.SetDeleteValue(Path+'DefaultValue/Value',
|
||||
LineBreaksToDelimiter(FDefaultValue,#10),'');
|
||||
end;
|
||||
|
||||
procedure TIDEBuildMacro.CreateDiff(OtherMode: TLazBuildMacro;
|
||||
@ -3722,9 +3743,12 @@ begin
|
||||
end;
|
||||
|
||||
procedure TIDEBuildMacro.SetDefaultValue(const AValue: string);
|
||||
var
|
||||
NewValue: String;
|
||||
begin
|
||||
if DefaultValue=AValue then exit;
|
||||
FDefaultValue:=AValue;
|
||||
NewValue:=ConvertLineEndings(AValue);
|
||||
if DefaultValue=NewValue then exit;
|
||||
FDefaultValue:=NewValue;
|
||||
IncreaseChangeStamp;
|
||||
IncreaseBuildMacroChangeStamp;
|
||||
end;
|
||||
@ -3814,7 +3838,9 @@ begin
|
||||
NewItem:=TIDEBuildMacro.Create;
|
||||
NewItem.LoadFromXMLConfig(AXMLConfig,Path+'Item'+IntToStr(i+1)+'/',DoSwitchPathDelims);
|
||||
if (NewItem.Identifier<>'') and IsValidIdent(NewItem.Identifier) then
|
||||
FItems.Add(NewItem);
|
||||
FItems.Add(NewItem)
|
||||
else
|
||||
NewItem.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -784,7 +784,7 @@ begin
|
||||
|
||||
edtErrorCnt.Text := IntToStr(Options.StopAfterErrCount);
|
||||
|
||||
// conditional
|
||||
// conditional + build macros
|
||||
{$IFDEF EnableBuildModes}
|
||||
ConditionalOptionsFrame.Conditionals:=Options.Conditionals as TCompOptConditionals;
|
||||
BuildMacrosFrame.BuildMacros:=Options.BuildMacros as TIDEBuildMacros;
|
||||
@ -1524,7 +1524,7 @@ begin
|
||||
ConditionalPage:=MainNoteBook.Page[Page];
|
||||
ConditionalPage.Caption:=dlgCOConditionals;
|
||||
{$IFDEF EnableBuildModes}
|
||||
CategoryTreeView.Items.AddObject(nil,MainNoteBook.Page[Page].Caption,MainNoteBook.Page[Page]);
|
||||
CategoryTreeView.Items.AddObject(nil,ConditionalPage.Caption,ConditionalPage);
|
||||
{$ENDIF}
|
||||
ConditionalsGroupBox.Caption:=dlgOIOptions;
|
||||
end;
|
||||
|
@ -1,50 +1,67 @@
|
||||
inherited BuildModesEditorFrame: TBuildModesEditorFrame
|
||||
Height = 306
|
||||
Width = 419
|
||||
ClientHeight = 306
|
||||
ClientWidth = 419
|
||||
Height = 421
|
||||
Width = 550
|
||||
ClientHeight = 421
|
||||
ClientWidth = 550
|
||||
TabOrder = 0
|
||||
DesignLeft = 460
|
||||
DesignTop = 269
|
||||
object BuildModeBtnPanel: TPanel[0]
|
||||
Left = 0
|
||||
Height = 24
|
||||
Top = 0
|
||||
Width = 419
|
||||
Align = alTop
|
||||
AutoSize = True
|
||||
ClientHeight = 24
|
||||
ClientWidth = 419
|
||||
object BuildMacroValuesGroupBox: TGroupBox[0]
|
||||
Left = 6
|
||||
Height = 234
|
||||
Top = 181
|
||||
Width = 538
|
||||
Align = alClient
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'BuildMacroValuesGroupBox'
|
||||
ClientHeight = 213
|
||||
ClientWidth = 530
|
||||
TabOrder = 0
|
||||
object NewBuildModeSpeedButton: TSpeedButton
|
||||
Left = 1
|
||||
Height = 22
|
||||
Top = 1
|
||||
Width = 23
|
||||
Align = alLeft
|
||||
AutoSize = True
|
||||
Color = clBtnFace
|
||||
NumGlyphs = 0
|
||||
OnClick = NewBuildModeButtonClick
|
||||
ShowHint = True
|
||||
ParentShowHint = False
|
||||
end
|
||||
object DeleteBMRowSpeedButton: TSpeedButton
|
||||
Left = 24
|
||||
Height = 22
|
||||
Top = 1
|
||||
Width = 23
|
||||
Align = alLeft
|
||||
AutoSize = True
|
||||
Color = clBtnFace
|
||||
NumGlyphs = 0
|
||||
OnClick = DeleteBMRowButtonClick
|
||||
ShowHint = True
|
||||
ParentShowHint = False
|
||||
object BuildMacroValuesStringGrid: TStringGrid
|
||||
Left = 0
|
||||
Height = 213
|
||||
Top = 0
|
||||
Width = 530
|
||||
Align = alClient
|
||||
AutoFillColumns = True
|
||||
ColCount = 2
|
||||
DefaultColWidth = 120
|
||||
FixedCols = 0
|
||||
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goEditing, goAlwaysShowEditor, goSmoothScroll]
|
||||
RowCount = 2
|
||||
TabOrder = 0
|
||||
OnEditButtonClick = BuildMacroValuesStringGridEditButtonClick
|
||||
OnMouseUp = BuildMacroValuesStringGridMouseUp
|
||||
OnPickListSelect = BuildMacroValuesStringGridPickListSelect
|
||||
OnSelectEditor = BuildMacroValuesStringGridSelectEditor
|
||||
OnSelectCell = BuildMacroValuesStringGridSelectCell
|
||||
ColWidths = (
|
||||
264
|
||||
264
|
||||
)
|
||||
end
|
||||
end
|
||||
object BuildModesPopupMenu: TPopupMenu[1]
|
||||
left = 83
|
||||
top = 115
|
||||
object BuildModesGroupBox: TGroupBox[1]
|
||||
Left = 6
|
||||
Height = 158
|
||||
Top = 6
|
||||
Width = 538
|
||||
Align = alTop
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'BuildModesGroupBox'
|
||||
TabOrder = 1
|
||||
end
|
||||
object Splitter1: TSplitter[2]
|
||||
Cursor = crVSplit
|
||||
Left = 0
|
||||
Height = 5
|
||||
Top = 170
|
||||
Width = 550
|
||||
Align = alTop
|
||||
ResizeAnchor = akTop
|
||||
end
|
||||
object BuildModesPopupMenu: TPopupMenu[3]
|
||||
left = 180
|
||||
top = 60
|
||||
end
|
||||
end
|
||||
|
@ -17,6 +17,11 @@
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
Abstract:
|
||||
The frame for 'build modes' on the compiler options.
|
||||
Allows to edit build modes and build macro values.
|
||||
It does not allow to define new build macros.
|
||||
}
|
||||
unit BuildModesEditor;
|
||||
|
||||
@ -29,6 +34,7 @@ uses
|
||||
Grids, Graphics, Menus, ComCtrls, Dialogs, AvgLvlTree, DefineTemplates,
|
||||
StdCtrls, GraphMath, ExtCtrls, Buttons,
|
||||
ProjectIntf, IDEImagesIntf, IDEOptionsIntf,
|
||||
PackageDefs,
|
||||
PathEditorDlg, Project, PackageSystem, LazarusIDEStrConsts, CompilerOptions,
|
||||
IDEProcs;
|
||||
|
||||
@ -38,20 +44,32 @@ type
|
||||
{ TBuildModesEditorFrame }
|
||||
|
||||
TBuildModesEditorFrame = class(TAbstractIDEOptionsEditor)
|
||||
BuildMacroValuesGroupBox: TGroupBox;
|
||||
BuildMacroValuesStringGrid: TStringGrid;
|
||||
BuildModesGroupBox: TGroupBox;
|
||||
BuildModesPopupMenu: TPopupMenu;
|
||||
BuildModeBtnPanel: TPanel;
|
||||
NewBuildModeSpeedButton: TSpeedButton;
|
||||
DeleteBMRowSpeedButton: TSpeedButton;
|
||||
procedure DeleteBMRowButtonClick(Sender: TObject);
|
||||
procedure NewBuildModeButtonClick(Sender: TObject);
|
||||
Splitter1: TSplitter;
|
||||
procedure BuildMacroValuesStringGridEditButtonClick(Sender: TObject);
|
||||
procedure BuildMacroValuesStringGridMouseUp(Sender: TObject;
|
||||
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||
procedure BuildMacroValuesStringGridPickListSelect(Sender: TObject);
|
||||
procedure BuildMacroValuesStringGridSelectCell(Sender: TObject; aCol,
|
||||
aRow: Integer; var CanSelect: Boolean);
|
||||
procedure BuildMacroValuesStringGridSelectEditor(Sender: TObject; aCol,
|
||||
aRow: Integer; var Editor: TWinControl);
|
||||
private
|
||||
procedure UpdateButtons;
|
||||
FMacroValues: TProjectBuildMacros;
|
||||
FProject: TProject;
|
||||
procedure UpdateMacrosControls;
|
||||
function GetAllBuildMacros: TStrings;
|
||||
public
|
||||
function GetTitle: String; override;
|
||||
procedure Setup(ADialog: TAbstractOptionsEditorDialog); override;
|
||||
procedure ReadSettings(AOptions: TAbstractIDEOptions); override;
|
||||
procedure WriteSettings(AOptions: TAbstractIDEOptions); override;
|
||||
class function SupportedOptionsClass: TAbstractIDEOptionsClass; override;
|
||||
property AProject: TProject read FProject;
|
||||
property MacroValues: TProjectBuildMacros read FMacroValues;
|
||||
end;
|
||||
|
||||
implementation
|
||||
@ -60,14 +78,167 @@ implementation
|
||||
|
||||
{ TBuildModesEditorFrame }
|
||||
|
||||
procedure TBuildModesEditorFrame.NewBuildModeButtonClick(Sender: TObject);
|
||||
procedure TBuildModesEditorFrame.BuildMacroValuesStringGridEditButtonClick(
|
||||
Sender: TObject);
|
||||
var
|
||||
Grid: TStringGrid;
|
||||
begin
|
||||
Grid:=BuildMacroValuesStringGrid;
|
||||
//debugln(['TBuildModesEditorFrame.BuildMacroValuesStringGridEditButtonClick Col=',Grid.Col,' Row=',Grid.Row]);
|
||||
if Grid.Col=0 then begin
|
||||
if Grid.Row=MacroValues.Count+1 then begin
|
||||
// add new row
|
||||
|
||||
end else if Grid.Row>0 then begin
|
||||
// delete row
|
||||
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TBuildModesEditorFrame.UpdateButtons;
|
||||
procedure TBuildModesEditorFrame.BuildMacroValuesStringGridMouseUp(
|
||||
Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||
var
|
||||
Grid: TStringGrid;
|
||||
ACol: Longint;
|
||||
ARow: Longint;
|
||||
begin
|
||||
Grid:=BuildMacroValuesStringGrid;
|
||||
Grid.MouseToCell(X,Y,ACol,ARow);
|
||||
//debugln(['TBuildModesEditorFrame.BuildMacroValuesStringGridMouseUp ',ACol,',',ARow]);
|
||||
if ARow=MacroValues.Count+1 then begin
|
||||
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TBuildModesEditorFrame.BuildMacroValuesStringGridPickListSelect(
|
||||
Sender: TObject);
|
||||
begin
|
||||
//debugln(['TBuildModesEditorFrame.BuildMacroValuesStringGridPickListSelect ',Grid.Col,',',Grid.Row]);
|
||||
end;
|
||||
|
||||
procedure TBuildModesEditorFrame.BuildMacroValuesStringGridSelectCell(
|
||||
Sender: TObject; aCol, aRow: Integer; var CanSelect: Boolean);
|
||||
begin
|
||||
//debugln(['TBuildModesEditorFrame.BuildMacroValuesStringGridSelectCell ',Grid.Col,',',Grid.Row,' ',aCol,',',aRow]);
|
||||
end;
|
||||
|
||||
procedure TBuildModesEditorFrame.BuildMacroValuesStringGridSelectEditor(
|
||||
Sender: TObject; aCol, aRow: Integer; var Editor: TWinControl);
|
||||
var
|
||||
PickList: TPickListCellEditor;
|
||||
sl: TStringList;
|
||||
Macros: TStrings;
|
||||
Grid: TStringGrid;
|
||||
MacroName: string;
|
||||
i: LongInt;
|
||||
Macro: TLazBuildMacro;
|
||||
begin
|
||||
if MacroValues=nil then exit;
|
||||
Grid:=BuildMacroValuesStringGrid;
|
||||
//debugln(['TBuildModesEditorFrame.BuildMacroValuesStringGridSelectEditor ',acol,',',aRow,' ',DbgSName(Editor)]);
|
||||
if aCol=0 then begin
|
||||
// list all build MacroValues
|
||||
if not (Editor is TPickListCellEditor) then exit;
|
||||
PickList:=TPickListCellEditor(Editor);
|
||||
sl:=TStringList.Create;
|
||||
Macros:=nil;
|
||||
try
|
||||
if aRow=MacroValues.Count+1 then
|
||||
sl.Add('(none)')
|
||||
else
|
||||
sl.Add('(delete)');
|
||||
|
||||
Macros:=GetAllBuildMacros;
|
||||
sl.AddStrings(Macros);
|
||||
|
||||
PickList.Items.Assign(sl);
|
||||
finally
|
||||
Macros.Free;
|
||||
sl.Free;
|
||||
end;
|
||||
end else if aCol=1 then begin
|
||||
// list all possible values of current macro
|
||||
|
||||
if not (Editor is TPickListCellEditor) then exit;
|
||||
PickList:=TPickListCellEditor(Editor);
|
||||
|
||||
MacroName:=Grid.Cells[0,aRow];
|
||||
sl:=TStringList.Create;
|
||||
try
|
||||
Macros:=GetAllBuildMacros;
|
||||
i:=Macros.IndexOf(MacroName);
|
||||
if i>=0 then begin
|
||||
Macro:=TLazBuildMacro(Macros.Objects[i]);
|
||||
sl.AddStrings(Macro.Values);
|
||||
end else begin
|
||||
sl.Add('');
|
||||
end;
|
||||
|
||||
PickList.Items.Assign(sl);
|
||||
finally
|
||||
Macros.Free;
|
||||
sl.Free;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TBuildModesEditorFrame.UpdateMacrosControls;
|
||||
var
|
||||
Grid: TStringGrid;
|
||||
i: Integer;
|
||||
begin
|
||||
Grid:=BuildMacroValuesStringGrid;
|
||||
Grid.RowCount:=MacroValues.Count+2; // + titles + add button
|
||||
|
||||
for i:=0 to MacroValues.Count-1 do begin
|
||||
Grid.Cells[0,i+1]:=MacroValues.Names[i];
|
||||
Grid.Cells[1,i+1]:=MacroValues.ValueFromIndex(i);
|
||||
end;
|
||||
i:=MacroValues.Count+1;
|
||||
Grid.Cells[0,i]:='(none)';
|
||||
Grid.Cells[1,i]:='';
|
||||
end;
|
||||
|
||||
function TBuildModesEditorFrame.GetAllBuildMacros: TStrings;
|
||||
|
||||
procedure Add(aBuildMacro: TLazBuildMacro);
|
||||
begin
|
||||
if GetAllBuildMacros.IndexOf(aBuildMacro.Identifier)>=0 then exit;
|
||||
GetAllBuildMacros.AddObject(aBuildMacro.Identifier,aBuildMacro);
|
||||
end;
|
||||
|
||||
procedure Add(CompOpts: TLazCompilerOptions);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
for i:=0 to CompOpts.BuildMacros.Count-1 do
|
||||
Add(CompOpts.BuildMacros[i]);
|
||||
end;
|
||||
|
||||
var
|
||||
PkgList: TFPList;
|
||||
APackage: TLazPackage;
|
||||
i: Integer;
|
||||
begin
|
||||
Result:=TStringList.Create;
|
||||
Add(AProject.CompilerOptions);
|
||||
PkgList:=nil;
|
||||
try
|
||||
PackageGraph.GetAllRequiredPackages(AProject.FirstRequiredDependency,PkgList);
|
||||
if PkgList<>nil then begin
|
||||
for i:=0 to PkgList.Count-1 do begin
|
||||
if TObject(PkgList[i]) is TLazPackage then begin
|
||||
APackage:=TLazPackage(PkgList[i]);
|
||||
Add(APackage.CompilerOptions);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
PkgList.Free;
|
||||
end;
|
||||
|
||||
TStringList(Result).Sort;
|
||||
end;
|
||||
|
||||
function TBuildModesEditorFrame.GetTitle: String;
|
||||
@ -75,30 +246,38 @@ begin
|
||||
Result := 'Build modes';
|
||||
end;
|
||||
|
||||
procedure TBuildModesEditorFrame.DeleteBMRowButtonClick(Sender: TObject);
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
procedure TBuildModesEditorFrame.Setup(ADialog: TAbstractOptionsEditorDialog);
|
||||
var
|
||||
Grid: TStringGrid;
|
||||
begin
|
||||
NewBuildModeSpeedButton.Hint:=lisNewBuildMode;
|
||||
NewBuildModeSpeedButton.LoadGlyphFromLazarusResource('laz_add');
|
||||
DeleteBMRowSpeedButton.Hint:=lisDeleteRow;
|
||||
DeleteBMRowSpeedButton.LoadGlyphFromLazarusResource('laz_delete');
|
||||
BuildModesGroupBox.Caption:='Build modes';
|
||||
|
||||
// laz_edit, arrow_up, arrow_down
|
||||
UpdateButtons;
|
||||
BuildMacroValuesGroupBox.Caption:='Set macro values';
|
||||
Grid:=BuildMacroValuesStringGrid;
|
||||
Grid.Columns.Add;
|
||||
Grid.Columns[0].Title.Caption:='Macro name';
|
||||
Grid.Columns[0].ButtonStyle:=cbsPickList;
|
||||
Grid.Columns.Add;
|
||||
Grid.Columns[1].Title.Caption:='Macro value';
|
||||
Grid.Columns[1].ButtonStyle:=cbsPickList;
|
||||
end;
|
||||
|
||||
procedure TBuildModesEditorFrame.ReadSettings(AOptions: TAbstractIDEOptions);
|
||||
var
|
||||
PCOptions: TProjectCompilerOptions;
|
||||
begin
|
||||
|
||||
//debugln(['TBuildModesEditorFrame.ReadSettings ',DbgSName(AOptions)]);
|
||||
if AOptions is TProjectCompilerOptions then begin
|
||||
PCOptions:=TProjectCompilerOptions(AOptions);
|
||||
FProject:=PCOptions.Project;
|
||||
FMacroValues:=FProject.MacroValues;
|
||||
UpdateMacrosControls;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TBuildModesEditorFrame.WriteSettings(AOptions: TAbstractIDEOptions);
|
||||
begin
|
||||
// todo:
|
||||
|
||||
end;
|
||||
|
||||
class function TBuildModesEditorFrame.SupportedOptionsClass: TAbstractIDEOptionsClass;
|
||||
|
@ -2,9 +2,9 @@ object CompOptBuildMacrosFrame: TCompOptBuildMacrosFrame
|
||||
Left = 0
|
||||
Height = 233
|
||||
Top = 0
|
||||
Width = 492
|
||||
Width = 578
|
||||
ClientHeight = 233
|
||||
ClientWidth = 492
|
||||
ClientWidth = 578
|
||||
TabOrder = 0
|
||||
Visible = False
|
||||
DesignLeft = 349
|
||||
@ -13,17 +13,17 @@ object CompOptBuildMacrosFrame: TCompOptBuildMacrosFrame
|
||||
Left = 0
|
||||
Height = 233
|
||||
Top = 0
|
||||
Width = 492
|
||||
Align = alClient
|
||||
Width = 230
|
||||
Align = alLeft
|
||||
Caption = 'BuildMacrosGroupBox'
|
||||
ClientHeight = 212
|
||||
ClientWidth = 484
|
||||
ClientWidth = 222
|
||||
TabOrder = 0
|
||||
object BuildMacrosTreeView: TTreeView
|
||||
Left = 0
|
||||
Height = 212
|
||||
Top = 0
|
||||
Width = 484
|
||||
Width = 222
|
||||
Align = alClient
|
||||
DefaultItemHeight = 19
|
||||
PopupMenu = BuildMacrosTVPopupMenu
|
||||
@ -31,14 +31,732 @@ object CompOptBuildMacrosFrame: TCompOptBuildMacrosFrame
|
||||
TabOrder = 0
|
||||
OnEdited = BuildMacrosTreeViewEdited
|
||||
OnEditing = BuildMacrosTreeViewEditing
|
||||
OnKeyDown = BuildMacrosTreeViewKeyDown
|
||||
OnStartDrag = BuildMacrosTreeViewStartDrag
|
||||
OnSelectionChanged = BuildMacrosTreeViewSelectionChanged
|
||||
Options = [tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoRightClickSelect, tvoShowButtons, tvoShowLines, tvoShowRoot, tvoToolTips]
|
||||
end
|
||||
end
|
||||
object BuildMacroDefValGroupBox: TGroupBox
|
||||
Left = 235
|
||||
Height = 233
|
||||
Top = 0
|
||||
Width = 343
|
||||
Align = alClient
|
||||
Caption = 'BuildMacroDefValGroupBox'
|
||||
ClientHeight = 212
|
||||
ClientWidth = 335
|
||||
TabOrder = 1
|
||||
inline BMDefValSynEdit: TSynEdit
|
||||
Left = 0
|
||||
Height = 212
|
||||
Top = 0
|
||||
Width = 335
|
||||
Align = alClient
|
||||
Font.Height = -13
|
||||
Font.Name = 'Courier New'
|
||||
Font.Pitch = fpFixed
|
||||
Font.Quality = fqNonAntialiased
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
TabOrder = 0
|
||||
OnExit = BMDefValSynEditExit
|
||||
Gutter.Width = 57
|
||||
Gutter.MouseActions = <
|
||||
item
|
||||
Shift = []
|
||||
ShiftMask = []
|
||||
Button = mbLeft
|
||||
ClickCount = ccAny
|
||||
ClickDir = cdDown
|
||||
Command = 13
|
||||
MoveCaret = False
|
||||
Option = 0
|
||||
Priority = 0
|
||||
end
|
||||
item
|
||||
Shift = []
|
||||
ShiftMask = []
|
||||
Button = mbRight
|
||||
ClickCount = ccSingle
|
||||
ClickDir = cdUp
|
||||
Command = 12
|
||||
MoveCaret = False
|
||||
Option = 0
|
||||
Priority = 0
|
||||
end>
|
||||
Highlighter = BMDefValSynPasSyn
|
||||
Keystrokes = <
|
||||
item
|
||||
Command = ecUp
|
||||
ShortCut = 38
|
||||
end
|
||||
item
|
||||
Command = ecSelUp
|
||||
ShortCut = 8230
|
||||
end
|
||||
item
|
||||
Command = ecScrollUp
|
||||
ShortCut = 16422
|
||||
end
|
||||
item
|
||||
Command = ecDown
|
||||
ShortCut = 40
|
||||
end
|
||||
item
|
||||
Command = ecSelDown
|
||||
ShortCut = 8232
|
||||
end
|
||||
item
|
||||
Command = ecScrollDown
|
||||
ShortCut = 16424
|
||||
end
|
||||
item
|
||||
Command = ecLeft
|
||||
ShortCut = 37
|
||||
end
|
||||
item
|
||||
Command = ecSelLeft
|
||||
ShortCut = 8229
|
||||
end
|
||||
item
|
||||
Command = ecWordLeft
|
||||
ShortCut = 16421
|
||||
end
|
||||
item
|
||||
Command = ecSelWordLeft
|
||||
ShortCut = 24613
|
||||
end
|
||||
item
|
||||
Command = ecRight
|
||||
ShortCut = 39
|
||||
end
|
||||
item
|
||||
Command = ecSelRight
|
||||
ShortCut = 8231
|
||||
end
|
||||
item
|
||||
Command = ecWordRight
|
||||
ShortCut = 16423
|
||||
end
|
||||
item
|
||||
Command = ecSelWordRight
|
||||
ShortCut = 24615
|
||||
end
|
||||
item
|
||||
Command = ecPageDown
|
||||
ShortCut = 34
|
||||
end
|
||||
item
|
||||
Command = ecSelPageDown
|
||||
ShortCut = 8226
|
||||
end
|
||||
item
|
||||
Command = ecPageBottom
|
||||
ShortCut = 16418
|
||||
end
|
||||
item
|
||||
Command = ecSelPageBottom
|
||||
ShortCut = 24610
|
||||
end
|
||||
item
|
||||
Command = ecPageUp
|
||||
ShortCut = 33
|
||||
end
|
||||
item
|
||||
Command = ecSelPageUp
|
||||
ShortCut = 8225
|
||||
end
|
||||
item
|
||||
Command = ecPageTop
|
||||
ShortCut = 16417
|
||||
end
|
||||
item
|
||||
Command = ecSelPageTop
|
||||
ShortCut = 24609
|
||||
end
|
||||
item
|
||||
Command = ecLineStart
|
||||
ShortCut = 36
|
||||
end
|
||||
item
|
||||
Command = ecSelLineStart
|
||||
ShortCut = 8228
|
||||
end
|
||||
item
|
||||
Command = ecEditorTop
|
||||
ShortCut = 16420
|
||||
end
|
||||
item
|
||||
Command = ecSelEditorTop
|
||||
ShortCut = 24612
|
||||
end
|
||||
item
|
||||
Command = ecLineEnd
|
||||
ShortCut = 35
|
||||
end
|
||||
item
|
||||
Command = ecSelLineEnd
|
||||
ShortCut = 8227
|
||||
end
|
||||
item
|
||||
Command = ecEditorBottom
|
||||
ShortCut = 16419
|
||||
end
|
||||
item
|
||||
Command = ecSelEditorBottom
|
||||
ShortCut = 24611
|
||||
end
|
||||
item
|
||||
Command = ecToggleMode
|
||||
ShortCut = 45
|
||||
end
|
||||
item
|
||||
Command = ecCopy
|
||||
ShortCut = 16429
|
||||
end
|
||||
item
|
||||
Command = ecPaste
|
||||
ShortCut = 8237
|
||||
end
|
||||
item
|
||||
Command = ecDeleteChar
|
||||
ShortCut = 46
|
||||
end
|
||||
item
|
||||
Command = ecCut
|
||||
ShortCut = 8238
|
||||
end
|
||||
item
|
||||
Command = ecDeleteLastChar
|
||||
ShortCut = 8
|
||||
end
|
||||
item
|
||||
Command = ecDeleteLastChar
|
||||
ShortCut = 8200
|
||||
end
|
||||
item
|
||||
Command = ecDeleteLastWord
|
||||
ShortCut = 16392
|
||||
end
|
||||
item
|
||||
Command = ecUndo
|
||||
ShortCut = 32776
|
||||
end
|
||||
item
|
||||
Command = ecRedo
|
||||
ShortCut = 40968
|
||||
end
|
||||
item
|
||||
Command = ecLineBreak
|
||||
ShortCut = 13
|
||||
end
|
||||
item
|
||||
Command = ecSelectAll
|
||||
ShortCut = 16449
|
||||
end
|
||||
item
|
||||
Command = ecCopy
|
||||
ShortCut = 16451
|
||||
end
|
||||
item
|
||||
Command = ecBlockIndent
|
||||
ShortCut = 24649
|
||||
end
|
||||
item
|
||||
Command = ecLineBreak
|
||||
ShortCut = 16461
|
||||
end
|
||||
item
|
||||
Command = ecInsertLine
|
||||
ShortCut = 16462
|
||||
end
|
||||
item
|
||||
Command = ecDeleteWord
|
||||
ShortCut = 16468
|
||||
end
|
||||
item
|
||||
Command = ecBlockUnindent
|
||||
ShortCut = 24661
|
||||
end
|
||||
item
|
||||
Command = ecPaste
|
||||
ShortCut = 16470
|
||||
end
|
||||
item
|
||||
Command = ecCut
|
||||
ShortCut = 16472
|
||||
end
|
||||
item
|
||||
Command = ecDeleteLine
|
||||
ShortCut = 16473
|
||||
end
|
||||
item
|
||||
Command = ecDeleteEOL
|
||||
ShortCut = 24665
|
||||
end
|
||||
item
|
||||
Command = ecUndo
|
||||
ShortCut = 16474
|
||||
end
|
||||
item
|
||||
Command = ecRedo
|
||||
ShortCut = 24666
|
||||
end
|
||||
item
|
||||
Command = ecGotoMarker0
|
||||
ShortCut = 16432
|
||||
end
|
||||
item
|
||||
Command = ecGotoMarker1
|
||||
ShortCut = 16433
|
||||
end
|
||||
item
|
||||
Command = ecGotoMarker2
|
||||
ShortCut = 16434
|
||||
end
|
||||
item
|
||||
Command = ecGotoMarker3
|
||||
ShortCut = 16435
|
||||
end
|
||||
item
|
||||
Command = ecGotoMarker4
|
||||
ShortCut = 16436
|
||||
end
|
||||
item
|
||||
Command = ecGotoMarker5
|
||||
ShortCut = 16437
|
||||
end
|
||||
item
|
||||
Command = ecGotoMarker6
|
||||
ShortCut = 16438
|
||||
end
|
||||
item
|
||||
Command = ecGotoMarker7
|
||||
ShortCut = 16439
|
||||
end
|
||||
item
|
||||
Command = ecGotoMarker8
|
||||
ShortCut = 16440
|
||||
end
|
||||
item
|
||||
Command = ecGotoMarker9
|
||||
ShortCut = 16441
|
||||
end
|
||||
item
|
||||
Command = ecSetMarker0
|
||||
ShortCut = 24624
|
||||
end
|
||||
item
|
||||
Command = ecSetMarker1
|
||||
ShortCut = 24625
|
||||
end
|
||||
item
|
||||
Command = ecSetMarker2
|
||||
ShortCut = 24626
|
||||
end
|
||||
item
|
||||
Command = ecSetMarker3
|
||||
ShortCut = 24627
|
||||
end
|
||||
item
|
||||
Command = ecSetMarker4
|
||||
ShortCut = 24628
|
||||
end
|
||||
item
|
||||
Command = ecSetMarker5
|
||||
ShortCut = 24629
|
||||
end
|
||||
item
|
||||
Command = ecSetMarker6
|
||||
ShortCut = 24630
|
||||
end
|
||||
item
|
||||
Command = ecSetMarker7
|
||||
ShortCut = 24631
|
||||
end
|
||||
item
|
||||
Command = ecSetMarker8
|
||||
ShortCut = 24632
|
||||
end
|
||||
item
|
||||
Command = ecSetMarker9
|
||||
ShortCut = 24633
|
||||
end
|
||||
item
|
||||
Command = EcFoldLevel1
|
||||
ShortCut = 41009
|
||||
end
|
||||
item
|
||||
Command = EcFoldLevel2
|
||||
ShortCut = 41010
|
||||
end
|
||||
item
|
||||
Command = EcFoldLevel1
|
||||
ShortCut = 41011
|
||||
end
|
||||
item
|
||||
Command = EcFoldLevel1
|
||||
ShortCut = 41012
|
||||
end
|
||||
item
|
||||
Command = EcFoldLevel1
|
||||
ShortCut = 41013
|
||||
end
|
||||
item
|
||||
Command = EcFoldLevel6
|
||||
ShortCut = 41014
|
||||
end
|
||||
item
|
||||
Command = EcFoldLevel7
|
||||
ShortCut = 41015
|
||||
end
|
||||
item
|
||||
Command = EcFoldLevel8
|
||||
ShortCut = 41016
|
||||
end
|
||||
item
|
||||
Command = EcFoldLevel9
|
||||
ShortCut = 41017
|
||||
end
|
||||
item
|
||||
Command = EcFoldLevel0
|
||||
ShortCut = 41008
|
||||
end
|
||||
item
|
||||
Command = EcFoldCurrent
|
||||
ShortCut = 41005
|
||||
end
|
||||
item
|
||||
Command = EcUnFoldCurrent
|
||||
ShortCut = 41003
|
||||
end
|
||||
item
|
||||
Command = EcToggleMarkupWord
|
||||
ShortCut = 32845
|
||||
end
|
||||
item
|
||||
Command = ecNormalSelect
|
||||
ShortCut = 24654
|
||||
end
|
||||
item
|
||||
Command = ecColumnSelect
|
||||
ShortCut = 24643
|
||||
end
|
||||
item
|
||||
Command = ecLineSelect
|
||||
ShortCut = 24652
|
||||
end
|
||||
item
|
||||
Command = ecTab
|
||||
ShortCut = 9
|
||||
end
|
||||
item
|
||||
Command = ecShiftTab
|
||||
ShortCut = 8201
|
||||
end
|
||||
item
|
||||
Command = ecMatchBracket
|
||||
ShortCut = 24642
|
||||
end
|
||||
item
|
||||
Command = ecColSelUp
|
||||
ShortCut = 40998
|
||||
end
|
||||
item
|
||||
Command = ecColSelDown
|
||||
ShortCut = 41000
|
||||
end
|
||||
item
|
||||
Command = ecColSelLeft
|
||||
ShortCut = 40997
|
||||
end
|
||||
item
|
||||
Command = ecColSelRight
|
||||
ShortCut = 40999
|
||||
end
|
||||
item
|
||||
Command = ecColSelPageDown
|
||||
ShortCut = 40994
|
||||
end
|
||||
item
|
||||
Command = ecColSelPageBottom
|
||||
ShortCut = 57378
|
||||
end
|
||||
item
|
||||
Command = ecColSelPageUp
|
||||
ShortCut = 40993
|
||||
end
|
||||
item
|
||||
Command = ecColSelPageTop
|
||||
ShortCut = 57377
|
||||
end
|
||||
item
|
||||
Command = ecColSelLineStart
|
||||
ShortCut = 40996
|
||||
end
|
||||
item
|
||||
Command = ecColSelLineEnd
|
||||
ShortCut = 40995
|
||||
end
|
||||
item
|
||||
Command = ecColSelEditorTop
|
||||
ShortCut = 57380
|
||||
end
|
||||
item
|
||||
Command = ecColSelEditorBottom
|
||||
ShortCut = 57379
|
||||
end>
|
||||
MouseActions = <
|
||||
item
|
||||
Shift = []
|
||||
ShiftMask = [ssShift, ssAlt]
|
||||
Button = mbLeft
|
||||
ClickCount = ccSingle
|
||||
ClickDir = cdDown
|
||||
Command = 1
|
||||
MoveCaret = True
|
||||
Option = 0
|
||||
Priority = 0
|
||||
end
|
||||
item
|
||||
Shift = [ssShift]
|
||||
ShiftMask = [ssShift, ssAlt]
|
||||
Button = mbLeft
|
||||
ClickCount = ccSingle
|
||||
ClickDir = cdDown
|
||||
Command = 1
|
||||
MoveCaret = True
|
||||
Option = 1
|
||||
Priority = 0
|
||||
end
|
||||
item
|
||||
Shift = [ssAlt]
|
||||
ShiftMask = [ssShift, ssAlt]
|
||||
Button = mbLeft
|
||||
ClickCount = ccSingle
|
||||
ClickDir = cdDown
|
||||
Command = 3
|
||||
MoveCaret = True
|
||||
Option = 0
|
||||
Priority = 0
|
||||
end
|
||||
item
|
||||
Shift = [ssShift, ssAlt]
|
||||
ShiftMask = [ssShift, ssAlt]
|
||||
Button = mbLeft
|
||||
ClickCount = ccSingle
|
||||
ClickDir = cdDown
|
||||
Command = 3
|
||||
MoveCaret = True
|
||||
Option = 1
|
||||
Priority = 0
|
||||
end
|
||||
item
|
||||
Shift = []
|
||||
ShiftMask = []
|
||||
Button = mbRight
|
||||
ClickCount = ccSingle
|
||||
ClickDir = cdUp
|
||||
Command = 12
|
||||
MoveCaret = False
|
||||
Option = 0
|
||||
Priority = 0
|
||||
end
|
||||
item
|
||||
Shift = []
|
||||
ShiftMask = []
|
||||
Button = mbLeft
|
||||
ClickCount = ccDouble
|
||||
ClickDir = cdDown
|
||||
Command = 6
|
||||
MoveCaret = True
|
||||
Option = 0
|
||||
Priority = 0
|
||||
end
|
||||
item
|
||||
Shift = []
|
||||
ShiftMask = []
|
||||
Button = mbLeft
|
||||
ClickCount = ccTriple
|
||||
ClickDir = cdDown
|
||||
Command = 7
|
||||
MoveCaret = True
|
||||
Option = 0
|
||||
Priority = 0
|
||||
end
|
||||
item
|
||||
Shift = []
|
||||
ShiftMask = []
|
||||
Button = mbLeft
|
||||
ClickCount = ccQuad
|
||||
ClickDir = cdDown
|
||||
Command = 8
|
||||
MoveCaret = True
|
||||
Option = 0
|
||||
Priority = 0
|
||||
end
|
||||
item
|
||||
Shift = []
|
||||
ShiftMask = []
|
||||
Button = mbMiddle
|
||||
ClickCount = ccSingle
|
||||
ClickDir = cdDown
|
||||
Command = 10
|
||||
MoveCaret = True
|
||||
Option = 0
|
||||
Priority = 0
|
||||
end
|
||||
item
|
||||
Shift = [ssCtrl]
|
||||
ShiftMask = [ssShift, ssAlt, ssCtrl]
|
||||
Button = mbLeft
|
||||
ClickCount = ccSingle
|
||||
ClickDir = cdUp
|
||||
Command = 11
|
||||
MoveCaret = False
|
||||
Option = 0
|
||||
Priority = 0
|
||||
end>
|
||||
MouseSelActions = <
|
||||
item
|
||||
Shift = []
|
||||
ShiftMask = []
|
||||
Button = mbLeft
|
||||
ClickCount = ccSingle
|
||||
ClickDir = cdDown
|
||||
Command = 9
|
||||
MoveCaret = False
|
||||
Option = 0
|
||||
Priority = 0
|
||||
end>
|
||||
Lines.Strings = (
|
||||
'BMDefValSynEdit'
|
||||
)
|
||||
BracketHighlightStyle = sbhsBoth
|
||||
inline SynGutterPartList1: TSynGutterPartList
|
||||
object SynGutterMarks1: TSynGutterMarks
|
||||
Width = 23
|
||||
end
|
||||
object SynGutterLineNumber1: TSynGutterLineNumber
|
||||
Width = 17
|
||||
MouseActions = <>
|
||||
MarkupInfo.Background = clBtnFace
|
||||
MarkupInfo.Foreground = clNone
|
||||
DigitCount = 2
|
||||
ShowOnlyLineNumbersMultiplesOf = 1
|
||||
ZeroStart = False
|
||||
LeadingZeros = False
|
||||
end
|
||||
object SynGutterChanges1: TSynGutterChanges
|
||||
Width = 4
|
||||
ModifiedColor = 59900
|
||||
SavedColor = clGreen
|
||||
end
|
||||
object SynGutterSeparator1: TSynGutterSeparator
|
||||
Width = 2
|
||||
end
|
||||
object SynGutterCodeFolding1: TSynGutterCodeFolding
|
||||
MouseActions = <
|
||||
item
|
||||
Shift = []
|
||||
ShiftMask = []
|
||||
Button = mbRight
|
||||
ClickCount = ccSingle
|
||||
ClickDir = cdUp
|
||||
Command = 16
|
||||
MoveCaret = False
|
||||
Option = 0
|
||||
Priority = 0
|
||||
end
|
||||
item
|
||||
Shift = []
|
||||
ShiftMask = [ssShift]
|
||||
Button = mbMiddle
|
||||
ClickCount = ccAny
|
||||
ClickDir = cdDown
|
||||
Command = 14
|
||||
MoveCaret = False
|
||||
Option = 0
|
||||
Priority = 0
|
||||
end
|
||||
item
|
||||
Shift = [ssShift]
|
||||
ShiftMask = [ssShift]
|
||||
Button = mbMiddle
|
||||
ClickCount = ccAny
|
||||
ClickDir = cdDown
|
||||
Command = 14
|
||||
MoveCaret = False
|
||||
Option = 1
|
||||
Priority = 0
|
||||
end
|
||||
item
|
||||
Shift = []
|
||||
ShiftMask = []
|
||||
Button = mbLeft
|
||||
ClickCount = ccAny
|
||||
ClickDir = cdDown
|
||||
Command = 0
|
||||
MoveCaret = False
|
||||
Option = 0
|
||||
Priority = 0
|
||||
end>
|
||||
MarkupInfo.Background = clNone
|
||||
MarkupInfo.Foreground = clGray
|
||||
MouseActionsExpanded = <
|
||||
item
|
||||
Shift = []
|
||||
ShiftMask = []
|
||||
Button = mbLeft
|
||||
ClickCount = ccAny
|
||||
ClickDir = cdDown
|
||||
Command = 14
|
||||
MoveCaret = False
|
||||
Option = 0
|
||||
Priority = 0
|
||||
end>
|
||||
MouseActionsCollapsed = <
|
||||
item
|
||||
Shift = [ssCtrl]
|
||||
ShiftMask = [ssCtrl]
|
||||
Button = mbLeft
|
||||
ClickCount = ccAny
|
||||
ClickDir = cdDown
|
||||
Command = 15
|
||||
MoveCaret = False
|
||||
Option = 0
|
||||
Priority = 0
|
||||
end
|
||||
item
|
||||
Shift = []
|
||||
ShiftMask = [ssCtrl]
|
||||
Button = mbLeft
|
||||
ClickCount = ccAny
|
||||
ClickDir = cdDown
|
||||
Command = 15
|
||||
MoveCaret = False
|
||||
Option = 1
|
||||
Priority = 0
|
||||
end>
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
object Splitter1: TSplitter
|
||||
Left = 230
|
||||
Height = 233
|
||||
Top = 0
|
||||
Width = 5
|
||||
end
|
||||
object BuildMacrosTVPopupMenu: TPopupMenu
|
||||
OnPopup = BuildMacrosTVPopupMenuPopup
|
||||
left = 99
|
||||
top = 77
|
||||
end
|
||||
object BMDefValSynPasSyn: TSynPasSyn
|
||||
Enabled = False
|
||||
CompilerMode = pcmDelphi
|
||||
NestedComments = False
|
||||
left = 360
|
||||
top = 52
|
||||
end
|
||||
end
|
||||
|
@ -24,33 +24,34 @@ unit Compiler_BuildMacro_Options;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LCLProc, FileUtil, Controls, Forms, StdCtrls,
|
||||
Grids, Buttons, ExtCtrls, Dialogs, ComCtrls, Menus, AvgLvlTree,
|
||||
IDEImagesIntf, ProjectIntf, PackageIntf, CompilerOptions,
|
||||
Compiler_CondTree, LazarusIDEStrConsts, CompOptsModes, PackageDefs;
|
||||
Classes, SysUtils, LCLProc, FileUtil, Controls, Forms, StdCtrls, Grids,
|
||||
Buttons, ExtCtrls, Dialogs, ComCtrls, Menus, AvgLvlTree, IDEImagesIntf,
|
||||
ProjectIntf, PackageIntf, CompilerOptions, Compiler_CondTree,
|
||||
LazarusIDEStrConsts, CompOptsModes, PackageDefs, SynEdit, SynHighlighterPas;
|
||||
|
||||
type
|
||||
TCBMNodeType = (
|
||||
cbmntNone,
|
||||
cbmntBuildMacro,
|
||||
cbmntValues,
|
||||
cbmntValue
|
||||
);
|
||||
|
||||
{ TCompOptBuildMacrosFrame }
|
||||
|
||||
TCompOptBuildMacrosFrame = class(TFrame)
|
||||
BMDefValSynEdit: TSynEdit;
|
||||
BMDefValSynPasSyn: TSynPasSyn;
|
||||
BuildMacroDefValGroupBox: TGroupBox;
|
||||
BuildMacrosGroupBox: TGroupBox;
|
||||
BuildMacrosTreeView: TTreeView;
|
||||
BuildMacrosTVPopupMenu: TPopupMenu;
|
||||
Splitter1: TSplitter;
|
||||
procedure BMDefValSynEditExit(Sender: TObject);
|
||||
procedure BuildMacrosTreeViewEdited(Sender: TObject; Node: TTreeNode;
|
||||
var S: string);
|
||||
procedure BuildMacrosTreeViewEditing(Sender: TObject; Node: TTreeNode;
|
||||
var AllowEdit: Boolean);
|
||||
procedure BuildMacrosTreeViewKeyDown(Sender: TObject; var Key: Word;
|
||||
Shift: TShiftState);
|
||||
procedure BuildMacrosTreeViewStartDrag(Sender: TObject;
|
||||
var DragObject: TDragObject);
|
||||
procedure BuildMacrosTreeViewSelectionChanged(Sender: TObject);
|
||||
procedure BuildMacrosTVPopupMenuPopup(Sender: TObject);
|
||||
procedure DeleteBuildMacroClick(Sender: TObject);
|
||||
procedure NewBuildMacroClick(Sender: TObject);
|
||||
@ -59,21 +60,19 @@ type
|
||||
private
|
||||
FBuildMacros: TIDEBuildMacros;
|
||||
fVarImgID: LongInt;
|
||||
fValuesImgID: LongInt;
|
||||
fValueImgID: LongInt;
|
||||
fDefValueImgID: LongInt;
|
||||
FEditors: TFPList;// list of TCompOptsExprEditor
|
||||
procedure SetBuildMacros(const AValue: TIDEBuildMacros);
|
||||
procedure RebuildTreeView;
|
||||
procedure TreeViewAddBuildMacro(aBuildMacro: TLazBuildMacro);
|
||||
function TreeViewAddBuildMacro(aBuildMacro: TLazBuildMacro): TTreeNode;
|
||||
procedure TreeViewAddValue(ValuesTVNode: TTreeNode; aValue: string);
|
||||
function GetNodeInfo(Node: TTreeNode; out BuildProperty: TLazBuildMacro): TCBMNodeType;
|
||||
function GetNodeInfo(Node: TTreeNode; out BuildMacro: TLazBuildMacro): TCBMNodeType;
|
||||
function GetSelectedNode(out aBuildMacro: TLazBuildMacro;
|
||||
out NodeType: TCBMNodeType): TTreeNode;
|
||||
function GetBuildMacroTVNode(aBuildMacro: TLazBuildMacro): TTreeNode;
|
||||
function GetValuesTVNode(aBuildMacro: TLazBuildMacro): TTreeNode;
|
||||
procedure FreeEditors;
|
||||
function GetMacroNamePrefix: string;
|
||||
procedure UpdateDefaultValueControls;
|
||||
procedure SaveDefaultValue;
|
||||
public
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
@ -90,34 +89,43 @@ procedure TCompOptBuildMacrosFrame.NewBuildMacroClick(Sender: TObject);
|
||||
var
|
||||
NewIdentifier: String;
|
||||
NewBuildMacro: TLazBuildMacro;
|
||||
i: Integer;
|
||||
TVNode: TTreeNode;
|
||||
begin
|
||||
NewIdentifier:=GetMacroNamePrefix+IntToStr(BuildMacros.Count+1);
|
||||
i:=1;
|
||||
repeat
|
||||
NewIdentifier:=GetMacroNamePrefix+IntToStr(BuildMacros.Count+1);
|
||||
if BuildMacros.IndexOfIdentifier(NewIdentifier)<0 then break;
|
||||
inc(i);
|
||||
until false;
|
||||
NewBuildMacro:=BuildMacros.Add(NewIdentifier);
|
||||
// add to TreeView
|
||||
BuildMacrosTreeView.BeginUpdate;
|
||||
TreeViewAddBuildMacro(NewBuildMacro);
|
||||
TVNode:=TreeViewAddBuildMacro(NewBuildMacro);
|
||||
BuildMacrosTreeView.Selected:=TVNode;
|
||||
BuildMacrosTreeView.EndUpdate;
|
||||
UpdateDefaultValueControls;
|
||||
end;
|
||||
|
||||
procedure TCompOptBuildMacrosFrame.NewValueClick(Sender: TObject);
|
||||
var
|
||||
BuildProperty: TLazBuildMacro;
|
||||
BuildMacro: TLazBuildMacro;
|
||||
NodeType: TCBMNodeType;
|
||||
i: Integer;
|
||||
NewValueStr: String;
|
||||
ValuesTVNode: TTreeNode;
|
||||
begin
|
||||
GetSelectedNode(BuildProperty,NodeType);
|
||||
if BuildProperty=nil then exit;
|
||||
GetSelectedNode(BuildMacro,NodeType);
|
||||
if BuildMacro=nil then exit;
|
||||
i:=1;
|
||||
repeat
|
||||
NewValueStr:=Format(lisValue2, [IntToStr(i)]);
|
||||
if BuildProperty.Values.IndexOf(NewValueStr)<0 then break;
|
||||
if BuildMacro.Values.IndexOf(NewValueStr)<0 then break;
|
||||
inc(i);
|
||||
until false;
|
||||
BuildProperty.Values.Add(NewValueStr);
|
||||
BuildMacro.Values.Add(NewValueStr);
|
||||
BuildMacrosTreeView.BeginUpdate;
|
||||
ValuesTVNode:=GetValuesTVNode(BuildProperty);
|
||||
ValuesTVNode:=GetBuildMacroTVNode(BuildMacro);
|
||||
TreeViewAddValue(ValuesTVNode,NewValueStr);
|
||||
ValuesTVNode.Expand(true);
|
||||
BuildMacrosTreeView.EndUpdate;
|
||||
@ -191,7 +199,7 @@ begin
|
||||
BuildMacrosTVPopupMenu.Items.Clear;
|
||||
GetSelectedNode(aBuildMacro,NodeType);
|
||||
|
||||
if NodeType in [cbmntBuildMacro,cbmntValues,cbmntValue] then
|
||||
if NodeType in [cbmntBuildMacro,cbmntValue] then
|
||||
Add('New value',@NewValueClick);
|
||||
if NodeType in [cbmntValue] then
|
||||
Add('Delete value ...',@DeleteValueClick);
|
||||
@ -211,75 +219,75 @@ begin
|
||||
AllowEdit:=NodeType in [cbmntBuildMacro,cbmntValue];
|
||||
end;
|
||||
|
||||
procedure TCompOptBuildMacrosFrame.BuildMacrosTreeViewKeyDown(Sender: TObject;
|
||||
var Key: Word; Shift: TShiftState);
|
||||
procedure TCompOptBuildMacrosFrame.BuildMacrosTreeViewSelectionChanged(
|
||||
Sender: TObject);
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
procedure TCompOptBuildMacrosFrame.BuildMacrosTreeViewStartDrag(Sender: TObject;
|
||||
var DragObject: TDragObject);
|
||||
begin
|
||||
|
||||
UpdateDefaultValueControls;
|
||||
end;
|
||||
|
||||
procedure TCompOptBuildMacrosFrame.BuildMacrosTreeViewEdited(Sender: TObject;
|
||||
Node: TTreeNode; var S: string);
|
||||
var
|
||||
BuildProperty: TLazBuildMacro;
|
||||
BuildMacro: TLazBuildMacro;
|
||||
NodeType: TCBMNodeType;
|
||||
ConflictBuildProperty: TIDEBuildMacro;
|
||||
Index: LongInt;
|
||||
begin
|
||||
NodeType:=GetNodeInfo(Node,BuildProperty);
|
||||
NodeType:=GetNodeInfo(Node,BuildMacro);
|
||||
case NodeType of
|
||||
|
||||
cbmntBuildMacro:
|
||||
if S<>BuildProperty.Identifier then begin
|
||||
if S<>BuildMacro.Identifier then begin
|
||||
// rename build macro
|
||||
if (S='') or (not IsValidIdent(S)) then begin
|
||||
MessageDlg(lisCCOErrorCaption,
|
||||
Format(lisInvalidBuildMacroTheBuildMacroMustBeAPascalIdentifie, ['"',
|
||||
S, '"']),
|
||||
mtError,[mbCancel],0);
|
||||
S:=BuildProperty.Identifier;
|
||||
S:=BuildMacro.Identifier;
|
||||
exit;
|
||||
end;
|
||||
ConflictBuildProperty:=BuildMacros.VarWithIdentifier(S);
|
||||
if (ConflictBuildProperty<>nil) and (ConflictBuildProperty<>BuildProperty) then
|
||||
if (ConflictBuildProperty<>nil) and (ConflictBuildProperty<>BuildMacro) then
|
||||
begin
|
||||
MessageDlg(lisCCOErrorCaption,
|
||||
Format(lisThereIsAlreadyABuildMacroWithTheName, ['"', S, '"']),
|
||||
mtError,[mbCancel],0);
|
||||
S:=BuildProperty.Identifier;
|
||||
S:=BuildMacro.Identifier;
|
||||
exit;
|
||||
end;
|
||||
BuildProperty.Identifier:=S;
|
||||
BuildMacro.Identifier:=S;
|
||||
end;
|
||||
|
||||
cbmntValue:
|
||||
begin
|
||||
Index:=Node.Index;
|
||||
Index:=BuildProperty.Values.IndexOf(S);
|
||||
Index:=BuildMacro.Values.IndexOf(S);
|
||||
if (Index>=0) and (Index<>Node.Index) then begin
|
||||
MessageDlg(lisCCOErrorCaption,
|
||||
Format(lisDuplicateFoundOfValue, ['"', S, '"']),
|
||||
mtError,[mbCancel],0);
|
||||
S:=BuildProperty.Values[Node.Index];
|
||||
S:=BuildMacro.Values[Node.Index];
|
||||
exit;
|
||||
end;
|
||||
BuildProperty.Values[Node.Index]:=S;
|
||||
BuildMacro.Values[Node.Index]:=S;
|
||||
end;
|
||||
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCompOptBuildMacrosFrame.BMDefValSynEditExit(Sender: TObject);
|
||||
begin
|
||||
SaveDefaultValue;
|
||||
end;
|
||||
|
||||
procedure TCompOptBuildMacrosFrame.SetBuildMacros(
|
||||
const AValue: TIDEBuildMacros);
|
||||
begin
|
||||
if FBuildMacros=AValue then exit;
|
||||
FBuildMacros:=AValue;
|
||||
RebuildTreeView;
|
||||
UpdateDefaultValueControls;
|
||||
end;
|
||||
|
||||
procedure TCompOptBuildMacrosFrame.RebuildTreeView;
|
||||
@ -288,7 +296,6 @@ var
|
||||
begin
|
||||
BuildMacrosTreeView.BeginUpdate;
|
||||
BuildMacrosTreeView.Items.Clear;
|
||||
FreeEditors;
|
||||
if BuildMacros<>nil then begin
|
||||
// first level: build macros
|
||||
for i:=0 to BuildMacros.Count-1 do
|
||||
@ -297,31 +304,25 @@ begin
|
||||
BuildMacrosTreeView.EndUpdate;
|
||||
end;
|
||||
|
||||
procedure TCompOptBuildMacrosFrame.TreeViewAddBuildMacro(
|
||||
aBuildMacro: TLazBuildMacro);
|
||||
function TCompOptBuildMacrosFrame.TreeViewAddBuildMacro(
|
||||
aBuildMacro: TLazBuildMacro): TTreeNode;
|
||||
var
|
||||
TVNode: TTreeNode;
|
||||
ValuesTVNode: TTreeNode;
|
||||
Values: TStrings;
|
||||
i: Integer;
|
||||
begin
|
||||
// create node for the build macro
|
||||
TVNode:=BuildMacrosTreeView.Items.AddObject(nil,aBuildMacro.Identifier,aBuildMacro);
|
||||
TVNode.ImageIndex:=fVarImgID;
|
||||
TVNode.SelectedIndex:=TVNode.ImageIndex;
|
||||
Result:=BuildMacrosTreeView.Items.AddObject(nil,aBuildMacro.Identifier,aBuildMacro);
|
||||
Result.ImageIndex:=fVarImgID;
|
||||
Result.SelectedIndex:=Result.ImageIndex;
|
||||
// second level
|
||||
begin
|
||||
// parent node for values
|
||||
ValuesTVNode:=BuildMacrosTreeView.Items.AddChild(TVNode, lisValues);
|
||||
ValuesTVNode.ImageIndex:=fValuesImgID;
|
||||
ValuesTVNode.SelectedIndex:=ValuesTVNode.ImageIndex;
|
||||
// a node for each value
|
||||
Values:=aBuildMacro.Values;
|
||||
for i:=0 to Values.Count-1 do
|
||||
TreeViewAddValue(ValuesTVNode,Values[i]);
|
||||
TreeViewAddValue(Result,Values[i]);
|
||||
end;
|
||||
//DebugLn(['TCompOptBuildMacrosFrame.TreeViewAddBuildMacro ',TVNode.Text]);
|
||||
TVNode.Expand(true);
|
||||
Result.Expand(true);
|
||||
end;
|
||||
|
||||
procedure TCompOptBuildMacrosFrame.TreeViewAddValue(ValuesTVNode: TTreeNode;
|
||||
@ -335,7 +336,7 @@ begin
|
||||
end;
|
||||
|
||||
function TCompOptBuildMacrosFrame.GetNodeInfo(Node: TTreeNode; out
|
||||
BuildProperty: TLazBuildMacro): TCBMNodeType;
|
||||
BuildMacro: TLazBuildMacro): TCBMNodeType;
|
||||
|
||||
function GetNodeType(CurNode: TTreeNode): TCBMNodeType;
|
||||
var
|
||||
@ -344,22 +345,19 @@ function TCompOptBuildMacrosFrame.GetNodeInfo(Node: TTreeNode; out
|
||||
if CurNode=nil then
|
||||
Result:=cbmntNone
|
||||
else if TObject(CurNode.Data) is TLazBuildMacro then begin
|
||||
BuildProperty:=TLazBuildMacro(CurNode.Data);
|
||||
BuildMacro:=TLazBuildMacro(CurNode.Data);
|
||||
Result:=cbmntBuildMacro;
|
||||
end else begin
|
||||
ParentType:=GetNodeType(CurNode.Parent);
|
||||
case ParentType of
|
||||
cbmntBuildMacro:
|
||||
if CurNode.Text=lisValues then
|
||||
Result:=cbmntValues;
|
||||
cbmntValues:
|
||||
Result:=cbmntValue;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
BuildProperty:=nil;
|
||||
BuildMacro:=nil;
|
||||
Result:=GetNodeType(Node);
|
||||
end;
|
||||
|
||||
@ -378,27 +376,6 @@ begin
|
||||
Result:=Result.GetNextSibling;
|
||||
end;
|
||||
|
||||
function TCompOptBuildMacrosFrame.GetValuesTVNode(aBuildMacro: TLazBuildMacro
|
||||
): TTreeNode;
|
||||
var
|
||||
BuildMacroTVNode: TTreeNode;
|
||||
begin
|
||||
BuildMacroTVNode:=GetBuildMacroTVNode(aBuildMacro);
|
||||
if (BuildMacroTVNode<>nil) then
|
||||
Result:=BuildMacroTVNode.GetFirstChild
|
||||
else
|
||||
Result:=nil;
|
||||
end;
|
||||
|
||||
procedure TCompOptBuildMacrosFrame.FreeEditors;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
for i:=0 to FEditors.Count-1 do
|
||||
TObject(FEditors[i]).Free;
|
||||
FEditors.Clear;
|
||||
end;
|
||||
|
||||
function TCompOptBuildMacrosFrame.GetMacroNamePrefix: string;
|
||||
begin
|
||||
Result:='BuildMacro';
|
||||
@ -407,11 +384,40 @@ begin
|
||||
Result:=TPkgCompilerOptions(BuildMacros.Owner).LazPackage.Name+'_macro';
|
||||
end;
|
||||
|
||||
procedure TCompOptBuildMacrosFrame.UpdateDefaultValueControls;
|
||||
var
|
||||
aBuildMacro: TLazBuildMacro;
|
||||
NodeType: TCBMNodeType;
|
||||
begin
|
||||
BuildMacroDefValGroupBox.Caption:='Default value';
|
||||
GetSelectedNode(aBuildMacro,NodeType);
|
||||
if aBuildMacro<>nil then begin
|
||||
BuildMacroDefValGroupBox.Caption:='Default value of macro '+aBuildMacro.Identifier;
|
||||
BuildMacroDefValGroupBox.Enabled:=true;
|
||||
BMDefValSynEdit.Lines.Text:=aBuildMacro.DefaultValue;
|
||||
BMDefValSynEdit.Enabled:=true;
|
||||
end else begin
|
||||
BuildMacroDefValGroupBox.Caption:='Default value of macro (none)';
|
||||
BuildMacroDefValGroupBox.Enabled:=false;
|
||||
BMDefValSynEdit.Lines.Text:='';
|
||||
BMDefValSynEdit.Enabled:=false;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCompOptBuildMacrosFrame.SaveDefaultValue;
|
||||
var
|
||||
BuildMacro: TLazBuildMacro;
|
||||
NodeType: TCBMNodeType;
|
||||
begin
|
||||
GetSelectedNode(BuildMacro,NodeType);
|
||||
if BuildMacro=nil then exit;
|
||||
BuildMacro.DefaultValue:=BMDefValSynEdit.Lines.Text;
|
||||
end;
|
||||
|
||||
constructor TCompOptBuildMacrosFrame.Create(TheOwner: TComponent);
|
||||
begin
|
||||
inherited Create(TheOwner);
|
||||
|
||||
FEditors:=TFPList.Create;
|
||||
BuildMacrosTreeView.Images := IDEImages.Images_24;
|
||||
fVarImgID:=IDEImages.LoadImage(24,'da_define');
|
||||
fValueImgID:=IDEImages.LoadImage(24,'da_define');
|
||||
@ -422,8 +428,6 @@ end;
|
||||
|
||||
destructor TCompOptBuildMacrosFrame.Destroy;
|
||||
begin
|
||||
FreeEditors;
|
||||
FreeAndNil(FEditors);
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
|
@ -639,7 +639,7 @@ type
|
||||
FEditorInfoList: TUnitEditorInfoList;
|
||||
FAutoCreateForms: boolean;
|
||||
FEnableI18NForLFM: boolean;
|
||||
FMacros: TProjectBuildMacros;
|
||||
FMacroValues: TProjectBuildMacros;
|
||||
FTmpAutoCreatedForms: TStrings; // temporary, used to apply auto create forms changes
|
||||
FAutoOpenDesignerFormsDisabled: boolean;
|
||||
FBookmarks: TProjectBookmarkList;
|
||||
@ -939,7 +939,7 @@ type
|
||||
write FLastCompilerFilename;
|
||||
property LastCompilerParams: string read FLastCompilerParams
|
||||
write FLastCompilerParams;
|
||||
property Macros: TProjectBuildMacros read FMacros;
|
||||
property MacroValues: TProjectBuildMacros read FMacroValues;
|
||||
property MainFilename: String read GetMainFilename;
|
||||
property MainProject: boolean read FMainProject write SetMainProject;
|
||||
property MainUnitID: Integer read FMainUnitID write SetMainUnitID;
|
||||
@ -2448,7 +2448,7 @@ begin
|
||||
FRunParameterOptions:=TRunParamsOptions.Create;
|
||||
Title := '';
|
||||
FUnitList := TFPList.Create; // list of TUnitInfo
|
||||
FMacros:=TProjectBuildMacros.Create;
|
||||
FMacroValues:=TProjectBuildMacros.Create;
|
||||
|
||||
FResources := TProjectResources.Create(Self);
|
||||
FResources.OnModified := @EmbeddedObjectModified;
|
||||
@ -2462,7 +2462,7 @@ begin
|
||||
FDefineTemplates.Active := False;
|
||||
FDestroying := True;
|
||||
Clear;
|
||||
FreeAndNil(FMacros);
|
||||
FreeAndNil(FMacroValues);
|
||||
FreeAndNil(FEditorInfoList);
|
||||
FreeThenNil(FResources);
|
||||
FreeThenNil(FBookmarks);
|
||||
@ -2632,8 +2632,8 @@ begin
|
||||
ProjectSessionStorageNames[SessionStorage],
|
||||
ProjectSessionStorageNames[pssInProjectInfo]);
|
||||
|
||||
// save macros
|
||||
Macros.SaveToXMLConfig(xmlconfig,Path+'Macros/');
|
||||
// save MacroValues
|
||||
MacroValues.SaveToXMLConfig(xmlconfig,Path+'MacroValues/');
|
||||
|
||||
// properties
|
||||
xmlconfig.SetDeleteValue(Path+'General/MainUnit/Value', MainUnitID,0);
|
||||
@ -3081,8 +3081,8 @@ begin
|
||||
ProjectSessionStorageNames[pssInProjectInfo]));
|
||||
//DebugLn('TProject.ReadProject SessionStorage=',dbgs(ord(SessionStorage)),' ProjectSessionFile=',ProjectSessionFile);
|
||||
|
||||
// load macros
|
||||
Macros.SaveToXMLConfig(xmlconfig,Path+'Macros/');
|
||||
// load MacroValues
|
||||
MacroValues.SaveToXMLConfig(xmlconfig,Path+'MacroValues/');
|
||||
|
||||
// load properties
|
||||
if FileVersion<9 then NewMainUnitID:=-1 else NewMainUnitID:=0;
|
||||
@ -3413,7 +3413,7 @@ begin
|
||||
UpdateProjectDirectory;
|
||||
FPublishOptions.Clear;
|
||||
Title := '';
|
||||
FMacros.Clear;
|
||||
FMacroValues.Clear;
|
||||
|
||||
Modified := false;
|
||||
SessionModified := false;
|
||||
@ -3527,7 +3527,7 @@ begin
|
||||
PublishOptions.Modified := False;
|
||||
CompilerOptions.Modified := False;
|
||||
Resources.Modified := False;
|
||||
Macros.Modified:=false;
|
||||
MacroValues.Modified:=false;
|
||||
SessionModified := False;
|
||||
end;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user