Commit 065f81f1 authored by Jan Möbius's avatar Jan Möbius
Browse files

Handle default projection mode via OpenFlipperSettings and reorder widget

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@11400 383ad7c9-94d9-4d36-a494-682f7c89f535
parent d1dc4061
...@@ -172,10 +172,6 @@ Core() : ...@@ -172,10 +172,6 @@ Core() :
PluginFunctions::setViewerProperties(viewerProperties); PluginFunctions::setViewerProperties(viewerProperties);
//set viewer defaults //set viewer defaults
OpenFlipper::Options::defaultProjectionMode( 1, 0 );
OpenFlipper::Options::defaultProjectionMode( 0, 1 );
OpenFlipper::Options::defaultProjectionMode( 0, 2 );
OpenFlipper::Options::defaultProjectionMode( 0, 3 );
OpenFlipper::Options::defaultViewingDirection( PluginFunctions::VIEW_FREE, 0 ); OpenFlipper::Options::defaultViewingDirection( PluginFunctions::VIEW_FREE, 0 );
OpenFlipper::Options::defaultViewingDirection( PluginFunctions::VIEW_TOP, 1 ); OpenFlipper::Options::defaultViewingDirection( PluginFunctions::VIEW_TOP, 1 );
OpenFlipper::Options::defaultViewingDirection( PluginFunctions::VIEW_LEFT, 2 ); OpenFlipper::Options::defaultViewingDirection( PluginFunctions::VIEW_LEFT, 2 );
......
...@@ -260,9 +260,6 @@ void Core::readApplicationOptions(INIFile& _ini) { ...@@ -260,9 +260,6 @@ void Core::readApplicationOptions(INIFile& _ini) {
if( _ini.get_entry(draw_modes, "Options", "DefaultDrawModes" + QString::number(i) ) ) if( _ini.get_entry(draw_modes, "Options", "DefaultDrawModes" + QString::number(i) ) )
OpenFlipper::Options::defaultDrawMode( listToDrawMode(draw_modes), i ); OpenFlipper::Options::defaultDrawMode( listToDrawMode(draw_modes), i );
if( _ini.get_entry(mode, "Options", "DefaultProjectionMode" + QString::number(i) ) )
OpenFlipper::Options::defaultProjectionMode( mode, i );
if( _ini.get_entry(mode, "Options", "DefaultViewingDirection" + QString::number(i) ) ) if( _ini.get_entry(mode, "Options", "DefaultViewingDirection" + QString::number(i) ) )
OpenFlipper::Options::defaultViewingDirection( mode, i ); OpenFlipper::Options::defaultViewingDirection( mode, i );
} }
...@@ -466,7 +463,6 @@ void Core::writeApplicationOptions(INIFile& _ini) { ...@@ -466,7 +463,6 @@ void Core::writeApplicationOptions(INIFile& _ini) {
draw_modes = drawModeToList( OpenFlipper::Options::defaultDrawMode(i) ); draw_modes = drawModeToList( OpenFlipper::Options::defaultDrawMode(i) );
_ini.add_entry("Options","DefaultDrawModes" + QString::number(i), draw_modes); _ini.add_entry("Options","DefaultDrawModes" + QString::number(i), draw_modes);
_ini.add_entry("Options","DefaultProjectionMode" + QString::number(i), OpenFlipper::Options::defaultProjectionMode(i) );
_ini.add_entry("Options","DefaultViewingDirection" + QString::number(i), OpenFlipper::Options::defaultViewingDirection(i) ); _ini.add_entry("Options","DefaultViewingDirection" + QString::number(i), OpenFlipper::Options::defaultViewingDirection(i) );
} }
......
...@@ -497,10 +497,10 @@ void Core::slotFileOpened ( int _id ) { ...@@ -497,10 +497,10 @@ void Core::slotFileOpened ( int _id ) {
for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ){ for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ){
PluginFunctions::viewerProperties(i).drawMode( OpenFlipper::Options::defaultDrawMode(i) ); PluginFunctions::viewerProperties(i).drawMode( OpenFlipper::Options::defaultDrawMode(i) );
if ( OpenFlipper::Options::defaultProjectionMode(i) == 0 ) if ( OpenFlipper::Options::defaultPerspectiveProjectionMode(i) )
PluginFunctions::orthographicProjection(i);
else
PluginFunctions::perspectiveProjection(i); PluginFunctions::perspectiveProjection(i);
else
PluginFunctions::orthographicProjection(i);
PluginFunctions::setFixedView(OpenFlipper::Options::defaultViewingDirection(i), i ); PluginFunctions::setFixedView(OpenFlipper::Options::defaultViewingDirection(i), i );
} }
......
...@@ -129,11 +129,11 @@ void Core::applyOptions(){ ...@@ -129,11 +129,11 @@ void Core::applyOptions(){
//only switch projection here if an object is opened //only switch projection here if an object is opened
//this prevents problems when applying options on app start //this prevents problems when applying options on app start
if ( PluginFunctions::objectCount() > 0 ){ if ( PluginFunctions::objectCount() > 0 ){
if ( OpenFlipper::Options::defaultProjectionMode(i) == 0 ) if ( OpenFlipper::Options::defaultPerspectiveProjectionMode(i) )
PluginFunctions::orthographicProjection(i);
else
PluginFunctions::perspectiveProjection(i); PluginFunctions::perspectiveProjection(i);
else
PluginFunctions::orthographicProjection(i);
} }
} }
......
...@@ -150,9 +150,6 @@ static bool synchronization_ = false; ...@@ -150,9 +150,6 @@ static bool synchronization_ = false;
/// Store the defaultDrawMode_ mode /// Store the defaultDrawMode_ mode
static std::vector<ACG::SceneGraph::DrawModes::DrawMode> defaultDrawMode_ = std::vector<ACG::SceneGraph::DrawModes::DrawMode> (4, ACG::SceneGraph::DrawModes::SOLID_SMOOTH_SHADED); static std::vector<ACG::SceneGraph::DrawModes::DrawMode> defaultDrawMode_ = std::vector<ACG::SceneGraph::DrawModes::DrawMode> (4, ACG::SceneGraph::DrawModes::SOLID_SMOOTH_SHADED);
/// Store the defaultProjectionMode_ mode
static std::vector<int> defaultProjectionMode_ = std::vector<int> (4, 1);
/// Store the defaultViewingDirection_ mode /// Store the defaultViewingDirection_ mode
static std::vector<int> defaultViewingDirection_ = std::vector<int> (4, 0); static std::vector<int> defaultViewingDirection_ = std::vector<int> (4, 0);
...@@ -486,12 +483,33 @@ ACG::SceneGraph::DrawModes::DrawMode defaultDrawMode(int _viewer){ ...@@ -486,12 +483,33 @@ ACG::SceneGraph::DrawModes::DrawMode defaultDrawMode(int _viewer){
return defaultDrawMode_[_viewer]; return defaultDrawMode_[_viewer];
} }
void defaultProjectionMode( int _mode, int _viewer){ void defaultPerspectiveProjectionMode( bool _mode, int _viewer){
defaultProjectionMode_[_viewer] = _mode;
// Core/Gui/glViewer<viewer> Orthogonal = false,Perspective = true (bool)\n
QString entry = "Viewer" + QString::number(_viewer) + "/perspectiveProjection";
OpenFlipperSettings().setValue(entry,_mode);
} }
int defaultProjectionMode(int _viewer){ bool defaultPerspectiveProjectionMode(int _viewer){
return defaultProjectionMode_[_viewer];
QString entry = "Viewer" + QString::number(_viewer) + "/perspectiveProjection";
switch (_viewer) {
case 0:
return OpenFlipperSettings().value(entry,true).toBool();
case 1:
return OpenFlipperSettings().value(entry,false).toBool();
case 2:
return OpenFlipperSettings().value(entry,false).toBool();
case 3:
return OpenFlipperSettings().value(entry,false).toBool();
default:
std::cerr << "defaultProjectionMode: illegal viewer id: " << _viewer << std::endl;
}
return true;
} }
void defaultViewingDirection( int _mode, int _viewer){ void defaultViewingDirection( int _mode, int _viewer){
......
...@@ -103,6 +103,10 @@ ...@@ -103,6 +103,10 @@
* * Core/Gui/fullscreen Show OpenFlipper in Fullscreen Mode(bool)\n * * Core/Gui/fullscreen Show OpenFlipper in Fullscreen Mode(bool)\n
* * Core/Projection/FOVY Field of view for projection matrix in perspective mode(double)\n * * Core/Projection/FOVY Field of view for projection matrix in perspective mode(double)\n
* *
* <b>User Interface Settings for each of the viewers</b>\n
* * Viewer<viewer>/perspectiveProjection Orthogonal = false,Perspective = true (bool)\n
*
*
* <b>File Handling</b>\n * <b>File Handling</b>\n
* * Core/CurrentDir The current Directory of the Application \n * * Core/CurrentDir The current Directory of the Application \n
* * Core/File/RecentFiles List of Recent Files \n * * Core/File/RecentFiles List of Recent Files \n
...@@ -455,13 +459,17 @@ QString helpDirStr(); ...@@ -455,13 +459,17 @@ QString helpDirStr();
DLLEXPORT DLLEXPORT
ACG::SceneGraph::DrawModes::DrawMode defaultDrawMode( int _viewer ); ACG::SceneGraph::DrawModes::DrawMode defaultDrawMode( int _viewer );
/// Store defaultProjectionMode setting /** \brief Store defaultProjectionMode setting
Perspective projection = true;
Orthogonal Projection = false;
*/
DLLEXPORT DLLEXPORT
void defaultProjectionMode( int _mode, int _viewer ); void defaultPerspectiveProjectionMode( bool _mode, int _viewer );
/// get defaultProjectionMode setting /// get defaultProjectionMode setting
DLLEXPORT DLLEXPORT
int defaultProjectionMode( int _viewer ); bool defaultPerspectiveProjectionMode( int _viewer );
/// Store defaultViewingDirection setting /// Store defaultViewingDirection setting
DLLEXPORT DLLEXPORT
......
...@@ -122,7 +122,7 @@ OptionsWidget::OptionsWidget(std::vector<PluginInfo>& _plugins, std::vector<KeyB ...@@ -122,7 +122,7 @@ OptionsWidget::OptionsWidget(std::vector<PluginInfo>& _plugins, std::vector<KeyB
for ( int i=0; i < PluginFunctions::viewers(); i++ ){ for ( int i=0; i < PluginFunctions::viewers(); i++ ){
viewerList->addItem("Viewer " + QString::number(i+1) ); viewerList->addItem("Viewer " + QString::number(i+1) );
defaultDrawModes_.push_back( ACG::SceneGraph::DrawModes::DEFAULT ); defaultDrawModes_.push_back( ACG::SceneGraph::DrawModes::DEFAULT );
defaultProjectionMode_.push_back( 0 ); defaultProjectionMode_.push_back( true );
defaultViewingDirections_.push_back( 0 ); defaultViewingDirections_.push_back( 0 );
} }
...@@ -187,7 +187,7 @@ void OptionsWidget::viewerSettingsChanged(int /*_index*/){ ...@@ -187,7 +187,7 @@ void OptionsWidget::viewerSettingsChanged(int /*_index*/){
mode.push_back( availDrawModes->item(i)->text() ); mode.push_back( availDrawModes->item(i)->text() );
defaultDrawModes_[ viewerList->currentRow() ] = descriptionsToDrawMode(mode); defaultDrawModes_[ viewerList->currentRow() ] = descriptionsToDrawMode(mode);
defaultProjectionMode_[ viewerList->currentRow() ] = projectionBox->currentIndex(); defaultProjectionMode_[ viewerList->currentRow() ] = projectionBox->currentIndex() ;
defaultViewingDirections_[ viewerList->currentRow() ] = directionBox->currentIndex(); defaultViewingDirections_[ viewerList->currentRow() ] = directionBox->currentIndex();
} }
}; };
...@@ -235,7 +235,11 @@ void OptionsWidget::updateViewerSettings(int _row){ ...@@ -235,7 +235,11 @@ void OptionsWidget::updateViewerSettings(int _row){
} }
} }
projectionBox->setCurrentIndex( defaultProjectionMode_[_row] ); if ( defaultProjectionMode_[_row] )
projectionBox->setCurrentIndex( 1 );
else
projectionBox->setCurrentIndex( 0 );
directionBox->setCurrentIndex( defaultViewingDirections_[_row] ); directionBox->setCurrentIndex( defaultViewingDirections_[_row] );
updatingViewerSettings_ = false; updatingViewerSettings_ = false;
...@@ -399,7 +403,7 @@ void OptionsWidget::showEvent ( QShowEvent * /*event*/ ) { ...@@ -399,7 +403,7 @@ void OptionsWidget::showEvent ( QShowEvent * /*event*/ ) {
for ( int i=0; i < PluginFunctions::viewers(); i++ ){ for ( int i=0; i < PluginFunctions::viewers(); i++ ){
defaultDrawModes_[i] = OpenFlipper::Options::defaultDrawMode(i); defaultDrawModes_[i] = OpenFlipper::Options::defaultDrawMode(i);
defaultProjectionMode_[i] = OpenFlipper::Options::defaultProjectionMode(i); defaultProjectionMode_[i] = OpenFlipper::Options::defaultPerspectiveProjectionMode(i);
defaultViewingDirections_[i] = OpenFlipper::Options::defaultViewingDirection(i); defaultViewingDirections_[i] = OpenFlipper::Options::defaultViewingDirection(i);
} }
...@@ -684,7 +688,7 @@ void OptionsWidget::slotApply() { ...@@ -684,7 +688,7 @@ void OptionsWidget::slotApply() {
//viewer defaults //viewer defaults
for (int i=0; i < PluginFunctions::viewers(); i++){ for (int i=0; i < PluginFunctions::viewers(); i++){
OpenFlipper::Options::defaultDrawMode( defaultDrawModes_[i], i ); OpenFlipper::Options::defaultDrawMode( defaultDrawModes_[i], i );
OpenFlipper::Options::defaultProjectionMode( defaultProjectionMode_[i], i ); OpenFlipper::Options::defaultPerspectiveProjectionMode( defaultProjectionMode_[i], i );
OpenFlipper::Options::defaultViewingDirection( defaultViewingDirections_[i], i ); OpenFlipper::Options::defaultViewingDirection( defaultViewingDirections_[i], i );
} }
......
...@@ -174,7 +174,7 @@ private: ...@@ -174,7 +174,7 @@ private:
// remember changes to viewer properties // remember changes to viewer properties
std::vector< ACG::SceneGraph::DrawModes::DrawMode > defaultDrawModes_; std::vector< ACG::SceneGraph::DrawModes::DrawMode > defaultDrawModes_;
std::vector< int > defaultProjectionMode_; std::vector< bool > defaultProjectionMode_;
std::vector< int > defaultViewingDirections_; std::vector< int > defaultViewingDirections_;
bool updatingViewerSettings_; bool updatingViewerSettings_;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>778</width> <width>825</width>
<height>964</height> <height>964</height>
</rect> </rect>
</property> </property>
...@@ -372,34 +372,13 @@ ...@@ -372,34 +372,13 @@
<enum>QFormLayout::ExpandingFieldsGrow</enum> <enum>QFormLayout::ExpandingFieldsGrow</enum>
</property> </property>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="label_15">
<property name="text">
<string>Projection type:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="projectionBox">
<item>
<property name="text">
<string>Orthogonal</string>
</property>
</item>
<item>
<property name="text">
<string>Perspective</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_27"> <widget class="QLabel" name="label_27">
<property name="text"> <property name="text">
<string>Field of View</string> <string>Field of View</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="0" column="1">
<widget class="QDoubleSpinBox" name="fieldOfView"> <widget class="QDoubleSpinBox" name="fieldOfView">
<property name="minimum"> <property name="minimum">
<double>1.000000000000000</double> <double>1.000000000000000</double>
...@@ -660,8 +639,8 @@ ...@@ -660,8 +639,8 @@
<property name="title"> <property name="title">
<string>Viewer Specific Settings</string> <string>Viewer Specific Settings</string>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_19"> <layout class="QGridLayout" name="gridLayout_5">
<item> <item row="0" column="0" rowspan="2">
<layout class="QVBoxLayout" name="verticalLayout_7"> <layout class="QVBoxLayout" name="verticalLayout_7">
<item> <item>
<widget class="QLabel" name="label_17"> <widget class="QLabel" name="label_17">
...@@ -697,14 +676,14 @@ ...@@ -697,14 +676,14 @@
</item> </item>
</layout> </layout>
</item> </item>
<item> <item row="0" column="1" rowspan="2">
<widget class="Line" name="line_3"> <widget class="Line" name="line_3">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="0" column="2" rowspan="2">
<layout class="QVBoxLayout" name="verticalLayout_9"> <layout class="QVBoxLayout" name="verticalLayout_9">
<item> <item>
<widget class="QLabel" name="label_7"> <widget class="QLabel" name="label_7">
...@@ -731,6 +710,35 @@ You can select multiple modes at the same time.</string> ...@@ -731,6 +710,35 @@ You can select multiple modes at the same time.</string>
</property> </property>
</widget> </widget>
</item> </item>
</layout>
</item>
<item row="0" column="3">
<layout class="QVBoxLayout" name="verticalLayout_21">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_19">
<item>
<widget class="QLabel" name="label_15">
<property name="text">
<string>Projection type:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="projectionBox">
<item>
<property name="text">
<string>Orthogonal</string>
</property>
</item>
<item>
<property name="text">
<string>Perspective</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item> <item>
<layout class="QFormLayout" name="formLayout_3"> <layout class="QFormLayout" name="formLayout_3">
<item row="1" column="0"> <item row="1" column="0">
...@@ -783,6 +791,19 @@ You can select multiple modes at the same time.</string> ...@@ -783,6 +791,19 @@ You can select multiple modes at the same time.</string>
</item> </item>
</layout> </layout>
</item> </item>
<item row="1" column="3">
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>157</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
......
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