IDEIntf: renamed TLazBuildMode to TLazBuildProperty

git-svn-id: trunk@19615 -
This commit is contained in:
mattias 2009-04-25 12:17:19 +00:00
parent 2c04e4de3e
commit 22260a35b9
3 changed files with 86 additions and 85 deletions

View File

@ -52,7 +52,7 @@ type
{ TIDEBuildMode } { TIDEBuildMode }
TIDEBuildMode = class(TLazBuildMode) TIDEBuildMode = class(TLazBuildProperty)
protected protected
procedure SetIdentifier(const AValue: string); override; procedure SetIdentifier(const AValue: string); override;
procedure SetDescription(const AValue: string); override; procedure SetDescription(const AValue: string); override;
@ -61,12 +61,12 @@ type
public public
constructor Create; constructor Create;
destructor Destroy; override; destructor Destroy; override;
procedure Assign(Source: TLazBuildMode); override; procedure Assign(Source: TLazBuildProperty); override;
procedure LoadFromXMLConfig(AXMLConfig: TXMLConfig; const Path: string; procedure LoadFromXMLConfig(AXMLConfig: TXMLConfig; const Path: string;
DoSwitchPathDelims: boolean); DoSwitchPathDelims: boolean);
procedure SaveToXMLConfig(AXMLConfig: TXMLConfig; const Path: string; procedure SaveToXMLConfig(AXMLConfig: TXMLConfig; const Path: string;
UsePathDelim: TPathDelimSwitch); UsePathDelim: TPathDelimSwitch);
procedure CreateDiff(OtherMode: TLazBuildMode; Tool: TCompilerDiffTool); procedure CreateDiff(OtherMode: TLazBuildProperty; Tool: TCompilerDiffTool);
procedure Assign(Source: TIDEBuildMode); procedure Assign(Source: TIDEBuildMode);
procedure SetDefaultValue(const AValue: string); override; procedure SetDefaultValue(const AValue: string); override;
end; end;
@ -75,16 +75,16 @@ type
{ TIDEBuildModes } { TIDEBuildModes }
TIDEBuildModes = class(TLazBuildModes) TIDEBuildModes = class(TLazBuildProperties)
private private
FBuildModeSet: TBuildModeSet; FBuildModeSet: TBuildModeSet;
fPrevModes, fNextModes: TIDEBuildModes; fPrevModes, fNextModes: TIDEBuildModes;
procedure SetBuildModeSet(const AValue: TBuildModeSet); procedure SetBuildModeSet(const AValue: TBuildModeSet);
protected protected
FItems: TFPList;// list of TIDEBuildMode FItems: TFPList;// list of TIDEBuildMode
function GetItems(Index: integer): TLazBuildMode; override; function GetItems(Index: integer): TLazBuildProperty; override;
public public
function Add(Identifier: string): TLazBuildMode; override; function Add(Identifier: string): TLazBuildProperty; override;
procedure Clear; override; procedure Clear; override;
function Count: integer; override; function Count: integer; override;
constructor Create(TheOwner: TObject); override; constructor Create(TheOwner: TObject); override;
@ -97,8 +97,9 @@ type
DoSwitchPathDelims: boolean); DoSwitchPathDelims: boolean);
procedure SaveToXMLConfig(AXMLConfig: TXMLConfig; const Path: string; procedure SaveToXMLConfig(AXMLConfig: TXMLConfig; const Path: string;
UsePathDelim: TPathDelimSwitch); UsePathDelim: TPathDelimSwitch);
procedure CreateDiff(OtherModes: TLazBuildModes; Tool: TCompilerDiffTool); procedure CreateDiff(OtherProperties: TLazBuildProperties;
procedure Assign(Source: TLazBuildModes); Tool: TCompilerDiffTool);
procedure Assign(Source: TLazBuildProperties);
property BuildModeSet: TBuildModeSet read FBuildModeSet write SetBuildModeSet;// active in BuildModeSet property BuildModeSet: TBuildModeSet read FBuildModeSet write SetBuildModeSet;// active in BuildModeSet
end; end;
@ -3541,7 +3542,7 @@ begin
inherited Destroy; inherited Destroy;
end; end;
procedure TIDEBuildMode.Assign(Source: TLazBuildMode); procedure TIDEBuildMode.Assign(Source: TLazBuildProperty);
begin begin
FIdentifier:=Source.Identifier; FIdentifier:=Source.Identifier;
FDefaultValue.Assign(Source.DefaultValue); FDefaultValue.Assign(Source.DefaultValue);
@ -3578,7 +3579,7 @@ begin
UsePathDelim); UsePathDelim);
end; end;
procedure TIDEBuildMode.CreateDiff(OtherMode: TLazBuildMode; procedure TIDEBuildMode.CreateDiff(OtherMode: TLazBuildProperty;
Tool: TCompilerDiffTool); Tool: TCompilerDiffTool);
begin begin
Tool.AddDiff('Identifier',Identifier,OtherMode.Identifier); Tool.AddDiff('Identifier',Identifier,OtherMode.Identifier);
@ -3632,12 +3633,12 @@ begin
end; end;
end; end;
function TIDEBuildModes.GetItems(Index: integer): TLazBuildMode; function TIDEBuildModes.GetItems(Index: integer): TLazBuildProperty;
begin begin
Result:=TLazBuildMode(FItems[Index]); Result:=TLazBuildProperty(FItems[Index]);
end; end;
function TIDEBuildModes.Add(Identifier: string): TLazBuildMode; function TIDEBuildModes.Add(Identifier: string): TLazBuildProperty;
begin begin
if IndexOfIdentifier(Identifier)>=0 then if IndexOfIdentifier(Identifier)>=0 then
raise Exception.Create('TIDEBuildModes.Add identifier already exists'); raise Exception.Create('TIDEBuildModes.Add identifier already exists');
@ -3731,22 +3732,22 @@ begin
Path+'Item'+IntToStr(i+1)+'/',UsePathDelim); Path+'Item'+IntToStr(i+1)+'/',UsePathDelim);
end; end;
procedure TIDEBuildModes.CreateDiff(OtherModes: TLazBuildModes; procedure TIDEBuildModes.CreateDiff(OtherProperties: TLazBuildProperties;
Tool: TCompilerDiffTool); Tool: TCompilerDiffTool);
var var
i: Integer; i: Integer;
begin begin
Tool.AddDiff('Count',Count,OtherModes.Count); Tool.AddDiff('Count',Count,OtherProperties.Count);
for i:=0 to Count-1 do begin for i:=0 to Count-1 do begin
if i<OtherModes.Count then if i<OtherProperties.Count then
TIDEBuildMode(Items[i]).CreateDiff(OtherModes.Items[i],Tool); TIDEBuildMode(Items[i]).CreateDiff(OtherProperties.Items[i],Tool);
end; end;
end; end;
procedure TIDEBuildModes.Assign(Source: TLazBuildModes); procedure TIDEBuildModes.Assign(Source: TLazBuildProperties);
var var
i: Integer; i: Integer;
Item: TLazBuildMode; Item: TLazBuildProperty;
begin begin
Clear; Clear;
for i:=0 to Source.Count-1 do begin for i:=0 to Source.Count-1 do begin

