diff options
| author | Brian Potchik <brian@vector35.com> | 2020-11-07 17:37:22 -0500 |
|---|---|---|
| committer | Brian Potchik <brian@vector35.com> | 2020-11-07 17:37:22 -0500 |
| commit | 2c312c8d5bca189241377c564ff5e9fb35fe9de2 (patch) | |
| tree | 217243b0d18bb8650893a5e18b8beb837edd0757 /ui/viewframe.h | |
| parent | bbec694624d4d8bb127864f1794c6466746f3aa8 (diff) | |
Improved view location preservation when duplicating existing views in the UI.
Diffstat (limited to 'ui/viewframe.h')
| -rw-r--r-- | ui/viewframe.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/ui/viewframe.h b/ui/viewframe.h index b54ec8c0..8d37c23f 100644 --- a/ui/viewframe.h +++ b/ui/viewframe.h @@ -150,6 +150,38 @@ public: ~ViewNavigationMode() { m_view->setNavigationMode(m_mode); } }; + +class BINARYNINJAUIAPI ViewLocation +{ + bool m_valid = false; + QString m_viewType; + uint64_t m_offset = 0; + bool m_hasILViewType = false; + BNFunctionGraphType m_ilViewType = NormalFunctionGraph; + size_t m_instrIndex = BN_INVALID_EXPR; + +public: + ViewLocation() { } + ViewLocation(const QString& viewType, uint64_t offset) : m_valid(true), m_viewType(viewType), m_offset(offset) { } + ViewLocation(const QString& viewType, uint64_t offset, BNFunctionGraphType ilViewType) : m_valid(true), + m_viewType(viewType), m_offset(offset), m_hasILViewType(true), m_ilViewType(ilViewType) { } + ViewLocation(const QString& viewType, uint64_t offset, BNFunctionGraphType ilViewType, size_t instrIndex) : m_valid(true), + m_viewType(viewType), m_offset(offset), m_hasILViewType(true), m_ilViewType(ilViewType), m_instrIndex(instrIndex) { } + + bool isValid() const { return m_valid; } + QString getViewType() const { return m_viewType; } + uint64_t getOffset() const { return m_offset; } + bool hasILViewType() const { return m_hasILViewType; } + BNFunctionGraphType getILViewType() const { return m_ilViewType; } + size_t getInstrIndex() const { return m_instrIndex; } + + void setViewType(QString& viewType) { m_viewType = viewType; } + void setOffset(uint64_t offset) { m_offset = offset; } + void setILViewType(BNFunctionGraphType ilViewType) { m_hasILViewType = true; m_ilViewType = ilViewType; } + void setInstrIndex(uint64_t index) { m_instrIndex = index; } +}; + + class BINARYNINJAUIAPI ViewContainer { public: @@ -205,6 +237,9 @@ public: uint64_t getCurrentOffset(); BNAddressRange getSelectionOffsets(); + ViewLocation getViewLocation(); + void setViewLocation(const ViewLocation& viewLocation); + View* getCurrentViewInterface() const { return View::getViewFromWidget(m_view); } QWidget* getCurrentWidget() const { return m_view; } |
