Mercurial > octave-nkf
comparison libgui/graphics/Canvas.cc @ 19799:134e5bfff5c5
* Canvas.cc (button_number): New static function.
(Canvas::canvasMousePressEvent): Use it to pass button number to
buttondownfcn.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 19 Feb 2015 02:33:05 -0500 |
parents | eebe8da58f8d |
children | 98cc7c741c5a |
comparison
equal
deleted
inserted
replaced
19798:c040bed12b2e | 19799:134e5bfff5c5 |
---|---|
406 redraw (false); | 406 redraw (false); |
407 } | 407 } |
408 } | 408 } |
409 } | 409 } |
410 | 410 |
411 static double | |
412 button_number (QMouseEvent *event) | |
413 { | |
414 double retval = 0; | |
415 | |
416 switch (event->button ()) | |
417 { | |
418 case Qt::LeftButton: | |
419 retval = 1; | |
420 break; | |
421 | |
422 case Qt::MidButton: | |
423 retval = 2; | |
424 break; | |
425 | |
426 case Qt::RightButton: | |
427 retval = 3; | |
428 break; | |
429 } | |
430 | |
431 return retval; | |
432 } | |
433 | |
411 void Canvas::canvasMousePressEvent (QMouseEvent* event) | 434 void Canvas::canvasMousePressEvent (QMouseEvent* event) |
412 { | 435 { |
413 gh_manager::auto_lock lock; | 436 gh_manager::auto_lock lock; |
414 graphics_object obj = gh_manager::get_object (m_handle); | 437 graphics_object obj = gh_manager::get_object (m_handle); |
415 | 438 |
498 switch (newMouseMode) | 521 switch (newMouseMode) |
499 { | 522 { |
500 case NoMode: | 523 case NoMode: |
501 gh_manager::post_set (figObj.get_handle (), "selectiontype", | 524 gh_manager::post_set (figObj.get_handle (), "selectiontype", |
502 Utils::figureSelectionType (event), false); | 525 Utils::figureSelectionType (event), false); |
526 | |
503 updateCurrentPoint (figObj, obj, event); | 527 updateCurrentPoint (figObj, obj, event); |
528 | |
504 gh_manager::post_callback (figObj.get_handle (), | 529 gh_manager::post_callback (figObj.get_handle (), |
505 "windowbuttondownfcn"); | 530 "windowbuttondownfcn"); |
531 | |
506 gh_manager::post_callback (currentObj.get_handle (), | 532 gh_manager::post_callback (currentObj.get_handle (), |
507 "buttondownfcn"); | 533 "buttondownfcn", button_number (event)); |
534 | |
508 if (event->button () == Qt::RightButton) | 535 if (event->button () == Qt::RightButton) |
509 ContextMenu::executeAt (currentObj.get_properties (), | 536 ContextMenu::executeAt (currentObj.get_properties (), |
510 event->globalPos ()); | 537 event->globalPos ()); |
511 break; | 538 break; |
512 | 539 |