MOUSE BUTTON CUSTOMIZATION:

Hi;

 

Just wondering if anyone has got the Mouse Button Customization working. See notes below from Bricsys. Have had a look at the CUI file but not sure what to do to get, for example, the ctrl+left click configured for the 4th mouse button!

 

MOUSE BUTTON CUSTOMIZATION:

Section MouseButtonRoot in the CUI file allows to override the right button click action, the middle button click action, and the mouse buttons with modifiers Ctrl and Shift.

Section DoubleClickRoot in the CUI file allows to override the double click action on an entity.

There is no user interface yet for these sections, but when these sections exist in the CUI file, they will be applied.

 

Jon Buckle.

Comments

  • The ability to change the mouse button bindings is something I was really waiting for (the default bindings make little sense in 2d), so I played around a bit to see if it works as expected. In short, the answer is not really, yet. This is what I did:

    I converted an old .mnu file with custom mouse bindings and isolated the relevant sections in a new partial menu file that can be easily loaded.
    However, the diesel function I used on the middle mouse button to open a zoom window directly from the cursor position:

    $M=$(if,$(eq,$(substr,$(getvar,cmdnames),$(-,$(strlen,$(getvar,cmdnames)),3)),ZOOM),\,'_zoom;_w;\)^Z

     did not work. It seems the \ operator is not supported, but that's not really a problem - I never understood the need for diesel anyway, and bricscad doesn't suffer from this inability to not being able to use lisp inside of lisp, so I just replaced that with the respective lisp code in the .mnl file:

    (defun jyg_zw ( / cmdnames ppoint)
    (setq ppoint (cadr (grread T))
    cmdnames (getvar "CMDNAMES")
    )
    (if (eq (substr cmdnames (abs (- (strlen cmdnames) 3))) "ZOOM")
    (command ppoint)
    (command "'_ZOOM" "_W" ppoint)
    )
    (princ)
    )

    and this worked.

    Unfortunately, most other things did not:
    - the action for the unmodified right mouse button seems to override SHORTCUTMENU, while the opposite should be true
    - MBUTTONPAN grabs the middle mouse button completely instead of only the first (unmodified) item. This would be o.k. if the modified buttons would be bound to useful functions, but they are not.
    - the entries in the menu file are overridden by bricscad's own bindings for dynamic pan and roll on the right mouse button
    - since the .cui file follows AutoCAD syntax, there is no way to override the functions on the (modified) left mouse button, and this is the biggest nuisance: users coming from AutoCAD usually try to cycle through objects by Ctrl+left clicking, and this leaves them with a slightly tilted view of their drawing. Many of them never worked in 3d and are completely lost, trying to tinker with the UCS or snap to get things in line again...

    A clean solution would probably need a break with AutoCAD syntax - but IMHO that would do no harm, since exchanging .cui files with AutoCAD users is completely pointless anyway. What I would like to see is something like this:
    The hard coded (bricscad specific) bindings should just be callable as MenuMacros that could be bound to any combination of mouse buttons and modifiers,for example:


    MB_Select -the 'normal' function of the left button (would probably be acceptable to leave this binding fixed)
    MB_ShortcutMenu - displaying the Shortcutmenu
    MB_Zoom - currently bound to Shift+Ctrl+LeftButton
    MB_Pan - currently bound to Shift+Ctrl+RightButton (and middle button via MBUTTONPAN)
    MB_Orbit - currently bound to Ctrl+LeftButton
    MB_Roll - currently bound to Ctrl+RightButton
    MB_Cycle - currently bound to Shift+SpaceBar
    MB_Window - 'drag&release' zoom window (new, as a better replacement for my function above)

    Anybody subscribing?

    (btw, my .cui and .mnl files can be found here: http://www.openaec.org/?q=node/364)

  • @ Knut:

    Thank you for shedding some light on this issue. I have never liked that Ctrl+LMB activates rtrot. I would prefer to see AC-compatibility here.

    FYI:
    The \ operator does work in BC. In fact your macro works! But, as you have indicated yourself, it is not possible to program the MMB. Try using Shift+RMB instead.

    Question:
    What does the ^Z do in your macro. It seems to work just fine without it:

    $M=$(if,$(eq,$(substr,$(getvar,cmdnames),$(-,$(strlen,$(getvar,cmdnames)),3)),ZOOM),,'_zoom;_w;\)
  • @ Roy:

    This is what my (very old) AutoCAD documentation says about ^Z:

    "^Z     Null character that suppresses the automatic addition of SPACEBAR at the end of a menu item"

    "if you use the DIESEL string language to perform "if-then" tests, conditions might exist where the normal terminating space or semicolon (resulting in ENTER) is undesirable. If you follow the menu macro with ^Z, AutoCAD does not add ENTER to the end of the macro expression."

     - actually I don't remember if this was necessary in ACAD to prevent command repetition, seems to work fine without in bricscad anyway.

    The macro does work with the middle mouse buttton, as long as MBUTTONPAN is off, but the problem lies in the backslash operator (again this is what the ACAD 2000 docs say):

    "As described earlier, you can include a backslash (\) in a menu item to pause for user input. For the buttons menus, the coordinates of the screen crosshair are supplied as user input when the button is pressed. This occurs only for the first backslash in the menu item; if the item contains no backslashes, the pointer coordinates are not used."

    In AutoCAD, the diesel expression (when bound to Shift+MiddleButton) immediately reads the cursor coordinates and opens a zoom window from that point; if the Shift-modifier is still pressed, the middle mouse button can then be used to specify the second point of the window. Bricscad, however, justs waits for the two points to be specified with left button clicks.

    But as I said before, as long as the lisp version works, this is not really an issue for me. Interesting question would be if there are any caveats when replacing all diesel expressions in a menu with their lisp counterparts...  maybe I'll check this out later if I find the time...

     

  • Another thing that is not seeming to work is binding the snap-menu to the (unmodified) right button:

    $M=$(if,$(getvar,cmdnames),$P0=BRICSCAD.SNAP $P0=*);

    is always echoing $(IF,??) to the command window and returning enter instead of popping up the menu.

  • Some of my remarks in #2 were incorrect:

    most definitions in the menu file are meant to be overridden if CTRLMOUSE is ON (just forgot about that), and the CTRL+LeftClick problem is of course also cured when CTRLMOUSE is OFF.

    Most users, however, will not want to do without the realtime bindings, so turning  CTRLMOUSE off will normally not be an option, unless something like described in #2 replaces them (which would render both MBUTTONPAN and CTRLMOUSE obsolete).

     

  • Knut thank you for clearing this up even further :-)
    I didn't know about the CTRLMOUSE setting, so some of my remark in post #3 are wrong as well.

    For your snap menu macro (post #5) try one of these:

    $M=$(if,$(eq,$(getvar,cmdnames),),,$P0=BRICSCAD.SNAP;$P0=*)
    $M=$(if,$(getvar,cmdactive),$P0=BRICSCAD.SNAP;$P0=*)
  • Roy,

    Thanks for the correction, works - maybe this was already broken in AutoCAD, don't remember.

    So my mouse.cui actually contains the following bindings (not an ideal solution, just a place to start): 

    MiddleButton - 'normal' pan
    RightButton - popup Snap menu if a command is active, send Enter otherwise
    Shift+MiddleButton - 'my' window zoom (opening a window directly from pointer position, allowing to select the second point also with the middle button, if Shift is held down)
    Shift+RightButton - zoom previous
    Ctrl+MiddleButton - also zoom previous
    Ctrl+RightButton - popup Grips menu if a grip is active, send Enter otherwise
    Ctrl+Shift+MiddleButton - zoom all
    Ctrl+Shift+RightButton - toggle MBUTTONPAN

    I also updated the files I uploaded to my site, just in case somebody stumbles into this...

This discussion has been closed.