From 193b25a53c51a36fe9538e03203b0054c8cfc355 Mon Sep 17 00:00:00 2001 From: mc <> Date: Wed, 18 Feb 2015 02:02:37 +0100 Subject: Just... some... more... lines... (bzr r13922.1.2) --- src/ui/dialog/font-substitution.cpp | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'src/ui/dialog/font-substitution.cpp') diff --git a/src/ui/dialog/font-substitution.cpp b/src/ui/dialog/font-substitution.cpp index ae03bdf0e..625ed99b9 100644 --- a/src/ui/dialog/font-substitution.cpp +++ b/src/ui/dialog/font-substitution.cpp @@ -70,19 +70,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); + SelContainer 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, SelContainer &l) { Gtk::MessageDialog warning(_("\nSome fonts are not available and have been substituted."), false, Gtk::MESSAGE_INFO, Gtk::BUTTONS_OK, true); @@ -152,20 +148,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) +SelContainer FontSubstitution::getFontReplacedItems(SPDocument* doc, Glib::ustring *out) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; - GSList *allList = NULL; - GSList *outList = NULL; + SelContainer allList; + SelContainer outList,x,y; std::set setErrors; std::set setFontSpans; std::map 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(SelContainer::const_iterator i = allList.begin();i!=allList.end();i++){ + SPItem *item = SP_ITEM(*i); SPStyle *style = item->style; Glib::ustring family = ""; @@ -254,7 +248,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_front(item); } } -- cgit v1.2.3 From 5fd00cab14d48beaf2279a2b8f3ad5b02b76c87b Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Thu, 19 Feb 2015 04:25:21 +0100 Subject: Put a few std::vector (bzr r13922.1.5) --- src/ui/dialog/font-substitution.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/ui/dialog/font-substitution.cpp') diff --git a/src/ui/dialog/font-substitution.cpp b/src/ui/dialog/font-substitution.cpp index 625ed99b9..e9a0fc017 100644 --- a/src/ui/dialog/font-substitution.cpp +++ b/src/ui/dialog/font-substitution.cpp @@ -70,7 +70,7 @@ FontSubstitution::checkFontSubstitutions(SPDocument* doc) int show_dlg = prefs->getInt("/options/font/substitutedlg", 0); if (show_dlg) { Glib::ustring out; - SelContainer l = getFontReplacedItems(doc, &out); + std::vector l = getFontReplacedItems(doc, &out); if (out.length() > 0) { show(out, l); } @@ -78,7 +78,7 @@ FontSubstitution::checkFontSubstitutions(SPDocument* doc) } void -FontSubstitution::show(Glib::ustring out, SelContainer &l) +FontSubstitution::show(Glib::ustring out, std::vector &l) { Gtk::MessageDialog warning(_("\nSome fonts are not available and have been substituted."), false, Gtk::MESSAGE_INFO, Gtk::BUTTONS_OK, true); @@ -148,17 +148,17 @@ FontSubstitution::show(Glib::ustring out, SelContainer &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. */ -SelContainer FontSubstitution::getFontReplacedItems(SPDocument* doc, Glib::ustring *out) +std::vector FontSubstitution::getFontReplacedItems(SPDocument* doc, Glib::ustring *out) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; - SelContainer allList; - SelContainer outList,x,y; + std::vector allList; + std::vector outList,x,y; std::set setErrors; std::set setFontSpans; std::map mapFontStyles; allList = get_all_items(x, doc->getRoot(), desktop, false, false, true, y); - for(SelContainer::const_iterator i = allList.begin();i!=allList.end();i++){ + for(std::vector::const_iterator i = allList.begin();i!=allList.end();i++){ SPItem *item = SP_ITEM(*i); SPStyle *style = item->style; Glib::ustring family = ""; @@ -214,8 +214,8 @@ SelContainer FontSubstitution::getFontReplacedItems(SPDocument* doc, Glib::ustri } // Check if any document styles are not in the actual layout - std::map::const_iterator mapIter; - for (mapIter = mapFontStyles.begin(); mapIter != mapFontStyles.end(); ++mapIter) { + std::map::const_reverse_iterator mapIter; + for (mapIter = mapFontStyles.rbegin(); mapIter != mapFontStyles.rend(); ++mapIter) { SPItem *item = mapIter->first; Glib::ustring fonts = mapIter->second; @@ -248,7 +248,7 @@ SelContainer FontSubstitution::getFontReplacedItems(SPDocument* doc, Glib::ustri Glib::ustring err = Glib::ustring::compose( _("Font '%1' substituted with '%2'"), fonts.c_str(), subName.c_str()); setErrors.insert(err); - outList.push_front(item); + outList.push_back(item); } } -- cgit v1.2.3 From 9a7fa4d1899d30ec745107823f307b2a0bf3172f Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Fri, 27 Feb 2015 03:10:36 +0100 Subject: corrected the casts (hopefully) (bzr r13922.1.10) --- src/ui/dialog/font-substitution.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/dialog/font-substitution.cpp') diff --git a/src/ui/dialog/font-substitution.cpp b/src/ui/dialog/font-substitution.cpp index e9a0fc017..1be87d180 100644 --- a/src/ui/dialog/font-substitution.cpp +++ b/src/ui/dialog/font-substitution.cpp @@ -159,7 +159,7 @@ std::vector FontSubstitution::getFontReplacedItems(SPDocument* doc, Gli allList = get_all_items(x, doc->getRoot(), desktop, false, false, true, y); for(std::vector::const_iterator i = allList.begin();i!=allList.end();i++){ - SPItem *item = SP_ITEM(*i); + SPItem *item = *i; SPStyle *style = item->style; Glib::ustring family = ""; -- cgit v1.2.3 From ba4dbfb351180e0fc4ad57be6e3534fa2ab5cf8c Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Tue, 28 Apr 2015 00:38:31 +0100 Subject: Fix unnecessary inclusion of glibmm/threads.h. This can be resolved by ensuring that glibmm headers always preceed glib.h headers. Same applies with gtkmm/gtk+ etc (bzr r14064) --- src/ui/dialog/font-substitution.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/ui/dialog/font-substitution.cpp') diff --git a/src/ui/dialog/font-substitution.cpp b/src/ui/dialog/font-substitution.cpp index ae03bdf0e..2ef61978f 100644 --- a/src/ui/dialog/font-substitution.cpp +++ b/src/ui/dialog/font-substitution.cpp @@ -10,10 +10,6 @@ # include #endif -#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H -#include -#endif - #include #include #include -- cgit v1.2.3