Changeset - r28276:df3d8c57ffc5
[Not reviewed]
master
0 8 0
Peter Nelson - 12 months ago 2023-12-10 17:25:36
peter1138@openttd.org
Change: Hide bevel for resizeable sparse layout windows. (#11572)

When clicked, the button is still highlighted to show that it is active.

The bevel is controlled with widget_data by RWV_SHOW_BEVEL or RWV_HIDE_BEVEL values.
8 files changed with 27 insertions and 17 deletions:
0 comments (0 inline, 0 general)
src/game/game_gui.cpp
Show inline comments
 
@@ -67,7 +67,7 @@ static const NWidgetPart _nested_gs_conf
 
		EndContainer(),
 
		NWidget(NWID_HORIZONTAL),
 
			NWidget(NWID_SPACER), SetFill(1, 0), SetResize(1, 0),
 
			NWidget(WWT_RESIZEBOX, COLOUR_MAUVE),
 
			NWidget(WWT_RESIZEBOX, COLOUR_MAUVE), SetDataTip(RWV_HIDE_BEVEL, STR_TOOLTIP_RESIZE),
 
		EndContainer(),
 
	EndContainer(),
 
};
src/graph_gui.cpp
Show inline comments
 
@@ -647,7 +647,7 @@ static const NWidgetPart _nested_operati
 
			NWidget(WWT_EMPTY, COLOUR_BROWN, WID_CV_GRAPH), SetMinimalSize(576, 160), SetFill(1, 1), SetResize(1, 1),
 
			NWidget(NWID_VERTICAL),
 
				NWidget(NWID_SPACER), SetFill(0, 1), SetResize(0, 1),
 
				NWidget(WWT_RESIZEBOX, COLOUR_BROWN, WID_CV_RESIZE),
 
				NWidget(WWT_RESIZEBOX, COLOUR_BROWN, WID_CV_RESIZE), SetDataTip(RWV_HIDE_BEVEL, STR_TOOLTIP_RESIZE),
 
			EndContainer(),
 
		EndContainer(),
 
	EndContainer(),
 
@@ -698,7 +698,7 @@ static const NWidgetPart _nested_income_
 
			NWidget(WWT_EMPTY, COLOUR_BROWN, WID_CV_GRAPH), SetMinimalSize(576, 128), SetFill(1, 1), SetResize(1, 1),
 
			NWidget(NWID_VERTICAL),
 
				NWidget(NWID_SPACER), SetFill(0, 1), SetResize(0, 1),
 
				NWidget(WWT_RESIZEBOX, COLOUR_BROWN, WID_CV_RESIZE),
 
				NWidget(WWT_RESIZEBOX, COLOUR_BROWN, WID_CV_RESIZE), SetDataTip(RWV_HIDE_BEVEL, STR_TOOLTIP_RESIZE),
 
			EndContainer(),
 
		EndContainer(),
 
	EndContainer(),
 
@@ -747,7 +747,7 @@ static const NWidgetPart _nested_deliver
 
			NWidget(WWT_EMPTY, COLOUR_BROWN, WID_CV_GRAPH), SetMinimalSize(576, 128), SetFill(1, 1), SetResize(1, 1),
 
			NWidget(NWID_VERTICAL),
 
				NWidget(NWID_SPACER), SetFill(0, 1), SetResize(0, 1),
 
				NWidget(WWT_RESIZEBOX, COLOUR_BROWN, WID_CV_RESIZE),
 
				NWidget(WWT_RESIZEBOX, COLOUR_BROWN, WID_CV_RESIZE), SetDataTip(RWV_HIDE_BEVEL, STR_TOOLTIP_RESIZE),
 
			EndContainer(),
 
		EndContainer(),
 
	EndContainer(),
 
