OSDN Git Service

[Feature] BGM、効果音のフォルダを開くメニューを追加
authorshimitei <shimitei@gmail.com>
Tue, 27 Apr 2021 13:50:02 +0000 (22:50 +0900)
committershimitei <shimitei@gmail.com>
Thu, 29 Apr 2021 04:26:34 +0000 (13:26 +0900)
src/ang_eng.rc
src/ang_jp.rc
src/main-win.cpp
src/main-win/main-win-menuitem.h
src/main-win/main-win-utils.cpp
src/main-win/main-win-utils.h

index f58e33d..5859641 100644 (file)
@@ -125,9 +125,14 @@ ANGBAND MENU
                        MENUITEM "Choose BG pict", 449
                }
 
+               MENUITEM SEPARATOR
                MENUITEM "&Music", 420
                MENUITEM "&Pause music when inactive", 421
+               MENUITEM "&Open music folder", 422
+               MENUITEM SEPARATOR
                MENUITEM "&Sound", 410
+               MENUITEM "&Open sound folder", 411
+               MENUITEM SEPARATOR
                MENUITEM "&HTML dump", 450
        }
 }
index db06388..3cc8431 100644 (file)
@@ -124,9 +124,14 @@ ANGBAND MENU
                        MENUITEM SEPARATOR
                        MENUITEM "\95Ç\8e\86\82ð\91I\91ð(&O)...", 449
                }
+               MENUITEM SEPARATOR
                MENUITEM "BGM(&M)", 420
                MENUITEM "\83A\83N\83e\83B\83u\8e\9e\82Ì\82ÝBGM\8dÄ\90¶(&M)", 421
+               MENUITEM "BGM\90Ý\92è\83t\83H\83\8b\83_\82ð\8aJ\82­(&O)", 422
+               MENUITEM SEPARATOR
                MENUITEM "\8cø\89Ê\89¹(&S)", 410
+               MENUITEM "\8cø\89Ê\89¹\90Ý\92è\83t\83H\83\8b\83_\82ð\8aJ\82­(&P)", 411
+               MENUITEM SEPARATOR
                MENUITEM "\89æ\96Ê\82ðHTML\82Å\95Û\91¶(&H)...", 450
        }
 }
index 294e750..a4e2bd6 100644 (file)
@@ -1940,11 +1940,23 @@ static void process_menus(player_type *player_ptr, WORD wCmd)
         use_pause_music_inactive = !use_pause_music_inactive;
         break;
     }
+    case IDM_OPTIONS_OPEN_MUSIC_DIR: {
+        std::vector<char> buf(MAIN_WIN_MAX_PATH);
+        path_build(&buf[0], MAIN_WIN_MAX_PATH, ANGBAND_DIR_XTRA_MUSIC, "music.cfg");
+        open_dir_in_explorer(&buf[0]);
+        break;
+    }
     case IDM_OPTIONS_SOUND: {
         arg_sound = !arg_sound;
         change_sound_mode(arg_sound);
         break;
     }
+    case IDM_OPTIONS_OPEN_SOUND_DIR: {
+        std::vector<char> buf(MAIN_WIN_MAX_PATH);
+        path_build(&buf[0], MAIN_WIN_MAX_PATH, ANGBAND_DIR_XTRA_SOUND, "sound.cfg");
+        open_dir_in_explorer(&buf[0]);
+        break;
+    }
     case IDM_OPTIONS_NO_BG: {
         change_bg_mode(bg_mode::BG_NONE);
         break;
index d9cf494..a360dbd 100644 (file)
 #define IDM_OPTIONS_NEW2_GRAPHICS 403
 #define IDM_OPTIONS_BIGTILE 409
 #define IDM_OPTIONS_SOUND 410
+#define IDM_OPTIONS_OPEN_SOUND_DIR 411
 #define IDM_OPTIONS_MUSIC 420
 #define IDM_OPTIONS_MUSIC_PAUSE_INACTIVE 421
+#define IDM_OPTIONS_OPEN_MUSIC_DIR 422
 #define IDM_OPTIONS_NO_BG 440
 #define IDM_OPTIONS_BG 441
 #define IDM_OPTIONS_PRESET_BG 442
index c6bc6c1..b00399d 100644 (file)
@@ -55,3 +55,12 @@ void save_screen_as_html(HWND hWnd)
         do_cmd_save_screen_html_aux(to_multibyte(&buf[0]).c_str(), 0);
     }
 }
+
+/*!
+ * @brief 対象ファイルを選択した状態でエクスプローラーを開く
+ * @param filename 対象ファイル
+ */
+void open_dir_in_explorer(char *filename) {
+    std::string str = "/select," + std::string(filename);
+    ShellExecuteW(NULL, NULL, L"explorer.exe", to_wchar(str.c_str()).wc_str(), NULL, SW_SHOWNORMAL);
+}
index b4debce..1d2ff34 100644 (file)
@@ -109,3 +109,4 @@ protected:
 
 bool is_already_running(void);
 void save_screen_as_html(HWND hWnd);
+void open_dir_in_explorer(char* filename);