Merge branch 'cairocanvas' of git.ardour.org:ardour/ardour into cairocanvas

This commit is contained in:
Paul Davis 2013-04-12 21:47:02 -04:00
commit 83c6aee3b7
9 changed files with 14 additions and 110 deletions

View file

@ -4780,7 +4780,6 @@ Editor::idle_resize ()
} }
_pending_resize_amount = 0; _pending_resize_amount = 0;
flush_canvas ();
_group_tabs->set_dirty (); _group_tabs->set_dirty ();
resize_idle_id = -1; resize_idle_id = -1;

View file

@ -248,8 +248,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
return sample / samples_per_pixel; return sample / samples_per_pixel;
} }
void flush_canvas ();
/* selection */ /* selection */
Selection& get_selection() const { return *selection; } Selection& get_selection() const { return *selection; }
@ -2084,8 +2082,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void region_view_added (RegionView *); void region_view_added (RegionView *);
void region_view_removed (); void region_view_removed ();
void update_canvas_now ();
EditorGroupTabs* _group_tabs; EditorGroupTabs* _group_tabs;
void fit_route_group (ARDOUR::RouteGroup *); void fit_route_group (ARDOUR::RouteGroup *);

View file

@ -261,15 +261,7 @@ Editor::track_canvas_viewport_size_allocated ()
_visible_canvas_width = _canvas_viewport_allocation.get_width (); _visible_canvas_width = _canvas_viewport_allocation.get_width ();
_visible_canvas_height = _canvas_viewport_allocation.get_height (); _visible_canvas_height = _canvas_viewport_allocation.get_height ();
cerr << "VISIBLE CANVAS now: " << _visible_canvas_width << " x " << _visible_canvas_height << endl; // SHOWTRACKS
if (_session) {
TrackViewList::iterator i;
for (i = track_views.begin(); i != track_views.end(); ++i) {
(*i)->clip_to_viewport ();
}
}
if (height_changed) { if (height_changed) {
@ -744,19 +736,8 @@ Editor::ensure_time_axis_view_is_visible (const TimeAxisView& tav)
void void
Editor::tie_vertical_scrolling () Editor::tie_vertical_scrolling ()
{ {
_track_canvas_vadj->set_value (vertical_adjustment.get_value ()); _track_canvas_vadj->set_value (vertical_adjustment.get_value ());
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
(*i)->clip_to_viewport ();
}
/* required to keep the controls_layout in lock step with the canvas group */
update_canvas_now ();
/* this will do an immediate redraw */
controls_layout.get_vadjustment()->set_value (vertical_adjustment.get_value()); controls_layout.get_vadjustment()->set_value (vertical_adjustment.get_value());
if (pending_visual_change.idle_handler_id < 0) { if (pending_visual_change.idle_handler_id < 0) {
@ -806,12 +787,7 @@ Editor::scroll_canvas_vertically ()
_trackview_group->move (0, y_delta); _trackview_group->move (0, y_delta);
_background_group->move (0, y_delta); _background_group->move (0, y_delta);
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
(*i)->clip_to_viewport ();
}
last_trackview_group_vertical_offset = get_trackview_group_vertical_offset (); last_trackview_group_vertical_offset = get_trackview_group_vertical_offset ();
/* required to keep the controls_layout in lock step with the canvas group */
update_canvas_now ();
} }
#endif #endif
@ -881,34 +857,6 @@ Editor::color_handler()
*/ */
} }
void
Editor::flush_canvas ()
{
if (is_mapped()) {
update_canvas_now ();
// gdk_window_process_updates (GTK_LAYOUT(track_canvas->gobj())->bin_window, true);
}
}
void
Editor::update_canvas_now ()
{
/* GnomeCanvas has a bug whereby if its idle handler is not scheduled between
two calls to update_now, an assert will trip. This wrapper works around
that problem by only calling update_now if the assert will not trip.
I think the GC bug is due to the fact that its code will reset need_update
and need_redraw to FALSE without checking to see if an idle handler is scheduled.
If one is scheduled, GC should probably remove it.
*/
/* XXX: CANVAS */
// GnomeCanvas* c = track_canvas->gobj ();
// if (c->need_update || c->need_redraw) {
// track_canvas->update_now ();
// }
}
double double
Editor::horizontal_position () const Editor::horizontal_position () const
{ {

View file

@ -63,6 +63,12 @@ Editor::track_canvas_scroll (GdkEventScroll* ev)
framepos_t xdelta; framepos_t xdelta;
int direction = ev->direction; int direction = ev->direction;
/* this event arrives without transformation by the canvas, so we have
* to transform the coordinates to be able to look things up.
*/
Duple event_coords = _track_canvas->window_to_canvas (Duple (ev->x, ev->y));
retry: retry:
switch (direction) { switch (direction) {
case GDK_SCROLL_UP: case GDK_SCROLL_UP:
@ -79,7 +85,7 @@ Editor::track_canvas_scroll (GdkEventScroll* ev)
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) { } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
if (!current_stepping_trackview) { if (!current_stepping_trackview) {
step_timeout = Glib::signal_timeout().connect (sigc::mem_fun(*this, &Editor::track_height_step_timeout), 500); step_timeout = Glib::signal_timeout().connect (sigc::mem_fun(*this, &Editor::track_height_step_timeout), 500);
std::pair<TimeAxisView*, int> const p = trackview_by_y_position (ev->y + vertical_adjustment.get_value()); std::pair<TimeAxisView*, int> const p = trackview_by_y_position (event_coords.y);
current_stepping_trackview = p.first; current_stepping_trackview = p.first;
if (!current_stepping_trackview) { if (!current_stepping_trackview) {
return false; return false;
@ -108,7 +114,7 @@ Editor::track_canvas_scroll (GdkEventScroll* ev)
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) { } else if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
if (!current_stepping_trackview) { if (!current_stepping_trackview) {
step_timeout = Glib::signal_timeout().connect (sigc::mem_fun(*this, &Editor::track_height_step_timeout), 500); step_timeout = Glib::signal_timeout().connect (sigc::mem_fun(*this, &Editor::track_height_step_timeout), 500);
std::pair<TimeAxisView*, int> const p = trackview_by_y_position (ev->y + vertical_adjustment.get_value()); std::pair<TimeAxisView*, int> const p = trackview_by_y_position (event_coords.y);
current_stepping_trackview = p.first; current_stepping_trackview = p.first;
if (!current_stepping_trackview) { if (!current_stepping_trackview) {
return false; return false;

View file

@ -667,11 +667,6 @@ RegionMotionDrag::motion (GdkEvent* event, bool first_move)
rv->drag_start (); rv->drag_start ();
/* Absolutely no idea why this is necessary, but it is; without
it, the region view disappears after the reparent.
*/
_editor->update_canvas_now ();
/* Reparent to a non scrolling group so that we can keep the /* Reparent to a non scrolling group so that we can keep the
region selection above all time axis views. region selection above all time axis views.
Reparenting means that we will have to move the region view Reparenting means that we will have to move the region view
@ -815,15 +810,6 @@ RegionMoveDrag::motion (GdkEvent* event, bool first_move)
_views = new_regionviews; _views = new_regionviews;
swap_grab (new_regionviews.front().view->get_canvas_group (), 0, event ? event->motion.time : 0); swap_grab (new_regionviews.front().view->get_canvas_group (), 0, event ? event->motion.time : 0);
/*
sync the canvas to what we think is its current state
without it, the canvas seems to
"forget" to update properly after the upcoming reparent()
..only if the mouse is in rapid motion at the time of the grab.
something to do with regionview creation taking so long?
*/
_editor->update_canvas_now();
} }
} }
@ -876,8 +862,6 @@ RegionMoveDrag::finished (GdkEvent* ev, bool movement_occurred)
bool const changed_tracks = (_time_axis_views[_views.front().time_axis_view] != &_views.front().view->get_time_axis_view()); bool const changed_tracks = (_time_axis_views[_views.front().time_axis_view] != &_views.front().view->get_time_axis_view());
framecnt_t const drag_delta = _primary->region()->position() - _last_frame_position; framecnt_t const drag_delta = _primary->region()->position() - _last_frame_position;
_editor->update_canvas_now ();
if (_copy) { if (_copy) {
finished_copy ( finished_copy (
@ -1278,8 +1262,6 @@ RegionMotionDrag::aborted (bool)
rv->move (-_total_x_delta, 0); rv->move (-_total_x_delta, 0);
rv->set_height (rtv->view()->child_height ()); rv->set_height (rtv->view()->child_height ());
} }
_editor->update_canvas_now ();
} }
/** @param b true to brush, otherwise false. /** @param b true to brush, otherwise false.
@ -1328,8 +1310,6 @@ RegionInsertDrag::RegionInsertDrag (Editor* e, boost::shared_ptr<Region> r, Rout
void void
RegionInsertDrag::finished (GdkEvent *, bool) RegionInsertDrag::finished (GdkEvent *, bool)
{ {
_editor->update_canvas_now ();
RouteTimeAxisView* dest_rtv = dynamic_cast<RouteTimeAxisView*> (_time_axis_views[_views.front().time_axis_view]); RouteTimeAxisView* dest_rtv = dynamic_cast<RouteTimeAxisView*> (_time_axis_views[_views.front().time_axis_view]);
_primary->get_canvas_group()->reparent (dest_rtv->view()->canvas_item()); _primary->get_canvas_group()->reparent (dest_rtv->view()->canvas_item());
@ -1680,7 +1660,6 @@ VideoTimeLineDrag::motion (GdkEvent* event, bool first_move)
DEBUG_TRACE (DEBUG::Drags, string_compose("SHIFT REGION at %1 by %2\n", i->initial_position, dt)); DEBUG_TRACE (DEBUG::Drags, string_compose("SHIFT REGION at %1 by %2\n", i->initial_position, dt));
if (first_move) { if (first_move) {
rv->drag_start (); rv->drag_start ();
_editor->update_canvas_now ();
rv->fake_set_opaque (true); rv->fake_set_opaque (true);
rv->region()->clear_changes (); rv->region()->clear_changes ();
rv->region()->suspend_property_changes(); rv->region()->suspend_property_changes();
@ -1742,7 +1721,6 @@ VideoTimeLineDrag::finished (GdkEvent * /*event*/, bool movement_occurred)
_editor->commit_reversible_command (); _editor->commit_reversible_command ();
_editor->update_canvas_now ();
} }
void void
@ -2429,9 +2407,6 @@ CursorDrag::motion (GdkEvent* event, bool)
framepos_t const adjusted_frame = adjusted_current_frame (event); framepos_t const adjusted_frame = adjusted_current_frame (event);
if (adjusted_frame != last_pointer_frame()) { if (adjusted_frame != last_pointer_frame()) {
fake_locate (adjusted_frame); fake_locate (adjusted_frame);
#ifdef GTKOSX
_editor->update_canvas_now ();
#endif
} }
} }
@ -2976,10 +2951,6 @@ MarkerDrag::motion (GdkEvent* event, bool)
assert (!_copied_locations.empty()); assert (!_copied_locations.empty());
show_verbose_cursor_time (newframe); show_verbose_cursor_time (newframe);
#ifdef GTKOSX
_editor->update_canvas_now ();
#endif
} }
void void

View file

@ -325,7 +325,7 @@ Editor::set_canvas_cursor ()
const ArdourCanvas::Item* i = items.front(); const ArdourCanvas::Item* i = items.front();
if (i && i->parent() && i->parent()->get_data (X_("timeselection"))) { if (i && i->parent() && i->parent()->get_data (X_("timeselection"))) {
pair<TimeAxisView*, int> tvp = trackview_by_y_position (_last_motion_y + vertical_adjustment.get_value()); pair<TimeAxisView*, int> tvp = trackview_by_y_position (_last_motion_y);
if (dynamic_cast<AutomationTimeAxisView*> (tvp.first)) { if (dynamic_cast<AutomationTimeAxisView*> (tvp.first)) {
current_canvas_cursor = _cursors->up_down; current_canvas_cursor = _cursors->up_down;
} }
@ -848,7 +848,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
/* grab selection for moving */ /* grab selection for moving */
_drags->set (new SelectionDrag (this, item, SelectionDrag::SelectionMove), event); _drags->set (new SelectionDrag (this, item, SelectionDrag::SelectionMove), event);
} else { } else {
double const y = event->button.y + vertical_adjustment.get_value(); double const y = event->button.y;
pair<TimeAxisView*, int> tvp = trackview_by_y_position (y); pair<TimeAxisView*, int> tvp = trackview_by_y_position (y);
if (tvp.first) { if (tvp.first) {
AutomationTimeAxisView* atv = dynamic_cast<AutomationTimeAxisView*> (tvp.first); AutomationTimeAxisView* atv = dynamic_cast<AutomationTimeAxisView*> (tvp.first);
@ -1100,7 +1100,7 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
{ {
if ( get_smart_mode() ) { if ( get_smart_mode() ) {
/* we're in "smart" joined mode, and we've clicked on a Selection */ /* we're in "smart" joined mode, and we've clicked on a Selection */
double const y = event->button.y + vertical_adjustment.get_value(); double const y = event->button.y;
pair<TimeAxisView*, int> tvp = trackview_by_y_position (y); pair<TimeAxisView*, int> tvp = trackview_by_y_position (y);
if (tvp.first) { if (tvp.first) {
/* if we're over an automation track, start a drag of its data */ /* if we're over an automation track, start a drag of its data */
@ -2680,9 +2680,6 @@ Editor::add_region_drag (ArdourCanvas::Item* item, GdkEvent*, RegionView* region
RegionSelection s = get_equivalent_regions (selection->regions, ARDOUR::Properties::select.property_id); RegionSelection s = get_equivalent_regions (selection->regions, ARDOUR::Properties::select.property_id);
_drags->add (new RegionMoveDrag (this, item, region_view, s.by_layer(), false, false)); _drags->add (new RegionMoveDrag (this, item, region_view, s.by_layer(), false, false));
} }
/* sync the canvas to what we think is its current state */
update_canvas_now();
} }
void void
@ -2860,7 +2857,7 @@ Editor::update_join_object_range_location (double /*x*/, double y)
} }
/* XXX: maybe we should make entered_track work in all cases, rather than resorting to this */ /* XXX: maybe we should make entered_track work in all cases, rather than resorting to this */
pair<TimeAxisView*, int> tvp = trackview_by_y_position (y + vertical_adjustment.get_value()); pair<TimeAxisView*, int> tvp = trackview_by_y_position (y);
if (tvp.first) { if (tvp.first) {

View file

@ -518,7 +518,7 @@ EditorRoutes::redisplay ()
/* show or hide the TimeAxisView */ /* show or hide the TimeAxisView */
if (visible) { if (visible) {
position += tv->show_at (position, n, &_editor->edit_controls_vbox); position += tv->show_at (position, n, &_editor->edit_controls_vbox);
tv->clip_to_viewport (); // SHOWTRACKS
} else { } else {
tv->hide (); tv->hide ();
} }
@ -687,7 +687,6 @@ EditorRoutes::handle_gui_changes (string const & what, void*)
/* Optional :make tracks change height while it happens, instead /* Optional :make tracks change height while it happens, instead
of on first-idle of on first-idle
*/ */
//update_canvas_now ();
redisplay (); redisplay ();
} }

View file

@ -284,16 +284,6 @@ TimeAxisView::show_at (double y, int& nth, VBox *parent)
return _effective_height; return _effective_height;
} }
void
TimeAxisView::clip_to_viewport ()
{
if (marked_for_display()) {
_canvas_background->show ();
_canvas_display->show ();
}
return;
}
bool bool
TimeAxisView::controls_ebox_scroll (GdkEventScroll* ev) TimeAxisView::controls_ebox_scroll (GdkEventScroll* ev)
{ {

View file

@ -125,8 +125,6 @@ class TimeAxisView : public virtual AxisView
virtual guint32 show_at (double y, int& nth, Gtk::VBox *parent); virtual guint32 show_at (double y, int& nth, Gtk::VBox *parent);
virtual void hide (); virtual void hide ();
void clip_to_viewport ();
bool touched (double top, double bot); bool touched (double top, double bot);
/** @return true if hidden, otherwise false */ /** @return true if hidden, otherwise false */