comparison layer/FlexiNoteLayer.cpp @ 1077:5144d7185fb5 spectrogram-minor-refactor

Move LayerGeometryProvider from view to layer
author Chris Cannam
date Thu, 30 Jun 2016 10:59:11 +0100
parents 8bf05426d950
children ee01a4062747
comparison
equal deleted inserted replaced
1076:e536dfc6b250 1077:5144d7185fb5
21 #include "base/Profiler.h" 21 #include "base/Profiler.h"
22 #include "base/Pitch.h" 22 #include "base/Pitch.h"
23 #include "base/LogRange.h" 23 #include "base/LogRange.h"
24 #include "base/RangeMapper.h" 24 #include "base/RangeMapper.h"
25 #include "ColourDatabase.h" 25 #include "ColourDatabase.h"
26 #include "view/View.h" 26 #include "LayerGeometryProvider.h"
27 27
28 #include "PianoScale.h" 28 #include "PianoScale.h"
29 #include "LinearNumericalScale.h" 29 #include "LinearNumericalScale.h"
30 #include "LogNumericalScale.h" 30 #include "LogNumericalScale.h"
31 31
32 #include "data/model/FlexiNoteModel.h" 32 #include "data/model/FlexiNoteModel.h"
33
34 #include "view/View.h"
33 35
34 #include "widgets/ItemEditDialog.h" 36 #include "widgets/ItemEditDialog.h"
35 #include "widgets/TextAbbrev.h" 37 #include "widgets/TextAbbrev.h"
36 38
37 #include <QPainter> 39 #include <QPainter>
869 QString vlabel = QString("freq: %1%2").arg(p.value).arg(m_model->getScaleUnits()); 871 QString vlabel = QString("freq: %1%2").arg(p.value).arg(m_model->getScaleUnits());
870 // v->drawVisibleText(paint, 872 // v->drawVisibleText(paint,
871 // x - paint.fontMetrics().width(vlabel) - 2, 873 // x - paint.fontMetrics().width(vlabel) - 2,
872 // y + paint.fontMetrics().height()/2 874 // y + paint.fontMetrics().height()/2
873 // - paint.fontMetrics().descent(), 875 // - paint.fontMetrics().descent(),
874 // vlabel, View::OutlinedText); 876 // vlabel, LayerGeometryProvider::OutlinedText);
875 v->drawVisibleText(paint, 877 v->drawVisibleText(paint,
876 x, 878 x,
877 y - h/2 - 2 - paint.fontMetrics().height() 879 y - h/2 - 2 - paint.fontMetrics().height()
878 - paint.fontMetrics().descent(), 880 - paint.fontMetrics().descent(),
879 vlabel, View::OutlinedText); 881 vlabel, LayerGeometryProvider::OutlinedText);
880 882
881 QString hlabel = "dur: " + QString(RealTime::frame2RealTime 883 QString hlabel = "dur: " + QString(RealTime::frame2RealTime
882 (p.duration, m_model->getSampleRate()).toText(true).c_str()); 884 (p.duration, m_model->getSampleRate()).toText(true).c_str());
883 v->drawVisibleText(paint, 885 v->drawVisibleText(paint,
884 x, 886 x,
885 y - h/2 - paint.fontMetrics().descent() - 2, 887 y - h/2 - paint.fontMetrics().descent() - 2,
886 hlabel, View::OutlinedText); 888 hlabel, LayerGeometryProvider::OutlinedText);
887 889
888 QString llabel = QString("%1").arg(p.label); 890 QString llabel = QString("%1").arg(p.label);
889 v->drawVisibleText(paint, 891 v->drawVisibleText(paint,
890 x, 892 x,
891 y + h + 2 + paint.fontMetrics().descent(), 893 y + h + 2 + paint.fontMetrics().descent(),
892 llabel, View::OutlinedText); 894 llabel, LayerGeometryProvider::OutlinedText);
893 QString nlabel = QString("%1").arg(noteNumber); 895 QString nlabel = QString("%1").arg(noteNumber);
894 v->drawVisibleText(paint, 896 v->drawVisibleText(paint,
895 x + paint.fontMetrics().averageCharWidth() / 2, 897 x + paint.fontMetrics().averageCharWidth() / 2,
896 y + h/2 - paint.fontMetrics().descent(), 898 y + h/2 - paint.fontMetrics().descent(),
897 nlabel, View::OutlinedText); 899 nlabel, LayerGeometryProvider::OutlinedText);
898 } 900 }
899 901
900 paint.drawRect(x, y - h/2, w, h); 902 paint.drawRect(x, y - h/2, w, h);
901 } 903 }
902 904