Changeset View
Changeset View
Standalone View
Standalone View
tools/selection/text/kpToolText.cpp
Show First 20 Lines • Show All 66 Lines • ▼ Show 20 Line(s) | |||||
67 | 67 | | |||
68 | // protected virtual [kpAbstractSelectionTool] | 68 | // protected virtual [kpAbstractSelectionTool] | ||
69 | kpAbstractSelectionContentCommand *kpToolText::newGiveContentCommand () const | 69 | kpAbstractSelectionContentCommand *kpToolText::newGiveContentCommand () const | ||
70 | { | 70 | { | ||
71 | kpTextSelection *textSel = document ()->textSelection (); | 71 | kpTextSelection *textSel = document ()->textSelection (); | ||
72 | #if DEBUG_KP_TOOL_TEXT | 72 | #if DEBUG_KP_TOOL_TEXT | ||
73 | qCDebug(kpLogTools) << "kpToolText::newGiveContentCommand()" | 73 | qCDebug(kpLogTools) << "kpToolText::newGiveContentCommand()" | ||
74 | << " textSel=" << textSel | 74 | << " textSel=" << textSel | ||
75 | << "; hasContent=" << textSel->hasContent () << endl; | 75 | << "; hasContent=" << textSel->hasContent (); | ||
76 | #endif | 76 | #endif | ||
77 | Q_ASSERT (textSel && !textSel->hasContent ()); | 77 | Q_ASSERT (textSel && !textSel->hasContent ()); | ||
78 | 78 | | |||
79 | return new kpToolTextGiveContentCommand ( | 79 | return new kpToolTextGiveContentCommand ( | ||
80 | *textSel, | 80 | *textSel, | ||
81 | QString()/*uninteresting child of macro cmd*/, | 81 | QString()/*uninteresting child of macro cmd*/, | ||
82 | environ ()->commandEnvironment ()); | 82 | environ ()->commandEnvironment ()); | ||
83 | } | 83 | } | ||
▲ Show 20 Lines • Show All 85 Lines • ▼ Show 20 Line(s) | |||||
169 | 169 | | |||
170 | // public virtual [base kpAbstractSelectionTool] | 170 | // public virtual [base kpAbstractSelectionTool] | ||
171 | void kpToolText::cancelShape () | 171 | void kpToolText::cancelShape () | ||
172 | { | 172 | { | ||
173 | #if DEBUG_KP_TOOL_TEXT | 173 | #if DEBUG_KP_TOOL_TEXT | ||
174 | qCDebug(kpLogTools) << "kpToolText::cancelShape()"; | 174 | qCDebug(kpLogTools) << "kpToolText::cancelShape()"; | ||
175 | #endif | 175 | #endif | ||
176 | 176 | | |||
177 | if (drawType () != None) | 177 | if (drawType () != None) { | ||
178 | kpAbstractSelectionTool::cancelShape (); | 178 | kpAbstractSelectionTool::cancelShape (); | ||
179 | } | ||||
179 | else if (hasBegunText ()) | 180 | else if (hasBegunText ()) | ||
180 | { | 181 | { | ||
181 | endTypingCommands (); | 182 | endTypingCommands (); | ||
182 | 183 | | |||
183 | commandHistory ()->undo (); | 184 | commandHistory ()->undo (); | ||
184 | } | 185 | } | ||
185 | else | 186 | else { | ||
186 | kpAbstractSelectionTool::cancelShape (); | 187 | kpAbstractSelectionTool::cancelShape (); | ||
187 | } | 188 | } | ||
189 | } | ||||
188 | 190 | | |||
189 | 191 | | |||
190 | // public virtual [base kpTool] | 192 | // public virtual [base kpTool] | ||
191 | void kpToolText::endShape (const QPoint &thisPoint, const QRect &normalizedRect) | 193 | void kpToolText::endShape (const QPoint &thisPoint, const QRect &normalizedRect) | ||
192 | { | 194 | { | ||
193 | #if DEBUG_KP_TOOL_TEXT | 195 | #if DEBUG_KP_TOOL_TEXT | ||
194 | qCDebug(kpLogTools) << "kpToolText::endShape()"; | 196 | qCDebug(kpLogTools) << "kpToolText::endShape()"; | ||
195 | #endif | 197 | #endif | ||
196 | 198 | | |||
197 | if (drawType () != None) | 199 | if (drawType () != None) { | ||
198 | kpAbstractSelectionTool::endDraw (thisPoint, normalizedRect); | 200 | kpAbstractSelectionTool::endDraw (thisPoint, normalizedRect); | ||
199 | else if (hasBegunText ()) | 201 | } | ||
202 | else if (hasBegunText ()) { | ||||
200 | endTypingCommands (); | 203 | endTypingCommands (); | ||
201 | else | 204 | } | ||
205 | else { | ||||
202 | kpAbstractSelectionTool::endDraw (thisPoint, normalizedRect); | 206 | kpAbstractSelectionTool::endDraw (thisPoint, normalizedRect); | ||
203 | } | 207 | } | ||
208 | } | ||||
204 | 209 | | |||
205 | 210 | | |||
206 | // protected virtual [base kpAbstractSelectionTool] | 211 | // protected virtual [base kpAbstractSelectionTool] | ||
207 | QVariant kpToolText::operation (DrawType drawType, Operation op, | 212 | QVariant kpToolText::operation (DrawType drawType, Operation op, | ||
208 | const QVariant &data1, const QVariant &data2) | 213 | const QVariant &data1, const QVariant &data2) | ||
209 | { | 214 | { | ||
210 | if (drawType == SelectText) | 215 | if (drawType == SelectText) { | ||
211 | return selectTextOperation (op, data1, data2); | 216 | return selectTextOperation (op, data1, data2); | ||
212 | else | 217 | } | ||
218 | | ||||
213 | return kpAbstractSelectionTool::operation (drawType, op, data1, data2); | 219 | return kpAbstractSelectionTool::operation (drawType, op, data1, data2); | ||
214 | } | 220 | } | ||
215 | 221 | | |||
216 | 222 | |