diff options
| author | kamalpreetgrewal <grewalkamal005@gmail.com> | 2016-08-15 03:59:18 +0000 |
|---|---|---|
| committer | kamalpreetgrewal <grewalkamal005@gmail.com> | 2016-08-15 03:59:18 +0000 |
| commit | 25a9ed4f38121eeb59cf15dbf19391aaef45bba3 (patch) | |
| tree | e123aeae50d98a52e1ad4575b29bf3c199619e33 /src/extension | |
| parent | Solve crash when deleting CSS property (diff) | |
| parent | inkview: Convert to ApplicationWindow (diff) | |
| download | inkscape-25a9ed4f38121eeb59cf15dbf19391aaef45bba3.tar.gz inkscape-25a9ed4f38121eeb59cf15dbf19391aaef45bba3.zip | |
Merge changes from trunk
(bzr r14949.1.64)
Diffstat (limited to 'src/extension')
35 files changed, 90 insertions, 595 deletions
diff --git a/src/extension/Makefile_insert b/src/extension/Makefile_insert deleted file mode 100644 index fb9713904..000000000 --- a/src/extension/Makefile_insert +++ /dev/null @@ -1,54 +0,0 @@ -## Makefile.am fragment sourced by src/Makefile.am. - -ink_common_sources += \ - extension/extension.cpp \ - extension/extension.h \ - extension/db.cpp \ - extension/db.h \ - extension/dependency.cpp \ - extension/dependency.h \ - extension/error-file.cpp \ - extension/error-file.h \ - extension/execution-env.cpp \ - extension/execution-env.h \ - extension/init.cpp \ - extension/init.h \ - extension/loader.h \ - extension/loader.cpp \ - extension/param/parameter.h \ - extension/param/parameter.cpp \ - extension/param/notebook.h \ - extension/param/notebook.cpp \ - extension/param/bool.h \ - extension/param/bool.cpp \ - extension/param/color.h \ - extension/param/color.cpp \ - extension/param/description.h \ - extension/param/description.cpp \ - extension/param/enum.h \ - extension/param/enum.cpp \ - extension/param/float.h \ - extension/param/float.cpp \ - extension/param/int.h \ - extension/param/int.cpp \ - extension/param/radiobutton.h \ - extension/param/radiobutton.cpp \ - extension/param/string.h \ - extension/param/string.cpp \ - extension/prefdialog.cpp \ - extension/prefdialog.h \ - extension/system.cpp \ - extension/system.h \ - extension/timer.cpp \ - extension/timer.h \ - extension/input.h \ - extension/input.cpp \ - extension/output.h \ - extension/output.cpp \ - extension/effect.h \ - extension/effect.cpp \ - extension/patheffect.h \ - extension/patheffect.cpp \ - extension/print.h \ - extension/print.cpp - diff --git a/src/extension/dbus/Makefile_insert b/src/extension/dbus/Makefile_insert deleted file mode 100644 index 192651d87..000000000 --- a/src/extension/dbus/Makefile_insert +++ /dev/null @@ -1,111 +0,0 @@ -## Makefile.am fragment sourced by src/Makefile.am. - -if WITH_DBUS - -############################# -# Sources for DBus interface -############################# - -ink_common_sources += \ - extension/dbus/dbus-init.cpp \ - extension/dbus/dbus-init.h \ - extension/dbus/application-interface.cpp \ - extension/dbus/application-interface.h \ - extension/dbus/document-interface.cpp \ - extension/dbus/document-interface.h \ - extension/dbus/org.inkscape.service.in - -########################### -# Build DBus wrapper files -########################### - -extension/dbus/application-server-glue.h: extension/dbus/application-interface.xml - dbus-binding-tool --mode=glib-server --output=$@ --prefix=application_interface $^ - -extension/dbus/document-server-glue.h: extension/dbus/document-interface.xml - dbus-binding-tool --mode=glib-server --output=$@ --prefix=document_interface $^ - -extension/dbus/document-client-glue.h: extension/dbus/document-interface.xml - dbus-binding-tool --mode=glib-client --output=$@ --prefix=document_interface $^ - -BUILT_SOURCES += \ - extension/dbus/application-server-glue.h \ - extension/dbus/document-server-glue.h \ - extension/dbus/document-client-glue.h - -########################### -# Distribut DBus interface -########################### - -EXTRA_DIST += \ - extension/dbus/application-interface.xml \ - extension/dbus/document-interface.xml - -########################### -# DBus Activation Service -########################### - -# Dbus service file -servicedir = $(DBUSSERVICEDIR) -service_in_files = extension/dbus/org.inkscape.service.in -service_DATA = $(service_in_files:.service.in=.service) - -# Rule to make the service file with bindir expanded -$(service_DATA): $(service_in_files) Makefile - @sed -e "s|bindir|$(prefix)|" $<> $@ - -############################ -# DBus Interface Helper Lib -############################ - -lib_LTLIBRARIES = \ - libinkdbus.la - -libinkdbusincludedir = $(includedir)/libinkdbus-0.48/libinkdbus -libinkdbusinclude_HEADERS = \ - extension/dbus/wrapper/inkscape-dbus-wrapper.h - -libinkdbus_la_SOURCES = \ - extension/dbus/wrapper/inkscape-dbus-wrapper.h \ - extension/dbus/wrapper/inkscape-dbus-wrapper.c - -libinkdbus_la_LDFLAGS = \ - -version-info 0:0:0 \ - -no-undefined \ - -export-symbols-regex "^[^_d].*" - -libinkdbus_la_CFLAGS = \ - $(DBUS_CFLAGS) \ - $(INKSCAPE_CFLAGS) \ - -I$(builddir)/extension/dbus \ - -Wall - -libinkdbus_la_LIBADD = \ - $(DBUS_LIBS) \ - $(INKSCAPE_LIBS) - -############################ -# DBus Pkgconfig file -############################ - -pkgconfig_DATA = extension/dbus/wrapper/inkdbus.pc -pkgconfigdir = $(libdir)/pkgconfig - -else # WITH_DBUS - -EXTRA_DIST += \ - extension/dbus/dbus-init.cpp \ - extension/dbus/dbus-init.h \ - extension/dbus/application-interface.cpp \ - extension/dbus/application-interface.h \ - extension/dbus/document-interface.cpp \ - extension/dbus/document-interface.h \ - extension/dbus/wrapper/inkscape-dbus-wrapper.h \ - extension/dbus/wrapper/inkscape-dbus-wrapper.c \ - extension/dbus/wrapper/inkdbus.pc \ - extension/dbus/org.inkscape.service.in \ - extension/dbus/application-interface.xml \ - extension/dbus/document-interface.xml - -endif - diff --git a/src/extension/dbus/document-interface.cpp b/src/extension/dbus/document-interface.cpp index d0a2e81aa..5a8fb0918 100644 --- a/src/extension/dbus/document-interface.cpp +++ b/src/extension/dbus/document-interface.cpp @@ -189,7 +189,7 @@ selection_get_center_y (Inkscape::Selection *sel){ std::vector<SPObject*> selection_swap(Inkscape::Selection *sel, gchar *name, GError **error) { - std::vector<SPObject*> oldsel = sel->list(); + std::vector<SPObject*> oldsel = std::vector<SPObject*>(sel->objects().begin(), sel->objects().end()); sel->set(get_object_by_name(sel->layers()->getDocument(), name, error)); return oldsel; @@ -1087,14 +1087,14 @@ void document_interface_update(DocumentInterface *doc_interface, GError ** error gboolean document_interface_selection_get(DocumentInterface *doc_interface, char ***out, GError ** /*error*/) { Inkscape::Selection * sel = doc_interface->target.getSelection(); - std::vector<SPObject*> oldsel = sel->list(); + auto oldsel = sel->objects(); int size = oldsel.size(); *out = g_new0 (char *, size + 1); int i = 0; - for (std::vector<SPObject*>::iterator iter = oldsel.begin(), e = oldsel.end(); iter != e; ++iter) { + for (auto iter = oldsel.begin(); iter != oldsel.end(); ++iter) { (*out)[i] = g_strdup((*iter)->getId()); i++; } @@ -1252,7 +1252,7 @@ gboolean document_interface_selection_move_to(DocumentInterface *doc_interface, Geom::OptRect sel_bbox = sel->visualBounds(); if (sel_bbox) { Geom::Point m( x - selection_get_center_x(sel) , 0 - (y - selection_get_center_y(sel)) ); - sp_selection_move_relative(sel, m, true); + sp_object_set_move_relative(sel, m, true); } return TRUE; } diff --git a/src/extension/error-file.cpp b/src/extension/error-file.cpp index 9ec643759..342511ec9 100644 --- a/src/extension/error-file.cpp +++ b/src/extension/error-file.cpp @@ -56,11 +56,7 @@ ErrorFileNotice::ErrorFileNotice (void) : g_free(ext_error_file); set_message(dialog_text, true); -#if WITH_GTKMM_3_0 - Gtk::Box * vbox = get_content_area(); -#else - Gtk::Box * vbox = get_vbox(); -#endif + auto vbox = get_content_area(); /* This is some filler text, needs to change before relase */ Inkscape::Preferences *prefs = Inkscape::Preferences::get(); diff --git a/src/extension/execution-env.cpp b/src/extension/execution-env.cpp index 569e2c762..624813863 100644 --- a/src/extension/execution-env.cpp +++ b/src/extension/execution-env.cpp @@ -55,8 +55,8 @@ ExecutionEnv::ExecutionEnv (Effect * effect, Inkscape::UI::View::View * doc, Imp sp_namedview_document_from_window(desktop); if (desktop != NULL) { - std::vector<SPItem*> selected = desktop->getSelection()->itemList(); - for(std::vector<SPItem*>::const_iterator x = selected.begin(); x != selected.end(); ++x){ + auto selected = desktop->getSelection()->items(); + for(auto x = selected.begin(); x != selected.end(); ++x){ Glib::ustring selected_id; selected_id = (*x)->getId(); _selected.insert(_selected.end(), selected_id); diff --git a/src/extension/extension.cpp b/src/extension/extension.cpp index 56ff0a5f4..c6dee1b70 100644 --- a/src/extension/extension.cpp +++ b/src/extension/extension.cpp @@ -22,12 +22,7 @@ #include <gtkmm/box.h> #include <gtkmm/label.h> #include <gtkmm/frame.h> - -#if WITH_GTKMM_3_0 -# include <gtkmm/grid.h> -#else -# include <gtkmm/table.h> -#endif +#include <gtkmm/grid.h> #include <glibmm/i18n.h> #include "inkscape.h" @@ -766,11 +761,7 @@ Extension::get_info_widget(void) Gtk::Frame * info = Gtk::manage(new Gtk::Frame("General Extension Information")); retval->pack_start(*info, true, true, 5); -#if WITH_GTKMM_3_0 - Gtk::Grid * table = Gtk::manage(new Gtk::Grid()); -#else - Gtk::Table * table = Gtk::manage(new Gtk::Table()); -#endif + auto table = Gtk::manage(new Gtk::Grid()); info->add(*table); @@ -784,11 +775,7 @@ Extension::get_info_widget(void) return retval; } -#if WITH_GTKMM_3_0 void Extension::add_val(Glib::ustring labelstr, Glib::ustring valuestr, Gtk::Grid * table, int * row) -#else -void Extension::add_val(Glib::ustring labelstr, Glib::ustring valuestr, Gtk::Table * table, int * row) -#endif { Gtk::Label * label; Gtk::Label * value; @@ -797,13 +784,8 @@ void Extension::add_val(Glib::ustring labelstr, Glib::ustring valuestr, Gtk::Tab label = Gtk::manage(new Gtk::Label(labelstr)); value = Gtk::manage(new Gtk::Label(valuestr)); -#if WITH_GTKMM_3_0 table->attach(*label, 0, (*row) - 1, 1, 1); table->attach(*value, 1, (*row) - 1, 1, 1); -#else - table->attach(*label, 0, 1, (*row) - 1, *row); - table->attach(*value, 1, 2, (*row) - 1, *row); -#endif label->show(); value->show(); diff --git a/src/extension/extension.h b/src/extension/extension.h index 1fb8bdfec..cd29e1636 100644 --- a/src/extension/extension.h +++ b/src/extension/extension.h @@ -22,12 +22,7 @@ #include <sigc++/signal.h> namespace Gtk { -#if WITH_GTKMM_3_0 class Grid; -#else - class Table; -#endif - class VBox; class Widget; } @@ -300,11 +295,7 @@ public: Gtk::VBox * get_help_widget(void); Gtk::VBox * get_params_widget(void); protected: -#if WITH_GTKMM_3_0 inline static void add_val(Glib::ustring labelstr, Glib::ustring valuestr, Gtk::Grid * table, int * row); -#else - inline static void add_val(Glib::ustring labelstr, Glib::ustring valuestr, Gtk::Table * table, int * row); -#endif }; diff --git a/src/extension/implementation/Makefile_insert b/src/extension/implementation/Makefile_insert deleted file mode 100644 index 1b9080f1a..000000000 --- a/src/extension/implementation/Makefile_insert +++ /dev/null @@ -1,9 +0,0 @@ -## Makefile.am fragment sourced by src/Makefile.am. - -ink_common_sources += \ - extension/implementation/implementation.cpp \ - extension/implementation/implementation.h \ - extension/implementation/script.cpp \ - extension/implementation/script.h \ - extension/implementation/xslt.cpp \ - extension/implementation/xslt.h diff --git a/src/extension/implementation/implementation.cpp b/src/extension/implementation/implementation.cpp index 995d3d9ad..6e6100d2b 100644 --- a/src/extension/implementation/implementation.cpp +++ b/src/extension/implementation/implementation.cpp @@ -45,10 +45,10 @@ Gtk::Widget *Implementation::prefs_effect(Inkscape::Extension::Effect *module, I SPDocument * current_document = view->doc(); - std::vector<SPItem*> selected = ((SPDesktop *)view)->getSelection()->itemList(); + auto selected = ((SPDesktop *) view)->getSelection()->items(); Inkscape::XML::Node const* first_select = NULL; if (!selected.empty()) { - const SPItem * item = selected[0]; + const SPItem * item = selected.front(); first_select = item->getRepr(); } diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index 01323bee2..d2319c2e0 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -689,9 +689,9 @@ void Script::effect(Inkscape::Extension::Effect *module, return; } - std::vector<SPItem*> selected = - desktop->getSelection()->itemList(); //desktop should not be NULL since doc was checked and desktop is a casted pointer - for(std::vector<SPItem*>::const_iterator x = selected.begin(); x != selected.end(); ++x){ + auto selected = + desktop->getSelection()->items(); //desktop should not be NULL since doc was checked and desktop is a casted pointer + for(auto x = selected.begin(); x != selected.end(); ++x){ Glib::ustring selected_id; selected_id += "--id="; selected_id += (*x)->getId(); @@ -942,11 +942,7 @@ void Script::checkStderr (const Glib::ustring &data, GtkWidget *dlg = GTK_WIDGET(warning.gobj()); sp_transientize(dlg); -#if WITH_GTKMM_3_0 - Gtk::Box * vbox = warning.get_content_area(); -#else - Gtk::Box * vbox = warning.get_vbox(); -#endif + auto vbox = warning.get_content_area(); /* Gtk::TextView * textview = new Gtk::TextView(Gtk::TextBuffer::create()); */ Gtk::TextView * textview = new Gtk::TextView(); diff --git a/src/extension/internal/Makefile_insert b/src/extension/internal/Makefile_insert deleted file mode 100644 index 125776d41..000000000 --- a/src/extension/internal/Makefile_insert +++ /dev/null @@ -1,173 +0,0 @@ -## Makefile.am fragment sourced by src/Makefile.am. - -if WITH_LIBWPG -ink_common_sources += \ - extension/internal/wpg-input.cpp \ - extension/internal/wpg-input.h -endif - -if WITH_LIBVISIO -ink_common_sources += \ - extension/internal/vsd-input.cpp \ - extension/internal/vsd-input.h -endif - -if WITH_LIBCDR -ink_common_sources += \ - extension/internal/cdr-input.cpp \ - extension/internal/cdr-input.h -endif - -if USE_IMAGE_MAGICK -ink_common_sources += \ - extension/internal/bitmap/imagemagick.cpp \ - extension/internal/bitmap/imagemagick.h \ - extension/internal/bitmap/adaptiveThreshold.cpp \ - extension/internal/bitmap/adaptiveThreshold.h \ - extension/internal/bitmap/addNoise.cpp \ - extension/internal/bitmap/addNoise.h \ - extension/internal/bitmap/blur.cpp \ - extension/internal/bitmap/blur.h \ - extension/internal/bitmap/channel.cpp \ - extension/internal/bitmap/channel.h \ - extension/internal/bitmap/charcoal.cpp \ - extension/internal/bitmap/charcoal.h \ - extension/internal/bitmap/colorize.cpp \ - extension/internal/bitmap/colorize.h \ - extension/internal/bitmap/contrast.cpp \ - extension/internal/bitmap/contrast.h \ - extension/internal/bitmap/crop.cpp \ - extension/internal/bitmap/crop.h \ - extension/internal/bitmap/cycleColormap.cpp \ - extension/internal/bitmap/cycleColormap.h \ - extension/internal/bitmap/despeckle.cpp \ - extension/internal/bitmap/despeckle.h \ - extension/internal/bitmap/edge.cpp \ - extension/internal/bitmap/edge.h \ - extension/internal/bitmap/emboss.cpp \ - extension/internal/bitmap/emboss.h \ - extension/internal/bitmap/enhance.cpp \ - extension/internal/bitmap/enhance.h \ - extension/internal/bitmap/equalize.cpp \ - extension/internal/bitmap/equalize.h \ - extension/internal/bitmap/gaussianBlur.cpp \ - extension/internal/bitmap/gaussianBlur.h \ - extension/internal/bitmap/implode.cpp \ - extension/internal/bitmap/implode.h \ - extension/internal/bitmap/level.cpp \ - extension/internal/bitmap/level.h \ - extension/internal/bitmap/levelChannel.cpp \ - extension/internal/bitmap/levelChannel.h \ - extension/internal/bitmap/medianFilter.cpp \ - extension/internal/bitmap/medianFilter.h \ - extension/internal/bitmap/modulate.cpp \ - extension/internal/bitmap/modulate.h \ - extension/internal/bitmap/negate.cpp \ - extension/internal/bitmap/negate.h \ - extension/internal/bitmap/normalize.cpp \ - extension/internal/bitmap/normalize.h \ - extension/internal/bitmap/oilPaint.cpp \ - extension/internal/bitmap/oilPaint.h \ - extension/internal/bitmap/opacity.cpp \ - extension/internal/bitmap/opacity.h \ - extension/internal/bitmap/raise.cpp \ - extension/internal/bitmap/raise.h \ - extension/internal/bitmap/reduceNoise.cpp \ - extension/internal/bitmap/reduceNoise.h \ - extension/internal/bitmap/sample.cpp \ - extension/internal/bitmap/sample.h \ - extension/internal/bitmap/shade.cpp \ - extension/internal/bitmap/shade.h \ - extension/internal/bitmap/sharpen.cpp \ - extension/internal/bitmap/sharpen.h \ - extension/internal/bitmap/solarize.cpp \ - extension/internal/bitmap/solarize.h \ - extension/internal/bitmap/spread.cpp \ - extension/internal/bitmap/spread.h \ - extension/internal/bitmap/swirl.cpp \ - extension/internal/bitmap/swirl.h \ - extension/internal/bitmap/threshold.cpp \ - extension/internal/bitmap/threshold.h \ - extension/internal/bitmap/unsharpmask.cpp \ - extension/internal/bitmap/unsharpmask.h \ - extension/internal/bitmap/wave.cpp \ - extension/internal/bitmap/wave.h -endif - -ink_common_sources += \ - extension/internal/bluredge.h \ - extension/internal/bluredge.cpp \ - extension/internal/clear-n_.h \ - extension/internal/grid.h \ - extension/internal/grid.cpp \ - extension/internal/gimpgrad.h \ - extension/internal/gimpgrad.cpp \ - extension/internal/svg.h \ - extension/internal/svg.cpp \ - extension/internal/svgz.h \ - extension/internal/svgz.cpp \ - extension/internal/cairo-ps-out.h \ - extension/internal/cairo-ps-out.cpp \ - extension/internal/cairo-render-context.h \ - extension/internal/cairo-render-context.cpp \ - extension/internal/cairo-renderer.h \ - extension/internal/cairo-renderer.cpp \ - extension/internal/cairo-renderer-pdf-out.h \ - extension/internal/cairo-renderer-pdf-out.cpp \ - extension/internal/cairo-png-out.h \ - extension/internal/cairo-png-out.cpp \ - extension/internal/javafx-out.cpp \ - extension/internal/javafx-out.h \ - extension/internal/gdkpixbuf-input.h \ - extension/internal/gdkpixbuf-input.cpp \ - extension/internal/latex-text-renderer.h \ - extension/internal/latex-text-renderer.cpp \ - extension/internal/pdfinput/svg-builder.h \ - extension/internal/pdfinput/svg-builder.cpp \ - extension/internal/pdfinput/pdf-parser.h \ - extension/internal/pdfinput/pdf-parser.cpp \ - extension/internal/pdfinput/pdf-input.h \ - extension/internal/pdfinput/pdf-input.cpp \ - extension/internal/pov-out.cpp \ - extension/internal/pov-out.h \ - extension/internal/odf.cpp \ - extension/internal/odf.h \ - extension/internal/latex-pstricks.cpp \ - extension/internal/latex-pstricks.h \ - extension/internal/latex-pstricks-out.cpp \ - extension/internal/latex-pstricks-out.h \ - extension/internal/filter/bevels.h \ - extension/internal/filter/blurs.h \ - extension/internal/filter/bumps.h \ - extension/internal/filter/color.h \ - extension/internal/filter/distort.h \ - extension/internal/filter/filter.h \ - extension/internal/filter/image.h \ - extension/internal/filter/morphology.h \ - extension/internal/filter/overlays.h \ - extension/internal/filter/paint.h \ - extension/internal/filter/protrusions.h \ - extension/internal/filter/shadows.h \ - extension/internal/filter/textures.h \ - extension/internal/filter/transparency.h \ - extension/internal/filter/filter-all.cpp \ - extension/internal/filter/filter-file.cpp \ - extension/internal/filter/filter.cpp \ - extension/internal/filter/filter.h \ - extension/internal/text_reassemble.c \ - extension/internal/text_reassemble.h \ - extension/internal/emf-print.h \ - extension/internal/emf-print.cpp \ - extension/internal/emf-inout.h \ - extension/internal/emf-inout.cpp \ - extension/internal/metafile-inout.h \ - extension/internal/metafile-inout.cpp \ - extension/internal/metafile-print.h \ - extension/internal/metafile-print.cpp \ - extension/internal/wmf-print.h \ - extension/internal/wmf-print.cpp \ - extension/internal/wmf-inout.h \ - extension/internal/wmf-inout.cpp \ - extension/internal/image-resolution.h \ - extension/internal/image-resolution.cpp - diff --git a/src/extension/internal/bitmap/imagemagick.cpp b/src/extension/internal/bitmap/imagemagick.cpp index a235dcb0f..472c2db91 100644 --- a/src/extension/internal/bitmap/imagemagick.cpp +++ b/src/extension/internal/bitmap/imagemagick.cpp @@ -65,8 +65,8 @@ ImageMagickDocCache::ImageMagickDocCache(Inkscape::UI::View::View * view) : _imageItems(NULL) { SPDesktop *desktop = (SPDesktop*)view; - const std::vector<SPItem*> selectedItemList = desktop->selection->itemList(); - int selectCount = selectedItemList.size(); + auto selectedItemList = desktop->selection->items(); + int selectCount = (int) boost::distance(selectedItemList); // Init the data-holders _nodes = new Inkscape::XML::Node*[selectCount]; @@ -78,7 +78,7 @@ ImageMagickDocCache::ImageMagickDocCache(Inkscape::UI::View::View * view) : _imageItems = new SPItem*[selectCount]; // Loop through selected items - for (std::vector<SPItem*>::const_iterator i = selectedItemList.begin(); i != selectedItemList.end(); ++i) { + for (auto i = selectedItemList.begin(); i != selectedItemList.end(); ++i) { SPItem *item = *i; Inkscape::XML::Node *node = reinterpret_cast<Inkscape::XML::Node *>(item->getRepr()); if (!strcmp(node->name(), "image") || !strcmp(node->name(), "svg:image")) @@ -235,7 +235,7 @@ ImageMagick::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::Vie { SPDocument * current_document = view->doc(); - std::vector<SPItem*> selected = ((SPDesktop *)view)->getSelection()->itemList(); + auto selected = ((SPDesktop *) view)->getSelection()->items(); Inkscape::XML::Node * first_select = NULL; if (!selected.empty()) { first_select = (selected.front())->getRepr(); diff --git a/src/extension/internal/bluredge.cpp b/src/extension/internal/bluredge.cpp index 4a04e3c33..4f66b39fc 100644 --- a/src/extension/internal/bluredge.cpp +++ b/src/extension/internal/bluredge.cpp @@ -62,7 +62,7 @@ BlurEdge::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View double old_offset = prefs->getDouble("/options/defaultoffsetwidth/value", 1.0, "px"); // TODO need to properly refcount the items, at least - std::vector<SPItem*> items(selection->itemList()); + std::vector<SPItem*> items(selection->items().begin(), selection->items().end()); selection->clear(); for(std::vector<SPItem*>::iterator item = items.begin(); diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp index 5d8b0e076..1310bb343 100644 --- a/src/extension/internal/cairo-render-context.cpp +++ b/src/extension/internal/cairo-render-context.cpp @@ -986,13 +986,12 @@ void CairoRenderContext::popState(void) static bool pattern_hasItemChildren(SPPattern *pat) { - bool hasItems = false; - for ( SPObject *child = pat->firstChild() ; child && !hasItems; child = child->getNext() ) { - if (SP_IS_ITEM (child)) { - hasItems = true; + for (auto& child: pat->children) { + if (SP_IS_ITEM (&child)) { + return true; } } - return hasItems; + return false; } cairo_pattern_t* @@ -1087,10 +1086,10 @@ CairoRenderContext::_createPatternPainter(SPPaintServer const *const paintserver // show items and render them for (SPPattern *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) { if (pat_i && SP_IS_OBJECT(pat_i) && pattern_hasItemChildren(pat_i)) { // find the first one with item children - for ( SPObject *child = pat_i->firstChild() ; child; child = child->getNext() ) { - if (SP_IS_ITEM(child)) { - SP_ITEM(child)->invoke_show(drawing, dkey, SP_ITEM_REFERENCE_FLAGS); - _renderer->renderItem(pattern_ctx, SP_ITEM(child)); + for (auto& child: pat_i->children) { + if (SP_IS_ITEM(&child)) { + SP_ITEM(&child)->invoke_show(drawing, dkey, SP_ITEM_REFERENCE_FLAGS); + _renderer->renderItem(pattern_ctx, SP_ITEM(&child)); } } break; // do not go further up the chain if children are found @@ -1116,9 +1115,9 @@ CairoRenderContext::_createPatternPainter(SPPaintServer const *const paintserver // hide all items for (SPPattern *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) { if (pat_i && SP_IS_OBJECT(pat_i) && pattern_hasItemChildren(pat_i)) { // find the first one with item children - for ( SPObject *child = pat_i->firstChild() ; child; child = child->getNext() ) { - if (SP_IS_ITEM(child)) { - SP_ITEM(child)->invoke_hide(dkey); + for (auto& child: pat_i->children) { + if (SP_IS_ITEM(&child)) { + SP_ITEM(&child)->invoke_hide(dkey); } } break; // do not go further up the chain if children are found diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp index 5dc20ab06..cd96a7f58 100644 --- a/src/extension/internal/cairo-renderer.cpp +++ b/src/extension/internal/cairo-renderer.cpp @@ -741,8 +741,8 @@ CairoRenderer::applyClipPath(CairoRenderContext *ctx, SPClipPath const *cp) TRACE(("BEGIN clip\n")); SPObject const *co = cp; - for ( SPObject const *child = co->firstChild() ; child; child = child->getNext() ) { - SPItem const *item = dynamic_cast<SPItem const *>(child); + for (auto& child: co->children) { + SPItem const *item = dynamic_cast<SPItem const *>(&child); if (item) { // combine transform of the item in clippath and the item using clippath: @@ -800,8 +800,8 @@ CairoRenderer::applyMask(CairoRenderContext *ctx, SPMask const *mask) TRACE(("BEGIN mask\n")); SPObject const *co = mask; - for ( SPObject const *child = co->firstChild() ; child; child = child->getNext() ) { - SPItem const *item = dynamic_cast<SPItem const *>(child); + for (auto& child: co->children) { + SPItem const *item = dynamic_cast<SPItem const *>(&child); if (item) { // TODO fix const correctness: renderItem(ctx, const_cast<SPItem*>(item)); diff --git a/src/extension/internal/cdr-input.cpp b/src/extension/internal/cdr-input.cpp index a26af2078..b94b6d019 100644 --- a/src/extension/internal/cdr-input.cpp +++ b/src/extension/internal/cdr-input.cpp @@ -111,11 +111,7 @@ CdrImportDialog::CdrImportDialog(const std::vector<RVNGString> &vec) _previewArea = Gtk::manage(new class Gtk::VBox()); vbox1 = Gtk::manage(new class Gtk::VBox()); vbox1->pack_start(*_previewArea, Gtk::PACK_EXPAND_WIDGET, 0); -#if WITH_GTKMM_3_0 this->get_content_area()->pack_start(*vbox1); -#else - this->get_vbox()->pack_start(*vbox1); -#endif // CONTROLS @@ -137,13 +133,8 @@ CdrImportDialog::CdrImportDialog(const std::vector<RVNGString> &vec) g_free(label_text); // Adjustment + spinner -#if WITH_GTKMM_3_0 - Glib::RefPtr<Gtk::Adjustment> _pageNumberSpin_adj = Gtk::Adjustment::create(1, 1, _vec.size(), 1, 10, 0); + auto _pageNumberSpin_adj = Gtk::Adjustment::create(1, 1, _vec.size(), 1, 10, 0); _pageNumberSpin = Gtk::manage(new Gtk::SpinButton(_pageNumberSpin_adj, 1, 0)); -#else - Gtk::Adjustment *_pageNumberSpin_adj = Gtk::manage(new class Gtk::Adjustment(1, 1, _vec.size(), 1, 10, 0)); - _pageNumberSpin = Gtk::manage(new Gtk::SpinButton(*_pageNumberSpin_adj, 1, 0)); -#endif _pageNumberSpin->set_can_focus(); _pageNumberSpin->set_update_policy(Gtk::UPDATE_ALWAYS); _pageNumberSpin->set_numeric(true); diff --git a/src/extension/internal/emf-print.cpp b/src/extension/internal/emf-print.cpp index 9f3b5475f..d4c5d95a3 100644 --- a/src/extension/internal/emf-print.cpp +++ b/src/extension/internal/emf-print.cpp @@ -1042,8 +1042,12 @@ void PrintEmf::do_clip_if_present(SPStyle const *style){ /* find the clipping path */ Geom::PathVector combined_pathvector; Geom::Affine tfc; // clipping transform, generally not the same as item transform - for(item = SP_ITEM(scp->firstChild()); item; item=SP_ITEM(item->getNext())){ - if (SP_IS_GROUP(item)) { // not implemented + for (auto& child: scp->children) { + item = SP_ITEM(&child); + if (!item) { + break; + } + if (SP_IS_GROUP(item)) { // not implemented // return sp_group_render(item); combined_pathvector = merge_PathVector_with_group(combined_pathvector, item, tfc); } else if (SP_IS_SHAPE(item)) { @@ -1081,7 +1085,11 @@ Geom::PathVector PrintEmf::merge_PathVector_with_group(Geom::PathVector const &c new_combined_pathvector = combined_pathvector; SPGroup *group = SP_GROUP(item); Geom::Affine tfc = item->transform * transform; - for(SPItem *item = SP_ITEM(group->firstChild()); item; item=SP_ITEM(item->getNext())){ + for (auto& child: group->children) { + item = SP_ITEM(&child); + if (!item) { + break; + } if (SP_IS_GROUP(item)) { new_combined_pathvector = merge_PathVector_with_group(new_combined_pathvector, item, tfc); // could be endlessly recursive on a badly formed SVG } else if (SP_IS_SHAPE(item)) { diff --git a/src/extension/internal/filter/filter.cpp b/src/extension/internal/filter/filter.cpp index 25e89bbf3..0907845f8 100644 --- a/src/extension/internal/filter/filter.cpp +++ b/src/extension/internal/filter/filter.cpp @@ -125,7 +125,7 @@ void Filter::effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::Vie Inkscape::Selection * selection = ((SPDesktop *)document)->selection; // TODO need to properly refcount the items, at least - std::vector<SPItem*> items(selection->itemList()); + std::vector<SPItem*> items(selection->items().begin(), selection->items().end()); Inkscape::XML::Document * xmldoc = document->doc()->getReprDoc(); Inkscape::XML::Node * defsrepr = document->doc()->getDefs()->getRepr(); diff --git a/src/extension/internal/grid.cpp b/src/extension/internal/grid.cpp index c766bd828..9e730f5e5 100644 --- a/src/extension/internal/grid.cpp +++ b/src/extension/internal/grid.cpp @@ -180,10 +180,10 @@ Grid::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View { SPDocument * current_document = view->doc(); - std::vector<SPItem*> selected = ((SPDesktop *)view)->getSelection()->itemList(); + auto selected = ((SPDesktop *) view)->getSelection()->items(); Inkscape::XML::Node * first_select = NULL; if (!selected.empty()) { - first_select = selected[0]->getRepr(); + first_select = selected.front()->getRepr(); } return module->autogui(current_document, first_select, changeSignal); diff --git a/src/extension/internal/javafx-out.cpp b/src/extension/internal/javafx-out.cpp index 386bde1d6..d7ad7e6f7 100644 --- a/src/extension/internal/javafx-out.cpp +++ b/src/extension/internal/javafx-out.cpp @@ -732,9 +732,9 @@ bool JavaFXOutput::doTreeRecursive(SPDocument *doc, SPObject *obj) /** * Descend into children */ - for (SPObject *child = obj->firstChild() ; child ; child = child->next) + for (auto &child: obj->children) { - if (!doTreeRecursive(doc, child)) { + if (!doTreeRecursive(doc, &child)) { return false; } } @@ -804,9 +804,9 @@ bool JavaFXOutput::doBody(SPDocument *doc, SPObject *obj) /** * Descend into children */ - for (SPObject *child = obj->firstChild() ; child ; child = child->next) + for (auto &child: obj->children) { - if (!doBody(doc, child)) { + if (!doBody(doc, &child)) { return false; } } diff --git a/src/extension/internal/metafile-print.cpp b/src/extension/internal/metafile-print.cpp index 47ba5971c..061eb634d 100644 --- a/src/extension/internal/metafile-print.cpp +++ b/src/extension/internal/metafile-print.cpp @@ -293,20 +293,22 @@ void PrintMetafile::brush_classify(SPObject *parent, int depth, Inkscape::Pixbuf } // still looking? Look at this pattern's children, if there are any - SPObject *child = pat_i->firstChild(); - while (child && !(*epixbuf) && (*hatchType == -1)) { - brush_classify(child, depth, epixbuf, hatchType, hatchColor, bkColor); - child = child->getNext(); + for (auto& child: pat_i->children) { + if (*epixbuf || *hatchType != -1) { + break; + } + brush_classify(&child, depth, epixbuf, hatchType, hatchColor, bkColor); } } } else if (SP_IS_IMAGE(parent)) { *epixbuf = ((SPImage *)parent)->pixbuf; return; } else { // some inkscape rearrangements pass through nodes between pattern and image which are not classified as either. - SPObject *child = parent->firstChild(); - while (child && !(*epixbuf) && (*hatchType == -1)) { - brush_classify(child, depth, epixbuf, hatchType, hatchColor, bkColor); - child = child->getNext(); + for (auto& child: parent->children) { + if (*epixbuf || *hatchType != -1) { + break; + } + brush_classify(&child, depth, epixbuf, hatchType, hatchColor, bkColor); } } } diff --git a/src/extension/internal/pdfinput/pdf-input.cpp b/src/extension/internal/pdfinput/pdf-input.cpp index c1940b16a..0c22fa399 100644 --- a/src/extension/internal/pdfinput/pdf-input.cpp +++ b/src/extension/internal/pdfinput/pdf-input.cpp @@ -39,10 +39,8 @@ #include <gtkmm/radiobutton.h> #include <gtkmm/scale.h> -#if WITH_GTKMM_3_0 #include <glibmm/convert.h> #include <glibmm/miscutils.h> -#endif #include "extension/system.h" #include "extension/input.h" @@ -92,14 +90,8 @@ PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gchar */*uri*/) _labelSelect = Gtk::manage(new class Gtk::Label(_("Select page:"))); // Page number -#if WITH_GTKMM_3_0 - Glib::RefPtr<Gtk::Adjustment> _pageNumberSpin_adj = Gtk::Adjustment::create(1, 1, _pdf_doc->getNumPages(), 1, 10, 0); + auto _pageNumberSpin_adj = Gtk::Adjustment::create(1, 1, _pdf_doc->getNumPages(), 1, 10, 0); _pageNumberSpin = Gtk::manage(new Inkscape::UI::Widget::SpinButton(_pageNumberSpin_adj, 1, 1)); -#else - Gtk::Adjustment *_pageNumberSpin_adj = Gtk::manage( - new class Gtk::Adjustment(1, 1, _pdf_doc->getNumPages(), 1, 10, 0)); - _pageNumberSpin = Gtk::manage(new class Inkscape::UI::Widget::SpinButton(*_pageNumberSpin_adj, 1, 1)); -#endif _labelTotalPages = Gtk::manage(new class Gtk::Label()); hbox2 = Gtk::manage(new class Gtk::HBox(false, 0)); // Disable the page selector when there's only one page @@ -137,13 +129,8 @@ PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gchar */*uri*/) _labelViaInternal = Gtk::manage(new class Gtk::Label(_("Import via internal (Poppler derived) library. Text is stored as text but white space is missing. Meshes are converted to tiles, the number depends on the precision set below."))); #endif -#if WITH_GTKMM_3_0 _fallbackPrecisionSlider_adj = Gtk::Adjustment::create(2, 1, 256, 1, 10, 10); _fallbackPrecisionSlider = Gtk::manage(new class Gtk::Scale(_fallbackPrecisionSlider_adj)); -#else - _fallbackPrecisionSlider_adj = Gtk::manage(new class Gtk::Adjustment(2, 1, 256, 1, 10, 10)); - _fallbackPrecisionSlider = Gtk::manage(new class Gtk::HScale(*_fallbackPrecisionSlider_adj)); -#endif _fallbackPrecisionSlider->set_value(2.0); _labelPrecisionComment = Gtk::manage(new class Gtk::Label(_("rough"))); hbox6 = Gtk::manage(new class Gtk::HBox(false, 4)); @@ -278,15 +265,9 @@ PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gchar */*uri*/) hbox1->pack_start(*vbox1); hbox1->pack_start(*_previewArea, Gtk::PACK_EXPAND_WIDGET, 4); -#if WITH_GTKMM_3_0 get_content_area()->set_homogeneous(false); get_content_area()->set_spacing(0); get_content_area()->pack_start(*hbox1); -#else - this->get_vbox()->set_homogeneous(false); - this->get_vbox()->set_spacing(0); - this->get_vbox()->pack_start(*hbox1); -#endif this->set_title(_("PDF Import Settings")); this->set_modal(true); @@ -300,12 +281,7 @@ PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gchar */*uri*/) this->show_all(); // Connect signals -#if WITH_GTKMM_3_0 _previewArea->signal_draw().connect(sigc::mem_fun(*this, &PdfImportDialog::_onDraw)); -#else - _previewArea->signal_expose_event().connect(sigc::mem_fun(*this, &PdfImportDialog::_onExposePreview)); -#endif - _pageNumberSpin_adj->signal_value_changed().connect(sigc::mem_fun(*this, &PdfImportDialog::_onPageNumberChanged)); _cropCheck->signal_toggled().connect(sigc::mem_fun(*this, &PdfImportDialog::_onToggleCropping)); _fallbackPrecisionSlider_adj->signal_value_changed().connect(sigc::mem_fun(*this, &PdfImportDialog::_onPrecisionChanged)); @@ -527,16 +503,6 @@ static void copy_cairo_surface_to_pixbuf (cairo_surface_t *surface, #endif -/** - * \brief Updates the preview area with the previously rendered thumbnail - */ -#if !WITH_GTKMM_3_0 -bool PdfImportDialog::_onExposePreview(GdkEventExpose * /*event*/) { - Cairo::RefPtr<Cairo::Context> cr = _previewArea->get_window()->create_cairo_context(); - return _onDraw(cr); -} -#endif - bool PdfImportDialog::_onDraw(const Cairo::RefPtr<Cairo::Context>& cr) { // Check if we have a thumbnail at all if (!_thumb_data) { diff --git a/src/extension/internal/pdfinput/pdf-input.h b/src/extension/internal/pdfinput/pdf-input.h index 6e36603c3..c338207c1 100644 --- a/src/extension/internal/pdfinput/pdf-input.h +++ b/src/extension/internal/pdfinput/pdf-input.h @@ -39,11 +39,7 @@ namespace Gtk { class DrawingArea; class Frame; class HBox; -#if WITH_GTKMM_3_0 class Scale; -#else - class HScale; -#endif class RadioButton; class VBox; class Label; @@ -79,10 +75,6 @@ private: void _setPreviewPage(int page); // Signal handlers -#if !WITH_GTKMM_3_0 - bool _onExposePreview(GdkEventExpose *event); -#endif - bool _onDraw(const Cairo::RefPtr<Cairo::Context>& cr); void _onPageNumberChanged(); void _onToggleCropping(); @@ -110,13 +102,8 @@ private: class Gtk::RadioButton * _importViaInternal; // Use native (poppler based) importing class Gtk::Label * _labelViaInternal; #endif -#if WITH_GTKMM_3_0 - class Gtk::Scale * _fallbackPrecisionSlider; + Gtk::Scale * _fallbackPrecisionSlider; Glib::RefPtr<Gtk::Adjustment> _fallbackPrecisionSlider_adj; -#else - class Gtk::HScale * _fallbackPrecisionSlider; - class Gtk::Adjustment *_fallbackPrecisionSlider_adj; -#endif class Gtk::Label * _labelPrecisionComment; class Gtk::HBox * hbox6; class Gtk::Label * _labelText; diff --git a/src/extension/internal/pov-out.cpp b/src/extension/internal/pov-out.cpp index bd2168b68..8df883069 100644 --- a/src/extension/internal/pov-out.cpp +++ b/src/extension/internal/pov-out.cpp @@ -479,9 +479,9 @@ bool PovOutput::doTreeRecursive(SPDocument *doc, SPObject *obj) /** * Descend into children */ - for (SPObject *child = obj->firstChild() ; child ; child = child->next) + for (auto &child: obj->children) { - if (!doTreeRecursive(doc, child)) + if (!doTreeRecursive(doc, &child)) return false; } diff --git a/src/extension/internal/vsd-input.cpp b/src/extension/internal/vsd-input.cpp index a3d4aad37..2de2d0ec6 100644 --- a/src/extension/internal/vsd-input.cpp +++ b/src/extension/internal/vsd-input.cpp @@ -113,12 +113,7 @@ VsdImportDialog::VsdImportDialog(const std::vector<RVNGString> &vec) _previewArea = Gtk::manage(new class Gtk::VBox()); vbox1 = Gtk::manage(new class Gtk::VBox()); vbox1->pack_start(*_previewArea, Gtk::PACK_EXPAND_WIDGET, 0); -#if WITH_GTKMM_3_0 this->get_content_area()->pack_start(*vbox1); -#else - this->get_vbox()->pack_start(*vbox1); -#endif - // CONTROLS @@ -140,13 +135,8 @@ VsdImportDialog::VsdImportDialog(const std::vector<RVNGString> &vec) g_free(label_text); // Adjustment + spinner -#if WITH_GTKMM_3_0 - Glib::RefPtr<Gtk::Adjustment> _pageNumberSpin_adj = Gtk::Adjustment::create(1, 1, _vec.size(), 1, 10, 0); + auto _pageNumberSpin_adj = Gtk::Adjustment::create(1, 1, _vec.size(), 1, 10, 0); _pageNumberSpin = Gtk::manage(new Gtk::SpinButton(_pageNumberSpin_adj, 1, 0)); -#else - Gtk::Adjustment *_pageNumberSpin_adj = Gtk::manage(new class Gtk::Adjustment(1, 1, _vec.size(), 1, 10, 0)); - _pageNumberSpin = Gtk::manage(new Gtk::SpinButton(*_pageNumberSpin_adj, 1, 0)); -#endif _pageNumberSpin->set_can_focus(); _pageNumberSpin->set_update_policy(Gtk::UPDATE_ALWAYS); _pageNumberSpin->set_numeric(true); diff --git a/src/extension/param/bool.cpp b/src/extension/param/bool.cpp index d64f798ba..ca61d8c51 100644 --- a/src/extension/param/bool.cpp +++ b/src/extension/param/bool.cpp @@ -14,6 +14,7 @@ #include <gtkmm/box.h> #include <gtkmm/spinbutton.h> #include <gtkmm/checkbutton.h> +#include <glib/gi18n.h> #include "xml/node.h" #include "../extension.h" @@ -129,14 +130,10 @@ Gtk::Widget *ParamBool::get_widget(SPDocument * doc, Inkscape::XML::Node * node, return NULL; } -#if WITH_GTKMM_3_0 - Gtk::Box * hbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 4)); + auto hbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 4)); hbox->set_homogeneous(false); -#else - Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4)); -#endif - Gtk::Label * label = Gtk::manage(new Gtk::Label(_text, Gtk::ALIGN_START)); + Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_START)); label->show(); hbox->pack_end(*label, true, true); diff --git a/src/extension/param/enum.cpp b/src/extension/param/enum.cpp index 4e7420807..8bc0fbda7 100644 --- a/src/extension/param/enum.cpp +++ b/src/extension/param/enum.cpp @@ -251,7 +251,7 @@ Gtk::Widget *ParamComboBox::get_widget(SPDocument * doc, Inkscape::XML::Node * n } Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4)); - Gtk::Label * label = Gtk::manage(new Gtk::Label(_text, Gtk::ALIGN_START)); + Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_START)); label->show(); hbox->pack_start(*label, false, false, _indent); diff --git a/src/extension/param/float.cpp b/src/extension/param/float.cpp index dff7cbf46..23a03ea8f 100644 --- a/src/extension/param/float.cpp +++ b/src/extension/param/float.cpp @@ -15,6 +15,7 @@ #include <gtkmm/scale.h> #include "ui/widget/spinbutton.h" #include "ui/widget/spin-scale.h" +#include <glib/gi18n.h> #include "xml/node.h" #include "extension/extension.h" @@ -176,16 +177,12 @@ Gtk::Widget * ParamFloat::get_widget(SPDocument * doc, Inkscape::XML::Node * nod Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4)); -#if WITH_GTKMM_3_0 - ParamFloatAdjustment * pfa = new ParamFloatAdjustment(this, doc, node, changeSignal); + auto pfa = new ParamFloatAdjustment(this, doc, node, changeSignal); Glib::RefPtr<Gtk::Adjustment> fadjust(pfa); -#else - ParamFloatAdjustment * fadjust = Gtk::manage(new ParamFloatAdjustment(this, doc, node, changeSignal)); -#endif if (_mode == FULL) { - UI::Widget::SpinScale *scale = new UI::Widget::SpinScale(_text, fadjust, _precision); + UI::Widget::SpinScale *scale = new UI::Widget::SpinScale(_(_text), fadjust, _precision); scale->set_size_request(400, -1); scale->show(); hbox->pack_start(*scale, false, false); @@ -193,15 +190,11 @@ Gtk::Widget * ParamFloat::get_widget(SPDocument * doc, Inkscape::XML::Node * nod } else if (_mode == MINIMAL) { - Gtk::Label * label = Gtk::manage(new Gtk::Label(_text, Gtk::ALIGN_START)); + Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_START)); label->show(); hbox->pack_start(*label, true, true, _indent); -#if WITH_GTKMM_3_0 - Inkscape::UI::Widget::SpinButton * spin = Gtk::manage(new Inkscape::UI::Widget::SpinButton(fadjust, 0.1, _precision)); -#else - Inkscape::UI::Widget::SpinButton * spin = Gtk::manage(new Inkscape::UI::Widget::SpinButton(*fadjust, 0.1, _precision)); -#endif + auto spin = Gtk::manage(new Inkscape::UI::Widget::SpinButton(fadjust, 0.1, _precision)); spin->show(); hbox->pack_start(*spin, false, false); } diff --git a/src/extension/param/int.cpp b/src/extension/param/int.cpp index dda801282..222d4f243 100644 --- a/src/extension/param/int.cpp +++ b/src/extension/param/int.cpp @@ -15,6 +15,7 @@ #include <gtkmm/scale.h> #include "ui/widget/spinbutton.h" #include "ui/widget/spin-scale.h" +#include <glib/gi18n.h> #include "xml/node.h" #include "extension/extension.h" @@ -157,32 +158,23 @@ ParamInt::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4)); - -#if WITH_GTKMM_3_0 - ParamIntAdjustment * pia = new ParamIntAdjustment(this, doc, node, changeSignal); + auto pia = new ParamIntAdjustment(this, doc, node, changeSignal); Glib::RefPtr<Gtk::Adjustment> fadjust(pia); -#else - ParamIntAdjustment * fadjust = Gtk::manage(new ParamIntAdjustment(this, doc, node, changeSignal)); -#endif if (_mode == FULL) { - UI::Widget::SpinScale *scale = new UI::Widget::SpinScale(_text, fadjust, 0); + UI::Widget::SpinScale *scale = new UI::Widget::SpinScale(_(_text), fadjust, 0); scale->set_size_request(400, -1); scale->show(); hbox->pack_start(*scale, false, false); } else if (_mode == MINIMAL) { - Gtk::Label * label = Gtk::manage(new Gtk::Label(_text, Gtk::ALIGN_START)); + Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_START)); label->show(); hbox->pack_start(*label, true, true, _indent); -#if WITH_GTKMM_3_0 - Inkscape::UI::Widget::SpinButton * spin = Gtk::manage(new Inkscape::UI::Widget::SpinButton(fadjust, 1.0, 0)); -#else - Inkscape::UI::Widget::SpinButton * spin = Gtk::manage(new Inkscape::UI::Widget::SpinButton(*fadjust, 1.0, 0)); -#endif + auto spin = Gtk::manage(new Inkscape::UI::Widget::SpinButton(fadjust, 1.0, 0)); spin->show(); hbox->pack_start(*spin, false, false); } diff --git a/src/extension/param/notebook.cpp b/src/extension/param/notebook.cpp index 20c8e8481..957d12d06 100644 --- a/src/extension/param/notebook.cpp +++ b/src/extension/param/notebook.cpp @@ -353,11 +353,7 @@ public: // hook function this->signal_switch_page().connect(sigc::mem_fun(this, &ParamNotebookWdg::changed_page)); }; -#if WITH_GTKMM_3_0 void changed_page(Gtk::Widget *page, guint pagenum); -#else - void changed_page(GtkNotebookPage *page, guint pagenum); -#endif bool activated; }; @@ -368,11 +364,7 @@ public: * is actually visible. This to exclude 'fake' changes when the * notebookpages are added or removed. */ -#if WITH_GTKMM_3_0 void ParamNotebookWdg::changed_page(Gtk::Widget * /*page*/, guint pagenum) -#else -void ParamNotebookWdg::changed_page(GtkNotebookPage * /*page*/, guint pagenum) -#endif { if (get_visible()) { _pref->set((int)pagenum, _doc, _node); diff --git a/src/extension/param/parameter.cpp b/src/extension/param/parameter.cpp index e4a614667..a5632a39a 100644 --- a/src/extension/param/parameter.cpp +++ b/src/extension/param/parameter.cpp @@ -58,16 +58,6 @@ Parameter *Parameter::make(Inkscape::XML::Node *in_repr, Inkscape::Extension::Ex const char *guitext = in_repr->attribute("gui-text"); if (guitext == NULL) { guitext = in_repr->attribute("_gui-text"); - if (guitext == NULL) { - // guitext = ""; // propably better to require devs to explicitly set an empty gui-text if this is what they want - } else { - const char *context = in_repr->attribute("msgctxt"); - if (context != NULL) { - guitext = g_dpgettext2(NULL, context, guitext); - } else { - guitext = _(guitext); - } - } } const char *gui_tip = in_repr->attribute("gui-tip"); if (gui_tip == NULL) { diff --git a/src/extension/param/radiobutton.cpp b/src/extension/param/radiobutton.cpp index 1d1b860c6..c54cc0ec3 100644 --- a/src/extension/param/radiobutton.cpp +++ b/src/extension/param/radiobutton.cpp @@ -303,17 +303,12 @@ Gtk::Widget * ParamRadioButton::get_widget(SPDocument * doc, Inkscape::XML::Node return NULL; } -#if WITH_GTKMM_3_0 - Gtk::Box * hbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 4)); + auto hbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 4)); hbox->set_homogeneous(false); - Gtk::Box * vbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL, 0)); + auto vbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL, 0)); vbox->set_homogeneous(false); -#else - Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4)); - Gtk::VBox * vbox = Gtk::manage(new Gtk::VBox(false, 0)); -#endif - Gtk::Label * label = Gtk::manage(new Gtk::Label(_text, Gtk::ALIGN_START, Gtk::ALIGN_START)); + Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_START, Gtk::ALIGN_START)); label->show(); hbox->pack_start(*label, false, false, _indent); diff --git a/src/extension/param/string.cpp b/src/extension/param/string.cpp index 6b082b133..1d9205502 100644 --- a/src/extension/param/string.cpp +++ b/src/extension/param/string.cpp @@ -166,7 +166,7 @@ Gtk::Widget * ParamString::get_widget(SPDocument * doc, Inkscape::XML::Node * no } Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4)); - Gtk::Label * label = Gtk::manage(new Gtk::Label(_text, Gtk::ALIGN_START)); + Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_START)); label->show(); hbox->pack_start(*label, false, false, _indent); diff --git a/src/extension/plugins/grid2/grid.cpp b/src/extension/plugins/grid2/grid.cpp index 6880c574d..233d4e522 100644 --- a/src/extension/plugins/grid2/grid.cpp +++ b/src/extension/plugins/grid2/grid.cpp @@ -186,10 +186,10 @@ Grid::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View { SPDocument * current_document = view->doc(); - std::vector<SPItem*> selected = ((SPDesktop *)view)->getSelection()->itemList(); + auto selected = ((SPDesktop *) view)->getSelection()->items(); Inkscape::XML::Node * first_select = NULL; if (!selected.empty()) { - first_select = selected[0]->getRepr(); + first_select = selected.front()->getRepr(); } return module->autogui(current_document, first_select, changeSignal); diff --git a/src/extension/prefdialog.cpp b/src/extension/prefdialog.cpp index 2521dc1de..1ca590e85 100644 --- a/src/extension/prefdialog.cpp +++ b/src/extension/prefdialog.cpp @@ -41,11 +41,7 @@ namespace Extension { them. It also places the passed-in widgets into the dialog. */ PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * controls, Effect * effect) : -#if WITH_GTKMM_3_0 Gtk::Dialog(_(name.c_str()), true), -#else - Gtk::Dialog(_(name.c_str()), true, true), -#endif _help(help), _name(name), _button_ok(NULL), @@ -68,11 +64,7 @@ PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * co hbox->pack_start(*controls, true, true, 6); hbox->show(); -#if WITH_GTKMM_3_0 this->get_content_area()->pack_start(*hbox, true, true, 6); -#else - this->get_vbox()->pack_start(*hbox, true, true, 6); -#endif /* Gtk::Button * help_button = add_button(Gtk::Stock::HELP, Gtk::RESPONSE_HELP); @@ -97,19 +89,10 @@ PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * co _param_preview = Parameter::make(doc->root(), _effect); } -#if WITH_GTKMM_3_0 - Gtk::Separator * sep = Gtk::manage(new Gtk::Separator()); -#else - Gtk::HSeparator * sep = Gtk::manage(new Gtk::HSeparator()); -#endif - + auto sep = Gtk::manage(new Gtk::Separator()); sep->show(); -#if WITH_GTKMM_3_0 this->get_content_area()->pack_start(*sep, true, true, 4); -#else - this->get_vbox()->pack_start(*sep, true, true, 4); -#endif hbox = Gtk::manage(new Gtk::HBox()); _button_preview = _param_preview->get_widget(NULL, NULL, &_signal_preview); @@ -117,19 +100,11 @@ PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * co hbox->pack_start(*_button_preview, true, true,6); hbox->show(); -#if WITH_GTKMM_3_0 this->get_content_area()->pack_start(*hbox, true, true, 6); -#else - this->get_vbox()->pack_start(*hbox, true, true, 6); -#endif Gtk::Box * hbox = dynamic_cast<Gtk::Box *>(_button_preview); if (hbox != NULL) { -#if WITH_GTKMM_3_0 _checkbox_preview = dynamic_cast<Gtk::CheckButton *>(hbox->get_children().front()); -#else - _checkbox_preview = dynamic_cast<Gtk::CheckButton *>(hbox->children().back().get_widget()); -#endif } preview_toggle(); |
