From b5991e8bb6fa2651f285f4786191d46ed2fffcb9 Mon Sep 17 00:00:00 2001 From: mattias Date: Mon, 29 Apr 2013 23:06:59 +0000 Subject: [PATCH] IDE: mode matrix: new target git-svn-id: trunk@40944 - --- ide/frames/compiler_modematrix.pas | 31 +++++++++++++++++++++++++++++- ide/frames/modematrixctrl.pas | 8 +++++++- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/ide/frames/compiler_modematrix.pas b/ide/frames/compiler_modematrix.pas index dda070a09f..d6ec67ab52 100644 --- a/ide/frames/compiler_modematrix.pas +++ b/ide/frames/compiler_modematrix.pas @@ -99,8 +99,37 @@ begin end; procedure TFrame1.BMMNewTargetToolButtonClick(Sender: TObject); +var + aRow: Integer; + MatRow: TGroupedMatrixRow; + Group: TGroupedMatrixGroup; begin - + aRow:=Grid.Row; + if aRow add as first target of storage group + Grid.Matrix.AddGroup(Group,'Target: *'); + Group.Move(Group.Count-1,0); + end else begin + // Group is a target + // => add target behind current target + Grid.Matrix.AddGroup(Group.Group,'Target: *'); + Group.Group.Move(Group.Group.Count-1,Group.GetGroupIndex+1); + end; + Grid.Matrix.RebuildRows; + finally + Grid.MatrixChanged; + end; + UpdateButtons; end; procedure TFrame1.BMMMoveDownToolButtonClick(Sender: TObject); diff --git a/ide/frames/modematrixctrl.pas b/ide/frames/modematrixctrl.pas index 36dfe36b51..f26f2483c3 100644 --- a/ide/frames/modematrixctrl.pas +++ b/ide/frames/modematrixctrl.pas @@ -67,6 +67,7 @@ type property Count: integer read GetCount; property Items[Index: integer]: TGroupedMatrixRow read GetItems; default; function IndexOfRow(aRow: TGroupedMatrixRow): integer; + procedure Move(CurIndex, NewIndex: integer); function GetNext: TGroupedMatrixRow; override; function GetLastLeaf: TGroupedMatrixRow; override; property Color: TColor read FColor write SetColor; @@ -141,13 +142,13 @@ type function GetTopLvlCount: integer; function GetTopLvlItems(Index: integer): TGroupedMatrixRow; procedure InternalAdd(Group: TGroupedMatrixGroup; Row: TGroupedMatrixRow); - procedure RebuildRows; public procedure Assign(Source: TPersistent); override; constructor Create(aControl: TGroupedMatrixControl); destructor Destroy; override; procedure Clear; function Equals(Obj: TObject): boolean; override; + procedure RebuildRows; property RowCount: integer read GetRowCount; property Rows[Index: integer]: TGroupedMatrixRow read GetRows; default; procedure DeleteRow(Index: integer); @@ -731,6 +732,11 @@ begin Result:=-1; end; +procedure TGroupedMatrixGroup.Move(CurIndex, NewIndex: integer); +begin + FItems.Move(CurIndex,NewIndex); +end; + function TGroupedMatrixGroup.GetNext: TGroupedMatrixRow; begin if Count>0 then