Register
4coder » Wiki

4coder Wiki

Featured Article: [MODULE] Primitive highlight

Description

This module provides text highlighting of types, functions and macros (as of 4coder 4.1.6, 4coder commands are not supported) by coloring them with a user specified color. For an identifier to be recognized as a type, function or macro, the file declaring it must be loaded.

primitive highlight screenshot

Version

This was tested with 4coder 4.1.6.

Setup

You need to #include this file in your custom layer (4coder_default_bindings.cpp by default) below the line:

1
#include "4coder_default_include.cpp"

You need to call the function primitive_highlight_draw_cpp_token_colors from default_render_buffer in 4coder_default_hooks.cpp instead of draw_cpp_token_colors. The function takes one extra argument which is the buffer that is currently being drawn. The call should look like this:

1
primitive_highlight_draw_cpp_token_colors( app, text_layout_id, &token_array, buffer );

You'll need to insert the following function prototype above the declaration of default_render_buffer:

1
function void primitive_highlight_draw_cpp_token_colors( Application_Links *app, Text_Layout_ID text_layout_id, Token_Array *array, Buffer_ID buffer );

Add those lines in your theme file to change the colors.

1
2
3
4
primitive_highlight_type = 0xffaaaaef;
primitive_highlight_function = 0xffbbbbbb;
primitive_highlight_macro = 0xffa46391;
primitive_highlight_4coder_command = 0xffffffff;

You can define the order in which primitive types are chosen in case ...