Relayer punch/loop range rects, fix display of punch-in with no punch-out, ensure range selection rect is hidden after single click.

git-svn-id: svn://localhost/ardour2/branches/3.0@3836 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Nick Mainsbridge 2008-09-29 20:35:44 +00:00
parent ef9beb3f60
commit 80608f7594
6 changed files with 34 additions and 78 deletions

View File

@ -61,15 +61,7 @@ AudioStreamView::AudioStreamView (AudioTimeAxisView& tv)
crossfades_visible = true; crossfades_visible = true;
_waveform_scale = LinearWaveform; _waveform_scale = LinearWaveform;
_waveform_shape = Traditional; _waveform_shape = Traditional;
color_handler ();
if (tv.is_track())
stream_base_color = ARDOUR_UI::config()->canvasvar_AudioTrackBase.get();
else
stream_base_color = ARDOUR_UI::config()->canvasvar_AudioBusBase.get();
canvas_rect->property_fill_color_rgba() = stream_base_color;
canvas_rect->property_outline_color_rgba() = RGBA_BLACK;
_amplitude_above_axis = 1.0; _amplitude_above_axis = 1.0;
use_rec_regions = tv.editor.show_waveforms_recording (); use_rec_regions = tv.editor.show_waveforms_recording ();

View File

@ -4653,10 +4653,8 @@ Editor::idle_visual_changer ()
/* if we seek beyond the current end of the canvas, move the end */ /* if we seek beyond the current end of the canvas, move the end */
if (current_time_origin != pending_visual_change.time_origin) { if (current_time_origin != pending_visual_change.time_origin) {
//if (horizontal_adjustment.get_upper() < pending_visual_change.time_origin) {
last_canvas_frame = (cef > (pending_visual_change.time_origin + current_page_frames())) ? cef : pending_visual_change.time_origin + current_page_frames(); last_canvas_frame = (cef > (pending_visual_change.time_origin + current_page_frames())) ? cef : pending_visual_change.time_origin + current_page_frames();
horizontal_adjustment.set_upper ((cef - csf) / frames_per_unit); horizontal_adjustment.set_upper ((cef - csf) / frames_per_unit);
//}
horizontal_adjustment.set_value (pending_visual_change.time_origin / frames_per_unit); horizontal_adjustment.set_value (pending_visual_change.time_origin / frames_per_unit);
} else { } else {
update_fixed_rulers(); update_fixed_rulers();

View File

@ -141,11 +141,18 @@ Editor::initialize_canvas ()
transport_loop_range_rect->property_outline_pixels() = 1; transport_loop_range_rect->property_outline_pixels() = 1;
transport_loop_range_rect->hide(); transport_loop_range_rect->hide();
transport_punch_range_rect = new ArdourCanvas::SimpleRect (*_master_group, 0.0, 0.0, 0.0, 0.0);
transport_punch_range_rect->property_outline_pixels() = 0;
transport_punch_range_rect->hide();
/* a group to hold time (measure) lines */ /* a group to hold time (measure) lines */
time_line_group = new ArdourCanvas::Group (*_master_group, 0.0, 0.0); time_line_group = new ArdourCanvas::Group (*_master_group, 0.0, 0.0);
range_marker_drag_rect = new ArdourCanvas::SimpleRect (*time_line_group, 0.0, 0.0, 0.0, 0.0);
range_marker_drag_rect->hide ();
_trackview_group = new ArdourCanvas::Group (*_master_group, 0.0, 0.0); _trackview_group = new ArdourCanvas::Group (*_master_group, 0.0, 0.0);
_region_motion_group = new ArdourCanvas::Group (*_master_group, 0.0, 0.0); _region_motion_group = new ArdourCanvas::Group (*_trackview_group, 0.0, 0.0);
/* el barrio */ /* el barrio */
@ -179,10 +186,6 @@ Editor::initialize_canvas ()
cd_marker_bar->property_outline_what() = (0x1 | 0x8); cd_marker_bar->property_outline_what() = (0x1 | 0x8);
cd_marker_bar->property_outline_pixels() = 1; cd_marker_bar->property_outline_pixels() = 1;
range_marker_drag_rect = new ArdourCanvas::SimpleRect (*time_line_group, 0.0, 0.0, 0.0, 0.0);
//range_marker_drag_rect = new ArdourCanvas::SimpleRect (*_master_group, 0.0, 0.0, 0.0, 0.0);
range_marker_drag_rect->hide ();
timebar_group = new ArdourCanvas::Group (*track_canvas->root()); timebar_group = new ArdourCanvas::Group (*track_canvas->root());
cursor_group = new ArdourCanvas::Group (*track_canvas->root(), 0.0, 0.0); cursor_group = new ArdourCanvas::Group (*track_canvas->root(), 0.0, 0.0);
@ -213,11 +216,6 @@ Editor::initialize_canvas ()
transport_bar_drag_rect->property_outline_pixels() = 0; transport_bar_drag_rect->property_outline_pixels() = 0;
transport_bar_drag_rect->hide (); transport_bar_drag_rect->hide ();
transport_punch_range_rect = new ArdourCanvas::SimpleRect (*_master_group, 0.0, 0.0, 0.0, 0.0);
transport_punch_range_rect->property_outline_pixels() = 0;
transport_punch_range_rect->hide();
// transport_loop_range_rect->lower_to_bottom (); // loop on the bottom
transport_punchin_line = new ArdourCanvas::SimpleLine (*_master_group); transport_punchin_line = new ArdourCanvas::SimpleLine (*_master_group);
transport_punchin_line->property_x1() = 0.0; transport_punchin_line->property_x1() = 0.0;
@ -253,9 +251,6 @@ Editor::initialize_canvas ()
range_marker_bar->signal_event().connect (bind (mem_fun (*this, &Editor::canvas_range_marker_bar_event), range_marker_bar)); range_marker_bar->signal_event().connect (bind (mem_fun (*this, &Editor::canvas_range_marker_bar_event), range_marker_bar));
transport_marker_bar->signal_event().connect (bind (mem_fun (*this, &Editor::canvas_transport_marker_bar_event), transport_marker_bar)); transport_marker_bar->signal_event().connect (bind (mem_fun (*this, &Editor::canvas_transport_marker_bar_event), transport_marker_bar));
ZoomChanged.connect (bind (mem_fun(*this, &Editor::update_loop_range_view), false));
ZoomChanged.connect (bind (mem_fun(*this, &Editor::update_punch_range_view), false));
playhead_cursor = new Cursor (*this, &Editor::canvas_playhead_cursor_event); playhead_cursor = new Cursor (*this, &Editor::canvas_playhead_cursor_event);
if (logo_item) { if (logo_item) {
@ -870,6 +865,8 @@ Editor::scroll_canvas_horizontally ()
_master_group->move (-x_delta, 0); _master_group->move (-x_delta, 0);
timebar_group->move (-x_delta, 0); timebar_group->move (-x_delta, 0);
cursor_group->move (-x_delta, 0); cursor_group->move (-x_delta, 0);
update_fixed_rulers ();
redisplay_tempo (true);
} }
void void
@ -879,15 +876,12 @@ Editor::scroll_canvas_vertically ()
double x1, x2, y1, y2, y_delta; double x1, x2, y1, y2, y_delta;
_trackview_group->get_bounds(x1, y1, x2, y2); _trackview_group->get_bounds(x1, y1, x2, y2);
y_delta = y1 + vertical_adjustment.get_value() - canvas_timebars_vsize; y_delta = y1 + get_trackview_group_vertical_offset ();
_trackview_group->move (0, -y_delta); _trackview_group->move (0, -y_delta);
_region_motion_group->move (0, -y_delta);
#ifndef GTKOSX
/* required to keep the controls_layout in lock step with the canvas group */ /* required to keep the controls_layout in lock step with the canvas group */
track_canvas->update_now (); track_canvas->update_now ();
#endif
} }
void void
@ -898,6 +892,7 @@ Editor::canvas_horizontally_scrolled ()
if (time_origin != leftmost_frame) { if (time_origin != leftmost_frame) {
canvas_scroll_to (time_origin); canvas_scroll_to (time_origin);
} }
redisplay_tempo (true);
} }
void void
@ -910,11 +905,6 @@ Editor::canvas_scroll_to (nframes64_t time_origin)
last_canvas_frame = rightmost_frame; last_canvas_frame = rightmost_frame;
//reset_scrolling_region (); //reset_scrolling_region ();
} }
update_fixed_rulers ();
//redisplay_tempo (!_dragging_hscrollbar);
redisplay_tempo (true);
} }
void void

