Skip to content

Commit 8901dd3

Browse files
committed
eliminate old pending entity code; do not build missing entity interface if data is actually present (but frontend cache still suggests missing)
1 parent e1a5d13 commit 8901dd3

File tree

2 files changed

+3
-66
lines changed

2 files changed

+3
-66
lines changed

src/df/gfx/df_views.c

+3-65
Original file line numberDiff line numberDiff line change
@@ -5356,24 +5356,6 @@ DF_VIEW_CMD_FUNCTION_DEF(PendingEntity)
53565356
{
53575357
default:break;
53585358

5359-
// rjf: pick file
5360-
case DF_CoreCmdKind_PickFile:
5361-
{
5362-
DF_Entity *missing_file = df_entity_from_handle(pves->pick_file_override_target);
5363-
String8 pick_string = cmd->params.file_path;
5364-
if(!df_entity_is_nil(missing_file) && pick_string.size != 0)
5365-
{
5366-
DF_Entity *replacement = df_entity_from_path(pick_string, DF_EntityFromPathFlag_OpenAsNeeded|DF_EntityFromPathFlag_OpenMissing);
5367-
view->entity = df_handle_from_entity(replacement);
5368-
DF_CmdParams p = df_cmd_params_from_view(ws, panel, view);
5369-
p.entity = df_handle_from_entity(missing_file);
5370-
p.file_path = pick_string;
5371-
df_cmd_params_mark_slot(&p, DF_CmdParamSlot_Entity);
5372-
df_cmd_params_mark_slot(&p, DF_CmdParamSlot_FilePath);
5373-
df_push_cmd__root(&p, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_SetFileReplacementPath));
5374-
}
5375-
}break;
5376-
53775359
// rjf: gather deferred commands to redispatch when entity is ready
53785360
case DF_CoreCmdKind_GoToLine:
53795361
case DF_CoreCmdKind_GoToAddress:
@@ -5442,52 +5424,8 @@ DF_VIEW_CMD_FUNCTION_DEF(PendingEntity)
54425424

54435425
DF_VIEW_UI_FUNCTION_DEF(PendingEntity)
54445426
{
5445-
// rjf: grab state
5446-
DF_PendingEntityViewState *pves = df_view_user_state(view, DF_PendingEntityViewState);
5447-
DF_Entity *entity = df_entity_from_handle(view->entity);
5448-
5449-
// rjf: entity is missing -> notify user
5450-
if(entity->flags & DF_EntityFlag_IsMissing)
5451-
{
5452-
UI_WidthFill UI_HeightFill UI_Column UI_Padding(ui_pct(1, 0))
5453-
{
5454-
Temp scratch = scratch_begin(0, 0);
5455-
String8 full_path = df_full_path_from_entity(scratch.arena, entity);
5456-
UI_PrefWidth(ui_children_sum(1)) UI_PrefHeight(ui_em(3, 1))
5457-
UI_Row UI_Padding(ui_pct(1, 0))
5458-
UI_PrefWidth(ui_text_dim(10, 1))
5459-
UI_TextColor(df_rgba_from_theme_color(DF_ThemeColor_FailureBackground))
5460-
{
5461-
UI_Font(ui_icon_font()) ui_label(df_g_icon_kind_text_table[DF_IconKind_WarningBig]);
5462-
ui_labelf("Could not find \"%S\".", full_path);
5463-
}
5464-
UI_PrefHeight(ui_em(3, 1))
5465-
UI_Row UI_Padding(ui_pct(1, 0))
5466-
UI_PrefWidth(ui_text_dim(10, 1))
5467-
UI_TextColor(df_rgba_from_theme_color(DF_ThemeColor_ActionText))
5468-
UI_BackgroundColor(df_rgba_from_theme_color(DF_ThemeColor_ActionBackground))
5469-
UI_BorderColor(df_rgba_from_theme_color(DF_ThemeColor_ActionBorder))
5470-
UI_CornerRadius(ui_top_font_size()/3)
5471-
UI_PrefWidth(ui_text_dim(10, 1))
5472-
UI_Focus(UI_FocusKind_On)
5473-
if(ui_clicked(ui_buttonf("Find alternative...")))
5474-
{
5475-
DF_CmdParams params = df_cmd_params_from_view(ws, panel, view);
5476-
params.cmd_spec = df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_PickFile);
5477-
df_cmd_params_mark_slot(&params, DF_CmdParamSlot_CmdSpec);
5478-
df_push_cmd__root(&params, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_RunCommand));
5479-
pves->pick_file_override_target = df_handle_from_entity(entity);
5480-
}
5481-
scratch_end(scratch);
5482-
}
5483-
}
5484-
5485-
// rjf: entity is still loading -> loading animation
5486-
else
5487-
{
5488-
view->loading_t = view->loading_t_target = 1.f;
5489-
df_gfx_request_frame();
5490-
}
5427+
view->loading_t = view->loading_t_target = 1.f;
5428+
df_gfx_request_frame();
54915429
}
54925430

54935431
////////////////////////////////
@@ -5950,7 +5888,7 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
59505888
//////////////////////////////
59515889
//- rjf: build missing & override interface
59525890
//
5953-
if(entity_is_missing)
5891+
if(entity_is_missing && !text_info_is_ready)
59545892
{
59555893
UI_WidthFill UI_HeightFill UI_Column UI_Padding(ui_pct(1, 0))
59565894
{

src/df/gfx/df_views.h

-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ struct DF_PendingEntityViewState
101101
{
102102
Arena *deferred_cmd_arena;
103103
DF_CmdList deferred_cmds;
104-
DF_Handle pick_file_override_target;
105104
Arena *complete_cfg_arena;
106105
DF_CfgNode *complete_cfg_root;
107106
};

0 commit comments

Comments
 (0)