}
-MathMatrixInset::MathMatrixInset(MathInsetTypes t, unsigned int cols)
+MathMatrixInset::MathMatrixInset(MathInsetTypes t, col_type cols)
: MathGridInset(cols, 1), objtype_(t), nonum_(1), label_(1)
{
setDefaults();
}
-char MathMatrixInset::defaultColAlign(unsigned int col)
+char MathMatrixInset::defaultColAlign(col_type col)
{
switch (getType()) {
case LM_OT_ALIGN:
}
-int MathMatrixInset::defaultColSpace(unsigned int col)
+int MathMatrixInset::defaultColSpace(col_type col)
{
switch (getType()) {
case LM_OT_ALIGN:
if (numberedType()) {
int l = 0;
- for (unsigned int row = 0; row < nrows(); ++row)
+ for (row_type row = 0; row < nrows(); ++row)
l = std::max(l, mathed_string_width(LM_TC_BF, size(), nicelabel(row)));
if (l)
if (numberedType()) {
int xx = x + colinfo_.back().offset_ + colinfo_.back().width_ + 20;
- for (unsigned int row = 0; row < nrows(); ++row) {
+ for (row_type row = 0; row < nrows(); ++row) {
int yy = y + rowinfo_[row].offset_;
drawStr(pain, LM_TC_BF, size(), xx, yy, nicelabel(row));
}
bool n = numberedType();
- for (unsigned int row = 0; row < nrows(); ++row) {
- for (unsigned int col = 0; col < ncols(); ++col) {
+ for (row_type row = 0; row < nrows(); ++row) {
+ for (col_type col = 0; col < ncols(); ++col) {
cell(index(row, col)).write(os, fragile);
os << eocString(col);
}
}
-string MathMatrixInset::label(unsigned int row) const
+string MathMatrixInset::label(row_type row) const
{
return label_[row];
}
-void MathMatrixInset::label(unsigned int row, string const & label)
+void MathMatrixInset::label(row_type row, string const & label)
{
label_[row] = label;
}
-void MathMatrixInset::numbered(unsigned int row, bool num)
+void MathMatrixInset::numbered(row_type row, bool num)
{
nonum_[row] = !num;
}
-bool MathMatrixInset::numbered(unsigned int row) const
+bool MathMatrixInset::numbered(row_type row) const
{
return !nonum_[row];
}
std::vector<string> const MathMatrixInset::getLabelList() const
{
std::vector<string> res;
- for (unsigned int row = 0; row < nrows(); ++row)
+ for (row_type row = 0; row < nrows(); ++row)
if (!label_[row].empty() && nonum_[row] != 1)
res.push_back(label_[row]);
return res;
{
if (getType() == LM_OT_SIMPLE || getType() == LM_OT_XXALIGNAT)
return false;
- for (unsigned int row = 0; row < nrows(); ++row)
+ for (row_type row = 0; row < nrows(); ++row)
if (!nonum_[row])
return true;
return false;
}
-void MathMatrixInset::addRow(unsigned int row)
+void MathMatrixInset::addRow(row_type row)
{
nonum_.insert(nonum_.begin() + row + 1, !numberedType());
label_.insert(label_.begin() + row + 1, string());
}
-void MathMatrixInset::delRow(unsigned int row)
+void MathMatrixInset::delRow(row_type row)
{
MathGridInset::delRow(row);
nonum_.erase(nonum_.begin() + row);
}
-void MathMatrixInset::addCol(unsigned int col)
+void MathMatrixInset::addCol(col_type col)
{
switch (getType()) {
case LM_OT_EQUATION:
}
-void MathMatrixInset::delCol(unsigned int col)
+void MathMatrixInset::delCol(col_type col)
{
switch (getType()) {
case LM_OT_ALIGNAT:
}
-string MathMatrixInset::nicelabel(unsigned int row) const
+string MathMatrixInset::nicelabel(row_type row) const
{
if (nonum_[row])
return string();
void MathMatrixInset::glueall()
{
MathArray ar;
- for (unsigned int i = 0; i < nargs(); ++i)
+ for (idx_type i = 0; i < nargs(); ++i)
ar.push_back(cell(i));
*this = MathMatrixInset(LM_OT_SIMPLE);
cell(0) = ar;
MathGridInset::addCol(1);
// split it "nicely"
- unsigned int 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
- unsigned int 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);
case LM_OT_EQUATION: {
// set correct (no)numbering
bool allnonum = true;
- for (unsigned int row = 0; row < nrows(); ++row) {
+ for (row_type row = 0; row < nrows(); ++row) {
if (!nonum_[row])
allnonum = false;
}
// set first non-empty label
string label;
- for (unsigned int row = 0; row < nrows(); ++row) {
+ for (row_type row = 0; row < nrows(); ++row) {
if (!label_[row].empty()) {
label = label_[row];
break;
case LM_OT_XALIGNAT:
case LM_OT_XXALIGNAT:
default: {
- for (unsigned int row = 0; row < nrows(); ++row) {
- unsigned int c = 3 * row + 1;
+ for (row_type row = 0; row < nrows(); ++row) {
+ idx_type c = 3 * row + 1;
cell(c).push_back(cell(c + 1));
}
MathGridInset::delCol(2);