From 1e9b462b6e9eab8e4ec32794eb6adf31d6452e8c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Wed, 3 Apr 2002 13:40:22 +0000 Subject: [PATCH] remove no more needed hack for positioning the cursor with the mouse git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3890 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/formulabase.C | 41 +++++++++++++++------------------------- src/mathed/formulabase.h | 2 ++ src/mathed/math_hash.C | 2 +- 3 files changed, 18 insertions(+), 27 deletions(-) diff --git a/src/mathed/formulabase.C b/src/mathed/formulabase.C index 5bd77093dd..3636d9b6c0 100644 --- a/src/mathed/formulabase.C +++ b/src/mathed/formulabase.C @@ -155,22 +155,16 @@ string const InsetFormulaBase::editMessage() const } -void InsetFormulaBase::edit(BufferView * bv, int x, int /*y*/, unsigned int) +void InsetFormulaBase::edit(BufferView * bv, int x, int y, unsigned int +button) { + lyxerr << "edit: " << x << " " << y << " button: " << button << "\n"; if (!bv->lockInset(this)) lyxerr[Debug::MATHED] << "Cannot lock inset!!!" << endl; - //lyxerr << "edit: " << x << " " << y << " button: " << button << "\n"; - if (!mathcursor) { + if (!mathcursor) mathcursor = new MathCursor(this, x == 0); - metrics(bv); - // handle ignored click - if (hack_x || hack_y) { - insetButtonPress(bv, hack_x, hack_y, hack_button); - hack_x = hack_y = 0; - } - } else - metrics(bv); + metrics(bv); // if that is removed, we won't get the magenta box when entering an // inset for the first time bv->updateInset(this, false); @@ -281,9 +275,9 @@ void InsetFormulaBase::updateLocal(BufferView * bv, bool dirty) bool InsetFormulaBase::insetButtonRelease(BufferView * bv, int /*x*/, int /*y*/, int /*button*/) { + //lyxerr << "insetButtonRelease: " << x << " " << y << "\n"; if (!mathcursor) return false; - //lyxerr << "insetButtonRelease: " << x << " " << y << "\n"; hideInsetCursor(bv); showInsetCursor(bv); bv->updateInset(this, false); @@ -294,26 +288,21 @@ bool InsetFormulaBase::insetButtonRelease(BufferView * bv, void InsetFormulaBase::insetButtonPress(BufferView * bv, int x, int y, int button) { - // hack to cope with mouseclick that comes before the call to edit() - if (!mathcursor) { - hack_x = x; - hack_y = y; - hack_button = button; - return; - } + //lyxerr << "insetButtonPress: " + // << x << " " << y << " but: " << button << "\n"; - lyxerr << "insetButtonPress: " << x + xo_ << " " << y + yo_ - << " but: " << button << "\n"; switch (button) { default: case 1: - // just click + // left click + if (!mathcursor) { + mathcursor = new MathCursor(this, x == 0); + metrics(bv); + } first_x = x; first_y = y; - if (mathcursor) { - mathcursor->selClear(); - mathcursor->setPos(x + xo_, y + yo_); - } + mathcursor->selClear(); + mathcursor->setPos(x + xo_, y + yo_); break; /* case 2: diff --git a/src/mathed/formulabase.h b/src/mathed/formulabase.h index 67eeaa159a..3df1428255 100644 --- a/src/mathed/formulabase.h +++ b/src/mathed/formulabase.h @@ -114,6 +114,8 @@ public: virtual void mutateToText(); /// virtual void revealCodes(BufferView *) const; + /// + virtual Inset::EDITABLE editable() const { return HIGHLY_EDITABLE; } private: diff --git a/src/mathed/math_hash.C b/src/mathed/math_hash.C index c02b4156f8..8a56952d2b 100644 --- a/src/mathed/math_hash.C +++ b/src/mathed/math_hash.C @@ -103,7 +103,7 @@ key_type wordlist_array[] = {"mathfrak", LM_TK_FONT, LM_TC_EUFRAK}, {"mathit", LM_TK_FONT, LM_TC_IT}, {"mathnormal", LM_TK_FONT, LM_TC_VAR}, - //{"mathring", LM_TK_DECORATION, 0}, + {"mathring", LM_TK_DECORATION, 0}, {"mathrm", LM_TK_FONT, LM_TC_RM}, {"mathsf", LM_TK_FONT, LM_TC_SF}, {"mathtt", LM_TK_FONT, LM_TC_TT}, -- 2.39.2