]> git.lyx.org Git - lyx.git/commitdiff
some *cough* support for \ll and \gg and potentially more...
authorAndré Pönitz <poenitz@gmx.net>
Mon, 20 Aug 2001 16:37:35 +0000 (16:37 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Mon, 20 Aug 2001 16:37:35 +0000 (16:37 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2561 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/Makefile.am
src/mathed/math_cheatinset.C [new file with mode: 0644]
src/mathed/math_cheatinset.h [new file with mode: 0644]
src/mathed/math_hash.C
src/mathed/math_macrotable.C

index 55e1e8d9464be882a9d1b8e3f73a4268294c1aa6..61e5df60f5953ac8415402cce03940a2bb02625d 100644 (file)
@@ -26,6 +26,8 @@ libmathed_la_SOURCES = \
        math_bigopinset.h \
        math_binominset.C \
        math_binominset.h \
+       math_cheatinset.C \
+       math_cheatinset.h \
        math_charinset.C \
        math_charinset.h \
        math_cursor.C \
diff --git a/src/mathed/math_cheatinset.C b/src/mathed/math_cheatinset.C
new file mode 100644 (file)
index 0000000..a62f321
--- /dev/null
@@ -0,0 +1,39 @@
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include "math_cheatinset.h"
+#include "support.h"
+#include "support/LOstream.h"
+
+
+
+MathCheatInset::MathCheatInset(double w)
+       : wid_(w)
+{}
+
+
+MathInset * MathCheatInset::clone() const
+{
+       return new MathCheatInset(*this);
+}
+
+
+void MathCheatInset::draw(Painter & pain, int x, int y) const
+{}
+
+
+void MathCheatInset::write(std::ostream &, bool) const
+{}
+
+
+void MathCheatInset::writeNormal(std::ostream &) const
+{}
+
+
+void MathCheatInset::metrics(MathStyles st) const
+{
+       // mimic -.1em
+       mathed_char_dim(LM_TC_CONST, st, 'm', ascent_, descent_, width_);
+       width_ *= wid_;
+}
diff --git a/src/mathed/math_cheatinset.h b/src/mathed/math_cheatinset.h
new file mode 100644 (file)
index 0000000..5569c5a
--- /dev/null
@@ -0,0 +1,31 @@
+// -*- C++ -*-
+#ifndef MATH_CHEATINSET_H
+#define MATH_CHEATINSET_H
+
+#include "math_diminset.h"
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+/// Some cheating for displaying things like \ll etc
+
+class MathCheatInset : public MathDimInset {
+public:
+       ///
+       explicit MathCheatInset(double wid);
+       ///
+       MathInset * clone() const;
+       ///
+       void draw(Painter &, int x, int y) const;
+       ///
+       void write(std::ostream &, bool fragile) const;
+       ///
+       void writeNormal(std::ostream &) const;
+       ///
+       void metrics(MathStyles st) const;
+private:
+       /// width in em
+       double wid_;
+};
+#endif
index 01ce7c409d4d05f9a7bb19ce8798144e0284df54..afba73cbdf62f758707523dd11c64353bc56aef0 100644 (file)
@@ -137,7 +137,6 @@ latexkeys wordlist[] =
        {"gamma",  LM_TK_SYM, LM_gamma, LMB_NONE},
        {"gcd",  LM_TK_FUNCLIM, 0, LMB_NONE},
        {"geq",  LM_TK_SYM, LM_geq, LMB_RELATION},
-       {"gg",  LM_TK_NOGLYPH, 0, LMB_RELATION},
        {"grave",  LM_TK_DECORATION, LM_grave, LMB_NONE},
        {"hat",  LM_TK_DECORATION, LM_hat, LMB_NONE},
        {"hbar",  LM_TK_NOGLYPH, 0, LMB_NONE},
@@ -171,7 +170,6 @@ latexkeys wordlist[] =
        {"liminf",  LM_TK_FUNCLIM, 0, LMB_NONE},
        {"limits",  LM_TK_LIMIT, 1 , LMB_NONE},
        {"limsup",  LM_TK_FUNCLIM, 0, LMB_NONE},
-       {"ll",  LM_TK_NOGLYPH, 0, LMB_RELATION},
        {"ln",  LM_TK_FUNC, 0, LMB_NONE},
        {"log",  LM_TK_FUNC, 0, LMB_NONE},
        {"longleftarrow",  LM_TK_NOGLYPH, 0, LMB_NONE},
index 31c36c2c7e3a7b8038e3e903ea518dff2142f265..c7cc1a4819b6f1dfc49889e19dd30369ad6c95ef 100644 (file)
@@ -11,6 +11,8 @@
 #include "math_macrotemplate.h"
 #include "math_parser.h"
 #include "math_fracinset.h"
+#include "math_cheatinset.h"
+#include "math_charinset.h"
 #include "debug.h"
 
 
@@ -100,4 +102,16 @@ void MathMacroTable::builtinMacros()
        //createTemplate("lint",       4, "\\int_#1^#2#3 d#4");
        //createTemplate("silentmult", 0, "\\cdot");
        //createTemplate("binom",        2, "\\left(\\frac#1#2\\right)");
+       
+       MathMacroTemplate ll("ll", 0);
+       ll.cell(0).push_back(new MathCharInset('<', LM_TC_CONST));
+       ll.cell(0).push_back(new MathCheatInset(-0.9));
+       ll.cell(0).push_back(new MathCharInset('<', LM_TC_CONST));
+       insertTemplate(ll);
+
+       MathMacroTemplate gg("gg", 0);
+       gg.cell(0).push_back(new MathCharInset('>', LM_TC_CONST));
+       gg.cell(0).push_back(new MathCheatInset(-0.9));
+       gg.cell(0).push_back(new MathCharInset('>', LM_TC_CONST));
+       insertTemplate(gg);
 }