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 symbolClick(object sender, MouseButtonEventArgs e)
        {
            string         item           = ((TextBlock)sender).DataContext as string;
            CommandDetails commandDetails = new CommandDetails {
                UnicodeString = item, CommandType = Editor.CommandType.Text
            };

            ((MainWindow)Application.Current.MainWindow).HandleToolBarCommand(commandDetails);
        }
Example #3
0
 public void HandleUserCommand(CommandDetails commandDetails)
 {
     if (commandDetails.CommandType == CommandType.Text)
     {
         ConsumeText(commandDetails.UnicodeString); //ConsumeText() will call DeSelect() itself. No worries here
     }
     else
     {
         int undoCount = UndoManager.UndoCount + 1;
         if (IsSelecting)
         {
             ActiveChild.RemoveSelection(true);
         }
         ((EquationContainer)ActiveChild).ExecuteCommand(commandDetails.CommandType, commandDetails.CommandParam);
         if (IsSelecting && undoCount < UndoManager.UndoCount)
         {
             UndoManager.ChangeUndoCountOfLastAction(1);
         }
         CalculateSize();
         AdjustCarets();
         DeSelect();
     }
 }
Example #4
0
        private void insertButton_Click(object sender, RoutedEventArgs e)
        {
            uint number;

            if (ConvertToNumber(numberBox.Text, out number))
            {
                try
                {
                    CommandDetails commandDetails = new CommandDetails {
                        UnicodeString = Convert.ToChar(number).ToString(), CommandType = Editor.CommandType.Text
                    };
                    ((MainWindow)Application.Current.MainWindow).HandleToolBarCommand(commandDetails);
                }
                catch
                {
                    MessageBox.Show("The given value is invalid.", "Input error");
                }
            }
            else
            {
                MessageBox.Show("The entered value is invalid.", "Input error");
            }
        }
 public void HandleToolBarCommand(CommandDetails commandDetails)
 {
     if (commandDetails.CommandType == CommandType.CustomMatrix)
     {
         var inputForm = new MatrixInputWindow(((int[])commandDetails.CommandParam)[0], ((int[])commandDetails.CommandParam)[1]);
         inputForm.ProcessRequest += (x, y) =>
         {
             CommandDetails newCommand = new CommandDetails {
                 CommandType = CommandType.Matrix
             };
             newCommand.CommandParam = new int[] { x, y };
             editor.HandleUserCommand(newCommand);
         };
         _ = inputForm.ShowDialog();
     }
     else
     {
         editor.HandleUserCommand(commandDetails);
         if (commandDetails.CommandType == CommandType.Text)
         {
             historyToolBar.AddItem(commandDetails.UnicodeString);
         }
     }
 }
 public void HandleUserCommand(CommandDetails commandDetails)
 {
     equationRoot.HandleUserCommand(commandDetails);
     AdjustView();
     Dirty = true;
 }
 public EditorToolBarButton(CommandDetails commandDetails)
 {
     this.commandDetails = commandDetails;
 }
 public void HandleToolBarCommand(CommandDetails commandDetails)
 {
     if (commandDetails.CommandType == CommandType.CustomMatrix)
     {
         MatrixInputForm inputForm = new MatrixInputForm(((int[])commandDetails.CommandParam)[0], ((int[])commandDetails.CommandParam)[1]);
         inputForm.ProcessRequest += (x, y) =>
         {
             CommandDetails newCommand = new CommandDetails { CommandType = CommandType.Matrix };
             newCommand.CommandParam = new int[] { x, y };
             editor.HandleUserCommand(newCommand);
         };
         inputForm.ShowDialog(this);
     }
     else
     {
         editor.HandleUserCommand(commandDetails);
         if (commandDetails.CommandType == CommandType.Text)
         {
             historyToolBar.AddItem(commandDetails.UnicodeString);
         }
     }
 }
 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 insertButton_Click(object sender, RoutedEventArgs e)
 {
     uint number;
     if (ConvertToNumber(numberBox.Text, out number))
     {
         try
         {
             CommandDetails commandDetails = new CommandDetails { UnicodeString = Convert.ToChar(number).ToString(), CommandType = Editor.CommandType.Text };
             ((MainWindow)Application.Current.MainWindow).HandleToolBarCommand(commandDetails);
         }
         catch
         {
             MessageBox.Show("The given value is invalid.", "Input error");
         }
     }
     else
     {
         MessageBox.Show("The entered value is invalid.", "Input error");
     }
 }
Example #11
0
 public void HandleUserCommand(CommandDetails commandDetails)
 {
     if (commandDetails.CommandType == CommandType.Text)
     {
         ConsumeText(commandDetails.UnicodeString); //ConsumeText() will call DeSelect() itself. No worries here
     }
     else
     {
         int undoCount = UndoManager.UndoCount + 1;
         if (IsSelecting)
         {
             ActiveChild.RemoveSelection(true);
         }
         ((EquationContainer)ActiveChild).ExecuteCommand(commandDetails.CommandType, commandDetails.CommandParam);
         if (IsSelecting && undoCount < UndoManager.UndoCount)
         {
             UndoManager.ChangeUndoCountOfLastAction(1);
         }
         CalculateSize();
         AdjustCarets();
         DeSelect();
     }
 }
 public EditorToolBarButton(CommandDetails commandDetails)
 {
     this.commandDetails = commandDetails;
 }
 private void symbolClick(object sender, MouseButtonEventArgs e)
 {
     string item = ((TextBlock)sender).DataContext as string;
     CommandDetails commandDetails = new CommandDetails { UnicodeString = item, CommandType = Editor.CommandType.Text };
     ((MainWindow)Application.Current.MainWindow).HandleToolBarCommand(commandDetails);
 }
 public void HandleUserCommand(CommandDetails commandDetails)
 {
     equationRoot.HandleUserCommand(commandDetails);
     AdjustView();
     Dirty = true;
 }