Add editor portion of rendering flow

This commit is contained in:
Jack Andersen 2016-01-04 13:58:38 -10:00
parent 06eadd587e
commit 6e3614ec28
9 changed files with 71 additions and 52 deletions

View File

@ -64,7 +64,7 @@ public:
ModalWindow(ViewResources& res, View& parentView, const RectangleConstraint& constraint);
void think();
bool skipBuildInAnimation();
void close();
void close(bool skipAnimation=false);
bool closed() const {return m_phase >= Phase::BuildOut;}
void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub);

View File

@ -64,7 +64,8 @@ public:
ViewResources& viewRes() const {return *m_viewRes;}
const ThemeData& themeData() const {return m_viewRes->m_theme;}
View* setContentView(View* view);
std::vector<View*>& accessContentViews() {return m_views;}
void setActiveTextView(ITextInputView* textView)
{
if (m_activeTextView)
@ -113,7 +114,7 @@ private:
m_window->setCursor(boo::EMouseCursor::Pointer);
}
View* m_view = nullptr;
std::vector<View*> m_views;
std::unique_ptr<Tooltip> m_tooltip;
};

View File

@ -27,6 +27,15 @@ public:
void mouseLeave(const boo::SWindowCoord&);
void resized(const boo::SWindowRect& rootView, const boo::SWindowRect& sub);
void draw(boo::IGraphicsCommandQueue* gfxQ);
void setMultiplyColor(const Zeus::CColor& color)
{
View::setMultiplyColor(color);
if (m_contentView)
m_contentView->setMultiplyColor(color);
if (m_toolbar)
m_toolbar->setMultiplyColor(color);
}
};
}

View File

@ -80,6 +80,11 @@ public:
View::setMultiplyColor(color);
m_splitBlock.m_color = color;
m_splitBlockBuf->load(&m_splitBlock, sizeof(m_splitBlock));
if (m_views[0].m_view)
m_views[0].m_view->setMultiplyColor(color);
if (m_views[1].m_view)
m_views[1].m_view->setMultiplyColor(color);
}
};

View File

