@@ -2518,7 +2518,7 @@ void render_button_pin_cwd(explorer_window &expl, bool cwd_exists_before_edit) n
2518
2518
swan_popup_modals::open_new_pin (expl.cwd , false );
2519
2519
}
2520
2520
bool result = global_state::pinned_save_to_disk ();
2521
- print_debug_msg (" pinned_save_to_disk: %d" , result);
2521
+ // print_debug_msg("pinned_save_to_disk: %d", result);
2522
2522
}
2523
2523
if (imgui::IsItemHovered ()) {
2524
2524
imgui::SetTooltip (" %s current working directory" , already_pinned ? " Unpin" : " Pin" );
@@ -2528,7 +2528,7 @@ void render_button_pin_cwd(explorer_window &expl, bool cwd_exists_before_edit) n
2528
2528
static
2529
2529
bool render_history_browser_button () noexcept
2530
2530
{
2531
- if (imgui::Button (ICON_CI_HISTORY " ##expl.wd_history" )) {
2531
+ if (imgui::Button (ICON_CI_HISTORY " ## expl.wd_history" )) {
2532
2532
return true ;
2533
2533
}
2534
2534
if (imgui::IsItemHovered ()) {
@@ -2629,6 +2629,16 @@ void render_more_controls_button(explorer_window &expl, bool cwd_exists_before_e
2629
2629
2630
2630
render_button_pin_cwd (expl, cwd_exists_before_edit);
2631
2631
2632
+ imgui::SameLine ();
2633
+
2634
+ if (imgui::Button (ICON_CI_FILE_ADD)) swan_popup_modals::open_new_file (expl.cwd .data (), expl.id );
2635
+ if (imgui::IsItemHovered ()) imgui::SetTooltip (" New file in cwd" );
2636
+
2637
+ imgui::SameLine ();
2638
+
2639
+ if (imgui::Button (ICON_CI_NEW_FOLDER)) swan_popup_modals::open_new_directory (expl.cwd .data (), expl.id );
2640
+ if (imgui::IsItemHovered ()) imgui::SetTooltip (" New directory in cwd" );
2641
+
2632
2642
if (cwd_exists_before_edit) {
2633
2643
imgui::SameLine ();
2634
2644
imgui::TextDisabled (ICON_CI_KEBAB_VERTICAL);
@@ -2935,6 +2945,33 @@ render_cwd_text_input_result render_cwd_text_input(explorer_window &expl,
2935
2945
return retval;
2936
2946
}
2937
2947
2948
+ static
2949
+ void render_menu_new_object (explorer_window const &expl, char const *label = " New" ) noexcept
2950
+ {
2951
+ if (imgui::BeginMenu (label)) {
2952
+ {
2953
+ imgui::ScopedTextColor tc (file_color ());
2954
+ if (imgui::Selectable (ICON_CI_FILE_ADD " File" )) swan_popup_modals::open_new_file (expl.cwd .data (), expl.id );
2955
+ }
2956
+ {
2957
+ imgui::ScopedTextColor tc (directory_color ());
2958
+ if (imgui::Selectable (ICON_CI_NEW_FOLDER " Directory" )) swan_popup_modals::open_new_directory (expl.cwd .data (), expl.id );
2959
+ }
2960
+ imgui::SeparatorText (" TODO" );
2961
+ {
2962
+ imgui::ScopedDisable d (true );
2963
+ imgui::ScopedTextColor tc (symlink_color ());
2964
+ if (imgui::Selectable (ICON_CI_NEW_FOLDER " File Symlink" )) (void )d;
2965
+ }
2966
+ {
2967
+ imgui::ScopedDisable d (true );
2968
+ imgui::ScopedTextColor tc (symlink_color ());
2969
+ if (imgui::Selectable (ICON_CI_NEW_FILE " Directory Symlink" )) (void )d;
2970
+ }
2971
+ imgui::EndMenu ();
2972
+ }
2973
+ }
2974
+
2938
2975
bool swan_windows::render_explorer (explorer_window &expl, bool &open, finder_window &finder, bool any_popups_open) noexcept
2939
2976
{
2940
2977
#if 0
@@ -3491,13 +3528,7 @@ bool swan_windows::render_explorer(explorer_window &expl, bool &open, finder_win
3491
3528
auto result = g_file_op_payload.execute (expl);
3492
3529
// TODO: why is result unused?
3493
3530
}
3494
-
3495
- if (imgui::Selectable (" New file" )) {
3496
- swan_popup_modals::open_new_file (expl.cwd .data (), expl.id );
3497
- }
3498
- if (imgui::Selectable (" New directory" )) {
3499
- swan_popup_modals::open_new_directory (expl.cwd .data (), expl.id );
3500
- }
3531
+ render_menu_new_object (expl);
3501
3532
};
3502
3533
3503
3534
if (!drives_table_rendered) {
@@ -4414,6 +4445,13 @@ render_dirent_context_menu(explorer_window &expl, cwd_count_info const &cnt, swa
4414
4445
4415
4446
imgui::Separator ();
4416
4447
4448
+ if (!g_file_op_payload.items .empty () && !path_is_empty (expl.cwd ) && imgui::Selectable (" Paste" )) {
4449
+ auto result = g_file_op_payload.execute (expl);
4450
+ // TODO: why is result unused?
4451
+ }
4452
+
4453
+ render_menu_new_object (expl, " New (in cwd)" );
4454
+
4417
4455
if (imgui::BeginMenu (" Copy metadata" )) {
4418
4456
if (imgui::Selectable (" Name" )) {
4419
4457
imgui::SetClipboardText (expl.context_menu_target ->basic .path .data ());
0 commit comments