X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fassetedit.C;h=27a5a8db5ed72defb95f0d5a34dde1c391df099f;hb=af2d680fc71d16363f7f7fb7e602cb0c30015ee5;hp=9d3e6869b3cec69fbc4bd5e36514250dbacee221;hpb=30bdb85eb33a8ee7ba675038a86c6be59c43d7bd;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/cinelerra/assetedit.C b/cinelerra-5.1/cinelerra/assetedit.C index 9d3e6869..27a5a8db 100644 --- a/cinelerra-5.1/cinelerra/assetedit.C +++ b/cinelerra-5.1/cinelerra/assetedit.C @@ -95,19 +95,30 @@ void AssetEdit::edit_asset(Indexable *indexable) { EDL *nested_edl = (EDL*)indexable; - strcpy(changed_params->path, nested_edl->path); + strcpy(changed_params->path, nested_edl->path); changed_params->sample_rate = nested_edl->session->sample_rate; - changed_params->channels = nested_edl->session->audio_channels; + changed_params->channels = nested_edl->session->audio_channels; //printf("AssetEdit::edit_asset %d %f\n", __LINE__, nested_edl->session->frame_rate); changed_params->frame_rate = nested_edl->session->frame_rate; - changed_params->width = nested_edl->session->output_w; - changed_params->height = nested_edl->session->output_h; + changed_params->width = nested_edl->session->output_w; + changed_params->height = nested_edl->session->output_h; } BC_DialogThread::start(); } +void AssetEdit::handle_done_event(int result) +{ + if( !result ) { + changed_params->tcstart = ceil(indexable->get_frame_rate() * + (atoi(window->tc_hours_textbox->get_text()) * 3600 + + atoi(window->tc_minutes_textbox->get_text()) * 60 + + atoi(window->tc_seconds_textbox->get_text()))) + + atoi(window->tc_rest_textbox->get_text()); + } +} + void AssetEdit::handle_close_event(int result) { if(!result) @@ -119,7 +130,7 @@ void AssetEdit::handle_close_event(int result) if(indexable->is_asset) { asset = (Asset*)indexable; - if(!changed_params->equivalent(*asset, 1, 1)) + if(!changed_params->equivalent(*asset, 1, 1, mwindow->edl)) changed = 1; } else @@ -143,7 +154,7 @@ void AssetEdit::handle_close_event(int result) // happening when new_asset was created but not be happening anymore. if(asset) { - mwindow->remove_asset_from_caches(asset); + mwindow->remove_asset_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); @@ -216,7 +227,7 @@ AssetEditWindow::AssetEditWindow(MWindow *mwindow, AssetEdit *asset_edit) mwindow->gui->get_abs_cursor_y(1) - (128 + 64 + (!asset_edit->indexable->have_audio() ? 0 : 180) + (!asset_edit->indexable->have_video() ? 0 : 350)) / 2, - 400, (128 + 64 + + 450, (128 + 64 + (!asset_edit->indexable->have_audio() ? 0 : 180) + (!asset_edit->indexable->have_video() ? 0 : 350)), 0, 0, 1) { @@ -248,7 +259,7 @@ AssetEditWindow::~AssetEditWindow() void AssetEditWindow::create_objects() { - int y = 10, x = 10, x1 = 10, x2 = 160; + int y = 10, x = 10, x1 = 10, x2 = 190; char string[BCTEXTLEN]; int vmargin; FileSystem fs; @@ -506,7 +517,7 @@ void AssetEditWindow::create_objects() add_subwindow(new BC_Title(x, y, _("Frame rate:"))); x = x2; - sprintf(string, "%.2f", asset_edit->changed_params->frame_rate); + sprintf(string, "%.4f", asset_edit->changed_params->frame_rate); //printf("AssetEditWindow::create_objects %d %f\n", __LINE__, asset_edit->changed_params->frame_rate); if(asset) @@ -566,11 +577,11 @@ void AssetEditWindow::create_objects() y += ilacefixoption_chkboxw->get_h() + 5; // -------------------- add_subwindow(title = new BC_Title(x1, y, _("Asset's interlacing:"))); - add_subwindow(textboxw = new AssetEditILacemode(this, "", BC_ILACE_ASSET_MODEDEFAULT, x2, y, 200)); + add_subwindow(textboxw = new AssetEditILacemode(this, "", ILACE_ASSET_MODEDEFAULT, x2, y, 200)); ilacefixoption_chkboxw->ilacemode_textbox = textboxw; add_subwindow(listboxw = new AssetEditInterlacemodePulldown(mwindow, textboxw, - &asset->interlace_mode, + &asset_edit->changed_params->interlace_mode, (ArrayList*)&mwindow->interlace_asset_modes, ilacefixoption_chkboxw, x2 + textboxw->get_w(), @@ -580,11 +591,11 @@ void AssetEditWindow::create_objects() // -------------------- add_subwindow(title = new BC_Title(x1, y, _("Interlace correction:"))); - add_subwindow(textboxw = new AssetEditILacefixmethod(this, "", BC_ILACE_FIXDEFAULT, x2, y, 200)); + add_subwindow(textboxw = new AssetEditILacefixmethod(this, "", ILACE_FIXDEFAULT, x2, y, 200)); ilacefixoption_chkboxw->ilacefixmethod_textbox = textboxw; add_subwindow(listboxw = new InterlacefixmethodPulldown(mwindow, textboxw, - &asset->interlace_fixmethod, + &asset_edit->changed_params->interlace_fixmethod, (ArrayList*)&mwindow->interlace_asset_fixmethods, x2 + textboxw->get_w(), y)); @@ -609,39 +620,27 @@ void AssetEditWindow::create_objects() x = x2; // Calculate values to enter into textboxes - 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; + if( asset ) + Units::totext(tc, asset->tcstart / asset->frame_rate, + TIME_HMSF, asset->sample_rate, asset->frame_rate); + else + strcpy(tc, "0:00:00:00"); + + 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)); y += 30; } @@ -708,7 +707,7 @@ int AssetEditFRate::handle_event() Interlaceautofix::Interlaceautofix(MWindow *mwindow,AssetEditWindow *fwindow, int x, int y) : BC_CheckBox(x, y, - ((Asset *)fwindow->asset_edit->indexable)->interlace_autofixoption, + fwindow->asset_edit->changed_params->interlace_autofixoption, _("Automatically Fix Interlacing")) { this->fwindow = fwindow; @@ -721,7 +720,7 @@ Interlaceautofix::~Interlaceautofix() int Interlaceautofix::handle_event() { - Asset *asset = (Asset *)fwindow->asset_edit->indexable; + Asset *asset = fwindow->asset_edit->changed_params; asset->interlace_autofixoption = get_value(); showhideotherwidgets(); return 1; @@ -731,8 +730,8 @@ void Interlaceautofix::showhideotherwidgets() { int thevalue = get_value(); - Asset *asset = (Asset *)fwindow->asset_edit->indexable; - if (thevalue == BC_ILACE_AUTOFIXOPTION_AUTO) + Asset *asset = fwindow->asset_edit->changed_params; + if (thevalue == ILACE_AUTOFIXOPTION_AUTO) { this->ilacemode_textbox->enable(); this->ilacemode_listbox->enable(); @@ -742,7 +741,7 @@ void Interlaceautofix::showhideotherwidgets() ilacefixmethod_to_text(string,xx); this->ilacefixmethod_textbox->update(string); } - if (thevalue == BC_ILACE_AUTOFIXOPTION_MANUAL) + if (thevalue == ILACE_AUTOFIXOPTION_MANUAL) { this->ilacemode_textbox->disable(); this->ilacemode_listbox->disable(); @@ -792,7 +791,7 @@ AssetEditILaceautofixoption::AssetEditILaceautofixoption(AssetEditWindow *fwindo int AssetEditILaceautofixoption::handle_event() { - Asset *asset = (Asset *)fwindow->asset_edit->indexable; + Asset *asset = fwindow->asset_edit->changed_params; asset->interlace_autofixoption = ilaceautofixoption_from_text(get_text(), this->thedefault); return 1; } @@ -807,7 +806,7 @@ AssetEditILacemode::AssetEditILacemode(AssetEditWindow *fwindow, const char *tex int AssetEditILacemode::handle_event() { - Asset *asset = (Asset *)fwindow->asset_edit->indexable; + Asset *asset = fwindow->asset_edit->changed_params; asset->interlace_mode = ilacemode_from_text(get_text(),this->thedefault); return 1; } @@ -954,7 +953,7 @@ int AssetEditPathText::handle_event() AssetEditPath::AssetEditPath(MWindow *mwindow, AssetEditWindow *fwindow, BC_TextBox *textbox, int y, const char *text, const char *window_title, const char *window_caption) - : BrowseButton(mwindow, fwindow, textbox, 310, y, text, + : BrowseButton(mwindow->theme, fwindow, textbox, 310, y, text, window_title, window_caption, 0) { this->fwindow = fwindow; @@ -1040,8 +1039,8 @@ void DetailAssetThread::stop() dwindow->lock_window("DetailAssetThread::stop"); dwindow->set_done(1); dwindow->unlock_window(); - Thread::join(); } + Thread::join(); } void DetailAssetWindow::create_objects() @@ -1090,8 +1089,7 @@ void DetailAssetThread::run() AssetEditReelName::AssetEditReelName(AssetEditWindow *fwindow, int x, int y) - : BC_TextBox(x, y, 300, 1, - ((Asset *)fwindow->asset_edit->indexable)->reel_name, + : BC_TextBox(x, y, 220, 1, fwindow->asset_edit->changed_params->reel_name, 1, MEDIUMFONT, 1) { this->fwindow = fwindow; @@ -1111,7 +1109,7 @@ int AssetEditReelName::handle_event() AssetEditReelNumber::AssetEditReelNumber(AssetEditWindow *fwindow, int x, int y) - : BC_TextBox(x, y, 200, 1, ((Asset *)fwindow->asset_edit->indexable)->reel_number) + : BC_TextBox(x, y, 200, 1, fwindow->asset_edit->changed_params->reel_number) { this->fwindow = fwindow; } @@ -1127,25 +1125,3 @@ int AssetEditReelNumber::handle_event() - - -AssetEditTCStartTextBox::AssetEditTCStartTextBox(AssetEditWindow *fwindow, int value, int x, int y, int multiplier) - : BC_TextBox(x, y, 30, 1, value) -{ - this->fwindow = fwindow; - this->multiplier = multiplier; - previous = value; -} -AssetEditTCStartTextBox::~AssetEditTCStartTextBox() -{ -} -int AssetEditTCStartTextBox::handle_event() -{ - Asset *asset = fwindow->asset_edit->changed_params; - asset->tcstart -= previous * multiplier; - asset->tcstart += atoi(get_text()) * multiplier; - previous = atoi(get_text()); - return 1; -} - -