spjspj - Add invert selection to deck editor

This commit is contained in:
spjspj 2016-12-13 00:41:21 +11:00
parent 8680ab212f
commit 24b4bc8e30
2 changed files with 35 additions and 0 deletions

View file

@ -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) {