Add a checkbox for 'stretch markers' and show it when MouseGrid is active

Also, de-sensitize the checkbox if the session is AudioTime
This commit is contained in:
Ben Loftis 2023-09-13 09:04:22 -05:00 committed by Robin Gareus
parent 8ba74e2a51
commit 8da5d49e54
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
4 changed files with 30 additions and 1 deletions

View File

@ -3332,6 +3332,8 @@ Editor::setup_toolbar ()
mouse_mode_size_group->add_widget (visible_tracks_selector);
}
mouse_mode_size_group->add_widget (stretch_marker_cb);
mouse_mode_size_group->add_widget (grid_type_selector);
mouse_mode_size_group->add_widget (draw_length_selector);
mouse_mode_size_group->add_widget (draw_velocity_selector);
@ -3449,6 +3451,8 @@ Editor::setup_toolbar ()
snap_box.set_spacing (2);
snap_box.set_border_width (2);
stretch_marker_cb.set_name ("mouse mode button");
grid_type_selector.set_name ("mouse mode button");
draw_length_selector.set_name ("mouse mode button");
draw_velocity_selector.set_name ("mouse mode button");
@ -3480,6 +3484,14 @@ Editor::setup_toolbar ()
nudge_box->pack_start (nudge_forward_button, false, false);
nudge_box->pack_start (*nudge_clock, false, false);
stretch_marker_cb.set_label (_("Stretch Markers"));
stretch_marker_cb.set_active (true);
/* Grid - these tools are only visible when in Grid mode */
grid_box.set_spacing (2);
grid_box.set_border_width (2);
grid_box.pack_start (stretch_marker_cb, false, false, 4);
/* Draw - these MIDI tools are only visible when in Draw mode */
draw_box.set_spacing (2);
draw_box.set_border_width (2);
@ -3518,6 +3530,8 @@ Editor::setup_toolbar ()
toolbar_hbox.pack_start (snap_box, false, false);
toolbar_hbox.pack_start (*(manage (new ArdourVSpacer ())), false, false, 3);
toolbar_hbox.pack_start (*nudge_box, false, false);
toolbar_hbox.pack_start (_grid_box_spacer, false, false, 3);
toolbar_hbox.pack_start (grid_box, false, false);
toolbar_hbox.pack_start (_draw_box_spacer, false, false, 3);
toolbar_hbox.pack_start (draw_box, false, false);
toolbar_hbox.pack_end (_zoom_box, false, false, 2);
@ -3695,6 +3709,7 @@ Editor::setup_tooltips ()
set_tooltip (tav_expand_button, _("Expand Tracks"));
set_tooltip (tav_shrink_button, _("Shrink Tracks"));
set_tooltip (visible_tracks_selector, _("Number of visible tracks"));
set_tooltip (stretch_marker_cb, _("Move markers and ranges when stretching the Grid\n(this option is only available when session Time Domain is Beat Time)"));
set_tooltip (draw_length_selector, _("Note Length to Draw (AUTO uses the current Grid setting)"));
set_tooltip (draw_velocity_selector, _("Note Velocity to Draw (AUTO uses the nearest note's velocity)"));
set_tooltip (draw_channel_selector, _("Note Channel to Draw (AUTO uses the nearest note's channel)"));

View File

@ -2014,12 +2014,20 @@ private:
ArdourWidgets::ArdourDropdown draw_channel_selector;
void build_draw_midi_menus ();
Gtk::CheckButton stretch_marker_cb;
bool should_stretch_markers() const {
return stretch_marker_cb.get_active ();
}
ArdourWidgets::ArdourButton snap_mode_button;
bool snap_mode_button_clicked (GdkEventButton*);
Gtk::HBox snap_box;
Gtk::HBox grid_box;
Gtk::HBox draw_box;
ArdourWidgets::ArdourVSpacer _grid_box_spacer;
ArdourWidgets::ArdourVSpacer _draw_box_spacer;
Gtk::HBox ebox_hpacker;

View File

@ -1810,6 +1810,8 @@ Editor::parameter_changed (std::string p)
}
} else if (p == "track-name-number") {
queue_redisplay_track_views ();
} else if (p == "default-time-domain") {
stretch_marker_cb.set_sensitive (_session->config.get_default_time_domain () == Temporal::BeatTime);
}
}

View File

@ -379,8 +379,12 @@ Editor::mouse_mode_toggled (MouseMode m)
}
if (mouse_mode == MouseGrid) {
grid_box.show();
_grid_box_spacer.show ();
_canvas_grid_zone->set_ignore_events (false);
} else {
grid_box.hide ();
_grid_box_spacer.hide ();
_canvas_grid_zone->set_ignore_events (true);
}
@ -3045,7 +3049,7 @@ Editor::choose_mapping_drag (ArdourCanvas::Item* item, GdkEvent* event)
/* The reversible command starts here, must be ended/aborted in drag */
begin_reversible_command ("");
domain_bounce_info = new Temporal::DomainBounceInfo (Temporal::BeatTime, Temporal::AudioTime);
domain_bounce_info = new Temporal::DomainBounceInfo (Temporal::BeatTime, Temporal::AudioTime, should_stretch_markers());
Temporal::TempoMap::WritableSharedPtr map = begin_tempo_mapping (*domain_bounce_info);
/* Decide between a mid-twist, which we do if the