Indicate selection extents in time ruler

This commit is contained in:
Robin Gareus 2023-05-16 23:46:12 +02:00
parent 1ee2675716
commit cb78043adc
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
9 changed files with 51 additions and 0 deletions

View File

@ -294,6 +294,7 @@ Editor::Editor ()
, transport_marker_group (0)
, cd_marker_group (0)
, _time_markers_group (0)
, _selection_marker_group (0)
, hv_scroll_group (0)
, h_scroll_group (0)
, cursor_scroll_group (0)
@ -6774,6 +6775,8 @@ Editor::ui_parameter_changed (string parameter)
/* handled individually by each MidiRegionView */
} else if (parameter == "tempo-edit-behavior") {
set_tempo_edit_behavior (UIConfiguration::instance().get_tempo_edit_behavior());
} else if (parameter == "show-selection-marker") {
update_ruler_visibility ();
}
}

View File

@ -729,6 +729,7 @@ private:
void trigger_script_by_name (const std::string script_name, const std::string args = "");
void toggle_marker_lines ();
void set_marker_line_visibility (bool);
void update_selection_markers ();
void jump_forward_to_mark ();
void jump_backward_to_mark ();
@ -930,6 +931,10 @@ private:
/* parent for groups which themselves contain time markers */
ArdourCanvas::Container* _time_markers_group;
/* parent for group for selection marker (above ruler) */
ArdourCanvas::Container* _selection_marker_group;
LocationMarkers _selection_marker;
/* The group containing all other groups that are scrolled vertically
and horizontally.
*/

View File

@ -143,6 +143,12 @@ Editor::initialize_canvas ()
_time_markers_group = new ArdourCanvas::Container (h_scroll_group);
CANVAS_DEBUG_NAME (_time_markers_group, "time bars");
/* group above rulers, to show selection triangles */
_selection_marker_group = new ArdourCanvas::Container (h_scroll_group);
CANVAS_DEBUG_NAME (_selection_marker_group, "Canvas Selection Ruler");
_selection_marker.start = new SelectionMarker (*this, *_selection_marker_group, 0xff0000ff, ArdourMarker::SelectionStart);
_selection_marker.end = new SelectionMarker (*this, *_selection_marker_group, 0xff0000ff, ArdourMarker::SelectionEnd);
_selection_marker_group->raise_to_top ();
/* Note that because of ascending-y-axis coordinates, this order is
* bottom-to-top. But further note that the actual order is set in

View File

@ -2014,6 +2014,18 @@ Editor::find_marker_from_location_id (PBD::ID const & id, bool is_start) const
return 0;
}
void
Editor::update_selection_markers ()
{
timepos_t start, end;
if (get_selection_extents (start, end)) {
_selection_marker.set_position (start, end);
_selection_marker.show ();
} else {
_selection_marker.hide ();
}
}
void
Editor::toggle_cue_behavior ()
{

View File

@ -428,6 +428,7 @@ void
Editor::update_ruler_visibility ()
{
int visible_timebars = 0;
bool have_timebar = false;
if (no_ruler_shown_update) {
return;
@ -466,6 +467,7 @@ Editor::update_ruler_visibility ()
tbpos += timebar_height;
tbgpos += timebar_height;
visible_timebars++;
have_timebar = true;
} else {
minsec_ruler->hide();
minsec_label.hide();
@ -481,6 +483,7 @@ Editor::update_ruler_visibility ()
tbpos += timebar_height;
tbgpos += timebar_height;
visible_timebars++;
have_timebar = true;
} else {
timecode_ruler->hide();
timecode_label.hide();
@ -496,6 +499,7 @@ Editor::update_ruler_visibility ()
tbpos += timebar_height;
tbgpos += timebar_height;
visible_timebars++;
have_timebar = true;
} else {
samples_ruler->hide();
samples_label.hide();
@ -511,6 +515,7 @@ Editor::update_ruler_visibility ()
tbpos += timebar_height;
tbgpos += timebar_height;
visible_timebars++;
have_timebar = true;
} else {
bbt_ruler->hide();
bbt_label.hide();
@ -661,6 +666,12 @@ Editor::update_ruler_visibility ()
update_video_timeline(true);
}
if (have_timebar && UIConfiguration::instance().get_show_selection_marker ()) {
_selection_marker_group->show ();
} else {
_selection_marker_group->hide ();
}
ruler_separator->set_y_position ((int)(timebar_height * visible_timebars));
time_bars_vbox.set_size_request (-1, (int)(timebar_height * visible_timebars) + 1);

View File

@ -1300,6 +1300,8 @@ Editor::time_selection_changed ()
_session->clear_range_selection ();
}
}
update_selection_markers ();
}
/** Set all region actions to have a given sensitivity */
@ -1737,6 +1739,7 @@ Editor::region_selection_changed ()
set_mouse_mode (MouseObject, false);
}
}
update_selection_markers ();
}
void

View File

@ -170,6 +170,8 @@
regions gain envelope volume modes
[show-region-name]
regions name appearance editor
[show-selection-marker]
selection ruler marker range
[show-region-xrun-markers]
regions xruns markers dropouts
[show-secondary-clock]

View File

@ -2642,6 +2642,14 @@ RCOptionEditor::RCOptionEditor ()
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_show_region_name)
));
add_option (_("Appearance/Editor"),
new BoolOption (
"show-selection-marker",
_("Show Selection Marker"),
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_show_selection_marker),
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_show_selection_marker)
));
HSliderOption *gui_hs;

View File

@ -138,6 +138,7 @@ UI_CONFIG_VARIABLE (bool, snap_to_region_sync, "snap-to-region-sync", true)
UI_CONFIG_VARIABLE (bool, snap_to_region_start, "snap-to-region-start", true)
UI_CONFIG_VARIABLE (bool, snap_to_region_end, "snap-to-region-end", true)
UI_CONFIG_VARIABLE (bool, snap_to_grid, "snap-to-grid", true)
UI_CONFIG_VARIABLE (bool, show_selection_marker, "show-selection-marker", true)
UI_CONFIG_VARIABLE (bool, show_grids_ruler, "show-grids-ruler", true)
UI_CONFIG_VARIABLE (bool, rulers_follow_grid, "rulers-follow-grid", false)
UI_CONFIG_VARIABLE (bool, grid_follows_internal, "grid-follows-internal", false) //this feature is deprecated, default it FALSE for now; remove it in v6