Some more changes to GUI to better support high screen resolutions.

This commit is contained in:
LevelX2 2016-02-13 02:30:05 +01:00
parent 1c2faaadde
commit 7ef0a0a7f0
31 changed files with 745 additions and 518 deletions

View file

@ -115,11 +115,12 @@ import mage.client.remote.CallbackClientImpl;
import mage.client.table.TablesPane;
import mage.client.tournament.TournamentPane;
import mage.client.util.EDTExceptionHandler;
import mage.client.util.FontSizeHelper;
import mage.client.util.GUISizeHelper;
import mage.client.util.SettingsManager;
import mage.client.util.SystemUtil;
import mage.client.util.audio.MusicPlayer;
import mage.client.util.gui.ArrowBuilder;
import mage.client.util.gui.countryBox.CountryUtil;
import mage.client.util.stats.UpdateMemUsageTask;
import mage.components.ImagePanel;
import mage.interfaces.MageClient;
@ -238,11 +239,8 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
try {
UIManager.put("desktop", new Color(0, 0, 0, 0));
UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
FontSizeHelper.calculateGUISizes();
// Change default font and row size for JTables
Font font = FontSizeHelper.getTableFont();
UIManager.put("Table.font", font);
UIManager.put("Table.rowHeight", FontSizeHelper.tableRowHeight);
GUISizeHelper.calculateGUISizes();
// UIManager.put("Table.rowHeight", GUISizeHelper.tableRowHeight);
} catch (Exception ex) {
LOGGER.fatal(null, ex);
}
@ -532,7 +530,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
MagePane window = (MagePane) windows[i];
if (window.isVisible()) {
menuItem = new MagePaneMenuItem(window);
menuItem.setFont(FontSizeHelper.getToolbarFont());
menuItem.setFont(GUISizeHelper.getToolbarFont());
menuItem.setState(i == 0);
menuItem.addActionListener(new ActionListener() {
@Override
@ -1070,12 +1068,10 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
if (setActive) {
setActive(tablesPane);
} else // if other panel was already shown, mamke sure it's topmost again
{
if (topPanebefore != null) {
setActive(topPanebefore);
}
}
}
public void hideGames() {
JInternalFrame[] windows = desktopPane.getAllFramesInLayer(JLayeredPane.DEFAULT_LAYER);
@ -1407,6 +1403,8 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
public void changeGUISize() {
setGUISize();
CountryUtil.changeGUISize();
for (Component component : desktopPane.getComponents()) {
if (component instanceof MageDialog) {
((MageDialog) component).changeGUISize();
@ -1415,16 +1413,15 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
((MagePane) component).changeGUISize();
}
}
Font font = FontSizeHelper.getChatFont();
for (ChatPanelBasic chatPanel : getChatPanels().values()) {
chatPanel.changeGUISize(font);
chatPanel.changeGUISize(GUISizeHelper.chatFont);
}
this.revalidate();
this.repaint();
}
private void setGUISize() {
Font font = FontSizeHelper.getToolbarFont();
Font font = GUISizeHelper.getToolbarFont();
mageToolbar.setFont(font);
int newHeight = font.getSize() + 6;
Dimension mageToolbarDimension = mageToolbar.getPreferredSize();
@ -1448,7 +1445,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
component.setMaximumSize(d);
}
}
balloonTip.setFont(FontSizeHelper.tooltipFont);
balloonTip.setFont(GUISizeHelper.tooltipFont);
}
}

View file

