New fancy color cleanup; fancy string cleanup; api colors now use fancy colors; fancy colors are FColors

master
Allen Webster 2019-10-22 18:25:40 -07:00
parent 9f986493a1
commit 21d482e05f
24 changed files with 1284 additions and 1042 deletions

View File

@ -1542,16 +1542,19 @@ view_set_buffer(Application_Links *app, View_ID view_id, Buffer_ID buffer_id, Se
return(result);
}
// TODO(allen): remove this!
api(custom) function b32
view_post_fade(Application_Links *app, View_ID view_id, f32 seconds, Range_i64 range, int_color color)
{
view_post_fade(Application_Links *app, View_ID view_id, f32 seconds, Range_i64 range,
FColor 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){
view_post_paste_effect(view, seconds, (i32)range.start, (i32)size, color|0xFF000000);
Color_Table color_table = models->color_table;
view_post_paste_effect(view, seconds, (i32)range.start, (i32)size,
finalize_color(color_table, color));
result = true;
}
}
@ -2582,15 +2585,11 @@ get_theme_colors(Application_Links *app, Theme_Color *colors, i32 count)
}
}
api(custom) function argb_color
finalize_color(Application_Links *app, int_color color){
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;
u32 color_rgb = color;
if ((color & 0xFF000000) == 0){
color_rgb = color_table.vals[color % color_table.count];
}
return(color_rgb);
return(finalize_color(color_table, color));
}
api(custom) function String_Const_u8
@ -2630,10 +2629,11 @@ set_window_title(Application_Links *app, String_Const_u8 title)
return(true);
}
api(custom) function Vec2
draw_string_oriented(Application_Links *app, Face_ID font_id, String_Const_u8 str, Vec2 point, int_color color, u32 flags, Vec2 delta)
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)
{
Vec2 result = point;
Vec2_f32 result = point;
Models *models = (Models*)app->cmd_context;
Face *face = font_set_face_from_id(&models->font_set, font_id);
if (models->target == 0){
@ -2658,7 +2658,7 @@ 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, int_color color){
draw_rectangle(Application_Links *app, Rect_f32 rect, f32 roundness, FColor color){
Models *models = (Models*)app->cmd_context;
if (models->in_render_mode){
Color_Table color_table = models->color_table;
@ -2670,8 +2670,8 @@ draw_rectangle(Application_Links *app, Rect_f32 rect, f32 roundness, int_color c
}
api(custom) function void
draw_rectangle_outline(Application_Links *app, Rect_f32 rect, f32 roundness, f32 thickness, int_color color)
{
draw_rectangle_outline(Application_Links *app, Rect_f32 rect,
f32 roundness, f32 thickness, FColor color){
Models *models = (Models*)app->cmd_context;
if (models->in_render_mode){
Color_Table color_table = models->color_table;
@ -2722,9 +2722,10 @@ 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);
int_color *colors_array = push_array(arena, int_color, item_count);
FColor *colors_array = push_array(arena, FColor, item_count);
for (i64 i = 0; i < item_count; i += 1){
colors_array[i] = Stag_Default;
colors_array[i].a_byte = 0;
colors_array[i].id = Stag_Default;
}
result = text_layout_new(&models->text_layouts, arena, buffer_id, buffer_point,
visible_range, visible_line_number_range, rect, colors_array);
@ -2862,7 +2863,8 @@ 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, int_color color){
paint_text_color(Application_Links *app, Text_Layout_ID layout_id, Interval_i64 range,
FColor color){
Models *models = (Models*)app->cmd_context;
Rect_f32 result = {};
Text_Layout *layout = text_layout_get(&models->text_layouts, layout_id);
@ -2871,7 +2873,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;
int_color *color_ptr = layout->item_colors + range.min;
FColor *color_ptr = layout->item_colors + range.min;
for (i64 i = range.min; i < range.max; i += 1, color_ptr += 1){
*color_ptr = color;
}

View File

@ -162,11 +162,13 @@ draw_rectangle(Render_Target *target, Rect_f32 rect, f32 roundness, u32 color){
}
internal void
draw_font_glyph(Render_Target *target, Face *face, u32 codepoint, f32 x, f32 y, u32 color, u32 flags){
draw_font_glyph(Render_Target *target, Face *face, u32 codepoint, Vec2_f32 p,
ARGB_Color color, u32 flags){
draw__set_face_id(target, face->id);
u16 glyph_index = 0;
if (!codepoint_index_map_read(&face->codepoint_to_index_map, codepoint, &glyph_index)){
if (!codepoint_index_map_read(&face->codepoint_to_index_map, codepoint,
&glyph_index)){
glyph_index = 0;
}
Glyph_Bounds bounds = face->bounds[glyph_index];
@ -176,22 +178,29 @@ draw_font_glyph(Render_Target *target, Face *face, u32 codepoint, f32 x, f32 y,
Render_Vertex vertices[6] = {};
if (!HasFlag(flags, GlyphFlag_Rotate90)){
Rect_f32 xy = Rf32(x + bounds.xy_off.x0, y + bounds.xy_off.y0,
x + bounds.xy_off.x1, y + bounds.xy_off.y1);
Rect_f32 xy = Rf32(p + bounds.xy_off.p0, p + bounds.xy_off.p1);
vertices[0].xy = V2(xy.x0, xy.y1); vertices[0].uvw = V3(uv.x0, uv.y1, bounds.w);
vertices[1].xy = V2(xy.x1, xy.y1); vertices[1].uvw = V3(uv.x1, uv.y1, bounds.w);
vertices[2].xy = V2(xy.x0, xy.y0); vertices[2].uvw = V3(uv.x0, uv.y0, bounds.w);
vertices[5].xy = V2(xy.x1, xy.y0); vertices[5].uvw = V3(uv.x1, uv.y0, bounds.w);
vertices[0].xy = V2f32(xy.x0, xy.y1);
vertices[0].uvw = V3f32(uv.x0, uv.y1, bounds.w);
vertices[1].xy = V2f32(xy.x1, xy.y1);
vertices[1].uvw = V3f32(uv.x1, uv.y1, bounds.w);
vertices[2].xy = V2f32(xy.x0, xy.y0);
vertices[2].uvw = V3f32(uv.x0, uv.y0, bounds.w);
vertices[5].xy = V2f32(xy.x1, xy.y0);
vertices[5].uvw = V3f32(uv.x1, uv.y0, bounds.w);
}
else{
Rect_f32 xy = Rf32(x - bounds.xy_off.y1, y + bounds.xy_off.x0,
x - bounds.xy_off.y0, y + bounds.xy_off.x1);
Rect_f32 xy = Rf32(p.x - bounds.xy_off.y1, p.y + bounds.xy_off.x0,
p.x - bounds.xy_off.y0, p.y + bounds.xy_off.x1);
vertices[0].xy = V2(xy.x0, xy.y1); vertices[0].uvw = V3(uv.x1, uv.y1, bounds.w);
vertices[1].xy = V2(xy.x1, xy.y1); vertices[1].uvw = V3(uv.x1, uv.y0, bounds.w);
vertices[2].xy = V2(xy.x0, xy.y0); vertices[2].uvw = V3(uv.x0, uv.y1, bounds.w);
vertices[5].xy = V2(xy.x1, xy.y0); vertices[5].uvw = V3(uv.x0, uv.y0, bounds.w);
vertices[0].xy = V2f32(xy.x0, xy.y1);
vertices[0].uvw = V3f32(uv.x1, uv.y1, bounds.w);
vertices[1].xy = V2f32(xy.x1, xy.y1);
vertices[1].uvw = V3f32(uv.x1, uv.y0, bounds.w);
vertices[2].xy = V2f32(xy.x0, xy.y0);
vertices[2].uvw = V3f32(uv.x0, uv.y1, bounds.w);
vertices[5].xy = V2f32(xy.x1, xy.y0);
vertices[5].uvw = V3f32(uv.x0, uv.y0, bounds.w);
}
vertices[3] = vertices[1];
@ -215,7 +224,8 @@ floor32(Vec2 point){
}
internal f32
draw_string(Render_Target *target, Face *face, String_Const_u8 string, Vec2 point, u32 color, u32 flags, Vec2 delta){
draw_string(Render_Target *target, Face *face, String_Const_u8 string, Vec2_f32 point,
ARGB_Color color, u32 flags, Vec2_f32 delta){
f32 total_delta = 0.f;
if (face != 0){
point = floor32(point);
@ -238,7 +248,7 @@ draw_string(Render_Target *target, Face *face, String_Const_u8 string, Vec2 poin
if (behavior.do_codepoint_advance){
u32 codepoint = step.value;
if (color != 0){
draw_font_glyph(target, face, codepoint, point.x, point.y, color, flags);
draw_font_glyph(target, face, codepoint, point, color, flags);
}
f32 d = font_get_glyph_advance(face, codepoint);
point += d*delta;
@ -264,7 +274,7 @@ draw_string(Render_Target *target, Face *face, String_Const_u8 string, Vec2 poin
Vec2 pp = point;
for (u32 j = 0; j < 3; ++j){
draw_font_glyph(target, face, cs[j], pp.x, pp.y, color, flags);
draw_font_glyph(target, face, cs[j], pp, color, flags);
pp += delta*byte_sub_advances[j];
}
}

View File

@ -38,7 +38,7 @@ internal Text_Layout_ID
text_layout_new(Text_Layout_Container *container, Arena *arena,
Buffer_ID buffer_id, Buffer_Point point,
Interval_i64 visible_range, Interval_i64 visible_line_number_range,
Rect_f32 rect, int_color *item_colors){
Rect_f32 rect, FColor *item_colors){
Text_Layout *new_layout_data = text_layout_new__alloc_layout(container);
new_layout_data->arena = arena;
new_layout_data->buffer_id = buffer_id;
@ -90,8 +90,8 @@ text_layout_render(Thread_Context *tctx, Models *models, Text_Layout *layout){
Face *face = file_get_face(models, file);
f32 width = rect_width(layout->rect);
u32 special_color = color_table.vals[Stag_Special_Character];
u32 ghost_color = color_table.vals[Stag_Ghost_Character];
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;
@ -104,28 +104,23 @@ text_layout_render(Thread_Context *tctx, Models *models, Text_Layout *layout){
block = block->next){
Buffer_Layout_Item *item = block->items;
i64 count = block->count;
int_color *item_colors = layout->item_colors;
FColor *item_colors = layout->item_colors;
for (i32 i = 0; i < count; i += 1, item += 1){
if (item->codepoint != 0){
int_color symbol_color = item_colors[item->index - first_index];
u32 color = 0;
if (symbol_color == Stag_Default){
if (HasFlag(item->flags, BRFlag_Special_Character)){
color = special_color;
}
else if (HasFlag(item->flags, BRFlag_Ghost_Character)){
color = ghost_color;
}
else{
color = finalize_color(color_table, symbol_color);
}
ARGB_Color color = 0;
if (HasFlag(item->flags, BRFlag_Special_Character)){
color = special_color;
}
else if (HasFlag(item->flags, BRFlag_Ghost_Character)){
color = ghost_color;
}
else{
color = finalize_color(color_table, symbol_color);
FColor fcolor = item_colors[item->index - first_index];
color = finalize_color(color_table, fcolor);
}
Vec2_f32 p = item->rect.p0 + shift_p;
draw_font_glyph(target, face, item->codepoint, p.x, p.y, 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;
int_color *item_colors;
FColor *item_colors;
};
};

View File

@ -388,7 +388,7 @@ view_set_cursor_and_scroll(Thread_Context *tctx, Models *models, View *view, i64
}
internal void
view_post_paste_effect(View *view, f32 seconds, i64 start, i64 size, u32 color){
view_post_paste_effect(View *view, f32 seconds, i64 start, i64 size, ARGB_Color color){
Editing_File *file = view->file;
file->state.paste_effect.start = start;
file->state.paste_effect.end = start + size;
@ -727,13 +727,18 @@ release_font_and_update(Models *models, Face *face, Face *replacement_face){
////////////////////////////////
internal argb_color
finalize_color(Color_Table color_table, int_color color){
argb_color color_argb = color;
if ((color & 0xFF000000) == 0){
color_argb = color_table.vals[color % color_table.count];
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(color_argb);
return(result);
}
////////////////////////////////

View File

@ -1630,10 +1630,9 @@ CUSTOM_COMMAND_SIG(multi_paste){
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));
Theme_Color paste = {};
paste.tag = Stag_Paste;
get_theme_colors(app, &paste, 1);
view_post_fade(app, view, 0.667f, Ii64(range.max + 1, range.max + insert_string.size), paste.color);
view_post_fade(app, view, 0.667f,
Ii64(range.max + 1, range.max + insert_string.size),
fcolor_id(Stag_Paste));
}
else{
paste(app);
@ -1689,10 +1688,7 @@ multi_paste_range(Application_Links *app, View_ID view, Range_i64 range, i32 pas
view_set_cursor_and_preferred_x(app, view, seek_pos(finish_range.max));
// TODO(allen): Send this to all views.
Theme_Color paste;
paste.tag = Stag_Paste;
get_theme_colors(app, &paste, 1);
view_post_fade(app, view, 0.667f, finish_range, paste.color);
view_post_fade(app, view, 0.667f, finish_range, fcolor_id(Stag_Paste));
}
}
return(finish_range);

View File

@ -1520,18 +1520,18 @@ lerp(i32 a, f32 t, i32 b){
return((i32)(lerp((f32)a, t, (f32)b)));
}
internal Vec2
lerp(Vec2 a, f32 t, Vec2 b){
internal Vec2_f32
lerp(Vec2_f32 a, f32 t, Vec2_f32 b){
return(a + (b-a)*t);
}
internal Vec3
lerp(Vec3 a, f32 t, Vec3 b){
internal Vec3_f32
lerp(Vec3_f32 a, f32 t, Vec3_f32 b){
return(a + (b-a)*t);
}
internal Vec4
lerp(Vec4 a, f32 t, Vec4 b){
internal Vec4_f32
lerp(Vec4_f32 a, f32 t, Vec4_f32 b){
return(a + (b-a)*t);
}
@ -1590,34 +1590,9 @@ operator!=(Rect_f32 a, Rect_f32 b){
////////////////////////////////
// TODO(allen): Convert colors to Vec4
internal u32
color_blend(u32 a, f32 t, u32 b){
union{
u8 byte[4];
u32 comp;
} A, B, R;
A.comp = a;
B.comp = b;
R.byte[0] = (u8)lerp(A.byte[0], t, B.byte[0]);
R.byte[1] = (u8)lerp(A.byte[1], t, B.byte[1]);
R.byte[2] = (u8)lerp(A.byte[2], t, B.byte[2]);
R.byte[3] = (u8)lerp(A.byte[3], t, B.byte[3]);
return(R.comp);
}
internal Vec3
unpack_color3(u32 color){
Vec3 result;
result.r = ((color >> 16) & 0xFF)/255.f;
result.g = ((color >> 8) & 0xFF)/255.f;
result.b = ((color >> 0) & 0xFF)/255.f;
return(result);
}
internal Vec4
unpack_color4(u32 color){
Vec4 result;
internal Vec4_f32
unpack_color(ARGB_Color color){
Vec4_f32 result;
result.a = ((color >> 24) & 0xFF)/255.f;
result.r = ((color >> 16) & 0xFF)/255.f;
result.g = ((color >> 8) & 0xFF)/255.f;
@ -1625,9 +1600,9 @@ unpack_color4(u32 color){
return(result);
}
internal u32
pack_color4(Vec4 color){
u32 result =
internal ARGB_Color
pack_color(Vec4_f32 color){
ARGB_Color result =
((u8)(color.a*255) << 24) |
((u8)(color.r*255) << 16) |
((u8)(color.g*255) << 8) |
@ -1635,6 +1610,14 @@ pack_color4(Vec4 color){
return(result);
}
internal ARGB_Color
color_blend(ARGB_Color a, f32 t, ARGB_Color b){
Vec4_f32 av = unpack_color(a);
Vec4_f32 bv = unpack_color(b);
Vec4_f32 v = lerp(av, t, bv);
return(pack_color(v));
}
internal Vec4
rgba_to_hsla(Vec4 rgba){
Vec4 hsla = {};

View File

@ -774,6 +774,8 @@ union Rect_f32_Pair{
};
};
typedef u32 ARGB_Color;
////////////////////////////////
struct i8_Array{

View File

@ -62,10 +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.
Theme_Color paste = {};
paste.tag = Stag_Paste;
get_theme_colors(app, &paste, 1);
view_post_fade(app, view, 0.667f, Ii64(pos, pos + string.size), paste.color);
view_post_fade(app, view, 0.667f, Ii64_size(pos, string.size),
fcolor_id(Stag_Paste));
}
}
}
@ -101,10 +99,8 @@ CUSTOM_DOC("If the previous command was paste or paste_next, replaces the paste
view_set_cursor_and_preferred_x(app, view, seek_pos(pos + string.size));
// TODO(allen): Send this to all views.
Theme_Color paste = {};
paste.tag = Stag_Paste;
get_theme_colors(app, &paste, 1);
view_post_fade(app, view, 0.667f, Ii64(pos, pos + string.size), paste.color);
view_post_fade(app, view, 0.667f, Ii64_size(pos, string.size),
fcolor_id(Stag_Paste));
}
else{
paste(app);

View File

@ -289,7 +289,10 @@ default_render_buffer(Application_Links *app, View_ID view_id, b32 is_active_vie
// NOTE(allen): Scope highlight
if (global_config.use_scope_highlight){
int_color colors[] = { Stag_Back_Cycle_1, Stag_Back_Cycle_2, Stag_Back_Cycle_3, Stag_Back_Cycle_4, };
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));
}
@ -298,28 +301,35 @@ default_render_buffer(Application_Links *app, View_ID view_id, b32 is_active_vie
String_Const_u8 name = string_u8_litexpr("*compilation*");
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, Stag_Highlight_Junk);
draw_jump_highlights(app, buffer, text_layout_id, compilation_buffer,
fcolor_id(Stag_Highlight_Junk));
}
// NOTE(allen): Search highlight
if (global_config.use_jump_highlight){
Buffer_ID jump_buffer = get_locked_jump_buffer(app);
if (jump_buffer != compilation_buffer){
draw_jump_highlights(app, buffer, text_layout_id, jump_buffer, Stag_Highlight_White);
draw_jump_highlights(app, buffer, text_layout_id, jump_buffer,
fcolor_id(Stag_Highlight_White));
}
}
}
// NOTE(allen): Color parens
if (global_config.use_paren_helper){
int_color colors[] = { Stag_Text_Cycle_1, Stag_Text_Cycle_2, Stag_Text_Cycle_3, Stag_Text_Cycle_4, };
draw_paren_highlight(app, buffer, text_layout_id, cursor_pos, colors, ArrayCount(colors));
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));
}
// 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, Stag_Highlight_Cursor_Line);
draw_line_highlight(app, text_layout_id, line_number,
fcolor_id(Stag_Highlight_Cursor_Line));
}
// NOTE(allen): Cursor shape

View File

@ -32,7 +32,6 @@
#include "4coder_string_match.h"
#include "4coder_helper.h"
#include "4coder_delta_rule.h"
#include "4coder_fancy.h"
#include "4coder_draw.h"
#include "4coder_insertion.h"
#include "4coder_lister_base.h"

View File

@ -4,34 +4,35 @@
// TOP
function int_color
function FColor
get_margin_color(i32 level){
int_color margin = 0;
FColor margin = fcolor_zero();
switch (level){
default:
case UIHighlight_None:
{
margin = Stag_List_Item;
margin = fcolor_id(Stag_List_Item);
}break;
case UIHighlight_Hover:
{
margin = Stag_List_Item_Hover;
margin = fcolor_id(Stag_List_Item_Hover);
}break;
case UIHighlight_Active:
{
margin = Stag_List_Item_Active;
margin = fcolor_id(Stag_List_Item_Active);
}break;
}
return(margin);
}
internal Vec2
draw_string(Application_Links *app, Face_ID font_id, String_Const_u8 string, Vec2 p, int_color color){
return(draw_string_oriented(app, font_id, string, p, color, 0, V2(1.f, 0.f)));
internal Vec2_f32
draw_string(Application_Links *app, Face_ID font_id, String_Const_u8 string,
Vec2_f32 p, FColor color){
return(draw_string_oriented(app, font_id, color, string, p, 0, V2(1.f, 0.f)));
}
internal void
draw_margin(Application_Links *app, Rect_f32 outer, Rect_f32 inner, int_color color){
draw_margin(Application_Links *app, Rect_f32 outer, Rect_f32 inner, FColor 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);
@ -39,13 +40,15 @@ draw_margin(Application_Links *app, Rect_f32 outer, Rect_f32 inner, int_color co
}
internal void
draw_character_block(Application_Links *app, Text_Layout_ID layout, i64 pos, f32 roundness, int_color color){
draw_character_block(Application_Links *app, Text_Layout_ID layout, i64 pos,
f32 roundness, FColor color){
Rect_f32 rect = text_layout_character_on_screen(app, layout, pos);
draw_rectangle(app, rect, roundness, color);
}
internal void
draw_character_block(Application_Links *app, Text_Layout_ID layout, Range_i64 range, f32 roundness, int_color color){
draw_character_block(Application_Links *app, Text_Layout_ID layout, Range_i64 range,
f32 roundness, FColor color){
if (range.first < range.one_past_last){
i64 i = range.first;
Rect_f32 first_rect = text_layout_character_on_screen(app, layout, i);
@ -80,27 +83,32 @@ draw_character_block(Application_Links *app, Text_Layout_ID layout, Range_i64 ra
}
internal void
draw_character_wire_frame(Application_Links *app, Text_Layout_ID layout, i64 pos, f32 roundness, f32 thickness, int_color color){
draw_character_wire_frame(Application_Links *app, Text_Layout_ID layout, i64 pos,
f32 roundness, f32 thickness, FColor color){
Rect_f32 rect = text_layout_character_on_screen(app, layout, pos);
draw_rectangle_outline(app, rect, roundness, thickness, color);
}
internal void
draw_character_wire_frame(Application_Links *app, Text_Layout_ID layout, Range_i64 range, f32 roundness, f32 thickness, int_color color){
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);
}
}
internal void
draw_character_i_bar(Application_Links *app, Text_Layout_ID layout, i64 pos, int_color color){
draw_character_i_bar(Application_Links *app, Text_Layout_ID layout, i64 pos,
FColor 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);
}
internal void
draw_line_highlight(Application_Links *app, Text_Layout_ID layout, Range_i64 line_range, int_color color){
draw_line_highlight(Application_Links *app, Text_Layout_ID layout,
Range_i64 line_range, FColor 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);
@ -111,12 +119,14 @@ draw_line_highlight(Application_Links *app, Text_Layout_ID layout, Range_i64 lin
}
internal void
draw_line_highlight(Application_Links *app, Text_Layout_ID layout, i64 line, int_color color){
draw_line_highlight(Application_Links *app, Text_Layout_ID layout, i64 line,
FColor color){
draw_line_highlight(app, layout, Ii64(line), color);
}
internal void
paint_text_color_pos(Application_Links *app, Text_Layout_ID layout, i64 pos, int_color color){
paint_text_color_pos(Application_Links *app, Text_Layout_ID layout, i64 pos,
FColor color){
paint_text_color(app, layout, Ii64(pos, pos + 1), color);
}
@ -165,8 +175,9 @@ function Rect_f32
draw_background_and_margin(Application_Links *app, View_ID view, b32 is_active_view){
Rect_f32 view_rect = view_get_screen_rect(app, view);
Rect_f32 inner = rect_inner(view_rect, 3.f);
int_color margin_color = get_margin_color(is_active_view?UIHighlight_Active:UIHighlight_None);
draw_rectangle(app, inner, 0.f, Stag_Back);
FColor margin_color = get_margin_color(is_active_view?
UIHighlight_Active:UIHighlight_None);
draw_rectangle(app, inner, 0.f, fcolor_id(Stag_Back));
draw_margin(app, view_rect, inner, margin_color);
return(inner);
}
@ -182,15 +193,15 @@ 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, Stag_Bar);
draw_rectangle(app, bar, 0.f, fcolor_id(Stag_Bar));
Fancy_Color base_color = fancy_id(Stag_Base);
Fancy_Color pop2_color = fancy_id(Stag_Pop2);
FColor base_color = fcolor_id(Stag_Base);
FColor pop2_color = fcolor_id(Stag_Pop2);
i64 cursor_position = view_get_cursor_pos(app, view_id);
Buffer_Cursor cursor = view_compute_cursor(app, view_id, seek_pos(cursor_position));
Fancy_String_List list = {};
Fancy_Line list = {};
String_Const_u8 unique_name = push_buffer_unique_name(app, scratch, buffer);
push_fancy_string(scratch, &list, base_color, unique_name);
push_fancy_stringf(scratch, &list, base_color, " - Row: %3.lld Col: %3.lld -", cursor.line, cursor.col);
@ -232,28 +243,28 @@ draw_file_bar(Application_Links *app, View_ID view_id, Buffer_ID buffer, Face_ID
}
Vec2 p = bar.p0 + V2(2.f, 2.f);
draw_fancy_string(app, face_id, list.first, p, Stag_Default, 0);
draw_fancy_line(app, face_id, fcolor_zero(), &list, p);
}
function void
draw_query_bar(Application_Links *app, Query_Bar *query_bar, Face_ID face_id, Rect_f32 bar){
Scratch_Block scratch(app);
Fancy_String_List list = {};
push_fancy_string(scratch, &list, fancy_id(Stag_Pop1) , query_bar->prompt);
push_fancy_string(scratch, &list, fancy_id(Stag_Default), query_bar->string);
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);
Vec2_f32 p = bar.p0 + V2(2.f, 2.f);
draw_fancy_string(app, face_id, list.first, p, Stag_Default, 0);
draw_fancy_line(app, face_id, fcolor_zero(), &list, p);
}
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, Stag_Line_Numbers_Back);
draw_rectangle(app, margin, 0.f, fcolor_id(Stag_Line_Numbers_Back));
Interval_i64 visible_range = text_layout_get_visible_range(app, text_layout_id);
Fancy_Color line_color = fancy_id(Stag_Line_Numbers_Text);
FColor line_color = fcolor_id(Stag_Line_Numbers_Text);
i64 line_count = buffer_get_line_count(app, buffer);
i64 line_count_digit_count = digit_count_from_integer(line_count, 10);
@ -269,8 +280,11 @@ draw_line_number_margin(Application_Links *app, View_ID view_id, Buffer_ID buffe
Range_f32 line_y = text_layout_line_on_screen(app, text_layout_id, line_number);
Vec2_f32 p = V2f32(margin.x0, line_y.min);
Temp_Memory_Block temp(scratch);
Fancy_String *line_string = push_fancy_stringf(scratch, line_color, "%*lld", line_count_digit_count, line_number);
draw_fancy_string(app, face_id, line_string, p, Stag_Margin_Active, 0);
Fancy_String *string = push_fancy_stringf(scratch, 0, line_color,
"%*lld",
line_count_digit_count,
line_number);
draw_fancy_string(app, face_id, fcolor_zero(), string, p);
line_number += 1;
}
@ -292,8 +306,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, 0xFF000000);
draw_rectangle_outline(app, rect, 0.f, 1.f, 0xFFFFFFFF);
draw_rectangle(app, rect, 0.f, f_black);
draw_rectangle_outline(app, rect, 0.f, 1.f, f_white);
Vec2_f32 p = rect.p0;
@ -312,55 +326,55 @@ draw_fps_hud(Application_Links *app, Frame_Info frame_info,
dts[1] = history_animation_dt[j];
i32 frame_index = history_frame_index[j];
Fancy_String_List list = {};
push_fancy_stringf(scratch, &list, pink , "FPS: ");
push_fancy_stringf(scratch, &list, green, "[");
push_fancy_stringf(scratch, &list, white, "%5d", frame_index);
push_fancy_stringf(scratch, &list, green, "]: ");
Fancy_Line list = {};
push_fancy_stringf(scratch, &list, f_pink , "FPS: ");
push_fancy_stringf(scratch, &list, f_green, "[");
push_fancy_stringf(scratch, &list, f_white, "%5d", frame_index);
push_fancy_stringf(scratch, &list, f_green, "]: ");
for (i32 k = 0; k < 2; k += 1){
f32 dt = dts[k];
if (dt == 0.f){
push_fancy_stringf(scratch, &list, white, "----------");
push_fancy_stringf(scratch, &list, f_white, "----------");
}
else{
push_fancy_stringf(scratch, &list, white, "%10.6f", dt);
push_fancy_stringf(scratch, &list, f_white, "%10.6f", dt);
}
push_fancy_stringf(scratch, &list, green, " | ");
push_fancy_stringf(scratch, &list, f_green, " | ");
}
draw_fancy_string(app, face_id, list.first, p, Stag_Default, 0, 0, V2(1.f, 0.f));
draw_fancy_line(app, face_id, fcolor_zero(), &list, p);
}
}
}
function int_color
function FColor
get_token_color_cpp(Token token){
int_color result = Stag_Default;
ID_Color color = Stag_Default;
switch (token.kind){
case TokenBaseKind_Preprocessor:
{
result = Stag_Preproc;
color = Stag_Preproc;
}break;
case TokenBaseKind_Keyword:
{
result = Stag_Keyword;
color = Stag_Keyword;
}break;
case TokenBaseKind_Comment:
{
result = Stag_Comment;
color = Stag_Comment;
}break;
case TokenBaseKind_LiteralString:
{
result = Stag_Str_Constant;
color = Stag_Str_Constant;
}break;
case TokenBaseKind_LiteralInteger:
{
result = Stag_Int_Constant;
color = Stag_Int_Constant;
}break;
case TokenBaseKind_LiteralFloat:
{
result = Stag_Float_Constant;
color = Stag_Float_Constant;
}break;
default:
{
@ -368,7 +382,7 @@ get_token_color_cpp(Token token){
case TokenCppKind_LiteralTrue:
case TokenCppKind_LiteralFalse:
{
result = Stag_Bool_Constant;
color = Stag_Bool_Constant;
}break;
case TokenCppKind_LiteralCharacter:
case TokenCppKind_LiteralCharacterWide:
@ -376,16 +390,16 @@ get_token_color_cpp(Token token){
case TokenCppKind_LiteralCharacterUTF16:
case TokenCppKind_LiteralCharacterUTF32:
{
result = Stag_Char_Constant;
color = Stag_Char_Constant;
}break;
case TokenCppKind_PPIncludeFile:
{
result = Stag_Include;
color = Stag_Include;
}break;
}
}break;
}
return(result);
return(fcolor_id(color));
}
function void
@ -398,8 +412,9 @@ draw_buffer_add_cpp_token_colors(Application_Links *app, Text_Layout_ID text_lay
if (token->pos >= visible_range.one_past_last){
break;
}
int_color color = get_token_color_cpp(*token);
paint_text_color(app, text_layout_id, Ii64_size(token->pos, token->size), color);
FColor color = get_token_color_cpp(*token);
paint_text_color(app, text_layout_id, Ii64_size(token->pos, token->size),
color);
if (!token_it_inc_non_whitespace(&it)){
break;
}
@ -472,7 +487,7 @@ 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,
int_color *back_colors, int_color *fore_colors, i32 color_count){
FColor *back_colors, FColor *fore_colors, i32 color_count){
Scratch_Block scratch(app);
Range_i64_Array ranges = get_enclosure_ranges(app, scratch, buffer, pos, flags);
@ -530,7 +545,7 @@ draw_enclosures(Application_Links *app, Text_Layout_ID text_layout_id, Buffer_ID
function void
draw_scope_highlight(Application_Links *app, Buffer_ID buffer, Text_Layout_ID text_layout_id,
i64 pos, int_color *colors, i32 color_count){
i64 pos, FColor *colors, i32 color_count){
draw_enclosures(app, text_layout_id, buffer,
pos, FindNest_Scope, RangeHighlightKind_LineHighlight,
colors, 0, color_count);
@ -538,7 +553,7 @@ draw_scope_highlight(Application_Links *app, Buffer_ID buffer, Text_Layout_ID te
function void
draw_paren_highlight(Application_Links *app, Buffer_ID buffer, Text_Layout_ID text_layout_id,
i64 pos, int_color *colors, i32 color_count){
i64 pos, FColor *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);
@ -563,7 +578,7 @@ draw_paren_highlight(Application_Links *app, Buffer_ID buffer, Text_Layout_ID te
function void
draw_jump_highlights(Application_Links *app, Buffer_ID buffer, Text_Layout_ID text_layout_id,
Buffer_ID jump_buffer, int_color line_color){
Buffer_ID jump_buffer, FColor line_color){
Scratch_Block scratch(app);
if (jump_buffer != 0){
Managed_Scope scopes[2];
@ -599,8 +614,10 @@ draw_highlight_range(Application_Links *app, View_ID view_id,
Marker marker_range[2];
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, Stag_Highlight);
paint_text_color(app, text_layout_id, range, Stag_At_Highlight);
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));
}
}
}
@ -616,13 +633,21 @@ draw_original_4coder_style_cursor_mark_highlight(Application_Links *app, View_ID
i64 cursor_pos = view_get_cursor_pos(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, Stag_Cursor);
paint_text_color_pos(app, text_layout_id, cursor_pos, Stag_At_Cursor);
draw_character_wire_frame(app, text_layout_id, mark_pos, roundness, outline_thickness, Stag_Mark);
draw_character_block(app, text_layout_id, cursor_pos, roundness,
fcolor_id(Stag_Cursor));
paint_text_color_pos(app, text_layout_id, cursor_pos,
fcolor_id(Stag_At_Cursor));
draw_character_wire_frame(app, text_layout_id, mark_pos,
roundness, outline_thickness,
fcolor_id(Stag_Mark));
}
else{
draw_character_wire_frame(app, text_layout_id, mark_pos, roundness, outline_thickness, Stag_Mark);
draw_character_wire_frame(app, text_layout_id, cursor_pos, roundness, outline_thickness, Stag_Cursor);
draw_character_wire_frame(app, text_layout_id, mark_pos,
roundness, outline_thickness,
fcolor_id(Stag_Mark));
draw_character_wire_frame(app, text_layout_id, cursor_pos,
roundness, outline_thickness,
fcolor_id(Stag_Cursor));
}
}
}
@ -637,10 +662,12 @@ draw_notepad_style_cursor_highlight(Application_Links *app, View_ID view_id,
i64 mark_pos = view_get_mark_pos(app, view_id);
if (cursor_pos != mark_pos){
Range_i64 range = Ii64(cursor_pos, mark_pos);
draw_character_block(app, text_layout_id, range, roundness, Stag_Highlight);
paint_text_color(app, text_layout_id, range, Stag_At_Highlight);
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));
}
draw_character_i_bar(app, text_layout_id, cursor_pos, Stag_Cursor);
draw_character_i_bar(app, text_layout_id, cursor_pos, fcolor_id(Stag_Cursor));
}
}

View File

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

View File

@ -4,258 +4,520 @@
// TOP
static Fancy_Color
fancy_blend(id_color a, f32 t, id_color b){
Fancy_Color result = {};
result.index_a = (u16)a;
result.index_b = (u16)b;
result.table_a = 1;
result.table_b = 1;
result.c_b = (u8)(clamp(0, 255.0f*t, 255.0f));
result.c_a = 255 - result.c_b;
return(result);
}
static Fancy_Color
fancy_id(id_color a){
Fancy_Color result = {};
result.index_a = (u16)a;
result.index_b = 0;
result.table_a = 1;
result.table_b = 0;
result.c_a = 255;
result.c_b = 0;
return(result);
}
static Fancy_Color
fancy_rgba(argb_color color){
Fancy_Color result = {};
result.rgba = color;
result.code = 0;
return(result);
}
static Fancy_Color
fancy_rgba(f32 r, f32 g, f32 b, f32 a){
Fancy_Color result = fancy_rgba(pack_color4(V4(r, g, b, a)));
return(result);
}
static Fancy_Color
fancy_resolve_to_rgba(Application_Links *app, Fancy_Color source){
if (source.code != 0){
Vec4 a = unpack_color4(finalize_color(app, source.index_a));
Vec4 b = unpack_color4(finalize_color(app, source.index_b));
f32 ca = (f32)source.c_a/255.0f;
f32 cb = (f32)source.c_b/255.0f;
Vec4 value = ca*a + cb*b;
source.rgba = pack_color4(value);
source.code = 0;
function FColor
fcolor_argb(ARGB_Color color){
FColor result = {};
result.argb = color;
if (result.a_byte == 0){
result.argb = 0;
}
return(source);
return(result);
}
function FColor
fcolor_argb(Vec4_f32 color){
return(fcolor_argb(pack_color(color)));
}
function FColor
fcolor_argb(f32 r, f32 g, f32 b, f32 a){
return(fcolor_argb(pack_color(V4f32(r, g, b, a))));
}
static Fancy_Color
fancy_pass_through(void){
Fancy_Color result = {};
function FColor
fcolor_id(ID_Color id){
FColor result = {};
result.id = id;
return(result);
}
static int_color
int_color_from(Application_Links *app, Fancy_Color source){
int_color result = {};
if ((source.c_a == 255) && (source.c_b == 0)){
result = source.index_a;
function ARGB_Color
argb_color_blend(ARGB_Color a, f32 at, ARGB_Color b, f32 bt){
Vec4_f32 av = unpack_color(a);
Vec4_f32 bv = unpack_color(b);
Vec4_f32 value = at*av + bt*bv;
return(pack_color(value));
}
function ARGB_Color
argb_color_blend(ARGB_Color a, f32 t, ARGB_Color b){
return(argb_color_blend(a, 1.f - t, b, t));
}
function ARGB_Color
fcolor_resolve_to_argb(Application_Links *app, FColor color){
ARGB_Color result = 0;
if (color.a_byte == 0){
if (color.id != 0){
result = finalize_color(app, color.id);
}
}
else{
source = fancy_resolve_to_rgba(app, source);
result = source.rgba;
result = color.argb;
}
return(result);
}
static b32
is_valid(Fancy_Color source){
b32 result = !((source.code == 0) && (source.rgba == 0));
function FColor
fcolor_change_alpha(Application_Links *app, FColor color, f32 alpha){
Vec4_f32 v = unpack_color(fcolor_resolve_to_argb(app, 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);
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));
}
function FColor
fcolor_zero(void){
FColor result = {};
return(result);
}
static void
fancy_string_list_push(Fancy_String_List *list, Fancy_String *string){
list->last = (list->last ? list->last->next : list->first) = string;
function b32
fcolor_is_valid(FColor color){
return(color.argb != 0);
}
static Fancy_String *
push_fancy_string(Arena *arena, Fancy_String_List *list, Fancy_Color fore, Fancy_Color back, String_Const_u8 value){
////////////////////////////////
function void
push_fancy_string(Fancy_Line *line, Fancy_String *string){
sll_queue_push(line->first, line->last, string);
}
function void
push_fancy_line(Fancy_Block *block, Fancy_Line *line){
sll_queue_push(block->first, block->last, line);
block->line_count += 1;
}
////////////////////////////////
function Fancy_String*
push_fancy_string(Arena *arena, Fancy_Line *line, Face_ID face, FColor fore,
f32 pre_margin, f32 post_margin, String_Const_u8 value){
Fancy_String *result = push_array_zero(arena, Fancy_String, 1);
result->value = push_string_copy(arena, value);
result->value = value;
result->face = face;
result->fore = fore;
result->back = back;
if (list != 0){
fancy_string_list_push(list, result);
result->pre_margin = pre_margin;
result->post_margin = post_margin;
if (line != 0){
push_fancy_string(line, result);
}
return(result);
}
static Fancy_String *
push_fancy_string(Arena *arena, Fancy_Color fore, Fancy_Color back, String_Const_u8 value){
return(push_fancy_string(arena, 0, fore, back, value));
function Fancy_String*
push_fancy_string(Arena *arena, Fancy_Line *line, Face_ID face, FColor fore,
String_Const_u8 value){
return(push_fancy_string(arena, line, face, fore, 0, 0, value));
}
function Fancy_String*
push_fancy_string(Arena *arena, Fancy_Line *line, Face_ID face,
f32 pre_margin, f32 post_margin, String_Const_u8 value){
return(push_fancy_string(arena, line, face, fcolor_zero(),
pre_margin, post_margin, value));
}
function Fancy_String*
push_fancy_string(Arena *arena, Fancy_Line *line, FColor fore,
f32 pre_margin, f32 post_margin, String_Const_u8 value){
return(push_fancy_string(arena, line, 0, fore, pre_margin, post_margin, value));
}
function Fancy_String*
push_fancy_string(Arena *arena, Fancy_Line *line, Face_ID face, String_Const_u8 value){
return(push_fancy_string(arena, line, face, fcolor_zero(), 0, 0, value));
}
function Fancy_String*
push_fancy_string(Arena *arena, Fancy_Line *line, FColor color, String_Const_u8 value){
return(push_fancy_string(arena, line, 0, color, 0, 0, value));
}
function Fancy_String*
push_fancy_string(Arena *arena, Fancy_Line *line, f32 pre_margn, f32 post_margin,
String_Const_u8 value){
return(push_fancy_string(arena, line, 0, fcolor_zero(), pre_margn, post_margin,
value));
}
function Fancy_String*
push_fancy_string(Arena *arena, Fancy_Line *line, String_Const_u8 value){
return(push_fancy_string(arena, line, 0, fcolor_zero(), 0, 0, value));
}
static Fancy_String *
push_fancy_string(Arena *arena, Fancy_String_List *list, Fancy_Color fore, String_Const_u8 value){
return(push_fancy_string(arena, list, fore, fancy_pass_through(), value));
////////////////////////////////
function Fancy_String*
push_fancy_stringfv(Arena *arena, Fancy_Line *line, Face_ID face, FColor fore,
f32 pre_margin, f32 post_margin,
char *format, va_list args){
return(push_fancy_string(arena, line, face, fore, pre_margin, post_margin,
push_u8_stringfv(arena, format, args)));
}
function Fancy_String*
push_fancy_stringfv(Arena *arena, Fancy_Line *line, Face_ID face, FColor fore,
char *format, va_list args){
return(push_fancy_stringfv(arena, line, face, fore, 0, 0, format, args));
}
function Fancy_String*
push_fancy_stringfv(Arena *arena, Fancy_Line *line, Face_ID face,
f32 pre_margin, f32 post_margin,
char *format, va_list args){
return(push_fancy_stringfv(arena, line, face, fcolor_zero(),
pre_margin, post_margin, format, args));
}
function Fancy_String*
push_fancy_stringfv(Arena *arena, Fancy_Line *line, FColor fore,
f32 pre_margin, f32 post_margin,
char *format, va_list args){
return(push_fancy_stringfv(arena, line, 0, fore, pre_margin, post_margin,
format, args));
}
function Fancy_String*
push_fancy_stringfv(Arena *arena, Fancy_Line *line, Face_ID face,
char *format, va_list args){
return(push_fancy_stringfv(arena, line, face, fcolor_zero(), 0, 0,
format, args));
}
function Fancy_String*
push_fancy_stringfv(Arena *arena, Fancy_Line *line, FColor color,
char *format, va_list args){
return(push_fancy_stringfv(arena, line, 0, color, 0, 0, format, args));
}
function Fancy_String*
push_fancy_stringfv(Arena *arena, Fancy_Line *line, f32 pre_margn, f32 post_margin,
char *format, va_list args){
return(push_fancy_stringfv(arena, line, 0, fcolor_zero(), pre_margn, post_margin,
format, args));
}
function Fancy_String*
push_fancy_stringfv(Arena *arena, Fancy_Line *line,
char *format, va_list args){
return(push_fancy_stringfv(arena, line, 0, fcolor_zero(), 0, 0, format, args));
}
static Fancy_String *
push_fancy_string(Arena *arena, Fancy_Color fore, String_Const_u8 value){
return(push_fancy_string(arena, 0, fore, fancy_pass_through(), value));
#define StringFBegin() va_list args; va_start(args, format)
#define StringFPass(N) Fancy_String *result = N
#define StringFEnd() va_end(args); return(result)
function Fancy_String*
push_fancy_stringf(Arena *arena, Fancy_Line *line, Face_ID face, FColor fore,
f32 pre_margin, f32 post_margin,
char *format, ...){
StringFBegin();
StringFPass(push_fancy_string(arena, line, face, fore, pre_margin, post_margin,
push_u8_stringfv(arena, format, args)));
StringFEnd();
}
function Fancy_String*
push_fancy_stringf(Arena *arena, Fancy_Line *line, Face_ID face, FColor fore,
char *format, ...){
StringFBegin();
StringFPass(push_fancy_stringfv(arena, line, face, fore, 0, 0, format, args));
StringFEnd();
}
function Fancy_String*
push_fancy_stringf(Arena *arena, Fancy_Line *line, Face_ID face,
f32 pre_margin, f32 post_margin,
char *format, ...){
StringFBegin();
StringFPass(push_fancy_stringfv(arena, line, face, fcolor_zero(),
pre_margin, post_margin, format, args));
StringFEnd();
}
function Fancy_String*
push_fancy_stringf(Arena *arena, Fancy_Line *line, FColor fore,
f32 pre_margin, f32 post_margin,
char *format, ...){
StringFBegin();
StringFPass(push_fancy_stringfv(arena, line, 0, fore, pre_margin, post_margin,
format, args));
StringFEnd();
}
function Fancy_String*
push_fancy_stringf(Arena *arena, Fancy_Line *line, Face_ID face,
char *format, ...){
StringFBegin();
StringFPass(push_fancy_stringfv(arena, line, face, fcolor_zero(), 0, 0,
format, args));
StringFEnd();
}
function Fancy_String*
push_fancy_stringf(Arena *arena, Fancy_Line *line, FColor color,
char *format, ...){
StringFBegin();
StringFPass(push_fancy_stringfv(arena, line, 0, color, 0, 0, format, args));
StringFEnd();
}
function Fancy_String*
push_fancy_stringf(Arena *arena, Fancy_Line *line, f32 pre_margn, f32 post_margin,
char *format, ...){
StringFBegin();
StringFPass(push_fancy_stringfv(arena, line, 0, fcolor_zero(),
pre_margn, post_margin, format, args));
StringFEnd();
}
function Fancy_String*
push_fancy_stringf(Arena *arena, Fancy_Line *line,
char *format, ...){
StringFBegin();
StringFPass(push_fancy_stringfv(arena, line, 0, fcolor_zero(), 0, 0, format, args));
StringFEnd();
}
static Fancy_String *
push_fancy_string(Arena *arena, Fancy_String_List *list, String_Const_u8 value){
return(push_fancy_string(arena, list, fancy_pass_through(), fancy_pass_through(), value));
}
////////////////////////////////
static Fancy_String *
push_fancy_string(Arena *arena, String_Const_u8 value){
return(push_fancy_string(arena, 0, fancy_pass_through(), fancy_pass_through(), value));
}
static Fancy_String*
push_fancy_stringfv(Arena *arena, Fancy_String_List *list, Fancy_Color fore, Fancy_Color back, char *format, va_list args){
String_Const_u8 str = push_u8_stringfv(arena, format, args);
Fancy_String *result = 0;
if (str.size > 0){
result = push_fancy_string(arena, list, fore, back, str);
function Fancy_Line*
push_fancy_line(Arena *arena, Fancy_Block *block, Face_ID face, FColor fore,
String_Const_u8 text){
Fancy_Line *line = push_array_zero(arena, Fancy_Line, 1);
line->face = face;
line->fore = fore;
if (text.size != 0){
push_fancy_string(arena, line, text);
}
return(result);
if (block != 0){
push_fancy_line(block, line);
}
return(line);
}
function Fancy_Line*
push_fancy_line(Arena *arena, Fancy_Block *block, Face_ID face, FColor fcolor){
return(push_fancy_line(arena, block, face, fcolor, SCu8()));
}
function Fancy_Line*
push_fancy_line(Arena *arena, Fancy_Block *block, Face_ID face, String_Const_u8 val){
return(push_fancy_line(arena, block, face, fcolor_zero(), val));
}
function Fancy_Line*
push_fancy_line(Arena *arena, Fancy_Block *block, FColor color, String_Const_u8 val){
return(push_fancy_line(arena, block, 0, color, val));
}
function Fancy_Line*
push_fancy_line(Arena *arena, Fancy_Block *block, Face_ID face){
return(push_fancy_line(arena, block, face, fcolor_zero(), SCu8()));
}
function Fancy_Line*
push_fancy_line(Arena *arena, Fancy_Block *block, FColor color){
return(push_fancy_line(arena, block, 0, color, SCu8()));
}
function Fancy_Line*
push_fancy_line(Arena *arena, Fancy_Block *block, String_Const_u8 val){
return(push_fancy_line(arena, block, 0, fcolor_zero(), val));
}
function Fancy_Line*
push_fancy_line(Arena *arena, Fancy_Block *block){
return(push_fancy_line(arena, block, 0, fcolor_zero(), SCu8()));
}
static Fancy_String*
push_fancy_stringf(Arena *arena, Fancy_String_List *list, Fancy_Color fore, Fancy_Color back, char *format, ...){
va_list args;
va_start(args, format);
Fancy_String *result = push_fancy_stringfv(arena, list, fore, back, format, args);
va_end(args);
return(result);
}
////////////////////////////////
static Fancy_String*
push_fancy_stringf(Arena *arena, Fancy_String_List *list, Fancy_Color fore, char *format, ...){
va_list args;
va_start(args, format);
Fancy_String *result = push_fancy_stringfv(arena, list, fore, fancy_pass_through(), format, args);
va_end(args);
return(result);
}
static Fancy_String*
push_fancy_stringf(Arena *arena, Fancy_String_List *list, char *format, ...){
va_list args;
va_start(args, format);
Fancy_String *result = push_fancy_stringfv(arena, list, fancy_pass_through(), fancy_pass_through(), format, args);
va_end(args);
return(result);
}
static Fancy_String*
push_fancy_stringf(Arena *arena, Fancy_Color fore, Fancy_Color back, char *format, ...){
va_list args;
va_start(args, format);
Fancy_String *result = push_fancy_stringfv(arena, 0, fore, back, format, args);
va_end(args);
return(result);
}
static Fancy_String*
push_fancy_stringf(Arena *arena, Fancy_Color fore, char *format, ...){
va_list args;
va_start(args, format);
Fancy_String *result = push_fancy_stringfv(arena, 0, fore, fancy_pass_through(), format, args);
va_end(args);
return(result);
}
static Fancy_String*
push_fancy_stringf(Arena *arena, char *format, ...){
va_list args;
va_start(args, format);
Fancy_String *result = push_fancy_stringfv(arena, 0, fancy_pass_through(), fancy_pass_through(), format, args);
va_end(args);
return(result);
}
static Fancy_String_List
fancy_string_list_single(Fancy_String *fancy_string){
Fancy_String_List list = {};
list.first = fancy_string;
list.last = fancy_string;
return(list);
}
static Vec2_f32
draw_fancy_string(Application_Links *app, Face_ID font_id, Fancy_String *string,
Vec2_f32 P, int_color fore, int_color back, u32 flags, Vec2_f32 dP){
function f32
get_fancy_string_width__inner(Application_Links *app, Face_ID face,
Fancy_String *string){
f32 result = 0.f;
for (;string != 0;
string = string->next){
Face_ID use_font_id = (string->font_id) ? string->font_id : font_id;
int_color use_fore = is_valid(string->fore) ? int_color_from(app, string->fore) : fore;
f32 adv = get_string_advance(app, use_font_id, string->value);
// TODO(casey): need to fill the background here, but I don't know the line
// height, and I can't actually render filled shapes, so, like, I can't
// properly do dP :(
Face_Metrics metrics = get_face_metrics(app, font_id);
P += (string->pre_margin*metrics.normal_advance)*dP;
draw_string_oriented(app, use_font_id, string->value, P, use_fore, flags, dP);
P += (adv + string->post_margin*metrics.normal_advance)*dP;
Face_ID use_face = face;
if (string->face != 0){
use_face = string->face;
}
if (use_face != 0){
result += get_string_advance(app, use_face, string->value);
Face_Metrics metrics = get_face_metrics(app, use_face);
f32 normal_advance = metrics.normal_advance;
result += (string->pre_margin + string->post_margin)*normal_advance;
}
}
return(P);
return(result);
}
static Vec2_f32
draw_fancy_string(Application_Links *app, Face_ID font_id, Fancy_String *string,
Vec2_f32 P, int_color fore, int_color back){
return(draw_fancy_string(app, font_id, string, P, fore, back, 0, V2(1.f, 0.f)));
}
static f32
get_fancy_string_advance(Application_Links *app, Face_ID font_id, Fancy_String *string){
f32 advance = 0.f;
function f32
get_fancy_string_height__inner(Application_Links *app, Face_ID face,
Fancy_String *string){
f32 result = 0.f;
if (face != 0){
Face_Metrics metrics = get_face_metrics(app, face);
result = metrics.line_height;
}
for (;string != 0;
string = string->next){
Face_ID use_font_id = (string->font_id) ? string->font_id : font_id;
f32 adv = get_string_advance(app, use_font_id, string->value);
Face_Metrics metrics = get_face_metrics(app, font_id);
advance += (string->pre_margin + string->post_margin)*metrics.normal_advance + adv;
if (string->face != 0){
Face_ID use_face = string->face;
Face_Metrics metrics = get_face_metrics(app, use_face);
result = max(result, metrics.line_height);
}
}
return(advance);
return(result);
}
static void
draw_rectangle_fancy(Application_Links *app, Rect_f32 rect, Fancy_Color fancy_color){
int_color color = int_color_from(app, fancy_color);
draw_rectangle(app, rect, 0.f, color);
function Vec2_f32
draw_fancy_string__inner(Application_Links *app, Face_ID face, FColor fore,
Fancy_String *string, Vec2_f32 p, u32 flags, Vec2_f32 delta){
for (;string != 0;
string = string->next){
Face_ID use_face = face;
if (string->face != 0){
use_face = string->face;
}
FColor use_fore = fore;
if (fcolor_is_valid(string->fore)){
use_fore = string->fore;
}
if (use_face != 0){
Face_Metrics metrics = get_face_metrics(app, use_face);
if (fcolor_is_valid(use_fore)){
Vec2_f32 margin_delta = delta*metrics.normal_advance;
p += margin_delta*string->pre_margin;
p = draw_string_oriented(app, use_face, use_fore,
string->value, p, flags, delta);
p += margin_delta*string->post_margin;
}
else{
f32 adv =
(string->pre_margin + string->post_margin)*metrics.normal_advance;
adv += get_string_advance(app, use_face, string->value);
p += adv*delta;
}
}
}
return(p);
}
function f32
get_fancy_string_width(Application_Links *app, Face_ID face,
Fancy_String *string){
Fancy_String *next = string->next;
string->next = 0;
f32 result = get_fancy_string_width__inner(app, face, string);
string->next = next;
return(result);
}
function f32
get_fancy_string_height(Application_Links *app, Face_ID face,
Fancy_String *string){
Fancy_String *next = string->next;
string->next = 0;
f32 result = get_fancy_string_height__inner(app, face, string);
string->next = next;
return(result);
}
function Vec2_f32
draw_fancy_string(Application_Links *app, Face_ID face, FColor fore,
Fancy_String *string, Vec2_f32 p, u32 flags, Vec2_f32 delta){
Fancy_String *next = string->next;
string->next = 0;
Vec2_f32 result = draw_fancy_string__inner(app, face, fore,
string, p, flags, delta);
string->next = next;
return(result);
}
function f32
get_fancy_line_width(Application_Links *app, Face_ID face, Fancy_Line *line){
if (line->face != 0){
face = line->face;
}
return(get_fancy_string_width__inner(app, face, line->first));
}
function f32
get_fancy_line_height(Application_Links *app, Face_ID face, Fancy_Line *line){
if (line->face != 0){
face = line->face;
}
return(get_fancy_string_height__inner(app, face, line->first));
}
function Vec2_f32
draw_fancy_line(Application_Links *app, Face_ID face, FColor fore,
Fancy_Line *line, Vec2_f32 p, u32 flags, Vec2_f32 delta){
if (line->face != 0){
face = line->face;
}
if (fcolor_is_valid(line->fore)){
fore = line->fore;
}
return(draw_fancy_string__inner(app, face, fore,
line->first, p, flags, delta));
}
function f32
get_fancy_block_width(Application_Links *app, Face_ID face, Fancy_Block *block){
f32 width = 0.f;
for (Fancy_Line *node = block->first;
node != 0;
node = node->next){
f32 w = get_fancy_line_width(app, face, node);
width = max(width, w);
}
return(width);
}
function f32
get_fancy_block_height(Application_Links *app, Face_ID face, Fancy_Block *block){
f32 height = 0.f;
for (Fancy_Line *node = block->first;
node != 0;
node = node->next){
height += get_fancy_line_height(app, face, node);
}
return(height);
}
function Vec2_f32
get_fancy_block_dim(Application_Links *app, Face_ID face, Fancy_Block *block){
Vec2_f32 result = {};
result.x = get_fancy_block_width(app, face, block);
result.y = get_fancy_block_height(app, face, block);
return(result);
}
function void
draw_fancy_block(Application_Links *app, Face_ID face, FColor fore,
Fancy_Block *block, Vec2_f32 p, u32 flags, Vec2_f32 delta){
Face_Metrics metrics = get_face_metrics(app, face);
for (Fancy_Line *node = block->first;
node != 0;
node = node->next){
draw_fancy_line(app, face, fore, node, p, flags, delta);
p.y += get_fancy_line_height(app, face, node);
}
}
function Vec2_f32
draw_fancy_string(Application_Links *app, Face_ID face, FColor fore,
Fancy_String *string, Vec2_f32 p){
return(draw_fancy_string(app, face, fore, string, p, 0, V2f32(1.f, 0.f)));
}
function Vec2_f32
draw_fancy_line(Application_Links *app, Face_ID face, FColor fore,
Fancy_Line *line, Vec2_f32 p){
return(draw_fancy_line(app, face, fore, line, p, 0, V2f32(1.f, 0.f)));
}
function void
draw_fancy_block(Application_Links *app, Face_ID face, FColor fore,
Fancy_Block *block, Vec2_f32 p){
draw_fancy_block(app, face, fore, block, p, 0, V2f32(1.f, 0.f));
}
////////////////////////////////
// TODO(allen): beta: color palette
global Fancy_Color white = fancy_rgba(1.0f, 1.0f, 1.0f, 1.0f);
global Fancy_Color light_gray = fancy_rgba(0.7f, 0.7f, 0.7f, 1.0f);
global Fancy_Color gray = fancy_rgba(0.5f, 0.5f, 0.5f, 1.0f);
global Fancy_Color dark_gray = fancy_rgba(0.3f, 0.3f, 0.3f, 1.0f);
global Fancy_Color black = fancy_rgba(0.0f, 0.0f, 0.0f, 1.0f);
global Fancy_Color pink = fancy_rgba(1.0f, 0.0f, 1.0f, 1.0f);
global Fancy_Color green = fancy_rgba(0.0f, 1.0f, 0.0f, 1.0f);
global FColor f_white = fcolor_argb(1.0f, 1.0f, 1.0f, 1.0f);
global FColor f_light_gray = fcolor_argb(0.7f, 0.7f, 0.7f, 1.0f);
global FColor f_gray = fcolor_argb(0.5f, 0.5f, 0.5f, 1.0f);
global FColor f_dark_gray = fcolor_argb(0.3f, 0.3f, 0.3f, 1.0f);
global FColor f_black = fcolor_argb(0.0f, 0.0f, 0.0f, 1.0f);
global FColor f_pink = fcolor_argb(1.0f, 0.0f, 1.0f, 1.0f);
global FColor f_green = fcolor_argb(0.0f, 1.0f, 0.0f, 1.0f);
// BOTTOM

View File

@ -1,50 +0,0 @@
/*
* Fancy string - immediate mode renderer for colored strings
*/
// TOP
#if !defined(FCODER_FANCY_H)
#define FCODER_FANCY_H
struct Fancy_Color{
union{
struct{
id_color index_a;
id_color index_b;
};
u32 rgba;
};
union{
struct{
u8 table_a;
u8 table_b;
u8 c_a;
u8 c_b;
};
u32 code;
};
};
struct Fancy_String{
Fancy_String *next;
String_Const_u8 value;
Face_ID font_id;
Fancy_Color fore;
Fancy_Color back;
f32 pre_margin;
f32 post_margin;
};
struct Fancy_String_List{
Fancy_String *first;
Fancy_String *last;
};
#endif
// BOTTOM

View File

@ -186,15 +186,14 @@ lister_render(Application_Links *app, Frame_Info frame_info, View_ID view){
}
{
Fancy_String_List text_field = {};
push_fancy_string(scratch, &text_field, fancy_id(Stag_Pop1),
Fancy_Line text_field = {};
push_fancy_string(scratch, &text_field, fcolor_id(Stag_Pop1),
lister->query.string);
push_fancy_stringf(scratch, &text_field, fancy_id(Stag_Pop1), " ");
push_fancy_string(scratch, &text_field, fancy_id(Stag_Default),
push_fancy_stringf(scratch, &text_field, " ");
push_fancy_string(scratch, &text_field, fcolor_id(Stag_Default),
lister->text_field.string);
draw_fancy_string(app, face_id, text_field.first,
V2f32(text_field_rect.x0 + 3.f, text_field_rect.y0),
Stag_Default, Stag_Back, 0, V2f32(1.f, 0.f));
draw_fancy_line(app, face_id, fcolor_zero(), &text_field,
V2f32(text_field_rect.x0 + 3.f, text_field_rect.y0));
}
Range_f32 x = rect_range_x(list_rect);
@ -272,15 +271,15 @@ lister_render(Application_Links *app, Frame_Info frame_info, View_ID view){
}
draw_rectangle(app, item_rect, 6.f, get_margin_color(highlight));
draw_rectangle(app, item_inner, 6.f, Stag_Back);
draw_rectangle(app, item_inner, 6.f, fcolor_id(Stag_Back));
Fancy_String_List line = {};
push_fancy_string(scratch, &line, fancy_id(Stag_Default), node->string);
push_fancy_stringf(scratch, &line, fancy_id(Stag_Default), " ");
push_fancy_string(scratch, &line, fancy_id(Stag_Pop2), node->status);
Fancy_Line line = {};
push_fancy_string(scratch, &line, fcolor_id(Stag_Default), node->string);
push_fancy_stringf(scratch, &line, " ");
push_fancy_string(scratch, &line, fcolor_id(Stag_Pop2), node->status);
Vec2_f32 p = V2f32(item_inner.x0 + 3.f, item_inner.y0 + (block_height - line_height)*0.5f);
draw_fancy_string(app, face_id, line.first, p, Stag_Default, 0, 0, V2(1.f, 0.f));
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);
}
draw_set_clip(app, prev_clip);

View File

@ -646,19 +646,20 @@ log_parse_fill(Application_Links *app, Buffer_ID buffer){
}
internal void
log_graph_render__tag(Arena *arena, Fancy_String_List *line, Log_Parse *log, Log_Tag *tag){
log_graph_render__tag(Arena *arena, Fancy_Line *line,
Log_Parse *log, Log_Tag *tag){
String_Const_u8 tag_name = log_parse__get_string(log, tag->name);
push_fancy_stringf(arena, line, white, "[");
push_fancy_string(arena, line, green, tag_name);
push_fancy_stringf(arena, line, white, "=");
push_fancy_stringf(arena, line, f_white, "[");
push_fancy_string(arena, line, f_green, tag_name);
push_fancy_stringf(arena, line, f_white, "=");
if (tag->value.kind == LogTagKind_Integer){
push_fancy_stringf(arena, line, pink, "0x%llx", tag->value.value_s);
push_fancy_stringf(arena, line, f_pink, "0x%llx", tag->value.value_s);
}
else if (tag->value.kind == LogTagKind_String){
String_Const_u8 value = log_parse__get_string(log, tag->value.value);
push_fancy_string(arena, line, pink, value);
push_fancy_string(arena, line, f_pink, value);
}
push_fancy_stringf(arena, line, white, "]");
push_fancy_stringf(arena, line, f_white, "]");
}
internal void
@ -671,8 +672,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, Stag_Back);
get_margin_color(is_active_view?
UIHighlight_Active:UIHighlight_None));
draw_rectangle(app, inner, 0.f, fcolor_id(Stag_Back));
Rect_f32 prev_clip = draw_set_clip(app, inner);
////////////////////////////////
@ -710,23 +712,23 @@ log_graph_render(Application_Links *app, Frame_Info frame_info, View_ID view){
Rect_f32 box_inner = rect_inner(box, 3.f);
Fancy_Color margin_color = dark_gray;
FColor margin_color = f_dark_gray;
if (!in_details_region && hover_event == 0 && rect_contains_point(box, m_p)){
margin_color = gray;
margin_color = f_gray;
hover_event = box_node->event;
}
if (box_node->event == log_graph.selected_event){
margin_color = light_gray;
margin_color = f_light_gray;
}
draw_rectangle_fancy(app, box , margin_color);
draw_rectangle_fancy(app, box_inner, black );
draw_rectangle(app, box , 0.f, margin_color);
draw_rectangle(app, box_inner, 0.f, f_black );
Log_Event *event = box_node->event;
String_Const_u8 event_name = log_parse__get_string(&log_parse, event->event_name);
Fancy_String_List line = {};
push_fancy_string(scratch, &line, white, event_name);
Fancy_Line line = {};
push_fancy_string(scratch, &line, f_white, event_name);
for (Log_Filter *filter = log_preview_set.first;
filter != 0;
@ -745,7 +747,7 @@ log_graph_render(Application_Links *app, Frame_Info frame_info, View_ID view){
Vec2_f32 p = V2f32(box_inner.x0 + 3.f,
(f32_round32((box_inner.y0 + box_inner.y1 - line_height)*0.5f)));
draw_fancy_string(app, log_graph.face_id, line.first, p, 0, 0, 0, V2f32(1.f, 0.f));
draw_fancy_line(app, log_graph.face_id, fcolor_zero(), &line, p);
}
{
@ -757,8 +759,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_fancy(app, box , dark_gray);
draw_rectangle_fancy(app, box_inner, black );
draw_rectangle(app, box , 0.f, f_dark_gray);
draw_rectangle(app, box_inner, 0.f, f_black );
{
f32 y_cursor = box_inner.y0 + 3.f;
@ -767,8 +769,8 @@ log_graph_render(Application_Links *app, Frame_Info frame_info, View_ID view){
{
f32 x_cursor = box_inner.x0 + 3.f;
for (i32 i = LogTab_ERROR + 1; i < LogTab_COUNT; i += 1){
Fancy_Color color = (i == current_tab)?white:gray;
Fancy_String_List line = {};
FColor color = (i == current_tab)?f_white:f_gray;
Fancy_Line line = {};
switch (i){
case LogTab_Filters:
{
@ -781,13 +783,15 @@ log_graph_render(Application_Links *app, Frame_Info frame_info, View_ID view){
}
Vec2_f32 p = V2f32(x_cursor, y_cursor);
f32 advance = get_fancy_string_advance(app, log_graph.face_id, line.first);
draw_fancy_string(app, log_graph.face_id, line.first, p,
Stag_Default, Stag_Back, 0, V2f32(1.f, 0.f));
x_cursor += advance + metrics.normal_advance;
f32 width = get_fancy_line_width(app, log_graph.face_id,
&line);
draw_fancy_line(app, log_graph.face_id, fcolor_zero(),
&line, p);
x_cursor += width + metrics.normal_advance;
if (log_graph.has_unused_click){
Rect_f32 click_rect = Rf32(p.x, p.y, p.x + advance, p.y + line_height);
Rect_f32 click_rect = Rf32_xy_wh(p.x, p.y,
width, line_height);
if (rect_contains_point(click_rect, log_graph.unused_click)){
log_graph.has_unused_click = false;
log_graph.tab = i;
@ -805,36 +809,38 @@ log_graph_render(Application_Links *app, Frame_Info frame_info, View_ID view){
y_cursor += line_height;
if (y_cursor + line_height > box_inner.y1) goto finish_list_display;
Fancy_String_List line = {};
Fancy_Line line = {};
if (filter->kind == LogFilter_TagValue){
push_fancy_stringf(scratch, &line, white, "val [");
push_fancy_stringf(scratch, &line, f_white, "val [");
String_Const_u8 tag_name = log_parse__get_string(&log_parse, filter->tag_name_code);
push_fancy_stringf(scratch, &line, green, "%.*s", string_expand(tag_name));
push_fancy_stringf(scratch, &line, white, "=");
push_fancy_stringf(scratch, &line, f_green, "%.*s", string_expand(tag_name));
push_fancy_stringf(scratch, &line, f_white, "=");
if (filter->tag_value.kind == LogTagKind_Integer){
push_fancy_stringf(scratch, &line, pink, "0x%llx", filter->tag_value.value_s);
push_fancy_stringf(scratch, &line, f_pink, "0x%llx", filter->tag_value.value_s);
}
else if (filter->tag_value.kind == LogTagKind_String){
String_Const_u8 value = log_parse__get_string(&log_parse, filter->tag_value.value);
push_fancy_stringf(scratch, &line, pink, "%.*s", string_expand(value));
push_fancy_stringf(scratch, &line, f_pink, "%.*s", string_expand(value));
}
push_fancy_stringf(scratch, &line, white, "]");
push_fancy_stringf(scratch, &line, f_white, "]");
}
else{
push_fancy_stringf(scratch, &line, white, "name [");
push_fancy_stringf(scratch, &line, f_white, "name [");
String_Const_u8 tag_name = log_parse__get_string(&log_parse, filter->tag_name_code);
push_fancy_stringf(scratch, &line, green, "%.*s", string_expand(tag_name));
push_fancy_stringf(scratch, &line, white, "]");
push_fancy_stringf(scratch, &line, f_green, "%.*s", string_expand(tag_name));
push_fancy_stringf(scratch, &line, f_white, "]");
}
Vec2_f32 p = V2f32(box_inner.x0 + 3.f, y_cursor);
f32 advance = get_fancy_string_advance(app, log_graph.face_id, line.first);
draw_fancy_string(app, log_graph.face_id, line.first, p, Stag_Default, Stag_Back,
0, V2f32(1.f, 0.f));
f32 width = get_fancy_line_width(app, log_graph.face_id,
&line);
draw_fancy_line(app, log_graph.face_id, fcolor_zero(),
&line, p);
if (log_graph.has_unused_click){
Rect_f32 click_rect = Rf32(p.x, p.y, p.x + advance, p.y + line_height);
Rect_f32 click_rect = Rf32_xy_wh(p.x, p.y,
width, line_height);
if (rect_contains_point(click_rect, log_graph.unused_click)){
log_graph.has_unused_click = false;
log_filter_set__free_filter(viewing_filter_set, filter);
@ -852,17 +858,16 @@ log_graph_render(Application_Links *app, Frame_Info frame_info, View_ID view){
if (y_cursor + line_height > box_inner.y1) goto finish_event_display;
{
Fancy_String_List line = {};
Fancy_Line line = {};
String_Const_u8 file_name = log_parse__get_string(&log_parse, view_event->src_file_name);
push_fancy_stringf(scratch, &line, green, "[%d] ", view_event->event_number);
push_fancy_stringf(scratch, &line, white, "%.*s:", string_expand(file_name));
push_fancy_stringf(scratch, &line, pink, "%llu", view_event->line_number);
push_fancy_stringf(scratch, &line, f_green, "[%d] ", view_event->event_number);
push_fancy_stringf(scratch, &line, f_white, "%.*s:", string_expand(file_name));
push_fancy_stringf(scratch, &line, f_pink, "%llu", view_event->line_number);
Vec2_f32 right_p = V2f32(box_inner.x1 - 3.f, y_cursor);
f32 advance = get_fancy_string_advance(app, log_graph.face_id, line.first);
Vec2 p = V2f32(right_p.x - advance, right_p.y);
draw_fancy_string(app, log_graph.face_id, line.first, p, Stag_Default, Stag_Back,
0, V2(1.f, 0.f));
f32 width = get_fancy_line_width(app, log_graph.face_id, &line);
Vec2 p = V2f32(right_p.x - width, right_p.y);
draw_fancy_line(app, log_graph.face_id, fcolor_zero(), &line, p);
}
for (Log_Tag *tag = view_event->first_tag;
@ -872,14 +877,14 @@ log_graph_render(Application_Links *app, Frame_Info frame_info, View_ID view){
if (y_cursor + line_height > box_inner.y1) goto finish_event_display;
{
Fancy_String_List line = {};
Fancy_Line line = {};
log_graph_render__tag(scratch, &line, &log_parse, tag);
Vec2_f32 right_p = V2f32(box_inner.x1 - 3.f, y_cursor);
f32 advance = get_fancy_string_advance(app, log_graph.face_id, line.first);
Vec2 p = V2f32(right_p.x - advance, right_p.y);
draw_fancy_string(app, log_graph.face_id, line.first, p,
Stag_Default, Stag_Back, 0, V2(1.f, 0.f));
f32 width = get_fancy_line_width(app, log_graph.face_id, &line);
Vec2 p = V2f32(right_p.x - width, right_p.y);
draw_fancy_line(app, log_graph.face_id, fcolor_zero(),
&line, p);
if (log_graph.has_unused_click){
Rect_f32 click_rect = Rf32(p.x, p.y, right_p.x, p.y + line_height);

View File

@ -179,28 +179,25 @@ profile_draw_tab(Application_Links *app, Tab_State *state, Profile_Inspection *i
state->p.x += state->x_half_padding;
Fancy_String_List list = {};
push_fancy_string(scratch, &list, fancy_pass_through(), string);
Fancy_String *fstring = push_fancy_string(scratch, 0, string);
b32 hover = false;
f32 width = get_fancy_string_advance(app, state->face_id, list.first);
f32 width = get_fancy_string_width(app, state->face_id, fstring);
Rect_f32 box = Rf32(If32_size(state->p.x, width), state->tabs_y);
if (rect_contains_point(box, state->m_p)){
hover = true;
insp->tab_id_hovered = tab_id;
}
int_color text = Stag_Default;
int_color back = 0;
FColor text = fcolor_id(Stag_Default);
if (insp->tab_id == tab_id){
text = Stag_Pop2;
text = fcolor_id(Stag_Pop2);
}
else if (hover){
text = Stag_Pop1;
text = fcolor_id(Stag_Pop1);
}
Vec2_f32 np = draw_fancy_string(app, state->face_id, list.first, state->p,
text, back);
Vec2_f32 np = draw_fancy_string(app, state->face_id, text, fstring, state->p);
state->p = np;
state->p.x += state->x_half_padding;
}
@ -261,8 +258,9 @@ 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;
int_color colors[] = {
Stag_Back_Cycle_1, Stag_Back_Cycle_2, Stag_Back_Cycle_3, Stag_Back_Cycle_4,
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),
};
Scratch_Block scratch(app);
@ -274,22 +272,22 @@ 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_List list = {};
push_fancy_string(scratch, &list, fancy_id(Stag_Pop1), thread_name);
Fancy_String *fstr =
push_fancy_string(scratch, 0, fcolor_id(Stag_Pop1), thread_name);
Vec2_f32 p = V2f32(x_pos, y.min + 1.f);
draw_fancy_string(app, face_id, list.first, p, 0, 0);
f32 w = get_fancy_string_advance(app, face_id, list.first);
draw_fancy_string(app, face_id, fcolor_zero(), fstr, p);
f32 w = get_fancy_string_width(app, face_id, fstr);
nav_bar_w = max(nav_bar_w, w);
}
y.min += line_height + 2.f;
String_Const_u8 name = profile_node_name(node);
if (name.size > 0){
Fancy_String_List list = {};
push_fancy_string(scratch, &list, fancy_id(Stag_Default), name);
Fancy_String *fstr =
push_fancy_string(scratch, 0, fcolor_id(Stag_Default), name);
Vec2_f32 p = V2f32(x_pos, y.min + 1.f);
draw_fancy_string(app, face_id, list.first, p, 0, 0);
f32 w = get_fancy_string_advance(app, face_id, list.first);
draw_fancy_string(app, face_id, fcolor_zero(), fstr, p);
f32 w = get_fancy_string_width(app, face_id, fstr);
nav_bar_w = max(nav_bar_w, w);
}
y.min += line_height + 2.f;
@ -298,24 +296,22 @@ profile_draw_node(Application_Links *app, View_ID view, Face_ID face_id,
x_pos += nav_bar_w + x_half_padding;
if (node->parent != 0){
Fancy_String_List list = {};
push_fancy_string(scratch, &list, fancy_pass_through(),
string_u8_litexpr("to parent"));
f32 w = get_fancy_string_advance(app, face_id, list.first) + x_padding;
Fancy_String *fstr = push_fancy_string(scratch, 0, fcolor_zero(),
string_u8_litexpr("to parent"));
f32 w = get_fancy_string_width(app, face_id, fstr) + x_padding;
Range_f32 btn_x = If32_size(x_pos, w);
Rect_f32 box = Rf32(btn_x, nav_bar_y);
int_color color = Stag_Default;
FColor color = fcolor_id(Stag_Default);
if (rect_contains_point(box, m_p)){
draw_rectangle(app, box, 0.f, Stag_Margin);
color = Stag_Pop1;
draw_rectangle(app, box, 0.f, fcolor_id(Stag_Margin));
color = fcolor_id(Stag_Pop1);
insp->hover_node = node->parent;
}
Vec2_f32 p = V2f32(box.x0 + x_half_padding,
(box.y0 + box.y1 - line_height)*0.5f);
draw_fancy_string(app, face_id, list.first, p, color, 0);
draw_fancy_string(app, face_id, color, fstr, p);
x_pos = btn_x.max;
}
@ -326,8 +322,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,
0xFFFFFFFF);
draw_rectangle_outline(app, time_slice_box, 0.f, 3.f, f_white);
time_slice_box = rect_inner(time_slice_box, 3.f);
if (node->closed){
@ -371,12 +366,11 @@ profile_draw_node(Application_Links *app, View_ID view, Face_ID face_id,
// NOTE(allen): duration
{
f32 duration = ((f32)range_size(node->time))/1000000.f;
Fancy_String_List list = {};
push_fancy_stringf(scratch, &list, fancy_id(Stag_Default),
Fancy_Line list = {};
push_fancy_stringf(scratch, &list, fcolor_id(Stag_Default),
"time: %11.9f", duration);
draw_fancy_string(app, face_id, list.first,
V2f32(x_pos, y_pos + 1.f),
0, 0);
draw_fancy_line(app, face_id, fcolor_zero(),
&list, V2f32(x_pos, y_pos + 1.f));
y_pos += line_height + 2.f;
}
}
@ -404,14 +398,13 @@ 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_List text = {};
push_fancy_string(scratch, &text, fancy_id(Stag_Pop2),
string_u8_litexpr("no profile data"));
f32 width = get_fancy_string_advance(app, face_id, text.first);
Fancy_String *fstr = push_fancy_string(scratch, 0, fcolor_id(Stag_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;
Vec2_f32 half_dim = V2f32(width, line_height)*0.5f;
Vec2_f32 p = view_center - half_dim;
draw_fancy_string(app, face_id, text.first, p, Stag_Default, 0);
draw_fancy_string(app, face_id, fcolor_zero(), fstr, p);
}
else{
Rect_f32_Pair tabs_body = rect_split_top_bottom(region, line_height + 2.f);
@ -436,7 +429,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, Stag_Margin_Hover);
draw_rectangle(app, tabs_body.min, 0.f, fcolor_id(Stag_Margin_Hover));
if (inspect->tab_id == ProfileInspectTab_None){
inspect->tab_id = ProfileInspectTab_Threads;
@ -497,26 +490,26 @@ profile_render(Application_Links *app, Frame_Info frame_info, View_ID view){
for (i32 i = 0; i < count; i += 1, thread += 1){
Range_f32 y = If32_size(y_pos, block_height);
Fancy_String_List list = {};
push_fancy_stringf(scratch, &list, fancy_id(Stag_Pop1),
Fancy_Line list = {};
push_fancy_stringf(scratch, &list, fcolor_id(Stag_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, fancy_id(Stag_Pop2),
push_fancy_stringf(scratch, &list, fcolor_id(Stag_Pop2),
"active time %11.9f",
active_time);
Vec2_f32 p = V2f32(x.min + x_half_padding,
(y.min + y.max - line_height)*0.5f);
draw_fancy_string(app, face_id, list.first, p, 0, 0);
draw_fancy_line(app, face_id, fcolor_zero(), &list, p);
Rect_f32 box = Rf32(x, y);
int_color margin = Stag_Margin;
FColor margin = fcolor_id(Stag_Margin);
if (rect_contains_point(box, m_p)){
inspect->hover_thread = thread;
margin = Stag_Margin_Hover;
margin = fcolor_id(Stag_Margin_Hover);
}
draw_rectangle_outline(app, box, 6.f, 3.f, margin);
@ -535,46 +528,45 @@ profile_render(Application_Links *app, Frame_Info frame_info, View_ID view){
b32 name_too_long = false;
i32 name_width = 45;
Fancy_String_List list = {};
Fancy_Line list = {};
if (node->name.size > name_width){
push_fancy_stringf(scratch, &list, fancy_id(Stag_Pop1),
push_fancy_stringf(scratch, &list, fcolor_id(Stag_Pop1),
"%.*s... ",
name_width - 3, node->name.str);
name_too_long = true;
}
else{
push_fancy_stringf(scratch, &list, fancy_id(Stag_Pop1),
push_fancy_stringf(scratch, &list, fcolor_id(Stag_Pop1),
"%-*.*s ",
name_width,
string_expand(node->name));
name_width, string_expand(node->name));
}
if (node->corrupted_time){
push_fancy_string(scratch, &list, fancy_id(Stag_Pop2),
push_fancy_string(scratch, &list, fcolor_id(Stag_Pop2),
string_u8_litexpr("timing error "));
}
else{
push_fancy_stringf(scratch, &list, fancy_id(Stag_Pop2),
push_fancy_stringf(scratch, &list, fcolor_id(Stag_Pop2),
"%11.9fs ",
((f32)node->total_time)/1000000.f);
}
push_fancy_stringf(scratch, &list, fancy_id(Stag_Keyword),
push_fancy_stringf(scratch, &list, fcolor_id(Stag_Keyword),
"hit # %5d", node->hit_count);
Vec2_f32 p = V2f32(x.min + x_half_padding,
(y.min + y.max - line_height)*0.5f);
draw_fancy_string(app, face_id, list.first, p, 0, 0);
draw_fancy_line(app, face_id, fcolor_zero(), &list, p);
Rect_f32 box = Rf32(x, y);
int_color margin = Stag_Margin;
FColor margin = fcolor_id(Stag_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 = Stag_Margin_Hover;
margin = fcolor_id(Stag_Margin_Hover);
}
draw_rectangle_outline(app, box, 6.f, 3.f, margin);
@ -592,19 +584,19 @@ profile_render(Application_Links *app, Frame_Info frame_info, View_ID view){
node = node->next){
Range_f32 y = If32_size(y_pos, block_height);
Fancy_String_List list = {};
push_fancy_string(scratch, &list, fancy_id(Stag_Pop2),
Fancy_Line list = {};
push_fancy_string(scratch, &list, fcolor_id(Stag_Pop2),
node->message);
Vec2_f32 p = V2f32(x.min + x_half_padding,
(y.min + y.max - line_height)*0.5f);
draw_fancy_string(app, face_id, list.first, p, 0, 0);
draw_fancy_line(app, face_id, fcolor_zero(), &list, p);
Rect_f32 box = Rf32(x, y);
int_color margin = Stag_Margin;
FColor margin = fcolor_id(Stag_Margin);
if (rect_contains_point(box, m_p)){
inspect->location_jump_hovered = node->location;
margin = Stag_Margin_Hover;
margin = fcolor_id(Stag_Margin_Hover);
}
draw_rectangle_outline(app, box, 6.f, 3.f, margin);
@ -637,44 +629,31 @@ profile_render(Application_Links *app, Frame_Info frame_info, View_ID view){
// NOTE(allen): no tool tip for tabs
}
else{
i32 line_count = 0;
Fancy_String_List list[2] = {};
Fancy_Color color = fancy_rgba(1.f, 1.f, 1.f, 0.5f);
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);
f32 width = 0.f;
if (inspect->full_name_hovered.size > 0){
line_count += 1;
push_fancy_stringf(scratch, &list[0], color, "%.*s",
Fancy_Line *line = push_fancy_line(scratch, &block);
push_fancy_stringf(scratch, line, text_color, "%.*s",
string_expand(inspect->full_name_hovered));
f32 l_width = get_fancy_string_advance(app, face_id, list[0].first);
width = max(width, l_width);
}
if (inspect->location_jump_hovered.size > 0){
line_count += 1;
push_fancy_stringf(scratch, &list[1], color, "[shift] '%.*s'",
Fancy_Line *line = push_fancy_line(scratch, &block);
push_fancy_stringf(scratch, line, text_color, "[shift] '%.*s'",
string_expand(inspect->location_jump_hovered));
f32 l_width = get_fancy_string_advance(app, face_id, list[1].first);
width = max(width, l_width);
}
if (line_count > 0){
Vec2_f32 dims = V2f32(width + x_padding, line_count*line_height + 2.f);
if (block.line_count > 0){
Vec2_f32 dims = get_fancy_block_dim(app, face_id, &block);
dims += V2f32(x_padding, 2.f);
Rect_f32 box = get_tool_tip_box(region, m_p, dims);
draw_set_clip(app, box);
draw_rectangle(app, box, 6.f, 0x80000000);
f32 y = box.y0 + 1.f;
if (inspect->full_name_hovered.size > 0){
draw_fancy_string(app, face_id, list[0].first,
V2f32(box.x0 + x_half_padding, y),
0, 0);
y += line_height;
}
if (inspect->location_jump_hovered.size > 0){
draw_fancy_string(app, face_id, list[1].first,
V2f32(box.x0 + x_half_padding, y),
0, 0);
}
draw_rectangle(app, box, 6.f, back_color);
draw_fancy_block(app, face_id, fcolor_zero(), &block,
V2f32(box.x0 + x_half_padding, box.y0 + 1.f));
}
}
}

View File

@ -18,21 +18,73 @@ typedef Custom_Layer_Init_Type *_Init_APIs_Type(struct API_VTable_custom *custom
////////////////////////////////
typedef u32 argb_color;
typedef u16 ID_Color;
union FColor{
struct{
u8 padding__[3];
u8 a_byte;
};
ARGB_Color argb;
struct{
ID_Color id;
u16 padding_;
};
};
typedef u32 int_color;
struct Theme_Color{
ID_Color tag;
ARGB_Color color;
};
typedef u16 id_color;
//struct Theme{
//ARGB_Color colors[Stag_COUNT];
//};
typedef u32 Child_Process_ID;
struct Color_Table{
ARGB_Color *vals;
u32 count;
};
struct Color_Picker{
String_Const_u8 title;
ARGB_Color *dest;
b32 *finished;
};
////////////////////////////////
typedef u32 Face_ID;
struct Fancy_String{
Fancy_String *next;
String_Const_u8 value;
Face_ID face;
FColor fore;
f32 pre_margin;
f32 post_margin;
};
struct Fancy_Line{
Fancy_Line *next;
Face_ID face;
FColor fore;
Fancy_String *first;
Fancy_String *last;
};
struct Fancy_Block{
Fancy_Line *first;
Fancy_Line *last;
i32 line_count;
};
////////////////////////////////
typedef i32 Buffer_ID;
typedef i32 View_ID;
typedef i32 Panel_ID;
typedef u32 Text_Layout_ID;
typedef u32 Child_Process_ID;
typedef i32 UI_Highlight_Level;
enum{
@ -375,17 +427,6 @@ struct Query_Bar_Group{
~Query_Bar_Group();
};
struct Theme_Color{
id_color tag;
argb_color color;
};
//struct Theme{
//int_color colors[Stag_COUNT];
//};
typedef u32 Face_ID;
struct Font_Load_Location{
String_Const_u8 file_name;
b32 in_4coder_font_folder;
@ -533,11 +574,6 @@ Vec2_f32 name(Vec2_f32 pending, b32 is_new_target, f32 dt, void *data)
typedef Rect_f32 Buffer_Region_Function(Application_Links *app, View_ID view_id, Rect_f32 region);
struct Color_Table{
argb_color *vals;
u32 count;
};
typedef void New_Clipboard_Contents_Function(Application_Links *app, String_Const_u8 contents);
#define NEW_CLIPBOARD_CONTENTS_SIG(name) \
void name(Application_Links *app, String_Const_u8 contents)
@ -600,12 +636,6 @@ struct View_Context{
Command_Map_ID map_id;
};
struct Color_Picker{
String_Const_u8 title;
argb_color *dest;
b32 *finished;
};
typedef u32 String_Match_Flag;
enum{
StringMatch_CaseSensitive = 1,

View File

@ -346,12 +346,12 @@ static Command_Metadata fcoder_metacmd_table[211] = {
{ PROC_LINKS(kill_buffer, 0), false, "kill_buffer", 11, "Kills the current buffer.", 25, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1579 },
{ PROC_LINKS(save, 0), false, "save", 4, "Saves the current buffer.", 25, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1587 },
{ 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, 1597 },
{ 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, 1826 },
{ 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, 1839 },
{ 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, 1853 },
{ 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, 1924 },
{ 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, 2025 },
{ 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, 2032 },
{ 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, 1822 },
{ 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, 1835 },
{ 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, 1849 },
{ 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, 1920 },
{ 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, 2021 },
{ 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, 2028 },
{ 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, 82 },
{ 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, 93 },
{ 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, 104 },
@ -388,13 +388,13 @@ static Command_Metadata fcoder_metacmd_table[211] = {
{ 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, 104 },
{ 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, 990 },
{ 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(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, 73 },
{ 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, 115 },
{ 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, 122 },
{ 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, 111 },
{ 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, 118 },
{ PROC_LINKS(execute_previous_cli, 0), false, "execute_previous_cli", 20, "If the command execute_any_cli has already been used, this will execute a CLI reusing the most recent buffer name and command.", 126, "w:\\4ed\\code\\custom\\4coder_cli_command.cpp", 41, 7 },
{ PROC_LINKS(execute_any_cli, 0), false, "execute_any_cli", 15, "Queries for an output buffer name and system command, runs the system command as a CLI and prints the output to the specified buffer.", 133, "w:\\4ed\\code\\custom\\4coder_cli_command.cpp", 41, 22 },
{ PROC_LINKS(build_search, 0), false, "build_search", 12, "Looks for a build.bat, build.sh, or makefile in the current and parent directories. Runs the first that it finds and prints the output to *compilation*.", 153, "w:\\4ed\\code\\custom\\4coder_build_commands.cpp", 44, 128 },
@ -441,7 +441,7 @@ static Command_Metadata fcoder_metacmd_table[211] = {
{ 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, 713 },
{ 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, 692 },
{ PROC_LINKS(default_startup, 0), false, "default_startup", 15, "Default command for responding to a startup event", 49, "w:\\4ed\\code\\custom\\4coder_default_hooks.cpp", 43, 7 },
{ PROC_LINKS(default_try_exit, 0), false, "default_try_exit", 16, "Default command for responding to a try-exit event", 50, "w:\\4ed\\code\\custom\\4coder_default_hooks.cpp", 43, 21 },
};

View File

@ -85,10 +85,10 @@
#define custom_view_set_buffer_scroll_sig() b32 custom_view_set_buffer_scroll(Application_Links* app, View_ID view_id, Buffer_Scroll scroll, Set_Buffer_Scroll_Rule rule)
#define custom_view_set_mark_sig() b32 custom_view_set_mark(Application_Links* app, View_ID view_id, Buffer_Seek seek)
#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, int_color color)
#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_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, View_Context* ctx)
#define custom_view_alter_context_sig() b32 custom_view_alter_context(Application_Links* app, View_ID view_id, View_Context* ctx)
#define custom_view_current_context_sig() View_Context custom_view_current_context(Application_Links* app, View_ID view_id)
#define custom_view_current_context_hook_memory_sig() Data custom_view_current_context_hook_memory(Application_Links* app, View_ID view_id, Hook_ID hook_id)
#define custom_create_user_managed_scope_sig() Managed_Scope custom_create_user_managed_scope(Application_Links* app)
@ -146,15 +146,15 @@
#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, int_color color)
#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 custom_draw_string_oriented(Application_Links* app, Face_ID font_id, String_Const_u8 str, Vec2 point, int_color color, u32 flags, Vec2 delta)
#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_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, int_color color)
#define custom_draw_rectangle_outline_sig() void custom_draw_rectangle_outline(Application_Links* app, Rect_f32 rect, f32 roundness, f32 thickness, int_color color)
#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_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)
@ -162,7 +162,7 @@
#define custom_text_layout_get_visible_range_sig() Interval_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, int_color color)
#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_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_open_color_picker_sig() void custom_open_color_picker(Application_Links* app, Color_Picker* picker)
@ -255,10 +255,10 @@ typedef b32 custom_view_set_cursor_type(Application_Links* app, View_ID view_id,
typedef b32 custom_view_set_buffer_scroll_type(Application_Links* app, View_ID view_id, Buffer_Scroll scroll, Set_Buffer_Scroll_Rule rule);
typedef b32 custom_view_set_mark_type(Application_Links* app, View_ID view_id, Buffer_Seek seek);
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, int_color color);
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_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, View_Context* ctx);
typedef b32 custom_view_alter_context_type(Application_Links* app, View_ID view_id, View_Context* ctx);
typedef View_Context custom_view_current_context_type(Application_Links* app, View_ID view_id);
typedef Data custom_view_current_context_hook_memory_type(Application_Links* app, View_ID view_id, Hook_ID hook_id);
typedef Managed_Scope custom_create_user_managed_scope_type(Application_Links* app);
@ -316,15 +316,15 @@ typedef b32 custom_try_modify_face_type(Application_Links* app, Face_ID id, Face
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, int_color color);
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 custom_draw_string_oriented_type(Application_Links* app, Face_ID font_id, String_Const_u8 str, Vec2 point, int_color color, u32 flags, Vec2 delta);
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 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, int_color color);
typedef void custom_draw_rectangle_outline_type(Application_Links* app, Rect_f32 rect, f32 roundness, f32 thickness, int_color color);
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 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);
@ -332,7 +332,7 @@ typedef Buffer_ID custom_text_layout_get_buffer_type(Application_Links* app, Tex
typedef Interval_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, int_color color);
typedef void custom_paint_text_color_type(Application_Links* app, Text_Layout_ID layout_id, Interval_i64 range, FColor 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_open_color_picker_type(Application_Links* app, Color_Picker* picker);
@ -598,10 +598,10 @@ internal b32 view_set_cursor(Application_Links* app, View_ID view_id, Buffer_See
internal b32 view_set_buffer_scroll(Application_Links* app, View_ID view_id, Buffer_Scroll scroll, Set_Buffer_Scroll_Rule rule);
internal b32 view_set_mark(Application_Links* app, View_ID view_id, Buffer_Seek seek);
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, int_color color);
internal b32 view_post_fade(Application_Links* app, View_ID view_id, f32 seconds, Range_i64 range, FColor 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, View_Context* ctx);
internal b32 view_alter_context(Application_Links* app, View_ID view_id, View_Context* ctx);
internal View_Context view_current_context(Application_Links* app, View_ID view_id);
internal Data view_current_context_hook_memory(Application_Links* app, View_ID view_id, Hook_ID hook_id);
internal Managed_Scope create_user_managed_scope(Application_Links* app);
@ -659,15 +659,15 @@ internal b32 try_modify_face(Application_Links* app, Face_ID id, Face_Descriptio
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, int_color color);
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 draw_string_oriented(Application_Links* app, Face_ID font_id, String_Const_u8 str, Vec2 point, int_color color, u32 flags, Vec2 delta);
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 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, int_color color);
internal void draw_rectangle_outline(Application_Links* app, Rect_f32 rect, f32 roundness, f32 thickness, int_color color);
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 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);
@ -675,7 +675,7 @@ internal Buffer_ID text_layout_get_buffer(Application_Links* app, Text_Layout_ID
internal Interval_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, int_color color);
internal void paint_text_color(Application_Links* app, Text_Layout_ID layout_id, Interval_i64 range, FColor 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 open_color_picker(Application_Links* app, Color_Picker* picker);

View File

@ -85,10 +85,10 @@ api(custom) function b32 view_set_cursor(Application_Links* app, View_ID view_id
api(custom) function b32 view_set_buffer_scroll(Application_Links* app, View_ID view_id, Buffer_Scroll scroll, Set_Buffer_Scroll_Rule rule);
api(custom) function b32 view_set_mark(Application_Links* app, View_ID view_id, Buffer_Seek seek);
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, int_color color);
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_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, View_Context* ctx);
api(custom) function b32 view_alter_context(Application_Links* app, View_ID view_id, View_Context* ctx);
api(custom) function View_Context view_current_context(Application_Links* app, View_ID view_id);
api(custom) function Data view_current_context_hook_memory(Application_Links* app, View_ID view_id, Hook_ID hook_id);
api(custom) function Managed_Scope create_user_managed_scope(Application_Links* app);
@ -146,15 +146,15 @@ api(custom) function b32 try_modify_face(Application_Links* app, Face_ID id, Fac
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, int_color color);
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 draw_string_oriented(Application_Links* app, Face_ID font_id, String_Const_u8 str, Vec2 point, int_color color, u32 flags, Vec2 delta);
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 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, int_color color);
api(custom) function void draw_rectangle_outline(Application_Links* app, Rect_f32 rect, f32 roundness, f32 thickness, int_color color);
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 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);
@ -162,7 +162,7 @@ api(custom) function Buffer_ID text_layout_get_buffer(Application_Links* app, Te
api(custom) function Interval_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, int_color color);
api(custom) function void paint_text_color(Application_Links* app, Text_Layout_ID layout_id, Interval_i64 range, FColor 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 open_color_picker(Application_Links* app, Color_Picker* picker);

View File

@ -43,456 +43,447 @@ lexeme_table_lookup(u64 *hash_array, String_Const_u8 *key_array,
}
#endif
u64 main_keys_hash_array[125] = {
0x0000000000000000,0x0000000000000000,0xae0dc40193b178f9,0xb96986ad74366239,
0xae0dc4007d2799c3,0x0000000000000000,0x6b890ab6607df9f5,0xfe4cf8e09552fd7d,
0xb96986abf449ab87,0x0ce3b6f3f2ae6d8b,0xb96986b1e4d5012d,0x0000000000000000,
0xae0dc4006a46609d,0xbae13981c29d9e93,0xb96986ac8864fc5b,0x0000000000000000,
0xfe4cdd7782bcdf87,0x0000000000000000,0x27dc518216dc92b9,0x0000000000000000,
0x0000000000000000,0x0ce3a6b2ed33a3f3,0xb6c16efd6d7f8691,0x0000000000000000,
0x5f1d5c76d1541da9,0x0000000000000000,0x0000000000000000,0xae0dc4006ef1e009,
0xb96986ad76870c01,0xb96986aba21ca901,0xb96986ae1e791a09,0xfe4cda48543d15eb,
0x0000000000000000,0xfe4c21260e153663,0xbae13981c29e1649,0xae0dc4007c306d83,
0x0000000000000000,0x0000000000000000,0x0000000000000000,0xfe53a22c8fba72db,
0x0000000000000000,0x0000000000000000,0xfe4c3c0e0a6459c3,0x0000000000000000,
0x0000000000000000,0x482db76ef4a7c2b9,0x0000000000000000,0x0000000000000000,
0xb96986adef80de03,0xbae13981c29e443f,0x0000000000000000,0x0000000000000000,
0x0000000000000000,0xfe4c3b126f24e73b,0x0000000000000000,0x0000000000000000,
0xb6c16efd6d5e9039,0x0ce3a73cf2370b75,0x0000000000000000,0x0000000000000000,
0x0000000000000000,0x0ce3a6cd0e243afd,0xae0dc4006d60a3dd,0xb6c16efd6d33baeb,
0x0000000000000000,0x0000000000000000,0xae0dc4007c1e53d9,0xfe50f7d974bbaa05,
0xb96986acb1e73223,0xb96986ad72de7ddd,0xb96986ae0d38e84b,0x0000000000000000,
0x0000000000000000,0xfe4c3b65bbba43b3,0x320c5ad54842e269,0xb6c16efd6d7eb2db,
0x0000000000000000,0x0000000000000000,0x0000000000000000,0x0000000000000000,
0xb6c16efd6d41ec49,0xb6c16efd6d3ad8c3,0xb6c16efd6d79768d,0x0000000000000000,
0x0ce3a725764fbd37,0x0000000000000000,0xb6c16efd6d326823,0xae0dc4006a76982b,
0x0000000000000000,0x0000000000000000,0xae0dc40193bc7f19,0xa48abde904c1baf9,
0x0000000000000000,0x0000000000000000,0x0000000000000000,0x0000000000000000,
0x0000000000000000,0xb6c16efd6d379001,0x0000000000000000,0x0000000000000000,
0x0000000000000000,0x0000000000000000,0xb96986ae0d2c0de5,0x0000000000000000,
0xb96986ac4109bb39,0x0000000000000000,0x5ee5e1225dabbaf9,0x6b8a48a90953eeab,
0x0000000000000000,0x0000000000000000,0x0000000000000000,0x0000000000000000,
0xb6c16efd6d3a30eb,0xb96986ae1e53e287,0xfe4c6461b7a951e5,0x0000000000000000,
0xbae13981c29ded97,0xbae13981c29dde75,0x5f1d5c76d1541c8f,0x0000000000000000,
0x0ce3b6f5b502c4ff,0x0000000000000000,0xae0dc4006c0426b9,0x0ce3b6f3f2ae5611,
0xc8cfe7a5027aeab5,
u64 main_keys_hash_array[121] = {
0xd7d4c38040a2a51b,0xdf638ad4b9cf69f1,0x0000000000000000,0x49161f88607bb631,
0x536665a889795331,0xac2560d906339023,0x0000000000000000,0x0000000000000000,
0x9df913c598e7c12f,0x0000000000000000,0x30a1e151f231a23d,0x0000000000000000,
0xdf638ad451f403ad,0xdf63897bcdc00091,0xb02f5667f4aa212d,0x0000000000000000,
0x0000000000000000,0x0000000000000000,0x0000000000000000,0xac2560d9187f0241,
0x0000000000000000,0xdf638adf7971e675,0xb2eaca38e283efad,0x0000000000000000,
0xdf638ad318e5d1ff,0xdf638ad080551679,0x0000000000000000,0x0000000000000000,
0xdf638ad206456083,0x0000000000000000,0x0000000000000000,0x0000000000000000,
0x0000000000000000,0x0000000000000000,0xac2560dad36752fb,0x0000000000000000,
0x536665a889463469,0xb2ea03bb268a134f,0x0000000000000000,0xb2e835e1b80e6623,
0xd7d4c38040add1c7,0x0000000000000000,0x0000000000000000,0x0000000000000000,
0xdf638ad4bed34c65,0x9df9cfb653425513,0xd7d4c38040ae41d1,0x0000000000000000,
0x947a68a4ac1c1501,0x6d88621e3e0beb01,0x0000000000000000,0x536665a88ceccda5,
0x0000000000000000,0x536665a88ccb6129,0x0000000000000000,0x0000000000000000,
0x536665a8896b20ab,0x0000000000000000,0x0000000000000000,0xb07367b671947053,
0xb2ea3109b4b43533,0x536665a889437cc3,0x0000000000000000,0x0000000000000000,
0xac2560d91bdcfc25,0x9df91c40ba8cd527,0x0000000000000000,0x536665a889769513,
0xdf638979523c12d1,0x0000000000000000,0x0000000000000000,0xb2c5e55df6610773,
0x0000000000000000,0x536665a8894345fb,0x0000000000000000,0x0000000000000000,
0x0000000000000000,0x0000000000000000,0x0000000000000000,0xac2560daec0e3851,
0x0000000000000000,0xb2c54a9d3317afb5,0xac2560d919a44b01,0x0000000000000000,
0xb77ddd8b9e414ce1,0x0000000000000000,0x18f86466c464cb01,0x0000000000000000,
0x0000000000000000,0xd7d4c38040a2854f,0x9df9ce6f49907115,0xac2560d90e3e3341,
0xdf63897b933beefb,0x0000000000000000,0x9df9cfb6534252e9,0xb2ea06e728b259ed,
0x0000000000000000,0x0000000000000000,0xb2ea5877c412647b,0x0000000000000000,
0xac2560d90618b725,0x34cb86f3fc1ca901,0xdf638ad4a65162c3,0x0000000000000000,
0x536665a88c2a1c41,0x49161f88607ba867,0xb2ead185c7065f1b,0x9df91f79b4ec2e9b,
0x0000000000000000,0xdf638ad4bf72e239,0xac2560dad9a93d8b,0xdf638979520bcfbf,
0xac2560dada9feda1,0x0000000000000000,0x0000000000000000,0x536665a88cc8be73,
0xdf63897b8855fa1b,0xb2c5e570be19f85b,0x9df91ccc8c85f8ed,0xd7d4c38040adb35d,
0x0000000000000000,
};
u8 main_keys_key_array_2[] = {0x63,0x6f,0x6e,0x73,0x74,};
u8 main_keys_key_array_3[] = {0x73,0x74,0x72,0x75,0x63,0x74,};
u8 main_keys_key_array_4[] = {0x77,0x68,0x69,0x6c,0x65,};
u8 main_keys_key_array_6[] = {0x70,0x72,0x6f,0x74,0x65,0x63,0x74,0x65,0x64,};
u8 main_keys_key_array_7[] = {0x65,0x78,0x70,0x6c,0x69,0x63,0x69,0x74,};
u8 main_keys_key_array_8[] = {0x72,0x65,0x74,0x75,0x72,0x6e,};
u8 main_keys_key_array_9[] = {0x61,0x6c,0x69,0x67,0x6e,0x6f,0x66,};
u8 main_keys_key_array_10[] = {0x74,0x79,0x70,0x65,0x69,0x64,};
u8 main_keys_key_array_12[] = {0x66,0x6c,0x6f,0x61,0x74,};
u8 main_keys_key_array_13[] = {0x61,0x73,0x6d,};
u8 main_keys_key_array_14[] = {0x69,0x6e,0x6c,0x69,0x6e,0x65,};
u8 main_keys_key_array_16[] = {0x6f,0x70,0x65,0x72,0x61,0x74,0x6f,0x72,};
u8 main_keys_key_array_18[] = {0x73,0x74,0x61,0x74,0x69,0x63,0x5f,0x63,0x61,0x73,0x74,};
u8 main_keys_key_array_21[] = {0x70,0x72,0x69,0x76,0x61,0x74,0x65,};
u8 main_keys_key_array_22[] = {0x74,0x68,0x69,0x73,};
u8 main_keys_key_array_24[] = {0x64,0x6f,};
u8 main_keys_key_array_27[] = {0x73,0x68,0x6f,0x72,0x74,};
u8 main_keys_key_array_28[] = {0x73,0x74,0x61,0x74,0x69,0x63,};
u8 main_keys_key_array_29[] = {0x70,0x75,0x62,0x6c,0x69,0x63,};
u8 main_keys_key_array_30[] = {0x65,0x78,0x70,0x6f,0x72,0x74,};
u8 main_keys_key_array_31[] = {0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,};
u8 main_keys_key_array_33[] = {0x64,0x65,0x63,0x6c,0x74,0x79,0x70,0x65,};
u8 main_keys_key_array_34[] = {0x69,0x6e,0x74,};
u8 main_keys_key_array_35[] = {0x75,0x6e,0x69,0x6f,0x6e,};
u8 main_keys_key_array_39[] = {0x63,0x6f,0x6e,0x74,0x69,0x6e,0x75,0x65,};
u8 main_keys_key_array_42[] = {0x76,0x6f,0x6c,0x61,0x74,0x69,0x6c,0x65,};
u8 main_keys_key_array_45[] = {0x64,0x79,0x6e,0x61,0x6d,0x69,0x63,0x5f,0x63,0x61,0x73,0x74,};
u8 main_keys_key_array_48[] = {0x64,0x6f,0x75,0x62,0x6c,0x65,};
u8 main_keys_key_array_49[] = {0x74,0x72,0x79,};
u8 main_keys_key_array_53[] = {0x74,0x79,0x70,0x65,0x6e,0x61,0x6d,0x65,};
u8 main_keys_key_array_56[] = {0x6c,0x6f,0x6e,0x67,};
u8 main_keys_key_array_57[] = {0x76,0x69,0x72,0x74,0x75,0x61,0x6c,};
u8 main_keys_key_array_61[] = {0x64,0x65,0x66,0x61,0x75,0x6c,0x74,};
u8 main_keys_key_array_62[] = {0x63,0x61,0x74,0x63,0x68,};
u8 main_keys_key_array_63[] = {0x63,0x61,0x73,0x65,};
u8 main_keys_key_array_66[] = {0x75,0x73,0x69,0x6e,0x67,};
u8 main_keys_key_array_67[] = {0x6e,0x6f,0x65,0x78,0x63,0x65,0x70,0x74,};
u8 main_keys_key_array_68[] = {0x64,0x65,0x6c,0x65,0x74,0x65,};
u8 main_keys_key_array_69[] = {0x73,0x77,0x69,0x74,0x63,0x68,};
u8 main_keys_key_array_70[] = {0x73,0x69,0x7a,0x65,0x6f,0x66,};
u8 main_keys_key_array_73[] = {0x74,0x65,0x6d,0x70,0x6c,0x61,0x74,0x65,};
u8 main_keys_key_array_74[] = {0x73,0x74,0x61,0x74,0x69,0x63,0x5f,0x61,0x73,0x73,0x65,0x72,0x74,};
u8 main_keys_key_array_75[] = {0x74,0x72,0x75,0x65,};
u8 main_keys_key_array_80[] = {0x67,0x6f,0x74,0x6f,};
u8 main_keys_key_array_81[] = {0x65,0x6e,0x75,0x6d,};
u8 main_keys_key_array_82[] = {0x76,0x6f,0x69,0x64,};
u8 main_keys_key_array_84[] = {0x74,0x79,0x70,0x65,0x64,0x65,0x66,};
u8 main_keys_key_array_86[] = {0x63,0x68,0x61,0x72,};
u8 main_keys_key_array_87[] = {0x66,0x61,0x6c,0x73,0x65,};
u8 main_keys_key_array_90[] = {0x63,0x6c,0x61,0x73,0x73,};
u8 main_keys_key_array_91[] = {0x72,0x65,0x69,0x6e,0x74,0x65,0x72,0x70,0x72,0x65,0x74,0x5f,0x63,0x61,0x73,0x74,};
u8 main_keys_key_array_97[] = {0x62,0x6f,0x6f,0x6c,};
u8 main_keys_key_array_102[] = {0x73,0x69,0x67,0x6e,0x65,0x64,};
u8 main_keys_key_array_104[] = {0x66,0x72,0x69,0x65,0x6e,0x64,};
u8 main_keys_key_array_106[] = {0x63,0x6f,0x6e,0x73,0x74,0x5f,0x63,0x61,0x73,0x74,};
u8 main_keys_key_array_107[] = {0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,};
u8 main_keys_key_array_112[] = {0x65,0x6c,0x73,0x65,};
u8 main_keys_key_array_113[] = {0x65,0x78,0x74,0x65,0x72,0x6e,};
u8 main_keys_key_array_114[] = {0x75,0x6e,0x73,0x69,0x67,0x6e,0x65,0x64,};
u8 main_keys_key_array_116[] = {0x66,0x6f,0x72,};
u8 main_keys_key_array_117[] = {0x6e,0x65,0x77,};
u8 main_keys_key_array_118[] = {0x69,0x66,};
u8 main_keys_key_array_120[] = {0x6e,0x75,0x6c,0x6c,0x70,0x74,0x72,};
u8 main_keys_key_array_122[] = {0x62,0x72,0x65,0x61,0x6b,};
u8 main_keys_key_array_123[] = {0x61,0x6c,0x69,0x67,0x6e,0x61,0x73,};
u8 main_keys_key_array_124[] = {0x74,0x68,0x72,0x65,0x61,0x64,0x5f,0x6c,0x6f,0x63,0x61,0x6c,};
String_Const_u8 main_keys_key_array[125] = {
u8 main_keys_key_array_0[] = {0x61,0x73,0x6d,};
u8 main_keys_key_array_1[] = {0x73,0x74,0x72,0x75,0x63,0x74,};
u8 main_keys_key_array_3[] = {0x64,0x6f,};
u8 main_keys_key_array_4[] = {0x67,0x6f,0x74,0x6f,};
u8 main_keys_key_array_5[] = {0x66,0x61,0x6c,0x73,0x65,};
u8 main_keys_key_array_8[] = {0x74,0x79,0x70,0x65,0x64,0x65,0x66,};
u8 main_keys_key_array_10[] = {0x74,0x68,0x72,0x65,0x61,0x64,0x5f,0x6c,0x6f,0x63,0x61,0x6c,};
u8 main_keys_key_array_12[] = {0x73,0x69,0x67,0x6e,0x65,0x64,};
u8 main_keys_key_array_13[] = {0x66,0x72,0x69,0x65,0x6e,0x64,};
u8 main_keys_key_array_14[] = {0x70,0x72,0x6f,0x74,0x65,0x63,0x74,0x65,0x64,};
u8 main_keys_key_array_19[] = {0x63,0x6f,0x6e,0x73,0x74,};
u8 main_keys_key_array_21[] = {0x74,0x79,0x70,0x65,0x69,0x64,};
u8 main_keys_key_array_22[] = {0x75,0x6e,0x73,0x69,0x67,0x6e,0x65,0x64,};
u8 main_keys_key_array_24[] = {0x72,0x65,0x74,0x75,0x72,0x6e,};
u8 main_keys_key_array_25[] = {0x70,0x75,0x62,0x6c,0x69,0x63,};
u8 main_keys_key_array_28[] = {0x69,0x6e,0x6c,0x69,0x6e,0x65,};
u8 main_keys_key_array_34[] = {0x77,0x68,0x69,0x6c,0x65,};
u8 main_keys_key_array_36[] = {0x62,0x6f,0x6f,0x6c,};
u8 main_keys_key_array_37[] = {0x6f,0x70,0x65,0x72,0x61,0x74,0x6f,0x72,};
u8 main_keys_key_array_39[] = {0x74,0x79,0x70,0x65,0x6e,0x61,0x6d,0x65,};
u8 main_keys_key_array_40[] = {0x74,0x72,0x79,};
u8 main_keys_key_array_44[] = {0x73,0x77,0x69,0x74,0x63,0x68,};
u8 main_keys_key_array_45[] = {0x61,0x6c,0x69,0x67,0x6e,0x6f,0x66,};
u8 main_keys_key_array_46[] = {0x69,0x6e,0x74,};
u8 main_keys_key_array_48[] = {0x72,0x65,0x69,0x6e,0x74,0x65,0x72,0x70,0x72,0x65,0x74,0x5f,0x63,0x61,0x73,0x74,};
u8 main_keys_key_array_49[] = {0x73,0x74,0x61,0x74,0x69,0x63,0x5f,0x63,0x61,0x73,0x74,};
u8 main_keys_key_array_51[] = {0x76,0x6f,0x69,0x64,};
u8 main_keys_key_array_53[] = {0x74,0x68,0x69,0x73,};
u8 main_keys_key_array_56[] = {0x63,0x68,0x61,0x72,};
u8 main_keys_key_array_59[] = {0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,};
u8 main_keys_key_array_60[] = {0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,};
u8 main_keys_key_array_61[] = {0x65,0x6c,0x73,0x65,};
u8 main_keys_key_array_64[] = {0x63,0x61,0x74,0x63,0x68,};
u8 main_keys_key_array_65[] = {0x6e,0x75,0x6c,0x6c,0x70,0x74,0x72,};
u8 main_keys_key_array_67[] = {0x63,0x61,0x73,0x65,};
u8 main_keys_key_array_68[] = {0x65,0x78,0x70,0x6f,0x72,0x74,};
u8 main_keys_key_array_71[] = {0x63,0x6f,0x6e,0x74,0x69,0x6e,0x75,0x65,};
u8 main_keys_key_array_73[] = {0x65,0x6e,0x75,0x6d,};
u8 main_keys_key_array_79[] = {0x73,0x68,0x6f,0x72,0x74,};
u8 main_keys_key_array_81[] = {0x65,0x78,0x70,0x6c,0x69,0x63,0x69,0x74,};
u8 main_keys_key_array_82[] = {0x63,0x6c,0x61,0x73,0x73,};
u8 main_keys_key_array_84[] = {0x73,0x74,0x61,0x74,0x69,0x63,0x5f,0x61,0x73,0x73,0x65,0x72,0x74,};
u8 main_keys_key_array_86[] = {0x64,0x79,0x6e,0x61,0x6d,0x69,0x63,0x5f,0x63,0x61,0x73,0x74,};
u8 main_keys_key_array_89[] = {0x66,0x6f,0x72,};
u8 main_keys_key_array_90[] = {0x64,0x65,0x66,0x61,0x75,0x6c,0x74,};
u8 main_keys_key_array_91[] = {0x62,0x72,0x65,0x61,0x6b,};
u8 main_keys_key_array_92[] = {0x64,0x65,0x6c,0x65,0x74,0x65,};
u8 main_keys_key_array_94[] = {0x61,0x6c,0x69,0x67,0x6e,0x61,0x73,};
u8 main_keys_key_array_95[] = {0x6e,0x6f,0x65,0x78,0x63,0x65,0x70,0x74,};
u8 main_keys_key_array_98[] = {0x76,0x6f,0x6c,0x61,0x74,0x69,0x6c,0x65,};
u8 main_keys_key_array_100[] = {0x66,0x6c,0x6f,0x61,0x74,};
u8 main_keys_key_array_101[] = {0x63,0x6f,0x6e,0x73,0x74,0x5f,0x63,0x61,0x73,0x74,};
u8 main_keys_key_array_102[] = {0x73,0x69,0x7a,0x65,0x6f,0x66,};
u8 main_keys_key_array_104[] = {0x6c,0x6f,0x6e,0x67,};
u8 main_keys_key_array_105[] = {0x69,0x66,};
u8 main_keys_key_array_106[] = {0x74,0x65,0x6d,0x70,0x6c,0x61,0x74,0x65,};
u8 main_keys_key_array_107[] = {0x70,0x72,0x69,0x76,0x61,0x74,0x65,};
u8 main_keys_key_array_109[] = {0x73,0x74,0x61,0x74,0x69,0x63,};
u8 main_keys_key_array_110[] = {0x75,0x6e,0x69,0x6f,0x6e,};
u8 main_keys_key_array_111[] = {0x65,0x78,0x74,0x65,0x72,0x6e,};
u8 main_keys_key_array_112[] = {0x75,0x73,0x69,0x6e,0x67,};
u8 main_keys_key_array_115[] = {0x74,0x72,0x75,0x65,};
u8 main_keys_key_array_116[] = {0x64,0x6f,0x75,0x62,0x6c,0x65,};
u8 main_keys_key_array_117[] = {0x64,0x65,0x63,0x6c,0x74,0x79,0x70,0x65,};
u8 main_keys_key_array_118[] = {0x76,0x69,0x72,0x74,0x75,0x61,0x6c,};
u8 main_keys_key_array_119[] = {0x6e,0x65,0x77,};
String_Const_u8 main_keys_key_array[121] = {
{main_keys_key_array_0, 3},
{main_keys_key_array_1, 6},
{0, 0},
{main_keys_key_array_3, 2},
{main_keys_key_array_4, 4},
{main_keys_key_array_5, 5},
{0, 0},
{0, 0},
{main_keys_key_array_2, 5},
{main_keys_key_array_3, 6},
{main_keys_key_array_4, 5},
{main_keys_key_array_8, 7},
{0, 0},
{main_keys_key_array_6, 9},
{main_keys_key_array_7, 8},
{main_keys_key_array_8, 6},
{main_keys_key_array_9, 7},
{main_keys_key_array_10, 6},
{main_keys_key_array_10, 12},
{0, 0},
{main_keys_key_array_12, 5},
{main_keys_key_array_13, 3},
{main_keys_key_array_14, 6},
{0, 0},
{main_keys_key_array_16, 8},
{0, 0},
{main_keys_key_array_18, 11},
{main_keys_key_array_12, 6},
{main_keys_key_array_13, 6},
{main_keys_key_array_14, 9},
{0, 0},
{0, 0},
{main_keys_key_array_21, 7},
{main_keys_key_array_22, 4},
{0, 0},
{main_keys_key_array_24, 2},
{0, 0},
{0, 0},
{main_keys_key_array_27, 5},
{main_keys_key_array_19, 5},
{0, 0},
{main_keys_key_array_21, 6},
{main_keys_key_array_22, 8},
{0, 0},
{main_keys_key_array_24, 6},
{main_keys_key_array_25, 6},
{0, 0},
{0, 0},
{main_keys_key_array_28, 6},
{main_keys_key_array_29, 6},
{main_keys_key_array_30, 6},
{main_keys_key_array_31, 8},
{0, 0},
{main_keys_key_array_33, 8},
{main_keys_key_array_34, 3},
{main_keys_key_array_35, 5},
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{main_keys_key_array_34, 5},
{0, 0},
{main_keys_key_array_36, 4},
{main_keys_key_array_37, 8},
{0, 0},
{main_keys_key_array_39, 8},
{0, 0},
{0, 0},
{main_keys_key_array_42, 8},
{0, 0},
{0, 0},
{main_keys_key_array_45, 12},
{0, 0},
{0, 0},
{main_keys_key_array_48, 6},
{main_keys_key_array_49, 3},
{main_keys_key_array_40, 3},
{0, 0},
{0, 0},
{0, 0},
{main_keys_key_array_53, 8},
{main_keys_key_array_44, 6},
{main_keys_key_array_45, 7},
{main_keys_key_array_46, 3},
{0, 0},
{main_keys_key_array_48, 16},
{main_keys_key_array_49, 11},
{0, 0},
{main_keys_key_array_51, 4},
{0, 0},
{main_keys_key_array_53, 4},
{0, 0},
{0, 0},
{main_keys_key_array_56, 4},
{main_keys_key_array_57, 7},
{0, 0},
{0, 0},
{0, 0},
{main_keys_key_array_61, 7},
{main_keys_key_array_62, 5},
{main_keys_key_array_63, 4},
{main_keys_key_array_59, 9},
{main_keys_key_array_60, 8},
{main_keys_key_array_61, 4},
{0, 0},
{0, 0},
{main_keys_key_array_66, 5},
{main_keys_key_array_67, 8},
{main_keys_key_array_64, 5},
{main_keys_key_array_65, 7},
{0, 0},
{main_keys_key_array_67, 4},
{main_keys_key_array_68, 6},
{main_keys_key_array_69, 6},
{main_keys_key_array_70, 6},
{0, 0},
{0, 0},
{main_keys_key_array_73, 8},
{main_keys_key_array_74, 13},
{main_keys_key_array_75, 4},
{main_keys_key_array_71, 8},
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{main_keys_key_array_80, 4},
{main_keys_key_array_81, 4},
{main_keys_key_array_82, 4},
{0, 0},
{main_keys_key_array_84, 7},
{0, 0},
{main_keys_key_array_86, 4},
{main_keys_key_array_87, 5},
{0, 0},
{0, 0},
{main_keys_key_array_90, 5},
{main_keys_key_array_91, 16},
{main_keys_key_array_73, 4},
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{main_keys_key_array_97, 4},
{main_keys_key_array_79, 5},
{0, 0},
{main_keys_key_array_81, 8},
{main_keys_key_array_82, 5},
{0, 0},
{main_keys_key_array_84, 13},
{0, 0},
{main_keys_key_array_86, 12},
{0, 0},
{0, 0},
{main_keys_key_array_89, 3},
{main_keys_key_array_90, 7},
{main_keys_key_array_91, 5},
{main_keys_key_array_92, 6},
{0, 0},
{main_keys_key_array_94, 7},
{main_keys_key_array_95, 8},
{0, 0},
{0, 0},
{main_keys_key_array_98, 8},
{0, 0},
{main_keys_key_array_100, 5},
{main_keys_key_array_101, 10},
{main_keys_key_array_102, 6},
{0, 0},
{main_keys_key_array_104, 6},
{main_keys_key_array_104, 4},
{main_keys_key_array_105, 2},
{main_keys_key_array_106, 8},
{main_keys_key_array_107, 7},
{0, 0},
{main_keys_key_array_106, 10},
{main_keys_key_array_107, 9},
{main_keys_key_array_109, 6},
{main_keys_key_array_110, 5},
{main_keys_key_array_111, 6},
{main_keys_key_array_112, 5},
{0, 0},
{0, 0},
{main_keys_key_array_115, 4},
{main_keys_key_array_116, 6},
{main_keys_key_array_117, 8},
{main_keys_key_array_118, 7},
{main_keys_key_array_119, 3},
{0, 0},
{0, 0},
{main_keys_key_array_112, 4},
{main_keys_key_array_113, 6},
{main_keys_key_array_114, 8},
{0, 0},
{main_keys_key_array_116, 3},
{main_keys_key_array_117, 3},
{main_keys_key_array_118, 2},
{0, 0},
{main_keys_key_array_120, 7},
{0, 0},
{main_keys_key_array_122, 5},
{main_keys_key_array_123, 7},
{main_keys_key_array_124, 12},
};
Lexeme_Table_Value main_keys_value_array[125] = {
Lexeme_Table_Value main_keys_value_array[121] = {
{4, TokenCppKind_Asm},
{4, TokenCppKind_Struct},
{0, 0},
{4, TokenCppKind_Do},
{4, TokenCppKind_Goto},
{8, TokenCppKind_LiteralFalse},
{0, 0},
{0, 0},
{4, TokenCppKind_Typedef},
{0, 0},
{4, TokenCppKind_ThreadLocal},
{0, 0},
{4, TokenCppKind_Signed},
{4, TokenCppKind_Friend},
{4, TokenCppKind_Protected},
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{4, TokenCppKind_Const},
{4, TokenCppKind_Struct},
{4, TokenCppKind_While},
{0, 0},
{4, TokenCppKind_Protected},
{4, TokenCppKind_Explicit},
{4, TokenCppKind_Return},
{4, TokenCppKind_AlignOf},
{4, TokenCppKind_TypeID},
{4, TokenCppKind_Unsigned},
{0, 0},
{4, TokenCppKind_Return},
{4, TokenCppKind_Public},
{0, 0},
{0, 0},
{4, TokenCppKind_Float},
{4, TokenCppKind_Asm},
{4, TokenCppKind_Inline},
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{4, TokenCppKind_While},
{0, 0},
{4, TokenCppKind_Bool},
{4, TokenCppKind_Operator},
{0, 0},
{4, TokenCppKind_StaticCast},
{0, 0},
{0, 0},
{4, TokenCppKind_Private},
{4, TokenCppKind_This},
{0, 0},
{4, TokenCppKind_Do},
{0, 0},
{0, 0},
{4, TokenCppKind_Short},
{4, TokenCppKind_Static},
{4, TokenCppKind_Public},
{4, TokenCppKind_Export},
{4, TokenCppKind_Register},
{0, 0},
{4, TokenCppKind_DeclType},
{4, TokenCppKind_Int},
{4, TokenCppKind_Union},
{0, 0},
{0, 0},
{0, 0},
{4, TokenCppKind_Continue},
{0, 0},
{0, 0},
{4, TokenCppKind_Volatile},
{0, 0},
{0, 0},
{4, TokenCppKind_DynamicCast},
{0, 0},
{0, 0},
{4, TokenCppKind_Double},
{4, TokenCppKind_Typename},
{4, TokenCppKind_Try},
{0, 0},
{0, 0},
{0, 0},
{4, TokenCppKind_Typename},
{0, 0},
{0, 0},
{4, TokenCppKind_Long},
{4, TokenCppKind_Virtual},
{0, 0},
{0, 0},
{0, 0},
{4, TokenCppKind_Default},
{4, TokenCppKind_Catch},
{4, TokenCppKind_Case},
{0, 0},
{0, 0},
{4, TokenCppKind_Using},
{4, TokenCppKind_NoExcept},
{4, TokenCppKind_Delete},
{4, TokenCppKind_Switch},
{4, TokenCppKind_SizeOf},
{4, TokenCppKind_AlignOf},
{4, TokenCppKind_Int},
{0, 0},
{4, TokenCppKind_ReinterpretCast},
{4, TokenCppKind_StaticCast},
{0, 0},
{4, TokenCppKind_Template},
{4, TokenCppKind_StaticAssert},
{8, TokenCppKind_LiteralTrue},
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{4, TokenCppKind_Goto},
{4, TokenCppKind_Enum},
{4, TokenCppKind_Void},
{0, 0},
{4, TokenCppKind_Typedef},
{4, TokenCppKind_This},
{0, 0},
{0, 0},
{4, TokenCppKind_Char},
{8, TokenCppKind_LiteralFalse},
{0, 0},
{0, 0},
{4, TokenCppKind_Class},
{4, TokenCppKind_ReinterpretCast},
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{4, TokenCppKind_Bool},
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{4, TokenCppKind_Signed},
{0, 0},
{4, TokenCppKind_Friend},
{0, 0},
{4, TokenCppKind_ConstCast},
{4, TokenCppKind_Namespace},
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{4, TokenCppKind_Register},
{4, TokenCppKind_Else},
{4, TokenCppKind_Extern},
{4, TokenCppKind_Unsigned},
{0, 0},
{4, TokenCppKind_For},
{4, TokenCppKind_New},
{4, TokenCppKind_If},
{0, 0},
{4, TokenCppKind_Catch},
{4, TokenCppKind_NullPtr},
{0, 0},
{4, TokenCppKind_Case},
{4, TokenCppKind_Export},
{0, 0},
{0, 0},
{4, TokenCppKind_Continue},
{0, 0},
{4, TokenCppKind_Enum},
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{4, TokenCppKind_Short},
{0, 0},
{4, TokenCppKind_Explicit},
{4, TokenCppKind_Class},
{0, 0},
{4, TokenCppKind_StaticAssert},
{0, 0},
{4, TokenCppKind_DynamicCast},
{0, 0},
{0, 0},
{4, TokenCppKind_For},
{4, TokenCppKind_Default},
{4, TokenCppKind_Break},
{4, TokenCppKind_Delete},
{0, 0},
{4, TokenCppKind_AlignAs},
{4, TokenCppKind_ThreadLocal},
{4, TokenCppKind_NoExcept},
{0, 0},
{0, 0},
{4, TokenCppKind_Volatile},
{0, 0},
{4, TokenCppKind_Float},
{4, TokenCppKind_ConstCast},
{4, TokenCppKind_SizeOf},
{0, 0},
{4, TokenCppKind_Long},
{4, TokenCppKind_If},
{4, TokenCppKind_Template},
{4, TokenCppKind_Private},
{0, 0},
{4, TokenCppKind_Static},
{4, TokenCppKind_Union},
{4, TokenCppKind_Extern},
{4, TokenCppKind_Using},
{0, 0},
{0, 0},
{8, TokenCppKind_LiteralTrue},
{4, TokenCppKind_Double},
{4, TokenCppKind_DeclType},
{4, TokenCppKind_Virtual},
{4, TokenCppKind_New},
{0, 0},
};
i32 main_keys_slot_count = 125;
u64 main_keys_seed = 0xfa381694d5674125;
i32 main_keys_slot_count = 121;
u64 main_keys_seed = 0xc6a99799e45617dd;
u64 pp_directives_hash_array[25] = {
0x0000000000000000,0x34b86dc413bdc61d,0x0000000000000000,0xcc5e69206f9dddbd,
0x0000000000000000,0x65f024ddd53ade19,0x65f02489c656353d,0x0000000000000000,
0xcc5e69207d2543bd,0x35db8e7164ab1e55,0x6bb45a7c34b15b09,0x35db8e7164f625dd,
0x0000000000000000,0x0000000000000000,0x35db8e7164ab3649,0xcc5e692189cbad79,
0x0000000000000000,0xcc5e69207d6608a3,0x0000000000000000,0x0000000000000000,
0x65f02488282ecfbd,0x6bb4b5a2472171e5,0xcc5e6921a27c7d55,0x0000000000000000,
0x65f02489e6243cc7,
0xfa6a010b7dbbde13,0x0000000000000000,0xce2f38db2af5366d,0xfa6a010b7d62d06d,
0xcc962e54221688f9,0x0000000000000000,0x03b5dc5556efc84d,0xfa6a010b0bc317e5,
0x0000000000000000,0xcaa053e8a98a24b9,0xcaa053e8a98a2085,0xcc9620cd74b482d5,
0x0000000000000000,0x0000000000000000,0x0000000000000000,0x0000000000000000,
0xce2f38da33096dd7,0xce2f38dbf3d6ad6d,0xfa6a010b0bd76809,0x0000000000000000,
0xfa6a010b0edd496d,0xce2f38e88510d3c9,0x0000000000000000,0xcaa053e8aa33abcd,
0x0000000000000000,
};
u8 pp_directives_key_array_1[] = {0x69,0x66,};
u8 pp_directives_key_array_3[] = {0x69,0x66,0x64,0x65,0x66,};
u8 pp_directives_key_array_5[] = {0x70,0x72,0x61,0x67,0x6d,0x61,};
u8 pp_directives_key_array_6[] = {0x64,0x65,0x66,0x69,0x6e,0x65,};
u8 pp_directives_key_array_8[] = {0x75,0x6e,0x64,0x65,0x66,};
u8 pp_directives_key_array_9[] = {0x65,0x6c,0x69,0x66,};
u8 pp_directives_key_array_10[] = {0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,};
u8 pp_directives_key_array_11[] = {0x6c,0x69,0x6e,0x65,};
u8 pp_directives_key_array_14[] = {0x65,0x6c,0x73,0x65,};
u8 pp_directives_key_array_15[] = {0x65,0x72,0x72,0x6f,0x72,};
u8 pp_directives_key_array_17[] = {0x75,0x73,0x69,0x6e,0x67,};
u8 pp_directives_key_array_20[] = {0x69,0x66,0x6e,0x64,0x65,0x66,};
u8 pp_directives_key_array_21[] = {0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,};
u8 pp_directives_key_array_22[] = {0x65,0x6e,0x64,0x69,0x66,};
u8 pp_directives_key_array_24[] = {0x69,0x6d,0x70,0x6f,0x72,0x74,};
u8 pp_directives_key_array_0[] = {0x75,0x73,0x69,0x6e,0x67,};
u8 pp_directives_key_array_2[] = {0x64,0x65,0x66,0x69,0x6e,0x65,};
u8 pp_directives_key_array_3[] = {0x75,0x6e,0x64,0x65,0x66,};
u8 pp_directives_key_array_4[] = {0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,};
u8 pp_directives_key_array_6[] = {0x69,0x66,};
u8 pp_directives_key_array_7[] = {0x65,0x6e,0x64,0x69,0x66,};
u8 pp_directives_key_array_9[] = {0x65,0x6c,0x73,0x65,};
u8 pp_directives_key_array_10[] = {0x65,0x6c,0x69,0x66,};
u8 pp_directives_key_array_11[] = {0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,};
u8 pp_directives_key_array_16[] = {0x69,0x6d,0x70,0x6f,0x72,0x74,};
u8 pp_directives_key_array_17[] = {0x69,0x66,0x6e,0x64,0x65,0x66,};
u8 pp_directives_key_array_18[] = {0x65,0x72,0x72,0x6f,0x72,};
u8 pp_directives_key_array_20[] = {0x69,0x66,0x64,0x65,0x66,};
u8 pp_directives_key_array_21[] = {0x70,0x72,0x61,0x67,0x6d,0x61,};
u8 pp_directives_key_array_23[] = {0x6c,0x69,0x6e,0x65,};
String_Const_u8 pp_directives_key_array[25] = {
{pp_directives_key_array_0, 5},
{0, 0},
{pp_directives_key_array_1, 2},
{0, 0},
{pp_directives_key_array_2, 6},
{pp_directives_key_array_3, 5},
{pp_directives_key_array_4, 7},
{0, 0},
{pp_directives_key_array_5, 6},
{pp_directives_key_array_6, 6},
{pp_directives_key_array_6, 2},
{pp_directives_key_array_7, 5},
{0, 0},
{pp_directives_key_array_8, 5},
{pp_directives_key_array_9, 4},
{pp_directives_key_array_10, 7},
{pp_directives_key_array_11, 4},
{pp_directives_key_array_10, 4},
{pp_directives_key_array_11, 7},
{0, 0},
{0, 0},
{pp_directives_key_array_14, 4},
{pp_directives_key_array_15, 5},
{0, 0},
{pp_directives_key_array_17, 5},
{0, 0},
{0, 0},
{pp_directives_key_array_20, 6},
{pp_directives_key_array_21, 7},
{pp_directives_key_array_22, 5},
{pp_directives_key_array_16, 6},
{pp_directives_key_array_17, 6},
{pp_directives_key_array_18, 5},
{0, 0},
{pp_directives_key_array_20, 5},
{pp_directives_key_array_21, 6},
{0, 0},
{pp_directives_key_array_23, 4},
{0, 0},
{pp_directives_key_array_24, 6},
};
Lexeme_Table_Value pp_directives_value_array[25] = {
{0, 0},
{5, TokenCppKind_PPIf},
{0, 0},
{5, TokenCppKind_PPIfDef},
{0, 0},
{5, TokenCppKind_PPPragma},
{5, TokenCppKind_PPDefine},
{0, 0},
{5, TokenCppKind_PPUndef},
{5, TokenCppKind_PPElIf},
{5, TokenCppKind_PPInclude},
{5, TokenCppKind_PPLine},
{0, 0},
{0, 0},
{5, TokenCppKind_PPElse},
{5, TokenCppKind_PPError},
{0, 0},
{5, TokenCppKind_PPUsing},
{0, 0},
{5, TokenCppKind_PPDefine},
{5, TokenCppKind_PPUndef},
{5, TokenCppKind_PPInclude},
{0, 0},
{5, TokenCppKind_PPIfNDef},
{5, TokenCppKind_PPVersion},
{5, TokenCppKind_PPIf},
{5, TokenCppKind_PPEndIf},
{0, 0},
{5, TokenCppKind_PPElse},
{5, TokenCppKind_PPElIf},
{5, TokenCppKind_PPVersion},
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{5, TokenCppKind_PPImport},
{5, TokenCppKind_PPIfNDef},
{5, TokenCppKind_PPError},
{0, 0},
{5, TokenCppKind_PPIfDef},
{5, TokenCppKind_PPPragma},
{0, 0},
{5, TokenCppKind_PPLine},
{0, 0},
};
i32 pp_directives_slot_count = 25;
u64 pp_directives_seed = 0x8fec132e93357a37;
u64 pp_directives_seed = 0x7dd6fc44901da387;
u64 pp_keys_hash_array[2] = {
0xaa00330834c0d751,0x0000000000000000,
0x0000000000000000,0x3eb4becea6185ce7,
};
u8 pp_keys_key_array_0[] = {0x64,0x65,0x66,0x69,0x6e,0x65,0x64,};
u8 pp_keys_key_array_1[] = {0x64,0x65,0x66,0x69,0x6e,0x65,0x64,};
String_Const_u8 pp_keys_key_array[2] = {
{pp_keys_key_array_0, 7},
{0, 0},
{pp_keys_key_array_1, 7},
};
Lexeme_Table_Value pp_keys_value_array[2] = {
{4, TokenCppKind_PPDefined},
{0, 0},
{4, TokenCppKind_PPDefined},
};
i32 pp_keys_slot_count = 2;
u64 pp_keys_seed = 0x444d48e552bc237e;
u64 pp_keys_seed = 0x62441372bace9443;
struct Lex_State_Cpp{
u32 flags_ZF0;
u32 flags_KF0;

View File

@ -348,19 +348,18 @@ system_save_file_sig(){
////////////////////////////////
internal int_color
swap_r_and_b(int_color a){
int_color result = a & 0xff00ff00;
internal ARGB_Color
swap_r_and_b(ARGB_Color a){
ARGB_Color result = a & 0xff00ff00;
result |= ((a >> 16) & 0xff);
result |= ((a & 0xff) << 16);
return(result);
}
internal int_color
int_color_from_colorref(COLORREF ref, int_color alpha_from){
int_color rgb = swap_r_and_b(ref & 0xffffff);
int_color result = ((0xff000000 & alpha_from) | rgb);
internal ARGB_Color
int_color_from_colorref(COLORREF ref, ARGB_Color alpha_from){
ARGB_Color rgb = swap_r_and_b(ref & 0xffffff);
ARGB_Color result = ((0xff000000 & alpha_from) | rgb);
return(result);
}
@ -383,17 +382,20 @@ color_picker_hook(HWND Window, UINT Message, WPARAM WParam, LPARAM LParam){
case WM_CTLCOLORSTATIC:
{
// NOTE(casey): I can't believe I'm 42 years old and I still have to do this fucking crap.
// Microsoft is so fucking fired every god damn day. Would it have killed you to update rgbResult
// continuously, or at least provide a GetCurrentColor() call???
// NOTE(casey): I can't believe I'm 42 years old and I still have to do
// this fucking crap. Microsoft is so fucking fired every god damn day.
// Would it have killed you to update rgbResult continuously, or at least
// provide a GetCurrentColor() call???
//
// Anyway, since the color picker doesn't tell us when the color is changed, what we do is watch for messages
// that repaint the color swatch, which is dialog id 0x2c5, and then we sample it to see what color it is.
// No, I'm not fucking kidding, that's what we do.
// Anyway, since the color picker doesn't tell us when the color is
// changed, what we do is watch for messages that repaint the color
// swatch, which is dialog id 0x2c5, and then we sample it to see what
// color it is. No, I'm not fucking kidding, that's what we do.
HWND swatch_window = (HWND)LParam;
if(GetDlgCtrlID(swatch_window) == 0x2c5)
{
CHOOSECOLORW *win32_params = (CHOOSECOLORW *)GetWindowLongPtr(Window, GWLP_USERDATA);
CHOOSECOLORW *win32_params =
(CHOOSECOLORW *)GetWindowLongPtr(Window, GWLP_USERDATA);
if(win32_params)
{
Color_Picker *picker = (Color_Picker*)win32_params->lCustData;
@ -401,8 +403,11 @@ color_picker_hook(HWND Window, UINT Message, WPARAM WParam, LPARAM LParam){
RECT rect;
GetClientRect(swatch_window, &rect);
HDC swatch_dc = (HDC)WParam;
COLORREF Probe = GetPixel(swatch_dc, (rect.left + rect.right) / 4, (rect.top + rect.bottom) / 2);
int_color new_color = int_color_from_colorref(Probe, *picker->dest);
COLORREF Probe = GetPixel(swatch_dc,
(rect.left + rect.right)/4,
(rect.top + rect.bottom)/2);
ARGB_Color new_color =
int_color_from_colorref(Probe, *picker->dest);
if(*picker->dest != new_color)
{
@ -433,9 +438,8 @@ color_picker_thread(LPVOID Param)
{
Color_Picker *picker = (Color_Picker*)Param;
int_color color = 0;
if(picker->dest)
{
ARGB_Color color = 0;
if (picker->dest){
color = *picker->dest;
}
@ -451,18 +455,15 @@ color_picker_thread(LPVOID Param)
win32_params.lCustData = (LPARAM)picker;
win32_params.lpfnHook = color_picker_hook;
if(ChooseColorW(&win32_params))
{
if (ChooseColorW(&win32_params)){
color = int_color_from_colorref(win32_params.rgbResult, color);
}
if(picker->dest)
{
if(picker->dest){
*picker->dest = color;
}
if(picker->finished)
{
if (picker->finished){
*picker->finished = true;
}