summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2d4a37b)
raw | patch | inline | side by side (parent: 2d4a37b)
author | verbalshadow <verbalshadow@users.sourceforge.net> | |
Sat, 13 May 2006 21:07:48 +0000 (21:07 +0000) | ||
committer | verbalshadow <verbalshadow@users.sourceforge.net> | |
Sat, 13 May 2006 21:07:48 +0000 (21:07 +0000) |
ChangeLog | patch | blob | history | |
src/desktop-style.cpp | patch | blob | history | |
src/desktop-style.h | patch | blob | history | |
src/dyna-draw-context.cpp | patch | blob | history |
diff --git a/ChangeLog b/ChangeLog
index a0afe6c27b186875a96504beb65ab9940a2b1a3a..0a8cf3e9283b6f91afd7139c53e5f5615944f8bf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
+2006-05-13 verbalshadow <verbalshadow@gmail.com>
+
+ * src/dyna-draw-context.cpp, src/desktop-style.cpp,
+ src/desktop-style.h:
+
+ Calligraphy tool now draws in the last used color or the
+ tool style depending on the Preference setting.
+
2006-05-11 Michael Wybrow <mjwybrow@users.sourceforge.net>
* src/selection-chemistry.cpp, src/sp-conn-end-pair.cpp:
diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp
index 77fcb4823b30d557cb9d1ea583b51cc3f4a62561..f680988f8768bacb0067d970fd276d6ba0b3dc22 100644 (file)
--- a/src/desktop-style.cpp
+++ b/src/desktop-style.cpp
return r;
}
+guint32
+sp_desktop_get_color_tool(SPDesktop *desktop, char const *tool, bool is_fill)
+{
+ SPCSSAttr *css = NULL;
+ guint32 r = 0; // if there's no color, return black
+ if (prefs_get_int_attribute(tool, "usecurrent", 0) != 0) {
+ css = sp_desktop_get_style(desktop, is_fill);
+ }
+ else {
+ Inkscape::XML::Node *tool_repr = inkscape_get_repr(INKSCAPE, tool);
+ css = sp_repr_css_attr_inherited(tool_repr, "style");
+ }
+
+ gchar const *property = sp_repr_css_property(css, is_fill ? "fill" : "stroke", "#000");
+
+ if (desktop->current && property) { // if there is style and the property in it,
+ if (strncmp(property, "url", 3)) { // and if it's not url,
+ // read it
+ r = sp_svg_read_color(property, r);
+ }
+ }
+ return r | 0xff;
+}
/**
* Apply the desktop's current style or the tool style to repr.
*/
sp_repr_css_attr_unref(css);
}
}
- if (css_current) {
- sp_repr_css_attr_unref(css_current);
+ if (css_current) {sp_repr_css_attr_unref(css_current);
}
}
diff --git a/src/desktop-style.h b/src/desktop-style.h
index 3ebf4f2385e49e4991e3d975aac4ecf6563f2a2a..9f080648a2e5d5d9f92335a528184dcc64c83e5a 100644 (file)
--- a/src/desktop-style.h
+++ b/src/desktop-style.h
void sp_desktop_set_style(SPDesktop *desktop, SPCSSAttr *css, bool change = true, bool write_current = true);
SPCSSAttr *sp_desktop_get_style(SPDesktop *desktop, bool with_text);
guint32 sp_desktop_get_color (SPDesktop *desktop, bool is_fill);
+guint32 sp_desktop_get_color_tool(SPDesktop *desktop, char const *tool, bool is_fill);
double sp_desktop_get_font_size_tool (SPDesktop *desktop);
void sp_desktop_apply_style_tool(SPDesktop *desktop, Inkscape::XML::Node *repr, char const *tool, bool with_text);
index 05e4450866eeaafa8317637b882897de97ecfc22..99cea177becf954b307d2e6b2001e69b106ad18d 100644 (file)
#include "xml/repr.h"
#include "context-fns.h"
#include "sp-item.h"
+#include "inkscape.h"
#define DDC_RED_RGBA 0xff0000ff
SPCurve *curve = sp_curve_copy(dc->currentcurve);
sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH (cbp), curve);
sp_curve_unref(curve);
- sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(cbp), 0x000000ff, SP_WIND_RULE_EVENODD);
+ guint32 fillColor = sp_desktop_get_color_tool(SP_ACTIVE_DESKTOP, "tools.calligraphic", true);
+ sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(cbp), fillColor , SP_WIND_RULE_EVENODD);
+
sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(cbp), 0x00000000, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
/* fixme: Cannot we cascade it to root more clearly? */
g_signal_connect(G_OBJECT(cbp), "event", G_CALLBACK(sp_desktop_root_handler), SP_EVENT_CONTEXT(dc)->desktop);