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
This commit is contained in:
Richard Heck 2009-07-16 19:00:24 +00:00
parent 466b09b006
commit 0facb603fe
62 changed files with 298 additions and 25 deletions

View File

@ -2446,7 +2446,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
case LFUN_MATH_MACRO: case LFUN_MATH_MACRO:
case LFUN_MATH_SUBSCRIPT: case LFUN_MATH_SUBSCRIPT:
case LFUN_MATH_SUPERSCRIPT: case LFUN_MATH_SUPERSCRIPT:
code = MATH_CODE; code = MATH_HULL_CODE;
break; break;
case LFUN_INSET_MODIFY: case LFUN_INSET_MODIFY:

View File

@ -101,12 +101,65 @@ static TranslatorMap const build_translator()
InsetName("flex", FLEX_CODE), InsetName("flex", FLEX_CODE),
InsetName("space", SPACE_CODE), InsetName("space", SPACE_CODE),
InsetName("vspace", VSPACE_CODE), InsetName("vspace", VSPACE_CODE),
InsetName("mathmacroarg", MATHMACROARG_CODE), InsetName("mathmacroarg", MATH_MACROARG_CODE),
InsetName("listings", LISTINGS_CODE), InsetName("listings", LISTINGS_CODE),
InsetName("info", INFO_CODE), InsetName("info", INFO_CODE),
InsetName("collapsable", COLLAPSABLE_CODE), InsetName("collapsable", COLLAPSABLE_CODE),
InsetName("newpage", NEWPAGE_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 = size_t const insetnames_size =
@ -132,7 +185,7 @@ Buffer & Inset::buffer()
{ {
if (!buffer_) { if (!buffer_) {
odocstringstream s; 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(); s << "LyX Code: " << lyxCode() << " name: " << name();
LASSERT(false, /**/); LASSERT(false, /**/);
throw ExceptionMessage(BufferException, throw ExceptionMessage(BufferException,
@ -226,7 +279,7 @@ string insetName(InsetCode c)
void Inset::dispatch(Cursor & cur, FuncRequest & cmd) void Inset::dispatch(Cursor & cur, FuncRequest & cmd)
{ {
LASSERT(cur.buffer() == buffer_, return); LASSERT(cur.buffer() == &buffer(), return);
cur.updateFlags(Update::Force | Update::FitCursor); cur.updateFlags(Update::Force | Update::FitCursor);
cur.dispatched(); cur.dispatched();
doDispatch(cur, cmd); doDispatch(cur, cmd);

View File

@ -99,7 +99,7 @@ enum InsetCode {
/// ///
VSPACE_CODE, VSPACE_CODE,
/// ///
MATHMACROARG_CODE, // 40 MATH_MACROARG_CODE, // 40
/// ///
NOMENCL_CODE, NOMENCL_CODE,
/// ///
@ -114,6 +114,110 @@ enum InsetCode {
COLLAPSABLE_CODE, COLLAPSABLE_CODE,
/// ///
PHANTOM_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 } // namespace lyx

View File

@ -51,11 +51,13 @@ public:
int docbook(odocstream &, OutputParams const &) const; 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_; } docstring const & getInsetName() const { return name_; }
/// ///
bool editable() const { return true; } bool editable() const { return true; }
///
InsetCode lyxCode() const { return MATH_FORMULA_MACRO_CODE; }
private: private:
/// ///
MathAtom & tmpl() const; MathAtom & tmpl() const;

View File

@ -205,6 +205,8 @@ public:
/// superscript kerning /// superscript kerning
virtual int kerning(BufferView const *) const { return 0; } virtual int kerning(BufferView const *) const { return 0; }
///
InsetCode lyxCode() const { return MATH_CODE; }
}; };
/// ///

View File

@ -44,6 +44,8 @@ public:
void normalize(NormalStream &) const; void normalize(NormalStream &) const;
/// ///
void validate(LaTeXFeatures & features) const; void validate(LaTeXFeatures & features) const;
///
InsetCode lyxCode() const { return MATH_AMSARRAY_CODE; }
private: private:
virtual Inset * clone() const; virtual Inset * clone() const;
/// ///

View File

@ -49,6 +49,8 @@ public:
void maple(MapleStream & os) const; void maple(MapleStream & os) const;
/// ///
void validate(LaTeXFeatures & features) const; void validate(LaTeXFeatures & features) const;
///
InsetCode lyxCode() const { return MATH_ARRAY_CODE; }
private: private:
virtual Inset * clone() const; virtual Inset * clone() const;
/// ///

View File

@ -38,7 +38,8 @@ public:
void infoize2(odocstream & os) const; void infoize2(odocstream & os) const;
/// ///
static bool isBigInsetDelim(docstring const &); static bool isBigInsetDelim(docstring const &);
///
InsetCode lyxCode() const { return MATH_BIG_CODE; }
private: private:
virtual Inset * clone() const; virtual Inset * clone() const;
/// ///

View File

@ -45,6 +45,8 @@ public:
/// ///
void infoize(odocstream & os) const; void infoize(odocstream & os) const;
/// ///
InsetCode lyxCode() const { return MATH_BOLDSYMBOL_CODE; }
///
Kind kind_; Kind kind_;
private: private:
virtual Inset * clone() const; virtual Inset * clone() const;

View File

@ -38,6 +38,8 @@ public:
void infoize(odocstream & os) const; void infoize(odocstream & os) const;
/// ///
void validate(LaTeXFeatures & features) const; void validate(LaTeXFeatures & features) const;
///
InsetCode lyxCode() const { return MATH_BOX_CODE; }
private: private:
Inset * clone() const { return new InsetMathBox(*this); } Inset * clone() const { return new InsetMathBox(*this); }

View File

@ -49,6 +49,8 @@ public:
void mathmlize(MathStream &) const; void mathmlize(MathStream &) const;
/// ///
void infoize(odocstream & os) const; void infoize(odocstream & os) const;
///
InsetCode lyxCode() const { return MATH_BRACE_CODE; }
private: private:
virtual Inset * clone() const; virtual Inset * clone() const;
}; };

View File

@ -46,6 +46,8 @@ public:
void write(WriteStream & os) const; void write(WriteStream & os) const;
/// ///
void validate(LaTeXFeatures & features) const; void validate(LaTeXFeatures & features) const;
///
InsetCode lyxCode() const { return MATH_CASES_CODE; }
private: private:
virtual Inset * clone() const; virtual Inset * clone() const;
}; };

View File

@ -48,6 +48,8 @@ public:
char_type getChar() const { return char_; } char_type getChar() const { return char_; }
/// ///
bool isRelOp() const; bool isRelOp() const;
///
InsetCode lyxCode() const { return MATH_CHAR_CODE; }
private: private:
virtual Inset * clone() const; virtual Inset * clone() const;

View File

@ -42,6 +42,8 @@ public:
void normalize(NormalStream & ns) const; void normalize(NormalStream & ns) const;
/// ///
void infoize(odocstream & os) const; void infoize(odocstream & os) const;
///
InsetCode lyxCode() const { return MATH_COLOR_CODE; }
private: private:
virtual Inset * clone() const; virtual Inset * clone() const;
/// width of '[' in current font /// width of '[' in current font

View File

@ -47,6 +47,8 @@ public:
void mathmlize(MathStream &) const; void mathmlize(MathStream &) const;
/// ///
void infoize(odocstream & os) const; void infoize(odocstream & os) const;
///
InsetCode lyxCode() const { return MATH_COMMENT_CODE; }
private: private:
virtual Inset * clone() const; virtual Inset * clone() const;
}; };

View File

@ -39,6 +39,8 @@ public:
bool isScriptable() const; bool isScriptable() const;
/// ///
void validate(LaTeXFeatures & features) const; void validate(LaTeXFeatures & features) const;
///
InsetCode lyxCode() const { return MATH_DECORATION_CODE; }
private: private:
virtual Inset * clone() const; virtual Inset * clone() const;

View File

@ -59,6 +59,8 @@ public:
/// ///
void octave(OctaveStream &) const; void octave(OctaveStream &) const;
/// ///
InsetCode lyxCode() const { return MATH_DELIM_CODE; }
///
docstring left_; docstring left_;
/// ///
docstring right_; docstring right_;

View File

@ -44,6 +44,8 @@ public:
void maxima(MaximaStream &) const; void maxima(MaximaStream &) const;
/// ///
void write(WriteStream & os) const; void write(WriteStream & os) const;
///
InsetCode lyxCode() const { return MATH_DIFF_CODE; }
private: private:
virtual Inset * clone() const; virtual Inset * clone() const;
}; };

