X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=gtk%2Fsrc%2Fsubtitlehandler.c;h=a7f06712adae94662b1a4e7d8a521276235b8b3c;hb=fa148e2e3a3d2e89bcc482999f3442b2dc454bf5;hp=759caae21a93f3da6f536da901e6a32ca76ccef8;hpb=69a64f08c12c762576ee5afd9fdb460424cf4ed7;p=handbrake-jp%2Fhandbrake-jp-git.git diff --git a/gtk/src/subtitlehandler.c b/gtk/src/subtitlehandler.c index 759caae2..a7f06712 100644 --- a/gtk/src/subtitlehandler.c +++ b/gtk/src/subtitlehandler.c @@ -41,15 +41,6 @@ free_subtitle_key(gpointer data) static gboolean mustBurn(signal_user_data_t *ud, GValue *settings) { - if (ghb_settings_combo_int(ud->settings, "FileFormat") == HB_MUX_MP4) - { - // MP4 can only handle burned vobsubs. make sure there isn't - // already something burned in the list - if (ghb_settings_get_int(settings, "SubtitleSource") == VOBSUB) - { - return TRUE; - } - } return FALSE; } @@ -552,6 +543,7 @@ subtitle_burned_toggled_cb( GValue *subtitle_list; gint count; GValue *settings; + gint source; g_debug("burned toggled"); tp = gtk_tree_path_new_from_string (path); @@ -574,12 +566,21 @@ subtitle_burned_toggled_cb( return; settings = ghb_array_get_nth(subtitle_list, row); + source = ghb_settings_get_int(settings, "SubtitleSource"); + if (source != VOBSUB) + return; if (!active && mustBurn(ud, settings)) return; ghb_settings_set_boolean(settings, "SubtitleBurned", active); - gtk_list_store_set(GTK_LIST_STORE(tm), &ti, 2, active, -1); + + if (active) + { + ghb_settings_set_boolean(settings, "SubtitleDefaultTrack", !active); + gtk_list_store_set(GTK_LIST_STORE(tm), &ti, 3, !active, -1); + } + // Unburn the rest if (active) ghb_subtitle_exclusive_burn(ud, row); @@ -625,37 +626,20 @@ subtitle_default_toggled_cb( return; settings = ghb_array_get_nth(subtitle_list, row); + if (active && mustBurn(ud, settings)) + return; ghb_settings_set_boolean(settings, "SubtitleDefaultTrack", active); - gtk_list_store_set(GTK_LIST_STORE(tm), &ti, 3, active, -1); - // allow only one default - ghb_subtitle_exclusive_default(ud, row); - ghb_live_reset(ud); -} - -static const char* -subtitle_source_name(gint source) -{ - const gchar * name; - switch (source) + if (active) { - case VOBSUB: - name = "Bitmap"; - break; - case CC708SUB: - case CC608SUB: - name = "Text"; - break; - case SRTSUB: - name = "SRT"; - break; - default: - name = "Unknown"; - break; + ghb_settings_set_boolean(settings, "SubtitleBurned", !active); + gtk_list_store_set(GTK_LIST_STORE(tm), &ti, 2, !active, -1); } - return name; + // allow only one default + ghb_subtitle_exclusive_default(ud, row); + ghb_live_reset(ud); } static void @@ -670,6 +654,7 @@ subtitle_list_refresh_selected(signal_user_data_t *ud) gint row; GValue *settings = NULL; const GValue *subtitle_list; + gboolean allow_burn_force = FALSE; g_debug("subtitle_list_refresh_selected ()"); treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list")); @@ -712,8 +697,6 @@ subtitle_list_refresh_selected(signal_user_data_t *ud) lang = ghb_settings_combo_option(settings, "SrtLanguage"); code = ghb_settings_get_string(settings, "SrtCodeset"); - track = g_strdup_printf("%s (%s)", lang, code); - g_free(code); s_track = ghb_settings_get_string(settings, "SrtFile"); if (g_file_test(s_track, G_FILE_TEST_IS_REGULAR)) @@ -721,13 +704,16 @@ subtitle_list_refresh_selected(signal_user_data_t *ud) gchar *basename; basename = g_path_get_basename(s_track); + track = g_strdup_printf("%s (%s)(SRT)(%s)", lang, code, basename); source = g_strdup_printf("SRT (%s)", basename); g_free(basename); } else { + track = g_strdup_printf("%s (%s)(SRT)", lang, code); source = g_strdup_printf("SRT (none)"); } + g_free(code); offset = ghb_settings_get_int(settings, "SrtOffset"); forced = FALSE; @@ -737,24 +723,29 @@ subtitle_list_refresh_selected(signal_user_data_t *ud) { track = g_strdup( ghb_settings_combo_option(settings, "SubtitleTrack")); - source = g_strdup(subtitle_source_name(i_source)); + source = g_strdup(ghb_subtitle_source_name(i_source)); s_track = ghb_settings_get_string(settings, "SubtitleTrack"); forced = ghb_settings_get_boolean(settings, "SubtitleForced"); burned = ghb_settings_get_boolean(settings, "SubtitleBurned"); } + if (i_source == VOBSUB) + allow_burn_force = TRUE; + + gtk_list_store_set(GTK_LIST_STORE(store), &iter, // These are displayed in list 0, track, 1, forced, 2, burned, 3, def, - 4, source, - 5, offset, + 4, offset, // These are used to set combo box values when a list item is selected - 6, s_track, - 7, i_source, + 5, s_track, + 6, i_source, + 7, allow_burn_force, + 8, allow_burn_force, -1); g_free(track); g_free(source); @@ -901,6 +892,7 @@ add_to_subtitle_list( gboolean forced, burned, def; gchar *s_track; gint i_source; + gboolean allow_burn_force = FALSE; g_debug("add_to_subtitle_list ()"); treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list")); @@ -914,7 +906,10 @@ add_to_subtitle_list( s_track = ghb_settings_get_string(settings, "SubtitleTrack"); i_source = ghb_settings_get_int(settings, "SubtitleSource"); - source = subtitle_source_name(i_source); + source = ghb_subtitle_source_name(i_source); + + if (i_source == VOBSUB) + allow_burn_force = TRUE; gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, @@ -923,13 +918,12 @@ add_to_subtitle_list( 1, forced, 2, burned, 3, def, - 4, source, // These are used to set combo box values when a list item is selected - 6, s_track, - 7, i_source, - 8, TRUE, - 9, TRUE, - 10, FALSE, + 5, s_track, + 6, i_source, + 7, allow_burn_force, + 8, allow_burn_force, + 9, FALSE, -1); gtk_tree_selection_select_iter(selection, &iter); g_free(s_track); @@ -956,7 +950,6 @@ add_to_srt_list( lang = ghb_settings_combo_option(settings, "SrtLanguage"); code = ghb_settings_get_string(settings, "SrtCodeset"); - track = g_strdup_printf("%s (%s)", lang, code); forced = FALSE; burned = FALSE; def = ghb_settings_get_boolean(settings, "SubtitleDefaultTrack"); @@ -967,11 +960,13 @@ add_to_srt_list( gchar *basename; basename = g_path_get_basename(filename); + track = g_strdup_printf("%s (%s)(SRT)(%s)", lang, code, basename); source = g_strdup_printf("SRT (%s)", basename); g_free(basename); } else { + track = g_strdup_printf("%s (%s)(SRT)", lang, code); source = g_strdup_printf("SRT (none)"); } i_source = SRTSUB; @@ -984,14 +979,13 @@ add_to_srt_list( 1, forced, 2, burned, 3, def, - 4, source, - 5, offset, + 4, offset, // These are used to set combo box values when a list item is selected - 6, filename, - 7, i_source, + 5, filename, + 6, i_source, + 7, FALSE, 8, FALSE, - 9, FALSE, - 10, TRUE, + 9, TRUE, -1); gtk_tree_selection_select_iter(selection, &iter); g_free(code); @@ -1130,13 +1124,15 @@ srt_add_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) { // Add the current subtitle settings to the list. GValue *settings; - gchar *dir, *filename; + gchar *dir, *filename, *lang; g_debug("subtitle_add_clicked_cb ()"); settings = ghb_dict_value_new(); ghb_settings_set_int(settings, "SubtitleSource", SRTSUB); - ghb_settings_set_string(settings, "SrtLanguage", "und"); + lang = ghb_settings_get_string(ud->settings, "PreferredLanguage"); + ghb_settings_set_string(settings, "SrtLanguage", lang); + g_free(lang); ghb_settings_set_string(settings, "SrtCodeset", "UTF-8"); dir = ghb_settings_get_string(ud->settings, "SrtDir");