mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-11 13:17:00 -04:00
Generated packs can now be selected for printing.
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1107 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
|
||||
#include <util/prec.hpp>
|
||||
#include <data/set.hpp>
|
||||
#include <gui/card_select_window.hpp>
|
||||
|
||||
class wxFindReplaceData;
|
||||
|
||||
@@ -69,6 +70,7 @@ class SetWindowPanel : public wxPanel, public SetView {
|
||||
virtual CardP selectedCard() const; ///< Return the currently selected card, or CardP()
|
||||
virtual void selectCard(const CardP& card) {} ///< Switch the view to another card, can be null
|
||||
virtual void selectFirstCard() {} ///< Switch the view to the first card
|
||||
virtual void selectionChoices(ExportCardSelectionChoices& out) {} ///< Card subsets that can be exported from this panel
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------- : EOF
|
||||
|
||||
@@ -39,6 +39,8 @@ class RandomCardList : public CardListBase {
|
||||
|
||||
using CardListBase::rebuild;
|
||||
|
||||
const vector<CardP>* getCardsPtr() const { return &cards; }
|
||||
|
||||
protected:
|
||||
virtual void getItems(vector<VoidP>& out) const;
|
||||
virtual void onChangeSet();
|
||||
@@ -328,6 +330,12 @@ void RandomPackPanel::selectCard(const CardP& card) {
|
||||
preview->setCard(card);
|
||||
}
|
||||
|
||||
void RandomPackPanel::selectionChoices(ExportCardSelectionChoices& out) {
|
||||
out.push_back(new_intrusive2<ExportCardSelectionChoice>(
|
||||
_BUTTON_("export generated packs"),
|
||||
card_list->getCardsPtr()
|
||||
));
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : Clipboard
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ class RandomPackPanel : public SetWindowPanel {
|
||||
// --------------------------------------------------- : Selection
|
||||
virtual CardP selectedCard() const;
|
||||
virtual void selectCard(const CardP& card);
|
||||
virtual void selectionChoices(ExportCardSelectionChoices& out);
|
||||
|
||||
// --------------------------------------------------- : Clipboard
|
||||
|
||||
|
||||
+26
-12
@@ -329,16 +329,6 @@ void SetWindow::updateTitle() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SetWindow::onCardSelect(CardSelectEvent& ev) {
|
||||
FOR_EACH(p, panels) {
|
||||
p->selectCard(ev.card);
|
||||
}
|
||||
}
|
||||
void SetWindow::onCardActivate(CardSelectEvent& ev) {
|
||||
selectPanel(ID_WINDOW_CARDS);
|
||||
}
|
||||
|
||||
void SetWindow::fixMinWindowSize() {
|
||||
current_panel->SetMinSize(current_panel->GetSizer()->GetMinSize());
|
||||
Layout();
|
||||
@@ -360,6 +350,26 @@ void SetWindow::onSizeChange(wxCommandEvent&) {
|
||||
fixMinWindowSize();
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------- : Cards
|
||||
|
||||
void SetWindow::onCardSelect(CardSelectEvent& ev) {
|
||||
FOR_EACH(p, panels) {
|
||||
p->selectCard(ev.getCard());
|
||||
}
|
||||
}
|
||||
void SetWindow::onCardActivate(CardSelectEvent& ev) {
|
||||
selectPanel(ID_WINDOW_CARDS);
|
||||
}
|
||||
|
||||
void SetWindow::selectionChoices(ExportCardSelectionChoices& out) {
|
||||
out.push_back(new_intrusive1<ExportCardSelectionChoice>(*set)); // entire set
|
||||
FOR_EACH(p, panels) {
|
||||
p->selectionChoices(out);
|
||||
}
|
||||
out.push_back(new_intrusive<ExportCardSelectionChoice>()); // custom
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : Window events - close
|
||||
|
||||
void SetWindow::onClose(wxCloseEvent& ev) {
|
||||
@@ -594,11 +604,15 @@ void SetWindow::onFileCheckUpdates(wxCommandEvent&) {
|
||||
}
|
||||
|
||||
void SetWindow::onFilePrint(wxCommandEvent&) {
|
||||
print_set(this, set);
|
||||
ExportCardSelectionChoices choices;
|
||||
selectionChoices(choices);
|
||||
print_set(this, set, choices);
|
||||
}
|
||||
|
||||
void SetWindow::onFilePrintPreview(wxCommandEvent&) {
|
||||
print_preview(this, set);
|
||||
ExportCardSelectionChoices choices;
|
||||
selectionChoices(choices);
|
||||
print_preview(this, set, choices);
|
||||
}
|
||||
|
||||
void SetWindow::onFileReload(wxCommandEvent&) {
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <util/prec.hpp>
|
||||
#include <data/set.hpp>
|
||||
#include <wx/fdrepdlg.h>
|
||||
#include <gui/card_select_window.hpp>
|
||||
|
||||
class IconMenu;
|
||||
class SetWindowPanel;
|
||||
@@ -86,16 +87,20 @@ class SetWindow : public wxFrame, public SetView {
|
||||
virtual void onAction(const Action&, bool undone);
|
||||
|
||||
private:
|
||||
/// A different card has been selected
|
||||
void onCardSelect(CardSelectEvent&);
|
||||
void onCardActivate(CardSelectEvent&);
|
||||
|
||||
// minSize = mainSizer->getMinWindowSize(this)
|
||||
// but wx made that private
|
||||
void fixMinWindowSize();
|
||||
/// Update the window title based on the set name
|
||||
void updateTitle();
|
||||
|
||||
// --------------------------------------------------- : Cards
|
||||
|
||||
/// A different card has been selected
|
||||
void onCardSelect(CardSelectEvent&);
|
||||
void onCardActivate(CardSelectEvent&);
|
||||
/// Card subsets that can be exported
|
||||
void selectionChoices(ExportCardSelectionChoices& out);
|
||||
|
||||
// --------------------------------------------------- : Window events - close
|
||||
|
||||
/// Ask the user to save the set
|
||||
|
||||
Reference in New Issue
Block a user