Modify

Opened 11 years ago

Closed 7 years ago

Last modified 7 years ago

#4901 closed enhancement (fixed)

Presets: add checkbox type

Reported by: AM909 Owned by: team
Priority: normal Milestone:
Component: Core Version: tested
Keywords: presets fuel source_tag radiobutton Cc: lists@…

Description (last modified by simon04)

I'd like to propose the following extensions to the presets to make them more flexible and reduce the number of keystrokes/mouse clicks for common tasks:

Add radiobutton and checkbox types (in addition to text and combo).

A type="radio" group should allow 0 or 1 buttons to be selected.
A type="check" group should allow 0 or more buttons to be selected.

A radiobutton definition example:

<cbgroup type="radio" key="restriction" >
        <label text="Restriction" />
        <button value="no_u_turn" tooltip="No U-turn" icon="restriction_no_u_turn.png" default="yes" />
        <button value="no_left_turn" tooltip="No left turn" icon="restriction_no_left_turn.png" />
        ...
</cbgroup>

The button with default="yes" is selected by default. The result is to create a tag for the selected item with the specified key and the value associated with the selected button (e.g. restriction="no_u_turn" if no change is made to the default above).

A checkbox example:

<cbgroup type="check" key="source" >
        <label text="Source" />
        <button value="usgs_imagery" tooltip="USGS" icon="USGS.png" default="yes" />
        <button value="yahoo_imagery" tooltip="Yahoo" icon="Yahoo.png" />
        <button value="survey" tooltip="Survey" icon="survey.png" default="yes" />
        <button value="image" tooltip="Image" icon="image.png" default="yes" />
        ...
</cbgroup>

Any buttons with default="yes" are selected by default. In this case, where a key is specified in the cbgroup tag, the result is to create a tag for the selected item with the specified key and all the values associated with the selected buttons, delimited by semicolons (e.g. source="usgs_imagery;survey;image" if no change is made to the defaults above).

Another checkbox example:

<cbgroup type="check" >
        <label text="Available fuels" />
        <button key="propane" values="yes" tooltip="Propane" icon="propane.png" />
        <button key="diesel" values="yes" tooltip="Diesel" icon="diesel.png" />
        <button key="atm" values="no,yes," tooltip="ATM" icon="ATM.png" />
        ...
</cbgroup>

In this case, where there is no key specified in the cbgroup tag, each button has its own associated key and values. If one value is specified, it should be a two-state button, and the tag is created with the specified value if selected. If two values are specified, it should be a two-state button, and the tag is created with the first specified value if not selected, and the second specified value if selected. If three values are specified, it should be a three-state button, and the tag is created with the first/second/third values when de-selected/selected/third-state respectively. A value specified as empty (as in the third value for the third button above) should cause no tag to be created if chosen. Note this "multi-key" setup should work with type="radio" as well.

I'm picturing tool-button (like those that appear on toolbars) controls in order to conserve space. The controls for each cbgroup tag should be surrounded by a thin-line frame to visually group them together. The default should be to render them horizontally, but further extensions could be made to affect layout.

More traditional radiobutton and checkbox groups could be rendered as one choice per line, but would take more space. Might be easier to develop, though.

As always, thanks to those dedicated developers for listening, and making JOSM the great tool it is :)

Attachments (0)

Change History (6)

comment:1 Changed 10 years ago by simon04

Description: modified (diff)
Summary: Proposed extensions to preset definitionsPresets: add radiobutton and checkbox types

comment:2 Changed 8 years ago by Manu1400

Keywords: fuel source_tag added

comment:3 Changed 7 years ago by Don-vip

Keywords: radiobutton added
Summary: Presets: add radiobutton and checkbox typesPresets: add radiobutton type

Checkboxes have been added, they can even be regrouped:

checkgroup: group of checks
  columns: number of columns

check: checkbox
  key: key to set
  text: fixed label to display
  default: ticked on/off (default is "off")
  value_on: the value to set when checked (default is "yes")
  value_off: the value to set when unchecked (default is "no")
  disable_off: whether the off value is disabled in the dialog, i.e., only unset or yes are provided
  match: none/key/key!/keyvalue (default is "none", see below for more information)

Radiobutton has not been added yet.

comment:4 Changed 7 years ago by Aun Johnsen <lists@…>

Cc: lists@… added

comment:5 Changed 7 years ago by stoecker

Resolution: fixed
Status: newclosed

I don't think the missing radio buttons are a good addition at all.

comment:6 Changed 7 years ago by Don-vip

Summary: Presets: add radiobutton typePresets: add checkbox type

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.