Initial Space and ResourceOutliner stub

This commit is contained in:
Jack Andersen 2015-12-09 17:16:29 -10:00
parent b85b85a6fd
commit dae5e4b44e
7 changed files with 99 additions and 53 deletions

View File

@ -1,7 +1,15 @@
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
add_subdirectory(locale)
set(SPACE_HEADERS
ResourceOutliner/ResourceOutliner.hpp)
set(SPACE_SOURCES
ResourceOutliner/ResourceOutliner.cpp)
add_executable(rude WIN32
main.cpp
main.cpp ISpace.hpp
${SPACE_HEADERS} ${SPACE_SOURCES}
ViewManager.hpp ViewManager.cpp)
target_link_libraries(rude

13
Editor/ISpace.hpp Normal file
View File

@ -0,0 +1,13 @@
#ifndef RUDE_ISPACE_HPP
#define RUDE_ISPACE_HPP
namespace RUDE
{
class ISpace
{
};
}
#endif // RUDE_ISPACE_HPP

View File

@ -0,0 +1 @@
#include "ResourceOutliner.hpp"

View File

@ -0,0 +1,15 @@
#ifndef RUDE_RESOURCE_OUTLINER_HPP
#define RUDE_RESOURCE_OUTLINER_HPP
#include "ISpace.hpp"
namespace RUDE
{
class ResourceOutliner : public ISpace
{
};
}
#endif // RUDE_RESOURCE_OUTLINER_HPP

View File

@ -4,66 +4,38 @@
namespace RUDE
{
struct SetTo1 : Specter::IButtonBinding
{
ViewManager& m_vm;
std::string m_name = "SetTo1";
std::string m_help = "Sets scale factor to 1.0";
SetTo1(ViewManager& vm) : m_vm(vm) {}
const std::string& name() const {return m_name;}
const std::string& help() const {return m_help;}
void pressed(const boo::SWindowCoord& coord)
{
m_vm.RequestPixelFactor(1.0);
}
};
struct SetTo2 : Specter::IButtonBinding
{
ViewManager& m_vm;
std::string m_name = "SetTo2";
std::string m_help = "Sets scale factor to 2.0";
SetTo2(ViewManager& vm) : m_vm(vm) {}
const std::string& name() const {return m_name;}
const std::string& help() const {return m_help;}
void pressed(const boo::SWindowCoord& coord)
{
m_vm.RequestPixelFactor(2.0);
}
};
void ViewManager::SetupRootView()
{
m_rootView.reset(new Specter::RootView(*this, m_viewResources, m_mainWindow.get()));
Specter::SplitView* splitView = new Specter::SplitView(m_viewResources, *m_rootView, Specter::SplitView::Axis::Horizontal);
m_rootView->setContentView(std::unique_ptr<Specter::SplitView>(splitView));
m_splitView.reset(new Specter::SplitView(m_viewResources, *m_rootView, Specter::SplitView::Axis::Horizontal));
m_rootView->setContentView(m_splitView.get());
m_space1 = new Specter::Space(m_viewResources, *splitView, Specter::Toolbar::Position::Top);
m_space1->toolbar().push_back(std::make_unique<Specter::Button>(m_viewResources, m_space1->toolbar(),
std::make_unique<SetTo1>(*this), "Hello Button"));
m_space1.reset(new Specter::Space(m_viewResources, *m_splitView, Specter::Toolbar::Position::Top));
m_butt1.reset(new Specter::Button(m_viewResources, m_space1->toolbar(),
&m_setTo1, "Hello Button"));
m_space1->toolbar().push_back(m_butt1.get());
m_space2 = new Specter::Space(m_viewResources, *splitView, Specter::Toolbar::Position::Bottom);
m_space2->toolbar().push_back(std::make_unique<Specter::Button>(m_viewResources, m_space2->toolbar(),
std::make_unique<SetTo2>(*this), "こんにちはボタン"));
m_space2.reset(new Specter::Space(m_viewResources, *m_splitView, Specter::Toolbar::Position::Bottom));
m_butt2.reset(new Specter::Button(m_viewResources, m_space2->toolbar(),
&m_setTo2, "こんにちはボタン"));
m_space2->toolbar().push_back(m_butt2.get());
splitView->setContentView(0, std::unique_ptr<Specter::Space>(m_space1));
splitView->setContentView(1, std::unique_ptr<Specter::Space>(m_space2));
m_splitView->setContentView(0, m_space1.get());
m_splitView->setContentView(1, m_space2.get());
m_rootView->setBackground(Zeus::CColor::skGrey);
Specter::MultiLineTextView* textView1 = new Specter::MultiLineTextView(m_viewResources, *m_space1, m_viewResources.m_heading18);
m_space1->setContentView(std::unique_ptr<Specter::MultiLineTextView>(textView1));
m_textView1.reset(new Specter::MultiLineTextView(m_viewResources, *m_space1, m_viewResources.m_heading18));
m_space1->setContentView(m_textView1.get());
Specter::MultiLineTextView* textView2 = new Specter::MultiLineTextView(m_viewResources, *m_space2, m_viewResources.m_heading18);
m_space2->setContentView(std::unique_ptr<Specter::MultiLineTextView>(textView2));
m_textView2.reset(new Specter::MultiLineTextView(m_viewResources, *m_space2, m_viewResources.m_heading18));
m_space2->setContentView(m_textView2.get());
textView1->typesetGlyphs("Hello, World!\n\n", m_viewResources.themeData().uiText());
textView2->typesetGlyphs("こんにちは世界!\n\n", m_viewResources.themeData().uiText());
m_textView1->typesetGlyphs("Hello, World!\n\n", m_viewResources.themeData().uiText());
m_textView2->typesetGlyphs("こんにちは世界!\n\n", m_viewResources.themeData().uiText());
textView1->setBackground(m_viewResources.themeData().viewportBackground());
textView2->setBackground(m_viewResources.themeData().viewportBackground());
m_textView1->setBackground(m_viewResources.themeData().viewportBackground());
m_textView2->setBackground(m_viewResources.themeData().viewportBackground());
m_rootView->updateSize();
}

View File

@ -14,9 +14,14 @@ class ViewManager : Specter::IViewManager
Specter::ViewResources m_viewResources;
std::unique_ptr<boo::IWindow> m_mainWindow;
std::unique_ptr<Specter::RootView> m_rootView;
std::unique_ptr<Specter::SplitView> m_splitView;
Specter::Space* m_space1;
Specter::Space* m_space2;
std::unique_ptr<Specter::Space> m_space1;
std::unique_ptr<Specter::Button> m_butt1;
std::unique_ptr<Specter::MultiLineTextView> m_textView1;
std::unique_ptr<Specter::Space> m_space2;
std::unique_ptr<Specter::Button> m_butt2;
std::unique_ptr<Specter::MultiLineTextView> m_textView2;
HECL::CVar* m_cvPixelFactor;
@ -26,7 +31,7 @@ class ViewManager : Specter::IViewManager
void SetupRootView();
public:
ViewManager(HECL::Runtime::FileStoreManager& fileMgr, HECL::CVarManager& cvarMgr)
: m_cvarManager(cvarMgr), m_fontCache(fileMgr) {}
: m_cvarManager(cvarMgr), m_fontCache(fileMgr), m_setTo1(*this), m_setTo2(*this) {}
Specter::RootView& rootView() const {return *m_rootView;}
void RequestPixelFactor(float pf)
@ -38,6 +43,38 @@ public:
void init(boo::IApplication* app);
bool proc();
void stop();
struct SetTo1 : Specter::IButtonBinding
{
ViewManager& m_vm;
std::string m_name = "SetTo1";
std::string m_help = "Sets scale factor to 1.0";
SetTo1(ViewManager& vm) : m_vm(vm) {}
const std::string& name() const {return m_name;}
const std::string& help() const {return m_help;}
void pressed(const boo::SWindowCoord& coord)
{
m_vm.RequestPixelFactor(1.0);
}
};
SetTo1 m_setTo1;
struct SetTo2 : Specter::IButtonBinding
{
ViewManager& m_vm;
std::string m_name = "SetTo2";
std::string m_help = "Sets scale factor to 2.0";
SetTo2(ViewManager& vm) : m_vm(vm) {}
const std::string& name() const {return m_name;}
const std::string& help() const {return m_help;}
void pressed(const boo::SWindowCoord& coord)
{
m_vm.RequestPixelFactor(2.0);
}
};
SetTo2 m_setTo2;
};
}

@ -1 +1 @@
Subproject commit 4d8e33e98170fa66907c829457893c800c3082dc
Subproject commit 409855bc1b8085beb0a739efdf31ee53a7a8d305