console_gui.cpp File Reference

Handling the GUI of the in-game console. More...

#include "stdafx.h"
#include "textbuf_gui.h"
#include "window_gui.h"
#include "console_gui.h"
#include "console_internal.h"
#include "window_func.h"
#include "string_func.h"
#include "strings_func.h"
#include "gfx_func.h"
#include "settings_type.h"
#include "console_func.h"
#include "rev.h"
#include "table/strings.h"

Go to the source code of this file.

Data Structures

struct  IConsoleLine
 Container for a single line of console output. More...
struct  IConsoleWindow

Enumerations

enum  ConsoleWidgets { CW_BACKGROUND }
 

Widgets of the console window.

More...

Functions

static void IConsoleClearCommand ()
static void IConsoleResetHistoryPos ()
static const char * IConsoleHistoryAdd (const char *cmd)
 Add the entered line into the history so you can look it back scroll, etc.
static void IConsoleHistoryNavigate (int direction)
 Navigate Up/Down in the history of typed commands.
void IConsoleGUIInit ()
void IConsoleClearBuffer ()
void IConsoleGUIFree ()
void IConsoleResize (Window *w)
 Change the size of the in-game console window after the screen size changed, or the window state changed.
void IConsoleSwitch ()
 Toggle in-game console between opened and closed.
void IConsoleClose ()
 Close the in-game console.
void IConsoleGUIPrint (ConsoleColour colour_code, char *str)
 Handle the printing of text entered into the console or redirected there by any other means.

Variables

static const uint ICON_HISTORY_SIZE = 20
static const uint ICON_LINE_SPACING = 2
static const uint ICON_RIGHT_BORDERWIDTH = 10
static const uint ICON_BOTTOM_BORDERWIDTH = 12
static Textbuf _iconsole_cmdline
static char * _iconsole_history [ICON_HISTORY_SIZE]
static byte _iconsole_historypos
IConsoleModes _iconsole_mode
static struct NWidgetPart _nested_console_window_widgets []
static const WindowDesc _console_window_desc (WDP_MANUAL, 0, 0, WC_CONSOLE, WC_NONE, 0, _nested_console_window_widgets, lengthof(_nested_console_window_widgets))

Detailed Description

Handling the GUI of the in-game console.

Definition in file console_gui.cpp.


Enumeration Type Documentation

Widgets of the console window.

Enumerator:
CW_BACKGROUND 

Background of the console.

Definition at line 156 of file console_gui.cpp.


Function Documentation

void IConsoleClose (  ) 

Close the in-game console.

Definition at line 423 of file console_gui.cpp.

References ICONSOLE_OPENED, and IConsoleSwitch().

Referenced by InitWindowSystem().

void IConsoleGUIPrint ( ConsoleColour  colour_code,
char *  str 
)

Handle the printing of text entered into the console or redirected there by any other means.

Text can be redirected to other clients in a network game as well as to a logfile. If the network server is a dedicated server, all activities are also logged. All lines to print are added to a temporary buffer which can be used as a history to print them onscreen

Parameters:
colour_code the colour of the command. Red in case of errors, etc.
str the message entered or output on the console (notice, error, etc.)

Definition at line 492 of file console_gui.cpp.

References SetWindowDirty().

Referenced by IConsolePrint().

static const char * IConsoleHistoryAdd ( const char *  cmd  )  [static]

Add the entered line into the history so you can look it back scroll, etc.

Put it to the beginning as it is the latest text

Parameters:
cmd Text to be entered into the 'history'
Returns:
the command to execute

Definition at line 434 of file console_gui.cpp.

References IsWhitespace(), and StrEmpty().

Referenced by IConsoleWindow::OnKeyPress().

static void IConsoleHistoryNavigate ( int  direction  )  [static]

Navigate Up/Down in the history of typed commands.

Parameters:
direction Go further back in history (+1), go to recently typed commands (-1)

Definition at line 458 of file console_gui.cpp.

References Textbuf::buf, IsInsideMM(), Textbuf::max_bytes, ttd_strlcpy(), and UpdateTextBufferSize().

Referenced by IConsoleWindow::OnKeyPress().

void IConsoleResize ( Window w  ) 

Change the size of the in-game console window after the screen size changed, or the window state changed.

Definition at line 389 of file console_gui.cpp.

References Window::height, ICONSOLE_FULL, ICONSOLE_OPENED, MarkWholeScreenDirty(), and Window::width.

Referenced by IConsoleWindow::OnKeyPress(), and RelocateAllWindows().

void IConsoleSwitch (  ) 

Toggle in-game console between opened and closed.

Definition at line 407 of file console_gui.cpp.

References DeleteWindowById(), ICONSOLE_CLOSED, ICONSOLE_FULL, ICONSOLE_OPENED, and MarkWholeScreenDirty().

Referenced by IConsoleClose(), MainWindow::OnKeyPress(), and IConsoleWindow::OnKeyPress().


Variable Documentation

struct NWidgetPart _nested_console_window_widgets[] [static]
Initial value:
 {
  NWidget(WWT_EMPTY, INVALID_COLOUR, CW_BACKGROUND), SetResize(1, 1),
}

Definition at line 160 of file console_gui.cpp.


Generated on Fri Dec 31 17:15:43 2010 for OpenTTD by  doxygen 1.6.1