View File

@ -32,6 +32,8 @@ public:
docstring name() const; docstring name() const;
/// request "external features" /// request "external features"
void validate(LaTeXFeatures & features) const; void validate(LaTeXFeatures & features) const;
///
InsetCode lyxCode() const { return MATH_DOTS_CODE; }
protected: protected:
/// cache for the thing's height /// cache for the thing's height
mutable int dh_; mutable int dh_;

View File

@ -37,6 +37,8 @@ public:
void write(WriteStream & os) const; void write(WriteStream & os) const;
/// ///
void infoize(odocstream & os) const; void infoize(odocstream & os) const;
///
InsetCode lyxCode() const { return MATH_ENSUREMATH_CODE; }
private: private:
virtual Inset * clone() const; virtual Inset * clone() const;
}; };

View File

@ -35,6 +35,8 @@ public:
void metrics(MetricsInfo & mi, Dimension & dim) const; void metrics(MetricsInfo & mi, Dimension & dim) const;
/// ///
void infoize(odocstream & os) const; void infoize(odocstream & os) const;
///
InsetCode lyxCode() const { return MATH_ENV_CODE; }
private: private:
virtual Inset * clone() const; virtual Inset * clone() const;

View File

@ -46,6 +46,8 @@ public:
void mathmlize(MathStream &) const; void mathmlize(MathStream &) const;
/// ///
void octave(OctaveStream &) const; void octave(OctaveStream &) const;
///
InsetCode lyxCode() const { return MATH_EXFUNC_CODE; }
private: private:
virtual Inset * clone() const; virtual Inset * clone() const;

