mirror of https://github.com/OpenTTD/OpenTTD.git
Feature: Transparency option for cost and income indicators (#11001)
This commit is contained in:
parent
a938067d6b
commit
96fdfb941a
|
@ -2650,7 +2650,7 @@ STR_TRANSPARENT_BUILDINGS_TOOLTIP :{BLACK}Toggle t
|
|||
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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
};
|
||||
|
|
|
@ -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_transparency_widgets[] = {
|
|||
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. */
|
||||
|
|
|
@ -2316,7 +2316,7 @@ void NWidgetViewport::Draw(const Window *w)
|
|||
|
||||
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 {
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue