summaryrefslogtreecommitdiffstats
path: root/src/text-chemistry.cpp
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2016-10-03 20:51:05 +0000
committerjabiertxof <info@marker.es>2016-10-03 20:51:05 +0000
commit4db35e8a6706ddece9e977e5f26d4a6867ff8cbe (patch)
treef9711f260f694d96e26bf3216fb64f2b38611b2b /src/text-chemistry.cpp
parentupdate to trunk (diff)
parentMerge in jabiertxof's hover information for measure tool (diff)
downloadinkscape-4db35e8a6706ddece9e977e5f26d4a6867ff8cbe.tar.gz
inkscape-4db35e8a6706ddece9e977e5f26d4a6867ff8cbe.zip
Update to trunk
(bzr r15017.1.35)
Diffstat (limited to 'src/text-chemistry.cpp')
-rw-r--r--src/text-chemistry.cpp58
1 files changed, 29 insertions, 29 deletions
diff --git a/src/text-chemistry.cpp b/src/text-chemistry.cpp
index fbbbe5807..2b731c75d 100644
--- a/src/text-chemistry.cpp
+++ b/src/text-chemistry.cpp
@@ -12,7 +12,7 @@
*/
#ifdef HAVE_CONFIG_H
-# include <config.h>
+#include <config.h>
#endif
#include <cstring>
@@ -27,7 +27,6 @@
#include "document.h"
#include "document-undo.h"
#include "message-stack.h"
-#include "selection.h"
#include "style.h"
#include "text-editing.h"
@@ -43,8 +42,8 @@ using Inkscape::DocumentUndo;
static SPItem *
flowtext_in_selection(Inkscape::Selection *selection)
{
- std::vector<SPItem*> items = selection->itemList();
- for(std::vector<SPItem*>::const_iterator i=items.begin();i!=items.end();++i){
+ auto items = selection->items();
+ for(auto i=items.begin();i!=items.end();++i){
if (SP_IS_FLOWTEXT(*i))
return *i;
}
@@ -54,8 +53,8 @@ flowtext_in_selection(Inkscape::Selection *selection)
static SPItem *
text_or_flowtext_in_selection(Inkscape::Selection *selection)
{
- std::vector<SPItem*> items = selection->itemList();
- for(std::vector<SPItem*>::const_iterator i=items.begin();i!=items.end();++i){
+ auto items = selection->items();
+ for(auto i=items.begin();i!=items.end();++i){
if (SP_IS_TEXT(*i) || SP_IS_FLOWTEXT(*i))
return *i;
}
@@ -65,8 +64,8 @@ text_or_flowtext_in_selection(Inkscape::Selection *selection)
static SPItem *
shape_in_selection(Inkscape::Selection *selection)
{
- std::vector<SPItem*> items = selection->itemList();
- for(std::vector<SPItem*>::const_iterator i=items.begin();i!=items.end();++i){
+ auto items = selection->items();
+ for(auto i=items.begin();i!=items.end();++i){
if (SP_IS_SHAPE(*i))
return *i;
}
@@ -87,7 +86,7 @@ text_put_on_path()
Inkscape::XML::Document *xml_doc = desktop->doc()->getReprDoc();
- if (!text || !shape || selection->itemList().size() != 2) {
+ if (!text || !shape || boost::distance(selection->items()) != 2) {
desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>a text and a path</b> to put text on path."));
return;
}
@@ -142,8 +141,8 @@ text_put_on_path()
// make a list of text children
GSList *text_reprs = NULL;
- for (SPObject *o = text->children; o != NULL; o = o->next) {
- text_reprs = g_slist_prepend(text_reprs, o->getRepr());
+ for(auto& o: text->children) {
+ text_reprs = g_slist_prepend(text_reprs, o.getRepr());
}
// create textPath and put it into the text
@@ -196,8 +195,8 @@ text_remove_from_path()
}
bool did = false;
- std::vector<SPItem*> items(selection->itemList());
- for(std::vector<SPItem*>::const_iterator i=items.begin();i!=items.end();++i){
+ auto items = selection->items();
+ for(auto i=items.begin();i!=items.end();++i){
SPObject *obj = *i;
if (SP_IS_TEXT_TEXTPATH(obj)) {
@@ -214,7 +213,8 @@ text_remove_from_path()
} else {
DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_TEXT,
_("Remove text from path"));
- selection->setList(selection->itemList()); // reselect to update statusbar description
+ std::vector<SPItem *> vec(selection->items().begin(), selection->items().end());
+ selection->setList(vec); // reselect to update statusbar description
}
}
@@ -239,9 +239,9 @@ text_remove_all_kerns_recursively(SPObject *o)
g_strfreev(xa_comma);
}
- for (SPObject *i = o->firstChild(); i != NULL; i = i->getNext()) {
- text_remove_all_kerns_recursively(i);
- i->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_TEXT_LAYOUT_MODIFIED_FLAG);
+ for (auto& i: o->children) {
+ text_remove_all_kerns_recursively(&i);
+ i.requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_TEXT_LAYOUT_MODIFIED_FLAG);
}
}
@@ -260,8 +260,8 @@ text_remove_all_kerns()
bool did = false;
- std::vector<SPItem*> items = selection->itemList();
- for(std::vector<SPItem*>::const_iterator i=items.begin();i!=items.end();++i){
+ auto items = selection->items();
+ for(auto i=items.begin();i!=items.end();++i){
SPObject *obj = *i;
if (!SP_IS_TEXT(obj) && !SP_IS_TSPAN(obj) && !SP_IS_FLOWTEXT(obj)) {
@@ -296,7 +296,7 @@ text_flow_into_shape()
SPItem *text = text_or_flowtext_in_selection(selection);
SPItem *shape = shape_in_selection(selection);
- if (!text || !shape || selection->itemList().size() < 2) {
+ if (!text || !shape || boost::distance(selection->items()) < 2) {
desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>a text</b> and one or more <b>paths or shapes</b> to flow text into frame."));
return;
}
@@ -320,8 +320,8 @@ text_flow_into_shape()
g_return_if_fail(SP_IS_FLOWREGION(object));
/* Add clones */
- std::vector<SPItem*> items = selection->itemList();
- for(std::vector<SPItem*>::const_iterator i=items.begin();i!=items.end();++i){
+ auto items = selection->items();
+ for(auto i=items.begin();i!=items.end();++i){
SPItem *item = *i;
if (SP_IS_SHAPE(item)){
Inkscape::XML::Node *clone = xml_doc->createElement("svg:use");
@@ -352,9 +352,9 @@ text_flow_into_shape()
Inkscape::GC::release(text_repr);
} else { // reflow an already flowed text, preserving paras
- for (SPObject *o = text->children; o != NULL; o = o->next) {
- if (SP_IS_FLOWPARA(o)) {
- Inkscape::XML::Node *para_repr = o->getRepr()->duplicate(xml_doc);
+ for(auto& o: text->children) {
+ if (SP_IS_FLOWPARA(&o)) {
+ Inkscape::XML::Node *para_repr = o.getRepr()->duplicate(xml_doc);
root_repr->appendChild(para_repr);
object = doc->getObjectByRepr(para_repr);
g_return_if_fail(SP_IS_FLOWPARA(object));
@@ -387,7 +387,7 @@ text_unflow ()
Inkscape::Selection *selection = desktop->getSelection();
- if (!flowtext_in_selection(selection) || selection->itemList().size() < 1) {
+ if (!flowtext_in_selection(selection) || boost::distance(selection->items()) < 1) {
desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>a flowed text</b> to unflow it."));
return;
}
@@ -395,8 +395,8 @@ text_unflow ()
std::vector<SPItem*> new_objs;
GSList *old_objs = NULL;
- std::vector<SPItem*> items = selection->itemList();
- for(std::vector<SPItem*>::const_iterator i=items.begin();i!=items.end();++i){
+ auto items = selection->items();
+ for(auto i=items.begin();i!=items.end();++i){
if (!SP_IS_FLOWTEXT(*i)) {
continue;
@@ -480,7 +480,7 @@ flowtext_to_text()
bool did = false;
std::vector<Inkscape::XML::Node*> reprs;
- std::vector<SPItem*> items(selection->itemList());
+ std::vector<SPItem*> items(selection->items().begin(), selection->items().end());
for(std::vector<SPItem*>::const_iterator i=items.begin();i!=items.end();++i){
SPItem *item = *i;