Merge pull request #634 from fmahnke/no-scroll-pc

Don't always scroll to PC when updating debug window assembly view.
This commit is contained in:
thor2016 2023-04-17 21:26:54 -04:00 committed by GitHub
commit 50d4d58276
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 37 additions and 28 deletions

View File

@ -172,7 +172,7 @@ ConsoleDebugger::ConsoleDebugger(QWidget *parent)
loadDisplayViews();
windowUpdateReq = true;
windowUpdateReq = QAsmView::UPDATE_ALL;
dbgWin = this;
@ -373,7 +373,7 @@ void ConsoleDebugger::ld65ImportDebug(void)
debugSymbolTable.ld65LoadDebugFile( filename.toStdString().c_str() );
queueUpdate();
queueUpdate(QAsmView::UPDATE_ALL);
return;
}
@ -3080,7 +3080,7 @@ void ConsoleDebugger::debugStepBackCB(void)
{
FCEU_WRAPPER_LOCK();
FCEUD_TraceLoggerBackUpInstruction();
updateWindowData();
updateWindowData(QAsmView::UPDATE_ALL);
hexEditorUpdateMemoryValues(true);
hexEditorRequestUpdateAll();
lastBpIdx = BREAK_TYPE_STEP;
@ -3275,8 +3275,7 @@ void ConsoleDebugger::seekPCCB (void)
setRegsFromEntry();
//updateAllDebugWindows();
}
windowUpdateReq = true;
//asmView->scrollToPC();
windowUpdateReq = QAsmView::UPDATE_ALL;
}
//----------------------------------------------------------------------------
void ConsoleDebugger::openChangePcDialog(void)
@ -3330,7 +3329,7 @@ void ConsoleDebugger::openChangePcDialog(void)
{
X.PC = sbox->value();
windowUpdateReq = true;
windowUpdateReq = QAsmView::UPDATE_ALL;
}
}
//----------------------------------------------------------------------------
@ -4324,20 +4323,25 @@ void ConsoleDebugger::updateRegisterView(void)
ppuScrollY->setText( tr(stmp) );
}
//----------------------------------------------------------------------------
void ConsoleDebugger::updateWindowData(void)
void ConsoleDebugger::updateWindowData(enum QAsmView::UpdateType type)
{
asmView->updateAssemblyView();
asmView->scrollToPC();
if (type == QAsmView::UPDATE_ALL)
{
asmView->updateAssemblyView();
asmView->scrollToPC();
updateRegisterView();
} else if (type == QAsmView::UPDATE_NO_SCROLL)
{
asmView->updateAssemblyView();
updateRegisterView();
}
updateRegisterView();
windowUpdateReq = false;
windowUpdateReq = QAsmView::UPDATE_NONE;
}
//----------------------------------------------------------------------------
void ConsoleDebugger::queueUpdate(void)
void ConsoleDebugger::queueUpdate(enum QAsmView::UpdateType type)
{
windowUpdateReq = true;
windowUpdateReq = type;
}
//----------------------------------------------------------------------------
void ConsoleDebugger::updatePeriodic(void)
@ -4355,10 +4359,10 @@ void ConsoleDebugger::updatePeriodic(void)
bpNotifyReq = false;
}
if ( windowUpdateReq )
if ( windowUpdateReq != QAsmView::UPDATE_NONE )
{
FCEU_WRAPPER_LOCK();
updateWindowData();
updateWindowData(windowUpdateReq);
FCEU_WRAPPER_UNLOCK();
}
asmView->update();
@ -4528,7 +4532,7 @@ void ConsoleDebugger::breakPointNotify( int bpNum )
}
}
windowUpdateReq = true;
windowUpdateReq = QAsmView::UPDATE_ALL;
}
//----------------------------------------------------------------------------
void ConsoleDebugger::hbarChanged(int value)
@ -4651,11 +4655,11 @@ bool debuggerWaitingAtBreakpoint(void)
return waitingAtBp;
}
//----------------------------------------------------------------------------
void updateAllDebuggerWindows( void )
void updateAllDebuggerWindows( enum QAsmView::UpdateType type )
{
if ( dbgWin )
{
dbgWin->queueUpdate();
dbgWin->queueUpdate(type);
}
}
//----------------------------------------------------------------------------

