Merge pull request #34 from lioncash/override

Editor: Use override where applicable
This commit is contained in:
Phillip Stephens 2019-08-10 19:57:30 -07:00 committed by GitHub
commit ee1d595655
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 148 additions and 140 deletions

View File

@ -13,14 +13,14 @@ class GameMode : public ViewerSpace {
Value<bool> showToolbar = true; Value<bool> showToolbar = true;
} m_state; } m_state;
const Space::State& spaceState() const { return m_state; } const Space::State& spaceState() const override { return m_state; }
struct View : specter::View { struct View : specter::View {
GameMode& m_gMode; GameMode& m_gMode;
View(GameMode& gMode, specter::ViewResources& res) : specter::View(res, gMode.m_vm.rootView()), m_gMode(gMode) {} View(GameMode& gMode, specter::ViewResources& res) : specter::View(res, gMode.m_vm.rootView()), m_gMode(gMode) {}
void draw(boo::IGraphicsCommandQueue* gfxQ); void draw(boo::IGraphicsCommandQueue* gfxQ) override;
}; };
std::unique_ptr<View> m_view; std::unique_ptr<View> m_view;
@ -38,17 +38,17 @@ public:
reloadState(); reloadState();
} }
void reloadState() {} void reloadState() override {}
virtual specter::View* buildContentView(specter::ViewResources& res) { specter::View* buildContentView(specter::ViewResources& res) override {
m_view.reset(new View(*this, res)); m_view.reset(new View(*this, res));
return m_view.get(); return m_view.get();
} }
void think(); void think() override;
Space* copy(Space* parent) const { return new GameMode(m_vm, parent, *this); } Space* copy(Space* parent) const override { return new GameMode(m_vm, parent, *this); }
bool usesToolbar() const { return m_state.showToolbar; } bool usesToolbar() const override { return m_state.showToolbar; }
}; };
} // namespace urde } // namespace urde

View File

@ -10,7 +10,7 @@ class InformationCenter : public ViewerSpace {
Value<bool> showLog; Value<bool> showLog;
} m_state; } m_state;
const Space::State& spaceState() const { return m_state; } const Space::State& spaceState() const override { return m_state; }
struct View : specter::View { struct View : specter::View {
InformationCenter& m_ic; InformationCenter& m_ic;
@ -36,15 +36,15 @@ public:
reloadState(); reloadState();
} }
void reloadState() {} void reloadState() override {}
virtual specter::View* buildContentView(specter::ViewResources& res) { specter::View* buildContentView(specter::ViewResources& res) override {
m_view.reset(new View(*this, res)); m_view.reset(new View(*this, res));
return m_view.get(); return m_view.get();
} }
Space* copy(Space* parent) const { return new InformationCenter(m_vm, parent, *this); } Space* copy(Space* parent) const override { return new InformationCenter(m_vm, parent, *this); }
bool usesToolbar() const { return true; } bool usesToolbar() const override { return true; }
}; };
} // namespace urde } // namespace urde

View File

@ -16,7 +16,7 @@ class ModelViewer : public ViewerSpace {
} m_state; } m_state;
const Space::State& spaceState() const { return m_state; } const Space::State& spaceState() const override { return m_state; }
std::unique_ptr<urde::CLineRenderer> m_lineRenderer; std::unique_ptr<urde::CLineRenderer> m_lineRenderer;
struct View : specter::View { struct View : specter::View {
ModelViewer& m_mv; ModelViewer& m_mv;
@ -24,7 +24,7 @@ class ModelViewer : public ViewerSpace {
View(ModelViewer& mv, specter::ViewResources& res) : specter::View(res, mv.m_vm.rootView()), m_mv(mv) {} View(ModelViewer& mv, specter::ViewResources& res) : specter::View(res, mv.m_vm.rootView()), m_mv(mv) {}
void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub); void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub) override;
}; };
Camera m_camera; Camera m_camera;
@ -46,19 +46,19 @@ public:
reloadState(); reloadState();
} }
void reloadState() { void reloadState() override {
m_camera.setPosition(m_state.cameraPosition); m_camera.setPosition(m_state.cameraPosition);
m_camera.setOrientation(m_state.cameraOrientation); m_camera.setOrientation(m_state.cameraOrientation);
} }
Space* copy(Space* parent) const { return new ModelViewer(m_vm, parent, *this); } Space* copy(Space* parent) const override { return new ModelViewer(m_vm, parent, *this); }
virtual specter::View* buildContentView(specter::ViewResources& res) { specter::View* buildContentView(specter::ViewResources& res) override {
m_view.reset(new View(*this, res)); m_view.reset(new View(*this, res));
return m_view.get(); return m_view.get();
} }
bool usesToolbar() const { return true; } bool usesToolbar() const override { return true; }
}; };
} // namespace urde } // namespace urde

View File

@ -9,13 +9,13 @@ class EffectEditor : public EditorSpace {
AT_DECL_DNA_YAMLV AT_DECL_DNA_YAMLV
String<-1> path; String<-1> path;
} m_state; } m_state;
const Space::State& spaceState() const { return m_state; } const Space::State& spaceState() const override { return m_state; }
struct View : specter::View { struct View : specter::View {
View(specter::ViewResources& res, specter::View& parent) : specter::View(res, parent) {} View(specter::ViewResources& res, specter::View& parent) : specter::View(res, parent) {}
}; };
specter::View* buildContentView(specter::ViewResources& res) { return nullptr; } specter::View* buildContentView(specter::ViewResources& res) override { return nullptr; }
public: public:
EffectEditor(ViewManager& vm, Space* parent) : EditorSpace(vm, Class::EffectEditor, parent) {} EffectEditor(ViewManager& vm, Space* parent) : EditorSpace(vm, Class::EffectEditor, parent) {}
@ -24,9 +24,9 @@ public:
m_state = other.m_state; m_state = other.m_state;
} }
Space* copy(Space* parent) const { return new EffectEditor(m_vm, parent, *this); } Space* copy(Space* parent) const override { return new EffectEditor(m_vm, parent, *this); }
bool usesToolbar() const { return true; } bool usesToolbar() const override { return true; }
}; };
} // namespace urde } // namespace urde

