Commit 8a9192b1 authored by Jan Möbius's avatar Jan Möbius

Added option to invert mouse wheel direction

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@17108 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 6646578c
......@@ -129,6 +129,7 @@ void Core::applyOptions(){
//wheel zoom factor
PluginFunctions::viewerProperties(i).wheelZoomFactor( OpenFlipperSettings().value("Core/Mouse/Wheel/ZoomFactor",1).toDouble() );
PluginFunctions::viewerProperties(i).wheelZoomFactorShift( OpenFlipperSettings().value("Core/Mouse/Wheel/ZoomFactorShift",0.2).toDouble() );
PluginFunctions::viewerProperties(i).wheelInvert( OpenFlipperSettings().value("Core/Mouse/Wheel/Invert",false).toBool() );
}
//hideToolbox
......
......@@ -900,6 +900,8 @@ bool initializeSettings() {
if ( ! settings_->contains("Core/Mouse/Wheel/ZoomFactorShift") )
settings_->setValue("Core/Mouse/Wheel/ZoomFactorShift",0.2);
if ( ! settings_->contains("Core/Mouse/Wheel/Invert") )
settings_->setValue("Core/Mouse/Wheel/Invert",false);
// General Stereo Settings
if ( ! settings_->contains("Core/Stereo/FocalLength") )
......
......@@ -136,6 +136,7 @@
* <b>Mouse Controls</b>\n
* * Core/Mouse/Wheel/ZoomFactor Zoom factor used when turning the mouse wheel (double)\n
* * Core/Mouse/Wheel/ZoomFactorShift Zoom factor used when turning the mouse wheel while shift is pressed (makes zoom slower while shift is pressed) (double)\n
* * Core/Mouse/Wheel/Invert Invert mouse wheel zoom direction (bool)\n
*
* <b>General Stereo Settings</b>\n
* * Core/Stereo/EyeDistance Distance between eyes. Defaults to 7 cm (double)\n
......
......@@ -63,6 +63,7 @@ namespace Viewer {
snapshotCounter_(0),
wZoomFactor_(1.0),
wZoomFactorShift_(0.2),
wInvert_(false),
CCWFront_(true),
backgroundColor_(0.0f,0.0f,0.0f,1.0f),
locked_(0),
......
......@@ -184,23 +184,31 @@ namespace Viewer {
public slots:
/// Zoom factor when using mousewheel
/// Zoom factor when using mouse wheel
double wheelZoomFactor() { return wZoomFactor_; };
/// Zoom factor when using mousewheel and pressing shift
/// Zoom factor when using mouse wheel and pressing shift
double wheelZoomFactorShift() { return wZoomFactorShift_; };
/// Set zoom factor when using mousewheel
/// Set zoom factor when using mouse wheel
void wheelZoomFactor(double _factor) { wZoomFactor_ = _factor; };
/// Set zoom factor when using mousewheel and pressing shift
void wheelZoomFactorShift(double _factor) { wZoomFactorShift_ = _factor; };
/// Set zoom factor when using mouse wheel and pressing shift
void wheelZoomFactorShift(double _factor) { wZoomFactorShift_ = _factor; };
/// Invert mouse wheel direction?
bool wheelInvert() { return wInvert_; };
/// Invert mouse wheel direction
void wheelInvert(bool _invert) { wInvert_ = _invert; };
private:
double wZoomFactor_;
double wZoomFactorShift_;
bool wInvert_;
/** @} */
//===========================================================================
......
......@@ -1878,11 +1878,18 @@ void glViewer::handleNormalNavigation( QMouseEvent* _event ) {
void glViewer::viewWheelEvent( QWheelEvent* _event)
{
// Default mouse wheel factor
double factor = properties_.wheelZoomFactor();
// Shift pressed, so we use the smaller factor
if (_event->modifiers() == Qt::ShiftModifier)
factor = properties_.wheelZoomFactorShift();
// Mouse wheel inversion
if (properties_.wheelInvert())
factor *= -1.0;
if (projectionMode() == PERSPECTIVE_PROJECTION )
{
......
......@@ -352,6 +352,7 @@ void OptionsWidget::showEvent ( QShowEvent * /*event*/ ) {
//Init Viewer Settings
wZoomFactor->setValue( OpenFlipperSettings().value("Core/Mouse/Wheel/ZoomFactor").toDouble() );
wZoomFactorShift->setValue( OpenFlipperSettings().value("Core/Mouse/Wheel/ZoomFactorShift").toDouble() );
invertMouseWheelBox->setChecked( OpenFlipperSettings().value("Core/Mouse/Wheel/Invert").toBool() );
wheelBox->setChecked( OpenFlipperSettings().value("Core/Gui/glViewer/showControlWheels").toBool() );
......@@ -594,7 +595,8 @@ void OptionsWidget::slotApply() {
//viewer
OpenFlipperSettings().setValue("Core/Mouse/Wheel/ZoomFactor", wZoomFactor->text().toDouble());
OpenFlipperSettings().setValue("Core/Mouse/Wheel/ZoomFactorShift", wZoomFactorShift->text().toDouble());
OpenFlipperSettings().setValue("Core/Mouse/Wheel/Invert", invertMouseWheelBox->isChecked());
// Projection settings
OpenFlipperSettings().setValue("Core/Projection/FOVY", fieldOfView->value());
OpenFlipperSettings().setValue("Core/Gui/glViewer/minimalSceneSize",minimalSceneSize->value());
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>700</width>
<height>599</height>
<width>699</width>
<height>700</height>
</rect>
</property>
<property name="windowTitle">
......@@ -36,8 +36,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>671</width>
<height>866</height>
<width>670</width>
<height>888</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
......@@ -50,7 +50,7 @@
<string/>
</property>
<property name="currentIndex">
<number>0</number>
<number>2</number>
</property>
<property name="usesScrollButtons">
<bool>true</bool>
......@@ -400,73 +400,120 @@
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_8">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string> Mouse Wheel </string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="flat">
<bool>false</bool>
</property>
<property name="checkable">
<bool>false</bool>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>MouseWheel Zoom Sensitivity:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="wZoomFactor">
<property name="maximumSize">
<size>
<width>70</width>
<height>16777215</height>
</size>
</property>
<property name="maximum">
<double>10.000000000000000</double>
</property>
<property name="singleStep">
<double>0.200000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>MouseWheel Zoom Sensitivity (shift):</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QDoubleSpinBox" name="wZoomFactorShift">
<property name="maximumSize">
<size>
<width>70</width>
<height>16777215</height>
</size>
<layout class="QVBoxLayout" name="verticalLayout_25">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string> Mouse Wheel </string>
</property>
<property name="maximum">
<double>5.000000000000000</double>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
<property name="flat">
<bool>false</bool>
</property>
<property name="value">
<double>0.200000000000000</double>
<property name="checkable">
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_26">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_25">
<item>
<widget class="QFrame" name="frame_2">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QFormLayout" name="formLayout_2">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>MouseWheel Zoom Sensitivity:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="wZoomFactor">
<property name="maximumSize">
<size>
<width>70</width>
<height>16777215</height>
</size>
</property>
<property name="maximum">
<double>10.000000000000000</double>
</property>
<property name="singleStep">
<double>0.200000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>MouseWheel Zoom Sensitivity (shift):</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="wZoomFactorShift">
<property name="maximumSize">
<size>
<width>70</width>
<height>16777215</height>
</size>
</property>
<property name="maximum">
<double>5.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="value">
<double>0.200000000000000</double>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QFrame" name="frame_3">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="1">
<widget class="QCheckBox" name="invertMouseWheelBox">
<property name="text">
<string>Invert mouse wheel</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
......
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