diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2013-07-04 15:27:06 +0000 |
|---|---|---|
| committer | Javiertxo <jtx@jtx.marker.es> | 2013-07-04 15:27:06 +0000 |
| commit | b8ef835cd10460cf7548bae4970b395e9d7767d9 (patch) | |
| tree | 12e14b42023385cf8bf8192c2ae482a4f59deff1 /src | |
| parent | Im not sure what changes are (diff) | |
| parent | Shape calculations. do not quantize the coordinates. (Bug 168158) (diff) | |
| download | inkscape-b8ef835cd10460cf7548bae4970b395e9d7767d9.tar.gz inkscape-b8ef835cd10460cf7548bae4970b395e9d7767d9.zip | |
Upadate to trunk
(bzr r11950.1.122)
Diffstat (limited to 'src')
137 files changed, 1380 insertions, 546 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a8925e24f..49f32fdea 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -407,7 +407,6 @@ set(inkscape_SRC marker.h measure-context.h media.h - memeq.h menus-skeleton.h mesh-context.h message-context.h diff --git a/src/Makefile_insert b/src/Makefile_insert index c6955c92a..87b2545c8 100644 --- a/src/Makefile_insert +++ b/src/Makefile_insert @@ -99,7 +99,6 @@ ink_common_sources += \ main-cmdlineact.cpp main-cmdlineact.h \ marker.cpp marker.h \ media.cpp media.h \ - memeq.h \ menus-skeleton.h \ mesh-context.cpp mesh-context.h \ message-context.cpp message-context.h \ diff --git a/src/colorspace.h b/src/colorspace.h index 58d12b4c8..9b7af55e5 100644 --- a/src/colorspace.h +++ b/src/colorspace.h @@ -35,6 +35,7 @@ namespace colorspace class Component { public: + Component(); Component(std::string const &name, std::string const &tip, guint scale); std::string name; diff --git a/src/desktop.cpp b/src/desktop.cpp index 0bf442b7a..17548ee56 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -70,6 +70,7 @@ #include "sp-item-group.h" #include "sp-namedview.h" #include "sp-root.h" +#include "sp-defs.h" #include "widgets/desktop-widget.h" #include "xml/repr.h" #include "helper/action.h" //sp_action_perform @@ -595,6 +596,9 @@ SPObject *SPDesktop::layerForObject(SPObject *object) { SPObject *root=currentRoot(); object = object->parent; while ( object && object != root && !isLayer(object) ) { + // Objects in defs have no layer and are NOT in the root layer + if(SP_IS_DEFS(object)) + return NULL; object = object->parent; } return object; diff --git a/src/dialogs/dialog-events.cpp b/src/dialogs/dialog-events.cpp index 6a12d973a..4fbf26f94 100644 --- a/src/dialogs/dialog-events.cpp +++ b/src/dialogs/dialog-events.cpp @@ -15,6 +15,10 @@ # include "config.h" #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/entry.h> #include <gtkmm/window.h> #include <gdk/gdkkeysyms.h> diff --git a/src/display/canvas-axonomgrid.cpp b/src/display/canvas-axonomgrid.cpp index 170684328..1eadd3fd2 100644 --- a/src/display/canvas-axonomgrid.cpp +++ b/src/display/canvas-axonomgrid.cpp @@ -17,6 +17,10 @@ # include "config.h" #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <gtkmm/label.h> diff --git a/src/display/canvas-grid.cpp b/src/display/canvas-grid.cpp index 88da22835..ee5ad0945 100644 --- a/src/display/canvas-grid.cpp +++ b/src/display/canvas-grid.cpp @@ -17,6 +17,10 @@ # include "config.h" #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <gtkmm/label.h> diff --git a/src/display/nr-filter.cpp b/src/display/nr-filter.cpp index eeba94d7c..f0965c460 100644 --- a/src/display/nr-filter.cpp +++ b/src/display/nr-filter.cpp @@ -114,7 +114,8 @@ int Filter::render(Inkscape::DrawingItem const *item, DrawingContext &graphic, D Geom::Affine trans = item->ctm(); - Geom::OptRect filter_area = filter_effect_area(item->itemBounds()); +// Geom::OptRect filter_area = filter_effect_area(item->itemBounds()); // disabled, already done in visualBounds + Geom::OptRect filter_area = item->itemBounds(); // see LP Bug 1188336 if (!filter_area) return 1; FilterUnits units(_filter_units, _primitive_units); @@ -221,7 +222,8 @@ void Filter::area_enlarge(Geom::IntRect &bbox, Inkscape::DrawingItem const *item Geom::OptIntRect Filter::compute_drawbox(Inkscape::DrawingItem const *item, Geom::OptRect const &item_bbox) { - Geom::OptRect enlarged = filter_effect_area(item_bbox); +// Geom::OptRect enlarged = filter_effect_area(item_bbox); // disabled, already done in visualBounds + Geom::OptRect enlarged = item_bbox; // see LP Bug 1188336 if (enlarged) { *enlarged *= item->ctm(); diff --git a/src/doxygen-main.cpp b/src/doxygen-main.cpp index 71cd49dae..04e5ab33e 100644 --- a/src/doxygen-main.cpp +++ b/src/doxygen-main.cpp @@ -303,7 +303,7 @@ namespace XML {} * SPGuide [\ref sp-guide.cpp, \ref sp-guide.h, \ref satisfied-guide-cns.cpp, \ref sp-guide-attachment.h, \ref sp-guide-constraint.h] * * [\ref help.cpp] [\ref inkscape.cpp] [\ref inkscape-stock.cpp] - * [\ref interface.cpp, \ref memeq.h] [\ref main.cpp, \ref winmain.cpp] + * [\ref interface.cpp] [\ref main.cpp, \ref winmain.cpp] * [\ref menus-skeleton.h, \ref preferences-skeleton.h] * [\ref select-toolbar.cpp] [\ref shortcuts.cpp] * [\ref sp-cursor.cpp] [\ref text-edit.cpp] [\ref toolbox.cpp] diff --git a/src/event-context.cpp b/src/event-context.cpp index cec3a6e68..4bbb012e0 100644 --- a/src/event-context.cpp +++ b/src/event-context.cpp @@ -18,6 +18,10 @@ # include "config.h" #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include "shortcuts.h" #include "file.h" #include "event-context.h" @@ -586,13 +590,6 @@ static gint sp_event_context_private_root_handler( ret = sp_shortcut_invoke(shortcut, desktop); break; - case GDK_KEY_D: - case GDK_KEY_d: - if (!MOD__SHIFT(event) && !MOD__CTRL(event) && !MOD__ALT(event)) { - sp_toggle_dropper(desktop); - ret = TRUE; - } - break; case GDK_KEY_Q: case GDK_KEY_q: if (desktop->quick_zoomed()) { diff --git a/src/event-log.h b/src/event-log.h index cabc3ae9a..78f0ae5d1 100644 --- a/src/event-log.h +++ b/src/event-log.h @@ -10,6 +10,14 @@ #ifndef INKSCAPE_EVENT_LOG_H #define INKSCAPE_EVENT_LOG_H +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/treestore.h> #include <glibmm/refptr.h> #include <gtkmm/treeselection.h> diff --git a/src/extension/execution-env.cpp b/src/extension/execution-env.cpp index 4058fd787..d4b5fd187 100644 --- a/src/extension/execution-env.cpp +++ b/src/extension/execution-env.cpp @@ -10,6 +10,14 @@ #include <config.h> +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include "gtkmm/messagedialog.h" #include "execution-env.h" diff --git a/src/extension/extension.cpp b/src/extension/extension.cpp index f9cf70960..d63ec7485 100644 --- a/src/extension/extension.cpp +++ b/src/extension/extension.cpp @@ -19,6 +19,10 @@ # include "config.h" #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <gtkmm/label.h> #include <gtkmm/frame.h> @@ -421,16 +425,31 @@ gchar const *Extension::get_param_string(gchar const *name, SPDocument const *do } const gchar * -Extension::get_param_enum (const gchar * name, const SPDocument * doc, const Inkscape::XML::Node * node) +Extension::get_param_enum (const gchar * name, const SPDocument * doc, const Inkscape::XML::Node * node) const { - Parameter* param = get_param(name); + Parameter const *param = get_param(name); return param->get_enum(doc, node); } +/** + * This is useful to find out, if a given string \c value is selectable in a ComboBox named \cname. + * + * @param name The name of the enum parameter to get. + * @param doc The document to look in for document specific parameters. + * @param node The node to look in for a specific parameter. + * @return true if value exists, false if not + */ +bool +Extension::get_param_enum_contains(gchar const * name, gchar const * value, SPDocument * doc, Inkscape::XML::Node * node) const +{ + Parameter const *param = get_param(name); + return param->get_enum_contains(value, doc, node); +} + gchar const * -Extension::get_param_optiongroup( gchar const * name, SPDocument const * doc, Inkscape::XML::Node const * node) +Extension::get_param_optiongroup( gchar const * name, SPDocument const * doc, Inkscape::XML::Node const * node) const { - Parameter* param = get_param(name); + Parameter const*param = get_param(name); return param->get_optiongroup(doc, node); } @@ -504,9 +523,9 @@ Extension::get_param_float (const gchar * name, const SPDocument * doc, const In found parameter. */ guint32 -Extension::get_param_color (const gchar * name, const SPDocument * doc, const Inkscape::XML::Node * node) +Extension::get_param_color (const gchar * name, const SPDocument * doc, const Inkscape::XML::Node * node) const { - Parameter* param = get_param(name); + Parameter const *param = get_param(name); return param->get_color(doc, node); } @@ -597,6 +616,13 @@ Extension::set_param_optiongroup(gchar const * name, gchar const * value, SPDocu return param->set_optiongroup(value, doc, node); } +gchar const * +Extension::set_param_enum(gchar const * name, gchar const * value, SPDocument * doc, Inkscape::XML::Node * node) +{ + Parameter * param = get_param(name); + return param->set_enum(value, doc, node); +} + /** \return The passed in value diff --git a/src/extension/extension.h b/src/extension/extension.h index b6b4c51ed..079276936 100644 --- a/src/extension/extension.h +++ b/src/extension/extension.h @@ -234,15 +234,20 @@ public: guint32 get_param_color (const gchar * name, const SPDocument * doc = NULL, - const Inkscape::XML::Node * node = NULL); + const Inkscape::XML::Node * node = NULL) const; const gchar * get_param_enum (const gchar * name, const SPDocument * doc = NULL, - const Inkscape::XML::Node * node = NULL); + const Inkscape::XML::Node * node = NULL) const; gchar const *get_param_optiongroup( gchar const * name, SPDocument const * doc = 0, - Inkscape::XML::Node const * node = 0); + Inkscape::XML::Node const * node = 0) const; + + bool get_param_enum_contains(gchar const * name, + gchar const * value, + SPDocument * doc = 0x0, + Inkscape::XML::Node * node = 0x0) const; bool set_param_bool (const gchar * name, bool value, @@ -269,6 +274,11 @@ public: SPDocument * doc = 0, Inkscape::XML::Node * node = 0); + gchar const * set_param_enum (gchar const * name, + gchar const * value, + SPDocument * doc = 0x0, + Inkscape::XML::Node * node = 0x0); + guint32 set_param_color (const gchar * name, guint32 color, SPDocument * doc = NULL, diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index 69ce982d0..f0fd3711b 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -19,6 +19,10 @@ # include <config.h> #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/messagedialog.h> #include <gtkmm/main.h> #include <gtkmm/scrolledwindow.h> diff --git a/src/extension/internal/bitmap/imagemagick.cpp b/src/extension/internal/bitmap/imagemagick.cpp index 728c38dea..0d47240d4 100644 --- a/src/extension/internal/bitmap/imagemagick.cpp +++ b/src/extension/internal/bitmap/imagemagick.cpp @@ -8,6 +8,14 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <libintl.h> #include <gtkmm/box.h> diff --git a/src/extension/internal/cairo-ps-out.cpp b/src/extension/internal/cairo-ps-out.cpp index 983c9dfb5..5ce9a21f3 100644 --- a/src/extension/internal/cairo-ps-out.cpp +++ b/src/extension/internal/cairo-ps-out.cpp @@ -66,7 +66,7 @@ bool CairoEpsOutput::check (Inkscape::Extension::Extension * /*module*/) static bool ps_print_document_to_file(SPDocument *doc, gchar const *filename, unsigned int level, bool texttopath, bool omittext, - bool filtertobitmap, int resolution, const gchar * const exportId, bool exportDrawing, bool exportCanvas, bool eps = false) + bool filtertobitmap, int resolution, const gchar * const exportId, bool exportDrawing, bool exportCanvas, float bleedmargin_px, bool eps = false) { doc->ensureUpToDate(); @@ -104,7 +104,7 @@ ps_print_document_to_file(SPDocument *doc, gchar const *filename, unsigned int l bool ret = ctx->setPsTarget(filename); if(ret) { /* Render document */ - ret = renderer->setupDocument(ctx, doc, pageBoundingBox, 0., base); + ret = renderer->setupDocument(ctx, doc, pageBoundingBox, bleedmargin_px, base); if (ret) { renderer->renderItem(ctx, base); ret = ctx->finish(); @@ -174,6 +174,11 @@ CairoPsOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar con bool new_areaDrawing = !new_areaPage; + float bleedmargin_px = 0.; + try { + bleedmargin_px = ext->get_param_float("bleed"); + } catch(...) {} + const gchar *new_exportId = NULL; try { new_exportId = mod->get_param_string("exportId"); @@ -183,7 +188,11 @@ CairoPsOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar con { gchar * final_name; final_name = g_strdup_printf("> %s", filename); - ret = ps_print_document_to_file(doc, final_name, level, new_textToPath, new_textToLaTeX, new_blurToBitmap, new_bitmapResolution, new_exportId, new_areaDrawing, new_areaPage); + ret = ps_print_document_to_file(doc, final_name, level, new_textToPath, + new_textToLaTeX, new_blurToBitmap, + new_bitmapResolution, new_exportId, + new_areaDrawing, new_areaPage, + bleedmargin_px); g_free(final_name); if (!ret) @@ -254,6 +263,11 @@ CairoEpsOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar co bool new_areaDrawing = !new_areaPage; + float bleedmargin_px = 0.; + try { + bleedmargin_px = ext->get_param_float("bleed"); + } catch(...) {} + const gchar *new_exportId = NULL; try { new_exportId = mod->get_param_string("exportId"); @@ -263,7 +277,11 @@ CairoEpsOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar co { gchar * final_name; final_name = g_strdup_printf("> %s", filename); - ret = ps_print_document_to_file(doc, final_name, level, new_textToPath, new_textToLaTeX, new_blurToBitmap, new_bitmapResolution, new_exportId, new_areaDrawing, new_areaPage, true); + ret = ps_print_document_to_file(doc, final_name, level, new_textToPath, + new_textToLaTeX, new_blurToBitmap, + new_bitmapResolution, new_exportId, + new_areaDrawing, new_areaPage, + bleedmargin_px, true); g_free(final_name); if (!ret) @@ -322,6 +340,7 @@ CairoPsOutput::init (void) "<_option value=\"page\">" N_("Use document's page size") "</_option>" "<_option value=\"drawing\">" N_("Use exported object's size") "</_option>" "</param>" + "<param name=\"bleed\" gui-text=\"" N_("Bleed/margin (mm)") "\" type=\"float\" min=\"-10000\" max=\"10000\">0</param>\n" "<param name=\"exportId\" gui-text=\"" N_("Limit export to the object with ID:") "\" type=\"string\"></param>\n" "<output>\n" "<extension>.ps</extension>\n" @@ -362,6 +381,7 @@ CairoEpsOutput::init (void) "<_option value=\"page\">" N_("Use document's page size") "</_option>" "<_option value=\"drawing\">" N_("Use exported object's size") "</_option>" "</param>" + "<param name=\"bleed\" gui-text=\"" N_("Bleed/margin (mm)") "\" type=\"float\" min=\"-10000\" max=\"10000\">0</param>\n" "<param name=\"exportId\" gui-text=\"" N_("Limit export to the object with ID:") "\" type=\"string\"></param>\n" "<output>\n" "<extension>.eps</extension>\n" diff --git a/src/extension/internal/cdr-input.h b/src/extension/internal/cdr-input.h index 10af41d5a..3de6c1ed0 100644 --- a/src/extension/internal/cdr-input.h +++ b/src/extension/internal/cdr-input.h @@ -19,6 +19,10 @@ #ifdef WITH_LIBCDR +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/dialog.h> #include "../implementation/implementation.h" diff --git a/src/extension/internal/grid.cpp b/src/extension/internal/grid.cpp index 56bce2fe8..820d1c9d3 100644 --- a/src/extension/internal/grid.cpp +++ b/src/extension/internal/grid.cpp @@ -11,6 +11,14 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <gtkmm/adjustment.h> #include <gtkmm/spinbutton.h> diff --git a/src/extension/internal/odf.cpp b/src/extension/internal/odf.cpp index b23378fc3..9f745cdea 100644 --- a/src/extension/internal/odf.cpp +++ b/src/extension/internal/odf.cpp @@ -1191,16 +1191,29 @@ bool OdfOutput::writeMeta(ZipFile &zf) { creator = iter->second; } - Glib::ustring date = ""; + + Glib::ustring date; + Glib::ustring moddate; + char buf [80]; + time_t rawtime; + struct tm * timeinfo; + time (&rawtime); + timeinfo = localtime (&rawtime); + strftime (buf,80,"%Y-%m-%d %H:%M:%S",timeinfo); + moddate = Glib::ustring(buf); + iter = metadata.find("dc:date"); if (iter != metadata.end()) { date = iter->second; } + else + { + date = moddate; + } outs.writeString("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); outs.writeString("\n"); - outs.writeString("\n"); outs.writeString("<!--\n"); outs.writeString("*************************************************************************\n"); outs.writeString(" file: meta.xml\n"); @@ -1209,7 +1222,6 @@ bool OdfOutput::writeMeta(ZipFile &zf) outs.writeString("*************************************************************************\n"); outs.writeString("-->\n"); outs.writeString("\n"); - outs.writeString("\n"); outs.writeString("<office:document-meta\n"); outs.writeString("xmlns:office=\"urn:oasis:names:tc:opendocument:xmlns:office:1.0\"\n"); outs.writeString("xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n"); @@ -1221,10 +1233,11 @@ bool OdfOutput::writeMeta(ZipFile &zf) outs.writeString("xmlns:anim=\"urn:oasis:names:tc:opendocument:xmlns:animation:1.0\"\n"); outs.writeString("office:version=\"1.0\">\n"); outs.writeString("<office:meta>\n"); - Glib::ustring tmp = Glib::ustring(" <meta:generator>") + InkscapeVersion + "</meta:generator>\n"; + Glib::ustring tmp = Glib::ustring::compose(" <meta:generator>%1</meta:generator>\n", InkscapeVersion); + tmp += Glib::ustring::compose(" <meta:initial-creator>%1</meta:initial-creator>\n", creator); + tmp += Glib::ustring::compose(" <meta:creation-date>%1</meta:creation-date>\n", date); + tmp += Glib::ustring::compose(" <dc:date>%1</dc:date>\n", moddate); outs.writeUString(tmp); - outs.printf(" <meta:initial-creator>%s</meta:initial-creator>\n", creator.c_str()); - outs.printf(" <meta:creation-date>%s</meta:creation-date>\n", date.c_str()); for (iter = metadata.begin() ; iter != metadata.end() ; ++iter) { Glib::ustring name = iter->first; @@ -1235,18 +1248,15 @@ bool OdfOutput::writeMeta(ZipFile &zf) outs.writeUString(tmp); } } - outs.writeString(" <meta:editing-cycles>2</meta:editing-cycles>\n"); - outs.writeString(" <meta:editing-duration>PT56S</meta:editing-duration>\n"); - outs.writeString(" <meta:user-defined meta:name=\"Info 1\"/>\n"); - outs.writeString(" <meta:user-defined meta:name=\"Info 2\"/>\n"); - outs.writeString(" <meta:user-defined meta:name=\"Info 3\"/>\n"); - outs.writeString(" <meta:user-defined meta:name=\"Info 4\"/>\n"); - outs.writeString(" <meta:document-statistic meta:object-count=\"2\"/>\n"); + // outs.writeString(" <meta:editing-cycles>2</meta:editing-cycles>\n"); + // outs.writeString(" <meta:editing-duration>PT56S</meta:editing-duration>\n"); + // outs.writeString(" <meta:user-defined meta:name=\"Info 1\"/>\n"); + // outs.writeString(" <meta:user-defined meta:name=\"Info 2\"/>\n"); + // outs.writeString(" <meta:user-defined meta:name=\"Info 3\"/>\n"); + // outs.writeString(" <meta:user-defined meta:name=\"Info 4\"/>\n"); + // outs.writeString(" <meta:document-statistic meta:object-count=\"2\"/>\n"); outs.writeString("</office:meta>\n"); outs.writeString("</office:document-meta>\n"); - outs.writeString("\n"); - outs.writeString("\n"); - outs.close(); //Make our entry @@ -1533,7 +1543,7 @@ bool OdfOutput::processGradient(SPItem *item, gradientTable.push_back(gi); gradientLookupTable[id] = gradientName; - int gradientCount = gradientTable.size(); + // int gradientCount = gradientTable.size(); char buf[128]; if (gi.style == "linear") { diff --git a/src/extension/internal/pdf-input-cairo.h b/src/extension/internal/pdf-input-cairo.h index 66f1e5e7e..b65d22f48 100644 --- a/src/extension/internal/pdf-input-cairo.h +++ b/src/extension/internal/pdf-input-cairo.h @@ -16,6 +16,10 @@ # include <config.h> #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/dialog.h> #include <gtkmm/button.h> #include <gtkmm/buttonbox.h> diff --git a/src/extension/internal/pdfinput/pdf-input.h b/src/extension/internal/pdfinput/pdf-input.h index 3710e4667..f22a783ff 100644 --- a/src/extension/internal/pdfinput/pdf-input.h +++ b/src/extension/internal/pdfinput/pdf-input.h @@ -16,6 +16,10 @@ #ifdef HAVE_POPPLER +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/dialog.h> #include "../../implementation/implementation.h" diff --git a/src/extension/internal/vsd-input.h b/src/extension/internal/vsd-input.h index acc52debf..3414e0ec9 100644 --- a/src/extension/internal/vsd-input.h +++ b/src/extension/internal/vsd-input.h @@ -19,6 +19,10 @@ #ifdef WITH_LIBVISIO +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/dialog.h> #include "../implementation/implementation.h" diff --git a/src/extension/param/bool.cpp b/src/extension/param/bool.cpp index de9b1c586..548dec4fa 100644 --- a/src/extension/param/bool.cpp +++ b/src/extension/param/bool.cpp @@ -10,6 +10,10 @@ # include "config.h" #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/adjustment.h> #include <gtkmm/box.h> #include <gtkmm/spinbutton.h> diff --git a/src/extension/param/color.cpp b/src/extension/param/color.cpp index d8c78c97d..0a2598c56 100644 --- a/src/extension/param/color.cpp +++ b/src/extension/param/color.cpp @@ -14,6 +14,10 @@ #include <iostream> #include <sstream> +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/adjustment.h> #include <gtkmm/box.h> #include <gtkmm/spinbutton.h> diff --git a/src/extension/param/description.cpp b/src/extension/param/description.cpp index ae2d88ab3..c9cea73d4 100644 --- a/src/extension/param/description.cpp +++ b/src/extension/param/description.cpp @@ -13,6 +13,10 @@ # include "config.h" #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <gtkmm/label.h> #include <glibmm/i18n.h> diff --git a/src/extension/param/enum.cpp b/src/extension/param/enum.cpp index 18a73beb6..bb50c06e1 100644 --- a/src/extension/param/enum.cpp +++ b/src/extension/param/enum.cpp @@ -18,6 +18,10 @@ # include "config.h" #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <gtkmm/comboboxtext.h> #include <glibmm/i18n.h> @@ -173,6 +177,24 @@ const gchar *ParamComboBox::set(const gchar * in, SPDocument * /*doc*/, Inkscape return _value; } +/** + * function to test if \c guitext is selectable + */ +bool ParamComboBox::contains(const gchar * guitext, SPDocument const * /*doc*/, Inkscape::XML::Node const * /*node*/) const +{ + if (guitext == NULL) { + return false; /* Can't have NULL string */ + } + + for (GSList * list = choices; list != NULL; list = g_slist_next(list)) { + enumentry * entr = reinterpret_cast<enumentry *>(list->data); + if ( !entr->guitext.compare(guitext) ) + return true; + } + // if we did not find the guitext in this ParamComboBox: + return false; +} + void ParamComboBox::changed (void) { diff --git a/src/extension/param/enum.h b/src/extension/param/enum.h index ac7d72abd..52e018469 100644 --- a/src/extension/param/enum.h +++ b/src/extension/param/enum.h @@ -51,6 +51,11 @@ public: const gchar * set (const gchar * in, SPDocument * doc, Inkscape::XML::Node * node); + /** + * @returns true if guitext is part of this enum + */ + bool contains(const gchar * guitext, SPDocument const * /*doc*/, Inkscape::XML::Node const * /*node*/) const; + void changed (void); }; /* class ParamComboBox */ diff --git a/src/extension/param/float.cpp b/src/extension/param/float.cpp index 81508f6c0..464938f03 100644 --- a/src/extension/param/float.cpp +++ b/src/extension/param/float.cpp @@ -10,6 +10,10 @@ # include "config.h" #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/adjustment.h> #include <gtkmm/box.h> #include <gtkmm/scale.h> diff --git a/src/extension/param/int.cpp b/src/extension/param/int.cpp index c286018fd..819c75693 100644 --- a/src/extension/param/int.cpp +++ b/src/extension/param/int.cpp @@ -10,6 +10,10 @@ # include "config.h" #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/adjustment.h> #include <gtkmm/box.h> #include <gtkmm/scale.h> diff --git a/src/extension/param/notebook.cpp b/src/extension/param/notebook.cpp index 85cb5d04c..97002e33f 100644 --- a/src/extension/param/notebook.cpp +++ b/src/extension/param/notebook.cpp @@ -16,6 +16,9 @@ # include "config.h" #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif #include <gtkmm/adjustment.h> #include <gtkmm/box.h> diff --git a/src/extension/param/parameter.cpp b/src/extension/param/parameter.cpp index 97e4f9d8c..202b8110f 100644 --- a/src/extension/param/parameter.cpp +++ b/src/extension/param/parameter.cpp @@ -183,6 +183,15 @@ gchar const *Parameter::get_enum(SPDocument const *doc, Inkscape::XML::Node cons return param->get(doc, node); } +bool Parameter::get_enum_contains(gchar const * value, SPDocument const *doc, Inkscape::XML::Node const *node) const +{ + ParamComboBox const *param = dynamic_cast<ParamComboBox const *>(this); + if (!param) { + throw Extension::param_not_enum_param(); + } + return param->contains(value, doc, node); +} + gchar const *Parameter::get_optiongroup(SPDocument const *doc, Inkscape::XML::Node const * node) const { ParamRadioButton const *param = dynamic_cast<ParamRadioButton const *>(this); @@ -247,6 +256,15 @@ gchar const * Parameter::set_optiongroup( gchar const * in, SPDocument * doc, In return param->set(in, doc, node); } +gchar const *Parameter::set_enum( gchar const * in, SPDocument * doc, Inkscape::XML::Node * node ) +{ + ParamComboBox *param = dynamic_cast<ParamComboBox *>(this); + if (!param) { + throw Extension::param_not_enum_param(); + } + return param->set(in, doc, node); +} + /** Wrapper to cast to the object and use it's function. */ guint32 diff --git a/src/extension/param/parameter.h b/src/extension/param/parameter.h index d08efc554..5e1e3897f 100644 --- a/src/extension/param/parameter.h +++ b/src/extension/param/parameter.h @@ -88,8 +88,10 @@ public: gchar const *get_enum(SPDocument const *doc, Inkscape::XML::Node const *node) const; /** Wrapper to cast to the object and use it's function. */ - gchar const *get_optiongroup(SPDocument const * doc, Inkscape::XML::Node const *node) const; + bool get_enum_contains(gchar const * value, SPDocument const *doc, Inkscape::XML::Node const *node) const; + /** Wrapper to cast to the object and use it's function. */ + gchar const *get_optiongroup(SPDocument const * doc, Inkscape::XML::Node const *node) const; /** Wrapper to cast to the object and use it's function. */ bool set_bool(bool in, SPDocument * doc, Inkscape::XML::Node * node); @@ -101,6 +103,8 @@ public: gchar const *set_optiongroup(gchar const *in, SPDocument * doc, Inkscape::XML::Node *node); + gchar const *set_enum(gchar const * in, SPDocument * doc, Inkscape::XML::Node *node); + gchar const *set_string(gchar const * in, SPDocument * doc, Inkscape::XML::Node * node); guint32 set_color(guint32 in, SPDocument * doc, Inkscape::XML::Node * node); diff --git a/src/extension/param/radiobutton.cpp b/src/extension/param/radiobutton.cpp index e6e4d64e9..75d5a40e3 100644 --- a/src/extension/param/radiobutton.cpp +++ b/src/extension/param/radiobutton.cpp @@ -18,6 +18,10 @@ # include "config.h" #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <gtkmm/comboboxtext.h> #include <gtkmm/radiobutton.h> diff --git a/src/extension/param/string.cpp b/src/extension/param/string.cpp index 4e525ff73..d6e438db5 100644 --- a/src/extension/param/string.cpp +++ b/src/extension/param/string.cpp @@ -10,6 +10,10 @@ # include "config.h" #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/adjustment.h> #include <gtkmm/box.h> #include <gtkmm/spinbutton.h> diff --git a/src/extension/prefdialog.h b/src/extension/prefdialog.h index e1999791f..905d35744 100644 --- a/src/extension/prefdialog.h +++ b/src/extension/prefdialog.h @@ -10,6 +10,14 @@ #ifndef INKSCAPE_EXTENSION_DIALOG_H__ #define INKSCAPE_EXTENSION_DIALOG_H__ +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/dialog.h> #include <glibmm/value.h> #include <glibmm/ustring.h> diff --git a/src/helper/window.cpp b/src/helper/window.cpp index 444e1d8b0..cf6fb12ec 100644 --- a/src/helper/window.cpp +++ b/src/helper/window.cpp @@ -12,6 +12,11 @@ #ifdef HAVE_CONFIG_H # include <config.h> #endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/window.h> #include "inkscape.h" diff --git a/src/inkscape.cpp b/src/inkscape.cpp index eca19c4b9..7e570deb7 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -19,6 +19,11 @@ #include <errno.h> #include <map> + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/messagedialog.h> #include "debug/simple-event.h" #include "debug/event-tracker.h" diff --git a/src/interface.h b/src/interface.h index 2e9e7fc2e..13fbaf9ac 100644 --- a/src/interface.h +++ b/src/interface.h @@ -17,6 +17,14 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/menu.h> class SPItem; diff --git a/src/livarot/Shape.cpp b/src/livarot/Shape.cpp index c29444a33..130b1b03a 100644 --- a/src/livarot/Shape.cpp +++ b/src/livarot/Shape.cpp @@ -334,8 +334,8 @@ Shape::AddPoint (const Geom::Point x) pData[n].nextLinkedPoint = -1; pData[n].askForWindingS = NULL; pData[n].askForWindingB = -1; - pData[n].rx[0] = Round(p.x[0]); - pData[n].rx[1] = Round(p.x[1]); + pData[n].rx[0] = /*Round*/ (p.x[0]); + pData[n].rx[1] = /*Round*/ (p.x[1]); } if (_has_voronoi_data) { @@ -2116,8 +2116,8 @@ void Shape::initialisePointData() pData[i].pending = 0; pData[i].edgeOnLeft = -1; pData[i].nextLinkedPoint = -1; - pData[i].rx[0] = Round(getPoint(i).x[0]); - pData[i].rx[1] = Round(getPoint(i).x[1]); + pData[i].rx[0] = /*Round*/ (getPoint(i).x[0]); + pData[i].rx[1] = /*Round*/ (getPoint(i).x[1]); } _point_data_initialised = true; diff --git a/src/livarot/Shape.h b/src/livarot/Shape.h index dcd172da2..b999b9dca 100644 --- a/src/livarot/Shape.h +++ b/src/livarot/Shape.h @@ -266,10 +266,10 @@ public: // be careful when using this function // the coordinate rounding function - inline static double Round(double x) - { - return ldexp(rint(ldexp(x, 5)), -5); - } +// inline static double Round(double x) +// { +// return ldexp(rint(ldexp(x, 5)), -5); +// } // 2 miscannellous variations on it, to scale to and back the rounding grid inline static double HalfRound(double x) diff --git a/src/livarot/ShapeMisc.cpp b/src/livarot/ShapeMisc.cpp index 6fd40790f..5bb8a25ef 100644 --- a/src/livarot/ShapeMisc.cpp +++ b/src/livarot/ShapeMisc.cpp @@ -49,8 +49,8 @@ Shape::ConvertToForme (Path * dest) for (int i = 0; i < numberOfPoints(); i++) { - pData[i].rx[0] = Round (getPoint(i).x[0]); - pData[i].rx[1] = Round (getPoint(i).x[1]); + pData[i].rx[0] = /*Round*/ (getPoint(i).x[0]); + pData[i].rx[1] = /*Round*/ (getPoint(i).x[1]); } for (int i = 0; i < numberOfEdges(); i++) { @@ -199,8 +199,8 @@ Shape::ConvertToForme (Path * dest, int nbP, Path * *orig, bool splitWhenForced) for (int i = 0; i < numberOfPoints(); i++) { - pData[i].rx[0] = Round (getPoint(i).x[0]); - pData[i].rx[1] = Round (getPoint(i).x[1]); + pData[i].rx[0] = /*Round*/ (getPoint(i).x[0]); + pData[i].rx[1] = /*Round*/ (getPoint(i).x[1]); } for (int i = 0; i < numberOfEdges(); i++) { @@ -352,8 +352,8 @@ Shape::ConvertToFormeNested (Path * dest, int nbP, Path * *orig, int wildPath,in for (int i = 0; i < numberOfPoints(); i++) { - pData[i].rx[0] = Round (getPoint(i).x[0]); - pData[i].rx[1] = Round (getPoint(i).x[1]); + pData[i].rx[0] = /*Round*/ (getPoint(i).x[0]); + pData[i].rx[1] = /*Round*/ (getPoint(i).x[1]); } for (int i = 0; i < numberOfEdges(); i++) { diff --git a/src/livarot/ShapeSweep.cpp b/src/livarot/ShapeSweep.cpp index c2fd83e31..ffe5a9d73 100644 --- a/src/livarot/ShapeSweep.cpp +++ b/src/livarot/ShapeSweep.cpp @@ -250,8 +250,8 @@ Shape::ConvertToShape (Shape * a, FillRule directed, bool invert) } Geom::Point rPtX; - rPtX[0]= Round (ptX[0]); - rPtX[1]= Round (ptX[1]); + rPtX[0]= /*Round*/ (ptX[0]); + rPtX[1]= /*Round*/ (ptX[1]); int lastPointNo = -1; lastPointNo = AddPoint (rPtX); pData[lastPointNo].rx = rPtX; @@ -1051,8 +1051,8 @@ Shape::Booleen (Shape * a, Shape * b, BooleanOp mod,int cutPathID) } Geom::Point rPtX; - rPtX[0]= Round (ptX[0]); - rPtX[1]= Round (ptX[1]); + rPtX[0]= /*Round*/ (ptX[0]); + rPtX[1]= /*Round*/ (ptX[1]); int lastPointNo = -1; lastPointNo = AddPoint (rPtX); pData[lastPointNo].rx = rPtX; diff --git a/src/live_effects/lpe-bendpath.cpp b/src/live_effects/lpe-bendpath.cpp index 49660c91b..eaf9fe4a6 100644 --- a/src/live_effects/lpe-bendpath.cpp +++ b/src/live_effects/lpe-bendpath.cpp @@ -94,6 +94,10 @@ LPEBendPath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd bend_path.changed = false; } + if (uskeleton.empty()) { + return pwd2_in; /// \todo or throw an exception instead? might be better to throw an exception so that the UI can display an error message or smth + } + D2<Piecewise<SBasis> > patternd2 = make_cuts_independent(pwd2_in); Piecewise<SBasis> x = vertical_pattern.get_value() ? Piecewise<SBasis>(patternd2[1]) : Piecewise<SBasis>(patternd2[0]); Piecewise<SBasis> y = vertical_pattern.get_value() ? Piecewise<SBasis>(patternd2[0]) : Piecewise<SBasis>(patternd2[1]); @@ -105,9 +109,9 @@ LPEBendPath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd x-= bboxHorizontal.min(); y-= bboxVertical.middle(); - double scaling = uskeleton.cuts.back()/bboxHorizontal.extent(); + double scaling = uskeleton.cuts.back()/bboxHorizontal.extent(); - if (scaling != 1.0) { + if (scaling != 1.0) { x*=scaling; } @@ -117,7 +121,6 @@ LPEBendPath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd if (prop_scale != 1.0) y *= prop_scale; } - Piecewise<D2<SBasis> > output = compose(uskeleton,x) + y*compose(n,x); return output; } diff --git a/src/live_effects/parameter/originalpath.cpp b/src/live_effects/parameter/originalpath.cpp index 71ab006d6..6e1d9476d 100644 --- a/src/live_effects/parameter/originalpath.cpp +++ b/src/live_effects/parameter/originalpath.cpp @@ -4,6 +4,14 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include "live_effects/parameter/originalpath.h" diff --git a/src/main.cpp b/src/main.cpp index 5bb42d405..19ea3f181 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -147,7 +147,9 @@ enum { SP_ARG_EXPORT_SVG, SP_ARG_EXPORT_PS, SP_ARG_EXPORT_EPS, + SP_ARG_EXPORT_PS_LEVEL, SP_ARG_EXPORT_PDF, + SP_ARG_EXPORT_PDF_VERSION, SP_ARG_EXPORT_LATEX, #ifdef WIN32 SP_ARG_EXPORT_EMF, @@ -200,7 +202,9 @@ static gboolean sp_export_id_only = FALSE; static gchar *sp_export_svg = NULL; static gchar *sp_export_ps = NULL; static gchar *sp_export_eps = NULL; +static gint sp_export_ps_level = 2; static gchar *sp_export_pdf = NULL; +static gchar *sp_export_pdf_version = NULL; #ifdef WIN32 static gchar *sp_export_emf = NULL; #endif //WIN32 @@ -244,7 +248,9 @@ static void resetCommandlineGlobals() { sp_export_svg = NULL; sp_export_ps = NULL; sp_export_eps = NULL; + sp_export_ps_level = 2; sp_export_pdf = NULL; + sp_export_pdf_version = NULL; #ifdef WIN32 sp_export_emf = NULL; #endif //WIN32 @@ -381,11 +387,23 @@ struct poptOption options[] = { N_("Export document to an EPS file"), N_("FILENAME")}, + {"export-ps-level", 0, + POPT_ARG_INT, &sp_export_ps_level, SP_ARG_EXPORT_PS_LEVEL, + N_("Choose the PostScript Level used to export. Possible choices are" + " 2 (the default) and 3"), + N_("PS Level")}, + {"export-pdf", 'A', POPT_ARG_STRING, &sp_export_pdf, SP_ARG_EXPORT_PDF, N_("Export document to a PDF file"), N_("FILENAME")}, + {"export-pdf-version", 0, + POPT_ARG_STRING, &sp_export_pdf_version, SP_ARG_EXPORT_PDF_VERSION, + // TRANSLATORS: "--export-pdf-version" is an Inkscape command line option; see "inkscape --help" + N_("Export PDF to given version. (hint: make sure to input the exact string found in the PDF export dialog, e.g. \"PDF 1.4\" which is PDF-a conformant)"), + N_("PDF_VERSION")}, + {"export-latex", 0, POPT_ARG_NONE, &sp_export_latex, SP_ARG_EXPORT_LATEX, N_("Export PDF/PS/EPS without text. Besides the PDF/PS/EPS, a LaTeX file is exported, putting the text on top of the PDF/PS/EPS file. Include the result in LaTeX like: \\input{latexfile.tex}"), @@ -1638,12 +1656,54 @@ static int do_export_ps_pdf(SPDocument* doc, gchar const* uri, char const* mime) } (*i)->set_param_float("bleed", margin); + // handle --export-pdf-version + if (g_strcmp0(mime, "application/pdf") == 0) { + bool set_export_pdf_version_fail=true; + const gchar *pdfver_param_name="PDFversion"; + if(sp_export_pdf_version) { + // combine "PDF " and the given command line + std::string version_gui_string=std::string("PDF ")+sp_export_pdf_version; + try{ + // first, check if the given pdf version is selectable in the ComboBox + if((*i)->get_param_enum_contains("PDFversion", version_gui_string.c_str())) { + (*i)->set_param_enum(pdfver_param_name, version_gui_string.c_str()); + set_export_pdf_version_fail=false; + } else { + g_warning("Desired PDF export version \"%s\" not supported! Hint: input one of the versions found in the pdf export dialog e.g. \"1.4\".", + sp_export_pdf_version); + } + } catch (...) { + // can be thrown along the way: + // throw Extension::param_not_exist(); + // throw Extension::param_not_enum_param(); + g_warning("Parameter or Enum \"%s\" might not exist",pdfver_param_name); + } + } + + // set default pdf export version to 1.4, also if something went wrong + if(set_export_pdf_version_fail) { + (*i)->set_param_enum(pdfver_param_name, "PDF 1.4"); + } + } + //check if specified directory exists if (!Inkscape::IO::file_directory_exists(uri)) { g_warning("File path \"%s\" includes directory that doesn't exist.\n", uri); return 1; } + if ( g_strcmp0(mime, "image/x-postscript") == 0 + || g_strcmp0(mime, "image/x-e-postscript") == 0 ) { + if ( sp_export_ps_level < 2 || sp_export_ps_level > 3 ) { + g_warning("Only supported PostScript levels are 2 and 3." + " Defaulting to 2."); + sp_export_ps_level = 2; + } + + (*i)->set_param_enum("PSlevel", (sp_export_ps_level == 3) + ? "PostScript level 3" : "PostScript level 2"); + } + (*i)->save(doc, uri); return 0; } diff --git a/src/memeq.h b/src/memeq.h deleted file mode 100644 index ebccc3c9e..000000000 --- a/src/memeq.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef INKSCAPE_MEMEQ_H -#define INKSCAPE_MEMEQ_H - -#include <cstring> - -/** Convenience/readability wrapper for memcmp(a,b,n)==0. */ -inline bool -memeq(void const *a, void const *b, size_t n) -{ - return std::memcmp(a, b, n) == 0; -} - - -#endif /* !INKSCAPE_MEMEQ_H */ - -/* - Local Variables: - mode:c++ - c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) - indent-tabs-mode:nil - fill-column:99 - End: -*/ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/menus-skeleton.h b/src/menus-skeleton.h index 694619089..77e781763 100644 --- a/src/menus-skeleton.h +++ b/src/menus-skeleton.h @@ -199,10 +199,6 @@ static char const menus_skeleton[] = " <verb verb-id=\"ObjectsToPattern\" />\n" " <verb verb-id=\"ObjectsFromPattern\" />\n" " </submenu>\n" -" <submenu name=\"" N_("Symbo_l") "\">\n" -" <verb verb-id=\"ObjectsToSymbol\" />\n" -" <verb verb-id=\"ObjectsFromSymbol\" />\n" -" </submenu>\n" " <verb verb-id=\"ObjectsToMarker\" />\n" " <verb verb-id=\"ObjectsToGuides\" />\n" " <separator/>\n" diff --git a/src/rdf.cpp b/src/rdf.cpp index 017de42c1..72aea4898 100644 --- a/src/rdf.cpp +++ b/src/rdf.cpp @@ -202,8 +202,8 @@ struct rdf_license_t rdf_licenses [] = { rdf_license_cc_a_nc_nd, }, - { N_("Public Domain"), - "http://creativecommons.org/licenses/publicdomain/", + { N_("CC0 Public Domain Dedication"), + "http://creativecommons.org/publicdomain/zero/1.0/", rdf_license_pd, }, diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index cd0001175..56923859b 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -784,8 +784,10 @@ void sp_selection_ungroup(SPDesktop *desktop) continue; } - /* We do not allow ungrouping <svg> etc. (lauris) */ - if (strcmp(group->getRepr()->name(), "svg:g") && strcmp(group->getRepr()->name(), "svg:switch")) { + // This check reflects the g_return_if_fail in sp_item_group_ungroup and + // may be a redundent. It also allows ungrouping of 'a' tags and we dont + if (strcmp(group->getRepr()->name(), "svg:g") && strcmp(group->getRepr()->name(), "svg:switch") && + strcmp(group->getRepr()->name(), "svg:svg")) { // keep the non-group item in the new selection new_select = g_slist_append(new_select, group); continue; @@ -3030,19 +3032,17 @@ void sp_selection_unsymbol(SPDesktop *desktop) return; } - SPObject* use = selection->single(); + SPObject* symbol = selection->single(); // Make sure we have only one object in selection. // Require that we really have a <use> that references a <symbol>. - if( use == NULL || ( !SP_IS_USE( use ) && !SP_IS_SYMBOL( use->firstChild() ))) { + if( symbol == NULL || !SP_IS_SYMBOL( symbol )) { desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select only one <b>symbol</b> to convert to group.")); return; } doc->ensureUpToDate(); - SPObject* symbol = use->firstChild(); - Inkscape::XML::Node *group = xml_doc->createElement("svg:g"); group->setAttribute("style", symbol->getAttribute("style")); group->setAttribute("title", symbol->getAttribute("title")); @@ -3060,14 +3060,14 @@ void sp_selection_unsymbol(SPDesktop *desktop) child->deleteObject(true); } - SPObject* parent = use->parent; // So we insert <g> next to <use> (easier to find) + // So we insert <g> inside the current layer + SPObject *parent = desktop->currentLayer(); // Need to delete <symbol>; all other <use> elements that referenced <symbol> should // auto-magically reference <g>. symbol->deleteObject(true); group->setAttribute("id",id.c_str()); // After we delete symbol with same id. parent->getRepr()->appendChild(group); - //use->deleteObject(true); SPItem *group_item = static_cast<SPItem *>(sp_desktop_document(desktop)->getObjectByRepr(group)); Inkscape::GC::release(group); diff --git a/src/selection-describer.cpp b/src/selection-describer.cpp index 968a8bd22..72467c187 100644 --- a/src/selection-describer.cpp +++ b/src/selection-describer.cpp @@ -38,8 +38,9 @@ #include "sp-spiral.h" static const gchar * -type2term(GType type) +type2term(SPItem *item) { + GType type = G_OBJECT_TYPE( item ); if (type == SP_TYPE_ANCHOR) //TRANSLATORS: "Link" means internet link (anchor) { return C_("Web", "Link"); } @@ -68,6 +69,8 @@ type2term(GType type) if (type == SP_TYPE_TEXT) { return C_("Object", "Text"); } if (type == SP_TYPE_USE) + if (SP_IS_SYMBOL(item->firstChild())) + { return C_("Object", "Symbol"); } // TRANSLATORS: "Clone" is a noun, type of object { return C_("Object", "Clone"); } if (type == SP_TYPE_ARC) @@ -85,7 +88,7 @@ static GSList *collect_terms (GSList *items) { GSList *r = NULL; for (GSList *i = items; i != NULL; i = i->next) { - const gchar *term = type2term (G_OBJECT_TYPE(i->data)); + const gchar *term = type2term ( SP_ITEM(i->data) ); if (term != NULL && g_slist_find (r, term) == NULL) r = g_slist_prepend (r, (void *) term); } @@ -148,6 +151,8 @@ void SelectionDescriber::_updateMessageFromSelection(Inkscape::Selection *select gchar *layer_name; if (layer == root) { layer_name = g_strdup(_("root")); + } else if(!layer) { + layer_name = g_strdup(_("none")); } else { char const *layer_label; bool is_label = false; @@ -180,6 +185,8 @@ void SelectionDescriber::_updateMessageFromSelection(Inkscape::Selection *select if (num_parents == 1) { if (layer == parent) in_phrase = g_strdup_printf(_(" in %s"), layer_name); + else if (!layer) + in_phrase = g_strdup_printf(_(" hidden in definitions")); else in_phrase = g_strdup_printf(_(" in group %s (%s)"), parent_name, layer_name); } else { @@ -197,6 +204,10 @@ void SelectionDescriber::_updateMessageFromSelection(Inkscape::Selection *select _context.setF(Inkscape::NORMAL_MESSAGE, "%s%s. %s. %s.", item_desc, in_phrase, _("Convert symbol to group to edit"), _when_selected); + } else if (SP_IS_SYMBOL(item)) { + _context.setF(Inkscape::NORMAL_MESSAGE, "%s%s. %s.", + item_desc, in_phrase, + _("Remove from symbols tray to edit symbol")); } else if (SP_IS_USE(item) || (SP_IS_OFFSET(item) && SP_OFFSET(item)->sourceHref)) { _context.setF(Inkscape::NORMAL_MESSAGE, "%s%s. %s. %s.", item_desc, in_phrase, diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp index 3ba1ecd5f..a2eda6625 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -324,7 +324,10 @@ sp_item_group_ungroup (SPGroup *group, GSList **children, bool do_done) SPItem *gitem = group; Inkscape::XML::Node *grepr = gitem->getRepr(); - g_return_if_fail (!strcmp (grepr->name(), "svg:g") || !strcmp (grepr->name(), "svg:a") || !strcmp (grepr->name(), "svg:switch")); + g_return_if_fail (!strcmp (grepr->name(), "svg:g") + || !strcmp (grepr->name(), "svg:a") + || !strcmp (grepr->name(), "svg:switch") + || !strcmp (grepr->name(), "svg:svg")); // this converts the gradient/pattern fill/stroke on the group, if any, to userSpaceOnUse gitem->adjust_paint_recursive (Geom::identity(), Geom::identity(), false); diff --git a/src/sp-item.cpp b/src/sp-item.cpp index 19d71ed44..a4070c9b3 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -646,7 +646,7 @@ sp_item_update(SPObject *object, SPCtx *ctx, guint flags) /* Update bounding box data used by filters */ if (item->style->filter.set && item->display) { - Geom::OptRect item_bbox = item->geometricBounds(); + Geom::OptRect item_bbox = item->visualBounds(); SPItemView *itemview = item->display; do { @@ -1089,6 +1089,9 @@ Inkscape::DrawingItem *SPItem::invoke_show(Inkscape::Drawing &drawing, unsigned sp_mask_set_bbox(SP_MASK(mask), mask_key, item_bbox); mask->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); } + if (style->filter.set && display) { + item_bbox = visualBounds(); + } ai->setData(this); ai->setItemBounds(item_bbox); } diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp index be9f5388c..38ffbb20c 100644 --- a/src/sp-shape.cpp +++ b/src/sp-shape.cpp @@ -868,6 +868,13 @@ int SPShape::hasMarkers() const all three settings. This should be fixed later such that if 'marker' is specified, then all three should appear. */ + // Ignore markers for objects which are inside markers themselves. + for (SPObject *parent = this->parent; parent != NULL; parent = parent->parent) { + if(SP_IS_MARKER(parent)) { + return 0; + } + } + return ( this->_curve && (this->_marker[SP_MARKER_LOC] || diff --git a/src/sp-string.cpp b/src/sp-string.cpp index 2fe84ac6a..457c248bc 100644 --- a/src/sp-string.cpp +++ b/src/sp-string.cpp @@ -132,10 +132,10 @@ sp_string_update(SPObject *object, SPCtx *ctx, unsigned flags) if (((SPObjectClass *) sp_string_parent_class)->update) ((SPObjectClass *) sp_string_parent_class)->update(object, ctx, flags); - if (flags & (SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_MODIFIED_FLAG)) { - /* Parent style or we ourselves changed, so recalculate */ - flags &= ~SP_OBJECT_USER_MODIFIED_FLAG_B; // won't be "just a transformation" anymore, we're going to recompute "x" and "y" attributes - } + // if (flags & (SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_MODIFIED_FLAG)) { + // /* Parent style or we ourselves changed, so recalculate */ + // flags &= ~SP_OBJECT_USER_MODIFIED_FLAG_B; // won't be "just a transformation" anymore, we're going to recompute "x" and "y" attributes + // } } diff --git a/src/sp-symbol.cpp b/src/sp-symbol.cpp index 989a5b7f3..a56de2e5a 100644 --- a/src/sp-symbol.cpp +++ b/src/sp-symbol.cpp @@ -371,6 +371,8 @@ static Geom::OptRect sp_symbol_bbox(SPItem const *item, Geom::Affine const &tran SPSymbol const *symbol = SP_SYMBOL(item); Geom::OptRect bbox; + // We don't need a bounding box for Symbols dialog when selecting + // symbols. They have no canvas location. But cloned symbols are. if (symbol->cloned) { // Cloned <symbol> is actually renderable @@ -378,11 +380,6 @@ static Geom::OptRect sp_symbol_bbox(SPItem const *item, Geom::Affine const &tran Geom::Affine const a( symbol->c2p * transform ); bbox = ((SPItemClass *) (sp_symbol_parent_class))->bbox(item, a, type); } - } else { - // Need bounding box for Symbols dialog - - Geom::Affine const a; - bbox = ((SPItemClass *) (sp_symbol_parent_class))->bbox(item, a, type); } return bbox; } diff --git a/src/trace/siox.cpp b/src/trace/siox.cpp index 1a1426b83..8c9130412 100644 --- a/src/trace/siox.cpp +++ b/src/trace/siox.cpp @@ -2,18 +2,8 @@ Copyright 2005, 2006 by Gerald Friedland, Kristian Jantz and Lars Knipping Conversion to C++ for Inkscape by Bob Jamison - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + + Released under GNU GPL, read the file 'COPYING' for more information */ #include "siox.h" diff --git a/src/trace/siox.h b/src/trace/siox.h index 9a44ce1cf..fa18ac238 100644 --- a/src/trace/siox.h +++ b/src/trace/siox.h @@ -5,17 +5,7 @@ * * Conversion to C++ for Inkscape by Bob Jamison * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Released under GNU GPL, read the file 'COPYING' for more information */ /* diff --git a/src/ui/dialog/aboutbox.cpp b/src/ui/dialog/aboutbox.cpp index ba9670d86..6f1137e46 100644 --- a/src/ui/dialog/aboutbox.cpp +++ b/src/ui/dialog/aboutbox.cpp @@ -359,7 +359,7 @@ void AboutBox::initStrings() { "Nick\n" "Andreas Nilsson\n" "Mitsuru Oka\n" -"Marten Owens\n" +"Martin Owens\n" "Alvin Penner\n" "Jon Phillips\n" "Zdenko Podobny\n" diff --git a/src/ui/dialog/aboutbox.h b/src/ui/dialog/aboutbox.h index 622b1324f..7b3308672 100644 --- a/src/ui/dialog/aboutbox.h +++ b/src/ui/dialog/aboutbox.h @@ -15,6 +15,14 @@ #ifndef INKSCAPE_UI_DIALOG_ABOUTBOX_H #define INKSCAPE_UI_DIALOG_ABOUTBOX_H +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/dialog.h> namespace Inkscape { diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp index dbd06d9e8..7f88824f7 100644 --- a/src/ui/dialog/align-and-distribute.cpp +++ b/src/ui/dialog/align-and-distribute.cpp @@ -195,7 +195,7 @@ void ActionAlign::do_action(SPDesktop *desktop, int index) { //Move each item in the selected list separately for (std::list<SPItem *>::iterator it(selected.begin()); it != selected.end(); - it++) + ++it) { sp_desktop_document (desktop)->ensureUpToDate(); if (!sel_as_group) @@ -347,7 +347,7 @@ private : float pos = sorted.front().bbox.min()[_orientation]; for ( std::vector<BBoxSort> ::iterator it (sorted.begin()); it < sorted.end(); - it ++ ) + ++it ) { if (!Geom::are_near(pos, it->bbox.min()[_orientation], 1e-6)) { Geom::Point t(0.0, 0.0); diff --git a/src/ui/dialog/calligraphic-profile-rename.h b/src/ui/dialog/calligraphic-profile-rename.h index 4ef71900b..3256338eb 100644 --- a/src/ui/dialog/calligraphic-profile-rename.h +++ b/src/ui/dialog/calligraphic-profile-rename.h @@ -15,6 +15,10 @@ # include "config.h" #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/dialog.h> #include <gtkmm/entry.h> #include <gtkmm/label.h> diff --git a/src/ui/dialog/color-item.cpp b/src/ui/dialog/color-item.cpp index e09d9b1d1..2292b66fc 100644 --- a/src/ui/dialog/color-item.cpp +++ b/src/ui/dialog/color-item.cpp @@ -11,7 +11,16 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include <errno.h> + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/label.h> #include <glibmm/i18n.h> #include <cairo.h> diff --git a/src/ui/dialog/debug.cpp b/src/ui/dialog/debug.cpp index d127261c0..9e2287f80 100644 --- a/src/ui/dialog/debug.cpp +++ b/src/ui/dialog/debug.cpp @@ -13,6 +13,10 @@ # include <config.h> #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <gtkmm/dialog.h> #include <gtkmm/textview.h> diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp index fe15a4e86..a851503fe 100644 --- a/src/ui/dialog/export.cpp +++ b/src/ui/dialog/export.cpp @@ -20,6 +20,10 @@ // This has to be included prior to anything that includes setjmp.h, it croaks otherwise #include <png.h> +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <gtkmm/buttonbox.h> #include <gtkmm/dialog.h> diff --git a/src/ui/dialog/filedialogimpl-gtkmm.h b/src/ui/dialog/filedialogimpl-gtkmm.h index 7501b5e14..6687915d7 100644 --- a/src/ui/dialog/filedialogimpl-gtkmm.h +++ b/src/ui/dialog/filedialogimpl-gtkmm.h @@ -17,6 +17,14 @@ #ifndef __FILE_DIALOGIMPL_H__ #define __FILE_DIALOGIMPL_H__ +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + //Gtk includes #include <gtkmm/filechooserdialog.h> #include <glib/gstdio.h> diff --git a/src/ui/dialog/filedialogimpl-win32.h b/src/ui/dialog/filedialogimpl-win32.h index 0839be8a8..2e6bb4bb8 100644 --- a/src/ui/dialog/filedialogimpl-win32.h +++ b/src/ui/dialog/filedialogimpl-win32.h @@ -15,8 +15,11 @@ #ifdef WIN32 #if WITH_GLIBMM_2_32 +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H # include <glibmm/threads.h> #endif + +#endif #include "gc-core.h" #include <windows.h> #include "filedialogimpl-gtkmm.h" diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index 4c289d54e..4401d5658 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -1155,7 +1155,13 @@ FilterEffectsDialog::FilterModifier::FilterModifier(FilterEffectsDialog& d) sw->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); _list.get_column(1)->set_resizable(true); - + _list.set_reorderable(true); + + // We can track the drag/drop reordering from the row_delete (occurs after + // row_inserted and may occur many times when adding a new item) + _model->signal_row_deleted().connect( + sigc::mem_fun(*this, &FilterModifier::on_filter_reorder)); + sw->set_shadow_type(Gtk::SHADOW_IN); show_all_children(); _add.signal_clicked().connect(sigc::mem_fun(*this, &FilterModifier::add_filter)); @@ -1301,6 +1307,13 @@ void FilterEffectsDialog::FilterModifier::on_name_edited(const Glib::ustring& pa } } +void FilterEffectsDialog::FilterModifier::on_filter_reorder(const Gtk::TreeModel::Path& path) { + for(Gtk::TreeModel::iterator i = _model->children().begin(); i != _model->children().end(); ++i) { + SPObject* object = (*i)[_columns.filter]; + object->getRepr()->setPosition(0); + } +} + void FilterEffectsDialog::FilterModifier::on_selection_toggled(const Glib::ustring& path) { Gtk::TreeIter iter = _model->get_iter(path); diff --git a/src/ui/dialog/filter-effects-dialog.h b/src/ui/dialog/filter-effects-dialog.h index 658aac790..a2a2a3c6e 100644 --- a/src/ui/dialog/filter-effects-dialog.h +++ b/src/ui/dialog/filter-effects-dialog.h @@ -86,6 +86,7 @@ private: void on_filter_selection_changed(); void on_name_edited(const Glib::ustring&, const Glib::ustring&); + void on_filter_reorder(const Gtk::TreeModel::Path& path); void on_selection_toggled(const Glib::ustring&); void update_filters(); diff --git a/src/ui/dialog/floating-behavior.cpp b/src/ui/dialog/floating-behavior.cpp index d70c5f187..dd07f009a 100644 --- a/src/ui/dialog/floating-behavior.cpp +++ b/src/ui/dialog/floating-behavior.cpp @@ -10,6 +10,14 @@ * Released under GNU GPL. Read the file 'COPYING' for more information. */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/dialog.h> #include <gtkmm/stock.h> #include <glibmm/main.h> diff --git a/src/ui/dialog/font-substitution.cpp b/src/ui/dialog/font-substitution.cpp index 9fa94ca8f..bf9133086 100644 --- a/src/ui/dialog/font-substitution.cpp +++ b/src/ui/dialog/font-substitution.cpp @@ -10,6 +10,10 @@ # include <config.h> #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/messagedialog.h> #include <gtkmm/checkbutton.h> #include <gtkmm/scrolledwindow.h> diff --git a/src/ui/dialog/guides.h b/src/ui/dialog/guides.h index a15667152..422fed7fe 100644 --- a/src/ui/dialog/guides.h +++ b/src/ui/dialog/guides.h @@ -15,6 +15,10 @@ # include <config.h> #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/dialog.h> #if WITH_GTKMM_3_0 diff --git a/src/ui/dialog/icon-preview.cpp b/src/ui/dialog/icon-preview.cpp index 1a52410b8..468e85d36 100644 --- a/src/ui/dialog/icon-preview.cpp +++ b/src/ui/dialog/icon-preview.cpp @@ -17,6 +17,10 @@ # include <config.h> #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/buttonbox.h> #include <boost/scoped_ptr.hpp> diff --git a/src/ui/dialog/layer-properties.h b/src/ui/dialog/layer-properties.h index 0e2f8ed94..d38b8edf5 100644 --- a/src/ui/dialog/layer-properties.h +++ b/src/ui/dialog/layer-properties.h @@ -16,6 +16,10 @@ # include <config.h> #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/dialog.h> #include <gtkmm/entry.h> #include <gtkmm/label.h> diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index 5cc9578f1..ce923f6b4 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -404,13 +404,13 @@ void LayersPanel::_addLayer( SPDocument* doc, SPObject* layer, Gtk::TreeModel::R SPObject *child = _desktop->layer_manager->nthChildOf(layer, i); if ( child ) { #if DUMP_LAYERS - g_message(" %3d layer:%p {%s} [%s]", level, child, child->id, child->label() ); + g_message(" %3d layer:%p {%s} [%s]", level, child, child->getId(), child->label() ); #endif // DUMP_LAYERS Gtk::TreeModel::iterator iter = parentRow ? _store->prepend(parentRow->children()) : _store->prepend(); Gtk::TreeModel::Row row = *iter; row[_model->_colObject] = child; - row[_model->_colLabel] = child->label() ? child->label() : child->getId(); + row[_model->_colLabel] = child->defaultLabel(); row[_model->_colVisible] = SP_IS_ITEM(child) ? !SP_ITEM(child)->isHidden() : false; row[_model->_colLocked] = SP_IS_ITEM(child) ? SP_ITEM(child)->isLocked() : false; diff --git a/src/ui/dialog/layers.h b/src/ui/dialog/layers.h index e9fd9ebc6..ae0ac6040 100644 --- a/src/ui/dialog/layers.h +++ b/src/ui/dialog/layers.h @@ -12,6 +12,14 @@ #ifndef SEEN_LAYERS_PANEL_H #define SEEN_LAYERS_PANEL_H +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <gtkmm/treeview.h> #include <gtkmm/treestore.h> diff --git a/src/ui/dialog/livepatheffect-add.h b/src/ui/dialog/livepatheffect-add.h index 00f58b038..7fa766272 100644 --- a/src/ui/dialog/livepatheffect-add.h +++ b/src/ui/dialog/livepatheffect-add.h @@ -11,6 +11,14 @@ #ifndef INKSCAPE_DIALOG_LIVEPATHEFFECT_ADD_H #define INKSCAPE_DIALOG_LIVEPATHEFFECT_ADD_H +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/dialog.h> #include <gtkmm/liststore.h> #include <gtkmm/treeview.h> diff --git a/src/ui/dialog/messages.h b/src/ui/dialog/messages.h index 6ed246ece..54ca84f47 100644 --- a/src/ui/dialog/messages.h +++ b/src/ui/dialog/messages.h @@ -16,6 +16,14 @@ #ifndef INKSCAPE_UI_DIALOG_MESSAGES_H #define INKSCAPE_UI_DIALOG_MESSAGES_H +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <gtkmm/textview.h> #include <gtkmm/button.h> diff --git a/src/ui/dialog/ocaldialogs.h b/src/ui/dialog/ocaldialogs.h index 8cb247766..e21030bcd 100644 --- a/src/ui/dialog/ocaldialogs.h +++ b/src/ui/dialog/ocaldialogs.h @@ -13,6 +13,14 @@ #ifndef __OCAL_DIALOG_H__ #define __OCAL_DIALOG_H__ +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + //Gtk includes #include <gtkmm/box.h> #include <gtkmm/eventbox.h> diff --git a/src/ui/dialog/spellcheck.h b/src/ui/dialog/spellcheck.h index ab75809f3..27b89e34e 100644 --- a/src/ui/dialog/spellcheck.h +++ b/src/ui/dialog/spellcheck.h @@ -12,6 +12,14 @@ #ifndef SEEN_SPELLCHECK_H #define SEEN_SPELLCHECK_H +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <gtkmm/button.h> #include <gtkmm/buttonbox.h> diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp index 103302f41..b71686a17 100644 --- a/src/ui/dialog/symbols.cpp +++ b/src/ui/dialog/symbols.cpp @@ -18,10 +18,15 @@ #include <functional> #include <sstream> +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/buttonbox.h> #include <gtkmm/label.h> #if WITH_GTKMM_3_0 +# include <gtkmm/togglebutton.h> # include <gtkmm/grid.h> #else # include <gtkmm/table.h> @@ -40,9 +45,11 @@ #include "ui/cache/svg_preview_cache.h" #include "ui/clipboard.h" +#include "ui/icon-names.h" #include "symbols.h" +#include "selection.h" #include "desktop.h" #include "desktop-handles.h" #include "document.h" @@ -51,6 +58,7 @@ #include "sp-use.h" #include "sp-defs.h" #include "sp-symbol.h" +#include "widgets/icon.h" #ifdef WITH_LIBVISIO #include <libvisio/libvisio.h> @@ -58,6 +66,7 @@ #endif #include "verbs.h" +#include "helper/action.h" #include "xml/repr.h" namespace Inkscape { @@ -96,8 +105,6 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : UI::Widget::Panel("", prefsPath, SP_VERB_DIALOG_SYMBOLS), store(Gtk::ListStore::create(*getColumns())), iconView(0), - previewScale(0), - previewSize(0), currentDesktop(0), deskTrack(), currentDocument(0), @@ -136,8 +143,8 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : table->attach(*Gtk::manage(symbolSet),1,2,row,row+1,Gtk::FILL|Gtk::EXPAND,Gtk::SHRINK); #endif - sigc::connection connSet = - symbolSet->signal_changed().connect(sigc::mem_fun(*this, &SymbolsDialog::rebuild)); + sigc::connection connSet = symbolSet->signal_changed().connect( + sigc::mem_fun(*this, &SymbolsDialog::rebuild)); instanceConns.push_back(connSet); ++row; @@ -148,7 +155,7 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : iconView = new Gtk::IconView(static_cast<Glib::RefPtr<Gtk::TreeModel> >(store)); //iconView->set_text_column( columns->symbol_id ); iconView->set_tooltip_column( 1 ); - iconView->set_pixbuf_column( columns->symbol_image ); + iconView->set_pixbuf_column( columns->symbol_image ); // Giving the iconview a small minimum size will help users understand // What the dialog does. iconView->set_size_request( 100, 200 ); @@ -157,11 +164,12 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : targets.push_back(Gtk::TargetEntry( "application/x-inkscape-paste")); iconView->enable_model_drag_source (targets, Gdk::BUTTON1_MASK, Gdk::ACTION_COPY); - iconView->signal_drag_data_get().connect(sigc::mem_fun(*this, &SymbolsDialog::iconDragDataGet)); + iconView->signal_drag_data_get().connect( + sigc::mem_fun(*this, &SymbolsDialog::iconDragDataGet)); sigc::connection connIconChanged; - connIconChanged = - iconView->signal_selection_changed().connect(sigc::mem_fun(*this, &SymbolsDialog::iconChanged)); + connIconChanged = iconView->signal_selection_changed().connect( + sigc::mem_fun(*this, &SymbolsDialog::iconChanged)); instanceConns.push_back(connIconChanged); Gtk::ScrolledWindow *scroller = new Gtk::ScrolledWindow(); @@ -178,63 +186,68 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : ++row; - /******************** Preview Scale ***********************/ - Gtk::Label* labelScale = new Gtk::Label(_("Preview scale: ")); + /******************** Tools *******************************/ + Gtk::Button* button; + Gtk::HBox* tools = new Gtk::HBox(); + //tools->set_layout( Gtk::BUTTONBOX_END ); #if WITH_GTKMM_3_0 - table->attach(*Gtk::manage(labelScale),0,row,1,1); + scroller->set_hexpand(); + table->attach(*Gtk::manage(tools),0,row,2,1); #else - table->attach(*Gtk::manage(labelScale),0,1,row,row+1,Gtk::SHRINK,Gtk::SHRINK); + table->attach(*Gtk::manage(tools),0,2,row,row+1,Gtk::EXPAND|Gtk::FILL,Gtk::FILL); #endif - previewScale = new Gtk::ComboBoxText(); - const gchar *scales[] = - {_("Fit"), _("Fit to width"), _("Fit to height"), "0.1", "0.2", "0.5", "1.0", "2.0", "5.0", NULL}; - for( int i = 0; scales[i]; ++i ) { - previewScale->append(scales[i]); - } - previewScale->set_active_text(scales[0]); + addSymbol = Gtk::manage(new Gtk::Button()); + addSymbol->add(*Gtk::manage(Glib::wrap( + sp_icon_new (Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_ICON("symbol-add")))) ); + addSymbol->set_tooltip_text(_("Add Symbol from the current document.")); + addSymbol->set_relief( Gtk::RELIEF_NONE ); + addSymbol->set_focus_on_click( false ); + addSymbol->signal_clicked().connect(sigc::mem_fun(*this, &SymbolsDialog::insertSymbol)); + tools->pack_start(* addSymbol, Gtk::PACK_SHRINK); + + removeSymbol = Gtk::manage(new Gtk::Button()); + removeSymbol->add(*Gtk::manage(Glib::wrap( + sp_icon_new (Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_ICON("symbol-remove")))) ); + removeSymbol->set_tooltip_text(_("Remove Symbol from the current document.")); + removeSymbol->set_relief( Gtk::RELIEF_NONE ); + removeSymbol->set_focus_on_click( false ); + removeSymbol->signal_clicked().connect(sigc::mem_fun(*this, &SymbolsDialog::revertSymbol)); + tools->pack_start(* removeSymbol, Gtk::PACK_SHRINK); + + Gtk::Label* spacer = Gtk::manage(new Gtk::Label("")); + tools->pack_start(* Gtk::manage(spacer)); + + in_sizes = 2; // Default 32px + button = Gtk::manage(new Gtk::Button()); + button->add(*Gtk::manage(Glib::wrap( + sp_icon_new (Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_ICON("symbol-bigger")))) ); + button->set_tooltip_text(_("Make Icons bigger by zooming in.")); + button->set_relief( Gtk::RELIEF_NONE ); + button->set_focus_on_click( false ); + button->signal_clicked().connect(sigc::mem_fun(*this, &SymbolsDialog::zoomin)); + tools->pack_start(* button, Gtk::PACK_SHRINK); + + button = Gtk::manage(new Gtk::Button()); + button->add(*Gtk::manage(Glib::wrap( + sp_icon_new (Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_ICON("symbol-smaller")))) ); + button->set_tooltip_text(_("Make Icons smaller by zooming out.")); + button->set_relief( Gtk::RELIEF_NONE ); + button->set_focus_on_click( false ); + button->signal_clicked().connect(sigc::mem_fun(*this, &SymbolsDialog::zoomout)); + tools->pack_start(* button, Gtk::PACK_SHRINK); + + fitSymbol = Gtk::manage(new Gtk::ToggleButton()); + fitSymbol->add(*Gtk::manage(Glib::wrap( + sp_icon_new (Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_ICON("symbol-fit")))) ); + fitSymbol->set_tooltip_text(_("Toggle 'fit' symbols in icon space.")); + fitSymbol->set_relief( Gtk::RELIEF_NONE ); + fitSymbol->set_focus_on_click( false ); + fitSymbol->set_active( true ); + fitSymbol->signal_clicked().connect(sigc::mem_fun(*this, &SymbolsDialog::rebuild)); + tools->pack_start(* fitSymbol, Gtk::PACK_SHRINK); -#if WITH_GTKMM_3_0 - previewScale->set_hexpand(); - table->attach(*Gtk::manage(previewScale),1,row,1,1); -#else - table->attach(*Gtk::manage(previewScale),1,2,row,row+1,Gtk::FILL|Gtk::EXPAND,Gtk::SHRINK); -#endif - - sigc::connection connScale = - previewScale->signal_changed().connect(sigc::mem_fun(*this, &SymbolsDialog::rebuild)); - instanceConns.push_back(connScale); - - ++row; - - /******************** Preview Size ************************/ - Gtk::Label* labelSize = new Gtk::Label(_("Preview size: ")); - -#if WITH_GTKMM_3_0 - table->attach(*Gtk::manage(labelSize),0,row,1,1); -#else - table->attach(*Gtk::manage(labelSize),0,1,row,row+1,Gtk::SHRINK,Gtk::SHRINK); -#endif - - previewSize = new Gtk::ComboBoxText(); - const gchar *sizes[] = {"16", "24", "32", "48", "64", NULL}; - for( int i = 0; sizes[i]; ++i ) { - previewSize->append(sizes[i]); - } - previewSize->set_active_text(sizes[2]); - -#if WITH_GTKMM_3_0 - previewSize->set_hexpand(); - table->attach(*Gtk::manage(previewSize),1,row,1,1); -#else - table->attach(*Gtk::manage(previewSize),1,2,row,row+1,Gtk::FILL|Gtk::EXPAND,Gtk::SHRINK); -#endif - - sigc::connection connSize = - previewSize->signal_changed().connect(sigc::mem_fun(*this, &SymbolsDialog::rebuild)); - instanceConns.push_back(connSize); - ++row; /**********************************************************/ @@ -253,6 +266,10 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : sigc::mem_fun(*this, &SymbolsDialog::defsModified)); instanceConns.push_back(defsModifiedConn); + sigc::connection selectionChangedConn = currentDesktop->selection->connectChanged( + sigc::mem_fun(*this, &SymbolsDialog::selectionChanged)); + instanceConns.push_back(selectionChangedConn); + get_symbols(); draw_symbols( currentDocument ); /* Defaults to current document */ @@ -277,6 +294,20 @@ SymbolsDialog& SymbolsDialog::getInstance() return *new SymbolsDialog(); } +void SymbolsDialog::zoomin() { + if(in_sizes < 4) { + in_sizes++; + rebuild(); + } +} + +void SymbolsDialog::zoomout() { + if(in_sizes > 0) { + in_sizes--; + rebuild(); + } +} + void SymbolsDialog::rebuild() { store->clear(); @@ -287,10 +318,27 @@ void SymbolsDialog::rebuild() { // Symbol must be from Current Document (this method of // checking should be language independent). symbolDocument = currentDocument; + addSymbol->set_sensitive( true ); + removeSymbol->set_sensitive( true ); + } else { + addSymbol->set_sensitive( false ); + removeSymbol->set_sensitive( false ); } draw_symbols( symbolDocument ); } +void SymbolsDialog::insertSymbol() { + Inkscape::Verb *verb = Inkscape::Verb::get( SP_VERB_EDIT_SYMBOL ); + SPAction *action = verb->get_action((Inkscape::UI::View::View *) this->currentDesktop); + sp_action_perform (action, NULL); +} + +void SymbolsDialog::revertSymbol() { + Inkscape::Verb *verb = Inkscape::Verb::get( SP_VERB_EDIT_UNSYMBOL ); + SPAction *action = verb->get_action((Inkscape::UI::View::View *) this->currentDesktop); + sp_action_perform (action, NULL); +} + void SymbolsDialog::iconDragDataGet(const Glib::RefPtr<Gdk::DragContext>& /*context*/, Gtk::SelectionData& data, guint /*info*/, guint /*time*/) { #if WITH_GTKMM_3_0 @@ -319,48 +367,68 @@ void SymbolsDialog::defsModified(SPObject * /*object*/, guint /*flags*/) } } -void SymbolsDialog::iconChanged() { -#if WITH_GTKMM_3_0 - std::vector<Gtk::TreePath> iconArray = iconView->get_selected_items(); -#else - Gtk::IconView::ArrayHandle_TreePaths iconArray = iconView->get_selected_items(); -#endif +void SymbolsDialog::selectionChanged(Inkscape::Selection *selection) { + Glib::ustring symbol_id = selectedSymbolId(); + SPDocument* symbolDocument = selectedSymbols(); + SPObject* symbol = symbolDocument->getObjectById(symbol_id); - if( iconArray.empty() ) { - //std::cout << " iconArray empty: huh? " << std::endl; - } else { + if(symbol && !selection->includes(symbol)) { + iconView->unselect_all(); + } +} + +SPDocument* SymbolsDialog::selectedSymbols() { + /* OK, we know symbol name... now we need to copy it to clipboard, bon chance! */ + Glib::ustring symbolSetString = symbolSet->get_active_text(); + + SPDocument* symbolDocument = symbolSets[symbolSetString]; + if( !symbolDocument ) { + // Symbol must be from Current Document (this method of checking should be language independent). + return currentDocument; + } + return symbolDocument; +} + +Glib::ustring SymbolsDialog::selectedSymbolId() { + #if WITH_GTKMM_3_0 + std::vector<Gtk::TreePath> iconArray = iconView->get_selected_items(); + #else + Gtk::IconView::ArrayHandle_TreePaths iconArray = iconView->get_selected_items(); + #endif + if( !iconArray.empty() ) { Gtk::TreeModel::Path const & path = *iconArray.begin(); Gtk::ListStore::iterator row = store->get_iter(path); - Glib::ustring symbol_id = (*row)[getColumns()->symbol_id]; + return (*row)[getColumns()->symbol_id]; + } + return Glib::ustring(""); +} - /* OK, we know symbol name... now we need to copy it to clipboard, bon chance! */ - Glib::ustring symbolSetString = symbolSet->get_active_text(); +void SymbolsDialog::iconChanged() { - SPDocument* symbolDocument = symbolSets[symbolSetString]; - if( !symbolDocument ) { - // Symbol must be from Current Document (this method of - // checking should be language independent). - symbolDocument = currentDocument; - } + Glib::ustring symbol_id = selectedSymbolId(); + SPDocument* symbolDocument = selectedSymbols(); + SPObject* symbol = symbolDocument->getObjectById(symbol_id); - SPObject* symbol = symbolDocument->getObjectById(symbol_id); - if( symbol ) { - - // Find style for use in <use> - // First look for default style stored in <symbol> - gchar const* style = symbol->getAttribute("inkscape:symbol-style"); - if( !style ) { - // If no default style in <symbol>, look in documents. - if( symbolDocument == currentDocument ) { - style = style_from_use( symbol_id.c_str(), currentDocument ); - } else { - style = symbolDocument->getReprRoot()->attribute("style"); - } - } + if( symbol ) { + if( symbolDocument == currentDocument ) { + // Select the symbol on the canvas so it can be manipulated + currentDesktop->selection->set( symbol, false ); + } - ClipboardManager *cm = ClipboardManager::get(); - cm->copySymbol(symbol->getRepr(), style); + // Find style for use in <use> + // First look for default style stored in <symbol> + gchar const* style = symbol->getAttribute("inkscape:symbol-style"); + if( !style ) { + // If no default style in <symbol>, look in documents. + if( symbolDocument == currentDocument ) { + style = style_from_use( symbol_id.c_str(), currentDocument ); + } else { + style = symbolDocument->getReprRoot()->attribute("style"); + } } + + ClipboardManager *cm = ClipboardManager::get(); + cm->copySymbol(symbol->getRepr(), style); } } @@ -485,6 +553,9 @@ void SymbolsDialog::get_symbols() { symbol_doc = SPDocument::createNewDoc( fullname, FALSE ); if( symbol_doc ) { gchar *title = symbol_doc->getRoot()->title(); + if( title == NULL ) { + title = _("Unnamed Symbols"); + } symbolSets[Glib::ustring(title)] = symbol_doc; symbolSet->append(title); } @@ -672,11 +743,7 @@ SymbolsDialog::create_symbol_image(gchar const *symbol_id, SPObject *symbol) SPItem *item = SP_ITEM(object_temp); - Glib::ustring previewSizeString = previewSize->get_active_text(); - unsigned psize = atol( previewSizeString.c_str() ); - - Glib::ustring previewScaleString = previewScale->get_active_text(); - int previewScaleRow = previewScale->get_active_row_number(); + unsigned psize = SYMBOL_ICON_SIZES[in_sizes]; /* Update to renderable state */ Glib::ustring key = svg_preview_cache.cache_key(previewDocument->getURI(), symbol_id, psize); @@ -707,21 +774,9 @@ SymbolsDialog::create_symbol_image(gchar const *symbol_id, SPObject *symbol) height = 1.0; } - switch (previewScaleRow) { - case 0: - /* Fit */ - scale = psize/std::max(width,height); - break; - case 1: - /* Fit width */ - scale = psize/width; - break; - case 2: - /* Fit height */ - scale = psize/height; - break; - default: - scale = atof( previewScaleString.c_str() ); + if( fitSymbol->get_active() ) { + /* Fit */ + scale = psize/std::max(width,height); } pixbuf = Glib::wrap(render_pixbuf(renderDrawing, scale, *dbox, psize)); diff --git a/src/ui/dialog/symbols.h b/src/ui/dialog/symbols.h index 352d24ec0..54b1a3ab0 100644 --- a/src/ui/dialog/symbols.h +++ b/src/ui/dialog/symbols.h @@ -48,6 +48,9 @@ class SymbolColumns; // For Gtk::ListStore * new symbols documents to be constructed and if saved in the prefs folder will * make those symbols available for all future documents. */ + +const int SYMBOL_ICON_SIZES[] = {16, 24, 32, 48, 64}; + class SymbolsDialog : public UI::Widget::Panel { public: @@ -62,8 +65,15 @@ private: static SymbolColumns *getColumns(); + void zoomin(); + void zoomout(); void rebuild(); + void insertSymbol(); + void revertSymbol(); void defsModified(SPObject *object, guint flags); + void selectionChanged(Inkscape::Selection *selection); + SPDocument* selectedSymbols(); + Glib::ustring selectedSymbolId(); void iconChanged(); void iconDragDataGet(const Glib::RefPtr<Gdk::DragContext>& context, Gtk::SelectionData& selection_data, guint info, guint time); @@ -84,12 +94,15 @@ private: /* Keep track of all symbol template documents */ std::map<Glib::ustring, SPDocument*> symbolSets; + // Index into sizes which is selected + int in_sizes; Glib::RefPtr<Gtk::ListStore> store; Gtk::ComboBoxText* symbolSet; Gtk::IconView* iconView; - Gtk::ComboBoxText* previewScale; - Gtk::ComboBoxText* previewSize; + Gtk::Button* addSymbol; + Gtk::Button* removeSymbol; + Gtk::ToggleButton* fitSymbol; void setTargetDesktop(SPDesktop *desktop); SPDesktop* currentDesktop; diff --git a/src/ui/dialog/text-edit.h b/src/ui/dialog/text-edit.h index 0e3ebafa7..8683d80a3 100644 --- a/src/ui/dialog/text-edit.h +++ b/src/ui/dialog/text-edit.h @@ -18,6 +18,14 @@ #ifndef INKSCAPE_UI_DIALOG_TEXT_EDIT_H #define INKSCAPE_UI_DIALOG_TEXT_EDIT_H +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <gtkmm/notebook.h> #include <gtkmm/button.h> diff --git a/src/ui/dialog/tile.h b/src/ui/dialog/tile.h index 86dbd25a9..6e41723fd 100644 --- a/src/ui/dialog/tile.h +++ b/src/ui/dialog/tile.h @@ -19,6 +19,10 @@ # include <config.h> #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <gtkmm/notebook.h> #include <gtkmm/checkbutton.h> diff --git a/src/ui/dialog/transformation.cpp b/src/ui/dialog/transformation.cpp index c071fcf95..ce8af3f1f 100644 --- a/src/ui/dialog/transformation.cpp +++ b/src/ui/dialog/transformation.cpp @@ -15,6 +15,10 @@ # include <config.h> #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/dialog.h> #include <gtkmm/stock.h> #include <2geom/transforms.h> @@ -27,6 +31,7 @@ #include "inkscape.h" #include "selection.h" #include "selection-chemistry.h" +#include "message-stack.h" #include "verbs.h" #include "preferences.h" #include "sp-namedview.h" @@ -758,7 +763,7 @@ void Transformation::applyPageMove(Inkscape::Selection *selection) double move = x; for ( std::vector<BBoxSort> ::iterator it (sorted.begin()); it < sorted.end(); - it ++ ) + ++it ) { sp_item_move_rel(it->item, Geom::Translate(move, 0)); // move each next object by x relative to previous @@ -782,7 +787,7 @@ void Transformation::applyPageMove(Inkscape::Selection *selection) double move = y; for ( std::vector<BBoxSort> ::iterator it (sorted.begin()); it < sorted.end(); - it ++ ) + ++it ) { sp_item_move_rel(it->item, Geom::Translate(0, move)); // move each next object by x relative to previous @@ -898,10 +903,21 @@ void Transformation::applyPageSkew(Inkscape::Selection *selection) if (!_units_skew.isAbsolute()) { // percentage double skewX = _scalar_skew_horizontal.getValue("%"); double skewY = _scalar_skew_vertical.getValue("%"); + if (fabs(0.01*skewX*0.01*skewY - 1.0) < Geom::EPSILON) { + sp_desktop_message_stack(getDesktop())->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, <b>not used</b>.")); + return; + } sp_item_skew_rel (item, 0.01*skewX, 0.01*skewY); } else if (_units_skew.isRadial()) { //deg or rad double angleX = _scalar_skew_horizontal.getValue("rad"); double angleY = _scalar_skew_vertical.getValue("rad"); + if ((fabs(angleX - angleY + M_PI/2) < Geom::EPSILON) + || (fabs(angleX - angleY - M_PI/2) < Geom::EPSILON) + || (fabs((angleX - angleY)/3 + M_PI/2) < Geom::EPSILON) + || (fabs((angleX - angleY)/3 - M_PI/2) < Geom::EPSILON)) { + sp_desktop_message_stack(getDesktop())->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, <b>not used</b>.")); + return; + } double skewX = tan(-angleX); double skewY = tan(angleY); sp_item_skew_rel (item, skewX, skewY); @@ -912,6 +928,10 @@ void Transformation::applyPageSkew(Inkscape::Selection *selection) if (bbox) { double width = bbox->dimensions()[Geom::X]; double height = bbox->dimensions()[Geom::Y]; + if (fabs(skewX*skewY - width*height) < Geom::EPSILON) { + sp_desktop_message_stack(getDesktop())->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, <b>not used</b>.")); + return; + } sp_item_skew_rel (item, skewX/height, skewY/width); } } @@ -927,16 +947,31 @@ void Transformation::applyPageSkew(Inkscape::Selection *selection) if (!_units_skew.isAbsolute()) { // percentage double skewX = _scalar_skew_horizontal.getValue("%"); double skewY = _scalar_skew_vertical.getValue("%"); + if (fabs(0.01*skewX*0.01*skewY - 1.0) < Geom::EPSILON) { + sp_desktop_message_stack(getDesktop())->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, <b>not used</b>.")); + return; + } sp_selection_skew_relative(selection, *center, 0.01*skewX, 0.01*skewY); } else if (_units_skew.isRadial()) { //deg or rad double angleX = _scalar_skew_horizontal.getValue("rad"); double angleY = _scalar_skew_vertical.getValue("rad"); + if ((fabs(angleX - angleY + M_PI/2) < Geom::EPSILON) + || (fabs(angleX - angleY - M_PI/2) < Geom::EPSILON) + || (fabs((angleX - angleY)/3 + M_PI/2) < Geom::EPSILON) + || (fabs((angleX - angleY)/3 - M_PI/2) < Geom::EPSILON)) { + sp_desktop_message_stack(getDesktop())->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, <b>not used</b>.")); + return; + } double skewX = tan(-angleX); double skewY = tan(angleY); sp_selection_skew_relative(selection, *center, skewX, skewY); } else { // absolute displacement double skewX = _scalar_skew_horizontal.getValue("px"); double skewY = _scalar_skew_vertical.getValue("px"); + if (fabs(skewX*skewY - width*height) < Geom::EPSILON) { + sp_desktop_message_stack(getDesktop())->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, <b>not used</b>.")); + return; + } sp_selection_skew_relative(selection, *center, skewX/height, skewY/width); } } @@ -957,6 +992,10 @@ void Transformation::applyPageTransform(Inkscape::Selection *selection) double f = _scalar_transform_f.getValue(); Geom::Affine displayed(a, b, c, d, e, f); + if (displayed.isSingular()) { + sp_desktop_message_stack(getDesktop())->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, <b>not used</b>.")); + return; + } if (_check_replace_matrix.get_active()) { for (GSList const *l = selection->itemList(); l != NULL; l = l->next) { diff --git a/src/ui/previewholder.h b/src/ui/previewholder.h index f6d1985cc..f9f923be4 100644 --- a/src/ui/previewholder.h +++ b/src/ui/previewholder.h @@ -16,6 +16,10 @@ # include "config.h" #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <gtkmm/bin.h> diff --git a/src/ui/tool/multi-path-manipulator.cpp b/src/ui/tool/multi-path-manipulator.cpp index 87b8e2635..6c3a0d282 100644 --- a/src/ui/tool/multi-path-manipulator.cpp +++ b/src/ui/tool/multi-path-manipulator.cpp @@ -224,10 +224,12 @@ void MultiPathManipulator::shiftSelection(int dir) SubpathList::iterator last_j; NodeList::iterator last_k; bool anything_found = false; + bool anynode_found = false; for (MapType::iterator i = _mmap.begin(); i != _mmap.end(); ++i) { SubpathList &sp = i->second->subpathList(); for (SubpathList::iterator j = sp.begin(); j != sp.end(); ++j) { + anynode_found = true; for (NodeList::iterator k = (*j)->begin(); k != (*j)->end(); ++k) { if (k->selected()) { last_i = i; @@ -249,10 +251,12 @@ void MultiPathManipulator::shiftSelection(int dir) if (!anything_found) { // select first / last node // this should never fail because there must be at least 1 non-empty manipulator - if (dir == 1) { + if (anynode_found) { + if (dir == 1) { _selection.insert((*_mmap.begin()->second->subpathList().begin())->begin().ptr()); - } else { + } else { _selection.insert((--(*--(--_mmap.end())->second->subpathList().end())->end()).ptr()); + } } return; } diff --git a/src/ui/widget/button.h b/src/ui/widget/button.h index efadfad07..a214dd881 100644 --- a/src/ui/widget/button.h +++ b/src/ui/widget/button.h @@ -10,6 +10,14 @@ #ifndef INKSCAPE_UI_WIDGET_BUTTON_H #define INKSCAPE_UI_WIDGET_BUTTON_H +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/checkbutton.h> #include <gtkmm/radiobutton.h> diff --git a/src/ui/widget/color-picker.h b/src/ui/widget/color-picker.h index e20212615..b4da5dbf2 100644 --- a/src/ui/widget/color-picker.h +++ b/src/ui/widget/color-picker.h @@ -13,7 +13,16 @@ #ifndef __COLOR_PICKER_H__ #define __COLOR_PICKER_H__ +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + #include <stddef.h> + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/dialog.h> #include <gtkmm/button.h> #include <sigc++/sigc++.h> diff --git a/src/ui/widget/color-preview.h b/src/ui/widget/color-preview.h index caddfb9a2..959b5e09b 100644 --- a/src/ui/widget/color-preview.h +++ b/src/ui/widget/color-preview.h @@ -15,6 +15,10 @@ # include <config.h> #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/widget.h> namespace Inkscape { diff --git a/src/ui/widget/dock-item.h b/src/ui/widget/dock-item.h index 608badb62..cc0c13eea 100644 --- a/src/ui/widget/dock-item.h +++ b/src/ui/widget/dock-item.h @@ -11,6 +11,14 @@ #ifndef INKSCAPE_UI_WIGET_DOCK_ITEM_H #define INKSCAPE_UI_WIGET_DOCK_ITEM_H +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <gtkmm/frame.h> #include <gtkmm/window.h> diff --git a/src/ui/widget/dock.h b/src/ui/widget/dock.h index 28ab42740..611c10f46 100644 --- a/src/ui/widget/dock.h +++ b/src/ui/widget/dock.h @@ -12,6 +12,14 @@ #ifndef INKSCAPE_UI_WIDGET_DOCK_H #define INKSCAPE_UI_WIDGET_DOCK_H +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <list> #include "ui/widget/dock-item.h" diff --git a/src/ui/widget/entity-entry.cpp b/src/ui/widget/entity-entry.cpp index c622796b2..0f526f77a 100644 --- a/src/ui/widget/entity-entry.cpp +++ b/src/ui/widget/entity-entry.cpp @@ -17,6 +17,10 @@ # include <config.h> #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/scrolledwindow.h> #include <gtkmm/entry.h> diff --git a/src/ui/widget/filter-effect-chooser.h b/src/ui/widget/filter-effect-chooser.h index ae3ec07c4..6f0c2f26e 100644 --- a/src/ui/widget/filter-effect-chooser.h +++ b/src/ui/widget/filter-effect-chooser.h @@ -12,6 +12,14 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <gtkmm/combobox.h> diff --git a/src/ui/widget/frame.h b/src/ui/widget/frame.h index a04666651..55638ad40 100644 --- a/src/ui/widget/frame.h +++ b/src/ui/widget/frame.h @@ -10,6 +10,14 @@ #ifndef INKSCAPE_UI_WIDGET_FRAME_H #define INKSCAPE_UI_WIDGET_FRAME_H +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/alignment.h> #include <gtkmm/frame.h> #include <gtkmm/label.h> diff --git a/src/ui/widget/imageicon.h b/src/ui/widget/imageicon.h index 2ea8b8533..8faf13cb1 100644 --- a/src/ui/widget/imageicon.h +++ b/src/ui/widget/imageicon.h @@ -12,6 +12,14 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <glibmm/ustring.h> diff --git a/src/ui/widget/imagetoggler.h b/src/ui/widget/imagetoggler.h index 7b02fa4dc..df6eb7ded 100644 --- a/src/ui/widget/imagetoggler.h +++ b/src/ui/widget/imagetoggler.h @@ -14,6 +14,10 @@ #include "config.h" #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/cellrendererpixbuf.h> #include <gtkmm/widget.h> #include <glibmm/property.h> diff --git a/src/ui/widget/labelled.h b/src/ui/widget/labelled.h index 88eb3ce19..5334454bc 100644 --- a/src/ui/widget/labelled.h +++ b/src/ui/widget/labelled.h @@ -11,6 +11,14 @@ #ifndef INKSCAPE_UI_WIDGET_LABELLED_H #define INKSCAPE_UI_WIDGET_LABELLED_H +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> namespace Gtk { diff --git a/src/ui/widget/licensor.h b/src/ui/widget/licensor.h index ab6abd0a4..0ac3e5ab8 100644 --- a/src/ui/widget/licensor.h +++ b/src/ui/widget/licensor.h @@ -10,6 +10,14 @@ #ifndef INKSCAPE_UI_WIDGET_LICENSOR_H #define INKSCAPE_UI_WIDGET_LICENSOR_H +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> class SPDocument; diff --git a/src/ui/widget/notebook-page.h b/src/ui/widget/notebook-page.h index d8b8fb0c4..38ae9e054 100644 --- a/src/ui/widget/notebook-page.h +++ b/src/ui/widget/notebook-page.h @@ -14,6 +14,10 @@ # include <config.h> #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> namespace Gtk { diff --git a/src/ui/widget/object-composite-settings.h b/src/ui/widget/object-composite-settings.h index bee9f09b9..19a6cb2a5 100644 --- a/src/ui/widget/object-composite-settings.h +++ b/src/ui/widget/object-composite-settings.h @@ -11,6 +11,14 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <gtkmm/alignment.h> #include <gtkmm/adjustment.h> diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp index 7eb114d0a..d60eeefe0 100644 --- a/src/ui/widget/panel.cpp +++ b/src/ui/widget/panel.cpp @@ -15,6 +15,10 @@ # include <config.h> #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/dialog.h> // for Gtk::RESPONSE_* #include <gtkmm/menu.h> #include <gtkmm/stock.h> diff --git a/src/ui/widget/panel.h b/src/ui/widget/panel.h index 5bb054577..0c3d822b8 100644 --- a/src/ui/widget/panel.h +++ b/src/ui/widget/panel.h @@ -17,6 +17,10 @@ # include <config.h> #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <gtkmm/arrow.h> #include <gtkmm/button.h> diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index d32de6871..567f29f91 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -18,6 +18,10 @@ #include <windows.h> #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <gtkmm/frame.h> #include <gtkmm/alignment.h> diff --git a/src/ui/widget/preferences-widget.h b/src/ui/widget/preferences-widget.h index e3968045d..cb4ce17d1 100644 --- a/src/ui/widget/preferences-widget.h +++ b/src/ui/widget/preferences-widget.h @@ -15,8 +15,17 @@ #ifndef INKSCAPE_UI_WIDGET_INKSCAPE_PREFERENCES_H #define INKSCAPE_UI_WIDGET_INKSCAPE_PREFERENCES_H +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + #include <iostream> #include <vector> + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/filechooserbutton.h> #include "ui/widget/spinbutton.h" #include <stddef.h> diff --git a/src/ui/widget/rotateable.cpp b/src/ui/widget/rotateable.cpp index 1d91515e5..18d53bf5c 100644 --- a/src/ui/widget/rotateable.cpp +++ b/src/ui/widget/rotateable.cpp @@ -7,6 +7,14 @@ * Released under GNU GPL. Read the file 'COPYING' for more information. */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <gtkmm/eventbox.h> #include <glibmm/i18n.h> diff --git a/src/ui/widget/selected-style.h b/src/ui/widget/selected-style.h index 9b78cb17f..e5bc4f883 100644 --- a/src/ui/widget/selected-style.h +++ b/src/ui/widget/selected-style.h @@ -15,6 +15,10 @@ # include "config.h" #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #if WITH_GTKMM_3_0 diff --git a/src/ui/widget/spin-scale.cpp b/src/ui/widget/spin-scale.cpp index 548e9a6a6..ade3d1e60 100644 --- a/src/ui/widget/spin-scale.cpp +++ b/src/ui/widget/spin-scale.cpp @@ -6,11 +6,12 @@ * Released under GNU GPL. Read the file 'COPYING' for more information. */ +#include "spin-scale.h" + #include <gtkmm/adjustment.h> #include <glibmm/i18n.h> #include <glibmm/stringutils.h> -#include "spin-scale.h" #include "ui/widget/gimpspinscale.h" namespace Inkscape { diff --git a/src/ui/widget/spin-scale.h b/src/ui/widget/spin-scale.h index a8403307f..5fec8b1d8 100644 --- a/src/ui/widget/spin-scale.h +++ b/src/ui/widget/spin-scale.h @@ -9,6 +9,14 @@ #ifndef INKSCAPE_UI_WIDGET_SPIN_SCALE_H #define INKSCAPE_UI_WIDGET_SPIN_SCALE_H +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/adjustment.h> #include <gtkmm/box.h> #include <gtkmm/scale.h> diff --git a/src/ui/widget/spin-slider.h b/src/ui/widget/spin-slider.h index 8a45299e5..5f86fd15a 100644 --- a/src/ui/widget/spin-slider.h +++ b/src/ui/widget/spin-slider.h @@ -10,6 +10,14 @@ #ifndef INKSCAPE_UI_WIDGET_SPIN_SLIDER_H #define INKSCAPE_UI_WIDGET_SPIN_SLIDER_H +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/adjustment.h> #include <gtkmm/box.h> #include <gtkmm/scale.h> diff --git a/src/ui/widget/spinbutton.h b/src/ui/widget/spinbutton.h index 57c48369e..fe5d699e7 100644 --- a/src/ui/widget/spinbutton.h +++ b/src/ui/widget/spinbutton.h @@ -10,6 +10,14 @@ #ifndef INKSCAPE_UI_WIDGET_SPINBUTTON_H #define INKSCAPE_UI_WIDGET_SPINBUTTON_H +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/spinbutton.h> namespace Inkscape { diff --git a/src/ui/widget/style-swatch.h b/src/ui/widget/style-swatch.h index d7bab3732..6bdb5e248 100644 --- a/src/ui/widget/style-swatch.h +++ b/src/ui/widget/style-swatch.h @@ -17,6 +17,10 @@ # include "config.h" #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <gtkmm/label.h> #include <gtkmm/eventbox.h> diff --git a/src/ui/widget/tolerance-slider.cpp b/src/ui/widget/tolerance-slider.cpp index f92a08d0a..d166e3831 100644 --- a/src/ui/widget/tolerance-slider.cpp +++ b/src/ui/widget/tolerance-slider.cpp @@ -12,6 +12,10 @@ # include <config.h> #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/adjustment.h> #include <gtkmm/box.h> #include <gtkmm/label.h> diff --git a/src/ui/widget/unit-menu.h b/src/ui/widget/unit-menu.h index 142b11186..3104d5aef 100644 --- a/src/ui/widget/unit-menu.h +++ b/src/ui/widget/unit-menu.h @@ -10,6 +10,14 @@ #ifndef INKSCAPE_UI_WIDGET_UNIT_H #define INKSCAPE_UI_WIDGET_UNIT_H +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/comboboxtext.h> #include "util/units.h" diff --git a/src/unicoderange.cpp b/src/unicoderange.cpp index dcf461214..67239d0d2 100644 --- a/src/unicoderange.cpp +++ b/src/unicoderange.cpp @@ -37,8 +37,10 @@ int UnicodeRange::add_range(gchar* val){ Urange r; int i=0, count=0; - while(val[i]!='\0' && val[i]!='-' && val[i]!=' ' && val[i]!=',') i++; - r.start = (gchar*) malloc((i+1)*sizeof(gchar*)); + while(val[i]!='\0' && val[i]!='-' && val[i]!=' ' && val[i]!=','){ + i++; + } + r.start = (gchar*) malloc((i+1)*sizeof(gchar*)); strncpy(r.start, val, i); r.start[i] = '\0'; val+=i; @@ -50,7 +52,7 @@ UnicodeRange::add_range(gchar* val){ r.end = (gchar*) malloc((i+1)*sizeof(gchar*)); strncpy(r.end, val, i); r.end[i] = '\0'; - val+=i; + // val+=i; count+=i; } else { r.end=NULL; diff --git a/src/verbs.cpp b/src/verbs.cpp index ec7cad8dd..3fdb97365 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -32,6 +32,10 @@ #include <cstring> #include <string> +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/filechooserdialog.h> #include <gtkmm/messagedialog.h> #include <gtkmm/stock.h> @@ -43,6 +47,7 @@ #include "document.h" #include "draw-context.h" #include "extension/effect.h" +#include "event-context.h" #include "file.h" #include "gradient-drag.h" #include "helper/action.h" @@ -1556,7 +1561,7 @@ void ContextVerb::perform(SPAction *action, void *data) tools_switch(dt, TOOLS_MEASURE); break; case SP_VERB_CONTEXT_DROPPER: - tools_switch(dt, TOOLS_DROPPER); + sp_toggle_dropper(dt); // Functionality defined in event-context.cpp break; case SP_VERB_CONTEXT_CONNECTOR: tools_switch(dt, TOOLS_CONNECTOR); diff --git a/src/widgets/dash-selector.h b/src/widgets/dash-selector.h index 0a572f4de..faa667ac7 100644 --- a/src/widgets/dash-selector.h +++ b/src/widgets/dash-selector.h @@ -10,6 +10,14 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <gtkmm/combobox.h> #include <gtkmm/liststore.h> diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index 6c62a8f0d..814298041 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -55,7 +55,6 @@ #include "ui/widget/dock.h" #include "ui/widget/layer-selector.h" #include "ui/widget/selected-style.h" -#include "ui/widget/gimpspinscale.h" #include "ui/uxmanager.h" #include "util/ege-appear-time-tracker.h" #include "sp-root.h" @@ -628,14 +627,7 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) gtk_box_pack_end (GTK_BOX (dtw->statusbar), statusbar_tail, FALSE, FALSE, 0); // zoom status spinbutton -#if WITH_GTKMM_3_0 - Glib::RefPtr<Gtk::Adjustment> _adjustment = Gtk::Adjustment::create(100.0, log(SP_DESKTOP_ZOOM_MIN)/log(2), log(SP_DESKTOP_ZOOM_MAX)/log(2), 0.1, 1.0); -#else - Gtk::Adjustment *_adjustment = new Gtk::Adjustment(100.0, log(SP_DESKTOP_ZOOM_MIN)/log(2), log(SP_DESKTOP_ZOOM_MAX)/log(2), 0.1, 1.0); -#endif - dtw->zoom_status = gimp_spin_scale_new (_adjustment->gobj(), _("Zoom"), 1); - - //dtw->zoom_status = gtk_spin_button_new_with_range (log(SP_DESKTOP_ZOOM_MIN)/log(2), log(SP_DESKTOP_ZOOM_MAX)/log(2), 0.1); + dtw->zoom_status = gtk_spin_button_new_with_range (log(SP_DESKTOP_ZOOM_MIN)/log(2), log(SP_DESKTOP_ZOOM_MAX)/log(2), 0.1); gtk_widget_set_tooltip_text (dtw->zoom_status, _("Zoom")); gtk_widget_set_size_request (dtw->zoom_status, STATUS_ZOOM_WIDTH, -1); gtk_entry_set_width_chars (GTK_ENTRY (dtw->zoom_status), 6); @@ -696,18 +688,18 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) dtw->coord_status_y = gtk_label_new(NULL); gtk_label_set_markup( GTK_LABEL(dtw->coord_status_y), "<tt> 0.00 </tt>" ); gtk_misc_set_alignment (GTK_MISC(dtw->coord_status_y), 1.0, 0.5); - //GtkWidget* label_z = gtk_label_new(_("Z:")); + GtkWidget* label_z = gtk_label_new(_("Z:")); #if GTK_CHECK_VERSION(3,0,0) gtk_grid_attach(GTK_GRID(dtw->coord_status), dtw->coord_status_x, 2, 0, 1, 1); gtk_grid_attach(GTK_GRID(dtw->coord_status), dtw->coord_status_y, 2, 1, 1, 1); - //gtk_grid_attach(GTK_GRID(dtw->coord_status), label_z, 3, 0, 1, 2); - gtk_grid_attach(GTK_GRID(dtw->coord_status), dtw->zoom_status, 3, 0, 1, 2); + gtk_grid_attach(GTK_GRID(dtw->coord_status), label_z, 3, 0, 1, 2); + gtk_grid_attach(GTK_GRID(dtw->coord_status), dtw->zoom_status, 4, 0, 1, 2); #else gtk_table_attach(GTK_TABLE(dtw->coord_status), dtw->coord_status_x, 2,3, 0,1, GTK_FILL, GTK_FILL, 0, 0); gtk_table_attach(GTK_TABLE(dtw->coord_status), dtw->coord_status_y, 2,3, 1,2, GTK_FILL, GTK_FILL, 0, 0); - //gtk_table_attach(GTK_TABLE(dtw->coord_status), label_z, 3,4, 0,2, GTK_FILL, GTK_FILL, 0, 0); - gtk_table_attach(GTK_TABLE(dtw->coord_status), dtw->zoom_status, 3,4, 0,2, GTK_FILL, GTK_FILL, 0, 0); + gtk_table_attach(GTK_TABLE(dtw->coord_status), label_z, 3,4, 0,2, GTK_FILL, GTK_FILL, 0, 0); + gtk_table_attach(GTK_TABLE(dtw->coord_status), dtw->zoom_status, 4,5, 0,2, GTK_FILL, GTK_FILL, 0, 0); #endif sp_set_font_size_smaller (dtw->coord_status); @@ -1893,6 +1885,67 @@ sp_dtw_zoom_value_changed (GtkSpinButton *spin, gpointer data) spinbutton_defocus (GTK_WIDGET(spin)); } + +static void +sp_dtw_zoom_10 (GtkMenuItem */*item*/, gpointer data) +{ + sp_dtw_zoom_menu_handler (static_cast<SPDesktop*>(data), 0.1); +} + +static void +sp_dtw_zoom_25 (GtkMenuItem */*item*/, gpointer data) +{ + sp_dtw_zoom_menu_handler (static_cast<SPDesktop*>(data), 0.25); +} + +static void +sp_dtw_zoom_50 (GtkMenuItem */*item*/, gpointer data) +{ + sp_dtw_zoom_menu_handler (static_cast<SPDesktop*>(data), 0.5); +} + +static void +sp_dtw_zoom_100 (GtkMenuItem */*item*/, gpointer data) +{ + sp_dtw_zoom_menu_handler (static_cast<SPDesktop*>(data), 1.0); +} + +static void +sp_dtw_zoom_200 (GtkMenuItem */*item*/, gpointer data) +{ + sp_dtw_zoom_menu_handler (static_cast<SPDesktop*>(data), 2.0); +} + +static void +sp_dtw_zoom_500 (GtkMenuItem */*item*/, gpointer data) +{ + sp_dtw_zoom_menu_handler (static_cast<SPDesktop*>(data), 5.0); +} + +static void +sp_dtw_zoom_1000 (GtkMenuItem */*item*/, gpointer data) +{ + sp_dtw_zoom_menu_handler (static_cast<SPDesktop*>(data), 10.0); +} + +static void +sp_dtw_zoom_page (GtkMenuItem */*item*/, gpointer data) +{ + static_cast<SPDesktop*>(data)->zoom_page(); +} + +static void +sp_dtw_zoom_drawing (GtkMenuItem */*item*/, gpointer data) +{ + static_cast<SPDesktop*>(data)->zoom_drawing(); +} + +static void +sp_dtw_zoom_selection (GtkMenuItem */*item*/, gpointer data) +{ + static_cast<SPDesktop*>(data)->zoom_selection(); +} + static void sp_dtw_zoom_populate_popup (GtkEntry */*entry*/, GtkMenu *menu, gpointer data) { @@ -1906,6 +1959,14 @@ sp_dtw_zoom_populate_popup (GtkEntry */*entry*/, GtkMenu *menu, gpointer data) } g_list_free (children); + item = gtk_menu_item_new_with_label ("1000%"); + g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (sp_dtw_zoom_1000), dt); + gtk_widget_show (item); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); + item = gtk_menu_item_new_with_label ("500%"); + g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (sp_dtw_zoom_500), dt); + gtk_widget_show (item); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); item = gtk_menu_item_new_with_label ("200%"); g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (sp_dtw_zoom_200), dt); gtk_widget_show (item); @@ -1918,6 +1979,15 @@ sp_dtw_zoom_populate_popup (GtkEntry */*entry*/, GtkMenu *menu, gpointer data) g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (sp_dtw_zoom_50), dt); gtk_widget_show (item); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); + item = gtk_menu_item_new_with_label ("25%"); + g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (sp_dtw_zoom_25), dt); + gtk_widget_show (item); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); + item = gtk_menu_item_new_with_label ("10%"); + g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (sp_dtw_zoom_10), dt); + gtk_widget_show (item); + + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); item = gtk_separator_menu_item_new (); gtk_widget_show (item); @@ -1944,41 +2014,6 @@ sp_dtw_zoom_menu_handler (SPDesktop *dt, gdouble factor) dt->zoom_absolute(d.midpoint()[Geom::X], d.midpoint()[Geom::Y], factor); } -static void -sp_dtw_zoom_50 (GtkMenuItem */*item*/, gpointer data) -{ - sp_dtw_zoom_menu_handler (static_cast<SPDesktop*>(data), 0.5); -} - -static void -sp_dtw_zoom_100 (GtkMenuItem */*item*/, gpointer data) -{ - sp_dtw_zoom_menu_handler (static_cast<SPDesktop*>(data), 1.0); -} - -static void -sp_dtw_zoom_200 (GtkMenuItem */*item*/, gpointer data) -{ - sp_dtw_zoom_menu_handler (static_cast<SPDesktop*>(data), 2.0); -} - -static void -sp_dtw_zoom_page (GtkMenuItem */*item*/, gpointer data) -{ - static_cast<SPDesktop*>(data)->zoom_page(); -} - -static void -sp_dtw_zoom_drawing (GtkMenuItem */*item*/, gpointer data) -{ - static_cast<SPDesktop*>(data)->zoom_drawing(); -} - -static void -sp_dtw_zoom_selection (GtkMenuItem */*item*/, gpointer data) -{ - static_cast<SPDesktop*>(data)->zoom_selection(); -} static void sp_dtw_sticky_zoom_toggled (GtkMenuItem *, gpointer data) diff --git a/src/widgets/desktop-widget.h b/src/widgets/desktop-widget.h index 9188838b3..9031ac854 100644 --- a/src/widgets/desktop-widget.h +++ b/src/widgets/desktop-widget.h @@ -12,6 +12,14 @@ * ? -2004 */ +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/window.h> #include "message.h" #include "ui/view/view-widget.h" diff --git a/src/widgets/fill-style.cpp b/src/widgets/fill-style.cpp index 60e115f54..d9d62d3ec 100644 --- a/src/widgets/fill-style.cpp +++ b/src/widgets/fill-style.cpp @@ -22,6 +22,10 @@ # include "config.h" #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <glibmm/i18n.h> diff --git a/src/widgets/gradient-selector.h b/src/widgets/gradient-selector.h index ea83ff819..c88666b06 100644 --- a/src/widgets/gradient-selector.h +++ b/src/widgets/gradient-selector.h @@ -15,6 +15,14 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <glib.h> #include <gtk/gtk.h> diff --git a/src/widgets/gradient-vector.h b/src/widgets/gradient-vector.h index 463d77912..64e40a35b 100644 --- a/src/widgets/gradient-vector.h +++ b/src/widgets/gradient-vector.h @@ -15,6 +15,14 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/liststore.h> #include <stddef.h> diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp index 977b1badf..50f092c43 100644 --- a/src/widgets/icon.cpp +++ b/src/widgets/icon.cpp @@ -16,6 +16,10 @@ # include "config.h" #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/icontheme.h> #include <cstring> #include <glib.h> @@ -864,6 +868,13 @@ GtkWidget *sp_icon_new( Inkscape::IconSize lsize, gchar const *name ) return IconImpl::newFull( lsize, name ); } +// PUBLIC CALL for when you REALLY need a pixbuf +GdkPixbuf *sp_pixbuf_new( Inkscape::IconSize lsize, gchar const *name ) +{ + int psize = IconImpl::getPhysSize(lsize); + return IconImpl::renderup(name, lsize, psize); +} + // PUBLIC CALL: Gtk::Widget *sp_icon_get_icon( Glib::ustring const &oid, Inkscape::IconSize size ) { diff --git a/src/widgets/icon.h b/src/widgets/icon.h index 6bce2e330..e1dae0d6a 100644 --- a/src/widgets/icon.h +++ b/src/widgets/icon.h @@ -14,6 +14,14 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/widget.h> #include "icon-size.h" @@ -45,7 +53,7 @@ struct SPIcon { GtkWidget *sp_icon_new( Inkscape::IconSize size, const gchar *name ); - +GdkPixbuf *sp_pixbuf_new( Inkscape::IconSize size, const gchar *name ); // Might return a wrapped SPIcon, or Gtk::Image Gtk::Widget *sp_icon_get_icon( const Glib::ustring &oid, Inkscape::IconSize size = Inkscape::ICON_SIZE_BUTTON ); diff --git a/src/widgets/paint-selector.cpp b/src/widgets/paint-selector.cpp index 08058d60d..40d2fb9f3 100644 --- a/src/widgets/paint-selector.cpp +++ b/src/widgets/paint-selector.cpp @@ -24,6 +24,9 @@ #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" diff --git a/src/widgets/shrink-wrap-button.cpp b/src/widgets/shrink-wrap-button.cpp index 941a0466c..3558780ed 100644 --- a/src/widgets/shrink-wrap-button.cpp +++ b/src/widgets/shrink-wrap-button.cpp @@ -13,6 +13,10 @@ #include "config.h" #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/button.h> #include <gtk/gtk.h> diff --git a/src/widgets/sp-attribute-widget.h b/src/widgets/sp-attribute-widget.h index d9b972201..4bd6c6959 100644 --- a/src/widgets/sp-attribute-widget.h +++ b/src/widgets/sp-attribute-widget.h @@ -19,6 +19,10 @@ # include "config.h" #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/widget.h> #include <stddef.h> #include <sigc++/connection.h> diff --git a/src/widgets/sp-color-icc-selector.cpp b/src/widgets/sp-color-icc-selector.cpp index 69677257d..53e73dd57 100644 --- a/src/widgets/sp-color-icc-selector.cpp +++ b/src/widgets/sp-color-icc-selector.cpp @@ -7,6 +7,7 @@ #include <gtk/gtk.h> #include <glibmm/i18n.h> #include <map> +#include <set> #include <vector> #include "../dialogs/dialog-events.h" @@ -73,9 +74,45 @@ static void sp_color_icc_selector_dispose(GObject *object); static void sp_color_icc_selector_show_all (GtkWidget *widget); static void sp_color_icc_selector_hide(GtkWidget *widget); - G_END_DECLS +/** + * Class containing the parts for a single color component's UI presence. + */ +class ComponentUI +{ +public: + ComponentUI() : + _component(), + _adj(0), + _slider(0), + _btn(0), + _label(0), + _map(0) + { + } + + ComponentUI(colorspace::Component const &component) : + _component(component), + _adj(0), + _slider(0), + _btn(0), + _label(0), + _map(0) + { + } + + colorspace::Component _component; + GtkAdjustment *_adj; // Component adjustment + GtkWidget *_slider; + GtkWidget *_btn; // spinbutton + GtkWidget *_label; // Label + guchar *_map; +}; + +/** + * Class that implements the internals of the selector. + */ class ColorICCSelectorImpl { public: @@ -109,13 +146,7 @@ public: GtkWidget* _fixupBtn; GtkWidget* _profileSel; - guint _fooCount; - std::vector<guint> _fooScales; - GtkAdjustment** _fooAdj; - GtkWidget** _fooSlider; - GtkWidget** _fooBtn; - GtkWidget** _fooLabel; - guchar** _fooMap; + std::vector<ComponentUI> _compUI; GtkAdjustment* _adj; // Channel adjustment GtkWidget* _slider; @@ -136,7 +167,67 @@ static SPColorSelectorClass *parent_class; #define XPAD 4 #define YPAD 1 -GType sp_color_icc_selector_get_type (void) +namespace +{ + +size_t maxColorspaceComponentCount = 0; + +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) + +/** + * Internal variable to track all known colorspaces. + */ +std::set<cmsUInt32Number> knownColorspaces; + +#endif + + +/** + * Simple helper to allow bitwise or on GtkAttachOptions. + */ +GtkAttachOptions operator|(GtkAttachOptions lhs, GtkAttachOptions rhs) +{ + return static_cast<GtkAttachOptions>(static_cast<int>(lhs) | static_cast<int>(rhs)); +} + +/** + * Helper function to handle GTK2/GTK3 attachment #ifdef code. + */ +void attachToGridOrTable(GtkWidget *parent, + GtkWidget *child, + guint left, + guint top, + guint width, + guint height, + bool hexpand = false, + bool centered = false, + guint xpadding = XPAD, + guint ypadding = YPAD) +{ +#if GTK_CHECK_VERSION(3,0,0) + gtk_widget_set_margin_left( child, xpadding ); + gtk_widget_set_margin_right( child, xpadding ); + gtk_widget_set_margin_top( child, ypadding ); + gtk_widget_set_margin_bottom( child, ypadding ); + if (hexpand) { + gtk_widget_set_hexpand(child, TRUE); + } + if (centered) { + gtk_widget_set_halign( child, GTK_ALIGN_CENTER ); + gtk_widget_set_valign( child, GTK_ALIGN_CENTER ); + } + gtk_grid_attach( GTK_GRID(parent), child, left, top, width, height ); +#else + GtkAttachOptions xoptions = centered ? static_cast<GtkAttachOptions>(0) : hexpand ? (GTK_EXPAND | GTK_FILL) : GTK_FILL; + GtkAttachOptions yoptions = centered ? static_cast<GtkAttachOptions>(0) : GTK_FILL; + + gtk_table_attach( GTK_TABLE(parent), child, left, left + width, top, top + height, xoptions, yoptions, xpadding, ypadding ); +#endif +} + +} // namespace + +GType sp_color_icc_selector_get_type(void) { static GType type = 0; if (!type) { @@ -181,7 +272,8 @@ static void sp_color_icc_selector_class_init(SPColorICCSelectorClass *klass) ColorICCSelector::ColorICCSelector( SPColorSelector* csel ) - : ColorSelector( csel ) + : ColorSelector( csel ), + _impl(NULL) { } @@ -223,6 +315,13 @@ static cmsUInt16Number* getScratch() { return scritch; } +colorspace::Component::Component() : + name(), + tip(), + scale(1) +{ +} + colorspace::Component::Component(std::string const &name, std::string const &tip, guint scale) : name(name), tip(tip), @@ -275,6 +374,12 @@ std::vector<colorspace::Component> colorspace::getColorSpaceInfo( uint32_t space sets[cmsSigCmyData].push_back(Component(_("_C:"), _("Cyan"), 1)); // TYPE_CMY_16 sets[cmsSigCmyData].push_back(Component(_("_M:"), _("Magenta"), 1)); sets[cmsSigCmyData].push_back(Component(_("_Y:"), _("Yellow"), 1)); + + for (std::map<cmsUInt32Number, std::vector<Component> >::iterator it = sets.begin(); it != sets.end(); ++it) + { + knownColorspaces.insert(it->first); + maxColorspaceComponentCount = std::max(maxColorspaceComponentCount, it->second.size()); + } } std::vector<Component> target; @@ -301,12 +406,7 @@ ColorICCSelectorImpl::ColorICCSelectorImpl(ColorICCSelector *owner) : _fixupNeeded(0), _fixupBtn(0), _profileSel(0), - _fooCount(4), - _fooAdj(new GtkAdjustment*[_fooCount]), - _fooSlider(new GtkWidget*[_fooCount]), - _fooBtn(new GtkWidget*[_fooCount]), - _fooLabel(new GtkWidget*[_fooCount]), - _fooMap(new guchar*[_fooCount]), + _compUI(), _adj(0), _slider(0), _sbtn(0), @@ -330,7 +430,8 @@ ColorICCSelectorImpl::~ColorICCSelectorImpl() void ColorICCSelector::init() { - _impl = new ColorICCSelectorImpl(this); + if (_impl) delete(_impl); + _impl = new ColorICCSelectorImpl(this); gint row = 0; _impl->_updating = FALSE; @@ -345,14 +446,7 @@ void ColorICCSelector::init() gtk_widget_show (t); gtk_box_pack_start (GTK_BOX (_csel), t, TRUE, TRUE, 4); -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) - //guint partCount = _cmsChannelsOf( icSigRgbData ); - std::vector<colorspace::Component> things = colorspace::getColorSpaceInfo( cmsSigRgbData ); - _impl->_fooScales.clear(); - for (std::vector<colorspace::Component>::iterator it = things.begin(); it != things.end(); ++it) { - _impl->_fooScales.push_back(it->scale); - } -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) + _impl->_compUI.clear(); // Create components row = 0; @@ -365,15 +459,7 @@ void ColorICCSelector::init() //gtk_misc_set_alignment( GTK_MISC (_impl->_fixupBtn), 1.0, 0.5 ); gtk_widget_show( _impl->_fixupBtn ); -#if GTK_CHECK_VERSION(3,0,0) - gtk_widget_set_margin_left(_impl->_fixupBtn, XPAD); - gtk_widget_set_margin_right(_impl->_fixupBtn, XPAD); - gtk_widget_set_margin_top(_impl->_fixupBtn, YPAD); - gtk_widget_set_margin_bottom(_impl->_fixupBtn, YPAD); - gtk_grid_attach(GTK_GRID(t), _impl->_fixupBtn, 0, row, 1, 1); -#else - gtk_table_attach( GTK_TABLE (t), _impl->_fixupBtn, 0, 1, row, row + 1, GTK_FILL, GTK_FILL, XPAD, YPAD ); -#endif + attachToGridOrTable(t, _impl->_fixupBtn, 0, row, 1, 1); // Combobox and store with 2 columns : label (0) and full name (1) GtkListStore *store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING); @@ -390,15 +476,7 @@ void ColorICCSelector::init() gtk_widget_show( _impl->_profileSel ); gtk_combo_box_set_active( GTK_COMBO_BOX(_impl->_profileSel), 0 ); -#if GTK_CHECK_VERSION(3,0,0) - gtk_widget_set_margin_left(_impl->_profileSel, XPAD); - gtk_widget_set_margin_right(_impl->_profileSel, XPAD); - gtk_widget_set_margin_top(_impl->_profileSel, YPAD); - gtk_widget_set_margin_bottom(_impl->_profileSel, YPAD); - gtk_grid_attach(GTK_GRID(t), _impl->_profileSel, 1, row, 1, 1); -#else - gtk_table_attach( GTK_TABLE(t), _impl->_profileSel, 1, 2, row, row + 1, GTK_FILL, GTK_FILL, XPAD, YPAD ); -#endif + attachToGridOrTable(t, _impl->_profileSel, 1, row, 1, 1); #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) _impl->_profChangedID = g_signal_connect( G_OBJECT(_impl->_profileSel), "changed", G_CALLBACK(ColorICCSelectorImpl::_profileSelected), (gpointer)_impl ); @@ -409,85 +487,72 @@ void ColorICCSelector::init() row++; - for ( guint i = 0; i < _impl->_fooCount; i++ ) { - // Label + // populate the data for colorspaces and channels: #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) - _impl->_fooLabel[i] = gtk_label_new_with_mnemonic( (i < things.size()) ? things[i].name.c_str() : "" ); -#else - _impl->_fooLabel[i] = gtk_label_new_with_mnemonic( "." ); + std::vector<colorspace::Component> things = colorspace::getColorSpaceInfo( cmsSigRgbData ); #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) - gtk_misc_set_alignment( GTK_MISC (_impl->_fooLabel[i]), 1.0, 0.5 ); - gtk_widget_show( _impl->_fooLabel[i] ); -#if GTK_CHECK_VERSION(3,0,0) - gtk_widget_set_margin_left(_impl->_fooLabel[i], XPAD); - gtk_widget_set_margin_right(_impl->_fooLabel[i], XPAD); - gtk_widget_set_margin_top(_impl->_fooLabel[i], YPAD); - gtk_widget_set_margin_bottom(_impl->_fooLabel[i], YPAD); - gtk_grid_attach(GTK_GRID(t), _impl->_fooLabel[i], 0, row, 1, 1); + for ( size_t i = 0; i < maxColorspaceComponentCount; i++ ) { +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) + if (i < things.size()) { + _impl->_compUI.push_back(ComponentUI(things[i])); + } else { + _impl->_compUI.push_back(ComponentUI()); + } + + std::string labelStr = (i < things.size()) ? things[i].name.c_str() : ""; #else - gtk_table_attach( GTK_TABLE (t), _impl->_fooLabel[i], 0, 1, row, row + 1, GTK_FILL, GTK_FILL, XPAD, YPAD ); + _impl->_compUI.push_back(ComponentUI()); + + std::string labelStr = "."; #endif + _impl->_compUI[i]._label = gtk_label_new_with_mnemonic( labelStr.c_str() ); + gtk_misc_set_alignment( GTK_MISC (_impl->_compUI[i]._label), 1.0, 0.5 ); + gtk_widget_show( _impl->_compUI[i]._label ); + + attachToGridOrTable(t, _impl->_compUI[i]._label, 0, row, 1, 1); + // Adjustment - guint scaleValue = (i < _impl->_fooScales.size()) ? _impl->_fooScales[i] : 1; + guint scaleValue = _impl->_compUI[i]._component.scale; gdouble step = static_cast<gdouble>(scaleValue) / 100.0; gdouble page = static_cast<gdouble>(scaleValue) / 10.0; gint digits = (step > 0.9) ? 0 : 2; - _impl->_fooAdj[i] = GTK_ADJUSTMENT( gtk_adjustment_new( 0.0, 0.0, scaleValue, step, page, page ) ); + _impl->_compUI[i]._adj = GTK_ADJUSTMENT( gtk_adjustment_new( 0.0, 0.0, scaleValue, step, page, page ) ); // Slider - _impl->_fooSlider[i] = sp_color_slider_new( _impl->_fooAdj[i] ); + _impl->_compUI[i]._slider = sp_color_slider_new( _impl->_compUI[i]._adj ); #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) - gtk_widget_set_tooltip_text( _impl->_fooSlider[i], (i < things.size()) ? things[i].tip.c_str() : "" ); + gtk_widget_set_tooltip_text( _impl->_compUI[i]._slider, (i < things.size()) ? things[i].tip.c_str() : "" ); #else - gtk_widget_set_tooltip_text( _impl->_fooSlider[i], "." ); + gtk_widget_set_tooltip_text( _impl->_compUI[i]._slider, "." ); #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) - gtk_widget_show( _impl->_fooSlider[i] ); + gtk_widget_show( _impl->_compUI[i]._slider ); -#if GTK_CHECK_VERSION(3,0,0) - gtk_widget_set_margin_left(_impl->_fooSlider[i], XPAD); - gtk_widget_set_margin_right(_impl->_fooSlider[i], XPAD); - gtk_widget_set_margin_top(_impl->_fooSlider[i], YPAD); - gtk_widget_set_margin_bottom(_impl->_fooSlider[i], YPAD); - gtk_widget_set_hexpand(_impl->_fooSlider[i], TRUE); - gtk_grid_attach(GTK_GRID(t), _impl->_fooSlider[i], 1, row, 1, 1); -#else - gtk_table_attach( GTK_TABLE (t), _impl->_fooSlider[i], 1, 2, row, row + 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), GTK_FILL, XPAD, YPAD ); -#endif + attachToGridOrTable(t, _impl->_compUI[i]._slider, 1, row, 1, 1, true); - _impl->_fooBtn[i] = gtk_spin_button_new( _impl->_fooAdj[i], step, digits ); + _impl->_compUI[i]._btn = gtk_spin_button_new( _impl->_compUI[i]._adj, step, digits ); #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) - gtk_widget_set_tooltip_text( _impl->_fooBtn[i], (i < things.size()) ? things[i].tip.c_str() : "" ); + gtk_widget_set_tooltip_text( _impl->_compUI[i]._btn, (i < things.size()) ? things[i].tip.c_str() : "" ); #else - gtk_widget_set_tooltip_text( _impl->_fooBtn[i], "." ); + gtk_widget_set_tooltip_text( _impl->_compUI[i]._btn, "." ); #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) - sp_dialog_defocus_on_enter( _impl->_fooBtn[i] ); - gtk_label_set_mnemonic_widget( GTK_LABEL(_impl->_fooLabel[i]), _impl->_fooBtn[i] ); - gtk_widget_show( _impl->_fooBtn[i] ); + sp_dialog_defocus_on_enter( _impl->_compUI[i]._btn ); + gtk_label_set_mnemonic_widget( GTK_LABEL(_impl->_compUI[i]._label), _impl->_compUI[i]._btn ); + gtk_widget_show( _impl->_compUI[i]._btn ); -#if GTK_CHECK_VERSION(3,0,0) - gtk_widget_set_margin_left(_impl->_fooBtn[i], XPAD); - gtk_widget_set_margin_right(_impl->_fooBtn[i], XPAD); - gtk_widget_set_margin_top(_impl->_fooBtn[i], YPAD); - gtk_widget_set_margin_bottom(_impl->_fooBtn[i], YPAD); - gtk_widget_set_halign(_impl->_fooBtn[i], GTK_ALIGN_CENTER); - gtk_widget_set_valign(_impl->_fooBtn[i], GTK_ALIGN_CENTER); - gtk_grid_attach(GTK_GRID(t), _impl->_fooBtn[i], 2, row, 1, 1); -#else - gtk_table_attach( GTK_TABLE (t), _impl->_fooBtn[i], 2, 3, row, row + 1, (GtkAttachOptions)0, (GtkAttachOptions)0, XPAD, YPAD ); -#endif + attachToGridOrTable(t, _impl->_compUI[i]._btn, 2, row, 1, 1, false, true); - _impl->_fooMap[i] = g_new( guchar, 4 * 1024 ); - memset( _impl->_fooMap[i], 0x0ff, 1024 * 4 ); + _impl->_compUI[i]._map = g_new( guchar, 4 * 1024 ); + memset( _impl->_compUI[i]._map, 0x0ff, 1024 * 4 ); // Signals - g_signal_connect( G_OBJECT( _impl->_fooAdj[i] ), "value_changed", G_CALLBACK( ColorICCSelectorImpl::_adjustmentChanged ), _csel ); + g_signal_connect( G_OBJECT( _impl->_compUI[i]._adj ), "value_changed", G_CALLBACK( ColorICCSelectorImpl::_adjustmentChanged ), _csel ); - g_signal_connect( G_OBJECT( _impl->_fooSlider[i] ), "grabbed", G_CALLBACK( ColorICCSelectorImpl::_sliderGrabbed ), _csel ); - g_signal_connect( G_OBJECT( _impl->_fooSlider[i] ), "released", G_CALLBACK( ColorICCSelectorImpl::_sliderReleased ), _csel ); - g_signal_connect( G_OBJECT( _impl->_fooSlider[i] ), "changed", G_CALLBACK( ColorICCSelectorImpl::_sliderChanged ), _csel ); + g_signal_connect( G_OBJECT( _impl->_compUI[i]._slider ), "grabbed", G_CALLBACK( ColorICCSelectorImpl::_sliderGrabbed ), _csel ); + g_signal_connect( G_OBJECT( _impl->_compUI[i]._slider ), "released", G_CALLBACK( ColorICCSelectorImpl::_sliderReleased ), _csel ); + g_signal_connect( G_OBJECT( _impl->_compUI[i]._slider ), "changed", G_CALLBACK( ColorICCSelectorImpl::_sliderChanged ), _csel ); row++; } @@ -497,15 +562,7 @@ void ColorICCSelector::init() gtk_misc_set_alignment(GTK_MISC(_impl->_label), 1.0, 0.5); gtk_widget_show(_impl->_label); -#if GTK_CHECK_VERSION(3,0,0) - gtk_widget_set_margin_left(_impl->_label, XPAD); - gtk_widget_set_margin_right(_impl->_label, XPAD); - gtk_widget_set_margin_top(_impl->_label, YPAD); - gtk_widget_set_margin_bottom(_impl->_label, YPAD); - gtk_grid_attach(GTK_GRID(t), _impl->_label, 0, row, 1, 1); -#else - gtk_table_attach(GTK_TABLE (t), _impl->_label, 0, 1, row, row + 1, GTK_FILL, GTK_FILL, XPAD, YPAD); -#endif + attachToGridOrTable(t, _impl->_label, 0, row, 1, 1); // Adjustment _impl->_adj = GTK_ADJUSTMENT(gtk_adjustment_new(0.0, 0.0, 255.0, 1.0, 10.0, 10.0)); @@ -515,16 +572,7 @@ void ColorICCSelector::init() gtk_widget_set_tooltip_text(_impl->_slider, _("Alpha (opacity)")); gtk_widget_show(_impl->_slider); -#if GTK_CHECK_VERSION(3,0,0) - gtk_widget_set_margin_left(_impl->_slider, XPAD); - gtk_widget_set_margin_right(_impl->_slider, XPAD); - gtk_widget_set_margin_top(_impl->_slider, YPAD); - gtk_widget_set_margin_bottom(_impl->_slider, YPAD); - gtk_widget_set_hexpand(_impl->_slider, TRUE); - gtk_grid_attach(GTK_GRID(t), _impl->_slider, 1, row, 1, 1); -#else - gtk_table_attach (GTK_TABLE (t), _impl->_slider, 1, 2, row, row + 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), GTK_FILL, XPAD, YPAD); -#endif + attachToGridOrTable(t, _impl->_slider, 1, row, 1, 1, true); sp_color_slider_set_colors( SP_COLOR_SLIDER( _impl->_slider ), SP_RGBA32_F_COMPOSE( 1.0, 1.0, 1.0, 0.0 ), @@ -539,17 +587,7 @@ void ColorICCSelector::init() gtk_label_set_mnemonic_widget(GTK_LABEL(_impl->_label), _impl->_sbtn); gtk_widget_show(_impl->_sbtn); -#if GTK_CHECK_VERSION(3,0,0) - gtk_widget_set_margin_left(_impl->_sbtn, XPAD); - gtk_widget_set_margin_right(_impl->_sbtn, XPAD); - gtk_widget_set_margin_top(_impl->_sbtn, YPAD); - gtk_widget_set_margin_bottom(_impl->_sbtn, YPAD); - gtk_widget_set_halign(_impl->_sbtn, GTK_ALIGN_CENTER); - gtk_widget_set_valign(_impl->_sbtn, GTK_ALIGN_CENTER); - gtk_grid_attach(GTK_GRID(t), _impl->_sbtn, 2, row, 1, 1); -#else - gtk_table_attach(GTK_TABLE (t), _impl->_sbtn, 2, 3, row, row + 1, (GtkAttachOptions)0, (GtkAttachOptions)0, XPAD, YPAD); -#endif + attachToGridOrTable(t, _impl->_sbtn, 2, row, 1, 1, false, true); // Signals g_signal_connect(G_OBJECT(_impl->_adj), "value_changed", G_CALLBACK(ColorICCSelectorImpl::_adjustmentChanged), _csel); @@ -592,7 +630,7 @@ void ColorICCSelectorImpl::_fixupHit( GtkWidget* /*src*/, gpointer data ) { ColorICCSelectorImpl* self = reinterpret_cast<ColorICCSelectorImpl*>(data); gtk_widget_set_sensitive( self->_fixupBtn, FALSE ); - self->_adjustmentChanged( self->_fooAdj[0], SP_COLOR_ICC_SELECTOR(self->_owner->_csel) ); + self->_adjustmentChanged( self->_compUI[0]._adj, SP_COLOR_ICC_SELECTOR(self->_owner->_csel) ); } #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) @@ -704,7 +742,7 @@ void ColorICCSelectorImpl::_switchToProfile( gchar const* name ) g_message("+ new color is [%s]", tmp.toString().c_str()); #endif // DEBUG_LCMS _setProfile( tmp.icc ); - //_adjustmentChanged( _fooAdj[0], SP_COLOR_ICC_SELECTOR(_csel) ); + //_adjustmentChanged( _compUI[0]._adj, SP_COLOR_ICC_SELECTOR(_csel) ); _owner->setColorAlpha( tmp, _owner->_alpha, true ); #ifdef DEBUG_LCMS g_message("+_________________"); @@ -786,10 +824,10 @@ void ColorICCSelector::_colorChanged() for ( guint i = 0; i < _impl->_profChannelCount; i++ ) { gdouble val = 0.0; if ( _color.icc->colors.size() > i ) { - if ( _impl->_fooScales[i] == 256 ) { - val = (_color.icc->colors[i] + 128.0) / static_cast<gdouble>(_impl->_fooScales[i]); + if ( _impl->_compUI[i]._component.scale == 256 ) { + val = (_color.icc->colors[i] + 128.0) / static_cast<gdouble>(_impl->_compUI[i]._component.scale); } else { - val = _color.icc->colors[i] / static_cast<gdouble>(_impl->_fooScales[i]); + val = _color.icc->colors[i] / static_cast<gdouble>(_impl->_compUI[i]._component.scale); } } tmp[i] = val * 0x0ffff; @@ -840,10 +878,10 @@ void ColorICCSelectorImpl::_setProfile( SVGICCColor* profile ) profChanged = true; } - for ( guint i = 0; i < _fooCount; i++ ) { - gtk_widget_hide( _fooLabel[i] ); - gtk_widget_hide( _fooSlider[i] ); - gtk_widget_hide( _fooBtn[i] ); + for ( size_t i = 0; i < _compUI.size(); i++ ) { + gtk_widget_hide( _compUI[i]._label ); + gtk_widget_hide( _compUI[i]._slider ); + gtk_widget_hide( _compUI[i]._btn ); } if ( profile ) { @@ -855,40 +893,41 @@ void ColorICCSelectorImpl::_setProfile( SVGICCColor* profile ) _profChannelCount = cmsChannelsOf( asICColorSpaceSig(_prof->getColorSpace()) ); #endif - std::vector<colorspace::Component> things = colorspace::getColorSpaceInfo(asICColorSpaceSig(_prof->getColorSpace())); - _fooScales.clear(); - for (std::vector<colorspace::Component>::iterator it = things.begin(); it != things.end(); ++it) { - _fooScales.push_back(it->scale); - } if ( profChanged ) { + std::vector<colorspace::Component> things = colorspace::getColorSpaceInfo(asICColorSpaceSig(_prof->getColorSpace())); + for (size_t i = 0; (i < things.size()) && (i < _profChannelCount); ++i) + { + _compUI[i]._component = things[i]; + } + for ( guint i = 0; i < _profChannelCount; i++ ) { - gtk_label_set_text_with_mnemonic( GTK_LABEL(_fooLabel[i]), (i < things.size()) ? things[i].name.c_str() : ""); + gtk_label_set_text_with_mnemonic( GTK_LABEL(_compUI[i]._label), (i < things.size()) ? things[i].name.c_str() : ""); - gtk_widget_set_tooltip_text( _fooSlider[i], (i < things.size()) ? things[i].tip.c_str() : "" ); - gtk_widget_set_tooltip_text( _fooBtn[i], (i < things.size()) ? things[i].tip.c_str() : "" ); + gtk_widget_set_tooltip_text( _compUI[i]._slider, (i < things.size()) ? things[i].tip.c_str() : "" ); + gtk_widget_set_tooltip_text( _compUI[i]._btn, (i < things.size()) ? things[i].tip.c_str() : "" ); - sp_color_slider_set_colors( SP_COLOR_SLIDER(_fooSlider[i]), + sp_color_slider_set_colors( SP_COLOR_SLIDER(_compUI[i]._slider), SPColor(0.0, 0.0, 0.0).toRGBA32(0xff), SPColor(0.5, 0.5, 0.5).toRGBA32(0xff), SPColor(1.0, 1.0, 1.0).toRGBA32(0xff) ); /* - _fooAdj[i] = GTK_ADJUSTMENT( gtk_adjustment_new( val, 0.0, _fooScales[i], step, page, page ) ); - g_signal_connect( G_OBJECT( _fooAdj[i] ), "value_changed", G_CALLBACK( _adjustmentChanged ), _csel ); + _compUI[i]._adj = GTK_ADJUSTMENT( gtk_adjustment_new( val, 0.0, _fooScales[i], step, page, page ) ); + g_signal_connect( G_OBJECT( _compUI[i]._adj ), "value_changed", G_CALLBACK( _adjustmentChanged ), _csel ); - sp_color_slider_set_adjustment( SP_COLOR_SLIDER(_fooSlider[i]), _fooAdj[i] ); - gtk_spin_button_set_adjustment( GTK_SPIN_BUTTON(_fooBtn[i]), _fooAdj[i] ); - gtk_spin_button_set_digits( GTK_SPIN_BUTTON(_fooBtn[i]), digits ); + sp_color_slider_set_adjustment( SP_COLOR_SLIDER(_compUI[i]._slider), _compUI[i]._adj ); + gtk_spin_button_set_adjustment( GTK_SPIN_BUTTON(_compUI[i]._btn), _compUI[i]._adj ); + gtk_spin_button_set_digits( GTK_SPIN_BUTTON(_compUI[i]._btn), digits ); */ - gtk_widget_show( _fooLabel[i] ); - gtk_widget_show( _fooSlider[i] ); - gtk_widget_show( _fooBtn[i] ); - //gtk_adjustment_set_value( _fooAdj[i], 0.0 ); - //gtk_adjustment_set_value( _fooAdj[i], val ); + gtk_widget_show( _compUI[i]._label ); + gtk_widget_show( _compUI[i]._slider ); + gtk_widget_show( _compUI[i]._btn ); + //gtk_adjustment_set_value( _compUI[i]._adj, 0.0 ); + //gtk_adjustment_set_value( _compUI[i]._adj, val ); } - for ( guint i = _profChannelCount; i < _fooCount; i++ ) { - gtk_widget_hide( _fooLabel[i] ); - gtk_widget_hide( _fooSlider[i] ); - gtk_widget_hide( _fooBtn[i] ); + for ( size_t i = _profChannelCount; i < _compUI.size(); i++ ) { + gtk_widget_hide( _compUI[i]._label ); + gtk_widget_hide( _compUI[i]._slider ); + gtk_widget_hide( _compUI[i]._btn ); } } } else { @@ -911,13 +950,13 @@ void ColorICCSelectorImpl::_updateSliders( gint ignore ) for ( guint i = 0; i < _profChannelCount; i++ ) { gdouble val = 0.0; if ( _owner->_color.icc->colors.size() > i ) { - if ( _fooScales[i] == 256 ) { - val = (_owner->_color.icc->colors[i] + 128.0) / static_cast<gdouble>(_fooScales[i]); + if ( _compUI[i]._component.scale == 256 ) { + val = (_owner->_color.icc->colors[i] + 128.0) / static_cast<gdouble>(_compUI[i]._component.scale); } else { - val = _owner->_color.icc->colors[i] / static_cast<gdouble>(_fooScales[i]); + val = _owner->_color.icc->colors[i] / static_cast<gdouble>(_compUI[i]._component.scale); } } - gtk_adjustment_set_value( _fooAdj[i], val ); + gtk_adjustment_set_value( _compUI[i]._adj, val ); } if ( _prof ) { @@ -927,7 +966,7 @@ void ColorICCSelectorImpl::_updateSliders( gint ignore ) cmsUInt16Number* scratch = getScratch(); cmsUInt16Number filler[4] = {0, 0, 0, 0}; for ( guint j = 0; j < _profChannelCount; j++ ) { - filler[j] = 0x0ffff * ColorScales::getScaled( _fooAdj[j] ); + filler[j] = 0x0ffff * ColorScales::getScaled( _compUI[j]._adj ); } cmsUInt16Number* p = scratch; @@ -943,8 +982,8 @@ void ColorICCSelectorImpl::_updateSliders( gint ignore ) cmsHTRANSFORM trans = _prof->getTransfToSRGB8(); if ( trans ) { - cmsDoTransform( trans, scratch, _fooMap[i], 1024 ); - sp_color_slider_set_map( SP_COLOR_SLIDER(_fooSlider[i]), _fooMap[i] ); + cmsDoTransform( trans, scratch, _compUI[i]._map, 1024 ); + sp_color_slider_set_map( SP_COLOR_SLIDER(_compUI[i]._slider), _compUI[i]._map ); } } } @@ -992,8 +1031,8 @@ void ColorICCSelectorImpl::_adjustmentChanged( GtkAdjustment *adjustment, SPColo #endif // DEBUG_LCMS } else { #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) - for ( guint i = 0; i < iccSelector->_impl->_fooCount; i++ ) { - if ( iccSelector->_impl->_fooAdj[i] == adjustment ) { + for ( size_t i = 0; i < iccSelector->_impl->_compUI.size(); i++ ) { + if ( iccSelector->_impl->_compUI[i]._adj == adjustment ) { match = i; break; } @@ -1007,7 +1046,7 @@ void ColorICCSelectorImpl::_adjustmentChanged( GtkAdjustment *adjustment, SPColo cmsUInt16Number tmp[4]; for ( guint i = 0; i < 4; i++ ) { - tmp[i] = ColorScales::getScaled( iccSelector->_impl->_fooAdj[i] ) * 0x0ffff; + tmp[i] = ColorScales::getScaled( iccSelector->_impl->_compUI[i]._adj ) * 0x0ffff; } guchar post[4] = {0,0,0,0}; @@ -1033,12 +1072,10 @@ void ColorICCSelectorImpl::_adjustmentChanged( GtkAdjustment *adjustment, SPColo newColor = other; newColor.icc->colors.clear(); for ( guint i = 0; i < iccSelector->_impl->_profChannelCount; i++ ) { - gdouble val = ColorScales::getScaled( iccSelector->_impl->_fooAdj[i] ); - if ( i < iccSelector->_impl->_fooScales.size() ) { - val *= iccSelector->_impl->_fooScales[i]; - if ( iccSelector->_impl->_fooScales[i] == 256 ) { - val -= 128; - } + gdouble val = ColorScales::getScaled( iccSelector->_impl->_compUI[i]._adj ); + val *= iccSelector->_impl->_compUI[i]._component.scale; + if ( iccSelector->_impl->_compUI[i]._component.scale == 256 ) { + val -= 128; } newColor.icc->colors.push_back( val ); } diff --git a/src/widgets/sp-color-notebook.cpp b/src/widgets/sp-color-notebook.cpp index f75521e2c..c709e9775 100644 --- a/src/widgets/sp-color-notebook.cpp +++ b/src/widgets/sp-color-notebook.cpp @@ -651,8 +651,11 @@ void ColorNotebook::_updateRgbaEntry( const SPColor& color, gfloat alpha ) void ColorNotebook::_setCurrentPage(int i) { - gtk_notebook_set_current_page (GTK_NOTEBOOK (_book), i); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(_buttons[i]), TRUE); + gtk_notebook_set_current_page(GTK_NOTEBOOK(_book), i); + + if (_buttons && _trackerList && (static_cast<size_t>(i) < _trackerList->len) ) { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(_buttons[i]), TRUE); + } } void ColorNotebook::_buttonClicked(GtkWidget *widget, SPColorNotebook *colorbook) diff --git a/src/widgets/spw-utilities.cpp b/src/widgets/spw-utilities.cpp index 7fca56f56..87ca80f2f 100644 --- a/src/widgets/spw-utilities.cpp +++ b/src/widgets/spw-utilities.cpp @@ -17,6 +17,10 @@ #include <cstring> #include <string> +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <gtkmm/label.h> diff --git a/src/widgets/stroke-marker-selector.cpp b/src/widgets/stroke-marker-selector.cpp index 62fa47603..2d1c932d3 100644 --- a/src/widgets/stroke-marker-selector.cpp +++ b/src/widgets/stroke-marker-selector.cpp @@ -38,6 +38,7 @@ #include "helper/stock-items.h" #include "gradient-vector.h" +#include <gtkmm/icontheme.h> #include <gtkmm/adjustment.h> #include "ui/widget/spinbutton.h" #include "stroke-style.h" @@ -56,14 +57,11 @@ MarkerComboBox::MarkerComboBox(gchar const *id, int l) : marker_store = Gtk::ListStore::create(marker_columns); set_model(marker_store); pack_start(image_renderer, false); - pack_end(label_renderer, true); - label_renderer.set_padding(2, 0); - image_renderer.set_padding(2, 0); - set_cell_data_func(label_renderer, sigc::mem_fun(*this, &MarkerComboBox::prepareLabelRenderer)); set_cell_data_func(image_renderer, sigc::mem_fun(*this, &MarkerComboBox::prepareImageRenderer)); gtk_combo_box_set_row_separator_func(GTK_COMBO_BOX(gobj()), MarkerComboBox::separator_cb, NULL, NULL); - empty_image = new Gtk::Image(); + empty_image = new Gtk::Image( Glib::wrap( + sp_pixbuf_new( Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_ICON("no-marker") ) ) ); sandbox = ink_markers_preview_doc (); desktop = inkscape_active_desktop(); @@ -559,12 +557,6 @@ MarkerComboBox::create_marker_image(unsigned psize, gchar const *mname, return pb; } -void MarkerComboBox::prepareLabelRenderer( Gtk::TreeModel::const_iterator const &row ) { - Glib::ustring name=(*row)[marker_columns.label]; - label_renderer.property_markup() = name.c_str(); - label_renderer.property_scale() = 0.8; -} - void MarkerComboBox::prepareImageRenderer( Gtk::TreeModel::const_iterator const &row ) { Gtk::Image *image = (*row)[marker_columns.image]; diff --git a/src/widgets/stroke-marker-selector.h b/src/widgets/stroke-marker-selector.h index 02038ea42..27ac76d6f 100644 --- a/src/widgets/stroke-marker-selector.h +++ b/src/widgets/stroke-marker-selector.h @@ -10,6 +10,14 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <gtkmm/combobox.h> #include <gtkmm/liststore.h> @@ -60,7 +68,6 @@ private: SPDocument *doc; SPDocument *sandbox; Gtk::Image *empty_image; - Gtk::CellRendererText label_renderer; Gtk::CellRendererPixbuf image_renderer; class MarkerColumns : public Gtk::TreeModel::ColumnRecord { @@ -91,7 +98,6 @@ private: /* * Callbacks for drawing the combo box */ - void prepareLabelRenderer( Gtk::TreeModel::const_iterator const &row ); void prepareImageRenderer( Gtk::TreeModel::const_iterator const &row ); static gboolean separator_cb (GtkTreeModel *model, GtkTreeIter *iter, gpointer data); diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp index c6934f0a6..0a5b3781b 100644 --- a/src/widgets/stroke-style.cpp +++ b/src/widgets/stroke-style.cpp @@ -342,62 +342,37 @@ StrokeStyle::StrokeStyle() : // TRANSLATORS: Path markers are an SVG feature that allows you to attach arbitrary shapes // (arrowheads, bullets, faces, whatever) to the start, end, or middle nodes of a path. + spw_label(table, _("Markers:"), 0, i, NULL); + + hb = spw_hbox(table, 1, 1, i); + i++; + startMarkerCombo = manage(new MarkerComboBox("marker-start", SP_MARKER_LOC_START)); - spw_label(table, _("_Start Markers:"), 0, i, startMarkerCombo); startMarkerCombo->set_tooltip_text(_("Start Markers are drawn on the first node of a path or shape")); startMarkerConn = startMarkerCombo->signal_changed().connect( sigc::bind<MarkerComboBox *, StrokeStyle *, SPMarkerLoc>( sigc::ptr_fun(&StrokeStyle::markerSelectCB), startMarkerCombo, this, SP_MARKER_LOC_START)); startMarkerCombo->show(); -#if WITH_GTKMM_3_0 - startMarkerCombo->set_hexpand(); - startMarkerCombo->set_halign(Gtk::ALIGN_FILL); - startMarkerCombo->set_valign(Gtk::ALIGN_CENTER); - table->attach(*startMarkerCombo, 1, i, 3, 1); -#else - table->attach(*startMarkerCombo, 1, 4, i, i+1, (Gtk::EXPAND | Gtk::FILL), static_cast<Gtk::AttachOptions>(0), 0, 0); -#endif - - i++; + hb->pack_start(*startMarkerCombo, true, true, 0); midMarkerCombo = manage(new MarkerComboBox("marker-mid", SP_MARKER_LOC_MID)); - spw_label(table, _("_Mid Markers:"), 0, i, midMarkerCombo); midMarkerCombo->set_tooltip_text(_("Mid Markers are drawn on every node of a path or shape except the first and last nodes")); midMarkerConn = midMarkerCombo->signal_changed().connect( sigc::bind<MarkerComboBox *, StrokeStyle *, SPMarkerLoc>( sigc::ptr_fun(&StrokeStyle::markerSelectCB), midMarkerCombo, this, SP_MARKER_LOC_MID)); midMarkerCombo->show(); -#if WITH_GTKMM_3_0 - midMarkerCombo->set_hexpand(); - midMarkerCombo->set_halign(Gtk::ALIGN_FILL); - midMarkerCombo->set_valign(Gtk::ALIGN_CENTER); - table->attach(*midMarkerCombo, 1, i, 3, 1); -#else - table->attach(*midMarkerCombo, 1, 4, i, i+1, (Gtk::EXPAND | Gtk::FILL), static_cast<Gtk::AttachOptions>(0), 0, 0); -#endif - - i++; + hb->pack_start(*midMarkerCombo, true, true, 0); endMarkerCombo = manage(new MarkerComboBox("marker-end", SP_MARKER_LOC_END)); - spw_label(table, _("_End Markers:"), 0, i, endMarkerCombo); endMarkerCombo->set_tooltip_text(_("End Markers are drawn on the last node of a path or shape")); endMarkerConn = endMarkerCombo->signal_changed().connect( sigc::bind<MarkerComboBox *, StrokeStyle *, SPMarkerLoc>( sigc::ptr_fun(&StrokeStyle::markerSelectCB), endMarkerCombo, this, SP_MARKER_LOC_END)); endMarkerCombo->show(); -#if WITH_GTKMM_3_0 - endMarkerCombo->set_hexpand(); - endMarkerCombo->set_halign(Gtk::ALIGN_FILL); - endMarkerCombo->set_valign(Gtk::ALIGN_CENTER); - table->attach(*endMarkerCombo, 1, i, 3, 1); -#else - table->attach(*endMarkerCombo, 1, 4, i, i+1, (Gtk::EXPAND | Gtk::FILL), static_cast<Gtk::AttachOptions>(0), 0, 0); -#endif - - i++; + hb->pack_start(*endMarkerCombo, true, true, 0); setDesktop(desktop); updateLine(); diff --git a/src/widgets/swatch-selector.h b/src/widgets/swatch-selector.h index 4b7aa483f..c8c9983a6 100644 --- a/src/widgets/swatch-selector.h +++ b/src/widgets/swatch-selector.h @@ -1,6 +1,14 @@ #ifndef SEEN_SP_SWATCH_SELECTOR_H #define SEEN_SP_SWATCH_SELECTOR_H +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> class SPDocument; diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 88821b69b..549c61efa 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -29,6 +29,10 @@ # include "config.h" #endif +#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H +#include <glibmm/threads.h> +#endif + #include <gtkmm/box.h> #include <gtkmm/action.h> #include <gtkmm/actiongroup.h> diff --git a/src/widgets/widget-sizes.h b/src/widgets/widget-sizes.h index 8db036734..87c7ca2e0 100644 --- a/src/widgets/widget-sizes.h +++ b/src/widgets/widget-sizes.h @@ -27,7 +27,7 @@ #define STATUS_BAR_FONT_SIZE 10000 -#define STATUS_ZOOM_WIDTH 100 +#define STATUS_ZOOM_WIDTH 57 #define SELECTED_STYLE_SB_WIDTH 48 #define SELECTED_STYLE_WIDTH 190 diff --git a/src/winconsole.cpp b/src/winconsole.cpp index 1515d2062..085fb441c 100644 --- a/src/winconsole.cpp +++ b/src/winconsole.cpp @@ -5,13 +5,13 @@ * Windows has two types of executables: GUI and console. * The GUI executables detach immediately when run from the command * prompt (cmd.exe), and whatever you write to standard output - * disappears into a black hole. Console executables handle + * disappears into a black hole. Console executables * do display standard output and take standard input from the console, * but when you run them from the GUI, an extra console window appears. - * It's possible to hide it, but it still flashes from a fraction + * It's possible to hide it, but it still flashes for a fraction * of a second. * - * To provide an Unix-like experienve, where the application will behave + * To provide an Unix-like experience, where the application will behave * correctly in command line mode and at the same time won't create * the ugly console window when run from the GUI, we have to have two * executables. The first one, inkscape.exe, is the GUI application. @@ -31,7 +31,7 @@ *//* * Authors: * Jos Hirth <jh@kaioa.com> - * Krzysztof Kosiński <tweenk.pl@gmail.com> + * Krzysztof Kosinski <tweenk.pl@gmail.com> * * Copyright (C) 2008-2010 Authors * |
