# company_gui.cpp File Reference

Company related GUIs. More...

`#include "stdafx.h"`
`#include "gui.h"`
`#include "window_gui.h"`
`#include "textbuf_gui.h"`
`#include "viewport_func.h"`
`#include "gfx_func.h"`
`#include "company_func.h"`
`#include "command_func.h"`
`#include "network/network.h"`
`#include "network/network_gui.h"`
`#include "network/network_func.h"`
`#include "roadveh.h"`
`#include "train.h"`
`#include "aircraft.h"`
`#include "newgrf.h"`
`#include "company_manager_face.h"`
`#include "strings_func.h"`
`#include "date_func.h"`
`#include "string_func.h"`
`#include "widgets/dropdown_type.h"`
`#include "tilehighlight_func.h"`
`#include "settings_type.h"`
`#include "table/strings.h"`

Go to the source code of this file.

## Data Structures
struct | ExpensesList
| Expense list container. More...
struct | CompanyFinancesWindow
class | DropDownListColourItem
struct | SelectCompanyLiveryWindow
class | SelectCompanyManagerFaceWindow
struct | CompanyWindow
| Window with general information about a company. More...
struct | BuyCompanyWindow
## Enumerations
enum | { FIRST_GUI_CALL = INT_MAX }
enum | CompanyFinancesWindowWidgets { CFW_WIDGET_TOGGLE_SIZE = 2, CFW_WIDGET_EXPS_PANEL = 4, CFW_WIDGET_TOTAL_PANEL = 5, CFW_WIDGET_INCREASE_LOAN = 6, CFW_WIDGET_REPAY_LOAN = 7 }
enum | CompanyWindowWidgets { CW_WIDGET_CLOSEBOX = 0, CW_WIDGET_CAPTION, CW_WIDGET_FACE, CW_WIDGET_NEW_FACE, CW_WIDGET_COLOUR_SCHEME, CW_WIDGET_PRESIDENT_NAME, CW_WIDGET_COMPANY_NAME, CW_WIDGET_BUILD_VIEW_HQ, CW_WIDGET_RELOCATE_HQ, CW_WIDGET_BUY_SHARE, CW_WIDGET_SELL_SHARE, CW_WIDGET_COMPANY_PASSWORD, CW_WIDGET_COMPANY_JOIN }
## Functions
static void | DoShowCompanyFinances (CompanyID company, bool show_small, bool show_stickied, int top, int left)
| Open the small/large finance window of the company.
static void | DoSelectCompanyManagerFace (Window *parent, bool adv, int top, int left)
| Open the simple/advanced company manager face selection window.
static void | DrawCompanyEconomyStats (const Company *c, bool small)
void | ShowCompanyFinances (CompanyID company)
void | DrawCompanyManagerFace (CompanyManagerFace cmf, int colour, int x, int y)
| Draws the face of a company manager's face.
static void | DrawCompanyVehiclesAmount (CompanyID company)
| Draws text "Vehicles:" and number of all vehicle types, or "(none)".
int | GetAmountOwnedBy (const Company *c, Owner owner)
static void | DrawCompanyOwnerText (const Company *c)
| Draws list of all companies with shares.
void | ShowCompany (CompanyID company)
void | ShowBuyCompanyDialog (CompanyID company)
## Variables
static ExpensesType | _expenses_list_1 []
| Standard unsorted list of expenses.
static ExpensesType | _expenses_list_2 []
| Grouped list of expenses.
static const ExpensesList | _expenses_list_types []
static const Widget | _company_finances_widgets []
static const Widget | _company_finances_small_widgets []
static const WindowDesc | _company_finances_desc (WDP_AUTO, WDP_AUTO, 407, 60+10, 407, 60+10, WC_FINANCES, WC_NONE, WDF_STD_TOOLTIPS|WDF_STD_BTN|WDF_DEF_WIDGET|WDF_UNCLICK_BUTTONS|WDF_STICKY_BUTTON, _company_finances_widgets)
static const WindowDesc | _company_finances_small_desc (WDP_AUTO, WDP_AUTO, 280, 60, 280, 60, WC_FINANCES, WC_NONE, WDF_STD_TOOLTIPS|WDF_STD_BTN|WDF_DEF_WIDGET|WDF_UNCLICK_BUTTONS|WDF_STICKY_BUTTON, _company_finances_small_widgets)
static const StringID | _colour_dropdown []
static const LiveryClass | _livery_class [LS_END]
static const Widget | _select_company_livery_widgets []
static const WindowDesc | _select_company_livery_desc (WDP_AUTO, WDP_AUTO, 400, 49+1 *14, 400, 49+1 *14, WC_COMPANY_COLOUR, WC_NONE, WDF_STD_TOOLTIPS|WDF_STD_BTN|WDF_DEF_WIDGET, _select_company_livery_widgets)
static const Widget | _select_company_manager_face_widgets []
| Widget description for the normal/simple company manager face selection dialog.
static const Widget | _select_company_manager_face_adv_widgets []
| Widget description for the advanced company manager face selection dialog.
static const WindowDesc | _select_company_manager_face_desc (WDP_AUTO, WDP_AUTO, 190, 163, 190, 163, WC_COMPANY_MANAGER_FACE, WC_NONE, WDF_STD_TOOLTIPS|WDF_STD_BTN|WDF_DEF_WIDGET|WDF_UNCLICK_BUTTONS|WDF_CONSTRUCTION, _select_company_manager_face_widgets)
| normal/simple company manager face selection window description
static const WindowDesc | _select_company_manager_face_adv_desc (WDP_AUTO, WDP_AUTO, 220, 220, 220, 220, WC_COMPANY_MANAGER_FACE, WC_NONE, WDF_STD_TOOLTIPS|WDF_STD_BTN|WDF_DEF_WIDGET|WDF_UNCLICK_BUTTONS|WDF_CONSTRUCTION, _select_company_manager_face_adv_widgets)
| advanced company manager face selection window description
static const Widget | _company_widgets []
static const WindowDesc | _company_desc (WDP_AUTO, WDP_AUTO, 360, 170, 360, 170, WC_COMPANY, WC_NONE, WDF_STD_TOOLTIPS|WDF_STD_BTN|WDF_DEF_WIDGET|WDF_UNCLICK_BUTTONS, _company_widgets)
static const Widget | _buy_company_widgets []
static const WindowDesc | _buy_company_desc (153, 171, 334, 137, 334, 137, WC_BUY_COMPANY, WC_NONE, WDF_STD_TOOLTIPS|WDF_STD_BTN|WDF_DEF_WIDGET|WDF_CONSTRUCTION, _buy_company_widgets)

