Commit 437eb059 authored by Matthias Möller's avatar Matthias Möller

toolbar buttons keeps checked, if pressed twice

refs #1378

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@16084 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 01d58157
......@@ -414,6 +414,7 @@ CoreWidget( QVector<ViewMode*>& _viewModes,
moveButton_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"transform-move.png") );
moveButton_->setMinimumSize( 16, 16 );
moveButton_->setMaximumSize( 32, 32 );
moveButton_->setCheckable(true);
moveButton_->setToolTip( tr("Switch to <b>move</b> mode.") );
moveButton_->setWhatsThis(tr(
"Switch to <b>move</b> mode.<br>"
......@@ -427,13 +428,14 @@ CoreWidget( QVector<ViewMode*>& _viewModes,
this, SLOT( slotActionModeChanged(Viewer::ActionMode) ) );*/
viewerToolbar_->addWidget( moveButton_ )->setText(tr("Move"));
moveButton_->setDown(true);
moveButton_->setChecked(true);
pickButton_ = new QToolButton( viewerToolbar_ );
pickButton_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"pick.png") );
pickButton_->setMinimumSize( 16, 16 );
pickButton_->setMaximumSize( 32, 32 );
pickButton_->setCheckable(true);
pickButton_->setToolTip(tr("Switch to <b>picking</b> mode."));
pickButton_->setWhatsThis(tr(
"Switch to <b>picking</b> mode.<br>"
......@@ -448,6 +450,7 @@ CoreWidget( QVector<ViewMode*>& _viewModes,
questionButton_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"help-about.png") );
questionButton_->setMinimumSize( 16, 16 );
questionButton_->setMaximumSize( 32, 32 );
questionButton_->setCheckable(true);
questionButton_->setToolTip(tr("Switch to <b>identification</b> mode."));
questionButton_->setWhatsThis(tr(
"Switch to <b>identification</b> mode.<br>"
......
......@@ -62,70 +62,69 @@
//-----------------------------------------------------------------------------
void CoreWidget::setActionMode(const Viewer::ActionMode _am){
if (_am != actionMode_) {
lastActionMode_ = actionMode_;
actionMode_ = _am;
// update Buttons
// update Buttons
moveButton_->setChecked(false);
pickButton_->setChecked(false);
questionButton_->setChecked(false);
moveButton_->setDown(false);
pickButton_->setDown(false);
questionButton_->setDown(false);
switch (_am)
{
case Viewer::ExamineMode:
moveButton_->setChecked(true);
break;
case Viewer::LightMode:
break;
case Viewer::PickingMode:
pickButton_->setChecked(true);
break;
case Viewer::QuestionMode:
questionButton_->setChecked(true);
break;
}
switch (_am)
{
case Viewer::ExamineMode:
moveButton_->setDown(true);
break;
case Viewer::LightMode:
break;
case Viewer::PickingMode:
pickButton_->setDown(true);
break;
case Viewer::QuestionMode:
questionButton_->setDown(true);
break;
}
if (_am != actionMode_) {
lastActionMode_ = actionMode_;
actionMode_ = _am;
// update cursor
switch ( _am )
{
case Viewer::ExamineMode:
cursorPainter_->setCursor(QCursor( QPixmap( OpenFlipper::Options::iconDirStr() + QDir::separator() + "cursor_move.png" ) ,0,0 ));
break;
case Viewer::LightMode:
cursorPainter_->setCursor(QCursor( QPixmap( OpenFlipper::Options::iconDirStr() + QDir::separator() + "cursor_light.png" ) ,0,0 ));
break;
case Viewer::PickingMode:
cursorPainter_->setCursor(QCursor( QPixmap( OpenFlipper::Options::iconDirStr() + QDir::separator() + "cursor_arrow.png" ) ,0,0 ));
if (pick_mode_idx_ != -1) {
cursorPainter_->setCursor(pick_modes_[pick_mode_idx_].cursor() );
}
break;
case Viewer::QuestionMode:
cursorPainter_->setCursor(QCursor( QPixmap( OpenFlipper::Options::iconDirStr() + QDir::separator() + "cursor_whatsthis.png" ) ,0,0 ));
break;
case Viewer::ExamineMode:
cursorPainter_->setCursor(QCursor( QPixmap( OpenFlipper::Options::iconDirStr() + QDir::separator() + "cursor_move.png" ) ,0,0 ));
break;
case Viewer::LightMode:
cursorPainter_->setCursor(QCursor( QPixmap( OpenFlipper::Options::iconDirStr() + QDir::separator() + "cursor_light.png" ) ,0,0 ));
break;
case Viewer::PickingMode:
cursorPainter_->setCursor(QCursor( QPixmap( OpenFlipper::Options::iconDirStr() + QDir::separator() + "cursor_arrow.png" ) ,0,0 ));
if (pick_mode_idx_ != -1) {
cursorPainter_->setCursor(pick_modes_[pick_mode_idx_].cursor() );
}
break;
case Viewer::QuestionMode:
cursorPainter_->setCursor(QCursor( QPixmap( OpenFlipper::Options::iconDirStr() + QDir::separator() + "cursor_whatsthis.png" ) ,0,0 ));
break;
}
// Update pickmode toolbar
switch ( _am ) {
case Viewer::ExamineMode:
hidePickToolBar();
break;
case Viewer::ExamineMode:
hidePickToolBar();
break;
case Viewer::PickingMode:
// Show the pickMode Toolbar for this picking mode if it is set
if (pick_mode_idx_ != -1) {
if (pick_modes_[pick_mode_idx_].toolbar() )
setActivePickToolBar(pick_modes_[pick_mode_idx_].toolbar());
else
hidePickToolBar();
}
break;
case Viewer::PickingMode:
// Show the pickMode Toolbar for this picking mode if it is set
if (pick_mode_idx_ != -1) {
if (pick_modes_[pick_mode_idx_].toolbar() )
setActivePickToolBar(pick_modes_[pick_mode_idx_].toolbar());
else
hidePickToolBar();
}
break;
default:
break;
default:
break;
}
unsigned int maxPases = 1;
......@@ -139,9 +138,9 @@ void CoreWidget::setActionMode(const Viewer::ActionMode _am){
examiner_widgets_[i]->trackMouse(false);
if(_am == Viewer::PickingMode) {
if (pick_mode_idx_ != -1) {
examiner_widgets_[i]->trackMouse(pick_modes_[pick_mode_idx_].tracking() );
}
if (pick_mode_idx_ != -1) {
examiner_widgets_[i]->trackMouse(pick_modes_[pick_mode_idx_].tracking() );
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment