mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
Add key options to prefs dialog
This commit is contained in:
parent
ae2765885f
commit
d7a3904569
3 changed files with 1398 additions and 1014 deletions
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package mage.client.components;
|
||||
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.KeyListener;
|
||||
import javax.swing.JToggleButton;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Campbell Suter <znix@znix.xyz>
|
||||
*/
|
||||
public class KeyBindButton extends JToggleButton implements KeyListener {
|
||||
|
||||
private int keyCode;
|
||||
private String text;
|
||||
|
||||
public KeyBindButton() {
|
||||
fixText();
|
||||
addKeyListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyTyped(KeyEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyReleased(KeyEvent e) {
|
||||
if (!isSelected()) {
|
||||
return;
|
||||
}
|
||||
keyCode = e.getKeyCode();
|
||||
fixText();
|
||||
setSelected(false);
|
||||
System.out.println("text: " + text);
|
||||
}
|
||||
|
||||
private void fixText() {
|
||||
if (keyCode == 0) {
|
||||
text = "<None>";
|
||||
} else {
|
||||
text = KeyEvent.getKeyText(keyCode);
|
||||
}
|
||||
repaint();
|
||||
}
|
||||
|
||||
public void setKeyCode(int keyCode) {
|
||||
this.keyCode = keyCode;
|
||||
fixText();
|
||||
}
|
||||
|
||||
public int getKeyCode() {
|
||||
return keyCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
}
|
|
@ -5874,6 +5874,159 @@
|
|||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="tabControls">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
|
||||
<JTabbedPaneConstraints tabName="Controls">
|
||||
<Property name="tabTitle" type="java.lang.String" value="Controls"/>
|
||||
</JTabbedPaneConstraints>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="labelCancel" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="labelNextTurn" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="labelEndStep" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="labelMainStep" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="labelYourTurn" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lebelSkip" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="labelPriorEnd" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="keySkipStack" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="keyYourTurn" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="keyNextTurn" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="keyCancelSkip" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="keyEndStep" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="keyMainStep" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="keyPriorEnd" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace pref="483" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="labelCancel" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="keyCancelSkip" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="labelNextTurn" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="keyNextTurn" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="labelEndStep" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="keyEndStep" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="labelMainStep" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="keyMainStep" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="labelYourTurn" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="keyYourTurn" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="lebelSkip" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="keySkipStack" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="labelPriorEnd" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="keyPriorEnd" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace pref="301" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="labelNextTurn">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Next Turn"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="labelEndStep">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="End Step"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="labelMainStep">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Main Step"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="labelYourTurn">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Your Turn"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="lebelSkip">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Skip Stack"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="labelPriorEnd">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Prior End"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="labelCancel">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Cancel Skip"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="mage.client.components.KeyBindButton" name="keyCancelSkip">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="keyBindButton1"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="mage.client.components.KeyBindButton" name="keyNextTurn">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="keyBindButton1"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="mage.client.components.KeyBindButton" name="keyMainStep">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="keyBindButton1"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="mage.client.components.KeyBindButton" name="keyEndStep">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="keyBindButton1"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="mage.client.components.KeyBindButton" name="keyYourTurn">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="keyBindButton1"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="mage.client.components.KeyBindButton" name="keySkipStack">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="keyBindButton1"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="mage.client.components.KeyBindButton" name="keyPriorEnd">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="keyBindButton1"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="javax.swing.JButton" name="saveButton">
|
||||
|
|
|
@ -37,6 +37,7 @@ import java.awt.BorderLayout;
|
|||
import java.awt.Color;
|
||||
import java.awt.Image;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.image.BufferedImage;
|
||||
|
@ -60,6 +61,7 @@ import javax.swing.border.Border;
|
|||
import javax.swing.filechooser.FileFilter;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.SessionHandler;
|
||||
import mage.client.components.KeyBindButton;
|
||||
import mage.client.util.Config;
|
||||
import mage.client.util.GUISizeHelper;
|
||||
import mage.client.util.ImageHelper;
|
||||
|
@ -292,6 +294,15 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
public static final String KEY_PROXY_PSWD = "proxyPassword";
|
||||
public static final String KEY_CONNECTION_URL_SERVER_LIST = "connectionURLServerList";
|
||||
|
||||
// controls
|
||||
public static final String KEY_CONTROL_CANCEL_SKIP = "controlCancelSkip";
|
||||
public static final String KEY_CONTROL_NEXT_TURN = "controlNextTurn";
|
||||
public static final String KEY_CONTROL_END_STEP = "controlEndStep";
|
||||
public static final String KEY_CONTROL_MAIN_STEP = "controlMainStep";
|
||||
public static final String KEY_CONTROL_YOUR_TURN = "controlYourTurn";
|
||||
public static final String KEY_CONTROL_SKIP_STACK = "controlSkipStack";
|
||||
public static final String KEY_CONTROL_PRIOR_END = "controlPriorEnd";
|
||||
|
||||
public static final String KEY_AVATAR = "selectedId";
|
||||
|
||||
public static final String KEY_CONNECT_AUTO_CONNECT = "autoConnect";
|
||||
|
@ -538,6 +549,21 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
txtPasswordField = new javax.swing.JPasswordField();
|
||||
rememberPswd = new javax.swing.JCheckBox();
|
||||
jLabel11 = new javax.swing.JLabel();
|
||||
tabControls = new javax.swing.JPanel();
|
||||
labelNextTurn = new javax.swing.JLabel();
|
||||
labelEndStep = new javax.swing.JLabel();
|
||||
labelMainStep = new javax.swing.JLabel();
|
||||
labelYourTurn = new javax.swing.JLabel();
|
||||
lebelSkip = new javax.swing.JLabel();
|
||||
labelPriorEnd = new javax.swing.JLabel();
|
||||
labelCancel = new javax.swing.JLabel();
|
||||
keyCancelSkip = new mage.client.components.KeyBindButton();
|
||||
keyNextTurn = new mage.client.components.KeyBindButton();
|
||||
keyMainStep = new mage.client.components.KeyBindButton();
|
||||
keyEndStep = new mage.client.components.KeyBindButton();
|
||||
keyYourTurn = new mage.client.components.KeyBindButton();
|
||||
keySkipStack = new mage.client.components.KeyBindButton();
|
||||
keyPriorEnd = new mage.client.components.KeyBindButton();
|
||||
saveButton = new javax.swing.JButton();
|
||||
exitButton = new javax.swing.JButton();
|
||||
|
||||
|
@ -579,7 +605,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
.add(main_cardLayout.createSequentialGroup()
|
||||
.add(6, 6, 6)
|
||||
.add(main_cardLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
|
||||
.add(tooltipDelayLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 308, Short.MAX_VALUE)
|
||||
.add(tooltipDelayLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 308, Short.MAX_VALUE)
|
||||
.add(org.jdesktop.layout.GroupLayout.LEADING, showCardName)
|
||||
.add(tooltipDelay, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
|
@ -2440,6 +2466,95 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
|
||||
tabsPanel.addTab("Connection", tabConnection);
|
||||
|
||||
labelNextTurn.setText("Next Turn");
|
||||
|
||||
labelEndStep.setText("End Step");
|
||||
|
||||
labelMainStep.setText("Main Step");
|
||||
|
||||
labelYourTurn.setText("Your Turn");
|
||||
|
||||
lebelSkip.setText("Skip Stack");
|
||||
|
||||
labelPriorEnd.setText("Prior End");
|
||||
|
||||
labelCancel.setText("Cancel Skip");
|
||||
|
||||
keyCancelSkip.setText("keyBindButton1");
|
||||
|
||||
keyNextTurn.setText("keyBindButton1");
|
||||
|
||||
keyMainStep.setText("keyBindButton1");
|
||||
|
||||
keyEndStep.setText("keyBindButton1");
|
||||
|
||||
keyYourTurn.setText("keyBindButton1");
|
||||
|
||||
keySkipStack.setText("keyBindButton1");
|
||||
|
||||
keyPriorEnd.setText("keyBindButton1");
|
||||
|
||||
org.jdesktop.layout.GroupLayout tabControlsLayout = new org.jdesktop.layout.GroupLayout(tabControls);
|
||||
tabControls.setLayout(tabControlsLayout);
|
||||
tabControlsLayout.setHorizontalGroup(
|
||||
tabControlsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
|
||||
.add(tabControlsLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.add(tabControlsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
|
||||
.add(labelCancel)
|
||||
.add(labelNextTurn)
|
||||
.add(labelEndStep)
|
||||
.add(labelMainStep)
|
||||
.add(labelYourTurn)
|
||||
.add(lebelSkip)
|
||||
.add(labelPriorEnd))
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
|
||||
.add(tabControlsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
|
||||
.add(keySkipStack, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
|
||||
.add(keyYourTurn, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
|
||||
.add(keyNextTurn, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
|
||||
.add(keyCancelSkip, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
|
||||
.add(keyEndStep, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
|
||||
.add(keyMainStep, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
|
||||
.add(keyPriorEnd, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
|
||||
.addContainerGap(483, Short.MAX_VALUE))
|
||||
);
|
||||
tabControlsLayout.setVerticalGroup(
|
||||
tabControlsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
|
||||
.add(tabControlsLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.add(tabControlsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
|
||||
.add(labelCancel)
|
||||
.add(keyCancelSkip, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
|
||||
.add(tabControlsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
|
||||
.add(labelNextTurn)
|
||||
.add(keyNextTurn, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
|
||||
.add(tabControlsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
|
||||
.add(labelEndStep)
|
||||
.add(keyEndStep, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
|
||||
.add(tabControlsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
|
||||
.add(labelMainStep)
|
||||
.add(keyMainStep, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
|
||||
.add(tabControlsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
|
||||
.add(labelYourTurn)
|
||||
.add(keyYourTurn, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
|
||||
.add(tabControlsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
|
||||
.add(lebelSkip)
|
||||
.add(keySkipStack, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
|
||||
.add(tabControlsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
|
||||
.add(labelPriorEnd)
|
||||
.add(keyPriorEnd, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
|
||||
.addContainerGap(301, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
tabsPanel.addTab("Controls", tabControls);
|
||||
|
||||
saveButton.setLabel("Save");
|
||||
saveButton.setMaximumSize(new java.awt.Dimension(100, 30));
|
||||
saveButton.setMinimumSize(new java.awt.Dimension(100, 30));
|
||||
|
@ -2628,6 +2743,15 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
}
|
||||
save(prefs, dialog.txtURLServerList, KEY_CONNECTION_URL_SERVER_LIST);
|
||||
|
||||
// controls
|
||||
save(prefs, dialog.keyCancelSkip, KEY_CONTROL_CANCEL_SKIP);
|
||||
save(prefs, dialog.keyNextTurn, KEY_CONTROL_NEXT_TURN);
|
||||
save(prefs, dialog.keyEndStep, KEY_CONTROL_END_STEP);
|
||||
save(prefs, dialog.keyMainStep, KEY_CONTROL_MAIN_STEP);
|
||||
save(prefs, dialog.keyYourTurn, KEY_CONTROL_YOUR_TURN);
|
||||
save(prefs, dialog.keySkipStack, KEY_CONTROL_SKIP_STACK);
|
||||
save(prefs, dialog.keyPriorEnd, KEY_CONTROL_PRIOR_END);
|
||||
|
||||
// Avatar
|
||||
if (selectedAvatarId < MIN_AVATAR_ID || selectedAvatarId > MAX_AVATAR_ID) {
|
||||
selectedAvatarId = DEFAULT_AVATAR_ID;
|
||||
|
@ -3000,6 +3124,9 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
// Connection
|
||||
loadProxySettings(prefs);
|
||||
|
||||
// Controls
|
||||
loadControlSettings(prefs);
|
||||
|
||||
// Selected avatar
|
||||
loadSelectedAvatar(prefs);
|
||||
|
||||
|
@ -3161,6 +3288,16 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
load(prefs, dialog.txtURLServerList, KEY_CONNECTION_URL_SERVER_LIST, "http://XMage.de/files/server-list.txt");
|
||||
}
|
||||
|
||||
private static void loadControlSettings(Preferences prefs) {
|
||||
load(prefs, dialog.keyCancelSkip, KEY_CONTROL_CANCEL_SKIP, KeyEvent.VK_F3);
|
||||
load(prefs, dialog.keyNextTurn, KEY_CONTROL_NEXT_TURN, KeyEvent.VK_F4);
|
||||
load(prefs, dialog.keyEndStep, KEY_CONTROL_END_STEP, KeyEvent.VK_F5);
|
||||
load(prefs, dialog.keyMainStep, KEY_CONTROL_MAIN_STEP, KeyEvent.VK_F7);
|
||||
load(prefs, dialog.keyYourTurn, KEY_CONTROL_YOUR_TURN, KeyEvent.VK_F9);
|
||||
load(prefs, dialog.keySkipStack, KEY_CONTROL_SKIP_STACK, KeyEvent.VK_F10);
|
||||
load(prefs, dialog.keyPriorEnd, KEY_CONTROL_PRIOR_END, KeyEvent.VK_F11);
|
||||
}
|
||||
|
||||
private static void loadSelectedAvatar(Preferences prefs) {
|
||||
getSelectedAvatar();
|
||||
dialog.setSelectedId(selectedAvatarId);
|
||||
|
@ -3285,6 +3422,11 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
load(prefs, checkBox, propName, PHASE_ON);
|
||||
}
|
||||
|
||||
private static void load(Preferences prefs, KeyBindButton button, String propName, int defaultValue) {
|
||||
int prop = prefs.getInt(propName, defaultValue);
|
||||
button.setKeyCode(prop);
|
||||
}
|
||||
|
||||
private static void save(Preferences prefs, JCheckBox checkBox, String propName) {
|
||||
save(prefs, checkBox, propName, PHASE_ON, PHASE_OFF, false);
|
||||
}
|
||||
|
@ -3322,6 +3464,12 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
updateCache(propName, comboBox.getSelectedItem().toString().trim());
|
||||
}
|
||||
|
||||
private static void save(Preferences prefs, KeyBindButton button, String propName) {
|
||||
int code = button.getKeyCode();
|
||||
prefs.putInt(propName, code);
|
||||
updateCache(propName, Integer.toString(code));
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
tabsPanel.setSelectedIndex(0);
|
||||
}
|
||||
|
@ -3562,6 +3710,14 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
private javax.swing.JPanel jPanel31;
|
||||
private javax.swing.JPanel jPanel32;
|
||||
private javax.swing.JPanel jPanel33;
|
||||
private mage.client.components.KeyBindButton keyCancelSkip;
|
||||
private mage.client.components.KeyBindButton keyEndStep;
|
||||
private mage.client.components.KeyBindButton keyMainStep;
|
||||
private mage.client.components.KeyBindButton keyNextTurn;
|
||||
private mage.client.components.KeyBindButton keyPriorEnd;
|
||||
private mage.client.components.KeyBindButton keySkipStack;
|
||||
private mage.client.components.KeyBindButton keyYourTurn;
|
||||
private javax.swing.JLabel labelCancel;
|
||||
private javax.swing.JLabel labelCardSizeHand;
|
||||
private javax.swing.JLabel labelCardSizeMaxBattlefield;
|
||||
private javax.swing.JLabel labelCardSizeMinBattlefield;
|
||||
|
@ -3569,18 +3725,24 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
private javax.swing.JLabel labelDialogFont;
|
||||
private javax.swing.JLabel labelEditorCardOffset;
|
||||
private javax.swing.JLabel labelEditorCardSize;
|
||||
private javax.swing.JLabel labelEndStep;
|
||||
private javax.swing.JLabel labelEnlargedImageSize;
|
||||
private javax.swing.JLabel labelGameFeedback;
|
||||
private javax.swing.JLabel labelMainStep;
|
||||
private javax.swing.JLabel labelNextTurn;
|
||||
private javax.swing.JLabel labelNumberOfDownloadThreads;
|
||||
private javax.swing.JLabel labelPreferedImageLanguage;
|
||||
private javax.swing.JLabel labelPriorEnd;
|
||||
private javax.swing.JLabel labelStackWidth;
|
||||
private javax.swing.JLabel labelTooltipSize;
|
||||
private javax.swing.JLabel labelYourTurn;
|
||||
private javax.swing.JLabel lblProxyPassword;
|
||||
private javax.swing.JLabel lblProxyPort;
|
||||
private javax.swing.JLabel lblProxyServer;
|
||||
private javax.swing.JLabel lblProxyType;
|
||||
private javax.swing.JLabel lblProxyUserName;
|
||||
private javax.swing.JLabel lblURLServerList;
|
||||
private javax.swing.JLabel lebelSkip;
|
||||
private javax.swing.JPanel main_card;
|
||||
private javax.swing.JPanel main_game;
|
||||
private javax.swing.JPanel main_gamelog;
|
||||
|
@ -3612,6 +3774,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
private javax.swing.JPanel sounds_clips;
|
||||
private javax.swing.JPanel tabAvatars;
|
||||
private javax.swing.JPanel tabConnection;
|
||||
private javax.swing.JPanel tabControls;
|
||||
private javax.swing.JPanel tabGuiSize;
|
||||
private javax.swing.JPanel tabImages;
|
||||
private javax.swing.JPanel tabMain;
|
||||
|
|
Loading…
Reference in a new issue