diff --git a/ide/buildmodesmanager.pas b/ide/buildmodesmanager.pas index eb58e48da6..0c59fd6be4 100644 --- a/ide/buildmodesmanager.pas +++ b/ide/buildmodesmanager.pas @@ -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; diff --git a/ide/frames/compiler_modematrix.pas b/ide/frames/compiler_modematrix.pas index e3fff48bab..f35224dcf5 100644 --- a/ide/frames/compiler_modematrix.pas +++ b/ide/frames/compiler_modematrix.pas @@ -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 diff --git a/ide/frames/modematrixctrl.pas b/ide/frames/modematrixctrl.pas index 56449fce56..c07f82770e 100644 --- a/ide/frames/modematrixctrl.pas +++ b/ide/frames/modematrixctrl.pas @@ -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;