public void OpenDocumentAndGotoLine(Project MarkProject, DocumentInfo Document, int Line, int CharIndex, int Length) { if (Core.MainForm.InvokeRequired) { Core.MainForm.Invoke(new OpenDocumentAndGotoLineCallback(OpenDocumentAndGotoLine), new object[] { MarkProject, Document, Line, CharIndex, Length }); return; } if (CharIndex < 0) { CharIndex = 0; } if (Document != null) { var baseDoc = Core.Navigating.FindDocumentByPath(Document.FullPath); if (baseDoc != null) { baseDoc.Show(); baseDoc.SetCursorToLine(Line, CharIndex, true); if (Length > 0) { baseDoc.SelectText(Line, CharIndex, Length); } return; } } if (MarkProject != null) { string inPath = Document.FullPath.Replace("\\", "/"); foreach (ProjectElement element in MarkProject.Elements) { if (GR.Path.IsPathEqual(GR.Path.Append(MarkProject.Settings.BasePath, element.Filename), inPath)) { BaseDocument doc = MarkProject.ShowDocument(element); if (doc != null) { doc.SetCursorToLine(Line, CharIndex, true); if (Length > 0) { doc.SelectText(Line, CharIndex, Length); } } return; } } } if (Document.FullPath.Length > 0) { // file is not part of project BaseDocument newDoc = Core.MainForm.OpenFile(Document.FullPath); if (newDoc != null) { bool setFromMainDoc = false; if ((!setFromMainDoc) && (Core.Compiling.ParserASM.ASMFileInfo.ContainsFile(newDoc.DocumentInfo.FullPath))) { if (!Core.Compiling.IsCurrentlyBuilding()) { newDoc.DocumentInfo.SetASMFileInfo(Core.Compiling.ParserASM.ASMFileInfo, Core.Compiling.ParserASM.KnownTokens(), Core.Compiling.ParserASM.KnownTokenInfo()); } } //Debug.Log( "m_Outline.RefreshFromDocument after showdoc" ); //Core.MainForm.m_Outline.RefreshFromDocument( newDoc.DocumentInfo.BaseDoc ); newDoc.SetCursorToLine(Line, CharIndex, true); if (Length > 0) { newDoc.SelectText(Line, CharIndex, Length); } } } }