changeset 23976:529272d1c271

Complete openvar implementation (bug #51899). * NEWS: Announce Variable Editor. Add openvar to list of new functions. * octave-link.cc (Fopenvar): Add "#include builtin-defun-decls.h" for access to Octave functions. Sort #includes. Use is_string() to validate NAME input. Call Fisguirunning and issue a warning if it is not. Add BIST tests * scripts/help/__unimplemented__.m: Remove openvar from list.
author Rik <rik@octave.org>
date Wed, 30 Aug 2017 16:05:44 -0700
parents 976a7a350274
children cf34392c9de9
files NEWS libinterp/corefcn/octave-link.cc scripts/help/__unimplemented__.m
diffstat 3 files changed, 29 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Wed Aug 30 17:31:09 2017 -0400
+++ b/NEWS	Wed Aug 30 16:05:44 2017 -0700
@@ -1,6 +1,12 @@
 Summary of important user-visible changes for version 4.4 (yyyy-mm-dd):
 ----------------------------------------------------------------------
 
+ ** A graphical Variable Editor has been added to the GUI interface.
+    It uses a spreadsheet-like interface for quick, intuitive editing
+    of variables.  The Variable Editor is launched by double-clicking
+    on a variable name in the Workspace Window or by typing
+    "openvar VARIABLE_NAME" in the Command Window.
+
  ** On systems with 64-bit pointers, --enable-64 is now the default and
     Octave always uses 64-bit indexing.  However, if the configure
     script determines that the BLAS library uses 32-bit integers, then
@@ -42,6 +48,7 @@
       gsvd
       hgtransform
       humps
+      openvar
       repelem
 
  ** Deprecated functions.
--- a/libinterp/corefcn/octave-link.cc	Wed Aug 30 17:31:09 2017 -0400
+++ b/libinterp/corefcn/octave-link.cc	Wed Aug 30 16:05:44 2017 -0700
@@ -26,13 +26,15 @@
 #  include "config.h"
 #endif
 
+#include "builtin-defun-decls.h"
 #include "cmd-edit.h"
 #include "defun.h"
+#include "interpreter.h"
 #include "interpreter-private.h"
-#include "interpreter.h"
+#include "octave-link.h"
 #include "oct-env.h"
 #include "oct-mutex.h"
-#include "octave-link.h"
+#include "ovl.h"
 #include "pager.h"
 
 static int
@@ -388,22 +390,28 @@
 Open the variable @var{name} in the graphical Variable Editor.
 @end deftypefn */)
 {
-  octave_value retval;
-
-  if (args.length () == 1)
-    {
-      std::string name = args (0).string_value ();
-      if (! error_state)
-        octave_link::openvar (name);
-      else
-        error ("invalid arguments");
-    }
-  else
+  if (args.length () != 1)
     print_usage ();
 
-  return retval;
+  if (! args(0).is_string ())
+    error ("openvar: NAME must be a string"); 
+
+  std::string name = args(0).string_value ();
+
+  if (! (Fisguirunning ())(0).is_true ())
+    warning ("openvar: GUI is not running, can't start Variable Editor"); 
+  else
+    octave_link::openvar (name);
+
+  return ovl ();
 }
 
+/*
+%!error openvar ()
+%!error openvar ("a", "b")
+%!error <NAME must be a string> openvar (1:10)
+*/
+
 DEFUN (__octave_link_show_doc__, args, ,
        doc: /* -*- texinfo -*-
 @deftypefn {} {} __octave_link_show_doc__ (@var{filename})
--- a/scripts/help/__unimplemented__.m	Wed Aug 30 17:31:09 2017 -0400
+++ b/scripts/help/__unimplemented__.m	Wed Aug 30 16:05:44 2017 -0700
@@ -754,7 +754,6 @@
   "odextend",
   "openfig",
   "opengl",
-  "openvar",
   "ordeig",
   "ordqz",
   "outerjoin",