Am 29.10.2008 um 10:56 schrieb Abdelrazak Younes:
Hum, this commit fixes the right and left movement but not the up and down...

Putting leavePreview into idxFirst/idxLast looks wrong. See below.

André, Stefan, Enrico, could you please comment on the possibility to have InsetMathHull inside InsetMathHull? I can imagine that it is useful for XYmatrix purpose so that you don't have the full raw equation when you enter it.
One solution would be to move the preview handling to InsetMathGrid.

Looking at your patch: Would notifyCursorEnters(old, cur) in analogy to notifyCursorLeaves(old, cur) help? We can do that at the very same place where the notifyCursorLeaves(old, cur) is called already. Then every inset (both hulls in this case) would be called correctly.

Stefan

Abdel.


On 29/10/2008 10:24, [EMAIL PROTECTED] wrote:
Author: younes
Date: Wed Oct 29 10:24:54 2008
New Revision: 27186

URL: http://www.lyx.org/trac/changeset/27186
Log:
Fix http://bugzilla.lyx.org/show_bug.cgi?id=5392

The problem is that, for an unknown reason, an InsetMathHull is used *inside* an InsetMathHull. This is the reason why we have two levels of instant preview. I don't know if that was intended.

When moving the cursor, only the doDispatch() of the enclosing InsetMathHull is called, not the inner one; so we don't have a chance to detect that the inner InsetMathHull should leave its preview mode.

The new leavePreview() method ensures that the screen will be redrawn if needed with cursor movement.

Modified:
    lyx-devel/trunk/src/mathed/InsetMathHull.cpp
    lyx-devel/trunk/src/mathed/InsetMathHull.h

Modified: lyx-devel/trunk/src/mathed/InsetMathHull.cpp
URL: 
http://www.lyx.org/trac/file/lyx-devel/trunk/src/mathed/InsetMathHull.cpp?rev=27186
= = = = = = = = = =====================================================================
--- lyx-devel/trunk/src/mathed/InsetMathHull.cpp (original)
+++ lyx-devel/trunk/src/mathed/InsetMathHull.cpp Wed Oct 29 10:24:54 2008
@@ -277,10 +277,22 @@
 }


+void InsetMathHull::leavePreview(Cursor&  cur) const
+{
+       if (!use_preview_)
+               return;
+       use_preview_ = false;
+       Update::flags flags = cur.result().update();
+       if (flags&  Update::FitCursor)
+               cur.updateFlags(flags | Update::Force);
+}
+
+
 bool InsetMathHull::idxFirst(Cursor&  cur) const
 {
        cur.idx() = 0;
        cur.pos() = 0;
+       leavePreview(cur);
        return true;
 }

@@ -289,6 +301,7 @@
 {
        cur.idx() = nargs() - 1;
        cur.pos() = cur.lastpos();
+       leavePreview(cur);
        return true;
 }


Modified: lyx-devel/trunk/src/mathed/InsetMathHull.h
URL: 
http://www.lyx.org/trac/file/lyx-devel/trunk/src/mathed/InsetMathHull.h?rev=27186
= = = = = = = = = =====================================================================
--- lyx-devel/trunk/src/mathed/InsetMathHull.h (original)
+++ lyx-devel/trunk/src/mathed/InsetMathHull.h Wed Oct 29 10:24:54 2008
@@ -231,6 +231,8 @@
        void handleFont2(Cursor&  cur, docstring const&  arg);
        ///
        bool previewState(BufferView * bv) const;
+       ///
+       void leavePreview(Cursor&  cur) const;
 };







Reply via email to