X-Git-Url: https://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Ffileffmpeg.C;h=beb79636a0136b43dc69646e451f7f9938d474b8;hb=4d7f82a573a67301c43189fe20d0d4aa96b2b200;hp=23e391df2b4c417c1a2ca4cf33efaa49c6ff9759;hpb=2f28632d8209ef735de1698a596bc94fa9613497;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/cinelerra/fileffmpeg.C b/cinelerra-5.1/cinelerra/fileffmpeg.C index 23e391df..beb79636 100644 --- a/cinelerra-5.1/cinelerra/fileffmpeg.C +++ b/cinelerra-5.1/cinelerra/fileffmpeg.C @@ -10,6 +10,7 @@ #include "asset.h" #include "bcwindowbase.h" #include "bitspopup.h" +#include "ctype.h" #include "ffmpeg.h" #include "filebase.h" #include "file.h" @@ -395,10 +396,12 @@ void FFMPEGConfigAudio::create_objects() FFMPEG::load_options(option_path, asset->ff_audio_options, sizeof(asset->ff_audio_options)); } + audio_options = new FFAudioOptions(this, x, y, get_w()-x-20, 10, sizeof(asset->ff_audio_options)-1, asset->ff_audio_options); audio_options->create_objects(); add_subwindow(new BC_OKButton(this)); + add_subwindow(new BC_CancelButton(this)); show_window(1); bitrate->handle_event(); @@ -407,7 +410,7 @@ void FFMPEGConfigAudio::create_objects() int FFMPEGConfigAudio::close_event() { - set_done(0); + set_done(1); return 1; } @@ -481,6 +484,7 @@ FFMPEGConfigVideo::FFMPEGConfigVideo(BC_WindowBase *parent_window, Asset *asset) FFMPEGConfigVideo::~FFMPEGConfigVideo() { + delete ff_options_dialog; lock_window("FFMPEGConfigVideo::~FFMPEGConfigVideo"); if(preset_popup) delete preset_popup; presets.remove_all_objects(); @@ -555,8 +559,9 @@ void FFMPEGConfigVideo::create_objects() video_options = new FFVideoOptions(this, x, y, get_w()-x-20, 10, sizeof(asset->ff_video_options)-1, asset->ff_video_options); video_options->create_objects(); - add_subwindow(new BC_OKButton(this)); + add_subwindow(new BC_CancelButton(this)); + show_window(1); if( asset->ff_video_bitrate ) quality->disable(); @@ -567,7 +572,7 @@ void FFMPEGConfigVideo::create_objects() int FFMPEGConfigVideo::close_event() { - set_done(0); + set_done(1); return 1; } @@ -792,7 +797,7 @@ FFOptions_Opt::~FFOptions_Opt() char *FFOptions_Opt::get(char *vp, int sz) { - char *cp = vp, *ep = vp+sz-1; + char *cp = vp; *cp = 0; if( !opt ) return cp; @@ -808,10 +813,8 @@ char *FFOptions_Opt::get(char *vp, int sz) cp = sz >= 0 ? strncpy(vp,val,sz) : strcpy(vp, val); if( sz > 0 ) vp[sz-1] = 0; av_freep(&bp); - return cp; } - *vp = 0; return cp; } @@ -1088,6 +1091,50 @@ void FFOptionsWindow::update(FFOptions_Opt *opt) panel->update(); } +void FFOptions_OptPanel::show_tip(const char *tip) +{ + if( !tip ) return; + int len = strlen(tip); + if( len > (int)sizeof(tip_text)-1 ) len = sizeof(tip_text)-1; + strncpy(tip_text,tip,len); + tip_text[len] = 0; + int line_limit = 60; + int limit2 = line_limit/2; + int limit4 = line_limit/4-2; + char *cp = tip_text, *dp = cp+len; + int n; char *bp, *ep, *pp, *sp; + while( cp < dp ) { + for( ep=cp; ep line_limit ) + n = line_limit; + // search for last punct, last space before line_limit + for( bp=cp, pp=sp=0; --n>=0 && cp= limit4 ) + cp = pp+1; + // then, on spaces + else if( sp ) { + cp = sp; + } + // last, on next space + else { + while( cppanel->set_tooltip(tip_text); + fwin->panel->show_tooltip(); +} + int FFOptions_OptPanel::selection_changed() { FFOptions_Opt *opt = 0; @@ -1097,8 +1144,7 @@ int FFOptions_OptPanel::selection_changed() opt = opt_name->opt; } fwin->update(opt); - fwin->panel->set_tooltip(!opt ? 0 : opt->tip()); - fwin->panel->show_tooltip(); + if( opt ) show_tip(opt->tip()); return 1; } @@ -1415,6 +1461,7 @@ FFOptionsAudioDialog::FFOptionsAudioDialog(FFMPEGConfigAudio *aud_config) FFOptionsAudioDialog::~FFOptionsAudioDialog() { + close_window(); } void FFOptionsAudioDialog::update_options() @@ -1429,6 +1476,7 @@ FFOptionsVideoDialog::FFOptionsVideoDialog(FFMPEGConfigVideo *vid_config) FFOptionsVideoDialog::~FFOptionsVideoDialog() { + close_window(); } void FFOptionsVideoDialog::update_options()