summaryrefslogtreecommitdiff
path: root/src/transparency_gui.cpp
diff options
context:
space:
mode:
authormaedhros <maedhros@openttd.org>2008-02-10 14:49:44 +0000
committermaedhros <maedhros@openttd.org>2008-02-10 14:49:44 +0000
commit4e839aacf650f65cd8aeeece91fa038b3c68ffdb (patch)
tree9f2fca07965bf4aafc72cfaa9e2264d08d5c0ec1 /src/transparency_gui.cpp
parente075cf550033b68dbfba0c60988943e23a252ccc (diff)
downloadopenttd-4e839aacf650f65cd8aeeece91fa038b3c68ffdb.tar.xz
(svn r12102) -Feature: Allow locking individual transparency settings so they will not be changed by pressing 'x'. (Roujin)
Diffstat (limited to 'src/transparency_gui.cpp')
-rw-r--r--src/transparency_gui.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/transparency_gui.cpp b/src/transparency_gui.cpp
index 33c21d078..b33003f9e 100644
--- a/src/transparency_gui.cpp
+++ b/src/transparency_gui.cpp
@@ -12,12 +12,10 @@
#include "table/strings.h"
TransparencyOptionBits _transparency_opt;
+TransparencyOptionBits _transparency_lock;
enum TransparencyToolbarWidgets{
- /* Widgets not toggled when pressing the X key */
TTW_WIDGET_SIGNS = 3, ///< Make signs background transparent
-
- /* Widgets toggled when pressing the X key */
TTW_WIDGET_TREES, ///< Make trees transparent
TTW_WIDGET_HOUSES, ///< Make houses transparent
TTW_WIDGET_INDUSTRIES, ///< Make Industries transparent
@@ -39,14 +37,23 @@ static void TransparencyToolbWndProc(Window *w, WindowEvent *e)
}
DrawWindowWidgets(w);
+ for (uint i = TO_SIGNS; i < TO_END; i++) {
+ if (HasBit(_transparency_lock, i)) DrawSprite(SPR_LOCK, PAL_NONE, w->widget[TTW_WIDGET_SIGNS + i].left + 1, w->widget[TTW_WIDGET_SIGNS + i].top + 1);
+ }
break;
case WE_CLICK:
if (e->we.click.widget >= TTW_WIDGET_SIGNS) {
- /* toggle the bit of the transparencies variable when clicking on a widget, and play a sound */
- ToggleTransparency((TransparencyOption)(e->we.click.widget - TTW_WIDGET_SIGNS));
- SndPlayFx(SND_15_BEEP);
- MarkWholeScreenDirty();
+ if (_ctrl_pressed) {
+ /* toggle the bit of the transparencies lock variable */
+ ToggleTransparencyLock((TransparencyOption)(e->we.click.widget - TTW_WIDGET_SIGNS));
+ SetWindowDirty(w);
+ } else {
+ /* toggle the bit of the transparencies variable and play a sound */
+ ToggleTransparency((TransparencyOption)(e->we.click.widget - TTW_WIDGET_SIGNS));
+ SndPlayFx(SND_15_BEEP);
+ MarkWholeScreenDirty();
+ }
}
break;
}