diff libinterp/corefcn/event-manager.cc @ 27554:d0f778462a51

Restore hability to copy figure to clipboard (bug #55970) * __add_default_menu__.m: add "Edit>CopyFigure to Clipboard" menu that triggers clipboard_cb callback. (clipboard_cb): New callback that prints the figure to png and calls F__event_manager_copy_image_to_clipboard__. * event-manager.cc (F__event_manager_copy_image_to_clipboard__): New builtin function to copy image from a PNG file to clipboard.
author Pantxo Diribarne <pantxo.diribarne@gmail.com>
date Fri, 27 Sep 2019 13:14:13 +0200
parents 160930a3e5ee
children ba317c535adb
line wrap: on
line diff
--- a/libinterp/corefcn/event-manager.cc	Thu Oct 24 03:47:41 2019 -0400
+++ b/libinterp/corefcn/event-manager.cc	Fri Sep 27 13:14:13 2019 +0200
@@ -564,3 +564,19 @@
 
   return ovl (evmgr.unregister_doc (file));
 }
+
+DEFMETHOD (__event_manager_copy_image_to_clipboard__, interp, args, ,
+           doc: /* -*- texinfo -*-
+@deftypefn {} {} __event_manager_copy_image_to_clipboard__ (@var{filename})
+Undocumented internal function.
+@end deftypefn */)
+{
+  std::string file;
+
+  if (args.length () >= 1)
+    file = args(0).string_value();
+
+  octave::event_manager& evmgr = interp.get_event_manager ();
+  evmgr.copy_image_to_clipboard (file);
+  return ovl ();
+}