Commit e0bf8ff
Add setting for modifier requirement to key bindings for each tab
Changed files (5)
modifiedlibbirdfont/FontDisplay.valamodifiedlibbirdfont/KerningDisplay.valamodifiedlibbirdfont/Menu.valamodifiedlibbirdfont/Preview.valamodifiedlibbirdfont/SpacingTab.vala
Diff
@@ -156,6 +156,11 @@ public abstract class FontDisplay : GLib.Object { public static File find_file (string? dir, string name) { return SearchPaths.find_file (dir, name); }++ /** returns false if bindings to a single key works in the display. */+ public virtual bool needs_modifier () {+ return false;+ } } }@@ -1019,7 +1019,11 @@ public class KerningDisplay : FontDisplay { KerningTools.zoom_bar.set_zoom (KerningTools.font_size / 3); GlyphCanvas.redraw (); }- ++ public override bool needs_modifier () {+ return true;+ }+ public class UndoItem : GLib.Object { public string first; public string next;@@ -478,8 +478,8 @@ public class Menu : GLib.Object { } display = current_display.get_name ();- - if (!((display == "Kerning" || display == "Spacing" || display == "Preview") && item.modifiers == NONE)) {++ if (!current_display.needs_modifier () || item.modifiers != NONE) { if (!SettingsDisplay.update_key_bindings && (item.display == "" || item.display == display)) { item.action ();@@ -140,5 +140,10 @@ public class Preview : FontDisplay { } return sb.str; }+ + public override bool needs_modifier () {+ return true;+ }+ } }@@ -270,6 +270,11 @@ public class SpacingTab : KerningDisplay { text_input = true; TabContent.show_text_input (listener); }++ public override bool needs_modifier () {+ return true;+ }+ } }