mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-23 09:19:40 +02:00
IDE: global build modes
git-svn-id: trunk@17999 -
This commit is contained in:
parent
5de189d7af
commit
7332c0b540
@ -205,7 +205,7 @@ begin
|
||||
|
||||
OnBackupFileInteractive:=@BackupFile;
|
||||
RunCompilerWithOptions:=@OnRunCompilerWithOptions;
|
||||
BuildModeSet:=TBuildModeSet.Create;
|
||||
GlobalBuildModeSet:=TBuildModeSet.Create;
|
||||
end;
|
||||
|
||||
destructor TBuildManager.Destroy;
|
||||
@ -213,7 +213,7 @@ begin
|
||||
LazConfMacroFunc:=nil;
|
||||
OnBackupFileInteractive:=nil;
|
||||
FreeAndNil(InputHistories);
|
||||
FreeAndNil(BuildModeSet);
|
||||
FreeAndNil(GlobalBuildModeSet);
|
||||
|
||||
inherited Destroy;
|
||||
MainBuildBoss:=nil;
|
||||
|
@ -68,9 +68,15 @@ type
|
||||
procedure Assign(Source: TIDEBuildMode);
|
||||
end;
|
||||
|
||||
TBuildModeSet = class;
|
||||
|
||||
{ TIDEBuildModes }
|
||||
|
||||
TIDEBuildModes = class(TLazBuildModes)
|
||||
private
|
||||
FBuildModeSet: TBuildModeSet;
|
||||
fPrevModes, fNextModes: TIDEBuildModes;
|
||||
procedure SetBuildModeSet(const AValue: TBuildModeSet);
|
||||
protected
|
||||
FItems: TFPList;// list of TIDEBuildMode
|
||||
function GetItems(Index: integer): TLazBuildMode; override;
|
||||
@ -82,12 +88,13 @@ type
|
||||
procedure Delete(Index: integer); override;
|
||||
destructor Destroy; override;
|
||||
function IndexOfIdentifier(Identifier: string): integer; override;
|
||||
function ModeWithIdentifier(Identifier: string): TLazBuildMode; override;
|
||||
function ModeWithIdentifier(Identifier: string): TIDEBuildMode; override;
|
||||
procedure Move(OldIndex, NewIndex: integer); override;
|
||||
procedure LoadFromXMLConfig(AXMLConfig: TXMLConfig; const Path: string; DoSwitchPathDelims: boolean);
|
||||
procedure SaveToXMLConfig(AXMLConfig: TXMLConfig; const Path: string);
|
||||
procedure CreateDiff(OtherModes: TLazBuildModes; Tool: TCompilerDiffTool);
|
||||
procedure Assign(Source: TLazBuildModes);
|
||||
property BuildModeSet: TBuildModeSet read FBuildModeSet write SetBuildModeSet;// active in BuildModeSet
|
||||
end;
|
||||
|
||||
{ TBuildModeSet }
|
||||
@ -95,9 +102,13 @@ type
|
||||
TBuildModeSet = class
|
||||
private
|
||||
FEvaluator: TExpressionEvaluator;
|
||||
FFirstBuildModes: TIDEBuildModes;
|
||||
public
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
function FindModeWithIdentifier(Identifier: string; out BuildModes: TIDEBuildModes;
|
||||
out BuildMode: TIDEBuildMode): boolean;
|
||||
function GetUniqueModeName: string;
|
||||
property Evaluator: TExpressionEvaluator read FEvaluator;
|
||||
end;
|
||||
|
||||
@ -499,7 +510,7 @@ type
|
||||
TCompilerOptions = TBaseCompilerOptions;
|
||||
|
||||
var
|
||||
BuildModeSet: TBuildModeSet;
|
||||
GlobalBuildModeSet: TBuildModeSet;
|
||||
|
||||
const
|
||||
CompileReasonNames: array[TCompileReason] of string = (
|
||||
@ -826,7 +837,7 @@ constructor TBaseCompilerOptions.Create(const AOwner: TObject;
|
||||
const AToolClass: TCompilationToolClass);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
FConditionals := TCompOptConditionals.Create(BuildModeSet.Evaluator);
|
||||
FConditionals := TCompOptConditionals.Create(GlobalBuildModeSet.Evaluator);
|
||||
FParsedOpts := TParsedCompilerOptions.Create(TCompOptConditionals(FConditionals));
|
||||
FExecuteBefore := AToolClass.Create;
|
||||
FExecuteAfter := AToolClass.Create;
|
||||
@ -2856,7 +2867,7 @@ end;
|
||||
constructor TAdditionalCompilerOptions.Create(TheOwner: TObject);
|
||||
begin
|
||||
fOwner:=TheOwner;
|
||||
FConditionals:=TCompOptConditionals.Create(BuildModeSet.Evaluator);
|
||||
FConditionals:=TCompOptConditionals.Create(GlobalBuildModeSet.Evaluator);
|
||||
FParsedOpts:=TParsedCompilerOptions.Create(FConditionals);
|
||||
Clear;
|
||||
end;
|
||||
@ -3248,6 +3259,32 @@ begin
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
function TBuildModeSet.FindModeWithIdentifier(Identifier: string; out
|
||||
BuildModes: TIDEBuildModes; out BuildMode: TIDEBuildMode): boolean;
|
||||
begin
|
||||
BuildMode:=nil;
|
||||
BuildModes:=FFirstBuildModes;
|
||||
while BuildModes<>nil do begin
|
||||
BuildMode:=BuildModes.ModeWithIdentifier(Identifier);
|
||||
if BuildMode<>nil then exit(true);
|
||||
BuildModes:=BuildModes.fNextModes;
|
||||
end;
|
||||
Result:=false;
|
||||
end;
|
||||
|
||||
function TBuildModeSet.GetUniqueModeName: string;
|
||||
var
|
||||
i: Integer;
|
||||
BuildModes: TIDEBuildModes;
|
||||
BuildMode: TIDEBuildMode;
|
||||
begin
|
||||
i:=0;
|
||||
repeat
|
||||
inc(i);
|
||||
Result:='Mode'+IntToStr(i);
|
||||
until not FindModeWithIdentifier(Result,BuildModes,BuildMode);
|
||||
end;
|
||||
|
||||
{ TIDEBuildMode }
|
||||
|
||||
procedure TIDEBuildMode.SetIdentifier(const AValue: string);
|
||||
@ -3280,7 +3317,7 @@ constructor TIDEBuildMode.Create;
|
||||
begin
|
||||
FValues:=TStringList.Create;
|
||||
FValueDescriptions:=TStringList.Create;
|
||||
FDefaultValue:=TCompOptConditionals.Create(BuildModeSet.Evaluator);
|
||||
FDefaultValue:=TCompOptConditionals.Create(GlobalBuildModeSet.Evaluator);
|
||||
FDefaultValue.Root.NodeType:=cocntAddValue;
|
||||
FDefaultValue.Root.ValueType:=cocvtNone;
|
||||
end;
|
||||
@ -3350,6 +3387,23 @@ end;
|
||||
|
||||
{ TIDEBuildModes }
|
||||
|
||||
procedure TIDEBuildModes.SetBuildModeSet(const AValue: TBuildModeSet);
|
||||
begin
|
||||
if FBuildModeSet=AValue then exit;
|
||||
FBuildModeSet:=AValue;
|
||||
if FBuildModeSet<>nil then begin
|
||||
fNextModes:=GlobalBuildModeSet.FFirstBuildModes;
|
||||
GlobalBuildModeSet.FFirstBuildModes:=Self;
|
||||
end else begin
|
||||
if GlobalBuildModeSet.FFirstBuildModes=Self then
|
||||
GlobalBuildModeSet.FFirstBuildModes:=fNextModes;
|
||||
if fNextModes<>nil then fNextModes.fPrevModes:=fPrevModes;
|
||||
if fPrevModes<>nil then fPrevModes.fNextModes:=fNextModes;
|
||||
fPrevModes:=nil;
|
||||
fNextModes:=nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TIDEBuildModes.GetItems(Index: integer): TLazBuildMode;
|
||||
begin
|
||||
Result:=TLazBuildMode(FItems[Index]);
|
||||
@ -3391,6 +3445,7 @@ end;
|
||||
|
||||
destructor TIDEBuildModes.Destroy;
|
||||
begin
|
||||
BuildModeSet:=nil;
|
||||
Clear;
|
||||
FreeAndNil(FItems);
|
||||
inherited Destroy;
|
||||
@ -3403,7 +3458,7 @@ begin
|
||||
dec(Result);
|
||||
end;
|
||||
|
||||
function TIDEBuildModes.ModeWithIdentifier(Identifier: string): TLazBuildMode;
|
||||
function TIDEBuildModes.ModeWithIdentifier(Identifier: string): TIDEBuildMode;
|
||||
var
|
||||
i: LongInt;
|
||||
begin
|
||||
@ -3411,7 +3466,7 @@ begin
|
||||
if i<0 then
|
||||
Result:=nil
|
||||
else
|
||||
Result:=Items[i];
|
||||
Result:=TIDEBuildMode(Items[i]);
|
||||
end;
|
||||
|
||||
procedure TIDEBuildModes.Move(OldIndex, NewIndex: integer);
|
||||
|
@ -8,8 +8,8 @@ object CompOptBuildModesFrame: TCompOptBuildModesFrame
|
||||
Ctl3D = False
|
||||
TabOrder = 0
|
||||
Visible = False
|
||||
DesignLeft = 309
|
||||
DesignTop = 328
|
||||
DesignLeft = 324
|
||||
DesignTop = 400
|
||||
object ModesGroupBox: TGroupBox
|
||||
Left = 0
|
||||
Height = 229
|
||||
@ -70,7 +70,7 @@ object CompOptBuildModesFrame: TCompOptBuildModesFrame
|
||||
NumGlyphs = 0
|
||||
OnClick = MoveUpSpeedButtonClick
|
||||
end
|
||||
object ModesListBox: TListBox
|
||||
object ModesGrid: TStringGrid
|
||||
AnchorSideBottom.Control = NewSpeedButton
|
||||
Left = 0
|
||||
Height = 188
|
||||
@ -78,9 +78,11 @@ object CompOptBuildModesFrame: TCompOptBuildModesFrame
|
||||
Width = 182
|
||||
Align = alTop
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
ItemHeight = 0
|
||||
ColCount = 1
|
||||
FixedCols = 0
|
||||
FixedRows = 0
|
||||
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goEditing, goDblClickAutoSize, goSmoothScroll]
|
||||
TabOrder = 0
|
||||
TopIndex = -1
|
||||
end
|
||||
end
|
||||
object ValuesGroupBox: TGroupBox
|
||||
@ -102,6 +104,7 @@ object CompOptBuildModesFrame: TCompOptBuildModesFrame
|
||||
Align = alClient
|
||||
ColCount = 2
|
||||
FixedCols = 0
|
||||
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goColSizing, goEditing, goDblClickAutoSize, goSmoothScroll]
|
||||
TabOrder = 0
|
||||
end
|
||||
object DefaultValueGroupBox: TGroupBox
|
||||
|
@ -1,10 +1,12 @@
|
||||
{ This is an automatically generated lazarus resource file }
|
||||
|
||||
LazarusResources.Add('TCompOptBuildModesFrame','FORMDATA',[
|
||||
'TPF0'#23'TCompOptBuildModesFrame'#22'CompOptBuildModesFrame'#4'Left'#2#0#6'H'
|
||||
+'eight'#3#233#0#3'Top'#2#0#5'Width'#3#236#1#12'ClientHeight'#3#229#0#11'Clie'
|
||||
+'ntWidth'#3#232#1#5'Ctl3D'#8#8'TabOrder'#2#0#7'Visible'#8#10'DesignLeft'#3'5'
|
||||
+#1#9'DesignTop'#3'H'#1#0#9'TGroupBox'#13'ModesGroupBox'#4'Left'#2#0#6'Height'
|
||||
+#3#229#0#3'Top'#2#0#5'Width'#3#186#0#5'Align'#7#6'alLeft'#7'Caption'#6#13'Mo'
|
||||
+'desGroupBox'#12'ClientHeight'#3#210#0#11'ClientWidth'#3#182#0#5'Ctl3D'#8#8
|
||||
+'ntWidth'#3#232#1#5'Ctl3D'#8#8'TabOrder'#2#0#7'Visible'#8#10'DesignLeft'#3'D'
|
||||
+#1#9'DesignTop'#3#144#1#0#9'TGroupBox'#13'ModesGroupBox'#4'Left'#2#0#6'Heigh'
|
||||
+'t'#3#229#0#3'Top'#2#0#5'Width'#3#186#0#5'Align'#7#6'alLeft'#7'Caption'#6#13
|
||||
+'ModesGroupBox'#12'ClientHeight'#3#210#0#11'ClientWidth'#3#182#0#5'Ctl3D'#8#8
|
||||
+'TabOrder'#2#0#0#12'TSpeedButton'#14'NewSpeedButton'#22'AnchorSideLeft.Contr'
|
||||
+'ol'#7#13'ModesGroupBox'#24'AnchorSideBottom.Control'#7#13'ModesGroupBox'#21
|
||||
+'AnchorSideBottom.Side'#7#9'asrBottom'#4'Left'#2#0#6'Height'#2#22#3'Top'#3
|
||||
@ -22,30 +24,34 @@ LazarusResources.Add('TCompOptBuildModesFrame','FORMDATA',[
|
||||
+'eft.Control'#7#19'MoveDownSpeedButton'#19'AnchorSideLeft.Side'#7#9'asrBotto'
|
||||
+'m'#21'AnchorSideTop.Control'#7#14'NewSpeedButton'#4'Left'#2'E'#6'Height'#2
|
||||
+#22#3'Top'#3#188#0#5'Width'#2#23#5'Color'#7#9'clBtnFace'#9'NumGlyphs'#2#0#7
|
||||
+'OnClick'#7#22'MoveUpSpeedButtonClick'#0#0#8'TListBox'#12'ModesListBox'#24'A'
|
||||
+'OnClick'#7#22'MoveUpSpeedButtonClick'#0#0#11'TStringGrid'#9'ModesGrid'#24'A'
|
||||
+'nchorSideBottom.Control'#7#14'NewSpeedButton'#4'Left'#2#0#6'Height'#3#188#0
|
||||
+#3'Top'#2#0#5'Width'#3#182#0#5'Align'#7#5'alTop'#7'Anchors'#11#5'akTop'#6'ak'
|
||||
+'Left'#7'akRight'#8'akBottom'#0#10'ItemHeight'#2#0#8'TabOrder'#2#0#8'TopInde'
|
||||
+'x'#2#255#0#0#0#9'TGroupBox'#14'ValuesGroupBox'#4'Left'#3#191#0#6'Height'#3
|
||||
+#229#0#3'Top'#2#0#5'Width'#3')'#1#5'Align'#7#8'alClient'#7'Caption'#6#14'Val'
|
||||
+'uesGroupBox'#12'ClientHeight'#3#210#0#11'ClientWidth'#3'%'#1#5'Ctl3D'#8#8'T'
|
||||
+'abOrder'#2#1#0#11'TStringGrid'#16'ValuesStringGrid'#4'Left'#2#0#6'Height'#2
|
||||
+'_'#3'Top'#2#0#5'Width'#3'%'#1#5'Align'#7#8'alClient'#8'ColCount'#2#2#9'Fixe'
|
||||
+'dCols'#2#0#8'TabOrder'#2#0#0#0#9'TGroupBox'#20'DefaultValueGroupBox'#4'Left'
|
||||
+#2#0#6'Height'#2'm'#3'Top'#2'e'#5'Width'#3'%'#1#5'Align'#7#8'alBottom'#7'Cap'
|
||||
+'tion'#6#20'DefaultValueGroupBox'#12'ClientHeight'#2'Z'#11'ClientWidth'#3'!'
|
||||
+#1#5'Ctl3D'#8#8'TabOrder'#2#1#0#244#26'TCompOptsConditionalsFrame'#18'Defaul'
|
||||
+'tValueEditor'#6'Height'#2'Z'#5'Width'#3'!'#1#5'Align'#7#8'alClient'#12'Clie'
|
||||
+'ntHeight'#2'V'#11'ClientWidth'#3#29#1#7'Visible'#9#10'DesignLeft'#3#178#1#9
|
||||
+'DesignTop'#3'I'#1#0#241#9'TTreeView'#11'COCTreeView'#6'Height'#2'V'#5'Width'
|
||||
+#3#29#1#0#0#241#10'TPopupMenu'#12'COCPopupMenu'#0#241#9'TMenuItem'#19'Insert'
|
||||
+'AboveMenuItem'#0#0#241#9'TMenuItem'#19'InsertBelowMenuItem'#0#0#241#9'TMenu'
|
||||
+'Item'#19'InsertChildMenuItem'#0#0#241#9'TMenuItem'#14'DeleteMenuItem'#0#0
|
||||
+#241#9'TMenuItem'#14'MoveUpMenuItem'#0#0#241#9'TMenuItem'#16'MoveDownMenuIte'
|
||||
+'m'#0#0#241#9'TMenuItem'#17'MoveLvlUpMenuItem'#0#0#241#9'TMenuItem'#19'MoveL'
|
||||
+'vlDownMenuItem'#0#0#241#9'TMenuItem'#18'PropertiesMenuItem'#0#0#0#0#0#9'TSp'
|
||||
+'litter'#14'ValuesSplitter'#6'Cursor'#7#8'crVSplit'#4'Left'#2#0#6'Height'#2#6
|
||||
+#3'Top'#2'_'#5'Width'#3'%'#1#5'Align'#7#8'alBottom'#12'ResizeAnchor'#7#8'akB'
|
||||
+'ottom'#0#0#0#9'TSplitter'#12'MainSplitter'#4'Left'#3#186#0#6'Height'#3#229#0
|
||||
+#3'Top'#2#0#5'Width'#2#5#0#0#0
|
||||
+'Left'#7'akRight'#8'akBottom'#0#8'ColCount'#2#1#9'FixedCols'#2#0#9'FixedRows'
|
||||
+#2#0#7'Options'#11#15'goFixedVertLine'#15'goFixedHorzLine'#10'goVertLine'#10
|
||||
+'goHorzLine'#13'goRangeSelect'#9'goEditing'#18'goDblClickAutoSize'#14'goSmoo'
|
||||
+'thScroll'#0#8'TabOrder'#2#0#0#0#0#9'TGroupBox'#14'ValuesGroupBox'#4'Left'#3
|
||||
+#191#0#6'Height'#3#229#0#3'Top'#2#0#5'Width'#3')'#1#5'Align'#7#8'alClient'#7
|
||||
+'Caption'#6#14'ValuesGroupBox'#12'ClientHeight'#3#210#0#11'ClientWidth'#3'%'
|
||||
+#1#5'Ctl3D'#8#8'TabOrder'#2#1#0#11'TStringGrid'#16'ValuesStringGrid'#4'Left'
|
||||
+#2#0#6'Height'#2'_'#3'Top'#2#0#5'Width'#3'%'#1#5'Align'#7#8'alClient'#8'ColC'
|
||||
+'ount'#2#2#9'FixedCols'#2#0#7'Options'#11#15'goFixedVertLine'#15'goFixedHorz'
|
||||
+'Line'#10'goVertLine'#10'goHorzLine'#13'goRangeSelect'#11'goColSizing'#9'goE'
|
||||
+'diting'#18'goDblClickAutoSize'#14'goSmoothScroll'#0#8'TabOrder'#2#0#0#0#9'T'
|
||||
+'GroupBox'#20'DefaultValueGroupBox'#4'Left'#2#0#6'Height'#2'm'#3'Top'#2'e'#5
|
||||
+'Width'#3'%'#1#5'Align'#7#8'alBottom'#7'Caption'#6#20'DefaultValueGroupBox'
|
||||
+#12'ClientHeight'#2'Z'#11'ClientWidth'#3'!'#1#5'Ctl3D'#8#8'TabOrder'#2#1#0
|
||||
+#244#26'TCompOptsConditionalsFrame'#18'DefaultValueEditor'#6'Height'#2'Z'#5
|
||||
+'Width'#3'!'#1#5'Align'#7#8'alClient'#12'ClientHeight'#2'V'#11'ClientWidth'#3
|
||||
+#29#1#7'Visible'#9#10'DesignLeft'#3#178#1#9'DesignTop'#3'I'#1#0#241#9'TTreeV'
|
||||
+'iew'#11'COCTreeView'#6'Height'#2'V'#5'Width'#3#29#1#0#0#241#10'TPopupMenu'
|
||||
+#12'COCPopupMenu'#0#241#9'TMenuItem'#19'InsertAboveMenuItem'#0#0#241#9'TMenu'
|
||||
+'Item'#19'InsertBelowMenuItem'#0#0#241#9'TMenuItem'#19'InsertChildMenuItem'#0
|
||||
+#0#241#9'TMenuItem'#14'DeleteMenuItem'#0#0#241#9'TMenuItem'#14'MoveUpMenuIte'
|
||||
+'m'#0#0#241#9'TMenuItem'#16'MoveDownMenuItem'#0#0#241#9'TMenuItem'#17'MoveLv'
|
||||
+'lUpMenuItem'#0#0#241#9'TMenuItem'#19'MoveLvlDownMenuItem'#0#0#241#9'TMenuIt'
|
||||
+'em'#18'PropertiesMenuItem'#0#0#0#0#0#9'TSplitter'#14'ValuesSplitter'#6'Curs'
|
||||
+'or'#7#8'crVSplit'#4'Left'#2#0#6'Height'#2#6#3'Top'#2'_'#5'Width'#3'%'#1#5'A'
|
||||
+'lign'#7#8'alBottom'#12'ResizeAnchor'#7#8'akBottom'#0#0#0#9'TSplitter'#12'Ma'
|
||||
+'inSplitter'#4'Left'#3#186#0#6'Height'#3#229#0#3'Top'#2#0#5'Width'#2#5#0#0#0
|
||||
]);
|
||||
|
@ -36,9 +36,9 @@ type
|
||||
TCompOptBuildModesFrame = class(TFrame)
|
||||
DefaultValueEditor: TCompOptsConditionalsFrame;
|
||||
DefaultValueGroupBox: TGroupBox;
|
||||
ModesGrid: TStringGrid;
|
||||
ValuesGroupBox: TGroupBox;
|
||||
ModesGroupBox: TGroupBox;
|
||||
ModesListBox: TListBox;
|
||||
NewSpeedButton: TSpeedButton;
|
||||
DeleteSpeedButton: TSpeedButton;
|
||||
MoveDownSpeedButton: TSpeedButton;
|
||||
@ -69,8 +69,14 @@ implementation
|
||||
{ TCompOptBuildModesFrame }
|
||||
|
||||
procedure TCompOptBuildModesFrame.NewSpeedButtonClick(Sender: TObject);
|
||||
var
|
||||
NewIdentifier: String;
|
||||
begin
|
||||
|
||||
NewIdentifier:=GlobalBuildModeSet.GetUniqueModeName;
|
||||
BuildModes.Add(NewIdentifier);
|
||||
ModesGrid.RowCount:=BuildModes.Count;
|
||||
ModesGrid.Cells[0,BuildModes.Count-1]:=NewIdentifier;
|
||||
ModesGrid.Row:=BuildModes.Count-1;
|
||||
end;
|
||||
|
||||
procedure TCompOptBuildModesFrame.DeleteSpeedButtonClick(Sender: TObject);
|
||||
@ -79,16 +85,16 @@ var
|
||||
i: LongInt;
|
||||
begin
|
||||
if not GetSelectedBuildMode(BuildMode) then exit;
|
||||
i:=ModesListBox.ItemIndex;
|
||||
i:=ModesGrid.Row;
|
||||
if MessageDlg('Confirm delete',
|
||||
'Delete build mode "'+BuildMode.Identifier+'"?',
|
||||
mtConfirmation,[mbYes,mbCancel],0)<>mrYes
|
||||
then exit;
|
||||
BuildModes.Delete(i);
|
||||
ModesListBox.Items.Delete(i);
|
||||
if i=ModesListBox.Items.Count then
|
||||
ModesGrid.DeleteColRow(true,i);
|
||||
if i=ModesGrid.RowCount then
|
||||
dec(i);
|
||||
ModesListBox.ItemIndex:=i;
|
||||
ModesGrid.Row:=i;
|
||||
end;
|
||||
|
||||
procedure TCompOptBuildModesFrame.MoveDownSpeedButtonClick(Sender: TObject);
|
||||
@ -97,11 +103,12 @@ var
|
||||
BuildMode: TIDEBuildMode;
|
||||
begin
|
||||
if not GetSelectedBuildMode(BuildMode) then exit;
|
||||
i:=ModesListBox.ItemIndex;
|
||||
if i<ModesListBox.Items.Count-1 then begin
|
||||
i:=ModesGrid.Row;
|
||||
if i<ModesGrid.Row-1 then begin
|
||||
BuildModes.Move(i,i+1);
|
||||
ModesListBox.Items.Move(i,i+1);
|
||||
ModesListBox.ItemIndex:=i+1;
|
||||
ModesGrid.Cells[0,i]:=BuildModes.Items[i].Identifier;
|
||||
ModesGrid.Cells[0,i+1]:=BuildModes.Items[i+1].Identifier;
|
||||
ModesGrid.Row:=i+1;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -111,11 +118,12 @@ var
|
||||
BuildMode: TIDEBuildMode;
|
||||
begin
|
||||
if not GetSelectedBuildMode(BuildMode) then exit;
|
||||
i:=ModesListBox.ItemIndex;
|
||||
i:=ModesGrid.Row;
|
||||
if i>0 then begin
|
||||
BuildModes.Move(i,i-1);
|
||||
ModesListBox.Items.Move(i,i-1);
|
||||
ModesListBox.ItemIndex:=i-1;
|
||||
ModesGrid.Cells[0,i]:=BuildModes.Items[i].Identifier;
|
||||
ModesGrid.Cells[0,i-1]:=BuildModes.Items[i-1].Identifier;
|
||||
ModesGrid.Row:=i-1;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -130,14 +138,14 @@ procedure TCompOptBuildModesFrame.UpdateModes;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
ModesListBox.Items.BeginUpdate;
|
||||
ModesListBox.Items.Clear;
|
||||
ModesGrid.BeginUpdate;
|
||||
ModesGrid.ColCount:=1;
|
||||
ModesGrid.RowCount:=BuildModes.Count;
|
||||
if BuildModes<>nil then begin
|
||||
for i:=0 to BuildModes.Count-1 do begin
|
||||
ModesListBox.Items.Add(BuildModes.Items[i].Identifier);
|
||||
end;
|
||||
for i:=0 to BuildModes.Count-1 do
|
||||
ModesGrid.Cells[0,i]:=BuildModes.Items[i].Identifier;
|
||||
end;
|
||||
ModesListBox.Items.EndUpdate;
|
||||
ModesGrid.EndUpdate;
|
||||
UpdateValues;
|
||||
UpdateButtons;
|
||||
end;
|
||||
@ -177,10 +185,10 @@ end;
|
||||
procedure TCompOptBuildModesFrame.UpdateButtons;
|
||||
begin
|
||||
NewSpeedButton.Enabled:=BuildModes<>nil;
|
||||
DeleteSpeedButton.Enabled:=(ModesListBox.ItemIndex>=0);
|
||||
MoveDownSpeedButton.Enabled:=(ModesListBox.ItemIndex>=0)
|
||||
and (ModesListBox.ItemIndex<ModesListBox.Items.Count-1);
|
||||
MoveUpSpeedButton.Enabled:=(ModesListBox.ItemIndex>0);
|
||||
DeleteSpeedButton.Enabled:=(ModesGrid.Row>=0);
|
||||
MoveDownSpeedButton.Enabled:=(ModesGrid.Row>=0)
|
||||
and (ModesGrid.Row<ModesGrid.RowCount-1);
|
||||
MoveUpSpeedButton.Enabled:=(ModesGrid.Row>0);
|
||||
end;
|
||||
|
||||
function TCompOptBuildModesFrame.GetSelectedBuildMode(
|
||||
@ -188,8 +196,8 @@ function TCompOptBuildModesFrame.GetSelectedBuildMode(
|
||||
begin
|
||||
BuildMode:=nil;
|
||||
if BuildModes=nil then exit(false);
|
||||
if ModesListBox.ItemIndex<0 then exit(false);
|
||||
BuildMode:=TIDEBuildMode(BuildModes.Items[ModesListBox.ItemIndex]);
|
||||
if ModesGrid.Row<0 then exit(false);
|
||||
BuildMode:=TIDEBuildMode(BuildModes.Items[ModesGrid.Row]);
|
||||
Result:=true;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user