diff options
author | darkvater <darkvater@openttd.org> | 2004-12-15 23:33:04 +0000 |
---|---|---|
committer | darkvater <darkvater@openttd.org> | 2004-12-15 23:33:04 +0000 |
commit | 83981e40b594af221abf78eab41aa41182003b52 (patch) | |
tree | 74df7f1875fe162b316df2d10c6bb505e11cea71 /smallmap_gui.c | |
parent | ec94450aef385beb279e5b158389767611112f40 (diff) | |
download | openttd-83981e40b594af221abf78eab41aa41182003b52.tar.xz |
(svn r1121) -Feature: Added sticky windows feature. A small pin allows the user to set the window as undeletable and can only be closed by hand. As an example the viewport window has been stickied (thanks to Neko-San)
-To use the feature add WDF_STICKY_BUTTON to the widget description and update all widget-ID's since sticky button will be widget 2.
Diffstat (limited to 'smallmap_gui.c')
-rw-r--r-- | smallmap_gui.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/smallmap_gui.c b/smallmap_gui.c index 515a80a29..063a3da90 100644 --- a/smallmap_gui.c +++ b/smallmap_gui.c @@ -1003,7 +1003,8 @@ void ShowSmallMap() /* Extra ViewPort Window Stuff */ static Widget _extra_view_port_widgets[] = { { WWT_CLOSEBOX, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, -{ WWT_CAPTION, 14, 11, 299, 0, 13, STR_EXTRA_VIEW_PORT_TITLE, STR_018C_WINDOW_TITLE_DRAG_THIS}, +{ WWT_CAPTION, 14, 11, 287, 0, 13, STR_EXTRA_VIEW_PORT_TITLE, STR_018C_WINDOW_TITLE_DRAG_THIS}, +{ WWT_STICKYBOX, 14, 288, 299, 0, 13, 0x0, STR_STICKY_BUTTON}, { WWT_PANEL, 14, 0, 299, 14, 233, 0x0, STR_NULL}, { WWT_6, 14, 2, 297, 16, 231, 0x0, STR_NULL}, { WWT_PANEL, 14, 0, 21, 234, 255, 0x2DF, STR_017F_ZOOM_THE_VIEW_IN}, @@ -1027,15 +1028,15 @@ static void ExtraViewPortWndProc(Window *w, WindowEvent *e) } break; case WE_CLICK: { switch(e->click.widget) { - case 4: { /* zoom in */ + case 5: { /* zoom in */ DoZoomInOutWindow(ZOOM_IN,w); } break; - case 5: { /* zoom out */ + case 6: { /* zoom out */ DoZoomInOutWindow(ZOOM_OUT,w); } break; - case 6: { /* location button (move main view to same spot as this view) */ + case 7: { /* location button (move main view to same spot as this view) */ Window * w2 = FindWindowById(WC_MAIN_WINDOW, 0); int x = WP(w,vp_d).scrollpos_x; // Where is the main looking at int y = WP(w,vp_d).scrollpos_y; @@ -1044,7 +1045,7 @@ static void ExtraViewPortWndProc(Window *w, WindowEvent *e) WP(w2,vp_d).scrollpos_x = x - (w2->viewport->virtual_width - (294 <<vp->zoom) )/2; WP(w2,vp_d).scrollpos_y = y - (w2->viewport->virtual_height - (214 << vp->zoom) )/2; } break; - case 7: { /* inverse location button (move this view to same spot as main view) */ + case 8: { /* inverse location button (move this view to same spot as main view) */ Window * w2 = FindWindowById(WC_MAIN_WINDOW, 0); int x = WP(w2,vp_d).scrollpos_x; int y = WP(w2,vp_d).scrollpos_y; @@ -1060,7 +1061,7 @@ static void ExtraViewPortWndProc(Window *w, WindowEvent *e) static const WindowDesc _extra_view_port_desc = { -1,-1, 300, 256, WC_EXTRA_VIEW_PORT,0, - WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, + WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON, _extra_view_port_widgets, ExtraViewPortWndProc }; |