@@ -803,7 +803,7 @@ static const NWidgetPart _nested_perform
 
			NWidget(WWT_EMPTY, COLOUR_BROWN, WID_PHG_GRAPH), SetMinimalSize(576, 224), SetFill(1, 1), SetResize(1, 1),
 
			NWidget(NWID_VERTICAL),
 
				NWidget(NWID_SPACER), SetFill(0, 1), SetResize(0, 1),
 
				NWidget(WWT_RESIZEBOX, COLOUR_BROWN, WID_PHG_RESIZE),
 
				NWidget(WWT_RESIZEBOX, COLOUR_BROWN, WID_PHG_RESIZE), SetDataTip(RWV_HIDE_BEVEL, STR_TOOLTIP_RESIZE),
 
			EndContainer(),
 
		EndContainer(),
 
	EndContainer(),
 
@@ -852,7 +852,7 @@ static const NWidgetPart _nested_company
 
			NWidget(WWT_EMPTY, COLOUR_BROWN, WID_CV_GRAPH), SetMinimalSize(576, 224), SetFill(1, 1), SetResize(1, 1),
 
			NWidget(NWID_VERTICAL),
 
				NWidget(NWID_SPACER), SetFill(0, 1), SetResize(0, 1),
 
				NWidget(WWT_RESIZEBOX, COLOUR_BROWN, WID_CV_RESIZE),
 
				NWidget(WWT_RESIZEBOX, COLOUR_BROWN, WID_CV_RESIZE), SetDataTip(RWV_HIDE_BEVEL, STR_TOOLTIP_RESIZE),
 
			EndContainer(),
 
		EndContainer(),
 
	EndContainer(),
 
@@ -1089,7 +1089,7 @@ static const NWidgetPart _nested_cargo_p
 
			NWidget(NWID_SPACER), SetMinimalSize(12, 0), SetFill(1, 0), SetResize(1, 0),
 
			NWidget(WWT_TEXT, COLOUR_BROWN, WID_CPR_FOOTER), SetMinimalSize(0, 6), SetPadding(2, 0, 2, 0), SetDataTip(STR_GRAPH_CARGO_PAYMENT_RATES_X_LABEL, STR_NULL),
 
			NWidget(NWID_SPACER), SetFill(1, 0), SetResize(1, 0),
 
			NWidget(WWT_RESIZEBOX, COLOUR_BROWN, WID_CPR_RESIZE),
 
			NWidget(WWT_RESIZEBOX, COLOUR_BROWN, WID_CPR_RESIZE), SetDataTip(RWV_HIDE_BEVEL, STR_TOOLTIP_RESIZE),
 
		EndContainer(),
 
	EndContainer(),
 
};
src/network/network_content_gui.cpp
Show inline comments
 
@@ -1105,7 +1105,7 @@ static const NWidgetPart _nested_network
 
		/* Resize button. */
 
		NWidget(NWID_HORIZONTAL),
 
			NWidget(NWID_SPACER), SetFill(1, 0), SetResize(1, 0),
 
			NWidget(WWT_RESIZEBOX, COLOUR_LIGHT_BLUE),
 
			NWidget(WWT_RESIZEBOX, COLOUR_LIGHT_BLUE), SetDataTip(RWV_HIDE_BEVEL, STR_TOOLTIP_RESIZE),
 
		EndContainer(),
 
	EndContainer(),
 
};
src/network/network_gui.cpp
Show inline comments
 
@@ -936,7 +936,7 @@ static const NWidgetPart _nested_network
 
		/* Resize button. */
 
		NWidget(NWID_HORIZONTAL),
 
			NWidget(NWID_SPACER), SetFill(1, 0), SetResize(1, 0),
 
			NWidget(WWT_RESIZEBOX, COLOUR_LIGHT_BLUE),
 
			NWidget(WWT_RESIZEBOX, COLOUR_LIGHT_BLUE), SetDataTip(RWV_HIDE_BEVEL, STR_TOOLTIP_RESIZE),
 
		EndContainer(),
 
	EndContainer(),
 
};
src/newgrf_debug_gui.cpp
Show inline comments
 
@@ -1152,7 +1152,7 @@ static const NWidgetPart _nested_sprite_
 
		EndContainer(),
 
		NWidget(NWID_HORIZONTAL),
 
			NWidget(NWID_SPACER), SetFill(1, 0), SetResize(1, 0),
 
			NWidget(WWT_RESIZEBOX, COLOUR_GREY),
 
			NWidget(WWT_RESIZEBOX, COLOUR_GREY), SetDataTip(RWV_HIDE_BEVEL, STR_TOOLTIP_RESIZE),
 
		EndContainer(),
 
	EndContainer(),
 
};
src/newgrf_gui.cpp
Show inline comments
 
