fix the dim.y re-calculation for very large dialogs

This commit is contained in:
Patrick Parker 2007-06-23 03:13:24 +00:00
parent 53aed7fe6f
commit d775eda87c
3 changed files with 6 additions and 8 deletions

View file

@ -539,9 +539,10 @@ dialog::dimension_measurements dialog::layout(int xloc, int yloc)
}
}
const int frame_top_pad = get_frame().top_padding();
const int frame_bottom_pad = get_frame().bottom_padding();
if(dim.y + dim.interior.h + frame_bottom_pad > scr->h) {
dim.y = scr->h - dim.interior.h - frame_bottom_pad;
dim.y = maximum<int>(frame_top_pad, scr->h - dim.interior.h - frame_bottom_pad);
if(dim.y < dim.interior.y) {
dim.interior.y = dim.y;
}
@ -555,14 +556,11 @@ dialog::dimension_measurements dialog::layout(int xloc, int yloc)
//try to rein in the menu height a little bit
const int menu_height = menu_->height();
if(menu_height > 0) {
dim.menu_height = maximum<int>(0, max_height - dim.interior.h + menu_height);
dim.menu_height = maximum<int>(1, max_height - dim.interior.h + menu_height);
dim.interior.h -= menu_height - dim.menu_height;
}
}
dim.message.x = dim.x + image_width + left_padding + image_h_padding;
dim.message.y = dim.y + top_padding + caption_height;
//calculate the positions of the preview panes to the sides of the dialog
if(!preview_panes_.empty()) {

View file

@ -116,7 +116,7 @@ dialog_frame::dimension_measurements dialog_frame::layout(SDL_Rect const& rect)
return layout(rect.x, rect.y, rect.w, rect.h);
}
/*int dialog_frame::top_padding() const {
int dialog_frame::top_padding() const {
int padding = 0;
if(have_border_) {
padding += top_->h;
@ -125,7 +125,7 @@ dialog_frame::dimension_measurements dialog_frame::layout(SDL_Rect const& rect)
padding += font::get_max_height(font::SIZE_LARGE) + 2*dialog_frame::title_border_h;
}
return padding;
}*/
}
int dialog_frame::bottom_padding() const {
int padding = 0;

View file

@ -59,7 +59,7 @@ public:
//Static members
static const int title_border_w, title_border_h;
// int top_padding() const;
int top_padding() const;
int bottom_padding() const;
struct dimension_measurements {