예제 #1
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
		/// ------------------------------------------------------------------------------------
		protected override void Dispose(bool disposing)
		{
			Debug.WriteLineIf(!disposing, "********** Missing Dispose() call for " + GetType().Name + ". **********");
			if (disposing)
			{
				if (m_openFileDialog != null)
					m_openFileDialog.Dispose();

				if (m_fDisposeWsManager)
				{
					var disposable = m_wsManager as IDisposable;
					if (disposable != null)
						disposable.Dispose();
					m_wsManager = null;
				}
				if (m_fntForSpecialChar != null)
				{
					m_fntForSpecialChar.Dispose();
					m_fntForSpecialChar = null;
				}
				if (m_validCharsGridMngr != null)
					m_validCharsGridMngr.Dispose();
				if (m_chkBoxColHdrHandler != null)
					m_chkBoxColHdrHandler.Dispose();
				if (m_chrPropEng != null && Marshal.IsComObject(m_chrPropEng))
				{
					Marshal.ReleaseComObject(m_chrPropEng);
					m_chrPropEng = null;
				}
				if (m_openFileDialog != null)
					m_openFileDialog.Dispose();
				if (components != null)
					components.Dispose();
			}

			m_openFileDialog = null;
			m_validCharsGridMngr = null;
			m_chkBoxColHdrHandler = null;
			m_inventoryCharComparer = null;
			m_openFileDialog = null;

			base.Dispose(disposing);

		}
예제 #2
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the <see cref="ValidCharactersDlg"/> class.
		/// </summary>
		/// <param name="cache">The cache. Can be <c>null</c> if called from New Project
		/// dialog.</param>
		/// <param name="wsContainer">The FDO writing system container. Can't be
		/// <c>null</c>.</param>
		/// <param name="helpTopicProvider">The help topic provider.</param>
		/// <param name="app">The app.</param>
		/// <param name="ws">The language definition of the writing system for which this
		/// dialog is setting the valid characters. Can not be <c>null</c>.</param>
		/// <param name="wsName">The name of the writing system for which this dialog is setting
		/// the valid characters. Can not be <c>null</c> or <c>String.Empty</c>.</param>
		/// ------------------------------------------------------------------------------------
		public ValidCharactersDlg(FdoCache cache, IWritingSystemContainer wsContainer,
			IHelpTopicProvider helpTopicProvider, IApp app, IWritingSystem ws, string wsName) : this()
		{
			m_ws = ws;
			m_helpTopicProvider = helpTopicProvider;
			m_app = app;
			if (string.IsNullOrEmpty(wsName))
				throw new ArgumentException("Parameter must not be null or empty.", "wsName");

			if (cache != null)
				m_wsManager = cache.ServiceLocator.WritingSystemManager;

			m_chrPropEng = LgIcuCharPropEngineClass.Create();

			m_lblWsName.Text = string.Format(m_lblWsName.Text, wsName);

			// TE-6839: Temporarily remove Unicode tab (not yet implemented).
			tabCtrlAddFrom.TabPages.Remove(tabCtrlAddFrom.TabPages[kiTabUnicode]);

			m_fntForSpecialChar = new Font(SystemFonts.IconTitleFont.FontFamily, 8f);
			Font fnt = new Font(m_ws.DefaultFontName, 16);

			// Review - each of the following Font property set causes LoadCharsFromFont
			// to be executed which is an expensive operation as it pinvokes GetGlyphIndices
			// repeatedly.
			chrGridWordForming.Font = fnt;
			chrGridNumbers.Font = fnt;
			chrGridOther.Font = fnt;
			txtManualCharEntry.Font = fnt;
			txtFirstChar.Font = fnt;
			txtLastChar.Font = fnt;

			lblFirstCharCode.Top = txtFirstChar.Bottom + 5;
			lblLastCharCode.Top = txtLastChar.Bottom + 5;
			lblFirstChar.Top = txtFirstChar.Top +
				(txtFirstChar.Height - lblFirstChar.Height) / 2;
			lblLastChar.Top = txtLastChar.Top +
				(txtLastChar.Height - lblLastChar.Height) / 2;

			fnt = new Font(m_ws.DefaultFontName, 12);
			colChar.DefaultCellStyle.Font = fnt;

			tabData.Controls.Remove(gridCharInventory);
			var gridcol = gridCharInventory.Columns[3];
			m_chkBoxColHdrHandler = new CheckBoxColumnHeaderHandler(gridcol);
			m_chkBoxColHdrHandler.Label = gridcol.HeaderText;
			gridcol.HeaderText = String.Empty;

			contextCtrl.Initialize(cache, wsContainer, m_ws, m_app, fnt, gridCharInventory);
			contextCtrl.Dock = DockStyle.Fill;
			contextCtrl.CheckToRun = CharContextCtrl.CheckType.Characters;
			contextCtrl.ListValidator = RemoveInvalidCharacters;

			colChar.HeaderCell.SortGlyphDirection = SortOrder.Ascending;
			gridCharInventory.AutoGenerateColumns = false;

			colStatus.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight;

			m_validCharsGridMngr.Init(chrGridWordForming, chrGridOther, chrGridNumbers, m_ws, m_app);
			m_validCharsGridMngr.CharacterGridGotFocus += HandleCharGridGotFocus;
			m_validCharsGridMngr.CharacterGridSelectionChanged += HandleCharGridSelChange;
		}