def zoom_and_dock(self, vu_title, zoom, dock_position=None): widget = ida_kernwin.find_widget(self.title) if widget and dock_position: gli = ida_moves.graph_location_info_t() if ida_graph.viewer_get_gli(gli, widget): gli.zoom = zoom ida_graph.viewer_set_gli(widget, gli) ida_kernwin.set_dock_pos(self.title, vu_title, dock_position) self.Refresh()
def cg_zoom_and_dock(title, vu_title, dock_position=None): widget = ida_kernwin.find_widget(title) if widget: if dock_position is not None: gli = ida_moves.graph_location_info_t() if ida_graph.viewer_get_gli(gli, widget): gli.zoom = 1.0 ida_graph.viewer_set_gli(widget, gli) ida_kernwin.set_dock_pos(title, vu_title, dock_position)
def zoom_and_dock(self, target): widget = ida_kernwin.get_current_widget() if widget and self.dock_position: gli = ida_moves.graph_location_info_t() if ida_graph.viewer_get_gli(gli, widget): gli.zoom = self.zoom ida_graph.viewer_set_gli(widget, gli) ida_kernwin.set_dock_pos(ida_kernwin.get_widget_title(widget), ida_kernwin.get_widget_title(target), self.dock_position) self.Refresh()
def _dock_widgets(self, graph, dockpos=kw.DP_RIGHT): if graph: gv = graph.GetWidget() kw.set_dock_pos(kw.get_widget_title(gv), self.title, dockpos) gli = ida_moves.graph_location_info_t() if ida_graph.viewer_get_gli(gli, gv): gli.zoom = 0 # auto-position ida_graph.viewer_set_gli(gv, gli, ida_graph.GLICTL_CENTER) ida_graph.refresh_viewer(gv) return True return False
def update_widget_b(self): # Make sure we are in the same function place_a, _, _ = ida_kernwin.get_custom_viewer_place(widget_a, False) ida_kernwin.jumpto(widget_b, place_a, -1, -1) # and that we show the right place (slightly zoomed out) widget_a_center_gli = ida_moves.graph_location_info_t() if ida_graph.viewer_get_gli(widget_a_center_gli, widget_a, ida_graph.GLICTL_CENTER): widget_b_center_gli = ida_moves.graph_location_info_t() widget_b_center_gli.orgx = widget_a_center_gli.orgx widget_b_center_gli.orgy = widget_a_center_gli.orgy widget_b_center_gli.zoom = widget_a_center_gli.zoom * 0.5 ida_graph.viewer_set_gli(widget_b, widget_b_center_gli, ida_graph.GLICTL_CENTER)
def _center_graph(self): """ Center the sub-tree graph, and set an appropriate zoom level. """ widget = self.GetWidget() gv = ida_graph.get_graph_viewer(widget) g = ida_graph.get_viewer_graph(gv) ida_graph.viewer_fit_window(gv) ida_graph.refresh_viewer(gv) gli = ida_moves.graph_location_info_t() ida_graph.viewer_get_gli(gli, gv, ida_graph.GLICTL_CENTER) if gli.zoom > 1.5: gli.zoom = 1.5 else: gli.zoom = gli.zoom * 0.9 ida_graph.viewer_set_gli(gv, gli, ida_graph.GLICTL_CENTER)