Changeset View
Changeset View
Standalone View
Standalone View
libs/flake/tools/KoPathTool.cpp
Show First 20 Lines • Show All 100 Lines • ▼ Show 20 Line(s) | 99 | KoPathTool::KoPathTool(KoCanvasBase *canvas) | |||
---|---|---|---|---|---|
101 | , m_pointSelection(this) | 101 | , m_pointSelection(this) | ||
102 | , m_activeHandle(0) | 102 | , m_activeHandle(0) | ||
103 | , m_handleRadius(3) | 103 | , m_handleRadius(3) | ||
104 | , m_activeSegment(0) | 104 | , m_activeSegment(0) | ||
105 | , m_currentStrategy(0) | 105 | , m_currentStrategy(0) | ||
106 | { | 106 | { | ||
107 | QActionGroup *points = new QActionGroup(this); | 107 | QActionGroup *points = new QActionGroup(this); | ||
108 | // m_pointTypeGroup->setExclusive(true); | 108 | // m_pointTypeGroup->setExclusive(true); | ||
109 | m_actionPathPointCorner = new QAction(koIcon("pathpoint-corner"), i18n("Corner point"), this); | 109 | m_actionPathPointCorner = actionRegistry->makeQAction("pathpoint-corner", this, "Path Tool"); | ||
110 | addAction("pathpoint-corner", m_actionPathPointCorner); | 110 | addAction("pathpoint-corner", m_actionPathPointCorner); | ||
111 | m_actionPathPointCorner->setData(KoPathPointTypeCommand::Corner); | 111 | m_actionPathPointCorner->setData(KoPathPointTypeCommand::Corner); | ||
112 | points->addAction(m_actionPathPointCorner); | 112 | points->addAction(m_actionPathPointCorner); | ||
113 | 113 | | |||
114 | m_actionPathPointSmooth = new QAction(koIcon("pathpoint-smooth"), i18n("Smooth point"), this); | 114 | m_actionPathPointSmooth = actionRegistry->makeQAction("pathpoint-smooth", this, "Path Tool"); | ||
115 | addAction("pathpoint-smooth", m_actionPathPointSmooth); | 115 | addAction("pathpoint-smooth", m_actionPathPointSmooth); | ||
116 | m_actionPathPointSmooth->setData(KoPathPointTypeCommand::Smooth); | 116 | m_actionPathPointSmooth->setData(KoPathPointTypeCommand::Smooth); | ||
117 | points->addAction(m_actionPathPointSmooth); | 117 | points->addAction(m_actionPathPointSmooth); | ||
118 | 118 | | |||
119 | m_actionPathPointSymmetric = new QAction(koIcon("pathpoint-symmetric"), i18n("Symmetric Point"), this); | 119 | m_actionPathPointSymmetric = actionRegistry->makeQAction("pathpoint-symmetric", this, "Path Tool"); | ||
120 | addAction("pathpoint-symmetric", m_actionPathPointSymmetric); | 120 | addAction("pathpoint-symmetric", m_actionPathPointSymmetric); | ||
121 | m_actionPathPointSymmetric->setData(KoPathPointTypeCommand::Symmetric); | 121 | m_actionPathPointSymmetric->setData(KoPathPointTypeCommand::Symmetric); | ||
122 | points->addAction(m_actionPathPointSymmetric); | 122 | points->addAction(m_actionPathPointSymmetric); | ||
123 | 123 | | |||
124 | m_actionCurvePoint = new QAction(koIcon("pathpoint-curve"), i18n("Make curve point"), this); | 124 | m_actionCurvePoint = actionRegistry->makeQAction("pathpoint-curve", this, "Path Tool"); | ||
125 | addAction("pathpoint-curve", m_actionCurvePoint); | 125 | addAction("pathpoint-curve", m_actionCurvePoint); | ||
126 | connect(m_actionCurvePoint, SIGNAL(triggered()), this, SLOT(pointToCurve())); | 126 | connect(m_actionCurvePoint, SIGNAL(triggered()), this, SLOT(pointToCurve())); | ||
127 | 127 | | |||
128 | m_actionLinePoint = new QAction(koIcon("pathpoint-line"), i18n("Make line point"), this); | 128 | m_actionLinePoint = actionRegistry->makeQAction("pathpoint-line", this, "Path Tool"); | ||
129 | addAction("pathpoint-line", m_actionLinePoint); | 129 | addAction("pathpoint-line", m_actionLinePoint); | ||
130 | connect(m_actionLinePoint, SIGNAL(triggered()), this, SLOT(pointToLine())); | 130 | connect(m_actionLinePoint, SIGNAL(triggered()), this, SLOT(pointToLine())); | ||
131 | 131 | | |||
132 | m_actionLineSegment = new QAction(koIcon("pathsegment-line"), i18n("Segment to Line"), this); | 132 | m_actionLineSegment = actionRegistry->makeQAction("pathsegment-line", this, "Path Tool"); | ||
133 | m_actionLineSegment->setShortcut(Qt::Key_F); | | |||
134 | addAction("pathsegment-line", m_actionLineSegment); | 133 | addAction("pathsegment-line", m_actionLineSegment); | ||
135 | connect(m_actionLineSegment, SIGNAL(triggered()), this, SLOT(segmentToLine())); | 134 | connect(m_actionLineSegment, SIGNAL(triggered()), this, SLOT(segmentToLine())); | ||
136 | 135 | | |||
137 | m_actionCurveSegment = new QAction(koIcon("pathsegment-curve"), i18n("Segment to Curve"), this); | 136 | m_actionCurveSegment = actionRegistry->makeQAction("pathsegment-curve", this, "Path Tool"); | ||
138 | m_actionCurveSegment->setShortcut(Qt::Key_C); | | |||
139 | addAction("pathsegment-curve", m_actionCurveSegment); | 137 | addAction("pathsegment-curve", m_actionCurveSegment); | ||
140 | connect(m_actionCurveSegment, SIGNAL(triggered()), this, SLOT(segmentToCurve())); | 138 | connect(m_actionCurveSegment, SIGNAL(triggered()), this, SLOT(segmentToCurve())); | ||
141 | 139 | | |||
142 | m_actionAddPoint = new QAction(koIcon("pathpoint-insert"), i18n("Insert point"), this); | 140 | m_actionAddPoint = actionRegistry->makeQAction("pathpoint-insert", this, "Path Tool"); | ||
143 | m_actionAddPoint->setShortcut(Qt::Key_Insert); | | |||
144 | addAction("pathpoint-insert", m_actionAddPoint); | 141 | addAction("pathpoint-insert", m_actionAddPoint); | ||
145 | connect(m_actionAddPoint, SIGNAL(triggered()), this, SLOT(insertPoints())); | 142 | connect(m_actionAddPoint, SIGNAL(triggered()), this, SLOT(insertPoints())); | ||
146 | 143 | | |||
147 | m_actionRemovePoint = new QAction(koIcon("pathpoint-remove"), i18n("Remove point"), this); | 144 | m_actionRemovePoint = actionRegistry->makeQAction("pathpoint-remove", this, "Path Tool"); | ||
148 | m_actionRemovePoint->setShortcut(Qt::Key_Backspace); | | |||
149 | addAction("pathpoint-remove", m_actionRemovePoint); | 145 | addAction("pathpoint-remove", m_actionRemovePoint); | ||
150 | connect(m_actionRemovePoint, SIGNAL(triggered()), this, SLOT(removePoints())); | 146 | connect(m_actionRemovePoint, SIGNAL(triggered()), this, SLOT(removePoints())); | ||
151 | 147 | | |||
152 | m_actionBreakPoint = new QAction(koIcon("path-break-point"), i18n("Break at point"), this); | 148 | m_actionBreakPoint = actionRegistry->makeQAction("path-break-point", this, "Path Tool"); | ||
153 | addAction("path-break-point", m_actionBreakPoint); | 149 | addAction("path-break-point", m_actionBreakPoint); | ||
154 | connect(m_actionBreakPoint, SIGNAL(triggered()), this, SLOT(breakAtPoint())); | 150 | connect(m_actionBreakPoint, SIGNAL(triggered()), this, SLOT(breakAtPoint())); | ||
155 | 151 | | |||
156 | m_actionBreakSegment = new QAction(koIcon("path-break-segment"), i18n("Break at segment"), this); | 152 | m_actionBreakSegment = actionRegistry->makeQAction("path-break-segment", this, "Path Tool"); | ||
157 | addAction("path-break-segment", m_actionBreakSegment); | 153 | addAction("path-break-segment", m_actionBreakSegment); | ||
158 | connect(m_actionBreakSegment, SIGNAL(triggered()), this, SLOT(breakAtSegment())); | 154 | connect(m_actionBreakSegment, SIGNAL(triggered()), this, SLOT(breakAtSegment())); | ||
159 | 155 | | |||
160 | m_actionJoinSegment = new QAction(koIcon("pathpoint-join"), i18n("Join with segment"), this); | 156 | m_actionJoinSegment = actionRegistry->makeQAction("pathpoint-join", this, "Path Tool"); | ||
161 | m_actionJoinSegment->setShortcut(Qt::Key_J); | | |||
162 | addAction("pathpoint-join", m_actionJoinSegment); | 157 | addAction("pathpoint-join", m_actionJoinSegment); | ||
163 | connect(m_actionJoinSegment, SIGNAL(triggered()), this, SLOT(joinPoints())); | 158 | connect(m_actionJoinSegment, SIGNAL(triggered()), this, SLOT(joinPoints())); | ||
164 | 159 | | |||
165 | m_actionMergePoints = new QAction(koIcon("pathpoint-merge"), i18n("Merge points"), this); | 160 | m_actionMergePoints = actionRegistry->makeQAction("pathpoint-merge", this, "Path Tool"); | ||
166 | addAction("pathpoint-merge", m_actionMergePoints); | 161 | addAction("pathpoint-merge", m_actionMergePoints); | ||
167 | connect(m_actionMergePoints, SIGNAL(triggered()), this, SLOT(mergePoints())); | 162 | connect(m_actionMergePoints, SIGNAL(triggered()), this, SLOT(mergePoints())); | ||
168 | 163 | | |||
169 | m_actionConvertToPath = new QAction(koIcon("convert-to-path"), i18n("To Path"), this); | 164 | m_actionConvertToPath = actionRegistry->makeQAction("convert-to-path", this, "Path Tool"); | ||
170 | m_actionConvertToPath->setShortcut(Qt::Key_P); | | |||
171 | addAction("convert-to-path", m_actionConvertToPath); | 165 | addAction("convert-to-path", m_actionConvertToPath); | ||
172 | connect(m_actionConvertToPath, SIGNAL(triggered()), this, SLOT(convertToPath())); | 166 | connect(m_actionConvertToPath, SIGNAL(triggered()), this, SLOT(convertToPath())); | ||
173 | 167 | | |||
168 | | ||||
174 | connect(points, SIGNAL(triggered(QAction*)), this, SLOT(pointTypeChanged(QAction*))); | 169 | connect(points, SIGNAL(triggered(QAction*)), this, SLOT(pointTypeChanged(QAction*))); | ||
175 | connect(&m_pointSelection, SIGNAL(selectionChanged()), this, SLOT(pointSelectionChanged())); | 170 | connect(&m_pointSelection, SIGNAL(selectionChanged()), this, SLOT(pointSelectionChanged())); | ||
176 | 171 | | |||
177 | QBitmap b = QBitmap::fromData(QSize(16, 16), needle_bits); | 172 | QBitmap b = QBitmap::fromData(QSize(16, 16), needle_bits); | ||
178 | QBitmap m = b.createHeuristicMask(false); | 173 | QBitmap m = b.createHeuristicMask(false); | ||
179 | 174 | | |||
180 | m_selectCursor = QCursor(b, m, 2, 0); | 175 | m_selectCursor = QCursor(b, m, 2, 0); | ||
181 | 176 | | |||
▲ Show 20 Lines • Show All 787 Lines • Show Last 20 Lines |