public void NavTo(EventHandlerItem item) { DocumentLine line = txtScript.Document.GetLineByOffset(item.Location); txtScript.Select(line.Offset, line.Length); txtScript.ScrollToLine(line.LineNumber); }
private void lstItems_SelectionChanged(object sender, SelectionChangedEventArgs e) { EventHandlerItem item = (EventHandlerItem)lstItems.SelectedItem; if (item != null && current_page != null) { current_page.NavTo(item); } }
private void parseEventHandlers() { string pattern = @"\b\s*EventHandler\s+([\w_]+\([^\)]*\))\s*"; MatchCollection matches = Regex.Matches(Script.Data, pattern, RegexOptions.Multiline); // EventHandlerItem item; Items.Clear(); foreach (Match m in matches) { item = new EventHandlerItem(); item.Name = m.Groups[1].Value; item.Location = m.Index; Items.Add(item); } }
public static void ScanGladeFile(string FileName,out String ControlListString, ref Hashtable EventsTable) { StringBuilder ControlList = new StringBuilder(); XmlDocument doc = new XmlDocument(); doc.Load(FileName); XmlNodeList elemList = doc.GetElementsByTagName("widget"); //Scan al widgets for (int i=0; i < elemList.Count; i++) { if (elemList[i].Attributes["class"].Value.Substring(0,3)=="Gtk") { ControlList.AppendFormat("\t[Glade.Widget] {0} {1};\n",elemList[i].Attributes["class"].Value.Substring(3),elemList[i].Attributes["id"].Value); XmlNodeList EventList = doc.GetElementsByTagName("signal"); //Scan all signals for this widget for (int j=0; j < EventList.Count; j++) { string Name = EventList[j].Attributes["name"].Value; string Handler = EventList[j].Attributes["handler"].Value; EventsTable[Handler] = new EventHandlerItem(Name,Handler); } } else Console.WriteLine("Unsupported control : {0}, ignoring",elemList[i].Attributes["class"].Value); } ControlListString = ControlList.ToString(); }