]> git.lyx.org Git - lyx.git/commitdiff
Added new FINISED states FINISHED_RIGHT, FINISHED_UP, FINISHED_DOWN.
authorJürgen Vigna <jug@sad.it>
Thu, 16 Aug 2001 08:52:30 +0000 (08:52 +0000)
committerJürgen Vigna <jug@sad.it>
Thu, 16 Aug 2001 08:52:30 +0000 (08:52 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2518 a592a061-630c-0410-9148-cb99ea01b6c8

po/POTFILES.in
src/ChangeLog
src/insets/ChangeLog
src/insets/inset.h
src/insets/insetcollapsable.C
src/insets/insettabular.C
src/insets/insettext.C
src/lyxfunc.C

index 446fd4dc1db8fc91b13e982234429922be591d22..dc7e9ec132afc50e3bed339668e040bc90dfc191 100644 (file)
@@ -168,6 +168,7 @@ src/LyXView.C
 src/mathed/formulabase.C
 src/mathed/formula.C
 src/mathed/formulamacro.C
+src/mathed/math_cursor.C
 src/MenuBackend.C
 src/minibuffer.C
 src/paragraph.C
index 2161d93e2df3fcad739cf65c7ea8d4f5a6133a43..9c9ab335107d84326fa3f5ede58b9ee648810781 100644 (file)
@@ -1,3 +1,7 @@
+2001-08-16  Juergen Vigna  <jug@sad.it>
+
+       * lyxfunc.C (dispatch): implemented the new FINISHED states.
+
 2001-08-14  Dekel Tsur  <dekelts@tau.ac.il>
 
        * buffer.C (parseSingleLyXformat2Token): Do not generate errors
index 7cea082331f94b0eed5e408c20b0f02cc45c019d..ce461cfbb50f959dabc5b980f252bc4ce9310a6b 100644 (file)
@@ -1,3 +1,11 @@
+2001-08-16  Juergen Vigna  <jug@sad.it>
+
+       * insettext.C: implemented the new FINISHED states.
+
+       * insettabular.C: ditto 
+
+       * inset.h: added more FINISHED states for cursor right,up,down
+
 2001-08-14  Juergen Vigna  <jug@sad.it>
 
        * insetert.C (edit): forgot to set status_ in edit calls!
index 2a70ca4d857ec364f7357b497e43b83060cb153d..82d84034bc847b5e4c8b53beb69e649535d36426 100644 (file)
@@ -355,19 +355,28 @@ public:
            becomes a bit complex, just two possible results (boolean)
            are not enough. 
         
-           DISPATCHED   = the inset catched the action
+           DISPATCHED          = the inset catched the action
            DISPATCHED_NOUPDATE = the inset catched the action and no update
                                  is needed here to redraw the inset
-           FINISHED     = the inset must be unlocked as a result
-                          of the action
-           UNDISPATCHED = the action was not catched, it should be
-                          dispatched by lower level insets
+           FINISHED            = the inset must be unlocked as a result
+                                 of the action
+           FINISHED_RIGHT      = FINISHED, but put the cursor to the RIGHT of
+                                 the inset.
+           FINISHED_UP         = FINISHED, but put the cursor UP of
+                                 the inset.
+           FINISHED_DOWN       = FINISHED, but put the cursor DOWN of
+                                 the inset.
+           UNDISPATCHED        = the action was not catched, it should be
+                                 dispatched by lower level insets
        */ 
        enum RESULT {
                UNDISPATCHED = 0,
                DISPATCHED,
                DISPATCHED_NOUPDATE,
-               FINISHED
+               FINISHED,
+               FINISHED_RIGHT,
+               FINISHED_UP,
+               FINISHED_DOWN
        };
     
        /// To convert old binary dispatch results
index ce43acc582135c7dfc603ace9d0a760c7e93a5fe..b1905c679cbe7d4361bdc30cd725847e5818eb39 100644 (file)
@@ -417,10 +417,10 @@ void InsetCollapsable::update(BufferView * bv, LyXFont const & font,
 
 UpdatableInset::RESULT
 InsetCollapsable::localDispatch(BufferView * bv, kb_action action,
-                               string const & arg)
+                                string const & arg)
 {
        UpdatableInset::RESULT result = inset.localDispatch(bv, action, arg);
-       if (result == FINISHED)
+       if (result >= FINISHED)
                bv->unlockInset(this);
        first_after_edit = false;
        return result;
@@ -436,7 +436,7 @@ bool InsetCollapsable::lockInsetInInset(BufferView * bv, UpdatableInset * in)
 
 
 bool InsetCollapsable::unlockInsetInInset(BufferView * bv, UpdatableInset * in,
-                                         bool lr)
+                                          bool lr)
 {
        if (&inset == in) {
                bv->unlockInset(this);
index 62ab9682b9d335e9061455fcab1bbc6263f45bd7..f54ef6e196c6ec9ba6610c384219a86db1e87be8 100644 (file)
@@ -1105,7 +1105,7 @@ InsetTabular::localDispatch(BufferView * bv, kb_action action,
                        // reset need_update setted in above function!
                        need_update = NONE;
                        result = the_locking_inset->localDispatch(bv, action, arg);
-                       if ((result == UNDISPATCHED) || (result == FINISHED)) {
+                       if ((result == UNDISPATCHED) || (result >= FINISHED)) {
                                unlockInsetInInset(bv, the_locking_inset);
                                nodraw(false);
                                the_locking_inset = 0;
@@ -1121,7 +1121,7 @@ InsetTabular::localDispatch(BufferView * bv, kb_action action,
                }
                break;
        }
-       if (result!=FINISHED) {
+       if (result < FINISHED) {
                if (!the_locking_inset) {
                        showInsetCursor(bv);
                }
@@ -1400,7 +1400,7 @@ UpdatableInset::RESULT InsetTabular::moveRight(BufferView * bv, bool lock)
                bool moved = isRightToLeft(bv)
                        ? movePrevCell(bv) : moveNextCell(bv);
                if (!moved)
-                       return FINISHED;
+                       return FINISHED_RIGHT;
                if (lock && activateCellInset(bv))
                        return DISPATCHED;
        }
@@ -1428,7 +1428,7 @@ UpdatableInset::RESULT InsetTabular::moveUp(BufferView * bv, bool lock)
        int const ocell = actcell;
        actcell = tabular->GetCellAbove(actcell);
        if (actcell == ocell) // we moved out of the inset
-               return FINISHED;
+               return FINISHED_UP;
        resetPos(bv);
        if (lock) {
                int x = 0;
@@ -1449,7 +1449,7 @@ UpdatableInset::RESULT InsetTabular::moveDown(BufferView * bv, bool lock)
        int const ocell = actcell;
        actcell = tabular->GetCellBelow(actcell);
        if (actcell == ocell) // we moved out of the inset
-               return FINISHED;
+               return FINISHED_DOWN;
        resetPos(bv);
        if (lock) {
                int x = 0;
index 1e1da89929640ca9fadf52ae0a29648fc84e5964..5f030e5b46d89e8cb9ff564c044e08a921a121c7 100644 (file)
@@ -1319,7 +1319,7 @@ InsetText::localDispatch(BufferView * bv,
                setFont(bv, font, false);
        }
 
-       if (result != FINISHED) {
+       if (result < FINISHED) {
                showInsetCursor(bv);
        } else
                bv->unlockInset(this);
@@ -1499,10 +1499,10 @@ InsetText::moveLeft(BufferView * bv, bool activate_inset, bool selecting)
 
 UpdatableInset::RESULT
 InsetText::moveRightIntern(BufferView * bv, bool behind, 
-                          bool activate_inset, bool selecting)
+                           bool activate_inset, bool selecting)
 {
        if (!cpar(bv)->next() && (cpos(bv) >= cpar(bv)->size()))
-               return FINISHED;
+               return FINISHED_RIGHT;
        if (activate_inset && checkAndActivateInset(bv, behind))
                return DISPATCHED;
        getLyXText(bv)->cursorRight(bv);
@@ -1514,7 +1514,7 @@ InsetText::moveRightIntern(BufferView * bv, bool behind,
 
 UpdatableInset::RESULT
 InsetText::moveLeftIntern(BufferView * bv, bool behind,
-                         bool activate_inset, bool selecting)
+                          bool activate_inset, bool selecting)
 {
        if (!cpar(bv)->previous() && (cpos(bv) <= 0))
                return FINISHED;
@@ -1531,7 +1531,7 @@ UpdatableInset::RESULT
 InsetText::moveUp(BufferView * bv)
 {
        if (!crow(bv)->previous())
-               return FINISHED;
+               return FINISHED_UP;
        getLyXText(bv)->cursorUp(bv);
        return DISPATCHED_NOUPDATE;
 }
@@ -1541,7 +1541,7 @@ UpdatableInset::RESULT
 InsetText::moveDown(BufferView * bv)
 {
        if (!crow(bv)->next())
-               return FINISHED;
+               return FINISHED_DOWN;
        getLyXText(bv)->cursorDown(bv);
        return DISPATCHED_NOUPDATE;
 }
index a95050cc8befdcd394011bd0edb4f156fdb36f7a..534d64e73741eb2413992bc5d8acbe4505d406c6 100644 (file)
@@ -866,12 +866,40 @@ string const LyXFunc::dispatch(int ac,
                                        inset->edit(owner->view(),slx,sly,0); 
                                return string();
                        } else if (((result=owner->view()->theLockingInset()->
-                                  localDispatch(owner->view(), action,
-                                                argument)) ==
-                                  UpdatableInset::DISPATCHED) ||
-                                  (result == UpdatableInset::DISPATCHED_NOUPDATE))
+                                    localDispatch(owner->view(), action, argument)) ==
+                                   UpdatableInset::DISPATCHED) ||
+                                  (result == UpdatableInset::DISPATCHED_NOUPDATE))
                                return string();
-                       else {
+                       else if (result == UpdatableInset::FINISHED) {
+                                       if (TEXT()->cursor.par()->isRightToLeftPar(owner->buffer()->params)) {
+                                               TEXT()->cursorRight(owner->view());
+                                               moveCursorUpdate(true, false);
+                                               owner->showState();
+                                       }
+                                       return string();
+                       } else if (result == UpdatableInset::FINISHED_RIGHT) {
+                               if (!TEXT()->cursor.par()->isRightToLeftPar(owner->buffer()->params)) {
+                                       TEXT()->cursorRight(owner->view());
+                                       moveCursorUpdate(true, false);
+                                       owner->showState();
+                               }
+                               return string();
+                       } else if (result == UpdatableInset::FINISHED_UP) {
+                               if (TEXT()->cursor.row()->previous()) {
+                                       TEXT()->cursorUp(owner->view());
+                                       moveCursorUpdate(true, false);
+                                       owner->showState();
+                               }
+                               return string();
+                       } else if (result == UpdatableInset::FINISHED_DOWN) {
+                               if (TEXT()->cursor.row()->next())
+                                       TEXT()->cursorDown(owner->view());
+                               else
+                                       TEXT()->cursorRight(owner->view());
+                               moveCursorUpdate(true, false);
+                               owner->showState();
+                               return string();
+                       } else {
                                //setMessage(N_("Text mode"));
                                switch (action) {
                                case LFUN_UNKNOWN_ACTION: