From 541a1a480c131997178d482d7eb0b1f7f33d90ba Mon Sep 17 00:00:00 2001 From: jstebbins Date: Tue, 29 Jun 2010 00:15:59 +0000 Subject: [PATCH] LinGui: improvements to maxWidth/maxHeight preset gui Add checkbox for each of max width/height entries in the presets save dialog. When not checked, the value is not stored to the preset. If neither is checked, UsesPictureSettings=2 is assumed. If either is checked, UsesPictureSettings=1 is assumed. git-svn-id: svn://localhost/HandBrake/trunk@3420 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- gtk/src/ghb.ui | 293 +++++++++++++++++++++++++++++++++++++++++----------- gtk/src/makedeps.py | 3 +- gtk/src/presets.c | 44 ++++++-- 3 files changed, 270 insertions(+), 70 deletions(-) diff --git a/gtk/src/ghb.ui b/gtk/src/ghb.ui index d1019dea..118afa4b 100644 --- a/gtk/src/ghb.ui +++ b/gtk/src/ghb.ui @@ -4666,6 +4666,147 @@ no-fast-pskip=0:no-dct-decimate=0:cabac=1 tweak_ok + + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 5 + True + GTK_WIN_POS_CENTER_ON_PARENT + GDK_WINDOW_TYPE_HINT_DIALOG + False + + + + vertical + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 2 + + + vertical + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Folder Name: + 0 + + + False + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 40 + True + 30 + True + + + 1 + + + + + False + 0 + 10 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + GTK_SHADOW_ETCHED_OUT + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 6 + 4 + 12 + 4 + + + 60 + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + GTK_WRAP_WORD + False + + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + <b>Description</b> + True + + + + + 10 + 2 + + + + + 1 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + GTK_BUTTONBOX_END + + + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-cancel + True + + + + + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-ok + True + + + 1 + + + + + False + GTK_PACK_END + + + + + + preset_folder_cancel + preset_folder_ok + + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 5 @@ -4722,86 +4863,112 @@ no-fast-pskip=0:no-dct-decimate=0:cabac=1 - - vertical + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - + 3 + 3 True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - <b>Using Current Picture Settings</b> + <b>Custom Picture Dimensions</b> 0 True - False - 0 + 0 + 1 + 0 + 3 - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 4 - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Max Width: - 0 - - - False - 0 - - - - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - This is the maximum width that the video will be stored at. Whenever a new source is loaded, this value will be applied if the source width is greater. Setting this to 0 means there is no maximum width. - adjustment32 - True - - - - False - 1 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Max Height: - 1 - - - False - 2 - - - - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - This is the maximum height that the video will be stored at. Whenever a new source is loaded, this value will be applied if the source height is greater. Setting this to 0 means there is no maximum height. - adjustment33 - - - - False - 3 - - + + 0 + + + 1 + 2 + 2 + 3 + GTK_EXPAND + + + + + Maximum Width: + True + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Enable maximum width limit. + True + + + + 1 + 2 + 0 + 1 + GTK_FILL + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + This is the maximum width that the video will be stored at. Whenever a new source is loaded, this value will be applied if the source width is greater. Setting this to 0 means there is no maximum width. + adjustment32 + True + + + + 1 + 2 + 1 + 2 + + + + + + Maximum Height: + True + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Enable maximum height limit. + True + + + + 2 + 3 + 0 + 1 + GTK_FILL + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + This is the maximum height that the video will be stored at. Whenever a new source is loaded, this value will be applied if the source height is greater. Setting this to 0 means there is no maximum height. + adjustment33 + - False - 1 + 2 + 3 + 1 + 2 + diff --git a/gtk/src/makedeps.py b/gtk/src/makedeps.py index 594b22fa..75147503 100644 --- a/gtk/src/makedeps.py +++ b/gtk/src/makedeps.py @@ -40,7 +40,8 @@ dep_map = ( DepEntry("PictureDenoise", "PictureDenoiseCustom", "custom", False, True), DepEntry("PictureDecomb", "PictureDecombCustom", "custom", False, True), DepEntry("PictureDetelecine", "PictureDetelecineCustom", "custom", False, True), - DepEntry("autoscale", "PicturePresetBox", "FALSE", False, True), + DepEntry("PictureWidthEnable", "PictureWidth", "TRUE", False, False), + DepEntry("PictureHeightEnable", "PictureHeight", "TRUE", False, False), DepEntry("PictureAutoCrop", "PictureTopCrop", "FALSE", False, False), DepEntry("PictureAutoCrop", "PictureBottomCrop", "FALSE", False, False), DepEntry("PictureAutoCrop", "PictureLeftCrop", "FALSE", False, False), diff --git a/gtk/src/presets.c b/gtk/src/presets.c index 40329de1..1946f0ba 100644 --- a/gtk/src/presets.c +++ b/gtk/src/presets.c @@ -3157,6 +3157,20 @@ settings_save(signal_user_data_t *ud, const GValue *path) ghb_boolean_value_new(FALSE)); presets_list_insert(ud, indices, len); } + if (!ghb_settings_get_boolean( ud->settings, "PictureWidthEnable")) + { + ghb_dict_remove(dict, "PictureWidth"); + } + if (!ghb_settings_get_boolean( ud->settings, "PictureHeightEnable")) + { + ghb_dict_remove(dict, "PictureHeight"); + } + ghb_dict_insert(dict, g_strdup("autoscale"), + ghb_boolean_value_new( + !ghb_settings_get_boolean( ud->settings, "PictureWidthEnable") && + !ghb_settings_get_boolean( ud->settings, "PictureHeightEnable") + ) + ); store_presets(); ud->dont_clear_presets = TRUE; // Make the new preset the selected item @@ -3541,7 +3555,7 @@ presets_new_folder_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) const gchar *description = ""; gint count, *indices, len; - g_debug("presets_save_clicked_cb ()"); + g_debug("presets_new_folder_clicked_cb ()"); preset = ghb_settings_get_value (ud->settings, "preset_selection"); count = ghb_array_len(preset); @@ -3556,12 +3570,12 @@ presets_new_folder_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) { description = g_value_get_string( ghb_dict_lookup(dict, "PresetDescription")); - ghb_ui_update(ud, "PresetDescription", ghb_string_value(description)); + ghb_ui_update(ud, "FolderDescription", ghb_string_value(description)); } - desc = GTK_TEXT_VIEW(GHB_WIDGET(ud->builder, "PresetDescription")); - dialog = GHB_WIDGET(ud->builder, "preset_save_dialog"); - entry = GTK_ENTRY(GHB_WIDGET(ud->builder, "PresetName")); + desc = GTK_TEXT_VIEW(GHB_WIDGET(ud->builder, "FolderDescription")); + dialog = GHB_WIDGET(ud->builder, "preset_new_folder_dialog"); + entry = GTK_ENTRY(GHB_WIDGET(ud->builder, "FolderName")); gtk_entry_set_text(entry, name); response = gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_hide(dialog); @@ -3586,7 +3600,8 @@ presets_new_folder_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) } } ghb_array_append(dest, ghb_string_value_new(name)); - ghb_widget_to_setting(ud->settings, GTK_WIDGET(desc)); + GValue *val = ghb_widget_value(GTK_WIDGET(desc)); + ghb_settings_set_value(ud->settings, "PresetDescription", val); folder_save(ud, dest); ghb_value_free(dest); } @@ -3615,6 +3630,23 @@ presets_save_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) count = 1; desc = GTK_TEXT_VIEW(GHB_WIDGET(ud->builder, "PresetDescription")); + int width = ghb_settings_get_int(ud->settings, "PictureWidth"); + int height = ghb_settings_get_int(ud->settings, "PictureHeight"); + gboolean autoscale = ghb_settings_get_boolean(ud->settings, "autoscale"); + ghb_ui_update(ud, "PictureWidthEnable", + ghb_boolean_value(width!=0&&!autoscale)); + ghb_ui_update(ud, "PictureHeightEnable", + ghb_boolean_value(height!=0&&!autoscale)); + if (!width) + { + width = ghb_settings_get_int(ud->settings, "scale_width"); + ghb_ui_update(ud, "PictureWidth", ghb_int_value(width)); + } + if (!height) + { + height = ghb_settings_get_int(ud->settings, "scale_height"); + ghb_ui_update(ud, "PictureHeight", ghb_int_value(height)); + } dialog = GHB_WIDGET(ud->builder, "preset_save_dialog"); entry = GTK_ENTRY(GHB_WIDGET(ud->builder, "PresetName")); gtk_entry_set_text(entry, name); -- 2.11.0