summaryrefslogtreecommitdiffstats
path: root/src/ui/tools
diff options
context:
space:
mode:
authorMartin Owens <doctormo@gmail.com>2017-06-30 03:58:14 +0000
committerMartin Owens <doctormo@gmail.com>2017-06-30 03:58:14 +0000
commitf55448431e934bf29bb9a983711d204614db7cc7 (patch)
tree52358e8121babdf471b4cb86f1b704275e5865ac /src/ui/tools
parentMerge branch 'master' of gitlab.com:inkscape/inkscape (diff)
downloadinkscape-f55448431e934bf29bb9a983711d204614db7cc7.tar.gz
inkscape-f55448431e934bf29bb9a983711d204614db7cc7.zip
Hackfest: Refactor cursors so the hot spot is inside the xpm
Diffstat (limited to 'src/ui/tools')
-rw-r--r--src/ui/tools/arc-tool.cpp2
-rw-r--r--src/ui/tools/box3d-tool.cpp2
-rw-r--r--src/ui/tools/calligraphic-tool.cpp2
-rw-r--r--src/ui/tools/connector-tool.cpp2
-rw-r--r--src/ui/tools/dropper-tool.cpp6
-rw-r--r--src/ui/tools/dynamic-base.cpp4
-rw-r--r--src/ui/tools/dynamic-base.h2
-rw-r--r--src/ui/tools/eraser-tool.cpp2
-rw-r--r--src/ui/tools/flood-tool.cpp2
-rw-r--r--src/ui/tools/freehand-base.cpp4
-rw-r--r--src/ui/tools/freehand-base.h2
-rw-r--r--src/ui/tools/gradient-tool.cpp2
-rw-r--r--src/ui/tools/lpe-tool.cpp2
-rw-r--r--src/ui/tools/measure-tool.cpp2
-rw-r--r--src/ui/tools/mesh-tool.cpp2
-rw-r--r--src/ui/tools/node-tool.cpp6
-rw-r--r--src/ui/tools/pen-tool.cpp6
-rw-r--r--src/ui/tools/pen-tool.h2
-rw-r--r--src/ui/tools/pencil-tool.cpp2
-rw-r--r--src/ui/tools/rect-tool.cpp2
-rw-r--r--src/ui/tools/select-tool.cpp6
-rw-r--r--src/ui/tools/spiral-tool.cpp2
-rw-r--r--src/ui/tools/spray-tool.cpp2
-rw-r--r--src/ui/tools/star-tool.cpp2
-rw-r--r--src/ui/tools/text-tool.cpp6
-rw-r--r--src/ui/tools/tool-base.cpp55
-rw-r--r--src/ui/tools/tool-base.h5
-rw-r--r--src/ui/tools/tweak-tool.cpp16
-rw-r--r--src/ui/tools/zoom-tool.cpp2
29 files changed, 59 insertions, 93 deletions
diff --git a/src/ui/tools/arc-tool.cpp b/src/ui/tools/arc-tool.cpp
index 6652f7ab5..01e0c3e00 100644
--- a/src/ui/tools/arc-tool.cpp
+++ b/src/ui/tools/arc-tool.cpp
@@ -59,7 +59,7 @@ const std::string ArcTool::prefsPath = "/tools/shapes/arc";
ArcTool::ArcTool()
- : ToolBase(cursor_ellipse_xpm, 4, 4)
+ : ToolBase(cursor_ellipse_xpm)
, arc(NULL)
{
}
diff --git a/src/ui/tools/box3d-tool.cpp b/src/ui/tools/box3d-tool.cpp
index 425695a2c..276385335 100644
--- a/src/ui/tools/box3d-tool.cpp
+++ b/src/ui/tools/box3d-tool.cpp
@@ -54,7 +54,7 @@ const std::string& Box3dTool::getPrefsPath() {
const std::string Box3dTool::prefsPath = "/tools/shapes/3dbox";
Box3dTool::Box3dTool()
- : ToolBase(cursor_3dbox_xpm, 4, 4)
+ : ToolBase(cursor_3dbox_xpm)
, _vpdrag(NULL)
, box3d(NULL)
, ctrl_dragged(false)
diff --git a/src/ui/tools/calligraphic-tool.cpp b/src/ui/tools/calligraphic-tool.cpp
index 7228a52bc..266375caa 100644
--- a/src/ui/tools/calligraphic-tool.cpp
+++ b/src/ui/tools/calligraphic-tool.cpp
@@ -88,7 +88,7 @@ const std::string& CalligraphicTool::getPrefsPath() {
const std::string CalligraphicTool::prefsPath = "/tools/calligraphic";
CalligraphicTool::CalligraphicTool()
- : DynamicBase(cursor_calligraphy_xpm, 4, 4)
+ : DynamicBase(cursor_calligraphy_xpm)
, keep_selected(true)
, hatch_spacing(0)
, hatch_spacing_step(0)
diff --git a/src/ui/tools/connector-tool.cpp b/src/ui/tools/connector-tool.cpp
index 7e6fb4b72..29be4831a 100644
--- a/src/ui/tools/connector-tool.cpp
+++ b/src/ui/tools/connector-tool.cpp
@@ -145,7 +145,7 @@ const std::string& ConnectorTool::getPrefsPath() {
const std::string ConnectorTool::prefsPath = "/tools/connector";
ConnectorTool::ConnectorTool()
- : ToolBase(cursor_connector_xpm, 1, 1)
+ : ToolBase(cursor_connector_xpm)
, selection(NULL)
, npoints(0)
, state(SP_CONNECTOR_CONTEXT_IDLE)
diff --git a/src/ui/tools/dropper-tool.cpp b/src/ui/tools/dropper-tool.cpp
index 99177dc75..bd341262b 100644
--- a/src/ui/tools/dropper-tool.cpp
+++ b/src/ui/tools/dropper-tool.cpp
@@ -60,7 +60,7 @@ const std::string& DropperTool::getPrefsPath() {
const std::string DropperTool::prefsPath = "/tools/dropper";
DropperTool::DropperTool()
- : ToolBase(cursor_dropper_f_xpm, 5, 5)
+ : ToolBase(cursor_dropper_f_xpm)
, R(0)
, G(0)
, B(0)
@@ -70,8 +70,8 @@ DropperTool::DropperTool()
, area(NULL)
, centre(0, 0)
{
- cursor_dropper_fill = sp_cursor_new_from_xpm(cursor_dropper_f_xpm , 5, 5);
- cursor_dropper_stroke = sp_cursor_new_from_xpm(cursor_dropper_s_xpm , 5, 5);
+ cursor_dropper_fill = sp_cursor_from_xpm(cursor_dropper_f_xpm);
+ cursor_dropper_stroke = sp_cursor_from_xpm(cursor_dropper_s_xpm);
}
DropperTool::~DropperTool() {
diff --git a/src/ui/tools/dynamic-base.cpp b/src/ui/tools/dynamic-base.cpp
index 6627a470e..bb4989333 100644
--- a/src/ui/tools/dynamic-base.cpp
+++ b/src/ui/tools/dynamic-base.cpp
@@ -18,8 +18,8 @@ namespace Inkscape {
namespace UI {
namespace Tools {
-DynamicBase::DynamicBase(gchar const *const *cursor_shape, gint hot_x, gint hot_y)
- : ToolBase(cursor_shape, hot_x, hot_y)
+DynamicBase::DynamicBase(gchar const *const *cursor_shape)
+ : ToolBase(cursor_shape)
, accumulated(NULL)
, segments(NULL)
, currentshape(NULL)
diff --git a/src/ui/tools/dynamic-base.h b/src/ui/tools/dynamic-base.h
index 095af8f88..e270052f3 100644
--- a/src/ui/tools/dynamic-base.h
+++ b/src/ui/tools/dynamic-base.h
@@ -38,7 +38,7 @@ namespace Tools {
class DynamicBase : public ToolBase {
public:
- DynamicBase(gchar const *const *cursor_shape, gint hot_x, gint hot_y);
+ DynamicBase(gchar const *const *cursor_shape);
virtual ~DynamicBase();
virtual void set(const Inkscape::Preferences::Entry& val);
diff --git a/src/ui/tools/eraser-tool.cpp b/src/ui/tools/eraser-tool.cpp
index ae312e054..b4246b9cc 100644
--- a/src/ui/tools/eraser-tool.cpp
+++ b/src/ui/tools/eraser-tool.cpp
@@ -93,7 +93,7 @@ const std::string& EraserTool::getPrefsPath() {
const std::string EraserTool::prefsPath = "/tools/eraser";
EraserTool::EraserTool()
- : DynamicBase(cursor_eraser_xpm, 4, 4)
+ : DynamicBase(cursor_eraser_xpm)
, nowidth(false)
{
}
diff --git a/src/ui/tools/flood-tool.cpp b/src/ui/tools/flood-tool.cpp
index 6e1d085aa..f6f9b4355 100644
--- a/src/ui/tools/flood-tool.cpp
+++ b/src/ui/tools/flood-tool.cpp
@@ -98,7 +98,7 @@ Glib::ustring gap_init[4] = {
const std::vector<Glib::ustring> FloodTool::gap_list( gap_init, gap_init+4 );
FloodTool::FloodTool()
- : ToolBase(cursor_paintbucket_xpm, 11, 30)
+ : ToolBase(cursor_paintbucket_xpm)
, item(NULL)
{
// TODO: Why does the flood tool use a hardcoded tolerance instead of a pref?
diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp
index 4af70a816..8a5ef0aad 100644
--- a/src/ui/tools/freehand-base.cpp
+++ b/src/ui/tools/freehand-base.cpp
@@ -63,8 +63,8 @@ static void spdc_flush_white(FreehandBase *dc, SPCurve *gc);
static void spdc_reset_white(FreehandBase *dc);
static void spdc_free_colors(FreehandBase *dc);
-FreehandBase::FreehandBase(gchar const *const *cursor_shape, gint hot_x, gint hot_y)
- : ToolBase(cursor_shape, hot_x, hot_y)
+FreehandBase::FreehandBase(gchar const *const *cursor_shape)
+ : ToolBase(cursor_shape)
, selection(NULL)
, grab(NULL)
, attach(false)
diff --git a/src/ui/tools/freehand-base.h b/src/ui/tools/freehand-base.h
index 3ee4cd7d0..a3069aa09 100644
--- a/src/ui/tools/freehand-base.h
+++ b/src/ui/tools/freehand-base.h
@@ -44,7 +44,7 @@ namespace Tools {
class FreehandBase : public ToolBase {
public:
- FreehandBase(gchar const *const *cursor_shape, gint hot_x, gint hot_y);
+ FreehandBase(gchar const *const *cursor_shape);
virtual ~FreehandBase();
Inkscape::Selection *selection;
diff --git a/src/ui/tools/gradient-tool.cpp b/src/ui/tools/gradient-tool.cpp
index 750596808..95d940bd6 100644
--- a/src/ui/tools/gradient-tool.cpp
+++ b/src/ui/tools/gradient-tool.cpp
@@ -58,7 +58,7 @@ const std::string GradientTool::prefsPath = "/tools/gradient";
GradientTool::GradientTool()
- : ToolBase(cursor_gradient_xpm, 4, 4)
+ : ToolBase(cursor_gradient_xpm)
, cursor_addnode(false)
, node_added(false)
// TODO: Why are these connections stored as pointers?
diff --git a/src/ui/tools/lpe-tool.cpp b/src/ui/tools/lpe-tool.cpp
index 29e4c9e74..35e6d14a0 100644
--- a/src/ui/tools/lpe-tool.cpp
+++ b/src/ui/tools/lpe-tool.cpp
@@ -68,7 +68,7 @@ const std::string& LpeTool::getPrefsPath() {
const std::string LpeTool::prefsPath = "/tools/lpetool";
LpeTool::LpeTool()
- : PenTool(cursor_crosshairs_xpm, 7, 7)
+ : PenTool(cursor_crosshairs_xpm)
, shape_editor(NULL)
, canvas_bbox(NULL)
, mode(Inkscape::LivePathEffect::BEND_PATH)
diff --git a/src/ui/tools/measure-tool.cpp b/src/ui/tools/measure-tool.cpp
index 98b2c7d03..7f3c99716 100644
--- a/src/ui/tools/measure-tool.cpp
+++ b/src/ui/tools/measure-tool.cpp
@@ -322,7 +322,7 @@ void createAngleDisplayCurve(SPDesktop *desktop, Geom::Point const &center, Geom
boost::optional<Geom::Point> explicit_base_tmp = boost::none;
MeasureTool::MeasureTool()
- : ToolBase(cursor_measure_xpm, 4, 4)
+ : ToolBase(cursor_measure_xpm)
, grabbed(NULL)
{
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
diff --git a/src/ui/tools/mesh-tool.cpp b/src/ui/tools/mesh-tool.cpp
index ac43b6c9d..d79741270 100644
--- a/src/ui/tools/mesh-tool.cpp
+++ b/src/ui/tools/mesh-tool.cpp
@@ -72,7 +72,7 @@ const std::string MeshTool::prefsPath = "/tools/mesh";
// TODO: The gradient tool class looks like a 1:1 copy.
MeshTool::MeshTool()
- : ToolBase(cursor_gradient_xpm, 4, 4)
+ : ToolBase(cursor_gradient_xpm)
, cursor_addnode(false)
, node_added(false)
, show_handles(true)
diff --git a/src/ui/tools/node-tool.cpp b/src/ui/tools/node-tool.cpp
index 0c948c91c..08aacf805 100644
--- a/src/ui/tools/node-tool.cpp
+++ b/src/ui/tools/node-tool.cpp
@@ -118,7 +118,7 @@ const std::string NodeTool::prefsPath = "/tools/nodes";
SPCanvasGroup *create_control_group(SPDesktop *d);
NodeTool::NodeTool()
- : ToolBase(cursor_node_xpm, 1, 1)
+ : ToolBase(cursor_node_xpm)
, _selected_nodes(NULL)
, _multipath(NULL)
, edit_clipping_paths(false)
@@ -773,14 +773,10 @@ void NodeTool::mouseover_changed(Inkscape::UI::ControlPoint *p) {
if (cdp && !this->cursor_drag) {
this->cursor_shape = cursor_node_d_xpm;
- this->hot_x = 1;
- this->hot_y = 1;
this->sp_event_context_update_cursor();
this->cursor_drag = true;
} else if (!cdp && this->cursor_drag) {
this->cursor_shape = cursor_node_xpm;
- this->hot_x = 1;
- this->hot_y = 1;
this->sp_event_context_update_cursor();
this->cursor_drag = false;
}
diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp
index caf6faec2..265ddf2ea 100644
--- a/src/ui/tools/pen-tool.cpp
+++ b/src/ui/tools/pen-tool.cpp
@@ -81,7 +81,7 @@ const std::string& PenTool::getPrefsPath() {
const std::string PenTool::prefsPath = "/tools/freehand/pen";
PenTool::PenTool()
- : FreehandBase(cursor_pen_xpm, 4, 4)
+ : FreehandBase(cursor_pen_xpm)
, p()
, npoints(0)
, mode(MODE_CLICK)
@@ -100,8 +100,8 @@ PenTool::PenTool()
{
}
-PenTool::PenTool(gchar const *const *cursor_shape, gint hot_x, gint hot_y)
- : FreehandBase(cursor_shape, hot_x, hot_y)
+PenTool::PenTool(gchar const *const *cursor_shape)
+ : FreehandBase(cursor_shape)
, p()
, npoints(0)
, mode(MODE_CLICK)
diff --git a/src/ui/tools/pen-tool.h b/src/ui/tools/pen-tool.h
index 5a21e3bac..7e5483358 100644
--- a/src/ui/tools/pen-tool.h
+++ b/src/ui/tools/pen-tool.h
@@ -23,7 +23,7 @@ namespace Tools {
class PenTool : public FreehandBase {
public:
PenTool();
- PenTool(gchar const *const *cursor_shape, gint hot_x, gint hot_y);
+ PenTool(gchar const *const *cursor_shape);
virtual ~PenTool();
enum Mode {
diff --git a/src/ui/tools/pencil-tool.cpp b/src/ui/tools/pencil-tool.cpp
index ec2874823..99b8103c3 100644
--- a/src/ui/tools/pencil-tool.cpp
+++ b/src/ui/tools/pencil-tool.cpp
@@ -57,7 +57,7 @@ const std::string& PencilTool::getPrefsPath() {
const std::string PencilTool::prefsPath = "/tools/freehand/pencil";
PencilTool::PencilTool()
- : FreehandBase(cursor_pencil_xpm, 4, 4)
+ : FreehandBase(cursor_pencil_xpm)
, p()
, npoints(0)
, state(SP_PENCIL_CONTEXT_IDLE)
diff --git a/src/ui/tools/rect-tool.cpp b/src/ui/tools/rect-tool.cpp
index 272531945..8eaae2f7b 100644
--- a/src/ui/tools/rect-tool.cpp
+++ b/src/ui/tools/rect-tool.cpp
@@ -52,7 +52,7 @@ const std::string& RectTool::getPrefsPath() {
const std::string RectTool::prefsPath = "/tools/shapes/rect";
RectTool::RectTool()
- : ToolBase(cursor_rect_xpm, 4, 4)
+ : ToolBase(cursor_rect_xpm)
, rect(NULL)
, rx(0)
, ry(0)
diff --git a/src/ui/tools/select-tool.cpp b/src/ui/tools/select-tool.cpp
index 927b8a3d4..fca2173ca 100644
--- a/src/ui/tools/select-tool.cpp
+++ b/src/ui/tools/select-tool.cpp
@@ -81,7 +81,7 @@ sp_load_handles(int start, int count, char const **xpm) {
SelectTool::SelectTool()
// Don't load a default cursor
- : ToolBase(NULL, 0, 0)
+ : ToolBase(NULL)
, dragging(false)
, moved(false)
, button_press_shift(false)
@@ -94,8 +94,8 @@ SelectTool::SelectTool()
, _describer(NULL)
{
// cursors in select context
- CursorSelectMouseover = sp_cursor_new_from_xpm(cursor_select_m_xpm , 1, 1);
- CursorSelectDragging = sp_cursor_new_from_xpm(cursor_select_d_xpm , 1, 1);
+ CursorSelectMouseover = sp_cursor_from_xpm(cursor_select_m_xpm);
+ CursorSelectDragging = sp_cursor_from_xpm(cursor_select_d_xpm);
// selection handles
sp_load_handles(0, 2, handle_scale_xpm);
diff --git a/src/ui/tools/spiral-tool.cpp b/src/ui/tools/spiral-tool.cpp
index 0ba08853e..08c35b9b0 100644
--- a/src/ui/tools/spiral-tool.cpp
+++ b/src/ui/tools/spiral-tool.cpp
@@ -51,7 +51,7 @@ const std::string& SpiralTool::getPrefsPath() {
const std::string SpiralTool::prefsPath = "/tools/shapes/spiral";
SpiralTool::SpiralTool()
- : ToolBase(cursor_spiral_xpm, 4, 4)
+ : ToolBase(cursor_spiral_xpm)
, spiral(NULL)
, revo(3)
, exp(1)
diff --git a/src/ui/tools/spray-tool.cpp b/src/ui/tools/spray-tool.cpp
index ad006627c..f3e7e6d3c 100644
--- a/src/ui/tools/spray-tool.cpp
+++ b/src/ui/tools/spray-tool.cpp
@@ -137,7 +137,7 @@ static void sp_spray_scale_rel(Geom::Point c, SPDesktop */*desktop*/, SPItem *it
}
SprayTool::SprayTool()
- : ToolBase(cursor_spray_xpm, 4, 4, false)
+ : ToolBase(cursor_spray_xpm, false)
, pressure(TC_DEFAULT_PRESSURE)
, dragging(false)
, usepressurewidth(false)
diff --git a/src/ui/tools/star-tool.cpp b/src/ui/tools/star-tool.cpp
index ddee08189..18992d87a 100644
--- a/src/ui/tools/star-tool.cpp
+++ b/src/ui/tools/star-tool.cpp
@@ -57,7 +57,7 @@ const std::string& StarTool::getPrefsPath() {
const std::string StarTool::prefsPath = "/tools/shapes/star";
StarTool::StarTool()
- : ToolBase(cursor_star_xpm, 4, 4)
+ : ToolBase(cursor_star_xpm)
, star(NULL)
, magnitude(5)
, proportion(0.5)
diff --git a/src/ui/tools/text-tool.cpp b/src/ui/tools/text-tool.cpp
index 649bbb045..9091b455e 100644
--- a/src/ui/tools/text-tool.cpp
+++ b/src/ui/tools/text-tool.cpp
@@ -76,7 +76,7 @@ const std::string TextTool::prefsPath = "/tools/text";
TextTool::TextTool()
- : ToolBase(cursor_text_xpm, 7, 7)
+ : ToolBase(cursor_text_xpm)
, imc(NULL)
, text(NULL)
, pdoc(0, 0)
@@ -359,8 +359,6 @@ bool TextTool::item_handler(SPItem* item, GdkEvent* event) {
sp_canvas_item_show(this->indicator);
this->cursor_shape = cursor_text_insert_xpm;
- this->hot_x = 7;
- this->hot_y = 10;
this->sp_event_context_update_cursor();
sp_text_context_update_text_selection(this);
@@ -548,8 +546,6 @@ bool TextTool::root_handler(GdkEvent* event) {
this->over_text = 0;
// update cursor and statusbar: we are not over a text object now
this->cursor_shape = cursor_text_xpm;
- this->hot_x = 7;
- this->hot_y = 7;
this->sp_event_context_update_cursor();
desktop->event_context->defaultMessageContext()->clear();
}
diff --git a/src/ui/tools/tool-base.cpp b/src/ui/tools/tool-base.cpp
index 9231db7c8..0467b984e 100644
--- a/src/ui/tools/tool-base.cpp
+++ b/src/ui/tools/tool-base.cpp
@@ -86,7 +86,7 @@ SPDesktop const& ToolBase::getDesktop() const {
return *desktop;
}
-ToolBase::ToolBase(gchar const *const *cursor_shape, gint hot_x, gint hot_y, bool uses_snap)
+ToolBase::ToolBase(gchar const *const *cursor_shape, bool uses_snap)
: pref_observer(NULL)
, cursor(NULL)
, xp(0)
@@ -104,8 +104,6 @@ ToolBase::ToolBase(gchar const *const *cursor_shape, gint hot_x, gint hot_y, boo
, desktop(NULL)
, _uses_snap(uses_snap)
, cursor_shape(cursor_shape)
- , hot_x(hot_x)
- , hot_y(hot_y)
{
}
@@ -154,44 +152,24 @@ void ToolBase::sp_event_context_set_cursor(GdkCursorType cursor_type) {
void ToolBase::sp_event_context_update_cursor() {
GtkWidget *w = GTK_WIDGET(this->desktop->getCanvas());
if (gtk_widget_get_window (w)) {
-
GtkStyle *style = gtk_widget_get_style(w);
- /* fixme: */
if (this->cursor_shape) {
- GdkDisplay *display = gdk_display_get_default();
- if (gdk_display_supports_cursor_alpha(display) && gdk_display_supports_cursor_color(display)) {
- bool fillHasColor=false, strokeHasColor=false;
- guint32 fillColor = sp_desktop_get_color_tool(this->desktop, this->getPrefsPath(), true, &fillHasColor);
- guint32 strokeColor = sp_desktop_get_color_tool(this->desktop, this->getPrefsPath(), false, &strokeHasColor);
- double fillOpacity = fillHasColor ? sp_desktop_get_opacity_tool(this->desktop, this->getPrefsPath(), true) : 0;
- double strokeOpacity = strokeHasColor ? sp_desktop_get_opacity_tool(this->desktop, this->getPrefsPath(), false) : 0;
-
- GdkPixbuf *pixbuf = sp_cursor_pixbuf_from_xpm(
- this->cursor_shape,
- style->black, style->white,
- SP_RGBA32_U_COMPOSE(SP_RGBA32_R_U(fillColor),SP_RGBA32_G_U(fillColor),SP_RGBA32_B_U(fillColor),SP_COLOR_F_TO_U(fillOpacity)),
- SP_RGBA32_U_COMPOSE(SP_RGBA32_R_U(strokeColor),SP_RGBA32_G_U(strokeColor),SP_RGBA32_B_U(strokeColor),SP_COLOR_F_TO_U(strokeOpacity))
- );
- if (pixbuf != NULL) {
- if (this->cursor) {
- g_object_unref(this->cursor);
- }
- this->cursor = gdk_cursor_new_from_pixbuf(display, pixbuf, this->hot_x, this->hot_y);
- g_object_unref(pixbuf);
- }
- } else {
- GdkPixbuf *pixbuf = gdk_pixbuf_new_from_xpm_data((const gchar **)this->cursor_shape);
-
- if (pixbuf) {
- if (this->cursor) {
- g_object_unref(this->cursor);
- }
- this->cursor = gdk_cursor_new_from_pixbuf(display,
- pixbuf, this->hot_x, this->hot_y);
- g_object_unref(pixbuf);
- }
+ if(this->cursor) {
+ g_object_unref(this->cursor);
}
+
+ bool fillHasColor=false, strokeHasColor=false;
+ guint32 fillColor = sp_desktop_get_color_tool(this->desktop, this->getPrefsPath(), true, &fillHasColor);
+ guint32 strokeColor = sp_desktop_get_color_tool(this->desktop, this->getPrefsPath(), false, &strokeHasColor);
+ double fillOpacity = fillHasColor ? sp_desktop_get_opacity_tool(this->desktop, this->getPrefsPath(), true) : 0;
+ double strokeOpacity = strokeHasColor ? sp_desktop_get_opacity_tool(this->desktop, this->getPrefsPath(), false) : 0;
+
+ this->cursor = sp_cursor_from_xpm(
+ this->cursor_shape, &style->black, &style->white,
+ SP_RGBA32_C_COMPOSE(fillColor, fillOpacity),
+ SP_RGBA32_C_COMPOSE(strokeColor, strokeOpacity)
+ );
}
gdk_window_set_cursor(gtk_widget_get_window (w), this->cursor);
gdk_flush();
@@ -208,8 +186,7 @@ void ToolBase::sp_event_context_update_cursor() {
void ToolBase::setup() {
this->pref_observer = new ToolPrefObserver(this->getPrefsPath(), this);
Inkscape::Preferences::get()->addObserver(*(this->pref_observer));
-
- this->sp_event_context_update_cursor();
+ this->sp_event_context_update_cursor();
}
/**
diff --git a/src/ui/tools/tool-base.h b/src/ui/tools/tool-base.h
index 3d22fc66f..b0140cecb 100644
--- a/src/ui/tools/tool-base.h
+++ b/src/ui/tools/tool-base.h
@@ -144,7 +144,7 @@ public:
void enableGrDrag (bool enable=true);
bool deleteSelectedDrag(bool just_one);
- ToolBase(gchar const *const *cursor_shape, gint hot_x, gint hot_y, bool uses_snap = true);
+ ToolBase(gchar const *const *cursor_shape, bool uses_snap=true);
virtual ~ToolBase();
@@ -224,9 +224,6 @@ protected:
/// An xpm containing the shape of the tool's cursor.
gchar const *const *cursor_shape;
- /// The cursor's hot spot
- gint hot_x, hot_y;
-
bool sp_event_context_knot_mouseover() const;
private:
diff --git a/src/ui/tools/tweak-tool.cpp b/src/ui/tools/tweak-tool.cpp
index ff5d623c2..dcd9413fb 100644
--- a/src/ui/tools/tweak-tool.cpp
+++ b/src/ui/tools/tweak-tool.cpp
@@ -38,13 +38,13 @@
#include "pixmaps/cursor-tweak-rotate-counterclockwise.xpm"
#include "pixmaps/cursor-tweak-more.xpm"
#include "pixmaps/cursor-tweak-less.xpm"
-#include "pixmaps/cursor-thin.xpm"
-#include "pixmaps/cursor-thicken.xpm"
-#include "pixmaps/cursor-attract.xpm"
-#include "pixmaps/cursor-repel.xpm"
-#include "pixmaps/cursor-push.xpm"
-#include "pixmaps/cursor-roughen.xpm"
-#include "pixmaps/cursor-color.xpm"
+#include "pixmaps/cursor-tweak-thin.xpm"
+#include "pixmaps/cursor-tweak-thicken.xpm"
+#include "pixmaps/cursor-tweak-attract.xpm"
+#include "pixmaps/cursor-tweak-repel.xpm"
+#include "pixmaps/cursor-tweak-push.xpm"
+#include "pixmaps/cursor-tweak-roughen.xpm"
+#include "pixmaps/cursor-tweak-color.xpm"
#include "context-fns.h"
#include "inkscape.h"
#include "splivarot.h"
@@ -92,7 +92,7 @@ const std::string& TweakTool::getPrefsPath() {
const std::string TweakTool::prefsPath = "/tools/tweak";
TweakTool::TweakTool()
- : ToolBase(cursor_push_xpm, 4, 4)
+ : ToolBase(cursor_push_xpm)
, pressure(TC_DEFAULT_PRESSURE)
, dragging(false)
, usepressure(false)
diff --git a/src/ui/tools/zoom-tool.cpp b/src/ui/tools/zoom-tool.cpp
index d40d2e969..8ba0c17b3 100644
--- a/src/ui/tools/zoom-tool.cpp
+++ b/src/ui/tools/zoom-tool.cpp
@@ -36,7 +36,7 @@ const std::string& ZoomTool::getPrefsPath() {
const std::string ZoomTool::prefsPath = "/tools/zoom";
ZoomTool::ZoomTool()
- : ToolBase(cursor_zoom_xpm, 6, 6)
+ : ToolBase(cursor_zoom_xpm)
, grabbed(NULL)
, escaped(false)
{