diff view/ViewManager.cpp @ 944:78c152e4db95

Merge from branch tonioni
author Chris Cannam
date Mon, 20 Apr 2015 09:12:17 +0100
parents b48db6f1a7d2
children 36cddc3de023 4d54882bbf73
line wrap: on
line diff
--- a/view/ViewManager.cpp	Thu Jan 15 10:42:00 2015 +0000
+++ b/view/ViewManager.cpp	Mon Apr 20 09:12:17 2015 +0100
@@ -126,7 +126,7 @@
 {
 }
 
-int
+sv_frame_t
 ViewManager::getGlobalCentreFrame() const
 {
 #ifdef DEBUG_VIEW_MANAGER
@@ -136,7 +136,7 @@
 }
 
 void
-ViewManager::setGlobalCentreFrame(int f)
+ViewManager::setGlobalCentreFrame(sv_frame_t f)
 {
 #ifdef DEBUG_VIEW_MANAGER
     cerr << "ViewManager::setGlobalCentreFrame to " << f << endl;
@@ -154,7 +154,7 @@
     return m_globalZoom;
 }
 
-int
+sv_frame_t
 ViewManager::getPlaybackFrame() const
 {
     if (m_playSource && m_playSource->isPlaying()) {
@@ -164,7 +164,7 @@
 }
 
 void
-ViewManager::setPlaybackFrame(int f)
+ViewManager::setPlaybackFrame(sv_frame_t f)
 {
     if (m_playbackFrame != f) {
 	m_playbackFrame = f;
@@ -187,8 +187,8 @@
     m_playbackModel = model;
 }
 
-int
-ViewManager::alignPlaybackFrameToReference(int frame) const
+sv_frame_t
+ViewManager::alignPlaybackFrameToReference(sv_frame_t frame) const
 {
 #ifdef DEBUG_VIEW_MANAGER
     cerr << "ViewManager::alignPlaybackFrameToReference(" << frame << "): playback model is " << m_playbackModel << endl;
@@ -196,7 +196,7 @@
     if (!m_playbackModel) {
         return frame;
     } else {
-        int f = m_playbackModel->alignToReference(frame);
+        sv_frame_t f = m_playbackModel->alignToReference(frame);
 #ifdef DEBUG_VIEW_MANAGER
         cerr << "aligned frame = " << f << endl;
 #endif
@@ -204,8 +204,8 @@
     }
 }
 
-int
-ViewManager::alignReferenceToPlaybackFrame(int frame) const
+sv_frame_t
+ViewManager::alignReferenceToPlaybackFrame(sv_frame_t frame) const
 {
 #ifdef DEBUG_VIEW_MANAGER
     cerr << "ViewManager::alignReferenceToPlaybackFrame(" << frame << "): playback model is " << m_playbackModel << endl;
@@ -213,7 +213,7 @@
     if (!m_playbackModel) {
         return frame;
     } else {
-        int f = m_playbackModel->alignFromReference(frame);
+        sv_frame_t f = m_playbackModel->alignFromReference(frame);
 #ifdef DEBUG_VIEW_MANAGER
         cerr << "aligned frame = " << f << endl;
 #endif
@@ -313,8 +313,8 @@
     }
 }
 
-int
-ViewManager::constrainFrameToSelection(int frame) const
+sv_frame_t
+ViewManager::constrainFrameToSelection(sv_frame_t frame) const
 {
     MultiSelection::SelectionList sl = getSelections();
     if (sl.empty()) return frame;
@@ -373,7 +373,7 @@
 }
 
 Selection
-ViewManager::getContainingSelection(int frame, bool defaultToFollowing) const
+ViewManager::getContainingSelection(sv_frame_t frame, bool defaultToFollowing) const
 {
     return m_selections.getContainingSelection(frame, defaultToFollowing);
 }
@@ -478,7 +478,7 @@
     }
 }
 
-int 
+sv_samplerate_t 
 ViewManager::getPlaybackSampleRate() const
 {
     if (m_playSource) {
@@ -487,7 +487,7 @@
     return 0;
 }
 
-int
+sv_samplerate_t
 ViewManager::getOutputSampleRate() const
 {
     if (m_playSource) {
@@ -559,7 +559,7 @@
 }
 
 void
-ViewManager::viewCentreFrameChanged(int f, bool locked,
+ViewManager::viewCentreFrameChanged(sv_frame_t f, bool locked,
                                     PlaybackFollowMode mode)
 {
     View *v = dynamic_cast<View *>(sender());
@@ -590,15 +590,15 @@
 }
 
 void
-ViewManager::seek(int f)
+ViewManager::seek(sv_frame_t f)
 {
 #ifdef DEBUG_VIEW_MANAGER 
     cerr << "ViewManager::seek(" << f << ")" << endl;
 #endif
 
     if (m_playSource && m_playSource->isPlaying()) {
-	int playFrame = m_playSource->getCurrentPlayingFrame();
-	int diff = std::max(f, playFrame) - std::min(f, playFrame);
+	sv_frame_t playFrame = m_playSource->getCurrentPlayingFrame();
+	sv_frame_t diff = std::max(f, playFrame) - std::min(f, playFrame);
 	if (diff > 20000) {
 	    m_playbackFrame = f;
 	    m_playSource->play(f);
@@ -723,20 +723,20 @@
 int
 ViewManager::scalePixelSize(int pixels)
 {
-    static float ratio = 0.f;
-    if (ratio == 0.f) {
-        float baseEm;
+    static double ratio = 0.0;
+    if (ratio == 0.0) {
+        double baseEm;
 #ifdef Q_OS_MAC
-        baseEm = 17.f;
+        baseEm = 17.0;
 #else
-        baseEm = 15.f;
+        baseEm = 15.0;
 #endif
-        float em = QFontMetrics(QFont()).height();
+        double em = QFontMetrics(QFont()).height();
         ratio = em / baseEm;
     }
 
     int scaled = int(pixels * ratio + 0.5);
-    cerr << "scaledSize: " << pixels << " -> " << scaled << " at ratio " << ratio << endl;
+//    cerr << "scaledSize: " << pixels << " -> " << scaled << " at ratio " << ratio << endl;
     if (pixels != 0 && scaled == 0) scaled = 1;
     return scaled;
 }