2007-06-20 19:26:25 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
|
|
|
/** @file timetable_gui.cpp */
|
|
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include "openttd.h"
|
|
|
|
#include "variables.h"
|
2007-12-21 21:50:46 +00:00
|
|
|
#include "command_func.h"
|
2007-06-20 19:26:25 +00:00
|
|
|
#include "gui.h"
|
2007-12-19 20:45:46 +00:00
|
|
|
#include "window_gui.h"
|
|
|
|
#include "textbuf_gui.h"
|
2007-06-20 19:26:25 +00:00
|
|
|
#include "cargotype.h"
|
|
|
|
#include "depot.h"
|
2007-12-21 19:49:27 +00:00
|
|
|
#include "strings_func.h"
|
2007-12-27 13:35:39 +00:00
|
|
|
#include "vehicle_base.h"
|
2008-01-07 14:23:25 +00:00
|
|
|
#include "string_func.h"
|
2008-01-09 09:45:45 +00:00
|
|
|
#include "gfx_func.h"
|
2008-01-12 14:10:35 +00:00
|
|
|
#include "player_func.h"
|
2008-01-13 14:37:30 +00:00
|
|
|
#include "settings_type.h"
|
2007-06-20 19:26:25 +00:00
|
|
|
|
2008-01-13 01:21:35 +00:00
|
|
|
#include "table/strings.h"
|
|
|
|
|
2008-03-23 06:56:33 +00:00
|
|
|
enum TimetableViewWindowWidgets {
|
|
|
|
TTV_WIDGET_CLOSEBOX = 0,
|
|
|
|
TTV_CAPTION,
|
2008-03-27 14:34:29 +00:00
|
|
|
TTV_ORDER_VIEW,
|
2008-03-23 06:56:33 +00:00
|
|
|
TTV_STICKY,
|
|
|
|
TTV_TIMETABLE_PANEL,
|
|
|
|
TTV_SCROLLBAR,
|
|
|
|
TTV_SUMMARY_PANEL,
|
|
|
|
TTV_CHANGE_TIME,
|
|
|
|
TTV_CLEAR_TIME,
|
|
|
|
TTV_RESET_LATENESS,
|
|
|
|
TTV_AUTOFILL,
|
|
|
|
TTV_EMPTY,
|
|
|
|
TTV_RESIZE,
|
|
|
|
};
|
|
|
|
|
2008-04-11 21:19:03 +00:00
|
|
|
struct timetable_d {
|
|
|
|
int sel;
|
|
|
|
};
|
|
|
|
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(timetable_d));
|
|
|
|
|
2007-06-20 19:26:25 +00:00
|
|
|
static int GetOrderFromTimetableWndPt(Window *w, int y, const Vehicle *v)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Calculation description:
|
2008-04-11 21:19:03 +00:00
|
|
|
* 15 = 14 (w->widget[TTV_ORDER_VIEW].top) + 1 (frame-line)
|
2007-06-20 19:26:25 +00:00
|
|
|
* 10 = order text hight
|
|
|
|
*/
|
|
|
|
int sel = (y - 15) / 10;
|
|
|
|
|
|
|
|
if ((uint)sel >= w->vscroll.cap) return INVALID_ORDER;
|
|
|
|
|
|
|
|
sel += w->vscroll.pos;
|
|
|
|
|
|
|
|
return (sel <= v->num_orders * 2 && sel >= 0) ? sel : INVALID_ORDER;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void SetTimetableParams(int param1, int param2, uint32 time)
|
|
|
|
{
|
|
|
|
if (_patches.timetable_in_ticks) {
|
|
|
|
SetDParam(param1, STR_TIMETABLE_TICKS);
|
|
|
|
SetDParam(param2, time);
|
|
|
|
} else {
|
|
|
|
SetDParam(param1, STR_TIMETABLE_DAYS);
|
|
|
|
SetDParam(param2, time / DAY_TICKS);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void DrawTimetableWindow(Window *w)
|
|
|
|
{
|
|
|
|
const Vehicle *v = GetVehicle(w->window_number);
|
2008-04-11 21:19:03 +00:00
|
|
|
int selected = WP(w, timetable_d).sel;
|
2007-06-20 19:26:25 +00:00
|
|
|
|
|
|
|
SetVScrollCount(w, v->num_orders * 2);
|
|
|
|
|
|
|
|
if (v->owner == _local_player) {
|
|
|
|
if (selected == -1) {
|
2008-03-23 06:56:33 +00:00
|
|
|
w->DisableWidget(TTV_CHANGE_TIME);
|
|
|
|
w->DisableWidget(TTV_CLEAR_TIME);
|
2007-06-20 19:26:25 +00:00
|
|
|
} else if (selected % 2 == 1) {
|
2008-03-23 06:56:33 +00:00
|
|
|
w->EnableWidget(TTV_CHANGE_TIME);
|
|
|
|
w->EnableWidget(TTV_CLEAR_TIME);
|
2007-06-20 19:26:25 +00:00
|
|
|
} else {
|
|
|
|
const Order *order = GetVehicleOrder(v, (selected + 1) / 2);
|
2008-04-07 08:59:04 +00:00
|
|
|
bool disable = order == NULL || !order->IsType(OT_GOTO_STATION) || (order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION);
|
2007-06-20 19:26:25 +00:00
|
|
|
|
2008-03-23 06:56:33 +00:00
|
|
|
w->SetWidgetDisabledState(TTV_CHANGE_TIME, disable);
|
|
|
|
w->SetWidgetDisabledState(TTV_CLEAR_TIME, disable);
|
2007-06-20 19:26:25 +00:00
|
|
|
}
|
|
|
|
|
2008-03-23 06:56:33 +00:00
|
|
|
w->EnableWidget(TTV_RESET_LATENESS);
|
|
|
|
w->EnableWidget(TTV_AUTOFILL);
|
2007-06-20 19:26:25 +00:00
|
|
|
} else {
|
2008-03-23 06:56:33 +00:00
|
|
|
w->DisableWidget(TTV_CHANGE_TIME);
|
|
|
|
w->DisableWidget(TTV_CLEAR_TIME);
|
|
|
|
w->DisableWidget(TTV_RESET_LATENESS);
|
|
|
|
w->DisableWidget(TTV_AUTOFILL);
|
2007-06-20 19:26:25 +00:00
|
|
|
}
|
|
|
|
|
2008-03-23 06:56:33 +00:00
|
|
|
w->SetWidgetLoweredState(TTV_AUTOFILL, HasBit(v->vehicle_flags, VF_AUTOFILL_TIMETABLE));
|
2007-06-25 20:55:43 +00:00
|
|
|
|
2007-06-24 22:42:11 +00:00
|
|
|
SetDParam(0, v->index);
|
2007-06-20 19:26:25 +00:00
|
|
|
DrawWindowWidgets(w);
|
|
|
|
|
|
|
|
int y = 15;
|
|
|
|
int i = w->vscroll.pos;
|
|
|
|
VehicleOrderID order_id = (i + 1) / 2;
|
|
|
|
bool final_order = false;
|
|
|
|
|
|
|
|
const Order *order = GetVehicleOrder(v, order_id);
|
|
|
|
|
|
|
|
while (order != NULL) {
|
|
|
|
/* Don't draw anything if it extends past the end of the window. */
|
|
|
|
if (i - w->vscroll.pos >= w->vscroll.cap) break;
|
|
|
|
|
|
|
|
if (i % 2 == 0) {
|
|
|
|
SetDParam(2, STR_EMPTY);
|
|
|
|
|
2008-04-05 23:36:54 +00:00
|
|
|
switch (order->GetType()) {
|
2007-07-23 19:24:32 +00:00
|
|
|
case OT_DUMMY:
|
|
|
|
SetDParam(0, STR_INVALID_ORDER);
|
|
|
|
break;
|
|
|
|
|
2007-06-20 19:26:25 +00:00
|
|
|
case OT_GOTO_STATION:
|
2008-04-09 22:01:23 +00:00
|
|
|
SetDParam(0, STR_GO_TO_STATION);
|
|
|
|
SetDParam(1, STR_ORDER_GO_TO + order->GetNonStopType());
|
|
|
|
SetDParam(2, order->GetDestination());
|
|
|
|
SetDParam(3, STR_EMPTY);
|
2007-06-20 19:26:25 +00:00
|
|
|
|
|
|
|
if (order->wait_time > 0) {
|
2008-04-09 22:01:23 +00:00
|
|
|
SetDParam(4, STR_TIMETABLE_STAY_FOR);
|
|
|
|
SetTimetableParams(5, 6, order->wait_time);
|
|
|
|
} else {
|
|
|
|
SetDParam(4, STR_EMPTY);
|
2007-06-20 19:26:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
2008-04-11 14:27:18 +00:00
|
|
|
case OT_GOTO_DEPOT:
|
2008-04-12 11:15:25 +00:00
|
|
|
SetDParam(4, STR_EMPTY);
|
2007-06-20 19:26:25 +00:00
|
|
|
if (v->type == VEH_AIRCRAFT) {
|
2008-04-11 15:58:46 +00:00
|
|
|
if (order->GetDepotActionType() & ODATFB_NEAREST_DEPOT) {
|
2008-04-12 11:15:25 +00:00
|
|
|
SetDParam(0, STR_GO_TO_NEAREST_DEPOT);
|
|
|
|
SetDParam(2, STR_ORDER_NEAREST_HANGAR);
|
2008-04-11 15:58:46 +00:00
|
|
|
} else {
|
2008-04-12 11:15:25 +00:00
|
|
|
SetDParam(0, STR_GO_TO_HANGAR);
|
|
|
|
SetDParam(2, order->GetDestination());
|
2008-04-11 15:58:46 +00:00
|
|
|
}
|
2008-04-12 11:15:25 +00:00
|
|
|
SetDParam(3, STR_EMPTY);
|
2007-06-20 19:26:25 +00:00
|
|
|
} else {
|
2008-04-11 15:58:46 +00:00
|
|
|
if (order->GetDepotActionType() & ODATFB_NEAREST_DEPOT) {
|
2008-04-12 11:15:25 +00:00
|
|
|
SetDParam(0, STR_GO_TO_NEAREST_DEPOT);
|
|
|
|
SetDParam(2, STR_ORDER_NEAREST_DEPOT);
|
2008-04-11 15:58:46 +00:00
|
|
|
} else {
|
2008-04-12 11:15:25 +00:00
|
|
|
SetDParam(0, STR_GO_TO_DEPOT);
|
|
|
|
SetDParam(2, GetDepot(order->GetDestination())->town_index);
|
2008-04-11 15:58:46 +00:00
|
|
|
}
|
2007-06-20 19:26:25 +00:00
|
|
|
|
|
|
|
switch (v->type) {
|
2008-04-11 14:27:18 +00:00
|
|
|
case VEH_TRAIN: SetDParam(3, STR_ORDER_TRAIN_DEPOT); break;
|
|
|
|
case VEH_ROAD: SetDParam(3, STR_ORDER_ROAD_DEPOT); break;
|
|
|
|
case VEH_SHIP: SetDParam(3, STR_ORDER_SHIP_DEPOT); break;
|
|
|
|
default: NOT_REACHED();
|
2007-06-20 19:26:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-04-11 14:27:18 +00:00
|
|
|
if (order->GetDepotOrderType() & ODTFB_SERVICE) {
|
|
|
|
SetDParam(1, (order->GetNonStopType() & ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS) ? STR_ORDER_SERVICE_NON_STOP_AT : STR_ORDER_SERVICE_AT);
|
|
|
|
} else {
|
|
|
|
SetDParam(1, (order->GetNonStopType() & ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS) ? STR_ORDER_GO_NON_STOP_TO : STR_ORDER_GO_TO);
|
|
|
|
}
|
|
|
|
break;
|
2007-06-20 19:26:25 +00:00
|
|
|
|
|
|
|
case OT_GOTO_WAYPOINT:
|
2008-04-07 08:59:04 +00:00
|
|
|
SetDParam(0, (order->GetNonStopType() != ONSF_STOP_EVERYWHERE) ? STR_GO_NON_STOP_TO_WAYPOINT : STR_GO_TO_WAYPOINT);
|
2008-04-06 07:48:51 +00:00
|
|
|
SetDParam(1, order->GetDestination());
|
2007-06-20 19:26:25 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default: break;
|
|
|
|
}
|
|
|
|
|
2007-11-04 00:08:57 +00:00
|
|
|
DrawString(2, y, STR_TIMETABLE_GO_TO, (i == selected) ? TC_WHITE : TC_BLACK);
|
2007-06-20 19:26:25 +00:00
|
|
|
|
|
|
|
order_id++;
|
|
|
|
|
|
|
|
if (order_id >= v->num_orders) {
|
|
|
|
order = GetVehicleOrder(v, 0);
|
|
|
|
final_order = true;
|
|
|
|
} else {
|
|
|
|
order = order->next;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
StringID string;
|
|
|
|
|
|
|
|
if (order->travel_time == 0) {
|
|
|
|
string = STR_TIMETABLE_TRAVEL_NOT_TIMETABLED;
|
|
|
|
} else {
|
|
|
|
SetTimetableParams(0, 1, order->travel_time);
|
|
|
|
string = STR_TIMETABLE_TRAVEL_FOR;
|
|
|
|
}
|
|
|
|
|
2007-11-04 00:08:57 +00:00
|
|
|
DrawString(12, y, string, (i == selected) ? TC_WHITE : TC_BLACK);
|
2007-06-20 19:26:25 +00:00
|
|
|
|
|
|
|
if (final_order) break;
|
|
|
|
}
|
|
|
|
|
|
|
|
i++;
|
|
|
|
y += 10;
|
|
|
|
}
|
|
|
|
|
2008-03-23 06:56:33 +00:00
|
|
|
y = w->widget[TTV_SUMMARY_PANEL].top + 1;
|
2007-06-20 19:26:25 +00:00
|
|
|
|
2007-06-26 11:01:06 +00:00
|
|
|
{
|
|
|
|
uint total_time = 0;
|
|
|
|
bool complete = true;
|
|
|
|
|
|
|
|
for (const Order *order = GetVehicleOrder(v, 0); order != NULL; order = order->next) {
|
|
|
|
total_time += order->travel_time + order->wait_time;
|
|
|
|
if (order->travel_time == 0) complete = false;
|
2008-04-07 08:59:04 +00:00
|
|
|
if (order->wait_time == 0 && order->IsType(OT_GOTO_STATION) && !(order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION)) complete = false;
|
2007-06-26 11:01:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (total_time != 0) {
|
|
|
|
SetTimetableParams(0, 1, total_time);
|
2007-11-04 00:08:57 +00:00
|
|
|
DrawString(2, y, complete ? STR_TIMETABLE_TOTAL_TIME : STR_TIMETABLE_TOTAL_TIME_INCOMPLETE, TC_BLACK);
|
2007-06-26 11:01:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
y += 10;
|
|
|
|
|
2007-06-20 19:26:25 +00:00
|
|
|
if (v->lateness_counter == 0 || (!_patches.timetable_in_ticks && v->lateness_counter / DAY_TICKS == 0)) {
|
2007-11-04 00:08:57 +00:00
|
|
|
DrawString(2, y, STR_TIMETABLE_STATUS_ON_TIME, TC_BLACK);
|
2007-06-20 19:26:25 +00:00
|
|
|
} else {
|
|
|
|
SetTimetableParams(0, 1, abs(v->lateness_counter));
|
2007-11-04 00:08:57 +00:00
|
|
|
DrawString(2, y, v->lateness_counter < 0 ? STR_TIMETABLE_STATUS_EARLY : STR_TIMETABLE_STATUS_LATE, TC_BLACK);
|
2007-06-20 19:26:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline uint32 PackTimetableArgs(const Vehicle *v, uint selected)
|
|
|
|
{
|
|
|
|
uint order_number = (selected + 1) / 2;
|
|
|
|
uint is_journey = (selected % 2 == 1) ? 1 : 0;
|
|
|
|
|
|
|
|
if (order_number >= v->num_orders) order_number = 0;
|
|
|
|
|
|
|
|
return v->index | (order_number << 16) | (is_journey << 24);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void TimetableWndProc(Window *w, WindowEvent *we)
|
|
|
|
{
|
|
|
|
switch (we->event) {
|
|
|
|
case WE_PAINT:
|
|
|
|
DrawTimetableWindow(w);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WE_CLICK: {
|
|
|
|
const Vehicle *v = GetVehicle(w->window_number);
|
|
|
|
|
|
|
|
switch (we->we.click.widget) {
|
2008-03-27 14:34:29 +00:00
|
|
|
case TTV_ORDER_VIEW: /* Order view button */
|
|
|
|
ShowOrdersWindow(v);
|
|
|
|
break;
|
|
|
|
|
2008-03-23 06:56:33 +00:00
|
|
|
case TTV_TIMETABLE_PANEL: { /* Main panel. */
|
2007-06-20 19:26:25 +00:00
|
|
|
int selected = GetOrderFromTimetableWndPt(w, we->we.click.pt.y, v);
|
|
|
|
|
2008-04-11 21:19:03 +00:00
|
|
|
if (selected == INVALID_ORDER || selected == WP(w, timetable_d).sel) {
|
2007-06-20 19:26:25 +00:00
|
|
|
/* Deselect clicked order */
|
2008-04-11 21:19:03 +00:00
|
|
|
WP(w, timetable_d).sel = -1;
|
2007-06-20 19:26:25 +00:00
|
|
|
} else {
|
|
|
|
/* Select clicked order */
|
2008-04-11 21:19:03 +00:00
|
|
|
WP(w, timetable_d).sel = selected;
|
2007-06-20 19:26:25 +00:00
|
|
|
}
|
|
|
|
} break;
|
|
|
|
|
2008-03-23 06:56:33 +00:00
|
|
|
case TTV_CHANGE_TIME: { /* "Wait For" button. */
|
2008-04-11 21:19:03 +00:00
|
|
|
int selected = WP(w, timetable_d).sel;
|
2007-06-20 19:26:25 +00:00
|
|
|
VehicleOrderID real = (selected + 1) / 2;
|
|
|
|
|
|
|
|
if (real >= v->num_orders) real = 0;
|
|
|
|
|
|
|
|
const Order *order = GetVehicleOrder(v, real);
|
|
|
|
StringID current = STR_EMPTY;
|
|
|
|
|
|
|
|
if (order != NULL) {
|
|
|
|
uint time = (selected % 2 == 1) ? order->travel_time : order->wait_time;
|
|
|
|
if (!_patches.timetable_in_ticks) time /= DAY_TICKS;
|
|
|
|
|
|
|
|
if (time != 0) {
|
|
|
|
SetDParam(0, time);
|
|
|
|
current = STR_CONFIG_PATCHES_INT32;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ShowQueryString(current, STR_TIMETABLE_CHANGE_TIME, 31, 150, w, CS_NUMERAL);
|
|
|
|
} break;
|
|
|
|
|
2008-03-23 06:56:33 +00:00
|
|
|
case TTV_CLEAR_TIME: { /* Clear waiting time button. */
|
2008-04-11 21:19:03 +00:00
|
|
|
uint32 p1 = PackTimetableArgs(v, WP(w, timetable_d).sel);
|
2007-06-20 19:26:25 +00:00
|
|
|
DoCommandP(0, p1, 0, NULL, CMD_CHANGE_TIMETABLE | CMD_MSG(STR_CAN_T_TIMETABLE_VEHICLE));
|
|
|
|
} break;
|
|
|
|
|
2008-03-23 06:56:33 +00:00
|
|
|
case TTV_RESET_LATENESS: /* Reset the vehicle's late counter. */
|
2007-06-20 19:26:25 +00:00
|
|
|
DoCommandP(0, v->index, 0, NULL, CMD_SET_VEHICLE_ON_TIME | CMD_MSG(STR_CAN_T_TIMETABLE_VEHICLE));
|
|
|
|
break;
|
2007-06-25 20:55:43 +00:00
|
|
|
|
2008-03-23 06:56:33 +00:00
|
|
|
case TTV_AUTOFILL: /* Autofill the timetable. */
|
2007-11-19 21:02:30 +00:00
|
|
|
DoCommandP(0, v->index, HasBit(v->vehicle_flags, VF_AUTOFILL_TIMETABLE) ? 0 : 1, NULL, CMD_AUTOFILL_TIMETABLE | CMD_MSG(STR_CAN_T_TIMETABLE_VEHICLE));
|
2007-06-25 20:55:43 +00:00
|
|
|
break;
|
2007-06-20 19:26:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SetWindowDirty(w);
|
|
|
|
} break;
|
|
|
|
|
|
|
|
case WE_ON_EDIT_TEXT: {
|
|
|
|
const Vehicle *v = GetVehicle(w->window_number);
|
|
|
|
|
2008-04-11 21:19:03 +00:00
|
|
|
uint32 p1 = PackTimetableArgs(v, WP(w, timetable_d).sel);
|
2007-06-20 19:26:25 +00:00
|
|
|
|
|
|
|
uint64 time = StrEmpty(we->we.edittext.str) ? 0 : strtoul(we->we.edittext.str, NULL, 10);
|
|
|
|
if (!_patches.timetable_in_ticks) time *= DAY_TICKS;
|
|
|
|
|
|
|
|
uint32 p2 = minu(time, MAX_UVALUE(uint16));
|
|
|
|
|
|
|
|
DoCommandP(0, p1, p2, NULL, CMD_CHANGE_TIMETABLE | CMD_MSG(STR_CAN_T_TIMETABLE_VEHICLE));
|
|
|
|
} break;
|
|
|
|
|
|
|
|
case WE_RESIZE:
|
|
|
|
/* Update the scroll + matrix */
|
2008-03-23 06:56:33 +00:00
|
|
|
w->vscroll.cap = (w->widget[TTV_TIMETABLE_PANEL].bottom - w->widget[TTV_TIMETABLE_PANEL].top) / 10;
|
2007-06-20 19:26:25 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static const Widget _timetable_widgets[] = {
|
2008-03-23 06:56:33 +00:00
|
|
|
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // TTV_WIDGET_CLOSEBOX
|
2008-03-27 14:34:29 +00:00
|
|
|
{ WWT_CAPTION, RESIZE_RIGHT, 14, 11, 326, 0, 13, STR_TIMETABLE_TITLE, STR_018C_WINDOW_TITLE_DRAG_THIS}, // TTV_CAPTION
|
|
|
|
{ WWT_PUSHTXTBTN, RESIZE_LR, 14, 327, 387, 0, 13, STR_ORDER_VIEW, STR_ORDER_VIEW_TOOLTIP}, // TTV_ORDER_VIEW
|
2008-03-23 06:56:33 +00:00
|
|
|
{ WWT_STICKYBOX, RESIZE_LR, 14, 388, 399, 0, 13, STR_NULL, STR_STICKY_BUTTON}, // TTV_STICKY
|
2007-06-20 19:26:25 +00:00
|
|
|
|
2008-03-23 06:56:33 +00:00
|
|
|
{ WWT_PANEL, RESIZE_RB, 14, 0, 387, 14, 95, STR_NULL, STR_TIMETABLE_TOOLTIP}, // TTV_TIMETABLE_PANEL
|
|
|
|
{ WWT_SCROLLBAR, RESIZE_LRB, 14, 388, 399, 14, 95, STR_NULL, STR_0190_SCROLL_BAR_SCROLLS_LIST}, // TTV_SCROLLBAR
|
2007-06-20 19:26:25 +00:00
|
|
|
|
2008-03-23 06:56:33 +00:00
|
|
|
{ WWT_PANEL, RESIZE_RTB, 14, 0, 399, 96, 117, STR_NULL, STR_NULL}, // TTV_SUMMARY_PANEL
|
2007-06-20 19:26:25 +00:00
|
|
|
|
2008-03-23 06:56:33 +00:00
|
|
|
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 0, 109, 118, 129, STR_TIMETABLE_CHANGE_TIME, STR_TIMETABLE_WAIT_TIME_TOOLTIP}, // TTV_CHANGE_TIME
|
|
|
|
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 110, 219, 118, 129, STR_CLEAR_TIME, STR_TIMETABLE_CLEAR_TIME_TOOLTIP}, // TTV_CLEAR_TIME
|
|
|
|
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 220, 337, 118, 129, STR_RESET_LATENESS, STR_TIMETABLE_RESET_LATENESS_TOOLTIP}, // TTV_RESET_LATENESS
|
|
|
|
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 338, 387, 118, 129, STR_TIMETABLE_AUTOFILL, STR_TIMETABLE_AUTOFILL_TOOLTIP}, // TTV_AUTOFILL
|
2007-06-20 19:26:25 +00:00
|
|
|
|
2008-03-23 06:56:33 +00:00
|
|
|
{ WWT_PANEL, RESIZE_RTB, 14, 388, 387, 118, 129, STR_NULL, STR_NULL}, // TTV_EMPTY
|
|
|
|
{ WWT_RESIZEBOX, RESIZE_LRTB, 14, 388, 399, 118, 129, STR_NULL, STR_RESIZE_BUTTON}, // TTV_RESIZE
|
2007-06-20 19:26:25 +00:00
|
|
|
|
|
|
|
{ WIDGETS_END }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const WindowDesc _timetable_desc = {
|
2007-07-27 12:49:04 +00:00
|
|
|
WDP_AUTO, WDP_AUTO, 400, 130, 400, 130,
|
2007-06-20 19:26:25 +00:00
|
|
|
WC_VEHICLE_TIMETABLE, WC_VEHICLE_VIEW,
|
|
|
|
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE,
|
|
|
|
_timetable_widgets,
|
|
|
|
TimetableWndProc
|
|
|
|
};
|
|
|
|
|
|
|
|
void ShowTimetableWindow(const Vehicle *v)
|
|
|
|
{
|
|
|
|
Window *w = AllocateWindowDescFront(&_timetable_desc, v->index);
|
|
|
|
|
|
|
|
if (w != NULL) {
|
|
|
|
w->caption_color = v->owner;
|
2007-06-25 10:49:31 +00:00
|
|
|
w->vscroll.cap = 8;
|
2007-06-20 19:26:25 +00:00
|
|
|
w->resize.step_height = 10;
|
2008-04-11 21:19:03 +00:00
|
|
|
WP(w, timetable_d).sel = -1;
|
2007-06-20 19:26:25 +00:00
|
|
|
}
|
|
|
|
}
|