mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 21:06:59 -04:00
Stats panel stays up to date when cards change;
Shift+Enter inserts soft line break in text editor (TODO: cursor is moved incorrectly) git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@508 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -98,6 +98,7 @@ void StatCategoryList::drawItem(DC& dc, int x, int y, size_t item, bool selected
|
||||
|
||||
StatsPanel::StatsPanel(Window* parent, int id)
|
||||
: SetWindowPanel(parent, id)
|
||||
, up_to_date(true), active(false)
|
||||
{
|
||||
// init controls
|
||||
wxSplitterWindow* splitter;
|
||||
@@ -120,13 +121,25 @@ StatsPanel::StatsPanel(Window* parent, int id)
|
||||
void StatsPanel::onChangeSet() {
|
||||
card_list->setSet(set);
|
||||
categories->show(set->game);
|
||||
onCategorySelect();
|
||||
onChange();
|
||||
}
|
||||
|
||||
void StatsPanel::onAction(const Action&, bool undone) {
|
||||
onChange();
|
||||
}
|
||||
|
||||
void StatsPanel::initUI (wxToolBar*, wxMenuBar*) {
|
||||
active = true;
|
||||
if (!up_to_date) showCategory();
|
||||
}
|
||||
void StatsPanel::destroyUI(wxToolBar*, wxMenuBar*) {
|
||||
active = false;
|
||||
}
|
||||
|
||||
void StatsPanel::onCommand(int id) {
|
||||
switch (id) {
|
||||
case ID_FIELD_LIST: {
|
||||
onCategorySelect();
|
||||
onChange();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -151,7 +164,16 @@ class StatsFilter : public CardListFilter {
|
||||
Set& set;
|
||||
};
|
||||
|
||||
void StatsPanel::onCategorySelect() {
|
||||
void StatsPanel::onChange() {
|
||||
if (active) {
|
||||
showCategory();
|
||||
} else {
|
||||
up_to_date = false; // update later
|
||||
}
|
||||
}
|
||||
|
||||
void StatsPanel::showCategory() {
|
||||
up_to_date = true;
|
||||
// change graph data
|
||||
if (categories->hasSelection()) {
|
||||
StatsCategory& cat = categories->getSelection();
|
||||
|
||||
Reference in New Issue
Block a user