IDE: build macros: removed default value, will be done in conditionals

git-svn-id: trunk@27090 -
This commit is contained in:
mattias 2010-08-13 12:53:26 +00:00
parent 4525c8beda
commit 14b3de8d23
4 changed files with 55 additions and 749 deletions

View File

@ -36,7 +36,7 @@
values, valuedescriptions, defaultvalue:string,
- IDE build macro: TIDEBuildMacro, load/save to xmlconfig
- BuildMacroChangeStamp:
- changed on used packages
- changed on used packages, IncreaseBuildMacroChangeStamp
- remove TBuildModeGraph
- remove TBuildModeFlag
- remove TBuildMode
@ -70,9 +70,11 @@
default macro values of required packages
- every package/project needs a function to substitute macros
- check local macros (pkgdir, pkgoutdir)
- first check active project values
- then check default values of build macros of used packages
- finally use default global macros
- check active project values
- check default values of build macros of used packages
- check default values of build macros of self
- check conditionals
- use default global macros
- every package/project needs conditionals
- using config script
- conditionals are executed when a path is computed
@ -103,7 +105,7 @@ interface
uses
Classes, SysUtils, FileProcs, FileUtil, InterfaceBase, LCLProc, Forms,
Controls, Laz_XMLCfg, ExprEval, DefineTemplates,
Controls, Laz_XMLCfg, ExprEval, DefineTemplates, CodeToolsCfgScript,
// IDEIntf
ProjectIntf, MacroIntf, IDEExternToolIntf, SrcEditorIntf, IDEOptionsIntf,
// IDE
@ -130,7 +132,6 @@ type
procedure SetDescription(const AValue: string); override;
procedure SetValueDescriptions(const AValue: TStrings); override;
procedure SetValues(const AValue: TStrings); override;
procedure SetDefaultValue(const AValue: string); override;
public
constructor Create;
destructor Destroy; override;
@ -716,6 +717,10 @@ function MergeCustomOptions(const OldOptions, AddOptions: string): string;
function ConvertSearchPathToCmdLine(const switch, paths: String): String;
function ConvertOptionsToCmdLine(const Delim, Switch, OptionStr: string): string;
{
procedure GetBuildMacroValues(Owner: TObject; IncludeSelf: boolean);
}
function LoadXMLCompileReasons(const AConfig: TXMLConfig;
const APath: String; const DefaultReasons: TCompileReasons): TCompileReasons;
procedure SaveXMLCompileReasons(const AConfig: TXMLConfig; const APath: String;
@ -3672,7 +3677,6 @@ end;
procedure TIDEBuildMacro.Assign(Source: TLazBuildMacro);
begin
Identifier:=Source.Identifier;
DefaultValue:=Source.DefaultValue;
Description:=Source.Description;
ValueDescriptions:=Source.ValueDescriptions;
Values:=Source.Values;
@ -3685,7 +3689,6 @@ begin
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;
@ -3724,14 +3727,12 @@ begin
Tool.AddDiff('Description',Description,OtherMode.Description);
Tool.AddStringsDiff('Values',Values,OtherMode.Values);
Tool.AddStringsDiff('ValueDescriptions',ValueDescriptions,OtherMode.ValueDescriptions);
Tool.AddDiff('DefaultValue',DefaultValue,OtherMode.DefaultValue);
end;
procedure TIDEBuildMacro.Assign(Source: TIDEBuildMacro);
begin
Identifier:=Source.Identifier;
Values:=Source.Values;
FDefaultValue:=Source.DefaultValue;
Description:=Source.Description;
ValueDescriptions:=Source.ValueDescriptions;
end;
@ -3744,17 +3745,6 @@ begin
inc(FChangeStamp);
end;
procedure TIDEBuildMacro.SetDefaultValue(const AValue: string);
var
NewValue: String;
begin
NewValue:=ConvertLineEndings(AValue);
if DefaultValue=NewValue then exit;
FDefaultValue:=NewValue;
IncreaseChangeStamp;
IncreaseBuildMacroChangeStamp;
end;
{ TIDEBuildMacros }
function TIDEBuildMacros.GetItems(Index: integer): TLazBuildMacro;

View File

@ -20,710 +20,40 @@ object CompOptBuildMacrosFrame: TCompOptBuildMacrosFrame
ClientHeight = 214
ClientWidth = 330
TabOrder = 0
inline BMDefValSynEdit: TSynEdit
Left = 0
Height = 196
Top = 18
Width = 330
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
object BuildMacroDefaultLabel: TLabel
Left = 0
Left = 6
Height = 18
Top = 0
Width = 330
Top = 72
Width = 318
Align = alTop
BorderSpacing.Top = 15
BorderSpacing.Around = 6
Caption = 'BuildMacroDefaultLabel'
ParentColor = False
end
object BuildMacroDescriptionLabel: TLabel
Left = 6
Height = 18
Top = 6
Width = 318
Align = alTop
BorderSpacing.Left = 6
BorderSpacing.Top = 6
BorderSpacing.Right = 6
Caption = 'BuildMacroDescriptionLabel'
ParentColor = False
end
object BuildMacroDescriptionEdit: TEdit
Left = 6
Height = 27
Top = 24
Width = 318
Align = alTop
BorderSpacing.Left = 6
BorderSpacing.Right = 6
TabOrder = 0
Text = 'BuildMacroDescriptionEdit'
end
end
object Splitter1: TSplitter
Left = 233
@ -752,11 +82,4 @@ object CompOptBuildMacrosFrame: TCompOptBuildMacrosFrame
left = 99
top = 77
end
object BMDefValSynPasSyn: TSynPasSyn
Enabled = False
CompilerMode = pcmDelphi
NestedComments = False
left = 360
top = 52
end
end

View File

@ -43,14 +43,13 @@ type
{ TCompOptBuildMacrosFrame }
TCompOptBuildMacrosFrame = class(TFrame)
BMDefValSynEdit: TSynEdit;
BMDefValSynPasSyn: TSynPasSyn;
BuildMacroDescriptionEdit: TEdit;
BuildMacroSelectedGroupBox: TGroupBox;
BuildMacrosTreeView: TTreeView;
BuildMacrosTVPopupMenu: TPopupMenu;
BuildMacroDefaultLabel: TLabel;
BuildMacroDescriptionLabel: TLabel;
Splitter1: TSplitter;
procedure BMDefValSynEditExit(Sender: TObject);
procedure BuildMacrosTreeViewEdited(Sender: TObject; Node: TTreeNode;
var S: string);
procedure BuildMacrosTreeViewEditing(Sender: TObject; Node: TTreeNode;
@ -66,6 +65,7 @@ type
fVarImgID: LongInt;
fValueImgID: LongInt;
fDefValueImgID: LongInt;
procedure SaveItemProperties;
procedure SetBuildMacros(const AValue: TIDEBuildMacros);
procedure RebuildTreeView;
function TreeViewAddBuildMacro(aBuildMacro: TLazBuildMacro): TTreeNode;
@ -75,8 +75,7 @@ type
out NodeType: TCBMNodeType): TTreeNode;
function GetBuildMacroTVNode(aBuildMacro: TLazBuildMacro): TTreeNode;
function GetMacroNamePrefix: string;
procedure UpdateDefaultValueControls;
procedure SaveDefaultValue;
procedure UpdateItemPropertyControls;
public
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
@ -108,7 +107,7 @@ begin
TVNode:=TreeViewAddBuildMacro(NewBuildMacro);
BuildMacrosTreeView.Selected:=TVNode;
BuildMacrosTreeView.EndUpdate;
UpdateDefaultValueControls;
UpdateItemPropertyControls;
end;
procedure TCompOptBuildMacrosFrame.NewValueClick(Sender: TObject);
@ -226,7 +225,7 @@ end;
procedure TCompOptBuildMacrosFrame.BuildMacrosTreeViewSelectionChanged(
Sender: TObject);
begin
UpdateDefaultValueControls;
UpdateItemPropertyControls;
end;
procedure TCompOptBuildMacrosFrame.BuildMacrosTreeViewEdited(Sender: TObject;
@ -280,18 +279,13 @@ begin
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;
UpdateItemPropertyControls;
end;
procedure TCompOptBuildMacrosFrame.RebuildTreeView;
@ -388,7 +382,7 @@ begin
Result:=TPkgCompilerOptions(BuildMacros.Owner).LazPackage.Name+'_macro';
end;
procedure TCompOptBuildMacrosFrame.UpdateDefaultValueControls;
procedure TCompOptBuildMacrosFrame.UpdateItemPropertyControls;
var
aBuildMacro: TLazBuildMacro;
NodeType: TCBMNodeType;
@ -397,24 +391,24 @@ begin
if aBuildMacro<>nil then begin
BuildMacroSelectedGroupBox.Caption:='Macro '+aBuildMacro.Identifier;
BuildMacroSelectedGroupBox.Enabled:=true;
BMDefValSynEdit.Lines.Text:=aBuildMacro.DefaultValue;
BMDefValSynEdit.Enabled:=true;
BuildMacroDescriptionEdit.Enabled:=true;
BuildMacroDescriptionEdit.Text:=aBuildMacro.Description;
end else begin
BuildMacroSelectedGroupBox.Caption:='No macro selected';
BuildMacroSelectedGroupBox.Enabled:=false;
BMDefValSynEdit.Lines.Text:='';
BMDefValSynEdit.Enabled:=false;
BuildMacroDescriptionEdit.Enabled:=false;
BuildMacroDescriptionEdit.Text:='';
end;
end;
procedure TCompOptBuildMacrosFrame.SaveDefaultValue;
procedure TCompOptBuildMacrosFrame.SaveItemProperties;
var
BuildMacro: TLazBuildMacro;
NodeType: TCBMNodeType;
begin
GetSelectedNode(BuildMacro,NodeType);
if BuildMacro=nil then exit;
BuildMacro.DefaultValue:=BMDefValSynEdit.Lines.Text;
BuildMacro.Description:=BuildMacroDescriptionEdit.Text;
end;
constructor TCompOptBuildMacrosFrame.Create(TheOwner: TComponent);
@ -426,7 +420,8 @@ begin
fValueImgID:=IDEImages.LoadImage(24,'da_define');
fDefValueImgID:=IDEImages.LoadImage(24,'da_define');
BuildMacroDefaultLabel.Caption:='Default value or expression:';
BuildMacroDefaultLabel.Caption:='Hint: A default value can be defined in the conditionals.';
BuildMacroDescriptionLabel.Caption:='Description:';
end;
destructor TCompOptBuildMacrosFrame.Destroy;

View File

@ -176,14 +176,12 @@ type
procedure SetDescription(const AValue: string); virtual; abstract;
procedure SetValueDescriptions(const AValue: TStrings); virtual; abstract;
procedure SetValues(const AValue: TStrings); virtual; abstract;
procedure SetDefaultValue(const AValue: string); virtual; abstract;
public
procedure Assign(Source: TLazBuildMacro); virtual; abstract;
property Identifier: string read FIdentifier write SetIdentifier;
property Description: string read FDescription write SetDescription;
property Values: TStrings read FValues write SetValues;
property ValueDescriptions: TStrings read FValueDescriptions write SetValueDescriptions;
property DefaultValue: string read FDefaultValue write SetDefaultValue;
end;
{ TLazBuildMacros