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