Intercept UI::Command.new ?
-
Is there a way to intercept
UI.Command.newso that one can catch the menu_name argument passed to thenewmethod ? -
never mind - think I got it working now... I think...
-
Eeeexcellent!

-
@thomthom said:
Is there a way to intercept
UI.Command.newso that one can catch the menu_name argument passed to thenewmethod ?It is possible so:
module Object;;UI class Command class << self alias ;newORIG ;new private ;newORIG end def self.new(m_name, &cmd_block) p m_name #some code... self.__send__(;newORIG, m_name, &cmd_block) end#def end end#module -
Thom, this looks very intersting. Are you going to post some working code or a plugin here soon?
-
Need some more coding.
I've intercepted all the menus created and added getter methods. With this I should be able to override the menu and toolbar structures. It's all going to take a lot of UI development, but what I'm thinking is:Being able to:
- Override menu & toolbar text, tooltips, statusbar text
- Override menu location (user defined menu structure)
- Custom toolbars of any Ruby toolbar buttons (Though there can be issues here with plugins trying to hide/show their own toolbars)
- Mute menus and toolbar buttons
- Automatic menu sorting or custom arrangement (need to find a good solution for this)
Regarding automatic menu sorting or custom arrangement there are some issues:
Idea 1 - pre-populate the menus and hook up the commands when the plugins loads. Issue here is if a plugin is removed there'll be dead menu items. (Purge menu command?)Idea 2 - Find a way to work out when SU has loaded all plugins upon SU startup - populate menus when they are done.
-
Very interesting. Awaiting your TT_toolbarTool...

Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement