Beispiel #1
0
        internal void Flush()
        {
            if (_currentText.Length == 0)
            {
                return;
            }
            String text = _currentText.ToString();

            _currentText.Clear();
            int chars = _x.tcw();

            // TODO This is an invalid state, but it still seems to get here... I need to figure out why
            //if (_flushMode == TextFlushMode.Absolute && _x == 1 && Width == 0)
            //{
            //    ySystem.Diagnostics.Debug.WriteLine("How did I get here?");
            //}

            // If _x is 1 and Width == 0, We don't need to be here...
            if (_flushMode == TextFlushMode.Absolute)
            {
                _flushMode = TextFlushMode.Normal;
//                Inlines.Clear();
                if (Inlines.Count == 0)
                {
                    // Add an empty inline to allow for the absolute positioning
                    AddInline("", _defaultInfo);
                }

                if (Inlines.Count == 1 && FirstInline.DisplayInfo.AreSame(_currentInfo) &&
                    (FirstInline.DisplayInfo.Font == ZFont.FIXED_WIDTH_FONT ||
                     FirstInline.DisplayInfo.ImplementsStyle(ZStyles.FIXED_WIDTH_STYLE)))
                {
                    FirstInline.Text = ReplaceText(chars, FirstInline.Text, text);
                    return;
                }
                else
                {
                    if (Width == 0)
                    {
                        if (IsFixedWidth(_currentInfo))
                        {
                            setAbsolute(text, _x, _currentInfo);

                            return;
                        }
                        else
                        {
#if !USEADORNER
                            if (_x > 1)
                            {
                                System.Diagnostics.Debug.WriteLine("Inserting a blank");
                                ZBlankContainer zbc = new ZBlankContainer(_x);
                                Inlines.Add(zbc);
                            }

                            AddInline(text, _currentInfo);
                            return;
#else
                            setAbsolute(text, _x, _currentInfo);
                            return;
#endif
                        }
                    }
                    else
                    {
                        // TODO If the top == 1, it must be the status bar overwriting text... Make this work better
                        if (IsOnlyFixedFont() && IsFixedWidth(_currentInfo) || Top == 1)
                        {
                            // TODO Need to make some calculations here
                            String temp = CurrentText;
                            Inlines.Clear();

                            AddInline(ReplaceText(chars, temp, text), _fixedInfo);

                            return;
                        }
                        else
                        {
                            if (text.Trim() != "" || _currentInfo.ImplementsStyle(ZStyles.REVERSE_STYLE))
                            {
                                setAbsolute(text, _x, _currentInfo);

                                return;
                            }
                            else
                            {
                                // System.Diagnostics.Debug.WriteLine("Do something about Absolute");

                                // Figure f = new Figure();
                                return;
                            }
                        }
                    }
                }
            }
            else if (_flushMode == TextFlushMode.Overwrite)
            {
                _flushMode = TextFlushMode.Normal;
                throw new Exception("In Overwrite mode");
            }

            if (LastInline != null && LastInline.DisplayInfo.AreSame(_currentInfo))
            {
                LastInline.Text += text;
            }
            else
            {
                AddInline(text, _currentInfo);
            }
        }
Beispiel #2
0
        internal void Flush()
        {
            if (_currentText.Length == 0) return;
            String text = _currentText.ToString();
            _currentText.Clear();
            int chars = _x.tcw();

            // TODO This is an invalid state, but it still seems to get here... I need to figure out why
            //if (_flushMode == TextFlushMode.Absolute && _x == 1 && Width == 0)
            //{
            //    ySystem.Diagnostics.Debug.WriteLine("How did I get here?");
            //}

            // If _x is 1 and Width == 0, We don't need to be here...
            if (_flushMode == TextFlushMode.Absolute)
            {
                _flushMode = TextFlushMode.Normal;
//                Inlines.Clear();
                if (Inlines.Count == 0)
                {
                    // Add an empty inline to allow for the absolute positioning
                    AddInline("", _defaultInfo);
                }

                if (Inlines.Count == 1 && FirstInline.DisplayInfo.AreSame(_currentInfo) &&
                    (FirstInline.DisplayInfo.Font == ZFont.FIXED_WIDTH_FONT ||
                    FirstInline.DisplayInfo.ImplementsStyle(ZStyles.FIXED_WIDTH_STYLE)))
                {
                    FirstInline.Text = ReplaceText(chars, FirstInline.Text, text);
                    return;
                }
                else
                {
                    if (Width == 0)
                    {
                        if (IsFixedWidth(_currentInfo))
                        {
                            setAbsolute(text, _x, _currentInfo);
                            
                            return;
                        }
                        else
                        {
#if !USEADORNER
                            if (_x > 1)
                            {
                                System.Diagnostics.Debug.WriteLine("Inserting a blank");
                                ZBlankContainer zbc = new ZBlankContainer(_x);
                                Inlines.Add(zbc);
                            }

                            AddInline(text, _currentInfo);
                            return;
#else
                            setAbsolute(text, _x, _currentInfo);
                            return;
#endif
                        }
                    }
                    else
                    {
                        // TODO If the top == 1, it must be the status bar overwriting text... Make this work better
                        if (IsOnlyFixedFont() && IsFixedWidth(_currentInfo) || Top == 1)
                        {
                            // TODO Need to make some calculations here
                            String temp = CurrentText;
                            Inlines.Clear();

                            AddInline(ReplaceText(chars, temp, text), _fixedInfo);

                            return;
                        }
                        else
                        {
                            if (text.Trim() != "" || _currentInfo.ImplementsStyle(ZStyles.REVERSE_STYLE))
                            {
                                setAbsolute(text, _x, _currentInfo);

                                return;
                            }
                            else
                            {
                                // System.Diagnostics.Debug.WriteLine("Do something about Absolute");

                                // Figure f = new Figure();
                                return;
                            }
                        }
                    }
                }
            }
            else if (_flushMode == TextFlushMode.Overwrite)
            {
                _flushMode = TextFlushMode.Normal;
                throw new Exception("In Overwrite mode");
            }

            if (LastInline != null && LastInline.DisplayInfo.AreSame(_currentInfo))
            {
                LastInline.Text += text;
            }
            else
            {
                AddInline(text, _currentInfo);
            }
        }