mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-23 22:54:08 -06:00
Fix serveral issues on Linux environments
1. fix the crash issue in ComboBox 2. fix the network agent directory not correct issue 3. fix the first 3d tab switch failed issue 4. fix the filemenu not correct issue Change-Id: I6a99218c0f7edbd57114ca1d9ff8c5c020d26d94 (cherry picked from commit b5e1b06af42aea9d1413be29dd58150b2ac8d470)
This commit is contained in:
parent
b468b0da0e
commit
e228e72db1
4 changed files with 25 additions and 21 deletions
|
@ -2228,11 +2228,11 @@ bool GUI_App::on_init_inner()
|
||||||
|
|
||||||
// An ugly solution to GH #5537 in which GUI_App::init_opengl (normally called from events wxEVT_PAINT
|
// An ugly solution to GH #5537 in which GUI_App::init_opengl (normally called from events wxEVT_PAINT
|
||||||
// and wxEVT_SET_FOCUS before GUI_App::post_init is called) wasn't called before GUI_App::post_init and OpenGL wasn't initialized.
|
// and wxEVT_SET_FOCUS before GUI_App::post_init is called) wasn't called before GUI_App::post_init and OpenGL wasn't initialized.
|
||||||
#ifdef __linux__
|
//#ifdef __linux__
|
||||||
if (!m_post_initialized && m_opengl_initialized) {
|
// if (!m_post_initialized && m_opengl_initialized) {
|
||||||
#else
|
//#else
|
||||||
if (!m_post_initialized) {
|
if (!m_post_initialized) {
|
||||||
#endif
|
//#endif
|
||||||
m_post_initialized = true;
|
m_post_initialized = true;
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
this->mainframe->register_win32_callbacks();
|
this->mainframe->register_win32_callbacks();
|
||||||
|
|
|
@ -139,7 +139,7 @@ static wxIcon main_frame_icon(GUI_App::EAppMode app_mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
// BBS
|
// BBS
|
||||||
#ifdef __WINDOWS__
|
#ifndef __APPLE__
|
||||||
#define BORDERLESS_FRAME_STYLE (wxRESIZE_BORDER | wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxCLOSE_BOX)
|
#define BORDERLESS_FRAME_STYLE (wxRESIZE_BORDER | wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxCLOSE_BOX)
|
||||||
#else
|
#else
|
||||||
#define BORDERLESS_FRAME_STYLE (wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxCLOSE_BOX)
|
#define BORDERLESS_FRAME_STYLE (wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxCLOSE_BOX)
|
||||||
|
@ -178,7 +178,7 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, BORDERLESS_FRAME_
|
||||||
// Fonts were created by the DPIFrame constructor for the monitor, on which the window opened.
|
// Fonts were created by the DPIFrame constructor for the monitor, on which the window opened.
|
||||||
wxGetApp().update_fonts(this);
|
wxGetApp().update_fonts(this);
|
||||||
|
|
||||||
#ifdef __WINDOWS__
|
#ifndef __APPLE__
|
||||||
m_topbar = new BBLTopbar(this);
|
m_topbar = new BBLTopbar(this);
|
||||||
#else
|
#else
|
||||||
auto panel_topbar = new wxPanel(this, wxID_ANY);
|
auto panel_topbar = new wxPanel(this, wxID_ANY);
|
||||||
|
@ -284,7 +284,7 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, BORDERLESS_FRAME_
|
||||||
//Bind(wxEVT_MENU, [this](wxCommandEvent&) { m_plater->cut_selection_to_clipboard(); }, wxID_HIGHEST + wxID_CUT);
|
//Bind(wxEVT_MENU, [this](wxCommandEvent&) { m_plater->cut_selection_to_clipboard(); }, wxID_HIGHEST + wxID_CUT);
|
||||||
Bind(wxEVT_SIZE, [this](wxSizeEvent&) {
|
Bind(wxEVT_SIZE, [this](wxSizeEvent&) {
|
||||||
BOOST_LOG_TRIVIAL(trace) << "mainframe: size changed, is maximized = " << this->IsMaximized();
|
BOOST_LOG_TRIVIAL(trace) << "mainframe: size changed, is maximized = " << this->IsMaximized();
|
||||||
#ifdef __WINDOWS__
|
#ifndef __APPLE__
|
||||||
if (this->IsMaximized()) {
|
if (this->IsMaximized()) {
|
||||||
m_topbar->SetWindowSize();
|
m_topbar->SetWindowSize();
|
||||||
} else {
|
} else {
|
||||||
|
@ -326,7 +326,7 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, BORDERLESS_FRAME_
|
||||||
// initialize layout
|
// initialize layout
|
||||||
m_main_sizer = new wxBoxSizer(wxVERTICAL);
|
m_main_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
wxSizer* sizer = new wxBoxSizer(wxVERTICAL);
|
wxSizer* sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
#ifdef __WINDOWS__
|
#ifndef __APPLE__
|
||||||
sizer->Add(m_topbar, 0, wxEXPAND);
|
sizer->Add(m_topbar, 0, wxEXPAND);
|
||||||
#else
|
#else
|
||||||
sizer->Add(panel_topbar, 0, wxEXPAND);
|
sizer->Add(panel_topbar, 0, wxEXPAND);
|
||||||
|
@ -854,7 +854,7 @@ void MainFrame::init_tabpanel()
|
||||||
//monitor
|
//monitor
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __WINDOWS__
|
#ifndef __APPLE__
|
||||||
if (sel == tp3DEditor) {
|
if (sel == tp3DEditor) {
|
||||||
m_topbar->EnableUndoRedoItems();
|
m_topbar->EnableUndoRedoItems();
|
||||||
}
|
}
|
||||||
|
@ -1507,7 +1507,7 @@ void MainFrame::on_dpi_changed(const wxRect& suggested_rect)
|
||||||
dynamic_cast<Notebook*>(m_tabpanel)->Rescale();
|
dynamic_cast<Notebook*>(m_tabpanel)->Rescale();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __WINDOWS__
|
#ifndef __APPLE__
|
||||||
// BBS
|
// BBS
|
||||||
m_topbar->Rescale();
|
m_topbar->Rescale();
|
||||||
#endif
|
#endif
|
||||||
|
@ -1630,7 +1630,7 @@ static wxMenu* generate_help_menu()
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
// About
|
// About
|
||||||
#ifdef __WINDOWS__
|
#ifndef __APPLE__
|
||||||
wxString about_title = wxString::Format(_L("&About %s"), SLIC3R_APP_FULL_NAME);
|
wxString about_title = wxString::Format(_L("&About %s"), SLIC3R_APP_FULL_NAME);
|
||||||
append_menu_item(helpMenu, wxID_ANY, about_title, about_title,
|
append_menu_item(helpMenu, wxID_ANY, about_title, about_title,
|
||||||
[](wxCommandEvent&) { Slic3r::GUI::about(); });
|
[](wxCommandEvent&) { Slic3r::GUI::about(); });
|
||||||
|
@ -1691,7 +1691,7 @@ void MainFrame::init_menubar_as_editor()
|
||||||
[this](){return can_start_new_project(); }, this);
|
[this](){return can_start_new_project(); }, this);
|
||||||
// Open Project
|
// Open Project
|
||||||
|
|
||||||
#ifdef __WINDOWS__
|
#ifndef __APPLE__
|
||||||
append_menu_item(fileMenu, wxID_ANY, _L("Open Project") + dots + "\tCtrl+O", _L("Open a project file"),
|
append_menu_item(fileMenu, wxID_ANY, _L("Open Project") + dots + "\tCtrl+O", _L("Open a project file"),
|
||||||
[this](wxCommandEvent&) { if (m_plater) m_plater->load_project(); }, "menu_open", nullptr,
|
[this](wxCommandEvent&) { if (m_plater) m_plater->load_project(); }, "menu_open", nullptr,
|
||||||
[this](){return can_open_project(); }, this);
|
[this](){return can_open_project(); }, this);
|
||||||
|
@ -1722,7 +1722,7 @@ void MainFrame::init_menubar_as_editor()
|
||||||
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_open_project() && (m_recent_projects.GetCount() > 0)); }, recent_projects_submenu->GetId());
|
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_open_project() && (m_recent_projects.GetCount() > 0)); }, recent_projects_submenu->GetId());
|
||||||
|
|
||||||
// BBS: close save project
|
// BBS: close save project
|
||||||
#ifdef __WINDOWS__
|
#ifndef __APPLE__
|
||||||
append_menu_item(fileMenu, wxID_ANY, _L("Save Project") + "\tCtrl+S", _L("Save current project to file"),
|
append_menu_item(fileMenu, wxID_ANY, _L("Save Project") + "\tCtrl+S", _L("Save current project to file"),
|
||||||
[this](wxCommandEvent&) { if (m_plater) m_plater->save_project(); }, "menu_save", nullptr,
|
[this](wxCommandEvent&) { if (m_plater) m_plater->save_project(); }, "menu_save", nullptr,
|
||||||
[this](){return m_plater != nullptr && can_save(); }, this);
|
[this](){return m_plater != nullptr && can_save(); }, this);
|
||||||
|
@ -1733,7 +1733,7 @@ void MainFrame::init_menubar_as_editor()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef __WINDOWS__
|
#ifndef __APPLE__
|
||||||
append_menu_item(fileMenu, wxID_ANY, _L("Save Project as") + dots + "\tCtrl+Shift+S", _L("Save current project as"),
|
append_menu_item(fileMenu, wxID_ANY, _L("Save Project as") + dots + "\tCtrl+Shift+S", _L("Save current project as"),
|
||||||
[this](wxCommandEvent&) { if (m_plater) m_plater->save_project(true); }, "menu_save", nullptr,
|
[this](wxCommandEvent&) { if (m_plater) m_plater->save_project(true); }, "menu_save", nullptr,
|
||||||
[this](){return m_plater != nullptr && can_save_as(); }, this);
|
[this](){return m_plater != nullptr && can_save_as(); }, this);
|
||||||
|
@ -1748,7 +1748,7 @@ void MainFrame::init_menubar_as_editor()
|
||||||
|
|
||||||
// BBS
|
// BBS
|
||||||
wxMenu *import_menu = new wxMenu();
|
wxMenu *import_menu = new wxMenu();
|
||||||
#ifdef __WINDOWS__
|
#ifndef __APPLE__
|
||||||
append_menu_item(import_menu, wxID_ANY, _L("Import 3MF/STL/STEP/OBJ/AMF") + dots + "\tCtrl+I", _L("Load a model"),
|
append_menu_item(import_menu, wxID_ANY, _L("Import 3MF/STL/STEP/OBJ/AMF") + dots + "\tCtrl+I", _L("Load a model"),
|
||||||
[this](wxCommandEvent&) { if (m_plater) {
|
[this](wxCommandEvent&) { if (m_plater) {
|
||||||
m_plater->add_model();
|
m_plater->add_model();
|
||||||
|
@ -1791,7 +1791,7 @@ void MainFrame::init_menubar_as_editor()
|
||||||
|
|
||||||
fileMenu->AppendSeparator();
|
fileMenu->AppendSeparator();
|
||||||
|
|
||||||
#ifdef __WINDOWS__
|
#ifndef __APPLE__
|
||||||
append_menu_item(fileMenu, wxID_EXIT, _L("Quit"), wxString::Format(_L("Quit")),
|
append_menu_item(fileMenu, wxID_EXIT, _L("Quit"), wxString::Format(_L("Quit")),
|
||||||
[this](wxCommandEvent&) { Close(false); }, "menu_exit", nullptr);
|
[this](wxCommandEvent&) { Close(false); }, "menu_exit", nullptr);
|
||||||
#else
|
#else
|
||||||
|
@ -1812,7 +1812,7 @@ void MainFrame::init_menubar_as_editor()
|
||||||
wxString hotkey_delete = "Del";
|
wxString hotkey_delete = "Del";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __WINDOWS__
|
#ifndef __APPLE__
|
||||||
// BBS undo
|
// BBS undo
|
||||||
append_menu_item(editMenu, wxID_ANY, _L("Undo") + "\tCtrl+Z",
|
append_menu_item(editMenu, wxID_ANY, _L("Undo") + "\tCtrl+Z",
|
||||||
_L("Undo"), [this](wxCommandEvent&) { m_plater->undo(); },
|
_L("Undo"), [this](wxCommandEvent&) { m_plater->undo(); },
|
||||||
|
@ -2086,7 +2086,7 @@ void MainFrame::init_menubar_as_editor()
|
||||||
auto helpMenu = generate_help_menu();
|
auto helpMenu = generate_help_menu();
|
||||||
|
|
||||||
|
|
||||||
#ifdef __WINDOWS__
|
#ifndef __APPLE__
|
||||||
m_topbar->SetFileMenu(fileMenu);
|
m_topbar->SetFileMenu(fileMenu);
|
||||||
if (editMenu)
|
if (editMenu)
|
||||||
m_topbar->AddDropDownSubMenu(editMenu, _L("Edit"));
|
m_topbar->AddDropDownSubMenu(editMenu, _L("Edit"));
|
||||||
|
|
|
@ -120,7 +120,7 @@ wxString ComboBox::GetTextLabel() const
|
||||||
|
|
||||||
bool ComboBox::SetFont(wxFont const& font)
|
bool ComboBox::SetFont(wxFont const& font)
|
||||||
{
|
{
|
||||||
if (GetTextCtrl()->IsShown())
|
if (GetTextCtrl() && GetTextCtrl()->IsShown())
|
||||||
return GetTextCtrl()->SetFont(font);
|
return GetTextCtrl()->SetFont(font);
|
||||||
else
|
else
|
||||||
return TextInput::SetFont(font);
|
return TextInput::SetFont(font);
|
||||||
|
|
|
@ -111,7 +111,9 @@ int NetworkAgent::initialize_network_module(bool using_backup)
|
||||||
{
|
{
|
||||||
//int ret = -1;
|
//int ret = -1;
|
||||||
std::string library;
|
std::string library;
|
||||||
auto plugin_folder = boost::filesystem::path(wxStandardPaths::Get().GetUserDataDir().ToUTF8().data()) / "plugins";
|
std::string data_dir_str = data_dir();
|
||||||
|
boost::filesystem::path data_dir_path(data_dir_str);
|
||||||
|
auto plugin_folder = data_dir_path / "plugins";
|
||||||
|
|
||||||
if (using_backup) {
|
if (using_backup) {
|
||||||
plugin_folder = plugin_folder/"backup";
|
plugin_folder = plugin_folder/"backup";
|
||||||
|
@ -323,7 +325,9 @@ void* NetworkAgent::get_bambu_source_entry()
|
||||||
|
|
||||||
//int ret = -1;
|
//int ret = -1;
|
||||||
std::string library;
|
std::string library;
|
||||||
auto plugin_folder = boost::filesystem::path(wxStandardPaths::Get().GetUserDataDir().ToUTF8().data()) / "plugins";
|
std::string data_dir_str = data_dir();
|
||||||
|
boost::filesystem::path data_dir_path(data_dir_str);
|
||||||
|
auto plugin_folder = data_dir_path / "plugins";
|
||||||
#if defined(_MSC_VER) || defined(_WIN32)
|
#if defined(_MSC_VER) || defined(_WIN32)
|
||||||
wchar_t lib_wstr[128];
|
wchar_t lib_wstr[128];
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue