Path: blob/main/cad/PrusaSlicer/files/patch-src_slic3r_GUI_GUI__App.cpp
16461 views
--- src/slic3r/GUI/GUI_App.cpp.orig 2025-04-10 11:26:51 UTC1+++ src/slic3r/GUI/GUI_App.cpp2@@ -412,7 +412,7 @@ class SplashScreen : public wxSplashScreen (private)3};456-#ifdef __linux__7+#if defined(__linux__) || defined(__FreeBSD__)8bool static check_old_linux_datadir(const wxString& app_name) {9// If we are on Linux and the datadir does not exist yet, look into the old10// location where the datadir was before version 2.3. If we find it there,11@@ -1342,6 +1342,9 @@ bool GUI_App::on_init_inner()12// Set initialization of image handlers before any UI actions - See GH issue #746913wxInitAllImageHandlers();1415+ // Silence warnings generated with wxWidgets 3.216+ wxSizerFlags::DisableConsistencyChecks();17+18// Set our own gui log as an active target19m_log_gui = new LogGui();20wxLog::SetActiveTarget(m_log_gui);21@@ -1372,7 +1375,7 @@ bool GUI_App::on_init_inner()22const wxString resources_dir = from_u8(Slic3r::resources_dir());23wxCHECK_MSG(wxDirExists(resources_dir), false, wxString::Format("Resources path does not exist or is not a directory: %s", resources_dir));2425-#ifdef __linux__26+#if defined(__linux__) || defined(__FreeBSD__)27if (! check_old_linux_datadir(GetAppName())) {28std::cerr << "Quitting, user chose to move their data to new location." << std::endl;29return false;30@@ -1477,7 +1480,7 @@ bool GUI_App::on_init_inner()31if (!default_splashscreen_pos)32// revert "restore_win_position" value if application wasn't crashed33get_app_config()->set("restore_win_position", "1");34-#ifndef __linux__35+#if !defined(__linux__) && !defined(__FreeBSD__)36wxYield();37#endif38scrn->SetText(_L("Loading configuration")+ dots);39@@ -1660,7 +1663,7 @@ bool GUI_App::on_init_inner()40// and wxEVT_SET_FOCUS before GUI_App::post_init is called) wasn't called before GUI_App::post_init and OpenGL wasn't initialized.41// Since issue #9774 Where same problem occured on MacOS Ventura, we decided to have this check on MacOS as well.4243-#if defined(__linux__) || defined(__APPLE__)44+#if defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__)45if (!m_post_initialized && m_opengl_initialized) {46#else47if (!m_post_initialized) {48@@ -2350,7 +2353,7 @@ bool GUI_App::switch_language()49}50}5152-#ifdef __linux__53+#if defined(__linux__) || (__FreeBSD__)54static const wxLanguageInfo* linux_get_existing_locale_language(const wxLanguageInfo* language,55const wxLanguageInfo* system_language)56{57@@ -2552,7 +2555,7 @@ bool GUI_App::load_language(wxString language, bool in58m_language_info_best = wxLocale::FindLanguageInfo(best_language);59BOOST_LOG_TRIVIAL(trace) << boost::format("Best translation language detected (may be different from user locales): %1%") % m_language_info_best->CanonicalName.ToUTF8().data();60}61- #ifdef __linux__62+ #if defined(__linux__) || defined(__FreeBSD__)63wxString lc_all;64if (wxGetEnv("LC_ALL", &lc_all) && ! lc_all.IsEmpty()) {65// Best language returned by wxWidgets on Linux apparently does not respect LC_ALL.66@@ -2561,6 +2564,7 @@ bool GUI_App::load_language(wxString language, bool in67}68#endif69}70+ m_language_info_best = nullptr;71}7273const wxLanguageInfo *language_info = language.empty() ? nullptr : wxLocale::FindLanguageInfo(language);74@@ -2605,7 +2609,7 @@ bool GUI_App::load_language(wxString language, bool in75} else if (m_language_info_system != nullptr && language_info->CanonicalName.BeforeFirst('_') == m_language_info_system->CanonicalName.BeforeFirst('_'))76language_info = m_language_info_system;7778-#ifdef __linux__79+#if defined(__linux__) || defined(__FreeBSD__)80// If we can't find this locale , try to use different one for the language81// instead of just reporting that it is impossible to switch.82if (! wxLocale::IsAvailable(language_info->Language)) {83@@ -2726,7 +2730,7 @@ wxMenu* GUI_App::get_config_menu(MainFrame* main_frame84local_menu->Append(config_id_base + ConfigMenuTakeSnapshot, _L("Take Configuration &Snapshot"), _L("Capture a configuration snapshot"));85local_menu->Append(config_id_base + ConfigMenuUpdateConf, _L("Check for Configuration Updates"), _L("Check for configuration updates"));86local_menu->Append(config_id_base + ConfigMenuUpdateApp, _L("Check for Application Updates"), _L("Check for new version of application"));87-#if defined(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION)88+#if (defined(__linux__) || defined(__FreeBSD__)) && defined(SLIC3R_DESKTOP_INTEGRATION)89//if (DesktopIntegrationDialog::integration_possible())90local_menu->Append(config_id_base + ConfigMenuDesktopIntegration, _L("Desktop Integration"), _L("Desktop Integration"));91#endif //(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION)92@@ -2760,7 +2764,7 @@ wxMenu* GUI_App::get_config_menu(MainFrame* main_frame93case ConfigMenuUpdateApp:94app_version_check(true);95break;96-#ifdef __linux__97+#if defined(__linux__) || defined(__FreeBSD__)98case ConfigMenuDesktopIntegration:99show_desktop_integration_dialog();100break;101@@ -3404,7 +3408,7 @@ void GUI_App::show_desktop_integration_dialog()102103void GUI_App::show_desktop_integration_dialog()104{105-#ifdef __linux__106+#if defined(__linux__) || defined(__FreeBSD__)107//wxCHECK_MSG(mainframe != nullptr, false, "Internal error: Main frame not created / null");108DesktopIntegrationDialog dialog(mainframe);109dialog.ShowModal();110@@ -3424,7 +3428,7 @@ void GUI_App::show_downloader_registration_dialog()111if (msg.ShowModal() == wxID_YES) {112auto downloader_worker = new DownloaderUtils::Worker(nullptr);113downloader_worker->perform_download_register(app_config->get("url_downloader_dest"));114-#if defined(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION)115+#if (defined(__linux__) || defined(__FreeBSD__)) && defined(SLIC3R_DESKTOP_INTEGRATION)116if (DownloaderUtils::Worker::perform_registration_linux)117DesktopIntegrationDialog::perform_downloader_desktop_integration();118#endif //(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION)119@@ -3839,7 +3843,7 @@ void GUI_App::start_download(std::string url)120return;121}122123- #if defined(__APPLE__) || (defined(__linux__) && !defined(SLIC3R_DESKTOP_INTEGRATION))124+ #if defined(__APPLE__) || ((defined(__linux__) || defined(__FreeBSD__)) && !defined(SLIC3R_DESKTOP_INTEGRATION))125if (app_config && !app_config->get_bool("downloader_url_registered"))126{127notification_manager()->push_notification(NotificationType::URLNotRegistered);128129130