View File

@ -152,9 +152,9 @@ type
property Root: TCompOptCondNode read FRoot write FRoot; property Root: TCompOptCondNode read FRoot write FRoot;
end; end;
{ TLazBuildMode } { TLazBuildProperty }
TLazBuildMode = class TLazBuildProperty = class
protected protected
FDefaultValue: TLazCompOptConditionals; FDefaultValue: TLazCompOptConditionals;
FIdentifier: string; FIdentifier: string;
@ -166,7 +166,7 @@ type
procedure SetValueDescriptions(const AValue: TStrings); virtual; abstract; procedure SetValueDescriptions(const AValue: TStrings); virtual; abstract;
procedure SetValues(const AValue: TStrings); virtual; abstract; procedure SetValues(const AValue: TStrings); virtual; abstract;
public public
procedure Assign(Source: TLazBuildMode); virtual; abstract; procedure Assign(Source: TLazBuildProperty); virtual; abstract;
procedure SetDefaultValue(const AValue: string); virtual; abstract; procedure SetDefaultValue(const AValue: string); virtual; abstract;
property Identifier: string read FIdentifier write SetIdentifier; property Identifier: string read FIdentifier write SetIdentifier;
property Description: string read FDescription write SetDescription; property Description: string read FDescription write SetDescription;
@ -175,23 +175,23 @@ type
property DefaultValue: TLazCompOptConditionals read FDefaultValue; property DefaultValue: TLazCompOptConditionals read FDefaultValue;
end; end;
{ TLazBuildModes } { TLazBuildProperties }
TLazBuildModes = class TLazBuildProperties = class
private private
FOwner: TObject; FOwner: TObject;
protected protected
function GetItems(Index: integer): TLazBuildMode; virtual; abstract; function GetItems(Index: integer): TLazBuildProperty; virtual; abstract;
public public
constructor Create(TheOwner: TObject); virtual; constructor Create(TheOwner: TObject); virtual;
function Add(Identifier: string): TLazBuildMode; virtual; abstract; function Add(Identifier: string): TLazBuildProperty; virtual; abstract;
procedure Delete(Index: integer); virtual; abstract; procedure Delete(Index: integer); virtual; abstract;
procedure Move(OldIndex, NewIndex: integer); virtual; abstract; procedure Move(OldIndex, NewIndex: integer); virtual; abstract;
function IndexOfIdentifier(Identifier: string): integer; virtual; abstract; function IndexOfIdentifier(Identifier: string): integer; virtual; abstract;
function ModeWithIdentifier(Identifier: string): TLazBuildMode; virtual; abstract; function ModeWithIdentifier(Identifier: string): TLazBuildProperty; virtual; abstract;
function Count: integer; virtual; abstract; function Count: integer; virtual; abstract;
procedure Clear; virtual; abstract; procedure Clear; virtual; abstract;
property Items[Index: integer]: TLazBuildMode read GetItems; default; property Items[Index: integer]: TLazBuildProperty read GetItems; default;
property Owner: TObject read FOwner; property Owner: TObject read FOwner;
end; end;
@ -232,7 +232,7 @@ type
// conditionals / build modes // conditionals / build modes
FConditionals: TLazCompOptConditionals; FConditionals: TLazCompOptConditionals;
fBuildModes: TLazBuildModes; fBuildModes: TLazBuildProperties;
fLCLWidgetType: string; fLCLWidgetType: string;
// Parsing: // Parsing:
@ -344,7 +344,7 @@ type
// conditional / build modes // conditional / build modes
property Conditionals: TLazCompOptConditionals read FConditionals; property Conditionals: TLazCompOptConditionals read FConditionals;
property BuildModes: TLazBuildModes read fBuildModes; property BuildModes: TLazBuildProperties read fBuildModes;
// Beware: eventually LCLWidgetType will be replaced by a more generic solution // Beware: eventually LCLWidgetType will be replaced by a more generic solution
property LCLWidgetType: string read fLCLWidgetType write fLCLWidgetType; property LCLWidgetType: string read fLCLWidgetType write fLCLWidgetType;
@ -1628,9 +1628,9 @@ begin
inherited Destroy; inherited Destroy;
end; end;
{ TLazBuildModes } { TLazBuildProperties }
constructor TLazBuildModes.Create(TheOwner: TObject); constructor TLazBuildProperties.Create(TheOwner: TObject);
begin begin
FOwner:=TheOwner FOwner:=TheOwner
end; end;

View File

@ -65,15 +65,15 @@ type
FEditors: TFPList;// list of TCompOptsExprEditor FEditors: TFPList;// list of TCompOptsExprEditor
procedure SetBuildModes(const AValue: TIDEBuildModes); procedure SetBuildModes(const AValue: TIDEBuildModes);
procedure RebuildTreeView; procedure RebuildTreeView;
procedure TreeViewAddBuildMode(BuildMode: TLazBuildMode); procedure TreeViewAddBuildMode(BuildProperty: TLazBuildProperty);
procedure TreeViewAddValue(ValuesTVNode: TTreeNode; aValue: string); procedure TreeViewAddValue(ValuesTVNode: TTreeNode; aValue: string);
function GetNodeInfo(Node: TTreeNode; out BuildMode: TLazBuildMode): TCBMNodeType; function GetNodeInfo(Node: TTreeNode; out BuildProperty: TLazBuildProperty): TCBMNodeType;
function GetSelectedNode(out BuildMode: TLazBuildMode; function GetSelectedNode(out BuildProperty: TLazBuildProperty;
out NodeType: TCBMNodeType): TTreeNode; out NodeType: TCBMNodeType): TTreeNode;
function GetBuildModeTVNode(BuildMode: TLazBuildMode): TTreeNode; function GetBuildModeTVNode(BuildProperty: TLazBuildProperty): TTreeNode;
function GetValuesTVNode(BuildMode: TLazBuildMode): TTreeNode; function GetValuesTVNode(BuildProperty: TLazBuildProperty): TTreeNode;
procedure FreeEditors; procedure FreeEditors;
function GetEditor(BuildMode: TLazBuildMode): TCompOptsExprEditor; function GetEditor(BuildProperty: TLazBuildProperty): TCompOptsExprEditor;
public public
constructor Create(TheOwner: TComponent); override; constructor Create(TheOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
@ -87,41 +87,41 @@ implementation
procedure TCompOptBuildModesFrame.NewBuildModeClick(Sender: TObject); procedure TCompOptBuildModesFrame.NewBuildModeClick(Sender: TObject);
var var
NewIdentifier: String; NewIdentifier: String;
NewBuildMode: TLazBuildMode; NewBuildProperty: TLazBuildProperty;
SetResultNode: TCompOptCondNode; SetResultNode: TCompOptCondNode;
begin begin
NewIdentifier:=GlobalBuildModeSet.GetUniqueModeName(BuildModes); NewIdentifier:=GlobalBuildModeSet.GetUniqueModeName(BuildModes);
NewBuildMode:=BuildModes.Add(NewIdentifier); NewBuildProperty:=BuildModes.Add(NewIdentifier);
// add a node // add a node
SetResultNode:=TCompOptCondNode.Create(NewBuildMode.DefaultValue); SetResultNode:=TCompOptCondNode.Create(NewBuildProperty.DefaultValue);
SetResultNode.NodeType:=cocntSetValue; SetResultNode.NodeType:=cocntSetValue;
SetResultNode.ValueType:=cocvtResult; SetResultNode.ValueType:=cocvtResult;
NewBuildMode.DefaultValue.Root.AddLast(SetResultNode); NewBuildProperty.DefaultValue.Root.AddLast(SetResultNode);
// add to TreeView // add to TreeView
BuildModesTreeView.BeginUpdate; BuildModesTreeView.BeginUpdate;
TreeViewAddBuildMode(NewBuildMode); TreeViewAddBuildMode(NewBuildProperty);
BuildModesTreeView.EndUpdate; BuildModesTreeView.EndUpdate;
end; end;
procedure TCompOptBuildModesFrame.NewValueClick(Sender: TObject); procedure TCompOptBuildModesFrame.NewValueClick(Sender: TObject);
var var
BuildMode: TLazBuildMode; BuildProperty: TLazBuildProperty;
NodeType: TCBMNodeType; NodeType: TCBMNodeType;
i: Integer; i: Integer;
NewValueStr: String; NewValueStr: String;
ValuesTVNode: TTreeNode; ValuesTVNode: TTreeNode;
begin begin
GetSelectedNode(BuildMode,NodeType); GetSelectedNode(BuildProperty,NodeType);
if BuildMode=nil then exit; if BuildProperty=nil then exit;
i:=1; i:=1;
repeat repeat
NewValueStr:=Format(lisValue2, [IntToStr(i)]); NewValueStr:=Format(lisValue2, [IntToStr(i)]);
if BuildMode.Values.IndexOf(NewValueStr)<0 then break; if BuildProperty.Values.IndexOf(NewValueStr)<0 then break;
inc(i); inc(i);
until false; until false;
BuildMode.Values.Add(NewValueStr); BuildProperty.Values.Add(NewValueStr);
BuildModesTreeView.BeginUpdate; BuildModesTreeView.BeginUpdate;
ValuesTVNode:=GetValuesTVNode(BuildMode); ValuesTVNode:=GetValuesTVNode(BuildProperty);
TreeViewAddValue(ValuesTVNode,NewValueStr); TreeViewAddValue(ValuesTVNode,NewValueStr);
ValuesTVNode.Expand(true); ValuesTVNode.Expand(true);
BuildModesTreeView.EndUpdate; BuildModesTreeView.EndUpdate;
@ -129,21 +129,21 @@ end;
procedure TCompOptBuildModesFrame.DeleteValueClick(Sender: TObject); procedure TCompOptBuildModesFrame.DeleteValueClick(Sender: TObject);
var var
BuildMode: TLazBuildMode; BuildProperty: TLazBuildProperty;
NodeType: TCBMNodeType; NodeType: TCBMNodeType;
SelTVNode: TTreeNode; SelTVNode: TTreeNode;
aValue: String; aValue: String;
i: LongInt; i: LongInt;
begin begin
SelTVNode:=GetSelectedNode(BuildMode,NodeType); SelTVNode:=GetSelectedNode(BuildProperty,NodeType);
if NodeType<>cbmntValue then exit; if NodeType<>cbmntValue then exit;
aValue:=SelTVNode.Text; aValue:=SelTVNode.Text;
if MessageDlg(lisConfirmDelete, if MessageDlg(lisConfirmDelete,
Format(lisDeleteValue, ['"', aValue, '"']), Format(lisDeleteValue, ['"', aValue, '"']),
mtConfirmation,[mbYes,mbCancel],0)<>mrYes mtConfirmation,[mbYes,mbCancel],0)<>mrYes
then exit; then exit;
i:=BuildMode.Values.IndexOf(aValue); i:=BuildProperty.Values.IndexOf(aValue);
if i>=0 then BuildMode.Values.Delete(i); if i>=0 then BuildProperty.Values.Delete(i);
BuildModesTreeView.BeginUpdate; BuildModesTreeView.BeginUpdate;
SelTVNode.Delete; SelTVNode.Delete;
BuildModesTreeView.EndUpdate; BuildModesTreeView.EndUpdate;
@ -175,7 +175,7 @@ end;
procedure TCompOptBuildModesFrame.BuildModeTVPopupMenuPopup(Sender: TObject); procedure TCompOptBuildModesFrame.BuildModeTVPopupMenuPopup(Sender: TObject);
var var
BuildMode: TLazBuildMode; BuildProperty: TLazBuildProperty;
NodeType: TCBMNodeType; NodeType: TCBMNodeType;
Editor: TCompOptsExprEditor; Editor: TCompOptsExprEditor;
@ -198,7 +198,7 @@ var
begin begin
BuildModeTVPopupMenu.Items.Clear; BuildModeTVPopupMenu.Items.Clear;
GetSelectedNode(BuildMode,NodeType); GetSelectedNode(BuildProperty,NodeType);
if NodeType in [cbmntBuildMode,cbmntValues,cbmntValue] then if NodeType in [cbmntBuildMode,cbmntValues,cbmntValue] then
Add('New value',@NewValueClick); Add('New value',@NewValueClick);
@ -209,7 +209,7 @@ begin
if NodeType in [cbmntBuildMode] then if NodeType in [cbmntBuildMode] then
Add('Delete build mode ...',@DeleteBuildModeClick); Add('Delete build mode ...',@DeleteBuildModeClick);
if NodeType in [cbmntDefaultValue,cbmntDefaultValueEditor] then begin if NodeType in [cbmntDefaultValue,cbmntDefaultValueEditor] then begin
Editor:=GetEditor(BuildMode); Editor:=GetEditor(BuildProperty);
Editor.FillPopupMenu(BuildModeTVPopupMenu); Editor.FillPopupMenu(BuildModeTVPopupMenu);
end; end;
end; end;
@ -217,10 +217,10 @@ end;
procedure TCompOptBuildModesFrame.BuildModesTreeViewEditing(Sender: TObject; procedure TCompOptBuildModesFrame.BuildModesTreeViewEditing(Sender: TObject;
Node: TTreeNode; var AllowEdit: Boolean); Node: TTreeNode; var AllowEdit: Boolean);
var var
BuildMode: TLazBuildMode; BuildProperty: TLazBuildProperty;
NodeType: TCBMNodeType; NodeType: TCBMNodeType;
begin begin
NodeType:=GetNodeInfo(Node,BuildMode); NodeType:=GetNodeInfo(Node,BuildProperty);
AllowEdit:=NodeType in [cbmntBuildMode,cbmntValue]; AllowEdit:=NodeType in [cbmntBuildMode,cbmntValue];
end; end;
@ -233,49 +233,49 @@ end;
procedure TCompOptBuildModesFrame.BuildModesTreeViewEdited(Sender: TObject; procedure TCompOptBuildModesFrame.BuildModesTreeViewEdited(Sender: TObject;
Node: TTreeNode; var S: string); Node: TTreeNode; var S: string);
var var
BuildMode: TLazBuildMode; BuildProperty: TLazBuildProperty;
NodeType: TCBMNodeType; NodeType: TCBMNodeType;
ConflictBuildMode: TIDEBuildMode; ConflictBuildMode: TIDEBuildMode;
Index: LongInt; Index: LongInt;
begin begin
NodeType:=GetNodeInfo(Node,BuildMode); NodeType:=GetNodeInfo(Node,BuildProperty);
case NodeType of case NodeType of
cbmntBuildMode: cbmntBuildMode:
if S<>BuildMode.Identifier then begin if S<>BuildProperty.Identifier then begin
// rename build mode // rename build mode
if (S='') or (not IsValidIdent(S)) then begin if (S='') or (not IsValidIdent(S)) then begin
MessageDlg(lisCCOErrorCaption, MessageDlg(lisCCOErrorCaption,
Format(lisInvalidBuildModeTheBuildModeMustBeAPascalIdentifie, ['"', Format(lisInvalidBuildModeTheBuildModeMustBeAPascalIdentifie, ['"',
S, '"']), S, '"']),
mtError,[mbCancel],0); mtError,[mbCancel],0);
S:=BuildMode.Identifier; S:=BuildProperty.Identifier;
exit; exit;
end; end;
ConflictBuildMode:=BuildModes.ModeWithIdentifier(S); ConflictBuildMode:=BuildModes.ModeWithIdentifier(S);
if (ConflictBuildMode<>nil) and (ConflictBuildMode<>BuildMode) then if (ConflictBuildMode<>nil) and (ConflictBuildMode<>BuildProperty) then
begin begin
MessageDlg(lisCCOErrorCaption, MessageDlg(lisCCOErrorCaption,
Format(lisThereIsAlreadyABuildModeWithTheName, ['"', S, '"']), Format(lisThereIsAlreadyABuildModeWithTheName, ['"', S, '"']),
mtError,[mbCancel],0); mtError,[mbCancel],0);
S:=BuildMode.Identifier; S:=BuildProperty.Identifier;
exit; exit;
end; end;
BuildMode.Identifier:=S; BuildProperty.Identifier:=S;
end; end;
cbmntValue: cbmntValue:
begin begin
Index:=Node.Index; Index:=Node.Index;
Index:=BuildMode.Values.IndexOf(S); Index:=BuildProperty.Values.IndexOf(S);
if (Index>=0) and (Index<>Node.Index) then begin if (Index>=0) and (Index<>Node.Index) then begin
MessageDlg(lisCCOErrorCaption, MessageDlg(lisCCOErrorCaption,
Format(lisDuplicateFoundOfValue, ['"', S, '"']), Format(lisDuplicateFoundOfValue, ['"', S, '"']),
mtError,[mbCancel],0); mtError,[mbCancel],0);
S:=BuildMode.Values[Node.Index]; S:=BuildProperty.Values[Node.Index];
exit; exit;
end; end;
BuildMode.Values[Node.Index]:=S; BuildProperty.Values[Node.Index]:=S;
end; end;
end; end;
@ -303,8 +303,8 @@ begin
BuildModesTreeView.EndUpdate; BuildModesTreeView.EndUpdate;
end; end;
procedure TCompOptBuildModesFrame.TreeViewAddBuildMode(BuildMode: TLazBuildMode procedure TCompOptBuildModesFrame.TreeViewAddBuildMode(
); BuildProperty: TLazBuildProperty);
var var
TVNode: TTreeNode; TVNode: TTreeNode;
ValuesTVNode: TTreeNode; ValuesTVNode: TTreeNode;
@ -314,7 +314,7 @@ var
Editor: TCompOptsExprEditor; Editor: TCompOptsExprEditor;
begin begin
// create node for the build mode // create node for the build mode
TVNode:=BuildModesTreeView.Items.AddObject(nil,BuildMode.Identifier,BuildMode); TVNode:=BuildModesTreeView.Items.AddObject(nil,BuildProperty.Identifier,BuildProperty);
TVNode.ImageIndex:=fModeImgID; TVNode.ImageIndex:=fModeImgID;
TVNode.SelectedIndex:=TVNode.ImageIndex; TVNode.SelectedIndex:=TVNode.ImageIndex;
// second level // second level
@ -324,7 +324,7 @@ begin
ValuesTVNode.ImageIndex:=fValuesImgID; ValuesTVNode.ImageIndex:=fValuesImgID;
ValuesTVNode.SelectedIndex:=ValuesTVNode.ImageIndex; ValuesTVNode.SelectedIndex:=ValuesTVNode.ImageIndex;
// a node for each value // a node for each value
Values:=BuildMode.Values; Values:=BuildProperty.Values;
for i:=0 to Values.Count-1 do for i:=0 to Values.Count-1 do
TreeViewAddValue(ValuesTVNode,Values[i]); TreeViewAddValue(ValuesTVNode,Values[i]);
// a node for the default value // a node for the default value
@ -338,7 +338,7 @@ begin
Editor.DefaultValueType:=cocvtResult; Editor.DefaultValueType:=cocvtResult;
FEditors.Add(Editor); FEditors.Add(Editor);
Editor.Setup(BuildModesTreeView,DefValueTVNode, Editor.Setup(BuildModesTreeView,DefValueTVNode,
BuildMode.DefaultValue as TCompOptConditionals,[cocvtResult]); BuildProperty.DefaultValue as TCompOptConditionals,[cocvtResult]);
end; end;
//DebugLn(['TCompOptBuildModesFrame.TreeViewAddBuildMode ',TVNode.Text]); //DebugLn(['TCompOptBuildModesFrame.TreeViewAddBuildMode ',TVNode.Text]);
TVNode.Expand(true); TVNode.Expand(true);
@ -355,7 +355,7 @@ begin
end; end;
function TCompOptBuildModesFrame.GetNodeInfo(Node: TTreeNode; out function TCompOptBuildModesFrame.GetNodeInfo(Node: TTreeNode; out
BuildMode: TLazBuildMode): TCBMNodeType; BuildProperty: TLazBuildProperty): TCBMNodeType;
function GetNodeType(CurNode: TTreeNode): TCBMNodeType; function GetNodeType(CurNode: TTreeNode): TCBMNodeType;
var var
@ -363,8 +363,8 @@ function TCompOptBuildModesFrame.GetNodeInfo(Node: TTreeNode; out
begin begin
if CurNode=nil then if CurNode=nil then
Result:=cbmntNone Result:=cbmntNone
else if TObject(CurNode.Data) is TLazBuildMode then begin else if TObject(CurNode.Data) is TLazBuildProperty then begin
BuildMode:=TLazBuildMode(CurNode.Data); BuildProperty:=TLazBuildProperty(CurNode.Data);
Result:=cbmntBuildMode; Result:=cbmntBuildMode;
end else begin end else begin
ParentType:=GetNodeType(CurNode.Parent); ParentType:=GetNodeType(CurNode.Parent);
@ -383,31 +383,31 @@ function TCompOptBuildModesFrame.GetNodeInfo(Node: TTreeNode; out
end; end;
begin begin
BuildMode:=nil; BuildProperty:=nil;
Result:=GetNodeType(Node); Result:=GetNodeType(Node);
end; end;
function TCompOptBuildModesFrame.GetSelectedNode(out function TCompOptBuildModesFrame.GetSelectedNode(out
BuildMode: TLazBuildMode; out NodeType: TCBMNodeType): TTreeNode; BuildProperty: TLazBuildProperty; out NodeType: TCBMNodeType): TTreeNode;
begin begin
Result:=BuildModesTreeView.Selected; Result:=BuildModesTreeView.Selected;
NodeType:=GetNodeInfo(Result,BuildMode); NodeType:=GetNodeInfo(Result,BuildProperty);
end; end;
function TCompOptBuildModesFrame.GetBuildModeTVNode(BuildMode: TLazBuildMode function TCompOptBuildModesFrame.GetBuildModeTVNode(BuildProperty: TLazBuildProperty
): TTreeNode; ): TTreeNode;
begin begin
Result:=BuildModesTreeView.Items.GetFirstNode; Result:=BuildModesTreeView.Items.GetFirstNode;
while (Result<>nil) and (TObject(Result.Data)<>BuildMode) do while (Result<>nil) and (TObject(Result.Data)<>BuildProperty) do
Result:=Result.GetNextSibling; Result:=Result.GetNextSibling;
end; end;
function TCompOptBuildModesFrame.GetValuesTVNode(BuildMode: TLazBuildMode function TCompOptBuildModesFrame.GetValuesTVNode(BuildProperty: TLazBuildProperty
): TTreeNode; ): TTreeNode;
var var
BuildModeTVNode: TTreeNode; BuildModeTVNode: TTreeNode;
begin begin
BuildModeTVNode:=GetBuildModeTVNode(BuildMode); BuildModeTVNode:=GetBuildModeTVNode(BuildProperty);
if (BuildModeTVNode<>nil) then if (BuildModeTVNode<>nil) then
Result:=BuildModeTVNode.GetFirstChild Result:=BuildModeTVNode.GetFirstChild
else else
@ -423,14 +423,14 @@ begin
FEditors.Clear; FEditors.Clear;
end; end;
function TCompOptBuildModesFrame.GetEditor(BuildMode: TLazBuildMode function TCompOptBuildModesFrame.GetEditor(BuildProperty: TLazBuildProperty
): TCompOptsExprEditor; ): TCompOptsExprEditor;
var var
i: Integer; i: Integer;
begin begin
for i:=0 to FEditors.Count-1 do begin for i:=0 to FEditors.Count-1 do begin
Result:=TCompOptsExprEditor(FEditors[i]); Result:=TCompOptsExprEditor(FEditors[i]);
if Result.Conditionals=BuildMode.DefaultValue then exit; if Result.Conditionals=BuildProperty.DefaultValue then exit;
end; end;
Result:=nil; Result:=nil;
end; end;