Commit 0ca38467 authored by Jan Möbius's avatar Jan Möbius

Internal gl widget step one ... Move toolbar to corewidget

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@4463 383ad7c9-94d9-4d36-a494-682f7c89f535
parent a8a33b30
This diff is collapsed.
......@@ -267,6 +267,7 @@ public:
/// Show or hide toolbox
void showToolbox( bool _state );
/** @} */
//===========================================================================
......@@ -402,6 +403,13 @@ public:
int toolbarCount_;
QToolButton* stereoButton_;
QToolButton* projectionButton_;
QToolButton* moveButton_;
QToolButton* lightButton_;
QToolButton* pickButton_;
QToolButton* questionButton_;
/** @} */
//===========================================================================
......@@ -603,6 +611,28 @@ public:
private :
std::vector<PluginInfo>& plugins_;
//===========================================================================
/** @name Viewer Controls
* @{ */
//===========================================================================
private slots:
/// Enable or disable Stereo
void slotToggleStereoMode();
/// Change icons if the stereo mode has changed in the examiner
void slotProjectionModeChanged( bool _ortho );
/// Change Icons if action mode is changed in an examiner
void slotActionModeChanged( QtBaseViewer::ActionMode _mode );
private :
bool stereoActive_;
/** @} */
};
......
//=============================================================================
//
// 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/>.
//
//-----------------------------------------------------------------------------
//
// $Revision: 2063 $
// $Author: moebius $
// $Date: 2008-06-22 17:32:25 +0200 (So, 22 Jun 2008) $
//
//=============================================================================
//=============================================================================
//
// 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") );
}
void CoreWidget::slotActionModeChanged( QtBaseViewer::ActionMode _mode ) {
moveButton_->setDown(false);
lightButton_->setDown(false);
pickButton_->setDown(false);
questionButton_->setDown(false);
switch (_mode)
{
case QtBaseViewer::ExamineMode:
{
moveButton_->setDown(true);
break;
}
case QtBaseViewer::LightMode:
{
lightButton_->setDown(true);
break;
}
case QtBaseViewer::PickingMode:
{
pickButton_->setDown(true);
break;
}
case QtBaseViewer::QuestionMode:
{
questionButton_->setDown(true);
break;
}
}
}
//=============================================================================
This diff is collapsed.
......@@ -351,6 +351,12 @@ public:
/// get action mode
ActionMode actionMode() const { return actionMode_; }
signals:
void actionModeChanged( QtBaseViewer::ActionMode _mode );
public:
/// orientation of the faces
enum FaceOrientation {
......@@ -467,11 +473,6 @@ public:
QMenu * getFuncMenu() { return funcMenu_; };
QMenu * getDrawMenu() { return drawMenu_; };
/// Returns a pointer to the Toolbar
QToolBar* getToolBar();
/// Returns a pointer to the toolbar and removes it from the default position in the examiner widget
QToolBar* removeToolBar();
//---------------------------------------------------------------- public slots
public slots:
......@@ -521,6 +522,11 @@ public slots:
/// toggle projection mode
virtual void toggleProjectionMode();
signals:
void projectionModeChanged( bool _ortho );
public slots:
/// show scenegraph widget
virtual void showSceneGraphDialog();
......@@ -811,30 +817,6 @@ private:
// Layout for the basic widget ( viewer + wheels )
QGridLayout* glLayout_;
// tool bar
QToolBar * buttonBar_;
// set pick mode
QToolButton* pickButton_;
// set move mode
QToolButton* moveButton_;
// set light mode
QToolButton* lightButton_;
// set question mode
QToolButton* questionButton_;
// change projection mode (perspective/orthographic)
QToolButton* projectionButton_;
// go to home() position
QToolButton* homeButton_;
// setHome()
QToolButton* setHomeButton_;
// viewAll()
QToolButton* viewAllButton_;
// show sceneGraphDialog_
QToolButton* sceneGraphButton_;
// enable/disable stereo viewing
QToolButton* stereoButton_;
// rotate around x-axis
ACG::QtWidgets::QtWheel* wheelX_;
// rotate around y-axis
......@@ -858,9 +840,6 @@ private:
public slots:
/// toggle stereo mode
virtual void toggleStereoMode();
/// enable/disable stereo mode
virtual void setStereoMode(bool _b);
......
......@@ -45,11 +45,6 @@
#include <QStatusBar>
#include <QToolButton>
#include "mono.xpm"
#include "stereo.xpm"
#define monoIcon mono_xpm
#define stereoIcon stereo_xpm
//== NAMESPACES ===============================================================
......@@ -74,10 +69,6 @@ double QtBaseViewer::focalDistance( ) {
return focalDist_;
}
void QtBaseViewer::toggleStereoMode() {
QtBaseViewer::setStereoMode(!stereo_);
}
//-----------------------------------------------------------------------------
......@@ -86,15 +77,7 @@ QtBaseViewer::setStereoMode(bool _b)
{
stereo_ = _b;
if (stereo_)
{
statusbar_->showMessage("Stereo enabled");
stereoButton_->setIcon( QPixmap(stereoIcon) );
}
else
{
statusbar_->showMessage("Stereo disabled");
stereoButton_->setIcon( QPixmap(monoIcon) );
if (!stereo_) {
makeCurrent();
glDrawBuffer(GL_BACK);
}
......
/* XPM */
static const char * home_xpm[] = {
"24 24 4 1",
" c None",
". c #000000",
"+ c #FFFFFF",
"@ c #828282",
" ",
" ",
" ",
" ",
" ... ",
" .... .+@@ ",
" ........+@@ ",
" ..........+@@ ",
" .....@.....+@.. ",
" ....@@@++........ ",
" ...@@@++++++...... ",
" ...@@++++@@@++.... ",
" @@@++++++@..++..@.@ ",
" .++++++@..++.@@.@ ",
" .+++++++++++.@@.@ ",
" .+++@@@@++++.@@.@ ",
" .+++@...++++.@@.@ ",
" .+++@...++++.@@.@ ",
" .+++@...++++.@..@ ",
" .+++@...++++...@@ ",
" ..............@@ ",
" @@@@@@@@@@@@@@ ",
" ",
" "};
/* XPM */
static const char * info_xpm[] = {
"24 24 4 1",
" c None",
". c #000000",
"+ c #828282",
"@ c #FFFFFF",
" ",
" ",
" ... ",
" .+++. ",
" .++@++. ",
" .+@@@+. ",
" .++@++. ",
" .+++. ",
" ... ",
" ",
" ........... ",
" .++@@@@@++. ",
" ...+@@@+... ",
" .+@@@+. ",
" .+@@@+. ",
" .+@@@+. ",
" .+@@@+. ",
" .+@@@+. ",
" .+@@@+. ",
" ...+@@@+... ",
" .++@@@@@++. ",
" ........... ",
" ",
" "};
/* XPM */
static const char *light_xpm[] = {
/* columns rows colors chars-per-pixel */
"24 24 9 1",
" c black",
". c #010101",
"X c #808080",
"o c gray51",
"O c #B2B2B2",
"+ c gray100",
"@ c gray100",
"# c gray100",
"$ c None",
/* pixels */
"$$$$$$$$$$$+$$$$$$$$$$$$",
"$$$$$$$$$$$+O$$$$$$$$$$$",
"$$+O$$$$$$$+O$$$$$$$+$$$",
"$$$+O$$$$ $$$$$+O$$$",
"$$$$+O$ ooooo $$+O$$$$",
"$$$$$+ oo+++++oo +O$$$$$",
"$$$$$ oO+++++++Oo $$$$$$",
"$$$$$ oO+++++++Oo $$$$$$",
"$$$$ oO+++++++++Oo $$$$$",
"$+++ oO+++++++++Oo +++$$",
"$$OO oO+++++++++Oo OOO$$",
"$$$$ oO+++++++++Oo $$$$$",
"$$$$$ oO+++++++Oo $$$$$$",
"$$$$$ oO+++++++Oo $$$$$$",
"$$$$+O ooO+++Ooo $+O$$$$",
"$$$+O$$ ooooo $$$+O$$$",
"$$+O$$$$ .. $$$$$+$$$",
"$$$$$$$$ .OOO. $$$$$$$$$",
"$$$$$$$$ X...X $$$$$$$$$",
"$$$$$$$$ .OOO. $$$$$$$$$",
"$$$$$$$$ X...X $$$$$$$$$",
"$$$$$$$$ OOO $$$$$$$$$",
"$$$$$$$$$ $$$$$$$$$$",
"$$$$$$$$$$ $$$$$$$$$$$"
};
/* XPM */
static const char* mono_xpm[] = {
"24 24 2 1",
". c #000000",
" c None",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ..... ",
" ... ... ",
" .. .. ",
" . ... . ",
" . ... . ",
" .. .. ",
" ... ... ",
" ..... ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" "};
/* XPM */
static const char * move_xpm[] = {
"24 24 6 1",
" c None",
". c #000000",
"+ c #B2B2B2",
"@ c #FFFFFF",
"# c #828282",
"$ c #E5E5E5",
" ",
" ",
" ... ",
" .+@+. ",
" .+@@@+. ",
" .+@@@@@+. ",
" .+++@+++.# ",
" ...+@+...# ",
" ... #.+@+.##... ",
" .++.#..+@+.. .++. ",
" .+@+...++@++...+@+. ",
" .+@@+++++@@$+++++@@+. ",
" .@@@@@@@@@@@@@@@@@@@.#",
" .+@@+++++@@$+++++@@+.#",
" .+@+...++@++...+@+.##",
" .++.#..+@+..#.++.# ",
" ...# .+@+.##...# ",
" ##...+@+...### ",
" .+++@+++.# ",
" .+@@@@@+.# ",
" .+@@@+.## ",
" .+@+.## ",
" ...## ",
" ### "};
/* XPM */
static const char * ortho_xpm[] = {
"24 24 4 1",
" c None",
". c #000000",
"+ c #FFFFFF",
"@ c #828282",
" ",
" ",
" ",
" ",
" ..................... ",
" .++++.++++.++++.++++.@ ",
" .++++.++++.++++.++++.@ ",
" .++++.++++.++++.++++.@ ",
" .++++.++++.++++.++++.@ ",
" .....................@ ",
" .++++.++++.++++.++++.@ ",
" .++++.++++.++++.++++.@ ",
" .++++.++++.++++.++++.@ ",
" .++++.++++.++++.++++.@ ",
" .....................@ ",
" .++++.++++.++++.++++.@ ",
" .++++.++++.++++.++++.@ ",
" .++++.++++.++++.++++.@ ",
" .++++.++++.++++.++++.@ ",
" .....................@ ",
" @@@@@@@@@@@@@@@@@@@@@ ",
" ",
" ",
" "};
/* XPM */
static const char * persp_xpm[] = {
"24 24 5 1",
" c None",
". c #000000",
"+ c #828282",
"@ c #FFFFFF",
"# c #FCFCFC",
" ",
" ",
" ",
" ",
" ",
" .........+ ",
" ..@.@.@.@..+ ",
" .@@.@.@.@@.+ ",
" .............+ ",
" .@@.@@.@@.@@.+ ",
" ..@@.@@.@@.@@..+ ",
" .@@@.@@.@@.@@@.+ ",
" .................+ ",
" .@@@.@@@.@@@.@@#.+ ",
" ..@@@.@@@.@@@.@@@..+ ",
" .@@@..@@@.@@@..@@@.+ ",
" ..@@@.@@@@.@@@@.@@@..+ ",
" .@@@@.@@@@.@@@@.@@@@.+ ",
" .....................+ ",
" +++++++++++++++++++++ ",
" ",
" ",
" ",
" "};
/* XPM */
static const char * pick_xpm[] = {
"24 24 6 1",
" c None",
". c #000000",
"+ c #828282",
"@ c #B2B2B2",
"# c #E5E5E5",
"$ c #FFFFFF",
" .. ",
" ... ",
" .+.. ",
" .@+.. ",
" .@#+.. ",
" .@##@.. ",
" .@##@@.. ",
" .@#$#@@.. ",
" .@#$$#@@.. ",
" .@#$$$#@@.. ",
" .@#$$$$#@@.. ",
" .@#$$$$$#$+.. ",
" .@#$$$$$$+.. ",
" .@#$$$$+... ",
" .@#$$+.... ",
" .@@+...$+.. ",
" .@.. .+$++. ",
" .. .+$$+.. ",
" ..+$++. ",
" .+$$+.. ",
" ..+$++. ",
" .+$$.. ",
" ..... ",
" "};
/* XPM */
static const char * scenegraph_xpm[] = {
"24 24 6 1",
" c None",
". c #000000",
"+ c #FFFFFF",
"@ c #D8D8D8",
"# c #828282",
"$ c #B2B2B2",
" ",
" ... ",
" .+@@. ",
" .@+@.# ",
" .@@$.# ",
" ...## ",
" .## ... ",
" .# .+@@. ",
" .....@+@.# ",
" .###.@@$.# ",
" .# ...## ",
" .# .## ... ",
" .# .# .+@@. ",
" .# .....@+@.# ",
" .# ###.@@$.# ",
" .# ...## ",
" .# ### ",
" .# ... ",
" .# .+@@. ",
" .....@+@.# ",
" ###.@@$.# ",
" ...## ",
" ### ",
" "};
/* XPM */
static const char * set_home_xpm[] = {
"24 24 5 1",
" c None",
". c #000000",
"+ c #FFFFFF",
"@ c #B2B2B2",
"# c #828282",
" .... ",
" .+@.# ",
" .+@.# ",
" .+@.# ",
" .+@.# ",
" .+@.# ",
" ..# ... ",
" # .... .+## ",
" .... ........+## ",
" .+@.# ..........+## ",
" ....# .....#.....+#.. ",
" #### ....###++........",
" ...###++++++......",
" ...##++++###++.... ",
" ###++++++#..++..#.#",
" .++++++#..++.##.#",
" .+++++++++++.##.#",
" .+++####++++.##.#",
" .+++#...++++.##.#",
" .+++#...++++.##.#",
" .+++#...++++.#..#",
" .+++#...++++...##",
" ..............## ",
" ############## "};
/* XPM */
static const char* stereo_xpm[] = {
"24 24 2 1",
". c #000000",
" c None",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ..... ..... ",
" ... ... ... ... ",
" .. .... .. ",
" . ... .. ... . ",
" . ... .. ... . ",
" .. .... .. ",
" ... ... ... ... ",
" ..... ..... ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" "};
/* XPM */
static const char * viewall_xpm[] = {
"24 24 5 1",
" c None",
". c #000000",
"+ c #828282",
"@ c #FFFFFF",
"# c #4C4C4C",
" ",
" ",
" .+ ",
" .+ .+ .+ ",
" .+ .+ .+ ",
" .+ ..+ .+ ..+ . ",
" ..+ .+++.+++.+ .. ",