@@ -1963,7 +1963,7 @@ static const NWidgetPart _nested_newgrf_
 
		/* Resize button. */
 
		NWidget(NWID_HORIZONTAL),
 
			NWidget(NWID_SPACER), SetFill(1, 0), SetResize(1, 0),
 
			NWidget(WWT_RESIZEBOX, COLOUR_MAUVE),
 
			NWidget(WWT_RESIZEBOX, COLOUR_MAUVE), SetDataTip(RWV_HIDE_BEVEL, STR_TOOLTIP_RESIZE),
 
		EndContainer(),
 
	EndContainer(),
 
};
src/widget.cpp
Show inline comments
 
@@ -154,7 +154,7 @@ const WidgetDimensions WidgetDimensions:
 
	{20, 10, 20, 10},    ///< modalpopup
 
	{3, 3, 3, 3},        ///< picker
 
	{10, 8, 10, 8},      ///< sparse window padding
 
	{10, 8, 10, 1},      ///< resizable sparse window padding
 
	{10, 8, 10, 0},      ///< resizable sparse window padding
 
	1,                   ///< vsep_picker
 
	WD_PAR_VSEP_NORMAL,  ///< vsep_normal
 
	4,                   ///< vsep_sparse
 
@@ -777,10 +777,15 @@ static inline void DrawDebugBox(const Re
 
 * @param colour  Colour of the resize box.
 
 * @param at_left Resize box is at left-side of the window,
 
 * @param clicked Box is lowered.
 
 * @param bevel   Draw bevel iff set.
 
 */
 
static inline void DrawResizeBox(const Rect &r, Colours colour, bool at_left, bool clicked)
 
static inline void DrawResizeBox(const Rect &r, Colours colour, bool at_left, bool clicked, bool bevel)
 
{
 
	DrawFrameRect(r.left, r.top, r.right, r.bottom, colour, (clicked) ? FR_LOWERED : FR_NONE);
 
	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), _colour_gradient[colour][6]);
 
	}
 
	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));
 
}
 

	
 
@@ -2774,7 +2779,7 @@ NWidgetLeaf::NWidgetLeaf(WidgetType tp, 
 
		case WWT_RESIZEBOX:
 
			this->SetFill(0, 0);
 
			this->SetMinimalSize(WD_RESIZEBOX_WIDTH, 12);
 
			this->SetDataTip(STR_NULL, STR_TOOLTIP_RESIZE);
 
			this->SetDataTip(RWV_SHOW_BEVEL, STR_TOOLTIP_RESIZE);
 
			break;
 

	
 
		case WWT_CLOSEBOX:
 
@@ -3072,8 +3077,7 @@ void NWidgetLeaf::Draw(const Window *w)
 
			break;
 

	
 
		case WWT_RESIZEBOX:
 
			assert(this->widget_data == 0);
 
			DrawResizeBox(r, this->colour, this->pos_x < (w->width / 2), !!(w->flags & WF_SIZING));
 
			DrawResizeBox(r, this->colour, this->pos_x < (w->width / 2), !!(w->flags & WF_SIZING), this->widget_data == 0);
 
			break;
 

	
 
		case WWT_CLOSEBOX:
src/widget_type.h
Show inline comments
 
@@ -36,6 +36,12 @@ enum ArrowWidgetValues {
 
	AWV_RIGHT,    ///< Force the arrow to the right
 
};
 

	
 
/** WidgetData values for a resize box widget. */
 
enum ResizeWidgetValues {
 
	RWV_SHOW_BEVEL, ///< Bevel of resize box is shown.
 
	RWV_HIDE_BEVEL, ///< Bevel of resize box is hidden.
 
};
 

	
 
/**
 
 * Window widget types, nested widget types, and nested widget part types.
 
 */
0 comments (0 inline, 0 general)