Changeset - r28352:0df9b3f04533
[Not reviewed]
master
0 2 0
Peter Nelson - 11 months ago 2023-12-30 00:19:27
peter1138@openttd.org
Fix #11643: Empty area at top of survey preview. (#11647)

Empty area at the top of some textfile windows due to calling
SetDisplayedPlane() after calling FinishInitNested(), and/or changing
the displayed plane and not calling ReInit() after.

This was previously hidden by CheckForMissingGlyphs() reinitialising
all windows anyway.
2 files changed with 4 insertions and 5 deletions:
0 comments (0 inline, 0 general)
src/help_gui.cpp
Show inline comments
 
@@ -85,7 +85,7 @@ struct GameManualTextfileWindow : public
 
		if (this->filename == CHANGELOG_FILENAME) {
 
			this->link_anchors.clear();
 
			this->AfterLoadChangelog();
 
			this->GetWidget<NWidgetStacked>(WID_TF_SEL_JUMPLIST)->SetDisplayedPlane(this->jumplist.empty() ? SZSP_HORIZONTAL : 0);
 
			if (this->GetWidget<NWidgetStacked>(WID_TF_SEL_JUMPLIST)->SetDisplayedPlane(this->jumplist.empty() ? SZSP_HORIZONTAL : 0)) this->ReInit();
 
		} else {
 
			this->TextfileWindow::AfterLoadText();
 
		}
src/textfile_gui.cpp
Show inline comments
 
@@ -86,9 +86,9 @@ TextfileWindow::TextfileWindow(TextfileT
 
	this->CreateNestedTree();
 
	this->vscroll = this->GetScrollbar(WID_TF_VSCROLLBAR);
 
	this->hscroll = this->GetScrollbar(WID_TF_HSCROLLBAR);
 
	this->FinishInitNested(file_type);
 
	this->GetWidget<NWidgetCore>(WID_TF_CAPTION)->SetDataTip(STR_TEXTFILE_README_CAPTION + file_type, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS);
 
	this->GetWidget<NWidgetStacked>(WID_TF_SEL_JUMPLIST)->SetDisplayedPlane(SZSP_HORIZONTAL);
 
	this->FinishInitNested(file_type);
 

	
 
	this->DisableWidget(WID_TF_NAVBACK);
 
	this->DisableWidget(WID_TF_NAVFORWARD);
 
@@ -493,7 +493,7 @@ void TextfileWindow::NavigateToFile(std:
 

	
 
	if (StrEndsWithIgnoreCase(this->filename, ".md")) this->AfterLoadMarkdown();
 

	
 
	this->GetWidget<NWidgetStacked>(WID_TF_SEL_JUMPLIST)->SetDisplayedPlane(this->jumplist.empty() ? SZSP_HORIZONTAL : 0);
 
	if (this->GetWidget<NWidgetStacked>(WID_TF_SEL_JUMPLIST)->SetDisplayedPlane(this->jumplist.empty() ? SZSP_HORIZONTAL : 0)) this->ReInit();
 
}
 

	
 
/**
 
@@ -761,8 +761,7 @@ static void Xunzip(byte **bufp, size_t *
 
	this->lines.clear();
 
	this->jumplist.clear();
 

	
 
	this->GetWidget<NWidgetStacked>(WID_TF_SEL_JUMPLIST)->SetDisplayedPlane(SZSP_HORIZONTAL);
 
	this->ReInit();
 
	if (this->GetWidget<NWidgetStacked>(WID_TF_SEL_JUMPLIST)->SetDisplayedPlane(SZSP_HORIZONTAL)) this->ReInit();
 

	
 
	if (textfile.empty()) return;
 

	
0 comments (0 inline, 0 general)