diff src/graphics.cc @ 6925:1401a79af68c

[project @ 2007-09-26 18:58:52 by dbateman]
author dbateman
date Wed, 26 Sep 2007 18:58:53 +0000
parents f4e1bdb66535
children 688ef9440022
line wrap: on
line diff
--- a/src/graphics.cc	Tue Sep 25 19:08:20 2007 +0000
+++ b/src/graphics.cc	Wed Sep 26 18:58:53 2007 +0000
@@ -90,9 +90,12 @@
   bool retval = true;
   unsigned int len = str.length();
 
+  std::transform (str.begin (), str.end (), str.begin (), tolower);
+
   if (str.compare(0, len, "blue", 0, len) == 0)
     tmp_rgb[2] = 1;
-  else if (str.compare(0, len, "black", 0, len) == 0 || str.compare(0, len, "w", 0, len) == 0)
+  else if (str.compare(0, len, "black", 0, len) == 0 || 
+	   str.compare(0, len, "k", 0, len) == 0)
     tmp_rgb[0] = tmp_rgb[1] = tmp_rgb[2] = 0;
   else if (str.compare(0, len, "red", 0, len) == 0)
     tmp_rgb[0] = 1;
@@ -104,7 +107,8 @@
     tmp_rgb[0] = tmp_rgb[2] = 1;
   else if (str.compare(0, len, "cyan", 0, len) == 0)
     tmp_rgb[1] = tmp_rgb[2] = 1;
-  else if (str.compare(0, len, "white", 0, len) == 0)
+  else if (str.compare(0, len, "white", 0, len) == 0 ||
+	   str.compare(0, len, "w", 0, len) == 0)
     tmp_rgb[0] = tmp_rgb[1] = tmp_rgb[2] = 1;
   else	
     retval = false;
@@ -118,8 +122,8 @@
   return retval;
 }
 
-color_property::color_property (const octave_value& val)
-  : radio_val (), current_val ()
+color_property::color_property (const octave_value& val, const radio_values &v)
+  : radio_val (v), current_val ()
 {
   // FIXME -- need some error checking here.
 
@@ -129,11 +133,19 @@
 
       if (! s.empty ())
 	{
-	  color_values col (s);
-	  if (! error_state)
+	  if (radio_val.contains (s))
+	    {
+	      current_val = s;
+	      current_type = radio_t;
+	    }
+          else
 	    {
-	      color_val = col;
-	      current_type = color_t;
+	      color_values col (s);
+	      if (! error_state)
+		{
+		  color_val = col;
+		  current_type = color_t;
+		}
 	    }
 	}
       else
@@ -2119,7 +2131,7 @@
   else if (name.compare ("zdata"))
     set_zdata (val);
   else if (name.compare ("facecolor"))
-    set_facecolor (val);
+    set_facecolor (color_property (val, radio_values ("flat|none|interp")));
   else if (name.compare ("facealpha"))
     set_facealpha (val);
   else if (name.compare ("edgecolor"))