Commit c971e415 authored by Jan Möbius's avatar Jan Möbius

Moved wheel zoom factors to viewproperties

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@4525 383ad7c9-94d9-4d36-a494-682f7c89f535
parent ffb49205
......@@ -434,8 +434,8 @@ void Core::writeApplicationOptions(INIFile& _ini) {
_ini.add_entry("Options","Animation",PluginFunctions::viewerProperties().animation());
_ini.add_entry("Options","twoSidedLighting",PluginFunctions::viewerProperties().twoSidedLighting());
_ini.add_entry("Options","WheelZoomFactor",coreWidget_->examiner_widgets_[0]->wheelZoomFactor());
_ini.add_entry("Options","WheelZoomFactorShift",coreWidget_->examiner_widgets_[0]->wheelZoomFactorShift());
_ini.add_entry("Options","WheelZoomFactor",PluginFunctions::viewerProperties().wheelZoomFactor());
_ini.add_entry("Options","WheelZoomFactorShift",PluginFunctions::viewerProperties().wheelZoomFactorShift());
//============================================================================
// Save the current draw modes
......
......@@ -96,8 +96,8 @@ void Core::applyOptions(){
PluginFunctions::viewerProperties(i).backFaceCulling(OpenFlipper::Options::backfaceCulling());
//wheel zoom factor
coreWidget_->examiner_widgets_[i]->setWheelZoomFactor(OpenFlipper::Options::wheelZoomFactor());
coreWidget_->examiner_widgets_[i]->setWheelZoomFactorShift(OpenFlipper::Options::wheelZoomFactorShift());
PluginFunctions::viewerProperties().wheelZoomFactor(OpenFlipper::Options::wheelZoomFactor());
PluginFunctions::viewerProperties().wheelZoomFactorShift(OpenFlipper::Options::wheelZoomFactorShift());
// Picking Debugger
PluginFunctions::viewerProperties(i).renderPicking(OpenFlipper::Options::renderPicking(), target );
......
......@@ -49,6 +49,8 @@ namespace Viewer {
lastActionMode_(Viewer::PickingMode),
snapshotName_("snap.png"),
snapshotCounter_(0),
wZoomFactor_(1.0),
wZoomFactorShift_(0.2),
CCWFront_(true),
backgroundColor_(0.0f,0.0f,0.0f,0.0f),
renderPicking_(false),
......
......@@ -138,6 +138,34 @@ namespace Viewer {
/** @} */
//===========================================================================
//===========================================================================
/** @name Mouse Wheel Settings
* @{ */
//===========================================================================
//===========================================================================
public slots:
/// Zoom factor when using mousewheel
double wheelZoomFactor() { return wZoomFactor_; };
/// Zoom factor when using mousewheel and pressing shift
double wheelZoomFactorShift() { return wZoomFactorShift_; };
/// Set zoom factor when using mousewheel
void wheelZoomFactor(double _factor) { wZoomFactor_ = _factor; };
/// Set zoom factor when using mousewheel and pressing shift
void wheelZoomFactorShift(double _factor) { wZoomFactorShift_ = _factor; }; ;
private:
double wZoomFactor_;
double wZoomFactorShift_;
/** @} */
//===========================================================================
//===========================================================================
/** @name Rendering Settings
......@@ -268,6 +296,7 @@ namespace Viewer {
private:
bool animation_;
//===========================================================================
public:
......
......@@ -186,9 +186,6 @@ glViewer::glViewer( QWidget* _parent,
allowRotation_ = true;
//default wheel zoom factors
wZoomFactor_ = 1.0;
wZoomFactorShift_ = 0.2;
connect( &properties_,SIGNAL(updated()), this, SLOT( slotPropertiesUpdated() ) );
connect( &properties_,SIGNAL(actionModeChanged(Viewer::ActionMode)), this, SLOT( updateActionMode(Viewer::ActionMode) ) );
......@@ -1746,7 +1743,7 @@ glViewer::viewMouseEvent(QMouseEvent* _event)
double factor = 1.0;
if (_event->modifiers() == Qt::ShiftModifier)
factor = wZoomFactorShift_;
factor = properties_.wheelZoomFactorShift();
// mouse button should be pressed
if (_event->buttons() & (Qt::LeftButton | Qt::MidButton))
......@@ -1924,36 +1921,12 @@ glViewer::lightMouseEvent(QMouseEvent* _event)
//-----------------------------------------------------------------------------
double glViewer::wheelZoomFactor(){
return wZoomFactor_;
}
//-----------------------------------------------------------------------------
double glViewer::wheelZoomFactorShift(){
return wZoomFactorShift_;
}
//-----------------------------------------------------------------------------
void glViewer::setWheelZoomFactor(double _factor){
wZoomFactor_ = _factor;
}
//-----------------------------------------------------------------------------
void glViewer::setWheelZoomFactorShift(double _factor){
wZoomFactorShift_ = _factor;
}
//-----------------------------------------------------------------------------
void glViewer::viewWheelEvent( QWheelEvent* _event)
{
double factor = wZoomFactor_;
double factor = properties_.wheelZoomFactor();
if (_event->modifiers() == Qt::ShiftModifier)
factor = wZoomFactorShift_;
factor = properties_.wheelZoomFactorShift();
switch (projectionMode())
{
......@@ -2042,16 +2015,12 @@ void glViewer::applyProperties() {
else
glDisable( GL_CULL_FACE );
}
void glViewer::slotPropertiesUpdated() {
std::cerr << "Properties updated" << std::endl;
makeCurrent();
applyProperties();
updateGL();
}
......
......@@ -860,17 +860,6 @@ private:
void allowRotation( bool _mode ) { allowRotation_ = _mode; };
/// Factors for zooming with the wheel
public:
double wheelZoomFactor();
double wheelZoomFactorShift();
void setWheelZoomFactor(double _factor);
void setWheelZoomFactorShift(double _factor);
private:
double wZoomFactor_;
double wZoomFactorShift_;
private slots:
void slotAnimation();
......
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