Changeset - r27943:23c15817f0a5
[Not reviewed]
master
0 13 0
frosch - 15 months ago 2023-09-16 21:25:17
frosch@openttd.org
Codechange: Use parameters, which should be used.
13 files changed with 67 insertions and 41 deletions:
0 comments (0 inline, 0 general)
src/airport_gui.cpp
Show inline comments
 
@@ -563,10 +563,11 @@ public:
 

	
 
	void OnDropdownSelect(int widget, int index) override
 
	{
 
		assert(widget == WID_AP_CLASS_DROPDOWN);
 
		_selected_airport_class = (AirportClassID)index;
 
		this->vscroll->SetCount(AirportClass::Get(_selected_airport_class)->GetSpecCount());
 
		this->SelectFirstAvailableAirport(false);
 
		if (widget == WID_AP_CLASS_DROPDOWN) {
 
			_selected_airport_class = (AirportClassID)index;
 
			this->vscroll->SetCount(AirportClass::Get(_selected_airport_class)->GetSpecCount());
 
			this->SelectFirstAvailableAirport(false);
 
		}
 
	}
 

	
 
	void OnRealtimeTick([[maybe_unused]] uint delta_ms) override
src/cheat_gui.cpp
Show inline comments
 
@@ -345,6 +345,8 @@ struct CheatWindow : Window {
 

	
 
	void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
 
	{
 
		if (widget != WID_C_PANEL) return;
 

	
 
		Rect r = this->GetWidget<NWidgetBase>(WID_C_PANEL)->GetCurrentRect().Shrink(WidgetDimensions::scaled.framerect);
 
		uint btn = (pt.y - r.top) / this->line_height;
 
		uint x = pt.x - r.left;
src/game/game_gui.cpp
Show inline comments
 
@@ -367,12 +367,14 @@ struct GSConfigWindow : public Window {
 

	
 
	void OnDropdownSelect(int widget, int index) override
 
	{
 
		if (widget >= 0) return;
 
		assert(this->clicked_dropdown);
 
		SetValue(index);
 
	}
 

	
 
	void OnDropdownClose(Point, int widget, int, bool) override
 
	{
 
		if (widget >= 0) return;
 
		/* We cannot raise the dropdown button just yet. OnClick needs some hint, whether
 
		 * the same dropdown button was clicked again, and then not open the dropdown again.
 
		 * So, we only remember that it was closed, and process it on the next OnPaint, which is
src/misc_gui.cpp
Show inline comments
 
@@ -698,7 +698,7 @@ struct TooltipsWindow : public Window
 

	
 
	void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
 
	{
 
		/* There is only one widget. */
 
		if (widget != WID_TT_BACKGROUND) return;
 
		CopyInDParam(this->params);
 

	
 
		size->width  = std::min<uint>(GetStringBoundingBox(this->string_id).width, ScaleGUITrad(194));
 
@@ -711,7 +711,7 @@ struct TooltipsWindow : public Window
 

	
 
	void DrawWidget(const Rect &r, int widget) const override
 
	{
 
		/* There is only one widget. */
 
		if (widget != WID_TT_BACKGROUND) return;
 
		GfxFillRect(r, PC_BLACK);
 
		GfxFillRect(r.Shrink(WidgetDimensions::scaled.bevel), PC_LIGHT_YELLOW);
 

	
src/network/network_chat_gui.cpp
Show inline comments
 
@@ -474,9 +474,11 @@ struct NetworkChatWindow : public Window
 
		return state;
 
	}
 

	
 
	void OnEditboxChanged(int wid) override
 
	void OnEditboxChanged(int widget) override
 
	{
 
		_chat_tab_completion_active = false;
 
		if (widget == WID_NC_TEXTBOX) {
 
			_chat_tab_completion_active = false;
 
		}
 
	}
 

	
 
	/**
src/newgrf_gui.cpp
Show inline comments
 
@@ -453,6 +453,7 @@ struct NewGRFParametersWindow : public W
 

	
 
	void OnDropdownSelect(int widget, int index) override
 
	{
 
		if (widget >= 0) return;
 
		assert(this->clicked_dropdown);
 
		GRFParameterInfo &par_info = this->GetParameterInfo(this->clicked_row);
 
		par_info.SetValue(this->grf_config, index);
 
@@ -461,6 +462,7 @@ struct NewGRFParametersWindow : public W
 

	
 
	void OnDropdownClose(Point, int widget, int, bool) override
 
	{
 
		if (widget >= 0) return;
 
		/* We cannot raise the dropdown button just yet. OnClick needs some hint, whether
 
		 * the same dropdown button was clicked again, and then not open the dropdown again.
 
		 * So, we only remember that it was closed, and process it on the next OnPaint, which is
 
@@ -1169,6 +1171,7 @@ struct NewGRFWindow : public Window, New
 

	
 
	void OnDropdownSelect(int widget, int index) override
 
	{
 
		if (widget >= 0) return;
 
		if (!this->editable) return;
 

	
 
		ClearGRFConfigList(&this->actives);
 
@@ -1352,14 +1355,16 @@ struct NewGRFWindow : public Window, New
 
		return ES_HANDLED;
 
	}
 

	
 
	void OnEditboxChanged(int wid) override
 
	void OnEditboxChanged(int widget) override
 
	{
 
		if (!this->editable) return;
 

	
 
		string_filter.SetFilterTerm(this->filter_editbox.text.buf);
 
		this->avails.SetFilterState(!string_filter.IsEmpty());
 
		this->avails.ForceRebuild();
 
		this->InvalidateData(0);
 
		if (widget == WID_NS_FILTER) {
 
			string_filter.SetFilterTerm(this->filter_editbox.text.buf);
 
			this->avails.SetFilterState(!string_filter.IsEmpty());
 
			this->avails.ForceRebuild();
 
			this->InvalidateData(0);
 
		}
 
	}
 

	
 
	void OnDragDrop(Point pt, int widget) override
src/object_gui.cpp
Show inline comments
 
@@ -480,7 +480,7 @@ public:
 
			object_number = -1;
 
		} else {
 
			view_number = sel_view;
 
			ObjectClass *objclass = ObjectClass::Get(_selected_object_class);
 
			ObjectClass *objclass = ObjectClass::Get(object_class);
 
			object_number = objclass->GetUIFromIndex(sel_index);
 
		}
 

	
 
@@ -583,12 +583,14 @@ public:
 
		return ES_HANDLED;
 
	}
 

	
 
	void OnEditboxChanged(int wid) override
 
	void OnEditboxChanged(int widget) override
 
	{
 
		string_filter.SetFilterTerm(this->filter_editbox.text.buf);
 
		this->object_classes.SetFilterState(!string_filter.IsEmpty());
 
		this->object_classes.ForceRebuild();
 
		this->InvalidateData();
 
		if (widget == WID_BO_FILTER) {
 
			string_filter.SetFilterTerm(this->filter_editbox.text.buf);
 
			this->object_classes.SetFilterState(!string_filter.IsEmpty());
 
			this->object_classes.ForceRebuild();
 
			this->InvalidateData();
 
		}
 
	}
 

	
 
	/**
src/osk_gui.cpp
Show inline comments
 
@@ -185,9 +185,11 @@ struct OskWindow : public Window {
 

	
 
	void OnEditboxChanged(int widget) override
 
	{
 
		this->SetWidgetDirty(WID_OSK_TEXT);
 
		this->parent->OnEditboxChanged(this->text_btn);
 
		this->parent->SetWidgetDirty(this->text_btn);
 
		if (widget == WID_OSK_TEXT) {
 
			this->SetWidgetDirty(WID_OSK_TEXT);
 
			this->parent->OnEditboxChanged(this->text_btn);
 
			this->parent->SetWidgetDirty(this->text_btn);
 
		}
 
	}
 

	
 
	void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
src/rail_gui.cpp
Show inline comments
 
@@ -1127,12 +1127,14 @@ public:
 
		return ES_HANDLED;
 
	}
 

	
 
	void OnEditboxChanged(int wid) override
 
	void OnEditboxChanged(int widget) override
 
	{
 
		string_filter.SetFilterTerm(this->filter_editbox.text.buf);
 
		this->station_classes.SetFilterState(!string_filter.IsEmpty());
 
		this->station_classes.ForceRebuild();
 
		this->InvalidateData();
 
		if (widget == WID_BRAS_FILTER_EDITBOX) {
 
			string_filter.SetFilterTerm(this->filter_editbox.text.buf);
 
			this->station_classes.SetFilterState(!string_filter.IsEmpty());
 
			this->station_classes.ForceRebuild();
 
			this->InvalidateData();
 
		}
 
	}
 

	
 
	void OnPaint() override
src/road_gui.cpp
Show inline comments
 
@@ -1306,12 +1306,14 @@ public:
 
		return ES_NOT_HANDLED;
 
	}
 

	
 
	void OnEditboxChanged(int wid) override
 
	void OnEditboxChanged(int widget) override
 
	{
 
		string_filter.SetFilterTerm(this->filter_editbox.text.buf);
 
		this->roadstop_classes.SetFilterState(!string_filter.IsEmpty());
 
		this->roadstop_classes.ForceRebuild();
 
		this->InvalidateData();
 
		if (widget == WID_BROS_FILTER_EDITBOX) {
 
			string_filter.SetFilterTerm(this->filter_editbox.text.buf);
 
			this->roadstop_classes.SetFilterState(!string_filter.IsEmpty());
 
			this->roadstop_classes.ForceRebuild();
 
			this->InvalidateData();
 
		}
 
	}
 

	
 
	void OnPaint() override
src/script/script_gui.cpp
Show inline comments
 
@@ -526,12 +526,14 @@ struct ScriptSettingsWindow : public Win
 

	
 
	void OnDropdownSelect(int widget, int index) override
 
	{
 
		if (widget >= 0) return;
 
		assert(this->clicked_dropdown);
 
		SetValue(index);
 
	}
 

	
 
	void OnDropdownClose(Point, int widget, int, bool) override
 
	{
 
		if (widget >= 0) return;
 
		/* We cannot raise the dropdown button just yet. OnClick needs some hint, whether
 
		 * the same dropdown button was clicked again, and then not open the dropdown again.
 
		 * So, we only remember that it was closed, and process it on the next OnPaint, which is
src/station_gui.cpp
Show inline comments
 
@@ -638,13 +638,15 @@ public:
 

	
 
	void OnDropdownSelect(int widget, int index) override
 
	{
 
		if (this->stations.SortType() != index) {
 
			this->stations.SetSortType(index);
 
		if (widget == WID_STL_SORTDROPBTN) {
 
			if (this->stations.SortType() != index) {
 
				this->stations.SetSortType(index);
 

	
 
			/* Display the current sort variant */
 
			this->GetWidget<NWidgetCore>(WID_STL_SORTDROPBTN)->widget_data = this->sorter_names[this->stations.SortType()];
 
				/* Display the current sort variant */
 
				this->GetWidget<NWidgetCore>(WID_STL_SORTDROPBTN)->widget_data = this->sorter_names[this->stations.SortType()];
 

	
 
			this->SetDirty();
 
				this->SetDirty();
 
			}
 
		}
 
	}
 

	
 
@@ -1466,9 +1468,11 @@ struct StationViewWindow : public Window
 

	
 
	void SetStringParameters(int widget) const override
 
	{
 
		const Station *st = Station::Get(this->window_number);
 
		SetDParam(0, st->index);
 
		SetDParam(1, st->facilities);
 
		if (widget == WID_SV_CAPTION) {
 
			const Station *st = Station::Get(this->window_number);
 
			SetDParam(0, st->index);
 
			SetDParam(1, st->facilities);
 
		}
 
	}
 

	
 
	/**
src/video/sdl2_opengl_v.cpp
Show inline comments
 
@@ -50,7 +50,7 @@ static OGLProc GetOGLProcAddressCallback
 

	
 
bool VideoDriver_SDL_OpenGL::CreateMainWindow(uint w, uint h, uint flags)
 
{
 
	return this->VideoDriver_SDL_Base::CreateMainWindow(w, h, SDL_WINDOW_OPENGL);
 
	return this->VideoDriver_SDL_Base::CreateMainWindow(w, h, flags | SDL_WINDOW_OPENGL);
 
}
 

	
 
const char *VideoDriver_SDL_OpenGL::Start(const StringList &param)
0 comments (0 inline, 0 general)