Comment updates
[clinton/Virtual-Jaguar-Rx.git] / src / debugger / m68kDasmWin.cpp
index 65542fd..de4fc82 100644 (file)
@@ -10,7 +10,7 @@
 // JPM  06/27/2016  Created this file\r
 // JPM  12/04/2016  Suport ELF debug information\r
 // JPM              Replacing the ELF support by the debugger information manager calls\r
-// JPM   Aug./2020  Display only the code related to the traced function, added different layouts, Qt/HTML text format support\r
+// JPM   Aug./2020  Display only the code related to the traced function, added different layouts & a status bar, Qt/HTML text format support\r
 //\r
 \r
 // STILL TO DO:\r
@@ -28,6 +28,9 @@
 // \r
 m68KDasmWindow::m68KDasmWindow(QWidget * parent/*= 0*/): QWidget(parent, Qt::Dialog),\r
 layout(new QVBoxLayout),\r
+#if MD_LAYOUTFILE == 1\r
+statusbar(new QStatusBar),\r
+#endif\r
 #ifdef MD_LAYOUTTEXTS\r
 text(new QTextBrowser),\r
 #endif\r
@@ -44,6 +47,12 @@ memBase(0)
        layout->addWidget(text);\r
 #endif\r
 \r
+       // Status bar\r
+#if MD_LAYOUTFILE == 1\r
+       layout->addWidget(statusbar);\r
+       setLayout(layout);\r
+#endif\r
+\r
        // Set layout\r
        setLayout(layout);\r
 }\r
@@ -59,7 +68,8 @@ void m68KDasmWindow::RefreshContents(void)
        size_t m68KPCNbrDisasmLines = 0;\r
        char *Symbol = NULL, *LineSrc, *CurrentLineSrc = NULL;\r
        bool m68kPCShow = false;\r
-       bool constant, adr, equal, Error;\r
+       bool constant, adr, equal;\r
+       DBGstatus Status;\r
        size_t j, i;\r
        size_t  nbr = vjs.nbrdisasmlines;\r
        char *PtrFullSource, *CurrentPtrFullSource = (char *)calloc(1, 1);\r
@@ -78,7 +88,7 @@ void m68KDasmWindow::RefreshContents(void)
                adr = constant = equal = false;\r
 \r
                // Display source filename based on the program address\r
-               if (vjs.displayFullSourceFilename && (PtrFullSource = DBGManager_GetFullSourceFilenameFromAdr(oldpc, &Error)) && strcmp(CurrentPtrFullSource, PtrFullSource))\r
+               if (vjs.displayFullSourceFilename && (PtrFullSource = DBGManager_GetFullSourceFilenameFromAdr(oldpc, &Status)) && strcmp(CurrentPtrFullSource, PtrFullSource))\r
                {\r
 #if defined(MD_LAYOUTFILE)\r
                        if (i)\r
@@ -100,15 +110,33 @@ void m68KDasmWindow::RefreshContents(void)
                                CurrentPtrFullSource = (char *)realloc(CurrentPtrFullSource, strlen(PtrFullSource) + 1);\r
                                strcpy(CurrentPtrFullSource, PtrFullSource);\r
 #if defined(MD_LAYOUTFILE)\r
-                               if (!Error)\r
+                               if (Status)\r
                                {\r
-                                       // Referenced filename does exist\r
+                                       // Referenced filename doesn't exist\r
                                        sprintf(string, "<font color='#ff0000'><b>%s</b></font><br>", PtrFullSource);\r
+#if MD_LAYOUTFILE == 1\r
+                                       // Display status bar\r
+                                       if ((Status & DBGSTATUS_OUTDATEDFILE))\r
+                                       {\r
+                                               statusbar->setStyleSheet("background-color: lightyellow; font: bold");\r
+                                               statusbar->showMessage(QString("Outdated source file"));\r
+                                       }\r
+                                       else\r
+                                       {\r
+                                               statusbar->setStyleSheet("background-color: tomato; font: bold");\r
+                                               statusbar->showMessage(QString("Unavailable source file"));\r
+                                       }\r
+#endif\r
                                }\r
                                else\r
                                {\r
-                                       // Referenced filename doesn't exist\r
+                                       // Referenced filename does exist\r
                                        sprintf(string, "<font color='#00ff00'><b>%s</b></font><br>", PtrFullSource);\r
+#if MD_LAYOUTFILE == 1\r
+                                       // Display status bar\r
+                                       statusbar->setStyleSheet("background-color: transparent; font: bold");\r
+                                       statusbar->showMessage(QString(""));\r
+#endif\r
                                }\r
                                nbr++;\r
                                s += QString(string);\r
@@ -118,7 +146,7 @@ void m68KDasmWindow::RefreshContents(void)
                else\r
                {\r
                        // Display line number based on the program address\r
-                       if ((NumLine = DBGManager_GetNumLineFromAdr(oldpc, DBG_NO_TAG)) && ((signed)NumLine > (signed)CurrentNumLine))\r
+                       if ((NumLine = DBGManager_GetNumLineFromAdr(oldpc, DBG_NO_TAG)) && ((signed)NumLine > (signed)CurrentNumLine) && !Status)\r
                        {\r
 #if MD_LAYOUTFILE != 1\r
                                if ((signed)CurrentNumLine < 0)\r