GUI: Add menu option to open examples directory

This commit is contained in:
Colin Kinloch 2024-01-03 21:59:53 +00:00 committed by tildearrow
parent 6956443904
commit 04f2039803
3 changed files with 22 additions and 8 deletions

View file

@ -109,6 +109,7 @@ option(WARNINGS_ARE_ERRORS "Whether warnings in furnace's C++ code should be tre
option(WITH_DEMOS "Install demo songs" ON)
option(WITH_INSTRUMENTS "Install instruments" ON)
option(WITH_WAVETABLES "Install wavetables" ON)
option(SHOW_OPEN_ASSETS_MENU_ENTRY "Show option to open built-in assets directory (on supported platforms)" ON)
set(DEPENDENCIES_INCLUDE_DIRS extern/IconFontCppHeaders src/icon)
@ -1052,14 +1053,21 @@ if (NOT ANDROID OR TERMUX)
install(DIRECTORY doc DESTINATION ${CMAKE_INSTALL_DOCDIR})
install(DIRECTORY papers DESTINATION ${CMAKE_INSTALL_DOCDIR}/other)
install(FILES LICENSE DESTINATION ${CMAKE_INSTALL_DATADIR}/licenses/furnace)
if (WITH_DEMOS)
install(DIRECTORY demos DESTINATION ${CMAKE_INSTALL_DATADIR}/furnace)
endif()
if (WITH_INSTRUMENTS)
install(DIRECTORY instruments DESTINATION ${CMAKE_INSTALL_DATADIR}/furnace)
endif()
if (WITH_WAVETABLES)
install(DIRECTORY wavetables DESTINATION ${CMAKE_INSTALL_DATADIR}/furnace)
if (WITH_DEMOS OR WITH_INSTRUMENTS OR WITH_WAVETABLES)
set(FURNACE_DATADIR ${CMAKE_INSTALL_DATADIR}/furnace)
if (WITH_DEMOS)
install(DIRECTORY demos DESTINATION ${FURNACE_DATADIR})
endif()
if (WITH_INSTRUMENTS)
install(DIRECTORY instruments DESTINATION ${FURNACE_DATADIR})
endif()
if (WITH_WAVETABLES)
install(DIRECTORY wavetables DESTINATION ${FURNACE_DATADIR})
endif()
add_compile_definitions(FURNACE_DATADIR="${CMAKE_INSTALL_PREFIX}/${FURNACE_DATADIR}")
if (SHOW_OPEN_ASSETS_MENU_ENTRY)
add_compile_definitions(SHOW_OPEN_ASSETS_MENU_ENTRY)
endif()
endif()
foreach(num 16 32 64 128 256 512)
set(res ${num}x${num})

View file

@ -272,6 +272,7 @@ Available options:
| `WITH_DEMOS` | `ON` | Install demo songs on `make install` |
| `WITH_INSTRUMENTS` | `ON` | Install demo instruments on `make install` |
| `WITH_WAVETABLES` | `ON` | Install wavetables on `make install` |
| `SHOW_OPEN_ASSETS_MENU_ENTRY` | `ON` | `Show option to open built-in assets directory (on supported platforms)` |
(\*) `ON` if system-installed JACK detected, otherwise `OFF`

View file

@ -4316,6 +4316,11 @@ bool FurnaceGUI::loop() {
ImGui::EndMenu();
}
}
#if defined(FURNACE_DATADIR) && defined(SHOW_OPEN_ASSETS_MENU_ENTRY)
if (ImGui::MenuItem("open built-in assets directory")) {
SDL_OpenURL("file://" FURNACE_DATADIR);
}
#endif
ImGui::BeginDisabled(exitDisabledTimer);
ImGui::Separator();
if (ImGui::MenuItem("restore backup",BIND_FOR(GUI_ACTION_OPEN_BACKUP))) {