mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-13 19:01:21 +00:00
Merge branch 'main' into main
This commit is contained in:
@@ -136,6 +136,20 @@
|
||||
#include <wx/glcanvas.h>
|
||||
#endif // __WXGTK__
|
||||
#include <slic3r/GUI/CreatePresetsDialog.hpp>
|
||||
#include "libslic3r/AppConfig.hpp"
|
||||
#include "libslic3r/Model.hpp"
|
||||
#include "slic3r/GUI/DeviceManager.hpp"
|
||||
#include "slic3r/GUI/Gizmos/GLGizmosManager.hpp"
|
||||
#include "slic3r/GUI/IdleScheduler.hpp"
|
||||
#include "slic3r/GUI/ImGuiWrapper.hpp"
|
||||
#include "slic3r/GUI/Jobs/Worker.hpp"
|
||||
#include "slic3r/GUI/KeyChord.hpp"
|
||||
#include "slic3r/GUI/ParamsPanel.hpp"
|
||||
#include "slic3r/GUI/Tabbook.hpp"
|
||||
#include "slic3r/GUI/Widgets/SideButton.hpp"
|
||||
#include "slic3r/plugin/host/PluginPages.hpp"
|
||||
#include "slic3r/Utils/NetworkAgent.hpp"
|
||||
#include <wx/defs.h>
|
||||
|
||||
|
||||
namespace Slic3r {
|
||||
@@ -1249,6 +1263,10 @@ void MainFrame::shutdown()
|
||||
m_plugin_pages.shutdown();
|
||||
if (m_plater != nullptr)
|
||||
m_plater->remove_dock_panes();
|
||||
#ifdef SLIC3R_CAD
|
||||
if (DesignPanel* design = DesignPanel::if_built())
|
||||
design->shutdown();
|
||||
#endif
|
||||
#ifdef __WXGTK__
|
||||
// Edge panels are child windows — wxWidgets destroys them automatically.
|
||||
m_edge_bottom = nullptr;
|
||||
@@ -1372,6 +1390,23 @@ void MainFrame::show_option(bool show)
|
||||
}
|
||||
}
|
||||
|
||||
void MainFrame::set_undo_redo_enabled(bool undo, bool redo)
|
||||
{
|
||||
#ifndef __APPLE__
|
||||
m_topbar->EnableUndoRedo(undo, redo);
|
||||
#else
|
||||
(void) undo; (void) redo; // macOS has no top bar; Edit asks the tab when it opens
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef SLIC3R_CAD
|
||||
DesignPanel* MainFrame::shown_design_panel() const
|
||||
{
|
||||
DesignPanel* design = DesignPanel::if_built();
|
||||
return (design != nullptr && m_design_page != nullptr && m_design_page->IsShownOnScreen()) ? design : nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
void MainFrame::init_tabpanel() {
|
||||
// wxNB_NOPAGETHEME: Disable Windows Vista theme for the Notebook background. The theme performance is terrible on
|
||||
// Windows 10 with multiple high resolution displays connected.
|
||||
@@ -1437,6 +1472,11 @@ void MainFrame::init_tabpanel() {
|
||||
m_topbar->DisableUndoRedoItems();
|
||||
}
|
||||
#endif
|
||||
#ifdef SLIC3R_CAD
|
||||
// Design keeps its own history, and the top bar's Undo/Redo drive it while it is shown.
|
||||
if (m_design_page != nullptr && panel == m_design_page)
|
||||
DesignPanel::ensure()->update_undo_redo_buttons();
|
||||
#endif
|
||||
|
||||
if (panel)
|
||||
panel->SetFocus();
|
||||
@@ -1463,8 +1503,9 @@ void MainFrame::init_tabpanel() {
|
||||
#ifdef SLIC3R_CAD
|
||||
// The experimental feature is off by default, and when it is off the page is never
|
||||
// created, so the tab does not appear at all (the preference takes effect on the next
|
||||
// start, like the other feature toggles).
|
||||
if (wxGetApp().is_enable_cad_feature()) {
|
||||
// start, like the other feature toggles). Nor in the G-code viewer, which has no Design tab to put
|
||||
// it in — and no business opening a control socket onto one.
|
||||
if (wxGetApp().is_enable_cad_feature() && wxGetApp().is_editor()) {
|
||||
// Experimental and heavy enough that building it unasked would cost more than it saves.
|
||||
m_design_page = new LazyPage<DesignPanel>(this, TAB_ID_DESIGN, -1);
|
||||
m_lazy_pages.push_back(m_design_page);
|
||||
@@ -2655,6 +2696,9 @@ void MainFrame::on_dpi_changed(const wxRect& suggested_rect)
|
||||
MonitorPanel::when_built([](MonitorPanel& monitor) { monitor.msw_rescale(); });
|
||||
MultiMachinePage::when_built([](MultiMachinePage& multi_machine) { multi_machine.msw_rescale(); });
|
||||
CalibrationPanel::when_built([](CalibrationPanel& calibration) { calibration.msw_rescale(); });
|
||||
#ifdef SLIC3R_CAD
|
||||
DesignPanel::when_built([](DesignPanel& design) { design.msw_rescale(); });
|
||||
#endif
|
||||
|
||||
// BBS
|
||||
#if 0
|
||||
@@ -2719,6 +2763,9 @@ void MainFrame::on_sys_color_changed()
|
||||
wxGetApp().plater()->sys_color_changed();
|
||||
MonitorPanel::when_built([](MonitorPanel& monitor) { monitor.on_sys_color_changed(); });
|
||||
CalibrationPanel::when_built([](CalibrationPanel& calibration) { calibration.on_sys_color_changed(); });
|
||||
#ifdef SLIC3R_CAD
|
||||
DesignPanel::when_built([](DesignPanel& design) { design.on_sys_color_changed(); });
|
||||
#endif
|
||||
// update Tabs
|
||||
for (auto tab : wxGetApp().tabs_list)
|
||||
tab->sys_color_changed();
|
||||
@@ -3057,12 +3104,28 @@ void MainFrame::init_menubar_as_editor()
|
||||
#ifndef __APPLE__
|
||||
// BBS undo
|
||||
append_shortcut_item(editMenu, Shortcut::Undo, true, _L("Undo"),
|
||||
_L("Undo"), [this](wxCommandEvent&) { m_plater->undo(); },
|
||||
"menu_undo", nullptr, [this](){return m_plater->can_undo(); }, this);
|
||||
_L("Undo"), [this](wxCommandEvent&) {
|
||||
#ifdef SLIC3R_CAD
|
||||
if (DesignPanel* dp = shown_design_panel()) { dp->menu_undo_redo(false); return; }
|
||||
#endif
|
||||
m_plater->undo(); },
|
||||
"menu_undo", nullptr, [this](){
|
||||
#ifdef SLIC3R_CAD
|
||||
if (DesignPanel* dp = shown_design_panel()) return dp->menu_can_undo_redo(false);
|
||||
#endif
|
||||
return m_plater->can_undo(); }, this);
|
||||
// BBS redo
|
||||
append_shortcut_item(editMenu, Shortcut::Redo, true, _L("Redo"),
|
||||
_L("Redo"), [this](wxCommandEvent&) { m_plater->redo(); },
|
||||
"menu_redo", nullptr, [this](){return m_plater->can_redo(); }, this);
|
||||
_L("Redo"), [this](wxCommandEvent&) {
|
||||
#ifdef SLIC3R_CAD
|
||||
if (DesignPanel* dp = shown_design_panel()) { dp->menu_undo_redo(true); return; }
|
||||
#endif
|
||||
m_plater->redo(); },
|
||||
"menu_redo", nullptr, [this](){
|
||||
#ifdef SLIC3R_CAD
|
||||
if (DesignPanel* dp = shown_design_panel()) return dp->menu_can_undo_redo(true);
|
||||
#endif
|
||||
return m_plater->can_redo(); }, this);
|
||||
editMenu->AppendSeparator();
|
||||
// BBS Cut TODO
|
||||
append_shortcut_item(editMenu, Shortcut::Cut, true, _L("Cut"),
|
||||
@@ -3109,8 +3172,15 @@ void MainFrame::init_menubar_as_editor()
|
||||
if (handle_key_event(e)) {
|
||||
return;
|
||||
}
|
||||
#ifdef SLIC3R_CAD
|
||||
if (DesignPanel* dp = shown_design_panel()) { dp->menu_undo_redo(false); return; }
|
||||
#endif
|
||||
m_plater->undo(); },
|
||||
"", nullptr, [this](){return m_plater->can_undo(); }, this);
|
||||
"", nullptr, [this](){
|
||||
#ifdef SLIC3R_CAD
|
||||
if (DesignPanel* dp = shown_design_panel()) return dp->menu_can_undo_redo(false);
|
||||
#endif
|
||||
return m_plater->can_undo(); }, this);
|
||||
// BBS redo
|
||||
append_shortcut_item(editMenu, Shortcut::Redo, false, _L("Redo"),
|
||||
_L("Redo"), [this, handle_key_event](wxCommandEvent&) {
|
||||
@@ -3121,8 +3191,15 @@ void MainFrame::init_menubar_as_editor()
|
||||
if (handle_key_event(e)) {
|
||||
return;
|
||||
}
|
||||
#ifdef SLIC3R_CAD
|
||||
if (DesignPanel* dp = shown_design_panel()) { dp->menu_undo_redo(true); return; }
|
||||
#endif
|
||||
m_plater->redo(); },
|
||||
"", nullptr, [this](){return m_plater->can_redo(); }, this);
|
||||
"", nullptr, [this](){
|
||||
#ifdef SLIC3R_CAD
|
||||
if (DesignPanel* dp = shown_design_panel()) return dp->menu_can_undo_redo(true);
|
||||
#endif
|
||||
return m_plater->can_redo(); }, this);
|
||||
editMenu->AppendSeparator();
|
||||
// BBS Cut TODO
|
||||
append_shortcut_item(editMenu, Shortcut::Cut, false, _L("Cut"),
|
||||
@@ -3342,6 +3419,10 @@ void MainFrame::init_menubar_as_editor()
|
||||
viewMenu, wxID_ANY, _L("Reset Window Layout"), _L("Reset to default window layout"),
|
||||
[this](wxCommandEvent&) { m_plater->reset_window_layout(); }, "", this,
|
||||
[this]() {
|
||||
#ifdef SLIC3R_CAD
|
||||
if (shown_design_panel() != nullptr)
|
||||
return true;
|
||||
#endif
|
||||
return is_prepare_or_preview_tab() && m_plater->is_sidebar_enabled();
|
||||
},
|
||||
this);
|
||||
|
||||
Reference in New Issue
Block a user