new_grid: Add options for rulers_follow_grid and grid_follows_internal

This commit is contained in:
Ben Loftis 2018-07-26 13:53:36 -05:00 committed by Robin Gareus
parent 43c76ff23b
commit 0d32105a1e
4 changed files with 53 additions and 27 deletions

View File

@ -2216,7 +2216,7 @@ Editor::set_grid_to (GridType gt)
unsigned int grid_ind = (unsigned int)gt;
if (internal_editing()) {
if (internal_editing() && UIConfiguration::instance().get_grid_follows_internal()) {
internal_grid_type = gt;
} else {
pre_internal_grid_type = gt;
@ -2236,43 +2236,48 @@ Editor::set_grid_to (GridType gt)
}
/* show appropriate rulers for this grid setting.
* TODO: perhaps make this optional.
* Currently this is 'required' because the RULER calculates the grid_marks which will be used by grid_lines
*/
if (grid_musical()) {
ruler_tempo_action->set_active(true);
ruler_meter_action->set_active(true);
ruler_bbt_action->set_active(true);
ruler_timecode_action->set_active(false);
ruler_minsec_action->set_active(false);
ruler_samples_action->set_active(false);
if ( UIConfiguration::instance().get_rulers_follow_grid() ) {
ruler_timecode_action->set_active(false);
ruler_minsec_action->set_active(false);
ruler_samples_action->set_active(false);
}
} else if (_grid_type == GridTypeTimecode) {
ruler_tempo_action->set_active(false);
ruler_meter_action->set_active(false);
ruler_bbt_action->set_active(false);
ruler_timecode_action->set_active(true);
ruler_minsec_action->set_active(false);
ruler_samples_action->set_active(false);
if ( UIConfiguration::instance().get_rulers_follow_grid() ) {
ruler_tempo_action->set_active(false);
ruler_meter_action->set_active(false);
ruler_bbt_action->set_active(false);
ruler_minsec_action->set_active(false);
ruler_samples_action->set_active(false);
}
} else if (_grid_type == GridTypeMinSec) {
ruler_tempo_action->set_active(false);
ruler_meter_action->set_active(false);
ruler_bbt_action->set_active(false);
ruler_timecode_action->set_active(false);
ruler_minsec_action->set_active(true);
ruler_samples_action->set_active(false);
if ( UIConfiguration::instance().get_rulers_follow_grid() ) {
ruler_tempo_action->set_active(false);
ruler_meter_action->set_active(false);
ruler_bbt_action->set_active(false);
ruler_timecode_action->set_active(false);
ruler_samples_action->set_active(false);
}
} else if (_grid_type == GridTypeCDFrame) {
ruler_tempo_action->set_active(false);
ruler_meter_action->set_active(false);
ruler_bbt_action->set_active(false);
ruler_timecode_action->set_active(false);
ruler_cd_marker_action->set_active(true);
ruler_minsec_action->set_active(true);
ruler_cd_marker_action->set_active(true);
ruler_samples_action->set_active(false);
if ( UIConfiguration::instance().get_rulers_follow_grid() ) {
ruler_tempo_action->set_active(false);
ruler_meter_action->set_active(false);
ruler_bbt_action->set_active(false);
ruler_timecode_action->set_active(false);
ruler_samples_action->set_active(false);
}
}
instant_save ();

View File

@ -317,7 +317,10 @@ Editor::mouse_mode_toggled (MouseMode m)
/* Switch snap type/mode if we're moving to/from an internal tool. Note
this must toggle the actions and not call set_snap_*() directly,
otherwise things get out of sync and the combo box stops working. */
if (!was_internal && internal_editing()) {
if (!UIConfiguration::instance().get_grid_follows_internal()) {
grid_type_action(pre_internal_grid_type)->set_active(true);
snap_mode_action(pre_internal_snap_mode)->set_active(true);
} else if (!was_internal && internal_editing()) {
grid_type_action(internal_grid_type)->set_active(true);
snap_mode_action(internal_snap_mode)->set_active(true);
} else if (was_internal && !internal_editing()) {

View File

@ -2512,6 +2512,22 @@ RCOptionEditor::RCOptionEditor ()
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_rubberbanding_snaps_to_grid)
));
add_option (_("Editor/Snap"),
new BoolOption (
"grid-follows-internal",
_("Grid switches to alternate selection for Internal Edit tools"),
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_grid_follows_internal),
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_grid_follows_internal)
));
add_option (_("Editor/Snap"),
new BoolOption (
"rulers-follow-grid",
_("Rulers automatically change to follow the Grid mode selection"),
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_rulers_follow_grid),
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_rulers_follow_grid)
));
add_option (_("Editor/Snap"), new OptionEditorHeading (_("When \"Snap\" is enabled, snap to:")));

View File

@ -107,3 +107,5 @@ 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, 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