-
Notifications
You must be signed in to change notification settings - Fork 224
/
palette_common.h
239 lines (196 loc) · 7.1 KB
/
palette_common.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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
//////////////////////////////////////////////////////////////////////
// This file is part of Remere's Map Editor
//////////////////////////////////////////////////////////////////////
// Remere's Map Editor is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Remere's Map Editor is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//////////////////////////////////////////////////////////////////////
#ifndef RME_PALETTE_COMMONS_H_
#define RME_PALETTE_COMMONS_H_
#include "main.h"
#include "dcbutton.h"
#include "tileset.h"
#include "gui_ids.h"
#include "common_windows.h"
class GUI;
class BrushButton;
class TilesetCategory;
class BrushSizePanel;
class BrushPalettePanel;
class PaletteWindow;
typedef TilesetCategoryType PaletteType;
class BrushButton : public ItemToggleButton {
public:
BrushButton(wxWindow* parent, Brush* brush, RenderSize, uint32_t id = wxID_ANY);
BrushButton(wxWindow* parent, Brush* brush, RenderSize, EditorSprite* espr, uint32_t id = wxID_ANY);
virtual ~BrushButton();
Brush* brush;
void OnKey(wxKeyEvent& event);
DECLARE_EVENT_TABLE()
};
class PalettePanel : public wxPanel {
public:
PalettePanel(wxWindow* parent, wxWindowID id = wxID_ANY, long style = wxTAB_TRAVERSAL);
~PalettePanel();
// Interface
// Flushes this panel and consequent views will feature reloaded data
virtual void InvalidateContents();
// Loads the currently displayed page
virtual void LoadCurrentContents();
// Loads all content in this panel
virtual void LoadAllContents();
PaletteWindow* GetParentPalette() const;
virtual wxString GetName() const;
virtual PaletteType GetType() const;
// Add a tool panel!
virtual void AddToolPanel(PalettePanel* panel);
// Sets the style for this toolbar and child toolabrs
virtual void SetToolbarIconSize(bool large_icons);
// Select the first brush
virtual void SelectFirstBrush();
// Returns the currently selected brush (First brush if panel is not loaded)
virtual Brush* GetSelectedBrush() const;
// Returns the currently selected brush size
virtual int GetSelectedBrushSize() const;
// Select the brush in the parameter, this only changes the look of the panel
virtual bool SelectBrush(const Brush* whatbrush);
// Updates the palette window to use the current brush size
virtual void OnUpdateBrushSize(BrushShape shape, int size);
// Called when this page is about to be displayed
virtual void OnSwitchIn();
// Called when this page is hidden
virtual void OnSwitchOut();
// Called sometimes
virtual void OnUpdate();
// When the palette should do a delayed refresh (necessary for multiple palettes)
void OnRefreshTimer(wxTimerEvent&);
void RefreshOtherPalettes();
protected:
typedef std::vector<PalettePanel*> ToolBarList;
ToolBarList tool_bars;
wxTimer refresh_timer;
int last_brush_size;
DECLARE_EVENT_TABLE();
};
class BrushSizePanel : public PalettePanel {
public:
BrushSizePanel(wxWindow* parent);
~BrushSizePanel() {}
// Interface
// Flushes this panel and consequent views will feature reloaded data
void InvalidateContents();
// Loads the currently displayed page
void LoadCurrentContents();
// Loads all content in this panel
void LoadAllContents();
wxString GetName() const;
void SetToolbarIconSize(bool large);
// Updates the palette window to use the current brush size
void OnUpdateBrushSize(BrushShape shape, int size);
// Called when this page is displayed
void OnSwitchIn();
// wxWidgets event handling
void OnClickSquareBrush(wxCommandEvent& event);
void OnClickCircleBrush(wxCommandEvent& event);
void OnClickBrushSize(int which);
void OnClickBrushSize0(wxCommandEvent& event) { OnClickBrushSize(0); }
void OnClickBrushSize1(wxCommandEvent& event) { OnClickBrushSize(1); }
void OnClickBrushSize2(wxCommandEvent& event) { OnClickBrushSize(2); }
void OnClickBrushSize4(wxCommandEvent& event) { OnClickBrushSize(4); }
void OnClickBrushSize6(wxCommandEvent& event) { OnClickBrushSize(6); }
void OnClickBrushSize8(wxCommandEvent& event) { OnClickBrushSize(8); }
void OnClickBrushSize11(wxCommandEvent& event){ OnClickBrushSize(11); }
protected:
bool loaded;
bool large_icons;
DCButton* brushshapeSquareButton;
DCButton* brushshapeCircleButton;
DCButton* brushsize0Button;
DCButton* brushsize1Button;
DCButton* brushsize2Button;
DCButton* brushsize4Button;
DCButton* brushsize6Button;
DCButton* brushsize8Button;
DCButton* brushsize11Button;
DECLARE_EVENT_TABLE()
};
class BrushToolPanel : public PalettePanel {
public:
BrushToolPanel(wxWindow* parent);
~BrushToolPanel();
// Interface
// Flushes this panel and consequent views will feature reloaded data
void InvalidateContents();
// Loads the currently displayed page
void LoadCurrentContents();
// Loads all content in this panel
void LoadAllContents();
wxString GetName() const;
void SetToolbarIconSize(bool large);
// Returns the currently selected brush (First brush if panel is not loaded)
Brush* GetSelectedBrush() const;
// Select the brush in the parameter, this only changes the look of the panel
bool SelectBrush(const Brush* whatbrush);
// Called when this page is displayed
void OnSwitchIn();
// wxWidgets event handling
void OnClickGravelButton(wxCommandEvent& event);
void OnClickEraserButton(wxCommandEvent& event);
// ----
void OnClickNormalDoorButton(wxCommandEvent& event);
void OnClickLockedDoorButton(wxCommandEvent& event);
void OnClickMagicDoorButton(wxCommandEvent& event);
void OnClickQuestDoorButton(wxCommandEvent& event);
void OnClickHatchDoorButton(wxCommandEvent& event);
void OnClickWindowDoorButton(wxCommandEvent& event);
// ----
void OnClickPZBrushButton(wxCommandEvent& event);
void OnClickNOPVPBrushButton(wxCommandEvent& event);
void OnClickNoLogoutBrushButton(wxCommandEvent& event);
void OnClickPVPZoneBrushButton(wxCommandEvent& event);
public:
void DeselectAll();
bool loaded;
bool large_icons;
BrushButton* optionalBorderButton;
BrushButton* eraserButton;
// ----
BrushButton* normalDoorButton;
BrushButton* lockedDoorButton;
BrushButton* magicDoorButton;
BrushButton* questDoorButton;
BrushButton* hatchDoorButton;
BrushButton* windowDoorButton;
// ----
BrushButton* pzBrushButton;
BrushButton* nopvpBrushButton;
BrushButton* nologBrushButton;
BrushButton* pvpzoneBrushButton;
DECLARE_EVENT_TABLE()
};
class BrushThicknessPanel : public PalettePanel {
public:
BrushThicknessPanel(wxWindow* parent);
~BrushThicknessPanel();
// Interface
wxString GetName() const;
// Called when this page is displayed
void OnSwitchIn();
// wxWidgets event handling
void OnScroll(wxScrollEvent& event);
void OnClickCustomThickness(wxCommandEvent& event);
public:
wxSlider* slider;
wxCheckBox* use_button;
DECLARE_EVENT_TABLE()
};
#endif