Skip to content

Commit e6e4ebe

Browse files
committed
copy supporrt for variable and stack sidebars
1 parent f65d4fd commit e6e4ebe

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

ui/stackview.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,12 @@ class BINARYNINJAUIAPI StackView : public QAbstractScrollArea, public View, publ
199199
bool m_needFirstFocus;
200200
bool m_positionAware;
201201

202+
// Selection state
203+
size_t m_selectionStartLine;
204+
size_t m_selectionStartToken;
205+
bool m_hasSelection;
206+
bool m_isDragging;
207+
202208
//! Bind and register all stack view actions.
203209
void setupActions();
204210

@@ -213,9 +219,14 @@ class BINARYNINJAUIAPI StackView : public QAbstractScrollArea, public View, publ
213219
//! Find the end of a stack void given a start offset.
214220
int64_t findVoidEnd(int64_t start) const;
215221

222+
//! Get the beginning of the current selection (min position)
223+
void getSelectionRange(size_t& startLine, size_t& startToken, size_t& endLine, size_t& endToken) const;
224+
216225
protected:
217226
void paintEvent(QPaintEvent* event) override;
218227
void mousePressEvent(QMouseEvent* event) override;
228+
void mouseMoveEvent(QMouseEvent* event) override;
229+
void mouseReleaseEvent(QMouseEvent* event) override;
219230
void mouseDoubleClickEvent(QMouseEvent* event) override;
220231

221232
public:
@@ -298,8 +309,10 @@ class BINARYNINJAUIAPI StackView : public QAbstractScrollArea, public View, publ
298309

299310
BinaryViewRef getData() override;
300311
uint64_t getCurrentOffset() override;
312+
bool canCopy() override { return selectedLine() != nullptr; }
301313
bool canCopyAddress() override { return false; };
302314
bool canPaste() override { return false; };
315+
void copy(TransformRef xform = nullptr) override;
303316
void setSelectionOffsets(BNAddressRange range) override;
304317
bool navigate(uint64_t offset) override;
305318
QFont getFont() override;

ui/variablelist.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,9 @@ class BINARYNINJAUIAPI VariableList : public SidebarWidget, public FilterTarget
251251
//! Remove UIDF for the selected variable
252252
void resetSelectedVariableValue();
253253

254+
//! Copy selected variables to clipboard
255+
void copy();
256+
254257
virtual void setFilter(const std::string& filter) override;
255258
virtual void scrollToFirstItem() override;
256259
virtual void scrollToCurrentItem() override;

0 commit comments

Comments
 (0)