diff --git a/resources/icons/notification_close.svg b/resources/icons/notification_close.svg
new file mode 100644
index 000000000..708d8bfef
--- /dev/null
+++ b/resources/icons/notification_close.svg
@@ -0,0 +1,18 @@
+
+
+
diff --git a/resources/icons/notification_close_hover.svg b/resources/icons/notification_close_hover.svg
new file mode 100644
index 000000000..a04dce21a
--- /dev/null
+++ b/resources/icons/notification_close_hover.svg
@@ -0,0 +1,66 @@
+
+
diff --git a/resources/icons/notification_error.svg b/resources/icons/notification_error.svg
new file mode 100644
index 000000000..5356e7af6
--- /dev/null
+++ b/resources/icons/notification_error.svg
@@ -0,0 +1,71 @@
+
+
diff --git a/resources/icons/notification_minimalize.svg b/resources/icons/notification_minimalize.svg
new file mode 100644
index 000000000..bb3ae9b7a
--- /dev/null
+++ b/resources/icons/notification_minimalize.svg
@@ -0,0 +1,14 @@
+
+
+
diff --git a/resources/icons/notification_minimalize_hover.svg b/resources/icons/notification_minimalize_hover.svg
new file mode 100644
index 000000000..bc5bc6cca
--- /dev/null
+++ b/resources/icons/notification_minimalize_hover.svg
@@ -0,0 +1,58 @@
+
+
diff --git a/resources/icons/notification_warning.svg b/resources/icons/notification_warning.svg
new file mode 100644
index 000000000..6ba7a046d
--- /dev/null
+++ b/resources/icons/notification_warning.svg
@@ -0,0 +1,70 @@
+
+
diff --git a/src/imgui/imconfig.h b/src/imgui/imconfig.h
index feda857ae..4a1d1faa0 100644
--- a/src/imgui/imconfig.h
+++ b/src/imgui/imconfig.h
@@ -108,17 +108,19 @@ namespace ImGui
const char ColorMarkerEnd = 0x3; // ETX
// Special ASCII characters are used here as an ikons markers
- const char PrintIconMarker = 0x4;
- const char PrinterIconMarker = 0x5;
- const char PrinterSlaIconMarker = 0x6;
- const char FilamentIconMarker = 0x7;
- const char MaterialIconMarker = 0x8;
- const char CloseIconMarker = 0xB;
- const char CloseIconHoverMarker = 0xC;
- const char TimerDotMarker = 0xE;
- const char TimerDotEmptyMarker = 0xF;
- const char WarningMarker = 0x10;
- const char ErrorMarker = 0x11;
+ const char PrintIconMarker = 0x4;
+ const char PrinterIconMarker = 0x5;
+ const char PrinterSlaIconMarker = 0x6;
+ const char FilamentIconMarker = 0x7;
+ const char MaterialIconMarker = 0x8;
+ const char CloseIconMarker = 0xB;
+ const char CloseIconHoverMarker = 0xC;
+// const char TimerDotMarker = 0xE;
+// const char TimerDotEmptyMarker = 0xF;
+ const char MinimalizeMarker = 0xE;
+ const char MinimalizeHoverMarker = 0xF;
+ const char WarningMarker = 0x10;
+ const char ErrorMarker = 0x11;
// void MyFunction(const char* name, const MyMatrix44& v);
}
diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp
index 7ae6f4294..81f63cb4d 100644
--- a/src/slic3r/GUI/GLCanvas3D.cpp
+++ b/src/slic3r/GUI/GLCanvas3D.cpp
@@ -620,53 +620,57 @@ GLCanvas3D::WarningTexture::WarningTexture()
void GLCanvas3D::WarningTexture::activate(WarningTexture::Warning warning, bool state, const GLCanvas3D& canvas)
{
+ // Since we have NotificationsManager.hpp the warning textures are no loger needed.
+ // However i have left the infrastructure here and only commented the rendering.
+ // The plater warning / error notifications are added and closed from here.
+
+ std::string text;
+ 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 SomethingNotShown: text = L("Some objects are not visible."); break;
+ case ObjectClashed:
+ text = L( "An object outside the print area was detected.\n"
+ "Resolve the current problem to continue slicing.");
+ error = true;
+ break;
+ }
+ if(state) {
+ if(error)
+ wxGetApp().plater()->get_notification_manager()->push_plater_error_notification(text,*(wxGetApp().plater()->get_current_canvas3D()));
+ else
+ 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();
+ else
+ wxGetApp().plater()->get_notification_manager()->close_plater_warning_notification(text);
+ }
+
+ /*
auto it = std::find(m_warnings.begin(), m_warnings.end(), warning);
if (state) {
if (it != m_warnings.end()) // this warning is already set to be shown
return;
- m_warnings.emplace_back(warning);
+ m_warnings.push_back(warning);
std::sort(m_warnings.begin(), m_warnings.end());
-
- std::string text;
- 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 SomethingNotShown: text = L("Some objects are not visible."); break;
- case ObjectClashed: wxGetApp().plater()->get_notification_manager()->push_plater_error_notification(L("An object outside the print area was detected.\n"
- "Resolve the current problem to continue slicing."),
- *(wxGetApp().plater()->get_current_canvas3D()));
- break;
- }
- if (!text.empty())
- wxGetApp().plater()->get_notification_manager()->push_plater_warning_notification(text, *(wxGetApp().plater()->get_current_canvas3D()));
}
else {
if (it == m_warnings.end()) // deactivating something that is not active is an easy task
return;
m_warnings.erase(it);
-
- std::string text;
- 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 SomethingNotShown: text = L("Some objects are not visibl.e"); break;
- case ObjectClashed: wxGetApp().plater()->get_notification_manager()->close_plater_error_notification(); break;
- }
- if (!text.empty())
- wxGetApp().plater()->get_notification_manager()->close_plater_warning_notification(text);
-
- /*if (m_warnings.empty()) { // nothing remains to be shown
+ if (m_warnings.empty()) { // nothing remains to be shown
reset();
m_msg_text = "";// save information for rescaling
return;
- }*/
+ }
}
- /*
+
// Look at the end of our vector and generate proper texture.
std::string text;
bool red_colored = false;
@@ -674,7 +678,7 @@ void GLCanvas3D::WarningTexture::activate(WarningTexture::Warning warning, bool
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 SomethingNotShown : text = L("Some objects are not visible"); break;
+ case SomethingNotShown : text = L("Some objects are not visible when editing supports"); break;
case ObjectClashed: {
text = L("An object outside the print area was detected\n"
"Resolve the current problem to continue slicing");
diff --git a/src/slic3r/GUI/ImGuiWrapper.cpp b/src/slic3r/GUI/ImGuiWrapper.cpp
index 7c2754502..e839fdf9b 100644
--- a/src/slic3r/GUI/ImGuiWrapper.cpp
+++ b/src/slic3r/GUI/ImGuiWrapper.cpp
@@ -37,17 +37,19 @@ namespace GUI {
static const std::map font_icons = {
- {ImGui::PrintIconMarker , "cog" },
- {ImGui::PrinterIconMarker , "printer" },
- {ImGui::PrinterSlaIconMarker, "sla_printer" },
- {ImGui::FilamentIconMarker , "spool" },
- {ImGui::MaterialIconMarker , "resin" },
- {ImGui::CloseIconMarker , "cross" },
- {ImGui::CloseIconHoverMarker, "cross_focus_large" },
- {ImGui::TimerDotMarker , "timer_dot" },
- {ImGui::TimerDotEmptyMarker , "timer_dot_empty" },
- {ImGui::WarningMarker , "flag_green" },
- {ImGui::ErrorMarker , "flag_red" }
+ {ImGui::PrintIconMarker , "cog" },
+ {ImGui::PrinterIconMarker , "printer" },
+ {ImGui::PrinterSlaIconMarker , "sla_printer" },
+ {ImGui::FilamentIconMarker , "spool" },
+ {ImGui::MaterialIconMarker , "resin" },
+ {ImGui::CloseIconMarker , "notification_close" },
+ {ImGui::CloseIconHoverMarker , "notification_close_hover" },
+ //{ImGui::TimerDotMarker , "timer_dot" },
+ //{ImGui::TimerDotEmptyMarker , "timer_dot_empty" },
+ {ImGui::MinimalizeMarker , "notification_minimalize" },
+ {ImGui::MinimalizeHoverMarker , "notification_minimalize_hover" },
+ {ImGui::WarningMarker , "notification_warning" },
+ {ImGui::ErrorMarker , "notification_error" }
};
const ImVec4 ImGuiWrapper::COL_GREY_DARK = { 0.333f, 0.333f, 0.333f, 1.0f };
diff --git a/src/slic3r/GUI/NotificationManager.cpp b/src/slic3r/GUI/NotificationManager.cpp
index b7301f3d8..47962f4b2 100644
--- a/src/slic3r/GUI/NotificationManager.cpp
+++ b/src/slic3r/GUI/NotificationManager.cpp
@@ -49,13 +49,17 @@ NotificationManager::PopNotification::PopNotification(const NotificationData &n,
, m_text2 (n.text2)
, m_evt_handler (evt_handler)
{
- init();
+ //init();
}
NotificationManager::PopNotification::~PopNotification()
{
}
NotificationManager::PopNotification::RenderResult NotificationManager::PopNotification::render(GLCanvas3D& canvas, const float& initial_y)
{
+ if (!m_initialized)
+ {
+ init();
+ }
if (m_finished)
return RenderResult::Finished;
if (m_close_pending) {
@@ -228,6 +232,7 @@ void NotificationManager::PopNotification::init()
}
m_lines_count++;
}
+ m_initialized = true;
}
void NotificationManager::PopNotification::set_next_window_size(ImGuiWrapper& imgui)
{
@@ -492,12 +497,12 @@ void NotificationManager::PopNotification::render_minimize_button(ImGuiWrapper&
//button - if part if treggered
std::string button_text;
- button_text = ImGui::CloseIconMarker;
+ button_text = ImGui::MinimalizeMarker;
if (ImGui::IsMouseHoveringRect(ImVec2(win_pos_x - m_window_width / 10.f, win_pos_y + m_window_height - 2 * m_line_height + 1),
ImVec2(win_pos_x, win_pos_y + m_window_height),
true))
{
- button_text = ImGui::CloseIconHoverMarker;
+ button_text = ImGui::MinimalizeHoverMarker;
}
ImVec2 button_pic_size = ImGui::CalcTextSize(button_text.c_str());
ImVec2 button_size(button_pic_size.x * 1.25f, button_pic_size.y * 1.25f);
@@ -730,16 +735,16 @@ void NotificationManager::push_slicing_complete_notification(GLCanvas3D& canvas,
{
std::string hypertext;
int time = 10;
- if(large)
- {
+ if (has_error_notification())
+ return;
+ if (large) {
hypertext = _u8L("Export G-Code.");
time = 0;
}
NotificationData data{ NotificationType::SlicingComplete, NotificationLevel::RegularNotification, time, _u8L("Slicing finished."), hypertext };
NotificationManager::SlicingCompleteLargeNotification* notification = new NotificationManager::SlicingCompleteLargeNotification(data, m_next_id++, m_evt_handler, large);
- if (push_notification_data(notification, canvas, timestamp)) {
- } else {
+ if (!push_notification_data(notification, canvas, timestamp)) {
delete notification;
}
}
@@ -909,6 +914,23 @@ bool NotificationManager::find_older(NotificationManager::PopNotification* notif
return false;
}
+void NotificationManager::set_in_preview(bool preview)
+{
+ m_in_preview = preview;
+ for (PopNotification* notification : m_pop_notifications) {
+ if (notification->get_type() == NotificationType::PlaterWarning)
+ notification->hide(preview);
+ }
+}
+bool NotificationManager::has_error_notification()
+{
+ for (PopNotification* notification : m_pop_notifications) {
+ if (notification->get_data().level == NotificationLevel::ErrorNotification)
+ return true;
+ }
+ return false;
+}
+
void NotificationManager::dpi_changed()
{
diff --git a/src/slic3r/GUI/NotificationManager.hpp b/src/slic3r/GUI/NotificationManager.hpp
index d7037c53e..a11d08394 100644
--- a/src/slic3r/GUI/NotificationManager.hpp
+++ b/src/slic3r/GUI/NotificationManager.hpp
@@ -94,6 +94,7 @@ public:
void set_gray(bool g) { m_is_gray = g; }
void set_paused(bool p) { m_paused = p; }
bool compare_text(const std::string& text);
+ void hide(bool h) { m_hidden = h; }
protected:
// Call after every size change
void init();
@@ -120,6 +121,7 @@ public:
const NotificationData m_data;
int m_id;
+ bool m_initialized { false };
// Main text
std::string m_text1;
// Clickable text
@@ -130,12 +132,12 @@ public:
long m_remaining_time;
bool m_counting_down;
long m_last_remaining_time;
- bool m_paused{ false };
- int m_countdown_frame{ 0 };
- bool m_fading_out{ false };
+ bool m_paused { false };
+ int m_countdown_frame { 0 };
+ bool m_fading_out { false };
// total time left when fading beggins
- float m_fading_time{ 0.0f };
- float m_current_fade_opacity{ 1.f };
+ float m_fading_time { 0.0f };
+ float m_current_fade_opacity { 1.f };
// If hidden the notif is alive but not visible to user
bool m_hidden { false };
// m_finished = true - does not render, marked to delete
@@ -230,6 +232,7 @@ public:
// finds and closes all notifications of given type
void close_notification_of_type(const NotificationType type);
void dpi_changed();
+ void set_in_preview(bool preview);
private:
//pushes notification into the queue of notifications that are rendered
//can be used to create custom notification
@@ -238,6 +241,7 @@ private:
//finds older notification of same type and moves it to the end of queue. returns true if found
bool find_older(NotificationManager::PopNotification* notification);
void sort_notifications();
+ bool has_error_notification();
wxEvtHandler* m_evt_handler;
std::deque m_pop_notifications;
@@ -246,6 +250,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;
//prepared (basic) notifications
const std::vector basic_notifications = {
diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp
index 1fe32fd2d..45a1f6ea8 100644
--- a/src/slic3r/GUI/Plater.cpp
+++ b/src/slic3r/GUI/Plater.cpp
@@ -1512,7 +1512,7 @@ struct Plater::priv
GLToolbar view_toolbar;
GLToolbar collapse_toolbar;
Preview *preview;
- NotificationManager* notification_manager;
+ NotificationManager* notification_manager { nullptr };
BackgroundSlicingProcess background_process;
bool suppressed_backround_processing_update { false };
@@ -3304,6 +3304,8 @@ void Plater::priv::set_current_panel(wxPanel* panel)
// sets the canvas as dirty to force a render at the 1st idle event (wxWidgets IsShownOnScreen() is buggy and cannot be used reliably)
view3D->set_as_dirty();
view_toolbar.select_item("3D");
+ if(notification_manager != nullptr)
+ notification_manager->set_in_preview(false);
}
else if (current_panel == preview)
{
@@ -3318,6 +3320,8 @@ void Plater::priv::set_current_panel(wxPanel* panel)
preview->set_as_dirty();
view_toolbar.select_item("Preview");
+ if (notification_manager != nullptr)
+ notification_manager->set_in_preview(true);
}
current_panel->SetFocusFromKbd();
@@ -3481,6 +3485,10 @@ void Plater::priv::add_warning(const Slic3r::PrintStateBase::Warning& warning, s
}
void Plater::priv::actualizate_warnings(const Model& model, size_t print_oid)
{
+ if (model.objects.size() == 0) {
+ clear_warnings();
+ return;
+ }
std::vector living_oids;
living_oids.push_back(model.id().id);
living_oids.push_back(print_oid);