/// ------------------------------------------------------------------------------------ /// <summary> /// Toggles the visibility of the notes view. /// </summary> /// <param name="arg">The menu or toolbar item</param> /// <returns><c>true</c> because we handled the message.</returns> /// ------------------------------------------------------------------------------------ protected bool OnViewNotes(object arg) { NotesMainWnd notesWnd = ((TeApp)m_app).NotesWindow; if (notesWnd == null) { try { // Make sure the user can't close the main window when bringing up the // notes window (TE-8561) m_app.EnableMainWindows(false); m_syncHandler.IgnoreAnySyncMessages = true; notesWnd = new NotesMainWnd(m_app, m_StyleSheet, DraftViewZoomPercent); m_app.InitAndShowMainWindow(notesWnd, null); if (!notesWnd.OnFinishedInit()) Debug.Fail("Notes window did not initialize properly"); } finally { m_app.EnableMainWindows(true); m_syncHandler.IgnoreAnySyncMessages = false; } ((TeApp)m_app).NotesWindow = notesWnd; RespondToSyncScrollingMsgs(true); notesWnd.SyncHandler = m_syncHandler; if (ActiveEditingHelper != null) notesWnd.ScrollToScrEditingLocation(this, ActiveEditingHelper); } else if (arg != null) { // The user chose the View/Notes menu option, which is a toggle, // so we close the existing window. notesWnd.Close(); } return true; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Toggles the visibility of the notes view. /// </summary> /// <param name="arg">The menu or toolbar item</param> /// <returns><c>true</c> because we handled the message.</returns> /// ------------------------------------------------------------------------------------ protected bool OnViewNotes(object arg) { NotesMainWnd notesWnd = TeApp.GetNotesWndForCache(m_cache); if (notesWnd == null) { try { // Make sure the user can't close the main window when bringing up the // notes window (TE-8561) FwApp.App.EnableSameProjectWindows(m_cache, false); ActiveEditingHelper.SyncHandler.IgnoreAnySyncMessages = true; notesWnd = new NotesMainWnd(m_cache, m_StyleSheet, DraftViewZoomPercent); FwApp.App.InitAndShowMainWindow(notesWnd, null); notesWnd.OnFinishedInit(); } finally { FwApp.App.EnableSameProjectWindows(m_cache, true); ActiveEditingHelper.SyncHandler.IgnoreAnySyncMessages = false; } TeApp.AddNotesWndForCache(m_cache, notesWnd); EnableSynchronizedScrolling(true); if (ActiveEditingHelper != null) notesWnd.ScrollToScrEditingLocation(this, ActiveEditingHelper); } else if (arg != null) { // The user chose the View/Notes menu option, which is a toggle, // so we close the existing window. notesWnd.Close(); } return true; }