(svn r2444) - CodeChange: Add an enum for demagicifying the values of the 'flags' parameter of DrawFrameRect(). (_Abraxa_)
This commit is contained in:
		@@ -67,7 +67,7 @@ static void DrawAircraftImage(const Vehicle *v, int x, int y, VehicleID selectio
 | 
				
			|||||||
	if (v->subtype == 0)
 | 
						if (v->subtype == 0)
 | 
				
			||||||
		DrawSprite(0xF3D, x+25, y+5);
 | 
							DrawSprite(0xF3D, x+25, y+5);
 | 
				
			||||||
	if (v->index == selection) {
 | 
						if (v->index == selection) {
 | 
				
			||||||
		DrawFrameRect(x-1, y-1, x+58, y+21, 0xF, 0x10);
 | 
							DrawFrameRect(x-1, y-1, x+58, y+21, 0xF, FR_BORDERONLY);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1725,19 +1725,19 @@ static void CheatsWndProc(Window *w, WindowEvent *e)
 | 
				
			|||||||
			DrawSprite((SPR_OPENTTD_BASE + ((*ce->been_used)?67:66)), x+5, y+2);
 | 
								DrawSprite((SPR_OPENTTD_BASE + ((*ce->been_used)?67:66)), x+5, y+2);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (ce->type == CE_BOOL) {
 | 
								if (ce->type == CE_BOOL) {
 | 
				
			||||||
				DrawFrameRect(x+20, y+1, x+30+9, y+9, (*(bool*)ce->variable)?6:4, (*(bool*)ce->variable)?0x20:0);
 | 
									DrawFrameRect(x+20, y+1, x+30+9, y+9, (*(bool*)ce->variable) ? 6 : 4, (*(bool*)ce->variable) ? FR_LOWERED : 0);
 | 
				
			||||||
				SetDParam(0, *(bool*)ce->variable ? STR_CONFIG_PATCHES_ON : STR_CONFIG_PATCHES_OFF);
 | 
									SetDParam(0, *(bool*)ce->variable ? STR_CONFIG_PATCHES_ON : STR_CONFIG_PATCHES_OFF);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			}	else if (ce->type == CE_CLICK) {
 | 
								}	else if (ce->type == CE_CLICK) {
 | 
				
			||||||
				DrawFrameRect(x+20, y+1, x+30+9, y+9, 0, (WP(w,def_d).data_1==i*2+1)?0x20:0x00);
 | 
									DrawFrameRect(x+20, y+1, x+30+9, y+9, 0, (WP(w,def_d).data_1 == i*2+1) ? FR_LOWERED : 0);
 | 
				
			||||||
				if (i == 0)
 | 
									if (i == 0)
 | 
				
			||||||
					SetDParam64(0, (int64) 10000000);
 | 
										SetDParam64(0, (int64) 10000000);
 | 
				
			||||||
				else
 | 
									else
 | 
				
			||||||
					SetDParam(0, false);
 | 
										SetDParam(0, false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			} else {
 | 
								} else {
 | 
				
			||||||
				DrawFrameRect(x+20, y+1, x+20+9, y+9, 3, clk == i*2+1 ? 0x20 : 0);
 | 
									DrawFrameRect(x+20, y+1, x+20+9, y+9, 3, clk == i*2+1 ? FR_LOWERED : 0);
 | 
				
			||||||
				DrawFrameRect(x+30, y+1, x+30+9, y+9, 3, clk == i*2+2 ? 0x20 : 0);
 | 
									DrawFrameRect(x+30, y+1, x+30+9, y+9, 3, clk == i*2+2 ? FR_LOWERED : 0);
 | 
				
			||||||
				DrawStringCentered(x+25, y+1, STR_6819, 0);
 | 
									DrawStringCentered(x+25, y+1, STR_6819, 0);
 | 
				
			||||||
				DrawStringCentered(x+35, y+1, STR_681A, 0);
 | 
									DrawStringCentered(x+35, y+1, STR_681A, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -366,8 +366,8 @@ static void MusicWindowWndProc(Window *w, WindowEvent *e)
 | 
				
			|||||||
		DrawStringCentered(247, 15, STR_01DC_EFFECTS_VOLUME, 0);
 | 
							DrawStringCentered(247, 15, STR_01DC_EFFECTS_VOLUME, 0);
 | 
				
			||||||
		DrawStringCentered(247, 29, STR_01DD_MIN_MAX, 0);
 | 
							DrawStringCentered(247, 29, STR_01DD_MIN_MAX, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		DrawFrameRect(108, 23, 174, 26, 14, 0x20);
 | 
							DrawFrameRect(108, 23, 174, 26, 14, FR_LOWERED);
 | 
				
			||||||
		DrawFrameRect(214, 23, 280, 26, 14, 0x20);
 | 
							DrawFrameRect(214, 23, 280, 26, 14, FR_LOWERED);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		DrawFrameRect(108 + (msf.music_vol>>1),
 | 
							DrawFrameRect(108 + (msf.music_vol>>1),
 | 
				
			||||||
									22,
 | 
														22,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -765,7 +765,7 @@ static void MessageOptionsWndProc(Window *w, WindowEvent *e)
 | 
				
			|||||||
		for (i = 0, y = 26; i != 10; i++, y += 12, click_state >>= 1, val >>= 2) {
 | 
							for (i = 0, y = 26; i != 10; i++, y += 12, click_state >>= 1, val >>= 2) {
 | 
				
			||||||
			bool clicked = !!(click_state & 1);
 | 
								bool clicked = !!(click_state & 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			DrawFrameRect(13, y, 89, 11 + y, 3, (clicked) ? 0x20 : 0);
 | 
								DrawFrameRect(13, y, 89, 11 + y, 3, (clicked) ? FR_LOWERED : 0);
 | 
				
			||||||
			DrawStringCentered(((13 + 89 + 1) >> 1) + clicked, ((y + 11 + y + 1) >> 1) - 5 + clicked, message_opt[val & 0x3], 0x10);
 | 
								DrawStringCentered(((13 + 89 + 1) >> 1) + clicked, ((y + 11 + y + 1) >> 1) - 5 + clicked, message_opt[val & 0x3], 0x10);
 | 
				
			||||||
			DrawString(103, y + 1, i + STR_0206_ARRIVAL_OF_FIRST_VEHICLE, 0);
 | 
								DrawString(103, y + 1, i + STR_0206_ARRIVAL_OF_FIRST_VEHICLE, 0);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -66,7 +66,7 @@ static void DrawRoadVehImage(const Vehicle *v, int x, int y, VehicleID selection
 | 
				
			|||||||
	DrawSprite(image | ormod, x+14, y+6);
 | 
						DrawSprite(image | ormod, x+14, y+6);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (v->index == selection) {
 | 
						if (v->index == selection) {
 | 
				
			||||||
		DrawFrameRect(x-1, y-1, x+28, y+12, 15, 0x10);
 | 
							DrawFrameRect(x-1, y-1, x+28, y+12, 15, FR_BORDERONLY);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -842,13 +842,13 @@ static void PatchesSelectionWndProc(Window *w, WindowEvent *e)
 | 
				
			|||||||
				editable = false;
 | 
									editable = false;
 | 
				
			||||||
			if (pe->type == PE_BOOL) {
 | 
								if (pe->type == PE_BOOL) {
 | 
				
			||||||
				if (editable)
 | 
									if (editable)
 | 
				
			||||||
					DrawFrameRect(x+5, y+1, x+15+9, y+9, (*(bool*)pe->variable)?6:4, (*(bool*)pe->variable)?0x20:0);
 | 
										DrawFrameRect(x+5, y+1, x+15+9, y+9, (*(bool*)pe->variable) ? 6 : 4, (*(bool*)pe->variable) ? FR_LOWERED : 0);
 | 
				
			||||||
				else
 | 
									else
 | 
				
			||||||
					DrawFrameRect(x+5, y+1, x+15+9, y+9, (*(bool*)pe->variable)?7:9, (*(bool*)pe->variable)?0x20:0);
 | 
										DrawFrameRect(x+5, y+1, x+15+9, y+9, (*(bool*)pe->variable) ? 7 : 9, (*(bool*)pe->variable) ? FR_LOWERED : 0);
 | 
				
			||||||
				SetDParam(0, *(bool*)pe->variable ? STR_CONFIG_PATCHES_ON : STR_CONFIG_PATCHES_OFF);
 | 
									SetDParam(0, *(bool*)pe->variable ? STR_CONFIG_PATCHES_ON : STR_CONFIG_PATCHES_OFF);
 | 
				
			||||||
			} else {
 | 
								} else {
 | 
				
			||||||
				DrawFrameRect(x+5, y+1, x+5+9, y+9, 3, clk == i*2+1 ? 0x20 : 0);
 | 
									DrawFrameRect(x+5, y+1, x+5+9, y+9, 3, clk == i*2+1 ? FR_LOWERED : 0);
 | 
				
			||||||
				DrawFrameRect(x+15, y+1, x+15+9, y+9, 3, clk == i*2+2 ? 0x20 : 0);
 | 
									DrawFrameRect(x+15, y+1, x+15+9, y+9, 3, clk == i*2+2 ? FR_LOWERED : 0);
 | 
				
			||||||
				if (!editable) {
 | 
									if (!editable) {
 | 
				
			||||||
					int color = 0x8000 | _color_list[3].unk2;
 | 
										int color = 0x8000 | _color_list[3].unk2;
 | 
				
			||||||
					GfxFillRect(x+6, y+2, x+6+8, y+9, color);
 | 
										GfxFillRect(x+6, y+2, x+6+8, y+9, color);
 | 
				
			||||||
@@ -1294,8 +1294,8 @@ void ShowNewgrf(void)
 | 
				
			|||||||
/* state: 0 = none clicked, 0x01 = first clicked, 0x02 = second clicked */
 | 
					/* state: 0 = none clicked, 0x01 = first clicked, 0x02 = second clicked */
 | 
				
			||||||
void DrawArrowButtons(int x, int y, int state)
 | 
					void DrawArrowButtons(int x, int y, int state)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	DrawFrameRect(x, y+1, x+9, y+9, 3, (state&0x01) ? 0x20 : 0);
 | 
						DrawFrameRect(x, y+1, x+9, y+9, 3, (state & 0x01) ? FR_LOWERED : 0);
 | 
				
			||||||
	DrawFrameRect(x+10, y+1, x+19, y+9, 3, (state&0x02) ? 0x20 : 0);
 | 
						DrawFrameRect(x+10, y+1, x+19, y+9, 3, (state & 0x02) ? FR_LOWERED : 0);
 | 
				
			||||||
	DrawStringCentered(x+5, y+1, STR_6819, 0);
 | 
						DrawStringCentered(x+5, y+1, STR_6819, 0);
 | 
				
			||||||
	DrawStringCentered(x+15, y+1, STR_681A, 0);
 | 
						DrawStringCentered(x+15, y+1, STR_681A, 0);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -1320,7 +1320,7 @@ static void CustCurrencyWndProc(Window *w, WindowEvent *e)
 | 
				
			|||||||
		i++;
 | 
							i++;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// separator
 | 
							// separator
 | 
				
			||||||
		DrawFrameRect(10, y+1, 29, y+9, 0, ((clk >> (i*2)) & 0x03)?0x20:0x00);
 | 
							DrawFrameRect(10, y+1, 29, y+9, 0, ((clk >> (i*2)) & 0x03) ? FR_LOWERED : 0);
 | 
				
			||||||
		x = DrawString(x, y + 1, STR_CURRENCY_SEPARATOR, 0);
 | 
							x = DrawString(x, y + 1, STR_CURRENCY_SEPARATOR, 0);
 | 
				
			||||||
		DoDrawString(_str_separator, x + 4, y + 1, 6);
 | 
							DoDrawString(_str_separator, x + 4, y + 1, 6);
 | 
				
			||||||
		x = 35;
 | 
							x = 35;
 | 
				
			||||||
@@ -1328,7 +1328,7 @@ static void CustCurrencyWndProc(Window *w, WindowEvent *e)
 | 
				
			|||||||
		i++;
 | 
							i++;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// prefix
 | 
							// prefix
 | 
				
			||||||
		DrawFrameRect(10, y+1, 29, y+9, 0, ((clk >> (i*2)) & 0x03)?0x20:0x00);
 | 
							DrawFrameRect(10, y+1, 29, y+9, 0, ((clk >> (i*2)) & 0x03) ? FR_LOWERED : 0);
 | 
				
			||||||
		x = DrawString(x, y + 1, STR_CURRENCY_PREFIX, 0);
 | 
							x = DrawString(x, y + 1, STR_CURRENCY_PREFIX, 0);
 | 
				
			||||||
		DoDrawString(_currency_specs[23].prefix, x + 4, y + 1, 6);
 | 
							DoDrawString(_currency_specs[23].prefix, x + 4, y + 1, 6);
 | 
				
			||||||
		x = 35;
 | 
							x = 35;
 | 
				
			||||||
@@ -1336,7 +1336,7 @@ static void CustCurrencyWndProc(Window *w, WindowEvent *e)
 | 
				
			|||||||
		i++;
 | 
							i++;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// suffix
 | 
							// suffix
 | 
				
			||||||
		DrawFrameRect(10, y+1, 29, y+9, 0, ((clk >> (i*2)) & 0x03)?0x20:0x00);
 | 
							DrawFrameRect(10, y+1, 29, y+9, 0, ((clk >> (i*2)) & 0x03) ? FR_LOWERED : 0);
 | 
				
			||||||
		x = DrawString(x, y + 1, STR_CURRENCY_SUFFIX, 0);
 | 
							x = DrawString(x, y + 1, STR_CURRENCY_SUFFIX, 0);
 | 
				
			||||||
		DoDrawString(_currency_specs[23].suffix, x + 4, y + 1, 6);
 | 
							DoDrawString(_currency_specs[23].suffix, x + 4, y + 1, 6);
 | 
				
			||||||
		x = 35;
 | 
							x = 35;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -64,7 +64,7 @@ static void DrawShipImage(const Vehicle *v, int x, int y, VehicleID selection)
 | 
				
			|||||||
	DrawSprite(image | ormod, x+32, y+10);
 | 
						DrawSprite(image | ormod, x+32, y+10);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (v->index == selection) {
 | 
						if (v->index == selection) {
 | 
				
			||||||
		DrawFrameRect(x-5, y-1, x+67, y+21, 15, 0x10);
 | 
							DrawFrameRect(x-5, y-1, x+67, y+21, 15, FR_BORDERONLY);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -342,7 +342,7 @@ static void DrawTrainImage(const Vehicle *v, int x, int y, int count, int skip,
 | 
				
			|||||||
					ormod = PALETTE_CRASH;
 | 
										ormod = PALETTE_CRASH;
 | 
				
			||||||
				DrawSprite(image | ormod, x + 14, y + 6 + _traininfo_vehicle_pitch);
 | 
									DrawSprite(image | ormod, x + 14, y + 6 + _traininfo_vehicle_pitch);
 | 
				
			||||||
				if (v->index == selection)
 | 
									if (v->index == selection)
 | 
				
			||||||
					DrawFrameRect(x - 1, y - 1, x + width + 4, y + 12, 15, 0x10);
 | 
										DrawFrameRect(x - 1, y - 1, x + width + 4, y + 12, 15, FR_BORDERONLY);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			x += width + 5;
 | 
								x += width + 5;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1178,7 +1178,7 @@ static void ViewportDrawStrings(DrawPixelInfo *dpi, StringSpriteToDraw *ss)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		/* Draw the rectangle if 'tranparent station signs' is off, or if we are drawing a general text sign (STR_2806) */
 | 
							/* Draw the rectangle if 'tranparent station signs' is off, or if we are drawing a general text sign (STR_2806) */
 | 
				
			||||||
			if(!(_display_opt & DO_TRANS_SIGNS) || ss->string == STR_2806)
 | 
								if(!(_display_opt & DO_TRANS_SIGNS) || ss->string == STR_2806)
 | 
				
			||||||
				DrawFrameRect(x,y, x+w, bottom, ss->color, (_display_opt & DO_TRANS_BUILDINGS) ? 0x9 : 0);
 | 
									DrawFrameRect(x,y, x+w, bottom, ss->color, (_display_opt & DO_TRANS_BUILDINGS) ? FR_TRANSPARENT | FR_NOBORDER : 0);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		SetDParam(0, ss->params[0]);
 | 
							SetDParam(0, ss->params[0]);
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										36
									
								
								widget.c
									
									
									
									
									
								
							
							
						
						
									
										36
									
								
								widget.c
									
									
									
									
									
								
							@@ -189,7 +189,7 @@ void DrawWindowWidgets(Window *w)
 | 
				
			|||||||
		case WWT_PANEL_2: {
 | 
							case WWT_PANEL_2: {
 | 
				
			||||||
			int img;
 | 
								int img;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, (clicked) ? 0x20 : 0);
 | 
								DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, (clicked) ? FR_LOWERED : 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if ((img = wi->unkA) != 0) { // has an image
 | 
								if ((img = wi->unkA) != 0) { // has an image
 | 
				
			||||||
				if ((wi->type & WWT_MASK) == WWT_PANEL_2 && clicked) img++; // show diff image when clicked
 | 
									if ((wi->type & WWT_MASK) == WWT_PANEL_2 && clicked) img++; // show diff image when clicked
 | 
				
			||||||
@@ -201,7 +201,7 @@ void DrawWindowWidgets(Window *w)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		case WWT_CLOSEBOX: /* WWT_TEXTBTN */
 | 
							case WWT_CLOSEBOX: /* WWT_TEXTBTN */
 | 
				
			||||||
		case WWT_4: {
 | 
							case WWT_4: {
 | 
				
			||||||
			DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, (clicked) ? 0x20 : 0);
 | 
								DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, (clicked) ? FR_LOWERED : 0);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		/* fall through */
 | 
							/* fall through */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -217,7 +217,7 @@ void DrawWindowWidgets(Window *w)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		case WWT_6: {
 | 
							case WWT_6: {
 | 
				
			||||||
			StringID str;
 | 
								StringID str;
 | 
				
			||||||
			DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, 0x60);
 | 
								DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, FR_LOWERED | FR_DARKENED);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if ((str = wi->unkA) != 0) {
 | 
								if ((str = wi->unkA) != 0) {
 | 
				
			||||||
				DrawString(r.left+2, r.top+1, str, 0);
 | 
									DrawString(r.left+2, r.top+1, str, 0);
 | 
				
			||||||
@@ -231,7 +231,7 @@ void DrawWindowWidgets(Window *w)
 | 
				
			|||||||
			int x, amt1, amt2;
 | 
								int x, amt1, amt2;
 | 
				
			||||||
			int color;
 | 
								int color;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, (clicked) ? 0x20 : 0);
 | 
								DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, (clicked) ? FR_LOWERED : 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			c = (wi->unkA&0xFF);
 | 
								c = (wi->unkA&0xFF);
 | 
				
			||||||
			amt1 = (wi->right - wi->left + 1) / c;
 | 
								amt1 = (wi->right - wi->left + 1) / c;
 | 
				
			||||||
@@ -279,11 +279,11 @@ void DrawWindowWidgets(Window *w)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
			// draw up/down buttons
 | 
								// draw up/down buttons
 | 
				
			||||||
			clicked = !!((w->flags4 & (WF_SCROLL_UP | WF_HSCROLL | WF_SCROLL2)) == WF_SCROLL_UP);
 | 
								clicked = !!((w->flags4 & (WF_SCROLL_UP | WF_HSCROLL | WF_SCROLL2)) == WF_SCROLL_UP);
 | 
				
			||||||
			DrawFrameRect(r.left, r.top, r.right, r.top + 9, wi->color, (clicked) ? 0x20 : 0);
 | 
								DrawFrameRect(r.left, r.top, r.right, r.top + 9, wi->color, (clicked) ? FR_LOWERED : 0);
 | 
				
			||||||
			DoDrawString("\xA0", r.left + 2 + clicked, r.top + clicked, 0x10);
 | 
								DoDrawString("\xA0", r.left + 2 + clicked, r.top + clicked, 0x10);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			clicked = !!(((w->flags4 & (WF_SCROLL_DOWN | WF_HSCROLL | WF_SCROLL2)) == WF_SCROLL_DOWN));
 | 
								clicked = !!(((w->flags4 & (WF_SCROLL_DOWN | WF_HSCROLL | WF_SCROLL2)) == WF_SCROLL_DOWN));
 | 
				
			||||||
			DrawFrameRect(r.left, r.bottom - 9, r.right, r.bottom, wi->color, (clicked) ? 0x20 : 0);
 | 
								DrawFrameRect(r.left, r.bottom - 9, r.right, r.bottom, wi->color, (clicked) ? FR_LOWERED : 0);
 | 
				
			||||||
			DoDrawString("\xAA", r.left + 2 + clicked, r.bottom - 9 + clicked, 0x10);
 | 
								DoDrawString("\xAA", r.left + 2 + clicked, r.bottom - 9 + clicked, 0x10);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			c1 = _color_list[wi->color&0xF].window_color_1a;
 | 
								c1 = _color_list[wi->color&0xF].window_color_1a;
 | 
				
			||||||
@@ -300,7 +300,7 @@ void DrawWindowWidgets(Window *w)
 | 
				
			|||||||
			GfxFillRect(r.left+8, r.top+10, r.left+8, r.bottom-10, c2);
 | 
								GfxFillRect(r.left+8, r.top+10, r.left+8, r.bottom-10, c2);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			pt = HandleScrollbarHittest(&w->vscroll, r.top, r.bottom);
 | 
								pt = HandleScrollbarHittest(&w->vscroll, r.top, r.bottom);
 | 
				
			||||||
			DrawFrameRect(r.left, pt.x, r.right, pt.y, wi->color, (w->flags4 & (WF_SCROLL_MIDDLE | WF_HSCROLL | WF_SCROLL2)) == WF_SCROLL_MIDDLE ? 0x20 : 0);
 | 
								DrawFrameRect(r.left, pt.x, r.right, pt.y, wi->color, (w->flags4 & (WF_SCROLL_MIDDLE | WF_HSCROLL | WF_SCROLL2)) == WF_SCROLL_MIDDLE ? FR_LOWERED : 0);
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		case WWT_SCROLL2BAR: {
 | 
							case WWT_SCROLL2BAR: {
 | 
				
			||||||
@@ -311,11 +311,11 @@ void DrawWindowWidgets(Window *w)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
			// draw up/down buttons
 | 
								// draw up/down buttons
 | 
				
			||||||
			clicked = !!((w->flags4 & (WF_SCROLL_UP | WF_HSCROLL | WF_SCROLL2)) == (WF_SCROLL_UP | WF_SCROLL2));
 | 
								clicked = !!((w->flags4 & (WF_SCROLL_UP | WF_HSCROLL | WF_SCROLL2)) == (WF_SCROLL_UP | WF_SCROLL2));
 | 
				
			||||||
			DrawFrameRect(r.left, r.top, r.right, r.top + 9, wi->color,  (clicked) ? 0x20 : 0);
 | 
								DrawFrameRect(r.left, r.top, r.right, r.top + 9, wi->color,  (clicked) ? FR_LOWERED : 0);
 | 
				
			||||||
			DoDrawString("\xA0", r.left + 2 + clicked, r.top + clicked, 0x10);
 | 
								DoDrawString("\xA0", r.left + 2 + clicked, r.top + clicked, 0x10);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			clicked = !!((w->flags4 & (WF_SCROLL_DOWN | WF_HSCROLL | WF_SCROLL2)) == (WF_SCROLL_DOWN | WF_SCROLL2));
 | 
								clicked = !!((w->flags4 & (WF_SCROLL_DOWN | WF_HSCROLL | WF_SCROLL2)) == (WF_SCROLL_DOWN | WF_SCROLL2));
 | 
				
			||||||
			DrawFrameRect(r.left, r.bottom - 9, r.right, r.bottom, wi->color,  (clicked) ? 0x20 : 0);
 | 
								DrawFrameRect(r.left, r.bottom - 9, r.right, r.bottom, wi->color,  (clicked) ? FR_LOWERED : 0);
 | 
				
			||||||
			DoDrawString("\xAA", r.left + 2 + clicked, r.bottom - 9 + clicked, 0x10);
 | 
								DoDrawString("\xAA", r.left + 2 + clicked, r.bottom - 9 + clicked, 0x10);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			c1 = _color_list[wi->color&0xF].window_color_1a;
 | 
								c1 = _color_list[wi->color&0xF].window_color_1a;
 | 
				
			||||||
@@ -332,7 +332,7 @@ void DrawWindowWidgets(Window *w)
 | 
				
			|||||||
			GfxFillRect(r.left+8, r.top+10, r.left+8, r.bottom-10, c2);
 | 
								GfxFillRect(r.left+8, r.top+10, r.left+8, r.bottom-10, c2);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			pt = HandleScrollbarHittest(&w->vscroll2, r.top, r.bottom);
 | 
								pt = HandleScrollbarHittest(&w->vscroll2, r.top, r.bottom);
 | 
				
			||||||
			DrawFrameRect(r.left, pt.x, r.right, pt.y, wi->color, (w->flags4 & (WF_SCROLL_MIDDLE | WF_HSCROLL | WF_SCROLL2)) == (WF_SCROLL_MIDDLE | WF_SCROLL2) ? 0x20 : 0);
 | 
								DrawFrameRect(r.left, pt.x, r.right, pt.y, wi->color, (w->flags4 & (WF_SCROLL_MIDDLE | WF_HSCROLL | WF_SCROLL2)) == (WF_SCROLL_MIDDLE | WF_SCROLL2) ? FR_LOWERED : 0);
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -344,11 +344,11 @@ void DrawWindowWidgets(Window *w)
 | 
				
			|||||||
			assert(r.bottom - r.top == 11); // XXX - to ensure the same sizes are used everywhere!
 | 
								assert(r.bottom - r.top == 11); // XXX - to ensure the same sizes are used everywhere!
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			clicked = !!((w->flags4 & (WF_SCROLL_UP | WF_HSCROLL)) == (WF_SCROLL_UP | WF_HSCROLL));
 | 
								clicked = !!((w->flags4 & (WF_SCROLL_UP | WF_HSCROLL)) == (WF_SCROLL_UP | WF_HSCROLL));
 | 
				
			||||||
			DrawFrameRect(r.left, r.top, r.left + 9, r.bottom, wi->color, (clicked) ? 0x20 : 0);
 | 
								DrawFrameRect(r.left, r.top, r.left + 9, r.bottom, wi->color, (clicked) ? FR_LOWERED : 0);
 | 
				
			||||||
			DrawSprite(SPR_ARROW_LEFT, r.left + 1 + clicked, r.top + 1 + clicked);
 | 
								DrawSprite(SPR_ARROW_LEFT, r.left + 1 + clicked, r.top + 1 + clicked);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			clicked = !!((w->flags4 & (WF_SCROLL_DOWN | WF_HSCROLL)) == (WF_SCROLL_DOWN | WF_HSCROLL));
 | 
								clicked = !!((w->flags4 & (WF_SCROLL_DOWN | WF_HSCROLL)) == (WF_SCROLL_DOWN | WF_HSCROLL));
 | 
				
			||||||
			DrawFrameRect(r.right-9, r.top, r.right, r.bottom, wi->color, (clicked) ? 0x20 : 0);
 | 
								DrawFrameRect(r.right-9, r.top, r.right, r.bottom, wi->color, (clicked) ? FR_LOWERED : 0);
 | 
				
			||||||
			DrawSprite(SPR_ARROW_RIGHT, r.right - 8 + clicked, r.top + 1 + clicked);
 | 
								DrawSprite(SPR_ARROW_RIGHT, r.right - 8 + clicked, r.top + 1 + clicked);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			c1 = _color_list[wi->color&0xF].window_color_1a;
 | 
								c1 = _color_list[wi->color&0xF].window_color_1a;
 | 
				
			||||||
@@ -366,7 +366,7 @@ void DrawWindowWidgets(Window *w)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
			// draw actual scrollbar
 | 
								// draw actual scrollbar
 | 
				
			||||||
			pt = HandleScrollbarHittest(&w->hscroll, r.left, r.right);
 | 
								pt = HandleScrollbarHittest(&w->hscroll, r.left, r.right);
 | 
				
			||||||
			DrawFrameRect(pt.x, r.top, pt.y, r.bottom, wi->color, (w->flags4 & (WF_SCROLL_MIDDLE | WF_HSCROLL)) == (WF_SCROLL_MIDDLE | WF_HSCROLL) ? 0x20 : 0);
 | 
								DrawFrameRect(pt.x, r.top, pt.y, r.bottom, wi->color, (w->flags4 & (WF_SCROLL_MIDDLE | WF_HSCROLL)) == (WF_SCROLL_MIDDLE | WF_HSCROLL) ? FR_LOWERED : 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -406,7 +406,7 @@ void DrawWindowWidgets(Window *w)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		case WWT_STICKYBOX: {
 | 
							case WWT_STICKYBOX: {
 | 
				
			||||||
			assert(r.right - r.left == 11); // XXX - to ensure the same sizes are used everywhere!
 | 
								assert(r.right - r.left == 11); // XXX - to ensure the same sizes are used everywhere!
 | 
				
			||||||
			DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, (clicked) ? 0x20 : 0);
 | 
								DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, (clicked) ? FR_LOWERED : 0);
 | 
				
			||||||
			DrawSprite((clicked) ? SPR_PIN_UP : SPR_PIN_DOWN, r.left + 2 + clicked, r.top + 3 + clicked);
 | 
								DrawSprite((clicked) ? SPR_PIN_UP : SPR_PIN_DOWN, r.left + 2 + clicked, r.top + 3 + clicked);
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -415,15 +415,15 @@ void DrawWindowWidgets(Window *w)
 | 
				
			|||||||
			assert(r.right - r.left == 11); // XXX - to ensure the same sizes are used everywhere!
 | 
								assert(r.right - r.left == 11); // XXX - to ensure the same sizes are used everywhere!
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			clicked = !!(w->flags4 & WF_SIZING);
 | 
								clicked = !!(w->flags4 & WF_SIZING);
 | 
				
			||||||
			DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, (clicked) ? 0x20 : 0);
 | 
								DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, (clicked) ? FR_LOWERED : 0);
 | 
				
			||||||
			DrawSprite(SPR_WINDOW_RESIZE, r.left + 3 + clicked, r.top + 3 + clicked);
 | 
								DrawSprite(SPR_WINDOW_RESIZE, r.left + 3 + clicked, r.top + 3 + clicked);
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		case WWT_CAPTION: {
 | 
							case WWT_CAPTION: {
 | 
				
			||||||
			assert(r.bottom - r.top == 13); // XXX - to ensure the same sizes are used everywhere!
 | 
								assert(r.bottom - r.top == 13); // XXX - to ensure the same sizes are used everywhere!
 | 
				
			||||||
			DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, 0x10);
 | 
								DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, FR_BORDERONLY);
 | 
				
			||||||
			DrawFrameRect(r.left+1, r.top+1, r.right-1, r.bottom-1, wi->color, (w->caption_color == 0xFF) ? 0x60 : 0x70);
 | 
								DrawFrameRect(r.left+1, r.top+1, r.right-1, r.bottom-1, wi->color, (w->caption_color == 0xFF) ? FR_LOWERED | FR_DARKENED : FR_LOWERED | FR_DARKENED | FR_BORDERONLY);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (w->caption_color != 0xFF) {
 | 
								if (w->caption_color != 0xFF) {
 | 
				
			||||||
				GfxFillRect(r.left+2, r.top+2, r.right-2, r.bottom-2, _color_list[_player_colors[w->caption_color]].window_color_1b);
 | 
									GfxFillRect(r.left+2, r.top+2, r.right-2, r.bottom-2, _color_list[_player_colors[w->caption_color]].window_color_1b);
 | 
				
			||||||
@@ -443,7 +443,7 @@ draw_default:;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if (w->flags4 & WF_WHITE_BORDER_MASK) {
 | 
						if (w->flags4 & WF_WHITE_BORDER_MASK) {
 | 
				
			||||||
		//DrawFrameRect(w->left, w->top, w->left + w->width-1, w->top+w->height-1, 0xF, 0x10);
 | 
							//DrawFrameRect(w->left, w->top, w->left + w->width-1, w->top+w->height-1, 0xF, 0x10);
 | 
				
			||||||
		DrawFrameRect(0, 0, w->width-1, w->height-1, 0xF, 0x10);
 | 
							DrawFrameRect(0, 0, w->width-1, w->height-1, 0xF, FR_BORDERONLY);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										8
									
								
								window.h
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								window.h
									
									
									
									
									
								
							@@ -61,6 +61,14 @@ typedef struct Widget {
 | 
				
			|||||||
	uint16 tooltips;
 | 
						uint16 tooltips;
 | 
				
			||||||
} Widget;
 | 
					} Widget;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					enum FrameFlags {
 | 
				
			||||||
 | 
						FR_TRANSPARENT  = 0x01,  ///< Makes the background transparent if set
 | 
				
			||||||
 | 
						FR_NOBORDER     = 0x08,  ///< Hide border (draws just a solid box)
 | 
				
			||||||
 | 
						FR_BORDERONLY   = 0x10,  ///< Draw border only, no background
 | 
				
			||||||
 | 
						FR_LOWERED      = 0x20,  ///< If set the frame is lowered and the background color brighter (ie. buttons when pressed)
 | 
				
			||||||
 | 
						FR_DARKENED     = 0x40,  ///< If set the background is darker, allows for lowered frames with normal background color when used with FR_LOWERED (ie. dropdown boxes)
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* XXX - outside "byte event" so you can set event directly without going into
 | 
					/* XXX - outside "byte event" so you can set event directly without going into
 | 
				
			||||||
 * the union elements at first. Because of this every first element of the union
 | 
					 * the union elements at first. Because of this every first element of the union
 | 
				
			||||||
 * MUST BE 'byte event'. Whoever did this must get shot! Scheduled for immediate
 | 
					 * MUST BE 'byte event'. Whoever did this must get shot! Scheduled for immediate
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user