internal ComprehensionCheckingSettings(UNSQuestionsDialog dlg) { DefaultWindowState = dlg.WindowState; Location = dlg.Location; DialogSize = dlg.Size; MatchPartialWords = !dlg.MatchWholeWords; KeyTermFilterType = dlg.CheckedKeyTermFilterType; ShowToolbar = dlg.ShowToolbar; GenTemplateSettings = dlg.GenTemplateSettings; SendScrRefs = dlg.SendScrRefs; ReceiveScrRefs = dlg.ReceiveScrRefs; ShowAnswersAndComments = dlg.ShowAnswersAndComments; MaximumHeightOfKeyTermsPane = dlg.MaximumHeightOfKeyTermsPane; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Saves the Transcelerator settings. /// </summary> /// ------------------------------------------------------------------------------------ void SaveComprehensionCheckingSettings(object sender, EventArgs e) { Debug.Assert(sender == m_transceleratorWindow); try { using (RegistryKey key = m_app.ProjectSpecificSettingsKey.CreateSubKey(kComprehensionCheckingToolSubKey)) { key.SetValue(kCCSettings, m_transceleratorWindow.Settings.ToString()); } } catch (Exception error) { Logger.WriteError(error); } m_transceleratorWindow = null; }
internal ComprehensionCheckingSettings(UNSQuestionsDialog dlg) { DefaultWindowState = dlg.WindowState; Location = dlg.Location; DialogSize = dlg.Size; MatchPartialWords = !dlg.MatchWholeWords; KeyTermFilterType = dlg.CheckedKeyTermFilterType; ShowToolbar = dlg.ShowToolbar; GenTemplateSettings = dlg.GenTemplateSettings; SendScrRefs = dlg.SendScrRefs; ReceiveScrRefs = dlg.ReceiveScrRefs; ShowAnswersAndComments = dlg.ShowAnswersAndComments; MaximumHeightOfKeyTermsPane = dlg.MaximumHeightOfKeyTermsPane; }
/// ------------------------------------------------------------------------------------ /// <summary> /// This method implements the Translate UNS Questions menu item. It is called using /// reflection by xCore, not directly. See TeTMDefinition.xml, look for /// CmdUnsQuestions. /// </summary> /// ------------------------------------------------------------------------------------ protected bool OnUnsQuestions(object args) { if (m_transceleratorWindow != null) { m_transceleratorWindow.Activate(); return true; } using (new WaitCursor(this)) { List<IKeyTerm> keyTerms = new List<IKeyTerm>(); foreach (ICmPossibility keyTerm in Cache.LanguageProject.KeyTermsList.PossibilitiesOS) AddKtLeafNodes(keyTerms, keyTerm); IWritingSystem vernWs = Cache.ServiceLocator.WritingSystems.DefaultVernacularWritingSystem; IWritingSystem defaultWs = Cache.ServiceLocator.WritingSystemManager.UserWritingSystem; ComprehensionCheckingSettings ccSettings; try { using (RegistryKey key = m_app.ProjectSpecificSettingsKey.OpenSubKey(kComprehensionCheckingToolSubKey)) { ccSettings = ComprehensionCheckingSettings.LoadFromString( (string)key.GetValue(kCCSettings, string.Empty)); } if (string.IsNullOrEmpty(ccSettings.QuestionsFile)) ccSettings.QuestionsFile = Path.Combine(FwDirectoryFinder.TeFolder, "QTTallBooks.sfm"); } catch { ccSettings = new ComprehensionCheckingSettings(Path.Combine(FwDirectoryFinder.TeFolder, "QTTallBooks.sfm")); } ScrReference start, end; m_bookFilter.GetRefRangeForContiguousBooks(out start, out end); m_transceleratorWindow = new UNSQuestionsDialog(Cache.ProjectId.Name, keyTerms, m_StyleSheet.GetUiFontForWritingSystem(Cache.DefaultVernWs, 0), vernWs.IcuLocale, vernWs.RightToLeftScript, Path.Combine(ScrTextCollection.SettingsDirectory ?? @"c:\My Paratext Projects", "cms"), ccSettings, App.ApplicationName, start, end, vern => ((IWritingSystemDefinition)(vern ? vernWs : defaultWs)).LocalKeyboard.Activate(), () => ShowHelp.ShowHelpTopic(m_app, "khtpNoHelpTopic"), LookupTerm); // TODO: Come up with a Help topic m_transceleratorWindow.GetAvailableBooks = () => m_bookFilter.BookIds; m_transceleratorWindow.Closed += SaveComprehensionCheckingSettings; } m_transceleratorWindow.Show(); return true; }