about summary refs log tree commit diff stats
path: root/tracker_frame.cpp
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2023-05-05 15:46:58 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2023-05-05 15:46:58 -0400
commit149e7c0836927e14a926a952bd1a7f0d1b49e779 (patch)
tree2c7ac89387eb890d3d345217b79929e9a23f4ecf /tracker_frame.cpp
parent0dace7831673170bd31eefa6bbe6e705211d3061 (diff)
downloadlingo-ap-tracker-149e7c0836927e14a926a952bd1a7f0d1b49e779.tar.gz
lingo-ap-tracker-149e7c0836927e14a926a952bd1a7f0d1b49e779.tar.bz2
lingo-ap-tracker-149e7c0836927e14a926a952bd1a7f0d1b49e779.zip
Organised repo
Diffstat (limited to 'tracker_frame.cpp')
-rw-r--r--tracker_frame.cpp86
1 files changed, 0 insertions, 86 deletions
diff --git a/tracker_frame.cpp b/tracker_frame.cpp deleted file mode 100644 index 2a862a5..0000000 --- a/tracker_frame.cpp +++ /dev/null
@@ -1,86 +0,0 @@
1#include "tracker_frame.h"
2
3#include "ap_state.h"
4#include "connection_dialog.h"
5#include "tracker_config.h"
6#include "tracker_panel.h"
7
8enum TrackerFrameIds { ID_CONNECT = 1 };
9
10wxDEFINE_EVENT(STATE_CHANGED, wxCommandEvent);
11wxDEFINE_EVENT(STATUS_CHANGED, wxCommandEvent);
12
13TrackerFrame::TrackerFrame()
14 : wxFrame(nullptr, wxID_ANY, "Lingo Archipelago Tracker", wxDefaultPosition,
15 wxDefaultSize, wxDEFAULT_FRAME_STYLE | wxFULL_REPAINT_ON_RESIZE) {
16 ::wxInitAllImageHandlers();
17
18 AP_SetTrackerFrame(this);
19
20 SetSize(1280, 728);
21
22 wxMenu *menuFile = new wxMenu();
23 menuFile->Append(ID_CONNECT, "&Connect");
24 menuFile->Append(wxID_EXIT);
25
26 wxMenu *menuHelp = new wxMenu();
27 menuHelp->Append(wxID_ABOUT);
28
29 wxMenuBar *menuBar = new wxMenuBar();
30 menuBar->Append(menuFile, "&File");
31 menuBar->Append(menuHelp, "&Help");
32
33 SetMenuBar(menuBar);
34
35 CreateStatusBar();
36 SetStatusText("Not connected to Archipelago.");
37
38 Bind(wxEVT_MENU, &TrackerFrame::OnAbout, this, wxID_ABOUT);
39 Bind(wxEVT_MENU, &TrackerFrame::OnExit, this, wxID_EXIT);
40 Bind(wxEVT_MENU, &TrackerFrame::OnConnect, this, ID_CONNECT);
41 Bind(STATE_CHANGED, &TrackerFrame::OnStateChanged, this);
42 Bind(STATUS_CHANGED, &TrackerFrame::OnStatusChanged, this);
43
44 tracker_panel_ = new TrackerPanel(this);
45}
46
47void TrackerFrame::SetStatusMessage(std::string message) {
48 wxCommandEvent *event = new wxCommandEvent(STATUS_CHANGED);
49 event->SetString(message.c_str());
50
51 QueueEvent(event);
52}
53
54void TrackerFrame::UpdateIndicators() {
55 QueueEvent(new wxCommandEvent(STATE_CHANGED));
56}
57
58void TrackerFrame::OnAbout(wxCommandEvent &event) {
59 wxMessageBox("Lingo Archipelago Tracker by hatkirby",
60 "About lingo-ap-tracker", wxOK | wxICON_INFORMATION);
61}
62
63void TrackerFrame::OnExit(wxCommandEvent &event) { Close(true); }
64
65void TrackerFrame::OnConnect(wxCommandEvent &event) {
66 ConnectionDialog dlg;
67
68 if (dlg.ShowModal() == wxID_OK) {
69 GetTrackerConfig().ap_server = dlg.GetServerValue();
70 GetTrackerConfig().ap_player = dlg.GetPlayerValue();
71 GetTrackerConfig().ap_password = dlg.GetPasswordValue();
72 GetTrackerConfig().Save();
73
74 AP_Connect(dlg.GetServerValue(), dlg.GetPlayerValue(),
75 dlg.GetPasswordValue());
76 }
77}
78
79void TrackerFrame::OnStateChanged(wxCommandEvent &event) {
80 tracker_panel_->UpdateIndicators();
81 Refresh();
82}
83
84void TrackerFrame::OnStatusChanged(wxCommandEvent &event) {
85 SetStatusText(event.GetString());
86}
51 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807