From: André Pönitz Date: Thu, 18 Mar 2004 13:28:49 +0000 (+0000) Subject: remove a few rarely neede LyXTExt member functions X-Git-Tag: 1.6.10~15457 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=9e78fe66dec4adbbbf9f0a990ff098023cec86de;p=features.git remove a few rarely neede LyXTExt member functions git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8499 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/BufferView.C b/src/BufferView.C index 573da75b7a..dc813f9b03 100644 --- a/src/BufferView.C +++ b/src/BufferView.C @@ -267,7 +267,9 @@ bool BufferView::insertLyXFile(string const & filen) cursor().clearSelection(); text()->breakParagraph(cursor()); - bool res = buffer()->readFile(fname, text()->cursorPar()); + BOOST_ASSERT(cursor().inTexted()); + LyXText * text = cursor().text(); + bool res = buffer()->readFile(fname, text->getPar(cursor().par())); resize(); return res; } diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index 55e540cd45..f706a06d6c 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -616,9 +616,10 @@ void BufferView::Pimpl::savePosition(unsigned int i) { if (i >= saved_positions_num) return; + BOOST_ASSERT(bv_->cursor().inTexted()); saved_positions[i] = Position(buffer_->fileName(), - bv_->text()->cursorPar()->id(), - bv_->text()->cursor().pos()); + bv_->cursor().paragraph().id(), + bv_->cursor().pos()); if (i > 0) owner_->message(bformat(_("Saved bookmark %1$s"), tostr(i))); } diff --git a/src/PosIterator.C b/src/PosIterator.C index 3dcd602eb2..67772f4b5c 100644 --- a/src/PosIterator.C +++ b/src/PosIterator.C @@ -38,9 +38,11 @@ PosIterator::PosIterator(ParagraphList * pl, ParagraphList::iterator pit, PosIterator::PosIterator(BufferView & bv) { - LyXText * text = bv.getLyXText(); - lyx::pos_type pos = text->cursor().pos(); - ParagraphList::iterator pit = text->cursorPar(); + LCursor & cur = bv.cursor(); + BOOST_ASSERT(cur.inTexted()); + LyXText * text = cur.text(); + lyx::pos_type pos = cur.pos(); + ParagraphList::iterator pit = text->getPar(cur.par()); ParIterator par = bv.buffer()->par_iterator_begin(); ParIterator end = bv.buffer()->par_iterator_end(); diff --git a/src/lyxtext.h b/src/lyxtext.h index d715c15a42..e463e46a3f 100644 --- a/src/lyxtext.h +++ b/src/lyxtext.h @@ -92,9 +92,6 @@ public: /// Returns whether something would be changed by changeDepth bool changeDepthAllowed(LCursor & cur, bv_funcs::DEPTH_CHANGE type); - /// get the depth at current cursor position - int getDepth() const; - /// Set font over selection paragraphs and rebreak. void setFont(LCursor & cur, LyXFont const &, bool toggleall = false); @@ -145,8 +142,6 @@ public: ParagraphList::iterator getPar(par_type par) const; /// int parOffset(ParagraphList::iterator pit) const; - /// # FIXME: should not be used - ParagraphList::iterator cursorPar() const; // Returns the current font and depth as a message. std::string LyXText::currentState(LCursor & cur); @@ -372,11 +367,7 @@ public: /// int cursorY(CursorSlice const & cursor) const; - /// the current cursor slice - CursorSlice & cursor(); - /// the current cursor slice - CursorSlice const & cursor() const; - + /// friend class LyXScreen; /// diff --git a/src/text.C b/src/text.C index 03033d16d3..85cf1332d9 100644 --- a/src/text.C +++ b/src/text.C @@ -1294,7 +1294,7 @@ void LyXText::changeCase(LCursor & cur, LyXText::TextCase action) from = cur.selBegin(); to = cur.selEnd(); } else { - from = cursor(); + from = cur.top(); getWord(from, to, lyx::PARTIAL_WORD); setCursor(cur, to.par(), to.pos() + 1); } @@ -1436,14 +1436,6 @@ void LyXText::backspace(LCursor & cur) } -ParagraphList::iterator LyXText::cursorPar() const -{ - //lyxerr << "### cursorPar: cursor: " << bv()->cursor() << endl; - //lyxerr << "xxx cursorPar: cursor: " << cursor() << endl; - return getPar(cursor().par()); -} - - ParagraphList::iterator LyXText::getPar(CursorSlice const & cur) const { return getPar(cur.par()); @@ -1495,12 +1487,6 @@ LyXText::getRowNearY(int y, ParagraphList::iterator & pit) const } -int LyXText::getDepth() const -{ - return cursorPar()->getDepth(); -} - - RowList::iterator LyXText::firstRow() const { return paragraphs().front().rows.begin(); @@ -1874,31 +1860,6 @@ int LyXText::cursorY(CursorSlice const & cur) const } -CursorSlice & LyXText::cursor() -{ - //lyxerr << "# accessing slice " << findText(this) << endl; - if (this != bv()->cursor().text()) { - lyxerr << "cursor: " << bv()->cursor() - << "\ntext: " << bv()->cursor().text() - << "\nthis: " << this << endl; - BOOST_ASSERT(false); - } - return bv()->cursor().top(); -} - - -CursorSlice const & LyXText::cursor() const -{ - if (this != bv()->cursor().text()) { - lyxerr << "cursor: " << bv()->cursor() - << "\ntext: " << bv()->cursor().text() - << "\nthis: " << this << endl; - BOOST_ASSERT(false); - } - return bv()->cursor().top(); -} - - void LyXText::replaceSelection(LCursor & cur) { BOOST_ASSERT(this == cur.text()); @@ -1944,7 +1905,7 @@ string LyXText::currentState(LCursor & cur) // os << bformat(_("Font: %1$s"), font.stateText(&buffer->params)); // The paragraph depth - int depth = getDepth(); + int depth = cur.paragraph().getDepth(); if (depth > 0) os << bformat(_(", Depth: %1$s"), tostr(depth)); diff --git a/src/text2.C b/src/text2.C index bdf2183f43..fbd42cd6fd 100644 --- a/src/text2.C +++ b/src/text2.C @@ -1036,7 +1036,7 @@ void LyXText::insertStringAsLines(LCursor & cur, string const & str) { ParagraphList::iterator pit = getPar(cur.par()); ParagraphList::iterator endpit = boost::next(pit); - pos_type pos = cursor().pos(); + pos_type pos = cur.pos(); recordUndo(cur); // only to be sure, should not be neccessary diff --git a/src/text3.C b/src/text3.C index e907ac0f9e..ffc121ef12 100644 --- a/src/text3.C +++ b/src/text3.C @@ -265,7 +265,7 @@ void LyXText::gotoInset(LCursor & cur, cur.par() = 0; cur.pos() = 0; if (!gotoNextInset(cur, codes, contents)) { - cursor() = tmp; + cur.top() = tmp; cur.message(_("No more insets")); } } else {