time line items now have 64 bit location + duration; start making note resize apply...
authorPaul Davis <paul@linuxaudiosystems.com>
Wed, 9 Sep 2009 02:09:04 +0000 (02:09 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Wed, 9 Sep 2009 02:09:04 +0000 (02:09 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@5642 d708f5d6-7413-0410-9779-e7cbd77b26cf

14 files changed:
gtk2_ardour/automation_region_view.cc
gtk2_ardour/automation_region_view.h
gtk2_ardour/editor_drag.cc
gtk2_ardour/imageframe_view.cc
gtk2_ardour/imageframe_view.h
gtk2_ardour/marker.cc
gtk2_ardour/marker.h
gtk2_ardour/midi_region_view.cc
gtk2_ardour/midi_region_view.h
gtk2_ardour/mixer_ui.cc
gtk2_ardour/region_view.cc
gtk2_ardour/region_view.h
gtk2_ardour/time_axis_view_item.cc
gtk2_ardour/time_axis_view_item.h

index 5ad736d535f4c62f79f27797c5c7aeb38dc5f0f0..ad10851c7389b04a4c37d74d0ba00f6a312692a0 100644 (file)
@@ -139,7 +139,7 @@ AutomationRegionView::set_height (double h)
 }
 
 bool
-AutomationRegionView::set_position (nframes_t pos, void* src, double* ignored)
+AutomationRegionView::set_position (nframes64_t pos, void* src, double* ignored)
 {
        return RegionView::set_position(pos, src, ignored);
 }
index e6531821d3959dc593f4a1db6a4377bc5514a8d3..6ab9118017b6d726a0d50b0465766abcfab1d71d 100644 (file)
@@ -65,7 +65,7 @@ public:
 
 protected:
        void create_line(boost::shared_ptr<ARDOUR::AutomationList> list);
-       bool set_position(nframes_t pos, void* src, double* ignored);
+       bool set_position(nframes64_t pos, void* src, double* ignored);
        void region_resized(ARDOUR::Change what_changed);
        bool canvas_event(GdkEvent* ev);
        void add_automation_event (GdkEvent* event, nframes_t when, double y);
index fb39a34589cb6cc350b0cfa21081683df633d8b4..0469e45e3685f44723c4fe214151b415bd36522b 100644 (file)
@@ -36,6 +36,8 @@
 #include "audio_time_axis.h"
 #include "midi_time_axis.h"
 #include "canvas-note.h"
+#include "selection.h"
+#include "midi_selection.h"
 
 using namespace std;
 using namespace ARDOUR;
@@ -1415,21 +1417,49 @@ NoteResizeDrag::start_grab (GdkEvent* event, Gdk::Cursor *)
        } else {
                relative = true;
        }
+
+       MidiRegionSelection& ms (_editor->get_selection().midi_regions);
+
+       if (ms.size() > 1) {
+               /* has to be relative, may make no sense otherwise */
+               relative = true;
+       }
        
        region->note_selected (cnote, true);
-       region->begin_resizing (at_front);
+
+       for (MidiRegionSelection::iterator r = ms.begin(); r != ms.end(); ) {
+               MidiRegionSelection::iterator next;
+               next = r;
+               ++next;
+               (*r)->begin_resizing (at_front);
+               r = next;
+       }
 }
 
 void
 NoteResizeDrag::motion (GdkEvent* /*event*/, bool first_move)
 {
-       region->update_resizing (at_front, _current_pointer_x - _grab_x, relative);
+       MidiRegionSelection& ms (_editor->get_selection().midi_regions);
+       for (MidiRegionSelection::iterator r = ms.begin(); r != ms.end();) {
+               MidiRegionSelection::iterator next;
+               next = r;
+               ++next;
+               (*r)->update_resizing (at_front, _current_pointer_x - _grab_x, relative);
+               r = next;
+       }
 } 
 
 void
 NoteResizeDrag::finished (GdkEvent* event, bool movement_occurred)
 {
-       region->commit_resizing (at_front, _current_pointer_x - _grab_x, relative);
+       MidiRegionSelection& ms (_editor->get_selection().midi_regions);
+       for (MidiRegionSelection::iterator r = ms.begin(); r != ms.end();) {
+               MidiRegionSelection::iterator next;
+               next = r;
+               ++next;
+               (*r)->commit_resizing (at_front, _current_pointer_x - _grab_x, relative);
+               r = next;
+       }
 }
 
 void
