hydrogen 1.2.3
PatternEditorRuler.h
Go to the documentation of this file.
1/*
2 * Hydrogen
3 * Copyright(c) 2002-2008 by Alex >Comix< Cominu [comix@users.sourceforge.net]
4 * Copyright(c) 2008-2024 The hydrogen development team [hydrogen-devel@lists.sourceforge.net]
5 *
6 * http://www.hydrogen-music.org
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY, without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see https://www.gnu.org/licenses
20 *
21 */
22
23#ifndef PATTERN_EDITOR_RULER_H
24#define PATTERN_EDITOR_RULER_H
25
26#include "../EventListener.h"
27#include <QtGui>
28#include <QtWidgets>
30
31#include <core/Object.h>
33
35
36namespace H2Core
37{
38 class Pattern;
39}
40
42class PatternEditorRuler : public QWidget, protected WidgetWithScalableFont<8, 10, 12>, public H2Core::Object<PatternEditorRuler>, public EventListener
43{
45 Q_OBJECT
46
47 public:
48 explicit PatternEditorRuler( QWidget* parent );
50
53
54 void paintEvent(QPaintEvent *ev) override;
55 void updateStart(bool start);
68 void updatePosition( bool bForce = false );
69
70 void showEvent( QShowEvent *ev ) override;
71 void hideEvent( QHideEvent *ev ) override;
72 void mouseMoveEvent( QMouseEvent *ev ) override;
73 void mousePressEvent( QMouseEvent *ev ) override;
74 void leaveEvent( QEvent *ev ) override;
75
76 void zoomIn();
77 void zoomOut();
78 float getGridWidth() const {
79 return m_fGridWidth;
80 };
81
82 void createBackground();
85
86 public slots:
87 void updateEditor( bool bRedrawAll = false );
89
90 private:
94
96
97 QTimer *m_pTimer;
100
109 bool updateActiveRange();
110
111 // Implements EventListener interface
112 virtual void selectedPatternChangedEvent() override;
113 virtual void stateChangedEvent( H2Core::AudioEngine::State ) override;
114 virtual void songModeActivationEvent() override;
115 virtual void relocationEvent() override;
116 virtual void playingPatternsChangedEvent() override;
117 // ~ Implements EventListener interface
118};
119
120
121#endif
#define H2_OBJECT(name)
Definition Object.h:224
Pattern class is a Note container.
Definition Pattern.h:46
Changes
Bitwise or-able options showing which part of the Preferences were altered using the PreferencesDialo...
Pattern Editor Panel.
void hideEvent(QHideEvent *ev) override
void mouseMoveEvent(QMouseEvent *ev) override
bool updateActiveRange()
Updates m_nWidthActive.
void mousePressEvent(QMouseEvent *ev) override
int m_nWidthActive
Length of the song in pixels.
void updateStart(bool start)
PatternEditorRuler(const PatternEditorRuler &)=delete
virtual void stateChangedEvent(H2Core::AudioEngine::State) override
void onPreferencesChanged(H2Core::Preferences::Changes changes)
virtual void songModeActivationEvent() override
void leaveEvent(QEvent *ev) override
float getGridWidth() const
void showEvent(QShowEvent *ev) override
virtual void playingPatternsChangedEvent() override
PatternEditorRuler & operator=(const PatternEditorRuler &rhs)=delete
virtual void relocationEvent() override
void updateEditor(bool bRedrawAll=false)
void paintEvent(QPaintEvent *ev) override
void updatePosition(bool bForce=false)
Queries the audio engine to update the current position of the playhead.
virtual void selectedPatternChangedEvent() override
H2Core::Pattern * m_pPattern
PatternEditorRuler(QWidget *parent)
Widget is affected by the "Font size" settings in the PreferencesDialog.