Esempio n. 1
0
        /// ------------------------------------------------------------------------------------
        /// <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();
        }
Esempio n. 2
0
 /// ------------------------------------------------------------------------------------
 /// <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
 }
Esempio n. 3
0
        /// -----------------------------------------------------------------------------------
        /// <summary>
        /// Overridden to set the mediator
        /// </summary>
        /// -----------------------------------------------------------------------------------
        protected override void OnHandleCreated(EventArgs e)
        {
            base.OnHandleCreated(e);
            FwMainWnd wnd = TheMainWnd;

            Mediator = wnd == null ? null : wnd.Mediator;
        }
Esempio n. 4
0
 /// ------------------------------------------------------------------------------------
 /// <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;
 }
Esempio n. 5
0
 /// ------------------------------------------------------------------------------------
 /// <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;
 }
Esempio n. 6
0
 /// ------------------------------------------------------------------------------------
 /// <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;
 }
Esempio n. 7
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Creates the check control.
        /// </summary>
        /// <returns></returns>
        /// ------------------------------------------------------------------------------------
        protected override CheckControl CreateCheckControl()
        {
            FwMainWnd mainWnd = TopLevelControl as FwMainWnd;

            return(new EditorialChecksControl(m_cache, m_bookFilter,
                                              ((ISelectableView)this).BaseInfoBarCaption, m_sProjectName,
                                              (mainWnd != null ? mainWnd.TMAdapter : null)));
        }
 /// ------------------------------------------------------------------------------------
 /// <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;
 }
Esempio n. 9
0
        /// -----------------------------------------------------------------------------------
        /// <summary>
        /// Load a new project based on the given commandline arguments
        /// </summary>
        /// -----------------------------------------------------------------------------------
        public void LoadProject(string[] args)
        {
            FwMainWnd mainWindow = (FwMainWnd)FwApp.App.ActiveMainWindow;

            if (mainWindow != null)
            {
                mainWindow.Invoke(mainWindow.m_openDelegate, new object[] { args });
            }
        }
Esempio n. 10
0
 /// --------------------------------------------------------------------------------
 /// <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;
     }
 }
Esempio n. 11
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Process mouse button up event
        /// </summary>
        /// ------------------------------------------------------------------------------------
        protected override void OnMouseUp(MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Right)
            {
                base.OnMouseUp(e);
                return;
            }

            FwMainWnd mainWnd = TheMainWnd;

            if (mainWnd != null && mainWnd.TMAdapter != null)
            {
                FootnoteEditingHelper.ShowContextMenu(e.Location, mainWnd.TMAdapter, this,
                                                      "cmnuFootnoteView", "cmnuAddToDictFV", "cmnuChangeMultiOccurencesFV", "cmnuAddToDictFV",
                                                      TeProjectSettings.ShowSpellingErrors);
            }
        }
Esempio n. 12
0
        /// ------------------------------------------------------------------------------------
        /// <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;
        }
Esempio n. 13
0
        /// ------------------------------------------------------------------------------------
        /// <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);
            }
        }
Esempio n. 14
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Synchronize the embedded UsfmBrowser control to the specified reference.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private void SyncUsfmBrowser(ScrReference reference)
        {
            FwMainWnd mainWnd = (m_editingHelper == null ? null :
                                 m_editingHelper.Control.FindForm() as FwMainWnd);

            if (mainWnd == null)
            {
                return;
            }

            // Call SetCurrentReference on the TeMainWnd. We can't reference that assembly without
            // being circular, so use Reflection.
            MethodInfo info = mainWnd.GetType().GetMethod("SetCurrentReference");

            if (info != null)
            {
                info.Invoke(mainWnd, new object[] { reference });
            }
        }
        /// ------------------------------------------------------------------------------------
        /// <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;
        }
Esempio n. 16
0
        /// ------------------------------------------------------------------------------------
        /// <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>
        ///
        /// </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);
            }
        }
Esempio n. 18
0
        /// ------------------------------------------------------------------------------------
        /// <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);
            }
        }
Esempio n. 19
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Creates the grid control.
 /// </summary>
 /// ------------------------------------------------------------------------------------
 protected override UserControl CreateGridControl(FwMainWnd mainWnd)
 {
     return(new EditorialChecksRenderingsControl(m_cache, m_bookFilter, mainWnd));
 }
Esempio n. 20
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Creates the grid control.
 /// </summary>
 /// <returns></returns>
 /// ------------------------------------------------------------------------------------
 protected virtual UserControl CreateGridControl(FwMainWnd mainWnd)
 {
     throw new NotImplementedException("Must implement in subclass");
 }
Esempio n. 21
0
        /// ------------------------------------------------------------------------------------
        /// <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();
        }