From 7c7c3553763bc85a4a45226a03ca5dcb8ad7662d Mon Sep 17 00:00:00 2001 From: David Kocik Date: Thu, 18 Mar 2021 12:42:42 +0100 Subject: [PATCH] Notification manager - apply_in_preview function --- src/slic3r/GUI/GUI_Preview.cpp | 3 +-- src/slic3r/GUI/NotificationManager.cpp | 2 +- src/slic3r/GUI/NotificationManager.hpp | 4 +++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/slic3r/GUI/GUI_Preview.cpp b/src/slic3r/GUI/GUI_Preview.cpp index 8bda3b8e6..224ccfc36 100644 --- a/src/slic3r/GUI/GUI_Preview.cpp +++ b/src/slic3r/GUI/GUI_Preview.cpp @@ -677,12 +677,11 @@ void Preview::update_layers_slider(const std::vector& layers_z, bool kee _u8L("NOTE:") + "\n" + _u8L("Sliced object looks like the sign") + "\n", _u8L("Apply auto color change to print"), [this, notif_mngr](wxEvtHandler*) { - notif_mngr->close_notification_of_type(NotificationType::SignDetected); m_layers_slider->auto_color_change(); return true; }); - notif_mngr->set_in_preview(true); + notif_mngr->apply_in_preview(); break; } diff --git a/src/slic3r/GUI/NotificationManager.cpp b/src/slic3r/GUI/NotificationManager.cpp index 358f709a7..e83a0014c 100644 --- a/src/slic3r/GUI/NotificationManager.cpp +++ b/src/slic3r/GUI/NotificationManager.cpp @@ -1014,7 +1014,7 @@ void NotificationManager::push_plater_warning_notification(const std::string& te auto notification = std::make_unique(data, m_id_provider, m_evt_handler); push_notification_data(std::move(notification), 0); // dissaper if in preview - set_in_preview(m_in_preview); + apply_in_preview(); } void NotificationManager::close_plater_warning_notification(const std::string& text) diff --git a/src/slic3r/GUI/NotificationManager.hpp b/src/slic3r/GUI/NotificationManager.hpp index 83d94d907..4f3900aeb 100644 --- a/src/slic3r/GUI/NotificationManager.hpp +++ b/src/slic3r/GUI/NotificationManager.hpp @@ -159,8 +159,10 @@ public: void render_notifications(GLCanvas3D& canvas, float overlay_width); // finds and closes all notifications of given type void close_notification_of_type(const NotificationType type); - // Which view is active? Plater or G-code preview? Hide warnings in G-code preview. + // Hides warnings in G-code preview. Should be called from plater only when 3d view/ preview is changed void set_in_preview(bool preview); + // Calls set_in_preview to apply appearing or disappearing of some notificatons; + void apply_in_preview() { set_in_preview(m_in_preview); } // Move to left to avoid colision with variable layer height gizmo. void set_move_from_overlay(bool move) { m_move_from_overlay = move; } // perform update_state on each notification and ask for more frames if needed, return true for render needed