View File

@ -45,6 +45,8 @@ public:
void mathmlize(MathStream &) const; void mathmlize(MathStream &) const;
/// ///
void write(WriteStream & os) const; void write(WriteStream & os) const;
///
InsetCode lyxCode() const { return MATH_EXINT_CODE; }
private: private:
virtual Inset * clone() const; virtual Inset * clone() const;
/// ///

View File

@ -49,6 +49,8 @@ public:
void infoize(odocstream & os) const; void infoize(odocstream & os) const;
/// ///
int kerning(BufferView const * bv) const { return cell(0).kerning(bv); } int kerning(BufferView const * bv) const { return cell(0).kerning(bv); }
///
InsetCode lyxCode() const { return MATH_FONT_CODE; }
private: private:
virtual Inset * clone() const; virtual Inset * clone() const;

View File

@ -45,6 +45,8 @@ public:
void infoize(odocstream & os) const; void infoize(odocstream & os) const;
/// ///
int kerning(BufferView const * bv) const { return cell(0).kerning(bv); } int kerning(BufferView const * bv) const { return cell(0).kerning(bv); }
///
InsetCode lyxCode() const { return MATH_FONTOLD_CODE; }
private: private:
virtual Inset * clone() const; virtual Inset * clone() const;

View File

@ -124,6 +124,8 @@ public:
void mathmlize(MathStream &) const; void mathmlize(MathStream &) const;
/// ///
void validate(LaTeXFeatures & features) const; void validate(LaTeXFeatures & features) const;
///
InsetCode lyxCode() const { return MATH_FRAC_CODE; }
private: private:
Inset * clone() const; Inset * clone() const;
/// ///

View File

@ -248,6 +248,9 @@ protected:
std::vector<ColInfo> colinfo_; std::vector<ColInfo> colinfo_;
/// cell info /// cell info
std::vector<CellInfo> cellinfo_; std::vector<CellInfo> cellinfo_;
///
InsetCode lyxCode() const { return MATH_GRID_CODE; }
private: private:
/// ///
char v_align_; // add approp. type char v_align_; // add approp. type

View File

@ -1590,12 +1590,6 @@ void InsetMathHull::revealCodes(Cursor & cur) const
} }
InsetCode InsetMathHull::lyxCode() const
{
return MATH_CODE;
}
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////

View File

@ -142,6 +142,8 @@ public:
/// ///
virtual docstring contextMenu(BufferView const &, int, int) const; virtual docstring contextMenu(BufferView const &, int, int) const;
///
InsetCode lyxCode() const { return MATH_HULL_CODE; }
protected: protected:
InsetMathHull(InsetMathHull const &); InsetMathHull(InsetMathHull const &);
@ -218,8 +220,6 @@ public:
Inset * editXY(Cursor & cur, int x, int y); Inset * editXY(Cursor & cur, int x, int y);
/// ///
DisplayType display() const; DisplayType display() const;
///
InsetCode lyxCode() const;
protected: protected:
/// ///

View File

@ -38,6 +38,9 @@ public:
void write(WriteStream & os) const; void write(WriteStream & os) const;
/// ///
void normalize(NormalStream & ns) const; void normalize(NormalStream & ns) const;
///
InsetCode lyxCode() const { return MATH_KERN_CODE; }
private: private:
virtual Inset * clone() const; virtual Inset * clone() const;
/// width in em /// width in em

View File

@ -32,6 +32,9 @@ public:
void draw(PainterInfo & pi, int x, int y) const; void draw(PainterInfo & pi, int x, int y) const;
/// ///
void infoize(odocstream & os) const; void infoize(odocstream & os) const;
///
InsetCode lyxCode() const { return MATH_LEFTEQN_CODE; }
private: private:
virtual Inset * clone() const; virtual Inset * clone() const;
}; };

View File

@ -42,6 +42,9 @@ public:
void mathmlize(MathStream &) const; void mathmlize(MathStream &) const;
/// ///
void write(WriteStream & os) const; void write(WriteStream & os) const;
///
InsetCode lyxCode() const { return MATH_LIM_CODE; }
private: private:
virtual Inset * clone() const; virtual Inset * clone() const;
}; };

View File

@ -51,6 +51,9 @@ public:
/// ///
void cursorPos(BufferView const & bv, CursorSlice const & sl, void cursorPos(BufferView const & bv, CursorSlice const & sl,
bool boundary, int & x, int & y) const; bool boundary, int & x, int & y) const;
///
InsetCode lyxCode() const { return MATH_MBOX_CODE; }
protected: protected:
virtual void doDispatch(Cursor & cur, FuncRequest & cmd); virtual void doDispatch(Cursor & cur, FuncRequest & cmd);

View File

@ -43,6 +43,9 @@ public:
void mathmlize(MathStream &) const; void mathmlize(MathStream &) const;
/// ///
void octave(OctaveStream &) const; void octave(OctaveStream &) const;
///
InsetCode lyxCode() const { return MATH_MATRIX_CODE; }
private: private:
virtual Inset * clone() const; virtual Inset * clone() const;
}; };

View File

@ -127,6 +127,8 @@ public:
bool insertCompletion(Cursor & cur, docstring const & s, bool finished); bool insertCompletion(Cursor & cur, docstring const & s, bool finished);
/// ///
void completionPosAndDim(Cursor const &, int & x, int & y, Dimension & dim) const; void completionPosAndDim(Cursor const &, int & x, int & y, Dimension & dim) const;
///
InsetCode lyxCode() const { return MATH_NEST_CODE; }
protected: protected:
/// ///

View File

@ -46,6 +46,8 @@ public:
void mathmlize(MathStream &) const; void mathmlize(MathStream &) const;
/// ///
void write(WriteStream & os) const; void write(WriteStream & os) const;
///
InsetCode lyxCode() const { return MATH_NUMBER_CODE; }
private: private:
virtual Inset * clone() const; virtual Inset * clone() const;

View File

@ -35,6 +35,9 @@ public:
void normalize(NormalStream &) const; void normalize(NormalStream &) const;
/// ///
void validate(LaTeXFeatures & features) const; void validate(LaTeXFeatures & features) const;
///
InsetCode lyxCode() const { return MATH_OVERSET_CODE; }
private: private:
virtual Inset * clone() const; virtual Inset * clone() const;
}; };

View File

@ -34,6 +34,9 @@ public:
void infoize(odocstream & os) const; void infoize(odocstream & os) const;
/// ///
void write(WriteStream & os) const; void write(WriteStream & os) const;
///
InsetCode lyxCode() const { return MATH_PAR_CODE; }
private: private:
/// ///
virtual Inset * clone() const; virtual Inset * clone() const;

