viewerControl.cc 4.05 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
//=============================================================================
//
//                               OpenFlipper
//        Copyright (C) 2008 by Computer Graphics Group, RWTH Aachen
//                           www.openflipper.org
//
//-----------------------------------------------------------------------------
//
//                                License
//
//  OpenFlipper is free software: you can redistribute it and/or modify
//  it under the terms of the GNU Lesser General Public License as published by
//  the Free Software Foundation, either version 3 of the License, or
//  (at your option) any later version.
//
//  OpenFlipper is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU Lesser General Public License for more details.
//
//  You should have received a copy of the GNU Lesser General Public License
//  along with OpenFlipper.  If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
//
Jan Möbius's avatar
Jan Möbius committed
26 27 28
//   $Revision$
//   $Author$
//   $Date$
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
//
//=============================================================================




//=============================================================================
//
//  CLASS CoreWidget - IMPLEMENTATION
//
//=============================================================================


//== INCLUDES =================================================================

#include "CoreWidget.hh"

#include <OpenFlipper/BasePlugin/PluginFunctions.hh>
#include <OpenFlipper/common/GlobalOptions.hh>



//== IMPLEMENTATION ==========================================================

//=============================================================================

void CoreWidget::slotToggleStereoMode()
{
  stereoActive_ = !stereoActive_;

  if ( stereoActive_ ) {
    statusBar_->showMessage("Stereo enabled");
    stereoButton_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"mono.png") );
  } else {
    statusBar_->showMessage("Stereo disabled");
    stereoButton_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"stereo.png") );
  }

  for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i )
    examiner_widgets_[i]->setStereoMode(stereoActive_);
}

void CoreWidget::slotProjectionModeChanged( bool _ortho ) {
  if ( !_ortho )
    projectionButton_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"perspective.png") );
  else
    projectionButton_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"orthogonal.png") );

}

Jan Möbius's avatar
 
Jan Möbius committed
79
void CoreWidget::slotActionModeChanged( Viewer::ActionMode _mode ) {
80 81 82 83 84 85 86
  moveButton_->setDown(false);
  lightButton_->setDown(false);
  pickButton_->setDown(false);
  questionButton_->setDown(false);

  switch (_mode)
  {
Jan Möbius's avatar
 
Jan Möbius committed
87
    case Viewer::ExamineMode:
88 89 90 91 92 93
    {
      moveButton_->setDown(true);
      break;
    }


Jan Möbius's avatar
 
Jan Möbius committed
94
    case Viewer::LightMode:
95 96 97 98 99 100
    {
      lightButton_->setDown(true);
      break;
    }


Jan Möbius's avatar
 
Jan Möbius committed
101
    case Viewer::PickingMode:
102 103 104 105 106 107
    {
      pickButton_->setDown(true);
      break;
    }


Jan Möbius's avatar
 
Jan Möbius committed
108
    case Viewer::QuestionMode:
109 110 111 112 113 114 115
    {
      questionButton_->setDown(true);
      break;
    }
  }
}

116 117 118 119 120 121 122 123
void CoreWidget::slotFunctionMenuUpdate() {
  std::cerr << "DF" <<std::endl;
  if ( examiner_widgets_.empty() )
    return;

  QList< QAction *> allActions = functionMenu_->actions();

  for ( int i = 0 ; i <  allActions.size(); ++i ) {
Jan Möbius's avatar
Jan Möbius committed
124
    if ( allActions[i]->text()      == "Animation" )
125
      allActions[i]->setChecked(PluginFunctions::viewerProperties().animation());
126
    else if ( allActions[i]->text() == "Backface Culling" )
127
      allActions[i]->setChecked(PluginFunctions::viewerProperties().backFaceCulling());
128
    else if ( allActions[i]->text() == "Two-sided Lighting" )
129
      allActions[i]->setChecked(PluginFunctions::viewerProperties().twoSidedLighting());
130 131 132 133 134
  }

}


135
//=============================================================================