[kde-doc-english] [symboleditor] /: Added action to enable/disable generation of guide lines
Steve Allewell
steve.allewell at gmail.com
Sat Jul 26 20:52:43 UTC 2014
Git commit 330b1ec8f2fe8fc0e7d19cfcdb5c80b1a6b10161 by Steve Allewell.
Committed on 26/07/2014 at 20:50.
Pushed by sallewell into branch 'master'.
Added action to enable/disable generation of guide lines
With symbols that have many points, the number of guides generated can
become significant. This option allows them to be turned off if
required.
GUI: Additional gui action
M +2 -0 SymbolEditorui.rc
M +16 -0 src/Editor.cpp
M +2 -0 src/Editor.h
M +9 -0 src/MainWindow.cpp
http://commits.kde.org/symboleditor/330b1ec8f2fe8fc0e7d19cfcdb5c80b1a6b10161
diff --git a/SymbolEditorui.rc b/SymbolEditorui.rc
index b02de3a..951bad9 100644
--- a/SymbolEditorui.rc
+++ b/SymbolEditorui.rc
@@ -22,6 +22,7 @@
<Action name="scalePreferred"/>
<Separator/>
<Action name="enableSnap"/>
+ <Action name="enableGuides"/>
</Menu>
<Menu name="rendering"><text>&Rendering</text>
<Action name="fillPath"/>
@@ -58,6 +59,7 @@
<Action name="scalePreferred"/>
<Separator/>
<Action name="enableSnap"/>
+ <Action name="enableGuides"/>
</ToolBar>
<ToolBar name="RenderingToolbar" fullWidth="false"><text>Rendering Toolbar</text>
<Action name="fillPath"/>
diff --git a/src/Editor.cpp b/src/Editor.cpp
index 9faba35..e7a121c 100644
--- a/src/Editor.cpp
+++ b/src/Editor.cpp
@@ -646,6 +646,17 @@ void Editor::enableSnap(bool enabled)
/**
+ * Switch the generation of guides on or off.
+ *
+ * @param enabled true if on, false otherwise
+ */
+void Editor::enableGuides(bool enabled)
+{
+ m_guides = enabled;
+}
+
+
+/**
* Switch the fill mode on or off.
*
* @param filled true if on, false otherwise
@@ -852,6 +863,7 @@ void Editor::mouseMoveEvent(QMouseEvent *event)
}
constructGuides(toSymbol(p));
+
update();
}
@@ -1402,6 +1414,10 @@ void Editor::constructGuides(const QPointF &to)
m_guideCircles.clear();
m_snapPoints.clear();
+ if (!m_guides) {
+ return;
+ }
+
QList<QPointF> points;
points << m_points << m_activePoints; // construct list of all points on screen
diff --git a/src/Editor.h b/src/Editor.h
index c93ec8b..b67cdbb 100644
--- a/src/Editor.h
+++ b/src/Editor.h
@@ -112,6 +112,7 @@ public slots:
void selectTool(QAction *action);
void charSelected(const QChar &character);
void enableSnap(bool enabled);
+ void enableGuides(bool enabled);
void selectFilled(bool enabled);
void selectFillRule(QAction *action);
void selectCapStyle(QAction *action);
@@ -162,6 +163,7 @@ private:
bool m_snap; /**< true if snap mode is enabled */
bool m_fill; /**< true if fill mode is enabled */
+ bool m_guides; /**< true if generating guides is enabled */
QUndoStack m_undoStack; /**< holds the commands that modify the editor contents allowing for undo */
diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp
index e8d68c3..b56824e 100644
--- a/src/MainWindow.cpp
+++ b/src/MainWindow.cpp
@@ -229,6 +229,7 @@ MainWindow::MainWindow()
actions->action("moveTo")->trigger(); // select draw tool
actions->action("enableSnap")->setChecked(true); // enable snap
+ actions->action("enableGuides")->setChecked(true); // enable creation of guides
actions->action("file_save")->setEnabled(false); // nothing to save yet
actions->action("saveSymbol")->setEnabled(false); // nothing to save yet
actions->action("saveSymbolAsNew")->setEnabled(false); // nothing to save yet
@@ -1008,6 +1009,14 @@ void MainWindow::setupActions()
connect(action, SIGNAL(toggled(bool)), m_editor, SLOT(enableSnap(bool)));
actions->addAction("enableSnap", action);
+ action = new KAction(this);
+ action->setText(i18n("Enable Guides"));
+ action->setWhatsThis(i18n("Enable the generation of quide intersections."));
+ action->setIcon(KIcon("snap-guides"));
+ action->setCheckable(true);
+ connect(action, SIGNAL(toggled(bool)), m_editor, SLOT(enableGuides(bool)));
+ actions->addAction("enableGuides", action);
+
// Settings Menu
KStandardAction::preferences(this, SLOT(preferences()), actions);
}
More information about the kde-doc-english
mailing list