X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2FMathMacro.h;h=6e795237e197d2b50480c9b69d6f0e19cde108f0;hb=5fdc577badb1cb133d6a0dc7d831bb1f82576adb;hp=1a8654ac4035a9c671990aaf9d61269df5ef754e;hpb=314e30d5fdd243fca204effb20acdd6b8b8469b1;p=lyx.git diff --git a/src/mathed/MathMacro.h b/src/mathed/MathMacro.h index 1a8654ac40..6e795237e1 100644 --- a/src/mathed/MathMacro.h +++ b/src/mathed/MathMacro.h @@ -37,6 +37,10 @@ public: /// virtual MathMacro const * asMacro() const { return this; } /// + /// 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; @@ -45,6 +49,8 @@ public: { drawMarkers2(pi, x, y); } /// void metrics(MetricsInfo & mi, Dimension & dim) const; + /// was the macro in edit mode when computing metrics? + bool editMetrics(BufferView const * bv) const; /// int kerning(BufferView const * bv) const; /// get cursor position @@ -116,8 +122,12 @@ public: /// docstring name() const; + /// FIXME: Often dangling. + MacroData const * macro() const; /// docstring macroName() const; + /// Level of nesting in macros (including this one) + int nesting() const; /// bool validName() const; /// @@ -131,6 +141,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; @@ -144,19 +157,24 @@ protected: /// update macro definition void updateMacro(MacroContext const & mc); /// check if macro definition changed, argument changed etc. and adapt - void updateRepresentation(Cursor * cur, MacroContext const & mc, UpdateType); + void updateRepresentation(Cursor * cur, MacroContext const & mc, + UpdateType, int nesting); /// empty macro, put arguments into args, possibly strip arity-attachedArgsNum_ empty ones. /// Includes the optional arguments. void detachArguments(std::vector & args, bool strip); /// attach arguments (maybe less than arity at the end of an MathData), /// including the optional ones (even if it can be empty here) void attachArguments(std::vector const & args, size_t arity, int optionals); - /// - MacroData const * macro(); - /// - bool editMetrics(BufferView const * bv) const; 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; ///