Add reset keys to default button

This commit is contained in:
Campbell Suter 2016-10-21 09:33:56 +13:00
parent 4c292466c1
commit 0428f5bab3
No known key found for this signature in database
GPG key ID: 754A66CCF3F73C0F
2 changed files with 88 additions and 46 deletions

View file

@ -5889,30 +5889,38 @@
<Group type="102" alignment="0" 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"/>
<Component id="labelSkipStep" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="labelConfirm" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" attributes="0">
<Component id="bttnResetControls" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Group type="102" 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"/>
<Component id="labelSkipStep" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="labelConfirm" 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="keyConfirm" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="keyCancelSkip" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="keyNextTurn" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="keySkipStack" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="keyYourTurn" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="keyMainStep" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="keyPriorEnd" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="keySkipStep" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="keyEndStep" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="controlsDescriptionLabel" pref="498" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="keyConfirm" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="keyCancelSkip" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="keyNextTurn" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="keySkipStack" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="keyYourTurn" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="keyMainStep" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="keyPriorEnd" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="keySkipStep" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="keyEndStep" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="controlsDescriptionLabel" pref="498" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
@ -5970,7 +5978,9 @@
</Group>
</Group>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="bttnResetControls" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -6099,6 +6109,14 @@
<Property name="verticalAlignment" type="int" value="1"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="bttnResetControls">
<Properties>
<Property name="text" type="java.lang.String" value="Reset to default"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="bttnResetControlsActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>

View file

@ -574,6 +574,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
keyConfirm = new KeyBindButton(this, KEY_CONTROL_CONFIRM);
labelConfirm = new javax.swing.JLabel();
controlsDescriptionLabel = new javax.swing.JLabel();
bttnResetControls = new javax.swing.JButton();
saveButton = new javax.swing.JButton();
exitButton = new javax.swing.JButton();
@ -2515,6 +2516,13 @@ public class PreferencesDialog extends javax.swing.JDialog {
controlsDescriptionLabel.setText("<html>Click on a button and press a key to change a keybind.<br>Space and ESC are not available, and will set the keybind to nothing.<br>If you are currently playing a game, the changes will not take effect until you start a new game.");
controlsDescriptionLabel.setVerticalAlignment(javax.swing.SwingConstants.TOP);
bttnResetControls.setText("Reset to default");
bttnResetControls.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bttnResetControlsActionPerformed(evt);
}
});
org.jdesktop.layout.GroupLayout tabControlsLayout = new org.jdesktop.layout.GroupLayout(tabControls);
tabControls.setLayout(tabControlsLayout);
tabControlsLayout.setHorizontalGroup(
@ -2522,28 +2530,33 @@ public class PreferencesDialog extends javax.swing.JDialog {
.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)
.add(labelSkipStep)
.add(labelConfirm))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
.add(tabControlsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(keyConfirm, 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(keyNextTurn, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.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(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)
.add(keySkipStep, 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))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(controlsDescriptionLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 498, Short.MAX_VALUE)
.add(tabControlsLayout.createSequentialGroup()
.add(bttnResetControls)
.add(0, 0, Short.MAX_VALUE))
.add(tabControlsLayout.createSequentialGroup()
.add(tabControlsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(labelCancel)
.add(labelNextTurn)
.add(labelEndStep)
.add(labelMainStep)
.add(labelYourTurn)
.add(lebelSkip)
.add(labelPriorEnd)
.add(labelSkipStep)
.add(labelConfirm))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
.add(tabControlsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(keyConfirm, 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(keyNextTurn, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.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(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)
.add(keySkipStep, 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))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(controlsDescriptionLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 498, Short.MAX_VALUE)))
.addContainerGap())
);
tabControlsLayout.setVerticalGroup(
@ -2588,6 +2601,8 @@ public class PreferencesDialog extends javax.swing.JDialog {
.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))))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
.add(bttnResetControls)
.addContainerGap())
);
@ -3081,6 +3096,14 @@ public class PreferencesDialog extends javax.swing.JDialog {
// TODO add your handling code here:
}//GEN-LAST:event_cbCardRenderHideSetSymbolActionPerformed
private void bttnResetControlsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bttnResetControlsActionPerformed
getKeybindButtons().stream().forEach((bttn) -> {
String id = bttn.getKey();
int keyCode = getDefaultControlKey(id);
bttn.setKeyCode(keyCode);
});
}//GEN-LAST:event_bttnResetControlsActionPerformed
private void showProxySettings() {
Connection.ProxyType proxyType = (Connection.ProxyType) cbProxyType.getSelectedItem();
switch (proxyType) {
@ -3713,6 +3736,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
private javax.swing.JButton btnBrowseBackgroundImage;
private javax.swing.JButton btnBrowseBattlefieldImage;
private javax.swing.JButton btnBrowseImageLocation;
private javax.swing.JButton bttnResetControls;
private javax.swing.JCheckBox cbAllowRequestToShowHandCards;
private javax.swing.JCheckBox cbAskMoveToGraveOrder;
private javax.swing.JCheckBox cbAutoOrderTrigger;