mirror of
https://github.com/correl/mage.git
synced 2024-11-28 19:19:55 +00:00
Fixing issue with GUI events being triggered prematurely when loading prefs (#7785)
This commit is contained in:
parent
b2c104c5ed
commit
af59cea62c
1 changed files with 12 additions and 3 deletions
|
@ -35,7 +35,7 @@ import static mage.client.constants.Constants.BATTLEFIELD_FEEDBACK_COLORIZING_MO
|
||||||
import static mage.constants.Constants.*;
|
import static mage.constants.Constants.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author nantuko, JayDi85
|
* @author nantuko, JayDi85, leemi
|
||||||
*/
|
*/
|
||||||
public class PreferencesDialog extends javax.swing.JDialog {
|
public class PreferencesDialog extends javax.swing.JDialog {
|
||||||
|
|
||||||
|
@ -321,6 +321,8 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
||||||
|
|
||||||
private static ThemeType currentTheme = null;
|
private static ThemeType currentTheme = null;
|
||||||
|
|
||||||
|
private static boolean ignoreGUISizeSliderStateChangedEvent = false;
|
||||||
|
|
||||||
public static ThemeType getCurrentTheme() {
|
public static ThemeType getCurrentTheme() {
|
||||||
if (currentTheme == null) {
|
if (currentTheme == null) {
|
||||||
currentTheme = ThemeType.valueByName(getCachedValue(KEY_THEME, "Default"));
|
currentTheme = ThemeType.valueByName(getCachedValue(KEY_THEME, "Default"));
|
||||||
|
@ -3299,7 +3301,12 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
||||||
}//GEN-LAST:event_cbThemeActionPerformed
|
}//GEN-LAST:event_cbThemeActionPerformed
|
||||||
|
|
||||||
private void sliderGUISizeStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_sliderGUISizeStateChanged
|
private void sliderGUISizeStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_sliderGUISizeStateChanged
|
||||||
saveGUISize();
|
// This prevents this event from firing during the initial
|
||||||
|
// setting of the sliders from pref values
|
||||||
|
if (!ignoreGUISizeSliderStateChangedEvent)
|
||||||
|
{
|
||||||
|
saveGUISize();
|
||||||
|
}
|
||||||
}//GEN-LAST:event_sliderGUISizeStateChanged
|
}//GEN-LAST:event_sliderGUISizeStateChanged
|
||||||
|
|
||||||
private void showProxySettings() {
|
private void showProxySettings() {
|
||||||
|
@ -3462,6 +3469,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void loadGuiSize(Preferences prefs) {
|
private static void loadGuiSize(Preferences prefs) {
|
||||||
|
ignoreGUISizeSliderStateChangedEvent = true;
|
||||||
load(prefs, dialog.sliderFontSize, KEY_GUI_TABLE_FONT_SIZE, "14");
|
load(prefs, dialog.sliderFontSize, KEY_GUI_TABLE_FONT_SIZE, "14");
|
||||||
load(prefs, dialog.sliderChatFontSize, KEY_GUI_CHAT_FONT_SIZE, "14");
|
load(prefs, dialog.sliderChatFontSize, KEY_GUI_CHAT_FONT_SIZE, "14");
|
||||||
load(prefs, dialog.sliderCardSizeHand, KEY_GUI_CARD_HAND_SIZE, "14");
|
load(prefs, dialog.sliderCardSizeHand, KEY_GUI_CARD_HAND_SIZE, "14");
|
||||||
|
@ -3475,6 +3483,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
||||||
load(prefs, dialog.sliderCardSizeOtherZones, KEY_GUI_CARD_OTHER_ZONES_SIZE, "14");
|
load(prefs, dialog.sliderCardSizeOtherZones, KEY_GUI_CARD_OTHER_ZONES_SIZE, "14");
|
||||||
load(prefs, dialog.sliderCardSizeMinBattlefield, KEY_GUI_CARD_BATTLEFIELD_MIN_SIZE, "10");
|
load(prefs, dialog.sliderCardSizeMinBattlefield, KEY_GUI_CARD_BATTLEFIELD_MIN_SIZE, "10");
|
||||||
load(prefs, dialog.sliderCardSizeMaxBattlefield, KEY_GUI_CARD_BATTLEFIELD_MAX_SIZE, "14");
|
load(prefs, dialog.sliderCardSizeMaxBattlefield, KEY_GUI_CARD_BATTLEFIELD_MAX_SIZE, "14");
|
||||||
|
ignoreGUISizeSliderStateChangedEvent = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void loadImagesSettings(Preferences prefs) {
|
private static void loadImagesSettings(Preferences prefs) {
|
||||||
|
|
Loading…
Reference in a new issue