-/* 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"
#include "BufferView.h"
+#include "funcrequest.h"
+#include "iterators.h"
#include "lyxserver.h"
#include "intl.h"
#include "lyx_main.h"
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();
}
// actions
keyseq.clear();
// copied verbatim from do_accent_char
- view()->update(view()->getLyXText(), BufferView::SELECT);
+ view()->update();
view()->getLyXText()->selection.cursor = view()->getLyXText()->cursor;
}
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();
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:
case InsetOld::NOTE_CODE:
disable = ev.argument != "note";
break;
+ case InsetOld::BRANCH_CODE:
+ disable = ev.argument != "branch";
+ break;
default:
break;
}
}
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();
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;
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
#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());
}
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());
case LFUN_PREFIX:
if (view()->available() && !view()->theLockingInset())
- view()->update(view()->text, BufferView::SELECT);
+ view()->update();
owner->message(keyseq.printOptions());
break;
view()->owner()->updateLayoutChoice();
if (view()->available()) {
- view()->fitCursor();
+ if (view()->fitCursor()) {
+ lyxerr << "LyXFunc->fitCursor->update" << endl;
+
+ view()->update();
+ }
// If we executed a mutating lfun, mark the buffer as dirty
if (!getStatus(ev).disabled()
{
return (meta_fake_bit != key_modifier::none);
}
-