Codechange: Give ColourShade values names instead of numbers.
This commit is contained in:
		 Peter Nelson
					Peter Nelson
				
			
				
					committed by
					
						 Peter Nelson
						Peter Nelson
					
				
			
			
				
	
			
			
			 Peter Nelson
						Peter Nelson
					
				
			
						parent
						
							ae3390fe48
						
					
				
				
					commit
					912d7bd80e
				
			| @@ -1017,7 +1017,7 @@ void DrawEngineList(VehicleType type, const Rect &r, const GUIEngineList &eng_li | ||||
| 	int sprite_right = GetVehicleImageCellSize(type, EIT_PURCHASE).extend_right; | ||||
| 	int sprite_width = sprite_left + sprite_right; | ||||
| 	int circle_width = std::max(GetScaledSpriteSize(SPR_CIRCLE_FOLDED).width, GetScaledSpriteSize(SPR_CIRCLE_UNFOLDED).width); | ||||
| 	int linecolour = GetColourGradient(COLOUR_ORANGE, SHADE_4); | ||||
| 	int linecolour = GetColourGradient(COLOUR_ORANGE, SHADE_NORMAL); | ||||
|  | ||||
| 	Rect ir      = r.WithHeight(step_size).Shrink(WidgetDimensions::scaled.matrix); | ||||
| 	int sprite_y_offset = ScaleSpriteTrad(sprite_y_offsets[type]) + ir.Height() / 2; | ||||
|   | ||||
| @@ -146,8 +146,8 @@ void SetLocalCompany(CompanyID new_company) | ||||
|  */ | ||||
| TextColour GetDrawStringCompanyColour(CompanyID company) | ||||
| { | ||||
| 	if (!Company::IsValidID(company)) return (TextColour)GetColourGradient(COLOUR_WHITE, SHADE_4) | TC_IS_PALETTE_COLOUR; | ||||
| 	return (TextColour)GetColourGradient(_company_colours[company], SHADE_4) | TC_IS_PALETTE_COLOUR; | ||||
| 	if (!Company::IsValidID(company)) return (TextColour)GetColourGradient(COLOUR_WHITE, SHADE_NORMAL) | TC_IS_PALETTE_COLOUR; | ||||
| 	return (TextColour)GetColourGradient(_company_colours[company], SHADE_NORMAL) | TC_IS_PALETTE_COLOUR; | ||||
| } | ||||
|  | ||||
| /** | ||||
|   | ||||
| @@ -494,7 +494,7 @@ bool IsValidConsoleColour(TextColour c) | ||||
| 	 * colour gradient, so it must be one of those. */ | ||||
| 	c &= ~TC_IS_PALETTE_COLOUR; | ||||
| 	for (Colours i = COLOUR_BEGIN; i < COLOUR_END; i++) { | ||||
| 		if (GetColourGradient(i, SHADE_4) == c) return true; | ||||
| 		if (GetColourGradient(i, SHADE_NORMAL) == c) return true; | ||||
| 	} | ||||
|  | ||||
| 	return false; | ||||
|   | ||||
| @@ -384,7 +384,7 @@ struct DepotWindow : Window { | ||||
| 		 */ | ||||
| 		if (this->type == VEH_TRAIN && _consistent_train_width != 0) { | ||||
| 			int w = ScaleSpriteTrad(2 * _consistent_train_width); | ||||
| 			int col = GetColourGradient(wid->colour, SHADE_4); | ||||
| 			int col = GetColourGradient(wid->colour, SHADE_NORMAL); | ||||
| 			Rect image = ir.Indent(this->header_width, rtl).Indent(this->count_width, !rtl); | ||||
| 			int first_line = w + (-this->hscroll->GetPosition()) % w; | ||||
| 			if (rtl) { | ||||
|   | ||||
| @@ -627,7 +627,7 @@ public: | ||||
| 		for (CompanyID k = COMPANY_FIRST; k < MAX_COMPANIES; k++) { | ||||
| 			const Company *c = Company::GetIfValid(k); | ||||
| 			if (c != nullptr) { | ||||
| 				this->colours[numd] = GetColourGradient(c->colour, SHADE_6); | ||||
| 				this->colours[numd] = GetColourGradient(c->colour, SHADE_LIGHTER); | ||||
| 				for (int j = this->num_on_x_axis, i = 0; --j >= 0;) { | ||||
| 					if (j >= c->num_valid_stat_ent) { | ||||
| 						this->cost[numd][i] = INVALID_DATAPOINT; | ||||
| @@ -1294,8 +1294,8 @@ struct PerformanceRatingDetailWindow : Window { | ||||
| 		ScoreID score_type = (ScoreID)(widget - WID_PRD_SCORE_FIRST); | ||||
|  | ||||
| 		/* The colours used to show how the progress is going */ | ||||
| 		int colour_done = GetColourGradient(COLOUR_GREEN, SHADE_4); | ||||
| 		int colour_notdone = GetColourGradient(COLOUR_RED, SHADE_4); | ||||
| 		int colour_done = GetColourGradient(COLOUR_GREEN, SHADE_NORMAL); | ||||
| 		int colour_notdone = GetColourGradient(COLOUR_RED, SHADE_NORMAL); | ||||
|  | ||||
| 		/* Draw all the score parts */ | ||||
| 		int64_t val    = _score_part[company][score_type]; | ||||
|   | ||||
| @@ -262,7 +262,7 @@ private: | ||||
| 	{ | ||||
| 		/* Highlight the group if a vehicle is dragged over it */ | ||||
| 		if (g_id == this->group_over) { | ||||
| 			GfxFillRect(left + WidgetDimensions::scaled.bevel.left, y + WidgetDimensions::scaled.framerect.top, right - WidgetDimensions::scaled.bevel.right, y + this->tiny_step_height - 1 - WidgetDimensions::scaled.framerect.bottom, GetColourGradient(COLOUR_GREY, SHADE_7)); | ||||
| 			GfxFillRect(left + WidgetDimensions::scaled.bevel.left, y + WidgetDimensions::scaled.framerect.top, right - WidgetDimensions::scaled.bevel.right, y + this->tiny_step_height - 1 - WidgetDimensions::scaled.framerect.bottom, GetColourGradient(COLOUR_GREY, SHADE_LIGHTEST)); | ||||
| 		} | ||||
|  | ||||
| 		if (g_id == NEW_GROUP) return; | ||||
| @@ -630,7 +630,7 @@ public: | ||||
| 					for (size_t i = this->vscroll->GetPosition(); i < max; ++i) { | ||||
| 						const Vehicle *v = this->vehgroups[i].GetSingleVehicle(); | ||||
| 						if (v->group_id != this->vli.index) { | ||||
| 							GfxFillRect(mr.Shrink(WidgetDimensions::scaled.bevel), GetColourGradient(COLOUR_GREY, SHADE_3), FILLRECT_CHECKER); | ||||
| 							GfxFillRect(mr.Shrink(WidgetDimensions::scaled.bevel), GetColourGradient(COLOUR_GREY, SHADE_DARK), FILLRECT_CHECKER); | ||||
| 						} | ||||
| 						mr = mr.Translate(0, this->resize.step_height); | ||||
| 					} | ||||
|   | ||||
| @@ -312,7 +312,7 @@ void LinkGraphOverlay::DrawContent(Point pta, Point ptb, const LinkProperties &c | ||||
| 		GfxDrawLine(pta.x, pta.y + offset_y, ptb.x, ptb.y + offset_y, colour, width, dash); | ||||
| 	} | ||||
|  | ||||
| 	GfxDrawLine(pta.x, pta.y, ptb.x, ptb.y, GetColourGradient(COLOUR_GREY, SHADE_1), width); | ||||
| 	GfxDrawLine(pta.x, pta.y, ptb.x, ptb.y, GetColourGradient(COLOUR_GREY, SHADE_DARKEST), width); | ||||
| } | ||||
|  | ||||
| /** | ||||
| @@ -332,8 +332,8 @@ void LinkGraphOverlay::DrawStationDots(const DrawPixelInfo *dpi) const | ||||
|  | ||||
| 		LinkGraphOverlay::DrawVertex(pt.x, pt.y, r, | ||||
| 				GetColourGradient(st->owner != OWNER_NONE ? | ||||
| 						Company::Get(st->owner)->colour : COLOUR_GREY, SHADE_5), | ||||
| 				GetColourGradient(COLOUR_GREY, SHADE_1)); | ||||
| 						Company::Get(st->owner)->colour : COLOUR_GREY, SHADE_LIGHT), | ||||
| 				GetColourGradient(COLOUR_GREY, SHADE_DARKEST)); | ||||
| 	} | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -794,7 +794,7 @@ void QueryString::DrawEditBox(const Window *w, WidgetID wid) const | ||||
|  | ||||
| 	DrawFrameRect(cr, wi->colour, wi->IsLowered() ? FR_LOWERED : FR_NONE); | ||||
| 	DrawSpriteIgnorePadding(rtl ? SPR_IMG_DELETE_RIGHT : SPR_IMG_DELETE_LEFT, PAL_NONE, cr, SA_CENTER); | ||||
| 	if (this->text.bytes == 1) GfxFillRect(cr.Shrink(WidgetDimensions::scaled.bevel), GetColourGradient(wi->colour, SHADE_2), FILLRECT_CHECKER); | ||||
| 	if (this->text.bytes == 1) GfxFillRect(cr.Shrink(WidgetDimensions::scaled.bevel), GetColourGradient(wi->colour, SHADE_DARKER), FILLRECT_CHECKER); | ||||
|  | ||||
| 	DrawFrameRect(fr, wi->colour, FR_LOWERED | FR_DARKENED); | ||||
| 	GfxFillRect(fr.Shrink(WidgetDimensions::scaled.bevel), PC_BLACK); | ||||
|   | ||||
| @@ -1946,7 +1946,7 @@ public: | ||||
| 			DrawFrameRect(r, button->colour, FR_NONE); | ||||
| 			DrawSprite(button->sprite, PAL_NONE, r.left + WidgetDimensions::scaled.framerect.left, r.top + WidgetDimensions::scaled.framerect.top); | ||||
| 			if (button->disabled) { | ||||
| 				GfxFillRect(r.Shrink(WidgetDimensions::scaled.bevel), GetColourGradient(button->colour, SHADE_2), FILLRECT_CHECKER); | ||||
| 				GfxFillRect(r.Shrink(WidgetDimensions::scaled.bevel), GetColourGradient(button->colour, SHADE_DARKER), FILLRECT_CHECKER); | ||||
| 			} | ||||
|  | ||||
| 			int width = button->width + WidgetDimensions::scaled.hsep_normal; | ||||
|   | ||||
| @@ -1124,7 +1124,7 @@ public: | ||||
| 					int top = (this->order_over < this->selected_order ? y : y + line_height) - WidgetDimensions::scaled.framerect.top; | ||||
| 					int bottom = std::min(top + 2, ir.bottom); | ||||
| 					top = std::max(top - 3, ir.top); | ||||
| 					GfxFillRect(ir.left, top, ir.right, bottom, GetColourGradient(COLOUR_GREY, SHADE_7)); | ||||
| 					GfxFillRect(ir.left, top, ir.right, bottom, GetColourGradient(COLOUR_GREY, SHADE_LIGHTEST)); | ||||
| 					break; | ||||
| 				} | ||||
| 				y += line_height; | ||||
|   | ||||
| @@ -42,13 +42,13 @@ TextColour GetContrastColour(uint8_t background, uint8_t threshold = 128); | ||||
|  | ||||
| enum ColourShade : uint8_t { | ||||
| 	SHADE_BEGIN = 0, | ||||
| 	SHADE_1, | ||||
| 	SHADE_2, | ||||
| 	SHADE_3, | ||||
| 	SHADE_4, | ||||
| 	SHADE_5, | ||||
| 	SHADE_6, | ||||
| 	SHADE_7, | ||||
| 	SHADE_DARKEST, | ||||
| 	SHADE_DARKER, | ||||
| 	SHADE_DARK, | ||||
| 	SHADE_NORMAL, | ||||
| 	SHADE_LIGHT, | ||||
| 	SHADE_LIGHTER, | ||||
| 	SHADE_LIGHTEST, | ||||
| 	SHADE_END, | ||||
| }; | ||||
| DECLARE_POSTFIX_INCREMENT(ColourShade) | ||||
|   | ||||
| @@ -1414,7 +1414,7 @@ uint BaseSettingEntry::Draw(GameSettings *settings_ptr, int left, int right, int | ||||
|  | ||||
| 	int x = rtl ? right : left; | ||||
| 	if (cur_row >= first_row) { | ||||
| 		int colour = GetColourGradient(COLOUR_ORANGE, SHADE_4); | ||||
| 		int colour = GetColourGradient(COLOUR_ORANGE, SHADE_NORMAL); | ||||
| 		y += (cur_row - first_row) * SETTING_HEIGHT; // Compute correct y start position | ||||
|  | ||||
| 		/* Draw vertical for parent nesting levels */ | ||||
| @@ -2909,7 +2909,7 @@ void ShowGameSettings() | ||||
|  */ | ||||
| void DrawArrowButtons(int x, int y, Colours button_colour, byte state, bool clickable_left, bool clickable_right) | ||||
| { | ||||
| 	int colour = GetColourGradient(button_colour, SHADE_2); | ||||
| 	int colour = GetColourGradient(button_colour, SHADE_DARKER); | ||||
| 	Dimension dim = NWidgetScrollbar::GetHorizontalDimension(); | ||||
|  | ||||
| 	Rect lr = {x,                  y, x + (int)dim.width     - 1, y + (int)dim.height - 1}; | ||||
| @@ -2940,7 +2940,7 @@ void DrawArrowButtons(int x, int y, Colours button_colour, byte state, bool clic | ||||
|  */ | ||||
| void DrawDropDownButton(int x, int y, Colours button_colour, bool state, bool clickable) | ||||
| { | ||||
| 	int colour = GetColourGradient(button_colour, SHADE_2); | ||||
| 	int colour = GetColourGradient(button_colour, SHADE_DARKER); | ||||
|  | ||||
| 	Rect r = {x, y, x + SETTING_BUTTON_WIDTH - 1, y + SETTING_BUTTON_HEIGHT - 1}; | ||||
|  | ||||
|   | ||||
| @@ -346,7 +346,7 @@ void BuildOwnerLegend() | ||||
|  | ||||
| 	int i = NUM_NO_COMPANY_ENTRIES; | ||||
| 	for (const Company *c : Company::Iterate()) { | ||||
| 		_legend_land_owners[i].colour = GetColourGradient(c->colour, SHADE_5); | ||||
| 		_legend_land_owners[i].colour = GetColourGradient(c->colour, SHADE_LIGHT); | ||||
| 		_legend_land_owners[i].company = c->index; | ||||
| 		_legend_land_owners[i].show_on_map = true; | ||||
| 		_legend_land_owners[i].col_break = false; | ||||
|   | ||||
| @@ -76,7 +76,7 @@ static int HighlightDragPosition(int px, int max_width, int y, VehicleID selecti | ||||
| 		int top = y - height / 2; | ||||
| 		Rect r = {drag_hlight_left, top, drag_hlight_right, top + height - 1}; | ||||
| 		/* Sprite-scaling is used here as the area is from sprite size */ | ||||
| 		GfxFillRect(r.Shrink(ScaleSpriteTrad(1)), GetColourGradient(COLOUR_GREY, SHADE_7)); | ||||
| 		GfxFillRect(r.Shrink(ScaleSpriteTrad(1)), GetColourGradient(COLOUR_GREY, SHADE_LIGHTEST)); | ||||
| 	} | ||||
|  | ||||
| 	return drag_hlight_width; | ||||
| @@ -399,7 +399,7 @@ void DrawTrainDetails(const Train *v, const Rect &r, int vscroll_pos, uint16_t v | ||||
| 				if (vscroll_pos <= 0 && vscroll_pos > -vscroll_cap) { | ||||
| 					int py = r.top - line_height * vscroll_pos + text_y_offset; | ||||
| 					if (i > 0 || separate_sprite_row) { | ||||
| 						if (vscroll_pos != 0) GfxFillRect(r.left, py - WidgetDimensions::scaled.matrix.top - 1, r.right, py - WidgetDimensions::scaled.matrix.top, GetColourGradient(COLOUR_GREY, SHADE_5)); | ||||
| 						if (vscroll_pos != 0) GfxFillRect(r.left, py - WidgetDimensions::scaled.matrix.top - 1, r.right, py - WidgetDimensions::scaled.matrix.top, GetColourGradient(COLOUR_GREY, SHADE_LIGHT)); | ||||
| 					} | ||||
| 					switch (det_tab) { | ||||
| 						case TDW_TAB_CARGO: | ||||
|   | ||||
| @@ -624,7 +624,7 @@ static void DrawVehicleRefitWindow(const RefitOptions &refits, const RefitOption | ||||
| 	bool rtl = _current_text_dir == TD_RTL; | ||||
| 	uint iconwidth = std::max(GetSpriteSize(SPR_CIRCLE_FOLDED).width, GetSpriteSize(SPR_CIRCLE_UNFOLDED).width); | ||||
| 	uint iconheight = GetSpriteSize(SPR_CIRCLE_FOLDED).height; | ||||
| 	int linecolour = GetColourGradient(COLOUR_ORANGE, SHADE_4); | ||||
| 	int linecolour = GetColourGradient(COLOUR_ORANGE, SHADE_NORMAL); | ||||
|  | ||||
| 	int iconleft   = rtl ? ir.right - iconwidth     : ir.left; | ||||
| 	int iconcenter = rtl ? ir.right - iconwidth / 2 : ir.left + iconwidth / 2; | ||||
|   | ||||
| @@ -1716,7 +1716,7 @@ static void ViewportDrawStrings(ZoomLevel zoom, const StringSpriteToDrawVector * | ||||
| 				/* Don't draw the rectangle. | ||||
| 				 * Real colours need the TC_IS_PALETTE_COLOUR flag. | ||||
| 				 * Otherwise colours from _string_colourmap are assumed. */ | ||||
| 				colour = (TextColour)GetColourGradient(ss.colour, SHADE_6) | TC_IS_PALETTE_COLOUR; | ||||
| 				colour = (TextColour)GetColourGradient(ss.colour, SHADE_LIGHTER) | TC_IS_PALETTE_COLOUR; | ||||
| 			} else { | ||||
| 				/* Draw the rectangle if 'transparent station signs' is off, | ||||
| 				 * or if we are drawing a general text sign (STR_WHITE_SIGN). */ | ||||
|   | ||||
| @@ -282,10 +282,10 @@ void DrawFrameRect(int left, int top, int right, int bottom, Colours colour, Fra | ||||
| { | ||||
| 	assert(colour < COLOUR_END); | ||||
|  | ||||
| 	uint dark         = GetColourGradient(colour, SHADE_3); | ||||
| 	uint medium_dark  = GetColourGradient(colour, SHADE_5); | ||||
| 	uint medium_light = GetColourGradient(colour, SHADE_6); | ||||
| 	uint light        = GetColourGradient(colour, SHADE_7); | ||||
| 	uint dark         = GetColourGradient(colour, SHADE_DARK); | ||||
| 	uint medium_dark  = GetColourGradient(colour, SHADE_LIGHT); | ||||
| 	uint medium_light = GetColourGradient(colour, SHADE_LIGHTER); | ||||
| 	uint light        = GetColourGradient(colour, SHADE_LIGHTEST); | ||||
|  | ||||
| 	if (flags & FR_TRANSPARENT) { | ||||
| 		GfxFillRect(left, top, right, bottom, PALETTE_TO_TRANSPARENT, FILLRECT_RECOLOUR); | ||||
| @@ -423,7 +423,7 @@ static inline void DrawMatrix(const Rect &r, Colours colour, bool clicked, uint1 | ||||
| 		row_height = r.Height() / num_rows; | ||||
| 	} | ||||
|  | ||||
| 	int col = GetColourGradient(colour, SHADE_6); | ||||
| 	int col = GetColourGradient(colour, SHADE_LIGHTER); | ||||
|  | ||||
| 	int x = r.left; | ||||
| 	for (int ctr = num_columns; ctr > 1; ctr--) { | ||||
| @@ -437,7 +437,7 @@ static inline void DrawMatrix(const Rect &r, Colours colour, bool clicked, uint1 | ||||
| 		GfxFillRect(r.left + WidgetDimensions::scaled.bevel.left, x, r.right - WidgetDimensions::scaled.bevel.right, x + WidgetDimensions::scaled.bevel.top - 1, col); | ||||
| 	} | ||||
|  | ||||
| 	col = GetColourGradient(colour, SHADE_4); | ||||
| 	col = GetColourGradient(colour, SHADE_NORMAL); | ||||
|  | ||||
| 	x = r.left - 1; | ||||
| 	for (int ctr = num_columns; ctr > 1; ctr--) { | ||||
| @@ -469,8 +469,8 @@ static inline void DrawVerticalScrollbar(const Rect &r, Colours colour, bool up_ | ||||
| 	DrawImageButtons(r.WithHeight(height, false),  NWID_VSCROLLBAR, colour, up_clicked,   SPR_ARROW_UP,   SA_CENTER); | ||||
| 	DrawImageButtons(r.WithHeight(height, true),   NWID_VSCROLLBAR, colour, down_clicked, SPR_ARROW_DOWN, SA_CENTER); | ||||
|  | ||||
| 	int c1 = GetColourGradient(colour, SHADE_3); | ||||
| 	int c2 = GetColourGradient(colour, SHADE_7); | ||||
| 	int c1 = GetColourGradient(colour, SHADE_DARK); | ||||
| 	int c2 = GetColourGradient(colour, SHADE_LIGHTEST); | ||||
|  | ||||
| 	/* draw "shaded" background */ | ||||
| 	GfxFillRect(r.left, r.top + height, r.right, r.bottom - height, c2); | ||||
| @@ -508,8 +508,8 @@ static inline void DrawHorizontalScrollbar(const Rect &r, Colours colour, bool l | ||||
| 	DrawImageButtons(r.WithWidth(width, false), NWID_HSCROLLBAR, colour, left_clicked,  SPR_ARROW_LEFT,  SA_CENTER); | ||||
| 	DrawImageButtons(r.WithWidth(width, true),  NWID_HSCROLLBAR, colour, right_clicked, SPR_ARROW_RIGHT, SA_CENTER); | ||||
|  | ||||
| 	int c1 = GetColourGradient(colour, SHADE_3); | ||||
| 	int c2 = GetColourGradient(colour, SHADE_7); | ||||
| 	int c1 = GetColourGradient(colour, SHADE_DARK); | ||||
| 	int c2 = GetColourGradient(colour, SHADE_LIGHTEST); | ||||
|  | ||||
| 	/* draw "shaded" background */ | ||||
| 	GfxFillRect(r.left + width, r.top, r.right - width, r.bottom, c2); | ||||
| @@ -547,8 +547,8 @@ static inline void DrawFrame(const Rect &r, Colours colour, TextColour text_colo | ||||
|  | ||||
| 	if (str != STR_NULL) x2 = DrawString(r.left + WidgetDimensions::scaled.frametext.left, r.right - WidgetDimensions::scaled.frametext.right, r.top, str, text_colour, align, false, fs); | ||||
|  | ||||
| 	int c1 = GetColourGradient(colour, SHADE_3); | ||||
| 	int c2 = GetColourGradient(colour, SHADE_7); | ||||
| 	int c1 = GetColourGradient(colour, SHADE_DARK); | ||||
| 	int c2 = GetColourGradient(colour, SHADE_LIGHTEST); | ||||
|  | ||||
| 	/* If the frame has text, adjust the top bar to fit half-way through */ | ||||
| 	Rect inner = r.Shrink(ScaleGUITrad(1)); | ||||
| @@ -645,7 +645,7 @@ static inline void DrawResizeBox(const Rect &r, Colours colour, bool at_left, bo | ||||
| 	if (bevel) { | ||||
| 		DrawFrameRect(r.left, r.top, r.right, r.bottom, colour, (clicked) ? FR_LOWERED : FR_NONE); | ||||
| 	} else if (clicked) { | ||||
| 		GfxFillRect(r.Shrink(WidgetDimensions::scaled.bevel), GetColourGradient(colour, SHADE_6)); | ||||
| 		GfxFillRect(r.Shrink(WidgetDimensions::scaled.bevel), GetColourGradient(colour, SHADE_LIGHTER)); | ||||
| 	} | ||||
| 	DrawSpriteIgnorePadding(at_left ? SPR_WINDOW_RESIZE_LEFT : SPR_WINDOW_RESIZE_RIGHT, PAL_NONE, r.Shrink(ScaleGUITrad(2)), at_left ? (SA_LEFT | SA_BOTTOM | SA_FORCE) : (SA_RIGHT | SA_BOTTOM | SA_FORCE)); | ||||
| } | ||||
| @@ -685,7 +685,7 @@ void DrawCaption(const Rect &r, Colours colour, Owner owner, TextColour text_col | ||||
| 	DrawFrameRect(ir, colour, company_owned ? FR_LOWERED | FR_DARKENED | FR_BORDERONLY : FR_LOWERED | FR_DARKENED); | ||||
|  | ||||
| 	if (company_owned) { | ||||
| 		GfxFillRect(ir.Shrink(WidgetDimensions::scaled.bevel), GetColourGradient(_company_colours[owner], SHADE_4)); | ||||
| 		GfxFillRect(ir.Shrink(WidgetDimensions::scaled.bevel), GetColourGradient(_company_colours[owner], SHADE_NORMAL)); | ||||
| 	} | ||||
|  | ||||
| 	if (str != STR_NULL) { | ||||
| @@ -1906,7 +1906,7 @@ NWidgetCore *NWidgetMatrix::GetWidgetFromPos(int x, int y) | ||||
| /* virtual */ void NWidgetMatrix::Draw(const Window *w) | ||||
| { | ||||
| 	/* Fill the background. */ | ||||
| 	GfxFillRect(this->GetCurrentRect(), GetColourGradient(this->colour, SHADE_5)); | ||||
| 	GfxFillRect(this->GetCurrentRect(), GetColourGradient(this->colour, SHADE_LIGHT)); | ||||
|  | ||||
| 	/* Set up a clipping area for the previews. */ | ||||
| 	bool rtl = _current_text_dir == TD_RTL; | ||||
| @@ -2171,7 +2171,7 @@ void NWidgetBackground::Draw(const Window *w) | ||||
| 	if (this->child != nullptr) this->child->Draw(w); | ||||
|  | ||||
| 	if (this->IsDisabled()) { | ||||
| 		GfxFillRect(r.Shrink(WidgetDimensions::scaled.bevel), GetColourGradient(this->colour, SHADE_2), FILLRECT_CHECKER); | ||||
| 		GfxFillRect(r.Shrink(WidgetDimensions::scaled.bevel), GetColourGradient(this->colour, SHADE_DARKER), FILLRECT_CHECKER); | ||||
| 	} | ||||
|  | ||||
| 	DrawOutline(w, this); | ||||
| @@ -2416,7 +2416,7 @@ void NWidgetScrollbar::Draw(const Window *w) | ||||
| 	} | ||||
|  | ||||
| 	if (this->IsDisabled()) { | ||||
| 		GfxFillRect(r.Shrink(WidgetDimensions::scaled.bevel), GetColourGradient(this->colour, SHADE_2), FILLRECT_CHECKER); | ||||
| 		GfxFillRect(r.Shrink(WidgetDimensions::scaled.bevel), GetColourGradient(this->colour, SHADE_DARKER), FILLRECT_CHECKER); | ||||
| 	} | ||||
|  | ||||
| 	DrawOutline(w, this); | ||||
| @@ -2867,7 +2867,7 @@ void NWidgetLeaf::Draw(const Window *w) | ||||
| 	if (this->index >= 0) w->DrawWidget(r, this->index); | ||||
|  | ||||
| 	if (this->IsDisabled()) { | ||||
| 		GfxFillRect(r.Shrink(WidgetDimensions::scaled.bevel), GetColourGradient(this->colour, SHADE_2), FILLRECT_CHECKER); | ||||
| 		GfxFillRect(r.Shrink(WidgetDimensions::scaled.bevel), GetColourGradient(this->colour, SHADE_DARKER), FILLRECT_CHECKER); | ||||
| 	} | ||||
|  | ||||
| 	DrawOutline(w, this); | ||||
|   | ||||
| @@ -37,7 +37,7 @@ public: | ||||
|  | ||||
| 	virtual void Draw(const Rect &full, const Rect &, bool, Colours bg_colour) const | ||||
| 	{ | ||||
| 		if (this->masked) GfxFillRect(full, GetColourGradient(bg_colour, SHADE_5), FILLRECT_CHECKER); | ||||
| 		if (this->masked) GfxFillRect(full, GetColourGradient(bg_colour, SHADE_LIGHT), FILLRECT_CHECKER); | ||||
| 	} | ||||
|  | ||||
| 	TextColour GetColour(bool sel) const | ||||
| @@ -63,8 +63,8 @@ public: | ||||
|  | ||||
| 	void Draw(const Rect &full, const Rect &, bool, Colours bg_colour) const override | ||||
| 	{ | ||||
| 		uint8_t c1 = GetColourGradient(bg_colour, SHADE_3); | ||||
| 		uint8_t c2 = GetColourGradient(bg_colour, SHADE_7); | ||||
| 		uint8_t c1 = GetColourGradient(bg_colour, SHADE_DARK); | ||||
| 		uint8_t c2 = GetColourGradient(bg_colour, SHADE_LIGHTEST); | ||||
|  | ||||
| 		int mid = CenterBounds(full.top, full.bottom, 0); | ||||
| 		GfxFillRect(full.left, mid - WidgetDimensions::scaled.bevel.bottom, full.right, mid - 1, c1); | ||||
|   | ||||
| @@ -41,9 +41,9 @@ void DrawSliderWidget(Rect r, int min_value, int max_value, int value, const std | ||||
| 	int wx1 = r.left  + sw / 2; | ||||
| 	int wx2 = r.right - sw / 2; | ||||
| 	if (_current_text_dir == TD_RTL) std::swap(wx1, wx2); | ||||
| 	const uint shadow = GetColourGradient(COLOUR_GREY, SHADE_3); | ||||
| 	const uint fill = GetColourGradient(COLOUR_GREY, SHADE_6); | ||||
| 	const uint light = GetColourGradient(COLOUR_GREY, SHADE_7); | ||||
| 	const uint shadow = GetColourGradient(COLOUR_GREY, SHADE_DARK); | ||||
| 	const uint fill = GetColourGradient(COLOUR_GREY, SHADE_LIGHTER); | ||||
| 	const uint light = GetColourGradient(COLOUR_GREY, SHADE_LIGHTEST); | ||||
| 	const std::vector<Point> wedge{ Point{wx1, r.bottom - ha}, Point{wx2, r.top + ha}, Point{wx2, r.bottom - ha} }; | ||||
| 	GfxFillPolygon(wedge, fill); | ||||
| 	GfxDrawLine(wedge[0].x, wedge[0].y, wedge[2].x, wedge[2].y, light, t); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user