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

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() :
PluginFunctions::setViewerProperties(viewerProperties);
//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_TOP, 1 );
OpenFlipper::Options::defaultViewingDirection( PluginFunctions::VIEW_LEFT, 2 );
......
......@@ -260,9 +260,6 @@ void Core::readApplicationOptions(INIFile& _ini) {
if( _ini.get_entry(draw_modes, "Options", "DefaultDrawModes" + QString::number(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) ) )
OpenFlipper::Options::defaultViewingDirection( mode, i );
}
......@@ -466,7 +463,6 @@ void Core::writeApplicationOptions(INIFile& _ini) {
draw_modes = drawModeToList( OpenFlipper::Options::defaultDrawMode(i) );
_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) );
}
......
......@@ -497,10 +497,10 @@ void Core::slotFileOpened ( int _id ) {
for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ){
PluginFunctions::viewerProperties(i).drawMode( OpenFlipper::Options::defaultDrawMode(i) );
if ( OpenFlipper::Options::defaultProjectionMode(i) == 0 )
PluginFunctions::orthographicProjection(i);
else
if ( OpenFlipper::Options::defaultPerspectiveProjectionMode(i) )
PluginFunctions::perspectiveProjection(i);
else
PluginFunctions::orthographicProjection(i);
PluginFunctions::setFixedView(OpenFlipper::Options::defaultViewingDirection(i), i );
}
......
......@@ -129,11 +129,11 @@ void Core::applyOptions(){
//only switch projection here if an object is opened
//this prevents problems when applying options on app start
if ( PluginFunctions::objectCount() > 0 ){
if ( OpenFlipper::Options::defaultProjectionMode(i) == 0 )
PluginFunctions::orthographicProjection(i);
else
if ( PluginFunctions::objectCount() > 0 ){
if ( OpenFlipper::Options::defaultPerspectiveProjectionMode(i) )
PluginFunctions::perspectiveProjection(i);
else
PluginFunctions::orthographicProjection(i);
}
}
......
......@@ -150,9 +150,6 @@ static bool synchronization_ = false;
/// 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);
/// Store the defaultProjectionMode_ mode
static std::vector<int> defaultProjectionMode_ = std::vector<int> (4, 1);
/// Store the defaultViewingDirection_ mode
static std::vector<int> defaultViewingDirection_ = std::vector<int> (4, 0);
......@@ -486,12 +483,33 @@ ACG::SceneGraph::DrawModes::DrawMode defaultDrawMode(int _viewer){
return defaultDrawMode_[_viewer];
}
void defaultProjectionMode( int _mode, int _viewer){
defaultProjectionMode_[_viewer] = _mode;
void defaultPerspectiveProjectionMode( bool _mode, int _viewer){
// 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){
return defaultProjectionMode_[_viewer];
bool defaultPerspectiveProjectionMode(int _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){
......
......@@ -103,6 +103,10 @@
* * Core/Gui/fullscreen Show OpenFlipper in Fullscreen Mode(bool)\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
* * Core/CurrentDir The current Directory of the Application \n
* * Core/File/RecentFiles List of Recent Files \n
......@@ -455,13 +459,17 @@ QString helpDirStr();
DLLEXPORT
ACG::SceneGraph::DrawModes::DrawMode defaultDrawMode( int _viewer );
/// Store defaultProjectionMode setting
/** \brief Store defaultProjectionMode setting
Perspective projection = true;
Orthogonal Projection = false;
*/
DLLEXPORT
void defaultProjectionMode( int _mode, int _viewer );
void defaultPerspectiveProjectionMode( bool _mode, int _viewer );
/// get defaultProjectionMode setting
DLLEXPORT
int defaultProjectionMode( int _viewer );
bool defaultPerspectiveProjectionMode( int _viewer );
/// Store defaultViewingDirection setting
DLLEXPORT
......
......@@ -122,7 +122,7 @@ OptionsWidget::OptionsWidget(std::vector<PluginInfo>& _plugins, std::vector<KeyB
for ( int i=0; i < PluginFunctions::viewers(); i++ ){
viewerList->addItem("Viewer " + QString::number(i+1) );
defaultDrawModes_.push_back( ACG::SceneGraph::DrawModes::DEFAULT );
defaultProjectionMode_.push_back( 0 );
defaultProjectionMode_.push_back( true );
defaultViewingDirections_.push_back( 0 );
}
......@@ -187,7 +187,7 @@ void OptionsWidget::viewerSettingsChanged(int /*_index*/){
mode.push_back( availDrawModes->item(i)->text() );
defaultDrawModes_[ viewerList->currentRow() ] = descriptionsToDrawMode(mode);
defaultProjectionMode_[ viewerList->currentRow() ] = projectionBox->currentIndex();
defaultProjectionMode_[ viewerList->currentRow() ] = projectionBox->currentIndex() ;
defaultViewingDirections_[ viewerList->currentRow() ] = directionBox->currentIndex();
}
};
......@@ -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] );
updatingViewerSettings_ = false;
......@@ -399,7 +403,7 @@ void OptionsWidget::showEvent ( QShowEvent * /*event*/ ) {
for ( int i=0; i < PluginFunctions::viewers(); 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);
}
......@@ -684,7 +688,7 @@ void OptionsWidget::slotApply() {
//viewer defaults
for (int i=0; i < PluginFunctions::viewers(); 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 );
}
......
......@@ -174,7 +174,7 @@ private:
// remember changes to viewer properties
std::vector< ACG::SceneGraph::DrawModes::DrawMode > defaultDrawModes_;
std::vector< int > defaultProjectionMode_;
std::vector< bool > defaultProjectionMode_;
std::vector< int > defaultViewingDirections_;
bool updatingViewerSettings_;
......
......@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>778</width>
<width>825</width>
<height>964</height>
</rect>
</property>
......@@ -372,34 +372,13 @@
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<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">
<property name="text">
<string>Field of View</string>
</property>
</widget>
</item>
<item row="1" column="1">
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="fieldOfView">
<property name="minimum">
<double>1.000000000000000</double>
......@@ -660,8 +639,8 @@
<property name="title">
<string>Viewer Specific Settings</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_19">
<item>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0" rowspan="2">
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<widget class="QLabel" name="label_17">
......@@ -697,14 +676,14 @@
</item>
</layout>
</item>
<item>
<item row="0" column="1" rowspan="2">
<widget class="Line" name="line_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<item row="0" column="2" rowspan="2">
<layout class="QVBoxLayout" name="verticalLayout_9">
<item>
<widget class="QLabel" name="label_7">
......@@ -731,6 +710,35 @@ You can select multiple modes at the same time.</string>
</property>
</widget>
</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>
<layout class="QFormLayout" name="formLayout_3">
<item row="1" column="0">
......@@ -783,6 +791,19 @@ You can select multiple modes at the same time.</string>
</item>
</layout>
</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>
</widget>
</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