/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="ExportRtfDialog"/> class. /// </summary> /// <param name="cache">The cache.</param> /// <param name="helpTopicProvider">The help topic provider.</param> /// ------------------------------------------------------------------------------------ public ExportRtfDialog(FdoCache cache, IHelpTopicProvider helpTopicProvider) { // // Required for Windows Form Designer support // InitializeComponent(); // If the current settings are for arabic digits then don't show the option // to export them as arabic. m_scr = cache.LangProject.TranslatedScriptureOA; m_helpTopicProvider = helpTopicProvider; // Set default export folder. m_rtfFolder = new RegistryStringSetting( Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "ExportFolderForRTF", FwSubKey.TE); string fileName = m_rtfFolder.Value; m_fileDialog = new TeImportExportFileDialog(cache.ProjectId.Name, FileType.RTF); // Append a filename if it was set to just a directory if (Directory.Exists(fileName)) fileName = Path.Combine(fileName, m_fileDialog.DefaultFileName); m_txtOutputFile.Text = fileName; }
/// <summary> /// Initializes the variables. /// </summary> public void Init() { if (TeRegistryKey != null) return; TeRegistryKey = FwRegistryHelper.FieldWorksRegistryKey.CreateSubKey(FwSubKey.TE); ShowMarkerlessIconsSetting = new RegistryBoolSetting(TeRegistryKey, "FootnoteShowMarkerlessIcons", true); ShowEmptyParagraphPromptsSetting = new RegistryBoolSetting(TeRegistryKey, "ShowEmptyParagraphPrompts", true); ShowFormatMarksSetting = new RegistryBoolSetting(TeRegistryKey, "ShowFormatMarks", false); UserInterfaceLanguage = new RegistryStringSetting(FwRegistryHelper.FieldWorksRegistryKey, FwRegistryHelper.UserLocaleValueName, MiscUtils.CurrentUICulture); UseVerticalDraftView = new RegistryBoolSetting(TeRegistryKey, "UseVerticalDraftView", false); UseInterlinearBackTranslation = new RegistryBoolSetting(TeRegistryKey, "UseInterlinearBackTranslation", false); UseXhtmlExport = new RegistryBoolSetting(TeRegistryKey, "UseXhtmlExport", false); ShowTranslateUnsQuestions = new RegistryBoolSetting(TeRegistryKey, "ShowTranslateUnsQuestions", false); FootnoteSynchronousScrollingSetting = new RegistryBoolSetting(TeRegistryKey, "FootnoteSynchronousScrolling", true); ShowTheseStylesSetting = new RegistryStringSetting(TeRegistryKey, "ShowTheseStyles", "all"); ShowStyleLevelSetting = new RegistryStringSetting(TeRegistryKey, "ShowStyleLevel", DlgResources.ResourceString("kstidStyleLevelBasic")); ShowUserDefinedStylesSetting = new RegistryBoolSetting(TeRegistryKey, "ShowUserDefinedStyles", true); AutoStartLibronix = new RegistryBoolSetting(TeRegistryKey, "AutoStartLibronix", false); //UseEnableSendReceiveSyncMsgs = new RegistryBoolSetting(FwSubKey.TE, "UseSendReceiveSyncMsgs", false); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Constructor for runtime. /// </summary> /// <param name="langProjName">Name of the lang proj.</param> /// <param name="scr">The Scripture object.</param> /// <param name="styleSheet">The styleSheet</param> /// <param name="helpTopicProvider">The help topic provider.</param> /// <param name="app">The app.</param> /// ------------------------------------------------------------------------------------ public ImportWizard(string langProjName, IScripture scr, FwStyleSheet styleSheet, IHelpTopicProvider helpTopicProvider, IApp app) : this() { m_LangProjName = langProjName; m_scr = scr; m_helpTopicProvider = helpTopicProvider; m_app = app; m_StyleSheet = styleSheet; m_resolver = new ConfirmOverlappingFileReplaceDialog(helpTopicProvider); m_cache = scr.Cache; // Attempt to get the default import settings. m_settings = m_scr.FindOrCreateDefaultImportSettings(TypeOfImport.Unknown); if (m_settings.ImportTypeEnum == TypeOfImport.Unknown) m_settings.ImportTypeEnum = TypeOfImport.Paratext6; InitializeScrImportSettings(); // Initialize controls based on settings provided switch (m_settings.ImportTypeEnum) { case TypeOfImport.Paratext6: rbParatext6.Checked = true; break; case TypeOfImport.Other: rbOther.Checked = true; break; case TypeOfImport.Paratext5: rbParatext5.Checked = true; break; } if (m_helpTopicProvider == null) m_btnHelp.Visible = false; if (m_app != null) { m_LatestImportFolder = new RegistryStringSetting(FwSubKey.TE, m_scr.Cache.ProjectId.Name, "LatestImportDirectory", string.Empty); sfFileListBuilder.LatestImportFolder = m_LatestImportFolder.Value; } sfFileListBuilder.Initialize(m_helpTopicProvider, m_app); if (m_StyleSheet != null) { m_scrViewHelper = new StyleListViewHelper(lvScrMappings, 1); m_scrViewHelper.AddStyles(m_StyleSheet, MappingDetailsCtrl.AllPseudoStyles); m_annotationViewHelper = new StyleListViewHelper(lvAnnotationMappings, 1); m_annotationViewHelper.AddStyles(m_StyleSheet, MappingDetailsCtrl.AllPseudoStyles); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Constructor for runtime. /// </summary> /// <param name="langProjName">Name of the lang proj.</param> /// <param name="scr">The Scripture object.</param> /// <param name="styleSheet">The styleSheet</param> /// <param name="cache">The cache</param> /// <param name="sHelpFile">If null, the help button will be hidden</param> /// ------------------------------------------------------------------------------------ public ImportWizard(string langProjName, Scripture scr, FwStyleSheet styleSheet, FdoCache cache, string sHelpFile) : this() { m_LangProjName = langProjName; m_scr = scr; m_StyleSheet = styleSheet; m_resolver = new ConfirmOverlappingFileReplaceDialog(); m_settings = (ScrImportSet)m_scr.DefaultImportSettings; if (m_settings == null) { m_settings = new ScrImportSet(); m_scr.ImportSettingsOC.Add(m_settings); m_settings.ImportTypeEnum = TypeOfImport.Paratext6; } InitializeScrImportSettings(); // Initialize controls based on settings provided switch (m_settings.ImportTypeEnum) { case TypeOfImport.Paratext6: rbParatext6.Checked = true; break; case TypeOfImport.Other: rbOther.Checked = true; break; case TypeOfImport.Paratext5: rbParatext5.Checked = true; break; } m_cache = cache; m_helpFile = sHelpFile; if (m_helpFile == null) m_btnHelp.Visible = false; if (FwApp.App != null) { m_LatestImportFolder = new RegistryStringSetting(FwSubKey.TE, cache.ServerName, cache.DatabaseName, "LatestImportDirectory", string.Empty); sfFileListBuilder.LatestImportFolder = m_LatestImportFolder.Value; } if (m_StyleSheet != null) { m_scrViewHelper = new StyleListViewHelper(lvScrMappings, 1); m_scrViewHelper.AddStyles(m_StyleSheet as FwStyleSheet, MappingDetailsCtrl.AllPseudoStyles); m_annotationViewHelper = new StyleListViewHelper(lvAnnotationMappings, 1); m_annotationViewHelper.AddStyles(m_StyleSheet as FwStyleSheet, MappingDetailsCtrl.AllPseudoStyles); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="T:ExportXmlDialog"/> class. /// </summary> /// ------------------------------------------------------------------------------------ public ExportXmlDialog(FdoCache cache, FilteredScrBooks filter, int defaultBookNum, IVwStylesheet stylesheet, FileType exportType, IHelpTopicProvider helpTopicProvider) { // // Required for Windows Form Designer support // InitializeComponent(); m_helpTopicProvider = helpTopicProvider; m_scr = cache.LangProject.TranslatedScriptureOA; m_eExportType = exportType; string key; string descriptionFmt = "kstidOxesExportDescription"; switch (m_eExportType) { case FileType.XHTML: Text = TeResourceHelper.GetResourceString("kstidExportXHTML"); // "Export XHTML" key = "ExportFolderForXhtml"; break; case FileType.ODT: Text = TeResourceHelper.GetResourceString("kstidExportODT"); // "Export Open Office file" key = "ExportFolderForXhtml"; break; case FileType.PDF: Text = TeResourceHelper.GetResourceString("kstidExportPDF"); // "Export Adobe Portable Document" key = "ExportFolderForXhtml"; break; case FileType.OXEKT: Text = TeResourceHelper.GetResourceString("kstidExportOXEKT"); // "Export Open XML for Exchanging Key Terms" m_lblExportWhat.Text = TeResourceHelper.GetResourceString("kstidExportWhatOXEKT"); key = "ExportFolderForXml"; descriptionFmt = "kstidOxektExportDescription"; break; case FileType.OXES: default: key = "ExportFolderForXml"; break; } m_xmlFolder = new RegistryStringSetting(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), key, FwSubKey.TE); string fileName = m_xmlFolder.Value; m_fileDialog = new TeImportExportFileDialog(cache.ProjectId.Name, m_eExportType); // Append a filename if it was set to just a directory if (Directory.Exists(fileName)) fileName = Path.Combine(fileName, m_fileDialog.DefaultFileName); m_txtOutputFile.Text = fileName; // Ensure that the end of the filename is visible. m_txtOutputFile.Select(fileName.Length, 0); FillFilterListLabel(filter); // Set the single book from the current one in use if possible, otherwise set // it from the first available book, if any are available. if (defaultBookNum < 1 || defaultBookNum > BCVRef.LastBook) { defaultBookNum = 1; if (m_scr.ScriptureBooksOS.Count > 0) defaultBookNum = m_scr.ScriptureBooksOS[0].CanonicalNum; } m_scrBook.Initialize(defaultBookNum, m_scr.ScriptureBooksOS.Select(b => b.CanonicalNum).ToArray()); m_scrBook.PassageChanged += m_scrBook_PassageChanged; // Initialize the combo boxes, and then adjust their heights (and the locations // of following controls) as needed. m_oldComboHeight = cboFrom.Height; m_gap = cboTo.Top - cboFrom.Bottom; m_fntVern = ((FwStyleSheet)stylesheet).GetUiFontForWritingSystem( cache.DefaultVernWs, FontInfo.kDefaultFontSize); cboFrom.Font = cboTo.Font = m_fntVern; // Now that the sizes are fixed, load the combo box lists. LoadSectionsForBook(defaultBookNum); m_nBookForSections = defaultBookNum; m_sRangeBookFmt = m_grpSectionRange.Text; UpdateBookSectionGroupLabel(); //m_scrBook.Enabled = false; //m_grpSectionRange.Enabled = false; m_grpSectionRange.Visible = true; // Initialize the description. DateTime now = DateTime.Now; // "{0} exported by {1} on {2} {3}, {4} at {5}" m_txtDescription.Text = String.Format(DlgResources.ResourceString(descriptionFmt), cache.ProjectId.Name, System.Security.Principal.WindowsIdentity.GetCurrent().Name.Normalize(), now.ToString("MMMM"), now.Day, now.Year, now.ToShortTimeString()); // TODO: Set export type from the stored registry setting. }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="ExportXmlDialog"/> class. /// </summary> /// ------------------------------------------------------------------------------------ public ExportXmlDialog(FdoCache cache, FilteredScrBooks filter, ScrReference refBook, IVwStylesheet stylesheet, FileType exportType ) { // // Required for Windows Form Designer support // InitializeComponent(); m_scr = cache.LangProject.TranslatedScriptureOA; m_eExportType = exportType; string key; switch (m_eExportType) { case FileType.OXES: key = "ExportFolderForXML"; break; case FileType.XHTML: Text = TeResourceHelper.GetResourceString("kstidExportXHTML"); // "Export XHTML" key = "ExportFolderForXhtml"; break; case FileType.ODT: Text = TeResourceHelper.GetResourceString("kstidExportODT"); // "Export Open Office file" key = "ExportFolderForXhtml"; break; case FileType.PDF: Text = TeResourceHelper.GetResourceString("kstidExportPDF"); // "Export Adobe Portable Document" key = "ExportFolderForXhtml"; break; default: key = "ExportFolderForXML"; break; } m_xmlFolder = new RegistryStringSetting(FwSubKey.TE, cache.ServerName, cache.DatabaseName, key, Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)); string fileName = m_xmlFolder.Value; m_fileDialog = new TeImportExportFileDialog(cache, m_eExportType); // Append a filename if it was set to just a directory if (Directory.Exists(fileName)) fileName = Path.Combine(fileName, m_fileDialog.DefaultFileName); m_txtOutputFile.Text = fileName; // Ensure that the end of the filename is visible. m_txtOutputFile.Select(fileName.Length, 0); FillFilterListLabel(filter); // Set the single book from the current one in use if possible, otherwise set // it from the first available book, if any are available. if (refBook == null) { refBook = new ScrReference(); refBook.BBCCCVVV = 1001001; if (m_scr.ScriptureBooksOS.Count > 0) refBook.Book = m_scr.ScriptureBooksOS[0].CanonicalNum; } m_scrBook.Initialize(refBook, m_scr as Scripture, true); m_scrBook.PassageChanged += m_scrBook_PassageChanged; // Initialize the combo boxes, and then adjust their heights (and the locations // of following controls) as needed. m_oldComboHeight = cboFrom.Height; m_gap = cboTo.Top - cboFrom.Bottom; FwStyleSheet ss = stylesheet as FwStyleSheet; m_fntVern = new Font(ss.GetNormalFontFaceName(cache, cache.DefaultVernWs), 10); cboFrom.Font = cboTo.Font = m_fntVern; // Now that the sizes are fixed, load the combo box lists. LoadSectionsForBook(refBook.Book); m_nBookForSections = refBook.Book; m_sRangeBookFmt = m_grpSectionRange.Text; UpdateBookSectionGroupLabel(); //m_scrBook.Enabled = false; //m_grpSectionRange.Enabled = false; m_grpSectionRange.Visible = true; // Initialize the description. DateTime now = DateTime.Now; // "{0} exported by {1} on {2} {3}, {4} at {5}" m_txtDescription.Text = String.Format(DlgResources.ResourceString("kstidOxesExportDescription"), cache.LangProject.Name.BestAnalysisVernacularAlternative.Text, System.Security.Principal.WindowsIdentity.GetCurrent().Name.Normalize(), now.ToString("MMMM"), now.Day, now.Year, now.ToShortTimeString()); // TODO: Set export type from the stored registry setting. }
/// ------------------------------------------------------------------------------------ /// <summary> /// Do required initializations /// </summary> /// ------------------------------------------------------------------------------------ protected virtual void Init() { // // Required for Windows Form Designer support // InitializeComponent(); if (Cache != null) { m_bookFilterEnabled = new RegistryBoolSetting(FwSubKey.TE, Cache.ServerName, Cache.DatabaseName, "BookFilterEnabled", false); m_filtersKey = new RegistryStringSetting(FwSubKey.TE, Cache.ServerName, Cache.DatabaseName, "BookFilterBooks", string.Empty); m_bookFilter = new FilteredScrBooks(Cache, Handle.ToInt32()); m_bookFilter.FilterChanged += BookFilterChanged; m_bookFilter.SetSavedFilterFromString(m_filtersKey.Value); ILgWritingSystemFactory lgwsf = Cache.LanguageWritingSystemFactoryAccessor; m_defaultBackTranslationWs = -1; RegistryStringSetting regDefBtWs = GetBtWsRegistrySetting(String.Empty); if (!String.IsNullOrEmpty(regDefBtWs.Value)) m_defaultBackTranslationWs = lgwsf.GetWsFromStr(regDefBtWs.Value); if (m_defaultBackTranslationWs <= 0) m_defaultBackTranslationWs = Cache.DefaultAnalWs; } else { // Not sure if this is necessary, but just to avoid possible problems in tests... m_bookFilterEnabled = new RegistryBoolSetting(FwSubKey.TE, "TestBookFilterEnabled", false); m_filtersKey = new RegistryStringSetting(FwSubKey.TE, "TestBookFilterBooks", string.Empty); } if (TMAdapter != null) InitializeInsertBookMenus(); // must do after menus are created in InitializeComponent() if (DesignMode) return; SetupSideBarInfoBar(); Debug.Assert(m_scr != null); // Initialize the scripture passage control object. GotoReferenceControl.Initialize(ScrReference.StartOfBible(m_scr.Versification), (Scripture)m_scr, true); UpdateCaptionBar(); MaxStyleLevel = ToolsOptionsDialog.MaxStyleLevel; // We need to store this in a variable so that it can be removed for notification m_changeWatcher = new BookChangeWatcher(this); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="FwRegistrySettings"/> class. /// </summary> /// <param name="app">The application.</param> /// ------------------------------------------------------------------------------------ public FwRegistrySettings(FwApp app) { if (app == null) throw new ArgumentNullException("app"); m_firstTimeAppHasBeenRun = new RegistryBoolSetting(app.SettingsKey, "FirstTime", true); m_showSideBar = new RegistryBoolSetting(app.SettingsKey, "ShowSideBar", true); m_showStatusBar = new RegistryBoolSetting(app.SettingsKey, "ShowStatusBar", true); m_openLastEditedProject = new RegistryBoolSetting(app.SettingsKey, "OpenLastEditedProject", false); m_loadingProcessId = new RegistryIntSetting(app.SettingsKey, "LoadingProcessId", 0); m_numberOfLaunches = new RegistryIntSetting(app.SettingsKey, "launches", 0); m_numberOfSeriousCrashes = new RegistryIntSetting(app.SettingsKey, "NumberOfSeriousCrashes", 0); m_numberOfAnnoyingCrashes = new RegistryIntSetting(app.SettingsKey, "NumberOfAnnoyingCrashes", 0); m_totalAppRuntime = new RegistryIntSetting(app.SettingsKey, "TotalAppRuntime", 0); m_appStartupTime = new RegistryStringSetting(app.SettingsKey, "LatestAppStartupTime", string.Empty); m_latestProject = new RegistryStringSetting(app.SettingsKey, "LatestProject", string.Empty); m_latestServer = new RegistryStringSetting(app.SettingsKey, "LatestServer", string.Empty); }