Opened 9 years ago
Closed 9 years ago
#13510 closed defect (fixed)
View menu items are not disabled after last OSM data layer was removed
| Reported by: | openstreetmap.org-user-d1g | Owned by: | team |
|---|---|---|---|
| Priority: | minor | Milestone: | 16.10 |
| Component: | Core | Version: | |
| Keywords: | regression gsoc-core menu zoom | Cc: | michael2402 |
Description
What steps will reproduce the problem?
- create New layer
- remove it
What is the expected result?
Items in "Help/Menu/View" menu should be disabled, because there nothing to view/zoom/pan
What happens instead?
Items 4 and 5 are normal buttons
Please provide any additional information below. Attach a screenshot if possible.
URL:http://josm.openstreetmap.de/svn/trunk Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b Last:Changed Date: 2016-09-01 20:56:44 +0200 (Thu, 01 Sep 2016) Build-Date:2016-09-02 01:33:38 Revision:10929 Relative:URL: ^/trunk
Attachments (0)
Change History (13)
comment:1 by , 9 years ago
| Keywords: | disableditems added |
|---|
comment:2 by , 9 years ago
comment:3 by , 9 years ago
| Milestone: | → 16.08 |
|---|---|
| Priority: | trivial → minor |
comment:4 by , 9 years ago
| Keywords: | regression added; disableditems removed |
|---|
comment:5 by , 9 years ago
| Cc: | added |
|---|---|
| Keywords: | gsoc-core added |
@Michael: ZoomInAction.updateEnabledState() is called during layerRemoving event. At this time Main.getLayerManager().getLayers() is not (yet) empty. What's the best way to fix this?
follow-up: 7 comment:6 by , 9 years ago
There are several options for that:
- Register a
LayerAvailabilityListenerif we want to know if any layer is present or not (I prefer this one) - Register a
ActiveLayerChangeListenerif the option depends on the active layer (which may benull). - Use
isLastLayer()on theLayerRemoveEventto see if the last layer was removed. (quick, dirty)
The nice way would be to have a unified way for all menus to be disabled if all items are disabled. Then the menu items can simply be disabled. This is what I did in my main menu branch. We could bind the zoom actions directly to the map view and add them whenever the map view is added to the view, remove them otherwise.
comment:7 by , 9 years ago
| Keywords: | menu zoom added |
|---|---|
| Milestone: | 16.08 → 16.09 |
Replying to michael2402:
The nice way would be to have a unified way for all menus to be disabled if all items are disabled. Then the menu items can simply be disabled. This is what I did in my main menu branch.
OK let's fix this in next milestone then.
comment:9 by , 9 years ago
| Milestone: | 16.10 → 16.11 |
|---|
comment:11 by , 9 years ago
| Milestone: | 16.12 → 17.01 |
|---|
comment:12 by , 9 years ago
| Milestone: | 17.01 → 17.02 |
|---|
comment:13 by , 9 years ago
| Milestone: | 17.02 → 16.10 |
|---|---|
| Resolution: | → fixed |
| Status: | new → closed |
This has been fixed in r10998.



Do you mean "zoom in" and "zoom out"?