View File

@ -1149,17 +1149,15 @@ Editor::update_punch_range_view (bool visibility)
if ((Config->get_punch_in() || Config->get_punch_out()) && ((tpl = transport_punch_location()) != 0)) { if ((Config->get_punch_in() || Config->get_punch_out()) && ((tpl = transport_punch_location()) != 0)) {
double x1 = frame_to_pixel (tpl->start());
double x2 = frame_to_pixel (tpl->end());
guint track_canvas_width,track_canvas_height; guint track_canvas_width,track_canvas_height;
track_canvas->get_size(track_canvas_width,track_canvas_height); track_canvas->get_size(track_canvas_width,track_canvas_height);
if (Config->get_punch_in()) {
transport_punch_range_rect->property_x1() = x1; transport_punch_range_rect->property_x1() = frame_to_pixel (tpl->start());
transport_punch_range_rect->property_x2() = x2; transport_punch_range_rect->property_x2() = (Config->get_punch_out() ? frame_to_pixel (tpl->end()) : frame_to_pixel (JACK_MAX_FRAMES));
} else {
transport_punch_range_rect->property_x1() = (Config->get_punch_in() ? x1 : 0); transport_punch_range_rect->property_x1() = 0;
transport_punch_range_rect->property_x2() = (Config->get_punch_out() ? x2 : track_canvas_width); transport_punch_range_rect->property_x2() = (Config->get_punch_out() ? frame_to_pixel (tpl->end()) : track_canvas_width);
}
if (visibility) { if (visibility) {
transport_punch_range_rect->show(); transport_punch_range_rect->show();

View File

@ -1879,6 +1879,7 @@ Editor::finalize_drag ()
drag_info.last_pointer_frame = 0; drag_info.last_pointer_frame = 0;
drag_info.current_pointer_frame = 0; drag_info.current_pointer_frame = 0;
drag_info.brushing = false; drag_info.brushing = false;
range_marker_drag_rect->hide();
drag_info.clear_copied_locations (); drag_info.clear_copied_locations ();
} }
@ -3184,7 +3185,7 @@ Editor::start_region_grab (ArdourCanvas::Item* item, GdkEvent* event)
if (selection->regions.empty() || clicked_regionview == 0) { if (selection->regions.empty() || clicked_regionview == 0) {
return; return;
} }
_region_motion_group->raise_to_top ();
drag_info.copy = false; drag_info.copy = false;
drag_info.item = item; drag_info.item = item;
drag_info.data = clicked_regionview; drag_info.data = clicked_regionview;
@ -3213,19 +3214,9 @@ Editor::start_region_grab (ArdourCanvas::Item* item, GdkEvent* event)
drag_info.dest_trackview = drag_info.source_trackview; drag_info.dest_trackview = drag_info.source_trackview;
// we want a move threshold // we want a move threshold
drag_info.want_move_threshold = true; drag_info.want_move_threshold = true;
show_verbose_time_cursor (drag_info.last_frame_position, 10); show_verbose_time_cursor (drag_info.last_frame_position, 10);
begin_reversible_command (_("move region(s)")); begin_reversible_command (_("move region(s)"));
/*
the group containing moved regions may have been
offset during autoscroll. reset its y offset
(we should really handle this in the same way
we do with the x axis, but a simple way of achieving that
eludes me right now).
*/
_region_motion_group->property_y() = 0;
/* sync the canvas to what we think is its current state */ /* sync the canvas to what we think is its current state */
track_canvas->update_now(); track_canvas->update_now();
@ -3251,7 +3242,7 @@ Editor::start_region_copy_grab (ArdourCanvas::Item* item, GdkEvent* event)
if (selection->regions.empty() || clicked_regionview == 0) { if (selection->regions.empty() || clicked_regionview == 0) {
return; return;
} }
_region_motion_group->raise_to_top ();
drag_info.copy = true; drag_info.copy = true;
drag_info.item = item; drag_info.item = item;
drag_info.data = clicked_regionview; drag_info.data = clicked_regionview;
@ -3275,8 +3266,6 @@ Editor::start_region_copy_grab (ArdourCanvas::Item* item, GdkEvent* event)
drag_info.motion_callback = &Editor::region_drag_motion_callback; drag_info.motion_callback = &Editor::region_drag_motion_callback;
drag_info.finished_callback = &Editor::region_drag_finished_callback; drag_info.finished_callback = &Editor::region_drag_finished_callback;
show_verbose_time_cursor (drag_info.last_frame_position, 10); show_verbose_time_cursor (drag_info.last_frame_position, 10);
_region_motion_group->property_y() = 0;
} }
void void
@ -3742,7 +3731,6 @@ Editor::region_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
if (-x_delta > ix1 + horizontal_adjustment.get_value()) { if (-x_delta > ix1 + horizontal_adjustment.get_value()) {
// do_move = false; // do_move = false;
cerr << "illegal move" << endl;
x_delta = 0; x_delta = 0;
pending_region_position = drag_info.last_frame_position; pending_region_position = drag_info.last_frame_position;
break; break;
@ -3807,6 +3795,13 @@ Editor::region_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
rv->get_canvas_frame()->get_bounds (ix1, iy1, ix2, iy2); rv->get_canvas_frame()->get_bounds (ix1, iy1, ix2, iy2);
rv->get_canvas_frame()->i2w (ix1, iy1); rv->get_canvas_frame()->i2w (ix1, iy1);
cerr << "adjust y from " << iy1 << " using "
<< vertical_adjustment.get_value() << " - "
<< canvas_timebars_vsize
<< endl;
iy1 += get_trackview_group_vertical_offset ();;
if (drag_info.first_move) { if (drag_info.first_move) {
// hide any dependent views // hide any dependent views
@ -3825,16 +3820,6 @@ Editor::region_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
rv->fake_set_opaque (true); rv->fake_set_opaque (true);
} }
/* for evaluation of the track position of iy1, we have to adjust
to allow for the vertical scrolling adjustment and the height of the timebars.
*/
cerr << "adjust y from " << iy1 << " using "
<< vertical_adjustment.get_value() << " - "
<< canvas_timebars_vsize
<< endl;
iy1 += vertical_adjustment.get_value() - canvas_timebars_vsize;
TimeAxisView* tvp2 = trackview_by_y_position (iy1); TimeAxisView* tvp2 = trackview_by_y_position (iy1);
RouteTimeAxisView* canvas_rtv = dynamic_cast<RouteTimeAxisView*>(tvp2); RouteTimeAxisView* canvas_rtv = dynamic_cast<RouteTimeAxisView*>(tvp2);
@ -3957,13 +3942,6 @@ Editor::region_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event
nocommit = false; nocommit = false;
/* XXX is this true??? i can''t tell the difference.
The regionview has been moved at some stage during the grab so we need
to account for any mouse movement between this event and the last one.
*/
//region_drag_motion_callback (item, event);
if (Config->get_edit_mode() == Splice && !pre_drag_region_selection.empty()) { if (Config->get_edit_mode() == Splice && !pre_drag_region_selection.empty()) {
selection->set (pre_drag_region_selection); selection->set (pre_drag_region_selection);
pre_drag_region_selection.clear (); pre_drag_region_selection.clear ();

View File

@ -45,10 +45,10 @@ TempoLines::tempo_map_changed()
for (Lines::iterator i = _lines.begin(); i != _lines.end(); ++d) { for (Lines::iterator i = _lines.begin(); i != _lines.end(); ++d) {
Lines::iterator next = i; Lines::iterator next = i;
++next; ++next;
i->second->property_x1() = DBL_MAX - d; i->second->property_x1() = - d;
i->second->property_x2() = DBL_MAX - d; i->second->property_x2() = - d;
_lines.erase(i); _lines.erase(i);
_lines.insert(make_pair(DBL_MAX - d, i->second)); _lines.insert(make_pair(- d, i->second));
i = next; i = next;
} }
} }