diff options
| author | su_v <suv-sf@users.sourceforge.net> | 2012-10-04 08:06:18 +0000 |
|---|---|---|
| committer | ~suv <suv-sf@users.sourceforge.net> | 2012-10-04 08:06:18 +0000 |
| commit | fec1be463b3950772422da45fe4655de40c864e7 (patch) | |
| tree | 2eeef78cb15a7fba9453cfc9c12067c0331818d5 /src | |
| parent | update based on patch 'changes_2012_09_27b.patch' (diff) | |
| parent | extensions. Extrude. allow selection of multiple objects (Bug 1055155) (diff) | |
| download | inkscape-fec1be463b3950772422da45fe4655de40c864e7.tar.gz inkscape-fec1be463b3950772422da45fe4655de40c864e7.zip | |
merge from trunk (r11734)
(bzr r11668.1.22)
Diffstat (limited to 'src')
| -rw-r--r-- | src/display/nr-style.cpp | 8 | ||||
| -rw-r--r-- | src/document-subset.cpp | 2 | ||||
| -rw-r--r-- | src/extension/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | src/extension/internal/filter/color.h | 63 | ||||
| -rw-r--r-- | src/extension/internal/filter/paint.h | 52 | ||||
| -rw-r--r-- | src/interface.cpp | 150 | ||||
| -rw-r--r-- | src/libcroco/cr-term.c | 4 | ||||
| -rw-r--r-- | src/live_effects/effect.cpp | 6 | ||||
| -rw-r--r-- | src/live_effects/lpe-powerstroke.cpp | 14 | ||||
| -rw-r--r-- | src/main.cpp | 10 | ||||
| -rw-r--r-- | src/pencil-context.cpp | 25 | ||||
| -rw-r--r-- | src/ui/CMakeLists.txt | 7 | ||||
| -rw-r--r-- | src/ui/dialog/object-properties.cpp | 48 | ||||
| -rw-r--r-- | src/ui/dialog/tracedialog.cpp | 167 | ||||
| -rw-r--r-- | src/ui/widget/gimpspinscale.c | 9 | ||||
| -rw-r--r-- | src/ui/widget/panel.cpp | 14 | ||||
| -rw-r--r-- | src/ui/widget/panel.h | 6 | ||||
| -rw-r--r-- | src/ui/widget/selected-style.cpp | 70 | ||||
| -rw-r--r-- | src/ui/widget/selected-style.h | 9 | ||||
| -rw-r--r-- | src/widgets/eek-preview.cpp | 9 | ||||
| -rw-r--r-- | src/widgets/font-selector.cpp | 2 | ||||
| -rw-r--r-- | src/widgets/sp-color-notebook.cpp | 2 | ||||
| -rw-r--r-- | src/widgets/sp-color-wheel-selector.cpp | 5 |
23 files changed, 449 insertions, 237 deletions
diff --git a/src/display/nr-style.cpp b/src/display/nr-style.cpp index 86102f9e8..ba2340074 100644 --- a/src/display/nr-style.cpp +++ b/src/display/nr-style.cpp @@ -60,7 +60,9 @@ NRStyle::~NRStyle() { if (fill_pattern) cairo_pattern_destroy(fill_pattern); if (stroke_pattern) cairo_pattern_destroy(stroke_pattern); - if (dash) delete dash; + if (dash){ + delete [] dash; + } } void NRStyle::set(SPStyle *style) @@ -126,7 +128,9 @@ void NRStyle::set(SPStyle *style) } miter_limit = style->stroke_miterlimit.value; - if (dash) delete [] dash; + if (dash){ + delete [] dash; + } n_dash = style->stroke_dash.n_dash; if (n_dash != 0) { diff --git a/src/document-subset.cpp b/src/document-subset.cpp index 365be64ef..7fad73d9e 100644 --- a/src/document-subset.cpp +++ b/src/document-subset.cpp @@ -99,7 +99,7 @@ struct DocumentSubset::Relations : public GC::Managed<GC::ATOMIC>, Siblings new_children; bool found_one=false; for ( Siblings::iterator iter=children.begin() - ; iter != children.end() ; iter++ ) + ; iter != children.end() ; ++iter ) { if (obj->isAncestorOf(*iter)) { if (!found_one) { diff --git a/src/extension/CMakeLists.txt b/src/extension/CMakeLists.txt index 5761b1e8b..e1f04fa10 100644 --- a/src/extension/CMakeLists.txt +++ b/src/extension/CMakeLists.txt @@ -41,6 +41,7 @@ set(extension_SRC internal/gdkpixbuf-input.cpp internal/gimpgrad.cpp internal/grid.cpp + internal/image-resolution.cpp internal/latex-pstricks.cpp internal/latex-pstricks-out.cpp internal/odf.cpp @@ -50,6 +51,7 @@ set(extension_SRC internal/javafx-out.cpp internal/svg.cpp internal/svgz.cpp + internal/vsd-input.cpp internal/filter/filter-all.cpp internal/filter/filter-file.cpp @@ -129,6 +131,7 @@ set(extension_SRC internal/gdkpixbuf-input.h internal/gimpgrad.h internal/grid.h + internal/image-resolution.h internal/javafx-out.h internal/latex-pstricks-out.h internal/latex-pstricks.h @@ -141,6 +144,7 @@ set(extension_SRC internal/pov-out.h internal/svg.h internal/svgz.h + internal/vsd-input.h script/InkscapeScript.h ) diff --git a/src/extension/internal/filter/color.h b/src/extension/internal/filter/color.h index b6b194c8b..22b77a8cc 100644 --- a/src/extension/internal/filter/color.h +++ b/src/extension/internal/filter/color.h @@ -615,9 +615,8 @@ Duochrome::get_filter_text (Inkscape::Extension::Extension * ext) Filter's parameters: * Channel (enum, all colors, default Red) -> colormatrix (values) - * Background blend (enum, all blend modes, default Multiply) -> blend (mode) + * Background blend (enum, Normal, Multiply, Screen, default Normal) -> blend (mode) * Channel to alpha (boolean, default false) -> colormatrix (values) - * Invert (boolean, default false) -> colormatrix (values) */ class ExtractChannel : public Inkscape::Extension::Internal::Filter::Filter { @@ -637,16 +636,16 @@ public: "<_item value=\"r\">" N_("Red") "</_item>\n" "<_item value=\"g\">" N_("Green") "</_item>\n" "<_item value=\"b\">" N_("Blue") "</_item>\n" + "<_item value=\"c\">" N_("Cyan") "</_item>\n" + "<_item value=\"m\">" N_("Majenta") "</_item>\n" + "<_item value=\"y\">" N_("Yellow") "</_item>\n" "</param>\n" "<param name=\"blend\" gui-text=\"" N_("Background blend mode:") "\" type=\"enum\">\n" "<_item value=\"multiply\">" N_("Multiply") "</_item>\n" "<_item value=\"normal\">" N_("Normal") "</_item>\n" "<_item value=\"screen\">" N_("Screen") "</_item>\n" - "<_item value=\"darken\">" N_("Darken") "</_item>\n" - "<_item value=\"lighten\">" N_("Lighten") "</_item>\n" "</param>\n" "<param name=\"alpha\" gui-text=\"" N_("Channel to alpha") "\" type=\"boolean\">false</param>\n" - "<param name=\"invert\" gui-text=\"" N_("Inverted") "\" type=\"boolean\">false</param>\n" "<effect>\n" "<object-type>all</object-type>\n" "<effects-menu>\n" @@ -667,45 +666,45 @@ ExtractChannel::get_filter_text (Inkscape::Extension::Extension * ext) std::ostringstream blend; std::ostringstream colors; - std::ostringstream alpha; - std::ostringstream invert; blend << ext->get_param_enum("blend"); const gchar *channel = ext->get_param_enum("source"); if (ext->get_param_bool("alpha")) { - colors << "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"; - } else if ((g_ascii_strcasecmp("r", channel) == 0)) { - colors << "0 0 0 0 1 0 0 0 0 0 0 0 0 0 0"; - } else if ((g_ascii_strcasecmp("g", channel) == 0)) { - colors << "0 0 0 0 0 0 0 0 0 1 0 0 0 0 0"; - } else { - colors << "0 0 0 0 0 0 0 0 0 0 0 0 0 0 1"; - } - - if (ext->get_param_bool("invert")) { if ((g_ascii_strcasecmp("r", channel) == 0)) { - alpha << "-1 0 0 1"; + colors << "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0"; } else if ((g_ascii_strcasecmp("g", channel) == 0)) { - alpha << "0 -1 0 1"; + colors << "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0"; + } else if ((g_ascii_strcasecmp("b", channel) == 0)) { + colors << "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0"; + } else if ((g_ascii_strcasecmp("c", channel) == 0)) { + colors << "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 1 0"; + } else if ((g_ascii_strcasecmp("m", channel) == 0)) { + colors << "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 1 0"; } else { - alpha << "0 0 -1 1"; + colors << "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 1 0"; } } else { if ((g_ascii_strcasecmp("r", channel) == 0)) { - alpha << "1 0 0 0"; + colors << "0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0"; } else if ((g_ascii_strcasecmp("g", channel) == 0)) { - alpha << "0 1 0 0"; + colors << "0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0"; + } else if ((g_ascii_strcasecmp("b", channel) == 0)) { + colors << "0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0"; + } else if ((g_ascii_strcasecmp("c", channel) == 0)) { + colors << "0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 -1 0 0 1 0"; + } else if ((g_ascii_strcasecmp("m", channel) == 0)) { + colors << "0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 -1 0 1 0"; } else { - alpha << "0 0 1 0"; + colors << "0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 -1 1 0"; } } _filter = g_strdup_printf( "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" style=\"color-interpolation-filters:sRGB;\" inkscape:label=\"Extract Channel\">\n" - "<feColorMatrix in=\"SourceGraphic\" values=\"%s %s %s 0 \" result=\"colormatrix\" />\n" + "<feColorMatrix in=\"SourceGraphic\" values=\"%s 0 \" result=\"colormatrix\" />\n" "<feBlend in2=\"BackgroundImage\" mode=\"%s\" result=\"blend\" />\n" - "</filter>\n", colors.str().c_str(), alpha.str().c_str(), invert.str().c_str(), blend.str().c_str() ); + "</filter>\n", colors.str().c_str(), blend.str().c_str() ); return _filter; }; /* ExtractChannel filter */ @@ -1157,9 +1156,9 @@ LightnessContrast::get_filter_text (Inkscape::Extension::Extension * ext) }; /* Lightness-Contrast filter */ /** - \brief Custom predefined Nudge filter. + \brief Custom predefined Nudge RGB filter. - Nudge separately RGB channels and blend them to different types of backgrounds + Nudge RGB channels separately and blend them to different types of backgrounds Filter's parameters: Offsets @@ -1193,8 +1192,8 @@ public: static void init (void) { Inkscape::Extension::build_from_mem( "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n" - "<name>" N_("Nudge") "</name>\n" - "<id>org.inkscape.effect.filter.Nudge</id>\n" + "<name>" N_("Nudge RGB") "</name>\n" + "<id>org.inkscape.effect.filter.NudgeRGB</id>\n" "<param name=\"tab\" type=\"notebook\">\n" "<page name=\"offsettab\" _gui-text=\"Offset\">\n" "<_param name=\"redOffset\" type=\"description\" appearance=\"header\">" N_("Red offset") "</_param>\n" @@ -1232,7 +1231,7 @@ public: "<submenu name=\"" N_("Color") "\"/>\n" "</submenu>\n" "</effects-menu>\n" - "<menu-tip>" N_("Nudge separately RGB channels and blend them to different types of backgrounds") "</menu-tip>\n" + "<menu-tip>" N_("Nudge RGB channels separately and blend them to different types of backgrounds") "</menu-tip>\n" "</effect>\n" "</inkscape-extension>\n", new Nudge()); }; @@ -1277,7 +1276,7 @@ Nudge::get_filter_text (Inkscape::Extension::Extension * ext) a << (color & 0xff) / 255.0F; _filter = g_strdup_printf( - "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" style=\"color-interpolation-filters:sRGB;\" inkscape:label=\"Nudge\">\n" + "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" style=\"color-interpolation-filters:sRGB;\" inkscape:label=\"Nudge RGB\">\n" "<feFlood flood-opacity=\"%s\" flood-color=\"rgb(%s,%s,%s)\" result=\"flood\" />\n" "<feColorMatrix in=\"SourceGraphic\" values=\"0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 \" result=\"colormatrix1\" />\n" "<feOffset dy=\"%s\" dx=\"%s\" result=\"offset1\" />\n" @@ -1297,7 +1296,7 @@ Nudge::get_filter_text (Inkscape::Extension::Extension * ext) return _filter; -}; /* Nudge filter */ +}; /* Nudge RGB filter */ /** \brief Custom predefined Quadritone filter. diff --git a/src/extension/internal/filter/paint.h b/src/extension/internal/filter/paint.h index debdd7d79..dcc51c815 100644 --- a/src/extension/internal/filter/paint.h +++ b/src/extension/internal/filter/paint.h @@ -3,7 +3,7 @@ /* Change the 'PAINT' above to be your file name */ /* - * Copyright (C) 2011 Authors: + * Copyright (C) 2012 Authors: * Ivan Louette (filters) * Nicolas Dufour (UI) <nicoduf@yahoo.fr> * @@ -563,13 +563,13 @@ Electrize::get_filter_text (Inkscape::Extension::Extension * ext) Filter's parameters: * Lines type (enum, default smooth) -> - smooth = component1 (type="table"), component2 (type="table"), composite1 (in2="blur2") - hard = component1 (type="discrete"), component2 (type="discrete"), composite1 (in2="component1") - * Simplify (0.01->20., default 1.5) -> blur1 (stdDeviation) - * Line width (0.01->20., default 1.5) -> blur2 (stdDeviation) - * Lightness (0.->10., default 0.5) -> composite1 (k3) + smooth = component2 (type="table"), composite1 (in2="blur2") + hard = component2 (type="discrete"), composite1 (in2="component1") + * Simplify (0.01->20., default 3) -> blur1 (stdDeviation) + * Line width (0.01->20., default 3) -> blur2 (stdDeviation) + * Lightness (0.->10., default 1) -> composite1 (k2) * Blend (enum [normal, multiply, screen], default normal) -> blend (mode) - * Dark mode (boolean, default false) -> composite1 (true: in2="component2") + * Dark mode (boolean, default false) -> composite2 (true: in2="component2") */ class NeonDraw : public Inkscape::Extension::Internal::Filter::Filter { protected: @@ -588,15 +588,14 @@ public: "<_item value=\"table\">" N_("Smoothed") "</_item>\n" "<_item value=\"discrete\">" N_("Contrasted") "</_item>\n" "</param>\n" - "<param name=\"simply\" gui-text=\"" N_("Simplify:") "\" type=\"float\" appearance=\"full\" precision=\"2\" min=\"0.01\" max=\"20.00\">1.5</param>\n" - "<param name=\"width\" gui-text=\"" N_("Line width:") "\" type=\"float\" appearance=\"full\" precision=\"2\" min=\"0.01\" max=\"20.00\">1.5</param>\n" - "<param name=\"lightness\" gui-text=\"" N_("Lightness:") "\" type=\"float\" appearance=\"full\" precision=\"2\" min=\"0.00\" max=\"10.00\">0.5</param>\n" + "<param name=\"simply\" gui-text=\"" N_("Simplify:") "\" type=\"float\" appearance=\"full\" precision=\"2\" min=\"0.01\" max=\"20.00\">3</param>\n" + "<param name=\"width\" gui-text=\"" N_("Line width:") "\" type=\"float\" appearance=\"full\" precision=\"2\" min=\"0.01\" max=\"20.00\">3</param>\n" + "<param name=\"lightness\" gui-text=\"" N_("Lightness:") "\" type=\"float\" appearance=\"full\" precision=\"2\" min=\"0.00\" max=\"10.00\">1</param>\n" "<param name=\"blend\" gui-text=\"" N_("Blend mode:") "\" type=\"enum\">\n" "<_item value=\"normal\">Normal</_item>\n" "<_item value=\"multiply\">Multiply</_item>\n" "<_item value=\"screen\">Screen</_item>\n" "</param>\n" - "<param name=\"dark\" gui-text=\"" N_("Dark mode") "\" type=\"boolean\" >false</param>\n" "<effect>\n" "<object-type>all</object-type>\n" "<effects-menu>\n" @@ -620,7 +619,6 @@ NeonDraw::get_filter_text (Inkscape::Extension::Extension * ext) std::ostringstream width; std::ostringstream lightness; std::ostringstream type; - std::ostringstream dark; type << ext->get_param_enum("type"); blend << ext->get_param_enum("blend"); @@ -628,33 +626,27 @@ NeonDraw::get_filter_text (Inkscape::Extension::Extension * ext) width << ext->get_param_float("width"); lightness << ext->get_param_float("lightness"); - const gchar *typestr = ext->get_param_enum("type"); - if (ext->get_param_bool("dark")) { - dark << "component2"; - } else if ((g_ascii_strcasecmp("table", typestr) == 0)) { - dark << "blur2"; - } else { - dark << "component1"; - } - _filter = g_strdup_printf( "<filter xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" style=\"color-interpolation-filters:sRGB;\" inkscape:label=\"Neon Draw\">\n" "<feBlend mode=\"%s\" result=\"blend\" />\n" "<feGaussianBlur in=\"blend\" stdDeviation=\"%s\" result=\"blur1\" />\n" + "<feColorMatrix values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 50 0\" result=\"color1\" />\n" "<feComponentTransfer result=\"component1\">\n" - "<feFuncR type=\"discrete\" tableValues=\"0 0.3 0.6 1 1\" />\n" - "<feFuncG type=\"discrete\" tableValues=\"0 0.3 0.6 1 1\" />\n" - "<feFuncB type=\"discrete\" tableValues=\"0 0.3 0.6 1 1\" />\n" + "<feFuncR type=\"discrete\" tableValues=\"0 0.3 0.3 0.3 0.3 0.6 0.6 0.6 0.6 1 1\" />\n" + "<feFuncG type=\"discrete\" tableValues=\"0 0.3 0.3 0.3 0.3 0.6 0.6 0.6 0.6 1 1\" />\n" + "<feFuncB type=\"discrete\" tableValues=\"0 0.3 0.3 0.3 0.3 0.6 0.6 0.6 0.6 1 1\" />\n" "</feComponentTransfer>\n" "<feGaussianBlur in=\"component1\" stdDeviation=\"%s\" result=\"blur2\" />\n" - "<feComponentTransfer in=\"blur2\" result=\"component2\">\n" - "<feFuncR type=\"%s\" tableValues=\"0 1 0 1 0 1 0 1\" />\n" - "<feFuncG type=\"%s\" tableValues=\"0 1 0 1 0 1 0 1\" />\n" - "<feFuncB type=\"%s\" tableValues=\"0 1 0 1 0 1 0 1\" />\n" + "<feColorMatrix values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 50 0\" result=\"color2\" />\n" + "<feComponentTransfer in=\"color2\" result=\"component2\">\n" + "<feFuncR type=\"%s\" tableValues=\"0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1\" />\n" + "<feFuncG type=\"%s\" tableValues=\"0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1\" />\n" + "<feFuncB type=\"%s\" tableValues=\"0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1\" />\n" "</feComponentTransfer>\n" - "<feComposite in=\"component2\" in2=\"%s\" k3=\"%s\" operator=\"arithmetic\" k2=\"1\" result=\"composite1\" />\n" + "<feComposite in=\"component2\" in2=\"blur2\" k3=\"%s\" operator=\"arithmetic\" k2=\"1\" result=\"composite1\" />\n" + "<feColorMatrix values=\"-1 0 0 0 1 0 -1 0 0 0 1 0 -1 0 1 -0.21 -0.72 -0.07 2 0\" result=\"color3\" />\n" "<feComposite in=\"composite1\" in2=\"SourceGraphic\" operator=\"in\" result=\"composite2\" />\n" - "</filter>\n", blend.str().c_str(), simply.str().c_str(), width.str().c_str(), type.str().c_str(), type.str().c_str(), type.str().c_str(), dark.str().c_str(), lightness.str().c_str()); + "</filter>\n", blend.str().c_str(), simply.str().c_str(), width.str().c_str(), type.str().c_str(), type.str().c_str(), type.str().c_str(), lightness.str().c_str()); return _filter; }; /* NeonDraw filter */ diff --git a/src/interface.cpp b/src/interface.cpp index fdfdce5ae..f26b7ac74 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -778,69 +778,117 @@ sp_file_new_from_template(GtkWidget */*widget*/, gchar const *uri) sp_file_new(uri); } -void -sp_menu_append_new_templates(GtkWidget *menu, Inkscape::UI::View::View *view) -{ - std::list<gchar *> sources; - sources.push_back( profile_path("templates") ); // first try user's local dir - sources.push_back( g_strdup(INKSCAPE_TEMPLATESDIR) ); // then the system templates dir - // Use this loop to iterate through a list of possible document locations. - while (!sources.empty()) { - gchar *dirname = sources.front(); +static bool +compare_file_basenames(gchar const *a, gchar const *b) { + bool rc; + gchar *ba, *bb; - if ( Inkscape::IO::file_test( dirname, (GFileTest)(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR) ) ) { - GError *err = 0; - GDir *dir = g_dir_open(dirname, 0, &err); + bool sort_by_fullname = true; // Sort by full name (including path) or just filename + if (sort_by_fullname) { + ba = g_strdup(a); + bb = g_strdup(b); + } else { + ba = g_path_get_basename(a); + bb = g_path_get_basename(b); + } - if (dir) { - for (gchar const *file = g_dir_read_name(dir); file != NULL; file = g_dir_read_name(dir)) { - if (!g_str_has_suffix(file, ".svg") && !g_str_has_suffix(file, ".svgz")) { - continue; // skip non-svg files - } + gchar *fa = g_filename_to_utf8(ba, -1, NULL, NULL, NULL); + gchar *fb = g_filename_to_utf8(bb, -1, NULL, NULL, NULL); + g_free(ba); + g_free(bb); - { - gchar *basename = g_path_get_basename(file); - if (g_str_has_suffix(basename, ".svg") && g_str_has_prefix(basename, "default.")) { - g_free(basename); - basename = 0; - continue; // skip default.*.svg (i.e. default.svg and translations) - it's in the menu already - } + rc = g_utf8_collate(fa, fb) < 0; + + g_free(fa); + g_free(fb); + + return rc; +} + +void +sp_menu_get_svg_filenames_from_dir(gchar const *dirname, std::list<gchar const*> *files) +{ + if ( Inkscape::IO::file_test( dirname, (GFileTest)(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR) ) ) { + GError *err = 0; + GDir *dir = g_dir_open(dirname, 0, &err); + + if (dir) { + for (gchar const *file = g_dir_read_name(dir); file != NULL; file = g_dir_read_name(dir)) { + if (!g_str_has_suffix(file, ".svg") && !g_str_has_suffix(file, ".svgz")) { + continue; // skip non-svg files + } + + { + gchar *basename = g_path_get_basename(file); + if (g_str_has_suffix(basename, ".svg") && g_str_has_prefix(basename, "default.")) { g_free(basename); basename = 0; + continue; // skip default.*.svg (i.e. default.svg and translations) - it's in the menu already } - - gchar const *filepath = g_build_filename(dirname, file, NULL); - gchar *dupfile = g_strndup(file, strlen(file) - 4); - gchar *filename = g_filename_to_utf8(dupfile, -1, NULL, NULL, NULL); - g_free(dupfile); - GtkWidget *item = gtk_menu_item_new_with_label(filename); - g_free(filename); - - gtk_widget_show(item); - // how does "filepath" ever get freed? - g_signal_connect(G_OBJECT(item), - "activate", - G_CALLBACK(sp_file_new_from_template), - (gpointer) filepath); - - if (view) { - // set null tip for now; later use a description from the template file - g_object_set_data(G_OBJECT(item), "view", (gpointer) view); - g_signal_connect( G_OBJECT(item), "select", G_CALLBACK(sp_ui_menu_select), (gpointer) NULL ); - g_signal_connect( G_OBJECT(item), "deselect", G_CALLBACK(sp_ui_menu_deselect), NULL); - } - - gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); + g_free(basename); + basename = 0; } - g_dir_close(dir); + + gchar const *filepath = g_build_filename(dirname, file, NULL); + files->push_front(filepath); } + g_dir_close(dir); + } + } + + files->sort(compare_file_basenames); +} + +void +sp_menu_add_filenames_to_menu(GtkWidget *menu, Inkscape::UI::View::View *view, std::list<gchar const*> *files) +{ + if (!files->empty()) { + GtkWidget *sep = gtk_separator_menu_item_new(); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), sep); + } + + for(std::list<gchar const*>::iterator it=files->begin(); it != files->end(); ++it) { + gchar const *filepath = *it; + gchar const *file = g_path_get_basename(filepath); + gchar *dupfile = g_strndup(file, strlen(file) - 4); + gchar *filename = g_filename_to_utf8(dupfile, -1, NULL, NULL, NULL); + g_free(dupfile); + + GtkWidget *item = gtk_menu_item_new_with_label(filename); + g_free(filename); + + gtk_widget_show(item); + // how does "filepath" ever get freed? + g_signal_connect(G_OBJECT(item), + "activate", + G_CALLBACK(sp_file_new_from_template), + (gpointer) filepath); + + if (view) { + // set null tip for now; later use a description from the template file + g_object_set_data(G_OBJECT(item), "view", (gpointer) view); + g_signal_connect( G_OBJECT(item), "select", G_CALLBACK(sp_ui_menu_select), (gpointer) NULL ); + g_signal_connect( G_OBJECT(item), "deselect", G_CALLBACK(sp_ui_menu_deselect), NULL); } - // toss the dirname - g_free(dirname); - sources.pop_front(); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); } + +} +void +sp_menu_append_new_templates(GtkWidget *menu, Inkscape::UI::View::View *view) +{ + // user's local dir + std::list<gchar const*> userfiles; + sp_menu_get_svg_filenames_from_dir(profile_path("templates"), &userfiles); + sp_menu_add_filenames_to_menu(menu, view, &userfiles); + + // system templates dir + std::list<gchar const*> templatefiles; + sp_menu_get_svg_filenames_from_dir(INKSCAPE_TEMPLATESDIR, &templatefiles); + sp_menu_add_filenames_to_menu(menu, view, &templatefiles); + } void diff --git a/src/libcroco/cr-term.c b/src/libcroco/cr-term.c index 63b39271b..d95c4979f 100644 --- a/src/libcroco/cr-term.c +++ b/src/libcroco/cr-term.c @@ -365,9 +365,9 @@ cr_term_to_string (CRTerm * a_this) tmp_str = NULL; } - g_free (content); - content = NULL; } + g_free (content); + content = NULL; g_string_append (str_buf, ")"); } diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 44e57addf..3b57de25c 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -120,9 +120,9 @@ const Util::EnumData<EffectType> LPETypeData[] = { {ROUGH_HATCHES, N_("Hatches (rough)"), "rough_hatches"}, {SKETCH, N_("Sketch"), "sketch"}, {RULER, N_("Ruler"), "ruler"}, -/* 0.49 ?*/ - {POWERSTROKE, N_("[Unstable!] Power stroke"), "powerstroke"}, - {CLONE_ORIGINAL, N_("[Unstable!] Clone original path"), "clone_original"}, +/* 0.49 */ + {POWERSTROKE, N_("Power stroke"), "powerstroke"}, + {CLONE_ORIGINAL, N_("Clone original path"), "clone_original"}, }; const Util::EnumDataConverter<EffectType> LPETypeConverter(LPETypeData, sizeof(LPETypeData)/sizeof(*LPETypeData)); diff --git a/src/live_effects/lpe-powerstroke.cpp b/src/live_effects/lpe-powerstroke.cpp index 048742452..88a20c68a 100644 --- a/src/live_effects/lpe-powerstroke.cpp +++ b/src/live_effects/lpe-powerstroke.cpp @@ -135,13 +135,13 @@ static const Util::EnumDataConverter<unsigned> LineJoinTypeConverter(LineJoinTyp LPEPowerStroke::LPEPowerStroke(LivePathEffectObject *lpeobject) : Effect(lpeobject), offset_points(_("Offset points"), _("Offset points"), "offset_points", &wr, this), - sort_points(_("Sort points"), _("Sort offset points according to their time value along the curve."), "sort_points", &wr, this, true), - interpolator_type(_("Interpolator type"), _("Determines which kind of interpolator will be used to interpolate between stroke width along the path."), "interpolator_type", InterpolatorTypeConverter, &wr, this, Geom::Interpolate::INTERP_CUBICBEZIER_JOHAN), - interpolator_beta(_("Smoothness"), _("Sets the smoothness for the CubicBezierJohan interpolator. 0 = linear interpolation, 1 = smooth"), "interpolator_beta", &wr, this, 0.2), - start_linecap_type(_("Start cap"), _("Determines the shape of the path's start."), "start_linecap_type", LineCapTypeConverter, &wr, this, LINECAP_ROUND), - linejoin_type(_("Join"), _("Specifies the shape of the path's corners."), "linejoin_type", LineJoinTypeConverter, &wr, this, LINEJOIN_ROUND), - miter_limit(_("Miter limit"), _("Maximum length of the miter (in units of stroke width)"), "miter_limit", &wr, this, 4.), - end_linecap_type(_("End cap"), _("Determines the shape of the path's end."), "end_linecap_type", LineCapTypeConverter, &wr, this, LINECAP_ROUND) + sort_points(_("Sort points"), _("Sort offset points according to their time value along the curve"), "sort_points", &wr, this, true), + interpolator_type(_("Interpolator type:"), _("Determines which kind of interpolator will be used to interpolate between stroke width along the path"), "interpolator_type", InterpolatorTypeConverter, &wr, this, Geom::Interpolate::INTERP_CUBICBEZIER_JOHAN), + interpolator_beta(_("Smoothness:"), _("Sets the smoothness for the CubicBezierJohan interpolator; 0 = linear interpolation, 1 = smooth"), "interpolator_beta", &wr, this, 0.2), + start_linecap_type(_("Start cap:"), _("Determines the shape of the path's start"), "start_linecap_type", LineCapTypeConverter, &wr, this, LINECAP_ROUND), + linejoin_type(_("Join:"), _("Specifies the shape of the path's corners"), "linejoin_type", LineJoinTypeConverter, &wr, this, LINEJOIN_ROUND), + miter_limit(_("Miter limit:"), _("Maximum length of the miter (in units of stroke width)"), "miter_limit", &wr, this, 4.), + end_linecap_type(_("End cap:"), _("Determines the shape of the path's end"), "end_linecap_type", LineCapTypeConverter, &wr, this, LINECAP_ROUND) { show_orig_path = true; diff --git a/src/main.cpp b/src/main.cpp index e3862589d..48d2e4de3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1557,25 +1557,21 @@ static void do_export_ps_pdf(SPDocument* doc, gchar const* uri, char const* mime } if (sp_export_area_drawing) { - (*i)->set_param_bool ("areaDrawing", TRUE); - } else { - (*i)->set_param_bool ("areaDrawing", FALSE); + (*i)->set_param_optiongroup ("area", "drawing"); } if (sp_export_area_page) { if (sp_export_eps) { g_warning ("EPS cannot have its bounding box extend beyond its content, so if your drawing is smaller than the page, --export-area-page will clip it to drawing."); } - (*i)->set_param_bool ("areaPage", TRUE); - } else { - (*i)->set_param_bool ("areaPage", FALSE); + (*i)->set_param_optiongroup ("area", "page"); } if (!sp_export_area_drawing && !sp_export_area_page && !sp_export_id) { // neither is set, set page as default for ps/pdf and drawing for eps if (sp_export_eps) { try { - (*i)->set_param_bool("areaDrawing", TRUE); + (*i)->set_param_optiongroup("area", "drawing"); } catch (...) {} } } diff --git a/src/pencil-context.cpp b/src/pencil-context.cpp index d5b61e1f0..19a040b24 100644 --- a/src/pencil-context.cpp +++ b/src/pencil-context.cpp @@ -789,11 +789,13 @@ interpolate(SPPencilContext *pc) /* Set up direction of next curve. */ { - Geom::CubicBezier const * last_seg = dynamic_cast<Geom::CubicBezier const *>(pc->green_curve->last_segment()); - g_assert( last_seg ); // Relevance: validity of (*last_seg)[2] + Geom::Curve const * last_seg = pc->green_curve->last_segment(); + g_assert( last_seg ); // Relevance: validity of (*last_seg) pc->p[0] = last_seg->finalPoint(); pc->npoints = 1; - Geom::Point const req_vec( pc->p[0] - (*last_seg)[2] ); + Geom::Curve *last_seg_reverse = last_seg->reverse(); + Geom::Point const req_vec( -last_seg_reverse->unitTangentAt(0) ); + delete last_seg_reverse; pc->req_tangent = ( ( Geom::is_zero(req_vec) || !in_svg_plane(req_vec) ) ? Geom::Point(0, 0) : Geom::unit_vector(req_vec) ); @@ -881,11 +883,13 @@ sketch_interpolate(SPPencilContext *pc) /* Set up direction of next curve. */ { - Geom::CubicBezier const * last_seg = dynamic_cast<Geom::CubicBezier const *>(pc->green_curve->last_segment()); - g_assert( last_seg ); // Relevance: validity of (*last_seg)[2] + Geom::Curve const * last_seg = pc->green_curve->last_segment(); + g_assert( last_seg ); // Relevance: validity of (*last_seg) pc->p[0] = last_seg->finalPoint(); pc->npoints = 1; - Geom::Point const req_vec( pc->p[0] - (*last_seg)[2] ); + Geom::Curve *last_seg_reverse = last_seg->reverse(); + Geom::Point const req_vec( -last_seg_reverse->unitTangentAt(0) ); + delete last_seg_reverse; pc->req_tangent = ( ( Geom::is_zero(req_vec) || !in_svg_plane(req_vec) ) ? Geom::Point(0, 0) : Geom::unit_vector(req_vec) ); @@ -926,16 +930,19 @@ fit_and_split(SPPencilContext *pc) /* Set up direction of next curve. */ { - Geom::CubicBezier const * last_seg = dynamic_cast<Geom::CubicBezier const *>(pc->red_curve->last_segment()); - g_assert( last_seg ); // Relevance: validity of (*last_seg)[2] + Geom::Curve const * last_seg = pc->red_curve->last_segment(); + g_assert( last_seg ); // Relevance: validity of (*last_seg) pc->p[0] = last_seg->finalPoint(); pc->npoints = 1; - Geom::Point const req_vec( pc->p[0] - (*last_seg)[2] ); + Geom::Curve *last_seg_reverse = last_seg->reverse(); + Geom::Point const req_vec( -last_seg_reverse->unitTangentAt(0) ); + delete last_seg_reverse; pc->req_tangent = ( ( Geom::is_zero(req_vec) || !in_svg_plane(req_vec) ) ? Geom::Point(0, 0) : Geom::unit_vector(req_vec) ); } + pc->green_curve->append_continuous(pc->red_curve, 0.0625); SPCurve *curve = pc->red_curve->copy(); diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt index b3bcb3fdd..ec7782302 100644 --- a/src/ui/CMakeLists.txt +++ b/src/ui/CMakeLists.txt @@ -42,6 +42,7 @@ set(ui_SRC dialog/filter-effects-dialog.cpp dialog/find.cpp dialog/floating-behavior.cpp + dialog/font-substitution.cpp dialog/glyphs.cpp dialog/guides.cpp dialog/icon-preview.cpp @@ -82,6 +83,7 @@ set(ui_SRC widget/entry.cpp widget/filter-effect-chooser.cpp widget/frame.cpp + widget/gimpspinscale.c widget/imageicon.cpp widget/imagetoggler.cpp widget/labelled.cpp @@ -101,6 +103,7 @@ set(ui_SRC widget/scalar-unit.cpp widget/scalar.cpp widget/selected-style.cpp + widget/spin-scale.cpp widget/spin-slider.cpp widget/spinbutton.cpp widget/style-subject.cpp @@ -117,6 +120,7 @@ set(ui_SRC # Headers clipboard.h control-manager.h + control-types.h icon-names.h previewable.h previewfillable.h @@ -148,6 +152,7 @@ set(ui_SRC dialog/filter-effects-dialog.h dialog/find.h dialog/floating-behavior.h + dialog/font-substitution.h dialog/glyphs.h dialog/guides.h dialog/icon-preview.h @@ -204,6 +209,7 @@ set(ui_SRC widget/entry.h widget/filter-effect-chooser.h widget/frame.h + widget/gimpspinscale.h widget/imageicon.h widget/imagetoggler.h widget/labelled.h @@ -224,6 +230,7 @@ set(ui_SRC widget/scalar-unit.h widget/scalar.h widget/selected-style.h + widget/spin-scale.h widget/spin-slider.h widget/spinbutton.h widget/style-subject.h diff --git a/src/ui/dialog/object-properties.cpp b/src/ui/dialog/object-properties.cpp index 0aeb3816f..12ee2f762 100644 --- a/src/ui/dialog/object-properties.cpp +++ b/src/ui/dialog/object-properties.cpp @@ -54,7 +54,7 @@ ObjectProperties::ObjectProperties (void) : LabelID(_("_ID:"), 1), LabelLabel(_("_Label:"), 1), LabelTitle(_("_Title:"),1), - LabelDescription(_("_Description"),1), + LabelDescription(_("_Description:"),1), FrameDescription("", FALSE), HBoxCheck(FALSE, 0), CheckTable(1, 2, TRUE), @@ -69,16 +69,15 @@ ObjectProperties::ObjectProperties (void) : subselChangedConn() { //initialize labels for the table at the bottom of the dialog - int_labels.push_back("onclick"); - int_labels.push_back("onmouseover"); - int_labels.push_back("onmouseout"); - int_labels.push_back("onmousedown"); - int_labels.push_back("onmouseup"); - int_labels.push_back("onmousemove"); - int_labels.push_back("onfocusin"); - int_labels.push_back("onfocusout"); - int_labels.push_back("onfocusout"); - int_labels.push_back("onload"); + int_labels.push_back("onclick:"); + int_labels.push_back("onmouseover:"); + int_labels.push_back("onmouseout:"); + int_labels.push_back("onmousedown:"); + int_labels.push_back("onmouseup:"); + int_labels.push_back("onmousemove:"); + int_labels.push_back("onfocusin:"); + int_labels.push_back("onfocusout:"); + int_labels.push_back("onload:"); desktopChangeConn = deskTrack.connectDesktopChanged( sigc::mem_fun(*this, &ObjectProperties::setTargetDesktop) ); deskTrack.connect(GTK_WIDGET(gobj())); @@ -101,10 +100,11 @@ void ObjectProperties::MakeWidget(void) TopTable.set_border_width(4); TopTable.set_row_spacings(4); - TopTable.set_col_spacings(4); - contents->pack_start (TopTable, true, true, 0); + TopTable.set_col_spacings(0); + contents->pack_start (TopTable, false, false, 0); /* Create the label for the object id */ + LabelID.set_label (LabelID.get_label() + " "); LabelID.set_alignment (1, 0.5); TopTable.attach (LabelID, 0, 1, 0, 1, Gtk::SHRINK | Gtk::FILL, @@ -124,6 +124,7 @@ void ObjectProperties::MakeWidget(void) EntryID.grab_focus(); /* Create the label for the object label */ + LabelLabel.set_label (LabelLabel.get_label() + " "); LabelLabel.set_alignment (1, 0.5); TopTable.attach (LabelLabel, 0, 1, 1, 2, Gtk::SHRINK | Gtk::FILL, @@ -141,6 +142,7 @@ void ObjectProperties::MakeWidget(void) EntryLabel.signal_activate().connect(sigc::mem_fun(this, &ObjectProperties::label_changed)); /* Create the label for the object title */ + LabelTitle.set_label (LabelTitle.get_label() + " "); LabelTitle.set_alignment (1, 0.5); TopTable.attach (LabelTitle, 0, 1, 2, 3, Gtk::SHRINK | Gtk::FILL, @@ -149,18 +151,17 @@ void ObjectProperties::MakeWidget(void) /* Create the entry box for the object title */ EntryTitle.set_sensitive (FALSE); EntryTitle.set_max_length (256); - TopTable.attach (EntryTitle, 1, 3, 2, 3, + TopTable.attach (EntryTitle, 1, 2, 2, 3, Gtk::EXPAND | Gtk::FILL, Gtk::AttachOptions(), 0, 0 ); LabelTitle.set_mnemonic_widget (EntryTitle); + // pressing enter in the label field is the same as clicking Set: + EntryTitle.signal_activate().connect(sigc::mem_fun(this, &ObjectProperties::label_changed)); /* Create the frame for the object description */ FrameDescription.set_label_widget (LabelDescription); - FrameDescription.set_padding (4,0,0,0); - - TopTable.attach (FrameDescription, 0, 3, 3, 4, - Gtk::EXPAND | Gtk::FILL, - Gtk::EXPAND | Gtk::FILL, 0, 0 ); + FrameDescription.set_padding (0,0,0,0); + contents->pack_start (FrameDescription, true, true, 0); /* Create the text view box for the object description */ FrameTextDescription.set_border_width(4); @@ -175,8 +176,8 @@ void ObjectProperties::MakeWidget(void) /* Check boxes */ contents->pack_start (HBoxCheck, FALSE, FALSE, 0); - CheckTable.set_border_width(0); - HBoxCheck.pack_start (CheckTable, TRUE, TRUE, 10); + CheckTable.set_border_width(4); + HBoxCheck.pack_start (CheckTable, TRUE, TRUE, 0); /* Hide */ CBHide.set_tooltip_text (_("Check to make the object invisible")); @@ -195,7 +196,9 @@ void ObjectProperties::MakeWidget(void) /* Button for setting the object's id, label, title and description. */ - HBoxCheck.pack_start (BSet, TRUE, TRUE, 10); + CheckTable.attach (BSet, 2, 3, 0, 1, + Gtk::EXPAND | Gtk::FILL, + Gtk::AttachOptions(), 0, 0 ); BSet.signal_clicked().connect(sigc::mem_fun(this, &ObjectProperties::label_changed)); /* Create the frame for interactivity options */ @@ -332,7 +335,6 @@ void ObjectProperties::label_changed(void) /* Retrieve the label widget for the object's label */ Glib::ustring label = EntryLabel.get_text(); - g_assert(!label.empty()); /* Give feedback on success of setting the drawing object's label * using the widget's label text diff --git a/src/ui/dialog/tracedialog.cpp b/src/ui/dialog/tracedialog.cpp index a6495c205..1ad827a56 100644 --- a/src/ui/dialog/tracedialog.cpp +++ b/src/ui/dialog/tracedialog.cpp @@ -26,6 +26,8 @@ #include <glibmm/i18n.h> #include "desktop.h" +#include "desktop-tracker.h" +#include "selection.h" #include "trace/potrace/inkscape-potrace.h" #include "inkscape.h" @@ -83,6 +85,13 @@ class TraceDialogImpl : public TraceDialog void abort(); void previewCallback(); + void previewLiveCallback(); + void onSettingsChange(); + void onSelectionModified( guint flags ); + void onSetDefaults(); + + void setDesktop(SPDesktop *desktop); + void setTargetDesktop(SPDesktop *desktop); //############ General items @@ -90,6 +99,7 @@ class TraceDialogImpl : public TraceDialog Gtk::Button *mainOkButton; Gtk::Button *mainCancelButton; + Gtk::Button *mainResetButton; //######## Left pannel @@ -194,11 +204,40 @@ class TraceDialogImpl : public TraceDialog UI::Widget::Frame previewFrame; Gtk::VBox previewVBox; Gtk::Button previewButton; + Gtk::CheckButton previewLiveButton; + gboolean previewLive; Gtk::Image previewImage; + SPDesktop *desktop; + DesktopTracker deskTrack; + sigc::connection desktopChangeConn; + sigc::connection selectChangedConn; + sigc::connection selectModifiedConn; + }; +void TraceDialogImpl::setDesktop(SPDesktop *desktop) +{ + Panel::setDesktop(desktop); + deskTrack.setBase(desktop); +} +void TraceDialogImpl::setTargetDesktop(SPDesktop *desktop) +{ + if (this->desktop != desktop) { + if (this->desktop) { + selectChangedConn.disconnect(); + selectModifiedConn.disconnect(); + } + this->desktop = desktop; + if (desktop && desktop->selection) { + selectChangedConn = desktop->selection->connectChanged(sigc::hide(sigc::mem_fun(*this, &TraceDialogImpl::onSettingsChange))); + selectModifiedConn = desktop->selection->connectModified(sigc::hide<0>(sigc::mem_fun(*this, &TraceDialogImpl::onSelectionModified))); + + } + onSettingsChange(); + } +} //######################################################################### //## E V E N T S @@ -294,8 +333,9 @@ void TraceDialogImpl::potraceProcess(bool do_i_trace) { int width = preview->get_width(); int height = preview->get_height(); - double scaleFX = 200.0 / (double)width; - double scaleFY = 200.0 / (double)height; + const Gtk::Allocation& vboxAlloc = previewImage.get_allocation(); + double scaleFX = vboxAlloc.get_width() / (double)width; + double scaleFY = vboxAlloc.get_height() / (double)height; double scaleFactor = scaleFX > scaleFY ? scaleFY : scaleFX; int newWidth = (int) (((double)width) * scaleFactor); int newHeight = (int) (((double)height) * scaleFactor); @@ -351,6 +391,58 @@ void TraceDialogImpl::abort() //######################################################################### /** + * Callback for when any setting changes + */ +void TraceDialogImpl::onSettingsChange() +{ + if (previewLive) { + previewCallback(); + } +} + +void TraceDialogImpl::onSelectionModified( guint flags ) +{ + if (flags & ( SP_OBJECT_MODIFIED_FLAG | + SP_OBJECT_PARENT_MODIFIED_FLAG | + SP_OBJECT_STYLE_MODIFIED_FLAG) ) { + onSettingsChange(); + } +} + +/** + * Callback for when users resets defaults + */ +void TraceDialogImpl::onSetDefaults() +{ + + // temporarily disable live update + gboolean wasLive = previewLive; + previewLive = false; + + modeBrightnessRadioButton.set_active(true); + modeBrightnessSpinner.set_value(0.45); + modeCannyHiSpinner.set_value(0.65); + modeMultiScanNrColorSpinner.set_value(8.0); + modeMultiScanNrColorSpinner.set_value(8.0); + optionsSpecklesSizeSpinner.set_value(2); + optionsCornersThresholdSpinner.set_value(1.0); + optionsOptimToleranceSpinner.set_value(0.2); + + modeInvertButton.set_active(false); + modeMultiScanSmoothButton.set_active(true); + modeMultiScanStackButton.set_active(true); + modeMultiScanBackgroundButton.set_active(false); + optionsSpecklesButton.set_active(true); + optionsCornersButton.set_active(true); + optionsOptimButton.set_active(true); + sioxButton.set_active(false); + + previewLive = wasLive; + onSettingsChange(); + +} + +/** * Callback from the Preview button. Can be called from elsewhere. */ void TraceDialogImpl::previewCallback() @@ -359,24 +451,31 @@ void TraceDialogImpl::previewCallback() } /** + * Callback from the Preview Live button. + */ +void TraceDialogImpl::previewLiveCallback() +{ + previewLive = previewLiveButton.get_active(); + previewButton.set_sensitive(!previewLive); + onSettingsChange(); +} + +/** * Default response from the dialog. Let's intercept it */ void TraceDialogImpl::responseCallback(int response_id) { - if (response_id == GTK_RESPONSE_OK) - { - // for now, we assume potrace, as it's the only one we have - potraceProcess(true); - } - else if (response_id == GTK_RESPONSE_CANCEL) - { + if (response_id == GTK_RESPONSE_OK) { + // for now, we assume potrace, as it's the only one we have + potraceProcess(true); + } else if (response_id == GTK_RESPONSE_CANCEL) { abort(); - } - else - { + } else if (response_id == GTK_RESPONSE_HELP) { + onSetDefaults(); + } else { hide(); return; - } + } } @@ -417,6 +516,7 @@ TraceDialogImpl::TraceDialogImpl() : modeBrightnessSpinner.set_value(0.45); modeBrightnessBox.pack_end(modeBrightnessSpinner, false, false, MARGIN); modeBrightnessSpinner.set_tooltip_text(_("Brightness cutoff for black/white")); + modeBrightnessSpinner.get_adjustment()->signal_value_changed().connect( sigc::mem_fun(*this, &TraceDialogImpl::onSettingsChange) ); modeBrightnessSpinnerLabel.set_label(_("_Threshold:")); modeBrightnessSpinnerLabel.set_use_underline(true); @@ -435,6 +535,8 @@ TraceDialogImpl::TraceDialogImpl() : modeCannyRadioButton.set_use_underline(true); modeCannyBox.pack_start(modeCannyRadioButton, false, false, MARGIN); modeCannyRadioButton.set_tooltip_text(_("Trace with optimal edge detection by J. Canny's algorithm")); + modeCannyRadioButton.signal_clicked().connect( sigc::mem_fun(*this, &TraceDialogImpl::onSettingsChange) ); + /* modeCannyBox.pack_start(modeCannySeparator); modeCannyLoSpinnerLabel.set_label(_("Low")); @@ -451,6 +553,7 @@ TraceDialogImpl::TraceDialogImpl() : modeCannyHiSpinner.set_value(0.65); modeCannyBox.pack_end(modeCannyHiSpinner, false, false, MARGIN); modeCannyHiSpinner.set_tooltip_text(_("Brightness cutoff for adjacent pixels (determines edge thickness)")); + modeCannyHiSpinner.get_adjustment()->signal_value_changed().connect( sigc::mem_fun(*this, &TraceDialogImpl::onSettingsChange) ); modeCannyHiSpinnerLabel.set_label(_("T_hreshold:")); modeCannyHiSpinnerLabel.set_use_underline(true); @@ -469,6 +572,7 @@ TraceDialogImpl::TraceDialogImpl() : modeQuantRadioButton.set_use_underline(true); modeQuantBox.pack_start(modeQuantRadioButton, false, false, MARGIN); modeQuantRadioButton.set_tooltip_text(_("Trace along the boundaries of reduced colors")); + modeQuantRadioButton.signal_clicked().connect( sigc::mem_fun(*this, &TraceDialogImpl::onSettingsChange) ); modeQuantNrColorSpinner.set_digits(0); modeQuantNrColorSpinner.set_increments(1.0, 0); @@ -476,6 +580,7 @@ TraceDialogImpl::TraceDialogImpl() : modeQuantNrColorSpinner.set_value(8.0); modeQuantBox.pack_end(modeQuantNrColorSpinner, false, false, MARGIN); modeQuantNrColorSpinner.set_tooltip_text(_("The number of reduced colors")); + modeQuantNrColorSpinner.get_adjustment()->signal_value_changed().connect( sigc::mem_fun(*this, &TraceDialogImpl::onSettingsChange) ); modeQuantNrColorLabel.set_label(_("_Colors:")); modeQuantNrColorLabel.set_mnemonic_widget(modeQuantNrColorSpinner); @@ -491,6 +596,7 @@ TraceDialogImpl::TraceDialogImpl() : modeInvertBox.pack_start(modeInvertButton, false, false, MARGIN); modeBrightnessVBox.pack_start(modeInvertBox, false, false, MARGIN); modeInvertButton.set_tooltip_text(_("Invert black and white regions")); + modeInvertButton.signal_clicked().connect( sigc::mem_fun(*this, &TraceDialogImpl::onSettingsChange) ); modeBrightnessFrame.add(modeBrightnessVBox); modePageBox.pack_start(modeBrightnessFrame, false, false, 0); @@ -504,6 +610,7 @@ TraceDialogImpl::TraceDialogImpl() : modeMultiScanBrightnessRadioButton.set_use_underline(true); modeMultiScanHBox1.pack_start(modeMultiScanBrightnessRadioButton, false, false, MARGIN); modeMultiScanBrightnessRadioButton.set_tooltip_text(_("Trace the given number of brightness levels")); + modeMultiScanBrightnessRadioButton.signal_clicked().connect( sigc::mem_fun(*this, &TraceDialogImpl::onSettingsChange) ); modeMultiScanNrColorSpinner.set_digits(0); modeMultiScanNrColorSpinner.set_increments(1.0, 0); @@ -515,6 +622,7 @@ TraceDialogImpl::TraceDialogImpl() : modeMultiScanNrColorLabel.set_mnemonic_widget(modeMultiScanNrColorSpinner); modeMultiScanHBox1.pack_end(modeMultiScanNrColorLabel, false, false, MARGIN); modeMultiScanNrColorSpinner.set_tooltip_text(_("The desired number of scans")); + modeMultiScanNrColorSpinner.get_adjustment()->signal_value_changed().connect( sigc::mem_fun(*this, &TraceDialogImpl::onSettingsChange) ); modeMultiScanVBox.pack_start(modeMultiScanHBox1, false, false, MARGIN); @@ -523,6 +631,7 @@ TraceDialogImpl::TraceDialogImpl() : modeMultiScanColorRadioButton.set_use_underline(true); modeMultiScanHBox2.pack_start(modeMultiScanColorRadioButton, false, false, MARGIN); modeMultiScanColorRadioButton.set_tooltip_text(_("Trace the given number of reduced colors")); + modeMultiScanColorRadioButton.signal_clicked().connect( sigc::mem_fun(*this, &TraceDialogImpl::onSettingsChange) ); modeMultiScanVBox.pack_start(modeMultiScanHBox2, false, false, MARGIN); @@ -531,6 +640,7 @@ TraceDialogImpl::TraceDialogImpl() : modeMultiScanMonoRadioButton.set_use_underline(true); modeMultiScanHBox3.pack_start(modeMultiScanMonoRadioButton, false, false, MARGIN); modeMultiScanMonoRadioButton.set_tooltip_text(_("Same as Colors, but the result is converted to grayscale")); + modeMultiScanMonoRadioButton.signal_clicked().connect( sigc::mem_fun(*this, &TraceDialogImpl::onSettingsChange) ); modeMultiScanVBox.pack_start(modeMultiScanHBox3, false, false, MARGIN); @@ -540,6 +650,7 @@ TraceDialogImpl::TraceDialogImpl() : modeMultiScanSmoothButton.set_active(true); modeMultiScanHBox4.pack_start(modeMultiScanSmoothButton, false, false, MARGIN); modeMultiScanSmoothButton.set_tooltip_text(_("Apply Gaussian blur to the bitmap before tracing")); + modeMultiScanSmoothButton.signal_clicked().connect( sigc::mem_fun(*this, &TraceDialogImpl::onSettingsChange) ); // TRANSLATORS: "Stack" is a verb here modeMultiScanStackButton.set_label(_("Stac_k scans")); @@ -547,6 +658,7 @@ TraceDialogImpl::TraceDialogImpl() : modeMultiScanStackButton.set_active(true); modeMultiScanHBox4.pack_start(modeMultiScanStackButton, false, false, MARGIN); modeMultiScanStackButton.set_tooltip_text(_("Stack scans on top of one another (no gaps) instead of tiling (usually with gaps)")); + modeMultiScanStackButton.signal_clicked().connect( sigc::mem_fun(*this, &TraceDialogImpl::onSettingsChange) ); modeMultiScanBackgroundButton.set_label(_("Remo_ve background")); @@ -555,6 +667,7 @@ TraceDialogImpl::TraceDialogImpl() : modeMultiScanHBox4.pack_start(modeMultiScanBackgroundButton, false, false, MARGIN); // TRANSLATORS: "Layer" refers to one of the stacked paths in the multiscan modeMultiScanBackgroundButton.set_tooltip_text(_("Remove bottom (background) layer when done")); + modeMultiScanBackgroundButton.signal_clicked().connect( sigc::mem_fun(*this, &TraceDialogImpl::onSettingsChange) ); modeMultiScanVBox.pack_start(modeMultiScanHBox4, false, false, MARGIN); @@ -577,12 +690,14 @@ TraceDialogImpl::TraceDialogImpl() : optionsSpecklesButton.set_use_underline(true); optionsSpecklesButton.set_tooltip_text(_("Ignore small spots (speckles) in the bitmap")); optionsSpecklesButton.set_active(true); + optionsSpecklesButton.signal_clicked().connect( sigc::mem_fun(*this, &TraceDialogImpl::onSettingsChange) ); optionsSpecklesBox.pack_start(optionsSpecklesButton, false, false, MARGIN); optionsSpecklesSizeSpinner.set_digits(0); optionsSpecklesSizeSpinner.set_increments(1, 0); optionsSpecklesSizeSpinner.set_range(0, 1000); optionsSpecklesSizeSpinner.set_value(2); optionsSpecklesSizeSpinner.set_tooltip_text(_("Speckles of up to this many pixels will be suppressed")); + optionsSpecklesSizeSpinner.get_adjustment()->signal_value_changed().connect( sigc::mem_fun(*this, &TraceDialogImpl::onSettingsChange) ); optionsSpecklesBox.pack_end(optionsSpecklesSizeSpinner, false, false, MARGIN); optionsSpecklesSizeLabel.set_label(_("S_ize:")); optionsSpecklesSizeLabel.set_use_underline(true); @@ -593,6 +708,7 @@ TraceDialogImpl::TraceDialogImpl() : optionsCornersButton.set_use_underline(true); optionsCornersButton.set_tooltip_text(_("Smooth out sharp corners of the trace")); optionsCornersButton.set_active(true); + optionsCornersButton.signal_clicked().connect( sigc::mem_fun(*this, &TraceDialogImpl::onSettingsChange) ); optionsCornersBox.pack_start(optionsCornersButton, false, false, MARGIN); optionsCornersThresholdSpinner.set_digits(2); optionsCornersThresholdSpinner.set_increments(0.01, 0); @@ -600,6 +716,7 @@ TraceDialogImpl::TraceDialogImpl() : optionsCornersThresholdSpinner.set_value(1.0); optionsCornersBox.pack_end(optionsCornersThresholdSpinner, false, false, MARGIN); optionsCornersThresholdSpinner.set_tooltip_text(_("Increase this to smooth corners more")); + optionsCornersThresholdSpinner.get_adjustment()->signal_value_changed().connect( sigc::mem_fun(*this, &TraceDialogImpl::onSettingsChange) ); optionsCornersThresholdLabel.set_label(_("_Threshold:")); optionsCornersThresholdLabel.set_use_underline(true); optionsCornersThresholdLabel.set_mnemonic_widget(optionsCornersThresholdSpinner); @@ -609,6 +726,7 @@ TraceDialogImpl::TraceDialogImpl() : optionsOptimButton.set_use_underline(true); optionsOptimButton.set_active(true); optionsOptimButton.set_tooltip_text(_("Try to optimize paths by joining adjacent Bezier curve segments")); + optionsOptimButton.signal_clicked().connect( sigc::mem_fun(*this, &TraceDialogImpl::onSettingsChange) ); optionsOptimBox.pack_start(optionsOptimButton, false, false, MARGIN); optionsOptimToleranceSpinner.set_digits(2); optionsOptimToleranceSpinner.set_increments(0.05, 0); @@ -616,6 +734,7 @@ TraceDialogImpl::TraceDialogImpl() : optionsOptimToleranceSpinner.set_value(0.2); optionsOptimBox.pack_end(optionsOptimToleranceSpinner, false, false, MARGIN); optionsOptimToleranceSpinner.set_tooltip_text(_("Increase this to reduce the number of nodes in the trace by more aggressive optimization")); + optionsOptimToleranceSpinner.get_adjustment()->signal_value_changed().connect( sigc::mem_fun(*this, &TraceDialogImpl::onSettingsChange) ); optionsOptimToleranceLabel.set_label(_("To_lerance:")); optionsOptimToleranceLabel.set_use_underline(true); optionsOptimToleranceLabel.set_mnemonic_widget(optionsOptimToleranceSpinner); @@ -645,7 +764,7 @@ TraceDialogImpl::TraceDialogImpl() : //#### end left panel - mainHBox.pack_start(leftVBox); + mainHBox.pack_start(leftVBox, false, false, 0); //#### begin right panel @@ -658,12 +777,20 @@ TraceDialogImpl::TraceDialogImpl() : rightVBox.pack_start(sioxBox, false, false, 0); //## preview + Gtk::HBox *previewButtonHBox = manage(new Gtk::HBox(false, MARGIN )); + previewLiveButton.set_label(_("Live Preview")); + previewLiveButton.set_use_underline(true); + previewLiveCallback(); + previewLiveButton.signal_clicked().connect( + sigc::mem_fun(*this, &TraceDialogImpl::previewLiveCallback) ); previewButton.set_label(_("_Update")); previewButton.set_use_underline(true); previewButton.signal_clicked().connect( sigc::mem_fun(*this, &TraceDialogImpl::previewCallback) ); - previewVBox.pack_end(previewButton, false, false, 0); + previewButtonHBox->pack_start(previewLiveButton, false, false, 0); + previewButtonHBox->pack_end(previewButton, true, true, 0); + previewVBox.pack_end(*previewButtonHBox, false, false, 0); // I guess it's correct to call the "intermediate bitmap" a preview of the trace previewButton.set_tooltip_text(_("Preview the intermediate bitmap with the current settings, without actual tracing")); previewImage.set_size_request(200,200); @@ -677,11 +804,13 @@ TraceDialogImpl::TraceDialogImpl() : //#### end right panel - mainHBox.pack_start(rightVBox); + mainHBox.pack_start(rightVBox, true, true, 0); //#### Global stuff contents->pack_start(mainHBox); + mainResetButton = addResponseButton(_("Reset"), GTK_RESPONSE_HELP, true); + mainResetButton ->set_tooltip_text(_("Reset all settings to defaults")); //## The OK button mainCancelButton = addResponseButton(Gtk::Stock::STOP, GTK_RESPONSE_CANCEL); @@ -694,6 +823,9 @@ TraceDialogImpl::TraceDialogImpl() : show_all_children(); + desktopChangeConn = deskTrack.connectDesktopChanged( sigc::mem_fun(*this, &TraceDialogImpl::setTargetDesktop) ); + deskTrack.connect(GTK_WIDGET(gobj())); + //## Connect the signal signalResponse().connect( sigc::mem_fun(*this, &TraceDialogImpl::responseCallback)); @@ -714,6 +846,9 @@ TraceDialog &TraceDialog::getInstance() */ TraceDialogImpl::~TraceDialogImpl() { + selectChangedConn.disconnect(); + selectModifiedConn.disconnect(); + desktopChangeConn.disconnect(); } diff --git a/src/ui/widget/gimpspinscale.c b/src/ui/widget/gimpspinscale.c index 1b7ac7bfe..df39b9644 100644 --- a/src/ui/widget/gimpspinscale.c +++ b/src/ui/widget/gimpspinscale.c @@ -432,7 +432,11 @@ static gboolean gdk_cairo_region (cr, event->region); cairo_clip (cr); +#if GTK_CHECK_VERSION(2, 24,0) w = gdk_window_get_width (event->window); +#else + gdk_drawable_get_size (event->window, &w, NULL); +#endif #endif @@ -682,7 +686,12 @@ gimp_spin_scale_change_value (GtkWidget *widget, gint width; gimp_spin_scale_get_limits (GIMP_SPIN_SCALE (widget), &lower, &upper); + +#if GTK_CHECK_VERSION(2, 24,0) width = gdk_window_get_width (text_window); +#else + gdk_drawable_get_size (text_window, &width, NULL); +#endif #endif diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp index 1f945ada6..42435f298 100644 --- a/src/ui/widget/panel.cpp +++ b/src/ui/widget/panel.cpp @@ -572,21 +572,21 @@ void Panel::_apply() g_warning("Apply button clicked for panel [Panel::_apply()]"); } -Gtk::Button *Panel::addResponseButton(const Glib::ustring &button_text, int response_id) +Gtk::Button *Panel::addResponseButton(const Glib::ustring &button_text, int response_id, bool pack_start) { Gtk::Button *button = new Gtk::Button(button_text); - _addResponseButton(button, response_id); + _addResponseButton(button, response_id, pack_start); return button; } -Gtk::Button *Panel::addResponseButton(const Gtk::StockID &stock_id, int response_id) +Gtk::Button *Panel::addResponseButton(const Gtk::StockID &stock_id, int response_id, bool pack_start) { Gtk::Button *button = new Gtk::Button(stock_id); - _addResponseButton(button, response_id); + _addResponseButton(button, response_id, pack_start); return button; } -void Panel::_addResponseButton(Gtk::Button *button, int response_id) +void Panel::_addResponseButton(Gtk::Button *button, int response_id, bool pack_start) { // Create a button box for the response buttons if it's the first button to be added if (!_action_area) { @@ -597,6 +597,10 @@ void Panel::_addResponseButton(Gtk::Button *button, int response_id) _action_area->pack_end(*button); + if (pack_start) { + _action_area->set_child_secondary( *button , true); + } + if (response_id != 0) { // Re-emit clicked signals as response signals button->signal_clicked().connect(sigc::bind(_signal_response.make_slot(), response_id)); diff --git a/src/ui/widget/panel.h b/src/ui/widget/panel.h index 2d92d65c9..b4cc04809 100644 --- a/src/ui/widget/panel.h +++ b/src/ui/widget/panel.h @@ -96,8 +96,8 @@ public: /* Methods providing a Gtk::Dialog like interface for adding buttons that emit Gtk::RESPONSE * signals on click. */ - Gtk::Button* addResponseButton (const Glib::ustring &button_text, int response_id); - Gtk::Button* addResponseButton (const Gtk::StockID &stock_id, int response_id); + Gtk::Button* addResponseButton (const Glib::ustring &button_text, int response_id, bool pack_start=false); + Gtk::Button* addResponseButton (const Gtk::StockID &stock_id, int response_id, bool pack_start=false); void setDefaultResponse(int response_id); void setResponseSensitive(int response_id, bool setting); @@ -119,7 +119,7 @@ protected: virtual void _handleResponse(int response_id); /* Helper methods */ - void _addResponseButton(Gtk::Button *button, int response_id); + void _addResponseButton(Gtk::Button *button, int response_id, bool pack_start=false); Inkscape::Selection *_getSelection(); /** diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp index a4313f677..e5992958b 100644 --- a/src/ui/widget/selected-style.cpp +++ b/src/ui/widget/selected-style.cpp @@ -23,6 +23,7 @@ #include "desktop-handles.h" #include "style.h" #include "desktop-style.h" +#include "sp-namedview.h" #include "sp-linear-gradient-fns.h" #include "sp-radial-gradient-fns.h" #include "sp-pattern.h" @@ -38,7 +39,6 @@ #include "sp-gradient.h" #include "svg/svg-color.h" #include "svg/css-ostringstream.h" -#include "helper/units.h" #include "event-context.h" #include "message-context.h" #include "verbs.h" @@ -144,10 +144,7 @@ SelectedStyle::SelectedStyle(bool /*layout*/) _opacity_blocked (false), - _popup_px(_sw_group), - _popup_pt(_sw_group), - _popup_mm(_sw_group), - + _unit_mis(NULL), _sw_unit(NULL) { _drop[0] = _drop[1] = 0; @@ -298,34 +295,39 @@ SelectedStyle::SelectedStyle(bool /*layout*/) } { - _popup_px.add(*(new Gtk::Label(_("px"), 0.0, 0.5))); - _popup_px.signal_activate().connect(sigc::mem_fun(*this, &SelectedStyle::on_popup_px)); - _popup_sw.attach(_popup_px, 0,1, 0,1); - - _popup_pt.add(*(new Gtk::Label(_("pt"), 0.0, 0.5))); - _popup_pt.signal_activate().connect(sigc::mem_fun(*this, &SelectedStyle::on_popup_pt)); - _popup_sw.attach(_popup_pt, 0,1, 1,2); - - _popup_mm.add(*(new Gtk::Label(_("mm"), 0.0, 0.5))); - _popup_mm.signal_activate().connect(sigc::mem_fun(*this, &SelectedStyle::on_popup_mm)); - _popup_sw.attach(_popup_mm, 0,1, 2,3); + int row = 0; + + // List of units should match with Fill/Stroke dialog stroke style width list + for (GSList *l = sp_unit_get_list(SP_UNIT_ABSOLUTE | SP_UNIT_DEVICE); l != NULL; l = l->next) { + SPUnit const *u = (SPUnit*)l->data; + Gtk::RadioMenuItem *mi = Gtk::manage(new Gtk::RadioMenuItem(_sw_group)); + mi->add(*(new Gtk::Label(u->abbr, 0.0, 0.5))); + _unit_mis = g_slist_append(_unit_mis, mi); + mi->signal_activate().connect(sigc::bind<SPUnitId>(sigc::mem_fun(*this, &SelectedStyle::on_popup_units), u->unit_id)); + _popup_sw.attach(*mi, 0,1, row, row+1); + row++; + } - _popup_sw.attach(*(new Gtk::SeparatorMenuItem()), 0,1, 3,4); + _popup_sw.attach(*(new Gtk::SeparatorMenuItem()), 0,1, row, row+1); + row++; for (guint i = 0; i < G_N_ELEMENTS(_sw_presets_str); ++i) { Gtk::MenuItem *mi = Gtk::manage(new Gtk::MenuItem()); mi->add(*(new Gtk::Label(_sw_presets_str[i], 0.0, 0.5))); mi->signal_activate().connect(sigc::bind<int>(sigc::mem_fun(*this, &SelectedStyle::on_popup_preset), i)); - _popup_sw.attach(*mi, 0,1, 4+i, 5+i); + _popup_sw.attach(*mi, 0,1, row, row+1); + row++; } - guint i = G_N_ELEMENTS(_sw_presets_str) + 5; - - _popup_sw.attach(*(new Gtk::SeparatorMenuItem()), 0,1, i,i+1); + _popup_sw.attach(*(new Gtk::SeparatorMenuItem()), 0,1, row, row+1); + row++; _popup_sw_remove.add(*(new Gtk::Label(_("Remove"), 0.0, 0.5))); _popup_sw_remove.signal_activate().connect(sigc::mem_fun(*this, &SelectedStyle::on_stroke_remove)); - _popup_sw.attach(_popup_sw_remove, 0,1, i+1,i+2); + _popup_sw.attach(_popup_sw_remove, 0,1, row, row+1); + row++; + + sp_set_font_size_smaller (GTK_WIDGET(_popup_sw.gobj())); _popup_sw.show_all(); } @@ -447,7 +449,17 @@ SelectedStyle::setDesktop(SPDesktop *desktop) this ) )); - //_sw_unit = (SPUnit *) sp_desktop_namedview(desktop)->doc_units; + _sw_unit = (SPUnit *) sp_desktop_namedview(desktop)->doc_units; + + // Set the doc default unit active in the units list + gint length = g_slist_length(_unit_mis); + for (int i = 0; i < length; i++) { + Gtk::RadioMenuItem *mi = (Gtk::RadioMenuItem *) g_slist_nth_data(_unit_mis, i); + if (mi && mi->get_label() == Glib::ustring(_sw_unit->abbr)) { + mi->set_active(); + break; + } + } } void SelectedStyle::dragDataReceived( GtkWidget */*widget*/, @@ -887,16 +899,8 @@ SelectedStyle::on_opacity_click(GdkEventButton *event) return false; } -void SelectedStyle::on_popup_px() { - _sw_unit = (SPUnit *) &(sp_unit_get_by_id(SP_UNIT_PX)); - update(); -} -void SelectedStyle::on_popup_pt() { - _sw_unit = (SPUnit *) &(sp_unit_get_by_id(SP_UNIT_PT)); - update(); -} -void SelectedStyle::on_popup_mm() { - _sw_unit = (SPUnit *) &(sp_unit_get_by_id(SP_UNIT_MM)); +void SelectedStyle::on_popup_units(SPUnitId id) { + _sw_unit = (SPUnit *) &(sp_unit_get_by_id(id)); update(); } diff --git a/src/ui/widget/selected-style.h b/src/ui/widget/selected-style.h index 542983b53..a9e9d7274 100644 --- a/src/ui/widget/selected-style.h +++ b/src/ui/widget/selected-style.h @@ -27,6 +27,7 @@ #include <sigc++/sigc++.h> #include "rotateable.h" +#include "helper/units.h" class SPDesktop; class SPUnit; @@ -250,12 +251,8 @@ protected: Gtk::Menu _popup_sw; Gtk::RadioButtonGroup _sw_group; - Gtk::RadioMenuItem _popup_px; - void on_popup_px(); - Gtk::RadioMenuItem _popup_pt; - void on_popup_pt(); - Gtk::RadioMenuItem _popup_mm; - void on_popup_mm(); + GSList *_unit_mis; + void on_popup_units(SPUnitId id); void on_popup_preset(int i); Gtk::MenuItem _popup_sw_remove; diff --git a/src/widgets/eek-preview.cpp b/src/widgets/eek-preview.cpp index a0bc1ef15..e0c5d9eac 100644 --- a/src/widgets/eek-preview.cpp +++ b/src/widgets/eek-preview.cpp @@ -550,7 +550,8 @@ static gboolean eek_preview_button_press_cb( GtkWidget* widget, GdkEventButton* gtk_widget_grab_focus(widget); } - if ( event->button == PRIME_BUTTON_MAGIC_NUMBER ) { + if ( event->button == PRIME_BUTTON_MAGIC_NUMBER || + event->button == 2 ) { preview->_hot = TRUE; if ( preview->_within ) { gtk_widget_set_state( widget, GTK_STATE_ACTIVE ); @@ -567,8 +568,10 @@ static gboolean eek_preview_button_release_cb( GtkWidget* widget, GdkEventButton EekPreview* preview = EEK_PREVIEW(widget); preview->_hot = FALSE; gtk_widget_set_state( widget, GTK_STATE_NORMAL ); - if ( preview->_within && event->button == PRIME_BUTTON_MAGIC_NUMBER ) { - gboolean isAlt = (event->state & GDK_SHIFT_MASK) == GDK_SHIFT_MASK; + if ( preview->_within && + (event->button == PRIME_BUTTON_MAGIC_NUMBER || event->button == 2)) { + gboolean isAlt = ( ((event->state & GDK_SHIFT_MASK) == GDK_SHIFT_MASK) || + (event->button == 2)); if ( isAlt ) { g_signal_emit( widget, eek_preview_signals[ALTCLICKED_SIGNAL], 0, 2 ); diff --git a/src/widgets/font-selector.cpp b/src/widgets/font-selector.cpp index 0244621bf..61c6261bf 100644 --- a/src/widgets/font-selector.cpp +++ b/src/widgets/font-selector.cpp @@ -349,7 +349,7 @@ static void sp_font_selector_set_sizes( SPFontSelector *fsel ) #if GTK_CHECK_VERSION(2, 24,0) gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(fsel->size), Glib::ustring::format(size).c_str()); #else - gtk_combo_box_append_text (GTK_COMBO_BOX(fsel->size), size); + gtk_combo_box_append_text (GTK_COMBO_BOX(fsel->size), Glib::ustring::format(size).c_str()); #endif } diff --git a/src/widgets/sp-color-notebook.cpp b/src/widgets/sp-color-notebook.cpp index bafc75b18..f2ae0425f 100644 --- a/src/widgets/sp-color-notebook.cpp +++ b/src/widgets/sp-color-notebook.cpp @@ -287,7 +287,7 @@ void ColorNotebook::init() sp_set_font_size_smaller (_buttonbox); gtk_table_attach (GTK_TABLE (table), _buttonbox, 0, 2, row, row + 1, static_cast<GtkAttachOptions>(GTK_EXPAND|GTK_FILL), - static_cast<GtkAttachOptions>(GTK_EXPAND|GTK_FILL), + static_cast<GtkAttachOptions>(0), XPAD, YPAD); row++; diff --git a/src/widgets/sp-color-wheel-selector.cpp b/src/widgets/sp-color-wheel-selector.cpp index 4cc9f9e4a..bb8bba328 100644 --- a/src/widgets/sp-color-wheel-selector.cpp +++ b/src/widgets/sp-color-wheel-selector.cpp @@ -109,7 +109,8 @@ static void resizeHSVWheel( GtkHSV *hsv, GtkAllocation *allocation ) gint diam = std::min(allocation->width, allocation->height); // drop a little for resizing - diam -= 4; + // This magic number stops the dialog expanding in width when resizing height + diam -= 16; GtkStyle *style = gtk_widget_get_style( GTK_WIDGET(hsv) ); if ( style ) { @@ -161,7 +162,7 @@ void ColorWheelSelector::init() _wheel = gtk_hsv_new(); gtk_hsv_set_metrics( GTK_HSV(_wheel), 48, 8 ); gtk_widget_show( _wheel ); - gtk_table_attach( GTK_TABLE(t), _wheel, 0, 3, row, row + 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), XPAD, YPAD); + gtk_table_attach( GTK_TABLE(t), _wheel, 0, 3, row, row + 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), 0, 0); row++; |
