X-Git-Url: https://git.cinelerra-gg.org/git/?p=goodguy%2Fcinelerra.git;a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fformattools.C;h=643655e3bcac6aabd41095a9df95fd8baac10fa9;hp=312f39c8bb218776556fb6584ec28f4c883855ec;hb=HEAD;hpb=7fd85fb66168f6b518c5f2d73e04036e87faa0e1 diff --git a/cinelerra-5.1/cinelerra/formattools.C b/cinelerra-5.1/cinelerra/formattools.C index 312f39c8..ee040f3c 100644 --- a/cinelerra-5.1/cinelerra/formattools.C +++ b/cinelerra-5.1/cinelerra/formattools.C @@ -2,6 +2,7 @@ /* * CINELERRA * Copyright (C) 2010-2013 Adam Williams + * Copyright (C) 2003-2016 Cinelerra CV contributors * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -112,6 +113,7 @@ void FormatTools::create_objects( int brender, int horizontal_layout) { + int ys10 = yS(10); int x = init_x; int y = init_y; int ylev = init_y; @@ -128,61 +130,75 @@ void FormatTools::create_objects( this->prompt_video_compression = prompt_video_compression; this->file_per_label = file_per_label; + + if(asset->format == FILE_UNKNOWN) + asset->format = FILE_FFMPEG; //printf("FormatTools::create_objects 1\n"); if(!recording) { int px = x; window->add_subwindow(path_textbox = new FormatPathText(px, y, this)); + path_textbox->context_help_set_keyword("File Format section"); px += path_textbox->get_w() + 5; path_recent = new BC_RecentList("PATH", mwindow->defaults, - path_textbox, 10, px, y, 300, 100); + path_textbox, 10, px, y, xS(300), yS(100)); window->add_subwindow(path_recent); path_recent->load_items(File::formattostr(asset->format)); + path_recent->context_help_set_keyword("File Format section"); px += path_recent->get_w(); window->add_subwindow(path_button = new BrowseButton( mwindow->theme, window, path_textbox, px, y, asset->path, _("Output to file"), _("Select a file to write to:"), 0)); + path_button->context_help_set_keyword("File Format section"); // Set w for user. - w = MAX(w, 305); - y += path_textbox->get_h() + 10; + w = MAX(w, xS(305)); + y += path_textbox->get_h() + ys10; } else { -// w = x + 305; - w = 305; +// w = x + xS(305); + w = xS(305); } x = init_x; window->add_subwindow(format_title = new BC_Title(x, y, _("File Format:"))); + format_title->context_help_set_keyword("File Format section"); x += format_title->get_w() + margin; - window->add_subwindow(format_text = new BC_TextBox(x, y, 160, 1, + window->add_subwindow(format_text = new BC_TextBox(x, y, xS(160), 1, File::formattostr(asset->format))); + format_text->context_help_set_keyword("File Format section"); x += format_text->get_w() + margin; //printf("FormatTools::create_objects %d %p\n", __LINE__, window); window->add_subwindow(format_button = new FormatFormat(x, y, this)); format_button->create_objects(); + format_button->context_help_set_keyword("File Format section"); x += format_button->get_w() + 5; - window->add_subwindow(ffmpeg_type = new FFMpegType(x, y, 70, 1, asset->fformat)); + window->add_subwindow(ffmpeg_type = new FFMpegType(x, y, xS(70), 1, asset->fformat)); FFMPEG::set_asset_format(asset, mwindow->edl, asset->fformat); + ffmpeg_type->context_help_set_keyword("File Format section"); x += ffmpeg_type->get_w(); window->add_subwindow(format_ffmpeg = new FormatFFMPEG(x, y, this)); format_ffmpeg->create_objects(); + format_ffmpeg->context_help_set_keyword("File Format section"); x = init_x; - y += format_button->get_h() + 10; + y += format_button->get_h() + ys10; if( do_audio ) { window->add_subwindow(audio_title = new BC_Title(x, y, _("Audio:"), LARGEFONT, BC_WindowBase::get_resources()->audiovideo_color)); + audio_title->context_help_set_keyword("File Format section"); x += audio_title->get_w() + margin; window->add_subwindow(aparams_button = new FormatAParams(mwindow, this, x, y)); + aparams_button->context_help_set_keyword("File Format section"); x += aparams_button->get_w() + margin; if(prompt_audio) { window->add_subwindow(audio_switch = new FormatAudio(x, y, this, asset->audio_data)); + audio_switch->context_help_set_keyword("File Format section"); } x = init_x; ylev = y; - y += aparams_button->get_h() + 10; + y += aparams_button->get_h() + ys10; //printf("FormatTools::create_objects 6\n"); aparams_thread = new FormatAThread(this); @@ -191,22 +207,25 @@ void FormatTools::create_objects( //printf("FormatTools::create_objects 7\n"); if( do_video ) { if( horizontal_layout && do_audio ) { - x += 370; + x += xS(370); y = ylev; } //printf("FormatTools::create_objects 8\n"); window->add_subwindow(video_title = new BC_Title(x, y, _("Video:"), LARGEFONT, BC_WindowBase::get_resources()->audiovideo_color)); + video_title->context_help_set_keyword("File Format section"); x += video_title->get_w() + margin; if(prompt_video_compression) { window->add_subwindow(vparams_button = new FormatVParams(mwindow, this, x, y)); + vparams_button->context_help_set_keyword("File Format section"); x += vparams_button->get_w() + margin; } //printf("FormatTools::create_objects 9\n"); if(prompt_video) { window->add_subwindow(video_switch = new FormatVideo(x, y, this, asset->video_data)); + video_switch->context_help_set_keyword("File Format section"); y += video_switch->get_h(); } else { @@ -214,7 +233,7 @@ void FormatTools::create_objects( } //printf("FormatTools::create_objects 10\n"); - y += 10; + y += ys10; vparams_thread = new FormatVThread(this); } @@ -224,7 +243,8 @@ void FormatTools::create_objects( if( file_per_label ) { labeled_files = new FormatFilePerLabel(this, x, y, file_per_label); window->add_subwindow(labeled_files); - y += labeled_files->get_h() + 10; + labeled_files->context_help_set_keyword("File Format section"); + y += labeled_files->get_h() + ys10; } //printf("FormatTools::create_objects 12\n"); @@ -375,9 +395,8 @@ void FormatTools::update_extension() extension_ptr++; } - if(*ptr1 == 0 && - *extension_ptr != 0 && - *extension_ptr != '/') + if( (!*ptr1 && (*extension_ptr && *extension_ptr != '/')) || + (*ptr1 && (!*extension_ptr || *extension_ptr == '/')) ) need_extension = 1; } @@ -386,8 +405,10 @@ void FormatTools::update_extension() if(need_extension) { char *ptr1 = ptr; - extension_ptr = asset->format != FILE_FFMPEG ? - extensions.get(0) : asset->fformat; +// change "qt" to "mov" since ffmpeg does not know qt + extension_ptr = asset->format != FILE_FFMPEG ? extensions.get(0) : + !strcmp(asset->fformat, "qt" ) || + !strcmp(asset->fformat, "pro" ) ? "mov" : asset->fformat ; while(*extension_ptr != 0 && *extension_ptr != '/') *ptr1++ = *extension_ptr++; *ptr1 = 0; @@ -443,6 +464,8 @@ void FormatTools::set_w(int w) void FormatTools::reposition_window(int &init_x, int &init_y) { + int xs10 = xS(10), xs80 = xS(80); + int ys10 = yS(10); int x = init_x; int y = init_y; @@ -450,43 +473,47 @@ void FormatTools::reposition_window(int &init_x, int &init_y) { int px = x; path_textbox->reposition_window(px, y); - px += path_textbox->get_w() + 5; + px += path_textbox->get_w() + xS(5); path_recent->reposition_window(px, y); - px += path_recent->get_w() + 8; + px += path_recent->get_w() + xS(8); path_button->reposition_window(px, y); - y += path_textbox->get_h() + 10; + y += path_textbox->get_h() + ys10; } format_title->reposition_window(x, y); - x += 90; + x += xS(90); format_text->reposition_window(x, y); x += format_text->get_w(); format_button->reposition_window(x, y); + x += format_button->get_w() + 5; + ffmpeg_type->reposition_window(x, y); + x += ffmpeg_type->get_w(); + format_ffmpeg->reposition_window(x, y); x = init_x; - y += format_button->get_h() + 10; + y += format_button->get_h() + ys10; if(do_audio) { audio_title->reposition_window(x, y); - x += 80; + x += xs80; aparams_button->reposition_window(x, y); - x += aparams_button->get_w() + 10; + x += aparams_button->get_w() + xs10; if(prompt_audio) audio_switch->reposition_window(x, y); x = init_x; - y += aparams_button->get_h() + 10; + y += aparams_button->get_h() + ys10; } if(do_video) { video_title->reposition_window(x, y); - x += 80; + x += xs80; if(prompt_video_compression) { vparams_button->reposition_window(x, y); - x += vparams_button->get_w() + 10; + x += vparams_button->get_w() + xs10; } if(prompt_video) @@ -499,13 +526,13 @@ void FormatTools::reposition_window(int &init_x, int &init_y) y += vparams_button->get_h(); } - y += 10; + y += ys10; x = init_x; } if( file_per_label ) { labeled_files->reposition_window(x, y); - y += labeled_files->get_h() + 10; + y += labeled_files->get_h() + ys10; } init_y = y; @@ -659,7 +686,7 @@ void FormatVThread::run() FormatPathText::FormatPathText(int x, int y, FormatTools *format) : BC_TextBox(x, y, format->w - x - - 2*format->mwindow->theme->get_image_set("wrench")[0]->get_w() - 20, 1, + 2*format->mwindow->theme->get_image_set("wrench")[0]->get_w() - xS(20), 1, format->asset->path) { this->format = format; @@ -740,6 +767,7 @@ int FormatFormat::handle_event() asset->video_data = File::renders_video(asset); asset->ff_audio_options[0] = 0; asset->ff_video_options[0] = 0; + asset->ff_format_options[0] = 0; format->format_text->update(selection->get_text()); if( !format->use_brender ) format->update_extension(); @@ -768,10 +796,12 @@ int FormatFFMPEG::handle_event() { BC_ListBoxItem *selection = get_selection(0, 0); if( selection ) { - char *text = get_selection(0, 0)->get_text(); + const char *text = get_selection(0, 0)->get_text(); format->ffmpeg_type->update(text); +// forces options load defaults format->asset->ff_audio_options[0] = 0; format->asset->ff_video_options[0] = 0; + format->asset->ff_format_options[0] = 0; FFMPEG::set_asset_format(format->asset, format->mwindow->edl, text); format->update_extension(); format->close_format_windows();