## Detailed Description

Company related GUIs.

Definition in file company_gui.cpp.

## Enumeration Type Documentation

anonymous enum

Enumerator:

  FIRST_GUI_CALL | default value to specify thuis is the first call of the resizable gui

Definition at line 30 of file company_gui.cpp.

## Function Documentation

static void DoSelectCompanyManagerFace | ( | Window * | parent,
|  | bool | adv,
|  | int | top,
|  | int | left |
| ) |  |  | `[static]`

Open the simple/advanced company manager face selection window.

Parameters:

  | parent | the parent company window
  | adv | simple or advanced face selection window
  | top | previous top position of the window
  | left | previous left position of the window

Definition at line 1119 of file company_gui.cpp.

References _select_company_manager_face_adv_desc, _select_company_manager_face_desc, BringWindowToFrontById(), and Window::window_number.

Referenced by CompanyWindow::OnClick().

static void DoShowCompanyFinances | ( | CompanyID | company,
|  | bool | show_small,
|  | bool | show_stickied,
|  | int | top,
|  | int | left |
| ) |  |  | `[static]`

Open the small/large finance window of the company.

Parameters:

  | company | the company who's finances are requested to be seen
  | show_small | show large or small version opf the window
  | show_stickied | previous "stickyness" of the window
  | top | previous top position of the window
  | left | previous left position of the window

Precondition:
  is company a valid company

Definition at line 338 of file company_gui.cpp.

References BringWindowToFrontById().

void DrawCompanyManagerFace | ( | CompanyManagerFace | cmf,
|  | int | colour,
|  | int | x,
|  | int | y |
| ) |  |  |

Draws the face of a company manager's face.

Parameters:

  | cmf | the company manager's face
  | colour | the (background) colour of the gradient
  | x | x-position to draw the face
  | y | y-position to draw the face

