introduce the notion that note additions and property changes can cause the removal...
[ardour.git] / gtk2_ardour / audio_clock.cc
index 42531732fafd7b4bf77da21ead7678ee42ca4d27..be1bb97713b763e5d9e97cc5facda2a2e7b4ac90 100644 (file)
 #include "audio_clock.h"
 #include "utils.h"
 #include "keyboard.h"
+#include "gui_thread.h"
 #include "i18n.h"
 
 using namespace ARDOUR;
 using namespace PBD;
-using namespace sigc;
 using namespace Gtk;
 using namespace std;
 
+using Gtkmm2ext::Keyboard;
+
 using PBD::atoi;
 using PBD::atof;
 
@@ -50,10 +52,10 @@ sigc::signal<void> AudioClock::ModeChanged;
 vector<AudioClock*> AudioClock::clocks;
 
 const uint32_t AudioClock::field_length[(int) AudioClock::AudioFrames+1] = {
-       2,   /* SMPTE_Hours */
-       2,   /* SMPTE_Minutes */
-       2,   /* SMPTE_Seconds */
-       2,   /* SMPTE_Frames */
+       2,   /* Timecode_Hours */
+       2,   /* Timecode_Minutes */
+       2,   /* Timecode_Seconds */
+       2,   /* Timecode_Frames */
        2,   /* MS_Hours */
        2,   /* MS_Minutes */
        5,   /* MS_Seconds */
@@ -63,11 +65,13 @@ const uint32_t AudioClock::field_length[(int) AudioClock::AudioFrames+1] = {
        10   /* Audio Frame */
 };
 
-AudioClock::AudioClock (std::string clock_name, bool transient, std::string widget_name, bool allow_edit, bool duration, bool with_info)
+AudioClock::AudioClock (const string& clock_name, bool transient, const string& widget_name, 
+                       bool allow_edit, bool follows_playhead, bool duration, bool with_info)
        : _name (clock_name),
          is_transient (transient),
          is_duration (duration),
          editable (allow_edit),
+         _follows_playhead (follows_playhead),
          colon1 (":"),
          colon2 (":"),
          colon3 (":"),
@@ -77,7 +81,6 @@ AudioClock::AudioClock (std::string clock_name, bool transient, std::string widg
          b2 ("|"),
          last_when(0)
 {
-       session = 0;
        last_when = 0;
        last_pdelta = 0;
        last_sdelta = 0;
@@ -89,36 +92,36 @@ AudioClock::AudioClock (std::string clock_name, bool transient, std::string widg
        if (with_info) {
                frames_upper_info_label = manage (new Label);
                frames_lower_info_label = manage (new Label);
-               smpte_upper_info_label = manage (new Label);
-               smpte_lower_info_label = manage (new Label);
+               timecode_upper_info_label = manage (new Label);
+               timecode_lower_info_label = manage (new Label);
                bbt_upper_info_label = manage (new Label);
                bbt_lower_info_label = manage (new Label);
 
                frames_upper_info_label->set_name ("AudioClockFramesUpperInfo");
                frames_lower_info_label->set_name ("AudioClockFramesLowerInfo");
-               smpte_upper_info_label->set_name ("AudioClockSMPTEUpperInfo");
-               smpte_lower_info_label->set_name ("AudioClockSMPTELowerInfo");
+               timecode_upper_info_label->set_name ("AudioClockTimecodeUpperInfo");
+               timecode_lower_info_label->set_name ("AudioClockTimecodeLowerInfo");
                bbt_upper_info_label->set_name ("AudioClockBBTUpperInfo");
                bbt_lower_info_label->set_name ("AudioClockBBTLowerInfo");
 
-               Gtkmm2ext::set_size_request_to_display_given_text(*smpte_upper_info_label, "23.98",0,0);
-               Gtkmm2ext::set_size_request_to_display_given_text(*smpte_lower_info_label, "NDF",0,0);
+               Gtkmm2ext::set_size_request_to_display_given_text(*timecode_upper_info_label, "23.98",0,0);
+               Gtkmm2ext::set_size_request_to_display_given_text(*timecode_lower_info_label, "NDF",0,0);
 
                Gtkmm2ext::set_size_request_to_display_given_text(*bbt_upper_info_label, "88|88",0,0);
                Gtkmm2ext::set_size_request_to_display_given_text(*bbt_lower_info_label, "888.88",0,0);
 
                frames_info_box.pack_start (*frames_upper_info_label, true, true);
                frames_info_box.pack_start (*frames_lower_info_label, true, true);
-               smpte_info_box.pack_start (*smpte_upper_info_label, true, true);
-               smpte_info_box.pack_start (*smpte_lower_info_label, true, true);
+               timecode_info_box.pack_start (*timecode_upper_info_label, true, true);
+               timecode_info_box.pack_start (*timecode_lower_info_label, true, true);
                bbt_info_box.pack_start (*bbt_upper_info_label, true, true);
                bbt_info_box.pack_start (*bbt_lower_info_label, true, true);
 
        } else {
                frames_upper_info_label = 0;
                frames_lower_info_label = 0;
-               smpte_upper_info_label = 0;
-               smpte_lower_info_label = 0;
+               timecode_upper_info_label = 0;
+               timecode_lower_info_label = 0;
                bbt_upper_info_label = 0;
                bbt_lower_info_label = 0;
        }
@@ -146,21 +149,21 @@ AudioClock::AudioClock (std::string clock_name, bool transient, std::string widg
        ms_minutes_ebox.add (ms_minutes_label);
        ms_seconds_ebox.add (ms_seconds_label);
 
-       smpte_packer.set_homogeneous (false);
-       smpte_packer.set_border_width (2);
-       smpte_packer.pack_start (hours_ebox, false, false);
-       smpte_packer.pack_start (colon1, false, false);
-       smpte_packer.pack_start (minutes_ebox, false, false);
-       smpte_packer.pack_start (colon2, false, false);
-       smpte_packer.pack_start (seconds_ebox, false, false);
-       smpte_packer.pack_start (colon3, false, false);
-       smpte_packer.pack_start (frames_ebox, false, false);
+       timecode_packer.set_homogeneous (false);
+       timecode_packer.set_border_width (2);
+       timecode_packer.pack_start (hours_ebox, false, false);
+       timecode_packer.pack_start (colon1, false, false);
+       timecode_packer.pack_start (minutes_ebox, false, false);
+       timecode_packer.pack_start (colon2, false, false);
+       timecode_packer.pack_start (seconds_ebox, false, false);
+       timecode_packer.pack_start (colon3, false, false);
+       timecode_packer.pack_start (frames_ebox, false, false);
 
        if (with_info) {
-               smpte_packer.pack_start (smpte_info_box, false, false, 5);
+               timecode_packer.pack_start (timecode_info_box, false, false, 5);
        }
 
-       smpte_packer_hbox.pack_start (smpte_packer, true, false);
+       timecode_packer_hbox.pack_start (timecode_packer, true, false);
 
        bbt_packer.set_homogeneous (false);
        bbt_packer.set_border_width (2);
@@ -194,7 +197,7 @@ AudioClock::AudioClock (std::string clock_name, bool transient, std::string widg
        set_widget_name (widget_name);
 
        _mode = BBT; /* lie to force mode switch */
-       set_mode (SMPTE);
+       set_mode (Timecode);
 
        pack_start (clock_frame, true, true);
 
@@ -210,9 +213,9 @@ AudioClock::AudioClock (std::string clock_name, bool transient, std::string widg
        */
 
        clock_base.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::SCROLL_MASK);
-       clock_base.signal_button_release_event().connect (bind (mem_fun (*this, &AudioClock::field_button_release_event), SMPTE_Hours));
+       clock_base.signal_button_release_event().connect (sigc::bind (sigc::mem_fun (*this, &AudioClock::field_button_release_event), Timecode_Hours));
 
-       Session::SMPTEOffsetChanged.connect (mem_fun (*this, &AudioClock::smpte_offset_changed));
+       Session::TimecodeOffsetChanged.connect (_session_connections, invalidator (*this), boost::bind (&AudioClock::timecode_offset_changed, this), gui_context());
 
        if (editable) {
                setup_events ();
@@ -295,103 +298,103 @@ AudioClock::setup_events ()
        ms_minutes_ebox.set_flags (Gtk::CAN_FOCUS);
        ms_seconds_ebox.set_flags (Gtk::CAN_FOCUS);
 
-       hours_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), SMPTE_Hours));
-       minutes_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), SMPTE_Minutes));
-       seconds_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), SMPTE_Seconds));
-       frames_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), SMPTE_Frames));
-       audio_frames_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), AudioFrames));
-       bars_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), Bars));
-       beats_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), Beats));
-       ticks_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), Ticks));
-       ms_hours_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), MS_Hours));
-       ms_minutes_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), MS_Minutes));
-       ms_seconds_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), MS_Seconds));
-
-       hours_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), SMPTE_Hours));
-       minutes_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), SMPTE_Minutes));
-       seconds_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), SMPTE_Seconds));
-       frames_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), SMPTE_Frames));
-       audio_frames_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), AudioFrames));
-       bars_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), Bars));
-       beats_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), Beats));
-       ticks_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), Ticks));
-       ms_hours_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), MS_Hours));
-       ms_minutes_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), MS_Minutes));
-       ms_seconds_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), MS_Seconds));
-
-       hours_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), SMPTE_Hours));
-       minutes_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), SMPTE_Minutes));
-       seconds_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), SMPTE_Seconds));
-       frames_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), SMPTE_Frames));
-       audio_frames_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), AudioFrames));
-       bars_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), Bars));
-       beats_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), Beats));
-       ticks_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), Ticks));
-       ms_hours_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), MS_Hours));
-       ms_minutes_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), MS_Minutes));
-       ms_seconds_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), MS_Seconds));
-
-       hours_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), SMPTE_Hours));
-       minutes_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), SMPTE_Minutes));
-       seconds_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), SMPTE_Seconds));
-       frames_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), SMPTE_Frames));
-       audio_frames_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), AudioFrames));
-       bars_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), Bars));
-       beats_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), Beats));
-       ticks_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), Ticks));
-       ms_hours_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), MS_Hours));
-       ms_minutes_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), MS_Minutes));
-       ms_seconds_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), MS_Seconds));
-
-       hours_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), SMPTE_Hours));
-       minutes_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), SMPTE_Minutes));
-       seconds_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), SMPTE_Seconds));
-       frames_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), SMPTE_Frames));
-       audio_frames_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), AudioFrames));
-       bars_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), Bars));
-       beats_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), Beats));
-       ticks_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), Ticks));
-       ms_hours_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), MS_Hours));
-       ms_minutes_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), MS_Minutes));
-       ms_seconds_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), MS_Seconds));
-
-       hours_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), SMPTE_Hours));
-       minutes_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), SMPTE_Minutes));
-       seconds_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), SMPTE_Seconds));
-       frames_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), SMPTE_Frames));
-       audio_frames_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), AudioFrames));
-       bars_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), Bars));
-       beats_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), Beats));
-       ticks_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), Ticks));
-       ms_hours_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), MS_Hours));
-       ms_minutes_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), MS_Minutes));
-       ms_seconds_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), MS_Seconds));
-
-       hours_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), SMPTE_Hours));
-       minutes_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), SMPTE_Minutes));
-       seconds_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), SMPTE_Seconds));
-       frames_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), SMPTE_Frames));
-       audio_frames_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), AudioFrames));
-       bars_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), Bars));
-       beats_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), Beats));
-       ticks_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), Ticks));
-       ms_hours_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), MS_Hours));
-       ms_minutes_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), MS_Minutes));
-       ms_seconds_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), MS_Seconds));
-
-       hours_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), SMPTE_Hours));
-       minutes_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), SMPTE_Minutes));
-       seconds_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), SMPTE_Seconds));
-       frames_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), SMPTE_Frames));
-       audio_frames_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), AudioFrames));
-       bars_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), Bars));
-       beats_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), Beats));
-       ticks_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), Ticks));
-       ms_hours_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), MS_Hours));
-       ms_minutes_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), MS_Minutes));
-       ms_seconds_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), MS_Seconds));
-
-       clock_base.signal_focus_in_event().connect (mem_fun (*this, &AudioClock::drop_focus_handler));
+       hours_ebox.signal_motion_notify_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_motion_notify_event), Timecode_Hours));
+       minutes_ebox.signal_motion_notify_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_motion_notify_event), Timecode_Minutes));
+       seconds_ebox.signal_motion_notify_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_motion_notify_event), Timecode_Seconds));
+       frames_ebox.signal_motion_notify_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_motion_notify_event), Timecode_Frames));
+       audio_frames_ebox.signal_motion_notify_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_motion_notify_event), AudioFrames));
+       bars_ebox.signal_motion_notify_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_motion_notify_event), Bars));
+       beats_ebox.signal_motion_notify_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_motion_notify_event), Beats));
+       ticks_ebox.signal_motion_notify_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_motion_notify_event), Ticks));
+       ms_hours_ebox.signal_motion_notify_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_motion_notify_event), MS_Hours));
+       ms_minutes_ebox.signal_motion_notify_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_motion_notify_event), MS_Minutes));
+       ms_seconds_ebox.signal_motion_notify_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_motion_notify_event), MS_Seconds));
+
+       hours_ebox.signal_button_press_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_button_press_event), Timecode_Hours));
+       minutes_ebox.signal_button_press_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_button_press_event), Timecode_Minutes));
+       seconds_ebox.signal_button_press_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_button_press_event), Timecode_Seconds));
+       frames_ebox.signal_button_press_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_button_press_event), Timecode_Frames));
+       audio_frames_ebox.signal_button_press_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_button_press_event), AudioFrames));
+       bars_ebox.signal_button_press_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_button_press_event), Bars));
+       beats_ebox.signal_button_press_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_button_press_event), Beats));
+       ticks_ebox.signal_button_press_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_button_press_event), Ticks));
+       ms_hours_ebox.signal_button_press_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_button_press_event), MS_Hours));
+       ms_minutes_ebox.signal_button_press_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_button_press_event), MS_Minutes));
+       ms_seconds_ebox.signal_button_press_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_button_press_event), MS_Seconds));
+
+       hours_ebox.signal_button_release_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_button_release_event), Timecode_Hours));
+       minutes_ebox.signal_button_release_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_button_release_event), Timecode_Minutes));
+       seconds_ebox.signal_button_release_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_button_release_event), Timecode_Seconds));
+       frames_ebox.signal_button_release_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_button_release_event), Timecode_Frames));
+       audio_frames_ebox.signal_button_release_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_button_release_event), AudioFrames));
+       bars_ebox.signal_button_release_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_button_release_event), Bars));
+       beats_ebox.signal_button_release_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_button_release_event), Beats));
+       ticks_ebox.signal_button_release_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_button_release_event), Ticks));
+       ms_hours_ebox.signal_button_release_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_button_release_event), MS_Hours));
+       ms_minutes_ebox.signal_button_release_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_button_release_event), MS_Minutes));
+       ms_seconds_ebox.signal_button_release_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_button_release_event), MS_Seconds));
+
+       hours_ebox.signal_scroll_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_button_scroll_event), Timecode_Hours));
+       minutes_ebox.signal_scroll_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_button_scroll_event), Timecode_Minutes));
+       seconds_ebox.signal_scroll_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_button_scroll_event), Timecode_Seconds));
+       frames_ebox.signal_scroll_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_button_scroll_event), Timecode_Frames));
+       audio_frames_ebox.signal_scroll_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_button_scroll_event), AudioFrames));
+       bars_ebox.signal_scroll_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_button_scroll_event), Bars));
+       beats_ebox.signal_scroll_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_button_scroll_event), Beats));
+       ticks_ebox.signal_scroll_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_button_scroll_event), Ticks));
+       ms_hours_ebox.signal_scroll_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_button_scroll_event), MS_Hours));
+       ms_minutes_ebox.signal_scroll_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_button_scroll_event), MS_Minutes));
+       ms_seconds_ebox.signal_scroll_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_button_scroll_event), MS_Seconds));
+
+       hours_ebox.signal_key_press_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_key_press_event), Timecode_Hours));
+       minutes_ebox.signal_key_press_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_key_press_event), Timecode_Minutes));
+       seconds_ebox.signal_key_press_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_key_press_event), Timecode_Seconds));
+       frames_ebox.signal_key_press_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_key_press_event), Timecode_Frames));
+       audio_frames_ebox.signal_key_press_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_key_press_event), AudioFrames));
+       bars_ebox.signal_key_press_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_key_press_event), Bars));
+       beats_ebox.signal_key_press_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_key_press_event), Beats));
+       ticks_ebox.signal_key_press_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_key_press_event), Ticks));
+       ms_hours_ebox.signal_key_press_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_key_press_event), MS_Hours));
+       ms_minutes_ebox.signal_key_press_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_key_press_event), MS_Minutes));
+       ms_seconds_ebox.signal_key_press_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_key_press_event), MS_Seconds));
+
+       hours_ebox.signal_key_release_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_key_release_event), Timecode_Hours));
+       minutes_ebox.signal_key_release_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_key_release_event), Timecode_Minutes));
+       seconds_ebox.signal_key_release_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_key_release_event), Timecode_Seconds));
+       frames_ebox.signal_key_release_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_key_release_event), Timecode_Frames));
+       audio_frames_ebox.signal_key_release_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_key_release_event), AudioFrames));
+       bars_ebox.signal_key_release_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_key_release_event), Bars));
+       beats_ebox.signal_key_release_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_key_release_event), Beats));
+       ticks_ebox.signal_key_release_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_key_release_event), Ticks));
+       ms_hours_ebox.signal_key_release_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_key_release_event), MS_Hours));
+       ms_minutes_ebox.signal_key_release_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_key_release_event), MS_Minutes));
+       ms_seconds_ebox.signal_key_release_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_key_release_event), MS_Seconds));
+
+       hours_ebox.signal_focus_in_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_focus_in_event), Timecode_Hours));
+       minutes_ebox.signal_focus_in_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_focus_in_event), Timecode_Minutes));
+       seconds_ebox.signal_focus_in_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_focus_in_event), Timecode_Seconds));
+       frames_ebox.signal_focus_in_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_focus_in_event), Timecode_Frames));
+       audio_frames_ebox.signal_focus_in_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_focus_in_event), AudioFrames));
+       bars_ebox.signal_focus_in_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_focus_in_event), Bars));
+       beats_ebox.signal_focus_in_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_focus_in_event), Beats));
+       ticks_ebox.signal_focus_in_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_focus_in_event), Ticks));
+       ms_hours_ebox.signal_focus_in_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_focus_in_event), MS_Hours));
+       ms_minutes_ebox.signal_focus_in_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_focus_in_event), MS_Minutes));
+       ms_seconds_ebox.signal_focus_in_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_focus_in_event), MS_Seconds));
+
+       hours_ebox.signal_focus_out_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_focus_out_event), Timecode_Hours));
+       minutes_ebox.signal_focus_out_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_focus_out_event), Timecode_Minutes));
+       seconds_ebox.signal_focus_out_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_focus_out_event), Timecode_Seconds));
+       frames_ebox.signal_focus_out_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_focus_out_event), Timecode_Frames));
+       audio_frames_ebox.signal_focus_out_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_focus_out_event), AudioFrames));
+       bars_ebox.signal_focus_out_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_focus_out_event), Bars));
+       beats_ebox.signal_focus_out_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_focus_out_event), Beats));
+       ticks_ebox.signal_focus_out_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_focus_out_event), Ticks));
+       ms_hours_ebox.signal_focus_out_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_focus_out_event), MS_Hours));
+       ms_minutes_ebox.signal_focus_out_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_focus_out_event), MS_Minutes));
+       ms_seconds_ebox.signal_focus_out_event().connect (sigc::bind (sigc::mem_fun(*this, &AudioClock::field_focus_out_event), MS_Seconds));
+
+       clock_base.signal_focus_in_event().connect (sigc::mem_fun (*this, &AudioClock::drop_focus_handler));
 }
 
 bool
