]> git.lyx.org Git - features.git/commitdiff
remove a few rarely neede LyXTExt member functions
authorAndré Pönitz <poenitz@gmx.net>
Thu, 18 Mar 2004 13:28:49 +0000 (13:28 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Thu, 18 Mar 2004 13:28:49 +0000 (13:28 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8499 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView.C
src/BufferView_pimpl.C
src/PosIterator.C
src/lyxtext.h
src/text.C
src/text2.C
src/text3.C

index 573da75b7a14cc6ecbf575a810a59c445e8a433d..dc813f9b03591b67b2ba40574db6da479bb01681 100644 (file)
@@ -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;
 }
index 55e540cd4585835cadbc7b067701f9ec92898831..f706a06d6c06d2ab0073fef857aa2c9d0b6cbaf0 100644 (file)
@@ -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)));
 }
index 3dcd602eb2721a3eaae1dbdf22019322441f619c..67772f4b5c9795c8dc13f8606e1749d458672a68 100644 (file)
@@ -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();
index d715c15a4290cfe85cae6e988b4fdbf903640c57..e463e46a3f56ed29ceed4502e7f9aad4f038ab1b 100644 (file)
@@ -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;
 
        ///
index 03033d16d300315ec12daa6f7eea5854d0644f14..85cf1332d9fbe7e843686c6a9167108ae4d05cb2 100644 (file)
@@ -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));
 
index bdf2183f4355202ddd774a05223d0431da6d5b10..fbd42cd6fd316f3ca20d4aade4b803af15c1eee1 100644 (file)
@@ -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
index e907ac0f9efc3cb2612b9b9d52aa8631654e8f9d..ffc121ef12de0baafa29241bdf9e246abfa8ef99 100644 (file)
@@ -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 {