Skip to content

Commit

Permalink
further sketching & setting up for escape-hatch-style view rule uis
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanfleury committed Mar 29, 2024
1 parent 81c79c0 commit f2dd1e3
Show file tree
Hide file tree
Showing 9 changed files with 179 additions and 125 deletions.
50 changes: 18 additions & 32 deletions src/df/core/df_core.mdesk
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@ DF_CfgSrcTable:
////////////////////////////////
//~ rjf: Entity Kind Tables

@table(name)
DF_NameKindTable:
{
{Null}
{EntityName}
{EntityKindName}
}

@table(name name_lower op_delete op_freeze op_edit op_rename op_enable op_cond op_dup lf_mut_user_cfg tr_mut_user_cfg lf_mut_prof_cfg tr_mut_prof_cfg lf_mut_halt lf_mut_dbg tr_mut_halt tr_mut_dbg name_is_code user_lifetime name_label icon_kind display_string)
DF_EntityKindTable:
{
Expand Down Expand Up @@ -81,24 +73,24 @@ DF_EntityKindTable:
@table(name, name_lower, c_type)
DF_CmdParamSlotTable:
{
{Window, window, `DF_Handle`}
{Panel, panel, `DF_Handle`}
{DestPanel, dest_panel, `DF_Handle`}
{PrevView, prev_view, `DF_Handle`}
{View, view, `DF_Handle`}
{Entity, entity, `DF_Handle`}
{EntityList, entity_list, `DF_HandleList`}
{String, string, `String8`}
{FilePath, file_path, `String8`}
{TextPoint, text_point, `TxtPt`}
{CmdSpec, cmd_spec, `struct DF_CmdSpec *`}
{ViewSpec, view_spec, `struct DF_ViewSpec *`}
{VirtualAddr, vaddr, `U64`}
{VirtualOff, voff, `U64`}
{Index, index, `U64`}
{ID, id, `U64`}
{PreferDisassembly, prefer_dasm, `B32`}
{ForceConfirm, force_confirm,`B32`}
{Window window `DF_Handle`}
{Panel panel `DF_Handle`}
{DestPanel dest_panel `DF_Handle`}
{PrevView prev_view `DF_Handle`}
{View view `DF_Handle`}
{Entity entity `DF_Handle`}
{EntityList entity_list `DF_HandleList`}
{String string `String8`}
{FilePath file_path `String8`}
{TextPoint text_point `TxtPt`}
{CmdSpec cmd_spec `struct DF_CmdSpec *`}
{ViewSpec view_spec `struct DF_ViewSpec *`}
{VirtualAddr vaddr `U64`}
{VirtualOff voff `U64`}
{Index index `U64`}
{ID id `U64`}
{PreferDisassembly prefer_dasm `B32`}
{ForceConfirm force_confirm `B32`}
}

@table(name lister_omit q_slot q_ent_kind q_allow_files q_allow_folders q_keep_oi q_select_oi q_is_code q_required canonical_icon string display_name desc search_tags )
Expand Down Expand Up @@ -1706,12 +1698,6 @@ DF_DevToggleTable:
COUNT,
}

@enum DF_NameKind:
{
@expand(DF_NameKindTable, a) `$(a.name)`,
COUNT,
}

@enum DF_CoreCmdKind:
{
@expand(DF_CoreCmdTable, a) `$(a.name)`,
Expand Down
8 changes: 0 additions & 8 deletions src/df/core/generated/df_core.meta.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,6 @@ DF_EntityKind_EndedProcess,
DF_EntityKind_COUNT,
} DF_EntityKind;

typedef enum DF_NameKind
{
DF_NameKind_Null,
DF_NameKind_EntityName,
DF_NameKind_EntityKindName,
DF_NameKind_COUNT,
} DF_NameKind;

