]> git.lyx.org Git - features.git/commitdiff
preview cosmetics
authorAndré Pönitz <poenitz@gmx.net>
Wed, 26 Jun 2002 09:15:23 +0000 (09:15 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Wed, 26 Jun 2002 09:15:23 +0000 (09:15 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4485 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/formula.C
src/mathed/formulabase.h

index df95abb12ea3240f499acaaee4394b165b528e30..dd78f7096f29094ecfbaa8c28243f094cf55a11c 100644 (file)
@@ -165,15 +165,15 @@ void InsetFormula::draw(BufferView * bv, LyXFont const & font,
 {
        metrics(bv, font);
 
-       int x = int(xx);
-       int w = par_->width();
-       int h = par_->height();
-       int a = par_->ascent();
+       int const x = int(xx);
+       int const w = par_->width();
+       int const h = par_->height();
+       int const a = par_->ascent();
 
        MathPainterInfo pi(bv->painter());
+       pi.base.style = display() ? LM_ST_DISPLAY : LM_ST_TEXT;
        pi.base.font  = font;
        pi.base.font.setColor(LColor::math);
-       pi.base.style = display() ? LM_ST_DISPLAY : LM_ST_TEXT;
 
        if (lcolor.getX11Name(LColor::mathbg)!=lcolor.getX11Name(LColor::background))
                pi.pain.fillRectangle(x, y - a, w, h, LColor::mathbg);
@@ -194,11 +194,15 @@ void InsetFormula::draw(BufferView * bv, LyXFont const & font,
                par_->write(wi);
                if (preview(os.str(), preview_)) {
                        cerr << "image could be drawn\n";
-                       pi.pain.image(x + 40, y, 50, 50, *(preview_->image()));
+                       pi.pain.image(x + w + 2, y - a + 1, w - 2, h - 2, *(preview_->image()));
+               } else {
+                       pi.pain.fillRectangle(x + w, y - a, w, h, LColor::white);
                }
+               pi.pain.rectangle(x + w, y - a, w, h, LColor::mathframe);
+               xx += w;
        }
 
-       xx += par_->width();
+       xx += w;
        xo_ = x;
        yo_ = y;
 
@@ -404,7 +408,9 @@ int InsetFormula::descent(BufferView *, LyXFont const &) const
 int InsetFormula::width(BufferView * bv, LyXFont const & font) const
 {
        metrics(bv, font);
-       return par_->width();
+       int const w = par_->width();
+       // double the space for the preview if needed
+       return lyxrc.preview ? 2 * w : w;
 }
 
 
index fd6c2db66405a98087d40899c645df5ee940d037..0f7be78eaf3dd8c1ef2ddd352b79627325820832 100644 (file)
@@ -106,10 +106,10 @@ public:
 
        ///
        virtual bool searchForward(BufferView *, string const &,
-                                  bool = true, bool = false);
+                                  bool = true, bool = false);
        ///
        virtual bool searchBackward(BufferView *, string const &,
-                                   bool = true, bool = false);
+                                   bool = true, bool = false);
        ///
        virtual bool isTextInset() const { return true; }
        ///