From 14c5adf034fd1db2bfa4cf4ace44e0e6b35c2377 Mon Sep 17 00:00:00 2001 From: Enrico Forestieri Date: Mon, 6 Jul 2009 00:48:07 +0000 Subject: [PATCH] Better fix for #6049 and similar cases with other math insets. In order to fix #6047, I needed a further mode other than MATH_MODE and TEXT_MODE. In this mode, LyX should have behaved as in TEXT_MODE but should also have allowed math mode commands. Well, this mode was already implemented in LyX as UNDECIDED_MODE. Currently, this mode is used nowhere except in the strange case where a math hull is not present. It cannot be created by any other mean than editing a .lyx file and getting rid of the $...$ math delimiters. This kind of file can be reloaded in LyX and you would see a strange math formula in text mode outside of mathed. Of course, trying to latex this file would cause errors. After this commit, this strange mode is still possible, but now all math insets correctly declare that their mode is math mode (instead of undecided, and unless they state otherwise) and bugs such as #6049 are fixed. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30385 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/InsetMath.h | 3 +++ src/mathed/InsetMathFrac.h | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mathed/InsetMath.h b/src/mathed/InsetMath.h index 6b178a7a2d..8aef3591fa 100644 --- a/src/mathed/InsetMath.h +++ b/src/mathed/InsetMath.h @@ -98,6 +98,9 @@ public: /// this is overridden in math text insets (i.e. mbox) bool inMathed() const { return true; } + /// this is overridden by specific insets + virtual mode_type currentMode() const { return MATH_MODE; } + /// the ascent of the inset above the baseline /// compute the size of the object for text based drawing virtual void metricsT(TextMetricsInfo const & mi, Dimension & dim) const; diff --git a/src/mathed/InsetMathFrac.h b/src/mathed/InsetMathFrac.h index 7e22a24cfe..b2c55666b2 100644 --- a/src/mathed/InsetMathFrac.h +++ b/src/mathed/InsetMathFrac.h @@ -25,8 +25,6 @@ public: /// explicit InsetMathFracBase(idx_type ncells = 2); /// - mode_type currentMode() const { return MATH_MODE; } - /// bool idxUpDown(Cursor &, bool up) const; /// bool idxBackward(Cursor &) const { return false; }