mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 07:14:56 +01:00
simplify coaxing clock value out of ardour
This commit is contained in:
parent
edb9a24727
commit
2d8aa1d2ff
2 changed files with 22 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -70,6 +70,8 @@ class AudioClock : public CairoWidget, public ARDOUR::SessionHandlePtr
|
|||
void set_bbt_reference (framepos_t);
|
||||
void set_is_duration (bool);
|
||||
|
||||
void copy_text_to_clipboard () const;
|
||||
|
||||
std::string name() const { return _name; }
|
||||
|
||||
framepos_t current_time (framepos_t position = 0) const;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue