mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-13 07:32:23 -07:00
dedicated command for picking folders & improved flow when doing directory-only selection
This commit is contained in:
@@ -367,7 +367,8 @@ DF_CoreCmdTable:// | | |
|
||||
{WatchPins 0 Null Nil 0 0 0 0 0 Pin "watch_pins" "Watch Pins" "Opens the watch pins view." "" }
|
||||
{ExceptionFilters 0 Null Nil 0 0 0 0 0 Gear "exception_filters" "Exception Filters" "Opens the exception filters view." "exceptions,filters" }
|
||||
{Theme 0 Null Nil 0 0 0 0 0 Palette "theme" "Theme" "Opens the theme view." "theme,color,scheme,palette" }
|
||||
{PickFile 1 FilePath Nil 0 0 0 0 0 FileOutline "pick_file" "Pick File" "Opens the file browser to pick a file." "" }
|
||||
{PickFile 1 FilePath Nil 0 0 0 0 1 FileOutline "pick_file" "Pick File" "Opens the file browser to pick a file." "" }
|
||||
{PickFolder 1 FilePath Nil 1 0 0 0 1 FolderOpenFilled "pick_folder" "Pick Folder" "Opens the file browser to pick a folder." "" }
|
||||
|
||||
//- rjf: query completion
|
||||
{CompleteQuery 1 Null Nil 0 0 0 0 0 Null "complete_query" "Complete Query" "Completes a query." "" }
|
||||
|
||||
@@ -193,7 +193,8 @@ DF_CmdSpecInfo df_g_core_cmd_kind_spec_info_table[] =
|
||||
{ str8_lit_comp("watch_pins"), str8_lit_comp("Opens the watch pins view."), str8_lit_comp(""), str8_lit_comp("Watch Pins"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_FoldersOnly*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Pin},
|
||||
{ str8_lit_comp("exception_filters"), str8_lit_comp("Opens the exception filters view."), str8_lit_comp("exceptions,filters"), str8_lit_comp("Exception Filters"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_FoldersOnly*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Gear},
|
||||
{ str8_lit_comp("theme"), str8_lit_comp("Opens the theme view."), str8_lit_comp("theme,color,scheme,palette"), str8_lit_comp("Theme"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_FoldersOnly*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Palette},
|
||||
{ str8_lit_comp("pick_file"), str8_lit_comp("Opens the file browser to pick a file."), str8_lit_comp(""), str8_lit_comp("Pick File"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_FilePath, DF_EntityKind_Nil, (DF_CmdQueryFlag_FoldersOnly*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_FileOutline},
|
||||
{ str8_lit_comp("pick_file"), str8_lit_comp("Opens the file browser to pick a file."), str8_lit_comp(""), str8_lit_comp("Pick File"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_FilePath, DF_EntityKind_Nil, (DF_CmdQueryFlag_FoldersOnly*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*1)}, DF_IconKind_FileOutline},
|
||||
{ str8_lit_comp("pick_folder"), str8_lit_comp("Opens the file browser to pick a folder."), str8_lit_comp(""), str8_lit_comp("Pick Folder"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_FilePath, DF_EntityKind_Nil, (DF_CmdQueryFlag_FoldersOnly*1)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*1)}, DF_IconKind_FolderOpenFilled},
|
||||
{ str8_lit_comp("complete_query"), str8_lit_comp("Completes a query."), str8_lit_comp(""), str8_lit_comp("Complete Query"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_FoldersOnly*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
||||
{ str8_lit_comp("cancel_query"), str8_lit_comp("Cancels a query."), str8_lit_comp(""), str8_lit_comp("Cancel Query"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_FoldersOnly*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
||||
{ str8_lit_comp("toggle_dev_menu"), str8_lit_comp("Opens and closes the developer menu."), str8_lit_comp(""), str8_lit_comp("Toggle Developer Menu"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_FoldersOnly*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
||||
|
||||
@@ -244,6 +244,7 @@ DF_CoreCmdKind_WatchPins,
|
||||
DF_CoreCmdKind_ExceptionFilters,
|
||||
DF_CoreCmdKind_Theme,
|
||||
DF_CoreCmdKind_PickFile,
|
||||
DF_CoreCmdKind_PickFolder,
|
||||
DF_CoreCmdKind_CompleteQuery,
|
||||
DF_CoreCmdKind_CancelQuery,
|
||||
DF_CoreCmdKind_ToggleDevMenu,
|
||||
|
||||
+19
-8
@@ -2028,7 +2028,7 @@ DF_VIEW_UI_FUNCTION_DEF(FileSystem)
|
||||
DF_PathQuery path_query = df_path_query_from_string(query_normalized_with_opt_slash);
|
||||
F32 row_height_px = floor_f32(ui_top_font_size()*2.5f);
|
||||
F32 scroll_bar_dim = floor_f32(ui_top_font_size()*1.5f);
|
||||
B32 dir_selection = 0;
|
||||
B32 dir_selection = !!(ws->query_cmd_spec->info.query.flags & DF_CmdQueryFlag_FoldersOnly);
|
||||
|
||||
//- rjf: get extra state for this view
|
||||
DF_FileSystemViewState *fs = df_view_user_state(view, DF_FileSystemViewState);
|
||||
@@ -2209,6 +2209,15 @@ DF_VIEW_UI_FUNCTION_DEF(FileSystem)
|
||||
}
|
||||
}
|
||||
|
||||
// rjf: command argument is empty, picking folders -> use current folder
|
||||
else if(path_query.search.size == 0 && dir_selection)
|
||||
{
|
||||
DF_CmdParams params = df_cmd_params_from_view(ws, panel, view);
|
||||
params.file_path = path_query.path;
|
||||
df_cmd_params_mark_slot(¶ms, DF_CmdParamSlot_FilePath);
|
||||
df_push_cmd__root(¶ms, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_CompleteQuery));
|
||||
}
|
||||
|
||||
// rjf: command argument does not exactly match any file, but lister results are in:
|
||||
else if(file_count != 0)
|
||||
{
|
||||
@@ -2796,6 +2805,7 @@ DF_VIEW_CMD_FUNCTION_DEF(Target)
|
||||
{
|
||||
default:break;
|
||||
case DF_CoreCmdKind_PickFile:
|
||||
case DF_CoreCmdKind_PickFolder:
|
||||
{
|
||||
String8 pick_string = cmd->params.file_path;
|
||||
DF_Entity *storage_entity = entity;
|
||||
@@ -2835,6 +2845,7 @@ DF_VIEW_UI_FUNCTION_DEF(Target)
|
||||
struct
|
||||
{
|
||||
B32 fill_with_file;
|
||||
B32 fill_with_folder;
|
||||
B32 use_code_font;
|
||||
String8 key;
|
||||
DF_EntityKind storage_child_kind;
|
||||
@@ -2842,11 +2853,11 @@ DF_VIEW_UI_FUNCTION_DEF(Target)
|
||||
}
|
||||
kv_info[] =
|
||||
{
|
||||
{ 0, 0, str8_lit("Label"), DF_EntityKind_Nil, entity->name },
|
||||
{ 1, 0, str8_lit("Executable"), DF_EntityKind_Executable, df_entity_child_from_kind(entity, DF_EntityKind_Executable)->name },
|
||||
{ 0, 0, str8_lit("Arguments"), DF_EntityKind_Arguments, df_entity_child_from_kind(entity, DF_EntityKind_Arguments)->name },
|
||||
{ 1, 0, str8_lit("Working Directory"), DF_EntityKind_ExecutionPath, df_entity_child_from_kind(entity, DF_EntityKind_ExecutionPath)->name },
|
||||
{ 0, 1, str8_lit("Entry Point Override"), DF_EntityKind_EntryPointName, df_entity_child_from_kind(entity, DF_EntityKind_EntryPointName)->name },
|
||||
{ 0, 0, 0, str8_lit("Label"), DF_EntityKind_Nil, entity->name },
|
||||
{ 1, 0, 0, str8_lit("Executable"), DF_EntityKind_Executable, df_entity_child_from_kind(entity, DF_EntityKind_Executable)->name },
|
||||
{ 0, 0, 0, str8_lit("Arguments"), DF_EntityKind_Arguments, df_entity_child_from_kind(entity, DF_EntityKind_Arguments)->name },
|
||||
{ 0, 1, 0, str8_lit("Working Directory"), DF_EntityKind_ExecutionPath, df_entity_child_from_kind(entity, DF_EntityKind_ExecutionPath)->name },
|
||||
{ 0, 0, 1, str8_lit("Entry Point Override"), DF_EntityKind_EntryPointName, df_entity_child_from_kind(entity, DF_EntityKind_EntryPointName)->name },
|
||||
};
|
||||
|
||||
//- rjf: take controls to start/end editing
|
||||
@@ -2922,7 +2933,7 @@ DF_VIEW_UI_FUNCTION_DEF(Target)
|
||||
UI_TableVector
|
||||
{
|
||||
B32 row_selected = (tv->cursor.y == idx+1);
|
||||
B32 has_browse = kv_info[idx].fill_with_file;
|
||||
B32 has_browse = kv_info[idx].fill_with_file || kv_info[idx].fill_with_folder;
|
||||
|
||||
//- rjf: key (label)
|
||||
UI_TableCell UI_TextColor(df_rgba_from_theme_color(DF_ThemeColor_WeakText))
|
||||
@@ -3027,7 +3038,7 @@ DF_VIEW_UI_FUNCTION_DEF(Target)
|
||||
if(ui_buttonf("Browse...").clicked)
|
||||
{
|
||||
DF_CmdParams params = df_cmd_params_from_view(ws, panel, view);
|
||||
params.cmd_spec = df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_PickFile);
|
||||
params.cmd_spec = df_cmd_spec_from_core_cmd_kind(kv_info[idx].fill_with_file ? DF_CoreCmdKind_PickFile : DF_CoreCmdKind_PickFolder);
|
||||
df_cmd_params_mark_slot(¶ms, DF_CmdParamSlot_CmdSpec);
|
||||
df_push_cmd__root(¶ms, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_RunCommand));
|
||||
tv->pick_dst_kind = kv_info[idx].storage_child_kind;
|
||||
|
||||
Reference in New Issue
Block a user