main_gui.cpp File Reference

Handling of the main viewport. More...

#include "stdafx.h"
#include "currency.h"
#include "spritecache.h"
#include "window_gui.h"
#include "window_func.h"
#include "textbuf_gui.h"
#include "viewport_func.h"
#include "command_func.h"
#include "console_gui.h"
#include "genworld.h"
#include "transparency_gui.h"
#include "map_func.h"
#include "sound_func.h"
#include "transparency.h"
#include "strings_func.h"
#include "zoom_func.h"
#include "company_base.h"
#include "company_func.h"
#include "toolbar_gui.h"
#include "statusbar_gui.h"
#include "linkgraph_gui.h"
#include "tilehighlight_func.h"
#include "hotkeys.h"
#include "saveload/saveload.h"
#include "network/network.h"
#include "network/network_func.h"
#include "network/network_gui.h"
#include "network/network_base.h"
#include "table/sprites.h"
#include "table/strings.h"

Go to the source code of this file.

Data Structures

struct  MainWindow

Enumerations

enum  MainWindowWidgets { MW_VIEWPORT }
 

Widgets of the main window.

More...
enum  {
  GHK_QUIT, GHK_ABANDON, GHK_CONSOLE, GHK_BOUNDING_BOXES,
  GHK_CENTER, GHK_CENTER_ZOOM, GHK_RESET_OBJECT_TO_PLACE, GHK_DELETE_WINDOWS,
  GHK_DELETE_NONVITAL_WINDOWS, GHK_REFRESH_SCREEN, GHK_CRASH, GHK_MONEY,
  GHK_UPDATE_COORDS, GHK_TOGGLE_TRANSPARENCY, GHK_TOGGLE_INVISIBILITY = GHK_TOGGLE_TRANSPARENCY + 9, GHK_TRANSPARENCY_TOOLBAR = GHK_TOGGLE_INVISIBILITY + 8,
  GHK_TRANSPARANCY, GHK_CHAT, GHK_CHAT_ALL, GHK_CHAT_COMPANY,
  GHK_CHAT_SERVER
}

Functions

