diff --git a/include/Views/ViewEntity.h b/include/Views/ViewEntity.h index d48638b..bf9c3e9 100644 --- a/include/Views/ViewEntity.h +++ b/include/Views/ViewEntity.h @@ -51,6 +51,11 @@ namespace S2Plugin QWidget* mTabLevel; QWidget* mTabCPP; + uintptr_t mEntityPtr; + uintptr_t mComparisonEntityPtr{0}; + size_t mEntitySize{0}; + ViewToolbar* mToolbar; + // TOP LAYOUT QPushButton* mRefreshButton; QCheckBox* mAutoRefreshCheckBox; @@ -72,9 +77,6 @@ namespace S2Plugin // TAB CPP QTextEdit* mCPPTextEdit; CPPSyntaxHighlighter* mCPPSyntaxHighlighter; - uintptr_t mEntityPtr; - uintptr_t mComparisonEntityPtr{0}; - ViewToolbar* mToolbar; void initializeUI(); void updateMemoryViewOffsetAndSize(); diff --git a/src/Views/ViewEntity.cpp b/src/Views/ViewEntity.cpp index cd89f87..cc16a58 100644 --- a/src/Views/ViewEntity.cpp +++ b/src/Views/ViewEntity.cpp @@ -294,18 +294,22 @@ void S2Plugin::ViewEntity::interpretAsChanged(const QString& classType) recursiveHighlight(*it + ".", config->typeFieldsOfEntitySubclass(*it), recursiveHighlight); } - // updateMemoryViewOffsetAndSize(); // mInterpretAsComboBox->setCurrentText(""); mMainTreeView->updateTree(0, 0, true); + mEntitySize = delta; + updateMemoryViewOffsetAndSize(); } } void S2Plugin::ViewEntity::updateMemoryViewOffsetAndSize() { - static const size_t defaultBytesShown = 0x188; // big bucket size, small bucket size: 0xD0 + constexpr size_t smallEntityBucket = 0xD0; + constexpr size_t bigEntityBucket = 0x188; - mMemoryView->setOffsetAndSize(mEntityPtr, defaultBytesShown); - mMemoryComparisonView->setOffsetAndSize(mComparisonEntityPtr, defaultBytesShown); + size_t bytesShown = mEntitySize > smallEntityBucket ? bigEntityBucket : smallEntityBucket; + + mMemoryView->setOffsetAndSize(mEntityPtr, bytesShown); + mMemoryComparisonView->setOffsetAndSize(mComparisonEntityPtr, bytesShown); } void S2Plugin::ViewEntity::updateComparedMemoryViewHighlights()