From: Ben Loftis Date: Thu, 26 Jul 2018 18:53:36 +0000 (-0500) Subject: new_grid: Add options for rulers_follow_grid and grid_follows_internal X-Git-Url: https://main.carlh.net/gitweb/?p=ardour.git;a=commitdiff_plain;h=0d32105a1ec0a09f0676d06c133b66ec4a6b21f5 new_grid: Add options for rulers_follow_grid and grid_follows_internal --- diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 265fc23410..a8b4008738 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -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); - } else if (_grid_type == GridTypeTimecode) { - ruler_tempo_action->set_active(false); - ruler_meter_action->set_active(false); - ruler_bbt_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_timecode_action->set_active(true); - 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); + 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_minsec_action->set_active(true); - 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); + 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_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 (); diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index df559cf8f0..4b15b5d0e0 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -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()) { diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc index 42a0277f8d..2e68a44dd8 100644 --- a/gtk2_ardour/rc_option_editor.cc +++ b/gtk2_ardour/rc_option_editor.cc @@ -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:"))); diff --git a/gtk2_ardour/ui_config_vars.h b/gtk2_ardour/ui_config_vars.h index 3e2c6715ea..fab6eee89a 100644 --- a/gtk2_ardour/ui_config_vars.h +++ b/gtk2_ardour/ui_config_vars.h @@ -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