Commit 5cdd01a7 authored by twanvl's avatar twanvl

Icon for random cards panel

parent bcb9a857
...@@ -44,7 +44,7 @@ void ItemList::selectNext() { ...@@ -44,7 +44,7 @@ void ItemList::selectNext() {
selectItemPos(selected_item_pos + 1, true, true); selectItemPos(selected_item_pos + 1, true, true);
} }
void ItemList::selectFirst() { void ItemList::selectFirst() {
assert(0 < (long)sorted_list.size()); if (sorted_list.empty()) return;
selectItemPos(0, true); selectItemPos(0, true);
} }
......
...@@ -113,10 +113,10 @@ void PackTotalsPanel::draw(DC& dc) { ...@@ -113,10 +113,10 @@ void PackTotalsPanel::draw(DC& dc) {
} }
// draw total // draw total
dc.SetPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW)); dc.SetPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW));
dc.DrawLine(0, y-4, size.x, y-4);
dc.SetPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DHIGHLIGHT));
dc.DrawLine(0, y-3, size.x, y-3); dc.DrawLine(0, y-3, size.x, y-3);
y += 6; dc.SetPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DHIGHLIGHT));
dc.DrawLine(0, y-2, size.x, y-2);
y += 7;
drawItem(dc, y, _LABEL_("total cards"), total); drawItem(dc, y, _LABEL_("total cards"), total);
} }
...@@ -334,6 +334,7 @@ void RandomPackPanel::generate() { ...@@ -334,6 +334,7 @@ void RandomPackPanel::generate() {
} }
} }
card_list->rebuild(); card_list->rebuild();
card_list->selectFirst();
} }
// ----------------------------------------------------------------------------- : Selection // ----------------------------------------------------------------------------- : Selection
...@@ -343,7 +344,12 @@ CardP RandomPackPanel::selectedCard() const { ...@@ -343,7 +344,12 @@ CardP RandomPackPanel::selectedCard() const {
} }
void RandomPackPanel::selectCard(const CardP& card) { void RandomPackPanel::selectCard(const CardP& card) {
preview->setCard(card); // Don't change the card based on other panels
//preview->setCard(card);
}
void RandomPackPanel::onCardSelect(CardSelectEvent& ev) {
preview->setCard(ev.getCard());
ev.Skip(); // but do change other panels' selection
} }
void RandomPackPanel::selectionChoices(ExportCardSelectionChoices& out) { void RandomPackPanel::selectionChoices(ExportCardSelectionChoices& out) {
...@@ -353,6 +359,12 @@ void RandomPackPanel::selectionChoices(ExportCardSelectionChoices& out) { ...@@ -353,6 +359,12 @@ void RandomPackPanel::selectionChoices(ExportCardSelectionChoices& out) {
)); ));
} }
BEGIN_EVENT_TABLE(RandomPackPanel, wxPanel)
EVT_CARD_SELECT(wxID_ANY, RandomPackPanel::onCardSelect)
END_EVENT_TABLE ()
// ----------------------------------------------------------------------------- : Clipboard // ----------------------------------------------------------------------------- : Clipboard
bool RandomPackPanel::canCopy() const { return card_list->canCopy(); } bool RandomPackPanel::canCopy() const { return card_list->canCopy(); }
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
class CardViewer; class CardViewer;
class RandomCardList; class RandomCardList;
class PackTotalsPanel; class PackTotalsPanel;
struct CardSelectEvent;
DECLARE_POINTER_TYPE(PackType); DECLARE_POINTER_TYPE(PackType);
// ----------------------------------------------------------------------------- : RandomPackPanel // ----------------------------------------------------------------------------- : RandomPackPanel
...@@ -47,6 +48,8 @@ class RandomPackPanel : public SetWindowPanel { ...@@ -47,6 +48,8 @@ class RandomPackPanel : public SetWindowPanel {
virtual void doCopy(); virtual void doCopy();
private: private:
DECLARE_EVENT_TABLE();
CardViewer* preview; ///< Card preview CardViewer* preview; ///< Card preview
RandomCardList* card_list; ///< The list of cards RandomCardList* card_list; ///< The list of cards
wxTextCtrl* seed; ///< Seed value wxTextCtrl* seed; ///< Seed value
...@@ -74,6 +77,8 @@ class RandomPackPanel : public SetWindowPanel { ...@@ -74,6 +77,8 @@ class RandomPackPanel : public SetWindowPanel {
void generate(); void generate();
/// Store the settings /// Store the settings
void storeSettings(); void storeSettings();
void onCardSelect(CardSelectEvent& ev);
public: public:
typedef PackItem PackItem_for_typeof; typedef PackItem PackItem_for_typeof;
}; };
......
...@@ -146,7 +146,7 @@ SetWindow::SetWindow(Window* parent, const SetP& set) ...@@ -146,7 +146,7 @@ SetWindow::SetWindow(Window* parent, const SetP& set)
addPanel(menuWindow, tabBar, new StylePanel (this, wxID_ANY), 2, _("window_style"), _("style tab")); addPanel(menuWindow, tabBar, new StylePanel (this, wxID_ANY), 2, _("window_style"), _("style tab"));
addPanel(menuWindow, tabBar, new KeywordsPanel (this, wxID_ANY), 3, _("window_keywords"), _("keywords tab")); addPanel(menuWindow, tabBar, new KeywordsPanel (this, wxID_ANY), 3, _("window_keywords"), _("keywords tab"));
addPanel(menuWindow, tabBar, new StatsPanel (this, wxID_ANY), 4, _("window_statistics"), _("stats tab")); addPanel(menuWindow, tabBar, new StatsPanel (this, wxID_ANY), 4, _("window_statistics"), _("stats tab"));
addPanel(menuWindow, tabBar, new RandomPackPanel(this, wxID_ANY), 5, _("window_cards"), _("random pack tab")); // TODO: Get me an icon addPanel(menuWindow, tabBar, new RandomPackPanel(this, wxID_ANY), 5, _("window_random_pack"),_("random pack tab"));
selectPanel(ID_WINDOW_CARDS); // select cards panel selectPanel(ID_WINDOW_CARDS); // select cards panel
// loose ends // loose ends
......
...@@ -65,6 +65,7 @@ tool/window_set_info IMAGE "tool/window_set_info.png" ...@@ -65,6 +65,7 @@ tool/window_set_info IMAGE "tool/window_set_info.png"
tool/window_style IMAGE "tool/window_style.png" tool/window_style IMAGE "tool/window_style.png"
tool/window_keywords IMAGE "tool/window_keywords.png" tool/window_keywords IMAGE "tool/window_keywords.png"
tool/window_statistics IMAGE "tool/window_statistics.png" tool/window_statistics IMAGE "tool/window_statistics.png"
tool/window_random_pack IMAGE "tool/window_random_pack.png"
tool/help IMAGE "tool/help.png" tool/help IMAGE "tool/help.png"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment