Merge branch 'master' into jgrpp
Replace build and refit, and group collapse implementations Fix template creation build and refit # Conflicts: # Makefile.bundle.in # config.lib # src/animated_tile.cpp # src/blitter/32bpp_anim.hpp # src/blitter/32bpp_base.hpp # src/blitter/8bpp_base.hpp # src/blitter/null.hpp # src/build_vehicle_gui.cpp # src/command.cpp # src/command_func.h # src/console_gui.cpp # src/core/smallstack_type.hpp # src/date.cpp # src/debug.cpp # src/genworld_gui.cpp # src/ground_vehicle.hpp # src/group_gui.cpp # src/lang/korean.txt # src/linkgraph/linkgraph_gui.h # src/main_gui.cpp # src/misc_gui.cpp # src/network/core/game.h # src/network/core/packet.cpp # src/network/core/udp.cpp # src/network/core/udp.h # src/network/network_content.cpp # src/network/network_type.h # src/network/network_udp.cpp # src/newgrf_house.h # src/openttd.cpp # src/order_cmd.cpp # src/order_gui.cpp # src/os/unix/crashlog_unix.cpp # src/os/windows/crashlog_win.cpp # src/osk_gui.cpp # src/pathfinder/opf/opf_ship.cpp # src/rail_cmd.cpp # src/rail_gui.cpp # src/saveload/saveload.cpp # src/settings.cpp # src/settings_gui.cpp # src/smallmap_gui.h # src/station_base.h # src/station_cmd.cpp # src/table/gameopt_settings.ini # src/table/newgrf_debug_data.h # src/table/settings.ini # src/timetable_gui.cpp # src/toolbar_gui.cpp # src/train_gui.cpp # src/vehicle.cpp # src/vehicle_gui.cpp # src/vehiclelist.cpp # src/viewport.cpp # src/widgets/dropdown.cpp # src/window_gui.h
This commit is contained in:
@@ -26,8 +26,6 @@ enum BuildVehicleWidgets {
|
||||
WID_BV_SHOW_HIDE, ///< Button to hide or show the selected engine.
|
||||
WID_BV_BUILD_SEL, ///< Build button.
|
||||
WID_BV_RENAME, ///< Rename button.
|
||||
WID_BV_BUILD_REFIT,
|
||||
WID_BV_BUILD_REFIT_SEL,
|
||||
};
|
||||
|
||||
#endif /* WIDGETS_BUILD_VEHICLE_WIDGET_H */
|
||||
|
@@ -152,7 +152,7 @@ struct DropdownWindow : Window {
|
||||
DropdownWindow(Window *parent, const DropDownList *list, int selected, int button, bool instant_close, const Point &position, const Dimension &size, Colours wi_colour, bool scroll, DropDownSyncFocus sync_parent_focus)
|
||||
: Window(&_dropdown_desc)
|
||||
{
|
||||
assert(list->Length() > 0);
|
||||
assert(list->size() > 0);
|
||||
|
||||
this->position = position;
|
||||
this->parent_wnd_class = parent->window_class;
|
||||
@@ -178,14 +178,13 @@ struct DropdownWindow : Window {
|
||||
|
||||
/* Total length of list */
|
||||
int list_height = 0;
|
||||
for (const DropDownListItem * const *it = list->Begin(); it != list->End(); ++it) {
|
||||
const DropDownListItem *item = *it;
|
||||
for (const DropDownListItem *item : *list) {
|
||||
list_height += item->Height(items_width);
|
||||
}
|
||||
|
||||
/* Capacity is the average number of items visible */
|
||||
this->vscroll->SetCapacity(size.height * (uint16)list->Length() / list_height);
|
||||
this->vscroll->SetCount((uint16)list->Length());
|
||||
this->vscroll->SetCapacity(size.height * (uint16)list->size() / list_height);
|
||||
this->vscroll->SetCount((uint16)list->size());
|
||||
|
||||
this->parent_button = button;
|
||||
this->list = list;
|
||||
@@ -235,13 +234,10 @@ struct DropdownWindow : Window {
|
||||
int width = nwi->current_x - 4;
|
||||
int pos = this->vscroll->GetPosition();
|
||||
|
||||
const DropDownList *list = this->list;
|
||||
|
||||
for (const DropDownListItem * const *it = list->Begin(); it != list->End(); ++it) {
|
||||
for (const DropDownListItem *item : *this->list) {
|
||||
/* Skip items that are scrolled up */
|
||||
if (--pos >= 0) continue;
|
||||
|
||||
const DropDownListItem *item = *it;
|
||||
int item_height = item->Height(width);
|
||||
|
||||
if (y < item_height) {
|
||||
@@ -264,8 +260,7 @@ struct DropdownWindow : Window {
|
||||
|
||||
int y = r.top + 2;
|
||||
int pos = this->vscroll->GetPosition();
|
||||
for (const DropDownListItem * const *it = this->list->Begin(); it != this->list->End(); ++it) {
|
||||
const DropDownListItem *item = *it;
|
||||
for (const DropDownListItem *item : *this->list) {
|
||||
int item_height = item->Height(r.right - r.left + 1);
|
||||
|
||||
/* Skip items that are scrolled up */
|
||||
@@ -410,8 +405,7 @@ void ShowDropDownListAt(Window *w, const DropDownList *list, int selected, int b
|
||||
/* Total height of list */
|
||||
uint height = 0;
|
||||
|
||||
for (const DropDownListItem * const *it = list->Begin(); it != list->End(); ++it) {
|
||||
const DropDownListItem *item = *it;
|
||||
for (const DropDownListItem *item : *list) {
|
||||
height += item->Height(width);
|
||||
if (auto_width) max_item_width = max(max_item_width, item->Width() + 5);
|
||||
}
|
||||
@@ -439,7 +433,7 @@ void ShowDropDownListAt(Window *w, const DropDownList *list, int selected, int b
|
||||
/* If the dropdown doesn't fully fit, we need a dropdown. */
|
||||
if (height > available_height) {
|
||||
scroll = true;
|
||||
uint avg_height = height / list->Length();
|
||||
uint avg_height = height / list->size();
|
||||
|
||||
/* Check at least there is space for one item. */
|
||||
assert(available_height >= avg_height);
|
||||
@@ -530,12 +524,12 @@ void ShowDropDownMenu(Window *w, const StringID *strings, int selected, int butt
|
||||
|
||||
for (uint i = 0; strings[i] != INVALID_STRING_ID; i++) {
|
||||
if (i >= 32 || !HasBit(hidden_mask, i)) {
|
||||
*list->Append() = new DropDownListStringItem(strings[i], i, i < 32 && HasBit(disabled_mask, i));
|
||||
list->push_back(new DropDownListStringItem(strings[i], i, i < 32 && HasBit(disabled_mask, i)));
|
||||
}
|
||||
}
|
||||
|
||||
/* No entries in the list? */
|
||||
if (list->Length() == 0) {
|
||||
if (list->size() == 0) {
|
||||
delete list;
|
||||
return;
|
||||
}
|
||||
|
@@ -51,9 +51,9 @@ public:
|
||||
|
||||
DropDownListStringItem(StringID string, int result, bool masked) : DropDownListItem(result, masked), string(string) {}
|
||||
|
||||
virtual bool Selectable() const { return true; }
|
||||
virtual uint Width() const;
|
||||
virtual void Draw(int left, int right, int top, int bottom, bool sel, Colours bg_colour) const;
|
||||
bool Selectable() const override { return true; }
|
||||
uint Width() const override;
|
||||
void Draw(int left, int right, int top, int bottom, bool sel, Colours bg_colour) const override;
|
||||
virtual StringID String() const { return this->string; }
|
||||
|
||||
static int CDECL NatSortFunc(const DropDownListItem * const *first, const DropDownListItem * const *second);
|
||||
@@ -68,8 +68,8 @@ public:
|
||||
|
||||
DropDownListParamStringItem(StringID string, int result, bool masked) : DropDownListStringItem(string, result, masked) {}
|
||||
|
||||
virtual StringID String() const;
|
||||
virtual void SetParam(uint index, uint64 value) { decode_params[index] = value; }
|
||||
StringID String() const override;
|
||||
void SetParam(uint index, uint64 value) { decode_params[index] = value; }
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -81,7 +81,7 @@ public:
|
||||
|
||||
DropDownListCharStringItem(const char *raw_string, int result, bool masked) : DropDownListStringItem(STR_JUST_RAW_STRING, result, masked), raw_string(raw_string) {}
|
||||
|
||||
virtual StringID String() const;
|
||||
StringID String() const override;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -105,7 +105,7 @@ public:
|
||||
/**
|
||||
* A drop down list is a collection of drop down list items.
|
||||
*/
|
||||
typedef AutoDeleteSmallVector<const DropDownListItem *, 4> DropDownList;
|
||||
typedef AutoDeleteSmallVector<const DropDownListItem *> DropDownList;
|
||||
|
||||
void ShowDropDownListAt(Window *w, const DropDownList *list, int selected, int button, Rect wi_rect, Colours wi_colour, bool auto_width = false, bool instant_close = false, DropDownSyncFocus sync_parent_focus = DDSF_NONE);
|
||||
|
||||
|
@@ -34,9 +34,6 @@ enum GroupListWidgets {
|
||||
WID_GL_DELETE_GROUP, ///< Delete group button.
|
||||
WID_GL_RENAME_GROUP, ///< Rename group button.
|
||||
WID_GL_LIVERY_GROUP, ///< Group livery button.
|
||||
WID_GL_COLLAPSE_EXPAND_GROUP, ///< Collapse/expand group button.
|
||||
WID_GL_COLLAPSE_ALL_GROUPS, ///< Collapse all groups button.
|
||||
WID_GL_EXPAND_ALL_GROUPS, ///< Expand all groups button.
|
||||
WID_GL_REPLACE_PROTECTION, ///< Replace protection button.
|
||||
WID_GL_INFO, ///< Group info.
|
||||
};
|
||||
|
Reference in New Issue
Block a user