Make tempo lines physical_screen_height high, add xml null check, Use clicked_regionview directly to calculate region movement. Using drag_info.data may result in the wrong regionbiew being used, don't use canvas coords for region_drag_finished_callback x calculation (eliminates speed adjustment), prevent incorrect updates on dropped regions by updating canvas before placing region copies.
git-svn-id: svn://localhost/ardour2/branches/3.0@3965 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
@@ -400,7 +400,9 @@ AutomationTimeAxisView::set_height (uint32_t h)
|
||||
|
||||
char buf[32];
|
||||
snprintf (buf, sizeof (buf), "%u", height);
|
||||
xml_node->add_property ("height", buf);
|
||||
if (xml_node) {
|
||||
xml_node->add_property ("height", buf);
|
||||
}
|
||||
|
||||
if (changed_between_small_and_normal || first_call_to_set_height) {
|
||||
|
||||
|
||||
@@ -378,11 +378,6 @@ Editor::controls_layout_size_request (Requisition* req)
|
||||
}
|
||||
}
|
||||
|
||||
RefPtr<Gdk::Screen> screen = get_screen();
|
||||
|
||||
if (!screen) {
|
||||
screen = Gdk::Screen::get_default();
|
||||
}
|
||||
gint height = min ( (gint) pos, (gint) (physical_screen_height - 600));
|
||||
gint width = max (edit_controls_vbox.get_width(), controls_layout.get_width());
|
||||
|
||||
|
||||
@@ -3474,7 +3474,6 @@ Editor::region_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
|
||||
{
|
||||
double x_delta;
|
||||
double y_delta = 0;
|
||||
RegionView* rv = reinterpret_cast<RegionView*> (drag_info.data);
|
||||
nframes64_t pending_region_position = 0;
|
||||
int32_t pointer_y_span = 0, canvas_pointer_y_span = 0, original_pointer_order;
|
||||
int32_t visible_y_high = 0, visible_y_low = 512; //high meaning higher numbered.. not the height on the screen
|
||||
@@ -3670,7 +3669,7 @@ Editor::region_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
|
||||
|
||||
pending_region_position = drag_info.current_pointer_frame - drag_info.pointer_frame_offset;
|
||||
|
||||
sync_offset = rv->region()->sync_offset (sync_dir);
|
||||
sync_offset = clicked_regionview->region()->sync_offset (sync_dir);
|
||||
|
||||
/* we don't handle a sync point that lies before zero.
|
||||
*/
|
||||
@@ -3684,7 +3683,7 @@ Editor::region_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
|
||||
snap_to (sync_frame);
|
||||
}
|
||||
|
||||
pending_region_position = rv->region()->adjust_to_sync (sync_frame);
|
||||
pending_region_position = clicked_regionview->region()->adjust_to_sync (sync_frame);
|
||||
|
||||
} else {
|
||||
pending_region_position = drag_info.last_frame_position;
|
||||
@@ -3694,7 +3693,7 @@ Editor::region_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
|
||||
pending_region_position = 0;
|
||||
}
|
||||
|
||||
if (pending_region_position > max_frames - rv->region()->length()) {
|
||||
if (pending_region_position > max_frames - clicked_regionview->region()->length()) {
|
||||
pending_region_position = drag_info.last_frame_position;
|
||||
}
|
||||
|
||||
@@ -3921,6 +3920,8 @@ Editor::region_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event
|
||||
PlaylistSet frozen_playlists;
|
||||
list <sigc::connection> modified_playlist_connections;
|
||||
pair<PlaylistSet::iterator,bool> insert_result, frozen_insert_result;
|
||||
nframes64_t drag_delta;
|
||||
bool changed_tracks, changed_position;
|
||||
|
||||
/* first_move is set to false if the regionview has been moved in the
|
||||
motion handler.
|
||||
@@ -3976,6 +3977,13 @@ Editor::region_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event
|
||||
|
||||
begin_reversible_command (op_string);
|
||||
|
||||
changed_position = (drag_info.last_frame_position != (nframes64_t) (clicked_regionview->region()->position()));
|
||||
changed_tracks = (trackview_by_y_position (drag_info.current_pointer_y) != &clicked_regionview->get_time_axis_view());
|
||||
|
||||
drag_delta = clicked_regionview->region()->position() - drag_info.last_frame_position;
|
||||
|
||||
track_canvas->update_now ();
|
||||
|
||||
for (list<RegionView*>::const_iterator i = selection->regions.by_layer().begin(); i != selection->regions.by_layer().end(); ) {
|
||||
|
||||
RegionView* rv = (*i);
|
||||
@@ -3986,29 +3994,15 @@ Editor::region_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event
|
||||
|
||||
TimeAxisView* dest_tv = trackview_by_y_position (iy1);
|
||||
RouteTimeAxisView* dest_rtv = dynamic_cast<RouteTimeAxisView*>(dest_tv);
|
||||
double speed;
|
||||
bool changed_tracks, changed_position;
|
||||
nframes64_t where;
|
||||
|
||||
if (rv->region()->locked()) {
|
||||
++i;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* adjust for track speed */
|
||||
|
||||
speed = 1.0;
|
||||
|
||||
if (dest_rtv && dest_rtv->get_diskstream()) {
|
||||
speed = dest_rtv->get_diskstream()->speed();
|
||||
}
|
||||
|
||||
changed_position = (drag_info.last_frame_position != (nframes64_t) (rv->region()->position()/speed));
|
||||
changed_tracks = (dest_tv != &rv->get_time_axis_view());
|
||||
|
||||
if (changed_position && !drag_info.x_constrained) {
|
||||
_master_group->w2i(ix1, iy1);
|
||||
where = (nframes64_t) (unit_to_frame (ix1) * speed);
|
||||
where = rv->region()->position() - drag_delta;
|
||||
} else {
|
||||
where = rv->region()->position();
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ Editor::draw_measures ()
|
||||
}
|
||||
|
||||
if (tempo_lines == 0) {
|
||||
tempo_lines = new TempoLines(*track_canvas, time_line_group);
|
||||
tempo_lines = new TempoLines(*track_canvas, time_line_group, physical_screen_height);
|
||||
}
|
||||
|
||||
tempo_lines->draw(*current_bbt_points, frames_per_unit);
|
||||
|
||||
@@ -26,11 +26,12 @@ using namespace std;
|
||||
|
||||
#define MAX_CACHED_LINES 128
|
||||
|
||||
TempoLines::TempoLines(ArdourCanvas::Canvas& canvas, ArdourCanvas::Group* group)
|
||||
TempoLines::TempoLines(ArdourCanvas::Canvas& canvas, ArdourCanvas::Group* group, double screen_height)
|
||||
: _canvas(canvas)
|
||||
, _group(group)
|
||||
, _clean_left(DBL_MAX)
|
||||
, _clean_right(0.0)
|
||||
, _height(screen_height)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -85,7 +86,6 @@ TempoLines::draw (ARDOUR::TempoMap::BBTPointList& points, double frames_per_unit
|
||||
const size_t needed = points.size();
|
||||
|
||||
_canvas.get_scroll_region (x1, y1, x2, who_cares);
|
||||
_canvas.root()->get_bounds(who_cares, who_cares, who_cares, y2);
|
||||
|
||||
/* get the first bar spacing */
|
||||
|
||||
@@ -221,7 +221,8 @@ TempoLines::draw (ARDOUR::TempoMap::BBTPointList& points, double frames_per_unit
|
||||
line = new ArdourCanvas::SimpleLine (*_group);
|
||||
line->property_x1() = xpos;
|
||||
line->property_x2() = xpos;
|
||||
line->property_y2() = y2;
|
||||
line->property_y1() = 0.0;
|
||||
line->property_y2() = _height;
|
||||
line->property_color_rgba() = color;
|
||||
_lines.insert(make_pair(xpos, line));
|
||||
inserted_last_time = true;
|
||||
|
||||
@@ -35,7 +35,7 @@ typedef boost::fast_pool_allocator<
|
||||
|
||||
class TempoLines {
|
||||
public:
|
||||
TempoLines(ArdourCanvas::Canvas& canvas, ArdourCanvas::Group* group);
|
||||
TempoLines(ArdourCanvas::Canvas& canvas, ArdourCanvas::Group* group, double screen_height);
|
||||
|
||||
void tempo_map_changed();
|
||||
|
||||
@@ -52,6 +52,7 @@ private:
|
||||
ArdourCanvas::Group* _group;
|
||||
double _clean_left;
|
||||
double _clean_right;
|
||||
double _height;
|
||||
};
|
||||
|
||||
#endif /* __ardour_tempo_lines_h__ */
|
||||
|
||||
Reference in New Issue
Block a user