From b22fbfbe3ddb1b965efdc948fe47cf9002cd3c71 Mon Sep 17 00:00:00 2001 From: glx Date: Mon, 28 Jan 2019 23:51:34 +0100 Subject: Add: allow opening of one TextfileWindow per type --- src/ai/ai_gui.cpp | 2 +- src/network/network_content_gui.cpp | 2 +- src/newgrf_gui.cpp | 2 +- src/settings_gui.cpp | 2 +- src/textfile_gui.cpp | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp index 8dad16fab..aa56b3d83 100644 --- a/src/ai/ai_gui.cpp +++ b/src/ai/ai_gui.cpp @@ -660,7 +660,7 @@ struct ScriptTextfileWindow : public TextfileWindow { */ void ShowScriptTextfileWindow(TextfileType file_type, CompanyID slot) { - DeleteWindowByClass(WC_TEXTFILE); + DeleteWindowById(WC_TEXTFILE, file_type); new ScriptTextfileWindow(file_type, slot); } diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp index 1df2fc82c..877dea978 100644 --- a/src/network/network_content_gui.cpp +++ b/src/network/network_content_gui.cpp @@ -76,7 +76,7 @@ struct ContentTextfileWindow : public TextfileWindow { void ShowContentTextfileWindow(TextfileType file_type, const ContentInfo *ci) { - DeleteWindowByClass(WC_TEXTFILE); + DeleteWindowById(WC_TEXTFILE, file_type); new ContentTextfileWindow(file_type, ci); } diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index 140e29657..868fad968 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -561,7 +561,7 @@ struct NewGRFTextfileWindow : public TextfileWindow { void ShowNewGRFTextfileWindow(TextfileType file_type, const GRFConfig *c) { - DeleteWindowByClass(WC_TEXTFILE); + DeleteWindowById(WC_TEXTFILE, file_type); new NewGRFTextfileWindow(file_type, c); } diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index 134b1f58f..e94f96bc4 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -162,7 +162,7 @@ struct BaseSetTextfileWindow : public TextfileWindow { template void ShowBaseSetTextfileWindow(TextfileType file_type, const TBaseSet* baseset, StringID content_type) { - DeleteWindowByClass(WC_TEXTFILE); + DeleteWindowById(WC_TEXTFILE, file_type); new BaseSetTextfileWindow(file_type, baseset, content_type); } diff --git a/src/textfile_gui.cpp b/src/textfile_gui.cpp index b0f9b1125..ff5226c2b 100644 --- a/src/textfile_gui.cpp +++ b/src/textfile_gui.cpp @@ -65,7 +65,7 @@ TextfileWindow::TextfileWindow(TextfileType file_type) : Window(&_textfile_desc) this->CreateNestedTree(); this->vscroll = this->GetScrollbar(WID_TF_VSCROLLBAR); this->hscroll = this->GetScrollbar(WID_TF_HSCROLLBAR); - this->FinishInitNested(); + this->FinishInitNested(file_type); this->GetWidget(WID_TF_CAPTION)->SetDataTip(STR_TEXTFILE_README_CAPTION + file_type, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS); this->hscroll->SetStepSize(10); // Speed up horizontal scrollbar -- cgit v1.2.3-54-g00ecf