Changeset - r982:ae84d4003591
[Not reviewed]
master
0 8 0
darkvater - 20 years ago 2005-01-11 00:24:27
darkvater@openttd.org
(svn r1478) -Fix: [1099195] mouse-wheel in train replace window. Scrollbar1 and Scrollbar2 now work independently. You can only scroll on list and scrollbar itself; scrollbar must be next widget of the list.
-Fix: updated the few gui's that didn't have the scrollbar right after the listbox.
8 files changed with 74 insertions and 67 deletions:
0 comments (0 inline, 0 general)
aircraft_gui.c
Show inline comments
 
@@ -805,22 +805,6 @@ static void AircraftDepotClickAircraft(W
 
	}
 
}
 

	
 
static const Widget _aircraft_depot_widgets[] = {
 
{    WWT_TEXTBTN,   RESIZE_NONE,    14,     0,    10,     0,    13, STR_00C5,									STR_018B_CLOSE_WINDOW},
 
{    WWT_CAPTION,  RESIZE_RIGHT,    14,    11,   318,     0,    13, STR_A002_AIRCRAFT_HANGAR,	STR_018C_WINDOW_TITLE_DRAG_THIS},
 
{  WWT_STICKYBOX,     RESIZE_LR,    14,   319,   330,     0,    13, 0x0,											STR_STICKY_BUTTON},
 
{     WWT_MATRIX,     RESIZE_RB,    14,     0,   295,    14,    61, 0x204,										STR_A021_AIRCRAFT_CLICK_ON_AIRCRAFT},
 
{      WWT_PANEL,    RESIZE_LRB,    14,   296,   318,    14,    13, 0x0,													STR_NULL},
 
{     WWT_IMGBTN,   RESIZE_LRTB,    14,   296,   318,    14,    61, 0x2A9,										STR_A023_DRAG_AIRCRAFT_TO_HERE_TO},
 
{  WWT_SCROLLBAR,    RESIZE_LRB,    14,   319,   330,    14,    61, 0x0,											STR_0190_SCROLL_BAR_SCROLLS_LIST},
 
{ WWT_PUSHTXTBTN,     RESIZE_TB,    14,     0,   159,    62,    73, STR_A003_NEW_AIRCRAFT,		STR_A022_BUILD_NEW_AIRCRAFT},
 
{ WWT_PUSHTXTBTN,     RESIZE_TB,    14,   160,   318,    62,    73, STR_00E4_LOCATION,				STR_A024_CENTER_MAIN_VIEW_ON_HANGAR},
 
{      WWT_PANEL,    RESIZE_RTB,    14,   319,   318,    62,    73, 0x0,													STR_NULL},
 
{  WWT_RESIZEBOX,   RESIZE_LRTB,    14,   319,   330,    62,    73, 0x0,											STR_RESIZE_BUTTON},
 
{   WIDGETS_END},
 
};
 

	
 

	
 
static void AircraftDepotWndProc(Window *w, WindowEvent *e)
 
