Commit 1e5660b3 authored by Dirk Wilden's avatar Dirk Wilden
parent fce26e04
......@@ -175,6 +175,20 @@ void Core::readApplicationOptions(INIFile& _ini) {
if ( _ini.get_entry( animation, "Options" , "Animation") )
OpenFlipper::Options::animation(animation);
//============================================================================
// Load the twoSidedLighting setting
//============================================================================
bool twoSidedLighting = false;
if ( _ini.get_entry( twoSidedLighting, "Options" , "TwoSidedLighting") )
OpenFlipper::Options::twoSidedLighting(twoSidedLighting);
//============================================================================
// Load the synchronization setting
//============================================================================
bool synchronization = false;
if ( _ini.get_entry( synchronization, "Options" , "Synchronization") )
OpenFlipper::Options::synchronization(synchronization);
//============================================================================
// Load the stereo mode setting
//============================================================================
......@@ -407,6 +421,8 @@ void Core::writeApplicationOptions(INIFile& _ini) {
_ini.add_entry("Options","BackfaceCulling",coreWidget_->examiner_widget_->backFaceCulling());
_ini.add_entry("Options","Animation",coreWidget_->examiner_widget_->animation());
_ini.add_entry("Options","Synchronization",coreWidget_->examiner_widget_->synchronization());
_ini.add_entry("Options","twoSidedLighting",coreWidget_->examiner_widget_->twoSidedLighting());
_ini.add_entry("Options","WheelZoomFactor",coreWidget_->examiner_widget_->wheelZoomFactor());
_ini.add_entry("Options","WheelZoomFactorShift",coreWidget_->examiner_widget_->wheelZoomFactorShift());
......
......@@ -87,12 +87,18 @@ static bool nogui_ = false;
/// Store the stereo mode
static bool stereo_ = false;
/// Store the synchronization mode
static bool synchronization_ = false;
/// Store the animation mode
static bool animation_ = false;
/// Store the backfaceCulling mode
static bool backfaceCulling_ = false;
/// Store the backfaceCulling mode
static bool twoSidedLighting_ = false;
/// Store the wheelZoomFactor mode
static double wheelZoomFactor_ = 1.0;
......@@ -376,6 +382,16 @@ bool stereo( ) {
return stereo_;
}
/// Store synchronization mode setting
void synchronization( bool _synchronization ) {
synchronization_ = _synchronization;
}
/// get current synchronization setting
bool synchronization( ) {
return synchronization_;
}
/// Store animation mode setting
void animation( bool _animation ) {
animation_ = _animation;
......@@ -396,6 +412,16 @@ bool backfaceCulling( ) {
return backfaceCulling_;
}
/// Store twoSidedLighting setting
void twoSidedLighting( bool _twoSidedLighting ) {
twoSidedLighting_ = _twoSidedLighting;
}
/// get twoSidedLighting setting
bool twoSidedLighting( ) {
return twoSidedLighting_;
}
/// Store wheelZoomFactor setting
void wheelZoomFactor( double _factor ) {
wheelZoomFactor_ = _factor;
......
......@@ -316,6 +316,14 @@ void fontsDir(QDir _dir);
DLLEXPORT
bool stereo( );
/// Store synchronization setting
DLLEXPORT
void synchronization( bool _synchronization );
/// get current synchronization setting
DLLEXPORT
bool synchronization( );
/// Store animation mode setting
DLLEXPORT
void animation( bool _animation );
......@@ -332,6 +340,14 @@ void fontsDir(QDir _dir);
DLLEXPORT
bool backfaceCulling( );
/// Store twoSidedLighting setting
DLLEXPORT
void twoSidedLighting( bool _twoSidedLighting );
/// get twoSidedLighting setting
DLLEXPORT
bool twoSidedLighting( );
/// Store wheelZoomFactor setting
DLLEXPORT
void wheelZoomFactor( double _factor );
......
......@@ -195,11 +195,54 @@ void CoreWidget::updatePopupMenu(const QPoint& _point) {
examiner_widget_->getPickMenu()->setTearOffEnabled(true);
}
if (examiner_widget_->getFuncMenu() != NULL) {
examiner_widget_->getFuncMenu()->setTitle("&Functions");
contextMenu_->addMenu(examiner_widget_->getFuncMenu() );
examiner_widget_->getFuncMenu()->setTearOffEnabled(true);
}
// Add a functions menu
QAction* action;
QMenu* functionMenu = new QMenu("&Functions",contextMenu_);
action = functionMenu->addAction("Set Background Color");
action->setToolTip("Set the background color for the viewer");
connect(action, SIGNAL(triggered()), this, SLOT(changeBackgroundColor()) );
functionMenu->addSeparator();
action = functionMenu->addAction("Snapshot");
action->setToolTip("Make a snapshot");
connect(action, SIGNAL(triggered()), examiner_widget_, SLOT(actionSnapshot()) );
action = functionMenu->addAction("Set Snapshot Name");
action->setToolTip("Set a name for snapshots");
connect(action, SIGNAL(triggered()), examiner_widget_, SLOT(actionSnapshotName()) );
functionMenu->addSeparator();
action = functionMenu->addAction("Copy View");
action->setToolTip("Copy current view to clipboard");
connect(action, SIGNAL(triggered()), examiner_widget_, SLOT(actionCopyView()) );
action = functionMenu->addAction("Paste View");
action->setToolTip("Paste current view from clipboard");
connect(action, SIGNAL(triggered()), examiner_widget_, SLOT(actionPasteView()) );
functionMenu->addSeparator();
action = functionMenu->addAction("Synchronization");
action->setToolTip("Synchronize two different viewers");
action->setCheckable( true );
action->setChecked( OpenFlipper::Options::synchronization() );
connect(action, SIGNAL(triggered(bool)), examiner_widget_, SLOT(actionSynchronize(bool)) );
connect(action, SIGNAL(triggered(bool)), this, SLOT(updateGlobalOptions(bool)) );
action = functionMenu->addAction("Animation");
action->setToolTip("Animate rotation of objects");
action->setCheckable( true );
action->setChecked( OpenFlipper::Options::animation() );
connect(action, SIGNAL(triggered(bool)), examiner_widget_, SLOT(actionAnimation(bool)) );
connect(action, SIGNAL(triggered(bool)), this, SLOT(updateGlobalOptions(bool)) );
action = functionMenu->addAction("Backface Culling");
action->setToolTip("Enable backface culling");
action->setCheckable( true );
action->setChecked( OpenFlipper::Options::backfaceCulling() );
connect(action, SIGNAL(triggered(bool)), examiner_widget_, SLOT(actionBackfaceCulling(bool)) );
connect(action, SIGNAL(triggered(bool)), this, SLOT(updateGlobalOptions(bool)) );
action = functionMenu->addAction("Two-sided Lighting");
action->setToolTip("Enable two-sided lighting");
action->setCheckable( true );
action->setChecked( OpenFlipper::Options::twoSidedLighting() );
connect(action, SIGNAL(triggered(bool)), examiner_widget_, SLOT(actionTwoSidedLighting(bool)) );
connect(action, SIGNAL(triggered(bool)), this, SLOT(updateGlobalOptions(bool)) );
functionMenu->setTearOffEnabled(true);
contextMenu_->addMenu(functionMenu );
if ( ( examiner_widget_->getDrawMenu() != NULL ) && OpenFlipper::Options::drawModesInContextMenu() ) {
......@@ -214,6 +257,28 @@ void CoreWidget::updatePopupMenu(const QPoint& _point) {
}
}
void CoreWidget::changeBackgroundColor(){
ACG::Vec4f bc = examiner_widget_->backgroundColor();
QColor backCol((int)bc[0], (int)bc[1], (int)bc[2]);
QColor c = QColorDialog::getColor(backCol,this);
if (c != backCol && c.isValid()){
examiner_widget_->backgroundColor(ACG::Vec4f(((double) c.red()) / 255.0,
((double) c.green()) / 255.0,
((double) c.blue()) / 255.0,
1.0));
OpenFlipper::Options::defaultBackgroundColor( c.rgb() );
}
}
void CoreWidget::updateGlobalOptions(bool /*_enable*/){
OpenFlipper::Options::synchronization( examiner_widget_->synchronization() );
OpenFlipper::Options::animation( examiner_widget_->animation() );
OpenFlipper::Options::backfaceCulling( examiner_widget_->backFaceCulling() );
OpenFlipper::Options::twoSidedLighting( examiner_widget_->twoSidedLighting() );
}
void CoreWidget::slotAddContextMenu(QMenu* _menu) {
MenuInfo info;
info.menu = _menu;
......
......@@ -252,7 +252,7 @@ CoreWidget( QVector<ViewMode*>& _viewModes,
connect( examiner_widget_ , SIGNAL(signalCustomContextMenuRequested( const QPoint&) ) ,
this , SLOT( slotCustomContextMenu( const QPoint&) ) );
contextMenu_ = new QMenu(0);
contextMenu_ = new QMenu(this);
contextSelectionMenu_ = new QMenu("Selection",0);
setupMenuBar();
......
......@@ -375,6 +375,12 @@ public:
/// called by plugins to add a real context menu depending on DataType
void slotAddContextMenu( QMenu* _menu , DataType _dataType ,ContextMenuType type_);
/// update globalOptions for actions in the contexMenu
void updateGlobalOptions(bool _enable);
/// change the background color
void changeBackgroundColor();
private :
void updatePopupMenu(const QPoint& _point);
......
......@@ -118,6 +118,7 @@ void OptionsWidget::showEvent ( QShowEvent * /*event*/ ) {
logFile->setText( OpenFlipper::Options::logFile() );
//viewer
animation->setChecked( OpenFlipper::Options::animation() );
backfaceCulling->setChecked( OpenFlipper::Options::backfaceCulling() );
wZoomFactor->setText( QString::number(OpenFlipper::Options::wheelZoomFactor(), 'f') );
wZoomFactorShift->setText( QString::number(OpenFlipper::Options::wheelZoomFactorShift(), 'f') );
......@@ -365,6 +366,7 @@ void OptionsWidget::slotApply() {
OpenFlipper::Options::logFile( logFile->text() );
//viewer
OpenFlipper::Options::animation( animation->isChecked() );
OpenFlipper::Options::backfaceCulling( backfaceCulling->isChecked() );
OpenFlipper::Options::wheelZoomFactor( wZoomFactor->text().toDouble() );
OpenFlipper::Options::wheelZoomFactorShift( wZoomFactorShift->text().toDouble() );
......
......@@ -23,20 +23,12 @@ You can select multiple modes at the same time.</string>
<string/>
</property>
<property name="currentIndex" >
<number>5</number>
<number>2</number>
</property>
<property name="usesScrollButtons" >
<bool>true</bool>
</property>
<widget class="QWidget" name="general" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>462</width>
<height>677</height>
</rect>
</property>
<attribute name="title" >
<string>General</string>
</attribute>
......@@ -129,14 +121,6 @@ You can select multiple modes at the same time.</string>
</layout>
</widget>
<widget class="QWidget" name="paths" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>462</width>
<height>677</height>
</rect>
</property>
<attribute name="title" >
<string>Paths</string>
</attribute>
......@@ -161,14 +145,6 @@ You can select multiple modes at the same time.</string>
</layout>
</widget>
<widget class="QWidget" name="viewer" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>462</width>
<height>677</height>
</rect>
</property>
<attribute name="title" >
<string>Viewer</string>
</attribute>
......@@ -365,6 +341,19 @@ You can select multiple modes at the same time.</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="animation" >
<property name="toolTip" >
<string>Enable animated rotations</string>
</property>
<property name="statusTip" >
<string>Enable animated rotations</string>
</property>
<property name="text" >
<string>Animation</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6" >
<item>
......@@ -395,14 +384,6 @@ You can select multiple modes at the same time.</string>
</layout>
</widget>
<widget class="QWidget" name="key" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>462</width>
<height>677</height>
</rect>
</property>
<attribute name="title" >
<string>Key Bindings</string>
</attribute>
......@@ -419,14 +400,6 @@ You can select multiple modes at the same time.</string>
</layout>
</widget>
<widget class="QWidget" name="Updates" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>462</width>
<height>677</height>
</rect>
</property>
<attribute name="title" >
<string>Updates</string>
</attribute>
......@@ -545,14 +518,6 @@ You can select multiple modes at the same time.</string>
</layout>
</widget>
<widget class="QWidget" name="Debug" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>462</width>
<height>677</height>
</rect>
</property>
<attribute name="title" >
<string>Debug</string>
</attribute>
......
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