IDE: Hide build modes in "Additions and Overrides" when UseBuildModes=False.

git-svn-id: trunk@42035 -
This commit is contained in:
juha 2013-07-09 11:40:17 +00:00
parent 24630c451b
commit 659c0cca28
2 changed files with 41 additions and 28 deletions

View File

@ -665,8 +665,9 @@ var
begin begin
if aTyp='' then if aTyp='' then
aTyp:=Grid.TypeColumn.PickList.Names[0]; aTyp:=Grid.TypeColumn.PickList.Names[0];
NewRow:=Grid.Matrix.AddValue(Group,Grid.Modes[Grid.ActiveMode].Caption,aTyp, if EnvironmentOptions.UseBuildModes then
aValue,CreateBuildMatrixOptionGUID); NewRow:=Grid.Matrix.AddValue(Group,Grid.Modes[Grid.ActiveMode].Caption,aTyp,
aValue,CreateBuildMatrixOptionGUID);
end; end;
begin begin
@ -827,41 +828,47 @@ end;
procedure TCompOptModeMatrixFrame.UpdateModes(UpdateGrid: boolean); procedure TCompOptModeMatrixFrame.UpdateModes(UpdateGrid: boolean);
var var
i: Integer; i: Integer;
BuildMode: TProjectBuildMode;
aColor: TColor; aColor: TColor;
GridHasChanged: Boolean; GridHasChanged: Boolean;
aMode: TGroupedMatrixMode;
BuildModes: TProjectBuildModes;
ValuesHaveChanged: Boolean; ValuesHaveChanged: Boolean;
aMode: TGroupedMatrixMode;
BuildMode: TProjectBuildMode;
BuildModes: TProjectBuildModes;
BuildModeCount: integer;
begin begin
GridHasChanged:=false; GridHasChanged:=false;
ValuesHaveChanged:=false; ValuesHaveChanged:=false;
// add/update build modes // add/update build modes
BuildModes:=LazProject.BuildModes; BuildModes:=LazProject.BuildModes;
for i:=0 to BuildModes.Count-1 do begin if EnvironmentOptions.UseBuildModes then begin
BuildMode:=BuildModes[i]; for i:=0 to BuildModes.Count-1 do begin
aColor:=clDefault; BuildMode:=BuildModes[i];
if BuildMode.InSession then aColor:=SessionColor; aColor:=clDefault;
if i=Grid.Modes.Count then begin if BuildMode.InSession then aColor:=SessionColor;
Grid.Modes.Add(BuildMode.Identifier,aColor); if i=Grid.Modes.Count then begin
GridHasChanged:=true; Grid.Modes.Add(BuildMode.Identifier,aColor);
end
else begin
aMode:=Grid.Modes[i];
//debugln(['TCompOptModeMatrix.UpdateModes aMode.Caption=',aMode.Caption,' BuildMode.Identifier=',BuildMode.Identifier]);
if aMode.Caption<>BuildMode.Identifier then begin
aMode.Caption:=BuildMode.Identifier;
GridHasChanged:=true; GridHasChanged:=true;
end; end
if aMode.Color<>aColor then begin else begin
ValuesHaveChanged:=true; aMode:=Grid.Modes[i];
aMode.Color:=aColor; //debugln(['TCompOptModeMatrix.UpdateModes aMode.Caption=',aMode.Caption,' BuildMode.Identifier=',BuildMode.Identifier]);
if aMode.Caption<>BuildMode.Identifier then begin
aMode.Caption:=BuildMode.Identifier;
GridHasChanged:=true;
end;
if aMode.Color<>aColor then begin
ValuesHaveChanged:=true;
aMode.Color:=aColor;
end;
end; end;
end; end;
end; BuildModeCount:=BuildModes.Count;
// delete build modes end
while Grid.Modes.Count>BuildModes.Count do begin else
BuildModeCount:=0;
// delete leftover build modes
while Grid.Modes.Count>BuildModeCount do begin
Grid.Modes.Delete(Grid.Modes.Count-1); Grid.Modes.Delete(Grid.Modes.Count-1);
GridHasChanged:=true; GridHasChanged:=true;
end; end;
@ -883,9 +890,11 @@ procedure TCompOptModeMatrixFrame.UpdateActiveMode;
var var
i: Integer; i: Integer;
begin begin
if LazProject=nil then exit; if EnvironmentOptions.UseBuildModes then
i:=LazProject.BuildModes.IndexOf(LazProject.ActiveBuildMode); i:=LazProject.BuildModes.IndexOf(LazProject.ActiveBuildMode)
if (i<0) or (i>=Grid.Modes.Count) then exit; else
i:=-1;
if i>=Grid.Modes.Count then exit;
Grid.ActiveMode:=i; Grid.ActiveMode:=i;
end; end;

View File

@ -598,6 +598,7 @@ end;
procedure TIDEOptionsDialog.UpdateBuildModeButtons; procedure TIDEOptionsDialog.UpdateBuildModeButtons;
var var
ManyBuildModes: Boolean; ManyBuildModes: Boolean;
ModeMatrix: TCompOptModeMatrixFrame;
begin begin
ManyBuildModes:=Project1.BuildModes.Count > 1; ManyBuildModes:=Project1.BuildModes.Count > 1;
if ManyBuildModes then if ManyBuildModes then
@ -606,6 +607,9 @@ begin
UseBuildModeCheckBox.Visible := not ManyBuildModes; UseBuildModeCheckBox.Visible := not ManyBuildModes;
BuildModeComboBox.Visible := EnvironmentOptions.UseBuildModes; BuildModeComboBox.Visible := EnvironmentOptions.UseBuildModes;
BuildModeManageButton.Visible := EnvironmentOptions.UseBuildModes; BuildModeManageButton.Visible := EnvironmentOptions.UseBuildModes;
ModeMatrix:=TCompOptModeMatrixFrame(FindEditor(TCompOptModeMatrixFrame));
if Assigned(ModeMatrix) then
ModeMatrix.UpdateModes;
end; end;
procedure TIDEOptionsDialog.SetBuildModeVisibility(AVisibility: Boolean); procedure TIDEOptionsDialog.SetBuildModeVisibility(AVisibility: Boolean);