GUI, preferences: removed 4 useless size settings, fixed wrong fonts in few places like miss image path (part of #969, #6887)

This commit is contained in:
Oleg Agafonov 2024-07-27 21:35:33 +04:00
parent ba929d5692
commit 53a072b759
22 changed files with 166 additions and 180 deletions

View file

@ -413,7 +413,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
return; return;
} }
int height = GUISizeHelper.enlargedImageHeight; int height = GUISizeHelper.cardTooltipLargeImageHeight;
int width = (int) ((float) height * (float) 0.64); int width = (int) ((float) height * (float) 0.64);
bigCard.setSize(width, height); bigCard.setSize(width, height);
cardPreviewContainer.setBounds(0, 0, width + 80, height + 30); cardPreviewContainer.setBounds(0, 0, width + 80, height + 30);
@ -474,7 +474,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
private void setGUISizeTooltipContainer() { private void setGUISizeTooltipContainer() {
try { try {
int height = GUISizeHelper.enlargedImageHeight; int height = GUISizeHelper.cardTooltipLargeImageHeight;
int width = (int) ((float) height * (float) 0.64); int width = (int) ((float) height * (float) 0.64);
JPanel cardPreviewContainer = (JPanel) UI.getComponent(MageComponents.CARD_PREVIEW_CONTAINER); JPanel cardPreviewContainer = (JPanel) UI.getComponent(MageComponents.CARD_PREVIEW_CONTAINER);
@ -610,7 +610,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
MagePane window = (MagePane) windows[i]; MagePane window = (MagePane) windows[i];
if (window.isVisible()) { if (window.isVisible()) {
menuItem = new MagePaneMenuItem(window); menuItem = new MagePaneMenuItem(window);
menuItem.setFont(GUISizeHelper.menuFont); menuItem.setFont(GUISizeHelper.dialogFont);
menuItem.setState(i == 0); menuItem.setState(i == 0);
menuItem.addActionListener(ae -> { menuItem.addActionListener(ae -> {
MagePane frame = ((MagePaneMenuItem) ae.getSource()).getFrame(); MagePane frame = ((MagePaneMenuItem) ae.getSource()).getFrame();
@ -935,7 +935,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
jMemUsageLabel = new javax.swing.JLabel(); jMemUsageLabel = new javax.swing.JLabel();
menuDebugTestModalDialog.setText("Test Modal Dialogs"); menuDebugTestModalDialog.setText("Test Modal Dialogs");
menuDebugTestModalDialog.setFont(GUISizeHelper.menuFont); menuDebugTestModalDialog.setFont(GUISizeHelper.dialogFont);
menuDebugTestModalDialog.addActionListener(new java.awt.event.ActionListener() { menuDebugTestModalDialog.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) { public void actionPerformed(java.awt.event.ActionEvent evt) {
menuDebugTestModalDialogActionPerformed(evt); menuDebugTestModalDialogActionPerformed(evt);
@ -944,7 +944,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
popupDebug.add(menuDebugTestModalDialog); popupDebug.add(menuDebugTestModalDialog);
menuDebugTestCardRenderModesDialog.setText("Test Card Render Modes"); menuDebugTestCardRenderModesDialog.setText("Test Card Render Modes");
menuDebugTestCardRenderModesDialog.setFont(GUISizeHelper.menuFont); menuDebugTestCardRenderModesDialog.setFont(GUISizeHelper.dialogFont);
menuDebugTestCardRenderModesDialog.addActionListener(new java.awt.event.ActionListener() { menuDebugTestCardRenderModesDialog.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) { public void actionPerformed(java.awt.event.ActionEvent evt) {
menuDebugTestCardRenderModesDialogActionPerformed(evt); menuDebugTestCardRenderModesDialogActionPerformed(evt);
@ -1830,7 +1830,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
} }
private void setGUISize() { private void setGUISize() {
Font font = GUISizeHelper.menuFont; Font font = GUISizeHelper.dialogFont;
mageToolbar.setFont(font); mageToolbar.setFont(font);
int newHeight = font.getSize() + 6; int newHeight = font.getSize() + 6;
Dimension mageToolbarDimension = mageToolbar.getPreferredSize(); Dimension mageToolbarDimension = mageToolbar.getPreferredSize();

View file

@ -215,7 +215,7 @@
this.countLabels.add(label); this.countLabels.add(label);
this.add(label, (Integer) 0); // draw on background this.add(label, (Integer) 0); // draw on background
label.setLocation(columnNumber * cardDimension.width, 5); label.setLocation(columnNumber * cardDimension.width, 5);
label.setSize(cardDimension.width, DragCardGrid.COUNT_LABEL_HEIGHT); label.setSize(cardDimension.width, DragCardGrid.COUNT_LABEL_HEIGHT); // TODO: add here?
label.setVisible(true); label.setVisible(true);
return label; return label;
} }

View file

@ -328,7 +328,7 @@ public class CardIconsPanel extends JPanel {
// text // text
String hint = ManaSymbols.replaceSymbolsWithHTML(icon.getHint(), ManaSymbols.Type.CARD_ICON_HINT); String hint = ManaSymbols.replaceSymbolsWithHTML(icon.getHint(), ManaSymbols.Type.CARD_ICON_HINT);
hint = GUISizeHelper.textToHtmlWithSize(hint, GUISizeHelper.cardTooltipFontSize); hint = GUISizeHelper.textToHtmlWithSize(hint, GUISizeHelper.cardTooltipFont.getSize());
JLabel label = new JLabel(); JLabel label = new JLabel();
label.setToolTipText("<html>" + hint); label.setToolTipText("<html>" + hint);
if (!icon.getText().isEmpty()) { if (!icon.getText().isEmpty()) {

View file

@ -41,7 +41,7 @@
private Dimension cardDimension; private Dimension cardDimension;
private final List<JLabel> countLabels = new ArrayList<>(); // count label code copy-pasted from CardGrid.java private final List<JLabel> countLabels = new ArrayList<>(); // count label code copy-pasted from CardGrid.java
private int rowHeight; private int cardOffsetInStack;
private CardsView cards; private CardsView cards;
private Map<UUID, MageCard> mageCards = new LinkedHashMap<>(); private Map<UUID, MageCard> mageCards = new LinkedHashMap<>();
protected BigCard bigCard; protected BigCard bigCard;
@ -105,9 +105,9 @@
private void setGUISize() { private void setGUISize() {
mainTable.getTableHeader().setFont(GUISizeHelper.tableFont); mainTable.getTableHeader().setFont(GUISizeHelper.tableFont);
mainTable.setFont(GUISizeHelper.tableFont); mainTable.setFont(GUISizeHelper.tableFont);
mainTable.setRowHeight(GUISizeHelper.getTableRowHeight()); mainTable.setRowHeight(GUISizeHelper.tableRowHeight);
cardDimension = GUISizeHelper.editorCardDimension; cardDimension = GUISizeHelper.editorCardDimension;
rowHeight = GUISizeHelper.editorCardVertOffsetInStack; cardOffsetInStack = GUISizeHelper.editorCardVertOffsetInStack;
} }
private void makeTransparent() { private void makeTransparent() {
@ -357,13 +357,13 @@
String description = comparator.getCategoryName(card); String description = comparator.getCategoryName(card);
DragCardGrid.updateCountLabel(lastCountLabel, curRow + 1, description); DragCardGrid.updateCountLabel(lastCountLabel, curRow + 1, description);
rectangle.setLocation(curColumn * cardDimension.width, curRow * rowHeight + DragCardGrid.COUNT_LABEL_HEIGHT); rectangle.setLocation(curColumn * cardDimension.width, curRow * cardOffsetInStack + DragCardGrid.COUNT_LABEL_HEIGHT);
setCardBounds(mageCards.get(card.getId()), rectangle); setCardBounds(mageCards.get(card.getId()), rectangle);
curRow++; curRow++;
lastCard = card; lastCard = card;
} else { } else {
rectangle.setLocation(curColumn * cardDimension.width, curRow * rowHeight); rectangle.setLocation(curColumn * cardDimension.width, curRow * cardOffsetInStack);
setCardBounds(mageCards.get(card.getId()), rectangle); setCardBounds(mageCards.get(card.getId()), rectangle);
curColumn++; curColumn++;
if (curColumn == numColumns) { if (curColumn == numColumns) {
@ -377,7 +377,7 @@
maxRow = Math.max(maxRow, curRow); maxRow = Math.max(maxRow, curRow);
maxColumn = Math.max(maxColumn, curColumn); maxColumn = Math.max(maxColumn, curColumn);
updateCounts(); updateCounts();
cardArea.setPreferredSize(new Dimension((maxColumn + 1) * cardDimension.width, cardDimension.height + maxRow * rowHeight)); cardArea.setPreferredSize(new Dimension((maxColumn + 1) * cardDimension.width, cardDimension.height + maxRow * cardOffsetInStack));
cardArea.revalidate(); cardArea.revalidate();
this.revalidate(); this.revalidate();
this.repaint(); this.repaint();

View file

@ -1,11 +1,9 @@
package mage.client.components; package mage.client.components;
import java.awt.Color; import java.awt.Color;
import javax.swing.JEditorPane;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import mage.client.util.GUISizeHelper; import mage.client.util.GUISizeHelper;
import org.mage.card.arcane.ManaSymbols; import org.mage.card.arcane.ManaSymbols;
import org.mage.card.arcane.UI;
/** /**
* GUI: component for displaying text in feedback panel. Support html, mana symbols and popups. * GUI: component for displaying text in feedback panel. Support html, mana symbols and popups.
@ -46,7 +44,7 @@ public class MageTextArea extends MageEditorPane {
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("<body style='font-family:Dialog;font-size:"); buffer.append("<body style='font-family:Dialog;font-size:");
buffer.append(GUISizeHelper.gameDialogAreaFontSizeBig); buffer.append(GUISizeHelper.gameFeedbackPanelMainMessageFontSize);
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)
@ -66,7 +64,7 @@ public class MageTextArea extends MageEditorPane {
// 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 = "<html><center><body style='font-family:Dialog;font-size:" String tooltip = "<html><center><body style='font-family:Dialog;font-size:"
+ GUISizeHelper.gameDialogAreaFontSizeBig + GUISizeHelper.gameFeedbackPanelMainMessageFontSize
+ "pt;color: #FFFFFF'><p width='500'>" + basicText + "</p></body></html>"; + "pt;color: #FFFFFF'><p width='500'>" + basicText + "</p></body></html>";
MageTextArea.super.setToolTipText(tooltip); MageTextArea.super.setToolTipText(tooltip);
} else { } else {

View file

@ -184,7 +184,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
private void setGUISize() { private void setGUISize() {
mainTable.getTableHeader().setFont(GUISizeHelper.tableFont); mainTable.getTableHeader().setFont(GUISizeHelper.tableFont);
mainTable.setFont(GUISizeHelper.tableFont); mainTable.setFont(GUISizeHelper.tableFont);
mainTable.setRowHeight(GUISizeHelper.getTableRowHeight()); mainTable.setRowHeight(GUISizeHelper.tableRowHeight);
} }

View file

@ -511,7 +511,7 @@ public class CardHintsHelperDialog extends MageDialog implements MageDesktopIcon
@Override @Override
public void changeGUISize() { public void changeGUISize() {
setGUISize(GUISizeHelper.chatFont); setGUISize(GUISizeHelper.dialogFont);
this.validate(); this.validate();
this.repaint(); this.repaint();
} }

View file

@ -46,11 +46,11 @@ public class ErrorDialog extends MageDialog {
public void changeGUISize() { public void changeGUISize() {
super.changeGUISize(); super.changeGUISize();
this.textError.setFont(GUISizeHelper.gameDialogAreaFont); this.textError.setFont(GUISizeHelper.gameFeedbackPanelFont);
this.textInfo.setFont(GUISizeHelper.gameDialogAreaFont); this.textInfo.setFont(GUISizeHelper.gameFeedbackPanelFont);
this.btnCopyToClipboard.setFont(GUISizeHelper.gameDialogAreaFont); this.btnCopyToClipboard.setFont(GUISizeHelper.gameFeedbackPanelFont);
this.btnOpenGithub.setFont(GUISizeHelper.gameDialogAreaFont); this.btnOpenGithub.setFont(GUISizeHelper.gameFeedbackPanelFont);
this.btnOK.setFont(GUISizeHelper.gameDialogAreaFont); this.btnOK.setFont(GUISizeHelper.gameFeedbackPanelFont);
} }
private void openGithub() { private void openGithub() {

View file

@ -53,7 +53,7 @@ public class PickChoiceDialog extends MageDialog {
// pick choice shared in multiple dialogs, so modify window size only one time // pick choice shared in multiple dialogs, so modify window size only one time
// TODO: implement global window size settings and runtime theme support by gui scale logic (interface like MageThemeSupported:onSizeChanged,onThemeChanged,etc) // TODO: implement global window size settings and runtime theme support by gui scale logic (interface like MageThemeSupported:onSizeChanged,onThemeChanged,etc)
float guiScale = GUISizeHelper.gameDialogAreaFont.getSize2D() / GUISizeHelper.gameDialogAreaDefaultFontSize; float guiScale = GUISizeHelper.gameFeedbackPanelFont.getSize2D() / GUISizeHelper.gameDialogAreaDefaultFontSize;
int newWidth = GUISizeHelper.guiSizeScale(this.getSize().width, guiScale); int newWidth = GUISizeHelper.guiSizeScale(this.getSize().width, guiScale);
int newHeight = GUISizeHelper.guiSizeScale(this.getSize().height, guiScale); int newHeight = GUISizeHelper.guiSizeScale(this.getSize().height, guiScale);
this.setSize(newWidth, newHeight); this.setSize(newWidth, newHeight);
@ -286,14 +286,14 @@ public class PickChoiceDialog extends MageDialog {
public void changeGUISize() { public void changeGUISize() {
super.changeGUISize(); super.changeGUISize();
this.textMessage.setFont(GUISizeHelper.gameDialogAreaFont); this.textMessage.setFont(GUISizeHelper.gameFeedbackPanelFont);
this.textSubMessage.setFont(GUISizeHelper.gameDialogAreaFont); this.textSubMessage.setFont(GUISizeHelper.gameFeedbackPanelFont);
this.labelSearch.setFont(GUISizeHelper.gameDialogAreaFont); this.labelSearch.setFont(GUISizeHelper.gameFeedbackPanelFont);
this.editSearch.setFont(GUISizeHelper.gameDialogAreaFont); this.editSearch.setFont(GUISizeHelper.gameFeedbackPanelFont);
this.cbSpecial.setFont(GUISizeHelper.gameDialogAreaFont); this.cbSpecial.setFont(GUISizeHelper.gameFeedbackPanelFont);
this.listChoices.setFont(GUISizeHelper.tableFont); this.listChoices.setFont(GUISizeHelper.tableFont);
this.btOK.setFont(GUISizeHelper.gameDialogAreaFont); this.btOK.setFont(GUISizeHelper.gameFeedbackPanelFont);
this.btCancel.setFont(GUISizeHelper.gameDialogAreaFont); this.btCancel.setFont(GUISizeHelper.gameFeedbackPanelFont);
} }
private void choiceHintShow(int modelIndex) { private void choiceHintShow(int modelIndex) {

View file

@ -51,6 +51,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
private static final Logger logger = Logger.getLogger(PreferencesDialog.class); private static final Logger logger = Logger.getLogger(PreferencesDialog.class);
// WARNING, do not change const values - it must be same for compatibility with user's saved settings
public static final String KEY_SHOW_TOOLTIPS_DELAY = "showTooltipsDelay"; public static final String KEY_SHOW_TOOLTIPS_DELAY = "showTooltipsDelay";
public static final String KEY_SHOW_CARD_NAMES = "showCardNames"; public static final String KEY_SHOW_CARD_NAMES = "showCardNames";
public static final String KEY_SHOW_FULL_IMAGE_PATH = "showFullImagePath"; public static final String KEY_SHOW_FULL_IMAGE_PATH = "showFullImagePath";
@ -66,16 +67,12 @@ public class PreferencesDialog extends javax.swing.JDialog {
public static final String KEY_BATTLEFIELD_FEEDBACK_COLORIZING_MODE = "battlefieldFeedbackColorizingMode"; public static final String KEY_BATTLEFIELD_FEEDBACK_COLORIZING_MODE = "battlefieldFeedbackColorizingMode";
// size settings // size settings
public static final String KEY_GUI_TABLE_FONT_SIZE = "guiTableFontSize";
public static final String KEY_GUI_CHAT_FONT_SIZE = "guiChatFontSize"; public static final String KEY_GUI_CHAT_FONT_SIZE = "guiChatFontSize";
public static final String KEY_GUI_CARD_HAND_SIZE = "guiCardHandSize"; public static final String KEY_GUI_CARD_HAND_SIZE = "guiCardHandSize";
public static final String KEY_GUI_CARD_EDITOR_SIZE = "guiCardEditorSize"; public static final String KEY_GUI_CARD_EDITOR_SIZE = "guiCardEditorSize";
public static final String KEY_GUI_CARD_OFFSET_SIZE = "guiCardOffsetSize";
public static final String KEY_GUI_ENLARGED_IMAGE_SIZE = "guiEnlargedImageSize";
public static final String KEY_GUI_STACK_WIDTH = "guiStackWidth"; public static final String KEY_GUI_STACK_WIDTH = "guiStackWidth";
public static final String KEY_GUI_TOOLTIP_SIZE = "guiTooltipSize"; public static final String KEY_GUI_TOOLTIP_SIZE = "guiTooltipSize";
public static final String KEY_GUI_DIALOG_FONT_SIZE = "guiDialogFontSize"; public static final String KEY_GUI_DIALOG_FONT_SIZE = "guiDialogFontSize";
public static final String KEY_GUI_FEEDBACK_FONT_SIZE = "guiFeedbackAreaSize";
public static final String KEY_GUI_CARD_OTHER_ZONES_SIZE = "guiCardOtherZonesSize"; public static final String KEY_GUI_CARD_OTHER_ZONES_SIZE = "guiCardOtherZonesSize";
public static final String KEY_GUI_CARD_BATTLEFIELD_MIN_SIZE = "guiCardBattlefieldMinSize"; public static final String KEY_GUI_CARD_BATTLEFIELD_MIN_SIZE = "guiCardBattlefieldMinSize";
public static final String KEY_GUI_CARD_BATTLEFIELD_MAX_SIZE = "guiCardBattlefieldMaxSize"; public static final String KEY_GUI_CARD_BATTLEFIELD_MAX_SIZE = "guiCardBattlefieldMaxSize";
@ -94,7 +91,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
public static final String KEY_CARD_IMAGES_SAVE_TO_ZIP = "cardImagesSaveToZip"; public static final String KEY_CARD_IMAGES_SAVE_TO_ZIP = "cardImagesSaveToZip";
public static final String KEY_CARD_IMAGES_PREF_LANGUAGE = "cardImagesPreferredImageLaguage"; public static final String KEY_CARD_IMAGES_PREF_LANGUAGE = "cardImagesPreferredImageLaguage";
public static final String KEY_CARD_RENDERING_FALLBACK = "cardRenderingFallback"; public static final String KEY_CARD_RENDERING_IMAGE_MODE = "cardRenderingFallback";
public static final String KEY_CARD_RENDERING_ICONS_FOR_ABILITIES = "cardRenderingIconsForAbilities"; public static final String KEY_CARD_RENDERING_ICONS_FOR_ABILITIES = "cardRenderingIconsForAbilities";
public static final String KEY_CARD_RENDERING_ICONS_FOR_PLAYABLE = "cardRenderingIconsForPlayable"; public static final String KEY_CARD_RENDERING_ICONS_FOR_PLAYABLE = "cardRenderingIconsForPlayable";
public static final String KEY_CARD_RENDERING_REMINDER_TEXT = "cardRenderingReminderText"; public static final String KEY_CARD_RENDERING_REMINDER_TEXT = "cardRenderingReminderText";
@ -561,22 +558,18 @@ public class PreferencesDialog extends javax.swing.JDialog {
// prepare size table (you can change settings order by new position index) // prepare size table (you can change settings order by new position index)
// warning, if you change default values then make sure calculateGUISizes uses same // warning, if you change default values then make sure calculateGUISizes uses same
// basic // App's elements (from position 1)
createSizeSetting(1, KEY_GUI_TABLE_FONT_SIZE,14, true, "Font in tables", "The size of the font used to display table text."); createSizeSetting(1, KEY_GUI_DIALOG_FONT_SIZE, 14, true, "Font in dialogs and menu", "The size of the font of messages, menu, dialogs and other windows");
createSizeSetting(2, KEY_GUI_DIALOG_FONT_SIZE, 14, true, "Font in messages and menu", "The size of the font of messages and menues"); createSizeSetting(2, KEY_GUI_CHAT_FONT_SIZE, 14, true, "Font in logs and chats", "The size of the font used to display the chat text");
createSizeSetting(3, KEY_GUI_CHAT_FONT_SIZE, 14, true, "Font in chat", "The size of the font used to display the chat text"); createSizeSetting(3, KEY_GUI_CARD_EDITOR_SIZE,14, false, "Size of cards in editor and draft panels", "The size of the card in editor and the picked zone of the draft panel ");
createSizeSetting(4, KEY_GUI_CARD_EDITOR_SIZE,14, false, "Size of cards in editor and draft panels", "The size of the card in editor and the picked zone of the draft panel "); createSizeSetting(4, KEY_GUI_TOOLTIP_SIZE,17, true, "Size of popup card hint", "The size of the tooltip window for cards or permanents (use mouse wheel to switch text/image mode)");
createSizeSetting(5, KEY_GUI_CARD_OFFSET_SIZE,14, false, "Offset of card's image", "The vertical offset of card images in editor areas "); // TODO: delete // Game's elements (from position 8)
createSizeSetting(6, KEY_GUI_ENLARGED_IMAGE_SIZE, 20, false, "Size of popup card hint (image mode by mouse wheel)", "The size of the image shown for the card your mouse pointer<br>is located over while you turn the mouse wheel");
createSizeSetting(7, KEY_GUI_TOOLTIP_SIZE,14, true, "Size of popup card hint (text mode)", "The size of the tooltip window for cards or permanents"); // TODO: share with popup image
// game
createSizeSetting(8, KEY_GUI_PLAYER_PANEL_SIZE,14, false, "Size of player panel", "The size of the player panels on battlefield"); createSizeSetting(8, KEY_GUI_PLAYER_PANEL_SIZE,14, false, "Size of player panel", "The size of the player panels on battlefield");
createSizeSetting(9, KEY_GUI_CARD_HAND_SIZE,14, false, "Size of cards in hand and stack", "The size of the card images in hand and on the stack"); createSizeSetting(9, KEY_GUI_CARD_HAND_SIZE,14, false, "Size of cards in hand and stack", "The size of the card images in hand and on the stack");
createSizeSetting(10, KEY_GUI_FEEDBACK_FONT_SIZE,14, true, "Font size of feedback panel (top of the hand)", "The size of the game feedback area (buttons and messages above the hand area)"); createSizeSetting(10, KEY_GUI_STACK_WIDTH,14, false, "Size of stack zone (right of the hand)", "The % size of the stack object area in relation to the hand card area size."); // TODO: delete
createSizeSetting(11, KEY_GUI_STACK_WIDTH,14, false, "Size of stack zone (right of the hand)", "The % size of the stack object area in relation to the hand card area size."); // TODO: delete createSizeSetting(11, KEY_GUI_CARD_OTHER_ZONES_SIZE,14, false, "Size of cards in other zones", "The size of card in other game zone (e.g. graveyard, revealed cards etc.)");
createSizeSetting(12, KEY_GUI_CARD_OTHER_ZONES_SIZE,14, false, "Size of cards in other zones", "The size of card in other game zone (e.g. graveyard, revealed cards etc.)"); createSizeSetting(12, KEY_GUI_CARD_BATTLEFIELD_MIN_SIZE,10, false, "Size of permanents (min)", "The minimum size of permanents on the battlefield");
createSizeSetting(13, KEY_GUI_CARD_BATTLEFIELD_MIN_SIZE,10, false, "Size of permanents (min)", "The minimum size of permanents on the battlefield"); createSizeSetting(13, KEY_GUI_CARD_BATTLEFIELD_MAX_SIZE,14, false, "Size of permanents (max)", "The maximum size of permanents on the battlefield");
createSizeSetting(14, KEY_GUI_CARD_BATTLEFIELD_MAX_SIZE,14, false, "Size of permanents (max)", "The maximum size of permanents on the battlefield");
// hide unused controls // hide unused controls
hideUnusedSizeSettings(); hideUnusedSizeSettings();
@ -2916,7 +2909,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
save(prefs, dialog.cbUseRandomBattleImage, KEY_BATTLEFIELD_IMAGE_RANDOM, "true", "false", UPDATE_CACHE_POLICY); save(prefs, dialog.cbUseRandomBattleImage, KEY_BATTLEFIELD_IMAGE_RANDOM, "true", "false", UPDATE_CACHE_POLICY);
// rendering // rendering
save(prefs, dialog.cbCardRenderImageFallback, KEY_CARD_RENDERING_FALLBACK, "true", "false", UPDATE_CACHE_POLICY); save(prefs, dialog.cbCardRenderImageFallback, KEY_CARD_RENDERING_IMAGE_MODE, "true", "false", UPDATE_CACHE_POLICY);
save(prefs, dialog.cbCardRenderIconsForAbilities, KEY_CARD_RENDERING_ICONS_FOR_ABILITIES, "true", "false", UPDATE_CACHE_POLICY); save(prefs, dialog.cbCardRenderIconsForAbilities, KEY_CARD_RENDERING_ICONS_FOR_ABILITIES, "true", "false", UPDATE_CACHE_POLICY);
save(prefs, dialog.cbCardRenderIconsForPlayable, KEY_CARD_RENDERING_ICONS_FOR_PLAYABLE, "true", "false", UPDATE_CACHE_POLICY); save(prefs, dialog.cbCardRenderIconsForPlayable, KEY_CARD_RENDERING_ICONS_FOR_PLAYABLE, "true", "false", UPDATE_CACHE_POLICY);
save(prefs, dialog.cbCardRenderHideSetSymbol, KEY_CARD_RENDERING_SET_SYMBOL, "true", "false", UPDATE_CACHE_POLICY); save(prefs, dialog.cbCardRenderHideSetSymbol, KEY_CARD_RENDERING_SET_SYMBOL, "true", "false", UPDATE_CACHE_POLICY);
@ -3376,7 +3369,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
dialog.cbPreferredImageLanguage.setSelectedItem(MageFrame.getPreferences().get(KEY_CARD_IMAGES_PREF_LANGUAGE, CardLanguage.ENGLISH.getCode())); dialog.cbPreferredImageLanguage.setSelectedItem(MageFrame.getPreferences().get(KEY_CARD_IMAGES_PREF_LANGUAGE, CardLanguage.ENGLISH.getCode()));
// rendering settings // rendering settings
load(prefs, dialog.cbCardRenderImageFallback, KEY_CARD_RENDERING_FALLBACK, "true", "false"); load(prefs, dialog.cbCardRenderImageFallback, KEY_CARD_RENDERING_IMAGE_MODE, "true", "false");
load(prefs, dialog.cbCardRenderIconsForAbilities, KEY_CARD_RENDERING_ICONS_FOR_ABILITIES, "true", "true"); load(prefs, dialog.cbCardRenderIconsForAbilities, KEY_CARD_RENDERING_ICONS_FOR_ABILITIES, "true", "true");
load(prefs, dialog.cbCardRenderIconsForPlayable, KEY_CARD_RENDERING_ICONS_FOR_PLAYABLE, "true", "true"); load(prefs, dialog.cbCardRenderIconsForPlayable, KEY_CARD_RENDERING_ICONS_FOR_PLAYABLE, "true", "true");
load(prefs, dialog.cbCardRenderHideSetSymbol, KEY_CARD_RENDERING_SET_SYMBOL, "true"); load(prefs, dialog.cbCardRenderHideSetSymbol, KEY_CARD_RENDERING_SET_SYMBOL, "true");
@ -3687,7 +3680,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
} }
public static int getRenderMode() { public static int getRenderMode() {
if (getCachedValue(PreferencesDialog.KEY_CARD_RENDERING_FALLBACK, "false").equals("false")) { if (getCachedValue(PreferencesDialog.KEY_CARD_RENDERING_IMAGE_MODE, "false").equals("false")) {
return 0; // mtgo return 0; // mtgo
} else { } else {
return 1; // image return 1; // image

View file

@ -79,7 +79,7 @@ public class TableWaitingDialog extends MageDialog {
private void setGUISize() { private void setGUISize() {
jTableSeats.getTableHeader().setFont(GUISizeHelper.tableFont); jTableSeats.getTableHeader().setFont(GUISizeHelper.tableFont);
jTableSeats.setFont(GUISizeHelper.tableFont); jTableSeats.setFont(GUISizeHelper.tableFont);
jTableSeats.setRowHeight(GUISizeHelper.getTableRowHeight()); jTableSeats.setRowHeight(GUISizeHelper.tableRowHeight);
jSplitPane1.setDividerSize(GUISizeHelper.dividerBarSize); jSplitPane1.setDividerSize(GUISizeHelper.dividerBarSize);
jScrollPane1.getVerticalScrollBar().setPreferredSize(new Dimension(GUISizeHelper.scrollBarSize, 0)); jScrollPane1.getVerticalScrollBar().setPreferredSize(new Dimension(GUISizeHelper.scrollBarSize, 0));

View file

@ -28,7 +28,7 @@ public class UserRequestDialog extends MageDialog {
} }
private void setGUISize() { private void setGUISize() {
Font font = GUISizeHelper.gameRequestsFont; Font font = GUISizeHelper.dialogFont;
lblText.setFont(font); lblText.setFont(font);
lblText.setMaximumSize(new Dimension(300 + font.getSize() * 15, 200 + font.getSize() * 5)); lblText.setMaximumSize(new Dimension(300 + font.getSize() * 15, 200 + font.getSize() * 5));
lblText.setMinimumSize(new Dimension(300 + font.getSize() * 15, 20 + font.getSize() * 5)); lblText.setMinimumSize(new Dimension(300 + font.getSize() * 15, 20 + font.getSize() * 5));

View file

@ -421,7 +421,7 @@ public final class GamePanel extends javax.swing.JPanel {
jSplitPane1.setDividerSize(GUISizeHelper.dividerBarSize); jSplitPane1.setDividerSize(GUISizeHelper.dividerBarSize);
jSplitPane2.setDividerSize(GUISizeHelper.dividerBarSize); jSplitPane2.setDividerSize(GUISizeHelper.dividerBarSize);
txtHoldPriority.setFont(new Font(GUISizeHelper.gameDialogAreaFont.getFontName(), Font.BOLD, GUISizeHelper.gameDialogAreaFont.getSize())); txtHoldPriority.setFont(new Font(GUISizeHelper.gameFeedbackPanelFont.getFontName(), Font.BOLD, GUISizeHelper.gameFeedbackPanelFont.getSize()));
GUISizeHelper.changePopupMenuFont(popupMenuTriggerOrder); GUISizeHelper.changePopupMenuFont(popupMenuTriggerOrder);
// hand + stack panels // hand + stack panels
@ -502,7 +502,7 @@ public final class GamePanel extends javax.swing.JPanel {
// as workaround: can change size for closed ability picker only // as workaround: can change size for closed ability picker only
if (this.abilityPicker != null && !this.abilityPicker.isVisible()) { if (this.abilityPicker != null && !this.abilityPicker.isVisible()) {
this.abilityPicker.fullRefresh(GUISizeHelper.dialogsGuiScale); this.abilityPicker.fullRefresh(GUISizeHelper.dialogGuiScale);
this.abilityPicker.init(gameId, bigCard); this.abilityPicker.init(gameId, bigCard);
} }
} }
@ -1997,7 +1997,7 @@ public final class GamePanel extends javax.swing.JPanel {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private void initComponents() { private void initComponents() {
abilityPicker = new mage.client.components.ability.AbilityPicker(GUISizeHelper.dialogsGuiScale); abilityPicker = new mage.client.components.ability.AbilityPicker(GUISizeHelper.dialogGuiScale);
jSplitPane1 = new javax.swing.JSplitPane(); jSplitPane1 = new javax.swing.JSplitPane();
jSplitPane0 = new javax.swing.JSplitPane(); jSplitPane0 = new javax.swing.JSplitPane();
jPanel2 = new javax.swing.JPanel(); jPanel2 = new javax.swing.JPanel();

View file

@ -101,18 +101,18 @@ public class HelperPanel extends JPanel {
private void setGUISize() { private void setGUISize() {
//this.setMaximumSize(new Dimension(getParent().getWidth(), Integer.MAX_VALUE)); //this.setMaximumSize(new Dimension(getParent().getWidth(), Integer.MAX_VALUE));
textAreaScrollPane.setMaximumSize(new Dimension(getParent().getWidth(), GUISizeHelper.gameDialogAreaTextHeight)); textAreaScrollPane.setMaximumSize(new Dimension(getParent().getWidth(), GUISizeHelper.gameFeedbackPanelMaxHeight));
textAreaScrollPane.setPreferredSize(new Dimension(getParent().getWidth(), GUISizeHelper.gameDialogAreaTextHeight)); textAreaScrollPane.setPreferredSize(new Dimension(getParent().getWidth(), GUISizeHelper.gameFeedbackPanelMaxHeight));
// dialogTextArea.setMaximumSize(new Dimension(getParent().getWidth(), Integer.MAX_VALUE)); // dialogTextArea.setMaximumSize(new Dimension(getParent().getWidth(), Integer.MAX_VALUE));
// dialogTextArea.setPreferredSize(new Dimension(getParent().getWidth(), GUISizeHelper.gameDialogAreaTextHeight)); // dialogTextArea.setPreferredSize(new Dimension(getParent().getWidth(), GUISizeHelper.gameDialogAreaTextHeight));
// buttonContainer.setPreferredSize(new Dimension(getParent().getWidth(), GUISizeHelper.gameDialogButtonHeight + 4)); // buttonContainer.setPreferredSize(new Dimension(getParent().getWidth(), GUISizeHelper.gameDialogButtonHeight + 4));
// buttonContainer.setMinimumSize(new Dimension(160, GUISizeHelper.gameDialogButtonHeight + 20)); // buttonContainer.setMinimumSize(new Dimension(160, GUISizeHelper.gameDialogButtonHeight + 20));
// buttonContainer.setMaximumSize(new Dimension(Integer.MAX_VALUE, GUISizeHelper.gameDialogButtonHeight + 4)); // buttonContainer.setMaximumSize(new Dimension(Integer.MAX_VALUE, GUISizeHelper.gameDialogButtonHeight + 4));
btnLeft.setFont(GUISizeHelper.gameDialogAreaFont); btnLeft.setFont(GUISizeHelper.gameFeedbackPanelFont);
btnRight.setFont(GUISizeHelper.gameDialogAreaFont); btnRight.setFont(GUISizeHelper.gameFeedbackPanelFont);
btnSpecial.setFont(GUISizeHelper.gameDialogAreaFont); btnSpecial.setFont(GUISizeHelper.gameFeedbackPanelFont);
btnUndo.setFont(GUISizeHelper.gameDialogAreaFont); btnUndo.setFont(GUISizeHelper.gameFeedbackPanelFont);
this.redrawMessages(); this.redrawMessages();
@ -414,9 +414,10 @@ public class HelperPanel extends JPanel {
} }
// search max const size // search max const size
int constButtonSizeW = GUISizeHelper.gameDialogButtonWidth * 200 / 100; // TODO: research and test sizing - need improve (e.g. for long messages)?
int constButtonSizeW = GUISizeHelper.gameFeedbackPanelButtonWidth * 200 / 100;
int constGridSizeW = buttons.size() * constButtonSizeW + BUTTONS_H_GAP * (buttons.size() - 1); int constGridSizeW = buttons.size() * constButtonSizeW + BUTTONS_H_GAP * (buttons.size() - 1);
int constGridSizeH = Math.round(GUISizeHelper.gameDialogButtonHeight * 150 / 100); int constGridSizeH = Math.round(GUISizeHelper.gameFeedbackPanelButtonHeight * 150 / 100);
if (needButtonSizeW < constButtonSizeW) { if (needButtonSizeW < constButtonSizeW) {
// same size mode (grid) // same size mode (grid)
@ -450,7 +451,7 @@ public class HelperPanel extends JPanel {
private void redrawMessages() { private void redrawMessages() {
String panelText = this.basicMessage; String panelText = this.basicMessage;
if (this.secondaryMessage != null) { if (this.secondaryMessage != null) {
panelText += "<div style='font-size:" + GUISizeHelper.gameDialogAreaFontSizeSmall + "pt'>" + secondaryMessage + "</div>"; panelText += "<div style='font-size:" + GUISizeHelper.gameFeedbackPanelExtraMessageFontSize + "pt'>" + secondaryMessage + "</div>";
} }
this.dialogTextArea.setText(panelText, this.getWidth()); this.dialogTextArea.setText(panelText, this.getWidth());
} }

View file

@ -117,13 +117,13 @@ public class PlayersChatPanel extends javax.swing.JPanel {
private void setGUISize() { private void setGUISize() {
jTablePlayers.getTableHeader().setFont(GUISizeHelper.tableFont); jTablePlayers.getTableHeader().setFont(GUISizeHelper.tableFont);
jTablePlayers.setFont(GUISizeHelper.tableFont); jTablePlayers.setFont(GUISizeHelper.tableFont);
jTablePlayers.setRowHeight(GUISizeHelper.getTableRowHeight()); jTablePlayers.setRowHeight(GUISizeHelper.tableRowHeight);
jScrollPanePlayers.getVerticalScrollBar().setPreferredSize(new Dimension(GUISizeHelper.scrollBarSize, 0)); jScrollPanePlayers.getVerticalScrollBar().setPreferredSize(new Dimension(GUISizeHelper.scrollBarSize, 0));
jScrollPanePlayers.getHorizontalScrollBar().setPreferredSize(new Dimension(0, GUISizeHelper.scrollBarSize)); jScrollPanePlayers.getHorizontalScrollBar().setPreferredSize(new Dimension(0, GUISizeHelper.scrollBarSize));
jScrollPaneSystem.getVerticalScrollBar().setPreferredSize(new Dimension(GUISizeHelper.scrollBarSize, 0)); jScrollPaneSystem.getVerticalScrollBar().setPreferredSize(new Dimension(GUISizeHelper.scrollBarSize, 0));
jScrollPaneSystem.getHorizontalScrollBar().setPreferredSize(new Dimension(0, GUISizeHelper.scrollBarSize)); jScrollPaneSystem.getHorizontalScrollBar().setPreferredSize(new Dimension(0, GUISizeHelper.scrollBarSize));
jTabbedPaneText.setFont(GUISizeHelper.getTabFont()); jTabbedPaneText.setFont(GUISizeHelper.tableFont);
jSplitPane1.setDividerSize(GUISizeHelper.dividerBarSize); jSplitPane1.setDividerSize(GUISizeHelper.dividerBarSize);
} }

View file

@ -52,7 +52,6 @@ import java.util.List;
import java.util.*; import java.util.*;
import java.util.concurrent.CancellationException; import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import static mage.client.dialog.PreferencesDialog.*; import static mage.client.dialog.PreferencesDialog.*;
@ -590,11 +589,11 @@ public class TablesPanel extends javax.swing.JPanel {
private void setGUISize() { private void setGUISize() {
tableTables.getTableHeader().setFont(GUISizeHelper.tableFont); tableTables.getTableHeader().setFont(GUISizeHelper.tableFont);
tableTables.setFont(GUISizeHelper.tableFont); tableTables.setFont(GUISizeHelper.tableFont);
tableTables.setRowHeight(GUISizeHelper.getTableRowHeight()); tableTables.setRowHeight(GUISizeHelper.tableRowHeight);
tableCompleted.getTableHeader().setFont(GUISizeHelper.tableFont); tableCompleted.getTableHeader().setFont(GUISizeHelper.tableFont);
tableCompleted.setFont(GUISizeHelper.tableFont); tableCompleted.setFont(GUISizeHelper.tableFont);
tableCompleted.setRowHeight(GUISizeHelper.getTableRowHeight()); tableCompleted.setRowHeight(GUISizeHelper.tableRowHeight);
jSplitPane1.setDividerSize(GUISizeHelper.dividerBarSize); jSplitPane1.setDividerSize(GUISizeHelper.dividerBarSize);
jSplitPaneTables.setDividerSize(GUISizeHelper.dividerBarSize); jSplitPaneTables.setDividerSize(GUISizeHelper.dividerBarSize);
@ -603,20 +602,20 @@ public class TablesPanel extends javax.swing.JPanel {
ImageIcon icon = new javax.swing.ImageIcon(getClass().getResource("/buttons/state_waiting.png")); ImageIcon icon = new javax.swing.ImageIcon(getClass().getResource("/buttons/state_waiting.png"));
Image img = icon.getImage(); Image img = icon.getImage();
Image newimg = img.getScaledInstance(GUISizeHelper.menuFont.getSize(), GUISizeHelper.menuFont.getSize(), java.awt.Image.SCALE_SMOOTH); Image newimg = img.getScaledInstance(GUISizeHelper.dialogFont.getSize(), GUISizeHelper.dialogFont.getSize(), java.awt.Image.SCALE_SMOOTH);
btnStateWaiting.setIcon(new ImageIcon(newimg)); btnStateWaiting.setIcon(new ImageIcon(newimg));
icon = new javax.swing.ImageIcon(getClass().getResource("/buttons/state_active.png")); icon = new javax.swing.ImageIcon(getClass().getResource("/buttons/state_active.png"));
img = icon.getImage(); img = icon.getImage();
newimg = img.getScaledInstance(GUISizeHelper.menuFont.getSize(), GUISizeHelper.menuFont.getSize(), java.awt.Image.SCALE_SMOOTH); newimg = img.getScaledInstance(GUISizeHelper.dialogFont.getSize(), GUISizeHelper.dialogFont.getSize(), java.awt.Image.SCALE_SMOOTH);
btnStateActive.setIcon(new ImageIcon(newimg)); btnStateActive.setIcon(new ImageIcon(newimg));
icon = new javax.swing.ImageIcon(getClass().getResource("/buttons/state_finished.png")); icon = new javax.swing.ImageIcon(getClass().getResource("/buttons/state_finished.png"));
img = icon.getImage(); img = icon.getImage();
newimg = img.getScaledInstance(GUISizeHelper.menuFont.getSize(), GUISizeHelper.menuFont.getSize(), java.awt.Image.SCALE_SMOOTH); newimg = img.getScaledInstance(GUISizeHelper.dialogFont.getSize(), GUISizeHelper.dialogFont.getSize(), java.awt.Image.SCALE_SMOOTH);
btnStateFinished.setIcon(new ImageIcon(newimg)); btnStateFinished.setIcon(new ImageIcon(newimg));
int iconSize = 48 + GUISizeHelper.menuFont.getSize() * 2 - 15; int iconSize = 48 + GUISizeHelper.dialogFont.getSize() * 2 - 15;
icon = new javax.swing.ImageIcon(getClass().getResource("/buttons/match_new.png")); icon = new javax.swing.ImageIcon(getClass().getResource("/buttons/match_new.png"));
img = icon.getImage(); img = icon.getImage();
newimg = img.getScaledInstance(iconSize, iconSize, java.awt.Image.SCALE_SMOOTH); newimg = img.getScaledInstance(iconSize, iconSize, java.awt.Image.SCALE_SMOOTH);
@ -628,19 +627,19 @@ public class TablesPanel extends javax.swing.JPanel {
btnNewTournament.setIcon(new ImageIcon(newimg)); btnNewTournament.setIcon(new ImageIcon(newimg));
for (JToggleButton component : filterButtons) { for (JToggleButton component : filterButtons) {
component.setFont(GUISizeHelper.menuFont); component.setFont(GUISizeHelper.dialogFont);
} }
Dimension newDimension = new Dimension((int) jPanelBottom.getPreferredSize().getWidth(), GUISizeHelper.menuFont.getSize() + 28); Dimension newDimension = new Dimension((int) jPanelBottom.getPreferredSize().getWidth(), GUISizeHelper.dialogFont.getSize() + 28);
jPanelBottom.setMinimumSize(newDimension); jPanelBottom.setMinimumSize(newDimension);
jPanelBottom.setPreferredSize(newDimension); jPanelBottom.setPreferredSize(newDimension);
buttonWhatsNew.setFont(GUISizeHelper.menuFont); buttonWhatsNew.setFont(GUISizeHelper.dialogFont);
buttonNextMessage.setFont(GUISizeHelper.menuFont); buttonNextMessage.setFont(GUISizeHelper.dialogFont);
labelMessageHeader.setFont(new Font(GUISizeHelper.menuFont.getName(), Font.BOLD, GUISizeHelper.menuFont.getSize())); labelMessageHeader.setFont(new Font(GUISizeHelper.dialogFont.getName(), Font.BOLD, GUISizeHelper.dialogFont.getSize()));
labelMessageText.setFont(GUISizeHelper.menuFont); labelMessageText.setFont(GUISizeHelper.dialogFont);
btnQuickStart2Player.setFont(GUISizeHelper.menuFont); btnQuickStart2Player.setFont(GUISizeHelper.dialogFont);
btnQuickStart4Player.setFont(GUISizeHelper.menuFont); btnQuickStart4Player.setFont(GUISizeHelper.dialogFont);
btnQuickStartMCTS.setFont(GUISizeHelper.menuFont); btnQuickStartMCTS.setFont(GUISizeHelper.dialogFont);
} }
private void restoreDividerLocations() { private void restoreDividerLocations() {

View file

@ -119,11 +119,11 @@ public class TournamentPanel extends javax.swing.JPanel {
private void setGUISize() { private void setGUISize() {
tablePlayers.getTableHeader().setFont(GUISizeHelper.tableFont); tablePlayers.getTableHeader().setFont(GUISizeHelper.tableFont);
tablePlayers.setFont(GUISizeHelper.tableFont); tablePlayers.setFont(GUISizeHelper.tableFont);
tablePlayers.setRowHeight(GUISizeHelper.getTableRowHeight()); tablePlayers.setRowHeight(GUISizeHelper.tableRowHeight);
tableMatches.getTableHeader().setFont(GUISizeHelper.tableFont); tableMatches.getTableHeader().setFont(GUISizeHelper.tableFont);
tableMatches.setFont(GUISizeHelper.tableFont); tableMatches.setFont(GUISizeHelper.tableFont);
tableMatches.setRowHeight(GUISizeHelper.getTableRowHeight()); tableMatches.setRowHeight(GUISizeHelper.tableRowHeight);
jSplitPane1.setDividerSize(GUISizeHelper.dividerBarSize); jSplitPane1.setDividerSize(GUISizeHelper.dividerBarSize);
jSplitPane2.setDividerSize(GUISizeHelper.dividerBarSize); jSplitPane2.setDividerSize(GUISizeHelper.dividerBarSize);

View file

@ -23,12 +23,13 @@ public final class GUISizeHelper {
static final int CARD_IMAG_VALUE = 42; static final int CARD_IMAG_VALUE = 42;
public static String basicSymbolSize = "small"; public static String basicSymbolSize = "small";
static final int MIN_FONT_SIZE = 7;
public static int symbolCardSize = 15; public static int symbolCardSize = 15;
public static int symbolTableSize = 15; public static int symbolTableSize = 15;
public static int symbolChatSize = 15; public static int symbolChatSize = 15;
public static int symbolDialogSize = 15; public static int symbolDialogSize = 15;
public static int symbolTooltipSize = 15; public static int symbolTooltipSize = 15; // TODO: replace all symbolXXXSize by fontXXX usage
public static int symbolPaySize = 15; public static int symbolPaySize = 15;
public static int symbolEditorSize = 15; public static int symbolEditorSize = 15;
@ -38,33 +39,29 @@ public final class GUISizeHelper {
public static int dividerBarSize; public static int dividerBarSize;
public static int scrollBarSize; public static int scrollBarSize;
public static int flagHeight; public static int tableFlagHeight;
public static int cardTooltipFontSize = 15;
public static Font chatFont = new java.awt.Font("Arial", 0, 12); public static Font chatFont = new java.awt.Font("Arial", 0, 12);
public static Font tableFont = new java.awt.Font("Arial", 0, 12); public static Font tableFont = new java.awt.Font("Arial", 0, 12);
public static Font menuFont = new java.awt.Font("Arial", 0, 12); public static Font dialogFont = new java.awt.Font("Arial", 0, 12);
public static Font cardTooltipFont = new java.awt.Font("Arial", 0, 12);
public static Font gameRequestsFont = new java.awt.Font("Arial", 0, 12); public static int gameFeedbackPanelMainMessageFontSize = 16;
public static int gameFeedbackPanelExtraMessageFontSize = 11;
public static int gameDialogAreaFontSizeBig = 16; public static int gameFeedbackPanelMaxHeight = 0;
public static int gameDialogAreaFontSizeTooltip = 14;
public static int gameDialogAreaFontSizeSmall = 11;
public static int gameDialogAreaTextHeight = 0;
public static int gameDialogAreaButtonHigh = 16; public static int gameDialogAreaButtonHigh = 16;
public static Font gameDialogAreaFont = new java.awt.Font("Arial", 0, 12); public static Font gameFeedbackPanelFont = new java.awt.Font("Arial", 0, 12);
public static float gameDialogAreaDefaultFontSize = gameDialogAreaFont.getSize2D(); public static float gameDialogAreaDefaultFontSize = gameFeedbackPanelFont.getSize2D();
public static int gameDialogButtonHeight; public static int gameFeedbackPanelButtonHeight;
public static int gameDialogButtonWidth; public static int gameFeedbackPanelButtonWidth;
public static Dimension handCardDimension; public static Dimension handCardDimension;
public static int stackWidth; // percent public static int stackWidth; // percent
public static float playerPanelGuiScale; public static float playerPanelGuiScale;
public static float dialogsGuiScale; public static float dialogGuiScale;
public static Dimension otherZonesCardDimension; public static Dimension otherZonesCardDimension;
public static int otherZonesCardVerticalOffset; public static int otherZonesCardVerticalOffset;
@ -74,17 +71,9 @@ public final class GUISizeHelper {
public static Dimension editorCardDimension; public static Dimension editorCardDimension;
public static int editorCardVertOffsetInStack; public static int editorCardVertOffsetInStack;
public static int enlargedImageHeight; public static int cardTooltipLargeImageHeight;
public static int cardTooltipLargeTextHeight;
public static int getTableRowHeight() { public static int cardTooltipLargeTextWidth;
int fontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_TABLE_FONT_SIZE, 14);
return fontSize + 6;
}
public static Font getTabFont() {
int fontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_TABLE_FONT_SIZE, 14);
return new java.awt.Font("Arial", 0, fontSize);
}
public static Font getCardFont() { public static Font getCardFont() {
// default font type for some card panels (each render mode uses it's own font sizes) // default font type for some card panels (each render mode uses it's own font sizes)
@ -108,59 +97,59 @@ public final class GUISizeHelper {
} }
public static void calculateGUISizes() { public static void calculateGUISizes() {
int tableFontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_TABLE_FONT_SIZE, 14); // app - dialogs and menus
tableFont = new java.awt.Font("Arial", 0, tableFontSize); int dialogFontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_DIALOG_FONT_SIZE, 14);
tableRowHeight = tableFontSize + 4; dialogFont = new Font("Arial", 0, dialogFontSize);
tableHeaderHeight = tableFontSize + 10; symbolDialogSize = dialogFontSize;
symbolTableSize = tableFontSize; // for auto-sizeable dialogs - use scale logic (example: player panel, pick choice, pick ability, etc)
flagHeight = tableFontSize - 2; dialogGuiScale = dialogFontSize / 14.0f;
if (tableFontSize > 15) {
symbolEditorSize = tableFontSize - 5; // app - tables
dividerBarSize = 10 + (tableFontSize / 4); tableFont = new java.awt.Font("Arial", 0, dialogFontSize);
scrollBarSize = 14 + (tableFontSize / 4); tableRowHeight = dialogFontSize + 4;
tableHeaderHeight = dialogFontSize + 10;
symbolTableSize = dialogFontSize;
tableFlagHeight = dialogFontSize - 2;
if (dialogFontSize > 15) {
symbolEditorSize = dialogFontSize - 5;
dividerBarSize = 10 + (dialogFontSize / 4);
scrollBarSize = 14 + (dialogFontSize / 4);
} else { } else {
symbolEditorSize = tableFontSize; symbolEditorSize = dialogFontSize;
dividerBarSize = 10; dividerBarSize = 10;
scrollBarSize = 14; scrollBarSize = 14;
} }
// used for popup menus // game - feedback panel
int dialogFontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_DIALOG_FONT_SIZE, 14); gameFeedbackPanelFont = new Font("Arial", 0, dialogFontSize);
menuFont = new Font("Arial", 0, dialogFontSize); gameFeedbackPanelMainMessageFontSize = dialogFontSize;
gameRequestsFont = new Font("Arial", 0, dialogFontSize); gameFeedbackPanelExtraMessageFontSize = Math.max(MIN_FONT_SIZE, dialogFontSize / 2 + 2);
gameFeedbackPanelMaxHeight = 20 + 2 * gameFeedbackPanelMainMessageFontSize + 2 * gameFeedbackPanelExtraMessageFontSize;
// used in the feedback area of the game panel gameFeedbackPanelButtonHeight = dialogFontSize + 6;
int feedbackFontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_FEEDBACK_FONT_SIZE, 14); gameFeedbackPanelButtonWidth = dialogFontSize * 2 + 40;
gameDialogAreaFontSizeBig = feedbackFontSize;
gameDialogAreaFontSizeTooltip = feedbackFontSize - 2;
gameDialogAreaFontSizeSmall = (feedbackFontSize / 2) + 2;
gameDialogAreaTextHeight = GUISizeHelper.gameDialogAreaFontSizeBig + GUISizeHelper.gameDialogAreaFontSizeSmall + 30;
gameDialogAreaButtonHigh = feedbackFontSize;
gameDialogAreaFont = new Font("Arial", 0, feedbackFontSize);
gameDialogButtonHeight = feedbackFontSize + 6;
gameDialogButtonWidth = feedbackFontSize * 2 + 40;
symbolDialogSize = feedbackFontSize;
// app - chats and game logs
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;
cardTooltipFontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_TOOLTIP_SIZE, 14); // app - card popup and control's tooltip (e.g. mouse move over menu)
symbolTooltipSize = cardTooltipFontSize; int tooltipFontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_TOOLTIP_SIZE, 17);
cardTooltipFont = new java.awt.Font("Arial", 0, tooltipFontSize);
symbolTooltipSize = tooltipFontSize;
cardTooltipLargeImageHeight = 30 * tooltipFontSize;
cardTooltipLargeTextWidth = Math.max(150, 20 * tooltipFontSize - 50);
cardTooltipLargeTextHeight = Math.max(100, 12 * tooltipFontSize - 20);
UIManager.put("ToolTip.font", cardTooltipFont);
// control's tooltip on mouse move // game - player panel
UIManager.put("ToolTip.font", getCardFont().deriveFont(cardTooltipFontSize * 1.0f)); playerPanelGuiScale = (float) (PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_PLAYER_PANEL_SIZE, 14) / 14.0);
// game - hand
int handCardSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_CARD_HAND_SIZE, 14); int handCardSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_CARD_HAND_SIZE, 14);
handCardDimension = new Dimension(CARD_IMAGE_WIDTH * handCardSize / 42, CARD_IMAGE_HEIGHT * handCardSize / 42); handCardDimension = new Dimension(CARD_IMAGE_WIDTH * handCardSize / 42, CARD_IMAGE_HEIGHT * handCardSize / 42);
stackWidth = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_STACK_WIDTH, 30); stackWidth = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_STACK_WIDTH, 30);
playerPanelGuiScale = (float) (PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_PLAYER_PANEL_SIZE, 14) / 14.0);
// no needs in special size settings - compare dialog font size to find gui scale
dialogsGuiScale = (float) (PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_DIALOG_FONT_SIZE, 14) / 14.0);
int otherZonesCardSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_CARD_OTHER_ZONES_SIZE, 14); int otherZonesCardSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_CARD_OTHER_ZONES_SIZE, 14);
otherZonesCardDimension = new Dimension(CARD_IMAGE_WIDTH * otherZonesCardSize / 42, CARD_IMAGE_HEIGHT * otherZonesCardSize / 42); otherZonesCardDimension = new Dimension(CARD_IMAGE_WIDTH * otherZonesCardSize / 42, CARD_IMAGE_HEIGHT * otherZonesCardSize / 42);
if (PreferencesDialog.getRenderMode() == 0) { if (PreferencesDialog.getRenderMode() == 0) {
@ -176,33 +165,37 @@ public final class GUISizeHelper {
int battlefieldCardMaxSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_CARD_BATTLEFIELD_MAX_SIZE, 14); int battlefieldCardMaxSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_CARD_BATTLEFIELD_MAX_SIZE, 14);
battlefieldCardMaxDimension = new Dimension(CARD_IMAGE_WIDTH * battlefieldCardMaxSize / 42, CARD_IMAGE_HEIGHT * battlefieldCardMaxSize / 42); battlefieldCardMaxDimension = new Dimension(CARD_IMAGE_WIDTH * battlefieldCardMaxSize / 42, CARD_IMAGE_HEIGHT * battlefieldCardMaxSize / 42);
// app - deck editor and draft
int editorCardSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_CARD_EDITOR_SIZE, 14); int editorCardSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_CARD_EDITOR_SIZE, 14);
editorCardDimension = new Dimension(CARD_IMAGE_WIDTH * editorCardSize / 42, CARD_IMAGE_HEIGHT * editorCardSize / 42); editorCardDimension = new Dimension(CARD_IMAGE_WIDTH * editorCardSize / 42, CARD_IMAGE_HEIGHT * editorCardSize / 42);
if (PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CARD_RENDERING_FALLBACK, "false").equals("false")) { // make free space for card names in deck editor's stacks
if (PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CARD_RENDERING_IMAGE_MODE, "false").equals("false")) {
// mtgo render
editorCardVertOffsetInStack = CardRenderer.getCardTopHeight(editorCardDimension.width); editorCardVertOffsetInStack = CardRenderer.getCardTopHeight(editorCardDimension.width);
} else { } else {
editorCardVertOffsetInStack = 2 * PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_CARD_OFFSET_SIZE, 14) - 10; // image render
editorCardVertOffsetInStack = Math.round(1.3f * GUISizeHelper.getImageRendererTitleFontSize(editorCardDimension.height));
} }
enlargedImageHeight = 25 * PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_ENLARGED_IMAGE_SIZE, 20);
} }
public static int getTooltipCardWidth() { public static int getImageRendererMainFontSize(int cardHeight) {
return 20 * GUISizeHelper.cardTooltipFontSize - 50; // startup font size (it same size on all zoom levels)
return cardHeight / 13;
} }
public static int getTooltipCardHeight() { public static int getImageRendererTitleFontSize(int cardHeight) {
return 12 * GUISizeHelper.cardTooltipFontSize - 20; // extracted from image renderer file cause title size used in deck editor
return Math.max(13, getImageRendererMainFontSize(cardHeight));
} }
public static void changePopupMenuFont(JPopupMenu popupMenu) { public static void changePopupMenuFont(JPopupMenu popupMenu) {
for (Component comp : popupMenu.getComponents()) { for (Component comp : popupMenu.getComponents()) {
if (comp instanceof JMenuItem) { if (comp instanceof JMenuItem) {
comp.setFont(GUISizeHelper.menuFont); comp.setFont(GUISizeHelper.dialogFont);
if (comp instanceof JMenu) { if (comp instanceof JMenu) {
comp.setFont(GUISizeHelper.menuFont); comp.setFont(GUISizeHelper.dialogFont);
for (Component subComp : ((JMenu) comp).getMenuComponents()) { for (Component subComp : ((JMenu) comp).getMenuComponents()) {
subComp.setFont(GUISizeHelper.menuFont); subComp.setFont(GUISizeHelper.dialogFont);
} }
} }
} }

View file

@ -251,7 +251,7 @@ public final class GuiDisplayUtil {
} }
String fontFamily = "tahoma"; String fontFamily = "tahoma";
int fontSize = GUISizeHelper.cardTooltipFontSize; int fontSize = GUISizeHelper.cardTooltipFont.getSize();
/*if (prefs.fontFamily == CardFontFamily.arial) /*if (prefs.fontFamily == CardFontFamily.arial)
fontFamily = "arial"; fontFamily = "arial";
@ -271,14 +271,14 @@ public final class GuiDisplayUtil {
buffer.append(" [").append(card.getId().toString(), 0, 3).append(']'); buffer.append(" [").append(card.getId().toString(), 0, 3).append(']');
} }
buffer.append("</b></td><td align='right' valign='top' style='width:"); buffer.append("</b></td><td align='right' valign='top' style='width:");
buffer.append(symbolCount * GUISizeHelper.cardTooltipFontSize); buffer.append(symbolCount * fontSize);
buffer.append("px'>"); buffer.append("px'>");
if (!card.isSplitCard()) { if (!card.isSplitCard()) {
buffer.append(castingCost); buffer.append(castingCost);
} }
buffer.append("</td></tr></table>"); buffer.append("</td></tr></table>");
buffer.append("<table cellspacing=0 cellpadding=0 border=0 width='100%'><tr><td style='margin-left: 1px'>"); buffer.append("<table cellspacing=0 cellpadding=0 border=0 width='100%'><tr><td style='margin-left: 1px'>");
String imageSize = " width=" + GUISizeHelper.cardTooltipFontSize + " height=" + GUISizeHelper.cardTooltipFontSize + '>'; String imageSize = " width=" + fontSize + " height=" + fontSize + '>';
if (card.getColor().isWhite()) { if (card.getColor().isWhite()) {
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);
} }

View file

@ -24,9 +24,9 @@ public final class CountryUtil {
if (flagIcon == null) { if (flagIcon == null) {
Image flagImage = ImageHelper.getImageFromResources("/flags/" + countryCode + (countryCode.endsWith(".png") ? "" : ".png")); Image flagImage = ImageHelper.getImageFromResources("/flags/" + countryCode + (countryCode.endsWith(".png") ? "" : ".png"));
if (flagImage != null) { if (flagImage != null) {
if (GUISizeHelper.flagHeight > 11) { if (GUISizeHelper.tableFlagHeight > 11) {
int width = Math.round(GUISizeHelper.flagHeight * flagImage.getWidth(null) / flagImage.getHeight(null)); int width = Math.round(GUISizeHelper.tableFlagHeight * flagImage.getWidth(null) / flagImage.getHeight(null));
BufferedImage resized = ImageHelper.scale((BufferedImage) flagImage, BufferedImage.TYPE_4BYTE_ABGR, width, GUISizeHelper.flagHeight); BufferedImage resized = ImageHelper.scale((BufferedImage) flagImage, BufferedImage.TYPE_4BYTE_ABGR, width, GUISizeHelper.tableFlagHeight);
flagIcon = new ImageIcon(resized); flagIcon = new ImageIcon(resized);
} else { } else {
flagIcon = new ImageIcon(flagImage); flagIcon = new ImageIcon(flagImage);

View file

@ -4,6 +4,7 @@ import mage.MageInt;
import mage.cards.MageCardLocation; import mage.cards.MageCardLocation;
import mage.cards.action.ActionCallback; import mage.cards.action.ActionCallback;
import mage.client.dialog.PreferencesDialog; import mage.client.dialog.PreferencesDialog;
import mage.client.util.GUISizeHelper;
import mage.client.util.ImageCaches; import mage.client.util.ImageCaches;
import mage.client.util.ImageHelper; import mage.client.util.ImageHelper;
import mage.client.util.SoftValuesLoadingCache; import mage.client.util.SoftValuesLoadingCache;
@ -46,7 +47,6 @@ public class CardPanelRenderModeImage extends CardPanel {
private static final float TEXT_GLOW_INTENSITY = 3f; private static final float TEXT_GLOW_INTENSITY = 3f;
// text min size for image render mode // text min size for image render mode
private static final int CARD_TITLE_FONT_MIN_SIZE = 13;
private static final int CARD_PT_FONT_MIN_SIZE = 17; private static final int CARD_PT_FONT_MIN_SIZE = 17;
public final ScaledImagePanel imagePanel; public final ScaledImagePanel imagePanel;
@ -429,13 +429,14 @@ public class CardPanelRenderModeImage extends CardPanel {
fullImageText.setVisible(fullImagePath != null); fullImageText.setVisible(fullImagePath != null);
if (showText) { if (showText) {
int fontSize = cardHeight / 13; // startup font size (it same size on all zoom levels) int mainFontSize = GUISizeHelper.getImageRendererMainFontSize(cardHeight);
titleText.setFont(getFont().deriveFont(Font.BOLD, Math.max(CARD_TITLE_FONT_MIN_SIZE, fontSize))); int titleFontSize = GUISizeHelper.getImageRendererTitleFontSize(cardHeight);
titleText.setFont(getFont().deriveFont(Font.BOLD, titleFontSize));
// margins from card black border to text, not need? text show up good without margins // margins from card black border to text, not need? text show up good without margins
int titleMarginLeft = 0; //Math.round(28f / 672f * cardWidth); int titleMarginLeft = 0; //Math.round(28f / 672f * cardWidth);
int titleMarginRight = 0; int titleMarginRight = 0;
int titleMarginTop = Math.round(getCardCaptionTopOffset() / 100f * cardHeight);//Math.round(28f / 936f * cardHeight); int titleMarginTop = 0; //Math.round(getCardCaptionTopOffset() / 100f * cardHeight);//Math.round(28f / 936f * cardHeight);
int titleMarginBottom = 0; int titleMarginBottom = 0;
titleText.setBounds( titleText.setBounds(
imagePanel.getX() + titleMarginLeft, imagePanel.getX() + titleMarginLeft,
@ -444,7 +445,8 @@ public class CardPanelRenderModeImage extends CardPanel {
imagePanel.getBounds().height - titleMarginTop - titleMarginBottom imagePanel.getBounds().height - titleMarginTop - titleMarginBottom
); );
fullImageText.setFont(getFont().deriveFont(Font.PLAIN, 10)); int missImageFontSize = Math.max(10, Math.round(0.5f * mainFontSize));
fullImageText.setFont(getFont().deriveFont(Font.PLAIN, missImageFontSize));
fullImageText.setBounds(titleText.getX(), titleText.getY(), titleText.getBounds().width, titleText.getBounds().height); fullImageText.setBounds(titleText.getX(), titleText.getY(), titleText.getBounds().width, titleText.getBounds().height);
// PT (font as title) // PT (font as title)
@ -454,9 +456,9 @@ public class CardPanelRenderModeImage extends CardPanel {
MageInt currentPower = cardView.getOriginalPower(); MageInt currentPower = cardView.getOriginalPower();
MageInt currentToughness = cardView.getOriginalToughness(); MageInt currentToughness = cardView.getOriginalToughness();
prepareGlowFont(ptText1, Math.max(CARD_PT_FONT_MIN_SIZE, fontSize), currentPower, false); prepareGlowFont(ptText1, Math.max(CARD_PT_FONT_MIN_SIZE, mainFontSize), currentPower, false);
prepareGlowFont(ptText2, Math.max(CARD_PT_FONT_MIN_SIZE, fontSize), null, false); prepareGlowFont(ptText2, Math.max(CARD_PT_FONT_MIN_SIZE, mainFontSize), null, false);
prepareGlowFont(ptText3, Math.max(CARD_PT_FONT_MIN_SIZE, fontSize), currentToughness, CardRendererUtils.isCardWithDamage(cardView)); prepareGlowFont(ptText3, Math.max(CARD_PT_FONT_MIN_SIZE, mainFontSize), currentToughness, CardRendererUtils.isCardWithDamage(cardView));
// right bottom corner with margin (sizes from any sample card) // right bottom corner with margin (sizes from any sample card)
int ptMarginRight = Math.round(64f / 672f * cardWidth); int ptMarginRight = Math.round(64f / 672f * cardWidth);

View file

@ -43,8 +43,8 @@ public class CardInfoPaneImpl extends JEditorPane implements CardInfoPane {
} }
private void setGUISize() { private void setGUISize() {
addWidth = GUISizeHelper.getTooltipCardWidth(); addWidth = GUISizeHelper.cardTooltipLargeTextWidth;
addHeight = GUISizeHelper.getTooltipCardHeight(); addHeight = GUISizeHelper.cardTooltipLargeTextHeight;
setSize = true; setSize = true;
} }