GNU Octave  4.0.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Figure.cc
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2011-2015 Michael Goffioul
4 
5 This file is part of Octave.
6 
7 Octave is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, see
19 <http://www.gnu.org/licenses/>.
20 
21 */
22 
23 #ifdef HAVE_CONFIG_H
24 #include <config.h>
25 #endif
26 
27 #include <QAction>
28 #include <QActionEvent>
29 #include <QActionGroup>
30 #include <QApplication>
31 #include <QClipboard>
32 #include <QEvent>
33 #include <QFileDialog>
34 #include <QFileInfo>
35 #include <QFrame>
36 #include <QImage>
37 #include <QMainWindow>
38 #include <QMenu>
39 #include <QMenuBar>
40 #include <QMessageBox>
41 #include <QtDebug>
42 #include <QTimer>
43 #include <QToolBar>
44 
45 #include "Canvas.h"
46 #include "Container.h"
47 #include "Figure.h"
48 #include "FigureWindow.h"
49 #include "MouseModeActionGroup.h"
50 #include "QtHandlesUtils.h"
51 
52 #include "file-ops.h"
53 #include "unwind-prot.h"
54 #include "utils.h"
55 
56 #include "octave-qt-link.h"
57 
58 #include "builtin-defun-decls.h"
59 
60 namespace QtHandles
61 {
62 
63 #define ABOUT_TEXT "<b>QtHandles</b> - a Qt-based toolkit for <a href=\"http://www.octave.org\">Octave</a>.<br><br>Copyright (C) 2011-2015 Michael Goffioul"
64 
66 
67 static bool
69 {
71 
72  Matrix kids = fp.get_all_children ();
73 
74  for (int i = 0; i < kids.numel (); i++)
75  {
77 
78  if (go && (go.isa ("uicontrol") || go.isa ("uipanel")
79  || go.isa ("uibuttongroup")))
80  return true;
81  }
82 
83  return false;
84 }
85 
86 static bool
88 {
90 
91  Matrix kids = fp.get_all_children ();
92 
93  for (int i = 0; i < kids.numel (); i++)
94  {
96 
97  if (go && go.isa ("uimenu"))
98  return true;
99  }
100 
101  return false;
102 }
103 
104 static QRect
106 {
107  QRect r;
108 
109  if (bb.numel () == 4)
110  {
111  r = QRect (xround (bb(0)), xround (bb(1)),
112  xround (bb(2)), xround (bb(3)));
113  if (! r.isValid ())
114  r = QRect ();
115  }
116 
117  return r;
118 }
119 
120 Figure*
122 {
123  return new Figure (go, new FigureWindow ());
124 }
125 
127  : Object (go, win), m_blockUpdates (false), m_figureToolBar (0),
128  m_menuBar (0), m_innerRect (), m_outerRect (), m_mouseModeGroup (0)
129 {
130  m_container = new Container (win);
131  win->setCentralWidget (m_container);
132 
133  figure::properties& fp = properties<figure> ();
134 
136 
137  int offset = 0;
138  if (fp.toolbar_is ("figure") ||
139  (fp.toolbar_is ("auto") && fp.menubar_is ("figure") &&
140  ! hasUiControlChildren (fp)))
141  offset += m_figureToolBar->sizeHint ().height ();
142  else
143  m_figureToolBar->hide ();
144  if (fp.menubar_is ("figure") || hasUiMenuChildren (fp))
145  offset += m_menuBar->sizeHint ().height () + 1;
146  else
147  m_menuBar->hide ();
148 
151 
152  //qDebug () << "Figure::Figure:" << m_innerRect;
153  win->setGeometry (m_innerRect.adjusted (0, -offset, 0, 0));
154  //qDebug () << "Figure::Figure(adjusted)" << m_innerRect.adjusted (0, -offset, 0, 0);
155  win->setWindowTitle (Utils::fromStdString (fp.get_title ()));
156 
157  int eventMask = 0;
158  if (! fp.get_keypressfcn ().is_empty ())
159  eventMask |= Canvas::KeyPress;
160  if (! fp.get_keyreleasefcn ().is_empty ())
161  eventMask |= Canvas::KeyRelease;
162  m_container->canvas (m_handle)->setEventMask (eventMask);
163 
164  if (! fp.get_windowbuttonmotionfcn ().is_empty ())
165  {
166  m_container->setMouseTracking (true);
167  m_container->canvas (m_handle)->qWidget ()->setMouseTracking (true);
168  }
169 
170  connect (this, SIGNAL (asyncUpdate (void)),
171  this, SLOT (updateContainer (void)));
172 
173  if (fp.is_visible ())
174  QTimer::singleShot (0, win, SLOT (show ()));
175  else
176  win->hide ();
177 
178  win->addReceiver (this);
179  m_container->addReceiver (this);
180 }
181 
183 {
184 }
185 
186 static std::string
188 {
189  switch (mode)
190  {
191  case NoMode:
192  return "none";
193 
194  case RotateMode:
195  return "rotate";
196 
197  case ZoomInMode:
198  return "zoom in";
199 
200  case ZoomOutMode:
201  return "zoom out";
202 
203  case PanMode:
204  return "pan";
205 
206  case TextMode:
207  return "text";
208 
209  case SelectMode:
210  return "select";
211 
212  default:
213  break;
214  }
215 
216  return "none";
217 }
218 
219 static MouseMode
220 mouse_mode_from_string (const std::string& mode)
221 {
222  if (mode == "none")
223  return NoMode;
224  else if (mode == "rotate")
225  return RotateMode;
226  else if (mode == "zoom in")
227  return ZoomInMode;
228  else if (mode == "zoom out")
229  return ZoomOutMode;
230  else if (mode == "pan")
231  return PanMode;
232  else if (mode == "text")
233  return TextMode;
234  else if (mode == "select")
235  return SelectMode;
236  else
237  return NoMode;
238 }
239 
240 QString
242 {
244 
245  const figure::properties& fp = properties<figure> ();
246 
247  std::string name = fp.get_filename ();
248 
249  return QString::fromStdString (name);
250 }
251 
252 void
253 Figure::setFileName (const QString& name)
254 {
256 
257  figure::properties& fp = properties<figure> ();
258 
259  fp.set_filename (name.toStdString ());
260 }
261 
262 MouseMode
264 {
266 
267  const figure::properties& fp = properties<figure> ();
268 
269  std::string mode = fp.get___mouse_mode__ ();
270 
271  if (mode == "zoom")
272  {
274 
275  std::string direction = zm.getfield ("Direction").string_value ();
276 
277  mode += " " + direction;
278  }
279 
280  return mouse_mode_from_string (mode);
281 }
282 
283 void
285 {
286  QMainWindow* win = qWidget<QMainWindow> ();
287 
288  m_figureToolBar = win->addToolBar (tr ("Figure ToolBar"));
289  m_figureToolBar->setMovable (false);
290  m_figureToolBar->setFloatable (false);
291 
293  connect (m_mouseModeGroup, SIGNAL (modeChanged (MouseMode)),
294  SLOT (setMouseMode (MouseMode)));
295  m_figureToolBar->addActions (m_mouseModeGroup->actions ());
296 
297  QAction *toggle_axes = m_figureToolBar->addAction (tr ("Axes"));
298  connect (toggle_axes, SIGNAL (triggered (void)),
299  this, SLOT (toggleAxes (void)));
300 
301  QAction *toggle_grid = m_figureToolBar->addAction (tr ("Grid"));
302  connect (toggle_grid, SIGNAL (triggered (void)),
303  this, SLOT (toggleGrid (void)));
304 
305  QAction *auto_axes = m_figureToolBar->addAction (tr ("Autoscale"));
306  connect (auto_axes, SIGNAL (triggered (void)),
307  this, SLOT (autoAxes (void)));
308 
309  m_menuBar = new MenuBar (win);
310  win->setMenuBar (m_menuBar);
311 
312  QMenu* fileMenu = m_menuBar->addMenu (tr ("&File"));
313  fileMenu->menuAction ()->setObjectName ("builtinMenu");
314  fileMenu->addAction (tr ("&Save"), this, SLOT (fileSaveFigure (bool)));
315  fileMenu->addAction (tr ("Save &As"), this, SLOT (fileSaveFigureAs (void)));
316  fileMenu->addSeparator ();
317  fileMenu->addAction (tr ("&Close Figure"), this,
318  SLOT (fileCloseFigure (void)), Qt::CTRL|Qt::Key_W);
319 
320  QMenu* editMenu = m_menuBar->addMenu (tr ("&Edit"));
321  editMenu->menuAction ()->setObjectName ("builtinMenu");
322  editMenu->addAction (tr ("Cop&y"), this, SLOT (editCopy (bool)),
323  Qt::CTRL|Qt::Key_C);
324  editMenu->addSeparator ();
325  editMenu->addActions (m_mouseModeGroup->actions ());
326 
327  QMenu* helpMenu = m_menuBar->addMenu (tr ("&Help"));
328  helpMenu->menuAction ()->setObjectName ("builtinMenu");
329  helpMenu->addAction (tr ("&About QtHandles"), this,
330  SLOT (helpAboutQtHandles (void)));
331  helpMenu->addAction (tr ("About &Qt"), qApp, SLOT (aboutQt (void)));
332 
333  m_menuBar->addReceiver (this);
334 }
335 
336 void
338 {
339  if (m_mouseModeGroup)
340  {
341  m_blockUpdates = true;
343  m_blockUpdates = false;
344  }
345 }
346 
347 Container*
349 {
350  return m_container;
351 }
352 
353 void
355 {
356  Canvas* canvas = m_container->canvas (m_handle);
357 
358  if (canvas)
359  {
360  canvas->redraw ();
361  //canvas->setMouseMode (RotateMode);
362  }
363 
364  foreach (QFrame* frame,
365  qWidget<QWidget> ()->findChildren<QFrame*> ("UIPanel"))
366  {
367  Object* obj = Object::fromQObject (frame);
368 
369  if (obj)
370  obj->slotRedraw ();
371  }
372 
374 }
375 
376 void
377 Figure::print (const QString& file_cmd, const QString& term)
378 {
379  Canvas* canvas = m_container->canvas (m_handle);
380 
381  if (canvas)
382  canvas->print (file_cmd, term);
383 }
384 
385 void
387 {
388  Canvas* canvas = m_container->canvas (m_handle.value (), false);
389 
390  if (canvas)
391  canvas->blockRedraw (true);
392 
393  m_menuBar->removeReceiver (this);
394  m_container->removeReceiver (this);
395  qWidget<FigureWindow> ()->removeReceiver (this);
396 }
397 
398 void
399 Figure::update (int pId)
400 {
401  if (m_blockUpdates)
402  return;
403 
404  figure::properties& fp = properties<figure> ();
405  QMainWindow* win = qWidget<QMainWindow> ();
406 
407  m_blockUpdates = true;
408 
409  switch (pId)
410  {
412  {
414  //qDebug () << "Figure::update(position):" << m_innerRect;
415  int offset = 0;
416 
417  foreach (QToolBar* tb, win->findChildren<QToolBar*> ())
418  if (! tb->isHidden ())
419  offset += tb->sizeHint ().height ();
420  if (! m_menuBar->isHidden ())
421  offset += m_menuBar->sizeHint ().height () + 1;
422  //qDebug () << "Figure::update(position)(adjusted):" << m_innerRect.adjusted (0, -offset, 0, 0);
423  win->setGeometry (m_innerRect.adjusted (0, -offset, 0, 0));
424  //qDebug () << "Figure::update(position): done";
425  }
426  break;
427 
430  win->setWindowTitle (Utils::fromStdString (fp.get_title ()));
431  break;
432 
434  if (fp.is_visible ())
435  QTimer::singleShot (0, win, SLOT (show ()));
436  else
437  win->hide ();
438  break;
439 
441  if (fp.toolbar_is ("none"))
442  showFigureToolBar (false);
443  else if (fp.toolbar_is ("figure"))
444  showFigureToolBar (true);
445  else // "auto"
447  fp.menubar_is ("figure"));
448  break;
449 
451  showMenuBar (fp.menubar_is ("figure"));
452  if (fp.toolbar_is ("auto"))
453  showFigureToolBar (fp.menubar_is ("figure"));
454  break;
455 
457  if (fp.get_keypressfcn ().is_empty ())
459  else
461  break;
462 
464  if (fp.get_keyreleasefcn ().is_empty ())
466  else
468  break;
469 
471  {
472  bool hasCallback = ! fp.get_windowbuttonmotionfcn ().is_empty ();
473 
474  m_container->setMouseTracking (hasCallback);
475  foreach (QWidget* w, m_container->findChildren<QWidget*> ())
476  { w->setMouseTracking (hasCallback); }
477  }
478  break;
479 
480  default:
481  break;
482  }
483 
484  m_blockUpdates = false;
485 }
486 
487 void
489 {
490  if ((! m_figureToolBar->isHidden ()) != visible)
491  {
492  int dy = m_figureToolBar->sizeHint ().height ();
493  QRect r = qWidget<QWidget> ()->geometry ();
494 
495  if (! visible)
496  r.adjust (0, dy, 0, 0);
497  else
498  r.adjust (0, -dy, 0, 0);
499 
500  m_blockUpdates = true;
501  qWidget<QWidget> ()->setGeometry (r);
502  m_figureToolBar->setVisible (visible);
503  m_blockUpdates = false;
504 
505  updateBoundingBox (false);
506  }
507 }
508 
509 void
510 Figure::showMenuBar (bool visible)
511 {
512  int h1 = m_menuBar->sizeHint ().height ();
513 
514  foreach (QAction* a, m_menuBar->actions ())
515  if (a->objectName () == "builtinMenu")
516  a->setVisible (visible);
517 
518  int h2 = m_menuBar->sizeHint ().height ();
519 
520  if (! visible)
521  visible = hasUiMenuChildren (properties<figure> ());
522 
523  if ((! m_menuBar->isHidden ()) != visible)
524  {
525  int dy = qMax (h1, h2) + 1;
526  QRect r = qWidget<QWidget> ()->geometry ();
527 
528  //qDebug () << "Figure::showMenuBar:" << r;
529  if (! visible)
530  r.adjust (0, dy, 0, 0);
531  else
532  r.adjust (0, -dy, 0, 0);
533  //qDebug () << "Figure::showMenuBar(adjusted):" << r;
534 
535  m_blockUpdates = true;
536  qWidget<QWidget> ()->setGeometry (r);
537  m_menuBar->setVisible (visible);
538  m_blockUpdates = false;
539 
540  updateBoundingBox (false);
541  }
542 }
543 
544 void
546 {
548  graphics_object go = object ();
549 
550  if (go.valid_object ())
551  showMenuBar (Utils::properties<figure> (go).menubar_is ("figure"));
552 }
553 
554 QWidget*
556 {
557  return qWidget<QMainWindow> ()->menuBar ();
558 }
559 
561 {
566 };
567 
568 void
570 {
572 
573  UpdateBoundingBoxData* d = reinterpret_cast<UpdateBoundingBoxData*> (data);
575 
576  if (go.valid_object ())
577  {
578  figure::properties& fp = Utils::properties<figure> (go);
579 
580  fp.set_boundingbox (d->m_bbox, d->m_internal, false);
581  }
582 
583  delete d;
584 }
585 
586 void
587 Figure::updateBoundingBox (bool internal, int flags)
588 {
589  QWidget* win = qWidget<QWidget> ();
590  Matrix bb (1, 4);
591 
592  if (internal)
593  {
594  QRect r = m_innerRect;
595 
596  if (flags & UpdateBoundingBoxPosition)
597  r.moveTopLeft (win->mapToGlobal (m_container->pos ()));
598  if (flags & UpdateBoundingBoxSize)
599  r.setSize (m_container->size ());
600 
601  if (r.isValid () && r != m_innerRect)
602  {
603  m_innerRect = r;
604 
605  bb(0) = r.x ();
606  bb(1) = r.y ();
607  bb(2) = r.width ();
608  bb(3) = r.height ();
609  }
610  else
611  return;
612  }
613  else
614  {
615  QRect r = m_outerRect;
616 
617  if (flags & UpdateBoundingBoxPosition)
618  r.moveTopLeft (win->pos ());
619  if (flags & UpdateBoundingBoxSize)
620  r.setSize (win->frameGeometry ().size ());
621 
622  if (r.isValid () && r != m_outerRect)
623  {
624  m_outerRect = r;
625 
626  bb(0) = r.x ();
627  bb(1) = r.y ();
628  bb(2) = r.width ();
629  bb(3) = r.height ();
630  }
631  else
632  return;
633  }
634 
636 
637  d->m_bbox = bb;
638  d->m_internal = internal;
639  d->m_handle = m_handle;
640  d->m_figure = this;
641 
643 }
644 
645 bool
646 Figure::eventNotifyBefore (QObject* obj, QEvent* xevent)
647 {
648  if (! m_blockUpdates)
649  {
650  if (obj == m_container)
651  {
652  // Do nothing...
653  }
654  else if (obj == m_menuBar)
655  {
656  switch (xevent->type ())
657  {
658  case QEvent::ActionRemoved:
659  {
660  QAction* a = dynamic_cast<QActionEvent*> (xevent)->action ();
661 
662  if (! a->isSeparator ()
663  && a->objectName () != "builtinMenu")
664  updateMenuBar ();
665  }
666  break;
667 
668  default:
669  break;
670  }
671  }
672  else
673  {
674  switch (xevent->type ())
675  {
676  case QEvent::Close:
677  xevent->ignore ();
678  gh_manager::post_callback (m_handle, "closerequestfcn");
679  return true;
680 
681  default:
682  break;
683  }
684  }
685  }
686 
687  return false;
688 }
689 
690 void
691 Figure::eventNotifyAfter (QObject* watched, QEvent* xevent)
692 {
693  if (! m_blockUpdates)
694  {
695  if (watched == m_container)
696  {
697  switch (xevent->type ())
698  {
699  case QEvent::Resize:
701  break;
702 
703  case QEvent::ChildAdded:
704  if (dynamic_cast<QChildEvent*> (xevent)->child
705  ()->isWidgetType())
706  {
708  const figure::properties& fp = properties<figure> ();
709 
711  }
712 
713  default:
714  break;
715  }
716  }
717  else if (watched == m_menuBar)
718  {
719  switch (xevent->type ())
720  {
721  case QEvent::ActionAdded:
722  {
723  QAction* a = dynamic_cast<QActionEvent*> (xevent)->action ();
724 
725  if (! a->isSeparator ()
726  && a->objectName () != "builtinMenu")
727  updateMenuBar ();
728  }
729  break;
730 
731  default:
732  break;
733  }
734  }
735  else
736  {
737  switch (xevent->type ())
738  {
739  case QEvent::Move:
742  break;
743 
744  case QEvent::Resize:
746  break;
747 
748  default:
749  break;
750  }
751  }
752  }
753 }
754 
755 void
757 {
758  QMessageBox::about (qWidget<QMainWindow> (), tr ("About QtHandles"),
759  ABOUT_TEXT);
760 }
761 
762 void
764 {
765  if (m_blockUpdates)
766  return;
767 
769 
770  figure::properties& fp = properties<figure> ();
771 
773 
774  Canvas* canvas = m_container->canvas (m_handle);
775 
776  if (canvas)
777  canvas->setCursor (mode);
778 }
779 
780 void
782 {
783  QString file = fileName ();
784 
785  if (file.isEmpty ())
786  {
787  prompt = true;
788 
789  file = "untitled.pdf";
790  }
791 
792  if (prompt || file.isEmpty ())
793  {
794  QFileInfo finfo (file);
795 
796  file = QFileDialog::getSaveFileName (qWidget<FigureWindow> (),
797  tr ("Save Figure As"),
798  finfo.absoluteFilePath (), 0, 0,
799  QFileDialog::DontUseNativeDialog);
800  }
801 
802  if (! file.isEmpty ())
803  {
804  QFileInfo finfo (file);
805 
806  setFileName (finfo.absoluteFilePath ());
807 
809  file.toStdString ());
810  }
811 }
812 
813 void
814 Figure::save_figure_callback (const std::string& file)
815 {
816  Ffeval (ovl ("print", file));
817 }
818 
819 void
820 Figure::copy_figure_callback (const std::string& format)
821 {
822  std::string msg;
823 
824  std::string file = octave_tempnam ("", "oct-", msg) + "." + format;
825 
826  if (file.empty ())
827  {
828  // Report error?
829  return;
830  }
831 
832  std::string device = "-d" + format;
833 
834  Ffeval (ovl ("print", file, device));
835 
837 }
838 
839 void
841 {
842  fileSaveFigure (true);
843 }
844 
845 void
847 {
848  qWidget<QMainWindow> ()->close ();
849 }
850 
851 void
852 Figure::editCopy (bool /* choose_format */)
853 {
854  QString format = "png";
855 
856 #if 0
857 
858  // FIXME: allow choice of image formats.
859 
860  if (choose_format)
861  {
862  QFileInfo finfo (file);
863 
864  format = QFileDialog::getSaveFileName (qWidget<FigureWindow> (),
865  tr ("Save Figure As"),
866  finfo.absoluteFilePath (), 0, 0,
867  QFileDialog::DontUseNativeDialog);
868  }
869 #endif
870 
872  format.toStdString ());
873 }
874 
875 void
876 Figure::addCustomToolBar (QToolBar* bar, bool visible)
877 {
878  QMainWindow* win = qWidget<QMainWindow> ();
879 
880  if (! visible)
881  win->addToolBar (bar);
882  else
883  {
884  QSize sz = bar->sizeHint ();
885  QRect r = win->geometry ();
886  //qDebug () << "Figure::addCustomToolBar:" << r;
887 
888  r.adjust (0, -sz.height (), 0, 0);
889 
890  m_blockUpdates = true;
891  win->setGeometry (r);
892  win->addToolBarBreak ();
893  win->addToolBar (bar);
894  m_blockUpdates = false;
895 
896  //qDebug () << "Figure::addCustomToolBar:" << win->geometry ();
897  updateBoundingBox (false);
898  }
899 }
900 
901 void
902 Figure::showCustomToolBar (QToolBar* bar, bool visible)
903 {
904  QMainWindow* win = qWidget<QMainWindow> ();
905 
906  if ((! bar->isHidden ()) != visible)
907  {
908  QSize sz = bar->sizeHint ();
909  QRect r = win->geometry ();
910 
911  if (visible)
912  r.adjust (0, -sz.height (), 0, 0);
913  else
914  r.adjust (0, sz.height (), 0, 0);
915 
916  m_blockUpdates = true;
917  win->setGeometry (r);
918  bar->setVisible (visible);
919  m_blockUpdates = false;
920 
921  updateBoundingBox (false);
922  }
923 }
924 
925 void
927 {
928  redraw ();
929 }
930 
931 void
933 {
934  Canvas* canvas = m_container->canvas (m_handle);
935 
936  if (canvas)
937  canvas->toggleAxes (m_handle);
938 }
939 
940 void
942 {
943  Canvas* canvas = m_container->canvas (m_handle);
944 
945  if (canvas)
946  canvas->toggleGrid (m_handle);
947 }
948 
949 void
951 {
952  Canvas* canvas = m_container->canvas (m_handle);
953 
954  if (canvas)
955  canvas->autoAxes (m_handle);
956 }
957 
958 }; // namespace QtHandles
void fileSaveFigure(bool prompt=false)
Definition: Figure.cc:781
virtual QWidget * qWidget(void)=0
void update(int pId)
Definition: Figure.cc:399
QWidget * menu(void)
Definition: Figure.cc:555
QString fileName(void)
Definition: Figure.cc:241
QRect m_outerRect
Definition: Figure.h:136
#define ABOUT_TEXT
Definition: Figure.cc:63
static MouseMode mouse_mode_from_string(const std::string &mode)
Definition: Figure.cc:220
void showFigureToolBar(bool visible)
Definition: Figure.cc:488
void fileCloseFigure(void)
Definition: Figure.cc:846
static void post_callback(const graphics_handle &h, const std::string &name, const octave_value &data=Matrix())
Definition: graphics.h:13329
std::string get_title(void) const
Definition: graphics.cc:4623
bool is_visible(void) const
Definition: graphics.h:2758
double xround(double x)
Definition: lo-mappers.cc:63
static void updateBoundingBoxHelper(void *)
Definition: Figure.cc:569
Container * m_container
Definition: Figure.h:131
bool isa(const std::string &go_name) const
Definition: graphics.h:3375
QList< QAction * > actions(void) const
void set___mouse_mode__(const octave_value &val)
Definition: graphics.cc:1825
octave_idx_type numel(void) const
Number of elements in the array.
Definition: Array.h:275
MouseMode
Definition: Figure.h:38
virtual void autoAxes(const graphics_handle &handle)=0
void showCustomToolBar(QToolBar *bar, bool visible)
Definition: Figure.cc:902
#define CTRL(x)
Definition: kpty.cpp:143
std::string get___mouse_mode__(void) const
Definition: graphics.h:4291
void setEventMask(int m)
Definition: Canvas.h:61
void beingDeleted(void)
Definition: Figure.cc:386
QString fromStdString(const std::string &s)
bool toolbar_is(const std::string &v) const
Definition: graphics.h:4251
void addEventMask(int m)
Definition: Canvas.h:59
void print(const QString &file_cmd, const QString &term)
Definition: Canvas.cc:104
static QRect boundingBoxToRect(const Matrix &bb)
Definition: Figure.cc:105
void redraw(bool sync=false)
Definition: Canvas.cc:53
void editCopy(bool choose_format=false)
Definition: Figure.cc:852
Figure(const graphics_object &go, FigureWindow *win)
Definition: Figure.cc:126
F77_RET_T const double const double double * d
static bool hasUiControlChildren(const figure::properties &fp)
Definition: Figure.cc:68
void updateMenuBar(void)
Definition: Figure.cc:545
void showMenuBar(bool visible)
Definition: Figure.cc:510
void updateContainer(void)
Definition: Figure.cc:926
void setMouseMode(MouseMode mode)
Definition: Figure.cc:763
void addCustomToolBar(QToolBar *bar, bool visible)
Definition: Figure.cc:876
double value(void) const
Definition: oct-handle.h:70
void set_filename(const octave_value &val)
Definition: graphics.h:4421
void asyncUpdate(void)
Definition: moc-Figure.cc:136
std::string string_value(bool force=false) const
Definition: ov.h:897
void copy_figure_callback(const std::string &format)
Definition: Figure.cc:820
std::complex< double > w(std::complex< double > z, double relerr=0)
void slotRedraw(void)
Definition: Object.cc:115
graphics_handle m_handle
Definition: Object.h:100
static Object * fromQObject(QObject *obj)
Definition: Object.cc:181
void helpAboutQtHandles(void)
Definition: Figure.cc:756
void fileSaveFigureAs(void)
Definition: Figure.cc:840
void createFigureToolBarAndMenuBar(void)
Definition: Figure.cc:284
MouseModeActionGroup * m_mouseModeGroup
Definition: Figure.h:137
void removeReceiver(GenericEventNotifyReceiver *r)
void eventNotifyAfter(QObject *watched, QEvent *event)
Definition: Figure.cc:691
Definition: dMatrix.h:35
std::string get_filename(void) const
Definition: graphics.h:4182
octave_value get_keyreleasefcn(void) const
Definition: graphics.h:4194
MenuBar * m_menuBar
Definition: Figure.h:134
void toggleGrid(void)
Definition: Figure.cc:941
virtual void toggleAxes(const graphics_handle &handle)=0
virtual void toggleGrid(const graphics_handle &handle)=0
graphics_object object(void) const
Definition: Object.cc:73
octave_value get_windowbuttonmotionfcn(void) const
Definition: graphics.h:4261
bool eventNotifyBefore(QObject *watched, QEvent *event)
Definition: Figure.cc:646
bool valid_object(void) const
Definition: graphics.h:3395
bool is_empty(void) const
Definition: ov.h:526
Container * innerContainer(void)
Definition: Figure.cc:348
bool menubar_is(const std::string &v) const
Definition: graphics.h:4196
static bool hasUiMenuChildren(const figure::properties &fp)
Definition: Figure.cc:87
octave_value_list ovl(const octave_value &a0)
Definition: oct-obj.h:178
void autoAxes(void)
Definition: Figure.cc:950
octave_scalar_map scalar_map_value(void) const
Definition: ov.cc:1591
QRect m_innerRect
Definition: Figure.h:135
void toggleAxes(void)
Definition: Figure.cc:932
bool m_blockUpdates
Definition: Figure.h:132
void setCursor(MouseMode mode)
Definition: Canvas.cc:73
static std::string mouse_mode_to_string(MouseMode mode)
Definition: Figure.cc:187
QToolBar * m_figureToolBar
Definition: Figure.h:133
Matrix get_all_children(void) const
Definition: graphics.h:2576
void print(const QString &file_cmd, const QString &term)
Definition: Figure.cc:377
void addReceiver(GenericEventNotifyReceiver *r)
static graphics_object get_object(double val)
Definition: graphics.h:13212
void set_boundingbox(const Matrix &bb, bool internal=false, bool do_notify_toolkit=true)
Definition: graphics.cc:3878
static void post_function(graphics_event::event_fcn fcn, void *data=0)
Definition: graphics.h:13337
MouseMode mouseMode(void)
Definition: Figure.cc:263
static Figure * create(const graphics_object &go)
Definition: Figure.cc:121
octave_value getfield(const std::string &key) const
Definition: oct-map.cc:164
OCTINTERP_API octave_value_list Ffeval(const octave_value_list &=octave_value_list(), int=0)
Definition: oct-parse.cc:8742
Canvas * canvas(const graphics_handle &handle, bool create=true)
Definition: Container.cc:51
octave_value get___zoom_mode__(void) const
Definition: graphics.h:4297
void updateFigureToolBarAndMenuBar(void)
Definition: Figure.cc:337
void redraw(void)
Definition: Figure.cc:354
#define DECLARE_GENERICEVENTNOTIFY_SENDER(T, B)
void updateBoundingBox(bool internal=false, int flags=0)
Definition: Figure.cc:587
octave_value get_keypressfcn(void) const
Definition: graphics.h:4191
std::string octave_tempnam(const std::string &dir, const std::string &pfx)
Definition: file-ops.cc:671
Matrix get_boundingbox(bool internal=false, const Matrix &parent_pix_size=Matrix()) const
Definition: graphics.cc:3861
void save_figure_callback(const std::string &file)
Definition: Figure.cc:814
void setFileName(const QString &name)
Definition: Figure.cc:253
void blockRedraw(bool block=true)
Definition: Canvas.cc:67
void clearEventMask(int m)
Definition: Canvas.h:60