Esempio n. 1
0
        /// <summary>
        /// Executes in two distinct scenarios.
        ///
        /// 1. If disposing is true, the method has been called directly
        /// or indirectly by a user's code via the Dispose method.
        /// Both managed and unmanaged resources can be disposed.
        ///
        /// 2. If disposing is false, the method has been called by the
        /// runtime from inside the finalizer and you should not reference (access)
        /// other managed objects, as they already have been garbage collected.
        /// Only unmanaged resources can be disposed.
        /// </summary>
        /// <param name="disposing"></param>
        /// <remarks>
        /// If any exceptions are thrown, that is fine.
        /// If the method is being done in a finalizer, it will be ignored.
        /// If it is thrown by client code calling Dispose,
        /// it needs to be handled by fixing the bug.
        ///
        /// If subclasses override this method, they should call the base implementation.
        /// </remarks>
        protected override void Dispose(bool disposing)
        {
            //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
            // Must not be run more than once.
            if (IsDisposed)
            {
                return;
            }

            if (disposing)
            {
                // Dispose managed resources here.
                if (m_stylesComboBox != null)
                {
                    m_stylesComboBox.Dispose();
                }
            }

            // Dispose unmanaged resources here, whether disposing is true or false.
            m_stylesComboBox  = null;
            m_styleListHelper = null;
            m_styleSheet      = null;
            m_lp = null;

            base.Dispose(disposing);
        }
Esempio n. 2
0
        public override void Initialize()
        {
            CheckDisposed();

            base.Initialize();

            m_fdoCache = Cache;

            // Setup the stylesheet.
            IStStyle captionStyle = AddTestStyle("Caption", ContextValues.Internal,
                                                 StructureValues.Body, FunctionValues.Prose, false,
                                                 Cache.LangProject.StylesOC);

            m_styleSheet = new FwStyleSheet();
            ((FwStyleSheet)m_styleSheet).Init(m_fdoCache, m_lp.Hvo,
                                              (int)LangProject.LangProjectTags.kflidStyles);

            Debug.Assert(m_stylesComboBox == null, "m_stylesComboBox is not null.");
            //if (m_stylesComboBox != null)
            //	m_stylesComboBox.Dispose();
            m_stylesComboBox  = new ComboBox();
            m_styleListHelper = new StyleComboListHelper(m_stylesComboBox);

            // Set the options to display all of the styles
            m_styleListHelper.MaxStyleLevel = int.MaxValue;
        }
Esempio n. 3
0
        /// <summary>
        ///
        /// </summary>
        public override void TestTearDown()
        {
            m_lp         = null;
            m_styleSheet = null;
            m_stylesComboBox.Dispose();
            m_stylesComboBox = null;
            m_styleListHelper.Dispose();
            m_styleListHelper = null;

            base.TestTearDown();
        }
Esempio n. 4
0
        protected override void CreateTestData()
        {
            m_lp = Cache.LanguageProject;

            AddTestStyle("Normal", ContextValues.Internal, StructureValues.Undefined,
                         FunctionValues.Prose, false, m_lp.StylesOC);
            AddTestStyle("Paragraph", ContextValues.Text, StructureValues.Body,
                         FunctionValues.Prose, false, m_lp.StylesOC);
            AddTestStyle("Section Head", ContextValues.Text, StructureValues.Heading,
                         FunctionValues.Prose, false, m_lp.StylesOC);
            AddTestStyle("Verse Number", ContextValues.Text, StructureValues.Body,
                         FunctionValues.Verse, true, m_lp.StylesOC);
            AddTestStyle("Title Main", ContextValues.Title, StructureValues.Body,
                         FunctionValues.Prose, false, m_lp.StylesOC);
            AddTestStyle("Note General Paragraph", ContextValues.Note, StructureValues.Undefined,
                         FunctionValues.Prose, false, m_lp.StylesOC);
            AddTestStyle("Note Marker", ContextValues.Internal, StructureValues.Undefined,
                         FunctionValues.Prose, true, m_lp.StylesOC);
            AddTestStyle(kStyleName, ContextValues.Text, StructureValues.Body,
                         FunctionValues.Prose, true, 2, m_lp.StylesOC);

            // Setup the stylesheet.
            var captionStyle = AddTestStyle("Caption", ContextValues.Internal,
                                            StructureValues.Body, FunctionValues.Prose, false,
                                            m_lp.StylesOC);

            m_styleSheet = new LcmStyleSheet();
            m_styleSheet.Init(Cache, m_lp.Hvo,
                              LangProjectTags.kflidStyles);

            Debug.Assert(m_stylesComboBox == null, "m_stylesComboBox is not null.");
            //if (m_stylesComboBox != null)
            //	m_stylesComboBox.Dispose();
            m_stylesComboBox  = new ComboBox();
            m_styleListHelper = new StyleComboListHelper(m_stylesComboBox);

            // Set the options to display all of the styles
            m_styleListHelper.MaxStyleLevel = int.MaxValue;
        }
Esempio n. 5
0
		protected override void CreateTestData()
		{
			m_lp = Cache.LanguageProject;

			AddTestStyle("Normal", ContextValues.Internal, StructureValues.Undefined,
				FunctionValues.Prose, false, m_lp.StylesOC);
			AddTestStyle("Paragraph", ContextValues.Text, StructureValues.Body,
				FunctionValues.Prose, false, m_lp.StylesOC);
			AddTestStyle("Section Head", ContextValues.Text, StructureValues.Heading,
				FunctionValues.Prose, false, m_lp.StylesOC);
			AddTestStyle("Verse Number", ContextValues.Text, StructureValues.Body,
				FunctionValues.Verse, true, m_lp.StylesOC);
			AddTestStyle("Title Main", ContextValues.Title, StructureValues.Body,
				FunctionValues.Prose, false, m_lp.StylesOC);
			AddTestStyle("Note General Paragraph", ContextValues.Note, StructureValues.Undefined,
				FunctionValues.Prose, false, m_lp.StylesOC);
			AddTestStyle("Note Marker", ContextValues.Internal, StructureValues.Undefined,
				FunctionValues.Prose, true, m_lp.StylesOC);
			AddTestStyle(kStyleName, ContextValues.Text, StructureValues.Body,
				FunctionValues.Prose, true, 2, m_lp.StylesOC);

			// Setup the stylesheet.
			var captionStyle = AddTestStyle("Caption", ContextValues.Internal,
				StructureValues.Body, FunctionValues.Prose, false,
				m_lp.StylesOC);
			m_styleSheet = new FwStyleSheet();
			m_styleSheet.Init(Cache, m_lp.Hvo,
				LangProjectTags.kflidStyles);

			Debug.Assert(m_stylesComboBox == null, "m_stylesComboBox is not null.");
			//if (m_stylesComboBox != null)
			//	m_stylesComboBox.Dispose();
			m_stylesComboBox = new ComboBox();
			m_styleListHelper = new StyleComboListHelper(m_stylesComboBox);

			// Set the options to display all of the styles
			m_styleListHelper.MaxStyleLevel = int.MaxValue;
		}
Esempio n. 6
0
		/// <summary>
		/// Executes in two distinct scenarios.
		///
		/// 1. If disposing is true, the method has been called directly
		/// or indirectly by a user's code via the Dispose method.
		/// Both managed and unmanaged resources can be disposed.
		///
		/// 2. If disposing is false, the method has been called by the
		/// runtime from inside the finalizer and you should not reference (access)
		/// other managed objects, as they already have been garbage collected.
		/// Only unmanaged resources can be disposed.
		/// </summary>
		/// <param name="disposing"></param>
		/// <remarks>
		/// If any exceptions are thrown, that is fine.
		/// If the method is being done in a finalizer, it will be ignored.
		/// If it is thrown by client code calling Dispose,
		/// it needs to be handled by fixing the bug.
		///
		/// If subclasses override this method, they should call the base implementation.
		/// </remarks>
		protected override void Dispose(bool disposing)
		{
			//Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
			// Must not be run more than once.
			if (IsDisposed)
				return;

			if (disposing)
			{
				// Dispose managed resources here.
				if (m_stylesComboBox != null)
					m_stylesComboBox.Dispose();
			}

			// Dispose unmanaged resources here, whether disposing is true or false.
			m_stylesComboBox = null;
			m_styleListHelper = null;
			m_styleSheet = null;
			m_lp = null;

			base.Dispose(disposing);
		}
Esempio n. 7
0
		public override void Initialize()
		{
			CheckDisposed();

			base.Initialize();

			m_fdoCache = Cache;

			// Setup the stylesheet.
			IStStyle captionStyle = AddTestStyle("Caption", ContextValues.Internal,
				StructureValues.Body, FunctionValues.Prose, false,
				Cache.LangProject.StylesOC);
			m_styleSheet = new FwStyleSheet();
			((FwStyleSheet)m_styleSheet).Init(m_fdoCache, m_lp.Hvo,
				(int)LangProject.LangProjectTags.kflidStyles);

			Debug.Assert(m_stylesComboBox == null, "m_stylesComboBox is not null.");
			//if (m_stylesComboBox != null)
			//	m_stylesComboBox.Dispose();
			m_stylesComboBox = new ComboBox();
			m_styleListHelper = new StyleComboListHelper(m_stylesComboBox);

			// Set the options to display all of the styles
			m_styleListHelper.MaxStyleLevel = int.MaxValue;
		}
Esempio n. 8
0
		/// <summary>
		///
		/// </summary>
		public override void TestTearDown()
		{
			m_lp = null;
			m_styleSheet = null;
			m_stylesComboBox.Dispose();
			m_stylesComboBox = null;
			m_styleListHelper.Dispose();
			m_styleListHelper = null;

			base.TestTearDown();
		}
Esempio n. 9
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// This delegate gets called by the toolbar adapter in order to allow us to initialize
		/// combo boxes. Use it to initialize the zoom and styles combos.
		/// </summary>
		/// <param name="name">Name of toolbar item.</param>
		/// <param name="combo">ComboBox to initialize.</param>
		/// ------------------------------------------------------------------------------------
		private void InitializeToolBarCombos(string name, ComboBox combo)
		{
			if (name == "tbbZoom")
			{
				m_cboZoomPercent = combo;

				m_cboZoomPercent.KeyPress +=
					new System.Windows.Forms.KeyPressEventHandler(this.ZoomKeyPress);
				m_cboZoomPercent.LostFocus +=
					new System.EventHandler(this.ZoomLostFocus);
				m_cboZoomPercent.SelectionChangeCommitted +=
					new System.EventHandler(this.ZoomSelectionChanged);

				m_cboZoomPercent.DropDownStyle = ComboBoxStyle.DropDown;

				m_cboZoomPercent.Items.Add(PercentString(50));
				m_cboZoomPercent.Items.Add(PercentString(75));
				m_cboZoomPercent.Items.Add(PercentString(100));
				m_cboZoomPercent.Items.Add(PercentString(150));
				m_cboZoomPercent.Items.Add(PercentString(200));
				m_cboZoomPercent.Items.Add(PercentString(300));
				m_cboZoomPercent.Items.Add(PercentString(400));
			}
			else if (name == "tbbParaStylesCombo")
			{
				m_paraStylesComboBox = combo;
				m_paraStylesComboBox.DropDownStyle = ComboBoxStyle.DropDownList;
				m_paraStyleListHelper = new StyleComboListHelper(m_paraStylesComboBox);
				m_paraStyleListHelper.StyleChosen +=
					new StyleChosenHandler(StyleChosenFromStylesComboBox);
				m_paraStyleListHelper.GetCurrentStyleName +=
					new GetCurrentStyleNameHandler(GiveStyleComboCurrStyleName);
			}
			else if (name == "tbbCharStylesCombo")
			{
				m_charStylesComboBox = combo;
				m_charStylesComboBox.DropDownStyle = ComboBoxStyle.DropDownList;
				m_charStyleListHelper = new StyleComboListHelper(m_charStylesComboBox);
				m_charStyleListHelper.StyleChosen +=
					new StyleChosenHandler(StyleChosenFromStylesComboBox);
				m_charStyleListHelper.GetCurrentStyleName +=
					new GetCurrentStyleNameHandler(GiveStyleComboCurrStyleName);
			}
			else if (name == "tbbWSCombo")
			{
				m_writingSystemSelector = combo;
				m_writingSystemSelector.AccessibleName = "WritingSystemSelector";
				m_writingSystemSelector.DropDownStyle = ComboBoxStyle.DropDownList;
				m_writingSystemSelector.SelectionChangeCommitted +=
					new EventHandler(m_writingSystemSelector_SelectedIndexChanged);
			}
			else
				InitializeAppSpecificToolBarCombos(name, combo);
		}