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 MODULATORSPLITTER_H 26 #define MODULATORSPLITTER_H 27 28 #include <QSplitter> 29 class ModulatorEditor; 30 31 class ModulatorSplitterHandle: public QSplitterHandle 32 { 33 Q_OBJECT 34 35 public: ModulatorSplitterHandle(Qt::Orientation orientation,QSplitter * parent)36 ModulatorSplitterHandle(Qt::Orientation orientation, QSplitter * parent) : 37 QSplitterHandle(orientation, parent), 38 _enabled(true) 39 {} 40 setMoveEnabled(bool isEnabled)41 void setMoveEnabled(bool isEnabled) 42 { 43 _enabled = isEnabled; 44 this->setCursor(_enabled ? Qt::SplitVCursor : Qt::ArrowCursor); 45 } 46 47 protected: 48 void mouseMoveEvent(QMouseEvent * event); 49 50 private: 51 bool _enabled; 52 }; 53 54 class ModulatorSplitter: public QSplitter 55 { 56 Q_OBJECT 57 58 public: 59 ModulatorSplitter(QWidget *parent, QWidget *table, ModulatorEditor *modEditor, bool isPrst); 60 61 protected: 62 QSplitterHandle *createHandle(); 63 64 private slots: 65 void splitterMoved(int pos, int index); 66 void expandedStateChanged(bool isExpanded); 67 68 private: 69 static QVariantList toVariantList(QList<int> list); 70 static QList<int> fromVariantList(QVariantList list); 71 72 bool _isPrst; 73 bool _isExpanded; 74 ModulatorEditor * _modEditor; 75 }; 76 77 #endif // MODULATORSPLITTER_H 78