public void Clear()
 {
     equationRoot          = new EquationRoot(vCaret, hCaret);
     equationRoot.FontSize = fontSize;
     rootFontSize          = fontSize;
     Dirty = false;
     AdjustView();
 }
 public EditorControl()
 {
     InitializeComponent();
     mainGrid.Children.Add(vCaret);
     mainGrid.Children.Add(hCaret);
     equationRoot          = new EquationRoot(vCaret, hCaret);
     equationRoot.FontSize = fontSize;
     timer = new System.Threading.Timer(blinkCaret, null, blinkPeriod, blinkPeriod);
 }
 public EditorControl()
 {
     InitializeComponent();
     mainGrid.Children.Add(vCaret);
     mainGrid.Children.Add(hCaret);
     equationRoot = new EquationRoot(vCaret, hCaret);
     equationRoot.FontSize = fontSize;
     timer = new System.Threading.Timer(blinkCaret, null, blinkPeriod, blinkPeriod);
 }
        public EditorControl()
        {
            InitializeComponent();
            mainGrid.Children.Add(vCaret);
            mainGrid.Children.Add(hCaret);
            equationRoot          = new EquationRoot(vCaret, hCaret);
            equationRoot.FontSize = fontSize;
            timer = new System.Threading.Timer(blinkCaret, null, blinkPeriod, blinkPeriod);

            // ensure timer and carets are disposed when the window is closed.
            Loaded += OnControlLoaded;
        }
        public void RestoreAfterSave(EquationRoot root)
        {
            Dictionary <int, int> oldMapping = new Dictionary <int, int>();

            foreach (int i in mapping.Keys)
            {
                oldMapping.Add(mapping[i], i);
                TextFormat tf = formattingListBeforeSave[i];
                tf.Index = i;
            }
            root.ResetTextFormats(oldMapping);
            formattingList = formattingListBeforeSave;
        }
        public void OptimizeForSave(EquationRoot root)
        {
            mapping.Clear();
            List <TextFormat> newList  = new List <TextFormat>();
            HashSet <int>     usedOnes = root.GetUsedTextFormats();

            foreach (int i in usedOnes)
            {
                TextFormat tf = formattingList[i];
                tf.Index = newList.Count;
                newList.Add(tf);
                mapping.Add(i, tf.Index);
            }
            root.ResetTextFormats(mapping);
            formattingListBeforeSave = formattingList;
            formattingList           = newList;
        }
 public void Clear()
 {
     equationRoot = new EquationRoot(vCaret, hCaret);
     equationRoot.FontSize = fontSize;
     rootFontSize = fontSize;
     Dirty = false;
     AdjustView();
 }