13
0

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.
This commit is contained in:
Robin Gareus 2022-07-06 20:35:16 +02:00
parent 87d17f6624
commit 8ead1439d8
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
4 changed files with 17 additions and 19 deletions

View File

@ -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"))

View File

@ -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<Gtk::ToggleAction> ruler_video_action;
Glib::RefPtr<Gtk::ToggleAction> xjadeo_proc_action;
Glib::RefPtr<Gtk::ToggleAction> xjadeo_ontop_action;

View File

@ -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));

View File

@ -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();