Commit 3517aeda authored by Jan Möbius's avatar Jan Möbius

Moved currentDrawMOde to viewerProperties

Removed old action triggered by drawModeMenu

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@5230 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 6d569a5c
......@@ -288,18 +288,13 @@ QPoint mapToLocal( const QPoint _point ) {
void setDrawMode( const unsigned int _mode , int _viewer) {
if ( _viewer == ACTIVE_VIEWER ) {
examiner_widgets_[activeExaminer_]->drawMode(_mode);
examiner_widgets_[activeExaminer_]->updateGL();
} else if ( _viewer == ALL_VIEWERS )
for ( uint i = 0 ; i < examiner_widgets_.size(); ++i ) {
examiner_widgets_[i]->drawMode(_mode);
examiner_widgets_[i]->updateGL();
}
else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() ) {
examiner_widgets_[_viewer]->drawMode(_mode);
examiner_widgets_[_viewer]->updateGL();
}
if ( _viewer == ACTIVE_VIEWER )
viewerProperties(activeExaminer()).drawMode(_mode);
else if ( _viewer == ALL_VIEWERS )
for ( uint i = 0 ; i < examiner_widgets_.size(); ++i )
viewerProperties(i).drawMode(_mode);
else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
viewerProperties(_viewer).drawMode(_mode);
else
std::cerr << "Requested illegal viewer for setting DrawMode!!" << std::endl;
......@@ -312,15 +307,15 @@ void setDrawMode( const unsigned int _mode , int _viewer) {
*/
unsigned int drawMode( int _viewer ) {
if ( _viewer == ACTIVE_VIEWER ) {
return examiner_widgets_[activeExaminer_]->drawMode();
return viewerProperties(activeExaminer()).drawMode();
} else if ( _viewer == ALL_VIEWERS )
std::cerr << "Please select viewer to get viewing direction!" << std::endl;
else if ( ( _viewer >= 0 ) && _viewer < (int)examiner_widgets_.size() )
return examiner_widgets_[_viewer]->drawMode();
return viewerProperties(_viewer).drawMode();
else
std::cerr << "Requested illegal viewer for viewingDirection!!" << std::endl;
return examiner_widgets_[activeExaminer_]->drawMode();
return viewerProperties(activeExaminer()).drawMode();
}
bool scenegraphPick( ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, unsigned int &_nodeIdx, unsigned int &_targetIdx, ACG::Vec3d *_hitPointPtr=0 ) {
......
......@@ -589,7 +589,7 @@ void Core::openIniFile( QString _filename,
resetScenegraph();
for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ) {
coreWidget_->examiner_widgets_[i]->drawMode( OpenFlipper::Options::standardDrawMode() );
PluginFunctions::viewerProperties(i).drawMode( OpenFlipper::Options::standardDrawMode() );
coreWidget_->examiner_widgets_[i]->viewAll();
}
......
......@@ -234,7 +234,7 @@ void Core::slotLoad(QString _filename, DataType _type, int& _id) {
// if this is the first object opend, reset the global draw mode of all examiners to standard draw mode
if ( PluginFunctions::objectCount() == 1 && OpenFlipper::Options::gui() && !OpenFlipper::Options::loadingSettings() )
for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ) {
coreWidget_->examiner_widgets_[i]->drawMode( OpenFlipper::Options::standardDrawMode() );
PluginFunctions::viewerProperties(i).drawMode( OpenFlipper::Options::standardDrawMode() );
coreWidget_->examiner_widgets_[i]->viewAll();
}
......
......@@ -39,6 +39,7 @@
//=============================================================================
#include <OpenFlipper/common/GlobalDefines.hh>
#include <ACG/Scenegraph/DrawModes.hh>
#include "ViewerProperties.hh"
#include <iostream>
......@@ -47,6 +48,7 @@ namespace Viewer {
ViewerProperties::ViewerProperties():
actionMode_(Viewer::PickingMode),
lastActionMode_(Viewer::PickingMode),
currentDrawMode_(ACG::SceneGraph::DrawModes::NONE),
snapshotName_("snap.png"),
snapshotCounter_(0),
wZoomFactor_(1.0),
......
......@@ -108,8 +108,26 @@ namespace Viewer {
Viewer::ActionMode actionMode_, lastActionMode_;
/** @} */
//===========================================================================
/** @name Draw Mode States
* @{ */
//===========================================================================
public:
/// set draw mode (No test if this mode is available!)
void drawMode(unsigned int _mode) { currentDrawMode_ = _mode; emit updated(); };
/// get current draw mode
unsigned int drawMode() { return currentDrawMode_; };
private:
unsigned int currentDrawMode_;
/** @} */
//===========================================================================
/** @name Snapshot settings
* @{ */
......
......@@ -115,7 +115,7 @@ static const char VIEW_MAGIC[] =
glViewer::glViewer( QtGLGraphicsScene* _scene,
QGLWidget* _glWidget,
Viewer::ViewerProperties& _properties,
Viewer::ViewerProperties& _properties,
QGraphicsWidget* _parent,
const char* /* _name */ ,
QStatusBar *_statusBar) :
......@@ -150,7 +150,6 @@ glViewer::glViewer( QtGLGraphicsScene* _scene,
eyeDist_ = 0.01;
sceneGraphRoot_ = 0;
curDrawMode_ = ACG::SceneGraph::DrawModes::NONE;
normalsMode_ = DONT_TOUCH_NORMALS;
projectionMode_ = PERSPECTIVE_PROJECTION;
......@@ -544,13 +543,13 @@ void glViewer::drawScene_mono()
if (sceneGraphRoot_)
{
if (! properties_.renderPicking() ) {
ACG::SceneGraph::DrawAction action(curDrawMode_, false);
ACG::SceneGraph::traverse(sceneGraphRoot_, action, *glstate_, curDrawMode_);
ACG::SceneGraph::DrawAction action( properties_.drawMode() , false);
ACG::SceneGraph::traverse(sceneGraphRoot_, action, *glstate_, properties_.drawMode() );
if( blending_ )
{
ACG::SceneGraph::DrawAction action(curDrawMode_, true);
ACG::SceneGraph::traverse(sceneGraphRoot_, action, *glstate_, curDrawMode_);
ACG::SceneGraph::DrawAction action(properties_.drawMode(), true);
ACG::SceneGraph::traverse(sceneGraphRoot_, action, *glstate_, properties_.drawMode());
}
} else {
......@@ -1155,45 +1154,6 @@ void glViewer::actionPasteView()
}
//-----------------------------------------------------------------------------
void glViewer::actionDrawMenu( QAction * _action )
{
unsigned int mode( _action->data().toUInt() );
// combine draw modes
if (qApp->keyboardModifiers() & Qt::ShiftModifier)
{
if (drawMode() & mode)
drawMode(drawMode() & ~mode);
else
drawMode(drawMode() | mode);
}
// simply switch draw mode
else
{
// clear all other checked items
std::vector< QAction * >::iterator aIter, aEnd;
aEnd = drawMenuActions_.end();
for( aIter = drawMenuActions_.begin();
aIter != aEnd;
++aIter )
{
if( (*aIter)->data().toUInt() != mode )
(*aIter)->setChecked( false );
}
drawMode(mode);
}
hidePopupMenus();
updateGL();
}
//-----------------------------------------------------------------------------
void
......
......@@ -259,16 +259,6 @@ public:
/// map glarea coords to global coords
QPoint glMapToGlobal( const QPoint& _pos ) const;
/// set draw mode (No test if this mode is available!)
void drawMode(unsigned int _mode)
{
curDrawMode_ = _mode;
}
/// get current draw mode
unsigned int drawMode() { return curDrawMode_; }
/// convert current view to text representation
void encodeView(QString& _view);
/** Decode and apply text representation of view encoded by encodeView().
......@@ -348,7 +338,6 @@ public slots:
virtual void setView( const ACG::GLMatrixd& _modelview,
const ACG::GLMatrixd& _inverse_modelview );
void actionDrawMenu( QAction * _action );
void actionPickMenu( QAction * _action );
void actionPasteView();
......@@ -533,8 +522,6 @@ private:
// scenegraph stuff
ACG::SceneGraph::BaseNode* sceneGraphRoot_;
unsigned int curDrawMode_;
bool projectionUpdateLocked_;
bool blending_;
......
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