InsetTabular::InsetTabular(Buffer const & buf, int rows, int columns)
- : buffer(&buf)
+ : buffer_(&buf)
{
if (rows <= 0)
rows = 1;
}
-InsetTabular::InsetTabular(InsetTabular const & tab, Buffer const & buf)
- : UpdatableInset(tab), buffer(&buf)
+InsetTabular::InsetTabular(InsetTabular const & tab)
+ : UpdatableInset(tab), buffer_(tab.buffer_)
{
- tabular.reset(new LyXTabular(buf.params,
+ tabular.reset(new LyXTabular(buffer_->params,
this, *(tab.tabular)));
the_locking_inset = 0;
old_locking_inset = 0;
}
-Inset * InsetTabular::clone(Buffer const & buf) const
+Inset * InsetTabular::clone() const
{
- return new InsetTabular(*this, buf);
+ return new InsetTabular(*this);
}
BufferView * InsetTabular::view() const
{
- return buffer->getUser();
+ return buffer_->getUser();
+}
+
+
+void InsetTabular::buffer(Buffer * b)
+{
+ buffer_ = b;
}
}
-void InsetTabular::dimension(BufferView *, LyXFont const &,
+void InsetTabular::metrics(MetricsInfo &,
Dimension & dim) const
{
dim.asc = tabular->GetAscentOfRow(0);
++cell;
}
+// Would be nice, but for some completely unfathomable reason,
+// on a col resize to a new fixed width, even though the insettexts
+// are resized, the cell isn't, but drawing all cells in a tall table
+// has the desired effect somehow. Complete dark magic.
+#if 0
// avoiding drawing the rest of a long table is
// a pretty big speedup
if (y > bv->workHeight())
break;
+#endif
y += tabular->GetDescentOfRow(i) +
tabular->GetAscentOfRow(i + 1) +
bool const update = (tmplen != vallen);
tabular->SetColumnPWidth(actcell, vallen);
if (update) {
+ // We need this otherwise we won't resize
+ // the insettext of the active cell (if any)
+ // until later (see InsetText::do_resize)
+ unlockInsetInInset(bv, the_locking_inset);
+
int cell;
for (int i = 0; i < tabular->rows(); ++i) {
cell = tabular->GetCellNumber(i,column);
bool const update = (tmplen != vallen);
tabular->SetMColumnPWidth(actcell, vallen);
if (update) {
+ // We need this otherwise we won't resize
+ // the insettext of the active cell (if any)
+ // until later (see InsetText::do_resize)
+ unlockInsetInInset(bv, the_locking_inset);
+
for (int i = 0; i < tabular->rows(); ++i) {
tabular->GetCellInset(tabular->GetCellNumber(i, column))->
resizeLyXText(bv);
if (!lex.isOK())
return -1;
+ // FIXME: even current_view would be better than this.
BufferView * const bv = inset.view();
Buffer const * const buffer = bv ? bv->buffer() : 0;
if (buffer)
string const InsetTabularMailer::params2string(InsetTabular const & inset)
{
+ // FIXME: even current_view would be better than this.
BufferView * const bv = inset.view();
Buffer const * const buffer = bv ? bv->buffer() : 0;
if (!buffer)