diff --git a/specter/include/Specter/Button.hpp b/specter/include/Specter/Button.hpp index ce53675d9..66edca3e1 100644 --- a/specter/include/Specter/Button.hpp +++ b/specter/include/Specter/Button.hpp @@ -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); diff --git a/specter/include/Specter/NumericField.hpp b/specter/include/Specter/NumericField.hpp index 44bad77f2..2b1703da6 100644 --- a/specter/include/Specter/NumericField.hpp +++ b/specter/include/Specter/NumericField.hpp @@ -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); diff --git a/specter/include/Specter/RootView.hpp b/specter/include/Specter/RootView.hpp index cb94bb82f..8ecbf1a12 100644 --- a/specter/include/Specter/RootView.hpp +++ b/specter/include/Specter/RootView.hpp @@ -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;} diff --git a/specter/include/Specter/Space.hpp b/specter/include/Specter/Space.hpp index b377b1b44..06f406654 100644 --- a/specter/include/Specter/Space.hpp +++ b/specter/include/Specter/Space.hpp @@ -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); }; diff --git a/specter/include/Specter/SplitView.hpp b/specter/include/Specter/SplitView.hpp index a13747cfe..ef75d4019 100644 --- a/specter/include/Specter/SplitView.hpp +++ b/specter/include/Specter/SplitView.hpp @@ -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); }; diff --git a/specter/include/Specter/Toolbar.hpp b/specter/include/Specter/Toolbar.hpp index cf581f0bd..8cbe2f4b1 100644 --- a/specter/include/Specter/Toolbar.hpp +++ b/specter/include/Specter/Toolbar.hpp @@ -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;} diff --git a/specter/include/Specter/Tooltip.hpp b/specter/include/Specter/Tooltip.hpp index 3f4ec25e1..ccaefeb31 100644 --- a/specter/include/Specter/Tooltip.hpp +++ b/specter/include/Specter/Tooltip.hpp @@ -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;} diff --git a/specter/include/Specter/View.hpp b/specter/include/Specter/View.hpp index 0272527b3..3fe763b9b 100644 --- a/specter/include/Specter/View.hpp +++ b/specter/include/Specter/View.hpp @@ -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); }; diff --git a/specter/lib/Button.cpp b/specter/lib/Button.cpp index b2976c279..07bd6d91c 100644 --- a/specter/lib/Button.cpp +++ b/specter/lib/Button.cpp @@ -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); diff --git a/specter/lib/MultiLineTextView.cpp b/specter/lib/MultiLineTextView.cpp index 40ae51f74..44590a5f6 100644 --- a/specter/lib/MultiLineTextView.cpp +++ b/specter/lib/MultiLineTextView.cpp @@ -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 ; im_glyphIdx; rem -= sz; diff --git a/specter/lib/RootView.cpp b/specter/lib/RootView.cpp index 276ec628a..89c9b0e6e 100644 --- a/specter/lib/RootView.cpp +++ b/specter/lib/RootView.cpp @@ -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) { m_view = std::move(view); diff --git a/specter/lib/Space.cpp b/specter/lib/Space.cpp index b2ff221a8..63c9afa85 100644 --- a/specter/lib/Space.cpp +++ b/specter/lib/Space.cpp @@ -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); diff --git a/specter/lib/SplitView.cpp b/specter/lib/SplitView.cpp index 52a4b5293..b6a1d6962 100644 --- a/specter/lib/SplitView.cpp +++ b/specter/lib/SplitView.cpp @@ -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); diff --git a/specter/lib/Toolbar.cpp b/specter/lib/Toolbar.cpp index 2a456a857..f43285bfa 100644 --- a/specter/lib/Toolbar.cpp +++ b/specter/lib/Toolbar.cpp @@ -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); diff --git a/specter/lib/Tooltip.cpp b/specter/lib/Tooltip.cpp index 648954b0c..f1cc53844 100644 --- a/specter/lib/Tooltip.cpp +++ b/specter/lib/Tooltip.cpp @@ -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 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 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);