mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-30 21:50:18 +02:00
IDE: mode matrix: delete
git-svn-id: trunk@40943 -
This commit is contained in:
parent
1b2f18ecea
commit
3ca47329ed
@ -109,8 +109,19 @@ begin
|
||||
end;
|
||||
|
||||
procedure TFrame1.BMMDeleteToolButtonClick(Sender: TObject);
|
||||
var
|
||||
aRow: Integer;
|
||||
MatRow: TGroupedMatrixRow;
|
||||
begin
|
||||
|
||||
aRow:=Grid.Row;
|
||||
if aRow<1 then exit;
|
||||
MatRow:=Grid.Matrix[aRow-1];
|
||||
if MatRow.Group=nil then begin
|
||||
// storage groups can not be deleted
|
||||
exit;
|
||||
end;
|
||||
Grid.DeleteMatrixRow(aRow);
|
||||
UpdateButtons;
|
||||
end;
|
||||
|
||||
procedure TFrame1.UpdateButtons;
|
||||
|
@ -150,6 +150,7 @@ type
|
||||
function Equals(Obj: TObject): boolean; override;
|
||||
property RowCount: integer read GetRowCount;
|
||||
property Rows[Index: integer]: TGroupedMatrixRow read GetRows; default;
|
||||
procedure DeleteRow(Index: integer);
|
||||
function IndexOfRow(Row: TGroupedMatrixRow): integer;
|
||||
property TopLvlCount: integer read GetTopLvlCount;
|
||||
property TopLvlItems[Index: integer]: TGroupedMatrixRow read GetTopLvlItems;
|
||||
@ -221,6 +222,7 @@ type
|
||||
property Modes: TGroupedMatrixModes read GetModes;
|
||||
procedure MatrixChanging;
|
||||
procedure MatrixChanged;
|
||||
procedure DeleteMatrixRow(aRow: integer);
|
||||
property ActiveMode: integer read FActiveMode write SetActiveMode;
|
||||
function ModeColFirst: integer;
|
||||
function ModeColLast: integer;
|
||||
@ -237,7 +239,7 @@ type
|
||||
procedure Undo;
|
||||
procedure Redo;
|
||||
property MaxUndo: integer read FMaxUndo write SetMaxUndo default DefaultModeMatrixMaxUndo;
|
||||
procedure StoreUndo(EvenIfNothingChanged: boolean);
|
||||
procedure StoreUndo(EvenIfNothingChanged: boolean = false);
|
||||
end;
|
||||
|
||||
function VerticalIntersect(const aRect,bRect: TRect): boolean;
|
||||
@ -490,6 +492,12 @@ begin
|
||||
Result:=true;
|
||||
end;
|
||||
|
||||
procedure TGroupedMatrix.DeleteRow(Index: integer);
|
||||
begin
|
||||
Rows[Index].Free;
|
||||
RebuildRows;
|
||||
end;
|
||||
|
||||
function TGroupedMatrix.IndexOfRow(Row: TGroupedMatrixRow): integer;
|
||||
begin
|
||||
for Result:=0 to RowCount-1 do
|
||||
@ -970,7 +978,7 @@ begin
|
||||
ValueRow:=TGroupedMatrixValue(Matrix[fTypePopupMenuRow-1]);
|
||||
NewType:=TypeColumn.PickList.Names[Item.MenuIndex];
|
||||
if NewType=ValueRow.Typ then exit;
|
||||
StoreUndo(false);
|
||||
StoreUndo;
|
||||
ValueRow.Typ:=NewType;
|
||||
InvalidateCell(TypeCol,fTypePopupMenuRow);
|
||||
EditingDone;
|
||||
@ -1153,7 +1161,7 @@ begin
|
||||
ModeName:=Modes[aCol-1].Caption;
|
||||
i:=ValueRow.Modes.IndexOf(ModeName);
|
||||
if (i<0) = (aState=cbUnchecked) then exit;
|
||||
StoreUndo(false);
|
||||
StoreUndo;
|
||||
if i>=0 then begin
|
||||
ValueRow.Modes.Delete(i);
|
||||
end else begin
|
||||
@ -1298,7 +1306,7 @@ begin
|
||||
then begin
|
||||
ValueRow:=TGroupedMatrixValue(Matrix[aRow-1]);
|
||||
if ValueRow.Value=Value then exit;
|
||||
StoreUndo(false);
|
||||
StoreUndo;
|
||||
ValueRow.Value:=Value;
|
||||
end;
|
||||
inherited SetEditText(ACol, ARow, Value);
|
||||
@ -1464,6 +1472,18 @@ begin
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
procedure TGroupedMatrixControl.DeleteMatrixRow(aRow: integer);
|
||||
begin
|
||||
if (aRow<FixedRows) or (aRow>=RowCount) then exit;
|
||||
MatrixChanging;
|
||||
try
|
||||
StoreUndo;
|
||||
Matrix.DeleteRow(aRow-1);
|
||||
finally
|
||||
MatrixChanged;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TGroupedMatrixControl.ModeColFirst: integer;
|
||||
begin
|
||||
Result:=1;
|
||||
|
Loading…
Reference in New Issue
Block a user