index 2a419ee2752c3b2910e34e9e515ffaab58cd980b..0b3b01dcba835f490b6df4f652616760af042f1a 100644 (file)
@@ -168,9 +168,9 @@ ImageFrameView::~ImageFrameView()
  * @return true if the position change was a success, false otherwise
  */
 bool
-ImageFrameView::set_position(nframes_t pos, void* src, double* delta)
+ImageFrameView::set_position(nframes64_t pos, void* src, double* delta)
 {
-       nframes_t old_pos = frame_position ;
+       nframes64_t old_pos = frame_position ;
        
        // do the standard stuff
        bool ret = TimeAxisViewItem::set_position(pos, src, delta) ;
@@ -182,7 +182,7 @@ ImageFrameView::set_position(nframes_t pos, void* src, double* delta)
                {
                        // calculate the offset of the marker
                        MarkerView* mv = (MarkerView*)*i ;
-                       nframes_t marker_old_pos = mv->get_position() ;
+                       nframes64_t marker_old_pos = mv->get_position() ;
                        
                        mv->set_position(pos + (marker_old_pos - old_pos), src) ;
                }
@@ -199,7 +199,7 @@ ImageFrameView::set_position(nframes_t pos, void* src, double* delta)
  * @return true if the duration change was succesful, false otherwise
  */
 bool
-ImageFrameView::set_duration(nframes_t dur, void* src)
+ImageFrameView::set_duration(nframes64_t dur, void* src)
 {
        /* do the standard stuff */
        bool ret = TimeAxisViewItem::set_duration(dur, src) ;
index db83264e46764061a3efbc383f3da05cb2780713..202685365460c2a2b73cec748930965c8499d488 100644 (file)
@@ -90,7 +90,7 @@ class ImageFrameView : public TimeAxisViewItem
                 * @param src the identity of the object that initiated the change
                 * @return true if the position change was a success, false otherwise
                 */
-               virtual bool set_position(nframes_t pos, void* src, double* delta = 0) ;
+               virtual bool set_position(nframes64_t pos, void* src, double* delta = 0) ;
                
                /**
                 * Sets the duration of this item
@@ -99,7 +99,7 @@ class ImageFrameView : public TimeAxisViewItem
                 * @param src the identity of the object that initiated the change
                 * @return true if the duration change was succesful, false otherwise
                 */
-               virtual bool set_duration(nframes_t dur, void* src) ;
+               virtual bool set_duration(nframes64_t dur, void* src) ;
                
                //---------------------------------------------------------------------------------------//
                // Parent Component Methods
index 131354e72e0f4024ff173c456cc202dceadf5665..bc971281028a3e14e544729f7e918469d8ce9292 100644 (file)
@@ -390,7 +390,7 @@ Marker::set_name (const string& new_name)
 }
 
 void
-Marker::set_position (nframes_t frame)
+Marker::set_position (nframes64_t frame)
 {
        double new_unit_position = editor.frame_to_unit (frame);
        new_unit_position -= shift;
index fe6cac75c474cd5b57d3053ad1edf5c5657744c0..a379f010c96a9c34e3ff941d620db16e39c9be92 100644 (file)
@@ -65,7 +65,7 @@ class Marker : public PBD::Destructible
        void hide_line ();
        void set_line_vpos (double y_origin, double height);
 
-       void set_position (nframes_t);
+       void set_position (nframes64_t);
        void set_name (const std::string&);
        void set_color_rgba (uint32_t rgba);
        
index b4acdc7f5ee21e50b1f00ba8083b5ff636a97a76..4ef0ead38ecf681decfda7d54433d91fc36da84f 100644 (file)
@@ -1669,6 +1669,13 @@ MidiRegionView::get_position_pixels()
        return trackview.editor().frame_to_pixel(region_frame);
 }
 
+double
+MidiRegionView::get_end_position_pixels()
+{
+       nframes64_t frame = get_position() + get_duration ();
+       return trackview.editor().frame_to_pixel(frame);
+}
+
 nframes64_t
 MidiRegionView::beats_to_frames(double beats) const
 {
@@ -1727,7 +1734,6 @@ MidiRegionView::update_resizing (bool at_front, double delta_x, bool relative)
        for (std::vector<NoteResizeData *>::iterator i = _resize_data.begin(); i != _resize_data.end(); ++i) {
                SimpleRect* resize_rect = (*i)->resize_rect;
                CanvasNote* canvas_note = (*i)->canvas_note;
-               const double region_start = get_position_pixels();
                double current_x;
 
                if (at_front) {
@@ -1735,14 +1741,14 @@ MidiRegionView::update_resizing (bool at_front, double delta_x, bool relative)
                                current_x = canvas_note->x1() + delta_x;
                        } else {
                                // x is in track relative, transform it to region relative
-                               current_x = delta_x - region_start;
+                               current_x = delta_x - get_position_pixels();
                        }
                } else {
                        if (relative) {
                                current_x = canvas_note->x2() + delta_x;
                        } else {
                                // x is in track relative, transform it to region relative
-                               current_x = delta_x - region_start;
+                               current_x = delta_x - get_end_position_pixels ();
                        }
                }
                
@@ -1772,14 +1778,14 @@ MidiRegionView::commit_resizing (bool at_front, double delta_x, bool relative)
                                current_x = canvas_note->x1() + delta_x;
                        } else {
                                // x is in track relative, transform it to region relative
-                               current_x = delta_x - region_start;
+                               current_x = region_start + delta_x;
                        }
                } else {
                        if (relative) {
                                current_x = canvas_note->x2() + delta_x;
                        } else {
                                // x is in track relative, transform it to region relative
-                               current_x = delta_x - region_start;
+                               current_x = region_start + delta_x;
                        }
                }
                
