-//
-// allwatch.cpp - All Watch
-//
-// by Jean-Paul Mari
-//
-// JPM = Jean-Paul Mari <djipi.mari@gmail.com>
-//
-// Who When What
-// --- ---------- -----------------------------------------------------------
-// JPM 12/07/2017 Created this file
-//
-
-// STILL TO DO:
-//
-
-#include "debugger/allwatchbrowser.h"
-#include "memory.h"
-#include "debugger/DBGManager.h"
-
-
-AllWatchBrowserWindow::AllWatchBrowserWindow(QWidget * parent/*= 0*/) : QWidget(parent, Qt::Dialog),
- layout(new QVBoxLayout), text(new QTextBrowser),
-// layout(new QVBoxLayout), text(new QLabel),
-// refresh(new QPushButton(tr("Refresh"))),
-// address(new QLineEdit),
-// go(new QPushButton(tr("Go"))),
-// memBase(0),
- NbWatch(0),
- PtrWatchInfo(NULL)
-{
- setWindowTitle(tr("All Watch"));
-
-// address->setInputMask("hhhhhh");
-// QHBoxLayout * hbox1 = new QHBoxLayout;
-// hbox1->addWidget(refresh);
-// hbox1->addWidget(address);
-// hbox1->addWidget(go);
-
- // Need to set the size as well...
-// resize(560, 480);
-
- QFont fixedFont("Lucida Console", 8, QFont::Normal);
-// QFont fixedFont("", 8, QFont::Normal);
- fixedFont.setStyleHint(QFont::TypeWriter);
- text->setFont(fixedFont);
-//// layout->setSizeConstraint(QLayout::SetFixedSize);
- setLayout(layout);
-
- layout->addWidget(text);
-// layout->addWidget(refresh);
-// layout->addLayout(hbox1);
-
-// connect(refresh, SIGNAL(clicked()), this, SLOT(RefreshContents()));
-// connect(go, SIGNAL(clicked()), this, SLOT(GoToAddress()));
-}
-
-
-//
-AllWatchBrowserWindow::~AllWatchBrowserWindow(void)
-{
- NbWatch = 0;
- free(PtrWatchInfo);
-}
-
-
-//
-void AllWatchBrowserWindow::RefreshContents(void)
-{
- char string[1024];
-// char buf[64];
- QString WatchAll;
-
- if (isVisible())
- {
- if (!NbWatch)
- {
- if (NbWatch = DBGManager_GetNbExternalVariables())
- {
- PtrWatchInfo = (WatchInfo *)calloc(NbWatch, sizeof(WatchInfo));
-#ifdef _MSC_VER
-#pragma message("Warning: !!! Need to check the memory desalocation for PtrWatchInfo !!!")
-#else
- #warning "!!! Need to do the memory desalocation for PtrWatchInfo !!!"
-#endif // _MSC_VER
-
- for (uint32_t i = 0; i < NbWatch; i++)
- {
- PtrWatchInfo[i].PtrVariableName = DBGManager_GetExternalVariableName(i + 1);
- PtrWatchInfo[i].addr = DBGManager_GetExternalVariableAdr(i + 1);
- PtrWatchInfo[i].TypeTag = DBGManager_GetExternalVariableTypeTag(i + 1);
- if (!strlen(PtrWatchInfo[i].PtrVariableBaseTypeName = DBGManager_GetExternalVariableTypeName(i + 1)))
- {
- PtrWatchInfo[i].PtrVariableBaseTypeName = (char *)"<font color='#ff0000'>N/A</font>";
- }
- }
- }
- }
-
- for (uint32_t i = 0; i < NbWatch; i++)
- {
- if (PtrWatchInfo[i].PtrVariableName && PtrWatchInfo[i].PtrVariableBaseTypeName)
- {
- sprintf(string, "%i : %s | %s | 0x%06X | %s", (i + 1), PtrWatchInfo[i].PtrVariableBaseTypeName, PtrWatchInfo[i].PtrVariableName, (unsigned int)PtrWatchInfo[i].addr, (PtrWatchInfo[i].TypeTag & 0x8) ? "" : DBGManager_GetExternalVariableValue(i + 1));
- WatchAll += QString(string);
- sprintf(string, "<br>");
- WatchAll += QString(string);
- }
- }
-
- text->clear();
- text->setText(WatchAll);
- }
-}
-
-
-#if 0
-void AllWatchBrowserWindow::keyPressEvent(QKeyEvent * e)
-{
- if (e->key() == Qt::Key_Escape)
- hide();
- else if (e->key() == Qt::Key_PageUp)
- {
- memBase -= 480;
-
- if (memBase < 0)
- memBase = 0;
-
- RefreshContents();
- }
- else if (e->key() == Qt::Key_PageDown)
- {
- memBase += 480;
-
- if (memBase > (0x200000 - 480))
- memBase = 0x200000 - 480;
-
- RefreshContents();
- }
- else if (e->key() == Qt::Key_Up || e->key() == Qt::Key_Minus)
- {
- memBase -= 16;
-
- if (memBase < 0)
- memBase = 0;
-
- RefreshContents();
- }
- else if (e->key() == Qt::Key_Down || e->key() == Qt::Key_Equal)
- {
- memBase += 16;
-
- if (memBase > (0x200000 - 480))
- memBase = 0x200000 - 480;
-
- RefreshContents();
- }
-}
-#endif
-
-
-#if 0
-void AllWatchBrowserWindow::GoToAddress(void)
-{
- bool ok;
- QString newAddress = address->text();
- memBase = newAddress.toUInt(&ok, 16);
- RefreshContents();
-}
-#endif
-
+//\r
+// allwatchbrowser.cpp - All Watch\r
+//\r
+// by Jean-Paul Mari\r
+//\r
+// JPM = Jean-Paul Mari <djipi.mari@gmail.com>\r
+//\r
+// Who When What\r
+// --- ---------- -----------------------------------------------------------\r
+// JPM 12/07/2017 Created this file\r
+//\r
+\r
+// STILL TO DO:\r
+//\r
+\r
+#include "debugger/allwatchbrowser.h"\r
+#include "memory.h"\r
+#include "debugger/DBGManager.h"\r
+\r
+\r
+AllWatchBrowserWindow::AllWatchBrowserWindow(QWidget * parent/*= 0*/) : QWidget(parent, Qt::Dialog),\r
+ layout(new QVBoxLayout), text(new QTextBrowser),\r
+// layout(new QVBoxLayout), text(new QLabel),\r
+// refresh(new QPushButton(tr("Refresh"))),\r
+// address(new QLineEdit),\r
+// go(new QPushButton(tr("Go"))),\r
+// memBase(0),\r
+ NbWatch(0),\r
+ PtrWatchInfo(NULL)\r
+{\r
+ setWindowTitle(tr("All Watch"));\r
+\r
+// address->setInputMask("hhhhhh");\r
+// QHBoxLayout * hbox1 = new QHBoxLayout;\r
+// hbox1->addWidget(refresh);\r
+// hbox1->addWidget(address);\r
+// hbox1->addWidget(go);\r
+\r
+ // Need to set the size as well...\r
+// resize(560, 480);\r
+\r
+ QFont fixedFont("Lucida Console", 8, QFont::Normal);\r
+// QFont fixedFont("", 8, QFont::Normal);\r
+ fixedFont.setStyleHint(QFont::TypeWriter);\r
+ text->setFont(fixedFont);\r
+//// layout->setSizeConstraint(QLayout::SetFixedSize);\r
+ setLayout(layout);\r
+\r
+ layout->addWidget(text);\r
+// layout->addWidget(refresh);\r
+// layout->addLayout(hbox1);\r
+\r
+// connect(refresh, SIGNAL(clicked()), this, SLOT(RefreshContents()));\r
+// connect(go, SIGNAL(clicked()), this, SLOT(GoToAddress()));\r
+}\r
+\r
+\r
+//\r
+AllWatchBrowserWindow::~AllWatchBrowserWindow(void)\r
+{\r
+ NbWatch = 0;\r
+ free(PtrWatchInfo);\r
+}\r
+\r
+\r
+//\r
+void AllWatchBrowserWindow::RefreshContents(void)\r
+{\r
+ char string[1024];\r
+// char buf[64];\r
+ QString WatchAll;\r
+\r
+ if (isVisible())\r
+ {\r
+ if (!NbWatch)\r
+ {\r
+ if (NbWatch = DBGManager_GetNbGlobalVariables())\r
+ {\r
+ PtrWatchInfo = (WatchInfo *)calloc(NbWatch, sizeof(WatchInfo));\r
+#ifdef _MSC_VER\r
+#pragma message("Warning: !!! Need to check the memory desalocation for PtrWatchInfo !!!")\r
+#else\r
+ #warning "!!! Need to do the memory desalocation for PtrWatchInfo !!!"\r
+#endif // _MSC_VER\r
+ \r
+ for (uint32_t i = 0; i < NbWatch; i++)\r
+ {\r
+ PtrWatchInfo[i].PtrVariableName = DBGManager_GetGlobalVariableName(i + 1);\r
+ PtrWatchInfo[i].addr = DBGManager_GetGlobalVariableAdr(i + 1);\r
+ PtrWatchInfo[i].TypeTag = DBGManager_GetGlobalVariableTypeTag(i + 1);\r
+ if (!strlen(PtrWatchInfo[i].PtrVariableBaseTypeName = DBGManager_GetGlobalVariableTypeName(i + 1)))\r
+ {\r
+ PtrWatchInfo[i].PtrVariableBaseTypeName = (char *)"<font color='#ff0000'>N/A</font>";\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ for (uint32_t i = 0; i < NbWatch; i++)\r
+ {\r
+ if (PtrWatchInfo[i].PtrVariableName && PtrWatchInfo[i].PtrVariableBaseTypeName)\r
+ {\r
+ sprintf(string, "%i : %s | %s | 0x%06X | %s", (i + 1), PtrWatchInfo[i].PtrVariableBaseTypeName, PtrWatchInfo[i].PtrVariableName, (unsigned int)PtrWatchInfo[i].addr, (PtrWatchInfo[i].TypeTag & 0x8) ? "" : DBGManager_GetGlobalVariableValue(i + 1));\r
+ WatchAll += QString(string);\r
+ sprintf(string, "<br>");\r
+ WatchAll += QString(string);\r
+ }\r
+ }\r
+\r
+ text->clear();\r
+ text->setText(WatchAll);\r
+ }\r
+}\r
+\r
+\r
+#if 0\r
+void AllWatchBrowserWindow::keyPressEvent(QKeyEvent * e)\r
+{\r
+ if (e->key() == Qt::Key_Escape)\r
+ hide();\r
+ else if (e->key() == Qt::Key_PageUp)\r
+ {\r
+ memBase -= 480;\r
+\r
+ if (memBase < 0)\r
+ memBase = 0;\r
+\r
+ RefreshContents();\r
+ }\r
+ else if (e->key() == Qt::Key_PageDown)\r
+ {\r
+ memBase += 480;\r
+\r
+ if (memBase > (0x200000 - 480))\r
+ memBase = 0x200000 - 480;\r
+\r
+ RefreshContents();\r
+ }\r
+ else if (e->key() == Qt::Key_Up || e->key() == Qt::Key_Minus)\r
+ {\r
+ memBase -= 16;\r
+\r
+ if (memBase < 0)\r
+ memBase = 0;\r
+\r
+ RefreshContents();\r
+ }\r
+ else if (e->key() == Qt::Key_Down || e->key() == Qt::Key_Equal)\r
+ {\r
+ memBase += 16;\r
+\r
+ if (memBase > (0x200000 - 480))\r
+ memBase = 0x200000 - 480;\r
+\r
+ RefreshContents();\r
+ }\r
+}\r
+#endif\r
+\r
+\r
+#if 0\r
+void AllWatchBrowserWindow::GoToAddress(void)\r
+{\r
+ bool ok;\r
+ QString newAddress = address->text();\r
+ memBase = newAddress.toUInt(&ok, 16);\r
+ RefreshContents();\r
+}\r
+#endif\r
+\r