summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2013-04-12 21:47:02 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2013-04-12 21:47:02 -0400
commit83c6aee3b7ca73177a4fddda06283a20ab0ddfb7 (patch)
tree27f7bc4de0f7c33e6aa9a7f00c741081d91505eb /gtk2_ardour
parent4e84bc3a39ca624d62be590c532a8bc33b33baa4 (diff)
parent4e9108cd1e21b4a96aeaf6978c037f5d789da8a2 (diff)
Merge branch 'cairocanvas' of git.ardour.org:ardour/ardour into cairocanvas
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/editor.cc1
-rw-r--r--gtk2_ardour/editor.h4
-rw-r--r--gtk2_ardour/editor_canvas.cc54
-rw-r--r--gtk2_ardour/editor_canvas_events.cc10
-rw-r--r--gtk2_ardour/editor_drag.cc29
-rw-r--r--gtk2_ardour/editor_mouse.cc11
-rw-r--r--gtk2_ardour/editor_routes.cc3
-rw-r--r--gtk2_ardour/time_axis_view.cc10
-rw-r--r--gtk2_ardour/time_axis_view.h2
9 files changed, 14 insertions, 110 deletions
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc
index 4e372188ba..9050797216 100644
--- a/gtk2_ardour/editor.cc
+++ b/gtk2_ardour/editor.cc
@@ -4780,7 +4780,6 @@ Editor::idle_resize ()
}
_pending_resize_amount = 0;
- flush_canvas ();
_group_tabs->set_dirty ();
resize_idle_id = -1;
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h
index eabfa49984..6158aac5e8 100644
--- a/gtk2_ardour/editor.h
+++ b/gtk2_ardour/editor.h
@@ -248,8 +248,6 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
return sample / samples_per_pixel;
}
- void flush_canvas ();
-
/* 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_removed ();
- void update_canvas_now ();
-
EditorGroupTabs* _group_tabs;
void fit_route_group (ARDOUR::RouteGroup *);
diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc
index 27d51bb9f7..0b133cea19 100644
--- a/gtk2_ardour/editor_canvas.cc
+++ b/gtk2_ardour/editor_canvas.cc
@@ -261,15 +261,7 @@ Editor::track_canvas_viewport_size_allocated ()
_visible_canvas_width = _canvas_viewport_allocation.get_width ();
_visible_canvas_height = _canvas_viewport_allocation.get_height ();
- cerr << "VISIBLE CANVAS now: " << _visible_canvas_width << " x " << _visible_canvas_height << endl;
-
- if (_session) {
- TrackViewList::iterator i;
-
- for (i = track_views.begin(); i != track_views.end(); ++i) {
- (*i)->clip_to_viewport ();
- }
- }
+ // SHOWTRACKS
if (height_changed) {
@@ -744,19 +736,8 @@ Editor::ensure_time_axis_view_is_visible (const TimeAxisView& tav)
void
Editor::tie_vertical_scrolling ()
{
-
_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());
if (pending_visual_change.idle_handler_id < 0) {
@@ -806,12 +787,7 @@ Editor::scroll_canvas_vertically ()
_trackview_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 ();
- /* required to keep the controls_layout in lock step with the canvas group */
- update_canvas_now ();
}
#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
Editor::horizontal_position () const
{
diff --git a/gtk2_ardour/editor_canvas_events.cc b/gtk2_ardour/editor_canvas_events.cc
index 86577f44af..abc6ea96ad 100644
--- a/gtk2_ardour/editor_canvas_events.cc
+++ b/gtk2_ardour/editor_canvas_events.cc
@@ -63,6 +63,12 @@ Editor::track_canvas_scroll (GdkEventScroll* ev)
framepos_t xdelta;
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:
switch (direction) {
case GDK_SCROLL_UP:
@@ -79,7 +85,7 @@ Editor::track_canvas_scroll (GdkEventScroll* ev)
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
if (!current_stepping_trackview) {
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;
if (!current_stepping_trackview) {
return false;
@@ -108,7 +114,7 @@ Editor::track_canvas_scroll (GdkEventScroll* ev)
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
if (!current_stepping_trackview) {
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;
if (!current_stepping_trackview) {
return false;
diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc
index 0d64d940f2..d753d59551 100644
--- a/gtk2_ardour/editor_drag.cc
+++ b/gtk2_ardour/editor_drag.cc
@@ -667,11 +667,6 @@ RegionMotionDrag::motion (GdkEvent* event, bool first_move)
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
region selection above all time axis views.
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;
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());
framecnt_t const drag_delta = _primary->region()->position() - _last_frame_position;
- _editor->update_canvas_now ();
-
if (_copy) {
finished_copy (
@@ -1278,8 +1262,6 @@ RegionMotionDrag::aborted (bool)
rv->move (-_total_x_delta, 0);
rv->set_height (rtv->view()->child_height ());
}
-
- _editor->update_canvas_now ();
}
/** @param b true to brush, otherwise false.
@@ -1328,8 +1310,6 @@ RegionInsertDrag::RegionInsertDrag (Editor* e, boost::shared_ptr<Region> r, Rout
void
RegionInsertDrag::finished (GdkEvent *, bool)
{
- _editor->update_canvas_now ();
-
RouteTimeAxisView* dest_rtv = dynamic_cast<RouteTimeAxisView*> (_time_axis_views[_views.front().time_axis_view]);
_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));
if (first_move) {
rv->drag_start ();
- _editor->update_canvas_now ();
rv->fake_set_opaque (true);
rv->region()->clear_changes ();
rv->region()->suspend_property_changes();
@@ -1742,7 +1721,6 @@ VideoTimeLineDrag::finished (GdkEvent * /*event*/, bool movement_occurred)
_editor->commit_reversible_command ();
- _editor->update_canvas_now ();
}
void
@@ -2429,9 +2407,6 @@ CursorDrag::motion (GdkEvent* event, bool)
framepos_t const adjusted_frame = adjusted_current_frame (event);
if (adjusted_frame != last_pointer_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());
show_verbose_cursor_time (newframe);
-
-#ifdef GTKOSX
- _editor->update_canvas_now ();
-#endif
}
void
diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc
index e33da47d4f..c838f16f44 100644
--- a/gtk2_ardour/editor_mouse.cc
+++ b/gtk2_ardour/editor_mouse.cc
@@ -325,7 +325,7 @@ Editor::set_canvas_cursor ()
const ArdourCanvas::Item* i = items.front();
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)) {
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 */
_drags->set (new SelectionDrag (this, item, SelectionDrag::SelectionMove), event);
} 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);
if (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() ) {
/* 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);
if (tvp.first) {
/* 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);
_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
@@ -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 */
- 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) {
diff --git a/gtk2_ardour/editor_routes.cc b/gtk2_ardour/editor_routes.cc
index bf629ea27d..b700556402 100644
--- a/gtk2_ardour/editor_routes.cc
+++ b/gtk2_ardour/editor_routes.cc
@@ -518,7 +518,7 @@ EditorRoutes::redisplay ()
/* show or hide the TimeAxisView */
if (visible) {
position += tv->show_at (position, n, &_editor->edit_controls_vbox);
- tv->clip_to_viewport ();
+ // SHOWTRACKS
} else {
tv->hide ();
}
@@ -687,7 +687,6 @@ EditorRoutes::handle_gui_changes (string const & what, void*)
/* Optional :make tracks change height while it happens, instead
of on first-idle
*/
- //update_canvas_now ();
redisplay ();
}
diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc
index f8127b1172..433eee350d 100644
--- a/gtk2_ardour/time_axis_view.cc
+++ b/gtk2_ardour/time_axis_view.cc
@@ -284,16 +284,6 @@ TimeAxisView::show_at (double y, int& nth, VBox *parent)
return _effective_height;
}
-void
-TimeAxisView::clip_to_viewport ()
-{
- if (marked_for_display()) {
- _canvas_background->show ();
- _canvas_display->show ();
- }
- return;
-}
-
bool
TimeAxisView::controls_ebox_scroll (GdkEventScroll* ev)
{
diff --git a/gtk2_ardour/time_axis_view.h b/gtk2_ardour/time_axis_view.h
index 86fd6ae67b..17b702ec38 100644
--- a/gtk2_ardour/time_axis_view.h
+++ b/gtk2_ardour/time_axis_view.h
@@ -125,8 +125,6 @@ class TimeAxisView : public virtual AxisView
virtual guint32 show_at (double y, int& nth, Gtk::VBox *parent);
virtual void hide ();
- void clip_to_viewport ();
-
bool touched (double top, double bot);
/** @return true if hidden, otherwise false */