summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorbulia byak <buliabyak@gmail.com>2007-10-22 18:12:35 +0000
committerbuliabyak <buliabyak@users.sourceforge.net>2007-10-22 18:12:35 +0000
commit91bf24221fc632335621bf24aed51a122aee5562 (patch)
tree51325396b844fa799bdb6280e9f885cd20bad497 /src
parentadd copy-to-clipboard for selected stops (diff)
downloadinkscape-91bf24221fc632335621bf24aed51a122aee5562.tar.gz
inkscape-91bf24221fc632335621bf24aed51a122aee5562.zip
ensure copy/paste of style between gradient stops works
(bzr r3943)
Diffstat (limited to 'src')
-rw-r--r--src/selection-chemistry.cpp33
1 files changed, 22 insertions, 11 deletions
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp
index 2466b542e..8d0aa4e79 100644
--- a/src/selection-chemistry.cpp
+++ b/src/selection-chemistry.cpp
@@ -75,6 +75,7 @@
#include "unit-constants.h"
#include "xml/simple-document.h"
#include "sp-filter-reference.h"
+#include "gradient-drag.h"
using NR::X;
using NR::Y;
@@ -973,6 +974,20 @@ void sp_copy_stuff_used_by_item (GSList **defs_clip, SPItem *item, const GSList
}
}
+void
+sp_set_style_clipboard (SPCSSAttr *css)
+{
+ if (css != NULL) {
+ // clear style clipboard
+ if (style_clipboard) {
+ sp_repr_css_attr_unref (style_clipboard);
+ style_clipboard = NULL;
+ }
+ //sp_repr_css_print (css);
+ style_clipboard = css;
+ }
+}
+
/**
* \pre item != NULL
*/
@@ -1031,6 +1046,10 @@ void sp_selection_copy()
return; // copied color under cursor, nothing else to do
}
+ if (desktop->event_context->get_drag() && desktop->event_context->get_drag()->copy()) {
+ return; // copied selected stop(s), nothing else to do
+ }
+
// check if something is selected
if (selection->isEmpty()) {
desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Nothing was copied."));
@@ -1092,15 +1111,7 @@ void sp_selection_copy()
SPStyle *const query = sp_style_new(SP_ACTIVE_DOCUMENT);
if (sp_desktop_query_style_all (desktop, query)) {
SPCSSAttr *css = sp_css_attr_from_style (query, SP_STYLE_FLAG_ALWAYS);
- if (css != NULL) {
- // clear style clipboard
- if (style_clipboard) {
- sp_repr_css_attr_unref (style_clipboard);
- style_clipboard = NULL;
- }
- //sp_repr_css_print (css);
- style_clipboard = css;
- }
+ sp_set_style_clipboard (css);
}
sp_style_unref(query);
}
@@ -1170,8 +1181,8 @@ void sp_selection_paste_style()
Inkscape::Selection *selection = sp_desktop_selection(desktop);
// check if something is in the clipboard
- if (clipboard == NULL) {
- desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Nothing on the clipboard."));
+ if (style_clipboard == NULL) {
+ desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Nothing on the style clipboard."));
return;
}