Mercurial > hg > svgui
comparison view/Pane.cpp @ 1078:ee01a4062747 spectrogram-minor-refactor
Move drawVisibleText to PaintAssistant
author | Chris Cannam |
---|---|
date | Thu, 30 Jun 2016 12:40:22 +0100 |
parents | f2c63ec85901 |
children | ba379b4d4555 |
comparison
equal
deleted
inserted
replaced
1077:5144d7185fb5 | 1078:ee01a4062747 |
---|---|
23 #include "widgets/CommandHistory.h" | 23 #include "widgets/CommandHistory.h" |
24 #include "widgets/TextAbbrev.h" | 24 #include "widgets/TextAbbrev.h" |
25 #include "base/Preferences.h" | 25 #include "base/Preferences.h" |
26 #include "layer/WaveformLayer.h" | 26 #include "layer/WaveformLayer.h" |
27 #include "layer/TimeRulerLayer.h" | 27 #include "layer/TimeRulerLayer.h" |
28 #include "layer/PaintAssistant.h" | |
28 | 29 |
29 // GF: added so we can propagate the mouse move event to the note layer for context handling. | 30 // GF: added so we can propagate the mouse move event to the note layer for context handling. |
30 #include "layer/LayerFactory.h" | 31 #include "layer/LayerFactory.h" |
31 #include "layer/FlexiNoteLayer.h" | 32 #include "layer/FlexiNoteLayer.h" |
32 | 33 |
775 .toText(true))); | 776 .toText(true))); |
776 | 777 |
777 int tw = paint.fontMetrics().width(text); | 778 int tw = paint.fontMetrics().width(text); |
778 int x = width()/2 - 4 - tw; | 779 int x = width()/2 - 4 - tw; |
779 | 780 |
780 drawVisibleText(paint, x, y, text, OutlinedText); | 781 PaintAssistant::drawVisibleText(this, paint, x, y, text, PaintAssistant::OutlinedText); |
781 } | 782 } |
782 | 783 |
783 QString text = QString("%1").arg(m_centreFrame); | 784 QString text = QString("%1").arg(m_centreFrame); |
784 | 785 |
785 int x = width()/2 + 4; | 786 int x = width()/2 + 4; |
786 | 787 |
787 drawVisibleText(paint, x, y, text, OutlinedText); | 788 PaintAssistant::drawVisibleText(this, paint, x, y, text, PaintAssistant::OutlinedText); |
788 } | 789 } |
789 } | 790 } |
790 | 791 |
791 void | 792 void |
792 Pane::drawModelTimeExtents(QRect r, QPainter &paint, const Model *model) | 793 Pane::drawModelTimeExtents(QRect r, QPainter &paint, const Model *model) |
864 if (r.top() > h + y || r.left() > w + m_scaleWidth + 5) { | 865 if (r.top() > h + y || r.left() > w + m_scaleWidth + 5) { |
865 paint.restore(); | 866 paint.restore(); |
866 return; | 867 return; |
867 } | 868 } |
868 | 869 |
869 drawVisibleText(paint, m_scaleWidth + 5, | 870 PaintAssistant::drawVisibleText(this, paint, m_scaleWidth + 5, |
870 paint.fontMetrics().ascent() + y, text, OutlinedText); | 871 paint.fontMetrics().ascent() + y, text, PaintAssistant::OutlinedText); |
871 | 872 |
872 paint.restore(); | 873 paint.restore(); |
873 } | 874 } |
874 | 875 |
875 void | 876 void |
903 if (r.top() > h + y || r.left() > w + m_scaleWidth + 5) { | 904 if (r.top() > h + y || r.left() > w + m_scaleWidth + 5) { |
904 paint.restore(); | 905 paint.restore(); |
905 return; | 906 return; |
906 } | 907 } |
907 | 908 |
908 drawVisibleText(paint, m_scaleWidth + 5, | 909 PaintAssistant::drawVisibleText(this, paint, m_scaleWidth + 5, |
909 paint.fontMetrics().ascent() + y, text, OutlinedText); | 910 paint.fontMetrics().ascent() + y, text, PaintAssistant::OutlinedText); |
910 | 911 |
911 paint.restore(); | 912 paint.restore(); |
912 } | 913 } |
913 | 914 |
914 void | 915 void |
952 | 953 |
953 if (i + 1 == texts.size()) { | 954 if (i + 1 == texts.size()) { |
954 paint.setPen(getForeground()); | 955 paint.setPen(getForeground()); |
955 } | 956 } |
956 | 957 |
957 drawVisibleText(paint, llx, | 958 PaintAssistant::drawVisibleText(this, paint, llx, |
958 lly - fontHeight + fontAscent, | 959 lly - fontHeight + fontAscent, |
959 texts[i], OutlinedText); | 960 texts[i], PaintAssistant::OutlinedText); |
960 | 961 |
961 if (!pixmaps[i].isNull()) { | 962 if (!pixmaps[i].isNull()) { |
962 paint.drawPixmap(llx - fontAscent - 3, | 963 paint.drawPixmap(llx - fontAscent - 3, |
963 lly - fontHeight + (fontHeight-fontAscent)/2, | 964 lly - fontHeight + (fontHeight-fontAscent)/2, |
964 pixmaps[i]); | 965 pixmaps[i]); |
1016 .arg(offsetText); | 1017 .arg(offsetText); |
1017 if (newStart >= origStart) { | 1018 if (newStart >= origStart) { |
1018 offsetText = tr("+%1").arg(offsetText); | 1019 offsetText = tr("+%1").arg(offsetText); |
1019 } | 1020 } |
1020 } | 1021 } |
1021 drawVisibleText(paint, p0 + 2, fontAscent + fontHeight + 4, startText, OutlinedText); | 1022 PaintAssistant::drawVisibleText(this, paint, p0 + 2, fontAscent + fontHeight + 4, startText, PaintAssistant::OutlinedText); |
1022 drawVisibleText(paint, p1 + 2, fontAscent + fontHeight + 4, endText, OutlinedText); | 1023 PaintAssistant::drawVisibleText(this, paint, p1 + 2, fontAscent + fontHeight + 4, endText, PaintAssistant::OutlinedText); |
1023 drawVisibleText(paint, p0 + 2, fontAscent + fontHeight*2 + 4, offsetText, OutlinedText); | 1024 PaintAssistant::drawVisibleText(this, paint, p0 + 2, fontAscent + fontHeight*2 + 4, offsetText, PaintAssistant::OutlinedText); |
1024 drawVisibleText(paint, p1 + 2, fontAscent + fontHeight*2 + 4, offsetText, OutlinedText); | 1025 PaintAssistant::drawVisibleText(this, paint, p1 + 2, fontAscent + fontHeight*2 + 4, offsetText, PaintAssistant::OutlinedText); |
1025 | 1026 |
1026 //!!! duplicating display policy with View::drawSelections | 1027 //!!! duplicating display policy with View::drawSelections |
1027 | 1028 |
1028 if (m_editingSelectionEdge < 0) { | 1029 if (m_editingSelectionEdge < 0) { |
1029 paint.drawLine(p0, 1, p1, 1); | 1030 paint.drawLine(p0, 1, p1, 1); |
1082 int x = m_scaleWidth + 5; | 1083 int x = m_scaleWidth + 5; |
1083 int pbw = getProgressBarWidth(); | 1084 int pbw = getProgressBarWidth(); |
1084 if (x < pbw + 5) x = pbw + 5; | 1085 if (x < pbw + 5) x = pbw + 5; |
1085 | 1086 |
1086 if (r.x() < x + paint.fontMetrics().width(desc)) { | 1087 if (r.x() < x + paint.fontMetrics().width(desc)) { |
1087 drawVisibleText(paint, x, | 1088 PaintAssistant::drawVisibleText(this, paint, x, |
1088 height() - fontHeight + fontAscent - 6, | 1089 height() - fontHeight + fontAscent - 6, |
1089 desc, OutlinedText); | 1090 desc, PaintAssistant::OutlinedText); |
1090 } | 1091 } |
1091 } | 1092 } |
1092 | 1093 |
1093 bool | 1094 bool |
1094 Pane::render(QPainter &paint, int xorigin, sv_frame_t f0, sv_frame_t f1) | 1095 Pane::render(QPainter &paint, int xorigin, sv_frame_t f0, sv_frame_t f1) |