make stationary-playhead mode less secret
authorBen Loftis <ben@glw.com>
Fri, 22 May 2009 19:47:07 +0000 (19:47 +0000)
committerBen Loftis <ben@glw.com>
Fri, 22 May 2009 19:47:07 +0000 (19:47 +0000)
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@5111 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/ardour.menus.in
gtk2_ardour/editor.cc
gtk2_ardour/editor.h
gtk2_ardour/editor_actions.cc
gtk2_ardour/editor_canvas.cc
gtk2_ardour/editor_mixer.cc
gtk2_ardour/public_editor.h

index 73ce9e0a476e8edc9a0cff9bcd88043de15964b1..33a398985e39681971de3c783be50de89ec7cc07 100644 (file)
                <menuitem action='ToggleAutoReturn'/>
                <menuitem action='ToggleClick'/>
                <menuitem action='toggle-follow-playhead'/>
+               <menuitem action='toggle-stationary-playhead'/>
               <separator/>
        </menu>
 
index 6bb25267509575071f0a4ad96551abcded5f3226..8c846b60c24ee9cf4dbd943f53a1e9bda952a4d7 100644 (file)
@@ -309,6 +309,7 @@ Editor::Editor ()
        region_list_sort_type = (Editing::RegionListSortType) 0;
        have_pending_keyboard_selection = false;
        _follow_playhead = true;
+       _stationary_playhead = false;
        _xfade_visibility = true;
        editor_ruler_menu = 0;
        no_ruler_shown_update = false;
@@ -2512,6 +2513,18 @@ Editor::set_state (const XMLNode& node)
                }
        }
 
+       if ((prop = node.property ("stationary-playhead"))) {
+               bool yn = (prop->value() == "yes");
+               set_stationary_playhead (yn);
+               RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("toggle-stationary-playhead"));
+               if (act) {
+                       RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
+                       if (tact->get_active() != yn) {
+                               tact->set_active (yn);
+                       }
+               }
+       }
+
        if ((prop = node.property ("region-list-sort-type"))) {
                region_list_sort_type = (Editing::RegionListSortType) -1; // force change 
                reset_region_list_sort_type(str2regionlistsorttype(prop->value()));
@@ -2599,6 +2612,7 @@ Editor::get_state ()
        node->add_property ("show-waveforms-recording", _show_waveforms_recording ? "yes" : "no");
        node->add_property ("show-measures", _show_measures ? "yes" : "no");
        node->add_property ("follow-playhead", _follow_playhead ? "yes" : "no");
+       node->add_property ("stationary-playhead", _stationary_playhead ? "yes" : "no");
        node->add_property ("xfades-visible", _xfade_visibility ? "yes" : "no");
        node->add_property ("region-list-sort-type", enum2str(region_list_sort_type));
        node->add_property ("mouse-mode", enum2str(mouse_mode));
@@ -3812,6 +3826,28 @@ Editor::set_follow_playhead (bool yn)
        }
 }
 
