From b9019eb34b5e97662646815d18e1de8b2657cf5a Mon Sep 17 00:00:00 2001 From: williamisbeast95 Date: Fri, 15 May 2026 20:17:09 -0700 Subject: [PATCH] Add preset number to window title and bump to 2.0.1 --- CHANGELOG.md | 7 +++++++ CMakeLists.txt | 2 +- src/SDLRenderingWindow.cpp | 18 ++++++++++++++++-- 3 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..54513cf --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,7 @@ +# Changelog + +## 2.0.1 (2026-05-16) + +- Added preset number in the window title when `window.displayPresetNameInTitle=true`. +- Uses numeric suffix from preset names like `MilkDrop2077.0001.milk` when present. +- Falls back to playlist position when preset filename does not contain a numeric suffix. diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ee7050..6ee4937 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON) project(projectMSDL LANGUAGES C CXX - VERSION 2.0.0 + VERSION 2.0.1 ) list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") diff --git a/src/SDLRenderingWindow.cpp b/src/SDLRenderingWindow.cpp index 1516acf..420f300 100644 --- a/src/SDLRenderingWindow.cpp +++ b/src/SDLRenderingWindow.cpp @@ -14,6 +14,8 @@ #include +#include + const char* SDLRenderingWindow::name() const { return "SDL2 Rendering Window"; @@ -396,14 +398,25 @@ void SDLRenderingWindow::UpdateWindowTitle() auto& app = Poco::Util::Application::instance(); auto& projectMWrapper = app.getSubsystem(); - auto presetName = projectm_playlist_item(projectMWrapper.Playlist(), projectm_playlist_get_position(projectMWrapper.Playlist())); + auto currentPosition = projectm_playlist_get_position(projectMWrapper.Playlist()); + auto presetName = projectm_playlist_item(projectMWrapper.Playlist(), currentPosition); if (presetName) { Poco::Path presetFile(presetName); projectm_playlist_free_string(presetName); - newTitle += " ➫ " + presetFile.getBaseName(); + auto presetBaseName = presetFile.getBaseName(); + std::string presetNumber = std::to_string(currentPosition + 1); + + // If basename is like "MilkDrop2077.0001", use the trailing digits as preset number. + std::smatch match; + if (std::regex_match(presetBaseName, match, std::regex(R"(.*\.(\d+)$)")) && match.size() > 1) + { + presetNumber = match[1].str(); + } + + newTitle += " [" + presetNumber + "] -> " + presetBaseName; } if (projectm_get_preset_locked(projectMWrapper.ProjectM())) @@ -461,3 +474,4 @@ void SDLRenderingWindow::OnConfigurationPropertyRemoved(const std::string& key) UpdateWindowTitle(); } } +