/// ------------------------------------------------------------------------------------ /// <summary> /// This function will drop down the redo list box /// </summary> /// <param name="args"></param> /// <returns><c>true</c></returns> /// ------------------------------------------------------------------------------------ protected bool OnDropDownEditRedo(object args) { ToolBarPopupInfo popupInfo = args as ToolBarPopupInfo; if (popupInfo == null) return false; m_UndoRedoDropDown = new UndoRedoDropDown( FwApp.GetResourceString("kstidRedo1Action"), FwApp.GetResourceString("kstidRedoMultipleActions"), FwApp.GetResourceString("kstidUndoRedoCancel")); for (int i = 0; i < m_cache.ActionHandlerAccessor.RedoableSequenceCount; i++) { string redoText = m_cache.ActionHandlerAccessor.GetRedoTextN(i); m_UndoRedoDropDown.Actions.Add(redoText == null ? FwApp.GetResourceString("kstidUnknownRedo") : redoText.Replace("&", "")); } m_UndoRedoDropDown.ItemClick += new UndoRedoDropDown.ClickEventHandler(OnRedoDropDownClicked); m_UndoRedoDropDown.AdjustHeight(); popupInfo.Control = m_UndoRedoDropDown; return true; }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// <param name="popupInfo"></param> /// <param name="singleAction"></param> /// <param name="multipleActions"></param> /// <param name="cancel"></param> /// ------------------------------------------------------------------------------------ protected virtual void InitializeUndoRedoDropDown(ToolBarPopupInfo popupInfo, string singleAction, string multipleActions, string cancel) { m_UndoRedoDropDown = new UndoRedoDropDown(singleAction, multipleActions, cancel); popupInfo.Control = m_UndoRedoDropDown; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Clean up any resources being used. /// </summary> /// ------------------------------------------------------------------------------------ protected override void Dispose(bool disposing) { Debug.WriteLineIf(!disposing, "****************** Missing Dispose() call for " + GetType().Name + ". ******************"); // Must not be run more than once. if (IsDisposed || m_beingDisposed || Disposing) return; m_beingDisposed = true; if (disposing) { foreach (Control ctrl in m_rgClientViews.Values) { // Dispose of any views that aren't in the form currently. if (ctrl.Parent == null) ctrl.Dispose(); } if (m_mediator != null) { m_mediator.ProcessMessages = false; m_mediator.RemoveColleague(this); } if (m_cboZoomPercent != null) m_cboZoomPercent.Dispose(); if (m_paraStylesComboBox != null) m_paraStylesComboBox.Dispose(); if (m_charStylesComboBox != null) m_charStylesComboBox.Dispose(); if (m_writingSystemSelector != null) m_writingSystemSelector.Dispose(); if (m_progressHandler != null) m_progressHandler.Dispose(); if (m_writingSystemSelector != null) m_writingSystemSelector.Dispose(); if (m_UndoRedoDropDown != null) m_UndoRedoDropDown.Dispose(); if (components != null) components.Dispose(); // no need to explicitly call Dispose on m_persistence - it's part of // components collection and gets disposed there. if (m_rgClientViews != null) m_rgClientViews.Clear(); if (m_tmAdapter != null) { m_tmAdapter.LoadControlContainerItem -= LoadCustomToolBarControls; m_tmAdapter.InitializeComboItem -= InitializeToolBarCombos; m_tmAdapter.Dispose(); } if (m_cache != null) m_cache.ProjectNameChanged -= ProjectNameChanged; if (m_app != null) { // The removing of the window from the app's collection needs to happen later, after // this main window is already disposed of. This is needed for side-effects // that require a running message loop (such as closing the TE notes view // which would normally happen at this call without a running message loop) m_app.FwManager.ExecuteAsync(m_app.RemoveWindow, this); } } m_cboZoomPercent = null; m_paraStylesComboBox = null; m_charStylesComboBox = null; m_writingSystemSelector = null; m_delegate = null; m_tmAdapter = null; m_UndoRedoDropDown = null; m_writingSystemSelector = null; m_StyleSheet = null; m_selectedView = null; m_rgClientViews = null; #if !__MonoCS__ base.Dispose(disposing); #else try { base.Dispose(disposing); } catch (System.ArgumentOutOfRangeException) { // TODO-Linux: examine ToolStrip disposal in UIAdapter // is ToolStrip (from UIAdapter?) being Disposed multiple times? } #endif if (disposing) { if (m_viewHelper != null) m_viewHelper.Dispose(); if (m_mediator != null) m_mediator.Dispose(); } m_cache = null; m_viewHelper = null; m_mediator = null; m_app = null; m_beingDisposed = false; }
/// ------------------------------------------------------------------------------------ /// <summary> /// This function will drop down the redo list box /// </summary> /// <param name="args"></param> /// <returns><c>true</c></returns> /// ------------------------------------------------------------------------------------ protected bool OnDropDownEditRedo(object args) { ToolBarPopupInfo popupInfo = args as ToolBarPopupInfo; if (popupInfo == null) return false; m_UndoRedoDropDown = new UndoRedoDropDown( ResourceHelper.GetResourceString("kstidRedo1Action"), ResourceHelper.GetResourceString("kstidRedoMultipleActions"), ResourceHelper.GetResourceString("kstidUndoRedoCancel")); for (int i = 0; i < m_cache.ActionHandlerAccessor.RedoableSequenceCount; i++) { string redoText = m_cache.ActionHandlerAccessor.GetRedoTextN(i); Debug.Assert(!String.IsNullOrEmpty(redoText)); m_UndoRedoDropDown.Actions.Add(redoText.Replace("&", String.Empty)); } m_UndoRedoDropDown.ItemClick += OnRedoDropDownClicked; m_UndoRedoDropDown.AdjustHeight(); popupInfo.Control = m_UndoRedoDropDown; return true; }
/// ------------------------------------------------------------------------------------ /// <summary> /// This function will drop down the undo list box /// </summary> /// <param name="args"></param> /// <returns><c>true</c> if handled, otherwise <c>false</c></returns> /// ------------------------------------------------------------------------------------ protected virtual bool OnDropDownEditUndo(object args) { ToolBarPopupInfo popupInfo = args as ToolBarPopupInfo; if (popupInfo == null) return false; m_UndoRedoDropDown = new UndoRedoDropDown( ResourceHelper.GetResourceString("kstidUndo1Action"), ResourceHelper.GetResourceString("kstidUndoMultipleActions"), ResourceHelper.GetResourceString("kstidUndoRedoCancel")); for (int i = m_cache.ActionHandlerAccessor.UndoableSequenceCount - 1; i >= m_preMarkUndoSeqCount; i--) { string undoText = m_cache.ActionHandlerAccessor.GetUndoTextN(i); Debug.Assert(!String.IsNullOrEmpty(undoText)); m_UndoRedoDropDown.Actions.Add(undoText.Replace("&", String.Empty)); } m_UndoRedoDropDown.ItemClick += new UndoRedoDropDown.ClickEventHandler(OnUndoDropDownClicked); m_UndoRedoDropDown.AdjustHeight(); popupInfo.Control = m_UndoRedoDropDown; return true; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Clean up any resources being used. /// </summary> /// ------------------------------------------------------------------------------------ protected override void Dispose(bool disposing) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (IsDisposed || m_beingDisposed || Disposing) return; m_beingDisposed = true; FdoCache wndCache = null; if (disposing) { foreach (Control ctrl in m_rgClientWindows.Values) { // Dispose of any views that aren't in the form currently. if (ctrl.Parent == null) ctrl.Dispose(); } if (m_mediator != null) { m_mediator.ProcessMessages = false; m_mediator.RemoveColleague(this); } if (m_writingSystemSelector != null) m_writingSystemSelector.Dispose(); if (m_UndoRedoDropDown != null) m_UndoRedoDropDown.Dispose(); if (components != null) components.Dispose(); // no need to explicitly call Dispose on m_persistence - it's part of // components collection and gets disposed there. if (m_delegate != null) m_delegate.Dispose(); if (m_rgClientWindows != null) m_rgClientWindows.Clear(); if (m_cache != null && m_cache.ProgressBar == m_progressHandler) m_cache.ProgressBar = null; if (FwApp.App != null) { FwApp.App.OkToCloseApp = false; // Make sure we don't shutdown too soon FwApp.App.RemoveWindow(this, out wndCache); } } m_delegate = null; m_UndoRedoDropDown = null; m_writingSystemSelector = null; m_StyleSheet = null; m_selectedView = null; m_rgClientWindows = null; base.Dispose(disposing); if (disposing) { if (m_viewHelper != null) m_viewHelper.Dispose(); if (m_mediator != null) m_mediator.Dispose(); if (FwApp.App != null) { // Remove the cache as the last step. Hopefully this will fix some // ObjectDisposed exceptions we get but can't reproduce. (TE-8340) FwApp.App.OkToCloseApp = true; if (wndCache != null) FwApp.App.RemoveFdoCache(wndCache); } } m_cache = null; m_viewHelper = null; m_mediator = null; m_beingDisposed = false; }