# HG changeset patch # User Markus Mützel # Date 1589741342 -7200 # Node ID af912e78ce432e11274b40f2772ce119bf1656b6 # Parent 1f5ec8c025bc847ce9e0162e6221ef2ff40d68b5 Mirror value of axes property "activepositionproperty" from "positionconstraint" (bug #58336). * graphics.in.h (axes::properties): Hide property "activepositionproperty". (axes::properties::get_activepositionproperty, axes::properties::set_activepositionproperty): Add functions that redirect to "positionconstraint" property and translate values. * graphics.cc (axes::properties): Replace setting "activepositionproperty" by setting "positionconstraint". * doc/interpreter/genpropdoc.m: Move description from "activepositionproperty" axes property to "positionconstraint". diff -r 1f5ec8c025bc -r af912e78ce43 doc/interpreter/genpropdoc.m --- a/doc/interpreter/genpropdoc.m Sun May 17 18:59:24 2020 +0200 +++ b/doc/interpreter/genpropdoc.m Sun May 17 20:49:02 2020 +0200 @@ -654,12 +654,6 @@ s.doc = doc_unused; ## Specific properties - case "activepositionproperty" - s.doc = "Specify which of @qcode{\"position\"} or \ -@qcode{\"outerposition\"} properties takes precedence when axes \ -annotations extent changes. @xref{XREFaxesposition, , @w{position property}}, \ -and @ref{XREFaxesposition, , @w{outerposition property}}."; - case "alim" s.doc = sprintf (doc_notimpl, "Transparency"); @@ -839,6 +833,13 @@ @xref{XREFaxesouterposition, , @w{outerposition property}}."; s.valid = valid_4elvec; + case "positionconstraint" + s.doc = "Specify which of @qcode{\"innerposition\"} or \ +@qcode{\"outerposition\"} properties takes precedence when axes \ +annotations extent changes. \ +@xref{XREFaxesinnerposition, , @w{@qcode{\"innerposition\"} property}}, \ +and @ref{XREFaxesouterposition, , @w{@qcode{\"outerposition\"} property}}."; + case "projection" s.doc = doc_unused; diff -r 1f5ec8c025bc -r af912e78ce43 libinterp/corefcn/graphics.cc --- a/libinterp/corefcn/graphics.cc Sun May 17 18:59:24 2020 +0200 +++ b/libinterp/corefcn/graphics.cc Sun May 17 20:49:02 2020 +0200 @@ -5285,7 +5285,7 @@ axes::properties::sync_positions (void) { // First part is equivalent to 'update_tightinset ()' - if (activepositionproperty.is ("position")) + if (positionconstraint.is ("innerposition")) update_position (); else update_outerposition (); @@ -5302,7 +5302,7 @@ tightinset = tinset; set_units (old_units); update_transform (); - if (activepositionproperty.is ("position")) + if (positionconstraint.is ("innerposition")) update_position (); else update_outerposition (); @@ -5353,7 +5353,7 @@ %! hf = figure ("visible", "off"); %! graphics_toolkit (hf, "qt"); %! fpos = get (hf, "position"); -%! set (gca, "activepositionproperty", "position"); +%! set (gca, "positionconstraint", "innerposition"); %! unwind_protect %! plot (rand (3)); %! position = get (gca, "position"); @@ -7521,7 +7521,7 @@ void axes::properties::update_outerposition (void) { - set_activepositionproperty ("outerposition"); + set_positionconstraint ("outerposition"); caseless_str old_units = get_units (); set_units ("normalized"); @@ -7580,7 +7580,7 @@ void axes::properties::update_position (void) { - set_activepositionproperty ("position"); + set_positionconstraint ("innerposition"); caseless_str old_units = get_units (); set_units ("normalized"); @@ -7639,7 +7639,7 @@ double right_margin = std::max (linset(2), tinset(2)); double top_margin = std::max (linset(3), tinset(3)); - if (activepositionproperty.is ("position")) + if (positionconstraint.is ("innerposition")) { Matrix innerbox = position.get ().matrix_value (); diff -r 1f5ec8c025bc -r af912e78ce43 libinterp/corefcn/graphics.in.h --- a/libinterp/corefcn/graphics.in.h Sun May 17 18:59:24 2020 +0200 +++ b/libinterp/corefcn/graphics.in.h Sun May 17 20:49:02 2020 +0200 @@ -3466,6 +3466,31 @@ void sync_positions (void); + // Redirect calls to "activepositionproperty" to "positionconstraint". + + std::string get_activepositionproperty (void) const + { + std::string cur_val; + + if (positionconstraint.is ("innerposition")) + cur_val = "position"; + else + cur_val = "outerposition"; + + return cur_val; + } + + void set_activepositionproperty (const octave_value& val) + { + // call set method to validate the input + activepositionproperty.set (val); + + if (val.char_matrix_value ().row_as_string (0) == "position") + set_positionconstraint ("innerposition"); + else + set_positionconstraint (val); + } + // Redirect calls to "innerposition" to "position". octave_value get_innerposition (void) const @@ -3647,7 +3672,7 @@ // Programming note: Keep property list sorted if new ones are added. BEGIN_PROPERTIES (axes) - radio_property activepositionproperty , "{outerposition}|position" + radio_property activepositionproperty gsh , "{outerposition}|position" row_vector_property alim m , default_lim () radio_property alimmode , "{auto}|manual" // FIXME: not yet implemented