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:
twanvl
2008-08-08 21:35:38 +00:00
parent 5cde673976
commit 2d2c434bd8
18 changed files with 322 additions and 64 deletions
+2
View File
@@ -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
+8
View File
@@ -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
+1
View File
@@ -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
View File
@@ -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&) {
+9 -4
View File
@@ -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