diff options
Diffstat (limited to 'src/extension')
| -rw-r--r-- | src/extension/internal/cairo-render-context.cpp | 5 | ||||
| -rw-r--r-- | src/extension/internal/cairo-renderer.cpp | 2 | ||||
| -rw-r--r-- | src/extension/internal/emf-inout.cpp | 49 | ||||
| -rw-r--r-- | src/extension/internal/emf-print.cpp | 6 | ||||
| -rw-r--r-- | src/extension/internal/filter/color.h | 77 | ||||
| -rw-r--r-- | src/extension/internal/filter/filter-all.cpp | 1 | ||||
| -rw-r--r-- | src/extension/internal/pdfinput/pdf-parser.cpp | 20 | ||||
| -rw-r--r-- | src/extension/internal/text_reassemble.c | 20 | ||||
| -rw-r--r-- | src/extension/internal/wmf-inout.cpp | 36 | ||||
| -rw-r--r-- | src/extension/internal/wmf-print.cpp | 3 | ||||
| -rw-r--r-- | src/extension/param/radiobutton.cpp | 41 |
11 files changed, 182 insertions, 78 deletions
diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp index d76c187a2..2d6619e1e 100644 --- a/src/extension/internal/cairo-render-context.cpp +++ b/src/extension/internal/cairo-render-context.cpp @@ -42,6 +42,7 @@ #include "sp-hatch.h" #include "sp-linear-gradient.h" #include "sp-radial-gradient.h" +#include "sp-mesh.h" #include "sp-pattern.h" #include "sp-mask.h" #include "sp-clippath.h" @@ -1259,6 +1260,10 @@ CairoRenderContext::_createPatternForPaintServer(SPPaintServer const *const pain sp_color_get_rgb_floatv(&rg->vector.stops[i].color, rgb); cairo_pattern_add_color_stop_rgba(pattern, rg->vector.stops[i].offset, rgb[0], rgb[1], rgb[2], rg->vector.stops[i].opacity * alpha); } + } else if (SP_IS_MESH (paintserver)) { + SPMesh *mg = SP_MESH(paintserver); + + pattern = mg->pattern_new(_cr, pbox, 1.0); } else if (SP_IS_PATTERN (paintserver)) { pattern = _createPatternPainter(paintserver, pbox); } else if ( dynamic_cast<SPHatch const *>(paintserver) ) { diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp index 1f48d2097..7fbdc4296 100644 --- a/src/extension/internal/cairo-renderer.cpp +++ b/src/extension/internal/cairo-renderer.cpp @@ -517,7 +517,7 @@ static void sp_item_invoke_render(SPItem *item, CairoRenderContext *ctx) SPStyle* style = item->style; if((ctx->getFilterToBitmap() == TRUE) && (style->filter.set != 0)) { - sp_asbitmap_render(item, ctx); + return sp_asbitmap_render(item, ctx); } SPRoot *root = dynamic_cast<SPRoot *>(item); diff --git a/src/extension/internal/emf-inout.cpp b/src/extension/internal/emf-inout.cpp index 4b070cbaa..31e69706f 100644 --- a/src/extension/internal/emf-inout.cpp +++ b/src/extension/internal/emf-inout.cpp @@ -45,8 +45,8 @@ #include "display/drawing-item.h" #include "clear-n_.h" #include "svg/svg.h" -#include "util/units.h" // even though it is included indirectly by wmf-inout.h -#include "inkscape.h" // even though it is included indirectly by wmf-inout.h +#include "util/units.h" // even though it is included indirectly by emf-inout.h +#include "inkscape.h" // even though it is included indirectly by emf-inout.h #include "emf-print.h" #include "emf-inout.h" @@ -188,7 +188,7 @@ double Emf::current_scale(PEMF_CALLBACK_DATA d){ "matrix(a,b,c,d,e,f)" (WITH the double quotes) */ std::string Emf::current_matrix(PEMF_CALLBACK_DATA d, double x, double y, int useoffset){ - std::stringstream cxform; + SVGOStringStream cxform; double scale = current_scale(d); cxform << "\"matrix("; cxform << d->dc[d->level].worldTransform.eM11/scale; cxform << ","; @@ -1058,7 +1058,7 @@ Emf::snap_to_faraway_pair(double *x, double *y) Since exclude clip can go through here, it calls snap_to_faraway_pair for numerical stability. */ std::string Emf::pix_to_xy(PEMF_CALLBACK_DATA d, double x, double y){ - std::stringstream cxform; + SVGOStringStream cxform; double tx = pix_to_x_point(d,x,y); double ty = pix_to_y_point(d,x,y); snap_to_faraway_pair(&tx,&ty); @@ -1515,6 +1515,9 @@ void Emf::common_image_extraction(PEMF_CALLBACK_DATA d, void *pEmr, int dibparams = U_BI_UNKNOWN; // type of image not yet determined tmp_image << "\n\t <image\n"; + if (d->dc[d->level].clip_id){ + tmp_image << "\tclip-path=\"url(#clipEmfPath" << d->dc[d->level].clip_id << ")\"\n"; + } tmp_image << " y=\"" << dy << "\"\n x=\"" << dx <<"\"\n "; MEMPNG mempng; // PNG in memory comes back in this @@ -1727,21 +1730,23 @@ std::cout << "BEFORE DRAW" ) ){ // std::cout << "PATH DRAW at TOP path" << *(d->path) << std::endl; - d->outsvg += " <path "; // this is the ONLY place <path should be used!!! One exception, gradientfill. - if(d->drawtype){ // explicit draw type EMR record - output_style(d, d->drawtype); - } - else if(d->mask & U_DRAW_CLOSED){ // implicit draw type - output_style(d, U_EMR_STROKEANDFILLPATH); - } - else { - output_style(d, U_EMR_STROKEPATH); + if(!(d->path.empty())){ + d->outsvg += " <path "; // this is the ONLY place <path should be used!!! One exception, gradientfill. + if(d->drawtype){ // explicit draw type EMR record + output_style(d, d->drawtype); + } + else if(d->mask & U_DRAW_CLOSED){ // implicit draw type + output_style(d, U_EMR_STROKEANDFILLPATH); + } + else { + output_style(d, U_EMR_STROKEPATH); + } + d->outsvg += "\n\t"; + d->outsvg += "\n\td=\""; // this is the ONLY place d=" should be used!!!! One exception, gradientfill. + d->outsvg += d->path; + d->outsvg += " \" /> \n"; + d->path = ""; } - d->outsvg += "\n\t"; - d->outsvg += "\n\td=\""; // this is the ONLY place d=" should be used!!!! One exception, gradientfill. - d->outsvg += d->path; - d->outsvg += " \" /> \n"; - d->path = ""; // reset the flags d->mask = 0; d->drawtype = 0; @@ -3418,7 +3423,11 @@ std::cout << "BEFORE DRAW" tmp_rectangle << "\n\tz\""; tmp_rectangle << "\n\tstyle=\"stroke:none;fill:url(#"; tmp_rectangle << d->gradients.strings[fill_idx]; - tmp_rectangle << ");\"\n/>\n"; + tmp_rectangle << ");\"\n"; + if (d->dc[d->level].clip_id){ + tmp_rectangle << "\tclip-path=\"url(#clipEmfPath" << d->dc[d->level].clip_id << ")\"\n"; + } + tmp_rectangle << "/>\n"; } d->outsvg += tmp_rectangle.str().c_str(); } @@ -3538,7 +3547,7 @@ Emf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) d.tri = trinfo_release_except_FC(d.tri); - setViewBoxIfMissing(doc); + // in earlier versions no viewbox was generated and a call to setViewBoxIfMissing() was needed here. return doc; } diff --git a/src/extension/internal/emf-print.cpp b/src/extension/internal/emf-print.cpp index f7b6626c4..67a9242bc 100644 --- a/src/extension/internal/emf-print.cpp +++ b/src/extension/internal/emf-print.cpp @@ -251,7 +251,11 @@ unsigned int PrintEmf::begin(Inkscape::Extension::Print *mod, SPDocument *doc) g_error("Fatal programming error in PrintEmf::begin at textcomment_set 1"); } + char *oldlocale = g_strdup(setlocale(LC_NUMERIC, NULL)); + setlocale(LC_NUMERIC, "C"); snprintf(buff, sizeof(buff) - 1, "Drawing=%.1lfx%.1lfpx, %.1lfx%.1lfmm", _width, _height, Inkscape::Util::Quantity::convert(dwInchesX, "in", "mm"), Inkscape::Util::Quantity::convert(dwInchesY, "in", "mm")); + setlocale(LC_NUMERIC, oldlocale); + g_free(oldlocale); rec = textcomment_set(buff); if (!rec || emf_append((PU_ENHMETARECORD)rec, et, U_REC_FREE)) { g_error("Fatal programming error in PrintEmf::begin at textcomment_set 1"); @@ -706,7 +710,7 @@ int PrintEmf::create_pen(SPStyle const *style, const Geom::Affine &transform) n_dash = style->stroke_dasharray.values.size(); dash = new uint32_t[n_dash]; for (i = 0; i < n_dash; i++) { - dash[i] = (uint32_t)(Inkscape::Util::Quantity::convert(1, "mm", "px") * style->stroke_dasharray.values[i]); + dash[i] = style->stroke_dasharray.values[i]; } } } diff --git a/src/extension/internal/filter/color.h b/src/extension/internal/filter/color.h index 19af6e969..c3c26bf8b 100644 --- a/src/extension/internal/filter/color.h +++ b/src/extension/internal/filter/color.h @@ -3,13 +3,14 @@ /* Change the 'COLOR' above to be your file name */ /* - * Copyright (C) 2013 Authors: + * Copyright (C) 2013-2015 Authors: * Ivan Louette (filters) * Nicolas Dufour (UI) <nicoduf@yahoo.fr> * * Color filters * Brilliance * Channel painting + * Color blindness * Color shift * Colorize * Component transfer @@ -231,6 +232,80 @@ ChannelPaint::get_filter_text (Inkscape::Extension::Extension * ext) }; /* Channel Painting filter */ /** + \brief Custom predefined Color Blindness filter. + + Color Blindness filter. + Based on https://openclipart.org/detail/22299/Color%20Blindness%20filters + + Filter's parameters: + * Blindness type (enum, default Achromatomaly) -> colormatrix +*/ +class ColorBlindness : public Inkscape::Extension::Internal::Filter::Filter { +protected: + virtual gchar const * get_filter_text (Inkscape::Extension::Extension * ext); + +public: + ColorBlindness ( ) : Filter() { }; + virtual ~ColorBlindness ( ) { if (_filter != NULL) g_free((void *)_filter); return; } + + static void init (void) { + Inkscape::Extension::build_from_mem( + "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" + "<name>" N_("Color Blindness") "</name>\n" + "<id>org.inkscape.effect.filter.ColorBlindness</id>\n" + "<param name=\"tab\" type=\"notebook\">\n" + "<page name=\"optionstab\" _gui-text=\"Options\">\n" + "<param name=\"type\" gui-text=\"" N_("Blindness type:") "\" type=\"enum\">\n" + "<_item value=\"0.618 0.32 0.062 0 0 0.163 0.775 0.062 0 0 0.163 0.32 0.516 0 0 0 0 0 1 0 \">" N_("Rod monochromacy (atypical achromatopsia)") "</_item>\n" + "<_item value=\"0.299 0.587 0.114 0 0 0.299 0.587 0.114 0 0 0.299 0.587 0.114 0 0 0 0 0 1 0 \">" N_("Cone monochromacy (typical achromatopsia)") "</_item>\n" + "<_item value=\"0.8 0.2 0 0 0 0.2583 0.74167 0 0 0 0 0.14167 0.85833 0 0 0 0 0 1 0 \">" N_("Geen weak (deuteranomaly)") "</_item>\n" + "<_item value=\"0.625 0.375 0 0 0 0.7 0.3 0 0 0 0 0.3 0.7 0 0 0 0 0 1 0 \">" N_("Green blind (deuteranopia)") "</_item>\n" + "<_item value=\"0.8166 0.1833 0 0 0 0.333 0.666 0 0 0 0 0.125 0.875 0 0 0 0 0 1 0 \">" N_("Red weak (protanomaly)") "</_item>\n" + "<_item value=\"0.566 0.43333 0 0 0 0.55833 0.4416 0 0 0 0 0.24167 0.75833 0 0 0 0 0 1 0 \">" N_("Red blind (protanopia)") "</_item>\n" + "<_item value=\"0.966 0.033 0 0 0 0 0.733 0.266 0 0 0 0.1833 0.816 0 0 0 0 0 1 0 \">" N_("Blue weak (tritanomaly)") "</_item>\n" + "<_item value=\"0.95 0.05 0 0 0 0.2583 0.4333 0.5667 0 0 0 0.475 0.525 0 0 0 0 0 1 0 \">" N_("Blue blind (tritanopia)") "</_item>\n" + "</param>\n" + "</page>\n" + "<page name=\"helptab\" _gui-text=\"Help\">\n" + "<param name=\"help\" xml:space=\"preserve\" type=\"description\">\n" +"Filters based on https://openclipart.org/detail/22299/Color%20Blindness%20filters\n" +"\n" +"These filters don't correctly reflect actual color blindness for two main reasons:\n" +" * Everyone is different, and is not affected exactly the same way.\n" +" * The filters are in the RGB color space, and ignore confusion lines.\n" + "</param>\n" + "</page>\n" + "</param>\n" + "<effect>\n" + "<object-type>all</object-type>\n" + "<effects-menu>\n" + "<submenu name=\"" N_("Filters") "\">\n" + "<submenu name=\"" N_("Color") "\"/>\n" + "</submenu>\n" + "</effects-menu>\n" + "<menu-tip>" N_("Simulate color blindness") "</menu-tip>\n" + "</effect>\n" + "</inkscape-extension>\n", new ColorBlindness()); + }; +}; + +gchar const * +ColorBlindness::get_filter_text (Inkscape::Extension::Extension * ext) +{ + if (_filter != NULL) g_free((void *)_filter); + + std::ostringstream type; + type << ext->get_param_enum("type"); + + _filter = g_strdup_printf( + "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" style=\"color-interpolation-filters:sRGB;\" height=\"1\" width=\"1\" y=\"0\" x=\"0\" inkscape:label=\"Color Blindness\">\n" + "<feColorMatrix values=\"%s\" type=\"matrix\" result=\"colormatrix1\" />\n" + "</filter>\n", type.str().c_str()); + + return _filter; +}; /* Color Blindness filter */ + +/** \brief Custom predefined Color shift filter. Rotate and desaturate hue diff --git a/src/extension/internal/filter/filter-all.cpp b/src/extension/internal/filter/filter-all.cpp index 0273d1669..35504d37f 100644 --- a/src/extension/internal/filter/filter-all.cpp +++ b/src/extension/internal/filter/filter-all.cpp @@ -54,6 +54,7 @@ Filter::filters_all (void ) // Color Brilliance::init(); ChannelPaint::init(); + ColorBlindness::init(); ColorShift::init(); Colorize::init(); ComponentTransfer::init(); diff --git a/src/extension/internal/pdfinput/pdf-parser.cpp b/src/extension/internal/pdfinput/pdf-parser.cpp index 812fa373f..cc0b38515 100644 --- a/src/extension/internal/pdfinput/pdf-parser.cpp +++ b/src/extension/internal/pdfinput/pdf-parser.cpp @@ -2586,24 +2586,12 @@ void PdfParser::opShowSpaceText(Object args[], int /*numArgs*/) } } - - -/* - * The `POPPLER_NEW_GFXFONT' stuff is for the change to GfxFont's getNextChar() call. - * Thanks to tsdgeos for the fix. - * Miklos, does this look ok? - */ - void PdfParser::doShowText(GooString *s) { GfxFont *font; int wMode; double riseX, riseY; CharCode code; -#ifdef POPPLER_NEW_GFXFONT Unicode *u = NULL; -#else - Unicode u[8]; -#endif double x, y, dx, dy, tdx, tdy; double originX, originY, tOriginX, tOriginY; double oldCTM[6], newCTM[6]; @@ -2651,11 +2639,7 @@ void PdfParser::doShowText(GooString *s) { len = s->getLength(); while (len > 0) { n = font->getNextChar(p, len, &code, -#ifdef POPPLER_NEW_GFXFONT &u, &uLen, /* TODO: This looks like a memory leak for u. */ -#else - u, (int)(sizeof(u) / sizeof(Unicode)), &uLen, -#endif &dx, &dy, &originX, &originY); dx = dx * state->getFontSize() + state->getCharSpace(); if (n == 1 && *p == ' ') { @@ -2708,11 +2692,7 @@ void PdfParser::doShowText(GooString *s) { len = s->getLength(); while (len > 0) { n = font->getNextChar(p, len, &code, -#ifdef POPPLER_NEW_GFXFONT &u, &uLen, /* TODO: This looks like a memory leak for u. */ -#else - u, (int)(sizeof(u) / sizeof(Unicode)), &uLen, -#endif &dx, &dy, &originX, &originY); if (wMode) { diff --git a/src/extension/internal/text_reassemble.c b/src/extension/internal/text_reassemble.c index 4dfc49420..d3aafef12 100644 --- a/src/extension/internal/text_reassemble.c +++ b/src/extension/internal/text_reassemble.c @@ -67,11 +67,11 @@ Optional compiler switches for development: File: text_reassemble.c -Version: 0.0.15 -Date: 24-JUL-2014 +Version: 0.0.16 +Date: 25-FEB-2015 Author: David Mathog, Biology Division, Caltech email: mathog@caltech.edu -Copyright: 2014 David Mathog and California Institute of Technology (Caltech) +Copyright: 2015 David Mathog and California Institute of Technology (Caltech) */ #ifdef __cplusplus @@ -80,6 +80,7 @@ extern "C" { #include "text_reassemble.h" #include <libuemf/uemf_utf.h> /* For a couple of text functions. Exact copy from libUEMF. */ +#include <locale.h> #include <float.h> /* Code generated by make_ucd_mn_table.c using: @@ -1936,6 +1937,15 @@ void TR_layout_2_svg(TR_INFO *tri){ double newx,newy,tmpx; uint32_t utmp; + /* copy the current numeric locale, make a copy because setlocale may stomp on + the memory it points to. Then change it because SVG needs decimal points, + not commas, in floats. Restore on exit from this routine. + */ + char *prev_locale = setlocale(LC_NUMERIC,NULL); + char *hold_locale = malloc(sizeof(char) * (strlen(prev_locale) + 1)); + strcpy(hold_locale,prev_locale); + (void) setlocale(LC_NUMERIC,"POSIX"); + /* #define DBG_TR_PARA 0 #define DBG_TR_INPUT 1 @@ -2232,6 +2242,10 @@ void TR_layout_2_svg(TR_INFO *tri){ } /* end of j loop */ TRPRINT(tri,"</tspan></text>\n"); } /* end of i loop */ + + /* restore locale and free memory. */ + (void) setlocale(LC_NUMERIC,hold_locale); + free(hold_locale); } /** diff --git a/src/extension/internal/wmf-inout.cpp b/src/extension/internal/wmf-inout.cpp index 72c1c8bd3..503a93418 100644 --- a/src/extension/internal/wmf-inout.cpp +++ b/src/extension/internal/wmf-inout.cpp @@ -176,7 +176,7 @@ double Wmf::current_scale(PWMF_CALLBACK_DATA /*d*/){ /* WMF has no worldTransform, so this always returns an Identity rotation matrix, but the offsets may have values.*/ std::string Wmf::current_matrix(PWMF_CALLBACK_DATA d, double x, double y, int useoffset){ - std::stringstream cxform; + SVGOStringStream cxform; double scale = current_scale(d); cxform << "\"matrix("; cxform << 1.0/scale; cxform << ","; @@ -948,7 +948,7 @@ Wmf::pix_to_abs_size(PWMF_CALLBACK_DATA d, double px) /* returns "x,y" (without the quotes) in inkscape coordinates for a pair of WMF x,y coordinates */ std::string Wmf::pix_to_xy(PWMF_CALLBACK_DATA d, double x, double y){ - std::stringstream cxform; + SVGOStringStream cxform; cxform << pix_to_x_point(d,x,y); cxform << ","; cxform << pix_to_y_point(d,x,y); @@ -1308,6 +1308,9 @@ void Wmf::common_dib_to_image(PWMF_CALLBACK_DATA d, const char *dib, int dibparams = U_BI_UNKNOWN; // type of image not yet determined tmp_image << "\n\t <image\n"; + if (d->dc[d->level].clip_id){ + tmp_image << "\tclip-path=\"url(#clipWmfPath" << d->dc[d->level].clip_id << ")\"\n"; + } tmp_image << " y=\"" << dy << "\"\n x=\"" << dx <<"\"\n "; MEMPNG mempng; // PNG in memory comes back in this @@ -1405,6 +1408,9 @@ void Wmf::common_bm16_to_image(PWMF_CALLBACK_DATA d, U_BITMAP16 Bm16, const char SVGOStringStream tmp_image; tmp_image << "\n\t <image\n"; + if (d->dc[d->level].clip_id){ + tmp_image << "\tclip-path=\"url(#clipWmfPath" << d->dc[d->level].clip_id << ")\"\n"; + } tmp_image << " y=\"" << dy << "\"\n x=\"" << dx <<"\"\n "; MEMPNG mempng; // PNG in memory comes back in this @@ -1752,13 +1758,15 @@ std::cout << "BEFORE DRAW" ) ){ // std::cout << "PATH DRAW at TOP <<+++++++++++++++++++++++++++++++++++++" << std::endl; - d->outsvg += " <path "; // this is the ONLY place <path should be used!!!! - output_style(d); - d->outsvg += "\n\t"; - d->outsvg += "\n\td=\""; // this is the ONLY place d=" should be used!!!! - d->outsvg += d->path; - d->outsvg += " \" /> \n"; - d->path = ""; //reset the path + if(!(d->path.empty())){ + d->outsvg += " <path "; // this is the ONLY place <path should be used!!!! + output_style(d); + d->outsvg += "\n\t"; + d->outsvg += "\n\td=\""; // this is the ONLY place d=" should be used!!!! + d->outsvg += d->path; + d->outsvg += " \" /> \n"; + d->path = ""; //reset the path + } // reset the flags d->mask = 0; d->drawtype = 0; @@ -2600,9 +2608,9 @@ std::cout << "BEFORE DRAW" if(status==-1){ // change of escapement, emit what we have and reset TR_layout_analyze(d->tri); if (d->dc[d->level].clip_id){ - SVGOStringStream tmp_clip; - tmp_clip << "\n<g\n\tclip-path=\"url(#clipWmfPath" << d->dc[d->level].clip_id << ")\"\n>"; - d->outsvg += tmp_clip.str().c_str(); + SVGOStringStream tmp_clip; + tmp_clip << "\n<g\n\tclip-path=\"url(#clipWmfPath" << d->dc[d->level].clip_id << ")\"\n>"; + d->outsvg += tmp_clip.str().c_str(); } TR_layout_2_svg(d->tri); ts << d->tri->out; @@ -2610,7 +2618,7 @@ std::cout << "BEFORE DRAW" d->tri = trinfo_clear(d->tri); (void) trinfo_load_textrec(d->tri, &tsp, tsp.ori,TR_EMFBOT); // ignore return status, it must work if (d->dc[d->level].clip_id){ - d->outsvg += "\n</g>\n"; + d->outsvg += "\n</g>\n"; } } @@ -3113,7 +3121,7 @@ Wmf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) d.tri = trinfo_release_except_FC(d.tri); - setViewBoxIfMissing(doc); + // in earlier versions no viewbox was generated and a call to setViewBoxIfMissing() was needed here. return doc; } diff --git a/src/extension/internal/wmf-print.cpp b/src/extension/internal/wmf-print.cpp index e5ff34009..567f9f366 100644 --- a/src/extension/internal/wmf-print.cpp +++ b/src/extension/internal/wmf-print.cpp @@ -366,11 +366,12 @@ int PrintWmf::create_brush(SPStyle const *style, U_COLORREF *fcolor) if (!fcolor && style) { if (style->fill.isColor()) { fill_mode = DRAW_PAINT; + /* Dead assignment: Value stored to 'opacity' is never read float opacity = SP_SCALE24_TO_FLOAT(style->fill_opacity.value); if (opacity <= 0.0) { opacity = 0.0; // basically the same as no fill } - + */ sp_color_get_rgb_floatv(&style->fill.value.color, rgb); hatchColor = U_RGB(255 * rgb[0], 255 * rgb[1], 255 * rgb[2]); diff --git a/src/extension/param/radiobutton.cpp b/src/extension/param/radiobutton.cpp index f9515197c..740acf1d1 100644 --- a/src/extension/param/radiobutton.cpp +++ b/src/extension/param/radiobutton.cpp @@ -249,28 +249,35 @@ void ParamRadioButtonWdg::changed(void) class ComboWdg : public Gtk::ComboBoxText { +private: + ParamRadioButton* _base; + SPDocument* _doc; + Inkscape::XML::Node* _node; + sigc::signal<void> * _changeSignal; + public: - ComboWdg(ParamRadioButton* base, SPDocument * doc, Inkscape::XML::Node * node) : - Gtk::ComboBoxText(), - base(base), - doc(doc), - node(node) + ComboWdg(ParamRadioButton* base, SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal) : + _base(base), + _doc(doc), + _node(node), + _changeSignal(changeSignal) { + this->signal_changed().connect(sigc::mem_fun(this, &ComboWdg::changed)); } virtual ~ComboWdg() {} + void changed (void); +}; -protected: - ParamRadioButton* base; - SPDocument* doc; - Inkscape::XML::Node* node; - - virtual void on_changed() { - if ( base ) { - Glib::ustring value = base->value_from_label(get_active_text()); - base->set(value.c_str(), doc, node); - } +void ComboWdg::changed(void) +{ + if ( _base ) { + Glib::ustring value = _base->value_from_label(get_active_text()); + _base->set(value.c_str(), _doc, _node); } -}; + if (_changeSignal != NULL) { + _changeSignal->emit(); + } +} /** * Returns the value for the options label parameter @@ -317,7 +324,7 @@ Gtk::Widget * ParamRadioButton::get_widget(SPDocument * doc, Inkscape::XML::Node Gtk::ComboBoxText* cbt = 0; bool comboSet = false; if (_mode == MINIMAL) { - cbt = Gtk::manage(new ComboWdg(this, doc, node)); + cbt = Gtk::manage(new ComboWdg(this, doc, node, changeSignal)); cbt->show(); vbox->pack_start(*cbt, false, false); } |
