diff options
Diffstat (limited to 'muse2/muse/midiedit/dcanvas.h')
-rw-r--r-- | muse2/muse/midiedit/dcanvas.h | 60 |
1 files changed, 54 insertions, 6 deletions
diff --git a/muse2/muse/midiedit/dcanvas.h b/muse2/muse/midiedit/dcanvas.h index 5417a187..ae647709 100644 --- a/muse2/muse/midiedit/dcanvas.h +++ b/muse2/muse/midiedit/dcanvas.h @@ -26,6 +26,9 @@ #include "ecanvas.h" #include "song.h" #include "steprec.h" +#include <map> +#include <QList> +#include <QSet> #define TH 18 @@ -36,11 +39,11 @@ class QDropEvent; class QDragMoveEvent; class QDragLeaveEvent; +class DrumMap; namespace MusEGui { class MidiEditor; -class PianoRoll; -class ScrollScale; +class DrumEdit; //--------------------------------------------------------- // DEvent @@ -49,9 +52,38 @@ class ScrollScale; class DEvent : public CItem { public: - DEvent(MusECore::Event e, MusECore::Part* p); + DEvent(MusECore::Event e, MusECore::Part* p, int instr); }; + +struct instrument_number_mapping_t //FINDMICH TODO move into a suitable namespace! +{ + QSet<MusECore::Track*> tracks; + int pitch; + + instrument_number_mapping_t() + { + pitch=-1; + tracks.clear(); + } + + instrument_number_mapping_t(const QSet<MusECore::Track*>& tr, int p) + { + tracks=tr; + pitch=p; + } + + bool operator==(const instrument_number_mapping_t& that) //TODO maybe compare the Track* serial numbers, not the pointers themselves? + { + return (this->tracks == that.tracks && this->pitch==that.pitch); + } + + bool operator!=(const instrument_number_mapping_t& that) + { + return !operator==(that); + } +}; + //--------------------------------------------------------- // DrumCanvas //--------------------------------------------------------- @@ -59,6 +91,13 @@ class DEvent : public CItem { class DrumCanvas : public EventCanvas { Q_OBJECT + bool old_style_drummap_mode; + MusECore::DrumMap* ourDrumMap; + bool must_delete_our_drum_map; //FINDMICH really delete it! + QVector<instrument_number_mapping_t> instrument_map; + + DrumEdit* drumEditor; + MusECore::StepRec* steprec; // Cursor tool position @@ -71,7 +110,7 @@ class DrumCanvas : public EventCanvas { void drawTopItem(QPainter& p, const QRect& rect); virtual void drawMoving(QPainter&, const CItem*, const QRect&); virtual MusECore::Undo moveCanvasItems(CItemList&, int, int, DragType); - virtual MusECore::UndoOp moveItem(CItem*, const QPoint&, DragType); + virtual bool moveItem(MusECore::Undo&, CItem*, const QPoint&, DragType); virtual CItem* newItem(const QPoint&, int); virtual void resizeItem(CItem*, bool, bool); virtual void newItem(CItem*, bool); @@ -89,9 +128,10 @@ class DrumCanvas : public EventCanvas { virtual void resizeEvent(QResizeEvent*); virtual void curPartChanged(); int getNextStep(unsigned int pos, int basicStep, int stepSize=1); - + signals: void newWidth(int); + void ourDrumMapChanged(bool /*instrumentMap changed as well?*/); private slots: void midiNote(int pitch, int velo); @@ -111,7 +151,8 @@ class DrumCanvas : public EventCanvas { CMD_SELECT_ALL, CMD_SELECT_NONE, CMD_SELECT_INVERT, CMD_SELECT_ILOOP, CMD_SELECT_OLOOP, CMD_SELECT_PREV_PART, CMD_SELECT_NEXT_PART, CMD_DEL, CMD_FIXED_LEN, CMD_RIGHT, CMD_LEFT, CMD_RIGHT_NOSNAP, CMD_LEFT_NOSNAP, CMD_MODIFY_VELOCITY, CMD_CRESCENDO, - CMD_QUANTIZE, CMD_ERASE_EVENT, CMD_NOTE_SHIFT, CMD_DELETE_OVERLAPS, CMD_REORDER_LIST + CMD_QUANTIZE, CMD_ERASE_EVENT, CMD_NOTE_SHIFT, CMD_DELETE_OVERLAPS, CMD_REORDER_LIST, + CMD_GROUP_NONE, CMD_GROUP_CHAN, CMD_GROUP_MAX }; DrumCanvas(MidiEditor*, QWidget*, int, int, const char* name = 0); @@ -122,6 +163,13 @@ class DrumCanvas : public EventCanvas { MusECore::Event *getEventAtCursorPos(); void selectCursorEvent(MusECore::Event *ev); + int pitch_and_track_to_instrument(int pitch, MusECore::Track* track); + + MusECore::DrumMap* getOurDrumMap() { return ourDrumMap; } + int getOurDrumMapSize() { return instrument_map.size(); } + QVector<instrument_number_mapping_t>& get_instrument_map() { return instrument_map; } + void propagate_drummap_change(int instrument, bool update_druminmap); + void rebuildOurDrumMap(); }; } // namespace MusEGui |