@@ -215,6 +215,7 @@ class NotificationType(IntFlag):
215215 UndoEntryAdded = 1 << 49
216216 UndoEntryTaken = 1 << 50
217217 RedoEntryTaken = 1 << 51
218+ Rebased = 1 << 52
218219
219220 BinaryDataUpdates = DataWritten | DataInserted | DataRemoved
220221 FunctionLifetime = FunctionAdded | FunctionRemoved
@@ -467,6 +468,9 @@ def undo_entry_taken(self, view: 'BinaryView', entry: 'undo.UndoEntry'):
467468 def redo_entry_taken (self , view : 'BinaryView' , entry : 'undo.UndoEntry' ):
468469 pass
469470
471+ def rebased (self , old_view : 'BinaryView' , new_view : 'BinaryView' ):
472+ pass
473+
470474
471475class StringReference :
472476 _decodings = {
@@ -725,6 +729,8 @@ def __init__(self, view: 'BinaryView', notify: 'BinaryDataNotification'):
725729 self ._cb .undoEntryAdded = self ._cb .undoEntryAdded .__class__ (self ._undo_entry_added )
726730 self ._cb .undoEntryTaken = self ._cb .undoEntryTaken .__class__ (self ._undo_entry_taken )
727731 self ._cb .redoEntryTaken = self ._cb .redoEntryTaken .__class__ (self ._redo_entry_taken )
732+
733+ self ._cb .rebased = self ._cb .rebased .__class__ (self ._rebased )
728734 else :
729735 if notify .notifications & NotificationType .NotificationBarrier :
730736 self ._cb .notificationBarrier = self ._cb .notificationBarrier .__class__ (self ._notification_barrier )
@@ -821,6 +827,9 @@ def __init__(self, view: 'BinaryView', notify: 'BinaryDataNotification'):
821827 if notify .notifications & NotificationType .RedoEntryTaken :
822828 self ._cb .redoEntryTaken = self ._cb .redoEntryTaken .__class__ (self ._redo_entry_taken )
823829
830+ if notify .notifications & NotificationType .Rebased :
831+ self ._cb .rebased = self ._cb .rebased .__class__ (self ._rebased )
832+
824833 def _register (self ) -> None :
825834 core .BNRegisterDataNotification (self ._view .handle , self ._cb )
826835
@@ -1238,6 +1247,14 @@ def _redo_entry_taken(self, ctxt, view: core.BNBinaryView, entry: core.BNUndoEnt
12381247 except :
12391248 log_error_for_exception ("Unhandled Python exception in BinaryDataNotificationCallbacks._redo_entry_taken" )
12401249
1250+ def _rebased (self , ctxt , old_view : core .BNBinaryView , new_view : core .BNBinaryView ):
1251+ try :
1252+ file_metadata = filemetadata .FileMetadata (handle = core .BNGetFileForView (new_view ))
1253+ new_view_obj = BinaryView (file_metadata = file_metadata , handle = core .BNNewViewReference (new_view ))
1254+ self ._notify .rebased (self ._view , new_view_obj )
1255+ except :
1256+ log_error_for_exception ("Unhandled Python exception in BinaryDataNotificationCallbacks._rebased" )
1257+
12411258 @property
12421259 def view (self ) -> 'BinaryView' :
12431260 return self ._view
0 commit comments