summaryrefslogtreecommitdiffstats
path: root/src/widgets/text-toolbar.cpp
diff options
context:
space:
mode:
authorMarc Jeanmougin <marc@jeanmougin.fr>2015-04-29 21:14:01 +0000
committerMarc Jeanmougin <mc@M0nst3r.bouyguesbox.fr>2015-04-29 21:14:01 +0000
commit9b7af8caac08ad42a48214518bc004e258eb5873 (patch)
treedcaaac56217eb5da334ab420f5e791cf7eb70f23 /src/widgets/text-toolbar.cpp
parentBetter solution picking (diff)
parentcorrected test file (diff)
downloadinkscape-9b7af8caac08ad42a48214518bc004e258eb5873.tar.gz
inkscape-9b7af8caac08ad42a48214518bc004e258eb5873.zip
bzr merge lp:~mc.../inkscape/SelContainer
The main change of this branch is that the container for selections is now a std::vector and not a GSList. This change propagates in most of the codebase. Normally, there are no changes of semantics, except the following: -> childList is now in the intuitive order (childList()[0] is now firstChild) -> sp_selection_paste_impl is now in the opposite order (change is local to selection-chemistry.cpp, and simplify a few things there) -> selection.setReprList now takes the list in the opposite order. It was always the case (the list was always reversed before handing to it) -> a few comparison functions now work "the c++ way": the C way was to return -1 if a<b, 0 if a==b and 1 if a>b, now they return (bool)(a<b) so they can be used with std::sort (bzr r14074)
Diffstat (limited to 'src/widgets/text-toolbar.cpp')
-rw-r--r--src/widgets/text-toolbar.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/widgets/text-toolbar.cpp b/src/widgets/text-toolbar.cpp
index ec011fffd..7b22e4af7 100644
--- a/src/widgets/text-toolbar.cpp
+++ b/src/widgets/text-toolbar.cpp
@@ -372,9 +372,10 @@ static void sp_text_align_mode_changed( EgeSelectOneAction *act, GObject *tbl )
// move the x of all texts to preserve the same bbox
Inkscape::Selection *selection = desktop->getSelection();
- for (GSList const *items = selection->itemList(); items != NULL; items = items->next) {
- if (SP_IS_TEXT(SP_ITEM(items->data))) {
- SPItem *item = SP_ITEM(items->data);
+ std::vector<SPItem*> itemlist=selection->itemList();
+ for(std::vector<SPItem*>::const_iterator i=itemlist.begin();i!=itemlist.end();i++){
+ if (SP_IS_TEXT(*i)) {
+ SPItem *item = *i;
unsigned writing_mode = item->style->writing_mode.value;
// below, variable names suggest horizontal move, but we check the writing direction
@@ -523,11 +524,11 @@ static void sp_text_lineheight_value_changed( GtkAdjustment *adj, GObject *tbl )
// Until deprecated sodipodi:linespacing purged:
Inkscape::Selection *selection = desktop->getSelection();
- GSList const *items = selection->itemList();
bool modmade = false;
- for (; items != NULL; items = items->next) {
- if (SP_IS_TEXT (items->data)) {
- SP_OBJECT(items->data)->getRepr()->setAttribute("sodipodi:linespacing", sp_repr_css_property (css, "line-height", NULL));
+ std::vector<SPItem*> itemlist=selection->itemList();
+ for(std::vector<SPItem*>::const_iterator i=itemlist.begin();i!=itemlist.end();i++){
+ if (SP_IS_TEXT (*i)) {
+ (*i)->getRepr()->setAttribute("sodipodi:linespacing", sp_repr_css_property (css, "line-height", NULL));
modmade = true;
}
}
@@ -869,12 +870,11 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/
// Only flowed text can be justified, only normal text can be kerned...
// Find out if we have flowed text now so we can use it several places
gboolean isFlow = false;
- for (GSList const *items = SP_ACTIVE_DESKTOP->getSelection()->itemList();
- items != NULL;
- items = items->next) {
+ std::vector<SPItem*> itemlist=SP_ACTIVE_DESKTOP->getSelection()->itemList();
+ for(std::vector<SPItem*>::const_iterator i=itemlist.begin();i!=itemlist.end();i++){
// const gchar* id = reinterpret_cast<SPItem *>(items->data)->getId();
// std::cout << " " << id << std::endl;
- if( SP_IS_FLOWTEXT(SP_ITEM(items->data))) {
+ if( SP_IS_FLOWTEXT(*i)) {
isFlow = true;
// std::cout << " Found flowed text" << std::endl;
break;
@@ -1159,14 +1159,14 @@ static void sp_text_toolbox_select_cb( GtkEntry* entry, GtkEntryIconPosition /*p
//std::cout << "text_toolbox_missing_font_cb: selecting: " << family << std::endl;
// Get all items with matching font-family set (not inherited!).
- GSList *selectList = NULL;
+ std::vector<SPItem*> selectList;
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
SPDocument *document = desktop->getDocument();
- GSList *allList = get_all_items(NULL, document->getRoot(), desktop, false, false, true, NULL);
- for (GSList *i = allList; i != NULL; i = i->next) {
-
- SPItem *item = SP_ITEM(i->data);
+ std::vector<SPItem*> x,y;
+ std::vector<SPItem*> allList = get_all_items(x, document->getRoot(), desktop, false, false, true, y);
+ for(std::vector<SPItem*>::const_reverse_iterator i=allList.rbegin();i!=allList.rend();i++){
+ SPItem *item = *i;
SPStyle *style = item->style;
if (style) {
@@ -1183,7 +1183,7 @@ static void sp_text_toolbox_select_cb( GtkEntry* entry, GtkEntryIconPosition /*p
if (family_style.compare( family ) == 0 ) {
//std::cout << " found: " << item->getId() << std::endl;
- selectList = g_slist_prepend (selectList, item);
+ selectList.push_back(item);
}
}
}