Modify

Opened 3 years ago

Last modified 6 weeks ago

#4901 new enhancement

Presets: add radiobutton and checkbox types

Reported by: Am909 Owned by: team
Priority: normal Component: Core
Version: tested Keywords: presets fuel source_tag
Cc:

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 (2)

comment:1 Changed 16 months ago by simon04

  • Description modified (diff)
  • Summary changed from Proposed extensions to preset definitions to Presets: add radiobutton and checkbox types

comment:2 Changed 6 weeks ago by Manu1400

  • Keywords fuel source_tag added

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as new .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from team. Next status will be 'new'.
Next status will be 'needinfo'.The owner will change to Am909
as duplicate The resolution will be set to duplicate. Next status will be 'closed'.The specified ticket will be cross-referenced with this ticket
The owner will be changed from team to anonymous. Next status will be 'assigned'.
Author


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

 
Note: See TracTickets for help on using tickets.