From 971cc5833c368cbca28b9f3c7785f33687ab3fed Mon Sep 17 00:00:00 2001 From: QIDI TECH <893239786@qq.com> Date: Mon, 18 Nov 2024 15:12:16 +0800 Subject: [PATCH] fix bug of slic3r --- src/slic3r/Config/Version.cpp | 16 + src/slic3r/GUI/3DBed.cpp | 9 +- src/slic3r/GUI/3DBed.hpp | 7 +- src/slic3r/GUI/3DScene.cpp | 9 +- src/slic3r/GUI/AboutDialog.cpp | 29 +- src/slic3r/GUI/BedShapeDialog.cpp | 10 +- src/slic3r/GUI/BedShapeDialog.hpp | 2 +- src/slic3r/GUI/BitmapCache.cpp | 13 +- src/slic3r/GUI/BitmapComboBox.cpp | 2 +- src/slic3r/GUI/BonjourDialog.cpp | 65 ++-- src/slic3r/GUI/Camera.cpp | 1 - src/slic3r/GUI/ConfigManipulation.cpp | 12 +- src/slic3r/GUI/ConfigWizard.cpp | 48 ++- src/slic3r/GUI/ConfigWizardWebViewPage.cpp | 13 +- src/slic3r/GUI/ConfigWizardWebViewPage.hpp | 1 + src/slic3r/GUI/ConfigWizard_private.hpp | 5 + src/slic3r/GUI/CoordAxes.cpp | 2 +- src/slic3r/GUI/DoubleSliderForGcode.cpp | 1 - src/slic3r/GUI/DoubleSliderForGcode.hpp | 1 - src/slic3r/GUI/DoubleSliderForLayers.cpp | 6 - src/slic3r/GUI/DoubleSliderForLayers.hpp | 1 - src/slic3r/GUI/EditGCodeDialog.cpp | 4 +- src/slic3r/GUI/Field.cpp | 19 +- src/slic3r/GUI/FirmwareDialog.cpp | 2 +- .../GUI/FrequentlyChangedParameters.cpp | 2 - .../GUI/FrequentlyChangedParameters.hpp | 1 - src/slic3r/GUI/GCodeViewer.cpp | 279 ++++++++++------ src/slic3r/GUI/GCodeViewer.hpp | 11 +- src/slic3r/GUI/GLCanvas3D.cpp | 27 +- src/slic3r/GUI/GLTexture.cpp | 2 - src/slic3r/GUI/GLToolbar.cpp | 2 +- src/slic3r/GUI/GUI_App.cpp | 108 +++--- src/slic3r/GUI/GUI_App.hpp | 13 +- src/slic3r/GUI/GUI_Init.cpp | 1 + src/slic3r/GUI/GUI_ObjectList.cpp | 8 +- src/slic3r/GUI/GUI_Preview.cpp | 4 +- src/slic3r/GUI/Gizmos/GLGizmoCut.cpp | 4 +- src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp | 23 +- src/slic3r/GUI/Gizmos/GLGizmoEmboss.hpp | 6 +- src/slic3r/GUI/Gizmos/GLGizmosManager.cpp | 5 +- src/slic3r/GUI/Gizmos/GLGizmosManager.hpp | 4 +- src/slic3r/GUI/HintNotification.cpp | 17 +- src/slic3r/GUI/ImGuiDoubleSlider.hpp | 1 - src/slic3r/GUI/ImGuiPureWrap.cpp | 1 - src/slic3r/GUI/ImGuiPureWrap.hpp | 12 +- src/slic3r/GUI/ImGuiWrapper.cpp | 43 +-- src/slic3r/GUI/ImGuiWrapper.hpp | 14 +- src/slic3r/GUI/LibVGCode/LibVGCodeWrapper.hpp | 1 - src/slic3r/GUI/MainFrame.cpp | 181 +++++----- src/slic3r/GUI/MainFrame.hpp | 18 +- src/slic3r/GUI/MsgDialog.cpp | 16 +- src/slic3r/GUI/Notebook.cpp | 5 +- src/slic3r/GUI/NotificationManager.cpp | 6 +- src/slic3r/GUI/NotificationManager.hpp | 6 +- src/slic3r/GUI/OG_CustomCtrl.cpp | 1 - src/slic3r/GUI/OpenGLManager.cpp | 4 +- src/slic3r/GUI/OptionsGroup.cpp | 10 +- src/slic3r/GUI/OptionsGroup.hpp | 4 +- src/slic3r/GUI/PhysicalPrinterDialog.cpp | 175 +++++++++- src/slic3r/GUI/PhysicalPrinterDialog.hpp | 6 +- src/slic3r/GUI/Plater.cpp | 137 +++----- src/slic3r/GUI/Plater.hpp | 15 +- src/slic3r/GUI/Preferences.cpp | 1 - src/slic3r/GUI/Preferences.hpp | 1 - src/slic3r/GUI/PresetArchiveDatabase.cpp | 3 +- src/slic3r/GUI/PresetComboBoxes.cpp | 25 +- src/slic3r/GUI/PresetComboBoxes.hpp | 1 - src/slic3r/GUI/PrintHostDialogs.cpp | 42 +-- src/slic3r/GUI/PrintHostDialogs.hpp | 12 +- src/slic3r/GUI/RemovableDriveManager.cpp | 2 +- src/slic3r/GUI/RulerForDoubleSlider.cpp | 1 - src/slic3r/GUI/RulerForDoubleSlider.hpp | 1 - src/slic3r/GUI/Selection.cpp | 4 + src/slic3r/GUI/Sidebar.cpp | 8 +- src/slic3r/GUI/Sidebar.hpp | 1 - src/slic3r/GUI/SysInfoDialog.cpp | 2 +- src/slic3r/GUI/Tab.cpp | 18 +- src/slic3r/GUI/TickCodesManager.cpp | 1 - src/slic3r/GUI/TickCodesManager.hpp | 1 - src/slic3r/GUI/TopBar.cpp | 23 +- src/slic3r/GUI/TopBarMenus.cpp | 3 + src/slic3r/GUI/TopBarMenus.hpp | 2 + src/slic3r/GUI/UnsavedChangesDialog.cpp | 2 +- src/slic3r/GUI/UpdateDialogs.cpp | 12 +- src/slic3r/GUI/UpdateDialogs.hpp | 2 - src/slic3r/GUI/UpdatesUIManager.cpp | 1 - src/slic3r/GUI/UpdatesUIManager.hpp | 1 - src/slic3r/GUI/UserAccount.hpp | 4 +- src/slic3r/GUI/WebUserLoginDialog.cpp | 1 - src/slic3r/GUI/WebView.cpp | 5 +- src/slic3r/GUI/Widgets/SpinInput.cpp | 1 - src/slic3r/GUI/Widgets/SwitchButton.cpp | 24 +- src/slic3r/GUI/Widgets/SwitchButton.hpp | 2 - src/slic3r/GUI/wxExtensions.cpp | 10 - src/slic3r/GUI/wxExtensions.hpp | 5 - src/slic3r/Utils/HexFile.cpp | 2 +- src/slic3r/Utils/Http.cpp | 2 +- src/slic3r/Utils/MacDarkMode.hpp | 7 - src/slic3r/Utils/MacDarkMode.mm | 315 ------------------ src/slic3r/Utils/Moonraker.cpp | 18 +- src/slic3r/Utils/Moonraker.hpp | 3 +- src/slic3r/Utils/PresetUpdater.cpp | 5 - src/slic3r/Utils/PrintHost.cpp | 10 +- src/slic3r/Utils/Repetier.cpp | 4 +- src/slic3r/Utils/UndoRedo.cpp | 26 +- src/slic3r/Utils/WxFontUtils.cpp | 2 +- tests/fff_print/test_perimeters.cpp | 3 +- 107 files changed, 875 insertions(+), 1195 deletions(-) diff --git a/src/slic3r/Config/Version.cpp b/src/slic3r/Config/Version.cpp index 0b3d2cb..47ea15a 100644 --- a/src/slic3r/Config/Version.cpp +++ b/src/slic3r/Config/Version.cpp @@ -236,9 +236,11 @@ Index::const_iterator Index::recommended() const std::vector Index::load_db() { boost::filesystem::path cache_dir = boost::filesystem::path(Slic3r::data_dir()) / "cache"; + boost::filesystem::path vendor_dir = boost::filesystem::path(Slic3r::data_dir()) / "vendor"; std::vector index_db; std::string errors_cummulative; + for (auto &dir_entry : boost::filesystem::directory_iterator(cache_dir)) if (Slic3r::is_idx_file(dir_entry)) { Index idx; @@ -252,6 +254,20 @@ std::vector Index::load_db() index_db.emplace_back(std::move(idx)); } + for (auto &dir_entry : boost::filesystem::directory_iterator(vendor_dir)) + if (Slic3r::is_idx_file(dir_entry)) { + Index idx; + try { + idx.load(dir_entry.path()); + } catch (const std::runtime_error &err) { + errors_cummulative += err.what(); + errors_cummulative += "\n"; + continue; + } + if (std::find_if(index_db.begin(), index_db.end(), [idx](const Index& index) { return idx.vendor() == index.vendor();}) == index_db.end()) + index_db.emplace_back(std::move(idx)); + } + if (! errors_cummulative.empty()) throw Slic3r::RuntimeError(errors_cummulative); return index_db; diff --git a/src/slic3r/GUI/3DBed.cpp b/src/slic3r/GUI/3DBed.cpp index 55c9470..d961ef1 100644 --- a/src/slic3r/GUI/3DBed.cpp +++ b/src/slic3r/GUI/3DBed.cpp @@ -30,12 +30,7 @@ namespace Slic3r { namespace GUI { //B52 -bool Bed3D::set_shape(const Pointfs & bed_shape, - const double max_print_height, - const std::string &custom_texture, - const std::string &custom_model, - const Pointfs & exclude_bed_shape, - bool force_as_custom) +bool Bed3D::set_shape(const Pointfs& bed_shape, const double max_print_height, const std::string& custom_texture, const std::string& custom_model, const Pointfs & exclude_bed_shape, bool force_as_custom) { auto check_texture = [](const std::string& texture) { boost::system::error_code ec; // so the exists call does not throw (e.g. after a permission problem) @@ -79,7 +74,7 @@ bool Bed3D::set_shape(const Pointfs & bed_shape, m_type = type; //B52 - m_build_volume = BuildVolume{bed_shape, max_print_height, exclude_bed_shape}; + m_build_volume = BuildVolume { bed_shape, max_print_height, exclude_bed_shape}; m_texture_filename = texture_filename; m_model_filename = model_filename; m_extended_bounding_box = this->calc_extended_bounding_box(); diff --git a/src/slic3r/GUI/3DBed.hpp b/src/slic3r/GUI/3DBed.hpp index 92ae9d1..87b3c94 100644 --- a/src/slic3r/GUI/3DBed.hpp +++ b/src/slic3r/GUI/3DBed.hpp @@ -58,12 +58,7 @@ public: //FIXME if the build volume max print height is updated, this function still returns zero // as this class does not use it, thus there is no need to update the UI. //B52 - bool set_shape(const Pointfs & bed_shape, - const double max_print_height, - const std::string &custom_texture, - const std::string &custom_model, - const Pointfs & exclude_bed_shape, - bool force_as_custom = false); + bool set_shape(const Pointfs& bed_shape, const double max_print_height, const std::string& custom_texture, const std::string& custom_model, const Pointfs& exclude_bed_shape, bool force_as_custom = false); // Build volume geometry for various collision detection tasks. const BuildVolume& build_volume() const { return m_build_volume; } diff --git a/src/slic3r/GUI/3DScene.cpp b/src/slic3r/GUI/3DScene.cpp index f588105..12ecbdc 100644 --- a/src/slic3r/GUI/3DScene.cpp +++ b/src/slic3r/GUI/3DScene.cpp @@ -205,7 +205,6 @@ const ColorRGBA GLVolume::SELECTED_COLOR = ColorRGBA::GREEN(); const ColorRGBA GLVolume::HOVER_SELECT_COLOR = { 0.4f, 0.9f, 0.1f, 1.0f }; const ColorRGBA GLVolume::HOVER_DESELECT_COLOR = { 1.0f, 0.75f, 0.75f, 1.0f }; //B22 -//const ColorRGBA GLVolume::OUTSIDE_COLOR = { 0.0f, 0.38f, 0.8f, 1.0f }; const ColorRGBA GLVolume::OUTSIDE_COLOR = { 1.0f, 0.0f, 0.0f, 1.0f }; const ColorRGBA GLVolume::SELECTED_OUTSIDE_COLOR = { 0.19f, 0.58f, 1.0f, 1.0f }; const ColorRGBA GLVolume::DISABLED_COLOR = ColorRGBA::DARK_GRAY(); @@ -265,6 +264,14 @@ void GLVolume::set_render_color(bool force_transparent) } } else { + //B22 + /*if (hover == HS_Select) + set_render_color(HOVER_SELECT_COLOR); + else if (hover == HS_Deselect) + set_render_color(HOVER_DESELECT_COLOR); + else if (selected) + set_render_color(outside ? SELECTED_OUTSIDE_COLOR : SELECTED_COLOR); + else if (disabled)*/ if (disabled) set_render_color(DISABLED_COLOR); else if (outside && shader_outside_printer_detection_enabled) diff --git a/src/slic3r/GUI/AboutDialog.cpp b/src/slic3r/GUI/AboutDialog.cpp index 027df6c..b50f453 100644 --- a/src/slic3r/GUI/AboutDialog.cpp +++ b/src/slic3r/GUI/AboutDialog.cpp @@ -8,7 +8,7 @@ #include "MainFrame.hpp" #include "format.hpp" -#include +#include // IWYU pragma: keep namespace Slic3r { namespace GUI { @@ -223,16 +223,16 @@ AboutDialog::AboutDialog() auto main_sizer = new wxBoxSizer(wxVERTICAL); main_sizer->Add(hsizer, 0, wxEXPAND | wxALL, 20); - // logo + //y15 m_logo = new wxStaticBitmap(this, wxID_ANY, *get_bmp_bundle("QIDI_Back", 99)); //hsizer->Add(m_logo, 1, wxALIGN_CENTER_VERTICAL); - //Rectangle - + wxBoxSizer* vsizer = new wxBoxSizer(wxVERTICAL); vsizer->Add(m_logo, 1, wxTOP | wxLEFT | wxRIGHT | wxEXPAND, -50); hsizer->AddSpacer(15); hsizer->Add(vsizer, 2, wxEXPAND|wxLEFT, 0); - + + //y15 // title /*{ wxStaticText* title = new wxStaticText(this, wxID_ANY, wxGetApp().is_editor() ? SLIC3R_APP_NAME : GCODEVIEWER_APP_NAME, wxDefaultPosition, wxDefaultSize); @@ -273,7 +273,7 @@ AboutDialog::AboutDialog() m_html->SetBorders(2); const wxString copyright_str = _L("Copyright"); // TRN AboutDialog: "Slic3r %1% GNU Affero General Public License" - const wxString a_url_str = _L("Amazon : https://www.amazon.com/stores/page/220AF7CA-5334-4ECA-8E62-B6C8A068E7AC"); + //Y const wxString s_url_str = _L("Shopify : https://qidi3d.com/"); const wxString is_lecensed_str = _L("is licensed under the"); const wxString license_str = _L("GNU Affero General Public License, version 3"); @@ -286,19 +286,18 @@ AboutDialog::AboutDialog() "" "%4%" "

" - "%5%
" - "%6%" + "%5%" "

" - "%7%
" - "%12% © 2023-2024 QIDI Technology.
" - "%8% © 2016-2024 Prusa Research.
" - "%9% © 2011-2018 Alessandro Ranellucci.
" - "Slic3r %10% " - "%11%." + "%6%
" + "%11% © 2023-2024 QIDI Technology.
" + "%7% © 2016-2024 Prusa Research.
" + "%8% © 2011-2018 Alessandro Ranellucci.
" + "Slic3r %9% " + "%10%." "
" "" "", bgr_clr_str, text_clr_str, text_clr_str - , contributors_str, a_url_str, s_url_str ,version_str + , contributors_str, s_url_str ,version_str , copyright_str, copyright_str , is_lecensed_str, license_str, copyright_str); m_html->SetPage(text); diff --git a/src/slic3r/GUI/BedShapeDialog.cpp b/src/slic3r/GUI/BedShapeDialog.cpp index f5431d0..600867d 100644 --- a/src/slic3r/GUI/BedShapeDialog.cpp +++ b/src/slic3r/GUI/BedShapeDialog.cpp @@ -21,9 +21,9 @@ namespace Slic3r { namespace GUI { //B52 -BedShape::BedShape(const ConfigOptionPoints &points1, const ConfigOptionPoints &points2) +BedShape::BedShape(const ConfigOptionPoints& points1, const ConfigOptionPoints& points2) { - m_build_volume = {points1.values, 0., points2.values}; + m_build_volume = { points1.values, 0., points2.values}; } static std::string get_option_label(BedShape::Parameter param) @@ -299,8 +299,6 @@ void BedShapePanel::build_panel(const ConfigOptionPoints& default_pt, const Conf left_sizer->Add(exclude_panel, 0, wxEXPAND); left_sizer->Add(texture_panel, 0, wxEXPAND); left_sizer->Add(model_panel, 0, wxEXPAND); - left_sizer->Add(texture_panel, 1, wxEXPAND); - left_sizer->Add(model_panel, 1, wxEXPAND); wxSizer* top_sizer = new wxBoxSizer(wxHORIZONTAL); top_sizer->Add(left_sizer, 0, wxEXPAND | wxLEFT | wxTOP | wxBOTTOM, 10); @@ -348,7 +346,7 @@ wxSizer* BedShapePanel::init_exclude_sizer() wxGetApp().UpdateDarkUI(panel_0, true); exclude_optgroup_0 = std::make_shared(panel_0, _L("Exclude area 1")); exclude_optgroup_0->label_width = 10; - exclude_optgroup_0->m_on_change = [this](t_config_option_key opt_key, boost::any value) { + exclude_optgroup_0->on_change = [this](t_config_option_key opt_key, boost::any value) { update_shape(); }; BedShape::append_option_line(exclude_optgroup_0, BedShape::Parameter::ExcludeMax); @@ -360,7 +358,7 @@ wxSizer* BedShapePanel::init_exclude_sizer() wxGetApp().UpdateDarkUI(panel_1, true); exclude_optgroup_1 = std::make_shared(panel_1, _L("Exclude area 2")); exclude_optgroup_1->label_width = 10; - exclude_optgroup_1->m_on_change = [this](t_config_option_key opt_key, boost::any value) { + exclude_optgroup_1->on_change = [this](t_config_option_key opt_key, boost::any value) { update_shape(); }; BedShape::append_option_line(exclude_optgroup_1, BedShape::Parameter::ExcludeMax); diff --git a/src/slic3r/GUI/BedShapeDialog.hpp b/src/slic3r/GUI/BedShapeDialog.hpp index 10cd381..61395dd 100644 --- a/src/slic3r/GUI/BedShapeDialog.hpp +++ b/src/slic3r/GUI/BedShapeDialog.hpp @@ -91,7 +91,7 @@ private: wxPanel* init_texture_panel(); wxPanel* init_model_panel(); //B52 - void set_shape(const ConfigOptionPoints &points1, const ConfigOptionPoints &points2); + void set_shape(const ConfigOptionPoints &points1, const ConfigOptionPoints &points2); //Y20 //B52 void set_exclude_area(const ConfigOptionPoints &points1, const ConfigOptionPoints &points2); void update_preview(); diff --git a/src/slic3r/GUI/BitmapCache.cpp b/src/slic3r/GUI/BitmapCache.cpp index 799716e..ef190c0 100644 --- a/src/slic3r/GUI/BitmapCache.cpp +++ b/src/slic3r/GUI/BitmapCache.cpp @@ -473,18 +473,14 @@ wxBitmapBundle *BitmapCache::from_png_of_login(const std::string &bitmap_name, u int cx = image.GetWidth() / 2; int cy = image.GetHeight() / 2; - for (int y = 0; y < height; ++y) - { - for (int x = 0; x < height; ++x) - { + for (int y = 0; y < height; ++y) { + for (int x = 0; x < height; ++x) { int dx = x - radius; int dy = y - radius; - if (dx * dx + dy * dy <= radius * radius) - { + if (dx * dx + dy * dy <= radius * radius) { image.SetRGB(x, y, image.GetRed(cx + dx, cy + dy), image.GetGreen(cx + dx, cy + dy), image.GetBlue(cx + dx, cy + dy)); image.SetAlpha(x, y, 255); - } else - { + } else { image.SetRGB(x, y, 38, 38, 41); image.SetAlpha(x, y, 0); } @@ -493,7 +489,6 @@ wxBitmapBundle *BitmapCache::from_png_of_login(const std::string &bitmap_name, u return this->insert_bndl(bitmap_key, wxImage_to_wxBitmap_with_alpha(std::move(image))); } - wxBitmap* BitmapCache::load_svg(const std::string &bitmap_name, unsigned target_width, unsigned target_height, const bool grayscale/* = false*/, const bool dark_mode/* = false*/, const std::string& new_color /*= ""*/) { diff --git a/src/slic3r/GUI/BitmapComboBox.cpp b/src/slic3r/GUI/BitmapComboBox.cpp index f1bb67e..dd3074e 100644 --- a/src/slic3r/GUI/BitmapComboBox.cpp +++ b/src/slic3r/GUI/BitmapComboBox.cpp @@ -36,7 +36,7 @@ #include "format.hpp" // A workaround for a set of issues related to text fitting into gtk widgets: -// See e.g.: https://github.com/qidi3d/QIDISlicer/issues/4584 +// See e.g.: https://github.com/QIDITECH/QIDISlicer/issues/4584 #if defined(__WXGTK20__) || defined(__WXGTK3__) #include #include diff --git a/src/slic3r/GUI/BonjourDialog.cpp b/src/slic3r/GUI/BonjourDialog.cpp index 081e4c4..e152b8c 100644 --- a/src/slic3r/GUI/BonjourDialog.cpp +++ b/src/slic3r/GUI/BonjourDialog.cpp @@ -21,7 +21,6 @@ #include "slic3r/Utils/Bonjour.hpp" #include "slic3r/Utils/Udp.hpp" - namespace Slic3r { @@ -46,7 +45,8 @@ class UdpReplyEvent : public wxEvent public: UdpReply reply; - UdpReplyEvent(wxEventType eventType, int winid, UdpReply &&reply) : wxEvent(winid, eventType), reply(std::move(reply)) {} + UdpReplyEvent(wxEventType eventType, int winid, UdpReply &&reply) + : wxEvent(winid, eventType), reply(std::move(reply)) {} virtual wxEvent *Clone() const { return new UdpReplyEvent(*this); } }; @@ -62,7 +62,7 @@ wxDECLARE_EVENT(EVT_BONJOUR_COMPLETE, wxCommandEvent); wxDEFINE_EVENT(EVT_BONJOUR_COMPLETE, wxCommandEvent); class ReplySet: public std::set {}; -class UdpReplySet : public std::set {}; +class UdpReplySet: public std::set {}; struct LifetimeGuard { @@ -75,8 +75,8 @@ struct LifetimeGuard BonjourDialog::BonjourDialog(wxWindow *parent, Slic3r::PrinterTechnology tech) : wxDialog(parent, wxID_ANY, _(L("Network lookup")), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER) , list(new wxListView(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxSIMPLE_BORDER)) - , replies(new ReplySet) - , udp_replies(new UdpReplySet) + , replies(new ReplySet) + , udp_replies(new UdpReplySet) , label(new wxStaticText(this, wxID_ANY, "")) , timer(new wxTimer()) , timer_state(0) @@ -111,12 +111,12 @@ BonjourDialog::BonjourDialog(wxWindow *parent, Slic3r::PrinterTechnology tech) Bind(EVT_BONJOUR_REPLY, &BonjourDialog::on_reply, this); - Bind(EVT_UDP_REPLY, &BonjourDialog::on_udp_reply, this); + Bind(EVT_UDP_REPLY, &BonjourDialog::on_udp_reply, this); // B29 - Bind(EVT_BONJOUR_COMPLETE, [this](wxCommandEvent &) { - this->timer_state = 0; - }); + Bind(EVT_BONJOUR_COMPLETE, [this](wxCommandEvent &) { + this->timer_state = 0; + }); Bind(wxEVT_TIMER, &BonjourDialog::on_timer, this); GUI::wxGetApp().UpdateDlgDarkUI(this); @@ -143,31 +143,30 @@ bool BonjourDialog::show_and_lookup() // so that both threads can access it safely. auto dguard = std::make_shared(this); - // B29 - Udp::TxtKeys udp_txt_keys{"version", "model"}; + // B29 + Udp::TxtKeys udp_txt_keys{"version", "model"}; udp = Udp("octoprint") .set_txt_keys(std::move(udp_txt_keys)) - .set_retries(3) - .set_timeout(4) - .on_udp_reply([dguard](UdpReply &&reply) { - std::lock_guard lock_guard(dguard->mutex); - auto dialog = dguard->dialog; - if (dialog != nullptr) { - auto evt = new UdpReplyEvent(EVT_UDP_REPLY, dialog->GetId(), std::move(reply)); - wxQueueEvent(dialog, evt); - } - }) - .on_complete([dguard]() { - std::lock_guard lock_guard(dguard->mutex); - auto dialog = dguard->dialog; - if (dialog != nullptr) { - auto evt = new wxCommandEvent(EVT_UDP_COMPLETE, dialog->GetId()); - wxQueueEvent(dialog, evt); - } - }) - .lookup(); - + .set_retries(3) + .set_timeout(4) + .on_udp_reply([dguard](UdpReply &&reply) { + std::lock_guard lock_guard(dguard->mutex); + auto dialog = dguard->dialog; + if (dialog != nullptr) { + auto evt = new UdpReplyEvent(EVT_UDP_REPLY, dialog->GetId(), std::move(reply)); + wxQueueEvent(dialog, evt); + } + }) + .on_complete([dguard]() { + std::lock_guard lock_guard(dguard->mutex); + auto dialog = dguard->dialog; + if (dialog != nullptr) { + auto evt = new wxCommandEvent(EVT_UDP_COMPLETE, dialog->GetId()); + wxQueueEvent(dialog, evt); + } + }) + .lookup(); // Note: More can be done here when we support discovery of hosts other than Octoprint and SL1 Bonjour::TxtKeys txt_keys { "version", "model" }; @@ -265,8 +264,7 @@ void BonjourDialog::on_reply(BonjourReplyEvent &e) } // B29 -void BonjourDialog::on_udp_reply(UdpReplyEvent &e) -{ +void BonjourDialog::on_udp_reply(UdpReplyEvent &e) { if (udp_replies->find(e.reply) != udp_replies->end()) { // We already have this reply return; @@ -313,7 +311,6 @@ void BonjourDialog::on_udp_reply(UdpReplyEvent &e) } } - void BonjourDialog::on_timer(wxTimerEvent &) { on_timer_process(); diff --git a/src/slic3r/GUI/Camera.cpp b/src/slic3r/GUI/Camera.cpp index 8b61930..72a3be6 100644 --- a/src/slic3r/GUI/Camera.cpp +++ b/src/slic3r/GUI/Camera.cpp @@ -564,7 +564,6 @@ void Camera::set_default_orientation() const double theta_rad = Geometry::deg2rad(-(double)m_zenit); //B3 const double phi_rad = Geometry::deg2rad(0.0); - // const double phi_rad = Geometry::deg2rad(45.0); const double sin_theta = ::sin(theta_rad); const Vec3d camera_pos = m_target + m_distance * Vec3d(sin_theta * ::sin(phi_rad), sin_theta * ::cos(phi_rad), ::cos(theta_rad)); m_view_rotation = Eigen::AngleAxisd(theta_rad, Vec3d::UnitX()) * Eigen::AngleAxisd(phi_rad, Vec3d::UnitZ()); diff --git a/src/slic3r/GUI/ConfigManipulation.cpp b/src/slic3r/GUI/ConfigManipulation.cpp index e776a4a..1912966 100644 --- a/src/slic3r/GUI/ConfigManipulation.cpp +++ b/src/slic3r/GUI/ConfigManipulation.cpp @@ -349,8 +349,8 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig* config) bool has_ironing = config->opt_bool("ironing"); //w33 - for (auto el : {"ironing_type", "ironing_flowrate", "ironing_spacing", "ironing_speed", "ironing_pattern"}) - toggle_field(el, has_ironing); + for (auto el : { "ironing_type", "ironing_flowrate", "ironing_spacing", "ironing_speed", "ironing_pattern"}) + toggle_field(el, has_ironing); bool have_sequential_printing = config->opt_bool("complete_objects"); for (auto el : { "extruder_clearance_radius", "extruder_clearance_height" }) @@ -381,14 +381,6 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig* config) toggle_field("min_feature_size", have_arachne); toggle_field("min_bead_width", have_arachne); toggle_field("thin_walls", !have_arachne); - - //w38 - bool has_detect_overhang_wall = config->opt_bool("overhangs"); - bool has_overhang_reverse = config->opt_bool("overhang_reverse"); - bool allow_overhang_reverse = has_detect_overhang_wall && !has_spiral_vase; - toggle_field("overhang_reverse", allow_overhang_reverse); - toggle_field("overhang_reverse_internal_only", allow_overhang_reverse && has_overhang_reverse); - toggle_field("overhang_reverse_threshold", allow_overhang_reverse && has_overhang_reverse); } void ConfigManipulation::toggle_print_sla_options(DynamicPrintConfig* config) diff --git a/src/slic3r/GUI/ConfigWizard.cpp b/src/slic3r/GUI/ConfigWizard.cpp index eb31c69..778b794 100644 --- a/src/slic3r/GUI/ConfigWizard.cpp +++ b/src/slic3r/GUI/ConfigWizard.cpp @@ -59,13 +59,21 @@ #include "UnsavedChangesDialog.hpp" #include "UpdatesUIManager.hpp" #include "PresetArchiveDatabase.hpp" -#include "Plater.hpp" +#include "Plater.hpp" // #ysFIXME - implement getter for preset_archive_database from GetApp()??? #include "slic3r/Utils/AppUpdater.hpp" #include "slic3r/GUI/I18N.hpp" #include "slic3r/Config/Version.hpp" #include "WebUserLoginDialog.hpp" +/* ysFIXME - delete after testing and release +// it looks like this workaround is no need any more after update of the wxWidgets to 3.2.0 +#if defined(__linux__) && defined(__WXGTK3__) +#define wxLinux_gtk3 true +#else +#define wxLinux_gtk3 false +#endif //defined(__linux__) && defined(__WXGTK3__) +*/ namespace Slic3r { namespace GUI { @@ -75,6 +83,7 @@ using Config::Snapshot; using Config::SnapshotDB; + ConfigWizardLoadingDialog::ConfigWizardLoadingDialog(wxWindow* parent, const wxString& message) : wxDialog(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxFRAME_FLOAT_ON_PARENT) { @@ -561,6 +570,7 @@ ConfigWizardPage::ConfigWizardPage(ConfigWizard *parent, wxString title, wxStrin // Update!!! -> it looks like this workaround is no need any more after update of the wxWidgets to 3.2.0 // There is strange layout on Linux with GTK3, + // see https://github.com/prusa3d/PrusaSlicer/issues/5103 and https://github.com/prusa3d/PrusaSlicer/issues/4861 // So, non-active pages will be hidden later, on wxEVT_SHOW, after completed Layout() for all pages if (!wxLinux_gtk3) */ @@ -903,6 +913,7 @@ PageMaterials::PageMaterials(ConfigWizard *parent, Materials *materials, wxStrin html_window = new wxHtmlWindow(this, wxID_ANY, wxDefaultPosition, wxSize(60 * em, 20 * em), wxHW_SCROLLBAR_AUTO); + //y15 // html_window->Bind(wxEVT_HTML_LINK_CLICKED, [](wxHtmlLinkEvent& event) { // wxGetApp().open_browser_with_warning_dialog(event.GetLinkInfo().GetHref()); // event.Skip(false); @@ -1138,7 +1149,7 @@ void PageMaterials::update_lists(int sel_type, int sel_vendor, int last_selected bool templates_available = list_printer->size() > 1 && list_printer->get_data(1) == TEMPLATES; // Does our wxWidgets version support operator== for wxArrayInt ? - // https://github.com/qidi3d/QIDISlicer/issues/5152#issuecomment-787208614 + // https://github.com/QIDITECH/QIDISlicer/issues/5152#issuecomment-787208614 #if wxCHECK_VERSION(3, 1, 1) if (sel_printers != sel_printers_prev) { #else @@ -2589,7 +2600,7 @@ void ConfigWizard::priv::load_pages() index->add_page(page_welcome); index->add_page(page_login); - +//y15 // index->add_page(page_update_manager); // // if (is_config_from_archive) { @@ -2667,6 +2678,7 @@ void ConfigWizard::priv::load_pages() // index->go_to(former_active); // Will restore the active item/page if possible // } +//y15 // Printers if (!only_sla_mode) index->add_page(page_fff); @@ -2866,6 +2878,7 @@ void ConfigWizard::priv::set_start_page(ConfigWizard::StartPage start_page) } } +//y15 void ConfigWizard::priv::create_3rdparty_pages() { for (const auto &pair : bundles) { @@ -2960,6 +2973,7 @@ void ConfigWizard::priv::create_vendor_printers_page(const std::string& repo_id, { // multiple vendor repository auto repo = get_repo(repo_id); + //y15 //assert(repo); //repo->printers_pages.insert({vendor->id, {pageFFF, pageSLA}}); } @@ -3170,6 +3184,7 @@ void ConfigWizard::priv::on_3rdparty_install(const VendorProfile *vendor, bool i bool ConfigWizard::priv::can_finish() { + //y15 // if (index->active_page() == page_update_manager) // return false; // Set enabling fo "Finish" button -> there should to be selected at least one printer @@ -3178,6 +3193,7 @@ bool ConfigWizard::priv::can_finish() bool ConfigWizard::priv::can_go_next() { + //y15 // if (index->active_page() == page_update_manager) // return page_update_manager->manager->has_selections(); return true; @@ -3186,7 +3202,7 @@ bool ConfigWizard::priv::can_go_next() bool ConfigWizard::priv::can_show_next() { const bool is_last = index->active_is_last(); - + //y15 // if (index->active_page() == page_update_manager && is_last) // return true; @@ -3195,6 +3211,7 @@ bool ConfigWizard::priv::can_show_next() bool ConfigWizard::priv::can_select_all() { + //y15 // if (index->active_page() == page_update_manager) // return false; // set enabling for "Select all..." -> there should to be exist at least one printer page @@ -3682,7 +3699,7 @@ bool ConfigWizard::priv::apply_config(AppConfig *app_config, PresetBundle *prese app_config->set("associate_stl", page_files_association->associate_stl() ? "1" : "0"); //Y app_config->set("associate_step", page_files_association->associate_step() ? "1" : "0"); - // app_config->set("associate_gcode", page_files_association->associate_gcode() ? "1" : "0"); +// app_config->set("associate_gcode", page_files_association->associate_gcode() ? "1" : "0"); if (wxGetApp().is_editor()) { if (page_files_association->associate_3mf()) @@ -3749,6 +3766,7 @@ void ConfigWizard::priv::update_presets_in_config(const std::string& section, co bool ConfigWizard::priv::check_fff_selected() { + //y15 // for (const auto page : pages_fff) // if (page->any_selected()) // return true; @@ -3867,10 +3885,9 @@ static void unselect(PagePrinters* page) bool ConfigWizard::priv::can_clear_printer_pages() { + //y15 // const auto& selected_uuids = page_update_manager->manager->get_selected_uuids(); - wxString msg; - //for (Repository& repo : repositories) { // for (auto& [name, printers] : repo.printers_pages) { // if (PagePrinters* page = printers.first; @@ -3883,6 +3900,7 @@ bool ConfigWizard::priv::can_clear_printer_pages() // } //} + wxString msg; if (msg.IsEmpty()) return true; @@ -4094,10 +4112,12 @@ ConfigWizard::ConfigWizard(wxWindow *parent) p->add_page(p->page_welcome = new PageWelcome(this)); p->add_page(p->page_login = new ConfigWizardWebViewPage(this)); + //y15 // p->add_page(p->page_update_manager = new PageUpdateManager(this)); // other pages will be loaded later after confirm repositories selection + //y15 const auto qidi_it = p->bundles.find("QIDITechnology"); wxCHECK_RET(qidi_it != p->bundles.cend(), "Vendor QIDITechnology not found"); const VendorProfile* vendor_qidi = qidi_it->second.vendor_profile; @@ -4109,7 +4129,6 @@ ConfigWizard::ConfigWizard(wxWindow *parent) p->page_fff->is_primary_printer_page = true; } - p->page_msla = new PagePrinters(this, _L("QIDI MSLA Technology Printers"), "QIDI MSLA", *vendor_qidi, 0, T_SLA); p->add_page(p->page_msla); if (p->only_sla_mode) { @@ -4149,6 +4168,7 @@ ConfigWizard::ConfigWizard(wxWindow *parent) p->add_page(p->page_diams = new PageDiameters(this)); p->add_page(p->page_temps = new PageTemperatures(this)); + //y15 p->load_pages(); p->index->go_to(size_t{ 0 }); @@ -4173,13 +4193,6 @@ ConfigWizard::ConfigWizard(wxWindow *parent) evt.Enable(p->can_go_next()); }); - //p->page_login->Bind(wxEVT_WEBVIEW_NAVIGATED, [this](wxWebViewEvent& evt) - // { - // wxString url = evt.GetURL(); - // if (url.ends_with(_L("userCenter"))) - // this->p->index->go_next(); - // }); - p->btn_next->Bind(wxEVT_BUTTON, [this](const wxCommandEvent &) { // check, that there is selected at least one filament/material @@ -4190,6 +4203,7 @@ ConfigWizard::ConfigWizard(wxWindow *parent) ! p->check_and_install_missing_materials(dynamic_cast(active_page)->materials->technology)) // In that case don't leave the page and the function above queried the user whether to install default materials. return; + //y15 // if (active_page == p->page_update_manager && p->index->active_is_last()) { // size_t next_active = p->index->pages_cnt(); // p->page_update_manager->Hide(); @@ -4226,7 +4240,7 @@ ConfigWizard::ConfigWizard(wxWindow *parent) p->index->go_to(p->page_mode); }); - + //y15 // p->btn_sel_all->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) // { // evt.Enable(p->can_select_all()); @@ -4270,6 +4284,7 @@ bool ConfigWizard::run(RunReason reason, StartPage start_page) p->set_run_reason(reason); p->set_start_page(start_page); p->is_config_from_archive = reason == RR_USER; + //y15 // p->set_config_updated_from_archive(p->is_config_from_archive, false); if (ShowModal() == wxID_OK) { @@ -4297,6 +4312,7 @@ void ConfigWizard::update_login() // repos changed - we need rebuild wxGetApp().plater()->get_preset_archive_database()->sync_blocking(); // now change PageUpdateManager + //y15 // p->page_update_manager->manager->update(); } } diff --git a/src/slic3r/GUI/ConfigWizardWebViewPage.cpp b/src/slic3r/GUI/ConfigWizardWebViewPage.cpp index 68522d1..b720200 100644 --- a/src/slic3r/GUI/ConfigWizardWebViewPage.cpp +++ b/src/slic3r/GUI/ConfigWizardWebViewPage.cpp @@ -11,6 +11,7 @@ #include +//y15 #include using namespace std; using namespace nlohmann; @@ -32,6 +33,7 @@ ConfigWizardWebViewPage::ConfigWizardWebViewPage(ConfigWizard *parent) // Create the webview m_browser_sizer = new wxBoxSizer(wxHORIZONTAL); +//y15 wxString TargetUrl = ""; #if QDT_RELEASE_TO_PUBLIC @@ -39,12 +41,7 @@ ConfigWizardWebViewPage::ConfigWizardWebViewPage(ConfigWizard *parent) QIDINetwork m_qidinetwork; TargetUrl = m_qidinetwork.get_qidi_host(); #endif - - BOOST_LOG_TRIVIAL(error) << "login url = " << TargetUrl.ToStdString(); -// -// TargetUrl = "https://login_aliyun.qidi3dprinter.com/#/account/login"; -// m_browser = WebView::CreateWebView(this, TargetUrl, {}); - // wxString test_url = "https://www.baidu.com"; + m_browser = WebView::CreateWebView(this, TargetUrl, {"wx"}); if (!m_browser) { // TRN Config wizard page with a log in page. @@ -65,7 +62,8 @@ ConfigWizardWebViewPage::ConfigWizardWebViewPage(ConfigWizard *parent) append(m_browser_sizer, 1, wxEXPAND); m_browser_sizer->Show(true); - + + //y15 this->Layout(); // Connect the webview events // Bind(wxEVT_WEBVIEW_ERROR, &ConfigWizardWebViewPage::on_error, this, m_browser->GetId()); @@ -166,6 +164,7 @@ void ConfigWizardWebViewPage::on_navigation_request(wxWebViewEvent &evt) } } +//y15 void ConfigWizardWebViewPage::is_login(wxWebViewEvent& evt) { wxString str_input = evt.GetString(); diff --git a/src/slic3r/GUI/ConfigWizardWebViewPage.hpp b/src/slic3r/GUI/ConfigWizardWebViewPage.hpp index 275b2c7..119c605 100644 --- a/src/slic3r/GUI/ConfigWizardWebViewPage.hpp +++ b/src/slic3r/GUI/ConfigWizardWebViewPage.hpp @@ -56,6 +56,7 @@ public: void load_error_page(); // returns true if logged in - wizard needs to update repos bool login_changed(); + //y15 void is_login(wxWebViewEvent& evt); private: diff --git a/src/slic3r/GUI/ConfigWizard_private.hpp b/src/slic3r/GUI/ConfigWizard_private.hpp index f0a7a45..23a21f6 100644 --- a/src/slic3r/GUI/ConfigWizard_private.hpp +++ b/src/slic3r/GUI/ConfigWizard_private.hpp @@ -456,6 +456,7 @@ struct PageFilesAssociation : ConfigWizardPage private: wxCheckBox* cb_3mf{ nullptr }; wxCheckBox* cb_stl{ nullptr }; + //Y wxCheckBox* cb_step{ nullptr }; // wxCheckBox* cb_gcode; @@ -464,6 +465,7 @@ public: bool associate_3mf() const { return cb_3mf->IsChecked(); } bool associate_stl() const { return cb_stl->IsChecked(); } + //Y bool associate_step() const { return cb_step->IsChecked(); } // bool associate_gcode() const { return cb_gcode->IsChecked(); } }; @@ -630,6 +632,7 @@ struct ConfigWizard::priv wxButton *btn_cancel = nullptr; PageWelcome *page_welcome = nullptr; + //y15 PagePrinters *page_fff = nullptr; PagePrinters *page_msla = nullptr; ConfigWizardWebViewPage *page_login = nullptr; @@ -644,6 +647,7 @@ struct ConfigWizard::priv PageFilesAssociation* page_files_association = nullptr; #endif // _WIN32 PageMode *page_mode = nullptr; + //y15 PageVendors* page_vendors = nullptr; Pages3rdparty pages_3rdparty; @@ -687,6 +691,7 @@ struct ConfigWizard::priv void add_page(ConfigWizardPage *page); void enable_next(bool enable); void set_start_page(ConfigWizard::StartPage start_page); + //y15 void create_3rdparty_pages(); void create_vendor_printers_page(const std::string& repo_id, const VendorProfile* vendor, bool install = false, bool from_single_vendor_repo = false); void set_run_reason(RunReason run_reason); diff --git a/src/slic3r/GUI/CoordAxes.cpp b/src/slic3r/GUI/CoordAxes.cpp index 4d36200..a605276 100644 --- a/src/slic3r/GUI/CoordAxes.cpp +++ b/src/slic3r/GUI/CoordAxes.cpp @@ -43,7 +43,7 @@ void CoordAxes::render(const Transform3d& trafo, float emission_factor) shader->set_uniform("emission_factor", emission_factor); // Scale the axes if the camera is close to them to avoid issues - // such as https://github.com/qidi3d/QIDISlicer/issues/9483 + // such as https://github.com/QIDITECH/QIDISlicer/issues/9483 const Camera& camera = wxGetApp().plater()->get_camera(); Transform3d scale_tr = Transform3d::Identity(); scale_tr.scale(std::min(1., camera.get_inv_zoom() * 10.)); diff --git a/src/slic3r/GUI/DoubleSliderForGcode.cpp b/src/slic3r/GUI/DoubleSliderForGcode.cpp index 54bffae..21aab81 100644 --- a/src/slic3r/GUI/DoubleSliderForGcode.cpp +++ b/src/slic3r/GUI/DoubleSliderForGcode.cpp @@ -1,4 +1,3 @@ - #include "DoubleSliderForGcode.hpp" #include diff --git a/src/slic3r/GUI/DoubleSliderForGcode.hpp b/src/slic3r/GUI/DoubleSliderForGcode.hpp index 97c0301..5f914a2 100644 --- a/src/slic3r/GUI/DoubleSliderForGcode.hpp +++ b/src/slic3r/GUI/DoubleSliderForGcode.hpp @@ -1,4 +1,3 @@ - #ifndef slic3r_GUI_DoubleSliderForGcode_hpp_ #define slic3r_GUI_DoubleSliderForGcode_hpp_ diff --git a/src/slic3r/GUI/DoubleSliderForLayers.cpp b/src/slic3r/GUI/DoubleSliderForLayers.cpp index 128acca..a6b4b59 100644 --- a/src/slic3r/GUI/DoubleSliderForLayers.cpp +++ b/src/slic3r/GUI/DoubleSliderForLayers.cpp @@ -1,4 +1,3 @@ - #include "DoubleSliderForLayers.hpp" #include @@ -108,7 +107,6 @@ void DSForLayers::SetLayersTimes(const std::vector& layers_times, float t // Erase duplicates values from m_values and save it to the m_layers_values // They will be used for show the correct estimated time for MM print, when "No sparce layer" is enabled - // See https://github.com/qidi3d/QIDISlicer/issues/6232 if (m_ticks.is_wipe_tower && m_values.size() != m_layers_times.size()) { m_layers_values = m_values; sort(m_layers_values.begin(), m_layers_values.end()); @@ -386,7 +384,6 @@ void DSForLayers::draw_ruler(const ImRect& slideable_region) tick++; } } - // very short object or some non-trivial ruler with non-regular step (see https://github.com/qidi3d/QIDISlicer/issues/7263) else { if (step < 1) // step less then 1 px indicates very tall object with non-regular laayer step (probably in vase mode) return; @@ -1097,7 +1094,6 @@ std::string DSForLayers::get_label(int pos, LabelType label_type, const std::str // When "Print Settings -> Multiple Extruders -> No sparse layer" is enabled, then "Smart" Wipe Tower is used for wiping. // As a result, each layer with tool changes is splited for min 3 parts: first tool, wiping, second tool ... // So, vertical slider have to respect to this case. - // see https://github.com/qidi3d/QIDISlicer/issues/6232. // m_values contains data for all layer's parts, // but m_layers_values contains just unique Z values. // Use this function for correct conversion slider position to number of printed layer @@ -1210,8 +1206,6 @@ std::string DSForLayers::get_tooltip(int tick/*=-1*/) std::string space = " "; tooltip = space; auto format_gcode = [space](std::string gcode) -> std::string { - // when the tooltip is too long, it starts to flicker, see: https://github.com/qidi3d/QIDISlicer/issues/7368 - // so we limit the number of lines shown std::vector lines; boost::split(lines, gcode, boost::is_any_of("\n"), boost::token_compress_off); static const size_t MAX_LINES = 10; diff --git a/src/slic3r/GUI/DoubleSliderForLayers.hpp b/src/slic3r/GUI/DoubleSliderForLayers.hpp index 8f2ee7a..4cb7375 100644 --- a/src/slic3r/GUI/DoubleSliderForLayers.hpp +++ b/src/slic3r/GUI/DoubleSliderForLayers.hpp @@ -1,4 +1,3 @@ - #ifndef slic3r_GUI_DoubleSliderForLayers_hpp_ #define slic3r_GUI_DoubleSliderForLayers_hpp_ diff --git a/src/slic3r/GUI/EditGCodeDialog.cpp b/src/slic3r/GUI/EditGCodeDialog.cpp index 21b92ee..444cb41 100644 --- a/src/slic3r/GUI/EditGCodeDialog.cpp +++ b/src/slic3r/GUI/EditGCodeDialog.cpp @@ -23,7 +23,7 @@ #include "libslic3r/PlaceholderParser.hpp" #include "libslic3r/Preset.hpp" -#include "libslic3r/PresetBundle.hpp" +#include "libslic3r/PresetBundle.hpp" // IWYU pragma: keep #include "libslic3r/Print.hpp" namespace Slic3r { @@ -56,7 +56,7 @@ EditGCodeDialog::EditGCodeDialog(wxWindow* parent, const std::string& key, const const auto text_clr_str = encode_color(ColorRGB(text_clr.Red(), text_clr.Green(), text_clr.Blue())); //TRN this word-combination is a part of phraze "For more information about placeholders and its use visit our help page" - const wxString link = format_wxstr("%2%", "help.qidi3d.com/article/macros_1775", _L("help page")); + const wxString link = format_wxstr("%2%", "wiki.qidi3d.com/article/macros_1775", _L("help page")); // TRN ConfigWizard : Downloader : %1% = "help page" const wxString main_text = format_wxstr(_L("For more information about placeholders and its use visit our %1%."), link); diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp index f481b3d..e8bf1ce 100644 --- a/src/slic3r/GUI/Field.cpp +++ b/src/slic3r/GUI/Field.cpp @@ -13,8 +13,8 @@ #include #include -#include -#include +#include // IWYU pragma: keep +#include // IWYU pragma: keep #include #include #include @@ -256,7 +256,6 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true const char dec_sep_alt = dec_sep == '.' ? ',' : '.'; // Replace the first incorrect separator in decimal number, // if this value doesn't "N/A" value in some language - // see https://github.com/qidi3d/QIDISlicer/issues/6921 if (!is_na_value && str.Replace(dec_sep_alt, dec_sep, false) != 0) set_value(str, false); @@ -314,7 +313,6 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true case coFloatOrPercent: { if (m_opt.type == coFloatOrPercent && m_opt.opt_key == "first_layer_height" && !str.IsEmpty() && str.Last() == '%') { // Workaroud to avoid of using of the % for first layer height - // see https://github.com/qidi3d/QIDISlicer/issues/7418 wxString label = m_opt.full_label.empty() ? _(m_opt.label) : _(m_opt.full_label); show_error(m_parent, format_wxstr(_L("%s doesn't support percentage"), label)); const wxString stVal = double_to_string(0.01, 2); @@ -1058,15 +1056,7 @@ void Choice::BUILD() { // recast as a wxWindow to fit the calling convention window = dynamic_cast(temp); -//Y10 - /*if (m_opt.enum_def) { - if (auto& labels = m_opt.enum_def->labels(); !labels.empty()) { - bool localized = m_opt.enum_def->has_labels(); - for (const std::string& el : labels) - temp->Append(localized ? _(from_u8(el)) : from_u8(el)); - set_selection(); - } - }*/ + //B35 #if defined(__WIN32__) || defined(__WXMAC__) if (m_opt.enum_def) { @@ -1109,10 +1099,9 @@ void Choice::BUILD() { temp->Append(localized ? _(from_u8(el)) : from_u8(el)); set_selection(); } - } + } #endif - temp->Bind(wxEVT_MOUSEWHEEL, [this](wxMouseEvent& e) { if (m_suppress_scroll && !m_is_dropped) e.StopPropagation(); diff --git a/src/slic3r/GUI/FirmwareDialog.cpp b/src/slic3r/GUI/FirmwareDialog.cpp index 2674fe1..bddccb1 100644 --- a/src/slic3r/GUI/FirmwareDialog.cpp +++ b/src/slic3r/GUI/FirmwareDialog.cpp @@ -771,7 +771,7 @@ void FirmwareDialog::priv::ensure_joined() const char* FirmwareDialog::priv::avr109_dev_name(Avr109Pid usb_pid) { switch (usb_pid.boot) { case USB_PID_MMU_BOOT: - return "Original QIDI MMU 2.0 Control"; + return "Original QIDI Multi Material 2 & 3 Upgrade (bootloader)"; case USB_PID_CW1_BOOT: return "Original QIDI CW1"; case USB_PID_CW1S_BOOT: diff --git a/src/slic3r/GUI/FrequentlyChangedParameters.cpp b/src/slic3r/GUI/FrequentlyChangedParameters.cpp index 1a58f18..642eda3 100644 --- a/src/slic3r/GUI/FrequentlyChangedParameters.cpp +++ b/src/slic3r/GUI/FrequentlyChangedParameters.cpp @@ -1,5 +1,3 @@ - - #include "FrequentlyChangedParameters.hpp" #include "Plater.hpp" diff --git a/src/slic3r/GUI/FrequentlyChangedParameters.hpp b/src/slic3r/GUI/FrequentlyChangedParameters.hpp index 91daedb..99de251 100644 --- a/src/slic3r/GUI/FrequentlyChangedParameters.hpp +++ b/src/slic3r/GUI/FrequentlyChangedParameters.hpp @@ -1,4 +1,3 @@ - #ifndef slic3r_FreqChangedParams_hpp_ #define slic3r_FreqChangedParams_hpp_ diff --git a/src/slic3r/GUI/GCodeViewer.cpp b/src/slic3r/GUI/GCodeViewer.cpp index 6cd8621..fb60ed2 100644 --- a/src/slic3r/GUI/GCodeViewer.cpp +++ b/src/slic3r/GUI/GCodeViewer.cpp @@ -212,18 +212,7 @@ void GCodeViewer::SequentialView::Marker::init() m_model.set_color({ 1.0f, 1.0f, 1.0f, 0.5f }); } -void GCodeViewer::SequentialView::Marker::set_world_position(const Vec3f& position) -{ - m_world_position = position; - m_world_transform = (Geometry::translation_transform((position + m_model_z_offset * Vec3f::UnitZ()).cast()) * - Geometry::translation_transform(m_model.get_bounding_box().size().z() * Vec3d::UnitZ()) * Geometry::rotation_transform({ M_PI, 0.0, 0.0 })).cast(); -} - -////B43 -void GCodeViewer::SequentialView::Marker::update_curr_move(GCodeProcessorResult::MoveVertex move) { m_curr_move = move; } - -//B43 -void GCodeViewer::SequentialView::Marker::render(EViewType &view_type) +void GCodeViewer::SequentialView::Marker::render() { if (!m_visible) return; @@ -677,12 +666,12 @@ void GCodeViewer::SequentialView::GCodeWindow::render(float top, float bottom, s assert(m_lines_cache.size() == m_cache_range.size()); }; //B18 - static const ImVec4 LINE_NUMBER_COLOR = ImGuiWrapper::COL_BLUE_LIGHT; - static const ImVec4 SELECTION_RECT_COLOR = ImGuiWrapper::COL_BLUE_LIGHT; - static const ImVec4 COMMAND_COLOR = { 0.8f, 0.8f, 0.0f, 1.0f }; - static const ImVec4 PARAMETERS_COLOR = { 1.0f, 1.0f, 1.0f, 1.0f }; - static const ImVec4 COMMENT_COLOR = { 0.27f, 0.47f, 1.0f, 1.0f }; - static const ImVec4 ELLIPSIS_COLOR = { 0.0f, 0.7f, 0.0f, 1.0f }; + static const ImVec4 LINE_NUMBER_COLOR = ImGuiPureWrap::COL_BLUE_LIGHT; + static const ImVec4 SELECTION_RECT_COLOR = ImGuiPureWrap::COL_BLUE_LIGHT; + static const ImVec4 COMMAND_COLOR = { 0.8f, 0.8f, 0.0f, 1.0f }; + static const ImVec4 PARAMETERS_COLOR = { 1.0f, 1.0f, 1.0f, 1.0f }; + static const ImVec4 COMMENT_COLOR = { 0.27f, 0.47f, 1.0f, 1.0f }; + static const ImVec4 ELLIPSIS_COLOR = { 0.0f, 0.7f, 0.0f, 1.0f }; if (!m_visible || m_filename.empty() || m_lines_ends.empty() || curr_line_id == 0) return; @@ -815,8 +804,8 @@ void GCodeViewer::SequentialView::GCodeWindow::render(float top, float bottom, s imgui.set_requires_extra_frame(); } } -//B43 -void GCodeViewer::SequentialView::render(float legend_height, EViewType &view_type) + +void GCodeViewer::SequentialView::render(float legend_height, const libvgcode::Viewer* viewer, uint32_t gcode_id) { #if VGCODE_ENABLE_COG_AND_TOOL_MARKERS if (viewer == nullptr) @@ -839,87 +828,188 @@ void GCodeViewer::init() if (m_gl_data_initialized) return; - // initializes opengl data of TBuffers - for (size_t i = 0; i < m_buffers.size(); ++i) { - TBuffer& buffer = m_buffers[i]; - EMoveType type = buffer_type(i); - switch (type) - { - default: { break; } - case EMoveType::Tool_change: - case EMoveType::Color_change: - case EMoveType::Pause_Print: - case EMoveType::Custom_GCode: - case EMoveType::Retract: - case EMoveType::Unretract: - case EMoveType::Seam: { -#if !DISABLE_GCODEVIEWER_INSTANCED_MODELS - if (wxGetApp().is_gl_version_greater_or_equal_to(3, 3)) { - buffer.render_primitive_type = TBuffer::ERenderPrimitiveType::InstancedModel; - buffer.shader = "gouraud_light_instanced"; - buffer.model.model.init_from(diamond(16)); - buffer.model.color = option_color(type); - buffer.model.instances.format = InstanceVBuffer::EFormat::InstancedModel; - } - else { -#endif // !DISABLE_GCODEVIEWER_INSTANCED_MODELS - buffer.render_primitive_type = TBuffer::ERenderPrimitiveType::BatchedModel; - buffer.vertices.format = VBuffer::EFormat::PositionNormal3; - buffer.shader = "gouraud_light"; - buffer.model.data = diamond(16); - buffer.model.color = option_color(type); - buffer.model.instances.format = InstanceVBuffer::EFormat::BatchedModel; -#if !DISABLE_GCODEVIEWER_INSTANCED_MODELS - } -#endif // !DISABLE_GCODEVIEWER_INSTANCED_MODELS - break; - } - case EMoveType::Wipe: - case EMoveType::Extrude: { - buffer.render_primitive_type = TBuffer::ERenderPrimitiveType::Triangle; - buffer.vertices.format = VBuffer::EFormat::PositionNormal3; - buffer.shader = "gouraud_light"; - break; - } - case EMoveType::Travel: { - buffer.render_primitive_type = TBuffer::ERenderPrimitiveType::Line; - buffer.vertices.format = VBuffer::EFormat::Position; -#if ENABLE_GL_CORE_PROFILE - // on MAC using the geometry shader of dashed_thick_lines is too slow - buffer.shader = "flat"; -// buffer.shader = OpenGLManager::get_gl_info().is_core_profile() ? "dashed_thick_lines" : "flat"; -#else - buffer.shader = "flat"; -#endif // ENABLE_GL_CORE_PROFILE - break; - } - } -//Y13 - set_toolpath_move_type_visible(EMoveType::Seam, true); - set_toolpath_move_type_visible(EMoveType::Extrude, true); - } - // initializes tool marker m_sequential_view.marker.init(); m_gl_data_initialized = true; + + try + { + m_viewer.init(reinterpret_cast(glGetString(GL_VERSION))); + glcheck(); + } + catch (const std::exception& e) + { + MessageDialog msg_dlg(wxGetApp().plater(), e.what(), _L("Error"), wxICON_ERROR | wxOK); + msg_dlg.ShowModal(); + } } -void GCodeViewer::load(const GCodeProcessorResult& gcode_result, const Print& print) +void GCodeViewer::load_as_gcode(const GCodeProcessorResult& gcode_result, const Print& print, const std::vector& str_tool_colors, + const std::vector& str_color_print_colors) { + m_loaded_as_preview = false; + + const bool current_top_layer_only = m_viewer.is_top_layer_only_view_range(); + const bool required_top_layer_only = get_app_config()->get_bool("seq_top_layer_only"); + if (current_top_layer_only != required_top_layer_only) + m_viewer.toggle_top_layer_only_view_range(); + // avoid processing if called with the same gcode_result - if (m_last_result_id == gcode_result.id && - (m_last_view_type == m_view_type || (m_last_view_type != EViewType::VolumetricRate && m_view_type != EViewType::VolumetricRate))) + if (m_last_result_id == gcode_result.id && wxGetApp().is_editor()) { + // collect tool colors + libvgcode::Palette tools_colors; + tools_colors.reserve(str_tool_colors.size()); + for (const std::string& color : str_tool_colors) { + tools_colors.emplace_back(libvgcode::convert(color)); + } + m_viewer.set_tool_colors(tools_colors); + + // collect color print colors + libvgcode::Palette color_print_colors; + const std::vector& str_colors = str_color_print_colors.empty() ? str_tool_colors : str_color_print_colors; + for (const std::string& color : str_colors) { + color_print_colors.emplace_back(libvgcode::convert(color)); + } + m_viewer.set_color_print_colors(color_print_colors); return; + } m_last_result_id = gcode_result.id; - m_last_view_type = m_view_type; // release gpu memory, if used - reset(); + reset(); - //B43 - m_gcode_result = &gcode_result; + // convert data from QIDISlicer format to libvgcode format + libvgcode::GCodeInputData data = libvgcode::convert(gcode_result, str_tool_colors, str_color_print_colors, m_viewer); + +//#define ENABLE_DATA_EXPORT 1 +//#if ENABLE_DATA_EXPORT +// auto extrusion_role_to_string = [](libvgcode::EGCodeExtrusionRole role) { +// switch (role) { +// case libvgcode::EGCodeExtrusionRole::None: { return "EGCodeExtrusionRole::None"; } +// case libvgcode::EGCodeExtrusionRole::Perimeter: { return "EGCodeExtrusionRole::Perimeter"; } +// case libvgcode::EGCodeExtrusionRole::ExternalPerimeter: { return "EGCodeExtrusionRole::ExternalPerimeter"; } +// case libvgcode::EGCodeExtrusionRole::OverhangPerimeter: { return "EGCodeExtrusionRole::OverhangPerimeter"; } +// case libvgcode::EGCodeExtrusionRole::InternalInfill: { return "EGCodeExtrusionRole::InternalInfill"; } +// case libvgcode::EGCodeExtrusionRole::SolidInfill: { return "EGCodeExtrusionRole::SolidInfill"; } +// case libvgcode::EGCodeExtrusionRole::TopSolidInfill: { return "EGCodeExtrusionRole::TopSolidInfill"; } +// case libvgcode::EGCodeExtrusionRole::Ironing: { return "EGCodeExtrusionRole::Ironing"; } +// case libvgcode::EGCodeExtrusionRole::BridgeInfill: { return "EGCodeExtrusionRole::BridgeInfill"; } +// case libvgcode::EGCodeExtrusionRole::GapFill: { return "EGCodeExtrusionRole::GapFill"; } +// case libvgcode::EGCodeExtrusionRole::Skirt: { return "EGCodeExtrusionRole::Skirt"; } +// case libvgcode::EGCodeExtrusionRole::SupportMaterial: { return "EGCodeExtrusionRole::SupportMaterial"; } +// case libvgcode::EGCodeExtrusionRole::SupportMaterialInterface: { return "EGCodeExtrusionRole::SupportMaterialInterface"; } +// case libvgcode::EGCodeExtrusionRole::WipeTower: { return "EGCodeExtrusionRole::WipeTower"; } +// case libvgcode::EGCodeExtrusionRole::Custom: { return "EGCodeExtrusionRole::Custom"; } +// case libvgcode::EGCodeExtrusionRole::COUNT: { return "EGCodeExtrusionRole::COUNT"; } +// } +// }; +// +// auto move_type_to_string = [](libvgcode::EMoveType type) { +// switch (type) { +// case libvgcode::EMoveType::Noop: { return "EMoveType::Noop"; } +// case libvgcode::EMoveType::Retract: { return "EMoveType::Retract"; } +// case libvgcode::EMoveType::Unretract: { return "EMoveType::Unretract"; } +// case libvgcode::EMoveType::Seam: { return "EMoveType::Seam"; } +// case libvgcode::EMoveType::ToolChange: { return "EMoveType::ToolChange"; } +// case libvgcode::EMoveType::ColorChange: { return "EMoveType::ColorChange"; } +// case libvgcode::EMoveType::PausePrint: { return "EMoveType::PausePrint"; } +// case libvgcode::EMoveType::CustomGCode: { return "EMoveType::CustomGCode"; } +// case libvgcode::EMoveType::Travel: { return "EMoveType::Travel"; } +// case libvgcode::EMoveType::Wipe: { return "EMoveType::Wipe"; } +// case libvgcode::EMoveType::Extrude: { return "EMoveType::Extrude"; } +// case libvgcode::EMoveType::COUNT: { return "EMoveType::COUNT"; } +// } +// }; +// +// FilePtr out{ boost::nowide::fopen("C:/qidi/slicer/test_output/spe1872/test.data", "wb") }; +// if (out.f != nullptr) { +// const uint32_t vertices_count = static_cast(data.vertices.size()); +// fwrite((void*)&vertices_count, 1, sizeof(uint32_t), out.f); +// for (const libvgcode::PathVertex& v : data.vertices) { +// fwrite((void*)&v.position[0], 1, sizeof(float), out.f); +// fwrite((void*)&v.position[1], 1, sizeof(float), out.f); +// fwrite((void*)&v.position[2], 1, sizeof(float), out.f); +// fwrite((void*)&v.height, 1, sizeof(float), out.f); +// fwrite((void*)&v.width, 1, sizeof(float), out.f); +// fwrite((void*)&v.feedrate, 1, sizeof(float), out.f); +// fwrite((void*)&v.actual_feedrate, 1, sizeof(float), out.f); +// fwrite((void*)&v.mm3_per_mm, 1, sizeof(float), out.f); +// fwrite((void*)&v.fan_speed, 1, sizeof(float), out.f); +// fwrite((void*)&v.temperature, 1, sizeof(float), out.f); +// fwrite((void*)&v.role, 1, sizeof(uint8_t), out.f); +// fwrite((void*)&v.type, 1, sizeof(uint8_t), out.f); +// fwrite((void*)&v.gcode_id, 1, sizeof(uint32_t), out.f); +// fwrite((void*)&v.layer_id, 1, sizeof(uint32_t), out.f); +// fwrite((void*)&v.extruder_id, 1, sizeof(uint32_t), out.f); +// fwrite((void*)&v.color_id, 1, sizeof(uint32_t), out.f); +// fwrite((void*)&v.times[0], 1, sizeof(float), out.f); +// fwrite((void*)&v.times[1], 1, sizeof(float), out.f); +//#if VGCODE_ENABLE_COG_AND_TOOL_MARKERS +// const float weight = v.weight; +//#else +// const float weight = 0.0f; +//#endif // VGCODE_ENABLE_COG_AND_TOOL_MARKERS +// fwrite((void*)&weight, 1, sizeof(float), out.f); +// } +// +// const uint8_t spiral_vase_mode = data.spiral_vase_mode ? 1 : 0; +// fwrite((void*)&spiral_vase_mode, 1, sizeof(uint8_t), out.f); +// +// const uint32_t tool_colors_count = static_cast(data.tools_colors.size()); +// fwrite((void*)&tool_colors_count, 1, sizeof(uint32_t), out.f); +// for (const libvgcode::Color& c : data.tools_colors) { +// fwrite((void*)&c[0], 1, sizeof(uint8_t), out.f); +// fwrite((void*)&c[1], 1, sizeof(uint8_t), out.f); +// fwrite((void*)&c[2], 1, sizeof(uint8_t), out.f); +// } +// +// const uint32_t color_print_colors_count = static_cast(data.color_print_colors.size()); +// fwrite((void*)&color_print_colors_count, 1, sizeof(uint32_t), out.f); +// for (const libvgcode::Color& c : data.color_print_colors) { +// fwrite((void*)&c[0], 1, sizeof(uint8_t), out.f); +// fwrite((void*)&c[1], 1, sizeof(uint8_t), out.f); +// fwrite((void*)&c[2], 1, sizeof(uint8_t), out.f); +// } +// } +//#endif // ENABLE_DATA_EXPORT + + // send data to the viewer + m_viewer.reset_default_extrusion_roles_colors(); + m_viewer.load(std::move(data)); + +#if !VGCODE_ENABLE_COG_AND_TOOL_MARKERS + const size_t vertices_count = m_viewer.get_vertices_count(); + m_cog.reset(); + for (size_t i = 1; i < vertices_count; ++i) { + const libvgcode::PathVertex& curr = m_viewer.get_vertex_at(i); + if (curr.type == libvgcode::EMoveType::Extrude && + curr.role != libvgcode::EGCodeExtrusionRole::Skirt && + curr.role != libvgcode::EGCodeExtrusionRole::SupportMaterial && + curr.role != libvgcode::EGCodeExtrusionRole::SupportMaterialInterface && + curr.role != libvgcode::EGCodeExtrusionRole::WipeTower && + curr.role != libvgcode::EGCodeExtrusionRole::Custom) { + const Vec3d curr_pos = libvgcode::convert(curr.position).cast(); + const Vec3d prev_pos = libvgcode::convert(m_viewer.get_vertex_at(i - 1).position).cast(); + m_cog.add_segment(curr_pos, prev_pos, gcode_result.filament_densities[curr.extruder_id] * curr.mm3_per_mm * (curr_pos - prev_pos).norm()); + } + } +#endif // !VGCODE_ENABLE_COG_AND_TOOL_MARKERS + + const libvgcode::AABox bbox = wxGetApp().is_gcode_viewer() ? + m_viewer.get_bounding_box() : + m_viewer.get_extrusion_bounding_box({ + libvgcode::EGCodeExtrusionRole::Perimeter, libvgcode::EGCodeExtrusionRole::ExternalPerimeter, libvgcode::EGCodeExtrusionRole::OverhangPerimeter, + libvgcode::EGCodeExtrusionRole::InternalInfill, libvgcode::EGCodeExtrusionRole::SolidInfill, libvgcode::EGCodeExtrusionRole::TopSolidInfill, + libvgcode::EGCodeExtrusionRole::Ironing, libvgcode::EGCodeExtrusionRole::BridgeInfill, libvgcode::EGCodeExtrusionRole::GapFill, + libvgcode::EGCodeExtrusionRole::Skirt, libvgcode::EGCodeExtrusionRole::SupportMaterial, libvgcode::EGCodeExtrusionRole::SupportMaterialInterface, + libvgcode::EGCodeExtrusionRole::WipeTower + }); + m_paths_bounding_box = BoundingBoxf3(libvgcode::convert(bbox[0]).cast(), libvgcode::convert(bbox[1]).cast()); + + if (wxGetApp().is_editor()) + m_contained_in_bed = wxGetApp().plater()->build_volume().all_paths_inside(gcode_result, m_paths_bounding_box); m_extruders_count = gcode_result.extruders_count; m_sequential_view.gcode_window.load_gcode(gcode_result); @@ -978,8 +1068,7 @@ void GCodeViewer::load(const GCodeProcessorResult& gcode_result, const Print& pr } //B52 - wxGetApp().plater()->set_bed_shape(bed_shape, gcode_result.max_print_height, texture, model, - {{0.,0.}},gcode_result.bed_shape.empty()); + wxGetApp().plater()->set_bed_shape(bed_shape, gcode_result.max_print_height, texture, model, {{0.,0.}}, gcode_result.bed_shape.empty()); } m_print_statistics = gcode_result.print_statistics; @@ -1056,14 +1145,9 @@ void GCodeViewer::render() const libvgcode::PathVertex& curr_vertex = m_viewer.get_current_vertex(); m_sequential_view.marker.set_world_position(libvgcode::convert(curr_vertex.position)); m_sequential_view.marker.set_z_offset(m_z_offset); - //B43 - m_sequential_view.render(legend_height, m_view_type); + m_sequential_view.render(legend_height, &m_viewer, curr_vertex.gcode_id); } } -#if ENABLE_GCODE_VIEWER_STATISTICS - render_statistics(); -#endif // ENABLE_GCODE_VIEWER_STATISTICS -} #if VGCODE_ENABLE_COG_AND_TOOL_MARKERS if (is_legend_shown()) { @@ -2664,10 +2748,11 @@ void GCodeViewer::render_legend(float& legend_height) if (ImGui::BeginTable("Times", 2)) { const std::vector layers_times = get_layers_times(); if (!layers_times.empty()) - add_strings_row_to_table(_u8L("First layer") + ":", ImGuiPSWrap::to_ImVec4(ColorRGBA::WHITE()), + //y15 + add_strings_row_to_table(_u8L("First layer") + ":", ImGuiPureWrap::COL_WHITE_LIGHT, short_time_ui(get_time_dhms(layers_times.front())), ImGuiPSWrap::to_ImVec4(ColorRGBA::WHITE())); - add_strings_row_to_table(_u8L("Total") + ":", ImGuiPSWrap::to_ImVec4(ColorRGBA::WHITE()), + add_strings_row_to_table(_u8L("Total") + ":", ImGuiPureWrap::COL_WHITE_LIGHT, short_time_ui(get_time_dhms(time_mode.time)), ImGuiPSWrap::to_ImVec4(ColorRGBA::WHITE())); ImGui::EndTable(); diff --git a/src/slic3r/GUI/GCodeViewer.hpp b/src/slic3r/GUI/GCodeViewer.hpp index dd34ff9..9d552cd 100644 --- a/src/slic3r/GUI/GCodeViewer.hpp +++ b/src/slic3r/GUI/GCodeViewer.hpp @@ -110,7 +110,6 @@ public: { GLModel m_model; Vec3f m_world_position; - Transform3f m_world_transform; // For seams, the position of the marker is on the last endpoint of the toolpath containing it. // This offset is used to show the correct value of tool position in the "ToolPosition" window. // See implementation of render() method @@ -149,9 +148,9 @@ public: bool is_visible() const { return m_visible; } void set_visible(bool visible) { m_visible = visible; } - //B43 - void render(EViewType &view_type); - void update_curr_move(GCodeProcessorResult::MoveVertex move); + + void render(); + void render_position_window(const libvgcode::Viewer* viewer); }; class GCodeWindow @@ -216,10 +215,6 @@ private: BoundingBoxf3 m_shells_bounding_box; // bounding box of toolpaths + marker tools + shells BoundingBoxf3 m_max_bounding_box; - - //B43 - const GCodeProcessorResult *m_gcode_result; - float m_max_print_height{ 0.0f }; float m_z_offset{ 0.0f }; size_t m_extruders_count; diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 3e1ebcf..20ecc44 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -1,7 +1,7 @@ #include "libslic3r/libslic3r.h" #include "GLCanvas3D.hpp" -#include +#include // IWYU pragma: keep #include #include "libslic3r/BuildVolume.hpp" @@ -71,19 +71,12 @@ #ifndef IMGUI_DEFINE_MATH_OPERATORS #define IMGUI_DEFINE_MATH_OPERATORS #endif - #include #include static constexpr const float TRACKBALLSIZE = 0.8f; //B12 -/* -static const Slic3r::ColorRGBA DEFAULT_BG_DARK_COLOR = { 0.478f, 0.478f, 0.478f, 1.0f }; -static const Slic3r::ColorRGBA DEFAULT_BG_LIGHT_COLOR = { 0.753f, 0.753f, 0.753f, 1.0f }; -static const Slic3r::ColorRGBA ERROR_BG_DARK_COLOR = { 0.478f, 0.192f, 0.039f, 1.0f }; -static const Slic3r::ColorRGBA ERROR_BG_LIGHT_COLOR = { 0.753f, 0.192f, 0.039f, 1.0f }; -*/ static const Slic3r::ColorRGBA DEFAULT_BG_DARK_COLOR = {0.957f, 0.969f, 0.996f, 1.0f}; static const Slic3r::ColorRGBA DEFAULT_BG_LIGHT_COLOR = {0.957f, 0.969f, 0.996f, 1.0f}; static const Slic3r::ColorRGBA DARKMODE_BG_DARK_COLOR = {0.145f, 0.149f, 0.165f, 1.0f}; @@ -617,8 +610,8 @@ void GLCanvas3D::LayersEditing::generate_layer_height_texture() bool level_of_detail_2nd_level = true; m_layers_texture.cells = Slic3r::generate_layer_height_texture( *m_slicing_parameters, - //w27 - Slic3r::generate_object_layers(*m_slicing_parameters, m_layer_height_profile,false), + //w27 + Slic3r::generate_object_layers(*m_slicing_parameters, m_layer_height_profile,false), m_layers_texture.data.data(), m_layers_texture.height, m_layers_texture.width, level_of_detail_2nd_level); m_layers_texture.valid = true; } @@ -1499,7 +1492,6 @@ bool GLCanvas3D::check_volumes_outside_state(GLVolumeCollection& volumes, ModelI //FIXME doing test on convex hull until we learn to do test on non-convex polygons efficiently. case BuildVolume::Type::Custom: state = build_volume.object_state(volume_convex_mesh(*volume).its, volume->world_matrix().cast(), volume_sinking(*volume)); - // state = build_volume.volume_state_bbox(volume_bbox(*volume)); break; default: // Ignore, don't produce any collision. @@ -2508,8 +2500,6 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re } //Y5 if ToolpathOutside, unable export button - //post_event(Event(EVT_GLCANVAS_ENABLE_ACTION_BUTTONS, - // contained_min_one && !m_model->objects.empty() && !partlyOut)); if (isToolpathOutside) { post_event(Event(EVT_GLCANVAS_ENABLE_EXPORT_BUTTONS, false)); } @@ -2547,6 +2537,7 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re raycaster->set_active(v->is_active); } + // check activity/visibility of the modifiers in SLA mode for (GLVolume* volume : m_volumes.volumes) if (volume->object_idx() < (int)m_model->objects.size() && m_model->objects[volume->object_idx()]->instances[volume->instance_idx()]->is_printable()) { if (volume->is_active && volume->is_modifier && m_model->objects[volume->object_idx()]->volumes[volume->volume_idx()]->is_modifier()) @@ -3061,7 +3052,6 @@ void GLCanvas3D::on_key(wxKeyEvent& evt) } else if (! wxGetApp().is_gcode_viewer() && keyCode == WXK_TAB && // Use strong condition for modifiers state to avoid cases when Shift can be combined with other modifiers - // (see https://github.com/qidi3d/QIDISlicer/issues/7799) evt.GetModifiers() == wxMOD_SHIFT) { // Collapse side-panel with Shift+Tab post_event(SimpleEvent(EVT_GLCANVAS_COLLAPSE_SIDEBAR)); @@ -3217,7 +3207,6 @@ void GLCanvas3D::on_mouse_wheel(wxMouseEvent& evt) #ifdef __WXMSW__ // For some reason the Idle event is not being generated after the mouse scroll event in case of scrolling with the two fingers on the touch pad, // if the event is not allowed to be passed further. - // https://github.com/qidi3d/QIDISlicer/issues/2750 // evt.Skip() used to trigger the needed screen refresh, but it does no more. wxWakeUpIdle() seem to work now. wxWakeUpIdle(); #endif /* __WXMSW__ */ @@ -6044,8 +6033,6 @@ bool GLCanvas3D::check_toolbar_icon_size(float init_scale, float& new_scale_to_s // calculate scale needed for items in all top toolbars // the std::max() is there because on some Linux dialects/virtual machines this code is called when the canvas has not been properly initialized yet, // leading to negative values for the scale. - // See: https://github.com/qidi3d/QIDISlicer/issues/8563 - // https://github.com/supermerill/SuperSlicer/issues/854 const float new_h_scale = std::max((cnv_size.get_width() - noitems_width), 1.0f) / (items_cnt * GLToolbar::Default_Icons_Size); float gizmos_height = m_gizmos.get_scaled_total_height(); @@ -6299,6 +6286,8 @@ void GLCanvas3D::_render_camera_target() } #endif // ENABLE_SHOW_CAMERA_TARGET + + static void render_sla_layer_legend(const SLAPrint& print, int layer_idx, int cnv_width) { const std::vector& areas = print.print_statistics().layers_areas; @@ -6329,6 +6318,8 @@ static void render_sla_layer_legend(const SLAPrint& print, int layer_idx, int cn } } + + void GLCanvas3D::_render_sla_slices() { if (!m_use_clipping_planes || current_printer_technology() != ptSLA) @@ -6674,7 +6665,7 @@ void GLCanvas3D::_set_warning_notification_if_needed(EWarning warning) } } } - + //Y5 if (show) { isToolpathOutside = true; diff --git a/src/slic3r/GUI/GLTexture.cpp b/src/slic3r/GUI/GLTexture.cpp index a980d57..16b4249 100644 --- a/src/slic3r/GUI/GLTexture.cpp +++ b/src/slic3r/GUI/GLTexture.cpp @@ -218,7 +218,6 @@ bool GLTexture::load_from_svg_files_as_sprites_array(const std::vectorapp_version_check(false); }); @@ -924,20 +920,7 @@ static boost::optional parse_semver_from_ini(const std::string& path) void GUI_App::init_app_config() { - // Profiles for the alpha are stored into the QIDISlicer-alpha directory to not mix with the current release. - - SetAppName(SLIC3R_APP_FULL_NAME); -// SetAppName(SLIC3R_APP_KEY "-alpha"); -//B7 - // SetAppName(SLIC3R_APP_KEY "-beta"); - - -// SetAppDisplayName(SLIC3R_APP_NAME); - - // Set the Slic3r data directory at the Slic3r XS module. - // Unix: ~/ .Slic3r - // Windows : "C:\Users\username\AppData\Roaming\Slic3r" or "C:\Documents and Settings\username\Application Data\Slic3r" - // Mac : "~/Library/Application Support/Slic3r" + SetAppName(SLIC3R_APP_FULL_NAME); if (!app_config) app_config = new AppConfig(is_editor() ? AppConfig::EAppMode::Editor : AppConfig::EAppMode::GCodeViewer); @@ -1440,7 +1423,7 @@ bool GUI_App::on_init_inner() , NotificationManager::NotificationLevel::ImportantNotificationLevel , Slic3r::format(_u8L("New prerelease version %1% is available."), evt_string) , _u8L("See Releases page.") - , [](wxEvtHandler* evnthndlr) {wxGetApp().open_browser_with_warning_dialog("https://github.com/qidi3d/QIDISlicer/releases"); return true; } + , [](wxEvtHandler* evnthndlr) {wxGetApp().open_browser_with_warning_dialog("https://github.com/QIDITECH/QIDISlicer/releases"); return true; } ); } } @@ -1554,6 +1537,7 @@ bool GUI_App::on_init_inner() if (is_editor()) update_mode(); // update view mode after fix of the object_list size + //y15 // show_printer_webview_tab(); #ifdef __APPLE__ @@ -1603,8 +1587,8 @@ bool GUI_App::on_init_inner() "To avoid this problem, consider disabling \"%4%\" in \"Preferences\". " "Otherwise, the application will most likely crash again next time."), "" + from_u8(crash_reason) + "", - "#2939", - "#5573", + "#2939", + "#5573", "" + preferences_item + ""), true, wxYES_NO); @@ -1672,18 +1656,18 @@ void GUI_App::init_ui_colours() m_mode_palette = get_mode_default_palette(); bool is_dark_mode = dark_mode(); -// #ifdef _WIN32 +//#ifdef _WIN32 //B10 m_color_label_default = is_dark_mode ? wxColour(255, 255, 255): wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT); m_color_highlight_label_default = is_dark_mode ? wxColour(230, 230, 230): wxSystemSettings::GetColour(/*wxSYS_COLOUR_HIGHLIGHTTEXT*/wxSYS_COLOUR_WINDOWTEXT); - m_color_highlight_default = is_dark_mode ? wxColour(68, 68, 68) : wxColour(180, 201, 253); + m_color_highlight_default = is_dark_mode ? wxColour(68, 68, 68) : wxColour(180, 201, 253); m_tap_color_highlight_default = is_dark_mode ? wxColour(43, 43, 43) : wxColour(255, 255, 255); m_color_hovered_btn_label = is_dark_mode ? wxColour(68, 121, 251) : wxColour(68, 121, 251); - m_color_default_btn_label = is_dark_mode ? wxColour(68, 121, 251): wxColour(68, 121, 251); + m_color_default_btn_label = is_dark_mode ? wxColour(68, 121, 251) : wxColour(68, 121, 251); m_color_selected_btn_bg = is_dark_mode ? wxColour(68, 68, 68) : wxColour(206, 209, 217); -// #else -// m_color_label_default = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT); -// #endif +//#else +// m_color_label_default = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT); +//#endif m_color_window_default = is_dark_mode ? wxColour(43, 43, 43) : wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); } @@ -1926,7 +1910,8 @@ const std::string GUI_App::get_html_bg_color(wxWindow* html_parent) wxColour bgr_clr = html_parent->GetBackgroundColour(); #ifdef __APPLE__ // On macOS 10.13 and older the background color returned by wxWidgets - // is wrong. wxSYS_COLOUR_WINDOW + // is wrong, which leads to https://github.com/QIDITECH/QIDISlicer/issues/7603 + // and https://github.com/QIDITECH/QIDISlicer/issues/3775. wxSYS_COLOUR_WINDOW // may not match the window background exactly, but it seems to never end up // as black on black. @@ -1970,6 +1955,7 @@ void GUI_App::set_mode_palette(const std::vector& palette) } } +//y bool GUI_App::tabs_as_menu() const { return app_config->get_bool("tabs_as_menu"); // || dark_mode(); @@ -2052,8 +2038,10 @@ void GUI_App::check_printer_presets() void GUI_App::recreate_GUI(const wxString& msg_name) { m_is_recreating_gui = true; - // y1 + + // y1 mainframe->m_printer_view->StopStatusThread(); + mainframe->shutdown(); wxProgressDialog dlg(msg_name, msg_name, 100, nullptr, wxPD_AUTO_HIDE); @@ -2135,6 +2123,7 @@ void GUI_App::shutdown() } } +//y15 void GUI_App::SetOnlineLogin(bool status) { if (!status) @@ -2144,12 +2133,14 @@ void GUI_App::SetOnlineLogin(bool status) wxGetApp().app_config->set("user_name", ""); wxGetApp().app_config->set("user_token", ""); } - mainframe->m_printer_view->SetLoginStatus(status); - mainframe->refresh_account_menu(status); + mainframe->m_printer_view->SetLoginStatus(status); + mainframe->refresh_account_menu(status); } +//y15 void GUI_App::SetPresentChange(bool status) { mainframe->m_printer_view->SetPresetChanged(status); } + // static method accepting a wxWindow object as first parameter bool GUI_App::catch_error(std::function cb, // wxMessageDialog* message_dialog, @@ -3296,9 +3287,9 @@ wxString GUI_App::current_language_code_safe() const { "ja", "ja_JP", }, { "ko", "ko_KR", }, { "pl", "pl_PL", }, - { "uk", "uk_UA", }, - { "zh", "zh_CN", }, - { "ru", "ru_RU", }, + //{ "uk", "uk_UA", }, + //{ "zh", "zh_CN", }, + //{ "ru", "ru_RU", }, }; wxString language_code = this->current_language_code().BeforeFirst('_'); auto it = mapping.find(language_code); @@ -3332,8 +3323,11 @@ bool GUI_App::run_wizard(ConfigWizard::RunReason reason, ConfigWizard::StartPage { wxCHECK_MSG(mainframe != nullptr, false, "Internal error: Main frame not created / null"); + //y15 + std::string old_token = wxGetApp().app_config->get("user_token"); + // Cancel sync before starting wizard to prevent two downloads at same time. - // preset_updater->cancel_sync(); + preset_updater->cancel_sync(); // Show login dialog before wizard. #if 0 bool user_was_logged = plater()->get_user_account()->is_logged(); @@ -3357,12 +3351,13 @@ bool GUI_App::run_wizard(ConfigWizard::RunReason reason, ConfigWizard::StartPage wxYield(); // We have to update repos - // plater()->get_preset_archive_database()->sync_blocking(); + //y15 + //plater()->get_preset_archive_database()->sync_blocking(); if (reason == ConfigWizard::RunReason::RR_USER) { // Since there might be new repos, we need to sync preset updater - preset_updater->cancel_sync(); const SharedArchiveRepositoryVector &repos = plater()->get_preset_archive_database()->get_selected_archive_repositories(); + //y15 // preset_updater->sync_blocking(preset_bundle, this, repos); preset_updater->update_index_db(); // Offer update installation. @@ -3398,7 +3393,9 @@ bool GUI_App::run_wizard(ConfigWizard::RunReason reason, ConfigWizard::StartPage may_switch_to_SLA_preset(_L("Configuration is editing from ConfigWizard")); } //y14 - wxGetApp().SetOnlineLogin(wxGetApp().app_config->get("user_token") != ""); + std::string new_token = wxGetApp().app_config->get("user_token"); + if(old_token != new_token) + wxGetApp().SetOnlineLogin(true); return res; } @@ -3573,12 +3570,10 @@ void GUI_App::window_pos_sanitize(wxTopLevelWindow* window) bool GUI_App::config_wizard_startup() { - if (!m_app_conf_exists || preset_bundle->printers.only_default_printers()) - { + if (!m_app_conf_exists || preset_bundle->printers.only_default_printers()) { run_wizard(ConfigWizard::RR_DATA_EMPTY); return true; - } - else if (get_app_config()->legacy_datadir()) { + } else if (get_app_config()->legacy_datadir()) { // Looks like user has legacy pre-vendorbundle data directory, // explain what this is and run the wizard @@ -3620,7 +3615,12 @@ bool GUI_App::check_updates(const bool invoked_by_user) PresetUpdater::UpdateResult updater_result; try { preset_updater->update_index_db(); - updater_result = preset_updater->config_update(app_config->orig_version(), invoked_by_user ? PresetUpdater::UpdateParams::SHOW_TEXT_BOX : PresetUpdater::UpdateParams::SHOW_NOTIFICATION, plater()->get_preset_archive_database()->get_selected_archive_repositories()); + //y15 + Plater* hasplater = plater(); + if (hasplater == NULL) + updater_result == PresetUpdater::R_INCOMPAT_EXIT; + else + updater_result = preset_updater->config_update(app_config->orig_version(), invoked_by_user ? PresetUpdater::UpdateParams::SHOW_TEXT_BOX : PresetUpdater::UpdateParams::SHOW_NOTIFICATION, plater()->get_preset_archive_database()->get_selected_archive_repositories()); if (updater_result == PresetUpdater::R_INCOMPAT_EXIT) { mainframe->Close(); // Applicaiton is closing. @@ -3750,6 +3750,7 @@ void GUI_App::associate_stl_files() associate_file_type(L".stl", L"QIDI.Slicer.1", L"QIDISlicer", true); } +//Y void GUI_App::associate_step_files() { associate_file_type(L".step", L"QIDI.Slicer.1", L"QIDISlicer", true); @@ -4229,6 +4230,7 @@ void GUI_App::handle_connect_request_printer_select_inner(const std::string & ms select_filament_from_connect(msg); } +//y15 //void GUI_App::show_printer_webview_tab() //{ // mainframe->show_printer_webview_tab(preset_bundle->physical_printers.get_selected_printer_config()); diff --git a/src/slic3r/GUI/GUI_App.hpp b/src/slic3r/GUI/GUI_App.hpp index 8f0c60f..dbe0a4c 100644 --- a/src/slic3r/GUI/GUI_App.hpp +++ b/src/slic3r/GUI/GUI_App.hpp @@ -114,7 +114,7 @@ class ConfigWizard; static wxString dots("…", wxConvUTF8); // Does our wxWidgets version support markup? -// https://github.com/qidi3d/QIDISlicer/issues/4282#issuecomment-634676371 +// https://github.com/QIDITECH/QIDISlicer/issues/4282#issuecomment-634676371 #if wxUSE_MARKUP && wxCHECK_VERSION(3, 1, 1) #define SUPPORTS_MARKUP #endif @@ -122,7 +122,7 @@ static wxString dots("…", wxConvUTF8); // A wrapper class to allow ignoring some known warnings // and not bothering users with redundant messages. -// see https://github.com/qidi3d/QIDISlicer/issues/12920 +// see https://github.com/QIDITECH/QIDISlicer/issues/12920 class LogGui : public wxLogGui { protected: @@ -235,6 +235,7 @@ public: // Process command line parameters cached in this->init_params, // load configs, STLs etc. void post_init(); + //y void shutdown(); // If formatted for github, plaintext with OpenGL extensions enclosed into
. // Otherwise HTML formatted for the system info dialog. @@ -278,7 +279,7 @@ public: std::vector get_mode_palette(); void set_mode_palette(const std::vector &palette); -// #ifdef _WIN32 +//#ifdef _WIN32 const wxColour& get_label_highlight_clr() { return m_color_highlight_label_default; } const wxColour& get_highlight_default_clr() { return m_color_highlight_default; } //B10 @@ -289,7 +290,7 @@ public: #ifdef _MSW_DARK_MODE void force_menu_update(); #endif //_MSW_DARK_MODE -// #endif +//#endif //B64 #if QDT_RELEASE_TO_PUBLIC std::vector get_devices() { return m_devices; }; @@ -302,6 +303,7 @@ public: const wxFont& code_font() { return m_code_font; } const wxFont& link_font() { return m_link_font; } int em_unit() const { return m_em_unit; } + //y bool tabs_as_menu() const; bool suppress_round_corners() const; wxSize get_min_size(wxWindow* display_win) const; @@ -443,7 +445,7 @@ public: void open_wifi_config_dialog(bool forced, const wxString& drive_path = {}); bool get_wifi_config_dialog_shown() const { return m_wifi_config_dialog_shown; } - + //y3 void setExitHost(std::set exit_host) { m_exit_host = exit_host; }; std::set getExitHost() { return m_exit_host; }; @@ -459,6 +461,7 @@ public: void select_filament_from_connect(const std::string& cmd); void handle_connect_request_printer_select(const std::string& cmd); void handle_connect_request_printer_select_inner(const std::string& cmd); + //y // void show_printer_webview_tab(); // return true if preset vas invisible and we have to installed it to make it selectable bool select_printer_preset(const Preset* printer_preset); diff --git a/src/slic3r/GUI/GUI_Init.cpp b/src/slic3r/GUI/GUI_Init.cpp index 3f97970..6008de6 100644 --- a/src/slic3r/GUI/GUI_Init.cpp +++ b/src/slic3r/GUI/GUI_Init.cpp @@ -23,6 +23,7 @@ #include #include #include + #if __APPLE__ #include #endif // __APPLE__ diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index 75012f6..d53fc55 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -100,7 +100,7 @@ ObjectList::ObjectList(wxWindow* parent) : // detect the current mouse position here, to pass it to list_manipulation() method // if we detect it later, the user may have moved the mouse pointer while calculations are performed, and this would mess-up the HitTest() call performed into list_manipulation() - // see: https://github.com/qidi3d/QIDISlicer/issues/3802 + // see: https://github.com/QIDITECH/QIDISlicer/issues/3802 #ifndef __WXOSX__ const wxPoint mouse_pos = this->get_mouse_position_in_control(); #endif @@ -109,7 +109,7 @@ ObjectList::ObjectList(wxWindow* parent) : // On Windows and Linux: // It's not invoked KillFocus event for "temporary" panels (like "Manipulation panel", "Settings", "Layer ranges"), // if we change selection in object list. - // see https://github.com/qidi3d/QIDISlicer/issues/3303 + // see https://github.com/QIDITECH/QIDISlicer/issues/3303 // But, if we call SetFocus() for ObjectList it will cause an invoking of a KillFocus event for "temporary" panels this->SetFocus(); #else @@ -949,7 +949,6 @@ void ObjectList::list_manipulation(const wxPoint& mouse_pos, bool evt_context_me { // Interesting fact: when mouse_pos.x < 0, HitTest(mouse_pos, item, col) returns item = null, but column = last column. // So, when mouse was moved to scene immediately after clicking in ObjectList, in the scene will be shown context menu for the Editing column. - // see: https://github.com/qidi3d/QIDISlicer/issues/3802 if (mouse_pos.x < 0) return; @@ -2489,7 +2488,7 @@ bool ObjectList::has_selected_cut_object() const for (wxDataViewItem item : sels) { const int obj_idx = m_objects_model->GetObjectIdByItem(item); - // ys_FIXME: The obj_idx= 0 && obj_idx < int(m_objects->size()) && object(obj_idx)->is_cut()) return true; @@ -3663,7 +3662,6 @@ void ObjectList::update_selections() sels.Add(m_objects_model->GetItemByInstanceId(selection.get_object_idx(), selection.get_instance_idx())); // Can be the case, when we have selected itSettings | itLayerRoot | itLayer in the ObjectList and selected object/instance in the Scene // and then select some object/instance in 3DScene using Ctrt+left click - // see https://github.com/qidi3d/QIDISlicer/issues/5517 else { // Unselect all items in ObjectList m_last_selected_item = wxDataViewItem(nullptr); diff --git a/src/slic3r/GUI/GUI_Preview.cpp b/src/slic3r/GUI/GUI_Preview.cpp index 31fd2b4..74a209c 100644 --- a/src/slic3r/GUI/GUI_Preview.cpp +++ b/src/slic3r/GUI/GUI_Preview.cpp @@ -22,7 +22,7 @@ #include #include -#include +#include // IWYU pragma: keep #include #include #include @@ -974,7 +974,7 @@ void Preview::load_print_as_fff(bool keep_z_range) m_moves_slider->Show(gcode_preview_data_valid && !zs.empty()); if (!zs.empty() && !m_keep_current_preview_type) { - unsigned int number_extruders = wxGetApp().is_editor() ? + const unsigned int number_extruders = wxGetApp().is_editor() ? (unsigned int)print->extruders().size() : m_canvas->get_gcode_extruders_count(); const bool contains_color_gcodes = std::any_of(std::begin(color_print_values), std::end(color_print_values), [](auto const& item) { return item.type == CustomGCode::Type::ColorChange || item.type == CustomGCode::Type::ToolChange; }); diff --git a/src/slic3r/GUI/Gizmos/GLGizmoCut.cpp b/src/slic3r/GUI/Gizmos/GLGizmoCut.cpp index 2864e83..8dcb945 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoCut.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoCut.cpp @@ -1893,7 +1893,7 @@ GLGizmoCut3D::PartSelection::PartSelection(const ModelObject* mo, const Transfor // split to parts for (int id = int(volumes.size())-1; id >= 0; id--) - if (volumes[id]->is_splittable() && volumes[id]->is_model_part()) + if (volumes[id]->is_splittable() && volumes[id]->is_model_part()) // we have to split just solid volumes volumes[id]->split(1); m_parts.clear(); @@ -2284,7 +2284,7 @@ void GLGizmoCut3D::render_connectors_input_window(CutConnectors &connectors) ImGui::AlignTextToFramePadding(); ImGuiPureWrap::text_colored(ImGuiPureWrap::COL_BLUE_LIGHT, m_labels_map["Connectors"]); - + m_imgui->disabled_begin(connectors.empty()); ImGui::SameLine(m_label_width); const wxString act_name = _L("Remove connectors"); diff --git a/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp b/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp index 1c87719..f287de4 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp @@ -334,7 +334,6 @@ GLGizmoEmboss::GLGizmoEmboss(GLCanvas3D &parent) //B34 void GLGizmoEmboss::create_volume(ModelVolumeType volume_type, const Vec2d &mouse_pos, std::string str) { - if (!init_create(volume_type)) return ; @@ -351,11 +350,10 @@ void GLGizmoEmboss::create_volume(ModelVolumeType volume_type, const Vec2d &mous m_style_manager.get_style().projection.depth = print_config->get_abs_value("layer_height"); DataBasePtr base = create_emboss_data_base(str, m_style_manager, m_text_lines, m_parent.get_selection(), volume_type, m_job_cancel); - CreateVolumeParams input = create_input(m_parent, m_style_manager.get_style(), m_raycast_manager, volume_type); - - start_create_volume_without_position(input, std::move(base)); - + //w43 + CreateVolumeParams input = create_input(volume_type, str); + start_create_volume_without_position(input); } bool GLGizmoEmboss::create_volume(ModelVolumeType volume_type, const Vec2d& mouse_pos) @@ -391,6 +389,21 @@ CreateVolumeParams GLGizmoEmboss::create_input(ModelVolumeType volume_type) plater->get_ui_job_worker(), volume_type, m_raycast_manager, gizmo, gl_volume, style.distance, style.angle}; } +//w43 +CreateVolumeParams GLGizmoEmboss::create_input(ModelVolumeType volume_type ,const std::string num_text) +{ + // NOTE: change style manager - be carefull with order changes + DataBasePtr base = create_emboss_data_base(num_text, m_style_manager, m_text_lines, + m_parent.get_selection(), volume_type, m_job_cancel); + + const StyleManager::Style &style = m_style_manager.get_style(); + auto gizmo = static_cast(GLGizmosManager::Emboss); + const GLVolume *gl_volume = get_first_hovered_gl_volume(m_parent); + Plater *plater = wxGetApp().plater(); + return CreateVolumeParams{std::move(base), m_parent, plater->get_camera(), plater->build_volume(), + plater->get_ui_job_worker(), volume_type, m_raycast_manager, gizmo, gl_volume, style.distance, style.angle}; +} + void GLGizmoEmboss::on_shortcut_key() { set_volume_by_selection(); if (m_volume == nullptr) { diff --git a/src/slic3r/GUI/Gizmos/GLGizmoEmboss.hpp b/src/slic3r/GUI/Gizmos/GLGizmoEmboss.hpp index 552ad32..15283ff 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoEmboss.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoEmboss.hpp @@ -52,8 +52,6 @@ public: /// /// Object part / Negative volume / Modifier bool create_volume(ModelVolumeType volume_type); - //B34 - void change_height(double height); /// /// Handle pressing of shortcut @@ -190,7 +188,9 @@ private: // initialize data for create volume in job Emboss::CreateVolumeParams create_input(ModelVolumeType volume_type); - // Emboss::CreateVolumeParams create_input(GLCanvas3D &canvas, const StyleManager::Style &style, RaycastManager &raycaster, ModelVolumeType volume_type); + + //w43 + Emboss::CreateVolumeParams create_input(ModelVolumeType volume_type, const std::string num_text); struct GuiCfg; std::unique_ptr m_gui_cfg; diff --git a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp index 1c903e5..4926043 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp @@ -34,7 +34,7 @@ namespace Slic3r { namespace GUI { -const float GLGizmosManager::Default_Icons_Size = 52;// 64; +const float GLGizmosManager::Default_Icons_Size = 64; GLGizmosManager::GLGizmosManager(GLCanvas3D& parent) : m_parent(parent) @@ -836,10 +836,9 @@ void GLGizmosManager::do_render_overlay() const const unsigned int sprite_id = gizmo->get_sprite_id(); // higlighted state needs to be decided first so its highlighting in every other state - // const int icon_idx = (m_highlight.first == idx ? (m_highlight.second ? 4 : 5) : (m_current == idx) ? /*2*/1 : ((m_hover == idx) ? 1 : (gizmo->is_activable() ? 0 : 3))); //y14 const int icon_idx = (m_highlight.first == idx ? (m_highlight.second ? 4 : 5) : (m_current == idx) ? 2 : ((m_hover == idx) ? 1 : (gizmo->is_activable() ? 0 : 3))); - + const float u_left = u_offset + icon_idx * du; const float u_right = u_left + du - u_offset; const float v_top = v_offset + sprite_id * dv; diff --git a/src/slic3r/GUI/Gizmos/GLGizmosManager.hpp b/src/slic3r/GUI/Gizmos/GLGizmosManager.hpp index 632c455..c6285ee 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmosManager.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmosManager.hpp @@ -90,8 +90,8 @@ private: float scale{ 1.0f }; float icons_size{ Default_Icons_Size }; float border{ 5.0f }; - float gap_x{ 15.0f }; - float gap_y{ 15.0f }; + float gap_x{ 5.0f }; + float gap_y{ 5.0f }; float stride_y() const { return icons_size + gap_y;} diff --git a/src/slic3r/GUI/HintNotification.cpp b/src/slic3r/GUI/HintNotification.cpp index 7296ba7..7010fe1 100644 --- a/src/slic3r/GUI/HintNotification.cpp +++ b/src/slic3r/GUI/HintNotification.cpp @@ -282,7 +282,6 @@ bool tags_check(const std::string& disabled_tags, const std::string& enabled_tag } void launch_browser_if_allowed(const std::string& url) { - return; wxGetApp().open_browser_with_warning_dialog(url); } } //namespace @@ -574,12 +573,11 @@ void NotificationManager::HintNotification::count_spaces() // no left button picture //m_left_indentation = m_line_height; - //Y4 - /*if (m_documentation_link.empty()) + + if (m_documentation_link.empty()) m_window_width_offset = m_left_indentation + m_line_height * 3.f; else - m_window_width_offset = m_left_indentation + m_line_height * 5.5f;*/ - m_window_width_offset = m_left_indentation + m_line_height * 3.f; + m_window_width_offset = m_left_indentation + m_line_height * 5.5f; m_window_width = m_line_height * 25; } @@ -754,6 +752,8 @@ bool NotificationManager::HintNotification::on_text_click() void NotificationManager::HintNotification::render_text(const float win_size_x, const float win_size_y, const float win_pos_x, const float win_pos_y) { + //y15 + count_lines(); if (!m_has_hint_data) { retrieve_data(); } @@ -885,11 +885,10 @@ void NotificationManager::HintNotification::render_close_button(const float win_ //render_right_arrow_button(imgui, win_size_x, win_size_y, win_pos_x, win_pos_y); render_logo(win_size_x, win_size_y, win_pos_x, win_pos_y); render_preferences_button(win_pos_x, win_pos_y); - //Y4 - /*if (!m_documentation_link.empty() && !wxGetApp().app_config->get_bool("suppress_hyperlinks")) + if (!m_documentation_link.empty() && !wxGetApp().app_config->get_bool("suppress_hyperlinks")) { - render_documentation_button(imgui, win_size_x, win_size_y, win_pos_x, win_pos_y); - }*/ + render_documentation_button(win_size_x, win_size_y, win_pos_x, win_pos_y); + } } diff --git a/src/slic3r/GUI/ImGuiDoubleSlider.hpp b/src/slic3r/GUI/ImGuiDoubleSlider.hpp index cbc8590..5458195 100644 --- a/src/slic3r/GUI/ImGuiDoubleSlider.hpp +++ b/src/slic3r/GUI/ImGuiDoubleSlider.hpp @@ -1,4 +1,3 @@ - #ifndef slic3r_ImGUI_DoubleSlider_hpp_ #define slic3r_ImGUI_DoubleSlider_hpp_ diff --git a/src/slic3r/GUI/ImGuiPureWrap.cpp b/src/slic3r/GUI/ImGuiPureWrap.cpp index 0452d9c..07ae057 100644 --- a/src/slic3r/GUI/ImGuiPureWrap.cpp +++ b/src/slic3r/GUI/ImGuiPureWrap.cpp @@ -1,4 +1,3 @@ - #include "ImGuiPureWrap.hpp" #include diff --git a/src/slic3r/GUI/ImGuiPureWrap.hpp b/src/slic3r/GUI/ImGuiPureWrap.hpp index 2ef3bad..570a810 100644 --- a/src/slic3r/GUI/ImGuiPureWrap.hpp +++ b/src/slic3r/GUI/ImGuiPureWrap.hpp @@ -1,4 +1,3 @@ - #ifndef slic3r_ImGuiPureWrap_hpp_ #define slic3r_ImGuiPureWrap_hpp_ @@ -151,15 +150,16 @@ namespace ImGuiPureWrap const ImVec4 COL_GREY_DARK = { 0.33f, 0.33f, 0.33f, 1.0f }; const ImVec4 COL_GREY_LIGHT = { 0.4f, 0.4f, 0.4f, 1.0f }; - const ImVec4 COL_ORANGE_DARK = { 0.67f, 0.36f, 0.19f, 1.0f }; - const ImVec4 COL_ORANGE_LIGHT = { 0.923f, 0.504f, 0.264f, 1.0f }; - const ImVec4 COL_BLUE_DARK = {0.017f,0.326f,0.926f,1.0f}; - const ImVec4 COL_BLUE_LIGHT = { 0.27f, 0.47f, 1.0f, 1.0f }; + const ImVec4 COL_ORANGE_DARK = { 0.67f, 0.36f, 0.19f, 1.0f }; + const ImVec4 COL_ORANGE_LIGHT = { 0.923f, 0.504f, 0.264f, 1.0f }; + //y15 + const ImVec4 COL_BLUE_DARK = {0.017f,0.326f,0.926f,1.0f}; + const ImVec4 COL_BLUE_LIGHT = { 0.27f, 0.47f, 1.0f, 1.0f }; const ImVec4 COL_WINDOW_BACKGROUND = { 0.13f, 0.13f, 0.13f, 0.8f }; const ImVec4 COL_BUTTON_BACKGROUND = COL_BLUE_DARK; const ImVec4 COL_BUTTON_HOVERED = COL_BLUE_LIGHT; const ImVec4 COL_BUTTON_ACTIVE = COL_BUTTON_HOVERED; - const ImVec4 COL_WHITE_LIGHT = { 1.0f, 1.0f, 1.0f, 1.0f }; + const ImVec4 COL_WHITE_LIGHT = { 1.0f, 1.0f, 1.0f, 1.0f }; } #endif // slic3r_ImGuiPureWrap_hpp_ diff --git a/src/slic3r/GUI/ImGuiWrapper.cpp b/src/slic3r/GUI/ImGuiWrapper.cpp index 7921791..409534c 100644 --- a/src/slic3r/GUI/ImGuiWrapper.cpp +++ b/src/slic3r/GUI/ImGuiWrapper.cpp @@ -145,22 +145,31 @@ static const std::map font_icons_large = { {ImGui::SlaViewProcessed , "sla_view_processed" }, }; +static const std::map font_icons_medium = { + //y14 + {ImGui::Lock , "lock" }, + {ImGui::LockHovered , "lock" }, + {ImGui::Unlock , "lock_open" }, + {ImGui::UnlockHovered , "lock_open_f" }, + {ImGui::DSRevert , "undo" }, + {ImGui::DSRevertHovered , "undo_f" }, + {ImGui::DSSettings , "cog" }, + {ImGui::DSSettingsHovered , "cog_f" }, + + {ImGui::ErrorTick , "error_tick" }, + {ImGui::ErrorTickHovered , "error_tick_f" }, + {ImGui::PausePrint , "pause_print" }, + {ImGui::PausePrintHovered , "pause_print_f" }, + {ImGui::EditGCode , "edit_gcode" }, + {ImGui::EditGCodeHovered , "edit_gcode_f" }, + {ImGui::RemoveTick , "colorchange_del" }, + {ImGui::RemoveTickHovered , "colorchange_del_f" }, +}; + static const std::map font_icons_extra_large = { {ImGui::ClippyMarker , "notification_clippy" }, }; -const ImVec4 ImGuiWrapper::COL_GREY_DARK = { 0.33f, 0.33f, 0.33f, 1.0f }; -const ImVec4 ImGuiWrapper::COL_GREY_LIGHT = { 0.4f, 0.4f, 0.4f, 1.0f }; -//B18 -const ImVec4 ImGuiWrapper::COL_WHITE_LIGHT = { 1.0f, 1.0f, 1.0f, 1.0f }; -const ImVec4 ImGuiWrapper::COL_BLUE_LIGHT = { 0.27f, 0.47f, 1.0f, 1.0f }; -const ImVec4 ImGuiWrapper::COL_ORANGE_DARK = { 0.67f, 0.36f, 0.19f, 1.0f }; -const ImVec4 ImGuiWrapper::COL_ORANGE_LIGHT = to_ImVec4(ColorRGBA::ORANGE()); -const ImVec4 ImGuiWrapper::COL_WINDOW_BACKGROUND = { 0.13f, 0.13f, 0.13f, 0.8f }; -const ImVec4 ImGuiWrapper::COL_BUTTON_BACKGROUND = COL_BLUE_LIGHT; -const ImVec4 ImGuiWrapper::COL_BUTTON_HOVERED = COL_BLUE_LIGHT; -const ImVec4 ImGuiWrapper::COL_BUTTON_ACTIVE = COL_BUTTON_HOVERED; - ImGuiWrapper::ImGuiWrapper() { ImGui::CreateContext(); @@ -1127,6 +1136,8 @@ void ImGuiWrapper::init_font(bool compress) builder.AddChar(ImWchar(0x2026)); // … if (s_font_cjk) { + // contains characters not in the ImGui ranges for simplified Chinese. Add them manually. + // This should no longer be needed because the following block would add them automatically. builder.AddChar(ImWchar(0x5ED3)); builder.AddChar(ImWchar(0x8F91)); } @@ -1292,7 +1303,6 @@ void ImGuiWrapper::init_style() }; // Window - //B18 style.WindowRounding = 4.0f; set_color(ImGuiCol_WindowBg, ImGuiPureWrap::COL_WINDOW_BACKGROUND); set_color(ImGuiCol_TitleBgActive, ImGuiPureWrap::COL_BLUE_DARK); @@ -1303,7 +1313,6 @@ void ImGuiWrapper::init_style() set_color(ImGuiCol_FrameBgActive, ImGuiPureWrap::COL_GREY_LIGHT); // Text selection - //B18 set_color(ImGuiCol_TextSelectedBg, ImGuiPureWrap::COL_BLUE_DARK); // Buttons @@ -1312,26 +1321,21 @@ void ImGuiWrapper::init_style() set_color(ImGuiCol_ButtonActive, ImGuiPureWrap::COL_BUTTON_ACTIVE); // Checkbox - //B18 set_color(ImGuiCol_CheckMark, ImGuiPureWrap::COL_BLUE_LIGHT); // ComboBox items - //B18 set_color(ImGuiCol_Header, ImGuiPureWrap::COL_BLUE_DARK); set_color(ImGuiCol_HeaderHovered, ImGuiPureWrap::COL_BLUE_LIGHT); set_color(ImGuiCol_HeaderActive, ImGuiPureWrap::COL_BLUE_LIGHT); // Slider - //B18 set_color(ImGuiCol_SliderGrab, ImGuiPureWrap::COL_BLUE_DARK); set_color(ImGuiCol_SliderGrabActive,ImGuiPureWrap::COL_BLUE_LIGHT); // Separator - //B18 set_color(ImGuiCol_Separator, ImGuiPureWrap::COL_BLUE_LIGHT); // Tabs - //B18 set_color(ImGuiCol_Tab, ImGuiPureWrap::COL_BLUE_DARK); set_color(ImGuiCol_TabHovered, ImGuiPureWrap::COL_BLUE_LIGHT); set_color(ImGuiCol_TabActive, ImGuiPureWrap::COL_BLUE_LIGHT); @@ -1339,7 +1343,6 @@ void ImGuiWrapper::init_style() set_color(ImGuiCol_TabUnfocusedActive, ImGuiPureWrap::COL_GREY_LIGHT); // Scrollbars - //B18 set_color(ImGuiCol_ScrollbarGrab, ImGuiPureWrap::COL_BLUE_LIGHT); set_color(ImGuiCol_ScrollbarGrabHovered,ImGuiPureWrap::COL_BLUE_LIGHT); set_color(ImGuiCol_ScrollbarGrabActive, ImGuiPureWrap::COL_BLUE_LIGHT); diff --git a/src/slic3r/GUI/ImGuiWrapper.hpp b/src/slic3r/GUI/ImGuiWrapper.hpp index eae6dcd..c831b10 100644 --- a/src/slic3r/GUI/ImGuiWrapper.hpp +++ b/src/slic3r/GUI/ImGuiWrapper.hpp @@ -116,7 +116,7 @@ public: /// Define where to draw it /// Color of polygon /// Width of polygon line - //B18 + //y static void draw(const Polygon &polygon, ImDrawList * draw_list = ImGui::GetOverlayDrawList(), ImU32 color = ImGui::GetColorU32(ImGuiPureWrap::COL_BLUE_LIGHT), @@ -128,18 +128,6 @@ public: ImFontAtlasCustomRect* GetTextureCustomRect(const wchar_t& tex_id); - static const ImVec4 COL_GREY_DARK; - static const ImVec4 COL_GREY_LIGHT; - //B18 - static const ImVec4 COL_WHITE_LIGHT; - static const ImVec4 COL_BLUE_LIGHT; - static const ImVec4 COL_ORANGE_DARK; - static const ImVec4 COL_ORANGE_LIGHT; - static const ImVec4 COL_WINDOW_BACKGROUND; - static const ImVec4 COL_BUTTON_BACKGROUND; - static const ImVec4 COL_BUTTON_HOVERED; - static const ImVec4 COL_BUTTON_ACTIVE; - private: void init_font(bool compress); void init_input(); diff --git a/src/slic3r/GUI/LibVGCode/LibVGCodeWrapper.hpp b/src/slic3r/GUI/LibVGCode/LibVGCodeWrapper.hpp index be93b10..728e333 100644 --- a/src/slic3r/GUI/LibVGCode/LibVGCodeWrapper.hpp +++ b/src/slic3r/GUI/LibVGCode/LibVGCodeWrapper.hpp @@ -1,4 +1,3 @@ - #ifndef slic3r_LibVGCodeWrapper_hpp_ #define slic3r_LibVGCodeWrapper_hpp_ diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index 37d9331..375639f 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -39,7 +39,7 @@ #include "Plater.hpp" #include "../Utils/Process.hpp" #include "format.hpp" -#include "slic3r/GUI/InstanceCheck.hpp" +#include "slic3r/GUI/InstanceCheck.hpp" // IWYU pragma: keep #include #include @@ -74,10 +74,6 @@ #endif namespace Slic3r { namespace GUI { -wxDEFINE_EVENT(EVT_LOAD_URL, wxCommandEvent); -wxDEFINE_EVENT(EVT_LOAD_PRINTER_URL, wxCommandEvent); - - enum class ERescaleTarget { @@ -270,8 +266,10 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S event.Veto(); return; } - //B64 - m_printer_view->StopStatusThread(); + + //B64//y15 + if (!wxGetApp().is_gcode_viewer()) + m_printer_view->StopStatusThread(); this->shutdown(); // propagate event event.Skip(); @@ -377,7 +375,6 @@ void MainFrame::update_layout() ESettingsLayout layout = wxGetApp().is_gcode_viewer() ? ESettingsLayout::GCodeViewer : (wxGetApp().app_config->get_bool("old_settings_layout_mode") ? ESettingsLayout::Old : - // wxGetApp().app_config->get_bool("new_settings_layout_mode") ? ( wxGetApp().tabs_as_menu() ? ESettingsLayout::Old : ESettingsLayout::New) : wxGetApp().app_config->get_bool("dlg_settings_layout_mode") ? ESettingsLayout::Dlg : ESettingsLayout::Old); if (m_layout == layout) @@ -520,7 +517,6 @@ void MainFrame::shutdown() m_plater->unbind_canvas_event_handlers(); // Cleanup of canvases' volumes needs to be done here or a crash may happen on some Linux Debian flavours - // see: https://github.com/qidi3d/QIDISlicer/issues/3964 m_plater->reset_canvas_volumes(); } @@ -605,12 +601,73 @@ void MainFrame::update_title() title += wxString(build_id); if (wxGetApp().is_editor()) - //B8 - title += (" "); + title += (" " + _L("based on Slic3r")); SetTitle(title); } +static wxString GetTooltipForSettingsButton(PrinterTechnology pt) +{ + std::string tooltip = _u8L("Switch to Settings") + "\n" + "[" + shortkey_ctrl_prefix() + "2] - " + _u8L("Print Settings Tab") + + "\n" + "[" + shortkey_ctrl_prefix() + "3] - " + (pt == ptFFF ? _u8L("Filament Settings Tab") : _u8L("Material Settings Tab")) + + "\n" + "[" + shortkey_ctrl_prefix() + "4] - " + _u8L("Printer Settings Tab"); + return from_u8(tooltip); +} + +void MainFrame::update_topbars() +{ + if (wxGetApp().is_gcode_viewer()) + return; + + const bool show_login = !wxGetApp().app_config->has("show_login_button") || wxGetApp().app_config->get_bool("show_login_button"); + m_tmp_top_bar->ShowUserAccount(show_login); + m_tabpanel->ShowUserAccount(show_login); + + if (!show_login) { + if (auto user_account = wxGetApp().plater()->get_user_account(); + user_account && user_account->is_logged()) + user_account->do_logout(); + } +} + +void MainFrame::set_callbacks_for_topbar_menus() +{ + m_bar_menus.set_workspaces_menu_callbacks( + []() -> int { return wxGetApp().get_mode(); }, + [](/*ConfigOptionMode*/int mode) -> void { wxGetApp().save_mode(mode); }, + [](/*ConfigOptionMode*/int mode) -> std::string { return wxGetApp().get_mode_btn_color(mode); } + ); + + m_bar_menus.set_account_menu_callbacks( + []() -> void { wxGetApp().plater()->act_with_user_account(); }, + [this]() -> void { + wxString preferences_item = _L("Show Log in button in application top bar"); + wxString msg = + _L("QIDISlicer will remember your choice.") + "\n\n" + + format_wxstr(_L("Visit \"Preferences\" and check \"%1%\"\nto changes your choice."), preferences_item); + + MessageDialog msg_dlg(this, msg, _L("QIDISlicer: Don't ask me again"), wxOK | wxCANCEL | wxICON_INFORMATION); + if (msg_dlg.ShowModal() == wxID_OK) { + wxGetApp().app_config->set("show_login_button", "0"); + + m_bar_menus.RemoveHideLoginItem(); + update_topbars(); + } + }, + []() -> TopBarMenus::UserAccountInfo { + if (auto user_account = wxGetApp().plater()->get_user_account()) + return { user_account->is_logged(), + user_account->get_username(), + user_account->get_avatar_path(true) }; + return TopBarMenus::UserAccountInfo(); + } + ); + + // we need "Hide Log in button" menu item only till "show_login_button" wasn't changed + if (wxGetApp().app_config->has("show_login_button")) + m_bar_menus.RemoveHideLoginItem(); +} + void MainFrame::init_tabpanel() { wxGetApp().update_ui_colours_from_appconfig(); @@ -645,6 +702,7 @@ void MainFrame::init_tabpanel() size_t current_selected_tab = m_tabpanel->GetSelection(); Tab* tab = dynamic_cast(panel); + //y15 if (tab != nullptr) { // There shouldn't be a case, when we try to select a tab, which doesn't support a printer technology @@ -837,7 +895,6 @@ void MainFrame::remove_connect_webview_tab() void MainFrame::show_printer_webview_tab(DynamicPrintConfig* dpc) { -#if 0 // if physical printer is selected if (dpc && dpc->option>("host_type")->value != htQIDIConnect) { std::string url = dpc->opt_string("print_host"); @@ -867,7 +924,6 @@ void MainFrame::show_printer_webview_tab(DynamicPrintConfig* dpc) select_tab(size_t(0)); remove_printer_webview_tab(); } -#endif } void MainFrame::add_printer_webview_tab(const wxString& url) @@ -921,6 +977,7 @@ void MainFrame::set_printer_webview_credentials(const std::string& usr, const st void Slic3r::GUI::MainFrame::refresh_account_menu(bool avatar/* = false */) { // Update User name in TopBar + //y15 m_bar_menus.UpdateAccountState(avatar); m_tabpanel->GetTopBarItemsCtrl()->UpdateAccountButton(avatar); @@ -1248,16 +1305,16 @@ static wxMenu* generate_help_menu() // TRN Item from "Help" menu // append_menu_item(helpMenu, wxID_ANY, wxString::Format(_L("&Quick Start"), SLIC3R_APP_NAME), // wxString::Format(_L("Open the %s website in your browser"), SLIC3R_APP_NAME), -// [](wxCommandEvent&) { wxGetApp().open_browser_with_warning_dialog("https://help.qidi3d.com/article/first-print-with-qidislicer_1753", nullptr, false); }); +// [](wxCommandEvent&) { wxGetApp().open_browser_with_warning_dialog("https://wiki.qidi3d.com/article/first-print-with-qidislicer_1753", nullptr, false); }); // TRN Item from "Help" menu // append_menu_item(helpMenu, wxID_ANY, wxString::Format(_L("Sample &G-codes and Models"), SLIC3R_APP_NAME), // wxString::Format(_L("Open the %s website in your browser"), SLIC3R_APP_NAME), -// [](wxCommandEvent&) { wxGetApp().open_browser_with_warning_dialog("https://help.qidi3d.com/article/sample-g-codes_529630", nullptr, false); }); +// [](wxCommandEvent&) { wxGetApp().open_browser_with_warning_dialog("https://wiki.qidi3d.com/article/sample-g-codes_529630", nullptr, false); }); // helpMenu->AppendSeparator(); // append_menu_item(helpMenu, wxID_ANY, _L("QIDI 3D &Drivers"), _L("Open the QIDI3D drivers download page in your browser"), // [](wxCommandEvent&) { wxGetApp().open_web_page_localized("https://www.qidi3d.com/downloads"); }); // append_menu_item(helpMenu, wxID_ANY, _L("Software &Releases"), _L("Open the software releases page in your browser"), -// [](wxCommandEvent&) { wxGetApp().open_browser_with_warning_dialog("https://github.com/qidi3d/QIDISlicer/releases", nullptr, false); }); +// [](wxCommandEvent&) { wxGetApp().open_browser_with_warning_dialog("https://github.com/QIDITECH/QIDISlicer/releases", nullptr, false); }); //# my $versioncheck = $self->_append_menu_item($helpMenu, "Check for &Updates...", "Check for new Slic3r versions", sub{ //# wxTheApp->check_version(1); //# }); @@ -1687,6 +1744,7 @@ void MainFrame::init_menubar_as_editor() m_bar_menus.AppendMenuItem(helpMenu, _L("&Help")); #else + // menubar // assign menubar to frame after appending items, otherwise special items // will not be handled correctly @@ -1770,7 +1828,7 @@ void MainFrame::init_menubar_as_gcodeviewer() [this]() {return can_export_toolpaths(); }, this); append_menu_item(fileMenu, wxID_ANY, _L("Open &QIDISlicer") + dots, _L("Open QIDISlicer"), [](wxCommandEvent&) { start_new_slicer(); }, "", nullptr, - []() {return true; }, this); + []() { return true; }, this); fileMenu->AppendSeparator(); append_menu_item(fileMenu, wxID_EXIT, _L("&Quit"), wxString::Format(_L("Quit %s"), SLIC3R_APP_NAME), [this](wxCommandEvent&) { Close(false); }); @@ -1873,50 +1931,6 @@ void MainFrame::export_config() if (dlg.ShowModal() == wxID_OK) file = dlg.GetPath(); if (!file.IsEmpty()) { -//#if wxUSE_SECRETSTORE -// bool passwords_to_plain = false; -// bool passwords_dialog_shown = false; -//#endif -// // callback function thats going to be passed to preset bundle (so preset bundle doesnt have to include WX secret lib) -// std::function load_password = [&](const std::string& printer_id, const std::string& opt, std::string& out_psswd)->bool{ -// out_psswd = std::string(); -//#if wxUSE_SECRETSTORE -// // First password prompts user with dialog -// if (!passwords_dialog_shown) { -// wxString msg = _L("Some of the exported printers contain passwords, which are stored in the system password store." -// " Do you want to include the passwords in the plain text form in the exported file?"); -// MessageDialog dlg_psswd(this, msg, wxMessageBoxCaptionStr, wxYES_NO | wxYES_DEFAULT | wxICON_QUESTION); -// if (dlg_psswd.ShowModal() == wxID_YES) -// passwords_to_plain = true; -// passwords_dialog_shown = true; -// } -// if (!passwords_to_plain) -// return false; -// wxSecretStore store = wxSecretStore::GetDefault(); -// wxString errmsg; -// if (!store.IsOk(&errmsg)) { -// std::string msg = GUI::format("%1% (%2%).", _u8L("Failed to load credentials from the system password store."), errmsg); -// BOOST_LOG_TRIVIAL(error) << msg; -// show_error(nullptr, msg); -// // Do not try again. System store is not reachable. -// passwords_to_plain = false; -// return false; -// } -// const wxString service = GUI::format_wxstr(L"%1%/PhysicalPrinter/%2%/%3%", SLIC3R_APP_NAME, printer_id, opt); -// wxString username; -// wxSecretValue password; -// if (!store.Load(service, username, password)) { -// std::string msg = GUI::format(_u8L("Failed to load credentials from the system password store for printer %1%."), printer_id); -// BOOST_LOG_TRIVIAL(error) << msg; -// show_error(nullptr, msg); -// return false; -// } -// out_psswd = into_u8(password.GetAsString()); -// return true; -//#else -// return false; -//#endif // wxUSE_SECRETSTORE -// }; wxGetApp().app_config->update_config_dir(get_dir_name(file)); m_last_config = file; config.save(file.ToUTF8().data()); @@ -2148,55 +2162,15 @@ void MainFrame::select_tab(size_t tab/* = size_t(-1)*/) // Controls on page are created on active page of active tab now. // We should select/activate tab before its showing to avoid an UI-flickering - //B45 - auto select = [this, tab](bool was_hidden) { // when tab == -1, it means we should show the last selected tab size_t new_selection = tab == (size_t)(-1) ? m_last_selected_tab : (m_layout == ESettingsLayout::Dlg && tab != 0) ? tab - 1 : tab; - //B4 //B64 + // B30 if (m_tabpanel->GetSelection() == 4) { - PresetBundle &preset_bundle = *wxGetApp().preset_bundle; - PhysicalPrinterCollection &ph_printers = preset_bundle.physical_printers; - - std::vector vec1; - std::vector vec2; - for (PhysicalPrinterCollection::ConstIterator it = ph_printers.begin(); it != ph_printers.end(); ++it) { - for (const std::string &preset_name : it->get_preset_names()) { - - std::string full_name = it->get_full_name(preset_name); - vec1.push_back(full_name); - } - } - - for (DeviceButton *button : m_printer_view->GetButton()) { - vec2.push_back(button->GetLabel().ToStdString()); - } - - bool result1 = std::equal(vec1.begin(), vec1.end(), vec2.begin(), vec2.end()); - vec1.clear(); - vec2.clear(); -//#if QDT_RELEASE_TO_PUBLIC -// wxString msg; -// QIDINetwork m_qidinetwork; -// m_qidinetwork.get_device_list(msg); -// auto m_devices = wxGetApp().get_devices(); -// for (const auto &device : m_devices) { -// vec1.push_back(device.device_name); -// } -// for (DeviceButton *button : m_printer_view->GetNetButton()) { -// vec2.push_back(button->GetLabel().ToStdString()); - //} -// bool result2 = std::equal(vec1.begin(), vec1.end(), vec2.begin(), vec2.end()); -//#endif - bool result2 = true; - // m_printer_view->SetPresetChanged(!result1 || !result2); - - //B64 m_printer_view->SetPauseThread(false); m_printer_view->Layout(); } - // B30 - if (m_tabpanel->GetSelection() != (int) new_selection) + if (m_tabpanel->GetSelection() != (int)new_selection) m_tabpanel->SetSelection(new_selection); if (tab == 0 && m_layout == ESettingsLayout::Old) @@ -2394,6 +2368,7 @@ SettingsDialog::SettingsDialog(MainFrame* mainframe) case '2': { m_main_frame->select_tab(1); break; } case '3': { m_main_frame->select_tab(2); break; } case '4': { m_main_frame->select_tab(3); break; } + //y15 case '5': { m_main_frame->select_tab(4); break; } case '6': { m_main_frame->select_tab(5); break; } #ifdef __APPLE__ diff --git a/src/slic3r/GUI/MainFrame.hpp b/src/slic3r/GUI/MainFrame.hpp index ccbee8c..1e11786 100644 --- a/src/slic3r/GUI/MainFrame.hpp +++ b/src/slic3r/GUI/MainFrame.hpp @@ -139,7 +139,6 @@ class MainFrame : public DPIFrame { Unknown, Old, - New, Dlg, GCodeViewer }; @@ -225,20 +224,21 @@ public: void refresh_account_menu(bool avatar = false); - PrintHostQueueDialog *printhost_queue_dlg() { return m_printhost_queue_dlg; } + PrintHostQueueDialog* printhost_queue_dlg() { return m_printhost_queue_dlg; } - Plater *m_plater{nullptr}; - FRF_Calibration_Dlg *m_frf_calib_dlg{nullptr}; + Plater* m_plater { nullptr }; //B34 - PA_Calibration_Dlg *m_pa_calib_dlg{nullptr}; - MVS_Calibration_Dlg *m_mvs_calib_dlg{nullptr}; + FRF_Calibration_Dlg* m_frf_calib_dlg{nullptr}; + //B34 + PA_Calibration_Dlg* m_pa_calib_dlg{nullptr}; + MVS_Calibration_Dlg* m_mvs_calib_dlg{nullptr}; //B4 wxString tem_host; - PrinterWebView * m_printer_view{nullptr}; + PrinterWebView* m_printer_view{nullptr}; //B28 - GuideWebView * m_guide_view{nullptr}; + GuideWebView* m_guide_view{nullptr}; //B45 - PresetCollection *m_collection{nullptr}; + PresetCollection* m_collection{nullptr}; TopBar* m_tmp_top_bar { nullptr }; TopBar* m_tabpanel { nullptr }; diff --git a/src/slic3r/GUI/MsgDialog.cpp b/src/slic3r/GUI/MsgDialog.cpp index 86327e2..6aa9fd0 100644 --- a/src/slic3r/GUI/MsgDialog.cpp +++ b/src/slic3r/GUI/MsgDialog.cpp @@ -75,9 +75,7 @@ MsgDialog::MsgDialog(wxWindow *parent, const wxString &title, const wxString &he main_sizer->Add(topsizer, 1, wxEXPAND); main_sizer->Add(new StaticLine(this), 0, wxEXPAND | wxLEFT | wxRIGHT, HORIZ_SPACING); main_sizer->Add(btn_sizer, 0, wxALL | wxEXPAND, VERT_SPACING); - //B50 - // if (style & wxOK) - // add_button(wxID_OK, true); + //B61 if (title != "App Update available" and title != _L("Send G-Code to printer host")) { apply_style(style); @@ -114,7 +112,6 @@ wxButton* MsgDialog::get_button(wxWindowID btn_id){ return static_cast(FindWindowById(btn_id, this)); } -//B44 void MsgDialog::apply_style(long style) { if (style & wxOK) add_button(wxID_OK, true); @@ -211,13 +208,6 @@ static void add_msg_content(MsgDialog* parent, wxBoxSizer* content_sizer, const if (content.is_monospaced_font) // Code formatting will be preserved. This is useful for reporting errors from the placeholder parser. msg_escaped = std::string("
") + msg_escaped + "
"; -//Y - bool is_that_msg = false; - std::string that_msg; - that_msg = msg_escaped.substr(0, 46); - if (that_msg == "Downloading QIDISlicer version file has failed") - is_that_msg = true; - bool is_errort = false;//priv::http_get_file(); html->SetPage(format_wxstr("" "" "" @@ -247,8 +237,8 @@ void ErrorDialog::create(const HtmlContent& content, int icon_width) { add_msg_content(this, content_sizer, content); - // Use a small bitmap with monospaced font, as the error text will not be wrapped. - logo->SetBitmap(*get_bmp_bundle("QIDISlicer_192px_grayscale.png", icon_width)); + // Use a small bitmap with monospaced font, as the error text will not be wrapped. + logo->SetBitmap(*get_bmp_bundle("QIDISlicer_192px_grayscale.png", icon_width)); SetMaxSize(wxSize(-1, CONTENT_MAX_HEIGHT*wxGetApp().em_unit())); diff --git a/src/slic3r/GUI/Notebook.cpp b/src/slic3r/GUI/Notebook.cpp index 720f973..b333365 100644 --- a/src/slic3r/GUI/Notebook.cpp +++ b/src/slic3r/GUI/Notebook.cpp @@ -1,3 +1,7 @@ +///|/ Copyright (c) Prusa Research 2021 - 2022 Oleksandra Iushchenko @YuSanka, Lukáš Hejl @hejllukas +///|/ +///|/ PrusaSlicer is released under the terms of the AGPLv3 or higher +///|/ #include "Notebook.hpp" #ifdef _WIN32 @@ -41,7 +45,6 @@ void ButtonsListCtrl::OnPaint(wxPaintEvent&) const wxColour& selected_btn_bg = Slic3r::GUI::wxGetApp().get_color_selected_btn_bg(); // B10 - // const wxColour& default_btn_bg = Slic3r::GUI::wxGetApp().get_color_hovered_btn_label(); const wxColour& default_btn_bg = Slic3r::GUI::wxGetApp().get_tap_highlight_default_clr(); const wxColour& btn_marker_color = Slic3r::GUI::wxGetApp().get_color_hovered_btn_label(); diff --git a/src/slic3r/GUI/NotificationManager.cpp b/src/slic3r/GUI/NotificationManager.cpp index fbc8f70..753bf77 100644 --- a/src/slic3r/GUI/NotificationManager.cpp +++ b/src/slic3r/GUI/NotificationManager.cpp @@ -7,7 +7,7 @@ #include "wxExtensions.hpp" #include "ObjectDataViewModel.hpp" #include "libslic3r/Config.hpp" -#include "slic3r/Utils/PrintHost.hpp" +#include "slic3r/Utils/PrintHost.hpp" // IWYU pragma: keep #include "libslic3r/Config.hpp" #include "format.hpp" @@ -243,7 +243,7 @@ bool NotificationManager::PopNotification::push_background_color() return true; } if (m_data.level == NotificationLevel::ErrorNotificationLevel) { - // ImVec4 backcolor = ImGui::GetStyleColorVec4(ImGuiCol_WindowBg); + //B18 ImVec4 backcolor(0.27f, 0.47f, 1.0f, 0.5f); backcolor.x += 0.73f; backcolor.y -= 0.47f; @@ -252,7 +252,7 @@ bool NotificationManager::PopNotification::push_background_color() return true; } if (m_data.level == NotificationLevel::WarningNotificationLevel) { - // ImVec4 backcolor = ImGui::GetStyleColorVec4(ImGuiCol_WindowBg); + //B18 ImVec4 backcolor(0.27f, 0.47f, 1.0f, 0.5f); backcolor.x += 0.73f; backcolor.y += 0.03f; diff --git a/src/slic3r/GUI/NotificationManager.hpp b/src/slic3r/GUI/NotificationManager.hpp index 571c626..c0937bf 100644 --- a/src/slic3r/GUI/NotificationManager.hpp +++ b/src/slic3r/GUI/NotificationManager.hpp @@ -336,6 +336,7 @@ private: Finished, // Requesting Render Hovered, // Followed by Shown Paused, + //y Exporting }; @@ -923,7 +924,8 @@ private: {NotificationType::URLNotRegistered , NotificationLevel::RegularNotificationLevel , 10 - , _u8L("QIDISlicer recieved a download request from Printables.com, but it's not allowed. You can allow it") + // TRN: The text is followed by a hyperlink saying "here." It is necessary to split it in two phrases, sorry. + , _u8L("QIDISlicer received a download request from Printables.com, but it's not allowed. You can allow it") , _u8L("here.") , [](wxEvtHandler* evnthndlr) { wxGetApp().open_preferences("downloader_url_registered", "Other"); @@ -931,7 +933,7 @@ private: } }, //{NotificationType::NewAppAvailable, NotificationLevel::ImportantNotificationLevel, 20, _u8L("New version is available."), _u8L("See Releases page."), [](wxEvtHandler* evnthndlr) { - // wxGetApp().open_browser_with_warning_dialog("https://github.com/qidi3d/QIDISlicer/releases"); return true; }}, + // wxGetApp().open_browser_with_warning_dialog("https://github.com/QIDITECH/QIDISlicer/releases"); return true; }}, //{NotificationType::NewAppAvailable, NotificationLevel::ImportantNotificationLevel, 20, _u8L("New vesion of QIDISlicer is available.", _u8L("Download page.") }, //{NotificationType::LoadingFailed, NotificationLevel::RegularNotificationLevel, 20, _u8L("Loading of model has Failed") }, //{NotificationType::DeviceEjected, NotificationLevel::RegularNotificationLevel, 10, _u8L("Removable device has been safely ejected")} // if we want changeble text (like here name of device), we need to do it as CustomNotification diff --git a/src/slic3r/GUI/OG_CustomCtrl.cpp b/src/slic3r/GUI/OG_CustomCtrl.cpp index e02ae02..2868d71 100644 --- a/src/slic3r/GUI/OG_CustomCtrl.cpp +++ b/src/slic3r/GUI/OG_CustomCtrl.cpp @@ -581,7 +581,6 @@ void OG_CustomCtrl::CtrlLine::render(wxDC& dc, wxCoord v_pos) Field* field = ctrl->opt_group->get_field(og_line.get_options().front().opt_id); - const bool suppress_hyperlinks = get_app_config()->get_bool("suppress_hyperlinks"); if (draw_just_act_buttons) { if (field) { diff --git a/src/slic3r/GUI/OpenGLManager.cpp b/src/slic3r/GUI/OpenGLManager.cpp index de0ce6f..dfd71fe 100644 --- a/src/slic3r/GUI/OpenGLManager.cpp +++ b/src/slic3r/GUI/OpenGLManager.cpp @@ -383,7 +383,7 @@ bool OpenGLManager::init_gl() "while OpenGL version %s, renderer %s, vendor %s was detected."), s_gl_info.get_version_string(), s_gl_info.get_renderer(), s_gl_info.get_vendor()); #endif // SLIC3R_OPENGL_ES message += "\n"; - message += _L("You may need to update your graphics card driver."); + message += _L("You may need to update your graphics card driver."); #ifdef _WIN32 message += "\n"; message += _L("As a workaround, you may run QIDISlicer with a software rendered 3D graphics by running qidi-slicer.exe with the --sw-renderer parameter."); @@ -411,7 +411,7 @@ bool OpenGLManager::init_gl() #ifdef _WIN32 // Since AMD driver version 22.7.1, there is probably some bug in the driver that causes the issue with the missing - // texture of the bed (see: https://github.com/qidi3d/QIDISlicer/issues/8417). + // texture of the bed (see: https://github.com/QIDITECH/QIDISlicer/issues/8417). // It seems that this issue only triggers when mipmaps are generated manually // (combined with a texture compression) with texture size not being power of two. // When mipmaps are generated through OpenGL function glGenerateMipmap() the driver works fine, diff --git a/src/slic3r/GUI/OptionsGroup.cpp b/src/slic3r/GUI/OptionsGroup.cpp index 5c6680a..d1447b6 100644 --- a/src/slic3r/GUI/OptionsGroup.cpp +++ b/src/slic3r/GUI/OptionsGroup.cpp @@ -1,16 +1,15 @@ #include "OptionsGroup.hpp" #include "Search.hpp" #include "GUI_App.hpp" -#include "MainFrame.hpp" #include "OG_CustomCtrl.hpp" #include "format.hpp" #include -#include +#include // IWYU pragma: keep #include #include #include -#include "slic3r/GUI/Search.hpp" +#include "slic3r/GUI/Search.hpp" // IWYU pragma: keep #include "libslic3r/Exception.hpp" #include "libslic3r/Utils.hpp" #include "libslic3r/AppConfig.hpp" @@ -235,7 +234,8 @@ void OptionsGroup::change_opt_value(DynamicPrintConfig& config, const t_config_o config.option(opt_key)->set_at(vec_new, opt_index, 0); break; } case coPoints: { - if (opt_key == "bed_shape") { + //Y20 //B52 + if (opt_key == "bed_shape" || opt_key == "bed_exclude_area") { config.option(opt_key)->values = boost::any_cast>(value); break; } @@ -1164,7 +1164,7 @@ wxString OptionsGroup::get_url(const std::string& path_end) wxString language = wxGetApp().current_language_code_safe(); wxString lang_marker = language.IsEmpty() ? "en" : language.BeforeFirst('_'); - return wxString("https://help.qidi3d.com/") + lang_marker + wxString("/article/" + path_end); + return wxString("https://wiki.qidi3d.com/") + lang_marker + wxString("/article/" + path_end); } bool OptionsGroup::launch_browser(const std::string& path_end) diff --git a/src/slic3r/GUI/OptionsGroup.hpp b/src/slic3r/GUI/OptionsGroup.hpp index 125f225..25e0e23 100644 --- a/src/slic3r/GUI/OptionsGroup.hpp +++ b/src/slic3r/GUI/OptionsGroup.hpp @@ -112,7 +112,6 @@ public: int ctrl_horiz_alignment{ wxALIGN_LEFT}; column_t extra_column {nullptr}; t_change on_change { nullptr }; - t_change m_on_change { nullptr }; // To be called when the field loses focus, to assign a new initial value to the field. // Used by the relative position / rotation / scale manipulation fields of the Object Manipulation UI. t_kill_focus fill_empty_value { nullptr }; @@ -123,8 +122,9 @@ public: std::function rescale_extra_column_item { nullptr }; std::function rescale_near_label_widget { nullptr }; - + std::function edit_custom_gcode { nullptr }; + wxFont sidetext_font {wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT) }; wxFont label_font {wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT) }; int sidetext_width{ -1 }; diff --git a/src/slic3r/GUI/PhysicalPrinterDialog.cpp b/src/slic3r/GUI/PhysicalPrinterDialog.cpp index f13d492..d26ff3b 100644 --- a/src/slic3r/GUI/PhysicalPrinterDialog.cpp +++ b/src/slic3r/GUI/PhysicalPrinterDialog.cpp @@ -94,6 +94,7 @@ PresetForPrinter::PresetForPrinter(PhysicalPrinterDialog* parent, const std::str wxBoxSizer* preset_sizer = new wxBoxSizer(wxHORIZONTAL); preset_sizer->Add(m_presets_list , 1, wxEXPAND); + //y15 // preset_sizer->Add(m_delete_preset_btn , 0, wxEXPAND | wxLEFT, BORDER_W); wxBoxSizer* name_sizer = new wxBoxSizer(wxHORIZONTAL); @@ -107,6 +108,7 @@ PresetForPrinter::PresetForPrinter(PhysicalPrinterDialog* parent, const std::str PresetForPrinter::~PresetForPrinter() { m_presets_list->Destroy(); + //y15 // m_delete_preset_btn->Destroy(); m_info_line->Destroy(); m_full_printer_name->Destroy(); @@ -132,6 +134,7 @@ std::string PresetForPrinter::get_preset_name() void PresetForPrinter::SuppressDelete() { + //y15 //m_delete_preset_btn->Enable(false); // this case means that now we have only one related preset for the printer @@ -142,6 +145,7 @@ void PresetForPrinter::SuppressDelete() void PresetForPrinter::AllowDelete() { + //y15 //if (!m_delete_preset_btn->IsEnabled()) // m_delete_preset_btn->Enable(); @@ -152,16 +156,89 @@ void PresetForPrinter::AllowDelete() void PresetForPrinter::on_sys_color_changed() { m_presets_list->sys_color_changed(); + //y15 // m_delete_preset_btn->sys_color_changed(); } +namespace { + +bool is_secret_store_ok() +{ +#if wxUSE_SECRETSTORE + wxSecretStore store = wxSecretStore::GetDefault(); + wxString errmsg; + if (!store.IsOk(&errmsg)) { + BOOST_LOG_TRIVIAL(warning) << "wxSecretStore is not supported: " << errmsg; + return false; + } + return true; +#else + return false; +#endif +} +bool save_secret(const std::string& id, const std::string& opt, const std::string& usr, const std::string& psswd) +{ +#if wxUSE_SECRETSTORE + wxSecretStore store = wxSecretStore::GetDefault(); + wxString errmsg; + if (!store.IsOk(&errmsg)) { + std::string msg = GUI::format("%1% (%2%).", _u8L("This system doesn't support storing passwords securely"), errmsg); + BOOST_LOG_TRIVIAL(error) << msg; + show_error(nullptr, msg); + return false; + } + const wxString service = GUI::format_wxstr(L"%1%/PhysicalPrinter/%2%/%3%", SLIC3R_APP_NAME, id, opt); + const wxString username = boost::nowide::widen(usr); + const wxSecretValue password(boost::nowide::widen(psswd)); + if (!store.Save(service, username, password)) { + std::string msg(_u8L("Failed to save credentials to the system password store.")); + BOOST_LOG_TRIVIAL(error) << msg; + show_error(nullptr, msg); + return false; + } + return true; +#else + BOOST_LOG_TRIVIAL(error) << "wxUSE_SECRETSTORE not supported. Cannot save password to the system store."; + return false; +#endif // wxUSE_SECRETSTORE +} +bool load_secret(const std::string& id, const std::string& opt, std::string& usr, std::string& psswd) +{ +#if wxUSE_SECRETSTORE + wxSecretStore store = wxSecretStore::GetDefault(); + wxString errmsg; + if (!store.IsOk(&errmsg)) { + std::string msg = GUI::format("%1% (%2%).", _u8L("This system doesn't support storing passwords securely"), errmsg); + BOOST_LOG_TRIVIAL(error) << msg; + show_error(nullptr, msg); + return false; + } + const wxString service = GUI::format_wxstr(L"%1%/PhysicalPrinter/%2%/%3%", SLIC3R_APP_NAME, id, opt); + wxString username; + wxSecretValue password; + if (!store.Load(service, username, password)) { + std::string msg(_u8L("Failed to load credentials from the system password store.")); + BOOST_LOG_TRIVIAL(error) << msg; + show_error(nullptr, msg); + return false; + } + usr = into_u8(username); + psswd = into_u8(password.GetAsString()); + return true; +#else + BOOST_LOG_TRIVIAL(error) << "wxUSE_SECRETSTORE not supported. Cannot load password from the system store."; + return false; +#endif // wxUSE_SECRETSTORE +} +} + //------------------------------------------ // PhysicalPrinterDialog //------------------------------------------ //y3 -PhysicalPrinterDialog::PhysicalPrinterDialog(wxWindow *parent, wxString printer_name, std::set exit_host) : +PhysicalPrinterDialog::PhysicalPrinterDialog(wxWindow* parent, wxString printer_name, std::set exit_host) : DPIDialog(parent, wxID_ANY, _L("Physical Printer"), wxDefaultPosition, wxSize(45 * wxGetApp().em_unit(), -1), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER), m_printer("", wxGetApp().preset_bundle->physical_printers.default_config()) { @@ -177,14 +254,17 @@ PhysicalPrinterDialog::PhysicalPrinterDialog(wxWindow *parent, wxString printer_ else { std::string full_name = into_u8(printer_name); printer_name = from_u8(PhysicalPrinter::get_short_name(full_name)); + //y15 old_name = into_u8(printer_name); new_printer = false; } - + + //y15 m_exit_host = exit_host; wxStaticText* label_top = new wxStaticText(this, wxID_ANY, _L("Descriptive name for the printer") + ":"); + //y15 /* m_add_preset_btn = new ScalableButton(this, wxID_ANY, "add_copies"); m_add_preset_btn->SetFont(wxGetApp().normal_font()); m_add_preset_btn->SetToolTip(_L("Add preset for this printer device")); @@ -208,6 +288,21 @@ PhysicalPrinterDialog::PhysicalPrinterDialog(wxWindow *parent, wxString printer_ const std::set& preset_names = printer->get_preset_names(); for (const std::string& preset_name : preset_names) m_presets.emplace_back(new PresetForPrinter(this, preset_name)); +//y15 +// // "stored" indicates data are stored secretly, load them from store. +// if (m_printer.config.opt_string("printhost_password") == "stored" && m_printer.config.opt_string("printhost_password") == "stored") { +// std::string username; +// std::string password; +// if (load_secret(m_printer.name, "printhost_password", username, password)) { +// if (!username.empty()) +// m_printer.config.opt_string("printhost_user") = username; +// if (!password.empty()) +// m_printer.config.opt_string("printhost_password") = password; +// } else { +// m_printer.config.opt_string("printhost_user") = std::string(); +// m_printer.config.opt_string("printhost_password") = std::string(); +// } +// } } if (m_presets.size() == 1) @@ -229,6 +324,7 @@ PhysicalPrinterDialog::PhysicalPrinterDialog(wxWindow *parent, wxString printer_ wxBoxSizer* nameSizer = new wxBoxSizer(wxHORIZONTAL); nameSizer->Add(m_printer_name, 1, wxEXPAND); + //y15 // nameSizer->Add(m_add_preset_btn, 0, wxEXPAND | wxLEFT, BORDER_W); m_presets_sizer = new wxBoxSizer(wxVERTICAL); @@ -287,7 +383,7 @@ void PhysicalPrinterDialog::update_printers() void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgroup) { - m_optgroup->m_on_change = [this](t_config_option_key opt_key, boost::any value) { + m_optgroup->on_change = [this](t_config_option_key opt_key, boost::any value) { if (opt_key == "host_type" || opt_key == "printhost_authorization_type") this->update(); if (opt_key == "print_host") @@ -354,6 +450,21 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr return sizer; }; +//y15 +// auto api_key_copy = [=](wxWindow* parent) { +// auto sizer = create_sizer_with_btn(parent, &m_api_key_copy_btn, "copy", _L("Copy")); +// m_api_key_copy_btn->Bind(wxEVT_BUTTON, [=](wxCommandEvent& e) { +// if (Field* apikey_field = m_optgroup->get_field("printhost_apikey"); apikey_field) { +// if (wxTextCtrl* temp = dynamic_cast(apikey_field->getWindow()); temp ) { +// wxTheClipboard->Open(); +// wxTheClipboard->SetData(new wxTextDataObject(temp->GetValue())); +// wxTheClipboard->Close(); +// } +// } +// }); +// return sizer; +// }; + // Set a wider width for a better alignment Option option = m_optgroup->get_option("print_host"); option.opt.width = Field::def_width_wider(); @@ -366,6 +477,7 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr option = m_optgroup->get_option("printhost_apikey"); option.opt.width = Field::def_width_wider(); + //y15 m_optgroup->append_single_option_line(option); option = m_optgroup->get_option("printhost_port"); @@ -428,6 +540,39 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr m_optgroup->append_line(line); } +//y15 +// // Text line with info how passwords and api keys are stored +// if (is_secret_store_ok()) { +// Line line{ "", "" }; +// line.full_width = 1; +// line.widget = [ca_file_hint](wxWindow* parent) { +// wxString info = GUI::format_wxstr(L"%1%:\n\t%2%\n" +// , _L("Storing passwords") +// , GUI::format_wxstr(_L("On this system, %1% uses the system password store to safely store and read passwords and API keys."), SLIC3R_APP_NAME)); +// auto txt = new wxStaticText(parent, wxID_ANY, info); +// txt->SetFont(wxGetApp().normal_font()); +// auto sizer = new wxBoxSizer(wxHORIZONTAL); +// sizer->Add(txt, 1, wxEXPAND); +// return sizer; +// }; +// m_optgroup->append_line(line); +// } else { +// Line line{ "", "" }; +// line.full_width = 1; +// line.widget = [ca_file_hint](wxWindow* parent) { +// wxString info = GUI::format_wxstr(L"%1%:\n\t%2%\n\t%3%\n" +// , _L("Storing passwords") +// , GUI::format_wxstr(_L("On this system, %1% cannot access the system password store."), SLIC3R_APP_NAME) +// , _L("Passwords and API keys are stored in plain text.")); +// auto txt = new wxStaticText(parent, wxID_ANY, info); +// txt->SetFont(wxGetApp().normal_font()); +// auto sizer = new wxBoxSizer(wxHORIZONTAL); +// sizer->Add(txt, 1, wxEXPAND); +// return sizer; +// }; +// m_optgroup->append_line(line); +// } + for (const std::string& opt_key : std::vector{ "printhost_user", "printhost_password" }) { option = m_optgroup->get_option(opt_key); option.opt.width = Field::def_width_wider(); @@ -445,6 +590,7 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr const auto opt = m_config->option>("host_type"); m_last_host_type = opt->value; m_opened_as_connect = (m_last_host_type == htQIDIConnect); + Field* printhost_field = m_optgroup->get_field("print_host"); if (printhost_field) { @@ -466,7 +612,7 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr if (field) field->propagate_value(); }), temp->GetId()); - } + } } // Always fill in the "printhost_port" combo box from the config and select it. @@ -510,7 +656,7 @@ void PhysicalPrinterDialog::update(bool printer_change) for (const std::string& opt_key : std::vector{ "printhost_user", "printhost_password" }) m_optgroup->hide_field(opt_key); supports_multiple_printers = opt && opt->value == htRepetier; - } + } // Hide Browse and Test buttons for Connect if (opt->value == htQIDIConnect) { m_printhost_browse_btn->Hide(); @@ -519,8 +665,8 @@ void PhysicalPrinterDialog::update(bool printer_change) text_ctrl* printhost_win = printhost_field ? dynamic_cast(printhost_field->getWindow()) : nullptr; if (!m_opened_as_connect && printhost_win && m_last_host_type != htQIDIConnect){ m_stored_host = printhost_win->GetValue(); - printhost_win->SetValue(L"https://connect.qidi3d.com"); - } + printhost_win->SetValue(from_u8(Utils::ServiceConfig::instance().connect_url())); + } } else { m_printhost_browse_btn->Show(); // hide QIDIConnect address and show hostname @@ -593,7 +739,7 @@ void PhysicalPrinterDialog::update_host_type(bool printer_change) for (PresetForPrinter* prstft : m_presets) { std::string preset_name = prstft->get_preset_name(); if (Preset* preset = wxGetApp().preset_bundle->printers.find_preset(preset_name)) { - std::string model_id = preset->config.opt_string("printer_model"); + std::string model_id = preset->config.opt_string("printer_model"); if (preset->vendor) { if (preset->vendor->name == "QIDI Technology") { const std::vector& models = preset->vendor->models; @@ -732,6 +878,7 @@ void PhysicalPrinterDialog::on_dpi_changed(const wxRect& suggested_rect) void PhysicalPrinterDialog::on_sys_color_changed() { + //y15 //m_add_preset_btn->sys_color_changed(); m_printhost_browse_btn->sys_color_changed(); m_printhost_test_btn->sys_color_changed(); @@ -744,7 +891,6 @@ void PhysicalPrinterDialog::on_sys_color_changed() void PhysicalPrinterDialog::OnOK(wxEvent& event) { - //y3 std::string now_host = boost::any_cast(m_optgroup->get_field("print_host")->get_value()); if (now_host.empty()) { @@ -777,6 +923,7 @@ void PhysicalPrinterDialog::OnOK(wxEvent& event) Field* printhost_field = m_optgroup->get_field("print_host"); text_ctrl* printhost_win = printhost_field ? dynamic_cast(printhost_field->getWindow()) : nullptr; const auto opt = m_config->option>("host_type"); + //y15 if (opt->value == htMoonraker) { Field * printhost_field = m_optgroup->get_field("print_host"); text_ctrl *printhost_win = printhost_field ? dynamic_cast(printhost_field->getWindow()) : nullptr; @@ -799,7 +946,6 @@ void PhysicalPrinterDialog::OnOK(wxEvent& event) //y3 wxString msg_text = from_u8((boost::format(_u8L("Printer with name \"%1%\" already exists.")) % existing->name/*printer_name*/).str()); //msg_text += "\n" + _L("Replace?"); - ////wxMessageDialog dialog(nullptr, msg_text, _L("Warning"), wxICON_WARNING | wxYES | wxNO); //MessageDialog dialog(nullptr, msg_text, _L("Warning"), wxICON_WARNING | wxYES | wxNO); MessageDialog dialog(nullptr, msg_text, _L("Warning"), wxICON_WARNING | wxOK); dialog.ShowModal(); @@ -846,6 +992,14 @@ void PhysicalPrinterDialog::OnOK(wxEvent& event) //update printer name, if it was changed m_printer.set_name(into_u8(printer_name)); +//y15 +// // save access data secretly +// if (!m_printer.config.opt_string("printhost_password").empty()) { +// if (save_secret(m_printer.name, "printhost_password", m_printer.config.opt_string("printhost_user"), m_printer.config.opt_string("printhost_password"))) { +// m_printer.config.opt_string("printhost_password", false) = "stored"; +// } +// } + // save new physical printer printers.save_printer(m_printer, renamed_from); @@ -859,7 +1013,6 @@ void PhysicalPrinterDialog::OnOK(wxEvent& event) wxGetApp().get_tab(Preset::TYPE_PRINTER)->update_preset_choice(); //B64 - // wxGetApp().SetPresentChange(true); m_machine_name = into_u8(printer_name); m_machine_host = now_host; event.Skip(); diff --git a/src/slic3r/GUI/PhysicalPrinterDialog.hpp b/src/slic3r/GUI/PhysicalPrinterDialog.hpp index 4ce72c0..41c67d9 100644 --- a/src/slic3r/GUI/PhysicalPrinterDialog.hpp +++ b/src/slic3r/GUI/PhysicalPrinterDialog.hpp @@ -72,6 +72,8 @@ class PhysicalPrinterDialog : public DPIDialog ScalableButton* m_printhost_test_btn {nullptr}; ScalableButton* m_printhost_cafile_browse_btn {nullptr}; ScalableButton* m_printhost_port_browse_btn {nullptr}; + //y15 + // ScalableButton* m_api_key_copy_btn {nullptr}; wxBoxSizer* m_presets_sizer {nullptr}; @@ -88,7 +90,7 @@ class PhysicalPrinterDialog : public DPIDialog public: //y3 - PhysicalPrinterDialog(wxWindow *parent, wxString printer_name, std::set exit_host); + PhysicalPrinterDialog(wxWindow* parent, wxString printer_name, std::set exit_host); ~PhysicalPrinterDialog(); void update(bool printer_change = false); @@ -106,7 +108,6 @@ public: std::string get_name(); std::string get_host(); - protected: void on_dpi_changed(const wxRect& suggested_rect) override; void on_sys_color_changed() override; @@ -118,7 +119,6 @@ private: }; - } // namespace GUI } // namespace Slic3r diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index ede48f4..3323342 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -1,4 +1,3 @@ - #include "Plater.hpp" #include "slic3r/GUI/Jobs/UIThreadWorker.hpp" @@ -12,7 +11,7 @@ #include #include #include -#include +#include // IWYU pragma: keep #include #include #include @@ -34,12 +33,6 @@ #include #include #include -#ifdef _WIN32 -#include -#include -#include -#endif - #if wxUSE_SECRETSTORE #include #endif @@ -53,16 +46,13 @@ #include "libslic3r/Format/OBJ.hpp" #include "libslic3r/GCode/ThumbnailData.hpp" #include "libslic3r/Model.hpp" -#include "libslic3r/SLA/Hollowing.hpp" #include "libslic3r/SLA/SupportPoint.hpp" #include "libslic3r/SLA/ReprojectPointsOnMesh.hpp" -#include "libslic3r/Polygon.hpp" #include "libslic3r/Print.hpp" #include "libslic3r/PrintConfig.hpp" #include "libslic3r/SLAPrint.hpp" #include "libslic3r/Utils.hpp" #include "libslic3r/PresetBundle.hpp" -#include "libslic3r/ClipperUtils.hpp" #include "libslic3r/miniz_extension.hpp" // For stl export @@ -73,9 +63,6 @@ #include "GUI_App.hpp" #include "GUI_ObjectList.hpp" #include "GUI_ObjectManipulation.hpp" -#include "GUI_ObjectLayers.hpp" -#include "GUI_Utils.hpp" -#include "GUI_Geometry.hpp" #include "GUI_Utils.hpp" #include "GUI_Factories.hpp" #include "wxExtensions.hpp" @@ -90,11 +77,9 @@ #include "Camera.hpp" #include "Mouse3DController.hpp" #include "Tab.hpp" -//#include "Jobs/ArrangeJob.hpp" #include "Jobs/ArrangeJob2.hpp" #include "ConfigWizardWebViewPage.hpp" -//#include "Jobs/FillBedJob.hpp" #include "Jobs/RotoptimizeJob.hpp" #include "Jobs/SLAImportJob.hpp" #include "Jobs/SLAImportDialog.hpp" @@ -103,10 +88,8 @@ #include "Jobs/BoostThreadWorker.hpp" #include "BackgroundSlicingProcess.hpp" #include "PrintHostDialogs.hpp" -#include "ConfigWizard.hpp" #include "../Utils/ASCIIFolding.hpp" #include "../Utils/PrintHost.hpp" - #include "../Utils/UndoRedo.hpp" #include "../Utils/PresetUpdater.hpp" #include "../Utils/Process.hpp" @@ -537,12 +520,7 @@ struct Plater::priv // fills the m_bed.m_grid_lines and sets m_bed.m_origin. // Sets m_bed.m_polygon to limit the object placement. //B52 - void set_bed_shape(const Pointfs& shape, - const double max_print_height, - const std::string& custom_texture, - const std::string& custom_model, - const Pointfs& exclude_bed_shape, - bool force_as_custom = false); + void set_bed_shape(const Pointfs& shape, const double max_print_height, const std::string& custom_texture, const std::string& custom_model, const Pointfs& exclude_bed_shape, bool force_as_custom = false); bool can_delete() const; bool can_delete_all() const; @@ -943,6 +921,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) this->show_action_buttons(this->ready_to_slice); }); + //y15 // this->q->Bind(EVT_UA_ID_USER_SUCCESS, [this](UserAccountSuccessEvent& evt) { // if (login_dialog != nullptr) { // login_dialog->EndModal(wxID_CANCEL); @@ -2327,32 +2306,6 @@ void Plater::priv::export_gcode(fs::path output_path, bool output_path_on_remova // If the SLA processing of just a single object's supports is running, restart slicing for the whole object. this->background_process.set_task(PrintBase::TaskParams()); this->restart_background_process(priv::UPDATE_BACKGROUND_PROCESS_FORCE_EXPORT); - - //Y6 PrintHint - if(wxGetApp().get_mode() == comSimple) { - std::string filament_type; - bool ShowPrintHint = false; - const PrintStatistics& ps = this->fff_print.print_statistics(); - const auto& extruders_filaments = wxGetApp().preset_bundle->extruders_filaments; - std::list FilamentsHintList = {"PETG", "PLA", "TPU"}; - - for (const auto& [filament_id, filament_vol] : ps.filament_stats) { - assert(filament_id < extruders_filaments.size()); - if (const Preset* preset = extruders_filaments[filament_id].get_selected_preset()) { - filament_type = preset->config.opt_string("filament_type", filament_id); - if (std::find(FilamentsHintList.begin(), FilamentsHintList.end(), filament_type) != FilamentsHintList.end()) { - ShowPrintHint = true; - break; - } - } - } - - if (ShowPrintHint) { - std::string message; - message = _u8L("Opening the front door and top cover before printing can improve heat dissipation, obtain better print quality, and prevent extruder blockage."); - notification_manager->push_notification(message); - } - } } unsigned int Plater::priv::update_restart_background_process(bool force_update_scene, bool force_update_preview) @@ -2943,11 +2896,11 @@ void Plater::priv::on_slicing_update(SlicingStatusEvent &evt) const std::string message_dial = GUI::format("%1% %2% %3%" , _L_PLURAL("You are using template filament preset.", "You are using template filament presets.", templ_cnt) , _u8L("Please note that template presets are not customized for specific printer and should only be used as a starting point for creating your own user presets.") - , "https://help.qidi3d.com/" + , "https://wiki.qidi3d.com/" ); BOOST_LOG_TRIVIAL(warning) << message_notif; - notification_manager->push_slicing_warning_notification(message_notif, false, 0, 0, "https://help.qidi3d.com/", - [](wxEvtHandler* evnthndlr) { wxGetApp().open_browser_with_warning_dialog("https://help.qidi3d.com/article/template-filaments_467599"); return false; } + notification_manager->push_slicing_warning_notification(message_notif, false, 0, 0, "https://wiki.qidi3d.com/", + [](wxEvtHandler* evnthndlr) { wxGetApp().open_browser_with_warning_dialog("https://wiki.qidi3d.com/article/template-filaments_467599"); return false; } ); add_warning({ PrintStateBase::WarningLevel::CRITICAL, true, message_dial, 0}, 0); } @@ -3611,12 +3564,7 @@ bool Plater::priv::can_reload_from_disk() const } //B52 -void Plater::priv::set_bed_shape(const Pointfs& shape, - const double max_print_height, - const std::string& custom_texture, - const std::string& custom_model, - const Pointfs& exclude_bed_shape, - bool force_as_custom) +void Plater::priv::set_bed_shape(const Pointfs& shape, const double max_print_height, const std::string& custom_texture, const std::string& custom_model, const Pointfs& exclude_bed_shape, bool force_as_custom) { bool new_shape = bed.set_shape(shape, max_print_height, custom_texture, custom_model, exclude_bed_shape, force_as_custom); @@ -3764,6 +3712,7 @@ void Plater::priv::show_action_buttons(const bool ready_to_slice_) const const auto print_host_opt = selected_printer_config ? selected_printer_config->option("print_host") : nullptr; const bool send_gcode_shown = print_host_opt != nullptr && !print_host_opt->value.empty(); const bool connect_gcode_shown = print_host_opt == nullptr && can_show_upload_to_connect(); + //y auto m_devices = wxGetApp().get_devices(); const bool link_has_machine = m_devices.size() > 0; @@ -3772,7 +3721,9 @@ void Plater::priv::show_action_buttons(const bool ready_to_slice_) const { RemovableDriveManager::RemovableDrivesStatus removable_media_status = wxGetApp().removable_drive_manager()->status(); if (sidebar->show_reslice(false) | - sidebar->show_export(true) | sidebar->show_send(send_gcode_shown | link_has_machine) | + sidebar->show_export(true) | + sidebar->show_send(send_gcode_shown | link_has_machine) | + //y15 // sidebar->show_connect(connect_gcode_shown) | sidebar->show_export_removable(removable_media_status.has_removable_drives)) sidebar->Layout(); @@ -3785,7 +3736,8 @@ void Plater::priv::show_action_buttons(const bool ready_to_slice_) const if (sidebar->show_reslice(ready_to_slice) | sidebar->show_export(!ready_to_slice) | sidebar->show_send((send_gcode_shown | link_has_machine) && !ready_to_slice) | - sidebar->show_connect(connect_gcode_shown && !ready_to_slice) | + //y15 + // sidebar->show_connect(connect_gcode_shown && !ready_to_slice) | sidebar->show_export_removable(!ready_to_slice && removable_media_status.has_removable_drives)) sidebar->Layout(); } @@ -6069,6 +6021,8 @@ static void alert_when_exporting_binary_gcode(bool binary_output, const std::str } } + + void Plater::export_gcode(bool prefer_removable) { if (p->model.objects.empty()) @@ -6747,6 +6701,7 @@ std::string Plater::get_upload_filename() return default_output_file.filename().string(); } +//y15 void Plater::send_gcode() { // if physical_printer is selected, send gcode for this printer @@ -6759,13 +6714,29 @@ void Plater::send_gcode() // Obtain default output path fs::path default_output_file; - default_output_file = get_upload_filename(); + try { + // Update the background processing, so that the placeholder parser will get the correct values for the ouput file template. + // Also if there is something wrong with the current configuration, a pop-up dialog will be shown and the export will not be performed. + unsigned int state = this->p->update_restart_background_process(false, false); + if (state & priv::UPDATE_BACKGROUND_PROCESS_INVALID) + return; + default_output_file = this->p->background_process.output_filepath_for_project(into_path(get_project_filename(".3mf"))); + } catch (const Slic3r::PlaceholderParserError& ex) { + // Show the error with monospaced font. + show_error(this, ex.what(), true); + return; + } catch (const std::exception& ex) { + show_error(this, ex.what(), false); + return; + } + default_output_file = fs::path(Slic3r::fold_utf8_to_ascii(default_output_file.string())); // Repetier specific: Query the server for the list of file groups. wxArrayString groups; // QIDILink specific: Query the server for the list of file groups. wxArrayString storage_paths; wxArrayString storage_names; + //y15 bool only_link = false; if (physical_printer_config) { PrintHostJob upload_job(physical_printer_config); @@ -6784,8 +6755,8 @@ void Plater::send_gcode() only_link = true; } max_send_number = std::stoi(wxGetApp().app_config->get("max_send")); - //B61 - PrintHostSendDialog dlg(default_output_file, PrintHostPostUploadAction::StartPrint, groups, storage_paths, storage_names, this, + //B61 + PrintHostSendDialog dlg(default_output_file, PrintHostPostUploadAction::StartPrint, groups, storage_paths, storage_names, this, (this->fff_print().print_statistics()), only_link); if (dlg.ShowModal() == wxID_OK) { if (printer_technology() == ptFFF) { @@ -6832,13 +6803,6 @@ void Plater::send_gcode() upload_job.upload_data.storage = dlg.storage(); upload_job.create_time = std::chrono::system_clock::now(); - //if (diff.count() < 0) - // upload_job.sendinginterval = UploadCount / std::stoi(wxGetApp().app_config->get("max_send")) * - // std::stoi(wxGetApp().app_config->get("sending_interval")) * 60 - - // diff.count(); - //else - // upload_job.sendinginterval = UploadCount / std::stoi(wxGetApp().app_config->get("max_send")) * - // std::stoi(wxGetApp().app_config->get("sending_interval")) * 60; if (UploadCount != 0 && UploadCount % std::stoi(wxGetApp().app_config->get("max_send")) == 0) { m_sending_interval += std::stoi(wxGetApp().app_config->get("sending_interval")) * 60; } @@ -6876,14 +6840,6 @@ void Plater::send_gcode() upload_job.upload_data.storage = dlg.storage(); upload_job.create_time = std::chrono::system_clock::now(); - //if (diff.count() < 0) - // upload_job.sendinginterval = UploadCount / std::stoi(wxGetApp().app_config->get("max_send")) * - // std::stoi(wxGetApp().app_config->get("sending_interval")) * 60 - - // diff.count()+4; - //else - // upload_job.sendinginterval = UploadCount / std::stoi(wxGetApp().app_config->get("max_send")) * - // std::stoi(wxGetApp().app_config->get("sending_interval")) * 60; - if (UploadCount != 0 && UploadCount % std::stoi(wxGetApp().app_config->get("max_send")) == 0) { m_sending_interval += std::stoi(wxGetApp().app_config->get("sending_interval")) * 60; } @@ -6897,11 +6853,8 @@ void Plater::send_gcode() return; } - //std::chrono::seconds seconds_to_add(upload_job.sendinginterval); - - //m_time_p = upload_job.create_time + seconds_to_add; p->export_gcode(fs::path(), false, std::move(upload_job)); - UploadCount++; + UploadCount++; } } #endif @@ -7017,8 +6970,7 @@ void Plater::on_config_change(const DynamicPrintConfig &config) p->preview->get_canvas3d()->reset_volumes(); } //B52 - else if (opt_key == "bed_shape" || opt_key == "bed_custom_texture" || opt_key == "bed_custom_model" || - opt_key == "bed_exclude_area") { + else if (opt_key == "bed_shape" || opt_key == "bed_custom_texture" || opt_key == "bed_custom_model" || opt_key == "bed_exclude_area") { bed_shape_changed = true; update_scheduled = true; } @@ -7079,12 +7031,7 @@ void Plater::set_bed_shape() const } //B52 -void Plater::set_bed_shape(const Pointfs& shape, - const double max_print_height, - const std::string& custom_texture, - const std::string& custom_model, - const Pointfs& exclude_bed_shape, - bool force_as_custom) const +void Plater::set_bed_shape(const Pointfs& shape, const double max_print_height, const std::string& custom_texture, const std::string& custom_model, const Pointfs& exclude_bed_shape, bool force_as_custom) const { p->set_bed_shape(shape, max_print_height, custom_texture, custom_model, exclude_bed_shape, force_as_custom); } @@ -7092,9 +7039,7 @@ void Plater::set_bed_shape(const Pointfs& shape, //B52 void Plater::set_default_bed_shape() const { - set_bed_shape({ {0.0, 0.0}, {200.0, 0.0}, {200.0, 200.0}, {0.0, 200.0} }, 0.0, {}, {}, { - {0.0, 0.0} - }, true); + set_bed_shape({ {0.0, 0.0}, {200.0, 0.0}, {200.0, 200.0}, {0.0, 200.0} }, 0.0, {}, {}, {{0.0, 0.0}}, true); } void Plater::force_filament_colors_update() @@ -7713,14 +7658,12 @@ void Plater::toggle_remember_user_account_session() void Plater::act_with_user_account() { + //y std::string current_user_token = wxGetApp().app_config->get("user_token"); if (current_user_token.empty()) wxGetApp().ShowUserLogin(true); else - { - wxGetApp().SetOnlineLogin(false); - } } void Plater::init_notification_manager() diff --git a/src/slic3r/GUI/Plater.hpp b/src/slic3r/GUI/Plater.hpp index 4ece1d2..d550c4c 100644 --- a/src/slic3r/GUI/Plater.hpp +++ b/src/slic3r/GUI/Plater.hpp @@ -15,6 +15,7 @@ #include "Jobs/Job.hpp" #include "Jobs/Worker.hpp" +//y #include "libslic3r/GCode/ThumbnailData.hpp" class wxString; @@ -206,8 +207,6 @@ public: void apply_cut_object_to_model(size_t init_obj_idx, const ModelObjectPtrs& cut_objects); - //B61 - ThumbnailData get_thumbnailldate(); //B64 ThumbnailData get_thumbnailldate_send(); void export_gcode(bool prefer_removable); @@ -233,6 +232,7 @@ public: bool is_background_process_update_scheduled() const; void suppress_background_process(const bool stop_background_process) ; void send_gcode(); + //y15 // void send_gcode_inner(DynamicPrintConfig* physical_printer_config); void eject_drive(); void connect_gcode(); @@ -360,14 +360,9 @@ public: const Mouse3DController& get_mouse3d_controller() const; Mouse3DController& get_mouse3d_controller(); - void set_bed_shape() const; + void set_bed_shape() const; //B52 - void set_bed_shape(const Pointfs& shape, - const double max_print_height, - const std::string& custom_texture, - const std::string& custom_model, - const Pointfs& exclude_bed_shape, - bool force_as_custom = false) const; + void set_bed_shape(const Pointfs& shape, const double max_print_height, const std::string& custom_texture, const std::string& custom_model, const Pointfs& exclude_bed_shape, bool force_as_custom = false) const; void set_default_bed_shape() const; NotificationManager* get_notification_manager(); @@ -448,7 +443,7 @@ public: wxMenu* instance_menu(); wxMenu* layer_menu(); wxMenu* multi_selection_menu(); - + //y void resetUploadCount() { UploadCount = 0; diff --git a/src/slic3r/GUI/Preferences.cpp b/src/slic3r/GUI/Preferences.cpp index fce4f41..6cb6d5b 100644 --- a/src/slic3r/GUI/Preferences.cpp +++ b/src/slic3r/GUI/Preferences.cpp @@ -1,4 +1,3 @@ - #include "Preferences.hpp" #include "OptionsGroup.hpp" #include "GUI_App.hpp" diff --git a/src/slic3r/GUI/Preferences.hpp b/src/slic3r/GUI/Preferences.hpp index 91d8bcc..a8b6555 100644 --- a/src/slic3r/GUI/Preferences.hpp +++ b/src/slic3r/GUI/Preferences.hpp @@ -1,4 +1,3 @@ - #ifndef slic3r_Preferences_hpp_ #define slic3r_Preferences_hpp_ diff --git a/src/slic3r/GUI/PresetArchiveDatabase.cpp b/src/slic3r/GUI/PresetArchiveDatabase.cpp index d017253..d4b671d 100644 --- a/src/slic3r/GUI/PresetArchiveDatabase.cpp +++ b/src/slic3r/GUI/PresetArchiveDatabase.cpp @@ -251,8 +251,7 @@ bool OnlineArchiveRepository::get_file_inner(const std::string& url, const fs::p bool OnlineArchiveRepository::get_archive(const fs::path& target_path) const { - //y15 - return get_file_inner(m_data.index_url.empty() ? m_data.url + "vendor_indices.zip" : m_data.index_url + "vendor_indices.zip", target_path); + return get_file_inner(m_data.index_url.empty() ? m_data.url + "vendor_indices.zip" : m_data.index_url, target_path); } bool OnlineArchiveRepository::get_file(const std::string& source_subpath, const fs::path& target_path, const std::string& repository_id) const diff --git a/src/slic3r/GUI/PresetComboBoxes.cpp b/src/slic3r/GUI/PresetComboBoxes.cpp index 039d2a7..ed18d8c 100644 --- a/src/slic3r/GUI/PresetComboBoxes.cpp +++ b/src/slic3r/GUI/PresetComboBoxes.cpp @@ -1,4 +1,3 @@ - #include "PresetComboBoxes.hpp" #include @@ -48,7 +47,6 @@ //B55 #include "../Utils/PrintHost.hpp" // A workaround for a set of issues related to text fitting into gtk widgets: -// See e.g.: https://github.com/qidi3d/QIDISlicer/issues/4584 #if defined(__WXGTK20__) || defined(__WXGTK3__) #include #include @@ -140,7 +138,6 @@ void PresetComboBox::init_from_bundle(PresetBundle* preset_bundle) void PresetComboBox::OnSelect(wxCommandEvent& evt) { - // see https://github.com/qidi3d/QIDISlicer/issues/3889 // Under OSX: in case of use of a same names written in different case (like "ENDER" and "Ender") // m_presets_choice->GetSelection() will return first item, because search in PopupListCtrl is case-insensitive. // So, use GetSelection() from event parameter @@ -406,11 +403,13 @@ void PresetComboBox::update(std::string select_preset_name) } void PresetComboBox::edit_physical_printer() -{ +{ //y3 std::set m_exit_host = wxGetApp().getExitHost(); if (!m_preset_bundle->physical_printers.has_selection()) return; + + //y3 PhysicalPrinter &ph_printer = m_preset_bundle->physical_printers.get_selected_printer(); std::string ph_host = ph_printer.config.opt_string("print_host"); m_exit_host.erase(ph_host); @@ -420,11 +419,10 @@ void PresetComboBox::edit_physical_printer() update(); wxGetApp().SetPresentChange(true); } - } void PresetComboBox::add_physical_printer() -{ +{ //y3 std::set m_exit_host = wxGetApp().getExitHost(); if (PhysicalPrinterDialog(this->GetParent(), wxEmptyString, m_exit_host).ShowModal() == wxID_OK) { @@ -435,8 +433,8 @@ void PresetComboBox::add_physical_printer() void PresetComboBox::open_physical_printer_url() { - const PhysicalPrinter &pp = m_preset_bundle->physical_printers.get_selected_printer(); - std::string host = pp.config.opt_string("print_host"); + const PhysicalPrinter& pp = m_preset_bundle->physical_printers.get_selected_printer(); + std::string host = pp.config.opt_string("print_host"); assert(!host.empty()); //B55 const DynamicPrintConfig *cfg = wxGetApp().preset_bundle->physical_printers.get_selected_printer_config(); @@ -670,6 +668,7 @@ bool PresetComboBox::selection_is_changed_according_to_physical_printers() wxGetApp().sidebar().update_presets(m_type); // Check and show "Physical printer" page if needed + //y15 // wxGetApp().show_printer_webview_tab(); return true; @@ -882,11 +881,7 @@ void PlaterPresetComboBox::show_add_menu() append_menu_item(menu, wxID_ANY, _L("Add physical printer"), "", [this](wxCommandEvent&) { - //y3 - std::set m_exit_host = wxGetApp().getExitHost(); - PhysicalPrinterDialog dlg(this->GetParent(), wxEmptyString, m_exit_host); - if (dlg.ShowModal() == wxID_OK) - update(); + add_physical_printer(); }, "edit_uni", menu, []() { return true; }, wxGetApp().plater()); wxGetApp().plater()->PopupMenu(menu); @@ -1349,7 +1344,6 @@ void PlaterPresetComboBox::update() #ifdef __WXMSW__ // Use this part of code just on Windows to avoid of some layout issues on Linux - // see https://github.com/qidi3d/QIDISlicer/issues/5163 and https://github.com/qidi3d/QIDISlicer/issues/5505 // Update control min size after rescale (changed Display DPI under MSW) if (GetMinWidth() != 20 * m_em_unit) SetMinSize(wxSize(20 * m_em_unit, GetSize().GetHeight())); @@ -1361,7 +1355,6 @@ void PlaterPresetComboBox::msw_rescale() PresetComboBox::msw_rescale(); #ifdef __WXMSW__ // Use this part of code just on Windows to avoid of some layout issues on Linux - // see https://github.com/qidi3d/QIDISlicer/issues/5163 and https://github.com/qidi3d/QIDISlicer/issues/5505 // Update control min size after rescale (changed Display DPI under MSW) if (GetMinWidth() != 20 * m_em_unit) SetMinSize(wxSize(20 * m_em_unit, GetSize().GetHeight())); @@ -1391,7 +1384,6 @@ TabPresetComboBox::TabPresetComboBox(wxWindow* parent, Preset::Type preset_type) void TabPresetComboBox::OnSelect(wxCommandEvent &evt) { - // see https://github.com/qidi3d/QIDISlicer/issues/3889 // Under OSX: in case of use of a same names written in different case (like "ENDER" and "Ender") // m_presets_choice->GetSelection() will return first item, because search in PopupListCtrl is case-insensitive. // So, use GetSelection() from event parameter @@ -1419,7 +1411,6 @@ void TabPresetComboBox::OnSelect(wxCommandEvent &evt) #ifdef __WXMSW__ // From the Win 2004 preset combobox lose a focus after change the preset selection // and that is why the up/down arrow doesn't work properly - // (see https://github.com/qidi3d/QIDISlicer/issues/5531 ). // So, set the focus to the combobox explicitly this->SetFocus(); #endif diff --git a/src/slic3r/GUI/PresetComboBoxes.hpp b/src/slic3r/GUI/PresetComboBoxes.hpp index 0a0af00..5595ade 100644 --- a/src/slic3r/GUI/PresetComboBoxes.hpp +++ b/src/slic3r/GUI/PresetComboBoxes.hpp @@ -1,4 +1,3 @@ - #ifndef slic3r_PresetComboBoxes_hpp_ #define slic3r_PresetComboBoxes_hpp_ diff --git a/src/slic3r/GUI/PrintHostDialogs.cpp b/src/slic3r/GUI/PrintHostDialogs.cpp index f6bdf7a..f0cd99e 100644 --- a/src/slic3r/GUI/PrintHostDialogs.cpp +++ b/src/slic3r/GUI/PrintHostDialogs.cpp @@ -40,18 +40,8 @@ static const char *CONFIG_KEY_GROUP = "printhost_group"; static const char* CONFIG_KEY_STORAGE = "printhost_storage"; //B61 -PrintHostSendDialog::PrintHostSendDialog(const fs::path & path, - PrintHostPostUploadActions post_actions, - const wxArrayString & groups, - const wxArrayString & storage_paths, - const wxArrayString & storage_names, - Plater * plater, - const PrintStatistics & ps, - bool onlylink) - : MsgDialog(static_cast(wxGetApp().mainframe), - _L("Send G-Code to printer host"), - _L(""), - 0) // Set style = 0 to avoid default creation of the "OK" button. +PrintHostSendDialog::PrintHostSendDialog(const fs::path &path, PrintHostPostUploadActions post_actions, const wxArrayString &groups, const wxArrayString& storage_paths, const wxArrayString& storage_names, Plater* plater, const PrintStatistics& ps, bool onlylink) + : MsgDialog(static_cast(wxGetApp().mainframe), _L("Send G-Code to printer host"), _L(""), 0) // Set style = 0 to avoid default creation of the "OK" button. // All buttons will be added later in this constructor , txt_filename(new wxTextCtrl(this, wxID_ANY)) , combo_groups(!groups.IsEmpty() ? new wxComboBox(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, groups, wxCB_READONLY) : nullptr) @@ -354,14 +344,6 @@ PrintHostSendDialog::PrintHostSendDialog(const fs::path & path, wxStaticBoxSizer *sizer2 = new wxStaticBoxSizer(wxVERTICAL, this, _L("")); sizer2->Add(scrool_box_sizer2); - - - //hbox2->Add(scrool_box_sizer); - - //hbox2->Add(0, 0, 0, wxEXPAND | wxLEFT, 23); - - //hbox2->Add(scrool_box_sizer2); - hbox2->Add(sizer1); hbox2->Add(0, 0, 0, wxEXPAND | wxLEFT, 23); hbox2->Add(sizer2); @@ -411,7 +393,7 @@ PrintHostSendDialog::PrintHostSendDialog(const fs::path & path, m_valid_suffix = recent_path.substr(extension_start); // .gcode suffix control auto validate_path = [this](const wxString &path) -> bool { - if (! path.Lower().EndsWith(m_valid_suffix.Lower())) { + if (!path.Lower().EndsWith(m_valid_suffix.Lower())) { MessageDialog msg_wingow(this, wxString::Format(_L("Upload filename doesn't end with \"%s\". Do you wish to continue?"), m_valid_suffix), wxString(SLIC3R_APP_NAME), wxYES | wxNO); return msg_wingow.ShowModal() == wxID_YES; } @@ -542,7 +524,6 @@ PrintHostSendDialog::PrintHostSendDialog(const fs::path & path, #ifdef __linux__ // On Linux with GTK2 when text control lose the focus then selection (colored background) disappears but text color stay white // and as a result the text is invisible with light mode - // see https://github.com/qidi3d/QIDISlicer/issues/4532 // Workaround: Unselect text selection explicitly on kill focus txt_filename->Bind(wxEVT_KILL_FOCUS, [this](wxEvent& e) { e.Skip(); @@ -620,20 +601,6 @@ wxBoxSizer *PrintHostSendDialog::create_item_input( sizer_input->Add(0, 0, 0, wxEXPAND | wxLEFT, 3); sizer_input->Add(second_title, 0, wxALIGN_CENTER_VERTICAL | wxALL, 3); - //input->GetTextCtrl()->Bind(wxEVT_TEXT_ENTER, [this, param, input](wxCommandEvent &e) { - // auto value = input->GetTextCtrl()->GetValue(); - // wxGetApp().app_config->set(param, std::string(value.mb_str())); - // wxGetApp().app_config->save(); - // e.Skip(); - //}); - - //input->GetTextCtrl()->Bind(wxEVT_KILL_FOCUS, [this, param, input](wxFocusEvent &e) { - // auto value = input->GetTextCtrl()->GetValue(); - // wxGetApp().app_config->set(param, std::string(value.mb_str())); - // wxGetApp().app_config->save(); - // e.Skip(); - //}); - input->GetTextCtrl()->Bind(wxEVT_TEXT, [this, param, input](wxCommandEvent &e) { auto value = input->GetTextCtrl()->GetValue(); if (!value.empty()) { @@ -979,6 +946,7 @@ void PrintHostQueueDialog::on_error(Event &evt) wxCHECK_RET(evt.job_id < (size_t)job_list->GetItemCount(), "Out of bounds access to job list"); set_state(evt.job_id, ST_ERROR); + //y std::string response_msg = into_u8(evt.status); wxString code_msg = ""; if (response_msg.find("HTTP 404:") != std::string::npos) { @@ -994,7 +962,7 @@ void PrintHostQueueDialog::on_error(Event &evt) else code_msg = response_msg; - auto errormsg = format_wxstr("%1%\n%2%", _L("Error uploading to print host") + ":", code_msg); + auto errormsg = format_wxstr("%1%\n%2%", _L("Error uploading to print host") + ":", code_msg); job_list->SetValue(wxVariant(0), evt.job_id, COL_PROGRESS); job_list->SetValue(wxVariant(errormsg), evt.job_id, COL_ERRORMSG); // Stashes the error message into a hidden column for later diff --git a/src/slic3r/GUI/PrintHostDialogs.hpp b/src/slic3r/GUI/PrintHostDialogs.hpp index 5dcc44f..e64ae0c 100644 --- a/src/slic3r/GUI/PrintHostDialogs.hpp +++ b/src/slic3r/GUI/PrintHostDialogs.hpp @@ -4,7 +4,6 @@ #include #include #include -#include #include #include @@ -13,9 +12,11 @@ #include "GUI_Utils.hpp" #include "MsgDialog.hpp" #include "../Utils/PrintHost.hpp" + //B61 #include "Plater.hpp" #include "libslic3r/Print.hpp" +#include class wxButton; class wxTextCtrl; @@ -62,14 +63,7 @@ class PrintHostSendDialog : public GUI::MsgDialog { public: //B61 - PrintHostSendDialog(const boost::filesystem::path &path, - PrintHostPostUploadActions post_actions, - const wxArrayString & groups, - const wxArrayString & storage_paths, - const wxArrayString & storage_names, - Plater * plater, - const PrintStatistics & ps, - bool onlyLik); + PrintHostSendDialog(const boost::filesystem::path &path, PrintHostPostUploadActions post_actions, const wxArrayString& groups, const wxArrayString& storage_paths, const wxArrayString& storage_names, Plater* plater, const PrintStatistics& ps, bool onlyLik); boost::filesystem::path filename() const; PrintHostPostUploadAction post_action() const; std::string group() const; diff --git a/src/slic3r/GUI/RemovableDriveManager.cpp b/src/slic3r/GUI/RemovableDriveManager.cpp index 320ae78..e83fc7a 100644 --- a/src/slic3r/GUI/RemovableDriveManager.cpp +++ b/src/slic3r/GUI/RemovableDriveManager.cpp @@ -874,7 +874,7 @@ void RemovableDriveManager::eject_drive() child.wait(ec); bool success = false; if (ec) { - // The wait call can fail, as it did in https://github.com/qidi3d/QIDISlicer/issues/5507 + // The wait call can fail, as it did in https://github.com/QIDITECH/QIDISlicer/issues/5507 // It can happen even in cases where the eject is sucessful, but better report it as failed. // We did not find a way to reliably retrieve the exit code of the process. BOOST_LOG_TRIVIAL(error) << "boost::process::child::wait() failed during Ejection. State of Ejection is unknown. Error code: " << ec.value(); diff --git a/src/slic3r/GUI/RulerForDoubleSlider.cpp b/src/slic3r/GUI/RulerForDoubleSlider.cpp index 9f3dab7..492d57a 100644 --- a/src/slic3r/GUI/RulerForDoubleSlider.cpp +++ b/src/slic3r/GUI/RulerForDoubleSlider.cpp @@ -1,4 +1,3 @@ - #include #include diff --git a/src/slic3r/GUI/RulerForDoubleSlider.hpp b/src/slic3r/GUI/RulerForDoubleSlider.hpp index 2c11f97..89dc7f8 100644 --- a/src/slic3r/GUI/RulerForDoubleSlider.hpp +++ b/src/slic3r/GUI/RulerForDoubleSlider.hpp @@ -1,4 +1,3 @@ - #ifndef slic3r_GUI_RulerForDoubleSlider_hpp_ #define slic3r_GUI_RulerForDoubleSlider_hpp_ diff --git a/src/slic3r/GUI/Selection.cpp b/src/slic3r/GUI/Selection.cpp index a3c3c2d..e7796f8 100644 --- a/src/slic3r/GUI/Selection.cpp +++ b/src/slic3r/GUI/Selection.cpp @@ -1251,6 +1251,10 @@ void Selection::scale_to_fit_print_volume(const BuildVolume& volume) remove_volumes(m_mode, to_remove); } + // FIXME: It should really only account for the model parts when scaling to fit. Not for modifiers, + // support enforcers / blockers and negative meshes. + + switch (volume.type()) { case BuildVolume::Type::Rectangle: { undoredo_snapshot = fit_rectangle(volume, !undoredo_snapshot); break; } diff --git a/src/slic3r/GUI/Sidebar.cpp b/src/slic3r/GUI/Sidebar.cpp index 06a1d82..62f7825 100644 --- a/src/slic3r/GUI/Sidebar.cpp +++ b/src/slic3r/GUI/Sidebar.cpp @@ -1,4 +1,3 @@ - #include "Sidebar.hpp" #include "FrequentlyChangedParameters.hpp" #include "Plater.hpp" @@ -430,7 +429,7 @@ Sidebar::Sidebar(Plater *parent) // Buttons underneath the scrolled area // rescalable bitmap buttons "Send to printer" and "Remove device" - + //y15 auto init_scalable_btn = [this](ScalableButton** btn, const std::string& icon_name, wxString label, wxString tooltip = wxEmptyString) { #ifdef __APPLE__ @@ -439,6 +438,7 @@ Sidebar::Sidebar(Plater *parent) int bmp_px_cnt = 32; #endif //__APPLE__ ScalableBitmap bmp = ScalableBitmap(this, icon_name, bmp_px_cnt); + //y15 *btn = new ScalableButton(this, wxID_ANY, bmp, label, wxBU_EXACTFIT); wxGetApp().SetWindowVariantForButton((*btn)); @@ -457,6 +457,7 @@ Sidebar::Sidebar(Plater *parent) (*btn)->Hide(); }; + //y init_scalable_btn(&m_btn_send_gcode , "export_gcode", _L("Send to printer"), _L("Send to printer") + " " +GUI::shortkey_ctrl_prefix() + "Shift+G"); init_scalable_btn(&m_btn_export_gcode_removable, "export_to_sd", _L("Export"), _L("Export to SD card / Flash drive") + " " + GUI::shortkey_ctrl_prefix() + "U"); @@ -485,7 +486,8 @@ Sidebar::Sidebar(Plater *parent) auto* complect_btns_sizer = new wxBoxSizer(wxHORIZONTAL); complect_btns_sizer->Add(m_btn_export_gcode, 1, wxEXPAND); - complect_btns_sizer->Add(m_btn_connect_gcode, 1, wxEXPAND | wxLEFT, margin_5); + //y15 + // complect_btns_sizer->Add(m_btn_connect_gcode, 1, wxEXPAND | wxLEFT, margin_5); complect_btns_sizer->Add(m_btn_send_gcode, 0, wxLEFT, margin_5); complect_btns_sizer->Add(m_btn_export_gcode_removable, 0, wxLEFT, margin_5); diff --git a/src/slic3r/GUI/Sidebar.hpp b/src/slic3r/GUI/Sidebar.hpp index 371c746..4ee9e46 100644 --- a/src/slic3r/GUI/Sidebar.hpp +++ b/src/slic3r/GUI/Sidebar.hpp @@ -1,4 +1,3 @@ - #ifndef slic3r_Sidebar_hpp_ #define slic3r_Sidebar_hpp_ diff --git a/src/slic3r/GUI/SysInfoDialog.cpp b/src/slic3r/GUI/SysInfoDialog.cpp index 2d727b4..39c8e77 100644 --- a/src/slic3r/GUI/SysInfoDialog.cpp +++ b/src/slic3r/GUI/SysInfoDialog.cpp @@ -11,7 +11,7 @@ #include -#include +#include // IWYU pragma: keep #include #include "GUI_App.hpp" #include "MainFrame.hpp" diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 59c1378..e802d26 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -1,4 +1,3 @@ - // #include "libslic3r/GCodeSender.hpp" #include "slic3r/GUI/BedShapeDialog.hpp" #include "slic3r/Utils/Serial.hpp" @@ -1455,11 +1454,6 @@ void TabPrint::build() optgroup->append_single_option_line("thick_bridges", category_path + "thick_bridges"); optgroup->append_single_option_line("overhangs", category_path + "detect-bridging-perimeters"); - //w38 - optgroup->append_single_option_line("overhang_reverse"); - optgroup->append_single_option_line("overhang_reverse_internal_only"); - optgroup->append_single_option_line("overhang_reverse_threshold"); - optgroup = page->new_optgroup(L("Advanced")); optgroup->append_single_option_line("seam_position", category_path + "seam-position"); //Y21 @@ -2194,8 +2188,6 @@ void TabFilament::build() optgroup->append_single_option_line("filament_diameter"); optgroup->append_single_option_line("extrusion_multiplier"); optgroup->append_single_option_line("filament_density"); - //Y23 - optgroup->append_single_option_line("filament_shrink"); optgroup->append_single_option_line("filament_cost"); optgroup->append_single_option_line("filament_spool_weight"); @@ -2260,7 +2252,6 @@ void TabFilament::build() optgroup->append_line(line); optgroup->append_single_option_line("bridge_fan_speed", category_path + "fan-settings"); - optgroup->append_single_option_line("disable_fan_first_layers", category_path + "fan-settings"); //B15//Y26 line = { L("Rapido Cooling Fan Speed"), "" }; line.append_option(optgroup->get_option("enable_auxiliary_fan")); @@ -3691,7 +3682,7 @@ void TabPrinter::toggle_options() // some options only apply when not using firmware retraction vec.resize(0); //w15 - vec = {"retract_speed", "deretract_speed", "retract_before_wipe", "retract_restart_extra", "wipe", "wipe_distance"}; + vec = { "retract_speed", "deretract_speed", "retract_before_wipe", "retract_restart_extra", "wipe", "wipe_distance"}; for (auto el : vec) toggle_option(el, retraction && !use_firmware_retraction, i); @@ -3808,6 +3799,7 @@ void Tab::load_current_preset() else wxGetApp().sidebar().update_objects_list_extruder_column(1); // Check and show "Physical printer" page if needed + //y15 // wxGetApp().show_printer_webview_tab(); } // Reload preset pages with the new configuration values. @@ -3865,9 +3857,6 @@ void Tab::load_current_preset() on_presets_changed(); if (m_type == Preset::TYPE_SLA_PRINT || m_type == Preset::TYPE_PRINT) update_frequently_changed_parameters(); -//Y26 - else if (m_type == Preset::TYPE_FILAMENT) - update_frequently_filament_changed_parameters(); } m_opt_status_value = (m_presets->get_selected_preset_parent() ? osSystemValue : 0) | osInitValue; @@ -4559,6 +4548,7 @@ void Tab::delete_preset() if (printer.preset_names.size() == 1) { if (m_presets_choice->del_physical_printer(_L("It's a last preset for this physical printer."))) { // Hide "Physical printer" page + //y15 // wxGetApp().show_printer_webview_tab(); Layout(); } @@ -5096,6 +5086,8 @@ wxSizer* TabPrinter::create_bed_shape_widget(wxWindow* parent) *m_config->option("bed_exclude_area"), *m_config->option("bed_custom_texture"), *m_config->option("bed_custom_model")); + //y15 + dlg.CentreOnScreen(); if (dlg.ShowModal() == wxID_OK) { const std::vector& shape = dlg.get_shape(); //Y20 //B52 diff --git a/src/slic3r/GUI/TickCodesManager.cpp b/src/slic3r/GUI/TickCodesManager.cpp index 1916655..9d539f4 100644 --- a/src/slic3r/GUI/TickCodesManager.cpp +++ b/src/slic3r/GUI/TickCodesManager.cpp @@ -1,4 +1,3 @@ - #include "TickCodesManager.hpp" #include diff --git a/src/slic3r/GUI/TickCodesManager.hpp b/src/slic3r/GUI/TickCodesManager.hpp index 478ccdd..1b2e243 100644 --- a/src/slic3r/GUI/TickCodesManager.hpp +++ b/src/slic3r/GUI/TickCodesManager.hpp @@ -1,4 +1,3 @@ - #ifndef slic3r_GUI_TickCodesManager_hpp_ #define slic3r_GUI_TickCodesManager_hpp_ diff --git a/src/slic3r/GUI/TopBar.cpp b/src/slic3r/GUI/TopBar.cpp index 864b59d..d81c8b5 100644 --- a/src/slic3r/GUI/TopBar.cpp +++ b/src/slic3r/GUI/TopBar.cpp @@ -8,6 +8,7 @@ #include #include +//y15 #include "./libslic3r/AppConfig.hpp" wxDEFINE_EVENT(wxCUSTOMEVT_TOPBAR_SEL_CHANGED, wxCommandEvent); @@ -211,11 +212,14 @@ void TopBarItemsCtrl::ButtonWithPopup::SetLabel(const wxString& label) void TopBarItemsCtrl::UpdateAccountButton(bool avatar/* = false*/) { + //y15 std::string top_user_name = wxGetApp().app_config->get("user_name"); std::string top_user_head = wxGetApp().app_config->get("user_head_name"); const wxString user_name = !top_user_name.empty() ? from_u8(top_user_name) : _L("Log in"); m_account_btn->SetToolTip(user_name); + + //y15 //if (!top_user_name.empty()) //{ // if (!top_user_name.empty()) @@ -232,25 +236,6 @@ void TopBarItemsCtrl::UpdateAccountButton(bool avatar/* = false*/) m_account_btn->SetLabel(m_collapsed_btns ? "" : user_name); this->Layout(); - - //TopBarMenus::UserAccountInfo user_account = m_menus->get_user_account_info(); - //const wxString user_name = user_account.is_logged ? from_u8(user_account.user_name) : _L("Log in"); - //m_account_btn->SetToolTip(user_name); - //if (avatar) { - // if (user_account.is_logged) { - // ScalableBitmap new_logo(this, user_account.avatar_path, wxSize(login_icon_sz, login_icon_sz)); - // if (new_logo.IsOk()) - // m_account_btn->SetBitmapBundle(new_logo.bmp()); - // else - // m_account_btn->SetBitmapBundle(*get_bmp_bundle("user", login_icon_sz)); - // } - // else { - // m_account_btn->SetBitmapBundle(*get_bmp_bundle("user", login_icon_sz)); - // } - //} - - //m_account_btn->SetLabel(m_collapsed_btns ? "" : user_name); - //this->Layout(); } void TopBarItemsCtrl::UnselectPopupButtons() diff --git a/src/slic3r/GUI/TopBarMenus.cpp b/src/slic3r/GUI/TopBarMenus.cpp index d2a5038..8f2d76a 100644 --- a/src/slic3r/GUI/TopBarMenus.cpp +++ b/src/slic3r/GUI/TopBarMenus.cpp @@ -4,6 +4,7 @@ #include "libslic3r/Config.hpp" //ConfigOptionMode #include "GUI_Factories.hpp" #include "I18N.hpp" +//y15 #include "GUI_App.hpp" #include "./libslic3r/AppConfig.hpp" @@ -12,6 +13,7 @@ using namespace Slic3r::GUI; TopBarMenus::TopBarMenus() { CreateAccountMenu(); + //y15 // UpdateAccountMenu(); UpdateAccountState(!wxGetApp().app_config->get("user_token").empty()); @@ -106,6 +108,7 @@ void TopBarMenus::UpdateAccountMenu() } } +//y15 void TopBarMenus::UpdateAccountState(bool state) { if(state) diff --git a/src/slic3r/GUI/TopBarMenus.hpp b/src/slic3r/GUI/TopBarMenus.hpp index bd8da44..82219b2 100644 --- a/src/slic3r/GUI/TopBarMenus.hpp +++ b/src/slic3r/GUI/TopBarMenus.hpp @@ -45,7 +45,9 @@ public: void ApplyWorkspacesMenu(); void CreateAccountMenu(); void UpdateAccountMenu(); + //y15 void UpdateAccountState(bool state); + void RemoveHideLoginItem(); void Popup(TopBarItemsCtrl* popup_ctrl, wxMenu* menu, wxPoint pos); diff --git a/src/slic3r/GUI/UnsavedChangesDialog.cpp b/src/slic3r/GUI/UnsavedChangesDialog.cpp index 6053f1b..99bbe11 100644 --- a/src/slic3r/GUI/UnsavedChangesDialog.cpp +++ b/src/slic3r/GUI/UnsavedChangesDialog.cpp @@ -11,7 +11,7 @@ #include "libslic3r/PrintConfig.hpp" #include "libslic3r/PresetBundle.hpp" #include "libslic3r/Color.hpp" -#include "slic3r/GUI/Sidebar.hpp" +#include "slic3r/GUI/Sidebar.hpp" // IWYU pragma: keep #include "format.hpp" #include "GUI_App.hpp" #include "Plater.hpp" diff --git a/src/slic3r/GUI/UpdateDialogs.cpp b/src/slic3r/GUI/UpdateDialogs.cpp index c55d109..5ba0a28 100644 --- a/src/slic3r/GUI/UpdateDialogs.cpp +++ b/src/slic3r/GUI/UpdateDialogs.cpp @@ -123,6 +123,7 @@ AppUpdateAvailableDialog::AppUpdateAvailableDialog(const Semver& ver_current, co content_sizer->AddSpacer(VERT_SPACING); } + //B AUAD_size = wxSize(850, 500); content_sizer->SetMinSize(AppUpdateAvailableDialog::AUAD_size); //B @@ -147,8 +148,6 @@ wxWebView *AppUpdateAvailableDialog::CreateTipView(wxWindow *parent) return tipView; } - - bool AppUpdateAvailableDialog::disable_version_check() const { if (!cbox) @@ -335,7 +334,6 @@ MsgUpdateConfig::MsgUpdateConfig(const std::vector &updates, bool force_ if (! update.changelog_url.empty() && update.version.prerelease() == nullptr) { auto *line = new wxBoxSizer(wxHORIZONTAL); - // auto changelog_url = (boost::format(update.changelog_url) % lang_code).str(); //B51 auto changelog_url = ""; //line->AddSpacer(3*VERT_SPACING); @@ -500,14 +498,6 @@ MsgDataLegacy::MsgDataLegacy() : //content_sizer->Add(text2); //content_sizer->Add(link); //content_sizer->AddSpacer(VERT_SPACING); - auto *text2 = new wxStaticText(this, wxID_ANY, _(L("For more information please visit our wiki page:"))); - static const wxString url("https://github.com/qidi3d/QIDISlicer/wiki/Slic3r-PE-1.40-configuration-update"); - // The wiki page name is intentionally not localized: - // TRN %s = QIDISlicer - auto *link = new wxHyperlinkCtrl(this, wxID_ANY, format_wxstr(_L("%s 1.40 configuration update"), SLIC3R_APP_NAME), CONFIG_UPDATE_WIKI_URL); - content_sizer->Add(text2); - content_sizer->Add(link); - content_sizer->AddSpacer(VERT_SPACING); finalize(); } diff --git a/src/slic3r/GUI/UpdateDialogs.hpp b/src/slic3r/GUI/UpdateDialogs.hpp index ed1c1f1..f531347 100644 --- a/src/slic3r/GUI/UpdateDialogs.hpp +++ b/src/slic3r/GUI/UpdateDialogs.hpp @@ -14,7 +14,6 @@ //B44 #include - class wxBoxSizer; class wxCheckBox; @@ -53,7 +52,6 @@ public: AppUpdateAvailableDialog& operator=(const AppUpdateAvailableDialog&) = delete; virtual ~AppUpdateAvailableDialog(); - // B44 wxWebView *CreateTipView(wxWindow *parent); wxWebView *m_vebview_release_note{nullptr}; diff --git a/src/slic3r/GUI/UpdatesUIManager.cpp b/src/slic3r/GUI/UpdatesUIManager.cpp index 5fa8aa1..11c94ee 100644 --- a/src/slic3r/GUI/UpdatesUIManager.cpp +++ b/src/slic3r/GUI/UpdatesUIManager.cpp @@ -1,4 +1,3 @@ - #include "UpdatesUIManager.hpp" #include "I18N.hpp" #include "wxExtensions.hpp" diff --git a/src/slic3r/GUI/UpdatesUIManager.hpp b/src/slic3r/GUI/UpdatesUIManager.hpp index a42190b..f295ce6 100644 --- a/src/slic3r/GUI/UpdatesUIManager.hpp +++ b/src/slic3r/GUI/UpdatesUIManager.hpp @@ -1,4 +1,3 @@ - #ifndef slic3r_GUI_UpdatesUIManager_hpp_ #define slic3r_GUI_UpdatesUIManager_hpp_ diff --git a/src/slic3r/GUI/UserAccount.hpp b/src/slic3r/GUI/UserAccount.hpp index 8418af0..4988333 100644 --- a/src/slic3r/GUI/UserAccount.hpp +++ b/src/slic3r/GUI/UserAccount.hpp @@ -76,10 +76,8 @@ public: void set_current_printer_data(const std::string& data) { m_current_printer_data_json_from_connect = data; } void set_refresh_time(int seconds) { m_communication->set_refresh_time(seconds); } - - void set_username(const std::string& username); - private: + void set_username(const std::string& username); std::string m_instance_hash; // used in avatar path diff --git a/src/slic3r/GUI/WebUserLoginDialog.cpp b/src/slic3r/GUI/WebUserLoginDialog.cpp index fb713c3..060ecc9 100644 --- a/src/slic3r/GUI/WebUserLoginDialog.cpp +++ b/src/slic3r/GUI/WebUserLoginDialog.cpp @@ -23,7 +23,6 @@ #include #include -// #include #include "WebView.hpp" #if QDT_RELEASE_TO_PUBLIC #include "../QIDI/QIDINetwork.hpp" diff --git a/src/slic3r/GUI/WebView.cpp b/src/slic3r/GUI/WebView.cpp index 87f07f2..902cd43 100644 --- a/src/slic3r/GUI/WebView.cpp +++ b/src/slic3r/GUI/WebView.cpp @@ -23,10 +23,9 @@ wxWebView* WebView::CreateWebView(wxWindow * parent, const wxString& url, const wxString correct_url = url.empty() ? wxString("") : wxURI(url).BuildURI(); #ifdef __WIN32__ + //y15 //webView->SetUserAgent(SLIC3R_APP_FULL_NAME); - // webView->SetUserAgent("QIDISlicer/v1.1.7"); - //webView->SetUserAgent(wxString::Format("QIDI-Slicer/v%s (%s) Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko)", - // SLIC3R_VERSION, Slic3r::GUI::wxGetApp().dark_mode() ? "dark" : "light")); + webView->Create(parent, wxID_ANY, correct_url, wxDefaultPosition, wxDefaultSize); //We register the wxfs:// protocol for testing purposes //webView->RegisterHandler(wxSharedPtr(new wxWebViewArchiveHandler("wxfs"))); diff --git a/src/slic3r/GUI/Widgets/SpinInput.cpp b/src/slic3r/GUI/Widgets/SpinInput.cpp index b811e0e..5911ff7 100644 --- a/src/slic3r/GUI/Widgets/SpinInput.cpp +++ b/src/slic3r/GUI/Widgets/SpinInput.cpp @@ -595,7 +595,6 @@ void SpinInputDouble::onTextEnter(wxCommandEvent &event) val = value; wxString str_val = wxString::FromDouble(value, digits); text_ctrl->SetValue(str_val); - } if (!Slic3r::is_approx(value, val)) { SetValue(value); diff --git a/src/slic3r/GUI/Widgets/SwitchButton.cpp b/src/slic3r/GUI/Widgets/SwitchButton.cpp index 625816a..faacf5c 100644 --- a/src/slic3r/GUI/Widgets/SwitchButton.cpp +++ b/src/slic3r/GUI/Widgets/SwitchButton.cpp @@ -11,15 +11,14 @@ SwitchButton::SwitchButton(wxWindow* parent, const wxString& name, wxWindowID id) : BitmapToggleButton(parent, name, id) , m_on(this, "toggle_on", 28, 16) - , m_off(this, "toggle_off", 28, 16) + , m_off(this, "toggle_off", 28, 16) , text_color(std::pair{ 0x4479FB, (int) StateColor::Checked}, std::pair{0x6B6B6B, (int) StateColor::Normal}) - , track_color(0x333337) + , track_color(0x333337) , thumb_color(std::pair{0x4479FB, (int) StateColor::Checked}, std::pair{0x333337, (int) StateColor::Normal}) { Rescale(); } - void SwitchButton::SetLabels(wxString const& lbl_on, wxString const& lbl_off) { labels[0] = lbl_on; @@ -82,14 +81,11 @@ void SwitchButton::Rescale() auto size = textSize[1]; if (size.x > thumbSize.x) thumbSize.x = size.x; else size.x = thumbSize.x; - //thumbSize.x += BS * 12 *10; - //thumbSize.y += BS * 6; - thumbSize.x = m_size/2; + thumbSize.x = m_size/2; //y3 - thumbSize.y = 30; - trackSize.x = m_size; + thumbSize.y = 30; + trackSize.x = m_size; trackSize.y = 35; - auto maxWidth = GetMaxWidth(); #ifdef __WXOSX__ maxWidth *= scale; @@ -105,7 +101,6 @@ void SwitchButton::Rescale() memdc.SelectObject(bmp); memdc.SetBackground(wxBrush(GetBackgroundColour())); memdc.Clear(); - //memdc.SetFont(dc.GetFont()); memdc.SetFont(wxFont(14, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD)); auto state = i == 0 ? StateColor::Enabled : (StateColor::Checked | StateColor::Enabled); { @@ -127,20 +122,11 @@ void SwitchButton::Rescale() dc2.SetPen(wxPen(wxColour(66, 66, 69), 1)); dc2.DrawLine(trackSize.x / 2, 1, trackSize.x / 2, thumbSize.y - 1); dc2.DrawLine(0, thumbSize.y, trackSize.x, thumbSize.y); - } memdc.SetTextForeground(text_color.colorForStates(state ^ StateColor::Checked)); memdc.DrawText(labels[0], {BS + (thumbSize.x - textSize[0].x) / 2 - 7, BS + (thumbSize.y - textSize[0].y) / 2 - 4 * BS}); memdc.SetTextForeground(text_color.colorForStates(state)); memdc.DrawText(labels[1], {trackSize.x - thumbSize.x - BS + (thumbSize.x - textSize[1].x) / 2 - 4, BS + (thumbSize.y - textSize[1].y) / 2 - 4 * BS}); - - //memdc.SetPen(wxPen(wxColour(68, 121, 251))); - // if (!GetValue()) - // memdc.DrawLine(BS + BS * 10 * 7, thumbSize.y, BS + BS * 10 * 10, thumbSize.y); - // else - // memdc.DrawLine(trackSize.x - thumbSize.x + BS * 10 * 7 - BS * 4, thumbSize.y, - // trackSize.x - thumbSize.x + BS * 10 * 10 - BS * 4, thumbSize.y); - memdc.SelectObject(wxNullBitmap); #ifdef __WXOSX__ bmp = wxBitmap(bmp.ConvertToImage(), -1, scale); diff --git a/src/slic3r/GUI/Widgets/SwitchButton.hpp b/src/slic3r/GUI/Widgets/SwitchButton.hpp index d5a9d19..73dc73d 100644 --- a/src/slic3r/GUI/Widgets/SwitchButton.hpp +++ b/src/slic3r/GUI/Widgets/SwitchButton.hpp @@ -29,8 +29,6 @@ public: //B64 void SetSize(int size); - - private: void update() override; diff --git a/src/slic3r/GUI/wxExtensions.cpp b/src/slic3r/GUI/wxExtensions.cpp index 39b67c2..243994e 100644 --- a/src/slic3r/GUI/wxExtensions.cpp +++ b/src/slic3r/GUI/wxExtensions.cpp @@ -332,7 +332,6 @@ wxBitmapBundle *get_bmp_bundle_of_login(const std::string &bmp_name_in, return bmp; } - wxBitmapBundle* get_empty_bmp_bundle(int width, int height) { static Slic3r::GUI::BitmapCache cache; @@ -562,15 +561,6 @@ void ScalableBitmap::sys_color_changed() m_bmp = *get_bmp_bundle(m_icon_name, m_bmp_width, m_bmp_height); } - -//B34 -//void ScalableBitmap::msw_rescale() -//{ -// -// m_bmp = create_scaled_bitmap(m_icon_name, m_parent, m_px_cnt, m_grayscale, std::string(), false, m_resize); -//} - - // ---------------------------------------------------------------------------- // QIDIButton // ---------------------------------------------------------------------------- diff --git a/src/slic3r/GUI/wxExtensions.hpp b/src/slic3r/GUI/wxExtensions.hpp index 327d84e..fed59bb 100644 --- a/src/slic3r/GUI/wxExtensions.hpp +++ b/src/slic3r/GUI/wxExtensions.hpp @@ -127,8 +127,6 @@ public: void SetBitmap(const wxBitmapBundle& bmp) { m_bmp = bmp; } wxSize GetSize() const { return get_preferred_size(m_bmp, m_parent); } - //B34 - //void msw_rescale(); int GetWidth() const { return GetSize().GetWidth(); } int GetHeight() const { return GetSize().GetHeight(); } bool IsOk() const { return m_bmp.IsOk(); } @@ -140,9 +138,6 @@ private: std::string m_icon_name = ""; int m_bmp_width{ 16 }; int m_bmp_height{ -1 }; - //B34 - bool m_grayscale{false}; - bool m_resize{false}; }; diff --git a/src/slic3r/Utils/HexFile.cpp b/src/slic3r/Utils/HexFile.cpp index a13fcab..257aefb 100644 --- a/src/slic3r/Utils/HexFile.cpp +++ b/src/slic3r/Utils/HexFile.cpp @@ -1,7 +1,7 @@ #include "HexFile.hpp" #include -#include +#include // IWYU pragma: keep #include #include diff --git a/src/slic3r/Utils/Http.cpp b/src/slic3r/Utils/Http.cpp index 5a624c4..5c92ae4 100644 --- a/src/slic3r/Utils/Http.cpp +++ b/src/slic3r/Utils/Http.cpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include // IWYU pragma: keep #include #include #include diff --git a/src/slic3r/Utils/MacDarkMode.hpp b/src/slic3r/Utils/MacDarkMode.hpp index 9a450c1..27619ef 100644 --- a/src/slic3r/Utils/MacDarkMode.hpp +++ b/src/slic3r/Utils/MacDarkMode.hpp @@ -9,13 +9,6 @@ namespace GUI { #if __APPLE__ extern bool mac_dark_mode(); extern double mac_max_scaling_factor(); -extern void set_miniaturizable(void * window); -void WKWebView_evaluateJavaScript(void * web, wxString const & script, void (*callback)(wxString const &)); -void WKWebView_setTransparentBackground(void * web); -void set_tag_when_enter_full_screen(bool isfullscreen); -void set_title_colour_after_set_title(void * window); -void initGestures(void * view, wxEvtHandler * handler); -void openFolderForFile(wxString const & file); #endif diff --git a/src/slic3r/Utils/MacDarkMode.mm b/src/slic3r/Utils/MacDarkMode.mm index e539053..6eca932 100644 --- a/src/slic3r/Utils/MacDarkMode.mm +++ b/src/slic3r/Utils/MacDarkMode.mm @@ -1,5 +1,4 @@ #import "MacDarkMode.hpp" -#include "../GUI/Widgets/Label.hpp" #include "wx/osx/core/cfstring.h" @@ -10,8 +9,6 @@ #import #import -#include - @interface MacDarkMode : NSObject {} @end @@ -20,9 +17,6 @@ namespace Slic3r { namespace GUI { -NSTextField* mainframe_text_field = nil; -bool is_in_full_screen_mode = false; - bool mac_dark_mode() { NSString *style = [[NSUserDefaults standardUserDefaults] stringForKey:@"AppleInterfaceStyle"]; @@ -41,47 +35,6 @@ double mac_max_scaling_factor() } return scaling; } - -void set_miniaturizable(void * window) -{ - CGFloat rFloat = 34/255.0; - CGFloat gFloat = 34/255.0; - CGFloat bFloat = 36/255.0; - [(NSView*) window window].titlebarAppearsTransparent = true; - [(NSView*) window window].backgroundColor = [NSColor colorWithCalibratedRed:rFloat green:gFloat blue:bFloat alpha:1.0]; - [(NSView*) window window].styleMask |= NSMiniaturizableWindowMask; - - NSEnumerator *viewEnum = [[[[[[[(NSView*) window window] contentView] superview] titlebarViewController] view] subviews] objectEnumerator]; - NSView *viewObject; - - while(viewObject = (NSView *)[viewEnum nextObject]) { - if([viewObject class] == [NSTextField self]) { - //[(NSTextField*)viewObject setTextColor : NSColor.whiteColor]; - mainframe_text_field = viewObject; - } - } -} - -void set_tag_when_enter_full_screen(bool isfullscreen) -{ - is_in_full_screen_mode = isfullscreen; -} - -void set_title_colour_after_set_title(void * window) -{ - NSEnumerator *viewEnum = [[[[[[[(NSView*) window window] contentView] superview] titlebarViewController] view] subviews] objectEnumerator]; - NSView *viewObject; - while(viewObject = (NSView *)[viewEnum nextObject]) { - if([viewObject class] == [NSTextField self]) { - [(NSTextField*)viewObject setTextColor : NSColor.whiteColor]; - mainframe_text_field = viewObject; - } - } - - if (mainframe_text_field) { - [(NSTextField*)mainframe_text_field setTextColor : NSColor.whiteColor]; - } -} void WKWebView_evaluateJavaScript(void * web, wxString const & script, void (*callback)(wxString const &)) { @@ -92,276 +45,8 @@ void WKWebView_evaluateJavaScript(void * web, wxString const & script, void (*ca } }]; } - -void WKWebView_setTransparentBackground(void * web) -{ - WKWebView * webView = (WKWebView*)web; - [webView layer].backgroundColor = [NSColor clearColor].CGColor; -} -void openFolderForFile(wxString const & file) -{ - NSArray *fileURLs = [NSArray arrayWithObjects:wxCFStringRef(file).AsNSString(), /* ... */ nil]; - [[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs:fileURLs]; -} - } } @end - -/* textColor for NSTextField */ -@implementation NSTextField (textColor) - -- (void)setTextColor2:(NSColor *)textColor -{ - if (Slic3r::GUI::mainframe_text_field != self){ - [self setTextColor2: textColor]; - }else{ - if(Slic3r::GUI::is_in_full_screen_mode){ - [self setTextColor2 : NSColor.darkGrayColor]; - }else{ - [self setTextColor2 : NSColor.whiteColor]; - } - } -} - - -+ (void) load -{ - Method setTextColor = class_getInstanceMethod([NSTextField class], @selector(setTextColor:)); - Method setTextColor2 = class_getInstanceMethod([NSTextField class], @selector(setTextColor2:)); - method_exchangeImplementations(setTextColor, setTextColor2); -} - -@end - -/* drawsBackground for NSTextField */ -@implementation NSTextField (drawsBackground) - -- (instancetype)initWithFrame2:(NSRect)frameRect -{ - [self initWithFrame2:frameRect]; - self.drawsBackground = false; - return self; -} - - -+ (void) load -{ - Method initWithFrame = class_getInstanceMethod([NSTextField class], @selector(initWithFrame:)); - Method initWithFrame2 = class_getInstanceMethod([NSTextField class], @selector(initWithFrame2:)); - method_exchangeImplementations(initWithFrame, initWithFrame2); -} - -@end - -/* textColor for NSButton */ - -@implementation NSButton (NSButton_Extended) - -- (NSColor *)textColor -{ - NSAttributedString *attrTitle = [self attributedTitle]; - int len = [attrTitle length]; - NSRange range = NSMakeRange(0, MIN(len, 1)); // get the font attributes from the first character - NSDictionary *attrs = [attrTitle fontAttributesInRange:range]; - NSColor *textColor = [NSColor controlTextColor]; - if (attrs) - { - textColor = [attrs objectForKey:NSForegroundColorAttributeName]; - } - - return textColor; -} - -- (void)setTextColor:(NSColor *)textColor -{ - NSMutableAttributedString *attrTitle = - [[NSMutableAttributedString alloc] initWithAttributedString:[self attributedTitle]]; - int len = [attrTitle length]; - NSRange range = NSMakeRange(0, len); - [attrTitle addAttribute:NSForegroundColorAttributeName value:textColor range:range]; - [attrTitle fixAttributesInRange:range]; - [self setAttributedTitle:attrTitle]; - [attrTitle release]; -} - -- (void)setBezelStyle2:(NSBezelStyle)bezelStyle -{ - if (bezelStyle != NSBezelStyleShadowlessSquare) - [self setBordered: YES]; - [self setBezelStyle2: bezelStyle]; -} - -+ (void) load -{ - Method setBezelStyle = class_getInstanceMethod([NSButton class], @selector(setBezelStyle:)); - Method setBezelStyle2 = class_getInstanceMethod([NSButton class], @selector(setBezelStyle2:)); - method_exchangeImplementations(setBezelStyle, setBezelStyle2); -} - -- (NSFocusRingType) focusRingType -{ - return NSFocusRingTypeNone; -} - -@end - -/* edit column for wxCocoaOutlineView */ - -#include -#include -#include - -@implementation wxCocoaOutlineView (Edit) - -bool addObserver = false; - -- (BOOL)outlineView: (NSOutlineView*) view shouldEditTableColumn:(nullable NSTableColumn *)tableColumn item:(nonnull id)item -{ - NSClipView * clipView = [[self enclosingScrollView] contentView]; - if (!addObserver) { - addObserver = true; - clipView.postsBoundsChangedNotifications = YES; - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(synchronizedViewContentBoundsDidChange:) - name:NSViewBoundsDidChangeNotification - object:clipView]; - } - - wxDataViewColumn* const col((wxDataViewColumn *)[tableColumn getColumnPointer]); - wxDataViewItem item2([static_cast(item) pointer]); - - wxDataViewCtrl* const dvc = implementation->GetDataViewCtrl(); - // Before doing anything we send an event asking if editing of this item is really wanted. - wxDataViewEvent event(wxEVT_DATAVIEW_ITEM_EDITING_STARTED, dvc, col, item2); - dvc->GetEventHandler()->ProcessEvent( event ); - if( !event.IsAllowed() ) - return NO; - - return YES; -} - -- (void)synchronizedViewContentBoundsDidChange:(NSNotification *)notification -{ - wxDataViewCtrl* const dvc = implementation->GetDataViewCtrl(); - wxDataViewCustomRenderer * r = dvc->GetCustomRendererPtr(); - if (r) - r->FinishEditing(); -} - -@end - -/* Font for wxTextCtrl */ - -@implementation NSTableHeaderCell (Font) - -- (NSFont*) font -{ - return Label::sysFont(13).OSXGetNSFont(); -} - -@end - -/* remove focused border for wxTextCtrl */ - -@implementation NSTextField (FocusRing) - -- (NSFocusRingType) focusRingType -{ - return NSFocusRingTypeNone; -} - -@end - -/* gesture handle for Canvas3D */ - -@interface wxNSCustomOpenGLView : NSOpenGLView -{ -} -@end - - -@implementation wxNSCustomOpenGLView (Gesture) - -wxEvtHandler * _gestureHandler = nullptr; - -- (void) onGestureMove: (NSPanGestureRecognizer*) gesture -{ - wxPanGestureEvent evt; - NSPoint tr = [gesture translationInView: self]; - evt.SetDelta({(int) tr.x, (int) tr.y}); - [self postEvent:evt withGesture:gesture]; -} - -- (void) onGestureScale: (NSMagnificationGestureRecognizer*) gesture -{ - wxZoomGestureEvent evt; - evt.SetZoomFactor(gesture.magnification + 1.0); - [self postEvent:evt withGesture:gesture]; -} - -- (void) onGestureRotate: (NSRotationGestureRecognizer*) gesture -{ - wxRotateGestureEvent evt; - evt.SetRotationAngle(-gesture.rotation); - [self postEvent:evt withGesture:gesture]; -} - -- (void) postEvent: (wxGestureEvent &) evt withGesture: (NSGestureRecognizer* ) gesture -{ - NSPoint pos = [gesture locationInView: self]; - evt.SetPosition({(int) pos.x, (int) pos.y}); - if (gesture.state == NSGestureRecognizerStateBegan) - evt.SetGestureStart(); - else if (gesture.state == NSGestureRecognizerStateEnded) - evt.SetGestureEnd(); - _gestureHandler->ProcessEvent(evt); -} - -- (void) scrollWheel2:(NSEvent *)event -{ - bool shiftDown = [event modifierFlags] & NSShiftKeyMask; - if (_gestureHandler && shiftDown && event.hasPreciseScrollingDeltas) { - wxPanGestureEvent evt; - evt.SetDelta({-(int)[event scrollingDeltaX], - (int)[event scrollingDeltaY]}); - _gestureHandler->ProcessEvent(evt); - } else { - [self scrollWheel2: event]; - } -} - -+ (void) load -{ - Method scrollWheel = class_getInstanceMethod([wxNSCustomOpenGLView class], @selector(scrollWheel:)); - Method scrollWheel2 = class_getInstanceMethod([wxNSCustomOpenGLView class], @selector(scrollWheel2:)); - method_exchangeImplementations(scrollWheel, scrollWheel2); -} - -- (void) initGesturesWithHandler: (wxEvtHandler*) handler -{ -// NSPanGestureRecognizer * pan = [[NSPanGestureRecognizer alloc] initWithTarget: self action: @selector(onGestureMove:)]; -// pan.numberOfTouchesRequired = 2; -// pan.allowedTouchTypes = 0; -// NSMagnificationGestureRecognizer * magnification = [[NSMagnificationGestureRecognizer alloc] initWithTarget: self action: @selector(onGestureScale:)]; -// NSRotationGestureRecognizer * rotation = [[NSRotationGestureRecognizer alloc] initWithTarget: self action: @selector(onGestureRotate:)]; -// [self addGestureRecognizer:pan]; -// [self addGestureRecognizer:magnification]; -// [self addGestureRecognizer:rotation]; - _gestureHandler = handler; -} - -@end - -namespace Slic3r { -namespace GUI { - -void initGestures(void * view, wxEvtHandler * handler) -{ - wxNSCustomOpenGLView * glView = (wxNSCustomOpenGLView *) view; - [glView initGesturesWithHandler: handler]; -} - -} -} diff --git a/src/slic3r/Utils/Moonraker.cpp b/src/slic3r/Utils/Moonraker.cpp index e76a15d..adffabf 100644 --- a/src/slic3r/Utils/Moonraker.cpp +++ b/src/slic3r/Utils/Moonraker.cpp @@ -65,15 +65,15 @@ std::string substitute_host(const std::string& orig_addr, std::string sub_addr) return out; } #endif -} // namespace +} //B55 -Moonraker::Moonraker(DynamicPrintConfig *config, bool add_port) - : m_host(add_port ? config->opt_string("print_host").find(":10088") == std::string::npos ? config->opt_string("print_host") + ":10088" : - config->opt_string("print_host") : - config->opt_string("print_host")) - , m_apikey(config->opt_string("printhost_apikey")) - , m_cafile(config->opt_string("printhost_cafile")) - , m_ssl_revoke_best_effort(config->opt_bool("printhost_ssl_ignore_revoke")) +Moonraker::Moonraker(DynamicPrintConfig *config, bool add_port) : + m_host(add_port ? config->opt_string("print_host").find(":10088") == std::string::npos ? config->opt_string("print_host") + ":10088" : + config->opt_string("print_host") : + config->opt_string("print_host")), + m_apikey(config->opt_string("printhost_apikey")), + m_cafile(config->opt_string("printhost_cafile")), + m_ssl_revoke_best_effort(config->opt_bool("printhost_ssl_ignore_revoke")) {} //B64 Moonraker::Moonraker(std::string host, std::string local_ip) @@ -478,7 +478,7 @@ void Moonraker::set_auth(Http &http) const if (!m_cafile.empty()) http.ca_file(m_cafile); } -//B52 + std::string Moonraker::make_url(const std::string &path) const { if (m_host.find("http://") == 0 || m_host.find("https://") == 0) { diff --git a/src/slic3r/Utils/Moonraker.hpp b/src/slic3r/Utils/Moonraker.hpp index 31734b3..0e4724b 100644 --- a/src/slic3r/Utils/Moonraker.hpp +++ b/src/slic3r/Utils/Moonraker.hpp @@ -40,7 +40,8 @@ public: bool has_auto_discovery() const override { return true; } bool can_test() const override { return true; } PrintHostPostUploadActions get_post_upload_actions() const override { return PrintHostPostUploadAction::StartPrint; } - std::string get_host() const override { return m_show_ip != "" ? m_show_ip : m_host; } + //y + std::string get_host() const override { return m_show_ip != "" ? m_show_ip : m_host; } const std::string& get_apikey() const { return m_apikey; } const std::string& get_cafile() const { return m_cafile; } //y6 diff --git a/src/slic3r/Utils/PresetUpdater.cpp b/src/slic3r/Utils/PresetUpdater.cpp index 0b03278..2f11dcd 100644 --- a/src/slic3r/Utils/PresetUpdater.cpp +++ b/src/slic3r/Utils/PresetUpdater.cpp @@ -903,11 +903,6 @@ Updates PresetUpdater::priv::get_config_updates(const Semver &old_slic3r_version new_update = Update(std::move(path_in_rsrc), std::move(bundle_path), *recommended, vp.name, vp.changelog_url, current_not_supported); bundle_path_idx_to_install = path_idx_in_rsrc; found = true; -//Y24 - } else if (rsrc_vp.config_version > vp.config_version) { - new_update = Update(std::move(path_in_rsrc), std::move(bundle_path), *recommended, vp.name, vp.changelog_url, current_not_supported); - bundle_path_idx_to_install = path_idx_in_rsrc; - found = true; } else { BOOST_LOG_TRIVIAL(warning) << format("The recommended config version for vendor `%1%` in resources does not match the recommended\n" " config version for this version of QIDISlicer. Corrupted installation?", idx.vendor()); diff --git a/src/slic3r/Utils/PrintHost.cpp b/src/slic3r/Utils/PrintHost.cpp index 162ac50..dd2d115 100644 --- a/src/slic3r/Utils/PrintHost.cpp +++ b/src/slic3r/Utils/PrintHost.cpp @@ -22,10 +22,11 @@ #include "Moonraker.hpp" #include "QIDIConnect.hpp" #include "../GUI/PrintHostDialogs.hpp" -#include "../GUI/GUI_App.hpp" // B64 #include +#include "../GUI/GUI_App.hpp" + namespace fs = boost::filesystem; using boost::optional; using Slic3r::GUI::PrintHostQueueDialog; @@ -221,6 +222,7 @@ void PrintHostJobQueue::priv::bg_thread_main() remove_source(); job_id++; + //B64 if (channel_jobs.size_hint() == 0) { GUI::wxGetApp().plater()->resetUploadCount(); } @@ -237,7 +239,6 @@ void PrintHostJobQueue::priv::bg_thread_main() } } -//B64 void PrintHostJobQueue::priv::progress_fn(Http::Progress progress, bool &cancel) { if (cancel) { @@ -278,6 +279,7 @@ void PrintHostJobQueue::priv::progress_fn(Http::Progress progress, bool &cancel) emit_progress(gui_progress); prev_progress = gui_progress; } + //B64 for (int i = 0; i < vec_jobs.size(); i++) { std::chrono::system_clock::time_point curr_time = std::chrono::system_clock::now(); auto diff = std::chrono::duration_cast(curr_time - vec_jobs[i].create_time); @@ -316,7 +318,7 @@ bool PrintHostJobQueue::priv::cancel_fn() } return cancel; } -//B64 + void PrintHostJobQueue::priv::error_fn(wxString error) { // check if transfer was not canceled before error occured - than do not show the error @@ -406,7 +408,7 @@ void PrintHostJobQueue::priv::perform_job(PrintHostJob the_job) if (success) { emit_progress(100); } - } + } } //B64 diff --git a/src/slic3r/Utils/Repetier.cpp b/src/slic3r/Utils/Repetier.cpp index 61b9071..6ffac9b 100644 --- a/src/slic3r/Utils/Repetier.cpp +++ b/src/slic3r/Utils/Repetier.cpp @@ -41,7 +41,7 @@ static bool validate_repetier(const boost::optional& name, const boost::optional& soft) { if (soft) { - // See https://github.com/qidi3d/QIDISlicer/issues/7807: + // See https://github.com/QIDITECH/QIDISlicer/issues/7807: // Repetier allows "rebranding", so the "name" value is not reliable when detecting // server type. Newer Repetier versions send "software", which should be invariant. return ((*soft) == "Repetier-Server"); @@ -148,7 +148,7 @@ bool Repetier::upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, Error if(upload_data.post_action == PrintHostPostUploadAction::StartPrint) { http.form_add("name", upload_filename.string()); - http.form_add("autostart", "true"); // See https://github.com/qidi3d/QIDISlicer/issues/7807#issuecomment-1235519371 + http.form_add("autostart", "true"); // See https://github.com/QIDITECH/QIDISlicer/issues/7807#issuecomment-1235519371 } http.form_add("a", "upload") diff --git a/src/slic3r/Utils/UndoRedo.cpp b/src/slic3r/Utils/UndoRedo.cpp index c073fa6..ceda960 100644 --- a/src/slic3r/Utils/UndoRedo.cpp +++ b/src/slic3r/Utils/UndoRedo.cpp @@ -1,11 +1,11 @@ #include "UndoRedo.hpp" -#include -#include -#include -#include -#include -#include +#include // IWYU pragma: keep +#include // IWYU pragma: keep +#include // IWYU pragma: keep +#include // IWYU pragma: keep +#include // IWYU pragma: keep +#include // IWYU pragma: keep #include #include #include @@ -21,7 +21,7 @@ #include #include -#include "slic3r/GUI/3DScene.hpp" +#include "slic3r/GUI/3DScene.hpp" // IWYU pragma: keep #include "libslic3r/BoundingBox.hpp" #include "libslic3r/Exception.hpp" #if 0 @@ -692,8 +692,8 @@ using OutputArchive = cereal::UserDataAdapter -#include -#include -#include +#include // IWYU pragma: keep +#include // IWYU pragma: keep +#include // IWYU pragma: keep +#include // IWYU pragma: keep namespace Slic3r { namespace UndoRedo { diff --git a/src/slic3r/Utils/WxFontUtils.cpp b/src/slic3r/Utils/WxFontUtils.cpp index 0368c21..f8dcc0f 100644 --- a/src/slic3r/Utils/WxFontUtils.cpp +++ b/src/slic3r/Utils/WxFontUtils.cpp @@ -6,7 +6,7 @@ #include #include -#include "libslic3r/Utils.hpp" +#include "libslic3r/Utils.hpp" // IWYU pragma: keep #include "libslic3r/Emboss.hpp" #include "libslic3r/Exception.hpp" diff --git a/tests/fff_print/test_perimeters.cpp b/tests/fff_print/test_perimeters.cpp index d0e5a9e..ca6fbbc 100644 --- a/tests/fff_print/test_perimeters.cpp +++ b/tests/fff_print/test_perimeters.cpp @@ -94,10 +94,9 @@ SCENARIO("Perimeter nesting", "[Perimeters]") ext_order.emplace_back(ee->role() == ExtrusionRole::ExternalPerimeter); REQUIRE(ext_order == data.ext_order); } - //w38 THEN("expected number of internal contour loops") { size_t cinternal = std::count_if(loops.entities.begin(), loops.entities.end(), - [](const ExtrusionEntity *ee){ return dynamic_cast(ee)->loop_role() == elrDefault; }); + [](const ExtrusionEntity *ee){ return dynamic_cast(ee)->loop_role() == elrContourInternalPerimeter; }); REQUIRE(cinternal == data.cinternal); } THEN("expected number of ccw loops") {