Definition at line 643 of file company_gui.cpp.

References _cmf_info, DrawSprite(), GE_WM, GENDER_FEMALE, GetCompanyManagerFaceBits(), GetCompanyManagerFaceSprite(), and HasBit().

Referenced by CompanyWindow::OnPaint().

static void DrawCompanyOwnerText | ( | const Company * | c | ) | `[static]`

Draws list of all companies with shares.

Parameters:

  | c | pointer to the Company structure

Definition at line 1231 of file company_gui.cpp.

References DrawString(), and GetCharacterHeight().

Referenced by CompanyWindow::OnPaint().

static void DrawCompanyVehiclesAmount | ( | CompanyID | company | ) | `[static]`

Draws text "Vehicles:" and number of all vehicle types, or "(none)".

Parameters:

  | company | ID of company to print statistics of

Definition at line 1167 of file company_gui.cpp.

References DrawString(), IsFrontEngine(), and IsNormalAircraft().

Referenced by CompanyWindow::OnPaint().

## Variable Documentation

const Widget _buy_company_widgets[]`[static]`

Initial value:

     {
    {   WWT_CLOSEBOX,   RESIZE_NONE,  COLOUR_LIGHT_BLUE,     0,    10,     0,    13, STR_00C5,              STR_018B_CLOSE_WINDOW},
    {    WWT_CAPTION,   RESIZE_NONE,  COLOUR_LIGHT_BLUE,    11,   333,     0,    13, STR_00B3_MESSAGE_FROM, STR_018C_WINDOW_TITLE_DRAG_THIS},
    {      WWT_PANEL,   RESIZE_NONE,  COLOUR_LIGHT_BLUE,     0,   333,    14,   136, 0x0,                   STR_NULL},
    {    WWT_TEXTBTN,   RESIZE_NONE,  COLOUR_LIGHT_BLUE,   148,   207,   117,   128, STR_00C9_NO,           STR_NULL},
    {    WWT_TEXTBTN,   RESIZE_NONE,  COLOUR_LIGHT_BLUE,   218,   277,   117,   128, STR_00C8_YES,          STR_NULL},
    {   WIDGETS_END},
    }

Definition at line 1509 of file company_gui.cpp.

const StringID _colour_dropdown[]`[static]`

Initial value:

     {
      STR_00D1_DARK_BLUE,
      STR_00D2_PALE_GREEN,
      STR_00D3_PINK,
      STR_00D4_YELLOW,
      STR_00D5_RED,
      STR_00D6_LIGHT_BLUE,
      STR_00D7_GREEN,
      STR_00D8_DARK_GREEN,
      STR_00D9_BLUE,
      STR_00DA_CREAM,
      STR_00DB_MAUVE,
      STR_00DC_PURPLE,
      STR_00DD_ORANGE,
      STR_00DE_BROWN,
      STR_00DF_GREY,
      STR_00E0_WHITE,
    }

Definition at line 352 of file company_gui.cpp.

const Widget _company_finances_small_widgets[]`[static]`

Initial value:

     {
    {   WWT_CLOSEBOX,   RESIZE_NONE,  COLOUR_GREY,     0,    10,     0,    13, STR_00C5,               STR_018B_CLOSE_WINDOW},
    {    WWT_CAPTION,   RESIZE_NONE,  COLOUR_GREY,    11,   253,     0,    13, STR_700E_FINANCES,      STR_018C_WINDOW_TITLE_DRAG_THIS},
    {     WWT_IMGBTN,   RESIZE_NONE,  COLOUR_GREY,   254,   267,     0,    13, SPR_LARGE_SMALL_WINDOW, STR_7075_TOGGLE_LARGE_SMALL_WINDOW},
    {  WWT_STICKYBOX,   RESIZE_NONE,  COLOUR_GREY,   268,   279,     0,    13, 0x0,                    STR_STICKY_BUTTON},
    {      WWT_EMPTY,   RESIZE_NONE,  COLOUR_GREY,     0,     0,     0,     0, 0x0,                    STR_NULL},
    {      WWT_PANEL,   RESIZE_NONE,  COLOUR_GREY,     0,   279,    14,    47, STR_NULL,               STR_NULL},
    { WWT_PUSHTXTBTN,   RESIZE_NONE,  COLOUR_GREY,     0,   139,    48,    59, STR_7029_BORROW,        STR_7035_INCREASE_SIZE_OF_LOAN},
    { WWT_PUSHTXTBTN,   RESIZE_NONE,  COLOUR_GREY,   140,   279,    48,    59, STR_702A_REPAY,         STR_7036_REPAY_PART_OF_LOAN},
    {   WIDGETS_END},
    }