void CcGiveMoney (const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
void HandleOnEditText (const char *str)
bool HandlePlacePushButton (Window *w, int widget, CursorID cursor, HighLightStyle mode)
 This code is shared for the majority of the pushbuttons.
void CcPlaySound10 (const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
void ShowNetworkGiveMoneyWindow (CompanyID company)
bool DoZoomInOutWindow (ZoomStateChange how, Window *w)
 Zooms a viewport in a window in or out.
void ZoomInOrOutToCursorWindow (bool in, Window *w)
bool IsQuitKey (uint16 keycode)
 Does the given keycode match one of the keycodes bound to 'quit game'?
void ShowSelectGameWindow ()
void SetupColoursAndInitialWindow ()
 Initialise the default colours (remaps and the likes), and load the main windows.
void ShowVitalWindows ()
 Show the vital in-game windows.
void GameSizeChanged ()
 Size of the application screen changed.

Variables

static int _rename_id = 1
static int _rename_what = -1
static struct NWidgetPart _nested_main_window_widgets []
static const WindowDesc _main_window_desc (WDP_MANUAL, 0, 0, WC_MAIN_WINDOW, WC_NONE, 0, _nested_main_window_widgets, lengthof(_nested_main_window_widgets))
const uint16 _ghk_quit_keys [] = {'Q' | WKC_CTRL, 'Q' | WKC_META, 0}
const uint16 _ghk_abandon_keys [] = {'W' | WKC_CTRL, 'W' | WKC_META, 0}
const uint16 _ghk_chat_keys [] = {WKC_RETURN, 'T', 0}
const uint16 _ghk_chat_all_keys [] = {WKC_SHIFT | WKC_RETURN, WKC_SHIFT | 'T', 0}
const uint16 _ghk_chat_company_keys [] = {WKC_CTRL | WKC_RETURN, WKC_CTRL | 'T', 0}
const uint16 _ghk_chat_server_keys [] = {WKC_CTRL | WKC_SHIFT | WKC_RETURN, WKC_CTRL | WKC_SHIFT | 'T', 0}
Hotkey< MainWindow > * _global_hotkeys = MainWindow::global_hotkeys

Detailed Description

Handling of the main viewport.

Definition in file main_gui.cpp.


Enumeration Type Documentation

Widgets of the main window.

Enumerator:
MW_VIEWPORT 

Main window viewport.

Definition at line 204 of file main_gui.cpp.


Function Documentation

bool DoZoomInOutWindow ( ZoomStateChange  how,
Window w 
)

Zooms a viewport in a window in or out.

Parameters:
how Zooming direction.
w Window owning the viewport.
Returns:
Returns true if zooming step could be done, false if further zooming is not possible.
Note:
No button handling or what so ever is done.

Definition at line 139 of file main_gui.cpp.

References ViewportData::dest_scrollpos_x, ViewportData::dest_scrollpos_y, ViewportData::follow_vehicle, INVALID_VEHICLE, Window::InvalidateData(), ViewportData::scrollpos_x, ViewportData::scrollpos_y, Window::viewport, ViewPort::virtual_height, ViewPort::virtual_left, ViewPort::virtual_top, ViewPort::virtual_width, ViewPort::zoom, ZOOM_IN, ZOOM_LVL_MAX, ZOOM_LVL_MIN, ZOOM_NONE, and ZOOM_OUT.

Referenced by MaxZoomInOut(), and ExtraViewportWindow::OnClick().

void GameSizeChanged (  ) 

Size of the application screen changed.

Adapt the game screen-size, re-allocate the open windows, and repaint everything

Definition at line 581 of file main_gui.cpp.

References _cur_resolution, MarkWholeScreenDirty(), and RelocateAllWindows().

Referenced by VideoDriver_Win32::MakeWindow().

bool HandlePlacePushButton ( Window w,
int  widget,
CursorID  cursor,
HighLightStyle  mode 
)

This code is shared for the majority of the pushbuttons.

Handles e.g. the pressing of a button (to build things), playing of click sound and sets certain parameters

Parameters:
w Window which called the function
widget ID of the widget (=button) that called this function
cursor How should the cursor image change? E.g. cursor with depot image in it
mode Tile highlighting mode, e.g. drawing a rectangle or a dot on the ground
Returns:
true if the button is clicked, false if it's unclicked

Definition at line 99 of file main_gui.cpp.

References Window::IsWidgetDisabled(), Window::IsWidgetLowered(), Window::LowerWidget(), Window::SetDirty(), Window::window_class, and Window::window_number.

Referenced by BuildTreesWindow::OnClick(), FoundTownWindow::OnClick(), ScenarioEditorLandscapeGenerationWindow::OnClick(), TerraformToolbarWindow::OnClick(), BuildRoadToolbarWindow::OnClick(), BuildRailToolbarWindow::OnClick(), BuildIndustryWindow::OnClick(), BuildDocksToolbarWindow::OnClick(), and BuildAirToolbarWindow::OnClick().

bool IsQuitKey ( uint16  keycode  ) 

Does the given keycode match one of the keycodes bound to 'quit game'?

Parameters:
keycode The keycode that was pressed by the user.
Returns:
True iff the keycode matches one of the hotkeys for 'quit'.

Definition at line 527 of file main_gui.cpp.

Referenced by EndGameHighScoreBaseWindow::OnKeyPress().


Variable Documentation

struct NWidgetPart _nested_main_window_widgets[] [static]
Initial value:
 {
  NWidget(NWID_VIEWPORT, INVALID_COLOUR, MW_VIEWPORT), SetResize(1, 1),
}

Definition at line 208 of file main_gui.cpp.


Generated on Sun Jun 5 04:20:10 2011 for OpenTTD by  doxygen 1.6.1