@@ -415,7 +418,7 @@ void
 AudioClock::set (nframes_t when, bool force, nframes_t offset, char which)
 {
 
-       if ((!force && !is_visible()) || session == 0) {
+       if ((!force && !is_visible()) || _session == 0) {
                return;
        }
 
@@ -447,8 +450,8 @@ AudioClock::set (nframes_t when, bool force, nframes_t offset, char which)
        }
 
        switch (_mode) {
-       case SMPTE:
-               set_smpte (when, force);
+       case Timecode:
+               set_timecode (when, force);
                break;
 
        case BBT:
@@ -471,12 +474,12 @@ AudioClock::set (nframes_t when, bool force, nframes_t offset, char which)
 }
 
 void
-AudioClock::smpte_offset_changed ()
+AudioClock::timecode_offset_changed ()
 {
        nframes_t current;
 
        switch (_mode) {
-       case SMPTE:
+       case Timecode:
                if (is_duration) {
                        current = current_duration();
                } else {
@@ -497,7 +500,7 @@ AudioClock::set_frames (nframes_t when, bool /*force*/)
        audio_frames_label.set_text (buf);
 
        if (frames_upper_info_label) {
-               nframes_t rate = session->frame_rate();
+               nframes_t rate = _session->frame_rate();
 
                if (fmod (rate, 1000.0) == 0.000) {
                        sprintf (buf, "%uK", rate/1000);
@@ -509,7 +512,7 @@ AudioClock::set_frames (nframes_t when, bool /*force*/)
                        frames_upper_info_label->set_text (buf);
                }
 
-               float vid_pullup = session->config.get_video_pullup();
+               float vid_pullup = _session->config.get_video_pullup();
 
                if (vid_pullup == 0.0) {
                        if (frames_lower_info_label->get_text () != _("none")) {
@@ -534,11 +537,11 @@ AudioClock::set_minsec (nframes_t when, bool force)
        float secs;
 
        left = when;
-       hrs = (int) floor (left / (session->frame_rate() * 60.0f * 60.0f));
-       left -= (nframes_t) floor (hrs * session->frame_rate() * 60.0f * 60.0f);
-       mins = (int) floor (left / (session->frame_rate() * 60.0f));
-       left -= (nframes_t) floor (mins * session->frame_rate() * 60.0f);
-       secs = left / (float) session->frame_rate();
+       hrs = (int) floor (left / (_session->frame_rate() * 60.0f * 60.0f));
+       left -= (nframes_t) floor (hrs * _session->frame_rate() * 60.0f * 60.0f);
+       mins = (int) floor (left / (_session->frame_rate() * 60.0f));
+       left -= (nframes_t) floor (mins * _session->frame_rate() * 60.0f);
+       secs = left / (float) _session->frame_rate();
 
        if (force || hrs != ms_last_hrs) {
                sprintf (buf, "%02d", hrs);
@@ -560,61 +563,61 @@ AudioClock::set_minsec (nframes_t when, bool force)
 }
 
 void
-AudioClock::set_smpte (nframes_t when, bool force)
+AudioClock::set_timecode (nframes_t when, bool force)
 {
        char buf[32];
-       SMPTE::Time smpte;
+       Timecode::Time timecode;
 
        if (is_duration) {
-               session->smpte_duration (when, smpte);
+               _session->timecode_duration (when, timecode);
        } else {
-               session->smpte_time (when, smpte);
+               _session->timecode_time (when, timecode);
        }
 
-       if (force || smpte.hours != last_hrs || smpte.negative != last_negative) {
-               if (smpte.negative) {
-                       sprintf (buf, "-%02" PRIu32, smpte.hours);
+       if (force || timecode.hours != last_hrs || timecode.negative != last_negative) {
+               if (timecode.negative) {
+                       sprintf (buf, "-%02" PRIu32, timecode.hours);
                } else {
-                       sprintf (buf, " %02" PRIu32, smpte.hours);
+                       sprintf (buf, " %02" PRIu32, timecode.hours);
                }
                hours_label.set_text (buf);
-               last_hrs = smpte.hours;
-               last_negative = smpte.negative;
+               last_hrs = timecode.hours;
+               last_negative = timecode.negative;
        }
 
-       if (force || smpte.minutes != last_mins) {
-               sprintf (buf, "%02" PRIu32, smpte.minutes);
+       if (force || timecode.minutes != last_mins) {
+               sprintf (buf, "%02" PRIu32, timecode.minutes);
                minutes_label.set_text (buf);
-               last_mins = smpte.minutes;
+               last_mins = timecode.minutes;
        }
 
-       if (force || smpte.seconds != last_secs) {
-               sprintf (buf, "%02" PRIu32, smpte.seconds);
+       if (force || timecode.seconds != last_secs) {
+               sprintf (buf, "%02" PRIu32, timecode.seconds);
                seconds_label.set_text (buf);
-               last_secs = smpte.seconds;
+               last_secs = timecode.seconds;
        }
 
-       if (force || smpte.frames != last_frames) {
-               sprintf (buf, "%02" PRIu32, smpte.frames);
+       if (force || timecode.frames != last_frames) {
+               sprintf (buf, "%02" PRIu32, timecode.frames);
                frames_label.set_text (buf);
-               last_frames = smpte.frames;
+               last_frames = timecode.frames;
        }
 
-       if (smpte_upper_info_label) {
-               double smpte_frames = session->smpte_frames_per_second();
+       if (timecode_upper_info_label) {
+               double timecode_frames = _session->timecode_frames_per_second();
 
-               if ( fmod(smpte_frames, 1.0) == 0.0) {
-                       sprintf (buf, "%u", int (smpte_frames));
+               if ( fmod(timecode_frames, 1.0) == 0.0) {
+                       sprintf (buf, "%u", int (timecode_frames));
                } else {
-                       sprintf (buf, "%.2f", smpte_frames);
+                       sprintf (buf, "%.2f", timecode_frames);
                }
 
-               if (smpte_upper_info_label->get_text() != buf) {
-                       smpte_upper_info_label->set_text (buf);
+               if (timecode_upper_info_label->get_text() != buf) {
+                       timecode_upper_info_label->set_text (buf);
                }
 
-               if ((fabs(smpte_frames - 29.97) < 0.0001) || smpte_frames == 30) {
-                       if (session->smpte_drop_frames()) {
+               if ((fabs(timecode_frames - 29.97) < 0.0001) || timecode_frames == 30) {
+                       if (_session->timecode_drop_frames()) {
                                sprintf (buf, "DF");
                        } else {
                                sprintf (buf, "NDF");
@@ -624,8 +627,8 @@ AudioClock::set_smpte (nframes_t when, bool force)
                        buf[0] = '\0';
                }
 
-               if (smpte_lower_info_label->get_text() != buf) {
-                       smpte_lower_info_label->set_text (buf);
+               if (timecode_lower_info_label->get_text() != buf) {
+                       timecode_lower_info_label->set_text (buf);
                }
        }
 }
@@ -643,12 +646,12 @@ AudioClock::set_bbt (nframes_t when, bool force)
                        bbt.beats = 0;
                        bbt.ticks = 0;
                } else {
-                       session->tempo_map().bbt_time (when, bbt);
+                       _session->tempo_map().bbt_time (when, bbt);
                        bbt.bars--;
                        bbt.beats--;
                }
        } else {
-               session->tempo_map().bbt_time (when, bbt);
+               _session->tempo_map().bbt_time (when, bbt);
        }
 
        sprintf (buf, "%03" PRIu32, bbt.bars);
@@ -673,7 +676,7 @@ AudioClock::set_bbt (nframes_t when, bool force)
                        pos = bbt_reference_time;
                }
 
-               TempoMap::Metric m (session->tempo_map().metric_at (pos));
+               TempoMetric m (_session->tempo_map().metric_at (pos));
 
                sprintf (buf, "%-5.2f", m.tempo().beats_per_minute());
                if (bbt_lower_info_label->get_text() != buf) {
@@ -689,12 +692,12 @@ AudioClock::set_bbt (nframes_t when, bool force)
 void
 AudioClock::set_session (Session *s)
 {
-       session = s;
+       SessionHandlePtr::set_session (s);
 
-       if (s) {
+       if (_session) {
 
                XMLProperty* prop;
-               XMLNode* node = session->extra_xml (X_("ClockModes"));
+               XMLNode* node = _session->extra_xml (X_("ClockModes"));
                AudioClock::Mode amode;
 
                if (node) {
@@ -712,7 +715,7 @@ void
 AudioClock::focus ()
 {
        switch (_mode) {
-       case SMPTE:
+       case Timecode:
                hours_ebox.grab_focus ();
                break;
 
@@ -750,16 +753,16 @@ AudioClock::field_key_release_event (GdkEventKey *ev, Field field)
        bool move_on = false;
 
        switch (field) {
-       case SMPTE_Hours:
+       case Timecode_Hours:
                label = &hours_label;
                break;
-       case SMPTE_Minutes:
+       case Timecode_Minutes:
                label = &minutes_label;
                break;
-       case SMPTE_Seconds:
+       case Timecode_Seconds:
                label = &seconds_label;
                break;
-       case SMPTE_Frames:
+       case Timecode_Frames:
                label = &frames_label;
                break;
 
@@ -895,12 +898,12 @@ AudioClock::field_key_release_event (GdkEventKey *ev, Field field)
                if (key_entry_state) {
 
                        switch (field) {
-                       case SMPTE_Hours:
-                       case SMPTE_Minutes:
-                       case SMPTE_Seconds:
-                       case SMPTE_Frames:
-                               // Check SMPTE fields for sanity (may also adjust fields)
-                               smpte_sanitize_display();
+                       case Timecode_Hours:
+                       case Timecode_Minutes:
+                       case Timecode_Seconds:
+                       case Timecode_Frames:
+                               // Check Timecode fields for sanity (may also adjust fields)
+                               timecode_sanitize_display();
                                break;
                        case Bars:
                        case Beats:
@@ -926,18 +929,18 @@ AudioClock::field_key_release_event (GdkEventKey *ev, Field field)
 
                switch (field) {
 
-                       /* SMPTE */
+                       /* Timecode */
 
-               case SMPTE_Hours:
+               case Timecode_Hours:
                        minutes_ebox.grab_focus ();
                        break;
-               case SMPTE_Minutes:
+               case Timecode_Minutes:
                        seconds_ebox.grab_focus ();
                        break;
-               case SMPTE_Seconds:
+               case Timecode_Seconds:
                        frames_ebox.grab_focus ();
                        break;
-               case SMPTE_Frames:
+               case Timecode_Frames:
                        clock_base.grab_focus ();
                        break;
 
@@ -994,19 +997,19 @@ AudioClock::field_focus_in_event (GdkEventFocus */*ev*/, Field field)
        Keyboard::magic_widget_grab_focus ();
 
        switch (field) {
-       case SMPTE_Hours:
+       case Timecode_Hours:
                hours_ebox.set_flags (Gtk::HAS_FOCUS);
                hours_ebox.set_state (Gtk::STATE_ACTIVE);
                break;
-       case SMPTE_Minutes:
+       case Timecode_Minutes:
                minutes_ebox.set_flags (Gtk::HAS_FOCUS);
                minutes_ebox.set_state (Gtk::STATE_ACTIVE);
                break;
-       case SMPTE_Seconds:
+       case Timecode_Seconds:
                seconds_ebox.set_flags (Gtk::HAS_FOCUS);
                seconds_ebox.set_state (Gtk::STATE_ACTIVE);
                break;
-       case SMPTE_Frames:
+       case Timecode_Frames:
                frames_ebox.set_flags (Gtk::HAS_FOCUS);
                frames_ebox.set_state (Gtk::STATE_ACTIVE);
                break;
@@ -1050,19 +1053,19 @@ AudioClock::field_focus_out_event (GdkEventFocus */*ev*/, Field field)
 {
        switch (field) {
 
-       case SMPTE_Hours:
+       case Timecode_Hours:
                hours_ebox.unset_flags (Gtk::HAS_FOCUS);
                hours_ebox.set_state (Gtk::STATE_NORMAL);
                break;
-       case SMPTE_Minutes:
+       case Timecode_Minutes:
                minutes_ebox.unset_flags (Gtk::HAS_FOCUS);
                minutes_ebox.set_state (Gtk::STATE_NORMAL);
                break;
-       case SMPTE_Seconds:
+       case Timecode_Seconds:
                seconds_ebox.unset_flags (Gtk::HAS_FOCUS);
                seconds_ebox.set_state (Gtk::STATE_NORMAL);
                break;
-       case SMPTE_Frames:
+       case Timecode_Frames:
                frames_ebox.unset_flags (Gtk::HAS_FOCUS);
                frames_ebox.set_state (Gtk::STATE_NORMAL);
                break;
@@ -1108,6 +1111,7 @@ bool
 AudioClock::field_button_release_event (GdkEventButton *ev, Field field)
 {
        if (dragging) {
+               cerr << "button event on clock but we are dragging\n";
                gdk_pointer_ungrab (GDK_CURRENT_TIME);
                dragging = false;
                if (ev->y > drag_start_y+1 || ev->y < drag_start_y-1 || Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)){
@@ -1125,6 +1129,7 @@ AudioClock::field_button_release_event (GdkEventButton *ev, Field field)
        }
 
        if (Keyboard::is_context_menu_event (ev)) {
+               cerr << "Context menu event on clock\n";
                if (ops_menu == 0) {
                        build_ops_menu ();
                }
@@ -1135,16 +1140,16 @@ AudioClock::field_button_release_event (GdkEventButton *ev, Field field)
        switch (ev->button) {
        case 1:
                switch (field) {
-               case SMPTE_Hours:
+               case Timecode_Hours:
                        hours_ebox.grab_focus();
                        break;
-               case SMPTE_Minutes:
+               case Timecode_Minutes:
                        minutes_ebox.grab_focus();
                        break;
-               case SMPTE_Seconds:
+               case Timecode_Seconds:
                        seconds_ebox.grab_focus();
                        break;
-               case SMPTE_Frames:
+               case Timecode_Frames:
                        frames_ebox.grab_focus();
                        break;
 
@@ -1184,7 +1189,7 @@ AudioClock::field_button_release_event (GdkEventButton *ev, Field field)
 bool
 AudioClock::field_button_press_event (GdkEventButton *ev, Field /*field*/)
 {
-       if (session == 0) {
+       if (_session == 0) {
                return false;
        }
 
@@ -1230,7 +1235,7 @@ AudioClock::field_button_press_event (GdkEventButton *ev, Field /*field*/)
 bool
 AudioClock::field_button_scroll_event (GdkEventScroll *ev, Field field)
 {
-       if (session == 0) {
+       if (_session == 0) {
                return false;
        }
 
@@ -1277,7 +1282,7 @@ AudioClock::field_button_scroll_event (GdkEventScroll *ev, Field field)
 bool
 AudioClock::field_motion_notify_event (GdkEventMotion *ev, Field field)
 {
-       if (session == 0 || !dragging) {
+       if (_session == 0 || !dragging) {
                return false;
        }
 
@@ -1335,17 +1340,17 @@ AudioClock::get_frames (Field field,nframes_t pos,int dir)
        nframes_t frames = 0;
        BBT_Time bbt;
        switch (field) {
-       case SMPTE_Hours:
-               frames = (nframes_t) floor (3600.0 * session->frame_rate());
+       case Timecode_Hours:
+               frames = (nframes_t) floor (3600.0 * _session->frame_rate());
                break;
-       case SMPTE_Minutes:
-               frames = (nframes_t) floor (60.0 * session->frame_rate());
+       case Timecode_Minutes:
+               frames = (nframes_t) floor (60.0 * _session->frame_rate());
                break;
-       case SMPTE_Seconds:
-               frames = session->frame_rate();
+       case Timecode_Seconds:
+               frames = _session->frame_rate();
                break;
-       case SMPTE_Frames:
-               frames = (nframes_t) floor (session->frame_rate() / session->smpte_frames_per_second());
+       case Timecode_Frames:
+               frames = (nframes_t) floor (_session->frame_rate() / _session->timecode_frames_per_second());
                break;
 
        case AudioFrames:
@@ -1353,32 +1358,32 @@ AudioClock::get_frames (Field field,nframes_t pos,int dir)
                break;
 
        case MS_Hours:
-               frames = (nframes_t) floor (3600.0 * session->frame_rate());
+               frames = (nframes_t) floor (3600.0 * _session->frame_rate());
                break;
        case MS_Minutes:
-               frames = (nframes_t) floor (60.0 * session->frame_rate());
+               frames = (nframes_t) floor (60.0 * _session->frame_rate());
                break;
        case MS_Seconds:
-               frames = session->frame_rate();
+               frames = _session->frame_rate();
                break;
 
        case Bars:
                bbt.bars = 1;
                bbt.beats = 0;
                bbt.ticks = 0;
-               frames = session->tempo_map().bbt_duration_at(pos,bbt,dir);
+               frames = _session->tempo_map().bbt_duration_at(pos,bbt,dir);
                break;
        case Beats:
                bbt.bars = 0;
                bbt.beats = 1;
                bbt.ticks = 0;
-               frames = session->tempo_map().bbt_duration_at(pos,bbt,dir);
+               frames = _session->tempo_map().bbt_duration_at(pos,bbt,dir);
                break;
        case Ticks:
                bbt.bars = 0;
                bbt.beats = 0;
                bbt.ticks = 1;
-               frames = session->tempo_map().bbt_duration_at(pos,bbt,dir);
+               frames = _session->tempo_map().bbt_duration_at(pos,bbt,dir);
                break;
        }
 
@@ -1391,8 +1396,8 @@ AudioClock::current_time (nframes_t pos) const
        nframes_t ret = 0;
 
        switch (_mode) {
-       case SMPTE:
-               ret = smpte_frame_from_display ();
+       case Timecode:
+               ret = timecode_frame_from_display ();
                break;
        case BBT:
                ret = bbt_frame_from_display (pos);
@@ -1419,8 +1424,8 @@ AudioClock::current_duration (nframes_t pos) const
        nframes_t ret = 0;
 
        switch (_mode) {
-       case SMPTE:
-               ret = smpte_frame_from_display ();
+       case Timecode:
+               ret = timecode_frame_from_display ();
                break;
        case BBT:
                ret = bbt_frame_duration_from_display (pos);
@@ -1442,9 +1447,9 @@ AudioClock::current_duration (nframes_t pos) const
 }
 
 void
-AudioClock::smpte_sanitize_display()
+AudioClock::timecode_sanitize_display()
 {
-       // Check SMPTE fields for sanity, possibly adjusting values
+       // Check Timecode fields for sanity, possibly adjusting values
        if (atoi(minutes_label.get_text()) > 59) {
                minutes_label.set_text("59");
        }
@@ -1453,7 +1458,7 @@ AudioClock::smpte_sanitize_display()
                seconds_label.set_text("59");
        }
 
-       switch ((long)rint(session->smpte_frames_per_second())) {
+       switch ((long)rint(_session->timecode_frames_per_second())) {
        case 24:
                if (atoi(frames_label.get_text()) > 23) {
                        frames_label.set_text("23");
@@ -1473,7 +1478,7 @@ AudioClock::smpte_sanitize_display()
                break;
        }
 
-       if (session->smpte_drop_frames()) {
+       if (_session->timecode_drop_frames()) {
                if ((atoi(minutes_label.get_text()) % 10) && (atoi(seconds_label.get_text()) == 0) && (atoi(frames_label.get_text()) < 2)) {
                        frames_label.set_text("02");
                }
@@ -1481,272 +1486,272 @@ AudioClock::smpte_sanitize_display()
 }
 
 nframes_t
-AudioClock::smpte_frame_from_display () const
+AudioClock::timecode_frame_from_display () const
 {
-       if (session == 0) {
+       if (_session == 0) {
                return 0;
        }
 
-       SMPTE::Time smpte;
+       Timecode::Time timecode;
        nframes_t sample;
 
-       smpte.hours = atoi (hours_label.get_text());
-       smpte.minutes = atoi (minutes_label.get_text());
-       smpte.seconds = atoi (seconds_label.get_text());
-       smpte.frames = atoi (frames_label.get_text());
-       smpte.rate = session->smpte_frames_per_second();
-       smpte.drop= session->smpte_drop_frames();
+       timecode.hours = atoi (hours_label.get_text());
+       timecode.minutes = atoi (minutes_label.get_text());
+       timecode.seconds = atoi (seconds_label.get_text());
+       timecode.frames = atoi (frames_label.get_text());
+       timecode.rate = _session->timecode_frames_per_second();
+       timecode.drop= _session->timecode_drop_frames();
 
-       session->smpte_to_sample( smpte, sample, false /* use_offset */, false /* use_subframes */ );
+       _session->timecode_to_sample( timecode, sample, false /* use_offset */, false /* use_subframes */ );
 
 
 #if 0
-#define SMPTE_SAMPLE_TEST_1
-#define SMPTE_SAMPLE_TEST_2
-#define SMPTE_SAMPLE_TEST_3
-#define SMPTE_SAMPLE_TEST_4
-#define SMPTE_SAMPLE_TEST_5
-#define SMPTE_SAMPLE_TEST_6
-#define SMPTE_SAMPLE_TEST_7
-
-       // Testcode for smpte<->sample conversions (P.S.)
-       SMPTE::Time smpte1;
+#define Timecode_SAMPLE_TEST_1
+#define Timecode_SAMPLE_TEST_2
+#define Timecode_SAMPLE_TEST_3
+#define Timecode_SAMPLE_TEST_4
+#define Timecode_SAMPLE_TEST_5
+#define Timecode_SAMPLE_TEST_6
+#define Timecode_SAMPLE_TEST_7
+
+       // Testcode for timecode<->sample conversions (P.S.)
+       Timecode::Time timecode1;
        nframes_t sample1;
        nframes_t oldsample = 0;
-       SMPTE::Time smpte2;
+       Timecode::Time timecode2;
        nframes_t sample_increment;
 
-       sample_increment = (long)rint(session->frame_rate() / session->smpte_frames_per_second);
+       sample_increment = (long)rint(_session->frame_rate() / _session->timecode_frames_per_second);
 
-#ifdef SMPTE_SAMPLE_TEST_1
+#ifdef Timecode_SAMPLE_TEST_1
        // Test 1: use_offset = false, use_subframes = false
        cout << "use_offset = false, use_subframes = false" << endl;
        for (int i = 0; i < 108003; i++) {
-               session->smpte_to_sample( smpte1, sample1, false /* use_offset */, false /* use_subframes */ );
-               session->sample_to_smpte( sample1, smpte2, false /* use_offset */, false /* use_subframes */ );
+               _session->timecode_to_sample( timecode1, sample1, false /* use_offset */, false /* use_subframes */ );
+               _session->sample_to_timecode( sample1, timecode2, false /* use_offset */, false /* use_subframes */ );
 
                if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1)))) {
                        cout << "ERROR: sample increment not right: " << (sample1 - oldsample) << " != " << sample_increment << endl;
-                       cout << "smpte1: " << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
+                       cout << "timecode1: " << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << " -> ";
                        cout << "sample: " << sample1 << endl;
                        cout << "sample: " << sample1 << " -> ";
-                       cout << "smpte2: " << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
+                       cout << "timecode2: " << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl;
                        break;
                }
 
-               if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) {
-                       cout << "ERROR: smpte2 not equal smpte1" << endl;
-                       cout << "smpte1: " << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
+               if (timecode2.hours != timecode1.hours || timecode2.minutes != timecode1.minutes || timecode2.seconds != timecode2.seconds || timecode2.frames != timecode1.frames) {
+                       cout << "ERROR: timecode2 not equal timecode1" << endl;
+                       cout << "timecode1: " << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << " -> ";
                        cout << "sample: " << sample1 << endl;
                        cout << "sample: " << sample1 << " -> ";
-                       cout << "smpte2: " << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
+                       cout << "timecode2: " << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl;
                        break;
                }
                oldsample = sample1;
-               session->smpte_increment( smpte1 );
+               _session->timecode_increment( timecode1 );
        }
 
        cout << "sample_increment: " << sample_increment << endl;
        cout << "sample: " << sample1 << " -> ";
-       cout << "smpte: " << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
+       cout << "timecode: " << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl;
 #endif
 
-#ifdef SMPTE_SAMPLE_TEST_2
+#ifdef Timecode_SAMPLE_TEST_2
        // Test 2: use_offset = true, use_subframes = false
        cout << "use_offset = true, use_subframes = false" << endl;
 
-       smpte1.hours = 0;
-       smpte1.minutes = 0;
-       smpte1.seconds = 0;
-       smpte1.frames = 0;
-       smpte1.subframes = 0;
+       timecode1.hours = 0;
+       timecode1.minutes = 0;
+       timecode1.seconds = 0;
+       timecode1.frames = 0;
+       timecode1.subframes = 0;
        sample1 = oldsample = 0;
 
-       session->sample_to_smpte( sample1, smpte1, true /* use_offset */, false /* use_subframes */ );
+       _session->sample_to_timecode( sample1, timecode1, true /* use_offset */, false /* use_subframes */ );
        cout << "Starting at sample: " << sample1 << " -> ";
-       cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl;
+       cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << endl;
 
        for (int i = 0; i < 108003; i++) {
-               session->smpte_to_sample( smpte1, sample1, true /* use_offset */, false /* use_subframes */ );
-               session->sample_to_smpte( sample1, smpte2, true /* use_offset */, false /* use_subframes */ );
+               _session->timecode_to_sample( timecode1, sample1, true /* use_offset */, false /* use_subframes */ );
+               _session->sample_to_timecode( sample1, timecode2, true /* use_offset */, false /* use_subframes */ );
 
-//     cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
+//     cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << " -> ";
 //     cout << "sample: " << sample1 << endl;
 //     cout << "sample: " << sample1 << " -> ";
-//     cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
+//     cout << "timecode: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl;
 
                if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1)))) {
                        cout << "ERROR: sample increment not right: " << (sample1 - oldsample) << " != " << sample_increment << endl;
-                       cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
+                       cout << "timecode1: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << " -> ";
                        cout << "sample: " << sample1 << endl;
                        cout << "sample: " << sample1 << " -> ";
-                       cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
+                       cout << "timecode2: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl;
                        break;
                }
 
-               if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) {
-                       cout << "ERROR: smpte2 not equal smpte1" << endl;
-                       cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
+               if (timecode2.hours != timecode1.hours || timecode2.minutes != timecode1.minutes || timecode2.seconds != timecode2.seconds || timecode2.frames != timecode1.frames) {
+                       cout << "ERROR: timecode2 not equal timecode1" << endl;
+                       cout << "timecode1: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << " -> ";
                        cout << "sample: " << sample1 << endl;
                        cout << "sample: " << sample1 << " -> ";
-                       cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
+                       cout << "timecode2: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl;
                        break;
                }
                oldsample = sample1;
-               session->smpte_increment( smpte1 );
+               _session->timecode_increment( timecode1 );
        }
 
        cout << "sample_increment: " << sample_increment << endl;
        cout << "sample: " << sample1 << " -> ";
-       cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
+       cout << "timecode: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl;
 #endif
 
-#ifdef SMPTE_SAMPLE_TEST_3
+#ifdef Timecode_SAMPLE_TEST_3
        // Test 3: use_offset = true, use_subframes = false, decrement
        cout << "use_offset = true, use_subframes = false, decrement" << endl;
 
-       session->sample_to_smpte( sample1, smpte1, true /* use_offset */, false /* use_subframes */ );
+       _session->sample_to_timecode( sample1, timecode1, true /* use_offset */, false /* use_subframes */ );
        cout << "Starting at sample: " << sample1 << " -> ";
-       cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl;
+       cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << endl;
 
        for (int i = 0; i < 108003; i++) {
-               session->smpte_to_sample( smpte1, sample1, true /* use_offset */, false /* use_subframes */ );
-               session->sample_to_smpte( sample1, smpte2, true /* use_offset */, false /* use_subframes */ );
+               _session->timecode_to_sample( timecode1, sample1, true /* use_offset */, false /* use_subframes */ );
+               _session->sample_to_timecode( sample1, timecode2, true /* use_offset */, false /* use_subframes */ );
 
-//     cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
+//     cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << " -> ";
 //     cout << "sample: " << sample1 << endl;
 //     cout << "sample: " << sample1 << " -> ";
-//     cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
+//     cout << "timecode: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl;
 
                if ((i > 0) && ( ((oldsample - sample1) != sample_increment) && ((oldsample - sample1) != (sample_increment + 1)) && ((oldsample - sample1) != (sample_increment - 1)))) {
                        cout << "ERROR: sample increment not right: " << (oldsample - sample1) << " != " << sample_increment << endl;
-                       cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
+                       cout << "timecode1: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << " -> ";
                        cout << "sample: " << sample1 << endl;
                        cout << "sample: " << sample1 << " -> ";
-                       cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
+                       cout << "timecode2: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl;
                        break;
                }
 
-               if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) {
-                       cout << "ERROR: smpte2 not equal smpte1" << endl;
-                       cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
+               if (timecode2.hours != timecode1.hours || timecode2.minutes != timecode1.minutes || timecode2.seconds != timecode2.seconds || timecode2.frames != timecode1.frames) {
+                       cout << "ERROR: timecode2 not equal timecode1" << endl;
+                       cout << "timecode1: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << " -> ";
                        cout << "sample: " << sample1 << endl;
                        cout << "sample: " << sample1 << " -> ";
-                       cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
+                       cout << "timecode2: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl;
                        break;
                }
                oldsample = sample1;
-               session->smpte_decrement( smpte1 );
+               _session->timecode_decrement( timecode1 );
        }
 
        cout << "sample_decrement: " << sample_increment << endl;
        cout << "sample: " << sample1 << " -> ";
-       cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
+       cout << "timecode: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl;
 #endif
 
 
-#ifdef SMPTE_SAMPLE_TEST_4
+#ifdef Timecode_SAMPLE_TEST_4
        // Test 4: use_offset = true, use_subframes = true
        cout << "use_offset = true, use_subframes = true" << endl;
 
        for (long sub = 5; sub < 80; sub += 5) {
-               smpte1.hours = 0;
-               smpte1.minutes = 0;
-               smpte1.seconds = 0;
-               smpte1.frames = 0;
-               smpte1.subframes = 0;
+               timecode1.hours = 0;
+               timecode1.minutes = 0;
+               timecode1.seconds = 0;
+               timecode1.frames = 0;
+               timecode1.subframes = 0;
                sample1 = oldsample = (sample_increment * sub) / 80;
 
-               session->sample_to_smpte( sample1, smpte1, true /* use_offset */, true /* use_subframes */ );
+               _session->sample_to_timecode( sample1, timecode1, true /* use_offset */, true /* use_subframes */ );
 
                cout << "starting at sample: " << sample1 << " -> ";
-               cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl;
+               cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << endl;
 
                for (int i = 0; i < 108003; i++) {
-                       session->smpte_to_sample( smpte1, sample1, true /* use_offset */, true /* use_subframes */ );
-                       session->sample_to_smpte( sample1, smpte2, true /* use_offset */, true /* use_subframes */ );
+                       _session->timecode_to_sample( timecode1, sample1, true /* use_offset */, true /* use_subframes */ );
+                       _session->sample_to_timecode( sample1, timecode2, true /* use_offset */, true /* use_subframes */ );
 
                        if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1)))) {
                                cout << "ERROR: sample increment not right: " << (sample1 - oldsample) << " != " << sample_increment << endl;
-                               cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
+                               cout << "timecode1: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << " -> ";
                                cout << "sample: " << sample1 << endl;
                                cout << "sample: " << sample1 << " -> ";
-                               cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
+                               cout << "timecode2: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl;
                                //break;
                        }
 
-                       if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames || smpte2.subframes != smpte1.subframes) {
-                               cout << "ERROR: smpte2 not equal smpte1" << endl;
-                               cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
+                       if (timecode2.hours != timecode1.hours || timecode2.minutes != timecode1.minutes || timecode2.seconds != timecode2.seconds || timecode2.frames != timecode1.frames || timecode2.subframes != timecode1.subframes) {
+                               cout << "ERROR: timecode2 not equal timecode1" << endl;
+                               cout << "timecode1: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << " -> ";
                                cout << "sample: " << sample1 << endl;
                                cout << "sample: " << sample1 << " -> ";
-                               cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
+                               cout << "timecode2: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl;
                                break;
                        }
                        oldsample = sample1;
-                       session->smpte_increment( smpte1 );
+                       _session->timecode_increment( timecode1 );
                }
 
                cout << "sample_increment: " << sample_increment << endl;
                cout << "sample: " << sample1 << " -> ";
-               cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
+               cout << "timecode: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl;
 
                for (int i = 0; i < 108003; i++) {
-                       session->smpte_to_sample( smpte1, sample1, true /* use_offset */, true /* use_subframes */ );
-                       session->sample_to_smpte( sample1, smpte2, true /* use_offset */, true /* use_subframes */ );
+                       _session->timecode_to_sample( timecode1, sample1, true /* use_offset */, true /* use_subframes */ );
+                       _session->sample_to_timecode( sample1, timecode2, true /* use_offset */, true /* use_subframes */ );
 
                        if ((i > 0) && ( ((oldsample - sample1) != sample_increment) && ((oldsample - sample1) != (sample_increment + 1)) && ((oldsample - sample1) != (sample_increment - 1)))) {
                                cout << "ERROR: sample increment not right: " << (oldsample - sample1) << " != " << sample_increment << endl;
-                               cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
+                               cout << "timecode1: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << " -> ";
                                cout << "sample: " << sample1 << endl;
                                cout << "sample: " << sample1 << " -> ";
-                               cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
+                               cout << "timecode2: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl;
                                //break;
                        }
 
-                       if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames || smpte2.subframes != smpte1.subframes) {
-                               cout << "ERROR: smpte2 not equal smpte1" << endl;
-                               cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
+                       if (timecode2.hours != timecode1.hours || timecode2.minutes != timecode1.minutes || timecode2.seconds != timecode2.seconds || timecode2.frames != timecode1.frames || timecode2.subframes != timecode1.subframes) {
+                               cout << "ERROR: timecode2 not equal timecode1" << endl;
+                               cout << "timecode1: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << " -> ";
                                cout << "sample: " << sample1 << endl;
                                cout << "sample: " << sample1 << " -> ";
-                               cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
+                               cout << "timecode2: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl;
                                break;
                        }
                        oldsample = sample1;
-                       session->smpte_decrement( smpte1 );
+                       _session->timecode_decrement( timecode1 );
                }
 
                cout << "sample_decrement: " << sample_increment << endl;
                cout << "sample: " << sample1 << " -> ";
-               cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
+               cout << "timecode: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl;
        }
 #endif
 
 
-#ifdef SMPTE_SAMPLE_TEST_5
+#ifdef Timecode_SAMPLE_TEST_5
        // Test 5: use_offset = true, use_subframes = false, increment seconds
        cout << "use_offset = true, use_subframes = false, increment seconds" << endl;
 
-       smpte1.hours = 0;
-       smpte1.minutes = 0;
-       smpte1.seconds = 0;
-       smpte1.frames = 0;
-       smpte1.subframes = 0;
+       timecode1.hours = 0;
+       timecode1.minutes = 0;
+       timecode1.seconds = 0;
+       timecode1.frames = 0;
+       timecode1.subframes = 0;
        sample1 = oldsample = 0;
-       sample_increment = session->frame_rate();
+       sample_increment = _session->frame_rate();
 
-       session->sample_to_smpte( sample1, smpte1, true /* use_offset */, false /* use_subframes */ );
+       _session->sample_to_timecode( sample1, timecode1, true /* use_offset */, false /* use_subframes */ );
        cout << "Starting at sample: " << sample1 << " -> ";
-       cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl;
+       cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << endl;
 
        for (int i = 0; i < 3600; i++) {
-               session->smpte_to_sample( smpte1, sample1, true /* use_offset */, false /* use_subframes */ );
-               session->sample_to_smpte( sample1, smpte2, true /* use_offset */, false /* use_subframes */ );
+               _session->timecode_to_sample( timecode1, sample1, true /* use_offset */, false /* use_subframes */ );
+               _session->sample_to_timecode( sample1, timecode2, true /* use_offset */, false /* use_subframes */ );
 
-//     cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
+//     cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << " -> ";
 //     cout << "sample: " << sample1 << endl;
 //     cout << "sample: " << sample1 << " -> ";
-//     cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
+//     cout << "timecode: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl;
 
 //     if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1))))
 //     {
@@ -1754,48 +1759,48 @@ AudioClock::smpte_frame_from_display () const
 //       break;
 //     }
 
-               if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) {
-                       cout << "ERROR: smpte2 not equal smpte1" << endl;
-                       cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
+               if (timecode2.hours != timecode1.hours || timecode2.minutes != timecode1.minutes || timecode2.seconds != timecode2.seconds || timecode2.frames != timecode1.frames) {
+                       cout << "ERROR: timecode2 not equal timecode1" << endl;
+                       cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << " -> ";
                        cout << "sample: " << sample1 << endl;
                        cout << "sample: " << sample1 << " -> ";
-                       cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
+                       cout << "timecode: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl;
                        break;
                }
                oldsample = sample1;
-               session->smpte_increment_seconds( smpte1 );
+               _session->timecode_increment_seconds( timecode1 );
        }
 
        cout << "sample_increment: " << sample_increment << endl;
        cout << "sample: " << sample1 << " -> ";
-       cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
+       cout << "timecode: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl;
 #endif
 
 
-#ifdef SMPTE_SAMPLE_TEST_6
+#ifdef Timecode_SAMPLE_TEST_6
        // Test 6: use_offset = true, use_subframes = false, increment minutes
        cout << "use_offset = true, use_subframes = false, increment minutes" << endl;
 
-       smpte1.hours = 0;
-       smpte1.minutes = 0;
-       smpte1.seconds = 0;
-       smpte1.frames = 0;
-       smpte1.subframes = 0;
+       timecode1.hours = 0;
+       timecode1.minutes = 0;
+       timecode1.seconds = 0;
+       timecode1.frames = 0;
+       timecode1.subframes = 0;
        sample1 = oldsample = 0;
-       sample_increment = session->frame_rate() * 60;
+       sample_increment = _session->frame_rate() * 60;
 
-       session->sample_to_smpte( sample1, smpte1, true /* use_offset */, false /* use_subframes */ );
+       _session->sample_to_timecode( sample1, timecode1, true /* use_offset */, false /* use_subframes */ );
        cout << "Starting at sample: " << sample1 << " -> ";
-       cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl;
+       cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << endl;
 
        for (int i = 0; i < 60; i++) {
-               session->smpte_to_sample( smpte1, sample1, true /* use_offset */, false /* use_subframes */ );
-               session->sample_to_smpte( sample1, smpte2, true /* use_offset */, false /* use_subframes */ );
+               _session->timecode_to_sample( timecode1, sample1, true /* use_offset */, false /* use_subframes */ );
+               _session->sample_to_timecode( sample1, timecode2, true /* use_offset */, false /* use_subframes */ );
 
-//     cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
+//     cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << " -> ";
 //     cout << "sample: " << sample1 << endl;
 //     cout << "sample: " << sample1 << " -> ";
-//     cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
+//     cout << "timecode: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl;
 
 //     if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1))))
 //     {
@@ -1803,47 +1808,47 @@ AudioClock::smpte_frame_from_display () const
 //       break;
 //     }
 
-               if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) {
-                       cout << "ERROR: smpte2 not equal smpte1" << endl;
-                       cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
+               if (timecode2.hours != timecode1.hours || timecode2.minutes != timecode1.minutes || timecode2.seconds != timecode2.seconds || timecode2.frames != timecode1.frames) {
+                       cout << "ERROR: timecode2 not equal timecode1" << endl;
+                       cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << " -> ";
                        cout << "sample: " << sample1 << endl;
                        cout << "sample: " << sample1 << " -> ";
-                       cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
+                       cout << "timecode: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl;
                        break;
                }
                oldsample = sample1;
-               session->smpte_increment_minutes( smpte1 );
+               _session->timecode_increment_minutes( timecode1 );
        }
 
        cout << "sample_increment: " << sample_increment << endl;
        cout << "sample: " << sample1 << " -> ";
-       cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
+       cout << "timecode: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl;
 #endif
 
-#ifdef SMPTE_SAMPLE_TEST_7
+#ifdef Timecode_SAMPLE_TEST_7
        // Test 7: use_offset = true, use_subframes = false, increment hours
        cout << "use_offset = true, use_subframes = false, increment hours" << endl;
 
-       smpte1.hours = 0;
-       smpte1.minutes = 0;
-       smpte1.seconds = 0;
-       smpte1.frames = 0;
-       smpte1.subframes = 0;
+       timecode1.hours = 0;
+       timecode1.minutes = 0;
+       timecode1.seconds = 0;
+       timecode1.frames = 0;
+       timecode1.subframes = 0;
        sample1 = oldsample = 0;
-       sample_increment = session->frame_rate() * 60 * 60;
+       sample_increment = _session->frame_rate() * 60 * 60;
 
-       session->sample_to_smpte( sample1, smpte1, true /* use_offset */, false /* use_subframes */ );
+       _session->sample_to_timecode( sample1, timecode1, true /* use_offset */, false /* use_subframes */ );
        cout << "Starting at sample: " << sample1 << " -> ";
-       cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl;
+       cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << endl;
 
        for (int i = 0; i < 10; i++) {
-               session->smpte_to_sample( smpte1, sample1, true /* use_offset */, false /* use_subframes */ );
-               session->sample_to_smpte( sample1, smpte2, true /* use_offset */, false /* use_subframes */ );
+               _session->timecode_to_sample( timecode1, sample1, true /* use_offset */, false /* use_subframes */ );
+               _session->sample_to_timecode( sample1, timecode2, true /* use_offset */, false /* use_subframes */ );
 
-//     cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
+//     cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << " -> ";
 //     cout << "sample: " << sample1 << endl;
 //     cout << "sample: " << sample1 << " -> ";
-//     cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
+//     cout << "timecode: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl;
 
 //     if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1))))
 //     {
@@ -1851,21 +1856,21 @@ AudioClock::smpte_frame_from_display () const
 //       break;
 //     }
 
-               if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) {
-                       cout << "ERROR: smpte2 not equal smpte1" << endl;
-                       cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
+               if (timecode2.hours != timecode1.hours || timecode2.minutes != timecode1.minutes || timecode2.seconds != timecode2.seconds || timecode2.frames != timecode1.frames) {
+                       cout << "ERROR: timecode2 not equal timecode1" << endl;
+                       cout << "timecode: " << (timecode1.negative ? "-" : "") << timecode1.hours << ":" << timecode1.minutes << ":" << timecode1.seconds << ":" << timecode1.frames << "::" << timecode1.subframes << " -> ";
                        cout << "sample: " << sample1 << endl;
                        cout << "sample: " << sample1 << " -> ";
-                       cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
+                       cout << "timecode: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl;
                        break;
                }
                oldsample = sample1;
-               session->smpte_increment_hours( smpte1 );
+               _session->timecode_increment_hours( timecode1 );
        }
 
        cout << "sample_increment: " << sample_increment << endl;
        cout << "sample: " << sample1 << " -> ";
-       cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
+       cout << "timecode: " << (timecode2.negative ? "-" : "") << timecode2.hours << ":" << timecode2.minutes << ":" << timecode2.seconds << ":" << timecode2.frames << "::" << timecode2.subframes << endl;
 #endif
 
 #endif
@@ -1876,7 +1881,7 @@ AudioClock::smpte_frame_from_display () const
 nframes_t
 AudioClock::minsec_frame_from_display () const
 {
-       if (session == 0) {
+       if (_session == 0) {
                return 0;
        }
 
@@ -1884,7 +1889,7 @@ AudioClock::minsec_frame_from_display () const
        int mins = atoi (ms_minutes_label.get_text());
        float secs = atof (ms_seconds_label.get_text());
 
-       nframes_t sr = session->frame_rate();
+       nframes_t sr = _session->frame_rate();
 
        return (nframes_t) floor ((hrs * 60.0f * 60.0f * sr) + (mins * 60.0f * sr) + (secs * sr));
 }
@@ -1892,7 +1897,7 @@ AudioClock::minsec_frame_from_display () const
 nframes_t
 AudioClock::bbt_frame_from_display (nframes_t pos) const
 {
-       if (session == 0) {
+       if (_session == 0) {
                error << "AudioClock::current_time() called with BBT mode but without session!" << endmsg;
                return 0;
        }
@@ -1909,7 +1914,7 @@ AudioClock::bbt_frame_from_display (nframes_t pos) const
                any.bbt.beats++;
        }
 
-       nframes_t ret = session->convert_to_frames_at (pos, any);
+       nframes_t ret = _session->convert_to_frames_at (pos, any);
 
        return ret;
 }
@@ -1918,7 +1923,7 @@ AudioClock::bbt_frame_from_display (nframes_t pos) const
 nframes_t
 AudioClock::bbt_frame_duration_from_display (nframes_t pos) const
 {
-       if (session == 0) {
+       if (_session == 0) {
                error << "AudioClock::current_time() called with BBT mode but without session!" << endmsg;
                return 0;
        }
@@ -1930,7 +1935,7 @@ AudioClock::bbt_frame_duration_from_display (nframes_t pos) const
        bbt.beats = atoi (beats_label.get_text());
        bbt.ticks = atoi (ticks_label.get_text());
 
-       return session->tempo_map().bbt_duration_at(pos,bbt,1);
+       return _session->tempo_map().bbt_duration_at(pos,bbt,1);
 }
 
 nframes_t
@@ -1948,12 +1953,38 @@ AudioClock::build_ops_menu ()
        ops_menu->set_name ("ArdourContextMenu");
 
        if (!Profile->get_sae()) {
-               ops_items.push_back (MenuElem (_("Timecode"), bind (mem_fun(*this, &AudioClock::set_mode), SMPTE)));
+               ops_items.push_back (MenuElem (_("Timecode"), sigc::bind (sigc::mem_fun(*this, &AudioClock::set_mode), Timecode)));
+       }
+       ops_items.push_back (MenuElem (_("Bars:Beats"), sigc::bind (sigc::mem_fun(*this, &AudioClock::set_mode), BBT)));
+       ops_items.push_back (MenuElem (_("Minutes:Seconds"), sigc::bind (sigc::mem_fun(*this, &AudioClock::set_mode), MinSec)));
+       ops_items.push_back (MenuElem (_("Samples"), sigc::bind (sigc::mem_fun(*this, &AudioClock::set_mode), Frames)));
+       ops_items.push_back (MenuElem (_("Off"), sigc::bind (sigc::mem_fun(*this, &AudioClock::set_mode), Off)));
+
+       if (editable && !is_duration && !_follows_playhead) {
+               ops_items.push_back (SeparatorElem());
+               ops_items.push_back (MenuElem (_("Set From Playhead"), sigc::mem_fun(*this, &AudioClock::set_from_playhead)));
+               ops_items.push_back (MenuElem (_("Locate to this time"), sigc::mem_fun(*this, &AudioClock::locate)));
        }
-       ops_items.push_back (MenuElem (_("Bars:Beats"), bind (mem_fun(*this, &AudioClock::set_mode), BBT)));
-       ops_items.push_back (MenuElem (_("Minutes:Seconds"), bind (mem_fun(*this, &AudioClock::set_mode), MinSec)));
-       ops_items.push_back (MenuElem (_("Samples"), bind (mem_fun(*this, &AudioClock::set_mode), Frames)));
-       ops_items.push_back (MenuElem (_("Off"), bind (mem_fun(*this, &AudioClock::set_mode), Off)));
+}
+
+void
+AudioClock::set_from_playhead ()
+{
+       if (!_session) {
+               return;
+       }
+       
+       set (_session->transport_frame());
+}
+
+void
+AudioClock::locate ()
+{
+       if (!_session || is_duration) {
+               return;
+       }
+       
+       _session->request_locate (current_time(), false);
 }
 
 void
@@ -1977,8 +2008,8 @@ AudioClock::set_mode (Mode m)
        _mode = m;
 
        switch (_mode) {
-       case SMPTE:
-               clock_base.add (smpte_packer_hbox);
+       case Timecode:
+               clock_base.add (timecode_packer_hbox);
                break;
 
        case BBT:
@@ -2013,30 +2044,30 @@ AudioClock::set_mode (Mode m)
 void
 AudioClock::set_size_requests ()
 {
-       /* note that in some fonts, "88" is narrower than "00", hence the 2 pixel padding */
+       /* note that in some fonts, "88" is narrower than "00" */
 
        switch (_mode) {
-       case SMPTE:
-               Gtkmm2ext::set_size_request_to_display_given_text (hours_label, "-00", 5, 5);
-               Gtkmm2ext::set_size_request_to_display_given_text (minutes_label, "00", 5, 5);
-               Gtkmm2ext::set_size_request_to_display_given_text (seconds_label, "00", 5, 5);
-               Gtkmm2ext::set_size_request_to_display_given_text (frames_label, "00", 5, 5);
+       case Timecode:
+               Gtkmm2ext::set_size_request_to_display_given_text (hours_label, "-88", 5, 5);
+               Gtkmm2ext::set_size_request_to_display_given_text (minutes_label, "88", 5, 5);
+               Gtkmm2ext::set_size_request_to_display_given_text (seconds_label, "88", 5, 5);
+               Gtkmm2ext::set_size_request_to_display_given_text (frames_label, "88", 5, 5);
                break;
 
        case BBT:
-               Gtkmm2ext::set_size_request_to_display_given_text (bars_label, "-000", 5, 5);
-               Gtkmm2ext::set_size_request_to_display_given_text (beats_label, "00", 5, 5);
-               Gtkmm2ext::set_size_request_to_display_given_text (ticks_label, "0000", 5, 5);
+               Gtkmm2ext::set_size_request_to_display_given_text (bars_label, "-888", 5, 5);
+               Gtkmm2ext::set_size_request_to_display_given_text (beats_label, "88", 5, 5);
+               Gtkmm2ext::set_size_request_to_display_given_text (ticks_label, "8888", 5, 5);
                break;
 
        case MinSec:
-               Gtkmm2ext::set_size_request_to_display_given_text (ms_hours_label, "00", 5, 5);
-               Gtkmm2ext::set_size_request_to_display_given_text (ms_minutes_label, "00", 5, 5);
-               Gtkmm2ext::set_size_request_to_display_given_text (ms_seconds_label, "00.000", 5, 5);
+               Gtkmm2ext::set_size_request_to_display_given_text (ms_hours_label, "88", 5, 5);
+               Gtkmm2ext::set_size_request_to_display_given_text (ms_minutes_label, "88", 5, 5);
+               Gtkmm2ext::set_size_request_to_display_given_text (ms_seconds_label, "88.888", 5, 5);
                break;
 
        case Frames:
-               Gtkmm2ext::set_size_request_to_display_given_text (audio_frames_label, "0000000000", 5, 5);
+               Gtkmm2ext::set_size_request_to_display_given_text (audio_frames_label, "8888888888", 5, 5);
                break;
 
        case Off:
@@ -2051,3 +2082,47 @@ AudioClock::set_bbt_reference (nframes64_t pos)
 {
        bbt_reference_time = pos;
 }
+
+void
+AudioClock::on_style_changed (const Glib::RefPtr<Style>& old_style)
+{
+       HBox::on_style_changed (old_style);
+
+       /* propagate style changes to all component widgets that should inherit the main one */
+
+       Glib::RefPtr<RcStyle> rcstyle = get_modifier_style();
+
+       clock_base.modify_style (rcstyle);
+       audio_frames_label.modify_style (rcstyle);
+       hours_label.modify_style (rcstyle);
+       minutes_label.modify_style (rcstyle);
+       seconds_label.modify_style (rcstyle);
+       frames_label.modify_style (rcstyle);
+       bars_label.modify_style (rcstyle);
+       beats_label.modify_style (rcstyle);
+       ticks_label.modify_style (rcstyle);
+       ms_hours_label.modify_style (rcstyle);
+       ms_minutes_label.modify_style (rcstyle);
+       ms_seconds_label.modify_style (rcstyle);
+       hours_ebox.modify_style (rcstyle);
+       minutes_ebox.modify_style (rcstyle);
+       seconds_ebox.modify_style (rcstyle);
+       frames_ebox.modify_style (rcstyle);
+       audio_frames_ebox.modify_style (rcstyle);
+       bars_ebox.modify_style (rcstyle);
+       beats_ebox.modify_style (rcstyle);
+       ticks_ebox.modify_style (rcstyle);
+       ms_hours_ebox.modify_style (rcstyle);
+       ms_minutes_ebox.modify_style (rcstyle);
+       ms_seconds_ebox.modify_style (rcstyle);
+
+       colon1.modify_style (rcstyle);
+       colon2.modify_style (rcstyle);
+       colon3.modify_style (rcstyle);
+       colon4.modify_style (rcstyle);
+       colon5.modify_style (rcstyle);
+       b1.modify_style (rcstyle);
+       b2.modify_style (rcstyle);
+
+       set_size_requests ();
+}