Removed FSkin access from AllZone, all FSkin access now through Singletons.getView().

This commit is contained in:
Doublestrike
2012-01-17 11:35:02 +00:00
parent 5dd09d2671
commit a496d68c20
29 changed files with 83 additions and 94 deletions

View File

@@ -37,7 +37,6 @@ import forge.quest.data.QuestData;
import forge.quest.gui.main.QuestEvent; import forge.quest.gui.main.QuestEvent;
import forge.quest.gui.main.QuestEventManager; import forge.quest.gui.main.QuestEventManager;
import forge.view.toolbox.FOverlay; import forge.view.toolbox.FOverlay;
import forge.view.toolbox.FSkin;
/** /**
* Please use public getters and setters instead of direct field access. * Please use public getters and setters instead of direct field access.
@@ -58,9 +57,6 @@ public final class AllZone {
// blank // blank
} }
/** Global <code>SKIN</code>. */
private static FSkin skin = null;
/** Global <code>questData</code>. */ /** Global <code>questData</code>. */
private static forge.quest.data.QuestData questData = null; private static forge.quest.data.QuestData questData = null;
@@ -666,33 +662,6 @@ public final class AllZone {
return AllZone.COLOR_CHANGER; return AllZone.COLOR_CHANGER;
} }
/**
* <p>
* getSkin.
* </p>
* Gets current display skin.
*
* @return a {@link forge.view.toolbox.FSkin} object.
* @since 1.0.15
*/
public static FSkin getSkin() {
return AllZone.skin;
}
/**
* <p>
* setSkin.
* </p>
* Sets current display skin.
*
* @param fs
* a {@link forge.view.toolbox.FSkin} object.
* @since 1.0.15
*/
public static void setSkin(final FSkin fs) {
AllZone.skin = fs;
}
/** /**
* Gets the overlay. * Gets the overlay.
* *

View File

@@ -154,7 +154,7 @@ public class ControlSettings {
FSkin skin = new FSkin(name); FSkin skin = new FSkin(name);
prefs.setSkin(name); prefs.setSkin(name);
AllZone.setSkin(skin); Singletons.getView().setSkin(skin);
((GuiTopLevel) AllZone.getDisplay()).getController().changeState(0); ((GuiTopLevel) AllZone.getDisplay()).getController().changeState(0);
// TODO This should work, but it doesn't. :| Doublestrike 15-12-11 // TODO This should work, but it doesn't. :| Doublestrike 15-12-11
view.getParentView().showSettingsMenu(); view.getParentView().showSettingsMenu();

View File

@@ -101,7 +101,7 @@ public class QuestWinLoseHandler extends ControlWinLose {
this.model.qData = AllZone.getQuestData(); this.model.qData = AllZone.getQuestData();
this.model.qEvent = AllZone.getQuestEvent(); this.model.qEvent = AllZone.getQuestEvent();
this.wonMatch = this.model.matchState.isMatchWonBy(AllZone.getHumanPlayer().getName()); this.wonMatch = this.model.matchState.isMatchWonBy(AllZone.getHumanPlayer().getName());
this.skin = AllZone.getSkin(); this.skin = Singletons.getView().getSkin();
this.isAnte = Singletons.getModel().getPreferences().isPlayForAnte(); this.isAnte = Singletons.getModel().getPreferences().isPlayForAnte();
} }

View File

@@ -46,14 +46,16 @@ import forge.view.toolbox.FSkin;
public class FView { public class FView {
private transient SplashFrame splashFrame; private transient SplashFrame splashFrame;
private FSkin skin;
/** /**
* The splashFrame field is guaranteed to exist when this constructor exits. * The splashFrame field is guaranteed to exist when this constructor exits.
* *
* @param skin * @param skin0
* the skin * the skin
*/ */
public FView(final FSkin skin) { public FView(final FSkin skin0) {
this.skin = skin0;
// We must use invokeAndWait here to fulfill the constructor's // We must use invokeAndWait here to fulfill the constructor's
// contract. // contract.
@@ -98,6 +100,16 @@ public class FView {
return result; return result;
} }
/** @return FSkin */
public FSkin getSkin() {
return skin;
}
/** @param skin0 &emsp; FSkin */
public void setSkin(FSkin skin0) {
this.skin = skin0;
}
/** /**
* Tell the view that the model has been bootstrapped, and its data is ready * Tell the view that the model has been bootstrapped, and its data is ready
* for initial display. * for initial display.
@@ -145,7 +157,7 @@ public class FView {
// splashFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); // splashFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
FView.this.splashFrame = null; FView.this.splashFrame = null;
AllZone.getSkin().loadFontAndImages(); skin.loadFontAndImages();
GuiTopLevel g = new GuiTopLevel(); GuiTopLevel g = new GuiTopLevel();
g.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); g.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
AllZone.setDisplay(g); AllZone.setDisplay(g);
@@ -156,6 +168,5 @@ public class FView {
ErrorViewer.showError(ex); ErrorViewer.showError(ex);
} }
} // End if(splashHasBeenClosed) } // End if(splashHasBeenClosed)
} // End FView() } // End FView()
} }

View File

@@ -19,7 +19,6 @@ package forge.view;
import java.util.ArrayList; import java.util.ArrayList;
import forge.AllZone;
import forge.Constant; import forge.Constant;
import forge.ConstantStringArrayList; import forge.ConstantStringArrayList;
import forge.FileUtil; import forge.FileUtil;
@@ -56,7 +55,6 @@ public final class Main {
final FSkin skin = new FSkin(Singletons.getModel().getPreferences().getSkin()); final FSkin skin = new FSkin(Singletons.getModel().getPreferences().getSkin());
final FView view = new FView(skin); final FView view = new FView(skin);
Singletons.setView(view); Singletons.setView(view);
AllZone.setSkin(skin);
// Need this soon after card factory is loaded // Need this soon after card factory is loaded
Main.loadDynamicGamedata(); Main.loadDynamicGamedata();

View File

@@ -27,7 +27,7 @@ import javax.swing.JLabel;
import javax.swing.JPanel; import javax.swing.JPanel;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import forge.AllZone; import forge.Singletons;
import forge.control.ControlHomeUI; import forge.control.ControlHomeUI;
import forge.control.home.ControlConstructed; import forge.control.home.ControlConstructed;
import forge.control.home.ControlDraft; import forge.control.home.ControlDraft;
@@ -64,7 +64,7 @@ public class HomeTopLevel extends FPanel {
*/ */
public HomeTopLevel() { public HomeTopLevel() {
super(); super();
skin = AllZone.getSkin(); skin = Singletons.getView().getSkin();
constructed = new ViewConstructed(this); constructed = new ViewConstructed(this);
sealed = new ViewSealed(this); sealed = new ViewSealed(this);

View File

@@ -3,7 +3,7 @@ package forge.view.home;
import javax.swing.ImageIcon; import javax.swing.ImageIcon;
import javax.swing.JButton; import javax.swing.JButton;
import forge.AllZone; import forge.Singletons;
import forge.view.toolbox.FSkin; import forge.view.toolbox.FSkin;
/** /**
@@ -17,7 +17,7 @@ public class StartButton extends JButton {
*/ */
public StartButton(HomeTopLevel v0) { public StartButton(HomeTopLevel v0) {
super(); super();
final FSkin skin = AllZone.getSkin(); final FSkin skin = Singletons.getView().getSkin();
setRolloverEnabled(true); setRolloverEnabled(true);
setRolloverIcon(new ImageIcon(skin.getImage("button.startDOWN"))); setRolloverIcon(new ImageIcon(skin.getImage("button.startDOWN")));
setOpaque(false); setOpaque(false);

View File

@@ -11,7 +11,7 @@ import javax.swing.JButton;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.border.LineBorder; import javax.swing.border.LineBorder;
import forge.AllZone; import forge.Singletons;
import forge.view.toolbox.FSkin; import forge.view.toolbox.FSkin;
/** /**
@@ -34,7 +34,7 @@ public class SubButton extends JButton {
*/ */
public SubButton(String txt0) { public SubButton(String txt0) {
super(txt0); super(txt0);
skin = AllZone.getSkin(); skin = Singletons.getView().getSkin();
setBorder(new LineBorder(skin.getColor("borders"), 1)); setBorder(new LineBorder(skin.getColor("borders"), 1));
setBackground(skin.getColor("inactive")); setBackground(skin.getColor("inactive"));
setForeground(skin.getColor("text")); setForeground(skin.getColor("text"));
@@ -57,7 +57,7 @@ public class SubButton extends JButton {
int px = (int) (SubButton.this.getHeight() / 2); int px = (int) (SubButton.this.getHeight() / 2);
px = (px < 10 ? 10 : px); px = (px < 10 ? 10 : px);
px = (px > 15 ? 15 : px); px = (px > 15 ? 15 : px);
SubButton.this.setFont(AllZone.getSkin().getFont(px)); SubButton.this.setFont(Singletons.getView().getSkin().getFont(px));
} }
}); });
} }

