Changeset - r27824:c503500c92b2
[Not reviewed]
master
0 6 0
Richard Wheeler - 10 months ago 2023-08-25 14:04:40
2762690+zephyris@users.noreply.github.com
Feature: Transparency option for cost and income indicators (#11001)
6 files changed with 10 insertions and 10 deletions:
0 comments (0 inline, 0 general)
src/lang/english.txt
Show inline comments
 
@@ -2650,7 +2650,7 @@ STR_TRANSPARENT_BUILDINGS_TOOLTIP       
 
STR_TRANSPARENT_BRIDGES_TOOLTIP                                 :{BLACK}Toggle transparency for bridges. Ctrl+Click to lock
 
STR_TRANSPARENT_STRUCTURES_TOOLTIP                              :{BLACK}Toggle transparency for structures like lighthouses and antennas. Ctrl+Click to lock
 
STR_TRANSPARENT_CATENARY_TOOLTIP                                :{BLACK}Toggle transparency for catenary. Ctrl+Click to lock
 
STR_TRANSPARENT_LOADING_TOOLTIP                                 :{BLACK}Toggle transparency for loading indicators. Ctrl+Click to lock
 
STR_TRANSPARENT_TEXT_TOOLTIP                                    :{BLACK}Toggle transparency for loading and cost/income text. Ctrl+Click to lock
 
STR_TRANSPARENT_INVISIBLE_TOOLTIP                               :{BLACK}Set objects invisible instead of transparent
 

	
 
# Linkgraph legend window
src/texteff.cpp
Show inline comments
 
@@ -118,10 +118,10 @@ void DrawTextEffects(DrawPixelInfo *dpi)
 
{
 
	/* Don't draw the text effects when zoomed out a lot */
 
	if (dpi->zoom > ZOOM_LVL_OUT_8X) return;
 

	
 
	if (IsTransparencySet(TO_TEXT)) return;
 
	for (TextEffect &te : _text_effects) {
 
		if (te.string_id == INVALID_STRING_ID) continue;
 
		if (te.mode == TE_RISING || (_settings_client.gui.loading_indicators && !IsTransparencySet(TO_LOADING))) {
 
		if (te.mode == TE_RISING || _settings_client.gui.loading_indicators) {
 
			CopyInDParam(te.params);
 
			ViewportAddString(dpi, ZOOM_LVL_OUT_8X, &te, te.string_id, te.string_id - 1, STR_NULL);
 
		}
src/transparency.h
Show inline comments
 
@@ -28,7 +28,7 @@ enum TransparencyOption {
 
	TO_BRIDGES,    ///< bridges
 
	TO_STRUCTURES, ///< other objects such as transmitters and lighthouses
 
	TO_CATENARY,   ///< catenary
 
	TO_LOADING,    ///< loading indicators
 
	TO_TEXT,       ///< loading and cost/income text
 
	TO_END,
 
	TO_INVALID,    ///< Invalid transparency option
 
};
src/transparency_gui.cpp
Show inline comments
 
@@ -50,7 +50,7 @@ public:
 
			case WID_TT_BRIDGES:
 
			case WID_TT_STRUCTURES:
 
			case WID_TT_CATENARY:
 
			case WID_TT_LOADING: {
 
			case WID_TT_TEXT: {
 
				uint i = widget - WID_TT_BEGIN;
 
				if (HasBit(_transparency_lock, i)) DrawSprite(SPR_LOCK, PAL_NONE, r.left + WidgetDimensions::scaled.fullbevel.left, r.top + WidgetDimensions::scaled.fullbevel.top);
 
				break;
 
@@ -58,7 +58,7 @@ public:
 
			case WID_TT_BUTTONS: {
 
				const Rect fr = r.Shrink(WidgetDimensions::scaled.framerect);
 
				for (uint i = WID_TT_BEGIN; i < WID_TT_END; i++) {
 
					if (i == WID_TT_LOADING) continue; // Do not draw button for invisible loading indicators.
 
					if (i == WID_TT_TEXT) continue; // Loading and cost/income text has no invisibility button.
 

	
 
					const Rect wr = this->GetWidget<NWidgetBase>(i)->GetCurrentRect().Shrink(WidgetDimensions::scaled.fullbevel);
 
					DrawFrameRect(wr.left, fr.top, wr.right, fr.bottom, COLOUR_PALE_GREEN,
 
@@ -90,7 +90,7 @@ public:
 
					break;
 
				}
 
			}
 
			if (i == WID_TT_LOADING || i == WID_TT_END) return;
 
			if (i == WID_TT_TEXT|| i == WID_TT_END) return;
 

	
 
			ToggleInvisibility((TransparencyOption)(i - WID_TT_BEGIN));
 
			if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
 
@@ -140,7 +140,7 @@ static const NWidgetPart _nested_transpa
 
		NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_TT_BRIDGES), SetMinimalSize(43, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BRIDGE, STR_TRANSPARENT_BRIDGES_TOOLTIP),
 
		NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_TT_STRUCTURES), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_TRANSMITTER, STR_TRANSPARENT_STRUCTURES_TOOLTIP),
 
		NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_TT_CATENARY), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_BUILD_X_ELRAIL, STR_TRANSPARENT_CATENARY_TOOLTIP),
 
		NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_TT_LOADING), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_TRAINLIST, STR_TRANSPARENT_LOADING_TOOLTIP),
 
		NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_TT_TEXT), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_TRAINLIST, STR_TRANSPARENT_TEXT_TOOLTIP),
 
		NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetFill(1, 1), EndContainer(),
 
	EndContainer(),
 
	/* Panel with 'invisibility' buttons. */
src/widget.cpp
Show inline comments
 
@@ -2316,7 +2316,7 @@ void NWidgetViewport::Draw(const Window 
 

	
 
	if (this->disp_flags & ND_NO_TRANSPARENCY) {
 
		TransparencyOptionBits to_backup = _transparency_opt;
 
		_transparency_opt &= (1 << TO_SIGNS) | (1 << TO_LOADING); // Disable all transparency, except textual stuff
 
		_transparency_opt &= (1 << TO_SIGNS) | (1 << TO_TEXT); // Disable all transparency, except textual stuff
 
		w->DrawViewport();
 
		_transparency_opt = to_backup;
 
	} else {
src/widgets/transparency_widget.h
Show inline comments
 
@@ -22,7 +22,7 @@ enum TransparencyToolbarWidgets {
 
	WID_TT_BRIDGES,                  ///< Bridges transparency toggle button.
 
	WID_TT_STRUCTURES,               ///< Object structure transparency toggle button.
 
	WID_TT_CATENARY,                 ///< Catenary transparency toggle button.
 
	WID_TT_LOADING,                  ///< Loading indicators transparency toggle button.
 
	WID_TT_TEXT,                     ///< Loading and cost/income text transparency toggle button.
 
	WID_TT_END,                      ///< End of toggle buttons.
 

	
 
	/* Panel with buttons for invisibility */
0 comments (0 inline, 0 general)