diff --git a/Mage.Client/src/main/java/mage/client/components/MageTextArea.java b/Mage.Client/src/main/java/mage/client/components/MageTextArea.java index e540c434ad..d45a6cb4bf 100644 --- a/Mage.Client/src/main/java/mage/client/components/MageTextArea.java +++ b/Mage.Client/src/main/java/mage/client/components/MageTextArea.java @@ -3,6 +3,7 @@ package mage.client.components; import java.awt.Color; import javax.swing.JEditorPane; import javax.swing.SwingUtilities; +import mage.client.util.GUISizeHelper; import org.mage.card.arcane.ManaSymbols; import org.mage.card.arcane.UI; @@ -35,7 +36,7 @@ public class MageTextArea extends JEditorPane { final StringBuilder buffer = new StringBuilder(512); // Dialog is a java logical font family, so it should work on all systems buffer.append("
"); // Don't know what it does (easy italc?) but it bugs with multiple #HTML color codes (LevelX2) @@ -57,10 +58,9 @@ public class MageTextArea extends JEditorPane { MageTextArea.super.setText(promptText); // in case the text don't fit in the panel a tooltip with the text is added if (panelWidth > 0 && MageTextArea.this.getPreferredSize().getWidth() > panelWidth) { -// String tooltip = promptText -// .replace("color: #FFFFFF'>", "color: #111111'>

") -// .replace("", "

"); - String tooltip = "

" + basicText + "

"; + String tooltip = "

" + basicText + "

"; MageTextArea.super.setToolTipText(tooltip); } else { MageTextArea.super.setToolTipText(null); diff --git a/Mage.Client/src/main/java/mage/client/game/FeedbackPanel.java b/Mage.Client/src/main/java/mage/client/game/FeedbackPanel.java index b00b00730a..ed53a73b98 100644 --- a/Mage.Client/src/main/java/mage/client/game/FeedbackPanel.java +++ b/Mage.Client/src/main/java/mage/client/game/FeedbackPanel.java @@ -45,6 +45,7 @@ import mage.client.MageFrame; import mage.client.chat.ChatPanelBasic; import mage.client.components.MageTextArea; import mage.client.dialog.MageDialog; +import mage.client.util.GUISizeHelper; import mage.client.util.audio.AudioManager; import mage.client.util.gui.ArrowBuilder; import static mage.constants.Constants.Option.ORIGINAL_ID; @@ -96,6 +97,11 @@ public class FeedbackPanel extends javax.swing.JPanel { } private void setGUISize() { + btnLeft.setFont(GUISizeHelper.gameDialogAreaFont); + btnRight.setFont(GUISizeHelper.gameDialogAreaFont); + btnSpecial.setFont(GUISizeHelper.gameDialogAreaFont); + btnUndo.setFont(GUISizeHelper.gameDialogAreaFont); + helper.changeGUISize(); } @@ -171,8 +177,8 @@ public class FeedbackPanel extends javax.swing.JPanel { } } - protected String getSmallText(String text) { - return "
" + text + "
"; + protected static String getSmallText(String text) { + return "
" + text + "
"; } private void setSpecial(String text, boolean visible) { diff --git a/Mage.Client/src/main/java/mage/client/game/GamePanel.java b/Mage.Client/src/main/java/mage/client/game/GamePanel.java index 80b72b2f1f..19c7be83ca 100644 --- a/Mage.Client/src/main/java/mage/client/game/GamePanel.java +++ b/Mage.Client/src/main/java/mage/client/game/GamePanel.java @@ -195,6 +195,8 @@ public final class GamePanel extends javax.swing.JPanel { private MageDialogState choiceWindowState; + private int feedbackAreaHeight; + private enum PopUpMenuType { TRIGGER_ORDER @@ -378,15 +380,18 @@ public final class GamePanel extends javax.swing.JPanel { jSplitPane1.setDividerSize(GUISizeHelper.dividerBarSize); jSplitPane2.setDividerSize(GUISizeHelper.dividerBarSize); + feedbackAreaHeight = GUISizeHelper.gameDialogAreaFontSizeBig + GUISizeHelper.gameDialogAreaFontSizeSmall + GUISizeHelper.gameDialogAreaButtonHigh + 50; + helper.setPreferredSize(new Dimension(100, feedbackAreaHeight)); + stackObjects.setCardDimension(GUISizeHelper.handCardDimension); int newStackWidth = jPanel3.getWidth() * GUISizeHelper.stackWidth / 100; if (newStackWidth < 360) { newStackWidth = 360; } - Dimension newDimension = new Dimension(jPanel3.getWidth() - newStackWidth, (int) GUISizeHelper.handCardDimension.height + GUISizeHelper.scrollBarSize); + Dimension newDimension = new Dimension(jPanel3.getWidth() - newStackWidth, GUISizeHelper.handCardDimension.height + GUISizeHelper.scrollBarSize); handContainer.setPreferredSize(newDimension); handContainer.setMaximumSize(newDimension); - newDimension = new Dimension(newStackWidth, (int) GUISizeHelper.handCardDimension.height + GUISizeHelper.scrollBarSize); + newDimension = new Dimension(newStackWidth, GUISizeHelper.handCardDimension.height + GUISizeHelper.scrollBarSize); stackObjects.setPreferredSize(newDimension); stackObjects.setMinimumSize(newDimension); stackObjects.setMaximumSize(newDimension); @@ -1115,7 +1120,7 @@ public final class GamePanel extends javax.swing.JPanel { // magenoxx: because of uncaught bug with saving state, rolling back and stack // undo is allowed only for empty stack controllingPlayer = !gameView.getPriorityPlayerName().equals(playerView.getName()); - if (playerView.getStatesSavedSize() > 0 && gameView.getStack().size() == 0) { + if (playerView.getStatesSavedSize() > 0 && gameView.getStack().isEmpty()) { feedbackPanel.allowUndo(playerView.getStatesSavedSize()); } break; @@ -1137,8 +1142,7 @@ public final class GamePanel extends javax.swing.JPanel { if (controllingPlayer) { priorityPlayerText = " / priority " + gameView.getPriorityPlayerName(); } - String messageToDisplay = message + "
" + activePlayerText + " / " + gameView.getStep().toString() + priorityPlayerText + "
"; - + String messageToDisplay = message + FeedbackPanel.getSmallText(activePlayerText + " / " + gameView.getStep().toString() + priorityPlayerText); this.feedbackPanel.getFeedback(FeedbackMode.SELECT, messageToDisplay, gameView.getSpecial(), panelOptions, messageId); } @@ -1335,10 +1339,10 @@ public final class GamePanel extends javax.swing.JPanel { lblPriority.setLabelFor(txtPriority); lblPriority.setText("Priority Player:"); - feedbackPanel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(150, 50, 50), 2)); - feedbackPanel.setMaximumSize(new java.awt.Dimension(208, 121)); - feedbackPanel.setMinimumSize(new java.awt.Dimension(208, 121)); - + // feedbackPanel.setBorder(javax.swing.BorderFactory.createLineBorder(Color.MAGENTA, 5)); + // feedbackPanel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(150, 50, 50), 2)); + // feedbackPanel.setMaximumSize(new java.awt.Dimension(208, 121)); + // feedbackPanel.setMinimumSize(new java.awt.Dimension(208, 121)); bigCard.setBorder(new LineBorder(Color.black, 1, true)); int c = JComponent.WHEN_IN_FOCUSED_WINDOW; @@ -1750,7 +1754,8 @@ public final class GamePanel extends javax.swing.JPanel { jPhases.addMouseListener(phasesMouseAdapter); pnlReplay.setOpaque(false); - HelperPanel helper = new HelperPanel(); + helper = new HelperPanel(); + // helper.setBorder(new LineBorder(Color.MAGENTA, 2)); helper.setPreferredSize(new Dimension(100, 90)); feedbackPanel.setHelperPanel(helper); @@ -2200,6 +2205,7 @@ public final class GamePanel extends javax.swing.JPanel { private mage.client.chat.ChatPanelBasic gameChatPanel; private mage.client.game.FeedbackPanel feedbackPanel; + private HelperPanel helper; private mage.client.chat.ChatPanelBasic userChatPanel; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; diff --git a/Mage.Client/src/main/java/mage/client/game/HelperPanel.java b/Mage.Client/src/main/java/mage/client/game/HelperPanel.java index fb1b2ee442..0692400a37 100644 --- a/Mage.Client/src/main/java/mage/client/game/HelperPanel.java +++ b/Mage.Client/src/main/java/mage/client/game/HelperPanel.java @@ -73,6 +73,7 @@ public class HelperPanel extends JPanel { //private javax.swing.JButton btnStopTimer; private MageTextArea textArea; + JPanel buttonContainer; private javax.swing.JButton linkLeft; private javax.swing.JButton linkRight; @@ -113,6 +114,12 @@ public class HelperPanel extends JPanel { } private void setGUISize() { + buttonContainer.setPreferredSize(new Dimension(100, GUISizeHelper.gameDialogAreaFont.getSize() + 10)); + btnLeft.setFont(GUISizeHelper.gameDialogAreaFont); + btnRight.setFont(GUISizeHelper.gameDialogAreaFont); + btnSpecial.setFont(GUISizeHelper.gameDialogAreaFont); + btnUndo.setFont(GUISizeHelper.gameDialogAreaFont); + GUISizeHelper.changePopupMenuFont(popupMenuAskNo); GUISizeHelper.changePopupMenuFont(popupMenuAskYes); } @@ -124,13 +131,13 @@ public class HelperPanel extends JPanel { setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS)); setOpaque(false); - JPanel container = new JPanel(); - - container.setPreferredSize(new Dimension(100, 30)); - container.setMinimumSize(new Dimension(20, 20)); - container.setMaximumSize(new Dimension(2000, 100)); - container.setLayout(new GridBagLayout()); - container.setOpaque(false); + buttonContainer = new JPanel(); + // buttonContainer.setBorder(new LineBorder(Color.RED, 1)); + buttonContainer.setPreferredSize(new Dimension(100, 30)); + buttonContainer.setMinimumSize(new Dimension(20, 20)); + buttonContainer.setMaximumSize(new Dimension(2000, 100)); + buttonContainer.setLayout(new GridBagLayout()); + buttonContainer.setOpaque(false); JPanel jPanel = new JPanel(); @@ -142,20 +149,20 @@ public class HelperPanel extends JPanel { jPanel.add(textArea); add(jPanel); - add(container); + add(buttonContainer); btnSpecial = new JButton("Special"); btnSpecial.setVisible(false); - container.add(btnSpecial); + buttonContainer.add(btnSpecial); btnLeft = new JButton("OK"); btnLeft.setVisible(false); - container.add(btnLeft); + buttonContainer.add(btnLeft); btnRight = new JButton("Cancel"); btnRight.setVisible(false); - container.add(btnRight); + buttonContainer.add(btnRight); btnUndo = new JButton("Undo"); btnUndo.setVisible(false); - container.add(btnUndo); + buttonContainer.add(btnUndo); MouseListener checkPopupAdapter = new MouseAdapter() { @Override diff --git a/Mage.Client/src/main/java/mage/client/util/GUISizeHelper.java b/Mage.Client/src/main/java/mage/client/util/GUISizeHelper.java index 2eee2a19a1..098f3995e2 100644 --- a/Mage.Client/src/main/java/mage/client/util/GUISizeHelper.java +++ b/Mage.Client/src/main/java/mage/client/util/GUISizeHelper.java @@ -52,8 +52,11 @@ public class GUISizeHelper { public static Font gameRequestsFont = new java.awt.Font("Arial", 0, 12); - public static Font gameDialogAreaFontBig = new java.awt.Font("Arial", 0, 12); - public static Font gameDialogAreaFontSmall = new java.awt.Font("Arial", 0, 12); + public static int gameDialogAreaFontSizeBig = 16; + public static int gameDialogAreaFontSizeTooltip = 14; + public static int gameDialogAreaFontSizeSmall = 11; + public static int gameDialogAreaButtonHigh = 16; + public static Font gameDialogAreaFont = new java.awt.Font("Arial", 0, 12); public static Dimension handCardDimension; public static int stackWidth; @@ -103,6 +106,13 @@ public class GUISizeHelper { gameRequestsFont = new Font("Arial", 0, dialogFontSize); symbolDialogSize = dialogFontSize; + int feedbackFontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_FEEDBACK_AREA_SIZE, 14); + gameDialogAreaFontSizeBig = feedbackFontSize; + gameDialogAreaFontSizeTooltip = feedbackFontSize - 2; + gameDialogAreaFontSizeSmall = (feedbackFontSize / 2) + 2; + gameDialogAreaButtonHigh = feedbackFontSize; + gameDialogAreaFont = new Font("Arial", 0, dialogFontSize); + int chatFontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_CHAT_FONT_SIZE, 14); chatFont = new java.awt.Font("Arial", 0, chatFontSize); symbolChatSize = chatFontSize; diff --git a/Mage.Client/src/main/java/mage/client/util/gui/GuiDisplayUtil.java b/Mage.Client/src/main/java/mage/client/util/gui/GuiDisplayUtil.java index 18e336b3f1..3676095d1a 100644 --- a/Mage.Client/src/main/java/mage/client/util/gui/GuiDisplayUtil.java +++ b/Mage.Client/src/main/java/mage/client/util/gui/GuiDisplayUtil.java @@ -236,16 +236,16 @@ public class GuiDisplayUtil { buffer.append("W").append(imageSize); + buffer.append("U").append(imageSize); + buffer.append("B").append(imageSize); + buffer.append("R").append(imageSize); + buffer.append("G 0) { -// this 2 replaces were only done with the empty string, is it any longer needed? (LevelX2) -// legal = legal.replaceAll("#([^#]+)#", "$1"); -// legal = legal.replaceAll("\\s*//\\s*", "
"); -// legal = legal.replace("\r\n", "
"); legal = legal.replaceAll("\\{this\\}", card.getName().isEmpty() ? "this" : card.getName()); legal = legal.replaceAll("\\{source\\}", card.getName().isEmpty() ? "this" : card.getName()); buffer.append(ManaSymbols.replaceSymbolsWithHTML(legal, ManaSymbols.Type.TOOLTIP));