changeset 27699:c9d9aae197c3

restore files deleted in changeset b3401292e101
author John W. Eaton <jwe@octave.org>
date Sat, 16 Nov 2019 01:04:30 -0500
parents f65b1666e650
children 6455c82d5180
files libgui/src/graphics-init.cc libgui/src/graphics-init.h
diffstat 2 files changed, 115 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libgui/src/graphics-init.cc	Sat Nov 16 01:04:30 2019 -0500
@@ -0,0 +1,76 @@
+/*
+
+Copyright (C) 2019 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
+<https://www.gnu.org/licenses/>.
+
+*/
+
+#if defined (HAVE_CONFIG_H)
+#  include "config.h"
+#endif
+
+#include <QApplication>
+#include <QMetaType>
+#include <QThread>
+
+#include "graphics-init.h"
+#include "octave-qobject.h"
+#include "qt-graphics-toolkit.h"
+#include "QtHandlesUtils.h"
+
+#include "graphics.h"
+#include "gtk-manager.h"
+#include "interpreter.h"
+
+namespace octave
+{
+  void graphics_init (interpreter& interp, base_qobject& oct_qobj)
+  {
+#if defined (HAVE_QT_GRAPHICS)
+
+    gh_manager& gh_mgr = interp.get_gh_manager ();
+
+    autolock guard (gh_mgr.graphics_lock ());
+
+    qRegisterMetaType<graphics_object> ("graphics_object");
+
+    gh_mgr.enable_event_processing (true);
+
+    QtHandles::qt_graphics_toolkit *qt_gtk
+      = new QtHandles::qt_graphics_toolkit (interp, oct_qobj);
+
+    if (QThread::currentThread ()
+        != QApplication::instance ()->thread ())
+      qt_gtk->moveToThread (QApplication::instance ()->thread ());
+
+    graphics_toolkit tk (qt_gtk);
+
+    octave::gtk_manager& gtk_mgr = interp.get_gtk_manager ();
+
+    gtk_mgr.register_toolkit ("qt");
+
+    gtk_mgr.load_toolkit (tk);
+
+#else
+
+    octave_unused_parameter (interp);
+    octave_unused_parameter (oct_qobj);
+
+#endif
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libgui/src/graphics-init.h	Sat Nov 16 01:04:30 2019 -0500
@@ -0,0 +1,39 @@
+/*
+
+Copyright (C) 2019 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
+<https://www.gnu.org/licenses/>.
+
+*/
+
+#if ! defined (octave_graphics_init_h)
+#define octave_graphics_init_h 1
+
+#include <QObject>
+
+#include "qt-interpreter-events.h"
+
+namespace octave
+{
+  class interpreter;
+
+  class base_qobject;
+
+  extern void graphics_init (interpreter& interp, base_qobject& oct_qobj);
+}
+
+#endif