]> git.lyx.org Git - features.git/commitdiff
Properly fix bug 3258.
authorAbdelrazak Younes <younes@lyx.org>
Wed, 18 Jul 2007 09:55:33 +0000 (09:55 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Wed, 18 Jul 2007 09:55:33 +0000 (09:55 +0000)
* 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

src/frontends/controllers/ControlTabular.cpp
src/frontends/qt4/QTabular.cpp
src/insets/InsetTabular.cpp
src/insets/InsetTabular.h

index 54a2e70b6a651160e8d0ffa513ae19b1c343502b..76e3f86abff5c0b497982615b724b4e6a5df057e 100644 (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));
index f5d9f6952148de66b05951faf209fa2b1b9c31ab..73ce923fd84191b823b46fb2f90ec4398f11e098 100644 (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();
 
index 1379f6cbc16e968a665acbcfb1fa3a44e0307bb6..d2545eea34a945704166b812431054cfb8117193 100644 (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());
 }
 
 
index 5c3fb27f0541f3c18c9190d2147f637e9f7a5e76..32e1aa56e55080c9c31b6057387e21b74d1d93a7 100644 (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_;
 };