comparison layer/NoteLayer.cpp @ 1078:ee01a4062747 spectrogram-minor-refactor

Move drawVisibleText to PaintAssistant
author Chris Cannam
date Thu, 30 Jun 2016 12:40:22 +0100
parents 5144d7185fb5
children a34a2a25907c
comparison
equal deleted inserted replaced
1077:5144d7185fb5 1078:ee01a4062747
19 #include "base/RealTime.h" 19 #include "base/RealTime.h"
20 #include "base/Profiler.h" 20 #include "base/Profiler.h"
21 #include "base/Pitch.h" 21 #include "base/Pitch.h"
22 #include "base/LogRange.h" 22 #include "base/LogRange.h"
23 #include "base/RangeMapper.h" 23 #include "base/RangeMapper.h"
24 #include "view/View.h"
25
24 #include "ColourDatabase.h" 26 #include "ColourDatabase.h"
25 #include "view/View.h"
26
27 #include "PianoScale.h" 27 #include "PianoScale.h"
28 #include "LinearNumericalScale.h" 28 #include "LinearNumericalScale.h"
29 #include "LogNumericalScale.h" 29 #include "LogNumericalScale.h"
30 #include "PaintAssistant.h"
30 31
31 #include "data/model/NoteModel.h" 32 #include "data/model/NoteModel.h"
32 33
33 #include "widgets/ItemEditDialog.h" 34 #include "widgets/ItemEditDialog.h"
34 #include "widgets/TextAbbrev.h" 35 #include "widgets/TextAbbrev.h"
807 808
808 paint.setPen(v->getForeground()); 809 paint.setPen(v->getForeground());
809 paint.setBrush(v->getForeground()); 810 paint.setBrush(v->getForeground());
810 811
811 QString vlabel = QString("%1%2").arg(p.value).arg(getScaleUnits()); 812 QString vlabel = QString("%1%2").arg(p.value).arg(getScaleUnits());
812 v->drawVisibleText(paint, 813 PaintAssistant::drawVisibleText(v, paint,
813 x - paint.fontMetrics().width(vlabel) - 2, 814 x - paint.fontMetrics().width(vlabel) - 2,
814 y + paint.fontMetrics().height()/2 815 y + paint.fontMetrics().height()/2
815 - paint.fontMetrics().descent(), 816 - paint.fontMetrics().descent(),
816 vlabel, LayerGeometryProvider::OutlinedText); 817 vlabel, PaintAssistant::OutlinedText);
817 818
818 QString hlabel = RealTime::frame2RealTime 819 QString hlabel = RealTime::frame2RealTime
819 (p.frame, m_model->getSampleRate()).toText(true).c_str(); 820 (p.frame, m_model->getSampleRate()).toText(true).c_str();
820 v->drawVisibleText(paint, 821 PaintAssistant::drawVisibleText(v, paint,
821 x, 822 x,
822 y - h/2 - paint.fontMetrics().descent() - 2, 823 y - h/2 - paint.fontMetrics().descent() - 2,
823 hlabel, LayerGeometryProvider::OutlinedText); 824 hlabel, PaintAssistant::OutlinedText);
824 } 825 }
825 826
826 paint.drawRect(x, y - h/2, w, h); 827 paint.drawRect(x, y - h/2, w, h);
827 } 828 }
828 829