Tweak Lua-doc processing:
[ardour.git] / gtk2_ardour / midi_region_view.cc
index fc1b525e18415ad1642be71739304ca1ce5c7ea1..b3d2f4f00708e07cbb676fdc3361873f42da1a56 100644 (file)
@@ -1,21 +1,29 @@
 /*
-    Copyright (C) 2001-2011 Paul Davis
-    Author: David Robillard
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
+ * Copyright (C) 2006-2016 David Robillard <d@drobilla.net>
+ * Copyright (C) 2007-2012 Carl Hetherington <carl@carlh.net>
+ * Copyright (C) 2007-2018 Paul Davis <paul@linuxaudiosystems.com>
+ * Copyright (C) 2008-2012 Hans Baier <hansfbaier@googlemail.com>
+ * Copyright (C) 2013-2017 John Emmas <john@creativepost.co.uk>
+ * Copyright (C) 2014-2017 Nick Mainsbridge <mainsbridge@gmail.com>
+ * Copyright (C) 2014-2018 Ben Loftis <ben@harrisonconsoles.com>
+ * Copyright (C) 2014-2019 Robin Gareus <robin@gareus.org>
+ * Copyright (C) 2015-2016 Tim Mayberry <mojofunk@gmail.com>
+ * Copyright (C) 2015-2017 AndrĂ© Nusser <andre.nusser@googlemail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
 
 #include <cmath>
 #include <algorithm>
@@ -423,7 +431,7 @@ MidiRegionView::leave_notify (GdkEventCrossing*)
 void
 MidiRegionView::mouse_mode_changed ()
 {
-       // Adjust sample colour (become more transparent for internal tools)
+       // Adjust frame colour (become more transparent for internal tools)
        set_frame_color();
 
        if (_entered) {
@@ -464,7 +472,7 @@ MidiRegionView::enter_internal (uint32_t state)
                _grabbed_keyboard = true;
        }
 
-       // Lower sample handles below notes so they don't steal events
+       // Lower frame handles below notes so they don't steal events
        if (frame_handle_start) {
                frame_handle_start->lower_to_bottom();
        }
@@ -485,7 +493,7 @@ MidiRegionView::leave_internal()
                _grabbed_keyboard = false;
        }
 
-       // Raise sample handles above notes so they catch events
+       // Raise frame handles above notes so they catch events
        if (frame_handle_start) {
                frame_handle_start->raise_to_top();
        }
@@ -2996,8 +3004,9 @@ MidiRegionView::update_resizing (NoteBase* primary, bool at_front, double delta_
                }
 
                if (current_x < 0) {
-                       // This works even with snapping because RegionView::snap_sample_to_sample()
-                       // snaps forward if the snapped sample is before the beginning of the region
+                       /* This works even with snapping because RegionView::snap_sample_to_sample()
+                        * snaps forward if the snapped sample is before the beginning of the region
+                        */
                        current_x = 0;
                }
                if (current_x > trackview.editor().sample_to_pixel(_region->length())) {
@@ -3030,7 +3039,7 @@ MidiRegionView::update_resizing (NoteBase* primary, bool at_front, double delta_
                        if (snap_delta_samps > 0) {
                                snap_delta_beats = region_samples_to_region_beats_double (snap_delta_samps);
                        } else if (snap_delta_samps < 0) {
-                               snap_delta_beats = region_samples_to_region_beats_double ( - snap_delta_samps);
+                               snap_delta_beats = region_samples_to_region_beats_double (- snap_delta_samps);
                                sign = -1;
                        }
 
@@ -3045,7 +3054,8 @@ MidiRegionView::update_resizing (NoteBase* primary, bool at_front, double delta_
                        }
 
                        const Temporal::Beats beats = Temporal::Beats (tmap.exact_beat_at_sample (snapped_x + midi_region()->position(), divisions)
-                                                                    - midi_region()->beat()) + midi_region()->start_beats();
+                                                                      - midi_region()->beat())
+                                                     + midi_region()->start_beats();
 
                        Temporal::Beats len         = Temporal::Beats();
 
@@ -3796,8 +3806,8 @@ MidiRegionView::paste_internal (samplepos_t pos, unsigned paste_count, float tim
        const Temporal::Beats duration      = last_time - first_time;
        const Temporal::Beats snap_duration = duration.snap_to(snap_beats);
        const Temporal::Beats paste_offset  = snap_duration * paste_count;
-       const Temporal::Beats quarter_note     = absolute_samples_to_source_beats(pos) + paste_offset;
-       Temporal::Beats     end_point     = Temporal::Beats();
+       const Temporal::Beats quarter_note  = absolute_samples_to_source_beats(pos) + paste_offset;
+       Temporal::Beats       end_point     = Temporal::Beats();
 
        DEBUG_TRACE (DEBUG::CutNPaste, string_compose ("Paste data spans from %1 to %2 (%3) ; paste pos beats = %4 (based on %5 - %6)\n",
                                                       first_time,
@@ -4159,9 +4169,10 @@ MidiRegionView::set_step_edit_cursor_width (Temporal::Beats beats)
        _step_edit_cursor_width = beats;
 
        if (_step_edit_cursor) {
-               _step_edit_cursor->set_x1 (_step_edit_cursor->x0() + trackview.editor().sample_to_pixel (
-                                                  region_beats_to_region_samples (_step_edit_cursor_position + beats)
-                                                  - region_beats_to_region_samples (_step_edit_cursor_position)));
+               _step_edit_cursor->set_x1 (_step_edit_cursor->x0()
+                                          + trackview.editor().sample_to_pixel (
+                                            region_beats_to_region_samples (_step_edit_cursor_position + beats)
+                                            - region_beats_to_region_samples (_step_edit_cursor_position)));
        }
 }
 
@@ -4201,7 +4212,7 @@ MidiRegionView::data_recorded (boost::weak_ptr<MidiSource> w)
 
                /* convert from session samples to source beats */
                Temporal::Beats const time_beats = _source_relative_time_converter.from(
-                       ev.time() - src->timeline_position() + _region->start());
+                       ev.time() - src->natural_position() + _region->start());
 
                if (ev.type() == MIDI_CMD_NOTE_ON) {
                        boost::shared_ptr<NoteType> note (