Chris@195: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@195: Chris@195: /* Chris@195: Sonic Visualiser Chris@195: An audio file viewer and annotation editor. Chris@195: Centre for Digital Music, Queen Mary, University of London. Chris@195: This file copyright 2006-2007 Chris Cannam and QMUL. Chris@195: Chris@195: This program is free software; you can redistribute it and/or Chris@195: modify it under the terms of the GNU General Public License as Chris@195: published by the Free Software Foundation; either version 2 of the Chris@195: License, or (at your option) any later version. See the file Chris@195: COPYING included with this distribution for more information. Chris@195: */ Chris@195: Chris@1228: #ifndef SV_PAINT_ASSISTANT_H Chris@1228: #define SV_PAINT_ASSISTANT_H Chris@195: Chris@195: #include Chris@1228: #include Chris@195: #include Chris@195: Chris@195: class QPainter; Chris@1078: class Layer; Chris@1078: class LayerGeometryProvider; Chris@195: Chris@195: class PaintAssistant Chris@195: { Chris@195: public: Chris@195: enum Scale { LinearScale, MeterScale, dBScale }; Chris@195: Chris@195: static void paintVerticalLevelScale(QPainter &p, QRect rect, Chris@905: double minVal, double maxVal, Chris@220: Scale scale, int &multRtn, Chris@195: std::vector *markCoordRtns = 0); Chris@195: Chris@905: static int getYForValue(Scale scale, double value, Chris@905: double minVal, double maxVal, Chris@195: int minY, int height); Chris@1078: Chris@1078: enum TextStyle { Chris@1078: BoxedText, Chris@1078: OutlinedText, Chris@1078: OutlinedItalicText Chris@1078: }; Chris@1078: Chris@1078: static void drawVisibleText(const LayerGeometryProvider *, Chris@1078: QPainter &p, int x, int y, Chris@1078: QString text, TextStyle style); Chris@1228: Chris@1228: /** Chris@1228: * Scale up pen width for a hi-dpi display without pixel doubling. Chris@1228: * Very similar to ViewManager::scalePixelSize, but a bit more Chris@1228: * conservative. Chris@1228: */ Chris@1228: static double scalePenWidth(double width); Chris@1228: Chris@1228: /** Chris@1228: * Apply scalePenWidth to a pen. Chris@1228: */ Chris@1228: static QPen scalePen(QPen pen); Chris@195: }; Chris@195: Chris@195: #endif