diff libinterp/corefcn/graphics.cc @ 18764:89448a7523b2

Add some more callbacks for root properties (bug #42347). * graphics.in.h (root prop. errormessage): set read-only and declare custom get method * graphics.in.h (root prop. diary, diaryfile, echo, recursionlimit): declare custom get/set methods * graphics.cc (root::properties::get_errormessage, set_diary, get_diary, set_diaryfile, get_diaryfile, set_echo, get_echo, set_recursionlimit, get_recursionlimit): new methods. * pager.cc (F__diaryfile__, F__diarystate__): new functions to retrieve diary info. * pager.cc: set default value "diary" for diary_file static variable. * input.cc (F__echostate__): new function to retrieve echo info.
author Pantxo Diribarne <pantxo.diribarne@gmail.com>
date Tue, 13 May 2014 18:51:52 +0200
parents 9fbb254c09e6
children 70ea5a2856fe
line wrap: on
line diff
--- a/libinterp/corefcn/graphics.cc	Thu May 15 14:24:21 2014 -0700
+++ b/libinterp/corefcn/graphics.cc	Tue May 13 18:51:52 2014 +0200
@@ -3257,6 +3257,89 @@
 }
 
 std::string
+root_figure::properties::get_diary (void) const
+{
+  bool is_diary_on = F__diarystate__ ()(0).bool_value ();
+  if (is_diary_on)
+    return std::string ("on");
+  else
+    return std::string ("off");
+}
+
+void
+root_figure::properties::set_diary (const octave_value& val)
+{
+  if (! error_state)
+    {
+      // Input checking and abrev. matching
+      diary.set (val, false);
+      
+      if (! error_state)
+        {
+          Fdiary (ovl (diary.current_value ()));
+
+          diary.run_listeners ();
+        }
+    }
+}
+
+std::string
+root_figure::properties::get_diaryfile (void) const
+{
+  return F__diaryfile__ ()(0).string_value ();
+}
+
+void
+root_figure::properties::set_diaryfile (const octave_value& val)
+{
+  if (! error_state)
+    {
+      // Input checking and abrev. matching
+      diaryfile.set (val, false);
+      
+      if (! error_state)
+        {
+          Fdiary (ovl (diaryfile.string_value ()));
+
+          diaryfile.run_listeners ();
+        }
+    }
+}
+
+std::string
+root_figure::properties::get_echo (void) const
+{
+  bool is_echo_on = F__echostate__ ()(0).bool_value ();
+  if (is_echo_on)
+    return std::string ("on");
+  else
+    return std::string ("off");
+}
+
+void
+root_figure::properties::set_echo (const octave_value& val)
+{
+  if (! error_state)
+    {
+      // Input checking and abrev. matching
+      echo.set (val, false);
+      
+      if (! error_state)
+        {
+          Fecho (ovl (echo.current_value ()));
+
+          echo.run_listeners ();
+        }
+    }
+}
+
+std::string
+root_figure::properties::get_errormessage (void) const
+{
+  return Flasterr ()(0).string_value ();
+}
+
+std::string
 root_figure::properties::get_format (void) const
 {
   return F__formatstring__ ()(0).string_value ();
@@ -3311,6 +3394,32 @@
     }
 }
 
+
+double
+root_figure::properties::get_recursionlimit (void) const
+{
+  return Fmax_recursion_depth ()(0).double_value ();
+}
+
+void
+root_figure::properties::set_recursionlimit (const octave_value& val)
+{
+  if (! error_state)
+    {
+      // Input checking and abrev. matching
+      recursionlimit.set (val, false);
+      
+      if (! error_state)
+        {
+          double dval = recursionlimit.double_value ();
+
+          Fmax_recursion_depth (ovl (dval));
+
+          recursionlimit.run_listeners ();
+        }
+    }
+}
+
 void
 figure::properties::set_integerhandle (const octave_value& val)
 {