Changeset View
Changeset View
Standalone View
Standalone View
tools/kpTool_MouseEvents.cpp
Show First 20 Lines • Show All 114 Lines • ▼ Show 20 Line(s) | 102 | { | |||
---|---|---|---|---|---|
115 | } | 115 | } | ||
116 | 116 | | |||
117 | return; | 117 | return; | ||
118 | } | 118 | } | ||
119 | 119 | | |||
120 | kpView *view = viewUnderCursor (); | 120 | kpView *view = viewUnderCursor (); | ||
121 | Q_ASSERT (view); | 121 | Q_ASSERT (view); | ||
122 | 122 | | |||
123 | if (view) | 123 | if (view) { | ||
124 | qCDebug(kpLogTools) << "\tview=" << view->objectName (); | 124 | qCDebug(kpLogTools) << "\tview=" << view->objectName (); | ||
125 | } | ||||
125 | 126 | | |||
126 | // let user know what mouse button is being used for entire draw | 127 | // let user know what mouse button is being used for entire draw | ||
127 | d->mouseButton = mouseButton (e->buttons ()); | 128 | d->mouseButton = mouseButton (e->buttons ()); | ||
128 | d->shiftPressed = (e->modifiers () & Qt::ShiftModifier); | 129 | d->shiftPressed = (e->modifiers () & Qt::ShiftModifier); | ||
129 | d->controlPressed = (e->modifiers () & Qt::ControlModifier); | 130 | d->controlPressed = (e->modifiers () & Qt::ControlModifier); | ||
130 | d->altPressed = (e->modifiers () & Qt::AltModifier); | 131 | d->altPressed = (e->modifiers () & Qt::AltModifier); | ||
131 | d->startPoint = d->currentPoint = view->transformViewToDoc (e->pos ()); | 132 | d->startPoint = d->currentPoint = view->transformViewToDoc (e->pos ()); | ||
132 | d->currentViewPoint = e->pos (); | 133 | d->currentViewPoint = e->pos (); | ||
▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Line(s) | 188 | { | |||
194 | // update will be executed first and it'll only update part of | 195 | // update will be executed first and it'll only update part of | ||
195 | // the screen resulting in ugly tearing of the viewManager's | 196 | // the screen resulting in ugly tearing of the viewManager's | ||
196 | // tempImage. | 197 | // tempImage. | ||
197 | viewManager ()->setFastUpdates (); | 198 | viewManager ()->setFastUpdates (); | ||
198 | } | 199 | } | ||
199 | 200 | | |||
200 | drawInternal (); | 201 | drawInternal (); | ||
201 | 202 | | |||
202 | if (dragScrolled) | 203 | if (dragScrolled) { | ||
203 | viewManager ()->restoreFastUpdates (); | 204 | viewManager ()->restoreFastUpdates (); | ||
205 | } | ||||
204 | 206 | | |||
205 | d->lastPoint = d->currentPoint; | 207 | d->lastPoint = d->currentPoint; | ||
206 | } | 208 | } | ||
207 | else | 209 | else | ||
208 | { | 210 | { | ||
209 | kpView *view = viewUnderCursor (); | 211 | kpView *view = viewUnderCursor (); | ||
210 | if (!view) // possible if cancelShape()'ed but still holding down initial mousebtn | 212 | if (!view) // possible if cancelShape()'ed but still holding down initial mousebtn | ||
211 | { | 213 | { | ||
Show All 11 Lines | |||||
223 | //--------------------------------------------------------------------- | 225 | //--------------------------------------------------------------------- | ||
224 | 226 | | |||
225 | void kpTool::mouseReleaseEvent (QMouseEvent *e) | 227 | void kpTool::mouseReleaseEvent (QMouseEvent *e) | ||
226 | { | 228 | { | ||
227 | qCDebug(kpLogTools) << "kpTool::mouseReleaseEvent pos=" << e->pos () | 229 | qCDebug(kpLogTools) << "kpTool::mouseReleaseEvent pos=" << e->pos () | ||
228 | << " button=" << (int) e->button () | 230 | << " button=" << (int) e->button () | ||
229 | << " stateAfter: buttons=" << (int *) (int) e->buttons () | 231 | << " stateAfter: buttons=" << (int *) (int) e->buttons () | ||
230 | << " modifiers=" << (int *) (int) e->modifiers () | 232 | << " modifiers=" << (int *) (int) e->modifiers () | ||
231 | << " beganDraw=" << d->beganDraw << endl; | 233 | << " beganDraw=" << d->beganDraw; | ||
232 | 234 | | |||
233 | // Have _not_ already cancelShape()'ed by pressing other mouse button? | 235 | // Have _not_ already cancelShape()'ed by pressing other mouse button? | ||
234 | // (e.g. you can cancel a line dragged out with the LMB, by pressing | 236 | // (e.g. you can cancel a line dragged out with the LMB, by pressing | ||
235 | // the RMB) | 237 | // the RMB) | ||
236 | if (d->beganDraw) | 238 | if (d->beganDraw) | ||
237 | { | 239 | { | ||
238 | kpView *view = viewUnderStartPoint (); | 240 | kpView *view = viewUnderStartPoint (); | ||
239 | Q_ASSERT (view); | 241 | Q_ASSERT (view); | ||
Show All 13 Lines | |||||
253 | } | 255 | } | ||
254 | 256 | | |||
255 | //--------------------------------------------------------------------- | 257 | //--------------------------------------------------------------------- | ||
256 | 258 | | |||
257 | void kpTool::wheelEvent (QWheelEvent *e) | 259 | void kpTool::wheelEvent (QWheelEvent *e) | ||
258 | { | 260 | { | ||
259 | qCDebug(kpLogTools) << "kpTool::wheelEvent() modifiers=" << (int *) (int) e->modifiers () | 261 | qCDebug(kpLogTools) << "kpTool::wheelEvent() modifiers=" << (int *) (int) e->modifiers () | ||
260 | << " hasBegunDraw=" << hasBegunDraw () | 262 | << " hasBegunDraw=" << hasBegunDraw () | ||
261 | << " delta=" << e->delta () | 263 | << " delta=" << e->delta (); | ||
262 | << endl; | | |||
263 | 264 | | |||
264 | e->ignore (); | 265 | e->ignore (); | ||
265 | 266 | | |||
266 | // If CTRL not pressed, bye. | 267 | // If CTRL not pressed, bye. | ||
267 | if ((e->modifiers () & Qt::ControlModifier) == 0) | 268 | if ((e->modifiers () & Qt::ControlModifier) == 0) | ||
268 | { | 269 | { | ||
269 | qCDebug(kpLogTools) << "\tno CTRL -> bye"; | 270 | qCDebug(kpLogTools) << "\tno CTRL -> bye"; | ||
270 | return; | 271 | return; | ||
Show All 30 Lines |