comparison layer/SpectrogramLayer.cpp @ 806:4c8ca536b54f warnfix_no_size_t

Some more unsigned/long removal
author Chris Cannam
date Tue, 17 Jun 2014 15:36:56 +0100
parents 1d526ba11a24
children 856dbe997dcd
comparison
equal deleted inserted replaced
805:1d526ba11a24 806:4c8ca536b54f
139 if (!m_model || !m_model->isOK()) return; 139 if (!m_model || !m_model->isOK()) return;
140 140
141 connectSignals(m_model); 141 connectSignals(m_model);
142 142
143 connect(m_model, SIGNAL(modelChanged()), this, SLOT(cacheInvalid())); 143 connect(m_model, SIGNAL(modelChanged()), this, SLOT(cacheInvalid()));
144 connect(m_model, SIGNAL(modelChanged(int, int)), 144 connect(m_model, SIGNAL(modelChangedWithin(int, int)),
145 this, SLOT(cacheInvalid(int, int))); 145 this, SLOT(cacheInvalid(int, int)));
146 146
147 emit modelReplaced(); 147 emit modelReplaced();
148 } 148 }
149 149
590 << i->second.validArea.y() << " " 590 << i->second.validArea.y() << " "
591 << i->second.validArea.width() << "x" 591 << i->second.validArea.width() << "x"
592 << i->second.validArea.height() << endl; 592 << i->second.validArea.height() << endl;
593 #endif 593 #endif
594 594
595 if (long(startFrame) > v->getStartFrame()) { 595 if (int(startFrame) > v->getStartFrame()) {
596 if (startFrame >= v->getEndFrame()) { 596 if (startFrame >= v->getEndFrame()) {
597 #ifdef DEBUG_SPECTROGRAM_REPAINT 597 #ifdef DEBUG_SPECTROGRAM_REPAINT
598 cerr << "Modified start frame is off right of view" << endl; 598 cerr << "Modified start frame is off right of view" << endl;
599 #endif 599 #endif
600 return; 600 return;
608 QRect(0, 0, x-1, v->height()); 608 QRect(0, 0, x-1, v->height());
609 } else { 609 } else {
610 i->second.validArea = QRect(); 610 i->second.validArea = QRect();
611 } 611 }
612 } else { 612 } else {
613 if (long(endFrame) < v->getStartFrame()) { 613 if (int(endFrame) < v->getStartFrame()) {
614 #ifdef DEBUG_SPECTROGRAM_REPAINT 614 #ifdef DEBUG_SPECTROGRAM_REPAINT
615 cerr << "Modified end frame is off left of view" << endl; 615 cerr << "Modified end frame is off left of view" << endl;
616 #endif 616 #endif
617 return; 617 return;
618 } 618 }
1098 cerr << "SpectrogramLayer: emitting modelChanged(" 1098 cerr << "SpectrogramLayer: emitting modelChanged("
1099 << lastFill << "," << fill << ")" << endl; 1099 << lastFill << "," << fill << ")" << endl;
1100 #endif 1100 #endif
1101 invalidateImageCaches(lastFill, fill); 1101 invalidateImageCaches(lastFill, fill);
1102 i->second.second = fill; 1102 i->second.second = fill;
1103 emit modelChanged(lastFill, fill); 1103 emit modelChangedWithin(lastFill, fill);
1104 } 1104 }
1105 } else { 1105 } else {
1106 #ifdef DEBUG_SPECTROGRAM_REPAINT 1106 #ifdef DEBUG_SPECTROGRAM_REPAINT
1107 cerr << "SpectrogramLayer: going backwards, emitting modelChanged(" 1107 cerr << "SpectrogramLayer: going backwards, emitting modelChanged("
1108 << m_model->getStartFrame() << "," << m_model->getEndFrame() << ")" << endl; 1108 << m_model->getStartFrame() << "," << m_model->getEndFrame() << ")" << endl;
1109 #endif 1109 #endif
1110 invalidateImageCaches(); 1110 invalidateImageCaches();
1111 i->second.second = fill; 1111 i->second.second = fill;
1112 emit modelChanged(m_model->getStartFrame(), m_model->getEndFrame()); 1112 emit modelChangedWithin(m_model->getStartFrame(), m_model->getEndFrame());
1113 } 1113 }
1114 1114
1115 if (i->second.second >= 0) { 1115 if (i->second.second >= 0) {
1116 allDone = false; 1116 allDone = false;
1117 } 1117 }
1778 SVDEBUG << "SpectrogramLayer::paint(): m_model is " << m_model << ", zoom level is " << v->getZoomLevel() << ", m_updateTimer " << m_updateTimer << endl; 1778 SVDEBUG << "SpectrogramLayer::paint(): m_model is " << m_model << ", zoom level is " << v->getZoomLevel() << ", m_updateTimer " << m_updateTimer << endl;
1779 1779
1780 cerr << "rect is " << rect.x() << "," << rect.y() << " " << rect.width() << "x" << rect.height() << endl; 1780 cerr << "rect is " << rect.x() << "," << rect.y() << " " << rect.width() << "x" << rect.height() << endl;
1781 #endif 1781 #endif
1782 1782
1783 long startFrame = v->getStartFrame(); 1783 int startFrame = v->getStartFrame();
1784 if (startFrame < 0) m_candidateFillStartFrame = 0; 1784 if (startFrame < 0) m_candidateFillStartFrame = 0;
1785 else m_candidateFillStartFrame = startFrame; 1785 else m_candidateFillStartFrame = startFrame;
1786 1786
1787 if (!m_model || !m_model->isOK() || !m_model->isReady()) { 1787 if (!m_model || !m_model->isOK() || !m_model->isReady()) {
1788 return; 1788 return;
1794 1794
1795 // Need to do this even if !isLayerDormant, as that could mean v 1795 // Need to do this even if !isLayerDormant, as that could mean v
1796 // is not in the dormancy map at all -- we need it to be present 1796 // is not in the dormancy map at all -- we need it to be present
1797 // and accountable for when determining whether we need the cache 1797 // and accountable for when determining whether we need the cache
1798 // in the cache-fill thread above. 1798 // in the cache-fill thread above.
1799 //!!! no longer use cache-fill thread 1799 //!!! no inter use cache-fill thread
1800 const_cast<SpectrogramLayer *>(this)->Layer::setLayerDormant(v, false); 1800 const_cast<SpectrogramLayer *>(this)->Layer::setLayerDormant(v, false);
1801 1801
1802 int fftSize = getFFTSize(v); 1802 int fftSize = getFFTSize(v);
1803 /* 1803 /*
1804 FFTModel *fft = getFFTModel(v); 1804 FFTModel *fft = getFFTModel(v);
2194 // we draw up to, and one which we subsequently crop at. 2194 // we draw up to, and one which we subsequently crop at.
2195 2195
2196 bool bufferBinResolution = false; 2196 bool bufferBinResolution = false;
2197 if (increment > zoomLevel) bufferBinResolution = true; 2197 if (increment > zoomLevel) bufferBinResolution = true;
2198 2198
2199 long leftBoundaryFrame = -1, leftCropFrame = -1; 2199 int leftBoundaryFrame = -1, leftCropFrame = -1;
2200 long rightBoundaryFrame = -1, rightCropFrame = -1; 2200 int rightBoundaryFrame = -1, rightCropFrame = -1;
2201 2201
2202 int bufwid; 2202 int bufwid;
2203 2203
2204 if (bufferBinResolution) { 2204 if (bufferBinResolution) {
2205 2205
2206 for (int x = x0; ; --x) { 2206 for (int x = x0; ; --x) {
2207 long f = v->getFrameForX(x); 2207 int f = v->getFrameForX(x);
2208 if ((f / increment) * increment == f) { 2208 if ((f / increment) * increment == f) {
2209 if (leftCropFrame == -1) leftCropFrame = f; 2209 if (leftCropFrame == -1) leftCropFrame = f;
2210 else if (x < x0 - 2) { leftBoundaryFrame = f; break; } 2210 else if (x < x0 - 2) { leftBoundaryFrame = f; break; }
2211 } 2211 }
2212 } 2212 }
2213 for (int x = x0 + w; ; ++x) { 2213 for (int x = x0 + w; ; ++x) {
2214 long f = v->getFrameForX(x); 2214 int f = v->getFrameForX(x);
2215 if ((f / increment) * increment == f) { 2215 if ((f / increment) * increment == f) {
2216 if (rightCropFrame == -1) rightCropFrame = f; 2216 if (rightCropFrame == -1) rightCropFrame = f;
2217 else if (x > x0 + w + 2) { rightBoundaryFrame = f; break; } 2217 else if (x > x0 + w + 2) { rightBoundaryFrame = f; break; }
2218 } 2218 }
2219 } 2219 }
3078 cursorPos.y() + paint.fontMetrics().ascent() + 2, 3078 cursorPos.y() + paint.fontMetrics().ascent() + 2,
3079 pitchLabel, 3079 pitchLabel,
3080 View::OutlinedText); 3080 View::OutlinedText);
3081 } 3081 }
3082 3082
3083 long frame = v->getFrameForX(cursorPos.x()); 3083 int frame = v->getFrameForX(cursorPos.x());
3084 RealTime rt = RealTime::frame2RealTime(frame, m_model->getSampleRate()); 3084 RealTime rt = RealTime::frame2RealTime(frame, m_model->getSampleRate());
3085 QString rtLabel = QString("%1 s").arg(rt.toText(true).c_str()); 3085 QString rtLabel = QString("%1 s").arg(rt.toText(true).c_str());
3086 QString frameLabel = QString("%1").arg(frame); 3086 QString frameLabel = QString("%1").arg(frame);
3087 v->drawVisibleText(paint, 3087 v->drawVisibleText(paint,
3088 cursorPos.x() - paint.fontMetrics().width(frameLabel) - 2, 3088 cursorPos.x() - paint.fontMetrics().width(frameLabel) - 2,