]> git.lyx.org Git - lyx.git/blobdiff - src/lyxfunc.C
Point fix, earlier forgotten
[lyx.git] / src / lyxfunc.C
index 0f2dfc41de3338f1329d891d2070e87614694af3..9c85a46ec617dc89dab45f3cb3b66c5af9710880 100644 (file)
@@ -1,19 +1,27 @@
-/* This file is part of
- * ======================================================
+/**
+ * \file lyxfunc.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- *           LyX, The Document Processor
+ * \author Alfredo Braunstein
+ * \author Lars Gullik Bjønnes
+ * \author Jean-Marc Lasgouttes
+ * \author Angus Leeming
+ * \author John Levon
+ * \author André Pönitz
+ * \author Allan Rae
+ * \author Dekel Tsur
+ * \author Martin Vermeer
+ * \author Jürgen Vigna
  *
- *         Copyright 1995 Matthias Ettrich
- *          Copyright 1995-2001 The LyX Team.
- *
- * ====================================================== */
+ * Full author contact details are available in file CREDITS.
+ */
 
 #include <config.h>
 
 #include "lyxfunc.h"
 #include "version.h"
 #include "kbmap.h"
-#include "lyxrow.h"
 #include "bufferlist.h"
 #include "buffer.h"
 #include "buffer_funcs.h"
@@ -115,12 +123,9 @@ LyXFunc::LyXFunc(LyXView * o)
 void LyXFunc::moveCursorUpdate()
 {
        LyXText * lt = view()->text;
-       if (lt->selection.mark()) {
+       if (lt->selection.mark())
                lt->setSelection();
-               if (!lt->isInInset())
-                       view()->update();
-       }
-       view()->update(lt, BufferView::SELECT);
+       view()->update();
        view()->switchKeyMap();
 }
 
@@ -139,7 +144,7 @@ void LyXFunc::handleKeyFunc(kb_action action)
        // actions
        keyseq.clear();
        // copied verbatim from do_accent_char
-       view()->update(view()->getLyXText(), BufferView::SELECT);
+       view()->update();
        view()->getLyXText()->selection.cursor = view()->getLyXText()->cursor;
 }
 
@@ -314,7 +319,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const
        switch (ev.action) {
        case LFUN_EXPORT:
                disable = ev.argument != "custom"
-                       && !Exporter::IsExportable(buf, ev.argument);
+                       && !Exporter::IsExportable(*buf, ev.argument);
                break;
        case LFUN_UNDO:
                disable = buf->undostack.empty();
@@ -340,7 +345,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const
                disable = !buf->isLatex() || lyxrc.chktex_command == "none";
                break;
        case LFUN_BUILDPROG:
-               disable = !Exporter::IsExportable(buf, "program");
+               disable = !Exporter::IsExportable(*buf, "program");
                break;
 
        case LFUN_LAYOUT_TABULAR:
@@ -509,6 +514,9 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const
                        case InsetOld::NOTE_CODE:
                                disable = ev.argument != "note";
                                break;
+                       case InsetOld::BRANCH_CODE:
+                               disable = ev.argument != "branch";
+                               break;
                        default:
                                break;
                }
@@ -545,7 +553,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const
                }
 
                if (name == "print") {
-                       disable = !Exporter::IsExportable(buf, "dvi") ||
+                       disable = !Exporter::IsExportable(*buf, "dvi") ||
                                lyxrc.print_command == "none";
                } else if (name == "character") {
                        UpdatableInset * tli = view()->theLockingInset();
@@ -637,6 +645,11 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const
        case LFUN_INSERT_NOTE:
                code = InsetOld::NOTE_CODE;
                break;
+       case LFUN_INSERT_BRANCH:
+               code = InsetOld::BRANCH_CODE;
+               if (buf->params.branchlist.empty())
+                       disable = true;
+               break;
        case LFUN_INSERT_LABEL:
                code = InsetOld::LABEL_CODE;
                break;
@@ -906,11 +919,11 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
                                goto exit_with_message;
                        } else if (result == FINISHED_UP) {
                                RowList::iterator const irow = view()->text->cursorIRow();
-                               if (irow != view()->text->rows().begin()) {
+                               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
@@ -918,17 +931,17 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
 #endif
                                        moveCursorUpdate();
                                } else {
-                                       view()->update(view()->text, BufferView::SELECT);
+                                       view()->update();
                                }
                                owner->clearMessage();
                                goto exit_with_message;
                        } else if (result == FINISHED_DOWN) {
                                RowList::iterator const irow = view()->text->cursorIRow();
-                               if (boost::next(irow) != view()->text->rows().end()) {
+                               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());
@@ -968,7 +981,7 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
                                        }
                                        goto exit_with_message;
                                case LFUN_DOWN:
-                                       if (boost::next(view()->text->cursorRow()) != view()->text->rows().end())
+                                       if (view()->text->cursorRow() != view()->text->lastRow())
                                                view()->text->cursorDown(view());
                                        else
                                                view()->text->cursorRight(view());
@@ -1026,7 +1039,7 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
 
        case LFUN_PREFIX:
                if (view()->available() && !view()->theLockingInset())
-                       view()->update(view()->text, BufferView::SELECT);
+                       view()->update();
                owner->message(keyseq.printOptions());
                break;
 
@@ -1965,4 +1978,3 @@ bool LyXFunc::wasMetaKey() const
 {
        return (meta_fake_bit != key_modifier::none);
 }
-