summaryrefslogtreecommitdiffstats
path: root/src/widgets/paint-selector.cpp
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2015-05-09 18:34:01 +0000
committerJabiertxof <jtx@jtx.marker.es>2015-05-09 18:34:01 +0000
commit36bc16fc9772ce0271eb5ec62e2c03cb1038282e (patch)
treec13d992c952bd21bc00c393d80bfe31c3b35284e /src/widgets/paint-selector.cpp
parentprevent overflow index on a pathinfo function (diff)
parentFix Doxyfile (diff)
downloadinkscape-36bc16fc9772ce0271eb5ec62e2c03cb1038282e.tar.gz
inkscape-36bc16fc9772ce0271eb5ec62e2c03cb1038282e.zip
update to trunk
(bzr r13645.1.85)
Diffstat (limited to 'src/widgets/paint-selector.cpp')
-rw-r--r--src/widgets/paint-selector.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/widgets/paint-selector.cpp b/src/widgets/paint-selector.cpp
index 948c80db3..221344296 100644
--- a/src/widgets/paint-selector.cpp
+++ b/src/widgets/paint-selector.cpp
@@ -24,10 +24,6 @@
#include <cstring>
#include <string>
-#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H
-#include <glibmm/threads.h>
-#endif
-
#include "widgets/swatch-selector.h"
#include "sp-pattern.h"
#include <glibmm/i18n.h>
@@ -39,6 +35,7 @@
#include "sp-linear-gradient.h"
#include "sp-radial-gradient.h"
#include "sp-mesh.h"
+#include "sp-stop.h"
/* fixme: Move it from dialogs to here */
#include "gradient-selector.h"
#include <inkscape.h>
@@ -662,6 +659,20 @@ sp_paint_selector_color_changed(SPColorSelector *csel, SPPaintSelector *psel)
static void sp_paint_selector_set_mode_color(SPPaintSelector *psel, SPPaintSelector::Mode /*mode*/)
{
GtkWidget *csel;
+
+ SPColor newcolor = psel->color;
+ float newalpha = psel->alpha;
+
+ if ((psel->mode == SPPaintSelector::MODE_SWATCH)
+ || (psel->mode == SPPaintSelector::MODE_GRADIENT_LINEAR)
+ || (psel->mode == SPPaintSelector::MODE_GRADIENT_RADIAL) ) {
+ SPGradientSelector *gsel = getGradientFromData(psel);
+ if (gsel) {
+ SPGradient *gradient = gsel->getVector();
+ newcolor = gradient->getFirstStop()->specified_color;
+ newalpha = gradient->getFirstStop()->opacity;
+ }
+ }
sp_paint_selector_set_style_buttons(psel, psel->solid);
gtk_widget_set_sensitive(psel->style, TRUE);
@@ -697,8 +708,7 @@ static void sp_paint_selector_set_mode_color(SPPaintSelector *psel, SPPaintSelec
psel->selector = vb;
/* Set color */
- SP_COLOR_SELECTOR( csel )->base->setColorAlpha( psel->color, psel->alpha );
-
+ SP_COLOR_SELECTOR( csel )->base->setColorAlpha( newcolor, newalpha );
}
gtk_label_set_markup(GTK_LABEL(psel->label), _("<b>Flat color</b>"));