]> git.lyx.org Git - features.git/commitdiff
visual support for \displaystyle
authorAndré Pönitz <poenitz@gmx.net>
Thu, 3 Jan 2002 12:02:54 +0000 (12:02 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Thu, 3 Jan 2002 12:02:54 +0000 (12:02 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3280 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/ChangeLog
src/mathed/formulabase.C
src/mathed/math_boxinset.C
src/mathed/math_cursor.C
src/mathed/math_factory.C
src/mathed/math_hash.C
src/mathed/math_lefteqninset.C
src/mathed/math_parser.C
src/mathed/math_sizeinset.C
src/mathed/math_support.C
src/mathed/math_support.h

index 1738fc7090f95bd402c2166a34d38f81d8c0d440..8d9b99f5d2121b83e7ed6116fd5af8d96a50fced 100644 (file)
@@ -1,3 +1,11 @@
+
+2002-01-03  André Pönitz <poenitz@gmx.net>
+
+       * formulabase.[Ch]: implement simple search
+
+       * math_sizeinset.[Ch]: support for \displaystyle etc
+
+
 2001-12-18  Dekel Tsur  <dekelts@tau.ac.il>
 
        * math_macrotable.C (builtinMacros): Adjust kern values.
index 26a4f1b526488754d961ccaf5ebd96c113e39377..5c275b1ddfb24148db2c7ceb39d777704416aa84 100644 (file)
@@ -280,8 +280,8 @@ void InsetFormulaBase::insetButtonPress(BufferView * bv,
                return;
        }
 
-       //lyxerr << "insetButtonPress: " << x + xo_ << " " << y + yo_
-       //      << " but: " << button << "\n";
+       lyxerr << "insetButtonPress: " << x + xo_ << " " << y + yo_
+               << " but: " << button << "\n";
        switch (button) {
                default:
                case 1:
index b2ed64015f875667382793ff64fffec246bb6e15..8065cd136dc16351d3b7748feec6cb69942f8130 100644 (file)
@@ -5,13 +5,11 @@
 #endif
 
 #include "math_boxinset.h"
-#include "support/LOstream.h"
-#include "debug.h"
-#include "Painter.h"
-#include "math_cursor.h"
+#include "math_support.h"
 #include "math_mathmlstream.h"
 #include "math_streamstr.h"
 
+
 MathBoxInset::MathBoxInset(string const & name)
        : MathGridInset(1, 1), name_(name)
 {}
@@ -46,8 +44,5 @@ void MathBoxInset::rebreak()
 void MathBoxInset::draw(Painter & pain, int x, int y) const
 {
        MathGridInset::draw(pain, x, y);
-       if (mathcursor && mathcursor->isInside(this)) {
-               pain.rectangle(x - 1, y - ascent() - 1, width(), height(),
-                       LColor::mathframe);
-       }
+       mathed_draw_framebox(pain, x, y, this);
 }
index 24e53be5706875371cc42776402f70bb20f4cf50..2cc8113baf1c77baf7e2a85cb2991c54cf04948d 100644 (file)
@@ -1275,6 +1275,7 @@ bool MathCursor::interpret(string const & s)
        return true;
 }
 
+
 bool MathCursor::script(bool up)
 {
        macroModeClose();
index 327624ec0d0f9b05241be1440296590af50ebc89..7e09a0abcc706c00edcba25c56d244666e23a956 100644 (file)
@@ -15,6 +15,7 @@
 #include "math_macroarg.h"
 #include "math_notinset.h"
 #include "math_rootinset.h"
+#include "math_sizeinset.h"
 #include "math_spaceinset.h"
 #include "math_specialcharinset.h"
 #include "math_sqrtinset.h"
@@ -68,6 +69,8 @@ MathAtom createMathInset(latexkeys const * l)
                return MathAtom(new MathBoxInset(l->name));
        case LM_TK_FUNC:
                return MathAtom(new MathFuncInset(l->name));
+       case LM_TK_STY:
+               return MathAtom(new MathSizeInset(l));
        }
        return MathAtom(new MathUnknownInset(l->name));
 }
index 1f22147ab4633847dbf692f99865ff872867c139..99956ad3fda996caf25b2a1ffdc12fe5e17154ad 100644 (file)
@@ -1,6 +1,7 @@
 #include <config.h>
 
 #include "math_parser.h"
+#include "math_metricsinfo.h"
 #include "lyxlex.h"
 #include "debug.h"
 #include "support/filetools.h" // LibFileSearch
@@ -65,7 +66,7 @@ key_type wordlist_array[] =
        {"deg",  LM_TK_FUNC, 0},
        {"det",  LM_TK_FUNCLIM, 0},
        {"dim",  LM_TK_FUNC, 0},
-       //{"displaystyle",  LM_TK_STY, LM_ST_DISPLAY},
+       {"displaystyle",  LM_TK_STY, LM_ST_DISPLAY},
        {"dot",  LM_TK_DECORATION, 0},
        {"end",  LM_TK_END, 0},
        {"exp",  LM_TK_FUNC, 0},
index 99eb3159a25adb051cb547c46e49c1c690ee7fac..318a634549838f1a6b961e51a774fb66c5de3fae 100644 (file)
@@ -3,10 +3,8 @@
 #endif
 
 #include "math_lefteqninset.h"
-#include "LColor.h"
-#include "Painter.h"
-#include "math_cursor.h"
 #include "math_mathmlstream.h"
+#include "math_support.h"
 
 
 MathLefteqnInset::MathLefteqnInset()
@@ -32,10 +30,7 @@ void MathLefteqnInset::metrics(MathMetricsInfo const & mi) const
 void MathLefteqnInset::draw(Painter & pain, int x, int y) const
 {
        xcell(0).draw(pain, x + 2, y);
-       if (mathcursor && mathcursor->isInside(this)) {
-               pain.rectangle(x, y - ascent(), xcell(0).width(), height(),
-                       LColor::mathframe);
-       }
+       //mathed_draw_framebox(pain, x, y, this);
 }
 
 
index 7538fce72c38fbf3d9d7edfad4b9bada56b79d24..b67ea0112ed56907e2a5741667a7b692e70b01da 100644 (file)
@@ -64,6 +64,7 @@ point to write some macros:
 #include "math_macrotemplate.h"
 #include "math_hullinset.h"
 #include "math_rootinset.h"
+#include "math_sizeinset.h"
 #include "math_sqrtinset.h"
 #include "math_scriptinset.h"
 #include "math_specialcharinset.h"
@@ -899,19 +900,6 @@ void Parser::parse_into(MathArray & array, unsigned flags, MathTextCodes code)
                        return;
                }
 
