public void Append(string str, StringStyle style, bool force_button)
 {
     if (BufferStrLength > 2000)
         return;
     if (force_button)
         fromCssToButton();
     if ((builder.Length == 0) || (lastStringStyle == style))
     {
         if (builder.Length > 2000)
             return;
         if (builder.Length + str.Length > 2000)
             str = str.Substring(0, 2000 - builder.Length) + "※※※バッファーの文字数が2000字(全角1000字)を超えています。これ以降は表示できません※※※";
         builder.Append(str);
         lastStringStyle = style;
     }
     else
     {
         stringList.Add(new ConsoleStyledString(builder.ToString(), lastStringStyle));
         builder.Remove(0, builder.Length);
         builder.Append(str);
         lastStringStyle = style;
     }
     if (force_button)
         fromCssToButton();
 }
Example #2
0
 public void Append(string str, StringStyle style, bool force_button)
 {
     if (BufferStrLength > 2000)
     {
         return;
     }
     if (force_button)
     {
         fromCssToButton();
     }
     if ((builder.Length == 0) || (lastStringStyle == style))
     {
         if (builder.Length > 2000)
         {
             return;
         }
         if (builder.Length + str.Length > 2000)
         {
             str = str.Substring(0, 2000 - builder.Length) + "※※※バッファーの文字数が2000字(全角1000字)を超えています。これ以降は表示できません※※※";
         }
         builder.Append(str);
         lastStringStyle = style;
     }
     else
     {
         m_stringList.Add(new ConsoleStyledString(builder.ToString(), lastStringStyle));
         builder.Remove(0, builder.Length);
         builder.Append(str);
         lastStringStyle = style;
     }
     if (force_button)
     {
         fromCssToButton();
     }
 }
Example #3
0
        private static string getClosingStyleStartingTag(StringStyle style)
        {
            bool fontChanged = !((style.Fontname == null || style.Fontname == Config.FontName) && !style.ColorChanged && (style.ButtonColor == Config.FocusColor));

            if (!fontChanged && style.FontStyle == FontStyle.Regular)
            {
                return("");
            }
            StringBuilder b = new StringBuilder();

            if (style.FontStyle != FontStyle.Regular)
            {
                if ((style.FontStyle & FontStyle.Bold) != FontStyle.Regular)
                {
                    b.Append("</b>");
                }
                if ((style.FontStyle & FontStyle.Italic) != FontStyle.Regular)
                {
                    b.Append("</i>");
                }
                if ((style.FontStyle & FontStyle.Underline) != FontStyle.Regular)
                {
                    b.Append("</u>");
                }
                if ((style.FontStyle & FontStyle.Strikeout) != FontStyle.Regular)
                {
                    b.Append("</s>");
                }
            }
            if (fontChanged)
            {
                b.Append("</font>");
            }
            return(b.ToString());
        }
Example #4
0
        private static string getStringStyleStartingTag(StringStyle style)
        {
            var fontChanged = !((style.Fontname == null || style.Fontname == Config.FontName) && !style.ColorChanged &&
                                style.ButtonColor == Config.FocusColor);

            if (!fontChanged && style.FontStyle == FontStyle.Regular)
            {
                return("");
            }
            var b = new StringBuilder();

            if (fontChanged)
            {
                b.Append("<font");
                if (style.Fontname != null && style.Fontname != Config.FontName)
                {
                    b.Append(" face='");
                    b.Append(Escape(style.Fontname));
                    b.Append("'");
                }
                if (style.ColorChanged)
                {
                    b.Append(" color='#");
                    var colorValue = style.Color.R * 0x10000 + style.Color.G * 0x100 + style.Color.B;
                    b.Append(colorValue.ToString("X6"));
                    b.Append("'");
                }
                if (style.ButtonColor != Config.FocusColor)
                {
                    b.Append(" bcolor='#");
                    var colorValue = style.ButtonColor.R * 0x10000 + style.ButtonColor.G * 0x100 + style.ButtonColor.B;
                    b.Append(colorValue.ToString("X6"));
                    b.Append("'");
                }
                b.Append(">");
            }
            if (style.FontStyle != FontStyle.Regular)
            {
                if ((style.FontStyle & FontStyle.Strikeout) != FontStyle.Regular)
                {
                    b.Append("<s>");
                }
                if ((style.FontStyle & FontStyle.Underline) != FontStyle.Regular)
                {
                    b.Append("<u>");
                }
                if ((style.FontStyle & FontStyle.Italic) != FontStyle.Regular)
                {
                    b.Append("<i>");
                }
                if ((style.FontStyle & FontStyle.Bold) != FontStyle.Regular)
                {
                    b.Append("<b>");
                }
            }

            return(b.ToString());
        }
