#include "math_support.h"
#include "debug.h"
#include "Painter.h"
+#include "textpainter.h"
+#include "Lsstream.h"
#include "LaTeXFeatures.h"
#include "support/LAssert.h"
if (s == "multline") return LM_OT_MULTLINE;
if (s == "gather") return LM_OT_GATHER;
return LM_OT_SIMPLE;
- }
+ }
string normalName(MathInsetTypes t)
default: break;
}
return "unknown";
- }
+ }
} // end anon namespace
if (display()) {
ascent_ += 12;
descent_ += 12;
- }
+ }
if (numberedType()) {
+ whichFont(mi_.font, LM_TC_BF, mi_);
int l = 0;
for (row_type row = 0; row < nrows(); ++row)
- l = max(l, mathed_string_width(LM_TC_BF, mi_, nicelabel(row)));
+ l = max(l, mathed_string_width(mi_.font, nicelabel(row)));
if (l)
width_ += 30 + l;
// make it at least as high as the current font
int asc = 0;
int des = 0;
- math_font_max_dim(LM_TC_TEXTRM, mi_, asc, des);
+ math_font_max_dim(mi_.font, asc, des);
ascent_ = max(ascent_, asc);
descent_ = max(descent_, des);
}
int const xx = x + colinfo_.back().offset_ + colinfo_.back().width_ + 20;
for (row_type row = 0; row < nrows(); ++row) {
int const yy = y + rowinfo_[row].offset_;
- drawStr(pain, LM_TC_BF, mi_, xx, yy, nicelabel(row));
+ drawStr(pain, mi_.font, xx, yy, nicelabel(row));
}
}
}
-void MathHullInset::metrics(TextMetricsInfo const & mi) const
+void MathHullInset::metricsT(TextMetricsInfo const &) const
{
- ascent_ = 1;
- descent_ = 0;
- width_ = normalName(objtype_).size();
+#if 0
+ if (display()) {
+ MathGridInset::metricsT(mi);
+ } else
+#endif
+ {
+ ostringstream os;
+ WriteStream wi(os, false, true);
+ write(wi);
+ width_ = os.str().size();
+ ascent_ = 1;
+ descent_ = 0;
+ }
}
-void MathHullInset::draw(TextPainter & pain, int x, int y) const
+void MathHullInset::drawT(TextPainter & pain, int x, int y) const
{
- pain.draw(x, y, normalName(objtype_).c_str());
+#if 0
+ if (display()) {
+ MathGridInset::drawT(pain, x, y);
+ } else
+#endif
+ {
+ ostringstream os;
+ WriteStream wi(os, false, true);
+ write(wi);
+ pain.draw(x, y, os.str().c_str());
+ }
}
void MathHullInset::label(row_type row, string const & label)
{
- label_[row] = label;
+ label_[row] = label;
}
void MathHullInset::numbered(row_type row, bool num)
{
- nonum_[row] = !num;
+ nonum_[row] = !num;
}
{
return true;
/*
- return
+ return
objtype_ == LM_OT_ALIGN ||
objtype_ == LM_OT_MULTLINE ||
objtype_ == LM_OT_GATHER ||
case LM_OT_EQUATION:
if (n)
- os << "\\begin{equation" << star(n) << "}\n";
+ os << "\\begin{equation" << star(n) << "}\n";
else
- os << "\\[\n";
+ os << "\\[\n";
break;
case LM_OT_EQNARRAY:
break;
case LM_OT_XXALIGNAT:
- os << "\\begin{xxalignat}"
+ os << "\\begin{xxalignat}"
<< "{" << static_cast<unsigned int>(ncols()/2) << "}\n";
break;
case LM_OT_EQUATION:
if (n)
- os << "\\end{equation" << star(n) << "}\n";
+ os << "\\end{equation" << star(n) << "}\n";
else
- os << "\\]\n";
+ os << "\\]\n";
break;
case LM_OT_EQNARRAY:
}
-void MathHullInset::addRow(row_type row)
+void MathHullInset::addRow(row_type row)
{
nonum_.insert(nonum_.begin() + row + 1, !numberedType());
label_.insert(label_.begin() + row + 1, string());
}
-void MathHullInset::delRow(row_type row)
+void MathHullInset::delRow(row_type row)
{
MathGridInset::delRow(row);
nonum_.erase(nonum_.begin() + row);
setType(LM_OT_SIMPLE);
break;
- case LM_OT_ALIGN:
+ case LM_OT_ALIGN:
case LM_OT_ALIGNAT:
case LM_OT_XALIGNAT:
case LM_OT_XXALIGNAT: {
MathGridInset::addCol(1);
// split it "nicely"
- pos_type pos = firstRelOp(cell(0));
+ pos_type pos = firstRelOp(cell(0));
cell(1) = cell(0);
cell(0).erase(pos, cell(0).size());
cell(1).erase(0, pos);
MathGridInset::addCol(1);
// split it "nicely" on the firest relop
- pos_type pos = firstRelOp(cell(0));
+ pos_type pos = firstRelOp(cell(0));
cell(1) = MathArray(cell(0), pos, cell(0).size());
cell(0).erase(pos, cell(0).size());
setType(LM_OT_EQNARRAY);
mutate(newtype);
break;
-
+
case LM_OT_ALIGNAT:
case LM_OT_XALIGNAT:
case LM_OT_XXALIGNAT:
void MathHullInset::write(WriteStream & os) const
{
header_write(os);
-
+
bool n = numberedType();
-
+
for (row_type row = 0; row < nrows(); ++row) {
- for (col_type col = 0; col < ncols(); ++col)
+ for (col_type col = 0; col < ncols(); ++col)
os << cell(index(row, col)) << eocString(col);
if (n) {
if (!label_[row].empty())
}
os << eolString(row);
}
-
+
footer_write(os);
}
lyx::Assert(nonum_.size() == nrows());
lyx::Assert(label_.size() == nrows());
}
-
-