diff libinterp/corefcn/graphics-toolkit.cc @ 23774:41795b504a8b

don't use singleton for gtk_manager * graphics-handle.h, graphics-toolkit.cc, graphics-toolkit.h, gtk-manager.cc, gtk-manager.h: New files, extracted from graphics.cc and graphics.in.h. * libinterp/corefcn/module.mk: Update. * graphics.cc (Favailable_graphics_toolkits, Fregister_graphics_toolkit, Floaded_graphics_toolkits): Now defined with DEFMETHOD. * main-window.cc (octave_interpreter::execute): Pass interpreter object to Fregister_graphics_toolkit. * interpreter-private.cc, interpreter-private.h (__get_gtk_manager__): New function. * interpreter.cc, interpreter.h (interpreter::m_gtk_manager): New data member. (interpreter::get_gtk_manager): New function. (interpreter::cleanup): Update call to unload_all_toolkits. * __init_qt__.cc (__init__): Pass reference to interpreter. Update caller. (__shutdown__): Don't call gtk_manager::unload_toolkit here. (F__init_qt__): Define with DEFMETHOD. * __init_fltk__.cc (F__init_fltk__): Access gtk_manager through interpreter object. * __init_gnuplot__.cc (gnuplot_graphics_toolkit::close): Don't call gtk_manager::unload_toolkit here. F__init_gnuplot__): Access gtk_manager through interpreter object.
author John W. Eaton <jwe@octave.org>
date Fri, 14 Jul 2017 16:05:59 -0400
parents
children 194eb4bd202b
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libinterp/corefcn/graphics-toolkit.cc	Fri Jul 14 16:05:59 2017 -0400
@@ -0,0 +1,44 @@
+/*
+
+Copyright (C) 2007-2017 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3 of the License, or
+(at your option) any later version.
+
+Octave is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if defined (HAVE_CONFIG_H)
+#  include "config.h"
+#endif
+
+#include "graphics.h"
+#include "gtk-manager.h"
+
+void
+base_graphics_toolkit::update (const graphics_handle& h, int id)
+{
+  graphics_object go = gh_manager::get_object (h);
+
+  update (go, id);
+}
+
+bool
+base_graphics_toolkit::initialize (const graphics_handle& h)
+{
+  graphics_object go = gh_manager::get_object (h);
+
+  return initialize (go);
+}