Definition at line 211 of file company_gui.cpp.

const Widget _company_finances_widgets[]`[static]`

Initial value:

     {
    {   WWT_CLOSEBOX,   RESIZE_NONE,  COLOUR_GREY,     0,    10,       0,      13, STR_00C5,               STR_018B_CLOSE_WINDOW},
    {    WWT_CAPTION,   RESIZE_NONE,  COLOUR_GREY,    11,   379,       0,      13, STR_700E_FINANCES,      STR_018C_WINDOW_TITLE_DRAG_THIS},
    {     WWT_IMGBTN,   RESIZE_NONE,  COLOUR_GREY,   380,   394,       0,      13, SPR_LARGE_SMALL_WINDOW, STR_7075_TOGGLE_LARGE_SMALL_WINDOW},
    {  WWT_STICKYBOX,   RESIZE_NONE,  COLOUR_GREY,   395,   406,       0,      13, 0x0,                    STR_STICKY_BUTTON},
    {      WWT_PANEL,   RESIZE_NONE,  COLOUR_GREY,     0,   406,      14, 13 + 10, 0x0,    STR_NULL},
    {      WWT_PANEL,   RESIZE_NONE,  COLOUR_GREY,     0,   406, 14 + 10, 47 + 10, 0x0, STR_NULL},
    { WWT_PUSHTXTBTN,   RESIZE_NONE,  COLOUR_GREY,     0,   202, 48 + 10, 59 + 10, STR_7029_BORROW,        STR_7035_INCREASE_SIZE_OF_LOAN},
    { WWT_PUSHTXTBTN,   RESIZE_NONE,  COLOUR_GREY,   203,   406, 48 + 10, 59 + 10, STR_702A_REPAY,         STR_7036_REPAY_PART_OF_LOAN},
    {   WIDGETS_END},
    }

Definition at line 199 of file company_gui.cpp.

const Widget _company_widgets[]`[static]`

Initial value:

     {
    {   WWT_CLOSEBOX,   RESIZE_NONE,  COLOUR_GREY,     0,    10,     0,    13, STR_00C5,                          STR_018B_CLOSE_WINDOW},
    {    WWT_CAPTION,   RESIZE_NONE,  COLOUR_GREY,    11,   359,     0,    13, STR_7001,                          STR_018C_WINDOW_TITLE_DRAG_THIS},
    {      WWT_PANEL,   RESIZE_NONE,  COLOUR_GREY,     0,   359,    14,   157, 0x0,                               STR_NULL},
    { WWT_PUSHTXTBTN,   RESIZE_NONE,  COLOUR_GREY,     0,    89,   158,   169, STR_7004_NEW_FACE,                 STR_7030_SELECT_NEW_FACE_FOR_PRESIDENT},
    { WWT_PUSHTXTBTN,   RESIZE_NONE,  COLOUR_GREY,    90,   179,   158,   169, STR_7005_COLOUR_SCHEME,            STR_7031_CHANGE_THE_COMPANY_VEHICLE},
    { WWT_PUSHTXTBTN,   RESIZE_NONE,  COLOUR_GREY,   180,   269,   158,   169, STR_7009_PRESIDENT_NAME,           STR_7032_CHANGE_THE_PRESIDENT_S},
    { WWT_PUSHTXTBTN,   RESIZE_NONE,  COLOUR_GREY,   270,   359,   158,   169, STR_7008_COMPANY_NAME,             STR_7033_CHANGE_THE_COMPANY_NAME},
    {    WWT_TEXTBTN,   RESIZE_NONE,  COLOUR_GREY,   266,   355,    18,    29, STR_7072_VIEW_HQ,                  STR_7070_BUILD_COMPANY_HEADQUARTERS},
    {    WWT_TEXTBTN,   RESIZE_NONE,  COLOUR_GREY,   266,   355,    32,    43, STR_RELOCATE_HQ,                   STR_RELOCATE_COMPANY_HEADQUARTERS},
    { WWT_PUSHTXTBTN,   RESIZE_NONE,  COLOUR_GREY,     0,   179,   158,   169, STR_7077_BUY_25_SHARE_IN_COMPANY,  STR_7079_BUY_25_SHARE_IN_THIS_COMPANY},
    { WWT_PUSHTXTBTN,   RESIZE_NONE,  COLOUR_GREY,   180,   359,   158,   169, STR_7078_SELL_25_SHARE_IN_COMPANY, STR_707A_SELL_25_SHARE_IN_THIS_COMPANY},
    { WWT_PUSHTXTBTN,   RESIZE_NONE,  COLOUR_GREY,   266,   355,   138,   149, STR_COMPANY_PASSWORD,              STR_COMPANY_PASSWORD_TOOLTIP},
    { WWT_PUSHTXTBTN,   RESIZE_NONE,  COLOUR_GREY,   266,   355,   138,   149, STR_COMPANY_JOIN,                  STR_COMPANY_JOIN_TIP},
    {   WIDGETS_END},
    }

