Changeset View
Changeset View
Standalone View
Standalone View
plugins/artistictextshape/ArtisticTextTool.cpp
Show All 37 Lines | |||||
38 | #include <KoShapeManager.h> | 38 | #include <KoShapeManager.h> | ||
39 | #include <KoPointerEvent.h> | 39 | #include <KoPointerEvent.h> | ||
40 | #include <KoPathShape.h> | 40 | #include <KoPathShape.h> | ||
41 | #include <KoShapeBackground.h> | 41 | #include <KoShapeBackground.h> | ||
42 | #include <KoShapeController.h> | 42 | #include <KoShapeController.h> | ||
43 | #include <KoShapeContainer.h> | 43 | #include <KoShapeContainer.h> | ||
44 | #include <KoInteractionStrategy.h> | 44 | #include <KoInteractionStrategy.h> | ||
45 | #include <KoIcon.h> | 45 | #include <KoIcon.h> | ||
46 | #include "kis_action_registry.h" | ||||
46 | 47 | | |||
47 | #include <klocalizedstring.h> | 48 | #include <klocalizedstring.h> | ||
48 | #include <kstandardaction.h> | 49 | #include <kstandardaction.h> | ||
49 | #include <QAction> | 50 | #include <QAction> | ||
50 | #include <QDebug> | 51 | #include <QDebug> | ||
51 | 52 | | |||
52 | #include <QAction> | 53 | #include <QAction> | ||
53 | #include <QGridLayout> | 54 | #include <QGridLayout> | ||
Show All 16 Lines | 67 | { | |||
70 | } | 71 | } | ||
71 | return false; | 72 | return false; | ||
72 | } | 73 | } | ||
73 | 74 | | |||
74 | ArtisticTextTool::ArtisticTextTool(KoCanvasBase *canvas) | 75 | ArtisticTextTool::ArtisticTextTool(KoCanvasBase *canvas) | ||
75 | : KoToolBase(canvas), m_selection(canvas, this), m_currentShape(0), m_hoverText(0), m_hoverPath(0), m_hoverHandle(false) | 76 | : KoToolBase(canvas), m_selection(canvas, this), m_currentShape(0), m_hoverText(0), m_hoverPath(0), m_hoverHandle(false) | ||
76 | , m_textCursor( -1 ), m_showCursor( true ), m_currentStrategy(0) | 77 | , m_textCursor( -1 ), m_showCursor( true ), m_currentStrategy(0) | ||
77 | { | 78 | { | ||
78 | m_detachPath = new QAction(koIcon("artistictext-detach-path"), i18n("Detach Path"), this); | 79 | KisActionRegistry *actionRegistry = KisActionRegistry::instance(); | ||
80 | m_detachPath = actionRegistry->makeQAction("artistictext_detach_from_path", this); | ||||
79 | m_detachPath->setEnabled( false ); | 81 | m_detachPath->setEnabled( false ); | ||
80 | connect( m_detachPath, SIGNAL(triggered()), this, SLOT(detachPath()) ); | 82 | connect( m_detachPath, SIGNAL(triggered()), this, SLOT(detachPath()) ); | ||
81 | addAction("artistictext_detach_from_path", m_detachPath); | 83 | addAction("artistictext_detach_from_path", m_detachPath); | ||
82 | 84 | | |||
83 | m_convertText = new QAction(koIcon("pathshape"), i18n("Convert to Path"), this); | 85 | m_convertText = actionRegistry->makeQAction("artistictext_convert_to_path", this); | ||
84 | m_convertText->setEnabled( false ); | 86 | m_convertText->setEnabled( false ); | ||
85 | connect( m_convertText, SIGNAL(triggered()), this, SLOT(convertText()) ); | 87 | connect( m_convertText, SIGNAL(triggered()), this, SLOT(convertText()) ); | ||
86 | addAction("artistictext_convert_to_path", m_convertText); | 88 | addAction("artistictext_convert_to_path", m_convertText); | ||
87 | 89 | | |||
88 | m_fontBold = new QAction(koIcon("format-text-bold"), i18n("Bold text"), this); | 90 | m_fontBold = actionRegistry->makeQAction("artistictext_font_bold", this); | ||
89 | m_fontBold->setCheckable(true); | | |||
90 | connect(m_fontBold, SIGNAL(toggled(bool)), this, SLOT(toggleFontBold(bool))); | 91 | connect(m_fontBold, SIGNAL(toggled(bool)), this, SLOT(toggleFontBold(bool))); | ||
91 | addAction("artistictext_font_bold", m_fontBold); | 92 | addAction("artistictext_font_bold", m_fontBold); | ||
92 | 93 | | |||
93 | m_fontItalic = new QAction(koIcon("format-text-italic"), i18n("Italic text"), this); | 94 | m_fontItalic = actionRegistry->makeQAction("artistictext_font_italic", this); | ||
94 | m_fontItalic->setCheckable(true); | | |||
95 | connect(m_fontItalic, SIGNAL(toggled(bool)), this, SLOT(toggleFontItalic(bool))); | 95 | connect(m_fontItalic, SIGNAL(toggled(bool)), this, SLOT(toggleFontItalic(bool))); | ||
96 | addAction("artistictext_font_italic", m_fontItalic); | 96 | addAction("artistictext_font_italic", m_fontItalic); | ||
97 | 97 | | |||
98 | m_superScript = new QAction(koIcon("format-text-superscript"), i18n("Superscript"), this); | 98 | m_superScript = actionRegistry->makeQAction("artistictext_superscript", this); | ||
99 | m_superScript->setCheckable(true); | | |||
100 | connect(m_superScript, SIGNAL(triggered()), this, SLOT(setSuperScript())); | 99 | connect(m_superScript, SIGNAL(triggered()), this, SLOT(setSuperScript())); | ||
101 | addAction("artistictext_superscript", m_superScript); | 100 | addAction("artistictext_superscript", m_superScript); | ||
102 | 101 | | |||
103 | m_subScript = new QAction(koIcon("format-text-subscript"), i18n("Subscript"), this); | 102 | m_subScript = actionRegistry->makeQAction("artistictext_subscript", this); | ||
104 | m_subScript->setCheckable(true); | | |||
105 | connect(m_subScript, SIGNAL(triggered()), this, SLOT(setSubScript())); | 103 | connect(m_subScript, SIGNAL(triggered()), this, SLOT(setSubScript())); | ||
106 | addAction("artistictext_subscript", m_subScript); | 104 | addAction("artistictext_subscript", m_subScript); | ||
107 | 105 | | |||
108 | QAction *anchorStart = new QAction(koIcon("format-justify-left"), i18n("Anchor at Start"), this); | 106 | QAction *anchorStart = actionRegistry->makeQAction("artistictext_anchor_start", this); | ||
109 | anchorStart->setCheckable( true ); | | |||
110 | anchorStart->setData(ArtisticTextShape::AnchorStart); | 107 | anchorStart->setData(ArtisticTextShape::AnchorStart); | ||
111 | addAction("artistictext_anchor_start", anchorStart); | 108 | addAction("artistictext_anchor_start", anchorStart); | ||
112 | 109 | | |||
113 | QAction *anchorMiddle = new QAction(koIcon("format-justify-center"), i18n("Anchor at Middle"), this); | 110 | QAction *anchorMiddle = actionRegistry->makeQAction("artistictext_anchor_middle", this); | ||
114 | anchorMiddle->setCheckable( true ); | | |||
115 | anchorMiddle->setData(ArtisticTextShape::AnchorMiddle); | 111 | anchorMiddle->setData(ArtisticTextShape::AnchorMiddle); | ||
116 | addAction("artistictext_anchor_middle", anchorMiddle); | 112 | addAction("artistictext_anchor_middle", anchorMiddle); | ||
117 | 113 | | |||
118 | QAction *anchorEnd = new QAction(koIcon("format-justify-right"), i18n("Anchor at End"), this); | 114 | QAction *anchorEnd = actionRegistry->makeQAction("artistictext_anchor_end", this); | ||
119 | anchorEnd->setCheckable( true ); | | |||
120 | anchorEnd->setData(ArtisticTextShape::AnchorEnd); | 115 | anchorEnd->setData(ArtisticTextShape::AnchorEnd); | ||
121 | addAction("artistictext_anchor_end", anchorEnd); | 116 | addAction("artistictext_anchor_end", anchorEnd); | ||
122 | 117 | | |||
123 | m_anchorGroup = new QActionGroup(this); | 118 | m_anchorGroup = new QActionGroup(this); | ||
124 | m_anchorGroup->setExclusive(true); | 119 | m_anchorGroup->setExclusive(true); | ||
125 | m_anchorGroup->addAction(anchorStart); | 120 | m_anchorGroup->addAction(anchorStart); | ||
126 | m_anchorGroup->addAction(anchorMiddle); | 121 | m_anchorGroup->addAction(anchorMiddle); | ||
127 | m_anchorGroup->addAction(anchorEnd); | 122 | m_anchorGroup->addAction(anchorEnd); | ||
▲ Show 20 Lines • Show All 845 Lines • Show Last 20 Lines |