#include "BufferView.h"
#include "cursor.h"
#include "debug.h"
+#include "dispatchresult.h"
#include "encoding.h"
#include "exporter.h"
#include "format.h"
disable = true;
}
} else {
- static InsetTabular inset(*owner->buffer(), 1, 1);
- FuncStatus ret;
-
+ static InsetTabular inset(*buf, 1, 1);
disable = true;
- ret = inset.getStatus(ev.argument);
+ FuncStatus ret = inset.getStatus(ev.argument);
if (ret.onoff(true) || ret.onoff(false))
flag.setOnOff(false);
}
disable = buf->isUnnamed() || buf->isClean();
break;
case LFUN_BOOKMARK_GOTO:
- disable = !view()->
+ disable = !view()->
isSavedPosition(strToUnsignedInt(ev.argument));
break;
+
case LFUN_MERGE_CHANGES:
case LFUN_ACCEPT_CHANGE:
case LFUN_REJECT_CHANGE:
case LFUN_REJECT_ALL_CHANGES:
disable = !buf->params().tracking_changes;
break;
+
case LFUN_INSET_TOGGLE: {
LyXText * lt = view()->getLyXText();
disable = !(isEditableInset(lt->getInset())
code = InsetOld::SPACE_CODE;
break;
case LFUN_INSET_DIALOG_SHOW: {
- LyXText * lt = view()->getLyXText();
- InsetOld * inset = lt->getInset();
- disable = !inset;
- if (!disable) {
- code = inset->lyxCode();
- if (!(code == InsetOld::INCLUDE_CODE
- || code == InsetOld::BIBTEX_CODE
- || code == InsetOld::FLOAT_LIST_CODE
- || code == InsetOld::TOC_CODE))
- disable = true;
- }
+ InsetOld * inset = view()->getLyXText()->getInset();
+ disable = !inset;
+ if (!disable) {
+ code = inset->lyxCode();
+ if (!(code == InsetOld::INCLUDE_CODE
+ || code == InsetOld::BIBTEX_CODE
+ || code == InsetOld::FLOAT_LIST_CODE
+ || code == InsetOld::TOC_CODE))
+ disable = true;
}
break;
+ }
default:
break;
}
if (view()->available())
view()->hideCursor();
-#if 0
+#if 1
{
Cursor cursor;
buildCursor(cursor, *view());
- if (cursor.dispatch(FuncRequest(func, view())) == DISPATCHED) {
+ DispatchResult result =
+ cursor.dispatch(FuncRequest(func, view()));
+
+ if (result.dispatched()) {
+ if (result.update()) {
+ view()->update();
+ }
lyxerr << "dispatched by Cursor::dispatch()\n";
goto exit_with_message;
}
+ lyxerr << "### NOT DispatchResult(true, true) BY Cursor::dispatch() ###\n";
}
#endif
if (view()->available() && view()->theLockingInset()) {
- dispatch_result result;
+ DispatchResult result;
if (action > 1 || (action == LFUN_UNKNOWN_ACTION &&
!keyseq.deleted()))
{
int dummy_y;
inset->getCursorPos(view(), inset_x, dummy_y);
#endif
- if (action == LFUN_UNKNOWN_ACTION
- && argument.empty()) {
+ if (action == LFUN_UNKNOWN_ACTION && argument.empty())
argument = encoded_last_key;
- }
// the insets can't try to handle this,
// a table cell in the dummy position will
// Hand-over to inset's own dispatch:
result = inset->dispatch(FuncRequest(view(), action, argument));
- if (result == DISPATCHED || result == DISPATCHED_NOUPDATE) {
+ if (result.dispatched()) {
+ if (result.update())
+ view()->update();
+
goto exit_with_message;
}
- // If UNDISPATCHED, just soldier on
- if (result == FINISHED) {
+ // If DispatchResult(false), just soldier on
+ if (result.val() == FINISHED) {
owner->clearMessage();
goto exit_with_message;
// We do not need special RTL handling here:
// one position after the inset.
}
- if (result == FINISHED_RIGHT) {
+ if (result.val() == FINISHED_RIGHT) {
view()->text->cursorRight(view());
moveCursorUpdate();
owner->clearMessage();
goto exit_with_message;
}
- if (result == FINISHED_UP) {
+ if (result.val() == FINISHED_UP) {
LyXText * text = view()->text;
ParagraphList::iterator pit = text->cursorPar();
Row const & row = *pit->getRow(text->cursor.pos());
text->cursor.x() + inset_x,
text->cursor.y() -
row.baseline() - 1);
- text->cursor.x_fix(text->cursor.x());
+ view()->x_target(text->cursor.x());
#else
text->cursorUp(view());
#endif
goto exit_with_message;
}
- if (result == FINISHED_DOWN) {
+ if (result.val() == FINISHED_DOWN) {
LyXText * text = view()->text;
ParagraphList::iterator pit = text->cursorPar();
Row const & row = *pit->getRow(text->cursor.pos());
text->cursor.y() -
row.baseline() +
row.height() + 1);
- text->cursor.x_fix(text->cursor.x());
+ view()->x_target(text->cursor.x());
#else
text->cursorDown(view());
#endif
}
#warning I am not sure this is still right, please have a look! (Jug 20020417)
- // result == UNDISPATCHED
+ // result == DispatchResult()
//setMessage(N_("Text mode"));
switch (action) {
case LFUN_UNKNOWN_ACTION:
}
bool fw = (action == LFUN_WORDFINDFORWARD);
if (!searched_string.empty())
- lyx::find::find(view(), searched_string, fw);
+ lyx::find::find(view(), searched_string,
+ true, false, fw);
break;
}
QuitLyX();
break;
- case LFUN_TOCVIEW:
- {
+ case LFUN_TOCVIEW: {
InsetCommandParams p("tableofcontents");
string const data = InsetCommandMailer::params2string("toc", p);
owner->getDialogs().show("toc", data, 0);
//#warning Find another implementation here (or another lyxfunc)!
#endif
#endif
- case LFUN_HELP_OPEN:
- {
+
+ case LFUN_HELP_OPEN: {
string const arg = argument;
if (arg.empty()) {
setErrorMessage(N_("Missing argument"));
break;
}
- case LFUN_DIALOG_SHOW_NEXT_INSET:
+ case LFUN_DIALOG_SHOW_NEXT_INSET:
break;
case LFUN_INSET_DIALOG_SHOW: {
InsetOld * inset = view()->getLyXText()->getInset();
- if (inset)
+ if (inset)
inset->dispatch(FuncRequest(view(), LFUN_INSET_DIALOG_SHOW));
break;
}
argument = split(argument, countstr, ' ');
istringstream is(countstr);
int count = 0;
- is >> count;
+ is >> count;
lyxerr << "repeat: count: " << count << " cmd: " << argument << endl;
for (int i = 0; i < count; ++i)
dispatch(lyxaction.lookupFunc(argument));
if (isStrInt(argument)) {
pid_t const pid = strToInt(argument);
ForkedcallsController & fcc = ForkedcallsController::get();
- fcc.kill(pid);
+ fcc.kill(pid);
}
break;