add support for using - as prefix keys to enter a negative value in an audio clock. so far only used for session timecode offset option clock
git-svn-id: svn://localhost/ardour2/branches/3.0@13443 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
b36caf3b6f
commit
b8b8384a26
|
@ -74,6 +74,8 @@ AudioClock::AudioClock (const string& clock_name, bool transient, const string&
|
|||
, layout_x_offset (0)
|
||||
, em_width (0)
|
||||
, _edit_by_click_field (false)
|
||||
, _negative_allowed (false)
|
||||
, edit_is_negative (false)
|
||||
, editing_attr (0)
|
||||
, foreground_attr (0)
|
||||
, first_height (0)
|
||||
|
@ -574,8 +576,10 @@ AudioClock::start_edit (Field f)
|
|||
edit_string.clear ();
|
||||
_layout->set_text ("");
|
||||
}
|
||||
|
||||
input_string.clear ();
|
||||
editing = true;
|
||||
edit_is_negative = false;
|
||||
|
||||
if (f) {
|
||||
input_string = get_field (f);
|
||||
|
@ -698,6 +702,7 @@ AudioClock::end_edit (bool modify)
|
|||
} else {
|
||||
|
||||
editing = false;
|
||||
edit_is_negative = false;
|
||||
_layout->set_attributes (normal_attributes);
|
||||
_layout->set_text (pre_edit_string);
|
||||
}
|
||||
|
@ -1344,12 +1349,15 @@ AudioClock::on_key_press_event (GdkEventKey* ev)
|
|||
|
||||
case GDK_minus:
|
||||
case GDK_KP_Subtract:
|
||||
end_edit_relative (false);
|
||||
if (_negative_allowed && input_string.empty()) {
|
||||
edit_is_negative = true;
|
||||
} else {
|
||||
end_edit_relative (false);
|
||||
}
|
||||
return true;
|
||||
break;
|
||||
|
||||
case GDK_plus:
|
||||
case GDK_KP_Add:
|
||||
end_edit_relative (true);
|
||||
return true;
|
||||
break;
|
||||
|
@ -1933,6 +1941,7 @@ AudioClock::frames_from_timecode_string (const string& str) const
|
|||
return 0;
|
||||
}
|
||||
|
||||
TC.negative = edit_is_negative;
|
||||
TC.rate = _session->timecode_frames_per_second();
|
||||
TC.drop= _session->timecode_drop_frames();
|
||||
|
||||
|
@ -2220,3 +2229,9 @@ AudioClock::dpi_reset ()
|
|||
first_height = 0;
|
||||
queue_resize ();
|
||||
}
|
||||
|
||||
void
|
||||
AudioClock::set_negative_allowed (bool yn)
|
||||
{
|
||||
_negative_allowed = yn;
|
||||
}
|
||||
|
|
|
@ -76,6 +76,7 @@ class AudioClock : public CairoWidget, public ARDOUR::SessionHandlePtr
|
|||
framepos_t current_time (framepos_t position = 0) const;
|
||||
framepos_t current_duration (framepos_t position = 0) const;
|
||||
void set_session (ARDOUR::Session *s);
|
||||
void set_negative_allowed (bool yn);
|
||||
|
||||
sigc::signal<void> ValueChanged;
|
||||
sigc::signal<void> mode_changed;
|
||||
|
@ -104,6 +105,8 @@ class AudioClock : public CairoWidget, public ARDOUR::SessionHandlePtr
|
|||
int em_width;
|
||||
bool _edit_by_click_field;
|
||||
int _mode_width[4]; /* enum Mode entries */
|
||||
bool _negative_allowed;
|
||||
bool edit_is_negative;
|
||||
|
||||
Glib::RefPtr<Pango::Layout> _layout;
|
||||
Glib::RefPtr<Pango::Layout> _left_layout;
|
||||
|
@ -195,7 +198,7 @@ class AudioClock : public CairoWidget, public ARDOUR::SessionHandlePtr
|
|||
bool bbt_validate_edit (const std::string&);
|
||||
bool minsec_validate_edit (const std::string&);
|
||||
|
||||
framepos_t frames_from_timecode_string (const std::string&) const;
|
||||
framepos_t frames_from_timecode_string (const std::string&) const;
|
||||
framepos_t frames_from_bbt_string (framepos_t, const std::string&) const;
|
||||
framepos_t frame_duration_from_bbt_string (framepos_t, const std::string&) const;
|
||||
framepos_t frames_from_minsec_string (const std::string&) const;
|
||||
|
|
|
@ -541,6 +541,7 @@ public:
|
|||
void set_session (ARDOUR::Session *);
|
||||
|
||||
Gtk::Widget& tip_widget() { return _clock; }
|
||||
AudioClock& clock() { return _clock; }
|
||||
|
||||
private:
|
||||
void save_clock_time ();
|
||||
|
|
|
@ -99,6 +99,7 @@ SessionOptionEditor::SessionOptionEditor (Session* s)
|
|||
);
|
||||
|
||||
co->set_session (_session);
|
||||
co->clock().set_negative_allowed (true);
|
||||
|
||||
add_option (_("Timecode"), co);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user