Beispiel #1
0
 public void SetTextStyle(int new_style)
 {
     if (_currentDisplay.Style != new_style)
     {
         _currentDisplay.Style = new_style;
         _currentParagraph.SetDisplayInfo(_currentDisplay);
     }
 }
Beispiel #2
0
        private void SetCurrentParagraph()
        {
            ZParagraph temp = null;

            Dispatcher.Invoke(new Action(delegate
            {
                foreach (ZParagraph zp in _fd.Blocks)
                {
                    // TODO This might be a bug somewhere
                    // For some reason, _cursorY is fluctuating by 1
                    if (Math.Abs(zp.Top - _cursorY) <= 1)
                    {
                        temp = zp;
                    }
                }

                if (_currentParagraph == temp)
                {
                    _currentParagraph.SetCursorXPosition(_cursorX);
                    return;
                }

                if (temp != null)
                {
                    if (_currentParagraph != null)
                    {
                        _currentParagraph.Flush();
                    }

                    _currentParagraph = temp;
                    _currentParagraph.SetCursorXPosition(_cursorX);
                    _currentParagraph.SetDisplayInfo(_currentDisplay);
                }
            }));
            if (temp == null)
            {
                System.Diagnostics.Debug.WriteLine("Not matching an existing paragraph:" + _cursorY + ":" + _metrics.FontSize.Height + ":" + _metrics.WindowSize.Height);
            }
        }
        private void SetCurrentParagraph()
        {
            ZParagraph temp = null;
            Dispatcher.Invoke(new Action(delegate
            {

                foreach (ZParagraph zp in _fd.Blocks)
                {
                    // TODO This might be a bug somewhere
                    // For some reason, _cursorY is fluctuating by 1
                    if (Math.Abs(zp.Top - _cursorY) <= 1)
                    {
                        temp = zp;
                    }
                }

                if (_currentParagraph == temp)
                {
                    _currentParagraph.SetCursorXPosition(_cursorX);
                    return;
                }

                if (temp != null)
                {
                    if (_currentParagraph != null) _currentParagraph.Flush();

                    _currentParagraph = temp;
                    _currentParagraph.SetCursorXPosition(_cursorX);
                    _currentParagraph.SetDisplayInfo(_currentDisplay);
                }

            }));
            if (temp == null)
            {
                System.Diagnostics.Debug.WriteLine("Not matching an existing paragraph:" + _cursorY + ":" + _metrics.FontSize.Height + ":" + _metrics.WindowSize.Height);
            }
        }