Changeset View
Changeset View
Standalone View
Standalone View
tools/kpTool_Drawing.cpp
Show First 20 Lines • Show All 178 Lines • ▼ Show 20 Line(s) | |||||
179 | 179 | | |||
180 | //--------------------------------------------------------------------- | 180 | //--------------------------------------------------------------------- | ||
181 | 181 | | |||
182 | void kpTool::endInternal () | 182 | void kpTool::endInternal () | ||
183 | { | 183 | { | ||
184 | if (d->began) | 184 | if (d->began) | ||
185 | { | 185 | { | ||
186 | // before we can stop using the tool, we must stop the current drawing operation (if any) | 186 | // before we can stop using the tool, we must stop the current drawing operation (if any) | ||
187 | if (hasBegunShape ()) | 187 | if (hasBegunShape ()) { | ||
188 | endShapeInternal (d->currentPoint, normalizedRect ()); | 188 | endShapeInternal (d->currentPoint, normalizedRect ()); | ||
189 | } | ||||
189 | 190 | | |||
190 | // call user virtual func | 191 | // call user virtual func | ||
191 | end (); | 192 | end (); | ||
192 | 193 | | |||
193 | // clear leftover statusbar messages | 194 | // clear leftover statusbar messages | ||
194 | setUserMessage (); | 195 | setUserMessage (); | ||
195 | setUserShapePoints (calculateCurrentPoint ()); | 196 | setUserShapePoints (calculateCurrentPoint ()); | ||
196 | 197 | | |||
▲ Show 20 Lines • Show All 59 Lines • ▼ Show 20 Line(s) | |||||
256 | } | 257 | } | ||
257 | 258 | | |||
258 | //--------------------------------------------------------------------- | 259 | //--------------------------------------------------------------------- | ||
259 | 260 | | |||
260 | // virtual | 261 | // virtual | ||
261 | void kpTool::hover (const QPoint &point) | 262 | void kpTool::hover (const QPoint &point) | ||
262 | { | 263 | { | ||
263 | qCDebug(kpLogTools) << "kpTool::hover" << point | 264 | qCDebug(kpLogTools) << "kpTool::hover" << point | ||
264 | << " base implementation" | 265 | << " base implementation"; | ||
265 | << endl; | | |||
266 | 266 | | |||
267 | setUserShapePoints (point); | 267 | setUserShapePoints (point); | ||
268 | } | 268 | } | ||
269 | 269 | | |||
270 | //--------------------------------------------------------------------- | 270 | //--------------------------------------------------------------------- | ||
271 | 271 | | |||
272 | // virtual | 272 | // virtual | ||
273 | void kpTool::globalDraw () | 273 | void kpTool::globalDraw () | ||
Show All 33 Lines | 306 | { | |||
307 | if (hasBegunShape ()) | 307 | if (hasBegunShape ()) | ||
308 | { | 308 | { | ||
309 | d->beganDraw = false; | 309 | d->beganDraw = false; | ||
310 | cancelShape (); | 310 | cancelShape (); | ||
311 | d->viewUnderStartPoint = nullptr; | 311 | d->viewUnderStartPoint = nullptr; | ||
312 | 312 | | |||
313 | emit cancelledShape (viewUnderCursor () ? d->currentPoint : KP_INVALID_POINT); | 313 | emit cancelledShape (viewUnderCursor () ? d->currentPoint : KP_INVALID_POINT); | ||
314 | 314 | | |||
315 | if (viewUnderCursor ()) | 315 | if (viewUnderCursor ()) { | ||
316 | hover (d->currentPoint); | 316 | hover (d->currentPoint); | ||
317 | } | ||||
317 | else | 318 | else | ||
318 | { | 319 | { | ||
319 | d->currentPoint = KP_INVALID_POINT; | 320 | d->currentPoint = KP_INVALID_POINT; | ||
320 | d->currentViewPoint = KP_INVALID_POINT; | 321 | d->currentViewPoint = KP_INVALID_POINT; | ||
321 | hover (d->currentPoint); | 322 | hover (d->currentPoint); | ||
322 | } | 323 | } | ||
323 | 324 | | |||
324 | if (returnToPreviousToolAfterEndDraw ()) | 325 | if (returnToPreviousToolAfterEndDraw ()) | ||
Show All 19 Lines | |||||
344 | 345 | | |||
345 | //--------------------------------------------------------------------- | 346 | //--------------------------------------------------------------------- | ||
346 | 347 | | |||
347 | void kpTool::endDrawInternal (const QPoint &thisPoint, const QRect &normalizedRect, | 348 | void kpTool::endDrawInternal (const QPoint &thisPoint, const QRect &normalizedRect, | ||
348 | bool wantEndShape) | 349 | bool wantEndShape) | ||
349 | { | 350 | { | ||
350 | qCDebug(kpLogTools) << "kpTool::endDrawInternal() wantEndShape=" << wantEndShape; | 351 | qCDebug(kpLogTools) << "kpTool::endDrawInternal() wantEndShape=" << wantEndShape; | ||
351 | 352 | | |||
352 | if (wantEndShape && !hasBegunShape ()) | 353 | if (wantEndShape && !hasBegunShape ()) { | ||
353 | return; | 354 | return; | ||
354 | else if (!wantEndShape && !hasBegunDraw ()) | 355 | } | ||
356 | | ||||
357 | if (!wantEndShape && !hasBegunDraw ()) { | ||||
355 | return; | 358 | return; | ||
359 | } | ||||
356 | 360 | | |||
357 | d->beganDraw = false; | 361 | d->beganDraw = false; | ||
358 | 362 | | |||
359 | if (wantEndShape) | 363 | if (wantEndShape) | ||
360 | { | 364 | { | ||
361 | qCDebug(kpLogTools) << "\tcalling endShape()"; | 365 | qCDebug(kpLogTools) << "\tcalling endShape()"; | ||
362 | endShape (thisPoint, normalizedRect); | 366 | endShape (thisPoint, normalizedRect); | ||
363 | } | 367 | } | ||
364 | else | 368 | else | ||
365 | { | 369 | { | ||
366 | qCDebug(kpLogTools) << "\tcalling endDraw()"; | 370 | qCDebug(kpLogTools) << "\tcalling endDraw()"; | ||
367 | endDraw (thisPoint, normalizedRect); | 371 | endDraw (thisPoint, normalizedRect); | ||
368 | } | 372 | } | ||
369 | d->viewUnderStartPoint = nullptr; | 373 | d->viewUnderStartPoint = nullptr; | ||
370 | 374 | | |||
371 | emit endedDraw (d->currentPoint); | 375 | emit endedDraw (d->currentPoint); | ||
372 | if (viewUnderCursor ()) | 376 | if (viewUnderCursor ()) { | ||
373 | hover (d->currentPoint); | 377 | hover (d->currentPoint); | ||
378 | } | ||||
374 | else | 379 | else | ||
375 | { | 380 | { | ||
376 | d->currentPoint = KP_INVALID_POINT; | 381 | d->currentPoint = KP_INVALID_POINT; | ||
377 | d->currentViewPoint = KP_INVALID_POINT; | 382 | d->currentViewPoint = KP_INVALID_POINT; | ||
378 | hover (d->currentPoint); | 383 | hover (d->currentPoint); | ||
379 | } | 384 | } | ||
380 | 385 | | |||
381 | if (returnToPreviousToolAfterEndDraw ()) | 386 | if (returnToPreviousToolAfterEndDraw ()) | ||
Show All 21 Lines |