-/*             
-               case LM_TK_STY:
-               {
-                       lyxerr[Debug::MATHED] << "LM_TK_STY not implemented\n";
-                       //MathArray tmp = array;
-                       //MathSizeInset * p = new MathSizeInset(MathStyles(lval_->id));
-                       //array.push_back(p);
-                       //parse_into(p->cell(0), FLAG_BRACE_FONT);
-                       break; 
-               }
-
-*/
-               
                else if (t.cs() == "begin") {
                        string const name = getArg('{', '}');   
                        if (name == "array") {
@@ -1000,6 +988,13 @@ void Parser::parse_into(MathArray & array, unsigned flags, MathTextCodes code)
                                        array.push_back(p);
                                }
 
+                               else if (l->token == LM_TK_STY) {
+                                       MathAtom p = createMathInset(t.cs());
+                                       parse_into(p->cell(0), flags, code);
+                                       array.push_back(p);
+                                       return;
+                               }
+
                                else {
                                        MathAtom p = createMathInset(t.cs());
                                        for (MathInset::idx_type i = 0; i < p->nargs(); ++i) 
index 02f45c00afb7e25009b49ed99206325ec6d58904..0f4eb4667aa4e1dce1d685e410894a59eddec411 100644 (file)
@@ -8,6 +8,7 @@
 #include "math_parser.h"
 #include "math_mathmlstream.h"
 #include "math_streamstr.h"
+#include "math_support.h"
 
 
 MathSizeInset::MathSizeInset(latexkeys const * l)
@@ -23,7 +24,8 @@ MathInset * MathSizeInset::clone() const
 
 void MathSizeInset::draw(Painter & pain, int x, int y) const
 {
-       xcell(0).draw(pain, x, y);
+       xcell(0).draw(pain, x + 1, y);
+       mathed_draw_framebox(pain, x, y, this);
 }
 
 
@@ -32,9 +34,9 @@ void MathSizeInset::metrics(MathMetricsInfo const & mi) const
        MathMetricsInfo m = mi;
        m.style = MathStyles(key_->id);
        xcell(0).metrics(m);
-       ascent_   = xcell(0).ascent_;
-       descent_  = xcell(0).descent_;
-       width_    = xcell(0).width_;
+       ascent_   = xcell(0).ascent_ + 1;
+       descent_  = xcell(0).descent_ + 1;
+       width_    = xcell(0).width_ + 2;
 }
 
 
index 3f6ee22868744fd2f000d5c0db75f03f6aa77e69..a7ffa7949cbcc649028d8aa39ba5819ae861410b 100644 (file)
@@ -6,6 +6,7 @@
 #include "lyxfont.h"
 #include "FontLoader.h"
 #include "font.h"
+#include "math_cursor.h"
 #include "math_defs.h"
 #include "math_inset.h"
 #include "math_parser.h"
@@ -709,6 +710,14 @@ void mathed_draw_deco(Painter & pain, int x, int y, int w, int h,
 }
 
 
+void mathed_draw_framebox(Painter & pain, int x, int y, MathInset const * p)
+{
+       if (mathcursor && mathcursor->isInside(p))
+               pain.rectangle(x, y - p->ascent(), p->width(), p->height(),
+                       LColor::mathframe);
+}
+
+
 // In the future maybe we use a better fonts renderer
 void drawStr(Painter & pain, MathTextCodes type, MathMetricsInfo const & siz,
        int x, int y, string const & s)
index 2b219a39a55eee2cda3612dd830deb3aab717a22..5be27bc06d1edbbd487e079f0cd8a9b4d6083569 100644 (file)
@@ -9,6 +9,7 @@
 class Painter;
 class latexkeys;
 class MathMetricsInfo;
+class MathInset;
 
 extern char const * latex_mathspace[];
 
@@ -26,6 +27,8 @@ int mathed_char_descent(MathTextCodes type, MathMetricsInfo const & size,
 void mathed_draw_deco(Painter & pain, int x, int y, int w, int h,
        string const & name);
 
+void mathed_draw_framebox(Painter & pain, int x, int y, MathInset const *);
+
 void mathed_string_dim(MathTextCodes type, MathMetricsInfo const & size,
        string const & s, int & asc, int & des, int & wid);
 int mathed_string_height(MathTextCodes type, MathMetricsInfo const & size,