comparison layer/RegionLayer.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
17 17
18 #include "data/model/Model.h" 18 #include "data/model/Model.h"
19 #include "base/RealTime.h" 19 #include "base/RealTime.h"
20 #include "base/Profiler.h" 20 #include "base/Profiler.h"
21 #include "base/LogRange.h" 21 #include "base/LogRange.h"
22
22 #include "ColourDatabase.h" 23 #include "ColourDatabase.h"
23
24 #include "ColourMapper.h" 24 #include "ColourMapper.h"
25 #include "LinearNumericalScale.h" 25 #include "LinearNumericalScale.h"
26 #include "LogNumericalScale.h" 26 #include "LogNumericalScale.h"
27 #include "LinearColourScale.h" 27 #include "LinearColourScale.h"
28 #include "LogColourScale.h" 28 #include "LogColourScale.h"
29 #include "PaintAssistant.h"
29 30
30 #include "view/View.h" 31 #include "view/View.h"
31 32
32 #include "data/model/RegionModel.h" 33 #include "data/model/RegionModel.h"
33 34
977 978
978 paint.setPen(v->getForeground()); 979 paint.setPen(v->getForeground());
979 paint.setBrush(v->getForeground()); 980 paint.setBrush(v->getForeground());
980 981
981 QString vlabel = QString("%1%2").arg(p.value).arg(getScaleUnits()); 982 QString vlabel = QString("%1%2").arg(p.value).arg(getScaleUnits());
982 v->drawVisibleText(paint, 983 PaintAssistant::drawVisibleText(v, paint,
983 x - paint.fontMetrics().width(vlabel) - 2, 984 x - paint.fontMetrics().width(vlabel) - 2,
984 y + paint.fontMetrics().height()/2 985 y + paint.fontMetrics().height()/2
985 - paint.fontMetrics().descent(), 986 - paint.fontMetrics().descent(),
986 vlabel, LayerGeometryProvider::OutlinedText); 987 vlabel, PaintAssistant::OutlinedText);
987 988
988 QString hlabel = RealTime::frame2RealTime 989 QString hlabel = RealTime::frame2RealTime
989 (p.frame, m_model->getSampleRate()).toText(true).c_str(); 990 (p.frame, m_model->getSampleRate()).toText(true).c_str();
990 v->drawVisibleText(paint, 991 PaintAssistant::drawVisibleText(v, paint,
991 x, 992 x,
992 y - h/2 - paint.fontMetrics().descent() - 2, 993 y - h/2 - paint.fontMetrics().descent() - 2,
993 hlabel, LayerGeometryProvider::OutlinedText); 994 hlabel, PaintAssistant::OutlinedText);
994 } 995 }
995 996
996 paint.drawLine(x, y-1, x + w, y-1); 997 paint.drawLine(x, y-1, x + w, y-1);
997 paint.drawLine(x, y+1, x + w, y+1); 998 paint.drawLine(x, y+1, x + w, y+1);
998 paint.drawLine(x, y - h/2, x, y + h/2); 999 paint.drawLine(x, y - h/2, x, y + h/2);
1046 } 1047 }
1047 lastLabelY = labelY; 1048 lastLabelY = labelY;
1048 nextLabelMinX = labelX + paint.fontMetrics().width(label); 1049 nextLabelMinX = labelX + paint.fontMetrics().width(label);
1049 } 1050 }
1050 1051
1051 v->drawVisibleText(paint, labelX, labelY, label, LayerGeometryProvider::OutlinedText); 1052 PaintAssistant::drawVisibleText(v, paint, labelX, labelY, label, PaintAssistant::OutlinedText);
1052 } 1053 }
1053 } 1054 }
1054 1055
1055 paint.restore(); 1056 paint.restore();
1056 } 1057 }