mirror of
https://github.com/correl/mage.git
synced 2025-04-12 17:00:08 -09:00
Merge pull request #2673 from spjspj/master
spjspj - Add new invert selection option
This commit is contained in:
commit
49d9630c05
2 changed files with 35 additions and 0 deletions
Mage.Client/src/main/java/mage/client
|
@ -577,6 +577,8 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
void hideCards(Collection<CardView> card);
|
||||
|
||||
void duplicateCards(Collection<CardView> cards);
|
||||
|
||||
void invertCardSelection(Collection<CardView> cards);
|
||||
|
||||
void showAll();
|
||||
};
|
||||
|
@ -1106,6 +1108,18 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
l.duplicateCards(toDuplicate);
|
||||
}
|
||||
}
|
||||
|
||||
private void invertSelection() {
|
||||
Collection<CardView> toInvert = allCards;
|
||||
for (DragCardGridListener l : listeners) {
|
||||
l.invertCardSelection(toInvert);
|
||||
for (CardView card : allCards) {
|
||||
MageCard view = cardViews.get(card.getId());
|
||||
view.update(card);
|
||||
}
|
||||
}
|
||||
repaint();
|
||||
}
|
||||
|
||||
private void showAll() {
|
||||
for (DragCardGridListener l : listeners) {
|
||||
|
@ -1645,6 +1659,10 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
JMenuItem hide = new JMenuItem("Hide");
|
||||
hide.addActionListener(e2 -> hideSelection());
|
||||
menu.add(hide);
|
||||
|
||||
JMenuItem invertSelection = new JMenuItem("Invert Selection");
|
||||
invertSelection.addActionListener(e2 -> invertSelection());
|
||||
menu.add(invertSelection);
|
||||
|
||||
// Show 'Duplicate Selection' for FREE_BUILDING
|
||||
if (this.mode == Constants.DeckEditorMode.FREE_BUILDING) {
|
||||
|
|
|
@ -144,6 +144,14 @@ public class DeckArea extends javax.swing.JPanel {
|
|||
deckList.addCardView(newCard, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invertCardSelection(Collection<CardView> cards) {
|
||||
// Invert Selection
|
||||
for (CardView card : cards) {
|
||||
card.setSelected(!card.isSelected());
|
||||
}
|
||||
}
|
||||
});
|
||||
sideboardList.addDragCardGridListener(new DragCardGrid.DragCardGridListener() {
|
||||
@Override
|
||||
|
@ -174,6 +182,15 @@ public class DeckArea extends javax.swing.JPanel {
|
|||
sideboardList.addCardView(newCard, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invertCardSelection(Collection<CardView> cards) {
|
||||
// Invert Selection
|
||||
for (CardView card : cards) {
|
||||
card.setSelected(!card.isSelected());
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue