public SentenceList() { InitializeComponent(); //this.BackColor = CF.ExternalBorder; //this.miSynchronizeWithVideo.ShortcutKeys = System.Windows.Forms.Keys.F11; // End; //this.miRepeatVideo.ShortcutKeys = System.Windows.Forms.Keys.F12; // Home; this.saveLessonFileDialog.Filter = GlobalOptions.GetFileFilterForLesson(true); this.Load += new EventHandler(SentenceList_Load); this.btFilter.Click += new System.EventHandler(this.btFilter_Click); this.miGoToTranslatebyPromt.Click += new System.EventHandler(this.miGoToTranslateByGoogle_Click); #region Images //zoomInToolStripMenuItem.Image = f.button_images.zoom_in.ToBitmap(); //zoomOutToolStripMenuItem.Image = f.button_images.zoom_out.ToBitmap(); this.miPaste.Image = f.button_images.paste; this.miGoToTranslateByGoogle.Image = this.miTranslateByGoogle.Image; this.miGoToTranslateByMicrosoft.Image = this.miTranslateByMicrosoft.Image; this.miGoToTranslateByYahoo.Image = this.miTranslateByYahoo.Image; //this.btEstimate.Image = global::f.button_images.estimate; //this.btFind.Image = global::f.button_images.find; // this.btSearchSubtitles.Image = global::f.button_images.find; System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SentenceList)); this.miOpenLesson.Image = ((System.Drawing.Image)(resources.GetObject("btOpen.Image"))); this.miOpenText.Image = ((System.Drawing.Image)(resources.GetObject("btOpen.Image"))); this.miOpenVideo.Image = ((System.Drawing.Image)(resources.GetObject("btOpen.Image"))); this.saveToolStripMenuItem.Image = // miSaveText this.miSaveLesson.Image = ((System.Drawing.Image)(resources.GetObject("saveToolStripMenuItem.Image"))); this.miCloseText.Image = this.miCloseVideo.Image = global::f.button_images.Close; // this.miCloseLesson.Image = global::f.button_images.Close; чтобы не отвлекал внимание #endregion #region events // -------- text this.miPaste.Click += new System.EventHandler(this.miPaste_Click); this.miOpenText.Click += new EventHandler(miOpenText_Click); this.miCloseText.Click += new System.EventHandler(this.miCloseText_Click); this.nextSentenceToolStripMenuItem.Click += new System.EventHandler(this.nextSentenceToolStripMenuItem_Click); this.previousSentenceToolStripMenuItem.Click += new System.EventHandler(this.previousSentenceToolStripMenuItem_Click); this.zoomInToolStripMenuItem.Click += new System.EventHandler(this.zoomInToolStripMenuItem_Click); this.zoomOutToolStripMenuItem.Click += new System.EventHandler(this.zoomOutToolStripMenuItem_Click); this.miPasteText.Click += new EventHandler(miPasteText_Click); this.btText.DropDownOpening += new System.EventHandler(this.moreMenuButton_Click); #endregion this.openFileDialog.InitialDirectory = FileSelector.GetFolderForFileSelection(""); this.panelTopIndent.Visible = false; }
protected virtual void AssignFilterForTextFile() { this.openFileDialog.Filter = GlobalOptions.GetFileFilterForSubtitles(true); }
public void RestoreState() { try { string _videoFileName = CF.GetValue("VideoFileName", @"\Sample\Episode\video sample.mp4"); if (!Utils.IsURL(_videoFileName)) { _videoFileName = FileManager.FindPath(_videoFileName, @"Please select a video file"); } // _videoFileName = FileManager.FindPathAndReturnFullFileName(_videoFileName, @"\my_video\movie.avi - specify a file with downloaded video"); string _subtFileName = CF.GetValue("ListEn_FileName", @"\Sample\Episode\video sample.EN.srt"); //_subtFileName = FileManager.FindPath(_subtFileName, @"\my_video\subtitle_for_my_movie.sub - specify a file with downloaded subtitles"); _subtFileName = FileManager.FindPath(_subtFileName, @"Please select a video file"); string _lessonFileName = CF.GetValue("Lesson_FileName", CF.GetFolderForUserFiles() + @"\video sample.EN.srt.lesson"); string _subtNativeFileName = CF.GetValue("ListNative_FileName", @"\Sample\Episode\video sample.RU.srt"); if (string.IsNullOrEmpty(CF.GetValue(CF.installation_date, ""))) { m_IsFirstRun = true; CF.SetValue(CF.installation_date, DateTime.Today.ToString("dd-MM-yyyy")); } #region FileSelectorDialog // bool skipFileSelectorDialog = CF.GetValue("IsSkipFileSelectorDialog", false); bool skipFileSelectorDialog = false; if (!skipFileSelectorDialog && !T.NoScreen) { #region working with Args foreach (string arg in T.Args) { if (!File.Exists(arg)) { continue; } if (GlobalOptions.IsVideo(arg)) { _videoFileName = arg; // SuggestTextFile(this.VideoFileName); //break; } else if (GlobalOptions.IsSubtitle(arg) || GlobalOptions.IsText(arg)) { _subtFileName = arg; // SuggestVideoFile(this.FileName); //break; } } #endregion Type tFoo = typeof(mshtml.BlockFormats); // it's for loading mshtml assembly FileSelectorInstance = new FileSelector() { VideoFileName = _videoFileName, SubtitleFileName = _subtFileName, LessonFileName = _lessonFileName, SubtitleNativeFileName = _subtNativeFileName }; if (IsFirstRun) { FileSelectorInstance.DoUseSample(); } FileSelectorInstance.Show(); // поскольку this.Visible = false; } #endregion this.reader.TwinList.ListEn.TimeShift = CF.GetValue(CF.timeshift_video, 0.0D); this.reader.TwinList.ListEn.RefreshLabelIndent(); this.RestoreState(this.reader.TwinList.ListEn, false); // т.к. после перезапуска программы не подсвечивается текущее предложение, оно где то внизу this.reader.TwinList.ListEn.List.ScrollSelectedToCenter(); this.RestoreState(this.reader.TwinList.ListNative, string.IsNullOrEmpty(_subtNativeFileName)); if (VideoForm.CurrentVideoContrl != null) { VideoForm.CurrentVideoContrl.mainMenu1.CheckButtonsState(); } #region LanguageDirection //CurrentLangInfo.InitLanguagesMenu(this.toolStrip1); CurrentLangInfo.LanguageDirection = this.reader.LanguageDirection = CF.GetValue("LanguageDirection", CurrentLangInfo.DefaultLangDir); CurrentLangInfo.ChangedLanguageDirection += new EventHandler(ListEn_ChangeLanguageDirection); #endregion // auto ListEn_ChangeLanguageDirection(this.reader.LanguageDirection, EventArgs.Empty); // this.reader.TwinText.textEn.Font = new Font(this.reader.TwinText.textEn.Font.Name, float.Parse(CF.GetValue(sentenceList.Name + "FontSize", 9))); this.reader.TwinText.MenuForSelected.IsListenByClick = CF.GetValue("ListenByClick", true); this.reader.TwinText.MenuForSelected.IsShowPopupWindow = CF.GetValue("ShowPopupWindow", true); this.reader.TwinText.MenuForSelected.IsAddWordToTutor = CF.GetValue("AddWordToTutorOnDoubleClick", false); // --- false --- //this.reader.TwinText.menuForSelected1.miPopupAsMonoDictionary.Checked = CF.GetValue("PopupAsMonoDictionary", false); this.reader.TwinText.MenuForSelected.LastDictName = CF.GetValue("LastDictionary", GoogleDictionary.MainTitle); // http://tech.onliner.by/2012/04/12/resolution // весной 2012 года разрешение мониторов 1024×768 впервые перестало быть самым популярным среди пользователей PC, уступив пальму первенства 1366×768. // В США самым популярным разрешением пока остается 1024×768. CF.AssignValues("MainForm", this, new Point(10, 20), new Size(1200, 728)); this.reader.TwinText.Height = CF.GetValue("TextTwin", 364); // если так то хрень - // 100); // this.reader.TwinText.textForeignAndTran.paForeignText.Height = CF.GetValue("TextForeign_Heigh", 62); // this.reader.TwinText.textWithTranslate.SetAccommodativeHeight(true); // this.reader.TwinText.textNative.Width = CF.GetValue("TextNative", 250); // for TwinList this.reader.TwinList.ListNative.Width = CF.GetValue("ListNative", 252); this.reader.TwinList.paLists.Width = CF.GetValue(text_lists_width, this.Width / 2); // for TwinText this.reader.TwinText.textForeignAndTran.ForeignText.ZoomFactor = CF.GetValue("TextForeign_FontSize", 1f); //TODO this.reader.TwinText.textForeignAndTran.translatedText.ZoomFactor = CF.GetValue("TextTranslate_FontSize", 1f); this.reader.TwinText.textNative.ZoomFactor = CF.GetValue("TextNative_FontSize", 1f); this.reader.TwinText.MenuForSelected.miHideTranslation.Checked = CF.GetValue("IsHidedTranslation", false); } catch (Exception ex) { Messages.ErrorOnRestoringApp(ex); } // здесь видно неправильное положение //if (Utils.VideoForm != null && !Utils.VideoForm.IsDisposed && !Utils.VideoForm.Disposing) // CF.AssignValues("VideoForm", Utils.VideoForm); }
void btVideoOpen_Click(object sender, EventArgs e) { GetFileName(GlobalOptions.GetFileFilterForVideo(true), this.txVideoFile); }
void btSubtitleOpen_Click(object sender, EventArgs e) { GetFileName(GlobalOptions.GetFileFilterForSubtitles(true), this.txSubtFile); }
protected override void AssignFilterForTextFile() { this.openFileDialog.Filter = GlobalOptions.GetFileFilterForLesson(true); }