Example #1
0
		/// <summary>
		/// Get the object, which was inserted under the keyword (line, at offset, with length length),
		/// returns null, if no such keyword was inserted.
		/// </summary>
		public object this[SyntaxDocument document, Word line, int offset, int length] {
			get {
				if(length == 0) {
					return null;
				}
                //Node next = root;
				
                //int wordOffset = line.Offset + offset;
                //if (casesensitive) {
                //    for (int i = 0; i < length; ++i) {
                //        int index = ((int)document.GetCharAt(wordOffset + i)) % 256;
                //        next = next.leaf[index];
						
                //        if (next == null) {
                //            return null;
                //        }
						
                //        if (next.color != null && TextUtility.RegionMatches(document, wordOffset, length, next.word)) {
                //            return next.color;
                //        }
                //    }
                //} else {
                //    for (int i = 0; i < length; ++i) {
                //        int index = ((int)Char.ToUpper(document.GetCharAt(wordOffset + i))) % 256;
						
                //        next = next.leaf[index];
						
                //        if (next == null) {
                //            return null;
                //        }
						
                //        if (next.color != null && TextUtility.RegionMatches(document, casesensitive, wordOffset, length, next.word)) {
                //            return next.color;
                //        }
                //    }
                //}
				return null;
			}
		}
		public SourceCodePrintDocument(SyntaxDocument document) : base()
		{
			this.Document = document;
		}
Example #3
0
		public FormatRangeCollection(SyntaxDocument document)
		{
			_Document = document;
		}
 public static void Init(DataGridView dgv, 
     SyntaxDocument s, 
     Dictionary<VBALogLevelFlag, Image> levelpics,
     ToolStripButton starttest,
     ToolStripButton singlesteptest,
     ToolStripButton stoptest
     )
 {
     ms_dgv = dgv;
     ms_scripteditor = s;
     ms_levelpics = levelpics;
     ms_starttest = starttest;
     ms_singlesteptest = singlesteptest;
     ms_stoptest = stoptest;
 }
Example #5
0
		/// <summary>
		/// Exports the content of a SyntaxDocument to a HTML formatted string
		/// </summary>
		/// <param name="doc">SyntaxDocument object to export from</param>
		/// <param name="BGColor">HTML color string to use as background color</param>
		/// <param name="ImagePath">File path tho the images to use in the HTML string</param>
		/// <param name="Style">HTML style string that should be applied to the output</param>
		/// <returns></returns>
		public string Export(SyntaxDocument doc,System.Drawing.Color BGColor,string ImagePath,string Style)
		{
			
			sb=new System.Text.StringBuilder ();
			doc.ParseAll (true);
			int i=0;
			
			string guid=DateTime.Now.Ticks.ToString ();
			
			//style=\"font-family:courier new;font-size:13px;\"
			if (BGColor.A ==0)
				Out("<table  ><tr><td nowrap><div style=\""+ Style +"\">");
			else
				Out("<table  style=\"background-color:" + GetHTMLColor (BGColor) + ";" + Style + "\"><tr><td nowrap><div>");
			foreach (Row r in doc)
			{
				i++;
				if (r.CanFold)
				{
					RenderCollapsed(r.VirtualCollapsedRow,r,i,ImagePath,guid);
					Out("<div style=\"display:block;\" id=\"open" + guid+"_"+i.ToString () + "\">");

					string img="minus.gif";
					try
					{
						if (r.Expansion_StartSegment.Parent.Parent  == null)
							img = "minusNoTopLine.gif";
					}
					catch
					{
					}
					Out ("<img src=\"" + ImagePath + img + "\" align=top onclick=\"open" + guid+"_"+i.ToString () +".style.display='none'; closed" + guid+"_"+i.ToString () +".style.display='block'; \">");
				}
				else
				{
					if (r.CanFoldEndPart)
					{
						Out ("<img src=\"" + ImagePath + "L.gif\"  align=top>");
					}
					else
					{
						if (r.HasExpansionLine)
						{
							Out ("<img src=\"" + ImagePath + "I.gif\"  align=top>");
						}
						else
						{
							Out ("<img src=\"" + ImagePath + "clear.gif\"  align=top>");
						}
					}
				}
				foreach (Word w in r)
				{
					write (w.Text,w.Style);
				}
				if (r.CanFoldEndPart)
					Out("</div>\n");
				else
					Out("<br>\n");				
			}
			Out("</div></td></tr></table>");

			return this.sb.ToString ();
		}
Example #6
0
		/// <summary>
		/// Exports the content of a SyntaxDocument to a HTML formatted string
		/// </summary>
		/// <param name="doc">SyntaxDocument object to export from</param>
		/// <param name="ImagePath">File path tho the images to use in the HTML string</param>
		/// <returns></returns>
		public string Export(SyntaxDocument doc,string ImagePath)
		{
			return this.Export (doc,System.Drawing.Color.Transparent, ImagePath,"");
		}
		public void AttachDocument(SyntaxDocument document)
		{
			//_Document=document;

			if (_Document != null)
			{
				_Document.ParsingCompleted -= new EventHandler(this.OnParsingCompleted);
				_Document.Parsing -= new EventHandler(this.OnParse);
				_Document.Change -= new EventHandler(this.OnChange);
			}

			if (document == null)
				document = new SyntaxDocument();

			_Document = document;

			if (this._Document != null)
			{
				_Document.ParsingCompleted += new EventHandler(this.OnParsingCompleted);
				_Document.Parsing += new EventHandler(this.OnParse);
				_Document.Change += new EventHandler(this.OnChange);
			}
            
			this.Redraw();
		}