* Added preferences setting to switch on/off to write card names in bigger font on card panels.

This commit is contained in:
LevelX2 2014-09-26 19:40:57 +02:00
parent 070e8609f4
commit 54ec3b658e
4 changed files with 59 additions and 17 deletions

View file

@ -66,13 +66,13 @@
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="main_card" alignment="1" max="32767" attributes="0"/>
<Component id="main_game" alignment="0" pref="533" max="32767" attributes="0"/>
<Component id="main_game" alignment="0" max="32767" attributes="0"/>
<Component id="main_gamelog" alignment="1" max="32767" attributes="0"/>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -80,12 +80,12 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="main_card" min="-2" pref="68" max="-2" attributes="0"/>
<Component id="main_card" min="-2" pref="93" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="main_game" min="-2" pref="91" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="main_gamelog" min="-2" pref="49" max="-2" attributes="0"/>
<EmptySpace pref="171" max="32767" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -142,6 +142,25 @@
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JCheckBox" name="showCardName">
<Properties>
<Property name="selected" type="boolean" value="true"/>
<Property name="text" type="java.lang.String" value="Show card name on card panel"/>
<Property name="toolTipText" type="java.lang.String" value="Write the card&apos;s name on the card to make the card name more recognizable."/>
<Property name="actionCommand" type="java.lang.String" value=""/>
<Property name="cursor" type="java.awt.Cursor" editor="org.netbeans.modules.form.editors2.CursorEditor">
<Color id="Standardcursor"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="showCardNameActionPerformed"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Last"/>
</Constraint>
</Constraints>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="main_game">

View file

