Skip to content

Commit 20b03bd

Browse files
committed
Allow DockHandler::notifyOffset to provide notification that an IL view information has changed.
1 parent b24b2a1 commit 20b03bd

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

ui/dockhandler.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@
77

88
#include "binaryninjaapi.h"
99
#include "action.h"
10+
#include "viewframe.h"
1011
#include "uitypes.h"
1112

1213
class ContextMenuManager;
1314
class DockHandler;
1415
class Menu;
15-
class View;
16-
class ViewFrame;
1716

1817

1918
struct BINARYNINJAUIAPI DockProperties
@@ -101,7 +100,7 @@ class BINARYNINJAUIAPI DockHandler: public QObject
101100
bool m_shouldResizeDocks = false;
102101
std::map<Qt::DockWidgetArea, bool> m_enableHiddenGroupSave;
103102

104-
uint64_t m_currentOffset = 0;
103+
ViewLocation m_currentViewLocation;
105104

106105
friend class DockContextHandler;
107106
std::map<QWidget*, DockContextHandler*> m_contexts;

ui/viewframe.h

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
#include <stack>
1111
#include <utility>
1212
#include <vector>
13-
#include "dockhandler.h"
1413
#include "filecontext.h"
1514
#include "viewtype.h"
1615
#include "action.h"
1716

17+
1818
class BINARYNINJAUIAPI HistoryEntry: public BinaryNinja::RefCountObject
1919
{
2020
QString m_viewType;
@@ -26,12 +26,15 @@ class BINARYNINJAUIAPI HistoryEntry: public BinaryNinja::RefCountObject
2626
void setViewType(const QString& type) { m_viewType = type; }
2727
};
2828

29+
2930
class AssembleDialog;
3031
class CompileDialog;
32+
class DockHandler;
3133
class FeatureMap;
3234
class StatusBarWidget;
3335
class ViewNavigationMode;
3436

37+
3538
class BINARYNINJAUIAPI View
3639
{
3740
protected:
@@ -158,29 +161,37 @@ class BINARYNINJAUIAPI ViewLocation
158161
bool m_valid = false;
159162
QString m_viewType;
160163
uint64_t m_offset = 0;
161-
bool m_hasILViewType = false;
162164
BNFunctionGraphType m_ilViewType = NormalFunctionGraph;
163165
size_t m_instrIndex = BN_INVALID_EXPR;
164166

165167
public:
166168
ViewLocation() { }
167169
ViewLocation(const QString& viewType, uint64_t offset) : m_valid(true), m_viewType(viewType), m_offset(offset) { }
168170
ViewLocation(const QString& viewType, uint64_t offset, BNFunctionGraphType ilViewType) : m_valid(true),
169-
m_viewType(viewType), m_offset(offset), m_hasILViewType(true), m_ilViewType(ilViewType) { }
171+
m_viewType(viewType), m_offset(offset), m_ilViewType(ilViewType) { }
170172
ViewLocation(const QString& viewType, uint64_t offset, BNFunctionGraphType ilViewType, size_t instrIndex) : m_valid(true),
171-
m_viewType(viewType), m_offset(offset), m_hasILViewType(true), m_ilViewType(ilViewType), m_instrIndex(instrIndex) { }
173+
m_viewType(viewType), m_offset(offset), m_ilViewType(ilViewType), m_instrIndex(instrIndex) { }
172174

173175
bool isValid() const { return m_valid; }
174176
QString getViewType() const { return m_viewType; }
175177
uint64_t getOffset() const { return m_offset; }
176-
bool hasILViewType() const { return m_hasILViewType; }
177178
BNFunctionGraphType getILViewType() const { return m_ilViewType; }
178179
size_t getInstrIndex() const { return m_instrIndex; }
179180

180181
void setViewType(QString& viewType) { m_viewType = viewType; }
181182
void setOffset(uint64_t offset) { m_offset = offset; }
182-
void setILViewType(BNFunctionGraphType ilViewType) { m_hasILViewType = true; m_ilViewType = ilViewType; }
183+
void setILViewType(BNFunctionGraphType ilViewType) { m_ilViewType = ilViewType; }
183184
void setInstrIndex(uint64_t index) { m_instrIndex = index; }
185+
186+
bool operator==(const ViewLocation& other) const
187+
{
188+
return (m_valid == other.m_valid) &&
189+
(m_viewType == other.m_viewType) &&
190+
(m_offset == other.m_offset) &&
191+
(m_ilViewType == other.m_ilViewType) &&
192+
(m_instrIndex == other.m_instrIndex);
193+
}
194+
bool operator!=(const ViewLocation& other) const { return !((*this) == other); }
184195
};
185196

186197

0 commit comments

Comments
 (0)