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
+55
View File
@@ -13,8 +13,59 @@
DECLARE_POINTER_TYPE(Set);
DECLARE_POINTER_TYPE(Card);
DECLARE_POINTER_TYPE(ExportCardSelectionChoice);
class SelectCardList;
// ----------------------------------------------------------------------------- : ExportWindowBase
enum ExportCardSelectionType
{ EXPORT_SEL_ENTIRE_SET
, EXPORT_SEL_SUBSET
, EXPORT_SEL_CUSTOM
};
class ExportCardSelectionChoice : public IntrusivePtrBase<ExportCardSelectionChoice> {
public:
ExportCardSelectionChoice();
ExportCardSelectionChoice(const Set& set);
ExportCardSelectionChoice(const String& label, const vector<CardP>& cards);
ExportCardSelectionChoice(const String& label, const vector<CardP>* cards);
const String label;
const ExportCardSelectionType type;
const vector<CardP>* the_cards; ///< The cards
vector<CardP> own_cards; ///< Maybe we own the cards, in that case the_cards = &own_cards
};
typedef vector<ExportCardSelectionChoiceP> ExportCardSelectionChoices;
/// Base class for export windows, deals with card selection
class ExportWindowBase : public wxDialog {
public:
ExportWindowBase(const SetP& set, const ExportCardSelectionChoices& cards_choices);
/// Create the controls, return a sizer containing them
wxSizer* Create();
/// Get the selected cards
const vector<CardP>& getSelection() const { return *cards; }
protected:
DECLARE_EVENT_TABLE();
SetP set; ///< Set to export
const vector<CardP>* cards; ///< Cards to export
private:
ExportCardSelectionChoices cards_choices; ///< Ways to select cards
size_t active_choice;
wxStaticText* card_count;
wxButton* select_cards;
void onChangeSelectionChoice(wxCommandEvent&);
void onSelectCards(wxCommandEvent&);
void update();
};
// ----------------------------------------------------------------------------- : CardSelectWindow
/// A window for selecting a subset of the cards from a set.
@@ -26,6 +77,10 @@ class CardSelectWindow : public wxDialog {
/// Is the given card selected?
bool isSelected(const CardP& card) const;
/// Get a list of all selected cards
void getSelection(vector<CardP>& out) const;
/// Change which cards are selected
void setSelection(const vector<CardP>& cards);
protected:
DECLARE_EVENT_TABLE();