mirror of https://github.com/AxioDL/metaforce.git
Removed resetResources method (global reconstruction preferred)
This commit is contained in:
parent
f4c0903eee
commit
d58d8c2391
|
@ -44,7 +44,6 @@ public:
|
|||
void mouseEnter(const boo::SWindowCoord&);
|
||||
void mouseLeave(const boo::SWindowCoord&);
|
||||
void resized(const boo::SWindowRect& rootView, const boo::SWindowRect& sub);
|
||||
void resetResources(ViewResources& res);
|
||||
void draw(boo::IGraphicsCommandQueue* gfxQ);
|
||||
|
||||
void setText(const std::string& text);
|
||||
|
|
|
@ -43,7 +43,6 @@ public:
|
|||
void mouseEnter(const boo::SWindowCoord&);
|
||||
void mouseLeave(const boo::SWindowCoord&);
|
||||
void resized(const boo::SWindowRect& rootView, const boo::SWindowRect& sub);
|
||||
void resetResources(ViewResources& res);
|
||||
void draw(boo::IGraphicsCommandQueue* gfxQ);
|
||||
|
||||
void setText(const std::string& text);
|
||||
|
|
|
@ -54,7 +54,6 @@ public:
|
|||
void modKeyDown(boo::EModifierKey mod, bool isRepeat);
|
||||
void modKeyUp(boo::EModifierKey mod);
|
||||
|
||||
void resetResources(ViewResources& res);
|
||||
void dispatchEvents() {m_events.dispatchEvents();}
|
||||
void draw(boo::IGraphicsCommandQueue* gfxQ);
|
||||
const boo::SWindowRect& rootRect() const {return m_rootRect;}
|
||||
|
|
|
@ -26,7 +26,6 @@ public:
|
|||
void mouseEnter(const boo::SWindowCoord&);
|
||||
void mouseLeave(const boo::SWindowCoord&);
|
||||
void resized(const boo::SWindowRect& rootView, const boo::SWindowRect& sub);
|
||||
void resetResources(ViewResources& res);
|
||||
void draw(boo::IGraphicsCommandQueue* gfxQ);
|
||||
};
|
||||
|
||||
|
|
|
@ -81,7 +81,6 @@ public:
|
|||
void mouseEnter(const boo::SWindowCoord&);
|
||||
void mouseLeave(const boo::SWindowCoord&);
|
||||
void resized(const boo::SWindowRect& rootView, const boo::SWindowRect& sub);
|
||||
void resetResources(ViewResources& res);
|
||||
void draw(boo::IGraphicsCommandQueue* gfxQ);
|
||||
};
|
||||
|
||||
|
|
|
@ -101,7 +101,6 @@ public:
|
|||
void mouseEnter(const boo::SWindowCoord&);
|
||||
void mouseLeave(const boo::SWindowCoord&coord);
|
||||
void resized(const boo::SWindowRect& rootView, const boo::SWindowRect& sub);
|
||||
void resetResources(ViewResources& res);
|
||||
void draw(boo::IGraphicsCommandQueue* gfxQ);
|
||||
|
||||
int nominalHeight() const {return m_nomHeight;}
|
||||
|
|
|
@ -32,7 +32,6 @@ public:
|
|||
Tooltip(ViewResources& res, View& parentView, const std::string& title,
|
||||
const std::string& message);
|
||||
void resized(const boo::SWindowRect& rootView, const boo::SWindowRect& sub);
|
||||
void resetResources(ViewResources& res);
|
||||
void draw(boo::IGraphicsCommandQueue* gfxQ);
|
||||
|
||||
int nominalWidth() const {return m_nomWidth;}
|
||||
|
|
|
@ -125,7 +125,6 @@ public:
|
|||
virtual void mouseEnter(const boo::SWindowCoord&) {}
|
||||
virtual void mouseLeave(const boo::SWindowCoord&) {}
|
||||
virtual void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub);
|
||||
virtual void resetResources(ViewResources& res) {}
|
||||
virtual void draw(boo::IGraphicsCommandQueue* gfxQ);
|
||||
};
|
||||
|
||||
|
|
|
@ -41,7 +41,17 @@ Button::Button(ViewResources& res, View& parentView,
|
|||
}
|
||||
|
||||
commitResources(res);
|
||||
resetResources(res);
|
||||
|
||||
m_text.reset(new TextView(res, *this, res.m_mainFont));
|
||||
setText(m_textStr);
|
||||
m_verts[0].m_color = res.themeData().button1Inactive();
|
||||
m_verts[1].m_color = res.themeData().button2Inactive();
|
||||
m_verts[2].m_color = res.themeData().button1Inactive();
|
||||
m_verts[3].m_color = res.themeData().button2Inactive();
|
||||
m_verts[4].m_color = res.themeData().button2Inactive();
|
||||
for (int i=5 ; i<28 ; ++i)
|
||||
m_verts[i].m_color = res.themeData().button2Inactive();
|
||||
m_bVertsBuf->load(m_verts, sizeof(SolidShaderVert) * 28);
|
||||
}
|
||||
|
||||
void Button::setText(const std::string& text)
|
||||
|
@ -170,20 +180,6 @@ void Button::mouseLeave(const boo::SWindowCoord& coord)
|
|||
setInactive();
|
||||
}
|
||||
|
||||
void Button::resetResources(ViewResources& res)
|
||||
{
|
||||
m_text.reset(new TextView(res, *this, res.m_mainFont));
|
||||
setText(m_textStr);
|
||||
m_verts[0].m_color = res.themeData().button1Inactive();
|
||||
m_verts[1].m_color = res.themeData().button2Inactive();
|
||||
m_verts[2].m_color = res.themeData().button1Inactive();
|
||||
m_verts[3].m_color = res.themeData().button2Inactive();
|
||||
m_verts[4].m_color = res.themeData().button2Inactive();
|
||||
for (int i=5 ; i<28 ; ++i)
|
||||
m_verts[i].m_color = res.themeData().button2Inactive();
|
||||
m_bVertsBuf->load(m_verts, sizeof(SolidShaderVert) * 28);
|
||||
}
|
||||
|
||||
void Button::resized(const boo::SWindowRect& root, const boo::SWindowRect& sub)
|
||||
{
|
||||
View::resized(root, sub);
|
||||
|
|
|
@ -64,7 +64,7 @@ std::string MultiLineTextView::LineWrap(const std::string& str, int wrap)
|
|||
lastSpaceRem = rem - 1;
|
||||
rollbackPos = ret.size() + 1;
|
||||
}
|
||||
for (size_t i=0 ; i<sz ; ++i)
|
||||
for (utf8proc_ssize_t i=0 ; i<sz ; ++i)
|
||||
ret += it[i];
|
||||
lCh = glyph->m_glyphIdx;
|
||||
rem -= sz;
|
||||
|
|
|
@ -122,15 +122,6 @@ void RootView::modKeyUp(boo::EModifierKey mod)
|
|||
{
|
||||
}
|
||||
|
||||
void RootView::resetResources(ViewResources& res)
|
||||
{
|
||||
m_viewRes = &res;
|
||||
if (m_view)
|
||||
m_view->resetResources(res);
|
||||
if (m_tooltip)
|
||||
m_tooltip->resetResources(res);
|
||||
}
|
||||
|
||||
void RootView::setContentView(std::unique_ptr<View>&& view)
|
||||
{
|
||||
m_view = std::move(view);
|
||||
|
|
|
@ -114,13 +114,6 @@ void Space::mouseLeave(const boo::SWindowCoord& coord)
|
|||
}
|
||||
}
|
||||
|
||||
void Space::resetResources(ViewResources& res)
|
||||
{
|
||||
if (m_contentView)
|
||||
m_contentView->resetResources(res);
|
||||
m_toolbar->resetResources(res);
|
||||
}
|
||||
|
||||
void Space::resized(const boo::SWindowRect& root, const boo::SWindowRect& sub)
|
||||
{
|
||||
View::resized(root, sub);
|
||||
|
|
|
@ -213,14 +213,6 @@ void SplitView::mouseLeave(const boo::SWindowCoord& coord)
|
|||
}
|
||||
}
|
||||
|
||||
void SplitView::resetResources(ViewResources& res)
|
||||
{
|
||||
if (m_views[0].m_view)
|
||||
m_views[0].m_view->resetResources(res);
|
||||
if (m_views[1].m_view)
|
||||
m_views[1].m_view->resetResources(res);
|
||||
}
|
||||
|
||||
void SplitView::resized(const boo::SWindowRect& root, const boo::SWindowRect& sub)
|
||||
{
|
||||
View::resized(root, sub);
|
||||
|
|
|
@ -138,16 +138,6 @@ void Toolbar::mouseLeave(const boo::SWindowCoord& coord)
|
|||
}
|
||||
}
|
||||
|
||||
void Toolbar::resetResources(ViewResources& res)
|
||||
{
|
||||
m_nomHeight = res.pixelFactor() * TOOLBAR_GAUGE;
|
||||
m_padding = res.pixelFactor() * TOOLBAR_PADDING;
|
||||
setBackground(res.themeData().toolbarBackground());
|
||||
updateSize();
|
||||
for (Child& c : m_children)
|
||||
c.m_view->resetResources(res);
|
||||
}
|
||||
|
||||
void Toolbar::resized(const boo::SWindowRect& root, const boo::SWindowRect& sub)
|
||||
{
|
||||
View::resized(root, sub);
|
||||
|
|
|
@ -41,7 +41,32 @@ Tooltip::Tooltip(ViewResources& res, View& parentView, const std::string& title,
|
|||
m_ttVerts[i].m_color = res.themeData().tooltipBackground();
|
||||
|
||||
commitResources(res);
|
||||
resetResources(res);
|
||||
|
||||
for (int i=0 ; i<4 ; ++i)
|
||||
{
|
||||
m_cornersOutline[i].reset(new TextView(res, *this, res.m_curveFont, 1));
|
||||
m_cornersFilled[i].reset(new TextView(res, *this, res.m_curveFont, 1));
|
||||
}
|
||||
m_cornersOutline[0]->typesetGlyphs(L"\xF4F0");
|
||||
m_cornersFilled[0]->typesetGlyphs(L"\xF4F1", res.themeData().tooltipBackground());
|
||||
m_cornersOutline[1]->typesetGlyphs(L"\xF4F2");
|
||||
m_cornersFilled[1]->typesetGlyphs(L"\xF4F3", res.themeData().tooltipBackground());
|
||||
m_cornersOutline[2]->typesetGlyphs(L"\xF4F4");
|
||||
m_cornersFilled[2]->typesetGlyphs(L"\xF4F5", res.themeData().tooltipBackground());
|
||||
m_cornersOutline[3]->typesetGlyphs(L"\xF4F6");
|
||||
m_cornersFilled[3]->typesetGlyphs(L"\xF4F7", res.themeData().tooltipBackground());
|
||||
|
||||
m_title.reset(new TextView(res, *this, res.m_heading14));
|
||||
m_title->typesetGlyphs(m_titleStr);
|
||||
m_message.reset(new MultiLineTextView(res, *this, res.m_mainFont));
|
||||
m_message->typesetGlyphs(m_messageStr, Zeus::CColor::skWhite,
|
||||
int(TOOLTIP_MAX_TEXT_WIDTH * res.pixelFactor()));
|
||||
|
||||
float pf = res.pixelFactor();
|
||||
std::pair<int,int> margin = m_cornersOutline[0]->queryGlyphDimensions(0);
|
||||
m_nomWidth = std::min(int(TOOLTIP_MAX_WIDTH * pf),
|
||||
int(std::max(m_title->nominalWidth(), m_message->nominalWidth()) + margin.first * 2));
|
||||
m_nomHeight = m_title->nominalHeight() + m_message->nominalHeight() + margin.second * 3;
|
||||
}
|
||||
|
||||
void Tooltip::setVerts(int width, int height, float pf)
|
||||
|
@ -105,35 +130,6 @@ void Tooltip::resized(const boo::SWindowRect& root, const boo::SWindowRect& sub)
|
|||
m_cornersFilled[3]->resized(root, cornerRect);
|
||||
}
|
||||
|
||||
void Tooltip::resetResources(ViewResources& res)
|
||||
{
|
||||
for (int i=0 ; i<4 ; ++i)
|
||||
{
|
||||
m_cornersOutline[i].reset(new TextView(res, *this, res.m_curveFont, 1));
|
||||
m_cornersFilled[i].reset(new TextView(res, *this, res.m_curveFont, 1));
|
||||
}
|
||||
m_cornersOutline[0]->typesetGlyphs(L"\xF4F0");
|
||||
m_cornersFilled[0]->typesetGlyphs(L"\xF4F1", res.themeData().tooltipBackground());
|
||||
m_cornersOutline[1]->typesetGlyphs(L"\xF4F2");
|
||||
m_cornersFilled[1]->typesetGlyphs(L"\xF4F3", res.themeData().tooltipBackground());
|
||||
m_cornersOutline[2]->typesetGlyphs(L"\xF4F4");
|
||||
m_cornersFilled[2]->typesetGlyphs(L"\xF4F5", res.themeData().tooltipBackground());
|
||||
m_cornersOutline[3]->typesetGlyphs(L"\xF4F6");
|
||||
m_cornersFilled[3]->typesetGlyphs(L"\xF4F7", res.themeData().tooltipBackground());
|
||||
|
||||
m_title.reset(new TextView(res, *this, res.m_heading14));
|
||||
m_title->typesetGlyphs(m_titleStr);
|
||||
m_message.reset(new MultiLineTextView(res, *this, res.m_mainFont));
|
||||
m_message->typesetGlyphs(m_messageStr, Zeus::CColor::skWhite,
|
||||
int(TOOLTIP_MAX_TEXT_WIDTH * res.pixelFactor()));
|
||||
|
||||
float pf = res.pixelFactor();
|
||||
std::pair<int,int> margin = m_cornersOutline[0]->queryGlyphDimensions(0);
|
||||
m_nomWidth = std::min(int(TOOLTIP_MAX_WIDTH * pf),
|
||||
int(std::max(m_title->nominalWidth(), m_message->nominalWidth()) + margin.first * 2));
|
||||
m_nomHeight = m_title->nominalHeight() + m_message->nominalHeight() + margin.second * 3;
|
||||
}
|
||||
|
||||
void Tooltip::draw(boo::IGraphicsCommandQueue* gfxQ)
|
||||
{
|
||||
gfxQ->setShaderDataBinding(m_ttShaderBinding);
|
||||
|
|
Loading…
Reference in New Issue