diff --git a/Mage.Client/src/main/java/mage/client/constants/Constants.java b/Mage.Client/src/main/java/mage/client/constants/Constants.java index 5547517a85..8572dc5e3a 100644 --- a/Mage.Client/src/main/java/mage/client/constants/Constants.java +++ b/Mage.Client/src/main/java/mage/client/constants/Constants.java @@ -113,6 +113,11 @@ public final class Constants { public static final String BASE_SOUND_PATH = "sounds" + File.separator; // TODO: check path with File.separator public static final String BASE_MUSICS_PATH = "music" + File.separator; + // battlefield feedback panel colors (used in preferences dialogs too) + public static final int BATTLEFIELD_FEEDBACK_COLORIZING_MODE_DISABLE = 0; + public static final int BATTLEFIELD_FEEDBACK_COLORIZING_MODE_ENABLE_BY_ONE_COLOR = 1; + public static final int BATTLEFIELD_FEEDBACK_COLORIZING_MODE_ENABLE_BY_MULTICOLOR = 2; + public interface IO { String DEFAULT_IMAGES_DIR = "plugins" + File.separator + "images" + File.separator; String IMAGE_PROPERTIES_FILE = "image.url.properties"; diff --git a/Mage.Client/src/main/java/mage/client/dialog/PreferencesDialog.form b/Mage.Client/src/main/java/mage/client/dialog/PreferencesDialog.form index 0eead728a1..1058a968e7 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/PreferencesDialog.form +++ b/Mage.Client/src/main/java/mage/client/dialog/PreferencesDialog.form @@ -80,6 +80,7 @@ + @@ -94,12 +95,73 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -159,7 +221,7 @@ - + @@ -189,16 +251,11 @@ - - - - - @@ -226,13 +283,13 @@ - + - + @@ -339,11 +396,11 @@ - + - + @@ -355,46 +412,50 @@ - + - - - - + + + - - - - + + + - + - - - + + + + + + + + - + + + + - + - - - + + + + - - - diff --git a/Mage.Client/src/main/java/mage/client/dialog/PreferencesDialog.java b/Mage.Client/src/main/java/mage/client/dialog/PreferencesDialog.java index 4f7639ed4a..831900e297 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/PreferencesDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/PreferencesDialog.java @@ -69,6 +69,8 @@ import mage.client.util.Config; import mage.client.util.GUISizeHelper; import mage.client.util.ImageHelper; import mage.client.util.gui.BufferedImageBuilder; + +import static mage.client.constants.Constants.BATTLEFIELD_FEEDBACK_COLORIZING_MODE_ENABLE_BY_MULTICOLOR; import static mage.constants.Constants.DEFAULT_AVATAR_ID; import static mage.constants.Constants.MAX_AVATAR_ID; import static mage.constants.Constants.MIN_AVATAR_ID; @@ -101,6 +103,8 @@ public class PreferencesDialog extends javax.swing.JDialog { public static final String KEY_GAME_ASK_MOVE_TO_GRAVE_ORDER = "gameAskMoveToGraveORder"; public static final String KEY_GAME_USE_PROFANITY_FILTER = "gameUseProfanityFilter"; + public static final String KEY_BATTLEFIELD_FEEDBACK_COLORIZING_MODE = "battlefieldFeedbackColorizingMode"; + 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"; @@ -398,11 +402,14 @@ public class PreferencesDialog extends javax.swing.JDialog { tabsPanel = new javax.swing.JTabbedPane(); tabMain = new javax.swing.JPanel(); + main_gamelog = new javax.swing.JPanel(); + cbGameLogAutoSave = new javax.swing.JCheckBox(); + cbDraftLogAutoSave = new javax.swing.JCheckBox(); main_card = new javax.swing.JPanel(); showCardName = new javax.swing.JCheckBox(); - showFullImagePath = new javax.swing.JCheckBox(); tooltipDelayLabel = new javax.swing.JLabel(); tooltipDelay = new javax.swing.JSlider(); + showFullImagePath = new javax.swing.JCheckBox(); main_game = new javax.swing.JPanel(); nonLandPermanentsInOnePile = new javax.swing.JCheckBox(); showPlayerNamesPermanently = new javax.swing.JCheckBox(); @@ -411,9 +418,9 @@ public class PreferencesDialog extends javax.swing.JDialog { cbShowStormCounter = new javax.swing.JCheckBox(); cbConfirmEmptyManaPool = new javax.swing.JCheckBox(); cbAskMoveToGraveOrder = new javax.swing.JCheckBox(); - main_gamelog = new javax.swing.JPanel(); - cbGameLogAutoSave = new javax.swing.JCheckBox(); - cbDraftLogAutoSave = new javax.swing.JCheckBox(); + main_battlefield = new javax.swing.JPanel(); + cbBattlefieldFeedbackColorizingMode = new javax.swing.JComboBox(); + lblBattlefieldFeedbackColorizingMode = new javax.swing.JLabel(); tabGuiSize = new javax.swing.JPanel(); guiSizeBasic = new javax.swing.JPanel(); sliderFontSize = new javax.swing.JSlider(); @@ -589,6 +596,45 @@ public class PreferencesDialog extends javax.swing.JDialog { tabsPanel.setMinimumSize(new java.awt.Dimension(532, 451)); + main_gamelog.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Game log")); + + cbGameLogAutoSave.setSelected(true); + cbGameLogAutoSave.setText("Auto save game logs (to \"../Mage.Client/gamelogs/\" directory)"); + cbGameLogAutoSave.setToolTipText("The logs of all your games will be saved to the mentioned folder if this option is switched on."); + cbGameLogAutoSave.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + cbGameLogAutoSaveActionPerformed(evt); + } + }); + + cbDraftLogAutoSave.setSelected(true); + cbDraftLogAutoSave.setText("Auto save draft logs (to \"../Mage.Client/gamelogs/\" directory)"); + cbDraftLogAutoSave.setToolTipText("The logs of all your games will be saved to the mentioned folder if this option is switched on."); + cbDraftLogAutoSave.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + cbDraftLogAutoSaveActionPerformed(evt); + } + }); + + org.jdesktop.layout.GroupLayout main_gamelogLayout = new org.jdesktop.layout.GroupLayout(main_gamelog); + main_gamelog.setLayout(main_gamelogLayout); + main_gamelogLayout.setHorizontalGroup( + main_gamelogLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(main_gamelogLayout.createSequentialGroup() + .addContainerGap() + .add(main_gamelogLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) + .add(cbDraftLogAutoSave, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .add(cbGameLogAutoSave, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + main_gamelogLayout.setVerticalGroup( + main_gamelogLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(main_gamelogLayout.createSequentialGroup() + .add(cbGameLogAutoSave) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(cbDraftLogAutoSave)) + ); + main_card.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Card")); showCardName.setSelected(true); @@ -615,9 +661,8 @@ public class PreferencesDialog extends javax.swing.JDialog { tooltipDelay.setToolTipText("The time the appearance of the tooltip window for a card is delayed.
\nIf set to zero, the tooltip window won't be shown at all."); tooltipDelay.setValue(300); - showFullImagePath.setSelected(false); + showFullImagePath.setSelected(true); showFullImagePath.setToolTipText("Show the path Xmage is expecting for this card's image (only displays if missing)"); - showFullImagePath.setActionCommand(""); showFullImagePath.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); showFullImagePath.setLabel("Display image path for missing images"); showFullImagePath.addActionListener(new java.awt.event.ActionListener() { @@ -634,7 +679,7 @@ public class PreferencesDialog extends javax.swing.JDialog { .add(6, 6, 6) .add(main_cardLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(main_cardLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false) - .add(tooltipDelayLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 308, Short.MAX_VALUE) + .add(tooltipDelayLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 308, Short.MAX_VALUE) .add(tooltipDelay, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .add(main_cardLayout.createSequentialGroup() .add(showCardName) @@ -654,9 +699,6 @@ public class PreferencesDialog extends javax.swing.JDialog { .add(tooltipDelay, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); - showFullImagePath.getAccessibleContext().setAccessibleName("Display image path for missing images"); - showFullImagePath.getAccessibleContext().setAccessibleDescription("Show the path Xmage is expecting for this card's image (only displays if missing)"); - main_game.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Game")); nonLandPermanentsInOnePile.setSelected(true); @@ -737,11 +779,11 @@ public class PreferencesDialog extends javax.swing.JDialog { .add(main_gameLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) .add(showPlayerNamesPermanently, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(nonLandPermanentsInOnePile, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .add(showAbilityPickerForced) .add(cbConfirmEmptyManaPool, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(cbAllowRequestToShowHandCards, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(cbShowStormCounter, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .add(cbAskMoveToGraveOrder, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .add(cbAskMoveToGraveOrder, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .add(showAbilityPickerForced, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap(255, Short.MAX_VALUE)) ); main_gameLayout.setVerticalGroup( @@ -765,43 +807,35 @@ public class PreferencesDialog extends javax.swing.JDialog { nonLandPermanentsInOnePile.getAccessibleContext().setAccessibleName("nonLandPermanentsInOnePile"); - main_gamelog.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Game log")); + main_battlefield.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Battlefield")); - cbGameLogAutoSave.setSelected(true); - cbGameLogAutoSave.setText("Auto save game logs (to \"../Mage.Client/gamelogs/\" directory)"); - cbGameLogAutoSave.setToolTipText("The logs of all your games will be saved to the mentioned folder if this option is switched on."); - cbGameLogAutoSave.addActionListener(new java.awt.event.ActionListener() { + cbBattlefieldFeedbackColorizingMode.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Disable colorizing", "Enable one color for all phases", "Enable multicolor for different phases" })); + cbBattlefieldFeedbackColorizingMode.setToolTipText("Battlefield feedback panel colorizing on your turn (e.g. use green color if you must select card or answer to request)"); + cbBattlefieldFeedbackColorizingMode.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - cbGameLogAutoSaveActionPerformed(evt); + cbBattlefieldFeedbackColorizingModeActionPerformed(evt); } }); - cbDraftLogAutoSave.setSelected(true); - cbDraftLogAutoSave.setText("Auto save draft logs (to \"../Mage.Client/gamelogs/\" directory)"); - cbDraftLogAutoSave.setToolTipText("The logs of all your games will be saved to the mentioned folder if this option is switched on."); - cbDraftLogAutoSave.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - cbDraftLogAutoSaveActionPerformed(evt); - } - }); + lblBattlefieldFeedbackColorizingMode.setLabelFor(cbBattlefieldFeedbackColorizingMode); + lblBattlefieldFeedbackColorizingMode.setText("Feedback panel colorizing:"); - org.jdesktop.layout.GroupLayout main_gamelogLayout = new org.jdesktop.layout.GroupLayout(main_gamelog); - main_gamelog.setLayout(main_gamelogLayout); - main_gamelogLayout.setHorizontalGroup( - main_gamelogLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(main_gamelogLayout.createSequentialGroup() + org.jdesktop.layout.GroupLayout main_battlefieldLayout = new org.jdesktop.layout.GroupLayout(main_battlefield); + main_battlefield.setLayout(main_battlefieldLayout); + main_battlefieldLayout.setHorizontalGroup( + main_battlefieldLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(main_battlefieldLayout.createSequentialGroup() .addContainerGap() - .add(main_gamelogLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) - .add(cbDraftLogAutoSave, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .add(cbGameLogAutoSave, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .add(lblBattlefieldFeedbackColorizingMode) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(cbBattlefieldFeedbackColorizingMode, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 278, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); - main_gamelogLayout.setVerticalGroup( - main_gamelogLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(main_gamelogLayout.createSequentialGroup() - .add(cbGameLogAutoSave) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(cbDraftLogAutoSave)) + main_battlefieldLayout.setVerticalGroup( + main_battlefieldLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(main_battlefieldLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) + .add(lblBattlefieldFeedbackColorizingMode) + .add(cbBattlefieldFeedbackColorizingMode, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) ); org.jdesktop.layout.GroupLayout tabMainLayout = new org.jdesktop.layout.GroupLayout(tabMain); @@ -813,7 +847,8 @@ public class PreferencesDialog extends javax.swing.JDialog { .add(tabMainLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(org.jdesktop.layout.GroupLayout.TRAILING, main_card, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(org.jdesktop.layout.GroupLayout.TRAILING, main_gamelog, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .add(main_game, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .add(main_game, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .add(org.jdesktop.layout.GroupLayout.TRAILING, main_battlefield, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap()) ); tabMainLayout.setVerticalGroup( @@ -825,7 +860,9 @@ public class PreferencesDialog extends javax.swing.JDialog { .add(main_game, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(main_gamelog, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) - .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(main_battlefield, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .addContainerGap(154, Short.MAX_VALUE)) ); main_card.getAccessibleContext().setAccessibleName("Game panel"); @@ -2712,6 +2749,16 @@ public class PreferencesDialog extends javax.swing.JDialog { save(prefs, dialog.cbGameLogAutoSave, KEY_GAME_LOG_AUTO_SAVE, "true", "false", UPDATE_CACHE_POLICY); save(prefs, dialog.cbDraftLogAutoSave, KEY_DRAFT_LOG_AUTO_SAVE, "true", "false", UPDATE_CACHE_POLICY); + String paramName = KEY_BATTLEFIELD_FEEDBACK_COLORIZING_MODE; + int paramValue = dialog.cbBattlefieldFeedbackColorizingMode.getSelectedIndex(); + int paramDefault = BATTLEFIELD_FEEDBACK_COLORIZING_MODE_ENABLE_BY_MULTICOLOR; + if (getCachedValue(paramName, paramDefault) != paramValue) { + prefs.putInt(paramName, paramValue); + if (UPDATE_CACHE_POLICY) { + updateCache(paramName, Integer.toString(paramValue)); + } + } + // GUI Size boolean sizeGUIChanged = false; if (getCachedValue(KEY_GUI_TABLE_FONT_SIZE, 14) != dialog.sliderFontSize.getValue()) { @@ -3145,6 +3192,10 @@ public class PreferencesDialog extends javax.swing.JDialog { private void showFullImagePathActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_showFullImagePathActionPerformed }//GEN-LAST:event_showFullImagePathActionPerformed + private void cbBattlefieldFeedbackColorizingModeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbBattlefieldFeedbackColorizingModeActionPerformed + + }//GEN-LAST:event_cbBattlefieldFeedbackColorizingModeActionPerformed + private void showProxySettings() { Connection.ProxyType proxyType = (Connection.ProxyType) cbProxyType.getSelectedItem(); switch (proxyType) { @@ -3260,6 +3311,16 @@ public class PreferencesDialog extends javax.swing.JDialog { load(prefs, dialog.cbGameLogAutoSave, KEY_GAME_LOG_AUTO_SAVE, "true"); load(prefs, dialog.cbDraftLogAutoSave, KEY_DRAFT_LOG_AUTO_SAVE, "true"); + String feedbackParam = ""; + try { + feedbackParam = MageFrame.getPreferences().get(KEY_BATTLEFIELD_FEEDBACK_COLORIZING_MODE, "2"); + int feedbackMode = Integer.parseInt(feedbackParam); + dialog.cbBattlefieldFeedbackColorizingMode.setSelectedIndex(feedbackMode); + } catch (Throwable e) { + logger.error("Can't parse and setup param " + KEY_BATTLEFIELD_FEEDBACK_COLORIZING_MODE + " = " + feedbackParam, e); + dialog.cbBattlefieldFeedbackColorizingMode.setSelectedIndex(BATTLEFIELD_FEEDBACK_COLORIZING_MODE_ENABLE_BY_MULTICOLOR); + } + load(prefs, dialog.checkBoxUpkeepYou, UPKEEP_YOU, "on", "on"); load(prefs, dialog.checkBoxDrawYou, DRAW_YOU, "on", "on"); load(prefs, dialog.checkBoxMainYou, MAIN_YOU, "on", "on"); @@ -3759,6 +3820,12 @@ public class PreferencesDialog extends javax.swing.JDialog { ); } + public static int getBattlefieldFeedbackColorizingMode() { + return PreferencesDialog.getCachedValue( + PreferencesDialog.KEY_BATTLEFIELD_FEEDBACK_COLORIZING_MODE, + BATTLEFIELD_FEEDBACK_COLORIZING_MODE_ENABLE_BY_MULTICOLOR); + } + public List getKeybindButtons() { return Arrays.asList( keyCancelSkip, @@ -3785,6 +3852,7 @@ public class PreferencesDialog extends javax.swing.JDialog { private javax.swing.JCheckBox cbAllowRequestToShowHandCards; private javax.swing.JCheckBox cbAskMoveToGraveOrder; private javax.swing.JCheckBox cbAutoOrderTrigger; + private javax.swing.JComboBox cbBattlefieldFeedbackColorizingMode; private javax.swing.JCheckBox cbCardRenderHideSetSymbol; private javax.swing.JCheckBox cbCardRenderImageFallback; private javax.swing.JCheckBox cbCardRenderShowReminderText; @@ -3905,6 +3973,7 @@ public class PreferencesDialog extends javax.swing.JDialog { private javax.swing.JLabel labelToggleRecordMacro; private javax.swing.JLabel labelTooltipSize; private javax.swing.JLabel labelYourTurn; + private javax.swing.JLabel lblBattlefieldFeedbackColorizingMode; private javax.swing.JLabel lblProxyPassword; private javax.swing.JLabel lblProxyPort; private javax.swing.JLabel lblProxyServer; @@ -3912,6 +3981,7 @@ public class PreferencesDialog extends javax.swing.JDialog { private javax.swing.JLabel lblProxyUserName; private javax.swing.JLabel lblURLServerList; private javax.swing.JLabel lebelSkip; + private javax.swing.JPanel main_battlefield; private javax.swing.JPanel main_card; private javax.swing.JPanel main_game; private javax.swing.JPanel main_gamelog; diff --git a/Mage.Client/src/main/java/mage/client/game/HelperPanel.java b/Mage.Client/src/main/java/mage/client/game/HelperPanel.java index 0cfbde700a..f858e84944 100644 --- a/Mage.Client/src/main/java/mage/client/game/HelperPanel.java +++ b/Mage.Client/src/main/java/mage/client/game/HelperPanel.java @@ -27,12 +27,7 @@ */ package mage.client.game; -import java.awt.Color; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.GridLayout; -import java.awt.Point; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; @@ -49,11 +44,13 @@ import javax.swing.ScrollPaneConstants; import javax.swing.SwingUtilities; import javax.swing.ToolTipManager; import javax.swing.UIManager; +import javax.swing.border.EmptyBorder; import javax.swing.border.LineBorder; import mage.client.SessionHandler; import mage.client.components.MageTextArea; import mage.client.constants.Constants; +import mage.client.dialog.PreferencesDialog; import mage.client.game.FeedbackPanel.FeedbackMode; import static mage.client.game.FeedbackPanel.FeedbackMode.QUESTION; @@ -81,6 +78,7 @@ public class HelperPanel extends JPanel { //private javax.swing.JButton btnStopTimer; private JScrollPane textAreaScrollPane; private MageTextArea dialogTextArea; + JPanel mainPanel; JPanel buttonGrid; JPanel buttonContainer; @@ -136,13 +134,21 @@ public class HelperPanel extends JPanel { btnSpecial.setFont(GUISizeHelper.gameDialogAreaFont); btnUndo.setFont(GUISizeHelper.gameDialogAreaFont); + // update text fonts if (message != null) { - int pos = this.message.indexOf("font-size:"); - if (pos > 0) { - String newMessage = this.message.substring(0, pos + 10) + GUISizeHelper.gameDialogAreaFontSizeBig + this.message.substring(pos + 12); - pos = this.message.indexOf("font-size:", pos + 10); - if (pos > 0) { - newMessage = this.message.substring(0, pos + 10) + GUISizeHelper.gameDialogAreaFontSizeSmall + this.message.substring(pos + 12); + int pos1 = this.message.indexOf("font-size:"); + + if (pos1 > 0) { + int pos2 = this.message.indexOf("font-size:", pos1 + 10); + + String newMessage; + if (pos2 > 0) { + // 2 sizes: big + small // TODO: 2 sizes for compatibility only? On 04.02.2018 can't find two size texts (JayDi85) + newMessage = this.message.substring(0, pos1 + 10) + GUISizeHelper.gameDialogAreaFontSizeBig + this.message.substring(pos1 + 12); + newMessage = newMessage.substring(0, pos1 + 10) + GUISizeHelper.gameDialogAreaFontSizeSmall + newMessage.substring(pos1 + 12); + } else { + // 1 size: small + newMessage = this.message.substring(0, pos1 + 10) + GUISizeHelper.gameDialogAreaFontSizeSmall + this.message.substring(pos1 + 12); } setBasicMessage(newMessage); } @@ -158,9 +164,14 @@ public class HelperPanel extends JPanel { private void initComponents() { initPopupMenuTriggerOrder(); - setBackground(new Color(0, 0, 0, 100)); - setLayout(new GridLayout(0, 1)); - setOpaque(false); + + this.setBorder(new EmptyBorder(5, 5, 5, 5)); + this.setLayout(new GridLayout(0, 1)); + this.setOpaque(false); + mainPanel = new JPanel(); + mainPanel.setLayout(new GridLayout(0, 1)); + mainPanel.setOpaque(false); + this.add(mainPanel); dialogTextArea = new MageTextArea(); dialogTextArea.setText(""); @@ -172,12 +183,12 @@ public class HelperPanel extends JPanel { textAreaScrollPane.getViewport().setOpaque(false); textAreaScrollPane.setBorder(null); textAreaScrollPane.setViewportBorder(null); - add(textAreaScrollPane); + mainPanel.add(textAreaScrollPane); buttonContainer = new JPanel(); buttonContainer.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); buttonContainer.setOpaque(false); - add(buttonContainer); + mainPanel.add(buttonContainer); buttonGrid = new JPanel(); // buttons layout auto changes by autoSizeButtonsAndFeedbackState buttonGrid.setOpaque(false); @@ -335,6 +346,7 @@ public class HelperPanel extends JPanel { Color ACTIVE_FEEDBACK_BACKGROUND_COLOR_MAIN = new Color(0, 0, 255, 50); Color ACTIVE_FEEDBACK_BACKGROUND_COLOR_BATTLE = new Color(255, 0, 0, 50); Color ACTIVE_FEEDBACK_BACKGROUND_COLOR_OTHER = new Color(0, 255, 0, 50); + int FEEDBACK_COLORIZING_MODE = PreferencesDialog.getBattlefieldFeedbackColorizingMode(); // cleanup current settings to default (flow layout - different sizes) this.buttonGrid.setLayout(new FlowLayout(FlowLayout.CENTER, BUTTONS_H_GAP, 0)); @@ -349,23 +361,37 @@ public class HelperPanel extends JPanel { // color panel on player's feedback waiting if (this.gameNeedFeedback) { // wait player's action - this.setOpaque(true); + switch (FEEDBACK_COLORIZING_MODE) { + case Constants.BATTLEFIELD_FEEDBACK_COLORIZING_MODE_DISABLE: + // disabled + this.mainPanel.setOpaque(false); + this.mainPanel.setBorder(null); + break; - // different colors for different game phases - Color backColor = ACTIVE_FEEDBACK_BACKGROUND_COLOR_OTHER; - if (this.gameTurnPhase != null) { - switch (this.gameTurnPhase) { - case PRECOMBAT_MAIN: - case POSTCOMBAT_MAIN: - backColor = ACTIVE_FEEDBACK_BACKGROUND_COLOR_MAIN; - break; - case COMBAT: - backColor = ACTIVE_FEEDBACK_BACKGROUND_COLOR_BATTLE; - break; - } + case Constants.BATTLEFIELD_FEEDBACK_COLORIZING_MODE_ENABLE_BY_ONE_COLOR: + // one color + this.mainPanel.setOpaque(true); + this.mainPanel.setBackground(ACTIVE_FEEDBACK_BACKGROUND_COLOR_OTHER); + break; + + case Constants.BATTLEFIELD_FEEDBACK_COLORIZING_MODE_ENABLE_BY_MULTICOLOR: + // multicolor + this.mainPanel.setOpaque(true); + Color backColor = ACTIVE_FEEDBACK_BACKGROUND_COLOR_OTHER; + if (this.gameTurnPhase != null) { + switch (this.gameTurnPhase) { + case PRECOMBAT_MAIN: + case POSTCOMBAT_MAIN: + backColor = ACTIVE_FEEDBACK_BACKGROUND_COLOR_MAIN; + break; + case COMBAT: + backColor = ACTIVE_FEEDBACK_BACKGROUND_COLOR_BATTLE; + break; + } + } + this.mainPanel.setBackground(backColor); + break; } - this.setBackground(backColor); - } else { // inform about other players this.setOpaque(false);