summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-10-20 19:38:51 +0000
committersmatz <smatz@openttd.org>2009-10-20 19:38:51 +0000
commit30ebe379c768a2d2bd060d6bf4fb82d7f609df3f (patch)
treea786adec143d3c72d80783b6bfa5ee8bc2d59182
parenta138f604ee57f36460dfc7a9d206b6f7f0dd9fe0 (diff)
downloadopenttd-30ebe379c768a2d2bd060d6bf4fb82d7f609df3f.tar.xz
(svn r17825) -Change: 'animate' the 'center to current position' button in SmallMapWindow when pressed
-rw-r--r--src/smallmap_gui.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp
index 5ea6e0f86..dc9a37e5f 100644
--- a/src/smallmap_gui.cpp
+++ b/src/smallmap_gui.cpp
@@ -56,7 +56,7 @@ enum SmallMapWindowWidgets {
static const Widget _smallmap_widgets[] = {
{ WWT_CLOSEBOX, RESIZE_NONE, COLOUR_BROWN, 0, 10, 0, 13, STR_BLACK_CROSS, STR_TOOLTIP_CLOSE_WINDOW}, // SM_WIDGET_CLOSEBOX
{ WWT_CAPTION, RESIZE_RIGHT, COLOUR_BROWN, 11, 337, 0, 13, STR_SMALLMAP_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS}, // SM_WIDGET_CAPTION
-{ WWT_STICKYBOX, RESIZE_LR, COLOUR_BROWN, 338, 349, 0, 13, 0x0, STR_TOOLTIP_STICKY}, // SM_WIDGET_STICKYBOX
+{ WWT_STICKYBOX, RESIZE_LR, COLOUR_BROWN, 338, 349, 0, 13, 0x0, STR_TOOLTIP_STICKY}, // SM_WIDGET_STICKYBOX
{ WWT_PANEL, RESIZE_RB, COLOUR_BROWN, 0, 349, 14, 157, 0x0, STR_NULL}, // SM_WIDGET_MAP_BORDER
{ WWT_INSET, RESIZE_RB, COLOUR_BROWN, 2, 347, 16, 155, 0x0, STR_NULL}, // SM_WIDGET_MAP
{ WWT_PANEL, RESIZE_RTB, COLOUR_BROWN, 0, 261, 158, 201, 0x0, STR_NULL}, // SM_WIDGET_LEGEND
@@ -67,12 +67,12 @@ static const Widget _smallmap_widgets[] = {
{ WWT_IMGBTN, RESIZE_LRTB, COLOUR_BROWN, 284, 305, 180, 201, SPR_IMG_SHOW_ROUTES, STR_SMALLMAP_TOOLTIP_SHOW_TRANSPORT_ROUTES_ON}, // SM_WIDGET_ROUTES
{ WWT_IMGBTN, RESIZE_LRTB, COLOUR_BROWN, 306, 327, 180, 201, SPR_IMG_PLANTTREES, STR_SMALLMAP_TOOLTIP_SHOW_VEGETATION_ON_MAP}, // SM_WIDGET_VEGETATION
{ WWT_IMGBTN, RESIZE_LRTB, COLOUR_BROWN, 328, 349, 180, 201, SPR_IMG_COMPANY_GENERAL, STR_SMALLMAP_TOOLTIP_SHOW_LAND_OWNERS_ON_MAP}, // SM_WIDGET_OWNERS
-{ WWT_IMGBTN, RESIZE_LRTB, COLOUR_BROWN, 262, 283, 158, 179, SPR_IMG_SMALLMAP, STR_SMALLMAP_CENTER}, // SM_WIDGET_CENTERMAP
+{WWT_PUSHIMGBTN, RESIZE_LRTB, COLOUR_BROWN, 262, 283, 158, 179, SPR_IMG_SMALLMAP, STR_SMALLMAP_CENTER}, // SM_WIDGET_CENTERMAP
{ WWT_IMGBTN, RESIZE_LRTB, COLOUR_BROWN, 262, 283, 180, 201, SPR_IMG_TOWN, STR_SMALLMAP_TOOLTIP_TOGGLE_TOWN_NAMES_ON_OFF}, // SM_WIDGET_TOGGLETOWNNAME
{ WWT_PANEL, RESIZE_RTB, COLOUR_BROWN, 0, 337, 202, 213, 0x0, STR_NULL}, // SM_WIDGET_BOTTOMPANEL
{ WWT_TEXTBTN, RESIZE_TB, COLOUR_BROWN, 0, 99, 202, 213, STR_SMALLMAP_ENABLE_ALL, STR_NULL}, // SM_WIDGET_ENABLEINDUSTRIES
{ WWT_TEXTBTN, RESIZE_TB, COLOUR_BROWN, 100, 201, 202, 213, STR_SMALLMAP_DISABLE_ALL, STR_NULL}, // SM_WIDGET_DISABLEINDUSTRIES
-{ WWT_RESIZEBOX, RESIZE_LRTB, COLOUR_BROWN, 338, 349, 202, 213, 0x0, STR_TOOLTIP_RESIZE}, // SM_WIDGET_RESIZEBOX
+{ WWT_RESIZEBOX, RESIZE_LRTB, COLOUR_BROWN, 338, 349, 202, 213, 0x0, STR_TOOLTIP_RESIZE}, // SM_WIDGET_RESIZEBOX
{ WIDGETS_END},
};
@@ -97,7 +97,7 @@ static const NWidgetPart _nested_smallmap_widgets[] = {
NWidget(NWID_VERTICAL),
/* Top button row. */
NWidget(NWID_HORIZONTAL),
- NWidget(WWT_IMGBTN, COLOUR_BROWN, SM_WIDGET_CENTERMAP), SetMinimalSize(22, 22),
+ NWidget(WWT_PUSHIMGBTN, COLOUR_BROWN, SM_WIDGET_CENTERMAP), SetMinimalSize(22, 22),
SetDataTip(SPR_IMG_SMALLMAP, STR_SMALLMAP_CENTER),
NWidget(WWT_IMGBTN, COLOUR_BROWN, SM_WIDGET_CONTOUR), SetMinimalSize(22, 22),
SetDataTip(SPR_IMG_SHOW_COUNTOURS, STR_SMALLMAP_TOOLTIP_SHOW_LAND_CONTOURS_ON_MAP),
@@ -969,8 +969,7 @@ public:
case SM_WIDGET_CENTERMAP: // Center the smallmap again
this->SmallMapCenterOnCurrentPos();
-
- this->SetDirty();
+ this->HandleButtonClick(SM_WIDGET_CENTERMAP);
SndPlayFx(SND_15_BEEP);
break;
@@ -1122,7 +1121,7 @@ bool SmallMapWindow::show_towns = true;
static const WindowDesc _smallmap_desc(
WDP_AUTO, WDP_AUTO, 350, 214, 446, 314,
WC_SMALLMAP, WC_NONE,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON | WDF_RESIZABLE,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON | WDF_RESIZABLE | WDF_UNCLICK_BUTTONS,
_smallmap_widgets, _nested_smallmap_widgets, lengthof(_nested_smallmap_widgets)
);