private ZRun AddInline(String Text, CharDisplayInfo DisplayInfo)
        {
            ZRun temp = CreateInline(Text, DisplayInfo);

            Inlines.Add(temp);
            return(temp);
        }
Exemple #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);
        }
        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);
        }
        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);
        }
        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);
                }
            }
        }
 private void RemoveCharsFromRun(ZRun run, int count)
 {
     run.Text = run.Text.Remove(run.Text.Length - count);
 }
 internal void EndInputMode()
 {
     _inputRun = null;
 }
 internal void StartInputMode()
 {
     _inputRun = new ZRun(_currentInfo);
     ImplementRunStyle(_inputRun);
     Inlines.Add(_inputRun);
 }
 private void RemoveCharsFromRun(ZRun run, int count)
 {
     run.Text = run.Text.Remove(run.Text.Length - count);
 }
Exemple #10
0
 internal void EndInputMode()
 {
     _inputRun = null;
 }
Exemple #11
0
 internal void StartInputMode()
 {
     _inputRun = new ZRun(_currentInfo);
     ImplementRunStyle(_inputRun);
     Inlines.Add(_inputRun);
 }
Exemple #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);
                }
            }
        }
Exemple #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;
        }