def perform(self, event): e = self.active_editor addr, error = prompt_for_hex( e.window.control, "Enter address value:\n(default hex; prefix with # for decimal)", "Goto Address in a Segment", return_error=True, default_base="hex") if addr is not None: s = e.segment index = addr - s.start_addr if e.segment.is_valid_index(index): e.index_clicked(index, 0, None) e.task.status_bar.message = e.get_label_at_index(index) else: segments = e.document.find_segments_in_range(addr) if len(segments) > 1: segments = segments[ 1:] # Skip ALL segment if other segments exist if len(segments) == 0: e.task.status_bar.message = "Address $%04x not valid in any segment" % addr else: if len(segments) > 1: segments = segments[ 1:] # Skip ALL segment if others are available segment_num, segment, index = segments[0] e.view_segment_number(segment_num) e.index_clicked(index, 0, None) e.task.status_bar.message = "%s in segment %s" % ( e.get_label_at_index(index), e.segment.name) else: e.task.status_bar.message = error
def show_dialog(self): value = prompt_for_hex(self.viewer.control, self.prompt, self.cmd.pretty_name) if value is not None: cmd = self.cmd(self.linked_base.segment, self.linked_base.selected_ranges, value) self.active_editor.process_command(cmd)
def perform(self, event): e = self.active_editor segment = e.document.segments[self.segment_number] org = prompt_for_hex(e.window.control, "Enter origin address for %s" % segment.name, "Set Segment Origin") if org is not None: segment.start_addr = org e.update_segments_ui() e.metadata_dirty = True e.reconfigure_panes()
def perform(self, event): e = self.active_editor size = prompt_for_hex(e.window.control, "Enter number of bytes in each segment", "Multiple Segments") if size is not None and size > 0: segments = e.get_segments_from_selection(size) for segment in segments: text = "%04x-%04x" % (segment.start_addr, segment.start_addr + len(segment) - 1) segment.name = text e.add_user_segment(segment, False) e.update_segments_ui()
def perform(self, event): e = self.active_editor segment = e.segment org = prompt_for_hex( e.window.control, "Enter origin address for %s\n(default hex, prefix with # for decimal, %% for binary)" % segment.name, "Set Segment Origin") if org is not None: cmd = SetSegmentOriginCommand(segment, org) e.process_command(cmd)
def perform(self, event): e = self.active_editor size = prompt_for_hex( e.window.control, "Enter number of bytes in each segment\n(default hex, prefix with # for decimal, %% for binary)", "Multiple Segments") if size is not None and size > 0: segments = e.get_segments_from_selection(size) for segment in segments: text = "%04x-%04x" % (segment.start_addr, segment.start_addr + len(segment) - 1) segment.name = text e.add_user_segment(segment, False) e.find_segment(segment=segments[0], refresh=True)
def perform(self, event): e = self.active_editor addr, error = prompt_for_hex(e.window.control, "Enter address value: (default hex; prefix with # for decimal)", "Goto Address in a Segment", return_error=True, default_base="hex") if addr is not None: s = e.segment index = addr - s.start_addr if e.segment.is_valid_index(index): e.index_clicked(index, 0, None) e.task.status_bar.message = e.get_label_at_index(index) else: segment_num, segment, index = e.document.find_segment_in_range(addr) if segment_num >= 0: e.view_segment_number(segment_num) e.index_clicked(index, 0, None) e.task.status_bar.message = "%s in segment %s" % (e.get_label_at_index(index), e.segment.name) else: e.task.status_bar.message = "Address $%04x not valid in any segment" % addr else: e.task.status_bar.message = error
def show_dialog(self, e): value = prompt_for_hex(e.window.control, "Enter byte value: (prefix with 0x or $ for hex, % for binary)", self.cmd.pretty_name) if value is not None: cmd = self.cmd(e.segment, e.selected_ranges, value) self.active_editor.process_command(cmd)
def perform(self, event): e = self.active_editor width = prompt_for_hex(e.window.control, 'Enter new pixel zoom factor', 'Set Map Zoom', e.map_zoom) if width is not None and width > 0: wx.CallAfter(e.set_map_zoom, width)
def perform(self, event): e = self.active_editor width = prompt_for_hex(e.window.control, 'Enter new map width in bytes', 'Set Map Width', str(e.map_width)) if width is not None and width > 0: wx.CallAfter(e.set_map_width, width)