[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [unclassified] patch for color_properties assignment
From: |
Kai Habel |
Subject: |
Re: [unclassified] patch for color_properties assignment |
Date: |
Wed, 08 Aug 2007 11:47:35 +0000 |
User-agent: |
IceDove 1.5.0.12 (X11/20070607) |
John W. Eaton schrieb:
I'm now confused about the patches in this thread and the
"problem with radio values in color_property" thread. Which ones are
needed? Am I missing any other patches for graphics?
Thanks,
jwe
I think there is still one problem unsolved. Here is the relevant part
of the discussion
(http://www.nabble.com/patch-for-color_properties-assignment-tf4041176.html)
Another problem is the radio_values::validate method. In your patch you
check first for valid radio values:
if (radio_val.validate (s))
+ {
+ current_val = s;
+ current_type = radio_t;
+ }
+ else
+ {
+ color_values col (s);
+ if (! error_state)
+ {
+ color_val = col;
+ current_type = color_t;
+ }
+ else
+ error ("invalid color specification");
+ }
but if 's' is a string color value (e.g. 'r' or 'red') validate calls
the error function and sets the error flag. This causes an error message
and octave terminates. I have turned off the error call in
radio_values::validate for test purposes. Then the creation of a line
object with:
h=__go_line__ (gca);
works as expected.
I think the issue here is that validate raises an error. I will send a
patch which will overcome this (e,g, replace radio_val.validate (s)
with
radio_val.possible_vals.find (val) != radio_val.possible_vals.end ()
I have tried to replace "radio_val.validate (s)" with
"radio_val.possible_vals.find (val) != radio_val.possible_vals.end ()"
for the operator
color_property&
color_property::operator = (const octave_value& val)
(line 187 of graphics.cc), but this causes an compilation error:
g++ -c -fPIC -I. -I.. -I../liboctave -I../src -I../libcruft/misc
-DHAVE_CONFIG_H -mieee-fp -Wall -W -Wshadow -Wold-style-cast -g -O2
graphics.cc -o pic/graphics.o
graphics.h: In member function 'color_property&
color_property::operator=(const octave_value&)':
graphics.h:112: error: 'std::set<std::basic_string<char,
std::char_traits<char>, std::allocator<char> >,
std::less<std::basic_string<char, std::char_traits<char>,
std::allocator<char> > >, std::allocator<std::basic_string<char,
std::char_traits<char>, std::allocator<char> > > >
radio_values::possible_vals' is private
(Please note I use a modified graphics.h, the line 112 refers to
std::set<std::string> possible_vals;)
I don't know if some 'friend' magic would help here. Another solution
is to have an addtional radio_values::__validate__() function without
this error() call.
I don't know how to proceed here, any suggestions?
Kai
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [unclassified] patch for color_properties assignment,
Kai Habel <=