//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 // }
public void UpdateStyles(TextStyle[] styles) { _Styles.Clear(); foreach (TextStyle ts in styles) { _Styles[ts] = ts; if (this.GutterInfo != null && this.GutterInfo.Style.Name.Equals(ts.Name, StringComparison.CurrentCultureIgnoreCase)) { this.GutterInfo.Style = ts; } foreach (BlockType bt in this.Blocks) { if (bt.Style != null && !string.IsNullOrEmpty(bt.Style.Name) && bt.Style.Name.Equals(ts.Name, StringComparison.CurrentCultureIgnoreCase)) { bt.Style = ts; } foreach (Scope current in bt.ScopePatterns) { if (current.Style != null && !string.IsNullOrEmpty(current.Style.Name) && current.Style.Name.Equals(ts.Name, StringComparison.CurrentCultureIgnoreCase)) { current.Style = ts; } } foreach (PatternList current in bt.KeywordsList) { if (current.Style != null && !string.IsNullOrEmpty(current.Style.Name) && current.Style.Name.Equals(ts.Name, StringComparison.CurrentCultureIgnoreCase)) { current.Style = ts; } } foreach (PatternList current in bt.OperatorsList) { if (current.Style != null && !string.IsNullOrEmpty(current.Style.Name) && current.Style.Name.Equals(ts.Name, StringComparison.CurrentCultureIgnoreCase)) { current.Style = ts; } } } } if (StyleUpdated != null) { StyleUpdated(this, EventArgs.Empty); } }
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; } }*/ }
//done private TextStyle GetStyle(string Name) { if (_Styles[Name] == null) { TextStyle s = new TextStyle(); _Styles.Add(Name, s); } return (TextStyle)_Styles[Name]; }
//done private TextStyle GetStyle(string Name) { if (_Styles.ContainsKey(Name) == false) { TextStyle s = new TextStyle(); _Styles.Add(Name, s); } return (TextStyle)_Styles[Name]; }
public object Clone() { TextStyle ts = new TextStyle(); _Cloning = true; ts._Cloning = true; try { ts.Change = this.Change; ts.BorderColor = this.BorderColor; ts.BackColor = this.BackColor; ts.DefaultBackColor = this.DefaultBackColor; ts.Bold = this.Bold; ts.ForeColor = this.ForeColor; ts.DefaultForeColor = this.DefaultForeColor; ts.Italic = this.Italic; ts.Underline = this.Underline; ts.Name = this.Name; } finally { ts._Cloning = false; _Cloning = false; } return ts; }
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 ("&","&"); text=text.Replace ("<","<"); text=text.Replace (">",">"); text=text.Replace (" "," "); text=text.Replace ("\t"," "); Out (text); if (s!=null) { Out("</span>"); if (s.Italic) Out("</i>"); if (s.Bold) Out("</b>"); } }
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); }
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; }