IDE: Do not clear out settings under "Additions and Overrides" after renaming a build mode. Issue #35572.

git-svn-id: trunk@62120 -
This commit is contained in:
juha 2019-10-26 05:59:32 +00:00
parent 18912d2ef6
commit f625e656d0
3 changed files with 23 additions and 45 deletions

View File

@ -443,17 +443,19 @@ end;
procedure TBuildModesForm.RenameButtonClick(Sender: TObject);
var
CurMode: TProjectBuildMode;
Value: string;
Value, OldValue: string;
i: Integer;
begin
i:=BuildModesStringGrid.Row-1;
if (i<0) then exit;
CurMode:=fBuildModes[i];
Value:=CurMode.Identifier;
OldValue:=Value;
if InputQuery(lisRename, lisUIDName, Value) then
begin
CurMode.Identifier:=Value;
FillBuildModesGrid;
ModeMatrixFrame.Grid.RenameMode(OldValue, Value);
end;
end;

View File

@ -126,8 +126,6 @@ type
procedure CreateNewOption(aTyp, aValue: string);
procedure CreateNewTarget;
function GetCaptionValue(aCaption, aPattern: string): string;
procedure UpdateEnabledModesInGrid(Options: TBuildMatrixOptions;
StorageGroup: TGroupedMatrixGroup; var HasChanged: boolean);
procedure UpdateGridStorageGroups;
protected
procedure VisibleChanged; override;
@ -852,41 +850,6 @@ begin
Result:=copy(aCaption,p,length(aCaption)-length(aPattern)+2);
end;
procedure TCompOptModeMatrixFrame.UpdateEnabledModesInGrid(
Options: TBuildMatrixOptions; StorageGroup: TGroupedMatrixGroup;
var HasChanged: boolean);
// update enabled modes in grid
var
GrpIndex: Integer;
Target: TGroupedMatrixGroup;
i: Integer;
ValueRow: TGroupedMatrixValue;
OptionIndex: Integer;
Option: TBuildMatrixOption;
begin
OptionIndex:=0;
for GrpIndex:=0 to StorageGroup.Count-1 do begin
Target:=TGroupedMatrixGroup(StorageGroup[GrpIndex]);
if not (Target is TGroupedMatrixGroup) then
exit;
//debugln(['TCompOptModeMatrix.UpdateEnabledModesInGrid Target=',Target.AsString]);
for i:=0 to Target.Count-1 do begin
ValueRow:=TGroupedMatrixValue(Target[i]);
if not (ValueRow is TGroupedMatrixValue) then
exit;
//debugln(['TCompOptModeMatrix.UpdateEnabledModesInGrid ValueRow=',ValueRow.AsString]);
if OptionIndex>=Options.Count then exit;
Option:=Options[OptionIndex];
//debugln(['TCompOptModeMatrix.UpdateEnabledModesInGrid Option.Modes="',dbgstr(Option.Modes),'" ValueRow.GetNormalizedModes="',dbgstr(ValueRow.GetNormalizedModes),'"']);
if Option.Modes<>ValueRow.GetNormalizedModes then begin
HasChanged:=true;
ValueRow.ModeList.Text:=Option.Modes;
end;
inc(OptionIndex);
end;
end;
end;
procedure TCompOptModeMatrixFrame.UpdateGridStorageGroups;
var
i, j: Integer;
@ -1021,14 +984,7 @@ begin
Grid.Modes.Delete(Grid.Modes.Count-1);
GridHasChanged:=true;
end;
UpdateEnabledModesInGrid(EnvironmentOptions.BuildMatrixOptions,GroupIDE,ValuesHaveChanged);
UpdateEnabledModesInGrid(LazProject.BuildModes.SharedMatrixOptions,GroupProject,ValuesHaveChanged);
UpdateEnabledModesInGrid(LazProject.BuildModes.SessionMatrixOptions,GroupSession,ValuesHaveChanged);
UpdateActiveMode;
//debugln(['TCompOptModeMatrix.UpdateModes UpdateGrid=',UpdateGrid,' GridHasChanged=',GridHasChanged]);
if UpdateGrid and GridHasChanged then
Grid.MatrixChanged
else if GridHasChanged or ValuesHaveChanged then

View File

@ -265,6 +265,7 @@ type
procedure MatrixChanging;
procedure MatrixChanged;
procedure DeleteMatrixRow(aRow: integer);
procedure RenameMode(aOldName, aNewName: string);
function ModeColFirst: integer;
function ModeColLast: integer;
function TypeCol: integer;
@ -1652,6 +1653,25 @@ begin
end;
end;
procedure TGroupedMatrixControl.RenameMode(aOldName, aNewName: string);
var
iRow, iMod: Integer;
MatRow: TGroupedMatrixRow;
ValRow: TGroupedMatrixValue;
begin
for iRow:=0 to Matrix.RowCount-1 do
begin
MatRow:=Matrix.Rows[iRow];
if MatRow is TGroupedMatrixValue then
begin
ValRow:=TGroupedMatrixValue(MatRow);
iMod:=IndexInStringList(ValRow.ModeList,cstCaseInsensitive,aOldName);
if iMod>=0 then
ValRow.ModeList[iMod]:=aNewName;
end;
end;
end;
function TGroupedMatrixControl.ModeColFirst: integer;
begin
Result:=1;