- made transparent direct colors a compile-time opt-in since it appears to be non-standard

Sat, 14 Jun 2014 19:41:09 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Sat, 14 Jun 2014 19:41:09 +0300
changeset 801
f6abc9eb4217
parent 800
a1d9b7fff8f7
child 802
2e220b9083bf

- made transparent direct colors a compile-time opt-in since it appears to be non-standard

CMakeLists.txt file | annotate | diff | comparison | revisions
src/colorSelector.cc file | annotate | diff | comparison | revisions
--- a/CMakeLists.txt	Sat Jun 14 09:58:58 2014 +0300
+++ b/CMakeLists.txt	Sat Jun 14 19:41:09 2014 +0300
@@ -9,6 +9,8 @@
 find_package (Qt4 REQUIRED)
 find_package (OpenGL REQUIRED)
 
+option (TRANSPARENT_DIRECT_COLORS "Enables non-standard transparent direct colors" OFF)
+
 get_target_property (UPDATEREVISION_EXE updaterevision LOCATION)
 
 add_custom_target (revision_check ALL
@@ -105,6 +107,10 @@
 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -W -Wall")
 set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lGLU")
 
+if (TRANSPARENT_DIRECT_COLORS)
+	set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTRANSPARENT_DIRECT_COLORS")
+endif()
+
 # With clang, we need to set -Wno-deprecated since Qt headers seem to use the
 # register keyword which clang doesn't seem to like. It also appears that Qt
 # doesn't set Q_COMPILER_INITIALIZER_LISTS when compiling with clang? What's
--- a/src/colorSelector.cc	Sat Jun 14 09:58:58 2014 +0300
+++ b/src/colorSelector.cc	Sat Jun 14 19:41:09 2014 +0300
@@ -59,7 +59,12 @@
 	ui->viewport->setMaximumWidth (width);
 
 	connect (ui->directColor, SIGNAL (clicked (bool)), this, SLOT (chooseDirectColor()));
+
+#ifdef TRANSPARENT_DIRECT_COLORS
 	connect (ui->transparentDirectColor, SIGNAL (clicked (bool)), this, SLOT (transparentCheckboxClicked()));
+#else
+	ui->transparentDirectColor->hide();
+#endif
 
 	drawColorInfo();
 }
@@ -151,8 +156,14 @@
 	ui->colorLabel->setText (format ("%1 - %2", selection()->indexString(),
 		(selection()->isDirect() ? "<direct color>" : selection()->name())));
 	ui->iconLabel->setPixmap (makeColorIcon (selection(), 16).pixmap (16, 16));
+
+#ifdef TRANSPARENT_DIRECT_COLORS
 	ui->transparentDirectColor->setEnabled (selection()->isDirect());
 	ui->transparentDirectColor->setChecked (selection()->isDirect() && selection()->faceColor().alphaF() < 1.0);
+#else
+	ui->transparentDirectColor->setChecked (false);
+	ui->transparentDirectColor->setEnabled (false);
+#endif
 }
 
 // =============================================================================

mercurial