Skip to content

Commit

Permalink
Add actions to quickly adjust the selection in linear and hex view
Browse files Browse the repository at this point in the history
  • Loading branch information
xusheng6 committed May 10, 2024
1 parent 31d5bac commit 015314d
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
23 changes: 22 additions & 1 deletion ui/hexeditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ class BINARYNINJAUIAPI HexEditor :
virtual void selectAll();
virtual void selectNone();

void setSelectionRange(uint64_t begin, uint64_t end);
virtual void setSelectionOffsets(BNAddressRange range) override;

virtual void updateFonts() override;
Expand Down Expand Up @@ -171,6 +170,28 @@ class BINARYNINJAUIAPI HexEditor :
void deleteBack();
void deleteForward();

void extendSelectionToStartOfBinary();
void extendSelectionToEndOfBinary();
void extendSelectionToStartOfSection();
void extendSelectionToEndOfSection();
void extendSelectionToStartOfSegment();
void extendSelectionToEndOfSegment();
void extendSelectionToStartOfDataVariable();
void extendSelectionToEndOfDataVariable();
void extendSelectionByBytes();
void extendSelectionToAddress();
void setSelectionSizeTo();
void saveSelectionTo();

bool canExtendSelectionToStartOfSection();
bool canExtendSelectionToEndOfSection();
bool canExtendSelectionToStartOfSegment();
bool canExtendSelectionToEndOfSegment();
bool canExtendSelectionToStartOfDataVariable();
bool canExtendSelectionToEndOfDataVariable();

void setSelectionOffsetsInternal(BNAddressRange range, bool navigateToStart = true);

BinaryViewRef m_data;
ViewFrame* m_view;

Expand Down
21 changes: 21 additions & 0 deletions ui/linearview.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ class BINARYNINJAUIAPI LinearView : public QAbstractScrollArea, public View, pub
bool navigateToGotoLabel(uint64_t label);
bool navigateToMatchingBrace();
bool navigateToExternalLink(uint64_t linkSourceAddr);
void setSelectionOffsetsInternal(BNAddressRange range, bool navigateToStart = true);
void viewData();

void scrollLines(int count);
Expand Down Expand Up @@ -518,6 +519,26 @@ private Q_SLOTS:
void splitToNewTabAndNavigateFromCursorPosition();
void splitToNewWindowAndNavigateFromCursorPosition();
void splitToNewPaneAndNavigateFromCursorPosition();

void extendSelectionToStartOfBinary();
void extendSelectionToEndOfBinary();
void extendSelectionToStartOfSection();
void extendSelectionToEndOfSection();
void extendSelectionToStartOfSegment();
void extendSelectionToEndOfSegment();
void extendSelectionToStartOfDataVariable();
void extendSelectionToEndOfDataVariable();
void extendSelectionByBytes();
void extendSelectionToAddress();
void setSelectionSizeTo();
void saveSelectionTo();

bool canExtendSelectionToStartOfSection();
bool canExtendSelectionToEndOfSection();
bool canExtendSelectionToStartOfSegment();
bool canExtendSelectionToEndOfSegment();
bool canExtendSelectionToStartOfDataVariable();
bool canExtendSelectionToEndOfDataVariable();
};

/*!
Expand Down

0 comments on commit 015314d

Please sign in to comment.