#include "gtk2ardour-config.h"
#endif
-#include <jack/types.h>
-
#include "gtkmm2ext/utils.h"
#include "ardour/profile.h"
#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"
using namespace Gtkmm2ext;
using namespace Editing;
-/* XXX this is a hack. it ought to be the maximum value of an framepos_t */
-
-const double max_canvas_coordinate = (double) JACK_MAX_FRAMES;
-
void
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);
+
+ 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");
- _time_bars_canvas_viewport = new ArdourCanvas::GtkCanvasViewport (horizontal_adjustment, unused_adjustment);
- _time_bars_canvas = _time_bars_canvas_viewport->canvas ();
-
_verbose_cursor = new VerboseCursor (this);
/* on the bottom, an image */
// logo_item->property_width_in_pixels() = true;
// logo_item->property_height_set() = true;
// logo_item->property_width_set() = true;
- logo_item->show ();
+ // 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));
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 ();
+
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));
CANVAS_DEBUG_NAME (meter_bar, "meter Bar");
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);
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));
if (logo_item) {
logo_item->lower_to_bottom ();
}
- /* need to handle 4 specific types of events as catch-alls */
+
+
+ _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);
+ _canvas_bottom_rect->Event.connect (sigc::mem_fun (*this, &Editor::canvas_bottom_rect_event));
+
+ /* these signals will initially be delivered to the canvas itself, but if they end up remaining unhandled, they are passed to Editor-level
+ handlers.
+ */
_track_canvas->signal_scroll_event().connect (sigc::mem_fun (*this, &Editor::track_canvas_scroll_event));
_track_canvas->signal_motion_notify_event().connect (sigc::mem_fun (*this, &Editor::track_canvas_motion_notify_event));
track_canvas_viewport_size_allocated ();
}
-bool
+void
Editor::track_canvas_viewport_size_allocated ()
{
bool height_changed = _visible_canvas_height != _canvas_viewport_allocation.get_height();
*/
vertical_adjustment.set_value (_full_canvas_height - _visible_canvas_height);
}
+
+ set_visible_track_count (_visible_track_count);
}
update_fixed_rulers();
redisplay_tempo (false);
_summary->set_overlays_dirty ();
-
- return false;
}
void
void
Editor::reset_controls_layout_height (int32_t h)
{
+ /* ensure that the rect that represents the "bottom" of the canvas
+ * (the drag-n-drop zone) is, in fact, at the bottom.
+ */
+
+ _canvas_bottom_rect->set_position (ArdourCanvas::Duple (0, h));
+
+ /* track controls layout must span the full height of "h" (all tracks)
+ * plus the bottom rect.
+ */
+
+ h += _canvas_bottom_rect->height ();
+
/* set the height of the scrollable area (i.e. the sum of all contained widgets)
+ * for the controls layout. The size request is set elsewhere.
*/
controls_layout.property_height() = h;
- /* size request is set elsewhere, see ::track_canvas_allocate() */
}
bool
return;
}
-
ArdourCanvas::Rect scrolling_boundary;
Gtk::Allocation alloc;
/* vertical */
- new_pixel = vertical_pos;
-
if (y < autoscroll_boundary.y0) {
/* scroll to make higher tracks visible */
}
void
-Editor::ensure_time_axis_view_is_visible (const TimeAxisView& tav)
+Editor::_ensure_time_axis_view_is_visible (const TimeAxisView& tav, bool at_top)
{
double begin = tav.y_position();
-
double v = vertical_adjustment.get_value ();
- if (begin < v || begin + tav.current_height() > v + _visible_canvas_height) {
+ if (!at_top && (begin < v || begin + tav.current_height() > v + _visible_canvas_height)) {
/* try to put the TimeAxisView roughly central */
if (begin >= _visible_canvas_height/2.0) {
begin -= _visible_canvas_height/2.0;
}
- vertical_adjustment.set_value (begin);
}
+
+ /* Clamp the y pos so that we do not extend beyond the canvas full
+ * height.
+ */
+ if (_full_canvas_height - begin < _visible_canvas_height){
+ begin = _full_canvas_height - _visible_canvas_height;
+ }
+
+ vertical_adjustment.set_value (begin);
}
/** Called when the main vertical_adjustment has changed */
ArdourCanvas::Group*
Editor::get_track_canvas_group() const
{
- return _track_canvas->root();
+ return hv_scroll_group;
}
ArdourCanvas::GtkCanvasViewport*