]> git.lyx.org Git - lyx.git/commitdiff
InsetText/Tabular fixes (buglist from SF.NET)
authorJürgen Vigna <jug@sad.it>
Fri, 1 Jun 2001 15:10:26 +0000 (15:10 +0000)
committerJürgen Vigna <jug@sad.it>
Fri, 1 Jun 2001 15:10:26 +0000 (15:10 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2085 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView_pimpl.C
src/ChangeLog
src/insets/ChangeLog
src/insets/insettabular.C
src/insets/insettext.C
src/insets/insettext.h
src/lyxfunc.C

index 5e7eaf7616ad29271022d397cdaa74516f366533..835cef0dd464c991576bf789a2c68e74722cb60d 100644 (file)
@@ -1835,7 +1835,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
                if (!lt->selection.mark())
                        beforeChange(lt);
                update(lt, BufferView::SELECT|BufferView::FITCUR);
-               LyXCursor const cur = lt->cursor;
+               LyXCursor const cur = lt->cursor;
                if (!is_rtl)
                        lt->CursorLeft(bv_, false);
                if ((is_rtl || cur != lt->cursor) && // only if really moved!
index 69ac99155539b714b836220b53fa200cb0848227..efe76281223ac4a20691629d72a6d1fbeff3f7f3 100644 (file)
@@ -1,3 +1,14 @@
+2001-06-01  Juergen Vigna  <jug@sad.it>
+
+       * lyxfunc.C (Dispatch): LFUN_PREFIX don't call the update if we're
+       inside a LockingInset (is the update needed at all?).
+
+2001-05-31  Juergen Vigna  <jug@sad.it>
+
+       * BufferView_pimpl.C (Dispatch): we need a new instanze of cursor
+       here not the old one otherwise how should we compare it afterwards
+       if it's the same!
+
 2001-06-01  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
 
        * lyxfont.C: 
index 92977ef2f28b778b7bf993a579e20a07e601b254..35e68f1721e888d84a5b004e152ebb9e9b1aecb8 100644 (file)
@@ -1,3 +1,16 @@
+2001-06-01  Juergen Vigna  <jug@sad.it>
+
+       * insettabular.C (resetPos): small hack so that scroll is not set to
+       0 when we are in the last column of a tabular. This is a problem we
+       have because of constats 20 offset on both directions, so this can
+       cause on the limit an endless loop.
+
+       * insettext.C (SetFont): forgot that we can have locking insets ;)
+
+2001-05-31  Juergen Vigna  <jug@sad.it>
+
+       * insettabular.C (LocalDispatch): small fix for LFUN_TAB.
+
 2001-05-31  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
 
        * figinset.C: add using std:: directive for the C functions which
index 212b1a5fb1edd7eeac5d7802de939abe3b31df30..39650ad2b60bbe641d37f7ccd20d0d25029df599 100644 (file)
@@ -577,10 +577,12 @@ bool InsetTabular::UnlockInsetInInset(BufferView * bv, UpdatableInset * inset,
        if (the_locking_inset == inset) {
                the_locking_inset->InsetUnlock(bv);
                the_locking_inset = 0;
+#warning fix scrolling when cellinset has requested a scroll (Jug)!!!
+#if 0
                if (scroll(false))
                        scroll(bv, 0.0F);
-               else
-                       UpdateLocal(bv, CELL, false);
+#endif
+               UpdateLocal(bv, CELL, false);
                ShowInsetCursor(bv, false);
                return true;
        }
@@ -782,7 +784,7 @@ InsetTabular::LocalDispatch(BufferView * bv,
        case LFUN_SHIFT_TAB:
        case LFUN_TAB:
        {
-               if (GetFirstLockingInsetOfType(Inset::TABULAR_CODE))
+               if (GetFirstLockingInsetOfType(Inset::TABULAR_CODE) != this)
                        break;
                HideInsetCursor(bv);
                if (the_locking_inset) {
@@ -1282,11 +1284,14 @@ void InsetTabular::resetPos(BufferView * bv) const
        new_x += offset;
        cursor.x(new_x);
 //    cursor.x(getCellXPos(actcell) + offset);
-       if (scroll(false) && (tabular->GetWidthOfTabular() < bv->workWidth()-20)) {
+       if ((actcol < tabular->columns()-1) && scroll(false) &&
+               (tabular->GetWidthOfTabular() < bv->workWidth()-20))
+       {
                scroll(bv, 0.0F);
                UpdateLocal(bv, FULL, false);
        } else if (the_locking_inset &&
-                (tabular->GetWidthOfColumn(actcell) > bv->workWidth()-20)) {
+                (tabular->GetWidthOfColumn(actcell) > bv->workWidth()-20))
+       {
                int xx = cursor.x() - offset + bv->text->GetRealCursorX(bv);
                if (xx > (bv->workWidth()-20)) {
                        scroll(bv, -(xx - bv->workWidth() + 60));
index 02ab563ae9a41b03621585cf3b190b0b73821a93..9367aa62ee9601b66e8981d94c23b2246244d88d 100644 (file)
@@ -284,21 +284,7 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
                ((need_update&(INIT|FULL)) || (top_baseline!=baseline) ||
                 (last_drawn_width!=insetWidth)))
        {
-               int w =  insetWidth;
-               int h = insetAscent + insetDescent;
-               int ty = baseline - insetAscent;
-       
-               if (ty < 0) {
-                       h += ty;
-                       ty = 0;
-               }
-               if ((ty + h) > pain.paperHeight())
-                       h = pain.paperHeight();
-               if ((top_x + drawTextXOffset + w) > pain.paperWidth())
-                       w = pain.paperWidth();
-               pain.fillRectangle(top_x+drawTextXOffset, ty, w, h);
-               cleared = true;
-               need_update = FULL;
+               clearInset(pain, baseline, cleared);
        }
        if (cleared)
                frame_is_visible = false;
@@ -315,7 +301,7 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
                }
                top_x = int(x);
 #if 1
-               cleared = true;
+               clearInset(pain, baseline, cleared);
 #else
                return;
 #endif
@@ -1394,6 +1380,10 @@ std::vector<string> const InsetText::getLabelList() const
 void InsetText::SetFont(BufferView * bv, LyXFont const & font, bool toggleall,
                         bool selectall)
 {
+       if (the_locking_inset) {
+               the_locking_inset->SetFont(bv, font, toggleall, selectall);
+               return;
+       }
        if (TEXT(bv)->selection.set()) {
                bv->text->SetUndo(bv->buffer(), Undo::EDIT,
                                  bv->text->cursor.par()->previous(),
@@ -1761,6 +1751,24 @@ void InsetText::clearSelection(BufferView * bv)
        TEXT(bv)->ClearSelection(bv);
 }
 
+void InsetText::clearInset(Painter & pain, int baseline, bool & cleared) const
+{
+       int w =  insetWidth;
+       int h = insetAscent + insetDescent;
+       int ty = baseline - insetAscent;
+       
+       if (ty < 0) {
+               h += ty;
+               ty = 0;
+       }
+       if ((ty + h) > pain.paperHeight())
+               h = pain.paperHeight();
+       if ((top_x + drawTextXOffset + w) > pain.paperWidth())
+               w = pain.paperWidth();
+       pain.fillRectangle(top_x+drawTextXOffset, ty, w, h);
+       cleared = true;
+       need_update = FULL;
+}
 /* Emacs:
  * Local variables:
  * tab-width: 4
index 615078abec0934359510e4c14ec11dd3c80d76ed..faa5cef34fe1451990f808d2104812764a066c85 100644 (file)
@@ -275,6 +275,7 @@ private:
        void drawFrame(Painter &, bool cleared) const;
        void clearFrame(Painter &, bool cleared) const;
        ///
+       void clearInset(Painter &, int baseline, bool & cleared) const;
        
        /* Private structures and variables */
        ///
index cbb0f0ebb82d44992c0129e5127e593134d00604..1ff937641a2012ac839fa9426e692bae64d9da69 100644 (file)
@@ -710,7 +710,10 @@ string const LyXFunc::Dispatch(int ac,
                                        }
                                        return string();
                                case LFUN_DOWN:
-                                       TEXT()->CursorDown(owner->view());
+                                       if (TEXT()->cursor.row()->next())
+                                               TEXT()->CursorDown(owner->view());
+                                       else
+                                               TEXT()->CursorRight(owner->view());
                                        moveCursorUpdate(true, false);
                                        owner->showState();
                                        return string();
@@ -794,7 +797,7 @@ string const LyXFunc::Dispatch(int ac,
                
        case LFUN_PREFIX:
        {
-               if (owner->view()->available()) {
+               if (owner->view()->available() && !owner->view()->theLockingInset()) {
                        owner->view()->update(TEXT(),
                                              BufferView::SELECT|BufferView::FITCUR);
                }