diff --git a/src/mathed/formulabase.C b/src/mathed/formulabase.C index cacaf05959..1d04d8d4e7 100644 --- a/src/mathed/formulabase.C +++ b/src/mathed/formulabase.C @@ -319,6 +319,11 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action, if (!mathcursor) return UNDISPATCHED; + if (mathcursor->asHyperActiveInset()) { + lyxerr << " uurr.... getting dificult now\n"; + return mathcursor->asHyperActiveInset()->localDispatch(bv, action, arg); + } + RESULT result = DISPATCHED; bool sel = false; bool was_macro = mathcursor->inMacroMode(); diff --git a/src/mathed/formulabase.h b/src/mathed/formulabase.h index 8f5c30f94b..c1ab919370 100644 --- a/src/mathed/formulabase.h +++ b/src/mathed/formulabase.h @@ -101,6 +101,8 @@ public: int xo() const { return xo_; } /// int yo() const { return yo_; } + /// + BufferView * view() const { return view_; } private: /// unimplemented void operator=(const InsetFormulaBase &); diff --git a/src/mathed/math_boxinset.C b/src/mathed/math_boxinset.C index 16263fb172..39b3b1c931 100644 --- a/src/mathed/math_boxinset.C +++ b/src/mathed/math_boxinset.C @@ -38,6 +38,12 @@ MathInset * MathBoxInset::clone() const } +UpdatableInset * MathBoxInset::asHyperActiveInset() const +{ + return text_; +} + + void MathBoxInset::write(MathWriteInfo & os) const { os << "\\" << name_ << "{" << cell(0) << "}"; @@ -76,3 +82,10 @@ void MathBoxInset::draw(Painter & pain, int x, int y) const pain.rectangle(x, y - ascent(), xcell(0).width(), height(), LColor::mathframe); } + + +void MathBoxInset::edit(BufferView * bv, int x, int y, unsigned int button) +{ + if (text_) + text_->edit(bv, x, y, button); +} diff --git a/src/mathed/math_boxinset.h b/src/mathed/math_boxinset.h index 6e7ac2fd05..b866bbe5b8 100644 --- a/src/mathed/math_boxinset.h +++ b/src/mathed/math_boxinset.h @@ -10,6 +10,7 @@ #endif class InsetText; +class UpdatableInset; class BufferView; class Buffer; class LyXFont; @@ -38,6 +39,10 @@ public: MathBoxInset * asBoxInset() { return this; } /// bool isHyperActive() const { return 1; } + /// + void edit(BufferView * bv, int x, int y, unsigned int button); + /// identifies hyperactive insets + UpdatableInset * asHyperActiveInset() const; private: /// unimplemented diff --git a/src/mathed/math_cursor.C b/src/mathed/math_cursor.C index 822b1d97fc..a4cc75efaa 100644 --- a/src/mathed/math_cursor.C +++ b/src/mathed/math_cursor.C @@ -232,6 +232,12 @@ void MathCursor::dump(char const *) const {} #endif +UpdatableInset * MathCursor::asHyperActiveInset() const +{ + return par()->asHyperActiveInset(); +} + + bool MathCursor::isInside(MathInset const * p) const { for (unsigned i = 0; i < Cursor_.size(); ++i) @@ -332,6 +338,9 @@ bool MathCursor::right(bool sel) if (hasNextAtom() && openable(nextAtom(), sel)) { if (nextAtom()->isHyperActive()) { lyxerr << "entering hyperactive inset\n"; + int x, y; + getPos(x, y); + nextAtom()->edit(formula()->view(), x, y, 0); } pushLeft(nextAtom()); return true; diff --git a/src/mathed/math_cursor.h b/src/mathed/math_cursor.h index 7332398c65..23ba663556 100644 --- a/src/mathed/math_cursor.h +++ b/src/mathed/math_cursor.h @@ -197,6 +197,8 @@ public: /// Make sure cursor position is valid void normalize() const; + /// + UpdatableInset * asHyperActiveInset() const; /// enter a MathInset void push(MathAtom & par); diff --git a/src/mathed/math_inset.h b/src/mathed/math_inset.h index ebdae3f548..065672fb6e 100644 --- a/src/mathed/math_inset.h +++ b/src/mathed/math_inset.h @@ -50,6 +50,8 @@ class MathMacroTemplate; class LaTeXFeatures; class Buffer; +class BufferView; +class UpdatableInset; struct MathWriteInfo { @@ -217,6 +219,8 @@ public: virtual MathBoxInset * asBoxInset() { return 0; } /// identifies macro templates virtual MathMacroTemplate * asMacroTemplate() { return 0; } + /// identifies hyperactive insets + virtual UpdatableInset * asHyperActiveInset() const { return 0; } /// identifies things that can get scripts virtual bool isScriptable() const { return false; } @@ -238,6 +242,8 @@ public: /// virtual void dump() const; + /// + virtual void edit(BufferView *, int, int, unsigned int) {} /// virtual void validate(LaTeXFeatures & features) const;