View File

@ -18,8 +18,8 @@ class ProjectResourcePool : public CSimplePool {
public: public:
ProjectResourcePool(IFactory& factory, ProjectManager& parent) : CSimplePool(factory), m_parent(parent) {} ProjectResourcePool(IFactory& factory, ProjectManager& parent) : CSimplePool(factory), m_parent(parent) {}
CToken GetObj(std::string_view); CToken GetObj(std::string_view) override;
CToken GetObj(std::string_view, const CVParamTransfer&); CToken GetObj(std::string_view, const CVParamTransfer&) override;
}; };
class ProjectManager { class ProjectManager {

View File

@ -16,12 +16,12 @@ class ResourceBrowser : public Space, public specter::IPathButtonsBinding {
Value<SortColumn> sortColumn = SortColumn::Name; Value<SortColumn> sortColumn = SortColumn::Name;
Value<specter::SortDirection> sortDir = specter::SortDirection::Ascending; Value<specter::SortDirection> sortDir = specter::SortDirection::Ascending;
} m_state; } m_state;
const Space::State& spaceState() const { return m_state; } const Space::State& spaceState() const override { return m_state; }
hecl::ProjectPath m_path; hecl::ProjectPath m_path;
std::vector<hecl::SystemString> m_comps; std::vector<hecl::SystemString> m_comps;
void pathButtonActivated(size_t idx); void pathButtonActivated(size_t idx) override;
struct ResListingDataBind : specter::ITableDataBinding, specter::ITableStateBinding { struct ResListingDataBind : specter::ITableDataBinding, specter::ITableStateBinding {
ResourceBrowser& m_rb; ResourceBrowser& m_rb;
@ -42,10 +42,10 @@ class ResourceBrowser : public Space, public specter::IPathButtonsBinding {
std::string m_projStr; std::string m_projStr;
std::string m_fileStr; std::string m_fileStr;
size_t columnCount() const { return 3; } size_t columnCount() const override { return 3; }
size_t rowCount() const { return m_entries.size(); } size_t rowCount() const override { return m_entries.size(); }
std::string_view header(size_t cIdx) const { std::string_view header(size_t cIdx) const override {
switch (cIdx) { switch (cIdx) {
case 0: case 0:
return m_nameCol; return m_nameCol;
@ -59,7 +59,7 @@ class ResourceBrowser : public Space, public specter::IPathButtonsBinding {
return {}; return {};
} }
std::string_view cell(size_t cIdx, size_t rIdx) const { std::string_view cell(size_t cIdx, size_t rIdx) const override {
switch (cIdx) { switch (cIdx) {
case 0: case 0:
return m_entries.at(rIdx).m_name; return m_entries.at(rIdx).m_name;
@ -73,11 +73,11 @@ class ResourceBrowser : public Space, public specter::IPathButtonsBinding {
return {}; return {};
} }
bool columnSplitResizeAllowed() const { return true; } bool columnSplitResizeAllowed() const override { return true; }
float getColumnSplit(size_t cIdx) const { return m_rb.m_state.columnSplits[cIdx]; } float getColumnSplit(size_t cIdx) const override { return m_rb.m_state.columnSplits[cIdx]; }
void setColumnSplit(size_t cIdx, float split) { m_rb.m_state.columnSplits[cIdx] = split; } void setColumnSplit(size_t cIdx, float split) override { m_rb.m_state.columnSplits[cIdx] = split; }
void updateListing(const hecl::DirectoryEnumerator& dEnum) { void updateListing(const hecl::DirectoryEnumerator& dEnum) {
m_entries.clear(); m_entries.clear();
@ -106,22 +106,22 @@ class ResourceBrowser : public Space, public specter::IPathButtonsBinding {
bool m_needsUpdate = false; bool m_needsUpdate = false;
specter::SortDirection getSort(size_t& cIdx) const { specter::SortDirection getSort(size_t& cIdx) const override {
cIdx = size_t(m_rb.m_state.sortColumn); cIdx = size_t(m_rb.m_state.sortColumn);
if (cIdx > 2) if (cIdx > 2)
cIdx = 0; cIdx = 0;
return m_rb.m_state.sortDir; return m_rb.m_state.sortDir;
} }
void setSort(size_t cIdx, specter::SortDirection dir) { void setSort(size_t cIdx, specter::SortDirection dir) override {
m_rb.m_state.sortDir = dir; m_rb.m_state.sortDir = dir;
m_rb.m_state.sortColumn = State::SortColumn(cIdx); m_rb.m_state.sortColumn = State::SortColumn(cIdx);
m_needsUpdate = true; m_needsUpdate = true;
} }
void setSelectedRow(size_t rIdx) {} void setSelectedRow(size_t rIdx) override {}
void rowActivated(size_t rIdx) {} void rowActivated(size_t rIdx) override {}
ResListingDataBind(ResourceBrowser& rb, const specter::IViewManager& vm) : m_rb(rb) { ResListingDataBind(ResourceBrowser& rb, const specter::IViewManager& vm) : m_rb(rb) {
m_nameCol = vm.translate<locale::name>(); m_nameCol = vm.translate<locale::name>();
@ -142,13 +142,13 @@ class ResourceBrowser : public Space, public specter::IPathButtonsBinding {
m_resListing.m_view.reset(new specter::Table(res, *this, &ro.m_resListingBind, &ro.m_resListingBind, 3)); m_resListing.m_view.reset(new specter::Table(res, *this, &ro.m_resListingBind, &ro.m_resListingBind, 3));
} }
void mouseDown(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey); void mouseDown(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey) override;
void mouseUp(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey); void mouseUp(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey) override;
void mouseMove(const boo::SWindowCoord&); void mouseMove(const boo::SWindowCoord&) override;
void mouseLeave(const boo::SWindowCoord&); void mouseLeave(const boo::SWindowCoord&) override;
void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub); void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub) override;
void draw(boo::IGraphicsCommandQueue* gfxQ); void draw(boo::IGraphicsCommandQueue* gfxQ) override;
}; };
std::unique_ptr<View> m_view; std::unique_ptr<View> m_view;
@ -168,7 +168,7 @@ public:
reloadState(); reloadState();
} }
void reloadState() { void reloadState() override {
hecl::ProjectPath pp(*m_vm.project(), m_state.path); hecl::ProjectPath pp(*m_vm.project(), m_state.path);
if (m_state.path.empty() || pp.isNone()) { if (m_state.path.empty() || pp.isNone()) {
m_state.path = m_vm.project()->getProjectWorkingPath().getRelativePathUTF8(); m_state.path = m_vm.project()->getProjectWorkingPath().getRelativePathUTF8();
@ -177,29 +177,29 @@ public:
navigateToPath(pp); navigateToPath(pp);
} }
void think() { void think() override {
if (m_resListingBind.m_needsUpdate) if (m_resListingBind.m_needsUpdate)
reloadState(); reloadState();
} }
bool navigateToPath(const hecl::ProjectPath& path); bool navigateToPath(const hecl::ProjectPath& path);
Space* copy(Space* parent) const { return new ResourceBrowser(m_vm, parent, *this); } Space* copy(Space* parent) const override { return new ResourceBrowser(m_vm, parent, *this); }
void buildToolbarView(specter::ViewResources& res, specter::Toolbar& tb) { void buildToolbarView(specter::ViewResources& res, specter::Toolbar& tb) override {
m_pathButtons.reset(new specter::PathButtons(res, tb, *this, true)); m_pathButtons.reset(new specter::PathButtons(res, tb, *this, true));
tb.push_back(m_pathButtons.get(), 1); tb.push_back(m_pathButtons.get(), 1);
reloadState(); reloadState();
} }
specter::View* buildContentView(specter::ViewResources& res) { specter::View* buildContentView(specter::ViewResources& res) override {
m_view.reset(new View(*this, res)); m_view.reset(new View(*this, res));
return m_view.get(); return m_view.get();
} }
bool usesToolbar() const { return true; } bool usesToolbar() const override { return true; }
unsigned toolbarUnits() const { return 2; } unsigned toolbarUnits() const override { return 2; }
}; };
} // namespace urde } // namespace urde

View File

@ -54,8 +54,8 @@ public:
std::string m_text; std::string m_text;
specter::Icon& m_icon; specter::Icon& m_icon;
zeus::CColor m_color; zeus::CColor m_color;
const std::string* text() const { return &m_text; } const std::string* text() const override { return &m_text; }
void activated(const boo::SWindowCoord& coord) {} void activated(const boo::SWindowCoord& coord) override {}
SubNodeData(Class cls, const char* text, specter::Icon& icon, const zeus::CColor& color) SubNodeData(Class cls, const char* text, specter::Icon& icon, const zeus::CColor& color)
: m_cls(cls), m_text(text), m_icon(icon), m_color(color) {} : m_cls(cls), m_text(text), m_icon(icon), m_color(color) {}
@ -65,8 +65,8 @@ public:
struct SubNode final : specter::IMenuNode { struct SubNode final : specter::IMenuNode {
Space& m_space; Space& m_space;
const SubNodeData& m_data; const SubNodeData& m_data;
const std::string* text() const { return &m_data.m_text; } const std::string* text() const override { return &m_data.m_text; }
void activated(const boo::SWindowCoord& coord); void activated(const boo::SWindowCoord& coord) override;
SubNode(Space& space, const SubNodeData& data) : m_space(space), m_data(data) {} SubNode(Space& space, const SubNodeData& data) : m_space(space), m_data(data) {}
}; };
@ -79,10 +79,10 @@ public:
} }
static std::string s_text; static std::string s_text;
const std::string* text() const { return &s_text; } const std::string* text() const override { return &s_text; }
size_t subNodeCount() const { return m_subNodes.size(); } size_t subNodeCount() const override { return m_subNodes.size(); }
IMenuNode* subNode(size_t idx) { return &m_subNodes[idx]; } IMenuNode* subNode(size_t idx) override { return &m_subNodes[idx]; }
static void InitializeStrings(ViewManager& vm); static void InitializeStrings(ViewManager& vm);
static const std::string* LookupClassString(Class cls) { static const std::string* LookupClassString(Class cls) {
@ -107,10 +107,10 @@ public:
struct SpaceSelectBind : specter::IButtonBinding { struct SpaceSelectBind : specter::IButtonBinding {
Space& m_space; Space& m_space;
std::string_view name(const specter::Control* control) const { return SpaceMenuNode::s_text; } std::string_view name(const specter::Control* control) const override { return SpaceMenuNode::s_text; }
MenuStyle menuStyle(const specter::Button* button) const { return MenuStyle::Primary; } MenuStyle menuStyle(const specter::Button* button) const override { return MenuStyle::Primary; }
std::unique_ptr<specter::View> buildMenu(const specter::Button* button); std::unique_ptr<specter::View> buildMenu(const specter::Button* button) override;
SpaceSelectBind(Space& space) : m_space(space) {} SpaceSelectBind(Space& space) : m_space(space) {}
} m_spaceSelectBind; } m_spaceSelectBind;
@ -143,9 +143,9 @@ public:
virtual void think() {} virtual void think() {}
virtual Space* copy(Space* parent) const = 0; virtual Space* copy(Space* parent) const = 0;
bool spaceSplitAllowed() const { return true; } bool spaceSplitAllowed() const override { return true; }
specter::ISplitSpaceController* spaceSplit(specter::SplitView::Axis axis, int thisSlot); specter::ISplitSpaceController* spaceSplit(specter::SplitView::Axis axis, int thisSlot) override;
virtual std::unique_ptr<Space> exchangeSpaceSplitJoin(Space* removeSpace, std::unique_ptr<Space>&& keepSpace) { virtual std::unique_ptr<Space> exchangeSpaceSplitJoin(Space* removeSpace, std::unique_ptr<Space>&& keepSpace) {
return std::unique_ptr<Space>(); return std::unique_ptr<Space>();
} }
@ -159,8 +159,9 @@ class RootSpace : public Space {
friend class ViewManager; friend class ViewManager;
std::unique_ptr<specter::RootView> m_rootView; std::unique_ptr<specter::RootView> m_rootView;
std::unique_ptr<Space> m_spaceTree; std::unique_ptr<Space> m_spaceTree;
struct State : Space::State{AT_DECL_DNA_YAMLV } m_state; struct State : Space::State{AT_DECL_DNA_YAMLV } m_state;
const Space::State& spaceState() const { return m_state; } const Space::State& spaceState() const override { return m_state; }
public: public:
RootSpace(ViewManager& vm) : Space(vm, Class::RootSpace, nullptr) {} RootSpace(ViewManager& vm) : Space(vm, Class::RootSpace, nullptr) {}
@ -170,12 +171,12 @@ public:
m_spaceTree.reset(NewSpaceFromConfigStream(vm, this, r)); m_spaceTree.reset(NewSpaceFromConfigStream(vm, this, r));
} }
void think() { void think() override {
if (m_spaceTree) if (m_spaceTree)
m_spaceTree->think(); m_spaceTree->think();
} }
void saveState(athena::io::IStreamWriter& w) const { void saveState(athena::io::IStreamWriter& w) const override {
w.writeUint32Big(atUint32(m_class)); w.writeUint32Big(atUint32(m_class));
m_state.write(w); m_state.write(w);
@ -185,7 +186,7 @@ public:
w.writeUint32Big(0); w.writeUint32Big(0);
} }
void saveState(athena::io::YAMLDocWriter& w) const { void saveState(athena::io::YAMLDocWriter& w) const override {
w.writeUint32("class", atUint32(m_class)); w.writeUint32("class", atUint32(m_class));
m_state.write(w); m_state.write(w);
@ -202,15 +203,15 @@ public:
m_spaceTree->m_parent = this; m_spaceTree->m_parent = this;
} }
Space* copy(Space* parent) const { return nullptr; } Space* copy(Space* parent) const override { return nullptr; }
bool spaceSplitAllowed() const { return false; } bool spaceSplitAllowed() const override { return false; }
specter::View* buildSpaceView(specter::ViewResources& res); specter::View* buildSpaceView(specter::ViewResources& res) override;
specter::View* buildContentView(specter::ViewResources& res) { return m_spaceTree->buildSpaceView(res); } specter::View* buildContentView(specter::ViewResources& res) override { return m_spaceTree->buildSpaceView(res); }
std::unique_ptr<Space> exchangeSpaceSplitJoin(Space* removeSpace, std::unique_ptr<Space>&& keepSpace); std::unique_ptr<Space> exchangeSpaceSplitJoin(Space* removeSpace, std::unique_ptr<Space>&& keepSpace) override;
specter::View* basisView(); specter::View* basisView() override;
}; };
class SplitSpace : public Space, public specter::ISplitSpaceController { class SplitSpace : public Space, public specter::ISplitSpaceController {
@ -222,7 +223,7 @@ class SplitSpace : public Space, public specter::ISplitSpaceController {
Value<specter::SplitView::Axis> axis = specter::SplitView::Axis::Horizontal; Value<specter::SplitView::Axis> axis = specter::SplitView::Axis::Horizontal;
Value<float> split = 0.5; Value<float> split = 0.5;
} m_state; } m_state;
const Space::State& spaceState() const { return m_state; } const Space::State& spaceState() const override { return m_state; }
public: public:
SplitSpace(ViewManager& vm, Space* parent, specter::SplitView::Axis axis) : Space(vm, Class::SplitSpace, parent) { SplitSpace(ViewManager& vm, Space* parent, specter::SplitView::Axis axis) : Space(vm, Class::SplitSpace, parent) {
@ -239,7 +240,7 @@ public:
reloadState(); reloadState();
} }
void reloadState() { void reloadState() override {
m_state.split = std::min(1.f, std::max(0.f, m_state.split)); m_state.split = std::min(1.f, std::max(0.f, m_state.split));
if (m_state.axis != specter::SplitView::Axis::Horizontal && m_state.axis != specter::SplitView::Axis::Vertical) if (m_state.axis != specter::SplitView::Axis::Horizontal && m_state.axis != specter::SplitView::Axis::Vertical)
m_state.axis = specter::SplitView::Axis::Horizontal; m_state.axis = specter::SplitView::Axis::Horizontal;
@ -249,14 +250,14 @@ public:
} }
} }
void think() { void think() override {
if (m_slots[0]) if (m_slots[0])
m_slots[0]->think(); m_slots[0]->think();
if (m_slots[1]) if (m_slots[1])
m_slots[1]->think(); m_slots[1]->think();
} }
void saveState(athena::io::IStreamWriter& w) const { void saveState(athena::io::IStreamWriter& w) const override {
w.writeUint32Big(atUint32(m_class)); w.writeUint32Big(atUint32(m_class));
m_state.write(w); m_state.write(w);
@ -271,7 +272,7 @@ public:
w.writeUint32Big(0); w.writeUint32Big(0);
} }
void saveState(athena::io::YAMLDocWriter& w) const { void saveState(athena::io::YAMLDocWriter& w) const override {
w.writeUint32("class", atUint32(m_class)); w.writeUint32("class", atUint32(m_class));
m_state.write(w); m_state.write(w);
@ -292,11 +293,11 @@ public:
void setChildSlot(unsigned slot, std::unique_ptr<Space>&& space); void setChildSlot(unsigned slot, std::unique_ptr<Space>&& space);
specter::View* buildSpaceView(specter::ViewResources& res) { return buildContentView(res); } specter::View* buildSpaceView(specter::ViewResources& res) override { return buildContentView(res); }
specter::View* buildContentView(specter::ViewResources& res); specter::View* buildContentView(specter::ViewResources& res) override;
Space* copy(Space* parent) const { return nullptr; } Space* copy(Space* parent) const override { return nullptr; }
bool spaceSplitAllowed() const { return false; } bool spaceSplitAllowed() const override { return false; }
ISpaceController* spaceJoin(int keepSlot) { ISpaceController* spaceJoin(int keepSlot) {
if (m_parent) { if (m_parent) {
@ -307,11 +308,11 @@ public:
return nullptr; return nullptr;
} }
std::unique_ptr<Space> exchangeSpaceSplitJoin(Space* removeSpace, std::unique_ptr<Space>&& keepSpace); std::unique_ptr<Space> exchangeSpaceSplitJoin(Space* removeSpace, std::unique_ptr<Space>&& keepSpace) override;
specter::SplitView* splitView() { return m_splitView.get(); } specter::SplitView* splitView() override { return m_splitView.get(); }
void updateSplit(float split) { m_state.split = split; } void updateSplit(float split) override { m_state.split = split; }
void joinViews(specter::SplitView* thisSplit, int thisSlot, specter::SplitView* otherSplit, int otherSlot); void joinViews(specter::SplitView* thisSplit, int thisSlot, specter::SplitView* otherSplit, int otherSlot) override;
void setAxis(specter::SplitView::Axis axis) { void setAxis(specter::SplitView::Axis axis) {
m_state.axis = axis; m_state.axis = axis;
@ -321,7 +322,7 @@ public:
specter::SplitView::Axis axis() const { return m_state.axis; } specter::SplitView::Axis axis() const { return m_state.axis; }
float split() const { return m_state.split; } float split() const { return m_state.split; }
specter::View* basisView() { return m_splitView.get(); } specter::View* basisView() override { return m_splitView.get(); }
}; };
inline SplitSpace* Space::castToSplitSpace() { inline SplitSpace* Space::castToSplitSpace() {
return cls() == Class::SplitSpace ? static_cast<SplitSpace*>(this) : nullptr; return cls() == Class::SplitSpace ? static_cast<SplitSpace*>(this) : nullptr;
@ -356,16 +357,21 @@ public:
specter::IButtonBinding* binding) specter::IButtonBinding* binding)
: Space(vm, Class::TestSpace, parent), m_contentStr(content), m_buttonStr(button), m_binding(binding) {} : Space(vm, Class::TestSpace, parent), m_contentStr(content), m_buttonStr(button), m_binding(binding) {}
<<<<<<< HEAD
struct State : Space::State{AT_DECL_DNA_YAMLV} m_state; struct State : Space::State{AT_DECL_DNA_YAMLV} m_state;
const Space::State& spaceState() const { return m_state; } const Space::State& spaceState() const { return m_state; }
=======
struct State : Space::State{AT_DECL_DNA_YAML AT_DECL_DNAV} m_state;
const Space::State& spaceState() const override { return m_state; }
>>>>>>> Editor: Use override where applicable
bool usesToolbar() const { return true; } bool usesToolbar() const override { return true; }
void buildToolbarView(specter::ViewResources& res, specter::Toolbar& tb) { void buildToolbarView(specter::ViewResources& res, specter::Toolbar& tb) override {
m_button.reset(new specter::Button(res, tb, m_binding, m_buttonStr)); m_button.reset(new specter::Button(res, tb, m_binding, m_buttonStr));
tb.push_back(m_button.get(), 0); tb.push_back(m_button.get(), 0);
} }
specter::View* buildContentView(specter::ViewResources& res) { specter::View* buildContentView(specter::ViewResources& res) override {
m_textView.reset(new specter::MultiLineTextView(res, *m_spaceView, res.m_heading14)); m_textView.reset(new specter::MultiLineTextView(res, *m_spaceView, res.m_heading14));
m_textView->setBackground(res.themeData().viewportBackground()); m_textView->setBackground(res.themeData().viewportBackground());
m_textView->typesetGlyphs(m_contentStr, res.themeData().uiText()); m_textView->typesetGlyphs(m_contentStr, res.themeData().uiText());

View File

@ -37,9 +37,11 @@ class SplashScreen : public specter::ModalWindow {
SplashScreen& m_splash; SplashScreen& m_splash;
hecl::SystemString m_deferPath; hecl::SystemString m_deferPath;
NewProjBinding(SplashScreen& splash) : m_splash(splash) {} NewProjBinding(SplashScreen& splash) : m_splash(splash) {}
std::string_view name(const specter::Control* control) const { return m_splash.m_newString.c_str(); } std::string_view name(const specter::Control* control) const override { return m_splash.m_newString.c_str(); }
std::string_view help(const specter::Control* control) const { return "Creates an empty project at selected path"; } std::string_view help(const specter::Control* control) const override {
void activated(const specter::Button* button, const boo::SWindowCoord& coord) { return "Creates an empty project at selected path";
}
void activated(const specter::Button* button, const boo::SWindowCoord& coord) override {
m_splash.m_fileBrowser.m_view.reset(new specter::FileBrowser( m_splash.m_fileBrowser.m_view.reset(new specter::FileBrowser(
m_splash.rootView().viewRes(), m_splash, m_splash.m_newString, specter::FileBrowser::Type::NewHECLProject, m_splash.rootView().viewRes(), m_splash, m_splash.m_newString, specter::FileBrowser::Type::NewHECLProject,
[&](bool ok, hecl::SystemStringView path) { [&](bool ok, hecl::SystemStringView path) {
@ -55,11 +57,11 @@ class SplashScreen : public specter::ModalWindow {
SplashScreen& m_splash; SplashScreen& m_splash;
hecl::SystemString m_deferPath; hecl::SystemString m_deferPath;
OpenProjBinding(SplashScreen& splash) : m_splash(splash), m_openRecentMenuRoot(*this) {} OpenProjBinding(SplashScreen& splash) : m_splash(splash), m_openRecentMenuRoot(*this) {}
std::string_view name(const specter::Control* control) const { return m_splash.m_openString.c_str(); } std::string_view name(const specter::Control* control) const override { return m_splash.m_openString.c_str(); }
std::string_view help(const specter::Control* control) const { std::string_view help(const specter::Control* control) const override {
return "Opens an existing project at selected path"; return "Opens an existing project at selected path";
} }
void activated(const specter::Button* button, const boo::SWindowCoord& coord) { void activated(const specter::Button* button, const boo::SWindowCoord& coord) override {
m_splash.m_fileBrowser.m_view.reset(new specter::FileBrowser( m_splash.m_fileBrowser.m_view.reset(new specter::FileBrowser(
m_splash.rootView().viewRes(), m_splash, m_splash.m_openString, specter::FileBrowser::Type::OpenHECLProject, m_splash.rootView().viewRes(), m_splash, m_splash.m_openString, specter::FileBrowser::Type::OpenHECLProject,
[&](bool ok, hecl::SystemStringView path) { [&](bool ok, hecl::SystemStringView path) {
@ -75,7 +77,7 @@ class SplashScreen : public specter::ModalWindow {
OpenRecentMenuRoot(OpenProjBinding& openProjBind) : m_openProjBind(openProjBind) {} OpenRecentMenuRoot(OpenProjBinding& openProjBind) : m_openProjBind(openProjBind) {}
std::string m_text; std::string m_text;
const std::string* text() const { return &m_text; } const std::string* text() const override { return &m_text; }
struct OpenRecentMenuItem final : specter::IMenuNode { struct OpenRecentMenuItem final : specter::IMenuNode {
OpenRecentMenuRoot& m_parent; OpenRecentMenuRoot& m_parent;
@ -83,8 +85,8 @@ class SplashScreen : public specter::ModalWindow {
hecl::SystemString m_path; hecl::SystemString m_path;
std::string m_text; std::string m_text;
const std::string* text() const { return &m_text; } const std::string* text() const override { return &m_text; }
void activated(const boo::SWindowCoord& coord) { void activated(const boo::SWindowCoord& coord) override {
m_parent.m_openProjBind.m_deferPath = m_path; m_parent.m_openProjBind.m_deferPath = m_path;
m_parent.m_openProjBind.m_splash.m_openButt.m_view->closeMenu(coord); m_parent.m_openProjBind.m_splash.m_openButt.m_view->closeMenu(coord);
} }
@ -98,8 +100,8 @@ class SplashScreen : public specter::ModalWindow {
}; };
std::vector<OpenRecentMenuItem> m_items; std::vector<OpenRecentMenuItem> m_items;
size_t subNodeCount() const { return m_items.size(); } size_t subNodeCount() const override { return m_items.size(); }
specter::IMenuNode* subNode(size_t idx) { return &m_items[idx]; } specter::IMenuNode* subNode(size_t idx) override { return &m_items[idx]; }
void buildNodes(const std::vector<hecl::SystemString>* recentProjects) { void buildNodes(const std::vector<hecl::SystemString>* recentProjects) {
m_items.clear(); m_items.clear();
@ -111,8 +113,8 @@ class SplashScreen : public specter::ModalWindow {
} }
} m_openRecentMenuRoot; } m_openRecentMenuRoot;
MenuStyle menuStyle(const specter::Button* button) const { return MenuStyle::Auxiliary; } MenuStyle menuStyle(const specter::Button* button) const override { return MenuStyle::Auxiliary; }
std::unique_ptr<View> buildMenu(const specter::Button* button) { std::unique_ptr<View> buildMenu(const specter::Button* button) override {
m_openRecentMenuRoot.buildNodes(m_splash.m_vm.recentProjects()); m_openRecentMenuRoot.buildNodes(m_splash.m_vm.recentProjects());
return std::unique_ptr<View>(new specter::Menu(m_splash.rootView().viewRes(), m_splash, &m_openRecentMenuRoot)); return std::unique_ptr<View>(new specter::Menu(m_splash.rootView().viewRes(), m_splash, &m_openRecentMenuRoot));
} }
@ -122,11 +124,11 @@ class SplashScreen : public specter::ModalWindow {
SplashScreen& m_splash; SplashScreen& m_splash;
hecl::SystemString m_deferPath; hecl::SystemString m_deferPath;
ExtractProjBinding(SplashScreen& splash) : m_splash(splash) {} ExtractProjBinding(SplashScreen& splash) : m_splash(splash) {}
std::string_view name(const specter::Control* control) const { return m_splash.m_extractString.c_str(); } std::string_view name(const specter::Control* control) const override { return m_splash.m_extractString.c_str(); }
std::string_view help(const specter::Control* control) const { std::string_view help(const specter::Control* control) const override {
return "Extracts game image as project at selected path"; return "Extracts game image as project at selected path";
} }
void activated(const specter::Button* button, const boo::SWindowCoord& coord) { void activated(const specter::Button* button, const boo::SWindowCoord& coord) override {
m_splash.m_fileBrowser.m_view.reset( m_splash.m_fileBrowser.m_view.reset(
new specter::FileBrowser(m_splash.rootView().viewRes(), m_splash, m_splash.m_extractString, new specter::FileBrowser(m_splash.rootView().viewRes(), m_splash, m_splash.m_extractString,
specter::FileBrowser::Type::OpenFile, [&](bool ok, hecl::SystemStringView path) { specter::FileBrowser::Type::OpenFile, [&](bool ok, hecl::SystemStringView path) {
@ -140,23 +142,23 @@ class SplashScreen : public specter::ModalWindow {
public: public:
SplashScreen(ViewManager& vm, specter::ViewResources& res); SplashScreen(ViewManager& vm, specter::ViewResources& res);
void think(); void think() override;
void updateContentOpacity(float opacity); void updateContentOpacity(float opacity) override;
void mouseDown(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey); void mouseDown(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey) override;
void mouseUp(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey); void mouseUp(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey) override;
void mouseMove(const boo::SWindowCoord&); void mouseMove(const boo::SWindowCoord&) override;
void mouseEnter(const boo::SWindowCoord&); void mouseEnter(const boo::SWindowCoord&) override;
void mouseLeave(const boo::SWindowCoord&); void mouseLeave(const boo::SWindowCoord&) override;
void scroll(const boo::SWindowCoord&, const boo::SScrollDelta&); void scroll(const boo::SWindowCoord&, const boo::SScrollDelta&) override;
void touchDown(const boo::STouchCoord&, uintptr_t); void touchDown(const boo::STouchCoord&, uintptr_t) override;
void touchUp(const boo::STouchCoord&, uintptr_t); void touchUp(const boo::STouchCoord&, uintptr_t) override;
void touchMove(const boo::STouchCoord&, uintptr_t); void touchMove(const boo::STouchCoord&, uintptr_t) override;
void charKeyDown(unsigned long, boo::EModifierKey, bool); void charKeyDown(unsigned long, boo::EModifierKey, bool) override;
void specialKeyDown(boo::ESpecialKey, boo::EModifierKey, bool); void specialKeyDown(boo::ESpecialKey, boo::EModifierKey, bool) override;
void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub); void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub) override;
void draw(boo::IGraphicsCommandQueue* gfxQ); void draw(boo::IGraphicsCommandQueue* gfxQ) override;
}; };
} // namespace urde } // namespace urde

View File

@ -60,47 +60,47 @@ class ViewManager final : public specter::IViewManager {
public: public:
TestGameView(ViewManager& vm, specter::ViewResources& res, specter::View& parent) : View(res, parent), m_vm(vm) {} TestGameView(ViewManager& vm, specter::ViewResources& res, specter::View& parent) : View(res, parent), m_vm(vm) {}
void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub); void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub) override;
void draw(boo::IGraphicsCommandQueue* gfxQ); void draw(boo::IGraphicsCommandQueue* gfxQ) override;
void think(); void think() override;
void mouseDown(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mkey) { void mouseDown(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mkey) override {
if (MP1::CMain* m = m_vm.m_projManager.gameMain()) if (MP1::CMain* m = m_vm.m_projManager.gameMain())
if (MP1::CGameArchitectureSupport* as = m->GetArchSupport()) if (MP1::CGameArchitectureSupport* as = m->GetArchSupport())
as->mouseDown(coord, button, mkey); as->mouseDown(coord, button, mkey);
} }
void mouseUp(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mkey) { void mouseUp(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mkey) override {
if (MP1::CMain* m = m_vm.m_projManager.gameMain()) if (MP1::CMain* m = m_vm.m_projManager.gameMain())
if (MP1::CGameArchitectureSupport* as = m->GetArchSupport()) if (MP1::CGameArchitectureSupport* as = m->GetArchSupport())
as->mouseUp(coord, button, mkey); as->mouseUp(coord, button, mkey);
} }
void mouseMove(const boo::SWindowCoord& coord) { void mouseMove(const boo::SWindowCoord& coord) override {
if (MP1::CMain* m = m_vm.m_projManager.gameMain()) if (MP1::CMain* m = m_vm.m_projManager.gameMain())
if (MP1::CGameArchitectureSupport* as = m->GetArchSupport()) if (MP1::CGameArchitectureSupport* as = m->GetArchSupport())
as->mouseMove(coord); as->mouseMove(coord);
} }
void scroll(const boo::SWindowCoord& coord, const boo::SScrollDelta& sd) { void scroll(const boo::SWindowCoord& coord, const boo::SScrollDelta& sd) override {
if (MP1::CMain* m = m_vm.m_projManager.gameMain()) if (MP1::CMain* m = m_vm.m_projManager.gameMain())
if (MP1::CGameArchitectureSupport* as = m->GetArchSupport()) if (MP1::CGameArchitectureSupport* as = m->GetArchSupport())
as->scroll(coord, sd); as->scroll(coord, sd);
} }
void charKeyDown(unsigned long cc, boo::EModifierKey mkey, bool repeat) { void charKeyDown(unsigned long cc, boo::EModifierKey mkey, bool repeat) override {
if (MP1::CMain* m = m_vm.m_projManager.gameMain()) if (MP1::CMain* m = m_vm.m_projManager.gameMain())
if (MP1::CGameArchitectureSupport* as = m->GetArchSupport()) if (MP1::CGameArchitectureSupport* as = m->GetArchSupport())
as->charKeyDown(cc, mkey, repeat); as->charKeyDown(cc, mkey, repeat);
} }
void charKeyUp(unsigned long cc, boo::EModifierKey mkey) { void charKeyUp(unsigned long cc, boo::EModifierKey mkey) override {
if (MP1::CMain* m = m_vm.m_projManager.gameMain()) if (MP1::CMain* m = m_vm.m_projManager.gameMain())
if (MP1::CGameArchitectureSupport* as = m->GetArchSupport()) if (MP1::CGameArchitectureSupport* as = m->GetArchSupport())
as->charKeyUp(cc, mkey); as->charKeyUp(cc, mkey);
} }
void specialKeyDown(boo::ESpecialKey skey, boo::EModifierKey mkey, bool repeat) { void specialKeyDown(boo::ESpecialKey skey, boo::EModifierKey mkey, bool repeat) override {
if (MP1::CMain* m = m_vm.m_projManager.gameMain()) if (MP1::CMain* m = m_vm.m_projManager.gameMain())
if (MP1::CGameArchitectureSupport* as = m->GetArchSupport()) if (MP1::CGameArchitectureSupport* as = m->GetArchSupport())
as->specialKeyDown(skey, mkey, repeat); as->specialKeyDown(skey, mkey, repeat);
@ -109,7 +109,7 @@ class ViewManager final : public specter::IViewManager {
m_vm.m_skipWait = true; m_vm.m_skipWait = true;
} }
void specialKeyUp(boo::ESpecialKey skey, boo::EModifierKey mkey) { void specialKeyUp(boo::ESpecialKey skey, boo::EModifierKey mkey) override {
if (MP1::CMain* m = m_vm.m_projManager.gameMain()) if (MP1::CMain* m = m_vm.m_projManager.gameMain())
if (MP1::CGameArchitectureSupport* as = m->GetArchSupport()) if (MP1::CGameArchitectureSupport* as = m->GetArchSupport())
as->specialKeyUp(skey, mkey); as->specialKeyUp(skey, mkey);
@ -166,21 +166,21 @@ public:
ProjectManager& projectManager() { return m_projManager; } ProjectManager& projectManager() { return m_projManager; }
hecl::Database::Project* project() { return m_projManager.project(); } hecl::Database::Project* project() { return m_projManager.project(); }
locale::ELocale getTranslatorLocale() const { return m_locale; } locale::ELocale getTranslatorLocale() const override { return m_locale; }
void deferSpaceSplit(specter::ISpaceController* split, specter::SplitView::Axis axis, int thisSlot, void deferSpaceSplit(specter::ISpaceController* split, specter::SplitView::Axis axis, int thisSlot,
const boo::SWindowCoord& coord) { const boo::SWindowCoord& coord) override {
m_deferSplit = static_cast<Space*>(split); m_deferSplit = static_cast<Space*>(split);
m_deferSplitAxis = axis; m_deferSplitAxis = axis;
m_deferSplitThisSlot = thisSlot; m_deferSplitThisSlot = thisSlot;
m_deferSplitCoord = coord; m_deferSplitCoord = coord;
} }
const std::vector<hecl::SystemString>* recentProjects() const { return &m_recentProjects; } const std::vector<hecl::SystemString>* recentProjects() const override { return &m_recentProjects; }
void pushRecentProject(hecl::SystemStringView path); void pushRecentProject(hecl::SystemStringView path) override;
const std::vector<hecl::SystemString>* recentFiles() const { return &m_recentFiles; } const std::vector<hecl::SystemString>* recentFiles() const override { return &m_recentFiles; }
void pushRecentFile(hecl::SystemStringView path); void pushRecentFile(hecl::SystemStringView path) override;
void init(boo::IApplication* app); void init(boo::IApplication* app);
const boo::SystemChar* platformName() { return m_mainPlatformName; } const boo::SystemChar* platformName() { return m_mainPlatformName; }

View File

@ -60,7 +60,7 @@ struct Application : boo::IApplicationCallback {
virtual ~Application() = default; virtual ~Application() = default;
int appMain(boo::IApplication* app) { int appMain(boo::IApplication* app) override {
initialize(app); initialize(app);
m_viewManager->init(app); m_viewManager->init(app);
while (m_running.load()) { while (m_running.load()) {
@ -73,8 +73,8 @@ struct Application : boo::IApplicationCallback {
m_viewManager.reset(); m_viewManager.reset();
return 0; return 0;
} }
void appQuitting(boo::IApplication*) { m_running.store(false); } void appQuitting(boo::IApplication*) override { m_running.store(false); }
void appFilesOpen(boo::IApplication*, const std::vector<boo::SystemString>& paths) { void appFilesOpen(boo::IApplication*, const std::vector<boo::SystemString>& paths) override {
for (const auto& path : paths) { for (const auto& path : paths) {
hecl::ProjectRootPath projPath = hecl::SearchForProject(path); hecl::ProjectRootPath projPath = hecl::SearchForProject(path);
if (projPath) { if (projPath) {