Notification manager - apply_in_preview function

This commit is contained in:
David Kocik 2021-03-18 12:42:42 +01:00
parent a6cf840540
commit 7c7c355376
3 changed files with 5 additions and 4 deletions

View File

@ -677,12 +677,11 @@ void Preview::update_layers_slider(const std::vector<double>& layers_z, bool kee
_u8L("NOTE:") + "\n" + _u8L("Sliced object looks like the sign") + "\n", _u8L("NOTE:") + "\n" + _u8L("Sliced object looks like the sign") + "\n",
_u8L("Apply auto color change to print"), _u8L("Apply auto color change to print"),
[this, notif_mngr](wxEvtHandler*) { [this, notif_mngr](wxEvtHandler*) {
notif_mngr->close_notification_of_type(NotificationType::SignDetected);
m_layers_slider->auto_color_change(); m_layers_slider->auto_color_change();
return true; return true;
}); });
notif_mngr->set_in_preview(true); notif_mngr->apply_in_preview();
break; break;
} }

View File

@ -1014,7 +1014,7 @@ void NotificationManager::push_plater_warning_notification(const std::string& te
auto notification = std::make_unique<NotificationManager::PlaterWarningNotification>(data, m_id_provider, m_evt_handler); auto notification = std::make_unique<NotificationManager::PlaterWarningNotification>(data, m_id_provider, m_evt_handler);
push_notification_data(std::move(notification), 0); push_notification_data(std::move(notification), 0);
// dissaper if in preview // dissaper if in preview
set_in_preview(m_in_preview); apply_in_preview();
} }
void NotificationManager::close_plater_warning_notification(const std::string& text) void NotificationManager::close_plater_warning_notification(const std::string& text)

View File

@ -159,8 +159,10 @@ public:
void render_notifications(GLCanvas3D& canvas, float overlay_width); void render_notifications(GLCanvas3D& canvas, float overlay_width);
// finds and closes all notifications of given type // finds and closes all notifications of given type
void close_notification_of_type(const NotificationType 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); 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. // Move to left to avoid colision with variable layer height gizmo.
void set_move_from_overlay(bool move) { m_move_from_overlay = move; } 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 // perform update_state on each notification and ask for more frames if needed, return true for render needed