mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -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();
|
||||
|
||||
@@ -26,6 +26,10 @@ class StatsPanel : public SetWindowPanel {
|
||||
// --------------------------------------------------- : UI
|
||||
|
||||
virtual void onChangeSet();
|
||||
virtual void onAction(const Action&, bool undone);
|
||||
|
||||
virtual void initUI (wxToolBar*, wxMenuBar*);
|
||||
virtual void destroyUI(wxToolBar*, wxMenuBar*);
|
||||
virtual void onCommand(int id);
|
||||
|
||||
// --------------------------------------------------- : Selection
|
||||
@@ -40,8 +44,12 @@ class StatsPanel : public SetWindowPanel {
|
||||
GraphControl* graph;
|
||||
FilteredCardList* card_list;
|
||||
|
||||
void onCategorySelect();
|
||||
bool up_to_date; ///< Are the graph and card list up to date?
|
||||
bool active; ///< Is this panel selected?
|
||||
|
||||
void onChange();
|
||||
void onGraphSelect(wxCommandEvent&);
|
||||
void showCategory();
|
||||
void filterCards();
|
||||
};
|
||||
|
||||
|
||||
@@ -192,7 +192,12 @@ bool TextValueEditor::onChar(wxKeyEvent& ev) {
|
||||
break;
|
||||
case WXK_RETURN:
|
||||
if (field().multi_line) {
|
||||
replaceSelection(_("\n"), _("Enter"));
|
||||
if (ev.ShiftDown()) {
|
||||
// soft line break
|
||||
replaceSelection(_("<soft-line>\n</soft-line>"), _("Soft line break"));
|
||||
} else {
|
||||
replaceSelection(_("\n"), _("Enter"));
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user