X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2FInsetMathFrac.h;h=c2427ec76496f59ebc602b1eb69fc7892abbf8a0;hb=e5bb491e2e10a8097284d11eae5501a3673731cb;hp=59c198691b7f82e7fd6761bb2611892609b45771;hpb=a9c466ae2f9b9d478e5ae46b2bfbbd31b97d7bf0;p=lyx.git diff --git a/src/mathed/InsetMathFrac.h b/src/mathed/InsetMathFrac.h index 59c198691b..c2427ec764 100644 --- a/src/mathed/InsetMathFrac.h +++ b/src/mathed/InsetMathFrac.h @@ -23,13 +23,19 @@ namespace lyx { class InsetMathFracBase : public InsetMathNest { public: /// - explicit InsetMathFracBase(idx_type ncells = 2); + InsetMathFracBase(Buffer * buf, idx_type ncells = 2); /// - bool idxUpDown(Cursor &, bool up) const; + marker_type marker(BufferView const *) const override { return marker_type::MARKER2; } /// - bool idxBackward(Cursor &) const { return false; } + bool idxUpDown(Cursor &, bool up) const override; /// - bool idxForward(Cursor &) const { return false; } + bool idxBackward(Cursor &) const override { return false; } + /// + bool idxForward(Cursor &) const override { return false; } + /// + InsetMathFracBase * asFracBaseInset() override { return this; } + /// + InsetMathFracBase const * asFracBaseInset() const override { return this; } }; @@ -40,114 +46,66 @@ public: /// enum Kind { FRAC, + AASTEX_CASE, + CFRAC, + CFRACLEFT, + CFRACRIGHT, + DFRAC, + TFRAC, OVER, ATOP, NICEFRAC, UNITFRAC, UNIT }; - /// - explicit InsetMathFrac(Kind kind = FRAC, idx_type ncells = 2); + explicit InsetMathFrac(Buffer * buf, Kind kind = FRAC, idx_type ncells = 2); + /// + bool idxForward(Cursor &) const override; /// - bool idxForward(Cursor &) const; + bool idxBackward(Cursor &) const override; /// - bool idxBackward(Cursor &) const; + MathClass mathClass() const override; /// - void metrics(MetricsInfo & mi, Dimension & dim) const; + void metrics(MetricsInfo & mi, Dimension & dim) const override; /// - void draw(PainterInfo &, int x, int y) const; + void draw(PainterInfo &, int x, int y) const override; /// - void metricsT(TextMetricsInfo const & mi, Dimension & dim) const; + void metricsT(TextMetricsInfo const & mi, Dimension & dim) const override; /// - void drawT(TextPainter &, int x, int y) const; + void drawT(TextPainter &, int x, int y) const override; /// identifies FracInsets - InsetMathFrac * asFracInset(); + InsetMathFrac * asFracInset() override; /// identifies FracInsets - InsetMathFrac const * asFracInset() const; - /// - docstring name() const; - /// - bool extraBraces() const; - - /// - void write(WriteStream & os) const; + InsetMathFrac const * asFracInset() const override; /// - void maple(MapleStream &) const; + docstring name() const override; /// - void mathematica(MathematicaStream &) const; + bool extraBraces() const override; /// - void octave(OctaveStream &) const; + void write(TeXMathStream & os) const override; /// - void mathmlize(MathStream &) const; - /// - void validate(LaTeXFeatures & features) const; -public: - Inset * clone() const; - /// - Kind kind_; -}; - - -/// \dfrac support -class InsetMathDFrac : public InsetMathFrac { -public: + void maple(MapleStream &) const override; /// - InsetMathDFrac() {} + void mathematica(MathematicaStream &) const override; /// - void metrics(MetricsInfo & mi, Dimension & dim) const; + void octave(OctaveStream &) const override; /// - void draw(PainterInfo &, int x, int y) const; + void mathmlize(MathMLStream &) const override; /// - docstring name() const; + void htmlize(HtmlStream &) const override; /// - void mathmlize(MathStream &) const; - /// - void validate(LaTeXFeatures & features) const; + void validate(LaTeXFeatures & features) const override; private: - Inset * clone() const; -}; - - -/// \tfrac support -class InsetMathTFrac : public InsetMathFrac { -public: - /// - InsetMathTFrac() {} - /// - void metrics(MetricsInfo & mi, Dimension & dim) const; - /// - void draw(PainterInfo &, int x, int y) const; + /// vertical displacement + int dy(FontInfo & fi) const; /// - docstring name() const; + Inset * clone() const override; /// - void mathmlize(MathStream &) const; - /// - void validate(LaTeXFeatures & features) const; -private: - Inset * clone() const; + Kind kind_; }; -/// \cfrac support -class InsetMathCFrac : public InsetMathFrac { -public: - /// - InsetMathCFrac() {} - /// - void metrics(MetricsInfo & mi, Dimension & dim) const; - /// - void draw(PainterInfo &, int x, int y) const; - /// - docstring name() const; - /// - void mathmlize(MathStream &) const; - /// - void validate(LaTeXFeatures & features) const; -private: - Inset * clone() const; -}; - /// Binom like objects class InsetMathBinom : public InsetMathFracBase { @@ -155,81 +113,44 @@ public: /// enum Kind { BINOM, + DBINOM, + TBINOM, CHOOSE, BRACE, BRACK }; - - /// - explicit InsetMathBinom(Kind kind = BINOM); - /// - void write(WriteStream & os) const; /// - void normalize(NormalStream &) const; + explicit InsetMathBinom(Buffer * buf, Kind kind = BINOM); /// - void metrics(MetricsInfo & mi, Dimension & dim) const; + void write(TeXMathStream & os) const override; /// - void draw(PainterInfo &, int x, int y) const; - /// draw decorations. - void drawDecoration(PainterInfo & pi, int x, int y) const - { drawMarkers2(pi, x, y); } + void normalize(NormalStream &) const override; + /// Generalized fractions are of inner class (see The TeXbook, p.292) + MathClass mathClass() const override { return MC_INNER; } /// - bool extraBraces() const; - /// - void validate(LaTeXFeatures & features) const; -private: - Inset * clone() const; - /// - int dw(int height) const; - /// - Kind kind_; -}; - - -/// \dbinom support -class InsetMathDBinom : public InsetMathFracBase { -public: + void metrics(MetricsInfo & mi, Dimension & dim) const override; /// - InsetMathDBinom() {} + void draw(PainterInfo &, int x, int y) const override; /// - void metrics(MetricsInfo & mi, Dimension & dim) const; + bool extraBraces() const override; /// - void draw(PainterInfo &, int x, int y) const; + void mathmlize(MathMLStream &) const override; /// - docstring name() const; + void htmlize(HtmlStream &) const override; /// - void mathmlize(MathStream &) const; + void validate(LaTeXFeatures & features) const override; /// - void validate(LaTeXFeatures & features) const; + InsetCode lyxCode() const override { return MATH_FRAC_CODE; } private: - Inset * clone() const; + Inset * clone() const override; /// int dw(int height) const; -}; - - -/// \tbinom support -class InsetMathTBinom : public InsetMathFracBase { -public: - /// - InsetMathTBinom() {} - /// - void metrics(MetricsInfo & mi, Dimension & dim) const; /// - void draw(PainterInfo &, int x, int y) const; - /// - docstring name() const; - /// - void mathmlize(MathStream &) const; - /// - void validate(LaTeXFeatures & features) const; -private: - Inset * clone() const; - /// - int dw(int height) const; + Kind kind_; }; + } // namespace lyx #endif