add theme files to default target, and install using target names
[ardour.git] / gtk2_ardour / midi_region_view.h
index c768a539c216d70b704cae9aaed1aeaaf4a5656c..243dbc2d698ab2cd8bb48c19a7f77d1d688e3d32 100644 (file)
@@ -79,11 +79,15 @@ class MidiRegionView : public RegionView
        inline double note_height() const
                { return contents_height() / (double)contents_note_range(); }
                        
-       inline double note_y(uint8_t note) const
+       inline double note_to_y(uint8_t note) const
                { return trackview.height
                                - (contents_height() * (note - midi_stream_view()->lowest_note() + 1))
                                - footer_height() - 3.0; }
        
+       inline uint8_t y_to_note(double y) const
+               { return (uint8_t)floor((contents_height() - y)
+                               / contents_height() * (double)contents_note_range()); }
+       
        void set_y_position_and_height (double, double);
     
     void show_region_editor ();
@@ -101,11 +105,19 @@ class MidiRegionView : public RegionView
 
        void display_model(boost::shared_ptr<ARDOUR::MidiModel> model);
 
+       /* This stuff is a bit boilerplatey ATM.  Work in progress. */
+
        inline void start_remove_command() {
                _command_mode = Remove;
                if (!_delta_command)
                        _delta_command = _model->new_delta_command();
        }
+       
+       inline void start_delta_command() {
+               _command_mode = Delta;
+               if (!_delta_command)
+                       _delta_command = _model->new_delta_command();
+       }
 
        void command_remove_note(ArdourCanvas::CanvasMidiEvent* ev) {
                if (_delta_command && ev->note()) {
@@ -113,6 +125,12 @@ class MidiRegionView : public RegionView
                        ev->selected(true);
                }
        }
+       
+       void command_add_note(ARDOUR::MidiModel::Note& note) {
+               if (_delta_command) {
+                       _delta_command->add(note);
+               }
+       }
 
        void note_entered(ArdourCanvas::CanvasMidiEvent* ev) {
                if (_command_mode == Remove && _delta_command && ev->note())
@@ -169,7 +187,7 @@ class MidiRegionView : public RegionView
        ArdourCanvas::CanvasNote**           _active_notes;
        ARDOUR::MidiModel::DeltaCommand*     _delta_command;
        
-       enum CommandMode { None, Remove };
+       enum CommandMode { None, Remove, Delta };
        CommandMode _command_mode;
 
 };