GNU Octave 7.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
Figure.cc
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 2011-2022 The Octave Project Developers
4//
5// See the file COPYRIGHT.md in the top-level directory of this
6// distribution or <https://octave.org/copyright/>.
7//
8// This file is part of Octave.
9//
10// Octave is free software: you can redistribute it and/or modify it
11// under the terms of the GNU General Public License as published by
12// the Free Software Foundation, either version 3 of the License, or
13// (at your option) any later version.
14//
15// Octave is distributed in the hope that it will be useful, but
16// WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18// GNU General Public License for more details.
19//
20// You should have received a copy of the GNU General Public License
21// along with Octave; see the file COPYING. If not, see
22// <https://www.gnu.org/licenses/>.
23//
24////////////////////////////////////////////////////////////////////////
25
26#if defined (HAVE_CONFIG_H)
27# include "config.h"
28#endif
29
30#include <QAction>
31#include <QActionEvent>
32#include <QApplication>
33#include <QClipboard>
34#include <QEvent>
35#include <QFileDialog>
36#include <QFileInfo>
37#include <QFrame>
38#include <QImage>
39#include <QMainWindow>
40#include <QMenu>
41#include <QMenuBar>
42#include <QMessageBox>
43#include <QtDebug>
44#include <QTimer>
45#include <QToolBar>
46#if defined (HAVE_QSCREEN_DEVICEPIXELRATIO)
47# include <QWindow>
48# include <QScreen>
49#endif
50
51#include "Canvas.h"
52#include "Container.h"
53#include "Figure.h"
54#include "FigureWindow.h"
55#include "QtHandlesUtils.h"
56
59
60#include "file-ops.h"
61#include "unwind-prot.h"
62#include "utils.h"
63#include "version.h"
64
65#include "builtin-defun-decls.h"
66#include "interpreter.h"
67
68namespace octave
69{
70
72
73 static QRect
75 {
76 QRect r;
77
78 if (bb.numel () == 4)
79 {
80 r = QRect (octave::math::round (bb(0)), octave::math::round (bb(1)),
82 if (! r.isValid ())
83 r = QRect ();
84 }
85
86 return r;
87 }
88
89 static QImage
91 {
92 QImage retval (cdata.rows (), cdata.columns (), QImage::Format_ARGB32);
93 QColor tmp ("White");
94 QColor black ("Black");
95 QColor white ("White");
96 for (octave_idx_type ii = 0; ii < cdata.rows (); ii++)
97 for (octave_idx_type jj = 0; jj < cdata.columns (); jj++)
98 {
99 if (cdata(ii, jj) == 1.0)
100 tmp = black;
101 else if (cdata(ii, jj) == 2.0)
102 tmp = white;
103 else
104 tmp.setAlpha (0);
105
106 retval.setPixel (jj, ii, tmp.rgba ());
107 }
108
109 return retval;
110 }
111
112 Figure *
113 Figure::create (octave::base_qobject& oct_qobj, octave::interpreter& interp,
114 const graphics_object& go)
115 {
116 return new Figure (oct_qobj, interp, go, new FigureWindow ());
117 }
118
119 Figure::Figure (octave::base_qobject& oct_qobj, octave::interpreter& interp,
120 const graphics_object& go, FigureWindow *win)
121 : Object (oct_qobj, interp, go, win), m_blockUpdates (false),
122 m_figureToolBar (nullptr), m_menuBar (nullptr), m_innerRect (),
123 m_outerRect (), m_previousHeight (0), m_resizable (true)
124 {
125 m_container = new Container (win, oct_qobj, interp);
126 win->setCentralWidget (m_container);
127
130
133
134 figure::properties& fp = properties<figure> ();
135
136 // Adjust figure position
137 m_innerRect = boundingBoxToRect (fp.get_boundingbox (true));
138 m_outerRect = boundingBoxToRect (fp.get_boundingbox (false));
139
141
142 // Menubar
143 m_menuBar = new MenuBar (win);
144 win->setMenuBar (m_menuBar);
145 m_menuBar->addReceiver (this);
146 m_menuBar->setStyleSheet (m_menuBar->styleSheet () + global_menubar_style);
147
148
149 // Status bar
150 m_statusBar = win->statusBar ();
151 m_statusBar->setVisible (false);
152
153 if (fp.toolbar_is ("figure")
154 || (fp.toolbar_is ("auto") && fp.menubar_is ("figure")))
155 showFigureStatusBar (true);
156
157 // Enable mouse tracking unconditionally
159
160 // When this constructor gets called all properties are already
161 // set, even non default. We force "update" here to get things right.
162
163 // Figure title
164 update (figure::properties::ID_NUMBERTITLE);
165
166 // Decide what keyboard events we listen to
168 update (figure::properties::ID_KEYPRESSFCN);
169 update (figure::properties::ID_KEYRELEASEFCN);
170
171 // modal style
172 update (figure::properties::ID_WINDOWSTYLE);
173
174 // Handle resizing constraints
175 update (figure::properties::ID_RESIZE);
176
177 // Custom pointer data
178 update (figure::properties::ID_POINTERSHAPECDATA);
179
180 // Visibility
181 update (figure::properties::ID_VISIBLE);
182
183 connect (this, &Figure::asyncUpdate, this, &Figure::updateContainer);
184
185 // Register for the signal that indicates when a window has moved
186 // to a different screen
187 connect (win, &FigureWindow::figureWindowShown,
189
190 win->addReceiver (this);
191 m_container->addReceiver (this);
192 }
193
195 { }
196
197 QString
199 {
200 gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
201
202 octave::autolock guard (gh_mgr.graphics_lock ());
203
204 const figure::properties& fp = properties<figure> ();
205
206 std::string name = fp.get_filename ();
207
209 }
210
211 void
212 Figure::setFileName (const QString& name)
213 {
214 gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
215
216 octave::autolock guard (gh_mgr.graphics_lock ());
217
218 figure::properties& fp = properties<figure> ();
219
220 fp.set_filename (name.toStdString ());
221 }
222
225 {
226 gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
227
228 octave::autolock guard (gh_mgr.graphics_lock ());
229
230 const figure::properties& fp = properties<figure> ();
231
232 std::string mode = fp.get___mouse_mode__ ();
233
234 if (mode == "zoom")
235 {
236 octave_scalar_map zm = fp.get___zoom_mode__ ().scalar_map_value ();
237
238 std::string direction = zm.getfield ("Direction").string_value ();
239
240 mode += ' ' + direction;
241 }
242
243 if (mode == "rotate")
244 return RotateMode;
245 else if (mode == "zoom in")
246 return ZoomInMode;
247 else if (mode == "zoom out")
248 return ZoomOutMode;
249 else if (mode == "pan")
250 return PanMode;
251 else if (mode == "text")
252 return TextMode;
253
254 return NoMode;
255 }
256
257 void
259 {
260 QMainWindow *win = qWidget<QMainWindow> ();
261
262 if (! m_resizable)
263 {
264 win->setSizePolicy (QSizePolicy::Preferred, QSizePolicy::Preferred);
265 win->setFixedSize (QSize( QWIDGETSIZE_MAX, QWIDGETSIZE_MAX));
266 }
267
268 // Unlock window if it is maximized or full-screen
269 int state = win->windowState ();
270 if (state == Qt::WindowFullScreen || state == Qt::WindowMaximized)
271 win->setWindowState (Qt::WindowNoState);
272
273 win->setGeometry (r);
274
275 if (! m_resizable)
276 {
277 win->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed);
278 win->setFixedSize(win->size ());
279 }
280 }
281
282 Container *
284 {
285 return m_container;
286 }
287
288 void
290 {
291 Canvas *canvas = m_container->canvas (m_handle);
292
293 if (canvas)
294 canvas->redraw ();
295
296 for (auto *qobj : qWidget<QWidget> ()->findChildren<QObject *> ())
297 {
298 if (qobj->objectName () == "UIPanel"
299 || qobj->objectName () == "UIButtonGroup"
300 || qobj->objectName () == "UIControl"
301 || qobj->objectName () == "UITable")
302 {
303 Object *obj = Object::fromQObject (qobj);
304
305 if (obj)
306 obj->slotRedraw ();
307 }
308 }
309 }
310
311 void
313 {
314 QWidget *win = qWidget<QWidget> ();
315
316 win->activateWindow ();
317 win->raise ();
318 }
319
320 void
321 Figure::print (const QString& file_cmd, const QString& term)
322 {
323 Canvas *canvas = m_container->canvas (m_handle);
324
325 if (canvas)
326 canvas->print (file_cmd, term);
327 }
328
331 {
332 uint8NDArray retval;
333 Canvas *canvas = m_container->canvas (m_handle);
334
335 if (canvas)
336 {
337 gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
338
339 gh_mgr.process_events ();
340 octave::autolock guard (gh_mgr.graphics_lock ());
341 retval = canvas->getPixels ();
342 }
343
344 return retval;
345 }
346
347 void
349 {
350 Canvas *canvas = m_container->canvas (m_handle.value (), false);
351
352 if (canvas)
353 canvas->blockRedraw (true);
354
356 qWidget<FigureWindow> ()->removeReceiver (this);
357 }
358
359 void
361 {
362 if (m_blockUpdates)
363 return;
364
365 figure::properties& fp = properties<figure> ();
366
367 if (fp.is___printing__ ())
368 return;
369
370 QMainWindow *win = qWidget<QMainWindow> ();
371
372 // If the window doesn't exist, there's nothing we can do.
373 if (! win)
374 return;
375
376 m_blockUpdates = true;
377
378 switch (pId)
379 {
380 case figure::properties::ID_POSITION:
381 {
382 m_innerRect = boundingBoxToRect (fp.get_boundingbox (true));
383 int toffset = 0;
384 int boffset = 0;
385
386 for (auto *tb : win->findChildren<QToolBar *> ())
387 if (! tb->isHidden ())
388 toffset += tb->sizeHint ().height ();
389
390 if (! m_menuBar->isHidden ())
391 toffset += m_menuBar->sizeHint ().height ();
392
393 if (! m_statusBar->isHidden ())
394 boffset += m_statusBar->sizeHint ().height ();
395
396 set_geometry (m_innerRect.adjusted (0, -toffset, 0, boffset));
397 }
398 break;
399
400 case figure::properties::ID_NAME:
401 case figure::properties::ID_NUMBERTITLE:
402 win->setWindowTitle (Utils::fromStdString (fp.get_title ()));
403 break;
404
405 case figure::properties::ID_VISIBLE:
406 if (fp.is_visible ())
407 {
408 QTimer::singleShot (0, win, &QMainWindow::show);
409 if (! fp.is___gl_window__ ())
410 {
411 gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
412
413 octave::autolock guard (gh_mgr.graphics_lock ());
414 fp.set ("__gl_window__", "on");
415 }
416 }
417 else
418 win->hide ();
419 break;
420
421 case figure::properties::ID_RESIZE:
422 if (fp.is_resize ())
423 {
424 win->setSizePolicy (QSizePolicy::Preferred, QSizePolicy::Preferred);
425 win->setFixedSize (QSize( QWIDGETSIZE_MAX, QWIDGETSIZE_MAX));
426 m_resizable = true;
427 }
428 else
429 {
430 win->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed);
431 win->setFixedSize(win->size ());
432 m_resizable = false;
433 }
434 break;
435
436 case figure::properties::ID_MENUBAR:
437 case figure::properties::ID_TOOLBAR:
438 if (fp.toolbar_is ("none"))
439 showFigureStatusBar (false);
440 else if (fp.toolbar_is ("figure"))
441 showFigureStatusBar (true);
442 else // "auto"
443 showFigureStatusBar (fp.menubar_is ("figure"));
444 break;
445
446 case figure::properties::ID_KEYPRESSFCN:
447 if (fp.get_keypressfcn ().isempty ())
449 else
451 // Signal the change to uipanels as well
452 for (auto *qobj : qWidget<QWidget> ()->findChildren<QObject *> ())
453 {
454 if (qobj->objectName () == "UIPanel")
455 {
456 Object *obj = Object::fromQObject (qobj);
457
458 if (obj)
459 {
460 if (fp.get_keypressfcn ().isempty ())
461 obj->innerContainer ()->canvas (m_handle)->
462 clearEventMask (Canvas::KeyPress);
463 else
464 obj->innerContainer ()->canvas (m_handle)->
465 addEventMask (Canvas::KeyPress);
466 }
467 }
468 }
469 break;
470
471 case figure::properties::ID_KEYRELEASEFCN:
472 if (fp.get_keyreleasefcn ().isempty ())
474 else
476 break;
477 // Signal the change to uipanels as well
478 for (auto *qobj : qWidget<QWidget> ()->findChildren<QObject *> ())
479 {
480 if (qobj->objectName () == "UIPanel")
481 {
482 Object *obj = Object::fromQObject (qobj);
483
484 if (obj)
485 {
486 if (fp.get_keypressfcn ().isempty ())
487 obj->innerContainer ()->canvas (m_handle)->
488 clearEventMask (Canvas::KeyRelease);
489 else
490 obj->innerContainer ()->canvas (m_handle)->
491 addEventMask (Canvas::KeyRelease);
492 }
493 }
494 }
495 break;
496
497 case figure::properties::ID_WINDOWSTYLE:
498 if (fp.windowstyle_is ("modal"))
499 {
500 bool is_visible = win->isVisible ();
501
502 // if window is already visible, need to hide and reshow it in order to
503 // make it use the modal settings
504 if (is_visible)
505 win->setVisible (false);
506
507 win->setWindowModality (Qt::ApplicationModal);
508 win->setVisible (is_visible);
509 }
510 else
511 win->setWindowModality (Qt::NonModal);
512
513 break;
514
515 case figure::properties::ID_POINTERSHAPECDATA:
517 pointer_to_qimage (fp.get_pointershapecdata ().matrix_value ());
518 if (fp.get_pointer () != "custom")
519 break;
520 OCTAVE_FALLTHROUGH;
521
522 case figure::properties::ID_POINTER:
523 case figure::properties::ID_POINTERSHAPEHOTSPOT:
524 case figure::properties::ID___MOUSE_MODE__:
525 case figure::properties::ID___ZOOM_MODE__:
527 fp.get_pointer (),
529 fp.get_pointershapehotspot ()
530 .matrix_value());
531 break;
532
533 default:
534 break;
535 }
536
537 m_blockUpdates = false;
538 }
539
540 void
542 {
543 if (m_statusBar
544 && (! m_statusBar->isHidden ()) != visible)
545 {
546 int dy = m_statusBar->sizeHint ().height ();
547 QRect r = qWidget<QWidget> ()->geometry ();
548
549 if (! visible)
550 r.adjust (0, 0, 0, -dy);
551 else
552 r.adjust (0, 0, 0, dy);
553
554 m_blockUpdates = true;
555 set_geometry (r);
556 m_statusBar->setVisible (visible);
557 m_blockUpdates = false;
558
559 updateBoundingBox (false);
560 }
561 }
562
563 void
565 {
566 gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
567
568 octave::autolock guard (gh_mgr.graphics_lock ());
569 graphics_object go = object ();
570
571 if (go.valid_object () && dh != 0)
572 {
573 QRect r = qWidget<QWidget> ()->geometry ();
574
575 r.adjust (0, dh, 0, 0);
576
577 m_blockUpdates = true;
578 set_geometry (r);
579 m_blockUpdates = false;
580
581 updateBoundingBox (false);
582 }
583 }
584
585 void
587 {
588 if (! m_statusBar->isHidden ())
589 m_statusBar->showMessage (QString ("(%1, %2)")
590 .arg (pt(0), 0, 'g', 5)
591 .arg (pt(1), 0, 'g', 5));
592 }
593
594 void
595 Figure::do_connections (const QObject *receiver, const QObject * /* emitter */)
596 {
597 Object::do_connections (receiver);
599 }
600
601 QWidget *
603 {
604 return qWidget<QMainWindow> ()->menuBar ();
605 }
606
607 void
608 Figure::updateBoundingBox (bool internal, int flags)
609 {
610 QWidget *win = qWidget<QWidget> ();
611 Matrix bb (1, 4);
612 std::string prop;
613
614 if (internal)
615 {
616 prop = "position";
617 QRect r = m_innerRect;
618
619 if (flags & UpdateBoundingBoxPosition)
620 r.moveTopLeft (win->mapToGlobal (m_container->pos ()));
621 if (flags & UpdateBoundingBoxSize)
622 r.setSize (m_container->size ());
623
624 if (r.isValid () && r != m_innerRect)
625 {
626 m_innerRect = r;
627
628 bb(0) = r.x ();
629 bb(1) = r.y ();
630 bb(2) = r.width ();
631 bb(3) = r.height ();
632 }
633 else
634 return;
635 }
636 else
637 {
638 prop = "outerposition";
639 QRect r = m_outerRect;
640
641 if (flags & UpdateBoundingBoxPosition)
642 r.moveTopLeft (win->pos ());
643 if (flags & UpdateBoundingBoxSize)
644 r.setSize (win->frameGeometry ().size ());
645
646 if (r.isValid () && r != m_outerRect)
647 {
648 m_outerRect = r;
649
650 bb(0) = r.x ();
651 bb(1) = r.y ();
652 bb(2) = r.width ();
653 bb(3) = r.height ();
654 }
655 else
656 return;
657 }
658
659 figure::properties& fp = properties<figure> ();
660
661 emit gh_set_event (m_handle, prop, fp.bbox2position (bb), false,
662 prop == "position");
663 }
664
665 bool
666 Figure::eventNotifyBefore (QObject *obj, QEvent *xevent)
667 {
668 if (! m_blockUpdates)
669 {
670 // Clicking the toolbar or the menubar makes this figure current
671 if (xevent->type () == QEvent::MouseButtonPress)
672 {
673 figure::properties& fp = properties<figure> ();
674
675 gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
676
677 graphics_object root = gh_mgr.get_object (0);
678
679 if (fp.get_handlevisibility () == "on")
680 root.set ("currentfigure",
681 fp.get___myhandle__ ().as_octave_value ());
682 }
683
684 if (obj == m_container)
685 {
686 // Do nothing...
687 }
688 else if (obj == m_menuBar)
689 {
690 switch (xevent->type ())
691 {
692 case QEvent::ActionAdded:
693 case QEvent::ActionChanged:
694 case QEvent::ActionRemoved:
695 m_previousHeight = m_menuBar->sizeHint ().height ();
696
697 default:
698 break;
699 }
700 }
701 else
702 {
703 switch (xevent->type ())
704 {
705 case QEvent::Close:
706 xevent->ignore ();
707 emit gh_callback_event (m_handle, "closerequestfcn");
708 return true;
709
710 default:
711 break;
712 }
713 }
714 }
715
716 return false;
717 }
718
719 void
720 Figure::eventNotifyAfter (QObject *watched, QEvent *xevent)
721 {
722 if (! m_blockUpdates)
723 {
724 if (watched == m_container)
725 {
726 gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
727
728 switch (xevent->type ())
729 {
730 case QEvent::Resize:
732 break;
733
734 case QEvent::ChildAdded:
735 if (dynamic_cast<QChildEvent *> (xevent)->child
736 ()->isWidgetType())
737 {
738 octave::autolock guard (gh_mgr.graphics_lock ());
739 update (figure::properties::ID_TOOLBAR);
740
742 }
743 break;
744
745 case QEvent::ChildRemoved:
746 if (dynamic_cast<QChildEvent *> (xevent)->child
747 ()->isWidgetType())
748 {
749 octave::autolock guard (gh_mgr.graphics_lock ());
750 update (figure::properties::ID_TOOLBAR);
751 }
752 break;
753
754 default:
755 break;
756 }
757 }
758 else if (watched == m_menuBar)
759 {
760 switch (xevent->type ())
761 {
762 case QEvent::ActionAdded:
763 case QEvent::ActionChanged:
764 case QEvent::ActionRemoved:
765 // The menubar may have been resized if no action is visible
766 {
767 QAction *a = dynamic_cast<QActionEvent *> (xevent)->action ();
768 int currentHeight = m_menuBar->sizeHint ().height ();
769 if (currentHeight != m_previousHeight
770 && ! a->isSeparator ())
771 updateFigureHeight (m_previousHeight - currentHeight);
772 }
773 break;
774
775 default:
776 break;
777 }
778 }
779 else
780 {
781 switch (xevent->type ())
782 {
783 case QEvent::Move:
786 break;
787
788 case QEvent::Resize:
790 break;
791
792 default:
793 break;
794 }
795 }
796 }
797 }
798
799 void
800 Figure::addCustomToolBar (QToolBar *bar, bool visible, bool isdefault)
801 {
802 QMainWindow *win = qWidget<QMainWindow> ();
803
804 if (isdefault)
805 m_figureToolBar = bar;
806
807 if (! visible)
808 win->addToolBar (bar);
809 else
810 {
811 QSize sz = bar->sizeHint ();
812 QRect r = win->geometry ();
813
814 r.adjust (0, -sz.height (), 0, 0);
815
816 m_blockUpdates = true;
817 set_geometry (r);
818 win->addToolBarBreak ();
819 win->addToolBar (bar);
820 m_blockUpdates = false;
821
822 updateBoundingBox (false);
823 }
824 }
825
826 void
827 Figure::showCustomToolBar (QToolBar *bar, bool visible)
828 {
829 QMainWindow *win = qWidget<QMainWindow> ();
830
831 if ((! bar->isHidden ()) != visible)
832 {
833 QSize sz = bar->sizeHint ();
834 QRect r = win->geometry ();
835
836 if (visible)
837 r.adjust (0, -sz.height (), 0, 0);
838 else
839 r.adjust (0, sz.height (), 0, 0);
840
841 m_blockUpdates = true;
842 set_geometry (r);
843 bar->setVisible (visible);
844 m_blockUpdates = false;
845
846 updateBoundingBox (false);
847 }
848 }
849
850 void
852 {
853 redraw ();
854 }
855
856 void
858 {
859#if defined (HAVE_QSCREEN_DEVICEPIXELRATIO)
860 QWindow *window = qWidget<QMainWindow> ()->windowHandle ();
861 QScreen *screen = window->screen ();
862
863 gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
864
865 octave::autolock guard (gh_mgr.graphics_lock ());
866
867 figure::properties& fp = properties<figure> ();
868 fp.set___device_pixel_ratio__ (screen->devicePixelRatio ());
869
870 connect (window, &QWindow::screenChanged, this, &Figure::screenChanged);
871#endif
872 }
873
874 void
875 Figure::screenChanged (QScreen *screen)
876 {
877#if defined (HAVE_QSCREEN_DEVICEPIXELRATIO)
878 gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
879
880 octave::autolock guard (gh_mgr.graphics_lock ());
881
882 figure::properties& fp = properties<figure> ();
883 double old_dpr = fp.get___device_pixel_ratio__ ();
884 double new_dpr = screen->devicePixelRatio ();
885 if (old_dpr != new_dpr)
886 {
887 fp.set___device_pixel_ratio__ (new_dpr);
888
889 // For some obscure reason, changing the __device_pixel_ratio__ property
890 // from the GUI thread does not necessarily trigger a redraw. Force it.
891 redraw ();
892 }
893#else
894 octave_unused_parameter (screen);
895#endif
896 }
897
898 void
900 {
901 // Enable mouse tracking on every widgets
902 m_container->setMouseTracking (true);
903 m_container->canvas (m_handle)->qWidget ()->setMouseTracking (true);
904 for (auto *w : m_container->findChildren<QWidget *> ())
905 w->setMouseTracking (true);
906 }
907
908}
#define DECLARE_GENERICEVENTNOTIFY_SENDER(T, B)
octave_idx_type numel(void) const
Number of elements in the array.
Definition: Array.h:411
octave_idx_type rows(void) const
Definition: Array.h:449
octave_idx_type columns(void) const
Definition: Array.h:458
Definition: dMatrix.h:42
void blockRedraw(bool block=true)
Definition: Canvas.cc:72
virtual uint8NDArray getPixels(void)
Definition: Canvas.h:89
void print(const QString &file_cmd, const QString &term)
Definition: Canvas.h:70
void addEventMask(int m)
Definition: Canvas.h:75
void setEventMask(int m)
Definition: Canvas.h:77
void setCursor(MouseMode mode, std::string fallback, QImage cdata, Matrix hotspot)
Definition: Canvas.cc:88
void redraw(bool sync=false)
Definition: Canvas.cc:58
void clearEventMask(int m)
Definition: Canvas.h:76
virtual QWidget * qWidget(void)=0
void interpreter_event(const octave::fcn_callback &fcn)
Canvas * canvas(const graphics_handle &handle, bool create=true)
Definition: Container.cc:56
QToolBar * m_figureToolBar
Definition: Figure.h:139
MouseMode mouseMode(void)
Definition: Figure.cc:224
void print(const QString &file_cmd, const QString &term)
Definition: Figure.cc:321
void showFigureStatusBar(bool visible)
Definition: Figure.cc:541
void figureWindowShown()
Definition: Figure.cc:857
void set_geometry(QRect r)
Definition: Figure.cc:258
void asyncUpdate(void)
void setFileName(const QString &name)
Definition: Figure.cc:212
void updateBoundingBox(bool internal=false, int flags=0)
Definition: Figure.cc:608
void updateFigureHeight(int delta_h)
Definition: Figure.cc:564
QRect m_innerRect
Definition: Figure.h:142
QString fileName(void)
Definition: Figure.cc:198
void interpreter_event(const octave::fcn_callback &fcn)
static Figure * create(octave::base_qobject &oct_qobj, octave::interpreter &interp, const graphics_object &go)
Definition: Figure.cc:113
QRect m_outerRect
Definition: Figure.h:143
Container * innerContainer(void)
Definition: Figure.cc:283
uint8NDArray slotGetPixels(void)
Definition: Figure.cc:330
bool m_blockUpdates
Definition: Figure.h:138
Container * m_container
Definition: Figure.h:137
void showCustomToolBar(QToolBar *bar, bool visible)
Definition: Figure.cc:827
void redraw(void)
Definition: Figure.cc:289
QWidget * menu(void)
Definition: Figure.cc:602
void updateStatusBar(ColumnVector pt)
Definition: Figure.cc:586
bool m_resizable
Definition: Figure.h:146
QStatusBar * m_statusBar
Definition: Figure.h:141
void addCustomToolBar(QToolBar *bar, bool visible, bool isdefault)
Definition: Figure.cc:800
bool eventNotifyBefore(QObject *watched, QEvent *event)
Definition: Figure.cc:666
void eventNotifyAfter(QObject *watched, QEvent *event)
Definition: Figure.cc:720
int m_previousHeight
Definition: Figure.h:145
void beingDeleted(void)
Definition: Figure.cc:348
~Figure(void)
Definition: Figure.cc:194
void show(void)
Definition: Figure.cc:312
@ UpdateBoundingBoxSize
Definition: Figure.h:102
@ UpdateBoundingBoxPosition
Definition: Figure.h:101
QImage m_pointer_cdata
Definition: Figure.h:144
MenuBar * m_menuBar
Definition: Figure.h:140
void screenChanged(QScreen *)
Definition: Figure.cc:875
void updateContainer(void)
Definition: Figure.cc:851
void do_connections(const QObject *receiver, const QObject *emitter=nullptr)
Definition: Figure.cc:595
void update(int pId)
Definition: Figure.cc:360
void enableMouseTracking(void)
Definition: Figure.cc:899
Figure(octave::base_qobject &oct_qobj, octave::interpreter &interp, const graphics_object &go, FigureWindow *win)
Definition: Figure.cc:119
void addReceiver(GenericEventNotifyReceiver *r)
void removeReceiver(GenericEventNotifyReceiver *r)
virtual Container * innerContainer(void)=0
virtual void do_connections(const QObject *receiver, const QObject *emitter=nullptr)
Definition: Object.cc:225
void gh_callback_event(const graphics_handle &h, const std::string &name)
void slotRedraw(void)
Definition: Object.cc:131
octave::interpreter & m_interpreter
Definition: Object.h:140
static Object * fromQObject(QObject *obj)
Definition: Object.cc:214
void gh_set_event(const graphics_handle &h, const std::string &name, const octave_value &value)
graphics_handle m_handle
Definition: Object.h:157
graphics_object object(void) const
Definition: Object.cc:83
Base class for Octave interfaces that use Qt.
double value(void) const
Definition: oct-handle.h:78
octave_value getfield(const std::string &key) const
Definition: oct-map.cc:183
std::string string_value(bool force=false) const
Definition: ov.h:1019
QString name
const QString global_menubar_style("QMenuBar {" "margin-top: 0px;" "margin-bottom: 0px;" "padding-top: 0px;" "padding-bottom: 0px;" "}")
std::complex< double > w(std::complex< double > z, double relerr=0)
QString fromStdString(const std::string &s)
T::properties & properties(graphics_object obj)
double round(double x)
Definition: lo-mappers.h:136
static uint32_t state[624]
Definition: randmtzig.cc:192
static QRect boundingBoxToRect(const Matrix &bb)
Definition: Figure.cc:74
MouseMode
Definition: Figure.h:50
@ PanMode
Definition: Figure.h:55
@ ZoomOutMode
Definition: Figure.h:54
@ RotateMode
Definition: Figure.h:52
@ NoMode
Definition: Figure.h:51
@ TextMode
Definition: Figure.h:57
@ ZoomInMode
Definition: Figure.h:53
static QImage pointer_to_qimage(const Matrix &cdata)
Definition: Figure.cc:90