Abdelrazak Younes wrote:
Abdelrazak Younes wrote:
Jürgen Spitzmüller wrote:
We are already pretty close to a release: we have fixed the regressions introduced with 1.5.2 (pixmap cache, AMS classes) and several other things, including 9 critical bugs. So 1.5.3svn is significantly ahead of 1.5.2, IMHO.

Therefore, I don't want to hold back the release very much longer. However, there are still some things left to do.

On bugzilla, there are five open critical bugs. I think at least these two should be fixed:

4333 cri lyx crashes when opening 1.4.3. file with index containin... 4346 cri Synchronizing insets crash when two windows open

I hope that Abdel and José, as the experts in the respective area, will find time to have a look.

I had a look to 4346. It's due to the autoOpen flag which is decided at metrics time. It basically decides to open the inset if the cursor is inside. This is not bad in itself but it is bad that this decision happens at metrics time. Even if I don't like this, the collapsible status is a content and everything that is content should never be decided at metrics.

I'll try to fix that in trunk and backport the fix afterwards.

Hum, not so easy... autoOpen_ was introduced in rev 10495 to fix bug 1921:

http://bugzilla.lyx.org/show_bug.cgi?id=1921

This obviously doesn't work well with multiview and is (again) a strong hint that the collapsable status is *not* contents and should not be saved in the LyX file.

Anyway, I am not sure this is easily fixable...

This patch (for trunk) mostly fixes the problem. The downside is that the inset is not automatically "uncollapsed" when you leave the inset after an automatic opening. The inset might also refuse to collapse if the cursor is within it in another view.

Opinions?

Abdel.
Index: insets/InsetCollapsable.cpp
===================================================================
--- insets/InsetCollapsable.cpp (revision 21550)
+++ insets/InsetCollapsable.cpp (working copy)
@@ -46,7 +46,7 @@
 
 InsetCollapsable::CollapseStatus InsetCollapsable::status() const
 {
-       return autoOpen_ ? Open : status_;
+       return status_;
 }
 
 
@@ -54,7 +54,7 @@
 {
        switch (decoration()) {
        case Classic:
-               if (status() == Open) {
+               if (status_ == Open) {
                        if (openinlined_)
                                return LeftButton;
                        else
@@ -78,7 +78,7 @@
 InsetCollapsable::InsetCollapsable(BufferParams const & bp,
                CollapseStatus status, InsetLayout const * il)
        : InsetText(bp), layout_(il), status_(status),
-         openinlined_(false), autoOpen_(false), mouse_hover_(false)
+         openinlined_(false), mouse_hover_(false)
 {
        setAutoBreakRows(true);
        setDrawFrame(true);
@@ -93,7 +93,6 @@
                labelstring_(rhs.labelstring_),
                status_(rhs.status_),
                openinlined_(rhs.openinlined_),
-               autoOpen_(rhs.autoOpen_),
                // the sole purpose of this copy constructor
                mouse_hover_(false)
 {
@@ -192,8 +191,6 @@
 {
        BOOST_ASSERT(layout_);
 
-       autoOpen_ = mi.base.bv->cursor().isInside(this);
-
        FontInfo tmpfont = mi.base.font;
        mi.base.font = layout_->font;
        mi.base.font.realize(tmpfont);
@@ -258,7 +255,6 @@
 {
        BOOST_ASSERT(layout_);
 
-       autoOpen_ = pi.base.bv->cursor().isInside(this);
        ColorCode const old_color = pi.background_color;
        pi.background_color = backgroundColor();
 
@@ -450,6 +446,7 @@
        //lyxerr << "InsetCollapsable: edit left/right" << endl;
        cur.push(*this);
        InsetText::edit(cur, left);
+       status_ = Open;
 }
 
 
Index: insets/InsetCollapsable.h
===================================================================
--- insets/InsetCollapsable.h   (revision 21550)
+++ insets/InsetCollapsable.h   (working copy)
@@ -176,8 +176,6 @@
        mutable CollapseStatus status_;
        /// a substatus of the Open status, determined automatically in metrics
        mutable bool openinlined_;
-       /// the inset will automatically open when the cursor is inside
-       mutable bool autoOpen_;
        /// changes color when mouse enters/leaves this inset
        bool mouse_hover_;
 };

Reply via email to