~ubuntu-branches/ubuntu/precise/fritzing/precise

« back to all changes in this revision

Viewing changes to src/sketch/zoomablegraphicsview.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Georges Khaznadar
  • Date: 2011-08-26 10:11:05 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20110826101105-w5hmn7zcf93ig5v6
Tags: 0.6.3b-1
* upgrapded to the newer upstream version
* parameters of the function GraphicsUtils::distanceFromLine in 
  src/svg/groundplanegenerator.cpp:767 are now declared as doubles,
  which Closes: #636441
* the new version fixes src/utils/folderutils.cpp, which
  Closes: #636061

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
********************************************************************
20
20
 
21
 
$Revision: 5143 $:
 
21
$Revision: 5404 $:
22
22
$Author: cohen@irascible.com $:
23
 
$Date: 2011-07-01 02:37:01 +0200 (Fri, 01 Jul 2011) $
 
23
$Date: 2011-08-17 07:18:44 +0200 (Wed, 17 Aug 2011) $
24
24
 
25
25
********************************************************************/
26
26
 
30
30
 
31
31
#include "zoomablegraphicsview.h"
32
32
#include "../utils/zoomslider.h"
33
 
 
 
33
#include "../utils/misc.h"
34
34
 
35
35
 
36
36
ZoomableGraphicsView::WheelMapping ZoomableGraphicsView::m_wheelMapping =
70
70
        bool doVertical = false;
71
71
 
72
72
        bool control = event->modifiers() & Qt::ControlModifier;
73
 
        bool alt = event->modifiers() & Qt::AltModifier;
 
73
        bool alt = event->modifiers() & altOrMetaModifier();
74
74
        bool shift = event->modifiers() & Qt::ShiftModifier;
75
75
 
76
76
        switch (m_wheelMapping) {
114
114
 
115
115
        int numSteps = event->delta() / 8;
116
116
        if (doZoom) {
117
 
                qreal delta = ((qreal) event->delta() / 120) * ZoomSlider::ZoomStep;
 
117
                double delta = ((double) event->delta() / 120) * ZoomSlider::ZoomStep;
118
118
                if (delta == 0) return;
119
119
 
120
120
                // Scroll zooming relative to the current size
130
130
        }
131
131
}
132
132
 
133
 
void ZoomableGraphicsView::relativeZoom(qreal step, bool centerOnCursor) {
134
 
        qreal tempSize = m_scaleValue + step;
 
133
void ZoomableGraphicsView::relativeZoom(double step, bool centerOnCursor) {
 
134
        double tempSize = m_scaleValue + step;
135
135
        if (tempSize < m_minScaleValue) {
136
136
                m_scaleValue = m_minScaleValue;
137
137
                emit zoomOutOfRange(m_scaleValue);
142
142
                emit zoomOutOfRange(m_scaleValue);
143
143
                return;
144
144
        }
145
 
        qreal tempScaleValue = tempSize/100;
 
145
        double tempScaleValue = tempSize/100;
146
146
 
147
147
        m_scaleValue = tempSize;
148
148
 
164
164
        emit zoomChanged(m_scaleValue);
165
165
}
166
166
 
167
 
void ZoomableGraphicsView::absoluteZoom(qreal percent) {
 
167
void ZoomableGraphicsView::absoluteZoom(double percent) {
168
168
        relativeZoom(percent-m_scaleValue, false);
169
169
}
170
170
 
171
 
qreal ZoomableGraphicsView::currentZoom() {
 
171
double ZoomableGraphicsView::currentZoom() {
172
172
        return m_scaleValue;
173
173
}
174
174