cairo_set_source_rgba (cr, bg_r, bg_g, bg_b, bg_a);
if (corner_radius) {
if (_left_layout) {
- Gtkmm2ext::rounded_top_half_rectangle (cr, 0, 0, get_width() - corner_radius/2.0, upper_height, corner_radius);
+ Gtkmm2ext::rounded_top_half_rectangle (cr, 0, 0, get_width(), upper_height, corner_radius);
} else {
Gtkmm2ext::rounded_rectangle (cr, 0, 0, get_width(), upper_height, corner_radius);
}
if (!_fixed_width) {
cairo_move_to (cr, layout_x_offset, 0);
} else {
- int xcenter = layout_x_offset > corner_radius/4.0 ? 0 : (get_width() - _mode_width[_mode]) /2;
+ int xcenter = layout_x_offset > 0 ? 0 : (get_width() - _mode_width[_mode]) /2;
cairo_move_to (cr, layout_x_offset + xcenter, (upper_height - layout_height) / 2.0);
}
if (corner_radius) {
Gtkmm2ext::rounded_bottom_half_rectangle (cr, 0, upper_height + separator_height,
left_rect_width + (separator_height == 0 ? corner_radius : 0),
- h - corner_radius/2.0, corner_radius);
+ h, corner_radius);
} else {
cairo_rectangle (cr, 0, upper_height + separator_height, left_rect_width, h);
}
if (corner_radius) {
Gtkmm2ext::rounded_bottom_half_rectangle (cr, left_rect_width + separator_height,
upper_height + separator_height,
- get_width() - separator_height - left_rect_width - corner_radius/2.0,
- h - corner_radius/2.0, corner_radius);
+ get_width() - separator_height - left_rect_width,
+ h, corner_radius);
} else {
cairo_rectangle (cr, left_rect_width + separator_height, upper_height + separator_height,
get_width() - separator_height - left_rect_width, h);
*/
int x, rw, rh;
_right_layout->get_pixel_size(rw, rh);
- x = get_width() - rw - separator_height - x_leading_padding - corner_radius/2.0;
+ x = get_width() - rw - separator_height - x_leading_padding;
if (x < x_leading_padding + left_rect_width + separator_height) {
/* rather cut off the right end than overlap with the text on the left */
x = x_leading_padding + left_rect_width + separator_height;
if (editing) {
if (!insert_map.empty()) {
- int xcenter = layout_x_offset > corner_radius/4.0 ? 0 : (get_width() - _mode_width[_mode]) /2;
+ int xcenter = layout_x_offset > 0 ? 0 : (get_width() - _mode_width[_mode]) /2;
if (input_string.length() < insert_map.size()) {
Pango::Rectangle cursor;
} else {
framepos_t c = current_time();
- if (c > frames) {
+ if (c > frames || _negative_allowed) {
set (c - frames, true);
} else {
set (0, true);
drop_focus ();
}
+void
+AudioClock::session_property_changed (const PropertyChange& p)
+{
+ set (last_when, true);
+}
+
void
AudioClock::session_configuration_changed (std::string p)
{
+ if (_negative_allowed) {
+ /* session option editor clock */
+ return;
+ }
+
if (p == "sync-source" || p == "external-sync") {
set (current_time(), true);
return;
float vid_pullup = _session->config.get_video_pullup();
if (vid_pullup == 0.0) {
- _right_layout->set_markup (string_compose ("<span size=\"%1\" foreground=\"white\">%2</span>",
- INFO_FONT_SIZE, _("pullup: \u2012")));
+ _right_layout->set_markup (string_compose ("<span size=\"%1\"><span foreground=\"white\">%2 </span><span foreground=\"green\">off</span></span>",
+ INFO_FONT_SIZE, _("Pull")));
} else {
- sprintf (buf, _("%+-6.4f%%"), vid_pullup);
- _right_layout->set_markup (string_compose ("<span size=\"%1\" foreground=\"green\">%2</span>",
- INFO_FONT_SIZE, buf));
+ sprintf (buf, _("%+.4f%%"), vid_pullup);
+ _right_layout->set_markup (string_compose ("<span size=\"%1\"><span foreground=\"white\">%2 </span><span foreground=\"green\">%3</span></span>",
+ INFO_FONT_SIZE, _("Pull"), buf));
}
}
}
TempoMetric m (_session->tempo_map().metric_at (pos));
sprintf (buf, "%-5.2f", m.tempo().beats_per_minute());
- _left_layout->set_markup (string_compose ("<span size=\"%1\" foreground=\"green\">%2</span>",
+ _left_layout->set_markup (string_compose ("<span size=\"%1\" foreground=\"white\">Tempo <span foreground=\"green\">%2</span></span>",
INFO_FONT_SIZE, buf));
sprintf (buf, "%g/%g", m.meter().divisions_per_bar(), m.meter().note_divisor());
- _right_layout->set_markup (string_compose ("<span size=\"%1\" foreground=\"green\">%2</span>",
+ _right_layout->set_markup (string_compose ("<span size=\"%1\" foreground=\"white\">Meter <span foreground=\"green\">%2</span></span>",
INFO_FONT_SIZE, buf));
}
}
if (_session) {
_session->config.ParameterChanged.connect (_session_connections, invalidator (*this), boost::bind (&AudioClock::session_configuration_changed, this, _1), gui_context());
+ _session->tempo_map().PropertyChanged.connect (_session_connections, invalidator (*this), boost::bind (&AudioClock::session_property_changed, this, _1), gui_context());
const XMLProperty* prop;
XMLNode* node = _session->extra_xml (X_("ClockModes"));
case GDK_KP_Subtract:
if (_negative_allowed && input_string.empty()) {
edit_is_negative = true;
+ edit_string.replace(0,1,"-");
+ _layout->set_text (edit_string);
+ queue_draw ();
} else {
end_edit_relative (false);
}
highlight_length = merge_input_and_edit_string ();
}
+ if (edit_is_negative) {
+ edit_string.replace(0,1,"-");
+ } else {
+ if (pre_edit_string.at(0) == '-') {
+ edit_string.replace(0,1,"_");
+ } else {
+ edit_string.replace(0,1," ");
+ }
+ }
+
show_edit_status (highlight_length);
_layout->set_text (edit_string);
queue_draw ();
/* the text has been centered vertically, so adjust
* x and y.
*/
- int xcenter = !_fixed_width || layout_x_offset > corner_radius/4.0 ? 0 : (get_width() - _mode_width[_mode]) /2;
+ int xcenter = !_fixed_width || layout_x_offset > 0 ? 0 : (get_width() - _mode_width[_mode]) /2;
y = ev->y - ((upper_height - layout_height)/2);
x = ev->x - layout_x_offset - xcenter;
if (_edit_by_click_field) {
- int xcenter = !_fixed_width || layout_x_offset > corner_radius/4.0 ? 0 : (get_width() - _mode_width[_mode]) /2;
+ int xcenter = !_fixed_width || layout_x_offset > 0 ? 0 : (get_width() - _mode_width[_mode]) /2;
int index = 0;
int trailing;
int y = ev->y - ((upper_height - layout_height)/2);
* x and y.
*/
- int xcenter = !_fixed_width || layout_x_offset > corner_radius/4.0 ? 0 : (get_width() - _mode_width[_mode]) /2;
+ int xcenter = !_fixed_width || layout_x_offset > 0 ? 0 : (get_width() - _mode_width[_mode]) /2;
y = ev->y - ((upper_height - layout_height)/2);
x = ev->x - layout_x_offset - xcenter;
frames *= 10;
}
- if ((double)current_time() - (double)frames < 0.0) {
+ if (!_negative_allowed && (double)current_time() - (double)frames < 0.0) {
set (0, true);
} else {
set (current_time() - frames, true);
AudioClock::timecode_validate_edit (const string&)
{
Timecode::Time TC;
+ int hours;
+ char ignored[2];
- if (sscanf (_layout->get_text().c_str(), "%" PRId32 ":%" PRId32 ":%" PRId32 ":%" PRId32,
- &TC.hours, &TC.minutes, &TC.seconds, &TC.frames) != 4) {
+ if (sscanf (_layout->get_text().c_str(), "%" PRId32 ":%" PRId32 ":%" PRId32 "%[:;]%" PRId32,
+ &hours, &TC.minutes, &TC.seconds, ignored, &TC.frames) != 5) {
+ return false;
+ }
+
+ if (hours < 0) {
+ TC.hours = hours * -1;
+ TC.negative = true;
+ } else {
+ TC.hours = hours;
+ TC.negative = false;
+ }
+
+ if (TC.negative && !_negative_allowed) {
return false;
}
Timecode::Time TC;
framepos_t sample;
+ char ignored[2];
+ int hours;
- if (sscanf (str.c_str(), "%d:%d:%d:%d", &TC.hours, &TC.minutes, &TC.seconds, &TC.frames) != 4) {
+ if (sscanf (str.c_str(), "%d:%d:%d%[:;]%d", &hours, &TC.minutes, &TC.seconds, ignored, &TC.frames) != 5) {
error << string_compose (_("programming error: %1 %2"), "badly formatted timecode clock string", str) << endmsg;
return 0;
}
-
- TC.negative = edit_is_negative;
+ TC.hours = abs(hours);
TC.rate = _session->timecode_frames_per_second();
TC.drop= _session->timecode_drop_frames();
_session->timecode_to_sample (TC, sample, false /* use_offset */, false /* use_subframes */ );
// timecode_tester ();
+ if (edit_is_negative) {
+ sample = - sample;
+ }
return sample;
}