summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2009-09-09 02:09:04 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2009-09-09 02:09:04 +0000
commit5328a114c93f14178a5d5b97d7a6b95ea007552e (patch)
tree6088a761d83fe6e18529000735cf725c031e9519
parent1bf79fa88502a156a71cd3d2de35aa234950c40c (diff)
time line items now have 64 bit location + duration; start making note resize apply across regions
git-svn-id: svn://localhost/ardour2/branches/3.0@5642 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--gtk2_ardour/automation_region_view.cc2
-rw-r--r--gtk2_ardour/automation_region_view.h2
-rw-r--r--gtk2_ardour/editor_drag.cc36
-rw-r--r--gtk2_ardour/imageframe_view.cc8
-rw-r--r--gtk2_ardour/imageframe_view.h4
-rw-r--r--gtk2_ardour/marker.cc2
-rw-r--r--gtk2_ardour/marker.h2
-rw-r--r--gtk2_ardour/midi_region_view.cc17
-rw-r--r--gtk2_ardour/midi_region_view.h3
-rw-r--r--gtk2_ardour/mixer_ui.cc2
-rw-r--r--gtk2_ardour/region_view.cc4
-rw-r--r--gtk2_ardour/region_view.h4
-rw-r--r--gtk2_ardour/time_axis_view_item.cc20
-rw-r--r--gtk2_ardour/time_axis_view_item.h36
14 files changed, 90 insertions, 52 deletions
diff --git a/gtk2_ardour/automation_region_view.cc b/gtk2_ardour/automation_region_view.cc
index 5ad736d535..ad10851c73 100644
--- a/gtk2_ardour/automation_region_view.cc
+++ b/gtk2_ardour/automation_region_view.cc
@@ -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);
}
diff --git a/gtk2_ardour/automation_region_view.h b/gtk2_ardour/automation_region_view.h
index e6531821d3..6ab9118017 100644
--- a/gtk2_ardour/automation_region_view.h
+++ b/gtk2_ardour/automation_region_view.h
@@ -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);
diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc
index fb39a34589..0469e45e36 100644
--- a/gtk2_ardour/editor_drag.cc
+++ b/gtk2_ardour/editor_drag.cc
@@ -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
diff --git a/gtk2_ardour/imageframe_view.cc b/gtk2_ardour/imageframe_view.cc
index 2a419ee275..0b3b01dcba 100644
--- a/gtk2_ardour/imageframe_view.cc
+++ b/gtk2_ardour/imageframe_view.cc
@@ -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) ;
diff --git a/gtk2_ardour/imageframe_view.h b/gtk2_ardour/imageframe_view.h
index db83264e46..2026853654 100644
--- a/gtk2_ardour/imageframe_view.h
+++ b/gtk2_ardour/imageframe_view.h
@@ -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
diff --git a/gtk2_ardour/marker.cc b/gtk2_ardour/marker.cc
index 131354e72e..bc97128102 100644
--- a/gtk2_ardour/marker.cc
+++ b/gtk2_ardour/marker.cc
@@ -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;
diff --git a/gtk2_ardour/marker.h b/gtk2_ardour/marker.h
index fe6cac75c4..a379f010c9 100644
--- a/gtk2_ardour/marker.h
+++ b/gtk2_ardour/marker.h
@@ -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);
diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc
index b4acdc7f5e..4ef0ead38e 100644
--- a/gtk2_ardour/midi_region_view.cc
+++ b/gtk2_ardour/midi_region_view.cc
@@ -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);
}
diff --git a/gtk2_ardour/midi_region_view.h b/gtk2_ardour/midi_region_view.h
index 08dea544e2..8bbd535a48 100644
--- a/gtk2_ardour/midi_region_view.h
+++ b/gtk2_ardour/midi_region_view.h
@@ -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)
diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc
index 37cc14b8b0..83a35bcb96 100644
--- a/gtk2_ardour/mixer_ui.cc
+++ b/gtk2_ardour/mixer_ui.cc
@@ -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;
diff --git a/gtk2_ardour/region_view.cc b/gtk2_ardour/region_view.cc
index b8ebc8fe89..c3d48d4aa2 100644
--- a/gtk2_ardour/region_view.cc
+++ b/gtk2_ardour/region_view.cc
@@ -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;
diff --git a/gtk2_ardour/region_view.h b/gtk2_ardour/region_view.h
index af7cb0369d..3f2f71eda4 100644
--- a/gtk2_ardour/region_view.h
+++ b/gtk2_ardour/region_view.h
@@ -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 () {}
diff --git a/gtk2_ardour/time_axis_view_item.cc b/gtk2_ardour/time_axis_view_item.cc
index 47a8d6a322..2236050792 100644
--- a/gtk2_ardour/time_axis_view_item.cc
+++ b/gtk2_ardour/time_axis_view_item.cc
@@ -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) ;
diff --git a/gtk2_ardour/time_axis_view_item.h b/gtk2_ardour/time_axis_view_item.h
index 97e7a73745..c1ae4e4e63 100644
--- a/gtk2_ardour/time_axis_view_item.h
+++ b/gtk2_ardour/time_axis_view_item.h
@@ -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 ;