@ -178,7 +178,8 @@ public:
m_bgRect[i].m_color = color;
m_bgVertBuf->load(&m_bgRect, sizeof(SolidShaderVert) * 4);
}
void setMultiplyColor(const Zeus::CColor& color)
virtual void setMultiplyColor(const Zeus::CColor& color)
{
m_viewVertBlock.m_color = color;
m_viewVertBlockBuf->load(&m_viewVertBlock, sizeof(ViewBlock));

View File

@ -289,6 +289,16 @@ void FileBrowser::okActivated(bool viaButton)
{
if (!viaButton && !err && S_ISDIR(theStat.st_mode))
{
if (m_type == Type::OpenHECLProject)
{
HECL::ProjectRootPath projRoot = HECL::SearchForProject(path);
if (projRoot)
{
m_returnFunc(true, projRoot.getAbsolutePath());
close();
return;
}
}
navigateToPath(path);
return;
}

View File

@ -447,9 +447,9 @@ bool ModalWindow::skipBuildInAnimation()
return true;
}
void ModalWindow::close()
void ModalWindow::close(bool skipAnimation)
{
m_phase = Phase::BuildOut;
m_phase = skipAnimation ? Phase::Done : Phase::BuildOut;
m_frame = 0;
}

View File

@ -27,8 +27,8 @@ void RootView::resized(const boo::SWindowRect& root, const boo::SWindowRect&)
m_rootRect.location[0] = 0;
m_rootRect.location[1] = 0;
View::resized(m_rootRect, m_rootRect);
if (m_view)
m_view->resized(m_rootRect, m_rootRect);
for (View* v : m_views)
v->resized(m_rootRect, m_rootRect);
if (m_tooltip)
m_tooltip->resized(m_rootRect, m_rootRect);
m_resizeRTDirty = true;
@ -38,22 +38,25 @@ void RootView::mouseDown(const boo::SWindowCoord& coord, boo::EMouseButton butto
{
if (m_activeTextView && !m_activeTextView->subRect().coordInRect(coord))
setActiveTextView(nullptr);
if (m_view)
m_view->mouseDown(coord, button, mods);
for (View* v : m_views)
v->mouseDown(coord, button, mods);
}
void RootView::mouseUp(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mods)
{
if (m_view)
m_view->mouseUp(coord, button, mods);
for (View* v : m_views)
v->mouseUp(coord, button, mods);
}
void RootView::mouseMove(const boo::SWindowCoord& coord)
{
if (m_activeDragView)
m_activeDragView->mouseMove(coord);
else if (m_view)
m_view->mouseMove(coord);
else
{
for (View* v : m_views)
v->mouseMove(coord);
}
boo::SWindowRect ttrect = m_rootRect;
ttrect.location[0] = coord.pixel[0];
@ -70,44 +73,44 @@ void RootView::mouseMove(const boo::SWindowCoord& coord)
void RootView::mouseEnter(const boo::SWindowCoord& coord)
{
if (m_view)
m_view->mouseEnter(coord);
for (View* v : m_views)
v->mouseEnter(coord);
}
void RootView::mouseLeave(const boo::SWindowCoord& coord)
{
if (m_view)
m_view->mouseLeave(coord);
for (View* v : m_views)
v->mouseLeave(coord);
}
void RootView::scroll(const boo::SWindowCoord& coord, const boo::SScrollDelta& scroll)
{
if (m_view)
m_view->scroll(coord, scroll);
for (View* v : m_views)
v->scroll(coord, scroll);
}
void RootView::touchDown(const boo::STouchCoord& coord, uintptr_t tid)
{
if (m_view)
m_view->touchDown(coord, tid);
for (View* v : m_views)
v->touchDown(coord, tid);
}
void RootView::touchUp(const boo::STouchCoord& coord, uintptr_t tid)
{
if (m_view)
m_view->touchUp(coord, tid);
for (View* v : m_views)
v->touchUp(coord, tid);
}
void RootView::touchMove(const boo::STouchCoord& coord, uintptr_t tid)
{
if (m_view)
m_view->touchMove(coord, tid);
for (View* v : m_views)
v->touchMove(coord, tid);
}
void RootView::charKeyDown(unsigned long charCode, boo::EModifierKey mods, bool isRepeat)
{
if (m_view)
m_view->charKeyDown(charCode, mods, isRepeat);
for (View* v : m_views)
v->charKeyDown(charCode, mods, isRepeat);
if (m_activeTextView &&
(mods & (boo::EModifierKey::Ctrl|boo::EModifierKey::Command)) != boo::EModifierKey::None)
{
@ -122,8 +125,8 @@ void RootView::charKeyDown(unsigned long charCode, boo::EModifierKey mods, bool
void RootView::charKeyUp(unsigned long charCode, boo::EModifierKey mods)
{
if (m_view)
m_view->charKeyUp(charCode, mods);
for (View* v : m_views)
v->charKeyUp(charCode, mods);
}
void RootView::specialKeyDown(boo::ESpecialKey key, boo::EModifierKey mods, bool isRepeat)
@ -133,44 +136,36 @@ void RootView::specialKeyDown(boo::ESpecialKey key, boo::EModifierKey mods, bool
m_window->setFullscreen(!m_window->isFullscreen());
return;
}
if (m_view)
m_view->specialKeyDown(key, mods, isRepeat);
for (View* v : m_views)
v->specialKeyDown(key, mods, isRepeat);
if (m_activeTextView)
m_activeTextView->specialKeyDown(key, mods, isRepeat);
}
void RootView::specialKeyUp(boo::ESpecialKey key, boo::EModifierKey mods)
{
if (m_view)
m_view->specialKeyUp(key, mods);
for (View* v : m_views)
v->specialKeyUp(key, mods);
if (m_activeTextView)
m_activeTextView->specialKeyUp(key, mods);
}
void RootView::modKeyDown(boo::EModifierKey mod, bool isRepeat)
{
if (m_view)
m_view->modKeyDown(mod, isRepeat);
for (View* v : m_views)
v->modKeyDown(mod, isRepeat);
if (m_activeTextView)
m_activeTextView->modKeyDown(mod, isRepeat);
}
void RootView::modKeyUp(boo::EModifierKey mod)
{
if (m_view)
m_view->modKeyUp(mod);
for (View* v : m_views)
v->modKeyUp(mod);
if (m_activeTextView)
m_activeTextView->modKeyUp(mod);
}
View* RootView::setContentView(View* view)
{
View* ret = m_view;
m_view = view;
updateSize();
return ret;
}
void RootView::resetTooltip(ViewResources& res)
{
m_tooltip.reset(new Tooltip(res, *this, "Test", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi hendrerit nisl quis lobortis mattis. Mauris efficitur, est a vestibulum iaculis, leo orci pellentesque nunc, non rutrum ipsum lectus eget nisl. Aliquam accumsan vestibulum turpis. Duis id lacus ac lectus sollicitudin posuere vel sit amet metus. Aenean nec tortor id enim efficitur accumsan vitae eu ante. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce magna eros, lacinia a leo eget, volutpat rhoncus urna."));
@ -192,8 +187,8 @@ void RootView::draw(boo::IGraphicsCommandQueue* gfxQ)
gfxQ->setViewport(m_rootRect);
gfxQ->setScissor(m_rootRect);
View::draw(gfxQ);
if (m_view)
m_view->draw(gfxQ);
for (View* v : m_views)
v->draw(gfxQ);
if (m_tooltip)
m_tooltip->draw(gfxQ);
gfxQ->resolveDisplay(m_renderTex);

View File

@ -10,10 +10,8 @@ Locale::Locale(const std::string& name, const std::string& fullName,
: m_name(name), m_fullName(fullName)
{
Athena::io::YAMLDocReader reader;
yaml_parser_t parser;
yaml_parser_initialize(&parser);
yaml_parser_set_input_string(&parser, yamlSource, yamlLength);
reader.read(&parser);
yaml_parser_set_input_string(reader.getParser(), yamlSource, yamlLength);
reader.parse();
m_rootNode = std::move(reader.releaseRootNode());
m_langNode = m_rootNode->findMapChild(name.c_str());
if (!m_langNode)