Changeset View
Changeset View
Standalone View
Standalone View
plugins/defaultTools/defaulttool/DefaultTool.cpp
Show First 20 Lines • Show All 50 Lines • ▼ Show 20 Line(s) | |||||
51 | #include <commands/KoShapeDeleteCommand.h> | 51 | #include <commands/KoShapeDeleteCommand.h> | ||
52 | #include <commands/KoShapeCreateCommand.h> | 52 | #include <commands/KoShapeCreateCommand.h> | ||
53 | #include <commands/KoShapeGroupCommand.h> | 53 | #include <commands/KoShapeGroupCommand.h> | ||
54 | #include <commands/KoShapeUngroupCommand.h> | 54 | #include <commands/KoShapeUngroupCommand.h> | ||
55 | #include <KoSnapGuide.h> | 55 | #include <KoSnapGuide.h> | ||
56 | #include <KoStrokeConfigWidget.h> | 56 | #include <KoStrokeConfigWidget.h> | ||
57 | #include <KoFillConfigWidget.h> | 57 | #include <KoFillConfigWidget.h> | ||
58 | #include <KoShadowConfigWidget.h> | 58 | #include <KoShadowConfigWidget.h> | ||
59 | #include "kis_action_registry.h" | ||||
59 | 60 | | |||
60 | #include <KoIcon.h> | 61 | #include <KoIcon.h> | ||
61 | 62 | | |||
62 | #include <QAction> | 63 | #include <QAction> | ||
63 | #include <QKeyEvent> | 64 | #include <QKeyEvent> | ||
64 | #include <QClipboard> | 65 | #include <QClipboard> | ||
65 | #include <KoResourcePaths.h> | 66 | #include <KoResourcePaths.h> | ||
66 | 67 | | |||
▲ Show 20 Lines • Show All 139 Lines • ▼ Show 20 Line(s) | |||||
206 | 207 | | |||
207 | bool DefaultTool::wantsAutoScroll() const | 208 | bool DefaultTool::wantsAutoScroll() const | ||
208 | { | 209 | { | ||
209 | return true; | 210 | return true; | ||
210 | } | 211 | } | ||
211 | 212 | | |||
212 | void DefaultTool::setupActions() | 213 | void DefaultTool::setupActions() | ||
213 | { | 214 | { | ||
214 | QAction * actionBringToFront = new QAction(koIcon("object-order-front-calligra"), | 215 | KisActionRegistry * actionRegistry = KisActionRegistry::instance(); | ||
215 | i18n("Bring to &Front"), this); | 216 | | ||
216 | actionBringToFront->setShortcut(QKeySequence("Ctrl+Shift+]")); | 217 | QAction * actionBringToFront = actionRegistry->makeQAction("object_order_front", this); | ||
217 | addAction("object_order_front", actionBringToFront); | 218 | addAction("object_order_front", actionBringToFront); | ||
218 | connect(actionBringToFront, SIGNAL(triggered()), this, SLOT(selectionBringToFront())); | 219 | connect(actionBringToFront, SIGNAL(triggered()), this, SLOT(selectionBringToFront())); | ||
219 | 220 | | |||
220 | QAction * actionRaise = new QAction(koIcon("object-order-raise-calligra"), i18n("&Raise"), this); | 221 | QAction * actionRaise = actionRegistry->makeQAction("object_order_raise", this); | ||
221 | actionRaise->setShortcut(QKeySequence("Ctrl+]")); | | |||
222 | addAction("object_order_raise", actionRaise); | 222 | addAction("object_order_raise", actionRaise); | ||
223 | connect(actionRaise, SIGNAL(triggered()), this, SLOT(selectionMoveUp())); | 223 | connect(actionRaise, SIGNAL(triggered()), this, SLOT(selectionMoveUp())); | ||
224 | 224 | | |||
225 | QAction * actionLower = new QAction(koIcon("object-order-lower-calligra"), i18n("&Lower"), this); | 225 | QAction * actionLower = actionRegistry->makeQAction("object_order_lower", this); | ||
226 | actionLower->setShortcut(QKeySequence("Ctrl+[")); | | |||
227 | addAction("object_order_lower", actionLower); | 226 | addAction("object_order_lower", actionLower); | ||
228 | connect(actionLower, SIGNAL(triggered()), this, SLOT(selectionMoveDown())); | 227 | connect(actionLower, SIGNAL(triggered()), this, SLOT(selectionMoveDown())); | ||
229 | 228 | | |||
230 | QAction * actionSendToBack = new QAction(koIcon("object-order-back-calligra"), | 229 | QAction * actionSendToBack = actionRegistry->makeQAction("object_order_back", this); | ||
231 | i18n("Send to &Back"), this); | | |||
232 | actionSendToBack->setShortcut(QKeySequence("Ctrl+Shift+[")); | | |||
233 | addAction("object_order_back", actionSendToBack); | 230 | addAction("object_order_back", actionSendToBack); | ||
234 | connect(actionSendToBack, SIGNAL(triggered()), this, SLOT(selectionSendToBack())); | 231 | connect(actionSendToBack, SIGNAL(triggered()), this, SLOT(selectionSendToBack())); | ||
235 | 232 | | |||
236 | QAction * actionAlignLeft = new QAction(koIcon("object-align-horizontal-left-calligra"), | 233 | QAction * actionAlignLeft = actionRegistry->makeQAction("object_align_horizontal_left", this); | ||
237 | i18n("Align Left"), this); | | |||
238 | addAction("object_align_horizontal_left", actionAlignLeft); | 234 | addAction("object_align_horizontal_left", actionAlignLeft); | ||
239 | connect(actionAlignLeft, SIGNAL(triggered()), this, SLOT(selectionAlignHorizontalLeft())); | 235 | connect(actionAlignLeft, SIGNAL(triggered()), this, SLOT(selectionAlignHorizontalLeft())); | ||
240 | 236 | | |||
241 | QAction * actionAlignCenter = new QAction(koIcon("object-align-horizontal-center-calligra"), | 237 | QAction * actionAlignCenter = actionRegistry->makeQAction("object_align_horizontal_center", this); | ||
242 | i18n("Horizontally Center"), this); | | |||
243 | addAction("object_align_horizontal_center", actionAlignCenter); | 238 | addAction("object_align_horizontal_center", actionAlignCenter); | ||
244 | connect(actionAlignCenter, SIGNAL(triggered()), this, SLOT(selectionAlignHorizontalCenter())); | 239 | connect(actionAlignCenter, SIGNAL(triggered()), this, SLOT(selectionAlignHorizontalCenter())); | ||
245 | 240 | | |||
246 | QAction * actionAlignRight = new QAction(koIcon("object-align-horizontal-right-calligra"), | 241 | QAction * actionAlignRight = actionRegistry->makeQAction("object_align_horizontal_right", this); | ||
247 | i18n("Align Right"), this); | | |||
248 | addAction("object_align_horizontal_right", actionAlignRight); | 242 | addAction("object_align_horizontal_right", actionAlignRight); | ||
249 | connect(actionAlignRight, SIGNAL(triggered()), this, SLOT(selectionAlignHorizontalRight())); | 243 | connect(actionAlignRight, SIGNAL(triggered()), this, SLOT(selectionAlignHorizontalRight())); | ||
250 | 244 | | |||
251 | QAction * actionAlignTop = new QAction(koIcon("object-align-vertical-top-calligra"), i18n("Align Top"), this); | 245 | QAction * actionAlignTop = actionRegistry->makeQAction("object_align_vertical_top", this); | ||
252 | addAction("object_align_vertical_top", actionAlignTop); | 246 | addAction("object_align_vertical_top", actionAlignTop); | ||
253 | connect(actionAlignTop, SIGNAL(triggered()), this, SLOT(selectionAlignVerticalTop())); | 247 | connect(actionAlignTop, SIGNAL(triggered()), this, SLOT(selectionAlignVerticalTop())); | ||
254 | 248 | | |||
255 | QAction * actionAlignMiddle = new QAction(koIcon("object-align-vertical-center-calligra"), | 249 | QAction * actionAlignMiddle = actionRegistry->makeQAction("object_align_vertical_center", this); | ||
256 | i18n("Vertically Center"), this); | | |||
257 | addAction("object_align_vertical_center", actionAlignMiddle); | 250 | addAction("object_align_vertical_center", actionAlignMiddle); | ||
258 | connect(actionAlignMiddle, SIGNAL(triggered()), this, SLOT(selectionAlignVerticalCenter())); | 251 | connect(actionAlignMiddle, SIGNAL(triggered()), this, SLOT(selectionAlignVerticalCenter())); | ||
259 | 252 | | |||
260 | QAction * actionAlignBottom = new QAction(koIcon("object-align-vertical-bottom-calligra"), | 253 | QAction * actionAlignBottom = actionRegistry->makeQAction("object_align_vertical_bottom", this); | ||
261 | i18n("Align Bottom"), this); | | |||
262 | addAction("object_align_vertical_bottom", actionAlignBottom); | 254 | addAction("object_align_vertical_bottom", actionAlignBottom); | ||
263 | connect(actionAlignBottom, SIGNAL(triggered()), this, SLOT(selectionAlignVerticalBottom())); | 255 | connect(actionAlignBottom, SIGNAL(triggered()), this, SLOT(selectionAlignVerticalBottom())); | ||
264 | 256 | | |||
265 | QAction * actionGroupBottom = new QAction(koIcon("object-group-calligra"), | 257 | QAction * actionGroupBottom = actionRegistry->makeQAction("object_group", this); | ||
266 | i18n("Group"), this); | | |||
267 | addAction("object_group", actionGroupBottom); | 258 | addAction("object_group", actionGroupBottom); | ||
268 | connect(actionGroupBottom, SIGNAL(triggered()), this, SLOT(selectionGroup())); | 259 | connect(actionGroupBottom, SIGNAL(triggered()), this, SLOT(selectionGroup())); | ||
269 | 260 | | |||
270 | QAction * actionUngroupBottom = new QAction(koIcon("object-ungroup-calligra"), | 261 | QAction * actionUngroupBottom = actionRegistry->makeQAction("object_ungroup", this); | ||
271 | i18n("Ungroup"), this); | | |||
272 | addAction("object_ungroup", actionUngroupBottom); | 262 | addAction("object_ungroup", actionUngroupBottom); | ||
273 | connect(actionUngroupBottom, SIGNAL(triggered()), this, SLOT(selectionUngroup())); | 263 | connect(actionUngroupBottom, SIGNAL(triggered()), this, SLOT(selectionUngroup())); | ||
274 | } | 264 | } | ||
275 | 265 | | |||
276 | qreal DefaultTool::rotationOfHandle(KoFlake::SelectionHandle handle, bool useEdgeRotation) | 266 | qreal DefaultTool::rotationOfHandle(KoFlake::SelectionHandle handle, bool useEdgeRotation) | ||
277 | { | 267 | { | ||
278 | QPointF selectionCenter = koSelection()->absolutePosition(); | 268 | QPointF selectionCenter = koSelection()->absolutePosition(); | ||
279 | QPointF direction; | 269 | QPointF direction; | ||
▲ Show 20 Lines • Show All 1046 Lines • Show Last 20 Lines |