- New Visual Themes setting to hide or show background image on match screen. Default show.

This commit is contained in:
spr
2013-07-15 19:19:01 +00:00
parent cada68dee5
commit 299ab754b3
4 changed files with 475 additions and 450 deletions

View File

@@ -61,6 +61,7 @@ import forge.gui.match.nonsingleton.VField;
import forge.gui.match.views.VAntes; import forge.gui.match.views.VAntes;
import forge.gui.toolbox.FSkin; import forge.gui.toolbox.FSkin;
import forge.net.NetServer; import forge.net.NetServer;
import forge.properties.ForgePreferences.FPref;
import forge.properties.NewConstants; import forge.properties.NewConstants;
import forge.quest.data.QuestPreferences.QPref; import forge.quest.data.QuestPreferences.QPref;
import forge.quest.io.QuestDataIO; import forge.quest.io.QuestDataIO;
@@ -223,7 +224,7 @@ public enum FControl {
case MATCH_SCREEN: case MATCH_SCREEN:
VMatchUI.SINGLETON_INSTANCE.populate(); VMatchUI.SINGLETON_INSTANCE.populate();
FView.SINGLETON_INSTANCE.getPnlInsets().setVisible(true); FView.SINGLETON_INSTANCE.getPnlInsets().setVisible(true);
FView.SINGLETON_INSTANCE.getPnlInsets().setForegroundImage(FSkin.getIcon(FSkin.Backgrounds.BG_MATCH)); showMatchBackgroundImage();
Singletons.getView().getFrame().addWindowListener(waConcede); Singletons.getView().getFrame().addWindowListener(waConcede);
SOverlayUtils.showTargetingOverlay(); SOverlayUtils.showTargetingOverlay();
break; break;
@@ -253,6 +254,16 @@ public enum FControl {
} }
} }
private void showMatchBackgroundImage() {
if (isMatchBackgroundImageVisible()) {
FView.SINGLETON_INSTANCE.getPnlInsets().setForegroundImage(FSkin.getIcon(FSkin.Backgrounds.BG_MATCH));
}
}
private boolean isMatchBackgroundImageVisible() {
return Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_MATCH_IMAGE_VISIBLE);
}
public void changeStateAutoFixLayout(Screens newState, String stateName) { public void changeStateAutoFixLayout(Screens newState, String stateName) {
try { try {
changeState(newState); changeState(newState);

View File

@@ -83,6 +83,7 @@ public enum CSubmenuPreferences implements ICDoc {
lstControls.add(Pair.of(view.getCbOverlayCardName(), FPref.UI_OVERLAY_CARD_NAME)); lstControls.add(Pair.of(view.getCbOverlayCardName(), FPref.UI_OVERLAY_CARD_NAME));
lstControls.add(Pair.of(view.getCbOverlayCardPower(), FPref.UI_OVERLAY_CARD_POWER)); lstControls.add(Pair.of(view.getCbOverlayCardPower(), FPref.UI_OVERLAY_CARD_POWER));
lstControls.add(Pair.of(view.getCbOverlayCardManaCost(), FPref.UI_OVERLAY_CARD_MANA_COST)); lstControls.add(Pair.of(view.getCbOverlayCardManaCost(), FPref.UI_OVERLAY_CARD_MANA_COST));
lstControls.add(Pair.of(view.getCbShowMatchBackgroundImage(), FPref.UI_MATCH_IMAGE_VISIBLE));
for(final Pair<JCheckBox, FPref> kv : lstControls) { for(final Pair<JCheckBox, FPref> kv : lstControls) {
kv.getKey().addItemListener(new ItemListener() { kv.getKey().addItemListener(new ItemListener() {
@@ -121,11 +122,13 @@ public enum CSubmenuPreferences implements ICDoc {
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see forge.control.home.IControlSubmenu#update() * @see forge.control.home.IControlSubmenu#update()
*/ */
@Override @Override
public void update() { public void update() {
this.view = VSubmenuPreferences.SINGLETON_INSTANCE; this.view = VSubmenuPreferences.SINGLETON_INSTANCE;
this.prefs = Singletons.getModel().getPreferences(); this.prefs = Singletons.getModel().getPreferences();

View File

@@ -22,7 +22,6 @@ import javax.swing.border.MatteBorder;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import forge.GameLogEntryType; import forge.GameLogEntryType;
import forge.Singletons; import forge.Singletons;
import forge.control.KeyboardShortcuts; import forge.control.KeyboardShortcuts;
@@ -82,6 +81,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
private final JCheckBox cbOverlayCardPower = new OptionsCheckBox("Power/Toughness"); private final JCheckBox cbOverlayCardPower = new OptionsCheckBox("Power/Toughness");
private final JCheckBox cbOverlayCardManaCost = new OptionsCheckBox("Mana Cost"); private final JCheckBox cbOverlayCardManaCost = new OptionsCheckBox("Mana Cost");
private final JCheckBox cbCompactMainMenu = new OptionsCheckBox("Use Compact Main Sidebar Menu"); private final JCheckBox cbCompactMainMenu = new OptionsCheckBox("Use Compact Main Sidebar Menu");
private final JCheckBox cbShowMatchBackgroundImage = new OptionsCheckBox("Show Background Image on Match Screen");
private final Map<FPref, KeyboardShortcutField> shortcutFields = new HashMap<FPref, KeyboardShortcutField>(); private final Map<FPref, KeyboardShortcutField> shortcutFields = new HashMap<FPref, KeyboardShortcutField>();
@@ -167,12 +167,17 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
pnlPrefs.add(cbpGameLogEntryType, "w 80%!, gap 10% 0 0 10px, span 2 1"); pnlPrefs.add(cbpGameLogEntryType, "w 80%!, gap 10% 0 0 10px, span 2 1");
pnlPrefs.add(new NoteLabel("Changes how much information is displayed in the game log. Sorted by least to most verbose."), regularConstraints); pnlPrefs.add(new NoteLabel("Changes how much information is displayed in the game log. Sorted by least to most verbose."), regularConstraints);
// Themes // Themes
pnlPrefs.add(new SectionLabel("Visual Themes"), sectionConstraints + ", gaptop 2%"); pnlPrefs.add(new SectionLabel("Visual Themes"), sectionConstraints + ", gaptop 2%");
pnlPrefs.add(cbpSkin, "w 80%!, gap 10% 0 0 10px, span 2 1"); pnlPrefs.add(cbpSkin, "w 80%!, gap 10% 0 0 10px, span 2 1");
pnlPrefs.add(new NoteLabel("Change the overall look and feel of Forge (RESTART REQUIRED)."), regularConstraints); pnlPrefs.add(new NoteLabel("Change the overall look and feel of Forge (RESTART REQUIRED)."), regularConstraints);
pnlPrefs.add(cbShowMatchBackgroundImage, regularConstraints);
pnlPrefs.add(new NoteLabel("Toggle the visibility of the background image on the match screen."), regularConstraints);
// Graphic Options // Graphic Options
pnlPrefs.add(new SectionLabel("Graphic Options"), sectionConstraints + ", gaptop 2%"); pnlPrefs.add(new SectionLabel("Graphic Options"), sectionConstraints + ", gaptop 2%");
@@ -188,13 +193,14 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
pnlPrefs.add(cbUiForTouchScreen, regularConstraints); pnlPrefs.add(cbUiForTouchScreen, regularConstraints);
pnlPrefs.add(new NoteLabel("Increases some UI elements to provide a better experience on touchscreen devices. (Needs restart)"), regularConstraints); pnlPrefs.add(new NoteLabel("Increases some UI elements to provide a better experience on touchscreen devices. (Needs restart)"), regularConstraints);
// Overlay options // Card Overlay options
pnlPrefs.add(new SectionLabel("Card Overlay Options"), sectionConstraints); pnlPrefs.add(new SectionLabel("Card Overlay Options"), sectionConstraints);
pnlPrefs.add(new NoteLabel("Show text overlays which are easier to read when cards are reduced in size to fit the play area."), regularConstraints); pnlPrefs.add(new NoteLabel("Show text overlays which are easier to read when cards are reduced in size to fit the play area."), regularConstraints);
pnlPrefs.add(cbOverlayCardName, regularConstraints); pnlPrefs.add(cbOverlayCardName, regularConstraints);
pnlPrefs.add(cbOverlayCardPower, regularConstraints); pnlPrefs.add(cbOverlayCardPower, regularConstraints);
pnlPrefs.add(cbOverlayCardManaCost, regularConstraints); pnlPrefs.add(cbOverlayCardManaCost, regularConstraints);
// Sound options // Sound options
pnlPrefs.add(new SectionLabel("Sound Options"), sectionConstraints + ", gaptop 2%"); pnlPrefs.add(new SectionLabel("Sound Options"), sectionConstraints + ", gaptop 2%");
@@ -204,6 +210,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
pnlPrefs.add(cbAltSoundSystem, regularConstraints); pnlPrefs.add(cbAltSoundSystem, regularConstraints);
pnlPrefs.add(new NoteLabel("Use the alternate sound system (only use in case your have issues with sound not playing or disappearing)"), regularConstraints); pnlPrefs.add(new NoteLabel("Use the alternate sound system (only use in case your have issues with sound not playing or disappearing)"), regularConstraints);
// Keyboard shortcuts // Keyboard shortcuts
final JLabel lblShortcuts = new SectionLabel("Keyboard Shortcuts"); final JLabel lblShortcuts = new SectionLabel("Keyboard Shortcuts");
pnlPrefs.add(lblShortcuts, sectionConstraints + ", gaptop 2%"); pnlPrefs.add(lblShortcuts, sectionConstraints + ", gaptop 2%");
@@ -467,6 +474,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
public FComboBoxPanel<String> getSkinsComboBoxPanel() { public FComboBoxPanel<String> getSkinsComboBoxPanel() {
return cbpSkin; return cbpSkin;
} }
/** @return {@link javax.swing.JCheckBox} */ /** @return {@link javax.swing.JCheckBox} */
public JCheckBox getCbEnforceDeckLegality() { public JCheckBox getCbEnforceDeckLegality() {
return cbEnforceDeckLegality; return cbEnforceDeckLegality;
@@ -496,8 +504,10 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
return btnReset; return btnReset;
} }
/** @return {@link javax.swing.JCheckBox} */
public JCheckBox getCbShowMatchBackgroundImage() {
return cbShowMatchBackgroundImage;
}
//========== Overridden from IVDoc //========== Overridden from IVDoc

View File

@@ -59,6 +59,7 @@ public class ForgePreferences extends PreferencesStore<ForgePreferences.FPref> {
UI_RANDOM_CARD_ART ("false"), UI_RANDOM_CARD_ART ("false"),
UI_CURRENT_AI_PROFILE (AiProfileUtil.AI_PROFILE_RANDOM_MATCH), UI_CURRENT_AI_PROFILE (AiProfileUtil.AI_PROFILE_RANDOM_MATCH),
UI_CLONE_MODE_SOURCE ("false"), /** */ UI_CLONE_MODE_SOURCE ("false"), /** */
UI_MATCH_IMAGE_VISIBLE ("true"),
UI_FOR_TOUCHSCREN("false"), UI_FOR_TOUCHSCREN("false"),