diff --git a/Mage.Client/src/main/java/mage/client/cards/CardEventSource.java b/Mage.Client/src/main/java/mage/client/cards/CardEventSource.java index e4ec1eceddf..22c5d1cb0b4 100644 --- a/Mage.Client/src/main/java/mage/client/cards/CardEventSource.java +++ b/Mage.Client/src/main/java/mage/client/cards/CardEventSource.java @@ -57,7 +57,7 @@ public class CardEventSource implements EventSource, Serializable { dispatcher.fireEvent(new Event(card, message)); } - public void shiftDoubleClick(SimpleCardView card, String message) { + public void altDoubleClick(SimpleCardView card, String message) { dispatcher.fireEvent(new Event(card, message)); } diff --git a/Mage.Client/src/main/java/mage/client/cards/CardGrid.java b/Mage.Client/src/main/java/mage/client/cards/CardGrid.java index 4fb751db74c..a2369fe3149 100644 --- a/Mage.Client/src/main/java/mage/client/cards/CardGrid.java +++ b/Mage.Client/src/main/java/mage/client/cards/CardGrid.java @@ -306,14 +306,14 @@ public class CardGrid extends javax.swing.JLayeredPane implements MouseListener, e.consume(); Object obj = e.getSource(); if (obj instanceof Card) { - if (e.isShiftDown()) { - cardEventSource.shiftDoubleClick(((Card) obj).getOriginal(), "shift-double-click"); + if (e.isAltDown()) { + cardEventSource.altDoubleClick(((Card) obj).getOriginal(), "alt-double-click"); } else { cardEventSource.doubleClick(((Card) obj).getOriginal(), "double-click"); } } else if (obj instanceof MageCard) { - if (e.isShiftDown()) { - cardEventSource.shiftDoubleClick(((MageCard) obj).getOriginal(), "shift-double-click"); + if (e.isAltDown()) { + cardEventSource.altDoubleClick(((MageCard) obj).getOriginal(), "alt-double-click"); } else { cardEventSource.doubleClick(((MageCard) obj).getOriginal(), "double-click"); } diff --git a/Mage.Client/src/main/java/mage/client/cards/CardsList.form b/Mage.Client/src/main/java/mage/client/cards/CardsList.form index 764a8a2619b..54af84ac6da 100644 --- a/Mage.Client/src/main/java/mage/client/cards/CardsList.form +++ b/Mage.Client/src/main/java/mage/client/cards/CardsList.form @@ -1,6 +1,6 @@ -
+ @@ -34,16 +34,21 @@ - - + + + + + + + - - - + + + @@ -67,22 +72,27 @@ - - - - - - - - + + + + + + + + + + + + + - - + + - + @@ -90,17 +100,20 @@ - - + - + + + + - + + - + @@ -108,22 +121,117 @@ - - - - - - + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -138,14 +246,15 @@ - + - + + - + @@ -164,6 +273,10 @@ + + + + @@ -174,7 +287,7 @@ - + @@ -193,11 +306,12 @@ + - + diff --git a/Mage.Client/src/main/java/mage/client/cards/CardsList.java b/Mage.Client/src/main/java/mage/client/cards/CardsList.java index 87db55c6a32..4713e383dbc 100644 --- a/Mage.Client/src/main/java/mage/client/cards/CardsList.java +++ b/Mage.Client/src/main/java/mage/client/cards/CardsList.java @@ -34,9 +34,10 @@ package mage.client.cards; - - -import java.awt.*; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Rectangle; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; @@ -45,22 +46,33 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.UUID; -import javax.swing.*; +import javax.swing.DefaultComboBoxModel; +import javax.swing.JTable; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.TableColumn; import javax.swing.table.TableColumnModel; -import mage.constants.CardType; import mage.cards.MageCard; import mage.client.constants.Constants.DeckEditorMode; import mage.client.constants.Constants.SortBy; +import static mage.client.constants.Constants.SortBy.CASTING_COST; +import static mage.client.constants.Constants.SortBy.COLOR; +import static mage.client.constants.Constants.SortBy.COLOR_DETAILED; +import static mage.client.constants.Constants.SortBy.RARITY; import mage.client.deckeditor.SortSetting; import mage.client.deckeditor.table.TableModel; import mage.client.deckeditor.table.UpdateCountsCallback; import mage.client.dialog.PreferencesDialog; import mage.client.plugins.impl.Plugins; -import mage.client.util.*; +import mage.client.util.CardViewColorComparator; +import mage.client.util.CardViewColorDetailedComparator; +import mage.client.util.CardViewCostComparator; +import mage.client.util.CardViewNameComparator; +import mage.client.util.CardViewRarityComparator; +import mage.client.util.Config; import mage.client.util.Event; +import mage.client.util.Listener; import mage.client.util.gui.TableSpinnerEditor; +import mage.constants.CardType; import mage.view.CardView; import mage.view.CardsView; import org.mage.card.arcane.CardPanel; @@ -164,8 +176,8 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar public void mousePressed(MouseEvent e) { if (e.getClickCount() == 2 && !e.isConsumed()) { e.consume(); - if (e.isShiftDown()) { - handleShiftDoubleClick(); + if (e.isAltDown()) { + handleAltDoubleClick(); } else { handleDoubleClick(); } @@ -173,7 +185,7 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar } }); - mainModel.setUpdateCountsCallback(new UpdateCountsCallback(lblCount, lblCreatureCount, lblLandCount)); + mainModel.setUpdateCountsCallback(new UpdateCountsCallback(lblCount, lblCreatureCount, lblLandCount, lblSorceryCount, lblInstantCount, lblEnchantmentCount)); } // if you use the deck ediot to build a free deck, numbers can be set directly in deck and sideboard @@ -192,11 +204,7 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar public void handleSetNumber(int number) { if (mainTable.getSelectedRowCount() == 1) { - int[] n = mainTable.getSelectedRows(); - List indexes = asList(n); - for (Integer index : indexes) { - mainModel.setNumber(index, number); - } + mainModel.setNumber(mainTable.getSelectedRow(), number); } } @@ -211,13 +219,13 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar } } - public void handleShiftDoubleClick() { + public void handleAltDoubleClick() { if (mainTable.getSelectedRowCount() > 0) { int[] n = mainTable.getSelectedRows(); List indexes = asList(n); Collections.reverse(indexes); for (Integer index : indexes) { - mainModel.shiftDoubleClick(index); + mainModel.altDoubleClick(index); } } } @@ -236,6 +244,10 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar public void loadCards(CardsView showCards, BigCard bigCard, UUID gameId) { + int selectedRow = -1; + if (currentView.equals(mainModel)) { + selectedRow = mainTable.getSelectedRow(); + } this.cards = showCards; this.bigCard = bigCard; this.gameId = gameId; @@ -243,6 +255,12 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar cbSortBy.setSelectedItem(sortSetting.getSortBy()); chkPiles.setSelected(sortSetting.isPilesToggle()); currentView.loadCards(showCards, sortSetting, bigCard, gameId); + if (selectedRow >= 0) { + selectedRow = Math.min(selectedRow, mainTable.getRowCount()-1); + if (selectedRow >= 0) { + mainTable.setRowSelectionInterval(selectedRow, selectedRow); + } + } } private void redrawCards() { @@ -260,6 +278,9 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar int curRow = 0; int landCount = 0; int creatureCount = 0; + int sorceryCount = 0; + int instantCount = 0; + int enchantmentCount = 0; //FIXME: why we remove all cards? for performance it's better to merge changes // as it is already done in ListView cardArea.removeAll(); @@ -323,36 +344,41 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar } rectangle.setLocation(curColumn * Config.dimensions.frameWidth, curRow * 20); addCard(card, bigCard, gameId, rectangle); - if (card.getCardTypes().contains(CardType.LAND)) { - landCount++; - } - if (card.getCardTypes().contains(CardType.CREATURE)) { - creatureCount++; - } curRow++; lastCard = card; - } - else { + } else { rectangle.setLocation(curColumn * Config.dimensions.frameWidth, curRow * 20); addCard(card, bigCard, gameId, rectangle); - if (card.getCardTypes().contains(CardType.LAND)) { - landCount++; - } - if (card.getCardTypes().contains(CardType.CREATURE)) { - creatureCount++; - } curColumn++; if (curColumn == numColumns) { curColumn = 0; curRow++; } } + if (card.getCardTypes().contains(CardType.LAND)) { + landCount++; + } + if (card.getCardTypes().contains(CardType.CREATURE)) { + creatureCount++; + } + if (card.getCardTypes().contains(CardType.SORCERY)) { + sorceryCount++; + } + if (card.getCardTypes().contains(CardType.INSTANT)) { + instantCount++; + } + if (card.getCardTypes().contains(CardType.ENCHANTMENT)) { + enchantmentCount++; + } } } int count = cards != null ? cards.size() : 0; - this.lblCount.setText("Count: " + Integer.toString(count)); - this.lblCreatureCount.setText("Creatures: " + Integer.toString(creatureCount)); - this.lblLandCount.setText("Lands: " + Integer.toString(landCount)); + this.lblCount.setText(Integer.toString(count)); + this.lblCreatureCount.setText(Integer.toString(creatureCount)); + this.lblLandCount.setText(Integer.toString(landCount)); + this.lblSorceryCount.setText(Integer.toString(sorceryCount)); + this.lblInstantCount.setText(Integer.toString(instantCount)); + this.lblEnchantmentCount.setText(Integer.toString(enchantmentCount)); cardArea.setPreferredSize(new Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight + 200)); cardArea.revalidate(); this.revalidate(); @@ -411,12 +437,16 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { + java.awt.GridBagConstraints gridBagConstraints; bgView = new javax.swing.ButtonGroup(); panelControl = new javax.swing.JPanel(); lblCount = new javax.swing.JLabel(); - lblCreatureCount = new javax.swing.JLabel(); lblLandCount = new javax.swing.JLabel(); + lblCreatureCount = new javax.swing.JLabel(); + lblSorceryCount = new javax.swing.JLabel(); + lblInstantCount = new javax.swing.JLabel(); + lblEnchantmentCount = new javax.swing.JLabel(); chkPiles = new javax.swing.JCheckBox(); cbSortBy = new javax.swing.JComboBox(); jToggleListView = new javax.swing.JToggleButton(); @@ -437,13 +467,73 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar panelControl.setPreferredSize(new java.awt.Dimension(616, 23)); panelControl.setRequestFocusEnabled(false); - lblCount.setText("Card Count"); + lblCount.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/deck_pack.png"))); // NOI18N + lblCount.setText("999"); + lblCount.setToolTipText("Number of all cards in this area."); + lblCount.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); + lblCount.setFocusable(false); + lblCount.setInheritsPopupMenu(false); + lblCount.setRequestFocusEnabled(false); + lblCount.setVerifyInputWhenFocusTarget(false); - lblCreatureCount.setText("Creature Count"); + lblLandCount.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); + lblLandCount.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/type_land.png"))); // NOI18N + lblLandCount.setText("999"); + lblLandCount.setToolTipText("Number of lands."); + lblLandCount.setVerticalAlignment(javax.swing.SwingConstants.TOP); + lblLandCount.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); + lblLandCount.setFocusable(false); + lblLandCount.setInheritsPopupMenu(false); + lblLandCount.setRequestFocusEnabled(false); + lblLandCount.setVerifyInputWhenFocusTarget(false); - lblLandCount.setText("Land Count"); + lblCreatureCount.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); + lblCreatureCount.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/type_creatures.png"))); // NOI18N + lblCreatureCount.setText("999"); + lblCreatureCount.setToolTipText("Number of creatures."); + lblCreatureCount.setVerticalAlignment(javax.swing.SwingConstants.TOP); + lblCreatureCount.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); + lblCreatureCount.setFocusable(false); + lblCreatureCount.setInheritsPopupMenu(false); + lblCreatureCount.setRequestFocusEnabled(false); + lblCreatureCount.setVerifyInputWhenFocusTarget(false); + + lblSorceryCount.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); + lblSorceryCount.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/type_sorcery.png"))); // NOI18N + lblSorceryCount.setText("999"); + lblSorceryCount.setToolTipText("Number of sorceries."); + lblSorceryCount.setVerticalAlignment(javax.swing.SwingConstants.TOP); + lblSorceryCount.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); + lblSorceryCount.setFocusable(false); + lblSorceryCount.setInheritsPopupMenu(false); + lblSorceryCount.setRequestFocusEnabled(false); + lblSorceryCount.setVerifyInputWhenFocusTarget(false); + + lblInstantCount.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); + lblInstantCount.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/type_instant.png"))); // NOI18N + lblInstantCount.setText("999"); + lblInstantCount.setToolTipText("Number of instants."); + lblInstantCount.setVerticalAlignment(javax.swing.SwingConstants.TOP); + lblInstantCount.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); + lblInstantCount.setFocusable(false); + lblInstantCount.setInheritsPopupMenu(false); + lblInstantCount.setRequestFocusEnabled(false); + lblInstantCount.setVerifyInputWhenFocusTarget(false); + + lblEnchantmentCount.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); + lblEnchantmentCount.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/type_enchantment.png"))); // NOI18N + lblEnchantmentCount.setText("999"); + lblEnchantmentCount.setToolTipText("Number of enchantments."); + lblEnchantmentCount.setVerticalAlignment(javax.swing.SwingConstants.TOP); + lblEnchantmentCount.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); + lblEnchantmentCount.setFocusable(false); + lblEnchantmentCount.setInheritsPopupMenu(false); + lblEnchantmentCount.setRequestFocusEnabled(false); + lblEnchantmentCount.setVerifyInputWhenFocusTarget(false); chkPiles.setText("Piles"); + chkPiles.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); + chkPiles.setMargin(new java.awt.Insets(3, 2, 2, 2)); chkPiles.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { chkPilesActionPerformed(evt); @@ -452,10 +542,11 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar cbSortBy.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "SortBy" })); cbSortBy.setToolTipText("Sort the cards if card view is active."); - cbSortBy.setMaximumSize(new java.awt.Dimension(80, 20)); - cbSortBy.setMinimumSize(new java.awt.Dimension(80, 20)); + cbSortBy.setMaximumSize(new java.awt.Dimension(120, 20)); + cbSortBy.setMinimumSize(new java.awt.Dimension(120, 20)); cbSortBy.setName("SortBy"); // NOI18N - cbSortBy.setPreferredSize(new java.awt.Dimension(80, 20)); + cbSortBy.setOpaque(false); + cbSortBy.setPreferredSize(new java.awt.Dimension(120, 20)); cbSortBy.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cbSortByActionPerformed(evt); @@ -465,10 +556,12 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar bgView.add(jToggleListView); jToggleListView.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/list_panel.png"))); // NOI18N jToggleListView.setToolTipText("Shows the cards as a list."); + jToggleListView.setBorder(null); + jToggleListView.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING); jToggleListView.setMargin(new java.awt.Insets(2, 6, 2, 6)); jToggleListView.setMaximumSize(new java.awt.Dimension(37, 25)); jToggleListView.setMinimumSize(new java.awt.Dimension(37, 25)); - jToggleListView.setPreferredSize(new java.awt.Dimension(37, 22)); + jToggleListView.setPreferredSize(new java.awt.Dimension(44, 22)); jToggleListView.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jToggleListViewActionPerformed(evt); @@ -478,8 +571,9 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar bgView.add(jToggleCardView); jToggleCardView.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/card_panel.png"))); // NOI18N jToggleCardView.setToolTipText("Shows the card as images."); + jToggleCardView.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING); jToggleCardView.setMargin(new java.awt.Insets(2, 6, 2, 6)); - jToggleCardView.setPreferredSize(new java.awt.Dimension(33, 22)); + jToggleCardView.setPreferredSize(new java.awt.Dimension(40, 22)); jToggleCardView.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jToggleCardViewActionPerformed(evt); @@ -490,36 +584,44 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar panelControl.setLayout(panelControlLayout); panelControlLayout.setHorizontalGroup( panelControlLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelControlLayout.createSequentialGroup() - .addContainerGap() - .addComponent(lblCount, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(panelControlLayout.createSequentialGroup() + .addComponent(lblCount) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(lblCreatureCount, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(lblLandCount) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(lblCreatureCount) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(lblSorceryCount) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(lblInstantCount) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(lblEnchantmentCount) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(lblLandCount, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(chkPiles) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(cbSortBy, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(cbSortBy, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jToggleListView, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jToggleCardView, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(287, 287, 287)) + .addGap(0, 55, Short.MAX_VALUE)) ); panelControlLayout.setVerticalGroup( panelControlLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelControlLayout.createSequentialGroup() .addGroup(panelControlLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelControlLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(cbSortBy, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lblCount) - .addComponent(lblCreatureCount) .addComponent(lblLandCount) - .addComponent(chkPiles) - .addComponent(jToggleListView, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(lblCreatureCount) + .addComponent(lblSorceryCount) + .addComponent(lblInstantCount, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(lblEnchantmentCount) + .addComponent(chkPiles)) + .addComponent(cbSortBy, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jToggleListView, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jToggleCardView, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addContainerGap()) + .addGap(0, 0, 0)) ); jToggleListView.getAccessibleContext().setAccessibleDescription("Switch between image and table view."); @@ -531,15 +633,18 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(panelCardArea) - .addComponent(panelControl, javax.swing.GroupLayout.DEFAULT_SIZE, 818, Short.MAX_VALUE) + .addGroup(layout.createSequentialGroup() + .addGap(1, 1, 1) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(panelControl, javax.swing.GroupLayout.DEFAULT_SIZE, 654, Short.MAX_VALUE) + .addComponent(panelCardArea))) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() - .addComponent(panelControl, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(panelControl, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, 0) - .addComponent(panelCardArea, javax.swing.GroupLayout.DEFAULT_SIZE, 69, Short.MAX_VALUE)) + .addComponent(panelCardArea, javax.swing.GroupLayout.DEFAULT_SIZE, 266, Short.MAX_VALUE)) ); }// //GEN-END:initComponents @@ -580,7 +685,10 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar private javax.swing.JToggleButton jToggleListView; private javax.swing.JLabel lblCount; private javax.swing.JLabel lblCreatureCount; + private javax.swing.JLabel lblEnchantmentCount; + private javax.swing.JLabel lblInstantCount; private javax.swing.JLabel lblLandCount; + private javax.swing.JLabel lblSorceryCount; private javax.swing.JScrollPane panelCardArea; private javax.swing.JPanel panelControl; // End of variables declaration//GEN-END:variables @@ -595,15 +703,15 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar e.consume(); Object obj = e.getSource(); if (obj instanceof Card) { - if (e.isShiftDown()) { - cardEventSource.shiftDoubleClick(((Card)obj).getOriginal(), "shift-double-click"); + if (e.isAltDown()) { + cardEventSource.altDoubleClick(((Card)obj).getOriginal(), "alt-double-click"); } else { cardEventSource.doubleClick(((Card)obj).getOriginal(), "double-click"); } } else if (obj instanceof MageCard) { - if (e.isShiftDown()) { - cardEventSource.shiftDoubleClick(((MageCard)obj).getOriginal(), "shift-double-click"); + if (e.isAltDown()) { + cardEventSource.altDoubleClick(((MageCard)obj).getOriginal(), "alt-double-click"); } else { cardEventSource.doubleClick(((MageCard)obj).getOriginal(), "double-click"); diff --git a/Mage.Client/src/main/java/mage/client/deckeditor/CardSelector.form b/Mage.Client/src/main/java/mage/client/deckeditor/CardSelector.form index 0c5ec8cd5fd..b3c2a7d1ce0 100644 --- a/Mage.Client/src/main/java/mage/client/deckeditor/CardSelector.form +++ b/Mage.Client/src/main/java/mage/client/deckeditor/CardSelector.form @@ -21,9 +21,9 @@ - + - + @@ -45,7 +45,7 @@ - + @@ -144,7 +144,7 @@ - + @@ -235,7 +235,7 @@ - + @@ -243,103 +243,133 @@ - + + + + + - - + - + - + + + + + - - + - + - + + + + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + + + + - + + + + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -448,6 +478,9 @@ + + + @@ -514,7 +547,7 @@ - + @@ -525,7 +558,7 @@ - + @@ -537,7 +570,7 @@ - + @@ -548,7 +581,7 @@ - + @@ -617,7 +650,7 @@ - + @@ -640,7 +673,7 @@ - + diff --git a/Mage.Client/src/main/java/mage/client/deckeditor/CardSelector.java b/Mage.Client/src/main/java/mage/client/deckeditor/CardSelector.java index 9d389f57db0..f54c1fcd9d4 100644 --- a/Mage.Client/src/main/java/mage/client/deckeditor/CardSelector.java +++ b/Mage.Client/src/main/java/mage/client/deckeditor/CardSelector.java @@ -144,6 +144,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene mainTable.getColumnModel().getColumn(6).setPreferredWidth(15); mainTable.getColumnModel().getColumn(7).setPreferredWidth(15); + // mainTable.setToolTipText(cardSelectorScrollPane.getToolTipText()); cardSelectorScrollPane.setViewportView(mainTable); mainTable.setOpaque(false); cbSortBy.setEnabled(false); @@ -154,7 +155,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene public void mousePressed(MouseEvent e) { if (e.getClickCount() == 2 && !e.isConsumed()) { e.consume(); - if (e.isShiftDown()) { + if (e.isAltDown()) { jButtonAddToSideboardActionPerformed(null); } else { jButtonAddToMainActionPerformed(null); @@ -242,25 +243,25 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene filter.add(Predicates.or(predicates)); predicates.clear(); - if (this.rdoLand.isSelected()) { + if (this.tbLand.isSelected()) { predicates.add(new CardTypePredicate(CardType.LAND)); } - if (this.rdoArtifacts.isSelected()) { + if (this.tbArifiacts.isSelected()) { predicates.add(new CardTypePredicate(CardType.ARTIFACT)); } - if (this.rdoCreatures.isSelected()) { + if (this.tbCreatures.isSelected()) { predicates.add(new CardTypePredicate(CardType.CREATURE)); } - if (this.rdoEnchantments.isSelected()) { + if (this.tbEnchantments.isSelected()) { predicates.add(new CardTypePredicate(CardType.ENCHANTMENT)); } - if (this.rdoInstants.isSelected()) { + if (this.tbInstants.isSelected()) { predicates.add(new CardTypePredicate(CardType.INSTANT)); } - if (this.rdoSorceries.isSelected()) { + if (this.tbSorceries.isSelected()) { predicates.add(new CardTypePredicate(CardType.SORCERY)); } - if (this.rdoPlaneswalkers.isSelected()) { + if (this.tbPlaneswalkers.isSelected()) { predicates.add(new CardTypePredicate(CardType.PLANESWALKER)); } filter.add(Predicates.or(predicates)); @@ -290,25 +291,25 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene criteria.white(this.tbWhite.isSelected()); criteria.colorless(this.tbColorless.isSelected()); - if (this.rdoLand.isSelected()) { + if (this.tbLand.isSelected()) { criteria.types(CardType.LAND); } - if (this.rdoArtifacts.isSelected()) { + if (this.tbArifiacts.isSelected()) { criteria.types(CardType.ARTIFACT); } - if (this.rdoCreatures.isSelected()) { + if (this.tbCreatures.isSelected()) { criteria.types(CardType.CREATURE); } - if (this.rdoEnchantments.isSelected()) { + if (this.tbEnchantments.isSelected()) { criteria.types(CardType.ENCHANTMENT); } - if (this.rdoInstants.isSelected()) { + if (this.tbInstants.isSelected()) { criteria.types(CardType.INSTANT); } - if (this.rdoSorceries.isSelected()) { + if (this.tbSorceries.isSelected()) { criteria.types(CardType.SORCERY); } - if (this.rdoPlaneswalkers.isSelected()) { + if (this.tbPlaneswalkers.isSelected()) { criteria.types(CardType.PLANESWALKER); } @@ -349,13 +350,13 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene // ALT or CTRL button was pushed if ((modifiers & ActionEvent.ALT_MASK) == ActionEvent.ALT_MASK || (modifiers & ActionEvent.CTRL_MASK) == ActionEvent.CTRL_MASK) { boolean invert = (modifiers & ActionEvent.ALT_MASK) == ActionEvent.ALT_MASK; - rdoArtifacts.setSelected(inverter(invert, rdoArtifacts.getActionCommand(), actionCommand)); - rdoCreatures.setSelected(inverter(invert, rdoCreatures.getActionCommand(), actionCommand)); - rdoEnchantments.setSelected(inverter(invert, rdoEnchantments.getActionCommand(), actionCommand)); - rdoInstants.setSelected(inverter(invert, rdoInstants.getActionCommand(), actionCommand)); - rdoLand.setSelected(inverter(invert, rdoLand.getActionCommand(), actionCommand)); - rdoPlaneswalkers.setSelected(inverter(invert, rdoPlaneswalkers.getActionCommand(), actionCommand)); - rdoSorceries.setSelected(inverter(invert, rdoSorceries.getActionCommand(), actionCommand)); + tbArifiacts.setSelected(inverter(invert, tbArifiacts.getActionCommand(), actionCommand)); + tbCreatures.setSelected(inverter(invert, tbCreatures.getActionCommand(), actionCommand)); + tbEnchantments.setSelected(inverter(invert, tbEnchantments.getActionCommand(), actionCommand)); + tbInstants.setSelected(inverter(invert, tbInstants.getActionCommand(), actionCommand)); + tbLand.setSelected(inverter(invert, tbLand.getActionCommand(), actionCommand)); + tbPlaneswalkers.setSelected(inverter(invert, tbPlaneswalkers.getActionCommand(), actionCommand)); + tbSorceries.setSelected(inverter(invert, tbSorceries.getActionCommand(), actionCommand)); } filterCards(); } @@ -437,14 +438,14 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene btnBooster = new javax.swing.JButton(); btnClear = new javax.swing.JButton(); tbTypes = new javax.swing.JToolBar(); - rdoLand = new javax.swing.JRadioButton(); - rdoCreatures = new javax.swing.JRadioButton(); - rdoArtifacts = new javax.swing.JRadioButton(); - rdoEnchantments = new javax.swing.JRadioButton(); - rdoInstants = new javax.swing.JRadioButton(); - rdoSorceries = new javax.swing.JRadioButton(); - rdoPlaneswalkers = new javax.swing.JRadioButton(); - jSeparator5 = new javax.swing.JToolBar.Separator(); + tbLand = new javax.swing.JToggleButton(); + tbCreatures = new javax.swing.JToggleButton(); + tbArifiacts = new javax.swing.JToggleButton(); + tbSorceries = new javax.swing.JToggleButton(); + tbInstants = new javax.swing.JToggleButton(); + tbEnchantments = new javax.swing.JToggleButton(); + tbPlaneswalkers = new javax.swing.JToggleButton(); + jSeparator6 = new javax.swing.JToolBar.Separator(); chkPiles = new javax.swing.JCheckBox(); jSeparator3 = new javax.swing.JToolBar.Separator(); cbSortBy = new javax.swing.JComboBox(); @@ -466,7 +467,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene tbColor.setFloatable(false); tbColor.setRollover(true); - tbColor.setToolTipText("Click with ALT to deselect all other colors or with CTRL to invert selection."); + tbColor.setToolTipText("Hold the ALT-key while clicking to deselect all other colors or hold the CTRL-key to select only all other colors."); tbColor.setBorderPainted(false); tbColor.setName(""); // NOI18N @@ -534,7 +535,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene tbWhite.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/color_white_off.png"))); // NOI18N tbWhite.setSelected(true); - tbWhite.setToolTipText("White
" + tbColor.getToolTipText()); + tbWhite.setToolTipText("White
" + tbColor.getToolTipText()); tbWhite.setActionCommand("White"); tbWhite.setFocusable(false); tbWhite.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); @@ -601,101 +602,114 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene tbTypes.setFloatable(false); tbTypes.setRollover(true); - tbTypes.setToolTipText("Click with ALT to deselect all other card types or with CTRL to deselect only clicked type."); // NOI18N + tbTypes.setToolTipText("Hold the ALT-key while clicking to deselect all other card types or hold the CTRL-key to only select all other card types."); // NOI18N tbTypes.setPreferredSize(new java.awt.Dimension(732, 27)); - rdoLand.setSelected(true); - rdoLand.setToolTipText("Land
" + tbLand.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/type_land.png"))); // NOI18N + tbLand.setSelected(true); + tbLand.setToolTipText("Land
" + tbTypes.getToolTipText()); - rdoLand.setFocusable(false); - rdoLand.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); - rdoLand.setLabel("Land "); - rdoLand.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); - rdoLand.addActionListener(new java.awt.event.ActionListener() { + tbLand.setActionCommand("Lands"); + tbLand.setFocusable(false); + tbLand.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + tbLand.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + tbLand.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - rdoLandActionPerformed(evt); + tbLandActionPerformed(evt); } }); - tbTypes.add(rdoLand); + tbTypes.add(tbLand); - rdoCreatures.setSelected(true); - rdoCreatures.setToolTipText("Creatures
" + tbCreatures.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/type_creatures.png"))); // NOI18N + tbCreatures.setSelected(true); + tbCreatures.setToolTipText("Creatures
" + tbTypes.getToolTipText()); - rdoCreatures.setFocusable(false); - rdoCreatures.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); - rdoCreatures.setLabel("Creatures "); - rdoCreatures.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); - rdoCreatures.addActionListener(new java.awt.event.ActionListener() { + tbCreatures.setActionCommand("Creatures"); + tbCreatures.setFocusable(false); + tbCreatures.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + tbCreatures.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + tbCreatures.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - rdoCreaturesActionPerformed(evt); + tbCreaturesActionPerformed(evt); } }); - tbTypes.add(rdoCreatures); + tbTypes.add(tbCreatures); - rdoArtifacts.setSelected(true); - rdoArtifacts.setText("Artifacts "); - rdoArtifacts.setToolTipText("Artifacts
" + tbArifiacts.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/type_artifact.png"))); // NOI18N + tbArifiacts.setSelected(true); + tbArifiacts.setToolTipText("Artifacts
" + tbTypes.getToolTipText()); - rdoArtifacts.setFocusable(false); - rdoArtifacts.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); - rdoArtifacts.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); - rdoArtifacts.addActionListener(new java.awt.event.ActionListener() { + tbArifiacts.setActionCommand("Artifacts"); + tbArifiacts.setFocusable(false); + tbArifiacts.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + tbArifiacts.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + tbArifiacts.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - rdoArtifactsActionPerformed(evt); + tbArifiactsActionPerformed(evt); } }); - tbTypes.add(rdoArtifacts); + tbTypes.add(tbArifiacts); - rdoEnchantments.setSelected(true); - rdoEnchantments.setText("Enchantments "); - rdoEnchantments.setToolTipText("Enchantments
" + tbSorceries.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/type_sorcery.png"))); // NOI18N + tbSorceries.setSelected(true); + tbSorceries.setToolTipText("Sorceries
" + tbTypes.getToolTipText()); - rdoEnchantments.setFocusable(false); - rdoEnchantments.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); - rdoEnchantments.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); - rdoEnchantments.addActionListener(new java.awt.event.ActionListener() { + tbSorceries.setActionCommand("Soceries"); + tbSorceries.setFocusable(false); + tbSorceries.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + tbSorceries.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + tbSorceries.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - rdoEnchantmentsActionPerformed(evt); + tbSorceriesActionPerformed(evt); } }); - tbTypes.add(rdoEnchantments); + tbTypes.add(tbSorceries); - rdoInstants.setSelected(true); - rdoInstants.setText("Instants "); - rdoInstants.setFocusable(false); - rdoInstants.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); - rdoInstants.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); - rdoInstants.addActionListener(new java.awt.event.ActionListener() { + tbInstants.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/type_instant.png"))); // NOI18N + tbInstants.setSelected(true); + tbInstants.setToolTipText("Instants
" + + tbTypes.getToolTipText()); + tbInstants.setActionCommand("Instants"); + tbInstants.setFocusable(false); + tbInstants.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + tbInstants.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + tbInstants.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - rdoInstantsActionPerformed(evt); + tbInstantsActionPerformed(evt); } }); - tbTypes.add(rdoInstants); + tbTypes.add(tbInstants); - rdoSorceries.setSelected(true); - rdoSorceries.setText("Sorceries "); - rdoSorceries.setFocusable(false); - rdoSorceries.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); - rdoSorceries.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); - rdoSorceries.addActionListener(new java.awt.event.ActionListener() { + tbEnchantments.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/type_enchantment.png"))); // NOI18N + tbEnchantments.setSelected(true); + tbEnchantments.setToolTipText("Enchantments
" + + tbTypes.getToolTipText()); + tbEnchantments.setActionCommand("Enchantments"); + tbEnchantments.setFocusable(false); + tbEnchantments.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + tbEnchantments.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + tbEnchantments.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - rdoSorceriesActionPerformed(evt); + tbEnchantmentsActionPerformed(evt); } }); - tbTypes.add(rdoSorceries); + tbTypes.add(tbEnchantments); - rdoPlaneswalkers.setSelected(true); - rdoPlaneswalkers.setText("Planeswalkers "); - rdoPlaneswalkers.setFocusable(false); - rdoPlaneswalkers.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); - rdoPlaneswalkers.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); - rdoPlaneswalkers.addActionListener(new java.awt.event.ActionListener() { + tbPlaneswalkers.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/type_planeswalker.png"))); // NOI18N + tbPlaneswalkers.setSelected(true); + tbPlaneswalkers.setToolTipText("Planeswalker
" + + tbTypes.getToolTipText()); + tbPlaneswalkers.setActionCommand("Planeswalkers"); + tbPlaneswalkers.setFocusable(false); + tbPlaneswalkers.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); + tbPlaneswalkers.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + tbPlaneswalkers.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - rdoPlaneswalkersActionPerformed(evt); + tbPlaneswalkersActionPerformed(evt); } }); - tbTypes.add(rdoPlaneswalkers); - tbTypes.add(jSeparator5); + tbTypes.add(tbPlaneswalkers); + tbTypes.add(jSeparator6); chkPiles.setText("Piles"); chkPiles.setToolTipText("Shows the card in piles by the selected sort."); @@ -759,15 +773,17 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene }); tbTypes.add(jToggleCardView); + cardSelectorScrollPane.setToolTipText("Double click to add the card to the main deck.
\nALT + Double click to add the card to the sideboard."); + cardSelectorBottomPanel.setOpaque(false); cardSelectorBottomPanel.setPreferredSize(new java.awt.Dimension(897, 40)); jButtonAddToMain.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/deck_in.png"))); // NOI18N - jButtonAddToMain.setToolTipText("Add selected cards to deck"); + jButtonAddToMain.setToolTipText("Add selected cards to deck.
\nAlternative: Double click the card in card selector to move a card to the deck."); jButtonAddToMain.setMargin(null); jButtonAddToMain.setMaximumSize(new java.awt.Dimension(42, 23)); jButtonAddToMain.setMinimumSize(new java.awt.Dimension(42, 23)); - jButtonAddToMain.setPreferredSize(new java.awt.Dimension(28, 22)); + jButtonAddToMain.setPreferredSize(new java.awt.Dimension(40, 28)); jButtonAddToMain.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonAddToMainActionPerformed(evt); @@ -775,11 +791,11 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene }); jButtonAddToSideboard.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/sideboard_in.png"))); // NOI18N - jButtonAddToSideboard.setToolTipText("Add selected cards to sideboard."); + jButtonAddToSideboard.setToolTipText("Add selected cards to sideboard.
\nAlternative: ALT key + Double click the card in card selector to move a card to the sideboard."); jButtonAddToSideboard.setMargin(new java.awt.Insets(2, 0, 2, 0)); jButtonAddToSideboard.setMaximumSize(new java.awt.Dimension(100, 30)); jButtonAddToSideboard.setMinimumSize(new java.awt.Dimension(10, 30)); - jButtonAddToSideboard.setPreferredSize(new java.awt.Dimension(28, 22)); + jButtonAddToSideboard.setPreferredSize(new java.awt.Dimension(40, 28)); jButtonAddToSideboard.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonAddToSideboardActionPerformed(evt); @@ -817,7 +833,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene jButtonRemoveFromMain.setMargin(null); jButtonRemoveFromMain.setMaximumSize(new java.awt.Dimension(42, 23)); jButtonRemoveFromMain.setMinimumSize(new java.awt.Dimension(42, 23)); - jButtonRemoveFromMain.setPreferredSize(new java.awt.Dimension(28, 22)); + jButtonRemoveFromMain.setPreferredSize(new java.awt.Dimension(40, 28)); jButtonRemoveFromMain.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonRemoveFromMainActionPerformed(evt); @@ -829,7 +845,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene jButtonRemoveFromSideboard.setMargin(new java.awt.Insets(2, 0, 2, 0)); jButtonRemoveFromSideboard.setMaximumSize(new java.awt.Dimension(10, 30)); jButtonRemoveFromSideboard.setMinimumSize(new java.awt.Dimension(100, 30)); - jButtonRemoveFromSideboard.setPreferredSize(new java.awt.Dimension(28, 22)); + jButtonRemoveFromSideboard.setPreferredSize(new java.awt.Dimension(40, 28)); jButtonRemoveFromSideboard.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonRemoveFromSideboardActionPerformed(evt); @@ -889,9 +905,9 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(tbColor, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(tbTypes, javax.swing.GroupLayout.DEFAULT_SIZE, 897, Short.MAX_VALUE) + .addComponent(tbTypes, javax.swing.GroupLayout.DEFAULT_SIZE, 1057, Short.MAX_VALUE) .addComponent(cardSelectorScrollPane) - .addComponent(cardSelectorBottomPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(cardSelectorBottomPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 1057, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -906,34 +922,6 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene ); }// //GEN-END:initComponents - private void rdoLandActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdoLandActionPerformed - filterCardsType(evt.getModifiers(), evt.getActionCommand()); - }//GEN-LAST:event_rdoLandActionPerformed - - private void rdoCreaturesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdoCreaturesActionPerformed - filterCardsType(evt.getModifiers(), evt.getActionCommand()); - }//GEN-LAST:event_rdoCreaturesActionPerformed - - private void rdoArtifactsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdoArtifactsActionPerformed - filterCardsType(evt.getModifiers(), evt.getActionCommand()); - }//GEN-LAST:event_rdoArtifactsActionPerformed - - private void rdoEnchantmentsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdoEnchantmentsActionPerformed - filterCardsType(evt.getModifiers(), evt.getActionCommand()); - }//GEN-LAST:event_rdoEnchantmentsActionPerformed - - private void rdoInstantsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdoInstantsActionPerformed - filterCardsType(evt.getModifiers(), evt.getActionCommand()); - }//GEN-LAST:event_rdoInstantsActionPerformed - - private void rdoSorceriesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdoSorceriesActionPerformed - filterCardsType(evt.getModifiers(), evt.getActionCommand()); - }//GEN-LAST:event_rdoSorceriesActionPerformed - - private void rdoPlaneswalkersActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdoPlaneswalkersActionPerformed - filterCardsType(evt.getModifiers(), evt.getActionCommand()); - }//GEN-LAST:event_rdoPlaneswalkersActionPerformed - private void cbExpansionSetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbExpansionSetActionPerformed filterCards(); }//GEN-LAST:event_cbExpansionSetActionPerformed @@ -1021,7 +1009,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene List indexes = asList(n); Collections.reverse(indexes); for (Integer index : indexes) { - mainModel.shiftDoubleClick(index); + mainModel.altDoubleClick(index); } //if (!mode.equals(Constants.DeckEditorMode.Constructed)) if (limited) { @@ -1072,6 +1060,34 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene filterCardsColor(evt.getModifiers(), evt.getActionCommand()); }//GEN-LAST:event_tbColorlessActionPerformed + private void tbCreaturesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tbCreaturesActionPerformed + filterCardsType(evt.getModifiers(), evt.getActionCommand()); + }//GEN-LAST:event_tbCreaturesActionPerformed + + private void tbArifiactsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tbArifiactsActionPerformed + filterCardsType(evt.getModifiers(), evt.getActionCommand()); + }//GEN-LAST:event_tbArifiactsActionPerformed + + private void tbSorceriesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tbSorceriesActionPerformed + filterCardsType(evt.getModifiers(), evt.getActionCommand()); + }//GEN-LAST:event_tbSorceriesActionPerformed + + private void tbInstantsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tbInstantsActionPerformed + filterCardsType(evt.getModifiers(), evt.getActionCommand()); + }//GEN-LAST:event_tbInstantsActionPerformed + + private void tbEnchantmentsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tbEnchantmentsActionPerformed + filterCardsType(evt.getModifiers(), evt.getActionCommand()); + }//GEN-LAST:event_tbEnchantmentsActionPerformed + + private void tbPlaneswalkersActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tbPlaneswalkersActionPerformed + filterCardsType(evt.getModifiers(), evt.getActionCommand()); + }//GEN-LAST:event_tbPlaneswalkersActionPerformed + + private void tbLandActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tbLandActionPerformed + filterCardsType(evt.getModifiers(), evt.getActionCommand()); + }//GEN-LAST:event_tbLandActionPerformed + private void toggleViewMode() { if (currentView instanceof CardGrid) { jToggleListView.setSelected(true); @@ -1137,23 +1153,23 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene private javax.swing.JToolBar.Separator jSeparator2; private javax.swing.JToolBar.Separator jSeparator3; private javax.swing.JToolBar.Separator jSeparator4; - private javax.swing.JToolBar.Separator jSeparator5; + private javax.swing.JToolBar.Separator jSeparator6; private javax.swing.JTextField jTextFieldSearch; private javax.swing.JToggleButton jToggleCardView; private javax.swing.JToggleButton jToggleListView; - private javax.swing.JRadioButton rdoArtifacts; - private javax.swing.JRadioButton rdoCreatures; - private javax.swing.JRadioButton rdoEnchantments; - private javax.swing.JRadioButton rdoInstants; - private javax.swing.JRadioButton rdoLand; - private javax.swing.JRadioButton rdoPlaneswalkers; - private javax.swing.JRadioButton rdoSorceries; + private javax.swing.JToggleButton tbArifiacts; private javax.swing.JToggleButton tbBlack; private javax.swing.JToggleButton tbBlue; private javax.swing.JToolBar tbColor; private javax.swing.JToggleButton tbColorless; + private javax.swing.JToggleButton tbCreatures; + private javax.swing.JToggleButton tbEnchantments; private javax.swing.JToggleButton tbGreen; + private javax.swing.JToggleButton tbInstants; + private javax.swing.JToggleButton tbLand; + private javax.swing.JToggleButton tbPlaneswalkers; private javax.swing.JToggleButton tbRed; + private javax.swing.JToggleButton tbSorceries; private javax.swing.JToolBar tbTypes; private javax.swing.JToggleButton tbWhite; // End of variables declaration//GEN-END:variables diff --git a/Mage.Client/src/main/java/mage/client/deckeditor/DeckEditorPanel.java b/Mage.Client/src/main/java/mage/client/deckeditor/DeckEditorPanel.java index 9f1d691d242..1586dfb1917 100644 --- a/Mage.Client/src/main/java/mage/client/deckeditor/DeckEditorPanel.java +++ b/Mage.Client/src/main/java/mage/client/deckeditor/DeckEditorPanel.java @@ -213,7 +213,7 @@ public class DeckEditorPanel extends javax.swing.JPanel { case "double-click": moveSelectorCardToDeck(event); break; - case "shift-double-click": + case "alt-double-click": if (mode == DeckEditorMode.FREE_BUILDING) { moveSelectorCardToSideboard(event); } else { @@ -252,7 +252,7 @@ public class DeckEditorPanel extends javax.swing.JPanel { refreshDeck(); break; } - case "shift-double-click": + case "alt-double-click": { SimpleCardView cardView = (SimpleCardView) event.getSource(); for (Card card : deck.getCards()) { @@ -275,7 +275,7 @@ public class DeckEditorPanel extends javax.swing.JPanel { // constructing phase or sideboarding during match -> card goes always to sideboard switch (event.getEventName()) { case "double-click": - case "shift-double-click": + case "alt-double-click": { SimpleCardView cardView = (SimpleCardView) event.getSource(); for (Card card : deck.getCards()) { @@ -313,7 +313,7 @@ public class DeckEditorPanel extends javax.swing.JPanel { hidePopup(); refreshDeck(); break; - case "shift-double-click": + case "alt-double-click": // remove card from sideboard cardView = (SimpleCardView) event.getSource(); for (Card card : deck.getSideboard()) { @@ -335,7 +335,7 @@ public class DeckEditorPanel extends javax.swing.JPanel { // construct phase or sideboarding during match switch (event.getEventName()) { case "double-click": - case "shift-double-click": + case "alt-double-click": SimpleCardView cardView = (SimpleCardView) event.getSource(); for (Card card : deck.getSideboard()) { if (card.getId().equals(cardView.getId())) { diff --git a/Mage.Client/src/main/java/mage/client/deckeditor/table/TableModel.java b/Mage.Client/src/main/java/mage/client/deckeditor/table/TableModel.java index f59bf2c453b..c79d00ba4ce 100644 --- a/Mage.Client/src/main/java/mage/client/deckeditor/table/TableModel.java +++ b/Mage.Client/src/main/java/mage/client/deckeditor/table/TableModel.java @@ -119,6 +119,9 @@ public class TableModel extends AbstractTableModel implements ICardGrid { this.gameId = gameId; int landCount = 0; int creatureCount = 0; + int instantCount = 0; + int sorceryCount = 0; + int enchantmentCount = 0; if (!merge) { this.clearCards(); for (CardView card : showCards.values()) { @@ -136,6 +139,15 @@ public class TableModel extends AbstractTableModel implements ICardGrid { if (card.getCardTypes().contains(CardType.CREATURE)) { creatureCount++; } + if (card.getCardTypes().contains(CardType.INSTANT)) { + instantCount++; + } + if (card.getCardTypes().contains(CardType.SORCERY)) { + sorceryCount++; + } + if (card.getCardTypes().contains(CardType.ENCHANTMENT)) { + enchantmentCount++; + } } } @@ -186,7 +198,7 @@ public class TableModel extends AbstractTableModel implements ICardGrid { } if (updateCountsCallback != null) { - updateCountsCallback.update(cards.size(), creatureCount, landCount); + updateCountsCallback.update(cards.size(), creatureCount, landCount, sorceryCount, instantCount, enchantmentCount); } } @@ -318,9 +330,9 @@ public class TableModel extends AbstractTableModel implements ICardGrid { cardEventSource.doubleClick(card, "double-click"); } - public void shiftDoubleClick(int index) { + public void altDoubleClick(int index) { CardView card = view.get(index); - cardEventSource.shiftDoubleClick(card, "shift-double-click"); + cardEventSource.altDoubleClick(card, "alt-double-click"); } public void removeFromMainEvent(int index) { diff --git a/Mage.Client/src/main/java/mage/client/deckeditor/table/UpdateCountsCallback.java b/Mage.Client/src/main/java/mage/client/deckeditor/table/UpdateCountsCallback.java index b09d6f1b3e2..d0cac93a8de 100644 --- a/Mage.Client/src/main/java/mage/client/deckeditor/table/UpdateCountsCallback.java +++ b/Mage.Client/src/main/java/mage/client/deckeditor/table/UpdateCountsCallback.java @@ -1,6 +1,6 @@ package mage.client.deckeditor.table; -import javax.swing.*; +import javax.swing.JLabel; /** * Updates counts in deck editor. @@ -11,16 +11,25 @@ public class UpdateCountsCallback { private final javax.swing.JLabel lblCount; private final javax.swing.JLabel lblCreatureCount; private final javax.swing.JLabel lblLandCount; + private final javax.swing.JLabel lblSoerceryCount; + private final javax.swing.JLabel lblInstantCount; + private final javax.swing.JLabel lblEnchantmentCount; - public UpdateCountsCallback(JLabel count, JLabel creatures, JLabel lands) { + public UpdateCountsCallback(JLabel count, JLabel creatures, JLabel lands, JLabel sorceries, JLabel instants, JLabel enchantments) { this.lblCount = count; this.lblCreatureCount = creatures; this.lblLandCount = lands; + this.lblSoerceryCount = sorceries; + this.lblInstantCount = instants; + this.lblEnchantmentCount = enchantments; } - public void update(int count, int creatures, int lands) { - this.lblCount.setText("Count: " + Integer.toString(count)); - this.lblCreatureCount.setText("Creatures: " + Integer.toString(creatures)); - this.lblLandCount.setText("Lands: " + Integer.toString(lands)); + public void update(int count, int creatures, int lands, int sorceries, int instants, int enchantments) { + this.lblCount.setText(Integer.toString(count)); + this.lblCreatureCount.setText(Integer.toString(creatures)); + this.lblLandCount.setText(Integer.toString(lands)); + this.lblSoerceryCount.setText(Integer.toString(sorceries)); + this.lblInstantCount.setText(Integer.toString(instants)); + this.lblEnchantmentCount.setText(Integer.toString(enchantments)); } } diff --git a/Mage.Client/src/main/java/mage/client/util/gui/TableSpinnerEditor.java b/Mage.Client/src/main/java/mage/client/util/gui/TableSpinnerEditor.java index 26d1d520e5e..ec79adea15e 100644 --- a/Mage.Client/src/main/java/mage/client/util/gui/TableSpinnerEditor.java +++ b/Mage.Client/src/main/java/mage/client/util/gui/TableSpinnerEditor.java @@ -54,7 +54,7 @@ public class TableSpinnerEditor extends DefaultCellEditor { JSpinner.DefaultEditor editor; JTextField textField; boolean valueSet; - private JTable lastTable; + private JTable table; private int lastRow = -1; private int currentRow = -1; private int lastOriginalHeigh; @@ -75,6 +75,14 @@ public class TableSpinnerEditor extends DefaultCellEditor { textField.addFocusListener(new FocusListener() { @Override public void focusGained(FocusEvent fe) { + lastOriginalHeigh = currentOriginalHeigh; + currentOriginalHeigh = 0; + lastRow = currentRow; + currentRow = -1; + if (lastOriginalHeigh < NEEDED_HIGH) { + table.setRowHeight(lastRow, NEEDED_HIGH); + } + SwingUtilities.invokeLater(new Runnable() { @Override public void run() { @@ -86,7 +94,8 @@ public class TableSpinnerEditor extends DefaultCellEditor { } @Override - public void focusLost(FocusEvent fe) { + public void focusLost(FocusEvent fe) { + resetRow(); if (currentRow < 0) { stopCellEditing(); } @@ -100,31 +109,23 @@ public class TableSpinnerEditor extends DefaultCellEditor { }); } - private synchronized void setTableRowHeigh(JTable table, int row) { - if (lastRow >=0 && lastOriginalHeigh < NEEDED_HIGH) { - lastTable.setRowHeight(lastRow, lastOriginalHeigh); - } - if (row >= 0 && currentRow >=0) { - lastRow = currentRow; - lastOriginalHeigh = currentOriginalHeigh; - currentRow = -1; - currentOriginalHeigh = -1; - } - lastRow = -1; - if (table != null) { - lastTable = table; - currentOriginalHeigh = table.getRowHeight(row); - currentRow = row; - if (currentOriginalHeigh < NEEDED_HIGH) { - lastTable.setRowHeight(currentRow, NEEDED_HIGH); - } - } + private synchronized void resetRow() { + if (lastRow >= 0) { + cardsList.handleSetNumber((Integer) spinner.getValue()); + table.setRowHeight(lastRow, lastOriginalHeigh); + lastRow = -1; + } } // Prepares the spinner component and returns it. @Override public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { - setTableRowHeigh(table, row); + if (this.table == null) { + this.table = table; + } + currentOriginalHeigh = table.getRowHeight(row); + currentRow = row; + if (!valueSet) { spinner.setValue(value); } @@ -159,9 +160,9 @@ public class TableSpinnerEditor extends DefaultCellEditor { public boolean stopCellEditing() { try { editor.commitEdit(); - spinner.commitEdit(); - cardsList.handleSetNumber((Integer) spinner.getValue()); - setTableRowHeigh(null, 0); + spinner.commitEdit(); + resetRow(); + } catch (java.text.ParseException e) { JOptionPane.showMessageDialog(null, "Invalid value, discarding."); diff --git a/Mage.Client/src/main/resources/buttons/deck_pack.png b/Mage.Client/src/main/resources/buttons/deck_pack.png new file mode 100644 index 00000000000..b45da8919ec Binary files /dev/null and b/Mage.Client/src/main/resources/buttons/deck_pack.png differ diff --git a/Mage.Client/src/main/resources/buttons/type_artifact.png b/Mage.Client/src/main/resources/buttons/type_artifact.png new file mode 100644 index 00000000000..17ae02f0d50 Binary files /dev/null and b/Mage.Client/src/main/resources/buttons/type_artifact.png differ diff --git a/Mage.Client/src/main/resources/buttons/type_creatures.png b/Mage.Client/src/main/resources/buttons/type_creatures.png new file mode 100644 index 00000000000..c524e7276b7 Binary files /dev/null and b/Mage.Client/src/main/resources/buttons/type_creatures.png differ diff --git a/Mage.Client/src/main/resources/buttons/type_enchantment.png b/Mage.Client/src/main/resources/buttons/type_enchantment.png new file mode 100644 index 00000000000..3b49e8123dc Binary files /dev/null and b/Mage.Client/src/main/resources/buttons/type_enchantment.png differ diff --git a/Mage.Client/src/main/resources/buttons/type_instant.png b/Mage.Client/src/main/resources/buttons/type_instant.png new file mode 100644 index 00000000000..40b211cb63e Binary files /dev/null and b/Mage.Client/src/main/resources/buttons/type_instant.png differ diff --git a/Mage.Client/src/main/resources/buttons/type_land.png b/Mage.Client/src/main/resources/buttons/type_land.png new file mode 100644 index 00000000000..ae59647df33 Binary files /dev/null and b/Mage.Client/src/main/resources/buttons/type_land.png differ diff --git a/Mage.Client/src/main/resources/buttons/type_planeswalker.png b/Mage.Client/src/main/resources/buttons/type_planeswalker.png new file mode 100644 index 00000000000..cf22d24bfc0 Binary files /dev/null and b/Mage.Client/src/main/resources/buttons/type_planeswalker.png differ diff --git a/Utils/release/getting_implemented_cards.txt b/Utils/release/getting_implemented_cards.txt index 15961f43e86..fae2fac4070 100644 --- a/Utils/release/getting_implemented_cards.txt +++ b/Utils/release/getting_implemented_cards.txt @@ -27,6 +27,8 @@ git log 9c5d5208b96e28e1e767574e1143b845e6b7308f..HEAD --diff-filter=A --name-st since 1.3.0-2014-02-15 git log 88d8c30b6c3dbf7c90354eccfd04107641c308f1..HEAD --diff-filter=A --name-status | sed -ne "s/^A[^u]Mage.Sets\/src\/mage\/sets\///p" | sort > added_cards.txt +since 1.3.0-2014-04-25 +git log a1cfd040d74dd6d2100168754961cfebb154f153..HEAD --diff-filter=A --name-status | sed -ne "s/^A[^u]Mage.Sets\/src\/mage\/sets\///p" | sort > added_cards.txt 3. Copy added_cards.txt to trunk\Utils folder