hydrogen 1.2.6
PatternEditorInstrumentList.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-2025 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
24#ifndef PATTERN_EDITOR_INSTRUMENT_LIST_H
25#define PATTERN_EDITOR_INSTRUMENT_LIST_H
26
27
28#include <core/Globals.h>
29
30#include <QtGui>
31#include <QtWidgets>
32
33#include <core/Object.h>
36#include "../EventListener.h"
37#include "../Selection.h"
40
41namespace H2Core
42{
43 class Pattern;
44}
45
47class Button;
48
51 , protected WidgetWithScalableFont<8, 10, 12>
53{
55 Q_OBJECT
56
57 public:
58 explicit InstrumentLine(QWidget* pParent);
59
60 int getNumber() const;
61
62 void setName(const QString& sName);
63 void setSelected(bool isSelected);
64 void setNumber(int nIndex);
65 void setMuted(bool isMuted);
66 void setSoloed( bool soloed );
67 void setSamplesMissing( bool bSamplesMissing );
68
69 static constexpr int m_nButtonWidth = 18;
70
71public slots:
73
74 private slots:
75 void functionClearNotes();
76
85 void functionFillNotes( int every );
90
93 void muteClicked();
94 void soloClicked();
96
98
99
100 private:
103 QLabel *m_pNameLbl;
109
110 virtual void mousePressEvent(QMouseEvent *ev) override;
111 virtual void mouseDoubleClickEvent( QMouseEvent* ev ) override;
112#ifdef H2CORE_HAVE_QT6
113 virtual void enterEvent( QEnterEvent *ev ) override;
114#else
115 virtual void enterEvent( QEvent *ev ) override;
116#endif
117 virtual void leaveEvent( QEvent *ev );
118 virtual void paintEvent( QPaintEvent* ev ) override;
120
121 void updateStyleSheet();
122 void setRowSelection( RowSelection rowSelection );
123
126};
127
128inline int InstrumentLine::getNumber() const {
129 return m_nInstrumentNumber;
130}
131
132
134class PatternEditorInstrumentList : public QWidget,
135 public EventListener,
136 public H2Core::Object<PatternEditorInstrumentList> {
138 Q_OBJECT
139
140 public:
141 PatternEditorInstrumentList( QWidget *parent, PatternEditorPanel *pPatternEditorPanel );
143
144 virtual void mousePressEvent(QMouseEvent *event) override;
145 virtual void mouseMoveEvent(QMouseEvent *event) override;
146
147
148 virtual void dragEnterEvent(QDragEnterEvent *event) override;
149 virtual void dropEvent(QDropEvent *event) override;
150
151 virtual void selectedInstrumentChangedEvent() override;
152 virtual void updateSongEvent( int nEvent ) override;
153 virtual void drumkitLoadedEvent() override;
154 virtual void instrumentParametersChangedEvent( int ) override;
155
157 public slots:
159
160
161 protected:
170
172
174
175private:
176 void drawFocus( QPainter& painter );
177};
178
179
180#endif
#define H2_OBJECT(name)
Definition Object.h:227
Generic Button with SVG icons or text.
Definition Button.h:60
Drag scroller object.
Definition Selection.h:129
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...
void setRowSelection(RowSelection rowSelection)
InstrumentLine(QWidget *pParent)
virtual void mousePressEvent(QMouseEvent *ev) override
virtual void mouseDoubleClickEvent(QMouseEvent *ev) override
virtual void leaveEvent(QEvent *ev)
void onPreferencesChanged(H2Core::Preferences::Changes changes)
void setSelected(bool isSelected)
void setSamplesMissing(bool bSamplesMissing)
H2Core::Pattern * getCurrentPattern()
void setName(const QString &sName)
static constexpr int m_nButtonWidth
virtual void paintEvent(QPaintEvent *ev) override
int m_nInstrumentNumber
The related instrument number.
virtual void enterEvent(QEvent *ev) override
bool m_bEntered
Whether the cursor entered the boundary of the widget.
virtual void mouseMoveEvent(QMouseEvent *event) override
void updateInstrumentLines()
Update every InstrumentLine, create or destroy lines if necessary.
InstrumentLine * createInstrumentLine()
Create a new InstrumentLine.
virtual void mousePressEvent(QMouseEvent *event) override
PatternEditorInstrumentList(QWidget *parent, PatternEditorPanel *pPatternEditorPanel)
virtual void instrumentParametersChangedEvent(int) override
virtual void dragEnterEvent(QDragEnterEvent *event) override
virtual void selectedInstrumentChangedEvent() override
virtual void updateSongEvent(int nEvent) override
virtual void dropEvent(QDropEvent *event) override
void drawFocus(QPainter &painter)
InstrumentLine * m_pInstrumentLine[MAX_INSTRUMENTS]
Pattern Editor Panel.
PixmapWidget(QWidget *pParent)
RowSelection
Specifies whether the row corresponding to m_nRowClicked should be highlighted and determines the lif...
Widget is affected by the "Font size" settings in the PreferencesDialog.
#define MAX_INSTRUMENTS
Maximum number of instruments allowed in Hydrogen.
Definition config.dox:70