mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-15 08:32:22 -07:00
set up auto view rule entities, serialization, & editor ui, for automatically mapping specific types to specific view rules
This commit is contained in:
@@ -5877,6 +5877,35 @@ df_cfg_strings_from_core(Arena *arena, String8 root_path, DF_CfgSrc source)
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: write auto view rules
|
||||
{
|
||||
B32 first = 1;
|
||||
DF_EntityList avrs = df_query_cached_entity_list_with_kind(DF_EntityKind_AutoViewRule);
|
||||
for(DF_EntityNode *n = avrs.first; n != 0; n = n->next)
|
||||
{
|
||||
DF_Entity *map = n->entity;
|
||||
if(map->cfg_src == source)
|
||||
{
|
||||
if(first)
|
||||
{
|
||||
first = 0;
|
||||
str8_list_push(arena, &strs, str8_lit("/// auto view rules ///////////////////////////////////////////////////////////\n"));
|
||||
str8_list_push(arena, &strs, str8_lit("\n"));
|
||||
}
|
||||
String8 type = df_entity_child_from_kind(map, DF_EntityKind_Source)->name;
|
||||
String8 view_rule = df_entity_child_from_kind(map, DF_EntityKind_Dest)->name;
|
||||
type = df_cfg_escaped_from_raw_string(arena, type);
|
||||
view_rule= df_cfg_escaped_from_raw_string(arena, view_rule);
|
||||
str8_list_push (arena, &strs, str8_lit("auto_view_rule:\n"));
|
||||
str8_list_push (arena, &strs, str8_lit("{\n"));
|
||||
str8_list_pushf(arena, &strs, " type: \"%S\"\n", type);
|
||||
str8_list_pushf(arena, &strs, " view_rule: \"%S\"\n", view_rule);
|
||||
str8_list_push (arena, &strs, str8_lit("}\n"));
|
||||
str8_list_push (arena, &strs, str8_lit("\n"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: write breakpoints
|
||||
{
|
||||
B32 first = 1;
|
||||
@@ -7888,6 +7917,29 @@ df_core_begin_frame(Arena *arena, DF_CmdList *cmds, F32 dt)
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: apply auto view rules
|
||||
DF_CfgVal *avrs = df_cfg_val_from_string(table, str8_lit("auto_view_rule"));
|
||||
for(DF_CfgNode *map = avrs->first;
|
||||
map != &df_g_nil_cfg_node;
|
||||
map = map->next)
|
||||
{
|
||||
if(map->source == src)
|
||||
{
|
||||
DF_CfgNode *src_cfg = df_cfg_node_child_from_string(map, str8_lit("type"), StringMatchFlag_CaseInsensitive);
|
||||
DF_CfgNode *dst_cfg = df_cfg_node_child_from_string(map, str8_lit("view_rule"), StringMatchFlag_CaseInsensitive);
|
||||
String8 type = src_cfg->first->string;
|
||||
String8 view_rule = dst_cfg->first->string;
|
||||
type = df_cfg_raw_from_escaped_string(scratch.arena, type);
|
||||
view_rule = df_cfg_raw_from_escaped_string(scratch.arena, view_rule);
|
||||
DF_Entity *map_entity = df_entity_alloc(0, df_entity_root(), DF_EntityKind_AutoViewRule);
|
||||
DF_Entity *src_entity = df_entity_alloc(0, map_entity, DF_EntityKind_Source);
|
||||
DF_Entity *dst_entity = df_entity_alloc(0, map_entity, DF_EntityKind_Dest);
|
||||
df_entity_equip_name(0, src_entity, type);
|
||||
df_entity_equip_name(0, dst_entity, view_rule);
|
||||
df_entity_equip_cfg_src(map_entity, src);
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: apply breakpoints
|
||||
DF_CfgVal *bps = df_cfg_val_from_string(table, str8_lit("breakpoint"));
|
||||
for(DF_CfgNode *bp = bps->first;
|
||||
@@ -8224,6 +8276,37 @@ df_core_begin_frame(Arena *arena, DF_CmdList *cmds, F32 dt)
|
||||
}
|
||||
}break;
|
||||
|
||||
//- rjf: auto view rules
|
||||
case DF_CoreCmdKind_SetAutoViewRuleType:
|
||||
case DF_CoreCmdKind_SetAutoViewRuleViewRule:
|
||||
{
|
||||
DF_Entity *map = df_entity_from_handle(params.entity);
|
||||
if(df_entity_is_nil(map))
|
||||
{
|
||||
map = df_entity_alloc(df_state_delta_history(), df_entity_root(), DF_EntityKind_AutoViewRule);
|
||||
df_entity_equip_cfg_src(map, DF_CfgSrc_Profile);
|
||||
}
|
||||
DF_Entity *src = df_entity_child_from_kind(map, DF_EntityKind_Source);
|
||||
if(df_entity_is_nil(src))
|
||||
{
|
||||
src = df_entity_alloc(df_state_delta_history(), map, DF_EntityKind_Source);
|
||||
}
|
||||
DF_Entity *dst = df_entity_child_from_kind(map, DF_EntityKind_Dest);
|
||||
if(df_entity_is_nil(dst))
|
||||
{
|
||||
dst = df_entity_alloc(df_state_delta_history(), map, DF_EntityKind_Dest);
|
||||
}
|
||||
if(map->kind == DF_EntityKind_AutoViewRule)
|
||||
{
|
||||
DF_Entity *edit_child = (core_cmd_kind == DF_CoreCmdKind_SetAutoViewRuleType ? src : dst);
|
||||
df_entity_equip_name(df_state_delta_history(), edit_child, params.string);
|
||||
}
|
||||
if(src->name.size == 0 && dst->name.size == 0)
|
||||
{
|
||||
df_entity_mark_for_deletion(map);
|
||||
}
|
||||
}break;
|
||||
|
||||
//- rjf: general entity operations
|
||||
case DF_CoreCmdKind_EnableEntity:
|
||||
case DF_CoreCmdKind_EnableBreakpoint:
|
||||
|
||||
@@ -28,6 +28,9 @@ DF_EntityKindTable:
|
||||
{OverrideFileLink override_file_link 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 "Label" FileOutline "Override File Link" }
|
||||
{PendingFileChange pending_file_change 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 "Label" FileOutline "Pending File Change" }
|
||||
|
||||
//- rjf: auto view rules
|
||||
{AutoViewRule auto_view_rule 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 "Label" Binoculars "Auto View Rule" }
|
||||
|
||||
//- rjf: diagnostics log
|
||||
{DiagLog diag_log 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 "Label" FileOutline "Diagnostics Log" }
|
||||
|
||||
@@ -222,6 +225,10 @@ DF_CoreCmdTable:// | | |
|
||||
{SetFileOverrideLinkDst 1 Null Nil 0 0 0 0 0 0 Null "set_file_override_link_dst" "Set File Override Link Destination" "Sets the destination path for an override file link." "" }
|
||||
{SetFileReplacementPath 1 Null Nil 0 0 0 0 0 0 Null "set_file_replacement_path" "Set File Replacement Path" "Sets the path which should be used as the replacement for the passed file." "" }
|
||||
|
||||
//- rjf: auto view rules
|
||||
{SetAutoViewRuleType 1 Null Nil 0 0 0 0 0 0 Null "set_auto_view_rule_type" "Set Auto View Rule Type" "Sets the type for an auto view rule." "" }
|
||||
{SetAutoViewRuleViewRule 1 Null Nil 0 0 0 0 0 0 Null "set_auto_view_rule_view_rule""Set Auto View Rule View Rule" "Sets the view rule string for an auto view rule." "" }
|
||||
|
||||
//- rjf: setting config paths
|
||||
{OpenUser 0 FilePath Nil 1 0 0 0 0 1 Person "open_user" "Open User" "Opens a user file path, immediately loading it, and begins autosaving to it." "load,user,profile,layout" }
|
||||
{OpenProfile 0 FilePath Nil 1 0 0 0 0 1 Briefcase "open_profile" "Open Profile" "Opens a profile file path, immediately loading it, and begins autosaving to it." "profile,project,session" }
|
||||
@@ -355,6 +362,7 @@ DF_CoreCmdTable:// | | |
|
||||
{Target 1 Null Nil 0 0 0 0 0 0 Target "target" "Target" "Opens the editor for a target." "" }
|
||||
{Targets 0 Null Nil 0 0 0 0 0 0 Target "targets" "Targets" "Opens the list of all targets." "" }
|
||||
{FilePathMap 0 Null Nil 0 0 0 0 0 0 FileOutline "file_path_map" "File Path Map" "Opens the file path mapping editor." "" }
|
||||
{AutoViewRules 0 Null Nil 0 0 0 0 0 0 Binoculars "auto_view_rules" "Auto View Rules" "Opens the auto view rule editor." "" }
|
||||
{Scheduler 0 Null Nil 0 0 0 0 0 0 Scheduler "scheduler" "Scheduler" "Opens the scheduler view, for process and thread controls." "threads,processes,targets" }
|
||||
{CallStack 0 Null Nil 0 0 0 0 0 0 Thread "call_stack" "Call Stack" "Opens the call stack view." "callstack,thread" }
|
||||
{Modules 0 Null Nil 0 0 0 0 0 0 Module "modules" "Modules" "Opens the modules view." "" }
|
||||
|
||||
@@ -27,7 +27,7 @@ Rng1U64 df_g_cmd_param_slot_range_table[19] =
|
||||
{OffsetOf(DF_CmdParams, force_confirm), OffsetOf(DF_CmdParams, force_confirm) + sizeof(B32)},
|
||||
};
|
||||
|
||||
DF_IconKind df_g_entity_kind_icon_kind_table[26] =
|
||||
DF_IconKind df_g_entity_kind_icon_kind_table[27] =
|
||||
{
|
||||
DF_IconKind_Null,
|
||||
DF_IconKind_Null,
|
||||
@@ -35,6 +35,7 @@ DF_IconKind_Machine,
|
||||
DF_IconKind_FileOutline,
|
||||
DF_IconKind_FileOutline,
|
||||
DF_IconKind_FileOutline,
|
||||
DF_IconKind_Binoculars,
|
||||
DF_IconKind_FileOutline,
|
||||
DF_IconKind_Null,
|
||||
DF_IconKind_Pin,
|
||||
@@ -57,7 +58,7 @@ DF_IconKind_Null,
|
||||
DF_IconKind_Null,
|
||||
};
|
||||
|
||||
String8 df_g_entity_kind_display_string_table[26] =
|
||||
String8 df_g_entity_kind_display_string_table[27] =
|
||||
{
|
||||
str8_lit_comp("Nil"),
|
||||
str8_lit_comp("Root"),
|
||||
@@ -65,6 +66,7 @@ str8_lit_comp("Machine"),
|
||||
str8_lit_comp("File"),
|
||||
str8_lit_comp("Override File Link"),
|
||||
str8_lit_comp("Pending File Change"),
|
||||
str8_lit_comp("Auto View Rule"),
|
||||
str8_lit_comp("Diagnostics Log"),
|
||||
str8_lit_comp("Flash Marker"),
|
||||
str8_lit_comp("Watch Pin"),
|
||||
@@ -87,7 +89,7 @@ str8_lit_comp("Conversion Failure"),
|
||||
str8_lit_comp("EndedProcess"),
|
||||
};
|
||||
|
||||
String8 df_g_entity_kind_name_label_table[26] =
|
||||
String8 df_g_entity_kind_name_label_table[27] =
|
||||
{
|
||||
str8_lit_comp("Label"),
|
||||
str8_lit_comp("Label"),
|
||||
@@ -97,6 +99,7 @@ str8_lit_comp("Label"),
|
||||
str8_lit_comp("Label"),
|
||||
str8_lit_comp("Label"),
|
||||
str8_lit_comp("Label"),
|
||||
str8_lit_comp("Label"),
|
||||
str8_lit_comp("Expression"),
|
||||
str8_lit_comp("Label"),
|
||||
str8_lit_comp("Expression"),
|
||||
@@ -117,7 +120,7 @@ str8_lit_comp("Label"),
|
||||
str8_lit_comp("Label"),
|
||||
};
|
||||
|
||||
DF_EntityKindFlags df_g_entity_kind_flags_table[26] =
|
||||
DF_EntityKindFlags df_g_entity_kind_flags_table[27] =
|
||||
{
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
@@ -125,6 +128,7 @@ DF_EntityKindFlags df_g_entity_kind_flags_table[26] =
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(1*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 1*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 1*DF_EntityKindFlag_NameIsCode | 1*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
@@ -147,7 +151,7 @@ DF_EntityKindFlags df_g_entity_kind_flags_table[26] =
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
};
|
||||
|
||||
DF_EntityOpFlags df_g_entity_kind_op_flags_table[26] =
|
||||
DF_EntityOpFlags df_g_entity_kind_op_flags_table[27] =
|
||||
{
|
||||
(0*DF_EntityOpFlag_Delete) | (0*DF_EntityOpFlag_Freeze) | (0*DF_EntityOpFlag_Edit) | (0*DF_EntityOpFlag_Rename) | (0*DF_EntityOpFlag_Enable) | (0*DF_EntityOpFlag_Condition) | (0*DF_EntityOpFlag_Duplicate),
|
||||
(0*DF_EntityOpFlag_Delete) | (0*DF_EntityOpFlag_Freeze) | (0*DF_EntityOpFlag_Edit) | (0*DF_EntityOpFlag_Rename) | (0*DF_EntityOpFlag_Enable) | (0*DF_EntityOpFlag_Condition) | (0*DF_EntityOpFlag_Duplicate),
|
||||
@@ -157,6 +161,7 @@ DF_EntityOpFlags df_g_entity_kind_op_flags_table[26] =
|
||||
(0*DF_EntityOpFlag_Delete) | (0*DF_EntityOpFlag_Freeze) | (0*DF_EntityOpFlag_Edit) | (0*DF_EntityOpFlag_Rename) | (0*DF_EntityOpFlag_Enable) | (0*DF_EntityOpFlag_Condition) | (0*DF_EntityOpFlag_Duplicate),
|
||||
(0*DF_EntityOpFlag_Delete) | (0*DF_EntityOpFlag_Freeze) | (0*DF_EntityOpFlag_Edit) | (0*DF_EntityOpFlag_Rename) | (0*DF_EntityOpFlag_Enable) | (0*DF_EntityOpFlag_Condition) | (0*DF_EntityOpFlag_Duplicate),
|
||||
(0*DF_EntityOpFlag_Delete) | (0*DF_EntityOpFlag_Freeze) | (0*DF_EntityOpFlag_Edit) | (0*DF_EntityOpFlag_Rename) | (0*DF_EntityOpFlag_Enable) | (0*DF_EntityOpFlag_Condition) | (0*DF_EntityOpFlag_Duplicate),
|
||||
(0*DF_EntityOpFlag_Delete) | (0*DF_EntityOpFlag_Freeze) | (0*DF_EntityOpFlag_Edit) | (0*DF_EntityOpFlag_Rename) | (0*DF_EntityOpFlag_Enable) | (0*DF_EntityOpFlag_Condition) | (0*DF_EntityOpFlag_Duplicate),
|
||||
(1*DF_EntityOpFlag_Delete) | (0*DF_EntityOpFlag_Freeze) | (0*DF_EntityOpFlag_Edit) | (1*DF_EntityOpFlag_Rename) | (0*DF_EntityOpFlag_Enable) | (0*DF_EntityOpFlag_Condition) | (1*DF_EntityOpFlag_Duplicate),
|
||||
(1*DF_EntityOpFlag_Delete) | (0*DF_EntityOpFlag_Freeze) | (0*DF_EntityOpFlag_Edit) | (1*DF_EntityOpFlag_Rename) | (1*DF_EntityOpFlag_Enable) | (1*DF_EntityOpFlag_Condition) | (1*DF_EntityOpFlag_Duplicate),
|
||||
(0*DF_EntityOpFlag_Delete) | (0*DF_EntityOpFlag_Freeze) | (0*DF_EntityOpFlag_Edit) | (0*DF_EntityOpFlag_Rename) | (0*DF_EntityOpFlag_Enable) | (0*DF_EntityOpFlag_Condition) | (0*DF_EntityOpFlag_Duplicate),
|
||||
@@ -209,7 +214,7 @@ DF_CoreCmdKind_Null,
|
||||
DF_CoreCmdKind_Null,
|
||||
};
|
||||
|
||||
DF_CmdSpecInfo df_g_core_cmd_kind_spec_info_table[206] =
|
||||
DF_CmdSpecInfo df_g_core_cmd_kind_spec_info_table[209] =
|
||||
{
|
||||
{ str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp(""), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
||||
{ str8_lit_comp("exit"), str8_lit_comp("Exits the debugger."), str8_lit_comp("quit,close,abort"), str8_lit_comp("Exit"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_X},
|
||||
@@ -296,6 +301,8 @@ DF_CmdSpecInfo df_g_core_cmd_kind_spec_info_table[206] =
|
||||
{ str8_lit_comp("set_file_override_link_src"), str8_lit_comp("Sets the source path for an override file link."), str8_lit_comp(""), str8_lit_comp("Set File Override Link Source"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
||||
{ str8_lit_comp("set_file_override_link_dst"), str8_lit_comp("Sets the destination path for an override file link."), str8_lit_comp(""), str8_lit_comp("Set File Override Link Destination"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
||||
{ str8_lit_comp("set_file_replacement_path"), str8_lit_comp("Sets the path which should be used as the replacement for the passed file."), str8_lit_comp(""), str8_lit_comp("Set File Replacement Path"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
||||
{ str8_lit_comp("set_auto_view_rule_type"), str8_lit_comp("Sets the type for an auto view rule."), str8_lit_comp(""), str8_lit_comp("Set Auto View Rule Type"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
||||
{ str8_lit_comp("set_auto_view_rule_view_rule"), str8_lit_comp("Sets the view rule string for an auto view rule."), str8_lit_comp(""), str8_lit_comp("Set Auto View Rule View Rule"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
||||
{ str8_lit_comp("open_user"), str8_lit_comp("Opens a user file path, immediately loading it, and begins autosaving to it."), str8_lit_comp("load,user,profile,layout"), str8_lit_comp("Open User"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_FilePath, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*1)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*1)}, DF_IconKind_Person},
|
||||
{ str8_lit_comp("open_profile"), str8_lit_comp("Opens a profile file path, immediately loading it, and begins autosaving to it."), str8_lit_comp("profile,project,session"), str8_lit_comp("Open Profile"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_FilePath, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*1)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*1)}, DF_IconKind_Briefcase},
|
||||
{ str8_lit_comp("apply_user_data"), str8_lit_comp("Applies user data from the active user file."), str8_lit_comp(""), str8_lit_comp("Apply User Data"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
||||
@@ -392,6 +399,7 @@ DF_CmdSpecInfo df_g_core_cmd_kind_spec_info_table[206] =
|
||||
{ str8_lit_comp("target"), str8_lit_comp("Opens the editor for a target."), str8_lit_comp(""), str8_lit_comp("Target"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Target},
|
||||
{ str8_lit_comp("targets"), str8_lit_comp("Opens the list of all targets."), str8_lit_comp(""), str8_lit_comp("Targets"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Target},
|
||||
{ str8_lit_comp("file_path_map"), str8_lit_comp("Opens the file path mapping editor."), str8_lit_comp(""), str8_lit_comp("File Path Map"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_FileOutline},
|
||||
{ str8_lit_comp("auto_view_rules"), str8_lit_comp("Opens the auto view rule editor."), str8_lit_comp(""), str8_lit_comp("Auto View Rules"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Binoculars},
|
||||
{ str8_lit_comp("scheduler"), str8_lit_comp("Opens the scheduler view, for process and thread controls."), str8_lit_comp("threads,processes,targets"), str8_lit_comp("Scheduler"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Scheduler},
|
||||
{ str8_lit_comp("call_stack"), str8_lit_comp("Opens the call stack view."), str8_lit_comp("callstack,thread"), str8_lit_comp("Call Stack"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Thread},
|
||||
{ str8_lit_comp("modules"), str8_lit_comp("Opens the modules view."), str8_lit_comp(""), str8_lit_comp("Modules"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Module},
|
||||
|
||||
@@ -23,6 +23,7 @@ DF_EntityKind_Machine,
|
||||
DF_EntityKind_File,
|
||||
DF_EntityKind_OverrideFileLink,
|
||||
DF_EntityKind_PendingFileChange,
|
||||
DF_EntityKind_AutoViewRule,
|
||||
DF_EntityKind_DiagLog,
|
||||
DF_EntityKind_FlashMarker,
|
||||
DF_EntityKind_WatchPin,
|
||||
@@ -133,6 +134,8 @@ DF_CoreCmdKind_SwitchToPartnerFile,
|
||||
DF_CoreCmdKind_SetFileOverrideLinkSrc,
|
||||
DF_CoreCmdKind_SetFileOverrideLinkDst,
|
||||
DF_CoreCmdKind_SetFileReplacementPath,
|
||||
DF_CoreCmdKind_SetAutoViewRuleType,
|
||||
DF_CoreCmdKind_SetAutoViewRuleViewRule,
|
||||
DF_CoreCmdKind_OpenUser,
|
||||
DF_CoreCmdKind_OpenProfile,
|
||||
DF_CoreCmdKind_ApplyUserData,
|
||||
@@ -229,6 +232,7 @@ DF_CoreCmdKind_Commands,
|
||||
DF_CoreCmdKind_Target,
|
||||
DF_CoreCmdKind_Targets,
|
||||
DF_CoreCmdKind_FilePathMap,
|
||||
DF_CoreCmdKind_AutoViewRules,
|
||||
DF_CoreCmdKind_Scheduler,
|
||||
DF_CoreCmdKind_CallStack,
|
||||
DF_CoreCmdKind_Modules,
|
||||
@@ -1508,11 +1512,11 @@ struct {B32 *value_ptr; String8 name;} DEV_toggle_table[] =
|
||||
};
|
||||
C_LINKAGE_BEGIN
|
||||
extern Rng1U64 df_g_cmd_param_slot_range_table[19];
|
||||
extern DF_IconKind df_g_entity_kind_icon_kind_table[26];
|
||||
extern String8 df_g_entity_kind_display_string_table[26];
|
||||
extern String8 df_g_entity_kind_name_label_table[26];
|
||||
extern DF_EntityKindFlags df_g_entity_kind_flags_table[26];
|
||||
extern DF_EntityOpFlags df_g_entity_kind_op_flags_table[26];
|
||||
extern DF_IconKind df_g_entity_kind_icon_kind_table[27];
|
||||
extern String8 df_g_entity_kind_display_string_table[27];
|
||||
extern String8 df_g_entity_kind_name_label_table[27];
|
||||
extern DF_EntityKindFlags df_g_entity_kind_flags_table[27];
|
||||
extern DF_EntityOpFlags df_g_entity_kind_op_flags_table[27];
|
||||
extern String8 df_g_cfg_src_string_table[4];
|
||||
extern DF_CoreCmdKind df_g_cfg_src_load_cmd_kind_table[4];
|
||||
extern DF_CoreCmdKind df_g_cfg_src_write_cmd_kind_table[4];
|
||||
|
||||
@@ -198,6 +198,7 @@ DF_GfxViewTable:
|
||||
{ Target "target" "Target" EntityName Target 1 0 0 0 0 0 0 "" }
|
||||
{ Targets "targets" "Targets" Null Target 0 1 0 1 0 1 1 "Displays a list of all targets, as well as controls for enabling, disabling, launching, editing, or deleting each target. For more information on targets, read the `Targets` section." }
|
||||
{ FilePathMap "file_path_map" "File Path Map" Null FileOutline 0 1 0 0 0 0 1 "Displays a table of *path maps*. Each path map is a pair of file or folder paths, one being a 'source' path, and one being a 'destination' path. These pairs are used by the debugger when automatically searching for specific files - for instance, when attempting to snap to a source code location specified by debug info. If debug info refers to a path on the machine on which a target executable was originally built, but that path is not valid on the debugger machine, but some alternative path exists, then path maps may be used to redirect the debugger from the debug info's specified paths to the associated appropriate debugger machine file paths." }
|
||||
{ AutoViewRules "auto_view_rules" "Auto View Rules" Null Binoculars 0 1 0 0 0 0 1 "Displays a table of *auto view rules*. Each *auto view rule* is a pair, with one element being a type, and the other being a view rule, which should be automatically applied to expressions of that type, when possible." }
|
||||
{ Scheduler "scheduler" "Scheduler" Null Scheduler 0 1 0 1 1 1 1 "Displays all processes and threads to which the debugger is currently attached, and contains controls for selecting and freezing threads." }
|
||||
{ CallStack "call_stack" "Call Stack" Null Thread 0 1 0 0 0 0 1 "Displays the call stack of the currently selected thread. Each frame in the call stack contains the associated module, function name, and return address. Allows selection of a particular call stack frame other than the top." }
|
||||
{ Modules "modules" "Modules" Null Module 0 1 0 1 0 1 1 "Displays a table of all modules currently loaded by any process to which the debugger is attached. This table displays each module's name, virtual address range in the containing process' address space, and which debug info file is being used by the debugger for the associated module." }
|
||||
|
||||
+291
-1
@@ -3444,7 +3444,7 @@ DF_VIEW_UI_FUNCTION_DEF(FilePathMap)
|
||||
B32 edit_end = 0;
|
||||
B32 edit_commit = 0;
|
||||
B32 edit_submit = 0;
|
||||
if(ui_is_focus_active())
|
||||
UI_Focus(UI_FocusKind_On) if(ui_is_focus_active())
|
||||
{
|
||||
if(!fpms->input_editing)
|
||||
{
|
||||
@@ -3708,6 +3708,296 @@ DF_VIEW_UI_FUNCTION_DEF(FilePathMap)
|
||||
ProfEnd();
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: AutoViewRules @view_hook_impl
|
||||
|
||||
DF_VIEW_SETUP_FUNCTION_DEF(AutoViewRules)
|
||||
{
|
||||
DF_AutoViewRulesViewState *avrs = df_view_user_state(view, DF_AutoViewRulesViewState);
|
||||
if(avrs->initialized == 0)
|
||||
{
|
||||
avrs->initialized = 1;
|
||||
avrs->src_column_pct = 0.5f;
|
||||
avrs->dst_column_pct = 0.5f;
|
||||
}
|
||||
}
|
||||
|
||||
DF_VIEW_STRING_FROM_STATE_FUNCTION_DEF(AutoViewRules)
|
||||
{
|
||||
DF_AutoViewRulesViewState *avrs = df_view_user_state(view, DF_AutoViewRulesViewState);
|
||||
return str8_lit("");
|
||||
}
|
||||
|
||||
DF_VIEW_CMD_FUNCTION_DEF(AutoViewRules)
|
||||
{
|
||||
DF_AutoViewRulesViewState *avrs = df_view_user_state(view, DF_AutoViewRulesViewState);
|
||||
|
||||
// rjf: process commands
|
||||
for(DF_CmdNode *n = cmds->first; n != 0; n = n->next)
|
||||
{
|
||||
DF_Cmd *cmd = &n->cmd;
|
||||
|
||||
// rjf: mismatched window/panel => skip
|
||||
if(df_window_from_handle(cmd->params.window) != ws ||
|
||||
df_panel_from_handle(cmd->params.panel) != panel)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DF_VIEW_UI_FUNCTION_DEF(AutoViewRules)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
DF_EntityList maps_list = df_query_cached_entity_list_with_kind(DF_EntityKind_AutoViewRule);
|
||||
DF_EntityArray maps = df_entity_array_from_list(scratch.arena, &maps_list);
|
||||
F32 row_height_px = floor_f32(ui_top_font_size()*2.5f);
|
||||
|
||||
//- rjf: grab state
|
||||
DF_AutoViewRulesViewState *avrs = df_view_user_state(view, DF_AutoViewRulesViewState);
|
||||
|
||||
//- rjf: take controls to start/end editing
|
||||
B32 edit_begin = 0;
|
||||
B32 edit_end = 0;
|
||||
B32 edit_commit = 0;
|
||||
B32 edit_submit = 0;
|
||||
UI_Focus(UI_FocusKind_On) if(ui_is_focus_active())
|
||||
{
|
||||
if(!avrs->input_editing)
|
||||
{
|
||||
UI_NavActionList *nav_actions = ui_nav_actions();
|
||||
for(UI_NavActionNode *n = nav_actions->first; n != 0; n = n->next)
|
||||
{
|
||||
if(n->v.insertion.size != 0 || n->v.flags & UI_NavActionFlag_Paste)
|
||||
{
|
||||
edit_begin = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(os_key_press(ui_events(), ui_window(), 0, OS_Key_F2))
|
||||
{
|
||||
edit_begin = 1;
|
||||
}
|
||||
}
|
||||
if(avrs->input_editing)
|
||||
{
|
||||
if(os_key_press(ui_events(), ui_window(), 0, OS_Key_Esc))
|
||||
{
|
||||
edit_end = 1;
|
||||
edit_commit = 0;
|
||||
}
|
||||
if(os_key_press(ui_events(), ui_window(), 0, OS_Key_Return))
|
||||
{
|
||||
edit_end = 1;
|
||||
edit_commit = 1;
|
||||
edit_submit = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: build
|
||||
DF_Handle commit_map = df_handle_zero();
|
||||
Side commit_side = Side_Invalid;
|
||||
F32 *col_pcts[] = { &avrs->src_column_pct, &avrs->dst_column_pct };
|
||||
Vec2S64 next_cursor = avrs->cursor;
|
||||
Rng1S64 visible_row_range = {0};
|
||||
UI_ScrollListParams scroll_list_params = {0};
|
||||
{
|
||||
scroll_list_params.flags = UI_ScrollListFlag_All;
|
||||
scroll_list_params.row_height_px = row_height_px;
|
||||
scroll_list_params.dim_px = dim_2f32(rect);
|
||||
scroll_list_params.cursor_range = r2s64(v2s64(0, 0), v2s64(1, maps.count + 1));
|
||||
scroll_list_params.item_range = r1s64(0, maps.count+2);
|
||||
scroll_list_params.cursor_min_is_empty_selection[Axis2_Y] = 1;
|
||||
}
|
||||
UI_ScrollListSignal scroll_list_sig = {0};
|
||||
UI_Focus(UI_FocusKind_On)
|
||||
UI_ScrollList(&scroll_list_params, &view->scroll_pos.y, avrs->input_editing ? 0 : &avrs->cursor, &visible_row_range, &scroll_list_sig)
|
||||
UI_Focus(UI_FocusKind_Null)
|
||||
UI_TableF(ArrayCount(col_pcts), col_pcts, "###tbl")
|
||||
{
|
||||
next_cursor = avrs->cursor;
|
||||
|
||||
//- rjf: header
|
||||
if(visible_row_range.min == 0) UI_TableVector UI_TextColor(df_rgba_from_theme_color(DF_ThemeColor_WeakText))
|
||||
{
|
||||
UI_TableCell ui_label(str8_lit("Type"));
|
||||
UI_TableCell ui_label(str8_lit("View Rule"));
|
||||
}
|
||||
|
||||
//- rjf: map rows
|
||||
for(S64 row_idx = Max(1, visible_row_range.min);
|
||||
row_idx <= visible_row_range.max && row_idx <= maps.count+1;
|
||||
row_idx += 1) UI_TableVector
|
||||
{
|
||||
U64 map_idx = row_idx-1;
|
||||
DF_Entity *map = (map_idx < maps.count ? maps.v[map_idx] : &df_g_nil_entity);
|
||||
DF_Entity *source = df_entity_child_from_kind(map, DF_EntityKind_Source);
|
||||
DF_Entity *dest = df_entity_child_from_kind(map, DF_EntityKind_Dest);
|
||||
String8 type = source->name;
|
||||
String8 view_rule = dest->name;
|
||||
B32 row_selected = (avrs->cursor.y == row_idx);
|
||||
|
||||
//- rjf: type
|
||||
UI_TableCell UI_WidthFill
|
||||
{
|
||||
//- rjf: editor
|
||||
{
|
||||
B32 value_selected = (row_selected && avrs->cursor.x == 0);
|
||||
|
||||
// rjf: begin editing
|
||||
if(value_selected && edit_begin)
|
||||
{
|
||||
avrs->input_editing = 1;
|
||||
avrs->input_size = Min(sizeof(avrs->input_buffer), type.size);
|
||||
MemoryCopy(avrs->input_buffer, type.str, avrs->input_size);
|
||||
avrs->input_cursor = txt_pt(1, 1+avrs->input_size);
|
||||
avrs->input_mark = txt_pt(1, 1);
|
||||
}
|
||||
|
||||
// rjf: build
|
||||
UI_Signal sig = {0};
|
||||
UI_FocusHot(value_selected ? UI_FocusKind_On : UI_FocusKind_Off)
|
||||
UI_FocusActive((value_selected && avrs->input_editing) ? UI_FocusKind_On : UI_FocusKind_Off)
|
||||
UI_Font(df_font_from_slot(DF_FontSlot_Code))
|
||||
{
|
||||
sig = df_line_editf(DF_LineEditFlag_CodeContents|DF_LineEditFlag_NoBackground|DF_LineEditFlag_DisplayStringIsCode, 0, 0, &avrs->input_cursor, &avrs->input_mark, avrs->input_buffer, sizeof(avrs->input_buffer), &avrs->input_size, 0, type, "###src_editor_%p", map);
|
||||
edit_commit = edit_commit || ui_committed(sig);
|
||||
}
|
||||
|
||||
// rjf: focus panel on press
|
||||
if(ui_pressed(sig))
|
||||
{
|
||||
DF_CmdParams p = df_cmd_params_from_panel(ws, panel);
|
||||
df_push_cmd__root(&p, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_FocusPanel));
|
||||
}
|
||||
|
||||
// rjf: begin editing on double-click
|
||||
if(!avrs->input_editing && ui_double_clicked(sig))
|
||||
{
|
||||
avrs->input_editing = 1;
|
||||
avrs->input_size = Min(sizeof(avrs->input_buffer), type.size);
|
||||
MemoryCopy(avrs->input_buffer, type.str, avrs->input_size);
|
||||
avrs->input_cursor = txt_pt(1, 1+avrs->input_size);
|
||||
avrs->input_mark = txt_pt(1, 1);
|
||||
}
|
||||
|
||||
// rjf: press on non-selected => commit edit, change selected cell
|
||||
if(ui_pressed(sig) && !value_selected)
|
||||
{
|
||||
edit_end = 1;
|
||||
edit_commit = avrs->input_editing;
|
||||
next_cursor.x = 0;
|
||||
next_cursor.y = map_idx+1;
|
||||
}
|
||||
|
||||
// rjf: store commit information
|
||||
if(value_selected)
|
||||
{
|
||||
commit_side = Side_Min;
|
||||
commit_map = df_handle_from_entity(map);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: dst
|
||||
UI_TableCell UI_WidthFill
|
||||
{
|
||||
//- rjf: editor
|
||||
{
|
||||
B32 value_selected = (row_selected && avrs->cursor.x == 1);
|
||||
|
||||
// rjf: begin editing
|
||||
if(value_selected && edit_begin)
|
||||
{
|
||||
avrs->input_editing = 1;
|
||||
avrs->input_size = Min(sizeof(avrs->input_buffer), view_rule.size);
|
||||
MemoryCopy(avrs->input_buffer, view_rule.str, avrs->input_size);
|
||||
avrs->input_cursor = txt_pt(1, 1+avrs->input_size);
|
||||
avrs->input_mark = txt_pt(1, 1);
|
||||
}
|
||||
|
||||
// rjf: build
|
||||
UI_Signal sig = {0};
|
||||
UI_FocusHot(value_selected ? UI_FocusKind_On : UI_FocusKind_Off)
|
||||
UI_FocusActive((value_selected && avrs->input_editing) ? UI_FocusKind_On : UI_FocusKind_Off)
|
||||
UI_Font(df_font_from_slot(DF_FontSlot_Code))
|
||||
{
|
||||
sig = df_line_editf(DF_LineEditFlag_CodeContents|DF_LineEditFlag_NoBackground|DF_LineEditFlag_DisplayStringIsCode, 0, 0, &avrs->input_cursor, &avrs->input_mark, avrs->input_buffer, sizeof(avrs->input_buffer), &avrs->input_size, 0, view_rule, "###dst_editor_%p", map);
|
||||
edit_commit = edit_commit || ui_committed(sig);
|
||||
}
|
||||
|
||||
// rjf: focus panel on press
|
||||
if(ui_pressed(sig))
|
||||
{
|
||||
DF_CmdParams p = df_cmd_params_from_panel(ws, panel);
|
||||
df_push_cmd__root(&p, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_FocusPanel));
|
||||
}
|
||||
|
||||
// rjf: begin editing on double-click
|
||||
if(!avrs->input_editing && ui_double_clicked(sig))
|
||||
{
|
||||
avrs->input_editing = 1;
|
||||
avrs->input_size = Min(sizeof(avrs->input_buffer), view_rule.size);
|
||||
MemoryCopy(avrs->input_buffer, view_rule.str, avrs->input_size);
|
||||
avrs->input_cursor = txt_pt(1, 1+avrs->input_size);
|
||||
avrs->input_mark = txt_pt(1, 1);
|
||||
}
|
||||
|
||||
// rjf: press on non-selected => commit edit, change selected cell
|
||||
if(ui_pressed(sig) && !value_selected)
|
||||
{
|
||||
edit_end = 1;
|
||||
edit_commit = avrs->input_editing;
|
||||
next_cursor.x = 2;
|
||||
next_cursor.y = map_idx+1;
|
||||
}
|
||||
|
||||
// rjf: store commit information
|
||||
if(value_selected)
|
||||
{
|
||||
commit_side = Side_Max;
|
||||
commit_map = df_handle_from_entity(map);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: apply commit
|
||||
if(edit_commit && commit_side != Side_Invalid)
|
||||
{
|
||||
String8 new_string = str8(avrs->input_buffer, avrs->input_size);
|
||||
DF_CmdParams p = df_cmd_params_from_view(ws, panel, view);
|
||||
p.entity = commit_map;
|
||||
p.string = new_string;
|
||||
df_cmd_params_mark_slot(&p, DF_CmdParamSlot_Entity);
|
||||
df_cmd_params_mark_slot(&p, DF_CmdParamSlot_FilePath);
|
||||
df_push_cmd__root(&p, df_cmd_spec_from_core_cmd_kind(commit_side == Side_Min ?
|
||||
DF_CoreCmdKind_SetAutoViewRuleType :
|
||||
DF_CoreCmdKind_SetAutoViewRuleViewRule));
|
||||
}
|
||||
|
||||
//- rjf: apply editing finish
|
||||
if(edit_end)
|
||||
{
|
||||
avrs->input_editing = 0;
|
||||
}
|
||||
|
||||
//- rjf: move down one row if submitted
|
||||
if(edit_submit)
|
||||
{
|
||||
next_cursor.y += 1;
|
||||
}
|
||||
|
||||
//- rjf: apply moves to selection
|
||||
avrs->cursor = next_cursor;
|
||||
|
||||
scratch_end(scratch);
|
||||
ProfEnd();
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Scheduler @view_hook_impl
|
||||
|
||||
|
||||
@@ -230,6 +230,23 @@ struct DF_FilePathMapViewState
|
||||
F32 dst_column_pct;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: AutoViewRules @view_types
|
||||
|
||||
typedef struct DF_AutoViewRulesViewState DF_AutoViewRulesViewState;
|
||||
struct DF_AutoViewRulesViewState
|
||||
{
|
||||
B32 initialized;
|
||||
Vec2S64 cursor;
|
||||
TxtPt input_cursor;
|
||||
TxtPt input_mark;
|
||||
U8 input_buffer[1024];
|
||||
U64 input_size;
|
||||
B32 input_editing;
|
||||
F32 src_column_pct;
|
||||
F32 dst_column_pct;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Modules @view_types
|
||||
|
||||
|
||||
@@ -731,7 +731,7 @@ DF_GfxViewRuleSpecInfo df_g_gfx_view_rule_spec_info_table[14] =
|
||||
{ str8_lit_comp("geo"), (DF_GfxViewRuleSpecInfoFlag_VizRowProd*0)|(DF_GfxViewRuleSpecInfoFlag_LineStringize*0)|(DF_GfxViewRuleSpecInfoFlag_RowUI*1)|(DF_GfxViewRuleSpecInfoFlag_BlockUI*1), 0, 0, DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_NAME(geo) , DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_NAME(geo) , 0 },
|
||||
};
|
||||
|
||||
DF_ViewSpecInfo df_g_gfx_view_kind_spec_info_table[30] =
|
||||
DF_ViewSpecInfo df_g_gfx_view_kind_spec_info_table[31] =
|
||||
{
|
||||
{(0|0*DF_ViewSpecFlag_ParameterizedByEntity|0*DF_ViewSpecFlag_CanSerialize|0*DF_ViewSpecFlag_CanSerializeEntityPath|0*DF_ViewSpecFlag_CanFilter|0*DF_ViewSpecFlag_FilterIsCode|0*DF_ViewSpecFlag_TypingAutomaticallyFilters), str8_lit_comp("null"), str8_lit_comp(""), DF_NameKind_Null, DF_IconKind_Null, DF_VIEW_SETUP_FUNCTION_NAME(Null), DF_VIEW_STRING_FROM_STATE_FUNCTION_NAME(Null), DF_VIEW_CMD_FUNCTION_NAME(Null), DF_VIEW_UI_FUNCTION_NAME(Null)},
|
||||
{(0|0*DF_ViewSpecFlag_ParameterizedByEntity|0*DF_ViewSpecFlag_CanSerialize|0*DF_ViewSpecFlag_CanSerializeEntityPath|0*DF_ViewSpecFlag_CanFilter|0*DF_ViewSpecFlag_FilterIsCode|0*DF_ViewSpecFlag_TypingAutomaticallyFilters), str8_lit_comp("empty"), str8_lit_comp(""), DF_NameKind_Null, DF_IconKind_Null, DF_VIEW_SETUP_FUNCTION_NAME(Empty), DF_VIEW_STRING_FROM_STATE_FUNCTION_NAME(Empty), DF_VIEW_CMD_FUNCTION_NAME(Empty), DF_VIEW_UI_FUNCTION_NAME(Empty)},
|
||||
@@ -743,6 +743,7 @@ DF_ViewSpecInfo df_g_gfx_view_kind_spec_info_table[30] =
|
||||
{(0|1*DF_ViewSpecFlag_ParameterizedByEntity|0*DF_ViewSpecFlag_CanSerialize|0*DF_ViewSpecFlag_CanSerializeEntityPath|0*DF_ViewSpecFlag_CanFilter|0*DF_ViewSpecFlag_FilterIsCode|0*DF_ViewSpecFlag_TypingAutomaticallyFilters), str8_lit_comp("target"), str8_lit_comp("Target"), DF_NameKind_EntityName, DF_IconKind_Target, DF_VIEW_SETUP_FUNCTION_NAME(Target), DF_VIEW_STRING_FROM_STATE_FUNCTION_NAME(Target), DF_VIEW_CMD_FUNCTION_NAME(Target), DF_VIEW_UI_FUNCTION_NAME(Target)},
|
||||
{(0|0*DF_ViewSpecFlag_ParameterizedByEntity|1*DF_ViewSpecFlag_CanSerialize|0*DF_ViewSpecFlag_CanSerializeEntityPath|1*DF_ViewSpecFlag_CanFilter|0*DF_ViewSpecFlag_FilterIsCode|1*DF_ViewSpecFlag_TypingAutomaticallyFilters), str8_lit_comp("targets"), str8_lit_comp("Targets"), DF_NameKind_Null, DF_IconKind_Target, DF_VIEW_SETUP_FUNCTION_NAME(Targets), DF_VIEW_STRING_FROM_STATE_FUNCTION_NAME(Targets), DF_VIEW_CMD_FUNCTION_NAME(Targets), DF_VIEW_UI_FUNCTION_NAME(Targets)},
|
||||
{(0|0*DF_ViewSpecFlag_ParameterizedByEntity|1*DF_ViewSpecFlag_CanSerialize|0*DF_ViewSpecFlag_CanSerializeEntityPath|0*DF_ViewSpecFlag_CanFilter|0*DF_ViewSpecFlag_FilterIsCode|0*DF_ViewSpecFlag_TypingAutomaticallyFilters), str8_lit_comp("file_path_map"), str8_lit_comp("File Path Map"), DF_NameKind_Null, DF_IconKind_FileOutline, DF_VIEW_SETUP_FUNCTION_NAME(FilePathMap), DF_VIEW_STRING_FROM_STATE_FUNCTION_NAME(FilePathMap), DF_VIEW_CMD_FUNCTION_NAME(FilePathMap), DF_VIEW_UI_FUNCTION_NAME(FilePathMap)},
|
||||
{(0|0*DF_ViewSpecFlag_ParameterizedByEntity|1*DF_ViewSpecFlag_CanSerialize|0*DF_ViewSpecFlag_CanSerializeEntityPath|0*DF_ViewSpecFlag_CanFilter|0*DF_ViewSpecFlag_FilterIsCode|0*DF_ViewSpecFlag_TypingAutomaticallyFilters), str8_lit_comp("auto_view_rules"), str8_lit_comp("Auto View Rules"), DF_NameKind_Null, DF_IconKind_Binoculars, DF_VIEW_SETUP_FUNCTION_NAME(AutoViewRules), DF_VIEW_STRING_FROM_STATE_FUNCTION_NAME(AutoViewRules), DF_VIEW_CMD_FUNCTION_NAME(AutoViewRules), DF_VIEW_UI_FUNCTION_NAME(AutoViewRules)},
|
||||
{(0|0*DF_ViewSpecFlag_ParameterizedByEntity|1*DF_ViewSpecFlag_CanSerialize|0*DF_ViewSpecFlag_CanSerializeEntityPath|1*DF_ViewSpecFlag_CanFilter|1*DF_ViewSpecFlag_FilterIsCode|1*DF_ViewSpecFlag_TypingAutomaticallyFilters), str8_lit_comp("scheduler"), str8_lit_comp("Scheduler"), DF_NameKind_Null, DF_IconKind_Scheduler, DF_VIEW_SETUP_FUNCTION_NAME(Scheduler), DF_VIEW_STRING_FROM_STATE_FUNCTION_NAME(Scheduler), DF_VIEW_CMD_FUNCTION_NAME(Scheduler), DF_VIEW_UI_FUNCTION_NAME(Scheduler)},
|
||||
{(0|0*DF_ViewSpecFlag_ParameterizedByEntity|1*DF_ViewSpecFlag_CanSerialize|0*DF_ViewSpecFlag_CanSerializeEntityPath|0*DF_ViewSpecFlag_CanFilter|0*DF_ViewSpecFlag_FilterIsCode|0*DF_ViewSpecFlag_TypingAutomaticallyFilters), str8_lit_comp("call_stack"), str8_lit_comp("Call Stack"), DF_NameKind_Null, DF_IconKind_Thread, DF_VIEW_SETUP_FUNCTION_NAME(CallStack), DF_VIEW_STRING_FROM_STATE_FUNCTION_NAME(CallStack), DF_VIEW_CMD_FUNCTION_NAME(CallStack), DF_VIEW_UI_FUNCTION_NAME(CallStack)},
|
||||
{(0|0*DF_ViewSpecFlag_ParameterizedByEntity|1*DF_ViewSpecFlag_CanSerialize|0*DF_ViewSpecFlag_CanSerializeEntityPath|1*DF_ViewSpecFlag_CanFilter|0*DF_ViewSpecFlag_FilterIsCode|1*DF_ViewSpecFlag_TypingAutomaticallyFilters), str8_lit_comp("modules"), str8_lit_comp("Modules"), DF_NameKind_Null, DF_IconKind_Module, DF_VIEW_SETUP_FUNCTION_NAME(Modules), DF_VIEW_STRING_FROM_STATE_FUNCTION_NAME(Modules), DF_VIEW_CMD_FUNCTION_NAME(Modules), DF_VIEW_UI_FUNCTION_NAME(Modules)},
|
||||
|
||||
@@ -26,6 +26,7 @@ DF_GfxViewKind_SymbolLister,
|
||||
DF_GfxViewKind_Target,
|
||||
DF_GfxViewKind_Targets,
|
||||
DF_GfxViewKind_FilePathMap,
|
||||
DF_GfxViewKind_AutoViewRules,
|
||||
DF_GfxViewKind_Scheduler,
|
||||
DF_GfxViewKind_CallStack,
|
||||
DF_GfxViewKind_Modules,
|
||||
@@ -132,6 +133,7 @@ DF_VIEW_SETUP_FUNCTION_DEF(SymbolLister);
|
||||
DF_VIEW_SETUP_FUNCTION_DEF(Target);
|
||||
DF_VIEW_SETUP_FUNCTION_DEF(Targets);
|
||||
DF_VIEW_SETUP_FUNCTION_DEF(FilePathMap);
|
||||
DF_VIEW_SETUP_FUNCTION_DEF(AutoViewRules);
|
||||
DF_VIEW_SETUP_FUNCTION_DEF(Scheduler);
|
||||
DF_VIEW_SETUP_FUNCTION_DEF(CallStack);
|
||||
DF_VIEW_SETUP_FUNCTION_DEF(Modules);
|
||||
@@ -162,6 +164,7 @@ DF_VIEW_STRING_FROM_STATE_FUNCTION_DEF(SymbolLister);
|
||||
DF_VIEW_STRING_FROM_STATE_FUNCTION_DEF(Target);
|
||||
DF_VIEW_STRING_FROM_STATE_FUNCTION_DEF(Targets);
|
||||
DF_VIEW_STRING_FROM_STATE_FUNCTION_DEF(FilePathMap);
|
||||
DF_VIEW_STRING_FROM_STATE_FUNCTION_DEF(AutoViewRules);
|
||||
DF_VIEW_STRING_FROM_STATE_FUNCTION_DEF(Scheduler);
|
||||
DF_VIEW_STRING_FROM_STATE_FUNCTION_DEF(CallStack);
|
||||
DF_VIEW_STRING_FROM_STATE_FUNCTION_DEF(Modules);
|
||||
@@ -192,6 +195,7 @@ DF_VIEW_CMD_FUNCTION_DEF(SymbolLister);
|
||||
DF_VIEW_CMD_FUNCTION_DEF(Target);
|
||||
DF_VIEW_CMD_FUNCTION_DEF(Targets);
|
||||
DF_VIEW_CMD_FUNCTION_DEF(FilePathMap);
|
||||
DF_VIEW_CMD_FUNCTION_DEF(AutoViewRules);
|
||||
DF_VIEW_CMD_FUNCTION_DEF(Scheduler);
|
||||
DF_VIEW_CMD_FUNCTION_DEF(CallStack);
|
||||
DF_VIEW_CMD_FUNCTION_DEF(Modules);
|
||||
@@ -222,6 +226,7 @@ DF_VIEW_UI_FUNCTION_DEF(SymbolLister);
|
||||
DF_VIEW_UI_FUNCTION_DEF(Target);
|
||||
DF_VIEW_UI_FUNCTION_DEF(Targets);
|
||||
DF_VIEW_UI_FUNCTION_DEF(FilePathMap);
|
||||
DF_VIEW_UI_FUNCTION_DEF(AutoViewRules);
|
||||
DF_VIEW_UI_FUNCTION_DEF(Scheduler);
|
||||
DF_VIEW_UI_FUNCTION_DEF(CallStack);
|
||||
DF_VIEW_UI_FUNCTION_DEF(Modules);
|
||||
@@ -281,7 +286,7 @@ extern String8 df_g_cmd_param_slot_2_view_spec_cmd_map[7];
|
||||
extern DF_StringBindingPair df_g_default_binding_table[97];
|
||||
extern String8 df_g_binding_version_remap_old_name_table[3];
|
||||
extern String8 df_g_binding_version_remap_new_name_table[3];
|
||||
extern DF_ViewSpecInfo df_g_gfx_view_kind_spec_info_table[30];
|
||||
extern DF_ViewSpecInfo df_g_gfx_view_kind_spec_info_table[31];
|
||||
extern String8 df_g_theme_color_display_string_table[54];
|
||||
extern String8 df_g_theme_color_cfg_string_table[54];
|
||||
read_only global U8 df_g_icon_font_bytes__data[] =
|
||||
|
||||
Reference in New Issue
Block a user