hydrogen 1.2.6
InstrumentEditorPanel.cpp
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#include <QLabel>
24#include <QPixmap>
25#include <QGridLayout>
26
27#include <core/Hydrogen.h>
29
31#include "../HydrogenApp.h"
32
33
35
37{
38 if ( m_pInstance == nullptr ) {
39 m_pInstance = new InstrumentEditorPanel( nullptr );
40 }
41 return m_pInstance;
42}
43
44
45
47{
48 UNUSED( pParent );
49
50
51
52 m_pInstance = this;
54
55 // LAYOUT
56 QGridLayout *vbox = new QGridLayout();
57 vbox->setSpacing( 0 );
58 vbox->setContentsMargins( 0, 0, 0, 0 );
59
60 vbox->addWidget( m_pInstrumentEditor, 0, 0 );
61
62 this->setLayout( vbox );
63 m_nLayer = 0;
64
66}
67
68
69
74
77 if ( pSong == nullptr ) {
78 return;
79 }
80
81 auto pComponentList = pSong->getComponents();
82 if ( pComponentList != nullptr && pComponentList->size() > 0 ) {
83 m_pInstrumentEditor->selectComponent( pComponentList->front()->get_id() );
84 } else {
85 m_pInstrumentEditor->selectComponent( -1 );
86 }
87 m_pInstrumentEditor->selectedInstrumentChangedEvent();
88}
89
91 // A new song got loaded
92 if ( nValue == 0 ) {
94 }
95}
96
98{
99 m_pInstrumentEditor->selectLayer( nLayer );
100 m_nLayer = nLayer;
101}
102
104{
105 selectLayer ( m_nLayer ); // trigger a redisplay of wave preview
106}
107
108
#define INFOLOG(x)
Definition Object.h:240
std::shared_ptr< Song > getSong() const
Get the current song.
Definition Hydrogen.h:123
static Hydrogen * get_instance()
Returns the current Hydrogen instance __instance.
Definition Hydrogen.h:84
void addEventListener(EventListener *pListener)
static HydrogenApp * get_instance()
Returns the instance of HydrogenApp class.
Container for the Instrument Editor (Singleton).
static InstrumentEditorPanel * get_instance()
virtual void drumkitLoadedEvent() override
static InstrumentEditorPanel * m_pInstance
InstrumentEditor * m_pInstrumentEditor
virtual void updateSongEvent(int) override
InstrumentEditorPanel(const InstrumentEditorPanel &)=delete
Instrument Editor.
#define UNUSED(v)
Definition Globals.h:42