示例#1
0
        private ZRun AddInline(String Text, CharDisplayInfo DisplayInfo)
        {
            ZRun temp = CreateInline(Text, DisplayInfo);

            Inlines.Add(temp);
            return(temp);
        }
示例#2
0
        public int StartInputMode()
        {
            _currentParagraph.Flush();
            _currentParagraph.StartInputMode();

            int width = 0;

            foreach (Inline il in _currentParagraph.Inlines)
            {
                if (il is ZRun)
                {
                    ZRun   r    = il as ZRun;
                    String text = r.Text;
                    if (text.Contains(">"))
                    {
                        String temp = text.TrimEnd();
                        if (temp.LastIndexOf(">") == temp.Length - 1)
                        {
                            width += (int)r.Width;
                            return(width);
                        }
                        else
                        {
                            // MessageBox.Show("> is not the last character in the line");
                            width += (int)r.Width;
                        }
                    }
                    else
                    {
                        width += (int)r.Width;
                    }
                }
                else if (il is ZBlankContainer)
                {
                    width += ((ZBlankContainer)il).Width;
                }
                else
                {
                    throw new Exception("Run isn't of ZRun or ZBlankContainer");
                }
            }

            return(-1);
        }
示例#3
0
        private ZRun CreateInline(String Text, CharDisplayInfo DisplayInfo)
        {
            // Add an empty inline to allow for the absolute positioning
            ZRun temp = new ZRun(DisplayInfo);

            temp.Text = Text;
            if (_currentInfo.Font == 1)
            {
                temp.FontFamily = _parent._regularFont.Family;
            }
            else
            {
                temp.FontFamily = _parent._fixedFont.Family;
            }

            ImplementRunStyle(temp);

            return(temp);
        }
示例#4
0
        private bool IsOnlyFixedFont()
        {
            foreach (Inline i in Inlines)
            {
                ZRun r = i as ZRun;
                if (r != null)
                {
                    if (!IsFixedWidth(r.DisplayInfo) && r.Text != "")
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }

            return(true);
        }
示例#5
0
        internal void ImplementRunStyle(ZRun run)
        {
            if (run == null)
            {
                return;
            }

            if (run.DisplayInfo.ImplementsStyle(ZStyles.BOLDFACE_STYLE))
            {
                FontWeight = FontWeights.Bold;
            }

            if (run.DisplayInfo.ImplementsStyle(ZStyles.EMPHASIS_STYLE))
            {
                run.FontStyle = FontStyles.Italic;
            }

            if (run.DisplayInfo.ImplementsStyle(ZStyles.FIXED_WIDTH_STYLE) || run.DisplayInfo.Font != ZFont.TEXT_FONT)
            {
                run.FontFamily = _parent._fixedFont.Family;
            }

            if (run.DisplayInfo.ImplementsStyle(ZStyles.REVERSE_STYLE))
            {
                run.Background = ZColorCheck.ZColorToBrush(run.DisplayInfo.ForegroundColor, ColorType.Foreground);
                run.Foreground = ZColorCheck.ZColorToBrush(run.DisplayInfo.BackgroundColor, ColorType.Background);
            }
            else
            {
                run.Foreground = ZColorCheck.ZColorToBrush(run.DisplayInfo.ForegroundColor, ColorType.Foreground);
                int color = run.DisplayInfo.BackgroundColor;
                if (color != _parent.bColor)
                {
                    run.Background = ZColorCheck.ZColorToBrush(color, ColorType.Background);
                }
            }
        }
示例#6
0
 private void RemoveCharsFromRun(ZRun run, int count)
 {
     run.Text = run.Text.Remove(run.Text.Length - count);
 }
示例#7
0
 internal void EndInputMode()
 {
     _inputRun = null;
 }
示例#8
0
 internal void StartInputMode()
 {
     _inputRun = new ZRun(_currentInfo);
     ImplementRunStyle(_inputRun);
     Inlines.Add(_inputRun);
 }
示例#9
0
 private void RemoveCharsFromRun(ZRun run, int count)
 {
     run.Text = run.Text.Remove(run.Text.Length - count);
 }
示例#10
0
 internal void EndInputMode()
 {
     _inputRun = null;
 }
示例#11
0
 internal void StartInputMode()
 {
     _inputRun = new ZRun(_currentInfo);
     ImplementRunStyle(_inputRun);
     Inlines.Add(_inputRun);
 }
示例#12
0
        internal void ImplementRunStyle(ZRun run)
        {
            if (run == null) return;

            if (run.DisplayInfo.ImplementsStyle(ZStyles.BOLDFACE_STYLE))
            {
                FontWeight = FontWeights.Bold;
            }

            if (run.DisplayInfo.ImplementsStyle(ZStyles.EMPHASIS_STYLE))
            {
                run.FontStyle = FontStyles.Italic;
            }

            if (run.DisplayInfo.ImplementsStyle(ZStyles.FIXED_WIDTH_STYLE) || run.DisplayInfo.Font != ZFont.TEXT_FONT)
            {
                run.FontFamily = _parent._fixedFont.Family;
            }

            if (run.DisplayInfo.ImplementsStyle(ZStyles.REVERSE_STYLE))
            {
                run.Background = ZColorCheck.ZColorToBrush(run.DisplayInfo.ForegroundColor, ColorType.Foreground);
                run.Foreground = ZColorCheck.ZColorToBrush(run.DisplayInfo.BackgroundColor, ColorType.Background);
            }
            else
            {
                run.Foreground = ZColorCheck.ZColorToBrush(run.DisplayInfo.ForegroundColor, ColorType.Foreground);
                int color = run.DisplayInfo.BackgroundColor;
                if (color != _parent.bColor)
                {
                    run.Background = ZColorCheck.ZColorToBrush(color, ColorType.Background);
                }
            }
        }
示例#13
0
        private ZRun CreateInline(String Text, CharDisplayInfo DisplayInfo) {
           // Add an empty inline to allow for the absolute positioning
            ZRun temp = new ZRun(DisplayInfo);
            temp.Text = Text;
            if (_currentInfo.Font == 1)
            {
                temp.FontFamily = _parent._regularFont.Family;
            }
            else
            {
                temp.FontFamily = _parent._fixedFont.Family;
            }

            ImplementRunStyle(temp);

            return temp;
        }