X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2FInsetMath.h;h=578b29fdcfd671926789bf3036b3859003c21941;hb=a68e5b777487b495feeefa53700834ecec6ec196;hp=3bab681df85f675a16289929dfb0ede7d7422135;hpb=670efa8f646218f2a378f0cc614c4c37a9f6b89a;p=lyx.git diff --git a/src/mathed/InsetMath.h b/src/mathed/InsetMath.h index 3bab681df8..578b29fdcf 100644 --- a/src/mathed/InsetMath.h +++ b/src/mathed/InsetMath.h @@ -13,7 +13,7 @@ #ifndef MATH_INSET_H #define MATH_INSET_H -#include "MathData.h" +#include "MathClass.h" #include "insets/Inset.h" @@ -53,7 +53,10 @@ inclusion in the "real LyX insets" FormulaInset and FormulaMacroInset. */ +class Cursor; class OutputParams; +class MetricsInfo; + class InsetMathArray; class InsetMathAMSArray; class InsetMathBrace; @@ -72,7 +75,6 @@ class InsetMathSpace; class InsetMathSpecialChar; class InsetMathSymbol; class InsetMathUnknown; - class InsetMathRef; class HtmlStream; @@ -84,9 +86,10 @@ class MathematicaStream; class MathStream; class WriteStream; -class MathMacroTemplate; -class MathMacro; -class Cursor; +class MathData; +class InsetMathMacroTemplate; +class InsetMathMacro; +class MathRow; class TextPainter; class TextMetricsInfo; class ReplaceData; @@ -111,6 +114,11 @@ public: /// this is overridden by specific insets virtual mode_type currentMode() const { return MATH_MODE; } + // The possible marker types for math insets + enum marker_type { NO_MARKER, MARKER2, MARKER, BOX_MARKER }; + /// this is overridden by insets with specific edit marker type + virtual marker_type marker(BufferView const *) const; + /// the ascent of the inset above the baseline /// compute the size of the object for text based drawing virtual void metricsT(TextMetricsInfo const & mi, Dimension & dim) const; @@ -142,10 +150,10 @@ public: virtual InsetMathGrid const * asGridInset() const { return 0; } virtual InsetMathHull * asHullInset() { return 0; } virtual InsetMathHull const * asHullInset() const { return 0; } - virtual MathMacro * asMacro() { return 0; } - virtual MathMacro const * asMacro() const { return 0; } - virtual MathMacroTemplate * asMacroTemplate() { return 0; } - virtual MathMacroTemplate const * asMacroTemplate() const { return 0; } + virtual InsetMathMacro * asMacro() { return 0; } + virtual InsetMathMacro const * asMacro() const { return 0; } + virtual InsetMathMacroTemplate * asMacroTemplate() { return 0; } + virtual InsetMathMacroTemplate const * asMacroTemplate() const { return 0; } virtual InsetMathMatrix const * asMatrixInset() const { return 0; } virtual InsetMathNest * asNestInset() { return 0; } virtual InsetMathNest const * asNestInset() const { return 0; } @@ -161,14 +169,21 @@ public: virtual InsetMathRef * asRefInset() { return 0; } virtual InsetMathSpecialChar const * asSpecialCharInset() const { return 0; } + /// The class of the math object (used primarily for spacing) + virtual MathClass mathClass() const; + /// Add this inset to a math row. Return true if contents got added + virtual bool addToMathRow(MathRow &, MetricsInfo & mi) const; + /// Hook that is run before metrics computation starts + virtual void beforeMetrics() const {} + /// Hook that is run after metrics computation + virtual void afterMetrics() const {} + /// Hook that is run before actual drawing + virtual void beforeDraw(PainterInfo const &) const {} + /// Hook that is run after drawing + virtual void afterDraw(PainterInfo const &) const {} + /// identifies things that can get scripts virtual bool isScriptable() const { return false; } - /// identifies a binary operators (used for spacing) - virtual bool isMathBin() const { return false; } - /// identifies relational operators (used for spacing and splitting equations) - virtual bool isMathRel() const { return false; } - /// identifies punctuation (used for spacing) - virtual bool isMathPunct() const { return false; } /// will this get written as a single block in {..} virtual bool extraBraces() const { return false; } @@ -225,7 +240,7 @@ public: /// math stuff usually isn't allowed in text mode virtual bool allowedIn(mode_type mode) const { return mode == MATH_MODE; } - /// superscript kerning + /// Italic correction as described in InsetMathScript.h virtual int kerning(BufferView const *) const { return 0; } /// bool isInToc() const { return true; }