mirror of https://github.com/OpenTTD/OpenTTD
(svn r16906) -Fix (r12939): Child windows of build toolbars were placed inconsistently.
parent
639a829f87
commit
8083d67780
|
@ -126,7 +126,7 @@ struct BuildAirToolbarWindow : Window {
|
||||||
{
|
{
|
||||||
this->RaiseButtons();
|
this->RaiseButtons();
|
||||||
|
|
||||||
DeleteWindowById(WC_BUILD_STATION, 0);
|
DeleteWindowById(WC_BUILD_STATION, TRANSPORT_AIR);
|
||||||
DeleteWindowById(WC_SELECT_STATION, 0);
|
DeleteWindowById(WC_SELECT_STATION, 0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -202,7 +202,7 @@ enum AirportPickerWidgets {
|
||||||
|
|
||||||
class AirportPickerWindow : public PickerWindowBase {
|
class AirportPickerWindow : public PickerWindowBase {
|
||||||
public:
|
public:
|
||||||
AirportPickerWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent)
|
AirportPickerWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent, TRANSPORT_AIR)
|
||||||
{
|
{
|
||||||
this->SetWidgetLoweredState(BAW_BTN_DONTHILIGHT, !_settings_client.gui.station_show_coverage);
|
this->SetWidgetLoweredState(BAW_BTN_DONTHILIGHT, !_settings_client.gui.station_show_coverage);
|
||||||
this->SetWidgetLoweredState(BAW_BTN_DOHILIGHT, _settings_client.gui.station_show_coverage);
|
this->SetWidgetLoweredState(BAW_BTN_DOHILIGHT, _settings_client.gui.station_show_coverage);
|
||||||
|
|
|
@ -118,7 +118,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BuildBridgeWindow(const WindowDesc *desc, TileIndex start, TileIndex end, uint32 br_type, GUIBridgeList *bl) : Window(desc),
|
BuildBridgeWindow(const WindowDesc *desc, TileIndex start, TileIndex end, uint32 br_type, GUIBridgeList *bl) : Window(desc, GB(br_type, 15, 2)),
|
||||||
start_tile(start),
|
start_tile(start),
|
||||||
end_tile(end),
|
end_tile(end),
|
||||||
type(br_type),
|
type(br_type),
|
||||||
|
@ -308,7 +308,7 @@ static const WindowDesc _build_bridge_desc(
|
||||||
*/
|
*/
|
||||||
void ShowBuildBridgeWindow(TileIndex start, TileIndex end, TransportType transport_type, byte road_rail_type)
|
void ShowBuildBridgeWindow(TileIndex start, TileIndex end, TransportType transport_type, byte road_rail_type)
|
||||||
{
|
{
|
||||||
DeleteWindowById(WC_BUILD_BRIDGE, 0);
|
DeleteWindowByClass(WC_BUILD_BRIDGE);
|
||||||
|
|
||||||
/* Data type for the bridge.
|
/* Data type for the bridge.
|
||||||
* Bit 16,15 = transport type,
|
* Bit 16,15 = transport type,
|
||||||
|
|
|
@ -241,10 +241,10 @@ struct BuildDocksToolbarWindow : Window {
|
||||||
{
|
{
|
||||||
this->RaiseButtons();
|
this->RaiseButtons();
|
||||||
|
|
||||||
DeleteWindowById(WC_BUILD_STATION, 0);
|
DeleteWindowById(WC_BUILD_STATION, TRANSPORT_WATER);
|
||||||
DeleteWindowById(WC_BUILD_DEPOT, 0);
|
DeleteWindowById(WC_BUILD_DEPOT, TRANSPORT_WATER);
|
||||||
DeleteWindowById(WC_SELECT_STATION, 0);
|
DeleteWindowById(WC_SELECT_STATION, 0);
|
||||||
DeleteWindowById(WC_BUILD_BRIDGE, 0);
|
DeleteWindowByClass(WC_BUILD_BRIDGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnPlacePresize(Point pt, TileIndex tile_from)
|
virtual void OnPlacePresize(Point pt, TileIndex tile_from)
|
||||||
|
@ -341,7 +341,7 @@ struct BuildDocksStationWindow : public PickerWindowBase {
|
||||||
public:
|
public:
|
||||||
BuildDocksStationWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(parent)
|
BuildDocksStationWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(parent)
|
||||||
{
|
{
|
||||||
this->InitNested(desc);
|
this->InitNested(desc, TRANSPORT_WATER);
|
||||||
this->LowerWidget(_settings_client.gui.station_show_coverage + BDSW_LT_OFF);
|
this->LowerWidget(_settings_client.gui.station_show_coverage + BDSW_LT_OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -447,7 +447,7 @@ private:
|
||||||
public:
|
public:
|
||||||
BuildDocksDepotWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(parent)
|
BuildDocksDepotWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(parent)
|
||||||
{
|
{
|
||||||
this->InitNested(desc);
|
this->InitNested(desc, TRANSPORT_WATER);
|
||||||
this->LowerWidget(_ship_depot_direction + BDDW_X);
|
this->LowerWidget(_ship_depot_direction + BDDW_X);
|
||||||
UpdateDocksDirection();
|
UpdateDocksDirection();
|
||||||
}
|
}
|
||||||
|
|
|
@ -766,11 +766,11 @@ struct BuildRailToolbarWindow : Window {
|
||||||
this->DisableWidget(RTW_REMOVE);
|
this->DisableWidget(RTW_REMOVE);
|
||||||
this->InvalidateWidget(RTW_REMOVE);
|
this->InvalidateWidget(RTW_REMOVE);
|
||||||
|
|
||||||
DeleteWindowById(WC_BUILD_SIGNAL, 0);
|
DeleteWindowById(WC_BUILD_SIGNAL, TRANSPORT_RAIL);
|
||||||
DeleteWindowById(WC_BUILD_STATION, 0);
|
DeleteWindowById(WC_BUILD_STATION, TRANSPORT_RAIL);
|
||||||
DeleteWindowById(WC_BUILD_DEPOT, 0);
|
DeleteWindowById(WC_BUILD_DEPOT, TRANSPORT_RAIL);
|
||||||
DeleteWindowById(WC_SELECT_STATION, 0);
|
DeleteWindowById(WC_SELECT_STATION, 0);
|
||||||
DeleteWindowById(WC_BUILD_BRIDGE, 0);
|
DeleteWindowByClass(WC_BUILD_BRIDGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnPlacePresize(Point pt, TileIndex tile)
|
virtual void OnPlacePresize(Point pt, TileIndex tile)
|
||||||
|
@ -986,7 +986,7 @@ public:
|
||||||
BuildRailStationWindow(const WindowDesc *desc, Window *parent, bool newstation) : PickerWindowBase(parent)
|
BuildRailStationWindow(const WindowDesc *desc, Window *parent, bool newstation) : PickerWindowBase(parent)
|
||||||
{
|
{
|
||||||
this->line_height = FONT_HEIGHT_NORMAL + 4;
|
this->line_height = FONT_HEIGHT_NORMAL + 4;
|
||||||
this->InitNested(desc);
|
this->InitNested(desc, TRANSPORT_RAIL);
|
||||||
|
|
||||||
this->LowerWidget(_railstation.orientation + BRSW_PLATFORM_DIR_X);
|
this->LowerWidget(_railstation.orientation + BRSW_PLATFORM_DIR_X);
|
||||||
if (_settings_client.gui.station_dragdrop) {
|
if (_settings_client.gui.station_dragdrop) {
|
||||||
|
@ -1470,7 +1470,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BuildSignalWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent)
|
BuildSignalWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent, TRANSPORT_RAIL)
|
||||||
{
|
{
|
||||||
this->FindWindowPlacementAndResize(desc);
|
this->FindWindowPlacementAndResize(desc);
|
||||||
};
|
};
|
||||||
|
@ -1639,7 +1639,7 @@ enum BuildRailDepotWidgets {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BuildRailDepotWindow : public PickerWindowBase {
|
struct BuildRailDepotWindow : public PickerWindowBase {
|
||||||
BuildRailDepotWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent)
|
BuildRailDepotWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent, TRANSPORT_RAIL)
|
||||||
{
|
{
|
||||||
this->LowerWidget(_build_depot_direction + BRDW_DEPOT_NE);
|
this->LowerWidget(_build_depot_direction + BRDW_DEPOT_NE);
|
||||||
this->FindWindowPlacementAndResize(desc);
|
this->FindWindowPlacementAndResize(desc);
|
||||||
|
@ -1740,7 +1740,7 @@ enum BuildRailWaypointWidgets {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BuildRailWaypointWindow : PickerWindowBase {
|
struct BuildRailWaypointWindow : PickerWindowBase {
|
||||||
BuildRailWaypointWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent)
|
BuildRailWaypointWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent, TRANSPORT_RAIL)
|
||||||
{
|
{
|
||||||
this->hscroll.cap = 5;
|
this->hscroll.cap = 5;
|
||||||
this->hscroll.count = _waypoint_count;
|
this->hscroll.count = _waypoint_count;
|
||||||
|
|
|
@ -528,11 +528,11 @@ struct BuildRoadToolbarWindow : Window {
|
||||||
this->InvalidateWidget(RTW_REMOVE);
|
this->InvalidateWidget(RTW_REMOVE);
|
||||||
this->InvalidateWidget(RTW_ONE_WAY);
|
this->InvalidateWidget(RTW_ONE_WAY);
|
||||||
|
|
||||||
DeleteWindowById(WC_BUS_STATION, 0);
|
DeleteWindowById(WC_BUS_STATION, TRANSPORT_ROAD);
|
||||||
DeleteWindowById(WC_TRUCK_STATION, 0);
|
DeleteWindowById(WC_TRUCK_STATION, TRANSPORT_ROAD);
|
||||||
DeleteWindowById(WC_BUILD_DEPOT, 0);
|
DeleteWindowById(WC_BUILD_DEPOT, TRANSPORT_ROAD);
|
||||||
DeleteWindowById(WC_SELECT_STATION, 0);
|
DeleteWindowById(WC_SELECT_STATION, 0);
|
||||||
DeleteWindowById(WC_BUILD_BRIDGE, 0);
|
DeleteWindowByClass(WC_BUILD_BRIDGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt)
|
virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt)
|
||||||
|
@ -796,7 +796,7 @@ enum BuildRoadDepotWidgets {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BuildRoadDepotWindow : public PickerWindowBase {
|
struct BuildRoadDepotWindow : public PickerWindowBase {
|
||||||
BuildRoadDepotWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent)
|
BuildRoadDepotWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent, TRANSPORT_ROAD)
|
||||||
{
|
{
|
||||||
this->LowerWidget(_road_depot_orientation + BRDW_DEPOT_NE);
|
this->LowerWidget(_road_depot_orientation + BRDW_DEPOT_NE);
|
||||||
if ( _cur_roadtype == ROADTYPE_TRAM) {
|
if ( _cur_roadtype == ROADTYPE_TRAM) {
|
||||||
|
@ -907,7 +907,7 @@ enum BuildRoadStationWidgets {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BuildRoadStationWindow : public PickerWindowBase {
|
struct BuildRoadStationWindow : public PickerWindowBase {
|
||||||
BuildRoadStationWindow(const WindowDesc *desc, Window *parent, RoadStopType rs) : PickerWindowBase(desc, parent)
|
BuildRoadStationWindow(const WindowDesc *desc, Window *parent, RoadStopType rs) : PickerWindowBase(desc, parent, TRANSPORT_ROAD)
|
||||||
{
|
{
|
||||||
/* Trams don't have non-drivethrough stations */
|
/* Trams don't have non-drivethrough stations */
|
||||||
if (_cur_roadtype == ROADTYPE_TRAM && _road_station_picker_orientation < DIAGDIR_END) {
|
if (_cur_roadtype == ROADTYPE_TRAM && _road_station_picker_orientation < DIAGDIR_END) {
|
||||||
|
|
|
@ -1198,7 +1198,7 @@ restart:
|
||||||
*
|
*
|
||||||
* By default position a child window at an offset of 10/10 of its parent.
|
* By default position a child window at an offset of 10/10 of its parent.
|
||||||
* With the exception of WC_BUILD_TOOLBAR (build railway/roads/ship docks/airports)
|
* With the exception of WC_BUILD_TOOLBAR (build railway/roads/ship docks/airports)
|
||||||
* and WC_SCEN_LAND_GEN (landscaping). Whose child window has an offset of 0/36 of
|
* and WC_SCEN_LAND_GEN (landscaping). Whose child window has an offset of 0/toolbar-height of
|
||||||
* its parent. So it's exactly under the parent toolbar and no buttons will be covered.
|
* its parent. So it's exactly under the parent toolbar and no buttons will be covered.
|
||||||
* However if it falls too extremely outside window positions, reposition
|
* However if it falls too extremely outside window positions, reposition
|
||||||
* it to an automatic place.
|
* it to an automatic place.
|
||||||
|
@ -1226,7 +1226,7 @@ static Point LocalGetWindowPlacement(const WindowDesc *desc, int16 sm_width, int
|
||||||
if (pt.x > _screen.width + 10 - default_width) {
|
if (pt.x > _screen.width + 10 - default_width) {
|
||||||
pt.x = (_screen.width + 10 - default_width) - 20;
|
pt.x = (_screen.width + 10 - default_width) - 20;
|
||||||
}
|
}
|
||||||
pt.y = w->top + ((desc->parent_cls == WC_BUILD_TOOLBAR || desc->parent_cls == WC_SCEN_LAND_GEN) ? 36 : 10);
|
pt.y = w->top + ((desc->parent_cls == WC_BUILD_TOOLBAR || desc->parent_cls == WC_SCEN_LAND_GEN) ? w->height : 10);
|
||||||
} else {
|
} else {
|
||||||
switch (desc->left) {
|
switch (desc->left) {
|
||||||
case WDP_ALIGN_TBR: // Align the right side with the top toolbar
|
case WDP_ALIGN_TBR: // Align the right side with the top toolbar
|
||||||
|
|
|
@ -709,7 +709,7 @@ public:
|
||||||
class PickerWindowBase : public Window {
|
class PickerWindowBase : public Window {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PickerWindowBase(const WindowDesc *desc, Window *parent) : Window(desc)
|
PickerWindowBase(const WindowDesc *desc, Window *parent, WindowNumber number = 0) : Window(desc, number)
|
||||||
{
|
{
|
||||||
this->parent = parent;
|
this->parent = parent;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue