Modify

Opened 13 years ago

Closed 13 years ago

Last modified 13 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 13 years ago.
mappaintstyles.png (15.4 KB ) - added by simon04 13 years ago.
6895_v2.patch (4.5 KB ) - added by simon04 13 years ago.

Download all attachments as: .zip

Change History (21)

by simon04, 13 years ago

Attachment: 6895.patch added

by simon04, 13 years ago

Attachment: mappaintstyles.png added

comment:1 by simon04, 13 years ago

Description: modified (diff)

comment:2 by Don-vip, 13 years ago

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

in reply to:  2 comment:3 by simon04, 13 years ago

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 by bastiK, 13 years ago

Description: modified (diff)

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

in reply to:  description comment:5 by bastiK, 13 years ago

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 by stoecker, 13 years ago

Owner: changed from team to simon04
Status: newneedinfo

What is the status of this?

comment:7 by simon04, 13 years ago

Owner: changed from simon04 to team
Status: needinfonew

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

by simon04, 13 years ago

Attachment: 6895_v2.patch added

comment:8 by simon04, 13 years ago

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 by akks, 13 years ago

Is it possible to toggle styles by toolbar buttons?

comment:10 by simon04, 13 years ago

Yes.

comment:11 by simon04, 13 years ago

Resolution: fixed
Status: newclosed

In 5086/josm:

fix #6895 - Add Map Paint Styles to View menu

comment:12 by akks, 13 years ago

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 13 years ago by akks (previous) (diff)

comment:13 by simon04, 13 years ago

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 by bastiK, 13 years ago

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 by bastiK, 13 years ago

Works great, what about a toolbar button?

in reply to:  15 ; comment:16 by simon04, 13 years ago

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.)

in reply to:  16 comment:17 by bastiK, 13 years ago

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.

in reply to:  description comment:18 by simon04, 13 years ago

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. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.