Codechange: Move dropdown and slider out of widgets directory. (#12403)

Also shuffle headers to place widget includes near end.

This leaves the widgets directory solely for defining Widget IDs.
This commit is contained in:
Peter Nelson 2024-03-31 19:37:16 +01:00 committed by GitHub
parent d5e28a904d
commit d683ec0183
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
41 changed files with 96 additions and 87 deletions

View File

@ -138,6 +138,9 @@ add_files(
dock_gui.cpp
driver.cpp
driver.h
dropdown.cpp
dropdown_func.h
dropdown_type.h
economy.cpp
economy_base.h
economy_cmd.h
@ -393,6 +396,8 @@ add_files(
signs_func.h
signs_gui.cpp
signs_type.h
slider.cpp
slider_func.h
slope_func.h
slope_type.h
smallmap_gui.cpp

View File

@ -22,7 +22,7 @@
#include "station_type.h"
#include "newgrf_airport.h"
#include "newgrf_callbacks.h"
#include "widgets/dropdown_type.h"
#include "dropdown_type.h"
#include "core/geometry_func.hpp"
#include "hotkeys.h"
#include "vehicle_func.h"

View File

@ -24,7 +24,7 @@
#include "core/geometry_func.hpp"
#include "rail_gui.h"
#include "road_gui.h"
#include "widgets/dropdown_func.h"
#include "dropdown_func.h"
#include "autoreplace_cmd.h"
#include "group_cmd.h"
#include "settings_cmd.h"

View File

@ -18,7 +18,7 @@
#include "gfx_func.h"
#include "tunnelbridge.h"
#include "sortlist_type.h"
#include "widgets/dropdown_func.h"
#include "dropdown_func.h"
#include "core/geometry_func.hpp"
#include "tunnelbridge_map.h"
#include "road_gui.h"

View File

@ -25,7 +25,7 @@
#include "window_func.h"
#include "timer/timer_game_calendar.h"
#include "vehicle_func.h"
#include "widgets/dropdown_func.h"
#include "dropdown_func.h"
#include "engine_gui.h"
#include "cargotype.h"
#include "core/geometry_func.hpp"

View File

@ -34,12 +34,13 @@
#include "game/game.hpp"
#include "goal_base.h"
#include "story_base.h"
#include "widgets/statusbar_widget.h"
#include "company_cmd.h"
#include "timer/timer.h"
#include "timer/timer_game_economy.h"
#include "timer/timer_game_tick.h"
#include "widgets/statusbar_widget.h"
#include "table/strings.h"
#include "safeguards.h"

View File

@ -23,7 +23,7 @@
#include "company_manager_face.h"
#include "strings_func.h"
#include "timer/timer_game_economy.h"
#include "widgets/dropdown_type.h"
#include "dropdown_type.h"
#include "tilehighlight_func.h"
#include "company_base.h"
#include "core/geometry_func.hpp"

View File

@ -14,8 +14,8 @@
#include "window_gui.h"
#include "date_gui.h"
#include "core/geometry_func.hpp"
#include "dropdown_type.h"
#include "widgets/dropdown_type.h"
#include "widgets/date_widget.h"
#include "safeguards.h"

View File

@ -7,19 +7,18 @@
/** @file dropdown.cpp Implementation of the dropdown widget. */
#include "../stdafx.h"
#include "../window_gui.h"
#include "../string_func.h"
#include "../strings_func.h"
#include "../window_func.h"
#include "../zoom_func.h"
#include "../timer/timer.h"
#include "../timer/timer_window.h"
#include "stdafx.h"
#include "dropdown_type.h"
#include "strings_func.h"
#include "timer/timer.h"
#include "timer/timer_window.h"
#include "window_gui.h"
#include "window_func.h"
#include "zoom_func.h"
#include "dropdown_widget.h"
#include "widgets/dropdown_widget.h"
#include "../safeguards.h"
#include "safeguards.h"
static constexpr NWidgetPart _nested_dropdown_menu_widgets[] = {

View File

@ -7,12 +7,12 @@
/** @file dropdown_func.h Functions related to the drop down widget. */
#ifndef WIDGETS_DROPDOWN_FUNC_H
#define WIDGETS_DROPDOWN_FUNC_H
#ifndef DROPDOWN_FUNC_H
#define DROPDOWN_FUNC_H
#include "../window_gui.h"
#include "window_gui.h"
/* Show drop down menu containing a fixed list of strings */
void ShowDropDownMenu(Window *w, const StringID *strings, int selected, WidgetID button, uint32_t disabled_mask, uint32_t hidden_mask, uint width = 0);
#endif /* WIDGETS_DROPDOWN_FUNC_H */
#endif /* DROPDOWN_FUNC_H */

View File

@ -7,17 +7,17 @@
/** @file dropdown_type.h Types related to the drop down widget. */
#ifndef WIDGETS_DROPDOWN_TYPE_H
#define WIDGETS_DROPDOWN_TYPE_H
#ifndef DROPDOWN_TYPE_H
#define DROPDOWN_TYPE_H
#include "../window_type.h"
#include "../gfx_func.h"
#include "../gfx_type.h"
#include "../palette_func.h"
#include "../string_func.h"
#include "../strings_func.h"
#include "../table/strings.h"
#include "../window_gui.h"
#include "window_type.h"
#include "gfx_func.h"
#include "gfx_type.h"
#include "palette_func.h"
#include "string_func.h"
#include "strings_func.h"
#include "table/strings.h"
#include "window_gui.h"
/**
* Base list item class from which others are derived.
@ -217,4 +217,4 @@ Dimension GetDropDownListDimension(const DropDownList &list);
void ReplaceDropDownList(Window *parent, DropDownList &&list);
#endif /* WIDGETS_DROPDOWN_TYPE_H */
#endif /* DROPDOWN_TYPE_H */

View File

@ -14,7 +14,7 @@
#include "../window_func.h"
#include "../network/network.h"
#include "../network/network_content.h"
#include "../widgets/dropdown_func.h"
#include "../dropdown_func.h"
#include "../timer/timer.h"
#include "../timer/timer_window.h"

View File

@ -18,8 +18,8 @@
#include "sound_func.h"
#include "fios.h"
#include "string_func.h"
#include "widgets/dropdown_type.h"
#include "widgets/dropdown_func.h"
#include "dropdown_type.h"
#include "dropdown_func.h"
#include "querystring_gui.h"
#include "town.h"
#include "core/geometry_func.hpp"

View File

@ -14,6 +14,7 @@
#include "vehicle_gui.h"
#include "landscape.h"
#include "window_func.h"
#include "widgets/vehicle_widget.h"
/** What is the status of our acceleration? */

View File

@ -18,7 +18,7 @@
#include "vehicle_func.h"
#include "autoreplace_gui.h"
#include "company_func.h"
#include "widgets/dropdown_func.h"
#include "dropdown_func.h"
#include "tilehighlight_func.h"
#include "vehicle_gui_base.h"
#include "core/geometry_func.hpp"

View File

@ -15,8 +15,8 @@
#include "table/control_codes.h"
#include "string_func.h"
#include "openttd.h"
#include "help_gui.h"
#include "widgets/help_widget.h"
#include "widgets/misc_widget.h"

View File

@ -28,15 +28,14 @@
#include "tilehighlight_func.h"
#include "string_func.h"
#include "sortlist_type.h"
#include "widgets/dropdown_func.h"
#include "dropdown_func.h"
#include "company_base.h"
#include "core/geometry_func.hpp"
#include "core/random_func.hpp"
#include "core/backup_type.hpp"
#include "genworld.h"
#include "smallmap_gui.h"
#include "widgets/dropdown_type.h"
#include "widgets/industry_widget.h"
#include "dropdown_type.h"
#include "clear_map.h"
#include "zoom_func.h"
#include "industry_cmd.h"
@ -46,6 +45,8 @@
#include "timer/timer_window.h"
#include "hotkeys.h"
#include "widgets/industry_widget.h"
#include "table/strings.h"
#include <bitset>

View File

@ -9,7 +9,6 @@
#include "stdafx.h"
#include "league_gui.h"
#include "company_base.h"
#include "company_gui.h"
#include "gui.h"
@ -22,7 +21,9 @@
#include "town.h"
#include "viewport_func.h"
#include "window_gui.h"
#include "widgets/league_widget.h"
#include "table/strings.h"
#include "table/sprites.h"

View File

@ -24,9 +24,9 @@
#include "string_func.h"
#include "settings_type.h"
#include "settings_gui.h"
#include "widgets/dropdown_func.h"
#include "widgets/dropdown_type.h"
#include "widgets/slider_func.h"
#include "dropdown_func.h"
#include "dropdown_type.h"
#include "slider_func.h"
#include "mixer.h"
#include "widgets/music_widget.h"

View File

@ -23,8 +23,8 @@
#include "network_udp.h"
#include "../window_func.h"
#include "../gfx_func.h"
#include "../widgets/dropdown_type.h"
#include "../widgets/dropdown_func.h"
#include "../dropdown_type.h"
#include "../dropdown_func.h"
#include "../querystring_gui.h"
#include "../sortlist_type.h"
#include "../company_func.h"

View File

@ -16,8 +16,8 @@
#include "gamelog.h"
#include "settings_type.h"
#include "settings_func.h"
#include "widgets/dropdown_type.h"
#include "widgets/dropdown_func.h"
#include "dropdown_type.h"
#include "dropdown_func.h"
#include "network/network.h"
#include "network/network_content.h"
#include "sortlist_type.h"

View File

@ -21,7 +21,7 @@
#include "town.h"
#include "sound_func.h"
#include "string_func.h"
#include "widgets/dropdown_func.h"
#include "dropdown_func.h"
#include "statusbar_gui.h"
#include "company_manager_face.h"
#include "company_func.h"

View File

@ -15,8 +15,8 @@
#include "timetable.h"
#include "strings_func.h"
#include "company_func.h"
#include "widgets/dropdown_type.h"
#include "widgets/dropdown_func.h"
#include "dropdown_type.h"
#include "dropdown_func.h"
#include "textbuf_gui.h"
#include "string_func.h"
#include "tilehighlight_func.h"

View File

@ -21,7 +21,7 @@
#include "window_func.h"
#include "sound_func.h"
#include "company_func.h"
#include "widgets/dropdown_type.h"
#include "dropdown_type.h"
#include "tunnelbridge.h"
#include "tilehighlight_func.h"
#include "spritecache.h"

View File

@ -11,7 +11,7 @@
#define RAIL_GUI_H
#include "rail_type.h"
#include "widgets/dropdown_type.h"
#include "dropdown_type.h"
struct Window *ShowBuildRailToolbar(RailType railtype);
void ReinitGuiAfterToggleElrail(bool disable);

View File

@ -13,7 +13,7 @@
#include "road_type.h"
#include "tile_type.h"
#include "direction_type.h"
#include "widgets/dropdown_type.h"
#include "dropdown_type.h"
struct Window *ShowBuildRoadToolbar(RoadType roadtype);
struct Window *ShowBuildRoadScenToolbar(RoadType roadtype);

View File

@ -11,10 +11,14 @@
#include "window_func.h"
#include "window_gui.h"
#include "screenshot.h"
#include "widgets/screenshot_widget.h"
#include "table/strings.h"
#include "gfx_func.h"
#include "widgets/screenshot_widget.h"
#include "table/strings.h"
#include "safeguards.h"
struct ScreenshotWindow : Window {
ScreenshotWindow(WindowDesc *desc) : Window(desc)
{

View File

@ -17,7 +17,7 @@
#include "../company_gui.h"
#include "../window_func.h"
#include "../network/network.h"
#include "../widgets/dropdown_func.h"
#include "../dropdown_func.h"
#include "../hotkeys.h"
#include "../company_cmd.h"
#include "../misc_cmd.h"

View File

@ -19,9 +19,9 @@
#include "strings_func.h"
#include "window_func.h"
#include "string_func.h"
#include "widgets/dropdown_type.h"
#include "widgets/dropdown_func.h"
#include "widgets/slider_func.h"
#include "dropdown_type.h"
#include "dropdown_func.h"
#include "slider_func.h"
#include "highscore.h"
#include "base_media_base.h"
#include "company_base.h"

View File

@ -11,7 +11,7 @@
#define SETTING_GUI_H
#include "gfx_type.h"
#include "widgets/dropdown_type.h"
#include "dropdown_type.h"
/** Width of setting buttons */
#define SETTING_BUTTON_WIDTH ((int)NWidgetScrollbar::GetHorizontalDimension().width * 2)

View File

@ -7,15 +7,15 @@
/** @file slider.cpp Implementation of the horizontal slider widget. */
#include "../stdafx.h"
#include "../palette_func.h"
#include "../window_gui.h"
#include "../window_func.h"
#include "../strings_func.h"
#include "../zoom_func.h"
#include "stdafx.h"
#include "gfx_func.h"
#include "palette_func.h"
#include "slider_func.h"
#include "strings_func.h"
#include "window_gui.h"
#include "zoom_func.h"
#include "../safeguards.h"
#include "safeguards.h"
static const int SLIDER_WIDTH = 3;

View File

@ -7,11 +7,11 @@
/** @file slider_type.h Types related to the horizontal slider widget. */
#ifndef WIDGETS_SLIDER_TYPE_H
#define WIDGETS_SLIDER_TYPE_H
#ifndef SLIDER_TYPE_H
#define SLIDER_TYPE_H
#include "../window_type.h"
#include "../gfx_func.h"
#include "core/geometry_type.hpp"
#include "strings_type.h"
void DrawSliderWidget(Rect r, int min_value, int max_value, int value, const std::map<int, StringID> &labels);
bool ClickSliderWidget(Rect r, Point pt, int min_value, int max_value, int &value);
@ -24,4 +24,4 @@ inline bool ClickSliderWidget(Rect r, Point pt, int min_value, int max_value, ui
return true;
}
#endif /* WIDGETS_SLIDER_TYPE_H */
#endif /* SLIDER_TYPE_H */

View File

@ -26,11 +26,12 @@
#include "strings_func.h"
#include "blitter/factory.hpp"
#include "linkgraph/linkgraph_gui.h"
#include "widgets/smallmap_widget.h"
#include "timer/timer.h"
#include "timer/timer_window.h"
#include "smallmap_gui.h"
#include "widgets/smallmap_widget.h"
#include "table/strings.h"
#include <bitset>

View File

@ -55,7 +55,6 @@
#include "company_gui.h"
#include "linkgraph/linkgraph_base.h"
#include "linkgraph/refresh.h"
#include "widgets/station_widget.h"
#include "tunnelbridge_map.h"
#include "station_cmd.h"
#include "waypoint_cmd.h"
@ -68,6 +67,8 @@
#include "timer/timer_game_tick.h"
#include "cheat_type.h"
#include "widgets/station_widget.h"
#include "table/strings.h"
#include <bitset>

View File

@ -20,7 +20,7 @@
#include "string_func.h"
#include "window_func.h"
#include "viewport_func.h"
#include "widgets/dropdown_func.h"
#include "dropdown_func.h"
#include "station_base.h"
#include "waypoint_base.h"
#include "tilehighlight_func.h"

View File

@ -15,8 +15,8 @@
#include "core/geometry_func.hpp"
#include "company_func.h"
#include "command_func.h"
#include "widgets/dropdown_type.h"
#include "widgets/dropdown_func.h"
#include "dropdown_type.h"
#include "dropdown_func.h"
#include "sortlist_type.h"
#include "goal_base.h"
#include "viewport_func.h"

View File

@ -15,7 +15,7 @@
#include "gfx_func.h"
#include "string_func.h"
#include "textfile_gui.h"
#include "widgets/dropdown_type.h"
#include "dropdown_type.h"
#include "gfx_layout.h"
#include "debug.h"
#include "openttd.h"

View File

@ -31,7 +31,7 @@
#include "core/geometry_func.hpp"
#include "genworld.h"
#include "stringfilter_type.h"
#include "widgets/dropdown_func.h"
#include "dropdown_func.h"
#include "town_kdtree.h"
#include "town_cmd.h"
#include "timer/timer.h"

View File

@ -26,7 +26,7 @@
#include "vehicle_func.h"
#include "autoreplace_gui.h"
#include "string_func.h"
#include "widgets/dropdown_func.h"
#include "dropdown_func.h"
#include "timetable.h"
#include "articulated_vehicles.h"
#include "spritecache.h"

View File

@ -17,7 +17,7 @@
#include "vehicle_base.h"
#include "vehiclelist.h"
#include "window_gui.h"
#include "widgets/dropdown_type.h"
#include "dropdown_type.h"
typedef GUIList<const Vehicle*, std::nullptr_t, CargoID> GUIVehicleList;

View File

@ -11,9 +11,6 @@ add_files(
date_widget.h
depot_widget.h
dock_widget.h
dropdown.cpp
dropdown_func.h
dropdown_type.h
dropdown_widget.h
engine_widget.h
error_widget.h
@ -48,8 +45,6 @@ add_files(
script_widget.h
settings_widget.h
sign_widget.h
slider.cpp
slider_func.h
smallmap_widget.h
station_widget.h
statusbar_widget.h