From: Sean P. <sea...@ma...> - 2005-12-06 22:10:54
|
On Dec 5, 2005, at 9:22 PM, Ralph Thomas wrote: > Hi adobe-source list, > > I was looking at the new command system and was wondering how to > command system will work with the current "action_fallback" in > window_server_t. Currently I use the action fallback like this: > > button( name: "Rotate Right", action: @rotate, value: > ["file://image.jpg", 90] ); > button( name: "Rotate Left", action: @rotate, value: > ["file://image.jpg", 270] ); > > I specify the target of the action by the value. This is very limited, > because I can't do things like (say) disable the buttons if > "file://image.jpg" is read-only. Is this the kind of problem that the > new command_system could help solve? This is the goal - certainly the details aren't worked out yet (Foster's getting a good start though - I haven't yet had a chance to fully review his work). The idea with the button as with a menu is that the enabled state is controlled by some predicate representing the pre-condition of the command. Normally with Adam and buttons this is driven from invariants on the Adam sheet (an Adam sheet is a model for relationships having to do with the parameters to some function, an invariant in Adam is a pre- condition of the function). So normally we would bind the button to a parameter and it's associated predicate (fire up the image size example and make the very large in pixels in either dimension). You example would be better described as: // eve description button (name "Rotate Left", action: @rotate, value: 270, bind: @file); // adam description input: file_name: "file://image.jpg"; output: file <== file_name; invariant: fa <== is_valid_file(file_name, @writeable); This is not a particularly elegant solution - but hopefully conveys the idea. For commands I've asked Foster to simply provide an "enabled" flag which can be set to reflect if the preconditions are satisfied - there should be two ways to drive this flag: Have a collection of predicate functions which are evaluated "when something has changed" - not particularly efficient but easy to represent. Have an Adam (like) rule which is updated by tracking dependencies (Adam is currently brute force so it isn't any more efficient than the above solution - but the dependencies are available so it could do better). The goal here is to start using the Adam modeling capabilities for describing functions to control the enabling of commands. Sean > > Thanks, > Ralph > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through > log files > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD > SPLUNK! > http://ads.osdn.com/?ad_idv37&alloc_id865&op=click > _______________________________________________ > Adobe-source-devel mailing list > Ado...@li... > https://lists.sourceforge.net/lists/listinfo/adobe-source-devel |