summaryrefslogtreecommitdiffstats
path: root/src/ui/tools/gradient-tool.cpp
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2015-03-18 18:07:14 +0000
committerJabiertxof <jtx@jtx.marker.es>2015-03-18 18:07:14 +0000
commite77956b4dbd029c9f6949f81fe083606f995c624 (patch)
tree74adda4df8986d65f70efb341c6235277361fd35 /src/ui/tools/gradient-tool.cpp
parentupdated code to work on 0.92 code (diff)
parentLatvian translation update (diff)
downloadinkscape-e77956b4dbd029c9f6949f81fe083606f995c624.tar.gz
inkscape-e77956b4dbd029c9f6949f81fe083606f995c624.zip
update to trunk
(bzr r12588.1.39)
Diffstat (limited to 'src/ui/tools/gradient-tool.cpp')
-rw-r--r--src/ui/tools/gradient-tool.cpp30
1 files changed, 10 insertions, 20 deletions
diff --git a/src/ui/tools/gradient-tool.cpp b/src/ui/tools/gradient-tool.cpp
index 9c853917e..5be84eb76 100644
--- a/src/ui/tools/gradient-tool.cpp
+++ b/src/ui/tools/gradient-tool.cpp
@@ -23,7 +23,7 @@
#include "document.h"
#include "selection.h"
#include "desktop.h"
-#include "desktop-handles.h"
+
#include "message-context.h"
#include "message-stack.h"
#include "pixmaps/cursor-gradient.xpm"
@@ -51,22 +51,12 @@
using Inkscape::DocumentUndo;
-#include "ui/tool-factory.h"
-
namespace Inkscape {
namespace UI {
namespace Tools {
static void sp_gradient_drag(GradientTool &rc, Geom::Point const pt, guint state, guint32 etime);
-namespace {
- ToolBase* createGradientContext() {
- return new GradientTool();
- }
-
- bool gradientContextRegistered = ToolFactory::instance().registerObject("/tools/gradient", createGradientContext);
-}
-
const std::string& GradientTool::getPrefsPath() {
return GradientTool::prefsPath;
}
@@ -112,7 +102,7 @@ void GradientTool::selection_changed(Inkscape::Selection*) {
GradientTool *rc = (GradientTool *) this;
GrDrag *drag = rc->_grdrag;
- Inkscape::Selection *selection = sp_desktop_selection(SP_EVENT_CONTEXT(rc)->desktop);
+ Inkscape::Selection *selection = this->desktop->getSelection();
if (selection == NULL) {
return;
}
@@ -167,7 +157,7 @@ void GradientTool::setup() {
}
this->enableGrDrag();
- Inkscape::Selection *selection = sp_desktop_selection(this->desktop);
+ Inkscape::Selection *selection = this->desktop->getSelection();
this->selcon = new sigc::connection(selection->connectChanged(
sigc::mem_fun(this, &GradientTool::selection_changed)
@@ -464,7 +454,7 @@ sp_gradient_context_add_stop_near_point (GradientTool *rc, SPItem *item, Geom::
SPStop *newstop = ec->get_drag()->addStopNearPoint (item, mouse_p, tolerance/desktop->current_zoom());
- DocumentUndo::done(sp_desktop_document (desktop), SP_VERB_CONTEXT_GRADIENT,
+ DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_GRADIENT,
_("Add gradient stop"));
ec->get_drag()->updateDraggers();
@@ -475,7 +465,7 @@ sp_gradient_context_add_stop_near_point (GradientTool *rc, SPItem *item, Geom::
bool GradientTool::root_handler(GdkEvent* event) {
static bool dragging;
- Inkscape::Selection *selection = sp_desktop_selection (desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
this->tolerance = prefs->getIntLimited("/options/dragtolerance/value", 0, 0, 100);
@@ -509,13 +499,13 @@ bool GradientTool::root_handler(GdkEvent* event) {
SPGradientType new_type = (SPGradientType) prefs->getInt("/tools/gradient/newgradient", SP_GRADIENT_TYPE_LINEAR);
Inkscape::PaintTarget fsmode = (prefs->getInt("/tools/gradient/newfillorstroke", 1) != 0) ? Inkscape::FOR_FILL : Inkscape::FOR_STROKE;
- SPGradient *vector = sp_gradient_vector_for_object(sp_desktop_document(desktop), desktop, item, fsmode);
+ SPGradient *vector = sp_gradient_vector_for_object(desktop->getDocument(), desktop, item, fsmode);
SPGradient *priv = sp_item_set_gradient(item, vector, new_type, fsmode);
sp_gradient_reset_to_userspace(priv, item);
}
- DocumentUndo::done(sp_desktop_document (desktop), SP_VERB_CONTEXT_GRADIENT,
+ DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_GRADIENT,
_("Create default gradient"));
}
ret = TRUE;
@@ -892,8 +882,8 @@ bool GradientTool::root_handler(GdkEvent* event) {
static void sp_gradient_drag(GradientTool &rc, Geom::Point const pt, guint /*state*/, guint32 etime)
{
SPDesktop *desktop = SP_EVENT_CONTEXT(&rc)->desktop;
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
- SPDocument *document = sp_desktop_document(desktop);
+ Inkscape::Selection *selection = desktop->getSelection();
+ SPDocument *document = desktop->getDocument();
ToolBase *ec = SP_EVENT_CONTEXT(&rc);
if (!selection->isEmpty()) {
@@ -957,7 +947,7 @@ static void sp_gradient_drag(GradientTool &rc, Geom::Point const pt, guint /*sta
"<b>Gradient</b> for %d objects; with <b>Ctrl</b> to snap angle", n_objects),
n_objects);
} else {
- sp_desktop_message_stack(desktop)->flash(Inkscape::WARNING_MESSAGE, _("Select <b>objects</b> on which to create gradient."));
+ desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>objects</b> on which to create gradient."));
}
}