Fix the language dialog.

The 'fix' is bit ugly and needs a proper fix later on.
This commit is contained in:
Mark de Wever 2008-10-29 20:07:22 +00:00
parent 9c0ba526dd
commit f2d3cef13f
3 changed files with 29 additions and 2 deletions

View file

@ -27,6 +27,8 @@
namespace gui2 {
bool disable_cache = false;
tgrid::tgrid(const unsigned rows, const unsigned cols) :
rows_(rows),
cols_(cols),
@ -726,14 +728,19 @@ tpoint tgrid::tchild::get_best_size() const
<< ".\n";
return border_space();
}
#if DISABLE_CACHE
#if 0 // HACK
#if disable_cache
if(true) {
#else
if(widget_->is_dirty() || best_size_ == tpoint(0, 0)) {
#endif
best_size_ = widget_->get_best_size() + border_space();
}
#else
if(disable_cache || widget_->is_dirty() || best_size_ == tpoint(0, 0)) {
best_size_ = widget_->get_best_size() + border_space();
}
#endif // HACK
DBG_G_L << "tgrid::tchild:"
<< " has widget " << true
@ -978,10 +985,18 @@ tpoint tgrid::get_size(const std::string& id, std::vector<unsigned>& width,
tpoint (tchild::*size_proc_max)(const tpoint&) const,
const tpoint& maximum_size) const
{
#if 0 // HACK
#if DISABLE_CACHE
height.clear();
width.clear();
#endif
#else
if(disable_cache) {
height.clear();
width.clear();
}
#endif // HACK
if(height.empty() || width.empty() || maximum_size != tpoint(0, 0)) {
DBG_G_L << "tgrid: calculate " << id << " size.\n";

View file

@ -22,6 +22,15 @@
namespace gui2 {
/**
* Helper variable for the layout system.
*
* @todo This is a kind of hack to make the layout engine work properly.
* Wrapping needs the cache disabled but the scrollbars need it enabled.
* But the entire layout code needs a review and probably a rewrite...
*/
extern bool disable_cache;
/**
* Base container class.
*

View file

@ -375,6 +375,7 @@ void twindow::layout()
// Too wide and we can wrap, try that.
if(static_cast<size_t>(size.x) > settings::screen_width && can_wrap()) {
DBG_G_L << "twindow " << __func__ << ": start wrapping.\n";
disable_cache = true;
if(set_width_constrain(settings::screen_width
- conf->left_border - conf->right_border)) {
@ -383,6 +384,7 @@ void twindow::layout()
<< ": After wrapping : " << size << ".\n";
} else {
DBG_G_L << "twindow " << __func__ << ": wrapping failed.\n";
disable_cache = false;
}
}
@ -444,6 +446,7 @@ void twindow::layout()
// Make sure the contrains are cleared, they might be partially set.
clear_width_constrain();
disable_cache = false;
need_layout_ = false;
}