#include "paragraph_funcs.h"
#include "ParagraphParameters.h"
#include "TextMetrics.h"
-#include "Undo.h"
#include "VSpace.h"
#include "ParIterator.h"
static void finishChange(Cursor & cur, bool selecting)
{
- finishUndo();
+ cur.finishUndo();
moveCursor(cur, selecting);
}
static void mathDispatch(Cursor & cur, FuncRequest const & cmd, bool display)
{
- recordUndo(cur);
+ cur.recordUndo();
docstring sel = cur.selectionAsString(false);
// It may happen that sel is empty but there is a selection
static void specialChar(Cursor & cur, InsetSpecialChar::Kind kind)
{
- recordUndo(cur);
+ cur.recordUndo();
cap::replaceSelection(cur);
cur.insert(new InsetSpecialChar(kind));
cur.posRight();
if (!inset)
return false;
- recordUndo(cur);
+ cur.recordUndo();
if (cmd.action == LFUN_INDEX_INSERT) {
docstring ds = support::subst(text->getStringToIndex(cur), '\n', ' ');
text->insertInset(cur, inset);
case LFUN_PARAGRAPH_MOVE_DOWN: {
pit_type const pit = cur.pit();
recUndo(cur, pit, pit + 1);
- finishUndo();
+ cur.finishUndo();
std::swap(pars_[pit], pars_[pit + 1]);
updateLabels(cur.buffer());
needsUpdate = true;
case LFUN_PARAGRAPH_MOVE_UP: {
pit_type const pit = cur.pit();
recUndo(cur, pit - 1, pit);
- finishUndo();
+ cur.finishUndo();
std::swap(pars_[pit], pars_[pit - 1]);
updateLabels(cur.buffer());
--cur.pit();
}
}
- recordUndo(cur);
+ cur.recordUndo();
par.params().startOfAppendix(start);
// we can set the refreshing parameters now
// this avoids a double undo
// FIXME: should not be needed, ideally
if (!cur.selection())
- recordUndo(cur);
+ cur.recordUndo();
cap::replaceSelection(cur);
cur.insert(new InsetNewline);
cur.posRight();
}
case LFUN_INSET_INSERT: {
- recordUndo(cur);
+ cur.recordUndo();
Inset * inset = createInset(bv, cmd);
if (inset) {
// FIXME (Abdel 01/02/2006):
}
bv->buffer().errors("Paste");
cur.clearSelection(); // bug 393
- finishUndo();
+ cur.finishUndo();
break;
case LFUN_CUT:
// this avoids a double undo
// FIXME: should not be needed, ideally
if (!cur.selection())
- recordUndo(cur);
+ cur.recordUndo();
cap::replaceSelection(cur);
pos = cur.pos();
char_type c;
bv->buffer().errorList("Paste"));
bv->buffer().errors("Paste");
bv->buffer().markDirty();
- finishUndo();
+ bv->cursor().finishUndo();
} else {
lyx::dispatch(FuncRequest(LFUN_PRIMARY_SELECTION_PASTE, "paragraph"));
}
}
case LFUN_HYPERLINK_INSERT: {
- InsetCommandParams p("href");
+ InsetCommandParams p(HYPERLINK_CODE);
docstring content;
if (cur.selection()) {
content = cur.selectionAsString(false);
}
case LFUN_LABEL_INSERT: {
- InsetCommandParams p("label");
+ InsetCommandParams p(LABEL_CODE);
// Try to generate a valid label
p["name"] = (cmd.argument().empty()) ?
cur.getPossibleLabel() :
Inset * inset = createInset(&cur.bv(), cmd);
if (!inset)
break;
- recordUndo(cur);
+ cur.recordUndo();
cur.clearSelection();
insertInset(cur, inset);
// Show the dialog for the nomenclature entry, since the
case LFUN_FLOAT_LIST: {
TextClass const & tclass = bv->buffer().params().getTextClass();
if (tclass.floats().typeExist(to_utf8(cmd.argument()))) {
- recordUndo(cur);
+ cur.recordUndo();
if (cur.selection())
cutSelection(cur, true, false);
breakParagraph(cur);
break;
case LFUN_BRANCH_INSERT:
code = BRANCH_CODE;
- if (cur.buffer().getMasterBuffer()->params().branchlist().empty())
+ if (cur.buffer().masterBuffer()->params().branchlist().empty())
enable = false;
break;
case LFUN_LABEL_INSERT:
case LFUN_INSET_DISSOLVE:
if (!cmd.argument().empty()) {
InsetLayout il = cur.inset().getLayout(cur.buffer().params());
- enable = (cur.inset().lyxCode() == FLEX_CODE)
- && (il.lyxtype == to_utf8(cmd.argument()));
- } else
+ enable = cur.inset().lyxCode() == FLEX_CODE
+ && il.lyxtype == to_utf8(cmd.argument());
+ } else {
enable = !isMainText(cur.bv().buffer())
- && cur.inset().nargs() == 1;
+ && cur.inset().nargs() == 1;
+ }
break;
case LFUN_CHANGE_ACCEPT:
{
cur.clearSelection();
if (!clip.empty()) {
- recordUndo(cur);
+ cur.recordUndo();
if (asParagraphs)
insertStringAsParagraphs(cur, clip);
else