mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-27 04:42:33 +00:00
Use wxwidgets fork instead of patch (#5184)
* Use wxwidgets fork instead of patch * fix build errors on Linux * Show/hide tabs accordingly
This commit is contained in:
@@ -924,29 +924,6 @@ void MainFrame::show_publish_button(bool show)
|
||||
// Layout();
|
||||
}
|
||||
|
||||
void MainFrame::show_calibration_button(bool show)
|
||||
{
|
||||
// #ifdef __APPLE__
|
||||
// bool shown = m_menubar->FindMenu(_L("Calibration")) != wxNOT_FOUND;
|
||||
// if (shown == show)
|
||||
// ;
|
||||
// else if (show)
|
||||
// m_menubar->Insert(3, m_calib_menu, wxString::Format("&%s", _L("Calibration")));
|
||||
// else
|
||||
// m_menubar->Remove(3);
|
||||
// #else
|
||||
// topbar()->ShowCalibrationButton(show);
|
||||
// #endif
|
||||
show = !show;
|
||||
auto shown2 = m_tabpanel->FindPage(m_calibration) != wxNOT_FOUND;
|
||||
if (shown2 == show)
|
||||
;
|
||||
else if (show)
|
||||
m_tabpanel->InsertPage(tpCalibration, m_calibration, _L("Calibration"), std::string("tab_monitor_active"), std::string("tab_monitor_active"), false);
|
||||
else
|
||||
m_tabpanel->RemovePage(tpCalibration);
|
||||
}
|
||||
|
||||
void MainFrame::update_title_colour_after_set_title()
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
@@ -1111,37 +1088,77 @@ void MainFrame::init_tabpanel() {
|
||||
|
||||
// SoftFever
|
||||
void MainFrame::show_device(bool bBBLPrinter) {
|
||||
if (m_tabpanel->GetPage(tpMonitor) != m_monitor &&
|
||||
m_tabpanel->GetPage(tpMonitor) != m_printer_view) {
|
||||
BOOST_LOG_TRIVIAL(error) << "Failed to find device tab";
|
||||
return;
|
||||
}
|
||||
if (bBBLPrinter) {
|
||||
if (m_tabpanel->GetPage(tpMonitor) != m_monitor) {
|
||||
m_printer_view->Hide();
|
||||
m_monitor->Show(true);
|
||||
m_tabpanel->RemovePage(tpMonitor);
|
||||
m_tabpanel->InsertPage(tpMonitor, m_monitor, _L("Device"),
|
||||
std::string("tab_monitor_active"),
|
||||
std::string("tab_monitor_active"));
|
||||
//m_tabpanel->SetSelection(tp3DEditor);
|
||||
}
|
||||
} else {
|
||||
if (m_tabpanel->GetPage(tpMonitor) != m_printer_view) {
|
||||
m_printer_view->Show();
|
||||
auto idx = -1;
|
||||
if (bBBLPrinter) {
|
||||
if (m_tabpanel->FindPage(m_monitor) != wxNOT_FOUND)
|
||||
return;
|
||||
// Remove printer view
|
||||
if ((idx = m_tabpanel->FindPage(m_printer_view)) != wxNOT_FOUND) {
|
||||
m_printer_view->Show(false);
|
||||
m_tabpanel->RemovePage(idx);
|
||||
}
|
||||
|
||||
// Create/insert monitor page
|
||||
if (!m_monitor) {
|
||||
m_monitor = new MonitorPanel(m_tabpanel, wxID_ANY, wxDefaultPosition, wxDefaultSize);
|
||||
m_monitor->SetBackgroundColour(*wxWHITE);
|
||||
}
|
||||
m_monitor->Show(false);
|
||||
m_tabpanel->InsertPage(tpMonitor, m_monitor, _L("Device"), std::string("tab_monitor_active"), std::string("tab_monitor_active"));
|
||||
|
||||
if (wxGetApp().is_enable_multi_machine()) {
|
||||
if (!m_multi_machine) {
|
||||
m_multi_machine = new MultiMachinePage(m_tabpanel, wxID_ANY, wxDefaultPosition, wxDefaultSize);
|
||||
m_multi_machine->SetBackgroundColour(*wxWHITE);
|
||||
}
|
||||
// TODO: change the bitmap
|
||||
m_multi_machine->Show(false);
|
||||
m_tabpanel->InsertPage(tpMultiDevice, m_multi_machine, _L("Multi-device"), std::string("tab_multi_active"),
|
||||
std::string("tab_multi_active"), false);
|
||||
}
|
||||
if (!m_calibration) {
|
||||
m_calibration = new CalibrationPanel(m_tabpanel, wxID_ANY, wxDefaultPosition, wxDefaultSize);
|
||||
m_calibration->SetBackgroundColour(*wxWHITE);
|
||||
}
|
||||
m_calibration->Show(false);
|
||||
m_tabpanel->InsertPage(tpCalibration, m_calibration, _L("Calibration"), std::string("tab_calibration_active"),
|
||||
std::string("tab_calibration_active"), false);
|
||||
|
||||
#ifdef _MSW_DARK_MODE
|
||||
wxGetApp().UpdateDarkUIWin(this);
|
||||
#endif // _MSW_DARK_MODE
|
||||
|
||||
} else {
|
||||
if (m_tabpanel->FindPage(m_printer_view) != wxNOT_FOUND)
|
||||
return;
|
||||
|
||||
if ((idx = m_tabpanel->FindPage(m_calibration)) != wxNOT_FOUND) {
|
||||
m_calibration->Show(false);
|
||||
m_tabpanel->RemovePage(idx);
|
||||
}
|
||||
if ((idx = m_tabpanel->FindPage(m_multi_machine)) != wxNOT_FOUND) {
|
||||
m_multi_machine->Show(false);
|
||||
m_tabpanel->RemovePage(idx);
|
||||
}
|
||||
if ((idx = m_tabpanel->FindPage(m_monitor)) != wxNOT_FOUND) {
|
||||
m_monitor->Show(false);
|
||||
m_tabpanel->RemovePage(tpMonitor);
|
||||
m_tabpanel->InsertPage(tpMonitor, m_printer_view, _L("Device"),
|
||||
std::string("tab_monitor_active"),
|
||||
std::string("tab_monitor_active"));
|
||||
//m_tabpanel->SetSelection(tp3DEditor);
|
||||
m_tabpanel->RemovePage(idx);
|
||||
}
|
||||
if (m_printer_view == nullptr) {
|
||||
m_printer_view = new PrinterWebView(m_tabpanel);
|
||||
Bind(EVT_LOAD_PRINTER_URL, [this](LoadPrinterViewEvent& evt) {
|
||||
wxString url = evt.GetString();
|
||||
wxString key = evt.GetAPIkey();
|
||||
// select_tab(MainFrame::tpMonitor);
|
||||
m_printer_view->load_url(url, key);
|
||||
});
|
||||
}
|
||||
m_printer_view->Show(false);
|
||||
m_tabpanel->InsertPage(tpMonitor, m_printer_view, _L("Device"), std::string("tab_monitor_active"),
|
||||
std::string("tab_monitor_active"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool MainFrame::preview_only_hint()
|
||||
{
|
||||
if (m_plater && (m_plater->only_gcode_mode() || (m_plater->using_exported_file()))) {
|
||||
@@ -2012,9 +2029,12 @@ void MainFrame::on_dpi_changed(const wxRect& suggested_rect)
|
||||
//if (m_layout != ESettingsLayout::Dlg) // Do not update tabs if the Settings are in the separated dialog
|
||||
m_param_panel->msw_rescale();
|
||||
m_project->msw_rescale();
|
||||
m_monitor->msw_rescale();
|
||||
m_multi_machine->msw_rescale();
|
||||
m_calibration->msw_rescale();
|
||||
if(m_monitor)
|
||||
m_monitor->msw_rescale();
|
||||
if(m_multi_machine)
|
||||
m_multi_machine->msw_rescale();
|
||||
if(m_calibration)
|
||||
m_calibration->msw_rescale();
|
||||
|
||||
// BBS
|
||||
#if 0
|
||||
@@ -2072,8 +2092,10 @@ void MainFrame::on_sys_color_changed()
|
||||
|
||||
// update Plater
|
||||
wxGetApp().plater()->sys_color_changed();
|
||||
m_monitor->on_sys_color_changed();
|
||||
m_calibration->on_sys_color_changed();
|
||||
if(m_monitor)
|
||||
m_monitor->on_sys_color_changed();
|
||||
if(m_calibration)
|
||||
m_calibration->on_sys_color_changed();
|
||||
// update Tabs
|
||||
for (auto tab : wxGetApp().tabs_list)
|
||||
tab->sys_color_changed();
|
||||
@@ -3321,12 +3343,16 @@ void MainFrame::select_tab(wxPanel* panel)
|
||||
//BBS
|
||||
void MainFrame::jump_to_monitor(std::string dev_id)
|
||||
{
|
||||
if(!m_monitor)
|
||||
return;
|
||||
m_tabpanel->SetSelection(tpMonitor);
|
||||
((MonitorPanel*)m_monitor)->select_machine(dev_id);
|
||||
}
|
||||
|
||||
void MainFrame::jump_to_multipage()
|
||||
{
|
||||
if(!m_multi_machine)
|
||||
return;
|
||||
m_tabpanel->SetSelection(tpMultiDevice);
|
||||
((MultiMachinePage*)m_multi_machine)->jump_to_send_page();
|
||||
}
|
||||
|
||||
@@ -259,7 +259,6 @@ public:
|
||||
void set_max_recent_count(int max);
|
||||
|
||||
void show_publish_button(bool show);
|
||||
void show_calibration_button(bool show);
|
||||
|
||||
void update_title_colour_after_set_title();
|
||||
void show_option(bool show);
|
||||
|
||||
@@ -1200,9 +1200,7 @@ void Sidebar::update_all_preset_comboboxes()
|
||||
bool is_bbl_vendor = preset_bundle.is_bbl_vendor();
|
||||
const bool use_bbl_network = preset_bundle.use_bbl_network();
|
||||
|
||||
// Orca:: show device tab based on vendor type
|
||||
auto p_mainframe = wxGetApp().mainframe;
|
||||
p_mainframe->show_device(use_bbl_network);
|
||||
auto cfg = preset_bundle.printers.get_edited_preset().config;
|
||||
|
||||
if (use_bbl_network) {
|
||||
@@ -1268,7 +1266,9 @@ void Sidebar::update_all_preset_comboboxes()
|
||||
if (p->combo_printer)
|
||||
p->combo_printer->update();
|
||||
|
||||
p_mainframe->m_tabpanel->SetSelection(p_mainframe->m_tabpanel->GetSelection());
|
||||
// Orca:: show device tab based on vendor type
|
||||
p_mainframe->show_device(use_bbl_network);
|
||||
p_mainframe->select_tab(MainFrame::tp3DEditor);
|
||||
}
|
||||
|
||||
void Sidebar::update_presets(Preset::Type preset_type)
|
||||
@@ -1337,9 +1337,6 @@ void Sidebar::update_presets(Preset::Type preset_type)
|
||||
}
|
||||
|
||||
Preset& printer_preset = wxGetApp().preset_bundle->printers.get_edited_preset();
|
||||
bool isBBL = preset_bundle.use_bbl_network();
|
||||
wxGetApp().mainframe->show_calibration_button(!isBBL);
|
||||
|
||||
if (auto printer_structure_opt = printer_preset.config.option<ConfigOptionEnum<PrinterStructure>>("printer_structure")) {
|
||||
wxGetApp().plater()->get_current_canvas3D()->get_arrange_settings().align_to_y_axis = (printer_structure_opt->value == PrinterStructure::psI3);
|
||||
}
|
||||
@@ -7084,7 +7081,7 @@ void Plater::priv::on_tab_selection_changing(wxBookCtrlEvent& e)
|
||||
if (new_sel == MainFrame::tpMonitor && wxGetApp().preset_bundle != nullptr) {
|
||||
auto cfg = wxGetApp().preset_bundle->printers.get_edited_preset().config;
|
||||
wxString url = cfg.opt_string("print_host_webui").empty() ? cfg.opt_string("print_host") : cfg.opt_string("print_host_webui");
|
||||
if (url.empty()) {
|
||||
if (main_frame->m_printer_view && url.empty()) {
|
||||
// It's missing_connection page, reload so that we can replay the gif image
|
||||
main_frame->m_printer_view->reload();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user