1 /*************************************************************************** 2 ** ** 3 ** Polyphone, a soundfont editor ** 4 ** Copyright (C) 2013-2020 Davy Triponney ** 5 ** ** 6 ** This program is free software: you can redistribute it and/or modify ** 7 ** it under the terms of the GNU General Public License as published by ** 8 ** the Free Software Foundation, either version 3 of the License, or ** 9 ** (at your option) any later version. ** 10 ** ** 11 ** This program is distributed in the hope that it will be useful, ** 12 ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** 13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** 14 ** GNU General Public License for more details. ** 15 ** ** 16 ** You should have received a copy of the GNU General Public License ** 17 ** along with this program. If not, see http://www.gnu.org/licenses/. ** 18 ** ** 19 **************************************************************************** 20 ** Author: Davy Triponney ** 21 ** Website/Contact: https://www.polyphone-soundfonts.com ** 22 ** Date: 01.01.2013 ** 23 ***************************************************************************/ 24 25 #ifndef PIANOKEYBDCUSTOM_H 26 #define PIANOKEYBDCUSTOM_H 27 28 #include "pianokeybd.h" 29 #include <QKeyEvent> 30 31 32 class PianoKeybdCustom : public PianoKeybd 33 { 34 Q_OBJECT 35 36 public: 37 PianoKeybdCustom(QWidget * parent); 38 39 // Add a range and a root key if rootKey != -1 40 void addRangeAndRootKey(int rootKey, int noteMin, int noteMax); 41 42 // Remove all customization 43 void clearCustomization(); 44 45 // Add a current range around a key 46 void addCurrentRange(int note, int noteMin, int noteMax); 47 48 public slots: 49 // Remove a current range around a key 50 void removeCurrentRange(int num); 51 52 private slots: 53 void setKey(int num, int vel); 54 55 private: 56 void updateRanges(); 57 58 QList<int> _currentRange; 59 QList<int> _rootKeys; 60 QMap<int, QList<int> > _mapPressed; 61 62 static QColor COLOR_PRESSED; 63 static QColor COLOR_BLACK_ENABLED; 64 static QColor COLOR_WHITE_ENABLED; 65 static QColor COLOR_BLACK_DISABLED; 66 static QColor COLOR_WHITE_DISABLED; 67 static QColor COLOR_BLACK_RANGE; 68 static QColor COLOR_WHITE_RANGE; 69 }; 70 71 #endif // PIANOKEYBDCUSTOM_H 72