Properly fix bug 3258.

* InsetTabular: 
  - remove the is_deleted_ boolean
  - dispatch(): remove the call to updateDialog at the end

* ControlTabular::initialiseParams(): connect to the current tabular if found.

* QTabular::update_contents(): initialiseParams() each time.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19112 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-07-18 09:55:33 +00:00
parent f521c4601d
commit 1007714d2e
4 changed files with 12 additions and 11 deletions

View File

@ -32,16 +32,24 @@ bool ControlTabular::initialiseParams(string const & data)
{
// try to get the current cell
BufferView const * const bv = kernel().bufferview();
InsetTabular const * current_inset = 0;
if (bv) {
Cursor const & cur = bv->cursor();
// get the innermost tabular inset;
// assume that it is "ours"
for (int i = cur.depth() - 1; i >= 0; --i)
if (cur[i].inset().lyxCode() == Inset::TABULAR_CODE) {
current_inset = static_cast<InsetTabular *>(&cur[i].inset());
active_cell_ = cur[i].idx();
break;
}
}
if (current_inset && data.empty()) {
params_.reset(new Tabular(current_inset->tabular));
return true;
}
InsetTabular tmp(kernel().buffer());
InsetTabularMailer::string2params(data, tmp);
params_.reset(new Tabular(tmp.tabular));

View File

@ -633,6 +633,8 @@ void QTabular::update_borders()
void QTabular::update_contents()
{
controller().initialiseParams(string());
Tabular const & tabular(controller().tabular());
Tabular::idx_type const cell = controller().getActiveCell();

View File

@ -2877,20 +2877,19 @@ Tabular::BoxType Tabular::useParbox(idx_type cell) const
InsetTabular::InsetTabular(Buffer const & buf, row_type rows,
col_type columns)
: tabular(buf.params(), max(rows, row_type(1)),
max(columns, col_type(1))), buffer_(&buf), scx_(0), is_deleted_(false)
max(columns, col_type(1))), buffer_(&buf), scx_(0)
{}
InsetTabular::InsetTabular(InsetTabular const & tab)
: Inset(tab), tabular(tab.tabular),
buffer_(tab.buffer_), scx_(0), is_deleted_(false)
buffer_(tab.buffer_), scx_(0)
{}
InsetTabular::~InsetTabular()
{
InsetTabularMailer(*this).hideDialog();
is_deleted_ = true;
}
@ -3491,11 +3490,6 @@ void InsetTabular::doDispatch(Cursor & cur, FuncRequest & cmd)
cell(cur.idx())->dispatch(cur, cmd);
break;
}
// FIXME: this accesses the position cache before it is initialized
//resetPos(cur);
if (!is_deleted_)
InsetTabularMailer(*this).updateDialog(&cur.bv());
}

View File

@ -824,9 +824,6 @@ private:
mutable idx_type first_visible_cell;
///
mutable int scx_;
/// Ugly boolean used when this inset is dissolved and
/// InsetTabularMailer should not be used.
bool is_deleted_;
};