* Some more changes to adjustment possibilities of GUI size.

This commit is contained in:
LevelX2 2016-02-19 16:30:52 +01:00
parent 35505b29bb
commit e15807b9ed
6 changed files with 64 additions and 39 deletions

View file

@ -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("<html><body style='font-family:Dialog;font-size:");
buffer.append(16);
buffer.append(GUISizeHelper.gameDialogAreaFontSizeBig);
buffer.append("pt;margin:3px 3px 3px 3px;color: #FFFFFF'><b><center>");
// 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'><p width='400'>")
// .replace("</body>", "</p></body>");
String tooltip = "<html><center><body style='font-family:Dialog;font-size:14;color: #FFFFFF'><p width='500'>" + basicText + "</p></body></html>";
String tooltip = "<html><center><body style='font-family:Dialog;font-size:"
+ GUISizeHelper.gameDialogAreaFontSizeBig
+ ";color: #FFFFFF'><p width='500'>" + basicText + "</p></body></html>";
MageTextArea.super.setToolTipText(tooltip);
} else {
MageTextArea.super.setToolTipText(null);

View file

@ -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 "<div style='font-size:11pt'>" + text + "</div>";
protected static String getSmallText(String text) {
return "<div style='font-size:" + GUISizeHelper.gameDialogAreaFontSizeSmall + "pt'>" + text + "</div>";
}
private void setSpecial(String text, boolean visible) {

View file

@ -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 + "<div style='font-size:11pt'>" + activePlayerText + " / " + gameView.getStep().toString() + priorityPlayerText + "</div>";
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;

View file

@ -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

View file

@ -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;

View file

@ -236,16 +236,16 @@ public class GuiDisplayUtil {
buffer.append("<img src='").append(getResourcePath("card/color_ind_white.png")).append("' alt='W' ").append(imageSize);
}
if (card.getColor().isBlue()) {
buffer.append("<img src='").append(getResourcePath("card/color_ind_blue.png")).append("' alt='U'>").append(imageSize);
buffer.append("<img src='").append(getResourcePath("card/color_ind_blue.png")).append("' alt='U' ").append(imageSize);
}
if (card.getColor().isBlack()) {
buffer.append("<img src='").append(getResourcePath("card/color_ind_black.png")).append("' alt='B'>").append(imageSize);
buffer.append("<img src='").append(getResourcePath("card/color_ind_black.png")).append("' alt='B' ").append(imageSize);
}
if (card.getColor().isRed()) {
buffer.append("<img src='").append(getResourcePath("card/color_ind_red.png")).append("' alt='R'>").append(imageSize);
buffer.append("<img src='").append(getResourcePath("card/color_ind_red.png")).append("' alt='R' ").append(imageSize);
}
if (card.getColor().isGreen()) {
buffer.append("<img src='").append(getResourcePath("card/color_ind_green.png")).append("' alt='G'>").append(imageSize);
buffer.append("<img src='").append(getResourcePath("card/color_ind_green.png")).append("' alt='G' ").append(imageSize);
}
if (!card.getColor().isColorless()) {
buffer.append("&nbsp;&nbsp;");
@ -339,10 +339,6 @@ public class GuiDisplayUtil {
String legal = rule.toString();
if (legal.length() > 0) {
// this 2 replaces were only done with the empty string, is it any longer needed? (LevelX2)
// legal = legal.replaceAll("#([^#]+)#", "<i>$1</i>");
// legal = legal.replaceAll("\\s*//\\s*", "<hr width='50%'>");
// legal = legal.replace("\r\n", "<div style='font-size:5pt'></div>");
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));