replaced zoom in/out toolbuttons with hotkeys

This commit is contained in:
zueuk 2006-04-18 14:52:37 +00:00
parent d116ed5874
commit 666b0e18d7
2 changed files with 98 additions and 147 deletions

View File

@ -54,7 +54,7 @@ object EditForm: TEditForm
TextHeight = 13
object StatusBar: TStatusBar
Left = 0
Top = 524
Top = 530
Width = 576
Height = 15
Panels = <
@ -81,7 +81,7 @@ object EditForm: TEditForm
object EditorToolBar: TToolBar
Left = 1
Top = 1
Width = 568
Width = 552
Height = 22
Align = alLeft
ButtonWidth = 25
@ -228,22 +228,8 @@ object EditForm: TEditForm
Style = tbsCheck
OnClick = tbExtendedEditClick
end
object tbZoomOut: TToolButton
Left = 291
Top = 0
Caption = 'tbZoomOut'
ImageIndex = 26
OnClick = tbZoomOutClick
end
object tbZoomIn: TToolButton
Left = 316
Top = 0
Caption = 'tbZoomIn'
ImageIndex = 27
OnClick = tbZoomInClick
end
object ToolButton6: TToolButton
Left = 341
Left = 291
Top = 0
Width = 8
Caption = 'ToolButton6'
@ -251,10 +237,11 @@ object EditForm: TEditForm
Style = tbsSeparator
end
object tbAxisLock: TToolButton
Left = 349
Left = 299
Top = 0
Hint = 'Lock transform axis'
Caption = 'tbAxisLock'
Down = True
ImageIndex = 16
ParentShowHint = False
ShowHint = True
@ -263,7 +250,7 @@ object EditForm: TEditForm
OnClick = tbAxisLockClick
end
object tbPivotMode: TToolButton
Left = 374
Left = 324
Top = 0
Hint = 'Toggle world pivot mode'
Caption = 'tbPivotMode'
@ -274,7 +261,7 @@ object EditForm: TEditForm
OnClick = btnPivotModeClick
end
object ToolButton5: TToolButton
Left = 399
Left = 349
Top = 0
Width = 8
Caption = 'ToolButton5'
@ -283,7 +270,7 @@ object EditForm: TEditForm
Visible = False
end
object tbRotate90CCW: TToolButton
Left = 407
Left = 357
Top = 0
Hint = 'Rotate triangle 90'#176' counter-clockwise'
Caption = 'tbRotate90CCW'
@ -293,7 +280,7 @@ object EditForm: TEditForm
OnClick = btTrgRotateLeft90Click
end
object tbRotate90CW: TToolButton
Left = 432
Left = 382
Top = 0
Hint = 'Rotate triangle 90'#176' clockwise'
Caption = 'tbRotate90CW'
@ -303,7 +290,7 @@ object EditForm: TEditForm
OnClick = btTrgRotateRight90Click
end
object tbFlipHorz: TToolButton
Left = 457
Left = 407
Top = 0
Hint = 'Flip triangle horizontal'
Caption = 'Flip Horizontal'
@ -313,7 +300,7 @@ object EditForm: TEditForm
OnClick = mnuFlipHorizontalClick
end
object tbFlipVert: TToolButton
Left = 482
Left = 432
Top = 0
Hint = 'Flip triangle vertical'
Caption = 'Flip Vertical'
@ -323,7 +310,7 @@ object EditForm: TEditForm
OnClick = mnuFlipVerticalClick
end
object ToolButton2: TToolButton
Left = 507
Left = 457
Top = 0
Width = 8
Caption = 'ToolButton2'
@ -331,7 +318,7 @@ object EditForm: TEditForm
Style = tbsSeparator
end
object tbVarPreview: TToolButton
Left = 515
Left = 465
Top = 0
Hint = 'Show/hide variation preview'
Caption = 'Variation Preview'
@ -342,7 +329,7 @@ object EditForm: TEditForm
OnClick = tbVarPreviewClick
end
object ToolButton3: TToolButton
Left = 540
Left = 490
Top = 0
Width = 8
Caption = 'ToolButton3'
@ -350,7 +337,7 @@ object EditForm: TEditForm
Style = tbsSeparator
end
object tbEnableFinalXform: TToolButton
Left = 548
Left = 498
Top = 0
Hint = 'Enable final transform'
Caption = 'Show Final Xform'
@ -366,14 +353,14 @@ object EditForm: TEditForm
Left = 0
Top = 24
Width = 576
Height = 500
Height = 506
Align = alClient
TabOrder = 1
object Splitter1: TSplitter
Left = 394
Top = 1
Width = 9
Height = 498
Height = 504
Align = alRight
AutoSnap = False
Beveled = True
@ -384,7 +371,7 @@ object EditForm: TEditForm
Left = 1
Top = 1
Width = 393
Height = 498
Height = 504
Align = alClient
BevelOuter = bvNone
Color = clAppWorkSpace
@ -394,7 +381,7 @@ object EditForm: TEditForm
Left = 403
Top = 1
Width = 172
Height = 498
Height = 504
Align = alRight
Alignment = taLeftJustify
BevelOuter = bvNone
@ -433,7 +420,7 @@ object EditForm: TEditForm
Left = 0
Top = 138
Width = 172
Height = 360
Height = 366
Align = alClient
TabOrder = 0
object lblTransform: TLabel
@ -464,7 +451,7 @@ object EditForm: TEditForm
end
object PageControl: TPageControl
Left = 1
Top = 26
Top = 32
Width = 170
Height = 333
ActivePage = TriangleTab
@ -1739,7 +1726,7 @@ object EditForm: TEditForm
Left = 313
Top = 40
Bitmap = {
494C01011C001D00040010001000FFFFFFFFFF00FFFFFFFFFFFFFFFF424D3600
494C01011A001D00040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
0000000000003600000028000000400000008000000001002000000000000080
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
@ -1874,10 +1861,10 @@ object EditForm: TEditForm
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000292B2F000000
00002F3236000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000292B2F000000
00002F3236000000000000000000000000000000000000000000FFFFFF000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000FFFFFF000000
00000000000000000000000000000000000000000000FFFFFF00000000000000
000000000000FFFFFF0000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
@ -1890,10 +1877,10 @@ object EditForm: TEditForm
000000000000FFFFFF0000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000003F43480000000000575C
6400000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000003F43480000000000575C
6400000000000000000000000000000000000000000000000000FFFFFF000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000FFFFFF000000
0000000000000000000000000000000000000000000000000000FFFFFF000000
0000FFFFFF000000000000000000000000000000000000000000000000000000
0000000000000000000040606000000000004060600000000000000000000000
@ -1906,89 +1893,89 @@ object EditForm: TEditForm
FF00000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000393C410000000000626871000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000393C410000000000626871000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000FFFFFF000000
0000000000000000000000000000000000000000000000000000FFFFFF000000
0000FFFFFF000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000006E52440033262100382A22000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000006E52440033262100382A22000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000FFFFFF000000
00000000000000000000000000000000000000000000FFFFFF00000000000000
000000000000FFFFFF0000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000008668
5A002A080000B57E5D00EFE4DF00E0CFC500AD7150002D0F0200957464000000
0000000000000000000000000000000000000000000000000000000000008668
5A002A080000B57E5D00EFE4DF00E0CFC500AD7150002D0F0200957464000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00000000000000000000000000FFFFFF00000000000000
000000000000FFFFFF0000000000000000000000000000000000406060000000
0000000000000000000000000000000000000000000000000000000000000000
000040606000000000000000000000000000000000000000000000000000350B
0500E9DAC900FDF5E600FCEFE300FBEDE300FCF3EA00E2D1C8003B160B00A288
800000000000000000000000000000000000000000000000000000000000350B
0500E9DAC900FDF5E600FCEFE300FBEDE300FCF3EA00E2D1C8003B160B00A288
8000000000000000000000000000000000000000000000000000000000000000
0000406060000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000003C2D2400D0AB
9600FCECD800F8DCC700F3D7C500F3D9C900F9E3D100FCF3E400D2B4A1002219
14000000000000000000000000000000000000000000000000003C2D2400D0AB
9600FCECD800F8DCC7000000000000000000F9E3D100FCF3E400D2B4A1002219
1400000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000406060000000
0000000000000000000000000000000000000000000000000000000000000000
000040606000000000000000000000000000000000000000000001010100F6E3
D300F9D1BB00EEBEA500EDBCA200ECC2A800F0CDB800FAE2CD00FEFCE2000000
000000000000000000000000000000000000000000000000000001010100F6E3
D300F9D1BB00EEBEA5000000000000000000F0CDB800FAE2CD00FEFCE2000000
0000406060000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000008000000080000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000FDEA
D900000000000000000000000000000000000000000000000000FFEED3000A08
050000000000000000000000000000000000000000000000000000000000FDEA
D900000000000000000000000000000000000000000000000000FFEED3000A08
0500000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000008000000080000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000FBE2
D300F8BCA300EC9D7F00E6978000E79D8400ECAD8D00F7C4A800EBCAB0000C09
080000000000000000000000000000000000000000000000000000000000FBE2
D300F8BCA300EC9D7F000000000000000000ECAD8D00F7C4A800EBCAB0000C09
0800000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000080000000800000008000000080000000800000008000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000067565100B57C
5F00FDD1BA00F5AD9400F19B7E00F09D8200F6B29500FDC7A400925039006655
500000000000000000000000000000000000000000000000000067565100B57C
5F00FDD1BA00F5AD94000000000000000000F6B29500FDC7A400925039006655
5000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000080000000800000008000000080000000800000008000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000040606000000000004060600000000000000000000000
0000000000000000000000000000000000000000000000000000000000006147
3800BD8B7100FEDECC00FED2BF00FCC0A900FEC7A9008E4C36001D1713000000
0000000000000000000000000000000000000000000000000000000000006147
3800BD8B7100FEDECC00FED2BF00FCC0A900FEC7A9008E4C36001D1713000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000008000000080000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00005144400005030200583B2700452D1F000000000042383400000000000000
0000000000000000000000000000000000000000000000000000000000000000
00005144400005030200583B2700452D1F000000000042383400000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000008000000080000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
@ -2771,11 +2758,11 @@ object EditForm: TEditForm
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000008F11FFFFFFC7FFC78F110EE1FFCFFFCF
8F117C7DFF8FFF8F8383783DFF9FFF9F83C77EFDFF1FFF1F8383FEFFF83FF83F
8111DEF7E01FE01F81119EF3E00FE00F81110001C00FC00FFFFF9EF3C00FC00F
FE7FDEF7C00FC00FFE7FFEFFC00FC00FF81F7EFDC00FC00FF81F783DE01FE01F
FE7F7C7DF03FF03FFE7F0EE1FFFFFFFFFFFFFEFFFFF7FFFFFEFFFEFFFEF7FEFF
000000000000000000000000000000008F11FFFF000000008F110EE100000000
8F117C7D000000008383783D0000000083C77EFD000000008383FEFF00000000
8111DEF70000000081119EF3000000008111000100000000FFFF9EF300000000
FE7FDEF700000000FE7FFEFF00000000F81F7EFD00000000F81F783D00000000
FE7F7C7D00000000FE7F0EE100000000FFFFFEFFFFF7FFFFFEFFFEFFFEF7FEFF
FFFFFEFFFFF7FFFFFEFFFABFFEF7FEFFFFFFFC7FFFD5FFFFFEFFEEFFFEE3FEFB
FFFFF47FFFF7FFFDAA020002AA02AA00FEE7F467FEE7FEE5FECFEECFFECFFECB
FE9FFE9FF69FFE9FFE3FFE3FFA3FFE3FFE7FFE7F007FFE7FFEFFFEFFFAFFFABF
@ -2799,7 +2786,8 @@ object EditForm: TEditForm
C003E001E001E001C003F1F9F1F9F1F9C003F8F90009D8D9C003FC7980098C09
C003F239C609C619C003F319E309E219C003F389F189F009C003F3C1F8C1F8C1
C0030021FC41F061C0070031FE01E231C00FF3F9FF09C719C01FF3FDFF8D8F8D
C03FF3FFFFCFDFDFFFFFF3FFFFEFFFFF}
C03FF3FFFFCFDFDFFFFFF3FFFFEFFFFF00000000000000000000000000000000
000000000000}
end
object TrianglePopup: TPopupMenu
AutoPopup = False

