public void OpenDocumentAndGotoLine(Project MarkProject, DocumentInfo Document, int Line) { if (Core.MainForm.InvokeRequired) { Core.MainForm.Invoke(new OpenDocumentAndGotoLineCallback(OpenDocumentAndGotoLine), new object[] { MarkProject, Document, Line }); return; } if (Document != null) { var baseDoc = Core.Navigating.FindDocumentByPath(Document.FullPath); if (baseDoc != null) { baseDoc.Show(); baseDoc.SetCursorToLine(Line, true); 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, true); } 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, true); } } }
public void OpenDocumentAndGotoLine(Project MarkProject, string DocumentFilename, int Line) { if (Core.MainForm.InvokeRequired) { Core.MainForm.Invoke(new OpenDocumentAndGotoLineCallback(OpenDocumentAndGotoLine), new object[] { MarkProject, DocumentFilename, Line }); return; } string inPath = DocumentFilename.Replace("\\", "/"); foreach (IDockContent dockContent in Core.MainForm.panelMain.Documents) { BaseDocument baseDoc = (BaseDocument)dockContent; if (baseDoc.DocumentInfo.FullPath == null) { continue; } string myPath = baseDoc.DocumentInfo.FullPath.Replace("\\", "/"); if (String.Compare(myPath, inPath, true) == 0) { baseDoc.Show(); baseDoc.SetCursorToLine(Line, true); return; } } if (MarkProject != null) { 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, true); } return; } } } if (DocumentFilename.Length > 0) { // file is not part of project BaseDocument newDoc = Core.MainForm.OpenFile(DocumentFilename); if (newDoc != null) { newDoc.SetCursorToLine(Line, true); } } }