From 4c278a57b59c4b8e913d17b47bc4828659b32659 Mon Sep 17 00:00:00 2001 From: Alexander Taylor Date: Tue, 12 May 2026 21:19:28 -0400 Subject: Changes related to display as/type toggling. --- ui/linearview.h | 1 + ui/tokenizedtextview.h | 1 + ui/util.h | 6 ++++++ ui/viewframe.h | 1 + 4 files changed, 9 insertions(+) (limited to 'ui') diff --git a/ui/linearview.h b/ui/linearview.h index 95abdd8c..d0036aaf 100644 --- a/ui/linearview.h +++ b/ui/linearview.h @@ -399,6 +399,7 @@ private Q_SLOTS: void makeString(size_t charSize = 1); void changeType(const UIActionContext& context); void undefineInRange(); + BNIntegerDisplayType getCurrentDisplayAs(const UIActionContext& context) override; void displayAs(const UIActionContext& context, BNIntegerDisplayType displayType) override; void createStructOrInferStructureType(); bool autoCreateArray(); diff --git a/ui/tokenizedtextview.h b/ui/tokenizedtextview.h index 0843d27a..d328c492 100644 --- a/ui/tokenizedtextview.h +++ b/ui/tokenizedtextview.h @@ -150,6 +150,7 @@ class BINARYNINJAUIAPI TokenizedTextView : virtual BinaryNinja::Ref getHistoryEntry() override; void populateDefaultHistoryEntry(TokenizedTextViewHistoryEntry* entry); virtual void navigateToHistoryEntry(BinaryNinja::Ref entry) override; + virtual bool canDisplayAs(const UIActionContext& context, const BNIntegerDisplayType displayType) override; virtual void OnBinaryDataWritten(BinaryNinja::BinaryView* data, uint64_t offset, size_t len) override; virtual void OnBinaryDataInserted(BinaryNinja::BinaryView* data, uint64_t offset, size_t len) override; diff --git a/ui/util.h b/ui/util.h index eb21b310..bd58f61a 100644 --- a/ui/util.h +++ b/ui/util.h @@ -22,7 +22,13 @@ std::string BINARYNINJAUIAPI getStringForRegisterValue(ArchitectureRef arch, Bin std::string BINARYNINJAUIAPI getPossibleValueSetStateName(BNRegisterValueType state); std::string BINARYNINJAUIAPI getStringForIntegerValue(int64_t value); std::string BINARYNINJAUIAPI getStringForUIntegerValue(uint64_t value); +bool BINARYNINJAUIAPI canDisplayIntegerTokenAs(const HighlightTokenState& token, BNIntegerDisplayType displayType); BNIntegerDisplayType BINARYNINJAUIAPI getInvertedIntegerDisplayType(BNIntegerDisplayType displayType, const std::string& text); +BNIntegerDisplayType BINARYNINJAUIAPI getToggledIntegerRadixDisplayType(BNIntegerDisplayType displayType, const std::string& text); +BNIntegerDisplayType BINARYNINJAUIAPI getToggledIntegerComplementDisplayType(BNIntegerDisplayType displayType, const std::string& text); +TypeRef BINARYNINJAUIAPI getIntegerTypePreservingDisplay(TypeRef type, size_t width, BinaryNinja::Confidence isSigned); +TypeRef BINARYNINJAUIAPI getIntegerTypeWithWidthPreservingAttributes(TypeRef type, size_t width); +TypeRef BINARYNINJAUIAPI getIntegerTypeWithSignPreservingAttributes(TypeRef type, BinaryNinja::Confidence isSigned); std::string BINARYNINJAUIAPI getStringForPossibleValueSet(ArchitectureRef arch, const BinaryNinja::PossibleValueSet& values, bool pretty = true); std::string BINARYNINJAUIAPI getStringForInstructionDataflowDetails(BinaryViewRef data, ArchitectureRef arch, FunctionRef func, uint64_t address); std::optional BINARYNINJAUIAPI getPossibleValueSetForToken(View* view, BinaryViewRef data, ArchitectureRef arch, diff --git a/ui/viewframe.h b/ui/viewframe.h index 08d4add6..3812afc0 100644 --- a/ui/viewframe.h +++ b/ui/viewframe.h @@ -210,6 +210,7 @@ class BINARYNINJAUIAPI View virtual void writeData(const BinaryNinja::DataBuffer& data, uint64_t addr); virtual bool canDisplayAs(const UIActionContext& context, const BNIntegerDisplayType); + virtual BNIntegerDisplayType getCurrentDisplayAs(const UIActionContext& context); virtual void displayAs(const UIActionContext& context, BNIntegerDisplayType type); virtual BinaryNinja::Ref getHistoryEntry(); -- cgit v1.3.1