freeride-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[FR-devel] Updated command manager code


From: Rich Kilmer
Subject: [FR-devel] Updated command manager code
Date: Wed, 25 Sep 2002 10:49:19 -0400

All,

I'm sorry I was not faster with this....

I just finished and checked in my updates to refactor the way 
commands are registered in FreeRIDE.  I now use slots rather 
than objects to hold commands.  It now looks something like this:

cslot = bus['/system/ui/commands/App/File/New']
cslot.set_proc {|*params| ... }
cslot['text'].data = '&New'
cslot['accelerator'] = 'Ctl-N'
cslot['description'] = 'Create new edit pane'

I have a manager to simplify this:

cmd_mgr = bus['/system/ui/commands'].manager
cmd_mgr.add("App/File/New", 
         "&New", 
         "Ctl-N", 
         "Create new edit pane" ) {|cmd_slot, *params| ...}

The first command sent to the command block is the cmd_slot 
so the block has access to the databus.  The command slot 
manager also have APIs for removing commands and iterating 
over commands (and of course looking up commands).


Which brings me to the second thing.  Individual commands 
have managers in their root that allow simplified access 
to the internal command structures:

new_cmd = cmd_mgr.command("App/File/New")

new_cmd is actually an object that is the manager of the 
command's slot, the actual data in in the subslots like 
in above.  This gives the same OO API that Curt had, but 
using the databus:

new_cmd.text = "&New'ish" 
...is the same as...
bus['/system/ui/commands/App/File/New/text"].data="&New'ish"

Of course had to update the menupane stuff in gui core and 
fox to use the new command structures and updated databusinspector 
and debugger code that registers their new commands and menu items.

I checked out all the code, and it seems to run...please 
let me know if folks encounter problems with this.

Whew,

-rich






reply via email to

[Prev in Thread] Current Thread [Next in Thread]