@@ -1787,7 +1793,6 @@ MidiRegionView::commit_resizing (bool at_front, double delta_x, bool relative)
                current_x = frames_to_beats (current_x);
 
                if (at_front && current_x < canvas_note->note()->end_time()) {
-
                        diff_add_change (canvas_note, MidiModel::DiffCommand::StartTime, current_x);
                }
 
index 08dea544e213d9abdd937720855f43a8c4070276..8bbd535a486e40f2602a804761ba9f4785f7d5c4 100644 (file)
@@ -199,6 +199,9 @@ class MidiRegionView : public RegionView
        /** Get the region position in pixels relative to session. */
        double get_position_pixels();
 
+       /** Get the region end position in pixels relative to session. */
+       double get_end_position_pixels();
+
        /** Begin resizing of some notes.
         * Called by CanvasMidiNote when resizing starts.
         * @param at_front which end of the note (true == note on, false == note off)
index 37cc14b8b012d3d67edf457fcaf441e51bc501cf..83a35bcb9670ae19beb6c1437b58071d5291195b 100644 (file)
@@ -393,7 +393,7 @@ Mixer_UI::sync_order_keys (string const & src)
        for (order = 0, ri = rows.begin(); ri != rows.end(); ++ri, ++order) {
                boost::shared_ptr<Route> route = (*ri)[track_columns.route];
                int old_key = order;
-               int new_key = route->order_key (N_("signal"));
+               unsigned int new_key = route->order_key (N_("signal"));
 
                assert (new_key < neworder.size());
                neworder[new_key] = old_key;
index b8ebc8fe8940e57ce86ab1fc9b9a6078a3e8a575..c3d48d4aa22572675f33833014472f7ae98bc12d 100644 (file)
@@ -310,7 +310,7 @@ RegionView::lower_to_bottom ()
 }
 
 bool
-RegionView::set_position (nframes_t pos, void* /*src*/, double* ignored)
+RegionView::set_position (nframes64_t pos, void* /*src*/, double* ignored)
 {
        double delta;
        bool ret;
@@ -346,7 +346,7 @@ RegionView::set_samples_per_unit (gdouble spu)
 }
 
 bool
