diff src/graphics.cc @ 13236:8bb526fb3349

allow radio values for graphics properaties to be abbreviated * grahpics.h.in (radio_values::validate): New argument to return matched value. (radio_values::contains (const std::string&)): New argument to return matched value. (radio_property::do_set): Accept abbreviated value names but set to full name of one of the possible values if a match is found. * graphics.cc (color_property::do_set): Likewise. (double_radio_property::do_set): Likewise.
author John W. Eaton <jwe@octave.org>
date Tue, 27 Sep 2011 02:06:41 -0400
parents 78744376463a
children e36c2f4ea8f5
line wrap: on
line diff
--- a/src/graphics.cc	Tue Sep 27 02:06:25 2011 -0400
+++ b/src/graphics.cc	Tue Sep 27 02:06:41 2011 -0400
@@ -926,11 +926,13 @@
 
       if (! s.empty ())
         {
-          if (radio_val.contains (s))
+          std::string match;
+
+          if (radio_val.contains (s, match))
             {
-              if (current_type != radio_t || current_val != s)
+              if (current_type != radio_t || match != current_val)
                 {
-                  current_val = s;
+                  current_val = match;
                   current_type = radio_t;
                   return true;
                 }
@@ -990,10 +992,11 @@
   if (val.is_string ())
     {
       std::string s = val.string_value ();
-
-      if (! s.empty () && radio_val.contains (s))
-        {
-          if (current_type != radio_t || s != current_val)
+      std::string match;
+
+      if (! s.empty () && radio_val.contains (s, match))
+        {
+          if (current_type != radio_t || match != current_val)
             {
               current_val = s;
               current_type = radio_t;