diff --git a/src/gui/control/native_look_editor.cpp b/src/gui/control/native_look_editor.cpp index 37d75ae5..9eac6d61 100644 --- a/src/gui/control/native_look_editor.cpp +++ b/src/gui/control/native_look_editor.cpp @@ -42,8 +42,6 @@ void NativeLookEditor::drawViewer(RotatedDC& dc, ValueViewer& v) { draw_control_border(this, dc.getDC(), wxRect(s.left - 1, s.top - 1, s.width + 2, s.height + 2)); // draw viewer v.draw(dc); - ValueEditor* e = v.getEditor(); - if (e) e->drawSelection(dc); } void NativeLookEditor::resizeViewers() { @@ -66,7 +64,7 @@ void NativeLookEditor::resizeViewers() { } void NativeLookEditor::onInit() { - // Give fieldEditors a chance to show/hide controls (scrollbar) when selecting other editors + // Give viewers a chance to show/hide controls (scrollbar) when selecting other editors FOR_EACH_EDITOR { e->onShow(true); } diff --git a/src/gui/set/cards_panel.cpp b/src/gui/set/cards_panel.cpp index 8609a9c8..ce108174 100644 --- a/src/gui/set/cards_panel.cpp +++ b/src/gui/set/cards_panel.cpp @@ -9,9 +9,11 @@ #include #include #include +#include #include #include #include +#include #include #include #include @@ -23,25 +25,27 @@ CardsPanel::CardsPanel(Window* parent, int id) : SetWindowPanel(parent, id, false) { // init controls -// Panel* notesP - editor = new CardEditor(this, ID_EDITOR); -// splitter = new SplitterWindow(&this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0); + wxPanel* notesP; + wxSplitterWindow* splitter; + editor = new CardEditor(this, ID_EDITOR); + splitter = new wxSplitterWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0); // card_list = new EditCardList(splitter, ID_CARD_LIST); - card_list = new CardListBase(this, ID_CARD_LIST); + card_list = new CardListBase(splitter, ID_CARD_LIST); + notesP = new Panel(splitter, wxID_ANY); + notes = new TextCtrl(notesP, ID_NOTES); + // init sizer for notes panel + wxSizer* sn = new wxBoxSizer(wxVERTICAL); + sn->Add(new wxStaticText(notesP, wxID_ANY, _("Card notes:")), 0, wxEXPAND, 2); + sn->Add(notes, 1, wxEXPAND | wxTOP, 2); + notesP->SetSizer(sn); // init splitter -// splitter->minimumPaneSize = 14; -// splitter->sashGravity = 1.0; -// splitter->splitHorizontally(cardList, notesP, -40); + splitter->SetMinimumPaneSize(14); + splitter->SetSashGravity(1.0); + splitter->SplitHorizontally(card_list, notesP, -40); // init sizer -/* Sizer* s = new wxBoxSizer(wxHORIZONTAL); - s->Add(editor, 0, wxRIGHT, 2); - s->Add(splitter, 1, wxEXPAND); - s->SetSizeHints(this); - SetSizer(s); -*/ wxSizer* s = new wxBoxSizer(wxHORIZONTAL); - s->Add(editor, 0, wxRIGHT, 2); - s->Add(card_list, 1, wxEXPAND); + s->Add(editor, 0, wxRIGHT, 2); + s->Add(splitter, 1, wxEXPAND); s->SetSizeHints(this); SetSizer(s); } @@ -52,6 +56,7 @@ CardsPanel::~CardsPanel() { void CardsPanel::onChangeSet() { editor->setSet(set); + notes->setSet(set); card_list->setSet(set); /* // resize editor Sizer* s = sizer; @@ -230,4 +235,5 @@ CardP CardsPanel::selectedCard() const { void CardsPanel::selectCard(const CardP& card) { card_list->setCard(card); editor->setCard(card); + notes->setValue(card ? &card->notes : nullptr); } diff --git a/src/gui/set/cards_panel.hpp b/src/gui/set/cards_panel.hpp index 08409023..54c9d70c 100644 --- a/src/gui/set/cards_panel.hpp +++ b/src/gui/set/cards_panel.hpp @@ -15,6 +15,7 @@ class wxSplitterWindow; class CardListBase; class DataEditor; +class TextCtrl; // ----------------------------------------------------------------------------- : CardsPanel @@ -83,7 +84,7 @@ class CardsPanel : public SetWindowPanel { bool findInValue(const CardP& crd_, virtual const ValueP& value, int firstChar, FindReplaceData& what, const FindHandler& handler); */ public: - + // --------------------------------------------------- : Selection virtual CardP selectedCard() const; virtual void selectCard(const CardP& card); @@ -93,7 +94,7 @@ class CardsPanel : public SetWindowPanel { wxSplitterWindow* splitter; DataEditor* editor; CardListBase* card_list; -// DataTextCtrl* notes; + TextCtrl* notes; // --------------------------------------------------- : Menus & tools wxMenu* cardMenu, formatMenu; diff --git a/src/gui/set/keywords_panel.cpp b/src/gui/set/keywords_panel.cpp index fd4fce8f..ee2e1a38 100644 --- a/src/gui/set/keywords_panel.cpp +++ b/src/gui/set/keywords_panel.cpp @@ -7,9 +7,25 @@ // ----------------------------------------------------------------------------- : Includes #include +#include +#include // ----------------------------------------------------------------------------- : KeywordsList +/// A control that lists the keywords in a set or game +class KeywordList : public wxListView { + public: + KeywordList(Window* parent, int id); + + /// Set the list of keywords to show + void setData(vector& dat); + + bool canSelectPrevious() const; + bool canSelectNext() const; + void selectPrevious(); + void selectNext(); +}; + // ----------------------------------------------------------------------------- : KeywordsPanel KeywordsPanel::KeywordsPanel(Window* parent, int id) diff --git a/src/gui/value/choice.cpp b/src/gui/value/choice.cpp index a3662608..b5bb6dbd 100644 --- a/src/gui/value/choice.cpp +++ b/src/gui/value/choice.cpp @@ -102,7 +102,8 @@ void ChoiceValueEditor::onLoseFocus() { drop_down->hide(false); } -void ChoiceValueEditor::drawSelection(RotatedDC& dc) { +void ChoiceValueEditor::draw(RotatedDC& dc) { + ChoiceValueViewer::draw(dc); if (nativeLook()) { draw_drop_down_arrow(&editor(), dc.getDC(), style().getRect().grow(1), drop_down->IsShown()); } diff --git a/src/gui/value/choice.hpp b/src/gui/value/choice.hpp index a2f48c8f..89557532 100644 --- a/src/gui/value/choice.hpp +++ b/src/gui/value/choice.hpp @@ -28,7 +28,7 @@ class ChoiceValueEditor : public ChoiceValueViewer, public ValueEditor { virtual void onChar(wxKeyEvent& ev); virtual void onLoseFocus(); - virtual void drawSelection(RotatedDC& dc); + virtual void draw(RotatedDC& dc); virtual void determineSize(); private: diff --git a/src/gui/value/color.cpp b/src/gui/value/color.cpp index 3883137f..51b89d49 100644 --- a/src/gui/value/color.cpp +++ b/src/gui/value/color.cpp @@ -138,7 +138,8 @@ void ColorValueEditor::onLoseFocus() { drop_down->hide(false); } -void ColorValueEditor::drawSelection(RotatedDC& dc) { +void ColorValueEditor::draw(RotatedDC& dc) { + ColorValueViewer::draw(dc); if (nativeLook()) { draw_drop_down_arrow(&editor(), dc.getDC(), style().getRect().grow(1), drop_down->IsShown()); } diff --git a/src/gui/value/color.hpp b/src/gui/value/color.hpp index b33636cc..dfb03431 100644 --- a/src/gui/value/color.hpp +++ b/src/gui/value/color.hpp @@ -27,7 +27,7 @@ class ColorValueEditor : public ColorValueViewer, public ValueEditor { virtual void onChar(wxKeyEvent& ev); virtual void onLoseFocus(); - virtual void drawSelection(RotatedDC& dc); + virtual void draw(RotatedDC& dc); virtual void determineSize(); private: diff --git a/src/gui/value/editor.hpp b/src/gui/value/editor.hpp index 50066698..e30cb263 100644 --- a/src/gui/value/editor.hpp +++ b/src/gui/value/editor.hpp @@ -99,11 +99,6 @@ class ValueEditor { virtual void determineSize() {} /// The editor is shown or hidden virtual void onShow(bool) {} - - /// Draw selection indicators - /** note: the drawing of the value is done by the viewer, only a selection indicator is drawn here - */ - virtual void drawSelection(RotatedDC& dc) {} }; // ----------------------------------------------------------------------------- : Utility diff --git a/src/mse.vcproj b/src/mse.vcproj index 7005bf72..df6d5562 100644 --- a/src/mse.vcproj +++ b/src/mse.vcproj @@ -585,6 +585,12 @@ + + + + { init_object(key, (*this)[key->index]); } } + /// Change this map by adding an additional key and value + void add(const Key& key, const Value& value) { + assert(get_key(value) == key); + if (key->index >= this->size()) this->resize(key->index + 1); + (*this)[key->index] = value; + } /// Retrieve a value given its key inline Value operator [] (const Key& key) {