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)
 Constructor for the window.
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)
 Change all settings to select another 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, bool gui_scope=true)
 Some data on this window has become invalid.
virtual void OnResize ()
 Called after the window got resized.

Data Fields

int redraw_timer
 Timer for redrawing the window, otherwise it'll happen every tick.
int last_vscroll_pos
 Last position of the scrolling.
bool autoscroll
 Whether automatically scrolling should be enabled or not.
bool show_break_box
 Whether the break/debug box is visible.
int highlight_row
 The output row that matches the given string, or -1.
Scrollbarvscroll
 Cache of the vertical scrollbar.

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
 Maximum length of the break string.
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 775 of file ai_gui.cpp.


Constructor & Destructor Documentation

AIDebugWindow::AIDebugWindow ( const WindowDesc desc,
WindowNumber  number 
) [inline]

Member Function Documentation

void AIDebugWindow::ChangeToAI ( CompanyID  show_ai  )  [inline]
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 956 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, PC_BLACK, AILog::LogData::pos, Window::resize, Backup< T >::Restore(), SA_FORCE, SA_LEFT, ResizeInfo::step_height, top_offset, AILog::LogData::type, AILog::LogData::used, vscroll, 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 1018 of file ai_gui.cpp.

References ai_debug_company, break_check_enabled, case_sensitive_break_check, ChangeToAI(), 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,
bool  gui_scope = true 
) [inline, virtual]

Some data on this window has become invalid.

Parameters:
data Information about the changed data.
gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See InvalidateWindowData() for details.

Reimplemented from Window.

Definition at line 1086 of file ai_gui.cpp.

References _current_company, _pause_mode, ai_debug_company, break_check_enabled, case_sensitive_break_check, CMD_PAUSE, Window::DisableWidget(), DoCommandP(), QueryStringBaseWindow::edit_str_buf, Window::EnableWidget(), AIObject::GetLogPointer(), highlight_row, AILog::LogData::lines, PM_PAUSED_NORMAL, PM_UNPAUSED, AILog::LogData::pos, Backup< T >::Restore(), Window::SetDirty(), Window::SetWidgetDirty(), StrEmpty(), and AI::Suspend().

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 1071 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 1130 of file ai_gui.cpp.

References Scrollbar::SetCapacityFromWidget(), and vscroll.

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 939 of file ai_gui.cpp.

References ai_debug_company, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, 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 830 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 Jun 3 05:19:38 2011 for OpenTTD by  doxygen 1.6.1