promote thread freeze state to ctrl entity tree; communicate via msgs for user -> ctrl, and communicate entity state changes back via events for ctrl -> user

This commit is contained in:
Ryan Fleury
2024-09-08 13:09:52 -07:00
parent fee500578a
commit 6cf0c7ee92
7 changed files with 129 additions and 125 deletions
+2 -1
View File
@@ -2166,6 +2166,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, D_CmdList *cmds)
DF_Palette(DF_PaletteCode_ImplicitButton)
{
D_Entity *entity = d_entity_from_handle(ws->entity_ctx_menu_entity);
CTRL_Entity *entity_ctrl = ctrl_entity_from_machine_id_handle(d_state->ctrl_entity_store, entity->ctrl_machine_id, entity->ctrl_handle);
DF_IconKind entity_icon = df_entity_kind_icon_kind_table[entity->kind];
D_EntityKindFlags kind_flags = d_entity_kind_flags_table[entity->kind];
String8 display_name = d_display_string_from_entity(scratch.arena, entity);
@@ -2333,7 +2334,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, D_CmdList *cmds)
// rjf: freezing
if(kind_flags & D_EntityKindFlag_CanFreeze)
{
B32 is_frozen = d_entity_is_frozen(entity);
B32 is_frozen = ctrl_entity_tree_is_frozen(entity_ctrl);
ui_set_next_palette(df_palette_from_code(is_frozen ? DF_PaletteCode_NegativePopButton : DF_PaletteCode_PositivePopButton));
if(is_frozen && ui_clicked(df_icon_buttonf(DF_IconKind_Locked, 0, "Thaw###freeze_thaw")))
{
+2 -1
View File
@@ -5606,6 +5606,7 @@ DF_VIEW_UI_FUNCTION_DEF(scheduler)
idx += 1)
{
D_Entity *entity = items.v[idx].entity;
CTRL_Entity *entity_ctrl = ctrl_entity_from_machine_id_handle(d_state->ctrl_entity_store, entity->ctrl_machine_id, entity->ctrl_handle);
B32 row_is_selected = (cursor.y == (S64)(idx+1));
F32 depth = 0.f;
if(query.size == 0) switch(entity->kind)
@@ -5628,7 +5629,7 @@ DF_VIEW_UI_FUNCTION_DEF(scheduler)
UI_TableCellSized(ui_em(1.5f*depth, 1.f)) {}
UI_TableCellSized(ui_em(2.25f, 1.f)) UI_FocusHot((row_is_selected && cursor.x == 0) ? UI_FocusKind_On : UI_FocusKind_Off)
{
B32 frozen = d_entity_is_frozen(entity);
B32 frozen = ctrl_entity_tree_is_frozen(entity_ctrl);
UI_Palette *palette = ui_top_palette();
if(frozen)
{
+4 -2
View File
@@ -1047,6 +1047,7 @@ df_code_slice(DF_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
{
continue;
}
CTRL_Entity *thread_ctrl = ctrl_entity_from_machine_id_handle(d_state->ctrl_entity_store, thread->ctrl_machine_id, thread->ctrl_handle);
U64 unwind_count = (thread == selected_thread) ? d_regs()->unwind_count : 0;
U64 thread_rip_vaddr = d_query_cached_rip_from_thread_unwind(thread, unwind_count);
D_Entity *process = d_entity_ancestor_from_kind(thread, D_EntityKind_Process);
@@ -1105,7 +1106,7 @@ df_code_slice(DF_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
u->thread_color = color;
u->alive_t = thread->alive_t;
u->is_selected = (thread == selected_thread);
u->is_frozen = d_entity_is_frozen(thread);
u->is_frozen = !!thread_ctrl->is_frozen;
u->do_lines = df_setting_val_from_code(DF_SettingCode_ThreadLines).s32;
u->do_glow = df_setting_val_from_code(DF_SettingCode_ThreadGlow).s32;
ui_box_equip_custom_draw(thread_box, df_thread_box_draw_extensions, u);
@@ -1205,6 +1206,7 @@ df_code_slice(DF_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
{
continue;
}
CTRL_Entity *thread_ctrl = ctrl_entity_from_machine_id_handle(d_state->ctrl_entity_store, thread->ctrl_machine_id, thread->ctrl_handle);
U64 unwind_count = (thread == selected_thread) ? d_regs()->unwind_count : 0;
U64 thread_rip_vaddr = d_query_cached_rip_from_thread_unwind(thread, unwind_count);
D_Entity *process = d_entity_ancestor_from_kind(thread, D_EntityKind_Process);
@@ -1263,7 +1265,7 @@ df_code_slice(DF_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
u->thread_color = color;
u->alive_t = thread->alive_t;
u->is_selected = (thread == selected_thread);
u->is_frozen = d_entity_is_frozen(thread);
u->is_frozen = !!thread_ctrl->is_frozen;
ui_box_equip_custom_draw(thread_box, df_thread_box_draw_extensions, u);
// rjf: fill out progress t (progress into range of current line's