Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/slic3r/GUI/NotificationManager.hpp')
-rw-r--r--src/slic3r/GUI/NotificationManager.hpp61
1 files changed, 54 insertions, 7 deletions
diff --git a/src/slic3r/GUI/NotificationManager.hpp b/src/slic3r/GUI/NotificationManager.hpp
index d8ca1e0bd..81c57eccb 100644
--- a/src/slic3r/GUI/NotificationManager.hpp
+++ b/src/slic3r/GUI/NotificationManager.hpp
@@ -140,7 +140,13 @@ public:
void set_in_preview(bool preview);
// Move to left to avoid colision with variable layer height gizmo.
void set_move_from_overlay(bool move) { m_move_from_overlay = move; }
-
+
+#if ENABLE_NEW_NOTIFICATIONS_FADE_OUT
+ void update_notifications();
+ bool requires_update() const { return m_requires_update; }
+ bool requires_render() const { return m_requires_render; }
+#endif // ENABLE_NEW_NOTIFICATIONS_FADE_OUT
+
private:
// duration 0 means not disapearing
struct NotificationData {
@@ -175,6 +181,17 @@ private:
class PopNotification
{
public:
+#if ENABLE_NEW_NOTIFICATIONS_FADE_OUT
+ enum class EState
+ {
+ Unknown,
+ Static,
+ Countdown,
+ FadingOut,
+ ClosePending,
+ Finished
+ };
+#else
enum class RenderResult
{
Finished,
@@ -183,27 +200,41 @@ private:
Countdown,
Hovered
};
+#endif // ENABLE_NEW_NOTIFICATIONS_FADE_OUT
PopNotification(const NotificationData &n, NotificationIDProvider &id_provider, wxEvtHandler* evt_handler);
virtual ~PopNotification() { if (m_id) m_id_provider.release_id(m_id); }
+#if ENABLE_NEW_NOTIFICATIONS_FADE_OUT
+ void render(GLCanvas3D& canvas, float initial_y, bool move_from_overlay, float overlay_width);
+#else
RenderResult render(GLCanvas3D& canvas, const float& initial_y, bool move_from_overlay, float overlay_width);
+#endif // ENABLE_NEW_NOTIFICATIONS_FADE_OUT
// close will dissapear notification on next render
void close() { m_close_pending = true; }
// data from newer notification of same type
void update(const NotificationData& n);
- bool get_finished() const { return m_finished || m_close_pending; }
+ bool is_finished() const { return m_finished || m_close_pending; }
+#if ENABLE_NEW_NOTIFICATIONS_FADE_OUT
+ bool is_hovered() const { return m_hovered; }
+#endif // ENABLE_NEW_NOTIFICATIONS_FADE_OUT
// returns top after movement
float get_top() const { return m_top_y; }
//returns top in actual frame
float get_current_top() const { return m_top_y; }
const NotificationType get_type() const { return m_data.type; }
- const NotificationData get_data() const { return m_data; }
- const bool get_is_gray() const { return m_is_gray; }
+ const NotificationData get_data() const { return m_data; }
+ const bool is_gray() const { return m_is_gray; }
// Call equals one second down
void substract_remaining_time() { m_remaining_time--; }
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; }
+#if ENABLE_NEW_NOTIFICATIONS_FADE_OUT
+ void update_state();
+ bool requires_render() const { return m_fading_out || m_close_pending || m_finished; }
+ bool requires_update() const { return m_state != EState::Static; }
+ EState get_state() const { return m_state; }
+#endif // ENABLE_NEW_NOTIFICATIONS_FADE_OUT
protected:
// Call after every size change
@@ -218,9 +249,11 @@ private:
virtual void render_close_button(ImGuiWrapper& imgui,
const float win_size_x, const float win_size_y,
const float win_pos_x , const float win_pos_y);
+#if !ENABLE_NEW_NOTIFICATIONS_FADE_OUT
void render_countdown(ImGuiWrapper& imgui,
const float win_size_x, const float win_size_y,
const float win_pos_x , const float win_pos_y);
+#endif // !ENABLE_NEW_NOTIFICATIONS_FADE_OUT
virtual void render_hypertext(ImGuiWrapper& imgui,
const float text_x, const float text_y,
const std::string text,
@@ -237,7 +270,10 @@ private:
// For reusing ImGUI windows.
NotificationIDProvider &m_id_provider;
- int m_id { 0 };
+#if ENABLE_NEW_NOTIFICATIONS_FADE_OUT
+ EState m_state { EState::Unknown };
+#endif // ENABLE_NEW_NOTIFICATIONS_FADE_OUT
+ int m_id { 0 };
bool m_initialized { false };
// Main text
std::string m_text1;
@@ -252,15 +288,22 @@ private:
bool m_paused { false };
int m_countdown_frame { 0 };
bool m_fading_out { false };
+#if ENABLE_NEW_NOTIFICATIONS_FADE_OUT
+ wxMilliClock_t m_fading_start { 0LL };
+#else
// 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 };
+#endif // ENABLE_NEW_NOTIFICATIONS_FADE_OUT
+ float m_current_fade_opacity { 1.0f };
// If hidden the notif is alive but not visible to user
bool m_hidden { false };
// m_finished = true - does not render, marked to delete
bool m_finished { false };
// Will go to m_finished next render
bool m_close_pending { false };
+#if ENABLE_NEW_NOTIFICATIONS_FADE_OUT
+ bool m_hovered { false };
+#endif // ENABLE_NEW_NOTIFICATIONS_FADE_OUT
// variables to count positions correctly
// all space without text
float m_window_width_offset;
@@ -390,6 +433,10 @@ private:
bool m_in_preview { false };
// True if the layer editing is enabled in Plater, so that the notifications are shifted left of it.
bool m_move_from_overlay { false };
+#if ENABLE_NEW_NOTIFICATIONS_FADE_OUT
+ bool m_requires_update{ false };
+ bool m_requires_render{ false };
+#endif // ENABLE_NEW_NOTIFICATIONS_FADE_OUT
//prepared (basic) notifications
const std::vector<NotificationData> basic_notifications = {