1 /* 2 * Hydrogen 3 * Copyright(c) 2002-2008 by Alex >Comix< Cominu [comix@users.sourceforge.net] 4 * 5 * http://www.hydrogen-music.org 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 2 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, write to the Free Software 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 * 21 */ 22 23 24 #ifndef PATTERN_EDITOR_INSTRUMENT_LIST_H 25 #define PATTERN_EDITOR_INSTRUMENT_LIST_H 26 27 28 #include <hydrogen/globals.h> 29 30 #include <QtGui> 31 #if QT_VERSION >= 0x050000 32 # include <QtWidgets> 33 #endif 34 35 #include <hydrogen/object.h> 36 #include "../Widgets/PixmapWidget.h" 37 38 namespace H2Core 39 { 40 class Pattern; 41 } 42 43 class PatternEditorPanel; 44 class ToggleButton; 45 46 class InstrumentLine : public PixmapWidget 47 { 48 H2_OBJECT 49 Q_OBJECT 50 51 public: 52 InstrumentLine(QWidget* pParent); 53 54 void setName(const QString& sName); 55 void setSelected(bool isSelected); 56 void setNumber(int nIndex); 57 void setMuted(bool isMuted); 58 void setSoloed( bool soloed ); 59 60 private slots: 61 void functionClearNotes(); 62 63 void functionFillAllNotes(); 64 void functionFillEveryTwoNotes(); 65 void functionFillEveryThreeNotes(); 66 void functionFillEveryFourNotes(); 67 void functionFillEverySixNotes(); 68 void functionFillEveryEightNotes(); 69 void functionFillEveryTwelveNotes(); 70 void functionFillEverySixteenNotes(); 71 void functionFillNotes( int every ); 72 void functionCopyInstrumentPattern(); 73 void functionCopyAllInstrumentPatterns(); 74 void functionPasteInstrumentPattern(); 75 void functionPasteAllInstrumentPatterns(); 76 void functionPasteInstrumentPatternExec(int patternID); 77 78 void functionRandomizeVelocity(); 79 void functionDeleteInstrument(); 80 void functionRenameInstrument(); 81 void muteClicked(); 82 void soloClicked(); 83 84 85 private: 86 QMenu *m_pFunctionPopup; 87 QMenu *m_pFunctionPopupSub; 88 QMenu *m_pCopyPopupSub; 89 QMenu *m_pPastePopupSub; 90 QLabel *m_pNameLbl; 91 bool m_bIsSelected; 92 int m_nInstrumentNumber; ///< The related instrument number 93 ToggleButton *m_pMuteBtn; 94 ToggleButton *m_pSoloBtn; 95 96 virtual void mousePressEvent(QMouseEvent *ev); 97 H2Core::Pattern* getCurrentPattern(); 98 }; 99 100 101 class PatternEditorInstrumentList : public QWidget, public H2Core::Object { 102 H2_OBJECT 103 Q_OBJECT 104 105 public: 106 PatternEditorInstrumentList( QWidget *parent, PatternEditorPanel *pPatternEditorPanel ); 107 ~PatternEditorInstrumentList(); 108 109 virtual void mousePressEvent(QMouseEvent *event); 110 virtual void mouseMoveEvent(QMouseEvent *event); 111 112 113 virtual void dragEnterEvent(QDragEnterEvent *event); 114 virtual void dropEvent(QDropEvent *event); 115 116 117 public slots: 118 void updateInstrumentLines(); 119 120 121 protected: 122 PatternEditorPanel *m_pPatternEditorPanel; 123 H2Core::Pattern *m_pPattern; 124 uint m_nGridHeight; 125 uint m_nEditorWidth; 126 uint m_nEditorHeight; 127 InstrumentLine* m_pInstrumentLine[MAX_INSTRUMENTS]; 128 QTimer *m_pUpdateTimer; 129 130 QPoint __drag_start_position; 131 132 InstrumentLine* createInstrumentLine(); 133 134 }; 135 136 137 #endif 138