mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
Revert "gui-desktop : add keyboard shortcut to press OK/Yes button"
This commit is contained in:
@@ -113,16 +113,6 @@ public class KeyboardShortcuts {
|
||||
}
|
||||
};
|
||||
|
||||
/** Press OK Button */
|
||||
final Action actPressButton = new AbstractAction() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
if (!Singletons.getControl().getCurrentScreen().isMatchScreen()) { return; }
|
||||
if (matchUI == null) { return; }
|
||||
matchUI.getGameController().selectButtonOk();
|
||||
}
|
||||
};
|
||||
|
||||
/** Alpha Strike. */
|
||||
final Action actAllAttack = new AbstractAction() {
|
||||
@Override
|
||||
@@ -225,7 +215,6 @@ public class KeyboardShortcuts {
|
||||
list.add(new Shortcut(FPref.SHORTCUT_MACRO_RECORD, localizer.getMessage("lblSHORTCUT_MACRO_RECORD"), actMacroRecord, am, im));
|
||||
list.add(new Shortcut(FPref.SHORTCUT_MACRO_NEXT_ACTION, localizer.getMessage("lblSHORTCUT_MACRO_NEXT_ACTION"), actMacroNextAction, am, im));
|
||||
list.add(new Shortcut(FPref.SHORTCUT_CARD_ZOOM, localizer.getMessage("lblSHORTCUT_CARD_ZOOM"), actZoomCard, am, im));
|
||||
list.add(new Shortcut(FPref.SHORTCUT_PRESS_BUTTON, localizer.getMessage("lblSHORTCUT_PRESS_BUTTON"), actPressButton, am, im));
|
||||
return list;
|
||||
} // End initMatchShortcuts()
|
||||
|
||||
|
||||
@@ -40,8 +40,6 @@ import com.google.common.base.Function;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import forge.localinstance.properties.ForgePreferences;
|
||||
import forge.model.FModel;
|
||||
import forge.toolbox.FList;
|
||||
import forge.toolbox.FMouseAdapter;
|
||||
import forge.toolbox.FOptionPane;
|
||||
@@ -83,7 +81,6 @@ public class ListChooser<T> {
|
||||
// initialized before; listeners may be added to it
|
||||
private final FList<T> lstChoices;
|
||||
private final FOptionPane optionPane;
|
||||
private final int okShortCut = Integer.parseInt(FModel.getPreferences().getPref(ForgePreferences.FPref.SHORTCUT_PRESS_BUTTON));
|
||||
|
||||
public ListChooser(final String title, final int minChoices, final int maxChoices, final Collection<T> list, final Function<T, String> display) {
|
||||
FThreads.assertExecutedByEdt(true);
|
||||
@@ -131,8 +128,7 @@ public class ListChooser<T> {
|
||||
|
||||
this.lstChoices.addKeyListener(new KeyAdapter() {
|
||||
@Override public void keyPressed(final KeyEvent e) {
|
||||
int code = e.getKeyCode();
|
||||
if (KeyEvent.VK_ENTER == code || okShortCut == code) {
|
||||
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
|
||||
ListChooser.this.commit();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,9 +15,7 @@ import javax.swing.text.StyleConstants;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import forge.gui.FThreads;
|
||||
import forge.localinstance.properties.ForgePreferences;
|
||||
import forge.localinstance.skin.FSkinProp;
|
||||
import forge.model.FModel;
|
||||
import forge.toolbox.FSkin.SkinImage;
|
||||
import forge.util.Localizer;
|
||||
import forge.view.FDialog;
|
||||
@@ -182,7 +180,6 @@ public class FOptionPane extends FDialog {
|
||||
final int gapBottom = comp == null ? gapAboveButtons : padding;
|
||||
FLabel centeredLabel = null;
|
||||
FTextPane prompt = null;
|
||||
final int okShortCut = Integer.parseInt(FModel.getPreferences().getPref(ForgePreferences.FPref.SHORTCUT_PRESS_BUTTON));
|
||||
|
||||
if (icon != null) {
|
||||
if (icon.getWidth() < 100) {
|
||||
@@ -256,21 +253,27 @@ public class FOptionPane extends FDialog {
|
||||
btn.addKeyListener(new KeyAdapter() { //hook certain keys to move focus between buttons
|
||||
@Override
|
||||
public void keyPressed(final KeyEvent e) {
|
||||
int code = e.getKeyCode();
|
||||
if(okShortCut == code) {
|
||||
btn.doClick();
|
||||
}
|
||||
else if(KeyEvent.VK_LEFT == code && option > 0){
|
||||
buttons[option - 1].requestFocusInWindow();
|
||||
}
|
||||
else if( KeyEvent.VK_RIGHT == code && option < lastOption){
|
||||
buttons[option + 1].requestFocusInWindow();
|
||||
}
|
||||
else if(KeyEvent.VK_HOME == code && option > 0) {
|
||||
buttons[0].requestFocusInWindow();
|
||||
}
|
||||
else if(KeyEvent.VK_END == code && option < lastOption) {
|
||||
buttons[lastOption].requestFocusInWindow();
|
||||
switch (e.getKeyCode()) {
|
||||
case KeyEvent.VK_LEFT:
|
||||
if (option > 0) {
|
||||
buttons[option - 1].requestFocusInWindow();
|
||||
}
|
||||
break;
|
||||
case KeyEvent.VK_RIGHT:
|
||||
if (option < lastOption) {
|
||||
buttons[option + 1].requestFocusInWindow();
|
||||
}
|
||||
break;
|
||||
case KeyEvent.VK_HOME:
|
||||
if (option > 0) {
|
||||
buttons[0].requestFocusInWindow();
|
||||
}
|
||||
break;
|
||||
case KeyEvent.VK_END:
|
||||
if (option < lastOption) {
|
||||
buttons[lastOption].requestFocusInWindow();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user