graph_gui.cpp File Reference

GUI that shows performance graphs. More...

#include "stdafx.h"
#include "graph_gui.h"
#include "window_gui.h"
#include "company_base.h"
#include "company_gui.h"
#include "economy_func.h"
#include "cargotype.h"
#include "strings_func.h"
#include "window_func.h"
#include "date_func.h"
#include "gfx_func.h"
#include "sortlist_type.h"
#include "core/geometry_func.hpp"
#include "math.h"
#include "currency.h"
#include "table/strings.h"
#include "table/sprites.h"

Go to the source code of this file.

Data Structures

struct  GraphLegendWindow
struct  ValuesInterval
 Contains the interval of a graph's data. More...
struct  BaseGraphWindow
struct  OperatingProfitGraphWindow
struct  IncomeGraphWindow
struct  DeliveredCargoGraphWindow
struct  PerformanceHistoryGraphWindow
struct  CompanyValueGraphWindow
struct  PaymentRatesGraphWindow
class  CompanyLeagueWindow
struct  PerformanceRatingDetailWindow

Enumerations

enum  GraphLegendWidgetNumbers { GLW_BACKGROUND, GLW_FIRST_COMPANY, GLW_LAST_COMPANY = GLW_FIRST_COMPANY + MAX_COMPANIES - 1 }
 

Widget numbers of the graph legend window.

More...
enum  CompanyValueWidgets { BGW_KEY_BUTTON, BGW_BACKGROUND, BGW_GRAPH, BGW_RESIZE }
 

Widget numbers of a base graph window.

More...
enum  PerformanceHistoryGraphWidgets {
  PHW_KEY, PHW_DETAILED_PERFORMANCE, PHW_BACKGROUND, PHW_GRAPH,
  PHW_RESIZE
}
 

Widget numbers of the performance history window.

More...
enum  CargoPaymentRatesWidgets {
  CPW_BACKGROUND, CPW_HEADER, CPW_GRAPH, CPW_RESIZE,
  CPW_FOOTER, CPW_ENABLE_CARGOS, CPW_DISABLE_CARGOS, CPW_CARGO_FIRST
}
 

Widget numbers of the cargo payment rates.

More...
enum  CompanyLeagueWidgets { CLW_BACKGROUND }
 

Widget numbers for the company league window.

More...
enum  PerformanceRatingDetailsWidgets { PRW_SCORE_FIRST, PRW_SCORE_LAST = PRW_SCORE_FIRST + (SCORE_END - SCORE_BEGIN) - 1, PRW_COMPANY_FIRST, PRW_COMPANY_LAST = PRW_COMPANY_FIRST + MAX_COMPANIES - 1 }
 

Widget numbers of the performance rating details window.

More...

Functions

static NWidgetBaseMakeNWidgetCompanyLines (int *biggest_index)
 Construct a vertical list of buttons, one for each company.
static void ShowGraphLegend ()
void ShowOperatingProfitGraph ()
void ShowIncomeGraph ()
void ShowDeliveredCargoGraph ()
void ShowPerformanceHistoryGraph ()
void ShowCompanyValueGraph ()
static NWidgetBaseMakeCargoButtons (int *biggest_index)
 Construct the row containing the digit keys.
void ShowCargoPaymentRates ()
static StringID GetPerformanceTitleFromValue (uint value)
void ShowCompanyLeagueTable ()
static NWidgetBaseMakePerformanceDetailPanels (int *biggest_index)
 Make a vertical list of panels for outputting score details.
NWidgetBaseMakeCompanyButtonRowsGraphGUI (int *biggest_index)
 Make a number of rows with buttons for each company for the performance rating detail window.
void ShowPerformanceRatingDetail ()

Variables

static uint _legend_excluded_companies
static uint _legend_excluded_cargo
static const OverflowSafeInt64 INVALID_DATAPOINT (INT64_MAX)
static const uint INVALID_DATAPOINT_POS = UINT_MAX
static const NWidgetPart _nested_graph_legend_widgets []
static const WindowDesc _graph_legend_desc (WDP_AUTO, 0, 0, WC_GRAPH_LEGEND, WC_NONE, 0, _nested_graph_legend_widgets, lengthof(_nested_graph_legend_widgets))
static const NWidgetPart _nested_operating_profit_widgets []
static const WindowDesc _operating_profit_desc (WDP_AUTO, 0, 0, WC_OPERATING_PROFIT, WC_NONE, WDF_UNCLICK_BUTTONS, _nested_operating_profit_widgets, lengthof(_nested_operating_profit_widgets))
static const NWidgetPart _nested_income_graph_widgets []
static const WindowDesc _income_graph_desc (WDP_AUTO, 0, 0, WC_INCOME_GRAPH, WC_NONE, WDF_UNCLICK_BUTTONS, _nested_income_graph_widgets, lengthof(_nested_income_graph_widgets))
static const NWidgetPart _nested_delivered_cargo_graph_widgets []
static const WindowDesc _delivered_cargo_graph_desc (WDP_AUTO, 0, 0, WC_DELIVERED_CARGO, WC_NONE, WDF_UNCLICK_BUTTONS, _nested_delivered_cargo_graph_widgets, lengthof(_nested_delivered_cargo_graph_widgets))
static const NWidgetPart _nested_performance_history_widgets []
static const WindowDesc _performance_history_desc (WDP_AUTO, 0, 0, WC_PERFORMANCE_HISTORY, WC_NONE, WDF_UNCLICK_BUTTONS, _nested_performance_history_widgets, lengthof(_nested_performance_history_widgets))
static const NWidgetPart _nested_company_value_graph_widgets []
static const WindowDesc _company_value_graph_desc (WDP_AUTO, 0, 0, WC_COMPANY_VALUE, WC_NONE, WDF_UNCLICK_BUTTONS, _nested_company_value_graph_widgets, lengthof(_nested_company_value_graph_widgets))
static const NWidgetPart _nested_cargo_payment_rates_widgets []
static const WindowDesc _cargo_payment_rates_desc (WDP_AUTO, 0, 0, WC_PAYMENT_RATES, WC_NONE, WDF_UNCLICK_BUTTONS, _nested_cargo_payment_rates_widgets, lengthof(_nested_cargo_payment_rates_widgets))
static const StringID _performance_titles []
static const NWidgetPart _nested_company_league_widgets []
static const WindowDesc _company_league_desc (WDP_AUTO, 0, 0, WC_COMPANY_LEAGUE, WC_NONE, 0, _nested_company_league_widgets, lengthof(_nested_company_league_widgets))
static const NWidgetPart _nested_performance_rating_detail_widgets []
static const WindowDesc _performance_rating_detail_desc (WDP_AUTO, 0, 0, WC_PERFORMANCE_DETAIL, WC_NONE, 0, _nested_performance_rating_detail_widgets, lengthof(_nested_performance_rating_detail_widgets))

Detailed Description

GUI that shows performance graphs.

Definition in file graph_gui.cpp.


Enumeration Type Documentation

Widget numbers of the cargo payment rates.

Definition at line 882 of file graph_gui.cpp.

Widget numbers for the company league window.

Definition at line 1125 of file graph_gui.cpp.

Widget numbers of a base graph window.

Definition at line 170 of file graph_gui.cpp.

Widget numbers of the graph legend window.

Definition at line 44 of file graph_gui.cpp.

Widget numbers of the performance history window.

Definition at line 770 of file graph_gui.cpp.

Widget numbers of the performance rating details window.

Definition at line 1311 of file graph_gui.cpp.


Function Documentation

static NWidgetBase* MakeCargoButtons ( int *  biggest_index  )  [static]
NWidgetBase* MakeCompanyButtonRowsGraphGUI ( int *  biggest_index  ) 

Make a number of rows with buttons for each company for the performance rating detail window.

Definition at line 1584 of file graph_gui.cpp.

References MakeCompanyButtonRows().

static NWidgetBase* MakeNWidgetCompanyLines ( int *  biggest_index  )  [static]

Construct a vertical list of buttons, one for each company.

Parameters:
biggest_index Storage for collecting the biggest index used in the returned tree.
Returns:
Panel with company buttons.
Postcondition:
*biggest_index contains the largest used index in the tree.

Definition at line 115 of file graph_gui.cpp.

References NWidgetContainer::Add(), FONT_HEIGHT_NORMAL, NWidgetCore::SetDataTip(), NWidgetResizeBase::SetFill(), NWidgetResizeBase::SetMinimalSize(), WD_FRAMERECT_BOTTOM, WD_FRAMERECT_TOP, and WWT_PANEL.

static NWidgetBase* MakePerformanceDetailPanels ( int *  biggest_index  )  [static]

Make a vertical list of panels for outputting score details.

Parameters:
biggest_index Storage for collecting the biggest index used in the returned tree.
Returns:
Panel with performance details.
Postcondition:
*biggest_index contains the largest used index in the tree.

Definition at line 1555 of file graph_gui.cpp.

References NWidgetContainer::Add(), lengthof, NC_EQUALSIZE, SCORE_END, NWidgetCore::SetDataTip(), NWidgetResizeBase::SetFill(), and WWT_PANEL.


Variable Documentation

const NWidgetPart _nested_company_league_widgets[] [static]
Initial value:
 {
  NWidget(NWID_HORIZONTAL),
    NWidget(WWT_CLOSEBOX, COLOUR_GREY),
    NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_COMPANY_LEAGUE_TABLE_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
    NWidget(WWT_SHADEBOX, COLOUR_GREY),
    NWidget(WWT_STICKYBOX, COLOUR_GREY),
  EndContainer(),
  NWidget(WWT_PANEL, COLOUR_GREY, CLW_BACKGROUND), SetMinimalSize(400, 0), SetMinimalTextLines(15, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM),
}

Definition at line 1284 of file graph_gui.cpp.

const NWidgetPart _nested_company_value_graph_widgets[] [static]
Initial value:
 {
  NWidget(NWID_HORIZONTAL),
    NWidget(WWT_CLOSEBOX, COLOUR_GREY),
    NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_GRAPH_COMPANY_VALUES_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
    NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, BGW_KEY_BUTTON), SetMinimalSize(50, 0), SetMinimalTextLines(1, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM + 2), SetDataTip(STR_GRAPH_KEY_BUTTON, STR_GRAPH_KEY_TOOLTIP),
    NWidget(WWT_SHADEBOX, COLOUR_GREY),
    NWidget(WWT_STICKYBOX, COLOUR_GREY),
  EndContainer(),
  NWidget(WWT_PANEL, COLOUR_GREY, BGW_BACKGROUND),
    NWidget(NWID_HORIZONTAL),
      NWidget(WWT_EMPTY, COLOUR_GREY, BGW_GRAPH), SetMinimalSize(576, 224), SetFill(1, 1), SetResize(1, 1),
      NWidget(NWID_VERTICAL),
        NWidget(NWID_SPACER), SetFill(0, 1), SetResize(0, 1),
        NWidget(WWT_RESIZEBOX, COLOUR_GREY, BGW_RESIZE),
      EndContainer(),
    EndContainer(),
  EndContainer(),
}

Definition at line 846 of file graph_gui.cpp.

const NWidgetPart _nested_delivered_cargo_graph_widgets[] [static]
Initial value:
 {
  NWidget(NWID_HORIZONTAL),
    NWidget(WWT_CLOSEBOX, COLOUR_GREY),
    NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_GRAPH_CARGO_DELIVERED_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
    NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, BGW_KEY_BUTTON), SetMinimalSize(50, 0), SetMinimalTextLines(1, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM + 2), SetDataTip(STR_GRAPH_KEY_BUTTON, STR_GRAPH_KEY_TOOLTIP),
    NWidget(WWT_SHADEBOX, COLOUR_GREY),
    NWidget(WWT_STICKYBOX, COLOUR_GREY),
  EndContainer(),
  NWidget(WWT_PANEL, COLOUR_GREY, BGW_BACKGROUND),
    NWidget(NWID_HORIZONTAL),
      NWidget(WWT_EMPTY, COLOUR_GREY, BGW_GRAPH), SetMinimalSize(576, 128), SetFill(1, 1), SetResize(1, 1),
      NWidget(NWID_VERTICAL),
        NWidget(NWID_SPACER), SetFill(0, 1), SetResize(0, 1),
        NWidget(WWT_RESIZEBOX, COLOUR_GREY, BGW_RESIZE),
      EndContainer(),
    EndContainer(),
  EndContainer(),
}

Definition at line 734 of file graph_gui.cpp.

const NWidgetPart _nested_graph_legend_widgets[] [static]
Initial value:
 {
  NWidget(NWID_HORIZONTAL),
    NWidget(WWT_CLOSEBOX, COLOUR_GREY),
    NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_GRAPH_KEY_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
    NWidget(WWT_SHADEBOX, COLOUR_GREY),
    NWidget(WWT_STICKYBOX, COLOUR_GREY),
  EndContainer(),
  NWidget(WWT_PANEL, COLOUR_GREY, GLW_BACKGROUND),
    NWidget(NWID_SPACER), SetMinimalSize(0, 2),
    NWidget(NWID_HORIZONTAL),
      NWidget(NWID_SPACER), SetMinimalSize(2, 0),
      NWidgetFunction(MakeNWidgetCompanyLines),
      NWidget(NWID_SPACER), SetMinimalSize(2, 0),
    EndContainer(),
  EndContainer(),
}

Definition at line 130 of file graph_gui.cpp.

const NWidgetPart _nested_income_graph_widgets[] [static]
Initial value:
 {
  NWidget(NWID_HORIZONTAL),
    NWidget(WWT_CLOSEBOX, COLOUR_GREY),
    NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_GRAPH_INCOME_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
    NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, BGW_KEY_BUTTON), SetMinimalSize(50, 0), SetMinimalTextLines(1, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM + 2), SetDataTip(STR_GRAPH_KEY_BUTTON, STR_GRAPH_KEY_TOOLTIP),
    NWidget(WWT_SHADEBOX, COLOUR_GREY),
    NWidget(WWT_STICKYBOX, COLOUR_GREY),
  EndContainer(),
  NWidget(WWT_PANEL, COLOUR_GREY, BGW_BACKGROUND),
    NWidget(NWID_HORIZONTAL),
      NWidget(WWT_EMPTY, COLOUR_GREY, BGW_GRAPH), SetMinimalSize(576, 128), SetFill(1, 1), SetResize(1, 1),
      NWidget(NWID_VERTICAL),
        NWidget(NWID_SPACER), SetFill(0, 1), SetResize(0, 1),
        NWidget(WWT_RESIZEBOX, COLOUR_GREY, BGW_RESIZE),
      EndContainer(),
    EndContainer(),
  EndContainer(),
}

Definition at line 685 of file graph_gui.cpp.

const NWidgetPart _nested_operating_profit_widgets[] [static]
Initial value:
 {
  NWidget(NWID_HORIZONTAL),
    NWidget(WWT_CLOSEBOX, COLOUR_GREY),
    NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_GRAPH_OPERATING_PROFIT_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
    NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, BGW_KEY_BUTTON), SetMinimalSize(50, 0), SetMinimalTextLines(1, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM + 2), SetDataTip(STR_GRAPH_KEY_BUTTON, STR_GRAPH_KEY_TOOLTIP),
    NWidget(WWT_SHADEBOX, COLOUR_GREY),
    NWidget(WWT_STICKYBOX, COLOUR_GREY),
  EndContainer(),
  NWidget(WWT_PANEL, COLOUR_GREY, BGW_BACKGROUND),
    NWidget(NWID_HORIZONTAL),
      NWidget(WWT_EMPTY, COLOUR_GREY, BGW_GRAPH), SetMinimalSize(576, 160), SetFill(1, 1), SetResize(1, 1),
      NWidget(NWID_VERTICAL),
        NWidget(NWID_SPACER), SetFill(0, 1), SetResize(0, 1),
        NWidget(WWT_RESIZEBOX, COLOUR_GREY, BGW_RESIZE),
      EndContainer(),
    EndContainer(),
  EndContainer(),
}

Definition at line 635 of file graph_gui.cpp.

const NWidgetPart _nested_performance_history_widgets[] [static]
Initial value:
 {
  NWidget(NWID_HORIZONTAL),
    NWidget(WWT_CLOSEBOX, COLOUR_GREY),
    NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_GRAPH_COMPANY_PERFORMANCE_RATINGS_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
    NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, PHW_DETAILED_PERFORMANCE), SetMinimalSize(50, 0), SetMinimalTextLines(1, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM + 2), SetDataTip(STR_PERFORMANCE_DETAIL_KEY, STR_GRAPH_PERFORMANCE_DETAIL_TOOLTIP),
    NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, PHW_KEY), SetMinimalSize(50, 0), SetMinimalTextLines(1, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM + 2), SetDataTip(STR_GRAPH_KEY_BUTTON, STR_GRAPH_KEY_TOOLTIP),
    NWidget(WWT_SHADEBOX, COLOUR_GREY),
    NWidget(WWT_STICKYBOX, COLOUR_GREY),
  EndContainer(),
  NWidget(WWT_PANEL, COLOUR_GREY, PHW_BACKGROUND),
    NWidget(NWID_HORIZONTAL),
      NWidget(WWT_EMPTY, COLOUR_GREY, PHW_GRAPH), SetMinimalSize(576, 224), SetFill(1, 1), SetResize(1, 1),
      NWidget(NWID_VERTICAL),
        NWidget(NWID_SPACER), SetFill(0, 1), SetResize(0, 1),
        NWidget(WWT_RESIZEBOX, COLOUR_GREY, PHW_RESIZE),
      EndContainer(),
    EndContainer(),
  EndContainer(),
}

Definition at line 797 of file graph_gui.cpp.

const NWidgetPart _nested_performance_rating_detail_widgets[] [static]
Initial value:
 {
  NWidget(NWID_HORIZONTAL),
    NWidget(WWT_CLOSEBOX, COLOUR_GREY),
    NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_PERFORMANCE_DETAIL, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
    NWidget(WWT_SHADEBOX, COLOUR_GREY),
    NWidget(WWT_STICKYBOX, COLOUR_GREY),
  EndContainer(),
  NWidget(WWT_PANEL, COLOUR_GREY),
    NWidgetFunction(MakeCompanyButtonRowsGraphGUI), SetPadding(0, 1, 1, 2),
  EndContainer(),
  NWidgetFunction(MakePerformanceDetailPanels),
}

Definition at line 1589 of file graph_gui.cpp.

const StringID _performance_titles[] [static]
Initial value:
 {
  STR_COMPANY_LEAGUE_PERFORMANCE_TITLE_ENGINEER,
  STR_COMPANY_LEAGUE_PERFORMANCE_TITLE_ENGINEER,
  STR_COMPANY_LEAGUE_PERFORMANCE_TITLE_TRAFFIC_MANAGER,
  STR_COMPANY_LEAGUE_PERFORMANCE_TITLE_TRAFFIC_MANAGER,
  STR_COMPANY_LEAGUE_PERFORMANCE_TITLE_TRANSPORT_COORDINATOR,
  STR_COMPANY_LEAGUE_PERFORMANCE_TITLE_TRANSPORT_COORDINATOR,
  STR_COMPANY_LEAGUE_PERFORMANCE_TITLE_ROUTE_SUPERVISOR,
  STR_COMPANY_LEAGUE_PERFORMANCE_TITLE_ROUTE_SUPERVISOR,
  STR_COMPANY_LEAGUE_PERFORMANCE_TITLE_DIRECTOR,
  STR_COMPANY_LEAGUE_PERFORMANCE_TITLE_DIRECTOR,
  STR_COMPANY_LEAGUE_PERFORMANCE_TITLE_CHIEF_EXECUTIVE,
  STR_COMPANY_LEAGUE_PERFORMANCE_TITLE_CHIEF_EXECUTIVE,
  STR_COMPANY_LEAGUE_PERFORMANCE_TITLE_CHAIRMAN,
  STR_COMPANY_LEAGUE_PERFORMANCE_TITLE_CHAIRMAN,
  STR_COMPANY_LEAGUE_PERFORMANCE_TITLE_PRESIDENT,
  STR_COMPANY_LEAGUE_PERFORMANCE_TITLE_TYCOON,
}

Definition at line 1129 of file graph_gui.cpp.


Generated on Sun May 8 07:30:25 2011 for OpenTTD by  doxygen 1.6.1