[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Graphics properties implementation
From: |
John W. Eaton |
Subject: |
Graphics properties implementation |
Date: |
Sat, 12 Jan 2008 03:39:26 -0500 |
On 11-Jan-2008, Michael Goffioul wrote:
| I finally succeeded to get a working version of the graphics system
| with typed property classes. The (rather long) patch is in attachment.
| As far as I could test, it seems to work OK, except some glitches
| (see below). It's probably not perfect and I'm sure some adaptation
| will be needed, but I think it's a good start and a candidate for
| initial commit.
OK, I applied the patch and checked it in. I needed the attached
changes to get a clean compile of graphics.cc. Most of the changes
had to do with the GCC warning option -Wshadow.
Was there some reason to omit the name handle arguments in some of the
calls to the base_property constructor? I added them, but if there
were intentionally omitted, I can undo that part of my patch.
I think graphics-props.cc should appear in the Makefile somewhere as a
dependency.
I wrote a (very) short ChangeLog entry. It might help to have
slightly more detail there.
Thanks,
jwe
Index: src/graphics.cc
===================================================================
RCS file: /cvs/octave/src/graphics.cc,v
retrieving revision 1.67
diff -u -u -r1.67 graphics.cc
--- src/graphics.cc 12 Jan 2008 08:21:57 -0000 1.67
+++ src/graphics.cc 12 Jan 2008 08:33:28 -0000
@@ -267,7 +267,7 @@
bool
array_property::validate (const octave_value& v)
{
- bool ok = false;
+ bool xok = false;
// FIXME: should we always support []?
if (v.is_empty () && v.is_double_type ())
@@ -277,41 +277,41 @@
if (type_constraints.size () > 0)
{
for (std::list<std::string>::const_iterator it = type_constraints.begin
();
- ! ok && it != type_constraints.end (); ++it)
+ ! xok && it != type_constraints.end (); ++it)
if ((*it) == v.type_name ())
- ok = true;
+ xok = true;
}
else
- ok = v.is_double_type ();
+ xok = v.is_double_type ();
- if (ok)
+ if (xok)
{
dim_vector vdims = v.dims ();
int vlen = vdims.length ();
- ok = false;
+ xok = false;
// check value size
if (size_constraints.size () > 0)
for (std::list<dim_vector>::const_iterator it = size_constraints.begin
();
- ! ok && it != size_constraints.end (); ++it)
+ ! xok && it != size_constraints.end (); ++it)
{
dim_vector itdims = (*it);
if (itdims.length () == vlen)
{
- ok = true;
+ xok = true;
- for (int i = 0; ok && i < vlen; i++)
+ for (int i = 0; xok && i < vlen; i++)
if (itdims(i) >= 0 && itdims(i) != vdims(i))
- ok = false;
+ xok = false;
}
}
else
return true;
}
- return ok;
+ return xok;
}
void
@@ -335,7 +335,7 @@
}
bool
-callback_property::validate (const octave_value& v) const
+callback_property::validate (const octave_value&) const
{
// FIXME: implement this
return true;
@@ -1180,10 +1180,10 @@
xticklabelmode = "auto";
yticklabelmode = "auto";
zticklabelmode = "auto";
- color = octave_value (color_values (0, 0, 0));
- xcolor = octave_value (color_values ("black"));
- ycolor = octave_value (color_values ("black"));
- zcolor = octave_value (color_values ("black"));
+ color = color_values (0, 0, 0);
+ xcolor = color_values ("black");
+ ycolor = color_values ("black");
+ zcolor = color_values ("black");
xscale = "linear";
yscale = "linear";
zscale = "linear";
Index: src/graphics.h.in
===================================================================
RCS file: /cvs/octave/src/graphics.h.in,v
retrieving revision 1.29
diff -u -u -r1.29 graphics.h.in
--- src/graphics.h.in 12 Jan 2008 08:21:57 -0000 1.29
+++ src/graphics.h.in 12 Jan 2008 08:33:28 -0000
@@ -214,7 +214,7 @@
void set_hidden (bool flag) { hidden = flag; }
- virtual void set (const octave_value& val)
+ virtual void set (const octave_value&)
{ error ("set: invalid property \"%s\"", name.c_str ()); }
virtual octave_value get (void) const
@@ -322,19 +322,19 @@
class radio_property : public base_property
{
public:
- radio_property (const std::string& name, const graphics_handle& h,
+ radio_property (const std::string& nm, const graphics_handle& h,
const radio_values& v = radio_values ())
- : base_property (name, h),
+ : base_property (nm, h),
vals (v), current_val (v.default_value ()) { }
- radio_property (const std::string& name, const graphics_handle& h,
+ radio_property (const std::string& nm, const graphics_handle& h,
const std::string& v)
- : base_property (name, h),
+ : base_property (nm, h),
vals (v), current_val (vals.default_value ()) { }
- radio_property (const std::string& name, const graphics_handle& h,
+ radio_property (const std::string& nm, const graphics_handle& h,
const radio_values& v, const std::string& def)
- : base_property (name, h),
+ : base_property (nm, h),
vals (v), current_val (def) { }
radio_property (const radio_property& p)
@@ -439,31 +439,31 @@
current_val (v.default_value ())
{ }
- color_property (const std::string& name, const graphics_handle& h,
+ color_property (const std::string& nm, const graphics_handle& h,
const color_values& c = color_values (),
const radio_values& v = radio_values ())
- : base_property (name, h),
+ : base_property (nm, h),
current_type (color_t), color_val (c), radio_val (v),
current_val (v.default_value ())
{ }
- color_property (const std::string& name, const graphics_handle& h,
+ color_property (const std::string& nm, const graphics_handle& h,
const radio_values& v)
- : base_property (name, h),
+ : base_property (nm, h),
current_type (radio_t), color_val (color_values ()), radio_val (v),
current_val (v.default_value ())
{ }
- color_property (const std::string& name, const graphics_handle& h,
+ color_property (const std::string& nm, const graphics_handle& h,
const std::string& v)
- : base_property (name, h),
+ : base_property (nm, h),
current_type (radio_t), color_val (color_values ()), radio_val (v),
current_val (radio_val.default_value ())
{ }
- color_property (const std::string& name, const graphics_handle& h,
+ color_property (const std::string& nm, const graphics_handle& h,
const color_property& v)
- : base_property (name, h),
+ : base_property (nm, h),
current_type (v.current_type), color_val (v.color_val),
radio_val (v.radio_val), current_val (v.current_val)
{ }
@@ -526,9 +526,9 @@
class double_property : public base_property
{
public:
- double_property (const std::string& name, const graphics_handle& h,
+ double_property (const std::string& nm, const graphics_handle& h,
double d = 0)
- : base_property (name, h),
+ : base_property (nm, h),
current_val (d) { }
double_property (const double_property& p)
@@ -562,9 +562,9 @@
class array_property : public base_property
{
public:
- array_property (const std::string& name, const graphics_handle& h,
+ array_property (const std::string& nm, const graphics_handle& h,
const octave_value& m)
- : base_property (), data (m) { }
+ : base_property (nm, h), data (m) { }
octave_value get (void) const { return data; }
@@ -606,17 +606,17 @@
data_property (void)
: base_property ("", graphics_handle ()) { }
- data_property (const std::string& name, const graphics_handle& h,
+ data_property (const std::string& nm, const graphics_handle& h,
const NDArray& m = NDArray ())
- : base_property (name, h),
+ : base_property (nm, h),
data (m), xmin (octave_Inf), xmax (-octave_Inf), xminp (octave_Inf)
{
get_data_limits ();
}
- data_property (const std::string& name, const graphics_handle& h,
+ data_property (const std::string& nm, const graphics_handle& h,
const Matrix& m)
- : base_property (name, h),
+ : base_property (nm, h),
data (m), xmin (octave_Inf), xmax (-octave_Inf), xminp (octave_Inf)
{
get_data_limits ();
@@ -688,14 +688,14 @@
class bool_property : public radio_property
{
public:
- bool_property (const std::string& name, const graphics_handle& h,
+ bool_property (const std::string& nm, const graphics_handle& h,
bool val)
- : radio_property (name, h, radio_values (val ? "{on}|off" : "on|{off}"))
+ : radio_property (nm, h, radio_values (val ? "{on}|off" : "on|{off}"))
{ }
- bool_property (const std::string& name, const graphics_handle& h,
+ bool_property (const std::string& nm, const graphics_handle& h,
const char* val)
- : radio_property (name, h, radio_values ("on|off"), val)
+ : radio_property (nm, h, radio_values ("on|off"), val)
{ }
bool_property (const bool_property& p)
@@ -723,9 +723,9 @@
class handle_property : public base_property
{
public:
- handle_property (const std::string& name, const graphics_handle& h,
+ handle_property (const std::string& nm, const graphics_handle& h,
const graphics_handle& val = graphics_handle ())
- : base_property (name, h),
+ : base_property (nm, h),
current_val (val) { }
handle_property (const handle_property& p)
@@ -758,9 +758,9 @@
class any_property : public base_property
{
public:
- any_property (const std::string& name, const graphics_handle& h,
+ any_property (const std::string& nm, const graphics_handle& h,
const octave_value& m = Matrix ())
- : base_property (), data (m) { }
+ : base_property (nm, h), data (m) { }
octave_value get (void) const { return data; }
@@ -781,9 +781,9 @@
class callback_property : public base_property
{
public:
- callback_property (const std::string& name, const graphics_handle& h,
+ callback_property (const std::string& nm, const graphics_handle& h,
const octave_value& m)
- : base_property (), callback (m) { }
+ : base_property (nm, h), callback (m) { }
octave_value get (void) const { return callback; }
- Graphics properties implementation, Michael Goffioul, 2008/01/11
- Re: Graphics properties implementation, David Bateman, 2008/01/11
- Re: Graphics properties implementation, Shai Ayal, 2008/01/12
- Graphics properties implementation,
John W. Eaton <=
- Re: Graphics properties implementation, Michael Goffioul, 2008/01/12
- Re: Graphics properties implementation, Michael Goffioul, 2008/01/12
- Re: Graphics properties implementation, Shai Ayal, 2008/01/12
- Re: Graphics properties implementation, Michael Goffioul, 2008/01/12
- Re: Graphics properties implementation, John W. Eaton, 2008/01/12
- Re: Graphics properties implementation, Michael Goffioul, 2008/01/12
- Re: Graphics properties implementation, Shai Ayal, 2008/01/12
- Re: Graphics properties implementation, Michael Goffioul, 2008/01/15
- Re: Graphics properties implementation, John W. Eaton, 2008/01/15
- Re: Graphics properties implementation, Shai Ayal, 2008/01/12