A layer parameter is of a certain value type: vector/point, string, integer number, real number, boolean…
In Parameter panel, each item is a layer parameter and it has a viewer and an editor widget for showing and changing its value, respectively. For each value type, there’s a correspondent viewer/editor widget type.
However, a single value type may have different purposes in a user point of view. Examples:
- an integer number may represent an amount (like the number of
pointsof aStarlayer), but is also used to store the index of an enumeration list item (like theblend methodparameter of many layer types) - a string is used to store a text, but it may be necessary to display a larger text typing area for an entire paragraph (like for
textofTextlayer) or even a file path (like audiofilenameofSoundlayer) - a pair of real numbers may represent the vertex 2D-coordinates or a 2D-scaling factor (as in
Stretchlayer)
For the GUI to know what parameters a layer have, what are their value types and how to handle these different applications of the same value type, a layer describes its parameters by (re)implementing synfig::Layer::get_param_vocab(), that returns a list of parameter descriptions (synfig::ParamDesc objects).
In order to specifically differentiate the purpose of that value type of a given parameter, the ParamDesc may have a hint set.
By using a regular git grep set_hint, currently there are these hints:
- enum
- for integers
- allow user to select an option from a combobox instead of remembering/knowing an internal number id
- – note
synfig::ParamDesc::add_enum_value()should be used together with this hint…
- dash
- set for some parameters, but never used
- filename
- for strings
- allow user to browse the file system, instead of fill this field via typing only
- paragraph
- for strings
- allow user to type text with multiple lines
- font_family
- for strings
- allow user to select an available font face instead of only typing it
- – defined in 2005, but only used this year in commit ccb98a3d95cdca341cec37814090d9ddc2d32c64
- size
- set for some parameters, but never used
- width
- set for some parameters, but never used
- sublayer_name
- for strings
- used only by a parameter of
Switchlayer (Active Layer Name) - allow user, via combobox, to select a layer encapsulated by the Switch layer, instead of typing it
Beside the hint property, there is also a method synfig::ParamDesc::set_is_distance() used by some parameters. It means the viewer and editor should present data as the unit-system chosen by the user in app preferences. By default, this parameter property is false, and should be explicitly set in the param_desc.
It seems the viewer (studio::CellRenderer_ValueBase) and editor (studio::Widget_ValueBase) don’t handle it well, ignoring it in some cases – by assuming it is true.