_track_canvas = _track_canvas_viewport->canvas ();
_track_canvas->set_background_color (UIConfiguration::instance().color ("arrange base"));
+ _track_canvas->use_nsglview ();
/* scroll group for items that should not automatically scroll
* (e.g verbose cursor). It shares the canvas coordinate space.
* uppermost (last) group with hv_scroll_group as a parent
*/
_drag_motion_group = new ArdourCanvas::Container (hv_scroll_group);
- CANVAS_DEBUG_NAME (_drag_motion_group, "Canvas Drag Motion");
+ CANVAS_DEBUG_NAME (_drag_motion_group, "Canvas Drag Motion");
/* TIME BAR CANVAS */
cd_marker_bar = new ArdourCanvas::Rectangle (cd_marker_group, ArdourCanvas::Rect (0.0, 0.0, ArdourCanvas::COORD_MAX, timebar_height));
CANVAS_DEBUG_NAME (cd_marker_bar, "CD Marker Bar");
- cd_marker_bar->set_outline_what (ArdourCanvas::Rectangle::BOTTOM);
+ cd_marker_bar->set_outline_what (ArdourCanvas::Rectangle::BOTTOM);
ARDOUR_UI::instance()->video_timeline = new VideoTimeLine(this, videotl_group, (timebar_height * videotl_bar_height));
_track_canvas->signal_enter_notify_event().connect (sigc::mem_fun(*this, &Editor::entered_track_canvas), false);
_track_canvas->set_flags (CAN_FOCUS);
+ _track_canvas->PreRender.connect (sigc::mem_fun(*this, &Editor::pre_render));
+
/* set up drag-n-drop */
vector<TargetEntry> target_table;
edit_controls_vbox.size_request (req);
w = req.width;
- if (_group_tabs->is_visible()) {
+ if (_group_tabs->is_visible()) {
_group_tabs->size_request (req);
- w += req.width;
- }
+ w += req.width;
+ }
- /* the controls layout has no horizontal scrolling, its visible
- width is always equal to the total width of its contents.
- */
+ /* the controls layout has no horizontal scrolling, its visible
+ width is always equal to the total width of its contents.
+ */
- controls_layout.property_width() = w;
- controls_layout.property_width_request() = w;
+ controls_layout.property_width() = w;
+ controls_layout.property_width_request() = w;
}
void
h += _canvas_drop_zone->height ();
- /* set the height of the scrollable area (i.e. the sum of all contained widgets)
+ /* 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;
+ controls_layout.property_height() = h;
}
do_import (midi_paths, Editing::ImportDistinctFiles, ImportAsTrack, SrcBest, SMFTrackName, SMFTempoIgnore, frame, is.selected_instrument());
if (UIConfiguration::instance().get_only_copy_imported_files() || copy) {
- do_import (audio_paths, Editing::ImportDistinctFiles, Editing::ImportAsTrack,
+ do_import (audio_paths, Editing::ImportDistinctFiles, Editing::ImportAsTrack,
SrcBest, SMFTrackName, SMFTempoIgnore, frame);
} else {
do_embed (audio_paths, Editing::ImportDistinctFiles, ImportAsTrack, frame);
selection->set (tv);
do_import (midi_paths, Editing::ImportSerializeFiles, ImportToTrack,
- SrcBest, SMFTrackName, SMFTempoIgnore, frame);
+ SrcBest, SMFTrackName, SMFTempoIgnore, frame);
if (UIConfiguration::instance().get_only_copy_imported_files() || copy) {
do_import (audio_paths, Editing::ImportSerializeFiles, Editing::ImportToTrack,
- SrcBest, SMFTrackName, SMFTempoIgnore, frame);
+ SrcBest, SMFTrackName, SMFTempoIgnore, frame);
} else {
do_embed (audio_paths, Editing::ImportSerializeFiles, ImportToTrack, frame);
}
if (from_headers) {
alloc = controls_layout.get_allocation ();
+
+ int wx, wy;
+
+ controls_layout.get_parent()->translate_coordinates (*toplevel,
+ alloc.get_x(), alloc.get_y(),
+ wx, wy);
+
+ scrolling_boundary = ArdourCanvas::Rect (wx, wy, wx + alloc.get_width(), wy + alloc.get_height());
+
+
} else {
alloc = _track_canvas_viewport->get_allocation ();
alloc.set_x (alloc.get_x() + 10);
}
- }
+ int wx, wy;
+
+ _track_canvas_viewport->get_parent()->translate_coordinates (*toplevel,
+ alloc.get_x(), alloc.get_y(),
+ wx, wy);
- scrolling_boundary = ArdourCanvas::Rect (alloc.get_x(), alloc.get_y(), alloc.get_x() + alloc.get_width(), alloc.get_y() + alloc.get_height());
+ scrolling_boundary = ArdourCanvas::Rect (wx, wy, wx + alloc.get_width(), wy + alloc.get_height());
+ }
int x, y;
Gdk::ModifierType mask;
return autoscroll_connection.connected ();
}
+std::pair <framepos_t,framepos_t>
+Editor::session_gui_extents ( bool use_extra ) const
+{
+ if (!_session) {
+ return std::pair <framepos_t,framepos_t>(max_framepos,0);
+ }
+
+ framecnt_t session_extent_start = _session->current_start_frame();
+ framecnt_t session_extent_end = _session->current_end_frame();
+
+ //calculate the extents of all regions in every playlist
+ //NOTE: we should listen to playlists, and cache these values so we don't calculate them every time.
+ {
+ boost::shared_ptr<RouteList> rl = _session->get_routes();
+ for (RouteList::iterator r = rl->begin(); r != rl->end(); ++r) {
+ boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*r);
+ if (tr) {
+ boost::shared_ptr<Playlist> pl = tr->playlist();
+ if ( pl && !pl->all_regions_empty() ) {
+ pair<framepos_t, framepos_t> e;
+ e = pl->get_extent();
+ if (e.first < session_extent_start) {
+ session_extent_start = e.first;
+ }
+ if (e.second > session_extent_end) {
+ session_extent_end = e.second;
+ }
+ }
+ }
+ }
+ }
+
+ //ToDo: also incorporate automation regions (in case the session has no audio/midi but is just used for automating plugins or the like)
+
+ //add additional time to the ui extents ( user-defined in config )
+ if (use_extra) {
+ framecnt_t const extra = UIConfiguration::instance().get_extra_ui_extents_time() * 60 * _session->nominal_frame_rate();
+ session_extent_end += extra;
+ session_extent_start -= extra;
+ }
+
+ //range-check
+ if (session_extent_end > max_framepos) {
+ session_extent_end = max_framepos;
+ }
+ if (session_extent_start < 0) {
+ session_extent_start = 0;
+ }
+
+ std::pair <framepos_t,framepos_t> ret (session_extent_start, session_extent_end);
+ return ret;
+}
+
bool
Editor::autoscroll_canvas ()
{
dx += 10 + (2 * (autoscroll_cnt/2));
dx = pixel_to_sample (dx);
+
+ dx *= UIConfiguration::instance().get_draggable_playhead_speed();
if (leftmost_frame < max_framepos - dx) {
new_frame = leftmost_frame + dx;
dx = pixel_to_sample (dx);
+ dx *= UIConfiguration::instance().get_draggable_playhead_speed();
+
if (leftmost_frame >= dx) {
new_frame = leftmost_frame - dx;
} else {
}
bool
-Editor::left_track_canvas (GdkEventCrossing */*ev*/)
+Editor::left_track_canvas (GdkEventCrossing* ev)
{
+ const bool was_within = within_track_canvas;
DropDownKeys ();
within_track_canvas = false;
set_entered_track (0);
set_entered_regionview (0);
reset_canvas_action_sensitivity (false);
+
+ if (was_within) {
+ if (ev->detail == GDK_NOTIFY_NONLINEAR ||
+ ev->detail == GDK_NOTIFY_NONLINEAR_VIRTUAL) {
+ /* context menu or something similar */
+ sensitize_the_right_region_actions (false);
+ } else {
+ sensitize_the_right_region_actions (true);
+ }
+ }
+
return false;
}
bool
-Editor::entered_track_canvas (GdkEventCrossing */*ev*/)
+Editor::entered_track_canvas (GdkEventCrossing* ev)
{
+ const bool was_within = within_track_canvas;
within_track_canvas = true;
reset_canvas_action_sensitivity (true);
- return FALSE;
+
+ if (!was_within) {
+ if (ev->detail == GDK_NOTIFY_NONLINEAR ||
+ ev->detail == GDK_NOTIFY_NONLINEAR_VIRTUAL) {
+ /* context menu or something similar */
+ sensitize_the_right_region_actions (false);
+ } else {
+ sensitize_the_right_region_actions (true);
+ }
+ }
+
+ return false;
}
void
horizontal_adjustment.set_value (p);
leftmost_frame = (framepos_t) floor (p * samples_per_pixel);
-
- update_fixed_rulers ();
- redisplay_tempo (true);
-
- if (pending_visual_change.idle_handler_id < 0) {
- _summary->set_overlays_dirty ();
- }
-
- update_video_timeline();
}
void
Editor::color_handler()
{
- ArdourCanvas::Color base = UIConfiguration::instance().color ("ruler base");
- ArdourCanvas::Color text = UIConfiguration::instance().color ("ruler text");
+ Gtkmm2ext::Color base = UIConfiguration::instance().color ("ruler base");
+ Gtkmm2ext::Color text = UIConfiguration::instance().color ("ruler text");
timecode_ruler->set_fill_color (base);
timecode_ruler->set_outline_color (text);
minsec_ruler->set_fill_color (base);