Skip to content

Commit f2dd1e3

Browse files
committed
further sketching & setting up for escape-hatch-style view rule uis
1 parent 81c79c0 commit f2dd1e3

File tree

9 files changed

+179
-125
lines changed

9 files changed

+179
-125
lines changed

src/df/core/df_core.mdesk

+18-32
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,6 @@ DF_CfgSrcTable:
1616
////////////////////////////////
1717
//~ rjf: Entity Kind Tables
1818

19-
@table(name)
20-
DF_NameKindTable:
21-
{
22-
{Null}
23-
{EntityName}
24-
{EntityKindName}
25-
}
26-
2719
@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)
2820
DF_EntityKindTable:
2921
{
@@ -81,24 +73,24 @@ DF_EntityKindTable:
8173
@table(name, name_lower, c_type)
8274
DF_CmdParamSlotTable:
8375
{
84-
{Window, window, `DF_Handle`}
85-
{Panel, panel, `DF_Handle`}
86-
{DestPanel, dest_panel, `DF_Handle`}
87-
{PrevView, prev_view, `DF_Handle`}
88-
{View, view, `DF_Handle`}
89-
{Entity, entity, `DF_Handle`}
90-
{EntityList, entity_list, `DF_HandleList`}
91-
{String, string, `String8`}
92-
{FilePath, file_path, `String8`}
93-
{TextPoint, text_point, `TxtPt`}
94-
{CmdSpec, cmd_spec, `struct DF_CmdSpec *`}
95-
{ViewSpec, view_spec, `struct DF_ViewSpec *`}
96-
{VirtualAddr, vaddr, `U64`}
97-
{VirtualOff, voff, `U64`}
98-
{Index, index, `U64`}
99-
{ID, id, `U64`}
100-
{PreferDisassembly, prefer_dasm, `B32`}
101-
{ForceConfirm, force_confirm,`B32`}
76+
{Window window `DF_Handle`}
77+
{Panel panel `DF_Handle`}
78+
{DestPanel dest_panel `DF_Handle`}
79+
{PrevView prev_view `DF_Handle`}
80+
{View view `DF_Handle`}
81+
{Entity entity `DF_Handle`}
82+
{EntityList entity_list `DF_HandleList`}
83+
{String string `String8`}
84+
{FilePath file_path `String8`}
85+
{TextPoint text_point `TxtPt`}
86+
{CmdSpec cmd_spec `struct DF_CmdSpec *`}
87+
{ViewSpec view_spec `struct DF_ViewSpec *`}
88+
{VirtualAddr vaddr `U64`}
89+
{VirtualOff voff `U64`}
90+
{Index index `U64`}
91+
{ID id `U64`}
92+
{PreferDisassembly prefer_dasm `B32`}
93+
{ForceConfirm force_confirm `B32`}
10294
}
10395

10496
@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 )
@@ -1706,12 +1698,6 @@ DF_DevToggleTable:
17061698
COUNT,
17071699
}
17081700

1709-
@enum DF_NameKind:
1710-
{
1711-
@expand(DF_NameKindTable, a) `$(a.name)`,
1712-
COUNT,
1713-
}
1714-
17151701
@enum DF_CoreCmdKind:
17161702
{
17171703
@expand(DF_CoreCmdTable, a) `$(a.name)`,

src/df/core/generated/df_core.meta.h

-8
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,6 @@ DF_EntityKind_EndedProcess,
4646
DF_EntityKind_COUNT,
4747
} DF_EntityKind;
4848

