[krita/krita-grids-kazakov] /: FEATURE: Added snap settings popup
Dmitry Kazakov
dimula73 at gmail.com
Wed Mar 9 12:07:12 UTC 2016
Git commit d1480b1f0ca24b4d92bd61ed475f0a31b75dab30 by Dmitry Kazakov.
Committed on 09/03/2016 at 12:06.
Pushed by dkazakov into branch 'krita-grids-kazakov'.
FEATURE: Added snap settings popup
You can press Shift+S to see a menu, where you can choose what snap
options you would like to use and which wouldn't.
The snap settings docker is removed.
CC:kimageshop at kde.org
M +96 -0 krita/kritamenu.action
M +0 -5 libs/flake/KoCanvasBase.cpp
M +0 -6 libs/flake/KoCanvasBase.h
M +16 -0 libs/flake/KoSnapGuide.cpp
M +4 -0 libs/flake/KoSnapGuide.h
M +1 -2 libs/ui/CMakeLists.txt
M +0 -6 libs/ui/canvas/kis_canvas2.cpp
M +0 -1 libs/ui/canvas/kis_canvas2.h
M +143 -12 libs/ui/canvas/kis_guides_manager.cpp
M +9 -0 libs/ui/canvas/kis_guides_manager.h
A +52 -0 libs/ui/canvas/kis_snap_config.cpp [License: GPL (v2+)]
A +91 -0 libs/ui/canvas/kis_snap_config.h [License: GPL (v2+)]
D +0 -110 libs/ui/canvas/kis_snap_guide_config_widget.cpp
D +0 -52 libs/ui/canvas/kis_snap_guide_config_widget.h
D +0 -139 libs/ui/canvas/kis_snap_guide_config_widget.ui
M +3 -0 libs/ui/canvas/kis_snap_line_strategy.cpp
M +30 -0 libs/ui/kis_config.cc
M +4 -0 libs/ui/kis_config.h
M +0 -3 plugins/dockers/CMakeLists.txt
M +0 -2 plugins/dockers/Plugin.cpp
D +0 -91 plugins/dockers/snapguidedocker/SnapGuideDocker.cpp
D +0 -62 plugins/dockers/snapguidedocker/SnapGuideDocker.h
D +0 -43 plugins/dockers/snapguidedocker/SnapGuideDockerFactory.cpp
D +0 -38 plugins/dockers/snapguidedocker/SnapGuideDockerFactory.h
http://commits.kde.org/krita/d1480b1f0ca24b4d92bd61ed475f0a31b75dab30
diff --git a/krita/kritamenu.action b/krita/kritamenu.action
index 3af08ba..3036403 100644
--- a/krita/kritamenu.action
+++ b/krita/kritamenu.action
@@ -666,6 +666,102 @@
<isCheckable>true</isCheckable>
<statusTip></statusTip>
</Action>
+ <Action name="show_snap_options_popup">
+ <icon></icon>
+ <text>Show Snap Options Popup</text>
+ <whatsThis></whatsThis>
+ <toolTip>Show Snap Options Popup</toolTip>
+ <iconText>Show Snap Options Popup</iconText>
+ <activationFlags>1000</activationFlags>
+ <shortcut>Shift+s</shortcut>
+ <isCheckable>false</isCheckable>
+ <statusTip></statusTip>
+ </Action>
+
+ <Action name="view_snap_orthogonal">
+ <icon></icon>
+ <text>Snap Orthogonal</text>
+ <whatsThis></whatsThis>
+ <toolTip>Snap Orthogonal</toolTip>
+ <iconText>Snap Orthogonal</iconText>
+ <activationFlags>1000</activationFlags>
+ <shortcut></shortcut>
+ <isCheckable>true</isCheckable>
+ <statusTip></statusTip>
+ </Action>
+
+ <Action name="view_snap_node">
+ <icon></icon>
+ <text>Snap Node</text>
+ <whatsThis></whatsThis>
+ <toolTip>Snap Node</toolTip>
+ <iconText>Snap Node</iconText>
+ <activationFlags>1000</activationFlags>
+ <shortcut></shortcut>
+ <isCheckable>true</isCheckable>
+ <statusTip></statusTip>
+ </Action>
+
+ <Action name="view_snap_extension">
+ <icon></icon>
+ <text>Snap Extension</text>
+ <whatsThis></whatsThis>
+ <toolTip>Snap Extension</toolTip>
+ <iconText>Snap Extension</iconText>
+ <activationFlags>1000</activationFlags>
+ <shortcut></shortcut>
+ <isCheckable>true</isCheckable>
+ <statusTip></statusTip>
+ </Action>
+
+ <Action name="view_snap_intersection">
+ <icon></icon>
+ <text>Snap Intersection</text>
+ <whatsThis></whatsThis>
+ <toolTip>Snap Intersection</toolTip>
+ <iconText>Snap Intersection</iconText>
+ <activationFlags>1000</activationFlags>
+ <shortcut></shortcut>
+ <isCheckable>true</isCheckable>
+ <statusTip></statusTip>
+ </Action>
+
+ <Action name="view_snap_bounding_box">
+ <icon></icon>
+ <text>Snap Bounding Box</text>
+ <whatsThis></whatsThis>
+ <toolTip>Snap Bounding Box</toolTip>
+ <iconText>Snap Bounding Box</iconText>
+ <activationFlags>1000</activationFlags>
+ <shortcut></shortcut>
+ <isCheckable>true</isCheckable>
+ <statusTip></statusTip>
+ </Action>
+
+ <Action name="view_snap_image_bounds">
+ <icon></icon>
+ <text>Snap Image Bounds</text>
+ <whatsThis></whatsThis>
+ <toolTip>Snap Image Bounds</toolTip>
+ <iconText>Snap Image Bounds</iconText>
+ <activationFlags>1000</activationFlags>
+ <shortcut></shortcut>
+ <isCheckable>true</isCheckable>
+ <statusTip></statusTip>
+ </Action>
+
+ <Action name="view_snap_image_center">
+ <icon></icon>
+ <text>Snap Image Center</text>
+ <whatsThis></whatsThis>
+ <toolTip>Snap Image Center</toolTip>
+ <iconText>Snap Image Center</iconText>
+ <activationFlags>1000</activationFlags>
+ <shortcut></shortcut>
+ <isCheckable>true</isCheckable>
+ <statusTip></statusTip>
+ </Action>
+
<Action name="view_toggle_perspective_grid">
<icon></icon>
<text>Show Perspective Grid</text>
diff --git a/libs/flake/KoCanvasBase.cpp b/libs/flake/KoCanvasBase.cpp
index 36b7906..4624eaf 100644
--- a/libs/flake/KoCanvasBase.cpp
+++ b/libs/flake/KoCanvasBase.cpp
@@ -120,8 +120,3 @@ KoSnapGuide * KoCanvasBase::snapGuide() const
{
return d->snapGuide;
}
-
-QWidget *KoCanvasBase::createSnapGuideConfigWidget() const
-{
- return 0;
-}
diff --git a/libs/flake/KoCanvasBase.h b/libs/flake/KoCanvasBase.h
index 1db4d9c..f571b3a 100644
--- a/libs/flake/KoCanvasBase.h
+++ b/libs/flake/KoCanvasBase.h
@@ -237,12 +237,6 @@ public:
*/
KoSnapGuide *snapGuide() const;
- /**
- * This factory method creates a new widget for the user to change
- * the snapping guide policies object from snapGuide().
- */
- QWidget *createSnapGuideConfigWidget() const;
-
/// called by KoCanvasController to set the controller that handles this canvas.
void setCanvasController(KoCanvasController *controller);
diff --git a/libs/flake/KoSnapGuide.cpp b/libs/flake/KoSnapGuide.cpp
index 06bf28a..7e041d3 100644
--- a/libs/flake/KoSnapGuide.cpp
+++ b/libs/flake/KoSnapGuide.cpp
@@ -90,6 +90,22 @@ KoShape *KoSnapGuide::editedShape() const
return d->editedShape;
}
+void KoSnapGuide::enableSnapStrategy(Strategy type, bool value)
+{
+ if ((d->usedStrategies & type) == value) return;
+
+ if (value) {
+ d->usedStrategies |= type;
+ } else {
+ d->usedStrategies &= ~type;
+ }
+}
+
+bool KoSnapGuide::isStrategyEnabled(Strategy type) const
+{
+ return d->usedStrategies & type;
+}
+
void KoSnapGuide::enableSnapStrategies(Strategies strategies)
{
d->usedStrategies = strategies;
diff --git a/libs/flake/KoSnapGuide.h b/libs/flake/KoSnapGuide.h
index 2895d2a..c7d5ba2 100644
--- a/libs/flake/KoSnapGuide.h
+++ b/libs/flake/KoSnapGuide.h
@@ -53,6 +53,7 @@ class QRectF;
* widget in guiutils.
*
*/
+
class KRITAFLAKE_EXPORT KoSnapGuide
{
public:
@@ -94,6 +95,9 @@ public:
/// returns the extra shapes to use
KoShape *editedShape() const;
+ void enableSnapStrategy(Strategy type, bool value);
+ bool isStrategyEnabled(Strategy type) const;
+
/// enables the strategies used for snapping
void enableSnapStrategies(Strategies strategies);
diff --git a/libs/ui/CMakeLists.txt b/libs/ui/CMakeLists.txt
index a254de2..951a7ca 100644
--- a/libs/ui/CMakeLists.txt
+++ b/libs/ui/CMakeLists.txt
@@ -67,8 +67,8 @@ set(kritaui_LIB_SRCS
canvas/kis_guides_decoration.cpp
canvas/kis_guides_manager.cpp
canvas/kis_guides_config.cpp
+ canvas/kis_snap_config.cpp
canvas/kis_snap_line_strategy.cpp
- canvas/kis_snap_guide_config_widget.cpp
dialogs/kis_about_application.cpp
dialogs/kis_dlg_adj_layer_props.cc
dialogs/kis_dlg_adjustment_layer.cc
@@ -492,7 +492,6 @@ ki18n_wrap_ui(kritaui_LIB_SRCS
wdgsplash.ui
input/wintab/kis_screen_size_choice_dialog.ui
- canvas/kis_snap_guide_config_widget.ui
)
diff --git a/libs/ui/canvas/kis_canvas2.cpp b/libs/ui/canvas/kis_canvas2.cpp
index 4296a67..8846668 100644
--- a/libs/ui/canvas/kis_canvas2.cpp
+++ b/libs/ui/canvas/kis_canvas2.cpp
@@ -67,7 +67,6 @@
#include "KisView.h"
#include "kis_canvas_controller.h"
#include "kis_grid_config.h"
-#include "kis_snap_guide_config_widget.h"
#ifdef HAVE_OPENGL
#include "kis_animation_player.h"
@@ -913,8 +912,3 @@ KisPaintingAssistantsDecoration* KisCanvas2::paintingAssistantsDecoration() cons
KisCanvasDecoration* deco = decoration("paintingAssistantsDecoration");
return qobject_cast<KisPaintingAssistantsDecoration*>(deco);
}
-
-QWidget *KisCanvas2::createSnapGuideConfigWidget() const
-{
- return new KisSnapGuideConfigWidget(snapGuide(), d->view);
-}
diff --git a/libs/ui/canvas/kis_canvas2.h b/libs/ui/canvas/kis_canvas2.h
index c8ac6de..5d7f93d 100644
--- a/libs/ui/canvas/kis_canvas2.h
+++ b/libs/ui/canvas/kis_canvas2.h
@@ -144,7 +144,6 @@ public: // KoCanvasBase implementation
KisInputManager* globalInputManager() const;
KisPaintingAssistantsDecoration* paintingAssistantsDecoration() const;
- QWidget* createSnapGuideConfigWidget() const;
public: // KisCanvas2 methods
diff --git a/libs/ui/canvas/kis_guides_manager.cpp b/libs/ui/canvas/kis_guides_manager.cpp
index f5f8569..e051c7c 100644
--- a/libs/ui/canvas/kis_guides_manager.cpp
+++ b/libs/ui/canvas/kis_guides_manager.cpp
@@ -18,6 +18,7 @@
#include "kis_guides_manager.h"
+#include <QMenu>
#include <QGuiApplication>
#include "kis_guides_decoration.h"
#include <KoRuler.h>
@@ -35,6 +36,7 @@
#include <KoSnapGuide.h>
#include "kis_snap_line_strategy.h"
#include "kis_change_guides_command.h"
+#include "kis_snap_config.h"
struct KisGuidesManager::Private
@@ -51,6 +53,7 @@ struct KisGuidesManager::Private
KisGuidesDecoration *decoration;
KisGuidesConfig guidesConfig;
+ KisSnapConfig snapConfig;
QPointer<KisView> view;
typedef QPair<Qt::Orientation, int> GuideHandle;
@@ -75,6 +78,8 @@ struct KisGuidesManager::Private
QPointF alignToPixels(const QPointF docPoint);
QPointF getDocPointFromEvent(QEvent *event);
Qt::MouseButton getButtonFromEvent(QEvent *event);
+ QAction* createShortenedAction(const QString &text, const QString &parentId, QObject *parent);
+ void syncAction(const QString &actionName, bool value);
GuideHandle currentGuide;
@@ -160,19 +165,30 @@ void KisGuidesManager::attachEventFilterImpl(bool value)
}
}
+void KisGuidesManager::Private::syncAction(const QString &actionName, bool value)
+{
+ KisActionManager *actionManager = view->viewManager()->actionManager();
+ KisAction *action = actionManager->actionByName(actionName);
+ KIS_ASSERT_RECOVER_RETURN(action);
+ KisSignalsBlocker b(action);
+ action->setChecked(value);
+}
+
void KisGuidesManager::syncActionsStatus()
{
if (!m_d->view) return;
- KisActionManager *actionManager = m_d->view->viewManager()->actionManager();
- KisAction *showGuidesAction = actionManager->actionByName("new_show_guides");
- KisAction *lockGuidesAction = actionManager->actionByName("new_lock_guides");
- KisAction *snapToGuidesAction = actionManager->actionByName("new_snap_to_guides");
-
- KisSignalsBlocker l(showGuidesAction, lockGuidesAction, snapToGuidesAction);
- showGuidesAction->setChecked(m_d->guidesConfig.showGuides());
- lockGuidesAction->setChecked(m_d->guidesConfig.lockGuides());
- snapToGuidesAction->setChecked(m_d->guidesConfig.snapToGuides());
+ m_d->syncAction("new_show_guides", m_d->guidesConfig.showGuides());
+ m_d->syncAction("new_lock_guides", m_d->guidesConfig.lockGuides());
+ m_d->syncAction("new_snap_to_guides", m_d->guidesConfig.snapToGuides());
+
+ m_d->syncAction("view_snap_orthogonal", m_d->snapConfig.orthogonal());
+ m_d->syncAction("view_snap_node", m_d->snapConfig.node());
+ m_d->syncAction("view_snap_extension", m_d->snapConfig.extension());
+ m_d->syncAction("view_snap_intersection", m_d->snapConfig.intersection());
+ m_d->syncAction("view_snap_bounding_box", m_d->snapConfig.boundingBox());
+ m_d->syncAction("view_snap_image_bounds", m_d->snapConfig.imageBounds());
+ m_d->syncAction("view_snap_image_center", m_d->snapConfig.imageCenter());
}
void KisGuidesManager::Private::updateSnappingStatus(const KisGuidesConfig &value)
@@ -189,6 +205,17 @@ void KisGuidesManager::Private::updateSnappingStatus(const KisGuidesConfig &valu
}
snapGuide->overrideSnapStrategy(KoSnapGuide::GuideLineSnapping, guidesSnap);
+ snapGuide->enableSnapStrategy(KoSnapGuide::GuideLineSnapping, guidesSnap);
+
+ snapGuide->enableSnapStrategy(KoSnapGuide::OrthogonalSnapping, snapConfig.orthogonal());
+ snapGuide->enableSnapStrategy(KoSnapGuide::NodeSnapping, snapConfig.node());
+ snapGuide->enableSnapStrategy(KoSnapGuide::ExtensionSnapping, snapConfig.extension());
+ snapGuide->enableSnapStrategy(KoSnapGuide::IntersectionSnapping, snapConfig.intersection());
+ snapGuide->enableSnapStrategy(KoSnapGuide::BoundingBoxSnapping, snapConfig.boundingBox());
+ snapGuide->enableSnapStrategy(KoSnapGuide::DocumentBoundsSnapping, snapConfig.imageBounds());
+ snapGuide->enableSnapStrategy(KoSnapGuide::DocumentCenterSnapping, snapConfig.imageCenter());
+
+ snapConfig.saveStaticData();
}
bool KisGuidesManager::showGuides() const
@@ -229,14 +256,39 @@ void KisGuidesManager::setup(KisActionManager *actionManager)
KisAction *action = 0;
action = actionManager->createAction("new_show_guides");
- connect(action, SIGNAL(triggered(bool)), this, SLOT(setShowGuides(bool)));
+ connect(action, SIGNAL(toggled(bool)), this, SLOT(setShowGuides(bool)));
action = actionManager->createAction("new_lock_guides");
- connect(action, SIGNAL(triggered(bool)), this, SLOT(setLockGuides(bool)));
+ connect(action, SIGNAL(toggled(bool)), this, SLOT(setLockGuides(bool)));
action = actionManager->createAction("new_snap_to_guides");
- connect(action, SIGNAL(triggered(bool)), this, SLOT(setSnapToGuides(bool)));
+ connect(action, SIGNAL(toggled(bool)), this, SLOT(setSnapToGuides(bool)));
+
+ action = actionManager->createAction("show_snap_options_popup");
+ connect(action, SIGNAL(triggered()), this, SLOT(slotShowSnapOptions()));
+
+ action = actionManager->createAction("view_snap_orthogonal");
+ connect(action, SIGNAL(toggled(bool)), this, SLOT(setSnapOrthogonal(bool)));
+
+ action = actionManager->createAction("view_snap_node");
+ connect(action, SIGNAL(toggled(bool)), this, SLOT(setSnapNode(bool)));
+
+ action = actionManager->createAction("view_snap_extension");
+ connect(action, SIGNAL(toggled(bool)), this, SLOT(setSnapExtension(bool)));
+
+ action = actionManager->createAction("view_snap_intersection");
+ connect(action, SIGNAL(toggled(bool)), this, SLOT(setSnapIntersection(bool)));
+
+ action = actionManager->createAction("view_snap_bounding_box");
+ connect(action, SIGNAL(toggled(bool)), this, SLOT(setSnapBoundingBox(bool)));
+ action = actionManager->createAction("view_snap_image_bounds");
+ connect(action, SIGNAL(toggled(bool)), this, SLOT(setSnapImageBounds(bool)));
+
+ action = actionManager->createAction("view_snap_image_center");
+ connect(action, SIGNAL(toggled(bool)), this, SLOT(setSnapImageCenter(bool)));
+
+ m_d->updateSnappingStatus(m_d->guidesConfig);
syncActionsStatus();
}
@@ -245,6 +297,7 @@ void KisGuidesManager::setView(QPointer<KisView> view)
if (m_d->view) {
KoSnapGuide *snapGuide = m_d->view->canvasBase()->snapGuide();
snapGuide->overrideSnapStrategy(KoSnapGuide::GuideLineSnapping, 0);
+ snapGuide->enableSnapStrategy(KoSnapGuide::GuideLineSnapping, false);
m_d->decoration = 0;
m_d->viewConnections.clear();
@@ -600,3 +653,81 @@ void KisGuidesManager::slotGuideCreationFinished(Qt::Orientation orientation, co
m_d->mouseReleaseHandler(docPos);
}
+
+QAction* KisGuidesManager::Private::createShortenedAction(const QString &text, const QString &parentId, QObject *parent)
+{
+ KisActionManager *actionManager = view->viewManager()->actionManager();
+ QAction *action = 0;
+ KisAction *parentAction = 0;
+
+ action = new QAction(text, parent);
+ action->setCheckable(true);
+ parentAction = actionManager->actionByName(parentId);
+ action->setChecked(parentAction->isChecked());
+ connect(action, SIGNAL(toggled(bool)), parentAction, SLOT(setChecked(bool)));
+
+ return action;
+}
+
+void KisGuidesManager::slotShowSnapOptions()
+{
+ const QPoint pos = QCursor::pos();
+ QMenu menu;
+
+ menu.addSection(i18n("Snap to:"));
+ menu.addAction(m_d->createShortenedAction(i18n("Grid"), "view_snap_to_grid", &menu));
+ menu.addAction(m_d->createShortenedAction(i18n("Guides"), "new_snap_to_guides", &menu));
+ menu.addAction(m_d->createShortenedAction(i18n("Orthogonal"), "view_snap_orthogonal", &menu));
+
+ menu.addAction(m_d->createShortenedAction(i18n("Node"), "view_snap_node", &menu));
+ menu.addAction(m_d->createShortenedAction(i18n("Extension"), "view_snap_extension", &menu));
+ menu.addAction(m_d->createShortenedAction(i18n("Intersection"), "view_snap_intersection", &menu));
+
+ menu.addAction(m_d->createShortenedAction(i18n("Bounding Box"), "view_snap_bounding_box", &menu));
+ menu.addAction(m_d->createShortenedAction(i18n("Image Bounds"), "view_snap_image_bounds", &menu));
+ menu.addAction(m_d->createShortenedAction(i18n("Image Center"), "view_snap_image_center", &menu));
+
+ menu.exec(pos);
+}
+
+void KisGuidesManager::setSnapOrthogonal(bool value)
+{
+ m_d->snapConfig.setOrthogonal(value);
+ m_d->updateSnappingStatus(m_d->guidesConfig);
+}
+
+void KisGuidesManager::setSnapNode(bool value)
+{
+ m_d->snapConfig.setNode(value);
+ m_d->updateSnappingStatus(m_d->guidesConfig);
+}
+
+void KisGuidesManager::setSnapExtension(bool value)
+{
+ m_d->snapConfig.setExtension(value);
+ m_d->updateSnappingStatus(m_d->guidesConfig);
+}
+
+void KisGuidesManager::setSnapIntersection(bool value)
+{
+ m_d->snapConfig.setIntersection(value);
+ m_d->updateSnappingStatus(m_d->guidesConfig);
+}
+
+void KisGuidesManager::setSnapBoundingBox(bool value)
+{
+ m_d->snapConfig.setBoundingBox(value);
+ m_d->updateSnappingStatus(m_d->guidesConfig);
+}
+
+void KisGuidesManager::setSnapImageBounds(bool value)
+{
+ m_d->snapConfig.setImageBounds(value);
+ m_d->updateSnappingStatus(m_d->guidesConfig);
+}
+
+void KisGuidesManager::setSnapImageCenter(bool value)
+{
+ m_d->snapConfig.setImageCenter(value);
+ m_d->updateSnappingStatus(m_d->guidesConfig);
+}
diff --git a/libs/ui/canvas/kis_guides_manager.h b/libs/ui/canvas/kis_guides_manager.h
index 3e13097..0046e95 100644
--- a/libs/ui/canvas/kis_guides_manager.h
+++ b/libs/ui/canvas/kis_guides_manager.h
@@ -59,6 +59,15 @@ public Q_SLOTS:
void slotGuideCreationInProgress(Qt::Orientation orientation, const QPoint &globalPos);
void slotGuideCreationFinished(Qt::Orientation orientation, const QPoint &globalPos);
+ void slotShowSnapOptions();
+
+ void setSnapOrthogonal(bool value);
+ void setSnapNode(bool value);
+ void setSnapExtension(bool value);
+ void setSnapIntersection(bool value);
+ void setSnapBoundingBox(bool value);
+ void setSnapImageBounds(bool value);
+ void setSnapImageCenter(bool value);
private:
void setGuidesConfigImpl(const KisGuidesConfig &value, bool emitModified = true);
void attachEventFilterImpl(bool value);
diff --git a/libs/ui/canvas/kis_snap_config.cpp b/libs/ui/canvas/kis_snap_config.cpp
new file mode 100644
index 0000000..76ece46
--- /dev/null
+++ b/libs/ui/canvas/kis_snap_config.cpp
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2016 Dmitry Kazakov <dimula73 at gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "kis_snap_config.h"
+
+#include "kis_config.h"
+
+KisSnapConfig::KisSnapConfig(bool loadValues)
+ : m_orthogonal(false),
+ m_node(false),
+ m_extension(false),
+ m_intersection(false),
+ m_boundingBox(false),
+ m_imageBounds(true),
+ m_imageCenter(true)
+{
+ if (loadValues) {
+ loadStaticData();
+ }
+}
+
+
+KisSnapConfig::~KisSnapConfig()
+{
+}
+
+void KisSnapConfig::saveStaticData() const
+{
+ KisConfig cfg;
+ cfg.saveSnapConfig(*this);
+}
+
+void KisSnapConfig::loadStaticData()
+{
+ KisConfig cfg;
+ cfg.loadSnapConfig(this);
+}
diff --git a/libs/ui/canvas/kis_snap_config.h b/libs/ui/canvas/kis_snap_config.h
new file mode 100644
index 0000000..dbc1adb
--- /dev/null
+++ b/libs/ui/canvas/kis_snap_config.h
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2016 Dmitry Kazakov <dimula73 at gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __KIS_SNAP_CONFIG_H
+#define __KIS_SNAP_CONFIG_H
+
+
+class KisSnapConfig
+{
+public:
+ KisSnapConfig(bool loadValues = true);
+ ~KisSnapConfig();
+
+ bool orthogonal() const {
+ return m_orthogonal;
+ }
+ void setOrthogonal(bool value) {
+ m_orthogonal = value;
+ }
+
+ bool node() const {
+ return m_node;
+ }
+ void setNode(bool value) {
+ m_node = value;
+ }
+
+ bool extension() const {
+ return m_extension;
+ }
+ void setExtension(bool value) {
+ m_extension = value;
+ }
+
+ bool intersection() const {
+ return m_intersection;
+ }
+ void setIntersection(bool value) {
+ m_intersection = value;
+ }
+
+ bool boundingBox() const {
+ return m_boundingBox;
+ }
+ void setBoundingBox(bool value) {
+ m_boundingBox = value;
+ }
+
+ bool imageBounds() const {
+ return m_imageBounds;
+ }
+ void setImageBounds(bool value) {
+ m_imageBounds = value;
+ }
+
+ bool imageCenter() const {
+ return m_imageCenter;
+ }
+ void setImageCenter(bool value) {
+ m_imageCenter = value;
+ }
+
+ void saveStaticData() const;
+ void loadStaticData();
+
+private:
+ bool m_orthogonal;
+ bool m_node;
+ bool m_extension;
+ bool m_intersection;
+ bool m_boundingBox;
+ bool m_imageBounds;
+ bool m_imageCenter;
+};
+
+#endif /* __KIS_SNAP_CONFIG_H */
diff --git a/libs/ui/canvas/kis_snap_guide_config_widget.cpp b/libs/ui/canvas/kis_snap_guide_config_widget.cpp
deleted file mode 100644
index f87cb30..0000000
--- a/libs/ui/canvas/kis_snap_guide_config_widget.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-/* This file is part of the KDE project
- * Copyright (C) 2008 Jan Hambrecht <jaham at gmx.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "kis_snap_guide_config_widget.h"
-#include "KoSnapGuide.h"
-
-#include <KoIcon.h>
-
-KisSnapGuideConfigWidget::KisSnapGuideConfigWidget(KoSnapGuide * snapGuide, QWidget * parent)
- : QWidget(parent), m_snapGuide(snapGuide)
-{
- widget.setupUi(this);
-
- widget.orthogonalSnapGuide->setIcon(koIcon("snap-orthogonal"));
- widget.nodeSnapGuide->setIcon(koIcon("snap-node"));
- widget.extensionSnapGuide->setIcon(koIcon("snap-extension"));
- widget.intersectionSnapGuide->setIcon(koIcon("snap-intersection"));
- widget.boundingBoxSnapGuide->setIcon(koIcon("snap-boundingbox"));
- widget.lineGuideSnapGuide->setIcon(koIcon("snap-guideline"));
-
- updateControls();
-
- connect(widget.useSnapGuides, SIGNAL(toggled(bool)), this, SLOT(snappingEnabled(bool)));
- connect(widget.orthogonalSnapGuide, SIGNAL(toggled(bool)), this, SLOT(strategyChanged()));
- connect(widget.nodeSnapGuide, SIGNAL(toggled(bool)), this, SLOT(strategyChanged()));
- connect(widget.extensionSnapGuide, SIGNAL(toggled(bool)), this, SLOT(strategyChanged()));
- connect(widget.intersectionSnapGuide, SIGNAL(toggled(bool)), this, SLOT(strategyChanged()));
- connect(widget.boundingBoxSnapGuide, SIGNAL(toggled(bool)), this, SLOT(strategyChanged()));
- connect(widget.lineGuideSnapGuide, SIGNAL(toggled(bool)), this, SLOT(strategyChanged()));
- connect(widget.snapDistance, SIGNAL(valueChanged(int)), this, SLOT(distanceChanged(int)));
-
- widget.useSnapGuides->setChecked(snapGuide->isSnapping());
-}
-
-KisSnapGuideConfigWidget::~KisSnapGuideConfigWidget()
-{
-}
-
-void KisSnapGuideConfigWidget::snappingEnabled(bool isEnabled)
-{
- widget.orthogonalSnapGuide->setEnabled(isEnabled);
- widget.nodeSnapGuide->setEnabled(isEnabled);
- widget.extensionSnapGuide->setEnabled(isEnabled);
- widget.intersectionSnapGuide->setEnabled(isEnabled);
- widget.boundingBoxSnapGuide->setEnabled(isEnabled);
- widget.lineGuideSnapGuide->setEnabled(isEnabled);
- widget.snapDistance->setEnabled(isEnabled);
-
- m_snapGuide->enableSnapping(isEnabled);
-}
-
-void KisSnapGuideConfigWidget::strategyChanged()
-{
- KoSnapGuide::Strategies strategies;
- if (widget.orthogonalSnapGuide->isChecked())
- strategies |= KoSnapGuide::OrthogonalSnapping;
- if (widget.nodeSnapGuide->isChecked())
- strategies |= KoSnapGuide::NodeSnapping;
- if (widget.extensionSnapGuide->isChecked())
- strategies |= KoSnapGuide::ExtensionSnapping;
- if (widget.intersectionSnapGuide->isChecked())
- strategies |= KoSnapGuide::IntersectionSnapping;
- if (widget.boundingBoxSnapGuide->isChecked())
- strategies |= KoSnapGuide::BoundingBoxSnapping;
- if (widget.lineGuideSnapGuide->isChecked())
- strategies |= KoSnapGuide::GuideLineSnapping;
-
- m_snapGuide->enableSnapStrategies(strategies);
-}
-
-void KisSnapGuideConfigWidget::distanceChanged(int distance)
-{
- m_snapGuide->setSnapDistance(distance);
-}
-
-void KisSnapGuideConfigWidget::updateControls()
-{
- const KoSnapGuide::Strategies enabledSnapStrategies = m_snapGuide->enabledSnapStrategies();
-
- widget.orthogonalSnapGuide->setChecked(enabledSnapStrategies & KoSnapGuide::OrthogonalSnapping);
- widget.nodeSnapGuide->setChecked(enabledSnapStrategies & KoSnapGuide::NodeSnapping);
- widget.extensionSnapGuide->setChecked(enabledSnapStrategies & KoSnapGuide::ExtensionSnapping);
- widget.intersectionSnapGuide->setChecked(enabledSnapStrategies & KoSnapGuide::IntersectionSnapping);
- widget.boundingBoxSnapGuide->setChecked(enabledSnapStrategies & KoSnapGuide::BoundingBoxSnapping);
- widget.lineGuideSnapGuide->setChecked(enabledSnapStrategies & KoSnapGuide::GuideLineSnapping);
-
- widget.snapDistance->setValue(m_snapGuide->snapDistance());
-}
-
-void KisSnapGuideConfigWidget::showEvent(QShowEvent * event)
-{
- Q_UNUSED(event);
- updateControls();
-}
diff --git a/libs/ui/canvas/kis_snap_guide_config_widget.h b/libs/ui/canvas/kis_snap_guide_config_widget.h
deleted file mode 100644
index 1b346a9..0000000
--- a/libs/ui/canvas/kis_snap_guide_config_widget.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* This file is part of the KDE project
- * Copyright (C) 2008 Jan Hambrecht <jaham at gmx.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef SNAPGUIDECONFIGWIDGET_H
-#define SNAPGUIDECONFIGWIDGET_H
-
-#include "ui_kis_snap_guide_config_widget.h"
-
-#include <QWidget>
-
-class KoSnapGuide;
-class QShowEvent;
-
-class KisSnapGuideConfigWidget : public QWidget
-{
- Q_OBJECT
-public:
- explicit KisSnapGuideConfigWidget(KoSnapGuide *snapGuide, QWidget *parent = 0);
- ~KisSnapGuideConfigWidget();
-
-private Q_SLOTS:
- void snappingEnabled(bool isEnabled);
- void strategyChanged();
- void distanceChanged(int distance);
- void updateControls();
-
-protected:
- virtual void showEvent(QShowEvent *event);
-
-private:
-
- Ui_SnapGuideConfigWidget widget;
- KoSnapGuide *m_snapGuide;
-};
-
-#endif // SNAPGUIDECONFIGWIDGET_H
diff --git a/libs/ui/canvas/kis_snap_guide_config_widget.ui b/libs/ui/canvas/kis_snap_guide_config_widget.ui
deleted file mode 100644
index bb5fc4b..0000000
--- a/libs/ui/canvas/kis_snap_guide_config_widget.ui
+++ /dev/null
@@ -1,139 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>SnapGuideConfigWidget</class>
- <widget class="QWidget" name="SnapGuideConfigWidget">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>218</width>
- <height>66</height>
- </rect>
- </property>
- <layout class="QGridLayout" columnstretch="0,0,0,0,1" rowstretch="0,0,1">
- <property name="margin">
- <number>0</number>
- </property>
- <item row="0" column="0">
- <widget class="QCheckBox" name="useSnapGuides">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QToolButton" name="nodeSnapGuide">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="toolTip">
- <string>Nodes</string>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item row="0" column="2">
- <widget class="QToolButton" name="extensionSnapGuide">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="toolTip">
- <string>Extension of lines</string>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item row="0" column="3">
- <widget class="QToolButton" name="boundingBoxSnapGuide">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="toolTip">
- <string>Bounding box of shape</string>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QSpinBox" name="snapDistance">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="toolTip">
- <string>Proximity distance where snapping happens</string>
- </property>
- <property name="suffix">
- <string> px</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QToolButton" name="orthogonalSnapGuide">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="toolTip">
- <string>Orthogonal</string>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item row="1" column="2">
- <widget class="QToolButton" name="intersectionSnapGuide">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="toolTip">
- <string>Intersection of lines</string>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item row="1" column="3">
- <widget class="QToolButton" name="lineGuideSnapGuide">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="toolTip">
- <string>Guide lines</string>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QWidget" name="SpecialSpacer">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
- <item row="0" column="4">
- <spacer>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/libs/ui/canvas/kis_snap_line_strategy.cpp b/libs/ui/canvas/kis_snap_line_strategy.cpp
index b153234..2bf85e4 100644
--- a/libs/ui/canvas/kis_snap_line_strategy.cpp
+++ b/libs/ui/canvas/kis_snap_line_strategy.cpp
@@ -39,6 +39,8 @@ KisSnapLineStrategy::~KisSnapLineStrategy()
bool KisSnapLineStrategy::snap(const QPointF &mousePosition, KoSnapProxy *proxy, qreal maxSnapDistance)
{
+ Q_UNUSED(proxy);
+
QPointF snappedPoint = mousePosition;
qreal minXDistance = std::numeric_limits<qreal>::max();
qreal minYDistance = std::numeric_limits<qreal>::max();
@@ -77,6 +79,7 @@ bool KisSnapLineStrategy::snap(const QPointF &mousePosition, KoSnapProxy *proxy,
QPainterPath KisSnapLineStrategy::decoration(const KoViewConverter &converter) const
{
+ Q_UNUSED(converter);
return QPainterPath();
}
diff --git a/libs/ui/kis_config.cc b/libs/ui/kis_config.cc
index 840bcc7..8cb4a5d 100644
--- a/libs/ui/kis_config.cc
+++ b/libs/ui/kis_config.cc
@@ -41,6 +41,7 @@
#include "kis_canvas_resource_provider.h"
#include "kis_config_notifier.h"
+#include "kis_snap_config.h"
#include <config-ocio.h>
@@ -755,6 +756,35 @@ void KisConfig::setGuidesColor(const QColor & v) const
m_cfg.writeEntry("guidesColor", v);
}
+void KisConfig::loadSnapConfig(KisSnapConfig *config, bool defaultValue) const
+{
+ KisSnapConfig defaultConfig(false);
+
+ if (defaultValue) {
+ *config = defaultConfig;
+ return;
+ }
+
+ config->setOrthogonal(m_cfg.readEntry("globalSnapOrthogonal", defaultConfig.orthogonal()));
+ config->setNode(m_cfg.readEntry("globalSnapNode", defaultConfig.node()));
+ config->setExtension(m_cfg.readEntry("globalSnapExtension", defaultConfig.extension()));
+ config->setIntersection(m_cfg.readEntry("globalSnapIntersection", defaultConfig.intersection()));
+ config->setBoundingBox(m_cfg.readEntry("globalSnapBoundingBox", defaultConfig.boundingBox()));
+ config->setImageBounds(m_cfg.readEntry("globalSnapImageBounds", defaultConfig.imageBounds()));
+ config->setImageCenter(m_cfg.readEntry("globalSnapImageCenter", defaultConfig.imageCenter()));
+}
+
+void KisConfig::saveSnapConfig(const KisSnapConfig &config)
+{
+ m_cfg.writeEntry("globalSnapOrthogonal", config.orthogonal());
+ m_cfg.writeEntry("globalSnapNode", config.node());
+ m_cfg.writeEntry("globalSnapExtension", config.extension());
+ m_cfg.writeEntry("globalSnapIntersection", config.intersection());
+ m_cfg.writeEntry("globalSnapBoundingBox", config.boundingBox());
+ m_cfg.writeEntry("globalSnapImageBounds", config.imageBounds());
+ m_cfg.writeEntry("globalSnapImageCenter", config.imageCenter());
+}
+
qint32 KisConfig::checkSize(bool defaultValue) const
{
return (defaultValue ? 32 : m_cfg.readEntry("checksize", 32));
diff --git a/libs/ui/kis_config.h b/libs/ui/kis_config.h
index 7cf0475..43ab35e 100644
--- a/libs/ui/kis_config.h
+++ b/libs/ui/kis_config.h
@@ -32,6 +32,7 @@
class KoColorProfile;
class KoColorSpace;
+class KisSnapConfig;
class KRITAUI_EXPORT KisConfig
{
@@ -193,6 +194,9 @@ public:
QColor guidesColor(bool defaultValue = false) const;
void setGuidesColor(const QColor & v) const;
+ void loadSnapConfig(KisSnapConfig *config, bool defaultValue = false) const;
+ void saveSnapConfig(const KisSnapConfig &config);
+
qint32 checkSize(bool defaultValue = false) const;
void setCheckSize(qint32 checkSize) const;
diff --git a/plugins/dockers/CMakeLists.txt b/plugins/dockers/CMakeLists.txt
index 82da719..3266236 100644
--- a/plugins/dockers/CMakeLists.txt
+++ b/plugins/dockers/CMakeLists.txt
@@ -2,9 +2,6 @@ project(calligradockers)
set(calligradockers_SRCS
- snapguidedocker/SnapGuideDocker.cpp
- snapguidedocker/SnapGuideDockerFactory.cpp
-
shapeproperties/ShapePropertiesDocker.cpp
shapeproperties/ShapePropertiesDockerFactory.cpp
diff --git a/plugins/dockers/Plugin.cpp b/plugins/dockers/Plugin.cpp
index 4347c77..778ffda 100644
--- a/plugins/dockers/Plugin.cpp
+++ b/plugins/dockers/Plugin.cpp
@@ -17,7 +17,6 @@
* Boston, MA 02110-1301, USA.
*/
#include "Plugin.h"
-#include "snapguidedocker/SnapGuideDockerFactory.h"
#include "shapeproperties/ShapePropertiesDockerFactory.h"
#include "shapecollection/ShapeCollectionDocker.h"
@@ -31,7 +30,6 @@ Plugin::Plugin(QObject *parent, const QVariantList &)
: QObject(parent)
{
Q_UNUSED(parent);
- KoDockRegistry::instance()->add(new SnapGuideDockerFactory());
KoDockRegistry::instance()->add(new ShapePropertiesDockerFactory());
KoDockRegistry::instance()->add(new ShapeCollectionDockerFactory());
}
diff --git a/plugins/dockers/snapguidedocker/SnapGuideDocker.cpp b/plugins/dockers/snapguidedocker/SnapGuideDocker.cpp
deleted file mode 100644
index 3f0d7f5..0000000
--- a/plugins/dockers/snapguidedocker/SnapGuideDocker.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/* This file is part of the KDE project
- Copyright (C) 2002 Tomislav Lukman <tomislav.lukman at ck.t-com.hr>
- Copyright (C) 2002 Rob Buis <buis at kde.org>
- Copyright (C) 2004 Laurent Montel <montel at kde.org>
- Copyright (C) 2005-2006 Tim Beaulen <tbscope at gmail.com>
- Copyright (C) 2005 Inge Wallin <inge at lysator.liu.se>
- Copyright (C) 2005 Thomas Zander <zander at kde.org>
- Copyright (C) 2005-2008 Jan Hambrecht <jaham at gmx.net>
- Copyright (C) 2006 C. Boemann <cbo at boemann.dk>
- Copyright (C) 2012 Jean-Nicolas Artaud <jeannicolasartaud at gmail.com>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
-*/
-
-#include "SnapGuideDocker.h"
-
-#include <klocalizedstring.h>
-
-#include <KoCanvasBase.h>
-#include <KoCanvasObserverBase.h>
-#include <KoSnapGuide.h>
-
-class SnapGuideDocker::Private
-{
-public:
- Private()
- : canvas(0)
- , mainWidget(0)
- {}
-
- KoCanvasBase *canvas;
- QPointer<QWidget> mainWidget;
-};
-
-SnapGuideDocker::SnapGuideDocker()
- : d(new Private())
-{
- setWindowTitle(i18n("Snap Settings"));
-}
-
-SnapGuideDocker::~SnapGuideDocker()
-{
- delete d;
-}
-
-void SnapGuideDocker::setCanvas(KoCanvasBase *canvas)
-{
- setEnabled(canvas != 0);
-
- if (d->canvas) {
- d->canvas->disconnectCanvasObserver(this); // "Every connection you make emits a signal, so duplicate connections emit two signals"
- if (d->mainWidget) {
- d->mainWidget->deleteLater();
- }
- }
-
- if (canvas) {
- d->mainWidget = canvas->createSnapGuideConfigWidget();
- }
-
- d->canvas = canvas;
- setWidget(d->mainWidget);
-}
-
-void SnapGuideDocker::unsetCanvas()
-{
- setEnabled(false);
- setWidget(0);
- d->canvas = 0;
- if (d->mainWidget) {
- d->mainWidget->deleteLater();
- }
-}
-
-void SnapGuideDocker::locationChanged(Qt::DockWidgetArea area)
-{
- Q_UNUSED(area);
-}
diff --git a/plugins/dockers/snapguidedocker/SnapGuideDocker.h b/plugins/dockers/snapguidedocker/SnapGuideDocker.h
deleted file mode 100644
index a484f7b..0000000
--- a/plugins/dockers/snapguidedocker/SnapGuideDocker.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* This file is part of the KDE project
- Made by Tomislav Lukman (tomislav.lukman at ck.tel.hr)
- Copyright (C) 2002 Tomislav Lukman <tomislav.lukman at ck.t-com.hr>
- Copyright (C) 2002 Rob Buis <buis at kde.org>
- Copyright (C) 2004 Laurent Montel <montel at kde.org>
- Copyright (C) 2005-2006 Tim Beaulen <tbscope at gmail.com>
- Copyright (C) 2005 Inge Wallin <inge at lysator.liu.se>
- Copyright (C) 2005 Thomas Zander <zander at kde.org>
- Copyright (C) 2005-2008 Jan Hambrecht <jaham at gmx.net>
- Copyright (C) 2006 C. Boemann <cbo at boemann.dk>
- Copyright (C) 2012 Jean-Nicolas Artaud <jeannicolasartaud at gmail.com>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
-*/
-
-#ifndef SNAPGUIDEDOCKER_H
-#define SNAPGUIDEDOCKER_H
-
-#include <KoCanvasObserverBase.h>
-#include <QDockWidget>
-
-/// A docker for setting properties of a snapping
-class SnapGuideDocker : public QDockWidget, public KoCanvasObserverBase
-{
- Q_OBJECT
-
-public:
- /// Creates the stroke docker
- SnapGuideDocker();
- virtual ~SnapGuideDocker();
- QString observerName()
- {
- return "SnapGuideDocker";
- }
-private Q_SLOTS:
- void locationChanged(Qt::DockWidgetArea area);
-
-private:
- /// reimplemented
- virtual void setCanvas(KoCanvasBase *canvas);
- virtual void unsetCanvas();
-
-private:
- class Private;
- Private *const d;
-};
-
-#endif // SNAPGUIDEDOCKER_H
-
diff --git a/plugins/dockers/snapguidedocker/SnapGuideDockerFactory.cpp b/plugins/dockers/snapguidedocker/SnapGuideDockerFactory.cpp
deleted file mode 100644
index bf85514..0000000
--- a/plugins/dockers/snapguidedocker/SnapGuideDockerFactory.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/* This file is part of the KDE project
- Copyright (C) 2012 Jean-Nicolas Artaud <jeannicolasartaud at gmail.com>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
-*/
-
-#include "SnapGuideDockerFactory.h"
-#include "SnapGuideDocker.h"
-
-SnapGuideDockerFactory::SnapGuideDockerFactory()
-{
-}
-
-QString SnapGuideDockerFactory::id() const
-{
- return QString("SnapGuide Properties");
-}
-
-QDockWidget *SnapGuideDockerFactory::createDockWidget()
-{
- SnapGuideDocker *widget = new SnapGuideDocker();
- widget->setObjectName(id());
-
- return widget;
-}
-
-KoDockFactoryBase::DockPosition SnapGuideDockerFactory::defaultDockPosition() const
-{
- return DockMinimized;
-}
diff --git a/plugins/dockers/snapguidedocker/SnapGuideDockerFactory.h b/plugins/dockers/snapguidedocker/SnapGuideDockerFactory.h
deleted file mode 100644
index f200437..0000000
--- a/plugins/dockers/snapguidedocker/SnapGuideDockerFactory.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* This file is part of the KDE project
- Copyright (C) 2007 Jan Hambrecht <jaham at gmx.net>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
-*/
-
-#ifndef SNAPGUIDEDOCKERFACTORY_H
-#define SNAPGUIDEDOCKERFACTORY_H
-
-#include <KoDockFactoryBase.h>
-#include <QDockWidget>
-
-/// the factory which creates the stroke docker
-class SnapGuideDockerFactory : public KoDockFactoryBase
-{
-public:
- SnapGuideDockerFactory();
-
- virtual QString id() const;
- virtual QDockWidget *createDockWidget();
- virtual KoDockFactoryBase::DockPosition defaultDockPosition() const;
-
-};
-
-#endif // SNAPGUIDEDOCKERFACTORY_H
More information about the kimageshop
mailing list