]> git.lyx.org Git - features.git/commitdiff
next step...
authorAndré Pönitz <poenitz@gmx.net>
Wed, 24 Oct 2001 19:09:31 +0000 (19:09 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Wed, 24 Oct 2001 19:09:31 +0000 (19:09 +0000)
would somebody explain me how inset nesting works in the outside world?

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2941 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/formulabase.C
src/mathed/formulabase.h
src/mathed/math_boxinset.C
src/mathed/math_boxinset.h
src/mathed/math_cursor.C
src/mathed/math_cursor.h
src/mathed/math_inset.h

index cacaf05959fa5caa7b6ab8f268054971a1cb5f3b..1d04d8d4e7a65ca7c1956d85a1c6c76f3e476323 100644 (file)
@@ -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();
index 8f5c30f94b0f78484d54782907cdfda25694c3c6..c1ab91937086c5494cff687d3a8d0a949549a99a 100644 (file)
@@ -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 &);
index 16263fb172df526323ea041420a4b3766b871cad..39b3b1c931d0d94b53fa07eea10e1183ec39ab12 100644 (file)
@@ -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);
+}
index 6e7ac2fd05f593ad3331e648f4c35dc661457a7b..b866bbe5b81942c60730238975b2ee813c0d3895 100644 (file)
@@ -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
index 822b1d97fc4b6076671fd209d92abc9c982a417b..a4cc75efaa8857afb299ed1644d44844470c5022 100644 (file)
@@ -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;
index 7332398c655937da573abb0d4397d2c3fe6588f2..23ba663556011673f395d4dd318bf882c7dccfe7 100644 (file)
@@ -197,6 +197,8 @@ public:
 
        /// Make sure cursor position is valid
        void normalize() const;
+       ///
+       UpdatableInset * asHyperActiveInset() const;
 
        /// enter a MathInset 
        void push(MathAtom & par);
index ebdae3f5480fd8dab685925b867106523d96309c..065672fb6ebba18599f54dc6aae83ea9248d9666 100644 (file)
@@ -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;