]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/MathMacroTemplate.cpp
* src/mathed/InsetMathHull.cpp:
[lyx.git] / src / mathed / MathMacroTemplate.cpp
index a0259b0181fe87927d89efcce59d9dce8ce15e5e..11b9ae90c6e096f20cf30691bc403e745bae272b 100644 (file)
@@ -36,6 +36,7 @@
 
 #include "frontends/Painter.h"
 
+#include "support/lassert.h"
 #include "support/convert.h"
 #include "support/debug.h"
 #include "support/gettext.h"
@@ -618,7 +619,7 @@ bool MathMacroTemplate::notifyCursorLeaves(Cursor const & old, Cursor & cur)
        // find this in cursor old
        Cursor insetCur = old;
        int scriptSlice = insetCur.find(this);
-       BOOST_ASSERT(scriptSlice != -1);
+       LASSERT(scriptSlice != -1, /**/);
        insetCur.cutOff(scriptSlice);
        
        commitEditChanges(insetCur);
@@ -656,7 +657,7 @@ void MathMacroTemplate::shiftArguments(size_t from, int by) {
                if (it.nextInset()->lyxCode() != MATHMACROARG_CODE)
                        continue;
                MathMacroArgument * arg = static_cast<MathMacroArgument*>(it.nextInset());
-               if (arg->number() >= from + 1)
+               if (arg->number() >= int(from) + 1)
                        arg->setNumber(arg->number() + by);
        }
 
@@ -1046,48 +1047,48 @@ bool MathMacroTemplate::getStatus(Cursor & /*cur*/, FuncRequest const & cmd,
                                num = convert<int>(arg);
                        bool on = (num >= optionals_
                                   && numargs_ < 9 && num <= numargs_ + 1);
-                       flag.enabled(on);
+                       flag.setEnabled(on);
                        break;
                }
 
                case LFUN_MATH_MACRO_APPEND_GREEDY_PARAM:
-                       flag.enabled(numargs_ < 9);
+                       flag.setEnabled(numargs_ < 9);
                        break;
 
                case LFUN_MATH_MACRO_REMOVE_PARAM: {
                        int num = numargs_;
                        if (arg.size() != 0)
                                num = convert<int>(arg);
-                       flag.enabled(num >= 1 && num <= numargs_);
+                       flag.setEnabled(num >= 1 && num <= numargs_);
                        break;
                }
 
                case LFUN_MATH_MACRO_MAKE_OPTIONAL:
-                       flag.enabled(numargs_ > 0
+                       flag.setEnabled(numargs_ > 0
                                     && optionals_ < numargs_
                                     && type_ != MacroTypeDef);
                        break;
 
                case LFUN_MATH_MACRO_MAKE_NONOPTIONAL:
-                       flag.enabled(optionals_ > 0
+                       flag.setEnabled(optionals_ > 0
                                     && type_ != MacroTypeDef);
                        break;
 
                case LFUN_MATH_MACRO_ADD_OPTIONAL_PARAM:
-                       flag.enabled(numargs_ < 9);
+                       flag.setEnabled(numargs_ < 9);
                        break;
 
                case LFUN_MATH_MACRO_REMOVE_OPTIONAL_PARAM:
-                       flag.enabled(optionals_ > 0);
+                       flag.setEnabled(optionals_ > 0);
                        break;
 
                case LFUN_MATH_MACRO_ADD_GREEDY_OPTIONAL_PARAM:
-                       flag.enabled(numargs_ == 0
+                       flag.setEnabled(numargs_ == 0
                                     && type_ != MacroTypeDef);
                        break;
 
                case LFUN_IN_MATHMACROTEMPLATE:
-                       flag.enabled();
+                       flag.setEnabled(true);
                        break;
 
                default:
@@ -1116,7 +1117,7 @@ void MathMacroTemplate::read(Lexer & lex)
 void MathMacroTemplate::write(ostream & os) const
 {
        odocstringstream oss;
-       WriteStream wi(oss, false, false);
+       WriteStream wi(oss, false, false, false);
        oss << "FormulaMacro\n";
        write(wi);
        os << to_utf8(oss.str());
@@ -1140,7 +1141,7 @@ void MathMacroTemplate::write(WriteStream & os, bool overwriteRedefinition) cons
                        else
                                os << "\\newcommandx";
 
-                       os << "\\" << name().c_str()
+                       os << "\\" << name()
                           << "[" << numargs_ << "]"
                           << "[usedefault, addprefix=\\global";
                        for (int i = 0; i < optionals_; ++i) {
@@ -1157,7 +1158,7 @@ void MathMacroTemplate::write(WriteStream & os, bool overwriteRedefinition) cons
                } else {
                        // macros without optionals use standard _global_ \def macros:
                        // \global\def\foo#1#2{#1,#2}
-                       os << "\\global\\def\\" << name().c_str();
+                       os << "\\global\\def\\" << name();
                        docstring param = from_ascii("#0");
                        for (int i = 1; i <= numargs_; ++i) { 
                                param[1] = '0' + i;
@@ -1172,7 +1173,7 @@ void MathMacroTemplate::write(WriteStream & os, bool overwriteRedefinition) cons
                        os << "\\renewcommand";
                else
                        os << "\\newcommand";
-               os << "{\\" << name().c_str() << '}';
+               os << "{\\" << name() << '}';
                if (numargs_ > 0)
                        os << '[' << numargs_ << ']';