mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 11:32:00 -08:00
Some more changes to GUI to better support high screen resolutions.
This commit is contained in:
parent
2ce5e00c6d
commit
706d319f81
25 changed files with 376 additions and 229 deletions
|
|
@ -101,6 +101,7 @@ import mage.client.dialog.ConnectDialog;
|
||||||
import mage.client.dialog.ErrorDialog;
|
import mage.client.dialog.ErrorDialog;
|
||||||
import mage.client.dialog.FeedbackDialog;
|
import mage.client.dialog.FeedbackDialog;
|
||||||
import mage.client.dialog.GameEndDialog;
|
import mage.client.dialog.GameEndDialog;
|
||||||
|
import mage.client.dialog.MageDialog;
|
||||||
import mage.client.dialog.PreferencesDialog;
|
import mage.client.dialog.PreferencesDialog;
|
||||||
import mage.client.dialog.TableWaitingDialog;
|
import mage.client.dialog.TableWaitingDialog;
|
||||||
import mage.client.dialog.UserRequestDialog;
|
import mage.client.dialog.UserRequestDialog;
|
||||||
|
|
@ -237,7 +238,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
||||||
try {
|
try {
|
||||||
UIManager.put("desktop", new Color(0, 0, 0, 0));
|
UIManager.put("desktop", new Color(0, 0, 0, 0));
|
||||||
UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
|
UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
|
||||||
FontSizeHelper.setGUISize();
|
FontSizeHelper.calculateGUISizes();
|
||||||
// Change default font and row size for JTables
|
// Change default font and row size for JTables
|
||||||
Font font = FontSizeHelper.getTableFont();
|
Font font = FontSizeHelper.getTableFont();
|
||||||
UIManager.put("Table.font", font);
|
UIManager.put("Table.font", font);
|
||||||
|
|
@ -1406,29 +1407,24 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
||||||
|
|
||||||
public void changeGUISize() {
|
public void changeGUISize() {
|
||||||
setGUISize();
|
setGUISize();
|
||||||
|
for (Component component : desktopPane.getComponents()) {
|
||||||
|
if (component instanceof MageDialog) {
|
||||||
|
((MageDialog) component).changeGUISize();
|
||||||
|
}
|
||||||
|
if (component instanceof MagePane) {
|
||||||
|
((MagePane) component).changeGUISize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Font font = FontSizeHelper.getChatFont();
|
||||||
|
for (ChatPanelBasic chatPanel : getChatPanels().values()) {
|
||||||
|
chatPanel.changeGUISize(font);
|
||||||
|
}
|
||||||
this.revalidate();
|
this.revalidate();
|
||||||
this.repaint();
|
this.repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setGUISize() {
|
private void setGUISize() {
|
||||||
Font font = FontSizeHelper.getToolbarFont();
|
Font font = FontSizeHelper.getToolbarFont();
|
||||||
// Tables
|
|
||||||
if (tablesPane != null) {
|
|
||||||
tablesPane.changeGUISize();
|
|
||||||
}
|
|
||||||
// Deck editor
|
|
||||||
JInternalFrame[] windows = desktopPane.getAllFramesInLayer(JLayeredPane.DEFAULT_LAYER);
|
|
||||||
for (JInternalFrame window : windows) {
|
|
||||||
if (window instanceof DeckEditorPane) {
|
|
||||||
((DeckEditorPane) window).getPanel().changeGUISize();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Tournament panels
|
|
||||||
for (Component component : desktopPane.getComponents()) {
|
|
||||||
if (component instanceof TournamentPane) {
|
|
||||||
((TournamentPane) component).changeGUISize();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mageToolbar.setFont(font);
|
mageToolbar.setFont(font);
|
||||||
int newHeight = font.getSize() + 6;
|
int newHeight = font.getSize() + 6;
|
||||||
Dimension mageToolbarDimension = mageToolbar.getPreferredSize();
|
Dimension mageToolbarDimension = mageToolbar.getPreferredSize();
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,6 @@ import java.awt.KeyboardFocusManager;
|
||||||
import java.beans.PropertyVetoException;
|
import java.beans.PropertyVetoException;
|
||||||
import static javax.swing.WindowConstants.DISPOSE_ON_CLOSE;
|
import static javax.swing.WindowConstants.DISPOSE_ON_CLOSE;
|
||||||
import javax.swing.plaf.basic.BasicInternalFrameUI;
|
import javax.swing.plaf.basic.BasicInternalFrameUI;
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -45,8 +44,6 @@ import org.apache.log4j.Logger;
|
||||||
*/
|
*/
|
||||||
public abstract class MagePane extends javax.swing.JInternalFrame {
|
public abstract class MagePane extends javax.swing.JInternalFrame {
|
||||||
|
|
||||||
private static final Logger LOGGER = Logger.getLogger(MagePane.class);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new form MagePane
|
* Creates new form MagePane
|
||||||
*/
|
*/
|
||||||
|
|
@ -62,6 +59,10 @@ public abstract class MagePane extends javax.swing.JInternalFrame {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void changeGUISize() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateUI() {
|
public void updateUI() {
|
||||||
super.updateUI();
|
super.updateUI();
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,12 @@ public class DeckEditorPane extends MagePane {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void changeGUISize() {
|
||||||
|
super.changeGUISize();
|
||||||
|
deckEditorPanel1.changeGUISize();
|
||||||
|
}
|
||||||
|
|
||||||
public void show(DeckEditorMode mode, Deck deck, String name, UUID tableId, int time) {
|
public void show(DeckEditorMode mode, Deck deck, String name, UUID tableId, int time) {
|
||||||
if (mode == DeckEditorMode.SIDEBOARDING || mode == DeckEditorMode.LIMITED_BUILDING) {
|
if (mode == DeckEditorMode.SIDEBOARDING || mode == DeckEditorMode.LIMITED_BUILDING) {
|
||||||
this.setTitle("Deck Editor - " + tableId.toString());
|
this.setTitle("Deck Editor - " + tableId.toString());
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@
|
||||||
* or implied, of BetaSteward_at_googlemail.com.
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* MageDialog.java
|
* MageDialog.java
|
||||||
*
|
*
|
||||||
* Created on 15-Dec-2009, 10:28:27 PM
|
* Created on 15-Dec-2009, 10:28:27 PM
|
||||||
|
|
@ -56,7 +56,7 @@ import org.apache.log4j.Logger;
|
||||||
*/
|
*/
|
||||||
public class MageDialog extends javax.swing.JInternalFrame {
|
public class MageDialog extends javax.swing.JInternalFrame {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(MageDialog.class);
|
private static final Logger LOGGER = Logger.getLogger(MageDialog.class);
|
||||||
|
|
||||||
protected boolean modal = false;
|
protected boolean modal = false;
|
||||||
|
|
||||||
|
|
@ -67,6 +67,10 @@ public class MageDialog extends javax.swing.JInternalFrame {
|
||||||
initComponents();
|
initComponents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void changeGUISize() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void show() {
|
public void show() {
|
||||||
super.show();
|
super.show();
|
||||||
|
|
@ -89,22 +93,20 @@ public class MageDialog extends javax.swing.JInternalFrame {
|
||||||
this.setClosable(false);
|
this.setClosable(false);
|
||||||
if (value) {
|
if (value) {
|
||||||
startModal();
|
startModal();
|
||||||
|
} else if (SwingUtilities.isEventDispatchThread()) {
|
||||||
|
stopModal();
|
||||||
} else {
|
} else {
|
||||||
if (SwingUtilities.isEventDispatchThread()) {
|
try {
|
||||||
stopModal();
|
SwingUtilities.invokeAndWait(new Runnable() {
|
||||||
} else {
|
@Override
|
||||||
try {
|
public void run() {
|
||||||
SwingUtilities.invokeAndWait(new Runnable() {
|
stopModal();
|
||||||
@Override
|
}
|
||||||
public void run() {
|
});
|
||||||
stopModal();
|
} catch (InterruptedException ex) {
|
||||||
}
|
LOGGER.fatal("MageDialog error", ex);
|
||||||
});
|
} catch (InvocationTargetException ex) {
|
||||||
} catch (InterruptedException ex) {
|
LOGGER.fatal("MageDialog error", ex);
|
||||||
logger.fatal("MageDialog error", ex);
|
|
||||||
} catch (InvocationTargetException ex) {
|
|
||||||
logger.fatal("MageDialog error", ex);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -140,7 +142,7 @@ public class MageDialog extends javax.swing.JInternalFrame {
|
||||||
} else if (source instanceof MenuComponent) {
|
} else if (source instanceof MenuComponent) {
|
||||||
((MenuComponent) source).dispatchEvent(event);
|
((MenuComponent) source).dispatchEvent(event);
|
||||||
} else {
|
} else {
|
||||||
logger.warn("Unable to dispatch: " + event);
|
LOGGER.warn("Unable to dispatch: " + event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -443,7 +443,7 @@
|
||||||
</Component>
|
</Component>
|
||||||
<Component class="javax.swing.JSlider" name="sliderFontSize">
|
<Component class="javax.swing.JSlider" name="sliderFontSize">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="majorTickSpacing" type="int" value="10"/>
|
<Property name="majorTickSpacing" type="int" value="5"/>
|
||||||
<Property name="maximum" type="int" value="50"/>
|
<Property name="maximum" type="int" value="50"/>
|
||||||
<Property name="minimum" type="int" value="10"/>
|
<Property name="minimum" type="int" value="10"/>
|
||||||
<Property name="minorTickSpacing" type="int" value="1"/>
|
<Property name="minorTickSpacing" type="int" value="1"/>
|
||||||
|
|
|
||||||
|
|
@ -724,9 +724,8 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
||||||
fontSizeLabel.setText("Size");
|
fontSizeLabel.setText("Size");
|
||||||
fontSizeLabel.setToolTipText("<HTML>The size of the font used to display text.");
|
fontSizeLabel.setToolTipText("<HTML>The size of the font used to display text.");
|
||||||
guiSize_font.add(fontSizeLabel, java.awt.BorderLayout.CENTER);
|
guiSize_font.add(fontSizeLabel, java.awt.BorderLayout.CENTER);
|
||||||
fontSizeLabel.getAccessibleContext().setAccessibleName("Size");
|
|
||||||
|
|
||||||
sliderFontSize.setMajorTickSpacing(10);
|
sliderFontSize.setMajorTickSpacing(5);
|
||||||
sliderFontSize.setMaximum(50);
|
sliderFontSize.setMaximum(50);
|
||||||
sliderFontSize.setMinimum(10);
|
sliderFontSize.setMinimum(10);
|
||||||
sliderFontSize.setMinorTickSpacing(1);
|
sliderFontSize.setMinorTickSpacing(1);
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,8 @@
|
||||||
*/
|
*/
|
||||||
package mage.client.dialog;
|
package mage.client.dialog;
|
||||||
|
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.Font;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.CancellationException;
|
import java.util.concurrent.CancellationException;
|
||||||
|
|
@ -46,6 +48,7 @@ import mage.client.components.MageComponents;
|
||||||
import mage.client.components.tray.MageTray;
|
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_ORDER;
|
||||||
import static mage.client.dialog.PreferencesDialog.KEY_TABLE_WAITING_COLUMNS_WIDTH;
|
import static mage.client.dialog.PreferencesDialog.KEY_TABLE_WAITING_COLUMNS_WIDTH;
|
||||||
|
import mage.client.util.FontSizeHelper;
|
||||||
import mage.client.util.audio.AudioManager;
|
import mage.client.util.audio.AudioManager;
|
||||||
import mage.client.util.gui.TableUtil;
|
import mage.client.util.gui.TableUtil;
|
||||||
import mage.client.util.gui.countryBox.CountryCellRenderer;
|
import mage.client.util.gui.countryBox.CountryCellRenderer;
|
||||||
|
|
@ -90,10 +93,25 @@ public class TableWaitingDialog extends MageDialog {
|
||||||
tableSeats.createDefaultColumnsFromModel();
|
tableSeats.createDefaultColumnsFromModel();
|
||||||
TableUtil.setColumnWidthAndOrder(tableSeats, DEFAULT_COLUMS_WIDTH, KEY_TABLE_WAITING_COLUMNS_WIDTH, KEY_TABLE_WAITING_COLUMNS_ORDER);
|
TableUtil.setColumnWidthAndOrder(tableSeats, DEFAULT_COLUMS_WIDTH, KEY_TABLE_WAITING_COLUMNS_WIDTH, KEY_TABLE_WAITING_COLUMNS_ORDER);
|
||||||
tableSeats.setDefaultRenderer(Icon.class, new CountryCellRenderer());
|
tableSeats.setDefaultRenderer(Icon.class, new CountryCellRenderer());
|
||||||
|
setGUISize();
|
||||||
|
|
||||||
MageFrame.getUI().addButton(MageComponents.TABLE_WAITING_START_BUTTON, btnStart);
|
MageFrame.getUI().addButton(MageComponents.TABLE_WAITING_START_BUTTON, btnStart);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void changeGUISize() {
|
||||||
|
setGUISize();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setGUISize() {
|
||||||
|
Font font = FontSizeHelper.getTableFont();
|
||||||
|
tableSeats.getTableHeader().setFont(font);
|
||||||
|
tableSeats.getTableHeader().setPreferredSize(new Dimension(FontSizeHelper.tableHeaderHeight, FontSizeHelper.tableHeaderHeight));
|
||||||
|
|
||||||
|
jSplitPane1.setDividerSize(FontSizeHelper.dividerBarSize);
|
||||||
|
jScrollPane1.getVerticalScrollBar().setPreferredSize(new Dimension(FontSizeHelper.scrollBarSize, 0));
|
||||||
|
jScrollPane1.getHorizontalScrollBar().setPreferredSize(new Dimension(0, FontSizeHelper.scrollBarSize));
|
||||||
|
}
|
||||||
|
|
||||||
public void update(TableView table) {
|
public void update(TableView table) {
|
||||||
try {
|
try {
|
||||||
if (table != null) {
|
if (table != null) {
|
||||||
|
|
|
||||||
|
|
@ -24,38 +24,37 @@
|
||||||
* The views and conclusions contained in the software and documentation are those of the
|
* 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
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
* or implied, of BetaSteward_at_googlemail.com.
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* BattlefieldPanel.java
|
* BattlefieldPanel.java
|
||||||
*
|
*
|
||||||
* Created on 10-Jan-2010, 10:43:14 PM
|
* Created on 10-Jan-2010, 10:43:14 PM
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package mage.client.game;
|
package mage.client.game;
|
||||||
|
|
||||||
import mage.cards.MagePermanent;
|
|
||||||
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.audio.AudioManager;
|
|
||||||
import mage.client.util.layout.CardLayoutStrategy;
|
|
||||||
import mage.constants.CardType;
|
|
||||||
import mage.utils.CardUtil;
|
|
||||||
import mage.view.CounterView;
|
|
||||||
import mage.view.PermanentView;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import javax.swing.border.Border;
|
|
||||||
import javax.swing.border.EmptyBorder;
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.ComponentAdapter;
|
import java.awt.event.ComponentAdapter;
|
||||||
import java.awt.event.ComponentEvent;
|
import java.awt.event.ComponentEvent;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
import javax.swing.*;
|
||||||
|
import javax.swing.border.Border;
|
||||||
|
import javax.swing.border.EmptyBorder;
|
||||||
|
import mage.cards.MagePermanent;
|
||||||
|
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.audio.AudioManager;
|
||||||
|
import mage.client.util.layout.CardLayoutStrategy;
|
||||||
import mage.client.util.layout.impl.OldCardLayoutStrategy;
|
import mage.client.util.layout.impl.OldCardLayoutStrategy;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.utils.CardUtil;
|
||||||
|
import mage.view.CounterView;
|
||||||
|
import mage.view.PermanentView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -78,18 +77,20 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane {
|
||||||
private final CardLayoutStrategy layoutStrategy = new OldCardLayoutStrategy();
|
private final CardLayoutStrategy layoutStrategy = new OldCardLayoutStrategy();
|
||||||
|
|
||||||
//private static int iCounter = 0;
|
//private static int iCounter = 0;
|
||||||
|
|
||||||
private boolean addedPermanent;
|
private boolean addedPermanent;
|
||||||
private boolean addedArtifact;
|
private boolean addedArtifact;
|
||||||
private boolean addedCreature;
|
private boolean addedCreature;
|
||||||
|
|
||||||
private boolean removedCreature;
|
private boolean removedCreature;
|
||||||
|
|
||||||
/** Creates new form BattlefieldPanel */
|
/**
|
||||||
|
* Creates new form BattlefieldPanel
|
||||||
|
*/
|
||||||
public BattlefieldPanel() {
|
public BattlefieldPanel() {
|
||||||
uiComponentsList.put("battlefieldPanel", this);
|
uiComponentsList.put("battlefieldPanel", this);
|
||||||
initComponents();
|
initComponents();
|
||||||
uiComponentsList.put("jPanel", jPanel);
|
uiComponentsList.put("jPanel", jPanel);
|
||||||
|
setGUISize();
|
||||||
|
|
||||||
addComponentListener(new ComponentAdapter() {
|
addComponentListener(new ComponentAdapter() {
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -109,7 +110,7 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void cleanUp() {
|
public void cleanUp() {
|
||||||
for (Component c: this.jPanel.getComponents()) {
|
for (Component c : this.jPanel.getComponents()) {
|
||||||
if (c instanceof Permanent || c instanceof MagePermanent) {
|
if (c instanceof Permanent || c instanceof MagePermanent) {
|
||||||
this.jPanel.remove(c);
|
this.jPanel.remove(c);
|
||||||
}
|
}
|
||||||
|
|
@ -119,11 +120,20 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane {
|
||||||
this.bigCard = null;
|
this.bigCard = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void changeGUISize() {
|
||||||
|
setGUISize();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setGUISize() {
|
||||||
|
jScrollPane.getVerticalScrollBar().setPreferredSize(new Dimension(FontSizeHelper.scrollBarSize, 0));
|
||||||
|
jScrollPane.getHorizontalScrollBar().setPreferredSize(new Dimension(0, FontSizeHelper.scrollBarSize));
|
||||||
|
}
|
||||||
|
|
||||||
public void update(Map<UUID, PermanentView> battlefield) {
|
public void update(Map<UUID, PermanentView> battlefield) {
|
||||||
boolean changed = false;
|
boolean changed = false;
|
||||||
|
|
||||||
List<PermanentView> permanentsToAdd = new ArrayList<>();
|
List<PermanentView> permanentsToAdd = new ArrayList<>();
|
||||||
for (PermanentView permanent: battlefield.values()) {
|
for (PermanentView permanent : battlefield.values()) {
|
||||||
if (!permanent.isPhasedIn()) {
|
if (!permanent.isPhasedIn()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -158,7 +168,7 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane {
|
||||||
UUID u1 = oldMagePermanent.getOriginalPermanent().getAttachedTo();
|
UUID u1 = oldMagePermanent.getOriginalPermanent().getAttachedTo();
|
||||||
UUID u2 = permanent.getAttachedTo();
|
UUID u2 = permanent.getAttachedTo();
|
||||||
if (u1 == null && u2 != null || u2 == null && u1 != null
|
if (u1 == null && u2 != null || u2 == null && u1 != null
|
||||||
|| (u1 != null && !u1.equals(u2)) ) {
|
|| (u1 != null && !u1.equals(u2))) {
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -214,7 +224,9 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sortLayout() {
|
public void sortLayout() {
|
||||||
if (battlefield == null) {return;}
|
if (battlefield == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
layoutStrategy.doLayout(this, width);
|
layoutStrategy.doLayout(this, width);
|
||||||
|
|
||||||
|
|
@ -266,26 +278,26 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removePermanent(UUID permanentId, final int count) {
|
private void removePermanent(UUID permanentId, final int count) {
|
||||||
for (Component c: this.jPanel.getComponents()) {
|
for (Component c : this.jPanel.getComponents()) {
|
||||||
final Component comp = c;
|
final Component comp = c;
|
||||||
if (comp instanceof Permanent) {
|
if (comp instanceof Permanent) {
|
||||||
if (((Permanent)comp).getPermanentId().equals(permanentId)) {
|
if (((Permanent) comp).getPermanentId().equals(permanentId)) {
|
||||||
comp.setVisible(false);
|
comp.setVisible(false);
|
||||||
this.jPanel.remove(comp);
|
this.jPanel.remove(comp);
|
||||||
}
|
}
|
||||||
} else if (comp instanceof MagePermanent) {
|
} else if (comp instanceof MagePermanent) {
|
||||||
if (((MagePermanent)comp).getOriginal().getId().equals(permanentId)) {
|
if (((MagePermanent) comp).getOriginal().getId().equals(permanentId)) {
|
||||||
Thread t = new Thread(new Runnable() {
|
Thread t = new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Plugins.getInstance().onRemoveCard((MagePermanent)comp, count);
|
Plugins.getInstance().onRemoveCard((MagePermanent) comp, count);
|
||||||
comp.setVisible(false);
|
comp.setVisible(false);
|
||||||
BattlefieldPanel.this.jPanel.remove(comp);
|
BattlefieldPanel.this.jPanel.remove(comp);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
t.start();
|
t.start();
|
||||||
}
|
}
|
||||||
if (((MagePermanent)comp).getOriginal().getCardTypes().contains(CardType.CREATURE)) {
|
if (((MagePermanent) comp).getOriginal().getCardTypes().contains(CardType.CREATURE)) {
|
||||||
removedCreature = true;
|
removedCreature = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -293,7 +305,7 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOptimizedDrawingEnabled () {
|
public boolean isOptimizedDrawingEnabled() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -309,7 +321,7 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane {
|
||||||
jPanel.setOpaque(false);
|
jPanel.setOpaque(false);
|
||||||
jScrollPane = new JScrollPane(jPanel);
|
jScrollPane = new JScrollPane(jPanel);
|
||||||
|
|
||||||
Border empty = new EmptyBorder(0,0,0,0);
|
Border empty = new EmptyBorder(0, 0, 0, 0);
|
||||||
jScrollPane.setBorder(empty);
|
jScrollPane.setBorder(empty);
|
||||||
jScrollPane.setViewportBorder(empty);
|
jScrollPane.setViewportBorder(empty);
|
||||||
jScrollPane.setOpaque(false);
|
jScrollPane.setOpaque(false);
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@
|
||||||
* or implied, of BetaSteward_at_googlemail.com.
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* FeedbackPanel.java
|
* FeedbackPanel.java
|
||||||
*
|
*
|
||||||
* Created on 23-Dec-2009, 9:54:01 PM
|
* Created on 23-Dec-2009, 9:54:01 PM
|
||||||
|
|
@ -60,7 +60,7 @@ import org.apache.log4j.Logger;
|
||||||
*/
|
*/
|
||||||
public class FeedbackPanel extends javax.swing.JPanel {
|
public class FeedbackPanel extends javax.swing.JPanel {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(FeedbackPanel.class);
|
private static final Logger LOGGER = Logger.getLogger(FeedbackPanel.class);
|
||||||
|
|
||||||
public enum FeedbackMode {
|
public enum FeedbackMode {
|
||||||
|
|
||||||
|
|
@ -74,7 +74,7 @@ public class FeedbackPanel extends javax.swing.JPanel {
|
||||||
private ChatPanelBasic connectedChatPanel;
|
private ChatPanelBasic connectedChatPanel;
|
||||||
private int lastMessageId;
|
private int lastMessageId;
|
||||||
|
|
||||||
private static final ScheduledExecutorService worker = Executors.newSingleThreadScheduledExecutor();
|
private static final ScheduledExecutorService WORKER = Executors.newSingleThreadScheduledExecutor();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new form FeedbackPanel
|
* Creates new form FeedbackPanel
|
||||||
|
|
@ -88,12 +88,21 @@ public class FeedbackPanel extends javax.swing.JPanel {
|
||||||
this.gameId = gameId;
|
this.gameId = gameId;
|
||||||
session = MageFrame.getSession();
|
session = MageFrame.getSession();
|
||||||
helper.init(gameId);
|
helper.init(gameId);
|
||||||
|
setGUISize();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void changeGUISize() {
|
||||||
|
setGUISize();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setGUISize() {
|
||||||
|
helper.changeGUISize();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getFeedback(FeedbackMode mode, String message, boolean special, Map<String, Serializable> options, int messageId) {
|
public void getFeedback(FeedbackMode mode, String message, boolean special, Map<String, Serializable> options, int messageId) {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
if (messageId < this.lastMessageId) {
|
if (messageId < this.lastMessageId) {
|
||||||
logger.warn("ignoring message from later source: " + messageId + ", text=" + message);
|
LOGGER.warn("ignoring message from later source: " + messageId + ", text=" + message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.lastMessageId = messageId;
|
this.lastMessageId = messageId;
|
||||||
|
|
@ -179,7 +188,7 @@ public class FeedbackPanel extends javax.swing.JPanel {
|
||||||
Runnable task = new Runnable() {
|
Runnable task = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
logger.info("Ending game...");
|
LOGGER.info("Ending game...");
|
||||||
Component c = MageFrame.getGame(gameId);
|
Component c = MageFrame.getGame(gameId);
|
||||||
while (c != null && !(c instanceof GamePane)) {
|
while (c != null && !(c instanceof GamePane)) {
|
||||||
c = c.getParent();
|
c = c.getParent();
|
||||||
|
|
@ -189,7 +198,7 @@ public class FeedbackPanel extends javax.swing.JPanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
worker.schedule(task, 8, TimeUnit.SECONDS);
|
WORKER.schedule(task, 8, TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleOptions(Map<String, Serializable> options) {
|
private void handleOptions(Map<String, Serializable> options) {
|
||||||
|
|
|
||||||
|
|
@ -24,14 +24,13 @@
|
||||||
* The views and conclusions contained in the software and documentation are those of the
|
* 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
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
* or implied, of BetaSteward_at_googlemail.com.
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GamePane.java
|
* GamePane.java
|
||||||
*
|
*
|
||||||
* Created on Dec 17, 2009, 9:34:10 AM
|
* Created on Dec 17, 2009, 9:34:10 AM
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package mage.client.game;
|
package mage.client.game;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
@ -45,7 +44,9 @@ import mage.client.MagePane;
|
||||||
*/
|
*/
|
||||||
public class GamePane extends MagePane {
|
public class GamePane extends MagePane {
|
||||||
|
|
||||||
/** Creates new form GamePane */
|
/**
|
||||||
|
* Creates new form GamePane
|
||||||
|
*/
|
||||||
public GamePane() {
|
public GamePane() {
|
||||||
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
||||||
initComponents();
|
initComponents();
|
||||||
|
|
@ -69,6 +70,12 @@ public class GamePane extends MagePane {
|
||||||
gamePanel.cleanUp();
|
gamePanel.cleanUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void changeGUISize() {
|
||||||
|
super.changeGUISize();
|
||||||
|
gamePanel.changeGUISize();
|
||||||
|
}
|
||||||
|
|
||||||
public void removeGame() {
|
public void removeGame() {
|
||||||
this.cleanUp();
|
this.cleanUp();
|
||||||
this.removeFrame();
|
this.removeFrame();
|
||||||
|
|
@ -97,14 +104,14 @@ public class GamePane extends MagePane {
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||||
getContentPane().setLayout(layout);
|
getContentPane().setLayout(layout);
|
||||||
layout.setHorizontalGroup(
|
layout.setHorizontalGroup(
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 600, Short.MAX_VALUE)
|
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 600, Short.MAX_VALUE)
|
||||||
.addGap(0, 600, Short.MAX_VALUE)
|
.addGap(0, 600, Short.MAX_VALUE)
|
||||||
);
|
);
|
||||||
layout.setVerticalGroup(
|
layout.setVerticalGroup(
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
|
.addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
|
||||||
.addGap(0, 400, Short.MAX_VALUE)
|
.addGap(0, 400, Short.MAX_VALUE)
|
||||||
);
|
);
|
||||||
|
|
||||||
pack();
|
pack();
|
||||||
|
|
|
||||||
|
|
@ -103,6 +103,7 @@ import mage.client.plugins.impl.Plugins;
|
||||||
import mage.client.util.CardsViewUtil;
|
import mage.client.util.CardsViewUtil;
|
||||||
import mage.client.util.Config;
|
import mage.client.util.Config;
|
||||||
import mage.client.util.Event;
|
import mage.client.util.Event;
|
||||||
|
import mage.client.util.FontSizeHelper;
|
||||||
import mage.client.util.GameManager;
|
import mage.client.util.GameManager;
|
||||||
import mage.client.util.Listener;
|
import mage.client.util.Listener;
|
||||||
import mage.client.util.audio.AudioManager;
|
import mage.client.util.audio.AudioManager;
|
||||||
|
|
@ -204,6 +205,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
||||||
|
|
||||||
public GamePanel() {
|
public GamePanel() {
|
||||||
initComponents();
|
initComponents();
|
||||||
|
changeGUISize();
|
||||||
|
|
||||||
initPopupMenuTriggerOrder();
|
initPopupMenuTriggerOrder();
|
||||||
//this.add(popupMenuTriggerOrder);
|
//this.add(popupMenuTriggerOrder);
|
||||||
|
|
@ -323,6 +325,21 @@ public final class GamePanel extends javax.swing.JPanel {
|
||||||
this.bigCard = null;
|
this.bigCard = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void changeGUISize() {
|
||||||
|
setGUISize();
|
||||||
|
handContainer.changeGUISize();
|
||||||
|
for (PlayAreaPanel playAreaPanel : players.values()) {
|
||||||
|
playAreaPanel.changeGUISize();
|
||||||
|
}
|
||||||
|
feedbackPanel.changeGUISize();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setGUISize() {
|
||||||
|
jSplitPane0.setDividerSize(FontSizeHelper.dividerBarSize);
|
||||||
|
jSplitPane1.setDividerSize(FontSizeHelper.dividerBarSize);
|
||||||
|
jSplitPane2.setDividerSize(FontSizeHelper.dividerBarSize);
|
||||||
|
}
|
||||||
|
|
||||||
private void saveDividerLocations() {
|
private void saveDividerLocations() {
|
||||||
// save panel sizes and divider locations.
|
// save panel sizes and divider locations.
|
||||||
Rectangle rec = MageFrame.getDesktop().getBounds();
|
Rectangle rec = MageFrame.getDesktop().getBounds();
|
||||||
|
|
@ -374,19 +391,17 @@ public final class GamePanel extends javax.swing.JPanel {
|
||||||
p.sizePlayer(smallMode);
|
p.sizePlayer(smallMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else if (smallMode) {
|
||||||
if (smallMode) {
|
smallMode = false;
|
||||||
smallMode = false;
|
Dimension bbDimension = new Dimension(256, 367);
|
||||||
Dimension bbDimension = new Dimension(256, 367);
|
bigCard.setMaximumSize(bbDimension);
|
||||||
bigCard.setMaximumSize(bbDimension);
|
bigCard.setMinimumSize(bbDimension);
|
||||||
bigCard.setMinimumSize(bbDimension);
|
bigCard.setPreferredSize(bbDimension);
|
||||||
bigCard.setPreferredSize(bbDimension);
|
pnlShortCuts.revalidate();
|
||||||
pnlShortCuts.revalidate();
|
pnlShortCuts.repaint();
|
||||||
pnlShortCuts.repaint();
|
this.handContainer.sizeHand(1, smallMode);
|
||||||
this.handContainer.sizeHand(1, smallMode);
|
for (PlayAreaPanel p : players.values()) {
|
||||||
for (PlayAreaPanel p : players.values()) {
|
p.sizePlayer(smallMode);
|
||||||
p.sizePlayer(smallMode);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
package mage.client.game;
|
package mage.client.game;
|
||||||
|
|
||||||
import mage.client.cards.BigCard;
|
import java.awt.*;
|
||||||
import mage.client.dialog.PreferencesDialog;
|
import java.util.UUID;
|
||||||
import mage.client.util.Config;
|
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.view.CardsView;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.border.Border;
|
import javax.swing.border.Border;
|
||||||
import javax.swing.border.EmptyBorder;
|
import javax.swing.border.EmptyBorder;
|
||||||
import java.awt.*;
|
import mage.client.cards.BigCard;
|
||||||
import java.util.UUID;
|
import mage.client.dialog.PreferencesDialog;
|
||||||
|
import mage.client.util.Config;
|
||||||
|
import mage.client.util.FontSizeHelper;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import mage.view.CardsView;
|
||||||
|
|
||||||
public class HandPanel extends JPanel {
|
public class HandPanel extends JPanel {
|
||||||
|
|
||||||
|
|
@ -25,6 +25,7 @@ public class HandPanel extends JPanel {
|
||||||
public HandPanel() {
|
public HandPanel() {
|
||||||
double factor = 1;
|
double factor = 1;
|
||||||
initComponents();
|
initComponents();
|
||||||
|
changeGUISize();
|
||||||
sizeHand(factor, false);
|
sizeHand(factor, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -65,6 +66,15 @@ public class HandPanel extends JPanel {
|
||||||
hand.cleanUp();
|
hand.cleanUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void changeGUISize() {
|
||||||
|
setGUISize();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setGUISize() {
|
||||||
|
jScrollPane1.getVerticalScrollBar().setPreferredSize(new Dimension(FontSizeHelper.scrollBarSize, 0));
|
||||||
|
jScrollPane1.getHorizontalScrollBar().setPreferredSize(new Dimension(0, FontSizeHelper.scrollBarSize));
|
||||||
|
}
|
||||||
|
|
||||||
public void loadCards(CardsView cards, BigCard bigCard, UUID gameId) {
|
public void loadCards(CardsView cards, BigCard bigCard, UUID gameId) {
|
||||||
hand.loadCards(cards, bigCard, gameId, true);
|
hand.loadCards(cards, bigCard, gameId, true);
|
||||||
hand.sizeCards(getHandCardDimension());
|
hand.sizeCards(getHandCardDimension());
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@ import mage.client.MageFrame;
|
||||||
import mage.client.components.MageTextArea;
|
import mage.client.components.MageTextArea;
|
||||||
import mage.client.game.FeedbackPanel.FeedbackMode;
|
import mage.client.game.FeedbackPanel.FeedbackMode;
|
||||||
import static mage.client.game.FeedbackPanel.FeedbackMode.QUESTION;
|
import static mage.client.game.FeedbackPanel.FeedbackMode.QUESTION;
|
||||||
|
import mage.client.util.FontSizeHelper;
|
||||||
import static mage.constants.PlayerAction.REQUEST_AUTO_ANSWER_ID_NO;
|
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_ID_YES;
|
||||||
import static mage.constants.PlayerAction.REQUEST_AUTO_ANSWER_RESET_ALL;
|
import static mage.constants.PlayerAction.REQUEST_AUTO_ANSWER_RESET_ALL;
|
||||||
|
|
@ -107,6 +108,23 @@ public class HelperPanel extends JPanel {
|
||||||
session = MageFrame.getSession();
|
session = MageFrame.getSession();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void changeGUISize() {
|
||||||
|
setGUISize();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setGUISize() {
|
||||||
|
for (Component comp : popupMenuAskNo.getComponents()) {
|
||||||
|
if (comp instanceof JMenuItem) {
|
||||||
|
comp.setFont(FontSizeHelper.menuFont);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (Component comp : popupMenuAskYes.getComponents()) {
|
||||||
|
if (comp instanceof JMenuItem) {
|
||||||
|
comp.setFont(FontSizeHelper.menuFont);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void initComponents() {
|
private void initComponents() {
|
||||||
initPopupMenuTriggerOrder();
|
initPopupMenuTriggerOrder();
|
||||||
setBackground(new Color(0, 0, 0, 100));
|
setBackground(new Color(0, 0, 0, 100));
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@
|
||||||
package mage.client.game;
|
package mage.client.game;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
|
import java.awt.Component;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
|
|
@ -55,6 +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_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;
|
||||||
import static mage.client.dialog.PreferencesDialog.KEY_GAME_MANA_AUTOPAYMENT_ONLY_ONE;
|
import static mage.client.dialog.PreferencesDialog.KEY_GAME_MANA_AUTOPAYMENT_ONLY_ONE;
|
||||||
|
import mage.client.util.FontSizeHelper;
|
||||||
import mage.constants.PlayerAction;
|
import mage.constants.PlayerAction;
|
||||||
import mage.view.PlayerView;
|
import mage.view.PlayerView;
|
||||||
|
|
||||||
|
|
@ -103,6 +105,8 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
||||||
addPopupMenuWatcher();
|
addPopupMenuWatcher();
|
||||||
}
|
}
|
||||||
this.add(popupMenu);
|
this.add(popupMenu);
|
||||||
|
setGUISize();
|
||||||
|
|
||||||
init(player, bigCard, gameId, priorityTime);
|
init(player, bigCard, gameId, priorityTime);
|
||||||
update(player);
|
update(player);
|
||||||
}
|
}
|
||||||
|
|
@ -137,6 +141,26 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void changeGUISize() {
|
||||||
|
setGUISize();
|
||||||
|
battlefieldPanel.changeGUISize();
|
||||||
|
playerPanel.changeGUISize();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setGUISize() {
|
||||||
|
for (Component comp : popupMenu.getComponents()) {
|
||||||
|
if (comp instanceof JMenuItem) {
|
||||||
|
comp.setFont(FontSizeHelper.menuFont);
|
||||||
|
if (comp instanceof JMenu) {
|
||||||
|
comp.setFont(FontSizeHelper.menuFont);
|
||||||
|
for (Component subComp : ((JMenu) comp).getMenuComponents()) {
|
||||||
|
subComp.setFont(FontSizeHelper.menuFont);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void addPopupMenuPlayer(boolean allowRequestToShowHandCards) {
|
private void addPopupMenuPlayer(boolean allowRequestToShowHandCards) {
|
||||||
|
|
||||||
JMenuItem menuItem;
|
JMenuItem menuItem;
|
||||||
|
|
@ -530,8 +554,6 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
||||||
setBorder(BorderFactory.createLineBorder(new Color(0, 0, 0, 0)));
|
setBorder(BorderFactory.createLineBorder(new Color(0, 0, 0, 0)));
|
||||||
playerPanel = new PlayerPanelExt();
|
playerPanel = new PlayerPanelExt();
|
||||||
btnCheat = new javax.swing.JButton();
|
btnCheat = new javax.swing.JButton();
|
||||||
//jScrollPane1 = new javax.swing.JScrollPane();
|
|
||||||
//battlefieldPanel = new mage.client.game.BattlefieldPanel(jScrollPane1);
|
|
||||||
battlefieldPanel = new mage.client.game.BattlefieldPanel();
|
battlefieldPanel = new mage.client.game.BattlefieldPanel();
|
||||||
|
|
||||||
btnCheat.setText("Cheat");
|
btnCheat.setText("Cheat");
|
||||||
|
|
@ -542,10 +564,6 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//jScrollPane1.setViewportView(battlefieldPanel);
|
|
||||||
//Border empty = new EmptyBorder(0,0,0,0);
|
|
||||||
//jScrollPane1.setBorder(empty);
|
|
||||||
//jScrollPane1.setViewportBorder(empty);
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||||
layout.setHorizontalGroup(
|
layout.setHorizontalGroup(
|
||||||
layout.createSequentialGroup()
|
layout.createSequentialGroup()
|
||||||
|
|
|
||||||
|
|
@ -102,9 +102,9 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
||||||
private static final int PANEL_HEIGHT_SMALL = 212;
|
private static final int PANEL_HEIGHT_SMALL = 212;
|
||||||
private static final int MANA_LABEL_SIZE_HORIZONTAL = 20;
|
private static final int MANA_LABEL_SIZE_HORIZONTAL = 20;
|
||||||
|
|
||||||
private static final Border greenBorder = new LineBorder(Color.green, 3);
|
private static final Border GREEN_BORDER = new LineBorder(Color.green, 3);
|
||||||
private static final Border redBorder = new LineBorder(Color.red, 2);
|
private static final Border RED_BORDER = new LineBorder(Color.red, 2);
|
||||||
private static final Border emptyBorder = BorderFactory.createEmptyBorder(0, 0, 0, 0);
|
private static final Border EMPTY_BORDER = BorderFactory.createEmptyBorder(0, 0, 0, 0);
|
||||||
|
|
||||||
private int avatarId = -1;
|
private int avatarId = -1;
|
||||||
private String flagName;
|
private String flagName;
|
||||||
|
|
@ -118,6 +118,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
||||||
public PlayerPanelExt() {
|
public PlayerPanelExt() {
|
||||||
setPreferredSize(new Dimension(PANEL_WIDTH, PANEL_HEIGHT));
|
setPreferredSize(new Dimension(PANEL_WIDTH, PANEL_HEIGHT));
|
||||||
initComponents();
|
initComponents();
|
||||||
|
setGUISize();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(UUID gameId, UUID playerId, BigCard bigCard, int priorityTime) {
|
public void init(UUID gameId, UUID playerId, BigCard bigCard, int priorityTime) {
|
||||||
|
|
@ -158,6 +159,14 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void changeGUISize() {
|
||||||
|
setGUISize();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setGUISize() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void update(PlayerView player) {
|
public void update(PlayerView player) {
|
||||||
this.player = player;
|
this.player = player;
|
||||||
updateAvatar();
|
updateAvatar();
|
||||||
|
|
@ -257,14 +266,14 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.isActive()) {
|
if (player.isActive()) {
|
||||||
this.avatar.setBorder(greenBorder);
|
this.avatar.setBorder(GREEN_BORDER);
|
||||||
this.btnPlayer.setBorder(greenBorder);
|
this.btnPlayer.setBorder(GREEN_BORDER);
|
||||||
} else if (player.hasLeft()) {
|
} else if (player.hasLeft()) {
|
||||||
this.avatar.setBorder(redBorder);
|
this.avatar.setBorder(RED_BORDER);
|
||||||
this.btnPlayer.setBorder(redBorder);
|
this.btnPlayer.setBorder(RED_BORDER);
|
||||||
} else {
|
} else {
|
||||||
this.avatar.setBorder(emptyBorder);
|
this.avatar.setBorder(EMPTY_BORDER);
|
||||||
this.btnPlayer.setBorder(emptyBorder);
|
this.btnPlayer.setBorder(EMPTY_BORDER);
|
||||||
}
|
}
|
||||||
|
|
||||||
update(player.getManaPool());
|
update(player.getManaPool());
|
||||||
|
|
@ -501,7 +510,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
||||||
manaCountLabelW.setText("0");
|
manaCountLabelW.setText("0");
|
||||||
manaLabels.put("W", manaCountLabelW);
|
manaLabels.put("W", manaCountLabelW);
|
||||||
r = new Rectangle(12, 12);
|
r = new Rectangle(12, 12);
|
||||||
BufferedImage imageManaW = ManaSymbols.getManaSymbolImageSmall("W");
|
BufferedImage imageManaW = ManaSymbols.getSizedManaSymbol("W");
|
||||||
HoverButton btnWhiteMana = new HoverButton(null, imageManaW, imageManaW, imageManaW, r);
|
HoverButton btnWhiteMana = new HoverButton(null, imageManaW, imageManaW, imageManaW, r);
|
||||||
btnWhiteMana.setToolTipText("White mana");
|
btnWhiteMana.setToolTipText("White mana");
|
||||||
btnWhiteMana.setOpaque(false);
|
btnWhiteMana.setOpaque(false);
|
||||||
|
|
@ -517,7 +526,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
||||||
manaCountLabelU.setText("0");
|
manaCountLabelU.setText("0");
|
||||||
manaLabels.put("U", manaCountLabelU);
|
manaLabels.put("U", manaCountLabelU);
|
||||||
r = new Rectangle(12, 12);
|
r = new Rectangle(12, 12);
|
||||||
BufferedImage imageManaU = ManaSymbols.getManaSymbolImageSmall("U");
|
BufferedImage imageManaU = ManaSymbols.getSizedManaSymbol("U");
|
||||||
HoverButton btnBlueMana = new HoverButton(null, imageManaU, imageManaU, imageManaU, r);
|
HoverButton btnBlueMana = new HoverButton(null, imageManaU, imageManaU, imageManaU, r);
|
||||||
btnBlueMana.setToolTipText("Blue mana");
|
btnBlueMana.setToolTipText("Blue mana");
|
||||||
btnBlueMana.setOpaque(false);
|
btnBlueMana.setOpaque(false);
|
||||||
|
|
@ -533,7 +542,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
||||||
manaCountLabelB.setText("0");
|
manaCountLabelB.setText("0");
|
||||||
manaLabels.put("B", manaCountLabelB);
|
manaLabels.put("B", manaCountLabelB);
|
||||||
r = new Rectangle(12, 12);
|
r = new Rectangle(12, 12);
|
||||||
BufferedImage imageManaB = ManaSymbols.getManaSymbolImageSmall("B");
|
BufferedImage imageManaB = ManaSymbols.getSizedManaSymbol("B");
|
||||||
HoverButton btnBlackMana = new HoverButton(null, imageManaB, imageManaB, imageManaB, r);
|
HoverButton btnBlackMana = new HoverButton(null, imageManaB, imageManaB, imageManaB, r);
|
||||||
btnBlackMana.setToolTipText("Black mana");
|
btnBlackMana.setToolTipText("Black mana");
|
||||||
btnBlackMana.setOpaque(false);
|
btnBlackMana.setOpaque(false);
|
||||||
|
|
@ -549,7 +558,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
||||||
manaCountLabelR.setText("0");
|
manaCountLabelR.setText("0");
|
||||||
manaLabels.put("R", manaCountLabelR);
|
manaLabels.put("R", manaCountLabelR);
|
||||||
r = new Rectangle(12, 12);
|
r = new Rectangle(12, 12);
|
||||||
BufferedImage imageManaR = ManaSymbols.getManaSymbolImageSmall("R");
|
BufferedImage imageManaR = ManaSymbols.getSizedManaSymbol("R");
|
||||||
HoverButton btnRedMana = new HoverButton(null, imageManaR, imageManaR, imageManaR, r);
|
HoverButton btnRedMana = new HoverButton(null, imageManaR, imageManaR, imageManaR, r);
|
||||||
btnRedMana.setToolTipText("Red mana");
|
btnRedMana.setToolTipText("Red mana");
|
||||||
btnRedMana.setOpaque(false);
|
btnRedMana.setOpaque(false);
|
||||||
|
|
@ -565,7 +574,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
||||||
manaCountLabelG.setText("0");
|
manaCountLabelG.setText("0");
|
||||||
manaLabels.put("G", manaCountLabelG);
|
manaLabels.put("G", manaCountLabelG);
|
||||||
r = new Rectangle(12, 12);
|
r = new Rectangle(12, 12);
|
||||||
BufferedImage imageManaG = ManaSymbols.getManaSymbolImageSmall("G");
|
BufferedImage imageManaG = ManaSymbols.getSizedManaSymbol("G");
|
||||||
HoverButton btnGreenMana = new HoverButton(null, imageManaG, imageManaG, imageManaG, r);
|
HoverButton btnGreenMana = new HoverButton(null, imageManaG, imageManaG, imageManaG, r);
|
||||||
btnGreenMana.setToolTipText("Green mana");
|
btnGreenMana.setToolTipText("Green mana");
|
||||||
btnGreenMana.setOpaque(false);
|
btnGreenMana.setOpaque(false);
|
||||||
|
|
@ -581,7 +590,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
||||||
manaCountLabelX.setText("0");
|
manaCountLabelX.setText("0");
|
||||||
manaLabels.put("X", manaCountLabelX);
|
manaLabels.put("X", manaCountLabelX);
|
||||||
r = new Rectangle(12, 12);
|
r = new Rectangle(12, 12);
|
||||||
BufferedImage imageManaX = ManaSymbols.getManaSymbolImageSmall("C");
|
BufferedImage imageManaX = ManaSymbols.getSizedManaSymbol("C");
|
||||||
HoverButton btnColorlessMana = new HoverButton(null, imageManaX, imageManaX, imageManaX, r);
|
HoverButton btnColorlessMana = new HoverButton(null, imageManaX, imageManaX, imageManaX, r);
|
||||||
btnColorlessMana.setToolTipText("Colorless mana");
|
btnColorlessMana.setToolTipText("Colorless mana");
|
||||||
btnColorlessMana.setOpaque(false);
|
btnColorlessMana.setOpaque(false);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,11 @@
|
||||||
package mage.client.plugins;
|
package mage.client.plugins;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
import javax.swing.*;
|
||||||
import mage.cards.MageCard;
|
import mage.cards.MageCard;
|
||||||
import mage.cards.MagePermanent;
|
import mage.cards.MagePermanent;
|
||||||
import mage.cards.action.ActionCallback;
|
import mage.cards.action.ActionCallback;
|
||||||
|
|
@ -7,31 +13,41 @@ import mage.client.cards.BigCard;
|
||||||
import mage.view.CardView;
|
import mage.view.CardView;
|
||||||
import mage.view.PermanentView;
|
import mage.view.PermanentView;
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.awt.*;
|
|
||||||
import java.awt.image.BufferedImage;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public interface MagePlugins {
|
public interface MagePlugins {
|
||||||
|
|
||||||
void loadPlugins();
|
void loadPlugins();
|
||||||
|
|
||||||
void shutdown();
|
void shutdown();
|
||||||
|
|
||||||
void updateGamePanel(Map<String, JComponent> ui);
|
void updateGamePanel(Map<String, JComponent> ui);
|
||||||
|
|
||||||
JComponent updateTablePanel(Map<String, JComponent> ui);
|
JComponent updateTablePanel(Map<String, JComponent> ui);
|
||||||
|
|
||||||
MagePermanent getMagePermanent(PermanentView card, BigCard bigCard, Dimension dimension, UUID gameId, boolean loadImage);
|
MagePermanent getMagePermanent(PermanentView card, BigCard bigCard, Dimension dimension, UUID gameId, boolean loadImage);
|
||||||
|
|
||||||
MageCard getMageCard(CardView card, BigCard bigCard, Dimension dimension, UUID gameId, boolean loadImage);
|
MageCard getMageCard(CardView card, BigCard bigCard, Dimension dimension, UUID gameId, boolean loadImage);
|
||||||
|
|
||||||
boolean isThemePluginLoaded();
|
boolean isThemePluginLoaded();
|
||||||
|
|
||||||
boolean isCardPluginLoaded();
|
boolean isCardPluginLoaded();
|
||||||
|
|
||||||
boolean isCounterPluginLoaded();
|
boolean isCounterPluginLoaded();
|
||||||
|
|
||||||
int sortPermanents(Map<String, JComponent> ui, Collection<MagePermanent> permanents);
|
int sortPermanents(Map<String, JComponent> ui, Collection<MagePermanent> permanents);
|
||||||
|
|
||||||
void downloadSymbols();
|
void downloadSymbols();
|
||||||
|
|
||||||
int getGamesPlayed();
|
int getGamesPlayed();
|
||||||
|
|
||||||
void addGamesPlayed();
|
void addGamesPlayed();
|
||||||
Image getManaSymbolImage(String symbol);
|
|
||||||
void onAddCard(MagePermanent card, int count);
|
void onAddCard(MagePermanent card, int count);
|
||||||
|
|
||||||
void onRemoveCard(MagePermanent card, int count);
|
void onRemoveCard(MagePermanent card, int count);
|
||||||
|
|
||||||
JComponent getCardInfoPane();
|
JComponent getCardInfoPane();
|
||||||
|
|
||||||
BufferedImage getOriginalImage(CardView card);
|
BufferedImage getOriginalImage(CardView card);
|
||||||
|
|
||||||
ActionCallback getActionCallback();
|
ActionCallback getActionCallback();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
package mage.client.plugins.impl;
|
package mage.client.plugins.impl;
|
||||||
|
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Image;
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
@ -32,12 +31,11 @@ import org.apache.log4j.Logger;
|
||||||
import org.mage.plugins.card.CardPluginImpl;
|
import org.mage.plugins.card.CardPluginImpl;
|
||||||
import org.mage.plugins.theme.ThemePluginImpl;
|
import org.mage.plugins.theme.ThemePluginImpl;
|
||||||
|
|
||||||
|
|
||||||
public class Plugins implements MagePlugins {
|
public class Plugins implements MagePlugins {
|
||||||
|
|
||||||
public static final String PLUGINS_DIRECTORY = "plugins/";
|
public static final String PLUGINS_DIRECTORY = "plugins/";
|
||||||
|
|
||||||
private static final MagePlugins fINSTANCE = new Plugins();
|
private static final MagePlugins fINSTANCE = new Plugins();
|
||||||
private static final Logger logger = Logger.getLogger(Plugins.class);
|
private static final Logger logger = Logger.getLogger(Plugins.class);
|
||||||
private static PluginManager pm;
|
private static PluginManager pm;
|
||||||
|
|
||||||
|
|
@ -107,8 +105,6 @@ public class Plugins implements MagePlugins {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isCardPluginLoaded() {
|
public boolean isCardPluginLoaded() {
|
||||||
return this.cardPlugin != null;
|
return this.cardPlugin != null;
|
||||||
|
|
@ -135,7 +131,7 @@ public class Plugins implements MagePlugins {
|
||||||
@Override
|
@Override
|
||||||
public int getGamesPlayed() {
|
public int getGamesPlayed() {
|
||||||
if (this.counterPlugin != null) {
|
if (this.counterPlugin != null) {
|
||||||
synchronized(Plugins.class) {
|
synchronized (Plugins.class) {
|
||||||
try {
|
try {
|
||||||
return this.counterPlugin.getGamePlayed();
|
return this.counterPlugin.getGamePlayed();
|
||||||
} catch (PluginException e) {
|
} catch (PluginException e) {
|
||||||
|
|
@ -150,7 +146,7 @@ public class Plugins implements MagePlugins {
|
||||||
@Override
|
@Override
|
||||||
public void addGamesPlayed() {
|
public void addGamesPlayed() {
|
||||||
if (this.counterPlugin != null) {
|
if (this.counterPlugin != null) {
|
||||||
synchronized(Plugins.class) {
|
synchronized (Plugins.class) {
|
||||||
try {
|
try {
|
||||||
this.counterPlugin.addGamePlayed();
|
this.counterPlugin.addGamePlayed();
|
||||||
} catch (PluginException e) {
|
} catch (PluginException e) {
|
||||||
|
|
@ -171,14 +167,6 @@ public class Plugins implements MagePlugins {
|
||||||
return this.themePlugin != null;
|
return this.themePlugin != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Image getManaSymbolImage(String symbol) {
|
|
||||||
if (this.cardPlugin != null) {
|
|
||||||
return this.cardPlugin.getManaSymbolImage(symbol);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAddCard(MagePermanent card, int count) {
|
public void onAddCard(MagePermanent card, int count) {
|
||||||
if (this.cardPlugin != null) {
|
if (this.cardPlugin != null) {
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,9 @@ public class TablesPane extends MagePane {
|
||||||
tablesPanel.cleanUp();
|
tablesPanel.cleanUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void changeGUISize() {
|
public void changeGUISize() {
|
||||||
|
super.changeGUISize();
|
||||||
tablesPanel.changeGUISize();
|
tablesPanel.changeGUISize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,7 @@ public class TournamentPane extends MagePane {
|
||||||
removeFrame();
|
removeFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void changeGUISize() {
|
public void changeGUISize() {
|
||||||
tournamentPanel.changeGUISize();
|
tournamentPanel.changeGUISize();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ package mage.client.util;
|
||||||
|
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
import mage.client.MageFrame;
|
import mage.client.MageFrame;
|
||||||
import mage.client.chat.ChatPanelBasic;
|
|
||||||
import mage.client.dialog.PreferencesDialog;
|
import mage.client.dialog.PreferencesDialog;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -17,9 +16,12 @@ import mage.client.dialog.PreferencesDialog;
|
||||||
public class FontSizeHelper {
|
public class FontSizeHelper {
|
||||||
|
|
||||||
public static String basicSymbolSize = "small";
|
public static String basicSymbolSize = "small";
|
||||||
|
|
||||||
public static int symbolCardSize = 15;
|
public static int symbolCardSize = 15;
|
||||||
public static int symbolTooltipSize = 15;
|
public static int symbolTooltipSize = 15;
|
||||||
public static int symbolPaySize = 15;
|
public static int symbolPaySize = 15;
|
||||||
|
public static int symbolEditorSize = 15;
|
||||||
|
|
||||||
public static int tableHeaderHeight = 24;
|
public static int tableHeaderHeight = 24;
|
||||||
public static int tableRowHeight = 20;
|
public static int tableRowHeight = 20;
|
||||||
|
|
||||||
|
|
@ -28,6 +30,11 @@ public class FontSizeHelper {
|
||||||
|
|
||||||
public static Font tooltipFont = 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 Font getChatFont() {
|
public static Font getChatFont() {
|
||||||
int fontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_FONT_SIZE, 14);
|
int fontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_FONT_SIZE, 14);
|
||||||
return new java.awt.Font("Arial", 0, fontSize);
|
return new java.awt.Font("Arial", 0, fontSize);
|
||||||
|
|
@ -54,14 +61,11 @@ public class FontSizeHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void changeGUISize() {
|
public static void changeGUISize() {
|
||||||
setGUISize();
|
calculateGUISizes();
|
||||||
for (ChatPanelBasic chatPanel : MageFrame.getChatPanels().values()) {
|
|
||||||
chatPanel.changeGUISize(getChatFont());
|
|
||||||
}
|
|
||||||
MageFrame.getInstance().changeGUISize();
|
MageFrame.getInstance().changeGUISize();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setGUISize() {
|
public static void calculateGUISizes() {
|
||||||
// Set basic symbol size
|
// Set basic symbol size
|
||||||
int fontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_FONT_SIZE, 14);
|
int fontSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_FONT_SIZE, 14);
|
||||||
if (fontSize < 25) {
|
if (fontSize < 25) {
|
||||||
|
|
@ -73,18 +77,22 @@ public class FontSizeHelper {
|
||||||
}
|
}
|
||||||
if (fontSize > 15) {
|
if (fontSize > 15) {
|
||||||
symbolTooltipSize = fontSize - 5;
|
symbolTooltipSize = fontSize - 5;
|
||||||
|
symbolEditorSize = fontSize - 5;
|
||||||
symbolPaySize = fontSize - 5;
|
symbolPaySize = fontSize - 5;
|
||||||
symbolCardSize = fontSize - 5;
|
symbolCardSize = 15;
|
||||||
dividerBarSize = 10 + (fontSize / 4);
|
dividerBarSize = 10 + (fontSize / 4);
|
||||||
scrollBarSize = 14 + (fontSize / 4);
|
scrollBarSize = 14 + (fontSize / 4);
|
||||||
} else {
|
} else {
|
||||||
symbolTooltipSize = fontSize;
|
symbolTooltipSize = fontSize;
|
||||||
|
symbolEditorSize = fontSize;
|
||||||
symbolPaySize = fontSize;
|
symbolPaySize = fontSize;
|
||||||
symbolCardSize = fontSize;
|
symbolCardSize = 15;
|
||||||
dividerBarSize = 10;
|
dividerBarSize = 10;
|
||||||
scrollBarSize = 14;
|
scrollBarSize = 14;
|
||||||
}
|
}
|
||||||
tooltipFont = new java.awt.Font("Arial", 0, fontSize - 2);
|
tooltipFont = new java.awt.Font("Arial", 0, fontSize - 2);
|
||||||
|
// used for popup menus
|
||||||
|
menuFont = new java.awt.Font("Arial", 0, fontSize);
|
||||||
|
|
||||||
tableRowHeight = fontSize + 4;
|
tableRowHeight = fontSize + 4;
|
||||||
tableHeaderHeight = fontSize + 10;
|
tableHeaderHeight = fontSize + 10;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ import java.awt.FlowLayout;
|
||||||
import java.awt.Image;
|
import java.awt.Image;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.swing.DefaultComboBoxModel;
|
import javax.swing.DefaultComboBoxModel;
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
import javax.swing.JComboBox;
|
import javax.swing.JComboBox;
|
||||||
|
|
@ -14,9 +13,8 @@ import javax.swing.JLabel;
|
||||||
import javax.swing.JList;
|
import javax.swing.JList;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.ListCellRenderer;
|
import javax.swing.ListCellRenderer;
|
||||||
|
|
||||||
import mage.client.constants.Constants;
|
import mage.client.constants.Constants;
|
||||||
import mage.client.plugins.impl.Plugins;
|
import org.mage.card.arcane.ManaSymbols;
|
||||||
|
|
||||||
public class ColorsChooser extends JComboBox implements ListCellRenderer {
|
public class ColorsChooser extends JComboBox implements ListCellRenderer {
|
||||||
|
|
||||||
|
|
@ -82,7 +80,7 @@ public class ColorsChooser extends JComboBox implements ListCellRenderer {
|
||||||
value = value.toUpperCase();
|
value = value.toUpperCase();
|
||||||
for (int i = 0; i < value.length(); i++) {
|
for (int i = 0; i < value.length(); i++) {
|
||||||
char symbol = value.charAt(i);
|
char symbol = value.charAt(i);
|
||||||
Image image = Plugins.getInstance().getManaSymbolImage(String.valueOf(symbol));
|
Image image = ManaSymbols.getSizedManaSymbol(String.valueOf(symbol));
|
||||||
if (image != null) {
|
if (image != null) {
|
||||||
images.add(image);
|
images.add(image);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@ public class ManaSymbols {
|
||||||
|
|
||||||
private static final Logger LOGGER = Logger.getLogger(ManaSymbols.class);
|
private static final Logger LOGGER = Logger.getLogger(ManaSymbols.class);
|
||||||
private static final Map<String, BufferedImage> MANA_IMAGES = new HashMap<>();
|
private static final Map<String, BufferedImage> MANA_IMAGES = new HashMap<>();
|
||||||
private static final Map<String, Image> MANA_IMAGES_ORIGINAL = new HashMap<>();
|
|
||||||
private static final Map<String, Image> SET_IMAGES = new HashMap<>();
|
private static final Map<String, Image> SET_IMAGES = new HashMap<>();
|
||||||
private static final Map<String, Dimension> SET_IMAGES_EXIST = new HashMap<>();
|
private static final Map<String, Dimension> SET_IMAGES_EXIST = new HashMap<>();
|
||||||
private static final Pattern REPLACE_SYMBOLS_PATTERN = Pattern.compile("\\{([^}/]*)/?([^}]*)\\}");
|
private static final Pattern REPLACE_SYMBOLS_PATTERN = Pattern.compile("\\{([^}/]*)/?([^}]*)\\}");
|
||||||
|
|
@ -35,23 +34,36 @@ public class ManaSymbols {
|
||||||
"BR", "G", "GU", "GW", "R", "RG", "RW", "S", "T", "U", "UB", "UR", "W", "WB", "WU",
|
"BR", "G", "GU", "GW", "R", "RG", "RW", "S", "T", "U", "UB", "UR", "W", "WB", "WU",
|
||||||
"WP", "UP", "BP", "RP", "GP", "X", "C" /*, "Y", "Z", "slash"*/};
|
"WP", "UP", "BP", "RP", "GP", "X", "C" /*, "Y", "Z", "slash"*/};
|
||||||
|
|
||||||
|
MANA_IMAGES.clear();
|
||||||
|
SET_IMAGES.clear();
|
||||||
|
SET_IMAGES_EXIST.clear();
|
||||||
|
|
||||||
for (String symbol : symbols) {
|
for (String symbol : symbols) {
|
||||||
File file = new File(getSymbolsPath() + Constants.RESOURCE_PATH_MANA_MEDIUM + "/" + symbol + ".jpg");
|
String resourcePath = Constants.RESOURCE_PATH_MANA_SMALL;
|
||||||
Rectangle r = new Rectangle(11, 11);
|
switch (FontSizeHelper.basicSymbolSize) {
|
||||||
|
case "medium":
|
||||||
|
resourcePath = Constants.RESOURCE_PATH_MANA_SMALL;
|
||||||
|
break;
|
||||||
|
case "large":
|
||||||
|
resourcePath = Constants.RESOURCE_PATH_MANA_LARGE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
File file = new File(getSymbolsPath() + resourcePath + "/" + symbol + ".jpg");
|
||||||
try {
|
try {
|
||||||
Image image = UI.getImageIcon(file.getAbsolutePath()).getImage();
|
if (FontSizeHelper.symbolPaySize != 15) {
|
||||||
BufferedImage resized = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(image, BufferedImage.TYPE_INT_ARGB), r);
|
BufferedImage notResized = ImageIO.read(file);
|
||||||
MANA_IMAGES.put(symbol, resized);
|
MANA_IMAGES.put(symbol, notResized);
|
||||||
|
} else {
|
||||||
|
Rectangle r = new Rectangle(FontSizeHelper.symbolPaySize, FontSizeHelper.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);
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("Error for symbol:" + symbol);
|
LOGGER.error("Error for symbol:" + symbol);
|
||||||
}
|
}
|
||||||
file = new File(getSymbolsPath() + Constants.RESOURCE_PATH_MANA_MEDIUM + "/" + symbol + ".jpg");
|
|
||||||
try {
|
|
||||||
Image image = UI.getImageIcon(file.getAbsolutePath()).getImage();
|
|
||||||
MANA_IMAGES_ORIGINAL.put(symbol, image);
|
|
||||||
} catch (Exception e) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> setCodes = ExpansionRepository.instance.getSetCodes();
|
List<String> setCodes = ExpansionRepository.instance.getSetCodes();
|
||||||
if (setCodes == null) {
|
if (setCodes == null) {
|
||||||
// the cards db file is probaly not included in the client. It will be created after the first connect to a server.
|
// the cards db file is probaly not included in the client. It will be created after the first connect to a server.
|
||||||
|
|
@ -158,10 +170,6 @@ public class ManaSymbols {
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Image getManaSymbolImage(String symbol) {
|
|
||||||
return MANA_IMAGES_ORIGINAL.get(symbol);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void draw(Graphics g, String manaCost, int x, int y) {
|
public static void draw(Graphics g, String manaCost, int x, int y) {
|
||||||
if (manaCost.length() == 0) {
|
if (manaCost.length() == 0) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -201,9 +209,9 @@ public class ManaSymbols {
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Type {
|
public enum Type {
|
||||||
|
|
||||||
CARD,
|
CARD,
|
||||||
TOOLTIP,
|
TOOLTIP,
|
||||||
|
EDITOR,
|
||||||
PAY
|
PAY
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -213,28 +221,28 @@ public class ManaSymbols {
|
||||||
String replaced = value;
|
String replaced = value;
|
||||||
|
|
||||||
if (!MANA_IMAGES.isEmpty()) {
|
if (!MANA_IMAGES.isEmpty()) {
|
||||||
|
int symbolSize;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case TOOLTIP:
|
case TOOLTIP:
|
||||||
replaced = REPLACE_SYMBOLS_PATTERN.matcher(value).replaceAll("<img src='file:" + getSymbolsPath(true) + "/symbols/small/$1$2.jpg' alt='$1$2' width=11 height=11>");
|
symbolSize = FontSizeHelper.symbolTooltipSize;
|
||||||
// replaced = REPLACE_SYMBOLS_PATTERN.matcher(value).replaceAll("<img src='file:" + getSymbolsPath(true)
|
|
||||||
// + "/symbols/" + FontSizeHelper.basicSymbolSize + "/$1$2.jpg' alt='$1$2' width="
|
|
||||||
// + FontSizeHelper.symbolTooltipSize + " height=" + FontSizeHelper.symbolTooltipSize + ">");
|
|
||||||
break;
|
break;
|
||||||
case CARD:
|
case CARD:
|
||||||
value = value.replace("{slash}", "<img src='file:" + getSymbolsPath() + "/symbols/medium/slash.jpg' alt='slash' width=10 height=13>");
|
symbolSize = FontSizeHelper.symbolCardSize;
|
||||||
replaced = REPLACE_SYMBOLS_PATTERN.matcher(value).replaceAll("<img src='file:" + getSymbolsPath(true)
|
|
||||||
+ "/symbols/" + FontSizeHelper.basicSymbolSize + "/$1$2.jpg' alt='$1$2' width="
|
|
||||||
+ FontSizeHelper.symbolCardSize + " height=" + FontSizeHelper.symbolCardSize + ">");
|
|
||||||
break;
|
break;
|
||||||
case PAY:
|
case PAY:
|
||||||
value = value.replace("{slash}", "<img src='file:" + getSymbolsPath() + "/symbols/medium/slash.jpg' alt='slash' width=10 height=13>");
|
symbolSize = FontSizeHelper.symbolPaySize;
|
||||||
replaced = REPLACE_SYMBOLS_PATTERN.matcher(value).replaceAll("<img src='file:" + getSymbolsPath(true)
|
break;
|
||||||
+ "/symbols/" + FontSizeHelper.basicSymbolSize + "/$1$2.jpg' alt='$1$2' "
|
case EDITOR:
|
||||||
+ "width=" + FontSizeHelper.symbolPaySize + " height=" + FontSizeHelper.symbolPaySize + ">");
|
symbolSize = FontSizeHelper.symbolEditorSize;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
symbolSize = 11;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
replaced = REPLACE_SYMBOLS_PATTERN.matcher(value).replaceAll("<img src='file:" + getSymbolsPath(true)
|
||||||
|
+ "/symbols/" + FontSizeHelper.basicSymbolSize + "/$1$2.jpg' alt='$1$2' width="
|
||||||
|
+ symbolSize + " height=" + symbolSize + ">");
|
||||||
|
|
||||||
}
|
}
|
||||||
replaced = replaced.replace("|source|", "{source}");
|
replaced = replaced.replace("|source|", "{source}");
|
||||||
replaced = replaced.replace("|this|", "{this}");
|
replaced = replaced.replace("|this|", "{this}");
|
||||||
|
|
@ -256,7 +264,7 @@ public class ManaSymbols {
|
||||||
return SET_IMAGES.get(set);
|
return SET_IMAGES.get(set);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BufferedImage getManaSymbolImageSmall(String symbol) {
|
public static BufferedImage getSizedManaSymbol(String symbol) {
|
||||||
return MANA_IMAGES.get(symbol);
|
return MANA_IMAGES.get(symbol);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ package org.mage.plugins.card;
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Frame;
|
import java.awt.Frame;
|
||||||
import java.awt.Image;
|
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
import java.awt.event.WindowAdapter;
|
import java.awt.event.WindowAdapter;
|
||||||
import java.awt.event.WindowEvent;
|
import java.awt.event.WindowEvent;
|
||||||
|
|
@ -31,7 +30,6 @@ import net.xeoh.plugins.base.annotations.meta.Author;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.mage.card.arcane.Animation;
|
import org.mage.card.arcane.Animation;
|
||||||
import org.mage.card.arcane.CardPanel;
|
import org.mage.card.arcane.CardPanel;
|
||||||
import org.mage.card.arcane.ManaSymbols;
|
|
||||||
import org.mage.plugins.card.constants.Constants;
|
import org.mage.plugins.card.constants.Constants;
|
||||||
import org.mage.plugins.card.dl.DownloadGui;
|
import org.mage.plugins.card.dl.DownloadGui;
|
||||||
import org.mage.plugins.card.dl.DownloadJob;
|
import org.mage.plugins.card.dl.DownloadJob;
|
||||||
|
|
@ -48,14 +46,15 @@ import org.mage.plugins.card.info.CardInfoPaneImpl;
|
||||||
*
|
*
|
||||||
* @author nantuko
|
* @author nantuko
|
||||||
* @version 0.1 01.11.2010 Mage permanents. Sorting card layout.
|
* @version 0.1 01.11.2010 Mage permanents. Sorting card layout.
|
||||||
* @version 0.6 17.07.2011 #sortPermanents got option to display non-land permanents in one pile
|
* @version 0.6 17.07.2011 #sortPermanents got option to display non-land
|
||||||
|
* permanents in one pile
|
||||||
* @version 0.7 29.07.2011 face down cards support
|
* @version 0.7 29.07.2011 face down cards support
|
||||||
*/
|
*/
|
||||||
@PluginImplementation
|
@PluginImplementation
|
||||||
@Author(name = "nantuko")
|
@Author(name = "nantuko")
|
||||||
public class CardPluginImpl implements CardPlugin {
|
public class CardPluginImpl implements CardPlugin {
|
||||||
|
|
||||||
private static final Logger log = Logger.getLogger(CardPluginImpl.class);
|
private static final Logger LOGGER = Logger.getLogger(CardPluginImpl.class);
|
||||||
|
|
||||||
private static final int GUTTER_Y = 15;
|
private static final int GUTTER_Y = 15;
|
||||||
private static final int GUTTER_X = 5;
|
private static final int GUTTER_X = 5;
|
||||||
|
|
@ -81,7 +80,7 @@ public class CardPluginImpl implements CardPlugin {
|
||||||
|
|
||||||
@PluginLoaded
|
@PluginLoaded
|
||||||
public void newPlugin(CardPlugin plugin) {
|
public void newPlugin(CardPlugin plugin) {
|
||||||
log.info(plugin.toString() + " has been loaded.");
|
LOGGER.info(plugin.toString() + " has been loaded.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -398,6 +397,7 @@ public class CardPluginImpl implements CardPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
private class Row extends ArrayList<Stack> {
|
private class Row extends ArrayList<Stack> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public Row() {
|
public Row() {
|
||||||
|
|
@ -458,6 +458,7 @@ public class CardPluginImpl implements CardPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
private class Stack extends ArrayList<MagePermanent> {
|
private class Stack extends ArrayList<MagePermanent> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -474,7 +475,7 @@ public class CardPluginImpl implements CardPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getHeight() {
|
private int getHeight() {
|
||||||
return cardHeight + (size() - 1) * stackSpacingY + cardSpacingY + attachmentSpacingY*maxAttachedCount;
|
return cardHeight + (size() - 1) * stackSpacingY + cardSpacingY + attachmentSpacingY * maxAttachedCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxAttachedCount() {
|
public int getMaxAttachedCount() {
|
||||||
|
|
@ -489,7 +490,8 @@ public class CardPluginImpl implements CardPlugin {
|
||||||
/**
|
/**
|
||||||
* Download various symbols (mana, tap, set).
|
* Download various symbols (mana, tap, set).
|
||||||
*
|
*
|
||||||
* @param imagesPath Path to check in and store symbols to. Can be null, in such case default path should be used.
|
* @param imagesPath Path to check in and store symbols to. Can be null, in
|
||||||
|
* such case default path should be used.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void downloadSymbols(String imagesPath) {
|
public void downloadSymbols(String imagesPath) {
|
||||||
|
|
@ -502,17 +504,17 @@ public class CardPluginImpl implements CardPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
it = new GathererSets(imagesPath);
|
it = new GathererSets(imagesPath);
|
||||||
for(DownloadJob job:it) {
|
for (DownloadJob job : it) {
|
||||||
g.getDownloader().add(job);
|
g.getDownloader().add(job);
|
||||||
}
|
}
|
||||||
|
|
||||||
it = new CardFrames(imagesPath);
|
it = new CardFrames(imagesPath);
|
||||||
for(DownloadJob job:it) {
|
for (DownloadJob job : it) {
|
||||||
g.getDownloader().add(job);
|
g.getDownloader().add(job);
|
||||||
}
|
}
|
||||||
|
|
||||||
it = new DirectLinksForDownload(imagesPath);
|
it = new DirectLinksForDownload(imagesPath);
|
||||||
for(DownloadJob job:it) {
|
for (DownloadJob job : it) {
|
||||||
g.getDownloader().add(job);
|
g.getDownloader().add(job);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -530,11 +532,6 @@ public class CardPluginImpl implements CardPlugin {
|
||||||
d.setVisible(true);
|
d.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Image getManaSymbolImage(String symbol) {
|
|
||||||
return ManaSymbols.getManaSymbolImage(symbol);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAddCard(MagePermanent card, int count) {
|
public void onAddCard(MagePermanent card, int count) {
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,13 @@ import java.awt.Rectangle;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
public class Constants {
|
public class Constants {
|
||||||
|
|
||||||
|
public static final String RESOURCE_PATH_SET = File.separator + "sets" + File.separator;
|
||||||
|
|
||||||
|
public static final String RESOURCE_PATH_MANA_SMALL = File.separator + "symbols" + File.separator + "small";
|
||||||
public static final String RESOURCE_PATH_MANA_LARGE = File.separator + "symbols" + File.separator + "large";
|
public static final String RESOURCE_PATH_MANA_LARGE = File.separator + "symbols" + File.separator + "large";
|
||||||
public static final String RESOURCE_PATH_MANA_MEDIUM = File.separator + "symbols" + File.separator + "medium";
|
public static final String RESOURCE_PATH_MANA_MEDIUM = File.separator + "symbols" + File.separator + "medium";
|
||||||
|
|
||||||
public static final String RESOURCE_PATH_SET = File.separator + "sets" + File.separator;
|
|
||||||
public static final String RESOURCE_PATH_SET_SMALL = RESOURCE_PATH_SET + File.separator + "small" + File.separator;
|
public static final String RESOURCE_PATH_SET_SMALL = RESOURCE_PATH_SET + File.separator + "small" + File.separator;
|
||||||
|
|
||||||
public static final Rectangle CARD_SIZE_FULL = new Rectangle(101, 149);
|
public static final Rectangle CARD_SIZE_FULL = new Rectangle(101, 149);
|
||||||
|
|
@ -20,6 +23,7 @@ public class Constants {
|
||||||
public static final int TOOLTIP_BORDER_WIDTH = 80;
|
public static final int TOOLTIP_BORDER_WIDTH = 80;
|
||||||
|
|
||||||
public interface IO {
|
public interface IO {
|
||||||
|
|
||||||
String imageBaseDir = "plugins" + File.separator + "images";
|
String imageBaseDir = "plugins" + File.separator + "images";
|
||||||
String IMAGE_PROPERTIES_FILE = "image.url.properties";
|
String IMAGE_PROPERTIES_FILE = "image.url.properties";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,16 @@
|
||||||
package mage.interfaces.plugin;
|
package mage.interfaces.plugin;
|
||||||
|
|
||||||
import mage.cards.MagePermanent;
|
|
||||||
import mage.cards.action.ActionCallback;
|
|
||||||
import mage.view.CardView;
|
|
||||||
import mage.view.PermanentView;
|
|
||||||
import net.xeoh.plugins.base.Plugin;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import javax.swing.*;
|
||||||
|
import mage.cards.MagePermanent;
|
||||||
|
import mage.cards.action.ActionCallback;
|
||||||
|
import mage.view.CardView;
|
||||||
|
import mage.view.PermanentView;
|
||||||
|
import net.xeoh.plugins.base.Plugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for card plugins
|
* Interface for card plugins
|
||||||
|
|
@ -23,20 +22,26 @@ import java.util.UUID;
|
||||||
* @author nantuko
|
* @author nantuko
|
||||||
*/
|
*/
|
||||||
public interface CardPlugin extends Plugin {
|
public interface CardPlugin extends Plugin {
|
||||||
|
|
||||||
MagePermanent getMagePermanent(PermanentView permanent, Dimension dimension, UUID gameId, ActionCallback callback, boolean canBeFoil, boolean loadImage);
|
MagePermanent getMagePermanent(PermanentView permanent, Dimension dimension, UUID gameId, ActionCallback callback, boolean canBeFoil, boolean loadImage);
|
||||||
|
|
||||||
MagePermanent getMageCard(CardView permanent, Dimension dimension, UUID gameId, ActionCallback callback, boolean canBeFoil, boolean loadImage);
|
MagePermanent getMageCard(CardView permanent, Dimension dimension, UUID gameId, ActionCallback callback, boolean canBeFoil, boolean loadImage);
|
||||||
|
|
||||||
int sortPermanents(Map<String, JComponent> ui, Collection<MagePermanent> cards, Map<String, String> options);
|
int sortPermanents(Map<String, JComponent> ui, Collection<MagePermanent> cards, Map<String, String> options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Download various symbols (mana, tap, set).
|
* Download various symbols (mana, tap, set).
|
||||||
*
|
*
|
||||||
* @param imagesPath Path to check in and store symbols to. Can be null, in such case default path should be used.
|
* @param imagesPath Path to check in and store symbols to. Can be null, in
|
||||||
|
* such case default path should be used.
|
||||||
*/
|
*/
|
||||||
void downloadSymbols(String imagesPath);
|
void downloadSymbols(String imagesPath);
|
||||||
|
|
||||||
Image getManaSymbolImage(String symbol);
|
|
||||||
void onAddCard(MagePermanent card, int count);
|
void onAddCard(MagePermanent card, int count);
|
||||||
|
|
||||||
void onRemoveCard(MagePermanent card, int count);
|
void onRemoveCard(MagePermanent card, int count);
|
||||||
|
|
||||||
JComponent getCardInfoPane();
|
JComponent getCardInfoPane();
|
||||||
|
|
||||||
BufferedImage getOriginalImage(CardView card);
|
BufferedImage getOriginalImage(CardView card);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue