From c140974bf40b34345191a79d85410ea62898c2b7 Mon Sep 17 00:00:00 2001 From: David Kocik Date: Fri, 26 Mar 2021 09:18:07 +0100 Subject: Changed ToolpathOuside error notification from plater to slicing error notification type so it is grayed out correctly --- src/slic3r/GUI/GLCanvas3D.cpp | 38 ++++++++++++++++++++++++---------- src/slic3r/GUI/NotificationManager.cpp | 8 +++++++ src/slic3r/GUI/NotificationManager.hpp | 1 + 3 files changed, 36 insertions(+), 11 deletions(-) (limited to 'src/slic3r/GUI') diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 2149f21e7..fa3d96420 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -6314,31 +6314,47 @@ std::vector GLCanvas3D::_parse_colors(const std::vector& col #if ENABLE_WARNING_TEXTURE_REMOVAL void GLCanvas3D::_set_warning_notification(EWarning warning, bool state) { + enum ErrorType{ + PLATER_WARNING, + PLATER_ERROR, + SLICING_ERROR + }; std::string text; - bool error = false; + ErrorType error = ErrorType::PLATER_WARNING; switch (warning) { case EWarning::ObjectOutside: text = _u8L("An object outside the print area was detected."); break; - case EWarning::ToolpathOutside: text = _u8L("A toolpath outside the print area was detected."); error = true; break; - case EWarning::SlaSupportsOutside: text = _u8L("SLA supports outside the print area were detected."); error = true; break; + case EWarning::ToolpathOutside: text = _u8L("A toolpath outside the print area was detected."); error = ErrorType::SLICING_ERROR; break; + case EWarning::SlaSupportsOutside: text = _u8L("SLA supports outside the print area were detected."); error = ErrorType::PLATER_ERROR; break; case EWarning::SomethingNotShown: text = _u8L("Some objects are not visible."); break; case EWarning::ObjectClashed: text = _u8L("An object outside the print area was detected.\n" "Resolve the current problem to continue slicing."); - error = true; + error = ErrorType::PLATER_ERROR; break; } auto& notification_manager = *wxGetApp().plater()->get_notification_manager(); - if (state) { - if (error) + switch (error) + { + case PLATER_WARNING: + if (state) + notification_manager.push_plater_warning_notification(text); + else + notification_manager.close_plater_warning_notification(text); + break; + case PLATER_ERROR: + if (state) notification_manager.push_plater_error_notification(text); else - notification_manager.push_plater_warning_notification(text); - } - else { - if (error) notification_manager.close_plater_error_notification(text); + break; + case SLICING_ERROR: + if (state) + notification_manager.push_slicing_error_notification(text); else - notification_manager.close_plater_warning_notification(text); + notification_manager.close_slicing_error_notification(text); + break; + default: + break; } } #else diff --git a/src/slic3r/GUI/NotificationManager.cpp b/src/slic3r/GUI/NotificationManager.cpp index 6c5918fde..144c89a1e 100644 --- a/src/slic3r/GUI/NotificationManager.cpp +++ b/src/slic3r/GUI/NotificationManager.cpp @@ -1072,6 +1072,14 @@ void NotificationManager::close_slicing_errors_and_warnings() } } } +void NotificationManager::close_slicing_error_notification(const std::string& text) +{ + for (std::unique_ptr& notification : m_pop_notifications) { + if (notification->get_type() == NotificationType::SlicingError && notification->compare_text(_u8L("ERROR:") + "\n" + text)) { + notification->close(); + } + } +} void NotificationManager::push_slicing_complete_notification(int timestamp, bool large) { std::string hypertext; diff --git a/src/slic3r/GUI/NotificationManager.hpp b/src/slic3r/GUI/NotificationManager.hpp index 95532c94e..74ebedde2 100644 --- a/src/slic3r/GUI/NotificationManager.hpp +++ b/src/slic3r/GUI/NotificationManager.hpp @@ -125,6 +125,7 @@ public: // void set_slicing_warning_gray(const std::string& text, bool g); // immediately stops showing slicing errors void close_slicing_errors_and_warnings(); + void close_slicing_error_notification(const std::string& text); // Release those slicing warnings, which refer to an ObjectID, which is not in the list. // living_oids is expected to be sorted. void remove_slicing_warnings_of_released_objects(const std::vector& living_oids); -- cgit v1.2.3