/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="TeImportManager"/> class. /// </summary> /// <param name="mainWnd">The main window we belong to</param> /// <param name="importCallbacks">The import callbacks.</param> /// ------------------------------------------------------------------------------------ protected TeImportManager(FwMainWnd mainWnd, ITeImportCallbacks importCallbacks) { m_mainWnd = mainWnd; m_cache = m_mainWnd.Cache; m_styleSheet = m_mainWnd.StyleSheet; m_importCallbacks = importCallbacks; m_bookFilter = m_importCallbacks.BookFilter; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="NotesDataEntryView"/> class. /// </summary> /// <param name="cache">Duh</param> /// <param name="userView">The UserView that this view displays</param> /// <param name="notesWnd">The notes window.</param> /// ------------------------------------------------------------------------------------ public NotesDataEntryView(FdoCache cache, IUserView userView, FwMainWnd notesWnd) : base(cache) { m_scr = Cache.LangProject.TranslatedScriptureOA; m_UserView = userView; m_notesMainWnd = notesWnd; BaseInfoBarCaption = userView.ViewNameShort; ReadOnlyView = true; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="NotesDataEntryView"/> class. /// </summary> /// <param name="cache">The cache.</param> /// <param name="helpTopicProvider">The help topic provider.</param> /// <param name="infoBarCaption">The info bar caption.</param> /// <param name="notesWnd">The notes window.</param> /// ------------------------------------------------------------------------------------ public NotesDataEntryView(FdoCache cache, IHelpTopicProvider helpTopicProvider, string infoBarCaption, FwMainWnd notesWnd) : base(cache) { m_helpTopicProvider = helpTopicProvider; m_scr = cache.LangProject.TranslatedScriptureOA; m_notesMainWnd = notesWnd; BaseInfoBarCaption = infoBarCaption; ReadOnlyView = true; }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// ------------------------------------------------------------------------------------ public CheckRenderingControl(FdoCache cache, FwMainWnd mainWnd) { DoubleBuffered = true; m_cache = cache; m_mainWnd = mainWnd; if (m_mainWnd != null) m_mainWnd.ZoomPercentageChanged += HandleZoomPercentageChanged; // Setup a new TsString sort comparer. if (m_cache == null) m_tsStrComparer = new TsStringComparer(); else { m_cache.MainCacheAccessor.AddNotification(this); IWritingSystem ws = m_cache.ServiceLocator.WritingSystems.DefaultVernacularWritingSystem; m_tsStrComparer = new TsStringComparer(ws); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Swaps the specified bookNew into the book filter and the specified bookOld out of the /// filter. /// </summary> /// <param name="bookOld">The old book to be swapped out of the filter.</param> /// <param name="bookNew">The new book to be swapped into the filter.</param> /// <param name="mainWnd">The window which contains the filter.</param> /// ------------------------------------------------------------------------------------ private void Swap(IScrBook bookOld, IScrBook bookNew, FwMainWnd mainWnd) { FilteredScrBooks filter = null; try { filter = (FilteredScrBooks)ReflectionHelper.GetProperty(mainWnd, "BookFilter"); } catch (System.MissingMethodException e) { Logger.WriteEvent(e.Message + " Main window: " + mainWnd.ToString()); } if (filter != null) { Logger.WriteEvent("Replacing book " + (bookOld != null ? bookOld.BookId : bookNew.BookId) + " in Book Filter for main window: " + mainWnd.ToString()); filter.SwapBooks(bookOld, bookNew); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="T:KeyTermRenderingsControl"/> class. /// </summary> /// <param name="cache">The cache.</param> /// <param name="mainWnd">the FwMainWnd that owns this control.</param> /// ------------------------------------------------------------------------------------ public KeyTermRenderingsControl(FdoCache cache, FwMainWnd mainWnd) : base(cache, mainWnd) { InitializeComponent(); AccessibleName = Name; DataGridView = m_dataGridView; // Setup columns m_Rendering.Cache = m_cache; m_Rendering.WritingSystemCode = m_cache.DefaultVernWs; m_OriginalTerm.Cache = m_cache; IWritingSystem ws; m_cache.ServiceLocator.WritingSystemManager.GetOrSet("grc", out ws); m_wsGreek = ws.Handle; if (m_wsGreek <= 0) throw new Exception("The Greek writing system is not defined."); m_cache.ServiceLocator.WritingSystemManager.GetOrSet("hbo", out ws); m_wsHebrew = ws.Handle; if (m_wsHebrew <= 0) throw new Exception("The Hebrew writing system is not defined."); if (mainWnd != null) { Parent = mainWnd; m_stylesheet = mainWnd.StyleSheet; m_Rendering.Font = m_stylesheet.GetUiFontForWritingSystem(cache.DefaultVernWs, FontInfo.kDefaultFontSize); } m_list = new List<ICheckGridRowObject>(); m_gridSorter = new CheckGridListSorter(m_list); m_gridSorter.AddComparer(m_Rendering.DataPropertyName, m_tsStrComparer); m_gridSorter.AddComparer(m_OriginalTerm.DataPropertyName, m_tsStrComparer); m_gridSorter.AddComparer(m_Status.DataPropertyName, new RenderingStatusComparer()); m_gridSorter.AddComparer(m_Reference.DataPropertyName, new ScriptureReferenceComparer(m_cache.LanguageProject.TranslatedScriptureOA.ScrProjMetaDataProvider)); m_dataGridView.Cache = m_cache; m_dataGridView.ColumnHeaderMouseClick += m_dataGridView_ColumnHeaderMouseClick; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="TeImportManager"/> class. /// </summary> /// <param name="mainWnd">The main window initiating the import</param> /// <param name="importCallbacks">The import callbacks.</param> /// <param name="app">The app.</param> /// <param name="fParatextStreamlinedImport">if set to <c>true</c> do a Paratext /// streamlined import (minimal UI).</param> /// ------------------------------------------------------------------------------------ internal TeImportManager(FwMainWnd mainWnd, ITeImportCallbacks importCallbacks, FwApp app, bool fParatextStreamlinedImport) : this(app.Cache, mainWnd.StyleSheet, app, fParatextStreamlinedImport) { m_mainWnd = mainWnd; m_importCallbacks = importCallbacks; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Import an OXES (Open XML for Editing Scripture) file. /// </summary> /// <param name="mainWnd">The main WND.</param> /// <param name="importCallbacks">The import callbacks.</param> /// <param name="app">The app.</param> /// ------------------------------------------------------------------------------------ public static void ImportXml(FwMainWnd mainWnd, ITeImportCallbacks importCallbacks, FwApp app) { TeImportManager mgr = new TeImportManager(mainWnd, importCallbacks, app, false); mgr.ImportXml(); }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// ------------------------------------------------------------------------------------ public CheckRenderingControl(FdoCache cache, FwMainWnd mainWnd) { DoubleBuffered = true; m_cache = cache; m_mainWnd = mainWnd; if (m_mainWnd != null) m_mainWnd.ZoomPercentageChanged += HandleZoomPercentageChanged; // Setup a new TsString sort comparer. if (m_cache == null) m_tsStrComparer = new TsStringComparer(); else { m_cache.MainCacheAccessor.AddNotification(this); string icuLocale = m_cache.LanguageWritingSystemFactoryAccessor.GetStrFromWs(m_cache.DefaultVernWs); m_tsStrComparer = new TsStringComparer(icuLocale); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Creates the grid control. /// </summary> /// ------------------------------------------------------------------------------------ protected override UserControl CreateGridControl(FwMainWnd mainWnd) { return new EditorialChecksRenderingsControl(m_cache, m_bookFilter, mainWnd, m_helpTopicProvider); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Creates the grid control. /// </summary> /// <returns></returns> /// ------------------------------------------------------------------------------------ protected override UserControl CreateGridControl(FwMainWnd mainWnd) { KeyTermRenderingsControl control = ControlCreator.Create(this, new KeyTermRenderingsCreateInfo()) as KeyTermRenderingsControl; control.ReferenceChanged += RenderingScrRefChanged; return control; }
/// -------------------------------------------------------------------------------- /// <summary> /// Initializes a new instance of the <see cref="T:IgnoreSynchMessages"/> class. /// </summary> /// <param name="mainWnd">The main window (which is useful to us only if it turns /// out to implement IScrRefTracker.</param> /// -------------------------------------------------------------------------------- public IgnoreSynchMessages(FwMainWnd mainWnd) { m_refTracker = mainWnd as IScrRefTracker; if (m_refTracker != null) { m_origIgnoreAnySyncMessages = m_refTracker.IgnoreAnySyncMessages; m_refTracker.IgnoreAnySyncMessages = true; } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Creates the grid control. /// </summary> /// <returns></returns> /// ------------------------------------------------------------------------------------ protected override UserControl CreateGridControl(FwMainWnd mainWnd) { KeyTermRenderingsControl control = new KeyTermRenderingsControl(m_cache, mainWnd); control.ReferenceChanged += RenderingScrRefChanged; return control; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="TeImportManager"/> class. /// </summary> /// <remarks>This version is for testing only</remarks> /// <param name="cache">The cache.</param> /// <param name="styleSheet">The style sheet.</param> /// ------------------------------------------------------------------------------------ protected TeImportManager(FdoCache cache, FwStyleSheet styleSheet) { m_mainWnd = null; m_cache = cache; m_styleSheet = styleSheet; m_bookFilter = null; // not used in testing }
/// ------------------------------------------------------------------------------------ /// <summary> /// Constructs a ChecksViewWrapper /// </summary> /// <param name="parent">The parent of the split wrapper (can be null). Will be replaced /// with real parent later.</param> /// <param name="cache">The Cache to give to the views</param> /// <param name="createInfo">Information for creating the draft view to display in the lower /// right corner</param> /// <param name="settingsRegKey">The parent control's ISettings registry key</param> /// ------------------------------------------------------------------------------------ public ChecksViewWrapper(Control parent, FdoCache cache, object createInfo, RegistryKey settingsRegKey) { SuspendLayout(); m_cache = cache; m_scr = m_cache.LangProject.TranslatedScriptureOA; m_mainWnd = parent as FwMainWnd; Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom; Dock = DockStyle.Fill; Name = "ChecksViewWrapper"; Visible = false; // If we have a main window, then ignore the one sent to us and use the main // window's extended settings key. Otherwise use the one sent to us. SettingsKey = (m_mainWnd != null ? m_mainWnd.SettingsKeyEx : settingsRegKey); if (parent != null) Site = parent.Site; // Set up the right view m_rightView = new FwSplitContainer(SettingsKey); m_rightView.Name = "ChecksRightView"; m_rightView.Orientation = Orientation.Horizontal; m_rightView.DesiredFirstPanePercentage = 0.7f; m_rightView.PanelToActivate = m_rightView.Panel1; m_rightView.Panel1Collapsed = false; m_rightView.Panel2Collapsed = false; m_rightView.Tag = createInfo; m_rightView.Dock = DockStyle.Fill; Controls.Add(m_rightView); // Note: setting parent needs to come last Parent = parent; ResumeLayout(); // This should only be null when running tests. if (m_mainWnd != null) m_mainWnd.Mediator.AddColleague(this); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="T:EditorialChecksRenderingsControl"/> class. /// </summary> /// <param name="cache">The cache.</param> /// <param name="bookFilter">The book filter.</param> /// <param name="mainWnd">The FwMainWnd that owns this control.</param> /// <param name="helpTopicProvider">The help topic provider.</param> /// ------------------------------------------------------------------------------------ public EditorialChecksRenderingsControl(FdoCache cache, FilteredScrBooks bookFilter, FwMainWnd mainWnd, IHelpTopicProvider helpTopicProvider) : base(cache, mainWnd) { InitializeComponent(); DataGridView = m_dataGridView; m_BookFilter = bookFilter; m_helpTopicProvider = helpTopicProvider; if (m_cache == null) return; m_Details.Cache = m_cache; m_Details.WritingSystemCode = m_cache.DefaultVernWs; if (mainWnd != null) { m_Details.Font = mainWnd.StyleSheet.GetUiFontForWritingSystem(m_cache.DefaultVernWs, FontInfo.kDefaultFontSize); } m_list = new List<ICheckGridRowObject>(); m_gridSorter = new CheckGridListSorter(m_list); m_gridSorter.AddComparer(m_TypeOfCheck.DataPropertyName, StringComparer.CurrentCulture); m_gridSorter.AddComparer(m_Message.DataPropertyName, StringComparer.CurrentCulture); m_gridSorter.AddComparer(m_Details.DataPropertyName, m_tsStrComparer); m_gridSorter.AddComparer(m_Status.DataPropertyName, new CheckingStatusComparer()); m_gridSorter.AddComparer(m_Reference.DataPropertyName, new ScrReferencePositionComparer(m_cache.LangProject.TranslatedScriptureOA.ScrProjMetaDataProvider, false)); m_dataGridView.Cache = m_cache; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Creates the grid control. /// </summary> /// <returns></returns> /// ------------------------------------------------------------------------------------ protected virtual UserControl CreateGridControl(FwMainWnd mainWnd) { throw new NotImplementedException("Must implement in subclass"); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="T:KeyTermRenderingsControl"/> class. /// </summary> /// <param name="cache">The cache.</param> /// <param name="mainWnd">the FwMainWnd that owns this control.</param> /// ------------------------------------------------------------------------------------ public KeyTermRenderingsControl(FdoCache cache, FwMainWnd mainWnd) : base(cache, mainWnd) { InitializeComponent(); DataGridView = m_dataGridView; // Setup columns m_Rendering.Cache = m_cache; m_Rendering.WritingSystemCode = m_cache.DefaultVernWs; m_OriginalTerm.Cache = m_cache; ILgWritingSystemFactory wsf = m_cache.LanguageWritingSystemFactoryAccessor; m_wsGreek = wsf.GetWsFromStr("grc"); if (m_wsGreek <= 0) throw new Exception("The Greek writing system is not defined."); m_wsHebrew = wsf.GetWsFromStr("hbo"); if (m_wsHebrew <= 0) throw new Exception("The Hebrew writing system is not defined."); if (mainWnd != null) { Parent = mainWnd; m_stylesheet = mainWnd.StyleSheet; m_Rendering.Font = new Font( m_stylesheet.GetNormalFontFaceName(cache, cache.DefaultVernWs), FontInfo.kDefaultFontSize / 1000); } m_list = new List<ICheckGridRowObject>(); m_gridSorter = new CheckGridListSorter(m_list); m_gridSorter.AddComparer(m_Rendering.DataPropertyName, m_tsStrComparer); m_gridSorter.AddComparer(m_OriginalTerm.DataPropertyName, m_tsStrComparer); m_gridSorter.AddComparer(m_Status.DataPropertyName, new RenderingStatusComparer()); m_gridSorter.AddComparer(m_Reference.DataPropertyName, new ScriptureReferenceComparer((Scripture)m_cache.LangProject.TranslatedScriptureOA)); m_dataGridView.Cache = m_cache; m_dataGridView.ColumnHeaderMouseClick += m_dataGridView_ColumnHeaderMouseClick; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Import an OXES (Open XML for Editing Scripture) file. /// </summary> /// <param name="mainWnd">The main WND.</param> /// <param name="importCallbacks">The import callbacks.</param> /// ------------------------------------------------------------------------------------ public static void ImportXml(FwMainWnd mainWnd, ITeImportCallbacks importCallbacks) { TeImportManager mgr = new TeImportManager(mainWnd, importCallbacks); mgr.ImportXml(); }