summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-01-03 23:32:59 +0000
committerrubidium <rubidium@openttd.org>2009-01-03 23:32:59 +0000
commit3024850bb10d82c2d18707d824d1b652ed1a74b8 (patch)
tree1a52113132e5eae93b37709f7356be106e6f3c42 /src
parente9484cff121ad8db85274b50e558142b63c0fc65 (diff)
downloadopenttd-3024850bb10d82c2d18707d824d1b652ed1a74b8.tar.xz
(svn r14819) -Change: make details and order menu stickyable, like the timetable window. Also let the detail/order/timetable window close eachther, like the detail and order windows already did, when not stickied.
Diffstat (limited to 'src')
-rw-r--r--src/order_gui.cpp25
-rw-r--r--src/timetable_gui.cpp3
-rw-r--r--src/vehicle_gui.cpp11
3 files changed, 25 insertions, 14 deletions
diff --git a/src/order_gui.cpp b/src/order_gui.cpp
index 3f70a8c28..140978a43 100644
--- a/src/order_gui.cpp
+++ b/src/order_gui.cpp
@@ -40,6 +40,7 @@ enum OrderWindowWidgets {
ORDER_WIDGET_CLOSEBOX = 0,
ORDER_WIDGET_CAPTION,
ORDER_WIDGET_TIMETABLE_VIEW,
+ ORDER_WIDGET_STICKY,
ORDER_WIDGET_ORDER_LIST,
ORDER_WIDGET_SCROLLBAR,
ORDER_WIDGET_SKIP,
@@ -1138,8 +1139,9 @@ public:
*/
static const Widget _orders_train_widgets[] = {
{ WWT_CLOSEBOX, RESIZE_NONE, COLOUR_GREY, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // ORDER_WIDGET_CLOSEBOX
- { WWT_CAPTION, RESIZE_RIGHT, COLOUR_GREY, 11, 385, 0, 13, STR_8829_ORDERS, STR_018C_WINDOW_TITLE_DRAG_THIS}, // ORDER_WIDGET_CAPTION
- { WWT_PUSHTXTBTN, RESIZE_LR, COLOUR_GREY, 325, 385, 0, 13, STR_TIMETABLE_VIEW, STR_TIMETABLE_VIEW_TOOLTIP}, // ORDER_WIDGET_TIMETABLE_VIEW
+ { WWT_CAPTION, RESIZE_RIGHT, COLOUR_GREY, 11, 373, 0, 13, STR_8829_ORDERS, STR_018C_WINDOW_TITLE_DRAG_THIS}, // ORDER_WIDGET_CAPTION
+ { WWT_PUSHTXTBTN, RESIZE_LR, COLOUR_GREY, 313, 373, 0, 13, STR_TIMETABLE_VIEW, STR_TIMETABLE_VIEW_TOOLTIP}, // ORDER_WIDGET_TIMETABLE_VIEW
+ { WWT_STICKYBOX, RESIZE_LR, COLOUR_GREY, 374, 385, 0, 13, STR_NULL, STR_STICKY_BUTTON}, // ORDER_WIDGET_STICKY
{ WWT_PANEL, RESIZE_RB, COLOUR_GREY, 0, 373, 14, 75, 0x0, STR_8852_ORDERS_LIST_CLICK_ON_ORDER}, // ORDER_WIDGET_ORDER_LIST
@@ -1173,7 +1175,7 @@ static const Widget _orders_train_widgets[] = {
static const WindowDesc _orders_train_desc = {
WDP_AUTO, WDP_AUTO, 386, 100, 386, 100,
WC_VEHICLE_ORDERS, WC_VEHICLE_VIEW,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESIZABLE,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON | WDF_RESIZABLE,
_orders_train_widgets,
};
@@ -1182,8 +1184,9 @@ static const WindowDesc _orders_train_desc = {
*/
static const Widget _orders_widgets[] = {
{ WWT_CLOSEBOX, RESIZE_NONE, COLOUR_GREY, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // ORDER_WIDGET_CLOSEBOX
- { WWT_CAPTION, RESIZE_RIGHT, COLOUR_GREY, 11, 385, 0, 13, STR_8829_ORDERS, STR_018C_WINDOW_TITLE_DRAG_THIS}, // ORDER_WIDGET_CAPTION
- { WWT_PUSHTXTBTN, RESIZE_LR, COLOUR_GREY, 325, 385, 0, 13, STR_TIMETABLE_VIEW, STR_TIMETABLE_VIEW_TOOLTIP}, // ORDER_WIDGET_TIMETABLE_VIEW
+ { WWT_CAPTION, RESIZE_RIGHT, COLOUR_GREY, 11, 373, 0, 13, STR_8829_ORDERS, STR_018C_WINDOW_TITLE_DRAG_THIS}, // ORDER_WIDGET_CAPTION
+ { WWT_PUSHTXTBTN, RESIZE_LR, COLOUR_GREY, 313, 373, 0, 13, STR_TIMETABLE_VIEW, STR_TIMETABLE_VIEW_TOOLTIP}, // ORDER_WIDGET_TIMETABLE_VIEW
+ { WWT_STICKYBOX, RESIZE_LR, COLOUR_GREY, 374, 385, 0, 13, STR_NULL, STR_STICKY_BUTTON}, // ORDER_WIDGET_STICKY
{ WWT_PANEL, RESIZE_RB, COLOUR_GREY, 0, 373, 14, 75, 0x0, STR_8852_ORDERS_LIST_CLICK_ON_ORDER}, // ORDER_WIDGET_ORDER_LIST
@@ -1217,7 +1220,7 @@ static const Widget _orders_widgets[] = {
static const WindowDesc _orders_desc = {
WDP_AUTO, WDP_AUTO, 386, 100, 386, 100,
WC_VEHICLE_ORDERS, WC_VEHICLE_VIEW,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESIZABLE,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON | WDF_RESIZABLE,
_orders_widgets,
};
@@ -1226,8 +1229,9 @@ static const WindowDesc _orders_desc = {
*/
static const Widget _other_orders_widgets[] = {
{ WWT_CLOSEBOX, RESIZE_NONE, COLOUR_GREY, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // ORDER_WIDGET_CLOSEBOX
- { WWT_CAPTION, RESIZE_RIGHT, COLOUR_GREY, 11, 385, 0, 13, STR_8829_ORDERS, STR_018C_WINDOW_TITLE_DRAG_THIS}, // ORDER_WIDGET_CAPTION
- { WWT_PUSHTXTBTN, RESIZE_LR, COLOUR_GREY, 325, 385, 0, 13, STR_TIMETABLE_VIEW, STR_TIMETABLE_VIEW_TOOLTIP}, // ORDER_WIDGET_TIMETABLE_VIEW
+ { WWT_CAPTION, RESIZE_RIGHT, COLOUR_GREY, 11, 373, 0, 13, STR_8829_ORDERS, STR_018C_WINDOW_TITLE_DRAG_THIS}, // ORDER_WIDGET_CAPTION
+ { WWT_PUSHTXTBTN, RESIZE_LR, COLOUR_GREY, 313, 373, 0, 13, STR_TIMETABLE_VIEW, STR_TIMETABLE_VIEW_TOOLTIP}, // ORDER_WIDGET_TIMETABLE_VIEW
+ { WWT_STICKYBOX, RESIZE_LR, COLOUR_GREY, 374, 385, 0, 13, STR_NULL, STR_STICKY_BUTTON}, // ORDER_WIDGET_STICKY
{ WWT_PANEL, RESIZE_RB, COLOUR_GREY, 0, 373, 14, 75, 0x0, STR_8852_ORDERS_LIST_CLICK_ON_ORDER}, // ORDER_WIDGET_ORDER_LIST
@@ -1261,13 +1265,14 @@ static const Widget _other_orders_widgets[] = {
static const WindowDesc _other_orders_desc = {
WDP_AUTO, WDP_AUTO, 386, 88, 386, 88,
WC_VEHICLE_ORDERS, WC_VEHICLE_VIEW,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE,
_other_orders_widgets,
};
void ShowOrdersWindow(const Vehicle *v)
{
- DeleteWindowById(WC_VEHICLE_DETAILS, v->index);
+ DeleteWindowById(WC_VEHICLE_DETAILS, v->index, false);
+ DeleteWindowById(WC_VEHICLE_TIMETABLE, v->index, false);
if (BringWindowToFrontById(WC_VEHICLE_ORDERS, v->index) != NULL) return;
if (v->owner != _local_company) {
diff --git a/src/timetable_gui.cpp b/src/timetable_gui.cpp
index 4097788d8..6920d2a1e 100644
--- a/src/timetable_gui.cpp
+++ b/src/timetable_gui.cpp
@@ -8,6 +8,7 @@
#include "command_func.h"
#include "gui.h"
#include "window_gui.h"
+#include "window_func.h"
#include "textbuf_gui.h"
#include "cargotype.h"
#include "strings_func.h"
@@ -366,5 +367,7 @@ static const WindowDesc _timetable_desc = {
void ShowTimetableWindow(const Vehicle *v)
{
+ DeleteWindowById(WC_VEHICLE_DETAILS, v->index, false);
+ DeleteWindowById(WC_VEHICLE_ORDERS, v->index, false);
AllocateWindowDescFront<TimetableWindow>(&_timetable_desc, v->index);
}
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index a9133e611..f8ed36523 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -1202,6 +1202,7 @@ enum VehicleDetailsWindowWidgets {
VLD_WIDGET_CLOSEBOX = 0,
VLD_WIDGET_CAPTION,
VLD_WIDGET_RENAME_VEHICLE,
+ VLD_WIDGET_STICKY,
VLD_WIDGET_TOP_DETAILS,
VLD_WIDGET_INCREASE_SERVICING_INTERVAL,
VLD_WIDGET_DECREASE_SERVICING_INTERVAL,
@@ -1218,8 +1219,9 @@ enum VehicleDetailsWindowWidgets {
/** Vehicle details widgets. */
static const Widget _vehicle_details_widgets[] = {
{ WWT_CLOSEBOX, RESIZE_NONE, COLOUR_GREY, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // VLD_WIDGET_CLOSEBOX
- { WWT_CAPTION, RESIZE_RIGHT, COLOUR_GREY, 11, 364, 0, 13, 0x0, STR_018C_WINDOW_TITLE_DRAG_THIS}, // VLD_WIDGET_CAPTION
- { WWT_PUSHTXTBTN, RESIZE_LR, COLOUR_GREY, 365, 404, 0, 13, STR_01AA_NAME, STR_NULL /* filled in later */}, // VLD_WIDGET_RENAME_VEHICLE
+ { WWT_CAPTION, RESIZE_RIGHT, COLOUR_GREY, 11, 352, 0, 13, 0x0, STR_018C_WINDOW_TITLE_DRAG_THIS}, // VLD_WIDGET_CAPTION
+ { WWT_PUSHTXTBTN, RESIZE_LR, COLOUR_GREY, 353, 392, 0, 13, STR_01AA_NAME, STR_NULL /* filled in later */}, // VLD_WIDGET_RENAME_VEHICLE
+ { WWT_STICKYBOX, RESIZE_LR, COLOUR_GREY, 393, 404, 0, 13, STR_NULL, STR_STICKY_BUTTON}, // VLD_WIDGET_STICKY
{ WWT_PANEL, RESIZE_RIGHT, COLOUR_GREY, 0, 404, 14, 55, 0x0, STR_NULL}, // VLD_WIDGET_TOP_DETAILS
{ WWT_PUSHTXTBTN, RESIZE_TB, COLOUR_GREY, 0, 10, 101, 106, STR_0188, STR_884D_INCREASE_SERVICING_INTERVAL}, // VLD_WIDGET_INCREASE_SERVICING_INTERVAL
{ WWT_PUSHTXTBTN, RESIZE_TB, COLOUR_GREY, 0, 10, 107, 112, STR_0189, STR_884E_DECREASE_SERVICING_INTERVAL}, // VLD_WIDGET_DECREASE_SERVICING_INTERVAL
@@ -1545,14 +1547,15 @@ struct VehicleDetailsWindow : Window {
static const WindowDesc _vehicle_details_desc = {
WDP_AUTO, WDP_AUTO, 405, 113, 405, 113,
WC_VEHICLE_DETAILS, WC_VEHICLE_VIEW,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE,
_vehicle_details_widgets,
};
/** Shows the vehicle details window of the given vehicle. */
static void ShowVehicleDetailsWindow(const Vehicle *v)
{
- DeleteWindowById(WC_VEHICLE_ORDERS, v->index);
+ DeleteWindowById(WC_VEHICLE_ORDERS, v->index, false);
+ DeleteWindowById(WC_VEHICLE_TIMETABLE, v->index, false);
AllocateWindowDescFront<VehicleDetailsWindow>(&_vehicle_details_desc, v->index);
}