Split InstrumentTrack (#6176)

Split InstrumentTrackView and InstrumentTrackWindow off of InstrumentTrack
This commit is contained in:
Alexandre Almeida
2021-10-02 00:40:01 -03:00
committed by GitHub
parent 745dec673d
commit 47cddcba75
16 changed files with 1354 additions and 1217 deletions

View File

@@ -1,6 +1,6 @@
/*
* InstrumentTrack.h - declaration of class InstrumentTrack, a track + window
* which holds an instrument-plugin
* InstrumentTrack.h - declaration of class InstrumentTrack, a track which
* holds an instrument-plugin
*
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
@@ -27,45 +27,22 @@
#define INSTRUMENT_TRACK_H
#include "AudioPort.h"
#include "GroupBox.h"
#include "InstrumentFunctions.h"
#include "InstrumentSoundShaping.h"
#include "Microtuner.h"
#include "Midi.h"
#include "MidiCCRackView.h"
#include "MidiEventProcessor.h"
#include "MidiPort.h"
#include "NotePlayHandle.h"
#include "Piano.h"
#include "PianoView.h"
#include "Pitch.h"
#include "Plugin.h"
#include "Track.h"
#include "TrackView.h"
class QLineEdit;
class InstrumentFunctionArpeggioView;
class InstrumentFunctionNoteStackingView;
class EffectRackView;
class InstrumentSoundShapingView;
class FadeButton;
class Instrument;
class InstrumentTrackWindow;
class InstrumentMidiIOView;
class InstrumentMiscView;
class Knob;
class FxLineLcdSpinBox;
class LcdSpinBox;
class LeftRightNav;
class midiPortMenu;
class DataFile;
class PluginView;
class TabWidget;
class TrackLabelButton;
class LedCheckBox;
class QLabel;
class LMMS_EXPORT InstrumentTrack : public Track, public MidiEventProcessor
@@ -327,196 +304,4 @@ private:
} ;
class InstrumentTrackView : public TrackView
{
Q_OBJECT
public:
InstrumentTrackView( InstrumentTrack * _it, TrackContainerView* tc );
virtual ~InstrumentTrackView();
InstrumentTrackWindow * getInstrumentTrackWindow();
InstrumentTrack * model()
{
return castModel<InstrumentTrack>();
}
const InstrumentTrack * model() const
{
return castModel<InstrumentTrack>();
}
static InstrumentTrackWindow * topLevelInstrumentTrackWindow();
QMenu * midiMenu()
{
return m_midiMenu;
}
// Create a menu for assigning/creating channels for this track
QMenu * createFxMenu( QString title, QString newFxLabel ) override;
protected:
void dragEnterEvent( QDragEnterEvent * _dee ) override;
void dropEvent( QDropEvent * _de ) override;
private slots:
void toggleInstrumentWindow( bool _on );
void toggleMidiCCRack();
void activityIndicatorPressed();
void activityIndicatorReleased();
void midiInSelected();
void midiOutSelected();
void midiConfigChanged();
void assignFxLine( int channelIndex );
void createFxLine();
void handleConfigChange(QString cls, QString attr, QString value);
private:
InstrumentTrackWindow * m_window;
// widgets in track-settings-widget
TrackLabelButton * m_tlb;
Knob * m_volumeKnob;
Knob * m_panningKnob;
FadeButton * m_activityIndicator;
QMenu * m_midiMenu;
QAction * m_midiInputAction;
QAction * m_midiOutputAction;
std::unique_ptr<MidiCCRackView> m_midiCCRackView;
QPoint m_lastPos;
FadeButton * getActivityIndicator() override
{
return m_activityIndicator;
}
friend class InstrumentTrackWindow;
} ;
class InstrumentTrackWindow : public QWidget, public ModelView,
public SerializingObjectHook
{
Q_OBJECT
public:
InstrumentTrackWindow( InstrumentTrackView * _tv );
virtual ~InstrumentTrackWindow();
// parent for all internal tab-widgets
TabWidget * tabWidgetParent()
{
return m_tabWidget;
}
InstrumentTrack * model()
{
return castModel<InstrumentTrack>();
}
const InstrumentTrack * model() const
{
return castModel<InstrumentTrack>();
}
void setInstrumentTrackView( InstrumentTrackView * _tv );
InstrumentTrackView *instrumentTrackView()
{
return m_itv;
}
PianoView * pianoView()
{
return m_pianoView;
}
static void dragEnterEventGeneric( QDragEnterEvent * _dee );
void dragEnterEvent( QDragEnterEvent * _dee ) override;
void dropEvent( QDropEvent * _de ) override;
public slots:
void textChanged( const QString & _new_name );
void toggleVisibility( bool _on );
void updateName();
void updateInstrumentView();
protected:
// capture close-events for toggling instrument-track-button
void closeEvent( QCloseEvent * _ce ) override;
void focusInEvent( QFocusEvent * _fe ) override;
void saveSettings( QDomDocument & _doc, QDomElement & _this ) override;
void loadSettings( const QDomElement & _this ) override;
protected slots:
void saveSettingsBtnClicked();
void viewNextInstrument();
void viewPrevInstrument();
private:
void modelChanged() override;
void viewInstrumentInDirection(int d);
//! adjust size of any child widget of the main tab
//! required to keep the old look when using a variable sized tab widget
void adjustTabSize(QWidget *w);
InstrumentTrack * m_track;
InstrumentTrackView * m_itv;
// widgets on the top of an instrument-track-window
QLineEdit * m_nameLineEdit;
LeftRightNav * m_leftRightNav;
Knob * m_volumeKnob;
Knob * m_panningKnob;
Knob * m_pitchKnob;
QLabel * m_pitchLabel;
LcdSpinBox* m_pitchRangeSpinBox;
QLabel * m_pitchRangeLabel;
FxLineLcdSpinBox * m_effectChannelNumber;
// tab-widget with all children
TabWidget * m_tabWidget;
PluginView * m_instrumentView;
InstrumentSoundShapingView * m_ssView;
InstrumentFunctionNoteStackingView* m_noteStackingView;
InstrumentFunctionArpeggioView* m_arpeggioView;
InstrumentMidiIOView * m_midiView;
EffectRackView * m_effectView;
InstrumentMiscView *m_miscView;
// test-piano at the bottom of every instrument-settings-window
PianoView * m_pianoView;
friend class InstrumentView;
friend class InstrumentTrackView;
} ;
#endif

View File

@@ -0,0 +1,118 @@
/*
* InstrumentTrackView.h - declaration of InstrumentTrackView class
*
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of LMMS - https://lmms.io
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef INSTRUMENT_TRACK_VIEW_H
#define INSTRUMENT_TRACK_VIEW_H
#include "TrackView.h"
#include "InstrumentTrack.h"
#include "MidiCCRackView.h"
class InstrumentTrackWindow;
class Knob;
class TrackContainerView;
class TrackLabelButton;
class InstrumentTrackView : public TrackView
{
Q_OBJECT
public:
InstrumentTrackView( InstrumentTrack * _it, TrackContainerView* tc );
virtual ~InstrumentTrackView();
InstrumentTrackWindow * getInstrumentTrackWindow();
InstrumentTrack * model()
{
return castModel<InstrumentTrack>();
}
const InstrumentTrack * model() const
{
return castModel<InstrumentTrack>();
}
static InstrumentTrackWindow * topLevelInstrumentTrackWindow();
QMenu * midiMenu()
{
return m_midiMenu;
}
// Create a menu for assigning/creating channels for this track
QMenu * createFxMenu( QString title, QString newFxLabel ) override;
protected:
void dragEnterEvent( QDragEnterEvent * _dee ) override;
void dropEvent( QDropEvent * _de ) override;
private slots:
void toggleInstrumentWindow( bool _on );
void toggleMidiCCRack();
void activityIndicatorPressed();
void activityIndicatorReleased();
void midiInSelected();
void midiOutSelected();
void midiConfigChanged();
void assignFxLine( int channelIndex );
void createFxLine();
void handleConfigChange(QString cls, QString attr, QString value);
private:
InstrumentTrackWindow * m_window;
// widgets in track-settings-widget
TrackLabelButton * m_tlb;
Knob * m_volumeKnob;
Knob * m_panningKnob;
FadeButton * m_activityIndicator;
QMenu * m_midiMenu;
QAction * m_midiInputAction;
QAction * m_midiOutputAction;
std::unique_ptr<MidiCCRackView> m_midiCCRackView;
QPoint m_lastPos;
FadeButton * getActivityIndicator() override
{
return m_activityIndicator;
}
friend class InstrumentTrackWindow;
} ;
#endif

View File

@@ -0,0 +1,161 @@
/*
* InstrumentTrackWindow.h - declaration of InstrumentTrackWindow class
*
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of LMMS - https://lmms.io
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef INSTRUMENT_TRACK_WINDOW_H
#define INSTRUMENT_TRACK_WINDOW_H
#include <QWidget>
#include "ModelView.h"
#include "SerializingObject.h"
class EffectRackView;
class FxLineLcdSpinBox;
class InstrumentFunctionArpeggioView;
class InstrumentFunctionNoteStackingView;
class InstrumentMidiIOView;
class InstrumentMiscView;
class InstrumentSoundShapingView;
class InstrumentTrack;
class InstrumentTrackShapingView;
class InstrumentTrackView;
class Knob;
class LcdSpinBox;
class LeftRightNav;
class PianoView;
class PluginView;
class QLabel;
class QLineEdit;
class QWidget;
class TabWidget;
class InstrumentTrackWindow : public QWidget, public ModelView,
public SerializingObjectHook
{
Q_OBJECT
public:
InstrumentTrackWindow( InstrumentTrackView * _tv );
virtual ~InstrumentTrackWindow();
// parent for all internal tab-widgets
TabWidget * tabWidgetParent()
{
return m_tabWidget;
}
InstrumentTrack * model()
{
return castModel<InstrumentTrack>();
}
const InstrumentTrack * model() const
{
return castModel<InstrumentTrack>();
}
void setInstrumentTrackView( InstrumentTrackView * _tv );
InstrumentTrackView *instrumentTrackView()
{
return m_itv;
}
PianoView * pianoView()
{
return m_pianoView;
}
static void dragEnterEventGeneric( QDragEnterEvent * _dee );
void dragEnterEvent( QDragEnterEvent * _dee ) override;
void dropEvent( QDropEvent * _de ) override;
public slots:
void textChanged( const QString & _new_name );
void toggleVisibility( bool _on );
void updateName();
void updateInstrumentView();
protected:
// capture close-events for toggling instrument-track-button
void closeEvent( QCloseEvent * _ce ) override;
void focusInEvent( QFocusEvent * _fe ) override;
void saveSettings( QDomDocument & _doc, QDomElement & _this ) override;
void loadSettings( const QDomElement & _this ) override;
protected slots:
void saveSettingsBtnClicked();
void viewNextInstrument();
void viewPrevInstrument();
private:
void modelChanged() override;
void viewInstrumentInDirection(int d);
//! adjust size of any child widget of the main tab
//! required to keep the old look when using a variable sized tab widget
void adjustTabSize(QWidget *w);
InstrumentTrack * m_track;
InstrumentTrackView * m_itv;
// widgets on the top of an instrument-track-window
QLineEdit * m_nameLineEdit;
LeftRightNav * m_leftRightNav;
Knob * m_volumeKnob;
Knob * m_panningKnob;
Knob * m_pitchKnob;
QLabel * m_pitchLabel;
LcdSpinBox* m_pitchRangeSpinBox;
QLabel * m_pitchRangeLabel;
FxLineLcdSpinBox * m_effectChannelNumber;
// tab-widget with all children
TabWidget * m_tabWidget;
PluginView * m_instrumentView;
InstrumentSoundShapingView * m_ssView;
InstrumentFunctionNoteStackingView* m_noteStackingView;
InstrumentFunctionArpeggioView* m_arpeggioView;
InstrumentMidiIOView * m_midiView;
EffectRackView * m_effectView;
InstrumentMiscView *m_miscView;
// test-piano at the bottom of every instrument-settings-window
PianoView * m_pianoView;
friend class InstrumentView;
friend class InstrumentTrackView;
} ;
#endif