Changes between Initial Version and Version 2 of Ticket #6341


Ignore:
Timestamp:
2012-02-09T06:39:29+01:00 (14 years ago)
Author:
akks
Comment:

Replying to [stoecker]:

Replying to [akks]:

Another idea (I cannot find exact ticket but it is not new). Is it possible to protect all core shortcuts like Alt-A from automatic changing by plugins? Add some registerCoreShortcut, for example, with higher priority? When plugin intends explicitly to replace core shortcut, it should also call some special function.

This can prevent many problems...

This is not as easy as you think. JOSM core does not know what shortcuts it has, as they are initialized only, when function is activated. So not all shortcuts are known before the plugins are registered.

The initial shortcut handling had a "remember all shortcuts whenever seen at least once". I disabled that mode, as it would prevent fixing broken shortcuts (the users would get a permanently saved redirect shortcut, which is not changeable by program updates).

If you have a good idea how to work around this problem ...

Probably a timed "remember shortcut whenever seen" which drops the information after a certain unused time and also updates the value, when default changes. I.e. don't store the real final shortcut, but store the information which leads to that shortcut and simply reconstruct all core shortcuts on startup. Ideas and code welcome.

BTW: I deprecated the Shortcut calls passing modifiers as argument. They should be converted to proper usage of GROUPS_ALT1 and ALT2. I will update the table, so that it converts group to corresponding modifier in the list, so it is better human readable in future (when I have time...).

Idea of workaround:

  • Register core shortcuts with function different call (search&replace in core? or use something like CodeBase?)
  • Plugin shortcut can take core key if initialized earluier
  • When core registers the shortcut and notice that it is used by plugin, it should take it back and move plugin shortcut to other free or non-core key.

I do not know if this is possible. What do you think?

Legend:

Unmodified
Added
Removed
Modified