From 80ea3a1e4b9e66918fb7733e99bfc14aef5a977f Mon Sep 17 00:00:00 2001 From: rgheck Date: Thu, 16 Jul 2009 19:00:24 +0000 Subject: [PATCH] Give inset codes to all the math insets, so we get more information when we run into assertions. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30634 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/Text3.cpp | 2 +- src/insets/Inset.cpp | 61 ++++++++++++++++++++-- src/insets/InsetCode.h | 106 +++++++++++++++++++++++++++++++++++++- src/mathed/InsetFormulaMacro.h | 4 +- src/mathed/InsetMath.h | 2 + src/mathed/InsetMathAMSArray.h | 2 + src/mathed/InsetMathArray.h | 2 + src/mathed/InsetMathBig.h | 3 +- src/mathed/InsetMathBoldSymbol.h | 2 + src/mathed/InsetMathBox.h | 2 + src/mathed/InsetMathBrace.h | 2 + src/mathed/InsetMathCases.h | 2 + src/mathed/InsetMathChar.h | 2 + src/mathed/InsetMathColor.h | 2 + src/mathed/InsetMathComment.h | 2 + src/mathed/InsetMathDecoration.h | 2 + src/mathed/InsetMathDelim.h | 2 + src/mathed/InsetMathDiff.h | 2 + src/mathed/InsetMathDots.h | 2 + src/mathed/InsetMathEnsureMath.h | 2 + src/mathed/InsetMathEnv.h | 2 + src/mathed/InsetMathExFunc.h | 2 + src/mathed/InsetMathExInt.h | 2 + src/mathed/InsetMathFont.h | 2 + src/mathed/InsetMathFontOld.h | 2 + src/mathed/InsetMathFrac.h | 2 + src/mathed/InsetMathGrid.h | 3 ++ src/mathed/InsetMathHull.cpp | 6 --- src/mathed/InsetMathHull.h | 4 +- src/mathed/InsetMathKern.h | 3 ++ src/mathed/InsetMathLefteqn.h | 3 ++ src/mathed/InsetMathLim.h | 3 ++ src/mathed/InsetMathMBox.h | 3 ++ src/mathed/InsetMathMatrix.h | 3 ++ src/mathed/InsetMathNest.h | 2 + src/mathed/InsetMathNumber.h | 2 + src/mathed/InsetMathOverset.h | 3 ++ src/mathed/InsetMathPar.h | 3 ++ src/mathed/InsetMathPhantom.h | 3 ++ src/mathed/InsetMathRef.h | 3 ++ src/mathed/InsetMathRoot.h | 3 ++ src/mathed/InsetMathScript.h | 3 ++ src/mathed/InsetMathSize.h | 3 ++ src/mathed/InsetMathSpace.h | 3 ++ src/mathed/InsetMathSpecialChar.h | 2 + src/mathed/InsetMathSplit.h | 3 ++ src/mathed/InsetMathSqrt.h | 3 ++ src/mathed/InsetMathStackrel.h | 3 ++ src/mathed/InsetMathString.h | 2 + src/mathed/InsetMathSubstack.h | 3 ++ src/mathed/InsetMathSymbol.h | 2 + src/mathed/InsetMathTabular.h | 2 + src/mathed/InsetMathUnderset.h | 3 ++ src/mathed/InsetMathUnknown.h | 2 + src/mathed/InsetMathXArrow.h | 2 + src/mathed/InsetMathXYArrow.h | 4 +- src/mathed/InsetMathXYMatrix.h | 3 ++ src/mathed/MacroTable.cpp | 2 +- src/mathed/MathMacro.h | 2 + src/mathed/MathMacroArgument.h | 2 +- src/mathed/MathMacroTemplate.cpp | 8 +-- src/mathed/MathMacroTemplate.h | 1 - 62 files changed, 298 insertions(+), 25 deletions(-) diff --git a/src/Text3.cpp b/src/Text3.cpp index 743538db40..a09573a644 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -2446,7 +2446,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd, case LFUN_MATH_MACRO: case LFUN_MATH_SUBSCRIPT: case LFUN_MATH_SUPERSCRIPT: - code = MATH_CODE; + code = MATH_HULL_CODE; break; case LFUN_INSET_MODIFY: diff --git a/src/insets/Inset.cpp b/src/insets/Inset.cpp index a9c13b76e2..ef5c17856f 100644 --- a/src/insets/Inset.cpp +++ b/src/insets/Inset.cpp @@ -101,12 +101,65 @@ static TranslatorMap const build_translator() InsetName("flex", FLEX_CODE), InsetName("space", SPACE_CODE), InsetName("vspace", VSPACE_CODE), - InsetName("mathmacroarg", MATHMACROARG_CODE), + InsetName("mathmacroarg", MATH_MACROARG_CODE), InsetName("listings", LISTINGS_CODE), InsetName("info", INFO_CODE), InsetName("collapsable", COLLAPSABLE_CODE), InsetName("newpage", NEWPAGE_CODE), - InsetName("tablecell", CELL_CODE) + InsetName("tablecell", CELL_CODE), + InsetName("mathamsarray", MATH_AMSARRAY_CODE), + InsetName("matharray", MATH_ARRAY_CODE), + InsetName("mathbig", MATH_BIG_CODE), + InsetName("mathboldsymbol", MATH_BOLDSYMBOL_CODE), + InsetName("mathbox", MATH_BOX_CODE), + InsetName("mathbrace", MATH_BRACE_CODE), + InsetName("mathcases", MATH_CASES_CODE), + InsetName("mathchar", MATH_CHAR_CODE), + InsetName("mathcolor", MATH_COLOR_CODE), + InsetName("mathcomment", MATH_COMMENT_CODE), + InsetName("mathdecoration", MATH_DECORATION_CODE), + InsetName("mathdelim", MATH_DELIM_CODE), + InsetName("mathdiff", MATH_DIFF_CODE), + InsetName("mathdots", MATH_DOTS_CODE), + InsetName("mathensuremath", MATH_ENSUREMATH_CODE), + InsetName("mathenv", MATH_ENV_CODE), + InsetName("mathexfunc", MATH_EXFUNC_CODE), + InsetName("mathexint", MATH_EXINT_CODE), + InsetName("mathfont", MATH_FONT_CODE), + InsetName("mathfontold", MATH_FONTOLD_CODE), + InsetName("mathfrac", MATH_FRAC_CODE), + InsetName("mathgrid", MATH_GRID_CODE), + InsetName("math", MATH_CODE), + InsetName("mathhull", MATH_HULL_CODE), + InsetName("mathkern", MATH_KERN_CODE), + InsetName("mathlefteqn", MATH_LEFTEQN_CODE), + InsetName("mathlim", MATH_LIM_CODE), + InsetName("mathmatrix", MATH_MATRIX_CODE), + InsetName("mathmbox", MATH_MBOX_CODE), + InsetName("mathnest", MATH_NEST_CODE), + InsetName("mathnumber", MATH_NUMBER_CODE), + InsetName("mathoverset", MATH_OVERSET_CODE), + InsetName("mathpar", MATH_PAR_CODE), + InsetName("mathphantom", MATH_PHANTOM_CODE), + InsetName("mathref", MATH_REF_CODE), + InsetName("mathroot", MATH_ROOT_CODE), + InsetName("mathscript", MATH_SCRIPT_CODE), + InsetName("mathsize", MATH_SIZE_CODE), + InsetName("mathspace", MATH_SPACE_CODE), + InsetName("mathspecialchar", MATH_SPECIALCHAR_CODE), + InsetName("mathsplit", MATH_SPLIT_CODE), + InsetName("mathsqrt", MATH_SQRT_CODE), + InsetName("mathstackrel", MATH_STACKREL_CODE), + InsetName("mathstring", MATH_STRING_CODE), + InsetName("mathsubstack", MATH_SUBSTACK_CODE), + InsetName("mathsymbol", MATH_SYMBOL_CODE), + InsetName("mathtabular", MATH_TABULAR_CODE), + InsetName("mathunderset", MATH_UNDERSET_CODE), + InsetName("mathunknown", MATH_UNKNOWN_CODE), + InsetName("mathxarrow", MATH_XARROW_CODE), + InsetName("mathxyarrow", MATH_XYARROW_CODE), + InsetName("mathxymatrix", MATH_XYMATRIX_CODE), + InsetName("mathmacro", MATH_MACRO_CODE), }; size_t const insetnames_size = @@ -132,7 +185,7 @@ Buffer & Inset::buffer() { if (!buffer_) { odocstringstream s; - lyxerr << "LyX Code: " << lyxCode() << " name: " << name() << std::endl; + lyxerr << "LyX Code: " << lyxCode() << " name: " << insetName(lyxCode()) << std::endl; s << "LyX Code: " << lyxCode() << " name: " << name(); LASSERT(false, /**/); throw ExceptionMessage(BufferException, @@ -226,7 +279,7 @@ string insetName(InsetCode c) void Inset::dispatch(Cursor & cur, FuncRequest & cmd) { - LASSERT(cur.buffer() == buffer_, return); + LASSERT(cur.buffer() == &buffer(), return); cur.updateFlags(Update::Force | Update::FitCursor); cur.dispatched(); doDispatch(cur, cmd); diff --git a/src/insets/InsetCode.h b/src/insets/InsetCode.h index 38c07559b6..841ae0d0c7 100644 --- a/src/insets/InsetCode.h +++ b/src/insets/InsetCode.h @@ -99,7 +99,7 @@ enum InsetCode { /// VSPACE_CODE, /// - MATHMACROARG_CODE, // 40 + MATH_MACROARG_CODE, // 40 /// NOMENCL_CODE, /// @@ -114,6 +114,110 @@ enum InsetCode { COLLAPSABLE_CODE, /// PHANTOM_CODE, + /// + MATH_AMSARRAY_CODE, + /// + MATH_ARRAY_CODE, + /// + MATH_BIG_CODE, // 50 + /// + MATH_BOLDSYMBOL_CODE, + /// + MATH_BOX_CODE, + /// + MATH_BRACE_CODE, + /// + MATH_CASES_CODE, + /// + MATH_CHAR_CODE, // 55 + /// + MATH_COLOR_CODE, + /// + MATH_COMMENT_CODE, + /// + MATH_DECORATION_CODE, + /// + MATH_DELIM_CODE, + /// + MATH_DIFF_CODE, // 60 + /// + MATH_DOTS_CODE, + /// + MATH_ENSUREMATH_CODE, + /// + MATH_ENV_CODE, + /// + MATH_EXFUNC_CODE, + /// + MATH_EXINT_CODE, // 65 + /// + MATH_FONT_CODE, + /// + MATH_FONTOLD_CODE, + /// + MATH_FRAC_CODE, + /// + MATH_GRID_CODE, + /// + MATH_HULL_CODE, // 70 + /// + MATH_KERN_CODE, + /// + MATH_LEFTEQN_CODE, + /// + MATH_LIM_CODE, + /// + MATH_MATRIX_CODE, + /// + MATH_MBOX_CODE, // 75 + /// + MATH_NEST_CODE, + /// + MATH_NUMBER_CODE, + /// + MATH_OVERSET_CODE, + /// + MATH_PAR_CODE, + /// + MATH_PHANTOM_CODE, // 80 + /// + MATH_REF_CODE, + /// + MATH_ROOT_CODE, + /// + MATH_SCRIPT_CODE, + /// + MATH_SIZE_CODE, + /// + MATH_SPACE_CODE, // 85 + /// + MATH_SPECIALCHAR_CODE, + /// + MATH_SPLIT_CODE, + /// + MATH_SQRT_CODE, + /// + MATH_STACKREL_CODE, + /// + MATH_STRING_CODE,// 90 + /// + MATH_SUBSTACK_CODE, + /// + MATH_SYMBOL_CODE, + /// + MATH_TABULAR_CODE, + /// + MATH_UNDERSET_CODE, + /// + MATH_UNKNOWN_CODE, // 95 + /// + MATH_XARROW_CODE, + /// + MATH_XYARROW_CODE, + /// + MATH_XYMATRIX_CODE, + /// + MATH_MACRO_CODE, }; } // namespace lyx diff --git a/src/mathed/InsetFormulaMacro.h b/src/mathed/InsetFormulaMacro.h index 47dc2664d8..7d08dc3d75 100644 --- a/src/mathed/InsetFormulaMacro.h +++ b/src/mathed/InsetFormulaMacro.h @@ -51,11 +51,13 @@ public: int docbook(odocstream &, OutputParams const &) const; /// - InsetCode lyxCode() const { return MATHMACRO_CODE; } + InsetCode lyxCode() const { return MATHMACRO_CODE_CODE; } /// docstring const & getInsetName() const { return name_; } /// bool editable() const { return true; } + /// + InsetCode lyxCode() const { return MATH_FORMULA_MACRO_CODE; } private: /// MathAtom & tmpl() const; diff --git a/src/mathed/InsetMath.h b/src/mathed/InsetMath.h index 8aef3591fa..4bbf4a00a5 100644 --- a/src/mathed/InsetMath.h +++ b/src/mathed/InsetMath.h @@ -205,6 +205,8 @@ public: /// superscript kerning virtual int kerning(BufferView const *) const { return 0; } + /// + InsetCode lyxCode() const { return MATH_CODE; } }; /// diff --git a/src/mathed/InsetMathAMSArray.h b/src/mathed/InsetMathAMSArray.h index 76c02f2452..9cf98a5cd7 100644 --- a/src/mathed/InsetMathAMSArray.h +++ b/src/mathed/InsetMathAMSArray.h @@ -44,6 +44,8 @@ public: void normalize(NormalStream &) const; /// void validate(LaTeXFeatures & features) const; + /// + InsetCode lyxCode() const { return MATH_AMSARRAY_CODE; } private: virtual Inset * clone() const; /// diff --git a/src/mathed/InsetMathArray.h b/src/mathed/InsetMathArray.h index 91c72b45ab..8768b3ed0f 100644 --- a/src/mathed/InsetMathArray.h +++ b/src/mathed/InsetMathArray.h @@ -49,6 +49,8 @@ public: void maple(MapleStream & os) const; /// void validate(LaTeXFeatures & features) const; + /// + InsetCode lyxCode() const { return MATH_ARRAY_CODE; } private: virtual Inset * clone() const; /// diff --git a/src/mathed/InsetMathBig.h b/src/mathed/InsetMathBig.h index cb65d2f8e4..58880dc867 100644 --- a/src/mathed/InsetMathBig.h +++ b/src/mathed/InsetMathBig.h @@ -38,7 +38,8 @@ public: void infoize2(odocstream & os) const; /// static bool isBigInsetDelim(docstring const &); - + /// + InsetCode lyxCode() const { return MATH_BIG_CODE; } private: virtual Inset * clone() const; /// diff --git a/src/mathed/InsetMathBoldSymbol.h b/src/mathed/InsetMathBoldSymbol.h index d91de3816a..67b0dfa4b7 100644 --- a/src/mathed/InsetMathBoldSymbol.h +++ b/src/mathed/InsetMathBoldSymbol.h @@ -45,6 +45,8 @@ public: /// void infoize(odocstream & os) const; /// + InsetCode lyxCode() const { return MATH_BOLDSYMBOL_CODE; } + /// Kind kind_; private: virtual Inset * clone() const; diff --git a/src/mathed/InsetMathBox.h b/src/mathed/InsetMathBox.h index d5c269cfec..5839439ed7 100644 --- a/src/mathed/InsetMathBox.h +++ b/src/mathed/InsetMathBox.h @@ -38,6 +38,8 @@ public: void infoize(odocstream & os) const; /// void validate(LaTeXFeatures & features) const; + /// + InsetCode lyxCode() const { return MATH_BOX_CODE; } private: Inset * clone() const { return new InsetMathBox(*this); } diff --git a/src/mathed/InsetMathBrace.h b/src/mathed/InsetMathBrace.h index f93508cbfe..4893db7c69 100644 --- a/src/mathed/InsetMathBrace.h +++ b/src/mathed/InsetMathBrace.h @@ -49,6 +49,8 @@ public: void mathmlize(MathStream &) const; /// void infoize(odocstream & os) const; + /// + InsetCode lyxCode() const { return MATH_BRACE_CODE; } private: virtual Inset * clone() const; }; diff --git a/src/mathed/InsetMathCases.h b/src/mathed/InsetMathCases.h index f518d06598..9ceac475ea 100644 --- a/src/mathed/InsetMathCases.h +++ b/src/mathed/InsetMathCases.h @@ -46,6 +46,8 @@ public: void write(WriteStream & os) const; /// void validate(LaTeXFeatures & features) const; + /// + InsetCode lyxCode() const { return MATH_CASES_CODE; } private: virtual Inset * clone() const; }; diff --git a/src/mathed/InsetMathChar.h b/src/mathed/InsetMathChar.h index ccfe0b4978..6dba328c4e 100644 --- a/src/mathed/InsetMathChar.h +++ b/src/mathed/InsetMathChar.h @@ -48,6 +48,8 @@ public: char_type getChar() const { return char_; } /// bool isRelOp() const; + /// + InsetCode lyxCode() const { return MATH_CHAR_CODE; } private: virtual Inset * clone() const; diff --git a/src/mathed/InsetMathColor.h b/src/mathed/InsetMathColor.h index fad0e658d1..19f1636b17 100644 --- a/src/mathed/InsetMathColor.h +++ b/src/mathed/InsetMathColor.h @@ -42,6 +42,8 @@ public: void normalize(NormalStream & ns) const; /// void infoize(odocstream & os) const; + /// + InsetCode lyxCode() const { return MATH_COLOR_CODE; } private: virtual Inset * clone() const; /// width of '[' in current font diff --git a/src/mathed/InsetMathComment.h b/src/mathed/InsetMathComment.h index 2a5035d7be..8699cedbba 100644 --- a/src/mathed/InsetMathComment.h +++ b/src/mathed/InsetMathComment.h @@ -47,6 +47,8 @@ public: void mathmlize(MathStream &) const; /// void infoize(odocstream & os) const; + /// + InsetCode lyxCode() const { return MATH_COMMENT_CODE; } private: virtual Inset * clone() const; }; diff --git a/src/mathed/InsetMathDecoration.h b/src/mathed/InsetMathDecoration.h index 1e09860d8b..3fa1be7075 100644 --- a/src/mathed/InsetMathDecoration.h +++ b/src/mathed/InsetMathDecoration.h @@ -39,6 +39,8 @@ public: bool isScriptable() const; /// void validate(LaTeXFeatures & features) const; + /// + InsetCode lyxCode() const { return MATH_DECORATION_CODE; } private: virtual Inset * clone() const; diff --git a/src/mathed/InsetMathDelim.h b/src/mathed/InsetMathDelim.h index 3dbb39da00..de7f11442b 100644 --- a/src/mathed/InsetMathDelim.h +++ b/src/mathed/InsetMathDelim.h @@ -59,6 +59,8 @@ public: /// void octave(OctaveStream &) const; /// + InsetCode lyxCode() const { return MATH_DELIM_CODE; } + /// docstring left_; /// docstring right_; diff --git a/src/mathed/InsetMathDiff.h b/src/mathed/InsetMathDiff.h index 8710d43fc1..557f16fed2 100644 --- a/src/mathed/InsetMathDiff.h +++ b/src/mathed/InsetMathDiff.h @@ -44,6 +44,8 @@ public: void maxima(MaximaStream &) const; /// void write(WriteStream & os) const; + /// + InsetCode lyxCode() const { return MATH_DIFF_CODE; } private: virtual Inset * clone() const; }; diff --git a/src/mathed/InsetMathDots.h b/src/mathed/InsetMathDots.h index f4f52716f6..ee3df2aeba 100644 --- a/src/mathed/InsetMathDots.h +++ b/src/mathed/InsetMathDots.h @@ -32,6 +32,8 @@ public: docstring name() const; /// request "external features" void validate(LaTeXFeatures & features) const; + /// + InsetCode lyxCode() const { return MATH_DOTS_CODE; } protected: /// cache for the thing's height mutable int dh_; diff --git a/src/mathed/InsetMathEnsureMath.h b/src/mathed/InsetMathEnsureMath.h index 0a6e9fe528..d6e9a242b5 100644 --- a/src/mathed/InsetMathEnsureMath.h +++ b/src/mathed/InsetMathEnsureMath.h @@ -37,6 +37,8 @@ public: void write(WriteStream & os) const; /// void infoize(odocstream & os) const; + /// + InsetCode lyxCode() const { return MATH_ENSUREMATH_CODE; } private: virtual Inset * clone() const; }; diff --git a/src/mathed/InsetMathEnv.h b/src/mathed/InsetMathEnv.h index 985f57a322..035aa68e5c 100644 --- a/src/mathed/InsetMathEnv.h +++ b/src/mathed/InsetMathEnv.h @@ -35,6 +35,8 @@ public: void metrics(MetricsInfo & mi, Dimension & dim) const; /// void infoize(odocstream & os) const; + /// + InsetCode lyxCode() const { return MATH_ENV_CODE; } private: virtual Inset * clone() const; diff --git a/src/mathed/InsetMathExFunc.h b/src/mathed/InsetMathExFunc.h index 9f91649f3d..7a5b25310f 100644 --- a/src/mathed/InsetMathExFunc.h +++ b/src/mathed/InsetMathExFunc.h @@ -46,6 +46,8 @@ public: void mathmlize(MathStream &) const; /// void octave(OctaveStream &) const; + /// + InsetCode lyxCode() const { return MATH_EXFUNC_CODE; } private: virtual Inset * clone() const; diff --git a/src/mathed/InsetMathExInt.h b/src/mathed/InsetMathExInt.h index d83d600bde..00f7ed9f57 100644 --- a/src/mathed/InsetMathExInt.h +++ b/src/mathed/InsetMathExInt.h @@ -45,6 +45,8 @@ public: void mathmlize(MathStream &) const; /// void write(WriteStream & os) const; + /// + InsetCode lyxCode() const { return MATH_EXINT_CODE; } private: virtual Inset * clone() const; /// diff --git a/src/mathed/InsetMathFont.h b/src/mathed/InsetMathFont.h index fecf7e7d43..e002ad1a11 100644 --- a/src/mathed/InsetMathFont.h +++ b/src/mathed/InsetMathFont.h @@ -49,6 +49,8 @@ public: void infoize(odocstream & os) const; /// int kerning(BufferView const * bv) const { return cell(0).kerning(bv); } + /// + InsetCode lyxCode() const { return MATH_FONT_CODE; } private: virtual Inset * clone() const; diff --git a/src/mathed/InsetMathFontOld.h b/src/mathed/InsetMathFontOld.h index e93f3061be..61d55b0e75 100644 --- a/src/mathed/InsetMathFontOld.h +++ b/src/mathed/InsetMathFontOld.h @@ -45,6 +45,8 @@ public: void infoize(odocstream & os) const; /// int kerning(BufferView const * bv) const { return cell(0).kerning(bv); } + /// + InsetCode lyxCode() const { return MATH_FONTOLD_CODE; } private: virtual Inset * clone() const; diff --git a/src/mathed/InsetMathFrac.h b/src/mathed/InsetMathFrac.h index b2c55666b2..3d9b3854e2 100644 --- a/src/mathed/InsetMathFrac.h +++ b/src/mathed/InsetMathFrac.h @@ -124,6 +124,8 @@ public: void mathmlize(MathStream &) const; /// void validate(LaTeXFeatures & features) const; + /// + InsetCode lyxCode() const { return MATH_FRAC_CODE; } private: Inset * clone() const; /// diff --git a/src/mathed/InsetMathGrid.h b/src/mathed/InsetMathGrid.h index f085f99f1a..fb6edfb989 100644 --- a/src/mathed/InsetMathGrid.h +++ b/src/mathed/InsetMathGrid.h @@ -248,6 +248,9 @@ protected: std::vector colinfo_; /// cell info std::vector cellinfo_; + /// + InsetCode lyxCode() const { return MATH_GRID_CODE; } + private: /// char v_align_; // add approp. type diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp index c00a6819bb..f0eb3244d6 100644 --- a/src/mathed/InsetMathHull.cpp +++ b/src/mathed/InsetMathHull.cpp @@ -1590,12 +1590,6 @@ void InsetMathHull::revealCodes(Cursor & cur) const } -InsetCode InsetMathHull::lyxCode() const -{ - return MATH_CODE; -} - - ///////////////////////////////////////////////////////////////////// diff --git a/src/mathed/InsetMathHull.h b/src/mathed/InsetMathHull.h index 14c1f0a396..12b3acd7d7 100644 --- a/src/mathed/InsetMathHull.h +++ b/src/mathed/InsetMathHull.h @@ -142,6 +142,8 @@ public: /// virtual docstring contextMenu(BufferView const &, int, int) const; + /// + InsetCode lyxCode() const { return MATH_HULL_CODE; } protected: InsetMathHull(InsetMathHull const &); @@ -218,8 +220,6 @@ public: Inset * editXY(Cursor & cur, int x, int y); /// DisplayType display() const; - /// - InsetCode lyxCode() const; protected: /// diff --git a/src/mathed/InsetMathKern.h b/src/mathed/InsetMathKern.h index be0e82166e..902f19e1f3 100644 --- a/src/mathed/InsetMathKern.h +++ b/src/mathed/InsetMathKern.h @@ -38,6 +38,9 @@ public: void write(WriteStream & os) const; /// void normalize(NormalStream & ns) const; + /// + InsetCode lyxCode() const { return MATH_KERN_CODE; } + private: virtual Inset * clone() const; /// width in em diff --git a/src/mathed/InsetMathLefteqn.h b/src/mathed/InsetMathLefteqn.h index 2a3825f2a4..6742e7327e 100644 --- a/src/mathed/InsetMathLefteqn.h +++ b/src/mathed/InsetMathLefteqn.h @@ -32,6 +32,9 @@ public: void draw(PainterInfo & pi, int x, int y) const; /// void infoize(odocstream & os) const; + /// + InsetCode lyxCode() const { return MATH_LEFTEQN_CODE; } + private: virtual Inset * clone() const; }; diff --git a/src/mathed/InsetMathLim.h b/src/mathed/InsetMathLim.h index 9ff2cbe025..f10055b436 100644 --- a/src/mathed/InsetMathLim.h +++ b/src/mathed/InsetMathLim.h @@ -42,6 +42,9 @@ public: void mathmlize(MathStream &) const; /// void write(WriteStream & os) const; + /// + InsetCode lyxCode() const { return MATH_LIM_CODE; } + private: virtual Inset * clone() const; }; diff --git a/src/mathed/InsetMathMBox.h b/src/mathed/InsetMathMBox.h index ace477a2f9..3116e7d585 100644 --- a/src/mathed/InsetMathMBox.h +++ b/src/mathed/InsetMathMBox.h @@ -51,6 +51,9 @@ public: /// void cursorPos(BufferView const & bv, CursorSlice const & sl, bool boundary, int & x, int & y) const; + /// + InsetCode lyxCode() const { return MATH_MBOX_CODE; } + protected: virtual void doDispatch(Cursor & cur, FuncRequest & cmd); diff --git a/src/mathed/InsetMathMatrix.h b/src/mathed/InsetMathMatrix.h index b44008bac4..11fa18349c 100644 --- a/src/mathed/InsetMathMatrix.h +++ b/src/mathed/InsetMathMatrix.h @@ -43,6 +43,9 @@ public: void mathmlize(MathStream &) const; /// void octave(OctaveStream &) const; + /// + InsetCode lyxCode() const { return MATH_MATRIX_CODE; } + private: virtual Inset * clone() const; }; diff --git a/src/mathed/InsetMathNest.h b/src/mathed/InsetMathNest.h index 6d73fbca37..7b320e61c3 100644 --- a/src/mathed/InsetMathNest.h +++ b/src/mathed/InsetMathNest.h @@ -127,6 +127,8 @@ public: bool insertCompletion(Cursor & cur, docstring const & s, bool finished); /// void completionPosAndDim(Cursor const &, int & x, int & y, Dimension & dim) const; + /// + InsetCode lyxCode() const { return MATH_NEST_CODE; } protected: /// diff --git a/src/mathed/InsetMathNumber.h b/src/mathed/InsetMathNumber.h index d9ca5a263c..a6ca9dae29 100644 --- a/src/mathed/InsetMathNumber.h +++ b/src/mathed/InsetMathNumber.h @@ -46,6 +46,8 @@ public: void mathmlize(MathStream &) const; /// void write(WriteStream & os) const; + /// + InsetCode lyxCode() const { return MATH_NUMBER_CODE; } private: virtual Inset * clone() const; diff --git a/src/mathed/InsetMathOverset.h b/src/mathed/InsetMathOverset.h index e737d623e9..0738693550 100644 --- a/src/mathed/InsetMathOverset.h +++ b/src/mathed/InsetMathOverset.h @@ -35,6 +35,9 @@ public: void normalize(NormalStream &) const; /// void validate(LaTeXFeatures & features) const; + /// + InsetCode lyxCode() const { return MATH_OVERSET_CODE; } + private: virtual Inset * clone() const; }; diff --git a/src/mathed/InsetMathPar.h b/src/mathed/InsetMathPar.h index 6edc6bf8b8..05d2dabdb0 100644 --- a/src/mathed/InsetMathPar.h +++ b/src/mathed/InsetMathPar.h @@ -34,6 +34,9 @@ public: void infoize(odocstream & os) const; /// void write(WriteStream & os) const; + /// + InsetCode lyxCode() const { return MATH_PAR_CODE; } + private: /// virtual Inset * clone() const; diff --git a/src/mathed/InsetMathPhantom.h b/src/mathed/InsetMathPhantom.h index 6bfdd08c5e..9d21bbdeff 100644 --- a/src/mathed/InsetMathPhantom.h +++ b/src/mathed/InsetMathPhantom.h @@ -37,6 +37,9 @@ public: void normalize(NormalStream & ns) const; /// void infoize(odocstream & os) const; + /// + InsetCode lyxCode() const { return MATH_PHANTOM_CODE; } + private: /// virtual Inset * clone() const; diff --git a/src/mathed/InsetMathRef.h b/src/mathed/InsetMathRef.h index da324522b9..b26678ce66 100644 --- a/src/mathed/InsetMathRef.h +++ b/src/mathed/InsetMathRef.h @@ -55,6 +55,9 @@ public: static int getType(docstring const & name); /// static docstring const & getName(int type); + /// + InsetCode lyxCode() const { return MATH_REF_CODE; } + protected: /// virtual void doDispatch(Cursor & cur, FuncRequest & cmd); diff --git a/src/mathed/InsetMathRoot.h b/src/mathed/InsetMathRoot.h index aaa62834f3..1fd6e08d0d 100644 --- a/src/mathed/InsetMathRoot.h +++ b/src/mathed/InsetMathRoot.h @@ -43,6 +43,9 @@ public: void mathematica(MathematicaStream &) const; /// void octave(OctaveStream &) const; + /// + InsetCode lyxCode() const { return MATH_ROOT_CODE; } + private: virtual Inset * clone() const; }; diff --git a/src/mathed/InsetMathScript.h b/src/mathed/InsetMathScript.h index e9be1fda6a..7917f0cd8c 100644 --- a/src/mathed/InsetMathScript.h +++ b/src/mathed/InsetMathScript.h @@ -102,6 +102,9 @@ public: void infoize(odocstream & os) const; /// say whether we have displayed limits void infoize2(odocstream & os) const; + /// + InsetCode lyxCode() const { return MATH_SCRIPT_CODE; } + protected: virtual void doDispatch(Cursor & cur, FuncRequest & cmd); private: diff --git a/src/mathed/InsetMathSize.h b/src/mathed/InsetMathSize.h index 9f7dc54f0a..855b318559 100644 --- a/src/mathed/InsetMathSize.h +++ b/src/mathed/InsetMathSize.h @@ -39,6 +39,9 @@ public: void normalize(NormalStream &) const; /// void infoize(odocstream & os) const; + /// + InsetCode lyxCode() const { return MATH_SIZE_CODE; } + private: virtual Inset * clone() const; /// diff --git a/src/mathed/InsetMathSpace.h b/src/mathed/InsetMathSpace.h index f45dee5d96..5770439660 100644 --- a/src/mathed/InsetMathSpace.h +++ b/src/mathed/InsetMathSpace.h @@ -61,6 +61,9 @@ public: docstring contextMenu(BufferView const &, int, int) const; /// bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const; + /// + InsetCode lyxCode() const { return MATH_SPACE_CODE; } + protected: /// virtual void doDispatch(Cursor & cur, FuncRequest & cmd); diff --git a/src/mathed/InsetMathSpecialChar.h b/src/mathed/InsetMathSpecialChar.h index 20bc9d9774..c672b504f6 100644 --- a/src/mathed/InsetMathSpecialChar.h +++ b/src/mathed/InsetMathSpecialChar.h @@ -52,6 +52,8 @@ public: docstring name() const { return name_; } /// char_type getChar() const { return char_; } + /// + InsetCode lyxCode() const { return MATH_SPECIALCHAR_CODE; } private: virtual Inset * clone() const; diff --git a/src/mathed/InsetMathSplit.h b/src/mathed/InsetMathSplit.h index 4f92d59ae7..9a8d4b93d4 100644 --- a/src/mathed/InsetMathSplit.h +++ b/src/mathed/InsetMathSplit.h @@ -37,6 +37,9 @@ public: int defaultColSpace(col_type) { return 0; } /// char defaultColAlign(col_type); + /// + InsetCode lyxCode() const { return MATH_SPLIT_CODE; } + private: /// virtual Inset * clone() const; diff --git a/src/mathed/InsetMathSqrt.h b/src/mathed/InsetMathSqrt.h index 7fd6452e6a..aaa1ac03c0 100644 --- a/src/mathed/InsetMathSqrt.h +++ b/src/mathed/InsetMathSqrt.h @@ -45,6 +45,9 @@ public: void octave(OctaveStream &) const; /// void mathmlize(MathStream &) const; + /// + InsetCode lyxCode() const { return MATH_SQRT_CODE; } + private: virtual Inset * clone() const; }; diff --git a/src/mathed/InsetMathStackrel.h b/src/mathed/InsetMathStackrel.h index f940424168..b27f1cd8b7 100644 --- a/src/mathed/InsetMathStackrel.h +++ b/src/mathed/InsetMathStackrel.h @@ -36,6 +36,9 @@ public: void write(WriteStream & os) const; /// void normalize(NormalStream &) const; + /// + InsetCode lyxCode() const { return MATH_STACKREL_CODE; } + private: virtual Inset * clone() const; }; diff --git a/src/mathed/InsetMathString.h b/src/mathed/InsetMathString.h index 9544503041..9f94a7457f 100644 --- a/src/mathed/InsetMathString.h +++ b/src/mathed/InsetMathString.h @@ -50,6 +50,8 @@ public: void mathmlize(MathStream &) const; /// void write(WriteStream & os) const; + /// + InsetCode lyxCode() const { return MATH_STRING_CODE; } private: virtual Inset * clone() const; diff --git a/src/mathed/InsetMathSubstack.h b/src/mathed/InsetMathSubstack.h index 045366bf6c..c0576aaa6b 100644 --- a/src/mathed/InsetMathSubstack.h +++ b/src/mathed/InsetMathSubstack.h @@ -44,6 +44,9 @@ public: void maple(MapleStream &) const; /// void validate(LaTeXFeatures & features) const; + /// + InsetCode lyxCode() const { return MATH_SUBSTACK_CODE; } + private: virtual Inset * clone() const; }; diff --git a/src/mathed/InsetMathSymbol.h b/src/mathed/InsetMathSymbol.h index 25c1a8d9f0..5382f72e85 100644 --- a/src/mathed/InsetMathSymbol.h +++ b/src/mathed/InsetMathSymbol.h @@ -68,6 +68,8 @@ public: void write(WriteStream & os) const; /// void infoize2(odocstream & os) const; + /// + InsetCode lyxCode() const { return MATH_SYMBOL_CODE; } private: virtual Inset * clone() const; diff --git a/src/mathed/InsetMathTabular.h b/src/mathed/InsetMathTabular.h index db96bc8939..0fb6c27961 100644 --- a/src/mathed/InsetMathTabular.h +++ b/src/mathed/InsetMathTabular.h @@ -45,6 +45,8 @@ public: void normalize(NormalStream &) const; /// void maple(MapleStream &) const; + /// + InsetCode lyxCode() const { return MATH_TABULAR_CODE; } private: Inset * clone() const; diff --git a/src/mathed/InsetMathUnderset.h b/src/mathed/InsetMathUnderset.h index 51311e6c6f..321f26fef0 100644 --- a/src/mathed/InsetMathUnderset.h +++ b/src/mathed/InsetMathUnderset.h @@ -37,6 +37,9 @@ public: void normalize(NormalStream & ns) const; /// void validate(LaTeXFeatures & features) const; + /// + InsetCode lyxCode() const { return MATH_UNDERSET_CODE; } + private: virtual Inset * clone() const; }; diff --git a/src/mathed/InsetMathUnknown.h b/src/mathed/InsetMathUnknown.h index c51bc15980..b43bcfd672 100644 --- a/src/mathed/InsetMathUnknown.h +++ b/src/mathed/InsetMathUnknown.h @@ -59,6 +59,8 @@ public: bool final() const; /// int kerning(BufferView const *) const { return kerning_; } + /// + InsetCode lyxCode() const { return MATH_UNKNOWN_CODE; } private: /// diff --git a/src/mathed/InsetMathXArrow.h b/src/mathed/InsetMathXArrow.h index bf668eaab7..d21dd42222 100644 --- a/src/mathed/InsetMathXArrow.h +++ b/src/mathed/InsetMathXArrow.h @@ -33,6 +33,8 @@ public: void normalize(NormalStream & os) const; /// void validate(LaTeXFeatures & features) const; + /// + InsetCode lyxCode() const { return MATH_XARROW_CODE; } private: virtual Inset * clone() const; diff --git a/src/mathed/InsetMathXYArrow.h b/src/mathed/InsetMathXYArrow.h index 50c7a043c8..75734bb856 100644 --- a/src/mathed/InsetMathXYArrow.h +++ b/src/mathed/InsetMathXYArrow.h @@ -42,14 +42,14 @@ public: void write(WriteStream & os) const; /// void normalize(NormalStream &) const; - -public: /// InsetMathXYMatrix const * targetMatrix() const; /// MathData const & targetCell() const; /// MathData const & sourceCell() const; + /// + InsetCode lyxCode() const { return MATH_XYARROW_CODE; } /// bool up_; diff --git a/src/mathed/InsetMathXYMatrix.h b/src/mathed/InsetMathXYMatrix.h index 4453d00d65..8e11a0b489 100644 --- a/src/mathed/InsetMathXYMatrix.h +++ b/src/mathed/InsetMathXYMatrix.h @@ -44,6 +44,9 @@ public: void maple(MapleStream &) const; /// void validate(LaTeXFeatures & features) const; + /// + InsetCode lyxCode() const { return MATH_XYMATRIX_CODE; } + private: /// virtual Inset * clone() const; diff --git a/src/mathed/MacroTable.cpp b/src/mathed/MacroTable.cpp index b2e50d1191..d686f421c4 100644 --- a/src/mathed/MacroTable.cpp +++ b/src/mathed/MacroTable.cpp @@ -85,7 +85,7 @@ void MacroData::expand(vector const & args, MathData & to) const for (DocIterator it = doc_iterator_begin(buffer, &inset); it; it.forwardChar()) { if (!it.nextInset()) continue; - if (it.nextInset()->lyxCode() != MATHMACROARG_CODE) + if (it.nextInset()->lyxCode() != MATH_MACROARG_CODE) continue; //it.cell().erase(it.pos()); //it.cell().insert(it.pos(), it.nextInset()->asInsetMath() diff --git a/src/mathed/MathMacro.h b/src/mathed/MathMacro.h index 5edac1df78..801c19dfb8 100644 --- a/src/mathed/MathMacro.h +++ b/src/mathed/MathMacro.h @@ -120,6 +120,8 @@ public: } /// Return the maximal number of arguments the macro is greedy for. size_t appetite() const { return appetite_; } + /// + InsetCode lyxCode() const { return MATH_MACRO_CODE; } protected: friend class MathData; diff --git a/src/mathed/MathMacroArgument.h b/src/mathed/MathMacroArgument.h index c3d364b727..4a52b1a1d2 100644 --- a/src/mathed/MathMacroArgument.h +++ b/src/mathed/MathMacroArgument.h @@ -35,7 +35,7 @@ public: /// void setNumber(int n); /// - InsetCode lyxCode() const { return MATHMACROARG_CODE; } + InsetCode lyxCode() const { return MATH_MACROARG_CODE; } /// void normalize(NormalStream &) const; diff --git a/src/mathed/MathMacroTemplate.cpp b/src/mathed/MathMacroTemplate.cpp index 6765f01a99..3014cc4ee7 100644 --- a/src/mathed/MathMacroTemplate.cpp +++ b/src/mathed/MathMacroTemplate.cpp @@ -635,7 +635,7 @@ void MathMacroTemplate::removeArguments(Cursor & cur, int from, int to) for (DocIterator it = doc_iterator_begin(&buffer(), this); it; it.forwardChar()) { if (!it.nextInset()) continue; - if (it.nextInset()->lyxCode() != MATHMACROARG_CODE) + if (it.nextInset()->lyxCode() != MATH_MACROARG_CODE) continue; MathMacroArgument * arg = static_cast(it.nextInset()); int n = arg->number() - 1; @@ -657,7 +657,7 @@ void MathMacroTemplate::shiftArguments(size_t from, int by) for (DocIterator it = doc_iterator_begin(&buffer(), this); it; it.forwardChar()) { if (!it.nextInset()) continue; - if (it.nextInset()->lyxCode() != MATHMACROARG_CODE) + if (it.nextInset()->lyxCode() != MATH_MACROARG_CODE) continue; MathMacroArgument * arg = static_cast(it.nextInset()); if (arg->number() >= int(from) + 1) @@ -676,7 +676,7 @@ int MathMacroTemplate::maxArgumentInDefinition() const for (; it; it.forwardChar()) { if (!it.nextInset()) continue; - if (it.nextInset()->lyxCode() != MATHMACROARG_CODE) + if (it.nextInset()->lyxCode() != MATH_MACROARG_CODE) continue; MathMacroArgument * arg = static_cast(it.nextInset()); maxArg = std::max(int(arg->number()), maxArg); @@ -696,7 +696,7 @@ void MathMacroTemplate::insertMissingArguments(int maxArg) for (; it && it[0].idx() == idx; it.forwardChar()) { if (!it.nextInset()) continue; - if (it.nextInset()->lyxCode() != MATHMACROARG_CODE) + if (it.nextInset()->lyxCode() != MATH_MACROARG_CODE) continue; MathMacroArgument * arg = static_cast(it.nextInset()); found[arg->number() - 1] = true; diff --git a/src/mathed/MathMacroTemplate.h b/src/mathed/MathMacroTemplate.h index dea1acf28e..0898df46fe 100644 --- a/src/mathed/MathMacroTemplate.h +++ b/src/mathed/MathMacroTemplate.h @@ -100,7 +100,6 @@ public: void infoize(odocstream & os) const; /// docstring contextMenu(BufferView const &, int, int) const; - protected: /// virtual void doDispatch(Cursor & cur, FuncRequest & cmd); -- 2.11.4.GIT