#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 )
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)
Change History (21)
by , 13 years ago
Attachment: | 6895.patch added |
---|
by , 13 years ago
Attachment: | mappaintstyles.png added |
---|
comment:1 by , 13 years ago
Description: | modified (diff) |
---|
follow-up: 3 comment:2 by , 13 years ago
comment:3 by , 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 , 13 years ago
Description: | modified (diff) |
---|
Why not copy TaggingPresets code? This seems to work the way you want.
comment:5 by , 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 , 13 years ago
Owner: | changed from | to
---|---|
Status: | new → needinfo |
What is the status of this?
comment:7 by , 13 years ago
Owner: | changed from | to
---|---|
Status: | needinfo → new |
No progress from my side. I'm happy if someone else can fix the remaining issue.
by , 13 years ago
Attachment: | 6895_v2.patch added |
---|
comment:8 by , 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:12 by , 13 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
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 :-) )
comment:14 by , 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.")
follow-up: 17 comment:16 by , 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.)
comment:17 by , 13 years ago
comment:18 by , 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) andJosmAction
(for registration for toolbar) simultaneously. I hope anyone knows how to solve this :-).
Create another action that simply displays the menu ? (with the menu being a public final field of Main class)