hydrogen 1.2.3
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-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
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 virtual void enterEvent( QEvent *ev );
113 virtual void leaveEvent( QEvent *ev );
114 virtual void paintEvent( QPaintEvent* ev ) override;
116
117 void updateStyleSheet();
118 void setRowSelection( RowSelection rowSelection );
119
122};
123
124inline int InstrumentLine::getNumber() const {
125 return m_nInstrumentNumber;
126}
127
128
130class PatternEditorInstrumentList : public QWidget,
131 public EventListener,
132 public H2Core::Object<PatternEditorInstrumentList> {
134 Q_OBJECT
135
136 public:
137 PatternEditorInstrumentList( QWidget *parent, PatternEditorPanel *pPatternEditorPanel );
139
140 virtual void mousePressEvent(QMouseEvent *event) override;
141 virtual void mouseMoveEvent(QMouseEvent *event) override;
142
143
144 virtual void dragEnterEvent(QDragEnterEvent *event) override;
145 virtual void dropEvent(QDropEvent *event) override;
146
147 virtual void selectedInstrumentChangedEvent() override;
148 virtual void updateSongEvent( int nEvent ) override;
149 virtual void drumkitLoadedEvent() override;
150 virtual void instrumentParametersChangedEvent( int ) override;
151
153 public slots:
155
156
157 protected:
166
168
170
171private:
172 void drawFocus( QPainter& painter );
173};
174
175
176#endif
#define H2_OBJECT(name)
Definition Object.h:224
Generic Button with SVG icons or text.
Definition Button.h:60
Drag scroller object.
Definition Selection.h:127
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)
virtual void enterEvent(QEvent *ev)
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.
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.
Widget has a list of items associated with a popup which in turn can open dialog windows.
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