diff options
| author | Krzysztof Kosi??ski <tweenk.pl@gmail.com> | 2015-05-08 17:26:29 +0000 |
|---|---|---|
| committer | Krzysztof KosiĆski <tweenk.pl@gmail.com> | 2015-05-08 17:26:29 +0000 |
| commit | f31b2c75e1313ccceeb6d33cc14aa545d4d370f9 (patch) | |
| tree | 444b38fe397f34ee5c298ed0efd5cc9f49afb7cf /src/ui/dialog | |
| parent | More helper/geom.h pruning. (diff) | |
| parent | cmake: Bring cmake installation in line with autotools (bug #1451481) (diff) | |
| download | inkscape-f31b2c75e1313ccceeb6d33cc14aa545d4d370f9.tar.gz inkscape-f31b2c75e1313ccceeb6d33cc14aa545d4d370f9.zip | |
Merge from trunk
(bzr r14059.2.11)
Diffstat (limited to 'src/ui/dialog')
44 files changed, 281 insertions, 386 deletions
diff --git a/src/ui/dialog/aboutbox.h b/src/ui/dialog/aboutbox.h index 015e344a1..f3234b88d 100644 --- a/src/ui/dialog/aboutbox.h +++ b/src/ui/dialog/aboutbox.h @@ -15,14 +15,6 @@ #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 65bc94011..882427912 100644 --- a/src/ui/dialog/align-and-distribute.cpp +++ b/src/ui/dialog/align-and-distribute.cpp @@ -97,9 +97,7 @@ void ActionAlign::do_action(SPDesktop *desktop, int index) Inkscape::Preferences *prefs = Inkscape::Preferences::get(); bool sel_as_group = prefs->getBool("/dialogs/align/sel-as-groups"); - using Inkscape::Util::GSListConstIterator; - std::list<SPItem *> selected; - selected.insert<GSListConstIterator<SPItem *> >(selected.end(), selection->itemList(), NULL); + std::vector<SPItem*> selected(selection->itemList()); if (selected.empty()) return; const Coeffs &a = _allCoeffs[index]; @@ -149,18 +147,19 @@ void ActionAlign::do_action(SPDesktop *desktop, int index) b = selection->preferredBounds(); //Move each item in the selected list separately - for (std::list<SPItem *>::iterator it(selected.begin()); + for (std::vector<SPItem*>::iterator it(selected.begin()); it != selected.end(); ++it) { + SPItem* item= *it; desktop->getDocument()->ensureUpToDate(); if (!sel_as_group) - b = (*it)->desktopPreferredBounds(); - if (b && (!focus || (*it) != focus)) { + b = (item)->desktopPreferredBounds(); + if (b && (!focus || (item) != focus)) { Geom::Point const sp(a.sx0 * b->min()[Geom::X] + a.sx1 * b->max()[Geom::X], a.sy0 * b->min()[Geom::Y] + a.sy1 * b->max()[Geom::Y]); Geom::Point const mp_rel( mp - sp ); if (LInfty(mp_rel) > 1e-9) { - sp_item_move_rel(*it, Geom::Translate(mp_rel)); + sp_item_move_rel(item, Geom::Translate(mp_rel)); changed = true; } } @@ -250,26 +249,24 @@ private : Inkscape::Selection *selection = desktop->getSelection(); if (!selection) return; - using Inkscape::Util::GSListConstIterator; - std::list<SPItem *> selected; - selected.insert<GSListConstIterator<SPItem *> >(selected.end(), selection->itemList(), NULL); + std::vector<SPItem*> selected(selection->itemList()); if (selected.empty()) return; //Check 2 or more selected objects - std::list<SPItem *>::iterator second(selected.begin()); + std::vector<SPItem*>::iterator second(selected.begin()); ++second; if (second == selected.end()) return; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); int prefs_bbox = prefs->getBool("/tools/bounding_box"); std::vector< BBoxSort > sorted; - for (std::list<SPItem *>::iterator it(selected.begin()); + for (std::vector<SPItem*>::iterator it(selected.begin()); it != selected.end(); - ++it) - { - Geom::OptRect bbox = !prefs_bbox ? (*it)->desktopVisualBounds() : (*it)->desktopGeometricBounds(); + ++it){ + SPItem *item = *it; + Geom::OptRect bbox = !prefs_bbox ? (item)->desktopVisualBounds() : (item)->desktopGeometricBounds(); if (bbox) { - sorted.push_back(BBoxSort(*it, *bbox, _orientation, _kBegin, _kEnd)); + sorted.push_back(BBoxSort(item, *bbox, _orientation, _kBegin, _kEnd)); } } //sort bbox by anchors @@ -549,9 +546,7 @@ private : Inkscape::Selection *selection = desktop->getSelection(); if (!selection) return; - using Inkscape::Util::GSListConstIterator; - std::list<SPItem *> selected; - selected.insert<GSListConstIterator<SPItem *> >(selected.end(), selection->itemList(), NULL); + std::vector<SPItem*> selected(selection->itemList()); if (selected.empty()) return; //Check 2 or more selected objects @@ -569,15 +564,17 @@ private : } else { // sorting by ZOrder is outomatically done by not setting the center center.reset(); } - selected.sort(ActionExchangePositions::sort_compare); + sort(selected.begin(),selected.end(),sort_compare); } - std::list<SPItem *>::iterator it(selected.begin()); - Geom::Point p1 = (*it)->getCenter(); + std::vector<SPItem*>::iterator it(selected.begin()); + SPItem* item = *it; + Geom::Point p1 = item->getCenter(); for (++it ;it != selected.end(); ++it) { - Geom::Point p2 = (*it)->getCenter(); + item = *it; + Geom::Point p2 = item->getCenter(); Geom::Point delta = p1 - p2; - sp_item_move_rel((*it),Geom::Translate(delta[Geom::X],delta[Geom::Y] )); + sp_item_move_rel(item,Geom::Translate(delta[Geom::X],delta[Geom::Y] )); p1 = p2; } Geom::Point p2 = selected.front()->getCenter(); @@ -615,8 +612,8 @@ private : Inkscape::Preferences *prefs = Inkscape::Preferences::get(); int saved_compensation = prefs->getInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED); prefs->setInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED); - - unclump ((GSList *) _dialog.getDesktop()->getSelection()->itemList()); + std::vector<SPItem*> x(_dialog.getDesktop()->getSelection()->itemList()); + unclump (x); // restore compensation setting prefs->setInt("/options/clonecompensation/value", saved_compensation); @@ -646,9 +643,7 @@ private : Inkscape::Selection *selection = desktop->getSelection(); if (!selection) return; - using Inkscape::Util::GSListConstIterator; - std::list<SPItem *> selected; - selected.insert<GSListConstIterator<SPItem *> >(selected.end(), selection->itemList(), NULL); + std::vector<SPItem*> selected(selection->itemList()); if (selected.empty()) return; //Check 2 or more selected objects @@ -672,12 +667,13 @@ private : int saved_compensation = prefs->getInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED); prefs->setInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED); - for (std::list<SPItem *>::iterator it(selected.begin()); + for (std::vector<SPItem*>::iterator it(selected.begin()); it != selected.end(); ++it) { + SPItem* item = *it; desktop->getDocument()->ensureUpToDate(); - Geom::OptRect item_box = !prefs_bbox ? (*it)->desktopVisualBounds() : (*it)->desktopGeometricBounds(); + Geom::OptRect item_box = !prefs_bbox ? (item)->desktopVisualBounds() : (item)->desktopGeometricBounds(); if (item_box) { // find new center, staying within bbox double x = _dialog.randomize_bbox->min()[Geom::X] + (*item_box)[Geom::X].extent() /2 + @@ -686,7 +682,7 @@ private : g_random_double_range (0, (*_dialog.randomize_bbox)[Geom::Y].extent() - (*item_box)[Geom::Y].extent()); // displacement is the new center minus old: Geom::Point t = Geom::Point (x, y) - 0.5*(item_box->max() + item_box->min()); - sp_item_move_rel(*it, Geom::Translate(t)); + sp_item_move_rel(item, Geom::Translate(t)); } } @@ -745,9 +741,7 @@ private : Inkscape::Selection *selection = desktop->getSelection(); if (!selection) return; - using Inkscape::Util::GSListConstIterator; - std::list<SPItem *> selected; - selected.insert<GSListConstIterator<SPItem *> >(selected.end(), selection->itemList(), NULL); + std::vector<SPItem*> selected(selection->itemList()); if (selected.empty()) return; //Check 2 or more selected objects @@ -758,20 +752,21 @@ private : std::vector<Baselines> sorted; - for (std::list<SPItem *>::iterator it(selected.begin()); + for (std::vector<SPItem*>::iterator it(selected.begin()); it != selected.end(); ++it) { - if (SP_IS_TEXT (*it) || SP_IS_FLOWTEXT (*it)) { - Inkscape::Text::Layout const *layout = te_get_layout(*it); + SPItem* item = *it; + if (SP_IS_TEXT (item) || SP_IS_FLOWTEXT (item)) { + Inkscape::Text::Layout const *layout = te_get_layout(item); boost::optional<Geom::Point> pt = layout->baselineAnchorPoint(); if (pt) { - Geom::Point base = *pt * (*it)->i2dt_affine(); + Geom::Point base = *pt * (item)->i2dt_affine(); if (base[Geom::X] < b_min[Geom::X]) b_min[Geom::X] = base[Geom::X]; if (base[Geom::Y] < b_min[Geom::Y]) b_min[Geom::Y] = base[Geom::Y]; if (base[Geom::X] > b_max[Geom::X]) b_max[Geom::X] = base[Geom::X]; if (base[Geom::Y] > b_max[Geom::Y]) b_max[Geom::Y] = base[Geom::Y]; - Baselines b (*it, base, _orientation); + Baselines b (item, base, _orientation); sorted.push_back(b); } } @@ -801,18 +796,19 @@ private : } } else { - for (std::list<SPItem *>::iterator it(selected.begin()); + for (std::vector<SPItem*>::iterator it(selected.begin()); it != selected.end(); ++it) { - if (SP_IS_TEXT (*it) || SP_IS_FLOWTEXT (*it)) { - Inkscape::Text::Layout const *layout = te_get_layout(*it); + SPItem* item = *it; + if (SP_IS_TEXT (item) || SP_IS_FLOWTEXT (item)) { + Inkscape::Text::Layout const *layout = te_get_layout(item); boost::optional<Geom::Point> pt = layout->baselineAnchorPoint(); if (pt) { - Geom::Point base = *pt * (*it)->i2dt_affine(); + Geom::Point base = *pt * (item)->i2dt_affine(); Geom::Point t(0.0, 0.0); t[_orientation] = b_min[_orientation] - base[_orientation]; - sp_item_move_rel(*it, Geom::Translate(t)); + sp_item_move_rel(item, Geom::Translate(t)); changed = true; } } diff --git a/src/ui/dialog/calligraphic-profile-rename.h b/src/ui/dialog/calligraphic-profile-rename.h index fa13db196..4ef71900b 100644 --- a/src/ui/dialog/calligraphic-profile-rename.h +++ b/src/ui/dialog/calligraphic-profile-rename.h @@ -15,10 +15,6 @@ # 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/clonetiler.cpp b/src/ui/dialog/clonetiler.cpp index bd3ad0254..f84a2ffd6 100644 --- a/src/ui/dialog/clonetiler.cpp +++ b/src/ui/dialog/clonetiler.cpp @@ -1359,7 +1359,7 @@ void CloneTiler::clonetiler_change_selection(Inkscape::Selection *selection, Gtk return; } - if (g_slist_length ((GSList *) selection->itemList()) > 1) { + if (selection->itemList().size() > 1) { gtk_widget_set_sensitive (buttons, FALSE); gtk_label_set_markup (GTK_LABEL(status), _("<small>More than one object selected.</small>")); return; @@ -2096,7 +2096,7 @@ void CloneTiler::clonetiler_unclump(GtkWidget */*widget*/, void *) Inkscape::Selection *selection = desktop->getSelection(); // check if something is selected - if (selection->isEmpty() || g_slist_length((GSList *) selection->itemList()) > 1) { + if (selection->isEmpty() || selection->itemList().size() > 1) { desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>one object</b> whose tiled clones to unclump.")); return; } @@ -2104,20 +2104,18 @@ void CloneTiler::clonetiler_unclump(GtkWidget */*widget*/, void *) SPObject *obj = selection->singleItem(); SPObject *parent = obj->parent; - GSList *to_unclump = NULL; // not including the original + std::vector<SPItem*> to_unclump; // not including the original for (SPObject *child = parent->firstChild(); child != NULL; child = child->next) { if (clonetiler_is_a_clone_of (child, obj)) { - to_unclump = g_slist_prepend (to_unclump, child); + to_unclump.push_back((SPItem*)child); } } desktop->getDocument()->ensureUpToDate(); - + reverse(to_unclump.begin(),to_unclump.end()); unclump (to_unclump); - g_slist_free (to_unclump); - DocumentUndo::done(desktop->getDocument(), SP_VERB_DIALOG_CLONETILER, _("Unclump tiled clones")); } @@ -2147,7 +2145,7 @@ void CloneTiler::clonetiler_remove(GtkWidget */*widget*/, GtkWidget *dlg, bool d Inkscape::Selection *selection = desktop->getSelection(); // check if something is selected - if (selection->isEmpty() || g_slist_length((GSList *) selection->itemList()) > 1) { + if (selection->isEmpty() || selection->itemList().size() > 1) { desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>one object</b> whose tiled clones to remove.")); return; } @@ -2225,7 +2223,7 @@ void CloneTiler::clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg) } // Check if more than one object is selected. - if (g_slist_length((GSList *) selection->itemList()) > 1) { + if (selection->itemList().size() > 1) { desktop->getMessageStack()->flash(Inkscape::ERROR_MESSAGE, _("If you want to clone several objects, <b>group</b> them and <b>clone the group</b>.")); return; } diff --git a/src/ui/dialog/color-item.cpp b/src/ui/dialog/color-item.cpp index a49a47d5c..6603d5c69 100644 --- a/src/ui/dialog/color-item.cpp +++ b/src/ui/dialog/color-item.cpp @@ -17,10 +17,6 @@ #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 9e2287f80..d127261c0 100644 --- a/src/ui/dialog/debug.cpp +++ b/src/ui/dialog/debug.cpp @@ -13,10 +13,6 @@ # 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/document-properties.cpp b/src/ui/dialog/document-properties.cpp index c381ed755..b04e8ecc1 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -1672,10 +1672,10 @@ void DocumentProperties::onDocUnitChange() Inkscape::XML::Node *repr = getDesktop()->getNamedView()->getRepr(); - Inkscape::Util::Unit const *old_doc_unit = unit_table.getUnit("px"); + /*Inkscape::Util::Unit const *old_doc_unit = unit_table.getUnit("px"); if(repr->attribute("inkscape:document-units")) { old_doc_unit = unit_table.getUnit(repr->attribute("inkscape:document-units")); - } + }*/ Inkscape::Util::Unit const *doc_unit = _rum_deflt.getUnit(); // Set document unit diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp index 6d90c792e..384aec415 100644 --- a/src/ui/dialog/export.cpp +++ b/src/ui/dialog/export.cpp @@ -20,10 +20,6 @@ // 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> @@ -605,7 +601,7 @@ void Export::onBatchClicked () void Export::updateCheckbuttons () { - gint num = g_slist_length((GSList *) SP_ACTIVE_DESKTOP->getSelection()->itemList()); + gint num = SP_ACTIVE_DESKTOP->getSelection()->itemList().size(); if (num >= 2) { batch_export.set_sensitive(true); batch_export.set_label(g_strdup_printf (ngettext("B_atch export %d selected object","B_atch export %d selected objects",num), num)); @@ -817,9 +813,9 @@ void Export::onAreaToggled () one that's nice */ if (filename.empty()) { const gchar * id = "object"; - const GSList * reprlst = SP_ACTIVE_DESKTOP->getSelection()->reprList(); - for(; reprlst != NULL; reprlst = reprlst->next) { - Inkscape::XML::Node * repr = (Inkscape::XML::Node *)reprlst->data; + const std::vector<XML::Node*> reprlst = SP_ACTIVE_DESKTOP->getSelection()->reprList(); + for(std::vector<XML::Node*>::const_iterator i=reprlst.begin(); reprlst.end() != i; i++) { + Inkscape::XML::Node * repr = *i; if (repr->attribute("id")) { id = repr->attribute("id"); break; @@ -1010,7 +1006,7 @@ void Export::onExport () if (batch_export.get_active ()) { // Batch export of selected objects - gint num = g_slist_length(const_cast<GSList *>(desktop->getSelection()->itemList())); + gint num = (desktop->getSelection()->itemList()).size(); gint n = 0; if (num < 1) { @@ -1024,8 +1020,9 @@ void Export::onExport () gint export_count = 0; - for (GSList *i = const_cast<GSList *>(desktop->getSelection()->itemList()); i && !interrupted; i = i->next) { - SPItem *item = reinterpret_cast<SPItem *>(i->data); + std::vector<SPItem*> itemlist=desktop->getSelection()->itemList(); + for(std::vector<SPItem*>::const_iterator i = itemlist.begin();i!=itemlist.end() && !interrupted ;i++){ + SPItem *item = *i; prog_dlg->set_data("current", GINT_TO_POINTER(n)); prog_dlg->set_data("total", GINT_TO_POINTER(num)); @@ -1063,13 +1060,13 @@ void Export::onExport () _("Exporting file <b>%s</b>..."), safeFile), desktop); MessageCleaner msgFlashCleanup(desktop->messageStack()->flashF(Inkscape::IMMEDIATE_MESSAGE, _("Exporting file <b>%s</b>..."), safeFile), desktop); - + std::vector<SPItem*> x; if (!sp_export_png_file (doc, path.c_str(), *area, width, height, dpi, dpi, nv->pagecolor, onProgressCallback, (void*)prog_dlg, TRUE, // overwrite without asking - hide ? const_cast<GSList *>(desktop->getSelection()->itemList()) : NULL + hide ? (desktop->getSelection()->itemList()) : x )) { gchar * error = g_strdup_printf(_("Could not export to filename %s.\n"), safeFile); @@ -1153,12 +1150,13 @@ void Export::onExport () prog_dlg->set_data("total", GINT_TO_POINTER(0)); /* Do export */ + std::vector<SPItem*> x; ExportResult status = sp_export_png_file(desktop->getDocument(), path.c_str(), Geom::Rect(Geom::Point(x0, y0), Geom::Point(x1, y1)), width, height, xdpi, ydpi, nv->pagecolor, onProgressCallback, (void*)prog_dlg, FALSE, - hide ? const_cast<GSList *>(desktop->getSelection()->itemList()) : NULL + hide ? (desktop->getSelection()->itemList()) : x ); if (status == EXPORT_ERROR) { gchar * safeFile = Inkscape::IO::sanitizeString(path.c_str()); @@ -1224,7 +1222,7 @@ void Export::onExport () break; } case SELECTION_SELECTION: { - const GSList * reprlst; + std::vector<XML::Node*> reprlst; SPDocument * doc = SP_ACTIVE_DOCUMENT; bool modified = false; @@ -1232,8 +1230,8 @@ void Export::onExport () DocumentUndo::setUndoSensitive(doc, false); reprlst = desktop->getSelection()->reprList(); - for(; reprlst != NULL; reprlst = reprlst->next) { - Inkscape::XML::Node * repr = static_cast<Inkscape::XML::Node *>(reprlst->data); + for(std::vector<Inkscape::XML::Node*>::const_iterator i=reprlst.begin(); reprlst.end() != i; i++) { + Inkscape::XML::Node * repr = *i; const gchar * temp_string; Glib::ustring dir = Glib::path_get_dirname(filename.c_str()); const gchar* docURI=SP_ACTIVE_DOCUMENT->getURI(); diff --git a/src/ui/dialog/filedialogimpl-gtkmm.h b/src/ui/dialog/filedialogimpl-gtkmm.h index 6687915d7..7501b5e14 100644 --- a/src/ui/dialog/filedialogimpl-gtkmm.h +++ b/src/ui/dialog/filedialogimpl-gtkmm.h @@ -17,14 +17,6 @@ #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 8c3b6bad6..b254c3ef6 100644 --- a/src/ui/dialog/filedialogimpl-win32.h +++ b/src/ui/dialog/filedialogimpl-win32.h @@ -16,11 +16,6 @@ #include <glibmm.h> #ifdef WIN32 -#if WITH_GLIBMM_2_32 -#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H -# include <glibmm/threads.h> -#endif -#endif #include "filedialogimpl-gtkmm.h" diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index 077c6f5ca..1ff9e4a1b 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -8,6 +8,7 @@ * Felipe C. da S. Sanches <juca@members.fsf.org> * Jon A. Cruz <jon@joncruz.org> * Abhishek Sharma + * insaner * * Copyright (C) 2007 Authors * @@ -690,7 +691,7 @@ private: void select_svg_element(){ Inkscape::Selection* sel = _desktop->getSelection(); if (sel->isEmpty()) return; - Inkscape::XML::Node* node = (Inkscape::XML::Node*) g_slist_nth_data((GSList *)sel->reprList(), 0); + Inkscape::XML::Node* node = sel->reprList()[0]; if (!node || !node->matchAttributeName("id")) return; std::ostringstream xlikhref; @@ -1360,8 +1361,15 @@ FilterEffectsDialog::FilterModifier::FilterModifier(FilterEffectsDialog& d) ((Gtk::CellRendererText*)_list.get_column(1)->get_first_cell())-> signal_edited().connect(sigc::mem_fun(*this, &FilterEffectsDialog::FilterModifier::on_name_edited)); + _list.append_column("#", _columns.count); + _list.get_column(2)->set_sizing(Gtk::TREE_VIEW_COLUMN_AUTOSIZE); + _list.get_column(2)->set_expand(false); + sw->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); _list.get_column(1)->set_resizable(true); + _list.get_column(1)->set_sizing(Gtk::TREE_VIEW_COLUMN_AUTOSIZE); + _list.get_column(1)->set_expand(true); + _list.set_reorderable(true); _list.enable_model_drag_dest (Gdk::ACTION_MOVE); @@ -1465,9 +1473,9 @@ void FilterEffectsDialog::FilterModifier::update_selection(Selection *sel) } std::set<SPObject*> used; - - for (GSList const *i = sel->itemList(); i != NULL; i = i->next) { - SPObject *obj = SP_OBJECT (i->data); + std::vector<SPItem*> itemlist=sel->itemList(); + for(std::vector<SPItem*>::const_iterator i=itemlist.begin(); itemlist.end() != i; i++) { + SPObject *obj = *i; SPStyle *style = obj->style; if (!style || !SP_IS_ITEM(obj)) { continue; @@ -1494,6 +1502,7 @@ void FilterEffectsDialog::FilterModifier::update_selection(Selection *sel) (*iter)[_columns.sel] = 0; } } + update_counts(); } void FilterEffectsDialog::FilterModifier::on_filter_selection_changed() @@ -1545,10 +1554,9 @@ void FilterEffectsDialog::FilterModifier::on_selection_toggled(const Glib::ustri if((*iter)[_columns.sel] == 1) filter = 0; - GSList const *items = sel->itemList(); - - for (GSList const *i = items; i != NULL; i = i->next) { - SPItem * item = SP_ITEM(i->data); + std::vector<SPItem*> itemlist=sel->itemList(); + for(std::vector<SPItem*>::const_iterator i=itemlist.begin(); itemlist.end() != i; i++) { + SPItem * item = *i; SPStyle *style = item->style; g_assert(style != NULL); @@ -1566,6 +1574,15 @@ void FilterEffectsDialog::FilterModifier::on_selection_toggled(const Glib::ustri } } + +void FilterEffectsDialog::FilterModifier::update_counts() +{ + for(Gtk::TreeModel::iterator i = _model->children().begin(); i != _model->children().end(); ++i) { + SPFilter* f = SP_FILTER((*i)[_columns.filter]); + (*i)[_columns.count] = f->getRefCount(); + } +} + /* Add all filters in the document to the combobox. Keeps the same selection if possible, otherwise selects the first element */ void FilterEffectsDialog::FilterModifier::update_filters() @@ -1650,12 +1667,13 @@ void FilterEffectsDialog::FilterModifier::remove_filter() SPDocument* doc = filter->document; // Delete all references to this filter - GSList *all = get_all_items(NULL, _desktop->currentRoot(), _desktop, false, false, true, NULL); - for (GSList *i = all; i != NULL; i = i->next) { - if (!SP_IS_ITEM(i->data)) { + std::vector<SPItem*> x,y; + std::vector<SPItem*> all = get_all_items(x, _desktop->currentRoot(), _desktop, false, false, true, y); + for(std::vector<SPItem*>::const_iterator i=all.begin(); all.end() != i; i++) { + if (!SP_IS_ITEM(*i)) { continue; } - SPItem *item = SP_ITEM(i->data); + SPItem *item = *i; if (!item->style) { continue; } @@ -1668,9 +1686,6 @@ void FilterEffectsDialog::FilterModifier::remove_filter() } } } - if (all) { - g_slist_free(all); - } //XML Tree being used directly here while it shouldn't be. sp_repr_unparent(filter->getRepr()); @@ -2422,7 +2437,7 @@ bool FilterEffectsDialog::PrimitiveList::on_motion_notify_event(GdkEventMotion* get_visible_rect(vis); int vis_x, vis_y; - int vis_x2, vis_y2; // NOTE: insaner added -- necessary to get the scrolling while dragging to work + int vis_x2, vis_y2; convert_widget_to_tree_coords(vis.get_x(), vis.get_y(), vis_x2, vis_y2); convert_tree_to_widget_coords(vis.get_x(), vis.get_y(), vis_x, vis_y); @@ -2442,7 +2457,6 @@ bool FilterEffectsDialog::PrimitiveList::on_motion_notify_event(GdkEventMotion* else _autoscroll_y = 0; - // NOTE: insaner added -- necessary to get the scrolling while dragging to work double e2 = ( e->x - vis_x2/2); // horizontal scrolling if(e2 < vis_x) @@ -2755,20 +2769,22 @@ FilterEffectsDialog::FilterEffectsDialog() Gtk::ScrolledWindow* sw_infobox = Gtk::manage(new Gtk::ScrolledWindow); Gtk::HBox* infobox = Gtk::manage(new Gtk::HBox(/*homogeneous:*/false, /*spacing:*/4)); Gtk::HBox* hb_prims = Gtk::manage(new Gtk::HBox); + Gtk::VBox* vb_prims = Gtk::manage(new Gtk::VBox); _getContents()->add(*hpaned); hpaned->pack1(_filter_modifier); hpaned->pack2(_primitive_box); _primitive_box.pack_start(*sw_prims); - _primitive_box.pack_start(*hb_prims, false, false); _primitive_box.pack_start(*sw_infobox, false, false); sw_prims->add(_primitive_list); - sw_infobox->add(*infobox); + sw_infobox->add(*vb_prims); infobox->pack_start(_infobox_icon, false, false); infobox->pack_start(_infobox_desc, false, false); _infobox_desc.set_line_wrap(true); - _infobox_desc.set_size_request(200, -1); + _infobox_desc.set_size_request(250, -1); + vb_prims->pack_start(*hb_prims); + vb_prims->pack_start(*infobox); hb_prims->pack_start(_add_primitive, false, false); hb_prims->pack_start(_add_primitive_type, false, false); @@ -2784,7 +2800,7 @@ FilterEffectsDialog::FilterEffectsDialog() _add_primitive_type.signal_changed().connect( sigc::mem_fun(*this, &FilterEffectsDialog::update_primitive_infobox)); - sw_prims->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); /* NOTE: insaner -- SCROLL the connections panel thing!!! */ + sw_prims->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); sw_prims->set_shadow_type(Gtk::SHADOW_IN); sw_infobox->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_NEVER); diff --git a/src/ui/dialog/filter-effects-dialog.h b/src/ui/dialog/filter-effects-dialog.h index 3fc19e7de..a067cd70c 100644 --- a/src/ui/dialog/filter-effects-dialog.h +++ b/src/ui/dialog/filter-effects-dialog.h @@ -4,6 +4,7 @@ /* Authors: * Nicholas Bishop <nicholasbishop@gmail.com> * Rodrigo Kumpera <kumpera@gmail.com> + * insaner * * Copyright (C) 2007 Authors * @@ -69,11 +70,13 @@ private: add(filter); add(label); add(sel); + add(count); } Gtk::TreeModelColumn<SPFilter*> filter; Gtk::TreeModelColumn<Glib::ustring> label; Gtk::TreeModelColumn<int> sel; + Gtk::TreeModelColumn<int> count; }; void setTargetDesktop(SPDesktop *desktop); @@ -89,6 +92,7 @@ private: bool on_filter_move(const Glib::RefPtr<Gdk::DragContext>& /*context*/, int x, int y, guint /*time*/); void on_selection_toggled(const Glib::ustring&); + void update_counts(); void update_filters(); void filter_list_button_release(GdkEventButton*); void add_filter(); diff --git a/src/ui/dialog/find.cpp b/src/ui/dialog/find.cpp index 951cb01ea..a8ac42a1b 100644 --- a/src/ui/dialog/find.cpp +++ b/src/ui/dialog/find.cpp @@ -549,7 +549,7 @@ bool Find::item_font_match(SPItem *item, const gchar *text, bool exact, bool cas } -GSList *Find::filter_fields (GSList *l, bool exact, bool casematch) +std::vector<SPItem*> Find::filter_fields (std::vector<SPItem*> &l, bool exact, bool casematch) { Glib::ustring tmp = entry_find.getEntry()->get_text(); if (tmp.empty()) { @@ -557,17 +557,17 @@ GSList *Find::filter_fields (GSList *l, bool exact, bool casematch) } gchar* text = g_strdup(tmp.c_str()); - GSList *in = l; - GSList *out = NULL; + std::vector<SPItem*> in = l; + std::vector<SPItem*> out; if (check_searchin_text.get_active()) { - for (GSList *i = in; i != NULL; i = i->next) { - SPObject *obj = reinterpret_cast<SPObject *>(i->data); + for(std::vector<SPItem*>::const_reverse_iterator i=in.rbegin(); in.rend() != i; i++) { + SPObject *obj = *i; SPItem *item = dynamic_cast<SPItem *>(obj); g_assert(item != NULL); if (item_text_match(item, text, exact, casematch)) { - if (!g_slist_find(out, i->data)) { - out = g_slist_prepend (out, i->data); + if (out.end()==find(out.begin(),out.end(), *i)) { + out.push_back(*i); if (_action_replace) { item_text_match(item, text, exact, casematch, _action_replace); } @@ -584,12 +584,12 @@ GSList *Find::filter_fields (GSList *l, bool exact, bool casematch) bool attrvalue = check_attributevalue.get_active(); if (ids) { - for (GSList *i = in; i != NULL; i = i->next) { - SPObject *obj = reinterpret_cast<SPObject *>(i->data); + for(std::vector<SPItem*>::const_reverse_iterator i=in.rbegin(); in.rend() != i; i++) { + SPObject *obj = *i; SPItem *item = dynamic_cast<SPItem *>(obj); if (item_id_match(item, text, exact, casematch)) { - if (!g_slist_find(out, i->data)) { - out = g_slist_prepend (out, i->data); + if (out.end()==find(out.begin(),out.end(), *i)) { + out.push_back(*i); if (_action_replace) { item_id_match(item, text, exact, casematch, _action_replace); } @@ -600,14 +600,13 @@ GSList *Find::filter_fields (GSList *l, bool exact, bool casematch) if (style) { - for (GSList *i = in; i != NULL; i = i->next) { - SPObject *obj = reinterpret_cast<SPObject *>(i->data); + for(std::vector<SPItem*>::const_reverse_iterator i=in.rbegin(); in.rend() != i; i++) { + SPObject *obj = *i; SPItem *item = dynamic_cast<SPItem *>(obj); g_assert(item != NULL); if (item_style_match(item, text, exact, casematch)) { - if (!g_slist_find(out, i->data)) - if (!g_slist_find(out, i->data)) { - out = g_slist_prepend (out, i->data); + if (out.end()==find(out.begin(),out.end(), *i)){ + out.push_back(*i); if (_action_replace) { item_style_match(item, text, exact, casematch, _action_replace); } @@ -618,13 +617,13 @@ GSList *Find::filter_fields (GSList *l, bool exact, bool casematch) if (attrname) { - for (GSList *i = in; i != NULL; i = i->next) { - SPObject *obj = reinterpret_cast<SPObject *>(i->data); + for(std::vector<SPItem*>::const_reverse_iterator i=in.rbegin(); in.rend() != i; i++) { + SPObject *obj = *i; SPItem *item = dynamic_cast<SPItem *>(obj); g_assert(item != NULL); if (item_attr_match(item, text, exact, casematch)) { - if (!g_slist_find(out, i->data)) { - out = g_slist_prepend (out, i->data); + if (out.end()==find(out.begin(),out.end(), *i)) { + out.push_back(*i); if (_action_replace) { item_attr_match(item, text, exact, casematch, _action_replace); } @@ -635,13 +634,13 @@ GSList *Find::filter_fields (GSList *l, bool exact, bool casematch) if (attrvalue) { - for (GSList *i = in; i != NULL; i = i->next) { - SPObject *obj = reinterpret_cast<SPObject *>(i->data); + for(std::vector<SPItem*>::const_reverse_iterator i=in.rbegin(); in.rend() != i; i++) { + SPObject *obj = *i; SPItem *item = dynamic_cast<SPItem *>(obj); g_assert(item != NULL); if (item_attrvalue_match(item, text, exact, casematch)) { - if (!g_slist_find(out, i->data)) { - out = g_slist_prepend (out, i->data); + if (out.end()==find(out.begin(),out.end(), *i)) { + out.push_back(*i); if (_action_replace) { item_attrvalue_match(item, text, exact, casematch, _action_replace); } @@ -652,13 +651,13 @@ GSList *Find::filter_fields (GSList *l, bool exact, bool casematch) if (font) { - for (GSList *i = in; i != NULL; i = i->next) { - SPObject *obj = reinterpret_cast<SPObject *>(i->data); + for(std::vector<SPItem*>::const_reverse_iterator i=in.rbegin(); in.rend() != i; i++) { + SPObject *obj = *i; SPItem *item = dynamic_cast<SPItem *>(obj); g_assert(item != NULL); if (item_font_match(item, text, exact, casematch)) { - if (!g_slist_find(out, i->data)) { - out = g_slist_prepend (out, i->data); + if (out.end()==find(out.begin(),out.end(),*i)) { + out.push_back(*i); if (_action_replace) { item_font_match(item, text, exact, casematch, _action_replace); } @@ -716,29 +715,29 @@ bool Find::item_type_match (SPItem *item) return false; } -GSList *Find::filter_types (GSList *l) +std::vector<SPItem*> Find::filter_types (std::vector<SPItem*> &l) { - GSList *n = NULL; - for (GSList *i = l; i != NULL; i = i->next) { - SPObject *obj = reinterpret_cast<SPObject *>(i->data); + std::vector<SPItem*> n; + for(std::vector<SPItem*>::const_reverse_iterator i=l.rbegin(); l.rend() != i; i++) { + SPObject *obj = *i; SPItem *item = dynamic_cast<SPItem *>(obj); g_assert(item != NULL); if (item_type_match(item)) { - n = g_slist_prepend (n, i->data); + n.push_back(*i); } } return n; } -GSList *Find::filter_list (GSList *l, bool exact, bool casematch) +std::vector<SPItem*> &Find::filter_list (std::vector<SPItem*> &l, bool exact, bool casematch) { l = filter_types (l); l = filter_fields (l, exact, casematch); return l; } -GSList *Find::all_items (SPObject *r, GSList *l, bool hidden, bool locked) +std::vector<SPItem*> &Find::all_items (SPObject *r, std::vector<SPItem*> &l, bool hidden, bool locked) { if (dynamic_cast<SPDefs *>(r)) { return l; // we're not interested in items in defs @@ -752,7 +751,7 @@ GSList *Find::all_items (SPObject *r, GSList *l, bool hidden, bool locked) SPItem *item = dynamic_cast<SPItem *>(child); if (item && !child->cloned && !desktop->isLayer(item)) { if ((hidden || !desktop->itemIsHidden(item)) && (locked || !item->isLocked())) { - l = g_slist_prepend (l, child); + l.insert(l.begin(),(SPItem*)child); } } l = all_items (child, l, hidden, locked); @@ -760,16 +759,17 @@ GSList *Find::all_items (SPObject *r, GSList *l, bool hidden, bool locked) return l; } -GSList *Find::all_selection_items (Inkscape::Selection *s, GSList *l, SPObject *ancestor, bool hidden, bool locked) +std::vector<SPItem*> &Find::all_selection_items (Inkscape::Selection *s, std::vector<SPItem*> &l, SPObject *ancestor, bool hidden, bool locked) { - for (GSList *i = (GSList *) s->itemList(); i != NULL; i = i->next) { - SPObject *obj = reinterpret_cast<SPObject *>(i->data); + std::vector<SPItem*> itemlist=s->itemList(); + for(std::vector<SPItem*>::const_reverse_iterator i=itemlist.rbegin(); itemlist.rend() != i; i++) { + SPObject *obj = *i; SPItem *item = dynamic_cast<SPItem *>(obj); g_assert(item != NULL); if (item && !item->cloned && !desktop->isLayer(item)) { if (!ancestor || ancestor->isAncestorOf(item)) { if ((hidden || !desktop->itemIsHidden(item)) && (locked || !item->isLocked())) { - l = g_slist_prepend (l, i->data); + l.push_back(*i); } } } @@ -817,7 +817,7 @@ void Find::onAction() bool casematch = check_case_sensitive.get_active(); blocked = true; - GSList *l = NULL; + std::vector<SPItem*> l; if (check_scope_selection.get_active()) { if (check_scope_layer.get_active()) { l = all_selection_items (desktop->selection, l, desktop->currentLayer(), hidden, locked); @@ -831,12 +831,12 @@ void Find::onAction() l = all_items(desktop->getDocument()->getRoot(), l, hidden, locked); } } - guint all = g_slist_length (l); + guint all = l.size(); - GSList *n = filter_list (l, exact, casematch); + std::vector<SPItem*> n = filter_list (l, exact, casematch); - if (n != NULL) { - int count = g_slist_length (n); + if (!n.empty()) { + int count = n.size(); desktop->messageStack()->flashF(Inkscape::NORMAL_MESSAGE, // TRANSLATORS: "%s" is replaced with "exact" or "partial" when this string is displayed ngettext("<b>%d</b> object found (out of <b>%d</b>), %s match.", @@ -857,7 +857,7 @@ void Find::onAction() Inkscape::Selection *selection = desktop->getSelection(); selection->clear(); selection->setList(n); - SPObject *obj = reinterpret_cast<SPObject *>(n->data); + SPObject *obj = n[0]; SPItem *item = dynamic_cast<SPItem *>(obj); g_assert(item != NULL); scroll_to_show_item(desktop, item); diff --git a/src/ui/dialog/find.h b/src/ui/dialog/find.h index c0c635f94..4bcb900b6 100644 --- a/src/ui/dialog/find.h +++ b/src/ui/dialog/find.h @@ -148,10 +148,10 @@ protected: /** * Function to filter a list of items based on the item type by calling each item_XXX_match function */ - GSList * filter_fields (GSList *l, bool exact, bool casematch); + std::vector<SPItem*> filter_fields (std::vector<SPItem*> &l, bool exact, bool casematch); bool item_type_match (SPItem *item); - GSList * filter_types (GSList *l); - GSList * filter_list (GSList *l, bool exact, bool casematch); + std::vector<SPItem*> filter_types (std::vector<SPItem*> &l); + std::vector<SPItem*> & filter_list (std::vector<SPItem*> &l, bool exact, bool casematch); /** * Find a string within a string and returns true if found with options for exact and casematching @@ -172,12 +172,12 @@ protected: * recursive function to return a list of all the items in the SPObject tree * */ - GSList * all_items (SPObject *r, GSList *l, bool hidden, bool locked); + std::vector<SPItem*> & all_items (SPObject *r, std::vector<SPItem*> &l, bool hidden, bool locked); /** * to return a list of all the selected items * */ - GSList * all_selection_items (Inkscape::Selection *s, GSList *l, SPObject *ancestor, bool hidden, bool locked); + std::vector<SPItem*> & all_selection_items (Inkscape::Selection *s, std::vector<SPItem*> &l, SPObject *ancestor, bool hidden, bool locked); /** * Shrink the dialog size when the expander widget is closed diff --git a/src/ui/dialog/floating-behavior.cpp b/src/ui/dialog/floating-behavior.cpp index 11db14801..55ef0c5bb 100644 --- a/src/ui/dialog/floating-behavior.cpp +++ b/src/ui/dialog/floating-behavior.cpp @@ -14,10 +14,6 @@ # 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> @@ -116,7 +112,7 @@ bool FloatingBehavior::_trans_timer (void) { } float goal, current; - goal = current = _d->get_opacity(); + current = _d->get_opacity(); if (_dialog_active.get_value()) { goal = _trans_focus; diff --git a/src/ui/dialog/font-substitution.cpp b/src/ui/dialog/font-substitution.cpp index ae03bdf0e..19506c6a3 100644 --- a/src/ui/dialog/font-substitution.cpp +++ b/src/ui/dialog/font-substitution.cpp @@ -10,10 +10,6 @@ # 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> @@ -70,19 +66,15 @@ FontSubstitution::checkFontSubstitutions(SPDocument* doc) int show_dlg = prefs->getInt("/options/font/substitutedlg", 0); if (show_dlg) { Glib::ustring out; - GSList *l = getFontReplacedItems(doc, &out); + std::vector<SPItem*> l = getFontReplacedItems(doc, &out); if (out.length() > 0) { show(out, l); } - if (l) { - g_slist_free(l); - l = NULL; - } } } void -FontSubstitution::show(Glib::ustring out, GSList *l) +FontSubstitution::show(Glib::ustring out, std::vector<SPItem*> &l) { Gtk::MessageDialog warning(_("\nSome fonts are not available and have been substituted."), false, Gtk::MESSAGE_INFO, Gtk::BUTTONS_OK, true); @@ -152,20 +144,18 @@ FontSubstitution::show(Glib::ustring out, GSList *l) * b. Build up a list of the objects rendered fonts - taken for the objects layout/spans * If there are fonts in a. that are not in b. then those fonts have been substituted. */ -GSList * FontSubstitution::getFontReplacedItems(SPDocument* doc, Glib::ustring *out) +std::vector<SPItem*> FontSubstitution::getFontReplacedItems(SPDocument* doc, Glib::ustring *out) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; - GSList *allList = NULL; - GSList *outList = NULL; + std::vector<SPItem*> allList; + std::vector<SPItem*> outList,x,y; std::set<Glib::ustring> setErrors; std::set<Glib::ustring> setFontSpans; std::map<SPItem *, Glib::ustring> mapFontStyles; - allList = get_all_items(NULL, doc->getRoot(), desktop, false, false, true, NULL); - - for (GSList *i = allList; i != NULL; i = i->next) { - - SPItem *item = SP_ITEM(i->data); + allList = get_all_items(x, doc->getRoot(), desktop, false, false, true, y); + for(std::vector<SPItem*>::const_iterator i = allList.begin();i!=allList.end();i++){ + SPItem *item = *i; SPStyle *style = item->style; Glib::ustring family = ""; @@ -220,8 +210,8 @@ GSList * FontSubstitution::getFontReplacedItems(SPDocument* doc, Glib::ustring * } // Check if any document styles are not in the actual layout - std::map<SPItem *, Glib::ustring>::const_iterator mapIter; - for (mapIter = mapFontStyles.begin(); mapIter != mapFontStyles.end(); ++mapIter) { + std::map<SPItem *, Glib::ustring>::const_reverse_iterator mapIter; + for (mapIter = mapFontStyles.rbegin(); mapIter != mapFontStyles.rend(); ++mapIter) { SPItem *item = mapIter->first; Glib::ustring fonts = mapIter->second; @@ -254,7 +244,7 @@ GSList * FontSubstitution::getFontReplacedItems(SPDocument* doc, Glib::ustring * Glib::ustring err = Glib::ustring::compose( _("Font '%1' substituted with '%2'"), fonts.c_str(), subName.c_str()); setErrors.insert(err); - outList = g_slist_prepend (outList, item); + outList.push_back(item); } } diff --git a/src/ui/dialog/font-substitution.h b/src/ui/dialog/font-substitution.h index 1c445081b..0818d778c 100644 --- a/src/ui/dialog/font-substitution.h +++ b/src/ui/dialog/font-substitution.h @@ -14,6 +14,7 @@ #include <glibmm/ustring.h> +class SPItem; class SPDocument; namespace Inkscape { @@ -25,13 +26,13 @@ public: FontSubstitution(); virtual ~FontSubstitution(); void checkFontSubstitutions(SPDocument* doc); - void show(Glib::ustring out, GSList *l); + void show(Glib::ustring out, std::vector<SPItem*> &l); static FontSubstitution &getInstance() { return *new FontSubstitution(); } Glib::ustring getSubstituteFontName (Glib::ustring font); protected: - GSList *getFontReplacedItems(SPDocument* doc, Glib::ustring *out); + std::vector<SPItem*> getFontReplacedItems(SPDocument* doc, Glib::ustring *out); private: FontSubstitution(FontSubstitution const &d); diff --git a/src/ui/dialog/glyphs.cpp b/src/ui/dialog/glyphs.cpp index 2b9053da9..7ca277ea2 100644 --- a/src/ui/dialog/glyphs.cpp +++ b/src/ui/dialog/glyphs.cpp @@ -578,9 +578,10 @@ void GlyphsPanel::setTargetDesktop(SPDesktop *desktop) void GlyphsPanel::insertText() { SPItem *textItem = 0; - for (const GSList *item = targetDesktop->selection->itemList(); item; item = item->next ) { - if (SP_IS_TEXT(item->data) || SP_IS_FLOWTEXT(item->data)) { - textItem = SP_ITEM(item->data); + std::vector<SPItem*> itemlist=targetDesktop->selection->itemList(); + for(std::vector<SPItem*>::const_iterator i=itemlist.begin(); itemlist.end() != i; i++) { + if (SP_IS_TEXT(*i) || SP_IS_FLOWTEXT(*i)) { + textItem = *i; break; } } @@ -687,8 +688,9 @@ void GlyphsPanel::selectionModifiedCB(guint flags) void GlyphsPanel::calcCanInsert() { int items = 0; - for (const GSList *item = targetDesktop->selection->itemList(); item; item = item->next ) { - if (SP_IS_TEXT(item->data) || SP_IS_FLOWTEXT(item->data)) { + std::vector<SPItem*> itemlist=targetDesktop->selection->itemList(); + for(std::vector<SPItem*>::const_iterator i=itemlist.begin(); itemlist.end() != i; i++) { + if (SP_IS_TEXT(*i) || SP_IS_FLOWTEXT(*i)) { ++items; } } diff --git a/src/ui/dialog/grid-arrange-tab.cpp b/src/ui/dialog/grid-arrange-tab.cpp index d3ccb9bde..c44f66a4d 100644 --- a/src/ui/dialog/grid-arrange-tab.cpp +++ b/src/ui/dialog/grid-arrange-tab.cpp @@ -48,7 +48,7 @@ * 0 *elem1 == *elem2 * >0 *elem1 goes after *elem2 */ -static int sp_compare_x_position(SPItem *first, SPItem *second) +static bool sp_compare_x_position(SPItem *first, SPItem *second) { using Geom::X; using Geom::Y; @@ -58,7 +58,7 @@ static int sp_compare_x_position(SPItem *first, SPItem *second) if ( !a || !b ) { // FIXME? - return 0; + return false; } double const a_height = a->dimensions()[Y]; @@ -76,40 +76,41 @@ static int sp_compare_x_position(SPItem *first, SPItem *second) } if (!a_in_b_vert) { - return -1; + return true; } if (a_in_b_vert && a->min()[X] > b->min()[X]) { - return 1; + return false; } if (a_in_b_vert && a->min()[X] < b->min()[X]) { - return -1; + return true; } - return 0; + return false; } /* * Sort items by their y co-ordinates. */ -static int sp_compare_y_position(SPItem *first, SPItem *second) +static bool sp_compare_y_position(SPItem *first, SPItem *second) { Geom::OptRect a = first->documentVisualBounds(); Geom::OptRect b = second->documentVisualBounds(); if ( !a || !b ) { // FIXME? - return 0; + return false; } if (a->min()[Geom::Y] > b->min()[Geom::Y]) { - return 1; + return false; } if (a->min()[Geom::Y] < b->min()[Geom::Y]) { - return -1; + return true; } - return 0; + return false; } + namespace Inkscape { namespace UI { namespace Dialog { @@ -168,10 +169,9 @@ void GridArrangeTab::arrange() desktop->getDocument()->ensureUpToDate(); Inkscape::Selection *selection = desktop->getSelection(); - const GSList *items = selection ? selection->itemList() : 0; - cnt=0; - for (; items != NULL; items = items->next) { - SPItem *item = SP_ITEM(items->data); + const std::vector<SPItem*> items = selection ? selection->itemList() : std::vector<SPItem*>(); + for(std::vector<SPItem*>::const_iterator i = items.begin();i!=items.end();i++){ + SPItem *item = *i; Geom::OptRect b = item->documentVisualBounds(); if (!b) { continue; @@ -198,20 +198,18 @@ void GridArrangeTab::arrange() // require the sorting done before we can calculate row heights etc. g_return_if_fail(selection); - const GSList *items2 = selection->itemList(); - GSList *rev = g_slist_copy(const_cast<GSList *>(items2)); - GSList *sorted = NULL; - rev = g_slist_sort(rev, (GCompareFunc) sp_compare_y_position); - sorted = g_slist_sort(rev, (GCompareFunc) sp_compare_x_position); + std::vector<SPItem*> sorted(selection->itemList()); + sort(sorted.begin(),sorted.end(),sp_compare_y_position); + sort(sorted.begin(),sorted.end(),sp_compare_x_position); // Calculate individual Row and Column sizes if necessary cnt=0; - const GSList *sizes = sorted; - for (; sizes != NULL; sizes = sizes->next) { - SPItem *item = SP_ITEM(sizes->data); + const std::vector<SPItem*> sizes(sorted); + for (std::vector<SPItem*>::const_iterator i = sizes.begin();i!=sizes.end();i++) { + SPItem *item = *i; Geom::OptRect b = item->documentVisualBounds(); if (b) { width = b->dimensions()[Geom::X]; @@ -308,12 +306,14 @@ g_print("\n row = %f col = %f selection x= %f selection y = %f", total_row_h } cnt=0; - for (row_cnt=0; ((sorted != NULL) && (row_cnt<NoOfRows)); row_cnt++) { + std::vector<SPItem*>::iterator it = sorted.begin(); + for (row_cnt=0; ((it != sorted.end()) && (row_cnt<NoOfRows)); row_cnt++) { GSList *current_row = NULL; - for (col_cnt = 0; ((sorted != NULL) && (col_cnt<NoOfCols)); col_cnt++) { - current_row = g_slist_append (current_row, sorted->data); - sorted = sorted->next; + col_cnt = 0; + for(;it!=sorted.end()&&col<NoOfCols;it++) { + current_row = g_slist_append (current_row, *it); + col_cnt++; } for (; current_row != NULL; current_row = current_row->next) { @@ -374,8 +374,8 @@ void GridArrangeTab::on_row_spinbutton_changed() Inkscape::Selection *selection = desktop ? desktop->selection : 0; g_return_if_fail( selection ); - GSList const *items = selection->itemList(); - int selcount = g_slist_length((GSList *)items); + std::vector<SPItem*> const items = selection->itemList(); + int selcount = items.size(); double PerCol = ceil(selcount / NoOfColsSpinner.get_value()); NoOfRowsSpinner.set_value(PerCol); @@ -400,8 +400,7 @@ void GridArrangeTab::on_col_spinbutton_changed() Inkscape::Selection *selection = desktop ? desktop->selection : 0; g_return_if_fail(selection); - GSList const *items = selection->itemList(); - int selcount = g_slist_length((GSList *)items); + int selcount = selection->itemList().size(); double PerRow = ceil(selcount / NoOfRowsSpinner.get_value()); NoOfColsSpinner.set_value(PerRow); @@ -538,10 +537,10 @@ void GridArrangeTab::updateSelection() updating = true; SPDesktop *desktop = Parent->getDesktop(); Inkscape::Selection *selection = desktop ? desktop->selection : 0; - GSList const *items = selection ? selection->itemList() : 0; + std::vector<SPItem*> const items = selection ? selection->itemList() : std::vector<SPItem*>(); - if (items) { - int selcount = g_slist_length((GSList *)items); + if (!items.empty()) { + int selcount = items.size(); if (NoOfColsSpinner.get_value() > 1 && NoOfRowsSpinner.get_value() > 1){ // Update the number of rows assuming number of columns wanted remains same. @@ -609,8 +608,7 @@ GridArrangeTab::GridArrangeTab(ArrangeDialog *parent) g_return_if_fail( selection ); int selcount = 1; if (!selection->isEmpty()) { - GSList const *items = selection->itemList(); - selcount = g_slist_length((GSList *)items); + selcount = selection->itemList().size(); } diff --git a/src/ui/dialog/guides.h b/src/ui/dialog/guides.h index 22bf5097a..4ff7b4fde 100644 --- a/src/ui/dialog/guides.h +++ b/src/ui/dialog/guides.h @@ -15,10 +15,6 @@ # 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 b908a90cb..77f120e1a 100644 --- a/src/ui/dialog/icon-preview.cpp +++ b/src/ui/dialog/icon-preview.cpp @@ -17,10 +17,6 @@ # 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> @@ -316,7 +312,7 @@ void IconPreviewPanel::setDesktop( SPDesktop* desktop ) if ( this->desktop ) { docReplacedConn = this->desktop->connectDocumentReplaced(sigc::hide<0>(sigc::mem_fun(this, &IconPreviewPanel::setDocument))); if ( this->desktop->selection && Inkscape::Preferences::get()->getBool("/iconpreview/autoRefresh", true) ) { - selChangedConn = desktop->selection->connectChanged(sigc::hide(sigc::mem_fun(this, &IconPreviewPanel::queueRefresh))); + selChangedConn = this->desktop->selection->connectChanged(sigc::hide(sigc::mem_fun(this, &IconPreviewPanel::queueRefresh))); } } } @@ -366,16 +362,14 @@ void IconPreviewPanel::refreshPreview() if ( sel ) { //g_message("found a selection to play with"); - GSList const *items = sel->itemList(); - while ( items && !target ) { - SPItem* item = SP_ITEM( items->data ); + std::vector<SPItem*> const items = sel->itemList(); + for(std::vector<SPItem*>::const_iterator i=items.begin();!target && i!=items.end();i++){ + SPItem* item = *i; gchar const *id = item->getId(); if ( id ) { targetId = id; target = item; } - - items = g_slist_next(items); } } } diff --git a/src/ui/dialog/layer-properties.h b/src/ui/dialog/layer-properties.h index d114c6ba5..c75a7f190 100644 --- a/src/ui/dialog/layer-properties.h +++ b/src/ui/dialog/layer-properties.h @@ -16,10 +16,6 @@ # 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.h b/src/ui/dialog/layers.h index ae0ac6040..9cd2c3b92 100644 --- a/src/ui/dialog/layers.h +++ b/src/ui/dialog/layers.h @@ -16,10 +16,6 @@ # 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 99ead878c..c686e8365 100644 --- a/src/ui/dialog/livepatheffect-add.h +++ b/src/ui/dialog/livepatheffect-add.h @@ -11,14 +11,6 @@ #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/lpe-fillet-chamfer-properties.cpp b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp index 7e5c17133..f63b19e86 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp @@ -8,10 +8,6 @@ #include <config.h> #endif -#if GLIBMM_DISABLE_DEPRECATED &&HAVE_GLIBMM_THREADS_H -#include <glibmm/threads.h> -#endif - #include <gtkmm.h> #include "lpe-fillet-chamfer-properties.h" #include <boost/lexical_cast.hpp> diff --git a/src/ui/dialog/lpe-powerstroke-properties.cpp b/src/ui/dialog/lpe-powerstroke-properties.cpp index a9e57970d..0cf3e9706 100644 --- a/src/ui/dialog/lpe-powerstroke-properties.cpp +++ b/src/ui/dialog/lpe-powerstroke-properties.cpp @@ -17,10 +17,6 @@ # include <config.h> #endif -#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H -#include <glibmm/threads.h> -#endif - #include "lpe-powerstroke-properties.h" #include <boost/lexical_cast.hpp> #include <gtkmm/stock.h> diff --git a/src/ui/dialog/messages.h b/src/ui/dialog/messages.h index 54ca84f47..6ed246ece 100644 --- a/src/ui/dialog/messages.h +++ b/src/ui/dialog/messages.h @@ -16,14 +16,6 @@ #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/object-attributes.cpp b/src/ui/dialog/object-attributes.cpp index f43a15225..1bc570f43 100644 --- a/src/ui/dialog/object-attributes.cpp +++ b/src/ui/dialog/object-attributes.cpp @@ -127,7 +127,7 @@ void ObjectAttributes::widget_setup (void) blocked = true; // CPPIFY - SPObject *obj = SP_OBJECT(item); //to get the selected item + SPObject *obj = item; //to get the selected item // GObjectClass *klass = G_OBJECT_GET_CLASS(obj); //to deduce the object's type // GType type = G_TYPE_FROM_CLASS(klass); const SPAttrDesc *desc; diff --git a/src/ui/dialog/object-properties.cpp b/src/ui/dialog/object-properties.cpp index dfe211e94..fc21a30d4 100644 --- a/src/ui/dialog/object-properties.cpp +++ b/src/ui/dialog/object-properties.cpp @@ -467,14 +467,14 @@ void ObjectProperties::_labelChanged() gchar *id = g_strdup(_entry_id.get_text().c_str()); g_strcanon(id, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.:", '_'); if (strcmp(id, item->getId()) == 0) { - _label_id.set_markup_with_mnemonic(_("_ID:")); + _label_id.set_markup_with_mnemonic(_("_ID:") + Glib::ustring(" ")); } else if (!*id || !isalnum (*id)) { _label_id.set_text(_("Id invalid! ")); } else if (SP_ACTIVE_DOCUMENT->getObjectById(id) != NULL) { _label_id.set_text(_("Id exists! ")); } else { SPException ex; - _label_id.set_markup_with_mnemonic(_("_ID:")); + _label_id.set_markup_with_mnemonic(_("_ID:") + Glib::ustring(" ")); SP_EXCEPTION_INIT(&ex); item->setAttribute("id", id, &ex); DocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM, _("Set object ID")); diff --git a/src/ui/dialog/objects.cpp b/src/ui/dialog/objects.cpp index 9db0285d7..781c6ef93 100644 --- a/src/ui/dialog/objects.cpp +++ b/src/ui/dialog/objects.cpp @@ -477,15 +477,15 @@ void ObjectsPanel::_objectsSelected( Selection *sel ) { _selectedConnection.block(); _tree.get_selection()->unselect_all(); SPItem *item = NULL; - for (const GSList * iter = sel->itemList(); iter != NULL; iter = iter->next) - { - item = reinterpret_cast<SPItem *>(iter->data); + std::vector<SPItem*> const items = sel->itemList(); + for(std::vector<SPItem*>::const_iterator i=items.begin(); i!=items.end();i++){ + item = *i; if (setOpacity) { _setCompositingValues(item); setOpacity = false; } - _store->foreach(sigc::bind<SPItem *, bool>( sigc::mem_fun(*this, &ObjectsPanel::_checkForSelected), item, iter->next == NULL)); + _store->foreach(sigc::bind<SPItem *, bool>( sigc::mem_fun(*this, &ObjectsPanel::_checkForSelected), item, (*i)==items.back())); } if (!item) { if (_desktop->currentLayer() && SP_IS_ITEM(_desktop->currentLayer())) { diff --git a/src/ui/dialog/objects.h b/src/ui/dialog/objects.h index 74c2382ac..1842fea11 100644 --- a/src/ui/dialog/objects.h +++ b/src/ui/dialog/objects.h @@ -16,10 +16,6 @@ # 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/ocaldialogs.h b/src/ui/dialog/ocaldialogs.h index bd028c145..6ceceb9ef 100644 --- a/src/ui/dialog/ocaldialogs.h +++ b/src/ui/dialog/ocaldialogs.h @@ -17,10 +17,6 @@ # 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/pixelartdialog.cpp b/src/ui/dialog/pixelartdialog.cpp index 5113f172a..760391df6 100644 --- a/src/ui/dialog/pixelartdialog.cpp +++ b/src/ui/dialog/pixelartdialog.cpp @@ -372,12 +372,12 @@ void PixelArtDialogImpl::vectorize() return; } - for ( GSList const *list = desktop->selection->itemList() ; list - ; list = list->next ) { - if ( !SP_IS_IMAGE(list->data) ) + std::vector<SPItem*> const items = desktop->selection->itemList(); + for(std::vector<SPItem*>::const_iterator i=items.begin(); i!=items.end();i++){ + if ( !SP_IS_IMAGE(*i) ) continue; - SPImage *img = SP_IMAGE(list->data); + SPImage *img = SP_IMAGE(*i); Input input; input.pixbuf = Glib::wrap(img->pixbuf->getPixbufRaw(), true); input.x = img->x; diff --git a/src/ui/dialog/polar-arrange-tab.cpp b/src/ui/dialog/polar-arrange-tab.cpp index 281958998..af1386e27 100644 --- a/src/ui/dialog/polar-arrange-tab.cpp +++ b/src/ui/dialog/polar-arrange-tab.cpp @@ -297,19 +297,18 @@ static void moveToPoint(int anchor, SPItem *item, Geom::Point p) void PolarArrangeTab::arrange() { Inkscape::Selection *selection = parent->getDesktop()->getSelection(); - const GSList *items, *tmp; - tmp = items = selection->itemList(); + const std::vector<SPItem*> tmp(selection->itemList()); SPGenericEllipse *referenceEllipse = NULL; // Last ellipse in selection bool arrangeOnEllipse = !arrangeOnParametersRadio.get_active(); bool arrangeOnFirstEllipse = arrangeOnEllipse && arrangeOnFirstCircleRadio.get_active(); int count = 0; - while(tmp) + for(std::vector<SPItem*>::const_iterator i=tmp.begin();i!=tmp.end();i++) { if(arrangeOnEllipse) { - SPItem *item = SP_ITEM(tmp->data); + SPItem *item = *i; if(arrangeOnFirstEllipse) { @@ -322,7 +321,6 @@ void PolarArrangeTab::arrange() referenceEllipse = SP_GENERICELLIPSE(item); } } - tmp = tmp->next; ++count; } @@ -374,11 +372,10 @@ void PolarArrangeTab::arrange() Geom::Point realCenter = Geom::Point(cx, cy) * transformation; - tmp = items; int i = 0; - while(tmp) + for(std::vector<SPItem*>::const_iterator it=tmp.begin();it!=tmp.end();it++) { - SPItem *item = SP_ITEM(tmp->data); + SPItem *item = *it; // Ignore the reference ellipse if any if(item != referenceEllipse) @@ -396,7 +393,6 @@ void PolarArrangeTab::arrange() ++i; } - tmp = tmp->next; } DocumentUndo::done(parent->getDesktop()->getDocument(), SP_VERB_SELECTION_ARRANGE, diff --git a/src/ui/dialog/print.cpp b/src/ui/dialog/print.cpp index ad979b570..c44d645a5 100644 --- a/src/ui/dialog/print.cpp +++ b/src/ui/dialog/print.cpp @@ -81,7 +81,7 @@ static void draw_page( width, height, (unsigned long)(Inkscape::Util::Quantity::convert(width, "px", "in") * dpi), (unsigned long)(Inkscape::Util::Quantity::convert(height, "px", "in") * dpi), - dpi, dpi, bgcolor, NULL, NULL, true, NULL); + dpi, dpi, bgcolor, NULL, NULL, true, std::vector<SPItem*>()); // This doesn't seem to work: //context->set_cairo_context ( Cairo::Context::create (Cairo::ImageSurface::create_from_png (tmp_png) ), dpi, dpi ); diff --git a/src/ui/dialog/spellcheck.h b/src/ui/dialog/spellcheck.h index 27b89e34e..e98a9d80e 100644 --- a/src/ui/dialog/spellcheck.h +++ b/src/ui/dialog/spellcheck.h @@ -16,10 +16,6 @@ # 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/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp index bc228633d..12b423602 100644 --- a/src/ui/dialog/svg-fonts-dialog.cpp +++ b/src/ui/dialog/svg-fonts-dialog.cpp @@ -524,7 +524,7 @@ void SvgFontsDialog::set_glyph_description_from_selected_path(){ return; } - Inkscape::XML::Node* node = (Inkscape::XML::Node*) g_slist_nth_data((GSList *)sel->reprList(), 0); + Inkscape::XML::Node* node = sel->reprList().front(); if (!node) return;//TODO: should this be an assert? if (!node->matchAttributeName("d") || !node->attribute("d")){ char *msg = _("The selected object does not have a <b>path</b> description."); @@ -566,7 +566,7 @@ void SvgFontsDialog::missing_glyph_description_from_selected_path(){ return; } - Inkscape::XML::Node* node = (Inkscape::XML::Node*) g_slist_nth_data((GSList *)sel->reprList(), 0); + Inkscape::XML::Node* node = sel->reprList().front(); if (!node) return;//TODO: should this be an assert? if (!node->matchAttributeName("d") || !node->attribute("d")){ char *msg = _("The selected object does not have a <b>path</b> description."); diff --git a/src/ui/dialog/swatches.cpp b/src/ui/dialog/swatches.cpp index 8759039c3..72677c07e 100644 --- a/src/ui/dialog/swatches.cpp +++ b/src/ui/dialog/swatches.cpp @@ -123,10 +123,10 @@ static void editGradientImpl( SPDesktop* desktop, SPGradient* gr ) bool shown = false; if ( desktop && desktop->doc() ) { Inkscape::Selection *selection = desktop->getSelection(); - GSList const *items = selection->itemList(); - if (items) { + std::vector<SPItem*> const items = selection->itemList(); + if (!items.empty()) { SPStyle query( desktop->doc() ); - int result = objects_query_fillstroke(const_cast<GSList *>(items), &query, true); + int result = objects_query_fillstroke((items), &query, true); if ( (result == QUERY_STYLE_MULTIPLE_SAME) || (result == QUERY_STYLE_SINGLE) ) { // could be pertinent if (query.fill.isPaintserver()) { diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp index eeb4d6cbe..06c17611f 100644 --- a/src/ui/dialog/symbols.cpp +++ b/src/ui/dialog/symbols.cpp @@ -18,10 +18,6 @@ #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> diff --git a/src/ui/dialog/tags.cpp b/src/ui/dialog/tags.cpp index 7d3edaffb..ed71c826f 100644 --- a/src/ui/dialog/tags.cpp +++ b/src/ui/dialog/tags.cpp @@ -352,9 +352,10 @@ void TagsPanel::_objectsSelected( Selection *sel ) { _selectedConnection.block(); _tree.get_selection()->unselect_all(); - for (const GSList * iter = sel->list(); iter != NULL; iter = iter->next) + std::vector<SPObject*> tmp=sel->list(); + for(std::vector<SPObject*>::const_iterator i=tmp.begin();i!=tmp.end();i++) { - SPObject *obj = reinterpret_cast<SPObject *>(iter->data); + SPObject *obj = *i; _store->foreach(sigc::bind<SPObject *>( sigc::mem_fun(*this, &TagsPanel::_checkForSelected), obj)); } _selectedConnection.unblock(); @@ -649,9 +650,9 @@ bool TagsPanel::_handleButtonEvent(GdkEventButton* event) if (col == _tree.get_column(COL_ADD - 1) && down_at_add) { if (SP_IS_TAG(obj)) { bool wasadded = false; - for (const GSList * iter = _desktop->selection->itemList(); iter != NULL; iter = iter->next) - { - SPObject *newobj = reinterpret_cast<SPObject *>(iter->data); + std::vector<SPItem*> items=_desktop->selection->itemList(); + for(std::vector<SPItem*>::const_iterator i=items.begin();i!=items.end();i++){ + SPObject *newobj = *i; bool addchild = true; for ( SPObject *child = obj->children; child != NULL; child = child->next) { if (SP_IS_TAG_USE(child) && SP_TAG_USE(child)->ref->getObject() == newobj) { diff --git a/src/ui/dialog/text-edit.cpp b/src/ui/dialog/text-edit.cpp index a8be8b543..815aa12ef 100644 --- a/src/ui/dialog/text-edit.cpp +++ b/src/ui/dialog/text-edit.cpp @@ -418,12 +418,11 @@ SPItem *TextEdit::getSelectedTextItem (void) if (!SP_ACTIVE_DESKTOP) return NULL; - for (const GSList *item = SP_ACTIVE_DESKTOP->getSelection()->itemList(); - item != NULL; - item = item->next) + std::vector<SPItem*> tmp=SP_ACTIVE_DESKTOP->getSelection()->itemList(); + for(std::vector<SPItem*>::const_iterator i=tmp.begin();i!=tmp.end();i++) { - if (SP_IS_TEXT(item->data) || SP_IS_FLOWTEXT(item->data)) - return SP_ITEM (item->data); + if (SP_IS_TEXT(*i) || SP_IS_FLOWTEXT(*i)) + return *i; } return NULL; @@ -437,11 +436,10 @@ unsigned TextEdit::getSelectedTextCount (void) unsigned int items = 0; - for (const GSList *item = SP_ACTIVE_DESKTOP->getSelection()->itemList(); - item != NULL; - item = item->next) + std::vector<SPItem*> tmp=SP_ACTIVE_DESKTOP->getSelection()->itemList(); + for(std::vector<SPItem*>::const_iterator i=tmp.begin();i!=tmp.end();i++) { - if (SP_IS_TEXT(item->data) || SP_IS_FLOWTEXT(item->data)) + if (SP_IS_TEXT(*i) || SP_IS_FLOWTEXT(*i)) ++items; } @@ -542,20 +540,20 @@ void TextEdit::onApply() SPDesktop *desktop = SP_ACTIVE_DESKTOP; unsigned items = 0; - const GSList *item_list = desktop->getSelection()->itemList(); + const std::vector<SPItem*> item_list = desktop->getSelection()->itemList(); SPCSSAttr *css = fillTextStyle (); sp_desktop_set_style(desktop, css, true); - for (; item_list != NULL; item_list = item_list->next) { + for(std::vector<SPItem*>::const_iterator i=item_list.begin();i!=item_list.end();i++){ // apply style to the reprs of all text objects in the selection - if (SP_IS_TEXT (item_list->data)) { + if (SP_IS_TEXT (*i)) { // backwards compatibility: - reinterpret_cast<SPObject*>(item_list->data)->getRepr()->setAttribute("sodipodi:linespacing", sp_repr_css_property (css, "line-height", NULL)); + (*i)->getRepr()->setAttribute("sodipodi:linespacing", sp_repr_css_property (css, "line-height", NULL)); ++items; } - else if (SP_IS_FLOWTEXT (item_list->data)) + else if (SP_IS_FLOWTEXT (*i)) // no need to set sodipodi:linespacing, because Inkscape never supported it on flowtext ++items; } diff --git a/src/ui/dialog/text-edit.h b/src/ui/dialog/text-edit.h index 8683d80a3..117ad2e28 100644 --- a/src/ui/dialog/text-edit.h +++ b/src/ui/dialog/text-edit.h @@ -22,10 +22,6 @@ # 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 2f75a8922..de1d3028b 100644 --- a/src/ui/dialog/tile.h +++ b/src/ui/dialog/tile.h @@ -20,10 +20,6 @@ # 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 233d99750..498ad7822 100644 --- a/src/ui/dialog/transformation.cpp +++ b/src/ui/dialog/transformation.cpp @@ -15,10 +15,6 @@ # 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> @@ -655,7 +651,7 @@ void Transformation::updatePageTransform(Inkscape::Selection *selection) { if (selection && !selection->isEmpty()) { if (_check_replace_matrix.get_active()) { - Geom::Affine current (SP_ITEM(selection->itemList()->data)->transform); // take from the first item in selection + Geom::Affine current (selection->itemList()[0]->transform); // take from the first item in selection Geom::Affine new_displayed = current; @@ -740,20 +736,19 @@ void Transformation::applyPageMove(Inkscape::Selection *selection) if (_check_move_relative.get_active()) { // shift each object relatively to the previous one - using Inkscape::Util::GSListConstIterator; - std::list<SPItem *> selected; - selected.insert<GSListConstIterator<SPItem *> >(selected.end(), selection->itemList(), NULL); + std::vector<SPItem*> selected(selection->itemList()); if (selected.empty()) return; if (fabs(x) > 1e-6) { std::vector< BBoxSort > sorted; - for (std::list<SPItem *>::iterator it(selected.begin()); + for (std::vector<SPItem*>::iterator it(selected.begin()); it != selected.end(); ++it) { - Geom::OptRect bbox = (*it)->desktopPreferredBounds(); + SPItem* item = *it; + Geom::OptRect bbox = item->desktopPreferredBounds(); if (bbox) { - sorted.push_back(BBoxSort(*it, *bbox, Geom::X, x > 0? 1. : 0., x > 0? 0. : 1.)); + sorted.push_back(BBoxSort(item, *bbox, Geom::X, x > 0? 1. : 0., x > 0? 0. : 1.)); } } //sort bbox by anchors @@ -771,13 +766,14 @@ void Transformation::applyPageMove(Inkscape::Selection *selection) } if (fabs(y) > 1e-6) { std::vector< BBoxSort > sorted; - for (std::list<SPItem *>::iterator it(selected.begin()); + for (std::vector<SPItem*>::iterator it(selected.begin()); it != selected.end(); ++it) { - Geom::OptRect bbox = (*it)->desktopPreferredBounds(); + SPItem* item = *it; + Geom::OptRect bbox = item->desktopPreferredBounds(); if (bbox) { - sorted.push_back(BBoxSort(*it, *bbox, Geom::Y, y > 0? 1. : 0., y > 0? 0. : 1.)); + sorted.push_back(BBoxSort(item, *bbox, Geom::Y, y > 0? 1. : 0., y > 0? 0. : 1.)); } } //sort bbox by anchors @@ -815,8 +811,9 @@ void Transformation::applyPageScale(Inkscape::Selection *selection) bool transform_stroke = prefs->getBool("/options/transform/stroke", true); bool preserve = prefs->getBool("/options/preservetransform/value", false); if (prefs->getBool("/dialogs/transformation/applyseparately")) { - for (GSList const *l = selection->itemList(); l != NULL; l = l->next) { - SPItem *item = SP_ITEM(l->data); + std::vector<SPItem*> tmp=selection->itemList(); + for(std::vector<SPItem*>::const_iterator i=tmp.begin();i!=tmp.end();i++){ + SPItem *item = *i; Geom::OptRect bbox_pref = item->desktopPreferredBounds(); Geom::OptRect bbox_geom = item->desktopGeometricBounds(); if (bbox_pref && bbox_geom) { @@ -878,8 +875,9 @@ void Transformation::applyPageRotate(Inkscape::Selection *selection) } if (prefs->getBool("/dialogs/transformation/applyseparately")) { - for (GSList const *l = selection->itemList(); l != NULL; l = l->next) { - SPItem *item = SP_ITEM(l->data); + std::vector<SPItem*> tmp=selection->itemList(); + for(std::vector<SPItem*>::const_iterator i=tmp.begin();i!=tmp.end();i++){ + SPItem *item = *i; sp_item_rotate_rel(item, Geom::Rotate (angle*M_PI/180.0)); } } else { @@ -897,8 +895,9 @@ void Transformation::applyPageSkew(Inkscape::Selection *selection) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); if (prefs->getBool("/dialogs/transformation/applyseparately")) { - for (GSList const *l = selection->itemList(); l != NULL; l = l->next) { - SPItem *item = SP_ITEM(l->data); + std::vector<SPItem*> items=selection->itemList(); + for(std::vector<SPItem*>::const_iterator i = items.begin();i!=items.end();i++){ + SPItem *item = *i; if (!_units_skew.isAbsolute()) { // percentage double skewX = _scalar_skew_horizontal.getValue("%"); @@ -998,10 +997,11 @@ void Transformation::applyPageTransform(Inkscape::Selection *selection) } if (_check_replace_matrix.get_active()) { - for (GSList const *l = selection->itemList(); l != NULL; l = l->next) { - SPItem *item = SP_ITEM(l->data); + std::vector<SPItem*> tmp=selection->itemList(); + for(std::vector<SPItem*>::const_iterator i=tmp.begin();i!=tmp.end();i++){ + SPItem *item = *i; item->set_item_transform(displayed); - SP_OBJECT(item)->updateRepr(); + item->updateRepr(); } } else { sp_selection_apply_affine(selection, displayed); // post-multiply each object's transform @@ -1150,7 +1150,7 @@ void Transformation::onReplaceMatrixToggled() double f = _scalar_transform_f.getValue(); Geom::Affine displayed (a, b, c, d, e, f); - Geom::Affine current = SP_ITEM(selection->itemList()->data)->transform; // take from the first item in selection + Geom::Affine current = selection->itemList()[0]->transform; // take from the first item in selection Geom::Affine new_displayed; if (_check_replace_matrix.get_active()) { |
