Added logic for ASM view horizontal scroll. Set debugger bookmark buttons to insensitive until code can be added.

This commit is contained in:
Matthew Budd 2020-09-17 22:59:56 -04:00
parent b319273765
commit e70eb49bf9
2 changed files with 38 additions and 11 deletions

View File

@ -383,12 +383,15 @@ ConsoleDebugger::ConsoleDebugger(QWidget *parent)
button = new QPushButton( tr("Add") ); button = new QPushButton( tr("Add") );
vbox->addWidget( button ); vbox->addWidget( button );
button->setEnabled(false); // TODO
button = new QPushButton( tr("Delete") ); button = new QPushButton( tr("Delete") );
vbox->addWidget( button ); vbox->addWidget( button );
button->setEnabled(false); // TODO
button = new QPushButton( tr("Name") ); button = new QPushButton( tr("Name") );
vbox->addWidget( button ); vbox->addWidget( button );
button->setEnabled(false); // TODO
hbox->addWidget( bmTree ); hbox->addWidget( bmTree );
hbox->addLayout( vbox ); hbox->addLayout( vbox );
@ -467,7 +470,7 @@ ConsoleDebugger::ConsoleDebugger(QWidget *parent)
periodicTimer = new QTimer( this ); periodicTimer = new QTimer( this );
connect( periodicTimer, &QTimer::timeout, this, &ConsoleDebugger::updatePeriodic ); connect( periodicTimer, &QTimer::timeout, this, &ConsoleDebugger::updatePeriodic );
//connect( hbar, SIGNAL(valueChanged(int)), this, SLOT(hbarChanged(int)) ); connect( hbar, SIGNAL(valueChanged(int)), this, SLOT(hbarChanged(int)) );
connect( vbar, SIGNAL(valueChanged(int)), this, SLOT(vbarChanged(int)) ); connect( vbar, SIGNAL(valueChanged(int)), this, SLOT(vbarChanged(int)) );
bpListUpdate( false ); bpListUpdate( false );
@ -1813,7 +1816,9 @@ void QAsmView::updateAssemblyView(void)
asmEntry.push_back(a); asmEntry.push_back(a);
} }
setMinimumWidth( maxLineLen * pxCharWidth ); pxLineWidth = maxLineLen * pxCharWidth;
setMinimumWidth( pxLineWidth );
vbar->setMaximum( asmEntry.size() ); vbar->setMaximum( asmEntry.size() );
} }
@ -2132,6 +2137,12 @@ void ConsoleDebugger::breakPointNotify( int bpNum )
windowUpdateReq = true; windowUpdateReq = true;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void ConsoleDebugger::hbarChanged(int value)
{
//printf("HBar Changed: %i\n", value);
asmView->setXScroll( value );
}
//----------------------------------------------------------------------------
void ConsoleDebugger::vbarChanged(int value) void ConsoleDebugger::vbarChanged(int value)
{ {
//printf("VBar Changed: %i\n", value); //printf("VBar Changed: %i\n", value);
@ -2475,6 +2486,7 @@ QAsmView::QAsmView(QWidget *parent)
symbolicDebugEnable = true; symbolicDebugEnable = true;
registerNameEnable = true; registerNameEnable = true;
maxLineLen = 0; maxLineLen = 0;
pxLineWidth = 0;
lineOffset = 0; lineOffset = 0;
maxLineOffset = 0; maxLineOffset = 0;
ctxMenuAddr = -1; ctxMenuAddr = -1;
@ -2501,6 +2513,18 @@ void QAsmView::setLine(int lineNum)
lineOffset = lineNum; lineOffset = lineNum;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void QAsmView::setXScroll(int value)
{
if ( viewWidth >= pxLineWidth )
{
pxLineXScroll = 0;
}
else
{
pxLineXScroll = (int)(0.010f * (float)value * (float)(pxLineWidth - viewWidth) );
}
}
//----------------------------------------------------------------------------
void QAsmView::scrollToPC(void) void QAsmView::scrollToPC(void)
{ {
if ( asmPC != NULL ) if ( asmPC != NULL )
@ -2573,14 +2597,14 @@ void QAsmView::resizeEvent(QResizeEvent *event)
maxLineOffset = 0; // mb.numLines() - viewLines + 1; maxLineOffset = 0; // mb.numLines() - viewLines + 1;
//if ( viewWidth >= pxLineWidth ) if ( viewWidth >= pxLineWidth )
//{ {
// pxLineXScroll = 0; pxLineXScroll = 0;
//} }
//else else
//{ {
// pxLineXScroll = (int)(0.010f * (float)hbar->value() * (float)(pxLineWidth - viewWidth) ); pxLineXScroll = (int)(0.010f * (float)hbar->value() * (float)(pxLineWidth - viewWidth) );
//} }
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -2775,7 +2799,7 @@ void QAsmView::paintEvent(QPaintEvent *event)
for (row=0; row < nrow; row++) for (row=0; row < nrow; row++)
{ {
x=0; x = -pxLineXScroll;
l = lineOffset + row; l = lineOffset + row;
painter.setPen( this->palette().color(QPalette::WindowText)); painter.setPen( this->palette().color(QPalette::WindowText));

View File

@ -72,6 +72,7 @@ class QAsmView : public QWidget
void asmClear(void); void asmClear(void);
int getAsmLineFromAddr(int addr); int getAsmLineFromAddr(int addr);
void setLine(int lineNum); void setLine(int lineNum);
void setXScroll(int value);
void scrollToPC(void); void scrollToPC(void);
void setDisplayROMoffsets( bool value ); void setDisplayROMoffsets( bool value );
void setSymbolDebugEnable( bool value ); void setSymbolDebugEnable( bool value );
@ -107,6 +108,7 @@ class QAsmView : public QWidget
int viewHeight; int viewHeight;
int lineOffset; int lineOffset;
int maxLineOffset; int maxLineOffset;
int pxLineWidth;
int pxLineXScroll; int pxLineXScroll;
int cursorPosX; int cursorPosX;
int cursorPosY; int cursorPosY;
@ -199,6 +201,7 @@ class ConsoleDebugger : public QDialog
void asmViewCtxMenuAddSym(void); void asmViewCtxMenuAddSym(void);
private slots: private slots:
void updatePeriodic(void); void updatePeriodic(void);
void hbarChanged(int value);
void vbarChanged(int value); void vbarChanged(int value);
void debugRunCB(void); void debugRunCB(void);
void debugStepIntoCB(void); void debugStepIntoCB(void);