From 729cb06f85e2888a7ac1e72375380257936106c9 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Thu, 7 Nov 2013 14:33:01 +0200 Subject: [PATCH] Fix some more inefficient autosizes --- source/dropdown.cpp | 4 ++-- source/entry.cpp | 14 ++++++++------ source/layout.cpp | 3 +-- source/list.cpp | 4 ++-- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/source/dropdown.cpp b/source/dropdown.cpp index 013e1d9..84f6af3 100644 --- a/source/dropdown.cpp +++ b/source/dropdown.cpp @@ -121,8 +121,8 @@ void Dropdown::list_autosize_changed() void Dropdown::resize_list() { - list.autosize(); - Geometry lgeom = list.get_geometry(); + Geometry lgeom; + list.autosize(lgeom); lgeom.x = 0; lgeom.y = -lgeom.h; lgeom.w = max(geom.w, lgeom.w); diff --git a/source/entry.cpp b/source/entry.cpp index 1198bde..44a169a 100644 --- a/source/entry.cpp +++ b/source/entry.cpp @@ -51,11 +51,12 @@ void Entry::autosize_special(const Part &part, Geometry &ageom) const Geometry sgeom = part.get_geometry(); if(!sgeom.w || !sgeom.h) { - slider->autosize(); + Geometry wgeom; + slider->autosize(wgeom); if(!sgeom.w) - sgeom.w = slider->get_geometry().w; + sgeom.w = wgeom.w; if(!sgeom.h) - sgeom.h = slider->get_geometry().h; + sgeom.h = wgeom.h; } const Sides &margin = part.get_margin(); @@ -237,11 +238,12 @@ void Entry::reposition_slider() Geometry sgeom = slider_part->get_geometry(); if(!sgeom.w || !sgeom.h) { - slider->autosize(); + Geometry wgeom; + slider->autosize(wgeom); if(!sgeom.w) - sgeom.w = slider->get_geometry().w; + sgeom.w = wgeom.w; if(!sgeom.h) - sgeom.h = slider->get_geometry().h; + sgeom.h = wgeom.h; } slider_part->get_alignment().apply(sgeom, geom, slider_part->get_margin()); diff --git a/source/layout.cpp b/source/layout.cpp index b8d8fb7..5df7bc1 100644 --- a/source/layout.cpp +++ b/source/layout.cpp @@ -475,8 +475,7 @@ Layout::Slot::Slot(Layout &l, Widget &w): vert_pack.gravity = 1; widget.signal_autosize_changed.connect(sigc::mem_fun(this, &Slot::autosize_changed)); widget.signal_visibility_changed.connect(sigc::mem_fun(this, &Slot::visibility_changed)); - widget.autosize(); - autosize_geom = widget.get_geometry(); + widget.autosize(autosize_geom); } void Layout::Slot::autosize_changed() diff --git a/source/list.cpp b/source/list.cpp index c5dddf5..a4550c4 100644 --- a/source/list.cpp +++ b/source/list.cpp @@ -121,7 +121,6 @@ List::Item *List::create_item(unsigned index) else item = new BasicItem(data->get_string(index)); add(*item); - item->autosize(); item->signal_autosize_changed.connect(sigc::mem_fun(this, &List::item_autosize_changed)); return item; } @@ -352,7 +351,8 @@ void List::Item::autosize_special(const Part &part, Geometry &ageom) const const Sides &margin = part.get_margin(); for(list::const_iterator i=children.begin(); i!=children.end(); ++i) { - const Geometry &cgeom = (*i)->widget->get_geometry(); + Geometry cgeom; + (*i)->widget->autosize(cgeom); ageom.w = max(ageom.w, cgeom.x+cgeom.w+margin.right); ageom.h = max(ageom.h, cgeom.y+cgeom.h+margin.top); } -- 2.45.2