When inserting new notes with the pencil tool, make them the length of the grid subvi...
authorCarl Hetherington <carl@carlh.net>
Sun, 16 May 2010 23:43:14 +0000 (23:43 +0000)
committerCarl Hetherington <carl@carlh.net>
Sun, 16 May 2010 23:43:14 +0000 (23:43 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@7109 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/midi_region_view.cc
gtk2_ardour/midi_region_view.h

index a0ccd7b9ad00f376c8552e1b539c6b43a7803550..b9bbff74d105126f8036532ec86574902fef1c06 100644 (file)
@@ -76,7 +76,6 @@ MidiRegionView::MidiRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &
        : RegionView (parent, tv, r, spu, basic_color)
        , _force_channel(-1)
        , _last_channel_selection(0xFFFF)
-       , _default_note_length(1.0)
        , _current_range_min(0)
        , _current_range_max(0)
        , _model_name(string())
@@ -101,7 +100,6 @@ MidiRegionView::MidiRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &
        : RegionView (parent, tv, r, spu, basic_color, false, visibility)
        , _force_channel(-1)
        , _last_channel_selection(0xFFFF)
-       , _default_note_length(1.0)
        , _model_name(string())
        , _custom_device_mode(string())
        , _active_notes(0)
@@ -125,7 +123,6 @@ MidiRegionView::MidiRegionView (const MidiRegionView& other)
        , RegionView (other)
        , _force_channel(-1)
        , _last_channel_selection(0xFFFF)
-       , _default_note_length(1.0)
        , _model_name(string())
        , _custom_device_mode(string())
        , _active_notes(0)
@@ -152,7 +149,6 @@ MidiRegionView::MidiRegionView (const MidiRegionView& other, boost::shared_ptr<M
        : RegionView (other, boost::shared_ptr<Region> (region))
        , _force_channel(-1)
        , _last_channel_selection(0xFFFF)
-       , _default_note_length(1.0)
        , _model_name(string())
        , _custom_device_mode(string())
        , _active_notes(0)
@@ -493,8 +489,16 @@ MidiRegionView::canvas_event(GdkEvent* ev)
                                clear_selection();
                                break;
                        case MouseRange:
-                               create_note_at(event_x, event_y, _default_note_length);
+                       {
+                               bool success;
+                               Evoral::MusicalTime beats = trackview.editor().get_grid_type_as_beats (success, trackview.editor().pixel_to_frame (event_x));
+                               if (!success) {
+                                       beats = 1;
+                               }
+                               
+                               create_note_at (event_x, event_y, beats);
                                break;
+                       }
                        default:
                                break;
                        }
index ea0595308079062caf42ed0e86e7421318c1cca8..21d81cf2f8041c441f06c1ff556cd20e73bacc01 100644 (file)
@@ -347,7 +347,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;