Example #5
0
        public override bool Equals(object obj)
        {
            if ((obj == null) || (!(obj is StringStyle)))
            {
                return(false);
            }
            StringStyle ss = (StringStyle)obj;

            return((this.Color == ss.Color) && (this.ButtonColor == ss.ButtonColor) && (this.ColorChanged == ss.ColorChanged) && (this.FontStyle == ss.FontStyle) && (this.Fontname.Equals(ss.Fontname, Config.SCIgnoreCase)));
        }
 public ConsoleStyledString(string str, StringStyle style)
 {
     //if ((StaticConfig.TextDrawingMode != TextDrawingMode.GRAPHICS) && (str.IndexOf('\t') >= 0))
     //    str = str.Replace("\t", "");
     this.Str = str;
     Font = Config.GetFont(style.Fontname, style.FontStyle);
     Color = style.Color;
     colorChanged = (Color != Config.ForeColor);
     PointX = -1;
     Width = -1;
 }
Example #7
0
 public void AppendButton(string str, StringStyle style, long input)
 {
     fromCssToButton();
     m_stringList.Add(new ConsoleStyledString(str, style));
     if (m_stringList.Count == 0)
     {
         return;
     }
     m_buttonList.Add(createButton(m_stringList, input));
     m_stringList.Clear();
 }
Example #8
0
 public void AppendPlainText(string str, StringStyle style)
 {
     fromCssToButton();
     m_stringList.Add(new ConsoleStyledString(str, style));
     if (m_stringList.Count == 0)
     {
         return;
     }
     m_buttonList.Add(createPlainButton(m_stringList));
     m_stringList.Clear();
 }
Example #9
0
 public ConsoleDisplayLine AppendAndFlushErrButton(string str, StringStyle style, string input, ScriptPosition pos, StringMeasure sm)
 {
     fromCssToButton();
     m_stringList.Add(new ConsoleStyledString(str, style));
     if (m_stringList.Count == 0)
     {
         return(null);
     }
     m_buttonList.Add(createButton(m_stringList, input, pos));
     m_stringList.Clear();
     return(FlushSingleLine(sm, false));
 }
Example #10
0
        public void printCustomBar(string barStr)
        {
            if (string.IsNullOrEmpty(barStr))
            {
                throw new CodeEE("空文字列によるDRAWLINEが行われました");
            }
            StringStyle ss = userStyle;

            userStyle.FontStyle = FontStyle.Regular;
            Print(getStBar(barStr));
            userStyle = ss;
        }
Example #11
0
        /// <summary>
        /// DRAWLINE命令に対応。これのフォントを変更できると面倒なことになるのでRegularに固定する。
        /// </summary>
        public void PrintBar()
        {
            //初期に設定済みなので見る必要なし
            //if (stBar == null)
            //    setStBar(StaticConfig.DrawLineString);

            //1806beta001 CompatiDRAWLINEの廃止、CompatiLinefeedAs1739へ移行
            //CompatiLinefeedAs1739の処理はPrintStringBuffer.csで行う
            //if (Config.CompatiDRAWLINE)
            //	PrintFlush(false);
            StringStyle ss = userStyle;

            userStyle.FontStyle = FontStyle.Regular;
            Print(stBar);
            userStyle = ss;
        }
