2007-06-20 19:26:25 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
2008-05-06 15:11:33 +00:00
|
|
|
/** @file timetable_gui.cpp GUI for time tabling. */
|
2007-06-20 19:26:25 +00:00
|
|
|
|
|
|
|
#include "stdafx.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"
|
2009-01-03 23:32:59 +00:00
|
|
|
#include "window_func.h"
|
2007-12-19 20:45:46 +00:00
|
|
|
#include "textbuf_gui.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-09-30 20:51:04 +00:00
|
|
|
#include "company_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-14 12:40:09 +00:00
|
|
|
void SetTimetableParams(int param1, int param2, uint32 time)
|
2007-06-20 19:26:25 +00:00
|
|
|
{
|
2008-05-29 15:13:28 +00:00
|
|
|
if (_settings_client.gui.timetable_in_ticks) {
|
2007-06-20 19:26:25 +00:00
|
|
|
SetDParam(param1, STR_TIMETABLE_TICKS);
|
|
|
|
SetDParam(param2, time);
|
|
|
|
} else {
|
|
|
|
SetDParam(param1, STR_TIMETABLE_DAYS);
|
|
|
|
SetDParam(param2, time / DAY_TICKS);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-16 13:39:25 +00:00
|
|
|
struct TimetableWindow : Window {
|
|
|
|
int sel_index;
|
2008-09-24 16:40:06 +00:00
|
|
|
const Vehicle *vehicle;
|
2007-06-20 19:26:25 +00:00
|
|
|
|
2008-05-16 13:39:25 +00:00
|
|
|
TimetableWindow(const WindowDesc *desc, WindowNumber window_number) : Window(desc, window_number)
|
|
|
|
{
|
2008-09-24 16:40:06 +00:00
|
|
|
this->vehicle = GetVehicle(window_number);
|
2009-02-09 02:33:10 +00:00
|
|
|
this->owner = this->vehicle->owner;
|
2008-05-16 13:39:25 +00:00
|
|
|
this->vscroll.cap = 8;
|
|
|
|
this->resize.step_height = 10;
|
|
|
|
this->sel_index = -1;
|
2008-05-23 23:02:13 +00:00
|
|
|
|
|
|
|
this->FindWindowPlacementAndResize(desc);
|
2008-05-16 13:39:25 +00:00
|
|
|
}
|
2007-06-20 19:26:25 +00:00
|
|
|
|
2008-05-16 13:39:25 +00:00
|
|
|
int GetOrderFromTimetableWndPt(int y, const Vehicle *v)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Calculation description:
|
|
|
|
* 15 = 14 (this->widget[TTV_ORDER_VIEW].top) + 1 (frame-line)
|
|
|
|
* 10 = order text hight
|
|
|
|
*/
|
|
|
|
int sel = (y - 15) / 10;
|
|
|
|
|
|
|
|
if ((uint)sel >= this->vscroll.cap) return INVALID_ORDER;
|
|
|
|
|
|
|
|
sel += this->vscroll.pos;
|
|
|
|
|
2009-01-03 13:20:32 +00:00
|
|
|
return (sel < v->GetNumOrders() * 2 && sel >= 0) ? sel : INVALID_ORDER;
|
2007-06-20 19:26:25 +00:00
|
|
|
}
|
|
|
|
|
2008-09-24 16:40:06 +00:00
|
|
|
virtual void OnInvalidateData(int data)
|
2008-05-16 13:39:25 +00:00
|
|
|
{
|
2008-09-24 16:40:06 +00:00
|
|
|
switch (data) {
|
|
|
|
case 0:
|
|
|
|
/* Autoreplace replaced the vehicle */
|
|
|
|
this->vehicle = GetVehicle(this->window_number);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case -1:
|
|
|
|
/* Removed / replaced all orders (after deleting / sharing) */
|
|
|
|
if (this->sel_index == -1) break;
|
|
|
|
|
|
|
|
this->DeleteChildWindows();
|
|
|
|
this->sel_index = -1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default: {
|
|
|
|
/* Moving an order. If one of these is INVALID_VEH_ORDER_ID, then
|
|
|
|
* the order is being created / removed */
|
|
|
|
if (this->sel_index == -1) break;
|
|
|
|
|
|
|
|
VehicleOrderID from = GB(data, 0, 8);
|
|
|
|
VehicleOrderID to = GB(data, 8, 8);
|
|
|
|
|
|
|
|
if (from == to) break; // no need to change anything
|
|
|
|
|
|
|
|
/* if from == INVALID_VEH_ORDER_ID, one order was added; if to == INVALID_VEH_ORDER_ID, one order was removed */
|
2009-01-03 13:20:32 +00:00
|
|
|
uint old_num_orders = this->vehicle->GetNumOrders() - (uint)(from == INVALID_VEH_ORDER_ID) + (uint)(to == INVALID_VEH_ORDER_ID);
|
2008-09-24 16:40:06 +00:00
|
|
|
|
|
|
|
VehicleOrderID selected_order = (this->sel_index + 1) / 2;
|
|
|
|
if (selected_order == old_num_orders) selected_order = 0; // when last travel time is selected, it belongs to order 0
|
|
|
|
|
|
|
|
bool travel = HasBit(this->sel_index, 0);
|
|
|
|
|
|
|
|
if (from != selected_order) {
|
|
|
|
/* Moving from preceeding order? */
|
|
|
|
selected_order -= (int)(from <= selected_order);
|
|
|
|
/* Moving to preceeding order? */
|
|
|
|
selected_order += (int)(to <= selected_order);
|
|
|
|
} else {
|
|
|
|
/* Now we are modifying the selected order */
|
|
|
|
if (to == INVALID_VEH_ORDER_ID) {
|
|
|
|
/* Deleting selected order */
|
|
|
|
this->DeleteChildWindows();
|
|
|
|
this->sel_index = -1;
|
|
|
|
break;
|
|
|
|
} else {
|
|
|
|
/* Moving selected order */
|
|
|
|
selected_order = to;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* recompute new sel_index */
|
|
|
|
this->sel_index = 2 * selected_order - (int)travel;
|
|
|
|
/* travel time of first order needs special handling */
|
2009-01-03 13:20:32 +00:00
|
|
|
if (this->sel_index == -1) this->sel_index = this->vehicle->GetNumOrders() * 2 - 1;
|
2008-09-24 16:40:06 +00:00
|
|
|
} break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
virtual void OnPaint()
|
|
|
|
{
|
|
|
|
const Vehicle *v = this->vehicle;
|
2008-05-16 13:39:25 +00:00
|
|
|
int selected = this->sel_index;
|
|
|
|
|
2009-01-03 13:20:32 +00:00
|
|
|
SetVScrollCount(this, v->GetNumOrders() * 2);
|
2008-05-16 13:39:25 +00:00
|
|
|
|
2008-09-30 20:39:50 +00:00
|
|
|
if (v->owner == _local_company) {
|
2008-07-14 21:01:49 +00:00
|
|
|
bool disable = true;
|
|
|
|
if (selected != -1) {
|
2009-01-03 13:20:32 +00:00
|
|
|
const Order *order = GetVehicleOrder(v, ((selected + 1) / 2) % v->GetNumOrders());
|
2008-07-14 21:01:49 +00:00
|
|
|
if (selected % 2 == 1) {
|
|
|
|
disable = order != NULL && order->IsType(OT_CONDITIONAL);
|
|
|
|
} else {
|
|
|
|
disable = order == NULL || ((!order->IsType(OT_GOTO_STATION) || (order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION)) && !order->IsType(OT_CONDITIONAL));
|
|
|
|
}
|
2008-05-16 13:39:25 +00:00
|
|
|
}
|
2007-06-20 19:26:25 +00:00
|
|
|
|
2008-07-14 21:01:49 +00:00
|
|
|
this->SetWidgetDisabledState(TTV_CHANGE_TIME, disable);
|
|
|
|
this->SetWidgetDisabledState(TTV_CLEAR_TIME, disable);
|
|
|
|
|
2008-05-16 13:39:25 +00:00
|
|
|
this->EnableWidget(TTV_RESET_LATENESS);
|
|
|
|
this->EnableWidget(TTV_AUTOFILL);
|
|
|
|
} else {
|
|
|
|
this->DisableWidget(TTV_CHANGE_TIME);
|
|
|
|
this->DisableWidget(TTV_CLEAR_TIME);
|
|
|
|
this->DisableWidget(TTV_RESET_LATENESS);
|
|
|
|
this->DisableWidget(TTV_AUTOFILL);
|
|
|
|
}
|
2007-06-20 19:26:25 +00:00
|
|
|
|
2008-05-16 13:39:25 +00:00
|
|
|
this->SetWidgetLoweredState(TTV_AUTOFILL, HasBit(v->vehicle_flags, VF_AUTOFILL_TIMETABLE));
|
2007-06-20 19:26:25 +00:00
|
|
|
|
2008-05-16 13:39:25 +00:00
|
|
|
SetDParam(0, v->index);
|
2008-05-17 12:48:06 +00:00
|
|
|
this->DrawWidgets();
|
2007-06-20 19:26:25 +00:00
|
|
|
|
2008-05-16 13:39:25 +00:00
|
|
|
int y = 15;
|
|
|
|
int i = this->vscroll.pos;
|
|
|
|
VehicleOrderID order_id = (i + 1) / 2;
|
|
|
|
bool final_order = false;
|
2007-06-20 19:26:25 +00:00
|
|
|
|
2008-05-16 13:39:25 +00:00
|
|
|
const Order *order = GetVehicleOrder(v, order_id);
|
2007-06-20 19:26:25 +00:00
|
|
|
|
2008-05-16 13:39:25 +00:00
|
|
|
while (order != NULL) {
|
|
|
|
/* Don't draw anything if it extends past the end of the window. */
|
|
|
|
if (i - this->vscroll.pos >= this->vscroll.cap) break;
|
|
|
|
|
|
|
|
if (i % 2 == 0) {
|
2008-07-14 20:18:06 +00:00
|
|
|
DrawOrderString(v, order, order_id, y, i == selected, true, this->widget[TTV_TIMETABLE_PANEL].right - 4);
|
2007-06-20 19:26:25 +00:00
|
|
|
|
2008-05-16 13:39:25 +00:00
|
|
|
order_id++;
|
|
|
|
|
2009-01-03 13:20:32 +00:00
|
|
|
if (order_id >= v->GetNumOrders()) {
|
2008-05-16 13:39:25 +00:00
|
|
|
order = GetVehicleOrder(v, 0);
|
|
|
|
final_order = true;
|
|
|
|
} else {
|
|
|
|
order = order->next;
|
|
|
|
}
|
2007-06-20 19:26:25 +00:00
|
|
|
} else {
|
2008-05-16 13:39:25 +00:00
|
|
|
StringID string;
|
|
|
|
|
2008-07-14 21:01:49 +00:00
|
|
|
if (order->IsType(OT_CONDITIONAL)) {
|
|
|
|
string = STR_TIMETABLE_NO_TRAVEL;
|
|
|
|
} else if (order->travel_time == 0) {
|
2008-05-16 13:39:25 +00:00
|
|
|
string = STR_TIMETABLE_TRAVEL_NOT_TIMETABLED;
|
|
|
|
} else {
|
|
|
|
SetTimetableParams(0, 1, order->travel_time);
|
|
|
|
string = STR_TIMETABLE_TRAVEL_FOR;
|
|
|
|
}
|
2007-06-20 19:26:25 +00:00
|
|
|
|
2008-07-14 20:18:06 +00:00
|
|
|
DrawStringTruncated(2, y, string, (i == selected) ? TC_WHITE : TC_BLACK, this->widget[TTV_TIMETABLE_PANEL].right - 4);
|
2007-06-20 19:26:25 +00:00
|
|
|
|
2008-05-16 13:39:25 +00:00
|
|
|
if (final_order) break;
|
|
|
|
}
|
|
|
|
|
|
|
|
i++;
|
|
|
|
y += 10;
|
2007-06-20 19:26:25 +00:00
|
|
|
}
|
|
|
|
|
2008-05-16 13:39:25 +00:00
|
|
|
y = this->widget[TTV_SUMMARY_PANEL].top + 1;
|
2007-06-20 19:26:25 +00:00
|
|
|
|
2008-05-16 13:39:25 +00:00
|
|
|
{
|
|
|
|
uint total_time = 0;
|
|
|
|
bool complete = true;
|
2007-06-20 19:26:25 +00:00
|
|
|
|
2008-05-16 13:39:25 +00:00
|
|
|
for (const Order *order = GetVehicleOrder(v, 0); order != NULL; order = order->next) {
|
|
|
|
total_time += order->travel_time + order->wait_time;
|
2008-07-14 21:01:49 +00:00
|
|
|
if (order->travel_time == 0 && !order->IsType(OT_CONDITIONAL)) complete = false;
|
2008-05-16 13:39:25 +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
|
|
|
|
2008-05-16 13:39:25 +00:00
|
|
|
if (total_time != 0) {
|
|
|
|
SetTimetableParams(0, 1, total_time);
|
|
|
|
DrawString(2, y, complete ? STR_TIMETABLE_TOTAL_TIME : STR_TIMETABLE_TOTAL_TIME_INCOMPLETE, TC_BLACK);
|
|
|
|
}
|
2007-06-26 11:01:06 +00:00
|
|
|
}
|
2008-05-16 13:39:25 +00:00
|
|
|
y += 10;
|
2007-06-26 11:01:06 +00:00
|
|
|
|
2008-05-29 15:13:28 +00:00
|
|
|
if (v->lateness_counter == 0 || (!_settings_client.gui.timetable_in_ticks && v->lateness_counter / DAY_TICKS == 0)) {
|
2008-05-16 13:39:25 +00:00
|
|
|
DrawString(2, y, STR_TIMETABLE_STATUS_ON_TIME, TC_BLACK);
|
|
|
|
} else {
|
|
|
|
SetTimetableParams(0, 1, abs(v->lateness_counter));
|
|
|
|
DrawString(2, y, v->lateness_counter < 0 ? STR_TIMETABLE_STATUS_EARLY : STR_TIMETABLE_STATUS_LATE, TC_BLACK);
|
2007-06-26 11:01:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-16 13:39: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;
|
|
|
|
|
2009-01-03 13:20:32 +00:00
|
|
|
if (order_number >= v->GetNumOrders()) order_number = 0;
|
2008-05-16 13:39:25 +00:00
|
|
|
|
|
|
|
return v->index | (order_number << 16) | (is_journey << 24);
|
2007-06-20 19:26:25 +00:00
|
|
|
}
|
|
|
|
|
2008-05-16 13:39:25 +00:00
|
|
|
virtual void OnClick(Point pt, int widget)
|
|
|
|
{
|
2008-09-24 16:40:06 +00:00
|
|
|
const Vehicle *v = this->vehicle;
|
2007-06-20 19:26:25 +00:00
|
|
|
|
2008-05-16 13:39:25 +00:00
|
|
|
switch (widget) {
|
|
|
|
case TTV_ORDER_VIEW: /* Order view button */
|
|
|
|
ShowOrdersWindow(v);
|
|
|
|
break;
|
2007-06-20 19:26:25 +00:00
|
|
|
|
2008-05-16 13:39:25 +00:00
|
|
|
case TTV_TIMETABLE_PANEL: { /* Main panel. */
|
|
|
|
int selected = GetOrderFromTimetableWndPt(pt.y, v);
|
2007-06-20 19:26:25 +00:00
|
|
|
|
2008-09-24 16:40:06 +00:00
|
|
|
this->DeleteChildWindows();
|
|
|
|
this->sel_index = (selected == INVALID_ORDER || selected == this->sel_index) ? -1 : selected;
|
2008-05-16 13:39:25 +00:00
|
|
|
} break;
|
2007-06-20 19:26:25 +00:00
|
|
|
|
2008-05-16 13:39:25 +00:00
|
|
|
case TTV_CHANGE_TIME: { /* "Wait For" button. */
|
|
|
|
int selected = this->sel_index;
|
|
|
|
VehicleOrderID real = (selected + 1) / 2;
|
2007-06-20 19:26:25 +00:00
|
|
|
|
2009-01-03 13:20:32 +00:00
|
|
|
if (real >= v->GetNumOrders()) real = 0;
|
2007-06-20 19:26:25 +00:00
|
|
|
|
2008-05-16 13:39:25 +00:00
|
|
|
const Order *order = GetVehicleOrder(v, real);
|
|
|
|
StringID current = STR_EMPTY;
|
2007-06-20 19:26:25 +00:00
|
|
|
|
2008-05-16 13:39:25 +00:00
|
|
|
if (order != NULL) {
|
|
|
|
uint time = (selected % 2 == 1) ? order->travel_time : order->wait_time;
|
2008-05-29 15:13:28 +00:00
|
|
|
if (!_settings_client.gui.timetable_in_ticks) time /= DAY_TICKS;
|
2007-06-20 19:26:25 +00:00
|
|
|
|
2008-05-16 13:39:25 +00:00
|
|
|
if (time != 0) {
|
|
|
|
SetDParam(0, time);
|
2009-02-08 12:25:13 +00:00
|
|
|
current = STR_CONFIG_SETTING_INT32;
|
2007-06-20 19:26:25 +00:00
|
|
|
}
|
2008-05-16 13:39:25 +00:00
|
|
|
}
|
2007-06-20 19:26:25 +00:00
|
|
|
|
2008-09-15 16:29:40 +00:00
|
|
|
ShowQueryString(current, STR_TIMETABLE_CHANGE_TIME, 31, 150, this, CS_NUMERAL, QSF_NONE);
|
2008-05-16 13:39:25 +00:00
|
|
|
} break;
|
2007-06-20 19:26:25 +00:00
|
|
|
|
2008-05-16 13:39:25 +00:00
|
|
|
case TTV_CLEAR_TIME: { /* Clear waiting time button. */
|
|
|
|
uint32 p1 = PackTimetableArgs(v, this->sel_index);
|
2008-12-28 14:37:19 +00:00
|
|
|
DoCommandP(0, p1, 0, CMD_CHANGE_TIMETABLE | CMD_MSG(STR_CAN_T_TIMETABLE_VEHICLE));
|
2008-05-16 13:39:25 +00:00
|
|
|
} break;
|
2007-06-20 19:26:25 +00:00
|
|
|
|
2008-05-16 13:39:25 +00:00
|
|
|
case TTV_RESET_LATENESS: /* Reset the vehicle's late counter. */
|
2008-12-28 14:37:19 +00:00
|
|
|
DoCommandP(0, v->index, 0, CMD_SET_VEHICLE_ON_TIME | CMD_MSG(STR_CAN_T_TIMETABLE_VEHICLE));
|
2008-05-16 13:39:25 +00:00
|
|
|
break;
|
2007-06-25 20:55:43 +00:00
|
|
|
|
2008-11-18 23:53:37 +00:00
|
|
|
case TTV_AUTOFILL: { /* Autofill the timetable. */
|
|
|
|
uint32 p2 = 0;
|
|
|
|
if (!HasBit(v->vehicle_flags, VF_AUTOFILL_TIMETABLE)) SetBit(p2, 0);
|
|
|
|
if (_ctrl_pressed) SetBit(p2, 1);
|
2008-12-28 14:37:19 +00:00
|
|
|
DoCommandP(0, v->index, p2, CMD_AUTOFILL_TIMETABLE | CMD_MSG(STR_CAN_T_TIMETABLE_VEHICLE));
|
2008-11-18 23:53:37 +00:00
|
|
|
} break;
|
2008-05-16 13:39:25 +00:00
|
|
|
}
|
2007-06-20 19:26:25 +00:00
|
|
|
|
2008-05-16 13:39:25 +00:00
|
|
|
this->SetDirty();
|
|
|
|
}
|
2008-05-10 08:58:52 +00:00
|
|
|
|
2008-05-16 13:39:25 +00:00
|
|
|
virtual void OnQueryTextFinished(char *str)
|
|
|
|
{
|
|
|
|
if (str == NULL) return;
|
2007-06-20 19:26:25 +00:00
|
|
|
|
2008-09-24 16:40:06 +00:00
|
|
|
const Vehicle *v = this->vehicle;
|
2007-06-20 19:26:25 +00:00
|
|
|
|
2008-05-16 13:39:25 +00:00
|
|
|
uint32 p1 = PackTimetableArgs(v, this->sel_index);
|
2007-06-20 19:26:25 +00:00
|
|
|
|
2008-05-16 13:39:25 +00:00
|
|
|
uint64 time = StrEmpty(str) ? 0 : strtoul(str, NULL, 10);
|
2008-05-29 15:13:28 +00:00
|
|
|
if (!_settings_client.gui.timetable_in_ticks) time *= DAY_TICKS;
|
2007-06-20 19:26:25 +00:00
|
|
|
|
2008-06-27 17:46:43 +00:00
|
|
|
uint32 p2 = minu(time, UINT16_MAX);
|
2007-06-20 19:26:25 +00:00
|
|
|
|
2008-12-28 14:37:19 +00:00
|
|
|
DoCommandP(0, p1, p2, CMD_CHANGE_TIMETABLE | CMD_MSG(STR_CAN_T_TIMETABLE_VEHICLE));
|
2008-05-16 13:39:25 +00:00
|
|
|
}
|
2007-06-20 19:26:25 +00:00
|
|
|
|
2008-05-16 13:39:25 +00:00
|
|
|
virtual void OnResize(Point new_size, Point delta)
|
|
|
|
{
|
|
|
|
/* Update the scroll + matrix */
|
|
|
|
this->vscroll.cap = (this->widget[TTV_TIMETABLE_PANEL].bottom - this->widget[TTV_TIMETABLE_PANEL].top) / 10;
|
2007-06-20 19:26:25 +00:00
|
|
|
}
|
2008-05-16 13:39:25 +00:00
|
|
|
};
|
2007-06-20 19:26:25 +00:00
|
|
|
|
|
|
|
static const Widget _timetable_widgets[] = {
|
2008-08-02 02:28:17 +00:00
|
|
|
{ WWT_CLOSEBOX, RESIZE_NONE, COLOUR_GREY, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // TTV_WIDGET_CLOSEBOX
|
|
|
|
{ WWT_CAPTION, RESIZE_RIGHT, COLOUR_GREY, 11, 326, 0, 13, STR_TIMETABLE_TITLE, STR_018C_WINDOW_TITLE_DRAG_THIS}, // TTV_CAPTION
|
|
|
|
{ WWT_PUSHTXTBTN, RESIZE_LR, COLOUR_GREY, 327, 387, 0, 13, STR_ORDER_VIEW, STR_ORDER_VIEW_TOOLTIP}, // TTV_ORDER_VIEW
|
|
|
|
{ WWT_STICKYBOX, RESIZE_LR, COLOUR_GREY, 388, 399, 0, 13, STR_NULL, STR_STICKY_BUTTON}, // TTV_STICKY
|
2007-06-20 19:26:25 +00:00
|
|
|
|
2008-08-02 02:28:17 +00:00
|
|
|
{ WWT_PANEL, RESIZE_RB, COLOUR_GREY, 0, 387, 14, 95, STR_NULL, STR_TIMETABLE_TOOLTIP}, // TTV_TIMETABLE_PANEL
|
|
|
|
{ WWT_SCROLLBAR, RESIZE_LRB, COLOUR_GREY, 388, 399, 14, 95, STR_NULL, STR_0190_SCROLL_BAR_SCROLLS_LIST}, // TTV_SCROLLBAR
|
2007-06-20 19:26:25 +00:00
|
|
|
|
2008-08-02 02:28:17 +00:00
|
|
|
{ WWT_PANEL, RESIZE_RTB, COLOUR_GREY, 0, 399, 96, 117, STR_NULL, STR_NULL}, // TTV_SUMMARY_PANEL
|
2007-06-20 19:26:25 +00:00
|
|
|
|
2008-08-02 02:28:17 +00:00
|
|
|
{ WWT_PUSHTXTBTN, RESIZE_TB, COLOUR_GREY, 0, 109, 118, 129, STR_TIMETABLE_CHANGE_TIME, STR_TIMETABLE_WAIT_TIME_TOOLTIP}, // TTV_CHANGE_TIME
|
|
|
|
{ WWT_PUSHTXTBTN, RESIZE_TB, COLOUR_GREY, 110, 219, 118, 129, STR_CLEAR_TIME, STR_TIMETABLE_CLEAR_TIME_TOOLTIP}, // TTV_CLEAR_TIME
|
|
|
|
{ WWT_PUSHTXTBTN, RESIZE_TB, COLOUR_GREY, 220, 337, 118, 129, STR_RESET_LATENESS, STR_TIMETABLE_RESET_LATENESS_TOOLTIP}, // TTV_RESET_LATENESS
|
|
|
|
{ WWT_PUSHTXTBTN, RESIZE_TB, COLOUR_GREY, 338, 387, 118, 129, STR_TIMETABLE_AUTOFILL, STR_TIMETABLE_AUTOFILL_TOOLTIP}, // TTV_AUTOFILL
|
2007-06-20 19:26:25 +00:00
|
|
|
|
2008-08-02 02:28:17 +00:00
|
|
|
{ WWT_PANEL, RESIZE_RTB, COLOUR_GREY, 388, 387, 118, 129, STR_NULL, STR_NULL}, // TTV_EMPTY
|
|
|
|
{ WWT_RESIZEBOX, RESIZE_LRTB, COLOUR_GREY, 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,
|
2009-02-04 16:59:41 +00:00
|
|
|
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE | WDF_CONSTRUCTION,
|
2007-06-20 19:26:25 +00:00
|
|
|
_timetable_widgets,
|
|
|
|
};
|
|
|
|
|
|
|
|
void ShowTimetableWindow(const Vehicle *v)
|
|
|
|
{
|
2009-01-03 23:32:59 +00:00
|
|
|
DeleteWindowById(WC_VEHICLE_DETAILS, v->index, false);
|
|
|
|
DeleteWindowById(WC_VEHICLE_ORDERS, v->index, false);
|
2008-05-16 13:39:25 +00:00
|
|
|
AllocateWindowDescFront<TimetableWindow>(&_timetable_desc, v->index);
|
2007-06-20 19:26:25 +00:00
|
|
|
}
|