]> git.lyx.org Git - lyx.git/blobdiff - src/text3.C
Fix breakage caused by bad commits.
[lyx.git] / src / text3.C
index b50a4253ecb6e73bf33db4cf6a1ad0c46a0b1064..7f0e8465726625e9381ab528e8290b07c0e51a14 100644 (file)
@@ -65,8 +65,8 @@
 #include "support/convert.h"
 #include "support/lyxtime.h"
 
-#include "mathed/math_hullinset.h"
-#include "mathed/math_macrotemplate.h"
+#include "mathed/InsetMathHull.h"
+#include "mathed/MathMacroTemplate.h"
 
 #include <boost/current_function.hpp>
 
@@ -148,7 +148,7 @@ namespace {
 
                if (sel.empty()) {
                        const int old_pos = cur.pos();
-                       cur.insert(new MathHullInset(hullSimple));
+                       cur.insert(new InsetMathHull(hullSimple));
                        BOOST_ASSERT(old_pos == cur.pos());
                        cur.nextInset()->edit(cur, true);
                        // don't do that also for LFUN_MATH_MODE
@@ -170,7 +170,7 @@ namespace {
                        if (sel.find("\\newcommand") == string::npos
                            && sel.find("\\def") == string::npos)
                        {
-                               MathHullInset * formula = new MathHullInset;
+                               InsetMathHull * formula = new InsetMathHull;
                                LyXLex lex(0, 0);
                                lex.setStream(is);
                                formula->read(cur.buffer(), lex);
@@ -182,7 +182,7 @@ namespace {
                        } else
                                cur.insert(new MathMacroTemplate(is));
                }
-               cur.message(N_("Math editor mode"));
+               cur.message(lyx::from_utf8(N_("Math editor mode")));
        }
 
 } // namespace anon
@@ -274,8 +274,15 @@ bool doInsertInset(LCursor & cur, LyXText * text,
        if (edit)
                inset->edit(cur, true);
 
-       if (gotsel && pastesel)
+       if (gotsel && pastesel) {
                cur.bv().owner()->dispatch(FuncRequest(LFUN_PASTE));
+               // reset first par to default
+               if (cur.lastpit() != 0 || cur.lastpos() != 0) {
+                       LyXLayout_ptr const layout =
+                               cur.buffer().params().getLyXTextClass().defaultLayout();
+                       cur.text()->paragraphs().begin()->layout(layout);
+               }
+       }
        return true;
 }
 
@@ -599,7 +606,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
 
        case LFUN_CHAR_DELETE_BACKWARD:
                if (!cur.selection()) {
-                       if (bv->owner()->getIntl().getTransManager().backspace()) {
+                       if (bv->getIntl().getTransManager().backspace()) {
                                // Par boundary, full-screen update
                                if (cur.pos() == 0)
                                        singleParUpdate = false;
@@ -760,7 +767,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
                break;
 
        case LFUN_PASTE:
-               cur.message(lyx::to_utf8(_("Paste")));
+               cur.message(_("Paste"));
                lyx::cap::replaceSelection(cur);
                if (isStrUnsignedInt(lyx::to_utf8(cmd.argument())))
                        pasteSelection(cur, bv->buffer()->errorList("Paste"),
@@ -776,17 +783,18 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
 
        case LFUN_CUT:
                cutSelection(cur, true, true);
-               cur.message(lyx::to_utf8(_("Cut")));
+               cur.message(_("Cut"));
                break;
 
        case LFUN_COPY:
                copySelection(cur);
-               cur.message(lyx::to_utf8(_("Copy")));
+               cur.message(_("Copy"));
                break;
 
        case LFUN_SERVER_GET_XY:
-               cur.message(convert<string>(cursorX(cur.top(), cur.boundary())) + ' '
-                         + convert<string>(cursorY(cur.top(), cur.boundary())));
+               cur.message(lyx::from_utf8(
+                       convert<string>(cursorX(cur.top(), cur.boundary())) + ' '
+                         + convert<string>(cursorY(cur.top(), cur.boundary()))));
                break;
 
        case LFUN_SERVER_SET_XY: {
@@ -804,15 +812,15 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
 
        case LFUN_SERVER_GET_FONT:
                if (current_font.shape() == LyXFont::ITALIC_SHAPE)
-                       cur.message("E");
+                       cur.message(lyx::from_utf8("E"));
                else if (current_font.shape() == LyXFont::SMALLCAPS_SHAPE)
-                       cur.message("N");
+                       cur.message(lyx::from_utf8("N"));
                else
-                       cur.message("0");
+                       cur.message(lyx::from_utf8("0"));
                break;
 
        case LFUN_SERVER_GET_LAYOUT:
-               cur.message(cur.paragraph().layout()->name());
+               cur.message(lyx::from_utf8(cur.paragraph().layout()->name()));
                break;
 
        case LFUN_LAYOUT: {
@@ -825,7 +833,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
                // function list/array with information about what
                // functions needs arguments and their type.
                if (cmd.argument().empty()) {
-                       cur.errorMessage(lyx::to_utf8(_("LyX function 'layout' needs an argument.")));
+                       cur.errorMessage(_("LyX function 'layout' needs an argument."));
                        break;
                }
 
@@ -843,8 +851,8 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
                }
 
                if (!hasLayout) {
-                       cur.errorMessage(string(N_("Layout ")) + lyx::to_utf8(cmd.argument()) +
-                               N_(" not known"));
+                       cur.errorMessage(lyx::from_utf8(N_("Layout ")) + cmd.argument() +
+                               lyx::from_utf8(N_(" not known")));
                        break;
                }
 
@@ -1069,7 +1077,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
                docstring::const_iterator end = cmd.argument().end();
                for (; cit != end; ++cit)
 #if 0
-                       bv->owner()->getIntl().getTransManager().
+                       bv->getIntl().getTransManager().
                                translateAndInsert(*cit, this);
 #else
                        insertChar(bv->cursor(), *cit);
@@ -1198,7 +1206,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
 
        case LFUN_MATH_MACRO:
                if (cmd.argument().empty())
-                       cur.errorMessage(N_("Missing argument"));
+                       cur.errorMessage(lyx::from_utf8(N_("Missing argument")));
                else {
                        string s = lyx::to_utf8(cmd.argument());
                        string const s1 = token(s, ' ', 1);
@@ -1222,7 +1230,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
        case LFUN_MATH_MATRIX:
        case LFUN_MATH_DELIM:
        case LFUN_MATH_BIGDELIM: {
-               cur.insert(new MathHullInset(hullSimple));
+               cur.insert(new InsetMathHull(hullSimple));
                cur.dispatch(FuncRequest(LFUN_CHAR_FORWARD));
                cur.dispatch(cmd);
                break;
@@ -1303,7 +1311,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
 
        case LFUN_FONT_FREE_APPLY:
                toggleAndShow(cur, this, freefont, toggleall);
-               cur.message(lyx::to_utf8(_("Character set")));
+               cur.message(_("Character set"));
                break;
 
        // Set the freefont using the contents of \param data dispatched from
@@ -1315,7 +1323,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
                        freefont = font;
                        toggleall = toggle;
                        toggleAndShow(cur, this, freefont, toggleall);
-                       cur.message(lyx::to_utf8(_("Character set")));
+                       cur.message(_("Character set"));
                }
                break;
        }
@@ -1381,7 +1389,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
                bv->owner()->getLyXFunc().handleKeyFunc(cmd.action);
                if (!cmd.argument().empty())
                        // FIXME: Are all these characters encoded in one byte in utf8?
-                       bv->owner()->getIntl().getTransManager()
+                       bv->getIntl().getTransManager()
                                .translateAndInsert(cmd.argument()[0], this);
                break;
 
@@ -1448,7 +1456,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
                                         params.align(),
                                         params.labelWidthString(),
                                         params.noindent());
-               cur.message(lyx::to_utf8(_("Paragraph layout set")));
+               cur.message(_("Paragraph layout set"));
                break;
        }