Index: source.list =================================================================== --- source.list (revision 11086) +++ source.list (working copy) @@ -211,6 +211,7 @@ depot_gui.cpp dock_gui.cpp engine_gui.cpp +fast_main_gui.cpp genworld_gui.cpp graph_gui.cpp group_gui.cpp Index: src/fast_main_gui.cpp =================================================================== --- src/fast_main_gui.cpp (revision 0) +++ src/fast_main_gui.cpp (revision 0) @@ -0,0 +1,93 @@ +/* $Id:$ */ + +/** @file fast_main_gui.cpp */ + +#include "stdafx.h" +#include "openttd.h" +#include "table/sprites.h" +#include "table/strings.h" +#include "functions.h" +#include "window.h" +#include "gui.h" +#include "viewport.h" +#include "gfx.h" +#include "sound.h" +#include "variables.h" + +enum FastMainGuiWidgets{ + FMGW_WIDGET_RAIL = 1, ///< railroad construction widget + FMGW_WIDGET_ROAD, ///< road construction widget + FMGW_WIDGET_TOPRIGHT, ///< blank widget + FMGW_WIDGET_WATER, ///< water contruction widget + FMGW_WIDGET_AIR, ///< airport construction widget + FMGW_WIDGET_BOTTOMLEFT, ///< blank widget + FMGW_WIDGET_HELP, ///< query tool + FMGW_WIDGET_BOTTOMRIGHT, ///< blank widget +}; + +static void FastMenuWndProc(Window *w, WindowEvent *e) +{ + switch (e->event) { + case WE_CREATE: { + } break; + + case WE_PAINT: { + DrawWindowWidgets(w); + } break; + + case WE_DESTROY: { + return; + } + + case WE_CLICK: { + if (e->we.click.widget >= FMGW_WIDGET_RAIL) { + + } + } break; + + case WE_TICK: { + DrawWindowWidgets(w); + } break; + } +} + +static const Widget _fast_main_gui_widgets[] = { +{ WWT_TRANSPARENT,RESIZE_NONE, 0, 0, 75, 0, 77, 0x0, STR_NULL}, //clicking on the transparent area will close the gui + +{ WWT_IMGBTN, RESIZE_NONE, 7, 0, 21, 0, 22, SPR_IMG_BUILDRAIL, STR_0181_BUILD_RAILROAD_TRACK}, +{ WWT_IMGBTN, RESIZE_NONE, 7, 27, 48, 0, 22, SPR_IMG_BUILDROAD, STR_0182_BUILD_ROADS}, +{ WWT_PANEL, RESIZE_NONE, 7, 54, 75, 0, 22, 0x0, STR_NULL}, + +{ WWT_IMGBTN, RESIZE_NONE, 7, 0, 21, 28, 50, SPR_IMG_BUILDWATER, STR_0183_BUILD_SHIP_DOCKS}, +/* nothing here, transparent area */ +{ WWT_IMGBTN, RESIZE_NONE, 7, 54, 75, 28, 50, SPR_IMG_BUILDAIR, STR_0184_BUILD_AIRPORTS}, + +{ WWT_IMGBTN, RESIZE_NONE, 7, 0, 21, 55, 77, SPR_IMG_LANDSCAPING, STR_LANDSCAPING_TOOLBAR_TIP}, +{ WWT_PANEL, RESIZE_NONE, 7, 27, 48, 55, 77, 0x0, STR_NULL}, +{ WWT_IMGBTN, RESIZE_NONE, 7, 54, 75, 55, 77, SPR_IMG_QUERY, STR_0186_LAND_BLOCK_INFORMATION}, +{ WIDGETS_END}, +}; + +static const WindowDesc _fast_main_gui_desc = { + WDP_CENTER, WDP_CENTER, 76, 78, 76, 78, //i want it at the mouse coords, but seems to be impossible with _cursor.pos.x/y, so center on the screen + WC_FAST_MAIN_GUI_TOOLBAR, WC_NONE, + WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, + _fast_main_gui_widgets, + FastMenuWndProc +}; +/* +void ShowFastMainGui(void) +{ + AllocateWindowDescFront(&_fast_main_gui_desc, 0); +} +*/ + +static void Tool_LandBlock(TileIndex tile) { + AllocateWindowDescFront(&_fast_main_gui_desc, 0); +} + +void ShowFastMainGui(void) +{ + _place_proc = Tool_LandBlock; + SetObjectToPlace(SPR_CURSOR_MOUSE, PAL_NONE, 1, WC_MAIN_TOOLBAR, 0); +} Index: src/gui.h =================================================================== --- src/gui.h (revision 11086) +++ src/gui.h (working copy) @@ -15,6 +15,9 @@ void CcBuildCanal(bool success, TileIndex tile, uint32 p1, uint32 p2); void CcTerraform(bool success, TileIndex tile, uint32 p1, uint32 p2); +/* fast main gui */ +void ShowFastMainGui(); + /* settings_gui.cpp */ void ShowGameOptions(); void ShowGameDifficulty(); Index: src/main_gui.cpp =================================================================== --- src/main_gui.cpp (revision 11086) +++ src/main_gui.cpp (working copy) @@ -2262,6 +2262,8 @@ ToggleTransparency(); break; + case WKC_CTRL | 'F': ShowFastMainGui(); break; + #ifdef ENABLE_NETWORK case WKC_RETURN: case 'T': // smart chat; send to team if any, otherwise to all if (_networking) { Index: src/openttd.h =================================================================== --- src/openttd.h (revision 11086) +++ src/openttd.h (working copy) @@ -587,6 +587,7 @@ WC_CONFIRM_POPUP_QUERY, WC_TRANSPARENCY_TOOLBAR, WC_VEHICLE_TIMETABLE, + WC_FAST_MAIN_GUI_TOOLBAR, }; Index: src/widget.cpp =================================================================== --- src/widget.cpp (revision 11086) +++ src/widget.cpp (working copy) @@ -218,6 +218,13 @@ goto draw_default; } + case WWT_TRANSPARENT: { + assert(wi->data == 0); + //DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, FR_TRANSPARENT); + //goto draw_default; + break; + } + case WWT_TEXTBTN: case WWT_TEXTBTN_2: { DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, (clicked) ? FR_LOWERED : FR_NONE); @@ -471,7 +478,9 @@ if (w->flags4 & WF_WHITE_BORDER_MASK) { //DrawFrameRect(w->left, w->top, w->left + w->width-1, w->top+w->height-1, 0xF, 0x10); - DrawFrameRect(0, 0, w->width-1, w->height-1, 0xF, FR_BORDERONLY); + const Widget *wt = &w->widget[0]; //the transparent widget is the first widget, so check its mask, sorry if is not the best solution, but the border is really weird :P + if (wt->type & WWT_MASK != WWT_TRANSPARENT) + DrawFrameRect(0, 0, w->width-1, w->height-1, 0xF, FR_BORDERONLY); } } Index: src/window.h =================================================================== --- src/window.h (revision 11086) +++ src/window.h (working copy) @@ -533,6 +533,7 @@ WWT_SCROLL2BAR, ///< 2nd vertical scrollbar WWT_RESIZEBOX, WWT_CLOSEBOX, + WWT_TRANSPARENT,///< should be transparent widget WWT_LAST, ///< Last Item. use WIDGETS_END to fill up padding!! WWT_MASK = 0x1F,