Mercurial > hg > svgui
comparison widgets/Panner.cpp @ 188:dd573e090eed
* Add range input dialog
* Make Panner support middle-click/ctrl-left-click to reset and emit
doubleClicked when doubleClicked instead of resetting
* Use range input dialog to enter new values for panner on double-click
author | Chris Cannam |
---|---|
date | Fri, 12 Jan 2007 21:52:56 +0000 |
parents | 42118892f428 |
children | 5b7472db612b |
comparison
equal
deleted
inserted
replaced
187:e7cf6044c2a0 | 188:dd573e090eed |
---|---|
51 } | 51 } |
52 | 52 |
53 void | 53 void |
54 Panner::mousePressEvent(QMouseEvent *e) | 54 Panner::mousePressEvent(QMouseEvent *e) |
55 { | 55 { |
56 if (e->button() == Qt::LeftButton) { | 56 if (e->button() == Qt::MidButton || |
57 ((e->button() == Qt::LeftButton) && | |
58 (e->modifiers() & Qt::ControlModifier))) { | |
59 resetToDefault(); | |
60 } else if (e->button() == Qt::LeftButton) { | |
57 m_clicked = true; | 61 m_clicked = true; |
58 m_clickPos = e->pos(); | 62 m_clickPos = e->pos(); |
59 m_dragStartX = m_rectX; | 63 m_dragStartX = m_rectX; |
60 m_dragStartY = m_rectY; | 64 m_dragStartY = m_rectY; |
61 } else if (e->button() == Qt::MidButton) { | |
62 resetToDefault(); | |
63 } | 65 } |
64 } | 66 } |
65 | 67 |
66 void | 68 void |
67 Panner::mouseDoubleClickEvent(QMouseEvent *e) | 69 Panner::mouseDoubleClickEvent(QMouseEvent *e) |
68 { | 70 { |
69 resetToDefault(); | 71 if (e->button() != Qt::LeftButton) { |
72 return; | |
73 } | |
74 | |
75 emit doubleClicked(); | |
70 } | 76 } |
71 | 77 |
72 void | 78 void |
73 Panner::mouseMoveEvent(QMouseEvent *e) | 79 Panner::mouseMoveEvent(QMouseEvent *e) |
74 { | 80 { |
156 emit rectCentreMoved(centreX(), centreY()); | 162 emit rectCentreMoved(centreX(), centreY()); |
157 update(); | 163 update(); |
158 } | 164 } |
159 | 165 |
160 void | 166 void |
167 Panner::getRectExtents(float &x0, float &y0, float &width, float &height) | |
168 { | |
169 x0 = m_rectX; | |
170 y0 = m_rectY; | |
171 width = m_rectWidth; | |
172 height = m_rectHeight; | |
173 } | |
174 | |
175 void | |
161 Panner::setRectExtents(float x0, float y0, float width, float height) | 176 Panner::setRectExtents(float x0, float y0, float width, float height) |
162 { | 177 { |
163 std::cerr << "Panner::setRectExtents(" << x0 << ", " << y0 << ", " | 178 std::cerr << "Panner::setRectExtents(" << x0 << ", " << y0 << ", " |
164 << width << ", " << height << ")" << std::endl; | 179 << width << ", " << height << ")" << std::endl; |
165 | 180 |