summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorbulia byak <buliabyak@gmail.com>2009-03-26 23:09:42 +0000
committerbuliabyak <buliabyak@users.sourceforge.net>2009-03-26 23:09:42 +0000
commite8aa48168a38ccbaa93a874a50b2ca74bbf93878 (patch)
tree7e241be119ed73652df65366affba28998dd20f3 /src
parentnew, more civilized image from bug 295361 (diff)
downloadinkscape-e8aa48168a38ccbaa93a874a50b2ca74bbf93878.tar.gz
inkscape-e8aa48168a38ccbaa93a874a50b2ca74bbf93878.zip
fix copy/paste of color from gradient stops
(bzr r7569)
Diffstat (limited to 'src')
-rw-r--r--src/ui/clipboard.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp
index 6ba3ca156..d95af5a8b 100644
--- a/src/ui/clipboard.cpp
+++ b/src/ui/clipboard.cpp
@@ -201,7 +201,28 @@ void ClipboardManagerImpl::copy()
if (desktop->event_context->get_drag()) {
GrDrag *drag = desktop->event_context->get_drag();
if (drag->hasSelection()) {
- _setClipboardColor(drag->getColor());
+ guint32 col = drag->getColor();
+
+ // set the color as clipboard content (text in RRGGBBAA format)
+ _setClipboardColor(col);
+
+ // create a style with this color on fill and opacity in master opacity, so it can be
+ // pasted on other stops or objects
+ if (_text_style) {
+ sp_repr_css_attr_unref(_text_style);
+ _text_style = NULL;
+ }
+ _text_style = sp_repr_css_attr_new();
+ // print and set properties
+ gchar color_str[16];
+ g_snprintf(color_str, 16, "#%06x", col >> 8);
+ sp_repr_css_set_property(_text_style, "fill", color_str);
+ float opacity = SP_RGBA32_A_F(col);
+ if (opacity > 1.0) opacity = 1.0; // safeguard
+ Inkscape::CSSOStringStream opcss;
+ opcss << opacity;
+ sp_repr_css_set_property(_text_style, "opacity", opcss.str().data());
+
_discardInternalClipboard();
return;
}