@ -26,7 +26,7 @@
* or implied, of BetaSteward_at_googlemail.com.
*/
/*
/*
* Cards.java
*
* Created on Dec 18, 2009, 10:40:12 AM
@ -50,6 +50,7 @@ import mage.cards.MageCard;
import mage.client.plugins.impl.Plugins;
import mage.client.util.CardsViewUtil;
import mage.client.util.Config;
import mage.client.util.GUISizeHelper;
import mage.view.CardView;
import mage.view.CardsView;
import mage.view.PermanentView;
@ -64,15 +65,14 @@ import org.mage.card.arcane.CardPanel;
*/
public class Cards extends javax.swing.JPanel {
private static final Logger logger = Logger.getLogger(Cards.class);
private static final Logger LOGGER = Logger.getLogger(Cards.class);
private static final Border EMPTY_BORDER = new EmptyBorder(0, 0, 0, 0);
private final Map<UUID, MageCard> cards = new LinkedHashMap<>();
private boolean dontDisplayTapped = false;
private static final int GAP_X = 5; // needed for marking cards with coloured fram (e.g. on hand)
private String zone;
private static final Border emptyBorder = new EmptyBorder(0, 0, 0, 0);
private int minOffsetY = 0;
/**
@ -98,17 +98,35 @@ public class Cards extends javax.swing.JPanel {
if (!skipAddingScrollPane) {
jScrollPane1.setOpaque(false);
jScrollPane1.getViewport().setOpaque(false);
jScrollPane1.setBorder(emptyBorder);
jScrollPane1.setBorder(EMPTY_BORDER);
}
if (Plugins.getInstance().isCardPluginLoaded()) {
cardArea.setLayout(null);
}
cardArea.setBorder(emptyBorder);
cardArea.setBorder(EMPTY_BORDER);
setGUISize();
}
public void cleanUp() {
}
public void changeGUISize() {
setGUISize();
for (MageCard mageCard : cards.values()) {
mageCard.setCardBounds(0, 0, getCardDimension().width, getCardDimension().height);
mageCard.updateImage();
}
layoutCards();
sizeCards(cardDimension);
}
private void setGUISize() {
if (jScrollPane1 != null) {
jScrollPane1.getVerticalScrollBar().setPreferredSize(new Dimension(GUISizeHelper.scrollBarSize, 0));
jScrollPane1.getHorizontalScrollBar().setPreferredSize(new Dimension(0, GUISizeHelper.scrollBarSize));
}
}
/**
* Sets components background color
*
@ -151,18 +169,18 @@ public class Cards extends javax.swing.JPanel {
}
// Workaround for bug leaving display of objects on the stack (issue #213 https://github.com/magefree/mage/issues/213)
if (cardsView.size() == 0 && countCards() > 0) {
if (cardsView.isEmpty() && countCards() > 0) {
// problem happens with transformable cards
logger.fatal("Card object on the cards panel was not removed");
LOGGER.fatal("Card object on the cards panel was not removed");
for (Component comp : cardArea.getComponents()) {
if (comp instanceof Card) {
Card card = (Card) comp;
logger.fatal("Card name:" + card.getName() + " type:" + card.getType(null));
LOGGER.fatal("Card name:" + card.getName() + " type:" + card.getType(null));
} else if (comp instanceof MageCard) {
MageCard mageCard = (MageCard) comp;
logger.fatal("MageCard name:" + mageCard.getName() + " toolTiptext:" + mageCard.getToolTipText());
LOGGER.fatal("MageCard name:" + mageCard.getName() + " toolTiptext:" + mageCard.getToolTipText());
} else {
logger.fatal("Unknown object:" + comp.getName() + " className:" + comp.getClass().getName());
LOGGER.fatal("Unknown object:" + comp.getName() + " className:" + comp.getClass().getName());
}
cardArea.remove(comp);
}
@ -235,15 +253,25 @@ public class Cards extends javax.swing.JPanel {
return cardDimension;
}
private void addCard(CardView card, BigCard bigCard, UUID gameId) {
MageCard cardImg = Plugins.getInstance().getMageCard(card, bigCard, getCardDimension(), gameId, true);
if (zone != null) {
cardImg.setZone(zone);
public void setCardDimension(Dimension dimension) {
this.cardDimension = dimension;
for (Component component : cardArea.getComponents()) {
if (component instanceof CardPanel) {
((CardPanel) component).setBounds(0, 0, dimension.width, dimension.height);
}
cards.put(card.getId(), cardImg);
cardArea.add(cardImg);
definePosition(cardImg);
cardImg.setCardAreaRef(cardArea);
}
layoutCards();
}
private void addCard(CardView card, BigCard bigCard, UUID gameId) {
MageCard mageCard = Plugins.getInstance().getMageCard(card, bigCard, getCardDimension(), gameId, true);
if (zone != null) {
mageCard.setZone(zone);
}
cards.put(card.getId(), mageCard);
cardArea.add(mageCard);
definePosition(mageCard);
mageCard.setCardAreaRef(cardArea);
}
private void definePosition(MageCard card) {
@ -320,28 +348,24 @@ public class Cards extends javax.swing.JPanel {
}
}
public void setCardDimension(Dimension dimension) {
this.cardDimension = dimension;
layoutCards();
}
private void layoutCards() {
java.util.List<CardPanel> cards = new ArrayList<>();
java.util.List<CardPanel> cardsToLayout = new ArrayList<>();
// get all the card panels
for (Component component : cardArea.getComponents()) {
if (component instanceof CardPanel) {
cards.add((CardPanel) component);
cardsToLayout.add((CardPanel) component);
}
}
Collections.sort(cards, new Comparator<CardPanel>() {
// sort the cards
Collections.sort(cardsToLayout, new Comparator<CardPanel>() {
@Override
public int compare(CardPanel cp1, CardPanel cp2) {
return Integer.valueOf(cp1.getLocation().x).compareTo(cp2.getLocation().x);
}
});
// relocate the cards
int dx = 0;
for (Component component : cards) {
for (Component component : cardsToLayout) {
component.setLocation(dx, Math.max(component.getLocation().y, minOffsetY));
dx += ((CardPanel) component).getCardWidth() + GAP_X;
}

View file

@ -36,7 +36,6 @@ package mage.client.cards;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Rectangle;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
@ -73,7 +72,7 @@ import mage.client.util.CardViewNameComparator;
import mage.client.util.CardViewRarityComparator;
import mage.client.util.Config;
import mage.client.util.Event;
import mage.client.util.FontSizeHelper;
import mage.client.util.GUISizeHelper;
import mage.client.util.Listener;
import mage.client.util.gui.TableSpinnerEditor;
import mage.constants.CardType;
@ -148,9 +147,11 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar
}
private void setGUISize() {
Font font = FontSizeHelper.getTableFont();
mainTable.getTableHeader().setFont(font);
mainTable.getTableHeader().setPreferredSize(new Dimension(FontSizeHelper.tableHeaderHeight, FontSizeHelper.tableHeaderHeight));
mainTable.getTableHeader().setFont(GUISizeHelper.tableFont);
mainTable.getTableHeader().setPreferredSize(new Dimension(GUISizeHelper.tableHeaderHeight, GUISizeHelper.tableHeaderHeight));
mainTable.setFont(GUISizeHelper.tableFont);
mainTable.setRowHeight(GUISizeHelper.getTableRowHeight());
}
private void makeTransparent() {

View file

@ -40,7 +40,7 @@ import java.awt.event.KeyEvent;
import java.util.UUID;
import javax.swing.JTextField;
import mage.client.MageFrame;
import mage.client.util.FontSizeHelper;
import mage.client.util.GUISizeHelper;
import mage.remote.Session;
import mage.view.ChatMessage.MessageColor;
import mage.view.ChatMessage.MessageType;
@ -122,7 +122,7 @@ public class ChatPanelBasic extends javax.swing.JPanel {
public ChatPanelBasic() {
initComponents();
setBackground(new Color(0, 0, 0, CHAT_ALPHA));
changeGUISize(FontSizeHelper.getChatFont());
changeGUISize(GUISizeHelper.chatFont);
if (jScrollPaneTxt != null) {
jScrollPaneTxt.setBackground(new Color(0, 0, 0, CHAT_ALPHA));
jScrollPaneTxt.getViewport().setBackground(new Color(0, 0, 0, CHAT_ALPHA));
@ -138,14 +138,14 @@ public class ChatPanelBasic extends javax.swing.JPanel {
txtMessage.setFont(font);
if (jScrollPaneTxt != null) {
jScrollPaneTxt.setFont(font);
jScrollPaneTxt.getVerticalScrollBar().setPreferredSize(new Dimension(FontSizeHelper.scrollBarSize, 0));
jScrollPaneTxt.getHorizontalScrollBar().setPreferredSize(new Dimension(0, FontSizeHelper.scrollBarSize));
jScrollPaneTxt.getVerticalScrollBar().setPreferredSize(new Dimension(GUISizeHelper.scrollBarSize, 0));
jScrollPaneTxt.getHorizontalScrollBar().setPreferredSize(new Dimension(0, GUISizeHelper.scrollBarSize));
}
int height = 30;
if (font.getSize() > 20) {
height = 30 + Math.min(font.getSize() - 10, 30);
}
txtMessage.setMinimumSize(new Dimension(txtMessage.getWidth(), height));
txtMessage.setMinimumSize(new Dimension(20, height));
txtMessage.setMaximumSize(new Dimension(txtMessage.getWidth(), height));
txtMessage.setPreferredSize(new Dimension(txtMessage.getWidth(), height));
txtMessage.setSize(new Dimension(txtMessage.getWidth(), height));

View file

@ -30,7 +30,7 @@ package mage.client.chat;
import java.awt.Font;
import static mage.client.chat.ChatPanelBasic.TIMESTAMP_COLOR;
import mage.client.components.ColorPane;
import mage.client.util.FontSizeHelper;
import mage.client.util.GUISizeHelper;
import mage.view.ChatMessage;
import org.mage.card.arcane.ManaSymbols;
@ -105,7 +105,7 @@ public class ChatPanelSeparated extends ChatPanelBasic {
public void setSystemMessagesPane(ColorPane systemMessagesPane) {
this.systemMessagesPane = systemMessagesPane;
changeGUISize(FontSizeHelper.getChatFont());
changeGUISize(GUISizeHelper.chatFont);
}
@Override

View file

@ -36,7 +36,6 @@ package mage.client.deckeditor;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ComponentEvent;
@ -65,7 +64,7 @@ import mage.client.cards.CardGrid;
import mage.client.cards.ICardGrid;
import mage.client.constants.Constants.SortBy;
import mage.client.deckeditor.table.TableModel;
import mage.client.util.FontSizeHelper;
import mage.client.util.GUISizeHelper;
import mage.client.util.sets.ConstructedFormats;
import mage.constants.CardType;
import mage.filter.FilterCard;
@ -187,9 +186,11 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
}
private void setGUISize() {
Font font = FontSizeHelper.getTableFont();
mainTable.getTableHeader().setFont(font);
mainTable.getTableHeader().setPreferredSize(new Dimension(FontSizeHelper.tableHeaderHeight, FontSizeHelper.tableHeaderHeight));
mainTable.getTableHeader().setFont(GUISizeHelper.tableFont);
mainTable.getTableHeader().setPreferredSize(new Dimension(GUISizeHelper.tableHeaderHeight, GUISizeHelper.tableHeaderHeight));
mainTable.setFont(GUISizeHelper.tableFont);
mainTable.setRowHeight(GUISizeHelper.getTableRowHeight());
}
public void switchToGrid() {

View file

@ -26,7 +26,7 @@
* or implied, of BetaSteward_at_googlemail.com.
*/
/*
/*
* CardInfoWindowDialog.java
*
* Created on Feb 1, 2010, 3:00:35 PM
@ -57,10 +57,9 @@ import org.mage.plugins.card.utils.impl.ImageManagerImpl;
*/
public class CardInfoWindowDialog extends MageDialog {
private static final Logger logger = Logger.getLogger(CardInfoWindowDialog.class);
private static final Logger LOGGER = Logger.getLogger(CardInfoWindowDialog.class);
public static enum ShowType {
REVEAL, REVEAL_TOP_LIBRARY, LOOKED_AT, EXILE, GRAVEYARD, OTHER
};
@ -124,7 +123,7 @@ public class CardInfoWindowDialog extends MageDialog {
try {
this.setIcon(false);
} catch (PropertyVetoException ex) {
logger.error(null, ex);
LOGGER.error(null, ex);
}
}
} else {

View file

@ -25,7 +25,7 @@
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace pref="405" max="32767" attributes="0"/>
<EmptySpace pref="403" max="32767" attributes="0"/>
<Component id="saveButton" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="exitButton" min="-2" pref="55" max="-2" attributes="0"/>
@ -71,7 +71,7 @@
<Component id="main_card" alignment="1" max="32767" attributes="0"/>
<Component id="main_gamelog" alignment="1" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="main_game" min="-2" max="-2" attributes="0"/>
<Component id="main_game" max="32767" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
@ -83,12 +83,12 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="main_card" max="32767" attributes="0"/>
<Component id="main_card" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="main_game" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="main_gamelog" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<EmptySpace pref="45" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -116,8 +116,7 @@
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="tooltipDelayLabel" max="32767" attributes="0"/>
<Component id="displayBigCardsInHand" alignment="0" max="32767" attributes="0"/>
<Component id="tooltipDelayLabel" pref="481" max="32767" attributes="0"/>
<Component id="tooltipDelay" alignment="1" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="showCardName" min="-2" max="-2" attributes="0"/>
@ -131,30 +130,16 @@
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="displayBigCardsInHand" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="showCardName" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="tooltipDelayLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="tooltipDelay" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JCheckBox" name="displayBigCardsInHand">
<Properties>
<Property name="text" type="java.lang.String" value="Use big images (for high resolution screens)"/>
<Property name="toolTipText" type="java.lang.String" value="Changes the size of the cards shown in hand. Switch this option off if you have a small screen size."/>
<Property name="actionCommand" type="java.lang.String" value=""/>
<Property name="horizontalAlignment" type="int" value="2"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="displayBigCardsInHandActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JCheckBox" name="showCardName">
<Properties>
<Property name="selected" type="boolean" value="true"/>
@ -217,7 +202,7 @@
<Component id="cbShowStormCounter" alignment="0" max="32767" attributes="0"/>
<Component id="cbAskMoveToGraveOrder" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace pref="7" max="32767" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -398,8 +383,8 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="guiSize_font" min="-2" pref="222" max="-2" attributes="0"/>
<EmptySpace pref="296" max="32767" attributes="0"/>
<Component id="guiSize_font" pref="506" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -407,8 +392,8 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="guiSize_font" min="-2" pref="95" max="-2" attributes="0"/>
<EmptySpace pref="332" max="32767" attributes="0"/>
<Component id="guiSize_font" min="-2" pref="216" max="-2" attributes="0"/>
<EmptySpace pref="211" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -418,7 +403,7 @@
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Font">
<TitledBorder title="Size elements">
<Border PropertyName="innerBorder" info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
<EtchetBorder/>
</Border>
@ -427,20 +412,8 @@
</Property>
</Properties>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
<SubComponents>
<Component class="javax.swing.JLabel" name="fontSizeLabel">
<Properties>
<Property name="horizontalAlignment" type="int" value="0"/>
<Property name="text" type="java.lang.String" value="Size"/>
<Property name="toolTipText" type="java.lang.String" value="&lt;HTML&gt;The size of the font used to display text."/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Center"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JSlider" name="sliderFontSize">
<Properties>
<Property name="majorTickSpacing" type="int" value="5"/>
@ -451,10 +424,105 @@
<Property name="paintTicks" type="boolean" value="true"/>
<Property name="snapToTicks" type="boolean" value="true"/>
<Property name="toolTipText" type="java.lang.String" value="&lt;HTML&gt;Size of the font."/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
<EtchetBorder/>
</Border>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[150, 40]"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="First"/>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="-1" gridY="-1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="3" insetsLeft="3" insetsBottom="3" insetsRight="3" anchor="11" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="fontSizeLabel">
<Properties>
<Property name="horizontalAlignment" type="int" value="0"/>
<Property name="text" type="java.lang.String" value="Size of table font"/>
<Property name="toolTipText" type="java.lang.String" value="&lt;HTML&gt;The size of the font used to display table text."/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="-1" gridWidth="1" gridHeight="1" fill="0" ipadX="3" ipadY="3" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="11" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JSlider" name="sliderCardSizeHand">
<Properties>
<Property name="majorTickSpacing" type="int" value="5"/>
<Property name="maximum" type="int" value="50"/>
<Property name="minimum" type="int" value="10"/>
<Property name="minorTickSpacing" type="int" value="1"/>
<Property name="paintLabels" type="boolean" value="true"/>
<Property name="paintTicks" type="boolean" value="true"/>
<Property name="snapToTicks" type="boolean" value="true"/>
<Property name="toolTipText" type="java.lang.String" value="&lt;HTML&gt;Size of the font."/>
<Property name="value" type="int" value="14"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
<EtchetBorder/>
</Border>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[150, 40]"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="3" gridY="0" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="3" insetsLeft="3" insetsBottom="3" insetsRight="3" anchor="11" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="labelCardSizeHand">
<Properties>
<Property name="horizontalAlignment" type="int" value="0"/>
<Property name="text" type="java.lang.String" value="Size of hand cards"/>
<Property name="toolTipText" type="java.lang.String" value="&lt;HTML&gt;The size of the hand cards"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="3" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="3" ipadY="3" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="11" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JSlider" name="sliderChatFontSize">
<Properties>
<Property name="majorTickSpacing" type="int" value="5"/>
<Property name="maximum" type="int" value="50"/>
<Property name="minimum" type="int" value="10"/>
<Property name="minorTickSpacing" type="int" value="1"/>
<Property name="paintLabels" type="boolean" value="true"/>
<Property name="paintTicks" type="boolean" value="true"/>
<Property name="snapToTicks" type="boolean" value="true"/>
<Property name="toolTipText" type="java.lang.String" value="&lt;HTML&gt;Size of the font."/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
<EtchetBorder/>
</Border>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[150, 40]"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="-1" gridY="3" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="3" insetsLeft="3" insetsBottom="3" insetsRight="3" anchor="11" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="chatFontSizeLabel">
<Properties>
<Property name="horizontalAlignment" type="int" value="0"/>
<Property name="text" type="java.lang.String" value="Size of chat font"/>
<Property name="toolTipText" type="java.lang.String" value="&lt;HTML&gt;The size of the font used to display the chat text"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="-1" gridWidth="1" gridHeight="1" fill="0" ipadX="3" ipadY="3" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="11" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
@ -871,7 +939,7 @@
<Component id="cbPreferedImageLanguage" min="-2" pref="153" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace min="0" pref="190" max="32767" attributes="0"/>
<EmptySpace min="0" pref="188" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="24" max="-2" attributes="0"/>
@ -2162,7 +2230,7 @@
</Group>
<Component id="connection_servers" alignment="1" max="32767" attributes="0"/>
</Group>
<EmptySpace pref="16" max="32767" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>

View file

@ -60,7 +60,7 @@ import javax.swing.border.Border;
import javax.swing.filechooser.FileFilter;
import mage.client.MageFrame;
import mage.client.util.Config;
import mage.client.util.FontSizeHelper;
import mage.client.util.GUISizeHelper;
import mage.client.util.ImageHelper;
import mage.client.util.gui.BufferedImageBuilder;
import static mage.constants.Constants.DEFAULT_AVATAR_ID;
@ -82,7 +82,6 @@ public class PreferencesDialog extends javax.swing.JDialog {
private static final Logger LOGGER = Logger.getLogger(PreferencesDialog.class);
public static final String KEY_HAND_USE_BIG_CARDS = "handUseBigCards";
public static final String KEY_SHOW_TOOLTIPS_DELAY = "showTooltipsDelay";
public static final String KEY_SHOW_CARD_NAMES = "showCardNames";
public static final String KEY_PERMANENTS_IN_ONE_PILE = "nonLandPermanentsInOnePile";
@ -93,7 +92,9 @@ public class PreferencesDialog extends javax.swing.JDialog {
public static final String KEY_GAME_CONFIRM_EMPTY_MANA_POOL = "gameConfirmEmptyManaPool";
public static final String KEY_GAME_ASK_MOVE_TO_GRAVE_ORDER = "gameAskMoveToGraveORder";
public static final String KEY_GUI_FONT_SIZE = "guiFontSize";
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_GAME_LOG_AUTO_SAVE = "gameLogAutoSave";
public static final String KEY_DRAFT_LOG_AUTO_SAVE = "draftLogAutoSave";
@ -125,7 +126,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
public static final String MAIN_YOU = "mainYou";
public static final String BEFORE_COMBAT_YOU = "beforeCombatYou";
public static final String END_OF_COMBAT_YOU = "endOfCombatYou";
public static final String MAIN_2_YOU = "main2You";
public static final String MAIN_TWO_YOU = "main2You";
public static final String END_OF_TURN_YOU = "endOfTurnYou";
public static final String UPKEEP_OTHERS = "upkeepOthers";
@ -133,7 +134,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
public static final String MAIN_OTHERS = "mainOthers";
public static final String BEFORE_COMBAT_OTHERS = "beforeCombatOthers";
public static final String END_OF_COMBAT_OTHERS = "endOfCombatOthers";
public static final String MAIN_2_OTHERS = "main2Others";
public static final String MAIN_TWO_OTHERS = "main2Others";
public static final String END_OF_TURN_OTHERS = "endOfTurnOthers";
public static final String KEY_STOP_ATTACK = "stopDeclareAttacksStep";
@ -339,11 +340,11 @@ public class PreferencesDialog extends javax.swing.JDialog {
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
java.awt.GridBagConstraints gridBagConstraints;
tabsPanel = new javax.swing.JTabbedPane();
tabMain = new javax.swing.JPanel();
main_card = new javax.swing.JPanel();
displayBigCardsInHand = new javax.swing.JCheckBox();
showCardName = new javax.swing.JCheckBox();
tooltipDelayLabel = new javax.swing.JLabel();
tooltipDelay = new javax.swing.JSlider();
@ -360,8 +361,12 @@ public class PreferencesDialog extends javax.swing.JDialog {
cbDraftLogAutoSave = new javax.swing.JCheckBox();
tabGuiSize = new javax.swing.JPanel();
guiSize_font = new javax.swing.JPanel();
fontSizeLabel = new javax.swing.JLabel();
sliderFontSize = new javax.swing.JSlider();
fontSizeLabel = new javax.swing.JLabel();
sliderCardSizeHand = new javax.swing.JSlider();
labelCardSizeHand = new javax.swing.JLabel();
sliderChatFontSize = new javax.swing.JSlider();
chatFontSizeLabel = new javax.swing.JLabel();
tabPhases = new javax.swing.JPanel();
jLabelHeadLine = new javax.swing.JLabel();
jLabelYourTurn = new javax.swing.JLabel();
@ -479,16 +484,6 @@ public class PreferencesDialog extends javax.swing.JDialog {
main_card.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Card"));
displayBigCardsInHand.setText("Use big images (for high resolution screens)");
displayBigCardsInHand.setToolTipText("Changes the size of the cards shown in hand. Switch this option off if you have a small screen size.");
displayBigCardsInHand.setActionCommand("");
displayBigCardsInHand.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
displayBigCardsInHand.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
displayBigCardsInHandActionPerformed(evt);
}
});
showCardName.setSelected(true);
showCardName.setText("Show card name on card panel");
showCardName.setToolTipText("Write the card's name on the card to make the card name more recognizable.");
@ -520,8 +515,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
.addGroup(main_cardLayout.createSequentialGroup()
.addGap(6, 6, 6)
.addGroup(main_cardLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(tooltipDelayLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(displayBigCardsInHand, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(tooltipDelayLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 481, Short.MAX_VALUE)
.addComponent(tooltipDelay, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(main_cardLayout.createSequentialGroup()
.addComponent(showCardName)
@ -531,14 +525,11 @@ public class PreferencesDialog extends javax.swing.JDialog {
main_cardLayout.setVerticalGroup(
main_cardLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(main_cardLayout.createSequentialGroup()
.addComponent(displayBigCardsInHand)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(showCardName)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(tooltipDelayLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(tooltipDelay, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
.addComponent(tooltipDelay, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
main_game.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Game"));
@ -625,7 +616,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
.addComponent(cbAllowRequestToShowHandCards, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(cbShowStormCounter, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(cbAskMoveToGraveOrder, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap(7, Short.MAX_VALUE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
main_gameLayout.setVerticalGroup(
main_gameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -697,7 +688,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
.addComponent(main_card, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(main_gamelog, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(tabMainLayout.createSequentialGroup()
.addComponent(main_game, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(main_game, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
);
@ -705,25 +696,20 @@ public class PreferencesDialog extends javax.swing.JDialog {
tabMainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(tabMainLayout.createSequentialGroup()
.addContainerGap()
.addComponent(main_card, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(main_card, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(main_game, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(main_gamelog, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
.addContainerGap(45, Short.MAX_VALUE))
);
main_card.getAccessibleContext().setAccessibleName("Game panel");
tabsPanel.addTab("Main", tabMain);
guiSize_font.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Font"));
guiSize_font.setLayout(new java.awt.BorderLayout());
fontSizeLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
fontSizeLabel.setText("Size");
fontSizeLabel.setToolTipText("<HTML>The size of the font used to display text.");
guiSize_font.add(fontSizeLabel, java.awt.BorderLayout.CENTER);
guiSize_font.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Size elements"));
guiSize_font.setLayout(new java.awt.GridBagLayout());
sliderFontSize.setMajorTickSpacing(5);
sliderFontSize.setMaximum(50);
@ -733,7 +719,77 @@ public class PreferencesDialog extends javax.swing.JDialog {
sliderFontSize.setPaintTicks(true);
sliderFontSize.setSnapToTicks(true);
sliderFontSize.setToolTipText("<HTML>Size of the font.");
guiSize_font.add(sliderFontSize, java.awt.BorderLayout.PAGE_START);
sliderFontSize.setBorder(javax.swing.BorderFactory.createEtchedBorder());
sliderFontSize.setMinimumSize(new java.awt.Dimension(150, 40));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
guiSize_font.add(sliderFontSize, gridBagConstraints);
fontSizeLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
fontSizeLabel.setText("Size of table font");
fontSizeLabel.setToolTipText("<HTML>The size of the font used to display table text.");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.ipadx = 3;
gridBagConstraints.ipady = 3;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
guiSize_font.add(fontSizeLabel, gridBagConstraints);
sliderCardSizeHand.setMajorTickSpacing(5);
sliderCardSizeHand.setMaximum(50);
sliderCardSizeHand.setMinimum(10);
sliderCardSizeHand.setMinorTickSpacing(1);
sliderCardSizeHand.setPaintLabels(true);
sliderCardSizeHand.setPaintTicks(true);
sliderCardSizeHand.setSnapToTicks(true);
sliderCardSizeHand.setToolTipText("<HTML>Size of the font.");
sliderCardSizeHand.setValue(14);
sliderCardSizeHand.setBorder(javax.swing.BorderFactory.createEtchedBorder());
sliderCardSizeHand.setMinimumSize(new java.awt.Dimension(150, 40));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 3;
gridBagConstraints.gridy = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
guiSize_font.add(sliderCardSizeHand, gridBagConstraints);
labelCardSizeHand.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
labelCardSizeHand.setText("Size of hand cards");
labelCardSizeHand.setToolTipText("<HTML>The size of the hand cards");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 3;
gridBagConstraints.gridy = 1;
gridBagConstraints.ipadx = 3;
gridBagConstraints.ipady = 3;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
guiSize_font.add(labelCardSizeHand, gridBagConstraints);
sliderChatFontSize.setMajorTickSpacing(5);
sliderChatFontSize.setMaximum(50);
sliderChatFontSize.setMinimum(10);
sliderChatFontSize.setMinorTickSpacing(1);
sliderChatFontSize.setPaintLabels(true);
sliderChatFontSize.setPaintTicks(true);
sliderChatFontSize.setSnapToTicks(true);
sliderChatFontSize.setToolTipText("<HTML>Size of the font.");
sliderChatFontSize.setBorder(javax.swing.BorderFactory.createEtchedBorder());
sliderChatFontSize.setMinimumSize(new java.awt.Dimension(150, 40));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridy = 3;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
guiSize_font.add(sliderChatFontSize, gridBagConstraints);
chatFontSizeLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
chatFontSizeLabel.setText("Size of chat font");
chatFontSizeLabel.setToolTipText("<HTML>The size of the font used to display the chat text");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.ipadx = 3;
gridBagConstraints.ipady = 3;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
guiSize_font.add(chatFontSizeLabel, gridBagConstraints);
javax.swing.GroupLayout tabGuiSizeLayout = new javax.swing.GroupLayout(tabGuiSize);
tabGuiSize.setLayout(tabGuiSizeLayout);
@ -741,15 +797,15 @@ public class PreferencesDialog extends javax.swing.JDialog {
tabGuiSizeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(tabGuiSizeLayout.createSequentialGroup()
.addContainerGap()
.addComponent(guiSize_font, javax.swing.GroupLayout.PREFERRED_SIZE, 222, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(296, Short.MAX_VALUE))
.addComponent(guiSize_font, javax.swing.GroupLayout.DEFAULT_SIZE, 506, Short.MAX_VALUE)
.addContainerGap())
);
tabGuiSizeLayout.setVerticalGroup(
tabGuiSizeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(tabGuiSizeLayout.createSequentialGroup()
.addContainerGap()
.addComponent(guiSize_font, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(332, Short.MAX_VALUE))
.addComponent(guiSize_font, javax.swing.GroupLayout.PREFERRED_SIZE, 216, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(211, Short.MAX_VALUE))
);
tabsPanel.addTab("GUI Size", tabGuiSize);
@ -1023,7 +1079,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
.addComponent(cbSaveToZipFiles, javax.swing.GroupLayout.Alignment.LEADING))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(cbPreferedImageLanguage, javax.swing.GroupLayout.PREFERRED_SIZE, 153, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(0, 190, Short.MAX_VALUE))
.addGap(0, 188, Short.MAX_VALUE))
.addGroup(panelCardImagesLayout.createSequentialGroup()
.addGap(24, 24, 24)
.addComponent(txtImageFolderPath)
@ -1915,7 +1971,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(cbProxyType, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(connection_servers, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap(16, Short.MAX_VALUE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
tabConnectionLayout.setVerticalGroup(
tabConnectionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -1956,7 +2012,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(405, Short.MAX_VALUE)
.addContainerGap(403, Short.MAX_VALUE)
.addComponent(saveButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(exitButton, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
@ -1981,7 +2037,6 @@ public class PreferencesDialog extends javax.swing.JDialog {
Preferences prefs = MageFrame.getPreferences();
// main
save(prefs, dialog.displayBigCardsInHand, KEY_HAND_USE_BIG_CARDS, "true", "false", UPDATE_CACHE_POLICY);
save(prefs, dialog.tooltipDelay, KEY_SHOW_TOOLTIPS_DELAY, "true", "false", UPDATE_CACHE_POLICY);
save(prefs, dialog.showCardName, KEY_SHOW_CARD_NAMES, "true", "false", UPDATE_CACHE_POLICY);
save(prefs, dialog.nonLandPermanentsInOnePile, KEY_PERMANENTS_IN_ONE_PILE, "true", "false", UPDATE_CACHE_POLICY);
@ -1995,9 +2050,22 @@ public class PreferencesDialog extends javax.swing.JDialog {
save(prefs, dialog.cbDraftLogAutoSave, KEY_DRAFT_LOG_AUTO_SAVE, "true", "false", UPDATE_CACHE_POLICY);
// GUI Size
if (getCachedValue(KEY_GUI_FONT_SIZE, 14) != dialog.sliderFontSize.getValue()) {
save(prefs, dialog.sliderFontSize, KEY_GUI_FONT_SIZE, "true", "false", UPDATE_CACHE_POLICY);
FontSizeHelper.changeGUISize();
boolean sizeGUIChanged = false;
if (getCachedValue(KEY_GUI_TABLE_FONT_SIZE, 14) != dialog.sliderFontSize.getValue()) {
save(prefs, dialog.sliderFontSize, KEY_GUI_TABLE_FONT_SIZE, "true", "false", UPDATE_CACHE_POLICY);
sizeGUIChanged = true;
}
if (getCachedValue(KEY_GUI_CHAT_FONT_SIZE, 14) != dialog.sliderFontSize.getValue()) {
save(prefs, dialog.sliderChatFontSize, KEY_GUI_CHAT_FONT_SIZE, "true", "false", UPDATE_CACHE_POLICY);
sizeGUIChanged = true;
}
if (getCachedValue(KEY_GUI_CARD_HAND_SIZE, 14) != dialog.sliderCardSizeHand.getValue()) {
save(prefs, dialog.sliderCardSizeHand, KEY_GUI_CARD_HAND_SIZE, "true", "false", UPDATE_CACHE_POLICY);
sizeGUIChanged = true;
}
if (sizeGUIChanged) {
// do as worker job
GUISizeHelper.changeGUISize();
}
// Phases & Priority
@ -2006,7 +2074,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
save(prefs, dialog.checkBoxMainYou, MAIN_YOU);
save(prefs, dialog.checkBoxBeforeCYou, BEFORE_COMBAT_YOU);
save(prefs, dialog.checkBoxEndOfCYou, END_OF_COMBAT_YOU);
save(prefs, dialog.checkBoxMain2You, MAIN_2_YOU);
save(prefs, dialog.checkBoxMain2You, MAIN_TWO_YOU);
save(prefs, dialog.checkBoxEndTurnYou, END_OF_TURN_YOU);
save(prefs, dialog.checkBoxUpkeepOthers, UPKEEP_OTHERS);
@ -2014,7 +2082,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
save(prefs, dialog.checkBoxMainOthers, MAIN_OTHERS);
save(prefs, dialog.checkBoxBeforeCOthers, BEFORE_COMBAT_OTHERS);
save(prefs, dialog.checkBoxEndOfCOthers, END_OF_COMBAT_OTHERS);
save(prefs, dialog.checkBoxMain2Others, MAIN_2_OTHERS);
save(prefs, dialog.checkBoxMain2Others, MAIN_TWO_OTHERS);
save(prefs, dialog.checkBoxEndTurnOthers, END_OF_TURN_OTHERS);
save(prefs, dialog.cbStopAttack, KEY_STOP_ATTACK, "true", "false", UPDATE_CACHE_POLICY);
@ -2263,10 +2331,6 @@ public class PreferencesDialog extends javax.swing.JDialog {
// TODO add your handling code here:
}//GEN-LAST:event_showPlayerNamesPermanentlyActionPerformed
private void displayBigCardsInHandActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_displayBigCardsInHandActionPerformed
}//GEN-LAST:event_displayBigCardsInHandActionPerformed
private void showCardNameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_showCardNameActionPerformed
}//GEN-LAST:event_showCardNameActionPerformed
@ -2429,7 +2493,6 @@ public class PreferencesDialog extends javax.swing.JDialog {
}
private static void loadPhases(Preferences prefs) {
load(prefs, dialog.displayBigCardsInHand, KEY_HAND_USE_BIG_CARDS, "true", "true");
load(prefs, dialog.tooltipDelay, KEY_SHOW_TOOLTIPS_DELAY, "300");
load(prefs, dialog.showCardName, KEY_SHOW_CARD_NAMES, "true");
load(prefs, dialog.nonLandPermanentsInOnePile, KEY_PERMANENTS_IN_ONE_PILE, "true");
@ -2448,7 +2511,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
load(prefs, dialog.checkBoxMainYou, MAIN_YOU, "on", "on");
load(prefs, dialog.checkBoxBeforeCYou, BEFORE_COMBAT_YOU, "on", "on");
load(prefs, dialog.checkBoxEndOfCYou, END_OF_COMBAT_YOU, "on", "on");
load(prefs, dialog.checkBoxMain2You, MAIN_2_YOU, "on", "on");
load(prefs, dialog.checkBoxMain2You, MAIN_TWO_YOU, "on", "on");
load(prefs, dialog.checkBoxEndTurnYou, END_OF_TURN_YOU, "on", "on");
load(prefs, dialog.checkBoxUpkeepOthers, UPKEEP_OTHERS, "on", "on");
@ -2456,7 +2519,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
load(prefs, dialog.checkBoxMainOthers, MAIN_OTHERS, "on", "on");
load(prefs, dialog.checkBoxBeforeCOthers, BEFORE_COMBAT_OTHERS, "on", "on");
load(prefs, dialog.checkBoxEndOfCOthers, END_OF_COMBAT_OTHERS, "on", "on");
load(prefs, dialog.checkBoxMain2Others, MAIN_2_OTHERS, "on", "on");
load(prefs, dialog.checkBoxMain2Others, MAIN_TWO_OTHERS, "on", "on");
load(prefs, dialog.checkBoxEndTurnOthers, END_OF_TURN_OTHERS, "on", "on");
load(prefs, dialog.cbStopAttack, KEY_STOP_ATTACK, "true", "true");
@ -2470,7 +2533,9 @@ public class PreferencesDialog extends javax.swing.JDialog {
}
private static void loadGuiSize(Preferences prefs) {
load(prefs, dialog.sliderFontSize, KEY_GUI_FONT_SIZE, "14");
load(prefs, dialog.sliderFontSize, KEY_GUI_TABLE_FONT_SIZE, "14");
load(prefs, dialog.sliderChatFontSize, KEY_GUI_CHAT_FONT_SIZE, "14");
load(prefs, dialog.sliderCardSizeHand, KEY_GUI_CARD_HAND_SIZE, "14");
}
private static void loadImagesSettings(Preferences prefs) {
@ -2891,6 +2956,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
private javax.swing.JCheckBox cbUseDefaultBattleImage;
private javax.swing.JCheckBox cbUseDefaultImageFolder;
private javax.swing.JCheckBox cbUseRandomBattleImage;
private javax.swing.JLabel chatFontSizeLabel;
private javax.swing.JCheckBox checkBoxBeforeCOthers;
private javax.swing.JCheckBox checkBoxBeforeCYou;
private javax.swing.JCheckBox checkBoxDrawOthers;
@ -2906,7 +2972,6 @@ public class PreferencesDialog extends javax.swing.JDialog {
private javax.swing.JCheckBox checkBoxUpkeepOthers;
private javax.swing.JCheckBox checkBoxUpkeepYou;
private javax.swing.JPanel connection_servers;
private javax.swing.JCheckBox displayBigCardsInHand;
private javax.swing.JButton exitButton;
private javax.swing.JLabel fontSizeLabel;
private javax.swing.JPanel guiSize_font;
@ -2949,6 +3014,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
private javax.swing.JPanel jPanel31;
private javax.swing.JPanel jPanel32;
private javax.swing.JPanel jPanel33;
private javax.swing.JLabel labelCardSizeHand;
private javax.swing.JLabel labelPreferedImageLanguage;
private javax.swing.JLabel lblProxyPassword;
private javax.swing.JLabel lblProxyPort;
@ -2970,6 +3036,8 @@ public class PreferencesDialog extends javax.swing.JDialog {
private javax.swing.JCheckBox showAbilityPickerForced;
private javax.swing.JCheckBox showCardName;
private javax.swing.JCheckBox showPlayerNamesPermanently;
private javax.swing.JSlider sliderCardSizeHand;
private javax.swing.JSlider sliderChatFontSize;
private javax.swing.JSlider sliderFontSize;
private javax.swing.JPanel sounds_backgroundMusic;
private javax.swing.JPanel sounds_clips;

View file

@ -34,7 +34,6 @@
package mage.client.dialog;
import java.awt.Dimension;
import java.awt.Font;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.CancellationException;
@ -48,7 +47,7 @@ import mage.client.components.MageComponents;
import mage.client.components.tray.MageTray;
import static mage.client.dialog.PreferencesDialog.KEY_TABLE_WAITING_COLUMNS_ORDER;
import static mage.client.dialog.PreferencesDialog.KEY_TABLE_WAITING_COLUMNS_WIDTH;
import mage.client.util.FontSizeHelper;
import mage.client.util.GUISizeHelper;
import mage.client.util.audio.AudioManager;
import mage.client.util.gui.TableUtil;
import mage.client.util.gui.countryBox.CountryCellRenderer;
@ -98,18 +97,20 @@ public class TableWaitingDialog extends MageDialog {
MageFrame.getUI().addButton(MageComponents.TABLE_WAITING_START_BUTTON, btnStart);
}
@Override
public void changeGUISize() {
setGUISize();
}
private void setGUISize() {
Font font = FontSizeHelper.getTableFont();
tableSeats.getTableHeader().setFont(font);
tableSeats.getTableHeader().setPreferredSize(new Dimension(FontSizeHelper.tableHeaderHeight, FontSizeHelper.tableHeaderHeight));
tableSeats.getTableHeader().setFont(GUISizeHelper.tableFont);
tableSeats.getTableHeader().setPreferredSize(new Dimension(GUISizeHelper.tableHeaderHeight, GUISizeHelper.tableHeaderHeight));
tableSeats.setFont(GUISizeHelper.tableFont);
tableSeats.setRowHeight(GUISizeHelper.getTableRowHeight());
jSplitPane1.setDividerSize(FontSizeHelper.dividerBarSize);
jScrollPane1.getVerticalScrollBar().setPreferredSize(new Dimension(FontSizeHelper.scrollBarSize, 0));
jScrollPane1.getHorizontalScrollBar().setPreferredSize(new Dimension(0, FontSizeHelper.scrollBarSize));
jSplitPane1.setDividerSize(GUISizeHelper.dividerBarSize);
jScrollPane1.getVerticalScrollBar().setPreferredSize(new Dimension(GUISizeHelper.scrollBarSize, 0));
jScrollPane1.getHorizontalScrollBar().setPreferredSize(new Dimension(0, GUISizeHelper.scrollBarSize));
}
public void update(TableView table) {

View file

@ -1,4 +1,4 @@
<?xml version="1.1" encoding="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JInternalFrameFormInfo">
<SyntheticProperties>

View file

@ -26,12 +26,11 @@
* or implied, of BetaSteward_at_googlemail.com.
*/
/*
/*
* DraftPane.java
*
* Created on Jan 7, 2011, 2:11:44 PM
*/
package mage.client.draft;
import java.awt.Component;
@ -48,11 +47,13 @@ import mage.client.plugins.impl.Plugins;
*/
public class DraftPane extends MagePane {
/** Creates new form DraftPane */
/**
* Creates new form DraftPane
*/
public DraftPane() {
boolean initialized = false;
if (Plugins.getInstance().isThemePluginLoaded()) {
Map<String, JComponent> uiComponents = new HashMap<String, JComponent>();
Map<String, JComponent> uiComponents = new HashMap<>();
JComponent container = Plugins.getInstance().updateTablePanel(uiComponents);
if (container != null) {
draftPanel1 = new mage.client.draft.DraftPanel();
@ -68,6 +69,11 @@ public class DraftPane extends MagePane {
}
}
@Override
public void changeGUISize() {
super.changeGUISize(); //To change body of generated methods, choose Tools | Templates.
}
public void showDraft(UUID draftId) {
this.setTitle("Draft - " + draftId);
this.draftPanel1.showDraft(draftId);
@ -78,10 +84,10 @@ public class DraftPane extends MagePane {
this.removeFrame();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents

View file

@ -26,7 +26,7 @@
* or implied, of BetaSteward_at_googlemail.com.
*/
/*
/*
* DraftPanel.java
*
* Created on Jan 7, 2011, 2:15:48 PM
@ -88,7 +88,7 @@ import org.apache.log4j.Logger;
*/
public class DraftPanel extends javax.swing.JPanel {
private static final Logger logger = Logger.getLogger(DraftPanel.class);
private static final Logger LOGGER = Logger.getLogger(DraftPanel.class);
private UUID draftId;
private Session session;
@ -121,7 +121,7 @@ public class DraftPanel extends javax.swing.JPanel {
private String currentBoosterHeader;
private String[] currentBooster;
private static final CardsView emptyView = new CardsView();
private static final CardsView EMPTY_VIEW = new CardsView();
/**
* Creates new form DraftPanel
@ -170,6 +170,15 @@ public class DraftPanel extends javax.swing.JPanel {
}
}
public void changeGUISize() {
draftPicks.changeGUISize();
setGUISize();
}
private void setGUISize() {
}
public synchronized void showDraft(UUID draftId) {
this.draftId = draftId;
session = MageFrame.getSession();
@ -186,7 +195,7 @@ public class DraftPanel extends javax.swing.JPanel {
try {
Files.write(pathToDraftLog(), "".getBytes(), StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING);
} catch (IOException ex) {
logger.error(null, ex);
LOGGER.error(null, ex);
}
} else {
logFilename = null;
@ -326,7 +335,7 @@ public class DraftPanel extends javax.swing.JPanel {
DraftPickView view = session.sendCardPick(draftId, source.getId(), cardsHidden);
if (view != null) {
loadCardsToPickedCardsArea(view.getPicks());
draftBooster.loadBooster(emptyView, bigCard);
draftBooster.loadBooster(EMPTY_VIEW, bigCard);
Plugins.getInstance().getActionCallback().hideTooltipPopup();
setMessage("Waiting for other players");
}
@ -524,7 +533,7 @@ public class DraftPanel extends javax.swing.JPanel {
try {
Files.write(pathToDraftLog(), data.getBytes(), StandardOpenOption.APPEND);
} catch (IOException ex) {
logger.error(null, ex);
LOGGER.error(null, ex);
}
}

View file

@ -47,7 +47,7 @@ import mage.client.cards.BigCard;
import mage.client.cards.Permanent;
import mage.client.plugins.impl.Plugins;
import mage.client.util.Config;
import mage.client.util.FontSizeHelper;
import mage.client.util.GUISizeHelper;
import mage.client.util.audio.AudioManager;
import mage.client.util.layout.CardLayoutStrategy;
import mage.client.util.layout.impl.OldCardLayoutStrategy;
@ -125,8 +125,8 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane {
}
private void setGUISize() {
jScrollPane.getVerticalScrollBar().setPreferredSize(new Dimension(FontSizeHelper.scrollBarSize, 0));
jScrollPane.getHorizontalScrollBar().setPreferredSize(new Dimension(0, FontSizeHelper.scrollBarSize));
jScrollPane.getVerticalScrollBar().setPreferredSize(new Dimension(GUISizeHelper.scrollBarSize, 0));
jScrollPane.getHorizontalScrollBar().setPreferredSize(new Dimension(0, GUISizeHelper.scrollBarSize));
}
public void update(Map<UUID, PermanentView> battlefield) {

View file

@ -74,6 +74,8 @@ public class GamePane extends MagePane {
public void changeGUISize() {
super.changeGUISize();
gamePanel.changeGUISize();
this.revalidate();
this.repaint();
}
public void removeGame() {

View file

@ -103,7 +103,7 @@ import mage.client.plugins.impl.Plugins;
import mage.client.util.CardsViewUtil;
import mage.client.util.Config;
import mage.client.util.Event;
import mage.client.util.FontSizeHelper;
import mage.client.util.GUISizeHelper;
import mage.client.util.GameManager;
import mage.client.util.Listener;
import mage.client.util.audio.AudioManager;
@ -205,7 +205,7 @@ public final class GamePanel extends javax.swing.JPanel {
public GamePanel() {
initComponents();
changeGUISize();
setGUISize();
initPopupMenuTriggerOrder();
//this.add(popupMenuTriggerOrder);
@ -332,12 +332,13 @@ public final class GamePanel extends javax.swing.JPanel {
playAreaPanel.changeGUISize();
}
feedbackPanel.changeGUISize();
}
private void setGUISize() {
jSplitPane0.setDividerSize(FontSizeHelper.dividerBarSize);
jSplitPane1.setDividerSize(FontSizeHelper.dividerBarSize);
jSplitPane2.setDividerSize(FontSizeHelper.dividerBarSize);
jSplitPane0.setDividerSize(GUISizeHelper.dividerBarSize);
jSplitPane1.setDividerSize(GUISizeHelper.dividerBarSize);
jSplitPane2.setDividerSize(GUISizeHelper.dividerBarSize);
}
private void saveDividerLocations() {
@ -386,7 +387,6 @@ public final class GamePanel extends javax.swing.JPanel {
bigCard.setPreferredSize(bbDimension);
pnlShortCuts.revalidate();
pnlShortCuts.repaint();
//this.handContainer.sizeHand(0.8, smallMode);
for (PlayAreaPanel p : players.values()) {
p.sizePlayer(smallMode);
}
@ -399,7 +399,6 @@ public final class GamePanel extends javax.swing.JPanel {
bigCard.setPreferredSize(bbDimension);
pnlShortCuts.revalidate();
pnlShortCuts.repaint();
this.handContainer.sizeHand(1, smallMode);
for (PlayAreaPanel p : players.values()) {
p.sizePlayer(smallMode);
}

View file

@ -6,33 +6,23 @@ import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
import mage.client.cards.BigCard;
import mage.client.dialog.PreferencesDialog;
import mage.client.util.Config;
import mage.client.util.FontSizeHelper;
import mage.client.util.GUISizeHelper;
import mage.constants.Zone;
import mage.view.CardsView;
public class HandPanel extends JPanel {
private static final int CARD_WIDTH = 75;
private static final double ASPECT_RATIO = 3.5 / 2.5;
private static final int HAND_MIN_CARDS_OFFSET_Y = -10;
private boolean smallMode = false;
private Dimension handCardDimensionBig;
private Dimension handCardDimension;
public HandPanel() {
double factor = 1;
initComponents();
changeGUISize();
sizeHand(factor, false);
}
public void initComponents() {
hand = new mage.client.cards.Cards(true);
hand.setCardDimension(getHandCardDimension());
hand.setMinOffsetY(HAND_MIN_CARDS_OFFSET_Y);
hand.setCardDimension(GUISizeHelper.handCardDimension);
jPanel = new JPanel();
jScrollPane1 = new JScrollPane(jPanel);
@ -46,11 +36,11 @@ public class HandPanel extends JPanel {
jPanel.setOpaque(false);
jScrollPane1.setOpaque(false);
jPanel.setBorder(emptyBorder);
jScrollPane1.setBorder(emptyBorder);
jPanel.setBorder(EMPTY_BORDER);
jScrollPane1.setBorder(EMPTY_BORDER);
jScrollPane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
jScrollPane1.getHorizontalScrollBar().setUnitIncrement(8);
jScrollPane1.setViewportBorder(emptyBorder);
jScrollPane1.setViewportBorder(EMPTY_BORDER);
setLayout(new BorderLayout());
add(jScrollPane1, BorderLayout.CENTER);
@ -58,7 +48,7 @@ public class HandPanel extends JPanel {
hand.setHScrollSpeed(8);
hand.setBackgroundColor(new Color(0, 0, 0, 0));
hand.setVisibleIfEmpty(false);
hand.setBorder(emptyBorder);
hand.setBorder(EMPTY_BORDER);
hand.setZone(Zone.HAND.toString());
}
@ -71,36 +61,19 @@ public class HandPanel extends JPanel {
}
private void setGUISize() {
jScrollPane1.getVerticalScrollBar().setPreferredSize(new Dimension(FontSizeHelper.scrollBarSize, 0));
jScrollPane1.getHorizontalScrollBar().setPreferredSize(new Dimension(0, FontSizeHelper.scrollBarSize));
jScrollPane1.getVerticalScrollBar().setPreferredSize(new Dimension(GUISizeHelper.scrollBarSize, 0));
jScrollPane1.getHorizontalScrollBar().setPreferredSize(new Dimension(0, GUISizeHelper.scrollBarSize));
hand.setCardDimension(GUISizeHelper.handCardDimension);
hand.changeGUISize();
}
public void loadCards(CardsView cards, BigCard bigCard, UUID gameId) {
hand.loadCards(cards, bigCard, gameId, true);
hand.sizeCards(getHandCardDimension());
}
private Dimension getHandCardDimension() {
String useBigCards = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_HAND_USE_BIG_CARDS, "true");
if (!smallMode && useBigCards.equals("true")) {
return handCardDimensionBig;
}
return handCardDimension;
}
public void sizeHand(double factor, boolean smallMode) {
this.smallMode = smallMode;
int width = (int) (factor * CARD_WIDTH);
int bigWidth = (int) (Config.handScalingFactor * CARD_WIDTH);
handCardDimension = new Dimension(width, (int) (width * ASPECT_RATIO));
handCardDimensionBig = new Dimension(bigWidth, (int) (bigWidth * ASPECT_RATIO));
hand.setCardDimension(getHandCardDimension());
hand.sizeCards(getHandCardDimension());
}
private JPanel jPanel;
private JScrollPane jScrollPane1;
private static final Border emptyBorder = new EmptyBorder(0, 0, 0, 0);
private static final Border EMPTY_BORDER = new EmptyBorder(0, 0, 0, 0);
private mage.client.cards.Cards hand;
}

View file

@ -50,7 +50,7 @@ import mage.client.MageFrame;
import mage.client.components.MageTextArea;
import mage.client.game.FeedbackPanel.FeedbackMode;
import static mage.client.game.FeedbackPanel.FeedbackMode.QUESTION;
import mage.client.util.FontSizeHelper;
import mage.client.util.GUISizeHelper;
import static mage.constants.PlayerAction.REQUEST_AUTO_ANSWER_ID_NO;
import static mage.constants.PlayerAction.REQUEST_AUTO_ANSWER_ID_YES;
import static mage.constants.PlayerAction.REQUEST_AUTO_ANSWER_RESET_ALL;
@ -115,12 +115,12 @@ public class HelperPanel extends JPanel {
private void setGUISize() {
for (Component comp : popupMenuAskNo.getComponents()) {
if (comp instanceof JMenuItem) {
comp.setFont(FontSizeHelper.menuFont);
comp.setFont(GUISizeHelper.menuFont);
}
}
for (Component comp : popupMenuAskYes.getComponents()) {
if (comp instanceof JMenuItem) {
comp.setFont(FontSizeHelper.menuFont);
comp.setFont(GUISizeHelper.menuFont);
}
}
}

View file

@ -56,7 +56,7 @@ import mage.client.dialog.PreferencesDialog;
import static mage.client.dialog.PreferencesDialog.KEY_GAME_ALLOW_REQUEST_SHOW_HAND_CARDS;
import static mage.client.dialog.PreferencesDialog.KEY_GAME_MANA_AUTOPAYMENT;
import static mage.client.dialog.PreferencesDialog.KEY_GAME_MANA_AUTOPAYMENT_ONLY_ONE;
import mage.client.util.FontSizeHelper;
import mage.client.util.GUISizeHelper;
import mage.constants.PlayerAction;
import mage.view.PlayerView;
@ -150,11 +150,11 @@ public class PlayAreaPanel extends javax.swing.JPanel {
private void setGUISize() {
for (Component comp : popupMenu.getComponents()) {
if (comp instanceof JMenuItem) {
comp.setFont(FontSizeHelper.menuFont);
comp.setFont(GUISizeHelper.menuFont);
if (comp instanceof JMenu) {
comp.setFont(FontSizeHelper.menuFont);
comp.setFont(GUISizeHelper.menuFont);
for (Component subComp : ((JMenu) comp).getMenuComponents()) {
subComp.setFont(FontSizeHelper.menuFont);
subComp.setFont(GUISizeHelper.menuFont);
}
}
}

View file

@ -56,7 +56,7 @@ import org.mage.plugins.card.images.ImageCache;
*/
public class MageActionCallback implements ActionCallback {
private static final Logger logger = Logger.getLogger(ActionCallback.class);
private static final Logger LOGGER = Logger.getLogger(ActionCallback.class);
public static final int GAP_X = 5;
public static final double COMPARE_GAP_X = 30;
@ -88,7 +88,7 @@ public class MageActionCallback implements ActionCallback {
private static final ScheduledExecutorService timeoutExecutor = Executors.newScheduledThreadPool(1);
private ScheduledFuture<?> hideTimeout;
private CardPanel prevCard;
private CardPanel prevCardPanel;
private boolean startedDragging;
private boolean isDragging;
private Point initialCardPos;
@ -207,7 +207,7 @@ public class MageActionCallback implements ActionCallback {
);
} catch (InterruptedException e) {
logger.warn(e.getMessage());
LOGGER.warn(e.getMessage());
}
}
});
@ -219,11 +219,11 @@ public class MageActionCallback implements ActionCallback {
// for some reason sometime mouseRelease happens before numerous Mouse_Dragged events
// that results in not finished dragging
clearDragging(this.prevCard);
clearDragging(this.prevCardPanel);
isDragging = false;
startedDragging = false;
prevCard = null;
prevCardPanel = null;
cardPanels.clear();
Point mouse = new Point(e.getX(), e.getY());
SwingUtilities.convertPointToScreen(mouse, data.component);
@ -266,7 +266,7 @@ public class MageActionCallback implements ActionCallback {
}
private void clearDragging(CardPanel card) {
if (this.startedDragging && prevCard != null && card != null) {
if (this.startedDragging && prevCardPanel != null && card != null) {
for (Component component : card.getCardArea().getComponents()) {
if (component instanceof CardPanel) {
if (cardPanels.contains((CardPanel) component)) {
@ -278,7 +278,7 @@ public class MageActionCallback implements ActionCallback {
sort(card, card.getCardArea(), true);
cardPanels.clear();
}
prevCard = null;
prevCardPanel = null;
}
@Override
@ -288,8 +288,8 @@ public class MageActionCallback implements ActionCallback {
@Override
public void mouseDragged(MouseEvent e, TransferData transferData) {
CardPanel card = ((CardPanel) transferData.component);
if (card.getZone() == null || !card.getZone().equalsIgnoreCase("hand")) {
CardPanel cardPanel = ((CardPanel) transferData.component);
if (cardPanel.getZone() == null || !cardPanel.getZone().equalsIgnoreCase("hand")) {
// drag'n'drop is allowed for HAND zone only
return;
}
@ -298,19 +298,19 @@ public class MageActionCallback implements ActionCallback {
return;
}
isDragging = true;
prevCard = card;
Point p = card.getCardLocation();
prevCardPanel = cardPanel;
Point cardPanelLocationOld = cardPanel.getLocation();
Point mouse = new Point(e.getX(), e.getY());
SwingUtilities.convertPointToScreen(mouse, transferData.component);
int xOffset = card.getXOffset(card.getCardWidth());
int xOffset = cardPanel.getXOffset(cardPanel.getCardWidth());
int newX = Math.max(initialCardPos.x + (int) (mouse.getX() - initialMousePos.x) - xOffset, 0);
card.setCardBounds(
cardPanel.setCardBounds(
newX,
p.y,
card.getCardWidth(),
card.getCardHeight());
card.getCardArea().setComponentZOrder(card, 0);
sort(card, card.getCardArea(), false);
cardPanelLocationOld.y + cardPanel.getCardYOffset(),
cardPanel.getCardWidth(),
cardPanel.getCardHeight());
cardPanel.getCardArea().setComponentZOrder(cardPanel, 0);
sort(cardPanel, cardPanel.getCardArea(), false);
if (!this.startedDragging) {
this.startedDragging = true;
@ -336,11 +336,9 @@ public class MageActionCallback implements ActionCallback {
component.setLocation(component.getLocation().x, component.getLocation().y + GO_DOWN_ON_DRAG_Y_OFFSET);
}
cardPanels.add((CardPanel) component);
} else {
if (!startedDragging) {
} else if (!startedDragging) {
component.setLocation(component.getLocation().x, component.getLocation().y - GO_UP_ON_DRAG_Y_OFFSET);
}
}
cards.add((CardPanel) component);
}
}
@ -430,7 +428,7 @@ public class MageActionCallback implements ActionCallback {
Component popupContainer = MageFrame.getUI().getComponent(MageComponents.POPUP_CONTAINER);
popupContainer.setVisible(false);
} catch (Exception e2) {
logger.warn("Can't set tooltip to visible = false", e2);
LOGGER.warn("Can't set tooltip to visible = false", e2);
}
}
@ -462,11 +460,9 @@ public class MageActionCallback implements ActionCallback {
if (notches > 0) {
hideEnlargedCard();
}
} else {
if (notches < 0) {
} else if (notches < 0) {
hideEnlargedCard();
}
}
return;
}
if (notches < 0) {
@ -515,7 +511,7 @@ public class MageActionCallback implements ActionCallback {
cardPreviewContainer.setVisible(false);
} catch (InterruptedException e) {
logger.warn("Can't hide enlarged card", e);
LOGGER.warn("Can't hide enlarged card", e);
}
}
}
@ -587,11 +583,11 @@ public class MageActionCallback implements ActionCallback {
displayCardInfo(mageCard, image, bigCard);
} else {
logger.warn("No Card preview Pane in Mage Frame defined. Card: " + cardView.getName());
LOGGER.warn("No Card preview Pane in Mage Frame defined. Card: " + cardView.getName());
}
} catch (Exception e) {
logger.warn("Problem dring display of enlarged card", e);
LOGGER.warn("Problem dring display of enlarged card", e);
}
}
});

View file

@ -72,19 +72,20 @@
<Property name="cursor" type="java.awt.Cursor" editor="org.netbeans.modules.form.editors2.CursorEditor">
<Color id="Standardcursor"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="gridColor" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="ff" red="ff" type="rgb"/>
</Property>
<Property name="opaque" type="boolean" value="false"/>
<Property name="requestFocusEnabled" type="boolean" value="false"/>
<Property name="rowSelectionAllowed" type="boolean" value="false"/>
<Property name="showHorizontalLines" type="boolean" value="false"/>
<Property name="showVerticalLines" type="boolean" value="false"/>
<Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor">
<TableHeader reorderingAllowed="true" resizingAllowed="true"/>
</Property>
<Property name="updateSelectionOnSort" type="boolean" value="false"/>
<Property name="verifyInputWhenFocusTarget" type="boolean" value="false"/>
</Properties>
<AccessibilityProperties>
<Property name="AccessibleContext.accessibleDescription" type="java.lang.String" value=""/>
</AccessibilityProperties>
</Component>
</SubComponents>
</Container>

View file

@ -35,7 +35,6 @@ package mage.client.table;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionAdapter;
import java.util.ArrayList;
@ -56,7 +55,7 @@ import mage.client.chat.ChatPanelBasic;
import static mage.client.chat.ChatPanelBasic.CHAT_ALPHA;
import static mage.client.dialog.PreferencesDialog.KEY_USERS_COLUMNS_ORDER;
import static mage.client.dialog.PreferencesDialog.KEY_USERS_COLUMNS_WIDTH;
import mage.client.util.FontSizeHelper;
import mage.client.util.GUISizeHelper;
import mage.client.util.MageTableRowSorter;
import mage.client.util.gui.TableUtil;
import mage.client.util.gui.countryBox.CountryCellRenderer;
@ -123,16 +122,17 @@ public class PlayersChatPanel extends javax.swing.JPanel {
}
private void setGUISize() {
Font font = FontSizeHelper.getTableFont();
jTablePlayers.getTableHeader().setFont(font);
jTablePlayers.getTableHeader().setPreferredSize(new Dimension((int) jTablePlayers.getTableHeader().getPreferredSize().getWidth(), FontSizeHelper.tableHeaderHeight));
jScrollPanePlayers.getVerticalScrollBar().setPreferredSize(new Dimension(FontSizeHelper.scrollBarSize, 0));
jScrollPanePlayers.getHorizontalScrollBar().setPreferredSize(new Dimension(0, FontSizeHelper.scrollBarSize));
jScrollPaneSystem.getVerticalScrollBar().setPreferredSize(new Dimension(FontSizeHelper.scrollBarSize, 0));
jScrollPaneSystem.getHorizontalScrollBar().setPreferredSize(new Dimension(0, FontSizeHelper.scrollBarSize));
jTablePlayers.getTableHeader().setFont(GUISizeHelper.tableFont);
jTablePlayers.getTableHeader().setPreferredSize(new Dimension((int) jTablePlayers.getTableHeader().getPreferredSize().getWidth(), GUISizeHelper.tableHeaderHeight));
jTablePlayers.setFont(GUISizeHelper.tableFont);
jTablePlayers.setRowHeight(GUISizeHelper.getTableRowHeight());
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(FontSizeHelper.getTabFont());
jSplitPane1.setDividerSize(FontSizeHelper.dividerBarSize);
jTabbedPaneText.setFont(GUISizeHelper.getTabFont());
jSplitPane1.setDividerSize(GUISizeHelper.dividerBarSize);
}
public void setSplitDividerLocation(int location) {
@ -291,7 +291,6 @@ public class PlayersChatPanel extends javax.swing.JPanel {
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
java.awt.GridBagConstraints gridBagConstraints;
jSpinner1 = new javax.swing.JSpinner();
jSplitPane1 = new javax.swing.JSplitPane();
@ -313,14 +312,15 @@ public class PlayersChatPanel extends javax.swing.JPanel {
jTablePlayers.setToolTipText("Connected players");
jTablePlayers.setAutoscrolls(false);
jTablePlayers.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
jTablePlayers.setFocusable(false);
jTablePlayers.setGridColor(new java.awt.Color(255, 255, 255));
jTablePlayers.setOpaque(false);
jTablePlayers.setRequestFocusEnabled(false);
jTablePlayers.setRowSelectionAllowed(false);
jTablePlayers.setShowHorizontalLines(false);
jTablePlayers.setShowVerticalLines(false);
jTablePlayers.setUpdateSelectionOnSort(false);
jTablePlayers.setVerifyInputWhenFocusTarget(false);
jScrollPanePlayers.setViewportView(jTablePlayers);
jTablePlayers.getAccessibleContext().setAccessibleDescription("");
jSplitPane1.setTopComponent(jScrollPanePlayers);
@ -404,7 +404,7 @@ public class PlayersChatPanel extends javax.swing.JPanel {
if (col != null) {
MageFrame.getInstance().getBalloonTip().setAttachedComponent(header);
JLabel content = new JLabel(tips.get(table.convertColumnIndexToModel(vColIndex)));
content.setFont(FontSizeHelper.tooltipFont);
content.setFont(GUISizeHelper.tooltipFont);
MageFrame.getInstance().getBalloonTip().setContents(content);
ToolTipUtils.balloonToToolTip(MageFrame.getInstance().getBalloonTip(), 600, 10000);
} else {

View file

@ -36,7 +36,6 @@ package mage.client.table;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.HeadlessException;
import java.awt.Point;
import java.awt.Rectangle;
@ -81,7 +80,7 @@ import static mage.client.dialog.PreferencesDialog.KEY_TABLES_COLUMNS_ORDER;
import static mage.client.dialog.PreferencesDialog.KEY_TABLES_COLUMNS_WIDTH;
import mage.client.dialog.TableWaitingDialog;
import mage.client.util.ButtonColumn;
import mage.client.util.FontSizeHelper;
import mage.client.util.GUISizeHelper;
import mage.client.util.MageTableRowSorter;
import mage.client.util.gui.GuiDisplayUtil;
import mage.client.util.gui.TableUtil;
@ -286,15 +285,20 @@ public class TablesPanel extends javax.swing.JPanel {
}
private void setGUISize() {
Font font = FontSizeHelper.getTableFont();
tableTables.getTableHeader().setFont(font);
tableTables.getTableHeader().setPreferredSize(new Dimension(FontSizeHelper.tableHeaderHeight, FontSizeHelper.tableHeaderHeight));
tableCompleted.getTableHeader().setFont(font);
tableCompleted.getTableHeader().setPreferredSize(new Dimension(FontSizeHelper.tableHeaderHeight, FontSizeHelper.tableHeaderHeight));
jSplitPane1.setDividerSize(FontSizeHelper.dividerBarSize);
jSplitPane2.setDividerSize(FontSizeHelper.dividerBarSize);
jScrollPane1.getVerticalScrollBar().setPreferredSize(new Dimension(FontSizeHelper.scrollBarSize, 0));
jScrollPane1.getHorizontalScrollBar().setPreferredSize(new Dimension(0, FontSizeHelper.scrollBarSize));
tableTables.getTableHeader().setFont(GUISizeHelper.tableFont);
tableTables.getTableHeader().setPreferredSize(new Dimension(GUISizeHelper.tableHeaderHeight, GUISizeHelper.tableHeaderHeight));
tableTables.setFont(GUISizeHelper.tableFont);
tableTables.setRowHeight(GUISizeHelper.getTableRowHeight());
tableCompleted.getTableHeader().setFont(GUISizeHelper.tableFont);
tableCompleted.getTableHeader().setPreferredSize(new Dimension(GUISizeHelper.tableHeaderHeight, GUISizeHelper.tableHeaderHeight));
tableCompleted.setFont(GUISizeHelper.tableFont);
tableCompleted.setRowHeight(GUISizeHelper.getTableRowHeight());
jSplitPane1.setDividerSize(GUISizeHelper.dividerBarSize);
jSplitPane2.setDividerSize(GUISizeHelper.dividerBarSize);
jScrollPane1.getVerticalScrollBar().setPreferredSize(new Dimension(GUISizeHelper.scrollBarSize, 0));
jScrollPane1.getHorizontalScrollBar().setPreferredSize(new Dimension(0, GUISizeHelper.scrollBarSize));
}
private void saveDividerLocations() {

View file

@ -35,7 +35,6 @@ package mage.client.tournament;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.text.DateFormat;
@ -58,8 +57,8 @@ import static mage.client.dialog.PreferencesDialog.KEY_TOURNAMENT_MATCH_COLUMNS_
import static mage.client.dialog.PreferencesDialog.KEY_TOURNAMENT_PLAYER_COLUMNS_ORDER;
import static mage.client.dialog.PreferencesDialog.KEY_TOURNAMENT_PLAYER_COLUMNS_WIDTH;
import mage.client.util.ButtonColumn;
import mage.client.util.FontSizeHelper;
import mage.client.util.Format;
import mage.client.util.GUISizeHelper;
import mage.client.util.gui.TableUtil;
import mage.client.util.gui.countryBox.CountryCellRenderer;
import mage.remote.Session;
@ -152,17 +151,22 @@ public class TournamentPanel extends javax.swing.JPanel {
}
private void setGUISize() {
Font font = FontSizeHelper.getTableFont();
tablePlayers.getTableHeader().setFont(font);
tablePlayers.getTableHeader().setPreferredSize(new Dimension(FontSizeHelper.tableHeaderHeight, FontSizeHelper.tableHeaderHeight));
tableMatches.getTableHeader().setFont(font);
tableMatches.getTableHeader().setPreferredSize(new Dimension(FontSizeHelper.tableHeaderHeight, FontSizeHelper.tableHeaderHeight));
jSplitPane1.setDividerSize(FontSizeHelper.dividerBarSize);
jSplitPane2.setDividerSize(FontSizeHelper.dividerBarSize);
jScrollPane1.getVerticalScrollBar().setPreferredSize(new Dimension(FontSizeHelper.scrollBarSize, 0));
jScrollPane1.getHorizontalScrollBar().setPreferredSize(new Dimension(0, FontSizeHelper.scrollBarSize));
jScrollPane2.getVerticalScrollBar().setPreferredSize(new Dimension(FontSizeHelper.scrollBarSize, 0));
jScrollPane2.getHorizontalScrollBar().setPreferredSize(new Dimension(0, FontSizeHelper.scrollBarSize));
tablePlayers.getTableHeader().setFont(GUISizeHelper.tableFont);
tablePlayers.getTableHeader().setPreferredSize(new Dimension(GUISizeHelper.tableHeaderHeight, GUISizeHelper.tableHeaderHeight));
tablePlayers.setFont(GUISizeHelper.tableFont);
tablePlayers.setRowHeight(GUISizeHelper.getTableRowHeight());
tableMatches.getTableHeader().setFont(GUISizeHelper.tableFont);
tableMatches.getTableHeader().setPreferredSize(new Dimension(GUISizeHelper.tableHeaderHeight, GUISizeHelper.tableHeaderHeight));
tableMatches.setFont(GUISizeHelper.tableFont);
tableMatches.setRowHeight(GUISizeHelper.getTableRowHeight());
jSplitPane1.setDividerSize(GUISizeHelper.dividerBarSize);
jSplitPane2.setDividerSize(GUISizeHelper.dividerBarSize);
jScrollPane1.getVerticalScrollBar().setPreferredSize(new Dimension(GUISizeHelper.scrollBarSize, 0));
jScrollPane1.getHorizontalScrollBar().setPreferredSize(new Dimension(0, GUISizeHelper.scrollBarSize));
jScrollPane2.getVerticalScrollBar().setPreferredSize(new Dimension(GUISizeHelper.scrollBarSize, 0));
jScrollPane2.getHorizontalScrollBar().setPreferredSize(new Dimension(0, GUISizeHelper.scrollBarSize));
}
private void saveDividerLocations() {

View file

@ -1,101 +0,0 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package mage.client.util;
import java.awt.Font;
import mage.client.MageFrame;
import mage.client.dialog.PreferencesDialog;
/**
*
* @author LevelX2
*/
public class FontSizeHelper {
public static String basicSymbolSize = "small";
public static int symbolCardSize = 15;
public static int symbolTooltipSize = 15;
public static int symbolPaySize = 15;
public static int symbolEditorSize = 15;
public static int tableHeaderHeight = 24;
public static int tableRowHeight = 20;
public static int dividerBarSize;
public static int scrollBarSize;
public static Font tooltipFont = new java.awt.Font("Arial", 0, 12);
public static Font menuFont = new java.awt.Font("Arial", 0, 12);
public static Font gameDialogAreaFontBig = new java.awt.Font("Arial", 0, 12);
public static Font gameDialogAreaFontSmall = new java.awt.Font("Arial", 0, 12);
public static Font getChatFont() {
int fontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_FONT_SIZE, 14);
return new java.awt.Font("Arial", 0, fontSize);
}
public static Font getTableFont() {
int fontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_FONT_SIZE, 14);
return new java.awt.Font("Arial", 0, fontSize);
}
public static Font getToolbarFont() {
int fontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_FONT_SIZE, 14);
return new java.awt.Font("Arial", 0, fontSize);
}
public static int getTableRowHeight() {
int fontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_FONT_SIZE, 14);
return fontSize + 6;
}
public static Font getTabFont() {
int fontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_FONT_SIZE, 14);
return new java.awt.Font("Arial", 0, fontSize);
}
public static void changeGUISize() {
calculateGUISizes();
MageFrame.getInstance().changeGUISize();
}
public static void calculateGUISizes() {
// Set basic symbol size
int fontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_FONT_SIZE, 14);
if (fontSize < 25) {
basicSymbolSize = "small";
} else if (fontSize < 45) {
basicSymbolSize = "medium";
} else {
basicSymbolSize = "large";
}
if (fontSize > 15) {
symbolTooltipSize = fontSize - 5;
symbolEditorSize = fontSize - 5;
symbolPaySize = fontSize - 5;
symbolCardSize = 15;
dividerBarSize = 10 + (fontSize / 4);
scrollBarSize = 14 + (fontSize / 4);
} else {
symbolTooltipSize = fontSize;
symbolEditorSize = fontSize;
symbolPaySize = fontSize;
symbolCardSize = 15;
dividerBarSize = 10;
scrollBarSize = 14;
}
tooltipFont = new java.awt.Font("Arial", 0, fontSize - 2);
// used for popup menus
menuFont = new java.awt.Font("Arial", 0, fontSize);
tableRowHeight = fontSize + 4;
tableHeaderHeight = fontSize + 10;
}
}

View file

@ -0,0 +1,117 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package mage.client.util;
import java.awt.Dimension;
import java.awt.Font;
import mage.client.MageFrame;
import mage.client.dialog.PreferencesDialog;
/**
*
* @author LevelX2
*/
public class GUISizeHelper {
// relate the native image card size to a value of the size scale
final static int CARD_IMAGE_WIDTH = 312;
final static int CARD_IMAGE_HEIGHT = 445;
final static int CARD_IMAG_VALUE = 42;
public static String basicSymbolSize = "small";
public static int symbolCardSize = 15;
public static int symbolTooltipSize = 15;
public static int symbolPaySize = 15;
public static int symbolEditorSize = 15;
public static int tableHeaderHeight = 24;
public static int tableRowHeight = 20;
public static int dividerBarSize;
public static int scrollBarSize;
public static int flagHeight;
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 tooltipFont = new java.awt.Font("Arial", 0, 12);
public static Font menuFont = new java.awt.Font("Arial", 0, 12);
public static Font gameDialogAreaFontBig = new java.awt.Font("Arial", 0, 12);
public static Font gameDialogAreaFontSmall = new java.awt.Font("Arial", 0, 12);
public static Dimension handCardDimension;
public static Font getToolbarFont() {
int fontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_TABLE_FONT_SIZE, 14);
return new java.awt.Font("Arial", 0, fontSize);
}
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 void changeGUISize() {
calculateGUISizes();
MageFrame.getInstance().changeGUISize();
}
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;
tooltipFont = new java.awt.Font("Arial", 0, tableFontSize - 2);
// used for popup menus
menuFont = new java.awt.Font("Arial", 0, tableFontSize);
int chatFontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_CHAT_FONT_SIZE, 14);
chatFont = new java.awt.Font("Arial", 0, chatFontSize);
// Set basic symbol size
if (tableFontSize > 24) {
flagHeight = tableFontSize - 4;
} else {
flagHeight = 11;
}
if (tableFontSize < 25) {
basicSymbolSize = "small";
} else if (tableFontSize < 45) {
basicSymbolSize = "medium";
} else {
basicSymbolSize = "large";
}
if (tableFontSize > 15) {
symbolTooltipSize = tableFontSize - 5;
symbolEditorSize = tableFontSize - 5;
symbolPaySize = tableFontSize - 5;
symbolCardSize = 15;
dividerBarSize = 10 + (tableFontSize / 4);
scrollBarSize = 14 + (tableFontSize / 4);
} else {
symbolTooltipSize = tableFontSize;
symbolEditorSize = tableFontSize;
symbolPaySize = tableFontSize;
symbolCardSize = 15;
dividerBarSize = 10;
scrollBarSize = 14;
}
int handCardSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_CARD_HAND_SIZE, 14);
int width = CARD_IMAGE_WIDTH * handCardSize / 42;
int height = CARD_IMAGE_HEIGHT * handCardSize / 42;
handCardDimension = new Dimension(width, height);
}
}

View file

@ -24,8 +24,7 @@
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
*/
package mage.client.util;
import com.mortennobel.imagescaling.ResampleOp;
@ -37,6 +36,7 @@ import java.awt.Image;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.Transparency;
import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
import java.awt.image.ImageObserver;
import java.awt.image.MemoryImageSource;
@ -58,6 +58,7 @@ import org.mage.card.arcane.UI;
* @author BetaSteward_at_googlemail.com
*/
public class ImageHelper {
protected static HashMap<String, BufferedImage> images = new HashMap<>();
protected static HashMap<String, BufferedImage> backgrounds = new HashMap<>();
@ -73,7 +74,8 @@ public class ImageHelper {
*
* @param ref - image name
* @param height - height after scaling
* @return a scaled image that preserves the original aspect ratio, with a specified height
* @return a scaled image that preserves the original aspect ratio, with a
* specified height
*/
public static BufferedImage loadImage(String ref, int height) {
BufferedImage image = loadImage(ref);
@ -104,7 +106,6 @@ public class ImageHelper {
return background;
}
public static BufferedImage scaleImage(BufferedImage image, int width, int height) {
BufferedImage scaledImage = image;
int w = image.getWidth();
@ -127,7 +128,7 @@ public class ImageHelper {
}
public static BufferedImage scaleImage(BufferedImage image, int height) {
double ratio = height / (double)image.getHeight();
double ratio = height / (double) image.getHeight();
int width = (int) (image.getWidth() * ratio);
return scaleImage(image, width, height);
}
@ -138,13 +139,12 @@ public class ImageHelper {
PixelGrabber grabber = new PixelGrabber(image, 0, 0, dimensions.frameWidth, dimensions.frameHeight, buffer, 0, dimensions.frameWidth);
try {
grabber.grabPixels();
}
catch(InterruptedException e) {
} catch (InterruptedException e) {
e.printStackTrace();
}
for(int y = 0; y < dimensions.frameHeight; y++) {
for(int x = 0; x < dimensions.frameWidth; x++) {
rotate[((dimensions.frameWidth - x - 1) *dimensions.frameHeight)+y] = buffer[(y*dimensions.frameWidth)+x];
for (int y = 0; y < dimensions.frameHeight; y++) {
for (int x = 0; x < dimensions.frameWidth; x++) {
rotate[((dimensions.frameWidth - x - 1) * dimensions.frameHeight) + y] = buffer[(y * dimensions.frameWidth) + x];
}
}
@ -155,7 +155,7 @@ public class ImageHelper {
public static BufferedImage rotate(BufferedImage image, double angle) {
double sin = Math.abs(Math.sin(angle)), cos = Math.abs(Math.cos(angle));
int w = image.getWidth(), h = image.getHeight();
int neww = (int)Math.floor(w*cos+h*sin), newh = (int)Math.floor(h*cos+w*sin);
int neww = (int) Math.floor(w * cos + h * sin), newh = (int) Math.floor(h * cos + w * sin);
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice gs = ge.getDefaultScreenDevice();
@ -163,8 +163,8 @@ public class ImageHelper {
BufferedImage result = gc.createCompatibleImage(neww, newh, Transparency.TRANSLUCENT);
Graphics2D g = result.createGraphics();
g.translate((neww-w)/2, (newh-h)/2);
g.rotate(angle, w/2, h/2);
g.translate((neww - w) / 2, (newh - h) / 2);
g.rotate(angle, w / 2, h / 2);
g.drawRenderedImage(image, null);
g.dispose();
return result;
@ -184,6 +184,7 @@ public class ImageHelper {
/**
* Returns an image scaled to the size appropriate for the card picture
* panel
*
* @param original
* @param width
* @param height
@ -196,8 +197,8 @@ public class ImageHelper {
}
/**
* Returns an image scaled to fit width
* panel
* Returns an image scaled to fit width panel
*
* @param original
* @param width
* @return
@ -212,8 +213,32 @@ public class ImageHelper {
}
}
/**
* scale image
*
* @param sbi image to scale
* @param imageType type of image
* @param dWidth width of destination image
* @param dHeight height of destination image
* @return scaled image
*/
public static BufferedImage scale(BufferedImage sbi, int imageType, int dWidth, int dHeight) {
BufferedImage dbi = null;
if (sbi != null) {
double fWidth = dWidth / sbi.getWidth();
double fHeight = dHeight / sbi.getHeight();
dbi = new BufferedImage(dWidth, dHeight, imageType);
Graphics2D g = dbi.createGraphics();
AffineTransform at = AffineTransform.getScaleInstance(fWidth, fHeight);
g.drawRenderedImage(sbi, at);
g.dispose();
}
return dbi;
}
/**
* Returns an image scaled to the needed size
*
* @param original
* @param sizeNeed
* @return
@ -226,6 +251,7 @@ public class ImageHelper {
/**
* Get image using relative path in resources.
*
* @param path
* @return
*/

View file

@ -5,10 +5,13 @@
*/
package mage.client.util.gui.countryBox;
import java.net.URL;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.util.HashMap;
import java.util.Map;
import javax.swing.ImageIcon;
import mage.client.util.GUISizeHelper;
import mage.client.util.ImageHelper;
import org.apache.log4j.Logger;
/**
@ -17,33 +20,44 @@ import org.apache.log4j.Logger;
*/
public class CountryUtil {
private static final Logger logger = Logger.getLogger(CountryUtil.class);
private static final Map<String, ImageIcon> flagIconCache = new HashMap<>();
private static final Map<String, String> countryMap = new HashMap<>();
private static final Logger LOGGER = Logger.getLogger(CountryUtil.class);
private static final Map<String, ImageIcon> FLAG_ICON_CACHE = new HashMap<>();
private static final Map<String, String> COUNTRY_MAP = new HashMap<>();
public static ImageIcon getCountryFlagIcon(String countryCode) {
ImageIcon flagIcon = flagIconCache.get(countryCode);
ImageIcon flagIcon = FLAG_ICON_CACHE.get(countryCode);
if (flagIcon == null) {
URL url = CountryUtil.class.getResource("/flags/" + countryCode + (countryCode.endsWith(".png") ? "" : ".png"));
if (url != null) {
flagIcon = new javax.swing.ImageIcon(url);
// URL url = CountryUtil.class.getResource("/flags/" + countryCode + (countryCode.endsWith(".png") ? "" : ".png"));
Image flagImage = ImageHelper.getImageFromResources("/flags/" + countryCode + (countryCode.endsWith(".png") ? "" : ".png"));
if (flagImage != null) {
if (GUISizeHelper.flagHeight > 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);
flagIcon = new ImageIcon(resized);
} else {
flagIcon = new ImageIcon(flagImage);
}
}
if (flagIcon == null || flagIcon.getImage() == null) {
logger.warn("Country flag resource not found: " + countryCode);
flagIconCache.put(countryCode, flagIcon);
LOGGER.warn("Country flag resource not found: " + countryCode);
FLAG_ICON_CACHE.put(countryCode, flagIcon);
} else {
flagIconCache.put(countryCode, flagIcon);
FLAG_ICON_CACHE.put(countryCode, flagIcon);
}
}
return flagIcon;
}
public static void changeGUISize() {
FLAG_ICON_CACHE.clear();
}
public static String getCountryName(String countryCode) {
if (countryMap.isEmpty()) {
if (COUNTRY_MAP.isEmpty()) {
for (int i = 0; i <= CountryComboBox.countryList.length - 1; i++) {
countryMap.put(CountryComboBox.countryList[i][1], CountryComboBox.countryList[i][0]);
COUNTRY_MAP.put(CountryComboBox.countryList[i][1], CountryComboBox.countryList[i][0]);
}
}
return countryMap.get(countryCode);
return COUNTRY_MAP.get(countryCode);
}
}

View file

@ -67,7 +67,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
private static final long serialVersionUID = -3272134219262184410L;
private static final Logger logger = Logger.getLogger(CardPanel.class);
private static final Logger LOGGER = Logger.getLogger(CardPanel.class);
private static final int WIDTH_LIMIT = 90; // card width limit to create smaller counter
public static final double TAPPED_ANGLE = Math.PI / 2;
@ -161,13 +161,14 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
this.gameCard = newGameCard;
this.callback = callback;
this.gameId = gameId;
this.setCardBounds(0, 0, dimension.width, dimension.height);
this.isPermanent = this.gameCard instanceof PermanentView;
this.isPermanent = this.gameCard instanceof PermanentView;
if (isPermanent) {
this.hasSickness = ((PermanentView) this.gameCard).hasSummoningSickness();
}
this.setCardBounds(0, 0, dimension.width, dimension.height);
//for container debug (don't remove)
//setBorder(BorderFactory.createLineBorder(Color.green));
if (this.gameCard.canTransform()) {
@ -271,9 +272,11 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
addComponentListener(this);
displayTitleAnyway = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_SHOW_CARD_NAMES, "true").equals("true");
titleText = new GlowText();
setText(gameCard);
titleText.setFont(getFont().deriveFont(Font.BOLD, 13f));
int fontSize = (int) dimension.getHeight() / 11;
titleText.setFont(getFont().deriveFont(Font.BOLD, fontSize));
titleText.setForeground(Color.white);
titleText.setGlow(Color.black, TEXT_GLOW_SIZE, TEXT_GLOW_INTENSITY);
titleText.setWrap(true);
@ -285,7 +288,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
} else if (CardUtil.isPlaneswalker(gameCard)) {
ptText.setText(gameCard.getLoyalty());
}
ptText.setFont(getFont().deriveFont(Font.BOLD, 13f));
ptText.setFont(getFont().deriveFont(Font.BOLD, fontSize));
ptText.setForeground(Color.white);
ptText.setGlow(Color.black, TEXT_GLOW_SIZE, TEXT_GLOW_INTENSITY);
add(ptText);
@ -330,9 +333,9 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
}
setText(gameCard);
} catch (Exception e) {
logger.fatal("Problem during image animation", e);
LOGGER.fatal("Problem during image animation", e);
} catch (Error err) {
logger.error("Problem during image animation", err);
LOGGER.error("Problem during image animation", err);
}
}
});
@ -613,6 +616,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
public final void setCardBounds(int x, int y, int cardWidth, int cardHeight) {
this.cardWidth = cardWidth;
this.cardHeight = cardHeight;
if (this.isPermanent) {
int rotCenterX = Math.round(cardWidth / 2f);
int rotCenterY = cardHeight - rotCenterX;
int rotCenterToTopCorner = Math.round(cardWidth * CardPanel.ROT_CENTER_TO_TOP_CORNER);
@ -624,21 +628,37 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
int width = -xOffset + rotCenterX + rotCenterToTopCorner;
int height = -yOffset + rotCenterY + rotCenterToBottomCorner;
setBounds(x + xOffset, y + yOffset, width, height);
} else {
cardXOffset = 5;
cardYOffset = 5;
int width = cardXOffset * 2 + cardWidth;
int height = cardYOffset * 2 + cardHeight;
setBounds(x - cardXOffset, y - cardYOffset, width, height);
}
}
public int getXOffset(int cardWidth) {
if (this.isPermanent) {
int rotCenterX = Math.round(cardWidth / 2f);
int rotCenterToBottomCorner = Math.round(cardWidth * CardPanel.ROT_CENTER_TO_BOTTOM_CORNER);
int xOffset = rotCenterX - rotCenterToBottomCorner;
return xOffset;
} else {
return cardXOffset;
}
}
public int getYOffset(int cardWidth, int cardHeight) {
if (this.isPermanent) {
int rotCenterX = Math.round(cardWidth / 2f);
int rotCenterY = cardHeight - rotCenterX;
int rotCenterToTopCorner = Math.round(cardWidth * CardPanel.ROT_CENTER_TO_TOP_CORNER);
int yOffset = rotCenterY - rotCenterToTopCorner;
return yOffset;
} else {
return cardYOffset;
}
}
public int getCardX() {
@ -728,14 +748,12 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
} else {
return ImageCache.getManifestImage();
}
} else {
if (this.gameCard instanceof StackAbilityView) {
} else if (this.gameCard instanceof StackAbilityView) {
return ImageCache.getMorphImage();
} else {
return ImageCache.loadImage(new TFile(DirectLinksForDownload.outDir + File.separator + DirectLinksForDownload.cardbackFilename));
}
}
}
@Override
public List<MagePermanent> getLinks() {
@ -1145,7 +1163,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
dayNightButton.setIcon(new ImageIcon(night));
}
if (this.gameCard.getSecondCardFace() == null) {
logger.error("no second side for card to transform!");
LOGGER.error("no second side for card to transform!");
return;
}
if (!isPermanent) { // use only for custom transformation (when pressing day-night button)

View file

@ -14,7 +14,7 @@ import java.util.regex.Pattern;
import javax.imageio.ImageIO;
import mage.cards.repository.ExpansionRepository;
import mage.client.dialog.PreferencesDialog;
import mage.client.util.FontSizeHelper;
import mage.client.util.GUISizeHelper;
import mage.client.util.ImageHelper;
import mage.client.util.gui.BufferedImageBuilder;
import org.apache.log4j.Logger;
@ -40,7 +40,7 @@ public class ManaSymbols {
for (String symbol : symbols) {
String resourcePath = Constants.RESOURCE_PATH_MANA_SMALL;
switch (FontSizeHelper.basicSymbolSize) {
switch (GUISizeHelper.basicSymbolSize) {
case "medium":
resourcePath = Constants.RESOURCE_PATH_MANA_SMALL;
break;
@ -50,11 +50,11 @@ public class ManaSymbols {
}
File file = new File(getSymbolsPath() + resourcePath + "/" + symbol + ".jpg");
try {
if (FontSizeHelper.symbolPaySize != 15) {
if (GUISizeHelper.symbolPaySize != 15) {
BufferedImage notResized = ImageIO.read(file);
MANA_IMAGES.put(symbol, notResized);
} else {
Rectangle r = new Rectangle(FontSizeHelper.symbolPaySize, FontSizeHelper.symbolPaySize);
Rectangle r = new Rectangle(GUISizeHelper.symbolPaySize, GUISizeHelper.symbolPaySize);
Image image = UI.getImageIcon(file.getAbsolutePath()).getImage();
BufferedImage resized = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(image, BufferedImage.TYPE_INT_ARGB), r);
MANA_IMAGES.put(symbol, resized);
@ -224,23 +224,23 @@ public class ManaSymbols {
int symbolSize;
switch (type) {
case TOOLTIP:
symbolSize = FontSizeHelper.symbolTooltipSize;
symbolSize = GUISizeHelper.symbolTooltipSize;
break;
case CARD:
symbolSize = FontSizeHelper.symbolCardSize;
symbolSize = GUISizeHelper.symbolCardSize;
break;
case PAY:
symbolSize = FontSizeHelper.symbolPaySize;
symbolSize = GUISizeHelper.symbolPaySize;
break;
case EDITOR:
symbolSize = FontSizeHelper.symbolEditorSize;
symbolSize = GUISizeHelper.symbolEditorSize;
break;
default:
symbolSize = 11;
break;
}
replaced = REPLACE_SYMBOLS_PATTERN.matcher(value).replaceAll("<img src='file:" + getSymbolsPath(true)
+ "/symbols/" + FontSizeHelper.basicSymbolSize + "/$1$2.jpg' alt='$1$2' width="
+ "/symbols/" + GUISizeHelper.basicSymbolSize + "/$1$2.jpg' alt='$1$2' width="
+ symbolSize + " height=" + symbolSize + ">");
}

View file

@ -97,9 +97,9 @@ public class CardPluginImpl implements CardPlugin {
}
@Override
public MagePermanent getMageCard(CardView permanent, Dimension dimension, UUID gameId, ActionCallback callback, boolean canBeFoil, boolean loadImage) {
CardPanel cardPanel = new CardPanel(permanent, gameId, loadImage, callback, false, dimension);
boolean implemented = permanent.getRarity() != null && !permanent.getRarity().equals(Rarity.NA);
public MagePermanent getMageCard(CardView cardView, Dimension dimension, UUID gameId, ActionCallback callback, boolean canBeFoil, boolean loadImage) {
CardPanel cardPanel = new CardPanel(cardView, gameId, loadImage, callback, false, dimension);
boolean implemented = cardView.getRarity() != null && !cardView.getRarity().equals(Rarity.NA);
cardPanel.setShowCastingCost(implemented);
return cardPanel;
}