Opened 14 years ago
Last modified 21 months ago
#5515 reopened enhancement
Single Key Shortcuts for activating and showing/hiding layers
Reported by: | AlfonZ | Owned by: | jttt |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Core shortcuts | Version: | |
Keywords: | layer shortcut | Cc: | stefanct, chriswhy |
Description (last modified by )
Reopened with a request for Single Key Shortcuts, see comment 25
I'd like to activate, show & hide layers using just keyboard shortcuts.
I have prepared a patch that creates shortcuts for this.
There will be 10 shortcuts for activating and 10 shortcuts for showing/hiding layers.
At first I thought to assign them to CTRL-1 to CTRL-0 and CTRL-SHIFT-1 to CTRL-SHIFT-0, but I wasn't sure if that's the right choice so I left them unassigned and user has to configure them in preferences.
Layers will be index-referenced. Does anybody use more than 10 layers at once?
This is my first patch for JOSM, so it needs proper review, especially shortcut names and texts for translation. Any feedback is welcome.
Attachments (1)
Change History (35)
by , 14 years ago
Attachment: | LayerShortcuts.diff added |
---|
comment:1 by , 13 years ago
Description: | modified (diff) |
---|
Ability to toggle between layers exists in the latest version 4542, but the ability to activate different layers with keyboard shortcuts does not seem to exist yet. This would be extremely handy because I regularly layer different datasets to update OSM, and switching between mouse and shortcuts is frustrating.
comment:2 by , 13 years ago
I'm working on adding multikey shortcuts that should solve this (feature inspired by shortcuts in eclipse). When finished, it would be possible to activate for example third layer by pressing Ctrl+Alt+A,3. I'm going to add shortcuts for activate layer, show/hide layer, jump to previous marker and jump to next marker.
comment:3 by , 13 years ago
Owner: | changed from | to
---|
comment:6 by , 13 years ago
- right click on data layer to see what shortcut is assigned for activating/hiding layers
- press shortcut and wait few seconds
- popup menu should be shown in right-bottom border with list of layers and assigned layer index
- press key assigned to layer
At which point it doesn't work? You don't have to always wait for menu to show up, you can press layer index key immediately. It's possible that selected shortcut doesn't work on your system, please try it with Activate layer, Show/hide layer and in Marker layer with Jump to next/previous marker.
comment:7 by , 13 years ago
Unfortunately, it is relly hard to make it work stable too. I have even removed all plugins...
The problem tis that popup is shown very rarely and in random moments:) Maybe Windows-specific problem?
Sometimes popup appear after several mouse clicks or even after switching the window...
It aclually performs layer switching by ctrl-alt-a,2 etc., but it took me 1/4 of an hour after reading this post s to learn this trick.
comment:8 by , 13 years ago
After looking at the source and debugging I figured it)
You need to
1) Press ctrl-alt-a, fast (do not hold it)
2) Do not press anything more!
3) Wait for 2 seconds - popup will appear.
I wonder, how to make it more clear for users...
Maybe, interval should be less? About 1 second or even less.
Elsewhere user will do something and will not notice anything.
Maybe, it would be better to show popup immediately, and REMOVE it after other clicks/keys (like now) or after 2 seconds (if there was no action).
And please renumber the layers - "0" button is too far from others, and not all of the mappers are programmers :)
comment:9 by , 13 years ago
I'll renumber it from 1, I didn't realize there is anything wrong with starting with zero ;-)
In normal usecase, it should be enough to press ctrl+alt+a and 1 to activate first layer (it's not necessary to release ctrl+alt). Popup menu is only additional hint in case user has lots of layers or doesn't know how this feature work. Thats reason for quite long interval, I didn't want popup menu to be shown every time. But 1 second should work fine.
This feature was inspired by similar feature in Eclipse, where after initial shortcut (ctrl+alt+a) is pressed it's shown in status bar and after some time menu is shown. Do you think it would help if after ctrl+alt+a is pressed, in status bar would appear "Activate layers" (and nothing else happened) and after 1 second menu would be shown?
comment:10 by , 13 years ago
Yes, I think status message, 1 second pause and renumbering will be enough to make it more obvious :)
Maybe message "Activate layer ...[please type its number]" or something like it will help)
I almost forget to thank you for this feature - it is really important and powerful!
comment:12 by , 13 years ago
I did some changes, I hope it's easier to understand now. It's quite trivial to add new multikey actions, do you have some suggestions which layer (or any other list) actions should be added?
comment:13 by , 13 years ago
Multikey shortcut for custom search actions (does not have a list, unfortunately) and/or filters can be useful, but I do not how many users use them intensively.
comment:14 by , 13 years ago
The behaviour is clear now, thank you!
But, I am afraid, popup text is invisible :) Just a gray rectangle with working menu items... Maybe, some internationalization issue.
It does not depend on system locale and Windows 7 Aero on/off (I checked). Also there are no error/warning messages in command line.
comment:15 by , 13 years ago
Do you mean popup title (name of action) or all entries? Did it work before? I've tested that only in linux, but I have WinXP in virtual box so I can try it there. If it's only title then it's probably caused by formatting (I've tried to make it centered and in italic).
Shorcuts for custom search/filters should be possible, I'll have a look at it.
comment:16 by , 13 years ago
All the entries are invisible, but clickable. There is no such problem in my Ubuntu VirtualBox :) (shortcut is itaic too, by the way).
comment:17 by , 13 years ago
It works fine in WinXP, you can try josm from http://jttt.110mb.com/josm-custom.jar, it has only removed italics for shorcuts. Otherwise it's completely standard popup menu, I have no idea why it shouldn't work in Win7
comment:19 by , 13 years ago
The problem is in
lbTitle.setHorizontalAlignment(JMenuItem.CENTER);
If you remove this line, all works perfectly.
comment:21 by , 13 years ago
Thank you!
Another simple idea - turn on/off map styles by multikey shortcut (we have only Ctrl-W for wireframe mode)
comment:22 by , 13 years ago
I think it works well now and the shortcuts Shift-A, Shift-S ar suitable :)
comment:23 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
comment:25 by , 12 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
i would like to have non-multikey shortcuts because they are still faster and more convenient (when importing data i need to switch between two data layers quite a lot to compare the features). i would not mind if there would be no keys assigned to it by default as long as i could assign them in the configuration menu. does anybody want to work on this? can some regular dev please tell me if such a patch would be merged? (should i open another ticket instead?)
comment:26 by , 12 years ago
Cc: | added |
---|
comment:27 by , 11 years ago
Component: | Core → Core shortcuts |
---|
comment:28 by , 6 years ago
Description: | modified (diff) |
---|---|
Summary: | Shortcuts for activating and showing/hiding layers → Single Key Shortcuts for activating and showing/hiding layers |
comment:29 by , 4 years ago
When I right-click on a layer in the Layers box, there is a shortcut shown there: Shift-S. Why does this only work within the context menu? Does Shift-S have another use within JOSM?
comment:30 by , 3 years ago
Cc: | added |
---|
comment:33 by , 21 months ago
Shift+A does nothing for me. Maybe because I have the MapWithAI plugin installed and that uses Shift+A for another purpose?
comment:34 by , 21 months ago
You can assign a different shortcut. See https://josm.openstreetmap.de/wiki/Help/Preferences/Shortcuts
patch