{
session = 0;
last_when = 0;
+ last_pdelta = 0;
+ last_sdelta = 0;
key_entry_state = 0;
ops_menu = 0;
dragging = false;
}
void
-AudioClock::set (nframes_t when, bool force)
+AudioClock::set (nframes_t when, bool force, nframes_t offset, int which)
{
if ((!force && !is_visible()) || session == 0) {
return;
}
- if (when == last_when && !force) {
+ if (when == last_when && !offset && !force) {
return;
}
+ bool pdelta = Config->get_primary_clock_delta_edit_cursor();
+ bool sdelta = Config->get_secondary_clock_delta_edit_cursor();
+
+ if (offset && which == 1 && pdelta) {
+ when = (when > offset) ? when - offset : offset - when;
+ } else if (offset && which == 2 && sdelta) {
+ when = (when > offset) ? when - offset : offset - when;
+ }
+
+ if (which == 1 && pdelta && !last_pdelta) {
+ cout << "set_widget_name() called" << endl;
+ set_widget_name("TransportClockDisplayDelta");
+ last_pdelta = true;
+ } else if (which == 1 && !pdelta && last_pdelta) {
+ set_widget_name("TransportClockDisplay");
+ last_pdelta = false;
+ } else if (which == 2 && sdelta && !last_sdelta) {
+ set_widget_name("SecondaryClockDisplayDelta");
+ last_sdelta = true;
+ } else if (which == 2 && !sdelta && last_sdelta) {
+ set_widget_name("SecondaryClockDisplay");
+ last_sdelta = false;
+ }
+
switch (_mode) {
case SMPTE:
set_smpte (when, force);
smpte_upper_info_label->set_text (buf);
- if (session->smpte_drop_frames()) {
- sprintf (buf, "DF");
+ if ((fabs(smpte_frames - 29.97) < 0.0001) || smpte_frames == 30) {
+ if (session->smpte_drop_frames()) {
+ sprintf (buf, "DF");
+ } else {
+ sprintf (buf, "NDF");
+ }
} else {
- sprintf (buf, "NDF");
+ // there is no drop frame alternative
+ buf[0] = '\0';
}
smpte_lower_info_label->set_text (buf);
}
}
+void
+AudioClock::focus ()
+{
+ switch (_mode) {
+ case SMPTE:
+ hours_ebox.grab_focus ();
+ break;
+
+ case BBT:
+ bars_ebox.grab_focus ();
+ break;
+
+ case MinSec:
+ ms_hours_ebox.grab_focus ();
+ break;
+
+ case Frames:
+ frames_ebox.grab_focus ();
+ break;
+
+ case Off:
+ break;
+ }
+}
+
+
bool
AudioClock::field_key_press_event (GdkEventKey *ev, Field field)
{
case Bars:
case Beats:
case Ticks:
- // Bars or beats should never be 0
- if (atoi(bars_label.get_text()) == 0) {
+ // Bars should never be, unless this clock is for a duration
+ if (atoi(bars_label.get_text()) == 0 && !is_duration) {
bars_label.set_text("001");
}
- if (atoi(beats_label.get_text()) == 0) {
+ // beats should never be 0, unless this clock is for a duration
+ if (atoi(beats_label.get_text()) == 0 && !is_duration) {
beats_label.set_text("01");
}
break;
if (dragging) {
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::Shift)){
+ if (ev->y > drag_start_y+1 || ev->y < drag_start_y-1 || Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)){
// we actually dragged so return without setting editing focus, or we shift clicked
return true;
}
switch (ev->button) {
case 1:
- if (Keyboard::modifier_state_equals (ev->state, Keyboard::Shift)) {
+ if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
set (frames, true);
ValueChanged (); /* EMIT_SIGNAL */
}
break;
case 2:
- if (Keyboard::modifier_state_equals (ev->state, Keyboard::Shift)) {
+ if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
set (frames, true);
ValueChanged (); /* EMIT_SIGNAL */
}
case GDK_SCROLL_UP:
frames = get_frames (field);
if (frames != 0) {
- if (Keyboard::modifier_state_equals (ev->state, Keyboard::Control)) {
+ if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
frames *= 10;
}
set (current_time() + frames, true);
case GDK_SCROLL_DOWN:
frames = get_frames (field);
if (frames != 0) {
- if (Keyboard::modifier_state_equals (ev->state, Keyboard::Control)) {
+ if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
frames *= 10;
}
float pixel_frame_scale_factor = 0.2f;
/*
- if (Keyboard::modifier_state_equals (ev->state, Keyboard::Control)) {
+ if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
pixel_frame_scale_factor = 0.1f;
}
if (Keyboard::modifier_state_contains (ev->state,
- Keyboard::Control|Keyboard::Alt)) {
+ Keyboard::PrimaryModifier|Keyboard::SecondaryModifier)) {
pixel_frame_scale_factor = 0.025f;
}
ops_items.push_back (MenuElem (_("Timecode"), bind (mem_fun(*this, &AudioClock::set_mode), SMPTE)));
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 (_("Audio Frames"), bind (mem_fun(*this, &AudioClock::set_mode), Frames)));
+ 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)));
}
if (_mode == m) {
return;
}
- switch (_mode) {
- case SMPTE:
- case BBT:
- case MinSec:
- case Frames:
- clock_base.remove ();
- break;
- case Off:
- break;
- }
+
+ clock_base.remove ();
_mode = m;
break;
case Off:
+ clock_base.add (off_hbox);
break;
}
break;
case Off:
+ Gtkmm2ext::set_size_request_to_display_given_text (off_hbox, "00000", 5, 5);
break;
}