Implements #2635: Draws a transparent rectangle in the loop area (plus CSS exposure) (#2657)

* Draws a transparent rectangle in the loop area (plus CSS exposure)

The color for the rectangle can be defined in the style CSS for the
active and inactive case. The following properties of the TimeLineWidget
are exposed through the CSS:
- The color of the lines that are drawn for each bar
- The color of the bar numbers
- The font size (given in pt)
- The minimum and the maximum height of the widget (given in em so that it scales with the font size). Set both to the same value to set a fixed size.
- The background of the widget
- A loop color: The color for the main rectangle's pen
- A loop brush: The brush used to fill the main rectangle
- An inner loop color: The color used for the pen that draws the inner border.
- loopRectangleVerticalPadding: specifies the padding used for the loop indicator rectangle.

The bar numbers are drawn conditionally like the bar lines. The
numbers are drawn with a constant distance to the tact line. This gives
a more consistent picture at different zoom levels and also fixes the
broken look at very small zoom sizes like for example 12.5%.

The bar numbers are drawn with hinting so that they show up less blurry on low DPI displays.

Remove the pixmaps that have been used up to now to draw the loop
boundaries.

Removes the unused "TimeLine" from style.css.

Document the style sheet properties for the loop indicator rectangle.
This commit is contained in:
Michael Gregorius
2016-06-12 18:13:23 +02:00
committed by GitHub
parent 1abbbc2ef6
commit ec95ef1ba9
8 changed files with 159 additions and 52 deletions

View File

@@ -42,6 +42,16 @@ class TimeLineWidget : public QWidget, public JournallingObject
{
Q_OBJECT
public:
Q_PROPERTY( QColor barLineColor READ getBarLineColor WRITE setBarLineColor )
Q_PROPERTY( QColor barNumberColor READ getBarNumberColor WRITE setBarNumberColor )
Q_PROPERTY( QColor inactiveLoopColor READ getInactiveLoopColor WRITE setInactiveLoopColor )
Q_PROPERTY( QBrush inactiveLoopBrush READ getInactiveLoopBrush WRITE setInactiveLoopBrush )
Q_PROPERTY( QColor inactiveLoopInnerColor READ getInactiveLoopInnerColor WRITE setInactiveLoopInnerColor )
Q_PROPERTY( QColor activeLoopColor READ getActiveLoopColor WRITE setActiveLoopColor )
Q_PROPERTY( QBrush activeLoopBrush READ getActiveLoopBrush WRITE setActiveLoopBrush )
Q_PROPERTY( QColor activeLoopInnerColor READ getActiveLoopInnerColor WRITE setActiveLoopInnerColor )
Q_PROPERTY( int loopRectangleVerticalPadding READ getLoopRectangleVerticalPadding WRITE setLoopRectangleVerticalPadding )
enum AutoScrollStates
{
AutoScrollEnabled,
@@ -66,6 +76,33 @@ public:
const MidiTime & begin, QWidget * parent );
virtual ~TimeLineWidget();
inline QColor const & getBarLineColor() const { return m_barLineColor; }
inline void setBarLineColor(QColor const & tactLineColor) { m_barLineColor = tactLineColor; }
inline QColor const & getBarNumberColor() const { return m_barNumberColor; }
inline void setBarNumberColor(QColor const & tactNumberColor) { m_barNumberColor = tactNumberColor; }
inline QColor const & getInactiveLoopColor() const { return m_inactiveLoopColor; }
inline void setInactiveLoopColor(QColor const & inactiveLoopColor) { m_inactiveLoopColor = inactiveLoopColor; }
inline QBrush const & getInactiveLoopBrush() const { return m_inactiveLoopBrush; }
inline void setInactiveLoopBrush(QBrush const & inactiveLoopBrush) { m_inactiveLoopBrush = inactiveLoopBrush; }
inline QColor const & getInactiveLoopInnerColor() const { return m_inactiveLoopInnerColor; }
inline void setInactiveLoopInnerColor(QColor const & inactiveLoopInnerColor) { m_inactiveLoopInnerColor = inactiveLoopInnerColor; }
inline QColor const & getActiveLoopColor() const { return m_activeLoopColor; }
inline void setActiveLoopColor(QColor const & activeLoopColor) { m_activeLoopColor = activeLoopColor; }
inline QBrush const & getActiveLoopBrush() const { return m_activeLoopBrush; }
inline void setActiveLoopBrush(QBrush const & activeLoopBrush) { m_activeLoopBrush = activeLoopBrush; }
inline QColor const & getActiveLoopInnerColor() const { return m_activeLoopInnerColor; }
inline void setActiveLoopInnerColor(QColor const & activeLoopInnerColor) { m_activeLoopInnerColor = activeLoopInnerColor; }
inline int const & getLoopRectangleVerticalPadding() const { return m_loopRectangleVerticalPadding; }
inline void setLoopRectangleVerticalPadding(int const & loopRectangleVerticalPadding) { m_loopRectangleVerticalPadding = loopRectangleVerticalPadding; }
inline Song::PlayPos & pos()
{
return( m_pos );
@@ -155,9 +192,19 @@ protected:
private:
static QPixmap * s_posMarkerPixmap;
static QPixmap * s_loopPointBeginPixmap;
static QPixmap * s_loopPointEndPixmap;
static QPixmap * s_loopPointDisabledPixmap;
QColor m_inactiveLoopColor;
QBrush m_inactiveLoopBrush;
QColor m_inactiveLoopInnerColor;
QColor m_activeLoopColor;
QBrush m_activeLoopBrush;
QColor m_activeLoopInnerColor;
int m_loopRectangleVerticalPadding;
QColor m_barLineColor;
QColor m_barNumberColor;
AutoScrollStates m_autoScroll;
LoopPointStates m_loopPoints;