Modify

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#6895 closed enhancement (fixed)

[Patch] Add Map Paint Styles to View menu

Reported by: simon04 Owned by: team
Priority: normal Milestone:
Component: Core Version:
Keywords: style menu toolbar Cc:

Description (last modified by bastiK)

In order to achieve #6731, I'd like to add all available Map Paint Styles to the View menu. Available styles can be toggled through the menu, which removes the necessity to view/hide the toggle dialog when this is seldom needed.

What I couldn't manage to get working is to add the new menu entry "Map Paint Styles" to the toolbar for a quicker access. The problem I encountered is that I cannot inherit from JMenu (for submenu entries) and JosmAction (for registration for toolbar) simultaneously. I hope anyone knows how to solve this :-).


Attachments (3)

6895.patch (3.6 KB) - added by simon04 12 years ago.
mappaintstyles.png (15.4 KB) - added by simon04 12 years ago.
6895_v2.patch (4.5 KB) - added by simon04 12 years ago.

Download all attachments as: .zip

Change History (21)

Changed 12 years ago by simon04

Attachment: 6895.patch added

Changed 12 years ago by simon04

Attachment: mappaintstyles.png added

comment:1 Changed 12 years ago by simon04

Description: modified (diff)

comment:2 Changed 12 years ago by Don-vip

Create another action that simply displays the menu ? (with the menu being a public final field of Main class)

comment:3 in reply to:  2 Changed 12 years ago by simon04

Replying to Don-vip:

Create another action that simply displays the menu ?

Could you sketch that in more detail, please? Which code goes to the actionPerformed method?

comment:4 Changed 12 years ago by bastiK

Description: modified (diff)

Why not copy TaggingPresets code? This seems to work the way you want.

comment:5 in reply to:  description Changed 12 years ago by bastiK

Replying to simon04:

In order to achieve #6731, I'd like to add all available Map Paint Styles to the View menu. Available styles can be toggled through the menu, which removes the necessity to view/hide the toggle dialog when this is seldom needed.

One problem I always had with Map Paint Styles in the Menu is that you cannot easily switch between 2 "alpha styles". First, you have to deactivate the current style and then activate the new one (or the other way around). This adds up to 6 mouse clicks compared to 4 clicks with toggle dialog (including activating and deactivating it). But as a toolbar button it would be more efficient, I'd suggest to have it in the toolbar by default.

The problem could be solved by adding a property "alpha" to the style, which means it is normally not used at the same time as another alpha style. These styles would have a radio button in front and not a checkbox. I postponed this idea because currently it works well and offers more freedom to the user.

comment:6 Changed 12 years ago by stoecker

Owner: changed from team to simon04
Status: newneedinfo

What is the status of this?

comment:7 Changed 12 years ago by simon04

Owner: changed from simon04 to team
Status: needinfonew

No progress from my side. I'm happy if someone else can fix the remaining issue.

Changed 12 years ago by simon04

Attachment: 6895_v2.patch added

comment:8 Changed 12 years ago by simon04

Summary: [Patch needs rework] Add Map Paint Styles to View menu[Patch] Add Map Paint Styles to View menu

Attached new version. Seems to be working fine while testing, please take a look at the code.

Drawback: When adding a new style via preferences, removing it again, and adding it a second time, a

Registered toolbar action mappaint/Surface overwritten: org.openstreetmap.josm.gui.mappaint.MapPaintMenu$MapPaintAction gets org.openstreetmap.josm.gui.mappaint.MapPaintMenu$MapPaintAction

is printed to the console. To avoid this, does it make sense to add the following method?

Main.toolbar.register(Action action, boolean ignoreOverwriting)

comment:9 Changed 12 years ago by akks

Is it possible to toggle styles by toolbar buttons?

comment:10 Changed 12 years ago by simon04

Yes.

comment:11 Changed 12 years ago by simon04

Resolution: fixed
Status: newclosed

In 5086/josm:

fix #6895 - Add Map Paint Styles to View menu

comment:12 Changed 12 years ago by akks

Resolution: fixed
Status: closedreopened

Is looks good!

Maybe it can be useful to add configuration button after style list. Then this menu item can fully replace toggle dialog for non-experts (moving up/down in the list is more expert thing).

(please re-close if wontfix :-) )

Last edited 12 years ago by akks (previous) (diff)

comment:13 Changed 12 years ago by simon04

Resolution: fixed
Status: reopenedclosed

In 5088/josm:

fix #6895 - improve MapPaintMenu (add "Preference", keep menu open after clicking checkbox) - thanks: http://tips4java.wordpress.com/2010/09/12/keeping-menus-open/

comment:14 Changed 12 years ago by bastiK

Please put

// License: GPL. For details, see LICENSE file.

at the top of each new file.

(Quote "You are free to use and/or modify any or all code posted on the Java Tips Weblog without restriction.")

comment:15 Changed 12 years ago by bastiK

Works great, what about a toolbar button?

comment:16 in reply to:  15 ; Changed 12 years ago by simon04

Replying to bastiK:

Works great, what about a toolbar button?

You suggest to have that button by default? (Adding the button(s) manually should already work.)

comment:17 in reply to:  16 Changed 12 years ago by bastiK

Replying to simon04:

Replying to bastiK:

Works great, what about a toolbar button?

You suggest to have that button by default?

Not sure yet, maybe later.

(Adding the button(s) manually should already work.)

Individual styles work (without toggle effect), but not the top level styles menu entry.

comment:18 in reply to:  description Changed 12 years ago by simon04

I guess, I forgot the remaining issue when considering this ticket for the second time. So this is still to be done …

Replying to simon04:

What I couldn't manage to get working is to add the new menu entry "Map Paint Styles" to the toolbar for a quicker access. The problem I encountered is that I cannot inherit from JMenu (for submenu entries) and JosmAction (for registration for toolbar) simultaneously. I hope anyone knows how to solve this :-).

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.