View File

@ -37,6 +37,9 @@ public:
void normalize(NormalStream & ns) const; void normalize(NormalStream & ns) const;
/// ///
void infoize(odocstream & os) const; void infoize(odocstream & os) const;
///
InsetCode lyxCode() const { return MATH_PHANTOM_CODE; }
private: private:
/// ///
virtual Inset * clone() const; virtual Inset * clone() const;

View File

@ -55,6 +55,9 @@ public:
static int getType(docstring const & name); static int getType(docstring const & name);
/// ///
static docstring const & getName(int type); static docstring const & getName(int type);
///
InsetCode lyxCode() const { return MATH_REF_CODE; }
protected: protected:
/// ///
virtual void doDispatch(Cursor & cur, FuncRequest & cmd); virtual void doDispatch(Cursor & cur, FuncRequest & cmd);

View File

@ -43,6 +43,9 @@ public:
void mathematica(MathematicaStream &) const; void mathematica(MathematicaStream &) const;
/// ///
void octave(OctaveStream &) const; void octave(OctaveStream &) const;
///
InsetCode lyxCode() const { return MATH_ROOT_CODE; }
private: private:
virtual Inset * clone() const; virtual Inset * clone() const;
}; };

View File

@ -102,6 +102,9 @@ public:
void infoize(odocstream & os) const; void infoize(odocstream & os) const;
/// say whether we have displayed limits /// say whether we have displayed limits
void infoize2(odocstream & os) const; void infoize2(odocstream & os) const;
///
InsetCode lyxCode() const { return MATH_SCRIPT_CODE; }
protected: protected:
virtual void doDispatch(Cursor & cur, FuncRequest & cmd); virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
private: private:

View File

@ -39,6 +39,9 @@ public:
void normalize(NormalStream &) const; void normalize(NormalStream &) const;
/// ///
void infoize(odocstream & os) const; void infoize(odocstream & os) const;
///
InsetCode lyxCode() const { return MATH_SIZE_CODE; }
private: private:
virtual Inset * clone() const; virtual Inset * clone() const;
/// ///

View File

@ -61,6 +61,9 @@ public:
docstring contextMenu(BufferView const &, int, int) const; docstring contextMenu(BufferView const &, int, int) const;
/// ///
bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const; bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
///
InsetCode lyxCode() const { return MATH_SPACE_CODE; }
protected: protected:
/// ///
virtual void doDispatch(Cursor & cur, FuncRequest & cmd); virtual void doDispatch(Cursor & cur, FuncRequest & cmd);

View File

@ -52,6 +52,8 @@ public:
docstring name() const { return name_; } docstring name() const { return name_; }
/// ///
char_type getChar() const { return char_; } char_type getChar() const { return char_; }
///
InsetCode lyxCode() const { return MATH_SPECIALCHAR_CODE; }
private: private:
virtual Inset * clone() const; virtual Inset * clone() const;

View File

@ -37,6 +37,9 @@ public:
int defaultColSpace(col_type) { return 0; } int defaultColSpace(col_type) { return 0; }
/// ///
char defaultColAlign(col_type); char defaultColAlign(col_type);
///
InsetCode lyxCode() const { return MATH_SPLIT_CODE; }
private: private:
/// ///
virtual Inset * clone() const; virtual Inset * clone() const;

View File

@ -45,6 +45,9 @@ public:
void octave(OctaveStream &) const; void octave(OctaveStream &) const;
/// ///
void mathmlize(MathStream &) const; void mathmlize(MathStream &) const;
///
InsetCode lyxCode() const { return MATH_SQRT_CODE; }
private: private:
virtual Inset * clone() const; virtual Inset * clone() const;
}; };

View File

@ -36,6 +36,9 @@ public:
void write(WriteStream & os) const; void write(WriteStream & os) const;
/// ///
void normalize(NormalStream &) const; void normalize(NormalStream &) const;
///
InsetCode lyxCode() const { return MATH_STACKREL_CODE; }
private: private:
virtual Inset * clone() const; virtual Inset * clone() const;
}; };

View File

