GNU Octave  4.2.1
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-2017 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 #if defined (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 #include "version.h"
56 
57 #include "octave-qt-link.h"
58 
59 #include "builtin-defun-decls.h"
60 
61 namespace QtHandles
62 {
63 
65 
66  static bool
68  {
70 
71  Matrix kids = fp.get_all_children ();
72 
73  for (int i = 0; i < kids.numel (); i++)
74  {
76 
77  if (go && (go.isa ("uicontrol") || go.isa ("uipanel")
78  || go.isa ("uibuttongroup")))
79  return true;
80  }
81 
82  return false;
83  }
84 
85  static bool
87  {
89 
90  Matrix kids = fp.get_all_children ();
91 
92  for (int i = 0; i < kids.numel (); i++)
93  {
95 
96  if (go && go.isa ("uimenu"))
97  return true;
98  }
99 
100  return false;
101  }
102 
103  static QRect
105  {
106  QRect r;
107 
108  if (bb.numel () == 4)
109  {
110  r = QRect (octave::math::round (bb(0)), octave::math::round (bb(1)),
111  octave::math::round (bb(2)), octave::math::round (bb(3)));
112  if (! r.isValid ())
113  r = QRect ();
114  }
115 
116  return r;
117  }
118 
119  Figure*
121  {
122  return new Figure (go, new FigureWindow ());
123  }
124 
126  : Object (go, win), m_blockUpdates (false), m_figureToolBar (0),
127  m_menuBar (0), m_innerRect (), m_outerRect (), m_mouseModeGroup (0)
128  {
129  m_container = new Container (win);
130  win->setCentralWidget (m_container);
131 
132  figure::properties& fp = properties<figure> ();
133 
134  // Status bar
135  m_statusBar = win->statusBar ();
136  int boffset = 0;
137 
138  // Toolbar and menubar
140  int toffset = 0;
141 
142  if (fp.toolbar_is ("figure") ||
143  (fp.toolbar_is ("auto") && fp.menubar_is ("figure") &&
144  ! hasUiControlChildren (fp)))
145  {
146  toffset += m_figureToolBar->sizeHint ().height ();
147  boffset += m_statusBar->sizeHint ().height ();
148  }
149  else
150  {
151  m_figureToolBar->hide ();
152  m_statusBar->hide ();
153  }
154 
155  if (fp.menubar_is ("figure") || hasUiMenuChildren (fp))
156  toffset += m_menuBar->sizeHint ().height ();
157  else
158  m_menuBar->hide ();
159 
162 
163  win->setGeometry (m_innerRect.adjusted (0, -toffset, 0, boffset));
164 
165  // Enable mouse tracking unconditionally
167 
168  // When this constructor gets called all properties are already
169  // set, even non default. We force "update" here to get things right.
170 
171  // Figure title
173 
174  // Decide what keyboard events we listen to
178 
179  // modal style
181 
182  // Visibility
184 
185  connect (this, SIGNAL (asyncUpdate (void)),
186  this, SLOT (updateContainer (void)));
187 
188  win->addReceiver (this);
189  m_container->addReceiver (this);
190  }
191 
193  { }
194 
195  static std::string
197  {
198  switch (mode)
199  {
200  case NoMode:
201  return "none";
202 
203  case RotateMode:
204  return "rotate";
205 
206  case ZoomInMode:
207  return "zoom in";
208 
209  case ZoomOutMode:
210  return "zoom out";
211 
212  case PanMode:
213  return "pan";
214 
215  case TextMode:
216  return "text";
217 
218  case SelectMode:
219  return "select";
220 
221  default:
222  break;
223  }
224 
225  return "none";
226  }
227 
228  static MouseMode
230  {
231  if (mode == "none")
232  return NoMode;
233  else if (mode == "rotate")
234  return RotateMode;
235  else if (mode == "zoom in")
236  return ZoomInMode;
237  else if (mode == "zoom out")
238  return ZoomOutMode;
239  else if (mode == "pan")
240  return PanMode;
241  else if (mode == "text")
242  return TextMode;
243  else if (mode == "select")
244  return SelectMode;
245  else
246  return NoMode;
247  }
248 
249  QString
251  {
253 
254  const figure::properties& fp = properties<figure> ();
255 
256  std::string name = fp.get_filename ();
257 
258  return QString::fromStdString (name);
259  }
260 
261  void
262  Figure::setFileName (const QString& name)
263  {
265 
266  figure::properties& fp = properties<figure> ();
267 
268  fp.set_filename (name.toStdString ());
269  }
270 
271  MouseMode
273  {
275 
276  const figure::properties& fp = properties<figure> ();
277 
279 
280  if (mode == "zoom")
281  {
283 
284  std::string direction = zm.getfield ("Direction").string_value ();
285 
286  mode += " " + direction;
287  }
288 
289  return mouse_mode_from_string (mode);
290  }
291 
292  void
294  {
295  QMainWindow* win = qWidget<QMainWindow> ();
296 
297  m_figureToolBar = win->addToolBar (tr ("Figure ToolBar"));
298  m_figureToolBar->setMovable (false);
299  m_figureToolBar->setFloatable (false);
300 
302  connect (m_mouseModeGroup, SIGNAL (modeChanged (MouseMode)),
303  SLOT (setMouseMode (MouseMode)));
304  m_figureToolBar->addActions (m_mouseModeGroup->actions ());
305 
306  QAction *toggle_axes = m_figureToolBar->addAction (tr ("Axes"));
307  connect (toggle_axes, SIGNAL (triggered (void)),
308  this, SLOT (toggleAxes (void)));
309 
310  QAction *toggle_grid = m_figureToolBar->addAction (tr ("Grid"));
311  connect (toggle_grid, SIGNAL (triggered (void)),
312  this, SLOT (toggleGrid (void)));
313 
314  QAction *auto_axes = m_figureToolBar->addAction (tr ("Autoscale"));
315  connect (auto_axes, SIGNAL (triggered (void)),
316  this, SLOT (autoAxes (void)));
317 
318  m_menuBar = new MenuBar (win);
319  win->setMenuBar (m_menuBar);
320 
321  QMenu* fileMenu = m_menuBar->addMenu (tr ("&File"));
322  fileMenu->menuAction ()->setObjectName ("builtinMenu");
323  fileMenu->addAction (tr ("&Save"), this, SLOT (fileSaveFigure (bool)));
324  fileMenu->addAction (tr ("Save &As"), this, SLOT (fileSaveFigureAs (void)));
325  fileMenu->addSeparator ();
326  fileMenu->addAction (tr ("&Close Figure"), this,
327  SLOT (fileCloseFigure (void)), Qt::CTRL | Qt::Key_W);
328 
329  QMenu* editMenu = m_menuBar->addMenu (tr ("&Edit"));
330  editMenu->menuAction ()->setObjectName ("builtinMenu");
331  editMenu->addAction (tr ("Cop&y"), this, SLOT (editCopy (bool)),
332  Qt::CTRL | Qt::Key_C);
333  editMenu->addSeparator ();
334  editMenu->addActions (m_mouseModeGroup->actions ());
335 
336  QMenu* helpMenu = m_menuBar->addMenu (tr ("&Help"));
337  helpMenu->menuAction ()->setObjectName ("builtinMenu");
338  helpMenu->addAction (tr ("About Octave"), this,
339  SLOT (helpAboutOctave (void)));
340 
341  m_menuBar->addReceiver (this);
342  }
343 
344  void
346  {
347  if (m_mouseModeGroup)
348  {
349  m_blockUpdates = true;
351  m_blockUpdates = false;
352  }
353  }
354 
355  Container*
357  {
358  return m_container;
359  }
360 
361  void
363  {
364  Canvas* canvas = m_container->canvas (m_handle);
365 
366  if (canvas)
367  {
368  canvas->redraw ();
369  //canvas->setMouseMode (RotateMode);
370  }
371 
372  foreach (QFrame* frame,
373  qWidget<QWidget> ()->findChildren<QFrame*> ())
374  {
375  if (frame->objectName () == "UIPanel"
376  || frame->objectName () == "UIButtonGroup")
377  {
378  Object* obj = Object::fromQObject (frame);
379 
380  if (obj)
381  obj->slotRedraw ();
382  }
383  }
384 
386  }
387 
388  void
389  Figure::print (const QString& file_cmd, const QString& term)
390  {
391  Canvas* canvas = m_container->canvas (m_handle);
392 
393  if (canvas)
394  canvas->print (file_cmd, term);
395  }
396 
397  void
399  {
400  Canvas* canvas = m_container->canvas (m_handle.value (), false);
401 
402  if (canvas)
403  canvas->blockRedraw (true);
404 
405  m_menuBar->removeReceiver (this);
406  m_container->removeReceiver (this);
407  qWidget<FigureWindow> ()->removeReceiver (this);
408  }
409 
410  void
411  Figure::update (int pId)
412  {
413  if (m_blockUpdates)
414  return;
415 
416  figure::properties& fp = properties<figure> ();
417  QMainWindow* win = qWidget<QMainWindow> ();
418 
419  m_blockUpdates = true;
420 
421  switch (pId)
422  {
424  {
426  int toffset = 0;
427  int boffset = 0;
428 
429  foreach (QToolBar* tb, win->findChildren<QToolBar*> ())
430  if (! tb->isHidden ())
431  toffset += tb->sizeHint ().height ();
432 
433  if (! m_menuBar->isHidden ())
434  toffset += m_menuBar->sizeHint ().height ();
435 
436  if (! m_statusBar->isHidden ())
437  boffset += m_statusBar->sizeHint ().height ();
438 
439  win->setGeometry (m_innerRect.adjusted (0, -toffset, 0, boffset));
440  }
441  break;
442 
445  win->setWindowTitle (Utils::fromStdString (fp.get_title ()));
446  break;
447 
449  if (fp.is_visible ())
450  QTimer::singleShot (0, win, SLOT (show ()));
451  else
452  win->hide ();
453  break;
454 
456  if (fp.toolbar_is ("none"))
457  showFigureToolBar (false);
458  else if (fp.toolbar_is ("figure"))
459  showFigureToolBar (true);
460  else // "auto"
462  fp.menubar_is ("figure"));
463  break;
464 
466  showMenuBar (fp.menubar_is ("figure"));
467  if (fp.toolbar_is ("auto"))
468  showFigureToolBar (fp.menubar_is ("figure"));
469  break;
470 
472  if (fp.get_keypressfcn ().is_empty ())
474  else
476  break;
477 
479  if (fp.get_keyreleasefcn ().is_empty ())
481  else
483  break;
484 
486  if (fp.windowstyle_is ("modal"))
487  {
488  bool is_visible = win->isVisible ();
489 
490  // if window is already visible, need to hide and reshow it in order to
491  // make it use the modal settings
492  if (is_visible)
493  win->setVisible (false);
494 
495  win->setWindowModality (Qt::ApplicationModal);
496  win->setVisible (is_visible);
497  }
498  else
499  win->setWindowModality (Qt::NonModal);
500 
501  break;
502 
503  default:
504  break;
505  }
506 
507  m_blockUpdates = false;
508  }
509 
510  void
512  {
513  if ((! m_figureToolBar->isHidden ()) != visible)
514  {
515  int dy1 = m_figureToolBar->sizeHint ().height ();
516  int dy2 = m_statusBar->sizeHint ().height ();
517  QRect r = qWidget<QWidget> ()->geometry ();
518 
519  if (! visible)
520  r.adjust (0, dy1, 0, -dy2);
521  else
522  r.adjust (0, -dy1, 0, dy2);
523 
524  m_blockUpdates = true;
525  qWidget<QWidget> ()->setGeometry (r);
526  m_figureToolBar->setVisible (visible);
527  m_statusBar->setVisible (visible);
528  m_blockUpdates = false;
529 
530  updateBoundingBox (false);
531  }
532  }
533 
534  void
535  Figure::showMenuBar (bool visible)
536  {
537  int h1 = m_menuBar->sizeHint ().height ();
538 
539  foreach (QAction* a, m_menuBar->actions ())
540  if (a->objectName () == "builtinMenu")
541  a->setVisible (visible);
542 
543  int h2 = m_menuBar->sizeHint ().height ();
544 
545  if (! visible)
546  visible = hasUiMenuChildren (properties<figure> ());
547 
548  if (! m_menuBar->isHidden ())
549  {
550  int dy = qMax (h1, h2);
551  QRect r = qWidget<QWidget> ()->geometry ();
552 
553  //qDebug () << "Figure::showMenuBar:" << r;
554  if (! visible)
555  r.adjust (0, dy, 0, 0);
556  else
557  r.adjust (0, -dy, 0, 0);
558  //qDebug () << "Figure::showMenuBar(adjusted):" << r;
559 
560  m_blockUpdates = true;
561  qWidget<QWidget> ()->setGeometry (r);
562  m_menuBar->setVisible (visible);
563  m_blockUpdates = false;
564 
565  updateBoundingBox (false);
566  }
567  }
568 
569  void
571  {
573  graphics_object go = object ();
574 
575  if (go.valid_object ())
576  showMenuBar (Utils::properties<figure> (go).menubar_is ("figure"));
577  }
578 
579  void
581  {
582  if (! m_statusBar->isHidden ())
583  m_statusBar->showMessage (QString ("(%1, %2)")
584  .arg (pt(0), 0, 'g', 5)
585  .arg (pt(1), 0, 'g', 5));
586  }
587 
588  QWidget*
590  {
591  return qWidget<QMainWindow> ()->menuBar ();
592  }
593 
595  {
600  };
601 
602  void
604  {
606 
607  UpdateBoundingBoxData* d = reinterpret_cast<UpdateBoundingBoxData*> (data);
609 
610  if (go.valid_object ())
611  {
612  figure::properties& fp = Utils::properties<figure> (go);
613 
614  fp.set_boundingbox (d->m_bbox, d->m_internal, false);
615  }
616 
617  delete d;
618  }
619 
620  void
621  Figure::updateBoundingBox (bool internal, int flags)
622  {
623  QWidget* win = qWidget<QWidget> ();
624  Matrix bb (1, 4);
625 
626  if (internal)
627  {
628  QRect r = m_innerRect;
629 
630  if (flags & UpdateBoundingBoxPosition)
631  r.moveTopLeft (win->mapToGlobal (m_container->pos ()));
632  if (flags & UpdateBoundingBoxSize)
633  r.setSize (m_container->size ());
634 
635  if (r.isValid () && r != m_innerRect)
636  {
637  m_innerRect = r;
638 
639  bb(0) = r.x ();
640  bb(1) = r.y ();
641  bb(2) = r.width ();
642  bb(3) = r.height ();
643  }
644  else
645  return;
646  }
647  else
648  {
649  QRect r = m_outerRect;
650 
651  if (flags & UpdateBoundingBoxPosition)
652  r.moveTopLeft (win->pos ());
653  if (flags & UpdateBoundingBoxSize)
654  r.setSize (win->frameGeometry ().size ());
655 
656  if (r.isValid () && r != m_outerRect)
657  {
658  m_outerRect = r;
659 
660  bb(0) = r.x ();
661  bb(1) = r.y ();
662  bb(2) = r.width ();
663  bb(3) = r.height ();
664  }
665  else
666  return;
667  }
668 
670 
671  d->m_bbox = bb;
672  d->m_internal = internal;
673  d->m_handle = m_handle;
674  d->m_figure = this;
675 
677  }
678 
679  bool
680  Figure::eventNotifyBefore (QObject* obj, QEvent* xevent)
681  {
682  if (! m_blockUpdates)
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::ActionRemoved:
693  {
694  QAction* a = dynamic_cast<QActionEvent*> (xevent)->action ();
695 
696  if (! a->isSeparator ()
697  && a->objectName () != "builtinMenu")
698  updateMenuBar ();
699  }
700  break;
701 
702  default:
703  break;
704  }
705  }
706  else
707  {
708  switch (xevent->type ())
709  {
710  case QEvent::Close:
711  xevent->ignore ();
712  gh_manager::post_callback (m_handle, "closerequestfcn");
713  return true;
714 
715  default:
716  break;
717  }
718  }
719  }
720 
721  return false;
722  }
723 
724  void
725  Figure::eventNotifyAfter (QObject* watched, QEvent* xevent)
726  {
727  if (! m_blockUpdates)
728  {
729  if (watched == m_container)
730  {
731  switch (xevent->type ())
732  {
733  case QEvent::Resize:
735  break;
736 
737  case QEvent::ChildAdded:
738  if (dynamic_cast<QChildEvent*> (xevent)->child
739  ()->isWidgetType())
740  {
743 
745  }
746 
747  case QEvent::ChildRemoved:
748  if (dynamic_cast<QChildEvent*> (xevent)->child
749  ()->isWidgetType())
750  {
753  }
754 
755  default:
756  break;
757  }
758  }
759  else if (watched == m_menuBar)
760  {
761  switch (xevent->type ())
762  {
763  case QEvent::ActionAdded:
764  {
765  QAction* a = dynamic_cast<QActionEvent*> (xevent)->action ();
766 
767  if (! a->isSeparator ()
768  && a->objectName () != "builtinMenu")
769  updateMenuBar ();
770  }
771  break;
772 
773  default:
774  break;
775  }
776  }
777  else
778  {
779  switch (xevent->type ())
780  {
781  case QEvent::Move:
784  break;
785 
786  case QEvent::Resize:
788  break;
789 
790  default:
791  break;
792  }
793  }
794  }
795  }
796 
797  void
799  {
802 
803  QMessageBox::about (qWidget<QMainWindow> (), tr ("About Octave"),
804  QString::fromStdString (message));
805  }
806 
807  void
809  {
810  if (m_blockUpdates)
811  return;
812 
814 
815  figure::properties& fp = properties<figure> ();
816 
818 
819  Canvas* canvas = m_container->canvas (m_handle);
820 
821  if (canvas)
822  canvas->setCursor (mode);
823  }
824 
825  void
827  {
828  QString file = fileName ();
829 
830  if (file.isEmpty ())
831  {
832  prompt = true;
833 
834  file = "untitled.pdf";
835  }
836 
837  if (prompt || file.isEmpty ())
838  {
839  QFileInfo finfo (file);
840 
841  file = QFileDialog::getSaveFileName (qWidget<FigureWindow> (),
842  tr ("Save Figure As"),
843  finfo.absoluteFilePath (), 0, 0,
844  QFileDialog::DontUseNativeDialog);
845  }
846 
847  if (! file.isEmpty ())
848  {
849  QFileInfo finfo (file);
850 
851  setFileName (finfo.absoluteFilePath ());
852 
854  file.toStdString ());
855  }
856  }
857 
858  void
860  {
861  figure::properties& fp = properties<figure> ();
863 
864  Ffeval (ovl ("print", fnum, file));
865  }
866 
867  void
869  {
870  std::string msg;
871 
872  std::string file = octave::sys::tempnam ("", "oct-", msg) + "." + format;
873 
874  if (file.empty ())
875  {
876  // Report error?
877  return;
878  }
879 
880  save_figure_callback (file);
881 
883  }
884 
885  void
887  {
888  fileSaveFigure (true);
889  }
890 
891  void
893  {
894  qWidget<QMainWindow> ()->close ();
895  }
896 
897  void
898  Figure::editCopy (bool /* choose_format */)
899  {
900  QString format = "png";
901 
902 #if 0
903 
904  // FIXME: allow choice of image formats.
905 
906  if (choose_format)
907  {
908  QFileInfo finfo (file);
909 
910  format = QFileDialog::getSaveFileName (qWidget<FigureWindow> (),
911  tr ("Save Figure As"),
912  finfo.absoluteFilePath (), 0, 0,
913  QFileDialog::DontUseNativeDialog);
914  }
915 #endif
916 
918  format.toStdString ());
919  }
920 
921  void
922  Figure::addCustomToolBar (QToolBar* bar, bool visible)
923  {
924  QMainWindow* win = qWidget<QMainWindow> ();
925 
926  if (! visible)
927  win->addToolBar (bar);
928  else
929  {
930  QSize sz = bar->sizeHint ();
931  QRect r = win->geometry ();
932  //qDebug () << "Figure::addCustomToolBar:" << r;
933 
934  r.adjust (0, -sz.height (), 0, 0);
935 
936  m_blockUpdates = true;
937  win->setGeometry (r);
938  win->addToolBarBreak ();
939  win->addToolBar (bar);
940  m_blockUpdates = false;
941 
942  //qDebug () << "Figure::addCustomToolBar:" << win->geometry ();
943  updateBoundingBox (false);
944  }
945  }
946 
947  void
948  Figure::showCustomToolBar (QToolBar* bar, bool visible)
949  {
950  QMainWindow* win = qWidget<QMainWindow> ();
951 
952  if ((! bar->isHidden ()) != visible)
953  {
954  QSize sz = bar->sizeHint ();
955  QRect r = win->geometry ();
956 
957  if (visible)
958  r.adjust (0, -sz.height (), 0, 0);
959  else
960  r.adjust (0, sz.height (), 0, 0);
961 
962  m_blockUpdates = true;
963  win->setGeometry (r);
964  bar->setVisible (visible);
965  m_blockUpdates = false;
966 
967  updateBoundingBox (false);
968  }
969  }
970 
971  void
973  {
974  redraw ();
975  }
976 
977  void
979  {
980  Canvas* canvas = m_container->canvas (m_handle);
981 
982  if (canvas)
983  canvas->toggleAxes (m_handle);
984  }
985 
986  void
988  {
989  Canvas* canvas = m_container->canvas (m_handle);
990 
991  if (canvas)
992  canvas->toggleGrid (m_handle);
993  }
994 
995  void
997  {
998  Canvas* canvas = m_container->canvas (m_handle);
999 
1000  if (canvas)
1001  canvas->autoAxes (m_handle);
1002  }
1003 
1004  void
1006  {
1007  // Enable mouse tracking on every widgets
1008  m_container->setMouseTracking (true);
1009  m_container->canvas (m_handle)->qWidget ()->setMouseTracking (true);
1010  foreach (QWidget* w, m_container->findChildren<QWidget*> ())
1011  { w->setMouseTracking (true); }
1012  }
1013 
1014 }
void fileSaveFigure(bool prompt=false)
Definition: Figure.cc:826
virtual QWidget * qWidget(void)=0
void update(int pId)
Definition: Figure.cc:411
QWidget * menu(void)
Definition: Figure.cc:589
QString fileName(void)
Definition: Figure.cc:250
QRect m_outerRect
Definition: Figure.h:141
For example cd octave end example noindent changes the current working directory to file
Definition: dirfns.cc:120
static MouseMode mouse_mode_from_string(const std::string &mode)
Definition: Figure.cc:229
void showFigureToolBar(bool visible)
Definition: Figure.cc:511
void fileCloseFigure(void)
Definition: Figure.cc:892
static void post_callback(const graphics_handle &h, const std::string &name, const octave_value &data=Matrix())
Definition: graphics.h:13910
std::string get_title(void) const
Definition: graphics.cc:4427
bool is_visible(void) const
Definition: graphics.h:2704
static void updateBoundingBoxHelper(void *)
Definition: Figure.cc:603
Container * m_container
Definition: Figure.h:135
bool isa(const std::string &go_name) const
Definition: graphics.h:3286
QList< QAction * > actions(void) const
OCTAVE_EXPORT octave_value_list isa nd deftypefn *return ovl(args(0).is_integer_type())
void set___mouse_mode__(const octave_value &val)
Definition: graphics.cc:1879
octave_idx_type numel(void) const
Number of elements in the array.
Definition: Array.h:363
MouseMode
Definition: Figure.h:39
Return the CPU time used by your Octave session The first output is the total time spent executing your process and is equal to the sum of second and third which are the number of CPU seconds spent executing in user mode and the number of CPU seconds spent executing in system mode
Definition: data.cc:6386
virtual void autoAxes(const graphics_handle &handle)=0
void showCustomToolBar(QToolBar *bar, bool visible)
Definition: Figure.cc:948
#define CTRL(x)
Definition: kpty.cpp:143
std::string get___mouse_mode__(void) const
Definition: graphics.h:4135
std::string tempnam(const std::string &dir, const std::string &pfx)
Definition: file-ops.cc:670
void setEventMask(int m)
Definition: Canvas.h:61
void helpAboutOctave(void)
Definition: Figure.cc:798
void beingDeleted(void)
Definition: Figure.cc:398
QString fromStdString(const std::string &s)
void enableMouseTracking(void)
Definition: Figure.cc:1005
bool toolbar_is(const std::string &v) const
Definition: graphics.h:4095
void addEventMask(int m)
Definition: Canvas.h:59
void print(const QString &file_cmd, const QString &term)
Definition: Canvas.cc:105
static QRect boundingBoxToRect(const Matrix &bb)
Definition: Figure.cc:104
void redraw(bool sync=false)
Definition: Canvas.cc:54
void editCopy(bool choose_format=false)
Definition: Figure.cc:898
Figure(const graphics_object &go, FigureWindow *win)
Definition: Figure.cc:125
octave_value arg
Definition: pr-output.cc:3440
double round(double x)
Definition: lo-mappers.cc:333
static bool hasUiControlChildren(const figure::properties &fp)
Definition: Figure.cc:67
F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T F77_REAL F77_REAL &F77_RET_T F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE * d
void updateMenuBar(void)
Definition: Figure.cc:570
void showMenuBar(bool visible)
Definition: Figure.cc:535
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
Definition: cellfun.cc:398
void updateContainer(void)
Definition: Figure.cc:972
void setMouseMode(MouseMode mode)
Definition: Figure.cc:808
void addCustomToolBar(QToolBar *bar, bool visible)
Definition: Figure.cc:922
void message(const char *name, const char *fmt,...)
Definition: error.cc:430
OCTAVE_EXPORT octave_value_list any number nd example oindent prints the prompt xample Pick a any number!nd example oindent and waits for the user to enter a value The string entered by the user is evaluated as an so it may be a literal a variable name
Definition: input.cc:871
double value(void) const
Definition: oct-handle.h:74
void set_filename(const octave_value &val)
Definition: graphics.h:4255
void asyncUpdate(void)
Definition: moc-Figure.cc:136
std::string string_value(bool force=false) const
Definition: ov.h:908
void copy_figure_callback(const std::string &format)
Definition: Figure.cc:868
std::complex< double > w(std::complex< double > z, double relerr=0)
void slotRedraw(void)
Definition: Object.cc:114
graphics_handle m_handle
Definition: Object.h:100
static Object * fromQObject(QObject *obj)
Definition: Object.cc:176
void fileSaveFigureAs(void)
Definition: Figure.cc:886
is false
Definition: cellfun.cc:398
void createFigureToolBarAndMenuBar(void)
Definition: Figure.cc:293
MouseModeActionGroup * m_mouseModeGroup
Definition: Figure.h:142
void removeReceiver(GenericEventNotifyReceiver *r)
void eventNotifyAfter(QObject *watched, QEvent *event)
Definition: Figure.cc:725
Definition: dMatrix.h:37
sz
Definition: data.cc:5342
LS_TEXT format
Definition: load-save.cc:1580
void updateStatusBar(ColumnVector pt)
Definition: Figure.cc:580
std::string get_filename(void) const
Definition: graphics.h:4022
octave_value get_keyreleasefcn(void) const
Definition: graphics.h:4037
MenuBar * m_menuBar
Definition: Figure.h:138
void toggleGrid(void)
Definition: Figure.cc:987
QStatusBar * m_statusBar
Definition: Figure.h:139
virtual void toggleAxes(const graphics_handle &handle)=0
virtual void toggleGrid(const graphics_handle &handle)=0
graphics_object object(void) const
Definition: Object.cc:72
bool eventNotifyBefore(QObject *watched, QEvent *event)
Definition: Figure.cc:680
octave::unwind_protect frame
Definition: graphics.cc:11584
std::string octave_name_version_copyright_copying_warranty_and_bugs(bool html, const std::string &extra_info)
Definition: version.cc:96
bool valid_object(void) const
Definition: graphics.h:3306
bool is_empty(void) const
Definition: ov.h:542
Container * innerContainer(void)
Definition: Figure.cc:356
bool menubar_is(const std::string &v) const
Definition: graphics.h:4039
static bool hasUiMenuChildren(const figure::properties &fp)
Definition: Figure.cc:86
void autoAxes(void)
Definition: Figure.cc:996
octave_scalar_map scalar_map_value(void) const
Definition: ov.cc:1699
QRect m_innerRect
Definition: Figure.h:140
void toggleAxes(void)
Definition: Figure.cc:978
bool m_blockUpdates
Definition: Figure.h:136
void setCursor(MouseMode mode)
Definition: Canvas.cc:74
static std::string mouse_mode_to_string(MouseMode mode)
Definition: Figure.cc:196
bool windowstyle_is(const std::string &v) const
Definition: graphics.h:4119
=val(i)}if ode{val(i)}occurs in table i
Definition: lookup.cc:239
QToolBar * m_figureToolBar
Definition: Figure.h:137
Matrix get_all_children(void) const
Definition: graphics.h:2522
void print(const QString &file_cmd, const QString &term)
Definition: Figure.cc:389
void addReceiver(GenericEventNotifyReceiver *r)
static graphics_object get_object(double val)
Definition: graphics.h:13794
void set_boundingbox(const Matrix &bb, bool internal=false, bool do_notify_toolkit=true)
Definition: graphics.cc:3710
static void post_function(graphics_event::event_fcn fcn, void *data=0)
Definition: graphics.h:13918
MouseMode mouseMode(void)
Definition: Figure.cc:272
static Figure * create(const graphics_object &go)
Definition: Figure.cc:120
octave_value getfield(const std::string &key) const
Definition: oct-map.cc:171
OCTINTERP_API octave_value_list Ffeval(const octave_value_list &=octave_value_list(), int=0)
Canvas * canvas(const graphics_handle &handle, bool create=true)
Definition: Container.cc:50
graphics_handle get___myhandle__(void) const
Definition: graphics.h:2710
octave_value get___zoom_mode__(void) const
Definition: graphics.h:4143
void updateFigureToolBarAndMenuBar(void)
Definition: Figure.cc:345
void redraw(void)
Definition: Figure.cc:362
#define DECLARE_GENERICEVENTNOTIFY_SENDER(T, B)
void updateBoundingBox(bool internal=false, int flags=0)
Definition: Figure.cc:621
octave_value get_keypressfcn(void) const
Definition: graphics.h:4034
octave_value as_octave_value(void) const
Definition: oct-handle.h:76
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
Definition: utils.cc:854
Matrix get_boundingbox(bool internal=false, const Matrix &parent_pix_size=Matrix()) const
Definition: graphics.cc:3693
void save_figure_callback(const std::string &file)
Definition: Figure.cc:859
void setFileName(const QString &name)
Definition: Figure.cc:262
void blockRedraw(bool block=true)
Definition: Canvas.cc:68
void clearEventMask(int m)
Definition: Canvas.h:60