]> git.lyx.org Git - lyx.git/blobdiff - src/Text2.cpp
SCons: msvc does not need this /TP option any more after we rename .C => .cpp. Also...
[lyx.git] / src / Text2.cpp
index 04f23499a5a45318d5885b55316bfd083058d979..92eaba739b9ab2fc193f5364f56a08b9a36e5502 100644 (file)
@@ -314,25 +314,16 @@ void Text::setInsetFont(Buffer const & buffer, pit_type pit,
                     pars_[pit].getInset(pos)->noFontChange());
 
        Inset * const inset = pars_[pit].getInset(pos);
-       DocIterator dit = doc_iterator_begin(*inset);
-       // start of the last cell
-       DocIterator end = dit;
-       end.idx() = end.lastidx();
-
-       while (true) {
-               Text * text = dit.text();
-               Inset * cell = dit.realInset();
-               if (text && cell) {
-                       DocIterator cellbegin = doc_iterator_begin(*cell);
+       CursorSlice::idx_type endidx = inset->nargs();
+       for (CursorSlice cs(*inset); cs.idx() != endidx; ++cs.idx()) {
+               Text * text = cs.text();
+               if (text) {
                        // last position of the cell
-                       DocIterator cellend = cellbegin;
+                       CursorSlice cellend = cs;
                        cellend.pit() = cellend.lastpit();
                        cellend.pos() = cellend.lastpos();
-                       text->setFont(buffer, cellbegin.top(), cellend.top(), font, toggleall);
+                       text->setFont(buffer, cs, cellend, font, toggleall);
                }
-               if (dit == end)
-                       break;
-               dit.forwardIdx();
        }
 }
 
@@ -380,7 +371,7 @@ void Text::setLayout(Cursor & cur, docstring const & layout)
        BOOST_ASSERT(this == cur.text());
        // special handling of new environment insets
        BufferView & bv = cur.bv();
-       BufferParams const & params = bv.buffer()->params();
+       BufferParams const & params = bv.buffer().params();
        Layout_ptr const & lyxlayout = params.getTextClass()[layout];
        if (lyxlayout->is_environment) {
                // move everything in a new environment inset