Exemple #1
0
        //public static char[] Parse(string text,string separators)
        //{
        //    //string Result="";
        //    System.Text.StringBuilder Result=new System.Text.StringBuilder ();
        //    text= " " + text +" ";

        //    char c;

        //    for(int i = 0; i <text.Length;i++)
        //    {
        //        c = text[i];
        //        if (separators.IndexOf (c)>=0 )
        //            Result.Append (' ');
        //        else
        //            Result.Append ('.');
        //    }

        //    return Result.ToString().ToCharArray ();
        //}



        public static void AddPatternString(string text, Row row, Pattern pattern, TextStyle style, Segment segment, bool hasError)
        {
            Word x = row.Add(text);
            x.Style = style;
            x.Pattern = pattern;
            x.HasError = hasError;
            x.Segment = segment;
        }
		public TextStyleDesignerDialog(TextStyle Style)
		{
			this._Style = Style;
			this._TmpStyle = (TextStyle) Style.Clone();

			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			this.pgStyles.SelectedObject = this._TmpStyle;
			lblCaption.Text = _Style.ToString();
			PreviewStyle();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}
Exemple #3
0
		public object Clone()
		{
			TextStyle ts = new TextStyle();
			ts.BackColor = this.BackColor;
			ts.Bold = this.Bold;
			ts.ForeColor = this.ForeColor;
			ts.Italic = this.Italic;
			ts.Underline = this.Underline;
			ts.Name = this.Name;
			return ts;
		}
Exemple #4
0
		public BlockType()
		{
			this.KeywordsList = new PatternListList(this);
			this.OperatorsList = new PatternListList(this);

			Style = new TextStyle();
			KeywordsList.Parent = this;
			KeywordsList.IsKeyword = true;
			OperatorsList.Parent = this;
			OperatorsList.IsOperator = true;
			ScopePatterns = new ScopeCollection(this);
		}
Exemple #5
0
		public unsafe static void AddString(string text,Row row,TextStyle style,Segment segment)
		{
            if (text == "")
                return;

            string[] spl = WordSplitter.Split(text);

            string w = null;

            for (int i = 0; i < spl.Length; i++)
            {
                w = spl[i];
                Word word = row.Add(w);
                word.Style = style;
                word.Segment = segment;

                if (w == " ")
                {
                    word.Type = WordType.xtSpace;
                }
                else if (w == "\t")
                {
                    word.Type = WordType.xtTab;
                }
            }

			/*if (Text=="")
				return;

			System.Text.StringBuilder CurrentWord=new System.Text.StringBuilder();

			char[] Buff=Text.ToCharArray();

			fixed (char* c = &Buff[0])
			{
				for (int i=0;i<Text.Length;i++)
				{
					if (c[i]==' ' || c[i]=='\t')
					{

						if (CurrentWord.Length != 0)
						{
							Word word = Row.Add (CurrentWord.ToString ());
							word.Style =Style;
							word.Segment =Segment;
							CurrentWord =new System.Text.StringBuilder();
						}

						Word ws=Row.Add (c[i].ToString ());
						if (c[i]==' ')
							ws.Type= WordType.xtSpace;
						else
							ws.Type= WordType.xtTab;
						ws.Style = Style ;
						ws.Segment = Segment;					
					}
					else
						CurrentWord.Append (c[i].ToString ());					
				}
				if (CurrentWord.Length  != 0)
				{
					Word word=Row.Add (CurrentWord.ToString ());
					word.Style =Style;
					word.Segment =Segment;				
				}	
			}*/
		}
Exemple #6
0
        //done
        private TextStyle GetStyle(string Name)
        {
            if (_Styles[Name] == null)
            {
                TextStyle s = new TextStyle();
                _Styles.Add(Name, s);
            }

            return (TextStyle)_Styles[Name];
        }
Exemple #7
0
		private void write(string text,TextStyle s)
		{
			if (s!=null)
			{
				if (s.Bold)
					Out("<b>");
				if (s.Italic)
					Out("<i>");
				if (s.Transparent)
					Out("<span style=\"color:" + GetHTMLColor(s.ForeColor) + "\">");
				else
					Out("<span style=\"color:" + GetHTMLColor(s.ForeColor) + ";background-color:" + GetHTMLColor(s.BackColor) + ";\">");
			}

			text=text.Replace ("&","&amp;");
			text=text.Replace ("<","&lt;");
			text=text.Replace (">","&gt;");
			text=text.Replace (" ","&nbsp;");
			text=text.Replace ("\t","&nbsp;&nbsp;&nbsp;&nbsp;");
			Out (text);

			if (s!=null)
			{				
				Out("</span>");

				if (s.Italic)
					Out("</i>");
				if (s.Bold)
					Out("</b>");
			}
		}