comparison layer/FlexiNoteLayer.cpp @ 1146:74f2706995b7 3.0-integration

Merge work on unified spectrogram and colour 3d plot caching renderer
author Chris Cannam
date Fri, 05 Aug 2016 15:05:02 +0100
parents ee01a4062747
children c39f2d439d59
comparison
equal deleted inserted replaced
1056:b4fd6c67fce5 1146:74f2706995b7
20 #include "base/RealTime.h" 20 #include "base/RealTime.h"
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
25 #include "ColourDatabase.h" 26 #include "ColourDatabase.h"
26 #include "view/View.h" 27 #include "LayerGeometryProvider.h"
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 #include "PaintAssistant.h"
31 32
32 #include "data/model/FlexiNoteModel.h" 33 #include "data/model/FlexiNoteModel.h"
34
35 #include "view/View.h"
33 36
34 #include "widgets/ItemEditDialog.h" 37 #include "widgets/ItemEditDialog.h"
35 #include "widgets/TextAbbrev.h" 38 #include "widgets/TextAbbrev.h"
36 39
37 #include <QPainter> 40 #include <QPainter>
865 868
866 paint.setPen(v->getForeground()); 869 paint.setPen(v->getForeground());
867 // paint.setBrush(v->getForeground()); 870 // paint.setBrush(v->getForeground());
868 871
869 QString vlabel = QString("freq: %1%2").arg(p.value).arg(m_model->getScaleUnits()); 872 QString vlabel = QString("freq: %1%2").arg(p.value).arg(m_model->getScaleUnits());
870 // v->drawVisibleText(paint, 873 // PaintAssistant::drawVisibleText(v, paint,
871 // x - paint.fontMetrics().width(vlabel) - 2, 874 // x - paint.fontMetrics().width(vlabel) - 2,
872 // y + paint.fontMetrics().height()/2 875 // y + paint.fontMetrics().height()/2
873 // - paint.fontMetrics().descent(), 876 // - paint.fontMetrics().descent(),
874 // vlabel, View::OutlinedText); 877 // vlabel, PaintAssistant::OutlinedText);
875 v->drawVisibleText(paint, 878 PaintAssistant::drawVisibleText(v, paint,
876 x, 879 x,
877 y - h/2 - 2 - paint.fontMetrics().height() 880 y - h/2 - 2 - paint.fontMetrics().height()
878 - paint.fontMetrics().descent(), 881 - paint.fontMetrics().descent(),
879 vlabel, View::OutlinedText); 882 vlabel, PaintAssistant::OutlinedText);
880 883
881 QString hlabel = "dur: " + QString(RealTime::frame2RealTime 884 QString hlabel = "dur: " + QString(RealTime::frame2RealTime
882 (p.duration, m_model->getSampleRate()).toText(true).c_str()); 885 (p.duration, m_model->getSampleRate()).toText(true).c_str());
883 v->drawVisibleText(paint, 886 PaintAssistant::drawVisibleText(v, paint,
884 x, 887 x,
885 y - h/2 - paint.fontMetrics().descent() - 2, 888 y - h/2 - paint.fontMetrics().descent() - 2,
886 hlabel, View::OutlinedText); 889 hlabel, PaintAssistant::OutlinedText);
887 890
888 QString llabel = QString("%1").arg(p.label); 891 QString llabel = QString("%1").arg(p.label);
889 v->drawVisibleText(paint, 892 PaintAssistant::drawVisibleText(v, paint,
890 x, 893 x,
891 y + h + 2 + paint.fontMetrics().descent(), 894 y + h + 2 + paint.fontMetrics().descent(),
892 llabel, View::OutlinedText); 895 llabel, PaintAssistant::OutlinedText);
893 QString nlabel = QString("%1").arg(noteNumber); 896 QString nlabel = QString("%1").arg(noteNumber);
894 v->drawVisibleText(paint, 897 PaintAssistant::drawVisibleText(v, paint,
895 x + paint.fontMetrics().averageCharWidth() / 2, 898 x + paint.fontMetrics().averageCharWidth() / 2,
896 y + h/2 - paint.fontMetrics().descent(), 899 y + h/2 - paint.fontMetrics().descent(),
897 nlabel, View::OutlinedText); 900 nlabel, PaintAssistant::OutlinedText);
898 } 901 }
899 902
900 paint.drawRect(x, y - h/2, w, h); 903 paint.drawRect(x, y - h/2, w, h);
901 } 904 }
902 905