mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-11 21:27:01 -04:00
Moved spec_sort to separate file, added more advanced options;
Split 'sort' script function into 'sort_text' and 'sort_list'; Double clicking card in stats panel switches to cards panel git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@587 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -33,6 +33,7 @@ DECLARE_TYPEOF_COLLECTION(CardListBase*);
|
||||
// ----------------------------------------------------------------------------- : Events
|
||||
|
||||
DEFINE_EVENT_TYPE(EVENT_CARD_SELECT);
|
||||
DEFINE_EVENT_TYPE(EVENT_CARD_ACTIVATE);
|
||||
|
||||
// ----------------------------------------------------------------------------- : CardListBase
|
||||
|
||||
@@ -352,11 +353,18 @@ void CardListBase::onContextMenu(wxContextMenuEvent&) {
|
||||
}
|
||||
}
|
||||
|
||||
void CardListBase::onItemActivate(wxListEvent& ev) {
|
||||
selectItemPos(ev.GetIndex(), false);
|
||||
CardSelectEvent event(getCard(), EVENT_CARD_ACTIVATE);
|
||||
ProcessEvent(event);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : CardListBase : Event table
|
||||
|
||||
BEGIN_EVENT_TABLE(CardListBase, ItemList)
|
||||
EVT_LIST_COL_RIGHT_CLICK (wxID_ANY, CardListBase::onColumnRightClick)
|
||||
EVT_LIST_COL_END_DRAG (wxID_ANY, CardListBase::onColumnResize)
|
||||
EVT_LIST_ITEM_ACTIVATED (wxID_ANY, CardListBase::onItemActivate)
|
||||
EVT_CHAR ( CardListBase::onChar)
|
||||
EVT_MOTION ( CardListBase::onDrag)
|
||||
EVT_MENU (ID_SELECT_COLUMNS, CardListBase::onSelectColumns)
|
||||
|
||||
@@ -19,17 +19,25 @@ DECLARE_POINTER_TYPE(Field);
|
||||
|
||||
// ----------------------------------------------------------------------------- : Events
|
||||
|
||||
DECLARE_EVENT_TYPE(EVENT_CARD_SELECT, <not used>)
|
||||
/// Handle CardSelectEvents
|
||||
DECLARE_EVENT_TYPE(EVENT_CARD_SELECT, <not used>)
|
||||
DECLARE_EVENT_TYPE(EVENT_CARD_ACTIVATE, <not used>)
|
||||
|
||||
/// Handle EVENT_CARD_SELECT events
|
||||
#define EVT_CARD_SELECT(id, handler) \
|
||||
DECLARE_EVENT_TABLE_ENTRY(EVENT_CARD_SELECT, id, -1, \
|
||||
(wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) \
|
||||
(void (wxEvtHandler::*)(CardSelectEvent&)) (&handler), (wxObject*) NULL),
|
||||
|
||||
/// Handle EVENT_CARD_ACTIVATE events
|
||||
#define EVT_CARD_ACTIVATE(id, handler) \
|
||||
DECLARE_EVENT_TABLE_ENTRY(EVENT_CARD_ACTIVATE, id, -1, \
|
||||
(wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) \
|
||||
(void (wxEvtHandler::*)(CardSelectEvent&)) (&handler), (wxObject*) NULL),
|
||||
|
||||
/// The event of selecting a card
|
||||
struct CardSelectEvent : public wxCommandEvent {
|
||||
inline CardSelectEvent(const CardP& card)
|
||||
: wxCommandEvent(EVENT_CARD_SELECT), card(card)
|
||||
inline CardSelectEvent(const CardP& card, int type = EVENT_CARD_SELECT)
|
||||
: wxCommandEvent(type), card(card)
|
||||
{}
|
||||
|
||||
CardP card; ///< The selected card
|
||||
@@ -122,11 +130,12 @@ class CardListBase : public ItemList, public SetView {
|
||||
// --------------------------------------------------- : Window events
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
void onColumnRightClick(wxListEvent& ev);
|
||||
void onColumnResize (wxListEvent& ev);
|
||||
void onSelectColumns (wxCommandEvent& ev);
|
||||
void onChar (wxKeyEvent& ev);
|
||||
void onDrag (wxMouseEvent& ev);
|
||||
void onColumnRightClick(wxListEvent&);
|
||||
void onColumnResize (wxListEvent&);
|
||||
void onItemActivate (wxListEvent&);
|
||||
void onSelectColumns (wxCommandEvent&);
|
||||
void onChar (wxKeyEvent&);
|
||||
void onDrag (wxMouseEvent&);
|
||||
void onContextMenu (wxContextMenuEvent&);
|
||||
};
|
||||
|
||||
|
||||
+16
-5
@@ -199,12 +199,19 @@ void SetWindow::addPanel(IconMenu* windowMenu, wxToolBar* tabBar, SetWindowPanel
|
||||
|
||||
void SetWindow::selectPanel(int id) {
|
||||
SetWindowPanel* toSelect = panels.at(id - ID_WINDOW_MIN);
|
||||
if (current_panel != toSelect) {
|
||||
// destroy & create menus
|
||||
if (current_panel) current_panel->destroyUI(GetToolBar(), GetMenuBar());
|
||||
current_panel = toSelect;
|
||||
current_panel->initUI(GetToolBar(), GetMenuBar());
|
||||
if (current_panel == toSelect) {
|
||||
// don't change, but fix tab bar
|
||||
wxToolBar* tabBar = (wxToolBar*)FindWindow(ID_TAB_BAR);
|
||||
int wid = ID_WINDOW_MIN;
|
||||
FOR_EACH(p, panels) {
|
||||
tabBar->ToggleTool(wid++, p == current_panel);
|
||||
}
|
||||
return;
|
||||
}
|
||||
// destroy & create menus
|
||||
if (current_panel) current_panel->destroyUI(GetToolBar(), GetMenuBar());
|
||||
current_panel = toSelect;
|
||||
current_panel->initUI(GetToolBar(), GetMenuBar());
|
||||
// show/hide panels and select tabs
|
||||
wxSizer* sizer = GetSizer();
|
||||
wxToolBar* tabBar = (wxToolBar*)FindWindow(ID_TAB_BAR);
|
||||
@@ -282,6 +289,9 @@ void SetWindow::onCardSelect(CardSelectEvent& ev) {
|
||||
p->selectCard(ev.card);
|
||||
}
|
||||
}
|
||||
void SetWindow::onCardActivate(CardSelectEvent& ev) {
|
||||
selectPanel(ID_WINDOW_CARDS);
|
||||
}
|
||||
|
||||
void SetWindow::fixMinWindowSize() {
|
||||
current_panel->SetMinSize(current_panel->GetSizer()->GetMinSize());
|
||||
@@ -699,5 +709,6 @@ BEGIN_EVENT_TABLE(SetWindow, wxFrame)
|
||||
EVT_CLOSE ( SetWindow::onClose)
|
||||
EVT_IDLE ( SetWindow::onIdle)
|
||||
EVT_CARD_SELECT (wxID_ANY, SetWindow::onCardSelect)
|
||||
EVT_CARD_ACTIVATE (wxID_ANY, SetWindow::onCardActivate)
|
||||
EVT_SIZE_CHANGE (wxID_ANY, SetWindow::onSizeChange)
|
||||
END_EVENT_TABLE ()
|
||||
|
||||
@@ -76,6 +76,7 @@ class SetWindow : public wxFrame, public SetView {
|
||||
private:
|
||||
/// A different card has been selected
|
||||
void onCardSelect(CardSelectEvent&);
|
||||
void onCardActivate(CardSelectEvent&);
|
||||
|
||||
// minSize = mainSizer->getMinWindowSize(this)
|
||||
// but wx made that private
|
||||
|
||||
Reference in New Issue
Block a user