Definition at line 1145 of file company_gui.cpp.

ExpensesType _expenses_list_1[]`[static]`

Initial value:

     {
      EXPENSES_CONSTRUCTION,
      EXPENSES_NEW_VEHICLES,
      EXPENSES_TRAIN_RUN,
      EXPENSES_ROADVEH_RUN,
      EXPENSES_AIRCRAFT_RUN,
      EXPENSES_SHIP_RUN,
      EXPENSES_PROPERTY,
      EXPENSES_TRAIN_INC,
      EXPENSES_ROADVEH_INC,
      EXPENSES_AIRCRAFT_INC,
      EXPENSES_SHIP_INC,
      EXPENSES_LOAN_INT,
      EXPENSES_OTHER,
    }

Standard unsorted list of expenses.

Definition at line 38 of file company_gui.cpp.

ExpensesType _expenses_list_2[]`[static]`

Initial value:

     {
      EXPENSES_TRAIN_INC,
      EXPENSES_ROADVEH_INC,
      EXPENSES_AIRCRAFT_INC,
      EXPENSES_SHIP_INC,
      INVALID_EXPENSES,
      EXPENSES_TRAIN_RUN,
      EXPENSES_ROADVEH_RUN,
      EXPENSES_AIRCRAFT_RUN,
      EXPENSES_SHIP_RUN,
      EXPENSES_PROPERTY,
      EXPENSES_LOAN_INT,
      INVALID_EXPENSES,
      EXPENSES_CONSTRUCTION,
      EXPENSES_NEW_VEHICLES,
      EXPENSES_OTHER,
      INVALID_EXPENSES,
    }

Grouped list of expenses.

Definition at line 55 of file company_gui.cpp.

const ExpensesList _expenses_list_types[]`[static]`

Initial value:

     {
      { _expenses_list_1, lengthof(_expenses_list_1), lengthof(_expenses_list_1) * 10 },
      { _expenses_list_2, lengthof(_expenses_list_2), lengthof(_expenses_list_2) * 10 + 3 * 12 },
    }

Definition at line 81 of file company_gui.cpp.

const LiveryClass _livery_class[LS_END]`[static]`

Initial value:

     {
      LC_OTHER,
      LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL,
      LC_ROAD, LC_ROAD,
      LC_SHIP, LC_SHIP,
      LC_AIRCRAFT, LC_AIRCRAFT, LC_AIRCRAFT,
      LC_ROAD, LC_ROAD,
    }

Definition at line 372 of file company_gui.cpp.

const Widget _select_company_livery_widgets[]`[static]`