@ -50,6 +50,8 @@ public:
void mathmlize(MathStream &) const; void mathmlize(MathStream &) const;
/// ///
void write(WriteStream & os) const; void write(WriteStream & os) const;
///
InsetCode lyxCode() const { return MATH_STRING_CODE; }
private: private:
virtual Inset * clone() const; virtual Inset * clone() const;

View File

@ -44,6 +44,9 @@ public:
void maple(MapleStream &) const; void maple(MapleStream &) const;
/// ///
void validate(LaTeXFeatures & features) const; void validate(LaTeXFeatures & features) const;
///
InsetCode lyxCode() const { return MATH_SUBSTACK_CODE; }
private: private:
virtual Inset * clone() const; virtual Inset * clone() const;
}; };

View File

@ -68,6 +68,8 @@ public:
void write(WriteStream & os) const; void write(WriteStream & os) const;
/// ///
void infoize2(odocstream & os) const; void infoize2(odocstream & os) const;
///
InsetCode lyxCode() const { return MATH_SYMBOL_CODE; }
private: private:
virtual Inset * clone() const; virtual Inset * clone() const;

View File

@ -45,6 +45,8 @@ public:
void normalize(NormalStream &) const; void normalize(NormalStream &) const;
/// ///
void maple(MapleStream &) const; void maple(MapleStream &) const;
///
InsetCode lyxCode() const { return MATH_TABULAR_CODE; }
private: private:
Inset * clone() const; Inset * clone() const;

View File

@ -37,6 +37,9 @@ public:
void normalize(NormalStream & ns) const; void normalize(NormalStream & ns) const;
/// ///
void validate(LaTeXFeatures & features) const; void validate(LaTeXFeatures & features) const;
///
InsetCode lyxCode() const { return MATH_UNDERSET_CODE; }
private: private:
virtual Inset * clone() const; virtual Inset * clone() const;
}; };

View File

@ -59,6 +59,8 @@ public:
bool final() const; bool final() const;
/// ///
int kerning(BufferView const *) const { return kerning_; } int kerning(BufferView const *) const { return kerning_; }
///
InsetCode lyxCode() const { return MATH_UNKNOWN_CODE; }
private: private:
/// ///

View File

@ -33,6 +33,8 @@ public:
void normalize(NormalStream & os) const; void normalize(NormalStream & os) const;
/// ///
void validate(LaTeXFeatures & features) const; void validate(LaTeXFeatures & features) const;
///
InsetCode lyxCode() const { return MATH_XARROW_CODE; }
private: private:
virtual Inset * clone() const; virtual Inset * clone() const;

View File

@ -42,14 +42,14 @@ public:
void write(WriteStream & os) const; void write(WriteStream & os) const;
/// ///
void normalize(NormalStream &) const; void normalize(NormalStream &) const;
public:
/// ///
InsetMathXYMatrix const * targetMatrix() const; InsetMathXYMatrix const * targetMatrix() const;
/// ///
MathData const & targetCell() const; MathData const & targetCell() const;
/// ///
MathData const & sourceCell() const; MathData const & sourceCell() const;
///
InsetCode lyxCode() const { return MATH_XYARROW_CODE; }
/// ///
bool up_; bool up_;

View File

@ -44,6 +44,9 @@ public:
void maple(MapleStream &) const; void maple(MapleStream &) const;
/// ///
void validate(LaTeXFeatures & features) const; void validate(LaTeXFeatures & features) const;
///
InsetCode lyxCode() const { return MATH_XYMATRIX_CODE; }
private: private:
/// ///
virtual Inset * clone() const; virtual Inset * clone() const;

View File

@ -85,7 +85,7 @@ void MacroData::expand(vector<MathData> const & args, MathData & to) const
for (DocIterator it = doc_iterator_begin(buffer, &inset); it; it.forwardChar()) { for (DocIterator it = doc_iterator_begin(buffer, &inset); it; it.forwardChar()) {
if (!it.nextInset()) if (!it.nextInset())
continue; continue;
if (it.nextInset()->lyxCode() != MATHMACROARG_CODE) if (it.nextInset()->lyxCode() != MATH_MACROARG_CODE)
continue; continue;
//it.cell().erase(it.pos()); //it.cell().erase(it.pos());
//it.cell().insert(it.pos(), it.nextInset()->asInsetMath() //it.cell().insert(it.pos(), it.nextInset()->asInsetMath()

View File

@ -120,6 +120,8 @@ public:
} }
/// Return the maximal number of arguments the macro is greedy for. /// Return the maximal number of arguments the macro is greedy for.
size_t appetite() const { return appetite_; } size_t appetite() const { return appetite_; }
///
InsetCode lyxCode() const { return MATH_MACRO_CODE; }
protected: protected:
friend class MathData; friend class MathData;

