Index: src/dock_gui.cpp =================================================================== --- src/dock_gui.cpp (revision 27772) +++ src/dock_gui.cpp (working copy) @@ -27,6 +27,7 @@ #include "hotkeys.h" #include "gui.h" #include "zoom_func.h" +#include "transparency.h" #include "widgets/dock_widget.h" @@ -403,11 +404,14 @@ { this->InitNested(TRANSPORT_WATER); this->LowerWidget(_settings_client.gui.station_show_coverage + BDSW_LT_OFF); + StartTempTransparency(); } virtual ~BuildDocksStationWindow() { + DeleteWindowById(WC_SELECT_STATION, 0); + StopTempTransparency(); } virtual void OnPaint() Index: src/transparency.h =================================================================== --- src/transparency.h (revision 27772) +++ src/transparency.h (working copy) @@ -37,7 +37,9 @@ typedef uint TransparencyOptionBits; ///< transparency option bits extern TransparencyOptionBits _transparency_opt; +extern TransparencyOptionBits _transparency_opt_tmp; extern TransparencyOptionBits _transparency_lock; +extern TransparencyOptionBits _transparency_lock_tmp; extern TransparencyOptionBits _invisibility_opt; extern byte _display_opt; @@ -71,6 +73,7 @@ static inline void ToggleTransparency(TransparencyOption to) { ToggleBit(_transparency_opt, to); + if (_transparency_opt_tmp != NULL) ToggleBit(_transparency_opt_tmp, to); } /** @@ -109,6 +112,7 @@ static inline void ToggleTransparencyLock(TransparencyOption to) { ToggleBit(_transparency_lock, to); + if (_transparency_lock_tmp != NULL) ToggleBit(_transparency_lock_tmp, to); } /** Set or clear all non-locked transparency options */ @@ -126,4 +130,30 @@ MarkWholeScreenDirty(); } +/** + * Temporarily store transparency options and locks for later + * restoration and set all non-locked transparency options. + */ +static inline void StartTempTransparency() +{ + _transparency_opt_tmp = _transparency_opt; + _transparency_lock_tmp = _transparency_opt_tmp | _transparency_lock; + _transparency_opt |= GB(~_transparency_lock_tmp, 0, TO_END); + + MarkWholeScreenDirty(); +} + +/** + * Restore transparency options and clear temporary + * transparency options and locks. + */ +static inline void StopTempTransparency() +{ + _transparency_opt &= _transparency_lock_tmp; + _transparency_opt_tmp = NULL; + _transparency_lock_tmp = NULL; + + MarkWholeScreenDirty(); +} + #endif /* TRANSPARENCY_H */ Index: src/transparency_gui.cpp =================================================================== --- src/transparency_gui.cpp (revision 27772) +++ src/transparency_gui.cpp (working copy) @@ -22,9 +22,11 @@ #include "safeguards.h" -TransparencyOptionBits _transparency_opt; ///< The bits that should be transparent. -TransparencyOptionBits _transparency_lock; ///< Prevent these bits from flipping with X. -TransparencyOptionBits _invisibility_opt; ///< The bits that should be invisible. +TransparencyOptionBits _transparency_opt; ///< The bits that should be transparent. +TransparencyOptionBits _transparency_opt_tmp = NULL; ///< Temporary bits that should be transparent while building. +TransparencyOptionBits _transparency_lock; ///< Prevent these bits from flipping with X. +TransparencyOptionBits _transparency_lock_tmp = NULL; ///< Prevent temporary bits from flipping while building. +TransparencyOptionBits _invisibility_opt; ///< The bits that should be invisible. byte _display_opt; ///< What do we want to draw/do? class TransparenciesWindow : public Window