View File

@ -167,6 +167,8 @@ class QAsmView : public QWidget
QFont getFont(void){ return font; };
enum UpdateType { UPDATE_NONE, UPDATE_ALL, UPDATE_NO_SCROLL };
protected:
bool event(QEvent *event) override;
void paintEvent(QPaintEvent *event) override;
@ -473,7 +475,7 @@ class ConsoleDebugger : public QDialog
ConsoleDebugger(QWidget *parent = 0);
~ConsoleDebugger(void);
void updateWindowData(void);
void updateWindowData(enum QAsmView::UpdateType type);
void updateRegisterView(void);
void updateTabVisibility(void);
void breakPointNotify(int bpNum);
@ -482,7 +484,7 @@ class ConsoleDebugger : public QDialog
void setBookmarkSelectedAddress( int addr );
int getBookmarkSelectedAddress(void){ return selBmAddrVal; };
void edit_BM_name( int addr );
void queueUpdate(void);
void queueUpdate(enum QAsmView::UpdateType type);
QLabel *asmLineSelLbl;
@ -575,7 +577,8 @@ class ConsoleDebugger : public QDialog
ColorMenuItem *pcColorAct;
int selBmAddrVal;
bool windowUpdateReq;
enum QAsmView::UpdateType windowUpdateReq;
bool startedTraceLogger;
private:
@ -670,6 +673,6 @@ void saveGameDebugBreakpoints( bool force = false );
void loadGameDebugBreakpoints(void);
void debuggerClearAllBreakpoints(void);
void debuggerClearAllBookmarks(void);
void updateAllDebuggerWindows(void);
void updateAllDebuggerWindows(enum QAsmView::UpdateType type);
extern debuggerBookmarkManager_t dbgBmMgr;

View File

@ -399,7 +399,7 @@ static int writeMem( int mode, unsigned int addr, int value )
{
if (debuggerWindowIsOpen())
{
updateAllDebuggerWindows();
updateAllDebuggerWindows(QAsmView::UPDATE_NO_SCROLL);
}
}
@ -1853,7 +1853,7 @@ void HexEditorDialog_t::openDebugSymbolEditWindow( int addr )
if ( ret == QDialog::Accepted )
{
updateAllDebuggerWindows();
updateAllDebuggerWindows(QAsmView::UPDATE_NO_SCROLL);
}
}
//----------------------------------------------------------------------------
@ -2836,6 +2836,7 @@ void QHexEdit::keyPressEvent(QKeyEvent *event)
}
else
{ // Edit Area is Hex
key = int(event->text()[0].toUpper().toLatin1());
if ( ::isxdigit( key ) )

View File

@ -57,6 +57,7 @@
#include "common/os_utils.h"
#include "Qt/ConsoleDebugger.h"
#include "Qt/ConsoleWindow.h"
#include "Qt/ConsoleUtilities.h"
#include "Qt/TraceLogger.h"
@ -2187,7 +2188,7 @@ void QTraceLogView::openBpEditWindow(int editIdx, watchpointinfo *wp, traceRecor
numWPs++;
}
updateAllDebuggerWindows();
updateAllDebuggerWindows(QAsmView::UPDATE_NO_SCROLL);
}
}
}
@ -2232,7 +2233,7 @@ void QTraceLogView::openDebugSymbolEditWindow(int addr, int bank)
if (ret == QDialog::Accepted)
{
updateAllDebuggerWindows();
updateAllDebuggerWindows(QAsmView::UPDATE_NO_SCROLL);
}
}
//----------------------------------------------------------------------------