summaryrefslogtreecommitdiffstats
path: root/src/ui/dialog/swatches.cpp
diff options
context:
space:
mode:
authorsu_v <suv-sf@users.sourceforge.net>2012-12-04 09:51:15 +0000
committer~suv <suv-sf@users.sourceforge.net>2012-12-04 09:51:15 +0000
commit2c6e21d9fd3945a73b3ed5d04a87fb16a90f7a8e (patch)
tree52a0994d8a30aaa8f867073d1cd9ce575f490de8 /src/ui/dialog/swatches.cpp
parentchanges_2012-11_28.patch (diff)
parentwix installer: create msi filename from version sing in src/inkscape.rc, add ... (diff)
downloadinkscape-2c6e21d9fd3945a73b3ed5d04a87fb16a90f7a8e.tar.gz
inkscape-2c6e21d9fd3945a73b3ed5d04a87fb16a90f7a8e.zip
merge from trunk (r11929)
[win32] Please update to latest devlibs for Windows (r41) (bzr r11668.1.44)
Diffstat (limited to '')
-rw-r--r--src/ui/dialog/swatches.cpp34
1 files changed, 18 insertions, 16 deletions
diff --git a/src/ui/dialog/swatches.cpp b/src/ui/dialog/swatches.cpp
index 9d5a2ac28..43b88e5c6 100644
--- a/src/ui/dialog/swatches.cpp
+++ b/src/ui/dialog/swatches.cpp
@@ -54,6 +54,8 @@
#include "dialog-manager.h"
#include "selection.h"
#include "verbs.h"
+#include "gradient-chemistry.h"
+#include "helper/action.h"
namespace Inkscape {
namespace UI {
@@ -142,8 +144,21 @@ static void editGradientImpl( SPDesktop* desktop, SPGradient* gr )
}
if (!shown) {
- GtkWidget *dialog = sp_gradient_vector_editor_new( gr );
- gtk_widget_show( dialog );
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ if (prefs->getBool("/dialogs/gradienteditor/showlegacy", false)) {
+ // Legacy gradient dialog
+ GtkWidget *dialog = sp_gradient_vector_editor_new( gr );
+ gtk_widget_show( dialog );
+ } else {
+ // Invoke the gradient tool
+ Inkscape::Verb *verb = Inkscape::Verb::get( SP_VERB_CONTEXT_GRADIENT );
+ if ( verb ) {
+ SPAction *action = verb->get_action( ( Inkscape::UI::View::View * ) SP_ACTIVE_DESKTOP);
+ if ( action ) {
+ sp_action_perform( action, NULL );
+ }
+ }
+ }
}
}
}
@@ -197,20 +212,7 @@ void SwatchesPanelHook::deleteGradient( GtkMenuItem */*menuitem*/, gpointer /*us
if ( bounceTarget ) {
SwatchesPanel* swp = bouncePanel;
SPDesktop* desktop = swp ? swp->getDesktop() : 0;
- SPDocument *doc = desktop ? desktop->doc() : 0;
- if (doc) {
- std::string targetName(bounceTarget->def.descr);
- const GSList *gradients = doc->getResourceList("gradient");
- for (const GSList *item = gradients; item; item = item->next) {
- SPGradient* grad = SP_GRADIENT(item->data);
- if ( targetName == grad->getId() ) {
- grad->setSwatch(false);
- DocumentUndo::done(doc, SP_VERB_CONTEXT_GRADIENT,
- _("Delete"));
- break;
- }
- }
- }
+ sp_gradient_unset_swatch(desktop, bounceTarget->def.descr);
}
}