diff --git a/ide/compileroptions.pp b/ide/compileroptions.pp index 9315ab07ac..884a302c7a 100644 --- a/ide/compileroptions.pp +++ b/ide/compileroptions.pp @@ -69,9 +69,9 @@ type constructor Create; destructor Destroy; override; procedure Assign(Source: TLazBuildMacro); override; - procedure LoadFromXMLConfig(AXMLConfig: TXMLConfig; const Path: string; + procedure LoadFromXMLConfig(aXMLConfig: TXMLConfig; const Path: string; DoSwitchPathDelims: boolean); - procedure SaveToXMLConfig(AXMLConfig: TXMLConfig; const Path: string; + procedure SaveToXMLConfig(aXMLConfig: TXMLConfig; const Path: string; UsePathDelim: TPathDelimSwitch); procedure CreateDiff(OtherMode: TLazBuildMacro; Tool: TCompilerDiffTool); procedure Assign(Source: TIDEBuildMacro); @@ -4067,23 +4067,20 @@ constructor TIDEBuildMacro.Create; begin FValues:=TStringList.Create; FValueDescriptions:=TStringList.Create; - FDefaultValue:=TCompOptConditionals.Create(DefaultBuildModeGraph.Evaluator); - FDefaultValue.Root.NodeType:=cocntAddValue; - FDefaultValue.Root.ValueType:=cocvtNone; + FDefaultValue:=''; end; destructor TIDEBuildMacro.Destroy; begin FreeAndNil(FValues); FreeAndNil(FValueDescriptions); - FreeAndNil(FDefaultValue); inherited Destroy; end; procedure TIDEBuildMacro.Assign(Source: TLazBuildMacro); begin FIdentifier:=Source.Identifier; - FDefaultValue.Assign(Source.DefaultValue); + FDefaultValue:=Source.DefaultValue; FDescription:=Source.Description; FValueDescriptions.Assign(Source.ValueDescriptions); FValues.Assign(Source.Values); @@ -4097,8 +4094,7 @@ begin FDescription:=AXMLConfig.GetValue(Path+'Description/Value',''); LoadStringList(AXMLConfig,FValues,Path+'Values/'); LoadStringList(AXMLConfig,FValueDescriptions,Path+'ValueDescriptions/'); - TCompOptConditionals(FDefaultValue).LoadFromXMLConfig(AXMLConfig,Path+'DefaultValue', - DoSwitchPathDelims); + FDefaultValue:=AXMLConfig.GetValue(Path+'Default/Value',''); while ValueDescriptions.Count>Values.Count do ValueDescriptions.Delete(ValueDescriptions.Count-1); @@ -4113,8 +4109,7 @@ begin AXMLConfig.SetDeleteValue(Path+'Description/Value',FDescription,''); SaveStringList(AXMLConfig,FValues,Path+'Values/'); SaveStringList(AXMLConfig,FValueDescriptions,Path+'ValueDescriptions/'); - TCompOptConditionals(FDefaultValue).SaveToXMLConfig(AXMLConfig,Path+'DefaultValue', - UsePathDelim); + AXMLConfig.SetDeleteValue(Path+'DefaultValue/Value',FDefaultValue,''); end; procedure TIDEBuildMacro.CreateDiff(OtherMode: TLazBuildMacro; @@ -4124,28 +4119,22 @@ begin Tool.AddDiff('Description',Description,OtherMode.Description); Tool.AddStringsDiff('Values',Values,OtherMode.Values); Tool.AddStringsDiff('ValueDescriptions',ValueDescriptions,OtherMode.ValueDescriptions); - TCompOptConditionals(DefaultValue).CreateDiff(OtherMode.DefaultValue,Tool); + Tool.AddDiff('DefaultValue',DefaultValue,OtherMode.DefaultValue); end; procedure TIDEBuildMacro.Assign(Source: TIDEBuildMacro); begin Identifier:=Source.Identifier; Values:=Source.Values; - DefaultValue.Assign(Source.DefaultValue); + FDefaultValue:=Source.DefaultValue; Description:=Source.Description; ValueDescriptions:=Source.ValueDescriptions; end; procedure TIDEBuildMacro.SetDefaultValue(const AValue: string); -var - Node: TCompOptCondNode; begin - DefaultValue.Root.ClearNodes; - Node:=TCompOptCondNode.Create(DefaultValue); - Node.NodeType:=cocntSetValue; - Node.ValueType:=cocvtResult; - Node.Value:=AValue; - DefaultValue.Root.AddLast(Node); + if DefaultValue=AValue then exit; + FDefaultValue:=AValue; end; { TIDEBuildMacros } diff --git a/ide/frames/compiler_buildmacro_options.pas b/ide/frames/compiler_buildmacro_options.pas index 04848c3808..13bd2524a8 100644 --- a/ide/frames/compiler_buildmacro_options.pas +++ b/ide/frames/compiler_buildmacro_options.pas @@ -34,9 +34,7 @@ type cbmntNone, cbmntBuildMacro, cbmntValues, - cbmntValue, - cbmntDefaultValue, - cbmntDefaultValueEditor + cbmntValue ); { TCompOptBuildMacrosFrame } @@ -75,7 +73,6 @@ type function GetBuildMacroTVNode(aBuildMacro: TLazBuildMacro): TTreeNode; function GetValuesTVNode(aBuildMacro: TLazBuildMacro): TTreeNode; procedure FreeEditors; - function GetEditor(aBuildMacro: TLazBuildMacro): TCompOptsExprEditor; function GetMacroNamePrefix: string; public constructor Create(TheOwner: TComponent); override; @@ -93,15 +90,9 @@ procedure TCompOptBuildMacrosFrame.NewBuildMacroClick(Sender: TObject); var NewIdentifier: String; NewBuildMacro: TLazBuildMacro; - SetResultNode: TCompOptCondNode; begin NewIdentifier:=DefaultBuildModeGraph.GetUniqueVarName(GetMacroNamePrefix,BuildMacros); NewBuildMacro:=BuildMacros.Add(NewIdentifier); - // add a node - SetResultNode:=TCompOptCondNode.Create(NewBuildMacro.DefaultValue); - SetResultNode.NodeType:=cocntSetValue; - SetResultNode.ValueType:=cocvtResult; - NewBuildMacro.DefaultValue.Root.AddLast(SetResultNode); // add to TreeView BuildMacrosTreeView.BeginUpdate; TreeViewAddBuildMacro(NewBuildMacro); @@ -160,7 +151,6 @@ var SelTVNode: TTreeNode; NodeType: TCBMNodeType; i: LongInt; - Editor: TCompOptsExprEditor; begin SelTVNode:=GetSelectedNode(TLazBuildMacro(aBuildMacro),NodeType); if aBuildMacro=nil then exit; @@ -169,9 +159,6 @@ begin mtConfirmation,[mbYes,mbCancel],0)<>mrYes then exit; i:=BuildMacros.IndexOfIdentifier(aBuildMacro.Identifier); - Editor:=GetEditor(aBuildMacro); - FEditors.Remove(Editor); - Editor.Free; BuildMacros.Delete(i); BuildMacrosTreeView.BeginUpdate; SelTVNode.Delete; @@ -182,7 +169,6 @@ procedure TCompOptBuildMacrosFrame.BuildMacrosTVPopupMenuPopup(Sender: TObject); var aBuildMacro: TLazBuildMacro; NodeType: TCBMNodeType; - Editor: TCompOptsExprEditor; function Add(const aCaption: string; const OnClickEvent: TNotifyEvent): TMenuItem; begin @@ -213,10 +199,6 @@ begin Add('New build macro',@NewBuildMacroClick); if NodeType in [cbmntBuildMacro] then Add('Delete build macro ...',@DeleteBuildMacroClick); - if NodeType in [cbmntDefaultValue,cbmntDefaultValueEditor] then begin - Editor:=GetEditor(aBuildMacro); - Editor.FillPopupMenu(BuildMacrosTVPopupMenu); - end; end; procedure TCompOptBuildMacrosFrame.BuildMacrosTreeViewEditing(Sender: TObject; @@ -322,8 +304,6 @@ var ValuesTVNode: TTreeNode; Values: TStrings; i: Integer; - DefValueTVNode: TTreeNode; - Editor: TCompOptsExprEditor; begin // create node for the build macro TVNode:=BuildMacrosTreeView.Items.AddObject(nil,aBuildMacro.Identifier,aBuildMacro); @@ -339,18 +319,6 @@ begin Values:=aBuildMacro.Values; for i:=0 to Values.Count-1 do TreeViewAddValue(ValuesTVNode,Values[i]); - // a node for the default value - DefValueTVNode:=BuildMacrosTreeView.Items.AddChild(TVNode, - lisDefaultValue); - DefValueTVNode.ImageIndex:=fDefValueImgID; - DefValueTVNode.SelectedIndex:=DefValueTVNode.ImageIndex; - // add default value nodes - Editor:=TCompOptsExprEditor.Create(Self); - Editor.DefaultNodeType:=cocntSetValue; - Editor.DefaultValueType:=cocvtResult; - FEditors.Add(Editor); - Editor.Setup(BuildMacrosTreeView,DefValueTVNode, - aBuildMacro.DefaultValue as TCompOptConditionals,[cocvtResult]); end; //DebugLn(['TCompOptBuildMacrosFrame.TreeViewAddBuildMacro ',TVNode.Text]); TVNode.Expand(true); @@ -383,13 +351,9 @@ function TCompOptBuildMacrosFrame.GetNodeInfo(Node: TTreeNode; out case ParentType of cbmntBuildMacro: if CurNode.Text=lisValues then - Result:=cbmntValues - else if CurNode.Text=lisDefaultValue then - Result:=cbmntDefaultValue; + Result:=cbmntValues; cbmntValues: Result:=cbmntValue; - cbmntDefaultValue: - Result:=cbmntDefaultValueEditor; end; end; end; @@ -435,18 +399,6 @@ begin FEditors.Clear; end; -function TCompOptBuildMacrosFrame.GetEditor(aBuildMacro: TLazBuildMacro - ): TCompOptsExprEditor; -var - i: Integer; -begin - for i:=0 to FEditors.Count-1 do begin - Result:=TCompOptsExprEditor(FEditors[i]); - if Result.Conditionals=aBuildMacro.DefaultValue then exit; - end; - Result:=nil; -end; - function TCompOptBuildMacrosFrame.GetMacroNamePrefix: string; begin Result:='BuildMacro'; diff --git a/ideintf/projectintf.pas b/ideintf/projectintf.pas index 4852e1cf79..d7eecca087 100644 --- a/ideintf/projectintf.pas +++ b/ideintf/projectintf.pas @@ -167,7 +167,7 @@ type TLazBuildMacro = class protected - FDefaultValue: TLazCompOptConditionals; + FDefaultValue: string; FIdentifier: string; FDescription: string; FValueDescriptions: TStrings; @@ -183,7 +183,7 @@ type property Description: string read FDescription write SetDescription; property Values: TStrings read FValues write SetValues; property ValueDescriptions: TStrings read FValueDescriptions write SetValueDescriptions; - property DefaultValue: TLazCompOptConditionals read FDefaultValue; + property DefaultValue: string read FDefaultValue; end; { TLazBuildMacros