metaforce/Editor/ViewManager.hpp

118 lines
3.6 KiB
C++
Raw Normal View History

2016-01-05 09:53:16 +00:00
#ifndef URDE_VIEW_MANAGER_HPP
#define URDE_VIEW_MANAGER_HPP
#include <HECL/CVarManager.hpp>
2015-12-13 21:01:32 +00:00
#include "ProjectManager.hpp"
#include "Space.hpp"
2016-02-16 05:50:41 +00:00
#include "Runtime/Particle/CElementGen.hpp"
#include "Runtime/Graphics/CLineRenderer.hpp"
2016-02-16 05:50:41 +00:00
2016-01-05 09:53:16 +00:00
namespace URDE
{
2015-12-13 02:27:34 +00:00
class SplashScreen;
2015-12-31 03:20:52 +00:00
class ViewManager : public Specter::IViewManager
{
2016-01-04 05:31:02 +00:00
friend class ProjectManager;
2016-01-11 02:17:08 +00:00
friend class Space;
friend class RootSpace;
2016-02-01 01:13:45 +00:00
friend class SplitSpace;
2016-01-04 05:31:02 +00:00
2016-01-02 02:27:46 +00:00
HECL::Runtime::FileStoreManager& m_fileStoreManager;
HECL::CVarManager& m_cvarManager;
2015-12-13 21:01:32 +00:00
ProjectManager m_projManager;
Specter::FontCache m_fontCache;
Specter::DefaultThemeData m_themeData;
Specter::ViewResources m_viewResources;
2016-01-18 23:33:23 +00:00
boo::GraphicsDataToken m_iconsToken;
2015-12-31 03:20:52 +00:00
Specter::Translator m_translator;
std::unique_ptr<boo::IWindow> m_mainWindow;
2016-01-04 05:31:02 +00:00
std::unique_ptr<Specter::RootView> m_rootView;
2015-12-13 02:27:34 +00:00
std::unique_ptr<SplashScreen> m_splash;
std::unique_ptr<RootSpace> m_rootSpace;
2016-01-05 00:01:02 +00:00
Specter::View* m_rootSpaceView = nullptr;
2015-12-09 01:04:50 +00:00
2016-02-16 05:50:41 +00:00
class ParticleView : public Specter::View
{
ViewManager& m_vm;
public:
ParticleView(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 draw(boo::IGraphicsCommandQueue* gfxQ);
2016-02-16 05:50:41 +00:00
};
std::unique_ptr<ParticleView> m_particleView;
pshag::TLockedToken<pshag::CGenDescription> m_partGenDesc;
std::unique_ptr<pshag::CElementGen> m_partGen;
std::unique_ptr<pshag::CLineRenderer> m_lineRenderer;
2016-02-16 05:50:41 +00:00
2016-01-16 03:58:11 +00:00
HECL::SystemString m_recentProjectsPath;
std::vector<HECL::SystemString> m_recentProjects;
HECL::SystemString m_recentFilesPath;
2016-01-02 02:27:46 +00:00
std::vector<HECL::SystemString> m_recentFiles;
2015-12-09 01:04:50 +00:00
bool m_updatePf = false;
float m_reqPf;
2016-01-11 02:17:08 +00:00
Specter::View* BuildSpaceViews();
2016-01-05 00:01:02 +00:00
Specter::RootView* SetupRootView();
SplashScreen* SetupSplashView();
2016-01-11 02:17:08 +00:00
void RootSpaceViewBuilt(Specter::View* view);
2015-12-13 02:27:34 +00:00
void SetupEditorView();
2016-01-05 00:01:02 +00:00
void SetupEditorView(ConfigReader& r);
void SaveEditorView(ConfigWriter& w);
2015-12-13 02:27:34 +00:00
bool m_showSplash = false;
2016-01-05 00:01:02 +00:00
void DismissSplash();
unsigned m_editorFrames = 120;
void FadeInEditors() {m_editorFrames = 0;}
2016-02-16 05:50:41 +00:00
void BuildTestPART(pshag::IObjectStore& objStore);
2016-01-11 02:17:08 +00:00
Space* m_deferSplit = nullptr;
Specter::SplitView::Axis m_deferSplitAxis;
int m_deferSplitThisSlot;
2016-01-12 00:46:27 +00:00
boo::SWindowCoord m_deferSplitCoord;
2016-01-11 02:17:08 +00:00
2016-01-04 05:31:02 +00:00
public:
2015-12-13 02:27:34 +00:00
ViewManager(HECL::Runtime::FileStoreManager& fileMgr, HECL::CVarManager& cvarMgr);
~ViewManager();
Specter::RootView& rootView() const {return *m_rootView;}
2016-01-03 04:06:18 +00:00
void requestPixelFactor(float pf)
{
m_reqPf = pf;
m_updatePf = true;
}
2015-12-13 21:01:32 +00:00
ProjectManager& projectManager() {return m_projManager;}
2016-01-07 00:40:27 +00:00
HECL::Database::Project* project() {return m_projManager.project();}
2015-12-31 03:20:52 +00:00
const Specter::Translator* getTranslator() const {return &m_translator;}
2015-12-13 21:01:32 +00:00
2016-01-12 00:46:27 +00:00
void deferSpaceSplit(Specter::ISpaceController* split, Specter::SplitView::Axis axis, int thisSlot,
const boo::SWindowCoord& coord)
2016-01-11 02:17:08 +00:00
{
m_deferSplit = static_cast<Space*>(split);
m_deferSplitAxis = axis;
m_deferSplitThisSlot = thisSlot;
2016-01-12 00:46:27 +00:00
m_deferSplitCoord = coord;
2016-01-11 02:17:08 +00:00
}
2016-01-02 02:27:46 +00:00
const std::vector<HECL::SystemString>* recentProjects() const {return &m_recentProjects;}
void pushRecentProject(const HECL::SystemString& path);
const std::vector<HECL::SystemString>* recentFiles() const {return &m_recentFiles;}
void pushRecentFile(const HECL::SystemString& path);
void init(boo::IApplication* app);
bool proc();
void stop();
};
}
2016-01-05 09:53:16 +00:00
#endif // URDE_VIEW_MANAGER_HPP