/
SkinEditor.h
116 lines (90 loc) · 3.14 KB
/
SkinEditor.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
#pragma once
#include <sigc++/connection.h>
#include "icommandsystem.h"
#include "modelskin.h"
#include "wxutil/WindowPosition.h"
#include "wxutil/PanedPosition.h"
#include "wxutil/dataview/DeclarationTreeView.h"
#include "wxutil/XmlResourceBasedWidget.h"
#include "wxutil/dialog/DialogBase.h"
#include "wxutil/preview/ModelPreview.h"
#include "wxutil/sourceview/SourceView.h"
namespace ui
{
class ModelTreeView;
class SkinEditor final :
public wxutil::DialogBase,
private wxutil::XmlResourceBasedWidget
{
private:
ModelTreeView* _modelTreeView;
std::unique_ptr<wxutil::ModelPreview> _modelPreview;
wxutil::D3DeclarationViewCtrl* _sourceView;
wxutil::DeclarationTreeView::Columns _columns;
wxutil::DeclarationTreeView* _skinTreeView;
struct SelectedModelColumns :
public wxutil::TreeModel::ColumnRecord
{
SelectedModelColumns() :
name(add(wxutil::TreeModel::Column::IconText))
{}
wxutil::TreeModel::Column name;
};
SelectedModelColumns _selectedModelColumns;
wxutil::TreeModel::Ptr _selectedModels;
wxutil::TreeView* _selectedModelList;
struct RemappingColumns :
public wxutil::TreeModel::ColumnRecord
{
RemappingColumns() :
active(add(wxutil::TreeModel::Column::Boolean)),
original(add(wxutil::TreeModel::Column::String)),
replacement(add(wxutil::TreeModel::Column::String))
{}
wxutil::TreeModel::Column active;
wxutil::TreeModel::Column original;
wxutil::TreeModel::Column replacement;
};
RemappingColumns _remappingColumns;
wxutil::TreeModel::Ptr _remappings;
wxutil::TreeView* _remappingList;
wxutil::WindowPosition _windowPosition;
wxutil::PanedPosition _leftPanePosition;
wxutil::PanedPosition _rightPanePosition;
bool _controlUpdateInProgress;
sigc::connection _skinModifiedConn;
private:
SkinEditor();
~SkinEditor() override;
public:
int ShowModal() override;
static void ShowDialog(const cmd::ArgumentList& args);
private:
void setupModelTreeView();
void setupSkinTreeView();
void setupSelectedModelList();
void setupRemappingPanel();
void setupPreview();
decl::ISkin::Ptr getSelectedSkin();
std::string getSelectedModelFromTree();
std::string getSelectedSkinModel();
void updateSkinButtonSensitivity();
void updateModelButtonSensitivity();
void updateSkinControlsFromSelection();
void updateModelControlsFromSkin(const decl::ISkin::Ptr& skin);
void updateRemappingControlsFromSkin(const decl::ISkin::Ptr& skin);
void updateSourceView(const decl::ISkin::Ptr& skin);
void onCloseButton(wxCommandEvent& ev);
void onAddModelToSkin(wxCommandEvent& ev);
void onRemoveModelFromSkin(wxCommandEvent& ev);
void onModelTreeSelectionChanged(wxDataViewEvent& ev);
void onSkinModelSelectionChanged(wxDataViewEvent& ev);
void onSkinSelectionChanged(wxDataViewEvent& ev);
void onSkinDeclarationChanged();
template<typename ObjectClass>
ObjectClass* getControl(const std::string& name)
{
return findNamedObject<ObjectClass>(this, name);
}
};
}