View File

@ -35,7 +35,7 @@ public:
/// ///
void setNumber(int n); void setNumber(int n);
/// ///
InsetCode lyxCode() const { return MATHMACROARG_CODE; } InsetCode lyxCode() const { return MATH_MACROARG_CODE; }
/// ///
void normalize(NormalStream &) const; void normalize(NormalStream &) const;

View File

@ -635,7 +635,7 @@ void MathMacroTemplate::removeArguments(Cursor & cur, int from, int to)
for (DocIterator it = doc_iterator_begin(&buffer(), this); it; it.forwardChar()) { for (DocIterator it = doc_iterator_begin(&buffer(), this); it; it.forwardChar()) {
if (!it.nextInset()) if (!it.nextInset())
continue; continue;
if (it.nextInset()->lyxCode() != MATHMACROARG_CODE) if (it.nextInset()->lyxCode() != MATH_MACROARG_CODE)
continue; continue;
MathMacroArgument * arg = static_cast<MathMacroArgument*>(it.nextInset()); MathMacroArgument * arg = static_cast<MathMacroArgument*>(it.nextInset());
int n = arg->number() - 1; 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()) { for (DocIterator it = doc_iterator_begin(&buffer(), this); it; it.forwardChar()) {
if (!it.nextInset()) if (!it.nextInset())
continue; continue;
if (it.nextInset()->lyxCode() != MATHMACROARG_CODE) if (it.nextInset()->lyxCode() != MATH_MACROARG_CODE)
continue; continue;
MathMacroArgument * arg = static_cast<MathMacroArgument*>(it.nextInset()); MathMacroArgument * arg = static_cast<MathMacroArgument*>(it.nextInset());
if (arg->number() >= int(from) + 1) if (arg->number() >= int(from) + 1)
@ -676,7 +676,7 @@ int MathMacroTemplate::maxArgumentInDefinition() const
for (; it; it.forwardChar()) { for (; it; it.forwardChar()) {
if (!it.nextInset()) if (!it.nextInset())
continue; continue;
if (it.nextInset()->lyxCode() != MATHMACROARG_CODE) if (it.nextInset()->lyxCode() != MATH_MACROARG_CODE)
continue; continue;
MathMacroArgument * arg = static_cast<MathMacroArgument*>(it.nextInset()); MathMacroArgument * arg = static_cast<MathMacroArgument*>(it.nextInset());
maxArg = std::max(int(arg->number()), maxArg); maxArg = std::max(int(arg->number()), maxArg);
@ -696,7 +696,7 @@ void MathMacroTemplate::insertMissingArguments(int maxArg)
for (; it && it[0].idx() == idx; it.forwardChar()) { for (; it && it[0].idx() == idx; it.forwardChar()) {
if (!it.nextInset()) if (!it.nextInset())
continue; continue;
if (it.nextInset()->lyxCode() != MATHMACROARG_CODE) if (it.nextInset()->lyxCode() != MATH_MACROARG_CODE)
continue; continue;
MathMacroArgument * arg = static_cast<MathMacroArgument*>(it.nextInset()); MathMacroArgument * arg = static_cast<MathMacroArgument*>(it.nextInset());
found[arg->number() - 1] = true; found[arg->number() - 1] = true;

View File

@ -100,7 +100,6 @@ public:
void infoize(odocstream & os) const; void infoize(odocstream & os) const;
/// ///
docstring contextMenu(BufferView const &, int, int) const; docstring contextMenu(BufferView const &, int, int) const;
protected: protected:
/// ///
virtual void doDispatch(Cursor & cur, FuncRequest & cmd); virtual void doDispatch(Cursor & cur, FuncRequest & cmd);