{
 
	switch(e->event) {
 
@@ -830,7 +814,7 @@ static void AircraftDepotWndProc(Window 
 

	
 
	case WE_CLICK:
 
		switch(e->click.widget) {
 
		case 3: /* click aircraft */
 
		case 5: /* click aircraft */
 
			AircraftDepotClickAircraft(w, e->click.pt.x, e->click.pt.y);
 
			break;
 
		case 7: /* show build aircraft window */
 
@@ -848,7 +832,7 @@ static void AircraftDepotWndProc(Window 
 

	
 
	case WE_DRAGDROP: {
 
		switch(e->click.widget) {
 
		case 3: {
 
		case 5: {
 
			Vehicle *v;
 
			VehicleID sel = WP(w,traindepot_d).sel;
 

	
 
@@ -862,12 +846,12 @@ static void AircraftDepotWndProc(Window 
 
			}
 
		} break;
 

	
 
		case 5:
 
			if (!HASBIT(w->disabled_state, 5) &&
 
		case 4:
 
			if (!HASBIT(w->disabled_state, 4) &&
 
					WP(w,traindepot_d).sel != INVALID_VEHICLE)	{
 
				Vehicle *v;
 

	
 
				HandleButtonClick(w, 5);
 
				HandleButtonClick(w, 4);
 

	
 
				v = GetVehicle(WP(w,traindepot_d).sel);
 
				WP(w,traindepot_d).sel = INVALID_VEHICLE;
 
@@ -890,12 +874,26 @@ static void AircraftDepotWndProc(Window 
 
	case WE_RESIZE:
 
		w->vscroll.cap += e->sizing.diff.y / 24;
 
		w->hscroll.cap += e->sizing.diff.x / 74;
 
		w->widget[3].unkA = (w->vscroll.cap << 8) + w->hscroll.cap;
 
		w->widget[5].unkA = (w->vscroll.cap << 8) + w->hscroll.cap;
 
		break;
 
	}
 
}
 

	
 
static const Widget _aircraft_depot_widgets[] = {
 
{    WWT_TEXTBTN,   RESIZE_NONE,    14,     0,    10,     0,    13, STR_00C5,									STR_018B_CLOSE_WINDOW},
 
{    WWT_CAPTION,  RESIZE_RIGHT,    14,    11,   318,     0,    13, STR_A002_AIRCRAFT_HANGAR,	STR_018C_WINDOW_TITLE_DRAG_THIS},
 
{  WWT_STICKYBOX,     RESIZE_LR,    14,   319,   330,     0,    13, 0x0,											STR_STICKY_BUTTON},
 
{      WWT_PANEL,    RESIZE_LRB,    14,   296,   318,    14,    13, 0x0,													STR_NULL},
 
{     WWT_IMGBTN,   RESIZE_LRTB,    14,   296,   318,    14,    61, 0x2A9,										STR_A023_DRAG_AIRCRAFT_TO_HERE_TO},
 

	
 
{     WWT_MATRIX,     RESIZE_RB,    14,     0,   295,    14,    61, 0x204,										STR_A021_AIRCRAFT_CLICK_ON_AIRCRAFT},
 
{  WWT_SCROLLBAR,    RESIZE_LRB,    14,   319,   330,    14,    61, 0x0,											STR_0190_SCROLL_BAR_SCROLLS_LIST},
 
{ WWT_PUSHTXTBTN,     RESIZE_TB,    14,     0,   159,    62,    73, STR_A003_NEW_AIRCRAFT,		STR_A022_BUILD_NEW_AIRCRAFT},
 
{ WWT_PUSHTXTBTN,     RESIZE_TB,    14,   160,   318,    62,    73, STR_00E4_LOCATION,				STR_A024_CENTER_MAIN_VIEW_ON_HANGAR},
 
{      WWT_PANEL,    RESIZE_RTB,    14,   319,   318,    62,    73, 0x0,													STR_NULL},
 
{  WWT_RESIZEBOX,   RESIZE_LRTB,    14,   319,   330,    62,    73, 0x0,											STR_RESIZE_BUTTON},
 
{   WIDGETS_END},
 
};
 

	
 
static const WindowDesc _aircraft_depot_desc = {
 
	-1, -1, 331, 74,
network_gui.c
Show inline comments
 
@@ -248,7 +248,7 @@ static void NetworkGameWindowWndProc(Win
 
		case 4: case 5:
 
			ShowDropDownMenu(w, _lan_internet_types_dropdown, _network_lan_internet, 5, 0, 0); // do it for widget 5
 
			break;
 
		case 10: { /* Matrix to show networkgames */
 
		case 9: { /* Matrix to show networkgames */
 
			uint32 id_v = (e->click.pt.y - NET_PRC__OFFSET_TOP_WIDGET) / NET_PRC__SIZE_OF_ROW;
 

	
 
			if (id_v >= w->vscroll.cap) { return;} // click out of bounds
 
@@ -363,11 +363,7 @@ static void NetworkGameWindowWndProc(Win
 
			break;
 
		}
 

	
 
		switch (HandleEditBoxKey(w, 3, e)) {
 
		case 1:
 
			HandleButtonClick(w, 10);
 
			break;
 
		}
 
		if (HandleEditBoxKey(w, 3, e) == 1) break; // enter pressed
 

	
 
		// The name is only allowed when it starts with a letter!
 
		if (_edit_str_buf[0] != '\0' && _edit_str_buf[0] != ' ')
 
@@ -399,13 +395,12 @@ static const Widget _network_game_window
 
{          WWT_6,   RESIZE_NONE,   BGC,    90,   231,    42,    53, STR_NETWORK_COMBO1,					STR_NETWORK_CONNECTION_TIP},
 
{   WWT_CLOSEBOX,   RESIZE_NONE,   BGC,   220,   230,    43,    52, STR_0225,										STR_NETWORK_CONNECTION_TIP},
 

	
 
{  WWT_SCROLLBAR,   RESIZE_NONE,   BGC,   220,   231,    62,   185, 0x0,													STR_0190_SCROLL_BAR_SCROLLS_LIST},
 

	
 
{     WWT_IMGBTN,   RESIZE_NONE,   BTC,    10,   130,    62,    73, 0x0,													STR_NETWORK_GAME_NAME_TIP },
 
{     WWT_IMGBTN,   RESIZE_NONE,   BTC,   131,   180,    62,    73, 0x0,													STR_NETWORK_CLIENTS_CAPTION_TIP },
 
{     WWT_IMGBTN,   RESIZE_NONE,   BTC,   181,   219,    62,    73, 0x0,													STR_NETWORK_INFO_ICONS_TIP },
 

	
 
{     WWT_MATRIX,   RESIZE_NONE,   BGC,    10,   219,    74,   185, 0x801,												STR_NETWORK_CLICK_GAME_TO_SELECT},
 
{  WWT_SCROLLBAR,   RESIZE_NONE,   BGC,   220,   231,    62,   185, 0x0,													STR_0190_SCROLL_BAR_SCROLLS_LIST},
 

	
 
{ WWT_PUSHTXTBTN,   RESIZE_NONE,   BTC,    10,   115,   195,   206, STR_NETWORK_FIND_SERVER,			STR_NETWORK_FIND_SERVER_TIP},
 
{ WWT_PUSHTXTBTN,   RESIZE_NONE,   BTC,   125,   231,   195,   206, STR_NETWORK_ADD_SERVER,			STR_NETWORK_ADD_SERVER_TIP},
roadveh_gui.c
Show inline comments
 
@@ -498,7 +498,7 @@ static void DrawRoadDepotWindow(Window *
 
	tile = w->window_number;
 

	
 
	/* setup disabled buttons */
 
	w->disabled_state = (_map_owner[tile]==_local_player) ? 0 : ((1<<5)|(1<<7));
 
	w->disabled_state = (_map_owner[tile]==_local_player) ? 0 : ((1<<4)|(1<<7));
 

	
 
	/* determine amount of items for scroller */
 
	num = 0;
 
@@ -622,7 +622,7 @@ static void RoadDepotWndProc(Window *w, 
 

	
 
	case WE_CLICK: {
 
		switch(e->click.widget) {
 
		case 3:
 
		case 5:
 
			RoadDepotClickVeh(w, e->click.pt.x, e->click.pt.y);
 
			break;
 

	
 
@@ -642,7 +642,7 @@ static void RoadDepotWndProc(Window *w, 
 

	
 
	case WE_DRAGDROP: {
 
		switch(e->click.widget) {
 
		case 3: {
 
		case 5: {
 
			Vehicle *v;
 
			VehicleID sel = WP(w,traindepot_d).sel;
 

	
 
@@ -656,12 +656,12 @@ static void RoadDepotWndProc(Window *w, 
 
			}
 
		} break;
 

	
 
		case 5:
 
			if (!HASBIT(w->disabled_state, 5) &&
 
		case 4:
 
			if (!HASBIT(w->disabled_state, 4) &&
 
					WP(w,traindepot_d).sel != INVALID_VEHICLE)	{
 
				Vehicle *v;
 

	
 
				HandleButtonClick(w, 5);
 
				HandleButtonClick(w, 4);
 

	
 
				v = GetVehicle(WP(w,traindepot_d).sel);
 
				WP(w,traindepot_d).sel = INVALID_VEHICLE;
 
@@ -685,7 +685,7 @@ static void RoadDepotWndProc(Window *w, 
 
		/* Update the scroll + matrix */
 
		w->vscroll.cap += e->sizing.diff.y / 14;
 
		w->hscroll.cap += e->sizing.diff.x / 56;
 
		w->widget[3].unkA = (w->vscroll.cap << 8) + w->hscroll.cap;
 
		w->widget[5].unkA = (w->vscroll.cap << 8) + w->hscroll.cap;
 

	
 
	} break;
 

	
 
@@ -697,9 +697,10 @@ static const Widget _road_depot_widgets[
 
{    WWT_TEXTBTN,   RESIZE_NONE,    14,     0,    10,     0,    13, STR_00C5, 										STR_018B_CLOSE_WINDOW},
 
{    WWT_CAPTION,  RESIZE_RIGHT,    14,    11,   302,     0,    13, STR_9003_ROAD_VEHICLE_DEPOT,	STR_018C_WINDOW_TITLE_DRAG_THIS},
 
{  WWT_STICKYBOX,     RESIZE_LR,    14,   303,   314,     0,    13, 0x0,													STR_STICKY_BUTTON},
 
{     WWT_MATRIX,     RESIZE_RB,    14,     0,   279,    14,    55, 0x305,												STR_9022_VEHICLES_CLICK_ON_VEHICLE},
 
{      WWT_PANEL,    RESIZE_LRB,    14,   280,   302,    14,    13, 0x0,													STR_NULL},
 
{     WWT_IMGBTN,   RESIZE_LRTB,    14,   280,   302,    14,    55, 0x2A9,												STR_9024_DRAG_ROAD_VEHICLE_TO_HERE},
 

	
 
{     WWT_MATRIX,     RESIZE_RB,    14,     0,   279,    14,    55, 0x305,												STR_9022_VEHICLES_CLICK_ON_VEHICLE},
 
{  WWT_SCROLLBAR,    RESIZE_LRB,    14,   303,   314,    14,    55, 0x0,													STR_0190_SCROLL_BAR_SCROLLS_LIST},
 
{ WWT_PUSHTXTBTN,     RESIZE_TB,    14,     0,   150,    56,    67, STR_9004_NEW_VEHICLES,				STR_9023_BUILD_NEW_ROAD_VEHICLE},
 
{ WWT_PUSHTXTBTN,     RESIZE_TB,    14,   151,   302,    56,    67, STR_00E4_LOCATION,						STR_9025_CENTER_MAIN_VIEW_ON_ROAD},
settings_gui.c
Show inline comments
 
@@ -1196,7 +1196,7 @@ static void NewgrfWndProc(Window *w, Win
 

	
 
	case WE_CLICK:
 
		switch(e->click.widget) {
 
		case 2: { // select a grf file
 
		case 3: { // select a grf file
 
			int y = (e->click.pt.y - NEWGRF_WND_PROC_OFFSET_TOP_WIDGET) / NEWGRF_WND_PROC_ROWSIZE;
 

	
 
			if (y >= w->vscroll.cap) { return;} // click out of bounds
 
@@ -1239,9 +1239,9 @@ static void NewgrfWndProc(Window *w, Win
 
static const Widget _newgrf_widgets[] = {
 
{   WWT_CLOSEBOX,   RESIZE_NONE,    14,     0,    10,     0,    13, STR_00C5,										STR_018B_CLOSE_WINDOW},
 
{    WWT_CAPTION,   RESIZE_NONE,    14,    11,   279,     0,    13, STR_NEWGRF_SETTINGS_CAPTION,	STR_018C_WINDOW_TITLE_DRAG_THIS},
 
{     WWT_MATRIX,   RESIZE_NONE,    14,     0,   267,    14,   182, 0xC01,/*small rows*/					STR_NEWGRF_TIP},
 
{      WWT_PANEL,   RESIZE_NONE,    14,     0,   279,   183,   276, 0x0,													STR_NULL},
 

	
 
{     WWT_MATRIX,   RESIZE_NONE,    14,     0,   267,    14,   182, 0xC01,/*small rows*/					STR_NEWGRF_TIP},
 
{  WWT_SCROLLBAR,   RESIZE_NONE,    14,   268,   279,    14,   182, 0x0,													STR_0190_SCROLL_BAR_SCROLLS_LIST},
 

	
 
{   WWT_CLOSEBOX,   RESIZE_NONE,    14,   147,   158,   244,   255, STR_0188,	STR_NULL},
ship_gui.c
Show inline comments
 
@@ -755,7 +755,7 @@ static void ShipDepotWndProc(Window *w, 
 

	
 
	case WE_CLICK:
 
		switch(e->click.widget) {
 
		case 3:
 
		case 5:
 
			ShipDepotClick(w, e->click.pt.x, e->click.pt.y);
 
			break;
 

	
 
@@ -775,7 +775,7 @@ static void ShipDepotWndProc(Window *w, 
 

	
 
	case WE_DRAGDROP: {
 
		switch(e->click.widget) {
 
		case 3: {
 
		case 5: {
 
			Vehicle *v;
 
			VehicleID sel = WP(w,traindepot_d).sel;
 

	
 
@@ -789,12 +789,12 @@ static void ShipDepotWndProc(Window *w, 
 
			}
 
		} break;
 

	
 
		case 5:
 
			if (!HASBIT(w->disabled_state, 5) &&
 
		case 4:
 
			if (!HASBIT(w->disabled_state, 4) &&
 
					WP(w,traindepot_d).sel != INVALID_VEHICLE)	{
 
				Vehicle *v;
 

	
 
				HandleButtonClick(w, 5);
 
				HandleButtonClick(w, 4);
 

	
 
				v = GetVehicle(WP(w,traindepot_d).sel);
 
				WP(w,traindepot_d).sel = INVALID_VEHICLE;
 
@@ -817,7 +817,7 @@ static void ShipDepotWndProc(Window *w, 
 
	case WE_RESIZE:
 
		w->vscroll.cap += e->sizing.diff.y / 24;
 
		w->hscroll.cap += e->sizing.diff.x / 90;
 
		w->widget[3].unkA = (w->vscroll.cap << 8) + w->hscroll.cap;
 
		w->widget[5].unkA = (w->vscroll.cap << 8) + w->hscroll.cap;
 
		break;
 
	}
 
}
 
@@ -826,9 +826,10 @@ static const Widget _ship_depot_widgets[
 
{    WWT_TEXTBTN,   RESIZE_NONE,    14,     0,    10,     0,    13, STR_00C5,								STR_018B_CLOSE_WINDOW},
 
{    WWT_CAPTION,  RESIZE_RIGHT,    14,    11,   292,     0,    13, STR_9803_SHIP_DEPOT,		STR_018C_WINDOW_TITLE_DRAG_THIS},
 
{  WWT_STICKYBOX,     RESIZE_LR,    14,   293,   304,     0,    13, 0x0,										STR_STICKY_BUTTON},
 
{      WWT_PANEL,    RESIZE_LRB,    14,   270,   292,    14,    13, 0x0,										STR_NULL},
 
{     WWT_IMGBTN,   RESIZE_LRTB,    14,   270,   292,    14,    61, 0x2A9,									STR_9821_DRAG_SHIP_TO_HERE_TO_SELL},
 

	
 
{     WWT_MATRIX,     RESIZE_RB,    14,     0,   269,    14,    61, 0x203,									STR_981F_SHIPS_CLICK_ON_SHIP_FOR},
 
{      WWT_PANEL,    RESIZE_LRB,    14,   270,   292,    14,    13, 0x0,													STR_NULL},
 
{     WWT_IMGBTN,   RESIZE_LRTB,    14,   270,   292,    14,    61, 0x2A9,									STR_9821_DRAG_SHIP_TO_HERE_TO_SELL},
 
{  WWT_SCROLLBAR,    RESIZE_LRB,    14,   293,   304,    14,    61, 0x0,										STR_0190_SCROLL_BAR_SCROLLS_LIST},
 
{ WWT_PUSHTXTBTN,     RESIZE_TB,    14,     0,   146,    62,    73, STR_9804_NEW_SHIPS,			STR_9820_BUILD_NEW_SHIP},
 
{ WWT_PUSHTXTBTN,     RESIZE_TB,    14,   147,   292,    62,    73, STR_00E4_LOCATION,			STR_9822_CENTER_MAIN_VIEW_ON_SHIP},
train_gui.c
Show inline comments
 
@@ -307,7 +307,7 @@ static void DrawTrainDepotWindow(Window 
 
	tile = w->window_number;
 

	
 
	/* setup disabled buttons */
 
	w->disabled_state = (_map_owner[tile]==_local_player) ? 0 : ((1<<5)|(1<<6)|(1<<8));
 
	w->disabled_state = (_map_owner[tile]==_local_player) ? 0 : ((1<<4)|(1<<5)|(1<<8));
 

	
 
	/* determine amount of items for scroller */
 
	num = 0;
 
@@ -527,7 +527,7 @@ static void TrainDepotWndProc(Window *w,
 
		case 9:
 
			ScrollMainWindowToTile(w->window_number);
 
			break;
 
		case 3:
 
		case 6:
 
			TrainDepotClickTrain(w, e->click.pt.x, e->click.pt.y);
 
			break;
 
		}
 
@@ -539,8 +539,7 @@ static void TrainDepotWndProc(Window *w,
 

	
 
	case WE_DRAGDROP: {
 
		switch(e->click.widget) {
 
		case 5:
 
		case 6: {
 
		case 4: case 5: {
 
			Vehicle *v;
 
			int sell_cmd;
 

	
 
@@ -558,7 +557,7 @@ static void TrainDepotWndProc(Window *w,
 

	
 
			HandleButtonClick(w, e->click.widget);
 

	
 
			sell_cmd = (e->click.widget == 6 || _ctrl_pressed) ? 1 : 0;
 
			sell_cmd = (e->click.widget == 5 || _ctrl_pressed) ? 1 : 0;
 

	
 
			if (v->subtype != 0) {
 
				DoCommandP(v->tile, v->index, sell_cmd, NULL, CMD_SELL_RAIL_WAGON | CMD_MSG(STR_8839_CAN_T_SELL_RAILROAD_VEHICLE));
 
@@ -570,7 +569,7 @@ static void TrainDepotWndProc(Window *w,
 
			}
 
		}	break;
 

	
 
		case 3: {
 
		case 6: {
 
				GetDepotVehiclePtData gdvp;
 
				VehicleID sel = WP(w,traindepot_d).sel;
 

	
 
@@ -597,20 +596,21 @@ static void TrainDepotWndProc(Window *w,
 
		/* Update the scroll + matrix */
 
		w->vscroll.cap += e->sizing.diff.y / 14;
 
		w->hscroll.cap += e->sizing.diff.x / 29;
 
		w->widget[3].unkA = (w->vscroll.cap << 8) + 1;
 
		w->widget[6].unkA = (w->vscroll.cap << 8) + 1;
 
	} break;
 
	}
 
}
 

	
 
static const Widget _train_depot_widgets[] = {
 
{   WWT_CLOSEBOX,   RESIZE_NONE,    14,     0,    10,     0,    13, STR_00C5,							STR_018B_CLOSE_WINDOW},
 
{    WWT_CAPTION,  RESIZE_RIGHT,    14,    11,   336,     0,    13, STR_8800_TRAIN_DEPOT,	STR_018C_WINDOW_TITLE_DRAG_THIS},
 
{  WWT_STICKYBOX,     RESIZE_LR,    14,   337,   348,     0,    13, 0x0,                   STR_STICKY_BUTTON},
 
{     WWT_MATRIX,     RESIZE_RB,    14,     0,   313,    14,    97, 0x601,									STR_883F_TRAINS_CLICK_ON_TRAIN_FOR},
 
{   WWT_CLOSEBOX,   RESIZE_NONE,    14,     0,    10,     0,    13, STR_00C5,								STR_018B_CLOSE_WINDOW},
 
{    WWT_CAPTION,  RESIZE_RIGHT,    14,    11,   336,     0,    13, STR_8800_TRAIN_DEPOT,		STR_018C_WINDOW_TITLE_DRAG_THIS},
 
{  WWT_STICKYBOX,     RESIZE_LR,    14,   337,   348,     0,    13, 0x0,										STR_STICKY_BUTTON},
 

	
 
{      WWT_PANEL,    RESIZE_LRB,    14,   314,   336,    14,    13, 0x0,										STR_NULL},
 
{      WWT_PANEL,   RESIZE_LRTB,    14,   314,   336,    14,    54, 0x2A9,									STR_8841_DRAG_TRAIN_VEHICLE_TO_HERE},
 
{      WWT_PANEL,   RESIZE_LRTB,    14,   314,   336,    55,   109, 0x2BF,									STR_DRAG_WHOLE_TRAIN_TO_SELL_TIP},
 

	
 
{     WWT_MATRIX,     RESIZE_RB,    14,     0,   313,    14,    97, 0x601,									STR_883F_TRAINS_CLICK_ON_TRAIN_FOR},
 
{  WWT_SCROLLBAR,    RESIZE_LRB,    14,   337,   348,    14,   109, 0x0,										STR_0190_SCROLL_BAR_SCROLLS_LIST},
 
{ WWT_PUSHTXTBTN,     RESIZE_TB,    14,     0,   167,   110,   121, STR_8815_NEW_VEHICLES,	STR_8840_BUILD_NEW_TRAIN_VEHICLE},
 
{ WWT_PUSHTXTBTN,     RESIZE_TB,    14,   168,   336,   110,   121, STR_00E4_LOCATION,			STR_8842_CENTER_MAIN_VIEW_ON_TRAIN},
window.c
Show inline comments
 
@@ -96,13 +96,25 @@ void DispatchRightClickEvent(Window *w, 
 
}
 

	
 

	
 
void DispatchMouseWheelEvent(Window *w, int wheel)
 
void DispatchMouseWheelEvent(Window *w, uint widget, int wheel)
 
{
 
	if (w->vscroll.count > w->vscroll.cap) {
 
		int pos = clamp(w->vscroll.pos + wheel, 0, w->vscroll.count - w->vscroll.cap);
 
		if (pos != w->vscroll.pos) {
 
			w->vscroll.pos = pos;
 
			SetWindowDirty(w);
 
	const Widget *wi1 = &w->widget[widget];
 
	const Widget *wi2 = &w->widget[widget + 1];
 
	Scrollbar *sb;
 

	
 
	/* The listbox can only scroll if scrolling was done on the scrollbar itself,
 
	 * or on the listbox (and the next item is (must be) the scrollbar) 
 
	 * XXX - should be rewritten as a widget-dependent scroller but that's
 
	 * not happening until someone rewrites the whole widget-code */
 
	if ((sb = &w->vscroll,  wi1->type == WWT_SCROLLBAR)  || (sb = &w->vscroll2, wi1->type == WWT_SCROLL2BAR)  || 
 
			(sb = &w->vscroll2, wi2->type == WWT_SCROLL2BAR) || (sb = &w->vscroll, wi2->type == WWT_SCROLLBAR) ) {
 

	
 
		if (sb->count > sb->cap) {
 
			int pos = clamp(sb->pos + wheel, 0, sb->count - sb->cap);
 
			if (pos != sb->pos) {
 
				sb->pos = pos;
 
				SetWindowDirty(w);
 
			}
 
		}
 
	}
 
}
 
@@ -1356,7 +1368,7 @@ void MouseLoop()
 
		}
 
	} else {
 
		if (mousewheel)
 
			DispatchMouseWheelEvent(w, mousewheel);
 
			DispatchMouseWheelEvent(w, GetWidgetFromPos(w, x - w->left, y - w->top), mousewheel);
 

	
 
		if (click == 1)
 
			DispatchLeftClickEvent(w, x - w->left, y - w->top);
window.h
Show inline comments
 
@@ -471,7 +471,7 @@ enum WindowFlags {
 

	
 
void DispatchLeftClickEvent(Window *w, int x, int y);
 
void DispatchRightClickEvent(Window *w, int x, int y);
 
void DispatchMouseWheelEvent(Window *w, int wheel);
 
void DispatchMouseWheelEvent(Window *w, uint widget, int wheel);
 

	
 
/* window.c */
 
void DrawOverlappedWindow(Window *w, int left, int top, int right, int bottom);
0 comments (0 inline, 0 general)