freeride-devel
[Top][All Lists]
Advanced

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

RE: [FR-devel] Updated command manager code


From: Curt Hibbs
Subject: RE: [FR-devel] Updated command manager code
Date: Wed, 25 Sep 2002 08:54:45 -0700

Good work, Rich!

This definitely opens up the command structure making it easier to write
plugins that can manipulate existing commands.

Curt

> -----Original Message-----
> From: address@hidden
> [mailto:address@hidden Behalf Of Rich
> Kilmer
> Sent: Wednesday, September 25, 2002 7:49 AM
> To: 'Freeride-Devel'
> Subject: [FR-devel] Updated command manager code
>
>
> 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
>
>
>
>
> _______________________________________________
> Freeride-devel mailing list
> address@hidden
> http://mail.freesoftware.fsf.org/mailman/listinfo/freeride-devel
>





reply via email to

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