Merge pull request #6419 from Card-Forge/revert-6234-ok_shortcut

Revert "gui-desktop : add keyboard shortcut to press OK/Yes button"
This commit is contained in:
kevlahnota
2024-10-24 07:35:01 +08:00
committed by GitHub
12 changed files with 23 additions and 44 deletions

View File

@@ -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. */ /** Alpha Strike. */
final Action actAllAttack = new AbstractAction() { final Action actAllAttack = new AbstractAction() {
@Override @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_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_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_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; return list;
} // End initMatchShortcuts() } // End initMatchShortcuts()

View File

@@ -40,8 +40,6 @@ import com.google.common.base.Function;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import forge.localinstance.properties.ForgePreferences;
import forge.model.FModel;
import forge.toolbox.FList; import forge.toolbox.FList;
import forge.toolbox.FMouseAdapter; import forge.toolbox.FMouseAdapter;
import forge.toolbox.FOptionPane; import forge.toolbox.FOptionPane;
@@ -83,7 +81,6 @@ public class ListChooser<T> {
// initialized before; listeners may be added to it // initialized before; listeners may be added to it
private final FList<T> lstChoices; private final FList<T> lstChoices;
private final FOptionPane optionPane; 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) { public ListChooser(final String title, final int minChoices, final int maxChoices, final Collection<T> list, final Function<T, String> display) {
FThreads.assertExecutedByEdt(true); FThreads.assertExecutedByEdt(true);
@@ -131,8 +128,7 @@ public class ListChooser<T> {
this.lstChoices.addKeyListener(new KeyAdapter() { this.lstChoices.addKeyListener(new KeyAdapter() {
@Override public void keyPressed(final KeyEvent e) { @Override public void keyPressed(final KeyEvent e) {
int code = e.getKeyCode(); if (e.getKeyCode() == KeyEvent.VK_ENTER) {
if (KeyEvent.VK_ENTER == code || okShortCut == code) {
ListChooser.this.commit(); ListChooser.this.commit();
} }
} }

View File

@@ -15,9 +15,7 @@ import javax.swing.text.StyleConstants;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import forge.gui.FThreads; import forge.gui.FThreads;
import forge.localinstance.properties.ForgePreferences;
import forge.localinstance.skin.FSkinProp; import forge.localinstance.skin.FSkinProp;
import forge.model.FModel;
import forge.toolbox.FSkin.SkinImage; import forge.toolbox.FSkin.SkinImage;
import forge.util.Localizer; import forge.util.Localizer;
import forge.view.FDialog; import forge.view.FDialog;
@@ -182,7 +180,6 @@ public class FOptionPane extends FDialog {
final int gapBottom = comp == null ? gapAboveButtons : padding; final int gapBottom = comp == null ? gapAboveButtons : padding;
FLabel centeredLabel = null; FLabel centeredLabel = null;
FTextPane prompt = null; FTextPane prompt = null;
final int okShortCut = Integer.parseInt(FModel.getPreferences().getPref(ForgePreferences.FPref.SHORTCUT_PRESS_BUTTON));
if (icon != null) { if (icon != null) {
if (icon.getWidth() < 100) { if (icon.getWidth() < 100) {
@@ -256,22 +253,28 @@ public class FOptionPane extends FDialog {
btn.addKeyListener(new KeyAdapter() { //hook certain keys to move focus between buttons btn.addKeyListener(new KeyAdapter() { //hook certain keys to move focus between buttons
@Override @Override
public void keyPressed(final KeyEvent e) { public void keyPressed(final KeyEvent e) {
int code = e.getKeyCode(); switch (e.getKeyCode()) {
if(okShortCut == code) { case KeyEvent.VK_LEFT:
btn.doClick(); if (option > 0) {
}
else if(KeyEvent.VK_LEFT == code && option > 0){
buttons[option - 1].requestFocusInWindow(); buttons[option - 1].requestFocusInWindow();
} }
else if( KeyEvent.VK_RIGHT == code && option < lastOption){ break;
case KeyEvent.VK_RIGHT:
if (option < lastOption) {
buttons[option + 1].requestFocusInWindow(); buttons[option + 1].requestFocusInWindow();
} }
else if(KeyEvent.VK_HOME == code && option > 0) { break;
case KeyEvent.VK_HOME:
if (option > 0) {
buttons[0].requestFocusInWindow(); buttons[0].requestFocusInWindow();
} }
else if(KeyEvent.VK_END == code && option < lastOption) { break;
case KeyEvent.VK_END:
if (option < lastOption) {
buttons[lastOption].requestFocusInWindow(); buttons[lastOption].requestFocusInWindow();
} }
break;
}
} }
}); });
if (option == defaultOption) { if (option == defaultOption) {

View File

@@ -418,7 +418,6 @@ lblSHORTCUT_AUTOYIELD_ALWAYS_NO=Duel: Auto-Bestätigen von Fähigkeiten auf dem
lblSHORTCUT_MACRO_RECORD=Duell: Aktion-Abfolge-Makro aufnehmen lblSHORTCUT_MACRO_RECORD=Duell: Aktion-Abfolge-Makro aufnehmen
lblSHORTCUT_MACRO_NEXT_ACTION=Duel: führe nächste Aktion im gespeicherten Makro aus lblSHORTCUT_MACRO_NEXT_ACTION=Duel: führe nächste Aktion im gespeicherten Makro aus
lblSHORTCUT_CARD_ZOOM=Duell: Zoome ausgewählte Karte lblSHORTCUT_CARD_ZOOM=Duell: Zoome ausgewählte Karte
lblSHORTCUT_PRESS_BUTTON=Duell: Drücken Sie die OK/Ja-Taste
#VSubmenuDraft.java #VSubmenuDraft.java
lblBoosterDraft=Booster-Draft lblBoosterDraft=Booster-Draft
lblHeaderBoosterDraft=Format: Booster-Draft lblHeaderBoosterDraft=Format: Booster-Draft

View File

@@ -420,7 +420,6 @@ lblSHORTCUT_AUTOYIELD_ALWAYS_NO=Match: auto-yield ability on stack (Always No)
lblSHORTCUT_MACRO_RECORD=Match: record a macro sequence of actions lblSHORTCUT_MACRO_RECORD=Match: record a macro sequence of actions
lblSHORTCUT_MACRO_NEXT_ACTION=Match: execute next action in a recorded macro lblSHORTCUT_MACRO_NEXT_ACTION=Match: execute next action in a recorded macro
lblSHORTCUT_CARD_ZOOM=Match: zoom the currently selected card lblSHORTCUT_CARD_ZOOM=Match: zoom the currently selected card
lblSHORTCUT_PRESS_BUTTON=Match: Press OK/Yes button
#VSubmenuDraft.java #VSubmenuDraft.java
lblBoosterDraft=Booster Draft lblBoosterDraft=Booster Draft
lblHeaderBoosterDraft=Sanctioned Format: Booster Draft lblHeaderBoosterDraft=Sanctioned Format: Booster Draft

View File

@@ -418,7 +418,6 @@ lblSHORTCUT_SHOWTARGETING=Partida: alternar la orientación visual de superposic
lblSHORTCUT_AUTOYIELD_ALWAYS_YES=Partida: ceder automáticamente en cada habilidad de la pila (Siempre Sí) lblSHORTCUT_AUTOYIELD_ALWAYS_YES=Partida: ceder automáticamente en cada habilidad de la pila (Siempre Sí)
lblSHORTCUT_AUTOYIELD_ALWAYS_NO=Partida: ceder automáticamente en cada habilidad de la pila (Siempre No) lblSHORTCUT_AUTOYIELD_ALWAYS_NO=Partida: ceder automáticamente en cada habilidad de la pila (Siempre No)
lblSHORTCUT_MACRO_RECORD=Partida: Grabar una macro de secuencia de acciones lblSHORTCUT_MACRO_RECORD=Partida: Grabar una macro de secuencia de acciones
lblSHORTCUT_PRESS_BUTTON=Partida: Presione el botón Aceptar/Sí
lblSHORTCUT_MACRO_NEXT_ACTION=Partida: Ejecutar siguiente acción en una macro grabada lblSHORTCUT_MACRO_NEXT_ACTION=Partida: Ejecutar siguiente acción en una macro grabada
lblSHORTCUT_CARD_ZOOM=Partida: hacer zoom en la carta seleccionada lblSHORTCUT_CARD_ZOOM=Partida: hacer zoom en la carta seleccionada
#VSubmenuDraft.java #VSubmenuDraft.java

View File

@@ -416,7 +416,6 @@ lblSHORTCUT_SHOWTARGETING=Correspondance : basculer la superposition visuelle du
lblSHORTCUT_AUTOYIELD_ALWAYS_YES=Match : capacité de rendement automatique sur la pile (toujours oui) lblSHORTCUT_AUTOYIELD_ALWAYS_YES=Match : capacité de rendement automatique sur la pile (toujours oui)
lblSHORTCUT_AUTOYIELD_ALWAYS_NO=Match : capacité de rendement automatique sur la pile (toujours non) lblSHORTCUT_AUTOYIELD_ALWAYS_NO=Match : capacité de rendement automatique sur la pile (toujours non)
lblSHORTCUT_MACRO_RECORD=Match : enregistrer une macro séquence d''actions lblSHORTCUT_MACRO_RECORD=Match : enregistrer une macro séquence d''actions
lblSHORTCUT_PRESS_BUTTON=Match: appuyez sur le bouton OK/Oui
lblSHORTCUT_MACRO_NEXT_ACTION=Match : exécuter l''action suivante dans une macro enregistrée lblSHORTCUT_MACRO_NEXT_ACTION=Match : exécuter l''action suivante dans une macro enregistrée
lblSHORTCUT_CARD_ZOOM=Match : zoomer la carte actuellement sélectionnée lblSHORTCUT_CARD_ZOOM=Match : zoomer la carte actuellement sélectionnée
#VSubmenuDraft.java #VSubmenuDraft.java

View File

@@ -415,7 +415,6 @@ lblSHORTCUT_SHOWTARGETING=Incontro: attiva / disattiva gli indicatori dei bersag
lblSHORTCUT_AUTOYIELD_ALWAYS_YES=Incontro: consenso automatico in pila: sempre Sì lblSHORTCUT_AUTOYIELD_ALWAYS_YES=Incontro: consenso automatico in pila: sempre Sì
lblSHORTCUT_AUTOYIELD_ALWAYS_NO=Incontro: consenso automatico in pila: sempre No lblSHORTCUT_AUTOYIELD_ALWAYS_NO=Incontro: consenso automatico in pila: sempre No
lblSHORTCUT_MACRO_RECORD=Incontro: registra una macro (sequenza di azioni) lblSHORTCUT_MACRO_RECORD=Incontro: registra una macro (sequenza di azioni)
lblSHORTCUT_PRESS_BUTTON=Incontro: premere il pulsante OK/Sì
lblSHORTCUT_MACRO_NEXT_ACTION=Incontro: esegue l''azione successiva in una macro registrata lblSHORTCUT_MACRO_NEXT_ACTION=Incontro: esegue l''azione successiva in una macro registrata
lblSHORTCUT_CARD_ZOOM=Incontro: ingrandisce la carta attualmente selezionata lblSHORTCUT_CARD_ZOOM=Incontro: ingrandisce la carta attualmente selezionata
#VSubmenuDraft.java #VSubmenuDraft.java

View File

@@ -416,7 +416,6 @@ lblSHORTCUT_SHOWTARGETING=ビジュアルオーバーレイのターゲットを
lblSHORTCUT_AUTOYIELD_ALWAYS_YES=スタック解決時、優先権の自動放棄(常にはい) lblSHORTCUT_AUTOYIELD_ALWAYS_YES=スタック解決時、優先権の自動放棄(常にはい)
lblSHORTCUT_AUTOYIELD_ALWAYS_NO=スタック解決時、優先権の自動放棄(常にいいえ) lblSHORTCUT_AUTOYIELD_ALWAYS_NO=スタック解決時、優先権の自動放棄(常にいいえ)
lblSHORTCUT_MACRO_RECORD=アクションのマクロシーケンスを記録します lblSHORTCUT_MACRO_RECORD=アクションのマクロシーケンスを記録します
lblSHORTCUT_PRESS_BUTTON=はいボタンを押してください
lblSHORTCUT_MACRO_NEXT_ACTION=記録されたマクロで次のアクションを実行します lblSHORTCUT_MACRO_NEXT_ACTION=記録されたマクロで次のアクションを実行します
lblSHORTCUT_CARD_ZOOM=現在選択されているカードをズームします lblSHORTCUT_CARD_ZOOM=現在選択されているカードをズームします
#VSubmenuDraft.java #VSubmenuDraft.java

View File

@@ -428,7 +428,6 @@ lblSHORTCUT_SHOWTARGETING=Partida\: mudar a indicação visual do alvo
lblSHORTCUT_AUTOYIELD_ALWAYS_YES=Partida\: resolver automático a pilha (Sempre Sim) lblSHORTCUT_AUTOYIELD_ALWAYS_YES=Partida\: resolver automático a pilha (Sempre Sim)
lblSHORTCUT_AUTOYIELD_ALWAYS_NO=Partida\: resolver automático a pilha (Sempre Não) lblSHORTCUT_AUTOYIELD_ALWAYS_NO=Partida\: resolver automático a pilha (Sempre Não)
lblSHORTCUT_MACRO_RECORD=Partida\: grave uma sequência macro das ações lblSHORTCUT_MACRO_RECORD=Partida\: grave uma sequência macro das ações
lblSHORTCUT_PRESS_BUTTON=Partida\: pressione o bot<6F>o OK/Sim
lblSHORTCUT_MACRO_NEXT_ACTION=Partida\: execute a próxima ação em uma macro gravada lblSHORTCUT_MACRO_NEXT_ACTION=Partida\: execute a próxima ação em uma macro gravada
lblSHORTCUT_CARD_ZOOM=Partida\: amplie a carta selecionada atual lblSHORTCUT_CARD_ZOOM=Partida\: amplie a carta selecionada atual
#VSubmenuDraft.java #VSubmenuDraft.java

View File

@@ -420,7 +420,6 @@ lblSHORTCUT_AUTOYIELD_ALWAYS_NO=匹配:自动让过堆叠中的异能(所有
lblSHORTCUT_MACRO_RECORD=匹配:记录操作宏的动作序列 lblSHORTCUT_MACRO_RECORD=匹配:记录操作宏的动作序列
lblSHORTCUT_MACRO_NEXT_ACTION=匹配:在录制的宏中执行下一个操作 lblSHORTCUT_MACRO_NEXT_ACTION=匹配:在录制的宏中执行下一个操作
lblSHORTCUT_CARD_ZOOM=匹配:缩放当前选定的图片 lblSHORTCUT_CARD_ZOOM=匹配:缩放当前选定的图片
lblSHORTCUT_PRESS_BUTTON=按“是”按钮
#VSubmenuDraft.java #VSubmenuDraft.java
lblBoosterDraft=轮抓 lblBoosterDraft=轮抓
lblHeaderBoosterDraft=游戏模式:轮抓 lblHeaderBoosterDraft=游戏模式:轮抓

View File

@@ -283,8 +283,7 @@ public class ForgePreferences extends PreferencesStore<ForgePreferences.FPref> {
SHORTCUT_AUTOYIELD_ALWAYS_NO ("78"), SHORTCUT_AUTOYIELD_ALWAYS_NO ("78"),
SHORTCUT_MACRO_RECORD ("16 82"), SHORTCUT_MACRO_RECORD ("16 82"),
SHORTCUT_MACRO_NEXT_ACTION ("16 50"), SHORTCUT_MACRO_NEXT_ACTION ("16 50"),
SHORTCUT_CARD_ZOOM("90"), SHORTCUT_CARD_ZOOM("90");
SHORTCUT_PRESS_BUTTON("32");
private final String strDefaultVal; private final String strDefaultVal;