示例#1
0
			/// ---------------------------------------------------------------------------------
			/// <summary>
			/// Initializes the valid characters explorer bar with three valid character grids.
			/// </summary>
			/// ---------------------------------------------------------------------------------
			internal void Init(CharacterGrid gridWf, CharacterGrid gridOther, CharacterGrid gridNum,
				IWritingSystem ws, IApp app)
			{
				m_ws = ws;
				m_app = app;

				gridWf.Font = new Font(ws.DefaultFontName, gridWf.Font.Size);
				gridNum.Font = new Font(ws.DefaultFontName, gridNum.Font.Size);
				gridOther.Font = new Font(ws.DefaultFontName, gridOther.Font.Size);

				gridWf.BackgroundColor = SystemColors.Window;
				gridNum.BackgroundColor = SystemColors.Window;
				gridOther.BackgroundColor = SystemColors.Window;

				gridWf.MultiSelect = true;
				gridNum.MultiSelect = true;
				gridOther.MultiSelect = true;

				gridWf.CellPainting += HandleGridCellPainting;
				gridNum.CellPainting += HandleGridCellPainting;
				gridOther.CellPainting += HandleGridCellPainting;

				gridWf.Enter += HandleGridEnter;
				gridNum.Enter += HandleGridEnter;
				gridOther.Enter += HandleGridEnter;

				gridWf.CellFormatting += HandleCellFormatting;
				gridNum.CellFormatting += HandleCellFormatting;
				gridOther.CellFormatting += HandleCellFormatting;

				gridWf.CellMouseClick += HandleCharGridCellMouseClick;
				gridNum.CellMouseClick += HandleCharGridCellMouseClick;
				gridOther.CellMouseClick += HandleCharGridCellMouseClick;

				gridWf.SelectionChanged += HandleCharGridSelectionChanged;
				gridOther.SelectionChanged += HandleCharGridSelectionChanged;

				m_gridWordForming = gridWf;
				m_gridNumbers = gridNum;
				m_gridOther = gridOther;
				m_validChars = ValidCharacters.Load(ws, LoadException, FwDirectoryFinder.LegacyWordformingCharOverridesFile);

				RefreshCharacterGrids(ValidCharacterType.All);
			}
示例#2
0
			/// ---------------------------------------------------------------------------------
			/// <summary>
			/// Clears all the valid characters.
			/// </summary>
			/// ---------------------------------------------------------------------------------
			internal void Reset()
			{
				m_validChars.Reset();
				m_currGrid = null;
				RefreshCharacterGrids(ValidCharacterType.All);
			}
示例#3
0
			/// ---------------------------------------------------------------------------------
			/// <summary>
			/// Handles the grid enter.
			/// </summary>
			/// ---------------------------------------------------------------------------------
			void HandleGridEnter(object sender, EventArgs e)
			{
				m_currGrid = sender as CharacterGrid;

				if (CharacterGridGotFocus != null)
					CharacterGridGotFocus(sender, e);
			}
示例#4
0
			/// ---------------------------------------------------------------------------------
			/// <summary>
			/// Determines whether or not all the selected characters in the specified grid fall
			/// into the category of punctuation or symbol characters.
			/// </summary>
			/// ---------------------------------------------------------------------------------
			private bool AreSelectedCharsOther(CharacterGrid grid)
			{
				if (grid == null || grid == m_gridNumbers || grid.SelectedCells.Count == 0)
					return false;

				foreach (DataGridViewCell cell in grid.SelectedCells)
				{
					string chr = grid.GetCharacterAt(cell.ColumnIndex, cell.RowIndex);
					if (string.IsNullOrEmpty(chr) || chr.Length <= 0)
						return false;

					if (!m_validChars.CanBeWordFormingOverride(chr))
						return false;
				}

				return true;
			}
