Exemplo n.º 1
0
        private void WindowKeyDown(object sender, KeyEventArgs e)
        {
            if (numl.txt_box.IsFocused || numt.txt_box.IsFocused || numr.txt_box.IsFocused || numb.txt_box.IsFocused)
            {
                return;
            }
            string key         = new System.Windows.Input.KeyConverter().ConvertToString(e.Key);
            string mod         = new System.Windows.Input.ModifierKeysConverter().ConvertToString(System.Windows.Input.Keyboard.Modifiers);
            string PressedKeys = "=" + ((mod.Length > 0) ? mod + "+" : "") + key;

            string Action = HotKeys.GetAction(PressedKeys);

            e.Handled = (Action.Length > 0);

            switch (Action)
            {
            case ("Frame forward"): Frame_Shift(1); break;

            case ("Frame back"): Frame_Shift(-1); break;

            case ("10 frames forward"): Frame_Shift(10); break;

            case ("10 frames backward"): Frame_Shift(-10); break;

            case ("100 frames forward"): Frame_Shift(100); break;

            case ("100 frames backward"): Frame_Shift(-100); break;

            case ("30 sec. forward"): Frame_Shift(Convert.ToInt32(fps * 30)); break;

            case ("30 sec. backward"): Frame_Shift(-Convert.ToInt32(fps * 30)); break;

            case ("3 min. forward"): Frame_Shift(Convert.ToInt32(fps * 180)); break;

            case ("3 min. backward"): Frame_Shift(-Convert.ToInt32(fps * 180)); break;

            case ("Fullscreen"): button_fullscreen_Click(null, null); break;
            }
        }
