]> git.lyx.org Git - features.git/commitdiff
pass mouse clicks also to insets "close enough"
authorAndré Pönitz <poenitz@gmx.net>
Tue, 25 Feb 2003 14:34:56 +0000 (14:34 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Tue, 25 Feb 2003 14:34:56 +0000 (14:34 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6251 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/formulabase.C
src/mathed/math_cursor.C
src/mathed/math_data.C
src/mathed/ref_inset.C

index 316ea479bf31fbe5c3b159c0ffde1c75e538fb87..27a2df6176b107fa154ed37feb42b2706b907c41 100644 (file)
@@ -318,6 +318,7 @@ dispatch_result InsetFormulaBase::lfunMouseRelease(FuncRequest const & cmd)
                // try to dispatch to enclosed insets first
                if (mathcursor->dispatch(cmd) == UNDISPATCHED) {
                        // launch math panel for right mouse button
+                       lyxerr << "lfunMouseRelease: undispatched: " << cmd.button() << endl;
                        bv->owner()->getDialogs().showMathPanel();
                }
                return DISPATCHED;
@@ -422,10 +423,12 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd)
 
        switch (cmd.action) {
                case LFUN_MOUSE_PRESS:
+                       //lyxerr << "Mouse single press\n";
                        return lfunMousePress(cmd);
                case LFUN_MOUSE_MOTION:
-                       return lfunMouseMotion(cmd);
+                       //return lfunMouseMotion(cmd);
                case LFUN_MOUSE_RELEASE:
+                       lyxerr << "Mouse single release\n";
                        return lfunMouseRelease(cmd);
                case LFUN_MOUSE_DOUBLE:
                        //lyxerr << "Mouse double\n";
index 7efecbba79247f1a5792088912619a679d16828e..77208b6fa9f4ab83834170dc3af3d2ca2c8da691 100644 (file)
@@ -1411,6 +1411,32 @@ MathCursorPos MathCursor::normalAnchor() const
 
 dispatch_result MathCursor::dispatch(FuncRequest const & cmd)
 {
+       // mouse clicks are somewhat special 
+       // check
+       switch (cmd.action) {
+               case LFUN_MOUSE_PRESS:
+               case LFUN_MOUSE_MOTION:
+               case LFUN_MOUSE_RELEASE:
+               case LFUN_MOUSE_DOUBLE: {
+                       MathCursorPos & pos = Cursor_.back();
+                       dispatch_result res = UNDISPATCHED;
+                       int x = 0, y = 0;
+                       getPos(x, y);
+                       if (x < cmd.x && hasPrevAtom()) {
+                               res = prevAtom().nucleus()->dispatch(cmd, pos.idx_, pos.pos_);
+                               if (res != UNDISPATCHED)
+                                       return res;
+                       }
+                       if (x > cmd.x && hasNextAtom()) {
+                               res = nextAtom().nucleus()->dispatch(cmd, pos.idx_, pos.pos_);
+                               if (res != UNDISPATCHED)
+                                       return res;
+                       }
+               }
+               default:
+                       break;
+       }
+
        for (int i = Cursor_.size() - 1; i >= 0; --i) {
                MathCursorPos & pos = Cursor_[i];
                dispatch_result res = pos.par_->dispatch(cmd, pos.idx_, pos.pos_);
index a3641321ba1f34180659086a597a74fd8c2d1643..1f65cd705a856566805f3e6dae92b72cabdd5179 100644 (file)
@@ -355,6 +355,7 @@ void MathArray::boundingBox(int & x1, int & x2, int & y1, int & y2)
        y2 = yo_ + descent();
 }
 
+
 void MathArray::center(int & x, int & y) const
 {
        x = xo_ + width() / 2;
index 520b6a0c867ecd129f65ba20fa96270aa92aeb04..9e3b5a8e30e6d7da991d9d8c76016f29d4e3c8ba 100644 (file)
@@ -40,6 +40,7 @@ dispatch_result
 RefInset::dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos)
 {
        switch (cmd.action) {
+               lyxerr << "dispatching " << cmd.argument << "\n";
                case LFUN_MOUSE_RELEASE:
                        if (cmd.button() == mouse_button::button3) {
                                lyxerr << "trying to goto ref" << cell(0) << "\n";