if (old_format)
return;
- lex.nextToken();
+ lex.next();
string token = lex.getString();
while (lex.isOK() && (token != "\\end_inset")) {
- lex.nextToken();
+ lex.next();
token = lex.getString();
}
if (token != "\\end_inset") {
++cell;
Dimension dim;
MetricsInfo m = mi;
- m.base.textwidth =
- tabular.column_info[j].p_width.inPixels(mi.base.textwidth);
+ LyXLength p_width = tabular.column_info[j].p_width;
+ if (!p_width.zero()) {
+ m.base.textwidth = p_width.inPixels(mi.base.textwidth);
+ }
tabular.getCellInset(cell).metrics(m, dim);
maxAsc = max(maxAsc, dim.asc);
maxDesc = max(maxDesc, dim.des);
for (int i = 0; i < tabular.rows(); ++i) {
int nx = x;
idx = tabular.getCellNumber(i, 0);
- if (y + tabular.getDescentOfRow(i) <= 0 &&
- y - tabular.getAscentOfRow(i) < pi.pain.paperHeight())
- {
- y += tabular.getDescentOfRow(i) +
- tabular.getAscentOfRow(i + 1) +
- tabular.getAdditionalHeight(i + 1);
+ if (y + tabular.getDescentOfRow(i) <= 0
+ && y - tabular.getAscentOfRow(i) < pi.pain.paperHeight()) {
+ y += tabular.getDescentOfRow(i)
+ + tabular.getAscentOfRow(i + 1)
+ + tabular.getAdditionalHeight(i + 1);
continue;
}
for (int j = 0; j < tabular.columns(); ++j) {
lyxerr << "InsetTabular::edit: " << this << endl;
finishUndo();
int cell;
+ cur.push(*this);
if (left) {
if (isRightToLeft(cur))
cell = tabular.getLastCellInRow(0);
// this accesses the position cache before it is initialized
//resetPos(cur);
//cur.bv().fitCursor();
- cur.push(*this);
cur.idx() = cell;
}
case LFUN_MOUSE_MOTION:
lyxerr << "# InsetTabular::MouseMotion\n" << bvcur << endl;
- if (cmd.button() != mouse_button::button1) {
+ if (cmd.button() == mouse_button::button1) {
// only accept motions to places not deeper nested than the real anchor
if (bvcur.anchor_.hasPart(cur)) {
setPos(cur, cmd.x, cmd.y);
bvcur.setCursor(cur);
+ bvcur.selection() = true;
}
}
break;
int InsetTabular::plaintext(Buffer const & buf, ostream & os,
OutputParams const & runparams) const
{
- int dp = runparams.linelen ? ownerPar(buf, this).params().depth() : 0;
+ int dp = runparams.linelen ? runparams.depth : 0;
return tabular.plaintext(buf, os, runparams, dp, false, 0);
}
InsetBase * InsetTabular::setPos(LCursor & cur, int x, int y) const
{
+ lyxerr << "# InsetTabular::setPos() x=" << x << " y=" << y << endl;
int idx_min = 0;
int dist_min = 1000000;
for (idx_type i = 0; i < nargs(); ++i) {
}
-bool InsetTabular::isRightToLeft(LCursor & cur)
+bool InsetTabular::isRightToLeft(LCursor & cur) const
{
- return cur.bv().getParentLanguage(this)->RightToLeft();
+ BOOST_ASSERT(cur.size() > 1);
+ Paragraph const & parentpar = cur[cur.size() - 2].paragraph();
+ LCursor::pos_type const parentpos = cur[cur.size() - 2].pos();
+ return parentpar.getFontSettings(cur.bv().buffer()->params(),
+ parentpos).language()->RightToLeft();
}
// we can only set this if we are not too far right
if (cols < columns) {
InsetText & inset = loctab->getCellInset(cell);
- LyXFont const font = inset.text_.getFont(0, 0);
+ Paragraph & par = inset.text_.getPar(0);
+ LyXFont const font = inset.text_.getFont(par, 0);
inset.setText(buf.substr(op, p - op), font);
++cols;
++cell;
// we can only set this if we are not too far right
if (cols < columns) {
InsetText & inset = tabular.getCellInset(cell);
- LyXFont const font = inset.text_.getFont(0, 0);
+ Paragraph & par = inset.text_.getPar(0);
+ LyXFont const font = inset.text_.getFont(par, 0);
inset.setText(buf.substr(op, p - op), font);
}
cols = ocol;
// check for the last cell if there is no trailing '\n'
if (cell < cells && op < len) {
InsetText & inset = loctab->getCellInset(cell);
- LyXFont const font = inset.text_.getFont(0, 0);
+ Paragraph & par = inset.text_.getPar(0);
+ LyXFont const font = inset.text_.getFont(par, 0);
inset.setText(buf.substr(op, len - op), font);
}
return true;