summaryrefslogtreecommitdiffstats
path: root/src/tweak-context.cpp
diff options
context:
space:
mode:
authorbulia byak <buliabyak@gmail.com>2008-07-26 19:34:22 +0000
committerbuliabyak <buliabyak@users.sourceforge.net>2008-07-26 19:34:22 +0000
commitec6d9cb00f9d888a237df156eea223dc342b1559 (patch)
tree6d6c699299a2b3b99df1d5295148b73c0d44450f /src/tweak-context.cpp
parentadd optional bool* parameter to find out if the tool has color/opacity set in... (diff)
downloadinkscape-ec6d9cb00f9d888a237df156eea223dc342b1559.tar.gz
inkscape-ec6d9cb00f9d888a237df156eea223dc342b1559.zip
simplify color reading from tool style
(bzr r6427)
Diffstat (limited to 'src/tweak-context.cpp')
-rw-r--r--src/tweak-context.cpp26
1 files changed, 4 insertions, 22 deletions
diff --git a/src/tweak-context.cpp b/src/tweak-context.cpp
index 5e572c39e..717d6bdc6 100644
--- a/src/tweak-context.cpp
+++ b/src/tweak-context.cpp
@@ -801,6 +801,7 @@ bool
sp_tweak_dilate (SPTweakContext *tc, NR::Point event_p, NR::Point p, NR::Point vector)
{
Inkscape::Selection *selection = sp_desktop_selection(SP_EVENT_CONTEXT(tc)->desktop);
+ SPDesktop *desktop = SP_EVENT_CONTEXT(tc)->desktop;
if (selection->isEmpty()) {
return false;
@@ -815,30 +816,11 @@ sp_tweak_dilate (SPTweakContext *tc, NR::Point event_p, NR::Point p, NR::Point v
double color_force = MIN(sqrt(force)/20.0, 1);
SPItem *item_at_point = SP_EVENT_CONTEXT(tc)->desktop->item_at_point(event_p, TRUE);
- Inkscape::XML::Node *tool_repr = inkscape_get_repr(INKSCAPE, "tools.tweak");
- SPCSSAttr *css = sp_repr_css_attr_inherited(tool_repr, "style");
- if (tc->mode == TWEAK_MODE_COLORPAINT && !css)
- return false;
bool do_fill = false, do_stroke = false, do_opacity = false;
- guint32 fill_goal = 0, stroke_goal = 0;
- float opacity_goal = 1;
-
- const gchar *fill_prop = sp_repr_css_property(css, "fill", NULL);
- if (fill_prop && strcmp(fill_prop, "none")) {
- do_fill = true;
- fill_goal = sp_svg_read_color(fill_prop, 0);
- }
- const gchar *stroke_prop = sp_repr_css_property(css, "stroke", NULL);
- if (stroke_prop && strcmp(stroke_prop, "none")) {
- do_stroke = true;
- stroke_goal = sp_svg_read_color(stroke_prop, 0);
- }
- const gchar *opacity_prop = sp_repr_css_property(css, "opacity", NULL);
- if (opacity_prop) {
- do_opacity = true;
- sp_svg_number_read_f(opacity_prop, &opacity_goal);
- }
+ guint32 fill_goal = sp_desktop_get_color_tool(desktop, "tools.tweak", true, &do_fill);
+ guint32 stroke_goal = sp_desktop_get_color_tool(desktop, "tools.tweak", false, &do_stroke);
+ double opacity_goal = sp_desktop_get_master_opacity_tool(desktop, "tools.tweak", &do_opacity);
for (GSList *items = g_slist_copy((GSList *) selection->itemList());
items != NULL;