diff --git a/Mage.Client/src/main/java/mage/client/MageFrame.java b/Mage.Client/src/main/java/mage/client/MageFrame.java index 8beb34df9ee..f6be85deefd 100644 --- a/Mage.Client/src/main/java/mage/client/MageFrame.java +++ b/Mage.Client/src/main/java/mage/client/MageFrame.java @@ -413,7 +413,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { return; } - int height = GUISizeHelper.enlargedImageHeight; + int height = GUISizeHelper.cardTooltipLargeImageHeight; int width = (int) ((float) height * (float) 0.64); bigCard.setSize(width, height); cardPreviewContainer.setBounds(0, 0, width + 80, height + 30); @@ -474,7 +474,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { private void setGUISizeTooltipContainer() { try { - int height = GUISizeHelper.enlargedImageHeight; + int height = GUISizeHelper.cardTooltipLargeImageHeight; int width = (int) ((float) height * (float) 0.64); 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]; if (window.isVisible()) { menuItem = new MagePaneMenuItem(window); - menuItem.setFont(GUISizeHelper.menuFont); + menuItem.setFont(GUISizeHelper.dialogFont); menuItem.setState(i == 0); menuItem.addActionListener(ae -> { MagePane frame = ((MagePaneMenuItem) ae.getSource()).getFrame(); @@ -935,7 +935,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { jMemUsageLabel = new javax.swing.JLabel(); menuDebugTestModalDialog.setText("Test Modal Dialogs"); - menuDebugTestModalDialog.setFont(GUISizeHelper.menuFont); + menuDebugTestModalDialog.setFont(GUISizeHelper.dialogFont); menuDebugTestModalDialog.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuDebugTestModalDialogActionPerformed(evt); @@ -944,7 +944,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { popupDebug.add(menuDebugTestModalDialog); menuDebugTestCardRenderModesDialog.setText("Test Card Render Modes"); - menuDebugTestCardRenderModesDialog.setFont(GUISizeHelper.menuFont); + menuDebugTestCardRenderModesDialog.setFont(GUISizeHelper.dialogFont); menuDebugTestCardRenderModesDialog.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuDebugTestCardRenderModesDialogActionPerformed(evt); @@ -1830,7 +1830,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { } private void setGUISize() { - Font font = GUISizeHelper.menuFont; + Font font = GUISizeHelper.dialogFont; mageToolbar.setFont(font); int newHeight = font.getSize() + 6; Dimension mageToolbarDimension = mageToolbar.getPreferredSize(); diff --git a/Mage.Client/src/main/java/mage/client/cards/CardGrid.java b/Mage.Client/src/main/java/mage/client/cards/CardGrid.java index 5bd6a93a060..1af72ceaba0 100644 --- a/Mage.Client/src/main/java/mage/client/cards/CardGrid.java +++ b/Mage.Client/src/main/java/mage/client/cards/CardGrid.java @@ -215,7 +215,7 @@ this.countLabels.add(label); this.add(label, (Integer) 0); // draw on background 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); return label; } diff --git a/Mage.Client/src/main/java/mage/client/cards/CardIconsPanel.java b/Mage.Client/src/main/java/mage/client/cards/CardIconsPanel.java index 629de0be28a..c4f0abf142c 100644 --- a/Mage.Client/src/main/java/mage/client/cards/CardIconsPanel.java +++ b/Mage.Client/src/main/java/mage/client/cards/CardIconsPanel.java @@ -328,7 +328,7 @@ public class CardIconsPanel extends JPanel { // text 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(); label.setToolTipText("" + hint); if (!icon.getText().isEmpty()) { diff --git a/Mage.Client/src/main/java/mage/client/cards/CardsList.java b/Mage.Client/src/main/java/mage/client/cards/CardsList.java index efce8343a15..b65a0ff73ad 100644 --- a/Mage.Client/src/main/java/mage/client/cards/CardsList.java +++ b/Mage.Client/src/main/java/mage/client/cards/CardsList.java @@ -41,7 +41,7 @@ private Dimension cardDimension; private final List countLabels = new ArrayList<>(); // count label code copy-pasted from CardGrid.java - private int rowHeight; + private int cardOffsetInStack; private CardsView cards; private Map mageCards = new LinkedHashMap<>(); protected BigCard bigCard; @@ -105,9 +105,9 @@ private void setGUISize() { mainTable.getTableHeader().setFont(GUISizeHelper.tableFont); mainTable.setFont(GUISizeHelper.tableFont); - mainTable.setRowHeight(GUISizeHelper.getTableRowHeight()); + mainTable.setRowHeight(GUISizeHelper.tableRowHeight); cardDimension = GUISizeHelper.editorCardDimension; - rowHeight = GUISizeHelper.editorCardVertOffsetInStack; + cardOffsetInStack = GUISizeHelper.editorCardVertOffsetInStack; } private void makeTransparent() { @@ -357,13 +357,13 @@ String description = comparator.getCategoryName(card); 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); curRow++; lastCard = card; } else { - rectangle.setLocation(curColumn * cardDimension.width, curRow * rowHeight); + rectangle.setLocation(curColumn * cardDimension.width, curRow * cardOffsetInStack); setCardBounds(mageCards.get(card.getId()), rectangle); curColumn++; if (curColumn == numColumns) { @@ -377,7 +377,7 @@ maxRow = Math.max(maxRow, curRow); maxColumn = Math.max(maxColumn, curColumn); 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(); this.revalidate(); this.repaint(); diff --git a/Mage.Client/src/main/java/mage/client/components/MageTextArea.java b/Mage.Client/src/main/java/mage/client/components/MageTextArea.java index 5bf557820d7..49ee1170cca 100644 --- a/Mage.Client/src/main/java/mage/client/components/MageTextArea.java +++ b/Mage.Client/src/main/java/mage/client/components/MageTextArea.java @@ -1,11 +1,9 @@ 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; /** * 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); // Dialog is a java logical font family, so it should work on all systems buffer.append("
"); // Don't know what it does (easy italc?) but it bugs with multiple #HTML color codes (LevelX2) @@ -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 if (panelWidth > 0 && MageTextArea.this.getPreferredSize().getWidth() > panelWidth) { String tooltip = "

" + basicText + "

"; MageTextArea.super.setToolTipText(tooltip); } else { diff --git a/Mage.Client/src/main/java/mage/client/deckeditor/CardSelector.java b/Mage.Client/src/main/java/mage/client/deckeditor/CardSelector.java index 9bd926665e5..2aad65268bf 100644 --- a/Mage.Client/src/main/java/mage/client/deckeditor/CardSelector.java +++ b/Mage.Client/src/main/java/mage/client/deckeditor/CardSelector.java @@ -184,7 +184,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene private void setGUISize() { mainTable.getTableHeader().setFont(GUISizeHelper.tableFont); mainTable.setFont(GUISizeHelper.tableFont); - mainTable.setRowHeight(GUISizeHelper.getTableRowHeight()); + mainTable.setRowHeight(GUISizeHelper.tableRowHeight); } diff --git a/Mage.Client/src/main/java/mage/client/dialog/CardHintsHelperDialog.java b/Mage.Client/src/main/java/mage/client/dialog/CardHintsHelperDialog.java index bccce8fa2a6..997caf8a730 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/CardHintsHelperDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/CardHintsHelperDialog.java @@ -511,7 +511,7 @@ public class CardHintsHelperDialog extends MageDialog implements MageDesktopIcon @Override public void changeGUISize() { - setGUISize(GUISizeHelper.chatFont); + setGUISize(GUISizeHelper.dialogFont); this.validate(); this.repaint(); } diff --git a/Mage.Client/src/main/java/mage/client/dialog/ErrorDialog.java b/Mage.Client/src/main/java/mage/client/dialog/ErrorDialog.java index e036b55effd..c19038184c9 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/ErrorDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/ErrorDialog.java @@ -46,11 +46,11 @@ public class ErrorDialog extends MageDialog { public void changeGUISize() { super.changeGUISize(); - this.textError.setFont(GUISizeHelper.gameDialogAreaFont); - this.textInfo.setFont(GUISizeHelper.gameDialogAreaFont); - this.btnCopyToClipboard.setFont(GUISizeHelper.gameDialogAreaFont); - this.btnOpenGithub.setFont(GUISizeHelper.gameDialogAreaFont); - this.btnOK.setFont(GUISizeHelper.gameDialogAreaFont); + this.textError.setFont(GUISizeHelper.gameFeedbackPanelFont); + this.textInfo.setFont(GUISizeHelper.gameFeedbackPanelFont); + this.btnCopyToClipboard.setFont(GUISizeHelper.gameFeedbackPanelFont); + this.btnOpenGithub.setFont(GUISizeHelper.gameFeedbackPanelFont); + this.btnOK.setFont(GUISizeHelper.gameFeedbackPanelFont); } private void openGithub() { diff --git a/Mage.Client/src/main/java/mage/client/dialog/PickChoiceDialog.java b/Mage.Client/src/main/java/mage/client/dialog/PickChoiceDialog.java index 8fe59ae6054..296710304e7 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/PickChoiceDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/PickChoiceDialog.java @@ -53,7 +53,7 @@ public class PickChoiceDialog extends MageDialog { // 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) - float guiScale = GUISizeHelper.gameDialogAreaFont.getSize2D() / GUISizeHelper.gameDialogAreaDefaultFontSize; + float guiScale = GUISizeHelper.gameFeedbackPanelFont.getSize2D() / GUISizeHelper.gameDialogAreaDefaultFontSize; int newWidth = GUISizeHelper.guiSizeScale(this.getSize().width, guiScale); int newHeight = GUISizeHelper.guiSizeScale(this.getSize().height, guiScale); this.setSize(newWidth, newHeight); @@ -286,14 +286,14 @@ public class PickChoiceDialog extends MageDialog { public void changeGUISize() { super.changeGUISize(); - this.textMessage.setFont(GUISizeHelper.gameDialogAreaFont); - this.textSubMessage.setFont(GUISizeHelper.gameDialogAreaFont); - this.labelSearch.setFont(GUISizeHelper.gameDialogAreaFont); - this.editSearch.setFont(GUISizeHelper.gameDialogAreaFont); - this.cbSpecial.setFont(GUISizeHelper.gameDialogAreaFont); + this.textMessage.setFont(GUISizeHelper.gameFeedbackPanelFont); + this.textSubMessage.setFont(GUISizeHelper.gameFeedbackPanelFont); + this.labelSearch.setFont(GUISizeHelper.gameFeedbackPanelFont); + this.editSearch.setFont(GUISizeHelper.gameFeedbackPanelFont); + this.cbSpecial.setFont(GUISizeHelper.gameFeedbackPanelFont); this.listChoices.setFont(GUISizeHelper.tableFont); - this.btOK.setFont(GUISizeHelper.gameDialogAreaFont); - this.btCancel.setFont(GUISizeHelper.gameDialogAreaFont); + this.btOK.setFont(GUISizeHelper.gameFeedbackPanelFont); + this.btCancel.setFont(GUISizeHelper.gameFeedbackPanelFont); } private void choiceHintShow(int modelIndex) { diff --git a/Mage.Client/src/main/java/mage/client/dialog/PreferencesDialog.java b/Mage.Client/src/main/java/mage/client/dialog/PreferencesDialog.java index 0aea74ac2eb..b28acdf1dc9 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/PreferencesDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/PreferencesDialog.java @@ -51,6 +51,7 @@ public class PreferencesDialog extends javax.swing.JDialog { 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_CARD_NAMES = "showCardNames"; 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"; // 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_CARD_HAND_SIZE = "guiCardHandSize"; 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_TOOLTIP_SIZE = "guiTooltipSize"; 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_BATTLEFIELD_MIN_SIZE = "guiCardBattlefieldMinSize"; 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_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_PLAYABLE = "cardRenderingIconsForPlayable"; 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) // warning, if you change default values then make sure calculateGUISizes uses same - // basic - createSizeSetting(1, KEY_GUI_TABLE_FONT_SIZE,14, true, "Font in tables", "The size of the font used to display table text."); - createSizeSetting(2, KEY_GUI_DIALOG_FONT_SIZE, 14, true, "Font in messages and menu", "The size of the font of messages and menues"); - createSizeSetting(3, KEY_GUI_CHAT_FONT_SIZE, 14, true, "Font in chat", "The size of the font used to display the chat text"); - 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(5, KEY_GUI_CARD_OFFSET_SIZE,14, false, "Offset of card's image", "The vertical offset of card images in editor areas "); // TODO: delete - 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
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 + // App's elements (from position 1) + 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_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_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)"); + // Game's elements (from position 8) 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(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(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(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(13, KEY_GUI_CARD_BATTLEFIELD_MIN_SIZE,10, false, "Size of permanents (min)", "The minimum 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"); + 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_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_MAX_SIZE,14, false, "Size of permanents (max)", "The maximum size of permanents on the battlefield"); // hide unused controls 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); // 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.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); @@ -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())); // 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.cbCardRenderIconsForPlayable, KEY_CARD_RENDERING_ICONS_FOR_PLAYABLE, "true", "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() { - if (getCachedValue(PreferencesDialog.KEY_CARD_RENDERING_FALLBACK, "false").equals("false")) { + if (getCachedValue(PreferencesDialog.KEY_CARD_RENDERING_IMAGE_MODE, "false").equals("false")) { return 0; // mtgo } else { return 1; // image diff --git a/Mage.Client/src/main/java/mage/client/dialog/TableWaitingDialog.java b/Mage.Client/src/main/java/mage/client/dialog/TableWaitingDialog.java index c4df463b271..be803c879bf 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/TableWaitingDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/TableWaitingDialog.java @@ -79,7 +79,7 @@ public class TableWaitingDialog extends MageDialog { private void setGUISize() { jTableSeats.getTableHeader().setFont(GUISizeHelper.tableFont); jTableSeats.setFont(GUISizeHelper.tableFont); - jTableSeats.setRowHeight(GUISizeHelper.getTableRowHeight()); + jTableSeats.setRowHeight(GUISizeHelper.tableRowHeight); jSplitPane1.setDividerSize(GUISizeHelper.dividerBarSize); jScrollPane1.getVerticalScrollBar().setPreferredSize(new Dimension(GUISizeHelper.scrollBarSize, 0)); diff --git a/Mage.Client/src/main/java/mage/client/dialog/UserRequestDialog.java b/Mage.Client/src/main/java/mage/client/dialog/UserRequestDialog.java index 080ec300e48..11b4fc32b95 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/UserRequestDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/UserRequestDialog.java @@ -28,7 +28,7 @@ public class UserRequestDialog extends MageDialog { } private void setGUISize() { - Font font = GUISizeHelper.gameRequestsFont; + Font font = GUISizeHelper.dialogFont; lblText.setFont(font); lblText.setMaximumSize(new Dimension(300 + font.getSize() * 15, 200 + font.getSize() * 5)); lblText.setMinimumSize(new Dimension(300 + font.getSize() * 15, 20 + font.getSize() * 5)); diff --git a/Mage.Client/src/main/java/mage/client/game/GamePanel.java b/Mage.Client/src/main/java/mage/client/game/GamePanel.java index e87fb9edcb0..63148693c56 100644 --- a/Mage.Client/src/main/java/mage/client/game/GamePanel.java +++ b/Mage.Client/src/main/java/mage/client/game/GamePanel.java @@ -421,7 +421,7 @@ public final class GamePanel extends javax.swing.JPanel { jSplitPane1.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); // 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 if (this.abilityPicker != null && !this.abilityPicker.isVisible()) { - this.abilityPicker.fullRefresh(GUISizeHelper.dialogsGuiScale); + this.abilityPicker.fullRefresh(GUISizeHelper.dialogGuiScale); this.abilityPicker.init(gameId, bigCard); } } @@ -1997,7 +1997,7 @@ public final class GamePanel extends javax.swing.JPanel { @SuppressWarnings("unchecked") 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(); jSplitPane0 = new javax.swing.JSplitPane(); jPanel2 = new javax.swing.JPanel(); diff --git a/Mage.Client/src/main/java/mage/client/game/HelperPanel.java b/Mage.Client/src/main/java/mage/client/game/HelperPanel.java index b5403a14fa4..531739b8e19 100644 --- a/Mage.Client/src/main/java/mage/client/game/HelperPanel.java +++ b/Mage.Client/src/main/java/mage/client/game/HelperPanel.java @@ -101,18 +101,18 @@ public class HelperPanel extends JPanel { private void setGUISize() { //this.setMaximumSize(new Dimension(getParent().getWidth(), Integer.MAX_VALUE)); - textAreaScrollPane.setMaximumSize(new Dimension(getParent().getWidth(), GUISizeHelper.gameDialogAreaTextHeight)); - textAreaScrollPane.setPreferredSize(new Dimension(getParent().getWidth(), GUISizeHelper.gameDialogAreaTextHeight)); + textAreaScrollPane.setMaximumSize(new Dimension(getParent().getWidth(), GUISizeHelper.gameFeedbackPanelMaxHeight)); + textAreaScrollPane.setPreferredSize(new Dimension(getParent().getWidth(), GUISizeHelper.gameFeedbackPanelMaxHeight)); // dialogTextArea.setMaximumSize(new Dimension(getParent().getWidth(), Integer.MAX_VALUE)); // dialogTextArea.setPreferredSize(new Dimension(getParent().getWidth(), GUISizeHelper.gameDialogAreaTextHeight)); // buttonContainer.setPreferredSize(new Dimension(getParent().getWidth(), GUISizeHelper.gameDialogButtonHeight + 4)); // buttonContainer.setMinimumSize(new Dimension(160, GUISizeHelper.gameDialogButtonHeight + 20)); // buttonContainer.setMaximumSize(new Dimension(Integer.MAX_VALUE, GUISizeHelper.gameDialogButtonHeight + 4)); - btnLeft.setFont(GUISizeHelper.gameDialogAreaFont); - btnRight.setFont(GUISizeHelper.gameDialogAreaFont); - btnSpecial.setFont(GUISizeHelper.gameDialogAreaFont); - btnUndo.setFont(GUISizeHelper.gameDialogAreaFont); + btnLeft.setFont(GUISizeHelper.gameFeedbackPanelFont); + btnRight.setFont(GUISizeHelper.gameFeedbackPanelFont); + btnSpecial.setFont(GUISizeHelper.gameFeedbackPanelFont); + btnUndo.setFont(GUISizeHelper.gameFeedbackPanelFont); this.redrawMessages(); @@ -414,9 +414,10 @@ public class HelperPanel extends JPanel { } // 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 constGridSizeH = Math.round(GUISizeHelper.gameDialogButtonHeight * 150 / 100); + int constGridSizeH = Math.round(GUISizeHelper.gameFeedbackPanelButtonHeight * 150 / 100); if (needButtonSizeW < constButtonSizeW) { // same size mode (grid) @@ -450,7 +451,7 @@ public class HelperPanel extends JPanel { private void redrawMessages() { String panelText = this.basicMessage; if (this.secondaryMessage != null) { - panelText += "
" + secondaryMessage + "
"; + panelText += "
" + secondaryMessage + "
"; } this.dialogTextArea.setText(panelText, this.getWidth()); } diff --git a/Mage.Client/src/main/java/mage/client/table/PlayersChatPanel.java b/Mage.Client/src/main/java/mage/client/table/PlayersChatPanel.java index 1d0bb9e69cc..bf6d503c361 100644 --- a/Mage.Client/src/main/java/mage/client/table/PlayersChatPanel.java +++ b/Mage.Client/src/main/java/mage/client/table/PlayersChatPanel.java @@ -117,13 +117,13 @@ public class PlayersChatPanel extends javax.swing.JPanel { private void setGUISize() { jTablePlayers.getTableHeader().setFont(GUISizeHelper.tableFont); jTablePlayers.setFont(GUISizeHelper.tableFont); - jTablePlayers.setRowHeight(GUISizeHelper.getTableRowHeight()); + jTablePlayers.setRowHeight(GUISizeHelper.tableRowHeight); jScrollPanePlayers.getVerticalScrollBar().setPreferredSize(new Dimension(GUISizeHelper.scrollBarSize, 0)); jScrollPanePlayers.getHorizontalScrollBar().setPreferredSize(new Dimension(0, GUISizeHelper.scrollBarSize)); jScrollPaneSystem.getVerticalScrollBar().setPreferredSize(new Dimension(GUISizeHelper.scrollBarSize, 0)); jScrollPaneSystem.getHorizontalScrollBar().setPreferredSize(new Dimension(0, GUISizeHelper.scrollBarSize)); - jTabbedPaneText.setFont(GUISizeHelper.getTabFont()); + jTabbedPaneText.setFont(GUISizeHelper.tableFont); jSplitPane1.setDividerSize(GUISizeHelper.dividerBarSize); } diff --git a/Mage.Client/src/main/java/mage/client/table/TablesPanel.java b/Mage.Client/src/main/java/mage/client/table/TablesPanel.java index d592947f1d5..be2c2e85cd2 100644 --- a/Mage.Client/src/main/java/mage/client/table/TablesPanel.java +++ b/Mage.Client/src/main/java/mage/client/table/TablesPanel.java @@ -52,7 +52,6 @@ import java.util.List; import java.util.*; import java.util.concurrent.CancellationException; import java.util.concurrent.ExecutionException; -import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import static mage.client.dialog.PreferencesDialog.*; @@ -590,11 +589,11 @@ public class TablesPanel extends javax.swing.JPanel { private void setGUISize() { tableTables.getTableHeader().setFont(GUISizeHelper.tableFont); tableTables.setFont(GUISizeHelper.tableFont); - tableTables.setRowHeight(GUISizeHelper.getTableRowHeight()); + tableTables.setRowHeight(GUISizeHelper.tableRowHeight); tableCompleted.getTableHeader().setFont(GUISizeHelper.tableFont); tableCompleted.setFont(GUISizeHelper.tableFont); - tableCompleted.setRowHeight(GUISizeHelper.getTableRowHeight()); + tableCompleted.setRowHeight(GUISizeHelper.tableRowHeight); jSplitPane1.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")); 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)); icon = new javax.swing.ImageIcon(getClass().getResource("/buttons/state_active.png")); 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)); icon = new javax.swing.ImageIcon(getClass().getResource("/buttons/state_finished.png")); 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)); - 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")); img = icon.getImage(); 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)); 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.setPreferredSize(newDimension); - buttonWhatsNew.setFont(GUISizeHelper.menuFont); - buttonNextMessage.setFont(GUISizeHelper.menuFont); - labelMessageHeader.setFont(new Font(GUISizeHelper.menuFont.getName(), Font.BOLD, GUISizeHelper.menuFont.getSize())); - labelMessageText.setFont(GUISizeHelper.menuFont); + buttonWhatsNew.setFont(GUISizeHelper.dialogFont); + buttonNextMessage.setFont(GUISizeHelper.dialogFont); + labelMessageHeader.setFont(new Font(GUISizeHelper.dialogFont.getName(), Font.BOLD, GUISizeHelper.dialogFont.getSize())); + labelMessageText.setFont(GUISizeHelper.dialogFont); - btnQuickStart2Player.setFont(GUISizeHelper.menuFont); - btnQuickStart4Player.setFont(GUISizeHelper.menuFont); - btnQuickStartMCTS.setFont(GUISizeHelper.menuFont); + btnQuickStart2Player.setFont(GUISizeHelper.dialogFont); + btnQuickStart4Player.setFont(GUISizeHelper.dialogFont); + btnQuickStartMCTS.setFont(GUISizeHelper.dialogFont); } private void restoreDividerLocations() { diff --git a/Mage.Client/src/main/java/mage/client/tournament/TournamentPanel.java b/Mage.Client/src/main/java/mage/client/tournament/TournamentPanel.java index a2ab15ad355..a95aca8803a 100644 --- a/Mage.Client/src/main/java/mage/client/tournament/TournamentPanel.java +++ b/Mage.Client/src/main/java/mage/client/tournament/TournamentPanel.java @@ -119,11 +119,11 @@ public class TournamentPanel extends javax.swing.JPanel { private void setGUISize() { tablePlayers.getTableHeader().setFont(GUISizeHelper.tableFont); tablePlayers.setFont(GUISizeHelper.tableFont); - tablePlayers.setRowHeight(GUISizeHelper.getTableRowHeight()); + tablePlayers.setRowHeight(GUISizeHelper.tableRowHeight); tableMatches.getTableHeader().setFont(GUISizeHelper.tableFont); tableMatches.setFont(GUISizeHelper.tableFont); - tableMatches.setRowHeight(GUISizeHelper.getTableRowHeight()); + tableMatches.setRowHeight(GUISizeHelper.tableRowHeight); jSplitPane1.setDividerSize(GUISizeHelper.dividerBarSize); jSplitPane2.setDividerSize(GUISizeHelper.dividerBarSize); diff --git a/Mage.Client/src/main/java/mage/client/util/GUISizeHelper.java b/Mage.Client/src/main/java/mage/client/util/GUISizeHelper.java index e622b1b6ffd..c7de52cd6c5 100644 --- a/Mage.Client/src/main/java/mage/client/util/GUISizeHelper.java +++ b/Mage.Client/src/main/java/mage/client/util/GUISizeHelper.java @@ -23,12 +23,13 @@ public final class GUISizeHelper { static final int CARD_IMAG_VALUE = 42; public static String basicSymbolSize = "small"; + static final int MIN_FONT_SIZE = 7; public static int symbolCardSize = 15; public static int symbolTableSize = 15; public static int symbolChatSize = 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 symbolEditorSize = 15; @@ -38,33 +39,29 @@ public final class GUISizeHelper { public static int dividerBarSize; public static int scrollBarSize; - public static int flagHeight; - - public static int cardTooltipFontSize = 15; + public static int tableFlagHeight; 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 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 gameDialogAreaFontSizeBig = 16; - public static int gameDialogAreaFontSizeTooltip = 14; - public static int gameDialogAreaFontSizeSmall = 11; - public static int gameDialogAreaTextHeight = 0; + public static int gameFeedbackPanelMainMessageFontSize = 16; + public static int gameFeedbackPanelExtraMessageFontSize = 11; + public static int gameFeedbackPanelMaxHeight = 0; public static int gameDialogAreaButtonHigh = 16; - public static Font gameDialogAreaFont = new java.awt.Font("Arial", 0, 12); - public static float gameDialogAreaDefaultFontSize = gameDialogAreaFont.getSize2D(); - public static int gameDialogButtonHeight; - public static int gameDialogButtonWidth; + public static Font gameFeedbackPanelFont = new java.awt.Font("Arial", 0, 12); + public static float gameDialogAreaDefaultFontSize = gameFeedbackPanelFont.getSize2D(); + public static int gameFeedbackPanelButtonHeight; + public static int gameFeedbackPanelButtonWidth; public static Dimension handCardDimension; public static int stackWidth; // percent public static float playerPanelGuiScale; - public static float dialogsGuiScale; + public static float dialogGuiScale; public static Dimension otherZonesCardDimension; public static int otherZonesCardVerticalOffset; @@ -74,17 +71,9 @@ public final class GUISizeHelper { public static Dimension editorCardDimension; public static int editorCardVertOffsetInStack; - public static int enlargedImageHeight; - - public static int getTableRowHeight() { - 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 int cardTooltipLargeImageHeight; + public static int cardTooltipLargeTextHeight; + public static int cardTooltipLargeTextWidth; public static Font getCardFont() { // 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() { - int tableFontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_TABLE_FONT_SIZE, 14); - tableFont = new java.awt.Font("Arial", 0, tableFontSize); - tableRowHeight = tableFontSize + 4; - tableHeaderHeight = tableFontSize + 10; - symbolTableSize = tableFontSize; - flagHeight = tableFontSize - 2; - if (tableFontSize > 15) { - symbolEditorSize = tableFontSize - 5; - dividerBarSize = 10 + (tableFontSize / 4); - scrollBarSize = 14 + (tableFontSize / 4); + // app - dialogs and menus + int dialogFontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_DIALOG_FONT_SIZE, 14); + dialogFont = new Font("Arial", 0, dialogFontSize); + symbolDialogSize = dialogFontSize; + // for auto-sizeable dialogs - use scale logic (example: player panel, pick choice, pick ability, etc) + dialogGuiScale = dialogFontSize / 14.0f; + + // app - tables + tableFont = new java.awt.Font("Arial", 0, dialogFontSize); + 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 { - symbolEditorSize = tableFontSize; + symbolEditorSize = dialogFontSize; dividerBarSize = 10; scrollBarSize = 14; } - // used for popup menus - int dialogFontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_DIALOG_FONT_SIZE, 14); - menuFont = new Font("Arial", 0, dialogFontSize); - gameRequestsFont = new Font("Arial", 0, dialogFontSize); - - // used in the feedback area of the game panel - int feedbackFontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_FEEDBACK_FONT_SIZE, 14); - 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; + // game - feedback panel + gameFeedbackPanelFont = new Font("Arial", 0, dialogFontSize); + gameFeedbackPanelMainMessageFontSize = dialogFontSize; + gameFeedbackPanelExtraMessageFontSize = Math.max(MIN_FONT_SIZE, dialogFontSize / 2 + 2); + gameFeedbackPanelMaxHeight = 20 + 2 * gameFeedbackPanelMainMessageFontSize + 2 * gameFeedbackPanelExtraMessageFontSize; + gameFeedbackPanelButtonHeight = dialogFontSize + 6; + gameFeedbackPanelButtonWidth = dialogFontSize * 2 + 40; + // app - chats and game logs int chatFontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_CHAT_FONT_SIZE, 14); chatFont = new java.awt.Font("Arial", 0, chatFontSize); symbolChatSize = chatFontSize; - cardTooltipFontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_TOOLTIP_SIZE, 14); - symbolTooltipSize = cardTooltipFontSize; + // app - card popup and control's tooltip (e.g. mouse move over menu) + 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 - UIManager.put("ToolTip.font", getCardFont().deriveFont(cardTooltipFontSize * 1.0f)); + // game - player panel + 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); handCardDimension = new Dimension(CARD_IMAGE_WIDTH * handCardSize / 42, CARD_IMAGE_HEIGHT * handCardSize / 42); 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); otherZonesCardDimension = new Dimension(CARD_IMAGE_WIDTH * otherZonesCardSize / 42, CARD_IMAGE_HEIGHT * otherZonesCardSize / 42); if (PreferencesDialog.getRenderMode() == 0) { @@ -176,33 +165,37 @@ public final class GUISizeHelper { 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); + // app - deck editor and draft int editorCardSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_CARD_EDITOR_SIZE, 14); 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); } 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() { - return 20 * GUISizeHelper.cardTooltipFontSize - 50; + public static int getImageRendererMainFontSize(int cardHeight) { + // startup font size (it same size on all zoom levels) + return cardHeight / 13; } - public static int getTooltipCardHeight() { - return 12 * GUISizeHelper.cardTooltipFontSize - 20; + public static int getImageRendererTitleFontSize(int cardHeight) { + // extracted from image renderer file cause title size used in deck editor + return Math.max(13, getImageRendererMainFontSize(cardHeight)); } public static void changePopupMenuFont(JPopupMenu popupMenu) { for (Component comp : popupMenu.getComponents()) { if (comp instanceof JMenuItem) { - comp.setFont(GUISizeHelper.menuFont); + comp.setFont(GUISizeHelper.dialogFont); if (comp instanceof JMenu) { - comp.setFont(GUISizeHelper.menuFont); + comp.setFont(GUISizeHelper.dialogFont); for (Component subComp : ((JMenu) comp).getMenuComponents()) { - subComp.setFont(GUISizeHelper.menuFont); + subComp.setFont(GUISizeHelper.dialogFont); } } } diff --git a/Mage.Client/src/main/java/mage/client/util/gui/GuiDisplayUtil.java b/Mage.Client/src/main/java/mage/client/util/gui/GuiDisplayUtil.java index e885350d56d..af8f20de7be 100644 --- a/Mage.Client/src/main/java/mage/client/util/gui/GuiDisplayUtil.java +++ b/Mage.Client/src/main/java/mage/client/util/gui/GuiDisplayUtil.java @@ -251,7 +251,7 @@ public final class GuiDisplayUtil { } String fontFamily = "tahoma"; - int fontSize = GUISizeHelper.cardTooltipFontSize; + int fontSize = GUISizeHelper.cardTooltipFont.getSize(); /*if (prefs.fontFamily == CardFontFamily.arial) fontFamily = "arial"; @@ -271,14 +271,14 @@ public final class GuiDisplayUtil { buffer.append(" [").append(card.getId().toString(), 0, 3).append(']'); } buffer.append("
"); if (!card.isSplitCard()) { buffer.append(castingCost); } buffer.append(""); buffer.append("
"); - String imageSize = " width=" + GUISizeHelper.cardTooltipFontSize + " height=" + GUISizeHelper.cardTooltipFontSize + '>'; + String imageSize = " width=" + fontSize + " height=" + fontSize + '>'; if (card.getColor().isWhite()) { buffer.append("W 11) { - int width = Math.round(GUISizeHelper.flagHeight * flagImage.getWidth(null) / flagImage.getHeight(null)); - BufferedImage resized = ImageHelper.scale((BufferedImage) flagImage, BufferedImage.TYPE_4BYTE_ABGR, width, GUISizeHelper.flagHeight); + if (GUISizeHelper.tableFlagHeight > 11) { + int width = Math.round(GUISizeHelper.tableFlagHeight * flagImage.getWidth(null) / flagImage.getHeight(null)); + BufferedImage resized = ImageHelper.scale((BufferedImage) flagImage, BufferedImage.TYPE_4BYTE_ABGR, width, GUISizeHelper.tableFlagHeight); flagIcon = new ImageIcon(resized); } else { flagIcon = new ImageIcon(flagImage); diff --git a/Mage.Client/src/main/java/org/mage/card/arcane/CardPanelRenderModeImage.java b/Mage.Client/src/main/java/org/mage/card/arcane/CardPanelRenderModeImage.java index cd9c949a88d..e271704536d 100644 --- a/Mage.Client/src/main/java/org/mage/card/arcane/CardPanelRenderModeImage.java +++ b/Mage.Client/src/main/java/org/mage/card/arcane/CardPanelRenderModeImage.java @@ -4,6 +4,7 @@ import mage.MageInt; import mage.cards.MageCardLocation; import mage.cards.action.ActionCallback; import mage.client.dialog.PreferencesDialog; +import mage.client.util.GUISizeHelper; import mage.client.util.ImageCaches; import mage.client.util.ImageHelper; import mage.client.util.SoftValuesLoadingCache; @@ -46,7 +47,6 @@ public class CardPanelRenderModeImage extends CardPanel { private static final float TEXT_GLOW_INTENSITY = 3f; // 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; public final ScaledImagePanel imagePanel; @@ -429,13 +429,14 @@ public class CardPanelRenderModeImage extends CardPanel { fullImageText.setVisible(fullImagePath != null); if (showText) { - int fontSize = cardHeight / 13; // startup font size (it same size on all zoom levels) - titleText.setFont(getFont().deriveFont(Font.BOLD, Math.max(CARD_TITLE_FONT_MIN_SIZE, fontSize))); + int mainFontSize = GUISizeHelper.getImageRendererMainFontSize(cardHeight); + 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 int titleMarginLeft = 0; //Math.round(28f / 672f * cardWidth); 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; titleText.setBounds( imagePanel.getX() + titleMarginLeft, @@ -444,7 +445,8 @@ public class CardPanelRenderModeImage extends CardPanel { 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); // PT (font as title) @@ -454,9 +456,9 @@ public class CardPanelRenderModeImage extends CardPanel { MageInt currentPower = cardView.getOriginalPower(); MageInt currentToughness = cardView.getOriginalToughness(); - prepareGlowFont(ptText1, Math.max(CARD_PT_FONT_MIN_SIZE, fontSize), currentPower, false); - prepareGlowFont(ptText2, Math.max(CARD_PT_FONT_MIN_SIZE, fontSize), null, false); - prepareGlowFont(ptText3, Math.max(CARD_PT_FONT_MIN_SIZE, fontSize), currentToughness, CardRendererUtils.isCardWithDamage(cardView)); + prepareGlowFont(ptText1, Math.max(CARD_PT_FONT_MIN_SIZE, mainFontSize), currentPower, false); + prepareGlowFont(ptText2, Math.max(CARD_PT_FONT_MIN_SIZE, mainFontSize), null, false); + prepareGlowFont(ptText3, Math.max(CARD_PT_FONT_MIN_SIZE, mainFontSize), currentToughness, CardRendererUtils.isCardWithDamage(cardView)); // right bottom corner with margin (sizes from any sample card) int ptMarginRight = Math.round(64f / 672f * cardWidth); diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/info/CardInfoPaneImpl.java b/Mage.Client/src/main/java/org/mage/plugins/card/info/CardInfoPaneImpl.java index 2ce167a178d..480f8939772 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/info/CardInfoPaneImpl.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/info/CardInfoPaneImpl.java @@ -43,8 +43,8 @@ public class CardInfoPaneImpl extends JEditorPane implements CardInfoPane { } private void setGUISize() { - addWidth = GUISizeHelper.getTooltipCardWidth(); - addHeight = GUISizeHelper.getTooltipCardHeight(); + addWidth = GUISizeHelper.cardTooltipLargeTextWidth; + addHeight = GUISizeHelper.cardTooltipLargeTextHeight; setSize = true; }