View File

@@ -9,7 +9,7 @@ import javax.swing.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import forge.AllZone; import forge.Singletons;
import forge.control.home.ControlConstructed; import forge.control.home.ControlConstructed;
import forge.view.toolbox.FList; import forge.view.toolbox.FList;
import forge.view.toolbox.FScrollPane; import forge.view.toolbox.FScrollPane;
@@ -43,7 +43,7 @@ public class ViewConstructed extends JPanel {
this.setOpaque(false); this.setOpaque(false);
this.setLayout(new MigLayout("insets 0, gap 0")); this.setLayout(new MigLayout("insets 0, gap 0"));
parentView = v0; parentView = v0;
skin = AllZone.getSkin(); skin = Singletons.getView().getSkin();
control = new ControlConstructed(this); control = new ControlConstructed(this);
populateHuman(); populateHuman();

View File

@@ -21,6 +21,7 @@ import javax.swing.text.StyledDocument;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import forge.AllZone; import forge.AllZone;
import forge.Command; import forge.Command;
import forge.Singletons;
import forge.control.home.ControlDraft; import forge.control.home.ControlDraft;
import forge.deck.Deck; import forge.deck.Deck;
import forge.game.GameType; import forge.game.GameType;
@@ -90,7 +91,7 @@ public class ViewDraft extends JPanel {
this.setOpaque(false); this.setOpaque(false);
this.setLayout(new MigLayout("insets 0, gap 0")); this.setLayout(new MigLayout("insets 0, gap 0"));
parentView = v0; parentView = v0;
skin = AllZone.getSkin(); skin = Singletons.getView().getSkin();
JLabel lblHuman = new JLabel("Select your deck: "); JLabel lblHuman = new JLabel("Select your deck: ");
lblHuman.setFont(skin.getBoldFont(16)); lblHuman.setFont(skin.getBoldFont(16));

View File

@@ -25,6 +25,7 @@ import javax.swing.border.MatteBorder;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import forge.AllZone; import forge.AllZone;
import forge.Singletons;
import forge.control.home.ControlQuest; import forge.control.home.ControlQuest;
import forge.gui.GuiUtils; import forge.gui.GuiUtils;
import forge.properties.ForgeProps; import forge.properties.ForgeProps;
@@ -71,7 +72,7 @@ public class ViewQuest extends JScrollPane {
this.setBorder(null); this.setBorder(null);
this.getVerticalScrollBar().setUnitIncrement(16); this.getVerticalScrollBar().setUnitIncrement(16);
parentView = v0; parentView = v0;
skin = AllZone.getSkin(); skin = Singletons.getView().getSkin();
// Title and viewport. Panel is put into scroll pane for resize safety. // Title and viewport. Panel is put into scroll pane for resize safety.
viewport = new JPanel(); viewport = new JPanel();

View File

@@ -6,7 +6,7 @@ import javax.swing.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import forge.AllZone; import forge.Singletons;
import forge.control.home.ControlSealed; import forge.control.home.ControlSealed;
import forge.game.GameType; import forge.game.GameType;
import forge.view.toolbox.DeckLister; import forge.view.toolbox.DeckLister;
@@ -35,7 +35,7 @@ public class ViewSealed extends JPanel {
this.setOpaque(false); this.setOpaque(false);
this.setLayout(new MigLayout("insets 0, gap 0, wrap")); this.setLayout(new MigLayout("insets 0, gap 0, wrap"));
parentView = v0; parentView = v0;
skin = AllZone.getSkin(); skin = Singletons.getView().getSkin();
control = new ControlSealed(this); control = new ControlSealed(this);
// Title // Title

View File

@@ -62,7 +62,7 @@ public class ViewSettings extends JScrollPane {
public ViewSettings(final HomeTopLevel v0) { public ViewSettings(final HomeTopLevel v0) {
super(VERTICAL_SCROLLBAR_ALWAYS, HORIZONTAL_SCROLLBAR_AS_NEEDED); super(VERTICAL_SCROLLBAR_ALWAYS, HORIZONTAL_SCROLLBAR_AS_NEEDED);
skin = AllZone.getSkin(); skin = Singletons.getView().getSkin();
parentView = v0; parentView = v0;
viewport = new JPanel(); viewport = new JPanel();
viewport.setOpaque(false); viewport.setOpaque(false);

View File

@@ -8,7 +8,7 @@ import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument; import javax.swing.text.StyledDocument;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import forge.AllZone; import forge.Singletons;
import forge.control.home.ControlUtilities; import forge.control.home.ControlUtilities;
import forge.view.toolbox.FSkin; import forge.view.toolbox.FSkin;
@@ -36,7 +36,7 @@ public class ViewUtilities extends JPanel {
this.setOpaque(false); this.setOpaque(false);
this.setLayout(new MigLayout("insets 0, gap 0, wrap, ay center")); this.setLayout(new MigLayout("insets 0, gap 0, wrap, ay center"));
parentView = v0; parentView = v0;
skin = AllZone.getSkin(); skin = Singletons.getView().getSkin();
btnDownloadPics = new SubButton("Download LQ Card Pictures"); btnDownloadPics = new SubButton("Download LQ Card Pictures");
this.add(btnDownloadPics, "h 30px!, w 50%!, gapleft 25%, gapbottom 2%, gaptop 5%"); this.add(btnDownloadPics, "h 30px!, w 50%!, gapleft 25%, gapbottom 2%, gaptop 5%");

View File

@@ -22,7 +22,7 @@ import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent; import java.awt.event.ComponentEvent;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import forge.AllZone; import forge.Singletons;
import forge.control.match.ControlDetail; import forge.control.match.ControlDetail;
import forge.gui.game.CardDetailPanel; import forge.gui.game.CardDetailPanel;
import forge.view.toolbox.FRoundedPanel; import forge.view.toolbox.FRoundedPanel;
@@ -43,11 +43,11 @@ public class ViewDetail extends FRoundedPanel {
*/ */
public ViewDetail() { public ViewDetail() {
super(); super();
skin = AllZone.getSkin(); skin = Singletons.getView().getSkin();
pnlDetail = new CardDetailPanel(null); pnlDetail = new CardDetailPanel(null);
pnlDetail.setOpaque(false); pnlDetail.setOpaque(false);
this.setBackground(AllZone.getSkin().getColor("theme")); this.setBackground(skin.getColor("theme"));
this.setLayout(new MigLayout("insets 0, gap 0")); this.setLayout(new MigLayout("insets 0, gap 0"));
add(pnlDetail, "w 100%!, h 100%!"); add(pnlDetail, "w 100%!, h 100%!");
@@ -68,7 +68,7 @@ public class ViewDetail extends FRoundedPanel {
pnlDetail.getSetInfoLabel().setFont(font); pnlDetail.getSetInfoLabel().setFont(font);
pnlDetail.getCDArea().setFont(font); pnlDetail.getCDArea().setFont(font);
setFont(AllZone.getSkin().getFont(px)); setFont(skin.getFont(px));
} }
}); });
} }

View File

@@ -34,6 +34,7 @@ import javax.swing.JPanel;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import forge.AllZone; import forge.AllZone;
import forge.Singletons;
import forge.control.match.ControlDock; import forge.control.match.ControlDock;
import forge.view.toolbox.FButton; import forge.view.toolbox.FButton;
import forge.view.toolbox.FOverlay; import forge.view.toolbox.FOverlay;
@@ -56,8 +57,9 @@ public class ViewDock extends FRoundedPanel {
*/ */
public ViewDock() { public ViewDock() {
super(); super();
this.skin = Singletons.getView().getSkin();
this.setToolTipText("Shortcut Button Dock"); this.setToolTipText("Shortcut Button Dock");
this.setBackground(AllZone.getSkin().getColor("theme")); this.setBackground(skin.getColor("theme"));
//this.setLayout(new MigLayout("insets 0, gap 0, ay center, ax center")); //this.setLayout(new MigLayout("insets 0, gap 0, ay center, ax center"));
// Mig layout does not support wrapping! // Mig layout does not support wrapping!
@@ -67,8 +69,6 @@ public class ViewDock extends FRoundedPanel {
layFlow.setVgap(10); layFlow.setVgap(10);
this.setLayout(layFlow); this.setLayout(layFlow);
this.skin = AllZone.getSkin();
this.actClose = new AbstractAction() { this.actClose = new AbstractAction() {
@Override @Override
public void actionPerformed(final ActionEvent e) { public void actionPerformed(final ActionEvent e) {

View File

@@ -42,6 +42,7 @@ import forge.AllZone;
import forge.Constant; import forge.Constant;
import forge.Constant.Zone; import forge.Constant.Zone;
import forge.Player; import forge.Player;
import forge.Singletons;
import forge.card.cardfactory.CardFactoryUtil; import forge.card.cardfactory.CardFactoryUtil;
import forge.card.mana.ManaPool; import forge.card.mana.ManaPool;
import forge.control.match.ControlField; import forge.control.match.ControlField;
@@ -87,13 +88,13 @@ public class ViewField extends FRoundedPanel {
*/ */
public ViewField(final Player player) { public ViewField(final Player player) {
super(); super();
this.skin = Singletons.getView().getSkin();
this.setOpaque(false); this.setOpaque(false);
this.setLayout(new MigLayout("insets 0, gap 0")); this.setLayout(new MigLayout("insets 0, gap 0"));
this.setCornerRadius(5); this.setCornerRadius(5);
this.setToolTipText(player.getName() + " Gameboard"); this.setToolTipText(player.getName() + " Gameboard");
this.setBackground(AllZone.getSkin().getColor("theme")); this.setBackground(skin.getColor("theme"));
this.skin = AllZone.getSkin();
this.inactiveBorder = new LineBorder(new Color(0, 0, 0, 0), 1); this.inactiveBorder = new LineBorder(new Color(0, 0, 0, 0), 1);
this.hoverBorder = new LineBorder(this.skin.getColor("borders"), 1); this.hoverBorder = new LineBorder(this.skin.getColor("borders"), 1);
this.counter = -1; this.counter = -1;
@@ -746,7 +747,7 @@ public class ViewField extends FRoundedPanel {
private boolean enabled = true; private boolean enabled = true;
private boolean active = false; private boolean active = false;
private boolean hover = false; private boolean hover = false;
private final Color hoverBG = AllZone.getSkin().getColor("hover"); private final Color hoverBG = Singletons.getView().getSkin().getColor("hover");
/** /**
* Shows phase labels, handles repainting and on/off states. A * Shows phase labels, handles repainting and on/off states. A

View File

@@ -21,7 +21,7 @@ import javax.swing.JScrollPane;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import arcane.ui.HandArea; import arcane.ui.HandArea;
import forge.AllZone; import forge.Singletons;
import forge.control.match.ControlHand; import forge.control.match.ControlHand;
import forge.view.toolbox.FRoundedPanel; import forge.view.toolbox.FRoundedPanel;
@@ -43,7 +43,7 @@ public class ViewHand extends FRoundedPanel {
public ViewHand(ViewTopLevel v0) { public ViewHand(ViewTopLevel v0) {
final JScrollPane scroller = new JScrollPane(); final JScrollPane scroller = new JScrollPane();
ViewHand.this.hand = new HandArea(scroller); ViewHand.this.hand = new HandArea(scroller);
ViewHand.this.setBackground(AllZone.getSkin().getColor("theme")); ViewHand.this.setBackground(Singletons.getView().getSkin().getColor("theme"));
topLevel = v0; topLevel = v0;
scroller.setViewportView(ViewHand.this.hand); scroller.setViewportView(ViewHand.this.hand);

View File

@@ -31,7 +31,7 @@ import javax.swing.Timer;
import javax.swing.border.MatteBorder; import javax.swing.border.MatteBorder;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import forge.AllZone; import forge.Singletons;
import forge.control.match.ControlInput; import forge.control.match.ControlInput;
import forge.view.toolbox.FButton; import forge.view.toolbox.FButton;
import forge.view.toolbox.FRoundedPanel; import forge.view.toolbox.FRoundedPanel;
@@ -58,7 +58,7 @@ public class ViewInput extends FRoundedPanel {
*/ */
public ViewInput() { public ViewInput() {
super(); super();
this.skin = AllZone.getSkin(); this.skin = Singletons.getView().getSkin();
this.setToolTipText("Input Area"); this.setToolTipText("Input Area");
this.setBackground(this.skin.getColor("theme")); this.setBackground(this.skin.getColor("theme"));
this.setForeground(this.skin.getColor("text")); this.setForeground(this.skin.getColor("text"));
@@ -94,7 +94,7 @@ public class ViewInput extends FRoundedPanel {
public void componentResized(ComponentEvent e) { public void componentResized(ComponentEvent e) {
int px = (int) (ViewInput.this.getWidth() / 17); int px = (int) (ViewInput.this.getWidth() / 17);
px = (px < 11 ? 11 : px); px = (px < 11 ? 11 : px);
tarMessage.setFont(AllZone.getSkin().getFont(px)); tarMessage.setFont(Singletons.getView().getSkin().getFont(px));
} }
}); });
// After all components are in place, instantiate controller. // After all components are in place, instantiate controller.

View File

@@ -18,7 +18,7 @@
package forge.view.match; package forge.view.match;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import forge.AllZone; import forge.Singletons;
import forge.control.match.ControlPicture; import forge.control.match.ControlPicture;
import forge.gui.game.CardPicturePanel; import forge.gui.game.CardPicturePanel;
import forge.view.toolbox.FRoundedPanel; import forge.view.toolbox.FRoundedPanel;
@@ -41,7 +41,7 @@ public class ViewPicture extends FRoundedPanel {
pnlPicture = new CardPicturePanel(null); pnlPicture = new CardPicturePanel(null);
pnlPicture.setOpaque(false); pnlPicture.setOpaque(false);
this.setBackground(AllZone.getSkin().getColor("theme")); this.setBackground(Singletons.getView().getSkin().getColor("theme"));
this.setLayout(new MigLayout("insets 0, gap 0, center")); this.setLayout(new MigLayout("insets 0, gap 0, center"));
add(pnlPicture, "w 100%!, h 100%!"); add(pnlPicture, "w 100%!, h 100%!");

View File

@@ -97,7 +97,7 @@ public class ViewTabber extends FRoundedPanel {
* Assembles Swing components for tabber area in sidebar. * Assembles Swing components for tabber area in sidebar.
*/ */
public ViewTabber() { public ViewTabber() {
this.skin = AllZone.getSkin(); this.skin = Singletons.getView().getSkin();
this.hoverColor = this.skin.getColor("hover"); this.hoverColor = this.skin.getColor("hover");
this.activeColor = this.skin.getColor("active"); this.activeColor = this.skin.getColor("active");
this.inactiveColor = this.skin.getColor("inactive"); this.inactiveColor = this.skin.getColor("inactive");
@@ -157,7 +157,7 @@ public class ViewTabber extends FRoundedPanel {
this.populatePnlConsole(); this.populatePnlConsole();
this.vtpTabber = new FVerticalTabPanel(this.panelList); this.vtpTabber = new FVerticalTabPanel(this.panelList);
this.setBackground(AllZone.getSkin().getColor("theme")); this.setBackground(skin.getColor("theme"));
this.setLayout(new MigLayout("insets 0, gap 0")); this.setLayout(new MigLayout("insets 0, gap 0"));
this.add(vtpTabber, "w 97%!, h 100%!, gapleft 2%"); this.add(vtpTabber, "w 97%!, h 100%!, gapleft 2%");

View File

@@ -34,6 +34,7 @@ import javax.swing.JTextArea;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import forge.AllZone; import forge.AllZone;
import forge.Singletons;
import forge.control.ControlMatchUI; import forge.control.ControlMatchUI;
import forge.control.match.ControlDetail; import forge.control.match.ControlDetail;
import forge.control.match.ControlDock; import forge.control.match.ControlDock;
@@ -96,8 +97,8 @@ public class ViewTopLevel extends FPanel {
// Set properties // Set properties
this.setOpaque(false); this.setOpaque(false);
this.setBGTexture(new ImageIcon(AllZone.getSkin().getImage("bg.texture"))); this.setBGTexture(new ImageIcon(Singletons.getView().getSkin().getImage("bg.texture")));
this.setBGImg(new ImageIcon(AllZone.getSkin().getImage("bg.match"))); this.setBGImg(new ImageIcon(Singletons.getView().getSkin().getImage("bg.match")));
this.setLayout(null); this.setLayout(null);
b = (int) Math.ceil(BOUNDARY_THICKNESS_PX / 2); b = (int) Math.ceil(BOUNDARY_THICKNESS_PX / 2);

View File

@@ -14,6 +14,7 @@ import forge.Constant;
import forge.MatchState; import forge.MatchState;
import forge.PhaseHandler; import forge.PhaseHandler;
import forge.Player; import forge.Player;
import forge.Singletons;
import forge.control.match.ControlWinLose; import forge.control.match.ControlWinLose;
import forge.game.GameType; import forge.game.GameType;
import forge.properties.ForgeProps; import forge.properties.ForgeProps;
@@ -21,6 +22,7 @@ import forge.properties.NewConstants.Lang.GuiWinLose.WinLoseText;
import forge.quest.gui.QuestWinLoseHandler; import forge.quest.gui.QuestWinLoseHandler;
import forge.view.toolbox.FButton; import forge.view.toolbox.FButton;
import forge.view.toolbox.FOverlay; import forge.view.toolbox.FOverlay;
import forge.view.toolbox.FSkin;
/** /**
* TODO: Write javadoc for this type. * TODO: Write javadoc for this type.
@@ -29,6 +31,7 @@ import forge.view.toolbox.FOverlay;
public class ViewWinLose { public class ViewWinLose {
private FButton btnContinue, btnRestart, btnQuit; private FButton btnContinue, btnRestart, btnQuit;
private JPanel pnlCustom; private JPanel pnlCustom;
private FSkin skin;
/** */ /** */
public ViewWinLose() { public ViewWinLose() {
@@ -47,6 +50,8 @@ public class ViewWinLose {
btnRestart = new FButton(); btnRestart = new FButton();
btnQuit = new FButton(); btnQuit = new FButton();
skin = Singletons.getView().getSkin();
// Control of the win/lose is handled differently for various game modes. // Control of the win/lose is handled differently for various game modes.
ControlWinLose control; ControlWinLose control;
if (Constant.Runtime.getGameType() == GameType.Quest) { if (Constant.Runtime.getGameType() == GameType.Quest) {
@@ -67,18 +72,18 @@ public class ViewWinLose {
lblTitle.setForeground(Color.white); lblTitle.setForeground(Color.white);
lblTitle.setHorizontalAlignment(SwingConstants.CENTER); lblTitle.setHorizontalAlignment(SwingConstants.CENTER);
lblTitle.setFont(AllZone.getSkin().getFont().deriveFont(Font.BOLD, 30)); lblTitle.setFont(skin.getFont().deriveFont(Font.BOLD, 30));
lblStats.setForeground(Color.white); lblStats.setForeground(Color.white);
lblStats.setHorizontalAlignment(SwingConstants.CENTER); lblStats.setHorizontalAlignment(SwingConstants.CENTER);
lblStats.setFont(AllZone.getSkin().getFont().deriveFont(Font.PLAIN, 26)); lblStats.setFont(skin.getFont().deriveFont(Font.PLAIN, 26));
btnContinue.setText("Continue"); btnContinue.setText("Continue");
btnContinue.setFont(AllZone.getSkin().getFont(22)); btnContinue.setFont(skin.getFont(22));
btnRestart.setText("Restart"); btnRestart.setText("Restart");
btnRestart.setFont(AllZone.getSkin().getFont(22)); btnRestart.setFont(skin.getFont(22));
btnQuit.setText("Quit"); btnQuit.setText("Quit");
btnQuit.setFont(AllZone.getSkin().getFont(22)); btnQuit.setFont(skin.getFont(22));
// End game and set state of "continue" button // End game and set state of "continue" button
PhaseHandler.setGameBegins(0); PhaseHandler.setGameBegins(0);

View File

@@ -18,6 +18,7 @@ import javax.swing.border.MatteBorder;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import forge.AllZone; import forge.AllZone;
import forge.Command; import forge.Command;
import forge.Singletons;
import forge.deck.Deck; import forge.deck.Deck;
import forge.deck.DeckManager; import forge.deck.DeckManager;
import forge.game.GameType; import forge.game.GameType;
@@ -61,7 +62,7 @@ public class DeckLister extends JPanel {
*/ */
public DeckLister(GameType gt0, Command cmd0, boolean deletable, boolean editable) { public DeckLister(GameType gt0, Command cmd0, boolean deletable, boolean editable) {
super(); super();
skin = AllZone.getSkin(); skin = Singletons.getView().getSkin();
gametype = gt0; gametype = gt0;
cmdExit = cmd0; cmdExit = cmd0;
this.setOpaque(false); this.setOpaque(false);

View File

@@ -32,7 +32,7 @@ import java.awt.event.KeyEvent;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JButton; import javax.swing.JButton;
import forge.AllZone; import forge.Singletons;
/** /**
* The core JButton used throughout the Forge project. Follows skin font and * The core JButton used throughout the Forge project. Follows skin font and
@@ -68,7 +68,7 @@ public class FButton extends JButton {
*/ */
public FButton(final String msg) { public FButton(final String msg) {
super(msg); super(msg);
this.skin = AllZone.getSkin(); this.skin = Singletons.getView().getSkin();
this.setOpaque(false); this.setOpaque(false);
this.setForeground(this.skin.getColor("text")); this.setForeground(this.skin.getColor("text"));
this.setBackground(Color.red); this.setBackground(Color.red);

View File

@@ -8,7 +8,8 @@ import javax.swing.JList;
import javax.swing.ListCellRenderer; import javax.swing.ListCellRenderer;
import javax.swing.border.EmptyBorder; import javax.swing.border.EmptyBorder;
import forge.AllZone; import forge.Singletons;
/** /**
* A JList object using Forge skin properties. * A JList object using Forge skin properties.
* *
@@ -33,7 +34,7 @@ public class FList extends JList {
*/ */
public FList(Object[] o0) { public FList(Object[] o0) {
super(o0); super(o0);
skin = AllZone.getSkin(); skin = Singletons.getView().getSkin();
setOpaque(false); setOpaque(false);

View File

@@ -25,7 +25,7 @@ import java.awt.RenderingHints;
import javax.swing.JPanel; import javax.swing.JPanel;
import forge.AllZone; import forge.Singletons;
/** /**
* <p> * <p>
@@ -42,7 +42,7 @@ public class FRoundedPanel extends JPanel {
private boolean[] borders = { true, true, true, true }; private boolean[] borders = { true, true, true, true };
private boolean[] corners = { true, true, true, true }; // NW, SW, SE, NE private boolean[] corners = { true, true, true, true }; // NW, SW, SE, NE
private Color shadowColor = new Color(150, 150, 150, 150); private Color shadowColor = new Color(150, 150, 150, 150);
private Color borderColor = AllZone.getSkin().getColor("borders"); private Color borderColor = Singletons.getView().getSkin().getColor("borders");
private int shadowOffset = 5; private int shadowOffset = 5;
private int cornerRadius = 10; private int cornerRadius = 10;
private boolean showShadow = false; private boolean showShadow = false;

View File

@@ -5,7 +5,7 @@ import java.awt.Component;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import javax.swing.border.LineBorder; import javax.swing.border.LineBorder;
import forge.AllZone; import forge.Singletons;
/** /**
* A very basic extension of JScrollPane to centralize common styling changes. * A very basic extension of JScrollPane to centralize common styling changes.
@@ -24,7 +24,7 @@ public class FScrollPane extends JScrollPane {
//setOpaque(false); //setOpaque(false);
getViewport().setOpaque(false); getViewport().setOpaque(false);
skin = AllZone.getSkin(); skin = Singletons.getView().getSkin();
setBorder(new LineBorder(skin.getColor("borders"), 1)); setBorder(new LineBorder(skin.getColor("borders"), 1));
setBackground(skin.getColor("zebra")); setBackground(skin.getColor("zebra"));
} }

View File

@@ -33,7 +33,7 @@ import javax.swing.JPanel;
import javax.swing.border.MatteBorder; import javax.swing.border.MatteBorder;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
import forge.AllZone; import forge.Singletons;
/** /**
* TODO: Write javadoc for this type. * TODO: Write javadoc for this type.
@@ -81,7 +81,7 @@ public class FVerticalTabPanel extends FPanel {
this.setLayout(new MigLayout("insets 0, gap 0, wrap 2")); this.setLayout(new MigLayout("insets 0, gap 0, wrap 2"));
this.setOpaque(false); this.setOpaque(false);
final int size = childPanels.size(); final int size = childPanels.size();
this.skin = AllZone.getSkin(); this.skin = Singletons.getView().getSkin();
this.hoverColor = this.skin.getColor("hover"); this.hoverColor = this.skin.getColor("hover");
this.activeColor = this.skin.getColor("active"); this.activeColor = this.skin.getColor("active");
this.inactiveColor = this.skin.getColor("inactive"); this.inactiveColor = this.skin.getColor("inactive");
@@ -250,12 +250,12 @@ public class FVerticalTabPanel extends FPanel {
if (tabsOnRightSide) { if (tabsOnRightSide) {
at.rotate(Math.toRadians(90), 0, 0); at.rotate(Math.toRadians(90), 0, 0);
g2d.setTransform(at); g2d.setTransform(at);
g2d.setColor(AllZone.getSkin().getColor("text")); g2d.setColor(skin.getColor("text"));
g2d.drawString(this.msg, 5, -4); g2d.drawString(this.msg, 5, -4);
} else { } else {
at.rotate(Math.toRadians(-90), 0, 0); at.rotate(Math.toRadians(-90), 0, 0);
g2d.setTransform(at); g2d.setTransform(at);
g2d.setColor(AllZone.getSkin().getColor("text")); g2d.setColor(skin.getColor("text"));
// Rotated, so follows: (this.msg, vertical coord, horizontal coord) // Rotated, so follows: (this.msg, vertical coord, horizontal coord)
g2d.drawString(this.msg, 8 - h, w - 6); g2d.drawString(this.msg, 8 - h, w - 6);
} }