diff options
Diffstat (limited to 'gtk2_ardour/audio_clock.cc')
-rw-r--r-- | gtk2_ardour/audio_clock.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/gtk2_ardour/audio_clock.cc b/gtk2_ardour/audio_clock.cc index 15fd85c229..a90946f3ba 100644 --- a/gtk2_ardour/audio_clock.cc +++ b/gtk2_ardour/audio_clock.cc @@ -2080,6 +2080,24 @@ AudioClock::frames_from_audioframes_string (const string& str) const } void +AudioClock::copy_text_to_clipboard () const +{ + string val; + if (editing) { + val = pre_edit_string; + } else { + val = _layout->get_text (); + } + const size_t trim = val.find_first_not_of(" "); + if (trim == string::npos) { + assert(0); // empty clock, can't be right. + return; + } + Glib::RefPtr<Clipboard> cl = Gtk::Clipboard::get(); + cl->set_text (val.substr(trim)); +} + +void AudioClock::build_ops_menu () { using namespace Menu_Helpers; @@ -2099,6 +2117,8 @@ AudioClock::build_ops_menu () 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 (SeparatorElem()); + ops_items.push_back (MenuElem (_("Copy to clipboard"), sigc::mem_fun(*this, &AudioClock::copy_text_to_clipboard))); } void |