#include "rowpainter.h"
#include "sgml.h"
#include "texrow.h"
-#include "undo_funcs.h"
+#include "undo.h"
#include "WordLangTuple.h"
#include "frontends/Alert.h"
if (the_locking_inset) {
if (the_locking_inset == inset) {
- the_locking_inset->localDispatch(cmd1);
+ the_locking_inset->dispatch(cmd1);
return;
}
// otherwise only unlock the_locking_inset
if (!bv->lockInset(uinset)) {
lyxerr[Debug::INSETS] << "Cannot lock inset" << endl;
}
- inset->localDispatch(cmd1);
+ inset->dispatch(cmd1);
if (the_locking_inset)
updateLocal(bv, false);
return;
if (!inset) {
bool paste_internally = false;
if (cmd.button() == mouse_button::button2 && getLyXText(bv)->selection.set()) {
- localDispatch(FuncRequest(bv, LFUN_COPY));
+ dispatch(FuncRequest(bv, LFUN_COPY));
paste_internally = true;
}
int old_top_y = bv->top_y();
// insert this
if (cmd.button() == mouse_button::button2) {
if (paste_internally)
- localDispatch(FuncRequest(bv, LFUN_PASTE));
+ dispatch(FuncRequest(bv, LFUN_PASTE));
else
- localDispatch(FuncRequest(bv, LFUN_PASTESELECTION, "paragraph"));
+ dispatch(FuncRequest(bv, LFUN_PASTESELECTION, "paragraph"));
}
} else {
getLyXText(bv)->clearSelection();
no_selection = true;
if (the_locking_inset)
- return the_locking_inset->localDispatch(cmd1);
+ return the_locking_inset->dispatch(cmd1);
int tmp_x = cmd.x;
int tmp_y = cmd.y + dim_.asc - bv->top_y();
// We still need to deal properly with the whole relative vs.
// absolute mouse co-ords thing in a realiable, sensible way
- bool ret = inset->localDispatch(cmd1);
+ bool ret = inset->dispatch(cmd1);
updateLocal(bv, false);
return ret;
}
cmd1.y -= inset_y;
if (the_locking_inset) {
- the_locking_inset->localDispatch(cmd1);
+ the_locking_inset->dispatch(cmd1);
return;
}
}
-InsetOld::RESULT InsetText::localDispatch(FuncRequest const & cmd)
+dispatch_result
+InsetText::priv_dispatch(FuncRequest const & cmd,
+ idx_type & idx, pos_type & pos)
{
BufferView * bv = cmd.view();
setViewCache(bv);
switch (cmd.action) {
case LFUN_INSET_EDIT: {
- UpdatableInset::localDispatch(cmd);
+ UpdatableInset::priv_dispatch(cmd, idx, pos);
if (!bv->lockInset(this)) {
lyxerr[Debug::INSETS] << "Cannot lock inset" << endl;
bool was_empty = paragraphs.begin()->empty() && paragraphs.size() == 1;
no_selection = false;
- RESULT result = UpdatableInset::localDispatch(cmd);
+ dispatch_result result = UpdatableInset::priv_dispatch(cmd, idx, pos);
if (result != UNDISPATCHED)
return DISPATCHED;
return FINISHED;
if (the_locking_inset) {
- result = the_locking_inset->localDispatch(cmd);
+ result = the_locking_inset->dispatch(cmd);
if (result == DISPATCHED_NOUPDATE)
return result;
if (result == DISPATCHED) {
}
-InsetOld::RESULT InsetText::moveRight(BufferView * bv)
+dispatch_result InsetText::moveRight(BufferView * bv)
{
if (text_.cursorPar()->isRightToLeftPar(bv->buffer()->params()))
return moveLeftIntern(bv, false, true, false);
}
-InsetOld::RESULT InsetText::moveLeft(BufferView * bv)
+dispatch_result InsetText::moveLeft(BufferView * bv)
{
if (text_.cursorPar()->isRightToLeftPar(bv->buffer()->params()))
return moveRightIntern(bv, true, true, false);
}
-InsetOld::RESULT
+dispatch_result
InsetText::moveRightIntern(BufferView * bv, bool front,
bool activate_inset, bool selecting)
{
}
-InsetOld::RESULT
+dispatch_result
InsetText::moveLeftIntern(BufferView * bv, bool front,
bool activate_inset, bool selecting)
{
}
-InsetOld::RESULT InsetText::moveUp(BufferView * bv)
+dispatch_result InsetText::moveUp(BufferView * bv)
{
if (crow() == text_.firstRow())
return FINISHED_UP;
}
-InsetOld::RESULT InsetText::moveDown(BufferView * bv)
+dispatch_result InsetText::moveDown(BufferView * bv)
{
if (crow() == text_.lastRow())
return FINISHED_DOWN;
if (text_.selection.set())
- recordUndo(bv, Undo::ATOMIC, text_.cursorPar());
+ text_.recUndo(text_.cursor.par());
if (selectall) {
text_.cursorTop();
if (!isHighlyEditableInset(inset))
return false;
FuncRequest cmd(bv, LFUN_INSET_EDIT, front ? "left" : "right");
- inset->localDispatch(cmd);
+ inset->dispatch(cmd);
if (!the_locking_inset)
return false;
updateLocal(bv, false);
inset_x = cx() - top_x;
inset_y = cy();
FuncRequest cmd(bv, LFUN_INSET_EDIT, x - inset_x, y - inset_y, button);
- inset->localDispatch(cmd);
+ inset->dispatch(cmd);
if (!the_locking_inset)
return false;
updateLocal(bv, false);
}
+LyXText * InsetText::getText(int i) const
+{
+ return (i == 0) ? const_cast<LyXText*>(&text_) : 0;
+}
+
+
LyXCursor const & InsetText::cursor(BufferView * bv) const
{
if (the_locking_inset)