new_grid: Add options for rulers_follow_grid and grid_follows_internal
authorBen Loftis <ben@harrisonconsoles.com>
Thu, 26 Jul 2018 18:53:36 +0000 (13:53 -0500)
committerRobin Gareus <robin@gareus.org>
Thu, 26 Jul 2018 22:26:09 +0000 (00:26 +0200)
gtk2_ardour/editor.cc
gtk2_ardour/editor_mouse.cc
gtk2_ardour/rc_option_editor.cc
gtk2_ardour/ui_config_vars.h

index 265fc234109ba269eaa50a43e16269aa9281ae70..a8b40087382f6d0e0caa3395ade4727822efd73c 100644 (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);
-       } 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 ();
index df559cf8f03c4e0935df40bdb2cb6fbd0e5a7b52..4b15b5d0e0daa85b61897d96bb9e0dd84315099a 100644 (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()) {
index 42a0277f8d76a777b770620b2d98803db1670a8f..2e68a44dd8bb49236eeadf626eeda808ef92c285 100644 (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:")));
 
 
index 3e2c6715ea9a35ba58b3fb0d907f4ba6e008eb8b..fab6eee89aac663694226ba6b2d2bee686383f0f 100644 (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