From 661534042b683bdb8d2624eaa7a5a140da271965 Mon Sep 17 00:00:00 2001 From: David Kocik Date: Mon, 21 Sep 2020 13:47:18 +0200 Subject: [PATCH] notifications: changed some plater warnings into errors, fixed not showing plater warnings in preview. --- src/slic3r/GUI/GLCanvas3D.cpp | 6 +++--- src/slic3r/GUI/NotificationManager.cpp | 9 +++++---- src/slic3r/GUI/NotificationManager.hpp | 5 +++-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index a3b4be9a7..c138b937c 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -628,8 +628,8 @@ void GLCanvas3D::WarningTexture::activate(WarningTexture::Warning warning, bool bool error = false; switch (warning) { case ObjectOutside: text = L("An object outside the print area was detected."); break; - case ToolpathOutside: text = L("A toolpath outside the print area was detected."); break; - case SlaSupportsOutside: text = L("SLA supports outside the print area were detected."); break; + case ToolpathOutside: text = L("A toolpath outside the print area was detected."); error = true; break; + case SlaSupportsOutside: text = L("SLA supports outside the print area were detected."); error = true; break; case SomethingNotShown: text = L("Some objects are not visible."); break; case ObjectClashed: text = L( "An object outside the print area was detected.\n" @@ -644,7 +644,7 @@ void GLCanvas3D::WarningTexture::activate(WarningTexture::Warning warning, bool wxGetApp().plater()->get_notification_manager()->push_plater_warning_notification(text, *(wxGetApp().plater()->get_current_canvas3D())); } else { if (error) - wxGetApp().plater()->get_notification_manager()->close_plater_error_notification(); + wxGetApp().plater()->get_notification_manager()->close_plater_error_notification(text); else wxGetApp().plater()->get_notification_manager()->close_plater_warning_notification(text); } diff --git a/src/slic3r/GUI/NotificationManager.cpp b/src/slic3r/GUI/NotificationManager.cpp index d5ab9ee1a..b9e7c7a6f 100644 --- a/src/slic3r/GUI/NotificationManager.cpp +++ b/src/slic3r/GUI/NotificationManager.cpp @@ -56,8 +56,7 @@ NotificationManager::PopNotification::~PopNotification() } NotificationManager::PopNotification::RenderResult NotificationManager::PopNotification::render(GLCanvas3D& canvas, const float& initial_y) { - if (!m_initialized) - { + if (!m_initialized) { init(); } if (m_finished) @@ -682,11 +681,13 @@ void NotificationManager::push_plater_error_notification(const std::string& text void NotificationManager::push_plater_warning_notification(const std::string& text, GLCanvas3D& canvas) { push_notification_data({ NotificationType::PlaterWarning, NotificationLevel::WarningNotification, 0, _u8L("WARNING:") + "\n" + text }, canvas, 0); + // dissaper if in preview + set_in_preview(m_in_preview); } -void NotificationManager::close_plater_error_notification() +void NotificationManager::close_plater_error_notification(const std::string& text) { for (PopNotification* notification : m_pop_notifications) { - if (notification->get_type() == NotificationType::PlaterError) { + if (notification->get_type() == NotificationType::PlaterError && notification->compare_text(_u8L("ERROR:") + "\n" + text)) { notification->close(); } } diff --git a/src/slic3r/GUI/NotificationManager.hpp b/src/slic3r/GUI/NotificationManager.hpp index a11d08394..c2cbc242c 100644 --- a/src/slic3r/GUI/NotificationManager.hpp +++ b/src/slic3r/GUI/NotificationManager.hpp @@ -220,7 +220,8 @@ public: void compare_warning_oids(const std::vector& living_oids); void push_plater_error_notification(const std::string& text, GLCanvas3D& canvas); void push_plater_warning_notification(const std::string& text, GLCanvas3D& canvas); - void close_plater_error_notification(); + // Closes error or warning of same text + void close_plater_error_notification(const std::string& text); void close_plater_warning_notification(const std::string& text); // creates special notification slicing complete // if large = true prints printing time and export button @@ -250,7 +251,7 @@ private: bool m_hovered { false }; //timestamps used for slining finished - notification could be gone so it needs to be stored here std::unordered_set m_used_timestamps; - bool m_in_preview; + bool m_in_preview { false }; //prepared (basic) notifications const std::vector basic_notifications = {