Skip to content

Commit 7662015

Browse files
[MOD] GUI: Shortcuts revised (mostly Mac)
1 parent 2e1e05b commit 7662015

3 files changed

Lines changed: 12 additions & 17 deletions

File tree

basex-core/src/main/java/org/basex/gui/GUIMenuCmd.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public void execute(final GUI gui) {
101101
},
102102

103103
/** Closes the database. */
104-
C_CLOSE(CLOSE, "% Q", true, false) {
104+
C_CLOSE(CLOSE, Prop.MAC ? null : "% Q", true, false) {
105105
@Override
106106
public void execute(final GUI gui) {
107107
gui.execute(new Close());
@@ -494,7 +494,7 @@ public boolean enabled(final GUI gui) {
494494
},
495495

496496
/** Filters the currently marked nodes. */
497-
C_FILTER_NODES(FILTER_SELECTED, "alt DOWN", true, false) {
497+
C_FILTER_NODES(FILTER_SELECTED, null, true, false) {
498498
@Override
499499
public void execute(final GUI gui) {
500500
final Context ctx = gui.context;
@@ -808,7 +808,7 @@ public void execute(final GUI gui) {
808808
},
809809

810810
/** Shows a preference dialog. */
811-
C_PREFERENCES(PREFERENCES + DOTS, Prop.MAC ? "% COMMA" : "% shift P", false, false) {
811+
C_PREFERENCES(PREFERENCES + DOTS, Prop.MAC ? null : "% shift P", false, false) {
812812
@Override
813813
public void execute(final GUI gui) {
814814
DialogPrefs.show(gui);
@@ -852,7 +852,7 @@ public void execute(final GUI gui) {
852852
/* BROWSE COMMANDS */
853853

854854
/** Goes one step back. */
855-
C_GO_BACK(GO_BACK, "alt LEFT", true, false) {
855+
C_GO_BACK(GO_BACK, Prop.MAC ? null : "alt LEFT", true, false) {
856856
@Override
857857
public void execute(final GUI gui) {
858858
gui.notify.hist(false);
@@ -865,7 +865,7 @@ public boolean enabled(final GUI gui) {
865865
},
866866

867867
/** Goes one step forward. */
868-
C_GO_FORWARD(GO_FORWARD, "alt RIGHT", true, false) {
868+
C_GO_FORWARD(GO_FORWARD, Prop.MAC ? null : "alt RIGHT", true, false) {
869869
@Override
870870
public void execute(final GUI gui) {
871871
gui.notify.hist(true);
@@ -878,7 +878,7 @@ public boolean enabled(final GUI gui) {
878878
},
879879

880880
/** Goes one level up. */
881-
C_GO_UP(GO_UP, "alt UP", true, false) {
881+
C_GO_UP(GO_UP, null, true, false) {
882882
@Override
883883
public void execute(final GUI gui) {
884884
// skip operation for root context
@@ -913,7 +913,7 @@ public boolean enabled(final GUI gui) {
913913
},
914914

915915
/** Goes to the root node. */
916-
C_GO_HOME(GO_HOME, "alt HOME", true, false) {
916+
C_GO_HOME(GO_HOME, Prop.MAC ? null : "alt HOME", true, false) {
917917
@Override
918918
public void execute(final GUI gui) {
919919
// skip operation for root context

basex-core/src/main/java/org/basex/gui/layout/BaseXKeys.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,10 @@ public enum BaseXKeys {
7676
/** Previous tab. */ PREVTAB(CTRL | SHIFT, VK_TAB),
7777
/** Close tab. */ CLOSETAB(META, VK_F4),
7878

79-
/** Go back. */ GOBACK(MAC ? META : ALT, VK_LEFT),
80-
/** Go forward. */ GOFORWARD(MAC ? META : ALT, VK_RIGHT),
81-
/** Go up. */ GOUP(MAC ? META : ALT, VK_PAGE_UP),
82-
/** Go down. */ FILTER(MAC ? META : ALT, VK_PAGE_DOWN),
83-
/** Go home. */ GOHOME(MAC ? META : ALT, VK_HOME),
79+
// browse shortcuts: disabled with Mac, as ALT and META are reserved for cursor movements
80+
/** Go back. */ GOBACK(ALT, VK_LEFT),
81+
/** Go forward. */ GOFORWARD(ALT, VK_RIGHT),
82+
/** Go home. */ GOHOME(ALT, VK_HOME),
8483

8584
/** Go to line. */ GOTOLINE(META, VK_L),
8685

basex-core/src/main/java/org/basex/gui/layout/BaseXLayout.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -334,17 +334,13 @@ public static void addInteraction(final Component comp, final BaseXWindow win) {
334334
private static KeyListener globalShortcuts(final GUI gui) {
335335
if(keys == null) keys = (KeyPressedListener) e -> {
336336
// browse back/forward
337-
if(gui.context.data() != null) {
337+
if(!Prop.MAC && gui.context.data() != null) {
338338
if(GOBACK.is(e)) {
339339
GUIMenuCmd.C_GO_BACK.execute(gui);
340340
} else if(GOFORWARD.is(e)) {
341341
GUIMenuCmd.C_GO_FORWARD.execute(gui);
342-
} else if(GOUP.is(e)) {
343-
GUIMenuCmd.C_GO_UP.execute(gui);
344342
} else if(GOHOME.is(e)) {
345343
GUIMenuCmd.C_GO_HOME.execute(gui);
346-
} else if(FILTER.is(e)) {
347-
GUIMenuCmd.C_FILTER_NODES.execute(gui);
348344
}
349345
}
350346

0 commit comments

Comments
 (0)