Skip to content

ModManagerGUI redo v2#268

Open
getcetc wants to merge 2 commits intocortex-command-community:developmentfrom
getcetc:ModManagerGUI-redo-v2
Open

ModManagerGUI redo v2#268
getcetc wants to merge 2 commits intocortex-command-community:developmentfrom
getcetc:ModManagerGUI-redo-v2

Conversation

@getcetc
Copy link
Contributor

@getcetc getcetc commented Feb 10, 2026

ModManagerGUI.mp4

Building on previous changes that grouped scripts by collapsible module categories.

This PR also adds glyphs for digits, apostrophe, dash, period and underscore to the title screen font, here used for module titles.

Copy link
Contributor

@HeliumAnt HeliumAnt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing work! Fixes needed for linux/macos, also some questionable code style decisions.

Comment on lines +262 to +271
void ModManagerGUI::OpenModsFolder() {
static const char folder[] = ".\\Mods";
#if defined(_WIN32)
ShellExecuteA(nullptr, "open", folder, nullptr, nullptr, 10);
// TODO: Confirm this works on Mac and Linux
#elif defined(__APPLE__)
system(("open \"" + folder + "\"").c_str());
#elif defined(__linux__)
system(("xdg-open \"" + folder + "\" &").c_str());
#endif
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move to System, please. Also cstrings can't be concatenated like this, use std::string, std::filesytstem::path or std::format instead. Maybe use SDL_OpenURL for linux/macos (may only work with absolute paths)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, will! Going to note that i won't be able to check this on linux and macos

Comment on lines +286 to +296
static auto toggleToggleEntryButton = [&](bool enable) {
m_ToggleListEntryButton->SetVisible(enable);
m_ToggleListEntryButton->SetEnabled(enable);
};
static auto resetRightHandSide = [&]() {
UpdateModuleHeader(-1);
m_ModOrScriptDescriptionLabel->SetText(GetDisclaimerText());
m_ToggleListEntryButton->SetVisible(false);
m_ToggleListEntryButton->SetEnabled(false);
toggleToggleEntryButton(false);
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just make these (private) member functions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good, will

}

// Unique_ptr so it gets GC'd
std::unique_ptr<BITMAP> newIconBm8Streched(create_bitmap_ex(8, maxSize, maxSize));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use std::unqiue_ptr<BitmapDeleter, BITMAP> (BitmapDeleter is currently with FrameMan iirc) otherwise the bitmap isn't deallocated properly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is new to me and im glad to learn this, i'll look into it and change this

@@ -14,9 +15,15 @@
#include "GUIButton.h"
#include "GUIListBox.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing <algorithm> and <cctype> include

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh! Maybe that got left in another commit, but doubting. It ran for me, will look at it!

std::string formattedStr = module->GetFriendlyName();
if (formattedStr == "") {
formattedStr = g_PresetMan.GetDataModuleName(moduleIndex);
transform(formattedStr.begin(), formattedStr.end(), formattedStr.begin(), ::tolower);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

explicit std::transform and std::tolower (below as well). pretty sure this shouldn't work without that actually.

if (selectedModuleIconBm->h == 0 || selectedModuleIconBm->w == 0) {
return;
}
float aspect = float(selectedModuleIconBm->w) / float(selectedModuleIconBm->h);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bad practice, use static_cast please. this is just a horrendous way to write a c-style cast

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just freestyle'd here to get it over with, i'll change 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants