summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbelugas <belugas@openttd.org>2007-12-08 03:10:50 +0000
committerbelugas <belugas@openttd.org>2007-12-08 03:10:50 +0000
commit73c58d8a409d7e5f3dbb864be893a1c0b34defd6 (patch)
tree4035aa66fcd85e5b6485927f6941345900ada009
parentb23f824f1848186dd37ee7616a1df58b439b5315 (diff)
downloadopenttd-73c58d8a409d7e5f3dbb864be893a1c0b34defd6.tar.xz
(svn r11596) -Codechange: Use the Window member HandleButtonClick and remove its now useless counterpart function
-rw-r--r--src/depot_gui.cpp2
-rw-r--r--src/genworld_gui.cpp8
-rw-r--r--src/industry_gui.cpp4
-rw-r--r--src/main_gui.cpp32
-rw-r--r--src/misc_gui.cpp2
-rw-r--r--src/network/network_gui.cpp2
-rw-r--r--src/window.cpp10
-rw-r--r--src/window.h1
8 files changed, 26 insertions, 35 deletions
diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp
index 17d8b06d1..3e9cf359d 100644
--- a/src/depot_gui.cpp
+++ b/src/depot_gui.cpp
@@ -916,7 +916,7 @@ static void DepotWndProc(Window *w, WindowEvent *e)
if (w->IsWidgetDisabled(e->we.click.widget)) return;
if (WP(w, depot_d).sel == INVALID_VEHICLE) return;
- HandleButtonClick(w, e->we.click.widget);
+ w->HandleButtonClick(e->we.click.widget);
v = GetVehicle(WP(w, depot_d).sel);
WP(w, depot_d).sel = INVALID_VEHICLE;
diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp
index a65cf90fc..82f263705 100644
--- a/src/genworld_gui.cpp
+++ b/src/genworld_gui.cpp
@@ -384,7 +384,7 @@ static void GenerateLandscapeWndProc(Window *w, WindowEvent *e)
case GLAND_START_DATE_DOWN: case GLAND_START_DATE_UP: // Year buttons
/* Don't allow too fast scrolling */
if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) {
- HandleButtonClick(w, e->we.click.widget);
+ w->HandleButtonClick(e->we.click.widget);
SetWindowDirty(w);
_patches_newgame.starting_year = Clamp(_patches_newgame.starting_year + e->we.click.widget - GLAND_START_DATE_TEXT, MIN_YEAR, MAX_YEAR);
@@ -399,7 +399,7 @@ static void GenerateLandscapeWndProc(Window *w, WindowEvent *e)
case GLAND_SNOW_LEVEL_DOWN: case GLAND_SNOW_LEVEL_UP: // Snow line buttons
/* Don't allow too fast scrolling */
if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) {
- HandleButtonClick(w, e->we.click.widget);
+ w->HandleButtonClick(e->we.click.widget);
SetWindowDirty(w);
_patches_newgame.snow_line_height = Clamp(_patches_newgame.snow_line_height + e->we.click.widget - GLAND_SNOW_LEVEL_TEXT, 2, MAX_SNOWLINE_HEIGHT);
@@ -654,7 +654,7 @@ static void CreateScenarioWndProc(Window *w, WindowEvent *e)
case CSCEN_START_DATE_DOWN: case CSCEN_START_DATE_UP: // Year buttons
/* Don't allow too fast scrolling */
if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) {
- HandleButtonClick(w, e->we.click.widget);
+ w->HandleButtonClick(e->we.click.widget);
SetWindowDirty(w);
_patches_newgame.starting_year = Clamp(_patches_newgame.starting_year + e->we.click.widget - CSCEN_START_DATE_TEXT, MIN_YEAR, MAX_YEAR);
@@ -669,7 +669,7 @@ static void CreateScenarioWndProc(Window *w, WindowEvent *e)
case CSCEN_FLAT_LAND_HEIGHT_DOWN: case CSCEN_FLAT_LAND_HEIGHT_UP: // Height level buttons
/* Don't allow too fast scrolling */
if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) {
- HandleButtonClick(w, e->we.click.widget);
+ w->HandleButtonClick(e->we.click.widget);
SetWindowDirty(w);
_patches_newgame.se_flat_world_height = Clamp(_patches_newgame.se_flat_world_height + e->we.click.widget - CSCEN_FLAT_LAND_HEIGHT_TEXT, 0, MAX_TILE_HEIGHT);
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp
index 67356a802..0b1383d5c 100644
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -256,7 +256,7 @@ static void BuildDynamicIndustryWndProc(Window *w, WindowEvent *e)
case DYNA_INDU_FUND_WIDGET: {
if (WP(w, fnd_d).select == INVALID_INDUSTRYTYPE) {
- HandleButtonClick(w, DYNA_INDU_FUND_WIDGET);
+ w->HandleButtonClick(DYNA_INDU_FUND_WIDGET);
if (GetNumTowns() == 0) {
ShowErrorMessage(STR_0286_MUST_BUILD_TOWN_FIRST, STR_CAN_T_GENERATE_INDUSTRIES, 0, 0);
@@ -268,7 +268,7 @@ static void BuildDynamicIndustryWndProc(Window *w, WindowEvent *e)
}
} else if (_game_mode != GM_EDITOR && _patches.raw_industry_construction == 2 && GetIndustrySpec(WP(w, fnd_d).select)->IsRawIndustry()) {
DoCommandP(0, WP(w, fnd_d).select, 0, NULL, CMD_BUILD_INDUSTRY | CMD_MSG(STR_4830_CAN_T_CONSTRUCT_THIS_INDUSTRY));
- HandleButtonClick(w, DYNA_INDU_FUND_WIDGET);
+ w->HandleButtonClick(DYNA_INDU_FUND_WIDGET);
} else {
HandlePlacePushButton(w, DYNA_INDU_FUND_WIDGET, SPR_CURSOR_INDUSTRY, VHM_RECT, NULL);
}
diff --git a/src/main_gui.cpp b/src/main_gui.cpp
index dbf98d41d..feddd031c 100644
--- a/src/main_gui.cpp
+++ b/src/main_gui.cpp
@@ -907,7 +907,7 @@ bool DoZoomInOutWindow(int how, Window *w)
static void ToolbarZoomInClick(Window *w)
{
if (DoZoomInOutWindow(ZOOM_IN, FindWindowById(WC_MAIN_WINDOW, 0))) {
- HandleButtonClick(w, 17);
+ w->HandleButtonClick(17);
SndPlayFx(SND_15_BEEP);
}
}
@@ -915,7 +915,7 @@ static void ToolbarZoomInClick(Window *w)
static void ToolbarZoomOutClick(Window *w)
{
if (DoZoomInOutWindow(ZOOM_OUT,FindWindowById(WC_MAIN_WINDOW, 0))) {
- HandleButtonClick(w, 18);
+ w->HandleButtonClick(18);
SndPlayFx(SND_15_BEEP);
}
}
@@ -992,7 +992,7 @@ static void ToolbarScenDateBackward(Window *w)
{
/* don't allow too fast scrolling */
if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) {
- HandleButtonClick(w, 6);
+ w->HandleButtonClick(6);
SetWindowDirty(w);
_patches_newgame.starting_year = Clamp(_patches_newgame.starting_year - 1, MIN_YEAR, MAX_YEAR);
@@ -1005,7 +1005,7 @@ static void ToolbarScenDateForward(Window *w)
{
/* don't allow too fast scrolling */
if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) {
- HandleButtonClick(w, 7);
+ w->HandleButtonClick(7);
SetWindowDirty(w);
_patches_newgame.starting_year = Clamp(_patches_newgame.starting_year + 1, MIN_YEAR, MAX_YEAR);
@@ -1023,7 +1023,7 @@ static void ToolbarScenMapTownDir(Window *w)
static void ToolbarScenZoomIn(Window *w)
{
if (DoZoomInOutWindow(ZOOM_IN, FindWindowById(WC_MAIN_WINDOW, 0))) {
- HandleButtonClick(w, 9);
+ w->HandleButtonClick(9);
SndPlayFx(SND_15_BEEP);
}
}
@@ -1031,7 +1031,7 @@ static void ToolbarScenZoomIn(Window *w)
static void ToolbarScenZoomOut(Window *w)
{
if (DoZoomInOutWindow(ZOOM_OUT, FindWindowById(WC_MAIN_WINDOW, 0))) {
- HandleButtonClick(w, 10);
+ w->HandleButtonClick(10);
SndPlayFx(SND_15_BEEP);
}
}
@@ -1333,7 +1333,7 @@ static void ScenEditLandGenWndProc(Window *w, WindowEvent *e)
break;
case 12: case 13: { // Increase/Decrease terraform size
int size = (e->we.click.widget == 12) ? 1 : -1;
- HandleButtonClick(w, e->we.click.widget);
+ w->HandleButtonClick(e->we.click.widget);
size += _terraform_size;
if (!IsInsideMM(size, 1, 8 + 1)) return;
@@ -1343,7 +1343,7 @@ static void ScenEditLandGenWndProc(Window *w, WindowEvent *e)
SetWindowDirty(w);
} break;
case 14: // gen random land
- HandleButtonClick(w, 14);
+ w->HandleButtonClick(14);
ShowCreateScenario();
break;
case 15: // Reset landscape
@@ -1410,7 +1410,7 @@ static inline void ShowEditorTerraformToolBar()
static void ToolbarScenGenLand(Window *w)
{
- HandleButtonClick(w, 11);
+ w->HandleButtonClick(11);
SndPlayFx(SND_15_BEEP);
ShowEditorTerraformToolBar();
@@ -1469,7 +1469,7 @@ static void ScenEditTownGenWndProc(Window *w, WindowEvent *e)
uint size = min(_scengen_town_size, (int)TSM_CITY);
TownSizeMode mode = _scengen_town_size > TSM_CITY ? TSM_CITY : TSM_FIXED;
- HandleButtonClick(w, 5);
+ w->HandleButtonClick(5);
_generating_world = true;
t = CreateRandomTown(20, mode, size);
_generating_world = false;
@@ -1483,7 +1483,7 @@ static void ScenEditTownGenWndProc(Window *w, WindowEvent *e)
break;
}
case 6: {// many random towns
- HandleButtonClick(w, 6);
+ w->HandleButtonClick(6);
_generating_world = true;
if (!GenerateTowns()) ShowErrorMessage(STR_NO_SPACE_FOR_TOWN, STR_CANNOT_GENERATE_TOWN, 0, 0);
@@ -1526,7 +1526,7 @@ static const WindowDesc _scen_edit_town_gen_desc = {
static void ToolbarScenGenTown(Window *w)
{
- HandleButtonClick(w, 12);
+ w->HandleButtonClick(12);
SndPlayFx(SND_15_BEEP);
AllocateWindowDescFront(&_scen_edit_town_gen_desc, 0);
@@ -1534,28 +1534,28 @@ static void ToolbarScenGenTown(Window *w)
static void ToolbarScenGenIndustry(Window *w)
{
- HandleButtonClick(w, 13);
+ w->HandleButtonClick(13);
SndPlayFx(SND_15_BEEP);
ShowBuildIndustryWindow();
}
static void ToolbarScenBuildRoad(Window *w)
{
- HandleButtonClick(w, 14);
+ w->HandleButtonClick(14);
SndPlayFx(SND_15_BEEP);
ShowBuildRoadScenToolbar();
}
static void ToolbarScenPlantTrees(Window *w)
{
- HandleButtonClick(w, 15);
+ w->HandleButtonClick(15);
SndPlayFx(SND_15_BEEP);
ShowBuildTreesScenToolbar();
}
static void ToolbarScenPlaceSign(Window *w)
{
- HandleButtonClick(w, 16);
+ w->HandleButtonClick(16);
SndPlayFx(SND_15_BEEP);
SelectSignTool();
}
diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp
index 535c8de37..47780867c 100644
--- a/src/misc_gui.cpp
+++ b/src/misc_gui.cpp
@@ -1591,7 +1591,7 @@ static void SaveLoadDlgWndProc(Window *w, WindowEvent *e)
if (_saveload_mode == SLD_SAVE_GAME || _saveload_mode == SLD_SAVE_SCENARIO) {
if (HandleEditBoxKey(w, &WP(w, querystr_d), 10, e) == 1) // Press Enter
- HandleButtonClick(w, 12);
+ w->HandleButtonClick(12);
}
break;
case WE_TIMEOUT:
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp
index de1ace134..eb9c04e4b 100644
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -755,7 +755,7 @@ static void NetworkStartServerWindowWndProc(Window *w, WindowEvent *e)
case NSSW_SPECTATORS_BTND: case NSSW_SPECTATORS_BTNU: // Click on up/down button for number of spectators
/* Don't allow too fast scrolling */
if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) {
- HandleButtonClick(w, e->we.click.widget);
+ w->HandleButtonClick(e->we.click.widget);
SetWindowDirty(w);
switch (e->we.click.widget) {
default: NOT_REACHED();
diff --git a/src/window.cpp b/src/window.cpp
index e64575301..958eb4475 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -97,14 +97,6 @@ void Window::HandleButtonClick(byte widget)
this->InvalidateWidget(widget);
}
-void HandleButtonClick(Window *w, byte widget)
-{
- w->LowerWidget(widget);
- w->flags4 |= 5 << WF_TIMEOUT_SHL;
- w->InvalidateWidget(widget);
-}
-
-
static void StartWindowDrag(Window *w);
static void StartWindowSizing(Window *w);
@@ -132,7 +124,7 @@ static void DispatchLeftClickEvent(Window *w, int x, int y, bool double_click)
case WWT_PANEL | WWB_PUSHBUTTON: /* WWT_PUSHBTN */
case WWT_IMGBTN | WWB_PUSHBUTTON: /* WWT_PUSHIMGBTN */
case WWT_TEXTBTN | WWB_PUSHBUTTON: /* WWT_PUSHTXTBTN */
- HandleButtonClick(w, e.we.click.widget);
+ w->HandleButtonClick(e.we.click.widget);
break;
}
} else if (wi->type == WWT_SCROLLBAR || wi->type == WWT_SCROLL2BAR || wi->type == WWT_HSCROLLBAR) {
diff --git a/src/window.h b/src/window.h
index f2b910cea..1fae1a5ca 100644
--- a/src/window.h
+++ b/src/window.h
@@ -646,7 +646,6 @@ int GetWidgetFromPos(const Window *w, int x, int y);
void DrawWindowWidgets(const Window *w);
void ShowDropDownMenu(Window *w, const StringID *strings, int selected, int button, uint32 disabled_mask, uint32 hidden_mask);
-void HandleButtonClick(Window *w, byte widget);
Window *GetCallbackWnd();
void DeleteNonVitalWindows();