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

View File

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