< Back to IRCAM Forum

Adding new context shortcuts?

Speaking of adding shortcuts–one of the first things I found myself desperately wanting in OM was a fast way to om-inspect an object. I was pleased by how easy it is: inserting one line into the definition of boxframe-default-list, as follows, adds an ‘Inspect’ entry to the contextual menu for boxes:

(defun boxframe-default-list (object)
  (list (list 
         (om-new-leafmenu  "Copy" #'(lambda () (copy (om-view-window object))))
         (om-new-leafmenu  "Cut" #'(lambda () (cut (om-view-window object))))
         (om-new-leafmenu  "Duplicate" #'(lambda () (duplicate-window (om-view-window object))))
         )
        (list 
         (om-new-leafmenu  "Get Info" #'(lambda () (get-info-window (om-view-window object))))
         (om-new-leafmenu  "Show Documentation" #'(lambda () (show-big-doc object))
; ***********************************************************************
         (om-new-leafmenu "Inspect" #'(lambda () (om-inspect object))));*
; ***********************************************************************
        (list
         (if (lock-button object)
             (om-new-leafmenu "Unlock Eval" #'(lambda () (apply-win (om-view-window object) 'add-rem-lock-button)))
           (om-new-leafmenu "Lock Eval" #'(lambda () (apply-win (om-view-window object) 'add-rem-lock-button))))
         (om-new-leafmenu "Eval Box" #'(lambda ()
                                    (om-eval-enqueue 
                                     `(progn
                                        (eval-box ,object)
                                        (clear-ev-once ,(om-view-container object)))))))))

Although much better than what I was doing before–using *current-workspace*–this is still a hack. Is there a better way to make custom shortcuts?

-Jonathan

1 Like

Dear Jonathan,

This is more complicated than that. I have made your request, adding the inspect in the menu and in the contextual menu. If you check out your code, you will realize that it is not the same “inspection” of the class you want to do as if om-inspect is called from the patch itself.

So here is the lisp file (to be put in the init file) and still in testing. Will be added soon in the coming version of OM.

Best
K
ominspect.lisp (15.6 KB)

1 Like

M. Haddad,

Thank you for responding so quickly with this. That is very cool. You even provided a C-y keyboard shortcut for it

I can see a few differences: you open inspectors for all items currently selected; you provide arguments for some of the optional parameters to om-new-leafmenu; and you om-inspect the value in the box instead of the box itself. Did I miss anything?

-Jonathan

Hi Jonathan,

No this is correct. But if you look closely, and look into the om-inspect once connected to a music class, this returns the slots. and info of the class, while if you just inspect a box inside a patch, the om-inspect will inspect also much more information which is in fact not necessary, such as “decoration” etc. these are just internal display slots which i believe are not really necessary for inspecting data. Anyhow, this is what om-inspect was built for.
Anyhow, now it is integrated in the new coming version and we thank you for your real practical suggestion and insight.

Best
K