mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-08 10:51:03 +00:00
fix bug #560
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8900 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
d2f9e0a569
commit
5fc3d2b0af
@ -26,7 +26,7 @@ public:
|
||||
///
|
||||
explicit MathBoxInset(std::string const & name);
|
||||
///
|
||||
virtual std::auto_ptr<InsetBase> clone() const;
|
||||
std::auto_ptr<InsetBase> clone() const;
|
||||
///
|
||||
mode_type currentMode() const { return TEXT_MODE; }
|
||||
///
|
||||
|
@ -253,12 +253,12 @@ MathAtom createMathInset(string const & s)
|
||||
return MathAtom(new MathSpaceInset(l->name));
|
||||
if (inset == "dots")
|
||||
return MathAtom(new MathDotsInset(l));
|
||||
if (inset == "mbox")
|
||||
return MathAtom(new MathBoxInset(l->name));
|
||||
// if (inset == "mbox")
|
||||
// return MathAtom(new MathBoxInset(l->name));
|
||||
// if (inset == "parbox")
|
||||
// return MathAtom(new MathParboxInset);
|
||||
if (inset == "fbox")
|
||||
return MathAtom(new MathFboxInset(l));
|
||||
// if (inset == "fbox")
|
||||
// return MathAtom(new MathFboxInset(l));
|
||||
if (inset == "style")
|
||||
return MathAtom(new MathSizeInset(l));
|
||||
if (inset == "font")
|
||||
@ -275,6 +275,10 @@ MathAtom createMathInset(string const & s)
|
||||
if (s.size() == 3 && s[0] == '\\' && s[1] == '#'
|
||||
&& s[2] >= '1' && s[2] <= '9')
|
||||
return MathAtom(new MathMacroArgument(s[2] - '0'));
|
||||
if (s == "mbox")
|
||||
return MathAtom(new MathBoxInset("mbox"));
|
||||
if (s == "fbox")
|
||||
return MathAtom(new MathFboxInset());
|
||||
if (s == "framebox")
|
||||
return MathAtom(new MathFrameboxInset);
|
||||
if (s == "makebox")
|
||||
|
@ -16,13 +16,15 @@
|
||||
#include "math_parser.h"
|
||||
#include "math_streamstr.h"
|
||||
#include "LColor.h"
|
||||
|
||||
#include "support/std_ostream.h"
|
||||
#include "frontends/Painter.h"
|
||||
|
||||
using std::auto_ptr;
|
||||
|
||||
|
||||
MathFboxInset::MathFboxInset(latexkeys const * key)
|
||||
: MathNestInset(1), key_(key)
|
||||
MathFboxInset::MathFboxInset()
|
||||
: MathNestInset(1)
|
||||
{}
|
||||
|
||||
|
||||
@ -34,20 +36,14 @@ auto_ptr<InsetBase> MathFboxInset::clone() const
|
||||
|
||||
MathInset::mode_type MathFboxInset::currentMode() const
|
||||
{
|
||||
if (key_->name == "fbox")
|
||||
return TEXT_MODE;
|
||||
return MATH_MODE;
|
||||
return TEXT_MODE;
|
||||
}
|
||||
|
||||
|
||||
void MathFboxInset::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
{
|
||||
if (key_->name == "fbox") {
|
||||
FontSetChanger dummy(mi.base, "textnormal");
|
||||
cell(0).metrics(mi, dim);
|
||||
} else {
|
||||
cell(0).metrics(mi, dim);
|
||||
}
|
||||
FontSetChanger dummy(mi.base, "textnormal");
|
||||
cell(0).metrics(mi, dim);
|
||||
metricsMarkers(dim, 5); // 5 pixels margin
|
||||
dim_ = dim;
|
||||
}
|
||||
@ -57,23 +53,26 @@ void MathFboxInset::draw(PainterInfo & pi, int x, int y) const
|
||||
{
|
||||
pi.pain.rectangle(x + 1, y - dim_.ascent() + 1,
|
||||
dim_.width() - 2, dim_.height() - 2, LColor::foreground);
|
||||
if (key_->name == "fbox") {
|
||||
FontSetChanger dummy(pi.base, "textnormal");
|
||||
cell(0).draw(pi, x + 5, y);
|
||||
} else {
|
||||
cell(0).draw(pi, x + 5, y);
|
||||
}
|
||||
FontSetChanger dummy(pi.base, "textnormal");
|
||||
cell(0).draw(pi, x + 5, y);
|
||||
setPosCache(pi, x, y);
|
||||
}
|
||||
|
||||
|
||||
void MathFboxInset::write(WriteStream & os) const
|
||||
{
|
||||
os << '\\' << key_->name << '{' << cell(0) << '}';
|
||||
os << "\\fbox{" << cell(0) << '}';
|
||||
}
|
||||
|
||||
|
||||
void MathFboxInset::normalize(NormalStream & os) const
|
||||
{
|
||||
os << '[' << key_->name << ' ' << cell(0) << ']';
|
||||
os << "[fbox " << cell(0) << ']';
|
||||
}
|
||||
|
||||
|
||||
void MathFboxInset::infoize(std::ostream & os) const
|
||||
{
|
||||
os << "FBox: ";
|
||||
}
|
||||
|
||||
|
@ -21,9 +21,9 @@ class latexkeys;
|
||||
class MathFboxInset : public MathNestInset {
|
||||
public:
|
||||
///
|
||||
MathFboxInset(latexkeys const * key);
|
||||
MathFboxInset();
|
||||
///
|
||||
virtual std::auto_ptr<InsetBase> clone() const;
|
||||
std::auto_ptr<InsetBase> clone() const;
|
||||
///
|
||||
mode_type currentMode() const;
|
||||
///
|
||||
@ -34,9 +34,8 @@ public:
|
||||
void write(WriteStream & os) const;
|
||||
/// write normalized content
|
||||
void normalize(NormalStream & ns) const;
|
||||
private:
|
||||
///
|
||||
latexkeys const * key_;
|
||||
void infoize(std::ostream & os) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1178,6 +1178,7 @@ void Parser::parse1(MathGridInset & grid, unsigned flags,
|
||||
return;
|
||||
}
|
||||
|
||||
#if 0
|
||||
else if (l->inset == "parbox") {
|
||||
// read optional positioning and width
|
||||
string pos = parse_verbatim_option();
|
||||
@ -1187,6 +1188,7 @@ void Parser::parse1(MathGridInset & grid, unsigned flags,
|
||||
cell->back().nucleus()->asParboxInset()->setPosition(pos);
|
||||
cell->back().nucleus()->asParboxInset()->setWidth(width);
|
||||
}
|
||||
#endif
|
||||
|
||||
else {
|
||||
MathAtom at = createMathInset(t.cs());
|
||||
@ -1214,7 +1216,7 @@ void Parser::parse1(MathGridInset & grid, unsigned flags,
|
||||
//}
|
||||
for (MathInset::idx_type i = start; i < at->nargs(); ++i) {
|
||||
parse(at.nucleus()->cell(i), FLAG_ITEM, m);
|
||||
parse1(grid, FLAG_SKIPSPACE, mode, numbered);
|
||||
skipSpaces();
|
||||
}
|
||||
cell->push_back(at);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user