void InsertSymbol() { UnicodeListItem item = null; if (useRecentList) { item = recentListBox.SelectedItem as UnicodeListItem; } else { item = symbolListBox.SelectedItem as UnicodeListItem; } if (item != null) { CommandDetails commandDetails = new CommandDetails { UnicodeString = item.UnicodeText, CommandType = Editor.CommandType.Text }; ((MainWindow)Application.Current.MainWindow).HandleToolBarCommand(commandDetails); if (!useRecentList) { if (recentList.Contains(item)) { recentList.Remove(item); } recentList.Insert(0, item); if (recentList.Count > 20) { recentList.RemoveAt(recentList.Count - 1); } } } }
private void SetupCategory(string categoryName, int start, int end) { ObservableCollection <UnicodeListItem> list = new ObservableCollection <UnicodeListItem>(); FontFamily family = FontFactory.GetFontFamily(FontType.STIXGeneral); for (int i = start; i <= end; i++) { if (TypefaceContainsCharacter(FontFactory.GetTypeface(FontType.STIXGeneral, FontStyles.Normal, FontWeights.Normal), Convert.ToChar(i))) { UnicodeListItem item = new UnicodeListItem { /*FontFamily = family, HexString = "0x" + i.ToString("X4"),*/ CodePoint = i, UnicodeText = string.Format("{0}", Convert.ToChar(i)) }; list.Add(item); allList.Add(item); } } if (categories.Keys.Contains(categoryName)) { ObservableCollection <UnicodeListItem> oldList = categories[categoryName]; foreach (UnicodeListItem item in list) { oldList.Add(item); } } else { categories.Add(categoryName, list); } }
private void characterCodeChanged(UnicodeListItem item) { if (item != null) { int numberBase = int.Parse((string)((ComboBoxItem)codeFormatComboBox.SelectedItem).Tag); string numberString = Convert.ToString(item.CodePoint, numberBase); if (numberBase == 16) { numberString = numberString.ToUpper().PadLeft(4, '0'); } else if (numberBase == 8) { numberString = numberString.PadLeft(6, '0'); } characterCode.Text = numberString; } }
private void codeFormatComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { UnicodeListItem item = symbolListBox.SelectedItem as UnicodeListItem; if (item != null) { int numberBase = int.Parse((string)((ComboBoxItem)codeFormatComboBox.SelectedItem).Tag); string numberString = Convert.ToString(item.CodePoint, numberBase); if (numberBase == 16) { numberString = numberString.ToUpper().PadLeft(4, '0'); } else if (numberBase == 8) { numberString = numberString.PadLeft(6, '0'); } characterCode.Text = numberString; } }
private void recentListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { UnicodeListItem item = recentListBox.SelectedItem as UnicodeListItem; characterCodeChanged(item); }
private void SetupCategory(string categoryName, int start, int end) { ObservableCollection<UnicodeListItem> list = new ObservableCollection<UnicodeListItem>(); FontFamily family = FontFactory.GetFontFamily(FontType.STIXGeneral); for (int i = start; i <= end; i++) { if (TypefaceContainsCharacter(FontFactory.GetTypeface(FontType.STIXGeneral, FontStyles.Normal, FontWeights.Normal), Convert.ToChar(i))) { UnicodeListItem item = new UnicodeListItem { /*FontFamily = family, HexString = "0x" + i.ToString("X4"),*/ CodePoint = i, UnicodeText = string.Format("{0}", Convert.ToChar(i)) }; list.Add(item); allList.Add(item); } } if (categories.Keys.Contains(categoryName)) { ObservableCollection<UnicodeListItem> oldList = categories[categoryName]; foreach (UnicodeListItem item in list) { oldList.Add(item); } } else { categories.Add(categoryName, list); } }