X-Git-Url: https://git.cinelerra-gg.org/git/?p=goodguy%2Fcinelerra.git;a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fassetedit.C;h=e603ad8cabba5eaa0aad4fd5060c86252a70258a;hp=c8ff4a9f025325d76aee5ea98880924239650139;hb=c9c0e07706fad701a70ee0d1ffb0fcb6304f138c;hpb=0df48ad2d876409c5beeae2e21933a728ea76c33 diff --git a/cinelerra-5.1/cinelerra/assetedit.C b/cinelerra-5.1/cinelerra/assetedit.C index c8ff4a9f..e603ad8c 100644 --- a/cinelerra-5.1/cinelerra/assetedit.C +++ b/cinelerra-5.1/cinelerra/assetedit.C @@ -104,6 +104,14 @@ void AssetEdit::edit_asset(Indexable *indexable, int x, int y) void AssetEdit::handle_done_event(int result) { + if( !result && changed_params->timecode >= 0 ) { + double rate = indexable->get_frame_rate(); + changed_params->timecode = + atoi(window->tc_hrs->get_text()) * 3600 + + atoi(window->tc_mins->get_text()) * 60 + + atoi(window->tc_secs->get_text()) + + atoi(window->tc_rest->get_text()) / rate; + } } void AssetEdit::handle_close_event(int result) @@ -133,7 +141,7 @@ void AssetEdit::handle_close_event(int result) // Omit index status from copy since an index rebuild may have been // happening when new_asset was created but not be happening anymore. if( asset ) { - mwindow->remove_asset_from_caches(asset); + mwindow->remove_from_caches(asset); //printf("AssetEdit::handle_close_event %d %f\n", __LINE__, asset->get_frame_rate()); asset->copy_from(changed_params, 0); //printf("AssetEdit::handle_close_event %d %d %d\n", __LINE__, changed_params->bits, asset->bits); @@ -159,7 +167,7 @@ void AssetEdit::handle_close_event(int result) indexable->path); remove_file(index_filename); indexable->index_state->index_status = INDEX_NOTTESTED; - mwindow->mainindexes->add_next_asset(0, indexable); + mwindow->mainindexes->add_indexable(indexable); mwindow->mainindexes->start_build(); } mwindow->gui->unlock_window(); @@ -187,14 +195,16 @@ BC_Window* AssetEdit::new_gui() int AssetEdit::window_height() { - int h = 128 + 64; - if( indexable->have_audio() ) h += 200; + int h = yS(128 + 64); + if( indexable->have_audio() ) h += yS(200); if( indexable->have_video() ) { - h += 160; + h += yS(160); if( indexable->is_asset ) { Asset *asset = (Asset *)indexable; if( File::can_scale_input(asset) ) - h += 42; + h += yS(42); + if( asset->timecode >= 0 ) + h += yS(32); } } return yS(h); @@ -516,8 +526,35 @@ void AssetEditWindow::create_objects() &asset_edit->changed_params->interlace_mode, (ArrayList*)&mwindow->interlace_asset_modes, x2 + edit_ilace_mode->get_w(), y)); + y += title->get_h() + yS(15); } } + if( asset && asset->timecode >= 0 ) { + char text[BCSTRLEN], *tc = text; + Units::totext(tc, asset->timecode, TIME_HMSF, + asset->sample_rate, asset->frame_rate); + const char *hrs = tc; tc = strchr(tc, ':'); *tc++ = 0; + const char *mins = tc; tc = strchr(tc, ':'); *tc++ = 0; + const char *secs = tc; tc = strchr(tc, ':'); *tc++ = 0; + const char *rest = tc; + int padw = BC_Title::calculate_w(this, ":", MEDIUMFONT); + int fldw = BC_Title::calculate_w(this, "00", MEDIUMFONT) + 5; + int hdrw = fldw + padw; x = x2; + add_subwindow(title = new BC_Title(x, y, _("hour"), SMALLFONT)); x += hdrw; + add_subwindow(title = new BC_Title(x, y, _("min"), SMALLFONT)); x += hdrw; + add_subwindow(title = new BC_Title(x, y, _("sec"), SMALLFONT)); x += hdrw; + add_subwindow(title = new BC_Title(x, y, _("frms"), SMALLFONT)); + y += title->get_h() + xS(3); + add_subwindow(title = new BC_Title(x1, y, _("Time Code Start:"))); + add_subwindow(tc_hrs = new BC_TextBox(x=x2, y, fldw, 1, hrs)); + add_subwindow(new BC_Title(x += tc_hrs->get_w(), y, ":")); + add_subwindow(tc_mins = new BC_TextBox(x += padw, y, fldw, 1, mins)); + add_subwindow(new BC_Title(x += tc_mins->get_w(), y, ":")); + add_subwindow(tc_secs = new BC_TextBox(x += padw, y , fldw, 1, secs)); + add_subwindow(new BC_Title(x += tc_secs->get_w(), y, ":")); + add_subwindow(tc_rest = new BC_TextBox(x += 10, y, fldw, 1, rest)); + y += title->get_h() + ypad5; + } add_subwindow(new BC_OKButton(this)); add_subwindow(new BC_CancelButton(this));