- char tc[12];
-
- Units::totext(tc,
- asset->tcstart / asset->frame_rate,
- TIME_HMSF,
- asset->sample_rate,
- asset->frame_rate);
-
- char *tc_hours = tc;
- char *tc_minutes = strchr(tc, ':') + 1;
- *(tc_minutes - 1) = 0;
- char *tc_seconds = strchr(tc_minutes, ':') + 1;
- *(tc_seconds - 1) = 0;
- char *tc_rest = strchr(tc_seconds, ':') + 1;
- *(tc_rest - 1) = 0;
-
- add_subwindow(new AssetEditTCStartTextBox(this, atoi(tc_hours), x, y,
- (int) (asset->frame_rate * 60 * 60)));
- x += 30;
- add_subwindow(new BC_Title(x, y, ":"));
- x += 10;
- add_subwindow(new AssetEditTCStartTextBox(this, atoi(tc_minutes), x, y,
- (int) (asset->frame_rate * 60)));
- x += 30;
- add_subwindow(new BC_Title(x, y, ":"));
- x += 10;
- add_subwindow(new AssetEditTCStartTextBox(this, atoi(tc_seconds), x, y,
- (int) (asset->frame_rate)));
- x += 30;
- add_subwindow(new BC_Title(x, y, ":"));
- x += 10;
- add_subwindow(new AssetEditTCStartTextBox(this, atoi(tc_rest), x, y, 1));
-
+ char text[32], *tc = text;
+ Units::totext(tc, asset->tcstart / asset->frame_rate,
+ TIME_HMSF, asset->sample_rate, asset->frame_rate);
+
+ const char *tc_hours = tc, *tc_minutes, *tc_seconds, *tc_rest;
+ tc = strchr(tc, ':'); *tc++ = 0; tc_minutes = tc;
+ tc = strchr(tc, ':'); *tc++ = 0; tc_seconds = tc;
+ tc = strchr(tc, ':'); *tc++ = 0; tc_rest = tc;
+
+ int padw = BC_Title::calculate_w(this, ":", MEDIUMFONT);
+ int fldw = BC_Title::calculate_w(this, "00", MEDIUMFONT) + 5;
+ add_subwindow(tc_hours_textbox = new BC_TextBox(x, y, fldw, 1, tc_hours));
+ add_subwindow(new BC_Title(x += tc_hours_textbox->get_w(), y, ":"));
+ add_subwindow(tc_minutes_textbox = new BC_TextBox(x += padw, y, fldw, 1, tc_minutes));
+ add_subwindow(new BC_Title(x += tc_minutes_textbox->get_w(), y, ":"));
+ add_subwindow(tc_seconds_textbox = new BC_TextBox(x += padw, y , fldw, 1, tc_seconds));
+ add_subwindow(new BC_Title(x += tc_seconds_textbox->get_w(), y, ":"));
+ add_subwindow(tc_rest_textbox = new BC_TextBox(x += 10, y, fldw, 1, tc_rest));