]> git.lyx.org Git - lyx.git/blobdiff - src/Text3.cpp
Fixme comment.
[lyx.git] / src / Text3.cpp
index 5c8c4dd4fd24af18dba92f0cfcdff878ac3d1127..11f5e4e9012b77683bd2a9680dc6fdd27f2b592b 100644 (file)
@@ -67,7 +67,6 @@
 
 #include "mathed/InsetMathHull.h"
 #include "mathed/MathMacroTemplate.h"
-#include "mathed/MathParser.h"
 
 #include <boost/next_prior.hpp>
 
@@ -1409,10 +1408,18 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
        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();
@@ -1439,7 +1446,8 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                // 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
@@ -1984,10 +1992,10 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
                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;
                }
@@ -2137,9 +2145,11 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
 
        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;