X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2Fmath_boxinset.C;h=3d5f14b6adc567282a8dd5dc285795b90172d518;hb=c649284611c4198c9d70be8a16d153cdf1ec0700;hp=2e1c3bacded15038e635a6e1744f6875adaad000;hpb=40b2b89d4dbd9f948732741503574333ac7b7df7;p=lyx.git diff --git a/src/mathed/math_boxinset.C b/src/mathed/math_boxinset.C index 2e1c3bacde..3d5f14b6ad 100644 --- a/src/mathed/math_boxinset.C +++ b/src/mathed/math_boxinset.C @@ -1,79 +1,56 @@ +#include + #ifdef __GNUG__ #pragma implementation #endif #include "math_boxinset.h" -#include "support/LOstream.h" -#include "LColor.h" -#include "debug.h" -#include "Painter.h" -#include "math_cursor.h" -#include "insets/insettext.h" +#include "math_support.h" +#include "math_mathmlstream.h" +#include "math_streamstr.h" MathBoxInset::MathBoxInset(string const & name) - : MathDimInset(), name_(name), text_(new InsetText), buffer_(0) + : MathGridInset(1, 1), name_(name) {} -MathBoxInset::MathBoxInset(MathBoxInset const & m) - : MathDimInset(*this), name_(m.name_), text_(0), buffer_(m.buffer_) -{ - if (!m.buffer_) - lyxerr << "no buffer\n"; - else - text_ = static_cast(m.text_->clone(*m.buffer_, false)); -} - - -MathBoxInset::~MathBoxInset() -{ - delete text_; -} - - MathInset * MathBoxInset::clone() const { return new MathBoxInset(*this); } -void MathBoxInset::write(MathWriteInfo & os) const +void MathBoxInset::write(WriteStream & os) const { os << "\\" << name_ << "{" << cell(0) << "}"; } -void MathBoxInset::writeNormal(std::ostream & os) const +void MathBoxInset::normalize(NormalStream & os) const { - os << "[mbox "; + os << '[' << name_ << ' '; //text_->write(buffer(), os); os << "] "; } -void MathBoxInset::metrics(MathMetricsInfo const & st) const +void MathBoxInset::rebreak() { - mi_ = st; - if (text_ && mi_.view) { - ascent_ = text_->ascent(mi_.view, mi_.font) + 2; - descent_ = text_->descent(mi_.view, mi_.font) + 2; - width_ = text_->width(mi_.view, mi_.font) + 4; - } else { - ascent_ = 10; - descent_ = 0; - width_ = 10; - } + //lyxerr << "trying to rebreak...\n"; } -void MathBoxInset::draw(Painter & pain, int x, int y) const +void MathBoxInset::metrics(MathMetricsInfo & mi) const { - float fx = x + 2; + MathFontSetChanger dummy(mi.base, "textnormal"); + MathGridInset::metrics(mi); +} + - if (text_ && mi_.view) - text_->draw(mi_.view, mi_.font, y, fx, false); - if (mathcursor && mathcursor->isInside(this)) - pain.rectangle(x, y - ascent(), xcell(0).width(), height(), - LColor::mathframe); +void MathBoxInset::draw(MathPainterInfo & pi, int x, int y) const +{ + MathFontSetChanger dummy(pi.base, "textnormal"); + MathGridInset::draw(pi, x, y); + mathed_draw_framebox(pi, x, y, this); }