diff framework/MainWindowBase.cpp @ 435:618d5816b04d cxx11

More type fixes
author Chris Cannam
date Tue, 10 Mar 2015 13:22:10 +0000
parents dee4aceb131c
children 72c662fe7ea3
line wrap: on
line diff
--- a/framework/MainWindowBase.cpp	Wed Mar 04 13:53:13 2015 +0000
+++ b/framework/MainWindowBase.cpp	Tue Mar 10 13:22:10 2015 +0000
@@ -228,14 +228,14 @@
     connect(m_viewManager, SIGNAL(outputLevelsChanged(float, float)),
 	    this, SLOT(outputLevelsChanged(float, float)));
 
-    connect(m_viewManager, SIGNAL(playbackFrameChanged(int)),
-            this, SLOT(playbackFrameChanged(int)));
-
-    connect(m_viewManager, SIGNAL(globalCentreFrameChanged(int)),
-            this, SLOT(globalCentreFrameChanged(int)));
-
-    connect(m_viewManager, SIGNAL(viewCentreFrameChanged(View *, int)),
-            this, SLOT(viewCentreFrameChanged(View *, int)));
+    connect(m_viewManager, SIGNAL(playbackFrameChanged(sv_frame_t)),
+            this, SLOT(playbackFrameChanged(sv_frame_t)));
+
+    connect(m_viewManager, SIGNAL(globalCentreFrameChanged(sv_frame_t)),
+            this, SLOT(globalCentreFrameChanged(sv_frame_t)));
+
+    connect(m_viewManager, SIGNAL(viewCentreFrameChanged(View *, sv_frame_t)),
+            this, SLOT(viewCentreFrameChanged(View *, sv_frame_t)));
 
     connect(m_viewManager, SIGNAL(viewZoomLevelChanged(View *, int, bool)),
             this, SLOT(viewZoomLevelChanged(View *, int, bool)));
@@ -691,7 +691,7 @@
     // frame before switching to whichever one we decide we want to
     // switch to, regardless of our efforts.
 
-    int frame = m_playSource->getCurrentBufferedFrame();
+    sv_frame_t frame = m_playSource->getCurrentBufferedFrame();
 
     cerr << "currentPaneChanged: current frame (in ref model) = " << frame << endl;
 
@@ -780,7 +780,7 @@
     Pane *currentPane = m_paneStack->getCurrentPane();
     if (!currentPane) return;
 
-    int startFrame, endFrame;
+    sv_frame_t startFrame, endFrame;
 
     if (currentPane->getStartFrame() < 0) startFrame = 0;
     else startFrame = currentPane->getStartFrame();
