freeride-devel
[Top][All Lists]
Advanced

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

Re: [FR-devel] Updates to System_Command stuff


From: Laurent Julliard
Subject: Re: [FR-devel] Updates to System_Command stuff
Date: Mon, 16 Sep 2002 09:49:11 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020826

Rich Kilmer wrote:
Laurent (and Curt),

I have completed study of the code to date on the FreeRIDE GUI and want
to pursue a bit of refactoring.  My main goal is to preserve the
functinality that's implemented, but restructure the way that the
FreeBASE DataBus is used.  If there's one thing I think we need to use
consistently is the DataBus.

I will use the System_Command plugins as a working example.

Right now for each command we store an instance of a GenericCommand
object as the .data of the command's slot.  That object accepts a String
as a constructor that encodes a bunch of stuff (menu, accelerator, hint
text) seperated by \t (tabs) and pass a block/proc to call when the
command is executed.  All of this data could be represented within the
DataBus itself in slots like:

cslot = bus['/system/ui/commands/FileNew']
cslot.set_proc {|*params| ... }
cslot['./Text'].data = '&New'
cslot['./Accelerator'] = 'Ctl-N'
cslot['./Description'] = 'Create new edit pane'

This seems more complex, but it can be simplified by adding a manager
that presents an API to create commands:

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

and...

cmgr.each_command {|slot| ...}

and...

cmgr.delete("FileNew")

etc...

I know this messes with the whole CommandManager structure but I have
some thoughts there too...

This is only one example of how the DataBus could be used to store a
structure that would otherwise require an object.
Thoughts about these changes, and my refactoring directions?


This is fine with me. One thing though is that you should look at both the DataBus inspector and the Debugger plugins and see how they add menu items today. How will your proposal interefere with the existing add/delete menu entry mechanism?

While your are at it the same abstraction level would be nice to have at the menuPane level. For instance the Debugger should be able to add the Run menu by itself if it doesn't yet exist and then add its own menu entry in there. Today, if my recollection is correct, the run menu is hardcoded and added at launchtime.


BTW:  We can also delete the file System_Commands.rb and change the
plugin.xml file...remove the entry for System_Commands and changing the
name of the subsystem to System_Commands.  Since a Subsystem is itself
represented as a plugin and it waits/depends on all plugins within it,
it can serve the same purpose that the System_Commands.rb file does
right now.  I did this on my machine and it works the same.

Regards,

Rich




_______________________________________________
Freeride-devel mailing list
address@hidden
http://mail.freesoftware.fsf.org/mailman/listinfo/freeride-devel



--
Laurent JULLIARD - Xerox R&T/SSTC/XPA - Open Source team
>> Host your Xerox Software project on CodeX: http://codex.xerox.com
>> address@hidden community: http://xww.linux.world.xerox.com





reply via email to

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