fontforge/fontforge — pull request #120 by monkeyiq (2012-09-23 15:19:35+00:00)
Title: Vanilla 2012sep new hotkeys v2

This is an update to https://github.com/fontforge/fontforge/pull/95 I had to fetch upstream which changed many files and so I created a subbranch first. So a new pull req was also created. This now has autotools for the new files and a default hotkey for all users before locale based hotkeys and user specific ones.

I will fix the TODO items listed at the bottom of the request shortly and commit to this branch.

The interesting parts are in gmenu.c and hotkeys.c

Each window, the glyph, fontview, and metrics windows all have a new string
type assigned to them. Hotkeys can then be assigned to menu items by selecting
them in the key of the hotkey and the remainder defines the key to activate that
action. For example:
CharView.Menu.Point.Curve: 7
Will select point/curve from the menu when you hit "7".

The menu prefix is used to allow stand alone hotkeys to also exist. So in a
subsequent patch we might have
CharView.Hotkey.SpiroMode: ctl+5
to select an action to perform which is not exposed in the menu.

The hotkeys files are loaded from a subdirectory of the share
directory in your $prefix. First the "defaults" file is loaded, then your full locale is tried, perhaps
starting with en_AU.UTF-8 and then all dot and _ chars are trimmed one
at a time. So for me I would eventually load the "en" hotkeys file.

After these system wide hotkeys are loaded the ~/.FontForge/hotkeys file
is loaded allowing the user to overwrite the system selections.

The menu handling code is updated to work out what the hotkeys are for
each menu item and display what is currently set for the hotkey. So
for example, a binding like
CharView.Menu.File.Open: Ctl+g
will show the ^g in the menu as the description of the file/open menu
item.

Some initial provision for saving is there, but it saves to a /tmp/
file at the moment. The idea is to allow the hotkeys to be changed by
fontforge itself and customizations are automatically saved to only
~/.FontForge/hotkeys

This is why loadHotkeysFromFile() has the isUserDefined flag which is
retained for each individual hotkey. So then a save() of the hotkeys
can only save user defined hotkeys back to their ~/.FontForge/hotkeys
file.

Still todo:
Update hotkeyssave().
Update htdocs