[go: up one dir, main page]

File: qtractorTrackForm.h

package info (click to toggle)
qtractor 0.9.31-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 12,712 kB
  • sloc: cpp: 117,217; ansic: 2,215; xml: 71; sh: 5; makefile: 3
file content (179 lines) | stat: -rw-r--r-- 4,807 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
// qtractorTrackForm.h
//
/****************************************************************************
   Copyright (C) 2005-2022, rncbc aka Rui Nuno Capela. All rights reserved.

   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; if not, write to the Free Software Foundation, Inc.,
   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

*****************************************************************************/

#ifndef __qtractorTrackForm_h
#define __qtractorTrackForm_h

#include "ui_qtractorTrackForm.h"

#include "qtractorTrack.h"

#include <QMap>


// Forward declarations...
class qtractorMidiBus;
class qtractorMidiManager;
class qtractorCommand;

class QMenu;


//----------------------------------------------------------------------------
// qtractorTrackForm -- UI wrapper form.

class qtractorTrackForm : public QDialog
{
	Q_OBJECT

public:

	// Constructor.
	qtractorTrackForm(QWidget *pParent = nullptr);
	// Destructor.
	~qtractorTrackForm();

	void setTrack(qtractorTrack *pTrack);
	qtractorTrack *track() const;

	const qtractorTrack::Properties& properties() const;

	qtractorTrack::TrackType trackType() const;

	void setMidiProgram(int iBank, int iProg);

protected slots:

	void accept();
	void reject();

	void stabilizeForm();
	void changed();

	void pluginListChanged();

	void trackTypeChanged();
	void inputBusNameChanged(int iInputBusName);
	void outputBusNameChanged(int iOutputBusName);
	void busNameClicked();

	void channelChanged(int iChannel);
	void instrumentChanged(int iInstrument);
	void bankSelMethodChanged(int iBankSelMethod);
	void bankChanged();
	void progChanged();

	void foregroundColorChanged(const QString& sText);
	void backgroundColorChanged(const QString& sText);
	void selectForegroundColor();
	void selectBackgroundColor();

	void addPlugin();
	void removePlugin();
	void moveUpPlugin();
	void moveDownPlugin();

	void trackIconAction();
	void trackIconClicked();
	void trackIconChanged();

protected:

	qtractorMidiBus *midiBus() const;

	int midiBank() const;
	int midiProg() const;

	void updateInstruments();
	void updateInstrumentsAdd(
		const QIcon& icon, qtractorMidiManager *pMidiManager);

	void updateTrackType(qtractorTrack::TrackType trackType);

	void updateChannel(int iChannel, int iBankSelMethod, int iBank, int iProg);
	void updateBanks(const QString& sInstrumentName, int iBankSelMethod, int iBank, int iProg);
	void updatePrograms(const QString& sInstrumentName, int iBank, int iProg);

	bool updateBanksAdd(const QIcon& icon, qtractorMidiManager *pMidiManager,
		const QString& sInstrumentName, int iBank, int& iBankIndex);
	bool updateProgramsAdd(const QIcon& icon, qtractorMidiManager *pMidiManager,
		const QString& sInstrumentName, int iBank, int iProg, int& iProgIndex);

	void updateColorItem(QComboBox *pComboBox, const QColor& color);
	void updateColorText(QComboBox *pComboBox, const QColor& color);

	QColor colorItem(QComboBox *pComboBox);

	// Update/reset output bus name...
	void updateOutputBusName(const QString& sBusName);

	// Save/load default bus names...
	void loadDefaultBusNames(qtractorTrack::TrackType trackType);
	void saveDefaultBusNames(qtractorTrack::TrackType trackType) const;

	// Track icon generic/standard action setup.
	void addIconMenuAction(const QString& sText, const QString& sTrackIcon);

private:

	// The Qt-designer UI struct...
	Ui::qtractorTrackForm m_ui;

	// Instance variables...
	qtractorTrack *m_pTrack;
	qtractorTrack::Properties m_props;
	qtractorMidiBus *m_pMidiBus;
	QMap<int, int> m_banks;
	QMap<int, int> m_progs;
	int m_iDirtySetup;
	int m_iDirtyCount;
	int m_iDirtyPatch;
	QString m_sOldOutputBusName;
	qtractorMidiBus *m_pOldMidiBus;
	int m_iOldChannel;
	QString m_sOldInstrumentName;
	int m_iOldBankSelMethod;
	int m_iOldBank;
	int m_iOldProg;

	// Keep last acceptable command.
	qtractorCommand *m_pLastCommand;

	// Track icon menu.
	QMenu *m_pIconMenu;

	// MIDI bank/program observer.
	class MidiProgramObserver;

	MidiProgramObserver *m_pMidiProgramObserver;

	// Default bus names...
	static QString g_sAudioInputBusName;
	static QString g_sAudioOutputBusName;
	static QString g_sMidiInputBusName;
	static QString g_sMidiOutputBusName;
};


#endif	// __qtractorTrackForm_h


// end of qtractorTrackForm.h