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:
twanvl
2007-07-06 16:32:17 +00:00
parent 1ca8c9ec99
commit b3d0d69437
3 changed files with 40 additions and 5 deletions
+25 -3
View File
@@ -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();