Changeset View
Changeset View
Standalone View
Standalone View
plugins/defaultTools/connectionTool/ConnectionTool.cpp
Show First 20 Lines • Show All 46 Lines • ▼ Show 20 Line(s) | |||||
47 | #include <KoDocumentResourceManager.h> | 47 | #include <KoDocumentResourceManager.h> | ||
48 | #include <KoInteractionStrategy.h> | 48 | #include <KoInteractionStrategy.h> | ||
49 | #include <KoShapeConfigWidgetBase.h> | 49 | #include <KoShapeConfigWidgetBase.h> | ||
50 | #include <KoConnectionShapeConfigWidget.h> | 50 | #include <KoConnectionShapeConfigWidget.h> | ||
51 | #include <KoPathConnectionPointStrategy.h> | 51 | #include <KoPathConnectionPointStrategy.h> | ||
52 | #include <KoStrokeConfigWidget.h> | 52 | #include <KoStrokeConfigWidget.h> | ||
53 | 53 | | |||
54 | #include <KoIcon.h> | 54 | #include <KoIcon.h> | ||
55 | #include "kis_action_registry.h" | ||||
55 | 56 | | |||
56 | #include <QAction> | 57 | #include <QAction> | ||
57 | #include <klocalizedstring.h> | 58 | #include <klocalizedstring.h> | ||
58 | #include <QDebug> | 59 | #include <QDebug> | ||
59 | #include <KoResourcePaths.h> | 60 | #include <KoResourcePaths.h> | ||
60 | #include <kundo2command.h> | 61 | #include <kundo2command.h> | ||
61 | 62 | | |||
62 | 63 | | |||
63 | ConnectionTool::ConnectionTool(KoCanvasBase * canvas) | 64 | ConnectionTool::ConnectionTool(KoCanvasBase * canvas) | ||
64 | : KoToolBase(canvas) | 65 | : KoToolBase(canvas) | ||
65 | , m_editMode(Idle) | 66 | , m_editMode(Idle) | ||
66 | , m_connectionType(KoConnectionShape::Standard) | 67 | , m_connectionType(KoConnectionShape::Standard) | ||
67 | , m_currentShape(0) | 68 | , m_currentShape(0) | ||
68 | , m_activeHandle(-1) | 69 | , m_activeHandle(-1) | ||
69 | , m_currentStrategy(0) | 70 | , m_currentStrategy(0) | ||
70 | , m_oldSnapStrategies(0) | 71 | , m_oldSnapStrategies(0) | ||
71 | , m_resetPaint(true) | 72 | , m_resetPaint(true) | ||
72 | { | 73 | { | ||
73 | QPixmap connectPixmap; | 74 | QPixmap connectPixmap; | ||
74 | connectPixmap.load(":/cursor_connect.png"); | 75 | connectPixmap.load(":/cursor_connect.png"); | ||
75 | m_connectCursor = QCursor(connectPixmap, 4, 1); | 76 | m_connectCursor = QCursor(connectPixmap, 4, 1); | ||
76 | 77 | | |||
77 | m_editConnectionPoint = new QAction(i18n("Edit connection points"), this); | 78 | KisActionRegistry * actionRegistry = KisActionRegistry::instance(); | ||
79 | m_editConnectionPoint = actionRegistry->makeQAction("toggle-edit-mode", this); | ||||
78 | m_editConnectionPoint->setCheckable(true); | 80 | m_editConnectionPoint->setCheckable(true); | ||
79 | addAction("toggle-edit-mode", m_editConnectionPoint); | 81 | addAction("toggle-edit-mode", m_editConnectionPoint); | ||
80 | 82 | | |||
81 | m_alignPercent = new QAction(QString("%"), this); | 83 | m_alignPercent = actionRegistry->makeQAction("align-relative", this); | ||
82 | m_alignPercent->setCheckable(true); | 84 | m_alignPercent->setCheckable(true); | ||
83 | addAction("align-relative", m_alignPercent); | 85 | addAction("align-relative", m_alignPercent); | ||
84 | m_alignLeft = new QAction(koIcon("align-horizontal-left"), i18n("Align to left edge"), this); | 86 | m_alignLeft = actionRegistry->makeQAction("align-left", this); | ||
85 | m_alignLeft->setCheckable(true); | 87 | m_alignLeft->setCheckable(true); | ||
86 | addAction("align-left", m_alignLeft); | 88 | addAction("align-left", m_alignLeft); | ||
87 | m_alignCenterH = new QAction(koIcon("align-horizontal-center"), i18n("Align to horizontal center"), this); | 89 | m_alignCenterH = actionRegistry->makeQAction("align-centerh", this); | ||
88 | m_alignCenterH->setCheckable(true); | 90 | m_alignCenterH->setCheckable(true); | ||
89 | addAction("align-centerh", m_alignCenterH); | 91 | addAction("align-centerh", m_alignCenterH); | ||
90 | m_alignRight = new QAction(koIcon("align-horizontal-right"), i18n("Align to right edge"), this); | 92 | m_alignRight = actionRegistry->makeQAction("align-right", this); | ||
91 | m_alignRight->setCheckable(true); | 93 | m_alignRight->setCheckable(true); | ||
92 | addAction("align-right", m_alignRight); | 94 | addAction("align-right", m_alignRight); | ||
93 | m_alignTop = new QAction(koIcon("align-vertical-top"), i18n("Align to top edge"), this); | 95 | m_alignTop = actionRegistry->makeQAction("align-top", this); | ||
94 | m_alignTop->setCheckable(true); | 96 | m_alignTop->setCheckable(true); | ||
95 | addAction("align-top", m_alignTop); | 97 | addAction("align-top", m_alignTop); | ||
96 | m_alignCenterV = new QAction(koIcon("align-vertical-center"), i18n("Align to vertical center"), this); | 98 | m_alignCenterV = actionRegistry->makeQAction("align-centerv", this); | ||
97 | m_alignCenterV->setCheckable(true); | 99 | m_alignCenterV->setCheckable(true); | ||
98 | addAction("align-centerv", m_alignCenterV); | 100 | addAction("align-centerv", m_alignCenterV); | ||
99 | m_alignBottom = new QAction(koIcon("align-vertical-bottom"), i18n("Align to bottom edge"), this); | 101 | m_alignBottom = actionRegistry->makeQAction("align-bottom", this); | ||
100 | m_alignBottom->setCheckable(true); | 102 | m_alignBottom->setCheckable(true); | ||
101 | addAction("align-bottom", m_alignBottom); | 103 | addAction("align-bottom", m_alignBottom); | ||
102 | 104 | | |||
103 | m_escapeAll = new QAction(koIcon("escape-direction-all"), i18n("Escape in all directions"), this); | 105 | m_escapeAll = actionRegistry->makeQAction("escape-all", this); | ||
104 | m_escapeAll->setCheckable(true); | 106 | m_escapeAll->setCheckable(true); | ||
105 | addAction("escape-all", m_escapeAll); | 107 | addAction("escape-all", m_escapeAll); | ||
106 | m_escapeHorizontal = new QAction(koIcon("escape-direction-horizontal"), i18n("Escape in horizontal directions"), this); | 108 | m_escapeHorizontal = actionRegistry->makeQAction("escape-horizontal", this); | ||
107 | m_escapeHorizontal->setCheckable(true); | 109 | m_escapeHorizontal->setCheckable(true); | ||
108 | addAction("escape-horizontal", m_escapeHorizontal); | 110 | addAction("escape-horizontal", m_escapeHorizontal); | ||
109 | m_escapeVertical = new QAction(koIcon("escape-direction-vertical"), i18n("Escape in vertical directions"), this); | 111 | m_escapeVertical = actionRegistry->makeQAction("escape-vertical", this); | ||
110 | m_escapeVertical->setCheckable(true); | 112 | m_escapeVertical->setCheckable(true); | ||
111 | addAction("escape-vertical", m_escapeVertical); | 113 | addAction("escape-vertical", m_escapeVertical); | ||
112 | m_escapeLeft = new QAction(koIcon("escape-direction-left"), i18n("Escape in left direction"), this); | 114 | m_escapeLeft = actionRegistry->makeQAction("escape-left", this); | ||
113 | m_escapeLeft->setCheckable(true); | 115 | m_escapeLeft->setCheckable(true); | ||
114 | addAction("escape-left", m_escapeLeft); | 116 | addAction("escape-left", m_escapeLeft); | ||
115 | m_escapeRight = new QAction(koIcon("escape-direction-right"), i18n("Escape in right direction"), this); | 117 | m_escapeRight = actionRegistry->makeQAction("escape-right", this); | ||
116 | m_escapeRight->setCheckable(true); | 118 | m_escapeRight->setCheckable(true); | ||
117 | addAction("escape-right", m_escapeRight); | 119 | addAction("escape-right", m_escapeRight); | ||
118 | m_escapeUp = new QAction(koIcon("escape-direction-up"), i18n("Escape in up direction"), this); | 120 | m_escapeUp = actionRegistry->makeQAction("escape-up", this); | ||
119 | m_escapeUp->setCheckable(true); | 121 | m_escapeUp->setCheckable(true); | ||
120 | addAction("escape-up", m_escapeUp); | 122 | addAction("escape-up", m_escapeUp); | ||
121 | m_escapeDown = new QAction(koIcon("escape-direction-down"), i18n("Escape in down direction"), this); | 123 | m_escapeDown = actionRegistry->makeQAction("escape-down", this); | ||
122 | m_escapeDown->setCheckable(true); | 124 | m_escapeDown->setCheckable(true); | ||
123 | addAction("escape-down", m_escapeDown); | 125 | addAction("escape-down", m_escapeDown); | ||
124 | 126 | | |||
125 | m_alignHorizontal = new QActionGroup(this); | 127 | m_alignHorizontal = new QActionGroup(this); | ||
126 | m_alignHorizontal->setExclusive(true); | 128 | m_alignHorizontal->setExclusive(true); | ||
127 | m_alignHorizontal->addAction(m_alignLeft); | 129 | m_alignHorizontal->addAction(m_alignLeft); | ||
128 | m_alignHorizontal->addAction(m_alignCenterH); | 130 | m_alignHorizontal->addAction(m_alignCenterH); | ||
129 | m_alignHorizontal->addAction(m_alignRight); | 131 | m_alignHorizontal->addAction(m_alignRight); | ||
▲ Show 20 Lines • Show All 827 Lines • Show Last 20 Lines |