mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Implement unique IDs and card linking
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include <util/prec.hpp>
|
||||
#include <gui/control/card_editor.hpp>
|
||||
#include <gui/value/editor.hpp>
|
||||
#include <gui/set/cards_panel.hpp>
|
||||
#include <gui/util.hpp>
|
||||
#include <data/field.hpp>
|
||||
#include <data/stylesheet.hpp>
|
||||
@@ -360,6 +361,16 @@ void DataEditor::onMotion(wxMouseEvent& ev) {
|
||||
}
|
||||
}
|
||||
|
||||
void DataEditor::onMouseEnter(wxMouseEvent& ev) {
|
||||
ev.Skip();
|
||||
if (GetId() == ID_CARD_LINK_EDITOR) {
|
||||
CardsPanel* panel = dynamic_cast<CardsPanel*> (GetParent());
|
||||
if (panel) {
|
||||
panel->refreshCard(card);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DataEditor::onMouseLeave(wxMouseEvent& ev) {
|
||||
// on mouse leave for editor
|
||||
if (hovered_viewer) {
|
||||
@@ -462,6 +473,13 @@ void DataEditor::onChar(wxKeyEvent& ev) {
|
||||
} else {
|
||||
ev.Skip();
|
||||
}
|
||||
|
||||
if (GetId() == ID_CARD_LINK_EDITOR) {
|
||||
CardsPanel* panel = dynamic_cast<CardsPanel*> (GetParent());
|
||||
if (panel) {
|
||||
panel->refreshCard(card);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : Menu events
|
||||
@@ -503,6 +521,10 @@ void DataEditor::onFocus(wxFocusEvent& ev) {
|
||||
selectFirst();
|
||||
}
|
||||
}
|
||||
CardsPanel* panel = dynamic_cast<CardsPanel*> (GetParent());
|
||||
if (panel) {
|
||||
panel->setFocusedEditor(this);
|
||||
}
|
||||
}
|
||||
void DataEditor::onLoseFocus(wxFocusEvent& ev) {
|
||||
if (current_editor) {
|
||||
@@ -520,6 +542,7 @@ BEGIN_EVENT_TABLE(DataEditor, CardViewer)
|
||||
EVT_RIGHT_DOWN (DataEditor::onRightDown)
|
||||
EVT_MOTION (DataEditor::onMotion)
|
||||
EVT_MOUSEWHEEL (DataEditor::onMouseWheel)
|
||||
EVT_ENTER_WINDOW (DataEditor::onMouseEnter)
|
||||
EVT_LEAVE_WINDOW (DataEditor::onMouseLeave)
|
||||
EVT_CONTEXT_MENU (DataEditor::onContextMenu)
|
||||
EVT_MENU (wxID_ANY, DataEditor::onMenu)
|
||||
|
||||
Reference in New Issue
Block a user