From 4ea160e709c4ad43c06da350cf3074ff80bd1168 Mon Sep 17 00:00:00 2001 From: Nukem Date: Sun, 18 Oct 2015 23:53:43 -0400 Subject: [PATCH] GUI: Possibly fix #406, #401, #243 (NEEDS CHECKING) This may have unintended side effects. --- src/gui/Src/BasicView/AbstractTableView.cpp | 14 +++++++++++--- src/gui/Src/BasicView/HexDump.cpp | 6 ++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/gui/Src/BasicView/AbstractTableView.cpp b/src/gui/Src/BasicView/AbstractTableView.cpp index 55bfdb36..248ac84b 100644 --- a/src/gui/Src/BasicView/AbstractTableView.cpp +++ b/src/gui/Src/BasicView/AbstractTableView.cpp @@ -911,16 +911,24 @@ dsint AbstractTableView::getTableOffset() return mTableOffset; } - void AbstractTableView::setTableOffset(dsint val) { - dsint wMaxOffset = getRowCount() - getViewableRowsCount() + 1; - wMaxOffset = wMaxOffset > 0 ? wMaxOffset : 0; + // Don't allow the new row value to go past the maximum + dsint wMaxOffset = getRowCount(); + if(val > wMaxOffset) return; + + // Change the row index so that it isn't scrolled completely + // to the bottom of the table + if (val > (wMaxOffset - getViewableRowsCount())) + val -= (getViewableRowsCount() - 3); + + // Signals mTableOffset = val; emit tableOffsetChanged(val); + // Change the scrollbar position #ifdef _WIN64 int wNewValue = scaleFromUint64ToScrollBarRange(mTableOffset); verticalScrollBar()->setValue(wNewValue); diff --git a/src/gui/Src/BasicView/HexDump.cpp b/src/gui/Src/BasicView/HexDump.cpp index 49044cf5..e26c8d27 100644 --- a/src/gui/Src/BasicView/HexDump.cpp +++ b/src/gui/Src/BasicView/HexDump.cpp @@ -54,8 +54,10 @@ void HexDump::printDumpAt(dsint parVA, bool select, bool repaint) dsint wRowCount; // Byte offset used to be aligned on the given RVA - mByteOffset = (int)((dsint)wRVA % (dsint)wBytePerRowCount); - mByteOffset = mByteOffset > 0 ? wBytePerRowCount - mByteOffset : 0; + // TODO: CHECK THIS + mByteOffset = 0; + // mByteOffset = (int)((dsint)wRVA % (dsint)wBytePerRowCount); + // mByteOffset = mByteOffset > 0 ? wBytePerRowCount - mByteOffset : 0; // Compute row count wRowCount = wSize / wBytePerRowCount;