void OnDoubleClick() { TreeModel model; TreeIter iter; if (!tree.Selection.GetSelected(out model, out iter)) { return; } GLib.Value value = new GLib.Value(); model.GetValue(iter, 4, ref value); object item = value.Val; if (item is MethodItem) { MethodItem method = (MethodItem)item; SourceWindow sourceView = ShowSourceFor(method.ParentClass); sourceView.CenterOnMethod(method); } else { TreePath treePath = model.GetPath(iter); if (tree.GetRowExpanded(treePath)) { tree.CollapseRow(treePath); } else { tree.ExpandRow(treePath, false); } } }
void OnDoubleClick() { TreeModel model; TreeIter iter; if (!tree.Selection.GetSelected(out model, out iter)) { return; } GLib.Value value = new GLib.Value(); model.GetValue(iter, 4, ref value); object item = value.Val; if (item is MethodItem) { MethodItem method = (MethodItem)item; SourceWindow sourceView = ShowSourceFor(method.ParentClass); sourceView.CenterOnMethod(method); } else { if (tree.ExpandRow(model.GetPath(iter), true)) { // LAME: This seems to collapse the entire tree... tree.CollapseRow(model.GetPath(iter)); } else { tree.ExpandRow(model.GetPath(iter), false); } } }
private void OnShowSource(object sender, CoverageView.ShowSourceEventArgs e) { foreach (Widget widget in notebook1.Children) { SourceWindow notebookSourceWindow = widget as SourceWindow; if (notebookSourceWindow == null) continue; if (notebookSourceWindow.classItem.Model.sourceFile.sourceFile != e.methodItem.ParentClass.Model.sourceFile.sourceFile) continue; notebook1.CurrentPage = notebook1.PageNum (notebookSourceWindow); notebookSourceWindow.CenterOnMethod (e.methodItem); return; } SourceWindow sourceWindow = new SourceWindow (e.methodItem.ParentClass); sourceWindow.CenterOnMethod (e.methodItem); string sourceFile = e.methodItem.ParentClass.Model.sourceFile.sourceFile; sourceFile = Path.GetFileName (sourceFile); NotebookTabLabel notebookTabLabel = new NotebookTabLabel (sourceFile); int index = notebook1.AppendPage (sourceWindow, notebookTabLabel); notebook1.CurrentPage = index; notebookTabLabel.CloseClicked += delegate(object obj, EventArgs eventArgs) { notebook1.CurrentPage = notebook1.PageNum (sourceWindow); OnCloseTab (this, EventArgs.Empty); }; }