fpvviewer: Adds properties to the drawer class and a nice instantaneous mousewheel zoom

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2707 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
sekelsenmat
2013-03-22 10:33:46 +00:00
parent b84e2f1705
commit 56183071a6
3 changed files with 51 additions and 20 deletions

View File

@@ -29,6 +29,22 @@ type
procedure HandleMouseUp(Sender: TObject; Button: TMouseButton; procedure HandleMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer); Shift: TShiftState; X, Y: Integer);
procedure Clear; procedure Clear;
public
property OnDblClick;
property OnTripleClick;
property OnQuadClick;
property OnDragDrop;
property OnDragOver;
property OnEndDock;
property OnEndDrag;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnMouseEnter;
property OnMouseLeave;
property OnMouseWheel;
property OnMouseWheelDown;
property OnMouseWheelUp;
end; end;
implementation implementation

View File

@@ -14,7 +14,7 @@ object frmFPVViewer: TfrmFPVViewer
Height = 424 Height = 424
Top = 176 Top = 176
Width = 485 Width = 485
PageIndex = 0 PageIndex = 1
Align = alClient Align = alClient
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
TabOrder = 0 TabOrder = 0
@@ -26,7 +26,7 @@ object frmFPVViewer: TfrmFPVViewer
AnchorSideTop.Control = btnSearchInTokens AnchorSideTop.Control = btnSearchInTokens
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 0 Left = 0
Height = 378 Height = 392
Top = 32 Top = 32
Width = 485 Width = 485
Align = alBottom Align = alBottom
@@ -65,7 +65,7 @@ object frmFPVViewer: TfrmFPVViewer
TabOrder = 1 TabOrder = 1
object editFileName: TFileNameEdit object editFileName: TFileNameEdit
Left = 8 Left = 8
Height = 22 Height = 23
Top = 8 Top = 8
Width = 304 Width = 304
DialogOptions = [] DialogOptions = []
@@ -87,7 +87,7 @@ object frmFPVViewer: TfrmFPVViewer
end end
object spinScale: TFloatSpinEdit object spinScale: TFloatSpinEdit
Left = 72 Left = 72
Height = 16 Height = 23
Top = 97 Top = 97
Width = 168 Width = 168
DecimalPlaces = 6 DecimalPlaces = 6
@@ -100,9 +100,9 @@ object frmFPVViewer: TfrmFPVViewer
end end
object Label1: TLabel object Label1: TLabel
Left = 8 Left = 8
Height = 16 Height = 15
Top = 97 Top = 97
Width = 55 Width = 46
Caption = 'Scale by:' Caption = 'Scale by:'
ParentColor = False ParentColor = False
end end
@@ -144,15 +144,15 @@ object frmFPVViewer: TfrmFPVViewer
end end
object Label2: TLabel object Label2: TLabel
Left = 8 Left = 8
Height = 16 Height = 15
Top = 72 Top = 72
Width = 88 Width = 73
Caption = 'Y adjustment:' Caption = 'Y adjustment:'
ParentColor = False ParentColor = False
end end
object spinAdjustY: TSpinEdit object spinAdjustY: TSpinEdit
Left = 80 Left = 80
Height = 16 Height = 23
Top = 72 Top = 72
Width = 72 Width = 72
Increment = 100 Increment = 100
@@ -162,7 +162,7 @@ object frmFPVViewer: TfrmFPVViewer
end end
object spinAdjustX: TSpinEdit object spinAdjustX: TSpinEdit
Left = 232 Left = 232
Height = 16 Height = 23
Top = 72 Top = 72
Width = 72 Width = 72
Increment = 50 Increment = 50
@@ -172,9 +172,9 @@ object frmFPVViewer: TfrmFPVViewer
end end
object Label3: TLabel object Label3: TLabel
Left = 160 Left = 160
Height = 16 Height = 15
Top = 72 Top = 72
Width = 88 Width = 73
Caption = 'X adjustment:' Caption = 'X adjustment:'
ParentColor = False ParentColor = False
end end
@@ -189,18 +189,18 @@ object frmFPVViewer: TfrmFPVViewer
end end
object Label4: TLabel object Label4: TLabel
Left = 9 Left = 9
Height = 16 Height = 15
Top = 126 Top = 126
Width = 153 Width = 128
Caption = 'Force encoding on read:' Caption = 'Force encoding on read:'
ParentColor = False ParentColor = False
end end
object comboEncoding: TComboBox object comboEncoding: TComboBox
Left = 144 Left = 144
Height = 20 Height = 23
Top = 126 Top = 126
Width = 128 Width = 128
ItemHeight = 0 ItemHeight = 15
ItemIndex = 0 ItemIndex = 0
Items.Strings = ( Items.Strings = (
'Read from the file' 'Read from the file'
@@ -236,17 +236,17 @@ object frmFPVViewer: TfrmFPVViewer
end end
object labelFileEncoding: TLabel object labelFileEncoding: TLabel
Left = 278 Left = 278
Height = 16 Height = 15
Top = 130 Top = 130
Width = 88 Width = 74
Caption = 'File encoding:' Caption = 'File encoding:'
ParentColor = False ParentColor = False
end end
object checkForceWhiteBackground: TCheckBox object checkForceWhiteBackground: TCheckBox
Left = 9 Left = 9
Height = 18 Height = 19
Top = 152 Top = 152
Width = 178 Width = 153
Caption = 'Force white background?' Caption = 'Force white background?'
TabOrder = 11 TabOrder = 11
end end

View File

@@ -51,6 +51,8 @@ type
private private
procedure MyContourLineDrawingProc(z,x1,y1,x2,y2: Double); procedure MyContourLineDrawingProc(z,x1,y1,x2,y2: Double);
function FPVDebugAddItemProc(AStr: string; AParent: Pointer): Pointer; function FPVDebugAddItemProc(AStr: string; AParent: Pointer): Pointer;
procedure HandleDrawerMouseWheel(Sender: TObject; Shift: TShiftState;
WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
public public
{ public declarations } { public declarations }
Drawer: TFPVVDrawer; Drawer: TFPVVDrawer;
@@ -357,6 +359,7 @@ begin
Drawer.Left := 5; Drawer.Left := 5;
Drawer.AnchorClient(5); Drawer.AnchorClient(5);
Drawer.TabStop := True; Drawer.TabStop := True;
Drawer.OnMouseWheel := @HandleDrawerMouseWheel;
end; end;
procedure TfrmFPVViewer.FormDestroy(Sender: TObject); procedure TfrmFPVViewer.FormDestroy(Sender: TObject);
@@ -390,5 +393,17 @@ begin
Result := lTreeItem; Result := lTreeItem;
end; end;
procedure TfrmFPVViewer.HandleDrawerMouseWheel(Sender: TObject;
Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint;
var Handled: Boolean);
begin
if WheelDelta > 0 then
spinScale.Value := spinScale.Value + spinScale.Increment
else
spinScale.Value := spinScale.Value - spinScale.Increment;
btnVisualize.Click();
end;
end. end.