mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-05 13:26:21 +00:00
some consolidation
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21478 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
f09222007f
commit
8995e86584
@ -322,8 +322,6 @@ liblyxmathed_la_SOURCES = \
|
||||
mathed/InsetMathBoldSymbol.cpp \
|
||||
mathed/InsetMathBoldSymbol.h \
|
||||
mathed/InsetMathBox.cpp \
|
||||
mathed/InsetMathBoxed.cpp \
|
||||
mathed/InsetMathBoxed.h \
|
||||
mathed/InsetMathBox.h \
|
||||
mathed/InsetMathBrace.cpp \
|
||||
mathed/InsetMathBrace.h \
|
||||
@ -352,16 +350,12 @@ liblyxmathed_la_SOURCES = \
|
||||
mathed/InsetMathExFunc.h \
|
||||
mathed/InsetMathExInt.cpp \
|
||||
mathed/InsetMathExInt.h \
|
||||
mathed/InsetMathFBox.cpp \
|
||||
mathed/InsetMathFBox.h \
|
||||
mathed/InsetMathFont.cpp \
|
||||
mathed/InsetMathFont.h \
|
||||
mathed/InsetMathFontOld.cpp \
|
||||
mathed/InsetMathFontOld.h \
|
||||
mathed/InsetMathFrac.cpp \
|
||||
mathed/InsetMathFrac.h \
|
||||
mathed/InsetMathFrameBox.cpp \
|
||||
mathed/InsetMathFrameBox.h \
|
||||
mathed/InsetMathGrid.cpp \
|
||||
mathed/InsetMathGrid.h \
|
||||
mathed/InsetMath.h \
|
||||
@ -375,8 +369,6 @@ liblyxmathed_la_SOURCES = \
|
||||
mathed/InsetMathLim.h \
|
||||
mathed/MathMacro.cpp \
|
||||
mathed/MathMacro.h \
|
||||
mathed/InsetMathMakebox.cpp \
|
||||
mathed/InsetMathMakebox.h \
|
||||
mathed/InsetMathMatrix.cpp \
|
||||
mathed/InsetMathMatrix.h \
|
||||
mathed/InsetMathNest.cpp \
|
||||
@ -447,8 +439,6 @@ liblyxmathed_la_SOURCES = \
|
||||
mathed/MathSupport.h \
|
||||
mathed/TextPainter.cpp \
|
||||
mathed/TextPainter.h
|
||||
# mathed/InsetMathMBox.cpp
|
||||
# mathed/InsetMathMBox.h
|
||||
|
||||
############################### Insets ##############################
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author André Pönitz
|
||||
* \author Ling Li (InsetMathMakebox)
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
@ -12,26 +13,30 @@
|
||||
|
||||
#include "InsetMathBox.h"
|
||||
|
||||
#include "LaTeXFeatures.h"
|
||||
#include "MathData.h"
|
||||
#include "MathStream.h"
|
||||
#include "MathSupport.h"
|
||||
#include "MetricsInfo.h"
|
||||
|
||||
#include "frontends/Painter.h"
|
||||
|
||||
#include <ostream>
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// InsetMathBox
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
InsetMathBox::InsetMathBox(docstring const & name)
|
||||
: InsetMathNest(1), name_(name)
|
||||
{}
|
||||
|
||||
|
||||
Inset * InsetMathBox::clone() const
|
||||
{
|
||||
return new InsetMathBox(*this);
|
||||
}
|
||||
|
||||
|
||||
void InsetMathBox::write(WriteStream & os) const
|
||||
{
|
||||
os << '\\' << name_ << '{' << cell(0) << '}';
|
||||
@ -70,4 +75,255 @@ void InsetMathBox::infoize(odocstream & os) const
|
||||
}
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// InsetMathFBox
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
InsetMathFBox::InsetMathFBox()
|
||||
: InsetMathNest(1)
|
||||
{}
|
||||
|
||||
|
||||
void InsetMathFBox::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
{
|
||||
FontSetChanger dummy(mi.base, "textnormal");
|
||||
cell(0).metrics(mi, dim);
|
||||
metricsMarkers(dim, 3); // 1 pixel space, 1 frame, 1 space
|
||||
// Cache the inset dimension.
|
||||
setDimCache(mi, dim);
|
||||
}
|
||||
|
||||
|
||||
void InsetMathFBox::draw(PainterInfo & pi, int x, int y) const
|
||||
{
|
||||
Dimension const dim = dimension(*pi.base.bv);
|
||||
pi.pain.rectangle(x + 1, y - dim.ascent() + 1,
|
||||
dim.width() - 2, dim.height() - 2, Color_foreground);
|
||||
FontSetChanger dummy(pi.base, "textnormal");
|
||||
cell(0).draw(pi, x + 3, y);
|
||||
setPosCache(pi, x, y);
|
||||
}
|
||||
|
||||
|
||||
void InsetMathFBox::write(WriteStream & os) const
|
||||
{
|
||||
os << "\\fbox{" << cell(0) << '}';
|
||||
}
|
||||
|
||||
|
||||
void InsetMathFBox::normalize(NormalStream & os) const
|
||||
{
|
||||
os << "[fbox " << cell(0) << ']';
|
||||
}
|
||||
|
||||
|
||||
void InsetMathFBox::infoize(odocstream & os) const
|
||||
{
|
||||
os << "FBox: ";
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// InsetMathFrameBox
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
InsetMathFrameBox::InsetMathFrameBox()
|
||||
: InsetMathNest(3)
|
||||
{}
|
||||
|
||||
|
||||
void InsetMathFrameBox::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
{
|
||||
FontSetChanger dummy(mi.base, "textnormal");
|
||||
w_ = mathed_char_width(mi.base.font, '[');
|
||||
InsetMathNest::metrics(mi);
|
||||
dim = cell(0).dimension(*mi.base.bv);
|
||||
dim += cell(1).dimension(*mi.base.bv);
|
||||
dim += cell(2).dimension(*mi.base.bv);
|
||||
metricsMarkers(dim);
|
||||
// Cache the inset dimension.
|
||||
setDimCache(mi, dim);
|
||||
}
|
||||
|
||||
|
||||
void InsetMathFrameBox::draw(PainterInfo & pi, int x, int y) const
|
||||
{
|
||||
FontSetChanger dummy(pi.base, "textnormal");
|
||||
Dimension const dim = dimension(*pi.base.bv);
|
||||
pi.pain.rectangle(x + 1, y - dim.ascent() + 1,
|
||||
dim.width() - 2, dim.height() - 2, Color_foreground);
|
||||
x += 5;
|
||||
BufferView const & bv = *pi.base.bv;
|
||||
|
||||
drawStrBlack(pi, x, y, from_ascii("["));
|
||||
x += w_;
|
||||
cell(0).draw(pi, x, y);
|
||||
x += cell(0).dimension(bv).wid;
|
||||
drawStrBlack(pi, x, y, from_ascii("]"));
|
||||
x += w_ + 4;
|
||||
|
||||
drawStrBlack(pi, x, y, from_ascii("["));
|
||||
x += w_;
|
||||
cell(1).draw(pi, x, y);
|
||||
x += cell(1).dimension(bv).wid;
|
||||
drawStrBlack(pi, x, y, from_ascii("]"));
|
||||
x += w_ + 4;
|
||||
|
||||
cell(2).draw(pi, x, y);
|
||||
drawMarkers(pi, x, y);
|
||||
}
|
||||
|
||||
|
||||
void InsetMathFrameBox::write(WriteStream & os) const
|
||||
{
|
||||
os << "\\framebox";
|
||||
os << '[' << cell(0) << ']';
|
||||
if (cell(1).size())
|
||||
os << '[' << cell(1) << ']';
|
||||
os << '{' << cell(2) << '}';
|
||||
}
|
||||
|
||||
|
||||
void InsetMathFrameBox::normalize(NormalStream & os) const
|
||||
{
|
||||
os << "[framebox " << cell(0) << ' ' << cell(1) << ' ' << cell(2) << ']';
|
||||
}
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// InsetMathBoxed
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
InsetMathBoxed::InsetMathBoxed()
|
||||
: InsetMathNest(1)
|
||||
{}
|
||||
|
||||
|
||||
void InsetMathBoxed::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
{
|
||||
cell(0).metrics(mi, dim);
|
||||
metricsMarkers2(dim, 3); // 1 pixel space, 1 frame, 1 space
|
||||
// Cache the inset dimension.
|
||||
setDimCache(mi, dim);
|
||||
}
|
||||
|
||||
|
||||
void InsetMathBoxed::draw(PainterInfo & pi, int x, int y) const
|
||||
{
|
||||
Dimension const dim = dimension(*pi.base.bv);
|
||||
pi.pain.rectangle(x + 1, y - dim.ascent() + 1,
|
||||
dim.width() - 2, dim.height() - 2, Color_foreground);
|
||||
cell(0).draw(pi, x + 3, y);
|
||||
setPosCache(pi, x, y);
|
||||
}
|
||||
|
||||
|
||||
void InsetMathBoxed::write(WriteStream & os) const
|
||||
{
|
||||
os << "\\boxed{" << cell(0) << '}';
|
||||
}
|
||||
|
||||
|
||||
void InsetMathBoxed::normalize(NormalStream & os) const
|
||||
{
|
||||
os << "[boxed " << cell(0) << ']';
|
||||
}
|
||||
|
||||
|
||||
void InsetMathBoxed::infoize(odocstream & os) const
|
||||
{
|
||||
os << "Boxed: ";
|
||||
}
|
||||
|
||||
|
||||
void InsetMathBoxed::validate(LaTeXFeatures & features) const
|
||||
{
|
||||
features.require("amsmath");
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// InsetMathMakebox
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
InsetMathMakebox::InsetMathMakebox()
|
||||
: InsetMathNest(3)
|
||||
{}
|
||||
|
||||
|
||||
void InsetMathMakebox::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
{
|
||||
FontSetChanger dummy(mi.base, from_ascii("textnormal"));
|
||||
w_ = mathed_char_width(mi.base.font, '[');
|
||||
InsetMathNest::metrics(mi);
|
||||
dim = cell(0).dimension(*mi.base.bv);
|
||||
dim += cell(1).dimension(*mi.base.bv);
|
||||
dim += cell(2).dimension(*mi.base.bv);
|
||||
dim.wid += 4 * w_ + 4;
|
||||
metricsMarkers(dim);
|
||||
// Cache the inset dimension.
|
||||
setDimCache(mi, dim);
|
||||
}
|
||||
|
||||
|
||||
void InsetMathMakebox::draw(PainterInfo & pi, int x, int y) const
|
||||
{
|
||||
FontSetChanger dummy(pi.base, from_ascii("textnormal"));
|
||||
drawMarkers(pi, x, y);
|
||||
|
||||
drawStrBlack(pi, x, y, from_ascii("["));
|
||||
x += w_;
|
||||
cell(0).draw(pi, x, y);
|
||||
x += cell(0).dimension(*pi.base.bv).width();
|
||||
drawStrBlack(pi, x, y, from_ascii("]"));
|
||||
x += w_ + 2;
|
||||
|
||||
drawStrBlack(pi, x, y, from_ascii("["));
|
||||
x += w_;
|
||||
cell(1).draw(pi, x, y);
|
||||
x += cell(1).dimension(*pi.base.bv).wid;
|
||||
drawStrBlack(pi, x, y, from_ascii("]"));
|
||||
x += w_ + 2;
|
||||
|
||||
cell(2).draw(pi, x, y);
|
||||
setPosCache(pi, x, y);
|
||||
}
|
||||
|
||||
|
||||
void InsetMathMakebox::write(WriteStream & os) const
|
||||
{
|
||||
os << "\\makebox";
|
||||
os << '[' << cell(0) << ']';
|
||||
if (cell(1).size())
|
||||
os << '[' << cell(1) << ']';
|
||||
os << '{' << cell(2) << '}';
|
||||
}
|
||||
|
||||
|
||||
void InsetMathMakebox::normalize(NormalStream & os) const
|
||||
{
|
||||
os << "[makebox " << cell(0) << ' ' << cell(1) << ' ' << cell(2) << ']';
|
||||
}
|
||||
|
||||
|
||||
void InsetMathMakebox::infoize(odocstream & os) const
|
||||
{
|
||||
os << "Makebox (width: " << cell(0)
|
||||
<< " pos: " << cell(1) << ")";
|
||||
}
|
||||
|
||||
|
||||
} // namespace lyx
|
||||
|
@ -19,11 +19,7 @@
|
||||
|
||||
namespace lyx {
|
||||
|
||||
|
||||
class Font;
|
||||
|
||||
/// Support for \\mbox
|
||||
|
||||
class InsetMathBox : public InsetMathNest {
|
||||
public:
|
||||
///
|
||||
@ -42,13 +38,105 @@ public:
|
||||
void infoize(odocstream & os) const;
|
||||
|
||||
private:
|
||||
virtual Inset * clone() const;
|
||||
Inset * clone() const { return new InsetMathBox(*this); }
|
||||
///
|
||||
docstring name_;
|
||||
};
|
||||
|
||||
|
||||
/// Non-AMS-style frame
|
||||
class InsetMathFBox : public InsetMathNest {
|
||||
public:
|
||||
///
|
||||
InsetMathFBox();
|
||||
///
|
||||
mode_type currentMode() const { return TEXT_MODE; }
|
||||
///
|
||||
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||
///
|
||||
void draw(PainterInfo & pi, int x, int y) const;
|
||||
///
|
||||
void write(WriteStream & os) const;
|
||||
/// write normalized content
|
||||
void normalize(NormalStream & ns) const;
|
||||
///
|
||||
void infoize(odocstream & os) const;
|
||||
private:
|
||||
///
|
||||
Inset * clone() const { return new InsetMathFBox(*this); }
|
||||
};
|
||||
|
||||
|
||||
/// Extra nesting
|
||||
class InsetMathFrameBox : public InsetMathNest {
|
||||
public:
|
||||
///
|
||||
InsetMathFrameBox();
|
||||
///
|
||||
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||
///
|
||||
void draw(PainterInfo & pi, int x, int y) const;
|
||||
///
|
||||
void write(WriteStream & os) const;
|
||||
/// write normalized content
|
||||
void normalize(NormalStream & ns) const;
|
||||
///
|
||||
mode_type currentMode() const { return TEXT_MODE; }
|
||||
private:
|
||||
Inset * clone() const { return new InsetMathFrameBox(*this); }
|
||||
/// width of '[' in current font
|
||||
mutable int w_;
|
||||
};
|
||||
|
||||
|
||||
/// Extra nesting: \\makebox.
|
||||
// consolidate with InsetMathFrameBox?
|
||||
class InsetMathMakebox : public InsetMathNest {
|
||||
public:
|
||||
///
|
||||
InsetMathMakebox();
|
||||
///
|
||||
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||
///
|
||||
void draw(PainterInfo & pi, int x, int y) const;
|
||||
///
|
||||
void write(WriteStream & os) const;
|
||||
/// write normalized content
|
||||
void normalize(NormalStream & ns) const;
|
||||
///
|
||||
mode_type currentMode() const { return TEXT_MODE; }
|
||||
///
|
||||
void infoize(odocstream & os) const;
|
||||
private:
|
||||
Inset * clone() const { return new InsetMathMakebox(*this); }
|
||||
/// width of '[' in current font
|
||||
mutable int w_;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/// AMS-style frame
|
||||
class InsetMathBoxed : public InsetMathNest {
|
||||
public:
|
||||
///
|
||||
InsetMathBoxed();
|
||||
///
|
||||
void validate(LaTeXFeatures & features) const;
|
||||
///
|
||||
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||
///
|
||||
void draw(PainterInfo & pi, int x, int y) const;
|
||||
///
|
||||
void write(WriteStream & os) const;
|
||||
/// write normalized content
|
||||
void normalize(NormalStream & ns) const;
|
||||
///
|
||||
void infoize(odocstream & os) const;
|
||||
private:
|
||||
Inset * clone() const { return new InsetMathBoxed(*this); }
|
||||
};
|
||||
|
||||
|
||||
} // namespace lyx
|
||||
|
||||
#endif
|
||||
#endif // MATH_MBOX
|
||||
|
@ -1,81 +0,0 @@
|
||||
/**
|
||||
* \file InsetMathBoxed.cpp
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author André Pönitz
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "InsetMathBoxed.h"
|
||||
|
||||
#include "LaTeXFeatures.h"
|
||||
#include "MathData.h"
|
||||
#include "MathStream.h"
|
||||
#include "MetricsInfo.h"
|
||||
|
||||
#include "frontends/Painter.h"
|
||||
|
||||
#include <ostream>
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
InsetMathBoxed::InsetMathBoxed()
|
||||
: InsetMathNest(1)
|
||||
{}
|
||||
|
||||
|
||||
Inset * InsetMathBoxed::clone() const
|
||||
{
|
||||
return new InsetMathBoxed(*this);
|
||||
}
|
||||
|
||||
|
||||
void InsetMathBoxed::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
{
|
||||
cell(0).metrics(mi, dim);
|
||||
metricsMarkers2(dim, 3); // 1 pixel space, 1 frame, 1 space
|
||||
// Cache the inset dimension.
|
||||
setDimCache(mi, dim);
|
||||
}
|
||||
|
||||
|
||||
void InsetMathBoxed::draw(PainterInfo & pi, int x, int y) const
|
||||
{
|
||||
Dimension const dim = dimension(*pi.base.bv);
|
||||
pi.pain.rectangle(x + 1, y - dim.ascent() + 1,
|
||||
dim.width() - 2, dim.height() - 2, Color_foreground);
|
||||
cell(0).draw(pi, x + 3, y);
|
||||
setPosCache(pi, x, y);
|
||||
}
|
||||
|
||||
|
||||
void InsetMathBoxed::write(WriteStream & os) const
|
||||
{
|
||||
os << "\\boxed{" << cell(0) << '}';
|
||||
}
|
||||
|
||||
|
||||
void InsetMathBoxed::normalize(NormalStream & os) const
|
||||
{
|
||||
os << "[boxed " << cell(0) << ']';
|
||||
}
|
||||
|
||||
|
||||
void InsetMathBoxed::infoize(odocstream & os) const
|
||||
{
|
||||
os << "Boxed: ";
|
||||
}
|
||||
|
||||
|
||||
void InsetMathBoxed::validate(LaTeXFeatures & features) const
|
||||
{
|
||||
features.require("amsmath");
|
||||
}
|
||||
|
||||
|
||||
} // namespace lyx
|
@ -1,45 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file InsetMathBoxed.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author André Pönitz
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef MATH_BOXEDINSET_H
|
||||
#define MATH_BOXEDINSET_H
|
||||
|
||||
#include "InsetMathNest.h"
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
|
||||
/// Non-AMS-style frame
|
||||
class InsetMathBoxed : public InsetMathNest {
|
||||
public:
|
||||
///
|
||||
InsetMathBoxed();
|
||||
///
|
||||
void validate(LaTeXFeatures & features) const;
|
||||
///
|
||||
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||
///
|
||||
void draw(PainterInfo & pi, int x, int y) const;
|
||||
///
|
||||
void write(WriteStream & os) const;
|
||||
/// write normalized content
|
||||
void normalize(NormalStream & ns) const;
|
||||
///
|
||||
void infoize(odocstream & os) const;
|
||||
private:
|
||||
virtual Inset * clone() const;
|
||||
};
|
||||
|
||||
|
||||
} // namespace lyx
|
||||
|
||||
#endif
|
@ -1,82 +0,0 @@
|
||||
/**
|
||||
* \file InsetMathFBox.cpp
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author André Pönitz
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "InsetMathFBox.h"
|
||||
|
||||
#include "MathData.h"
|
||||
#include "MathStream.h"
|
||||
#include "MetricsInfo.h"
|
||||
|
||||
#include "frontends/Painter.h"
|
||||
|
||||
#include <ostream>
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
InsetMathFBox::InsetMathFBox()
|
||||
: InsetMathNest(1)
|
||||
{}
|
||||
|
||||
|
||||
Inset * InsetMathFBox::clone() const
|
||||
{
|
||||
return new InsetMathFBox(*this);
|
||||
}
|
||||
|
||||
|
||||
InsetMath::mode_type InsetMathFBox::currentMode() const
|
||||
{
|
||||
return TEXT_MODE;
|
||||
}
|
||||
|
||||
|
||||
void InsetMathFBox::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
{
|
||||
FontSetChanger dummy(mi.base, "textnormal");
|
||||
cell(0).metrics(mi, dim);
|
||||
metricsMarkers(dim, 3); // 1 pixel space, 1 frame, 1 space
|
||||
// Cache the inset dimension.
|
||||
setDimCache(mi, dim);
|
||||
}
|
||||
|
||||
|
||||
void InsetMathFBox::draw(PainterInfo & pi, int x, int y) const
|
||||
{
|
||||
Dimension const dim = dimension(*pi.base.bv);
|
||||
pi.pain.rectangle(x + 1, y - dim.ascent() + 1,
|
||||
dim.width() - 2, dim.height() - 2, Color_foreground);
|
||||
FontSetChanger dummy(pi.base, "textnormal");
|
||||
cell(0).draw(pi, x + 3, y);
|
||||
setPosCache(pi, x, y);
|
||||
}
|
||||
|
||||
|
||||
void InsetMathFBox::write(WriteStream & os) const
|
||||
{
|
||||
os << "\\fbox{" << cell(0) << '}';
|
||||
}
|
||||
|
||||
|
||||
void InsetMathFBox::normalize(NormalStream & os) const
|
||||
{
|
||||
os << "[fbox " << cell(0) << ']';
|
||||
}
|
||||
|
||||
|
||||
void InsetMathFBox::infoize(odocstream & os) const
|
||||
{
|
||||
os << "FBox: ";
|
||||
}
|
||||
|
||||
|
||||
} // namespace lyx
|
@ -1,45 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file InsetMathFBox.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author André Pönitz
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef MATH_FBOXINSET_H
|
||||
#define MATH_FBOXINSET_H
|
||||
|
||||
#include "InsetMathNest.h"
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
|
||||
/// Non-AMS-style frame
|
||||
class InsetMathFBox : public InsetMathNest {
|
||||
public:
|
||||
///
|
||||
InsetMathFBox();
|
||||
///
|
||||
mode_type currentMode() const;
|
||||
///
|
||||
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||
///
|
||||
void draw(PainterInfo & pi, int x, int y) const;
|
||||
///
|
||||
void write(WriteStream & os) const;
|
||||
/// write normalized content
|
||||
void normalize(NormalStream & ns) const;
|
||||
///
|
||||
void infoize(odocstream & os) const;
|
||||
private:
|
||||
virtual Inset * clone() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
} // namespace lyx
|
||||
#endif
|
@ -1,94 +0,0 @@
|
||||
/**
|
||||
* \file InsetMathFrameBox.cpp
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author André Pönitz
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "InsetMathFrameBox.h"
|
||||
|
||||
#include "MathData.h"
|
||||
#include "MathStream.h"
|
||||
#include "MathSupport.h"
|
||||
#include "MetricsInfo.h"
|
||||
|
||||
#include "frontends/Painter.h"
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
InsetMathFrameBox::InsetMathFrameBox()
|
||||
: InsetMathNest(3)
|
||||
{}
|
||||
|
||||
|
||||
Inset * InsetMathFrameBox::clone() const
|
||||
{
|
||||
return new InsetMathFrameBox(*this);
|
||||
}
|
||||
|
||||
|
||||
void InsetMathFrameBox::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
{
|
||||
FontSetChanger dummy(mi.base, "textnormal");
|
||||
w_ = mathed_char_width(mi.base.font, '[');
|
||||
InsetMathNest::metrics(mi);
|
||||
dim = cell(0).dimension(*mi.base.bv);
|
||||
dim += cell(1).dimension(*mi.base.bv);
|
||||
dim += cell(2).dimension(*mi.base.bv);
|
||||
metricsMarkers(dim);
|
||||
// Cache the inset dimension.
|
||||
setDimCache(mi, dim);
|
||||
}
|
||||
|
||||
|
||||
void InsetMathFrameBox::draw(PainterInfo & pi, int x, int y) const
|
||||
{
|
||||
FontSetChanger dummy(pi.base, "textnormal");
|
||||
Dimension const dim = dimension(*pi.base.bv);
|
||||
pi.pain.rectangle(x + 1, y - dim.ascent() + 1,
|
||||
dim.width() - 2, dim.height() - 2, Color_foreground);
|
||||
x += 5;
|
||||
BufferView const & bv = *pi.base.bv;
|
||||
|
||||
drawStrBlack(pi, x, y, from_ascii("["));
|
||||
x += w_;
|
||||
cell(0).draw(pi, x, y);
|
||||
x += cell(0).dimension(bv).wid;
|
||||
drawStrBlack(pi, x, y, from_ascii("]"));
|
||||
x += w_ + 4;
|
||||
|
||||
drawStrBlack(pi, x, y, from_ascii("["));
|
||||
x += w_;
|
||||
cell(1).draw(pi, x, y);
|
||||
x += cell(1).dimension(bv).wid;
|
||||
drawStrBlack(pi, x, y, from_ascii("]"));
|
||||
x += w_ + 4;
|
||||
|
||||
cell(2).draw(pi, x, y);
|
||||
drawMarkers(pi, x, y);
|
||||
}
|
||||
|
||||
|
||||
void InsetMathFrameBox::write(WriteStream & os) const
|
||||
{
|
||||
os << "\\framebox";
|
||||
os << '[' << cell(0) << ']';
|
||||
if (cell(1).size())
|
||||
os << '[' << cell(1) << ']';
|
||||
os << '{' << cell(2) << '}';
|
||||
}
|
||||
|
||||
|
||||
void InsetMathFrameBox::normalize(NormalStream & os) const
|
||||
{
|
||||
os << "[framebox " << cell(0) << ' ' << cell(1) << ' ' << cell(2) << ']';
|
||||
}
|
||||
|
||||
|
||||
} // namespace lyx
|
@ -1,45 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file InsetMathFrameBox.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author André Pönitz
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef MATH_FRAMEBOXINSET_H
|
||||
#define MATH_FRAMEBOXINSET_H
|
||||
|
||||
#include "InsetMathNest.h"
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
|
||||
/// Extra nesting
|
||||
class InsetMathFrameBox : public InsetMathNest {
|
||||
public:
|
||||
///
|
||||
InsetMathFrameBox();
|
||||
///
|
||||
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||
///
|
||||
void draw(PainterInfo & pi, int x, int y) const;
|
||||
///
|
||||
void write(WriteStream & os) const;
|
||||
/// write normalized content
|
||||
void normalize(NormalStream & ns) const;
|
||||
///
|
||||
mode_type currentMode() const { return TEXT_MODE; }
|
||||
private:
|
||||
virtual Inset * clone() const;
|
||||
/// width of '[' in current font
|
||||
mutable int w_;
|
||||
};
|
||||
|
||||
|
||||
|
||||
} // namespace lyx
|
||||
#endif
|
@ -1,96 +0,0 @@
|
||||
/**
|
||||
* \file InsetMathMakebox.cpp
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Ling Li
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "InsetMathMakebox.h"
|
||||
#include "MathData.h"
|
||||
#include "MathStream.h"
|
||||
#include "MathSupport.h"
|
||||
|
||||
#include "support/std_ostream.h"
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
InsetMathMakebox::InsetMathMakebox()
|
||||
: InsetMathNest(3)
|
||||
{}
|
||||
|
||||
|
||||
Inset * InsetMathMakebox::clone() const
|
||||
{
|
||||
return new InsetMathMakebox(*this);
|
||||
}
|
||||
|
||||
|
||||
void InsetMathMakebox::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
{
|
||||
FontSetChanger dummy(mi.base, from_ascii("textnormal"));
|
||||
w_ = mathed_char_width(mi.base.font, '[');
|
||||
InsetMathNest::metrics(mi);
|
||||
dim = cell(0).dimension(*mi.base.bv);
|
||||
dim += cell(1).dimension(*mi.base.bv);
|
||||
dim += cell(2).dimension(*mi.base.bv);
|
||||
dim.wid += 4 * w_ + 4;
|
||||
metricsMarkers(dim);
|
||||
// Cache the inset dimension.
|
||||
setDimCache(mi, dim);
|
||||
}
|
||||
|
||||
|
||||
void InsetMathMakebox::draw(PainterInfo & pi, int x, int y) const
|
||||
{
|
||||
FontSetChanger dummy(pi.base, from_ascii("textnormal"));
|
||||
drawMarkers(pi, x, y);
|
||||
|
||||
drawStrBlack(pi, x, y, from_ascii("["));
|
||||
x += w_;
|
||||
cell(0).draw(pi, x, y);
|
||||
x += cell(0).dimension(*pi.base.bv).width();
|
||||
drawStrBlack(pi, x, y, from_ascii("]"));
|
||||
x += w_ + 2;
|
||||
|
||||
drawStrBlack(pi, x, y, from_ascii("["));
|
||||
x += w_;
|
||||
cell(1).draw(pi, x, y);
|
||||
x += cell(1).dimension(*pi.base.bv).wid;
|
||||
drawStrBlack(pi, x, y, from_ascii("]"));
|
||||
x += w_ + 2;
|
||||
|
||||
cell(2).draw(pi, x, y);
|
||||
setPosCache(pi, x, y);
|
||||
}
|
||||
|
||||
|
||||
void InsetMathMakebox::write(WriteStream & os) const
|
||||
{
|
||||
os << "\\makebox";
|
||||
os << '[' << cell(0) << ']';
|
||||
if (cell(1).size())
|
||||
os << '[' << cell(1) << ']';
|
||||
os << '{' << cell(2) << '}';
|
||||
}
|
||||
|
||||
|
||||
void InsetMathMakebox::normalize(NormalStream & os) const
|
||||
{
|
||||
os << "[makebox " << cell(0) << ' ' << cell(1) << ' ' << cell(2) << ']';
|
||||
}
|
||||
|
||||
|
||||
void InsetMathMakebox::infoize(odocstream & os) const
|
||||
{
|
||||
os << "Makebox (width: " << cell(0)
|
||||
<< " pos: " << cell(1) << ")";
|
||||
}
|
||||
|
||||
|
||||
} // namespace lyx
|
@ -1,48 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file InsetMathMakebox.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Ling Li
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef MATH_MAKEBOXINSET_H
|
||||
#define MATH_MAKEBOXINSET_H
|
||||
|
||||
#include "InsetMathNest.h"
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
/// Extra nesting: \\makebox.
|
||||
// consolidate with InsetMathFrameBox?
|
||||
|
||||
class InsetMathMakebox : public InsetMathNest {
|
||||
public:
|
||||
///
|
||||
InsetMathMakebox();
|
||||
///
|
||||
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||
///
|
||||
void draw(PainterInfo & pi, int x, int y) const;
|
||||
///
|
||||
void write(WriteStream & os) const;
|
||||
/// write normalized content
|
||||
void normalize(NormalStream & ns) const;
|
||||
///
|
||||
mode_type currentMode() const { return TEXT_MODE; }
|
||||
///
|
||||
void infoize(odocstream & os) const;
|
||||
private:
|
||||
virtual Inset * clone() const;
|
||||
/// width of '[' in current font
|
||||
mutable int w_;
|
||||
};
|
||||
|
||||
|
||||
|
||||
} // namespace lyx
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user