* ./hurricane/src/hviewer :

- Change: more ergonomic selection mode commands. Now clicking on "nothing"
        automatically switch off selection displaying.
This commit is contained in:
Jean-Paul Chaput 2009-03-18 15:33:08 +00:00
parent f102af2832
commit abbc94ea90
2 changed files with 10 additions and 7 deletions

View File

@ -84,7 +84,8 @@ namespace Hurricane {
bool SelectCommand::mouseReleaseEvent ( CellWidget* widget, QMouseEvent* event ) bool SelectCommand::mouseReleaseEvent ( CellWidget* widget, QMouseEvent* event )
{ {
if ( !isActive() ) return false; if ( !isActive() )
_startPoint = _stopPoint = event->pos();
setActive ( false ); setActive ( false );
setDrawingEnabled ( false ); setDrawingEnabled ( false );
@ -97,13 +98,14 @@ namespace Hurricane {
//widget->unselectAll (); //widget->unselectAll ();
widget->selectOccurrencesUnder ( widget->screenToDbuBox(selectArea) ); widget->selectOccurrencesUnder ( widget->screenToDbuBox(selectArea) );
bool somethingSelected = !widget->getSelectorSet().empty();
if ( !widget->getState()->showSelection() ) if ( widget->getState()->showSelection() != somethingSelected )
widget->setShowSelection ( true ); widget->setShowSelection ( somethingSelected );
else else
widget->refresh (); widget->refresh ();
return false; return true;
} }

View File

@ -98,9 +98,10 @@ namespace Hurricane {
QRect zoomArea = QRect ( _startPoint, _stopPoint ); QRect zoomArea = QRect ( _startPoint, _stopPoint );
if ( ( abs(zoomArea.width ()) > getDrawingThreshold() ) if ( ( abs(zoomArea.width ()) > getDrawingThreshold() )
&& ( abs(zoomArea.height()) > getDrawingThreshold() ) ) && ( abs(zoomArea.height()) > getDrawingThreshold() ) ) {
widget->reframe ( widget->screenToDbuBox(zoomArea) ); widget->reframe ( widget->screenToDbuBox(zoomArea) );
//else { return true;
} // else {
// cerr << Warning("Rejecting too small zoom request.") << endl; // cerr << Warning("Rejecting too small zoom request.") << endl;
// widget->update (); // widget->update ();
//} //}