New color scheme system up and running with dynamic meta-allocated-ids, arrays of colors in each slot, and full custom layer control

master
Allen Webster 2019-11-25 22:09:31 -08:00
parent c681ce5f7b
commit dbb2671bd0
28 changed files with 3679 additions and 3558 deletions

76
4ed.cpp
View File

@ -9,67 +9,6 @@
// TOP
internal void
fill_hardcode_default_style(Color_Table color_table){
color_table.vals[Stag_Back] = 0xFF0C0C0C;
color_table.vals[Stag_Margin] = 0xFF181818;
color_table.vals[Stag_Margin_Hover] = 0xFF252525;
color_table.vals[Stag_Margin_Active] = 0xFF323232;
color_table.vals[Stag_List_Item] = color_table.vals[Stag_Margin];
color_table.vals[Stag_List_Item_Hover] = color_table.vals[Stag_Margin_Hover];
color_table.vals[Stag_List_Item_Active] = color_table.vals[Stag_Margin_Active];
color_table.vals[Stag_Cursor] = 0xFF00EE00;
color_table.vals[Stag_Highlight] = 0xFFDDEE00;
color_table.vals[Stag_Mark] = 0xFF494949;
color_table.vals[Stag_Default] = 0xFF90B080;
color_table.vals[Stag_At_Cursor] = color_table.vals[Stag_Back];
color_table.vals[Stag_Highlight_Cursor_Line] = 0xFF1E1E1E;
color_table.vals[Stag_At_Highlight] = 0xFFFF44DD;
color_table.vals[Stag_Comment] = 0xFF2090F0;
color_table.vals[Stag_Keyword] = 0xFFD08F20;
color_table.vals[Stag_Str_Constant] = 0xFF50FF30;
color_table.vals[Stag_Char_Constant] = color_table.vals[Stag_Str_Constant];
color_table.vals[Stag_Int_Constant] = color_table.vals[Stag_Str_Constant];
color_table.vals[Stag_Float_Constant] = color_table.vals[Stag_Str_Constant];
color_table.vals[Stag_Bool_Constant] = color_table.vals[Stag_Str_Constant];
color_table.vals[Stag_Include] = color_table.vals[Stag_Str_Constant];
color_table.vals[Stag_Preproc] = color_table.vals[Stag_Default];
color_table.vals[Stag_Special_Character] = 0xFFFF0000;
color_table.vals[Stag_Ghost_Character] = color_blend(color_table.vals[Stag_Default], 0.5f, color_table.vals[Stag_Back]);
color_table.vals[Stag_Paste] = 0xFFDDEE00;
color_table.vals[Stag_Undo] = 0xFF00DDEE;
color_table.vals[Stag_Highlight_Junk] = 0xff3a0000;
color_table.vals[Stag_Highlight_White] = 0xff003a3a;
color_table.vals[Stag_Bar] = 0xFF888888;
color_table.vals[Stag_Base] = 0xFF000000;
color_table.vals[Stag_Pop1] = 0xFF3C57DC;
color_table.vals[Stag_Pop2] = 0xFFFF0000;
color_table.vals[Stag_Back_Cycle_1] = 0x10A00000;
color_table.vals[Stag_Back_Cycle_2] = 0x0C00A000;
color_table.vals[Stag_Back_Cycle_3] = 0x0C0000A0;
color_table.vals[Stag_Back_Cycle_4] = 0x0CA0A000;
color_table.vals[Stag_Text_Cycle_1] = 0xFFA00000;
color_table.vals[Stag_Text_Cycle_2] = 0xFF00A000;
color_table.vals[Stag_Text_Cycle_3] = 0xFF0030B0;
color_table.vals[Stag_Text_Cycle_4] = 0xFFA0A000;
color_table.vals[Stag_Line_Numbers_Back] = 0xFF101010;
color_table.vals[Stag_Line_Numbers_Text] = 0xFF404040;
}
internal void
app_hardcode_default_style(Models *models){
Color_Table color_table = {};
color_table.count = Stag_COUNT;
color_table.vals = push_array(models->arena, u32, color_table.count);
fill_hardcode_default_style(color_table);
models->fallback_color_table = color_table;
}
internal void
init_command_line_settings(App_Settings *settings, Plat_Settings *plat_settings, i32 argc, char **argv){
char *arg = 0;
@ -337,7 +276,6 @@ App_Init_Sig(app_init){
Face *new_face = font_set_new_face(&models->font_set, &description);
models->global_face_id = new_face->id;
}
app_hardcode_default_style(models);
// NOTE(allen): title space
models->has_new_title = true;
@ -805,20 +743,6 @@ App_Step_Sig(app_step){
frame.literal_dt = literal_dt;
frame.animation_dt = animation_dt;
{
Color_Table color_table = models->fallback_color_table;
#if 0
if (models->modify_color_table != 0){
color_table = models->modify_color_table(&models->app_links, frame);
if (color_table.count < models->fallback_color_table.count){
block_copy(models->fallback_color_table.vals, color_table.vals, color_table.count*sizeof(*color_table.vals));
color_table = models->fallback_color_table;
}
}
#endif
models->color_table = color_table;
}
Application_Links app = {};
app.tctx = tctx;
app.cmd_context = models;

View File

@ -1741,16 +1741,14 @@ view_set_buffer(Application_Links *app, View_ID view_id, Buffer_ID buffer_id, Se
// TODO(allen): remove this!
api(custom) function b32
view_post_fade(Application_Links *app, View_ID view_id, f32 seconds, Range_i64 range,
FColor color){
ARGB_Color color){
Models *models = (Models*)app->cmd_context;
View *view = imp_get_view(models, view_id);
b32 result = false;
if (api_check_view(view)){
i64 size = range_size(range);
if (size > 0){
Color_Table color_table = models->color_table;
view_post_paste_effect(view, seconds, (i32)range.start, (i32)size,
finalize_color(color_table, color));
view_post_paste_effect(view, seconds, (i32)range.start, (i32)size, color);
result = true;
}
}
@ -2018,6 +2016,13 @@ managed_scope_allocator(Application_Links *app, Managed_Scope scope)
return(result);
}
api(custom) function u64
managed_id_group_highest_id(Application_Links *app, String_Const_u8 group){
Models *models = (Models*)app->cmd_context;
Managed_ID_Set *set = &models->managed_id_set;
return(managed_ids_group_highest_id(set, group));
}
api(custom) function Managed_ID
managed_id_declare(Application_Links *app, String_Const_u8 group, String_Const_u8 name)
{
@ -2772,37 +2777,6 @@ try_release_face(Application_Links *app, Face_ID id, Face_ID replacement_id)
return(release_font_and_update(models, face, replacement));
}
api(custom) function void
set_theme_colors(Application_Links *app, Theme_Color *colors, i32 count)
{
Models *models = (Models*)app->cmd_context;
Color_Table color_table = models->color_table;
Theme_Color *theme_color = colors;
for (i32 i = 0; i < count; ++i, ++theme_color){
if (theme_color->tag < color_table.count){
color_table.vals[theme_color->tag] = theme_color->color;
}
}
}
api(custom) function void
get_theme_colors(Application_Links *app, Theme_Color *colors, i32 count)
{
Models *models = (Models*)app->cmd_context;
Color_Table color_table = models->color_table;
Theme_Color *theme_color = colors;
for (i32 i = 0; i < count; ++i, ++theme_color){
theme_color->color = finalize_color(color_table, theme_color->tag);
}
}
api(custom) function ARGB_Color
finalize_color(Application_Links *app, ID_Color color){
Models *models = (Models*)app->cmd_context;
Color_Table color_table = models->color_table;
return(finalize_color(color_table, color));
}
api(custom) function String_Const_u8
push_hot_directory(Application_Links *app, Arena *arena)
{
@ -2841,7 +2815,7 @@ set_window_title(Application_Links *app, String_Const_u8 title)
}
api(custom) function Vec2_f32
draw_string_oriented(Application_Links *app, Face_ID font_id, FColor color,
draw_string_oriented(Application_Links *app, Face_ID font_id, ARGB_Color color,
String_Const_u8 str, Vec2_f32 point, u32 flags, Vec2_f32 delta)
{
Vec2_f32 result = point;
@ -2852,9 +2826,7 @@ draw_string_oriented(Application_Links *app, Face_ID font_id, FColor color,
result += delta*width;
}
else{
Color_Table color_table = models->color_table;
u32 actual_color = finalize_color(color_table, color);
f32 width = draw_string(models->target, face, str, point, actual_color, flags, delta);
f32 width = draw_string(models->target, face, str, point, color, flags, delta);
result += delta*width;
}
return(result);
@ -2869,23 +2841,18 @@ get_string_advance(Application_Links *app, Face_ID font_id, String_Const_u8 str)
}
api(custom) function void
draw_rectangle(Application_Links *app, Rect_f32 rect, f32 roundness, FColor color){
draw_rectangle(Application_Links *app, Rect_f32 rect, f32 roundness, ARGB_Color color){
Models *models = (Models*)app->cmd_context;
if (models->in_render_mode){
Color_Table color_table = models->color_table;
u32 actual_color = finalize_color(color_table, color);
draw_rectangle(models->target, rect, roundness, actual_color);
draw_rectangle(models->target, rect, roundness, color);
}
}
api(custom) function void
draw_rectangle_outline(Application_Links *app, Rect_f32 rect,
f32 roundness, f32 thickness, FColor color){
draw_rectangle_outline(Application_Links *app, Rect_f32 rect, f32 roundness, f32 thickness, ARGB_Color color){
Models *models = (Models*)app->cmd_context;
if (models->in_render_mode){
Color_Table color_table = models->color_table;
u32 actual_color = finalize_color(color_table, color);
draw_rectangle_outline(models->target, rect, roundness, thickness, actual_color);
draw_rectangle_outline(models->target, rect, roundness, thickness, color);
}
}
@ -2932,11 +2899,7 @@ text_layout_create(Application_Links *app, Buffer_ID buffer_id, Rect_f32 rect, B
buffer_get_last_pos_from_line_number(buffer, visible_line_number_range.max));
i64 item_count = range_size_inclusive(visible_range);
FColor *colors_array = push_array(arena, FColor, item_count);
for (i64 i = 0; i < item_count; i += 1){
colors_array[i].a_byte = 0;
colors_array[i].id = Stag_Default;
}
ARGB_Color *colors_array = push_array_zero(arena, ARGB_Color, item_count);
result = text_layout_new(&models->text_layouts, arena, buffer_id, buffer_point,
visible_range, visible_line_number_range, rect, colors_array,
layout_func);
@ -3086,7 +3049,7 @@ text_layout_character_on_screen(Application_Links *app, Text_Layout_ID layout_id
api(custom) function void
paint_text_color(Application_Links *app, Text_Layout_ID layout_id, Interval_i64 range,
FColor color){
ARGB_Color color){
Models *models = (Models*)app->cmd_context;
Rect_f32 result = {};
Text_Layout *layout = text_layout_get(&models->text_layouts, layout_id);
@ -3095,7 +3058,7 @@ paint_text_color(Application_Links *app, Text_Layout_ID layout_id, Interval_i64
range.max = clamp_top(range.max, layout->visible_range.max);
range.min -= layout->visible_range.min;
range.max -= layout->visible_range.min;
FColor *color_ptr = layout->item_colors + range.min;
ARGB_Color *color_ptr = layout->item_colors + range.min;
for (i64 i = range.min; i < range.max; i += 1, color_ptr += 1){
*color_ptr = color;
}
@ -3109,11 +3072,11 @@ text_layout_free(Application_Links *app, Text_Layout_ID text_layout_id){
}
api(custom) function void
draw_text_layout(Application_Links *app, Text_Layout_ID layout_id){
draw_text_layout(Application_Links *app, Text_Layout_ID layout_id, ARGB_Color special_color, ARGB_Color ghost_color){
Models *models = (Models*)app->cmd_context;
Text_Layout *layout = text_layout_get(&models->text_layouts, layout_id);
if (layout != 0 && models->target != 0){
text_layout_render(app->tctx, models, layout);
text_layout_render(app->tctx, models, layout, special_color, ghost_color);
}
}

View File

@ -76,8 +76,7 @@ struct Models{
Buffer_Region_Function *buffer_region;
Layout_Function *layout_func;
Color_Table fallback_color_table;
Color_Table color_table;
Color_Table color_table_;
Model_View_Command_Function *free_view_cmd_funcs;
Model_View_Command_Function *first_view_cmd_func;

View File

@ -15,6 +15,20 @@ managed_ids_init(Base_Allocator *allocator, Managed_ID_Set *set){
set->name_to_group_table = make_table_Data_u64(allocator, 20);
}
internal Managed_ID
managed_ids_group_highest_id(Managed_ID_Set *set, String_Const_u8 group_name){
Managed_ID result = 0;
Data data = make_data(group_name.str, group_name.size);
Table_Lookup lookup = table_lookup(&set->name_to_group_table, data);
if (lookup.found_match){
u64 val = 0;
table_read(&set->name_to_group_table, lookup, &val);
Managed_ID_Group *group = (Managed_ID_Group*)IntAsPtr(val);
result = group->id_counter - 1;
}
return(result);
}
internal Managed_ID
managed_ids_declare(Managed_ID_Set *set, String_Const_u8 group_name, String_Const_u8 name){
Managed_ID_Group *group = 0;

View File

@ -37,8 +37,8 @@ text_layout_release(Thread_Context *tctx, Models *models, Text_Layout_Container
internal Text_Layout_ID
text_layout_new(Text_Layout_Container *container, Arena *arena,
Buffer_ID buffer_id, Buffer_Point point,
Range_i64 visible_range, Interval_i64 visible_line_number_range,
Rect_f32 rect, FColor *item_colors, Layout_Function *layout_func){
Range_i64 visible_range, Range_i64 visible_line_number_range,
Rect_f32 rect, ARGB_Color *item_colors, Layout_Function *layout_func){
Text_Layout *new_layout_data = text_layout_new__alloc_layout(container);
new_layout_data->arena = arena;
new_layout_data->buffer_id = buffer_id;
@ -83,17 +83,14 @@ text_layout_erase(Thread_Context *tctx, Models *models, Text_Layout_Container *c
////////////////////////////////
internal void
text_layout_render(Thread_Context *tctx, Models *models, Text_Layout *layout){
text_layout_render(Thread_Context *tctx, Models *models, Text_Layout *layout,
ARGB_Color special_color, ARGB_Color ghost_color){
Editing_File *file = imp_get_file(models, layout->buffer_id);
if (file != 0){
Render_Target *target = models->target;
Color_Table color_table = models->color_table;
Face *face = file_get_face(models, file);
f32 width = rect_width(layout->rect);
ARGB_Color special_color = color_table.vals[Stag_Special_Character];
ARGB_Color ghost_color = color_table.vals[Stag_Ghost_Character];
Vec2_f32 shift_p = layout->rect.p0 - layout->point.pixel_shift;
i64 first_index = layout->visible_range.first;
i64 line_number = layout->visible_line_number_range.min;
@ -108,7 +105,7 @@ text_layout_render(Thread_Context *tctx, Models *models, Text_Layout *layout){
block = block->next){
Layout_Item *item = block->items;
i64 count = block->item_count;
FColor *item_colors = layout->item_colors;
ARGB_Color *item_colors = layout->item_colors;
for (i32 i = 0; i < count; i += 1, item += 1){
if (item->codepoint != 0){
ARGB_Color color = 0;
@ -119,12 +116,10 @@ text_layout_render(Thread_Context *tctx, Models *models, Text_Layout *layout){
color = ghost_color;
}
else{
FColor fcolor = item_colors[item->index - first_index];
color = finalize_color(color_table, fcolor);
color = item_colors[item->index - first_index];
}
Vec2_f32 p = item->rect.p0 + shift_p;
draw_font_glyph(target, face, item->codepoint,
p, color, GlyphFlag_None);
draw_font_glyph(target, face, item->codepoint, p, color, GlyphFlag_None);
}
}
}

View File

@ -21,7 +21,7 @@ union Text_Layout{
Interval_i64 visible_range;
Interval_i64 visible_line_number_range;
Rect_f32 rect;
FColor *item_colors;
ARGB_Color *item_colors;
Layout_Function *layout_func;
};
};

View File

@ -793,22 +793,6 @@ release_font_and_update(Models *models, Face *face, Face *replacement_face){
////////////////////////////////
function ARGB_Color
finalize_color(Color_Table color_table, ID_Color id){
return(color_table.vals[id % color_table.count]);
}
function ARGB_Color
finalize_color(Color_Table color_table, FColor fcolor){
ARGB_Color result = fcolor.argb;
if (fcolor.a_byte == 0){
result = finalize_color(color_table, fcolor.id);
}
return(result);
}
////////////////////////////////
internal View*
imp_get_view(Models *models, View_ID view_id){
Live_Views *view_set = &models->view_set;

View File

@ -1593,173 +1593,6 @@ CUSTOM_DOC("Reopen the current buffer from the hard drive.")
////////////////////////////////
CUSTOM_COMMAND_SIG(multi_paste){
Scratch_Block scratch(app);
i32 count = clipboard_count(app, 0);
if (count > 0){
View_ID view = get_active_view(app, Access_ReadWriteVisible);
Managed_Scope scope = view_get_managed_scope(app, view);
Rewrite_Type *rewrite = scope_attachment(app, scope, view_rewrite_loc, Rewrite_Type);
if (*rewrite == Rewrite_Paste){
Rewrite_Type *next_rewrite = scope_attachment(app, scope, view_next_rewrite_loc, Rewrite_Type);
*next_rewrite = Rewrite_Paste;
i32 *paste_index_ptr = scope_attachment(app, scope, view_paste_index_loc, i32);
i32 paste_index = (*paste_index_ptr) + 1;
*paste_index_ptr = paste_index;
String_Const_u8 string = push_clipboard_index(app, scratch, 0, paste_index);
String_Const_u8 insert_string = push_u8_stringf(scratch, "\n%.*s", string_expand(string));
Buffer_ID buffer = view_get_buffer(app, view, Access_ReadWriteVisible);
Range_i64 range = get_view_range(app, view);
buffer_replace_range(app, buffer, Ii64(range.max), insert_string);
view_set_mark(app, view, seek_pos(range.max + 1));
view_set_cursor_and_preferred_x(app, view, seek_pos(range.max + insert_string.size));
view_post_fade(app, view, 0.667f,
Ii64(range.max + 1, range.max + insert_string.size),
fcolor_id(Stag_Paste));
}
else{
paste(app);
}
}
}
function Range_i64
multi_paste_range(Application_Links *app, View_ID view, Range_i64 range, i32 paste_count, b32 old_to_new){
Scratch_Block scratch(app);
Range_i64 finish_range = range;
if (paste_count >= 1){
Buffer_ID buffer = view_get_buffer(app, view, Access_ReadWriteVisible);
if (buffer != 0){
i64 total_size = 0;
for (i32 paste_index = 0; paste_index < paste_count; ++paste_index){
Temp_Memory temp = begin_temp(scratch);
String_Const_u8 string = push_clipboard_index(app, scratch, 0, paste_index);
total_size += string.size + 1;
end_temp(temp);
}
total_size -= 1;
i32 first = paste_count - 1;
i32 one_past_last = -1;
i32 step = -1;
if (!old_to_new){
first = 0;
one_past_last = paste_count;
step = 1;
}
List_String_Const_u8 list = {};
for (i32 paste_index = first; paste_index != one_past_last; paste_index += step){
if (paste_index != first){
string_list_push(scratch, &list, SCu8("\n", 1));
}
String_Const_u8 string = push_clipboard_index(app, scratch, 0, paste_index);
if (string.size > 0){
string_list_push(scratch, &list, string);
}
}
String_Const_u8 flattened = string_list_flatten(scratch, list);
buffer_replace_range(app, buffer, range, flattened);
i64 pos = range.min;
finish_range.min = pos;
finish_range.max = pos + total_size;
view_set_mark(app, view, seek_pos(finish_range.min));
view_set_cursor_and_preferred_x(app, view, seek_pos(finish_range.max));
// TODO(allen): Send this to all views.
view_post_fade(app, view, 0.667f, finish_range, fcolor_id(Stag_Paste));
}
}
return(finish_range);
}
function void
multi_paste_interactive_up_down(Application_Links *app, i32 paste_count, i32 clip_count){
View_ID view = get_active_view(app, Access_ReadWriteVisible);
i64 pos = view_get_cursor_pos(app, view);
b32 old_to_new = true;
Range_i64 range = multi_paste_range(app, view, Ii64(pos), paste_count, old_to_new);
Query_Bar_Group group(app);
Query_Bar bar = {};
bar.prompt = string_u8_litexpr("Up and Down to condense and expand paste stages; R to reverse order; Return to finish; Escape to abort.");
if (start_query_bar(app, &bar, 0) == 0) return;
User_Input in = {};
for (;;){
in = get_next_input(app, EventProperty_AnyKey, EventProperty_Escape);
if (in.abort) break;
b32 did_modify = false;
if (match_key_code(&in, KeyCode_Up)){
if (paste_count > 1){
--paste_count;
did_modify = true;
}
}
else if (match_key_code(&in, KeyCode_Down)){
if (paste_count < clip_count){
++paste_count;
did_modify = true;
}
}
else if (match_key_code(&in, KeyCode_R)){
old_to_new = !old_to_new;
did_modify = true;
}
else if (match_key_code(&in, KeyCode_Return)){
break;
}
if (did_modify){
range = multi_paste_range(app, view, range, paste_count, old_to_new);
}
}
if (in.abort){
Buffer_ID buffer = view_get_buffer(app, view, Access_ReadWriteVisible);
buffer_replace_range(app, buffer, range, SCu8(""));
}
}
CUSTOM_COMMAND_SIG(multi_paste_interactive){
i32 clip_count = clipboard_count(app, 0);
if (clip_count > 0){
multi_paste_interactive_up_down(app, 1, clip_count);
}
}
CUSTOM_COMMAND_SIG(multi_paste_interactive_quick){
i32 clip_count = clipboard_count(app, 0);
if (clip_count > 0){
u8 string_space[256];
Query_Bar_Group group(app);
Query_Bar bar = {};
bar.prompt = string_u8_litexpr("How Many Slots To Paste: ");
bar.string = SCu8(string_space, (umem)0);
bar.string_capacity = sizeof(string_space);
query_user_number(app, &bar);
i32 initial_paste_count = (i32)string_to_integer(bar.string, 10);
initial_paste_count = clamp(1, initial_paste_count, clip_count);
end_query_bar(app, &bar, 0);
multi_paste_interactive_up_down(app, initial_paste_count, clip_count);
}
}
////////////////////////////////
internal i32
record_get_new_cursor_position_undo(Application_Links *app, Buffer_ID buffer_id, History_Record_Index index, Record_Info record){
i32 new_edit_position = 0;

View File

@ -62,7 +62,8 @@ CUSTOM_DOC("At the cursor, insert the text at the top of the clipboard.")
view_set_cursor_and_preferred_x(app, view, seek_pos(pos + (i32)string.size));
// TODO(allen): Send this to all views.
view_post_fade(app, view, 0.667f, Ii64_size(pos, string.size), fcolor_id(Stag_Paste));
ARGB_Color argb = fcolor_resolve(fcolor_id(defcolor_paste));
view_post_fade(app, view, 0.667f, Ii64_size(pos, string.size), argb);
}
}
}
@ -97,7 +98,8 @@ CUSTOM_DOC("If the previous command was paste or paste_next, replaces the paste
buffer_replace_range(app, buffer, range, string);
view_set_cursor_and_preferred_x(app, view, seek_pos(pos + string.size));
view_post_fade(app, view, 0.667f, Ii64_size(pos, string.size), fcolor_id(Stag_Paste));
ARGB_Color argb = fcolor_resolve(fcolor_id(defcolor_paste));
view_post_fade(app, view, 0.667f, Ii64_size(pos, string.size), argb);
}
else{
paste(app);
@ -119,5 +121,174 @@ CUSTOM_DOC("Paste the next item on the clipboard and run auto-indent on the newl
auto_indent_range(app);
}
////////////////////////////////
CUSTOM_COMMAND_SIG(multi_paste){
Scratch_Block scratch(app);
i32 count = clipboard_count(app, 0);
if (count > 0){
View_ID view = get_active_view(app, Access_ReadWriteVisible);
Managed_Scope scope = view_get_managed_scope(app, view);
Rewrite_Type *rewrite = scope_attachment(app, scope, view_rewrite_loc, Rewrite_Type);
if (*rewrite == Rewrite_Paste){
Rewrite_Type *next_rewrite = scope_attachment(app, scope, view_next_rewrite_loc, Rewrite_Type);
*next_rewrite = Rewrite_Paste;
i32 *paste_index_ptr = scope_attachment(app, scope, view_paste_index_loc, i32);
i32 paste_index = (*paste_index_ptr) + 1;
*paste_index_ptr = paste_index;
String_Const_u8 string = push_clipboard_index(app, scratch, 0, paste_index);
String_Const_u8 insert_string = push_u8_stringf(scratch, "\n%.*s", string_expand(string));
Buffer_ID buffer = view_get_buffer(app, view, Access_ReadWriteVisible);
Range_i64 range = get_view_range(app, view);
buffer_replace_range(app, buffer, Ii64(range.max), insert_string);
view_set_mark(app, view, seek_pos(range.max + 1));
view_set_cursor_and_preferred_x(app, view, seek_pos(range.max + insert_string.size));
ARGB_Color argb = fcolor_resolve(fcolor_id(defcolor_paste));
view_post_fade(app, view, 0.667f,
Ii64(range.max + 1, range.max + insert_string.size),
argb);
}
else{
paste(app);
}
}
}
function Range_i64
multi_paste_range(Application_Links *app, View_ID view, Range_i64 range, i32 paste_count, b32 old_to_new){
Scratch_Block scratch(app);
Range_i64 finish_range = range;
if (paste_count >= 1){
Buffer_ID buffer = view_get_buffer(app, view, Access_ReadWriteVisible);
if (buffer != 0){
i64 total_size = 0;
for (i32 paste_index = 0; paste_index < paste_count; ++paste_index){
Temp_Memory temp = begin_temp(scratch);
String_Const_u8 string = push_clipboard_index(app, scratch, 0, paste_index);
total_size += string.size + 1;
end_temp(temp);
}
total_size -= 1;
i32 first = paste_count - 1;
i32 one_past_last = -1;
i32 step = -1;
if (!old_to_new){
first = 0;
one_past_last = paste_count;
step = 1;
}
List_String_Const_u8 list = {};
for (i32 paste_index = first; paste_index != one_past_last; paste_index += step){
if (paste_index != first){
string_list_push(scratch, &list, SCu8("\n", 1));
}
String_Const_u8 string = push_clipboard_index(app, scratch, 0, paste_index);
if (string.size > 0){
string_list_push(scratch, &list, string);
}
}
String_Const_u8 flattened = string_list_flatten(scratch, list);
buffer_replace_range(app, buffer, range, flattened);
i64 pos = range.min;
finish_range.min = pos;
finish_range.max = pos + total_size;
view_set_mark(app, view, seek_pos(finish_range.min));
view_set_cursor_and_preferred_x(app, view, seek_pos(finish_range.max));
// TODO(allen): Send this to all views.
ARGB_Color argb = fcolor_resolve(fcolor_id(defcolor_paste));
view_post_fade(app, view, 0.667f, finish_range, argb);
}
}
return(finish_range);
}
function void
multi_paste_interactive_up_down(Application_Links *app, i32 paste_count, i32 clip_count){
View_ID view = get_active_view(app, Access_ReadWriteVisible);
i64 pos = view_get_cursor_pos(app, view);
b32 old_to_new = true;
Range_i64 range = multi_paste_range(app, view, Ii64(pos), paste_count, old_to_new);
Query_Bar_Group group(app);
Query_Bar bar = {};
bar.prompt = string_u8_litexpr("Up and Down to condense and expand paste stages; R to reverse order; Return to finish; Escape to abort.");
if (start_query_bar(app, &bar, 0) == 0) return;
User_Input in = {};
for (;;){
in = get_next_input(app, EventProperty_AnyKey, EventProperty_Escape);
if (in.abort) break;
b32 did_modify = false;
if (match_key_code(&in, KeyCode_Up)){
if (paste_count > 1){
--paste_count;
did_modify = true;
}
}
else if (match_key_code(&in, KeyCode_Down)){
if (paste_count < clip_count){
++paste_count;
did_modify = true;
}
}
else if (match_key_code(&in, KeyCode_R)){
old_to_new = !old_to_new;
did_modify = true;
}
else if (match_key_code(&in, KeyCode_Return)){
break;
}
if (did_modify){
range = multi_paste_range(app, view, range, paste_count, old_to_new);
}
}
if (in.abort){
Buffer_ID buffer = view_get_buffer(app, view, Access_ReadWriteVisible);
buffer_replace_range(app, buffer, range, SCu8(""));
}
}
CUSTOM_COMMAND_SIG(multi_paste_interactive){
i32 clip_count = clipboard_count(app, 0);
if (clip_count > 0){
multi_paste_interactive_up_down(app, 1, clip_count);
}
}
CUSTOM_COMMAND_SIG(multi_paste_interactive_quick){
i32 clip_count = clipboard_count(app, 0);
if (clip_count > 0){
u8 string_space[256];
Query_Bar_Group group(app);
Query_Bar bar = {};
bar.prompt = string_u8_litexpr("How Many Slots To Paste: ");
bar.string = SCu8(string_space, (umem)0);
bar.string_capacity = sizeof(string_space);
query_user_number(app, &bar);
i32 initial_paste_count = (i32)string_to_integer(bar.string, 10);
initial_paste_count = clamp(1, initial_paste_count, clip_count);
end_query_bar(app, &bar, 0);
multi_paste_interactive_up_down(app, initial_paste_count, clip_count);
}
}
// BOTTOM

View File

@ -26,6 +26,7 @@ custom_layer_init(Application_Links *app){
ProfileThreadName(tctx, list, string_u8_litexpr("main"));
initialize_managed_id_metadata(app);
set_default_color_scheme(app);
}
#endif

View File

@ -0,0 +1,140 @@
/*
* Default color slots
*/
// TOP
function Color_Array
finalize_color_array(Color_Table table, u64 id){
return(table.arrays[id % table.count]);
}
function ARGB_Color
finalize_color(Color_Array array, i32 sub_index){
ARGB_Color result = 0xFFFFFFFF;
if (array.count > 0){
result = array.vals[sub_index % array.count];
}
return(result);
}
function ARGB_Color
finalize_color(Color_Table color_table, u64 id, i32 sub_index){
Color_Array array = finalize_color_array(color_table, id);
return(finalize_color(array, sub_index));
}
function Color_Array
finalize_color_array(u64 id){
return(finalize_color_array(active_color_table, id));
}
function ARGB_Color
finalize_color(u64 id, i32 sub_index){
return(finalize_color(active_color_table, id, sub_index));
}
////////////////////////////////
function Color_Array
make_colors(Arena *arena, ARGB_Color color){
Color_Array result = {};
result.count = 1;
result.vals = push_array(arena, ARGB_Color, 1);
result.vals[0] = color;
return(result);
}
function Color_Array
make_colors(Arena *arena, ARGB_Color c1, ARGB_Color c2){
Color_Array result = {};
result.count = 2;
result.vals = push_array(arena, ARGB_Color, 2);
result.vals[0] = c1;
result.vals[1] = c2;
return(result);
}
function Color_Array
make_colors(Arena *arena, ARGB_Color c1, ARGB_Color c2, ARGB_Color c3){
Color_Array result = {};
result.count = 3;
result.vals = push_array(arena, ARGB_Color, 3);
result.vals[0] = c1;
result.vals[1] = c2;
result.vals[2] = c3;
return(result);
}
function Color_Array
make_colors(Arena *arena, ARGB_Color c1, ARGB_Color c2, ARGB_Color c3, ARGB_Color c4){
Color_Array result = {};
result.count = 4;
result.vals = push_array(arena, ARGB_Color, 4);
result.vals[0] = c1;
result.vals[1] = c2;
result.vals[2] = c3;
result.vals[3] = c4;
return(result);
}
function Color_Array
make_colors(Arena *arena, ARGB_Color *colors, i32 count){
Color_Array result = {};
result.count = count;
result.vals = push_array_write(arena, ARGB_Color, count, colors);
return(result);
}
function void
set_default_color_scheme(Application_Links *app){
Arena arena = make_arena_system();
Managed_ID highest_color_id = managed_id_group_highest_id(app, string_u8_litexpr("colors"));
default_color_table.count = (u32)(clamp_top(highest_color_id + 1, max_u32));
default_color_table.arrays = push_array_zero(&arena, Color_Array, default_color_table.count);
default_color_table.arrays[0] = make_colors(&arena, 0xFF90B080);
default_color_table.arrays[defcolor_bar] = make_colors(&arena, 0xFF888888);
default_color_table.arrays[defcolor_base] = make_colors(&arena, 0xFF000000);
default_color_table.arrays[defcolor_pop1] = make_colors(&arena, 0xFF3C57DC);
default_color_table.arrays[defcolor_pop2] = make_colors(&arena, 0xFFFF0000);
default_color_table.arrays[defcolor_back] = make_colors(&arena, 0xFF0C0C0C);
default_color_table.arrays[defcolor_margin] = make_colors(&arena, 0xFF181818);
default_color_table.arrays[defcolor_margin_hover] = make_colors(&arena, 0xFF252525);
default_color_table.arrays[defcolor_margin_active] = make_colors(&arena, 0xFF323232);
default_color_table.arrays[defcolor_list_item] = make_colors(&arena, 0xFF181818);
default_color_table.arrays[defcolor_list_item_hover] = make_colors(&arena, 0xFF252525);
default_color_table.arrays[defcolor_list_item_active] = make_colors(&arena, 0xFF323232);
default_color_table.arrays[defcolor_cursor] = make_colors(&arena, 0xFF00EE00);
default_color_table.arrays[defcolor_at_cursor] = make_colors(&arena, 0xFF0C0C0C);
default_color_table.arrays[defcolor_highlight_cursor_line] = make_colors(&arena, 0xFF1E1E1E);
default_color_table.arrays[defcolor_highlight] = make_colors(&arena, 0xFFDDEE00);
default_color_table.arrays[defcolor_at_highlight] = make_colors(&arena, 0xFFFF44DD);
default_color_table.arrays[defcolor_mark] = make_colors(&arena, 0xFF494949);
default_color_table.arrays[defcolor_text_default] = make_colors(&arena, 0xFF90B080);
default_color_table.arrays[defcolor_comment] = make_colors(&arena, 0xFF2090F0);
default_color_table.arrays[defcolor_comment_pop] = make_colors(&arena, 0xFF00A000, 0xFFA00000);
default_color_table.arrays[defcolor_keyword] = make_colors(&arena, 0xFFD08F20);
default_color_table.arrays[defcolor_str_constant] = make_colors(&arena, 0xFF50FF30);
default_color_table.arrays[defcolor_char_constant] = make_colors(&arena, 0xFF50FF30);
default_color_table.arrays[defcolor_int_constant] = make_colors(&arena, 0xFF50FF30);
default_color_table.arrays[defcolor_float_constant] = make_colors(&arena, 0xFF50FF30);
default_color_table.arrays[defcolor_bool_constant] = make_colors(&arena, 0xFF50FF30);
default_color_table.arrays[defcolor_preproc] = make_colors(&arena, 0xFFA0B8A0);
default_color_table.arrays[defcolor_include] = make_colors(&arena, 0xFF50FF30);
default_color_table.arrays[defcolor_special_character] = make_colors(&arena, 0xFFFF0000);
default_color_table.arrays[defcolor_ghost_character] = make_colors(&arena, 0xFF4E5E46);
default_color_table.arrays[defcolor_highlight_junk] = make_colors(&arena, 0xFF3A0000);
default_color_table.arrays[defcolor_highlight_white] = make_colors(&arena, 0xFF003A3A);
default_color_table.arrays[defcolor_paste] = make_colors(&arena, 0xFFDDEE00);
default_color_table.arrays[defcolor_undo] = make_colors(&arena, 0xFF00DDEE);
default_color_table.arrays[defcolor_back_cycle] = make_colors(&arena, 0xFF130707, 0xFF071307, 0xFF070713, 0xFF131307);
default_color_table.arrays[defcolor_text_cycle] = make_colors(&arena, 0xFFA00000, 0xFF00A000, 0xFF0030B0, 0xFFA0A000);
default_color_table.arrays[defcolor_line_numbers_back] = make_colors(&arena, 0xFF101010);
default_color_table.arrays[defcolor_line_numbers_text] = make_colors(&arena, 0xFF404040);
active_color_table = default_color_table;
}
// BOTTOM

View File

@ -1,59 +1,55 @@
/*
* Colors with meanings built into the core.
* Default color slots
*/
// TOP
enum Style_Tag{
Stag_NOOP = 0,
#if !defined(FCODER_DEFAULT_COLORS_H)
#define FCODER_DEFAULT_COLORS_H
Stag_Bar = 1,
Stag_Base = 2,
Stag_Pop1 = 3,
Stag_Pop2 = 4,
Stag_Back = 5,
Stag_Margin = 6,
Stag_Margin_Hover = 7,
Stag_Margin_Active = 8,
Stag_List_Item = 9,
Stag_List_Item_Hover = 10,
Stag_List_Item_Active = 11,
Stag_Cursor = 12,
Stag_At_Cursor = 13,
Stag_Highlight_Cursor_Line = 14,
Stag_Highlight = 15,
Stag_At_Highlight = 16,
Stag_Mark = 17,
Stag_Default = 18,
Stag_Comment = 19,
Stag_Keyword = 20,
Stag_Str_Constant = 21,
Stag_Char_Constant = 22,
Stag_Int_Constant = 23,
Stag_Float_Constant = 24,
Stag_Bool_Constant = 25,
Stag_Preproc = 26,
Stag_Include = 27,
Stag_Special_Character = 28,
Stag_Ghost_Character = 29,
Stag_Highlight_Junk = 30,
Stag_Highlight_White = 31,
Stag_Paste = 32,
Stag_Undo = 33,
Stag_Back_Cycle_1 = 34,
Stag_Back_Cycle_2 = 35,
Stag_Back_Cycle_3 = 36,
Stag_Back_Cycle_4 = 37,
Stag_Text_Cycle_1 = 38,
Stag_Text_Cycle_2 = 39,
Stag_Text_Cycle_3 = 40,
Stag_Text_Cycle_4 = 41,
Stag_Line_Numbers_Back = 42,
Stag_Line_Numbers_Text = 43,
Stag_COUNT = 44
};
CUSTOM_ID(colors, defcolor_bar);
CUSTOM_ID(colors, defcolor_base);
CUSTOM_ID(colors, defcolor_pop1);
CUSTOM_ID(colors, defcolor_pop2);
CUSTOM_ID(colors, defcolor_back);
CUSTOM_ID(colors, defcolor_margin);
CUSTOM_ID(colors, defcolor_margin_hover);
CUSTOM_ID(colors, defcolor_margin_active);
CUSTOM_ID(colors, defcolor_list_item);
CUSTOM_ID(colors, defcolor_list_item_hover);
CUSTOM_ID(colors, defcolor_list_item_active);
CUSTOM_ID(colors, defcolor_cursor);
CUSTOM_ID(colors, defcolor_at_cursor);
CUSTOM_ID(colors, defcolor_highlight_cursor_line);
CUSTOM_ID(colors, defcolor_highlight);
CUSTOM_ID(colors, defcolor_at_highlight);
CUSTOM_ID(colors, defcolor_mark);
CUSTOM_ID(colors, defcolor_text_default);
CUSTOM_ID(colors, defcolor_comment);
CUSTOM_ID(colors, defcolor_comment_pop);
CUSTOM_ID(colors, defcolor_keyword);
CUSTOM_ID(colors, defcolor_str_constant);
CUSTOM_ID(colors, defcolor_char_constant);
CUSTOM_ID(colors, defcolor_int_constant);
CUSTOM_ID(colors, defcolor_float_constant);
CUSTOM_ID(colors, defcolor_bool_constant);
CUSTOM_ID(colors, defcolor_preproc);
CUSTOM_ID(colors, defcolor_include);
CUSTOM_ID(colors, defcolor_special_character);
CUSTOM_ID(colors, defcolor_ghost_character);
CUSTOM_ID(colors, defcolor_highlight_junk);
CUSTOM_ID(colors, defcolor_highlight_white);
CUSTOM_ID(colors, defcolor_paste);
CUSTOM_ID(colors, defcolor_undo);
CUSTOM_ID(colors, defcolor_back_cycle);
CUSTOM_ID(colors, defcolor_text_cycle);
CUSTOM_ID(colors, defcolor_line_numbers_back);
CUSTOM_ID(colors, defcolor_line_numbers_text);
#define FirstCustomColor Stag_COUNT
global Color_Table active_color_table = {};
global Color_Table default_color_table = {};
#endif
// BOTTOM

View File

@ -318,11 +318,7 @@ recursive_nest_highlight(Application_Links *app, Text_Layout_ID layout_id, Range
}
}
FColor t_colors[] = {
fcolor_id(Stag_Text_Cycle_1), fcolor_id(Stag_Text_Cycle_2),
fcolor_id(Stag_Text_Cycle_3), fcolor_id(Stag_Text_Cycle_4),
};
FColor t_color = t_colors[counter%ArrayCount(t_colors)];
ARGB_Color argb = finalize_color(defcolor_text_cycle, counter);
for (;ptr < ptr_end; ptr += 1){
Code_Index_Nest *nest = *ptr;
@ -330,9 +326,9 @@ recursive_nest_highlight(Application_Links *app, Text_Layout_ID layout_id, Range
break;
}
paint_text_color(app, layout_id, nest->open, t_color);
paint_text_color(app, layout_id, nest->open, argb);
if (nest->is_closed){
paint_text_color(app, layout_id, nest->close, t_color);
paint_text_color(app, layout_id, nest->close, argb);
}
recursive_nest_highlight(app, layout_id, range, &nest->nest_array, counter + 1);
}
@ -362,24 +358,25 @@ default_render_buffer(Application_Links *app, View_ID view_id, Face_ID face_id,
// NOTE(allen): Scan for TODOs and NOTEs
if (global_config.use_comment_keyword){
Comment_Highlight_Pair pairs[] = {
{string_u8_litexpr("NOTE"), Stag_Text_Cycle_2},
{string_u8_litexpr("TODO"), Stag_Text_Cycle_1},
{string_u8_litexpr("NOTE"), finalize_color(defcolor_comment_pop, 0)},
{string_u8_litexpr("TODO"), finalize_color(defcolor_comment_pop, 1)},
};
draw_comment_highlights(app, buffer, text_layout_id,
&token_array, pairs, ArrayCount(pairs));
}
}
else{
Range_i64 visible_range = text_layout_get_visible_range(app, text_layout_id);
paint_text_color_fcolor(app, text_layout_id, visible_range, fcolor_id(defcolor_text_default));
}
i64 cursor_pos = view_correct_cursor(app, view_id);
view_correct_mark(app, view_id);
// NOTE(allen): Scope highlight
if (global_config.use_scope_highlight){
FColor colors[] = {
fcolor_id(Stag_Back_Cycle_1), fcolor_id(Stag_Back_Cycle_2),
fcolor_id(Stag_Back_Cycle_3), fcolor_id(Stag_Back_Cycle_4),
};
draw_scope_highlight(app, buffer, text_layout_id, cursor_pos, colors, ArrayCount(colors));
Color_Array colors = finalize_color_array(defcolor_back_cycle);
draw_scope_highlight(app, buffer, text_layout_id, cursor_pos, colors.vals, colors.count);
}
if (global_config.use_error_highlight || global_config.use_jump_highlight){
@ -388,7 +385,7 @@ default_render_buffer(Application_Links *app, View_ID view_id, Face_ID face_id,
Buffer_ID compilation_buffer = get_buffer_by_name(app, name, Access_Always);
if (global_config.use_error_highlight){
draw_jump_highlights(app, buffer, text_layout_id, compilation_buffer,
fcolor_id(Stag_Highlight_Junk));
fcolor_id(defcolor_highlight_junk));
}
// NOTE(allen): Search highlight
@ -396,26 +393,22 @@ default_render_buffer(Application_Links *app, View_ID view_id, Face_ID face_id,
Buffer_ID jump_buffer = get_locked_jump_buffer(app);
if (jump_buffer != compilation_buffer){
draw_jump_highlights(app, buffer, text_layout_id, jump_buffer,
fcolor_id(Stag_Highlight_White));
fcolor_id(defcolor_highlight_white));
}
}
}
// NOTE(allen): Color parens
if (global_config.use_paren_helper){
FColor colors[] = {
fcolor_id(Stag_Text_Cycle_1), fcolor_id(Stag_Text_Cycle_2),
fcolor_id(Stag_Text_Cycle_3), fcolor_id(Stag_Text_Cycle_4),
};
draw_paren_highlight(app, buffer, text_layout_id, cursor_pos,
colors, ArrayCount(colors));
Color_Array colors = finalize_color_array(defcolor_text_cycle);
draw_paren_highlight(app, buffer, text_layout_id, cursor_pos, colors.vals, colors.count);
}
// NOTE(allen): Line highlight
if (global_config.highlight_line_at_cursor && is_active_view){
i64 line_number = get_line_number_from_pos(app, buffer, cursor_pos);
draw_line_highlight(app, text_layout_id, line_number,
fcolor_id(Stag_Highlight_Cursor_Line));
fcolor_id(defcolor_highlight_cursor_line));
}
// NOTE(allen): Cursor shape
@ -436,7 +429,7 @@ default_render_buffer(Application_Links *app, View_ID view_id, Face_ID face_id,
}
// NOTE(allen): put the actual text on the actual screen
draw_text_layout(app, text_layout_id);
draw_text_layout_default(app, text_layout_id);
draw_set_clip(app, prev_clip);
}

View File

@ -77,6 +77,7 @@
#include "generated/lexer_cpp.cpp"
#include "4coder_command_map.cpp"
#include "4coder_default_framework_variables.cpp"
#include "4coder_default_colors.cpp"
#include "4coder_helper.cpp"
#include "4coder_delta_rule.cpp"
#include "4coder_layout_rule.cpp"

View File

@ -4,6 +4,13 @@
// TOP
function void
draw_text_layout_default(Application_Links *app, Text_Layout_ID layout_id){
ARGB_Color special_color = finalize_color(defcolor_special_character, 0);
ARGB_Color ghost_color = finalize_color(defcolor_ghost_character, 0);
draw_text_layout(app, layout_id, special_color, ghost_color);
}
function FColor
get_margin_color(i32 level){
FColor margin = fcolor_zero();
@ -11,28 +18,45 @@ get_margin_color(i32 level){
default:
case UIHighlight_None:
{
margin = fcolor_id(Stag_List_Item);
margin = fcolor_id(defcolor_list_item);
}break;
case UIHighlight_Hover:
{
margin = fcolor_id(Stag_List_Item_Hover);
margin = fcolor_id(defcolor_list_item_hover);
}break;
case UIHighlight_Active:
{
margin = fcolor_id(Stag_List_Item_Active);
margin = fcolor_id(defcolor_list_item_active);
}break;
}
return(margin);
}
function Vec2_f32
draw_string(Application_Links *app, Face_ID font_id, String_Const_u8 string,
Vec2_f32 p, FColor color){
draw_string(Application_Links *app, Face_ID font_id, String_Const_u8 string, Vec2_f32 p, ARGB_Color color){
return(draw_string_oriented(app, font_id, color, string, p, 0, V2(1.f, 0.f)));
}
function Vec2_f32
draw_string(Application_Links *app, Face_ID font_id, String_Const_u8 string, Vec2_f32 p, FColor color){
ARGB_Color argb = fcolor_resolve(color);
draw_string(app, font_id, string, p, argb);
}
function void
draw_margin(Application_Links *app, Rect_f32 outer, Rect_f32 inner, FColor color){
draw_rectangle_fcolor(Application_Links *app, Rect_f32 rect, f32 roundness, FColor color){
ARGB_Color argb = fcolor_resolve(color);
draw_rectangle(app, rect, roundness, argb);
}
function void
draw_rectangle_outline_fcolor(Application_Links *app, Rect_f32 rect, f32 roundness, f32 thickness, FColor color){
ARGB_Color argb = fcolor_resolve(color);
draw_rectangle_outline(app, rect, roundness, thickness, argb);
}
function void
draw_margin(Application_Links *app, Rect_f32 outer, Rect_f32 inner, ARGB_Color color){
draw_rectangle(app, Rf32(outer.x0, outer.y0, outer.x1, inner.y0), 0.f, color);
draw_rectangle(app, Rf32(outer.x0, inner.y1, outer.x1, outer.y1), 0.f, color);
draw_rectangle(app, Rf32(outer.x0, inner.y0, inner.x0, inner.y1), 0.f, color);
@ -40,15 +64,25 @@ draw_margin(Application_Links *app, Rect_f32 outer, Rect_f32 inner, FColor color
}
function void
draw_character_block(Application_Links *app, Text_Layout_ID layout, i64 pos,
f32 roundness, FColor color){
draw_margin(Application_Links *app, Rect_f32 outer, Rect_f32 inner, FColor color){
ARGB_Color argb = fcolor_resolve(color);
draw_margin(app, outer, inner, argb);
}
function void
draw_character_block(Application_Links *app, Text_Layout_ID layout, i64 pos, f32 roundness, ARGB_Color color){
Rect_f32 rect = text_layout_character_on_screen(app, layout, pos);
draw_rectangle(app, rect, roundness, color);
}
function void
draw_character_block(Application_Links *app, Text_Layout_ID layout, Range_i64 range,
f32 roundness, FColor color){
draw_character_block(Application_Links *app, Text_Layout_ID layout, i64 pos, f32 roundness, FColor color){
ARGB_Color argb = fcolor_resolve(color);
draw_character_block(app, layout, pos, roundness, argb);
}
function void
draw_character_block(Application_Links *app, Text_Layout_ID layout, Range_i64 range, f32 roundness, ARGB_Color color){
if (range.first < range.one_past_last){
i64 i = range.first;
Rect_f32 first_rect = text_layout_character_on_screen(app, layout, i);
@ -83,32 +117,45 @@ draw_character_block(Application_Links *app, Text_Layout_ID layout, Range_i64 ra
}
function void
draw_character_wire_frame(Application_Links *app, Text_Layout_ID layout, i64 pos,
f32 roundness, f32 thickness, FColor color){
draw_character_block(Application_Links *app, Text_Layout_ID layout, Range_i64 range, f32 roundness, FColor color){
ARGB_Color argb = fcolor_resolve(color);
draw_character_block(app, layout, range, roundness, argb);
}
function void
draw_character_wire_frame(Application_Links *app, Text_Layout_ID layout, i64 pos, f32 roundness, f32 thickness, ARGB_Color color){
Rect_f32 rect = text_layout_character_on_screen(app, layout, pos);
draw_rectangle_outline(app, rect, roundness, thickness, color);
}
function void
draw_character_wire_frame(Application_Links *app, Text_Layout_ID layout,
Range_i64 range, f32 roundness, f32 thickness,
FColor color){
draw_character_wire_frame(Application_Links *app, Text_Layout_ID layout, i64 pos, f32 roundness, f32 thickness, FColor color){
ARGB_Color argb = fcolor_resolve(color);
draw_character_wire_frame(app, layout, pos, roundness, thickness, argb);
}
function void
draw_character_wire_frame(Application_Links *app, Text_Layout_ID layout, Range_i64 range, f32 roundness, f32 thickness, FColor color){
for (i64 i = range.first; i < range.one_past_last; i += 1){
draw_character_wire_frame(app, layout, i, roundness, thickness, color);
}
}
function void
draw_character_i_bar(Application_Links *app, Text_Layout_ID layout, i64 pos,
FColor color){
draw_character_i_bar(Application_Links *app, Text_Layout_ID layout, i64 pos, ARGB_Color color){
Rect_f32 rect = text_layout_character_on_screen(app, layout, pos);
rect.x1 = rect.x0 + 1.f;
draw_rectangle(app, rect, 0.f, color);
}
function void
draw_line_highlight(Application_Links *app, Text_Layout_ID layout,
Range_i64 line_range, FColor color){
draw_character_i_bar(Application_Links *app, Text_Layout_ID layout, i64 pos, FColor color){
ARGB_Color argb = fcolor_resolve(color);
draw_character_i_bar(app, layout, pos, argb);
}
function void
draw_line_highlight(Application_Links *app, Text_Layout_ID layout, Range_i64 line_range, ARGB_Color color){
Range_f32 y1 = text_layout_line_on_screen(app, layout, line_range.min);
Range_f32 y2 = text_layout_line_on_screen(app, layout, line_range.max);
Range_f32 y = range_union(y1, y2);
@ -119,17 +166,38 @@ draw_line_highlight(Application_Links *app, Text_Layout_ID layout,
}
function void
draw_line_highlight(Application_Links *app, Text_Layout_ID layout, i64 line,
FColor color){
draw_line_highlight(Application_Links *app, Text_Layout_ID layout, Range_i64 line_range, FColor color){
ARGB_Color argb = fcolor_resolve(color);
draw_line_highlight(app, layout, line_range, argb);
}
function void
draw_line_highlight(Application_Links *app, Text_Layout_ID layout, i64 line, ARGB_Color color){
draw_line_highlight(app, layout, Ii64(line), color);
}
function void
paint_text_color_pos(Application_Links *app, Text_Layout_ID layout, i64 pos,
FColor color){
draw_line_highlight(Application_Links *app, Text_Layout_ID layout, i64 line, FColor color){
draw_line_highlight(app, layout, Ii64(line), color);
}
function void
paint_text_color_fcolor(Application_Links *app, Text_Layout_ID layout, Range_i64 pos, FColor color){
ARGB_Color argb = fcolor_resolve(color);
paint_text_color(app, layout, pos, argb);
}
function void
paint_text_color_pos(Application_Links *app, Text_Layout_ID layout, i64 pos, ARGB_Color color){
paint_text_color(app, layout, Ii64(pos, pos + 1), color);
}
function void
paint_text_color_pos(Application_Links *app, Text_Layout_ID layout, i64 pos, FColor color){
ARGB_Color argb = fcolor_resolve(color);
paint_text_color_pos(app, layout, pos, argb);
}
////////////////////////////////
function Rect_f32_Pair
@ -172,7 +240,7 @@ layout_fps_hud_on_bottom(Rect_f32 rect, f32 line_height){
}
function Rect_f32
draw_background_and_margin(Application_Links *app, View_ID view, FColor margin, FColor back){
draw_background_and_margin(Application_Links *app, View_ID view, ARGB_Color margin, ARGB_Color back){
Rect_f32 view_rect = view_get_screen_rect(app, view);
Rect_f32 inner = rect_inner(view_rect, 3.f);
draw_rectangle(app, inner, 0.f, back);
@ -180,10 +248,17 @@ draw_background_and_margin(Application_Links *app, View_ID view, FColor margin,
return(inner);
}
function Rect_f32
draw_background_and_margin(Application_Links *app, View_ID view, FColor margin, FColor back){
ARGB_Color margin_argb = fcolor_resolve(margin);
ARGB_Color back_argb = fcolor_resolve(back);
return(draw_background_and_margin(app, view, margin_argb, back_argb));
}
function Rect_f32
draw_background_and_margin(Application_Links *app, View_ID view, b32 is_active_view){
FColor margin_color = get_margin_color(is_active_view?UIHighlight_Active:UIHighlight_None);
return(draw_background_and_margin(app, view, margin_color, fcolor_id(Stag_Back)));
return(draw_background_and_margin(app, view, margin_color, fcolor_id(defcolor_back)));
}
function Rect_f32
@ -197,10 +272,10 @@ function void
draw_file_bar(Application_Links *app, View_ID view_id, Buffer_ID buffer, Face_ID face_id, Rect_f32 bar){
Scratch_Block scratch(app);
draw_rectangle(app, bar, 0.f, fcolor_id(Stag_Bar));
draw_rectangle_fcolor(app, bar, 0.f, fcolor_id(defcolor_bar));
FColor base_color = fcolor_id(Stag_Base);
FColor pop2_color = fcolor_id(Stag_Pop2);
FColor base_color = fcolor_id(defcolor_base);
FColor pop2_color = fcolor_id(defcolor_pop2);
i64 cursor_position = view_get_cursor_pos(app, view_id);
Buffer_Cursor cursor = view_compute_cursor(app, view_id, seek_pos(cursor_position));
@ -254,8 +329,8 @@ function void
draw_query_bar(Application_Links *app, Query_Bar *query_bar, Face_ID face_id, Rect_f32 bar){
Scratch_Block scratch(app);
Fancy_Line list = {};
push_fancy_string(scratch, &list, fcolor_id(Stag_Pop1) , query_bar->prompt);
push_fancy_string(scratch, &list, fcolor_id(Stag_Default), query_bar->string);
push_fancy_string(scratch, &list, fcolor_id(defcolor_pop1) , query_bar->prompt);
push_fancy_string(scratch, &list, fcolor_id(defcolor_text_default), query_bar->string);
Vec2_f32 p = bar.p0 + V2(2.f, 2.f);
draw_fancy_line(app, face_id, fcolor_zero(), &list, p);
}
@ -263,11 +338,11 @@ draw_query_bar(Application_Links *app, Query_Bar *query_bar, Face_ID face_id, Re
function void
draw_line_number_margin(Application_Links *app, View_ID view_id, Buffer_ID buffer, Face_ID face_id, Text_Layout_ID text_layout_id, Rect_f32 margin){
Rect_f32 prev_clip = draw_set_clip(app, margin);
draw_rectangle(app, margin, 0.f, fcolor_id(Stag_Line_Numbers_Back));
draw_rectangle_fcolor(app, margin, 0.f, fcolor_id(defcolor_line_numbers_back));
Interval_i64 visible_range = text_layout_get_visible_range(app, text_layout_id);
FColor line_color = fcolor_id(Stag_Line_Numbers_Text);
FColor line_color = fcolor_id(defcolor_line_numbers_text);
i64 line_count = buffer_get_line_count(app, buffer);
i64 line_count_digit_count = digit_count_from_integer(line_count, 10);
@ -309,8 +384,8 @@ draw_fps_hud(Application_Links *app, Frame_Info frame_info,
history_animation_dt[wrapped_index] = frame_info.animation_dt;
history_frame_index[wrapped_index] = frame_info.index;
draw_rectangle(app, rect, 0.f, f_black);
draw_rectangle_outline(app, rect, 0.f, 1.f, f_white);
draw_rectangle_fcolor(app, rect, 0.f, f_black);
draw_rectangle_outline_fcolor(app, rect, 0.f, 1.f, f_white);
Vec2_f32 p = rect.p0;
@ -353,31 +428,31 @@ draw_fps_hud(Application_Links *app, Frame_Info frame_info,
function FColor
get_token_color_cpp(Token token){
ID_Color color = Stag_Default;
Managed_ID color = defcolor_text_default;
switch (token.kind){
case TokenBaseKind_Preprocessor:
{
color = Stag_Preproc;
color = defcolor_preproc;
}break;
case TokenBaseKind_Keyword:
{
color = Stag_Keyword;
color = defcolor_keyword;
}break;
case TokenBaseKind_Comment:
{
color = Stag_Comment;
color = defcolor_comment;
}break;
case TokenBaseKind_LiteralString:
{
color = Stag_Str_Constant;
color = defcolor_str_constant;
}break;
case TokenBaseKind_LiteralInteger:
{
color = Stag_Int_Constant;
color = defcolor_int_constant;
}break;
case TokenBaseKind_LiteralFloat:
{
color = Stag_Float_Constant;
color = defcolor_float_constant;
}break;
default:
{
@ -385,7 +460,7 @@ get_token_color_cpp(Token token){
case TokenCppKind_LiteralTrue:
case TokenCppKind_LiteralFalse:
{
color = Stag_Bool_Constant;
color = defcolor_bool_constant;
}break;
case TokenCppKind_LiteralCharacter:
case TokenCppKind_LiteralCharacterWide:
@ -393,11 +468,11 @@ get_token_color_cpp(Token token){
case TokenCppKind_LiteralCharacterUTF16:
case TokenCppKind_LiteralCharacterUTF32:
{
color = Stag_Char_Constant;
color = defcolor_char_constant;
}break;
case TokenCppKind_PPIncludeFile:
{
color = Stag_Include;
color = defcolor_include;
}break;
}
}break;
@ -416,7 +491,8 @@ draw_cpp_token_colors(Application_Links *app, Text_Layout_ID text_layout_id, Tok
break;
}
FColor color = get_token_color_cpp(*token);
paint_text_color(app, text_layout_id, Ii64_size(token->pos, token->size), color);
ARGB_Color argb = fcolor_resolve(color);
paint_text_color(app, text_layout_id, Ii64_size(token->pos, token->size), argb);
if (!token_it_inc_non_whitespace(&it)){
break;
}
@ -489,7 +565,8 @@ get_enclosure_ranges(Application_Links *app, Arena *arena, Buffer_ID buffer, i64
function void
draw_enclosures(Application_Links *app, Text_Layout_ID text_layout_id, Buffer_ID buffer,
i64 pos, u32 flags, Range_Highlight_Kind kind,
FColor *back_colors, FColor *fore_colors, i32 color_count){
ARGB_Color *back_colors, i32 back_count,
ARGB_Color *fore_colors, i32 fore_count){
Scratch_Block scratch(app);
Range_i64_Array ranges = get_enclosure_ranges(app, scratch, buffer, pos, flags);
@ -522,40 +599,43 @@ draw_enclosures(Application_Links *app, Text_Layout_ID text_layout_id, Buffer_ID
}
Range_i64 line_range = r[j];
if (back_colors != 0){
draw_line_highlight(app, text_layout_id, line_range, back_colors[color_index]);
i32 back_index = color_index%back_count;
draw_line_highlight(app, text_layout_id, line_range, back_colors[back_index]);
}
if (fore_colors != 0){
i32 fore_index = color_index%fore_count;
Range_i64 pos_range = get_pos_range_from_line_range(app, buffer, line_range);
paint_text_color(app, text_layout_id, pos_range, fore_colors[color_index]);
paint_text_color(app, text_layout_id, pos_range, fore_colors[fore_index]);
}
}
}
else{
if (back_colors != 0){
draw_character_block(app, text_layout_id, range.min, 0.f, back_colors[color_index]);
draw_character_block(app, text_layout_id, range.max - 1, 0.f, back_colors[color_index]);
i32 back_index = color_index%back_count;
draw_character_block(app, text_layout_id, range.min, 0.f, back_colors[back_index]);
draw_character_block(app, text_layout_id, range.max - 1, 0.f, back_colors[back_index]);
}
if (fore_colors != 0){
paint_text_color_pos(app, text_layout_id, range.min, fore_colors[color_index]);
paint_text_color_pos(app, text_layout_id, range.max - 1, fore_colors[color_index]);
i32 fore_index = color_index%fore_count;
paint_text_color_pos(app, text_layout_id, range.min, fore_colors[fore_index]);
paint_text_color_pos(app, text_layout_id, range.max - 1, fore_colors[fore_index]);
}
}
color_index += 1;
color_index = (color_index%color_count);
}
}
function void
draw_scope_highlight(Application_Links *app, Buffer_ID buffer, Text_Layout_ID text_layout_id,
i64 pos, FColor *colors, i32 color_count){
i64 pos, ARGB_Color *colors, i32 color_count){
draw_enclosures(app, text_layout_id, buffer,
pos, FindNest_Scope, RangeHighlightKind_LineHighlight,
colors, 0, color_count);
colors, color_count, 0, 0);
}
function void
draw_paren_highlight(Application_Links *app, Buffer_ID buffer, Text_Layout_ID text_layout_id,
i64 pos, FColor *colors, i32 color_count){
i64 pos, ARGB_Color *colors, i32 color_count){
Token_Array token_array = get_token_array_from_buffer(app, buffer);
if (token_array.tokens != 0){
Token_Iterator_Array it = token_iterator_pos(0, &token_array, pos);
@ -575,7 +655,7 @@ draw_paren_highlight(Application_Links *app, Buffer_ID buffer, Text_Layout_ID te
}
draw_enclosures(app, text_layout_id, buffer,
pos, FindNest_Paren, RangeHighlightKind_CharacterHighlight,
0, colors, color_count);
0, 0, colors, color_count);
}
function void
@ -617,9 +697,9 @@ draw_highlight_range(Application_Links *app, View_ID view_id,
if (managed_object_load_data(app, *highlight, 0, 2, marker_range)){
Range_i64 range = Ii64(marker_range[0].pos, marker_range[1].pos);
draw_character_block(app, text_layout_id, range, roundness,
fcolor_id(Stag_Highlight));
paint_text_color(app, text_layout_id, range,
fcolor_id(Stag_At_Highlight));
fcolor_id(defcolor_highlight));
paint_text_color_fcolor(app, text_layout_id, range,
fcolor_id(defcolor_at_highlight));
}
}
}
@ -636,20 +716,20 @@ draw_original_4coder_style_cursor_mark_highlight(Application_Links *app, View_ID
i64 mark_pos = view_get_mark_pos(app, view_id);
if (is_active_view){
draw_character_block(app, text_layout_id, cursor_pos, roundness,
fcolor_id(Stag_Cursor));
fcolor_id(defcolor_cursor));
paint_text_color_pos(app, text_layout_id, cursor_pos,
fcolor_id(Stag_At_Cursor));
fcolor_id(defcolor_at_cursor));
draw_character_wire_frame(app, text_layout_id, mark_pos,
roundness, outline_thickness,
fcolor_id(Stag_Mark));
fcolor_id(defcolor_mark));
}
else{
draw_character_wire_frame(app, text_layout_id, mark_pos,
roundness, outline_thickness,
fcolor_id(Stag_Mark));
fcolor_id(defcolor_mark));
draw_character_wire_frame(app, text_layout_id, cursor_pos,
roundness, outline_thickness,
fcolor_id(Stag_Cursor));
fcolor_id(defcolor_cursor));
}
}
}
@ -665,11 +745,11 @@ draw_notepad_style_cursor_highlight(Application_Links *app, View_ID view_id,
if (cursor_pos != mark_pos){
Range_i64 range = Ii64(cursor_pos, mark_pos);
draw_character_block(app, text_layout_id, range, roundness,
fcolor_id(Stag_Highlight));
paint_text_color(app, text_layout_id, range,
fcolor_id(Stag_At_Highlight));
fcolor_id(defcolor_highlight));
paint_text_color_fcolor(app, text_layout_id, range,
fcolor_id(defcolor_at_highlight));
}
draw_character_i_bar(app, text_layout_id, cursor_pos, fcolor_id(Stag_Cursor));
draw_character_i_bar(app, text_layout_id, cursor_pos, fcolor_id(defcolor_cursor));
}
}
@ -707,7 +787,7 @@ draw_tool_tip(Application_Links *app, Face_ID face, Fancy_Block *block,
box.x1 = f32_round32(box.x1);
box.y1 = f32_round32(box.y1);
Rect_f32 prev_clip = draw_set_clip(app, box);
draw_rectangle(app, box, 6.f, back_color);
draw_rectangle_fcolor(app, box, 6.f, back_color);
draw_fancy_block(app, face, fcolor_zero(), block,
box.p0 + V2f32(x_half_padding, 1.f));
draw_set_clip(app, prev_clip);
@ -729,7 +809,7 @@ draw_drop_down(Application_Links *app, Face_ID face, Fancy_Block *block,
box.x1 = f32_round32(box.x1);
box.y1 = f32_round32(box.y1);
Rect_f32 prev_clip = draw_set_clip(app, box);
draw_rectangle(app, box, 0.f, back_color);
draw_rectangle_fcolor(app, box, 0.f, back_color);
draw_margin(app, box, rect_inner(box, 1.f), outline_color);
draw_fancy_block(app, face, fcolor_zero(), block,
box.p0 + V2f32(x_half_padding, 2.f));
@ -746,12 +826,12 @@ draw_button(Application_Links *app, Rect_f32 rect, Vec2_f32 mouse_p, Face_ID fac
}
FColor margin_color = get_margin_color(hovered?UIHighlight_Active:UIHighlight_None);
draw_rectangle(app, rect, 3.f, margin_color);
draw_rectangle_fcolor(app, rect, 3.f, margin_color);
rect = rect_inner(rect, 3.f);
draw_rectangle(app, rect, 3.f, fcolor_id(Stag_Back));
draw_rectangle_fcolor(app, rect, 3.f, fcolor_id(defcolor_back));
Scratch_Block scratch(app);
Fancy_String *fancy = push_fancy_string(scratch, 0, face, fcolor_id(Stag_Default), text);
Fancy_String *fancy = push_fancy_string(scratch, 0, face, fcolor_id(defcolor_text_default), text);
Vec2_f32 dim = get_fancy_string_dim(app, 0, fancy);
Vec2_f32 p = (rect.p0 + rect.p1 - dim)*0.5f;
draw_fancy_string(app, fancy, p);

View File

@ -9,7 +9,7 @@
struct Comment_Highlight_Pair{
String_Const_u8 needle;
FColor color;
ARGB_Color color;
};
typedef i32 Range_Highlight_Kind;

View File

@ -23,9 +23,17 @@ fcolor_argb(f32 r, f32 g, f32 b, f32 a){
}
function FColor
fcolor_id(ID_Color id){
fcolor_id(Managed_ID id){
FColor result = {};
result.id = id;
result.id = (ID_Color)id;
return(result);
}
function FColor
fcolor_id(Managed_ID id, u32 sub_index){
FColor result = {};
result.id = (ID_Color)id;
result.sub_index = (u8)sub_index;
return(result);
}
@ -42,11 +50,11 @@ argb_color_blend(ARGB_Color a, f32 t, ARGB_Color b){
}
function ARGB_Color
fcolor_resolve_to_argb(Application_Links *app, FColor color){
fcolor_resolve(FColor color){
ARGB_Color result = 0;
if (color.a_byte == 0){
if (color.id != 0){
result = finalize_color(app, color.id);
result = finalize_color(color.id, color.sub_index);
}
}
else{
@ -56,20 +64,20 @@ fcolor_resolve_to_argb(Application_Links *app, FColor color){
}
function FColor
fcolor_change_alpha(Application_Links *app, FColor color, f32 alpha){
Vec4_f32 v = unpack_color(fcolor_resolve_to_argb(app, color));
fcolor_change_alpha(FColor color, f32 alpha){
Vec4_f32 v = unpack_color(fcolor_resolve(color));
v.a = alpha;
return(fcolor_argb(pack_color(v)));
}
function FColor
fcolor_blend(Application_Links *app, FColor a, f32 at, FColor b, f32 bt){
ARGB_Color a_argb = fcolor_resolve_to_argb(app, a);
ARGB_Color b_argb = fcolor_resolve_to_argb(app, b);
fcolor_blend(FColor a, f32 at, FColor b, f32 bt){
ARGB_Color a_argb = fcolor_resolve(a);
ARGB_Color b_argb = fcolor_resolve(b);
return(fcolor_argb(argb_color_blend(a_argb, at, b_argb, bt)));
}
function FColor
fcolor_blend(Application_Links *app, FColor a, f32 t, FColor b){
return(fcolor_blend(app, a, 1.f - t, b, t));
fcolor_blend(FColor a, f32 t, FColor b){
return(fcolor_blend(a, 1.f - t, b, t));
}
function FColor
@ -612,6 +620,7 @@ draw_fancy_string__inner(Application_Links *app, Face_ID face, FColor fore, Fanc
use_fore = string->fore;
}
if (use_face != 0){
ARGB_Color use_argb = fcolor_resolve(use_fore);
Face_Metrics metrics = get_face_metrics(app, use_face);
f32 down_shift = (base_line - metrics.ascent);
down_shift = clamp_bot(0.f, down_shift);
@ -621,7 +630,7 @@ draw_fancy_string__inner(Application_Links *app, Face_ID face, FColor fore, Fanc
if (fcolor_is_valid(use_fore)){
Vec2_f32 margin_delta = delta*metrics.normal_advance;
p_shifted += margin_delta*string->pre_margin;
p_shifted = draw_string_oriented(app, use_face, use_fore, string->value, p_shifted, flags, delta);
p_shifted = draw_string_oriented(app, use_face, use_argb, string->value, p_shifted, flags, delta);
p_shifted += margin_delta*string->post_margin;
}
else{

View File

@ -182,10 +182,10 @@ lister_render(Application_Links *app, Frame_Info frame_info, View_ID view){
{
Fancy_Line text_field = {};
push_fancy_string(scratch, &text_field, fcolor_id(Stag_Pop1),
push_fancy_string(scratch, &text_field, fcolor_id(defcolor_pop1),
lister->query.string);
push_fancy_stringf(scratch, &text_field, " ");
push_fancy_string(scratch, &text_field, fcolor_id(Stag_Default),
push_fancy_string(scratch, &text_field, fcolor_id(defcolor_text_default),
lister->text_field.string);
draw_fancy_line(app, face_id, fcolor_zero(), &text_field,
V2f32(text_field_rect.x0 + 3.f, text_field_rect.y0));
@ -266,13 +266,13 @@ lister_render(Application_Links *app, Frame_Info frame_info, View_ID view){
highlight = UIHighlight_Hover;
}
draw_rectangle(app, item_rect, 6.f, get_margin_color(highlight));
draw_rectangle(app, item_inner, 6.f, fcolor_id(Stag_Back));
draw_rectangle_fcolor(app, item_rect, 6.f, get_margin_color(highlight));
draw_rectangle_fcolor(app, item_inner, 6.f, fcolor_id(defcolor_back));
Fancy_Line line = {};
push_fancy_string(scratch, &line, fcolor_id(Stag_Default), node->string);
push_fancy_string(scratch, &line, fcolor_id(defcolor_text_default), node->string);
push_fancy_stringf(scratch, &line, " ");
push_fancy_string(scratch, &line, fcolor_id(Stag_Pop2), node->status);
push_fancy_string(scratch, &line, fcolor_id(defcolor_pop2), node->status);
Vec2_f32 p = item_inner.p0 + V2f32(3.f, (block_height - line_height)*0.5f);
draw_fancy_line(app, face_id, fcolor_zero(), &line, p);

View File

@ -671,10 +671,9 @@ log_graph_render(Application_Links *app, Frame_Info frame_info, View_ID view){
Rect_f32 view_rect = view_get_screen_rect(app, view);
Rect_f32 inner = rect_inner(view_rect, 3);
draw_rectangle(app, view_rect, 0.f,
get_margin_color(is_active_view?
UIHighlight_Active:UIHighlight_None));
draw_rectangle(app, inner, 0.f, fcolor_id(Stag_Back));
draw_rectangle_fcolor(app, view_rect, 0.f,
get_margin_color(is_active_view?UIHighlight_Active:UIHighlight_None));
draw_rectangle_fcolor(app, inner, 0.f, fcolor_id(defcolor_back));
Rect_f32 prev_clip = draw_set_clip(app, inner);
////////////////////////////////
@ -721,8 +720,8 @@ log_graph_render(Application_Links *app, Frame_Info frame_info, View_ID view){
margin_color = f_light_gray;
}
draw_rectangle(app, box , 0.f, margin_color);
draw_rectangle(app, box_inner, 0.f, f_black );
draw_rectangle_fcolor(app, box , 0.f, margin_color);
draw_rectangle_fcolor(app, box_inner, 0.f, f_black );
Log_Event *event = box_node->event;
@ -759,8 +758,8 @@ log_graph_render(Application_Links *app, Frame_Info frame_info, View_ID view){
Log_Graph_List_Tab current_tab = log_graph.tab;
Log_Filter_Set *viewing_filter_set = log_filter_set_from_tab(current_tab);
draw_rectangle(app, box , 0.f, f_dark_gray);
draw_rectangle(app, box_inner, 0.f, f_black );
draw_rectangle_fcolor(app, box , 0.f, f_dark_gray);
draw_rectangle_fcolor(app, box_inner, 0.f, f_black );
{
f32 y_cursor = box_inner.y0 + 3.f;

View File

@ -189,12 +189,12 @@ profile_draw_tab(Application_Links *app, Tab_State *state, Profile_Inspection *i
insp->tab_id_hovered = tab_id;
}
FColor text = fcolor_id(Stag_Default);
FColor text = fcolor_id(defcolor_text_default);
if (insp->tab_id == tab_id){
text = fcolor_id(Stag_Pop2);
text = fcolor_id(defcolor_pop2);
}
else if (hover){
text = fcolor_id(Stag_Pop1);
text = fcolor_id(defcolor_pop1);
}
Vec2_f32 np = draw_fancy_string(app, state->face_id, text, fstring, state->p);
@ -289,10 +289,7 @@ profile_draw_node(Application_Links *app, View_ID view, Face_ID face_id,
f32 x_padding = normal_advance*1.5f;
f32 x_half_padding = x_padding*0.5f;
FColor colors[] = {
fcolor_id(Stag_Back_Cycle_1), fcolor_id(Stag_Back_Cycle_2),
fcolor_id(Stag_Back_Cycle_3), fcolor_id(Stag_Back_Cycle_4),
};
Color_Array colors = finalize_color_array(defcolor_back_cycle);
Scratch_Block scratch(app);
@ -304,7 +301,7 @@ profile_draw_node(Application_Links *app, View_ID view, Face_ID face_id,
String_Const_u8 thread_name = profile_node_thread_name(node);
if (thread_name.size > 0){
Fancy_String *fstr =
push_fancy_string(scratch, 0, fcolor_id(Stag_Pop1), thread_name);
push_fancy_string(scratch, 0, fcolor_id(defcolor_pop1), thread_name);
Vec2_f32 p = V2f32(x_pos, y.min + 1.f);
draw_fancy_string(app, face_id, fcolor_zero(), fstr, p);
f32 w = get_fancy_string_width(app, face_id, fstr);
@ -315,7 +312,7 @@ profile_draw_node(Application_Links *app, View_ID view, Face_ID face_id,
String_Const_u8 name = profile_node_name(node);
if (name.size > 0){
Fancy_String *fstr =
push_fancy_string(scratch, 0, fcolor_id(Stag_Default), name);
push_fancy_string(scratch, 0, fcolor_id(defcolor_text_default), name);
Vec2_f32 p = V2f32(x_pos, y.min + 1.f);
draw_fancy_string(app, face_id, fcolor_zero(), fstr, p);
f32 w = get_fancy_string_width(app, face_id, fstr);
@ -333,10 +330,10 @@ profile_draw_node(Application_Links *app, View_ID view, Face_ID face_id,
Range_f32 btn_x = If32_size(x_pos, w);
Rect_f32 box = Rf32(btn_x, nav_bar_y);
FColor color = fcolor_id(Stag_Default);
FColor color = fcolor_id(defcolor_text_default);
if (rect_contains_point(box, m_p)){
draw_rectangle(app, box, 0.f, fcolor_id(Stag_Margin));
color = fcolor_id(Stag_Pop1);
draw_rectangle_fcolor(app, box, 0.f, fcolor_id(defcolor_margin));
color = fcolor_id(defcolor_pop1);
insp->hover_node = node->parent;
}
@ -353,7 +350,7 @@ profile_draw_node(Application_Links *app, View_ID view, Face_ID face_id,
Rect_f32 time_slice_box = side_by_side.min;
time_slice_box = rect_inner(time_slice_box, 3.f);
draw_rectangle_outline(app, time_slice_box, 0.f, 3.f, f_white);
draw_rectangle_outline_fcolor(app, time_slice_box, 0.f, 3.f, f_white);
time_slice_box = rect_inner(time_slice_box, 3.f);
if (node->closed){
@ -363,7 +360,6 @@ profile_draw_node(Application_Links *app, View_ID view, Face_ID face_id,
y = rect_range_y(time_slice_box);
i32 cycle_counter = 0;
i32 count = ArrayCount(colors);
for (Profile_Node *child = node->first_child;
child != 0;
child = child->next){
@ -379,7 +375,8 @@ profile_draw_node(Application_Links *app, View_ID view, Face_ID face_id,
child_y.max = lerp(y.min, child_y.max, y.max);
Rect_f32 box = Rf32(x, child_y);
draw_rectangle(app, box, 0.f, colors[cycle_counter%count]);
ARGB_Color argb = finalize_color(colors, cycle_counter);
draw_rectangle(app, box, 0.f, argb);
cycle_counter += 1;
if (rect_contains_point(box, m_p)){
@ -392,9 +389,9 @@ profile_draw_node(Application_Links *app, View_ID view, Face_ID face_id,
if (range_size(child_y) >= line_height){
String_Const_u8 child_name = profile_node_name(child);
Fancy_Line line = {};
push_fancy_string(scratch, &line, fcolor_id(Stag_Pop1),
push_fancy_string(scratch, &line, fcolor_id(defcolor_pop1),
child_name);
push_fancy_stringf(scratch, &line, fcolor_id(Stag_Default),
push_fancy_stringf(scratch, &line, fcolor_id(defcolor_text_default),
0.5f, 0.f, "#%4llu", child->unique_counter);
Vec2_f32 p = V2f32(x.min + x_half_padding,
@ -419,7 +416,7 @@ profile_draw_node(Application_Links *app, View_ID view, Face_ID face_id,
{
f32 duration = ((f32)range_size(node->time))/1000000.f;
Fancy_Line list = {};
push_fancy_stringf(scratch, &list, fcolor_id(Stag_Default),
push_fancy_stringf(scratch, &list, fcolor_id(defcolor_text_default),
"time: %11.9f", duration);
draw_fancy_line(app, face_id, fcolor_zero(),
&list, V2f32(x_pos, y_pos + 1.f));
@ -448,25 +445,25 @@ profile_draw_node(Application_Links *app, View_ID view, Face_ID face_id,
String_Const_u8 child_name = profile_node_name(child);
Fancy_Line line = {};
push_fancy_string_trunc(scratch, &line, child_name, 20);
push_fancy_stringf(scratch, &line, fcolor_id(Stag_Default), 0.5f, 0.f,
push_fancy_stringf(scratch, &line, fcolor_id(defcolor_text_default), 0.5f, 0.f,
"#%4llu", child->unique_counter);
push_fancy_stringf(scratch, &line, fcolor_id(Stag_Pop2),
push_fancy_stringf(scratch, &line, fcolor_id(defcolor_pop2),
0.5f, 0.f, "%6.4f", child_duration);
Vec2_f32 p = V2f32(x.min + x_half_padding,
(y.min + y.max - line_height)*0.5f);
draw_fancy_line(app, face_id, fcolor_id(Stag_Pop1), &line, p);
draw_fancy_line(app, face_id, fcolor_id(defcolor_pop1), &line, p);
Rect_f32 box = Rf32(x, y);
FColor margin = fcolor_id(Stag_Margin);
FColor margin = fcolor_id(defcolor_margin);
if (rect_contains_point(box, m_p)){
insp->full_name_hovered = child_name;
insp->unique_counter_hovered = child->unique_counter;
insp->location_jump_hovered = profile_node_location(child);
insp->hover_node = child;
margin = fcolor_id(Stag_Margin_Hover);
margin = fcolor_id(defcolor_margin_hover);
}
draw_rectangle_outline(app, box, 6.f, 3.f, margin);
draw_rectangle_outline_fcolor(app, box, 6.f, 3.f, margin);
y_pos = y.max;
if (y_pos >= info_box.y1){
@ -517,7 +514,7 @@ profile_render(Application_Links *app, Frame_Info frame_info, View_ID view){
Profile_Inspection *inspect = &global_profile_inspection;
if (inspect->thread_count == 0){
Fancy_String *fstr = push_fancy_string(scratch, 0, fcolor_id(Stag_Pop2),
Fancy_String *fstr = push_fancy_string(scratch, 0, fcolor_id(defcolor_pop2),
string_u8_litexpr("no profile data"));
f32 width = get_fancy_string_width(app, face_id, fstr);
Vec2_f32 view_center = (region.p0 + region.p1)*0.5f;
@ -549,7 +546,7 @@ profile_render(Application_Links *app, Frame_Info frame_info, View_ID view){
tab_state.x_half_padding = x_half_padding;
tab_state.m_p = m_p;
draw_rectangle(app, tabs_body.min, 0.f, fcolor_id(Stag_Margin_Hover));
draw_rectangle_fcolor(app, tabs_body.min, 0.f, fcolor_id(defcolor_margin_hover));
if (inspect->tab_id == ProfileInspectTab_None){
inspect->tab_id = ProfileInspectTab_Threads;
@ -615,13 +612,13 @@ profile_render(Application_Links *app, Frame_Info frame_info, View_ID view){
Range_f32 y = If32_size(y_pos, block_height);
Fancy_Line list = {};
push_fancy_stringf(scratch, &list, fcolor_id(Stag_Pop1),
push_fancy_stringf(scratch, &list, fcolor_id(defcolor_pop1),
"%-20.*s (%6d) ",
string_expand(thread->name),
thread->thread_id);
f32 active_time = ((f32)thread->active_time)/1000000.f;
push_fancy_stringf(scratch, &list, fcolor_id(Stag_Pop2),
push_fancy_stringf(scratch, &list, fcolor_id(defcolor_pop2),
"active time %11.9f",
active_time);
@ -630,12 +627,12 @@ profile_render(Application_Links *app, Frame_Info frame_info, View_ID view){
draw_fancy_line(app, face_id, fcolor_zero(), &list, p);
Rect_f32 box = Rf32(x, y);
FColor margin = fcolor_id(Stag_Margin);
FColor margin = fcolor_id(defcolor_margin);
if (rect_contains_point(box, m_p)){
inspect->hover_thread = thread;
margin = fcolor_id(Stag_Margin_Hover);
margin = fcolor_id(defcolor_margin_hover);
}
draw_rectangle_outline(app, box, 6.f, 3.f, margin);
draw_rectangle_outline_fcolor(app, box, 6.f, 3.f, margin);
y_pos = y.max;
if (y_pos >= tabs_body.max.y1){
@ -656,20 +653,20 @@ profile_render(Application_Links *app, Frame_Info frame_info, View_ID view){
u32 name_width = 45;
b32 name_too_long = (node->name.size > name_width);
Fancy_Line list = {};
push_fancy_string_fixed(scratch, &list, fcolor_id(Stag_Pop1),
push_fancy_string_fixed(scratch, &list, fcolor_id(defcolor_pop1),
node->name, name_width);
if (node->corrupted_time){
push_fancy_string(scratch, &list, fcolor_id(Stag_Pop2),
push_fancy_string(scratch, &list, fcolor_id(defcolor_pop2),
string_u8_litexpr("timing error "));
}
else{
push_fancy_stringf(scratch, &list, fcolor_id(Stag_Pop2),
push_fancy_stringf(scratch, &list, fcolor_id(defcolor_pop2),
"%11.9fs ",
((f32)node->total_time)/1000000.f);
}
push_fancy_stringf(scratch, &list, fcolor_id(Stag_Keyword),
push_fancy_stringf(scratch, &list, fcolor_id(defcolor_keyword),
"hit # %5d", node->hit_count);
Vec2_f32 p = V2f32(x.min + x_half_padding,
@ -677,16 +674,16 @@ profile_render(Application_Links *app, Frame_Info frame_info, View_ID view){
draw_fancy_line(app, face_id, fcolor_zero(), &list, p);
Rect_f32 box = Rf32(x, y);
FColor margin = fcolor_id(Stag_Margin);
FColor margin = fcolor_id(defcolor_margin);
if (rect_contains_point(box, m_p)){
if (name_too_long){
inspect->full_name_hovered = node->name;
}
inspect->location_jump_hovered = node->location;
inspect->hover_slot = node;
margin = fcolor_id(Stag_Margin_Hover);
margin = fcolor_id(defcolor_margin_hover);
}
draw_rectangle_outline(app, box, 6.f, 3.f, margin);
draw_rectangle_outline_fcolor(app, box, 6.f, 3.f, margin);
y_pos = y.max;
if (y_pos >= tabs_body.max.y1){
@ -706,7 +703,7 @@ profile_render(Application_Links *app, Frame_Info frame_info, View_ID view){
Range_f32 y = If32_size(y_pos, block_height);
Fancy_Line list = {};
push_fancy_string(scratch, &list, fcolor_id(Stag_Pop2),
push_fancy_string(scratch, &list, fcolor_id(defcolor_pop2),
node->message);
Vec2_f32 p = V2f32(x.min + x_half_padding,
@ -714,12 +711,12 @@ profile_render(Application_Links *app, Frame_Info frame_info, View_ID view){
draw_fancy_line(app, face_id, fcolor_zero(), &list, p);
Rect_f32 box = Rf32(x, y);
FColor margin = fcolor_id(Stag_Margin);
FColor margin = fcolor_id(defcolor_margin);
if (rect_contains_point(box, m_p)){
inspect->location_jump_hovered = node->location;
margin = fcolor_id(Stag_Margin_Hover);
margin = fcolor_id(defcolor_margin_hover);
}
draw_rectangle_outline(app, box, 6.f, 3.f, margin);
draw_rectangle_outline_fcolor(app, box, 6.f, 3.f, margin);
y_pos = y.max;
if (y_pos >= tabs_body.max.y1){
@ -782,9 +779,9 @@ profile_render(Application_Links *app, Frame_Info frame_info, View_ID view){
Range_f32 y = If32_size(y_pos, block_height);
Fancy_Line list = {};
push_fancy_stringf(scratch, &list, fcolor_id(Stag_Pop2), "[%12llu] / %6d ",
push_fancy_stringf(scratch, &list, fcolor_id(defcolor_pop2), "[%12llu] / %6d ",
node->total_memory, node->annotation.count);
push_fancy_stringf(scratch, &list, fcolor_id(Stag_Pop1), "%.*s",
push_fancy_stringf(scratch, &list, fcolor_id(defcolor_pop1), "%.*s",
string_expand(node->location));
Vec2_f32 p = V2f32(x.min + x_half_padding,
@ -792,10 +789,10 @@ profile_render(Application_Links *app, Frame_Info frame_info, View_ID view){
draw_fancy_line(app, face_id, fcolor_zero(), &list, p);
Rect_f32 box = Rf32(x, y);
FColor margin = fcolor_id(Stag_Margin);
FColor margin = fcolor_id(defcolor_margin);
if (rect_contains_point(box, m_p)){
inspect->location_jump_hovered = node->location;
margin = fcolor_id(Stag_Margin_Hover);
margin = fcolor_id(defcolor_margin_hover);
}
y_pos = y.max;
@ -833,8 +830,8 @@ profile_render(Application_Links *app, Frame_Info frame_info, View_ID view){
}
else{
Fancy_Block block = {};
FColor text_color = fcolor_change_alpha(app, f_white, 0.5f);
FColor back_color = fcolor_change_alpha(app, f_black, 0.5f);
FColor text_color = fcolor_change_alpha(f_white, 0.5f);
FColor back_color = fcolor_change_alpha(f_black, 0.5f);
if (inspect->full_name_hovered.size > 0){
Fancy_Line *line = push_fancy_line(scratch, &block, text_color);

View File

@ -230,7 +230,7 @@ get_word_complete_needle_range(Application_Links *app, Buffer_ID buffer, i64 pos
needle_range.max = pos;
needle_range.min = scan(app, boundary_alpha_numeric_underscore_utf8, buffer, Scan_Backward, pos);
i64 e = scan(app, boundary_alpha_numeric_underscore_utf8, buffer, Scan_Forward, needle_range.min);
if (needle_range.max > e){
if (pos > e){
needle_range = Ii64(pos);
}
return(needle_range);
@ -414,11 +414,9 @@ CUSTOM_DOC("Iteratively tries completing the word to the left of the cursor with
if (first_completion || !initialized){
ProfileBlock(app, "word complete state init");
initialized = false;
i64 pos = view_get_cursor_pos(app, view);
Range_i64 needle_range = get_word_complete_needle_range(app, buffer, pos);
if (range_size(needle_range) > 0){
initialized = true;
range = needle_range;
@ -482,8 +480,8 @@ word_complete_menu_render(Application_Links *app, Frame_Info frame_info, View_ID
for (i32 i = 0; i < menu->count; i += 1){
if (menu->options[i].size > 0){
Fancy_Line *line = push_fancy_line(scratch, &block, face);
push_fancy_stringf(scratch, line, fcolor_id(Stag_Pop1), "F%d:", i + 1);
push_fancy_string(scratch, line, fcolor_id(Stag_Default), menu->options[i]);
push_fancy_stringf(scratch, line, fcolor_id(defcolor_pop1), "F%d:", i + 1);
push_fancy_string(scratch, line, fcolor_id(defcolor_text_default), menu->options[i]);
}
}
@ -501,7 +499,7 @@ word_complete_menu_render(Application_Links *app, Frame_Info frame_info, View_ID
f32 x_half_padding = x_padding*0.5f;
draw_drop_down(app, face, &block, cursor_p, region, x_padding, x_half_padding,
fcolor_id(Stag_Margin_Hover), fcolor_id(Stag_Back));
fcolor_id(defcolor_margin_hover), fcolor_id(defcolor_back));
}
}

View File

@ -128,7 +128,7 @@ tutorial_render(Application_Links *app, Frame_Info frame_info, View_ID view_id){
f32 panel_y0 = region.y0 - 3.f;
region = rect_inner(region, 3.f);
draw_rectangle(app, region, 20.f, fcolor_id(Stag_Back));
draw_rectangle_fcolor(app, region, 20.f, fcolor_id(defcolor_back));
region = rect_inner(region, 10.f);
Vec2_f32 title_p = V2f32(region.x0, panel_y0 + (metrics.line_height*2.f) - title_height*0.5f);
@ -302,25 +302,25 @@ global String_Const_u8 hms_title = string_u8_litexpr("Handmade Seattle Demo");
function void
hms_demo_tutorial_short_details(Application_Links *app, Arena *arena, Fancy_Line *short_details){
Face_ID face = get_face_id(app, 0);
push_fancy_string(arena, short_details, tutorial.face, fcolor_id(Stag_Pop1), hms_title);
push_fancy_string(arena, short_details, face, fcolor_id(Stag_Default), 8.f, 8.f, string_u8_litexpr("Welcome to Handmade Seattle and to this 4coder demo!"));
push_fancy_string(arena, short_details, face, fcolor_id(Stag_Pop2), string_u8_litexpr("Click here to see more."));
push_fancy_string(arena, short_details, tutorial.face, fcolor_id(defcolor_pop1), hms_title);
push_fancy_string(arena, short_details, face, fcolor_id(defcolor_text_default), 8.f, 8.f, string_u8_litexpr("Welcome to Handmade Seattle and to this 4coder demo!"));
push_fancy_string(arena, short_details, face, fcolor_id(defcolor_pop2), string_u8_litexpr("Click here to see more."));
}
function void
hms_demo_tutorial_long_start(Application_Links *app, Arena *arena, Fancy_Block *long_details){
Fancy_Line *line = push_fancy_line(arena, long_details, tutorial.face, fcolor_id(Stag_Pop1), hms_title);
Fancy_Line *line = push_fancy_line(arena, long_details, tutorial.face, fcolor_id(defcolor_pop1), hms_title);
Face_ID face = get_face_id(app, 0);
//
line = push_fancy_line(arena, long_details, face, fcolor_id(Stag_Default));
line = push_fancy_line(arena, long_details, face, fcolor_id(defcolor_text_default));
#define M "If you want more information than what you can find here, please "
push_fancy_string(arena, line, string_u8_litexpr(M));
#undef M
push_fancy_string(arena, line, fcolor_id(Stag_Pop2), string_u8_litexpr("ask!"));
push_fancy_string(arena, line, fcolor_id(defcolor_pop2), string_u8_litexpr("ask!"));
//
push_fancy_line(arena, long_details, face, fcolor_id(Stag_Pop1), string_u8_litexpr(""));
push_fancy_line(arena, long_details, face, fcolor_id(defcolor_pop1), string_u8_litexpr(""));
}
function void
@ -337,12 +337,12 @@ hms_demo_tutorial_binding_line(Application_Links *app, Arena *arena, Fancy_Block
pad_size = 40.f - fill_size;
}
Fancy_Line *line = line = push_fancy_line(arena, long_details, face, fcolor_id(Stag_Default));
Fancy_Line *line = line = push_fancy_line(arena, long_details, face, fcolor_id(defcolor_text_default));
push_fancy_stringf(arena, line, pad_size, 0.5f, "<");
if (m.size > 0){
push_fancy_stringf(arena, line, fcolor_id(Stag_Keyword), 0.f, 0.5f, "%s", modifiers);
push_fancy_stringf(arena, line, fcolor_id(defcolor_keyword), 0.f, 0.5f, "%s", modifiers);
}
push_fancy_stringf(arena, line, fcolor_id(Stag_Pop2), "%s", key);
push_fancy_stringf(arena, line, fcolor_id(defcolor_pop2), "%s", key);
push_fancy_stringf(arena, line, 0.5f, 1.f, ">");
push_fancy_stringf(arena, line, "%s", description);
}
@ -359,7 +359,7 @@ hms_demo_tutorial_slide_1(Application_Links *app, Arena *arena){
Fancy_Block *long_details = &result.long_details;
hms_demo_tutorial_long_start(app, arena, long_details);
push_fancy_line(arena, long_details, face, fcolor_id(Stag_Pop1), string_u8_litexpr("Let's start with a few navigation commands:"));
push_fancy_line(arena, long_details, face, fcolor_id(defcolor_pop1), string_u8_litexpr("Let's start with a few navigation commands:"));
hms_demo_tutorial_binding_line(app, arena, long_details, face,
"Control", "Comma", "change active panel");
@ -376,7 +376,7 @@ hms_demo_tutorial_slide_1(Application_Links *app, Arena *arena){
hms_demo_tutorial_binding_line(app, arena, long_details, face,
"", "PageUp/PageDown", "move cursor by full pages up/down");
push_fancy_line(arena, long_details, face, fcolor_id(Stag_Pop1), string_u8_litexpr("Available in code files:"));
push_fancy_line(arena, long_details, face, fcolor_id(defcolor_pop1), string_u8_litexpr("Available in code files:"));
hms_demo_tutorial_binding_line(app, arena, long_details, face,
@ -409,7 +409,7 @@ hms_demo_tutorial_slide_2(Application_Links *app, Arena *arena){
Fancy_Block *long_details = &result.long_details;
hms_demo_tutorial_long_start(app, arena, long_details);
push_fancy_line(arena, long_details, face, fcolor_id(Stag_Pop1), string_u8_litexpr("Now a look at basic editing:"));
push_fancy_line(arena, long_details, face, fcolor_id(defcolor_pop1), string_u8_litexpr("Now a look at basic editing:"));
hms_demo_tutorial_binding_line(app, arena, long_details, face,
"", "TextInsert", "non-modal text insertion works in any user-writable buffers at the cursor");
@ -429,7 +429,7 @@ hms_demo_tutorial_slide_2(Application_Links *app, Arena *arena){
hms_demo_tutorial_binding_line(app, arena, long_details, face,
"Alt", "Up/Down", "move the current line");
push_fancy_line(arena, long_details, face, fcolor_id(Stag_Pop1), string_u8_litexpr("Range commands based on a cursor and mark (emacs style):"));
push_fancy_line(arena, long_details, face, fcolor_id(defcolor_pop1), string_u8_litexpr("Range commands based on a cursor and mark (emacs style):"));
hms_demo_tutorial_binding_line(app, arena, long_details, face,
"Control", "Space", "moves the mark to the cursor");
@ -443,7 +443,7 @@ hms_demo_tutorial_slide_2(Application_Links *app, Arena *arena){
hms_demo_tutorial_binding_line(app, arena, long_details, face,
"Control", "X", "cut the range");
push_fancy_line(arena, long_details, face, fcolor_id(Stag_Pop1), string_u8_litexpr("Paste options with a multi-stage clipboard:"));
push_fancy_line(arena, long_details, face, fcolor_id(defcolor_pop1), string_u8_litexpr("Paste options with a multi-stage clipboard:"));
hms_demo_tutorial_binding_line(app, arena, long_details, face,
"Control", "V", "paste the clipboard to the buffer");
@ -466,7 +466,7 @@ hms_demo_tutorial_slide_3(Application_Links *app, Arena *arena){
Fancy_Block *long_details = &result.long_details;
hms_demo_tutorial_long_start(app, arena, long_details);
push_fancy_line(arena, long_details, face, fcolor_id(Stag_Pop1), string_u8_litexpr("Now try beginning a file lister:"));
push_fancy_line(arena, long_details, face, fcolor_id(defcolor_pop1), string_u8_litexpr("Now try beginning a file lister:"));
hms_demo_tutorial_binding_line(app, arena, long_details, face,
"Control", "N", "begin a file lister for exploring the file system - always creating a new file");
@ -477,7 +477,7 @@ hms_demo_tutorial_slide_3(Application_Links *app, Arena *arena){
hms_demo_tutorial_binding_line(app, arena, long_details, face,
"Alt", "O", "same as previous option but opens in the other panel");
push_fancy_line(arena, long_details, face, fcolor_id(Stag_Pop1), string_u8_litexpr("Inside a file lister:"));
push_fancy_line(arena, long_details, face, fcolor_id(defcolor_pop1), string_u8_litexpr("Inside a file lister:"));
hms_demo_tutorial_binding_line(app, arena, long_details, face,
"", "TextInsert", "narrows the lister down to options with substrings matching the text field");
@ -497,7 +497,7 @@ hms_demo_tutorial_slide_3(Application_Links *app, Arena *arena){
hms_demo_tutorial_binding_line(app, arena, long_details, face,
"", "Escape", "cancel the operation");
push_fancy_line(arena, long_details, face, fcolor_id(Stag_Pop1), string_u8_litexpr("There are also buffer listers for operations on buffers that are already open:"));
push_fancy_line(arena, long_details, face, fcolor_id(defcolor_pop1), string_u8_litexpr("There are also buffer listers for operations on buffers that are already open:"));
hms_demo_tutorial_binding_line(app, arena, long_details, face,
"Control", "I", "begin a buffer lister and switch to the selected buffer");
@ -520,12 +520,12 @@ hms_demo_tutorial_slide_4(Application_Links *app, Arena *arena){
Fancy_Block *long_details = &result.long_details;
hms_demo_tutorial_long_start(app, arena, long_details);
push_fancy_line(arena, long_details, face, fcolor_id(Stag_Pop1), string_u8_litexpr("The command lister makes all commands available in one place:"));
push_fancy_line(arena, long_details, face, fcolor_id(defcolor_pop1), string_u8_litexpr("The command lister makes all commands available in one place:"));
hms_demo_tutorial_binding_line(app, arena, long_details, face,
"Alt", "X", "a lister of all commands");
push_fancy_line(arena, long_details, face, fcolor_id(Stag_Pop1), string_u8_litexpr("Try some of these commands from the command lister:"));
push_fancy_line(arena, long_details, face, fcolor_id(defcolor_pop1), string_u8_litexpr("Try some of these commands from the command lister:"));
hms_demo_tutorial_binding_line(app, arena, long_details, face,
"", "toggle_filebar", "toggle the panel's filebar");
@ -560,7 +560,7 @@ hms_demo_tutorial_slide_5(Application_Links *app, Arena *arena){
Fancy_Block *long_details = &result.long_details;
hms_demo_tutorial_long_start(app, arena, long_details);
push_fancy_line(arena, long_details, face, fcolor_id(Stag_Pop1), string_u8_litexpr("Fast navigation by jump lists:"));
push_fancy_line(arena, long_details, face, fcolor_id(defcolor_pop1), string_u8_litexpr("Fast navigation by jump lists:"));
hms_demo_tutorial_binding_line(app, arena, long_details, face,
"Alt", "F", "after the user answers a query for a string generate a jump list of matches");
@ -571,7 +571,7 @@ hms_demo_tutorial_slide_5(Application_Links *app, Arena *arena){
hms_demo_tutorial_binding_line(app, arena, long_details, face,
"Control Shift", "I", "parse the current buffer as a C/C++ source and generate a jump list of functions");
push_fancy_line(arena, long_details, face, fcolor_id(Stag_Pop1), string_u8_litexpr("After generating a jump list it is bound as the active jump list enabling these commands:"));
push_fancy_line(arena, long_details, face, fcolor_id(defcolor_pop1), string_u8_litexpr("After generating a jump list it is bound as the active jump list enabling these commands:"));
hms_demo_tutorial_binding_line(app, arena, long_details, face,
"Alt", "N", "jump to the next jump location");
@ -597,43 +597,43 @@ hms_demo_tutorial_slide_6(Application_Links *app, Arena *arena){
Fancy_Block *long_details = &result.long_details;
hms_demo_tutorial_long_start(app, arena, long_details);
push_fancy_line(arena, long_details, face, fcolor_id(Stag_Pop1), string_u8_litexpr("Virtual whitespace:"));
push_fancy_line(arena, long_details, face, fcolor_id(defcolor_pop1), string_u8_litexpr("Virtual whitespace:"));
push_fancy_line(arena, long_details, face, fcolor_id(Stag_Default),
push_fancy_line(arena, long_details, face, fcolor_id(defcolor_text_default),
string_u8_litexpr("\tBuffers that are indexed with information about nest structures can be equiped with the virtual whitespace layout algorithm."));
push_fancy_line(arena, long_details, face, fcolor_id(Stag_Default),
push_fancy_line(arena, long_details, face, fcolor_id(defcolor_text_default),
string_u8_litexpr("\tThe on screen layout of text is independent of the actual whitespace contents of the underlying text."));
push_fancy_line(arena, long_details, face, fcolor_id(Stag_Default), string_u8_litexpr(""));
push_fancy_line(arena, long_details, face, fcolor_id(defcolor_text_default), string_u8_litexpr(""));
push_fancy_line(arena, long_details, face, fcolor_id(Stag_Keyword),
push_fancy_line(arena, long_details, face, fcolor_id(defcolor_keyword),
string_u8_litexpr("\tTry inserting new scopes and parenthetical sections in a code file."));
push_fancy_line(arena, long_details, face, fcolor_id(Stag_Default),
push_fancy_line(arena, long_details, face, fcolor_id(defcolor_text_default),
string_u8_litexpr("\t\tObserve that indentation is updated automatically."));
push_fancy_line(arena, long_details, face, fcolor_id(Stag_Keyword),
push_fancy_line(arena, long_details, face, fcolor_id(defcolor_keyword),
string_u8_litexpr("\tTry creating a line that is long enough to wrap around the edge."));
push_fancy_line(arena, long_details, face, fcolor_id(Stag_Default),
push_fancy_line(arena, long_details, face, fcolor_id(defcolor_text_default),
string_u8_litexpr("\t\tObserve that wrapped lines obey the same indentation rules as literal lines."));
{
Fancy_Line *line = push_fancy_line(arena, long_details, face, fcolor_id(Stag_Default));
Fancy_Line *line = push_fancy_line(arena, long_details, face, fcolor_id(defcolor_text_default));
push_fancy_stringf(arena, line, "\tUse the command ");
push_fancy_stringf(arena, line, fcolor_id(Stag_Pop2), "toggle_virtual_whitespace");
push_fancy_stringf(arena, line, fcolor_id(defcolor_pop2), "toggle_virtual_whitespace");
push_fancy_stringf(arena, line, " to turn this feature on and off");
}
{
Fancy_Line *line = push_fancy_line(arena, long_details, face, fcolor_id(Stag_Default));
Fancy_Line *line = push_fancy_line(arena, long_details, face, fcolor_id(defcolor_text_default));
push_fancy_stringf(arena, line, "\tUse the command ");
push_fancy_stringf(arena, line, fcolor_id(Stag_Pop2), "toggle_line_wrap");
push_fancy_stringf(arena, line, fcolor_id(defcolor_pop2), "toggle_line_wrap");
push_fancy_stringf(arena, line, " to see how layout changes with line wrapping on and off");
}
push_fancy_line(arena, long_details, face, fcolor_id(Stag_Pop1), string_u8_litexpr("Auto Indentation:"));
push_fancy_line(arena, long_details, face, fcolor_id(defcolor_pop1), string_u8_litexpr("Auto Indentation:"));
hms_demo_tutorial_binding_line(app, arena, long_details, face,
"Control", "Tab", "auto indent the lines marked by the range; the effect is only visible with virtual whitespace off.");
@ -653,7 +653,7 @@ hms_demo_tutorial_slide_7(Application_Links *app, Arena *arena){
Fancy_Block *long_details = &result.long_details;
hms_demo_tutorial_long_start(app, arena, long_details);
push_fancy_line(arena, long_details, face, fcolor_id(Stag_Pop1), string_u8_litexpr("Builds, scripts, and projects:"));
push_fancy_line(arena, long_details, face, fcolor_id(defcolor_pop1), string_u8_litexpr("Builds, scripts, and projects:"));
hms_demo_tutorial_binding_line(app, arena, long_details, face,
"Alt", "M", "searches for and runs a build script (windows -> 'build.bat'; unix -> 'build.sh')");
@ -664,7 +664,7 @@ hms_demo_tutorial_slide_7(Application_Links *app, Arena *arena){
hms_demo_tutorial_binding_line(app, arena, long_details, face,
"", "execute_previous_cli", "repeats an execute_any_cli command with the same command and ouptut buffer");
push_fancy_line(arena, long_details, face, fcolor_id(Stag_Pop1), string_u8_litexpr("If a script/command generates output that can be parsed as jumps (e.g. compilation errors) then it becomes the active jump buffer:"));
push_fancy_line(arena, long_details, face, fcolor_id(defcolor_pop1), string_u8_litexpr("If a script/command generates output that can be parsed as jumps (e.g. compilation errors) then it becomes the active jump buffer:"));
hms_demo_tutorial_binding_line(app, arena, long_details, face,
"Alt", "N", "jump to the next jump location");
@ -675,7 +675,7 @@ hms_demo_tutorial_slide_7(Application_Links *app, Arena *arena){
hms_demo_tutorial_binding_line(app, arena, long_details, face,
"Alt Shift", "M", "jump to the first jump");
push_fancy_line(arena, long_details, face, fcolor_id(Stag_Pop1), string_u8_litexpr("The project system enables rich bindings of arbitrary system scripts (when a project is loaded):"));
push_fancy_line(arena, long_details, face, fcolor_id(defcolor_pop1), string_u8_litexpr("The project system enables rich bindings of arbitrary system scripts (when a project is loaded):"));
hms_demo_tutorial_binding_line(app, arena, long_details, face,
"", "F#", "run a script bound to the corresponding index in the loaded project");
@ -689,7 +689,7 @@ hms_demo_tutorial_slide_7(Application_Links *app, Arena *arena){
hms_demo_tutorial_binding_line(app, arena, long_details, face,
"", "setup_new_project", "command to generate a new 'project.4coder' file and build scripts");
push_fancy_line(arena, long_details, face, fcolor_id(Stag_Default),
push_fancy_line(arena, long_details, face, fcolor_id(defcolor_text_default),
string_u8_litexpr("\tCheckout 'project.4coder' to see more about what is in a project."));
return(result);
@ -707,16 +707,16 @@ hms_demo_tutorial_slide_8(Application_Links *app, Arena *arena){
Fancy_Block *long_details = &result.long_details;
hms_demo_tutorial_long_start(app, arena, long_details);
push_fancy_line(arena, long_details, face, fcolor_id(Stag_Default),
push_fancy_line(arena, long_details, face, fcolor_id(defcolor_text_default),
string_u8_litexpr("Probably the biggest feature in 4coder is that so many things about it can be customized."));
push_fancy_line(arena, long_details, face, fcolor_id(Stag_Default),
push_fancy_line(arena, long_details, face, fcolor_id(defcolor_text_default),
string_u8_litexpr("The project loaded for this demo is the 'default custom layer' everything here could be done differently, as you see fit."));
push_fancy_line(arena, long_details, face, fcolor_id(Stag_Default),
push_fancy_line(arena, long_details, face, fcolor_id(defcolor_text_default),
string_u8_litexpr(""));
push_fancy_line(arena, long_details, face, fcolor_id(Stag_Pop1),
push_fancy_line(arena, long_details, face, fcolor_id(defcolor_pop1),
string_u8_litexpr("Search for these commands to see some of the features available to customization:"));
hms_demo_tutorial_binding_line(app, arena, long_details, face,
@ -740,11 +740,11 @@ hms_demo_tutorial_slide_8(Application_Links *app, Arena *arena){
hms_demo_tutorial_binding_line(app, arena, long_details, face,
"", "setup_default_mapping", "defines the mapping of commands to bindings");
push_fancy_line(arena, long_details, face, fcolor_id(Stag_Default), string_u8_litexpr(""));
push_fancy_line(arena, long_details, face, fcolor_id(defcolor_text_default), string_u8_litexpr(""));
push_fancy_line(arena, long_details, face, fcolor_id(Stag_Default), string_u8_litexpr("\tThe macros CUSTOM_COMMAND_SIG and CUSTOM_DOC markup the commands to create the list of all available commands."));
push_fancy_line(arena, long_details, face, fcolor_id(defcolor_text_default), string_u8_litexpr("\tThe macros CUSTOM_COMMAND_SIG and CUSTOM_DOC markup the commands to create the list of all available commands."));
push_fancy_line(arena, long_details, face, fcolor_id(Stag_Default), string_u8_litexpr("\tThis means that user written commands that use the same markup automatically appear in the command_lister along side built in commands!"));
push_fancy_line(arena, long_details, face, fcolor_id(defcolor_text_default), string_u8_litexpr("\tThis means that user written commands that use the same markup automatically appear in the command_lister along side built in commands!"));
return(result);
}
@ -761,13 +761,13 @@ hms_demo_tutorial_slide_9(Application_Links *app, Arena *arena){
Fancy_Block *long_details = &result.long_details;
hms_demo_tutorial_long_start(app, arena, long_details);
push_fancy_line(arena, long_details, face, fcolor_id(Stag_Default),
push_fancy_line(arena, long_details, face, fcolor_id(defcolor_text_default),
string_u8_litexpr("The customization system exposes much more than just commands to be customized..."));
hms_demo_tutorial_binding_line(app, arena, long_details, face,
"Alt", "F", "(hint!) this is the default binding for search, use it to find these functions");
push_fancy_line(arena, long_details, face, fcolor_id(Stag_Pop1),
push_fancy_line(arena, long_details, face, fcolor_id(defcolor_pop1),
string_u8_litexpr("Write completely custom GUIs:"));
hms_demo_tutorial_binding_line(app, arena, long_details, face,
@ -776,7 +776,7 @@ hms_demo_tutorial_slide_9(Application_Links *app, Arena *arena){
hms_demo_tutorial_binding_line(app, arena, long_details, face,
"", "tutorial_run_loop/tutorial_render", "underlying implementation for the tutorial system powering this demo!");
push_fancy_line(arena, long_details, face, fcolor_id(Stag_Pop1),
push_fancy_line(arena, long_details, face, fcolor_id(defcolor_pop1),
string_u8_litexpr("Write custom text coloring and highlighting in buffers:"));
hms_demo_tutorial_binding_line(app, arena, long_details, face,
@ -788,7 +788,7 @@ hms_demo_tutorial_slide_9(Application_Links *app, Arena *arena){
hms_demo_tutorial_binding_line(app, arena, long_details, face,
"", "default_render_buffer", "puts together all the default markup in buffer rendering");
push_fancy_line(arena, long_details, face, fcolor_id(Stag_Pop1),
push_fancy_line(arena, long_details, face, fcolor_id(defcolor_pop1),
string_u8_litexpr("Write custom line layout rules:"));
hms_demo_tutorial_binding_line(app, arena, long_details, face,
@ -797,7 +797,7 @@ hms_demo_tutorial_slide_9(Application_Links *app, Arena *arena){
hms_demo_tutorial_binding_line(app, arena, long_details, face,
"", "layout_index_unwrapped__inner", "the unwrapped version of the virtual whitespace layout logic");
push_fancy_line(arena, long_details, face, fcolor_id(Stag_Pop1),
push_fancy_line(arena, long_details, face, fcolor_id(defcolor_pop1),
string_u8_litexpr("Write custom smoothing rules that interact with buffer and UI scrolling:"));
hms_demo_tutorial_binding_line(app, arena, long_details, face,
@ -821,7 +821,7 @@ hms_demo_tutorial_slide_10(Application_Links *app, Arena *arena){
Fancy_Block *long_details = &result.long_details;
hms_demo_tutorial_long_start(app, arena, long_details);
push_fancy_line(arena, long_details, face, fcolor_id(Stag_Pop1),
push_fancy_line(arena, long_details, face, fcolor_id(defcolor_pop1),
string_u8_litexpr("Some miscellaneous things to try:"));
hms_demo_tutorial_binding_line(app, arena, long_details, face,
@ -857,11 +857,11 @@ hms_demo_tutorial_slide_11(Application_Links *app, Arena *arena){
Fancy_Block *long_details = &result.long_details;
hms_demo_tutorial_long_start(app, arena, long_details);
push_fancy_line(arena, long_details, face, fcolor_id(Stag_Pop1), string_u8_litexpr(""));
push_fancy_line(arena, long_details, face, fcolor_id(defcolor_pop1), string_u8_litexpr(""));
push_fancy_line(arena, long_details, face, fcolor_id(Stag_Pop1), string_u8_litexpr(""));
push_fancy_line(arena, long_details, face, fcolor_id(defcolor_pop1), string_u8_litexpr(""));
push_fancy_line(arena, long_details, face, fcolor_id(Stag_Pop1), string_u8_litexpr("\t\tThanks for checking out the demo!"));
push_fancy_line(arena, long_details, face, fcolor_id(defcolor_pop1), string_u8_litexpr("\t\tThanks for checking out the demo!"));
return(result);
}

View File

@ -27,7 +27,8 @@ union FColor{
ARGB_Color argb;
struct{
ID_Color id;
u16 padding_;
u8 sub_index;
u8 padding_;
};
};
@ -36,12 +37,13 @@ struct Theme_Color{
ARGB_Color color;
};
//struct Theme{
//ARGB_Color colors[Stag_COUNT];
//};
struct Color_Array{
ARGB_Color *vals;
i32 count;
};
struct Color_Table{
ARGB_Color *vals;
Color_Array *arrays;
u32 count;
};

View File

@ -358,12 +358,12 @@ static Command_Metadata fcoder_metacmd_table[222] = {
{ PROC_LINKS(kill_buffer, 0), false, "kill_buffer", 11, "Kills the current buffer.", 25, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1568 },
{ PROC_LINKS(save, 0), false, "save", 4, "Saves the current buffer.", 25, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1576 },
{ PROC_LINKS(reopen, 0), false, "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1586 },
{ PROC_LINKS(undo, 0), false, "undo", 4, "Advances backwards through the undo history of the current buffer.", 66, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1811 },
{ PROC_LINKS(redo, 0), false, "redo", 4, "Advances forwards through the undo history of the current buffer.", 65, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1824 },
{ PROC_LINKS(undo_all_buffers, 0), false, "undo_all_buffers", 16, "Advances backward through the undo history in the buffer containing the most recent regular edit.", 97, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1838 },
{ PROC_LINKS(redo_all_buffers, 0), false, "redo_all_buffers", 16, "Advances forward through the undo history in the buffer containing the most recent regular edit.", 96, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1909 },
{ PROC_LINKS(open_in_other, 0), false, "open_in_other", 13, "Interactively opens a file in the other panel.", 46, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 2010 },
{ PROC_LINKS(default_file_externally_modified, 0), false, "default_file_externally_modified", 32, "Notes the external modification of attached files by printing a message.", 72, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 2016 },
{ PROC_LINKS(undo, 0), false, "undo", 4, "Advances backwards through the undo history of the current buffer.", 66, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1644 },
{ PROC_LINKS(redo, 0), false, "redo", 4, "Advances forwards through the undo history of the current buffer.", 65, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1657 },
{ PROC_LINKS(undo_all_buffers, 0), false, "undo_all_buffers", 16, "Advances backward through the undo history in the buffer containing the most recent regular edit.", 97, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1671 },
{ PROC_LINKS(redo_all_buffers, 0), false, "redo_all_buffers", 16, "Advances forward through the undo history in the buffer containing the most recent regular edit.", 96, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1742 },
{ PROC_LINKS(open_in_other, 0), false, "open_in_other", 13, "Interactively opens a file in the other panel.", 46, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1843 },
{ PROC_LINKS(default_file_externally_modified, 0), false, "default_file_externally_modified", 32, "Notes the external modification of attached files by printing a message.", 72, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1849 },
{ PROC_LINKS(set_eol_mode_to_crlf, 0), false, "set_eol_mode_to_crlf", 20, "Puts the buffer in crlf line ending mode.", 41, "w:\\4ed\\code\\custom\\4coder_eol.cpp", 33, 86 },
{ PROC_LINKS(set_eol_mode_to_lf, 0), false, "set_eol_mode_to_lf", 18, "Puts the buffer in lf line ending mode.", 39, "w:\\4ed\\code\\custom\\4coder_eol.cpp", 33, 99 },
{ PROC_LINKS(set_eol_mode_to_binary, 0), false, "set_eol_mode_to_binary", 22, "Puts the buffer in bin line ending mode.", 40, "w:\\4ed\\code\\custom\\4coder_eol.cpp", 33, 112 },
@ -389,7 +389,7 @@ static Command_Metadata fcoder_metacmd_table[222] = {
{ PROC_LINKS(list_all_locations_of_type_definition, 0), false, "list_all_locations_of_type_definition", 37, "Queries user for string, lists all locations of strings that appear to define a type whose name matches the input string.", 121, "w:\\4ed\\code\\custom\\4coder_search.cpp", 36, 210 },
{ PROC_LINKS(list_all_locations_of_type_definition_of_identifier, 0), false, "list_all_locations_of_type_definition_of_identifier", 51, "Reads a token or word under the cursor and lists all locations of strings that appear to define a type whose name matches it.", 125, "w:\\4ed\\code\\custom\\4coder_search.cpp", 36, 218 },
{ PROC_LINKS(word_complete, 0), false, "word_complete", 13, "Iteratively tries completing the word to the left of the cursor with other words in open buffers that have the same prefix string.", 130, "w:\\4ed\\code\\custom\\4coder_search.cpp", 36, 392 },
{ PROC_LINKS(word_complete_drop_down, 0), false, "word_complete_drop_down", 23, "Word complete with drop down menu.", 34, "w:\\4ed\\code\\custom\\4coder_search.cpp", 36, 641 },
{ PROC_LINKS(word_complete_drop_down, 0), false, "word_complete_drop_down", 23, "Word complete with drop down menu.", 34, "w:\\4ed\\code\\custom\\4coder_search.cpp", 36, 639 },
{ PROC_LINKS(goto_jump_at_cursor, 0), false, "goto_jump_at_cursor", 19, "If the cursor is found to be on a jump location, parses the jump location and brings up the file and position in another view and changes the active panel to the view containing the jump.", 187, "w:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 346 },
{ PROC_LINKS(goto_jump_at_cursor_same_panel, 0), false, "goto_jump_at_cursor_same_panel", 30, "If the cursor is found to be on a jump location, parses the jump location and brings up the file and position in this view, losing the compilation output or jump list.", 167, "w:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 373 },
{ PROC_LINKS(goto_next_jump, 0), false, "goto_next_jump", 14, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, skipping sub jump locations.", 123, "w:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 462 },
@ -401,13 +401,13 @@ static Command_Metadata fcoder_metacmd_table[222] = {
{ PROC_LINKS(if_read_only_goto_position, 0), false, "if_read_only_goto_position", 26, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.", 106, "w:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 562 },
{ PROC_LINKS(if_read_only_goto_position_same_panel, 0), false, "if_read_only_goto_position_same_panel", 37, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel.", 117, "w:\\4ed\\code\\custom\\4coder_jump_sticky.cpp", 41, 579 },
{ PROC_LINKS(view_jump_list_with_lister, 0), false, "view_jump_list_with_lister", 26, "When executed on a buffer with jumps, creates a persistent lister for all the jumps", 83, "w:\\4ed\\code\\custom\\4coder_jump_lister.cpp", 41, 59 },
{ PROC_LINKS(show_the_log_graph, 0), true, "show_the_log_graph", 18, "Parses *log* and displays the 'log graph' UI", 44, "w:\\4ed\\code\\custom\\4coder_log_parser.cpp", 40, 995 },
{ PROC_LINKS(show_the_log_graph, 0), true, "show_the_log_graph", 18, "Parses *log* and displays the 'log graph' UI", 44, "w:\\4ed\\code\\custom\\4coder_log_parser.cpp", 40, 994 },
{ PROC_LINKS(copy, 0), false, "copy", 4, "Copy the text in the range from the cursor to the mark onto the clipboard.", 74, "w:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 19 },
{ PROC_LINKS(cut, 0), false, "cut", 3, "Cut the text in the range from the cursor to the mark onto the clipboard.", 73, "w:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 28 },
{ PROC_LINKS(paste, 0), false, "paste", 5, "At the cursor, insert the text at the top of the clipboard.", 59, "w:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 39 },
{ PROC_LINKS(paste_next, 0), false, "paste_next", 10, "If the previous command was paste or paste_next, replaces the paste range with the next text down on the clipboard, otherwise operates as the paste command.", 156, "w:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 70 },
{ PROC_LINKS(paste_and_indent, 0), false, "paste_and_indent", 16, "Paste from the top of clipboard and run auto-indent on the newly pasted text.", 77, "w:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 108 },
{ PROC_LINKS(paste_next_and_indent, 0), false, "paste_next_and_indent", 21, "Paste the next item on the clipboard and run auto-indent on the newly pasted text.", 82, "w:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 115 },
{ PROC_LINKS(paste_next, 0), false, "paste_next", 10, "If the previous command was paste or paste_next, replaces the paste range with the next text down on the clipboard, otherwise operates as the paste command.", 156, "w:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 71 },
{ PROC_LINKS(paste_and_indent, 0), false, "paste_and_indent", 16, "Paste from the top of clipboard and run auto-indent on the newly pasted text.", 77, "w:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 110 },
{ PROC_LINKS(paste_next_and_indent, 0), false, "paste_next_and_indent", 21, "Paste the next item on the clipboard and run auto-indent on the newly pasted text.", 82, "w:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 117 },
{ PROC_LINKS(keyboard_macro_start_recording, 0), false, "keyboard_macro_start_recording", 30, "Start macro recording, do nothing if macro recording is already started", 71, "w:\\4ed\\code\\custom\\4coder_keyboard_macro.cpp", 44, 44 },
{ PROC_LINKS(keyboard_macro_finish_recording, 0), false, "keyboard_macro_finish_recording", 31, "Stop macro recording, do nothing if macro recording is not already started", 74, "w:\\4ed\\code\\custom\\4coder_keyboard_macro.cpp", 44, 57 },
{ PROC_LINKS(keyboard_macro_replay, 0), false, "keyboard_macro_replay", 21, "Replay the most recently recorded keyboard macro", 48, "w:\\4ed\\code\\custom\\4coder_keyboard_macro.cpp", 44, 80 },
@ -459,7 +459,7 @@ static Command_Metadata fcoder_metacmd_table[222] = {
{ PROC_LINKS(miblo_decrement_time_stamp, 0), false, "miblo_decrement_time_stamp", 26, "Decrement a time stamp under the cursor by one second. (format [m]m:ss or h:mm:ss", 81, "w:\\4ed\\code\\custom\\4coder_miblo_numbers.cpp", 43, 237 },
{ PROC_LINKS(miblo_increment_time_stamp_minute, 0), false, "miblo_increment_time_stamp_minute", 33, "Increment a time stamp under the cursor by one minute. (format [m]m:ss or h:mm:ss", 81, "w:\\4ed\\code\\custom\\4coder_miblo_numbers.cpp", 43, 243 },
{ PROC_LINKS(miblo_decrement_time_stamp_minute, 0), false, "miblo_decrement_time_stamp_minute", 33, "Decrement a time stamp under the cursor by one minute. (format [m]m:ss or h:mm:ss", 81, "w:\\4ed\\code\\custom\\4coder_miblo_numbers.cpp", 43, 249 },
{ PROC_LINKS(profile_inspect, 0), true, "profile_inspect", 15, "Inspect all currently collected profiling information in 4coder's self profiler.", 80, "w:\\4ed\\code\\custom\\4coder_profile_inspect.cpp", 45, 890 },
{ PROC_LINKS(profile_inspect, 0), true, "profile_inspect", 15, "Inspect all currently collected profiling information in 4coder's self profiler.", 80, "w:\\4ed\\code\\custom\\4coder_profile_inspect.cpp", 45, 887 },
{ PROC_LINKS(kill_tutorial, 0), false, "kill_tutorial", 13, "If there is an active tutorial, kill it.", 40, "w:\\4ed\\code\\custom\\4coder_tutorial.cpp", 38, 9 },
{ PROC_LINKS(tutorial_maximize, 0), false, "tutorial_maximize", 17, "Expand the tutorial window", 26, "w:\\4ed\\code\\custom\\4coder_tutorial.cpp", 38, 20 },
{ PROC_LINKS(tutorial_minimize, 0), false, "tutorial_minimize", 17, "Shrink the tutorial window", 26, "w:\\4ed\\code\\custom\\4coder_tutorial.cpp", 38, 34 },

View File

@ -108,6 +108,7 @@ vtable->get_managed_scope_with_multiple_dependencies = get_managed_scope_with_mu
vtable->managed_scope_clear_contents = managed_scope_clear_contents;
vtable->managed_scope_clear_self_all_dependent_scopes = managed_scope_clear_self_all_dependent_scopes;
vtable->managed_scope_allocator = managed_scope_allocator;
vtable->managed_id_group_highest_id = managed_id_group_highest_id;
vtable->managed_id_declare = managed_id_declare;
vtable->managed_scope_get_attachment = managed_scope_get_attachment;
vtable->managed_scope_attachment_erase = managed_scope_attachment_erase;
@ -155,9 +156,6 @@ vtable->get_face_id = get_face_id;
vtable->try_create_new_face = try_create_new_face;
vtable->try_modify_face = try_modify_face;
vtable->try_release_face = try_release_face;
vtable->set_theme_colors = set_theme_colors;
vtable->get_theme_colors = get_theme_colors;
vtable->finalize_color = finalize_color;
vtable->push_hot_directory = push_hot_directory;
vtable->set_hot_directory = set_hot_directory;
vtable->send_exit_signal = send_exit_signal;
@ -292,6 +290,7 @@ get_managed_scope_with_multiple_dependencies = vtable->get_managed_scope_with_mu
managed_scope_clear_contents = vtable->managed_scope_clear_contents;
managed_scope_clear_self_all_dependent_scopes = vtable->managed_scope_clear_self_all_dependent_scopes;
managed_scope_allocator = vtable->managed_scope_allocator;
managed_id_group_highest_id = vtable->managed_id_group_highest_id;
managed_id_declare = vtable->managed_id_declare;
managed_scope_get_attachment = vtable->managed_scope_get_attachment;
managed_scope_attachment_erase = vtable->managed_scope_attachment_erase;
@ -339,9 +338,6 @@ get_face_id = vtable->get_face_id;
try_create_new_face = vtable->try_create_new_face;
try_modify_face = vtable->try_modify_face;
try_release_face = vtable->try_release_face;
set_theme_colors = vtable->set_theme_colors;
get_theme_colors = vtable->get_theme_colors;
finalize_color = vtable->finalize_color;
push_hot_directory = vtable->push_hot_directory;
set_hot_directory = vtable->set_hot_directory;
send_exit_signal = vtable->send_exit_signal;

View File

@ -93,7 +93,7 @@
#define custom_view_set_mark_sig() b32 custom_view_set_mark(Application_Links* app, View_ID view_id, Buffer_Seek seek)
#define custom_view_quit_ui_sig() b32 custom_view_quit_ui(Application_Links* app, View_ID view_id)
#define custom_view_set_buffer_sig() b32 custom_view_set_buffer(Application_Links* app, View_ID view_id, Buffer_ID buffer_id, Set_Buffer_Flag flags)
#define custom_view_post_fade_sig() b32 custom_view_post_fade(Application_Links* app, View_ID view_id, f32 seconds, Range_i64 range, FColor color)
#define custom_view_post_fade_sig() b32 custom_view_post_fade(Application_Links* app, View_ID view_id, f32 seconds, Range_i64 range, ARGB_Color color)
#define custom_view_push_context_sig() b32 custom_view_push_context(Application_Links* app, View_ID view_id, View_Context* ctx)
#define custom_view_pop_context_sig() b32 custom_view_pop_context(Application_Links* app, View_ID view_id)
#define custom_view_alter_context_sig() b32 custom_view_alter_context(Application_Links* app, View_ID view_id, View_Context* ctx)
@ -106,6 +106,7 @@
#define custom_managed_scope_clear_contents_sig() b32 custom_managed_scope_clear_contents(Application_Links* app, Managed_Scope scope)
#define custom_managed_scope_clear_self_all_dependent_scopes_sig() b32 custom_managed_scope_clear_self_all_dependent_scopes(Application_Links* app, Managed_Scope scope)
#define custom_managed_scope_allocator_sig() Base_Allocator* custom_managed_scope_allocator(Application_Links* app, Managed_Scope scope)
#define custom_managed_id_group_highest_id_sig() u64 custom_managed_id_group_highest_id(Application_Links* app, String_Const_u8 group)
#define custom_managed_id_declare_sig() Managed_ID custom_managed_id_declare(Application_Links* app, String_Const_u8 group, String_Const_u8 name)
#define custom_managed_scope_get_attachment_sig() void* custom_managed_scope_get_attachment(Application_Links* app, Managed_Scope scope, Managed_ID id, umem size)
#define custom_managed_scope_attachment_erase_sig() void* custom_managed_scope_attachment_erase(Application_Links* app, Managed_Scope scope, Managed_ID id)
@ -153,17 +154,14 @@
#define custom_try_create_new_face_sig() Face_ID custom_try_create_new_face(Application_Links* app, Face_Description* description)
#define custom_try_modify_face_sig() b32 custom_try_modify_face(Application_Links* app, Face_ID id, Face_Description* description)
#define custom_try_release_face_sig() b32 custom_try_release_face(Application_Links* app, Face_ID id, Face_ID replacement_id)
#define custom_set_theme_colors_sig() void custom_set_theme_colors(Application_Links* app, Theme_Color* colors, i32 count)
#define custom_get_theme_colors_sig() void custom_get_theme_colors(Application_Links* app, Theme_Color* colors, i32 count)
#define custom_finalize_color_sig() ARGB_Color custom_finalize_color(Application_Links* app, ID_Color color)
#define custom_push_hot_directory_sig() String_Const_u8 custom_push_hot_directory(Application_Links* app, Arena* arena)
#define custom_set_hot_directory_sig() b32 custom_set_hot_directory(Application_Links* app, String_Const_u8 string)
#define custom_send_exit_signal_sig() void custom_send_exit_signal(Application_Links* app)
#define custom_set_window_title_sig() b32 custom_set_window_title(Application_Links* app, String_Const_u8 title)
#define custom_draw_string_oriented_sig() Vec2_f32 custom_draw_string_oriented(Application_Links* app, Face_ID font_id, FColor color, String_Const_u8 str, Vec2_f32 point, u32 flags, Vec2_f32 delta)
#define custom_draw_string_oriented_sig() Vec2_f32 custom_draw_string_oriented(Application_Links* app, Face_ID font_id, ARGB_Color color, String_Const_u8 str, Vec2_f32 point, u32 flags, Vec2_f32 delta)
#define custom_get_string_advance_sig() f32 custom_get_string_advance(Application_Links* app, Face_ID font_id, String_Const_u8 str)
#define custom_draw_rectangle_sig() void custom_draw_rectangle(Application_Links* app, Rect_f32 rect, f32 roundness, FColor color)
#define custom_draw_rectangle_outline_sig() void custom_draw_rectangle_outline(Application_Links* app, Rect_f32 rect, f32 roundness, f32 thickness, FColor color)
#define custom_draw_rectangle_sig() void custom_draw_rectangle(Application_Links* app, Rect_f32 rect, f32 roundness, ARGB_Color color)
#define custom_draw_rectangle_outline_sig() void custom_draw_rectangle_outline(Application_Links* app, Rect_f32 rect, f32 roundness, f32 thickness, ARGB_Color color)
#define custom_draw_set_clip_sig() Rect_f32 custom_draw_set_clip(Application_Links* app, Rect_f32 new_clip)
#define custom_text_layout_create_sig() Text_Layout_ID custom_text_layout_create(Application_Links* app, Buffer_ID buffer_id, Rect_f32 rect, Buffer_Point buffer_point)
#define custom_text_layout_region_sig() Rect_f32 custom_text_layout_region(Application_Links* app, Text_Layout_ID text_layout_id)
@ -171,9 +169,9 @@
#define custom_text_layout_get_visible_range_sig() Range_i64 custom_text_layout_get_visible_range(Application_Links* app, Text_Layout_ID text_layout_id)
#define custom_text_layout_line_on_screen_sig() Range_f32 custom_text_layout_line_on_screen(Application_Links* app, Text_Layout_ID layout_id, i64 line_number)
#define custom_text_layout_character_on_screen_sig() Rect_f32 custom_text_layout_character_on_screen(Application_Links* app, Text_Layout_ID layout_id, i64 pos)
#define custom_paint_text_color_sig() void custom_paint_text_color(Application_Links* app, Text_Layout_ID layout_id, Interval_i64 range, FColor color)
#define custom_paint_text_color_sig() void custom_paint_text_color(Application_Links* app, Text_Layout_ID layout_id, Interval_i64 range, ARGB_Color color)
#define custom_text_layout_free_sig() b32 custom_text_layout_free(Application_Links* app, Text_Layout_ID text_layout_id)
#define custom_draw_text_layout_sig() void custom_draw_text_layout(Application_Links* app, Text_Layout_ID layout_id)
#define custom_draw_text_layout_sig() void custom_draw_text_layout(Application_Links* app, Text_Layout_ID layout_id, ARGB_Color special_color, ARGB_Color ghost_color)
#define custom_open_color_picker_sig() void custom_open_color_picker(Application_Links* app, Color_Picker* picker)
#define custom_animate_in_n_milliseconds_sig() void custom_animate_in_n_milliseconds(Application_Links* app, u32 n)
#define custom_buffer_find_all_matches_sig() String_Match_List custom_buffer_find_all_matches(Application_Links* app, Arena* arena, Buffer_ID buffer, i32 string_id, Range_i64 range, String_Const_u8 needle, Character_Predicate* predicate, Scan_Direction direction)
@ -273,7 +271,7 @@ typedef b32 custom_view_set_buffer_scroll_type(Application_Links* app, View_ID v
typedef b32 custom_view_set_mark_type(Application_Links* app, View_ID view_id, Buffer_Seek seek);
typedef b32 custom_view_quit_ui_type(Application_Links* app, View_ID view_id);
typedef b32 custom_view_set_buffer_type(Application_Links* app, View_ID view_id, Buffer_ID buffer_id, Set_Buffer_Flag flags);
typedef b32 custom_view_post_fade_type(Application_Links* app, View_ID view_id, f32 seconds, Range_i64 range, FColor color);
typedef b32 custom_view_post_fade_type(Application_Links* app, View_ID view_id, f32 seconds, Range_i64 range, ARGB_Color color);
typedef b32 custom_view_push_context_type(Application_Links* app, View_ID view_id, View_Context* ctx);
typedef b32 custom_view_pop_context_type(Application_Links* app, View_ID view_id);
typedef b32 custom_view_alter_context_type(Application_Links* app, View_ID view_id, View_Context* ctx);
@ -286,6 +284,7 @@ typedef Managed_Scope custom_get_managed_scope_with_multiple_dependencies_type(A
typedef b32 custom_managed_scope_clear_contents_type(Application_Links* app, Managed_Scope scope);
typedef b32 custom_managed_scope_clear_self_all_dependent_scopes_type(Application_Links* app, Managed_Scope scope);
typedef Base_Allocator* custom_managed_scope_allocator_type(Application_Links* app, Managed_Scope scope);
typedef u64 custom_managed_id_group_highest_id_type(Application_Links* app, String_Const_u8 group);
typedef Managed_ID custom_managed_id_declare_type(Application_Links* app, String_Const_u8 group, String_Const_u8 name);
typedef void* custom_managed_scope_get_attachment_type(Application_Links* app, Managed_Scope scope, Managed_ID id, umem size);
typedef void* custom_managed_scope_attachment_erase_type(Application_Links* app, Managed_Scope scope, Managed_ID id);
@ -333,17 +332,14 @@ typedef Face_ID custom_get_face_id_type(Application_Links* app, Buffer_ID buffer
typedef Face_ID custom_try_create_new_face_type(Application_Links* app, Face_Description* description);
typedef b32 custom_try_modify_face_type(Application_Links* app, Face_ID id, Face_Description* description);
typedef b32 custom_try_release_face_type(Application_Links* app, Face_ID id, Face_ID replacement_id);
typedef void custom_set_theme_colors_type(Application_Links* app, Theme_Color* colors, i32 count);
typedef void custom_get_theme_colors_type(Application_Links* app, Theme_Color* colors, i32 count);
typedef ARGB_Color custom_finalize_color_type(Application_Links* app, ID_Color color);
typedef String_Const_u8 custom_push_hot_directory_type(Application_Links* app, Arena* arena);
typedef b32 custom_set_hot_directory_type(Application_Links* app, String_Const_u8 string);
typedef void custom_send_exit_signal_type(Application_Links* app);
typedef b32 custom_set_window_title_type(Application_Links* app, String_Const_u8 title);
typedef Vec2_f32 custom_draw_string_oriented_type(Application_Links* app, Face_ID font_id, FColor color, String_Const_u8 str, Vec2_f32 point, u32 flags, Vec2_f32 delta);
typedef Vec2_f32 custom_draw_string_oriented_type(Application_Links* app, Face_ID font_id, ARGB_Color color, String_Const_u8 str, Vec2_f32 point, u32 flags, Vec2_f32 delta);
typedef f32 custom_get_string_advance_type(Application_Links* app, Face_ID font_id, String_Const_u8 str);
typedef void custom_draw_rectangle_type(Application_Links* app, Rect_f32 rect, f32 roundness, FColor color);
typedef void custom_draw_rectangle_outline_type(Application_Links* app, Rect_f32 rect, f32 roundness, f32 thickness, FColor color);
typedef void custom_draw_rectangle_type(Application_Links* app, Rect_f32 rect, f32 roundness, ARGB_Color color);
typedef void custom_draw_rectangle_outline_type(Application_Links* app, Rect_f32 rect, f32 roundness, f32 thickness, ARGB_Color color);
typedef Rect_f32 custom_draw_set_clip_type(Application_Links* app, Rect_f32 new_clip);
typedef Text_Layout_ID custom_text_layout_create_type(Application_Links* app, Buffer_ID buffer_id, Rect_f32 rect, Buffer_Point buffer_point);
typedef Rect_f32 custom_text_layout_region_type(Application_Links* app, Text_Layout_ID text_layout_id);
@ -351,9 +347,9 @@ typedef Buffer_ID custom_text_layout_get_buffer_type(Application_Links* app, Tex
typedef Range_i64 custom_text_layout_get_visible_range_type(Application_Links* app, Text_Layout_ID text_layout_id);
typedef Range_f32 custom_text_layout_line_on_screen_type(Application_Links* app, Text_Layout_ID layout_id, i64 line_number);
typedef Rect_f32 custom_text_layout_character_on_screen_type(Application_Links* app, Text_Layout_ID layout_id, i64 pos);
typedef void custom_paint_text_color_type(Application_Links* app, Text_Layout_ID layout_id, Interval_i64 range, FColor color);
typedef void custom_paint_text_color_type(Application_Links* app, Text_Layout_ID layout_id, Interval_i64 range, ARGB_Color color);
typedef b32 custom_text_layout_free_type(Application_Links* app, Text_Layout_ID text_layout_id);
typedef void custom_draw_text_layout_type(Application_Links* app, Text_Layout_ID layout_id);
typedef void custom_draw_text_layout_type(Application_Links* app, Text_Layout_ID layout_id, ARGB_Color special_color, ARGB_Color ghost_color);
typedef void custom_open_color_picker_type(Application_Links* app, Color_Picker* picker);
typedef void custom_animate_in_n_milliseconds_type(Application_Links* app, u32 n);
typedef String_Match_List custom_buffer_find_all_matches_type(Application_Links* app, Arena* arena, Buffer_ID buffer, i32 string_id, Range_i64 range, String_Const_u8 needle, Character_Predicate* predicate, Scan_Direction direction);
@ -467,6 +463,7 @@ custom_get_managed_scope_with_multiple_dependencies_type *get_managed_scope_with
custom_managed_scope_clear_contents_type *managed_scope_clear_contents;
custom_managed_scope_clear_self_all_dependent_scopes_type *managed_scope_clear_self_all_dependent_scopes;
custom_managed_scope_allocator_type *managed_scope_allocator;
custom_managed_id_group_highest_id_type *managed_id_group_highest_id;
custom_managed_id_declare_type *managed_id_declare;
custom_managed_scope_get_attachment_type *managed_scope_get_attachment;
custom_managed_scope_attachment_erase_type *managed_scope_attachment_erase;
@ -514,9 +511,6 @@ custom_get_face_id_type *get_face_id;
custom_try_create_new_face_type *try_create_new_face;
custom_try_modify_face_type *try_modify_face;
custom_try_release_face_type *try_release_face;
custom_set_theme_colors_type *set_theme_colors;
custom_get_theme_colors_type *get_theme_colors;
custom_finalize_color_type *finalize_color;
custom_push_hot_directory_type *push_hot_directory;
custom_set_hot_directory_type *set_hot_directory;
custom_send_exit_signal_type *send_exit_signal;
@ -636,7 +630,7 @@ internal b32 view_set_buffer_scroll(Application_Links* app, View_ID view_id, Buf
internal b32 view_set_mark(Application_Links* app, View_ID view_id, Buffer_Seek seek);
internal b32 view_quit_ui(Application_Links* app, View_ID view_id);
internal b32 view_set_buffer(Application_Links* app, View_ID view_id, Buffer_ID buffer_id, Set_Buffer_Flag flags);
internal b32 view_post_fade(Application_Links* app, View_ID view_id, f32 seconds, Range_i64 range, FColor color);
internal b32 view_post_fade(Application_Links* app, View_ID view_id, f32 seconds, Range_i64 range, ARGB_Color color);
internal b32 view_push_context(Application_Links* app, View_ID view_id, View_Context* ctx);
internal b32 view_pop_context(Application_Links* app, View_ID view_id);
internal b32 view_alter_context(Application_Links* app, View_ID view_id, View_Context* ctx);
@ -649,6 +643,7 @@ internal Managed_Scope get_managed_scope_with_multiple_dependencies(Application_
internal b32 managed_scope_clear_contents(Application_Links* app, Managed_Scope scope);
internal b32 managed_scope_clear_self_all_dependent_scopes(Application_Links* app, Managed_Scope scope);
internal Base_Allocator* managed_scope_allocator(Application_Links* app, Managed_Scope scope);
internal u64 managed_id_group_highest_id(Application_Links* app, String_Const_u8 group);
internal Managed_ID managed_id_declare(Application_Links* app, String_Const_u8 group, String_Const_u8 name);
internal void* managed_scope_get_attachment(Application_Links* app, Managed_Scope scope, Managed_ID id, umem size);
internal void* managed_scope_attachment_erase(Application_Links* app, Managed_Scope scope, Managed_ID id);
@ -696,17 +691,14 @@ internal Face_ID get_face_id(Application_Links* app, Buffer_ID buffer_id);
internal Face_ID try_create_new_face(Application_Links* app, Face_Description* description);
internal b32 try_modify_face(Application_Links* app, Face_ID id, Face_Description* description);
internal b32 try_release_face(Application_Links* app, Face_ID id, Face_ID replacement_id);
internal void set_theme_colors(Application_Links* app, Theme_Color* colors, i32 count);
internal void get_theme_colors(Application_Links* app, Theme_Color* colors, i32 count);
internal ARGB_Color finalize_color(Application_Links* app, ID_Color color);
internal String_Const_u8 push_hot_directory(Application_Links* app, Arena* arena);
internal b32 set_hot_directory(Application_Links* app, String_Const_u8 string);
internal void send_exit_signal(Application_Links* app);
internal b32 set_window_title(Application_Links* app, String_Const_u8 title);
internal Vec2_f32 draw_string_oriented(Application_Links* app, Face_ID font_id, FColor color, String_Const_u8 str, Vec2_f32 point, u32 flags, Vec2_f32 delta);
internal Vec2_f32 draw_string_oriented(Application_Links* app, Face_ID font_id, ARGB_Color color, String_Const_u8 str, Vec2_f32 point, u32 flags, Vec2_f32 delta);
internal f32 get_string_advance(Application_Links* app, Face_ID font_id, String_Const_u8 str);
internal void draw_rectangle(Application_Links* app, Rect_f32 rect, f32 roundness, FColor color);
internal void draw_rectangle_outline(Application_Links* app, Rect_f32 rect, f32 roundness, f32 thickness, FColor color);
internal void draw_rectangle(Application_Links* app, Rect_f32 rect, f32 roundness, ARGB_Color color);
internal void draw_rectangle_outline(Application_Links* app, Rect_f32 rect, f32 roundness, f32 thickness, ARGB_Color color);
internal Rect_f32 draw_set_clip(Application_Links* app, Rect_f32 new_clip);
internal Text_Layout_ID text_layout_create(Application_Links* app, Buffer_ID buffer_id, Rect_f32 rect, Buffer_Point buffer_point);
internal Rect_f32 text_layout_region(Application_Links* app, Text_Layout_ID text_layout_id);
@ -714,9 +706,9 @@ internal Buffer_ID text_layout_get_buffer(Application_Links* app, Text_Layout_ID
internal Range_i64 text_layout_get_visible_range(Application_Links* app, Text_Layout_ID text_layout_id);
internal Range_f32 text_layout_line_on_screen(Application_Links* app, Text_Layout_ID layout_id, i64 line_number);
internal Rect_f32 text_layout_character_on_screen(Application_Links* app, Text_Layout_ID layout_id, i64 pos);
internal void paint_text_color(Application_Links* app, Text_Layout_ID layout_id, Interval_i64 range, FColor color);
internal void paint_text_color(Application_Links* app, Text_Layout_ID layout_id, Interval_i64 range, ARGB_Color color);
internal b32 text_layout_free(Application_Links* app, Text_Layout_ID text_layout_id);
internal void draw_text_layout(Application_Links* app, Text_Layout_ID layout_id);
internal void draw_text_layout(Application_Links* app, Text_Layout_ID layout_id, ARGB_Color special_color, ARGB_Color ghost_color);
internal void open_color_picker(Application_Links* app, Color_Picker* picker);
internal void animate_in_n_milliseconds(Application_Links* app, u32 n);
internal String_Match_List buffer_find_all_matches(Application_Links* app, Arena* arena, Buffer_ID buffer, i32 string_id, Range_i64 range, String_Const_u8 needle, Character_Predicate* predicate, Scan_Direction direction);
@ -831,6 +823,7 @@ global custom_get_managed_scope_with_multiple_dependencies_type *get_managed_sco
global custom_managed_scope_clear_contents_type *managed_scope_clear_contents = 0;
global custom_managed_scope_clear_self_all_dependent_scopes_type *managed_scope_clear_self_all_dependent_scopes = 0;
global custom_managed_scope_allocator_type *managed_scope_allocator = 0;
global custom_managed_id_group_highest_id_type *managed_id_group_highest_id = 0;
global custom_managed_id_declare_type *managed_id_declare = 0;
global custom_managed_scope_get_attachment_type *managed_scope_get_attachment = 0;
global custom_managed_scope_attachment_erase_type *managed_scope_attachment_erase = 0;
@ -878,9 +871,6 @@ global custom_get_face_id_type *get_face_id = 0;
global custom_try_create_new_face_type *try_create_new_face = 0;
global custom_try_modify_face_type *try_modify_face = 0;
global custom_try_release_face_type *try_release_face = 0;
global custom_set_theme_colors_type *set_theme_colors = 0;
global custom_get_theme_colors_type *get_theme_colors = 0;
global custom_finalize_color_type *finalize_color = 0;
global custom_push_hot_directory_type *push_hot_directory = 0;
global custom_set_hot_directory_type *set_hot_directory = 0;
global custom_send_exit_signal_type *send_exit_signal = 0;

View File

@ -93,7 +93,7 @@ api(custom) function b32 view_set_buffer_scroll(Application_Links* app, View_ID
api(custom) function b32 view_set_mark(Application_Links* app, View_ID view_id, Buffer_Seek seek);
api(custom) function b32 view_quit_ui(Application_Links* app, View_ID view_id);
api(custom) function b32 view_set_buffer(Application_Links* app, View_ID view_id, Buffer_ID buffer_id, Set_Buffer_Flag flags);
api(custom) function b32 view_post_fade(Application_Links* app, View_ID view_id, f32 seconds, Range_i64 range, FColor color);
api(custom) function b32 view_post_fade(Application_Links* app, View_ID view_id, f32 seconds, Range_i64 range, ARGB_Color color);
api(custom) function b32 view_push_context(Application_Links* app, View_ID view_id, View_Context* ctx);
api(custom) function b32 view_pop_context(Application_Links* app, View_ID view_id);
api(custom) function b32 view_alter_context(Application_Links* app, View_ID view_id, View_Context* ctx);
@ -106,6 +106,7 @@ api(custom) function Managed_Scope get_managed_scope_with_multiple_dependencies(
api(custom) function b32 managed_scope_clear_contents(Application_Links* app, Managed_Scope scope);
api(custom) function b32 managed_scope_clear_self_all_dependent_scopes(Application_Links* app, Managed_Scope scope);
api(custom) function Base_Allocator* managed_scope_allocator(Application_Links* app, Managed_Scope scope);
api(custom) function u64 managed_id_group_highest_id(Application_Links* app, String_Const_u8 group);
api(custom) function Managed_ID managed_id_declare(Application_Links* app, String_Const_u8 group, String_Const_u8 name);
api(custom) function void* managed_scope_get_attachment(Application_Links* app, Managed_Scope scope, Managed_ID id, umem size);
api(custom) function void* managed_scope_attachment_erase(Application_Links* app, Managed_Scope scope, Managed_ID id);
@ -153,17 +154,14 @@ api(custom) function Face_ID get_face_id(Application_Links* app, Buffer_ID buffe
api(custom) function Face_ID try_create_new_face(Application_Links* app, Face_Description* description);
api(custom) function b32 try_modify_face(Application_Links* app, Face_ID id, Face_Description* description);
api(custom) function b32 try_release_face(Application_Links* app, Face_ID id, Face_ID replacement_id);
api(custom) function void set_theme_colors(Application_Links* app, Theme_Color* colors, i32 count);
api(custom) function void get_theme_colors(Application_Links* app, Theme_Color* colors, i32 count);
api(custom) function ARGB_Color finalize_color(Application_Links* app, ID_Color color);
api(custom) function String_Const_u8 push_hot_directory(Application_Links* app, Arena* arena);
api(custom) function b32 set_hot_directory(Application_Links* app, String_Const_u8 string);
api(custom) function void send_exit_signal(Application_Links* app);
api(custom) function b32 set_window_title(Application_Links* app, String_Const_u8 title);
api(custom) function Vec2_f32 draw_string_oriented(Application_Links* app, Face_ID font_id, FColor color, String_Const_u8 str, Vec2_f32 point, u32 flags, Vec2_f32 delta);
api(custom) function Vec2_f32 draw_string_oriented(Application_Links* app, Face_ID font_id, ARGB_Color color, String_Const_u8 str, Vec2_f32 point, u32 flags, Vec2_f32 delta);
api(custom) function f32 get_string_advance(Application_Links* app, Face_ID font_id, String_Const_u8 str);
api(custom) function void draw_rectangle(Application_Links* app, Rect_f32 rect, f32 roundness, FColor color);
api(custom) function void draw_rectangle_outline(Application_Links* app, Rect_f32 rect, f32 roundness, f32 thickness, FColor color);
api(custom) function void draw_rectangle(Application_Links* app, Rect_f32 rect, f32 roundness, ARGB_Color color);
api(custom) function void draw_rectangle_outline(Application_Links* app, Rect_f32 rect, f32 roundness, f32 thickness, ARGB_Color color);
api(custom) function Rect_f32 draw_set_clip(Application_Links* app, Rect_f32 new_clip);
api(custom) function Text_Layout_ID text_layout_create(Application_Links* app, Buffer_ID buffer_id, Rect_f32 rect, Buffer_Point buffer_point);
api(custom) function Rect_f32 text_layout_region(Application_Links* app, Text_Layout_ID text_layout_id);
@ -171,9 +169,9 @@ api(custom) function Buffer_ID text_layout_get_buffer(Application_Links* app, Te
api(custom) function Range_i64 text_layout_get_visible_range(Application_Links* app, Text_Layout_ID text_layout_id);
api(custom) function Range_f32 text_layout_line_on_screen(Application_Links* app, Text_Layout_ID layout_id, i64 line_number);
api(custom) function Rect_f32 text_layout_character_on_screen(Application_Links* app, Text_Layout_ID layout_id, i64 pos);
api(custom) function void paint_text_color(Application_Links* app, Text_Layout_ID layout_id, Interval_i64 range, FColor color);
api(custom) function void paint_text_color(Application_Links* app, Text_Layout_ID layout_id, Interval_i64 range, ARGB_Color color);
api(custom) function b32 text_layout_free(Application_Links* app, Text_Layout_ID text_layout_id);
api(custom) function void draw_text_layout(Application_Links* app, Text_Layout_ID layout_id);
api(custom) function void draw_text_layout(Application_Links* app, Text_Layout_ID layout_id, ARGB_Color special_color, ARGB_Color ghost_color);
api(custom) function void open_color_picker(Application_Links* app, Color_Picker* picker);
api(custom) function void animate_in_n_milliseconds(Application_Links* app, u32 n);
api(custom) function String_Match_List buffer_find_all_matches(Application_Links* app, Arena* arena, Buffer_ID buffer, i32 string_id, Range_i64 range, String_Const_u8 needle, Character_Predicate* predicate, Scan_Direction direction);

View File

@ -1,5 +1,43 @@
function void
initialize_managed_id_metadata(Application_Links *app){
defcolor_bar = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_bar"));
defcolor_base = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_base"));
defcolor_pop1 = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_pop1"));
defcolor_pop2 = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_pop2"));
defcolor_back = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_back"));
defcolor_margin = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_margin"));
defcolor_margin_hover = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_margin_hover"));
defcolor_margin_active = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_margin_active"));
defcolor_list_item = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_list_item"));
defcolor_list_item_hover = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_list_item_hover"));
defcolor_list_item_active = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_list_item_active"));
defcolor_cursor = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_cursor"));
defcolor_at_cursor = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_at_cursor"));
defcolor_highlight_cursor_line = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_highlight_cursor_line"));
defcolor_highlight = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_highlight"));
defcolor_at_highlight = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_at_highlight"));
defcolor_mark = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_mark"));
defcolor_text_default = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_text_default"));
defcolor_comment = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_comment"));
defcolor_comment_pop = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_comment_pop"));
defcolor_keyword = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_keyword"));
defcolor_str_constant = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_str_constant"));
defcolor_char_constant = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_char_constant"));
defcolor_int_constant = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_int_constant"));
defcolor_float_constant = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_float_constant"));
defcolor_bool_constant = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_bool_constant"));
defcolor_preproc = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_preproc"));
defcolor_include = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_include"));
defcolor_special_character = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_special_character"));
defcolor_ghost_character = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_ghost_character"));
defcolor_highlight_junk = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_highlight_junk"));
defcolor_highlight_white = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_highlight_white"));
defcolor_paste = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_paste"));
defcolor_undo = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_undo"));
defcolor_back_cycle = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_back_cycle"));
defcolor_text_cycle = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_text_cycle"));
defcolor_line_numbers_back = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_line_numbers_back"));
defcolor_line_numbers_text = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_line_numbers_text"));
view_rewrite_loc = managed_id_declare(app, string_u8_litexpr("attachment"), string_u8_litexpr("view_rewrite_loc"));
view_next_rewrite_loc = managed_id_declare(app, string_u8_litexpr("attachment"), string_u8_litexpr("view_next_rewrite_loc"));
view_paste_index_loc = managed_id_declare(app, string_u8_litexpr("attachment"), string_u8_litexpr("view_paste_index_loc"));