comparison libgui/graphics/Figure.cc @ 20002:3cc0734283dc

style fixes in Qt graphics code * Backend.cc, BaseControl.cc, ButtonControl.cc, Canvas.cc, CheckBoxControl.cc, Container.cc, ContextMenu.cc, EditControl.cc, Figure.cc, FigureWindow.cc, GLCanvas.cc, KeyMap.cc, ListBoxControl.cc, Logger.cc, Menu.cc, MouseModeActionGroup.cc, Object.cc, ObjectFactory.cc, ObjectProxy.cc, Panel.cc, PopupMenuControl.cc, PushButtonControl.cc, PushTool.cc, QtHandlesUtils.cc, RadioButtonControl.cc, SliderControl.cc, TextControl.cc, TextEdit.cc, ToggleButtonControl.cc, ToggleTool.cc, ToolBar.cc, ToolBarButton.cc, __init_qt__.cc: Follow a few more Octave coding conventions.
author John W. Eaton <jwe@octave.org>
date Thu, 19 Mar 2015 12:27:54 -0400
parents b57b7f3f5e61
children 5e6e0563388b f0e61a67ad9f
comparison
equal deleted inserted replaced
20001:40b2c4323c16 20002:3cc0734283dc
56 56
57 #define ABOUT_TEXT "<b>QtHandles</b> - a Qt-based toolkit for <a href=\"http://www.octave.org\">Octave</a>.<br><br>Copyright (C) 2011-2014 Michael Goffioul" 57 #define ABOUT_TEXT "<b>QtHandles</b> - a Qt-based toolkit for <a href=\"http://www.octave.org\">Octave</a>.<br><br>Copyright (C) 2011-2014 Michael Goffioul"
58 58
59 DECLARE_GENERICEVENTNOTIFY_SENDER(MenuBar, QMenuBar); 59 DECLARE_GENERICEVENTNOTIFY_SENDER(MenuBar, QMenuBar);
60 60
61 static bool hasUiControlChildren (const figure::properties& fp) 61 static bool
62 hasUiControlChildren (const figure::properties& fp)
62 { 63 {
63 gh_manager::auto_lock lock; 64 gh_manager::auto_lock lock;
64 65
65 Matrix kids = fp.get_all_children (); 66 Matrix kids = fp.get_all_children ();
66 67
74 } 75 }
75 76
76 return false; 77 return false;
77 } 78 }
78 79
79 static bool hasUiMenuChildren (const figure::properties& fp) 80 static bool
81 hasUiMenuChildren (const figure::properties& fp)
80 { 82 {
81 gh_manager::auto_lock lock; 83 gh_manager::auto_lock lock;
82 84
83 Matrix kids = fp.get_all_children (); 85 Matrix kids = fp.get_all_children ();
84 86
91 } 93 }
92 94
93 return false; 95 return false;
94 } 96 }
95 97
96 static QRect boundingBoxToRect (const Matrix& bb) 98 static QRect
99 boundingBoxToRect (const Matrix& bb)
97 { 100 {
98 QRect r; 101 QRect r;
99 102
100 if (bb.numel () == 4) 103 if (bb.numel () == 4)
101 { 104 {
106 } 109 }
107 110
108 return r; 111 return r;
109 } 112 }
110 113
111 Figure* Figure::create (const graphics_object& go) 114 Figure*
115 Figure::create (const graphics_object& go)
112 { 116 {
113 return new Figure (go, new FigureWindow ()); 117 return new Figure (go, new FigureWindow ());
114 } 118 }
115 119
116 Figure::Figure (const graphics_object& go, FigureWindow* win) 120 Figure::Figure (const graphics_object& go, FigureWindow* win)
117 : Object (go, win), m_blockUpdates (false), m_figureToolBar (0), 121 : Object (go, win), m_blockUpdates (false), m_figureToolBar (0),
118 m_menuBar (0), m_innerRect (), m_outerRect (), 122 m_menuBar (0), m_innerRect (), m_outerRect (), m_mouseModeGroup (0)
119 m_mouseModeGroup (0)
120 { 123 {
121 m_container = new Container (win); 124 m_container = new Container (win);
122 win->setCentralWidget (m_container); 125 win->setCentralWidget (m_container);
123 126
124 figure::properties& fp = properties<figure> (); 127 figure::properties& fp = properties<figure> ();
171 174
172 Figure::~Figure (void) 175 Figure::~Figure (void)
173 { 176 {
174 } 177 }
175 178
176 static std::string mouse_mode_to_string (MouseMode mode) 179 static std::string
180 mouse_mode_to_string (MouseMode mode)
177 { 181 {
178 switch (mode) 182 switch (mode)
179 { 183 {
180 case NoMode: 184 case NoMode:
181 return "none"; 185 return "none";
203 } 207 }
204 208
205 return "none"; 209 return "none";
206 } 210 }
207 211
208 static MouseMode mouse_mode_from_string (const std::string& mode) 212 static MouseMode
213 mouse_mode_from_string (const std::string& mode)
209 { 214 {
210 if (mode == "none") 215 if (mode == "none")
211 return NoMode; 216 return NoMode;
212 else if (mode == "rotate") 217 else if (mode == "rotate")
213 return RotateMode; 218 return RotateMode;
223 return SelectMode; 228 return SelectMode;
224 else 229 else
225 return NoMode; 230 return NoMode;
226 } 231 }
227 232
228 QString Figure::fileName (void) 233 QString
234 Figure::fileName (void)
229 { 235 {
230 gh_manager::auto_lock lock; 236 gh_manager::auto_lock lock;
231 237
232 const figure::properties& fp = properties<figure> (); 238 const figure::properties& fp = properties<figure> ();
233 239
234 std::string name = fp.get_filename (); 240 std::string name = fp.get_filename ();
235 241
236 return QString::fromStdString (name); 242 return QString::fromStdString (name);
237 } 243 }
238 244
239 void Figure::setFileName (const QString& name) 245 void
246 Figure::setFileName (const QString& name)
240 { 247 {
241 gh_manager::auto_lock lock; 248 gh_manager::auto_lock lock;
242 249
243 figure::properties& fp = properties<figure> (); 250 figure::properties& fp = properties<figure> ();
244 251
245 fp.set_filename (name.toStdString ()); 252 fp.set_filename (name.toStdString ());
246 } 253 }
247 254
248 MouseMode Figure::mouseMode (void) 255 MouseMode
256 Figure::mouseMode (void)
249 { 257 {
250 gh_manager::auto_lock lock; 258 gh_manager::auto_lock lock;
251 259
252 const figure::properties& fp = properties<figure> (); 260 const figure::properties& fp = properties<figure> ();
253 261
263 } 271 }
264 272
265 return mouse_mode_from_string (mode); 273 return mouse_mode_from_string (mode);
266 } 274 }
267 275
268 void Figure::createFigureToolBarAndMenuBar (void) 276 void
277 Figure::createFigureToolBarAndMenuBar (void)
269 { 278 {
270 QMainWindow* win = qWidget<QMainWindow> (); 279 QMainWindow* win = qWidget<QMainWindow> ();
271 280
272 m_figureToolBar = win->addToolBar (tr ("Figure ToolBar")); 281 m_figureToolBar = win->addToolBar (tr ("Figure ToolBar"));
273 m_figureToolBar->setMovable (false); 282 m_figureToolBar->setMovable (false);
319 helpMenu->addAction (tr ("About &Qt"), qApp, SLOT (aboutQt (void))); 328 helpMenu->addAction (tr ("About &Qt"), qApp, SLOT (aboutQt (void)));
320 329
321 m_menuBar->addReceiver (this); 330 m_menuBar->addReceiver (this);
322 } 331 }
323 332
324 void Figure::updateFigureToolBarAndMenuBar (void) 333 void
334 Figure::updateFigureToolBarAndMenuBar (void)
325 { 335 {
326 if (m_mouseModeGroup) 336 if (m_mouseModeGroup)
327 { 337 {
328 m_blockUpdates = true; 338 m_blockUpdates = true;
329 m_mouseModeGroup->setMode (mouseMode ()); 339 m_mouseModeGroup->setMode (mouseMode ());
330 m_blockUpdates = false; 340 m_blockUpdates = false;
331 } 341 }
332 } 342 }
333 343
334 Container* Figure::innerContainer (void) 344 Container*
345 Figure::innerContainer (void)
335 { 346 {
336 return m_container; 347 return m_container;
337 } 348 }
338 349
339 void Figure::redraw (void) 350 void
351 Figure::redraw (void)
340 { 352 {
341 Canvas* canvas = m_container->canvas (m_handle); 353 Canvas* canvas = m_container->canvas (m_handle);
342 354
343 if (canvas) 355 if (canvas)
344 { 356 {
356 } 368 }
357 369
358 updateFigureToolBarAndMenuBar (); 370 updateFigureToolBarAndMenuBar ();
359 } 371 }
360 372
361 void Figure::print (const QString& file_cmd, const QString& term) 373 void
374 Figure::print (const QString& file_cmd, const QString& term)
362 { 375 {
363 Canvas* canvas = m_container->canvas (m_handle); 376 Canvas* canvas = m_container->canvas (m_handle);
364 377
365 if (canvas) 378 if (canvas)
366 canvas->print (file_cmd, term); 379 canvas->print (file_cmd, term);
367 } 380 }
368 381
369 void Figure::beingDeleted (void) 382 void
383 Figure::beingDeleted (void)
370 { 384 {
371 Canvas* canvas = m_container->canvas (m_handle.value (), false); 385 Canvas* canvas = m_container->canvas (m_handle.value (), false);
372 386
373 if (canvas) 387 if (canvas)
374 canvas->blockRedraw (true); 388 canvas->blockRedraw (true);
376 m_menuBar->removeReceiver (this); 390 m_menuBar->removeReceiver (this);
377 m_container->removeReceiver (this); 391 m_container->removeReceiver (this);
378 qWidget<FigureWindow> ()->removeReceiver (this); 392 qWidget<FigureWindow> ()->removeReceiver (this);
379 } 393 }
380 394
381 void Figure::update (int pId) 395 void
396 Figure::update (int pId)
382 { 397 {
383 if (m_blockUpdates) 398 if (m_blockUpdates)
384 return; 399 return;
385 400
386 figure::properties& fp = properties<figure> (); 401 figure::properties& fp = properties<figure> ();
404 //qDebug () << "Figure::update(position)(adjusted):" << m_innerRect.adjusted (0, -offset, 0, 0); 419 //qDebug () << "Figure::update(position)(adjusted):" << m_innerRect.adjusted (0, -offset, 0, 0);
405 win->setGeometry (m_innerRect.adjusted (0, -offset, 0, 0)); 420 win->setGeometry (m_innerRect.adjusted (0, -offset, 0, 0));
406 //qDebug () << "Figure::update(position): done"; 421 //qDebug () << "Figure::update(position): done";
407 } 422 }
408 break; 423 break;
424
409 case figure::properties::ID_NAME: 425 case figure::properties::ID_NAME:
410 case figure::properties::ID_NUMBERTITLE: 426 case figure::properties::ID_NUMBERTITLE:
411 win->setWindowTitle (Utils::fromStdString (fp.get_title ())); 427 win->setWindowTitle (Utils::fromStdString (fp.get_title ()));
412 break; 428 break;
429
413 case figure::properties::ID_VISIBLE: 430 case figure::properties::ID_VISIBLE:
414 if (fp.is_visible ()) 431 if (fp.is_visible ())
415 QTimer::singleShot (0, win, SLOT (show ())); 432 QTimer::singleShot (0, win, SLOT (show ()));
416 else 433 else
417 win->hide (); 434 win->hide ();
418 break; 435 break;
436
419 case figure::properties::ID_TOOLBAR: 437 case figure::properties::ID_TOOLBAR:
420 if (fp.toolbar_is ("none")) 438 if (fp.toolbar_is ("none"))
421 showFigureToolBar (false); 439 showFigureToolBar (false);
422 else if (fp.toolbar_is ("figure")) 440 else if (fp.toolbar_is ("figure"))
423 showFigureToolBar (true); 441 showFigureToolBar (true);
424 else // "auto" 442 else // "auto"
425 showFigureToolBar (! hasUiControlChildren (fp)); 443 showFigureToolBar (! hasUiControlChildren (fp));
426 break; 444 break;
445
427 case figure::properties::ID_MENUBAR: 446 case figure::properties::ID_MENUBAR:
428 showMenuBar (fp.menubar_is ("figure")); 447 showMenuBar (fp.menubar_is ("figure"));
429 break; 448 break;
449
430 case figure::properties::ID_KEYPRESSFCN: 450 case figure::properties::ID_KEYPRESSFCN:
431 if (fp.get_keypressfcn ().is_empty ()) 451 if (fp.get_keypressfcn ().is_empty ())
432 m_container->canvas (m_handle)->clearEventMask (Canvas::KeyPress); 452 m_container->canvas (m_handle)->clearEventMask (Canvas::KeyPress);
433 else 453 else
434 m_container->canvas (m_handle)->addEventMask (Canvas::KeyPress); 454 m_container->canvas (m_handle)->addEventMask (Canvas::KeyPress);
435 break; 455 break;
456
436 case figure::properties::ID_KEYRELEASEFCN: 457 case figure::properties::ID_KEYRELEASEFCN:
437 if (fp.get_keyreleasefcn ().is_empty ()) 458 if (fp.get_keyreleasefcn ().is_empty ())
438 m_container->canvas (m_handle)->clearEventMask (Canvas::KeyRelease); 459 m_container->canvas (m_handle)->clearEventMask (Canvas::KeyRelease);
439 else 460 else
440 m_container->canvas (m_handle)->addEventMask (Canvas::KeyRelease); 461 m_container->canvas (m_handle)->addEventMask (Canvas::KeyRelease);
441 break; 462 break;
463
442 case figure::properties::ID_WINDOWBUTTONMOTIONFCN: 464 case figure::properties::ID_WINDOWBUTTONMOTIONFCN:
443 { 465 {
444 bool hasCallback = ! fp.get_windowbuttonmotionfcn ().is_empty (); 466 bool hasCallback = ! fp.get_windowbuttonmotionfcn ().is_empty ();
445 467
446 m_container->setMouseTracking (hasCallback); 468 m_container->setMouseTracking (hasCallback);
447 foreach (QWidget* w, m_container->findChildren<QWidget*> ()) 469 foreach (QWidget* w, m_container->findChildren<QWidget*> ())
448 { w->setMouseTracking (hasCallback); } 470 { w->setMouseTracking (hasCallback); }
449 } 471 }
450 break; 472 break;
473
451 default: 474 default:
452 break; 475 break;
453 } 476 }
454 477
455 m_blockUpdates = false; 478 m_blockUpdates = false;
456 } 479 }
457 480
458 void Figure::showFigureToolBar (bool visible) 481 void
482 Figure::showFigureToolBar (bool visible)
459 { 483 {
460 if ((! m_figureToolBar->isHidden ()) != visible) 484 if ((! m_figureToolBar->isHidden ()) != visible)
461 { 485 {
462 int dy = m_figureToolBar->sizeHint ().height (); 486 int dy = m_figureToolBar->sizeHint ().height ();
463 QRect r = qWidget<QWidget> ()->geometry (); 487 QRect r = qWidget<QWidget> ()->geometry ();
474 498
475 updateBoundingBox (false); 499 updateBoundingBox (false);
476 } 500 }
477 } 501 }
478 502
479 void Figure::showMenuBar (bool visible) 503 void
504 Figure::showMenuBar (bool visible)
480 { 505 {
481 int h1 = m_menuBar->sizeHint ().height (); 506 int h1 = m_menuBar->sizeHint ().height ();
482 507
483 foreach (QAction* a, m_menuBar->actions ()) 508 foreach (QAction* a, m_menuBar->actions ())
484 if (a->objectName () == "builtinMenu") 509 if (a->objectName () == "builtinMenu")
508 533
509 updateBoundingBox (false); 534 updateBoundingBox (false);
510 } 535 }
511 } 536 }
512 537
513 void Figure::updateMenuBar (void) 538 void
539 Figure::updateMenuBar (void)
514 { 540 {
515 gh_manager::auto_lock lock; 541 gh_manager::auto_lock lock;
516 graphics_object go = object (); 542 graphics_object go = object ();
517 543
518 if (go.valid_object ()) 544 if (go.valid_object ())
519 showMenuBar (Utils::properties<figure> (go).menubar_is ("figure")); 545 showMenuBar (Utils::properties<figure> (go).menubar_is ("figure"));
520 } 546 }
521 547
522 QWidget* Figure::menu (void) 548 QWidget*
549 Figure::menu (void)
523 { 550 {
524 return qWidget<QMainWindow> ()->menuBar (); 551 return qWidget<QMainWindow> ()->menuBar ();
525 } 552 }
526 553
527 struct UpdateBoundingBoxData 554 struct UpdateBoundingBoxData
530 bool m_internal; 557 bool m_internal;
531 graphics_handle m_handle; 558 graphics_handle m_handle;
532 Figure* m_figure; 559 Figure* m_figure;
533 }; 560 };
534 561
535 void Figure::updateBoundingBoxHelper (void* data) 562 void
563 Figure::updateBoundingBoxHelper (void* data)
536 { 564 {
537 gh_manager::auto_lock lock; 565 gh_manager::auto_lock lock;
538 566
539 UpdateBoundingBoxData* d = reinterpret_cast<UpdateBoundingBoxData*> (data); 567 UpdateBoundingBoxData* d = reinterpret_cast<UpdateBoundingBoxData*> (data);
540 graphics_object go = gh_manager::get_object (d->m_handle); 568 graphics_object go = gh_manager::get_object (d->m_handle);
541 569
542 if (go.valid_object ()) 570 if (go.valid_object ())
543 { 571 {
544 figure::properties& fp = Utils::properties<figure> (go); 572 figure::properties& fp = Utils::properties<figure> (go);
545 573
546 //qDebug ("Figure::updateBoundingBoxHelper: internal=%d, bbox=[%g %g %g %g]",
547 // d->m_internal, d->m_bbox(0), d->m_bbox(1), d->m_bbox(2), d->m_bbox(3));
548 fp.set_boundingbox (d->m_bbox, d->m_internal, false); 574 fp.set_boundingbox (d->m_bbox, d->m_internal, false);
549 } 575 }
550 576
551 delete d; 577 delete d;
552 } 578 }
553 579
554 void Figure::updateBoundingBox (bool internal, int flags) 580 void
581 Figure::updateBoundingBox (bool internal, int flags)
555 { 582 {
556 QWidget* win = qWidget<QWidget> (); 583 QWidget* win = qWidget<QWidget> ();
557 Matrix bb (1, 4); 584 Matrix bb (1, 4);
558 585
559 if (internal) 586 if (internal)
565 if (flags & UpdateBoundingBoxSize) 592 if (flags & UpdateBoundingBoxSize)
566 r.setSize (m_container->size ()); 593 r.setSize (m_container->size ());
567 594
568 if (r.isValid () && r != m_innerRect) 595 if (r.isValid () && r != m_innerRect)
569 { 596 {
570 //qDebug() << "inner rect changed:" << m_innerRect << "->>" << r;
571 m_innerRect = r; 597 m_innerRect = r;
572 598
573 bb(0) = r.x (); 599 bb(0) = r.x ();
574 bb(1) = r.y (); 600 bb(1) = r.y ();
575 bb(2) = r.width (); 601 bb(2) = r.width ();
587 if (flags & UpdateBoundingBoxSize) 613 if (flags & UpdateBoundingBoxSize)
588 r.setSize (win->frameGeometry ().size ()); 614 r.setSize (win->frameGeometry ().size ());
589 615
590 if (r.isValid () && r != m_outerRect) 616 if (r.isValid () && r != m_outerRect)
591 { 617 {
592 //qDebug() << "outer rect changed:" << m_outerRect << "->>" << r;
593 m_outerRect = r; 618 m_outerRect = r;
594 619
595 bb(0) = r.x (); 620 bb(0) = r.x ();
596 bb(1) = r.y (); 621 bb(1) = r.y ();
597 bb(2) = r.width (); 622 bb(2) = r.width ();
606 d->m_bbox = bb; 631 d->m_bbox = bb;
607 d->m_internal = internal; 632 d->m_internal = internal;
608 d->m_handle = m_handle; 633 d->m_handle = m_handle;
609 d->m_figure = this; 634 d->m_figure = this;
610 635
611 //qDebug ("Figure::updateBoundingBox: internal=%d, bbox=[%g %g %g %g]",
612 // d->m_internal, d->m_bbox(0), d->m_bbox(1), d->m_bbox(2), d->m_bbox(3));
613 gh_manager::post_function (Figure::updateBoundingBoxHelper, d); 636 gh_manager::post_function (Figure::updateBoundingBoxHelper, d);
614 } 637 }
615 638
616 bool Figure::eventNotifyBefore (QObject* obj, QEvent* xevent) 639 bool
640 Figure::eventNotifyBefore (QObject* obj, QEvent* xevent)
617 { 641 {
618 if (! m_blockUpdates) 642 if (! m_blockUpdates)
619 { 643 {
620 if (obj == m_container) 644 if (obj == m_container)
621 { 645 {
624 else if (obj == m_menuBar) 648 else if (obj == m_menuBar)
625 { 649 {
626 switch (xevent->type ()) 650 switch (xevent->type ())
627 { 651 {
628 case QEvent::ActionRemoved: 652 case QEvent::ActionRemoved:
629 { 653 {
630 QAction* a = dynamic_cast<QActionEvent*> (xevent)->action (); 654 QAction* a = dynamic_cast<QActionEvent*> (xevent)->action ();
631 655
632 if (! a->isSeparator () 656 if (! a->isSeparator ()
633 && a->objectName () != "builtinMenu") 657 && a->objectName () != "builtinMenu")
634 updateMenuBar (); 658 updateMenuBar ();
635 } 659 }
636 break; 660 break;
661
637 default: 662 default:
638 break; 663 break;
639 } 664 }
640 } 665 }
641 else 666 else
644 { 669 {
645 case QEvent::Close: 670 case QEvent::Close:
646 xevent->ignore (); 671 xevent->ignore ();
647 gh_manager::post_callback (m_handle, "closerequestfcn"); 672 gh_manager::post_callback (m_handle, "closerequestfcn");
648 return true; 673 return true;
674
649 default: 675 default:
650 break; 676 break;
651 } 677 }
652 } 678 }
653 } 679 }
654 680
655 return false; 681 return false;
656 } 682 }
657 683
658 void Figure::eventNotifyAfter (QObject* watched, QEvent* xevent) 684 void
685 Figure::eventNotifyAfter (QObject* watched, QEvent* xevent)
659 { 686 {
660 if (! m_blockUpdates) 687 if (! m_blockUpdates)
661 { 688 {
662 if (watched == m_container) 689 if (watched == m_container)
663 { 690 {
664 switch (xevent->type ()) 691 switch (xevent->type ())
665 { 692 {
666 case QEvent::Resize: 693 case QEvent::Resize:
667 updateBoundingBox (true, UpdateBoundingBoxSize); 694 updateBoundingBox (true, UpdateBoundingBoxSize);
668 break; 695 break;
696
669 case QEvent::ChildAdded: 697 case QEvent::ChildAdded:
670 if (dynamic_cast<QChildEvent*> (xevent)->child 698 if (dynamic_cast<QChildEvent*> (xevent)->child
671 ()->isWidgetType()) 699 ()->isWidgetType())
672 { 700 {
673 gh_manager::auto_lock lock; 701 gh_manager::auto_lock lock;
674 const figure::properties& fp = properties<figure> (); 702 const figure::properties& fp = properties<figure> ();
675 703
676 showFigureToolBar (! hasUiControlChildren (fp)); 704 showFigureToolBar (! hasUiControlChildren (fp));
677 } 705 }
706
678 default: 707 default:
679 break; 708 break;
680 } 709 }
681 } 710 }
682 else if (watched == m_menuBar) 711 else if (watched == m_menuBar)
690 if (! a->isSeparator () 719 if (! a->isSeparator ()
691 && a->objectName () != "builtinMenu") 720 && a->objectName () != "builtinMenu")
692 updateMenuBar (); 721 updateMenuBar ();
693 } 722 }
694 break; 723 break;
724
695 default: 725 default:
696 break; 726 break;
697 } 727 }
698 } 728 }
699 else 729 else
702 { 732 {
703 case QEvent::Move: 733 case QEvent::Move:
704 updateBoundingBox (false, UpdateBoundingBoxPosition); 734 updateBoundingBox (false, UpdateBoundingBoxPosition);
705 updateBoundingBox (true, UpdateBoundingBoxPosition); 735 updateBoundingBox (true, UpdateBoundingBoxPosition);
706 break; 736 break;
737
707 case QEvent::Resize: 738 case QEvent::Resize:
708 updateBoundingBox (false, UpdateBoundingBoxSize); 739 updateBoundingBox (false, UpdateBoundingBoxSize);
709 break; 740 break;
741
710 default: 742 default:
711 break; 743 break;
712 } 744 }
713 } 745 }
714 } 746 }
715 } 747 }
716 748
717 void Figure::helpAboutQtHandles (void) 749 void
750 Figure::helpAboutQtHandles (void)
718 { 751 {
719 QMessageBox::about (qWidget<QMainWindow> (), tr ("About QtHandles"), 752 QMessageBox::about (qWidget<QMainWindow> (), tr ("About QtHandles"),
720 ABOUT_TEXT); 753 ABOUT_TEXT);
721 } 754 }
722 755
723 void Figure::setMouseMode (MouseMode mode) 756 void
757 Figure::setMouseMode (MouseMode mode)
724 { 758 {
725 if (m_blockUpdates) 759 if (m_blockUpdates)
726 return; 760 return;
727 761
728 gh_manager::auto_lock lock; 762 gh_manager::auto_lock lock;
735 769
736 if (canvas) 770 if (canvas)
737 canvas->setCursor (mode); 771 canvas->setCursor (mode);
738 } 772 }
739 773
740 void Figure::fileSaveFigure (bool prompt) 774 void
775 Figure::fileSaveFigure (bool prompt)
741 { 776 {
742 QString file = fileName (); 777 QString file = fileName ();
743 778
744 if (file.isEmpty ()) 779 if (file.isEmpty ())
745 { 780 {
767 octave_link::post_event (this, &Figure::save_figure_callback, 802 octave_link::post_event (this, &Figure::save_figure_callback,
768 file.toStdString ()); 803 file.toStdString ());
769 } 804 }
770 } 805 }
771 806
772 void Figure::save_figure_callback (const std::string& file) 807 void
808 Figure::save_figure_callback (const std::string& file)
773 { 809 {
774 Ffeval (ovl ("print", file)); 810 Ffeval (ovl ("print", file));
775 } 811 }
776 812
777 void Figure::fileSaveFigureAs (void) 813 void
814 Figure::fileSaveFigureAs (void)
778 { 815 {
779 fileSaveFigure (true); 816 fileSaveFigure (true);
780 } 817 }
781 818
782 void Figure::fileCloseFigure (void) 819 void
820 Figure::fileCloseFigure (void)
783 { 821 {
784 qWidget<QMainWindow> ()->close (); 822 qWidget<QMainWindow> ()->close ();
785 } 823 }
786 824
787 void Figure::editCopy (void) 825 void
788 { 826 Figure::editCopy (void)
789 } 827 {
790 828 }
791 void Figure::editCut (void) 829
792 { 830 void
793 } 831 Figure::editCut (void)
794 832 {
795 void Figure::editPaste (void) 833 }
796 { 834
797 } 835 void
798 836 Figure::editPaste (void)
799 void Figure::addCustomToolBar (QToolBar* bar, bool visible) 837 {
838 }
839
840 void
841 Figure::addCustomToolBar (QToolBar* bar, bool visible)
800 { 842 {
801 QMainWindow* win = qWidget<QMainWindow> (); 843 QMainWindow* win = qWidget<QMainWindow> ();
802 844
803 if (! visible) 845 if (! visible)
804 win->addToolBar (bar); 846 win->addToolBar (bar);
819 //qDebug () << "Figure::addCustomToolBar:" << win->geometry (); 861 //qDebug () << "Figure::addCustomToolBar:" << win->geometry ();
820 updateBoundingBox (false); 862 updateBoundingBox (false);
821 } 863 }
822 } 864 }
823 865
824 void Figure::showCustomToolBar (QToolBar* bar, bool visible) 866 void
867 Figure::showCustomToolBar (QToolBar* bar, bool visible)
825 { 868 {
826 QMainWindow* win = qWidget<QMainWindow> (); 869 QMainWindow* win = qWidget<QMainWindow> ();
827 870
828 if ((! bar->isHidden ()) != visible) 871 if ((! bar->isHidden ()) != visible)
829 { 872 {
842 885
843 updateBoundingBox (false); 886 updateBoundingBox (false);
844 } 887 }
845 } 888 }
846 889
847 void Figure::updateContainer (void) 890 void
891 Figure::updateContainer (void)
848 { 892 {
849 redraw (); 893 redraw ();
850 } 894 }
851 895
852 void Figure::toggleAxes (void) 896 void
897 Figure::toggleAxes (void)
853 { 898 {
854 Canvas* canvas = m_container->canvas (m_handle); 899 Canvas* canvas = m_container->canvas (m_handle);
855 900
856 if (canvas) 901 if (canvas)
857 canvas->toggleAxes (m_handle); 902 canvas->toggleAxes (m_handle);
858 } 903 }
859 904
860 void Figure::toggleGrid (void) 905 void
906 Figure::toggleGrid (void)
861 { 907 {
862 Canvas* canvas = m_container->canvas (m_handle); 908 Canvas* canvas = m_container->canvas (m_handle);
863 909
864 if (canvas) 910 if (canvas)
865 canvas->toggleGrid (m_handle); 911 canvas->toggleGrid (m_handle);
866 } 912 }
867 913
868 void Figure::autoAxes (void) 914 void
915 Figure::autoAxes (void)
869 { 916 {
870 Canvas* canvas = m_container->canvas (m_handle); 917 Canvas* canvas = m_container->canvas (m_handle);
871 918
872 if (canvas) 919 if (canvas)
873 canvas->autoAxes (m_handle); 920 canvas->autoAxes (m_handle);