From 8ead1439d82b2d5f8b476bcd276a85936b4295a8 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 6 Jul 2022 20:35:16 +0200 Subject: [PATCH] Fix ruler/canvas separator The track-header (gtk) is packed with 1px box spacing. This is added at the top of each box (best seen by looking at the group-tab vs track-header alignment in the editor). However the actual track separator line on the canvas is at the bottom of each track, aligning with the top of the next track or automation-lane. The first track however lacks a separator at the top, which needs to be provided by the ruler. Once the canvas is scrolled this ruler/canvas separator overlaps with the bottom separator of each TAV. Using ruler Rectangle::set_outline had various issues. The outline extends outside the rectangle. It bled into the video-timeline instead of the canvas' top y-axis pixel. Also the separator was above the video-timeline, not above the canvas. Hence a dedicated separator Line is preferable. It also provides a consistent separator if no rulers are visible. --- gtk2_ardour/editor.cc | 2 ++ gtk2_ardour/editor.h | 5 +++-- gtk2_ardour/editor_canvas.cc | 7 +++++++ gtk2_ardour/editor_rulers.cc | 22 +++++----------------- 4 files changed, 17 insertions(+), 19 deletions(-) diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 5599f2fd5b..ba77357829 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -333,6 +333,8 @@ Editor::Editor () , range_marker_bar (0) , transport_marker_bar (0) , cd_marker_bar (0) + , cue_marker_bar (0) + , ruler_separator (0) , minsec_label (_("Mins:Secs")) , bbt_label (_("Bars:Beats")) , timecode_label (_("Timecode")) diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index f3c6b3ec45..229977292d 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -1045,6 +1045,7 @@ private: ArdourCanvas::Rectangle* transport_marker_bar; ArdourCanvas::Rectangle* cd_marker_bar; ArdourCanvas::Rectangle* cue_marker_bar; + ArdourCanvas::Line* ruler_separator; void toggle_cue_behavior (); @@ -1061,8 +1062,8 @@ private: Gtk::Label cue_mark_label; /* videtimline related actions */ - Gtk::Label videotl_label; - ArdourCanvas::Container* videotl_group; + Gtk::Label videotl_label; + ArdourCanvas::Container* videotl_group; Glib::RefPtr ruler_video_action; Glib::RefPtr xjadeo_proc_action; Glib::RefPtr xjadeo_ontop_action; diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc index 1da41659c3..deff6537cc 100644 --- a/gtk2_ardour/editor_canvas.cc +++ b/gtk2_ardour/editor_canvas.cc @@ -190,6 +190,13 @@ Editor::initialize_canvas () cue_marker_bar = new ArdourCanvas::Rectangle (cue_marker_group, ArdourCanvas::Rect (0.0, timebar_top, ArdourCanvas::COORD_MAX, timebar_btm)); CANVAS_DEBUG_NAME (cue_marker_bar, "Cue Marker Bar"); + ruler_separator = new ArdourCanvas::Line(_time_markers_group); + CANVAS_DEBUG_NAME (ruler_separator, "separator between ruler and main canvas"); + ruler_separator->set (ArdourCanvas::Duple(0.0, 0.0), ArdourCanvas::Duple(ArdourCanvas::COORD_MAX, 0.0)); + ruler_separator->set_outline_color(Gtkmm2ext::rgba_to_color (0, 0, 0, 1.0)); + ruler_separator->set_outline_width(1.0); + ruler_separator->show(); + ARDOUR_UI::instance()->video_timeline = new VideoTimeLine(this, videotl_group, (timebar_height * videotl_bar_height)); cd_marker_bar_drag_rect = new ArdourCanvas::Rectangle (cd_marker_group, ArdourCanvas::Rect (0.0, 0.0, 100, timebar_height)); diff --git a/gtk2_ardour/editor_rulers.cc b/gtk2_ardour/editor_rulers.cc index 606c58f6af..3f0d2df156 100644 --- a/gtk2_ardour/editor_rulers.cc +++ b/gtk2_ardour/editor_rulers.cc @@ -534,8 +534,6 @@ Editor::update_ruler_visibility () tempo_label.hide(); } - ArdourCanvas::Rectangle *last_marker_bar = 0; - if (ruler_range_action->get_active()) { old_unit_pos = range_marker_group->position().y; if (tbpos != old_unit_pos) { @@ -545,7 +543,6 @@ Editor::update_ruler_visibility () range_mark_label.show(); range_marker_bar->set_outline(false); - last_marker_bar = range_marker_bar; tbpos += timebar_height; tbgpos += timebar_height; @@ -564,7 +561,6 @@ Editor::update_ruler_visibility () transport_mark_label.show(); transport_marker_bar->set_outline(false); - last_marker_bar = transport_marker_bar; tbpos += timebar_height; tbgpos += timebar_height; @@ -583,7 +579,6 @@ Editor::update_ruler_visibility () cd_mark_label.show(); cd_marker_bar->set_outline(false); - last_marker_bar = cd_marker_bar; tbpos += timebar_height; tbgpos += timebar_height; @@ -606,7 +601,6 @@ Editor::update_ruler_visibility () mark_label.show(); marker_bar->set_outline(false); - last_marker_bar = marker_bar; tbpos += timebar_height; tbgpos += timebar_height; @@ -625,7 +619,6 @@ Editor::update_ruler_visibility () cue_mark_label.show(); cue_marker_bar->set_outline(false); - last_marker_bar = cue_marker_bar; tbpos += timebar_height; tbgpos += timebar_height; @@ -639,12 +632,6 @@ Editor::update_ruler_visibility () update_cue_marker_display(); } - //the bottom ruler needs a black outline to separate it from the editor canvas - if ( last_marker_bar ) { - last_marker_bar->set_outline(true); - last_marker_bar->set_outline_what(ArdourCanvas::Rectangle::BOTTOM); - } - if (ruler_video_action->get_active()) { old_unit_pos = videotl_group->position().y; if (tbpos != old_unit_pos) { @@ -662,12 +649,13 @@ Editor::update_ruler_visibility () update_video_timeline(true); } - time_bars_vbox.set_size_request (-1, (int)(timebar_height * visible_timebars)); + ruler_separator->set_y_position ((int)(timebar_height * visible_timebars)); - /* move hv_scroll_group (trackviews) to the end of the timebars - */ + time_bars_vbox.set_size_request (-1, (int)(timebar_height * visible_timebars) + 1); - hv_scroll_group->set_y_position (timebar_height * visible_timebars); + /* move hv_scroll_group (trackviews) to the end of the timebars */ + + hv_scroll_group->set_y_position ((int)(timebar_height * visible_timebars)); compute_fixed_ruler_scale (); update_fixed_rulers();