From abbc94ea90d6ba06809d403dcd89d126442656f9 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Wed, 18 Mar 2009 15:33:08 +0000 Subject: [PATCH] * ./hurricane/src/hviewer : - Change: more ergonomic selection mode commands. Now clicking on "nothing" automatically switch off selection displaying. --- hurricane/src/hviewer/SelectCommand.cpp | 10 ++++++---- hurricane/src/hviewer/ZoomCommand.cpp | 7 ++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/hurricane/src/hviewer/SelectCommand.cpp b/hurricane/src/hviewer/SelectCommand.cpp index 47c3117f..06193ff4 100644 --- a/hurricane/src/hviewer/SelectCommand.cpp +++ b/hurricane/src/hviewer/SelectCommand.cpp @@ -84,7 +84,8 @@ namespace Hurricane { bool SelectCommand::mouseReleaseEvent ( CellWidget* widget, QMouseEvent* event ) { - if ( !isActive() ) return false; + if ( !isActive() ) + _startPoint = _stopPoint = event->pos(); setActive ( false ); setDrawingEnabled ( false ); @@ -97,13 +98,14 @@ namespace Hurricane { //widget->unselectAll (); widget->selectOccurrencesUnder ( widget->screenToDbuBox(selectArea) ); + bool somethingSelected = !widget->getSelectorSet().empty(); - if ( !widget->getState()->showSelection() ) - widget->setShowSelection ( true ); + if ( widget->getState()->showSelection() != somethingSelected ) + widget->setShowSelection ( somethingSelected ); else widget->refresh (); - return false; + return true; } diff --git a/hurricane/src/hviewer/ZoomCommand.cpp b/hurricane/src/hviewer/ZoomCommand.cpp index 9de42df6..48f68ce5 100644 --- a/hurricane/src/hviewer/ZoomCommand.cpp +++ b/hurricane/src/hviewer/ZoomCommand.cpp @@ -98,9 +98,10 @@ namespace Hurricane { QRect zoomArea = QRect ( _startPoint, _stopPoint ); if ( ( abs(zoomArea.width ()) > getDrawingThreshold() ) - && ( abs(zoomArea.height()) > getDrawingThreshold() ) ) - widget->reframe ( widget->screenToDbuBox(zoomArea) ); - //else { + && ( abs(zoomArea.height()) > getDrawingThreshold() ) ) { + widget->reframe ( widget->screenToDbuBox(zoomArea) ); + return true; + } // else { // cerr << Warning("Rejecting too small zoom request.") << endl; // widget->update (); //}