- added a configurable select color

Mon, 23 Dec 2013 16:29:44 +0200

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Mon, 23 Dec 2013 16:29:44 +0200
changeset 593
108d7d21e155
parent 592
d3cf7a23bb59
child 594
d9feccafcbf7

- added a configurable select color

changelog.txt file | annotate | diff | comparison | revisions
src/configDialog.cc file | annotate | diff | comparison | revisions
src/configDialog.h file | annotate | diff | comparison | revisions
src/gldraw.cc file | annotate | diff | comparison | revisions
ui/config.ui file | annotate | diff | comparison | revisions
--- a/changelog.txt	Mon Dec 23 16:16:45 2013 +0200
+++ b/changelog.txt	Mon Dec 23 16:29:44 2013 +0200
@@ -44,6 +44,8 @@
 - When adding edges with Intersector (which is done with Isecalc), the user is prompted for Isecalc's
 	path now as well if necessary instead of just ignoring it and not adding the edgelines.
 - Added a configuration option for line anti-aliasing.
+- Added a configurable selected color to blend to objects when they are selected, instead of a simple
+	light-up. Defaults to a blue color.
 - BFC red/green view and black edges no longer default to true.
 - When the background is dark, the "black edges" option actually means "white edges" now.
 - If the vertex snapper finds a vertex closer than 4 pixels, it likely is the vertex being looked for
--- a/src/configDialog.cc	Mon Dec 23 16:16:45 2013 +0200
+++ b/src/configDialog.cc	Mon Dec 23 16:29:44 2013 +0200
@@ -59,6 +59,7 @@
 extern_cfg (String, ld_defaultname);
 extern_cfg (String, ld_defaultuser);
 extern_cfg (Int, ld_defaultlicense);
+extern_cfg (String, gl_selectcolor);
 extern_cfg (String, prog_ytruder);
 extern_cfg (String, prog_rectifier);
 extern_cfg (String, prog_intersector);
@@ -97,6 +98,10 @@
 	connect (ui->mainColorButton, SIGNAL (clicked()),
 			 this, SLOT (slot_setGLForeground()));
 
+	setButtonBackground (ui->selColorButton, gl_selectcolor);
+	connect (ui->selColorButton, SIGNAL (clicked()),
+			 this, SLOT (slot_setGLSelectColor()));
+
 	ui->mainColorAlpha->setValue (gl_maincolor_alpha * 10.0f);
 	ui->lineThickness->setValue (gl_linethickness);
 	ui->colorizeObjects->setChecked (lv_colorize);
@@ -532,6 +537,12 @@
 }
 
 // =============================================================================
+// -----------------------------------------------------------------------------
+void ConfigDialog::slot_setGLSelectColor()
+{	pickColor (gl_selectcolor, ui->selColorButton);
+}
+
+// =============================================================================
 // Sets background color of a given button.
 // -----------------------------------------------------------------------------
 void ConfigDialog::setButtonBackground (QPushButton* button, str value)
--- a/src/configDialog.h	Mon Dec 23 16:16:45 2013 +0200
+++ b/src/configDialog.h	Mon Dec 23 16:29:44 2013 +0200
@@ -80,6 +80,7 @@
 	private slots:
 		void slot_setGLBackground();
 		void slot_setGLForeground();
+		void slot_setGLSelectColor();
 		void slot_setShortcut();
 		void slot_resetShortcut();
 		void slot_clearShortcut();
--- a/src/gldraw.cc	Mon Dec 23 16:16:45 2013 +0200
+++ b/src/gldraw.cc	Mon Dec 23 16:29:44 2013 +0200
@@ -59,6 +59,7 @@
 cfg (String,	gl_bgcolor,				"#FFFFFF")
 cfg (String,	gl_maincolor,			"#A0A0A0")
 cfg (Float,		gl_maincolor_alpha,	1.0)
+cfg (String,	gl_selectcolor,		"#0080FF")
 cfg (Int,		gl_linethickness,		2)
 cfg (Bool,		gl_colorbfc,			false)
 cfg (Int,		gl_camera,				GLRenderer::EFreeCamera)
@@ -336,18 +337,17 @@
 		}
 	}
 
-	long r = qcol.red(),
+	int r = qcol.red(),
 		 g = qcol.green(),
 		 b = qcol.blue(),
 		 a = qcol.alpha();
 
 	if (obj->topLevelParent()->isSelected())
 	{	// Brighten it up for the select list.
-		const uchar add = 51;
-
-		r = min (r + add, 255l);
-		g = min (g + add, 255l);
-		b = min (b + add, 255l);
+		QColor selcolor (gl_selectcolor);
+		r = (r + selcolor.red()) / 2;
+		g = (g + selcolor.green()) / 2;
+		b = (b + selcolor.blue()) / 2;
 	}
 
 	glColor4f (
--- a/ui/config.ui	Mon Dec 23 16:16:45 2013 +0200
+++ b/ui/config.ui	Mon Dec 23 16:29:44 2013 +0200
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>717</width>
-    <height>328</height>
+    <height>359</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -146,6 +146,27 @@
                </widget>
               </item>
               <item row="2" column="0">
+               <widget class="QLabel" name="selectedColorLabel">
+                <property name="text">
+                 <string>Selected Color</string>
+                </property>
+               </widget>
+              </item>
+              <item row="2" column="1">
+               <widget class="QPushButton" name="selColorButton">
+                <property name="whatsThis">
+                 <string>This color is used for the main color.</string>
+                </property>
+                <property name="text">
+                 <string/>
+                </property>
+                <property name="icon">
+                 <iconset resource="../ldforge.qrc">
+                  <normaloff>:/icons/colorselect.png</normaloff>:/icons/colorselect.png</iconset>
+                </property>
+               </widget>
+              </item>
+              <item row="3" column="0">
                <widget class="QLabel" name="label_2">
                 <property name="whatsThis">
                  <string/>
@@ -155,7 +176,7 @@
                 </property>
                </widget>
               </item>
-              <item row="2" column="1">
+              <item row="3" column="1">
                <widget class="QPushButton" name="backgroundColorButton">
                 <property name="whatsThis">
                  <string>This is the background color for the viewport.</string>

mercurial