Mercurial > octave-nkf
comparison libgui/graphics/Canvas.h @ 20142:f1f6d5eab46f
Draw a zoom-like box when creating an annotation interactively
* Canvas.h: new private state variable m_rectMode
* Canvas.cc (Canvas::canvasMousePressEvent): in text mode, initialize m_mouseAnchor, m_mouseCurrent, m_mouseAxes m_mouseMode = newMouseMode, m_rectMode = true for drawing the box; Remove call to anno_dlg.
* Canvas.cc (Canvas::canvasMouseMoveEvent): track mouse position as in zoom mode
* Canvas.cc (Canvas::canvasMouseReleaseEvent): use the anchor and current mouse coordoinates to define the position, and then call annot_dlg.
* annotation-dialog.ui: allow negative values for width and height
author | Pantxo Diribarne <pantxo.diribarne@gmail.com> |
---|---|
date | Mon, 20 Apr 2015 22:13:09 +0200 |
parents | c6c5cb9c4743 |
children | 248f2f2e7d48 |
comparison
equal
deleted
inserted
replaced
20141:8eb72c4ed457 | 20142:f1f6d5eab46f |
---|---|
82 Canvas (const graphics_handle& handle) | 82 Canvas (const graphics_handle& handle) |
83 : m_handle (handle), | 83 : m_handle (handle), |
84 m_redrawBlocked (false), | 84 m_redrawBlocked (false), |
85 m_mouseMode (NoMode), | 85 m_mouseMode (NoMode), |
86 m_clickMode (false), | 86 m_clickMode (false), |
87 m_eventMask (0) | 87 m_eventMask (0), |
88 m_rectMode (false) | |
88 { } | 89 { } |
89 | 90 |
90 void canvasToggleAxes (const graphics_handle& handle); | 91 void canvasToggleAxes (const graphics_handle& handle); |
91 void canvasToggleGrid (const graphics_handle& handle); | 92 void canvasToggleGrid (const graphics_handle& handle); |
92 void canvasAutoAxes (const graphics_handle& handle); | 93 void canvasAutoAxes (const graphics_handle& handle); |
111 bool m_clickMode; // True: ZoomIn, False: ZoomOut | 112 bool m_clickMode; // True: ZoomIn, False: ZoomOut |
112 QPoint m_mouseAnchor; | 113 QPoint m_mouseAnchor; |
113 QPoint m_mouseCurrent; | 114 QPoint m_mouseCurrent; |
114 graphics_handle m_mouseAxes; | 115 graphics_handle m_mouseAxes; |
115 int m_eventMask; | 116 int m_eventMask; |
117 bool m_rectMode; | |
116 }; | 118 }; |
117 | 119 |
118 }; // namespace QtHandles | 120 }; // namespace QtHandles |
119 | 121 |
120 #endif | 122 #endif |