summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Loftis <ben@glw.com>2009-05-22 19:47:07 +0000
committerBen Loftis <ben@glw.com>2009-05-22 19:47:07 +0000
commitbeef5e20ce6402e55c974d6126db8db6c7a13d7c (patch)
treeae9e47c8e767fc6677168d117e77132fe321b943
parent28f46b7f2cba64c3d5e34f39d7be45600dde3a58 (diff)
make stationary-playhead mode less secret
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@5111 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--gtk2_ardour/ardour.menus.in1
-rw-r--r--gtk2_ardour/editor.cc36
-rw-r--r--gtk2_ardour/editor.h5
-rw-r--r--gtk2_ardour/editor_actions.cc3
-rw-r--r--gtk2_ardour/editor_canvas.cc2
-rw-r--r--gtk2_ardour/editor_mixer.cc7
-rw-r--r--gtk2_ardour/public_editor.h3
7 files changed, 52 insertions, 5 deletions
diff --git a/gtk2_ardour/ardour.menus.in b/gtk2_ardour/ardour.menus.in
index 73ce9e0a47..33a398985e 100644
--- a/gtk2_ardour/ardour.menus.in
+++ b/gtk2_ardour/ardour.menus.in
@@ -125,6 +125,7 @@
<menuitem action='ToggleAutoReturn'/>
<menuitem action='ToggleClick'/>
<menuitem action='toggle-follow-playhead'/>
+ <menuitem action='toggle-stationary-playhead'/>
<separator/>
</menu>
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc
index 6bb2526750..8c846b60c2 100644
--- a/gtk2_ardour/editor.cc
+++ b/gtk2_ardour/editor.cc
@@ -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));
@@ -3813,6 +3827,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)
{
boost::shared_ptr<Crossfade> xfade (wxfade.lock());
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h
index 564f4c282a..9d661c8125 100644
--- a/gtk2_ardour/editor.h
+++ b/gtk2_ardour/editor.h
@@ -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;
diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc
index 0a242363a6..246f6bf7ec 100644
--- a/gtk2_ardour/editor_actions.cc
+++ b/gtk2_ardour/editor_actions.cc
@@ -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);
diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc
index fa347c2a63..39f238f4b8 100644
--- a/gtk2_ardour/editor_canvas.cc
+++ b/gtk2_ardour/editor_canvas.cc
@@ -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 ();
diff --git a/gtk2_ardour/editor_mixer.cc b/gtk2_ardour/editor_mixer.cc
index de0a27c687..a7d9a701a6 100644
--- a/gtk2_ardour/editor_mixer.cc
+++ b/gtk2_ardour/editor_mixer.cc
@@ -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
+ }
}
diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h
index 2ea266c327..bf21950c68 100644
--- a/gtk2_ardour/public_editor.h
+++ b/gtk2_ardour/public_editor.h
@@ -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;