@@ -851,11 +851,11 @@
 void
 MainWindowBase::pasteAtPlaybackPosition()
 {
-    int pos = getFrame();
+    sv_frame_t pos = getFrame();
     Clipboard &clipboard = m_viewManager->getClipboard();
     if (!clipboard.empty()) {
-        int firstEventFrame = clipboard.getPoints()[0].getFrame();
-        int offset = 0;
+        sv_frame_t firstEventFrame = clipboard.getPoints()[0].getFrame();
+        sv_frame_t offset = 0;
         if (firstEventFrame < 0) {
             offset = pos - firstEventFrame;
         } else if (firstEventFrame < pos) {
@@ -868,7 +868,7 @@
 }
 
 void
-MainWindowBase::pasteRelative(int offset)
+MainWindowBase::pasteRelative(sv_frame_t offset)
 {
     Pane *currentPane = m_paneStack->getCurrentPane();
     if (!currentPane) return;
@@ -936,7 +936,7 @@
 
 // FrameTimer method
 
-int
+sv_frame_t
 MainWindowBase::getFrame() const
 {
     if (m_playSource && m_playSource->isPlaying()) {
@@ -958,8 +958,8 @@
     MultiSelection::SelectionList selections = m_viewManager->getSelections();
     for (MultiSelection::SelectionList::iterator i = selections.begin();
          i != selections.end(); ++i) {
-        int start = i->getStartFrame();
-        int end = i->getEndFrame();
+        sv_frame_t start = i->getStartFrame();
+        sv_frame_t end = i->getEndFrame();
         if (start != end) {
             insertInstantAt(start);
             insertInstantAt(end);
@@ -968,7 +968,7 @@
 }
 
 void
-MainWindowBase::insertInstantAt(int frame)
+MainWindowBase::insertInstantAt(sv_frame_t frame)
 {
     Pane *pane = m_paneStack->getCurrentPane();
     if (!pane) {
@@ -1060,8 +1060,8 @@
     MultiSelection::SelectionList selections = m_viewManager->getSelections();
     for (MultiSelection::SelectionList::iterator i = selections.begin();
          i != selections.end(); ++i) {
-        int start = i->getStartFrame();
-        int end = i->getEndFrame();
+        sv_frame_t start = i->getStartFrame();
+        sv_frame_t end = i->getEndFrame();
         if (start < end) {
             insertItemAt(start, end - start);
         }
@@ -1069,7 +1069,7 @@
 }
 
 void
-MainWindowBase::insertItemAt(int frame, int duration)
+MainWindowBase::insertItemAt(sv_frame_t frame, sv_frame_t duration)
 {
     Pane *pane = m_paneStack->getCurrentPane();
     if (!pane) {
@@ -1078,10 +1078,10 @@
 
     // ugh!
 
-    int alignedStart = pane->alignFromReference(frame);
-    int alignedEnd = pane->alignFromReference(frame + duration);
+    sv_frame_t alignedStart = pane->alignFromReference(frame);
+    sv_frame_t alignedEnd = pane->alignFromReference(frame + duration);
     if (alignedStart >= alignedEnd) return;
-    int alignedDuration = alignedEnd - alignedStart;
+    sv_frame_t alignedDuration = alignedEnd - alignedStart;
 
     Command *c = 0;
 
@@ -1281,7 +1281,7 @@
 
     m_openingAudioFile = true;
 
-    int rate = 0;
+    sv_samplerate_t rate = 0;
 
     if (Preferences::getInstance()->getFixedSampleRate() != 0) {
         rate = Preferences::getInstance()->getFixedSampleRate();
@@ -1990,7 +1990,7 @@
 MainWindowBase::FileOpenStatus
 MainWindowBase::openLayersFromRDF(FileSource source)
 {
-    int rate = 0;
+    sv_samplerate_t rate = 0;
 
     SVDEBUG << "MainWindowBase::openLayersFromRDF" << endl;
 
@@ -2609,18 +2609,18 @@
 {
     if (!getMainModel()) return;
 
-    int frame = m_viewManager->getPlaybackFrame();
+    sv_frame_t frame = m_viewManager->getPlaybackFrame();
     ++frame;
 
     Pane *pane = m_paneStack->getCurrentPane();
     Layer *layer = getSnapLayer();
-    int sr = getMainModel()->getSampleRate();
+    sv_samplerate_t sr = getMainModel()->getSampleRate();
 
     if (!layer) {
 
         frame = RealTime::realTime2Frame
             (RealTime::frame2RealTime(frame, sr) + m_defaultFfwdRwdStep, sr);
-        if (frame > int(getMainModel()->getEndFrame())) {
+        if (frame > getMainModel()->getEndFrame()) {
             frame = getMainModel()->getEndFrame();
         }
 
@@ -2639,12 +2639,12 @@
     if (frame < 0) frame = 0;
 
     if (m_viewManager->getPlaySelectionMode()) {
-        frame = m_viewManager->constrainFrameToSelection(int(frame));
+        frame = m_viewManager->constrainFrameToSelection(frame);
     }
     
     m_viewManager->setPlaybackFrame(frame);
 
-    if (frame == (int)getMainModel()->getEndFrame() &&
+    if (frame == getMainModel()->getEndFrame() &&
         m_playSource &&
         m_playSource->isPlaying() &&
         !m_viewManager->getPlayLoopMode()) {
@@ -2663,7 +2663,7 @@
         stop();
     }
 
-    int frame = getMainModel()->getEndFrame();
+    sv_frame_t frame = getMainModel()->getEndFrame();
 
     if (m_viewManager->getPlaySelectionMode()) {
         frame = m_viewManager->constrainFrameToSelection(frame);
@@ -2681,7 +2681,7 @@
     if (!layer) { ffwd(); return; }
 
     Pane *pane = m_paneStack->getCurrentPane();
-    int frame = m_viewManager->getPlaybackFrame();
+    sv_frame_t frame = m_viewManager->getPlaybackFrame();
 
     int resolution = 0;
     if (pane) frame = pane->alignFromReference(frame);
@@ -2695,12 +2695,12 @@
     if (frame < 0) frame = 0;
 
     if (m_viewManager->getPlaySelectionMode()) {
-        frame = m_viewManager->constrainFrameToSelection(int(frame));
+        frame = m_viewManager->constrainFrameToSelection(frame);
     }
     
     m_viewManager->setPlaybackFrame(frame);
 
-    if (frame == (int)getMainModel()->getEndFrame() &&
+    if (frame == getMainModel()->getEndFrame() &&
         m_playSource &&
         m_playSource->isPlaying() &&
         !m_viewManager->getPlayLoopMode()) {
@@ -2713,12 +2713,12 @@
 {
     if (!getMainModel()) return;
 
-    int frame = m_viewManager->getPlaybackFrame();
+    sv_frame_t frame = m_viewManager->getPlaybackFrame();
     if (frame > 0) --frame;
 
     Pane *pane = m_paneStack->getCurrentPane();
     Layer *layer = getSnapLayer();
-    int sr = getMainModel()->getSampleRate();
+    sv_samplerate_t sr = getMainModel()->getSampleRate();
     
     // when rewinding during playback, we want to allow a period
     // following a rewind target point at which the rewind will go to
@@ -2734,7 +2734,7 @@
         
         frame = RealTime::realTime2Frame
             (RealTime::frame2RealTime(frame, sr) - m_defaultFfwdRwdStep, sr);
-        if (frame < int(getMainModel()->getStartFrame())) {
+        if (frame < getMainModel()->getStartFrame()) {
             frame = getMainModel()->getStartFrame();
         }
 
@@ -2753,7 +2753,7 @@
     if (frame < 0) frame = 0;
 
     if (m_viewManager->getPlaySelectionMode()) {
-        frame = m_viewManager->constrainFrameToSelection(int(frame));
+        frame = m_viewManager->constrainFrameToSelection(frame);
     }
 
     m_viewManager->setPlaybackFrame(frame);
@@ -2764,7 +2764,7 @@
 {
     if (!getMainModel()) return;
 
-    int frame = getMainModel()->getStartFrame();
+    sv_frame_t frame = getMainModel()->getStartFrame();
 
     if (m_viewManager->getPlaySelectionMode()) {
         frame = m_viewManager->constrainFrameToSelection(frame);
@@ -2782,7 +2782,7 @@
     if (!layer) { rewind(); return; }
 
     Pane *pane = m_paneStack->getCurrentPane();
-    int frame = m_viewManager->getPlaybackFrame();
+    sv_frame_t frame = m_viewManager->getPlaybackFrame();
 
     int resolution = 0;
     if (pane) frame = pane->alignFromReference(frame);
@@ -2796,7 +2796,7 @@
     if (frame < 0) frame = 0;
 
     if (m_viewManager->getPlaySelectionMode()) {
-        frame = m_viewManager->constrainFrameToSelection(int(frame));
+        frame = m_viewManager->constrainFrameToSelection(frame);
     }
     
     m_viewManager->setPlaybackFrame(frame);
@@ -3009,24 +3009,24 @@
 MainWindowBase::connectLayerEditDialog(ModelDataTableDialog *dialog)
 {
     connect(m_viewManager,
-            SIGNAL(globalCentreFrameChanged(int)),
+            SIGNAL(globalCentreFrameChanged(sv_frame_t)),
             dialog,
-            SLOT(userScrolledToFrame(int)));
+            SLOT(userScrolledToFrame(sv_frame_t)));
 
     connect(m_viewManager,
-            SIGNAL(playbackFrameChanged(int)),
+            SIGNAL(playbackFrameChanged(sv_frame_t)),
             dialog,
-            SLOT(playbackScrolledToFrame(int)));
+            SLOT(playbackScrolledToFrame(sv_frame_t)));
 
     connect(dialog,
-            SIGNAL(scrollToFrame(int)),
+            SIGNAL(scrollToFrame(sv_frame_t)),
             m_viewManager,
-            SLOT(setGlobalCentreFrame(int)));
+            SLOT(setGlobalCentreFrame(sv_frame_t)));
 
     connect(dialog,
-            SIGNAL(scrollToFrame(int)),
+            SIGNAL(scrollToFrame(sv_frame_t)),
             m_viewManager,
-            SLOT(setPlaybackFrame(int)));
+            SLOT(setPlaybackFrame(sv_frame_t)));
 }    
 
 void
@@ -3136,7 +3136,7 @@
 }
 
 void
-MainWindowBase::playbackFrameChanged(int frame)
+MainWindowBase::playbackFrameChanged(sv_frame_t frame)
 {
     if (!(m_playSource && m_playSource->isPlaying()) || !getMainModel()) return;
 
@@ -3172,7 +3172,7 @@
 }
 
 void
-MainWindowBase::globalCentreFrameChanged(int )
+MainWindowBase::globalCentreFrameChanged(sv_frame_t )
 {
     if ((m_playSource && m_playSource->isPlaying()) || !getMainModel()) return;
     Pane *p = 0;
@@ -3182,7 +3182,7 @@
 }
 
 void
-MainWindowBase::viewCentreFrameChanged(View *v, int frame)
+MainWindowBase::viewCentreFrameChanged(View *v, sv_frame_t frame)
 {
 //    SVDEBUG << "MainWindowBase::viewCentreFrameChanged(" << v << "," << frame << ")" << endl;