On Fri, Mar 19, 2004 at 10:19:00AM +0100, Alfredo Braunstein wrote:
> As it is, it doesn't even need recompilation!

sh...

> PS: are your private mail adress(es) working ok? I've sent you a mail last
> week and came back (tested with both)

andre.poenitz at
mathematik.tu-chemnitz.de 

should work.

Andre'
Only in lyx-devel/src: 1.diff
diff -p -r -U 4 -X excl.tmp lyx-devel-orig/src/BufferView.C lyx-devel/src/BufferView.C
--- lyx-devel-orig/src/BufferView.C     2004-03-18 20:08:03.000000000 +0100
+++ lyx-devel/src/BufferView.C  2004-03-19 00:48:47.000000000 +0100
@@ -369,17 +365,15 @@ LyXText * BufferView::text() const
 
 void BufferView::setCursor(ParIterator const & par, lyx::pos_type pos)
 {
        LCursor & cur = cursor();
-       cur.reset();
-       cur.push(buffer()->inset());
+       cur.reset(buffer()->inset());
        ParIterator::PosHolder const & positions = par.positions();
        int const last = par.size() - 1;
        for (int i = 0; i < last; ++i)
                (*positions[i].it)->inset->edit(cur, true);
        cur.resetAnchor();
-       LyXText * text = par.text(*buffer());
-       text->setCursor(cur, text->parOffset(par.pit()), pos);
+       par.text(*buffer())->setCursor(cur, par.pit(), pos);
 }
 
 
 /*
diff -p -r -U 4 -X excl.tmp lyx-devel-orig/src/BufferView_pimpl.C 
lyx-devel/src/BufferView_pimpl.C
--- lyx-devel-orig/src/BufferView_pimpl.C       2004-03-18 20:08:04.000000000 +0100
+++ lyx-devel/src/BufferView_pimpl.C    2004-03-19 00:57:39.000000000 +0100
@@ -441,16 +435,16 @@ void BufferView::Pimpl::scrollDocView(in
        int const height = defaultRowHeight();
        int const first = top_y() + height;
        int const last = top_y() + workarea().workHeight() - height;
 
-       bv_->cursor().reset();
+       bv_->cursor().reset(bv_->buffer()->inset());
        LyXText * text = bv_->text();
-       CursorSlice & cur = bv_->cursor().front();
-       int y = text->cursorY(cur);
+       int y = text->cursorY(bv_->cursor().front());
        if (y < first)
-               text->setCursorFromCoordinates(bv_->cursor(), 0, first);
-       else if (y > last)
-               text->setCursorFromCoordinates(bv_->cursor(), 0, last);
+               y = first;
+       if (y > last)
+               y = last;
+       text->setCursorFromCoordinates(bv_->cursor(), 0, y);
 
        owner_->updateLayoutChoice();
 }
 
@@ -1027,18 +1022,18 @@ bool BufferView::Pimpl::dispatch(FuncReq
                owner_->getDialogs().show("changes");
                break;
 
        case LFUN_ACCEPT_ALL_CHANGES: {
-               bv_->cursor().reset();
+               bv_->cursor().reset(bv_->buffer()->inset());
 #warning FIXME changes
                while (lyx::find::findNextChange(bv_))
                        bv_->getLyXText()->acceptChange(bv_->cursor());
                update();
                break;
        }
 
        case LFUN_REJECT_ALL_CHANGES: {
-               bv_->cursor().reset();
+               bv_->cursor().reset(bv_->buffer()->inset());
 #warning FIXME changes
                while (lyx::find::findNextChange(bv_))
                        bv_->getLyXText()->rejectChange(bv_->cursor());
                update();
@@ -1089,17 +1084,17 @@ bool BufferView::Pimpl::dispatch(FuncReq
                bv_->center();
                break;
 
        case LFUN_BEGINNINGBUFSEL:
-               bv_->cursor().reset();
+               bv_->cursor().reset(bv_->buffer()->inset());
                if (!cur.selection())
                        cur.resetAnchor();
                bv_->text()->cursorTop(cur);
                finishUndo();
                break;
 
        case LFUN_ENDBUFSEL:
-               bv_->cursor().reset();
+               bv_->cursor().reset(bv_->buffer()->inset());
                if (!cur.selection())
                        cur.resetAnchor();
                bv_->text()->cursorBottom(cur);
                finishUndo();
diff -p -r -U 4 -X excl.tmp lyx-devel-orig/src/cursor.C lyx-devel/src/cursor.C
--- lyx-devel-orig/src/cursor.C 2004-03-18 20:08:15.000000000 +0100
+++ lyx-devel/src/cursor.C      2004-03-19 00:44:08.000000000 +0100
@@ -85,14 +87,14 @@ LCursor::LCursor(BufferView & bv)
          cached_y_(0), x_target_(-1), selection_(false), mark_(false)
 {}
 
 
-void LCursor::reset()
+void LCursor::reset(InsetBase & inset)
 {
        clear();
-       push_back(CursorSlice());
+       push_back(CursorSlice(inset));
        anchor_.clear();
-       anchor_.push_back(CursorSlice());
+       anchor_.push_back(CursorSlice(inset));
        cached_y_ = 0;
        clearTargetX();
        selection_ = false;
        mark_ = false;
diff -p -r -U 4 -X excl.tmp lyx-devel-orig/src/cursor.h lyx-devel/src/cursor.h
--- lyx-devel-orig/src/cursor.h 2004-03-18 20:08:15.000000000 +0100
+++ lyx-devel/src/cursor.h      2004-03-19 00:45:41.000000000 +0100
@@ -158,10 +158,11 @@ public:
        /// get some interesting description of top position
        void info(std::ostream & os) const;
        /// are we in math mode (2), text mode (1) or unsure (0)?
        int currentMode();
-       /// reset cursor
-       void reset();
+       /// reset cursor bottom to the beginning of the given inset
+       // (sort of 'chroot' environment...)
+       void reset(InsetBase &);
        /// for spellchecking
        void replaceWord(std::string const & replacestring);
        /// update our view
        void update();
diff -p -r -U 4 -X excl.tmp lyx-devel-orig/src/paragraph.C lyx-devel/src/paragraph.C
--- lyx-devel-orig/src/paragraph.C      2004-03-18 20:08:27.000000000 +0100
+++ lyx-devel/src/paragraph.C   2004-03-19 03:51:11.000000000 +0100
@@ -79,41 +79,40 @@ Paragraph::Paragraph(Paragraph const & p
                width(par.width), layout_(par.layout_),
                text_(par.text_), begin_of_body_(par.begin_of_body_),
          pimpl_(new Paragraph::Pimpl(*par.pimpl_, this))
 {
+       //lyxerr << "Paragraph::Paragraph(Paragraph const&)" << endl;
        InsetList::iterator it = insetlist.begin();
        InsetList::iterator end = insetlist.end();
        for (; it != end; ++it)
                it->inset = it->inset->clone().release();
 }
 
 
-void Paragraph::operator=(Paragraph const & par)
+Paragraph & Paragraph::operator=(Paragraph const & par)
 {
        // needed as we will destroy the pimpl_ before copying it
-       if (&par != this)
-               return;
-
-       lyxerr << "Paragraph::operator=()" << endl;
-
-       itemdepth = par.itemdepth;
-
-       insetlist = par.insetlist;
-       InsetList::iterator it = insetlist.begin();
-       InsetList::iterator end = insetlist.end();
-       for (; it != end; ++it)
-               it->inset = it->inset->clone().release();
+       if (&par != this) {
+               itemdepth = par.itemdepth;
 
-       rows = par.rows;
-       y = par.y;
-       height = par.height;
-       width = par.width;
-       layout_ = par.layout();
-       text_ = par.text_;
-       begin_of_body_ = par.begin_of_body_;
+               insetlist = par.insetlist;
+               InsetList::iterator it = insetlist.begin();
+               InsetList::iterator end = insetlist.end();
+               for (; it != end; ++it)
+                       it->inset = it->inset->clone().release();
+
+               rows = par.rows;
+               y = par.y;
+               height = par.height;
+               width = par.width;
+               layout_ = par.layout();
+               text_ = par.text_;
+               begin_of_body_ = par.begin_of_body_;
 
-       delete pimpl_;
-       pimpl_ = new Pimpl(*par.pimpl_, this);
+               delete pimpl_;
+               pimpl_ = new Pimpl(*par.pimpl_, this);
+       }
+       return *this;
 }
 
 
 Paragraph::~Paragraph()
diff -p -r -U 4 -X excl.tmp lyx-devel-orig/src/paragraph.h lyx-devel/src/paragraph.h
--- lyx-devel-orig/src/paragraph.h      2004-02-25 15:44:03.000000000 +0100
+++ lyx-devel/src/paragraph.h   2004-03-19 03:46:02.000000000 +0100
@@ -64,9 +64,9 @@ public:
        Paragraph();
        ///
        Paragraph(Paragraph const &);
        ///
-       void operator=(Paragraph const &);
+       Paragraph & operator=(Paragraph const &);
        ///
        ~Paragraph();
 
        ///

Reply via email to