progress on per-view searching operation - will be specialized & used for replacements for finding text, for going to line/address, and filtering in query views

This commit is contained in:
Ryan Fleury
2025-02-19 11:33:16 -08:00
parent f87dd1be82
commit a8f72dd5f1
10 changed files with 386 additions and 342 deletions
+1 -1
View File
@@ -2253,7 +2253,7 @@ E_IRGEN_FUNCTION_DEF(default)
Temp scratch = scratch_begin(&arena, 1);
String8 file_path = path_normalized_from_string(scratch.arena, expr->string);
FileProperties props = os_properties_from_file_path(file_path);
if(props.flags & FilePropertyFlag_IsFolder || props.modified == 0)
if(props.flags & FilePropertyFlag_IsFolder || file_path.size == 0 || str8_match(file_path, str8_lit("/"), StringMatchFlag_SlashInsensitive))
{
E_Space space = e_space_make(E_SpaceKind_FileSystem);
result.root = e_irtree_set_space(arena, space, e_irtree_const_u(arena, e_id_from_string(file_path)));
+2 -1
View File
@@ -552,7 +552,8 @@ os_properties_from_file_path(String8 path)
Temp scratch = scratch_begin(0, 0);
WCHAR buffer[512] = {0};
DWORD length = GetLogicalDriveStringsW(sizeof(buffer), buffer);
U64 last_slash_pos = str8_find_needle(path, 0, str8_lit("/"), StringMatchFlag_SlashInsensitive);
U64 last_slash_pos = 0;
for(;last_slash_pos < path.size; last_slash_pos = str8_find_needle(path, last_slash_pos+1, str8_lit("/"), StringMatchFlag_SlashInsensitive));
String8 path_trimmed = str8_prefix(path, last_slash_pos);
for(U64 off = 0; off < (U64)length;)
{
+1 -1
View File
@@ -809,7 +809,7 @@ str8_lit_comp("far_manager"),
String8 rd_theme_preset_cfg_string_table[9] =
{
str8_lit_comp("theme:\n{\n background: 0x1b1b1bff,\n alt: background: 0x222222ff,\n pop: background: 0x355b6eff,\n border: 0x404040ff,\n text: 0xe5e5e5ff,\n weak: text: 0xa4a4a4ff,\n good: text: 0x32a852ff,\n bad: text: 0xcf5242ff,\n hover: 0xffffffff,\n focus: 0xfda200ff,\n cursor: 0x8aff00ff,\n selection: 0x99ccffff,\n inactive: background: 0x0000002f,\n drop_shadow: 0x0000007f,\n\n good_pop:\n {\n background: 0x2c5b36ff,\n border: 0x568761ff,\n hover: 0xe3f5d3ff,\n weak: text: 0xe3f5d3ff,\n }\n\n bad_pop:\n {\n background: 0x803425ff,\n hover: 0xff825cff,\n }\n\n code_default: 0xcbcbcbff,\n code_symbol: 0x42a2cfff,\n code_type: 0xfec746ff,\n code_local: 0x98bc80ff,\n code_register: 0xb7afd5ff,\n code_keyword: 0xb38d4cff,\n code_delimiter_or_operator: 0x767676ff,\n code_numeric: 0x98abb1ff,\n code_numeric_alt_digit_group: 0x738287ff,\n code_string: 0x98abb1ff,\n code_meta: 0xd96759ff,\n code_comment: 0x717171ff,\n line_info_0: 0x99503dff,\n line_info_1: 0xfe8249ff,\n line_info_2: 0xffba17ff,\n line_info_3: 0xcefd69ff,\n line_info_4: 0x99503dff,\n line_info_5: 0xfe8249ff,\n line_info_6: 0xcefd69ff,\n line_info_7: 0x99503dff,\n thread_0: 0xffcb7fff,\n thread_1: 0xb2ff65ff,\n thread_2: 0xff99e5ff,\n thread_3: 0x6598ffff,\n thread_4: 0x65ffcbff,\n thread_5: 0xff9819ff,\n thread_6: 0x9932ffff,\n thread_7: 0x65ff4cff,\n thread_unwound: 0xb2ccd8ff,\n thread_error: 0xb23219ff,\n breakpoint: 0xa72911ff,\n\n floating:\n {\n background: 0x1b1b1baf,\n background: alt: 0x0000005f,\n border: 0xbfbfbf1f,\n scroll_bar:\n {\n background: 0x3b3b3b5f,\n border: 0x5f5f5f5f,\n }\n }\n\n menu_bar:\n {\n background: 0x2b3740ff,\n border: 0x3e4c57ff,\n }\n\n scroll_bar:\n {\n background: 0x2b2b2bff,\n border: 0x3f3f3fff,\n }\n\n implicit:\n {\n background: 0x00000000,\n border: 0x00000000,\n }\n\n hollow:\n {\n background: 0x00000000,\n border: 0xffffff1f,\n }\n\n tab:\n {\n background: 0x6f5135ff,\n border: 0x8a6e54ff,\n inactive:\n {\n background: 0x2b3740ff,\n border: 0x3e4c57ff,\n }\n }\n\n drop_site:\n {\n background: 0xffffff05,\n border: 0xffffff0f,\n }\n}\n"),
str8_lit_comp("theme:\n{\n background: 0x1b1b1bff,\n alt: background: 0x222222ff,\n pop: background: 0x355b6eff,\n fresh: background: 0x446142ff,\n border: 0x404040ff,\n text: 0xe5e5e5ff,\n weak: text: 0xa4a4a4ff,\n good: text: 0x32a852ff,\n bad: text: 0xcf5242ff,\n hover: 0xffffffff,\n focus: 0xfda200ff,\n cursor: 0x8aff00ff,\n selection: 0x99ccffff,\n inactive: background: 0x0000002f,\n drop_shadow: 0x0000007f,\n\n good_pop:\n {\n background: 0x2c5b36ff,\n border: 0x568761ff,\n hover: 0xe3f5d3ff,\n weak: text: 0xe3f5d3ff,\n }\n\n bad_pop:\n {\n background: 0x803425ff,\n hover: 0xff825cff,\n }\n\n code_default: 0xcbcbcbff,\n code_symbol: 0x42a2cfff,\n code_type: 0xfec746ff,\n code_local: 0x98bc80ff,\n code_register: 0xb7afd5ff,\n code_keyword: 0xb38d4cff,\n code_delimiter_or_operator: 0x767676ff,\n code_numeric: 0x98abb1ff,\n code_numeric_alt_digit_group: 0x738287ff,\n code_string: 0x98abb1ff,\n code_meta: 0xd96759ff,\n code_comment: 0x717171ff,\n line_info_0: 0x99503dff,\n line_info_1: 0xfe8249ff,\n line_info_2: 0xffba17ff,\n line_info_3: 0xcefd69ff,\n line_info_4: 0x99503dff,\n line_info_5: 0xfe8249ff,\n line_info_6: 0xcefd69ff,\n line_info_7: 0x99503dff,\n thread_0: 0xffcb7fff,\n thread_1: 0xb2ff65ff,\n thread_2: 0xff99e5ff,\n thread_3: 0x6598ffff,\n thread_4: 0x65ffcbff,\n thread_5: 0xff9819ff,\n thread_6: 0x9932ffff,\n thread_7: 0x65ff4cff,\n thread_unwound: 0xb2ccd8ff,\n thread_error: 0xb23219ff,\n breakpoint: 0xa72911ff,\n\n floating:\n {\n background: 0x1b1b1baf,\n background: alt: 0x0000005f,\n background: fresh: 0x4461425f,\n border: 0xbfbfbf1f,\n scroll_bar:\n {\n background: 0x3b3b3b5f,\n border: 0x5f5f5f5f,\n }\n }\n\n menu_bar:\n {\n background: 0x2b3740ff,\n border: 0x3e4c57ff,\n }\n\n scroll_bar:\n {\n background: 0x2b2b2bff,\n border: 0x3f3f3fff,\n }\n\n implicit:\n {\n background: 0x00000000,\n border: 0x00000000,\n }\n\n hollow:\n {\n background: 0x00000000,\n border: 0xffffff1f,\n }\n\n tab:\n {\n background: 0x6f5135ff,\n border: 0x8a6e54ff,\n inactive:\n {\n background: 0x2b3740ff,\n border: 0x3e4c57ff,\n }\n }\n\n drop_site:\n {\n background: 0xffffff05,\n border: 0xffffff0f,\n }\n}\n"),
str8_lit_comp(""),
str8_lit_comp(""),
str8_lit_comp(""),
+2
View File
@@ -990,6 +990,7 @@ RD_ThemePresetTable:
background: 0x1b1b1bff,
alt: background: 0x222222ff,
pop: background: 0x355b6eff,
fresh: background: 0x446142ff,
border: 0x404040ff,
text: 0xe5e5e5ff,
weak: text: 0xa4a4a4ff,
@@ -1052,6 +1053,7 @@ RD_ThemePresetTable:
{
background: 0x1b1b1baf,
background: alt: 0x0000005f,
background: fresh: 0x4461425f,
border: 0xbfbfbf1f,
scroll_bar:
{
+314 -257
View File
@@ -3250,262 +3250,332 @@ rd_view_ui(Rng2F32 rect)
{
ProfBeginFunction();
RD_Cfg *view = rd_cfg_from_id(rd_regs()->view);
RD_ViewState *vs = rd_view_state_from_cfg(view);
String8 view_name = view->string;
String8 expr_string = rd_expr_from_cfg(view);
//////////////////////////////
//- rjf: special-case view: "getting started"
//- rjf: searching extension
//
if(0){}
else if(str8_match(view_name, str8_lit("getting_started"), 0))
F32 search_row_open_t = ui_anim(ui_key_from_stringf(ui_key_zero(), "search_row_open_%p", view), !!vs->is_searching);
if(search_row_open_t > 0.001f) RD_Font(RD_FontSlot_Code)
{
Temp scratch = scratch_begin(0, 0);
ui_set_next_flags(UI_BoxFlag_DefaultFocusNav);
UI_Focus(UI_FocusKind_On) UI_WidthFill UI_HeightFill UI_NamedColumn(str8_lit("empty_view"))
UI_Padding(ui_pct(1, 0)) UI_Focus(UI_FocusKind_Null)
//- rjf: clamp cursor
if(vs->search_cursor.column == 0)
{
RD_CfgList targets = rd_cfg_top_level_list_from_string(scratch.arena, str8_lit("target"));
CTRL_EntityList processes = ctrl_entity_list_from_kind(d_state->ctrl_entity_store, CTRL_EntityKind_Process);
//- rjf: icon & info
UI_Padding(ui_em(2.f, 1.f)) UI_TagF("weak")
vs->search_mark = txt_pt(1, 1);
vs->search_cursor = txt_pt(1, vs->search_string_size+1);
}
//- rjf: determine dimensions
F32 search_row_height_target = floor_f32(ui_top_font_size()*2.5f);
F32 search_row_height = search_row_open_t*search_row_height_target;
search_row_height = Min(search_row_height, dim_2f32(rect).y);
rect.y0 += search_row_height;
rect.y0 = floor_f32(rect.y0);
//- rjf: build container
UI_Box *search_row = &ui_nil_box;
UI_PrefHeight(ui_px(search_row_height, 1.f))
{
search_row = ui_build_box_from_stringf(UI_BoxFlag_DrawSideBottom|UI_BoxFlag_DrawDropShadow, "###search");
}
//- rjf: build contents
UI_Parent(search_row) UI_WidthFill UI_HeightFill UI_Focus(vs->is_searching ? UI_FocusKind_On : UI_FocusKind_Off)
{
UI_TextAlignment(UI_TextAlign_Center)
UI_Transparency(1-search_row_open_t)
UI_PrefWidth(ui_em(2.5f, 1.f))
UI_TagF("weak")
RD_Font(RD_FontSlot_Icons)
ui_label(rd_icon_kind_text_table[RD_IconKind_Find]);
RD_LineEditParams params = {0};
{
//- rjf: icon
params.flags |= RD_LineEditFlag_CodeContents;
params.flags |= RD_LineEditFlag_Border;
params.cursor = &vs->search_cursor;
params.mark = &vs->search_mark;
params.edit_buffer = vs->search_buffer;
params.edit_string_size_out = &vs->search_string_size;
params.edit_buffer_size = sizeof(vs->search_buffer);
}
rd_line_editf(&params, "###search");
}
//- rjf: commit string to view
RD_Cfg *search = rd_cfg_child_from_string_or_alloc(view, str8_lit("search"));
rd_cfg_new_replace(search, str8(vs->search_buffer, vs->search_string_size));
}
//////////////////////////////
//- rjf: build main view container
//
UI_Box *view_container = &ui_nil_box;
UI_WidthFill UI_HeightFill
{
view_container = ui_build_box_from_key(0, ui_key_zero());
}
//////////////////////////////
//- rjf: fill view container
//
UI_Parent(view_container)
{
////////////////////////////
//- rjf: special-case view: "getting started"
//
if(0){}
else if(str8_match(view_name, str8_lit("getting_started"), 0))
{
Temp scratch = scratch_begin(0, 0);
ui_set_next_flags(UI_BoxFlag_DefaultFocusNav);
UI_Focus(UI_FocusKind_On) UI_WidthFill UI_HeightFill UI_NamedColumn(str8_lit("empty_view"))
UI_Padding(ui_pct(1, 0)) UI_Focus(UI_FocusKind_Null)
{
RD_CfgList targets = rd_cfg_top_level_list_from_string(scratch.arena, str8_lit("target"));
CTRL_EntityList processes = ctrl_entity_list_from_kind(d_state->ctrl_entity_store, CTRL_EntityKind_Process);
//- rjf: icon & info
UI_Padding(ui_em(2.f, 1.f)) UI_TagF("weak")
{
F32 icon_dim = ui_top_font_size()*10.f;
UI_PrefHeight(ui_px(icon_dim, 1.f))
//- rjf: icon
{
F32 icon_dim = ui_top_font_size()*10.f;
UI_PrefHeight(ui_px(icon_dim, 1.f))
UI_Row
UI_Padding(ui_pct(1, 0))
UI_PrefWidth(ui_px(icon_dim, 1.f))
{
R_Handle texture = rd_state->icon_texture;
Vec2S32 texture_dim = r_size_from_tex2d(texture);
ui_image(texture, R_Tex2DSampleKind_Linear, r2f32p(0, 0, texture_dim.x, texture_dim.y), v4f32(1, 1, 1, 1), 0, str8_lit(""));
}
}
//- rjf: info
UI_Padding(ui_em(2.f, 1.f))
UI_WidthFill UI_PrefHeight(ui_em(2.f, 1.f))
UI_Row
UI_Padding(ui_pct(1, 0))
UI_PrefWidth(ui_px(icon_dim, 1.f))
UI_TextAlignment(UI_TextAlign_Center)
UI_PrefWidth(ui_text_dim(10, 1))
{
R_Handle texture = rd_state->icon_texture;
Vec2S32 texture_dim = r_size_from_tex2d(texture);
ui_image(texture, R_Tex2DSampleKind_Linear, r2f32p(0, 0, texture_dim.x, texture_dim.y), v4f32(1, 1, 1, 1), 0, str8_lit(""));
ui_label(str8_lit(BUILD_TITLE_STRING_LITERAL));
}
}
//- rjf: info
UI_Padding(ui_em(2.f, 1.f))
UI_WidthFill UI_PrefHeight(ui_em(2.f, 1.f))
UI_Row
UI_Padding(ui_pct(1, 0))
UI_TextAlignment(UI_TextAlign_Center)
UI_PrefWidth(ui_text_dim(10, 1))
//- rjf: targets state dependent helper
B32 helper_built = 0;
if(processes.count == 0)
{
ui_label(str8_lit(BUILD_TITLE_STRING_LITERAL));
helper_built = 1;
switch(targets.count)
{
//- rjf: user has no targets. build helper for adding them
case 0:
{
UI_PrefHeight(ui_em(3.75f, 1.f))
UI_Row
UI_Padding(ui_pct(1, 0))
UI_TextAlignment(UI_TextAlign_Center)
UI_PrefWidth(ui_em(22.f, 1.f))
UI_CornerRadius(ui_top_font_size()/2.f)
UI_TagF("pop")
if(ui_clicked(rd_icon_buttonf(RD_IconKind_Add, 0, "Add Target")))
{
rd_cmd(RD_CmdKind_RunCommand, .cmd_name = rd_cmd_kind_info_table[RD_CmdKind_AddTarget].string);
}
}break;
//- rjf: user has 1 target. build helper for launching it
case 1:
{
RD_Cfg *target_cfg = rd_cfg_list_first(&targets);
D_Target target = rd_target_from_cfg(scratch.arena, target_cfg);
String8 target_full_path = target.exe;
String8 target_name = str8_skip_last_slash(target_full_path);
UI_PrefHeight(ui_em(3.75f, 1.f))
UI_Row
UI_Padding(ui_pct(1, 0))
UI_TextAlignment(UI_TextAlign_Center)
UI_PrefWidth(ui_em(22.f, 1.f))
UI_CornerRadius(ui_top_font_size()/2.f)
UI_TagF("good_pop")
{
if(ui_clicked(rd_icon_buttonf(RD_IconKind_Play, 0, "Launch %S", target_name)))
{
rd_cmd(RD_CmdKind_LaunchAndRun, .cfg = target_cfg->id);
}
ui_spacer(ui_em(1.5f, 1));
if(ui_clicked(rd_icon_buttonf(RD_IconKind_StepInto, 0, "Step Into %S", target_name)))
{
rd_cmd(RD_CmdKind_LaunchAndInit, .cfg = target_cfg->id);
}
}
}break;
//- rjf: user has N targets.
default:
{
helper_built = 0;
}break;
}
}
}
//- rjf: targets state dependent helper
B32 helper_built = 0;
if(processes.count == 0)
{
helper_built = 1;
switch(targets.count)
//- rjf: or text
if(helper_built)
{
//- rjf: user has no targets. build helper for adding them
case 0:
{
UI_PrefHeight(ui_em(3.75f, 1.f))
UI_Row
UI_Padding(ui_pct(1, 0))
UI_TextAlignment(UI_TextAlign_Center)
UI_PrefWidth(ui_em(22.f, 1.f))
UI_CornerRadius(ui_top_font_size()/2.f)
UI_TagF("pop")
if(ui_clicked(rd_icon_buttonf(RD_IconKind_Add, 0, "Add Target")))
{
rd_cmd(RD_CmdKind_RunCommand, .cmd_name = rd_cmd_kind_info_table[RD_CmdKind_AddTarget].string);
}
}break;
//- rjf: user has 1 target. build helper for launching it
case 1:
{
RD_Cfg *target_cfg = rd_cfg_list_first(&targets);
D_Target target = rd_target_from_cfg(scratch.arena, target_cfg);
String8 target_full_path = target.exe;
String8 target_name = str8_skip_last_slash(target_full_path);
UI_PrefHeight(ui_em(3.75f, 1.f))
UI_Row
UI_Padding(ui_pct(1, 0))
UI_TextAlignment(UI_TextAlign_Center)
UI_PrefWidth(ui_em(22.f, 1.f))
UI_CornerRadius(ui_top_font_size()/2.f)
UI_TagF("good_pop")
{
if(ui_clicked(rd_icon_buttonf(RD_IconKind_Play, 0, "Launch %S", target_name)))
{
rd_cmd(RD_CmdKind_LaunchAndRun, .cfg = target_cfg->id);
}
ui_spacer(ui_em(1.5f, 1));
if(ui_clicked(rd_icon_buttonf(RD_IconKind_StepInto, 0, "Step Into %S", target_name)))
{
rd_cmd(RD_CmdKind_LaunchAndInit, .cfg = target_cfg->id);
}
}
}break;
//- rjf: user has N targets.
default:
{
helper_built = 0;
}break;
UI_TagF("weak")
UI_PrefHeight(ui_em(2.25f, 1.f))
UI_Row
UI_Padding(ui_pct(1, 0))
UI_TextAlignment(UI_TextAlign_Center)
UI_WidthFill
ui_labelf("- or -");
}
}
//- rjf: or text
if(helper_built)
{
//- rjf: helper text for command lister activation
UI_TagF("weak")
UI_PrefHeight(ui_em(2.25f, 1.f))
UI_Row
UI_Padding(ui_pct(1, 0))
UI_PrefHeight(ui_em(2.25f, 1.f)) UI_Row
UI_PrefWidth(ui_text_dim(10, 1))
UI_TextAlignment(UI_TextAlign_Center)
UI_WidthFill
ui_labelf("- or -");
UI_Padding(ui_pct(1, 0))
{
ui_labelf("use");
UI_TextAlignment(UI_TextAlign_Center) rd_cmd_binding_buttons(rd_cmd_kind_info_table[RD_CmdKind_OpenLister].string);
ui_labelf("to search for commands and options");
}
}
scratch_end(scratch);
}
////////////////////////////
//- rjf: special-case view: pending
//
else if(str8_match(view_name, str8_lit("pending"), 0))
{
Temp scratch = scratch_begin(0, 0);
typedef struct State State;
struct State
{
Arena *deferred_cmd_arena;
RD_CmdList deferred_cmds;
};
State *state = rd_view_state(State);
if(state->deferred_cmd_arena == 0)
{
state->deferred_cmd_arena = rd_push_view_arena();
}
rd_store_view_loading_info(1, 0, 0);
// rjf: any commands sent to this view need to be deferred until loading is complete
for(RD_Cmd *cmd = 0; rd_next_view_cmd(&cmd);)
{
RD_CmdKind kind = rd_cmd_kind_from_string(cmd->name);
switch(kind)
{
default:{}break;
case RD_CmdKind_GoToLine:
case RD_CmdKind_GoToAddress:
case RD_CmdKind_CenterCursor:
case RD_CmdKind_ContainCursor:
{
rd_cmd_list_push_new(state->deferred_cmd_arena, &state->deferred_cmds, cmd->name, cmd->regs);
}break;
}
}
//- rjf: helper text for command lister activation
UI_TagF("weak")
UI_PrefHeight(ui_em(2.25f, 1.f)) UI_Row
UI_PrefWidth(ui_text_dim(10, 1))
UI_TextAlignment(UI_TextAlign_Center)
UI_Padding(ui_pct(1, 0))
// rjf: unpack view's target expression & hash
String8 expr_string = rd_expr_from_cfg(view);
E_Eval eval = e_eval_from_string(scratch.arena, expr_string);
Rng1U64 range = r1u64(0, 1024);
U128 key = rd_key_from_eval_space_range(eval.space, range, 0);
U128 hash = hs_hash_from_key(key, 0);
// rjf: determine if hash's blob is ready, and which viewer to use
B32 data_is_ready = 0;
String8 new_view_name = {0};
{
ui_labelf("use");
UI_TextAlignment(UI_TextAlign_Center) rd_cmd_binding_buttons(rd_cmd_kind_info_table[RD_CmdKind_OpenLister].string);
ui_labelf("to search for commands and options");
}
}
scratch_end(scratch);
}
//////////////////////////////
//- rjf: special-case view: pending
//
else if(str8_match(view_name, str8_lit("pending"), 0))
{
Temp scratch = scratch_begin(0, 0);
typedef struct State State;
struct State
{
Arena *deferred_cmd_arena;
RD_CmdList deferred_cmds;
};
State *state = rd_view_state(State);
if(state->deferred_cmd_arena == 0)
{
state->deferred_cmd_arena = rd_push_view_arena();
}
rd_store_view_loading_info(1, 0, 0);
// rjf: any commands sent to this view need to be deferred until loading is complete
for(RD_Cmd *cmd = 0; rd_next_view_cmd(&cmd);)
{
RD_CmdKind kind = rd_cmd_kind_from_string(cmd->name);
switch(kind)
{
default:{}break;
case RD_CmdKind_GoToLine:
case RD_CmdKind_GoToAddress:
case RD_CmdKind_CenterCursor:
case RD_CmdKind_ContainCursor:
HS_Scope *hs_scope = hs_scope_open();
if(!u128_match(hash, u128_zero()))
{
rd_cmd_list_push_new(state->deferred_cmd_arena, &state->deferred_cmds, cmd->name, cmd->regs);
}break;
}
}
// rjf: unpack view's target expression & hash
String8 expr_string = rd_expr_from_cfg(view);
E_Eval eval = e_eval_from_string(scratch.arena, expr_string);
Rng1U64 range = r1u64(0, 1024);
U128 key = rd_key_from_eval_space_range(eval.space, range, 0);
U128 hash = hs_hash_from_key(key, 0);
// rjf: determine if hash's blob is ready, and which viewer to use
B32 data_is_ready = 0;
String8 new_view_name = {0};
{
HS_Scope *hs_scope = hs_scope_open();
if(!u128_match(hash, u128_zero()))
{
String8 data = hs_data_from_hash(hs_scope, hash);
U64 num_utf8_bytes = 0;
U64 num_unknown_bytes = 0;
for(U64 idx = 0; idx < data.size && idx < range.max;)
{
UnicodeDecode decode = utf8_decode(data.str+idx, data.size-idx);
if(decode.codepoint != max_U32 && (decode.inc > 1 ||
(10 <= decode.codepoint && decode.codepoint <= 13) ||
(32 <= decode.codepoint && decode.codepoint <= 126)))
String8 data = hs_data_from_hash(hs_scope, hash);
U64 num_utf8_bytes = 0;
U64 num_unknown_bytes = 0;
for(U64 idx = 0; idx < data.size && idx < range.max;)
{
num_utf8_bytes += decode.inc;
idx += decode.inc;
UnicodeDecode decode = utf8_decode(data.str+idx, data.size-idx);
if(decode.codepoint != max_U32 && (decode.inc > 1 ||
(10 <= decode.codepoint && decode.codepoint <= 13) ||
(32 <= decode.codepoint && decode.codepoint <= 126)))
{
num_utf8_bytes += decode.inc;
idx += decode.inc;
}
else
{
num_unknown_bytes += 1;
idx += 1;
}
}
data_is_ready = 1;
if(num_utf8_bytes > num_unknown_bytes*4 || num_unknown_bytes == 0)
{
new_view_name = str8_lit("text");
}
else
{
num_unknown_bytes += 1;
idx += 1;
new_view_name = str8_lit("memory");
}
}
data_is_ready = 1;
if(num_utf8_bytes > num_unknown_bytes*4 || num_unknown_bytes == 0)
{
new_view_name = str8_lit("text");
}
else
{
new_view_name = str8_lit("memory");
}
hs_scope_close(hs_scope);
}
hs_scope_close(hs_scope);
}
// rjf: if we don't have a viewer, just use the memory viewer.
if(new_view_name.size != 0)
{
new_view_name = str8_lit("memory");
}
// rjf: if data is ready and we have the name of a new visualizer,
// dispatch deferred commands & change this view's string to be
// that of the new visualizer.
if(data_is_ready && new_view_name.size != 0)
{
for(RD_CmdNode *cmd_node = state->deferred_cmds.first;
cmd_node != 0;
cmd_node = cmd_node->next)
// rjf: if we don't have a viewer, just use the memory viewer.
if(new_view_name.size != 0)
{
RD_Cmd *cmd = &cmd_node->cmd;
rd_push_cmd(cmd->name, cmd->regs);
new_view_name = str8_lit("memory");
}
RD_Cfg *view = rd_cfg_from_id(rd_regs()->view);
rd_cfg_equip_string(view, new_view_name);
// rjf: if data is ready and we have the name of a new visualizer,
// dispatch deferred commands & change this view's string to be
// that of the new visualizer.
if(data_is_ready && new_view_name.size != 0)
{
for(RD_CmdNode *cmd_node = state->deferred_cmds.first;
cmd_node != 0;
cmd_node = cmd_node->next)
{
RD_Cmd *cmd = &cmd_node->cmd;
rd_push_cmd(cmd->name, cmd->regs);
}
RD_Cfg *view = rd_cfg_from_id(rd_regs()->view);
rd_cfg_equip_string(view, new_view_name);
}
// rjf: if we don't have a viewer, for whatever reason, then just
// close the tab.
if(data_is_ready && new_view_name.size == 0)
{
rd_cmd(RD_CmdKind_CloseTab);
}
scratch_end(scratch);
}
// rjf: if we don't have a viewer, for whatever reason, then just
// close the tab.
if(data_is_ready && new_view_name.size == 0)
////////////////////////////
//- rjf: visualizer hook
//
else
{
rd_cmd(RD_CmdKind_CloseTab);
Temp scratch = scratch_begin(0, 0);
RD_ViewUIRule *view_ui_rule = rd_view_ui_rule_from_string(view_name);
E_Eval expr_eval = e_eval_from_string(scratch.arena, expr_string);
E_Expr *tag = rd_tag_from_cfg(scratch.arena, view);
view_ui_rule->ui(expr_eval, tag, rect);
scratch_end(scratch);
}
scratch_end(scratch);
}
//////////////////////////////
//- rjf: visualizer hook
//
else
{
Temp scratch = scratch_begin(0, 0);
RD_ViewUIRule *view_ui_rule = rd_view_ui_rule_from_string(view_name);
E_Eval expr_eval = e_eval_from_string(scratch.arena, expr_string);
E_Expr *tag = rd_tag_from_cfg(scratch.arena, view);
view_ui_rule->ui(expr_eval, tag, rect);
scratch_end(scratch);
}
ProfEnd();
@@ -3541,12 +3611,12 @@ rd_view_eval_view(void)
}
internal String8
rd_view_filter(void)
rd_view_search(void)
{
RD_Cfg *view = rd_cfg_from_id(rd_regs()->view);
RD_Cfg *filter = rd_cfg_child_from_string(view, str8_lit("filter"));
String8 filter_string = filter->first->string;
return filter_string;
RD_Cfg *search = rd_cfg_child_from_string(view, str8_lit("search"));
String8 search_string = search->first->string;
return search_string;
}
internal RD_Cfg *
@@ -5631,9 +5701,11 @@ ws->cfg_palettes[RD_PaletteCode_##name].selection = current->colors[RD_The
//- rjf: unpack query parameters
RD_Cfg *root = query;
RD_Cfg *view = rd_cfg_child_from_string_or_alloc(root, str8_lit("watch"));
rd_cfg_new(view, str8_lit("lister"));
rd_cfg_child_from_string_or_alloc(view, str8_lit("lister"));
RD_ViewState *vs = rd_view_state_from_cfg(view);
vs->is_searching = 1;
RD_Cfg *expr = rd_cfg_child_from_string_or_alloc(view, str8_lit("expression"));
String8 query_expression = str8_lit("query:procedures");
String8 query_expression = str8_lit("procedures");
rd_cfg_new_replace(expr, query_expression);
E_Eval query_eval = e_eval_from_string(scratch.arena, query_expression);
F32 row_height_px = floor_f32(ui_top_font_size()*2.5f);
@@ -5643,7 +5715,7 @@ ws->cfg_palettes[RD_PaletteCode_##name].selection = current->colors[RD_The
{
Vec2F32 content_rect_center = center_2f32(content_rect);
Vec2F32 content_rect_dim = dim_2f32(content_rect);
EV_BlockTree predicted_block_tree = ev_block_tree_from_exprs(scratch.arena, rd_view_eval_view(), str8_zero(), query_eval.exprs);
EV_BlockTree predicted_block_tree = ev_block_tree_from_exprs(scratch.arena, rd_view_eval_view(), rd_view_search(), query_eval.exprs);
F32 query_open_t = ui_anim(ui_key_from_string(ui_key_zero(), str8_lit("query_open_t")), 1.f);
F32 query_width_px = floor_f32(dim_2f32(content_rect).x * 0.35f);
F32 max_query_height_px = content_rect_dim.y*0.8f;
@@ -7070,7 +7142,6 @@ ws->cfg_palettes[RD_PaletteCode_##name].selection = current->colors[RD_The
panel_tree.focused == panel);
RD_Cfg *selected_tab = panel->selected_tab;
RD_ViewState *selected_tab_view_state = rd_view_state_from_cfg(selected_tab);
F32 selected_tab_is_filtering_t = ui_anim(ui_key_from_stringf(ui_key_zero(), "###is_filtering_t_%p", selected_tab), (F32)!!selected_tab_view_state->is_filtering);
ProfScope("leaf panel UI work - %.*s", str8_varg(selected_tab->string))
UI_Focus(panel_is_focused ? UI_FocusKind_Null : UI_FocusKind_Off)
{
@@ -7107,14 +7178,6 @@ ws->cfg_palettes[RD_PaletteCode_##name].selection = current->colors[RD_The
content_rect.y0 = panel_rect.y0;
content_rect.y1 = panel_rect.y1 - tab_bar_vheight;
}
if(selected_tab_is_filtering_t > 0.01f)
{
filter_rect.x0 = content_rect.x0;
filter_rect.y0 = content_rect.y0;
filter_rect.x1 = content_rect.x1;
content_rect.y0 += filter_bar_height*selected_tab_is_filtering_t;
filter_rect.y1 = content_rect.y0;
}
tab_bar_rect = intersect_2f32(tab_bar_rect, panel_rect);
content_rect = intersect_2f32(content_rect, panel_rect);
@@ -7399,7 +7462,7 @@ ws->cfg_palettes[RD_PaletteCode_##name].selection = current->colors[RD_The
UI_Box *loading_overlay_container = &ui_nil_box;
if(build_panel) UI_Parent(panel_box) UI_WidthFill UI_HeightFill
{
loading_overlay_container = ui_build_box_from_key(UI_BoxFlag_FloatingX|UI_BoxFlag_FloatingY, ui_key_zero());
loading_overlay_container = ui_build_box_from_key(UI_BoxFlag_Floating, ui_key_zero());
}
//////////////////////////
@@ -7454,7 +7517,7 @@ ws->cfg_palettes[RD_PaletteCode_##name].selection = current->colors[RD_The
//- rjf: build tab view
UI_Parent(view_container_box) if(selected_tab != &rd_nil_cfg) ProfScope("build tab view")
{
rd_view_ui(content_rect);
rd_view_ui(pad_2f32(content_rect, -1.f));
}
//- rjf: pop interaction registers; commit if this is the selected view
@@ -7470,7 +7533,7 @@ ws->cfg_palettes[RD_PaletteCode_##name].selection = current->colors[RD_The
//
if(build_panel)
{
F32 selected_tab_loading_t = ui_anim(ui_key_from_stringf(ui_key_zero(), "###is_view_loading_%p", selected_tab), selected_tab_view_state->loading_t_target);
F32 selected_tab_loading_t = ui_anim(ui_key_from_stringf(ui_key_zero(), "###is_view_loading_%p", selected_tab), selected_tab_view_state->loading_t_target, .initial = selected_tab_view_state->loading_t_target);
if(selected_tab_loading_t > 0.01f) UI_Parent(loading_overlay_container)
{
rd_loading_overlay(panel_rect, selected_tab_loading_t, selected_tab_view_state->loading_progress_v, selected_tab_view_state->loading_progress_v_target);
@@ -7548,6 +7611,7 @@ ws->cfg_palettes[RD_PaletteCode_##name].selection = current->colors[RD_The
TabTask *last_tab_task = 0;
U64 tab_task_count = 0;
F32 tab_close_width_px = ui_top_font_size()*2.5f;
F32 max_tab_width_px = ui_top_font_size()*20.f;
if(build_panel)
{
for(RD_CfgNode *n = panel->tabs.first; n != 0; n = n->next)
@@ -7561,6 +7625,7 @@ ws->cfg_palettes[RD_PaletteCode_##name].selection = current->colors[RD_The
t->tab = tab;
t->fstrs = rd_title_fstrs_from_cfg(scratch.arena, tab);
t->tab_width = dr_dim_from_fstrs(&t->fstrs).x + tab_close_width_px + ui_top_font_size()*1.f;
t->tab_width = Min(max_tab_width_px, t->tab_width);
SLLQueuePush(first_tab_task, last_tab_task, t);
tab_task_count += 1;
}
@@ -7703,7 +7768,7 @@ ws->cfg_palettes[RD_PaletteCode_##name].selection = current->colors[RD_The
UI_PrefWidth(ui_px(tab_close_width_px, 1.f)) UI_TextAlignment(UI_TextAlign_Center)
RD_Font(RD_FontSlot_Icons)
UI_FontSize(rd_font_size_from_slot(RD_FontSlot_Icons)*0.75f)
UI_TagF("weak")
UI_TagF(".") UI_TagF("weak") UI_TagF("implicit")
UI_CornerRadius00(0)
UI_CornerRadius01(0)
{
@@ -7713,6 +7778,7 @@ ws->cfg_palettes[RD_PaletteCode_##name].selection = current->colors[RD_The
ui_set_next_hover_cursor(OS_Cursor_HandPoint);
UI_Box *close_box = ui_build_box_from_stringf(UI_BoxFlag_Clickable|
UI_BoxFlag_DrawBorder|
UI_BoxFlag_DrawBackground|
UI_BoxFlag_DrawText|
UI_BoxFlag_DrawHotEffects|
UI_BoxFlag_DrawActiveEffects,
@@ -8157,9 +8223,12 @@ ws->cfg_palettes[RD_PaletteCode_##name].selection = current->colors[RD_The
if(box->hot_t > 0.01f) DR_ClipScope(box->rect)
{
Vec4F32 color = hover_color;
color.w *= 0.015f*t;
color.w *= 0.02f*t;
Vec2F32 center = ui_mouse();
Vec2F32 box_dim = dim_2f32(box->rect);
F32 max_dim = Max(box_dim.x, box_dim.y);
F32 radius = box->font_size*12.f;
radius = Min(max_dim, radius);
dr_rect(pad_2f32(r2f32(center, center), radius), color, radius, 0, radius/3.f);
}
}
@@ -14207,26 +14276,14 @@ Z(getting_started)
//- rjf: filtering
case RD_CmdKind_Filter:
{
#if 0 // TODO(rjf): @cfg
RD_View *view = rd_view_from_handle(rd_regs()->view);
RD_Panel *panel = rd_panel_from_handle(rd_regs()->panel);
B32 view_is_tab = 0;
for(RD_View *tab = panel->first_tab_view; !rd_view_is_nil(tab); tab = tab->order_next)
RD_Cfg *view = rd_cfg_from_id(rd_regs()->view);
RD_ViewState *vs = rd_view_state_from_cfg(view);
if(!vs->is_searching)
{
if(rd_view_is_project_filtered(tab)) { continue; }
if(tab == view)
{
view_is_tab = 1;
break;
}
vs->search_cursor = txt_pt(1, 1+vs->search_string_size);
vs->search_mark = txt_pt(1, 1);
}
if(view_is_tab && view->spec->flags & RD_ViewRuleInfoFlag_CanFilter)
{
view->is_filtering ^= 1;
view->query_cursor = txt_pt(1, 1+(S64)view->query_string_size);
view->query_mark = txt_pt(1, 1);
}
#endif
vs->is_searching ^= 1;
}break;
case RD_CmdKind_ClearFilter:
{
+7 -7
View File
@@ -162,12 +162,12 @@ struct RD_ViewState
RD_ArenaExt *last_arena_ext;
void *user_data;
// rjf: filter editing controls
B32 is_filtering;
TxtPt filter_cursor;
TxtPt filter_mark;
U8 filter_buffer[KB(1)];
U64 filter_string_size;
// rjf: search editing controls
B32 is_searching;
TxtPt search_cursor;
TxtPt search_mark;
U8 search_buffer[KB(1)];
U64 search_string_size;
};
typedef struct RD_ViewStateSlot RD_ViewStateSlot;
@@ -1075,7 +1075,7 @@ internal void rd_view_ui(Rng2F32 rect);
internal Arena *rd_view_arena(void);
internal UI_ScrollPt2 rd_view_scroll_pos(void);
internal EV_View *rd_view_eval_view(void);
internal String8 rd_view_filter(void);
internal String8 rd_view_search(void);
internal RD_Cfg *rd_view_cfg_from_string(String8 string);
internal E_Value rd_view_cfg_value_from_string(String8 string);
+14 -10
View File
@@ -844,7 +844,7 @@ rd_watch_pt_from_tbl(EV_BlockRangeList *block_ranges, Vec2S64 tbl)
RD_WatchPt pt = zero_struct;
{
Temp scratch = scratch_begin(0, 0);
EV_Row *row = ev_row_from_num(scratch.arena, rd_view_eval_view(), rd_view_filter(), block_ranges, (U64)tbl.y);
EV_Row *row = ev_row_from_num(scratch.arena, rd_view_eval_view(), rd_view_search(), block_ranges, (U64)tbl.y);
RD_WatchRowInfo row_info = rd_watch_row_info_from_row(scratch.arena, row);
{
S64 x = 0;
@@ -871,7 +871,7 @@ rd_tbl_from_watch_pt(EV_BlockRangeList *block_ranges, RD_WatchPt pt)
{
Temp scratch = scratch_begin(0, 0);
U64 num = ev_num_from_key(block_ranges, pt.key);
EV_Row *row = ev_row_from_num(scratch.arena, rd_view_eval_view(), rd_view_filter(), block_ranges, num);
EV_Row *row = ev_row_from_num(scratch.arena, rd_view_eval_view(), rd_view_search(), block_ranges, num);
RD_WatchRowInfo row_info = rd_watch_row_info_from_row(scratch.arena, row);
tbl.x = 0;
{
@@ -1119,10 +1119,9 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
// rjf: folder / file rows
else if(info.eval.space.kind == E_SpaceKind_FileSystem)
{
DR_FStrParams params = {rd_font_from_slot(RD_FontSlot_Main), rd_raster_flags_from_slot(RD_FontSlot_Main), ui_top_palette()->text, ui_top_font_size()};
E_Type *type = e_type_from_key__cached(info.eval.type_key);
String8 file_path = e_string_from_id(info.eval.value.u64);
DR_FStrList fstrs = rd_title_fstrs_from_file_path(arena, file_path);
E_Type *type = e_type_from_key__cached(info.eval.type_key);
if(str8_match(type->name, str8_lit("folder"), 0))
{
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Expr,
@@ -1476,6 +1475,12 @@ rd_info_from_watch_row_cell(Arena *arena, EV_Row *row, EV_StringFlags string_fla
result.flags |= RD_WatchCellFlag_Button;
result.cmd_name = cmd_name;
}
else if(result.eval.space.kind == E_SpaceKind_FileSystem)
{
String8 file_path = e_string_from_id(result.eval.value.u64);
result.fstrs = rd_title_fstrs_from_file_path(arena, file_path);
result.flags |= RD_WatchCellFlag_Button;
}
}break;
}
@@ -1544,7 +1549,6 @@ RD_VIEW_UI_FUNCTION_DEF(watch)
ewv->initialized = 1;
ewv->text_edit_arena = rd_push_view_arena();
}
B32 is_query = (rd_cfg_child_from_string(rd_cfg_from_id(rd_regs()->view), str8_lit("query")) != &rd_nil_cfg);
//////////////////////////////
//- rjf: unpack arguments
@@ -1554,7 +1558,7 @@ RD_VIEW_UI_FUNCTION_DEF(watch)
S64 num_possible_visible_rows = (S64)(dim_2f32(rect).y/row_height_px);
F32 row_string_max_size_px = dim_2f32(rect).x;
EV_StringFlags string_flags = EV_StringFlag_ReadOnlyDisplayRules;
String8 filter = rd_view_filter();
String8 filter = rd_view_search();
//////////////////////////////
//- rjf: decide if root should be implicit
@@ -2748,7 +2752,7 @@ RD_VIEW_UI_FUNCTION_DEF(watch)
{
if(row_is_fresh)
{
ui_set_next_tag(str8_lit("pop"));
ui_set_next_tag(str8_lit("fresh"));
row_flags |= UI_BoxFlag_DrawBackground;
}
else if(global_row_idx & 1)
@@ -2842,12 +2846,12 @@ RD_VIEW_UI_FUNCTION_DEF(watch)
{
if(cell_info.flags & RD_WatchCellFlag_IsErrored)
{
cell_flags |= UI_BoxFlag_DrawBackground|UI_BoxFlag_DrawBad;
cell_flags |= UI_BoxFlag_DrawBackground;
cell_tag = str8_lit("bad");
}
else if(cell_info.inheritance_tooltip.size != 0)
{
cell_flags |= UI_BoxFlag_DrawBackground|UI_BoxFlag_DrawPop;
cell_flags |= UI_BoxFlag_DrawBackground;
cell_tag = str8_lit("pop");
}
else if(cell_info.cfg->id == rd_get_hover_regs()->cfg &&
@@ -2862,7 +2866,7 @@ RD_VIEW_UI_FUNCTION_DEF(watch)
rgba.w *= 0.2f;
rgba.w *= ui_anim(ui_key_from_stringf(ui_key_zero(), "###cfg_hover_t_%p", cfg), 1.f, .rate = entity_hover_t_rate);
palette = ui_build_palette(ui_top_palette(), .background_pop = rgba);
cell_flags |= UI_BoxFlag_DrawPop|UI_BoxFlag_DrawBackground;
cell_flags |= UI_BoxFlag_DrawBackground;
}
else if(ctrl_handle_match(cell_info.entity->handle, rd_get_hover_regs()->ctrl_entity) &&
rd_state->hover_regs_slot == RD_RegSlot_CtrlEntity)
+20 -37
View File
@@ -371,7 +371,7 @@ rd_title_fstrs_from_ctrl_entity(Arena *arena, CTRL_Entity *entity, B32 include_e
Vec4F32 color = rd_color_from_ctrl_entity(entity);
if(color.w == 0)
{
color = ui_top_palette()->text;
color = ui_color_from_name(str8_lit("text"));
}
Vec4F32 secondary_color = ui_top_palette()->text_weak;
String8 name = rd_name_from_ctrl_entity(arena, entity);
@@ -401,8 +401,9 @@ rd_title_fstrs_from_ctrl_entity(Arena *arena, CTRL_Entity *entity, B32 include_e
entity->kind == CTRL_EntityKind_Process ||
entity->kind == CTRL_EntityKind_Thread) &&
ctrl_entity_tree_is_frozen(entity))
UI_TagF("bad")
{
dr_fstrs_push_new(arena, &result, &params, rd_icon_kind_text_table[RD_IconKind_Locked], .font = rd_font_from_slot(RD_FontSlot_Icons), .raster_flags = rd_raster_flags_from_slot(RD_FontSlot_Icons), .color = ui_top_palette()->background_bad);
dr_fstrs_push_new(arena, &result, &params, rd_icon_kind_text_table[RD_IconKind_Locked], .font = rd_font_from_slot(RD_FontSlot_Icons), .raster_flags = rd_raster_flags_from_slot(RD_FontSlot_Icons), .color = ui_color_from_name(str8_lit("text")));
dr_fstrs_push_new(arena, &result, &params, str8_lit(" "));
}
@@ -585,19 +586,8 @@ rd_loading_overlay(Rng2F32 rect, F32 loading_t, U64 progress_v, U64 progress_v_t
F32 t = pow_f32(sin_f32((F32)rd_state->time_in_seconds / 1.8f), 2.f);
F64 v = 1.f - abs_f32(0.5f - t);
// rjf: colors
Vec4F32 bg_color = rd_rgba_from_theme_color(RD_ThemeColor_BaseBackground);
Vec4F32 bd_color = rd_rgba_from_theme_color(RD_ThemeColor_BaseBorder);
Vec4F32 hl_color = rd_rgba_from_theme_color(RD_ThemeColor_BaseBackgroundPop);
bg_color.w *= loading_t;
bd_color.w *= loading_t;
hl_color.w *= loading_t;
// rjf: grab animation params
F32 bg_work_indicator_t = 1.f;
// rjf: build indicator
UI_CornerRadius(height/3.f)
UI_CornerRadius(height/3.f) UI_Transparency(1-loading_t)
{
// rjf: rects
Rng2F32 indicator_region_rect =
@@ -615,42 +605,35 @@ rd_loading_overlay(Rng2F32 rect, F32 loading_t, U64 progress_v, U64 progress_v_t
indicator_rect = pad_2f32(indicator_rect, -1.f);
// rjf: does the view have loading *progress* info? -> draw extra progress layer
if(progress_v != progress_v_target)
if(progress_v != progress_v_target) UI_TagF("drop_site")
{
F64 pct_done_f64 = ((F64)progress_v/(F64)progress_v_target);
F32 pct_done = (F32)pct_done_f64;
ui_set_next_palette(ui_build_palette(ui_top_palette(), .background = v4f32(1, 1, 1, 0.2f*loading_t)));
ui_set_next_fixed_x(indicator_region_rect.x0);
ui_set_next_fixed_y(indicator_region_rect.y0);
ui_set_next_fixed_width(dim_2f32(indicator_region_rect).x*pct_done);
ui_set_next_fixed_height(dim_2f32(indicator_region_rect).y);
ui_build_box_from_key(UI_BoxFlag_DrawBackground|UI_BoxFlag_FloatingX|UI_BoxFlag_FloatingY, ui_key_zero());
Rng2F32 pct_rect = r2f32p(indicator_region_rect.x0,
indicator_region_rect.y0,
indicator_region_rect.x0 + (indicator_region_rect.x1 - indicator_region_rect.x0)*pct_done,
indicator_region_rect.y1);
UI_Rect(pct_rect)
ui_build_box_from_key(UI_BoxFlag_DrawBackground|UI_BoxFlag_Floating, ui_key_zero());
}
// rjf: fill
ui_set_next_palette(ui_build_palette(ui_top_palette(), .background = hl_color));
ui_set_next_fixed_x(indicator_rect.x0);
ui_set_next_fixed_y(indicator_rect.y0);
ui_set_next_fixed_width(dim_2f32(indicator_rect).x);
ui_set_next_fixed_height(dim_2f32(indicator_rect).y);
ui_build_box_from_key(UI_BoxFlag_DrawBackground|UI_BoxFlag_FloatingX|UI_BoxFlag_FloatingY, ui_key_zero());
UI_TagF("pop") UI_Rect(indicator_rect)
ui_build_box_from_key(UI_BoxFlag_DrawBackground|UI_BoxFlag_Floating, ui_key_zero());
// rjf: animated bar
ui_set_next_palette(ui_build_palette(ui_top_palette(), .border = bd_color, .background = bg_color));
ui_set_next_fixed_x(indicator_region_rect.x0);
ui_set_next_fixed_y(indicator_region_rect.y0);
ui_set_next_fixed_width(dim_2f32(indicator_region_rect).x);
ui_set_next_fixed_height(dim_2f32(indicator_region_rect).y);
UI_Box *box = ui_build_box_from_stringf(UI_BoxFlag_DrawBackground|UI_BoxFlag_DrawBorder|UI_BoxFlag_FloatingX|UI_BoxFlag_FloatingY|UI_BoxFlag_Clickable, "bg_system_status");
UI_Signal sig = ui_signal_from_box(box);
UI_Rect(indicator_region_rect)
{
UI_Box *box = ui_build_box_from_stringf(UI_BoxFlag_DrawBackground|UI_BoxFlag_DrawBorder|UI_BoxFlag_Floating|UI_BoxFlag_Clickable, "bg_system_status");
UI_Signal sig = ui_signal_from_box(box);
}
}
// rjf: build background
UI_WidthFill UI_HeightFill
UI_WidthFill UI_HeightFill UI_Transparency(1-loading_t) UI_BlurSize(10.f*loading_t)
{
ui_set_next_palette(ui_build_palette(ui_top_palette(), .background = bg_color));
ui_set_next_blur_size(10.f*loading_t);
ui_build_box_from_key(UI_BoxFlag_DrawBackground|UI_BoxFlag_DrawBackgroundBlur|UI_BoxFlag_FloatingX|UI_BoxFlag_FloatingY, ui_key_zero());
ui_build_box_from_key(UI_BoxFlag_DrawBackground|UI_BoxFlag_DrawBackgroundBlur|UI_BoxFlag_Floating, ui_key_zero());
}
}
}
+3 -2
View File
@@ -795,7 +795,7 @@ ui_begin_build(OS_Handle window, UI_EventList *events, UI_IconInfo *icon_info, U
ui_state->build_box_count = 0;
ui_state->tooltip_open = 0;
ui_state->ctx_menu_changed = 0;
ui_state->default_animation_rate = 1 - pow_f32(2, (-80.f * ui_state->animation_dt));
ui_state->default_animation_rate = 1 - pow_f32(2, (-70.f * ui_state->animation_dt));
ui_state->tooltip_can_overflow_window = 0;
ui_state->tags_key_stack_top = ui_state->tags_key_stack_free = 0;
ui_state->tags_cache_slots_count = 512;
@@ -2550,11 +2550,11 @@ internal void
ui_box_equip_display_string(UI_Box *box, String8 string)
{
ProfBeginFunction();
Vec4F32 text_color = ui_color_from_name(str8_lit("text"));
box->string = push_str8_copy(ui_build_arena(), string);
box->flags |= UI_BoxFlag_HasDisplayString;
if(box->flags & UI_BoxFlag_DrawText && (box->fastpath_codepoint == 0 || !(box->flags & UI_BoxFlag_DrawTextFastpathCodepoint)))
{
Vec4F32 text_color = ui_color_from_name(str8_lit("text"));
String8 display_string = ui_box_display_string(box);
DR_FStrNode fstr_n = {0, {display_string, {box->font, box->text_raster_flags, text_color, box->font_size, 0, 0}}};
DR_FStrList fstrs = {&fstr_n, &fstr_n, 1};
@@ -2564,6 +2564,7 @@ ui_box_equip_display_string(UI_Box *box, String8 string)
else if(box->flags & UI_BoxFlag_DrawText && box->flags & UI_BoxFlag_DrawTextFastpathCodepoint && box->fastpath_codepoint != 0)
{
Temp scratch = scratch_begin(0, 0);
Vec4F32 text_color = ui_color_from_name(str8_lit("text"));
String8 display_string = ui_box_display_string(box);
String32 fpcp32 = str32(&box->fastpath_codepoint, 1);
String8 fpcp = str8_from_32(scratch.arena, fpcp32);
+22 -26
View File
@@ -383,32 +383,28 @@ typedef U64 UI_BoxFlags;
# define UI_BoxFlag_DrawDropShadow (UI_BoxFlags)(1ull<<27)
# define UI_BoxFlag_DrawBackgroundBlur (UI_BoxFlags)(1ull<<28)
# define UI_BoxFlag_DrawBackground (UI_BoxFlags)(1ull<<29)
# define UI_BoxFlag_DrawAlt (UI_BoxFlags)(1ull<<30)
# define UI_BoxFlag_DrawGood (UI_BoxFlags)(1ull<<31)
# define UI_BoxFlag_DrawBad (UI_BoxFlags)(1ull<<32)
# define UI_BoxFlag_DrawPop (UI_BoxFlags)(1ull<<33)
# define UI_BoxFlag_DrawBorder (UI_BoxFlags)(1ull<<34)
# define UI_BoxFlag_DrawSideTop (UI_BoxFlags)(1ull<<35)
# define UI_BoxFlag_DrawSideBottom (UI_BoxFlags)(1ull<<36)
# define UI_BoxFlag_DrawSideLeft (UI_BoxFlags)(1ull<<37)
# define UI_BoxFlag_DrawSideRight (UI_BoxFlags)(1ull<<38)
# define UI_BoxFlag_DrawText (UI_BoxFlags)(1ull<<39)
# define UI_BoxFlag_DrawTextFastpathCodepoint (UI_BoxFlags)(1ull<<40)
# define UI_BoxFlag_DrawTextWeak (UI_BoxFlags)(1ull<<41)
# define UI_BoxFlag_DrawHotEffects (UI_BoxFlags)(1ull<<42)
# define UI_BoxFlag_DrawActiveEffects (UI_BoxFlags)(1ull<<43)
# define UI_BoxFlag_DrawOverlay (UI_BoxFlags)(1ull<<44)
# define UI_BoxFlag_DrawBucket (UI_BoxFlags)(1ull<<45)
# define UI_BoxFlag_Clip (UI_BoxFlags)(1ull<<46)
# define UI_BoxFlag_AnimatePosX (UI_BoxFlags)(1ull<<47)
# define UI_BoxFlag_AnimatePosY (UI_BoxFlags)(1ull<<48)
# define UI_BoxFlag_DisableTextTrunc (UI_BoxFlags)(1ull<<49)
# define UI_BoxFlag_DisableIDString (UI_BoxFlags)(1ull<<50)
# define UI_BoxFlag_DisableFocusBorder (UI_BoxFlags)(1ull<<51)
# define UI_BoxFlag_DisableFocusOverlay (UI_BoxFlags)(1ull<<52)
# define UI_BoxFlag_HasDisplayString (UI_BoxFlags)(1ull<<53)
# define UI_BoxFlag_HasFuzzyMatchRanges (UI_BoxFlags)(1ull<<54)
# define UI_BoxFlag_RoundChildrenByParent (UI_BoxFlags)(1ull<<55)
# define UI_BoxFlag_DrawBorder (UI_BoxFlags)(1ull<<30)
# define UI_BoxFlag_DrawSideTop (UI_BoxFlags)(1ull<<31)
# define UI_BoxFlag_DrawSideBottom (UI_BoxFlags)(1ull<<32)
# define UI_BoxFlag_DrawSideLeft (UI_BoxFlags)(1ull<<33)
# define UI_BoxFlag_DrawSideRight (UI_BoxFlags)(1ull<<34)
# define UI_BoxFlag_DrawText (UI_BoxFlags)(1ull<<35)
# define UI_BoxFlag_DrawTextFastpathCodepoint (UI_BoxFlags)(1ull<<36)
# define UI_BoxFlag_DrawTextWeak (UI_BoxFlags)(1ull<<37)
# define UI_BoxFlag_DrawHotEffects (UI_BoxFlags)(1ull<<38)
# define UI_BoxFlag_DrawActiveEffects (UI_BoxFlags)(1ull<<39)
# define UI_BoxFlag_DrawOverlay (UI_BoxFlags)(1ull<<40)
# define UI_BoxFlag_DrawBucket (UI_BoxFlags)(1ull<<41)
# define UI_BoxFlag_Clip (UI_BoxFlags)(1ull<<42)
# define UI_BoxFlag_AnimatePosX (UI_BoxFlags)(1ull<<43)
# define UI_BoxFlag_AnimatePosY (UI_BoxFlags)(1ull<<44)
# define UI_BoxFlag_DisableTextTrunc (UI_BoxFlags)(1ull<<45)
# define UI_BoxFlag_DisableIDString (UI_BoxFlags)(1ull<<46)
# define UI_BoxFlag_DisableFocusBorder (UI_BoxFlags)(1ull<<47)
# define UI_BoxFlag_DisableFocusOverlay (UI_BoxFlags)(1ull<<48)
# define UI_BoxFlag_HasDisplayString (UI_BoxFlags)(1ull<<49)
# define UI_BoxFlag_HasFuzzyMatchRanges (UI_BoxFlags)(1ull<<50)
# define UI_BoxFlag_RoundChildrenByParent (UI_BoxFlags)(1ull<<51)
//- rjf: bundles
# define UI_BoxFlag_Clickable (UI_BoxFlag_MouseClickable|UI_BoxFlag_KeyboardClickable)