For some time, .ix() and .iy() have been exactly the same values as .x()
and .y(). This patch is a  no-functional-change cleanup. See my other
post for cursor placement issues.

OK ?

 11 files changed, 31 insertions(+), 85 deletions(-)

regards
john


Index: BufferView.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView.C,v
retrieving revision 1.185
diff -u -p -r1.185 BufferView.C
--- BufferView.C        2 Sep 2003 08:26:18 -0000       1.185
+++ BufferView.C        2 Sep 2003 16:35:22 -0000
@@ -479,7 +479,7 @@ bool BufferView::lockInset(UpdatableInse
 bool BufferView::fitLockedInsetCursor(int x, int y, int asc, int desc)
 {
        if (theLockingInset() && available()) {
-               y += text->cursor.iy() + theLockingInset()->insetInInsetY();
+               y += text->cursor.y() + theLockingInset()->insetInInsetY();
                if (screen().fitManualCursor(this, text, x, y, asc, desc)) {
                        updateScrollbar();
                        return true;
Index: lyxcursor.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxcursor.h,v
retrieving revision 1.36
diff -u -p -r1.36 lyxcursor.h
--- lyxcursor.h 2 Sep 2003 08:26:19 -0000       1.36
+++ lyxcursor.h 2 Sep 2003 16:35:23 -0000
@@ -46,16 +46,6 @@ public:
        void x(int i);
        /// return the x position in pixels
        int x() const;
-       /// set the stored next-line position when at the end of a row
-       void ix(int i);
-       /**
-        * Return the x position of the start of the next row, when this
-        * cursor is at the end of the previous row, for insets that take
-        * a full row.
-        *
-        * FIXME: explain why we need this ?
-        */
-       int ix() const;
        /// set the cached x position
        void x_fix(int i);
        /**
@@ -75,16 +65,7 @@ public:
        void y(int i);
        /// return the y position in pixels
        int y() const;
-       /// set the stored next-line y position when at the end of a row
-       void iy(int i);
-       /**
-        * Return the y position of the start of the next row, when this
-        * cursor is at the end of the previous row, for insets that take
-        * a full row.
-        *
-        * FIXME: explain why we need this ? especially for y...
-        */
-       int iy() const;
+
 private:
        /// The paragraph the cursor is in.
        ParagraphList::iterator par_;
Index: lyxfunc.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxfunc.C,v
retrieving revision 1.480
diff -u -p -r1.480 lyxfunc.C
--- lyxfunc.C   28 Aug 2003 07:41:14 -0000      1.480
+++ lyxfunc.C   2 Sep 2003 16:35:26 -0000
@@ -922,8 +922,8 @@ void LyXFunc::dispatch(FuncRequest const
                                if (irow != view()->text->firstRow()) {
 #if 1
                                        view()->text->setCursorFromCoordinates(
-                                               view()->text->cursor.ix() + inset_x,
-                                               view()->text->cursor.iy() -
+                                               view()->text->cursor.x() + inset_x,
+                                               view()->text->cursor.y() -
                                                irow->baseline() - 1);
                                        
view()->text->cursor.x_fix(view()->text->cursor.x());
 #else
@@ -940,8 +940,8 @@ void LyXFunc::dispatch(FuncRequest const
                                if (irow != view()->text->lastRow()) {
 #if 1
                                        view()->text->setCursorFromCoordinates(
-                                               view()->text->cursor.ix() + inset_x,
-                                               view()->text->cursor.iy() -
+                                               view()->text->cursor.x() + inset_x,
+                                               view()->text->cursor.y() -
                                                irow->baseline() +
                                                irow->height() + 1);
                                        
view()->text->cursor.x_fix(view()->text->cursor.x());
Index: text2.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text2.C,v
retrieving revision 1.452
diff -u -p -r1.452 text2.C
--- text2.C     2 Sep 2003 15:44:36 -0000       1.452
+++ text2.C     2 Sep 2003 16:35:29 -0000
@@ -1352,18 +1352,12 @@ void LyXText::setCursor(LyXCursor & cur,
        RowList::iterator row = getRow(pit, pos);
        int y = row->y();
 
-       RowList::iterator old_row = row;
-       // if we are before the first char of this row and are still in the
-       // same paragraph and there is a previous row then put the cursor on
-       // the end of the previous row
-       cur.iy(y + row->baseline());
-
        // y is now the beginning of the cursor row
        y += row->baseline();
        // y is now the cursor baseline
        cur.y(y);
 
-       pos_type last = lastPrintablePos(*pit, old_row);
+       pos_type last = lastPrintablePos(*pit, row);
 
        // None of these should happen, but we're scaredy-cats
        if (pos > pit->size()) {
@@ -1385,11 +1379,6 @@ void LyXText::setCursor(LyXCursor & cur,
        float x = getCursorX(pit, row, pos, last, boundary);
        cur.x(int(x));
        cur.x_fix(cur.x());
-       if (old_row != row) {
-               x = getCursorX(pit, old_row, pos, last, boundary);
-               cur.ix(int(x));
-       } else
-               cur.ix(cur.x());
 }
 
 
@@ -1626,9 +1615,6 @@ void LyXText::setCursorFromCoordinates(L
        cur.x(x);
        cur.y(y + rit->baseline());
 
-       cur.iy(cur.y());
-       cur.ix(cur.x());
-
        cur.boundary(bound);
 }
 
@@ -1675,7 +1661,7 @@ void LyXText::cursorUp(bool selecting)
        setCursorFromCoordinates(x, y);
        if (!selecting) {
                int topy = bv_owner->top_y();
-               int y1 = cursor.iy() - topy;
+               int y1 = cursor.y() - topy;
                int y2 = y1;
                y -= topy;
                InsetOld * inset_hit = checkInsetHit(x, y1);
@@ -1701,7 +1687,7 @@ void LyXText::cursorDown(bool selecting)
        setCursorFromCoordinates(x, y);
        if (!selecting && cursorRow() == cursorIRow()) {
                int topy = bv_owner->top_y();
-               int y1 = cursor.iy() - topy;
+               int y1 = cursor.y() - topy;
                int y2 = y1;
                y -= topy;
                InsetOld * inset_hit = checkInsetHit(x, y1);
Index: text3.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text3.C,v
retrieving revision 1.125
diff -u -p -r1.125 text3.C
--- text3.C     28 Aug 2003 07:41:20 -0000      1.125
+++ text3.C     2 Sep 2003 16:35:31 -0000
@@ -116,13 +116,13 @@ namespace {
 
                int const width = inset->width();
                int const inset_x = font.isVisibleRightToLeft()
-                       ? (cur.ix() - width) : cur.ix();
+                       ? (cur.x() - width) : cur.x();
 
                Box b(
                        inset_x + inset->scroll(),
                        inset_x + width,
-                       cur.iy() - inset->ascent(),
-                       cur.iy() + inset->descent()
+                       cur.y() - inset->ascent(),
+                       cur.y() + inset->descent()
                );
 
                if (!b.contained(x, y)) {
@@ -136,7 +136,7 @@ namespace {
 
                x -= b.x1;
                // The origin of an inset is on the baseline
-               y -= text.cursor.iy();
+               y -= text.cursor.y();
 
                return inset;
        }
@@ -266,7 +266,7 @@ void LyXText::cursorPrevious()
                // tall rows, but it's not working right now.
        } else {
                if (inset_owner) {
-                       new_y = bv()->text->cursor.iy()
+                       new_y = bv()->text->cursor.y()
                                + bv()->theLockingInset()->insetInInsetY() + y
                                + rit->height()
                                - bv()->workHeight() + 1;
@@ -302,7 +302,7 @@ void LyXText::cursorNext()
 
        int y = topy + bv_owner->workHeight();
        if (inset_owner && !topy) {
-               y -= (bv_owner->text->cursor.iy()
+               y -= (bv_owner->text->cursor.y()
                          - bv_owner->top_y()
                          + bv_owner->theLockingInset()->insetInInsetY());
        }
@@ -327,7 +327,7 @@ void LyXText::cursorNext()
 #endif
        } else {
                if (inset_owner) {
-                       new_y = bv()->text->cursor.iy()
+                       new_y = bv()->text->cursor.y()
                                + bv()->theLockingInset()->insetInInsetY()
                                + y - rit->baseline();
                } else {
@@ -1214,11 +1214,11 @@ InsetOld::RESULT LyXText::dispatch(FuncR
                        LyXFont font = bv->text->getFont(cursor.par(), cursor.pos());
                        int width = tli->width();
                        int inset_x = font.isVisibleRightToLeft()
-                               ? cursor.ix() - width : cursor.ix();
+                               ? cursor.x() - width : cursor.x();
                        int start_x = inset_x + tli->scroll();
                        FuncRequest cmd1 = cmd;
                        cmd1.x = cmd.x - start_x;
-                       cmd1.y = cmd.y - cursor.iy() + bv->top_y();
+                       cmd1.y = cmd.y - cursor.y() + bv->top_y();
                        tli->localDispatch(cmd1);
                        break;
                }
Index: frontends/screen.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/screen.C,v
retrieving revision 1.69
diff -u -p -r1.69 screen.C
--- frontends/screen.C  28 Aug 2003 07:41:21 -0000      1.69
+++ frontends/screen.C  2 Sep 2003 16:35:32 -0000
@@ -183,7 +183,7 @@ void LyXScreen::showCursor(BufferView & 
                // Ugly as you like.
                int bx, by;
                inset->getCursorPos(&bv, bx, by);
-               by += inset->insetInInsetY() + bv.text->cursor.iy();
+               by += inset->insetInInsetY() + bv.text->cursor.y();
                if (by < top_y)
                        return;
                if (by > top_y + workarea().workHeight())
Index: insets/insetbibtex.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetbibtex.C,v
retrieving revision 1.21
diff -u -p -r1.21 insetbibtex.C
--- insets/insetbibtex.C        28 Aug 2003 07:41:28 -0000      1.21
+++ insets/insetbibtex.C        2 Sep 2003 16:35:35 -0000
@@ -54,6 +54,7 @@ std::auto_ptr<InsetBase> InsetBibtex::cl
        return std::auto_ptr<InsetBase>(new InsetBibtex(*this));
 }
 
+
 void InsetBibtex::metrics(MetricsInfo & mi, Dimension & dim) const
 {
        InsetCommand::metrics(mi, dim);
Index: insets/insetbranch.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetbranch.C,v
retrieving revision 1.6
diff -u -p -r1.6 insetbranch.C
--- insets/insetbranch.C        28 Aug 2003 07:41:28 -0000      1.6
+++ insets/insetbranch.C        2 Sep 2003 16:35:36 -0000
@@ -131,6 +131,7 @@ dispatch_result InsetBranch::localDispat
        case LFUN_INSET_EDIT:
                if (cmd.button() != mouse_button::button3)
                        return InsetCollapsable::localDispatch(cmd);
+               
                return UNDISPATCHED;
        case LFUN_INSET_DIALOG_UPDATE:
                InsetBranchMailer("branch", *this).updateDialog(bv);
Index: insets/insetcollapsable.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetcollapsable.C,v
retrieving revision 1.167
diff -u -p -r1.167 insetcollapsable.C
--- insets/insetcollapsable.C   28 Aug 2003 07:41:28 -0000      1.167
+++ insets/insetcollapsable.C   2 Sep 2003 16:35:36 -0000
@@ -243,7 +243,6 @@ void InsetCollapsable::lfunMouseRelease(
                }
                bv->updateInset(this);
                bv->buffer()->markDirty();
-               lyxerr << "InsetCollapsable::lfunMouseRelease\n";
        } else if (!collapsed_ && cmd.y > button_dim.y2) {
                ret = inset.localDispatch(adjustCommand(cmd)) == DISPATCHED;
        }
Index: insets/insettext.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettext.C,v
retrieving revision 1.488
diff -u -p -r1.488 insettext.C
--- insets/insettext.C  28 Aug 2003 07:41:30 -0000      1.488
+++ insets/insettext.C  2 Sep 2003 16:35:40 -0000
@@ -281,8 +281,8 @@ void InsetText::draw(PainterInfo & pi, i
        top_y = y - dim_.asc;
 
        if (the_locking_inset && cpar() == inset_par && cpos() == inset_pos) {
-               inset_x = cix() - x + drawTextXOffset;
-               inset_y = ciy() + drawTextYOffset;
+               inset_x = cx() - x + drawTextXOffset;
+               inset_y = cy() + drawTextYOffset;
        }
 
        x += TEXT_TO_INSET_OFFSET;
@@ -386,8 +386,8 @@ void InsetText::lockInset(BufferView * b
 void InsetText::lockInset(BufferView * /*bv*/, UpdatableInset * inset)
 {
        the_locking_inset = inset;
-       inset_x = cix() - top_x + drawTextXOffset;
-       inset_y = ciy() + drawTextYOffset;
+       inset_x = cx() - top_x + drawTextXOffset;
+       inset_y = cy() + drawTextYOffset;
        inset_pos = cpos();
        inset_par = cpar();
        inset_boundary = cboundary();
@@ -438,8 +438,8 @@ bool InsetText::lockInsetInInset(BufferV
        if (the_locking_inset && the_locking_inset == inset) {
                if (cpar() == inset_par && cpos() == inset_pos) {
                        lyxerr[Debug::INSETS] << "OK" << endl;
-                       inset_x = cix() - top_x + drawTextXOffset;
-                       inset_y = ciy() + drawTextYOffset;
+                       inset_x = cx() - top_x + drawTextXOffset;
+                       inset_y = cy() + drawTextYOffset;
                } else {
                        lyxerr[Debug::INSETS] << "cursor.pos != inset_pos" << endl;
                }
@@ -581,8 +581,8 @@ bool InsetText::lfunMouseRelease(FuncReq
                if (isHighlyEditableInset(inset))
                        ret = inset->localDispatch(cmd1);
                else {
-                       inset_x = cix(bv) - top_x + drawTextXOffset;
-                       inset_y = ciy() + drawTextYOffset;
+                       inset_x = cx(bv) - top_x + drawTextXOffset;
+                       inset_y = cy() + drawTextYOffset;
                        cmd1.x = cmd.x - inset_x;
                        cmd1.y = cmd.x - inset_y;
                        inset->edit(bv, cmd1.x, cmd1.y, cmd.button());
@@ -1433,8 +1433,8 @@ bool InsetText::checkAndActivateInset(Bu
                x = dim_.wid;
        if (y < 0)
                y = dim_.des;
-       inset_x = cix() - top_x + drawTextXOffset;
-       inset_y = ciy() + drawTextYOffset;
+       inset_x = cx() - top_x + drawTextXOffset;
+       inset_y = cy() + drawTextYOffset;
        FuncRequest cmd(bv, LFUN_INSET_EDIT, x - inset_x, y - inset_y, button);
        inset->localDispatch(cmd);
        if (!the_locking_inset)
@@ -1501,27 +1501,9 @@ int InsetText::cx() const
 }
 
 
-int InsetText::cix() const
-{
-       int x = text_.cursor.ix() + top_x + TEXT_TO_INSET_OFFSET;
-       if (the_locking_inset) {
-               LyXFont font = text_.getFont(text_.cursor.par(), text_.cursor.pos());
-               if (font.isVisibleRightToLeft())
-                       x -= the_locking_inset->width();
-       }
-       return x;
-}
-
-
 int InsetText::cy() const
 {
        return text_.cursor.y() - dim_.asc + TEXT_TO_INSET_OFFSET;
-}
-
-
-int InsetText::ciy() const
-{
-       return text_.cursor.iy() - dim_.asc + TEXT_TO_INSET_OFFSET;
 }
 
 
Index: insets/insettext.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettext.h,v
retrieving revision 1.199
diff -u -p -r1.199 insettext.h
--- insets/insettext.h  28 Aug 2003 07:41:30 -0000      1.199
+++ insets/insettext.h  2 Sep 2003 16:35:40 -0000
@@ -258,11 +258,7 @@ private:
        ///
        int cx() const;
        ///
-       int cix() const;
-       ///
        int cy() const;
-       ///
-       int ciy() const;
        ///
        lyx::pos_type cpos() const;
        ///
-- 
Khendon's Law:
If the same point is made twice by the same person, the thread is over.

Reply via email to