1//////////////////////////////////////////////////////////////////////
2// This file is part of Remere's Map Editor
3//////////////////////////////////////////////////////////////////////
4// Remere's Map Editor is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// Remere's Map Editor is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with this program. If not, see <http://www.gnu.org/licenses/>.
16//////////////////////////////////////////////////////////////////////
17
18#ifndef _RME_LIVE_TAB_H_
19#define _RME_LIVE_TAB_H_
20
21#include "main.h"
22
23#include "editor_tabs.h"
24#include "application.h"
25#include "live_server.h"
26
27class wxGrid;
28class wxNotebook;
29
30class MapTabbook;
31class LiveSocket;
32class LiveServer;
33
34class LiveLogTab : public EditorTab, public wxPanel {
35public:
36 LiveLogTab(MapTabbook* aui, LiveSocket* socket);
37 ~LiveLogTab();
38
39 void Message(const wxString& str);
40 void Chat(const wxString& speaker, const wxString& str);
41
42 virtual wxWindow* GetWindow() const {
43 return (wxPanel*)this;
44 }
45 virtual wxString GetTitle() const;
46
47 bool IsConnected() const {
48 return socket != nullptr;
49 }
50 void Disconnect();
51
52 LiveSocket* GetSocket() {
53 return socket;
54 }
55
56 void UpdateClientList(const std::unordered_map<uint32_t, LivePeer*>& updatedClients);
57
58 void OnSelectChatbox(wxFocusEvent& evt);
59 void OnDeselectChatbox(wxFocusEvent& evt);
60
61 void OnChat(wxCommandEvent& evt);
62 void OnKeyDown(wxKeyEvent& evt);
63 void OnResizeChat(wxSizeEvent& evt);
64 void OnResizeClientList(wxSizeEvent& evt);
65 void OnCopySelectedLogText(wxCommandEvent& evt);
66 void OnLogRightClick(wxMouseEvent& evt);
67 void OnPageChanged(wxBookCtrlEvent& evt);
68 void OnGridCellLeftClick(wxGridEvent& evt);
69 void ChangeUserColor(int row, const wxColor& color);
70
71 // Method to get the log file path
72 wxString GetLogFilePath(const wxString& logType);
73
74protected:
75 MapTabbook* aui;
76 LiveSocket* socket;
77 wxNotebook* notebook;
78 wxTextCtrl* debug_log; // For debug messages
79 wxTextCtrl* chat_log; // For player chat
80 wxTextCtrl* input;
81 wxGrid* user_list;
82
83 std::unordered_map<uint32_t, LivePeer*> clients;
84
85 DECLARE_EVENT_TABLE();
86};
87
88#endif
89