49-
typedef enum DF_NameKind
50-
{
51-
DF_NameKind_Null,
52-
DF_NameKind_EntityName,
53-
DF_NameKind_EntityKindName,
54-
DF_NameKind_COUNT,
55-
} DF_NameKind;
56-
5749
typedef enum DF_CoreCmdKind
5850
{
5951
DF_CoreCmdKind_Null,

src/df/gfx/df_gfx.c

+11-8
Original file line numberDiff line numberDiff line change
@@ -9149,7 +9149,7 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
91499149
ui_set_next_pref_width(ui_px(params->margin_width_px, 1));
91509150
ui_set_next_pref_height(ui_px(params->line_height_px*(dim_1s64(params->line_num_range)+1), 1.f));
91519151
ui_set_next_child_layout_axis(Axis2_Y);
9152-
margin_container_box = ui_build_box_from_string(UI_BoxFlag_Clickable, str8_lit("margin_container"));
9152+
margin_container_box = ui_build_box_from_string(UI_BoxFlag_Clickable*!!(params->flags & DF_CodeSliceFlag_Clickable), str8_lit("margin_container"));
91539153
UI_Parent(margin_container_box) UI_PrefHeight(ui_px(params->line_height_px, 1.f))
91549154
{
91559155
U64 line_idx = 0;
@@ -9162,7 +9162,7 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
91629162
DF_EntityList line_pins = params->line_pins[line_idx];
91639163
ui_set_next_hover_cursor(OS_Cursor_HandPoint);
91649164
ui_set_next_background_color(v4f32(0, 0, 0, 0));
9165-
UI_Box *line_margin_box = ui_build_box_from_stringf(UI_BoxFlag_Clickable|UI_BoxFlag_DrawBackground|UI_BoxFlag_DrawActiveEffects, "line_margin_%I64x", line_num);
9165+
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);
91669166
UI_Parent(line_margin_box)
91679167
{
91689168
//- rjf: build margin thread ip ui
@@ -9215,7 +9215,7 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
92159215
ui_set_next_text_alignment(UI_TextAlign_Center);
92169216
UI_Key thread_box_key = ui_key_from_stringf(top_container_box->key, "###ip_%p", thread);
92179217
UI_Box *thread_box = ui_build_box_from_key(UI_BoxFlag_DisableTextTrunc|
9218-
UI_BoxFlag_Clickable|
9218+
UI_BoxFlag_Clickable*!!(params->flags & DF_CodeSliceFlag_Clickable)|
92199219
UI_BoxFlag_AnimatePosX|
92209220
UI_BoxFlag_DrawText,
92219221
thread_box_key);
@@ -9341,7 +9341,7 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
93419341
UI_BoxFlag_DrawHotEffects|
93429342
UI_BoxFlag_DrawBorder|
93439343
UI_BoxFlag_AnimatePosX|
9344-
UI_BoxFlag_Clickable|
9344+
UI_BoxFlag_Clickable*!!(params->flags & DF_CodeSliceFlag_Clickable)|
93459345
UI_BoxFlag_DisableTextTrunc,
93469346
"%S##bp_%p",
93479347
df_g_icon_kind_text_table[DF_IconKind_CircleFilled],
@@ -9408,7 +9408,7 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
94089408
UI_BoxFlag_DrawActiveEffects|
94099409
UI_BoxFlag_DrawHotEffects|
94109410
UI_BoxFlag_DrawBorder|
9411-
UI_BoxFlag_Clickable|
9411+
UI_BoxFlag_Clickable*!!(params->flags & DF_CodeSliceFlag_Clickable)|
94129412
UI_BoxFlag_AnimatePosX|
94139413
UI_BoxFlag_DisableTextTrunc,
94149414
"%S##watch_%p",
@@ -9472,7 +9472,7 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
94729472
{
94739473
ui_set_next_hover_cursor(ctrlified ? OS_Cursor_HandPoint : OS_Cursor_IBar);
94749474
ui_set_next_pref_height(ui_px(params->line_height_px*(dim_1s64(params->line_num_range)+1), 1.f));
9475-
text_container_box = ui_build_box_from_string(UI_BoxFlag_Clickable, str8_lit("text_container"));
9475+
text_container_box = ui_build_box_from_string(UI_BoxFlag_Clickable*!!(params->flags & DF_CodeSliceFlag_Clickable), str8_lit("text_container"));
94769476
}
94779477

94789478
//////////////////////////////
@@ -9530,7 +9530,7 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
95309530
String8 explanation = df_stop_explanation_string_icon_from_ctrl_event(scratch.arena, &stop_event, &icon);
95319531
UI_Parent(line_extras_boxes[line_idx]) UI_PrefWidth(ui_children_sum(1)) UI_PrefHeight(ui_px(params->line_height_px, 1.f))
95329532
{
9533-
UI_Box *box = ui_build_box_from_stringf(UI_BoxFlag_DrawBorder|UI_BoxFlag_Clickable, "###exception_info");
9533+
UI_Box *box = ui_build_box_from_stringf(UI_BoxFlag_DrawBorder, "###exception_info");
95349534
UI_Parent(box)
95359535
{
95369536
UI_TextColor(df_rgba_from_theme_color(DF_ThemeColor_FailureBackground))
@@ -9580,7 +9580,10 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
95809580
ui_spacer(ui_em(1.5f, 1.f));
95819581
ui_set_next_pref_width(ui_children_sum(1));
95829582
UI_Key pin_box_key = ui_key_from_stringf(ui_key_zero(), "###pin_%p", pin);
9583-
UI_Box *pin_box = ui_build_box_from_key(UI_BoxFlag_AnimatePos|UI_BoxFlag_Clickable|UI_BoxFlag_DrawHotEffects|UI_BoxFlag_DrawBorder, pin_box_key);
9583+
UI_Box *pin_box = ui_build_box_from_key(UI_BoxFlag_AnimatePos|
9584+
UI_BoxFlag_Clickable*!!(params->flags & DF_CodeSliceFlag_Clickable)|
9585+
UI_BoxFlag_DrawHotEffects|
9586+
UI_BoxFlag_DrawBorder, pin_box_key);
95849587
UI_Parent(pin_box) UI_PrefWidth(ui_text_dim(10, 1))
95859588
{
95869589
Vec4F32 pin_color = df_rgba_from_theme_color(DF_ThemeColor_WeakText);

src/df/gfx/df_gfx.h

+5-4
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ struct DF_ViewSpecInfo
113113
DF_ViewSpecFlags flags;
114114
String8 name;
115115
String8 display_string;
116-
DF_NameKind name_kind;
116+
enum DF_NameKind name_kind;
117117
DF_IconKind icon_kind;
118118
DF_ViewSetupFunctionType *setup_hook;
119119
DF_ViewStringFromStateFunctionType *string_from_state_hook;
@@ -302,7 +302,7 @@ enum
302302

303303
#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)
304304
#define DF_GFX_VIEW_RULE_WHOLE_UI_FUNCTION_NAME(name) df_gfx_view_rule_whole_ui__##name
305-
#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))
305+
#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))
306306

307307
typedef DF_GFX_VIEW_RULE_VIZ_ROW_PROD_FUNCTION_SIG(DF_GfxViewRuleVizRowProdHookFunctionType);
308308
typedef DF_GFX_VIEW_RULE_LINE_STRINGIZE_FUNCTION_SIG(DF_GfxViewRuleLineStringizeHookFunctionType);
@@ -383,8 +383,9 @@ enum
383383
typedef U32 DF_CodeSliceFlags;
384384
enum
385385
{
386-
DF_CodeSliceFlag_Margin = (1<<0),
387-
DF_CodeSliceFlag_LineNums = (1<<1),
386+
DF_CodeSliceFlag_Clickable = (1<<0),
387+
DF_CodeSliceFlag_Margin = (1<<1),
388+
DF_CodeSliceFlag_LineNums = (1<<2),
388389
};
389390

390391
typedef struct DF_CodeSliceParams DF_CodeSliceParams;

0 commit comments

Comments
 (0)