示例#5
0
			/// <summary/>
			protected virtual void Dispose(bool fDisposing)
			{
				System.Diagnostics.Debug.WriteLineIf(!fDisposing, "****** Missing Dispose() call for " + GetType().Name + ". ****** ");
				if (fDisposing && !IsDisposed)
				{
					// dispose managed and unmanaged objects
				if (m_gridWordForming != null)
				{
					m_gridWordForming.CellPainting -= HandleGridCellPainting;
					m_gridWordForming.Enter -= HandleGridEnter;
					m_gridWordForming.CellFormatting -= HandleCellFormatting;
					m_gridWordForming.CellMouseClick -= HandleCharGridCellMouseClick;
					m_gridWordForming.SelectionChanged -= HandleCharGridSelectionChanged;
					m_gridWordForming.Dispose();
				}

				if (m_gridNumbers != null)
				{
					m_gridNumbers.CellPainting -= HandleGridCellPainting;
					m_gridNumbers.Enter -= HandleGridEnter;
					m_gridNumbers.CellFormatting -= HandleCellFormatting;
					m_gridNumbers.CellMouseClick -= HandleCharGridCellMouseClick;
					m_gridNumbers.Dispose();
				}

				if (m_gridOther != null)
				{
					m_gridOther.CellPainting -= HandleGridCellPainting;
					m_gridOther.Enter -= HandleGridEnter;
					m_gridOther.CellFormatting -= HandleCellFormatting;
					m_gridOther.CellMouseClick -= HandleCharGridCellMouseClick;
					m_gridOther.SelectionChanged -= HandleCharGridSelectionChanged;
					m_gridOther.Dispose();
				}

				if (m_currGrid != null)
					m_currGrid.Dispose();

					if (m_cmnu != null)
						m_cmnu.Dispose();
				}
				m_gridWordForming = null;
				m_gridNumbers = null;
				m_gridOther = null;
					m_currGrid = null;
				IsDisposed = true;
			}
示例#6
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Event fired when the current character changes in one of the grids.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		private void HandleCharGridCharacterChanged(CharacterGrid grid, string newCharacter)
		{
			if (m_validCharsGridMngr != null)	// Can happen in tests.
				btnRemoveChar.Enabled = !string.IsNullOrEmpty(m_validCharsGridMngr.CurrentCharacter);
		}
示例#7
0
			/// ------------------------------------------------------------------------------------
			/// <summary>
			/// Initializes the valid characters explorer bar with three valid character grids.
			/// </summary>
			/// ------------------------------------------------------------------------------------
			internal void Init(CharacterGrid gridWf, CharacterGrid gridOther, CharacterGrid gridNum,
				LanguageDefinition langDef)
			{
				m_langDef = langDef;

				gridWf.BackgroundColor = SystemColors.Window;
				gridNum.BackgroundColor = SystemColors.Window;
				gridOther.BackgroundColor = SystemColors.Window;

				gridWf.MultiSelect = true;
				gridNum.MultiSelect = true;
				gridOther.MultiSelect = true;

				gridWf.CellPainting += HandleGridCellPainting;
				gridNum.CellPainting += HandleGridCellPainting;
				gridOther.CellPainting += HandleGridCellPainting;

				gridWf.Enter += HandleGridEnter;
				gridNum.Enter += HandleGridEnter;
				gridOther.Enter += HandleGridEnter;

				gridWf.CellFormatting += HandleCellFormatting;
				gridNum.CellFormatting += HandleCellFormatting;
				gridOther.CellFormatting += HandleCellFormatting;

				gridWf.CellMouseClick += HandleCharGridCellMouseClick;
				gridNum.CellMouseClick += HandleCharGridCellMouseClick;
				gridOther.CellMouseClick += HandleCharGridCellMouseClick;

				gridWf.SelectionChanged += HandleCharGridSelectionChanged;
				gridOther.SelectionChanged += HandleCharGridSelectionChanged;

				m_gridWordForming = gridWf;
				m_gridNumbers = gridNum;
				m_gridOther = gridOther;
				m_validChars = ValidCharacters.Load(langDef);

				RefreshCharacterGrids(ValidCharacterType.All);
			}
示例#8
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Event fired when the current character changes in one of the grids.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		private void HandleCharGridCharacterChanged(CharacterGrid grid, string newCharacter)
		{
			btnRemoveChar.Enabled = !string.IsNullOrEmpty(m_validCharsGridMngr.CurrentCharacter);
		}