mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57: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:
@@ -462,6 +462,8 @@ label:
|
||||
columns: Columns:
|
||||
|
||||
# Card select / images export
|
||||
select cards: Cards to export
|
||||
selected card count: %s cards will be exported.
|
||||
select cards print: Select the cards you want to print
|
||||
filename format: &Format:
|
||||
filename conflicts: &Handle duplicating filenames:
|
||||
@@ -564,6 +566,10 @@ button:
|
||||
hide: &Hide
|
||||
|
||||
# Card select
|
||||
export entire set: Entire set
|
||||
export generated packs: Generated packs
|
||||
export custom cards selection: Custom selection
|
||||
select cards: &Select Cards...
|
||||
select all: Select &All
|
||||
select none: Select &None
|
||||
overwrite: Overwrite old files
|
||||
|
||||
@@ -10,6 +10,113 @@
|
||||
#include <gui/card_select_window.hpp>
|
||||
#include <gui/control/select_card_list.hpp>
|
||||
#include <util/window_id.hpp>
|
||||
#include <wx/statline.h>
|
||||
|
||||
DECLARE_TYPEOF_COLLECTION(CardP);
|
||||
DECLARE_TYPEOF_COLLECTION(ExportCardSelectionChoiceP);
|
||||
|
||||
// ----------------------------------------------------------------------------- : ExportCardSelectionChoice
|
||||
|
||||
ExportCardSelectionChoice::ExportCardSelectionChoice()
|
||||
: label(_BUTTON_("export custom cards selection"))
|
||||
, type(EXPORT_SEL_CUSTOM)
|
||||
, the_cards(&own_cards)
|
||||
{}
|
||||
ExportCardSelectionChoice::ExportCardSelectionChoice(const Set& set)
|
||||
: label(_BUTTON_("export entire set"))
|
||||
, type(EXPORT_SEL_ENTIRE_SET)
|
||||
, the_cards(&set.cards)
|
||||
{}
|
||||
ExportCardSelectionChoice::ExportCardSelectionChoice(const String& label, const vector<CardP>& cards)
|
||||
: label(label)
|
||||
, type(EXPORT_SEL_SUBSET)
|
||||
, own_cards(cards)
|
||||
, the_cards(&own_cards)
|
||||
{}
|
||||
ExportCardSelectionChoice::ExportCardSelectionChoice(const String& label, const vector<CardP>* cards)
|
||||
: label(label)
|
||||
, type(EXPORT_SEL_SUBSET)
|
||||
, the_cards(cards)
|
||||
{}
|
||||
|
||||
// ----------------------------------------------------------------------------- : ExportWindowBase
|
||||
|
||||
|
||||
ExportWindowBase::ExportWindowBase(const SetP& set, const ExportCardSelectionChoices& cards_choices)
|
||||
: set(set), cards_choices(cards_choices)
|
||||
, active_choice(0)
|
||||
, select_cards(nullptr)
|
||||
{}
|
||||
|
||||
wxSizer* ExportWindowBase::Create() {
|
||||
// create sizer
|
||||
wxSizer* s = new wxStaticBoxSizer(wxVERTICAL, this, _LABEL_("select cards"));
|
||||
// create choice radio buttons
|
||||
int i = 0;
|
||||
bool any_custom = false;
|
||||
FOR_EACH(choice, cards_choices) {
|
||||
wxRadioButton* btn = new wxRadioButton(this, ID_SELECTION_CHOICE + i, choice->label);
|
||||
btn->Enable(!choice->the_cards->empty() || choice->type == EXPORT_SEL_CUSTOM);
|
||||
s->Add(btn, 0, wxALL, 6);
|
||||
s->AddSpacer(-4);
|
||||
any_custom |= choice->type == EXPORT_SEL_CUSTOM;
|
||||
i++;
|
||||
}
|
||||
// custom selection button
|
||||
if (any_custom) {
|
||||
select_cards = new wxButton(this, ID_SELECT_CARDS, _BUTTON_("select cards"));
|
||||
wxSizer* s2 = new wxBoxSizer(wxHORIZONTAL);
|
||||
s2->Add(select_cards, 1, wxLEFT, 20);
|
||||
s->AddSpacer(4);
|
||||
s->Add(s2, 0, wxALL & ~wxTOP, 6);
|
||||
}
|
||||
// total count label
|
||||
s->AddSpacer(4);
|
||||
s->Add(new wxStaticLine(this), 0, wxALL | wxEXPAND, 4);
|
||||
s->AddSpacer(4);
|
||||
card_count = new wxStaticText(this, wxID_ANY, wxEmptyString);
|
||||
s->Add(card_count, 0, wxALL & ~wxTOP, 6);
|
||||
s->AddSpacer(4);
|
||||
// done
|
||||
update();
|
||||
return s;
|
||||
}
|
||||
|
||||
void ExportWindowBase::onChangeSelectionChoice(wxCommandEvent& ev) {
|
||||
active_choice = ev.GetId() - ID_SELECTION_CHOICE;
|
||||
update();
|
||||
}
|
||||
|
||||
void ExportWindowBase::onSelectCards(wxCommandEvent&) {
|
||||
CardSelectWindow wnd(this, set, _LABEL_("select cards"), _TITLE_("select cards"));
|
||||
ExportCardSelectionChoice& choice = *cards_choices.at(active_choice);
|
||||
wnd.setSelection(choice.own_cards);
|
||||
if (wnd.ShowModal() != wxID_OK) {
|
||||
return; // cancel
|
||||
}
|
||||
// store cards
|
||||
choice.own_cards.clear();
|
||||
wnd.getSelection(choice.own_cards);
|
||||
update();
|
||||
|
||||
}
|
||||
|
||||
void ExportWindowBase::update() {
|
||||
ExportCardSelectionChoice& choice = *cards_choices.at(active_choice);
|
||||
cards = choice.the_cards;
|
||||
if (select_cards) {
|
||||
select_cards->Enable(choice.type == EXPORT_SEL_CUSTOM);
|
||||
}
|
||||
card_count->SetLabel(_LABEL_1_("selected card count", String::Format(_("%d"),cards->size())));
|
||||
wxWindow* ok_btn = FindWindow(wxID_OK);
|
||||
if (ok_btn) ok_btn->Enable(!cards->empty());
|
||||
}
|
||||
|
||||
|
||||
BEGIN_EVENT_TABLE(ExportWindowBase, wxDialog)
|
||||
EVT_RADIOBUTTON(wxID_ANY, ExportWindowBase::onChangeSelectionChoice)
|
||||
EVT_BUTTON (ID_SELECT_CARDS, ExportWindowBase::onSelectCards)
|
||||
END_EVENT_TABLE ()
|
||||
|
||||
// ----------------------------------------------------------------------------- : CardSelectWindow
|
||||
|
||||
@@ -36,7 +143,7 @@ CardSelectWindow::CardSelectWindow(Window* parent, const SetP& set, const String
|
||||
s->Add(s2, 0, wxEXPAND | wxALL & ~wxTOP, 8);
|
||||
s->SetSizeHints(this);
|
||||
SetSizer(s);
|
||||
SetSize(500,500);
|
||||
SetSize(600,500);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +151,14 @@ bool CardSelectWindow::isSelected(const CardP& card) const {
|
||||
return list->isSelected(card);
|
||||
}
|
||||
|
||||
void CardSelectWindow::getSelection(vector<CardP>& out) const {
|
||||
list->getSelection(out);
|
||||
}
|
||||
|
||||
void CardSelectWindow::setSelection(const vector<CardP>& cards) {
|
||||
list->setSelection(cards);
|
||||
}
|
||||
|
||||
void CardSelectWindow::onSelectAll(wxCommandEvent&) {
|
||||
list->selectAll();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -36,6 +36,18 @@ DECLARE_TYPEOF_COLLECTION(CardListBase*);
|
||||
DEFINE_EVENT_TYPE(EVENT_CARD_SELECT);
|
||||
DEFINE_EVENT_TYPE(EVENT_CARD_ACTIVATE);
|
||||
|
||||
CardP CardSelectEvent::getCard() const {
|
||||
return getTheCardList()->getCard();
|
||||
}
|
||||
|
||||
void CardSelectEvent::getSelection(vector<CardP>& out) const {
|
||||
getTheCardList()->getSelection(out);
|
||||
}
|
||||
|
||||
CardListBase* CardSelectEvent::getTheCardList() const {
|
||||
return static_cast<CardListBase*>(GetEventObject());
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : CardListBase
|
||||
|
||||
vector<CardListBase*> CardListBase::card_lists;
|
||||
@@ -116,11 +128,21 @@ void CardListBase::getItems(vector<VoidP>& out) const {
|
||||
out.push_back(c);
|
||||
}
|
||||
}
|
||||
void CardListBase::sendEvent() {
|
||||
CardSelectEvent ev(getCard());
|
||||
void CardListBase::sendEvent(int type) {
|
||||
CardSelectEvent ev(type);
|
||||
ev.SetEventObject(this);
|
||||
ProcessEvent(ev);
|
||||
}
|
||||
|
||||
void CardListBase::getSelection(vector<CardP>& out) const {
|
||||
long count = GetItemCount();
|
||||
for (long pos = 0 ; pos < count ; ++pos) {
|
||||
if (const_cast<CardListBase*>(this)->IsSelected(pos)) {
|
||||
out.push_back(getCard(pos));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : CardListBase : Clipboard
|
||||
|
||||
bool CardListBase::canCut() const { return canDelete(); }
|
||||
@@ -136,12 +158,7 @@ bool CardListBase::doCopy() {
|
||||
if (!canCopy()) return false;
|
||||
// cards to copy
|
||||
vector<CardP> cards_to_copy;
|
||||
long count = GetItemCount();
|
||||
for (long pos = 0 ; pos < count ; ++pos) {
|
||||
if (IsSelected(pos)) {
|
||||
cards_to_copy.push_back(getCard(pos));
|
||||
}
|
||||
}
|
||||
getSelection(cards_to_copy);
|
||||
if (cards_to_copy.empty()) return false;
|
||||
// put on clipboard
|
||||
if (!wxTheClipboard->Open()) return false;
|
||||
@@ -168,12 +185,7 @@ bool CardListBase::doPaste() {
|
||||
bool CardListBase::doDelete() {
|
||||
// cards to delete
|
||||
vector<CardP> cards_to_delete;
|
||||
long count = GetItemCount();
|
||||
for (long pos = 0 ; pos < count ; ++pos) {
|
||||
if (IsSelected(pos)) {
|
||||
cards_to_delete.push_back(getCard(pos));
|
||||
}
|
||||
}
|
||||
getSelection(cards_to_delete);
|
||||
if (cards_to_delete.empty()) return false;
|
||||
// delete cards
|
||||
set->actions.addAction(new AddCardAction(REMOVE, *set, cards_to_delete));
|
||||
@@ -372,8 +384,7 @@ void CardListBase::onContextMenu(wxContextMenuEvent&) {
|
||||
|
||||
void CardListBase::onItemActivate(wxListEvent& ev) {
|
||||
selectItemPos(ev.GetIndex(), false);
|
||||
CardSelectEvent event(getCard(), EVENT_CARD_ACTIVATE);
|
||||
ProcessEvent(event);
|
||||
sendEvent(EVENT_CARD_ACTIVATE);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : CardListBase : Event table
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
DECLARE_POINTER_TYPE(ChoiceField);
|
||||
DECLARE_POINTER_TYPE(Field);
|
||||
class CardListBase;
|
||||
|
||||
// ----------------------------------------------------------------------------- : Events
|
||||
|
||||
@@ -36,11 +37,16 @@ DECLARE_EVENT_TYPE(EVENT_CARD_ACTIVATE, <not used>)
|
||||
|
||||
/// The event of selecting a card
|
||||
struct CardSelectEvent : public wxCommandEvent {
|
||||
inline CardSelectEvent(const CardP& card, int type = EVENT_CARD_SELECT)
|
||||
: wxCommandEvent(type), card(card)
|
||||
inline CardSelectEvent(int type = EVENT_CARD_SELECT)
|
||||
: wxCommandEvent(type)
|
||||
{}
|
||||
|
||||
CardP card; ///< The selected card
|
||||
/// The selected card
|
||||
CardP getCard() const;
|
||||
/// All focused cards
|
||||
void getSelection(vector<CardP>& out) const;
|
||||
private:
|
||||
CardListBase* getTheCardList() const;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------- : CardListBase
|
||||
@@ -83,6 +89,8 @@ class CardListBase : public ItemList, public SetView {
|
||||
public:
|
||||
/// Return the card at the given position in the sorted card list
|
||||
inline CardP getCard(long pos) const { return static_pointer_cast<Card>(getItem(pos)); }
|
||||
/// Get a list of all focused cards
|
||||
void getSelection(vector<CardP>& out) const;
|
||||
protected:
|
||||
/// Get a list of all cards
|
||||
virtual void getItems(vector<VoidP>& out) const;
|
||||
@@ -97,7 +105,8 @@ class CardListBase : public ItemList, public SetView {
|
||||
virtual void sortBy(long column, bool ascending);
|
||||
|
||||
/// Send an 'item selected' event for the currently selected item (selected_item)
|
||||
virtual void sendEvent();
|
||||
virtual void sendEvent() { sendEvent(EVENT_CARD_SELECT); }
|
||||
void sendEvent(int type = EVENT_CARD_SELECT);
|
||||
/// Compare cards
|
||||
virtual bool compareItems(void* a, void* b) const;
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
* Terminology:
|
||||
* selected item = a single item in the variable selected_item
|
||||
* focused items = items that are drawn as selected in the control
|
||||
* TODO: This is reverse of normal
|
||||
*/
|
||||
class ItemList : public wxListView {
|
||||
public:
|
||||
|
||||
@@ -43,6 +43,18 @@ bool SelectCardList::isSelected(const CardP& card) const {
|
||||
return selected.find(card) != selected.end();
|
||||
}
|
||||
|
||||
void SelectCardList::getSelection(vector<CardP>& out) const {
|
||||
FOR_EACH_CONST(card, set->cards) {
|
||||
if (isSelected(card)) out.push_back(card);
|
||||
}
|
||||
}
|
||||
|
||||
void SelectCardList::setSelection(const vector<CardP>& cards) {
|
||||
selected.clear();
|
||||
copy(cards.begin(), cards.end(), inserter(selected, selected.begin()));
|
||||
}
|
||||
|
||||
|
||||
void SelectCardList::onChangeSet() {
|
||||
CardListBase::onChangeSet();
|
||||
// init selected list: select all
|
||||
|
||||
@@ -26,6 +26,11 @@ class SelectCardList : public CardListBase {
|
||||
void selectNone();
|
||||
/// 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:
|
||||
virtual int OnGetItemImage(long pos) const;
|
||||
virtual void onChangeSet();
|
||||
|
||||
@@ -72,9 +72,7 @@ void ImagesExportWindow::onOk(wxCommandEvent&) {
|
||||
if (name.empty()) return;
|
||||
// Cards to export
|
||||
vector<CardP> cards;
|
||||
FOR_EACH(card, set->cards) {
|
||||
if (isSelected(card)) cards.push_back(card);
|
||||
}
|
||||
getSelection(cards);
|
||||
// Export
|
||||
export_images(set, cards, name, gs.images_export_filename, gs.images_export_conflicts);
|
||||
// Done
|
||||
|
||||
+26
-20
@@ -248,39 +248,45 @@ void CardsPrintout::drawCard(DC& dc, const CardP& card, int card_nr) {
|
||||
|
||||
// ----------------------------------------------------------------------------- : PrintWindow
|
||||
|
||||
void print_preview(Window* parent, const SetP& set) {
|
||||
const vector<CardP>* cards_to_print(Window* parent, const SetP& set, const ExportCardSelectionChoices& choices) {
|
||||
// Let the user choose cards
|
||||
CardSelectWindow wnd(parent, set, _LABEL_("select cards print"), _TITLE_("select cards"));
|
||||
//CardSelectWindow wnd(parent, set, _LABEL_("select cards print"), _TITLE_("select cards"));
|
||||
ExportWindowBase wnd(set, choices);
|
||||
wnd.wxDialog::Create(parent, wxID_ANY, _TITLE_("select cards"));
|
||||
wxSizer* s = new wxBoxSizer(wxVERTICAL);
|
||||
wxSizer* s2 = wnd.Create();
|
||||
s->Add(s2, 1, wxEXPAND | wxALL, 8);
|
||||
s->Add(wnd.CreateButtonSizer(wxOK | wxCANCEL) , 0, wxEXPAND | wxALL, 8);
|
||||
s->SetSizeHints(&wnd);
|
||||
wnd.SetSizer(s);
|
||||
wnd.SetSize(300,-1);
|
||||
// show window
|
||||
if (wnd.ShowModal() != wxID_OK) {
|
||||
return; // cancel
|
||||
}
|
||||
vector<CardP> selected;
|
||||
FOR_EACH(c, set->cards) {
|
||||
if (wnd.isSelected(c)) selected.push_back(c);
|
||||
return nullptr; // cancel
|
||||
}
|
||||
return &wnd.getSelection();
|
||||
|
||||
}
|
||||
|
||||
void print_preview(Window* parent, const SetP& set, const ExportCardSelectionChoices& choices) {
|
||||
const vector<CardP>* cards = cards_to_print(parent, set, choices);
|
||||
if (!cards) return;
|
||||
// Show the print preview
|
||||
wxPreviewFrame* frame = new wxPreviewFrame(
|
||||
new wxPrintPreview(
|
||||
new CardsPrintout(set, selected),
|
||||
new CardsPrintout(set, selected)
|
||||
new CardsPrintout(set, *cards),
|
||||
new CardsPrintout(set, *cards)
|
||||
), parent, _TITLE_("print preview"));
|
||||
frame->Initialize();
|
||||
frame->Maximize(true);
|
||||
frame->Show();
|
||||
}
|
||||
|
||||
void print_set(Window* parent, const SetP& set) {
|
||||
// Let the user choose cards
|
||||
CardSelectWindow wnd(parent, set, _LABEL_("select cards print"), _TITLE_("select cards"));
|
||||
if (wnd.ShowModal() != wxID_OK) {
|
||||
return; // cancel
|
||||
}
|
||||
vector<CardP> selected;
|
||||
FOR_EACH(c, set->cards) {
|
||||
if (wnd.isSelected(c)) selected.push_back(c);
|
||||
}
|
||||
void print_set(Window* parent, const SetP& set, const ExportCardSelectionChoices& choices) {
|
||||
const vector<CardP>* cards = cards_to_print(parent, set, choices);
|
||||
if (!cards) return;
|
||||
// Print the cards
|
||||
wxPrinter p;
|
||||
CardsPrintout pout(set, selected);
|
||||
CardsPrintout pout(set, *cards);
|
||||
p.Print(parent, &pout, true);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <util/prec.hpp>
|
||||
#include <util/reflect.hpp>
|
||||
#include <util/real_point.hpp>
|
||||
#include <gui/card_select_window.hpp>
|
||||
|
||||
DECLARE_POINTER_TYPE(Set);
|
||||
class StyleSheet;
|
||||
@@ -19,10 +20,10 @@ class StyleSheet;
|
||||
// ----------------------------------------------------------------------------- : Printing
|
||||
|
||||
/// Show a print preview for the given set
|
||||
void print_preview(Window* parent, const SetP& set);
|
||||
void print_preview(Window* parent, const SetP& set, const ExportCardSelectionChoices& choices);
|
||||
|
||||
/// Print the given set
|
||||
void print_set(Window* parent, const SetP& set);
|
||||
void print_set(Window* parent, const SetP& set, const ExportCardSelectionChoices& choices);
|
||||
|
||||
// ----------------------------------------------------------------------------- : Layout
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# This file contains the keys expected to be in MSE locales
|
||||
# It was automatically generated by tools/locale/locale.pl
|
||||
# Generated on Mon Aug 4 03:28:32 2008
|
||||
# Generated on Fri Aug 8 23:23:10 2008
|
||||
|
||||
action:
|
||||
add control point: 0
|
||||
@@ -49,6 +49,9 @@ button:
|
||||
don't install package: 0
|
||||
edit symbol: 0
|
||||
enabled: 0
|
||||
export custom cards selection: 0
|
||||
export entire set: 0
|
||||
export generated packs: 0
|
||||
fixed seed: 0
|
||||
generate pack: 0
|
||||
hide: 0
|
||||
@@ -75,6 +78,7 @@ button:
|
||||
remove package: 0
|
||||
select: optional, 0
|
||||
select all: 0
|
||||
select cards: 0
|
||||
select none: 0
|
||||
show: 0
|
||||
show editing hints: 0
|
||||
@@ -310,8 +314,10 @@ label:
|
||||
rules: 0
|
||||
save changes: 1
|
||||
seed: 0
|
||||
select cards print: 0
|
||||
select cards: 0
|
||||
select cards print: optional, 0
|
||||
select columns: 0
|
||||
selected card count: 1
|
||||
selection: 0
|
||||
selection height: 0
|
||||
selection left: 0
|
||||
|
||||
@@ -232,6 +232,9 @@ enum ControlID {
|
||||
, ID_SHOW
|
||||
, ID_HIDE
|
||||
// Card select
|
||||
, ID_SELECT_CARDS
|
||||
, ID_SELECTION_CHOICE
|
||||
, ID_SELECTION_CHOICE_MAX = ID_SELECTION_CHOICE + 10
|
||||
, ID_SELECT_ALL
|
||||
, ID_SELECT_NONE
|
||||
// Settings
|
||||
|
||||
Reference in New Issue
Block a user