Exemple #1
0
        public void GotoDeclaration(DocumentInfo ASMDoc, string Word, string Zone, string CheapLabelParent)
        {
            Types.ASM.FileInfo fileToDebug = DetermineASMFileInfo(ASMDoc);

            Types.SymbolInfo tokenInfo = fileToDebug.TokenInfoFromName(Word, Zone, CheapLabelParent);
            if (tokenInfo == null)
            {
                fileToDebug = ASMDoc.ASMFileInfo;
                tokenInfo   = ASMDoc.ASMFileInfo.TokenInfoFromName(Word, Zone, CheapLabelParent);
            }
            if (tokenInfo != null)
            {
                string documentFile = "";
                int    documentLine = -1;
                if ((tokenInfo.LineIndex == 0) &&
                    (!string.IsNullOrEmpty(tokenInfo.DocumentFilename)))
                {
                    // try stored info first
                    OpenDocumentAndGotoLine(ASMDoc.Project, tokenInfo.DocumentFilename, tokenInfo.LocalLineIndex);
                    return;
                }

                if (fileToDebug.FindTrueLineSource(tokenInfo.LineIndex, out documentFile, out documentLine))
                {
                    OpenDocumentAndGotoLine(ASMDoc.Project, documentFile, documentLine);
                }
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("Could not determine item source");
            }
        }
Exemple #2
0
        internal void OpenSourceOfNextMessage()
        {
            if (CompileMessages == null)
            {
                return;
            }

            if (LastShownMessageIndex == -1)
            {
                LastShownMessageIndex = 0;
            }
            else
            {
                ++LastShownMessageIndex;
            }
            if (LastShownMessageIndex >= CompileMessages.Count)
            {
                LastShownMessageIndex = -1;
                return;
            }

            int offset = LastShownMessageIndex;

            foreach (var message in CompileMessages)
            {
                if (offset == 0)
                {
                    int lineNumber = message.Key;

                    string documentFile = "";
                    int    documentLine = -1;
                    ASMInfo.FindTrueLineSource(lineNumber, out documentFile, out documentLine);

                    if (!string.IsNullOrEmpty(message.Value.AlternativeFile))
                    {
                        documentFile = message.Value.AlternativeFile;
                        documentLine = message.Value.AlternativeLineIndex;
                    }

                    OpenDocumentAndGotoLine(Project, FindDocumentInfoByPath(documentFile), documentLine);
                    return;
                }
                --offset;
            }
        }
Exemple #3
0
        private void AddReferenceItem(Project Project, Types.ASM.FileInfo ASMInfo, int GlobalLineIndex)
        {
            var item = new ListViewItem(GlobalLineIndex.ToString());

            item.SubItems.Add("");
            item.SubItems.Add("");

            if (ASMInfo.FindTrueLineSource(GlobalLineIndex, out string filename, out int localLineIndex, out Types.ASM.SourceInfo SourceInfo))
            {
                item.SubItems[0].Text = (localLineIndex + 1).ToString();
                item.SubItems[1].Text = filename;

                if (Project != null)
                {
                    var element = Project.GetElementByFilename(filename);
                    if (element != null)
                    {
                        if (element.DocumentInfo != null)
                        {
                            item.Tag = element.DocumentInfo;
                        }

                        if (element.Document != null)
                        {
                            if ((localLineIndex >= 0) &&
                                (localLineIndex < element.Document.SourceControl.LinesCount))
                            {
                                item.SubItems[2].Text = element.Document.SourceControl.GetLine(localLineIndex).Text;
                            }
                        }
                        else
                        {
                            // fetch line from file
                            string textFromElement = Core.Searching.GetDocumentInfoText(element.DocumentInfo);

                            string line = FindLineInsideText(textFromElement, localLineIndex);

                            item.SubItems[2].Text = line;
                        }
                    }
                }
                else
                {
                    var doc = Core.Navigating.FindDocumentInfoByPath(filename);
                    if (doc != null)
                    {
                        item.Tag = doc;
                    }
                    if ((doc != null) &&
                        (doc.BaseDoc != null))
                    {
                        if ((localLineIndex >= 0) &&
                            (localLineIndex < doc.BaseDoc.SourceControl.LinesCount))
                        {
                            item.SubItems[2].Text = doc.BaseDoc.SourceControl.GetLine(localLineIndex).Text;
                        }
                    }
                }
            }
            listResults.Items.Add(item);
        }