void tab_input_extra::set_track_mode(mmg_track_t *t) { bool not_appending = t && !t->appending; bool normal_track = t && (('a' == t->type) || ('s' == t->type) || ('v' == t->type)); wxString ctype = t ? t->ctype.Lower() : wxT(""); st_cues->Enable(not_appending && normal_track); cob_cues->Enable(not_appending && normal_track); st_compression->Enable(not_appending && normal_track); cob_compression->Enable(not_appending && normal_track); st_user_defined->Enable(normal_track); tc_user_defined->Enable(normal_track); if (t) return; bool saved_dcvn = input->dont_copy_values_now; input->dont_copy_values_now = true; set_combobox_selection(cob_cues, Z("default")); tc_user_defined->SetValue(wxEmptyString); set_combobox_selection(cob_compression, wxEmptyString); input->dont_copy_values_now = saved_dcvn; }
void tab_input_general::set_track_mode(mmg_track_t *t) { bool normal_track = t && (('a' == t->type) || ('s' == t->type) || ('v' == t->type)); bool enable = t && !t->appending && normal_track; bool enable_chapters = t && ('c' == t->type); st_language->Enable(enable || enable_chapters); cob_language->Enable(enable || enable_chapters); st_track_name->Enable(enable); tc_track_name->Enable(enable); st_tags->Enable(enable); tc_tags->Enable(enable); b_browse_tags->Enable(enable); st_timecodes->Enable(enable); tc_timecodes->Enable(enable); b_browse_timecodes->Enable(enable); st_default->Enable(enable); cob_default->Enable(enable); st_forced->Enable(enable); cob_forced->Enable(enable); if (t) return; bool saved_dcvn = input->dont_copy_values_now; input->dont_copy_values_now = true; set_combobox_selection(cob_language, sorted_iso_codes[0]); tc_track_name->SetValue(wxEmptyString); cob_default->SetSelection(0); cob_forced->SetSelection(0); tc_tags->SetValue(wxEmptyString); tc_timecodes->SetValue(wxEmptyString); input->dont_copy_values_now = saved_dcvn; }
void tab_input_format::set_track_mode(mmg_track_t *t) { char type = t ? t->type : 'n'; wxString ctype = t ? t->ctype : wxT(""); bool appending = t ? t->appending : false; bool video = ('v' == type) && !appending; bool audio_app = ('a' == type); bool subs_app = ('s' == type); bool chapters_app = ('c' == type); bool avc_es = video && (t->packetizer == wxT("mpeg4_p10_es_video")); bool avc = video && (t->packetizer == wxT("mpeg4_p10_video")); bool normal_track = video || audio_app || subs_app; auto container = t ? files[t->source]->container : FILE_TYPE_IS_UNKNOWN; ctype = ctype.Lower(); st_delay->Enable(t && normal_track); tc_delay->Enable(t && normal_track); st_stretch->Enable(t && normal_track); tc_stretch->Enable(t && normal_track); st_sub_charset->Enable(chapters_app || (subs_app && (ctype.Find(wxT("vobsub")) < 0) && (container != FILE_TYPE_MATROSKA))); cob_sub_charset->Enable(chapters_app || (subs_app && (ctype.Find(wxT("vobsub")) < 0) && (container != FILE_TYPE_MATROSKA))); st_fourcc->Enable(video); cob_fourcc->Enable(video); st_stereo_mode->Enable(video); cob_stereo_mode->Enable(video); st_fps->Enable(video); cob_fps->Enable(video); st_nalu_size_length->Enable(avc || avc_es); cob_nalu_size_length->Enable(avc || avc_es); bool ar_enabled = normal_track && t && !t->display_dimensions_selected; rb_aspect_ratio->Enable(video); cob_aspect_ratio->Enable(video && ar_enabled); rb_display_dimensions->Enable(video); tc_display_width->Enable(video && !ar_enabled); st_x->Enable(video && !ar_enabled); tc_display_height->Enable(video && !ar_enabled); st_cropping->Enable(video); tc_cropping->Enable(video); rb_aspect_ratio->SetValue(video && ar_enabled); rb_display_dimensions->SetValue(video && !ar_enabled); cb_aac_is_sbr->Enable(audio_app && ((ctype.Find(wxT("aac")) >= 0) || (ctype.Find(wxT("mp4a")) >= 0))); cb_reduce_to_core->Enable(audio_app && (ctype.Find(wxT("dts")) >= 0)); cb_fix_bitstream_timing_info->Enable(video && (avc || avc_es)); if (t) return; bool saved_dcvn = input->dont_copy_values_now; input->dont_copy_values_now = true; set_combobox_selection(cob_aspect_ratio, wxEmptyString); tc_display_width->SetValue(wxEmptyString); tc_display_height->SetValue(wxEmptyString); set_combobox_selection(cob_fourcc, wxEmptyString); set_combobox_selection(cob_fps, wxEmptyString); cob_nalu_size_length->SetSelection(0); set_combobox_selection(cob_stereo_mode, wxEmptyString); tc_delay->SetValue(wxEmptyString); tc_stretch->SetValue(wxEmptyString); cb_aac_is_sbr->SetValue(false); cb_reduce_to_core->SetValue(false); cb_fix_bitstream_timing_info->SetValue(false); input->dont_copy_values_now = saved_dcvn; }
optdlg_mmg_tab::optdlg_mmg_tab(wxWindow *parent, mmg_options_t &options) : optdlg_base_tab(parent, options) { // Create the controls. cb_autoset_output_filename = new wxCheckBox(this, ID_CB_AUTOSET_OUTPUT_FILENAME, Z("Auto-set output filename")); cb_autoset_output_filename->SetToolTip(TIP("If checked mmg will automatically set the output filename " "if it hasn't been set already. This happens when you add " "the first file. If unset mmg will not touch the output filename.")); rb_odm_input_file = new wxRadioButton(this, ID_RB_ODM_INPUT_FILE, Z("Same directory as the first input file's"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP); rb_odm_previous = new wxRadioButton(this, ID_RB_ODM_PREVIOUS, Z("Use the previous output directory")); rb_odm_fixed = new wxRadioButton(this, ID_RB_ODM_FIXED, Z("Use this directory:")); tc_output_directory = new wxTextCtrl(this, ID_TC_OUTPUT_DIRECTORY, m_options.output_directory); b_browse_output_directory = new wxButton(this, ID_B_BROWSE_OUTPUT_DIRECTORY, Z("Browse")); tc_output_directory->SetToolTip(TIP("If left empty then mmg will set the output file name to be in the same directory as the first file added to this job. " "Otherwise this directory will be used.")); cb_ask_before_overwriting = new wxCheckBox(this, ID_CB_ASK_BEFORE_OVERWRITING, Z("Ask before overwriting things (files, jobs)")); cb_ask_before_overwriting->SetToolTip(TIP("If checked mmg will ask for " "confirmation before overwriting " "existing files, or before adding " "a new job if there's an old job " "whose description matches the " "new one.")); cb_set_delay_from_filename = new wxCheckBox(this, ID_CB_SET_DELAY_FROM_FILENAME, Z("Set the delay input field from the file name")); cb_set_delay_from_filename->SetToolTip(TIP("When a file is added its name is scanned. If it contains " "the word 'DELAY' followed by a number then this number " "is automatically put into the 'delay' input field for " "any audio track found in the file.")); cb_filenew_after_add_to_jobqueue = new wxCheckBox(this, ID_CB_NEW_AFTER_ADD_TO_JOBQUEUE, Z("Clear inputs after adding a job to the job queue")); cb_filenew_after_successful_mux = new wxCheckBox(this, ID_CB_NEW_AFTER_SUCCESSFUL_MUX, Z("Clear inputs after a successful muxing run")); cb_on_top = new wxCheckBox(this, ID_CB_ON_TOP, Z("Always on top")); cb_warn_usage = new wxCheckBox(this, ID_CB_WARN_USAGE, Z("Warn about possible incorrect usage of mmg")); cb_warn_usage->SetToolTip(TIP("If checked mmg will warn if it thinks that " "you're using it incorrectly. Such warnings " "are shown at least once even if you turn " "this feature off.")); cb_disable_header_removal_compression = new wxCheckBox(this, ID_CB_DISABLE_HRC, Z("Disable header removal compression for audio and video tracks by default")); cb_disable_header_removal_compression->SetToolTip(TIP("If checked mmg will set the 'compression' drop down box to 'none' for all audio and video tracks by default. " "The user can still change the compression setting afterwards.")); #if defined(HAVE_CURL_EASY_H) cb_check_for_updates = new wxCheckBox(this, ID_CB_CHECK_FOR_UPDATES, Z("Check online for the latest release")); cb_check_for_updates->SetToolTip(TIP("Check online whether or not a new release of MKVToolNix is available on the home page. " "Will only check when mmg starts and at most once a day. " "No information is transmitted to the server.")); #endif // defined(HAVE_CURL_EASY_H) cb_gui_debugging = new wxCheckBox(this, ID_CB_GUI_DEBUGGING, Z("Show mmg's debug window")); cb_gui_debugging->SetToolTip(TIP("Shows mmg's debug window in which debug messages will appear. " "This is only useful if you're helping the author debug a problem in mmg.")); #if defined(HAVE_LIBINTL_H) wxStaticText *st_ui_language = new wxStaticText(this, -1, Z("Interface language:")); cob_ui_language = new wxMTX_COMBOBOX_TYPE(this, ID_COB_UI_LANGUAGE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_DROPDOWN | wxCB_READONLY); std::vector<translation_c>::iterator translation = translation_c::ms_available_translations.begin(); wxString select_locale; std::vector<locale_sorter_t> sorted_entries; while (translation != translation_c::ms_available_translations.end()) { wxString curr_entry = wxU(boost::format("%1% (%2%)") % translation->m_translated_name % translation->m_english_name); sorted_entries.push_back(locale_sorter_t(curr_entry, translation->get_locale())); if ( (select_locale.IsEmpty() && (translation->m_english_name == "English")) || ba::iequals(app->m_ui_locale, translation->get_locale())) select_locale = curr_entry; ++translation; } wxLogMessage(wxT("Locale selection logic: select_locale %s uu_locale_lower %s translation_c::get_default_ui_locale() %s app->m_ui_locale %s"), select_locale.c_str(), wxUCS(app->m_ui_locale), wxUCS(translation_c::get_default_ui_locale()), wxUCS(app->m_ui_locale)); std::sort(sorted_entries.begin(), sorted_entries.end()); std::vector<locale_sorter_t>::iterator locale_entry = sorted_entries.begin(); while (locale_entry != sorted_entries.end()) { cob_ui_language->Append(locale_entry->display_val); m_sorted_locales.push_back(locale_entry->locale); ++locale_entry; } #endif // HAVE_LIBINTL_H // Set the defaults. cb_autoset_output_filename->SetValue(m_options.autoset_output_filename); cb_ask_before_overwriting->SetValue(m_options.ask_before_overwriting); cb_on_top->SetValue(m_options.on_top); cb_filenew_after_add_to_jobqueue->SetValue(m_options.filenew_after_add_to_jobqueue); cb_filenew_after_successful_mux->SetValue(m_options.filenew_after_successful_mux); cb_warn_usage->SetValue(m_options.warn_usage); cb_gui_debugging->SetValue(m_options.gui_debugging); cb_set_delay_from_filename->SetValue(m_options.set_delay_from_filename); cb_disable_header_removal_compression->SetValue(m_options.disable_a_v_compression); rb_odm_input_file->SetValue(m_options.output_directory_mode == ODM_FROM_FIRST_INPUT_FILE); rb_odm_previous->SetValue(m_options.output_directory_mode == ODM_PREVIOUS); rb_odm_fixed->SetValue(m_options.output_directory_mode == ODM_FIXED); #if defined(HAVE_LIBINTL_H) set_combobox_selection(cob_ui_language, select_locale); #endif // HAVE_LIBINTL_H #if defined(HAVE_CURL_EASY_H) cb_check_for_updates->SetValue(m_options.check_for_updates); #endif // defined(HAVE_CURL_EASY_H) enable_output_filename_controls(m_options.autoset_output_filename); // Create the layout. wxBoxSizer *siz_all = new wxBoxSizer(wxVERTICAL); siz_all->AddSpacer(5); siz_all->Add(new wxStaticText(this, wxID_ANY, Z("mmg options")), 0, wxGROW | wxLEFT | wxRIGHT, 5); siz_all->AddSpacer(5); siz_all->Add(new wxStaticLine(this), 0, wxGROW | wxLEFT | wxRIGHT, 5); siz_all->AddSpacer(5); wxBoxSizer *siz_line; #if defined(HAVE_LIBINTL_H) siz_line = new wxBoxSizer(wxHORIZONTAL); siz_line->Add(st_ui_language, 0, wxALIGN_CENTER_VERTICAL); siz_line->Add(cob_ui_language, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 5); siz_all->Add(siz_line, 0, wxGROW | wxLEFT, 5); siz_all->AddSpacer(5); #endif // HAVE_LIBINTL_H siz_all->Add(cb_autoset_output_filename, 0, wxLEFT, 5); siz_all->AddSpacer(5); #if defined(SYS_WINDOWS) int left_offset = 16; #else int left_offset = 24; #endif siz_all->Add(rb_odm_input_file, 0, wxLEFT, left_offset); siz_all->AddSpacer(5); siz_all->Add(rb_odm_previous, 0, wxLEFT, left_offset); siz_all->AddSpacer(5); siz_line = new wxBoxSizer(wxHORIZONTAL); siz_line->Add(rb_odm_fixed, 0, wxALIGN_CENTER_VERTICAL, 0); siz_line->Add(tc_output_directory, 1, wxALIGN_CENTER_VERTICAL | wxLEFT, 5); siz_line->Add(b_browse_output_directory, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5); siz_all->Add(siz_line, 0, wxGROW | wxLEFT, left_offset); siz_all->AddSpacer(5); siz_all->Add(cb_ask_before_overwriting, 0, wxLEFT, 5); siz_all->AddSpacer(5); siz_all->Add(cb_set_delay_from_filename, 0, wxLEFT, 5); siz_all->AddSpacer(5); siz_all->Add(cb_filenew_after_add_to_jobqueue, 0, wxLEFT, 5); siz_all->AddSpacer(5); siz_all->Add(cb_filenew_after_successful_mux, 0, wxLEFT, 5); siz_all->AddSpacer(5); #if defined(SYS_WINDOWS) siz_all->Add(cb_on_top, 0, wxLEFT, 5); siz_all->AddSpacer(5); #else cb_on_top->Show(false); #endif siz_all->Add(cb_warn_usage, 0, wxLEFT, 5); siz_all->AddSpacer(5); siz_all->Add(cb_disable_header_removal_compression, 0, wxLEFT, 5); siz_all->AddSpacer(5); #if defined(HAVE_CURL_EASY_H) siz_all->Add(cb_check_for_updates, 0, wxLEFT, 5); siz_all->AddSpacer(5); #endif // defined(HAVE_CURL_EASY_H) siz_all->Add(cb_gui_debugging, 0, wxLEFT, 5); siz_all->AddSpacer(5); SetSizer(siz_all); }