From 2053734e9e1e89fe79fa36e9ea874a7f9c7d6f76 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Thu, 14 Jan 2016 17:38:03 -1000 Subject: [PATCH] Update submodules --- Editor/SplashScreen.cpp | 10 ++++++++ Editor/SplashScreen.hpp | 54 ++++++++++++++++++++++++++++++++++++++++- hecl | 2 +- libSpecter | 2 +- 4 files changed, 65 insertions(+), 3 deletions(-) diff --git a/Editor/SplashScreen.cpp b/Editor/SplashScreen.cpp index a6032a0e1..4d4e0ab0a 100644 --- a/Editor/SplashScreen.cpp +++ b/Editor/SplashScreen.cpp @@ -35,12 +35,20 @@ SplashScreen::SplashScreen(ViewManager& vm, Specter::ViewResources& res) m_extractString(m_vm.translateOr("extract_game", "Extract Game")), m_extractProjBind(*this) { + m_openProjBind.m_openRecentMenuRoot.m_text = vm.translateOr("recent_projects", "Recent Projects"); m_textColorClear[3] = 0.0; commitResources(res); } void SplashScreen::think() { + if (phase() == Phase::Done) + { + if (m_fileBrowser.m_view) + m_fileBrowser.m_view.reset(); + return; + } + ModalWindow::think(); if (m_fileBrowser.m_view) m_fileBrowser.m_view->think(); @@ -245,6 +253,8 @@ void SplashScreen::resized(const boo::SWindowRect& root, const boo::SWindowRect& void SplashScreen::draw(boo::IGraphicsCommandQueue* gfxQ) { + if (phase() == Phase::Done) + return; ModalWindow::draw(gfxQ); if (m_title) diff --git a/Editor/SplashScreen.hpp b/Editor/SplashScreen.hpp index 36f7d21df..52b6ddd7d 100644 --- a/Editor/SplashScreen.hpp +++ b/Editor/SplashScreen.hpp @@ -5,6 +5,7 @@ #include #include #include +#include #include "ViewManager.hpp" namespace URDE @@ -58,7 +59,7 @@ class SplashScreen : public Specter::ModalWindow { SplashScreen& m_splash; HECL::SystemString m_deferPath; - OpenProjBinding(SplashScreen& splash) : m_splash(splash) {} + OpenProjBinding(SplashScreen& splash) : m_splash(splash), m_openRecentMenuRoot(*this) {} const char* name(const Specter::Control* control) const {return m_splash.m_openString.c_str();} const char* help(const Specter::Control* control) const {return "Opens an existing project at selected path";} void activated(const Specter::Button* button, const boo::SWindowCoord& coord) @@ -75,6 +76,57 @@ class SplashScreen : public Specter::ModalWindow m_splash.updateSize(); m_splash.m_openButt.mouseLeave(coord); } + + struct OpenRecentMenuRoot : Specter::IMenuNode + { + OpenProjBinding& m_openProjBind; + OpenRecentMenuRoot(OpenProjBinding& openProjBind) : m_openProjBind(openProjBind) {} + + std::string m_text; + const std::string* text() const {return &m_text;} + + struct OpenRecentMenuItem : Specter::IMenuNode + { + OpenRecentMenuRoot& m_parent; + + HECL::SystemString m_path; + std::string m_text; + + const std::string* text() const {return &m_text;} + void activated() {m_parent.m_openProjBind.m_deferPath = m_path;} + + OpenRecentMenuItem(OpenRecentMenuRoot& parent, const HECL::SystemString& path) + : m_parent(parent), m_path(path) + { + std::vector pathComps = Specter::FileBrowser::PathComponents(path); + if (pathComps.size()) + m_text = HECL::SystemUTF8View(pathComps.back()).str(); + } + }; + std::vector m_items; + + size_t subNodeCount() const {return m_items.size();} + Specter::IMenuNode* subNode(size_t idx) {return &m_items[idx];} + + void buildNodes(const std::vector* recentProjects) + { + m_items.clear(); + if (recentProjects) + { + m_items.reserve(recentProjects->size()); + for (const HECL::SystemString& path : *recentProjects) + m_items.emplace_back(*this, path); + } + } + } m_openRecentMenuRoot; + + MenuStyle menuStyle(const Specter::Button* button) const {return MenuStyle::Auxiliary;} + std::unique_ptr buildMenu(const Specter::Button* button) + { + m_openRecentMenuRoot.buildNodes(m_splash.m_vm.recentProjects()); + return std::unique_ptr(new Specter::Menu(m_splash.rootView().viewRes(), + m_splash, &m_openRecentMenuRoot)); + } } m_openProjBind; struct ExtractProjBinding : Specter::IButtonBinding diff --git a/hecl b/hecl index f9edbe582..5d0c80b9e 160000 --- a/hecl +++ b/hecl @@ -1 +1 @@ -Subproject commit f9edbe58261c36b9e7f02a3f6c6d07708187cd25 +Subproject commit 5d0c80b9e603ecb2762b281d8736d21a324c3e76 diff --git a/libSpecter b/libSpecter index b1a8603a8..2490aa3bb 160000 --- a/libSpecter +++ b/libSpecter @@ -1 +1 @@ -Subproject commit b1a8603a85ebc0b762a30391e1db5b43d93215b9 +Subproject commit 2490aa3bb82860fa2969d2cc797324d846e3b51c