Initial value:

     {
    { WWT_CLOSEBOX, RESIZE_NONE,  COLOUR_GREY,   0,  10,   0,  13, STR_00C5,                   STR_018B_CLOSE_WINDOW },
    {  WWT_CAPTION, RESIZE_NONE,  COLOUR_GREY,  11, 399,   0,  13, STR_7007_NEW_COLOUR_SCHEME, STR_018C_WINDOW_TITLE_DRAG_THIS },
    {   WWT_IMGBTN, RESIZE_NONE,  COLOUR_GREY,   0,  21,  14,  35, SPR_IMG_COMPANY_GENERAL,    STR_LIVERY_GENERAL_TIP },
    {   WWT_IMGBTN, RESIZE_NONE,  COLOUR_GREY,  22,  43,  14,  35, SPR_IMG_TRAINLIST,          STR_LIVERY_TRAIN_TIP },
    {   WWT_IMGBTN, RESIZE_NONE,  COLOUR_GREY,  44,  65,  14,  35, SPR_IMG_TRUCKLIST,          STR_LIVERY_ROADVEH_TIP },
    {   WWT_IMGBTN, RESIZE_NONE,  COLOUR_GREY,  66,  87,  14,  35, SPR_IMG_SHIPLIST,           STR_LIVERY_SHIP_TIP },
    {   WWT_IMGBTN, RESIZE_NONE,  COLOUR_GREY,  88, 109,  14,  35, SPR_IMG_AIRPLANESLIST,      STR_LIVERY_AIRCRAFT_TIP },
    {    WWT_PANEL, RESIZE_NONE,  COLOUR_GREY, 110, 399,  14,  35, 0x0,                        STR_NULL },
    {    WWT_PANEL, RESIZE_NONE,  COLOUR_GREY,   0, 149,  36,  47, 0x0,                        STR_NULL },
    { WWT_DROPDOWN, RESIZE_NONE,  COLOUR_GREY, 150, 274,  36,  47, STR_02BD,                   STR_LIVERY_PRIMARY_TIP },
    { WWT_DROPDOWN, RESIZE_NONE,  COLOUR_GREY, 275, 399,  36,  47, STR_02E1,                   STR_LIVERY_SECONDARY_TIP },
    {   WWT_MATRIX, RESIZE_NONE,  COLOUR_GREY,   0, 399,  48,  48 + 1 * 14, (1 << 8) | 1,      STR_LIVERY_PANEL_TIP },
    { WIDGETS_END },
    }

Definition at line 613 of file company_gui.cpp.

const Widget _select_company_manager_face_widgets[]`[static]`

Initial value:

     {
    {   WWT_CLOSEBOX,   RESIZE_NONE,  COLOUR_GREY,     0,    10,     0,    13, STR_00C5,                STR_018B_CLOSE_WINDOW},
    {    WWT_CAPTION,   RESIZE_NONE,  COLOUR_GREY,    11,   174,     0,    13, STR_7043_FACE_SELECTION, STR_018C_WINDOW_TITLE_DRAG_THIS},
    {     WWT_IMGBTN,   RESIZE_NONE,  COLOUR_GREY,   175,   189,     0,    13, SPR_LARGE_SMALL_WINDOW,  STR_FACE_ADVANCED_TIP},
    {      WWT_PANEL,   RESIZE_NONE,  COLOUR_GREY,     0,   189,    14,   150, 0x0,                     STR_NULL},
    { WWT_PUSHTXTBTN,   RESIZE_NONE,  COLOUR_GREY,     0,    94,   151,   162, STR_012E_CANCEL,         STR_7047_CANCEL_NEW_FACE_SELECTION},
    { WWT_PUSHTXTBTN,   RESIZE_NONE,  COLOUR_GREY,    95,   189,   151,   162, STR_012F_OK,             STR_7048_ACCEPT_NEW_FACE_SELECTION},
    {    WWT_TEXTBTN,   RESIZE_NONE,  COLOUR_GREY,    95,   187,    75,    86, STR_7044_MALE,           STR_7049_SELECT_MALE_FACES},
    {    WWT_TEXTBTN,   RESIZE_NONE,  COLOUR_GREY,    95,   187,    87,    98, STR_7045_FEMALE,         STR_704A_SELECT_FEMALE_FACES},
    { WWT_PUSHTXTBTN,   RESIZE_NONE,  COLOUR_GREY,     2,    93,   137,   148, STR_7046_NEW_FACE,       STR_704B_GENERATE_RANDOM_NEW_FACE},
    { WWT_PUSHTXTBTN,   RESIZE_NONE,  COLOUR_GREY,    95,   187,    16,    27, STR_FACE_ADVANCED,       STR_FACE_ADVANCED_TIP},
    {   WIDGETS_END},
    }

Widget description for the normal/simple company manager face selection dialog.

Definition at line 681 of file company_gui.cpp.