From 11458f3160e9c82d3e0f48b7013d952b729ec38b Mon Sep 17 00:00:00 2001 From: Josh F Date: Wed, 6 Jul 2022 13:40:52 -0400 Subject: Memory map sidebar widget + segment/section notifications --- binaryview.cpp | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) (limited to 'binaryview.cpp') diff --git a/binaryview.cpp b/binaryview.cpp index 330a1412..db45cc88 100644 --- a/binaryview.cpp +++ b/binaryview.cpp @@ -240,6 +240,66 @@ void BinaryDataNotification::TypeFieldReferenceChangedCallback( } +void BinaryDataNotification::SegmentAddedCallback(void* ctxt, BNBinaryView* data, BNSegment* segment) +{ + BinaryDataNotification* notify = (BinaryDataNotification*)ctxt; + Ref view = new BinaryView(BNNewViewReference(data)); + Ref segmentObj = new Segment(BNNewSegmentReference(segment)); + + notify->OnSegmentAdded(view, segmentObj); +} + + +void BinaryDataNotification::SegmentUpdatedCallback(void* ctxt, BNBinaryView* data, BNSegment* segment) +{ + BinaryDataNotification* notify = (BinaryDataNotification*)ctxt; + Ref view = new BinaryView(BNNewViewReference(data)); + Ref segmentObj = new Segment(BNNewSegmentReference(segment)); + + notify->OnSegmentUpdated(view, segmentObj); +} + + +void BinaryDataNotification::SegmentRemovedCallback(void* ctxt, BNBinaryView* data, BNSegment* segment) +{ + BinaryDataNotification* notify = (BinaryDataNotification*)ctxt; + Ref view = new BinaryView(BNNewViewReference(data)); + Ref segmentObj = new Segment(BNNewSegmentReference(segment)); + + notify->OnSegmentRemoved(view, segmentObj); +} + + +void BinaryDataNotification::SectionAddedCallback(void* ctxt, BNBinaryView* data, BNSection* section) +{ + BinaryDataNotification* notify = (BinaryDataNotification*)ctxt; + Ref view = new BinaryView(BNNewViewReference(data)); + Ref
sectionObj = new Section(BNNewSectionReference(section)); + + notify->OnSectionAdded(view, sectionObj); +} + + +void BinaryDataNotification::SectionUpdatedCallback(void* ctxt, BNBinaryView* data, BNSection* section) +{ + BinaryDataNotification* notify = (BinaryDataNotification*)ctxt; + Ref view = new BinaryView(BNNewViewReference(data)); + Ref
sectionObj = new Section(BNNewSectionReference(section)); + + notify->OnSectionUpdated(view, sectionObj); +} + + +void BinaryDataNotification::SectionRemovedCallback(void* ctxt, BNBinaryView* data, BNSection* section) +{ + BinaryDataNotification* notify = (BinaryDataNotification*)ctxt; + Ref view = new BinaryView(BNNewViewReference(data)); + Ref
sectionObj = new Section(BNNewSectionReference(section)); + + notify->OnSectionRemoved(view, sectionObj); +} + + BinaryDataNotification::BinaryDataNotification() { m_callbacks.context = this; @@ -267,6 +327,12 @@ BinaryDataNotification::BinaryDataNotification() m_callbacks.typeUndefined = TypeUndefinedCallback; m_callbacks.typeReferenceChanged = TypeReferenceChangedCallback; m_callbacks.typeFieldReferenceChanged = TypeFieldReferenceChangedCallback; + m_callbacks.segmentAdded = SegmentAddedCallback; + m_callbacks.segmentUpdated = SegmentUpdatedCallback; + m_callbacks.segmentRemoved = SegmentRemovedCallback; + m_callbacks.sectionAdded = SectionAddedCallback; + m_callbacks.sectionUpdated = SectionUpdatedCallback; + m_callbacks.sectionRemoved = SectionRemovedCallback; } -- cgit v1.3.1