summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/editor.h15
-rw-r--r--gtk2_ardour/editor_canvas.cc37
-rw-r--r--gtk2_ardour/editor_cursors.cc4
-rw-r--r--gtk2_ardour/editor_mouse.cc18
-rw-r--r--gtk2_ardour/verbose_cursor.cc2
5 files changed, 47 insertions, 29 deletions
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h
index 4653ccc6b4..f6623a3a15 100644
--- a/gtk2_ardour/editor.h
+++ b/gtk2_ardour/editor.h
@@ -733,7 +733,20 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
ArdourCanvas::Group* transport_marker_bar_group;
ArdourCanvas::Group* cd_marker_bar_group;
- /* The group containing all trackviews. Only scrolled vertically. */
+ /* The group containing all other groups that are scrolled vertically
+ and horizontally.
+ */
+ ArdourCanvas::Group* hv_scroll_group;
+
+ /* The group containing all other groups that are scrolled vertically ONLY
+ */
+ ArdourCanvas::Group* v_scroll_group;
+
+ /* The group containing all other groups that are scrolled horizontally ONLY
+ */
+ ArdourCanvas::Group* h_scroll_group;
+
+ /* The group containing all trackviews. */
ArdourCanvas::Group* _trackview_group;
/* The group used for region motion. Sits on top of _trackview_group */
diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc
index 2b491e7974..02c3e9d500 100644
--- a/gtk2_ardour/editor_canvas.cc
+++ b/gtk2_ardour/editor_canvas.cc
@@ -30,6 +30,7 @@
#include "canvas/canvas.h"
#include "canvas/rectangle.h"
#include "canvas/pixbuf.h"
+#include "canvas/scroll_group.h"
#include "canvas/text.h"
#include "canvas/debug.h"
@@ -65,7 +66,12 @@ Editor::initialize_canvas ()
{
_track_canvas_viewport = new ArdourCanvas::GtkCanvasViewport (horizontal_adjustment, vertical_adjustment);
_track_canvas = _track_canvas_viewport->canvas ();
- //_track_canvas->set_global_scroll (false);
+ _track_canvas->set_global_scroll (false);
+
+ hv_scroll_group = new ArdourCanvas::ScrollGroup (_track_canvas->root(),
+ ArdourCanvas::ScrollGroup::ScrollSensitivity (ArdourCanvas::ScrollGroup::ScrollsVertically|
+ ArdourCanvas::ScrollGroup::ScrollsHorizontally));
+ CANVAS_DEBUG_NAME (hv_scroll_group, "canvas hv scroll");
_verbose_cursor = new VerboseCursor (this);
@@ -80,9 +86,9 @@ Editor::initialize_canvas ()
// logo_item->property_width_set() = true;
// logo_item->show ();
}
-
+
/*a group to hold global rects like punch/loop indicators */
- global_rect_group = new ArdourCanvas::Group (_track_canvas->root());
+ global_rect_group = new ArdourCanvas::Group (hv_scroll_group);
CANVAS_DEBUG_NAME (global_rect_group, "global rect group");
transport_loop_range_rect = new ArdourCanvas::Rectangle (global_rect_group, ArdourCanvas::Rect (0.0, 0.0, 0.0, ArdourCanvas::COORD_MAX));
@@ -94,21 +100,20 @@ Editor::initialize_canvas ()
transport_punch_range_rect->hide();
/*a group to hold time (measure) lines */
- time_line_group = new ArdourCanvas::Group (_track_canvas->root());
+ time_line_group = new ArdourCanvas::Group (hv_scroll_group);
CANVAS_DEBUG_NAME (time_line_group, "time line group");
- _trackview_group = new ArdourCanvas::Group (_track_canvas->root());
+ _trackview_group = new ArdourCanvas::Group (hv_scroll_group);
//_trackview_group->set_scroll_sensitivity (ArdourCanvas::Group::ScrollSensitivity (ArdourCanvas::Group::ScrollsVertically|ArdourCanvas::Group::ScrollsHorizontally));
CANVAS_DEBUG_NAME (_trackview_group, "Canvas TrackViews");
-
+ _region_motion_group = new ArdourCanvas::Group (_trackview_group);
+ CANVAS_DEBUG_NAME (_region_motion_group, "Canvas Region Motion");
+
/* TIME BAR CANVAS */
_time_bars_canvas_viewport = new ArdourCanvas::GtkCanvasViewport (horizontal_adjustment, unused_adjustment);
_time_bars_canvas = _time_bars_canvas_viewport->canvas ();
-
- _region_motion_group = new ArdourCanvas::Group (_trackview_group);
- CANVAS_DEBUG_NAME (_region_motion_group, "Canvas Region Motion");
meter_bar_group = new ArdourCanvas::Group (_time_bars_canvas->root ());
meter_bar = new ArdourCanvas::Rectangle (meter_bar_group, ArdourCanvas::Rect (0.0, 0.0, ArdourCanvas::COORD_MAX, timebar_height));
@@ -177,14 +182,14 @@ Editor::initialize_canvas ()
transport_bar_drag_rect->set_outline (false);
transport_bar_drag_rect->hide ();
- transport_punchin_line = new ArdourCanvas::Line (_track_canvas->root());
+ transport_punchin_line = new ArdourCanvas::Line (hv_scroll_group);
transport_punchin_line->set_x0 (0);
transport_punchin_line->set_y0 (0);
transport_punchin_line->set_x1 (0);
transport_punchin_line->set_y1 (ArdourCanvas::COORD_MAX);
transport_punchin_line->hide ();
- transport_punchout_line = new ArdourCanvas::Line (_track_canvas->root());
+ transport_punchout_line = new ArdourCanvas::Line (hv_scroll_group);
transport_punchout_line->set_x0 (0);
transport_punchout_line->set_y0 (0);
transport_punchout_line->set_x1 (0);
@@ -192,12 +197,12 @@ Editor::initialize_canvas ()
transport_punchout_line->hide();
// used to show zoom mode active zooming
- zoom_rect = new ArdourCanvas::Rectangle (_track_canvas->root(), ArdourCanvas::Rect (0.0, 0.0, 0.0, 0.0));
+ zoom_rect = new ArdourCanvas::Rectangle (hv_scroll_group, ArdourCanvas::Rect (0.0, 0.0, 0.0, 0.0));
zoom_rect->hide();
zoom_rect->Event.connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_zoom_rect_event), (ArdourCanvas::Item*) 0));
// used as rubberband rect
- rubberband_rect = new ArdourCanvas::Rectangle (_trackview_group, ArdourCanvas::Rect (0.0, 0.0, 0.0, 0.0));
+ rubberband_rect = new ArdourCanvas::Rectangle (hv_scroll_group, ArdourCanvas::Rect (0.0, 0.0, 0.0, 0.0));
rubberband_rect->hide();
tempo_bar->Event.connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_tempo_bar_event), tempo_bar));
@@ -215,7 +220,7 @@ Editor::initialize_canvas ()
}
- _canvas_bottom_rect = new ArdourCanvas::Rectangle (_track_canvas->root(), ArdourCanvas::Rect (0.0, 0.0, ArdourCanvas::COORD_MAX, 20));
+ _canvas_bottom_rect = new ArdourCanvas::Rectangle (hv_scroll_group, ArdourCanvas::Rect (0.0, 0.0, ArdourCanvas::COORD_MAX, 20));
/* this thing is transparent */
_canvas_bottom_rect->set_fill (false);
_canvas_bottom_rect->set_outline (false);
@@ -591,8 +596,6 @@ Editor::autoscroll_canvas ()
/* vertical */
- new_pixel = vertical_pos;
-
if (y < autoscroll_boundary.y0) {
/* scroll to make higher tracks visible */
@@ -931,7 +934,7 @@ Editor::get_time_bars_group () const
ArdourCanvas::Group*
Editor::get_track_canvas_group() const
{
- return _track_canvas->root();
+ return hv_scroll_group;
}
ArdourCanvas::GtkCanvasViewport*
diff --git a/gtk2_ardour/editor_cursors.cc b/gtk2_ardour/editor_cursors.cc
index 1dd0d42a51..461fe4758e 100644
--- a/gtk2_ardour/editor_cursors.cc
+++ b/gtk2_ardour/editor_cursors.cc
@@ -33,8 +33,8 @@ using namespace Gtk;
EditorCursor::EditorCursor (Editor& ed, bool (Editor::*callbck)(GdkEvent*,ArdourCanvas::Item*))
: _editor (ed)
- , _time_bars_canvas_item (new ArdourCanvas::Arrow (_editor._time_bars_canvas->root ()))
- , _track_canvas_item (new ArdourCanvas::Line (_editor._track_canvas->root ()))
+ , _time_bars_canvas_item (new ArdourCanvas::Arrow (_editor.get_time_bars_group()))
+ , _track_canvas_item (new ArdourCanvas::Line (_editor.get_track_canvas_group()))
, _length (1.0)
{
CANVAS_DEBUG_NAME (_time_bars_canvas_item, "timebars editor cursor");
diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc
index 4d3c01b46d..ef34914930 100644
--- a/gtk2_ardour/editor_mouse.cc
+++ b/gtk2_ardour/editor_mouse.cc
@@ -134,18 +134,22 @@ Editor::mouse_frame (framepos_t& where, bool& in_track_canvas) const
framepos_t
Editor::window_event_sample (GdkEvent const * event, double* pcx, double* pcy) const
{
- double x;
- double y;
+ ArdourCanvas::Duple d;
- if (!gdk_event_get_coords (event, &x, &y)) {
+ if (!gdk_event_get_coords (event, &d.x, &d.y)) {
return 0;
}
+ /* adjust for scrolling (the canvas used by Ardour has global scroll
+ * disabled, so we have to do the adjustment explicitly).
+ */
+
+ d.translate (ArdourCanvas::Duple (horizontal_adjustment.get_value(), vertical_adjustment.get_value()));
+
/* event coordinates are in window units, so convert to canvas
- * (i.e. account for scrolling)
*/
- ArdourCanvas::Duple d = _track_canvas->window_to_canvas (ArdourCanvas::Duple (x, y));
+ d = _track_canvas->window_to_canvas (d);
if (pcx) {
*pcx = d.x;
@@ -317,7 +321,7 @@ Editor::set_canvas_cursor ()
vector<ArdourCanvas::Item const *> items;
- _track_canvas->root()->add_items_at_point (ArdourCanvas::Duple (x,y), items);
+ get_track_canvas_group()->add_items_at_point (ArdourCanvas::Duple (x,y), items);
// first item will be the upper most
@@ -2101,7 +2105,6 @@ Editor::leave_handler (ArdourCanvas::Item* item, GdkEvent*, ItemType item_type)
AutomationLine* al;
Marker *marker;
Location *loc;
- RegionView* rv;
bool is_start;
bool ret = true;
@@ -2186,7 +2189,6 @@ Editor::leave_handler (ArdourCanvas::Item* item, GdkEvent*, ItemType item_type)
case FadeOutTrimHandleItem:
case FadeInHandleItem:
case FadeOutHandleItem:
- rv = static_cast<RegionView*>(item->get_data ("regionview"));
{
ArdourCanvas::Rectangle *rect = dynamic_cast<ArdourCanvas::Rectangle *> (item);
if (rect) {
diff --git a/gtk2_ardour/verbose_cursor.cc b/gtk2_ardour/verbose_cursor.cc
index 497fb12152..e993583127 100644
--- a/gtk2_ardour/verbose_cursor.cc
+++ b/gtk2_ardour/verbose_cursor.cc
@@ -43,7 +43,7 @@ VerboseCursor::VerboseCursor (Editor* editor)
, _xoffset (0)
, _yoffset (0)
{
- _canvas_item = new ArdourCanvas::Text (_editor->_track_canvas->root());
+ _canvas_item = new ArdourCanvas::Text (_editor->get_track_canvas_group());
CANVAS_DEBUG_NAME (_canvas_item, "verbose canvas cursor");
_canvas_item->set_ignore_events (true);
_canvas_item->set_font_description (get_font_for_style (N_("VerboseCanvasCursor")));