#include "insets/InsetSpecialChar.h"
#include "insets/InsetText.h"
#include "insets/InsetInfo.h"
+#include "insets/InsetGraphics.h"
+#include "insets/InsetGraphicsParams.h"
#include "support/convert.h"
#include "support/debug.h"
moveCursor(cur, false);
break;
- case LFUN_DELETE_FORWARD_SKIP:
- // Reverse the effect of LFUN_BREAK_PARAGRAPH_SKIP.
- if (!cur.selection()) {
- if (cur.pos() == cur.lastpos()) {
- cursorForward(cur);
- cursorBackward(cur);
- }
- erase(cur);
- cur.resetAnchor();
- } else {
- cutSelection(cur, true, false);
- }
- break;
-
-
case LFUN_CHAR_DELETE_BACKWARD:
if (!cur.selection()) {
if (bv->getIntl().getTransManager().backspace()) {
}
break;
- case LFUN_DELETE_BACKWARD_SKIP:
- // Reverse the effect of LFUN_BREAK_PARAGRAPH_SKIP.
- if (!cur.selection()) {
- // FIXME: look here
- //CursorSlice cur = cursor();
- backspace(cur);
- //anchor() = cur;
- } else {
- cutSelection(cur, true, false);
- }
- break;
-
case LFUN_BREAK_PARAGRAPH:
cap::replaceSelection(cur);
breakParagraph(cur, cmd.argument() == "inverse");
cur.resetAnchor();
break;
- case LFUN_BREAK_PARAGRAPH_SKIP: {
- // When at the beginning of a paragraph, remove
- // indentation. Otherwise, do the same as LFUN_BREAK_PARAGRAPH.
- cap::replaceSelection(cur);
- if (cur.pos() == 0)
- cur.paragraph().params().labelWidthString(docstring());
- else
- breakParagraph(cur, false);
- cur.resetAnchor();
- break;
- }
-
// TODO
// With the creation of LFUN_PARAGRAPH_PARAMS, this is now redundant,
// as its duties can be performed there. Should it be removed??
break;
}
+ case LFUN_SET_GRAPHICS_GROUP: {
+ InsetGraphics * ins = graphics::getCurrentGraphicsInset(cur);
+ if (!ins)
+ break;
+
+ cur.recordUndoFullDocument();
+
+ string id = to_utf8(cmd.argument());
+ string grp = graphics::getGroupParams(bv->buffer(), id);
+ InsetGraphicsParams tmp, inspar = ins->getParams();
+
+ if (id.empty())
+ inspar.groupId = to_utf8(cmd.argument());
+ else {
+ InsetGraphics::string2params(grp, bv->buffer(), tmp);
+ tmp.filename = inspar.filename;
+ inspar = tmp;
+ }
+
+ ins->setParams(inspar);
+ }
+
case LFUN_SPACE_INSERT:
if (cur.paragraph().layout().free_spacing)
insertChar(cur, ' ');
cur.noUpdate();
return;
+ case mouse_button::none:
+ case mouse_button::button4:
+ case mouse_button::button5:
+ break;
} // switch (cmd.button())
break;
}
case LFUN_INFO_INSERT: {
- Inset * inset = createInset(cur.bv().buffer(), cmd);
- if (!inset)
- break;
- // if an empty inset is created (cmd.argument() is empty)
- // use current selection as parameter.
+ Inset * inset;
if (cmd.argument().empty() && cur.selection()) {
- // use selected text as info to avoid a separate UI
+ // if command argument is empty use current selection as parameter.
docstring ds = cur.selectionAsString(false);
cutSelection(cur, true, false);
- static_cast<InsetInfo *>(inset)->setInfo(to_utf8(ds));
- static_cast<InsetInfo *>(inset)->updateInfo();
+ FuncRequest cmd0(cmd, ds);
+ inset = createInset(cur.bv().buffer(), cmd0);
+ } else {
+ inset = createInset(cur.bv().buffer(), cmd);
}
+ if (!inset)
+ break;
insertInset(cur, inset);
cur.posForward();
break;
}
-#if 0
- case LFUN_LIST_INSERT:
-#endif
case LFUN_CAPTION_INSERT:
case LFUN_FOOTNOTE_INSERT:
case LFUN_NOTE_INSERT:
break;
}
- case LFUN_FONT_FREE_APPLY:
+ case LFUN_TEXTSTYLE_APPLY:
toggleAndShow(cur, this, freefont, toggleall);
cur.message(_("Character set"));
break;
// Set the freefont using the contents of \param data dispatched from
// the frontends and apply it at the current cursor location.
- case LFUN_FONT_FREE_UPDATE: {
+ case LFUN_TEXTSTYLE_UPDATE: {
Font font;
bool toggle;
if (font.fromString(to_utf8(cmd.argument()), toggle)) {
case LFUN_ACCENT_UNDERDOT:
case LFUN_ACCENT_UNDERBAR:
case LFUN_ACCENT_CARON:
- case LFUN_ACCENT_SPECIAL_CARON:
case LFUN_ACCENT_BREVE:
case LFUN_ACCENT_TIE:
case LFUN_ACCENT_HUNGARIAN_UMLAUT:
bv->translateAndInsert(cmd.argument()[0], this, cur);
break;
- case LFUN_FLOAT_LIST: {
+ case LFUN_FLOAT_LIST_INSERT: {
DocumentClass const & tclass = bv->buffer().params().documentClass();
if (tclass.floats().typeExist(to_utf8(cmd.argument()))) {
cur.recordUndo();
case LFUN_APPENDIX:
flag.setOnOff(cur.paragraph().params().startOfAppendix());
- return true;
+ break;
case LFUN_BIBITEM_INSERT:
enable = (cur.paragraph().layout().labeltype == LABEL_BIBLIO
case LFUN_WRAP_INSERT:
code = WRAP_CODE;
break;
- case LFUN_FLOAT_LIST:
+ case LFUN_FLOAT_LIST_INSERT:
code = FLOAT_LIST_CODE;
break;
-#if 0
- case LFUN_LIST_INSERT:
- code = LIST_CODE;
- break;
-#endif
case LFUN_CAPTION_INSERT:
code = CAPTION_CODE;
break;
case LFUN_FONT_EMPH:
flag.setOnOff(fontinfo.emph() == FONT_ON);
- return true;
+ break;
case LFUN_FONT_NOUN:
flag.setOnOff(fontinfo.noun() == FONT_ON);
- return true;
+ break;
case LFUN_FONT_BOLD:
flag.setOnOff(fontinfo.series() == BOLD_SERIES);
- return true;
+ break;
case LFUN_FONT_SANS:
flag.setOnOff(fontinfo.family() == SANS_FAMILY);
- return true;
+ break;
case LFUN_FONT_ROMAN:
flag.setOnOff(fontinfo.family() == ROMAN_FAMILY);
- return true;
+ break;
case LFUN_FONT_TYPEWRITER:
flag.setOnOff(fontinfo.family() == TYPEWRITER_FAMILY);
- return true;
+ break;
case LFUN_CUT:
case LFUN_COPY:
enable = (cur.pos() > cur.paragraph().beginOfBody());
break;
+ case LFUN_SET_GRAPHICS_GROUP: {
+ InsetGraphics * ins = graphics::getCurrentGraphicsInset(cur);
+ if (!ins)
+ enable = false;
+ else
+ flag.setOnOff(to_utf8(cmd.argument()) == ins->getParams().groupId);
+ break;
+ }
+
case LFUN_WORD_DELETE_FORWARD:
case LFUN_WORD_DELETE_BACKWARD:
case LFUN_LINE_DELETE:
case LFUN_LINE_BEGIN:
case LFUN_LINE_END:
case LFUN_CHAR_DELETE_FORWARD:
- case LFUN_DELETE_FORWARD_SKIP:
case LFUN_CHAR_DELETE_BACKWARD:
- case LFUN_DELETE_BACKWARD_SKIP:
case LFUN_BREAK_PARAGRAPH:
- case LFUN_BREAK_PARAGRAPH_SKIP:
case LFUN_PARAGRAPH_SPACING:
case LFUN_INSET_INSERT:
case LFUN_WORD_UPCASE:
case LFUN_FONT_UNDERLINE:
case LFUN_FONT_SIZE:
case LFUN_LANGUAGE:
- case LFUN_FONT_FREE_APPLY:
- case LFUN_FONT_FREE_UPDATE:
+ case LFUN_TEXTSTYLE_APPLY:
+ case LFUN_TEXTSTYLE_UPDATE:
case LFUN_LAYOUT_PARAGRAPH:
case LFUN_PARAGRAPH_UPDATE:
case LFUN_ACCENT_UMLAUT:
case LFUN_ACCENT_UNDERDOT:
case LFUN_ACCENT_UNDERBAR:
case LFUN_ACCENT_CARON:
- case LFUN_ACCENT_SPECIAL_CARON:
case LFUN_ACCENT_BREVE:
case LFUN_ACCENT_TIE:
case LFUN_ACCENT_HUNGARIAN_UMLAUT:
&& (cur.empty() || !cur.inset().insetAllowed(code)))
enable = false;
- flag.enabled(enable);
+ flag.setEnabled(enable);
return true;
}