typedef enum DF_CoreCmdKind
{
DF_CoreCmdKind_Null,
Expand Down
19 changes: 11 additions & 8 deletions src/df/gfx/df_gfx.c
Original file line number Diff line number Diff line change
Expand Up @@ -9149,7 +9149,7 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
ui_set_next_pref_width(ui_px(params->margin_width_px, 1));
ui_set_next_pref_height(ui_px(params->line_height_px*(dim_1s64(params->line_num_range)+1), 1.f));
ui_set_next_child_layout_axis(Axis2_Y);
margin_container_box = ui_build_box_from_string(UI_BoxFlag_Clickable, str8_lit("margin_container"));
margin_container_box = ui_build_box_from_string(UI_BoxFlag_Clickable*!!(params->flags & DF_CodeSliceFlag_Clickable), str8_lit("margin_container"));
UI_Parent(margin_container_box) UI_PrefHeight(ui_px(params->line_height_px, 1.f))
{
U64 line_idx = 0;
Expand All @@ -9162,7 +9162,7 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
DF_EntityList line_pins = params->line_pins[line_idx];
ui_set_next_hover_cursor(OS_Cursor_HandPoint);
ui_set_next_background_color(v4f32(0, 0, 0, 0));
UI_Box *line_margin_box = ui_build_box_from_stringf(UI_BoxFlag_Clickable|UI_BoxFlag_DrawBackground|UI_BoxFlag_DrawActiveEffects, "line_margin_%I64x", line_num);
UI_Box *line_margin_box = ui_build_box_from_stringf(UI_BoxFlag_Clickable*!!(params->flags & DF_CodeSliceFlag_Clickable)|UI_BoxFlag_DrawBackground|UI_BoxFlag_DrawActiveEffects, "line_margin_%I64x", line_num);
UI_Parent(line_margin_box)
{
//- rjf: build margin thread ip ui
Expand Down Expand Up @@ -9215,7 +9215,7 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
ui_set_next_text_alignment(UI_TextAlign_Center);
UI_Key thread_box_key = ui_key_from_stringf(top_container_box->key, "###ip_%p", thread);
UI_Box *thread_box = ui_build_box_from_key(UI_BoxFlag_DisableTextTrunc|
UI_BoxFlag_Clickable|
UI_BoxFlag_Clickable*!!(params->flags & DF_CodeSliceFlag_Clickable)|
UI_BoxFlag_AnimatePosX|
UI_BoxFlag_DrawText,
thread_box_key);
Expand Down Expand Up @@ -9341,7 +9341,7 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
UI_BoxFlag_DrawHotEffects|
UI_BoxFlag_DrawBorder|
UI_BoxFlag_AnimatePosX|
UI_BoxFlag_Clickable|
UI_BoxFlag_Clickable*!!(params->flags & DF_CodeSliceFlag_Clickable)|
UI_BoxFlag_DisableTextTrunc,
"%S##bp_%p",
df_g_icon_kind_text_table[DF_IconKind_CircleFilled],
Expand Down Expand Up @@ -9408,7 +9408,7 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
UI_BoxFlag_DrawActiveEffects|
UI_BoxFlag_DrawHotEffects|
UI_BoxFlag_DrawBorder|
UI_BoxFlag_Clickable|
UI_BoxFlag_Clickable*!!(params->flags & DF_CodeSliceFlag_Clickable)|
UI_BoxFlag_AnimatePosX|
UI_BoxFlag_DisableTextTrunc,
"%S##watch_%p",
Expand Down Expand Up @@ -9472,7 +9472,7 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
{
ui_set_next_hover_cursor(ctrlified ? OS_Cursor_HandPoint : OS_Cursor_IBar);
ui_set_next_pref_height(ui_px(params->line_height_px*(dim_1s64(params->line_num_range)+1), 1.f));
text_container_box = ui_build_box_from_string(UI_BoxFlag_Clickable, str8_lit("text_container"));
text_container_box = ui_build_box_from_string(UI_BoxFlag_Clickable*!!(params->flags & DF_CodeSliceFlag_Clickable), str8_lit("text_container"));
}

//////////////////////////////
Expand Down Expand Up @@ -9530,7 +9530,7 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
String8 explanation = df_stop_explanation_string_icon_from_ctrl_event(scratch.arena, &stop_event, &icon);
UI_Parent(line_extras_boxes[line_idx]) UI_PrefWidth(ui_children_sum(1)) UI_PrefHeight(ui_px(params->line_height_px, 1.f))
{
UI_Box *box = ui_build_box_from_stringf(UI_BoxFlag_DrawBorder|UI_BoxFlag_Clickable, "###exception_info");
UI_Box *box = ui_build_box_from_stringf(UI_BoxFlag_DrawBorder, "###exception_info");
UI_Parent(box)
{
UI_TextColor(df_rgba_from_theme_color(DF_ThemeColor_FailureBackground))
Expand Down Expand Up @@ -9580,7 +9580,10 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
ui_spacer(ui_em(1.5f, 1.f));
ui_set_next_pref_width(ui_children_sum(1));
UI_Key pin_box_key = ui_key_from_stringf(ui_key_zero(), "###pin_%p", pin);
UI_Box *pin_box = ui_build_box_from_key(UI_BoxFlag_AnimatePos|UI_BoxFlag_Clickable|UI_BoxFlag_DrawHotEffects|UI_BoxFlag_DrawBorder, pin_box_key);
UI_Box *pin_box = ui_build_box_from_key(UI_BoxFlag_AnimatePos|
UI_BoxFlag_Clickable*!!(params->flags & DF_CodeSliceFlag_Clickable)|
UI_BoxFlag_DrawHotEffects|
UI_BoxFlag_DrawBorder, pin_box_key);
UI_Parent(pin_box) UI_PrefWidth(ui_text_dim(10, 1))
{
Vec4F32 pin_color = df_rgba_from_theme_color(DF_ThemeColor_WeakText);
Expand Down
9 changes: 5 additions & 4 deletions src/df/gfx/df_gfx.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ struct DF_ViewSpecInfo
DF_ViewSpecFlags flags;
String8 name;
String8 display_string;
DF_NameKind name_kind;
enum DF_NameKind name_kind;
DF_IconKind icon_kind;
DF_ViewSetupFunctionType *setup_hook;
DF_ViewStringFromStateFunctionType *string_from_state_hook;
Expand Down Expand Up @@ -302,7 +302,7 @@ enum

#define DF_GFX_VIEW_RULE_WHOLE_UI_FUNCTION_SIG(name) void name(struct DF_Window *ws, struct DF_Panel *panel, struct DF_View *view, Rng2F32 rect, DBGI_Scope *dbgi_scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, struct DF_CfgNode *cfg)
#define DF_GFX_VIEW_RULE_WHOLE_UI_FUNCTION_NAME(name) df_gfx_view_rule_whole_ui__##name
#define DF_GFX_VIEW_RULE_WHOLE_UI_FUNCTION_DEF(name) DF_GFX_VIEW_RULE_WHOLW_UI_FUNCTION_SIG(DF_GFX_VIEW_RULE_WHOLE_UI_FUNCTION_NAME(name))
#define DF_GFX_VIEW_RULE_WHOLE_UI_FUNCTION_DEF(name) DF_GFX_VIEW_RULE_WHOLE_UI_FUNCTION_SIG(DF_GFX_VIEW_RULE_WHOLE_UI_FUNCTION_NAME(name))

typedef DF_GFX_VIEW_RULE_VIZ_ROW_PROD_FUNCTION_SIG(DF_GfxViewRuleVizRowProdHookFunctionType);
typedef DF_GFX_VIEW_RULE_LINE_STRINGIZE_FUNCTION_SIG(DF_GfxViewRuleLineStringizeHookFunctionType);
Expand Down Expand Up @@ -383,8 +383,9 @@ enum
typedef U32 DF_CodeSliceFlags;
enum
{
DF_CodeSliceFlag_Margin = (1<<0),
DF_CodeSliceFlag_LineNums = (1<<1),
DF_CodeSliceFlag_Clickable = (1<<0),
DF_CodeSliceFlag_Margin = (1<<1),
DF_CodeSliceFlag_LineNums = (1<<2),
};

typedef struct DF_CodeSliceParams DF_CodeSliceParams;
Expand Down
Loading

0 comments on commit f2dd1e3

Please sign in to comment.