]> git.lyx.org Git - features.git/commitdiff
New function ciy() which handles cursor.iy() functions.
authorJürgen Vigna <jug@sad.it>
Thu, 11 Apr 2002 15:08:22 +0000 (15:08 +0000)
committerJürgen Vigna <jug@sad.it>
Thu, 11 Apr 2002 15:08:22 +0000 (15:08 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3972 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/ChangeLog
src/insets/insettext.C
src/insets/insettext.h

index cecce08e658aa975182bac7fdb96daa8739dcbee..7de73637542cfc4bf12e05de9f1c9274bf2f8a71 100644 (file)
@@ -1,5 +1,7 @@
 2002-04-11  Juergen Vigna  <jug@sad.it>
 
+       * insettext.C: new function ciy() and use it for setting inset_y.
+
        * insetert.C (draw): fix the x return for collapsed version.
 
 2002-04-07  Herbert Voss  <voss@perce.de>
index 41a4a1c97881953b7801ea954328ed36161e71c8..76676a24df09b3d82325f9a196f44d0830e407eb 100644 (file)
@@ -425,7 +425,7 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
        if (the_locking_inset && (cpar(bv) == inset_par)
                && (cpos(bv) == inset_pos)) {
                inset_x = cx(bv) - top_x + drawTextXOffset;
-               inset_y = cy(bv) + drawTextYOffset;
+               inset_y = ciy(bv) + drawTextYOffset;
        }
        if (!cleared && (need_update == CURSOR)
            && !getLyXText(bv)->selection.set()) {
@@ -559,7 +559,7 @@ void InsetText::update(BufferView * bv, LyXFont const & font, bool reinit)
 
        if (the_locking_inset) {
                inset_x = cx(bv) - top_x + drawTextXOffset;
-               inset_y = cy(bv) + drawTextYOffset;
+               inset_y = ciy(bv) + drawTextYOffset;
                the_locking_inset->update(bv, font, reinit);
        }
 
@@ -786,7 +786,7 @@ void InsetText::lockInset(BufferView * bv, UpdatableInset * inset)
 {
        the_locking_inset = inset;
        inset_x = cx(bv) - top_x + drawTextXOffset;
-       inset_y = cy(bv) + drawTextYOffset;
+       inset_y = ciy(bv) + drawTextYOffset;
        inset_pos = cpos(bv);
        inset_par = cpar(bv);
        inset_boundary = cboundary(bv);
@@ -832,7 +832,7 @@ bool InsetText::lockInsetInInset(BufferView * bv, UpdatableInset * inset)
                if (cpar(bv) == inset_par && cpos(bv) == inset_pos) {
                        lyxerr[Debug::INSETS] << "OK" << endl;
                        inset_x = cx(bv) - top_x + drawTextXOffset;
-                       inset_y = cy(bv) + drawTextYOffset;
+                       inset_y = ciy(bv) + drawTextYOffset;
                } else {
                        lyxerr[Debug::INSETS] << "cursor.pos != inset_pos" << endl;
                }
@@ -910,7 +910,7 @@ bool InsetText::updateInsetInInset(BufferView * bv, Inset * inset)
                    cpar(bv) == inset_par && cpos(bv) == inset_pos)
                {
                        inset_x = cx(bv) - top_x + drawTextXOffset;
-                       inset_y = cy(bv) + drawTextYOffset;
+                       inset_y = ciy(bv) + drawTextYOffset;
                }
        }
        return found;
@@ -943,7 +943,7 @@ void InsetText::insetButtonPress(BufferView * bv, int x, int y, int button)
                        // otherwise unlock the_locking_inset and lock the new inset
                        the_locking_inset->insetUnlock(bv);
                        inset_x = cx(bv) - top_x + drawTextXOffset;
-                       inset_y = cy(bv) + drawTextYOffset;
+                       inset_y = ciy(bv) + drawTextYOffset;
                        the_locking_inset = 0;
                        inset->insetButtonPress(bv, x - inset_x,
                                                y - inset_y, button);
@@ -1044,7 +1044,7 @@ bool InsetText::insetButtonRelease(BufferView * bv, int x, int y, int button)
                                                        y - inset_y, button);
                } else {
                        inset_x = cx(bv) - top_x + drawTextXOffset;
-                       inset_y = cy(bv) + drawTextYOffset;
+                       inset_y = ciy(bv) + drawTextYOffset;
                        ret = inset->insetButtonRelease(bv, x - inset_x,
                                                        y - inset_y, button);
                        inset->edit(bv, x - inset_x,
@@ -1747,7 +1747,7 @@ void InsetText::showInsetCursor(BufferView * bv, bool show)
                int const asc = lyxfont::maxAscent(font);
                int const desc = lyxfont::maxDescent(font);
 
-               bv->fitLockedInsetCursor(cx(bv), cy(bv), asc, desc);
+               bv->fitLockedInsetCursor(cx(bv), ciy(bv), asc, desc);
                if (show)
                        bv->showLockedInsetCursor(cx(bv), cy(bv), asc, desc);
                setCursorVisible(true);
@@ -2020,7 +2020,7 @@ bool InsetText::checkAndActivateInset(BufferView * bv, int x, int y,
                if (y < 0)
                        y = insetDescent;
                inset_x = cx(bv) - top_x + drawTextXOffset;
-               inset_y = cy(bv) + drawTextYOffset;
+               inset_y = ciy(bv) + drawTextYOffset;
                inset->edit(bv, x - inset_x, y - inset_y, button);
                if (!the_locking_inset)
                        return false;
@@ -2137,6 +2137,13 @@ int InsetText::cy(BufferView * bv) const
 }
 
 
+int InsetText::ciy(BufferView * bv) const
+{
+       LyXFont font;
+       return getLyXText(bv)->cursor.iy() - ascent(bv, font) + TEXT_TO_INSET_OFFSET;
+}
+
+
 pos_type InsetText::cpos(BufferView * bv) const
 {
        return getLyXText(bv)->cursor.pos();
@@ -2286,7 +2293,7 @@ void InsetText::resizeLyXText(BufferView * bv, bool force) const
        restoreLyXTextState(bv, t);
        if (the_locking_inset) {
                inset_x = cx(bv) - top_x + drawTextXOffset;
-               inset_y = cy(bv) + drawTextYOffset;
+               inset_y = ciy(bv) + drawTextYOffset;
        }
 
        if (bv->screen()) {
@@ -2327,7 +2334,7 @@ void InsetText::reinitLyXText() const
                restoreLyXTextState(bv, t);
                if (the_locking_inset) {
                        inset_x = cx(bv) - top_x + drawTextXOffset;
-                       inset_y = cy(bv) + drawTextYOffset;
+                       inset_y = ciy(bv) + drawTextYOffset;
                }
                if (bv->screen()) {
                        t->first_y = bv->screen()->topCursorVisible(t);
index cf5977a20a81022fd2941fa8ba54ed738a9469f3..69f712dbe8804db095fead7bb9a0a6310ea17a34 100644 (file)
@@ -323,6 +323,8 @@ private:
        ///
        int cy(BufferView *) const;
        ///
+       int ciy(BufferView *) const;
+       ///
        lyx::pos_type cpos(BufferView *) const;
        ///
        Paragraph * cpar(BufferView *) const;