void RoundCornersPlugin::slotRoundCorners() { KoCanvasController* canvasController = KoToolManager::instance()->activeCanvasController(); KoSelection *selection = canvasController->canvas()->shapeManager()->selection(); KoShape * shape = selection->firstSelectedShape(); if (! shape) return; // check if we have a path based shape KoPathShape * path = dynamic_cast<KoPathShape*>(shape); if (! path) return; m_roundCornersDlg->setUnit(canvasController->canvas()->unit()); if (QDialog::Rejected == m_roundCornersDlg->exec()) return; KUndo2Command * cmd = new KUndo2Command(kundo2_i18n("Round Corners")); // convert to path before if we have a parametric shape KoParameterShape * ps = dynamic_cast<KoParameterShape*>(shape); if (ps && ps->isParametricShape()) new KoParameterToPathCommand(ps, cmd); new RoundCornersCommand(path, m_roundCornersDlg->radius(), cmd); canvasController->canvas()->addCommand(cmd); }
void WhirlPinchPlugin::slotWhirlPinch() { KoCanvasController* canvasController = KoToolManager::instance()->activeCanvasController(); KoSelection *selection = canvasController->canvas()->shapeManager()->selection(); KoShape * shape = selection->firstSelectedShape(); if (! shape) return; // check if we have a path based shape KoPathShape * path = dynamic_cast<KoPathShape*>(shape); if (! path) return; // check if it is no parametric shape KoParameterShape * ps = dynamic_cast<KoParameterShape*>(shape); if (ps && ps->isParametricShape()) return; m_whirlPinchDlg->setUnit(canvasController->canvas()->unit()); if (QDialog::Rejected == m_whirlPinchDlg->exec()) return; canvasController->canvas()->addCommand( new KarbonWhirlPinchCommand(path, m_whirlPinchDlg->angle(), m_whirlPinchDlg->pinch(), m_whirlPinchDlg->radius())); }
void KoPathToolSelection::selectPoints(const QRectF &rect, bool clearSelection) { if (clearSelection) { clear(); } blockSignals(true); foreach(KoPathShape* shape, m_selectedShapes) { KoParameterShape *parameterShape = dynamic_cast<KoParameterShape*>(shape); if (parameterShape && parameterShape->isParametricShape()) continue; foreach(KoPathPoint* point, shape->pointsAt(shape->documentToShape(rect))) add(point, false); }
void RefinePathPlugin::slotRefinePath() { KoCanvasController* canvasController = KoToolManager::instance()->activeCanvasController(); KoSelection *selection = canvasController->canvas()->shapeManager()->selection(); KoShape * shape = selection->firstSelectedShape(); if (! shape) return; // check if we have a path based shape KoPathShape * path = dynamic_cast<KoPathShape*>(shape); if (! path) return; // check if it is no parametric shape KoParameterShape * ps = dynamic_cast<KoParameterShape*>(shape); if (ps && ps->isParametricShape()) return; if (QDialog::Rejected == m_RefinePathDlg->exec()) return; canvasController->canvas()->addCommand(new KarbonPathRefineCommand(path, m_RefinePathDlg->knots())); }