mirror of
https://github.com/correl/mage.git
synced 2024-12-26 19:16:54 +00:00
* Some more changes to adjustment possibilities of GUI size.
This commit is contained in:
parent
35505b29bb
commit
e15807b9ed
6 changed files with 64 additions and 39 deletions
|
@ -3,6 +3,7 @@ package mage.client.components;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import javax.swing.JEditorPane;
|
import javax.swing.JEditorPane;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
|
import mage.client.util.GUISizeHelper;
|
||||||
import org.mage.card.arcane.ManaSymbols;
|
import org.mage.card.arcane.ManaSymbols;
|
||||||
import org.mage.card.arcane.UI;
|
import org.mage.card.arcane.UI;
|
||||||
|
|
||||||
|
@ -35,7 +36,7 @@ public class MageTextArea extends JEditorPane {
|
||||||
final StringBuilder buffer = new StringBuilder(512);
|
final StringBuilder buffer = new StringBuilder(512);
|
||||||
// Dialog is a java logical font family, so it should work on all systems
|
// 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("<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>");
|
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)
|
// 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);
|
MageTextArea.super.setText(promptText);
|
||||||
// in case the text don't fit in the panel a tooltip with the text is added
|
// 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) {
|
if (panelWidth > 0 && MageTextArea.this.getPreferredSize().getWidth() > panelWidth) {
|
||||||
// String tooltip = promptText
|
String tooltip = "<html><center><body style='font-family:Dialog;font-size:"
|
||||||
// .replace("color: #FFFFFF'>", "color: #111111'><p width='400'>")
|
+ GUISizeHelper.gameDialogAreaFontSizeBig
|
||||||
// .replace("</body>", "</p></body>");
|
+ ";color: #FFFFFF'><p width='500'>" + basicText + "</p></body></html>";
|
||||||
String tooltip = "<html><center><body style='font-family:Dialog;font-size:14;color: #FFFFFF'><p width='500'>" + basicText + "</p></body></html>";
|
|
||||||
MageTextArea.super.setToolTipText(tooltip);
|
MageTextArea.super.setToolTipText(tooltip);
|
||||||
} else {
|
} else {
|
||||||
MageTextArea.super.setToolTipText(null);
|
MageTextArea.super.setToolTipText(null);
|
||||||
|
|
|
@ -45,6 +45,7 @@ import mage.client.MageFrame;
|
||||||
import mage.client.chat.ChatPanelBasic;
|
import mage.client.chat.ChatPanelBasic;
|
||||||
import mage.client.components.MageTextArea;
|
import mage.client.components.MageTextArea;
|
||||||
import mage.client.dialog.MageDialog;
|
import mage.client.dialog.MageDialog;
|
||||||
|
import mage.client.util.GUISizeHelper;
|
||||||
import mage.client.util.audio.AudioManager;
|
import mage.client.util.audio.AudioManager;
|
||||||
import mage.client.util.gui.ArrowBuilder;
|
import mage.client.util.gui.ArrowBuilder;
|
||||||
import static mage.constants.Constants.Option.ORIGINAL_ID;
|
import static mage.constants.Constants.Option.ORIGINAL_ID;
|
||||||
|
@ -96,6 +97,11 @@ public class FeedbackPanel extends javax.swing.JPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setGUISize() {
|
private void setGUISize() {
|
||||||
|
btnLeft.setFont(GUISizeHelper.gameDialogAreaFont);
|
||||||
|
btnRight.setFont(GUISizeHelper.gameDialogAreaFont);
|
||||||
|
btnSpecial.setFont(GUISizeHelper.gameDialogAreaFont);
|
||||||
|
btnUndo.setFont(GUISizeHelper.gameDialogAreaFont);
|
||||||
|
|
||||||
helper.changeGUISize();
|
helper.changeGUISize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,8 +177,8 @@ public class FeedbackPanel extends javax.swing.JPanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getSmallText(String text) {
|
protected static String getSmallText(String text) {
|
||||||
return "<div style='font-size:11pt'>" + text + "</div>";
|
return "<div style='font-size:" + GUISizeHelper.gameDialogAreaFontSizeSmall + "pt'>" + text + "</div>";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setSpecial(String text, boolean visible) {
|
private void setSpecial(String text, boolean visible) {
|
||||||
|
|
|
@ -195,6 +195,8 @@ public final class GamePanel extends javax.swing.JPanel {
|
||||||
|
|
||||||
private MageDialogState choiceWindowState;
|
private MageDialogState choiceWindowState;
|
||||||
|
|
||||||
|
private int feedbackAreaHeight;
|
||||||
|
|
||||||
private enum PopUpMenuType {
|
private enum PopUpMenuType {
|
||||||
|
|
||||||
TRIGGER_ORDER
|
TRIGGER_ORDER
|
||||||
|
@ -378,15 +380,18 @@ public final class GamePanel extends javax.swing.JPanel {
|
||||||
jSplitPane1.setDividerSize(GUISizeHelper.dividerBarSize);
|
jSplitPane1.setDividerSize(GUISizeHelper.dividerBarSize);
|
||||||
jSplitPane2.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);
|
stackObjects.setCardDimension(GUISizeHelper.handCardDimension);
|
||||||
int newStackWidth = jPanel3.getWidth() * GUISizeHelper.stackWidth / 100;
|
int newStackWidth = jPanel3.getWidth() * GUISizeHelper.stackWidth / 100;
|
||||||
if (newStackWidth < 360) {
|
if (newStackWidth < 360) {
|
||||||
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.setPreferredSize(newDimension);
|
||||||
handContainer.setMaximumSize(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.setPreferredSize(newDimension);
|
||||||
stackObjects.setMinimumSize(newDimension);
|
stackObjects.setMinimumSize(newDimension);
|
||||||
stackObjects.setMaximumSize(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
|
// magenoxx: because of uncaught bug with saving state, rolling back and stack
|
||||||
// undo is allowed only for empty stack
|
// undo is allowed only for empty stack
|
||||||
controllingPlayer = !gameView.getPriorityPlayerName().equals(playerView.getName());
|
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());
|
feedbackPanel.allowUndo(playerView.getStatesSavedSize());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1137,8 +1142,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
||||||
if (controllingPlayer) {
|
if (controllingPlayer) {
|
||||||
priorityPlayerText = " / priority " + gameView.getPriorityPlayerName();
|
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);
|
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.setLabelFor(txtPriority);
|
||||||
lblPriority.setText("Priority Player:");
|
lblPriority.setText("Priority Player:");
|
||||||
|
|
||||||
feedbackPanel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(150, 50, 50), 2));
|
// feedbackPanel.setBorder(javax.swing.BorderFactory.createLineBorder(Color.MAGENTA, 5));
|
||||||
feedbackPanel.setMaximumSize(new java.awt.Dimension(208, 121));
|
// feedbackPanel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(150, 50, 50), 2));
|
||||||
feedbackPanel.setMinimumSize(new java.awt.Dimension(208, 121));
|
// feedbackPanel.setMaximumSize(new java.awt.Dimension(208, 121));
|
||||||
|
// feedbackPanel.setMinimumSize(new java.awt.Dimension(208, 121));
|
||||||
bigCard.setBorder(new LineBorder(Color.black, 1, true));
|
bigCard.setBorder(new LineBorder(Color.black, 1, true));
|
||||||
|
|
||||||
int c = JComponent.WHEN_IN_FOCUSED_WINDOW;
|
int c = JComponent.WHEN_IN_FOCUSED_WINDOW;
|
||||||
|
@ -1750,7 +1754,8 @@ public final class GamePanel extends javax.swing.JPanel {
|
||||||
jPhases.addMouseListener(phasesMouseAdapter);
|
jPhases.addMouseListener(phasesMouseAdapter);
|
||||||
|
|
||||||
pnlReplay.setOpaque(false);
|
pnlReplay.setOpaque(false);
|
||||||
HelperPanel helper = new HelperPanel();
|
helper = new HelperPanel();
|
||||||
|
// helper.setBorder(new LineBorder(Color.MAGENTA, 2));
|
||||||
helper.setPreferredSize(new Dimension(100, 90));
|
helper.setPreferredSize(new Dimension(100, 90));
|
||||||
feedbackPanel.setHelperPanel(helper);
|
feedbackPanel.setHelperPanel(helper);
|
||||||
|
|
||||||
|
@ -2200,6 +2205,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
||||||
|
|
||||||
private mage.client.chat.ChatPanelBasic gameChatPanel;
|
private mage.client.chat.ChatPanelBasic gameChatPanel;
|
||||||
private mage.client.game.FeedbackPanel feedbackPanel;
|
private mage.client.game.FeedbackPanel feedbackPanel;
|
||||||
|
private HelperPanel helper;
|
||||||
private mage.client.chat.ChatPanelBasic userChatPanel;
|
private mage.client.chat.ChatPanelBasic userChatPanel;
|
||||||
private javax.swing.JPanel jPanel2;
|
private javax.swing.JPanel jPanel2;
|
||||||
private javax.swing.JPanel jPanel3;
|
private javax.swing.JPanel jPanel3;
|
||||||
|
|
|
@ -73,6 +73,7 @@ public class HelperPanel extends JPanel {
|
||||||
//private javax.swing.JButton btnStopTimer;
|
//private javax.swing.JButton btnStopTimer;
|
||||||
|
|
||||||
private MageTextArea textArea;
|
private MageTextArea textArea;
|
||||||
|
JPanel buttonContainer;
|
||||||
|
|
||||||
private javax.swing.JButton linkLeft;
|
private javax.swing.JButton linkLeft;
|
||||||
private javax.swing.JButton linkRight;
|
private javax.swing.JButton linkRight;
|
||||||
|
@ -113,6 +114,12 @@ public class HelperPanel extends JPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setGUISize() {
|
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(popupMenuAskNo);
|
||||||
GUISizeHelper.changePopupMenuFont(popupMenuAskYes);
|
GUISizeHelper.changePopupMenuFont(popupMenuAskYes);
|
||||||
}
|
}
|
||||||
|
@ -124,13 +131,13 @@ public class HelperPanel extends JPanel {
|
||||||
setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
|
setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
|
||||||
setOpaque(false);
|
setOpaque(false);
|
||||||
|
|
||||||
JPanel container = new JPanel();
|
buttonContainer = new JPanel();
|
||||||
|
// buttonContainer.setBorder(new LineBorder(Color.RED, 1));
|
||||||
container.setPreferredSize(new Dimension(100, 30));
|
buttonContainer.setPreferredSize(new Dimension(100, 30));
|
||||||
container.setMinimumSize(new Dimension(20, 20));
|
buttonContainer.setMinimumSize(new Dimension(20, 20));
|
||||||
container.setMaximumSize(new Dimension(2000, 100));
|
buttonContainer.setMaximumSize(new Dimension(2000, 100));
|
||||||
container.setLayout(new GridBagLayout());
|
buttonContainer.setLayout(new GridBagLayout());
|
||||||
container.setOpaque(false);
|
buttonContainer.setOpaque(false);
|
||||||
|
|
||||||
JPanel jPanel = new JPanel();
|
JPanel jPanel = new JPanel();
|
||||||
|
|
||||||
|
@ -142,20 +149,20 @@ public class HelperPanel extends JPanel {
|
||||||
jPanel.add(textArea);
|
jPanel.add(textArea);
|
||||||
add(jPanel);
|
add(jPanel);
|
||||||
|
|
||||||
add(container);
|
add(buttonContainer);
|
||||||
|
|
||||||
btnSpecial = new JButton("Special");
|
btnSpecial = new JButton("Special");
|
||||||
btnSpecial.setVisible(false);
|
btnSpecial.setVisible(false);
|
||||||
container.add(btnSpecial);
|
buttonContainer.add(btnSpecial);
|
||||||
btnLeft = new JButton("OK");
|
btnLeft = new JButton("OK");
|
||||||
btnLeft.setVisible(false);
|
btnLeft.setVisible(false);
|
||||||
container.add(btnLeft);
|
buttonContainer.add(btnLeft);
|
||||||
btnRight = new JButton("Cancel");
|
btnRight = new JButton("Cancel");
|
||||||
btnRight.setVisible(false);
|
btnRight.setVisible(false);
|
||||||
container.add(btnRight);
|
buttonContainer.add(btnRight);
|
||||||
btnUndo = new JButton("Undo");
|
btnUndo = new JButton("Undo");
|
||||||
btnUndo.setVisible(false);
|
btnUndo.setVisible(false);
|
||||||
container.add(btnUndo);
|
buttonContainer.add(btnUndo);
|
||||||
|
|
||||||
MouseListener checkPopupAdapter = new MouseAdapter() {
|
MouseListener checkPopupAdapter = new MouseAdapter() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -52,8 +52,11 @@ public class GUISizeHelper {
|
||||||
|
|
||||||
public static Font gameRequestsFont = new java.awt.Font("Arial", 0, 12);
|
public static Font gameRequestsFont = new java.awt.Font("Arial", 0, 12);
|
||||||
|
|
||||||
public static Font gameDialogAreaFontBig = new java.awt.Font("Arial", 0, 12);
|
public static int gameDialogAreaFontSizeBig = 16;
|
||||||
public static Font gameDialogAreaFontSmall = new java.awt.Font("Arial", 0, 12);
|
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 Dimension handCardDimension;
|
||||||
public static int stackWidth;
|
public static int stackWidth;
|
||||||
|
@ -103,6 +106,13 @@ public class GUISizeHelper {
|
||||||
gameRequestsFont = new Font("Arial", 0, dialogFontSize);
|
gameRequestsFont = new Font("Arial", 0, dialogFontSize);
|
||||||
symbolDialogSize = 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);
|
int chatFontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_CHAT_FONT_SIZE, 14);
|
||||||
chatFont = new java.awt.Font("Arial", 0, chatFontSize);
|
chatFont = new java.awt.Font("Arial", 0, chatFontSize);
|
||||||
symbolChatSize = chatFontSize;
|
symbolChatSize = chatFontSize;
|
||||||
|
|
|
@ -236,16 +236,16 @@ public class GuiDisplayUtil {
|
||||||
buffer.append("<img src='").append(getResourcePath("card/color_ind_white.png")).append("' alt='W' ").append(imageSize);
|
buffer.append("<img src='").append(getResourcePath("card/color_ind_white.png")).append("' alt='W' ").append(imageSize);
|
||||||
}
|
}
|
||||||
if (card.getColor().isBlue()) {
|
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()) {
|
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()) {
|
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()) {
|
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()) {
|
if (!card.getColor().isColorless()) {
|
||||||
buffer.append(" ");
|
buffer.append(" ");
|
||||||
|
@ -339,10 +339,6 @@ public class GuiDisplayUtil {
|
||||||
|
|
||||||
String legal = rule.toString();
|
String legal = rule.toString();
|
||||||
if (legal.length() > 0) {
|
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("\\{this\\}", card.getName().isEmpty() ? "this" : card.getName());
|
||||||
legal = legal.replaceAll("\\{source\\}", card.getName().isEmpty() ? "this" : card.getName());
|
legal = legal.replaceAll("\\{source\\}", card.getName().isEmpty() ? "this" : card.getName());
|
||||||
buffer.append(ManaSymbols.replaceSymbolsWithHTML(legal, ManaSymbols.Type.TOOLTIP));
|
buffer.append(ManaSymbols.replaceSymbolsWithHTML(legal, ManaSymbols.Type.TOOLTIP));
|
||||||
|
|
Loading…
Reference in a new issue