View File

@ -192,8 +192,6 @@ type
tbRotate90CCW: TToolButton;
tbRotate90CW: TToolButton;
chkAxisLock: TCheckBox;
tbZoomOut: TToolButton;
tbZoomIn: TToolButton;
procedure ValidateVariable;
procedure vleVariablesValidate(Sender: TObject; ACol, ARow: Integer; const KeyName, KeyValue: string);
procedure vleVariablesKeyPress(Sender: TObject; var Key: Char);
@ -264,10 +262,6 @@ type
procedure btTrgMoveRightClick(Sender: TObject);
procedure btTrgMoveUpClick(Sender: TObject);
procedure btTrgMoveDownClick(Sender: TObject);
procedure btTrgMoveLUClick(Sender: TObject);
procedure btTrgMoveLDClick(Sender: TObject);
procedure btTrgMoveRUClick(Sender: TObject);
procedure btTrgMoveRDClick(Sender: TObject);
procedure btTrgScaleUpClick(Sender: TObject);
procedure btTrgScaleDownClick(Sender: TObject);
procedure splitterMoved(Sender: TObject);
@ -336,8 +330,6 @@ type
procedure ResetAxisScale(n: integer);
procedure tbExtendedEditClick(Sender: TObject);
procedure tbAxisLockClick(Sender: TObject);
procedure tbZoomOutClick(Sender: TObject);
procedure tbZoomInClick(Sender: TObject);
private
TriangleView: TCustomDrawControl;
@ -1430,7 +1422,6 @@ end;
end;
end;
// if EdgeCaught then
if (mouseOverEdge >= 0) then // highlight edge under cursor
begin
i := (mouseOverEdge + 1) mod 3;
@ -1453,7 +1444,7 @@ end;
Pen.Style := psSolid;
pen.Color := clWhite;
brush.Color := clSilver;
if pivotMode = pivotLocal then i := 2
if (pivotMode = pivotLocal) or EdgeCaught then i := 2
else i := 3;
Ellipse(a.x - i, a.y - i, a.x + i, a.y + i);
@ -3174,7 +3165,7 @@ end;
function TEditForm.GetPivot(n: integer): TSPoint;
begin
if (PivotMode = pivotLocal) or EdgeCaught then // hmm... should be always local for edges
if (PivotMode = pivotLocal) or {EdgeCaught} (mouseOverEdge >= 0) then // should be always local for edges (hmm...?)
with MainTriangles[n] do begin
Result.x := x[1] + (x[0] - x[1])*LocalPivot.x + (x[2] - x[1])*LocalPivot.y;
Result.y := y[1] + (y[0] - y[1])*LocalPivot.x + (y[2] - y[1])*LocalPivot.y;
@ -3294,6 +3285,7 @@ begin
TrgMove(0,-1);
end;
{
procedure TEditForm.btTrgMoveLUClick(Sender: TObject);
begin
TrgMove(-1,1);
@ -3313,6 +3305,7 @@ procedure TEditForm.btTrgMoveRDClick(Sender: TObject);
begin
TrgMove(1,-1);
end;
}
procedure TEditForm.btTrgScaleUpClick(Sender: TObject);
var
@ -3346,7 +3339,7 @@ begin
txtTrgScaleValue.ItemIndex := 1;
exit;
end;
assert(scale <> 0);
if scale = 0 then scale := 1e-6; //assert(scale <> 0);
if GetKeyState(VK_CONTROL) < 0 then scale := sqrt(scale)
else if GetKeyState(VK_SHIFT) < 0 then scale := scale*scale;
@ -3389,29 +3382,6 @@ begin
TriangleView.Cursor := crEditMove;
end
end;
{
case key of
VK_MENU:
begin
editMode := modeRotate;
// tbRotate.Down := true;
TriangleView.Cursor := crEditRotate;
end;
VK_CONTROL:
begin
editMode := modeScale;
// tbScale.Down := true;
TriangleView.Cursor := crEditScale;
end;
else //VK_SHIFT:
begin
editMode := modeMove;
// tbMove.Down := true;
TriangleView.Cursor := crEditMove;
end;
end;
// EditorToolBar.Refresh;
}
end
else
case key of
@ -3437,6 +3407,19 @@ begin
// can be changed in the future...
Ord('R'): btnResetPivotClick(Sender);
Ord('P'): btnPickPivotClick(Sender);
189: // "-"
begin
GraphZoom := GraphZoom * 0.8;
EditForm.StatusBar.Panels[2].Text := Format('Zoom: %f', [GraphZoom]);
TriangleView.Invalidate;
end;
187: // "+"
begin
GraphZoom := GraphZoom * 1.25;
EditForm.StatusBar.Panels[2].Text := Format('Zoom: %f', [GraphZoom]);
TriangleView.Invalidate;
end;
end;
end;
@ -3649,12 +3632,6 @@ end;
//-- Variable List -------------------------------------------------------------
// --Z-- hmmmm!
// this procedure is EXACT copy of ValidateVariation,
// the only difference is Set/Get-Variable instead of array access,
// which kinda is not good! :-\
// I think we should make an array of variables, maybe just for the editor...
procedure TEditForm.ValidateVariable;
var
i: integer;
@ -4415,19 +4392,5 @@ begin
end;
end;
procedure TEditForm.tbZoomOutClick(Sender: TObject);
begin
GraphZoom := GraphZoom * 0.8;
EditForm.StatusBar.Panels[2].Text := Format('Zoom: %f', [GraphZoom]);
TriangleView.Invalidate;
end;
procedure TEditForm.tbZoomInClick(Sender: TObject);
begin
GraphZoom := GraphZoom * 1.2;
EditForm.StatusBar.Panels[2].Text := Format('Zoom: %f', [GraphZoom]);
TriangleView.Invalidate;
end;
end.