Changeset - r14399:3f819c0da60a
src/ai/ai_gui.cpp
Show inline comments
 
@@ -146,20 +146,24 @@ struct AIListWindow : public Window {
 
			for (int i = 0; i < this->selected; i++) it++;
 
			AIConfig::GetConfig(slot)->ChangeAI((*it).second->GetName(), (*it).second->GetVersion());
 
		}
 
		SetWindowDirty(WC_GAME_OPTIONS, 0);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case AIL_WIDGET_LIST: { // Select one of the AIs
 
				int sel = (pt.y - this->GetWidget<NWidgetBase>(AIL_WIDGET_LIST)->pos_y) / this->line_height + this->vscroll.GetPosition() - 1;
 
				if (sel < (int)this->ai_info_list->size()) {
 
					this->selected = sel;
 
					this->SetDirty();
 
					if (click_count > 1) {
 
						this->ChangeAI();
 
						delete this;
 
					}
 
				}
 
				break;
 
			}
 

	
 
			case AIL_WIDGET_ACCEPT: {
 
				this->ChangeAI();
 
@@ -170,27 +174,12 @@ struct AIListWindow : public Window {
 
			case AIL_WIDGET_CANCEL:
 
				delete this;
 
				break;
 
		}
 
	}
 

	
 
	virtual void OnDoubleClick(Point pt, int widget)
 
	{
 
		switch (widget) {
 
			case AIL_WIDGET_LIST: {
 
				int sel = (pt.y - this->GetWidget<NWidgetBase>(AIL_WIDGET_LIST)->pos_y) / this->line_height + this->vscroll.GetPosition() - 1;
 
				if (sel < (int)this->ai_info_list->size()) {
 
					this->selected = sel;
 
					this->ChangeAI();
 
					delete this;
 
				}
 
				break;
 
			}
 
		}
 
	}
 

	
 
	virtual void OnResize()
 
	{
 
		NWidgetCore *nwi = this->GetWidget<NWidgetCore>(AIL_WIDGET_LIST);
 
		this->vscroll.SetCapacity(nwi->current_y / this->line_height);
 
		nwi->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
 
	}
 
@@ -329,13 +318,13 @@ struct AISettingsWindow : public Window 
 
			}
 
		} else if (_settings_game.difficulty.diff_level != 3) {
 
			IConsoleSetSetting("difficulty.diff_level", 3);
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case AIS_WIDGET_BACKGROUND: {
 
				const NWidgetBase *wid = this->GetWidget<NWidgetBase>(AIS_WIDGET_BACKGROUND);
 
				int num = (pt.y - wid->pos_y) / this->line_height + this->vscroll.GetPosition();
 
				if (num >= (int)this->ai_config->GetConfigList()->size()) break;
 
@@ -585,13 +574,13 @@ struct AIConfigWindow : public Window {
 
				}
 
				break;
 
			}
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case AIC_WIDGET_DECREASE:
 
			case AIC_WIDGET_INCREASE: {
 
				int new_value;
 
				if (widget == AIC_WIDGET_DECREASE) {
 
@@ -604,12 +593,13 @@ struct AIConfigWindow : public Window {
 
				break;
 
			}
 

	
 
			case AIC_WIDGET_LIST: { // Select a slot
 
				this->selected_slot = (CompanyID)((pt.y - this->GetWidget<NWidgetBase>(widget)->pos_y) / this->line_height + this->vscroll.GetPosition());
 
				this->InvalidateData();
 
				if (click_count > 1 && this->selected_slot != INVALID_COMPANY) ShowAIListWindow((CompanyID)this->selected_slot);
 
				break;
 
			}
 

	
 
			case AIC_WIDGET_MOVE_UP:
 
				if (this->selected_slot > 1) {
 
					Swap(_settings_newgame.ai_config[this->selected_slot], _settings_newgame.ai_config[this->selected_slot - 1]);
 
@@ -649,22 +639,12 @@ struct AIConfigWindow : public Window {
 
#endif
 
				}
 
				break;
 
		}
 
	}
 

	
 
	virtual void OnDoubleClick(Point pt, int widget)
 
	{
 
		switch (widget) {
 
			case AIC_WIDGET_LIST:
 
				this->OnClick(pt, widget);
 
				if (this->selected_slot != INVALID_COMPANY) ShowAIListWindow((CompanyID)this->selected_slot);
 
				break;
 
		}
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	{
 
		if (this->selected_slot == 0 || this->selected_slot > _settings_newgame.difficulty.max_no_competitors) {
 
			this->selected_slot = INVALID_COMPANY;
 
		}
 

	
 
@@ -908,13 +888,13 @@ struct AIDebugWindow : public Window {
 
		this->last_vscroll_pos = this->vscroll.GetPosition();
 
		this->SetDirty();
 
		/* Close AI settings window to prevent confusion */
 
		DeleteWindowByClass(WC_AI_SETTINGS);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		/* Check which button is clicked */
 
		if (IsInsideMM(widget, AID_WIDGET_COMPANY_BUTTON_START, AID_WIDGET_COMPANY_BUTTON_END + 1)) {
 
			/* Is it no on disable? */
 
			if (!this->IsWidgetDisabled(widget)) {
 
				ChangeToAI((CompanyID)(widget - AID_WIDGET_COMPANY_BUTTON_START));
src/airport_gui.cpp
Show inline comments
 
@@ -87,13 +87,13 @@ struct BuildAirToolbarWindow : Window {
 

	
 
	virtual void OnPaint()
 
	{
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (!IsInsideBS(widget, ATW_AIRPORT, lengthof(_build_air_button_proc))) return;
 

	
 
		_build_air_button_proc[widget - ATW_AIRPORT](this);
 
	}
 

	
 
@@ -254,13 +254,13 @@ public:
 
		}
 
		for (int i = 0; i < BAW_AIRPORT_COUNT; i++) {
 
			this->SetWidgetDisabledState(i + BAW_SMALL_AIRPORT, !AirportSpec::Get(i)->IsAvailable());
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case BAW_SMALL_AIRPORT: case BAW_CITY_AIRPORT: case BAW_HELIPORT: case BAW_METRO_AIRPORT:
 
			case BAW_INTERNATIONAL_AIRPORT: case BAW_COMMUTER_AIRPORT: case BAW_HELIDEPOT:
 
			case BAW_INTERCONTINENTAL_AIRPORT: case BAW_HELISTATION:
 
				this->SelectOtherAirport(widget - BAW_SMALL_AIRPORT);
src/autoreplace_gui.cpp
Show inline comments
 
@@ -396,13 +396,13 @@ public:
 
			this->details_height = needed_height;
 
			this->ReInit();
 
			return;
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case RVW_WIDGET_TRAIN_ENGINEWAGON_TOGGLE:
 
				this->replace_engines  = !(this->replace_engines);
 
				this->engines[0].ForceRebuild();
 
				this->reset_sel_engine = true;
src/bridge_gui.cpp
Show inline comments
 
@@ -240,13 +240,13 @@ public:
 
			delete this;
 
			return ES_HANDLED;
 
		}
 
		return ES_NOT_HANDLED;
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			default: break;
 
			case BBSW_BRIDGE_LIST: {
 
				uint i = ((int)pt.y - this->GetWidget<NWidgetBase>(BBSW_BRIDGE_LIST)->pos_y) / this->resize.step_height;
 
				if (i < this->vscroll.GetCapacity()) {
src/build_vehicle_gui.cpp
Show inline comments
 
@@ -999,13 +999,13 @@ struct BuildVehicleWindow : Window {
 
		EngList_Sort(&this->eng_list, _sorter[this->vehicle_type][this->sort_criteria]);
 

	
 
		this->eng_list.Compact();
 
		this->eng_list.RebuildDone();
 
	}
 

	
 
	void OnClick(Point pt, int widget)
 
	void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case BUILD_VEHICLE_WIDGET_SORT_ASSENDING_DESCENDING:
 
				this->descending_sort_order ^= true;
 
				_last_sort_order[this->vehicle_type] = this->descending_sort_order;
 
				this->eng_list.ForceRebuild();
 
@@ -1014,12 +1014,13 @@ struct BuildVehicleWindow : Window {
 

	
 
			case BUILD_VEHICLE_WIDGET_LIST: {
 
				uint i = (pt.y - this->GetWidget<NWidgetBase>(BUILD_VEHICLE_WIDGET_LIST)->pos_y) / this->resize.step_height + this->vscroll.GetPosition();
 
				size_t num_items = this->eng_list.Length();
 
				this->sel_engine = (i < num_items) ? this->eng_list[i] : INVALID_ENGINE;
 
				this->SetDirty();
 
				if (click_count > 1) this->OnClick(pt, BUILD_VEHICLE_WIDGET_BUILD, 1);
 
				break;
 
			}
 

	
 
			case BUILD_VEHICLE_WIDGET_SORT_DROPDOWN: // Select sorting criteria dropdown menu
 
				ShowDropDownMenu(this, _sort_listing[this->vehicle_type], this->sort_criteria, BUILD_VEHICLE_WIDGET_SORT_DROPDOWN, 0, 0);
 
				break;
 
@@ -1125,20 +1126,12 @@ struct BuildVehicleWindow : Window {
 
				this->ReInit();
 
				return;
 
			}
 
		}
 
	}
 

	
 
	virtual void OnDoubleClick(Point pt, int widget)
 
	{
 
		if (widget == BUILD_VEHICLE_WIDGET_LIST) {
 
			/* When double clicking, we want to buy a vehicle */
 
			this->OnClick(pt, BUILD_VEHICLE_WIDGET_BUILD);
 
		}
 
	}
 

	
 
	virtual void OnQueryTextFinished(char *str)
 
	{
 
		if (str == NULL) return;
 

	
 
		DoCommandP(0, this->rename_engine, 0, CMD_RENAME_ENGINE | CMD_MSG(STR_ERROR_CAN_T_RENAME_TRAIN_TYPE + this->vehicle_type), NULL, str);
 
	}
src/cheat_gui.cpp
Show inline comments
 
@@ -268,13 +268,13 @@ struct CheatWindow : Window {
 

	
 
	virtual void OnPaint()
 
	{
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		const NWidgetBase *wid = this->GetWidget<NWidgetBase>(CW_PANEL);
 
		uint btn = (pt.y - wid->pos_y - WD_FRAMERECT_TOP - this->header_height) / (FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL);
 
		uint x = pt.x - wid->pos_x;
 
		bool rtl = _dynlang.text_dir == TD_RTL;
 
		if (rtl) x = wid->current_x - x;
src/company_gui.cpp
Show inline comments
 
@@ -430,13 +430,13 @@ struct CompanyFinancesWindow : Window {
 
			this->SetWidgetDisabledState(CFW_REPAY_LOAN, company != _local_company || c->current_loan == 0); // Repay button only shows when there is any more money to repay.
 
		}
 

	
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case CFW_TOGGLE_SIZE: // toggle size
 
				this->small = !this->small;
 
				this->SetupWidgets();
 
				if (this->IsShaded()) {
 
@@ -726,13 +726,13 @@ public:
 

	
 
				y += 4 + FONT_HEIGHT_NORMAL;
 
			}
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			/* Livery Class buttons */
 
			case SCLW_WIDGET_CLASS_GENERAL:
 
			case SCLW_WIDGET_CLASS_RAIL:
 
			case SCLW_WIDGET_CLASS_ROAD:
 
@@ -1390,13 +1390,13 @@ public:
 
			case SCMFM_WIDGET_FACE:
 
				DrawCompanyManagerFace(this->face, Company::Get((CompanyID)this->window_number)->colour, r.left, r.top);
 
				break;
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			/* Toggle size, advanced/simple face selection */
 
			case SCMFW_WIDGET_TOGGLE_LARGE_SMALL:
 
			case SCMFW_WIDGET_TOGGLE_LARGE_SMALL_BUTTON:
 
				this->advanced = !this->advanced;
 
@@ -1913,13 +1913,13 @@ struct CompanyWindow : Window
 
			case CW_WIDGET_DESC_COMPANY_VALUE:
 
				SetDParam(0, CalculateCompanyValue(Company::Get((CompanyID)this->window_number)));
 
				break;
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case CW_WIDGET_NEW_FACE: DoSelectCompanyManagerFace(this); break;
 

	
 
			case CW_WIDGET_COLOUR_SCHEME:
 
				if (BringWindowToFrontById(WC_COMPANY_COLOUR, this->window_number)) break;
 
@@ -2112,13 +2112,13 @@ struct BuyCompanyWindow : Window {
 
				SetDParam(1, c->bankrupt_value);
 
				DrawStringMultiLine(r.left, r.right, r.top, r.bottom, STR_BUY_COMPANY_MESSAGE, TC_FROMSTRING, SA_CENTER);
 
			} break;
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case BCW_NO:
 
				delete this;
 
				break;
 

	
src/date_gui.cpp
Show inline comments
 
@@ -148,13 +148,13 @@ struct SetDateWindow : Window {
 

	
 
	virtual void OnPaint()
 
	{
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case SDW_DAY:
 
			case SDW_MONTH:
 
			case SDW_YEAR:
 
				ShowDateDropDown(widget);
src/depot_gui.cpp
Show inline comments
 
@@ -708,13 +708,13 @@ struct DepotWindow : Window {
 
			DEPOT_WIDGET_AUTOREPLACE,
 
			WIDGET_LIST_END);
 

	
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case DEPOT_WIDGET_MATRIX: { // List
 
				NWidgetBase *nwi = this->GetWidget<NWidgetBase>(DEPOT_WIDGET_MATRIX);
 
				this->DepotClick(pt.x - nwi->pos_x, pt.y - nwi->pos_y);
 
				break;
src/dock_gui.cpp
Show inline comments
 
@@ -178,13 +178,13 @@ struct BuildDocksToolbarWindow : Window 
 
	virtual void OnPaint()
 
	{
 
		this->SetWidgetsDisabledState(!CanBuildVehicleInfrastructure(VEH_SHIP), DTW_DEPOT, DTW_STATION, DTW_BUOY, WIDGET_LIST_END);
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (widget >= DTW_BUTTONS_BEGIN) _build_docks_button_proc[widget - DTW_BUTTONS_BEGIN](this);
 
	}
 

	
 
	virtual EventState OnKeyPress(uint16 key, uint16 keycode)
 
	{
 
@@ -369,13 +369,13 @@ public:
 
		/* Resize background if the text is not equally long as the window. */
 
		if (top > bottom || (top < bottom && back_nwi->current_y > back_nwi->smallest_y)) {
 
			ResizeWindow(this, 0, top - bottom);
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case BDSW_LT_OFF:
 
			case BDSW_LT_ON:
 
				this->RaiseWidget(_settings_client.gui.station_show_coverage + BDSW_LT_OFF);
 
				_settings_client.gui.station_show_coverage = (widget != BDSW_LT_OFF);
 
@@ -454,13 +454,13 @@ public:
 
		DrawShipDepotSprite(this->GetWidget<NWidgetBase>(BDDW_X)->pos_x + 64, this->GetWidget<NWidgetBase>(BDDW_X)->pos_y + 18, 0);
 
		DrawShipDepotSprite(this->GetWidget<NWidgetBase>(BDDW_X)->pos_x + 32, this->GetWidget<NWidgetBase>(BDDW_X)->pos_y + 34, 1);
 
		DrawShipDepotSprite(this->GetWidget<NWidgetBase>(BDDW_Y)->pos_x + 32, this->GetWidget<NWidgetBase>(BDDW_Y)->pos_y + 18, 2);
 
		DrawShipDepotSprite(this->GetWidget<NWidgetBase>(BDDW_Y)->pos_x + 64, this->GetWidget<NWidgetBase>(BDDW_Y)->pos_y + 34, 3);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case BDDW_X:
 
			case BDDW_Y:
 
				this->RaiseWidget(_ship_depot_direction + BDDW_X);
 
				_ship_depot_direction = (widget == BDDW_X ? AXIS_X : AXIS_Y);
src/engine_gui.cpp
Show inline comments
 
@@ -103,13 +103,13 @@ struct EnginePreviewWindow : Window {
 
		DrawVehicleEngine(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, this->width >> 1, y + VEHICLE_SPACE / 2, engine, GetEnginePalette(engine, _local_company));
 

	
 
		y += VEHICLE_SPACE;
 
		DrawStringMultiLine(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, r.bottom, GetEngineInfoString(engine), TC_FROMSTRING, SA_CENTER);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case EPW_YES:
 
				DoCommandP(0, this->window_number, 0, CMD_WANT_ENGINE_PREVIEW);
 
				/* Fallthrough */
 
			case EPW_NO:
src/genworld_gui.cpp
Show inline comments
 
@@ -516,13 +516,13 @@ struct GenerateLandscapeWindow : public 
 

	
 
		this->DrawWidgets();
 

	
 
		this->DrawEditBox(GLAND_RANDOM_EDITBOX);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case GLAND_TEMPERATE:
 
			case GLAND_ARCTIC:
 
			case GLAND_TROPICAL:
 
			case GLAND_TOYLAND:
 
@@ -918,13 +918,13 @@ struct CreateScenarioWindow : public Win
 
		}
 
		*size = GetStringBoundingBox(str);
 
		size->width += padding.width;
 
		size->height += padding.height;
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case CSCEN_TEMPERATE:
 
			case CSCEN_ARCTIC:
 
			case CSCEN_TROPICAL:
 
			case CSCEN_TOYLAND:
 
@@ -1158,13 +1158,13 @@ struct GenerateProgressWindow : public W
 

	
 
	GenerateProgressWindow() : Window()
 
	{
 
		this->InitNested(&_generate_progress_desc);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case GPWW_ABORT:
 
				if (_cursor.sprite == SPR_CURSOR_ZZZ) SetMouseCursor(SPR_CURSOR_MOUSE, PAL_NONE);
 
				ShowQuery(
 
					STR_GENERATION_ABORT_CAPTION,
src/graph_gui.cpp
Show inline comments
 
@@ -78,13 +78,13 @@ struct GraphLegendWindow : Window {
 

	
 
		SetDParam(0, cid);
 
		SetDParam(1, cid);
 
		DrawString(r.left + (rtl ? WD_FRAMERECT_LEFT : 19), r.right - (rtl ? 19 : WD_FRAMERECT_RIGHT), r.top + WD_FRAMERECT_TOP, STR_COMPANY_NAME_COMPANY_NUM, HasBit(_legend_excluded_companies, cid) ? TC_BLACK : TC_WHITE);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (!IsInsideMM(widget, GLW_FIRST_COMPANY, MAX_COMPANIES + GLW_FIRST_COMPANY)) return;
 

	
 
		ToggleBit(_legend_excluded_companies, widget - GLW_FIRST_COMPANY);
 
		this->ToggleWidgetLoweredState(widget);
 
		this->SetDirty();
 
@@ -510,13 +510,13 @@ public:
 

	
 
	virtual OverflowSafeInt64 GetGraphData(const Company *c, int j)
 
	{
 
		return INVALID_DATAPOINT;
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		/* Clicked on legend? */
 
		if (widget == BGW_KEY_BUTTON) ShowGraphLegend();
 
	}
 

	
 
	virtual void OnTick()
 
@@ -722,16 +722,16 @@ struct PerformanceHistoryGraphWindow : B
 

	
 
	virtual OverflowSafeInt64 GetGraphData(const Company *c, int j)
 
	{
 
		return c->old_economy[j].performance_history;
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (widget == PHW_DETAILED_PERFORMANCE) ShowPerformanceRatingDetail();
 
		this->BaseGraphWindow::OnClick(pt, widget);
 
		this->BaseGraphWindow::OnClick(pt, widget, click_count);
 
	}
 
};
 

	
 
static const NWidgetPart _nested_performance_history_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_CLOSEBOX, COLOUR_GREY),
 
@@ -871,13 +871,13 @@ struct PaymentRatesGraphWindow : BaseGra
 
		GfxFillRect(rect_x, y + clk_dif, rect_x + 8, y + 5 + clk_dif, 0);
 
		GfxFillRect(rect_x + 1, y + 1 + clk_dif, rect_x + 7, y + 4 + clk_dif, cs->legend_colour);
 
		SetDParam(0, cs->name);
 
		DrawString(rtl ? r.left : x + 14 + clk_dif, (rtl ? r.right - 14 + clk_dif : r.right), y + clk_dif, STR_GRAPH_CARGO_PAYMENT_CARGO);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (widget >= CPW_CARGO_FIRST) {
 
			int i = 0;
 
			const CargoSpec *cs;
 
			FOR_ALL_CARGOSPECS(cs) {
 
				if (cs->Index() + CPW_CARGO_FIRST == widget) break;
 
@@ -1327,13 +1327,13 @@ struct PerformanceRatingDetailWindow : W
 
				break;
 
			default:
 
				DrawString(this->score_detail_left, this->score_detail_right, text_top, STR_PERFORMANCE_DETAIL_AMOUNT_INT);
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		/* Check which button is clicked */
 
		if (IsInsideMM(widget, PRW_COMPANY_FIRST, PRW_COMPANY_LAST + 1)) {
 
			/* Is it no on disable? */
 
			if (!this->IsWidgetDisabled(widget)) {
 
				this->RaiseWidget(this->company + PRW_COMPANY_FIRST);
src/group_gui.cpp
Show inline comments
 
@@ -418,13 +418,13 @@ public:
 
			case GRP_WIDGET_LIST_VEHICLE:
 
				this->DrawVehicleListItems(this->vehicle_sel, this->resize.step_height, r);
 
				break;
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case GRP_WIDGET_SORT_BY_ORDER: // Flip sorting method ascending/descending
 
				this->vehicles.ToggleSortOrder();
 
				this->SetDirty();
 
				break;
src/highscore_gui.cpp
Show inline comments
 
@@ -56,13 +56,13 @@ struct EndGameHighScoreBaseWindow : Wind
 
	Point GetTopLeft640x480()
 
	{
 
		Point pt = {max(0, (_screen.width  / 2) - (640 / 2)), max(0, (_screen.height / 2) - (480 / 2))};
 
		return pt;
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		delete this;
 
	}
 

	
 
	virtual EventState OnKeyPress(uint16 key, uint16 keycode)
 
	{
src/industry_gui.cpp
Show inline comments
 
@@ -388,19 +388,13 @@ public:
 

	
 
	virtual void OnPaint()
 
	{
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void OnDoubleClick(Point pt, int widget)
 
	{
 
		if (widget != DPIW_MATRIX_WIDGET) return;
 
		this->OnClick(pt, DPIW_FUND_WIDGET);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case DPIW_MATRIX_WIDGET: {
 
				const IndustrySpec *indsp;
 
				int y = (pt.y - this->GetWidget<NWidgetBase>(DPIW_MATRIX_WIDGET)->pos_y) / this->resize.step_height + this->vscroll.GetPosition();
 

	
 
@@ -416,12 +410,13 @@ public:
 
						/* Reset the button state if going to prospecting or "build many industries" */
 
						this->RaiseButtons();
 
						ResetObjectToPlace();
 
					}
 

	
 
					this->SetWidgetDisabledState(DPIW_FUND_WIDGET, !this->enabled[this->selected_index]);
 
					if (this->enabled[this->selected_index] && click_count > 1) this->OnClick(pt, DPIW_FUND_WIDGET, 1);
 
				}
 
			} break;
 

	
 
			case DPIW_FUND_WIDGET: {
 
				if (this->selected_type == INVALID_INDUSTRYTYPE) {
 
					this->HandleButtonClick(DPIW_FUND_WIDGET);
 
@@ -700,13 +695,13 @@ public:
 

	
 
	virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
 
	{
 
		if (widget == IVW_INFO) size->height = this->info_height;
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		Industry *i;
 

	
 
		switch (widget) {
 
			case IVW_INFO: {
 
				i = Industry::Get(this->window_number);
 
@@ -1102,13 +1097,13 @@ public:
 
				break;
 
			}
 
		}
 
	}
 

	
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case IDW_DROPDOWN_ORDER:
 
				this->industries.ToggleSortOrder();
 
				this->SetDirty();
 
				break;
src/intro_gui.cpp
Show inline comments
 
@@ -94,13 +94,13 @@ struct SelectGameWindow : public Window 
 
		}
 
		textdim.width += padding.width;
 
		textdim.height += padding.height;
 
		*size = maxdim(*size, textdim);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
#ifdef ENABLE_NETWORK
 
		/* Do not create a network server when you (just) have closed one of the game
 
		 * creation/load windows for the network server. */
 
		if (IsInsideMM(widget, SGI_GENERATE_GAME, SGI_EDIT_SCENARIO + 1)) _is_network_server = false;
 
#endif /* ENABLE_NETWORK */
src/misc_gui.cpp
Show inline comments
 
@@ -1282,13 +1282,13 @@ struct QueryStringWindow : public QueryS
 
				HandleOnEditText(this->text.buf);
 
			}
 
			this->handled = true;
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case QUERY_STR_WIDGET_DEFAULT:
 
				this->text.buf[0] = '\0';
 
				/* Fallthrough */
 
			case QUERY_STR_WIDGET_OK:
 
@@ -1447,13 +1447,13 @@ struct QueryWindow : public Window {
 

	
 
	virtual void OnPaint()
 
	{
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case QUERY_WIDGET_YES: {
 
				/* in the Generate New World window, clicking 'Yes' causes
 
				 * DeleteNonVitalWindows() to be called - we shouldn't be in a window then */
 
				QueryCallbackProc *proc = this->proc;
 
@@ -1799,13 +1799,13 @@ public:
 

	
 
		if (_saveload_mode == SLD_SAVE_GAME || _saveload_mode == SLD_SAVE_SCENARIO) {
 
			this->DrawEditBox(SLWW_SAVE_OSK_TITLE);
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case SLWW_SORT_BYNAME: // Sort save names by name
 
				_savegame_sort_order = (_savegame_sort_order == SORT_BY_NAME) ?
 
					SORT_BY_NAME | SORT_DESCENDING : SORT_BY_NAME;
 
				_savegame_sort_dirty = true;
src/music_gui.cpp
Show inline comments
 
@@ -394,13 +394,13 @@ struct MusicTrackSelectionWindow : publi
 

	
 
	virtual void OnPaint()
 
	{
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case MTSW_LIST_LEFT: { // add to playlist
 
				int y = (pt.y - this->GetWidget<NWidgetBase>(widget)->pos_y) / FONT_HEIGHT_SMALL;
 

	
 
				if (msf.playlist < 4) return;
 
@@ -640,13 +640,13 @@ struct MusicWindow : public Window {
 
		for (int i = 0; i < 6; i++) {
 
			this->SetWidgetLoweredState(MW_ALL + i, i == msf.playlist);
 
		}
 
		this->SetDirty();
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case MW_PREV: // skip to prev
 
				if (!_song_is_active) return;
 
				SkipToPrevSong();
 
				this->SetDirty();
src/network/network_chat_gui.cpp
Show inline comments
 
@@ -477,13 +477,13 @@ struct NetworkChatWindow : public QueryS
 
		if (this->dtype == DESTTYPE_CLIENT) {
 
			SetDParamStr(0, NetworkFindClientInfoFromClientID((ClientID)this->dest)->client_name);
 
		}
 
		DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, this->dest_string, TC_BLACK, SA_RIGHT);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			/* Send */
 
			case NWCW_SENDBUTTON: SendChat(this->text.buf, this->dtype, this->dest);
 
			/* FALLTHROUGH */
 
			case NWCW_CLOSE: /* Cancel */ delete this; break;
src/network/network_content_gui.cpp
Show inline comments
 
@@ -161,13 +161,13 @@ public:
 
		}
 

	
 
		y += FONT_HEIGHT_NORMAL + 5;
 
		DrawStringMultiLine(r.left + 2, r.right - 2, y, y + FONT_HEIGHT_NORMAL * 2, str, TC_FROMSTRING, SA_CENTER);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (widget == NCDSWW_CANCELOK) {
 
			if (this->downloaded_bytes != this->total_bytes) _network_content_client.Close();
 
			delete this;
 
		}
 
	}
 
@@ -580,22 +580,13 @@ public:
 
				SetDParamStr(0, buf);
 
				y = DrawStringMultiLine(r.left + DETAIL_LEFT, r.right - DETAIL_RIGHT, y, max_y, STR_CONTENT_DETAIL_SELECTED_BECAUSE_OF);
 
			}
 
		}
 
	}
 

	
 
	virtual void OnDoubleClick(Point pt, int widget)
 
	{
 
		/* Double clicking on a line in the matrix toggles the state of the checkbox */
 
		if (widget != NCLWW_MATRIX) return;
 

	
 
		pt.x = this->GetWidget<NWidgetBase>(NCLWW_CHECKBOX)->pos_x;
 
		this->OnClick(pt, widget);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case NCLWW_MATRIX: {
 
				uint32 id_v = (pt.y - this->GetWidget<NWidgetBase>(NCLWW_MATRIX)->pos_y) / this->resize.step_height;
 

	
 
				if (id_v >= this->vscroll.GetCapacity()) return; // click out of bounds
 
@@ -604,13 +595,13 @@ public:
 
				if (id_v >= this->content.Length()) return; // click out of bounds
 

	
 
				this->selected = *this->content.Get(id_v);
 
				this->list_pos = id_v;
 

	
 
				const NWidgetBase *checkbox = this->GetWidget<NWidgetBase>(NCLWW_CHECKBOX);
 
				if (IsInsideBS(pt.x, checkbox->pos_x, checkbox->current_x)) {
 
				if (click_count > 1 || IsInsideBS(pt.x, checkbox->pos_x, checkbox->current_x)) {
 
					_network_content_client.ToggleSelectedState(this->selected);
 
					this->content.ForceResort();
 
				}
 

	
 
				this->InvalidateData();
 
			} break;
src/network/network_gui.cpp
Show inline comments
 
@@ -655,13 +655,13 @@ public:
 
			} else if (sel->info.use_password) {
 
				DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_NETWORK_SERVER_LIST_PASSWORD, TC_FROMSTRING, SA_CENTER); // password warning
 
			}
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		this->field = widget;
 
		switch (widget) {
 
			case NGWW_CANCEL: // Cancel button
 
				DeleteWindowById(WC_NETWORK_WINDOW, 0);
 
				break;
 
@@ -694,12 +694,15 @@ public:
 
				if (id_v >= this->vscroll.GetCapacity()) return; // click out of bounds
 
				id_v += this->vscroll.GetPosition();
 

	
 
				this->server = (id_v < this->servers.Length()) ? this->servers[id_v] : NULL;
 
				this->list_pos = (server == NULL) ? SLP_INVALID : id_v;
 
				this->SetDirty();
 

	
 
				/* FIXME the disabling should go into some InvalidateData, which is called instead of the SetDirty */
 
				if (!this->IsWidgetDisabled(NGWW_JOIN)) this->OnClick(pt, NGWW_JOIN, 1);
 
			} break;
 

	
 
			case NGWW_LASTJOINED: {
 
				NetworkGameList *last_joined = NetworkGameListAddItem(NetworkAddress(_settings_client.network.last_host, _settings_client.network.last_port));
 
				if (last_joined != NULL) {
 
					this->server = last_joined;
 
@@ -710,12 +713,15 @@ public:
 
							this->list_pos = i;
 
							break;
 
						}
 
					}
 
					this->ScrollToSelectedServer();
 
					this->SetDirty();
 

	
 
					/* FIXME the disabling should go into some InvalidateData, which is called instead of the SetDirty */
 
					if (!this->IsWidgetDisabled(NGWW_JOIN)) this->OnClick(pt, NGWW_JOIN, 1);
 
				}
 
			} break;
 

	
 
			case NGWW_FIND: // Find server automatically
 
				switch (_settings_client.network.lan_internet) {
 
					case 0: NetworkUDPSearchGame(); break;
 
@@ -752,20 +758,12 @@ public:
 
			case NGWW_NEWGRF: // NewGRF Settings
 
				if (this->server != NULL) ShowNewGRFSettings(false, false, false, &this->server->info.grfconfig);
 
				break;
 
		}
 
	}
 

	
 
	virtual void OnDoubleClick(Point pt, int widget)
 
	{
 
		if (widget == NGWW_MATRIX || widget == NGWW_LASTJOINED) {
 
			/* is the Join button enabled? */
 
			if (!this->IsWidgetDisabled(NGWW_JOIN)) this->OnClick(pt, NGWW_JOIN);
 
		}
 
	}
 

	
 
	virtual void OnDropdownSelect(int widget, int index)
 
	{
 
		switch (widget) {
 
			case NGWW_CONN_BTN:
 
				_settings_client.network.lan_internet = index;
 
				break;
 
@@ -1154,13 +1152,13 @@ struct NetworkStartServerWindow : public
 
			y += FONT_HEIGHT_NORMAL;
 

	
 
			if (y >= this->vscroll.GetCapacity() * FONT_HEIGHT_NORMAL + r.top) break;
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		this->field = widget;
 
		switch (widget) {
 
			case NSSW_CANCEL: // Cancel button
 
				ShowNetworkGameWindow();
 
				break;
 
@@ -1618,13 +1616,13 @@ struct NetworkLobbyWindow : public Windo
 
		y += FONT_HEIGHT_NORMAL;
 

	
 
		SetDParamStr(0, this->company_info[this->company].clients);
 
		DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_NETWORK_GAME_LOBBY_PLAYERS); // players
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case NLWW_CANCEL:   // Cancel button
 
				ShowNetworkGameWindow();
 
				break;
 

	
 
@@ -1633,12 +1631,15 @@ struct NetworkLobbyWindow : public Windo
 

	
 
				if (id_v >= this->vscroll.GetCapacity()) break;
 

	
 
				id_v += this->vscroll.GetPosition();
 
				this->company = (id_v >= this->server->info.companies_on) ? INVALID_COMPANY : NetworkLobbyFindCompanyIndex(id_v);
 
				this->SetDirty();
 

	
 
				/* FIXME the disabling should go into some InvalidateData, which is called instead of the SetDirty */
 
				if (!this->IsWidgetDisabled(NLWW_JOIN)) this->OnClick(pt, NLWW_JOIN, 1);
 
			} break;
 

	
 
			case NLWW_JOIN:     // Join company
 
				/* Button can be clicked only when it is enabled */
 
				NetworkClientConnectGame(NetworkAddress(_settings_client.network.last_host, _settings_client.network.last_port), this->company);
 
				break;
 
@@ -1657,20 +1658,12 @@ struct NetworkLobbyWindow : public Windo
 
				/* Clear the information so removed companies don't remain */
 
				memset(this->company_info, 0, sizeof(this->company_info));
 
				break;
 
		}
 
	}
 

	
 
	virtual void OnDoubleClick(Point pt, int widget)
 
	{
 
		if (widget == NLWW_MATRIX) {
 
			/* is the Join button enabled? */
 
			if (!this->IsWidgetDisabled(NLWW_JOIN)) this->OnClick(pt, NLWW_JOIN);
 
		}
 
	}
 

	
 
	virtual void OnResize()
 
	{
 
		this->vscroll.SetCapacityFromWidget(this, NLWW_MATRIX);
 
		this->GetWidget<NWidgetCore>(NLWW_MATRIX)->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
 
	}
 
};
 
@@ -2082,13 +2075,13 @@ struct NetworkClientListWindow : Window 
 
			DrawString(name_left, name_right, y, ci->client_name, colour);
 

	
 
			y += FONT_HEIGHT_NORMAL;
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		/* Show the popup with option */
 
		if (this->selected_item != -1) {
 
			PopupClientList(this->selected_item, pt.x + this->left, pt.y + this->top);
 
		}
 
	}
 
@@ -2215,13 +2208,13 @@ struct NetworkJoinStatusWindow : Window 
 
		width = max(width, GetStringBoundingBox(STR_NETWORK_CONNECTING_DOWNLOADING).width);
 

	
 
		/* Give a bit more clearing for the widest strings than strictly needed */
 
		size->width = width + WD_FRAMERECT_LEFT + WD_FRAMERECT_BOTTOM + 10;
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (widget == NJSW_CANCELOK) { // Disconnect button
 
			NetworkDisconnect();
 
			SwitchToMode(SM_MENU);
 
			ShowNetworkGameWindow();
 
		}
 
@@ -2301,13 +2294,13 @@ struct NetworkCompanyPasswordWindow : pu
 
	virtual void OnPaint()
 
	{
 
		this->DrawWidgets();
 
		this->DrawEditBox(NCPWW_PASSWORD);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case NCPWW_OK:
 
				this->OnOk();
 

	
 
			/* FALL THROUGH */
src/newgrf_gui.cpp
Show inline comments
 
@@ -341,18 +341,13 @@ public:
 
					ShowNewGRFInfo(this->sel, r.left + WD_FRAMERECT_LEFT, r.top + WD_FRAMERECT_TOP, r.right - WD_FRAMERECT_RIGHT, r.bottom - WD_FRAMERECT_BOTTOM, false);
 
				}
 
				break;
 
		}
 
	}
 

	
 
	virtual void OnDoubleClick(Point pt, int widget)
 
	{
 
		if (widget == ANGRFW_GRF_LIST) this->OnClick(pt, ANGRFW_ADD);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case ANGRFW_GRF_LIST: {
 
				/* Get row... */
 
				uint i = (pt.y - this->GetWidget<NWidgetBase>(ANGRFW_GRF_LIST)->pos_y - WD_FRAMERECT_TOP) / this->resize.step_height + this->vscroll.GetPosition();
 

	
 
@@ -361,15 +356,15 @@ public:
 
					this->sel_pos = i;
 
				} else {
 
					this->sel = NULL;
 
					this->sel_pos = -1;
 
				}
 
				this->InvalidateData(1);
 
				break;
 
				if (click_count == 1) break;
 
			}
 

	
 
			/* FALL THROUGH */
 
			case ANGRFW_ADD: // Add selection to list
 
				if (this->sel != NULL) {
 
					const GRFConfig *src = this->sel;
 
					GRFConfig **list;
 

	
 
					/* Find last entry in the list, checking for duplicate grfid on the way */
 
@@ -702,18 +697,13 @@ struct NewGRFWindow : public Window {
 
					ShowNewGRFInfo(this->sel, r.left + WD_FRAMERECT_LEFT, r.top + WD_FRAMERECT_TOP, r.right - WD_FRAMERECT_RIGHT, r.bottom - WD_FRAMERECT_BOTTOM, this->show_params);
 
				}
 
				break;
 
		}
 
	}
 

	
 
	virtual void OnDoubleClick(Point pt, int widget)
 
	{
 
		if (widget == SNGRFS_FILE_LIST) this->OnClick(pt, SNGRFS_SET_PARAMETERS);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case SNGRFS_PRESET_LIST: {
 
				DropDownList *list = new DropDownList();
 

	
 
				/* Add 'None' option for clearing list */
 
@@ -818,12 +808,13 @@ struct NewGRFWindow : public Window {
 
				for (c = this->list; c != NULL && i > 0; c = c->next, i--) {}
 

	
 
				if (this->sel != c) this->DeleteChildWindows(WC_QUERY_STRING); // Remove the parameter query window
 
				this->sel = c;
 

	
 
				this->InvalidateData();
 
				if (click_count > 1) this->OnClick(pt, SNGRFS_SET_PARAMETERS, 1);
 
				break;
 
			}
 

	
 
			case SNGRFS_APPLY_CHANGES: // Apply changes made to GRF list
 
				if (this->execute) {
 
					ShowQuery(
src/news_gui.cpp
Show inline comments
 
@@ -441,13 +441,13 @@ struct NewsWindow : Window {
 
				DrawStringMultiLine(r.left, r.right, r.top, r.bottom, GetEngineInfoString(engine), TC_FROMSTRING, SA_CENTER);
 
				break;
 
			}
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case NTW_CLOSEBOX:
 
				NewsWindow::duration = 0;
 
				delete this;
 
				_forced_news = NULL;
 
@@ -985,13 +985,13 @@ struct MessageHistoryWindow : Window {
 

	
 
	virtual void OnInvalidateData(int data)
 
	{
 
		this->vscroll.SetCount(_total_news);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (widget == MHW_BACKGROUND) {
 
			NewsItem *ni = _latest_news;
 
			if (ni == NULL) return;
 

	
 
			for (int n = (pt.y - this->GetWidget<NWidgetBase>(MHW_BACKGROUND)->pos_y - WD_FRAMERECT_TOP) / this->line_height + this->vscroll.GetPosition(); n > 0; n--) {
 
@@ -1160,13 +1160,13 @@ struct MessageOptionsWindow : Window {
 
		this->GetWidget<NWidgetCore>(WIDGET_NEWSOPT_DROP_SUMMARY)->widget_data = this->message_opt[this->state];
 

	
 
		/* Update widget to reflect the value of the #_news_ticker_sound variable. */
 
		this->SetWidgetLoweredState(WIDGET_NEWSOPT_SOUNDTICKER, _news_ticker_sound);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case WIDGET_NEWSOPT_DROP_SUMMARY: // Dropdown menu for all settings
 
				ShowDropDownMenu(this, this->message_opt, this->state, WIDGET_NEWSOPT_DROP_SUMMARY, 0, 0);
 
				break;
 

	
src/order_gui.cpp
Show inline comments
 
@@ -982,13 +982,13 @@ public:
 
			case ORDER_WIDGET_CAPTION:
 
				SetDParam(0, this->vehicle->index);
 
				break;
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case ORDER_WIDGET_ORDER_LIST: {
 
				ResetObjectToPlace();
 

	
 
				int sel = this->GetOrderFromPt(pt.y);
src/osk_gui.cpp
Show inline comments
 
@@ -139,13 +139,13 @@ struct OskWindow : public Window {
 
	{
 
		this->DrawWidgets();
 

	
 
		this->qs->DrawEditBox(this, OSK_WIDGET_TEXT);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		/* clicked a letter */
 
		if (widget >= OSK_WIDGET_LETTERS) {
 
			WChar c = _keyboard[this->shift][widget - OSK_WIDGET_LETTERS];
 

	
 
			if (!IsValidChar(c, this->qs->afilter)) return;
 
@@ -204,23 +204,23 @@ struct OskWindow : public Window {
 
				break;
 

	
 
			case OSK_WIDGET_OK:
 
				if (this->qs->orig == NULL || strcmp(this->qs->text.buf, this->qs->orig) != 0) {
 
					/* pass information by simulating a button press on parent window */
 
					if (this->ok_btn != 0) {
 
						this->parent->OnClick(pt, this->ok_btn);
 
						this->parent->OnClick(pt, this->ok_btn, 1);
 
						/* Window gets deleted when the parent window removes itself. */
 
						return;
 
					}
 
				}
 
				delete this;
 
				break;
 

	
 
			case OSK_WIDGET_CANCEL:
 
				if (this->cancel_btn != 0) { // pass a cancel event to the parent window
 
					this->parent->OnClick(pt, this->cancel_btn);
 
					this->parent->OnClick(pt, this->cancel_btn, 1);
 
					/* Window gets deleted when the parent window removes itself. */
 
					return;
 
				} else { // or reset to original string
 
					strcpy(qs->text.buf, this->orig_str_buf);
 
					UpdateTextBufferSize(&qs->text);
 
					MoveTextBufferPos(&qs->text, WKC_END);
src/rail_gui.cpp
Show inline comments
 
@@ -691,13 +691,13 @@ struct BuildRailToolbarWindow : Window {
 

	
 
	virtual void OnPaint()
 
	{
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (widget >= RTW_BUILD_NS) {
 
			_remove_button_clicked = false;
 
			_rail_build_button_data[widget - RTW_BUILD_NS].click_proc(this);
 
		}
 
		this->UpdateRemoveWidgetStatus(widget);
 
@@ -1162,13 +1162,13 @@ public:
 

	
 
	virtual void SetStringParameters(int widget) const
 
	{
 
		if (widget == BRSW_NEWST_DROPDOWN) SetDParam(0, GetStationClassName(_railstation.station_class));
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case BRSW_PLATFORM_DIR_X:
 
			case BRSW_PLATFORM_DIR_Y:
 
				this->RaiseWidget(_railstation.orientation + BRSW_PLATFORM_DIR_X);
 
				_railstation.orientation = (Axis)(widget - BRSW_PLATFORM_DIR_X);
 
@@ -1584,13 +1584,13 @@ public:
 
			};
 

	
 
			this->DrawSignalSprite(widget, _signal_lookup[widget - BSW_SEMAPHORE_NORM]);
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case BSW_SEMAPHORE_NORM:
 
			case BSW_SEMAPHORE_ENTRY:
 
			case BSW_SEMAPHORE_EXIT:
 
			case BSW_SEMAPHORE_COMBO:
 
@@ -1720,13 +1720,13 @@ struct BuildRailDepotWindow : public Pic
 
	{
 
		if (!IsInsideMM(widget, BRDW_DEPOT_NE, BRDW_DEPOT_NW + 1)) return;
 

	
 
		DrawTrainDepotSprite(r.left - 1, r.top, widget - BRDW_DEPOT_NE + DIAGDIR_NE, _cur_railtype);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case BRDW_DEPOT_NE:
 
			case BRDW_DEPOT_SE:
 
			case BRDW_DEPOT_SW:
 
			case BRDW_DEPOT_NW:
 
@@ -1823,13 +1823,13 @@ struct BuildRailWaypointWindow : PickerW
 
					GfxFillRect(nw->pos_x + 1, nw->pos_y + 1, nw->pos_x + nw->current_x - 2, bottom - 2, 0, FILLRECT_CHECKER);
 
				}
 
			}
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case BRWW_WAYPOINT_1:
 
			case BRWW_WAYPOINT_2:
 
			case BRWW_WAYPOINT_3:
 
			case BRWW_WAYPOINT_4:
src/road_gui.cpp
Show inline comments
 
@@ -480,13 +480,13 @@ struct BuildRoadToolbarWindow : Window {
 

	
 
	virtual void OnPaint()
 
	{
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (widget >= RTW_ROAD_X) {
 
			_remove_button_clicked = false;
 
			_one_way_button_clicked = false;
 
			_build_road_button_proc[widget - RTW_ROAD_X](this);
 
		}
 
@@ -784,13 +784,13 @@ struct BuildRoadDepotWindow : public Pic
 
	{
 
		if (!IsInsideMM(widget, BRDW_DEPOT_NE, BRDW_DEPOT_NW + 1)) return;
 

	
 
		DrawRoadDepotSprite(r.left - 1, r.top, (DiagDirection)(widget - BRDW_DEPOT_NE + DIAGDIR_NE), _cur_roadtype);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case BRDW_DEPOT_NW:
 
			case BRDW_DEPOT_NE:
 
			case BRDW_DEPOT_SW:
 
			case BRDW_DEPOT_SE:
 
@@ -926,13 +926,13 @@ struct BuildRoadStationWindow : public P
 
		if (!IsInsideMM(widget, BRSW_STATION_NE, BRSW_STATION_Y + 1)) return;
 

	
 
		StationType st = (this->window_class == WC_BUS_STATION) ? STATION_BUS : STATION_TRUCK;
 
		StationPickerDrawSprite(r.left + TILE_PIXELS, r.bottom - TILE_PIXELS, st, INVALID_RAILTYPE, widget < BRSW_STATION_X ? ROADTYPE_ROAD : _cur_roadtype, widget - BRSW_STATION_NE);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case BRSW_STATION_NE:
 
			case BRSW_STATION_SE:
 
			case BRSW_STATION_SW:
 
			case BRSW_STATION_NW:
src/settings_gui.cpp
Show inline comments
 
@@ -274,13 +274,13 @@ struct GameOptionsWindow : Window {
 
					*size = maxdim(*size, GetStringBoundingBox(STR_GAME_OPTIONS_BASE_MUSIC_STATUS));
 
				}
 
				break;
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case GOW_CURRENCY_DROPDOWN: // Setup currencies dropdown
 
				ShowDropDownMenu(this, BuildCurrencyDropdown(), this->opt->locale.currency, GOW_CURRENCY_DROPDOWN, _game_mode == GM_MENU ? 0 : ~GetMaskOfAllowedCurrencies(), 0);
 
				break;
 

	
 
@@ -622,13 +622,13 @@ public:
 

	
 
	virtual void OnPaint()
 
	{
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (widget >= GDW_OPTIONS_START) {
 
			widget -= GDW_OPTIONS_START;
 
			if ((widget % 3) == 2) return;
 

	
 
			/* Don't allow clients to make any changes */
 
@@ -1536,13 +1536,13 @@ struct GameSettingsWindow : Window {
 

	
 
	virtual void OnPaint()
 
	{
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (widget != SETTINGSEL_OPTIONSPANEL) return;
 

	
 
		int y = pt.y - this->GetWidget<NWidgetBase>(widget)->pos_y - SETTINGTREE_TOP_OFFSET;  // Shift y coordinate
 
		if (y < 0) return;  // Clicked above first entry
 

	
 
@@ -1823,13 +1823,13 @@ struct CustomCurrencyWindow : Window {
 

	
 
	virtual void OnPaint()
 
	{
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		int line = 0;
 
		int len = 0;
 
		StringID str = 0;
 
		CharSetFilter afilter = CS_ALPHANUMERAL;
 

	
src/signs_gui.cpp
Show inline comments
 
@@ -140,13 +140,13 @@ struct SignListWindow : Window, SignList
 

	
 
	virtual void SetStringParameters(int widget) const
 
	{
 
		if (widget == SLW_CAPTION) SetDParam(0, this->vscroll.GetCount());
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (widget == SLW_LIST) {
 
			uint id_v = (pt.y - this->GetWidget<NWidgetBase>(SLW_LIST)->pos_y - WD_FRAMERECT_TOP) / this->resize.step_height;
 

	
 
			if (id_v >= this->vscroll.GetCapacity()) return;
 
			id_v += this->vscroll.GetPosition();
 
@@ -325,13 +325,13 @@ struct SignWindow : QueryStringBaseWindo
 
	virtual void OnPaint()
 
	{
 
		this->DrawWidgets();
 
		if (!this->IsShaded()) this->DrawEditBox(QUERY_EDIT_SIGN_WIDGET_TEXT);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case QUERY_EDIT_SIGN_WIDGET_PREVIOUS:
 
			case QUERY_EDIT_SIGN_WIDGET_NEXT: {
 
				const Sign *si = this->PrevNextSign(widget == QUERY_EDIT_SIGN_WIDGET_NEXT);
 

	
src/smallmap_gui.cpp
Show inline comments
 
@@ -895,13 +895,13 @@ public:
 

	
 
	virtual void OnPaint()
 
	{
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case SM_WIDGET_MAP: { // Map window
 
				/*
 
				 * XXX: scrolling with the left mouse button is done by subsequently
 
				 * clicking with the left mouse button; clicking once centers the
src/station_gui.cpp
Show inline comments
 
@@ -529,13 +529,13 @@ public:
 
		if (widget == SLW_CAPTION) {
 
			SetDParam(0, this->window_number);
 
			SetDParam(1, this->vscroll.GetCount());
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case SLW_LIST: {
 
				uint32 id_v = (pt.y - this->GetWidget<NWidgetBase>(SLW_LIST)->pos_y - WD_FRAMERECT_TOP) / FONT_HEIGHT_NORMAL;
 

	
 
				if (id_v >= this->vscroll.GetCapacity()) return; // click out of bounds
 
@@ -1133,13 +1133,13 @@ struct StationViewWindow : public Window
 
				this->SetWidgetDirty(SVW_WAITING);
 
				break;
 
			}
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case SVW_WAITING:
 
				this->HandleCargoWaitingClick((pt.y - this->GetWidget<NWidgetBase>(SVW_WAITING)->pos_y - WD_FRAMERECT_TOP) / FONT_HEIGHT_NORMAL + this->vscroll.GetPosition());
 
				break;
 

	
 
@@ -1418,13 +1418,13 @@ struct SelectStationWindow : Window {
 
			SetDParam(0, st->index);
 
			SetDParam(1, st->facilities);
 
			DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, T::EXPECTED_FACIL == FACIL_WAYPOINT ? STR_STATION_LIST_WAYPOINT : STR_STATION_LIST_STATION);
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (widget != JSW_PANEL) return;
 

	
 
		uint32 st_index = (pt.y - this->GetWidget<NWidgetBase>(JSW_PANEL)->pos_y - WD_FRAMERECT_TOP) / this->resize.step_height + this->vscroll.GetPosition();
 
		bool distant_join = (st_index > 0);
 
		if (distant_join) st_index--;
src/statusbar_gui.cpp
Show inline comments
 
@@ -197,13 +197,13 @@ struct StatusBarWindow : Window {
 
				this->ticker_scroll    =   TICKER_STOP; // reset ticker ...
 
				this->reminder_timeout = REMINDER_STOP; // ... and reminder
 
				break;
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case SBW_MIDDLE: ShowLastNewsMessage(); break;
 
			case SBW_RIGHT:  if (_local_company != COMPANY_SPECTATOR) ShowCompanyFinances(_local_company); break;
 
			default: ResetObjectToPlace();
 
		}
src/subsidy_gui.cpp
Show inline comments
 
@@ -34,13 +34,13 @@ struct SubsidyListWindow : Window {
 
	SubsidyListWindow(const WindowDesc *desc, WindowNumber window_number) : Window()
 
	{
 
		this->InitNested(desc, window_number);
 
		this->OnInvalidateData(0);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (widget != SLW_PANEL) return;
 

	
 
		int y = (pt.y - this->GetWidget<NWidgetBase>(SLW_PANEL)->pos_y - WD_FRAMERECT_TOP) / this->resize.step_height;
 
		if (!IsInsideMM(y, 0, this->vscroll.GetCapacity())) return;
 

	
src/terraform_gui.cpp
Show inline comments
 
@@ -238,13 +238,13 @@ struct TerraformToolbarWindow : Window {
 

	
 
	virtual void OnPaint()
 
	{
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (widget >= TTW_BUTTONS_START) _terraform_button_proc[widget - TTW_BUTTONS_START](this);
 
	}
 

	
 
	virtual EventState OnKeyPress(uint16 key, uint16 keycode)
 
	{
 
@@ -670,13 +670,13 @@ struct ScenarioEditorLandscapeGeneration
 
				return ES_HANDLED;
 
			}
 
		}
 
		return ES_NOT_HANDLED;
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (IsInsideMM(widget, ETTW_BUTTONS_START, ETTW_BUTTONS_END)) {
 
			_editor_terraform_button_proc[widget - ETTW_BUTTONS_START](this);
 
		} else {
 
			switch (widget) {
 
				case ETTW_INCREASE_SIZE:
src/timetable_gui.cpp
Show inline comments
 
@@ -494,13 +494,13 @@ struct TimetableWindow : Window {
 

	
 
		if (order_number >= v->GetNumOrders()) order_number = 0;
 

	
 
		return v->index | (order_number << 16) | (is_journey << 24);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		const Vehicle *v = this->vehicle;
 

	
 
		switch (widget) {
 
			case TTV_ORDER_VIEW: // Order view button
 
				ShowOrdersWindow(v);
src/toolbar_gui.cpp
Show inline comments
 
@@ -1230,13 +1230,13 @@ struct MainToolbarWindow : Window {
 
		this->SetWidgetDisabledState(TBN_RAILS, !CanBuildVehicleInfrastructure(VEH_TRAIN));
 
		this->SetWidgetDisabledState(TBN_AIR, !CanBuildVehicleInfrastructure(VEH_AIRCRAFT));
 

	
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (_game_mode != GM_MENU && !this->IsWidgetDisabled(widget)) _toolbar_button_procs[widget](this);
 
	}
 

	
 
	virtual void OnDropdownSelect(int widget, int index)
 
	{
 
@@ -1467,13 +1467,13 @@ public:
 
				*size = GetStringBoundingBox(STR_WHITE_DATE_LONG);
 
				size->height = max(size->height, GetSpriteSize(SPR_IMG_SAVE).height + WD_IMGBTN_TOP + WD_IMGBTN_BOTTOM);
 
				break;
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (_game_mode == GM_MENU) return;
 
		_scen_toolbar_button_procs[widget](this);
 
	}
 

	
 
	virtual void OnDropdownSelect(int widget, int index)
src/town_gui.cpp
Show inline comments
 
@@ -248,16 +248,13 @@ public:
 
				resize->height = FONT_HEIGHT_NORMAL;
 
				size->height = WD_FRAMERECT_TOP + 9 * FONT_HEIGHT_NORMAL + WD_FRAMERECT_BOTTOM;
 
				break;
 
		}
 
	}
 

	
 
	virtual void OnDoubleClick(Point pt, int widget) { HandleClick(pt, widget, true); }
 
	virtual void OnClick(Point pt, int widget) { HandleClick(pt, widget, false); }
 

	
 
	void HandleClick(Point pt, int widget, bool double_click)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case TWA_COMMAND_LIST: {
 
				int y = (pt.y - this->GetWidget<NWidgetBase>(TWA_COMMAND_LIST)->pos_y - 1) / FONT_HEIGHT_NORMAL;
 

	
 
				if (!IsInsideMM(y, 0, 5)) return;
 
@@ -265,13 +262,13 @@ public:
 
				y = GetNthSetBit(GetMaskOfTownActions(NULL, _local_company, this->town), y + this->vscroll.GetPosition() - 1);
 
				if (y >= 0) {
 
					this->sel_index = y;
 
					this->SetDirty();
 
				}
 
				/* Fall through to clicking in case we are double-clicked */
 
				if (!double_click || y < 0) break;
 
				if (click_count == 1 || y < 0) break;
 
			}
 

	
 
			case TWA_EXECUTE:
 
				DoCommandP(this->town->xy, this->window_number, this->sel_index, CMD_DO_TOWN_ACTION | CMD_MSG(STR_ERROR_CAN_T_DO_THIS));
 
				break;
 
		}
 
@@ -432,13 +429,13 @@ public:
 
			SetDParam(0, this->town->noise_reached);
 
			SetDParam(1, this->town->MaxTownNoise());
 
			DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_LEFT, y += FONT_HEIGHT_NORMAL, STR_TOWN_VIEW_NOISE_IN_TOWN);
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case TVW_CENTERVIEW: // scroll to location
 
				if (_ctrl_pressed) {
 
					ShowExtraViewPortWindow(this->town->xy);
 
				} else {
 
@@ -794,13 +791,13 @@ public:
 
				*size = maxdim(*size, d);
 
				break;
 
			}
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case TDW_SORTNAME: // Sort by Name ascending/descending
 
				if (this->towns.SortType() == 0) {
 
					this->towns.ToggleSortOrder();
 
				} else {
 
@@ -1070,13 +1067,13 @@ public:
 
	virtual void OnPaint()
 
	{
 
		this->DrawWidgets();
 
		if (!this->IsShaded()) this->DrawEditBox(TSEW_TOWNNAME_EDITBOX);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case TSEW_NEWTOWN:
 
				HandlePlacePushButton(this, TSEW_NEWTOWN, SPR_CURSOR_TOWN, HT_RECT, NULL);
 
				break;
 

	
src/transparency_gui.cpp
Show inline comments
 
@@ -79,13 +79,13 @@ public:
 
							HasBit(_invisibility_opt, i - TTW_WIDGET_BEGIN) ? FR_LOWERED : FR_NONE);
 
				}
 
				break;
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (widget >= TTW_WIDGET_BEGIN && widget < TTW_WIDGET_END) {
 
			if (_ctrl_pressed) {
 
				/* toggle the bit of the transparencies lock variable */
 
				ToggleTransparencyLock((TransparencyOption)(widget - TTW_WIDGET_BEGIN));
 
				this->SetDirty();
src/tree_gui.cpp
Show inline comments
 
@@ -93,13 +93,13 @@ public:
 
		if (widget < BTW_TYPE_11 || widget > BTW_TYPE_34 || widget - BTW_TYPE_11 >= this->count) return;
 

	
 
		int i = this->base + widget - BTW_TYPE_11;
 
		DrawSprite(tree_sprites[i].sprite, tree_sprites[i].pal, (r.left + r.right) / 2, r.bottom - 7);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case BTW_TYPE_11: case BTW_TYPE_12: case BTW_TYPE_13: case BTW_TYPE_14:
 
			case BTW_TYPE_21: case BTW_TYPE_22: case BTW_TYPE_23: case BTW_TYPE_24:
 
			case BTW_TYPE_31: case BTW_TYPE_32: case BTW_TYPE_33: case BTW_TYPE_34:
 
				if (widget - BTW_TYPE_11 >= this->count) break;
src/vehicle_gui.cpp
Show inline comments
 
@@ -435,29 +435,25 @@ struct RefitWindow : public Window {
 
					}
 
				}
 
				break;
 
		}
 
	}
 

	
 
	virtual void OnDoubleClick(Point pt, int widget)
 
	{
 
		if (widget == VRW_MATRIX) this->OnClick(pt, VRW_REFITBUTTON);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case VRW_MATRIX: { // listbox
 
				int y = pt.y - this->GetWidget<NWidgetBase>(VRW_MATRIX)->pos_y;
 
				if (y >= 0) {
 
					this->sel = (y / (int)this->resize.step_height) + this->vscroll.GetPosition();
 
					this->SetDirty();
 
				}
 
				break;
 
				/* FIXME We need to call some InvalidateData to make this->cargo valid */
 
				if (click_count == 1) break;
 
			}
 

	
 
			/* FALL THROUGH */
 
			case VRW_REFITBUTTON: // refit button
 
				if (this->cargo != NULL) {
 
					const Vehicle *v = Vehicle::Get(this->window_number);
 

	
 
					if (this->order == INVALID_VEH_ORDER_ID) {
 
						if (DoCommandP(v->tile, v->index, this->cargo->cargo | this->cargo->subtype << 8, GetCmdRefitVeh(v))) delete this;
 
@@ -1113,13 +1109,13 @@ public:
 
		/* Set text of sort by dropdown widget. */
 
		this->GetWidget<NWidgetCore>(VLW_WIDGET_SORT_BY_PULLDOWN)->widget_data = this->vehicle_sorter_names[this->vehicles.SortType()];
 

	
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case VLW_WIDGET_SORT_ORDER: // Flip sorting method ascending/descending
 
				this->vehicles.ToggleSortOrder();
 
				this->SetDirty();
 
				break;
 
@@ -1608,13 +1604,13 @@ struct VehicleDetailsWindow : Window {
 
			VLD_WIDGET_DECREASE_SERVICING_INTERVAL,
 
			WIDGET_LIST_END);
 

	
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case VLD_WIDGET_RENAME_VEHICLE: { // rename
 
				const Vehicle *v = Vehicle::Get(this->window_number);
 
				SetDParam(0, v->index);
 
				ShowQueryString(STR_VEHICLE_NAME, STR_QUERY_RENAME_TRAIN_CAPTION + v->type,
 
@@ -2038,13 +2034,13 @@ public:
 

	
 
		/* draw the flag plus orders */
 
		DrawSprite(v->vehstatus & VS_STOPPED ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING, PAL_NONE, WD_FRAMERECT_LEFT, r.top + WD_FRAMERECT_TOP);
 
		DrawString(r.left + WD_FRAMERECT_LEFT + 6, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, str, TC_FROMSTRING, SA_CENTER);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		const Vehicle *v = Vehicle::Get(this->window_number);
 

	
 
		switch (widget) {
 
			case VVW_WIDGET_START_STOP_VEH: // start stop
 
				DoCommandP(v->tile, v->index, 0,
src/viewport_gui.cpp
Show inline comments
 
@@ -98,13 +98,13 @@ public:
 

	
 
	virtual void OnPaint()
 
	{
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case EVW_ZOOMIN: DoZoomInOutWindow(ZOOM_IN,  this); break;
 
			case EVW_ZOOMOUT: DoZoomInOutWindow(ZOOM_OUT, this); break;
 

	
 
			case EVW_MAIN_TO_VIEW: { // location button (move main view to same spot as this view) 'Paste Location'
src/waypoint_gui.cpp
Show inline comments
 
@@ -72,13 +72,13 @@ public:
 

	
 
	virtual void OnPaint()
 
	{
 
		this->DrawWidgets();
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		switch (widget) {
 
			case WAYPVW_CENTERVIEW: // scroll to location
 
				if (_ctrl_pressed) {
 
					ShowExtraViewPortWindow(this->wp->xy);
 
				} else {
src/widgets/dropdown.cpp
Show inline comments
 
@@ -244,13 +244,13 @@ struct DropdownWindow : Window {
 
				}
 
			}
 
			y += item_height;
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
	{
 
		if (widget != DDM_ITEMS) return;
 
		int item;
 
		if (this->GetDropDownItem(item)) {
 
			this->click_delay = 4;
 
			this->selected_index = item;
src/window.cpp
Show inline comments
 
@@ -250,15 +250,15 @@ static void StartWindowSizing(Window *w,
 

	
 
/**
 
 * Dispatch left mouse-button (possibly double) click in window.
 
 * @param w Window to dispatch event in
 
 * @param x X coordinate of the click
 
 * @param y Y coordinate of the click
 
 * @param double_click Was it a double click?
 
 * @param click_count Number of fast consecutive clicks at same position
 
 */
 
static void DispatchLeftClickEvent(Window *w, int x, int y, bool double_click)
 
static void DispatchLeftClickEvent(Window *w, int x, int y, int click_count)
 
{
 
	const NWidgetCore *nw = w->nested_root->GetWidgetFromPos(x, y);
 
	WidgetType widget_type = (nw != NULL) ? nw->type : WWT_EMPTY;
 

	
 
	bool focused_widget_changed = false;
 
	/* If clicked on a window that previously did dot have focus */
 
@@ -280,102 +280,94 @@ static void DispatchLeftClickEvent(Windo
 

	
 
	/* don't allow any interaction if the button has been disabled */
 
	if (nw->IsDisabled()) return;
 

	
 
	int widget_index = nw->index; ///< Index of the widget
 

	
 
	/* Process special buttons (only single clicks) */
 
	if (!double_click) {
 
		/* Clicked on a widget that is not disabled.
 
		 * So unless the clicked widget is the caption bar, change focus to this widget */
 
		if (widget_type != WWT_CAPTION) {
 
			/* Close the OSK window if a edit box loses focus */
 
			if (w->nested_focus != NULL &&  w->nested_focus->type == WWT_EDITBOX && w->nested_focus != nw && w->window_class != WC_OSK) {
 
				DeleteWindowById(WC_OSK, 0);
 
			}
 

	
 
			/* focused_widget_changed is 'now' only true if the window this widget
 
			 * is in gained focus. In that case it must remain true, also if the
 
			 * local widget focus did not change. As such it's the logical-or of
 
			 * both changed states.
 
			 *
 
			 * If this is not preserved, then the OSK window would be opened when
 
			 * a user has the edit box focused and then click on another window and
 
			 * then back again on the edit box (to type some text).
 
			 */
 
			focused_widget_changed |= w->SetFocusedWidget(widget_index);
 
	/* Clicked on a widget that is not disabled.
 
	 * So unless the clicked widget is the caption bar, change focus to this widget */
 
	if (widget_type != WWT_CAPTION) {
 
		/* Close the OSK window if a edit box loses focus */
 
		if (w->nested_focus != NULL &&  w->nested_focus->type == WWT_EDITBOX && w->nested_focus != nw && w->window_class != WC_OSK) {
 
			DeleteWindowById(WC_OSK, 0);
 
		}
 

	
 
		/* Close any child drop down menus. If the button pressed was the drop down
 
		 * list's own button, then we should not process the click any further. */
 
		if (HideDropDownMenu(w) == widget_index && widget_index >= 0) return;
 

	
 
		switch (widget_type) {
 
			/* special widget handling for buttons*/
 
			case WWT_PANEL   | WWB_PUSHBUTTON: // WWT_PUSHBTN
 
			case WWT_IMGBTN  | WWB_PUSHBUTTON: // WWT_PUSHIMGBTN
 
			case WWT_TEXTBTN | WWB_PUSHBUTTON: // WWT_PUSHTXTBTN
 
				w->HandleButtonClick(widget_index);
 
				break;
 
		/* focused_widget_changed is 'now' only true if the window this widget
 
		 * is in gained focus. In that case it must remain true, also if the
 
		 * local widget focus did not change. As such it's the logical-or of
 
		 * both changed states.
 
		 *
 
		 * If this is not preserved, then the OSK window would be opened when
 
		 * a user has the edit box focused and then click on another window and
 
		 * then back again on the edit box (to type some text).
 
		 */
 
		focused_widget_changed |= w->SetFocusedWidget(widget_index);
 
	}
 

	
 
			case WWT_SCROLLBAR:
 
			case WWT_SCROLL2BAR:
 
			case WWT_HSCROLLBAR:
 
				ScrollbarClickHandler(w, nw, x, y);
 
				break;
 
	/* Close any child drop down menus. If the button pressed was the drop down
 
	 * list's own button, then we should not process the click any further. */
 
	if (HideDropDownMenu(w) == widget_index && widget_index >= 0) return;
 

	
 
			case WWT_EDITBOX:
 
				if (!focused_widget_changed) { // Only open the OSK window if clicking on an already focused edit box
 
					/* Open the OSK window if clicked on an edit box */
 
					QueryStringBaseWindow *qs = dynamic_cast<QueryStringBaseWindow *>(w);
 
					if (qs != NULL) {
 
						qs->OnOpenOSKWindow(widget_index);
 
					}
 
				}
 
				break;
 
	switch (widget_type) {
 
		/* special widget handling for buttons*/
 
		case WWT_PANEL   | WWB_PUSHBUTTON: // WWT_PUSHBTN
 
		case WWT_IMGBTN  | WWB_PUSHBUTTON: // WWT_PUSHIMGBTN
 
		case WWT_TEXTBTN | WWB_PUSHBUTTON: // WWT_PUSHTXTBTN
 
			w->HandleButtonClick(widget_index);
 
			break;
 

	
 
		case WWT_SCROLLBAR:
 
		case WWT_SCROLL2BAR:
 
		case WWT_HSCROLLBAR:
 
			ScrollbarClickHandler(w, nw, x, y);
 
			break;
 

	
 
			case WWT_CLOSEBOX: // 'X'
 
				delete w;
 
				return;
 
		case WWT_EDITBOX:
 
			if (!focused_widget_changed) { // Only open the OSK window if clicking on an already focused edit box
 
				/* Open the OSK window if clicked on an edit box */
 
				QueryStringBaseWindow *qs = dynamic_cast<QueryStringBaseWindow *>(w);
 
				if (qs != NULL) {
 
					qs->OnOpenOSKWindow(widget_index);
 
				}
 
			}
 
			break;
 

	
 
			case WWT_CAPTION: // 'Title bar'
 
				StartWindowDrag(w);
 
				return;
 
		case WWT_CLOSEBOX: // 'X'
 
			delete w;
 
			return;
 

	
 
		case WWT_CAPTION: // 'Title bar'
 
			StartWindowDrag(w);
 
			return;
 

	
 
			case WWT_RESIZEBOX:
 
				/* When the resize widget is on the left size of the window
 
				 * we assume that that button is used to resize to the left. */
 
				StartWindowSizing(w, (int)nw->pos_x < (w->width / 2));
 
				nw->SetDirty(w);
 
				return;
 
		case WWT_RESIZEBOX:
 
			/* When the resize widget is on the left size of the window
 
			 * we assume that that button is used to resize to the left. */
 
			StartWindowSizing(w, (int)nw->pos_x < (w->width / 2));
 
			nw->SetDirty(w);
 
			return;
 

	
 
			case WWT_SHADEBOX:
 
				nw->SetDirty(w);
 
				w->SetShaded(!w->IsShaded());
 
				return;
 
		case WWT_SHADEBOX:
 
			nw->SetDirty(w);
 
			w->SetShaded(!w->IsShaded());
 
			return;
 

	
 
			case WWT_STICKYBOX:
 
				w->flags4 ^= WF_STICKY;
 
				nw->SetDirty(w);
 
				return;
 
		case WWT_STICKYBOX:
 
			w->flags4 ^= WF_STICKY;
 
			nw->SetDirty(w);
 
			return;
 

	
 
			default:
 
				break;
 
		}
 
		default:
 
			break;
 
	}
 

	
 
	/* Widget has no index, so the window is not interested in it. */
 
	if (widget_index < 0) return;
 

	
 
	Point pt = { x, y };
 

	
 
	if (double_click) {
 
		w->OnDoubleClick(pt, widget_index);
 
	} else {
 
		w->OnClick(pt, widget_index);
 
	}
 
	w->OnClick(pt, widget_index, click_count);
 
}
 

	
 
/**
 
 * Dispatch right mouse-button click in window.
 
 * @param w Window to dispatch event in
 
 * @param x X coordinate of the click
 
@@ -2124,17 +2116,13 @@ static void MouseLoop(MouseClick click, 
 
				break;
 
		}
 
	} else {
 
		switch (click) {
 
			case MC_LEFT:
 
			case MC_DOUBLE_LEFT:
 
				DispatchLeftClickEvent(w, x - w->left, y - w->top, false);
 
				if (click == MC_DOUBLE_LEFT && _mouseover_last_w != NULL) {
 
					/* Issue the doubleclick, if the window was not removed */
 
					DispatchLeftClickEvent(w, x - w->left, y - w->top, true);
 
				}
 
				DispatchLeftClickEvent(w, x - w->left, y - w->top, click == MC_DOUBLE_LEFT ? 2 : 1);
 
				break;
 

	
 
			default:
 
				if (!scrollwheel_scrolling || w == NULL || w->window_class != WC_SMALLMAP) break;
 
				/* We try to use the scrollwheel to scroll since we didn't touch any of the buttons.
 
				 * Simulate a right button click so we can get started. */
src/window_gui.h
Show inline comments
 
@@ -635,21 +635,15 @@ public:
 

	
 

	
 
	/**
 
	 * A click with the left mouse button has been made on the window.
 
	 * @param pt     the point inside the window that has been clicked.
 
	 * @param widget the clicked widget.
 
	 * @param click_count Number of fast consecutive clicks at same position
 
	 */
 
	virtual void OnClick(Point pt, int widget) {}
 

	
 
	/**
 
	 * A double click with the left mouse button has been made on the window.
 
	 * @param pt     the point inside the window that has been clicked.
 
	 * @param widget the clicked widget.
 
	 */
 
	virtual void OnDoubleClick(Point pt, int widget) {}
 
	virtual void OnClick(Point pt, int widget, int click_count) {}
 

	
 
	/**
 
	 * A click with the right mouse button has been made on the window.
 
	 * @param pt     the point inside the window that has been clicked.
 
	 * @param widget the clicked widget.
 
	 */
0 comments (0 inline, 0 general)