Remove unnecessary height changed notification for streamviews, now that the summary...
[ardour.git] / gtk2_ardour / midi_region_view.h
index 36b7c99f54ab29c5f343c1ef6dd6bf033fe41bf5..6c5dff9ff2b5fefe24738e7d7f1275094c79b170 100644 (file)
@@ -24,6 +24,9 @@
 
 #include <libgnomecanvasmm.h>
 #include <libgnomecanvasmm/polygon.h>
+
+#include "pbd/signals.h"
+
 #include "ardour/midi_track.h"
 #include "ardour/midi_region.h"
 #include "ardour/midi_model.h"
@@ -60,12 +63,13 @@ class GhostRegion;
 class AutomationTimeAxisView;
 class AutomationRegionView;
 class MidiCutBuffer;
+class MidiListEditor;
 
 class MidiRegionView : public RegionView
 {
   public:
        typedef Evoral::Note<Evoral::MusicalTime> NoteType;
-       typedef Evoral::Sequence<Evoral::MusicalTime>::Notes NoteList;
+       typedef Evoral::Sequence<Evoral::MusicalTime>::Notes Notes;
 
        MidiRegionView (ArdourCanvas::Group *,
                        RouteTimeAxisView&,
@@ -169,17 +173,13 @@ class MidiRegionView : public RegionView
 
        void display_model(boost::shared_ptr<ARDOUR::MidiModel> model);
 
-       void start_delta_command(std::string name = "midi edit");
-       void delta_add_note(const boost::shared_ptr<NoteType> note, bool selected, bool show_velocity=false);
-       void delta_remove_note(ArdourCanvas::CanvasNoteEvent* ev);
-
        void start_diff_command(std::string name = "midi edit");
        void diff_add_change(ArdourCanvas::CanvasNoteEvent* ev, ARDOUR::MidiModel::DiffCommand::Property, uint8_t val);
        void diff_add_change(ArdourCanvas::CanvasNoteEvent* ev, ARDOUR::MidiModel::DiffCommand::Property, Evoral::MusicalTime val);
+       void diff_add_note(const boost::shared_ptr<NoteType> note, bool selected, bool show_velocity=false);
+       void diff_remove_note(ArdourCanvas::CanvasNoteEvent* ev);
 
-       void apply_delta();
        void apply_diff();
-       void apply_delta_as_subcommand();
        void apply_diff_as_subcommand();
        void abort_command();
 
@@ -189,11 +189,15 @@ class MidiRegionView : public RegionView
        void   note_selected(ArdourCanvas::CanvasNoteEvent* ev, bool add, bool extend=false);
        void   note_deselected(ArdourCanvas::CanvasNoteEvent* ev);
        void   delete_selection();
+       void   delete_note (boost::shared_ptr<NoteType>);
        size_t selection_size() { return _selection.size(); }
 
        void move_selection(double dx, double dy);
        void note_dropped(ArdourCanvas::CanvasNoteEvent* ev, double d_pixels, int8_t d_note);
 
+       void select_matching_notes (uint8_t notenum, uint16_t channel_mask, bool add, bool extend);
+       void toggle_matching_notes (uint8_t notenum, uint16_t channel_mask);
+
        /** Return true iff the note is within the extent of the region.
         * @param visible will be set to true if the note is within the visible note range, false otherwise.
         */
@@ -211,20 +215,8 @@ class MidiRegionView : public RegionView
         */
        void begin_resizing(bool at_front);
 
-       /** Update resizing notes while user drags.
-        * @param at_front which end of the note (true == note on, false == note off)
-        * @param x the difference in mouse motion, ie the motion difference if relative=true
-        *           or the absolute mouse position (track-relative) if relative is false
-        * @param relative true if relative resizing is taking place, false if absolute resizing
-        */
-       void update_resizing(bool at_front, double x, bool relative);
-
-       /** Finish resizing notes when the user releases the mouse button.
-        * @param at_front which end of the note (true == note on, false == note off)
-        * @param event_x the absolute mouse position (track-relative)
-        * @param relative true if relative resizing is taking place, false if absolute resizing
-        */
-       void commit_resizing(bool at_front, double event_x, bool relative);
+       void update_resizing (ArdourCanvas::CanvasNote *, bool, double, bool);
+       void commit_resizing (ArdourCanvas::CanvasNote *, bool, double, bool);
 
        /** Adjust the velocity on a note, and the selection if applicable.
         * @param velocity the relative or absolute velocity
@@ -274,7 +266,7 @@ class MidiRegionView : public RegionView
        nframes64_t beats_to_frames(double beats) const;
 
        /** Convert a timestamp in frames to beats (both relative to region start) */
-       double frames_to_beats(nframes64_t beats) const;
+       double frames_to_beats(nframes64_t) const;
 
        void goto_previous_note ();
        void goto_next_note ();
@@ -285,7 +277,7 @@ class MidiRegionView : public RegionView
 
        void show_list_editor ();
 
-       void selection_as_notelist (NoteList& selected);
+       void selection_as_notelist (Notes& selected, bool allow_all_if_none_selected = false);
 
   protected:
        /** Allows derived types to specify their visibility requirements
@@ -298,7 +290,7 @@ class MidiRegionView : public RegionView
                        Gdk::Color& basic_color,
                        TimeAxisViewItem::Visibility);
 
-       void region_resized (ARDOUR::Change);
+       void region_resized (const PBD::PropertyChange&);
 
        void set_flags (XMLNode *);
        void store_flags ();
@@ -340,7 +332,6 @@ class MidiRegionView : public RegionView
 
        int8_t   _force_channel;
        uint16_t _last_channel_selection;
-       double   _default_note_length;
        uint8_t  _current_range_min;
        uint8_t  _current_range_max;
 
@@ -360,8 +351,15 @@ class MidiRegionView : public RegionView
        SysExes                              _sys_exes;
        ArdourCanvas::CanvasNote**           _active_notes;
        ArdourCanvas::Group*                 _note_group;
-       ARDOUR::MidiModel::DeltaCommand*     _delta_command;
        ARDOUR::MidiModel::DiffCommand*      _diff_command;
+       ArdourCanvas::CanvasNote*            _ghost_note;
+       double                               _last_ghost_x;
+       double                               _last_ghost_y;
+        double                               _drag_start_x;
+        double                               _drag_start_y;
+        double                               _last_x;
+        double                               _last_y;
+       ArdourCanvas::SimpleRect*            _drag_rect;
 
        MouseState _mouse_state;
        int _pressed_button;
@@ -386,14 +384,39 @@ class MidiRegionView : public RegionView
        std::vector<NoteResizeData *> _resize_data;
 
        /* connection used to connect to model's ContentChanged signal */
-       sigc::connection content_connection;
+       PBD::ScopedConnection content_connection;
 
        ArdourCanvas::CanvasNoteEvent* find_canvas_note (boost::shared_ptr<NoteType>);
        Events::iterator _optimization_iterator;
 
        void update_note (ArdourCanvas::CanvasNote*);
        void update_hit (ArdourCanvas::CanvasHit*);
+       void create_ghost_note (double, double);
+       void update_ghost_note (double, double);
+
+       MidiListEditor* _list_editor;
+       bool no_sound_notes;
+
+        PBD::ScopedConnection note_delete_connection;
+        void maybe_remove_deleted_note_from_selection (ArdourCanvas::CanvasNoteEvent*);
+
+       void snap_changed ();
+       PBD::ScopedConnection snap_changed_connection;
+
+       void show_verbose_canvas_cursor (boost::shared_ptr<NoteType>) const;
+
+        bool motion (GdkEventMotion*);
+        bool scroll (GdkEventScroll*);
+        bool key_press (GdkEventKey*);
+        bool key_release (GdkEventKey*);
+        bool button_press (GdkEventButton*);
+        bool button_release (GdkEventButton*);
+        bool enter_notify (GdkEventCrossing*);
+        bool leave_notify (GdkEventCrossing*);
 
+        void drop_down_keys ();
+        void maybe_select_by_position (GdkEventButton* ev, double x, double y);
+        void get_events (Events& e, Evoral::Sequence<Evoral::MusicalTime>::NoteOperator op, uint8_t val, int chan_mask = 0);
 };