simplify coaxing clock value out of ardour

This commit is contained in:
Robin Gareus 2015-04-14 11:55:39 +02:00
parent edb9a24727
commit 2d8aa1d2ff
2 changed files with 22 additions and 0 deletions

View file

@ -2079,6 +2079,24 @@ AudioClock::frames_from_audioframes_string (const string& str) const
return f;
}
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 ()
{
@ -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