|
Krita Source Code Documentation
|
The SvgTextCursor class. More...
#include <SvgTextCursor.h>
Inheritance diagram for SvgTextCursor:Classes | |
| class | InputQueryUpdateBlocker |
Public Types | |
| enum | MoveMode { MoveNone , MoveLeft , MoveRight , MoveUp , MoveDown , MoveNextChar , MovePreviousChar , MoveNextLine , MovePreviousLine , MoveWordLeft , MoveWordRight , MoveWordEnd , MoveWordStart , MoveLineStart , MoveLineEnd , ParagraphStart , ParagraphEnd } |
| enum | TypeSettingModeHandle { NoHandle , StartPos , EndPos , BaselineShift , Ascender , Descender , LineHeightTop , LineHeightBottom , BaselineAlphabetic , BaselineIdeographic , BaselineMiddle , BaselineHanging , BaselineMathematical , BaselineCentral } |
| Handles used by type setting mode. More... | |
Signals | |
| void | selectionChanged () |
| Sents an update selection was changed. | |
| void | sigOpenGlyphPalette () |
| Called by actions, tells the parent tool to open the glyph palette. | |
| void | updateCursorDecoration (QRectF updateRect) |
| Sents an update to the parent tool to update it's decorations. | |
Public Member Functions | |
| void | copy () const |
| copy copies plain text into the clipboard between anchor and pos. | |
| QPair< KoSvgTextProperties, KoSvgTextProperties > | currentTextProperties () const |
| currentTextProperties | |
| QCursor | cursorTypeForTypeSetting () const |
| Return appropriate typeSetting cursor;. | |
| void | deselectText () |
| Deselect all text. This effectively makes anchor the same as pos. | |
| void | focusIn () |
| Turns on blinking cursor. | |
| void | focusOut () |
| Stops blinking cursor. | |
| int | getAnchor () |
| Get the current selection anchor. This is the same as position, unless there's a selection. | |
| int | getPos () |
| Get the current position. | |
| QString | handleName (TypeSettingModeHandle handle) const |
| handleName | |
| bool | hasSelection () override |
| return true if the tool currently has something selected that can be copied or deleted. | |
| void | inputMethodEvent (QInputMethodEvent *event) |
| Process an input method event. This is used by IME like virtual keyboards. | |
| QVariant | inputMethodQuery (Qt::InputMethodQuery query) const |
| Process an input method query and return the requested result. | |
| void | insertRichText (KoSvgTextShape *insert, bool inheritPropertiesIfPossible=false) |
| Insert rich text at getPos();. | |
| void | insertText (QString text) |
| Insert text at getPos() | |
| bool | isAddingCommand () const |
| the cursor is currently adding a command | |
| void | keyPressEvent (QKeyEvent *event) |
| Handle the cursor-related key events. | |
| void | mergePropertiesIntoSelection (const KoSvgTextProperties props, const QSet< KoSvgTextProperties::PropertyId > removeProperties=QSet< KoSvgTextProperties::PropertyId >(), bool paragraphOnly=false, bool selectWord=false) |
| mergePropertiesIntoSelection Within Krita's SVG/CSS text system, it is possible to apply incomplete properties to a whole range. In that case, only the existing properties are applied. Properties can also be removed this way. | |
| void | moveCursor (MoveMode mode, bool moveAnchor=true) |
| Move the cursor, and, if you don't want a selection, move the anchor. | |
| void | notifyCursorPosChanged (int pos, int anchor) override |
| void | notifyMarkupChanged () override |
| void | notifyShapeChanged (KoShape::ChangeType type, KoShape *shape) override |
| void | paintDecorations (QPainter &gc, QColor selectionColor, int decorationThickness=1, qreal handleRadius=5.0) |
| Paint all decorations and blinkingcursors. | |
| bool | paste () |
| paste pastes plain text in the clipboard at pos. Uses pasteRichTextByDefault to determine whether to try and paste rich text. | |
| int | posForTypeSettingHandleAndRect (const TypeSettingModeHandle handle, const QRectF regionOfInterest) |
| posForHandleAndRect Returns the closest cursor position for a given region and typesetting handle. Used by the type setting mode to find the relevant metrics to scale. | |
| QList< KoSvgTextProperties > | propertiesForRange () const |
| propertiesForRange | |
| QList< KoSvgTextProperties > | propertiesForShape () const |
| propertiesForShape | |
| bool | registerPropertyAction (QAction *action, const QString &name) |
| Register an action. | |
| void | removeLastCodePoint () |
| removeLastCodePoint Special function to remove the last code point. Triggered by backspace. This is distinct from remove text, as some clusters have multiple code points, but it is generally expected backspace deletes the codepoints while delete with selection deletes the whole cluster. | |
| void | removeSelection () |
| removeSelection if there's a selection, creates a text-removal command. | |
| void | removeText (MoveMode first, MoveMode second) |
| removeText remove text relative to the current position. This will move the cursor according to the move modes and then remove the text between the two positions. | |
| void | setCaretSetting (int cursorWidth=1, int cursorFlash=1000, int cursorFlashLimit=5000, bool drawCursorInAdditionToSelection=false) |
| setCaretSetting Set the caret settings for the cursor. Qt has some standard functionality associated, which we pass via this. | |
| bool | setDominantBaselineFromHandle (const TypeSettingModeHandle handle) |
| setDominantBaselineFromHandle Set the dominant baseline from a given handle. | |
| void | setDrawTypeSettingHandle (bool draw) |
| void | setPasteRichTextByDefault (const bool pasteRichText=true) |
| setPasteRichText | |
| void | setPos (int pos, int anchor) |
| Set the pos and the anchor. | |
| void | setPosToPoint (QPointF point, bool moveAnchor=true) |
| Set the pos from a point. This currently does a search inside the text shape. | |
| void | setShape (KoSvgTextShape *textShape) |
| setShape | |
| void | setTypeSettingHandleHovered (TypeSettingModeHandle hovered=TypeSettingModeHandle::NoHandle) |
| Set a given typesetting handle as hovered, so it will be drawn as such. | |
| void | setTypeSettingModeActive (bool activate) |
| Set type setting mode active. | |
| void | setVisualMode (const bool visualMode=true) |
| setVisualMode set whether the navigation mode is visual or logical. This right now primarily affects Bidirectional text. | |
| KoSvgTextShape * | shape () const |
| Get the current text shape. | |
| SvgTextCursor (KoCanvasBase *canvas) | |
| KoSvgTextPropertiesInterface * | textPropertyInterface () |
| TypeSettingModeHandle | typeSettingHandleAtPos (const QRectF regionOfInterest) |
| Get typeSettingMode handle for text;. | |
| void | updateModifiers (const Qt::KeyboardModifiers modifiers) |
| void | updateTypeSettingDecorFromShape () |
| Update the type setting decorations. | |
| ~SvgTextCursor () | |
Public Member Functions inherited from Private | |
| Private (KisCanvas2 *c) | |
Public Member Functions inherited from KoToolSelection | |
| KoToolSelection (QObject *parent=0) | |
| ~KoToolSelection () override | |
Public Member Functions inherited from KoSvgTextShape::TextCursorChangeListener | |
| void | notifyShapeChanged (ChangeType type, KoShape *shape) override |
Public Member Functions inherited from KoShape::ShapeChangeListener | |
| virtual | ~ShapeChangeListener () |
Public Attributes | |
| QList< QAction * > | actions |
| int | anchor = 0 |
| QLineF | anchorCaret |
| int | anchorIndex = 0 |
| bool | blockQueryUpdates = false |
| Block qApp->inputMethod->update(), enabled during the inputmethod event flow. | |
| KoCanvasBase * | canvas |
| QLineF | cursorCaret |
| QColor | cursorColor |
| QTimer | cursorFlash |
| QTimer | cursorFlashLimit |
| QPainterPath | cursorShape |
| bool | cursorVisible = false |
| int | cursorWidth = 1 |
| bool | drawCursorInAdditionToSelection = false |
| bool | drawTypeSettingHandle = true |
| qreal | handleRadius = 7 |
| bool | hasFocus = false |
| SvgTextCursor::TypeSettingModeHandle | hoveredTypeSettingHandle = SvgTextCursor::NoHandle |
| QPainterPath | IMEDecoration |
| The decorations for the current preedit string. | |
| SvgTextCursorPropertyInterface * | interface {nullptr} |
| bool | isAddingCommand = false |
| Qt::KeyboardModifiers | lastKnownModifiers |
| QRectF | oldCursorRect |
| QRectF | oldIMEDecorationRect |
| Update Rectangle of previous decoration. | |
| QRectF | oldSelectionRect |
| QRectF | oldTypeSettingRect |
| bool | pasteRichText = true |
| int | pos = 0 |
| int | posIndex = 0 |
| SvgTextInsertCommand * | preEditCommand {nullptr} |
| PreEdit string as an command provided by the input method. | |
| int | preEditLength = -1 |
| Length of the preEditString. | |
| int | preEditStart = -1 |
| Start of the preEdit string as a cursor pos. | |
| KisAcyclicSignalConnector | resourceManagerAcyclicConnector |
| QPainterPath | selection |
| KoSvgTextShape * | shape {nullptr} |
| QVector< IMEDecorationInfo > | styleMap |
| Decoration info (underlines) for the preEdit string to differentiate it from regular text. | |
| TypeSettingDecorInfo | typeSettingDecor |
| bool | typeSettingMode = false |
| bool | visualNavigation = true |
Public Attributes inherited from Private | |
| KisCanvas2 * | canvas |
| int | displayedFrame |
| int | intendedFrame |
Private Slots | |
| void | blinkCursor () |
| Called by timer, toggles the text cursor visible or invisible. | |
| void | canvasResourceChanged (int key, const QVariant &value) |
| Called when the canvas resources (foreground/background) change. | |
| void | clearFormattingAction () |
| Called by the clear formatting action. | |
| bool | pastePlainText () |
| pastePlainText Explicitely paste plaintext at pos. | |
| bool | pasteRichText () |
| pasteRichText | |
| void | propertyAction () |
| Called by the actions to execute a property change based on their data. | |
| void | removeTransformsFromRange () |
| removeTransformsFromRange Called by actions to remove svg character transforms from range. | |
| void | stopBlinkCursor () |
| Called by timer, stops the text blinking animation. | |
| void | updateCanvasResources () |
| Update the canvas resources with fore and background color. | |
| void | updateInputMethodItemTransform () |
Private Member Functions | |
| bool | acceptableInput (const QKeyEvent *event) const |
| More or less copied from bool QInputControl::isAcceptableInput(const QKeyEvent *event) const. | |
| void | addCommandToUndoAdapter (KUndo2Command *cmd) |
| Adds a command to the canvas of the parent tool. | |
| void | commitIMEPreEdit () |
| int | moveModeResult (const MoveMode mode, int &pos, bool visual=false) const |
| Processes a move action, returns the input. | |
| SvgTextRemoveCommand * | removeSelectionImpl (bool allowCleanUp, KUndo2Command *parent=0) |
| removeSelection if there's a selection, creates a text-removal command. | |
| void | updateCursor (bool firstUpdate=false) |
| update the cursor shape. First update will block ensuring the canvas is visible so setShape won't cause this. | |
| void | updateIMEDecoration () |
| void | updateSelection () |
| void | updateTypeSettingDecoration () |
Private Attributes | |
| const QScopedPointer< Private > | d |
The SvgTextCursor class.
This class handles cursor movement and text editing operations.
It acts as the KoToolSelection for SvgTextTool, allowing it to integrate with the basic KoToolBase functionality for copy, cut paste and clear.
A selection is defined as the anchor being different from the cursor position, with the move operation accepting whether you want to shift the cursor position.
It is also a shape listener to allow the textcursor to update itself whenever the corresponding text shape changes.
Note for Android: to get a debug view of where the text input is at the operating system level, you can set an environment variable:
qputenv("KRITA_ANDROID_EDIT_TEXT_DEBUG_DRAW", "1")
Definition at line 155 of file SvgTextCursor.cpp.
Definition at line 54 of file SvgTextCursor.h.
Handles used by type setting mode.
Definition at line 75 of file SvgTextCursor.h.
|
explicit |
Definition at line 251 of file SvgTextCursor.cpp.
References canvas, canvasResourceChanged(), d, updateCanvasResources(), and updateInputMethodItemTransform().
| SvgTextCursor::~SvgTextCursor | ( | ) |
Definition at line 283 of file SvgTextCursor.cpp.
References commitIMEPreEdit(), and d.
|
private |
More or less copied from bool QInputControl::isAcceptableInput(const QKeyEvent *event) const.
Tests whether the current keyboard input can be printed as text, or is probably a shortcut. This is so that various keyboard events, like print don't get inserted as text.
Definition at line 2098 of file SvgTextCursor.cpp.
|
private |
|
privateslot |
Called by timer, toggles the text cursor visible or invisible.
Definition at line 1272 of file SvgTextCursor.cpp.
References d, and updateCursorDecoration().
|
privateslot |
Called when the canvas resources (foreground/background) change.
Definition at line 1318 of file SvgTextCursor.cpp.
References KoSvgTextProperties::background(), KoCanvasResource::BackgroundColor, d, KoSvgTextProperties::FillId, KoCanvasResource::ForegroundColor, KoSvgTextProperties::hasProperty(), hasSelection(), KoSvgTextProperties::isEmpty(), mergePropertiesIntoSelection(), KoSvgTextProperties::setProperty(), KoSvgTextProperties::stroke(), KoSvgTextProperties::StrokeId, KoColor::toQColor(), and value().
|
privateslot |
Called by the clear formatting action.
Definition at line 1362 of file SvgTextCursor.cpp.
References KoSvgTextProperties::LastPropertyId, and mergePropertiesIntoSelection().
|
private |
This applies any running IME interactions, used when the shape is deselected halfways through an IME interaction.
Definition at line 2122 of file SvgTextCursor.cpp.
References d, updateCursor(), and updateIMEDecoration().
| void SvgTextCursor::copy | ( | ) | const |
copy copies plain text into the clipboard between anchor and pos.
Definition at line 737 of file SvgTextCursor.cpp.
References KoSvgTextShapeMarkupConverter::convertToHtml(), KoSvgTextShapeMarkupConverter::convertToSvg(), d, and length().
| QPair< KoSvgTextProperties, KoSvgTextProperties > SvgTextCursor::currentTextProperties | ( | ) | const |
currentTextProperties
Definition at line 675 of file SvgTextCursor.cpp.
References d.
| QCursor SvgTextCursor::cursorTypeForTypeSetting | ( | ) | const |
Return appropriate typeSetting cursor;.
Definition at line 455 of file SvgTextCursor.cpp.
References d, KoSvgText::HorizontalTB, and StartPos.
| void SvgTextCursor::deselectText | ( | ) |
Deselect all text. This effectively makes anchor the same as pos.
Definition at line 829 of file SvgTextCursor.cpp.
| void SvgTextCursor::focusIn | ( | ) |
Turns on blinking cursor.
Definition at line 1659 of file SvgTextCursor.cpp.
References blinkCursor(), and d.
| void SvgTextCursor::focusOut | ( | ) |
Stops blinking cursor.
Definition at line 1668 of file SvgTextCursor.cpp.
References d, and stopBlinkCursor().
| int SvgTextCursor::getAnchor | ( | ) |
Get the current selection anchor. This is the same as position, unless there's a selection.
Definition at line 351 of file SvgTextCursor.cpp.
References d.
| int SvgTextCursor::getPos | ( | ) |
| QString SvgTextCursor::handleName | ( | TypeSettingModeHandle | handle | ) | const |
handleName
Definition at line 467 of file SvgTextCursor.cpp.
References Ascender, BaselineAlphabetic, BaselineCentral, BaselineHanging, BaselineIdeographic, BaselineMathematical, BaselineMiddle, BaselineShift, d, Descender, LineHeightBottom, and LineHeightTop.
|
overridevirtual |
return true if the tool currently has something selected that can be copied or deleted.
Reimplemented from KoToolSelection.
Definition at line 1375 of file SvgTextCursor.cpp.
References d.
| void SvgTextCursor::inputMethodEvent | ( | QInputMethodEvent * | event | ) |
Process an input method event. This is used by IME like virtual keyboards.
Definition at line 1069 of file SvgTextCursor.cpp.
References addCommandToUndoAdapter(), d, dbgTools, insertText(), IMEDecorationInfo::length, removeSelectionImpl(), IMEDecorationInfo::setDecorationFromQTextCharFormat(), IMEDecorationInfo::start, styleMap, updateCursor(), updateIMEDecoration(), and updateSelection().
| QVariant SvgTextCursor::inputMethodQuery | ( | Qt::InputMethodQuery | query | ) | const |
Process an input method query and return the requested result.
Definition at line 941 of file SvgTextCursor.cpp.
| void SvgTextCursor::insertRichText | ( | KoSvgTextShape * | insert, |
| bool | inheritPropertiesIfPossible = false ) |
Insert rich text at getPos();.
Definition at line 623 of file SvgTextCursor.cpp.
References addCommandToUndoAdapter(), KoShape::anchor(), d, hasSelection(), and removeSelectionImpl().
| void SvgTextCursor::insertText | ( | QString | text | ) |
Insert text at getPos()
Definition at line 607 of file SvgTextCursor.cpp.
References addCommandToUndoAdapter(), d, hasSelection(), and removeSelectionImpl().
| bool SvgTextCursor::isAddingCommand | ( | ) | const |
the cursor is currently adding a command
| void SvgTextCursor::keyPressEvent | ( | QKeyEvent * | event | ) |
Handle the cursor-related key events.
Definition at line 1412 of file SvgTextCursor.cpp.
References acceptableInput(), d, KoSvgTextProperties::DirectionId, KoSvgText::DirectionRightToLeft, insertText(), KIS_SAFE_ASSERT_RECOVER_RETURN, moveCursor(), MoveDown, MoveLeft, MoveLineEnd, MoveLineStart, MoveNextChar, MoveNextLine, MoveNone, MovePreviousChar, MovePreviousLine, MoveRight, MoveUp, MoveWordEnd, MoveWordStart, ParagraphEnd, ParagraphStart, KoSvgTextProperties::propertyOrDefault(), removeLastCodePoint(), removeText(), updateModifiers(), KoSvgText::VerticalRL, and KoSvgTextProperties::WritingModeId.
| void SvgTextCursor::mergePropertiesIntoSelection | ( | const KoSvgTextProperties | props, |
| const QSet< KoSvgTextProperties::PropertyId > | removeProperties = QSet<KoSvgTextProperties::PropertyId>(), | ||
| bool | paragraphOnly = false, | ||
| bool | selectWord = false ) |
mergePropertiesIntoSelection Within Krita's SVG/CSS text system, it is possible to apply incomplete properties to a whole range. In that case, only the existing properties are applied. Properties can also be removed this way.
| props | – properties to apply. |
| removeProperties | – properties to be removed. |
| paragraphOnly | – whether to apply to the paragraph. |
| selectWord | – whether to select the word if there's no selection. |
Definition at line 699 of file SvgTextCursor.cpp.
References addCommandToUndoAdapter(), d, moveModeResult(), MoveWordEnd, and MoveWordStart.
Move the cursor, and, if you don't want a selection, move the anchor.
Definition at line 592 of file SvgTextCursor.cpp.
References d, moveModeResult(), updateCursor(), and updateSelection().
|
private |
Processes a move action, returns the input.
Definition at line 2023 of file SvgTextCursor.cpp.
References d, MoveDown, MoveLeft, MoveLineEnd, MoveLineStart, MoveNextChar, MoveNextLine, MoveNone, MovePreviousChar, MovePreviousLine, MoveRight, MoveUp, MoveWordEnd, MoveWordLeft, MoveWordRight, MoveWordStart, ParagraphEnd, ParagraphStart, and pos.
|
overridevirtual |
TextCursorChangeListener reimplementation, this allows undo commands to update the cursor without having the cursor owned by the command.
Implements KoSvgTextShape::TextCursorChangeListener.
Definition at line 1393 of file SvgTextCursor.cpp.
References anchor, d, pos, updateCursor(), updateSelection(), and updateTypeSettingDecoration().
|
overridevirtual |
Implements KoSvgTextShape::TextCursorChangeListener.
Definition at line 1403 of file SvgTextCursor.cpp.
References d, updateCursor(), updateSelection(), and updateTypeSettingDecoration().
|
overridevirtual |
ShapeChangeListener reimplementation. This will update the cursor position when the shape was updated.
Implements KoShape::ShapeChangeListener.
Definition at line 1380 of file SvgTextCursor.cpp.
References d, shape, updateCursor(), updateInputMethodItemTransform(), updateSelection(), and updateTypeSettingDecoration().
| void SvgTextCursor::paintDecorations | ( | QPainter & | gc, |
| QColor | selectionColor, | ||
| int | decorationThickness = 1, | ||
| qreal | handleRadius = 5.0 ) |
Paint all decorations and blinkingcursors.
Definition at line 839 of file SvgTextCursor.cpp.
References BaselineShift, bgColorForCaret(), d, KisHandlePainterHelper::drawHandleCircle(), KisHandlePainterHelper::drawHandleRect(), KisHandlePainterHelper::drawPath(), EndPos, handleName(), handleRadius, p, KisHandleStyle::partiallyHighlightedPrimaryHandles(), KisHandleStyle::secondarySelection(), KisHandlePainterHelper::setHandleStyle(), and StartPos.
| bool SvgTextCursor::paste | ( | ) |
paste pastes plain text in the clipboard at pos. Uses pasteRichTextByDefault to determine whether to try and paste rich text.
Definition at line 767 of file SvgTextCursor.cpp.
References d, pastePlainText(), and pasteRichText.
|
privateslot |
pastePlainText Explicitely paste plaintext at pos.
Definition at line 809 of file SvgTextCursor.cpp.
References insertText().
|
privateslot |
pasteRichText
| int SvgTextCursor::posForTypeSettingHandleAndRect | ( | const TypeSettingModeHandle | handle, |
| const QRectF | regionOfInterest ) |
posForHandleAndRect Returns the closest cursor position for a given region and typesetting handle. Used by the type setting mode to find the relevant metrics to scale.
Definition at line 554 of file SvgTextCursor.cpp.
References d, KoSvgTextProperties::fontSize(), KoSvgText::HorizontalTB, KisAlgebra2D::intersectLineRect(), KoSvgText::LineHeightInfo::isNormal, KoSvgText::LineHeightInfo::length, KoSvgTextProperties::LineHeightId, KoSvgTextProperties::metrics(), KoSvgTextProperties::propertyOrDefault(), typeSettingBaselinesFromMetrics(), and KoSvgText::CssLengthPercentage::value.
| QList< KoSvgTextProperties > SvgTextCursor::propertiesForRange | ( | ) | const |
propertiesForRange
Definition at line 683 of file SvgTextCursor.cpp.
References d.
| QList< KoSvgTextProperties > SvgTextCursor::propertiesForShape | ( | ) | const |
propertiesForShape
Definition at line 693 of file SvgTextCursor.cpp.
References d.
|
privateslot |
Called by the actions to execute a property change based on their data.
Definition at line 1351 of file SvgTextCursor.cpp.
References d, SvgTextShortCuts::getModifiedProperties(), KoSvgTextProperties::isEmpty(), mergePropertiesIntoSelection(), and p.
| bool SvgTextCursor::registerPropertyAction | ( | QAction * | action, |
| const QString & | name ) |
Register an action.
Definition at line 1674 of file SvgTextCursor.cpp.
References clearFormattingAction(), SvgTextShortCuts::configureAction(), d, pastePlainText(), pasteRichText, propertyAction(), removeTransformsFromRange(), and sigOpenGlyphPalette().
| void SvgTextCursor::removeLastCodePoint | ( | ) |
removeLastCodePoint Special function to remove the last code point. Triggered by backspace. This is distinct from remove text, as some clusters have multiple code points, but it is generally expected backspace deletes the codepoints while delete with selection deletes the whole cluster.
Definition at line 660 of file SvgTextCursor.cpp.
References addCommandToUndoAdapter(), d, hasSelection(), and removeSelectionImpl().
| void SvgTextCursor::removeSelection | ( | ) |
removeSelection if there's a selection, creates a text-removal command.
| parent |
Definition at line 718 of file SvgTextCursor.cpp.
References addCommandToUndoAdapter(), and removeSelectionImpl().
|
private |
removeSelection if there's a selection, creates a text-removal command.
| parent |
Definition at line 724 of file SvgTextCursor.cpp.
| void SvgTextCursor::removeText | ( | SvgTextCursor::MoveMode | first, |
| SvgTextCursor::MoveMode | second ) |
removeText remove text relative to the current position. This will move the cursor according to the move modes and then remove the text between the two positions.
| first | how the cursor should move to get to the start position. |
| second | how the cursor should move to get to the end position. |
Definition at line 638 of file SvgTextCursor.cpp.
References addCommandToUndoAdapter(), d, hasSelection(), length(), moveModeResult(), and removeSelectionImpl().
|
privateslot |
removeTransformsFromRange Called by actions to remove svg character transforms from range.
Definition at line 821 of file SvgTextCursor.cpp.
References addCommandToUndoAdapter(), and d.
|
signal |
Sents an update selection was changed.
| void SvgTextCursor::setCaretSetting | ( | int | cursorWidth = 1, |
| int | cursorFlash = 1000, | ||
| int | cursorFlashLimit = 5000, | ||
| bool | drawCursorInAdditionToSelection = false ) |
setCaretSetting Set the caret settings for the cursor. Qt has some standard functionality associated, which we pass via this.
| cursorWidth | - Cursor width from the style. |
| cursorFlash | - the total time it takes for a cursor to hide reapear. |
| cursorFlashLimit | - maximum amount of time a cursor is allowed to flash. |
Definition at line 320 of file SvgTextCursor.cpp.
References blinkCursor(), cursorFlash, cursorFlashLimit, cursorWidth, d, drawCursorInAdditionToSelection, and stopBlinkCursor().
| bool SvgTextCursor::setDominantBaselineFromHandle | ( | const TypeSettingModeHandle | handle | ) |
setDominantBaselineFromHandle Set the dominant baseline from a given handle.
Definition at line 507 of file SvgTextCursor.cpp.
References KoSvgTextProperties::AlignmentBaselineId, Ascender, KoSvgText::BaselineAlphabetic, BaselineAlphabetic, KoSvgText::BaselineAuto, KoSvgText::BaselineCentral, BaselineCentral, KoSvgText::BaselineHanging, BaselineHanging, KoSvgText::BaselineIdeographic, BaselineIdeographic, KoSvgText::BaselineMathematical, BaselineMathematical, KoSvgText::BaselineMiddle, BaselineMiddle, KoSvgText::BaselineTextBottom, KoSvgText::BaselineTextTop, d, Descender, KoSvgTextProperties::DominantBaselineId, mergePropertiesIntoSelection(), NoHandle, and KoSvgTextProperties::setProperty().
| void SvgTextCursor::setDrawTypeSettingHandle | ( | bool | draw | ) |
Whether to draw the type setting handles. Turned off when the typesetting strategy is active to give artists more control.
Definition at line 441 of file SvgTextCursor.cpp.
References d.
| void SvgTextCursor::setPasteRichTextByDefault | ( | const bool | pasteRichText = true | ) |
setPasteRichText
| pasteRichText | – whether to paste rich text when possible. |
Definition at line 335 of file SvgTextCursor.cpp.
References d, and pasteRichText.
| void SvgTextCursor::setPos | ( | int | pos, |
| int | anchor ) |
Set the pos and the anchor.
Definition at line 356 of file SvgTextCursor.cpp.
References anchor, d, pos, updateCursor(), and updateSelection().
| void SvgTextCursor::setPosToPoint | ( | QPointF | point, |
| bool | moveAnchor = true ) |
Set the pos from a point. This currently does a search inside the text shape.
Definition at line 365 of file SvgTextCursor.cpp.
References commitIMEPreEdit(), d, pos, posIndex, updateCursor(), and updateSelection().
| void SvgTextCursor::setShape | ( | KoSvgTextShape * | textShape | ) |
setShape
| textShape | KoSvgTextShape to set, is allowed to be a nullptr, the cursor just won't do anything. |
Definition at line 296 of file SvgTextCursor.cpp.
References KoShape::addShapeChangeListener(), commitIMEPreEdit(), d, updateCursor(), updateInputMethodItemTransform(), updateSelection(), and updateTypeSettingDecorFromShape().
| void SvgTextCursor::setTypeSettingHandleHovered | ( | TypeSettingModeHandle | hovered = TypeSettingModeHandle::NoHandle | ) |
Set a given typesetting handle as hovered, so it will be drawn as such.
Definition at line 436 of file SvgTextCursor.cpp.
References d.
| void SvgTextCursor::setTypeSettingModeActive | ( | bool | activate | ) |
Set type setting mode active.
Definition at line 340 of file SvgTextCursor.cpp.
References d, and updateTypeSettingDecoration().
| void SvgTextCursor::setVisualMode | ( | const bool | visualMode = true | ) |
setVisualMode set whether the navigation mode is visual or logical. This right now primarily affects Bidirectional text.
| mode | whether to turn off visual mode. |
Definition at line 330 of file SvgTextCursor.cpp.
References d.
| KoSvgTextShape * SvgTextCursor::shape | ( | ) | const |
Get the current text shape.
|
signal |
Called by actions, tells the parent tool to open the glyph palette.
|
privateslot |
Called by timer, stops the text blinking animation.
Definition at line 1280 of file SvgTextCursor.cpp.
References d, and updateCursorDecoration().
| KoSvgTextPropertiesInterface * SvgTextCursor::textPropertyInterface | ( | ) |
The text properties interface. This is how the text properties docker communicates with the text tool.
Definition at line 1707 of file SvgTextCursor.cpp.
References d.
| SvgTextCursor::TypeSettingModeHandle SvgTextCursor::typeSettingHandleAtPos | ( | const QRectF | regionOfInterest | ) |
Get typeSettingMode handle for text;.
Definition at line 392 of file SvgTextCursor.cpp.
References d, distance(), EndPos, kisDistanceToLine(), kisProjectOnVector(), NoHandle, and StartPos.
|
privateslot |
Update the canvas resources with fore and background color.
Definition at line 2142 of file SvgTextCursor.cpp.
References SvgTextShortCuts::actionEnabled(), KoSvgTextProperties::background(), KoColorBackground::color(), KoShapeStroke::color, d, KoSvgTextProperties::FillId, KoColor::fromQColor(), KoSvgTextProperties::hasProperty(), hasSelection(), KoShapeStroke::isVisible(), SvgTextShortCuts::possibleActions(), KoColor::setOpacity(), KoSvgTextProperties::stroke(), and KoSvgTextProperties::StrokeId.
|
private |
update the cursor shape. First update will block ensuring the canvas is visible so setShape won't cause this.
Definition at line 1712 of file SvgTextCursor.cpp.
References blinkCursor(), d, selectionChanged(), and updateTypeSettingDecoration().
|
signal |
Sents an update to the parent tool to update it's decorations.
|
private |
Definition at line 1758 of file SvgTextCursor.cpp.
References d, IMEDecorationInfo::decor, KoSvgText::DecorationUnderline, IMEDecorationInfo::length, IMEDecorationInfo::start, IMEDecorationInfo::style, IMEDecorationInfo::thick, and updateCursorDecoration().
|
privateslot |
Definition at line 1290 of file SvgTextCursor.cpp.
| void SvgTextCursor::updateModifiers | ( | const Qt::KeyboardModifiers | modifiers | ) |
Definition at line 1648 of file SvgTextCursor.cpp.
References d, and updateTypeSettingDecoration().
|
private |
Definition at line 1744 of file SvgTextCursor.cpp.
References d, and updateCursorDecoration().
|
private |
This adds the start and end decoration...
This could be better but requires better nodeindex retrieval...
Split up baselines into paths and baselines.
Definition at line 1848 of file SvgTextCursor.cpp.
References KoSvgTextCharacterInfo::advance, Ascender, BaselineShift, calcLineHeight(), d, Descender, KoSvgTextCharacterInfo::finalPos, KoSvgText::FontMetrics::fontSize, KoSvgTextProperties::fontSize(), KoSvgText::HorizontalTB, LineHeightBottom, KoSvgTextProperties::LineHeightId, LineHeightTop, KoSvgTextProperties::metrics(), pos, posAndRotateTransform(), processBaseline(), processEdges(), KoSvgTextProperties::propertyOrDefault(), KoSvgTextCharacterInfo::rotateDeg, typeSettingBaselinesFromMetrics(), updateCursorDecoration(), updateTypeSettingDecorFromShape(), KoSvgText::CssLengthPercentage::value, and KoSvgTextCharacterInfo::visualLessThan().
| void SvgTextCursor::updateTypeSettingDecorFromShape | ( | ) |
Update the type setting decorations.
Definition at line 446 of file SvgTextCursor.cpp.
References d, KoSvgTextShape::PreformattedText, and KoSvgTextShape::PrePositionedText.
| QList<QAction*> SvgTextCursor::actions |
Definition at line 246 of file SvgTextCursor.cpp.
| int SvgTextCursor::anchor = 0 |
Definition at line 201 of file SvgTextCursor.cpp.
| QLineF SvgTextCursor::anchorCaret |
Definition at line 213 of file SvgTextCursor.cpp.
| int SvgTextCursor::anchorIndex = 0 |
Definition at line 222 of file SvgTextCursor.cpp.
| bool SvgTextCursor::blockQueryUpdates = false |
Block qApp->inputMethod->update(), enabled during the inputmethod event flow.
Definition at line 242 of file SvgTextCursor.cpp.
| KoCanvasBase* SvgTextCursor::canvas |
Definition at line 198 of file SvgTextCursor.cpp.
| QLineF SvgTextCursor::cursorCaret |
Definition at line 212 of file SvgTextCursor.cpp.
| QColor SvgTextCursor::cursorColor |
Definition at line 210 of file SvgTextCursor.cpp.
| QTimer SvgTextCursor::cursorFlash |
Definition at line 204 of file SvgTextCursor.cpp.
| QTimer SvgTextCursor::cursorFlashLimit |
Definition at line 205 of file SvgTextCursor.cpp.
| QPainterPath SvgTextCursor::cursorShape |
Definition at line 209 of file SvgTextCursor.cpp.
| bool SvgTextCursor::cursorVisible = false |
Definition at line 206 of file SvgTextCursor.cpp.
| int SvgTextCursor::cursorWidth = 1 |
Definition at line 214 of file SvgTextCursor.cpp.
|
private |
Definition at line 393 of file SvgTextCursor.h.
| bool SvgTextCursor::drawCursorInAdditionToSelection = false |
Definition at line 215 of file SvgTextCursor.cpp.
| bool SvgTextCursor::drawTypeSettingHandle = true |
Definition at line 231 of file SvgTextCursor.cpp.
| qreal SvgTextCursor::handleRadius = 7 |
Definition at line 232 of file SvgTextCursor.cpp.
| bool SvgTextCursor::hasFocus = false |
Definition at line 207 of file SvgTextCursor.cpp.
| SvgTextCursor::TypeSettingModeHandle SvgTextCursor::hoveredTypeSettingHandle = SvgTextCursor::NoHandle |
Definition at line 230 of file SvgTextCursor.cpp.
| QPainterPath SvgTextCursor::IMEDecoration |
The decorations for the current preedit string.
Definition at line 240 of file SvgTextCursor.cpp.
| SvgTextCursorPropertyInterface* SvgTextCursor::interface {nullptr} |
Definition at line 244 of file SvgTextCursor.cpp.
| bool SvgTextCursor::isAddingCommand = false |
Definition at line 199 of file SvgTextCursor.cpp.
| Qt::KeyboardModifiers SvgTextCursor::lastKnownModifiers |
Definition at line 227 of file SvgTextCursor.cpp.
| QRectF SvgTextCursor::oldCursorRect |
Definition at line 211 of file SvgTextCursor.cpp.
| QRectF SvgTextCursor::oldIMEDecorationRect |
Update Rectangle of previous decoration.
Definition at line 241 of file SvgTextCursor.cpp.
| QRectF SvgTextCursor::oldSelectionRect |
Definition at line 217 of file SvgTextCursor.cpp.
| QRectF SvgTextCursor::oldTypeSettingRect |
Definition at line 233 of file SvgTextCursor.cpp.
| bool SvgTextCursor::pasteRichText = true |
Definition at line 225 of file SvgTextCursor.cpp.
| int SvgTextCursor::pos = 0 |
Definition at line 200 of file SvgTextCursor.cpp.
| int SvgTextCursor::posIndex = 0 |
Definition at line 221 of file SvgTextCursor.cpp.
| SvgTextInsertCommand* SvgTextCursor::preEditCommand {nullptr} |
PreEdit string as an command provided by the input method.
Definition at line 236 of file SvgTextCursor.cpp.
| int SvgTextCursor::preEditLength = -1 |
Length of the preEditString.
Definition at line 238 of file SvgTextCursor.cpp.
| int SvgTextCursor::preEditStart = -1 |
Start of the preEdit string as a cursor pos.
Definition at line 237 of file SvgTextCursor.cpp.
| KisAcyclicSignalConnector SvgTextCursor::resourceManagerAcyclicConnector |
Definition at line 248 of file SvgTextCursor.cpp.
| QPainterPath SvgTextCursor::selection |
Definition at line 216 of file SvgTextCursor.cpp.
| KoSvgTextShape * SvgTextCursor::shape {nullptr} |
Definition at line 202 of file SvgTextCursor.cpp.
| QVector<IMEDecorationInfo> SvgTextCursor::styleMap |
Decoration info (underlines) for the preEdit string to differentiate it from regular text.
Definition at line 239 of file SvgTextCursor.cpp.
| TypeSettingDecorInfo SvgTextCursor::typeSettingDecor |
Definition at line 234 of file SvgTextCursor.cpp.
| bool SvgTextCursor::typeSettingMode = false |
Definition at line 229 of file SvgTextCursor.cpp.
| bool SvgTextCursor::visualNavigation = true |
Definition at line 224 of file SvgTextCursor.cpp.