1 /* 2 * tracker/SectionInstruments.h 3 * 4 * Copyright 2009 Peter Barth 5 * 6 * This file is part of Milkytracker. 7 * 8 * Milkytracker is free software: you can redistribute it and/or modify 9 * it under the terms of the GNU General Public License as published by 10 * the Free Software Foundation, either version 3 of the License, or 11 * (at your option) any later version. 12 * 13 * Milkytracker is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with Milkytracker. If not, see <http://www.gnu.org/licenses/>. 20 * 21 */ 22 23 /* 24 * SectionInstruments.h 25 * MilkyTracker 26 * 27 * Created by Peter Barth on 15.04.05. 28 * 29 */ 30 31 #ifndef SECTIONINSTRUMENTS__H 32 #define SECTIONINSTRUMENTS__H 33 34 #include "BasicTypes.h" 35 #include "Event.h" 36 #include "SectionAbstract.h" 37 38 class PPControl; 39 class EnvelopeEditorControl; 40 class EnvelopeEditor; 41 class PianoControl; 42 class PPContainer; 43 class EnvelopeContainer; 44 45 class SectionInstruments : public SectionAbstract 46 { 47 private: 48 PPContainer* containerEntire; 49 50 PPContainer* containerEnvelopes; 51 PPContainer* containerSampleSlider; 52 PPContainer* containerInstrumentSlider; 53 EnvelopeEditorControl* envelopeEditorControl; 54 PianoControl* pianoControl; 55 pp_int32 currentEnvelopeType; // 0 = Editing volume envelope, 1 = editing panning envelope 56 bool visible; 57 58 EnvelopeContainer* predefinedVolumeEnvelopes; 59 EnvelopeContainer* predefinedPanningEnvelopes; 60 61 bool storeEnvelope; 62 63 EnvelopeEditor* getEnvelopeEditor(); 64 65 protected: 66 virtual void showSection(bool bShow); 67 68 public: 69 SectionInstruments(Tracker& tracker); 70 virtual ~SectionInstruments(); 71 72 // PPEvent listener 73 virtual pp_int32 handleEvent(PPObject* sender, PPEvent* event); 74 75 virtual void init(); 76 77 virtual void init(pp_int32 x, pp_int32 y); 78 79 void realign(); 80 81 virtual void show(bool bShow); 82 83 void updateSampleSliders(bool repaint = true); 84 void updateInstrumentSliders(bool repaint = true); 85 86 virtual void update(bool repaint = true); 87 88 virtual void notifyTabSwitch(); 89 90 virtual void notifySampleSelect(pp_int32 index); 91 92 void updateAfterLoad(); 93 94 void updateEnvelopeWindow(bool repaint = true); 95 96 void updateEnvelopeEditor(bool repaint = true, bool reAttach = false); 97 98 void resetEnvelopeEditor(); 99 void resetPianoAssignment(); 100 getPianoControl()101 PianoControl* getPianoControl() { return pianoControl; } 102 getVisibleEnvelopeType()103 pp_int32 getVisibleEnvelopeType() { return currentEnvelopeType; } 104 105 bool isEnvelopeVisible(); 106 getEnvelopeEditorControl()107 EnvelopeEditorControl* getEnvelopeEditorControl() { return envelopeEditorControl; } 108 isVisible()109 bool isVisible() const { return visible; } 110 111 // Get predefined envelopes for storage purpose 112 pp_int32 getNumPredefinedEnvelopes(); 113 114 enum EnvelopeTypes 115 { 116 EnvelopeTypeVolume, 117 EnvelopeTypePanning 118 }; 119 120 PPString getEncodedEnvelope(EnvelopeTypes type, pp_int32 index); 121 void setEncodedEnvelope(EnvelopeTypes type, pp_int32 index, const PPString& str); 122 123 private: 124 void handleZapInstrument(); 125 void zapInstrument(); 126 127 // Responder should be friend 128 friend class DialogResponderInstruments; 129 130 friend class Tracker; 131 }; 132 133 #endif 134 135