-RegionView::set_duration (nframes_t frames, void *src)
+RegionView::set_duration (nframes64_t frames, void *src)
 {
        if (!TimeAxisViewItem::set_duration (frames, src)) {
                return false;
index af7cb0369d54fae2279649859b3412587e712528..3f2f71eda457b9e13c59c4870a54aaf05f6e46c6 100644 (file)
@@ -62,14 +62,14 @@ class RegionView : public TimeAxisViewItem
        
        virtual void set_height (double);
        virtual void set_samples_per_unit (double);
-       virtual bool set_duration (nframes_t, void*);
+       virtual bool set_duration (nframes64_t, void*);
        
        void move (double xdelta, double ydelta);
        
        void raise_to_top ();
        void lower_to_bottom ();
 
-       bool set_position(nframes_t pos, void* src, double* delta = 0);
+       bool set_position(nframes64_t pos, void* src, double* delta = 0);
        void fake_set_opaque (bool yn);
        
        virtual void show_region_editor () {}
index 47a8d6a3225e12d3c0cd3414eabf523064f06cbc..2236050792b76696ad80b5cbf93a2d35171ff7b7 100644 (file)
@@ -75,7 +75,7 @@ double TimeAxisViewItem::NAME_HIGHLIGHT_THRESH;
  * @param duration the duration of this item
  */
 TimeAxisViewItem::TimeAxisViewItem(const string & it_name, ArdourCanvas::Group& parent, TimeAxisView& tv, double spu, Gdk::Color const & base_color, 
-                                  nframes_t start, nframes_t duration, bool recording,
+                                  nframes64_t start, nframes64_t duration, bool recording,
                                   Visibility vis)
        : trackview (tv), _recregion(recording)
 {
@@ -130,7 +130,7 @@ TimeAxisViewItem::TimeAxisViewItem (const TimeAxisViewItem& other)
 }
 
 void
-TimeAxisViewItem::init (const string& it_name, double spu, Gdk::Color const & base_color, nframes_t start, nframes_t duration, Visibility vis)
+TimeAxisViewItem::init (const string& it_name, double spu, Gdk::Color const & base_color, nframes64_t start, nframes64_t duration, Visibility vis)
 {
        item_name = it_name ;
        samples_per_unit = spu ;
@@ -238,7 +238,7 @@ TimeAxisViewItem::~TimeAxisViewItem()
  * @return true if the position change was a success, false otherwise
  */
 bool
-TimeAxisViewItem::set_position(nframes_t pos, void* src, double* delta)
+TimeAxisViewItem::set_position(nframes64_t pos, void* src, double* delta)
 {
        if (position_locked) {
                return false;
@@ -278,7 +278,7 @@ TimeAxisViewItem::set_position(nframes_t pos, void* src, double* delta)
  *
  * @return the position of this item
  */
-nframes_t
+nframes64_t
 TimeAxisViewItem::get_position() const
 {
        return frame_position;
@@ -292,7 +292,7 @@ TimeAxisViewItem::get_position() const
  * @return true if the duration change was succesful, false otherwise
  */
 bool
-TimeAxisViewItem::set_duration (nframes_t dur, void* src)
+TimeAxisViewItem::set_duration (nframes64_t dur, void* src)
 {
        if ((dur > max_item_duration) || (dur < min_item_duration)) {
                warning << string_compose (_("new duration %1 frames is out of bounds for %2"), get_item_name(), dur)
@@ -316,7 +316,7 @@ TimeAxisViewItem::set_duration (nframes_t dur, void* src)
  * Returns the duration of this item
  *
  */
-nframes_t
+nframes64_t
 TimeAxisViewItem::get_duration() const
 {
        return (item_duration);
@@ -329,7 +329,7 @@ TimeAxisViewItem::get_duration() const
  * @param src the identity of the object that initiated the change
  */
 void
-TimeAxisViewItem::set_max_duration(nframes_t dur, void* src)
+TimeAxisViewItem::set_max_duration(nframes64_t dur, void* src)
 {
        max_item_duration = dur ;
        MaxDurationChanged(max_item_duration, src) ; /* EMIT_SIGNAL */
@@ -340,7 +340,7 @@ TimeAxisViewItem::set_max_duration(nframes_t dur, void* src)
  *
  * @return the maximum duration that this item may be set to
  */
-nframes_t
+nframes64_t
 TimeAxisViewItem::get_max_duration() const
 {
        return (max_item_duration) ;
@@ -353,7 +353,7 @@ TimeAxisViewItem::get_max_duration() const
  * @param src the identity of the object that initiated the change
  */
 void
-TimeAxisViewItem::set_min_duration(nframes_t dur, void* src)
+TimeAxisViewItem::set_min_duration(nframes64_t dur, void* src)
 {
        min_item_duration = dur ;
        MinDurationChanged(max_item_duration, src) ; /* EMIT_SIGNAL */
@@ -364,7 +364,7 @@ TimeAxisViewItem::set_min_duration(nframes_t dur, void* src)
  *
  * @return the nimum duration that this item mey be set to
  */
-nframes_t
+nframes64_t
 TimeAxisViewItem::get_min_duration() const
 {
        return(min_item_duration) ;
index 97e7a73745eb5b1dff8a0229b8f04a4223dcc27a..c1ae4e4e63d672935334c81c43f51607d8d9b1e0 100644 (file)
@@ -47,14 +47,14 @@ class TimeAxisViewItem : public Selectable
      * @param src the identity of the object that initiated the change
      * @return true if the position change was a success, false otherwise
      */
-    virtual bool set_position(nframes_t pos, void* src, double* delta = 0) ;
+    virtual bool set_position(nframes64_t pos, void* src, double* delta = 0) ;
     
     /**
      * Return the position of this item upon the timeline
      *
      * @return the position of this item
      */
-    nframes_t get_position() const ; 
+    nframes64_t get_position() const ; 
     
     /**
      * Sets the duration of this item
@@ -63,13 +63,13 @@ class TimeAxisViewItem : public Selectable
      * @param src the identity of the object that initiated the change
      * @return true if the duration change was succesful, false otherwise
      */
-    virtual bool set_duration(nframes_t dur, void* src) ;
+    virtual bool set_duration(nframes64_t dur, void* src) ;
     
     /**
      * Returns the duration of this item
      *
      */
-    nframes_t get_duration() const ;
+    nframes64_t get_duration() const ;
     
     /**
      * Sets the maximum duration that this item make have.
@@ -77,14 +77,14 @@ class TimeAxisViewItem : public Selectable
      * @param dur the new maximum duration
      * @param src the identity of the object that initiated the change
      */
-    virtual void set_max_duration(nframes_t dur, void* src) ;
+    virtual void set_max_duration(nframes64_t dur, void* src) ;
     
     /**
      * Returns the maxmimum duration that this item may be set to
      *
      * @return the maximum duration that this item may be set to
      */
-    nframes_t get_max_duration() const ;
+    nframes64_t get_max_duration() const ;
     
     /**
      * Sets the minimu duration that this item may be set to
@@ -92,14 +92,14 @@ class TimeAxisViewItem : public Selectable
      * @param the minimum duration that this item may be set to
      * @param src the identity of the object that initiated the change
      */
-    virtual void set_min_duration(nframes_t dur, void* src) ;
+    virtual void set_min_duration(nframes64_t dur, void* src) ;
     
     /**
      * Returns the minimum duration that this item mey be set to
      *
      * @return the nimum duration that this item mey be set to
      */
-    nframes_t get_min_duration() const ;
+    nframes64_t get_min_duration() const ;
     
     /**
      * Sets whether the position of this Item is locked to its current position
@@ -305,19 +305,19 @@ class TimeAxisViewItem : public Selectable
     sigc::signal<void,std::string,std::string,void*> NameChanged ;
     
     /** Emiited when the position of this item changes */
-    sigc::signal<void,nframes_t,void*> PositionChanged ;
+    sigc::signal<void,nframes64_t,void*> PositionChanged ;
     
     /** Emitted when the position lock of this item is changed */
     sigc::signal<void,bool,void*> PositionLockChanged ;
     
     /** Emitted when the duration of this item changes */
-    sigc::signal<void,nframes_t,void*> DurationChanged ;
+    sigc::signal<void,nframes64_t,void*> DurationChanged ;
     
     /** Emitted when the maximum item duration is changed */
-    sigc::signal<void,nframes_t,void*> MaxDurationChanged ;
+    sigc::signal<void,nframes64_t,void*> MaxDurationChanged ;
     
     /** Emitted when the mionimum item duration is changed */
-    sigc::signal<void,nframes_t,void*> MinDurationChanged ;
+    sigc::signal<void,nframes64_t,void*> MinDurationChanged ;
     
     enum Visibility {
            ShowFrame = 0x1,
@@ -342,11 +342,11 @@ class TimeAxisViewItem : public Selectable
      * @param duration the duration of this item
      */
     TimeAxisViewItem(const std::string & it_name, ArdourCanvas::Group& parent, TimeAxisView& tv, double spu, Gdk::Color const & base_color, 
-                    nframes_t start, nframes_t duration, bool recording = false, Visibility v = Visibility (0));
+                    nframes64_t start, nframes64_t duration, bool recording = false, Visibility v = Visibility (0));
 
     TimeAxisViewItem (const TimeAxisViewItem& other);
 
-    void init (const std::string& it_name, double spu, Gdk::Color const & base_color, nframes_t start, nframes_t duration, Visibility vis);
+    void init (const std::string& it_name, double spu, Gdk::Color const & base_color, nframes64_t start, nframes64_t duration, Visibility vis);
     
     /**
      * Calculates some contrasting color for displaying various parts of this item, based upon the base color
@@ -391,16 +391,16 @@ class TimeAxisViewItem : public Selectable
     bool position_locked ;
     
     /** The posotion of this item on the timeline */
-    nframes_t frame_position ;
+    nframes64_t frame_position ;
     
     /** the duration of this item upon the timeline */
-    nframes_t item_duration ;
+    nframes64_t item_duration ;
     
     /** the maximum duration that we allow this item to take */
-    nframes_t max_item_duration ;
+    nframes64_t max_item_duration ;
     
     /** the minimu duration that we allow this item to take */
-    nframes_t min_item_duration ;
+    nframes64_t min_item_duration ;
     
     /** indicates whether this Max Duration constraint is active */
     bool max_duration_active ;