@ -79,6 +79,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
public static final String KEY_SHOW_TOOLTIPS_ANY_ZONE = "showTooltipsInAnyZone";
public static final String KEY_HAND_USE_BIG_CARDS = "handUseBigCards";
public static final String KEY_SHOW_CARD_NAMES = "showCardNames";
public static final String KEY_PERMANENTS_IN_ONE_PILE = "nonLandPermanentsInOnePile";
public static final String KEY_SHOW_PLAYER_NAMES_PERMANENTLY = "showPlayerNamesPermanently";
public static final String KEY_SHOW_ABILITY_PICKER_FORCED = "showAbilityPicker";
@ -300,6 +301,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
main_card = new javax.swing.JPanel();
displayBigCardsInHand = new javax.swing.JCheckBox();
showToolTipsInAnyZone = new javax.swing.JCheckBox();
showCardName = new javax.swing.JCheckBox();
main_game = new javax.swing.JPanel();
nonLandPermanentsInOnePile = new javax.swing.JCheckBox();
showPlayerNamesPermanently = new javax.swing.JCheckBox();
@ -421,6 +423,18 @@ public class PreferencesDialog extends javax.swing.JDialog {
});
main_card.add(showToolTipsInAnyZone, java.awt.BorderLayout.CENTER);
showCardName.setSelected(true);
showCardName.setText("Show card name on card panel");
showCardName.setToolTipText("Write the card's name on the card to make the card name more recognizable.");
showCardName.setActionCommand("");
showCardName.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
showCardName.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
showCardNameActionPerformed(evt);
}
});
main_card.add(showCardName, java.awt.BorderLayout.PAGE_END);
main_game.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Game"));
main_game.setLayout(new java.awt.BorderLayout());
@ -477,7 +491,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
.addContainerGap()
.addGroup(tabMainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(main_card, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(main_game, javax.swing.GroupLayout.DEFAULT_SIZE, 533, Short.MAX_VALUE)
.addComponent(main_game, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(main_gamelog, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
@ -485,12 +499,12 @@ public class PreferencesDialog extends javax.swing.JDialog {
tabMainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(tabMainLayout.createSequentialGroup()
.addContainerGap()
.addComponent(main_card, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(main_card, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(main_game, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(main_gamelog, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(171, Short.MAX_VALUE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
main_card.getAccessibleContext().setAccessibleName("Game panel");
@ -830,7 +844,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
.addComponent(panelCardImages, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(panelBackgroundImages, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(54, Short.MAX_VALUE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
tabsPanel.addTab("Images", tabImages);
@ -1365,8 +1379,9 @@ public class PreferencesDialog extends javax.swing.JDialog {
Preferences prefs = MageFrame.getPreferences();
// main
save(prefs, dialog.showToolTipsInAnyZone, KEY_SHOW_TOOLTIPS_ANY_ZONE, "true", "false", UPDATE_CACHE_POLICY);
save(prefs, dialog.showCardName, KEY_SHOW_TOOLTIPS_ANY_ZONE, "true", "false", UPDATE_CACHE_POLICY);
save(prefs, dialog.displayBigCardsInHand, KEY_HAND_USE_BIG_CARDS, "true", "false", UPDATE_CACHE_POLICY);
save(prefs, dialog.showCardName, KEY_SHOW_CARD_NAMES, "true", "false", UPDATE_CACHE_POLICY);
save(prefs, dialog.nonLandPermanentsInOnePile, KEY_PERMANENTS_IN_ONE_PILE, "true", "false", UPDATE_CACHE_POLICY);
save(prefs, dialog.showPlayerNamesPermanently, KEY_SHOW_PLAYER_NAMES_PERMANENTLY, "true", "false", UPDATE_CACHE_POLICY);
save(prefs, dialog.showAbilityPickerForced, KEY_SHOW_ABILITY_PICKER_FORCED, "true", "false", UPDATE_CACHE_POLICY);
@ -1630,9 +1645,9 @@ public class PreferencesDialog extends javax.swing.JDialog {
}//GEN-LAST:event_displayBigCardsInHandActionPerformed
private void showToolTipsInAnyZoneActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_showToolTipsInAnyZoneActionPerformed
private void showCardNameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_showCardNameActionPerformed
}//GEN-LAST:event_showToolTipsInAnyZoneActionPerformed
}//GEN-LAST:event_showCardNameActionPerformed
private void showAbilityPickerForcedActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_showAbilityPickerForcedActionPerformed
// TODO add your handling code here:
@ -1642,6 +1657,10 @@ public class PreferencesDialog extends javax.swing.JDialog {
// TODO add your handling code here:
}//GEN-LAST:event_cbEnableOtherSoundsActionPerformed
private void showToolTipsInAnyZoneActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_showToolTipsInAnyZoneActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_showToolTipsInAnyZoneActionPerformed
private void showProxySettings() {
if (cbProxyType.getSelectedItem() == Connection.ProxyType.SOCKS) {
this.pnlProxy.setVisible(true);
@ -1724,7 +1743,8 @@ public class PreferencesDialog extends javax.swing.JDialog {
load(prefs, dialog.checkBoxEndTurnOthers, END_OF_TURN_OTHERS);
load(prefs, dialog.displayBigCardsInHand, KEY_HAND_USE_BIG_CARDS, "true");
load(prefs, dialog.showToolTipsInAnyZone, KEY_SHOW_TOOLTIPS_ANY_ZONE, "true");
load(prefs, dialog.showCardName, KEY_SHOW_CARD_NAMES, "true");
load(prefs, dialog.showCardName, KEY_SHOW_TOOLTIPS_ANY_ZONE, "true");
load(prefs, dialog.nonLandPermanentsInOnePile, KEY_PERMANENTS_IN_ONE_PILE, "true");
load(prefs, dialog.showPlayerNamesPermanently, KEY_SHOW_PLAYER_NAMES_PERMANENTLY, "true");
load(prefs, dialog.showAbilityPickerForced, KEY_SHOW_ABILITY_PICKER_FORCED, "true");
@ -2134,6 +2154,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
private javax.swing.JCheckBox rememberPswd;
private javax.swing.JButton saveButton;
private javax.swing.JCheckBox showAbilityPickerForced;
private javax.swing.JCheckBox showCardName;
private javax.swing.JCheckBox showPlayerNamesPermanently;
private javax.swing.JCheckBox showToolTipsInAnyZone;
private javax.swing.JPanel sounds_backgroundMusic;

View file

@ -72,7 +72,7 @@ public class HandPanel extends JPanel {
}
private Dimension getHandCardDimension() {
String useBigCards = MageFrame.getPreferences().get(PreferencesDialog.KEY_HAND_USE_BIG_CARDS, "false");
String useBigCards = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_HAND_USE_BIG_CARDS, "true");
if (!smallMode && useBigCards.equals("true")) {
return handCardDimensionBig;
}

View file

@ -31,6 +31,7 @@ import mage.cards.MagePermanent;
import mage.cards.TextPopup;
import mage.cards.action.ActionCallback;
import mage.cards.action.TransferData;
import mage.client.dialog.PreferencesDialog;
import mage.client.plugins.adapters.MageActionCallback;
import mage.client.plugins.impl.Plugins;
import mage.client.util.ImageHelper;
@ -259,6 +260,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
addMouseMotionListener(this);
addMouseWheelListener(this);
displayTitleAnyway = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_SHOW_TOOLTIPS_ANY_ZONE, "true").equals("true");
titleText = new GlowText();
setText(gameCard);
titleText.setFont(getFont().deriveFont(Font.BOLD, 13f));
@ -266,7 +268,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
titleText.setGlow(Color.black, TEXT_GLOW_SIZE, TEXT_GLOW_INTENSITY);
titleText.setWrap(true);
add(titleText);
ptText = new GlowText();
if (CardUtil.isCreature(gameCard)) {
ptText.setText(gameCard.getPower() + "/" + gameCard.getToughness());
@ -580,8 +582,8 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
ptText.setVisible(showText);
int titleX = Math.round(cardWidth * (20f / 480));
int titleY = Math.round(cardHeight * (9f / 680));
titleText.setBounds(cardXOffset + titleX, cardYOffset + titleY, cardWidth - titleX, cardHeight);
int titleY = Math.round(cardHeight * (9f / 680)) + 10;
titleText.setBounds(cardXOffset + titleX, cardYOffset + titleY, cardWidth - titleX, cardHeight - titleY);
Dimension ptSize = ptText.getPreferredSize();
ptText.setSize(ptSize.width, ptSize.height);