IDE: mode matrix: editing targets

git-svn-id: trunk@40958 -
This commit is contained in:
mattias 2013-04-30 16:35:12 +00:00
parent 48f88c37ef
commit c527f83790

View File

@ -1,3 +1,24 @@
{
***************************************************************************
* *
* This source is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This code is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* General Public License for more details. *
* *
* A copy of the GNU General Public License is available on the World *
* Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
* obtain it by writing to the Free Software Foundation, *
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
***************************************************************************
}
unit ModeMatrixCtrl; unit ModeMatrixCtrl;
{$mode objfpc}{$H+} {$mode objfpc}{$H+}
@ -243,6 +264,8 @@ type
procedure Redo; procedure Redo;
property MaxUndo: integer read FMaxUndo write SetMaxUndo default DefaultModeMatrixMaxUndo; property MaxUndo: integer read FMaxUndo write SetMaxUndo default DefaultModeMatrixMaxUndo;
procedure StoreUndo(EvenIfNothingChanged: boolean = false); procedure StoreUndo(EvenIfNothingChanged: boolean = false);
public
property TitleStyle default tsNative;
end; end;
function VerticalIntersect(const aRect,bRect: TRect): boolean; function VerticalIntersect(const aRect,bRect: TRect): boolean;
@ -1234,6 +1257,7 @@ var
aCol: Longint; aCol: Longint;
aRow: Longint; aRow: Longint;
MatRow: TGroupedMatrixRow; MatRow: TGroupedMatrixRow;
GroupRow: TGroupedMatrixGroup;
begin begin
inherited MouseDown(Button, Shift, X, Y); inherited MouseDown(Button, Shift, X, Y);
if (csDesigning in componentState) or not MouseButtonAllowed(Button) then if (csDesigning in componentState) or not MouseButtonAllowed(Button) then
@ -1247,7 +1271,6 @@ begin
if MatRow is TGroupedMatrixValue then begin if MatRow is TGroupedMatrixValue then begin
if (aCol>=ModeColFirst) and (aCol<=ModeColLast) then begin if (aCol>=ModeColFirst) and (aCol<=ModeColLast) then begin
if Shift*[ssCtrl,ssShift,ssLeft]=[ssLeft] then begin if Shift*[ssCtrl,ssShift,ssLeft]=[ssLeft] then begin
// toggle a matrix cell
ToggleModeValue(aRow, aCol); ToggleModeValue(aRow, aCol);
end; end;
end else if aCol=TypeCol then begin end else if aCol=TypeCol then begin
@ -1258,6 +1281,12 @@ begin
SelectEditor; SelectEditor;
EditorShow(False); EditorShow(False);
end; end;
end else if MatRow is TGroupedMatrixGroup then begin
GroupRow:=TGroupedMatrixGroup(MatRow);
if (aCol=ValueCol) and (GroupRow.Writable) then begin
SelectEditor;
EditorShow(False);
end;
end; end;
end; end;
end; end;
@ -1301,7 +1330,7 @@ begin
if MatRow is TGroupedMatrixValue then if MatRow is TGroupedMatrixValue then
Result:=TGroupedMatrixValue(MatRow).Value Result:=TGroupedMatrixValue(MatRow).Value
else else
Result:=TGroupedMatrixGroup(MatRow).Caption; Result:=TGroupedMatrixGroup(MatRow).Value;
exit; exit;
end; end;
Result:=inherited GetEditText(aCol, aRow); Result:=inherited GetEditText(aCol, aRow);
@ -1326,6 +1355,7 @@ begin
if GroupRow.Value=Value then exit; if GroupRow.Value=Value then exit;
StoreUndo; StoreUndo;
GroupRow.Value:=Value; GroupRow.Value:=Value;
InvalidateRow(ARow);
end; end;
end; end;
inherited SetEditText(ACol, ARow, Value); inherited SetEditText(ACol, ARow, Value);
@ -1356,10 +1386,8 @@ begin
FMaxUndo:=DefaultModeMatrixMaxUndo; FMaxUndo:=DefaultModeMatrixMaxUndo;
Options:=Options+[goEditing]; // ToDo: change property default Options:=Options+[goEditing]; // ToDo: change property default
FixedCols:=1; // ToDo: change property default RowCount:=1;
FixedRows:=1; // ToDo: change property default TitleStyle:=tsNative;
RowCount:=1; // ToDo: change property default
TitleStyle:=tsNative; // ToDo: change property default
AutoFillColumns:=true; AutoFillColumns:=true;
FIndent:=DefaultGroupMatrixIndent; FIndent:=DefaultGroupMatrixIndent;
FActiveModeColor:=RGBToColor(220,255,220); FActiveModeColor:=RGBToColor(220,255,220);