-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathWL4EditorWindow.h
181 lines (168 loc) · 7.66 KB
/
WL4EditorWindow.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
#ifndef WL4EDITORWINDOW_H
#define WL4EDITORWINDOW_H
#include <QButtonGroup>
#include <QLabel>
#include <QMainWindow>
#include "Dialog/ChooseLevelDialog.h"
#include "Dialog/DoorConfigDialog.h"
#include "Dialog/LevelConfigDialog.h"
#include "Dialog/RoomConfigDialog.h"
#include "Dialog/TilesetEditDialog.h"
#include "Dialog/CreditsEditDialog.h"
#include "DockWidget/CameraControlDockWidget.h"
#include "DockWidget/EditModeDockWidget.h"
#include "DockWidget/EntitySetDockWidget.h"
#include "DockWidget/Tile16DockWidget.h"
#include "DockWidget/OutputDockWidget.h"
#include "LevelComponents/Level.h"
#include "LevelComponents/Room.h"
namespace Ui
{
class WL4EditorWindow;
}
class WL4EditorWindow : public QMainWindow
{
Q_OBJECT
private:
Ui::WL4EditorWindow *ui;
QLabel *statusBarLabel;
QLabel *statusBarLabel_MousePosition;
QLabel *statusBarLabel_Scalerate;
QLabel *statusBarLabel_rectselectMode;
Tile16DockWidget *Tile16SelecterWidget;
EditModeDockWidget *EditModeWidget;
EntitySetDockWidget *EntitySetWidget;
CameraControlDockWidget *CameraControlWidget;
OutputDockWidget *OutputWidget = nullptr;
LevelComponents::Level *CurrentLevel = nullptr;
QAction *RecentROMs[5];
uint recentROMnum = 0;
QAction *RecentScripts[5];
uint recentScriptNum = 0;
uint graphicViewScalerate = 2;
bool UnsavedChanges = false; // state check bool only be used when user try loading another ROM, another Level or
// close the editor without saving changes
bool firstROMLoaded = false;
QString dialogInitialPath = QString("");
void closeEvent(QCloseEvent *event);
bool notify(QObject *receiver, QEvent *event);
bool SaveCurrentFile();
bool SaveCurrentFileAs();
bool UnsavedChangesPrompt(QString str);
void ClearEverythingInRoom(bool no_warning = false);
// recent file manager functions
void InitRecentFileMenuEntries(const bool manageRecentScripts = false);
bool OpenRecentFile(QString newFilepath, const bool manageRecentScripts = false);
void ManageRecentFilesOrScripts(QString newFilepath, const bool manageRecentScripts = false);
protected:
void resizeEvent(QResizeEvent *event);
public:
explicit WL4EditorWindow(QWidget *parent = 0);
~WL4EditorWindow();
void RenderScreenFull();
void RenderScreenVisibilityChange();
void RenderScreenElementsLayersUpdate(unsigned int DoorId, int EntityId);
void RenderScreenTilesChange(QVector<LevelComponents::Tileinfo> tilelist, int LayerID);
void SetStatusBarText(char *str);
void LoadRoomUIUpdate();
Tile16DockWidget *GetTile16DockWidgetPtr() { return Tile16SelecterWidget; }
EditModeDockWidget *GetEditModeWidgetPtr() { return EditModeWidget; }
EntitySetDockWidget *GetEntitySetDockWidgetPtr() { return EntitySetWidget; }
OutputDockWidget *GetOutputWidgetPtr() { return OutputWidget; }
void InvalidOutputWidgetPtr() { OutputWidget = nullptr; }
LevelComponents::Room *GetCurrentRoom() { return CurrentLevel->GetRooms()[GetCurrentRoomId()]; }
int GetCurrentRoomId();
LevelComponents::Level *GetCurrentLevel() { return CurrentLevel; }
void SetUnsavedChanges(bool newValue) { UnsavedChanges = newValue; }
bool FirstROMIsLoaded() { return firstROMLoaded; }
void OpenROM();
void UIStartUp();
void SetEditModeDockWidgetLayerEditability();
QVector<bool> GetLayersVisibilityArray() { return EditModeWidget->GetLayersVisibilityArray(); }
void Graphicsview_UnselectDoorAndEntity();
void RoomConfigReset(DialogParams::RoomConfigParams *currentroomconfig,
DialogParams::RoomConfigParams *nextroomconfig);
void ShowEntitySetDockWidget() { EntitySetWidget->setVisible(true); }
void ShowTile16DockWidget() { Tile16SelecterWidget->setVisible(true); }
void ShowCameraControlDockWidget() { CameraControlWidget->setVisible(true); }
void HideCameraControlDockWidget() { CameraControlWidget->setVisible(false); }
void HideEntitySetDockWidget() { EntitySetWidget->setVisible(false); }
void HideTile16DockWidget() { Tile16SelecterWidget->setVisible(false); }
void ResetEntitySetDockWidget() { EntitySetWidget->ResetEntitySet(CurrentLevel->GetRooms()[GetCurrentRoomId()]); }
void ResetCameraControlDockWidget()
{
CameraControlWidget->PopulateCameraControlInfo(CurrentLevel->GetRooms()[GetCurrentRoomId()]);
}
void DeleteEntity(int EntityIndex) { CurrentLevel->GetRooms()[GetCurrentRoomId()]->DeleteEntity(EntityIndex); }
bool DeleteDoor(int globalDoorIndex);
void SetEditModeWidgetDifficultyRadioBox(int rd) { EditModeWidget->SetDifficultyRadioBox(rd); }
void LoadROMDataFromFile(QString qFilePath);
void PrintMousePos(int x, int y);
uint GetGraphicViewScalerate() { return graphicViewScalerate; }
void SetGraphicViewScalerate(uint scalerate);
void RefreshRectSelectHint(bool state);
void SetRectSelectMode(bool state);
QGraphicsView *Getgraphicview();
void SetChangeCurrentRoomEnabled(bool state);
void SetCurrentRoomId(int roomid, bool call_from_spinbox_valuechange = false);
void EditCurrentTileset(DialogParams::TilesetEditParams *_newTilesetEditParams);
QString GetdDialogInitialPath() { return dialogInitialPath; }
void SetDialogInitialPath(QString newpath) { dialogInitialPath = newpath; }
private slots:
// called slots
void openRecentROM();
void openRecentScript();
// Auto-generated
void on_actionOpen_ROM_triggered();
void on_actionSave_ROM_triggered();
void on_actionSave_As_triggered();
void on_actionSave_Room_s_graphic_triggered();
void on_loadLevelButton_clicked();
void on_roomDecreaseButton_clicked();
void on_roomIncreaseButton_clicked();
void on_actionUndo_triggered();
void on_actionRedo_triggered();
void on_actionUndo_global_triggered();
void on_actionRedo_global_triggered();
void on_actionLevel_Config_triggered();
void on_actionRoom_Config_triggered();
void on_actionEdit_Tileset_triggered();
void on_actionEdit_Credits_triggered();
void on_actionNew_Door_triggered();
void on_actionNew_Room_triggered();
void on_action_duplicate_Normal_triggered();
void on_action_duplicate_Hard_triggered();
void on_action_duplicate_S_Hard_triggered();
void on_action_swap_Layer_0_Layer_1_triggered();
void on_action_swap_Layer_1_Layer_2_triggered();
void on_action_swap_Layer_0_Layer_2_triggered();
void on_action_swap_Normal_Hard_triggered();
void on_action_swap_Hard_S_Hard_triggered();
void on_action_swap_Normal_S_Hard_triggered();
void on_action_clear_Layer_0_triggered();
void on_action_clear_Layer_1_triggered();
void on_action_clear_Layer_2_triggered();
void on_action_clear_Normal_triggered();
void on_action_clear_Hard_triggered();
void on_action_clear_S_Hard_triggered();
void on_actionClear_all_triggered();
void on_actionRect_Select_Mode_toggled(bool arg1);
void on_actionPatch_Manager_triggered();
void on_actionRun_from_file_triggered();
void on_actionLight_triggered();
void on_actionDark_triggered();
void on_actionZoom_in_triggered();
void on_actionZoom_out_triggered();
void on_actionEdit_Entity_EntitySet_triggered();
void on_actionOutput_window_triggered();
void on_actionAbout_triggered();
void on_actionImport_Tileset_from_ROM_triggered();
void on_actionRolling_Save_triggered();
void on_actionGraphic_Manager_triggered();
void on_actionReload_project_settings_triggered();
void on_actionEdit_Animated_Tile_Groups_triggered();
void on_actionEdit_Wall_Paints_triggered();
void on_spinBox_RoomID_valueChanged(int arg1);
void on_action_swap_Rooms_triggered();
};
#endif // WL4EDITORWINDOW_H