Exemplo n.º 2
0
        private ArrayList raw_action = new ArrayList(); //Action, не переведенные

        public Settings_Window(MainWindow parent, int set_focus_to)
        {
            this.InitializeComponent();
            this.Owner = this.p = parent;

            //переводим
            button_ok.Content                      = Languages.Translate("OK");
            Title                                  = Languages.Translate("Settings") + ":";
            check_x264_psnr.ToolTip                = Languages.Translate("Show x264 PSNR info");
            check_x264_ssim.ToolTip                = Languages.Translate("Show x264 SSIM info");
            check_x265_psnr.ToolTip                = check_x264_psnr.ToolTip.ToString().Replace("x264", "x265");
            check_x265_ssim.ToolTip                = check_x264_ssim.ToolTip.ToString().Replace("x264", "x265");
            check_x262_psnr.ToolTip                = check_x264_psnr.ToolTip.ToString().Replace("x264", "x262");
            check_x262_ssim.ToolTip                = check_x264_ssim.ToolTip.ToString().Replace("x264", "x262");
            check_show_arguments.Content           = Languages.Translate("Show encoding arguments");
            check_show_script.Content              = Languages.Translate("Show AviSynth script");
            check_search_temp.Content              = Languages.Translate("Search the best temp folder place on program start");
            check_auto_colormatrix.Content         = Languages.Translate("Auto apply ColorMatrix for MPEG2 files");
            label_temppath.Content                 = Languages.Translate("Temp folder path:");
            button_temppath.ToolTip                = Languages.Translate("Edit path");
            button_temppath_open.ToolTip           = Languages.Translate("Open folder");
            check_window_size.Content              = Languages.Translate("Restore the size and location of the main window");
            check_window_pos.Content               = Languages.Translate("Fit windows to the working area bounds");
            check_hide_comments.Content            = Languages.Translate("Remove comments (#text) from the AviSynth script");
            check_show_ftooltips.Content           = Languages.Translate("Show advanced tooltips for filtering presets");
            check_resize_first.Content             = Languages.Translate("Make crop/resize before filtering (otherwise - after filtering)");
            check_read_prmtrs.Content              = Languages.Translate("Read parameters from the script when saving a new task");
            check_log_to_file.Content              = Languages.Translate("Write encoding log to file");
            check_logfile_tempfolder.Content       = Languages.Translate("in Temp folder");
            label_extensions.Content               = Languages.Translate("Only files with this extensions will be opened:");
            check_batch_autoencoding.Content       = Languages.Translate("Start encoding after opening all files");
            check_is_always_close_encoding.Content = Languages.Translate("Autoclose encoding window if task was successfully accomplished");
            label_clone.Content                    = Languages.Translate("Clone from the already opened file to each other:");
            check_clone_ar.Content                 = Languages.Translate("Aspect/Resolution info (crop, aspect, etc)");
            check_clone_trim.Content               = Languages.Translate("Trim");
            check_clone_deint.Content              = Languages.Translate("Deinterlace");
            check_clone_fps.Content                = Languages.Translate("Framerate");
            check_clone_audio.Content              = Languages.Translate("Audio options");
            check_batch_pause.Content              = Languages.Translate("Make a pause after 1-st opened file");

            string create_cache = " - " + Languages.Translate("Create caches in Temp folder");
            string delete_cache = " - " + Languages.Translate("Auto delete caches");

            check_ffms_cache_in_temp.Content      = "FFmpegSource2" + create_cache;
            check_delete_ff_cache.Content         = "FFmpegSource2" + delete_cache;
            check_dgindex_cache_in_temp.Content   = "DGIndex" + create_cache;
            check_delete_dgindex_cache.Content    = "DGIndex" + delete_cache;
            check_dgindexnv_cache_in_temp.Content = "DGIndexNV" + create_cache;
            check_delete_dgindexnv_cache.Content  = "DGIndexNV" + delete_cache;
            check_delete_lsmash_cache.Content     = "LWLibav" + delete_cache;

            if (SysInfo.GetOSArchInt() == 64)
            {
                check_use_64x264.Content = Languages.Translate("Use 64-bit x264");
                check_use_64x264.ToolTip = Languages.Translate("This option will allow you to use 64-bit x264 with 32-bit AviSynth (via avs4x26x proxy)");
                check_use_64x265.Content = check_use_64x264.Content.ToString().Replace("x264", "x265");
                check_use_64x265.ToolTip = check_use_64x264.ToolTip.ToString().Replace("x264", "x265");
            }
            else
            {
                check_use_64x264.Content   = Languages.Translate("Run x264 using avs4x26x proxy");
                check_use_64x264.ToolTip   = Languages.Translate("Use this option if you run out of memory due to 32-bit OS limitation of ~2GB per process");
                check_use_64x265.Content   = Languages.Translate("Use 64-bit x264").Replace("x264", "x265");
                check_use_64x265.IsChecked = false;
                check_use_64x265.IsEnabled = false;
            }

            check_dont_delete_caches.Content = Languages.Translate("Don`t delete any caches and temporal files");
            check_use_trayicon.Content       = Languages.Translate("Enable system tray icon");
            check_audio_first.Content        = Languages.Translate("Encode audio first, then video");

            check_batch_pause.ToolTip = Languages.Translate("So you can tune all encoding settings as needed, and then continue opening");
            check_clone_ar.ToolTip    = Languages.Translate("Clone: resolution, crop on each side, added black borders, output SAR/aspect and aspect adjusting method.") +
                                        "\r\n" + Languages.Translate("Note: Autocrop analysis will not be performed!");
            check_clone_trim.ToolTip  = Languages.Translate("Clone: trim start and trim end (for each region)");
            check_clone_deint.ToolTip = Languages.Translate("Clone: source type, field order, deinterlace method.") +
                                        "\r\n" + Languages.Translate("Note: Autodeinterlace analysis will not be performed!");
            check_clone_fps.ToolTip          = Languages.Translate("Clone: output framerate");
            check_clone_audio.ToolTip        = Languages.Translate("Clone: output samplerate, samplerate converter, channels, channels converter");
            check_dont_delete_caches.ToolTip = Languages.Translate("Enable this option only if you use XviD4PSP as script creator, and then encoding it in another application.") +
                                               "\r\n" + Languages.Translate("Or for experiments. In any other cases this option must be disabled (unchecked)!");
            check_read_prmtrs.ToolTip = Languages.Translate("Read from the script: width, height, fps, duration and frames count.") + "\r\n" +
                                        Languages.Translate("Use it only if these parameters was changed manually in the script!");
            check_use_win7taskbar.Content = Languages.Translate("Enable Windows 7 taskbar progress indication");
            check_enable_backup.Content   = Languages.Translate("Create a backups of the tasks list");
            check_validate_pathes.Content = Languages.Translate("Check for illegal characters in pathes");
            check_sort_by_time.Content    = Languages.Translate("Sort presets by last modification time");
            check_auto_abort.Content      = Languages.Translate("Cancel encoding if there is no progress (in minutes):");

            button_restore_hotkeys.Content = Languages.Translate("Restore default settings");
            button_edit_hotkeys.Content    = Languages.Translate("Edit");
            button_save_hotkeys.Content    = Languages.Translate("Save");
            label_action.Content           = Languages.Translate("Action") + ":";
            label_combination.Content      = Languages.Translate("Combination") + ":";

            tab_main.Header        = Languages.Translate("Misc");
            tab_encoding.Header    = Languages.Translate("Encoding");
            tab_temp.Header        = Languages.Translate("Temp files");
            tab_open_folder.Header = Languages.Translate("Batch encoding");
            //tab_hotkeys.Header = Languages.Translate("HotKeys");

            check_x264_psnr.IsChecked              = Settings.x264_PSNR;
            check_x264_ssim.IsChecked              = Settings.x264_SSIM;
            check_x265_psnr.IsChecked              = Settings.x265_PSNR;
            check_x265_ssim.IsChecked              = Settings.x265_SSIM;
            check_x262_psnr.IsChecked              = Settings.x262_PSNR;
            check_x262_ssim.IsChecked              = Settings.x262_SSIM;
            check_show_arguments.IsChecked         = Settings.ArgumentsToLog;
            check_show_script.IsChecked            = Settings.PrintAviSynth;
            check_delete_ff_cache.IsChecked        = Settings.DeleteFFCache;
            check_delete_lsmash_cache.IsChecked    = Settings.DeleteLSMASHCache;
            check_delete_dgindex_cache.IsChecked   = Settings.DeleteDGIndexCache;
            check_delete_dgindexnv_cache.IsChecked = Settings.DeleteDGIndexNVCache;
            check_search_temp.IsChecked            = Settings.SearchTempPath;
            textbox_temp.Text = Settings.TempPath;
            check_auto_colormatrix.IsChecked        = Settings.AutoColorMatrix;
            check_window_size.IsChecked             = Settings.WindowResize;                      //Восстанавливать параметры главного окна
            check_hide_comments.IsChecked           = Settings.HideComments;                      //Удалять комментарии из скрипта
            check_show_ftooltips.IsChecked          = Settings.ShowFToolTips;                     //Показывать подсказки к пресетам фильтрации
            check_resize_first.IsChecked            = Settings.ResizeFirst;                       //Ресайз перед фильтрацией
            check_read_prmtrs.IsChecked             = Settings.ReadScript;                        //Считывать параметры скрипта
            check_log_to_file.IsChecked             = Settings.WriteLog;                          //Записывать лог кодирования в файл..
            check_logfile_tempfolder.IsChecked      = Settings.LogInTemp;                         //.. а файл поместить во временную папку
            textbox_extensions.Text                 = Settings.GoodFilesExtensions;               //Окно со списком допустимых расширений файлов (при пакетной обработке)
            check_batch_autoencoding.IsChecked      = Settings.AutoBatchEncoding;                 //Автозапуск кодирования (при пакетной обработке)
            check_ffms_cache_in_temp.IsChecked      = Settings.FFMS_IndexInTemp;                  //Помещать FFMS2-кэш в Темп-папку
            check_dgindex_cache_in_temp.IsChecked   = Settings.DGIndexInTemp;                     //Помещать DGIndex-кэш в Темп-папку
            check_dgindexnv_cache_in_temp.IsChecked = Settings.DGIndexNVInTemp;                   //Помещать DGIndexNV-кэш в Темп-папку
            check_clone_ar.IsChecked                = Settings.BatchCloneAR;                      //Наследовать параметры Разрешения\Аспекта от предыдущего файла (при пакетной обработке)
            check_clone_trim.IsChecked              = Settings.BatchCloneTrim;                    //То-же что и выше, но для обрезки
            check_clone_deint.IsChecked             = Settings.BatchCloneDeint;                   //А это для деинтерлейса
            check_clone_fps.IsChecked               = Settings.BatchCloneFPS;                     //Это для fps
            check_clone_audio.IsChecked             = Settings.BatchCloneAudio;                   //Ну а это для звуковых параметров
            check_batch_pause.IsChecked             = Settings.BatchPause;                        //Пауза после первого открытого файла (чтоб выставить настройки и т.д.)
            check_use_64x264.IsChecked              = Settings.UseAVS4x264;                       //Запускать x264\x264_64 через avs4x26x
            if (check_use_64x265.IsEnabled)
            {
                check_use_64x265.IsChecked = Settings.UseAVS4x265;                                //Использовать 64-битный x265
            }
            check_is_always_close_encoding.IsChecked = Settings.AutoClose;                        //Автозакрытие окна кодирования
            check_dont_delete_caches.IsChecked       = !(check_delete_ff_cache.IsEnabled =
                                                             check_delete_lsmash_cache.IsEnabled = check_delete_dgindex_cache.IsEnabled =
                                                                 check_delete_dgindexnv_cache.IsEnabled = Settings.DeleteTempFiles); //Удалять кэши и временные файлы
            check_use_trayicon.IsChecked    = Settings.TrayIconIsEnabled;                                                            //Иконка в трее вкл\выкл
            check_audio_first.IsChecked     = Settings.EncodeAudioFirst;                                                             //Кодировать сначала звук, потом видео
            check_use_win7taskbar.IsChecked = Settings.Win7TaskbarIsEnabled;                                                         //Поддержка таскбара в Win7 вкл\выкл
            check_enable_backup.IsChecked   = Settings.EnableBackup;                                                                 //Разрешаем сохранять резервную копию списка заданий
            check_validate_pathes.IsChecked = Settings.ValidatePathes;                                                               //Проверять пути на "нехорошие" символы
            check_sort_by_time.IsChecked    = Settings.SortPresetsByTime;                                                            //Сортировка пресетов по времени изменений
            check_auto_abort.IsChecked      = Settings.AutoAbortEncoding;                                                            //Автоматически прерывать зависшие задания
            num_auto_abort.Value            = Settings.AutoAbortThreshold;                                                           //Время отсутствия прогресса для определения зависания
            num_auto_abort.Tag = (check_auto_abort.IsChecked.Value) ? null : "Inactive";

            if ((bool)(check_window_pos.IsChecked = Settings.CheckWindowsPos))                    //Проверять размер и расположение окон
            {
                this.SourceInitialized += new EventHandler(Window_SourceInitialized);
            }

            //Загружаем HotKeys (плюс перевод к действиям)
            foreach (string line in HotKeys.Data)
            {
                if (line.Contains("="))
                {
                    string[] action_and_combination = line.Split(new string[] { "=" }, StringSplitOptions.None);
                    raw_action.Add(action_and_combination[0].Trim());
                    string translated_action = Languages.Translate(action_and_combination[0].Trim());
                    combo_action.Items.Add(translated_action);
                    listview_hotkeys.Items.Add(new { Column1 = translated_action, Column2 = action_and_combination[1] });
                }
            }
            combo_action.SelectedIndex = listview_hotkeys.SelectedIndex = 0;
            textbox_combination.Text   = HotKeys.GetKeys(raw_action[combo_action.SelectedIndex].ToString());
            list_loaded = true;

            //Чтоб открыть окно на нужной вкладке
            if (set_focus_to == 2)
            {
                tab_temp.IsSelected = true;
            }
            else if (set_focus_to == 3)
            {
                tab_encoding.IsSelected = true;
            }
            else if (set_focus_to == 4)
            {
                tab_open_folder.IsSelected = true;
            }
            else if (set_focus_to == 5)
            {
                tab_hotkeys.IsSelected = true;
            }

            ShowDialog();
        }