IDE: mode matrix: fixed updating storagegroups after undo/redo

git-svn-id: trunk@41518 -
This commit is contained in:
mattias 2013-06-03 18:16:52 +00:00
parent 822ca4c2e1
commit bdc3c94a83

View File

@ -39,8 +39,7 @@ interface
uses uses
Classes, SysUtils, types, LazLogger, Controls, Graphics, ComCtrls, Menus, Classes, SysUtils, types, LazLogger, Controls, Graphics, ComCtrls, Menus,
IDEOptionsIntf, IDEImagesIntf, CompOptsIntf, LCLProc, IDEOptionsIntf, IDEImagesIntf, CompOptsIntf, EnvironmentOpts,
EnvironmentOpts,
PackageSystem, PackageDefs, Project, LazarusIDEStrConsts, TransferMacros, PackageSystem, PackageDefs, Project, LazarusIDEStrConsts, TransferMacros,
ModeMatrixOpts, ModeMatrixCtrl; ModeMatrixOpts, ModeMatrixCtrl;
@ -107,6 +106,7 @@ type
function GetCaptionValue(aCaption, aPattern: string): string; function GetCaptionValue(aCaption, aPattern: string): string;
procedure UpdateEnabledModesInGrid(Options: TBuildMatrixOptions; procedure UpdateEnabledModesInGrid(Options: TBuildMatrixOptions;
StorageGroup: TGroupedMatrixGroup; var HasChanged: boolean); StorageGroup: TGroupedMatrixGroup; var HasChanged: boolean);
procedure UpdateGridStorageGroups;
protected protected
procedure VisibleChanged; override; procedure VisibleChanged; override;
public public
@ -480,6 +480,7 @@ end;
procedure TCompOptModeMatrix.BMMUndoToolButtonClick(Sender: TObject); procedure TCompOptModeMatrix.BMMUndoToolButtonClick(Sender: TObject);
begin begin
Grid.Undo; Grid.Undo;
UpdateGridStorageGroups;
UpdateButtons; UpdateButtons;
end; end;
@ -536,6 +537,7 @@ end;
procedure TCompOptModeMatrix.BMMRedoToolButtonClick(Sender: TObject); procedure TCompOptModeMatrix.BMMRedoToolButtonClick(Sender: TObject);
begin begin
Grid.Redo; Grid.Redo;
UpdateGridStorageGroups;
UpdateButtons; UpdateButtons;
end; end;
@ -783,6 +785,33 @@ begin
end; end;
end; end;
procedure TCompOptModeMatrix.UpdateGridStorageGroups;
var
i: Integer;
MatRow: TGroupedMatrixRow;
GroupRow: TGroupedMatrixGroup;
j: Integer;
begin
fGroupIDE:=nil;
fGroupProject:=nil;
fGroupSession:=nil;
j:=0;
for i:=0 to Grid.Matrix.RowCount-1 do begin
MatRow:=Grid.Matrix.Rows[i];
if (MatRow.Group=nil) and (MatRow is TGroupedMatrixGroup) then begin
GroupRow:=TGroupedMatrixGroup(MatRow);
inc(j);
case j of
1: fGroupIDE:=GroupRow;
2: fGroupProject:=GroupRow;
3: fGroupSession:=GroupRow;
end;
end;
end;
if fGroupSession=nil then
raise Exception.Create('grid lost the session storage group');
end;
procedure TCompOptModeMatrix.VisibleChanged; procedure TCompOptModeMatrix.VisibleChanged;
begin begin
inherited VisibleChanged; inherited VisibleChanged;