#include "mathed/InsetMathHull.h"
#include "mathed/MathMacroTemplate.h"
-#include "mathed/MathParser.h"
#include <boost/next_prior.hpp>
case LFUN_FLOAT_INSERT:
case LFUN_FLOAT_WIDE_INSERT:
case LFUN_WRAP_INSERT: {
- bool content = cur.selection(); // will some text be moved into the inset?
+ // will some text be moved into the inset?
+ bool content = cur.selection();
doInsertInset(cur, this, cmd, true, true);
cur.posForward();
+
+ // If some text is moved into the inset, doInsertInset
+ // puts the cursor outside the inset. To insert the
+ // caption we put it back into the inset.
+ if (content)
+ cur.backwardPos();
+
ParagraphList & pars = cur.text()->paragraphs();
DocumentClass const & tclass = bv->buffer().params().documentClass();
// We cannot use Cursor::dispatch here it needs access to up to
// date metrics.
FuncRequest cmd_caption(LFUN_CAPTION_INSERT);
- cur.text()->dispatch(cur, cmd_caption);
+ doInsertInset(cur, cur.text(), cmd_caption, true, false);
+ updateLabels(bv->buffer());
cur.updateFlags(Update::Force);
// FIXME: When leaving the Float (or Wrap) inset we should
// delete any empty paragraph left above or below the
string s = cmd.getArg(0);
InsetLayout il =
cur.buffer().params().documentClass().insetLayout(from_utf8(s));
- if (il.lyxtype() != "charstyle" &&
- il.lyxtype() != "custom" &&
- il.lyxtype() != "element" &&
- il.lyxtype ()!= "standard")
+ if (il.lyxtype() != InsetLayout::CHARSTYLE &&
+ il.lyxtype() != InsetLayout::CUSTOM &&
+ il.lyxtype() != InsetLayout::ELEMENT &&
+ il.lyxtype ()!= InsetLayout::STANDARD)
enable = false;
break;
}
case LFUN_INSET_DISSOLVE:
if (!cmd.argument().empty()) {
- InsetLayout il = cur.inset().getLayout(cur.buffer().params());
+ InsetLayout const & il = cur.inset().getLayout(cur.buffer().params());
+ InsetLayout::InsetLyXType const type =
+ translateLyXType(to_utf8(cmd.argument()));
enable = cur.inset().lyxCode() == FLEX_CODE
- && il.lyxtype() == to_utf8(cmd.argument());
+ && il.lyxtype() == type;
} else {
enable = !isMainText(cur.bv().buffer())
&& cur.inset().nargs() == 1;