# HG changeset patch # User jwe # Date 1200723033 0 # Node ID 135c13496fafcce605b9e556e1731b0871646b2d # Parent bd58dafaf10230ff69c58576edebd68396cb4660 [project @ 2008-01-19 06:06:46 by jwe] diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,27 @@ +2008-01-19 Michael Goffioul + + * graphics.h.in (base_properties::beingdeleted, + base_properties::is_beingdeleted, + base_properties::get_beingdeleted, + base_properties::set_beingdeleted): + Add beingdeleted property and accessors. + * graphics.cc (base_properties::get): Likewise. + (gh_manager::free): Set beingdeleted to "on" when freeing an object. + * genprops.awk: Skip C++-style comments in property declaration. + + * graphics.h.in (class axes::properties): New properties: alim, + alimmode, xminortick, yminortick, zminortick, ambientlightcolor, + cameraposition, cameratarget, cameraupvector, cameraviewangle, + camerapositionmode, cameratargetmode, cameraupvectormode, + cameraviewanglemode, currentpoint, drawmode, fontangle, fontname, + fontsize, fontweight, fontunits, gridlinestyle, + minorgridlinestyle, linestyleorder, linewidth, plotboxaspectratio, + plotboxaspectratiomode, projection, tickdir, tickdirmode, + ticklength, tightinset, units, x_viewtransform, + x_projectiontransform, x_viewporttransform, x_normrendertransform, + x_rendertransform. + * genprops.awk: Handle new readonly modifier 'r'. + 2008-01-18 Juhani Saastamoinen * genprops.awk: Avoid using "default" as a variable name. diff --git a/src/genprops.awk b/src/genprops.awk --- a/src/genprops.awk +++ b/src/genprops.awk @@ -342,8 +342,9 @@ for (i = 1; i <= idx; i++) { - printf (" %sif (name.compare (\"%s\"))\n set_%s (val);\n", - (i > 1 ? "else " : ""), name[i], name[i]) >> filename; + if (! readonly[i]) + printf (" %sif (name.compare (\"%s\"))\n set_%s (val);\n", + (i > 1 ? "else " : ""), name[i], name[i]) >> filename; } printf (" else\n base_properties::set (name, val);\n}\n\n") >> filename; @@ -439,7 +440,7 @@ { if (gather) { - if (NF < 2) + if (NF < 2 || /^[ \t]*\/\//) next; idx++; @@ -459,7 +460,8 @@ limits[idx] = 0; mode[idx] = 0; - hidden[idx] = 0; + hidden[idx] = 0; + readonly[idx] = 0; emit_get[idx] = "definition"; emit_set[idx] = "definition"; defval[idx] = ""; @@ -500,9 +502,13 @@ if (index (quals, "S")) emit_set[idx] = "declaration"; - ## The property is hidden - if (index (quals, "h")) - hidden[idx] = 1; + ## The property is hidden + if (index (quals, "h")) + hidden[idx] = 1; + + ## The property is read-only + if (index (quals, "r")) + readonly[idx] = 1; ## ## emmit an asignment set function ## if (index (quals, "a")) diff --git a/src/graphics.cc b/src/graphics.cc --- a/src/graphics.cc +++ b/src/graphics.cc @@ -682,7 +682,8 @@ if (p != handle_map.end ()) { - p->second.get_properties ().execute_deletefcn (); + p->second.get_properties ().set_beingdeleted (true); + p->second.get_properties ().execute_deletefcn (); handle_map.erase (p); @@ -940,6 +941,8 @@ retval = get_userdata (); else if (name.compare ("visible")) retval = get_visible (); + else if (name.compare ("beingdeleted")) + retval = get_beingdeleted (); else { std::map::const_iterator it = all_props.find (name); @@ -982,6 +985,7 @@ m.assign ("uicontextmenu", get_uicontextmenu ()); m.assign ("userdata", get_userdata ()); m.assign ("visible", get_visible ()); + m.assign ("beingdeleted", get_beingdeleted ()); return m; } diff --git a/src/graphics.h.in b/src/graphics.h.in --- a/src/graphics.h.in +++ b/src/graphics.h.in @@ -981,7 +981,8 @@ selectionhighlight ("selectionhighlight", mh, true), uicontextmenu ("uicontextmenu", mh, graphics_handle ()), userdata ("userdata", mh, Matrix ()), - visible ("visible", mh, true) + visible ("visible", mh, true), + beingdeleted ("beingdeleted", mh, false) { } virtual ~base_properties (void) { } @@ -1054,6 +1055,9 @@ std::string get_visible (void) const { return visible.current_value (); } + bool is_beingdeleted (void) const { return beingdeleted.is_on (); } + std::string get_beingdeleted (void) const { return beingdeleted.current_value (); } + virtual void remove_child (const graphics_handle& h); virtual void adopt (const graphics_handle& h) @@ -1184,6 +1188,15 @@ } } + void set_beingdeleted (const octave_value& val) + { + if (! error_state) + { + beingdeleted = val; + mark_modified (); + } + } + void reparent (const graphics_handle& new_parent) { parent = new_parent; } @@ -1250,26 +1263,30 @@ } protected: - string_property tag; - string_property type; - bool_property __modified__; - graphics_handle __myhandle__; - handle_property parent; + // properties common to all objects + bool_property beingdeleted; + radio_property busyaction; + callback_property buttondownfcn; // FIXME: use a property class for children Matrix children; - radio_property busyaction; - callback_property buttondownfcn; bool_property clipping; callback_property createfcn; callback_property deletefcn; radio_property handlevisibility; bool_property hittest; bool_property interruptible; + handle_property parent; bool_property selected; bool_property selectionhighlight; - handle_property uicontextmenu; + string_property tag; + string_property type; any_property userdata; bool_property visible; + // additional (octave-specific) properties + bool_property __modified__; + graphics_handle __myhandle__; + // FIXME: should this really be here? + handle_property uicontextmenu; protected: std::map all_props; @@ -1853,10 +1870,12 @@ array_property ylim m , default_lim () array_property zlim m , default_lim () array_property clim m , default_lim () + array_property alim m , default_lim () radio_property xlimmode al , "{auto}|manual" radio_property ylimmode al , "{auto}|manual" radio_property zlimmode al , "{auto}|manual" radio_property climmode al , "{auto}|manual" + radio_property alimmode , "{auto}|manual" mutable handle_property xlabel GSO , graphics_handle () mutable handle_property ylabel GSO , graphics_handle () mutable handle_property zlabel GSO , graphics_handle () @@ -1872,6 +1891,10 @@ radio_property xtickmode , "{auto}|manual" radio_property ytickmode , "{auto}|manual" radio_property ztickmode , "{auto}|manual" + bool_property xminortick , "off" + bool_property yminortick , "off" + bool_property zminortick , "off" + // FIXME: should be kind of string array any_property xticklabel m , "" any_property yticklabel m , "" any_property zticklabel m , "" @@ -1895,20 +1918,58 @@ array_property outerposition , Matrix () radio_property activepositionproperty , "{outerposition}|position" radio_property __colorbar__ h , "{none}|north|south|east|west|northoutside|southoutside|eastoutside|westoutside" + color_property ambientlightcolor , color_values (1, 1, 1) + array_property cameraposition m , Matrix (1, 3, 0.0) + array_property cameratarget m , Matrix (1, 3, 0.0) + array_property cameraupvector m , Matrix () + double_property cameraviewangle m , 10.0 + radio_property camerapositionmode , "{auto}|manual" + radio_property cameratargetmode , "{auto}|manual" + radio_property cameraupvectormode , "{auto}|manual" + radio_property cameraviewanglemode , "{auto}|manual" + array_property currentpoint , Matrix (2, 3, 0.0) + radio_property drawmode , "{normal}|fast" + radio_property fontangle , "{normal}|italic|oblique" + string_property fontname , "Helvetica" + double_property fontsize , 12 + radio_property fontunits , "{points}|normalized|inches|centimeters|pixels" + radio_property fontweight , "{normal}|light|demi|bold" + radio_property gridlinestyle , "{-}|--|:|-.|none" + // FIXME: should be kind of string array + string_property linestyleorder , "-" + double_property linewidth , 0.5 + radio_property minorgridlinestyle , "{-}|--|:|-.|none" + array_property plotboxaspectratio m , Matrix (1, 3, 1.0) + radio_property plotboxaspectratiomode , "{auto}|manual" + radio_property projection , "{orthographic}|perpective" + radio_property tickdir m , "{in}|out" + radio_property tickdirmode , "{auto}|manual" + array_property ticklength , Matrix (1, 2, 0.1) + array_property tightinset r , Matrix (1, 4, 0.0) + // FIXME: uicontextmenu should be moved here + radio_property units , "{normalized}|inches|centimeters|points|pixels|characters" + // hidden properties for transformation computation + array_property x_viewtransform h , Matrix (4, 4, 0.0) + array_property x_projectiontransform h , Matrix (4, 4, 0.0) + array_property x_viewporttransform h , Matrix (4, 4, 0.0) + array_property x_normrendertransform h , Matrix (4, 4, 0.0) + array_property x_rendertransform h , Matrix (4, 4, 0.0) END_PROPERTIES protected: void init (void) { position.add_constraint (dim_vector (1, 4)); - position.add_constraint (dim_vector (0, 0)); + position.add_constraint (dim_vector (0, 0)); outerposition.add_constraint (dim_vector (1, 4)); colororder.add_constraint (dim_vector (-1, 3)); dataaspectratio.add_constraint (dim_vector (1, 3)); + plotboxaspectratio.add_constraint (dim_vector (1, 3)); xlim.add_constraint (dim_vector (1, 2)); ylim.add_constraint (dim_vector (1, 2)); zlim.add_constraint (dim_vector (1, 2)); clim.add_constraint (dim_vector (1, 2)); + alim.add_constraint (dim_vector (1, 2)); xtick.add_constraint (dim_vector (1, -1)); ytick.add_constraint (dim_vector (1, -1)); ztick.add_constraint (dim_vector (1, -1)); @@ -1916,6 +1977,14 @@ vw(1) = 90; view = vw; view.add_constraint (dim_vector (1, 2)); + cameraposition.add_constraint (dim_vector (1, 3)); + Matrix upv (1, 3, 0.0); + upv(2) = 1.0; + cameraupvector = upv; + cameraupvector.add_constraint (dim_vector (1, 3)); + currentpoint.add_constraint (dim_vector (2, 3)); + ticklength.add_constraint (dim_vector (1, 2)); + tightinset.add_constraint (dim_vector (1, 4)); } }; @@ -2163,7 +2232,7 @@ // properties declarations. BEGIN_PROPERTIES(patch) - data_property xdata l , Matrix () + data_property xdata l , Matrix () data_property ydata l , Matrix () data_property zdata l , Matrix () data_property cdata l , Matrix ()