From 8e573a98087634d65eb9e9077c794ec798bb0109 Mon Sep 17 00:00:00 2001 From: dashodanger Date: Fri, 25 Oct 2024 17:04:23 -0600 Subject: [PATCH] Check for .zip extensions instead of .oaf; disable 7z support; do not collapse disabled modules --- libraries/physfs/CMakeLists.txt | 2 +- source/m_addons.cc | 2 +- source/main.cc | 2 +- source/ui_module.cc | 57 ++++++++++++++++++--------------- source/ui_module.h | 2 ++ 5 files changed, 36 insertions(+), 29 deletions(-) diff --git a/libraries/physfs/CMakeLists.txt b/libraries/physfs/CMakeLists.txt index 96fff5eef..897508fd8 100644 --- a/libraries/physfs/CMakeLists.txt +++ b/libraries/physfs/CMakeLists.txt @@ -109,7 +109,7 @@ if(NOT PHYSFS_ARCHIVE_ZIP) add_definitions(-DPHYSFS_SUPPORTS_ZIP=0) endif() -option(PHYSFS_ARCHIVE_7Z "Enable 7zip support" TRUE) +option(PHYSFS_ARCHIVE_7Z "Enable 7zip support" OFF) if(NOT PHYSFS_ARCHIVE_7Z) add_definitions(-DPHYSFS_SUPPORTS_7Z=0) endif() diff --git a/source/m_addons.cc b/source/m_addons.cc index 0d8a3a56b..ce38d71df 100644 --- a/source/m_addons.cc +++ b/source/m_addons.cc @@ -225,7 +225,7 @@ void VFS_ScanForAddons() continue; } - if (statter.filetype == PHYSFS_FILETYPE_DIRECTORY || (statter.filetype == PHYSFS_FILETYPE_REGULAR && GetExtension(*p) == ".oaf")) + if (statter.filetype == PHYSFS_FILETYPE_DIRECTORY || (statter.filetype == PHYSFS_FILETYPE_REGULAR && GetExtension(*p) == ".zip")) { addon_info_t info; diff --git a/source/main.cc b/source/main.cc index b40848992..b0af99063 100644 --- a/source/main.cc +++ b/source/main.cc @@ -1715,7 +1715,7 @@ softrestart:; FL_MENU_TOGGLE | (randomize_misc ? FL_MENU_VALUE : 0)); if (all_addons.size() == 0) { - main_win->menu_bar->add(_("Addons/No folders or *.oaf files"), nullptr, nullptr, nullptr, + main_win->menu_bar->add(_("Addons/No folders or *.zip files"), nullptr, nullptr, nullptr, FL_MENU_INACTIVE); main_win->menu_bar->add(_("Addons/found in the \\/addons directory!"), nullptr, nullptr, nullptr, FL_MENU_INACTIVE); diff --git a/source/ui_module.cc b/source/ui_module.cc index 54f50ce32..981b93264 100644 --- a/source/ui_module.cc +++ b/source/ui_module.cc @@ -39,6 +39,7 @@ UI_Module::UI_Module(int X, int Y, int W, int H, const std::string &id, const st box(box_style); id_name = id; + og_label = label; if ((red >= 0) && (green >= 0) && (blue >= 0)) { @@ -115,7 +116,7 @@ void UI_Module::AddHeader(const std::string &opt, const std::string &label, int if (!mod_button->value()) { - rhead->hide(); + rhead->deactivate(); } add(rhead); @@ -145,7 +146,7 @@ void UI_Module::AddUrl(const std::string &opt, const std::string &label, const s if (!mod_button->value()) { - rurl->hide(); + rurl->deactivate(); } add(rurl); @@ -211,7 +212,7 @@ void UI_Module::AddOption(const std::string &opt, const std::string &label, cons if (!mod_button->value()) { - rch->hide(); + rch->deactivate(); } add(rch); @@ -230,7 +231,6 @@ void UI_Module::AddSliderOption(const std::string &opt, std::string &label, cons const std::string &randomize_group, const std::string &default_value) { int nw = this->parent()->w(); - // int nh = KromulentHeight(30); int nx = x() + KromulentWidth(6); int ny = y() + cur_opt_y - KromulentHeight(15); @@ -401,7 +401,7 @@ void UI_Module::AddSliderOption(const std::string &opt, std::string &label, cons if (!mod_button->value()) { - rsl->hide(); + rsl->deactivate(); } add(rsl); @@ -466,7 +466,7 @@ void UI_Module::AddButtonOption(const std::string &opt, const std::string &label if (!mod_button->value()) { - rbt->hide(); + rbt->deactivate(); } add(rbt); @@ -481,18 +481,18 @@ void UI_Module::AddButtonOption(const std::string &opt, const std::string &label int UI_Module::CalcHeight() const { - if (mod_button->value()) - { - return cur_opt_y + KromulentHeight(6); - } - else - { - return KromulentHeight(34); - } + return cur_opt_y + KromulentHeight(6); } void UI_Module::update_Enable() { + if (!Is_UI()) + { + if (mod_button->value()) + heading->copy_label(og_label.c_str()); + else + heading->copy_label(StringFormat("%s (DISABLED)", og_label.c_str()).c_str()); + } std::map::const_iterator IT; std::map::const_iterator IT2; @@ -506,11 +506,11 @@ void UI_Module::update_Enable() if (mod_button->value()) { - M->show(); + M->activate(); } else { - M->hide(); + M->deactivate(); } } @@ -520,11 +520,11 @@ void UI_Module::update_Enable() if (mod_button->value()) { - M->show(); + M->activate(); } else { - M->hide(); + M->deactivate(); } } @@ -533,11 +533,11 @@ void UI_Module::update_Enable() UI_RButton *M = IT3->second; if (mod_button->value()) { - M->show(); + M->activate(); } else { - M->hide(); + M->deactivate(); } } @@ -546,11 +546,11 @@ void UI_Module::update_Enable() UI_RHeader *M = IT4->second; if (mod_button->value()) { - M->show(); + M->activate(); } else { - M->hide(); + M->deactivate(); } } @@ -559,11 +559,11 @@ void UI_Module::update_Enable() UI_RLink *M = IT5->second; if (mod_button->value()) { - M->show(); + M->activate(); } else { - M->hide(); + M->deactivate(); } } } @@ -1266,11 +1266,16 @@ bool UI_CustomMods::ShowModule(const std::string &id, bool new_shown) return true; } - // visibility definitely changed - if (new_shown) { M->show(); + if (!M->Is_UI()) + { + if (M->mod_button->value()) + M->heading->copy_label(M->og_label.c_str()); + else + M->heading->copy_label(StringFormat("%s (DISABLED)", M->og_label.c_str()).c_str()); + } } else { diff --git a/source/ui_module.h b/source/ui_module.h index b9521f89f..cbd8713d6 100644 --- a/source/ui_module.h +++ b/source/ui_module.h @@ -56,6 +56,8 @@ class UI_Module : public Fl_Group std::string id_name; + std::string og_label; // For toggling the (Disabled) text + // only used while positioning the options (as they are added) int cur_opt_y;