X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FText2.cpp;h=45fb9dfe6910b6e275cb64b6e2712cdf7cebad7b;hb=4080450341a4ed1cec0e4f72d9c917d2c7378157;hp=24365e99f30f99f96bb41a088e19bcadb96b5598;hpb=3fcc6711f09883c6391429c00d9964d5665f076e;p=lyx.git diff --git a/src/Text2.cpp b/src/Text2.cpp index 24365e99f3..45fb9dfe69 100644 --- a/src/Text2.cpp +++ b/src/Text2.cpp @@ -150,9 +150,7 @@ Font Text::getFont(Buffer const & buffer, Paragraph const & par, BOOST_ASSERT(pos >= 0); Layout_ptr const & layout = par.layout(); -#ifdef WITH_WARNINGS -#warning broken? -#endif + // FIXME: broken? BufferParams const & params = buffer.params(); pos_type const body_pos = par.beginOfBody(); @@ -329,7 +327,7 @@ void Text::setInsetFont(Buffer const & buffer, pit_type pit, DocIterator cellend = cellbegin; cellend.pit() = cellend.lastpit(); cellend.pos() = cellend.lastpos(); - text->setFont(buffer, cellbegin, cellend, font, toggleall); + text->setFont(buffer, cellbegin.top(), cellend.top(), font, toggleall); } if (dit == end) break; @@ -358,7 +356,7 @@ pit_type Text::undoSpan(pit_type pit) void Text::setLayout(Buffer const & buffer, pit_type start, pit_type end, - string const & layout) + docstring const & layout) { BOOST_ASSERT(start != end); @@ -376,7 +374,7 @@ void Text::setLayout(Buffer const & buffer, pit_type start, pit_type end, // set layout over selection and make a total rebreak of those paragraphs -void Text::setLayout(Cursor & cur, string const & layout) +void Text::setLayout(Cursor & cur, docstring const & layout) { BOOST_ASSERT(this == cur.text()); // special handling of new environment insets @@ -385,7 +383,7 @@ void Text::setLayout(Cursor & cur, string const & layout) Layout_ptr const & lyxlayout = params.getTextClass()[layout]; if (lyxlayout->is_environment) { // move everything in a new environment inset - LYXERR(Debug::DEBUG) << "setting layout " << layout << endl; + LYXERR(Debug::DEBUG) << "setting layout " << to_utf8(layout) << endl; lyx::dispatch(FuncRequest(LFUN_LINE_BEGIN)); lyx::dispatch(FuncRequest(LFUN_LINE_END_SELECT)); lyx::dispatch(FuncRequest(LFUN_CUT)); @@ -494,13 +492,13 @@ void Text::setFont(Cursor & cur, Font const & font, bool toggleall) // Ok, we have a selection. recordUndoSelection(cur); - setFont(cur.buffer(), cur.selectionBegin(), cur.selectionEnd(), font, - toggleall); + setFont(cur.buffer(), cur.selectionBegin().top(), + cur.selectionEnd().top(), font, toggleall); } -void Text::setFont(Buffer const & buffer, DocIterator const & begin, - DocIterator const & end, Font const & font, +void Text::setFont(Buffer const & buffer, CursorSlice const & begin, + CursorSlice const & end, Font const & font, bool toggleall) { // Don't use forwardChar here as ditend might have @@ -508,7 +506,7 @@ void Text::setFont(Buffer const & buffer, DocIterator const & begin, // Can't use forwardPos either as this descends into // nested insets. Language const * language = buffer.params().language; - for (DocIterator dit = begin; dit != end; dit.forwardPosNoDescend()) { + for (CursorSlice dit = begin; dit != end; dit.forwardPos()) { if (dit.pos() != dit.lastpos()) { pit_type const pit = dit.pit(); pos_type const pos = dit.pos(); @@ -649,12 +647,8 @@ void Text::setParagraph(Cursor & cur, params.spacing(spacing); // does the layout allow the new alignment? - //FIXME The reason we need the first check is because - //LYX_ALIGN_LAYOUT isn't required to be possible. It - //should be...and will be. - if ((align == LYX_ALIGN_LAYOUT) || - (align & par.layout()->alignpossible)) - params.align(align); + if (align & par.layout()->alignpossible) + params.align(align); par.setLabelWidthString(labelwidthstring); params.noindent(noindent); } @@ -1151,12 +1145,10 @@ bool Text::deleteEmptyParagraphMechanism(Cursor & cur, && oldpar.isLineSeparator(old.pos() - 1) && !oldpar.isDeleted(old.pos() - 1)) { oldpar.eraseChar(old.pos() - 1, cur.buffer().params().trackChanges); -#ifdef WITH_WARNINGS -#warning This will not work anymore when we have multiple views of the same buffer +// FIXME: This will not work anymore when we have multiple views of the same buffer // In this case, we will have to correct also the cursors held by // other bufferviews. It will probably be easier to do that in a more // automated way in CursorSlice code. (JMarc 26/09/2001) -#endif // correct all cursor parts if (same_par) { fixCursorAfterDelete(cur.top(), old.top()); @@ -1186,7 +1178,7 @@ bool Text::deleteEmptyParagraphMechanism(Cursor & cur, ParagraphList & plist = old.text()->paragraphs(); plist.erase(boost::next(plist.begin(), old.pit())); - // see #warning above + // see #warning (FIXME?) above if (cur.depth() >= old.depth()) { CursorSlice & curslice = cur[old.depth() - 1]; if (&curslice.inset() == &old.inset()