Modify

Opened 14 years ago

Last modified 13 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 Hb---)

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)

LayerShortcuts.diff (4.0 KB ) - added by AlfonZ 14 years ago.
patch

Download all attachments as: .zip

Change History (35)

by AlfonZ, 14 years ago

Attachment: LayerShortcuts.diff added

patch

comment:1 by PJHouser, 12 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 jttt, 12 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 jttt, 12 years ago

Owner: changed from team to jttt

comment:4 by jttt, 12 years ago

Resolution: fixed
Status: newclosed

In [4596/josm]:

Fix #5515 Shortcuts for activating and showing/hiding layers

comment:5 by PJHouser, 12 years ago

Resolution: fixed
Status: closedreopened

I can't get it to work.

comment:6 by jttt, 12 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 akks, 12 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.

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

comment:8 by akks, 12 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 :)

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

comment:9 by jttt, 12 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 akks, 12 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:11 by jttt, 12 years ago

In [4604/josm]:

Multikey action improvements (see #5515):

  • show text in status bar after shortcut is pressed
  • number layers from 1
  • do not allow Repeat for last layer if layer index conflicts with shortcut

comment:12 by jttt, 12 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 akks, 12 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 akks, 12 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.

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

comment:15 by jttt, 12 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 akks, 12 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 jttt, 12 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:18 by akks, 12 years ago

The problem persists on Win7...
I am looking at the code...

comment:19 by akks, 12 years ago

The problem is in
lbTitle.setHorizontalAlignment(JMenuItem.CENTER);

If you remove this line, all works perfectly.

comment:20 by jttt, 12 years ago

In [4615/josm]:

Use different way to center popup menu title to prevent blank menu on Windows 7, add shortcuts to enable/hiding of filters (see #5515)

comment:21 by akks, 12 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 akks, 12 years ago

I think it works well now and the shortcuts Shift-A, Shift-S ar suitable :)

comment:23 by akks, 12 years ago

Resolution: fixed
Status: reopenedclosed

comment:24 by skyper, 12 years ago

Ticket #7343 has been marked as a duplicate of this ticket.

comment:25 by stefanct, 11 years ago

Resolution: fixed
Status: closedreopened

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 stefanct, 11 years ago

Cc: stefanct added

comment:27 by Don-vip, 10 years ago

Component: CoreCore shortcuts

comment:28 by Hb---, 5 years ago

Description: modified (diff)
Summary: Shortcuts for activating and showing/hiding layersSingle Key Shortcuts for activating and showing/hiding layers

comment:29 by chriswhy, 3 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 chriswhy, 3 years ago

Cc: chriswhy added

comment:32 by chriswhy, 3 years ago

@skyper, thanks, just what I was looking for.

comment:33 by Will <will@…>, 13 months ago

Shift+A does nothing for me. Maybe because I have the MapWithAI plugin installed and that uses Shift+A for another purpose?

Modify Ticket

Change Properties
Set your email in Preferences
Action
as reopened The owner will remain jttt.
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from jttt to the specified user. Next status will be 'new'.
Next status will be 'needinfo'. The owner will be changed from jttt to AlfonZ.
as duplicate The resolution will be set to duplicate. Next status will be 'closed'. The specified ticket will be cross-referenced with this ticket.

Add Comment


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