diff options
| author | Brandon Schaefer <brandontschaefer@gmail.com> | 2014-03-07 13:56:50 -0800 |
|---|---|---|
| committer | Brandon Schaefer <brandontschaefer@gmail.com> | 2014-03-07 13:56:50 -0800 |
| commit | 5d251352b3ba8c99b7f409976100ef6f80368783 (patch) | |
| tree | f9cafbfbcbb9bd543ad787db0e154859e7042f01 | |
| parent | faba196553dbdf5bb9d546031d05f8f1af846259 (diff) | |
| parent | 91169f8854ade95264589ee0ea15d488bf3c2a4c (diff) | |
* Reload the icons when the scale changes.
* Fixed bug in PlaceGroup where the space layout was not scaling correctly. (bzr r3680.8.6)
| -rwxr-xr-x | dash/PlacesGroup.cpp | 13 | ||||
| -rw-r--r-- | dash/PlacesGroup.h | 1 | ||||
| -rw-r--r-- | dash/ResultRenderer.h | 2 | ||||
| -rw-r--r-- | dash/ResultRendererHorizontalTile.cpp | 20 | ||||
| -rw-r--r-- | dash/ResultRendererHorizontalTile.h | 4 | ||||
| -rw-r--r-- | dash/ResultRendererTile.cpp | 11 | ||||
| -rw-r--r-- | dash/ResultRendererTile.h | 1 | ||||
| -rw-r--r-- | dash/ResultView.cpp | 9 | ||||
| -rw-r--r-- | dash/ResultViewGrid.cpp | 7 | ||||
| -rw-r--r-- | dash/ResultViewGrid.h | 2 | ||||
| -rw-r--r-- | dash/ScopeBar.cpp | 7 | ||||
| -rwxr-xr-x | dash/ScopeView.cpp | 2 |
12 files changed, 64 insertions, 15 deletions
diff --git a/dash/PlacesGroup.cpp b/dash/PlacesGroup.cpp index 1f18132ff..414b07e0d 100755 --- a/dash/PlacesGroup.cpp +++ b/dash/PlacesGroup.cpp @@ -151,15 +151,13 @@ PlacesGroup::PlacesGroup(dash::StyleInterface& style) _group_layout = new nux::VLayout("", NUX_TRACKER_LOCATION); - // FIXME, we'll have to figure out how to move this so we can update this with the DPI - RawPixel const group_top = style.GetPlacesGroupTopSpace(); - int top_space = group_top.CP(_scale); - _group_layout->AddLayout(new nux::SpaceLayout(top_space, top_space, top_space, top_space), 0); + // Spacelayout size is updated in UpdatePlacesGroupSize + _space_layout = new nux::SpaceLayout(0, 0, 0, 0); + _group_layout->AddLayout(_space_layout, 0); _header_view = new HeaderView(NUX_TRACKER_LOCATION); _group_layout->AddView(_header_view, 0, nux::MINOR_POSITION_START, nux::MINOR_SIZE_FULL); - // FIXME I might need to move this to Scale when we increase the DashIcon size _header_layout = new nux::HLayout(NUX_TRACKER_LOCATION); _header_layout->SetLeftAndRightPadding(_style.GetCategoryHeaderLeftPadding(), 0); _header_view->SetLayout(_header_layout); @@ -225,6 +223,11 @@ void PlacesGroup::UpdatePlacesGroupSize() { RawPixel const icon_size = _style.GetCategoryIconSize(); + RawPixel const group_top = _style.GetPlacesGroupTopSpace(); + + int top_space = group_top.CP(_scale); + _space_layout->SetMinimumSize(top_space, top_space); + _space_layout->SetMaximumSize(top_space, top_space); _header_layout->SetSpaceBetweenChildren(SPACE_BETWEEN_CHILDREN.CP(_scale)); diff --git a/dash/PlacesGroup.h b/dash/PlacesGroup.h index 91024c552..536be4fc1 100644 --- a/dash/PlacesGroup.h +++ b/dash/PlacesGroup.h @@ -138,6 +138,7 @@ private: nux::HLayout* _expand_label_layout; nux::HLayout* _expand_layout; nux::VLayout* _child_layout; + nux::SpaceLayout* _space_layout; dash::ResultView* _child_view; std::unique_ptr<nux::AbstractPaintLayer> _focus_layer; diff --git a/dash/ResultRenderer.h b/dash/ResultRenderer.h index fbdada730..b53ad5398 100644 --- a/dash/ResultRenderer.h +++ b/dash/ResultRenderer.h @@ -65,6 +65,8 @@ public: // unload any previous grabbed images virtual void Unload(Result const& row); + virtual void ReloadResult(Result const& row) {} + // get a image to drag virtual nux::NBitmapData* GetDndImage(Result const& row) const; diff --git a/dash/ResultRendererHorizontalTile.cpp b/dash/ResultRendererHorizontalTile.cpp index 59be04d76..b603f7912 100644 --- a/dash/ResultRendererHorizontalTile.cpp +++ b/dash/ResultRendererHorizontalTile.cpp @@ -89,6 +89,17 @@ NUX_IMPLEMENT_OBJECT_TYPE(ResultRendererHorizontalTile); ResultRendererHorizontalTile::ResultRendererHorizontalTile(NUX_FILE_LINE_DECL) : ResultRendererTile(NUX_FILE_LINE_PARAM) { + ReloadTextures(); +} + +void ResultRendererHorizontalTile::UpdateScale(double scale) +{ + ResultRenderer::UpdateScale(scale); + ReloadTextures(); +} + +void ResultRendererHorizontalTile::ReloadTextures() +{ width = CARD_VIEW_WIDTH.CP(scale_); height = CARD_VIEW_HEIGHT.CP(scale_); @@ -96,12 +107,13 @@ ResultRendererHorizontalTile::ResultRendererHorizontalTile(NUX_FILE_LINE_DECL) // try and get a texture from the texture cache TextureCache& cache = TextureCache::GetDefault(); prelight_cache_ = cache.FindTexture("ResultRendererHorizontalTile.PreLightTexture", - CARD_VIEW_WIDTH.CP(scale_), - CARD_VIEW_HEIGHT.CP(scale_), + width, + height, sigc::mem_fun(this, &ResultRendererHorizontalTile::DrawHighlight)); + normal_cache_ = cache.FindTexture("ResultRendererHorizontalTile.NormalTexture", - CARD_VIEW_WIDTH.CP(scale_), - CARD_VIEW_HEIGHT.CP(scale_), + width, + height, sigc::mem_fun(this, &ResultRendererHorizontalTile::DrawNormal)); } diff --git a/dash/ResultRendererHorizontalTile.h b/dash/ResultRendererHorizontalTile.h index 2b9544d0c..1fdf2e259 100644 --- a/dash/ResultRendererHorizontalTile.h +++ b/dash/ResultRendererHorizontalTile.h @@ -51,10 +51,14 @@ public: virtual nux::NBitmapData* GetDndImage(Result const& row) const; + void UpdateScale(double scale); + protected: virtual void LoadText(Result const& row); private: + void ReloadTextures(); + nux::BaseTexture* DrawHighlight(std::string const& texid, int width, int height); nux::BaseTexture* DrawNormal(std::string const& texid, diff --git a/dash/ResultRendererTile.cpp b/dash/ResultRendererTile.cpp index 5e2fc4305..5075565df 100644 --- a/dash/ResultRendererTile.cpp +++ b/dash/ResultRendererTile.cpp @@ -238,6 +238,17 @@ void ResultRendererTile::Preload(Result const& row) } } +void ResultRendererTile::ReloadResult(Result const& row) +{ + Unload(row); + + if (row.renderer<TextureContainer*>() == nullptr) + const_cast<Result&>(row).set_renderer(new TextureContainer()); + + LoadIcon(row); + LoadText(row); +} + void ResultRendererTile::Unload(Result const& row) { TextureContainer *container = row.renderer<TextureContainer*>(); diff --git a/dash/ResultRendererTile.h b/dash/ResultRendererTile.h index 32fb5969c..5c41c1419 100644 --- a/dash/ResultRendererTile.h +++ b/dash/ResultRendererTile.h @@ -75,6 +75,7 @@ public: virtual nux::NBitmapData* GetDndImage(Result const& row) const; + void ReloadResult(Result const& row); void UpdateScale(double scale) override; int Padding() const; diff --git a/dash/ResultView.cpp b/dash/ResultView.cpp index c6ffa4a7b..d0b9cd193 100644 --- a/dash/ResultView.cpp +++ b/dash/ResultView.cpp @@ -86,7 +86,16 @@ void ResultView::UpdateScale(double scale) scale_ = scale; if (renderer_) + { renderer_->UpdateScale(scale_); + + for (auto it = result_model_->begin(); it != result_model_->end(); ++it) + { + renderer_->ReloadResult(*it); + } + + NeedRedraw(); + } } } diff --git a/dash/ResultViewGrid.cpp b/dash/ResultViewGrid.cpp index ca9b571ab..ffe47d12f 100644 --- a/dash/ResultViewGrid.cpp +++ b/dash/ResultViewGrid.cpp @@ -1011,6 +1011,13 @@ ResultViewGrid::SetSelectedIndex(int index) } void +ResultViewGrid::UpdateScale(double scale) +{ + ResultView::UpdateScale(scale); + UpdateRenderTextures(); +} + +void ResultViewGrid::UpdateRenderTextures() { nux::Geometry root_geo(GetAbsoluteGeometry()); diff --git a/dash/ResultViewGrid.h b/dash/ResultViewGrid.h index bba997c0d..c039c2337 100644 --- a/dash/ResultViewGrid.h +++ b/dash/ResultViewGrid.h @@ -60,6 +60,8 @@ public: virtual void GetResultDimensions(int& rows, int& columns); + void UpdateScale(double scale); + protected: void MouseMove(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags); void MouseClick(int x, int y, unsigned long button_flags, unsigned long key_flags); diff --git a/dash/ScopeBar.cpp b/dash/ScopeBar.cpp index 1d09f3d96..13ab67bc6 100644 --- a/dash/ScopeBar.cpp +++ b/dash/ScopeBar.cpp @@ -39,8 +39,8 @@ namespace { // according to Q design the inner area of the scopebar should be 40px // (without any borders) -RawPixel const SCOPEBAR_HEIGHT = 41; -RawPixel const TRIANGLE_SIZE = 5; +RawPixel const SCOPEBAR_HEIGHT = 41_em; +RawPixel const TRIANGLE_SIZE = 5_em; } @@ -56,9 +56,6 @@ ScopeBar::ScopeBar() ScopeBar::~ScopeBar() { - // If you store pointers in an STL, you've got to manually clean them up! - for (unsigned i = 0; i < icons_.size(); ++i) - delete icons_[i]; } void ScopeBar::SetupBackground() diff --git a/dash/ScopeView.cpp b/dash/ScopeView.cpp index f32589c02..9e5a7994c 100755 --- a/dash/ScopeView.cpp +++ b/dash/ScopeView.cpp @@ -297,7 +297,7 @@ void ScopeView::UpdateScale(double scale) UpdateScopeViewSize(); - for (auto const group : category_views_) + for (auto& group : category_views_) { group->UpdateScale(scale_); } |
