1 /*************************************************************************** 2 ** ** 3 ** Polyphone, a soundfont editor ** 4 ** Copyright (C) 2013-2020 Davy Triponney ** 5 ** 2014 Andrea Celani ** 6 ** ** 7 ** This program is free software: you can redistribute it and/or modify ** 8 ** it under the terms of the GNU General Public License as published by ** 9 ** the Free Software Foundation, either version 3 of the License, or ** 10 ** (at your option) any later version. ** 11 ** ** 12 ** This program is distributed in the hope that it will be useful, ** 13 ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** 14 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** 15 ** GNU General Public License for more details. ** 16 ** ** 17 ** You should have received a copy of the GNU General Public License ** 18 ** along with this program. If not, see http://www.gnu.org/licenses/. ** 19 ** ** 20 **************************************************************************** 21 ** Author: Davy Triponney ** 22 ** Website/Contact: https://www.polyphone-soundfonts.com ** 23 ** Date: 01.01.2013 ** 24 ***************************************************************************/ 25 26 #ifndef MODULATORCELL_H 27 #define MODULATORCELL_H 28 29 #include <QWidget> 30 #include "basetypes.h" 31 class SoundfontManager; 32 33 namespace Ui { 34 class ModulatorCell; 35 } 36 37 class ModulatorCell : public QWidget 38 { 39 Q_OBJECT 40 41 public: 42 // Initialization based on an existing id 43 ModulatorCell(EltID id, QWidget *parent = nullptr); 44 45 // Initialization based on a default modulator 46 ModulatorCell(ModulatorData modulatorData, QWidget * parent = nullptr); 47 48 ~ModulatorCell(); 49 50 AttributeType getTargetAttribute(); getID()51 EltID getID() { return _id; } 52 53 // Inform the cell that it's been selected (the colors will change) 54 void setSelected(bool isSelected); 55 56 void setOverwrittenBy(int otherModulator); 57 void setOverridingDefault(); 58 59 // Get the modulator as configured in the cell 60 ModulatorData getModulatorData(); 61 62 protected: 63 void paintEvent(QPaintEvent* event); 64 65 private slots: 66 void on_spinAmount_editingFinished(); 67 void on_comboTransform_currentIndexChanged(int index); 68 void onOutputChanged(int dummy); 69 70 private: 71 void initializeStyle(); 72 void updateLabelModNumber(); 73 74 Ui::ModulatorCell *ui; 75 QColor _computationAreaColor, _computationAreaColorSelected; 76 QColor _labelColor, _labelColorSelected; 77 bool _isSelected; 78 QFont _fontHint; 79 EltID _id; 80 bool _isPrst; 81 SoundfontManager * _sm; 82 QString _intRange; 83 bool _overwrittenBy; 84 85 static const QString s_doubleArrow; 86 }; 87 88 #endif // MODULATORCELL_H 89