| 1 |
/* Copyright (C) 2025 Wildfire Games. |
| 2 |
* This file is part of 0 A.D. |
| 3 |
* |
| 4 |
* 0 A.D. 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 2 of the License, or |
| 7 |
* (at your option) any later version. |
| 8 |
* |
| 9 |
* 0 A.D. 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 0 A.D. If not, see <http://www.gnu.org/licenses/>. |
| 16 |
*/ |
| 17 |
|
| 18 |
#ifndef INCLUDED_SCENARIOEDITOR |
| 19 |
#define INCLUDED_SCENARIOEDITOR |
| 20 |
|
| 21 |
#include "tools/atlas/AtlasObject/AtlasObject.h" |
| 22 |
#include "tools/atlas/AtlasUI/CustomControls/FileHistory/FileHistory.h" |
| 23 |
#include "tools/atlas/AtlasUI/General/Observable.h" |
| 24 |
#include "tools/atlas/AtlasUI/ScenarioEditor/SectionLayout.h" |
| 25 |
#include "tools/atlas/AtlasUI/ScenarioEditor/Tools/Common/MiscState.h" |
| 26 |
#include "tools/atlas/AtlasUI/ScenarioEditor/Tools/Common/ObjectSettings.h" |
| 27 |
#include "tools/atlas/AtlasUI/ScenarioEditor/Tools/Common/Tools.h" |
| 28 |
|
| 29 |
#include <map> |
| 30 |
#include <vector> |
| 31 |
#include <wx/defs.h> |
| 32 |
#include <wx/event.h> |
| 33 |
#include <wx/frame.h> |
| 34 |
#include <wx/icon.h> |
| 35 |
#include <wx/string.h> |
| 36 |
#include <wx/timer.h> |
| 37 |
|
| 38 |
class AtlasWindowCommandProc; |
| 39 |
class wxWindow; |
| 40 |
|
| 41 |
class ScenarioEditor : public wxFrame |
| 42 |
{ |
| 43 |
public: |
| 44 |
ScenarioEditor(wxWindow* parent); |
| 45 |
void OnClose(wxCloseEvent& event); |
| 46 |
void OnTimer(wxTimerEvent& event); |
| 47 |
void OnIdle(wxIdleEvent& event); |
| 48 |
wxToolBar* OnCreateToolBar(long style, wxWindowID id, const wxString &name); |
| 49 |
|
| 50 |
void OnNew(wxCommandEvent& event); |
| 51 |
void OnOpen(wxCommandEvent& event); |
| 52 |
void OnSave(wxCommandEvent& event); |
| 53 |
void OnSaveAs(wxCommandEvent& event); |
| 54 |
void OnImportHeightmap(wxCommandEvent& event); |
| 55 |
void OnMRUFile(wxCommandEvent& event); |
| 56 |
|
| 57 |
void OnQuit(wxCommandEvent& event); |
| 58 |
void OnUndo(wxCommandEvent& event); |
| 59 |
void OnRedo(wxCommandEvent& event); |
| 60 |
void OnCopy(wxCommandEvent& event); |
| 61 |
void OnPaste(wxCommandEvent& event); |
| 62 |
|
| 63 |
void OnWireframe(wxCommandEvent& event); |
| 64 |
void OnMessageTrace(wxCommandEvent& event); |
| 65 |
void OnScreenshot(wxCommandEvent& event); |
| 66 |
void OnMediaPlayer(wxCommandEvent& event); |
| 67 |
void OnJavaScript(wxCommandEvent& event); |
| 68 |
void OnCameraReset(wxCommandEvent& event); |
| 69 |
void OnDumpState(wxCommandEvent& event); |
| 70 |
void OnSelectedObjectsChange(const std::vector<AtlasMessage::ObjectID>& selectedObjects); |
| 71 |
|
| 72 |
void OnHelp(wxCommandEvent& event); |
| 73 |
|
| 74 |
void OnMenuOpen(wxMenuEvent& event); |
| 75 |
|
| 76 |
bool OpenFile(const wxString& name, const wxString& filename); |
| 77 |
|
| 78 |
void NotifyOnMapReload(); |
| 79 |
|
| 80 |
static AtlasWindowCommandProc& GetCommandProc(); |
| 81 |
|
| 82 |
static float GetSpeedModifier(); |
| 83 |
|
| 84 |
Observable<ObjectSettings>& GetObjectSettings() { return m_ObjectSettings; } |
| 85 |
Observable<AtObj>& GetMapSettings() { return m_MapSettings; } |
| 86 |
|
| 87 |
ToolManager& GetToolManager() { return m_ToolManager; } |
| 88 |
|
| 89 |
void SelectPage(const wxString& classname) { m_SectionLayout.SelectPage(classname); } |
| 90 |
|
| 91 |
bool DiscardChangesDialog(); |
| 92 |
|
| 93 |
private: |
| 94 |
|
| 95 |
ToolManager m_ToolManager; |
| 96 |
|
| 97 |
wxTimer m_Timer; |
| 98 |
wxTimer m_RenderTimer; |
| 99 |
|
| 100 |
SectionLayout m_SectionLayout; |
| 101 |
|
| 102 |
Observable<ObjectSettings> m_ObjectSettings; |
| 103 |
Observable<AtObj> m_MapSettings; |
| 104 |
|
| 105 |
void SetOpenFilename(const wxString& filename); |
| 106 |
wxString m_OpenFilename; |
| 107 |
FileHistory m_FileHistory; |
| 108 |
|
| 109 |
wxIcon m_Icon; |
| 110 |
|
| 111 |
struct HelpItem |
| 112 |
{ |
| 113 |
wxString m_Title, m_Tooltip, m_URL; |
| 114 |
HelpItem(const wxString& title, const wxString& tooltip, const wxString& url) |
| 115 |
: m_Title(title), m_Tooltip(tooltip), m_URL(url) |
| 116 |
{} |
| 117 |
}; |
| 118 |
std::map<int, HelpItem> m_HelpData; |
| 119 |
|
| 120 |
DECLARE_EVENT_TABLE(); |
| 121 |
}; |
| 122 |
|
| 123 |
#endif // INCLUDED_SCENARIOEDITOR |