Example #12
0
 public ConsoleStyledString(string str, StringStyle style)
 {
     //if ((StaticConfig.TextDrawingMode != TextDrawingMode.GRAPHICS) && (str.IndexOf('\t') >= 0))
     //    str = str.Replace("\t", "");
     Str         = str;
     StringStyle = style;
     Font        = Config.GetFont(style.Fontname, style.FontStyle);
     if (Font == null)
     {
         Error = true;
         return;
     }
     Color        = style.Color;
     ButtonColor  = style.ButtonColor;
     colorChanged = style.ColorChanged;
     if (!colorChanged && Color != Config.ForeColor)
     {
         colorChanged = true;
     }
     PointX = -1;
     Width  = -1;
 }
Example #13
0
        /// <summary>
        /// DRAWLINE命令に対応。これのフォントを変更できると面倒なことになるのでRegularに固定する。
        /// </summary>
        public void PrintBar()
        {
            //初期に設定済みなので見る必要なし
            //if (stBar == null)
            //    setStBar(StaticConfig.DrawLineString);

            //1806beta001 CompatiDRAWLINEの廃止、CompatiLinefeedAs1739へ移行
            //CompatiLinefeedAs1739の処理はPrintStringBuffer.csで行う
            //if (Config.CompatiDRAWLINE)
            //	PrintFlush(false);
            StringStyle ss = userStyle;
            userStyle.FontStyle = FontStyle.Regular;
            Print(stBar);
            userStyle = ss;
        }
Example #14
0
 public void Append(string str, StringStyle style)
 {
     Append(str, style, false);
 }
Example #15
0
 public void ResetStyle()
 {
     userStyle = defaultStyle;
     alignment = DisplayLineAlignment.LEFT;
 }
 public ConsoleDisplayLine AppendErrButton(string str, StringStyle style, string input, ScriptPosition pos, StringMeasure sm)
 {
     fromCssToButton();
     stringList.Add(new ConsoleStyledString(str, style));
     if (stringList.Count == 0)
         return null;
     buttonList.Add(createButton(stringList, input, pos));
     stringList.Clear();
     setLengthToButtonList(sm);
     ConsoleButtonString[] dispLineButtonArray = new ConsoleButtonString[buttonList.Count];
     buttonList.CopyTo(dispLineButtonArray);
     ConsoleDisplayLine line = new ConsoleDisplayLine(parent, dispLineButtonArray, true, false);
     this.Clear();
     return line;
 }
Example #17
0
 public void printCustomBar(string barStr)
 {
     StringStyle ss = userStyle;
     userStyle.FontStyle = FontStyle.Regular;
     Print(getStBar(barStr));
     userStyle = ss;
 }
Example #18
0
 public void GotoTitle()
 {
     //if (state == ConsoleState.Error)
     //{
     //    MessageBox.Show("エラー発生時はこの機能は使えません");
     //}
     if (timer != null && timer.Enabled)
         stopTimer();
     displayLineList.Clear();
     ClearDisplay();
     logicalLineCount = 0;
     lineNo = 0;
     lastDrawnLineNo = -1;
     if (redraw == ConsoleRedraw.None)
         redraw = ConsoleRedraw.Normal;
     useUserStyle = false;
     userStyle = new StringStyle(Config.ForeColor, FontStyle.Regular, null);
     emuera.BeginTitle();
     state = ConsoleState.WaitKey;
     callEmueraProgram("");
     RefreshStrings(true);
 }
Example #19
0
 public void ResetStyle()
 {
     style = defaultStyle;
     alignment = DisplayLineAlignment.LEFT;
 }
 public void AppendPlainText(string str, StringStyle style)
 {
     fromCssToButton();
     stringList.Add(new ConsoleStyledString(str, style));
     if (stringList.Count == 0)
         return;
     buttonList.Add(createPlainButton(stringList));
     stringList.Clear();
 }
 public void Append(string str, StringStyle style)
 {
     Append(str, style, false);
 }
 public void AppendButton(string str, StringStyle style, string input)
 {
     fromCssToButton();
     stringList.Add(new ConsoleStyledString(str, style));
     if (stringList.Count == 0)
         return;
     buttonList.Add(createButton(stringList,input));
     stringList.Clear();
 }