hydrogen 1.2.6
LayerPreview.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#ifndef LAYER_PREVIEW_H
23#define LAYER_PREVIEW_H
24
25#include <QtGui>
26#include <QtWidgets>
27#include <memory>
28
29#include <core/Object.h>
32#include "../EventListener.h"
34
35namespace H2Core
36{
37class InstrumentLayer;
38}
39
41class LayerPreview : public QWidget, protected WidgetWithScalableFont<5, 6, 7>, public H2Core::Object<LayerPreview>, public EventListener
42{
44 Q_OBJECT
45
46 public:
47 explicit LayerPreview(QWidget* pParent);
49
50 void updateAll();
51
52 void paintEvent(QPaintEvent *ev) override;
53 virtual void mousePressEvent(QMouseEvent *ev) override;
54 virtual void mouseReleaseEvent(QMouseEvent *ev) override;
55 virtual void mouseMoveEvent ( QMouseEvent *ev ) override;
56
57 void set_selected_component( int SelectedComponent );
58 void setSelectedLayer( int nSelectedLayer );
59
60public slots:
62
63 private:
64 static const int m_nLayerHeight = 10;
66 std::shared_ptr<H2Core::Instrument> m_pInstrument;
71
79 int getMidiVelocityFromRaw( const float raw );
80
87 void showLayerStartVelocity( const std::shared_ptr<H2Core::InstrumentLayer> pLayer,
88 QMouseEvent* pEvent );
89
96 void showLayerEndVelocity( const std::shared_ptr<H2Core::InstrumentLayer> pLayer,
97 QMouseEvent* pEvent );
98
99 virtual void selectedInstrumentChangedEvent() override;
100 virtual void drumkitLoadedEvent() override;
101 virtual void updateSongEvent(int) override;
103 int getPointSizeButton() const;
104};
105
106inline void LayerPreview::setSelectedLayer( int nLayer ) {
107 if ( nLayer != m_nSelectedLayer ) {
108 m_nSelectedLayer = nLayer;
109 }
110}
111
112#endif
#define H2_OBJECT(name)
Definition Object.h:227
InstrumentLayer is part of an instrument each layer has it's own : gain which is the ration between...
Changes
Bitwise or-able options showing which part of the Preferences were altered using the PreferencesDialo...
virtual void mouseMoveEvent(QMouseEvent *ev) override
LayerPreview(QWidget *pParent)
virtual void mousePressEvent(QMouseEvent *ev) override
QPixmap m_speakerPixmap
void showLayerEndVelocity(const std::shared_ptr< H2Core::InstrumentLayer > pLayer, QMouseEvent *pEvent)
display a layer's end velocity in a tooltip
static const int m_nLayerHeight
void setSelectedLayer(int nSelectedLayer)
void onPreferencesChanged(H2Core::Preferences::Changes changes)
int m_nSelectedComponent
virtual void drumkitLoadedEvent() override
virtual void mouseReleaseEvent(QMouseEvent *ev) override
void showLayerStartVelocity(const std::shared_ptr< H2Core::InstrumentLayer > pLayer, QMouseEvent *pEvent)
display a layer's start velocity in a tooltip
virtual void selectedInstrumentChangedEvent() override
virtual void updateSongEvent(int) override
void paintEvent(QPaintEvent *ev) override
std::shared_ptr< H2Core::Instrument > m_pInstrument
void set_selected_component(int SelectedComponent)
int getMidiVelocityFromRaw(const float raw)
convert a raw velocity value (0.0 to 1.0) into a MIDI velocity value (0 to 127)
int getPointSizeButton() const
Used to detect changed in the font.
Widget is affected by the "Font size" settings in the PreferencesDialog.