From: Abdelrazak Younes Date: Wed, 18 Jul 2007 09:55:33 +0000 (+0000) Subject: Properly fix bug 3258. X-Git-Tag: 1.6.10~9111 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=1007714d2ec380d935d59092013ea88373bfb1df;p=features.git 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 --- diff --git a/src/frontends/controllers/ControlTabular.cpp b/src/frontends/controllers/ControlTabular.cpp index 54a2e70b6a..76e3f86abf 100644 --- a/src/frontends/controllers/ControlTabular.cpp +++ b/src/frontends/controllers/ControlTabular.cpp @@ -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(&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)); diff --git a/src/frontends/qt4/QTabular.cpp b/src/frontends/qt4/QTabular.cpp index f5d9f69521..73ce923fd8 100644 --- a/src/frontends/qt4/QTabular.cpp +++ b/src/frontends/qt4/QTabular.cpp @@ -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(); diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp index 1379f6cbc1..d2545eea34 100644 --- a/src/insets/InsetTabular.cpp +++ b/src/insets/InsetTabular.cpp @@ -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()); } diff --git a/src/insets/InsetTabular.h b/src/insets/InsetTabular.h index 5c3fb27f05..32e1aa56e5 100644 --- a/src/insets/InsetTabular.h +++ b/src/insets/InsetTabular.h @@ -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_; };