Commits

Anonymous committed 81213a0

hachoir-wx: add "Open Window Here" menu option

  • Participants
  • Parent commits c8a2e24

Comments (0)

Files changed (5)

File hachoir-wx/hachoir_wx/app.py

         subfile.name = field.path
         new_window(self, subfile, parser, subfile.name)
 
+    def on_field_open_window_here(self, dispatcher, field):
+        new_window(self, dispatcher.top_file, field, dispatcher.top_filename)
+
     def on_frame_activated(self, dispatcher, frame):
         self.SetTopWindow(frame)
 
 
     dispatcher = dispatcher_t()
     dispatcher.add_receiver(app)
+    dispatcher.top_file = file
+    dispatcher.top_filename = filename
 
     frame = frame_view.setup_frame_view(dispatcher)
     field_view.setup_field_view(frame, dispatcher)

File hachoir-wx/hachoir_wx/field_view/field_menu_fwd.py

                   id=XRCID('field_menu_dump_to_disk'))
         view.Bind(EVT_MENU, self.imp.on_parse_substream,
                   id=XRCID('field_menu_parse_substream'))
+        view.Bind(EVT_MENU, self.imp.on_open_window_here,
+                  id=XRCID('field_menu_open_window_here'))
 

File hachoir-wx/hachoir_wx/field_view/field_menu_imp.py

     def on_parse_substream(self, dispatcher):
         self.dispatcher.trigger('field_parse_substream', self.selected)
 
+    def on_open_window_here(self, dispatcher):
+        self.dispatcher.trigger('field_open_window_here', self.selected)
+
     def on_dump_to_disk(self, event):
         dump_path = self.view.ask_for_dump_file(_('Dump "' + self.selected._getPath() + '" To Disk...'))
         if dump_path is not None:

File hachoir-wx/hachoir_wx/hex_view/compat_msw.py

-# -*- coding: utf-8 -*-
-
-# Windows wx compatibility
-
-def get_width_chars(view):
-    return ((view.GetClientSize()[0]-3) // (view.GetCharWidth()-1) - 1) // 3
-
-def get_height_chars(view):
-    return view.GetClientSize()[1] // view.GetCharHeight()
+# -*- coding: utf-8 -*-
+
+# Windows wx compatibility
+
+def get_width_chars(view):
+    return ((view.GetClientSize()[0]-3) // (view.GetCharWidth()-1) - 1) // 3
+
+def get_height_chars(view):
+    return view.GetClientSize()[1] // view.GetCharHeight()

File hachoir-wx/hachoir_wx/resource/hachoir_wx.xrc

       <object class="wxMenuItem" name="field_menu_parse_substream">
         <label>Parse Sub-Stream</label>
       </object>
+      <object class="wxMenuItem" name="field_menu_open_window_here">
+        <label>Open New Window Here</label>
+      </object>
       <object class="separator"/>
       <object class="wxMenu" name="field_menu_address">
         <label>Address Offset</label>