// public virtual [base kpTool] // TODO: dup with kpToolPolyline but we don't want to create another level of // inheritance and readability. void kpToolPolygon::endDraw (const QPoint &, const QRect &) { #if DEBUG_KP_TOOL_POLYGON qCDebug(kpLogTools) << "kpToolPolygon::endDraw() points=" << points ()->toList () << endl; #endif // A click of the other mouse button (to finish shape, instead of adding // another control point) would have caused endShape() to have been // called in kpToolPolygonalBase::beginDraw(). The points list would now // be empty. We are being called by kpTool::mouseReleaseEvent(). if (points ()->count () == 0) return; if (points ()->count () >= kpToolPolygonalBase::MaxPoints) { #if DEBUG_KP_TOOL_POLYGON qCDebug(kpLogTools) << "\tending shape"; #endif endShape (); return; } if (originatingMouseButton () == 0) { setUserMessage (i18n ("Left drag another line or right click to finish.")); } else { setUserMessage (i18n ("Right drag another line or left click to finish.")); } }
void kpTool::endInternal () { if (m_began) { // before we can stop using the tool, we must stop the current drawing operation (if any) if (hasBegunShape ()) endShapeInternal (m_currentPoint, QRect (m_startPoint, m_currentPoint).normalize ()); // call user virtual func end (); // clear leftover statusbar messages setUserMessage (); setUserShapePoints (currentPoint ()); // we've stopped using the tool... m_began = false; // and so we can't be drawing with it m_beganDraw = false; if (m_mainWindow) { kpToolToolBar *tb = m_mainWindow->toolToolBar (); if (tb) { tb->hideAllToolWidgets (); } } } }
// private void kpAbstractSelectionTool::beginDrawMove () { d->startMoveDragFromSelectionTopLeft = currentPoint () - document ()->selection ()->topLeft (); if (mouseButton () == 0) { /*virtual*/setSelectionBorderForBeginDrawMove (); } else { // Don't hide sel border momentarily if user is just // right _clicking_ selection. // (single shot timer) d->RMBMoveUpdateGUITimer->start (100/*ms*/); } setUserMessage (cancelUserMessage ()); }
// virtual void kpToolColorPicker::endDraw (const QPoint &thisPoint, const QRect &) { const kpColor color = colorAtPixel (thisPoint); if (color.isValid ()) { kpToolColorPickerCommand *cmd = new kpToolColorPickerCommand ( m_mouseButton, color, m_oldColor, mainWindow ()); mainWindow ()->commandHistory ()->addCommand (cmd, false /* no exec */); setUserMessage (haventBegunDrawUserMessage ()); } else { cancelShape (); } }
void kpTool::beginInternal () { #if DEBUG_KP_TOOL kdDebug () << "kpTool::beginInternal()" << endl; #endif if (!m_began) { // clear leftover statusbar messages setUserMessage (); m_currentPoint = currentPoint (); m_currentViewPoint = currentPoint (false/*view point*/); setUserShapePoints (m_currentPoint); // TODO: Audit all the code in this file - states like "m_began" & // "m_beganDraw" should be set before calling user func. // Also, m_currentPoint should be more frequently initialised. // call user virtual func begin (); // we've starting using the tool... m_began = true; // but we haven't started drawing with it m_beganDraw = false; uint keyState = KApplication::keyboardModifiers (); m_shiftPressed = (keyState & KApplication::ShiftModifier); m_controlPressed = (keyState & KApplication::ControlModifier); // TODO: Can't do much about ALT - unless it's always KApplication::Modifier1? // Ditto for everywhere else where I set SHIFT & CTRL but not alt. m_altPressed = false; } }
// virtual void kpToolColorPicker::beginDraw () { m_oldColor = color (m_mouseButton); setUserMessage (cancelUserMessage ()); }
void kpToolColorPicker::begin () { setUserMessage (haventBegunDrawUserMessage ()); }
void kpToolColorPicker::releasedAllButtons () { setUserMessage (haventBegunDrawUserMessage ()); }
// virtual void kpToolColorPicker::cancelShape () { mainWindow ()->colorToolBar ()->setColor (m_mouseButton, m_oldColor); setUserMessage (i18n ("Let go of all the mouse buttons.")); }