File diff r24596:eddf98238034 → r24597:afde5721a3b6
src/textfile_gui.cpp
Show inline comments
 
@@ -95,13 +95,13 @@ uint TextfileWindow::GetContentHeight()
 
{
 
	switch (widget) {
 
		case WID_TF_BACKGROUND:
 
			resize->height = 1;
 

	
 
			size->height = 4 * resize->height + TOP_SPACING + BOTTOM_SPACING; // At least 4 lines are visible.
 
			size->width = max(200u, size->width); // At least 200 pixels wide.
 
			size->width = std::max(200u, size->width); // At least 200 pixels wide.
 
			break;
 
	}
 
}
 

	
 
/** Set scrollbars to the right lengths. */
 
void TextfileWindow::SetupScrollbars()
 
@@ -109,13 +109,13 @@ void TextfileWindow::SetupScrollbars()
 
	if (IsWidgetLowered(WID_TF_WRAPTEXT)) {
 
		this->vscroll->SetCount(this->GetContentHeight());
 
		this->hscroll->SetCount(0);
 
	} else {
 
		uint max_length = 0;
 
		for (uint i = 0; i < this->lines.size(); i++) {
 
			max_length = max(max_length, GetStringBoundingBox(this->lines[i], FS_MONO).width);
 
			max_length = std::max(max_length, GetStringBoundingBox(this->lines[i], FS_MONO).width);
 
		}
 
		this->vscroll->SetCount((uint)this->lines.size() * FONT_HEIGHT_MONO);
 
		this->hscroll->SetCount(max_length + WD_FRAMETEXT_LEFT + WD_FRAMETEXT_RIGHT);
 
	}
 

	
 
	this->SetWidgetDisabledState(WID_TF_HSCROLLBAR, IsWidgetLowered(WID_TF_WRAPTEXT));