Mercurial > hg > svgui
diff layer/Colour3DPlotLayer.cpp @ 978:64c2b3a4435a 3.0-integration
Merge from branch osx-retina
author | Chris Cannam |
---|---|
date | Fri, 26 Jun 2015 14:10:40 +0100 |
parents | bc23c2cfff65 |
children | 7242fe160c19 |
line wrap: on
line diff
--- a/layer/Colour3DPlotLayer.cpp Fri Jun 26 14:10:18 2015 +0100 +++ b/layer/Colour3DPlotLayer.cpp Fri Jun 26 14:10:40 2015 +0100 @@ -530,7 +530,7 @@ } void -Colour3DPlotLayer::setLayerDormant(const View *v, bool dormant) +Colour3DPlotLayer::setLayerDormant(const LayerGeometryProvider *v, bool dormant) { if (dormant) { @@ -554,7 +554,7 @@ } bool -Colour3DPlotLayer::isLayerScrollable(const View *v) const +Colour3DPlotLayer::isLayerScrollable(const LayerGeometryProvider *v) const { if (m_normalizeVisibleArea) { return false; @@ -613,7 +613,7 @@ } bool -Colour3DPlotLayer::getYScaleValue(const View *, int, +Colour3DPlotLayer::getYScaleValue(const LayerGeometryProvider *, int, double &, QString &) const { return false;//!!! @@ -669,13 +669,13 @@ } double -Colour3DPlotLayer::getYForBin(View *v, double bin) const +Colour3DPlotLayer::getYForBin(LayerGeometryProvider *v, double bin) const { double y = bin; if (!m_model) return y; double mn = 0, mx = m_model->getHeight(); getDisplayExtents(mn, mx); - double h = v->height(); + double h = v->getPaintHeight(); if (m_binScale == LinearBinScale) { y = h - (((bin - mn) * h) / (mx - mn)); } else { @@ -687,19 +687,19 @@ } int -Colour3DPlotLayer::getIYForBin(View *v, int bin) const +Colour3DPlotLayer::getIYForBin(LayerGeometryProvider *v, int bin) const { return int(round(getYForBin(v, bin))); } double -Colour3DPlotLayer::getBinForY(View *v, double y) const +Colour3DPlotLayer::getBinForY(LayerGeometryProvider *v, double y) const { double bin = y; if (!m_model) return bin; double mn = 0, mx = m_model->getHeight(); getDisplayExtents(mn, mx); - double h = v->height(); + double h = v->getPaintHeight(); if (m_binScale == LinearBinScale) { bin = mn + ((h - y) * (mx - mn)) / h; } else { @@ -711,13 +711,13 @@ } int -Colour3DPlotLayer::getIBinForY(View *v, int y) const +Colour3DPlotLayer::getIBinForY(LayerGeometryProvider *v, int y) const { return int(floor(getBinForY(v, y))); } QString -Colour3DPlotLayer::getFeatureDescription(View *v, QPoint &pos) const +Colour3DPlotLayer::getFeatureDescription(LayerGeometryProvider *v, QPoint &pos) const { if (!m_model) return ""; @@ -748,8 +748,8 @@ if (symin < 0) symin = 0; if (symax > sh) symax = sh; - // double binHeight = double(v->height()) / (symax - symin); -// int sy = int((v->height() - y) / binHeight) + symin; + // double binHeight = double(v->getPaintHeight()) / (symax - symin); +// int sy = int((v->getPaintHeight() - y) / binHeight) + symin; int sy = getIBinForY(v, y); @@ -779,14 +779,15 @@ } int -Colour3DPlotLayer::getColourScaleWidth(QPainter &) const +Colour3DPlotLayer::getColourScaleWidth(QPainter &p) const { - int cw = 20; + // Font is rotated + int cw = p.fontMetrics().height(); return cw; } int -Colour3DPlotLayer::getVerticalScaleWidth(View *, bool, QPainter &paint) const +Colour3DPlotLayer::getVerticalScaleWidth(LayerGeometryProvider *, bool, QPainter &paint) const { if (!m_model) return 0; @@ -808,7 +809,7 @@ } void -Colour3DPlotLayer::paintVerticalScale(View *v, bool, QPainter &paint, QRect rect) const +Colour3DPlotLayer::paintVerticalScale(LayerGeometryProvider *v, bool, QPainter &paint, QRect rect) const { if (!m_model) return; @@ -868,7 +869,7 @@ paint.save(); QFont font = paint.font(); - font.setPixelSize(10); + font.setPixelSize(int(font.pixelSize() * 0.65)); paint.setFont(font); int msw = paint.fontMetrics().width(maxstr); @@ -906,6 +907,8 @@ int py = h; + int defaultFontHeight = paint.fontMetrics().height(); + for (int i = symin; i <= symax; ++i) { int y0; @@ -915,9 +918,9 @@ if (i > symin) { if (paint.fontMetrics().height() >= h) { - if (h >= 8) { + if (h >= defaultFontHeight * 0.8) { QFont tf = paint.font(); - tf.setPixelSize(h-2); + tf.setPixelSize(int(h * 0.8)); paint.setFont(tf); } else { continue; @@ -1283,7 +1286,7 @@ } bool -Colour3DPlotLayer::shouldPaintDenseIn(const View *v) const +Colour3DPlotLayer::shouldPaintDenseIn(const LayerGeometryProvider *v) const { if (!m_model || !v || !(v->getViewManager())) { return false; @@ -1292,7 +1295,7 @@ v->getViewManager()->getMainModelSampleRate() / m_model->getSampleRate(); if (m_opaque || m_smooth || - m_model->getHeight() >= v->height() || + m_model->getHeight() >= v->getPaintHeight() || ((m_model->getResolution() * srRatio) / v->getZoomLevel()) < 2) { return true; } @@ -1300,7 +1303,7 @@ } void -Colour3DPlotLayer::paint(View *v, QPainter &paint, QRect rect) const +Colour3DPlotLayer::paint(LayerGeometryProvider *v, QPainter &paint, QRect rect) const { /* if (m_model) { @@ -1315,13 +1318,13 @@ int completion = 0; if (!m_model || !m_model->isOK() || !m_model->isReady(&completion)) { if (completion > 0) { - paint.fillRect(0, 10, v->width() * completion / 100, + paint.fillRect(0, 10, v->getPaintWidth() * completion / 100, 10, QColor(120, 120, 120)); } return; } - if (m_normalizeVisibleArea && !m_normalizeColumns) rect = v->rect(); + if (m_normalizeVisibleArea && !m_normalizeColumns) rect = v->getPaintRect(); sv_frame_t modelStart = m_model->getStartFrame(); sv_frame_t modelEnd = m_model->getEndFrame(); @@ -1339,7 +1342,7 @@ int x0 = rect.left(); int x1 = rect.right() + 1; - int h = v->height(); + int h = v->getPaintHeight(); double srRatio = v->getViewManager()->getMainModelSampleRate() / m_model->getSampleRate(); @@ -1461,7 +1464,7 @@ } void -Colour3DPlotLayer::paintDense(View *v, QPainter &paint, QRect rect) const +Colour3DPlotLayer::paintDense(LayerGeometryProvider *v, QPainter &paint, QRect rect) const { Profiler profiler("Colour3DPlotLayer::paintDense", true); if (!m_cache) return; @@ -1477,7 +1480,7 @@ int x1 = rect.right() + 1; const int w = x1 - x0; // const so it can be used as array size below - int h = v->height(); // we always paint full height + int h = v->getPaintHeight(); // we always paint full height int sh = m_model->getHeight(); int symin = m_miny; @@ -1692,7 +1695,7 @@ } bool -Colour3DPlotLayer::snapToFeatureFrame(View *v, sv_frame_t &frame, +Colour3DPlotLayer::snapToFeatureFrame(LayerGeometryProvider *v, sv_frame_t &frame, int &resolution, SnapType snap) const {