changeset 31020:cb9451780a15

Update figure graphics object for Matlab compatibility. * NEWS.8.md: Announce addition of "innerposition" and "windowstate" properties to figure objects. Announce change in default for "dockcontrols" property to "on". * graphics.in.h (figure::properties::get_innerposition, figure::properties::set_innerposition): New functions to alias "innerposition" property to "position" property. * graphics.in.h (BEGIN_PROPERTIES (figure)): Change "dockcontrols" default to "on". Re-order "pointer" property to show the default "arrow" as the first entry. Add new property "windowstate".
author Rik <rik@octave.org>
date Tue, 24 May 2022 13:28:06 -0700
parents d07218f22447
children f44e19671777
files etc/NEWS.8.md libinterp/corefcn/graphics.in.h
diffstat 2 files changed, 25 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/etc/NEWS.8.md	Tue May 24 22:36:18 2022 +0200
+++ b/etc/NEWS.8.md	Tue May 24 13:28:06 2022 -0700
@@ -16,6 +16,9 @@
 
 ### Graphics backend
 
+- Additional properties have been added to the `figure` graphics object:
+    * `"innerposition"` (equivalent to `"position"`)
+    * `"windowstate"` (not yet implemented)
 
 ### Matlab compatibility
 
@@ -42,6 +45,13 @@
 - `var` and `std` now optionally output a second argument containing the mean
   or weighted mean.
 
+- The default state for certain graphics properties has been made
+  consistent with Matlab.
+
+  Object      | Property         | Default State
+  ------------|------------------|------------
+  `figure`    | `"dockcontrols"` | `"on"`
+
 ### Alphabetical list of new functions added in Octave 8
 
 * `uifigure`
--- a/libinterp/corefcn/graphics.in.h	Tue May 24 22:36:18 2022 +0200
+++ b/libinterp/corefcn/graphics.in.h	Tue May 24 13:28:06 2022 -0700
@@ -3149,6 +3149,17 @@
 
     OCTINTERP_API void adopt (const graphics_handle& h);
 
+    // Alias "innerposition" to "position".
+    octave_value get_innerposition (void) const
+    {
+      return get_position ();
+    }
+
+    void set_innerposition (const octave_value& val)
+    {
+      set_position (val);
+    }
+
     OCTINTERP_API void set_position (const octave_value& val,
                                      bool do_notify_toolkit = true);
 
@@ -3189,9 +3200,10 @@
       string_property currentcharacter r , ""
       handle_property currentobject r , graphics_handle ()
       array_property currentpoint r , Matrix (2, 1, 0)
-      bool_property dockcontrols , "off"
+      bool_property dockcontrols , "on"
       string_property filename , ""
       bool_property graphicssmoothing , "on"
+      array_property innerposition sg , default_figure_position ()
       bool_property integerhandle S , "on"
       bool_property inverthardcopy , "on"
       callback_property keypressfcn , Matrix ()
@@ -3209,7 +3221,7 @@
       array_property papersize U , default_figure_papersize ()
       radio_property papertype SU , "{usletter}|uslegal|a0|a1|a2|a3|a4|a5|b0|b1|b2|b3|b4|b5|arch-a|arch-b|arch-c|arch-d|arch-e|a|b|c|d|e|tabloid|<custom>"
       radio_property paperunits Su , "{inches}|centimeters|normalized|points"
-      radio_property pointer , "crosshair|{arrow}|ibeam|watch|topl|topr|botl|botr|left|top|right|bottom|circle|cross|fleur|custom|hand"
+      radio_property pointer , "{arrow}|crosshair|ibeam|watch|topl|topr|botl|botr|left|top|right|bottom|circle|cross|fleur|custom|hand"
       array_property pointershapecdata , Matrix (16, 16, 1)
       array_property pointershapehotspot , Matrix (1, 2, 1)
       array_property position s , default_figure_position ()
@@ -3230,6 +3242,7 @@
       callback_property windowkeypressfcn , Matrix ()
       callback_property windowkeyreleasefcn , Matrix ()
       callback_property windowscrollwheelfcn , Matrix ()
+      radio_property windowstate , "{normal}|minimized|maximized|fullscreen"
       radio_property windowstyle , "{normal}|modal|docked"
 
       // Overridden base property