ASM display window changed to use QPlainTextEdit instead of QTextEdit.

This commit is contained in:
Matthew Budd 2020-09-02 22:16:41 -04:00
parent ccbcab5e77
commit 254a1a1d37
2 changed files with 52 additions and 8 deletions

View File

@ -61,14 +61,17 @@ ConsoleDebugger::ConsoleDebugger(QWidget *parent)
mainLayout = new QHBoxLayout();
asmText = new QTextEdit(this);
asmText = new QPlainTextEdit(this);
vbox1 = new QVBoxLayout();
vbox2 = new QVBoxLayout();
hbox1 = new QHBoxLayout();
grid = new QGridLayout();
asmText->setFont(font);
asmText->setReadOnly(true);
asmText->setOverwriteMode(true);
asmText->setMinimumWidth( 20 * fontCharWidth );
asmText->setLineWrapMode( QPlainTextEdit::NoWrap );
vbox1->addLayout( hbox1 );
hbox1->addLayout( vbox2 );
@ -152,7 +155,7 @@ ConsoleDebugger::ConsoleDebugger(QWidget *parent)
vbox2->addLayout( hbox );
stackFrame = new QGroupBox(tr("Stack $0100"));
stackText = new QTextEdit(this);
stackText = new QPlainTextEdit(this);
hbox = new QHBoxLayout();
hbox->addWidget( stackText );
vbox2->addWidget( stackFrame );
@ -264,17 +267,23 @@ ConsoleDebugger::ConsoleDebugger(QWidget *parent)
setLayout( mainLayout );
displayROMoffsets = 0;
displayROMoffsets = false;
windowUpdateReq = true;
asmPC = NULL;
dbgWinList.push_back( this );
updateWindowData();
periodicTimer = new QTimer( this );
connect( periodicTimer, &QTimer::timeout, this, &ConsoleDebugger::updatePeriodic );
periodicTimer->start( 100 ); // 10hz
}
//----------------------------------------------------------------------------
ConsoleDebugger::~ConsoleDebugger(void)
{
printf("Destroy Debugger Window\n");
periodicTimer->stop();
asmClear();
}
//----------------------------------------------------------------------------
@ -467,6 +476,8 @@ void ConsoleDebugger::updateAssemblyView(void)
addr = starting_address;
asmPC = NULL;
asmText->clear();
//gtk_text_buffer_get_start_iter( textbuf, &iter );
//textview_lines_allocated = gtk_text_buffer_get_line_count( textbuf ) - 1;
@ -592,16 +603,43 @@ void ConsoleDebugger::updateWindowData(void)
{
updateAssemblyView();
windowUpdateReq = false;
}
//----------------------------------------------------------------------------
void ConsoleDebugger::updatePeriodic(void)
{
//printf("Update Periodic\n");
if ( windowUpdateReq )
{
fceuWrapperLock();
updateWindowData();
fceuWrapperUnLock();
}
}
//----------------------------------------------------------------------------
void ConsoleDebugger::breakPointNotify( int addr )
{
windowUpdateReq = true;
}
//----------------------------------------------------------------------------
void FCEUD_DebugBreakpoint( int addr )
{
std::list <ConsoleDebugger*>::iterator it;
printf("Breakpoint Hit: 0x%04X \n", addr );
fceuWrapperUnLock();
for (it=dbgWinList.begin(); it!=dbgWinList.end(); it++)
{
(*it)->updateWindowData();
(*it)->breakPointNotify( addr );
}
while (FCEUI_EmulationPaused() && !FCEUI_EmulationFrameStepped())
{
usleep(100000);
}
fceuWrapperLock();
}
//----------------------------------------------------------------------------

View File

@ -13,12 +13,14 @@
#include <QPushButton>
#include <QFont>
#include <QLabel>
#include <QTimer>
#include <QFrame>
#include <QGroupBox>
#include <QTreeView>
#include <QTreeWidget>
#include <QLineEdit>
#include <QTextEdit>
#include <QPlainTextEdit>
#include "Qt/main.h"
@ -57,6 +59,7 @@ class ConsoleDebugger : public QDialog
void updateAssemblyView(void);
void asmClear(void);
int getAsmLineFromAddr(int addr);
void breakPointNotify(int addr);
protected:
void closeEvent(QCloseEvent *event);
@ -64,8 +67,8 @@ class ConsoleDebugger : public QDialog
//void keyReleaseEvent(QKeyEvent *event);
//QTreeWidget *tree;
QTextEdit *asmText;
QTextEdit *stackText;
QPlainTextEdit *asmText;
QPlainTextEdit *stackText;
QLineEdit *seekEntry;
QLineEdit *pcEntry;
QLineEdit *regAEntry;
@ -94,17 +97,20 @@ class ConsoleDebugger : public QDialog
QLabel *pixLbl;
QLabel *cpuCyclesLbl;
QLabel *cpuInstrsLbl;
QTimer *periodicTimer;
QFont font;
dbg_asm_entry_t *asmPC;
std::vector <dbg_asm_entry_t*> asmEntry;
char displayROMoffsets;
bool displayROMoffsets;
bool windowUpdateReq;
private:
public slots:
void closeWindow(void);
private slots:
void updatePeriodic(void);
};