r2 - 08 Aug 2006 - 20:32:39 - TimPetersonYou are here: TWiki >  GRAPEcluster Web  >  Documentation > SpracheCommandDefinition

The Sprache language definition language

A command definition is a sequence of whitespace-separated command components in order, all of which must be matched for the command to be triggered. This is followed by a curly-brace-delimited name of a method to execute to handle the command. There are two kinds of components: words and variables. A word is a static string that must be present in the command. A variable is a named placeholder of a certain type, and the input parameter must match that type for the command to match. A variable consists of a type (int, double, string) followed by a space, followed by the variable name, all surrounded by angle brackets. If a command can accept any number of parameters, the final component should be a *. If this catch-all command actually delegates its handling to another class, the target class name can be specified within square brackets. This allows the automatic command GUI builder to trace where each component of each command is parsed and generate the complete list of supported commands.

A variable definition can contain some number of GUI control definitions. If present, these go between the variable name and the closing angle bracket. If no controls are specified, a default text field is used. The controls can have parameters in parentheses. All controls attached to a given variable display the same value and update accordingly.

An inital value for the GUI for a variable can be specified using the default(...) option, with the default value inside the parentheses.

A text field is specified by text(10), with the parameter being the size of the box in characters. Several options can be specified in a drop-down box by using dropdown("on", "off"). An editable drop-down list can be created with combobox("on", "off"). A numeric value can be selected by a slider with a control like slider(0, 10, 0.1), which specifies a range from 0 to 10 and a resolution of 0.1. A filebrowser creates a button which opens a file browsing window. A checkbox creates a checkbox returning a boolean value.

Example command definitions

  • From spiegel.viewcontrol.function.plugins.input.File:
    set file <string file  default("default.sim")  text(20)  filebrowser> { onSetParam }
This creates a text field 20 characters wide followed by a filebrowser button. The initial value is default.sim.

  • From spiegel.viewcontrol.function.plugins.camera.BaseCamera3D:
    set stereoMode <string mode  dropdown("mono", "left", "right")> { onSetParam }
This creates a dropdown list with three choices, the default being mono (the first choice). (The combobox control could be used to allow entering values other than the provided choices.)

  • From spiegel.viewcontrol.function.plugins.camera.BaseCamera3D:
   set location
       <double x  text(3)  slider(-10, 10, 0.1)>
       <double y  text(3)  slider(-10, 10, 0.1)>
       <double z  text(3)  slider(-10, 10, 0.1)>
       { onSetParam }
This creates a text field and a linked slider for each of x, y, and z. The sliders range from -10 to +10, with a resolution of 0.1.

  • From spiegel.viewcontrol.function.plugins.camera.BaseCamera3D:
    set antialias <boolean value> { onSetParam }
This creates a checkbox. If necessary, this can be specified explicitly using checkbox.

-- TimPeterson - 12 Jun 2006

Edit | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r2 < r1 | More topic actions
General Information
Technology
  • Resources

Documentation
Repository
Related Projects
  • GUI Development
  • MovieMaker?
  • GUI
  • 3D Input Devices
  • Fly Through Path

Related Sites

 
Powered by TWiki
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback