colorize_pseudocode_lines

summary: interactively color decompilation lines

description:

Provides an action that can be used to dynamically alter the lines background rendering for pseudocode listings (as opposed to using ida_hexrays.cfunc_t.pseudocode[N].bgcolor)

After running this script, pressing ‘M’ on a line in a “Pseudocode-?” widget, will cause that line to be rendered with a special background color.

keywords: colors

level: intermediate

Attributes

hooks

act_name

act_shortcut

Classes

pseudo_line_t

pseudocode_lines_rendering_hooks_t

toggle_line_marked_ah_t

We could very well use an ARGB value, but instead let's go

Module Contents

class colorize_pseudocode_lines.pseudo_line_t(func_ea, line_nr)

Bases: object

func_ea
line_nr
class colorize_pseudocode_lines.pseudocode_lines_rendering_hooks_t

Bases: ida_kernwin.UI_Hooks

marked_lines
get_lines_rendering_info(out, widget, rin)

get lines rendering information

Parameters:
  • out – (lines_rendering_output_t *)

  • widget – (const TWidget *)

  • info – (const lines_rendering_input_t *)

Returns:

void

class colorize_pseudocode_lines.toggle_line_marked_ah_t(hooks)

Bases: ida_kernwin.action_handler_t

We could very well use an ARGB value, but instead let’s go go with a color ‘key’: those can be altered by the user/theme, and therefore have a better chance of being appropriate (or at least expected.)

COLOR_KEY
hooks
activate(ctx)

Activate an action. This function implements the core behavior of an action. It is called when the action is triggered, from a menu, from a popup menu, from the toolbar, or programmatically.

Returns:

non-zero: all IDA windows will be refreshed

update(ctx)

Update an action. This is called when the context of the UI changed, and we need to let the action update some of its properties if needed (label, icon, …) In addition, this lets IDA know whether the action is enabled, and when it should be queried for availability again. Note: This callback is not meant to change anything in the application’s state, except by calling one (or many) of the “update_action_*()” functions on this very action.

colorize_pseudocode_lines.hooks
colorize_pseudocode_lines.act_name = 'example:colorize_pseudocode_line'
colorize_pseudocode_lines.act_shortcut = 'M'