mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-12 10:30:28 +00:00
Codechange: Use parameters, which should be used.
This commit is contained in:
parent
b6c8f301be
commit
b5885295f0
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -453,6 +453,7 @@ struct NewGRFParametersWindow : public Window {
|
||||
|
||||
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 Window {
|
||||
|
||||
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, NewGRFScanCallback {
|
||||
|
||||
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, NewGRFScanCallback {
|
||||
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
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -526,12 +526,14 @@ struct ScriptSettingsWindow : 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
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -50,7 +50,7 @@ static OGLProc GetOGLProcAddressCallback(const char *proc)
|
||||
|
||||
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 ¶m)
|
||||
|
Loading…
Reference in New Issue
Block a user