X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2FMathMacro.h;h=f1e61dcb4c5bcf81d8171624c471d32f7939ea38;hb=ad79ac406f9c8fc85880cfeb5416b0299ee9a617;hp=157e6e64efb3f04bf5e8eb01ef852fa5acf7b9a9;hpb=0f15dcc69895c190811d98ad5f0b9bce887f53f6;p=lyx.git diff --git a/src/mathed/MathMacro.h b/src/mathed/MathMacro.h index 157e6e64ef..f1e61dcb4c 100644 --- a/src/mathed/MathMacro.h +++ b/src/mathed/MathMacro.h @@ -37,21 +37,28 @@ public: /// virtual MathMacro const * asMacro() const { return this; } /// + marker_type marker() const; /// If the macro is in normal edit mode, dissolve its contents in /// the row. Otherwise, just insert the inset. bool addToMathRow(MathRow &, MetricsInfo & mi) const; /// - void draw(PainterInfo & pi, int x, int y) const; - /// draw selection background - void drawSelection(PainterInfo & pi, int x, int y) const; - /// draw decorations. - void drawDecoration(PainterInfo & pi, int x, int y) const - { drawMarkers2(pi, x, y); } + void beforeMetrics() const; + /// + void afterMetrics() const; + /// + void beforeDraw(PainterInfo const &) const; + /// + void afterDraw(PainterInfo const &) const; + /// void metrics(MetricsInfo & mi, Dimension & dim) const; /// was the macro in edit mode when computing metrics? bool editMetrics(BufferView const * bv) const; /// + void draw(PainterInfo & pi, int x, int y) const; + /// draw selection background + void drawSelection(PainterInfo & pi, int x, int y) const; + /// int kerning(BufferView const * bv) const; /// get cursor position void cursorPos(BufferView const & bv, CursorSlice const & sl, @@ -122,7 +129,7 @@ public: /// docstring name() const; - /// + /// FIXME: Often dangling. MacroData const * macro() const; /// docstring macroName() const; @@ -141,6 +148,9 @@ public: size_t appetite() const; /// InsetCode lyxCode() const { return MATH_MACRO_CODE; } + /// This is not used for display; however whether it is mathrel determines + /// how to split equations intelligently. + MathClass mathClass() const; //override protected: friend class MathData; @@ -164,6 +174,14 @@ protected: void attachArguments(std::vector const & args, size_t arity, int optionals); private: + /// Math mode for output and display. UNDECIDED for user macros: they could + /// be either. + mode_type modeToEnsure() const; + /// This function is needed for now because of two shortfalls of the current + /// implementation: the macro() pointer is often dangling, in which case we + /// fall back to a backup copy, and the macro is not known at inset + /// creation, in which case we fall back to the global macro with this name. + MacroData const * macroBackup() const; /// virtual Inset * clone() const; ///