Mercurial > octave
changeset 27647:2a506bc4a7af
eliminate global access to Octave interpreter in qt graphics classes
Provide reference to interprerter to qt graphics classes to
eliminate need for accessing it through a global variable.
* qt-graphics-toolkit.cc (qt_graphics_toolkit::create_object): Pass
m_interpreter to create functions for individual graphics objects.
* BaseControl.h, BaseControl.cc, ButtonControl.h, ButtonControl.cc,
ButtonGroup.h, ButtonGroup.cc, Canvas.h, Canvas.cc, CheckBoxControl.h,
CheckBoxControl.cc, Container.h, Container.cc, ContextMenu.h,
ContextMenu.cc, EditControl.h, EditControl.cc, Figure.h, Figure.cc,
GLCanvas.h, GLCanvas.cc, ListBoxControl.h, ListBoxControl.cc, Menu.h,
Menu.cc, Object.h, Object.cc, Panel.h, Panel.cc, PopupMenuControl.h,
PopupMenuControl.cc, PushButtonControl.h, PushButtonControl.cc,
PushTool.h, PushTool.cc, QtHandlesUtils.h, RadioButtonControl.h,
RadioButtonControl.cc, SliderControl.h, SliderControl.cc, Table.h,
Table.cc, TextControl.h, TextControl.cc, ToggleButtonControl.h,
ToggleButtonControl.cc, ToggleTool.h, ToggleTool.cc, ToolBar.h,
ToolBar.cc, ToolBarButton.h, ToolBarButton.cc:
Accept reference to interpreter in create function and constructors
for graphics objects. Eliminate global access to interpreter object
and graphics_handle manager.
line wrap: on
line diff
--- a/libgui/graphics/BaseControl.cc Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/BaseControl.cc Wed Nov 06 12:42:12 2019 -0500 @@ -34,7 +34,7 @@ #include "QtHandlesUtils.h" #include "graphics.h" -#include "interpreter-private.h" +#include "interpreter.h" namespace QtHandles { @@ -93,9 +93,11 @@ w->setPalette (p); } - BaseControl::BaseControl (octave::base_qobject&, const graphics_object& go, - QWidget *w) - : Object (go, w), m_normalizedFont (false), m_keyPressHandlerDefined (false) + BaseControl::BaseControl (octave::base_qobject& oct_qobj, + octave::interpreter& interp, + const graphics_object& go, QWidget *w) + : Object (oct_qobj, interp, go, w), m_normalizedFont (false), + m_keyPressHandlerDefined (false) { qObject ()->setObjectName ("UIControl"); init (w); @@ -199,7 +201,7 @@ bool BaseControl::eventFilter (QObject *watched, QEvent *xevent) { - gh_manager& gh_mgr = octave::__get_gh_manager__ ("BaseControl::eventFilter"); + gh_manager& gh_mgr = m_interpreter.get_gh_manager (); switch (xevent->type ()) { @@ -238,7 +240,7 @@ emit gh_callback_event (m_handle, "buttondownfcn"); if (m->button () == Qt::RightButton) - ContextMenu::executeAt (up, m->globalPos ()); + ContextMenu::executeAt (m_interpreter, up, m->globalPos ()); } else {
--- a/libgui/graphics/BaseControl.h Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/BaseControl.h Wed Nov 06 12:42:12 2019 -0500 @@ -31,6 +31,7 @@ namespace octave { class base_qobject; + class interpreter; } namespace QtHandles @@ -39,8 +40,8 @@ class BaseControl : public Object { public: - BaseControl (octave::base_qobject& oct_qobj, const graphics_object& go, - QWidget *w); + BaseControl (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_object& go, QWidget *w); ~BaseControl (void); Container * innerContainer (void) { return nullptr; }
--- a/libgui/graphics/ButtonControl.cc Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/ButtonControl.cc Wed Nov 06 12:42:12 2019 -0500 @@ -32,15 +32,16 @@ #include "QtHandlesUtils.h" #include "graphics.h" -#include "interpreter-private.h" +#include "interpreter.h" namespace QtHandles { ButtonControl::ButtonControl (octave::base_qobject& oct_qobj, + octave::interpreter& interp, const graphics_object& go, QAbstractButton *btn) - : BaseControl (oct_qobj, go, btn), m_blockCallback (false) + : BaseControl (oct_qobj, interp, go, btn), m_blockCallback (false) { uicontrol::properties& up = properties<uicontrol> (); @@ -97,9 +98,9 @@ btn->setChecked (false); if (up.style_is ("radiobutton") || up.style_is ("togglebutton")) { - gh_manager& gh_mgr = octave::__get_gh_manager__ ("ButtonControl::update"); + gh_manager& gh_mgr = m_interpreter.get_gh_manager (); - Object *parent = Object::parentObject (gh_mgr.get_object (up.get___myhandle__ ())); + Object *parent = Object::parentObject (m_interpreter, gh_mgr.get_object (up.get___myhandle__ ())); ButtonGroup *btnGroup = dynamic_cast<ButtonGroup *>(parent); if (btnGroup) btnGroup->selectNothing (); @@ -125,7 +126,7 @@ if (! m_blockCallback && btn->isCheckable ()) { - gh_manager& gh_mgr = octave::__get_gh_manager__ ("ButtonControl::toggled"); + gh_manager& gh_mgr = m_interpreter.get_gh_manager (); octave::autolock guard (gh_mgr.graphics_lock ());
--- a/libgui/graphics/ButtonControl.h Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/ButtonControl.h Wed Nov 06 12:42:12 2019 -0500 @@ -30,6 +30,7 @@ namespace octave { class base_qobject; + class interpreter; } namespace QtHandles @@ -40,8 +41,8 @@ Q_OBJECT public: - ButtonControl (octave::base_qobject& oct_qobj, const graphics_object& go, - QAbstractButton *btn); + ButtonControl (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_object& go, QAbstractButton *btn); ~ButtonControl (void); protected:
--- a/libgui/graphics/ButtonGroup.cc Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/ButtonGroup.cc Wed Nov 06 12:42:12 2019 -0500 @@ -44,7 +44,7 @@ #include "octave-qobject.h" -#include "interpreter-private.h" +#include "interpreter.h" #include "ov-struct.h" namespace QtHandles @@ -97,9 +97,9 @@ ButtonGroup* ButtonGroup::create (octave::base_qobject& oct_qobj, - const graphics_object& go) + octave::interpreter& interp, const graphics_object& go) { - Object *parent = Object::parentObject (go); + Object *parent = parentObject (interp, go); if (parent) { @@ -108,8 +108,8 @@ if (container) { QFrame *frame = new QFrame (container); - return new ButtonGroup (oct_qobj, go, new QButtonGroup (frame), - frame); + return new ButtonGroup (oct_qobj, interp, go, + new QButtonGroup (frame), frame); } } @@ -117,10 +117,11 @@ } ButtonGroup::ButtonGroup (octave::base_qobject& oct_qobj, + octave::interpreter& interp, const graphics_object& go, QButtonGroup *buttongroup, QFrame *frame) - : Object (go, frame), m_hiddenbutton(nullptr), m_container (nullptr), - m_title (nullptr), m_blockUpdates (false) + : Object (oct_qobj, interp, go, frame), m_hiddenbutton (nullptr), + m_container (nullptr), m_title (nullptr), m_blockUpdates (false) { uibuttongroup::properties& pp = properties<uibuttongroup> (); @@ -139,7 +140,7 @@ m_hiddenbutton->hide (); m_buttongroup->addButton (m_hiddenbutton); - m_container = new Container (frame, oct_qobj); + m_container = new Container (frame, oct_qobj, interp); m_container->canvas (m_handle); connect (m_container, SIGNAL (interpeter_event (const fcn_callback&)), @@ -189,7 +190,7 @@ { if (! m_blockUpdates) { - gh_manager& gh_mgr = octave::__get_gh_manager__ ("ButtonGroup::eventFilter"); + gh_manager& gh_mgr = m_interpreter.get_gh_manager (); if (watched == qObject ()) { @@ -230,7 +231,8 @@ { octave::autolock guard (gh_mgr.graphics_lock ()); - ContextMenu::executeAt (properties (), m->globalPos ()); + ContextMenu::executeAt (m_interpreter, properties (), + m->globalPos ()); } } break; @@ -363,7 +365,7 @@ { graphics_handle h = pp.get_selectedobject (); - gh_manager& gh_mgr = octave::__get_gh_manager__ ("ButtonGroup::update"); + gh_manager& gh_mgr = m_interpreter.get_gh_manager (); octave::autolock guard (gh_mgr.graphics_lock ()); @@ -468,7 +470,7 @@ Q_UNUSED (toggled); if (! m_blockUpdates) { - gh_manager& gh_mgr = octave::__get_gh_manager__ ("ButtonGroup::buttonToggled"); + gh_manager& gh_mgr = m_interpreter.get_gh_manager (); octave::autolock guard (gh_mgr.graphics_lock ()); @@ -496,7 +498,7 @@ { Q_UNUSED (btn); - gh_manager& gh_mgr = octave::__get_gh_manager__ ("ButtonGroup::buttonClicked"); + gh_manager& gh_mgr = m_interpreter.get_gh_manager (); octave::autolock guard (gh_mgr.graphics_lock ());
--- a/libgui/graphics/ButtonGroup.h Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/ButtonGroup.h Wed Nov 06 12:42:12 2019 -0500 @@ -34,6 +34,7 @@ namespace octave { class base_qobject; + class interpreter; } namespace QtHandles @@ -46,16 +47,18 @@ Q_OBJECT public: - ButtonGroup (octave::base_qobject& oct_qobj, const graphics_object& go, - QButtonGroup *buttongroup, QFrame *frame); + ButtonGroup (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_object& go, QButtonGroup *buttongroup, + QFrame *frame); ~ButtonGroup (void); Container * innerContainer (void) { return m_container; } bool eventFilter (QObject *watched, QEvent *event); - static ButtonGroup * create (octave::base_qobject& oct_qobj, - const graphics_object& go); + static ButtonGroup * + create (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_object& go); void addButton (QAbstractButton *btn);
--- a/libgui/graphics/Canvas.cc Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/Canvas.cc Wed Nov 06 12:42:12 2019 -0500 @@ -45,7 +45,6 @@ #include "builtin-defun-decls.h" #include "graphics.h" -#include "interpreter-private.h" #include "interpreter.h" #include "oct-opengl.h" @@ -179,7 +178,7 @@ Canvas::updateCurrentPoint (const graphics_object& fig, const graphics_object& obj, QMouseEvent *event) { - gh_manager& gh_mgr = octave::__get_gh_manager__ ("Canvas::updateCurrentPoint"); + gh_manager& gh_mgr = m_interpreter.get_gh_manager (); octave::autolock guard (gh_mgr.graphics_lock ()); @@ -219,7 +218,7 @@ Canvas::updateCurrentPoint (const graphics_object& fig, const graphics_object& obj) { - gh_manager& gh_mgr = octave::__get_gh_manager__ ("Canvas::updateCurrentPoint"); + gh_manager& gh_mgr = m_interpreter.get_gh_manager (); octave::autolock guard (gh_mgr.graphics_lock ()); @@ -258,10 +257,8 @@ } static void - autoscale_axes (axes::properties& ap) + autoscale_axes (gh_manager& gh_mgr, axes::properties& ap) { - gh_manager& gh_mgr = octave::__get_gh_manager__ ("autoscale_axes"); - octave::autolock guard (gh_mgr.graphics_lock ()); // Reset zoom stack @@ -277,7 +274,7 @@ { if (! m_redrawBlocked) { - gh_manager& gh_mgr = octave::__get_gh_manager__ ("Canvas::canvasPaintEvent"); + gh_manager& gh_mgr = m_interpreter.get_gh_manager (); octave::autolock guard (gh_mgr.graphics_lock ()); @@ -345,7 +342,7 @@ Matrix children = obj.get_properties ().get_all_children (); octave_idx_type num_children = children.numel (); - gh_manager& gh_mgr = octave::__get_gh_manager__ ("Canvas::select_object"); + gh_manager& gh_mgr = m_interpreter.get_gh_manager (); for (int i = 0; i < num_children; i++) { @@ -443,7 +440,7 @@ void Canvas::canvasMouseMoveEvent (QMouseEvent *event) { - gh_manager& gh_mgr = octave::__get_gh_manager__ ("Canvas::canvasMouseMoveEvent"); + gh_manager& gh_mgr = m_interpreter.get_gh_manager (); octave::autolock guard (gh_mgr.graphics_lock ()); @@ -578,7 +575,7 @@ void Canvas::canvasMousePressEvent (QMouseEvent *event) { - gh_manager& gh_mgr = octave::__get_gh_manager__ ("Canvas::canvasMousePressEvent"); + gh_manager& gh_mgr = m_interpreter.get_gh_manager (); octave::autolock guard (gh_mgr.graphics_lock ()); @@ -677,7 +674,8 @@ // Show context menu of the selected object if (currentObj && event->button () == Qt::RightButton) - ContextMenu::executeAt (currentObj.get_properties (), + ContextMenu::executeAt (m_interpreter, + currentObj.get_properties (), event->globalPos ()); } break; @@ -712,7 +710,7 @@ { axes::properties& ap = Utils::properties<axes> (axesObj); - autoscale_axes (ap); + autoscale_axes (gh_mgr, ap); } else { @@ -746,7 +744,7 @@ axes::properties& ap = Utils::properties<axes> (axesObj); - autoscale_axes (ap); + autoscale_axes (gh_mgr, ap); } break; @@ -790,7 +788,7 @@ void Canvas::canvasMouseReleaseEvent (QMouseEvent *event) { - gh_manager& gh_mgr = octave::__get_gh_manager__ ("Canvas::canvasMouseReleaseEvent"); + gh_manager& gh_mgr = m_interpreter.get_gh_manager (); if ((m_mouseMode == ZoomInMode || m_mouseMode == ZoomOutMode) && m_mouseAxes.ok ()) @@ -900,7 +898,7 @@ void Canvas::canvasWheelEvent (QWheelEvent *event) { - gh_manager& gh_mgr = octave::__get_gh_manager__ ("Canvas::canvasWheelEvent"); + gh_manager& gh_mgr = m_interpreter.get_gh_manager (); octave::autolock guard (gh_mgr.graphics_lock ()); @@ -1025,7 +1023,7 @@ { if (m_eventMask & KeyPress) { - gh_manager& gh_mgr = octave::__get_gh_manager__ ("Canvas::canvasKeyPressEvent"); + gh_manager& gh_mgr = m_interpreter.get_gh_manager (); octave::autolock guard (gh_mgr.graphics_lock ()); @@ -1056,7 +1054,7 @@ { if (! event->isAutoRepeat () && (m_eventMask & KeyRelease)) { - gh_manager& gh_mgr = octave::__get_gh_manager__ ("Canvas::canvasKeyReleaseEvent"); + gh_manager& gh_mgr = m_interpreter.get_gh_manager (); octave::autolock guard (gh_mgr.graphics_lock ()); @@ -1075,13 +1073,13 @@ return false; } - Canvas* - Canvas::create (octave::base_qobject& oct_qobj, + Canvas * + Canvas::create (octave::base_qobject& oct_qobj, octave::interpreter& interp, const graphics_handle& handle, QWidget *parent, const std::string& /* name */) { // Only OpenGL - return new GLCanvas (oct_qobj, handle, parent); + return new GLCanvas (oct_qobj, interp, handle, parent); } }
--- a/libgui/graphics/Canvas.h Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/Canvas.h Wed Nov 06 12:42:12 2019 -0500 @@ -41,6 +41,7 @@ namespace octave { class base_qobject; + class interpreter; } namespace QtHandles @@ -77,9 +78,10 @@ virtual QWidget * qWidget (void) = 0; - static Canvas * create (octave::base_qobject& oct_qobj, - const graphics_handle& handle, QWidget *parent, - const std::string& name); + static Canvas * + create (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_handle& handle, QWidget *parent, + const std::string& name); virtual uint8NDArray getPixels (void) { return do_getPixels (m_handle); }; @@ -113,8 +115,10 @@ const graphics_handle& handle) = 0; protected: - Canvas (octave::base_qobject& oct_qobj, const graphics_handle& handle) + Canvas (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_handle& handle) : m_octave_qobj (oct_qobj), + m_interpreter (interp), m_handle (handle), m_redrawBlocked (false), m_mouseMode (NoMode), @@ -145,11 +149,14 @@ bool axes_only = false, std::vector<std::string> omit = std::vector<std::string> ()); + protected: + octave::base_qobject& m_octave_qobj; + octave::interpreter& m_interpreter; + private: QCursor make_cursor (const QString& name, int hot_x = -1, int hot_y = -1); - octave::base_qobject& m_octave_qobj; graphics_handle m_handle; bool m_redrawBlocked; MouseMode m_mouseMode;
--- a/libgui/graphics/CheckBoxControl.cc Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/CheckBoxControl.cc Wed Nov 06 12:42:12 2019 -0500 @@ -36,24 +36,27 @@ CheckBoxControl* CheckBoxControl::create (octave::base_qobject& oct_qobj, + octave::interpreter& interp, const graphics_object& go) { - Object *parent = Object::parentObject (go); + Object *parent = parentObject (interp, go); if (parent) { Container *container = parent->innerContainer (); if (container) - return new CheckBoxControl (oct_qobj, go, new QCheckBox (container)); + return new CheckBoxControl (oct_qobj, interp, go, + new QCheckBox (container)); } return nullptr; } CheckBoxControl::CheckBoxControl (octave::base_qobject& oct_obj, + octave::interpreter& interp, const graphics_object& go, QCheckBox *box) - : ButtonControl (oct_obj, go, box) + : ButtonControl (oct_obj, interp, go, box) { box->setAutoFillBackground (true); }
--- a/libgui/graphics/CheckBoxControl.h Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/CheckBoxControl.h Wed Nov 06 12:42:12 2019 -0500 @@ -30,6 +30,7 @@ namespace octave { class base_qobject; + class interpreter; } namespace QtHandles @@ -38,12 +39,14 @@ class CheckBoxControl : public ButtonControl { public: - CheckBoxControl (octave::base_qobject& oct_qobj, const graphics_object& go, + CheckBoxControl (octave::base_qobject& oct_qobj, + octave::interpreter& interp, const graphics_object& go, QCheckBox *box); ~CheckBoxControl (void); - static CheckBoxControl * create (octave::base_qobject& oct_qobj, - const graphics_object& go); + static CheckBoxControl * + create (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_object& go); }; }
--- a/libgui/graphics/Container.cc Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/Container.cc Wed Nov 06 12:42:12 2019 -0500 @@ -33,13 +33,15 @@ #include "QtHandlesUtils.h" #include "graphics.h" -#include "interpreter-private.h" +#include "interpreter.h" namespace QtHandles { - Container::Container (QWidget *xparent, octave::base_qobject& oct_qobj) - : ContainerBase (xparent), m_octave_qobj (oct_qobj), m_canvas (nullptr) + Container::Container (QWidget *xparent, octave::base_qobject& oct_qobj, + octave::interpreter& interp) + : ContainerBase (xparent), m_octave_qobj (oct_qobj), + m_interpreter (interp), m_canvas (nullptr) { setFocusPolicy (Qt::ClickFocus); } @@ -52,7 +54,7 @@ { if (! m_canvas && xcreate) { - gh_manager& gh_mgr = octave::__get_gh_manager__ ("Container::canvas"); + gh_manager& gh_mgr = m_interpreter.get_gh_manager (); octave::autolock guard (gh_mgr.graphics_lock ()); @@ -62,7 +64,7 @@ { graphics_object fig = go.get_ancestor ("figure"); - m_canvas = Canvas::create (m_octave_qobj, gh, this, + m_canvas = Canvas::create (m_octave_qobj, m_interpreter, gh, this, fig.get ("renderer").string_value ()); connect (m_canvas, SIGNAL (interpeter_event (const fcn_callback&)), @@ -131,7 +133,7 @@ if (m_canvas) m_canvas->qWidget ()->setGeometry (0, 0, width (), height ()); - gh_manager& gh_mgr = octave::__get_gh_manager__ ("Container::resizeEvent"); + gh_manager& gh_mgr = m_interpreter.get_gh_manager (); octave::autolock guard (gh_mgr.graphics_lock ());
--- a/libgui/graphics/Container.h Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/Container.h Wed Nov 06 12:42:12 2019 -0500 @@ -47,7 +47,8 @@ Q_OBJECT public: - Container (QWidget *parent, octave::base_qobject& oct_qobj); + Container (QWidget *parent, octave::base_qobject& oct_qobj, + octave::interpreter& interp); ~Container (void); Canvas * canvas (const graphics_handle& handle, bool create = true); @@ -78,6 +79,7 @@ private: octave::base_qobject& m_octave_qobj; + octave::interpreter& m_interpreter; Canvas *m_canvas; };
--- a/libgui/graphics/ContextMenu.cc Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/ContextMenu.cc Wed Nov 06 12:42:12 2019 -0500 @@ -32,30 +32,31 @@ #include "octave-qobject.h" -#include "interpreter-private.h" +#include "interpreter.h" namespace QtHandles { ContextMenu* ContextMenu::create (octave::base_qobject& oct_qobj, - const graphics_object& go) + octave::interpreter& interp, const graphics_object& go) { - Object *xparent = Object::parentObject (go); + Object *xparent = parentObject (interp, go); if (xparent) { QWidget *w = xparent->qWidget<QWidget> (); - return new ContextMenu (oct_qobj, go, new QMenu (w)); + return new ContextMenu (oct_qobj, interp, go, new QMenu (w)); } return nullptr; } - ContextMenu::ContextMenu (octave::base_qobject&, + ContextMenu::ContextMenu (octave::base_qobject& oct_qobj, + octave::interpreter& interp, const graphics_object& go, QMenu *xmenu) - : Object (go, xmenu) + : Object (oct_qobj, interp, go, xmenu) { xmenu->setAutoFillBackground (true); @@ -116,13 +117,14 @@ } void - ContextMenu::executeAt (const base_properties& props, const QPoint& pt) + ContextMenu::executeAt (octave::interpreter& interp, + const base_properties& props, const QPoint& pt) { graphics_handle h = props.get_uicontextmenu (); if (h.ok ()) { - gh_manager& gh_mgr = octave::__get_gh_manager__ ("ContextMenu::executeAt"); + gh_manager& gh_mgr = interp.get_gh_manager (); octave::autolock guard (gh_mgr.graphics_lock ()); graphics_object go = gh_mgr.get_object (h);
--- a/libgui/graphics/ContextMenu.h Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/ContextMenu.h Wed Nov 06 12:42:12 2019 -0500 @@ -33,6 +33,7 @@ namespace octave { class base_qobject; + class interpreter; } namespace QtHandles @@ -43,14 +44,16 @@ Q_OBJECT public: - ContextMenu (octave::base_qobject& oct_qobj, const graphics_object& go, - QMenu *menu); + ContextMenu (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_object& go, QMenu *menu); ~ContextMenu (void); - static ContextMenu * create (octave::base_qobject& oct_qobj, - const graphics_object& go); + static ContextMenu * + create (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_object& go); - static void executeAt (const base_properties& props, const QPoint& pt); + static void executeAt (octave::interpreter& interp, + const base_properties& props, const QPoint& pt); Container * innerContainer (void) { return nullptr; }
--- a/libgui/graphics/EditControl.cc Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/EditControl.cc Wed Nov 06 12:42:12 2019 -0500 @@ -38,9 +38,9 @@ EditControl* EditControl::create (octave::base_qobject& oct_qobj, - const graphics_object& go) + octave::interpreter& interp, const graphics_object& go) { - Object *parent = Object::parentObject (go); + Object *parent = parentObject (interp, go); if (parent) { @@ -51,9 +51,11 @@ uicontrol::properties& up = Utils::properties<uicontrol> (go); if ((up.get_max () - up.get_min ()) > 1) - return new EditControl (oct_qobj, go, new TextEdit (container)); + return new EditControl (oct_qobj, interp, go, + new TextEdit (container)); else - return new EditControl (oct_qobj, go, new QLineEdit (container)); + return new EditControl (oct_qobj, interp, go, + new QLineEdit (container)); } } @@ -61,8 +63,9 @@ } EditControl::EditControl (octave::base_qobject& oct_qobj, + octave::interpreter& interp, const graphics_object& go, QLineEdit *edit) - : BaseControl (oct_qobj, go, edit), m_multiLine (false), + : BaseControl (oct_qobj, interp, go, edit), m_multiLine (false), m_textChanged (false) { init (edit); @@ -92,8 +95,9 @@ } EditControl::EditControl (octave::base_qobject& oct_qobj, + octave::interpreter& interp, const graphics_object& go, TextEdit *edit) - : BaseControl (oct_qobj, go, edit), m_multiLine (true), + : BaseControl (oct_qobj, interp, go, edit), m_multiLine (true), m_textChanged (false) { init (edit);
--- a/libgui/graphics/EditControl.h Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/EditControl.h Wed Nov 06 12:42:12 2019 -0500 @@ -31,6 +31,7 @@ namespace octave { class base_qobject; + class interpreter; } namespace QtHandles @@ -43,16 +44,17 @@ Q_OBJECT public: - EditControl (octave::base_qobject& oct_qobj, const graphics_object& go, - QLineEdit *edit); + EditControl (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_object& go, QLineEdit *edit); - EditControl (octave::base_qobject& oct_qobj, const graphics_object& go, - TextEdit *edit); + EditControl (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_object& go, TextEdit *edit); ~EditControl (void); - static EditControl * create (octave::base_qobject& oct_qobj, - const graphics_object& go); + static EditControl * + create (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_object& go); protected: void update (int pId);
--- a/libgui/graphics/Figure.cc Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/Figure.cc Wed Nov 06 12:42:12 2019 -0500 @@ -60,7 +60,7 @@ #include "version.h" #include "builtin-defun-decls.h" -#include "interpreter-private.h" +#include "interpreter.h" namespace QtHandles { @@ -107,18 +107,19 @@ } Figure* - Figure::create (octave::base_qobject& oct_qobj, const graphics_object& go) + Figure::create (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_object& go) { - return new Figure (oct_qobj, go, new FigureWindow ()); + return new Figure (oct_qobj, interp, go, new FigureWindow ()); } - Figure::Figure (octave::base_qobject& oct_qobj, const graphics_object& go, - FigureWindow *win) - : Object (go, win), m_blockUpdates (false), m_figureToolBar (nullptr), - m_menuBar (nullptr), m_innerRect (), m_outerRect (), - m_previousHeight (0), m_resizable (true) + Figure::Figure (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_object& go, FigureWindow *win) + : Object (oct_qobj, interp, go, win), m_blockUpdates (false), + m_figureToolBar (nullptr), m_menuBar (nullptr), m_innerRect (), + m_outerRect (), m_previousHeight (0), m_resizable (true) { - m_container = new Container (win, oct_qobj); + m_container = new Container (win, oct_qobj, interp); win->setCentralWidget (m_container); connect (m_container, SIGNAL (interpeter_event (const fcn_callback&)), @@ -194,7 +195,7 @@ QString Figure::fileName (void) { - gh_manager& gh_mgr = octave::__get_gh_manager__ ("Figure::fileName"); + gh_manager& gh_mgr = m_interpreter.get_gh_manager (); octave::autolock guard (gh_mgr.graphics_lock ()); @@ -208,7 +209,7 @@ void Figure::setFileName (const QString& name) { - gh_manager& gh_mgr = octave::__get_gh_manager__ ("Figure::setFileName"); + gh_manager& gh_mgr = m_interpreter.get_gh_manager (); octave::autolock guard (gh_mgr.graphics_lock ()); @@ -220,7 +221,7 @@ MouseMode Figure::mouseMode (void) { - gh_manager& gh_mgr = octave::__get_gh_manager__ ("Figure::mouseMode"); + gh_manager& gh_mgr = m_interpreter.get_gh_manager (); octave::autolock guard (gh_mgr.graphics_lock ()); @@ -332,7 +333,7 @@ if (canvas) { - gh_manager& gh_mgr = octave::__get_gh_manager__ ("Figure::slotGetPixels"); + gh_manager& gh_mgr = m_interpreter.get_gh_manager (); gh_mgr.process_events (); octave::autolock guard (gh_mgr.graphics_lock ()); @@ -406,7 +407,7 @@ QTimer::singleShot (0, win, SLOT (show ())); if (! fp.is___gl_window__ ()) { - gh_manager& gh_mgr = octave::__get_gh_manager__ ("Figure::update"); + gh_manager& gh_mgr = m_interpreter.get_gh_manager (); octave::autolock guard (gh_mgr.graphics_lock ()); fp.set ("__gl_window__", "on"); @@ -563,7 +564,7 @@ void Figure::updateFigureHeight (int dh) { - gh_manager& gh_mgr = octave::__get_gh_manager__ ("Figure::updateFigureHeight"); + gh_manager& gh_mgr = m_interpreter.get_gh_manager (); octave::autolock guard (gh_mgr.graphics_lock ()); graphics_object go = object (); @@ -672,7 +673,7 @@ { figure::properties& fp = properties<figure> (); - gh_manager& gh_mgr = octave::__get_gh_manager__ ("Figure::eventNotifyBefore"); + gh_manager& gh_mgr = m_interpreter.get_gh_manager (); graphics_object root = gh_mgr.get_object (0); @@ -723,7 +724,7 @@ { if (watched == m_container) { - gh_manager& gh_mgr = octave::__get_gh_manager__ ("Figure::eventNotifyAfter"); + gh_manager& gh_mgr = m_interpreter.get_gh_manager (); switch (xevent->type ()) { @@ -860,7 +861,7 @@ QWindow* window = qWidget<QMainWindow> ()->windowHandle (); QScreen* screen = window->screen (); - gh_manager& gh_mgr = octave::__get_gh_manager__ ("Figure::figureWindowShown"); + gh_manager& gh_mgr = m_interpreter.get_gh_manager (); octave::autolock guard (gh_mgr.graphics_lock ()); @@ -876,7 +877,7 @@ Figure::screenChanged (QScreen* screen) { #if defined (HAVE_QSCREEN_DEVICEPIXELRATIO) - gh_manager& gh_mgr = octave::__get_gh_manager__ ("Figure::screenChanged"); + gh_manager& gh_mgr = m_interpreter.get_gh_manager (); octave::autolock guard (gh_mgr.graphics_lock ());
--- a/libgui/graphics/Figure.h Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/Figure.h Wed Nov 06 12:42:12 2019 -0500 @@ -37,6 +37,7 @@ namespace octave { class base_qobject; + class interpreter; } namespace QtHandles @@ -68,12 +69,13 @@ friend class ToolBar; public: - Figure (octave::base_qobject& oct_qobj, const graphics_object& go, - FigureWindow *win); + Figure (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_object& go, FigureWindow *win); ~Figure (void); - static Figure * create (octave::base_qobject& oct_qobj, - const graphics_object& go); + static Figure * + create (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_object& go); QString fileName (void); void setFileName (const QString& name);
--- a/libgui/graphics/GLCanvas.cc Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/GLCanvas.cc Wed Nov 06 12:42:12 2019 -0500 @@ -30,7 +30,7 @@ #include "gl-render.h" #include "gl2ps-print.h" #include "graphics.h" -#include "interpreter-private.h" +#include "interpreter.h" namespace QtHandles { @@ -48,9 +48,10 @@ #endif GLCanvas::GLCanvas (octave::base_qobject& oct_qobj, + octave::interpreter& interp, const graphics_handle& gh, QWidget *xparent) : OCTAVE_QT_OPENGL_WIDGET (OCTAVE_QT_OPENGL_WIDGET_FORMAT_ARGS xparent), - Canvas (oct_qobj, gh), m_glfcns (), m_renderer (m_glfcns) + Canvas (oct_qobj, interp, gh), m_glfcns (), m_renderer (m_glfcns) { setFocusPolicy (Qt::ClickFocus); setFocus (); @@ -68,7 +69,7 @@ void GLCanvas::draw (const graphics_handle& gh) { - gh_manager& gh_mgr = octave::__get_gh_manager__ ("GLCanvas::draw"); + gh_manager& gh_mgr = m_interpreter.get_gh_manager (); octave::autolock guard (gh_mgr.graphics_lock ()); @@ -89,7 +90,7 @@ { uint8NDArray retval; - gh_manager& gh_mgr = octave::__get_gh_manager__ ("GLCanvas::do_getPixels"); + gh_manager& gh_mgr = m_interpreter.get_gh_manager (); graphics_object go = gh_mgr.get_object (gh); @@ -141,7 +142,7 @@ GLCanvas::do_print (const QString& file_cmd, const QString& term, const graphics_handle& handle) { - gh_manager& gh_mgr = octave::__get_gh_manager__ ("GLCanvas::do_print"); + gh_manager& gh_mgr = m_interpreter.get_gh_manager (); octave::autolock guard (gh_mgr.graphics_lock ());
--- a/libgui/graphics/GLCanvas.h Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/GLCanvas.h Wed Nov 06 12:42:12 2019 -0500 @@ -56,8 +56,8 @@ class GLCanvas : public OCTAVE_QT_OPENGL_WIDGET, public Canvas { public: - GLCanvas (octave::base_qobject& oct_qobj, const graphics_handle& handle, - QWidget *parent); + GLCanvas (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_handle& handle, QWidget *parent); ~GLCanvas (void); void initializeGL (void);
--- a/libgui/graphics/ListBoxControl.cc Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/ListBoxControl.cc Wed Nov 06 12:42:12 2019 -0500 @@ -68,24 +68,27 @@ ListBoxControl* ListBoxControl::create (octave::base_qobject& oct_qobj, + octave::interpreter& interp, const graphics_object& go) { - Object *parent = Object::parentObject (go); + Object *parent = parentObject (interp, go); if (parent) { Container *container = parent->innerContainer (); if (container) - return new ListBoxControl (oct_qobj, go, new QListWidget (container)); + return new ListBoxControl (oct_qobj, interp, go, + new QListWidget (container)); } return nullptr; } ListBoxControl::ListBoxControl (octave::base_qobject& oct_qobj, + octave::interpreter& interp, const graphics_object& go, QListWidget *list) - : BaseControl (oct_qobj, go, list), m_blockCallback (false), + : BaseControl (oct_qobj, interp, go, list), m_blockCallback (false), m_selectionChanged (false) { uicontrol::properties& up = properties<uicontrol> ();
--- a/libgui/graphics/ListBoxControl.h Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/ListBoxControl.h Wed Nov 06 12:42:12 2019 -0500 @@ -32,6 +32,7 @@ namespace octave { class base_qobject; + class interpreter; } namespace QtHandles @@ -42,12 +43,14 @@ Q_OBJECT public: - ListBoxControl (octave::base_qobject& oct_qobj, const graphics_object& go, + ListBoxControl (octave::base_qobject& oct_qobj, + octave::interpreter& interp, const graphics_object& go, QListWidget *list); ~ListBoxControl (void); - static ListBoxControl * create (octave::base_qobject& oct_qobj, - const graphics_object& go); + static ListBoxControl * + create (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_object& go); protected: void update (int pId);
--- a/libgui/graphics/Menu.cc Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/Menu.cc Wed Nov 06 12:42:12 2019 -0500 @@ -60,24 +60,27 @@ } Menu* - Menu::create (octave::base_qobject& oct_qobj, const graphics_object& go) + Menu::create (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_object& go) { - Object *parent_obj = Object::parentObject (go); + Object *parent_obj = parentObject (interp, go); if (parent_obj) { QObject *qObj = parent_obj->qObject (); if (qObj) - return new Menu (oct_qobj, go, new QAction (qObj), parent_obj); + return new Menu (oct_qobj, interp, go, new QAction (qObj), + parent_obj); } return nullptr; } - Menu::Menu (octave::base_qobject&, const graphics_object& go, - QAction *action, Object *xparent) - : Object (go, action), m_parent (nullptr), m_separator (nullptr) + Menu::Menu (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_object& go, QAction *action, Object *xparent) + : Object (oct_qobj, interp, go, action), m_parent (nullptr), + m_separator (nullptr) { uimenu::properties& up = properties<uimenu> ();
--- a/libgui/graphics/Menu.h Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/Menu.h Wed Nov 06 12:42:12 2019 -0500 @@ -33,6 +33,7 @@ namespace octave { class base_qobject; + class interpreter; } namespace QtHandles @@ -43,12 +44,13 @@ Q_OBJECT public: - Menu (octave::base_qobject& oct_qobj, const graphics_object& go, - QAction *action, Object *parent); + Menu (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_object& go, QAction *action, Object *parent); ~Menu (void); - static Menu * create (octave::base_qobject& oct_qobj, - const graphics_object& go); + static Menu * + create (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_object& go); Container * innerContainer (void) { return nullptr; }
--- a/libgui/graphics/Object.cc Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/Object.cc Wed Nov 06 12:42:12 2019 -0500 @@ -29,18 +29,21 @@ #include "Object.h" #include "QtHandlesUtils.h" +#include "octave-qobject.h" #include "qt-graphics-toolkit.h" #include "graphics.h" -#include "interpreter-private.h" +#include "interpreter.h" namespace QtHandles { - Object::Object (const graphics_object& go, QObject *obj) - : QObject (), m_go (go), m_handle (go.get_handle ()), m_qobject (nullptr) + Object::Object (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_object& go, QObject *obj) + : QObject (), m_octave_qobj (oct_qobj), m_interpreter (interp), + m_go (go), m_handle (go.get_handle ()), m_qobject (nullptr) { - gh_manager& gh_mgr = octave::__get_gh_manager__ ("Object::Object"); + gh_manager& gh_mgr = m_interpreter.get_gh_manager (); octave::autolock guard (gh_mgr.graphics_lock ()); @@ -76,7 +79,7 @@ graphics_object Object::object (void) const { - gh_manager& gh_mgr = octave::__get_gh_manager__ ("Object::object"); + gh_manager& gh_mgr = m_interpreter.get_gh_manager (); octave::autolock guard (gh_mgr.graphics_lock (), false); @@ -91,7 +94,7 @@ void Object::slotUpdate (int pId) { - gh_manager& gh_mgr = octave::__get_gh_manager__ ("Object::slotUpdate"); + gh_manager& gh_mgr = m_interpreter.get_gh_manager (); octave::autolock guard (gh_mgr.graphics_lock ()); @@ -114,7 +117,7 @@ void Object::slotFinalize (void) { - gh_manager& gh_mgr = octave::__get_gh_manager__ ("Object::slotFinalize"); + gh_manager& gh_mgr = m_interpreter.get_gh_manager (); octave::autolock guard (gh_mgr.graphics_lock ()); @@ -124,7 +127,7 @@ void Object::slotRedraw (void) { - gh_manager& gh_mgr = octave::__get_gh_manager__ ("Object::slotRedraw"); + gh_manager& gh_mgr = m_interpreter.get_gh_manager (); octave::autolock guard (gh_mgr.graphics_lock ()); @@ -135,7 +138,7 @@ void Object::slotShow (void) { - gh_manager& gh_mgr = octave::__get_gh_manager__ ("Object::slotShow"); + gh_manager& gh_mgr = m_interpreter.get_gh_manager (); octave::autolock guard (gh_mgr.graphics_lock ()); @@ -146,7 +149,7 @@ void Object::slotPrint (const QString& file_cmd, const QString& term) { - gh_manager& gh_mgr = octave::__get_gh_manager__ ("Object::slotPrint"); + gh_manager& gh_mgr = m_interpreter.get_gh_manager (); octave::autolock guard (gh_mgr.graphics_lock ()); @@ -192,9 +195,9 @@ } Object* - Object::parentObject (const graphics_object& go) + Object::parentObject (octave::interpreter& interp, const graphics_object& go) { - gh_manager& gh_mgr = octave::__get_gh_manager__ ("Object::parentObject"); + gh_manager& gh_mgr = interp.get_gh_manager (); octave::autolock guard (gh_mgr.graphics_lock ());
--- a/libgui/graphics/Object.h Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/Object.h Wed Nov 06 12:42:12 2019 -0500 @@ -32,6 +32,12 @@ class QString; class QWidget; +namespace octave +{ + class base_qobject; + class interpreter; +} + namespace QtHandles { @@ -43,7 +49,8 @@ Q_OBJECT public: - Object (const graphics_object& go, QObject *obj = nullptr); + Object (octave::base_qobject& qobj, octave::interpreter& interp, + const graphics_object& go, QObject *obj = nullptr); virtual ~Object (void); @@ -111,7 +118,9 @@ void objectDestroyed (QObject *obj = nullptr); protected: - static Object * parentObject (const graphics_object& go); + static Object * + parentObject (octave::interpreter& interp, const graphics_object& go); + void init (QObject *obj, bool callBase = false); virtual void update (int pId); @@ -124,6 +133,9 @@ protected: + octave::base_qobject& m_octave_qobj; + octave::interpreter& m_interpreter; + // Store the graphics object directly so that it will exist when // we need it. Previously, it was possible for the graphics // toolkit to get a handle to a figure, then have the interpreter
--- a/libgui/graphics/Panel.cc Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/Panel.cc Wed Nov 06 12:42:12 2019 -0500 @@ -39,7 +39,7 @@ #include "octave-qobject.h" #include "graphics.h" -#include "interpreter-private.h" +#include "interpreter.h" namespace QtHandles { @@ -90,25 +90,26 @@ } Panel* - Panel::create (octave::base_qobject& oct_qobj, const graphics_object& go) + Panel::create (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_object& go) { - Object *parent = Object::parentObject (go); + Object *parent = parentObject (interp, go); if (parent) { Container *container = parent->innerContainer (); if (container) - return new Panel (oct_qobj, go, new QFrame (container)); + return new Panel (oct_qobj, interp, go, new QFrame (container)); } return nullptr; } - Panel::Panel (octave::base_qobject& oct_qobj, const graphics_object& go, - QFrame *frame) - : Object (go, frame), m_container (nullptr), m_title (nullptr), - m_blockUpdates (false) + Panel::Panel (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_object& go, QFrame *frame) + : Object (oct_qobj, interp, go, frame), m_container (nullptr), + m_title (nullptr), m_blockUpdates (false) { uipanel::properties& pp = properties<uipanel> (); @@ -123,7 +124,7 @@ setupPalette (pp, pal); frame->setPalette (pal); - m_container = new Container (frame, oct_qobj); + m_container = new Container (frame, oct_qobj, interp); m_container->canvas (m_handle); connect (m_container, SIGNAL (interpeter_event (const fcn_callback&)), @@ -172,7 +173,7 @@ { if (! m_blockUpdates) { - gh_manager& gh_mgr = octave::__get_gh_manager__ ("Panel::eventFilter"); + gh_manager& gh_mgr = m_interpreter.get_gh_manager (); if (watched == qObject ()) { @@ -216,7 +217,8 @@ graphics_object go = object (); if (go.valid_object ()) - ContextMenu::executeAt (go.get_properties (), + ContextMenu::executeAt (m_interpreter, + go.get_properties (), m->globalPos ()); } }
--- a/libgui/graphics/Panel.h Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/Panel.h Wed Nov 06 12:42:12 2019 -0500 @@ -31,6 +31,7 @@ namespace octave { class base_qobject; + class interpreter; } namespace QtHandles @@ -41,16 +42,17 @@ class Panel : public Object { public: - Panel (octave::base_qobject& oct_qobj, const graphics_object& go, - QFrame *frame); + Panel (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_object& go, QFrame *frame); ~Panel (void); Container * innerContainer (void) { return m_container; } bool eventFilter (QObject *watched, QEvent *event); - static Panel * create (octave::base_qobject& oct_qobj, - const graphics_object& go); + static Panel * + create (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_object& go); void do_connections (const QObject *receiver, const QObject *emitter = nullptr);
--- a/libgui/graphics/PopupMenuControl.cc Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/PopupMenuControl.cc Wed Nov 06 12:42:12 2019 -0500 @@ -37,16 +37,17 @@ PopupMenuControl* PopupMenuControl::create (octave::base_qobject& oct_qobj, + octave::interpreter& interp, const graphics_object& go) { - Object *parent = Object::parentObject (go); + Object *parent = parentObject (interp, go); if (parent) { Container *container = parent->innerContainer (); if (container) - return new PopupMenuControl (oct_qobj, go, + return new PopupMenuControl (oct_qobj, interp, go, new QComboBox (container)); } @@ -54,8 +55,10 @@ } PopupMenuControl::PopupMenuControl (octave::base_qobject& oct_qobj, - const graphics_object& go, QComboBox *box) - : BaseControl (oct_qobj, go, box), m_blockUpdate (false) + octave::interpreter& interp, + const graphics_object& go, + QComboBox *box) + : BaseControl (oct_qobj, interp, go, box), m_blockUpdate (false) { uicontrol::properties& up = properties<uicontrol> ();
--- a/libgui/graphics/PopupMenuControl.h Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/PopupMenuControl.h Wed Nov 06 12:42:12 2019 -0500 @@ -30,6 +30,7 @@ namespace octave { class base_qobject; + class interpreter; } namespace QtHandles @@ -41,11 +42,13 @@ public: PopupMenuControl (octave::base_qobject& oct_qobj, - const graphics_object& go, QComboBox *box); + octave::interpreter& interp, const graphics_object& go, + QComboBox *box); ~PopupMenuControl (void); - static PopupMenuControl * create (octave::base_qobject& oct_qobj, - const graphics_object& go); + static PopupMenuControl * + create (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_object& go); protected: void update (int pId);
--- a/libgui/graphics/PushButtonControl.cc Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/PushButtonControl.cc Wed Nov 06 12:42:12 2019 -0500 @@ -38,16 +38,17 @@ PushButtonControl* PushButtonControl::create (octave::base_qobject& oct_qobj, + octave::interpreter& interp, const graphics_object& go) { - Object *parent = Object::parentObject (go); + Object *parent = parentObject (interp, go); if (parent) { Container *container = parent->innerContainer (); if (container) - return new PushButtonControl (oct_qobj, go, + return new PushButtonControl (oct_qobj, interp, go, new QPushButton (container)); } @@ -55,9 +56,10 @@ } PushButtonControl::PushButtonControl (octave::base_qobject& oct_qobj, + octave::interpreter& interp, const graphics_object& go, QPushButton *btn) - : ButtonControl (oct_qobj, go, btn) + : ButtonControl (oct_qobj, interp, go, btn) { uicontrol::properties& up = properties<uicontrol> ();
--- a/libgui/graphics/PushButtonControl.h Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/PushButtonControl.h Wed Nov 06 12:42:12 2019 -0500 @@ -30,6 +30,7 @@ namespace octave { class base_qobject; + class interpreter; } namespace QtHandles @@ -38,12 +39,14 @@ class PushButtonControl : public ButtonControl { public: - PushButtonControl (octave::base_qobject& oct_qobj, const graphics_object& go, + PushButtonControl (octave::base_qobject& oct_qobj, + octave::interpreter& interp, const graphics_object& go, QPushButton *btn); ~PushButtonControl (void); - static PushButtonControl * create (octave::base_qobject& oct_qobj, - const graphics_object& go); + static PushButtonControl * + create (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_object& go); protected: void update (int pId);
--- a/libgui/graphics/PushTool.cc Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/PushTool.cc Wed Nov 06 12:42:12 2019 -0500 @@ -34,24 +34,27 @@ { PushTool* - PushTool::create (octave::base_qobject& oct_qobj, const graphics_object& go) + PushTool::create (octave::base_qobject& oct_qobj, + octave::interpreter& interp, const graphics_object& go) { - Object *parent = Object::parentObject (go); + Object *parent = parentObject (interp, go); if (parent) { QWidget *parentWidget = parent->qWidget<QWidget> (); if (parentWidget) - return new PushTool (oct_qobj, go, new QAction (parentWidget)); + return new PushTool (oct_qobj, interp, go, + new QAction (parentWidget)); } return nullptr; } PushTool::PushTool (octave::base_qobject& oct_qobj, + octave::interpreter& interp, const graphics_object& go, QAction *action) - : ToolBarButton<uipushtool> (oct_qobj, go, action) + : ToolBarButton<uipushtool> (oct_qobj, interp, go, action) { connect (action, SIGNAL (triggered (bool)), this, SLOT (clicked (void))); }
--- a/libgui/graphics/PushTool.h Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/PushTool.h Wed Nov 06 12:42:12 2019 -0500 @@ -28,6 +28,7 @@ namespace octave { class base_qobject; + class interpreter; } namespace QtHandles @@ -38,12 +39,13 @@ Q_OBJECT public: - PushTool (octave::base_qobject& oct_qobj, const graphics_object& go, - QAction *action); + PushTool (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_object& go, QAction *action); ~PushTool (void); - static PushTool * create (octave::base_qobject& oct_qobj, - const graphics_object& go); + static PushTool * + create (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_object& go); protected: void update (int pId);
--- a/libgui/graphics/QtHandlesUtils.h Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/QtHandlesUtils.h Wed Nov 06 12:42:12 2019 -0500 @@ -32,7 +32,6 @@ #include <string> #include "graphics.h" -#include "interpreter-private.h" class QKeyEvent; class QMouseEvent; @@ -71,15 +70,6 @@ properties (graphics_object obj) { return dynamic_cast<typename T::properties&> (obj.get_properties ()); } - template <typename T> - inline typename T::properties& - properties (const graphics_handle& h) - { - gh_manager& gh_mgr = octave::__get_gh_manager__ ("Utils::properties"); - - return Utils::properties<T> (gh_mgr.get_object (h)); - } - QImage makeImageFromCData (const octave_value& v, int width = -1, int height = -1);
--- a/libgui/graphics/RadioButtonControl.cc Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/RadioButtonControl.cc Wed Nov 06 12:42:12 2019 -0500 @@ -38,16 +38,17 @@ RadioButtonControl* RadioButtonControl::create (octave::base_qobject& oct_qobj, + octave::interpreter& interp, const graphics_object& go) { - Object *parent = Object::parentObject (go); + Object *parent = parentObject (interp, go); if (parent) { Container *container = parent->innerContainer (); if (container) - return new RadioButtonControl (oct_qobj, go, + return new RadioButtonControl (oct_qobj, interp, go, new QRadioButton (container)); } @@ -55,11 +56,12 @@ } RadioButtonControl::RadioButtonControl (octave::base_qobject& oct_qobj, + octave::interpreter& interp, const graphics_object& go, QRadioButton *radio) - : ButtonControl (oct_qobj, go, radio) + : ButtonControl (oct_qobj, interp, go, radio) { - Object *parent = Object::parentObject (go); + Object *parent = parentObject (interp, go); ButtonGroup *btnGroup = dynamic_cast<ButtonGroup *>(parent); if (btnGroup) btnGroup->addButton (radio);
--- a/libgui/graphics/RadioButtonControl.h Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/RadioButtonControl.h Wed Nov 06 12:42:12 2019 -0500 @@ -30,6 +30,7 @@ namespace octave { class base_qobject; + class interpreter; } namespace QtHandles @@ -38,11 +39,13 @@ class RadioButtonControl : public ButtonControl { public: - RadioButtonControl (octave::base_qobject& oct_qobj, const graphics_object& go, + RadioButtonControl (octave::base_qobject& oct_qobj, + octave::interpreter& interp, const graphics_object& go, QRadioButton *box); ~RadioButtonControl (void); static RadioButtonControl * create (octave::base_qobject& oct_qobj, + octave::interpreter& interp, const graphics_object& go); };
--- a/libgui/graphics/SliderControl.cc Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/SliderControl.cc Wed Nov 06 12:42:12 2019 -0500 @@ -33,7 +33,7 @@ #include "octave-qobject.h" #include "graphics.h" -#include "interpreter-private.h" +#include "interpreter.h" #define RANGE_INT_MAX 1000000 @@ -42,25 +42,28 @@ SliderControl* SliderControl::create (octave::base_qobject& oct_qobj, + octave::interpreter& interp, const graphics_object& go) { - Object *parent = Object::parentObject (go); + Object *parent = parentObject (interp, go); if (parent) { Container *container = parent->innerContainer (); if (container) - return new SliderControl (oct_qobj, go, new QScrollBar (container)); + return new SliderControl (oct_qobj, interp, go, + new QScrollBar (container)); } return nullptr; } SliderControl::SliderControl (octave::base_qobject& oct_qobj, + octave::interpreter& interp, const graphics_object& go, QAbstractSlider *slider) - : BaseControl (oct_qobj, go, slider), m_blockUpdates (false) + : BaseControl (oct_qobj, interp, go, slider), m_blockUpdates (false) { uicontrol::properties& up = properties<uicontrol> (); @@ -135,7 +138,7 @@ { if (! m_blockUpdates) { - gh_manager& gh_mgr = octave::__get_gh_manager__ ("SliderControl::valueChanged"); + gh_manager& gh_mgr = m_interpreter.get_gh_manager (); octave::autolock guard (gh_mgr.graphics_lock ());
--- a/libgui/graphics/SliderControl.h Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/SliderControl.h Wed Nov 06 12:42:12 2019 -0500 @@ -30,6 +30,7 @@ namespace octave { class base_qobject; + class interpreter; } namespace QtHandles @@ -40,12 +41,13 @@ Q_OBJECT public: - SliderControl (octave::base_qobject& oct_qobj, const graphics_object& go, - QAbstractSlider *slider); + SliderControl (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_object& go, QAbstractSlider *slider); ~SliderControl (void); - static SliderControl * create (octave::base_qobject& oct_qobj, - const graphics_object& go); + static SliderControl * + create (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_object& go); protected: void update (int pId);
--- a/libgui/graphics/Table.cc Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/Table.cc Wed Nov 06 12:42:12 2019 -0500 @@ -48,7 +48,7 @@ #include "octave-qobject.h" #include "graphics.h" -#include "interpreter-private.h" +#include "interpreter.h" #include "oct-stream.h" #include "oct-string.h" #include "oct-strstrm.h" @@ -426,25 +426,26 @@ } Table* - Table::create (octave::base_qobject& oct_qobj, const graphics_object& go) + Table::create (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_object& go) { - Object *parent = Object::parentObject (go); + Object *parent = parentObject (interp, go); if (parent) { Container *container = parent->innerContainer (); if (container) - return new Table (oct_qobj, go, new QTableWidget (container)); + return new Table (oct_qobj, interp, go, new QTableWidget (container)); } return 0; } - Table::Table (octave::base_qobject&, const graphics_object& go, - QTableWidget *tableWidget) - : Object (go, tableWidget), m_tableWidget (tableWidget), m_curData (), - m_blockUpdates (false) + Table::Table (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_object& go, QTableWidget *tableWidget) + : Object (oct_qobj, interp, go, tableWidget), m_tableWidget (tableWidget), + m_curData (), m_blockUpdates (false) { qObject ()->setObjectName ("UItable"); uitable::properties& tp = properties<uitable> (); @@ -565,7 +566,7 @@ m_blockUpdates = true; - gh_manager& gh_mgr = octave::__get_gh_manager__ ("Table::comboBoxCurrentIndexChanged"); + gh_manager& gh_mgr = m_interpreter.get_gh_manager (); octave::autolock guard (gh_mgr.graphics_lock ()); @@ -685,7 +686,7 @@ return; m_blockUpdates = true; - gh_manager& gh_mgr = octave::__get_gh_manager__ ("Table::checkBoxClicked"); + gh_manager& gh_mgr = m_interpreter.get_gh_manager (); octave::autolock guard (gh_mgr.graphics_lock ()); @@ -801,7 +802,7 @@ return; m_blockUpdates = true; - gh_manager& gh_mgr = octave::__get_gh_manager__ ("Table::itemChanged"); + gh_manager& gh_mgr = m_interpreter.get_gh_manager (); octave::autolock guard (gh_mgr.graphics_lock ()); @@ -1512,7 +1513,7 @@ bool Table::eventFilter (QObject *watched, QEvent *xevent) { - gh_manager& gh_mgr = octave::__get_gh_manager__ ("Table::eventFilter"); + gh_manager& gh_mgr = m_interpreter.get_gh_manager (); //uitable::properties& tp = properties<uitable> (); if (qobject_cast<QTableWidget *> (watched)) @@ -1556,7 +1557,8 @@ emit gh_callback_event (m_handle, "buttondownfcn"); if (m->button () == Qt::RightButton) - ContextMenu::executeAt (properties (), m->globalPos ()); + ContextMenu::executeAt (m_interpreter, properties (), + m->globalPos ()); } else { @@ -1698,7 +1700,7 @@ emit gh_callback_event (m_handle, "buttondownfcn"); if (m->button () == Qt::RightButton) - ContextMenu::executeAt (tp, m->globalPos ()); + ContextMenu::executeAt (m_interpreter, tp, m->globalPos ()); } else {
--- a/libgui/graphics/Table.h Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/Table.h Wed Nov 06 12:42:12 2019 -0500 @@ -32,6 +32,7 @@ namespace octave { class base_qobject; + class interpreter; } namespace QtHandles @@ -44,16 +45,17 @@ Q_OBJECT public: - Table (octave::base_qobject& oct_qobj, const graphics_object& go, - QTableWidget* tableWidget); + Table (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_object& go, QTableWidget* tableWidget); ~Table (void); Container* innerContainer (void) { return m_container; } bool eventFilter (QObject* watched, QEvent* event); - static Table* create (octave::base_qobject& oct_qobj, - const graphics_object& go); + static Table * + create (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_object& go); protected: void update (int pId);
--- a/libgui/graphics/TextControl.cc Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/TextControl.cc Wed Nov 06 12:42:12 2019 -0500 @@ -37,24 +37,25 @@ TextControl* TextControl::create (octave::base_qobject& oct_qobj, - const graphics_object& go) + octave::interpreter& interp, const graphics_object& go) { - Object *parent = Object::parentObject (go); + Object *parent = parentObject (interp, go); if (parent) { Container *container = parent->innerContainer (); if (container) - return new TextControl (oct_qobj, go, new QLabel (container)); + return new TextControl (oct_qobj, interp, go, new QLabel (container)); } return nullptr; } TextControl::TextControl (octave::base_qobject& oct_qobj, + octave::interpreter& interp, const graphics_object& go, QLabel *label) - : BaseControl (oct_qobj, go, label) + : BaseControl (oct_qobj, interp, go, label) { uicontrol::properties& up = properties<uicontrol> ();
--- a/libgui/graphics/TextControl.h Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/TextControl.h Wed Nov 06 12:42:12 2019 -0500 @@ -30,6 +30,7 @@ namespace octave { class base_qobject; + class interpreter; } namespace QtHandles @@ -38,12 +39,13 @@ class TextControl : public BaseControl { public: - TextControl (octave::base_qobject& oct_qobj, const graphics_object& go, - QLabel *label); + TextControl (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_object& go, QLabel *label); ~TextControl (void); - static TextControl * create (octave::base_qobject& oct_qobj, - const graphics_object& go); + static TextControl * + create (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_object& go); protected: void update (int pId);
--- a/libgui/graphics/ToggleButtonControl.cc Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/ToggleButtonControl.cc Wed Nov 06 12:42:12 2019 -0500 @@ -38,16 +38,17 @@ ToggleButtonControl* ToggleButtonControl::create (octave::base_qobject& oct_qobj, + octave::interpreter& interp, const graphics_object& go) { - Object *parent = Object::parentObject (go); + Object *parent = parentObject (interp, go); if (parent) { Container *container = parent->innerContainer (); if (container) - return new ToggleButtonControl (oct_qobj, go, + return new ToggleButtonControl (oct_qobj, interp, go, new QPushButton (container)); } @@ -55,11 +56,12 @@ } ToggleButtonControl::ToggleButtonControl (octave::base_qobject& oct_qobj, + octave::interpreter& interp, const graphics_object& go, QPushButton *btn) - : ButtonControl (oct_qobj, go, btn) + : ButtonControl (oct_qobj, interp, go, btn) { - Object *parent = Object::parentObject (go); + Object *parent = parentObject (interp, go); ButtonGroup *btnGroup = dynamic_cast<ButtonGroup *>(parent); if (btnGroup) btnGroup->addButton (btn);
--- a/libgui/graphics/ToggleButtonControl.h Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/ToggleButtonControl.h Wed Nov 06 12:42:12 2019 -0500 @@ -30,6 +30,7 @@ namespace octave { class base_qobject; + class interpreter; } namespace QtHandles @@ -38,12 +39,14 @@ class ToggleButtonControl : public ButtonControl { public: - ToggleButtonControl (octave::base_qobject& oct_qobj, const graphics_object& go, - QPushButton *box); + ToggleButtonControl (octave::base_qobject& oct_qobj, + octave::interpreter& interp, + const graphics_object& go, QPushButton *box); ~ToggleButtonControl (void); - static ToggleButtonControl * create (octave::base_qobject& oct_qobj, - const graphics_object& go); + static ToggleButtonControl * + create (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_object& go); protected: void update (int pId);
--- a/libgui/graphics/ToggleTool.cc Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/ToggleTool.cc Wed Nov 06 12:42:12 2019 -0500 @@ -34,24 +34,27 @@ { ToggleTool* - ToggleTool::create (octave::base_qobject& oct_qobj, const graphics_object& go) + ToggleTool::create (octave::base_qobject& oct_qobj, + octave::interpreter& interp, const graphics_object& go) { - Object *parent = Object::parentObject (go); + Object *parent = parentObject (interp, go); if (parent) { QWidget *parentWidget = parent->qWidget<QWidget> (); if (parentWidget) - return new ToggleTool (oct_qobj, go, new QAction (parentWidget)); + return new ToggleTool (oct_qobj, interp, go, + new QAction (parentWidget)); } return nullptr; } ToggleTool::ToggleTool (octave::base_qobject& oct_qobj, + octave::interpreter& interp, const graphics_object& go, QAction *action) - : ToolBarButton<uitoggletool> (oct_qobj, go, action) + : ToolBarButton<uitoggletool> (oct_qobj, interp, go, action) { uitoggletool::properties& tp = properties<uitoggletool> ();
--- a/libgui/graphics/ToggleTool.h Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/ToggleTool.h Wed Nov 06 12:42:12 2019 -0500 @@ -28,6 +28,7 @@ namespace octave { class base_qobject; + class interpreter; } namespace QtHandles @@ -38,12 +39,14 @@ Q_OBJECT public: - ToggleTool (octave::base_qobject& oct_qobj, const graphics_object& go, + ToggleTool (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_object& go, QAction *action); ~ToggleTool (void); - static ToggleTool * create (octave::base_qobject& oct_qobj, - const graphics_object& go); + static ToggleTool * + create (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_object& go); protected: void update (int pId);
--- a/libgui/graphics/ToolBar.cc Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/ToolBar.cc Wed Nov 06 12:42:12 2019 -0500 @@ -66,24 +66,26 @@ } ToolBar* - ToolBar::create (octave::base_qobject& oct_qobj, const graphics_object& go) + ToolBar::create (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_object& go) { - Object *parent = Object::parentObject (go); + Object *parent = parentObject (interp, go); if (parent) { QWidget *parentWidget = parent->qWidget<QWidget> (); if (parentWidget) - return new ToolBar (oct_qobj, go, new QToolBar (parentWidget)); + return new ToolBar (oct_qobj, interp, go, + new QToolBar (parentWidget)); } return nullptr; } - ToolBar::ToolBar (octave::base_qobject&, const graphics_object& go, - QToolBar *bar) - : Object (go, bar), m_empty (nullptr), m_figure (nullptr) + ToolBar::ToolBar (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_object& go, QToolBar *bar) + : Object (oct_qobj, interp, go, bar), m_empty (nullptr), m_figure (nullptr) { uitoolbar::properties& tp = properties<uitoolbar> ();
--- a/libgui/graphics/ToolBar.h Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/ToolBar.h Wed Nov 06 12:42:12 2019 -0500 @@ -31,6 +31,7 @@ namespace octave { class base_qobject; + class interpreter; } namespace QtHandles @@ -43,12 +44,13 @@ Q_OBJECT public: - ToolBar (octave::base_qobject& oct_qobj, const graphics_object& go, - QToolBar *bar); + ToolBar (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_object& go, QToolBar *bar); ~ToolBar (void); - static ToolBar * create (octave::base_qobject& oct_qobj, - const graphics_object& go); + static ToolBar * + create (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_object& go); Container * innerContainer (void) { return nullptr; }
--- a/libgui/graphics/ToolBarButton.cc Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/ToolBarButton.cc Wed Nov 06 12:42:12 2019 -0500 @@ -36,8 +36,9 @@ { template <typename T> ToolBarButton<T>::ToolBarButton (octave::base_qobject& oct_qobj, + octave::interpreter& interp, const graphics_object& go, QAction *action) - : Object (go, action), m_octave_qobj (oct_qobj), m_separator (nullptr) + : Object (oct_qobj, interp, go, action), m_separator (nullptr) { typename T::properties& tp = properties<T> ();
--- a/libgui/graphics/ToolBarButton.h Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/ToolBarButton.h Wed Nov 06 12:42:12 2019 -0500 @@ -31,6 +31,7 @@ namespace octave { class base_qobject; + class interpreter; } namespace QtHandles @@ -42,8 +43,8 @@ class ToolBarButton : public Object { public: - ToolBarButton (octave::base_qobject& oct_qobj, const graphics_object& go, - QAction *action); + ToolBarButton (octave::base_qobject& oct_qobj, octave::interpreter& interp, + const graphics_object& go, QAction *action); ~ToolBarButton (void); Container * innerContainer (void) { return nullptr; } @@ -52,7 +53,6 @@ void update (int pId); private: - octave::base_qobject& m_octave_qobj; QAction *m_separator; QIcon get_icon (const std::string& name);
--- a/libgui/graphics/qt-graphics-toolkit.cc Tue Nov 05 18:23:20 2019 -0500 +++ b/libgui/graphics/qt-graphics-toolkit.cc Wed Nov 06 12:42:12 2019 -0500 @@ -370,82 +370,85 @@ graphics_object go (gh_mgr.get_object (graphics_handle (handle))); - if (go.valid_object ()) + if (! go.valid_object ()) { - if (go.get_properties ().is_beingdeleted ()) - qWarning ("qt_graphics_toolkit::create_object: object is being deleted"); - else - { - ObjectProxy *proxy = qt_graphics_toolkit::toolkitObjectProxy (go); + qWarning ("qt_graphics_toolkit::create_object: invalid object for handle %g", + handle); + return; + } + + if (go.get_properties ().is_beingdeleted ()) + { + qWarning ("qt_graphics_toolkit::create_object: object is being deleted"); + return; + } + + ObjectProxy *proxy = qt_graphics_toolkit::toolkitObjectProxy (go); - if (proxy) - { - Logger::debug ("qt_graphics_toolkit::create_object: " - "create %s from thread %08x", - go.type ().c_str (), QThread::currentThreadId ()); + if (! proxy) + { + qWarning ("qt_graphics_toolkit::create_object: no proxy for handle %g", + handle); + return; + } - Object *obj = nullptr; + Logger::debug ("qt_graphics_toolkit::create_object: " + "create %s from thread %08x", + go.type ().c_str (), QThread::currentThreadId ()); + + Object *obj = nullptr; - if (go.isa ("figure")) - obj = Figure::create (m_octave_qobj, go); - else if (go.isa ("uicontrol")) - { - uicontrol::properties& up = - Utils::properties<uicontrol> (go); + if (go.isa ("figure")) + obj = Figure::create (m_octave_qobj, m_interpreter, go); + else if (go.isa ("uicontrol")) + { + uicontrol::properties& up = + Utils::properties<uicontrol> (go); - if (up.style_is ("pushbutton")) - obj = PushButtonControl::create (m_octave_qobj, go); - else if (up.style_is ("edit")) - obj = EditControl::create (m_octave_qobj, go); - else if (up.style_is ("checkbox")) - obj = CheckBoxControl::create (m_octave_qobj, go); - else if (up.style_is ("radiobutton")) - obj = RadioButtonControl::create (m_octave_qobj, go); - else if (up.style_is ("togglebutton")) - obj = ToggleButtonControl::create (m_octave_qobj, go); - else if (up.style_is ("text")) - obj = TextControl::create (m_octave_qobj, go); - else if (up.style_is ("popupmenu")) - obj = PopupMenuControl::create (m_octave_qobj, go); - else if (up.style_is ("slider")) - obj = SliderControl::create (m_octave_qobj, go); - else if (up.style_is ("listbox")) - obj = ListBoxControl::create (m_octave_qobj, go); - } - else if (go.isa ("uibuttongroup")) - obj = ButtonGroup::create (m_octave_qobj, go); - else if (go.isa ("uipanel")) - obj = Panel::create (m_octave_qobj, go); - else if (go.isa ("uimenu")) - obj = Menu::create (m_octave_qobj, go); - else if (go.isa ("uicontextmenu")) - obj = ContextMenu::create (m_octave_qobj, go); - else if (go.isa ("uitable")) - obj = Table::create (m_octave_qobj, go); - else if (go.isa ("uitoolbar")) - obj = ToolBar::create (m_octave_qobj, go); - else if (go.isa ("uipushtool")) - obj = PushTool::create (m_octave_qobj, go); - else if (go.isa ("uitoggletool")) - obj = ToggleTool::create (m_octave_qobj, go); - else - qWarning ("qt_graphics_toolkit::create_object: unsupported type '%s'", - go.type ().c_str ()); + if (up.style_is ("pushbutton")) + obj = PushButtonControl::create (m_octave_qobj, m_interpreter, go); + else if (up.style_is ("edit")) + obj = EditControl::create (m_octave_qobj, m_interpreter, go); + else if (up.style_is ("checkbox")) + obj = CheckBoxControl::create (m_octave_qobj, m_interpreter, go); + else if (up.style_is ("radiobutton")) + obj = RadioButtonControl::create (m_octave_qobj, m_interpreter, go); + else if (up.style_is ("togglebutton")) + obj = ToggleButtonControl::create (m_octave_qobj, m_interpreter, go); + else if (up.style_is ("text")) + obj = TextControl::create (m_octave_qobj, m_interpreter, go); + else if (up.style_is ("popupmenu")) + obj = PopupMenuControl::create (m_octave_qobj, m_interpreter, go); + else if (up.style_is ("slider")) + obj = SliderControl::create (m_octave_qobj, m_interpreter, go); + else if (up.style_is ("listbox")) + obj = ListBoxControl::create (m_octave_qobj, m_interpreter, go); + } + else if (go.isa ("uibuttongroup")) + obj = ButtonGroup::create (m_octave_qobj, m_interpreter, go); + else if (go.isa ("uipanel")) + obj = Panel::create (m_octave_qobj, m_interpreter, go); + else if (go.isa ("uimenu")) + obj = Menu::create (m_octave_qobj, m_interpreter, go); + else if (go.isa ("uicontextmenu")) + obj = ContextMenu::create (m_octave_qobj, m_interpreter, go); + else if (go.isa ("uitable")) + obj = Table::create (m_octave_qobj, m_interpreter, go); + else if (go.isa ("uitoolbar")) + obj = ToolBar::create (m_octave_qobj, m_interpreter, go); + else if (go.isa ("uipushtool")) + obj = PushTool::create (m_octave_qobj, m_interpreter, go); + else if (go.isa ("uitoggletool")) + obj = ToggleTool::create (m_octave_qobj, m_interpreter, go); + else + qWarning ("qt_graphics_toolkit::create_object: unsupported type '%s'", + go.type ().c_str ()); - if (obj) - { - proxy->setObject (obj); - obj->do_connections (this); - } - } - else - qWarning ("qt_graphics_toolkit::create_object: no proxy for handle %g", - handle); - } + if (obj) + { + proxy->setObject (obj); + obj->do_connections (this); } - else - qWarning ("qt_graphics_toolkit::create_object: invalid object for handle %g", - handle); } void qt_graphics_toolkit::gh_callback_event (const graphics_handle& h,