From b76821ddffe4ccae343feb731c119892c96f7418 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Thu, 16 Aug 2001 12:34:48 +0000 Subject: [PATCH] new special-purpose inset for \not git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2527 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/Makefile.am | 2 ++ src/mathed/math_hash.C | 2 +- src/mathed/math_notinset.C | 45 +++++++++++++++++++++++++++++++++++ src/mathed/math_notinset.h | 26 ++++++++++++++++++++ src/mathed/math_parser.h | 2 ++ src/mathed/math_symbolinset.C | 2 +- 6 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 src/mathed/math_notinset.C create mode 100644 src/mathed/math_notinset.h diff --git a/src/mathed/Makefile.am b/src/mathed/Makefile.am index 2fa5c1e570..55e1e8d946 100644 --- a/src/mathed/Makefile.am +++ b/src/mathed/Makefile.am @@ -66,6 +66,8 @@ libmathed_la_SOURCES = \ math_matrixinset.h \ math_nestinset.C \ math_nestinset.h \ + math_notinset.C \ + math_notinset.h \ math_noglyphinset.C \ math_noglyphinset.h \ math_parser.C \ diff --git a/src/mathed/math_hash.C b/src/mathed/math_hash.C index 3fe5ca23ab..1b6fb33b3d 100644 --- a/src/mathed/math_hash.C +++ b/src/mathed/math_hash.C @@ -200,7 +200,7 @@ latexkeys wordlist[] = {"ni", LM_TK_NOGLYPH, 0, LMB_RELATION}, {"nolimits", LM_TK_LIMIT, static_cast(-1), LMB_NONE}, {"nonumber", LM_TK_NONUM, 0, LMB_NONE}, - {"not", LM_TK_DECORATION, LM_not, LMB_NONE}, + {"not", LM_TK_NOT, LM_not, LMB_NONE}, {"nu", LM_TK_SYM, LM_nu, LMB_NONE}, {"nwarrow", LM_TK_NOGLYPH, 0, LMB_NONE}, {"odot", LM_TK_NOGLYPH, 0, LMB_OPERATOR}, diff --git a/src/mathed/math_notinset.C b/src/mathed/math_notinset.C new file mode 100644 index 0000000000..5b72fc88b2 --- /dev/null +++ b/src/mathed/math_notinset.C @@ -0,0 +1,45 @@ +#include "math_notinset.h" +#include "math_parser.h" +#include "support.h" +#include "support/LOstream.h" + + +using std::ostream; + +MathNotInset::MathNotInset() +{} + + +MathInset * MathNotInset::clone() const +{ + return new MathNotInset(*this); +} + + +void MathNotInset::write(ostream & os, bool /* fragile */) const +{ + os << "\\not "; +} + + +void MathNotInset::writeNormal(ostream & os) const +{ + os << "[not] "; +} + + +void MathNotInset::metrics(MathStyles st) const +{ + size(st); + mathed_char_dim(LM_TC_VAR, size_, '/', ascent_, descent_, width_); + width_ = 1; +} + + +void MathNotInset::draw(Painter & pain, int x, int y) const +{ + xo(x); + yo(y); + + drawChar(pain, LM_TC_VAR, size_, x + 4, y, '/'); +} diff --git a/src/mathed/math_notinset.h b/src/mathed/math_notinset.h new file mode 100644 index 0000000000..917e5bb7ff --- /dev/null +++ b/src/mathed/math_notinset.h @@ -0,0 +1,26 @@ +// -*- C++ -*- +#ifndef MATH_NOTINSET_H +#define MATH_NOTINSET_H + +#include "math_diminset.h" + +struct latexkeys; + +// \\not + +class MathNotInset : public MathDimInset { +public: + /// + MathNotInset(); + /// + MathInset * clone() const; + /// + void write(std::ostream &, bool fragile) const; + /// + void writeNormal(std::ostream &) const; + /// + void metrics(MathStyles st) const; + /// + void draw(Painter &, int x, int y) const; +}; +#endif diff --git a/src/mathed/math_parser.h b/src/mathed/math_parser.h index fa5e770f8a..d93ec5d2b6 100644 --- a/src/mathed/math_parser.h +++ b/src/mathed/math_parser.h @@ -107,6 +107,8 @@ enum MathTokenEnum /// LM_TK_MATH, /// + LM_TK_NOT, + /// LM_TK_STACK }; diff --git a/src/mathed/math_symbolinset.C b/src/mathed/math_symbolinset.C index 1ca489bd5b..6a1648ea17 100644 --- a/src/mathed/math_symbolinset.C +++ b/src/mathed/math_symbolinset.C @@ -25,7 +25,7 @@ void MathSymbolInset::write(ostream & os, bool /* fragile */) const void MathSymbolInset::writeNormal(ostream & os) const { - os << "[bigop " << sym_->name << "] "; + os << "[" << sym_->name << "] "; } -- 2.39.5