+void
+Editor::toggle_stationary_playhead ()
+{
+       RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("toggle-stationary-playhead"));
+       if (act) {
+               RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
+               set_stationary_playhead (tact->get_active());
+       }
+}
+
+void
+Editor::set_stationary_playhead (bool yn)
+{
+       if (_stationary_playhead != yn) {
+               if ((_stationary_playhead = yn) == true) {
+                       /* catch up */
+                       update_current_screen ();
+               }
+               instant_save ();
+       }
+}
+
 void
 Editor::toggle_xfade_active (boost::weak_ptr<Crossfade> wxfade)
 {
index 564f4c282a32e52fc4c53013630077960a4810e3..9d661c8125c97ae81011ffbb8343dacbd4fa44ec 100644 (file)
@@ -308,6 +308,10 @@ class Editor : public PublicEditor
 
        /* playhead/screen stuff */
        
+       void set_stationary_playhead (bool yn);
+       void toggle_stationary_playhead ();
+       bool stationary_playhead() const { return _stationary_playhead; }
+
        void set_follow_playhead (bool yn);
        void toggle_follow_playhead ();
        bool follow_playhead() const { return _follow_playhead; }
@@ -1470,6 +1474,7 @@ public:
        
        bool _show_measures;
        bool _show_waveforms;
+       bool _stationary_playhead;
        bool _follow_playhead;
        bool _show_waveforms_recording;
        
index 0a242363a6c6c39b3410bc58e540c90b548c812b..246f6bf7ec3aa7e9ae40e183b9b7d481bb9b815f 100644 (file)
@@ -592,6 +592,9 @@ Editor::register_actions ()
        act = ActionManager::register_action (editor_actions, "remove-last-capture", _("Remove Last Capture"), (mem_fun(*this, &Editor::remove_last_capture)));
        ActionManager::session_sensitive_actions.push_back (act);
 
+       act = ActionManager::register_toggle_action (editor_actions, "toggle-stationary-playhead", _("Stationary Playhead"), (mem_fun(*this, &Editor::toggle_stationary_playhead)));
+       ActionManager::session_sensitive_actions.push_back (act);
+
        act = ActionManager::register_action (editor_actions, "insert-time", _("Insert Time"), (mem_fun(*this, &Editor::do_insert_time)));
        ActionManager::session_sensitive_actions.push_back (act);
        ActionManager::track_selection_sensitive_actions.push_back (act);
index fa347c2a636e6cc83fdc6f74c6ccc7e7cdc2f911..39f238f4b8f2ee3180fd3418dcdf86e540853cf9 100644 (file)
@@ -850,7 +850,7 @@ Editor::scroll_canvas_horizontally ()
        redisplay_tempo (true);
 
 #ifndef GTKOSX
-       if (!autoscroll_active) {
+       if (!autoscroll_active && !_stationary_playhead) {
                /* force rulers and canvas to move in lock step */
                while (gtk_events_pending ()) {
                        gtk_main_iteration ();
index de0a27c687cbc59c2bd9ae088c29b3aa81aa45fb..a7d9a701a65ab53edd0f4df056117f342d38888c 100644 (file)
@@ -242,8 +242,7 @@ Editor::update_current_screen ()
                        if (frame != last_update_frame) {
 
 
-#undef CONTINUOUS_SCROLL
-#ifndef  CONTINUOUS_SCROLL
+               if ( !_stationary_playhead ) {
                                if (frame < leftmost_frame || frame > leftmost_frame + current_page_frames()) {
 
 #ifdef DEBUG_CURRENT_SCREEN
@@ -262,7 +261,7 @@ Editor::update_current_screen ()
 
                                playhead_cursor->set_position (frame);
 
-#else  // CONTINUOUS_SCROLL
+               } else {
                                
                                /* don't do continuous scroll till the new position is in the rightmost quarter of the 
                                   editor canvas
@@ -283,7 +282,7 @@ Editor::update_current_screen ()
                                
                                playhead_cursor->set_position (frame);
 
-#endif // CONTINUOUS_SCROLL
+                               }
 
                        }
 
index 2ea266c327b056c85b89bb9519b52ee12d0e77ae..bf21950c68e1fab15e5dd18edbdff2798b973ac8 100644 (file)
@@ -143,6 +143,9 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulThingWithGoingAway
        virtual void set_selected_mixer_strip (TimeAxisView&) = 0;
        virtual void hide_track_in_display (TimeAxisView& tv, bool temporary = false) = 0;
        virtual void show_track_in_display (TimeAxisView& tv) = 0;
+       virtual void set_stationary_playhead (bool yn) = 0;
+       virtual void toggle_stationary_playhead () = 0;
+       virtual bool stationary_playhead() const = 0;
        virtual void set_follow_playhead (bool yn) = 0;
        virtual void toggle_follow_playhead () = 0;
        virtual bool follow_playhead() const = 0;