Mercurial > hg > svgui
diff view/Overview.cpp @ 922:26da827e8fb5 tonioni
Merge from cxx11 branch
author | Chris Cannam |
---|---|
date | Mon, 23 Mar 2015 11:26:28 +0000 |
parents | 2857e6352b06 4a578a360011 |
children | 1c529a22a6a7 |
line wrap: on
line diff
--- a/view/Overview.cpp Mon Mar 23 10:04:51 2015 +0000 +++ b/view/Overview.cpp Mon Mar 23 11:26:28 2015 +0000 @@ -38,12 +38,12 @@ } void -Overview::modelChangedWithin(int startFrame, int endFrame) +Overview::modelChangedWithin(sv_frame_t startFrame, sv_frame_t endFrame) { bool zoomChanged = false; - int frameCount = getModelsEndFrame() - getModelsStartFrame(); - int zoomLevel = frameCount / width(); + sv_frame_t frameCount = getModelsEndFrame() - getModelsStartFrame(); + int zoomLevel = int(frameCount / width()); if (zoomLevel < 1) zoomLevel = 1; zoomLevel = getZoomConstraintBlockSize(zoomLevel, ZoomConstraint::RoundUp); @@ -91,7 +91,7 @@ } void -Overview::globalCentreFrameChanged(int +Overview::globalCentreFrameChanged(sv_frame_t #ifdef DEBUG_OVERVIEW f #endif @@ -104,7 +104,7 @@ } void -Overview::viewCentreFrameChanged(View *v, int +Overview::viewCentreFrameChanged(View *v, sv_frame_t #ifdef DEBUG_OVERVIEW f #endif @@ -128,7 +128,7 @@ } void -Overview::viewManagerPlaybackFrameChanged(int f) +Overview::viewManagerPlaybackFrameChanged(sv_frame_t f) { #ifdef DEBUG_OVERVIEW cerr << "Overview[" << this << "]::viewManagerPlaybackFrameChanged(" << f << "): " << f << endl; @@ -167,9 +167,9 @@ cerr << "Overview::paintEvent: width is " << width() << ", centre frame " << m_centreFrame << endl; #endif - int startFrame = getModelsStartFrame(); - int frameCount = getModelsEndFrame() - getModelsStartFrame(); - int zoomLevel = frameCount / width(); + sv_frame_t startFrame = getModelsStartFrame(); + sv_frame_t frameCount = getModelsEndFrame() - getModelsStartFrame(); + int zoomLevel = int(frameCount / width()); if (zoomLevel < 1) zoomLevel = 1; zoomLevel = getZoomConstraintBlockSize(zoomLevel, ZoomConstraint::RoundUp); @@ -178,7 +178,7 @@ emit zoomLevelChanged(m_zoomLevel, m_followZoom); } - int centreFrame = startFrame + m_zoomLevel * (width() / 2); + sv_frame_t centreFrame = startFrame + m_zoomLevel * (width() / 2); if (centreFrame > (startFrame + getModelsEndFrame())/2) { centreFrame = (startFrame + getModelsEndFrame())/2; } @@ -214,21 +214,21 @@ QRect primary; int y = 0; - + for (ViewSet::iterator i = m_views.begin(); i != m_views.end(); ++i) { if (!*i) continue; View *w = (View *)*i; - int f0 = w->getFrameForX(0); - int f1 = w->getFrameForX(w->width()); + sv_frame_t f0 = w->getFrameForX(0); + sv_frame_t f1 = w->getFrameForX(w->width()); if (f0 >= 0) { - int rf0 = w->alignToReference(f0); + sv_frame_t rf0 = w->alignToReference(f0); f0 = alignFromReference(rf0); } if (f1 >= 0) { - int rf1 = w->alignToReference(f1); + sv_frame_t rf1 = w->alignToReference(f1); f1 = alignFromReference(rf1); } @@ -273,7 +273,7 @@ Overview::mousePressEvent(QMouseEvent *e) { m_clickPos = e->pos(); - int clickFrame = getFrameForX(m_clickPos.x()); + sv_frame_t clickFrame = getFrameForX(m_clickPos.x()); if (clickFrame > 0) m_dragCentreFrame = clickFrame; else m_dragCentreFrame = 0; m_clickedInRange = true; @@ -301,12 +301,12 @@ if (!m_clickedInRange) return; int xoff = int(e->x()) - int(m_clickPos.x()); - int frameOff = xoff * m_zoomLevel; + sv_frame_t frameOff = xoff * m_zoomLevel; - int newCentreFrame = m_dragCentreFrame; + sv_frame_t newCentreFrame = m_dragCentreFrame; if (frameOff > 0) { newCentreFrame += frameOff; - } else if (newCentreFrame >= int(-frameOff)) { + } else if (newCentreFrame >= -frameOff) { newCentreFrame += frameOff; } else { newCentreFrame = 0; @@ -318,8 +318,8 @@ } if (std::max(m_centreFrame, newCentreFrame) - - std::min(m_centreFrame, newCentreFrame) > int(m_zoomLevel)) { - int rf = alignToReference(newCentreFrame); + std::min(m_centreFrame, newCentreFrame) > m_zoomLevel) { + sv_frame_t rf = alignToReference(newCentreFrame); #ifdef DEBUG_OVERVIEW cerr << "Overview::mouseMoveEvent: x " << e->x() << " and click x " << m_clickPos.x() << " -> frame " << newCentreFrame << " -> rf " << rf << endl; #endif @@ -335,8 +335,8 @@ void Overview::mouseDoubleClickEvent(QMouseEvent *e) { - int frame = getFrameForX(e->x()); - int rf = 0; + sv_frame_t frame = getFrameForX(e->x()); + sv_frame_t rf = 0; if (frame > 0) rf = alignToReference(frame); #ifdef DEBUG_OVERVIEW cerr << "Overview::mouseDoubleClickEvent: frame " << frame << " -> rf " << rf << endl;