diff options
author | Yexo <Yexo@openttd.org> | 2009-01-29 02:42:36 +0000 |
---|---|---|
committer | Yexo <Yexo@openttd.org> | 2009-01-29 02:42:36 +0000 |
commit | e8f190849ec43775bff136361b9ffc364d5fe95f (patch) | |
tree | fb59c7c89e4c38389e254a1ef30bddf8833975e1 /src | |
parent | a57c73e2f9db65778f14aaa28d5142ffb9950adf (diff) | |
download | openttd-e8f190849ec43775bff136361b9ffc364d5fe95f.tar.xz |
(svn r15291) -Cleanup: Move the station list widgets to their class from station_gui.h
-Fix: comment for ReallocT was wrong, the memory is not zeroed.
Diffstat (limited to 'src')
-rw-r--r-- | src/core/alloc_func.hpp | 2 | ||||
-rw-r--r-- | src/station_gui.cpp | 36 | ||||
-rw-r--r-- | src/station_gui.h | 25 |
3 files changed, 33 insertions, 30 deletions
diff --git a/src/core/alloc_func.hpp b/src/core/alloc_func.hpp index f1e0f7ba8..a5a730771 100644 --- a/src/core/alloc_func.hpp +++ b/src/core/alloc_func.hpp @@ -69,7 +69,7 @@ static FORCEINLINE T *CallocT(size_t num_elements) * elements of the given type. It also explicitly casts it to the requested * type. It extends/shrinks the memory allocation given in t_ptr. * @note throws an error when there is no memory anymore. - * @note the memory contains all zero values. + * @note the pointer to the data may change, but the data will remain valid. * @param T the type of the variable(s) to allocation. * @param t_ptr the previous allocation to extend/shrink. * @param num_elements the number of elements to allocate of the given type. diff --git a/src/station_gui.cpp b/src/station_gui.cpp index f0bfae69d..4cfdb6b90 100644 --- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -93,6 +93,34 @@ typedef GUIList<const Station*> GUIStationList; */ class CompanyStationsWindow : public Window { + /** Enum for CompanyStations, referring to _company_stations_widgets */ + enum StationListWidgets { + SLW_CLOSEBOX = 0, ///< Close window button + SLW_CAPTION, ///< Window caption + SLW_STICKY, ///< Sticky button + SLW_LIST, ///< The main panel, list of stations + SLW_SCROLLBAR, ///< Scrollbar next to the main panel + SLW_RESIZE, ///< Resize button + + SLW_TRAIN, ///< 'TRAIN' button - list only facilities where is a railroad station + SLW_TRUCK, ///< 'TRUCK' button - list only facilities where is a truck stop + SLW_BUS, ///< 'BUS' button - list only facilities where is a bus stop + SLW_AIRPLANE, ///< 'AIRPLANE' button - list only facilities where is an airport + SLW_SHIP, ///< 'SHIP' button - list only facilities where is a dock + SLW_FACILALL, ///< 'ALL' button - list all facilities + + SLW_PAN_BETWEEN, ///< Small panel between list of types of ficilities and list of cargo types + SLW_NOCARGOWAITING, ///< 'NO' button - list stations where no cargo is waiting + SLW_CARGOALL, ///< 'ALL' button - list all stations + SLW_PAN_RIGHT, ///< Panel right of list of cargo types + + SLW_SORTBY, ///< 'Sort by' button - reverse sort direction + SLW_SORTDROPBTN, ///< Dropdown button + SLW_PAN_SORT_RIGHT, ///< Panel right of sorting options + + SLW_CARGOSTART, ///< Widget numbers used for list of cargo types (not present in _company_stations_widgets) + }; + protected: /* Runtime saved values */ static Listing last_sorting; @@ -570,11 +598,11 @@ const StringID CompanyStationsWindow::sorter_names[] = { static const Widget _company_stations_widgets[] = { { WWT_CLOSEBOX, RESIZE_NONE, COLOUR_GREY, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // SLW_CLOSEBOX -{ WWT_CAPTION, RESIZE_RIGHT, COLOUR_GREY, 11, 345, 0, 13, STR_3048_STATIONS, STR_018C_WINDOW_TITLE_DRAG_THIS}, -{ WWT_STICKYBOX, RESIZE_LR, COLOUR_GREY, 346, 357, 0, 13, 0x0, STR_STICKY_BUTTON}, +{ WWT_CAPTION, RESIZE_RIGHT, COLOUR_GREY, 11, 345, 0, 13, STR_3048_STATIONS, STR_018C_WINDOW_TITLE_DRAG_THIS}, // SLW_CAPTION +{ WWT_STICKYBOX, RESIZE_LR, COLOUR_GREY, 346, 357, 0, 13, 0x0, STR_STICKY_BUTTON}, // SLW_STICKY { WWT_PANEL, RESIZE_RB, COLOUR_GREY, 0, 345, 37, 161, 0x0, STR_3057_STATION_NAMES_CLICK_ON}, // SLW_LIST -{ WWT_SCROLLBAR, RESIZE_LRB, COLOUR_GREY, 346, 357, 37, 149, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, -{ WWT_RESIZEBOX, RESIZE_LRTB, COLOUR_GREY, 346, 357, 150, 161, 0x0, STR_RESIZE_BUTTON}, +{ WWT_SCROLLBAR, RESIZE_LRB, COLOUR_GREY, 346, 357, 37, 149, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, // SLW_SCROLLBAR +{ WWT_RESIZEBOX, RESIZE_LRTB, COLOUR_GREY, 346, 357, 150, 161, 0x0, STR_RESIZE_BUTTON}, // SLW_RESIZE { WWT_TEXTBTN, RESIZE_NONE, COLOUR_GREY, 0, 13, 14, 24, STR_TRAIN, STR_USE_CTRL_TO_SELECT_MORE}, // SLW_TRAIN { WWT_TEXTBTN, RESIZE_NONE, COLOUR_GREY, 14, 27, 14, 24, STR_LORRY, STR_USE_CTRL_TO_SELECT_MORE}, // SLW_TRUCK diff --git a/src/station_gui.h b/src/station_gui.h index 1addc6ab9..8efe3aae2 100644 --- a/src/station_gui.h +++ b/src/station_gui.h @@ -7,31 +7,6 @@ #include "command_type.h" -/** Enum for CompanyStations, referring to _company_stations_widgets */ -enum StationListWidgets { - SLW_CLOSEBOX = 0, ///< Close 'X' button - - SLW_LIST = 3, ///< The main panel, list of stations - - SLW_TRAIN = 6, ///< 'TRAIN' button - list only facilities where is a railroad station - SLW_TRUCK, - SLW_BUS, - SLW_AIRPLANE, - SLW_SHIP, - SLW_FACILALL, ///< 'ALL' button - list all facilities - - SLW_PAN_BETWEEN = 12, ///< Small panel between list of types of ficilities and list of cargo types - SLW_NOCARGOWAITING = 13, ///< 'NO' button - list stations where no cargo is waiting - SLW_CARGOALL = 14, ///< 'ALL' button - list all stations - SLW_PAN_RIGHT = 15, ///< Panel right of list of cargo types - - SLW_SORTBY = 16, ///< 'Sort by' button - reverse sort direction - SLW_SORTDROPBTN = 17, ///< Dropdown button - SLW_PAN_SORT_RIGHT = 18, ///< Panel right of sorting options - - SLW_CARGOSTART = 19, ///< Widget numbers used for list of cargo types (not present in _company_stations_widgets) -}; - /** Enum for StationView, referring to _station_view_widgets and _station_view_expanded_widgets */ enum StationViewWidgets { SVW_CLOSEBOX = 0, ///< Close 'X' button |