AIDebugWindow Struct Reference

Window with everything an AI prints via AILog. More...

Inheritance diagram for AIDebugWindow:
QueryStringBaseWindow Window QueryString ZeroedMemoryAllocator

Public Member Functions

 AIDebugWindow (const WindowDesc *desc, WindowNumber number)
virtual void UpdateWidgetSize (int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
 Update size and resize step of a widget in the window.
virtual void OnPaint ()
 The window must be repainted.
virtual void SetStringParameters (int widget) const
 Initialize string parameters for a widget.
virtual void DrawWidget (const Rect &r, int widget) const
 Draw the contents of a nested widget.
void ChangeToAI (CompanyID show_ai)
virtual void OnClick (Point pt, int widget, int click_count)
 A click with the left mouse button has been made on the window.
virtual void OnTimeout ()
 Called when this window's timeout has been reached.
virtual void OnMouseLoop ()
 Called for every mouse loop run, which is at least once per (game) tick.
virtual EventState OnKeyPress (uint16 key, uint16 keycode)
 A key has been pressed.
virtual void OnInvalidateData (int data=0)
 Some data on this window has become invalid.
virtual void OnResize ()
 Called after the window got resized.

Data Fields

int redraw_timer
int last_vscroll_pos
bool autoscroll
bool show_break_box
int highlight_row
 The output row that matches the given string, or -1.
Scrollbarvscroll

Static Public Attributes

static const int top_offset = WD_FRAMERECT_TOP + 2
 Offset of the text at the top of the AID_WIDGET_LOG_PANEL.
static const int bottom_offset = WD_FRAMERECT_BOTTOM
 Offset of the text at the bottom of the AID_WIDGET_LOG_PANEL.
static const unsigned int MAX_BREAK_STR_STRING_LENGTH = 256
static CompanyID ai_debug_company = INVALID_COMPANY
 The AI that is (was last) being debugged.
static bool break_check_enabled = true
 Stop an AI when it prints a matching string.
static char break_string [MAX_BREAK_STR_STRING_LENGTH] = ""
 The string to match to the AI output.
static bool case_sensitive_break_check = false
 Is the matching done case-sensitive.

Detailed Description

Window with everything an AI prints via AILog.

Definition at line 706 of file ai_gui.cpp.


Member Function Documentation

virtual void AIDebugWindow::DrawWidget ( const Rect r,
int  widget 
) const [inline, virtual]

Draw the contents of a nested widget.

Parameters:
r Rectangle occupied by the widget.
widget Number of the widget to draw.
Note:
This method may not change any state, it may only use drawing functions.

Reimplemented from Window.

Definition at line 883 of file ai_gui.cpp.

References _current_company, ai_debug_company, AILog::LogData::count, DrawString(), AIObject::GetLogPointer(), Scrollbar::GetPosition(), GfxFillRect(), highlight_row, INVALID_COMPANY, Scrollbar::IsVisible(), AILog::LogData::lines, AILog::LOG_ERROR, AILog::LOG_INFO, AILog::LOG_SQ_ERROR, AILog::LOG_SQ_INFO, AILog::LOG_WARNING, AILog::LogData::pos, Window::resize, Backup< T >::Restore(), SA_FORCE, SA_LEFT, ResizeInfo::step_height, top_offset, AILog::LogData::type, AILog::LogData::used, and WD_PAR_VSEP_NORMAL.

virtual void AIDebugWindow::OnClick ( Point  pt,
int  widget,
int  click_count 
) [inline, virtual]

A click with the left mouse button has been made on the window.

Parameters:
pt the point inside the window that has been clicked.
widget the clicked widget.
click_count Number of fast consecutive clicks at same position

Reimplemented from Window.

Definition at line 941 of file ai_gui.cpp.

References ai_debug_company, break_check_enabled, case_sensitive_break_check, CMD_COMPANY_CTRL, CMD_PAUSE, Window::DisableWidget(), DoCommandP(), IsInsideMM(), Window::IsWidgetDisabled(), PM_PAUSED_NORMAL, Window::RaiseWidget(), Window::SetWidgetDirty(), Window::SetWidgetLoweredState(), and ShowAISettingsWindow().

virtual void AIDebugWindow::OnInvalidateData ( int  data = 0  )  [inline, virtual]
virtual EventState AIDebugWindow::OnKeyPress ( uint16  key,
uint16  keycode 
) [inline, virtual]

A key has been pressed.

Parameters:
key the Unicode value of the key.
keycode the untranslated key code including shift state.
Returns:
ES_HANDLED if the key press has been handled and no other window should receive the event.

Reimplemented from Window.

Definition at line 994 of file ai_gui.cpp.

References break_string, QueryStringBaseWindow::edit_str_buf, ES_NOT_HANDLED, lastof, and strecpy().

virtual void AIDebugWindow::OnPaint (  )  [inline, virtual]
virtual void AIDebugWindow::OnResize (  )  [inline, virtual]

Called after the window got resized.

For nested windows with a viewport, call NWidgetViewport::UpdateViewportCoordinates.

Reimplemented from Window.

Definition at line 1047 of file ai_gui.cpp.

References Scrollbar::SetCapacityFromWidget().

virtual void AIDebugWindow::SetStringParameters ( int  widget  )  const [inline, virtual]

Initialize string parameters for a widget.

Calls to this function are made during initialization to measure the size (that is as part of InitNested()), during drawing, and while re-initializing the window. Only for widgets that render text initializing is requested.

Parameters:
widget Widget number.

Reimplemented from Window.

Definition at line 866 of file ai_gui.cpp.

References ai_debug_company, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), ScriptFileInfo::GetName(), ScriptFileInfo::GetVersion(), INVALID_COMPANY, Company::IsValidAiID(), SetDParam(), and SetDParamStr().

virtual void AIDebugWindow::UpdateWidgetSize ( int  widget,
Dimension size,
const Dimension padding,
Dimension fill,
Dimension resize 
) [inline, virtual]

Update size and resize step of a widget in the window.

After retrieval of the minimal size and the resize-steps of a widget, this function is called to allow further refinement, typically by computing the real maximal size of the content. Afterwards, size is taken to be the minimal size of the widget and resize is taken to contain the resize steps. For the convenience of the callee, padding contains the amount of padding between the content and the edge of the widget. This should be added to the returned size.

Parameters:
widget Widget number.
size Size of the widget.
padding Recommended amount of space between the widget content and the widget edge.
fill Fill step of the widget.
resize Resize step of the widget.

Reimplemented from Window.

Definition at line 756 of file ai_gui.cpp.

References bottom_offset, FONT_HEIGHT_NORMAL, top_offset, and WD_PAR_VSEP_NORMAL.


The documentation for this struct was generated from the following file:

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