OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::GUI::NotificationManager::PopNotification Class Reference
Inheritance diagram for Slic3r::GUI::NotificationManager::PopNotification:
Collaboration diagram for Slic3r::GUI::NotificationManager::PopNotification:

Classes

struct  ImGUITheme

Public Types

enum class  EState {
  Unknown , Hidden , Shown , NotFading ,
  FadingOut , ClosePending , Finished , Hovered ,
  Paused
}
typedef std::function< void(PopNotification *)> DeleteCallback

Public Member Functions

 PopNotification (const NotificationData &n, NotificationIDProvider &id_provider, wxEvtHandler *evt_handler)
virtual ~PopNotification ()
virtual void render (GLCanvas3D &canvas, float initial_y, bool move_from_overlay, float overlay_width, float right_margin)
virtual void bbl_render_block_notification (GLCanvas3D &canvas, float initial_y, bool move_from_overlay, float overlay_width, float right_margin)
virtual void close ()
void update (const NotificationData &n)
void append (const std::string &append_str)
bool is_finished () const
void reinit ()
float get_top () const
float get_bottom () const
float get_current_top () const
const NotificationType get_type () const
const NotificationData & get_data () const
std::string get_text1 () const
const bool is_gray () const
void set_gray (bool g)
virtual bool compare_text (const std::string &text) const
void hide (bool h)
virtual bool update_state (bool paused, const int64_t delta)
int64_t next_render () const
EState get_state () const
bool is_hovered () const
void set_hovered ()
void reset_timer ()
void set_Multiline (bool Multi)
virtual void on_change_color_mode (bool is_dark)
void set_scale (float scale)
void set_delete_callback (DeleteCallback)
bool is_valid_delete_callback ()

Protected Member Functions

virtual void init ()
virtual void set_next_window_size (ImGuiWrapper &imgui)
virtual void render_text (ImGuiWrapper &imgui, const float win_size_x, const float win_size_y, const float win_pos_x, const float win_pos_y)
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)
virtual void render_hypertext (ImGuiWrapper &imgui, const float text_x, const float text_y, const std::string text, bool more=false)
void render_hyperlink_action (ImGuiWrapper &imgui, float text_x, float text_y, const std::string &text, const char *button_id, const std::function< void()> &on_click)
virtual void bbl_render_block_notif_text (ImGuiWrapper &imgui, const float win_size_x, const float win_size_y, const float win_pos_x, const float win_pos_y)
virtual void bbl_render_block_notif_buttons (ImGuiWrapper &imgui, ImVec2 win_size, ImVec2 win_pos)
virtual void bbl_render_block_notif_left_sign (ImGuiWrapper &imgui, const float win_size_x, const float win_size_y, const float win_pos_x, const float win_pos_y)
virtual void bbl_render_left_sign (ImGuiWrapper &imgui, const float win_size_x, const float win_size_y, const float win_pos_x, const float win_pos_y)
virtual void render_left_sign (ImGuiWrapper &imgui)
virtual void render_minimize_button (ImGuiWrapper &imgui, const float win_pos_x, const float win_pos_y)
virtual bool on_text_click ()
virtual void count_spaces ()
virtual void count_lines ()
virtual bool push_background_color ()
virtual int get_duration ()
void ensure_ui_inited ()
void use_bbl_theme ()
void restore_default_theme ()

Protected Attributes

bool m_is_dark = false
bool m_is_dark_inited = false
const NotificationData m_data
NotificationIDProvider & m_id_provider
int m_id { 0 }
ImGUITheme m_DefaultTheme
ImVec4 m_WindowBkgColor
ImVec4 m_TextColor
ImVec4 m_HyperTextColor
ImVec4 m_HyperTextColorHover
ImVec4 m_ErrorColor
ImVec4 m_WarnColor
ImVec4 m_NormalColor
ImVec4 m_CurrentColor
float m_WindowRadius
bool m_WindowRadius_inited = false
EState m_state { EState::Unknown }
int64_t m_fading_start { 0LL }
int64_t m_notification_start
int64_t m_next_render { std::numeric_limits<int64_t>::max() }
float m_current_fade_opacity { 1.0f }
std::string m_text1
std::string m_hypertext
std::string m_text2
size_t pos_start = std::string::npos
size_t pos_end = std::string::npos
std::string error_start = "<Error>"
std::string error_end = "</Error>"
DeleteCallback m_on_delete_callback
float m_window_width_offset
float m_left_indentation
float m_window_height { 56.0f }
float m_window_width { 450.0f }
float m_top_y { 0.0f }
float m_bottom_y { 0.0f }
float m_line_height
std::vector< size_t > m_endlines
std::vector< size_t > m_endlines2
bool m_is_gray { false }
bool m_multiline { false }
bool m_minimize_b_visible { false }
size_t m_lines_count { 1 }
wxEvtHandler * m_evt_handler
float m_scale = 1.0f

Detailed Description


Class Documentation

◆ Slic3r::GUI::NotificationManager::PopNotification::ImGUITheme

struct Slic3r::GUI::NotificationManager::PopNotification::ImGUITheme
Class Members
ImVec4 mBorderColor
ImVec4 mTextColor
ImVec4 mWindowBkg
ImVec2 mWindowPadding
float mWindowRound

Member Typedef Documentation

◆ DeleteCallback

Member Enumeration Documentation

◆ EState

Enumerator
Unknown 
Hidden 
Shown 
NotFading 
FadingOut 
ClosePending 
Finished 
Hovered 
Paused 
476 {
477 Unknown, // NOT initialized
478 Hidden,
479 Shown, // Requesting Render at some time if duration != 0
480 NotFading, // Never jumps to state Fading out even if duration says so
481 FadingOut, // Requesting Render at some time
482 ClosePending, // Requesting Render
483 Finished, // Requesting Render
484 Hovered, // Followed by Shown
485 Paused
486 };
@ Unknown
Definition PresetBundle.hpp:42

Constructor & Destructor Documentation

◆ PopNotification()

Slic3r::GUI::NotificationManager::PopNotification::PopNotification ( const NotificationData & n,
NotificationIDProvider & id_provider,
wxEvtHandler * evt_handler )
184 :
185 m_data (n)
186 , m_id_provider (id_provider)
187 , m_text1 (n.text1)
188 , m_hypertext (n.hypertext)
189 , m_text2 (n.text2)
190 , m_evt_handler (evt_handler)
192{
195 m_NormalColor = ImVec4(0, 0.588, 0.533, 1);
196
197 m_CurrentColor = m_NormalColor; //Default
198
199 m_WindowBkgColor = ImVec4(1, 1, 1, 1);
200 m_TextColor = ImVec4(.2f, .2f, .2f, 1.0f);
201 m_HyperTextColor = ImVec4(0, 0.588, 0.533, 1);
202}
static int64_t timestamp_now()
Definition GLCanvas3D.hpp:1416
static ImVec4 to_ImVec4(const ColorRGB &color)
Definition ImGuiWrapper.cpp:1053
ImVec4 m_WarnColor
Definition NotificationManager.hpp:602
const NotificationData m_data
Definition NotificationManager.hpp:578
int64_t m_notification_start
Definition NotificationManager.hpp:620
ImVec4 m_WindowBkgColor
Definition NotificationManager.hpp:595
std::string m_text2
Definition NotificationManager.hpp:632
ImVec4 m_CurrentColor
Definition NotificationManager.hpp:604
wxEvtHandler * m_evt_handler
Definition NotificationManager.hpp:667
std::string m_hypertext
Definition NotificationManager.hpp:630
ImVec4 m_HyperTextColor
Definition NotificationManager.hpp:598
ImVec4 m_TextColor
Definition NotificationManager.hpp:596
NotificationIDProvider & m_id_provider
Definition NotificationManager.hpp:580
ImVec4 m_ErrorColor
Definition NotificationManager.hpp:601
ImVec4 m_NormalColor
Definition NotificationManager.hpp:603
std::string m_text1
Definition NotificationManager.hpp:628
static ColorRGBA decode_color_to_float_array(const std::string color)
Definition GUI_Utils.hpp:60

References Slic3r::GUI::decode_color_to_float_array(), m_CurrentColor, m_data, m_ErrorColor, m_evt_handler, m_hypertext, m_HyperTextColor, m_id_provider, m_NormalColor, m_notification_start, m_text1, m_text2, m_TextColor, m_WarnColor, m_WindowBkgColor, and Slic3r::GUI::ImGuiWrapper::to_ImVec4().

Referenced by Slic3r::GUI::NotificationManager::ExportFinishedNotification::ExportFinishedNotification(), Slic3r::GUI::NotificationManager::HintNotification::HintNotification(), Slic3r::GUI::NotificationManager::ObjectIDNotification::ObjectIDNotification(), Slic3r::GUI::NotificationManager::OrcaSyncConflictNotification::OrcaSyncConflictNotification(), Slic3r::GUI::NotificationManager::PlaterWarningNotification::PlaterWarningNotification(), Slic3r::GUI::NotificationManager::PluginMissingNotification::PluginMissingNotification(), Slic3r::GUI::NotificationManager::ProgressBarNotification::ProgressBarNotification(), Slic3r::GUI::NotificationManager::SharedProfilesNotification::SharedProfilesNotification(), Slic3r::GUI::NotificationManager::SlicingProgressNotification::SlicingProgressNotification(), and Slic3r::GUI::NotificationManager::UpdatedItemsInfoNotification::UpdatedItemsInfoNotification().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~PopNotification()

virtual Slic3r::GUI::NotificationManager::PopNotification::~PopNotification ( )
inlinevirtual
489{ if (m_id) m_id_provider.release_id(m_id); }
int m_id
Definition NotificationManager.hpp:581

References m_id, and m_id_provider.

Member Function Documentation

◆ append()

void Slic3r::GUI::NotificationManager::PopNotification::append ( const std::string & append_str)
1063{
1064 m_text1 = m_text1 + "\n" + append_str;
1065 //m_hypertext = n.hypertext;
1066 //m_text2 = n.text2;
1067 //const_cast<NotificationData&>(m_data).callback = n.callback;
1068 init();
1069 m_multiline = false;
1070}
virtual void init()
Definition NotificationManager.cpp:622
bool m_multiline
Definition NotificationManager.hpp:662

References Slic3r::GUI::NotificationManager::init(), m_multiline, and m_text1.

Here is the call graph for this function:

◆ bbl_render_block_notif_buttons()

void Slic3r::GUI::NotificationManager::PopNotification::bbl_render_block_notif_buttons ( ImGuiWrapper & imgui,
ImVec2 win_size,
ImVec2 win_pos )
protectedvirtual

Reimplemented in Slic3r::GUI::NotificationManager::PluginMissingNotification.

906{
907 // close button
908 ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(.0f, .0f, .0f, .0f));
909 ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(.0f, .0f, .0f, .0f));
910 push_style_color(ImGuiCol_Text, ImVec4(1.f, 1.f, 1.f, 1.f), m_state == EState::FadingOut, m_current_fade_opacity);
911 push_style_color(ImGuiCol_TextSelectedBg, ImVec4(0, .75f, .75f, 1.f), m_state == EState::FadingOut, m_current_fade_opacity);
912 ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(.0f, .0f, .0f, .0f));
913
914 std::wstring button_text;
915 button_text = ImGui::CloseBlockNotifButton;
916 ImVec2 button_pic_size = ImGui::CalcTextSize(into_u8(button_text).c_str());
917 ImVec2 button_size(button_pic_size.x * 2.f, button_pic_size.y * 2.f);
918
919 ImVec2 cursor_pos = { win_size.x - m_line_height * 2.0f, win_size.y / 2 - button_size.y / 2 };
920 ImGui::SetCursorPos(cursor_pos);
921 //if (ImGui::IsMouseHoveringRect(ImVec2(win_pos.x - win_size.x / 10.f, win_pos.y + win_size.y / 2 - button_pic_size.y),
922 // ImVec2(win_pos.x - win_size.x / 20.f, win_pos.y + win_size.y / 2 + button_pic_size.y),
923 // true))
924 if(ImGui::IsMouseHoveringRect(win_pos + cursor_pos, win_pos + cursor_pos + button_size))
925 {
926 button_text = ImGui::CloseBlockNotifHoverButton;
927 }
928 if (imgui.button(button_text.c_str(), button_size.x, button_size.y))
929 {
930 close();
931 }
932 ImGui::PopStyleColor(5);
933
934
936 //ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(.0f, .0f, .0f, .0f));
937 //ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(.0f, .0f, .0f, .0f));
938 //push_style_color(ImGuiCol_ButtonActive, ImGui::GetStyleColorVec4(ImGuiCol_WindowBg), m_state == EState::FadingOut, m_current_fade_opacity);
939 //push_style_color(ImGuiCol_Text, ImVec4(1.f, 1.f, 1.f, 1.f), m_state == EState::FadingOut, m_current_fade_opacity);
940 //push_style_color(ImGuiCol_TextSelectedBg, ImVec4(0, .75f, .75f, 1.f), m_state == EState::FadingOut, m_current_fade_opacity);
942 //std::wstring button_text;
943 //button_text = m_is_dark ? ImGui::MinimalizeDarkButton : ImGui::MinimalizeButton;
944 //if (ImGui::IsMouseHoveringRect(ImVec2(win_pos_x - m_window_width / 10.f, win_pos_y + m_window_height - 2 * m_line_height + 1),
945 // ImVec2(win_pos_x, win_pos_y + m_window_height),
946 // true))
947 //{
948 // button_text = m_is_dark ? ImGui::MinimalizeHoverDarkButton : ImGui::MinimalizeHoverButton;
949 //}
950 //ImVec2 button_pic_size = ImGui::CalcTextSize(into_u8(button_text).c_str());
951 //ImVec2 button_size(button_pic_size.x * 1.25f, button_pic_size.y * 1.25f);
952 //ImGui::SetCursorPosX(m_window_width - m_line_height * 1.8f);
953 //ImGui::SetCursorPosY(m_window_height - button_size.y - 5);
954 //if (imgui.button(button_text.c_str(), button_size.x, button_size.y))
955 //{
956 // m_multiline = false;
957 //}
958
959 //ImGui::PopStyleColor(5);
960 //m_minimize_b_visible = true;
961}
float m_current_fade_opacity
Definition NotificationManager.hpp:623
@ FadingOut
Definition NotificationManager.hpp:481
float m_line_height
Definition NotificationManager.hpp:654
EState m_state
Definition NotificationManager.hpp:613
virtual void close()
Definition NotificationManager.cpp:477
void push_style_color(ImGuiCol idx, const ImVec4 &col, bool fading_out, float current_fade_opacity)
Definition HintNotification.cpp:81
std::string into_u8(const wxString &str)
Definition GUI.cpp:549

References Slic3r::GUI::ImGuiWrapper::button(), close(), FadingOut, Slic3r::GUI::into_u8(), m_current_fade_opacity, m_line_height, and m_state.

Referenced by bbl_render_block_notification().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bbl_render_block_notif_left_sign()

void Slic3r::GUI::NotificationManager::PopNotification::bbl_render_block_notif_left_sign ( ImGuiWrapper & imgui,
const float win_size_x,
const float win_size_y,
const float win_pos_x,
const float win_pos_y )
protectedvirtual
972{
973 auto window = ImGui::GetCurrentWindow();
974 //window->DrawList->AddImage(user_texture_id, bb.Min + padding + margin, bb.Max - padding - margin, uv0, uv1, ImGui::GetColorU32(tint_col));
975
976 std::wstring text;
977 text = ImGui::BlockNotifErrorIcon;
978 ImGui::SetCursorPosX(m_line_height / 3);
979 ImGui::SetCursorPosY(m_window_height / 2 - m_line_height);
980 imgui.text(text.c_str());
981
982}
float m_window_height
Definition NotificationManager.hpp:647

References m_line_height, m_window_height, and Slic3r::GUI::ImGuiWrapper::text().

Referenced by bbl_render_block_notification().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bbl_render_block_notif_text()

void Slic3r::GUI::NotificationManager::PopNotification::bbl_render_block_notif_text ( ImGuiWrapper & imgui,
const float win_size_x,
const float win_size_y,
const float win_pos_x,
const float win_pos_y )
protectedvirtual

Reimplemented in Slic3r::GUI::NotificationManager::PluginMissingNotification.

649{
650 float x_offset = m_left_indentation;
651 int last_end = 0;
652 float starting_y = (m_lines_count == 2 ? win_size_y / 2 - m_line_height : (m_lines_count == 1 ? win_size_y / 2 - m_line_height / 2 : m_line_height / 2));
653 float shift_y = m_line_height;
654 std::string line;
655
656 for (size_t i = 0; i < (m_multiline ? m_endlines.size() : std::min(m_endlines.size(), (size_t)2)); i++) {
657 assert(m_endlines.size() > i && m_text1.size() >= m_endlines[i]);
658 line.clear();
659 ImGui::SetCursorPosX(x_offset);
660 ImGui::SetCursorPosY(starting_y + i * shift_y);
661 if (m_endlines.size() > i && m_text1.size() >= m_endlines[i]) {
662 if (i == 1 && m_endlines.size() > 2 && !m_multiline) {
663 // second line with "more" hypertext
664 line = m_text1.substr(m_endlines[0] + (m_text1[m_endlines[0]] == '\n' || m_text1[m_endlines[0]] == ' ' ? 1 : 0), m_endlines[1] - m_endlines[0] - (m_text1[m_endlines[0]] == '\n' || m_text1[m_endlines[0]] == ' ' ? 1 : 0));
665 while (ImGui::CalcTextSize(line.c_str()).x > m_window_width - m_window_width_offset - ImGui::CalcTextSize((".." + _u8L("More")).c_str()).x) {
666 line = line.substr(0, line.length() - 1);
667 }
668 line += "..";
669 }
670 else {
671 // regural line
672 line = m_text1.substr(last_end, m_endlines[i] - last_end);
673 }
674 last_end = m_endlines[i];
675 if (m_text1.size() > m_endlines[i])
676 last_end += (m_text1[m_endlines[i]] == '\n' || m_text1[m_endlines[i]] == ' ' ? 1 : 0);
677
678 if (pos_start != std::string::npos && pos_end != std::string::npos && m_endlines[i] - line.length() >= pos_start && m_endlines[i] <= pos_end) {
680 imgui.text(line.c_str());
681 ImGui::PopStyleColor();
682 }
683 else {
684 imgui.text(line.c_str());
685 }
686 }
687 }
688 //hyperlink text
689 if (!m_multiline && m_lines_count > 2) {
690 render_hypertext(imgui, x_offset + ImGui::CalcTextSize((line + " ").c_str()).x, starting_y + shift_y, _u8L("More"), true);
691 }
692 else if (!m_hypertext.empty()) {
693 const ImVec2 button_size = {52, 28};
694 ImVec2 cursor_pos = { win_size_x - m_line_height * 6.0f, win_size_y / 2 - button_size.y / 2 };
695 ImGui::SetCursorPos(cursor_pos);
696 ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1);
697 ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 2);
698 ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(1.f, 1.f, 1.f, 1.f));
699 ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(1.f, 1.f, 1.f, 0.f));
700 //if (imgui.button(_L("Jump"), button_size.x, button_size.y)) { if (on_text_click()) { close(); } }
701 ImGui::PopStyleColor(2);
702 ImGui::PopStyleVar(2);
703 render_hypertext(imgui, x_offset + ImGui::CalcTextSize((line + (line.empty() ? "" : " ")).c_str()).x, starting_y + (m_endlines.size() - 1) * shift_y, m_hypertext);
704 }
705
706 // text2 (text after hypertext) is not rendered for regular notifications
707 // its rendering is in HintNotification::render_text
708}
size_t pos_start
Definition NotificationManager.hpp:634
float m_window_width
Definition NotificationManager.hpp:648
size_t pos_end
Definition NotificationManager.hpp:635
std::vector< size_t > m_endlines
Definition NotificationManager.hpp:656
size_t m_lines_count
Definition NotificationManager.hpp:665
float m_left_indentation
Definition NotificationManager.hpp:645
float m_window_width_offset
Definition NotificationManager.hpp:643
virtual void render_hypertext(ImGuiWrapper &imgui, const float text_x, const float text_y, const std::string text, bool more=false)
Definition NotificationManager.cpp:762
#define _u8L(s)
Definition I18N.hpp:11

References _u8L, FadingOut, m_current_fade_opacity, m_endlines, m_ErrorColor, m_hypertext, m_left_indentation, m_line_height, m_lines_count, m_multiline, m_state, m_text1, m_window_width, m_window_width_offset, pos_end, pos_start, render_hypertext(), and Slic3r::GUI::ImGuiWrapper::text().

Referenced by bbl_render_block_notification().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bbl_render_block_notification()

void Slic3r::GUI::NotificationManager::PopNotification::bbl_render_block_notification ( GLCanvas3D & canvas,
float initial_y,
bool move_from_overlay,
float overlay_width,
float right_margin )
virtual
388{
390 init();
391
392 if (m_state == EState::Hidden) {
393 m_top_y = initial_y - GAP_WIDTH;
394 return;
395 }
396
398 {
400 return;
401 }
402
403 Size cnv_size = canvas.get_canvas_size();
404 ImGuiWrapper& imgui = *wxGetApp().imgui();
405 float right_gap = right_margin + (move_from_overlay ? overlay_width + m_line_height * 5 : 0);
406 bool fading_pop = false;
407
408 if (m_line_height != ImGui::CalcTextSize("A").y)
409 init();
410
412
413 // top y of window
414 m_top_y = initial_y + m_window_height;
415
416 ImVec2 win_pos(1.0f * (float) cnv_size.get_width() - right_gap, 1.0f * (float) cnv_size.get_height() - m_top_y);
417 imgui.set_next_window_pos(win_pos.x, win_pos.y, ImGuiCond_Always, 1.0f, 0.0f);
418 imgui.set_next_window_size(m_window_width, m_window_height, ImGuiCond_Always);
419
420 // color change based on fading out
421 if (m_state == EState::FadingOut) {
422 push_style_color(ImGuiCol_WindowBg, ImGui::GetStyleColorVec4(ImGuiCol_WindowBg), true, m_current_fade_opacity);
423 push_style_color(ImGuiCol_Text, ImGui::GetStyleColorVec4(ImGuiCol_Text), true, m_current_fade_opacity);
424 push_style_color(ImGuiCol_ButtonHovered, ImGui::GetStyleColorVec4(ImGuiCol_ButtonHovered), true, m_current_fade_opacity);
425 fading_pop = true;
426 }
427
428 bool bgrnd_color_pop = push_background_color();
429
430 // name of window indentifies window - has to be unique string
431 if (m_id == 0)
432 m_id = m_id_provider.allocate_id();
433 std::string name = "!!Ntfctn" + std::to_string(m_id);
434
437 { // ORCA match and ensure color usage
438 push_style_color(ImGuiCol_Border, m_WarnColor, true, m_current_fade_opacity);
439 push_style_color(ImGuiCol_WindowBg, m_WarnColor, true, m_current_fade_opacity);
440 }
442 { // ORCA match and ensure color usage
444 push_style_color(ImGuiCol_WindowBg, m_ErrorColor, true, m_current_fade_opacity);
445 }
446 push_style_color(ImGuiCol_Text, { 1,1,1,1 }, true, m_current_fade_opacity);
447
448 if (imgui.begin(name, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse)) {
449 ImVec2 win_size = ImGui::GetWindowSize();
450 ImVec2 win_pos = ImGui::GetWindowPos();
451 if (ImGui::IsMouseHoveringRect(win_pos, win_pos + win_size)) {
452 set_hovered();
453 }
454
455 //render left icon
456 bbl_render_block_notif_left_sign(imgui, win_size.x, win_size.y, win_pos.x, win_pos.y);
457 bbl_render_block_notif_text(imgui, win_size.x, win_size.y, win_pos.x, win_pos.y);
458 bbl_render_block_notif_buttons(imgui, win_size, win_pos);
459 //render_close_button(imgui, win_size.x, win_size.y, win_pos.x, win_pos.y);
460 //m_minimize_b_visible = false;
461 //if (m_multiline && m_lines_count > 3)
462 // render_minimize_button(imgui, win_pos.x, win_pos.y);
463 }
464 ImGui::BringWindowToDisplayFront(ImGui::GetCurrentWindow());
465 imgui.end();
466
467 ImGui::PopStyleColor(3);
469
470 if (bgrnd_color_pop)
471 ImGui::PopStyleColor();
472
473 if (fading_pop)
474 ImGui::PopStyleColor(3);
475}
static constexpr float GAP_WIDTH
Definition NotificationManager.cpp:61
virtual void set_next_window_size(ImGuiWrapper &imgui)
Definition NotificationManager.cpp:640
virtual void bbl_render_block_notif_buttons(ImGuiWrapper &imgui, ImVec2 win_size, ImVec2 win_pos)
Definition NotificationManager.cpp:905
virtual void bbl_render_block_notif_text(ImGuiWrapper &imgui, const float win_size_x, const float win_size_y, const float win_pos_x, const float win_pos_y)
Definition NotificationManager.cpp:648
void use_bbl_theme()
Definition NotificationManager.cpp:236
virtual bool push_background_color()
Definition NotificationManager.cpp:483
@ ClosePending
Definition NotificationManager.hpp:482
@ Hidden
Definition NotificationManager.hpp:478
@ Unknown
Definition NotificationManager.hpp:477
@ Finished
Definition NotificationManager.hpp:483
virtual void bbl_render_block_notif_left_sign(ImGuiWrapper &imgui, const float win_size_x, const float win_size_y, const float win_pos_x, const float win_pos_y)
Definition NotificationManager.cpp:971
float m_top_y
Definition NotificationManager.hpp:650
void set_hovered()
Definition NotificationManager.hpp:517
void restore_default_theme()
Definition NotificationManager.cpp:279
@ SeriousWarningNotificationLevel
Definition NotificationManager.hpp:226
@ ErrorNotificationLevel
Definition NotificationManager.hpp:228

References bbl_render_block_notif_buttons(), bbl_render_block_notif_left_sign(), bbl_render_block_notif_text(), Slic3r::GUI::ImGuiWrapper::begin(), ClosePending, Slic3r::GUI::ImGuiWrapper::end(), Slic3r::GUI::NotificationManager::ErrorNotificationLevel, FadingOut, Finished, GAP_WIDTH, Slic3r::GUI::GLCanvas3D::get_canvas_size(), Slic3r::GUI::Size::get_height(), Slic3r::GUI::Size::get_width(), Hidden, Slic3r::GUI::NotificationManager::init(), m_current_fade_opacity, m_data, m_ErrorColor, m_id, m_id_provider, m_line_height, m_state, m_top_y, m_WarnColor, m_window_height, m_window_width, push_background_color(), restore_default_theme(), Slic3r::GUI::NotificationManager::SeriousWarningNotificationLevel, set_hovered(), Slic3r::GUI::ImGuiWrapper::set_next_window_pos(), Slic3r::GUI::ImGuiWrapper::set_next_window_size(), set_next_window_size(), Unknown, and use_bbl_theme().

Here is the call graph for this function:

◆ bbl_render_left_sign()

void Slic3r::GUI::NotificationManager::PopNotification::bbl_render_left_sign ( ImGuiWrapper & imgui,
const float win_size_x,
const float win_size_y,
const float win_pos_x,
const float win_pos_y )
protectedvirtual
985{
987 ImDrawList *draw_list = ImGui::GetWindowDrawList();
988 ImVec2 round_rect_pos = ImVec2(win_pos_x - win_size_x + ImGui::GetStyle().WindowBorderSize, win_pos_y + ImGui::GetStyle().WindowBorderSize);
989 ImVec2 round_rect_size = ImVec2(m_WindowRadius * 2, win_size_y - 2 * ImGui::GetStyle().WindowBorderSize);
990
991 ImVec2 rect_pos = round_rect_pos + ImVec2(m_WindowRadius, 0);
992 ImVec2 rect_size = ImVec2(round_rect_size.x / 2, round_rect_size.y);
993
994 ImU32 clr = ImGui::GetColorU32(ImVec4(m_CurrentColor.x, m_CurrentColor.y, m_CurrentColor.z, m_current_fade_opacity));
995
996 draw_list->AddRectFilled(round_rect_pos, round_rect_pos + round_rect_size, clr, m_WindowRadius);
997 draw_list->AddRectFilled(rect_pos, rect_pos + rect_size, clr, 0);
998}
float m_WindowRadius
Definition NotificationManager.hpp:606
void ensure_ui_inited()
Definition NotificationManager.cpp:205

References ensure_ui_inited(), m_current_fade_opacity, m_CurrentColor, and m_WindowRadius.

Referenced by render().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ close()

◆ compare_text()

bool Slic3r::GUI::NotificationManager::PopNotification::compare_text ( const std::string & text) const
virtual

Reimplemented in Slic3r::GUI::NotificationManager::PrintHostUploadNotification, and Slic3r::GUI::NotificationManager::URLDownloadNotification.

1073{
1074 std::wstring wt1 = boost::nowide::widen(m_text1);
1075 std::wstring wt2 = boost::nowide::widen(text);
1076 wt1.erase(std::remove_if(wt1.begin(), wt1.end(), ::iswspace), wt1.end());
1077 wt2.erase(std::remove_if(wt2.begin(), wt2.end(), ::iswspace), wt2.end());
1078 if (wt1.compare(wt2) == 0)
1079 return true;
1080 return false;
1081}

References m_text1.

◆ count_lines()

void Slic3r::GUI::NotificationManager::PopNotification::count_lines ( )
protectedvirtual

Reimplemented in Slic3r::GUI::NotificationManager::HintNotification.

530{
531 std::string text = m_text1;
532 size_t last_end = 0;
533 m_lines_count = 0;
534
535 if (text.empty())
536 return;
537
538 // handle with marks
539 if (pos_start == std::string::npos && pos_end == std::string::npos) {
540 pos_start = text.find(error_start);
541 if (pos_start != std::string::npos) {
542 text.erase(pos_start, error_start.length());
543 pos_end = text.find(error_end);
544 if (pos_end != std::string::npos) {
545 text.erase(pos_end, error_end.length());
546 }
547 }
548 m_text1 = text;
549 }
550
551 m_endlines.clear();
552 while (last_end < text.length())
553 {
554 size_t next_hard_end = text.find_first_of('\n', last_end);
555 if (next_hard_end != std::string::npos && ImGui::CalcTextSize(text.substr(last_end, next_hard_end - last_end).c_str()).x < m_window_width - m_window_width_offset) {
556 //next line is ended by '/n'
557 m_endlines.push_back(next_hard_end);
558 last_end = next_hard_end + 1;
559 }
560 else {
561 // find next suitable endline
562 if (ImGui::CalcTextSize(text.substr(last_end).c_str()).x >= m_window_width - m_window_width_offset) {
563 // more than one line till end
564 size_t next_space = text.find_first_of(' ', last_end);
565 if (next_space > 0 && next_space < text.length()) {
566 size_t next_space_candidate = text.find_first_of(' ', next_space + 1);
567 while (next_space_candidate > 0 && ImGui::CalcTextSize(text.substr(last_end, next_space_candidate - last_end).c_str()).x < m_window_width - m_window_width_offset) {
568 next_space = next_space_candidate;
569 next_space_candidate = text.find_first_of(' ', next_space + 1);
570 }
571 } else {
572 next_space = text.length();
573 }
574 // when one word longer than line.
575 if (ImGui::CalcTextSize(text.substr(last_end, next_space - last_end).c_str()).x > m_window_width - m_window_width_offset ||
576 ImGui::CalcTextSize(text.substr(last_end, next_space - last_end).c_str()).x < (m_window_width - m_window_width_offset) / 4 * 3
577 ) {
578 //BBS
579 wxString wx_text = from_u8(text.substr(last_end, text.length() - last_end).c_str());
580 float width_of_char = ImGui::CalcTextSize("a").x;
581 int letter_count = (int) ((m_window_width - m_window_width_offset) / width_of_char) / 2; // give a predict value of char count
582 int output_count = 0;
583 while (true) {
584 if (letter_count >= wx_text.size())
585 break;
586 float used_space = ImGui::CalcTextSize(into_u8(wx_text.SubString(0, letter_count)).c_str()).x;
587 if (used_space > m_window_width - m_window_width_offset)
588 break;
589 letter_count++;
590 }
591 if (letter_count > 0) {
592 output_count = into_u8(wx_text.SubString(0, letter_count - 1)).size();
593 }
594 m_endlines.push_back(last_end + output_count);
595 last_end += output_count;
596 } else {
597 m_endlines.push_back(next_space);
598 last_end = next_space + 1;
599 }
600 }
601 else {
602 m_endlines.push_back(text.length());
603 last_end = text.length();
604 }
605
606 }
608 }
609 // hypertext calculation
610 if (!m_hypertext.empty()) {
611 int prev_end = m_endlines.size() > 1 ? m_endlines[m_endlines.size() - 2] : 0; // m_endlines.size() - 2 because we are fitting hypertext instead of last endline
612 if (ImGui::CalcTextSize((escape_string_cstyle(text.substr(prev_end, last_end - prev_end)) + m_hypertext).c_str()).x > m_window_width - m_window_width_offset) {
613 m_endlines.push_back(last_end);
615 }
616 }
617
618 // m_text_2 (text after hypertext) is not used for regular notifications right now.
619 // its caluculation is in HintNotification::count_lines()
620}
std::string error_start
Definition NotificationManager.hpp:636
std::string error_end
Definition NotificationManager.hpp:637
wxString from_u8(const std::string &str)
Definition GUI.cpp:544
std::string escape_string_cstyle(const std::string &str)
Definition Config.cpp:76

References error_end, error_start, Slic3r::escape_string_cstyle(), Slic3r::GUI::from_u8(), Slic3r::GUI::into_u8(), m_endlines, m_hypertext, m_lines_count, m_text1, m_window_width, m_window_width_offset, pos_end, and pos_start.

Referenced by init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ count_spaces()

void Slic3r::GUI::NotificationManager::PopNotification::count_spaces ( )
protectedvirtual

Reimplemented in Slic3r::GUI::NotificationManager::ExportFinishedNotification, Slic3r::GUI::NotificationManager::HintNotification, Slic3r::GUI::NotificationManager::PrintHostUploadNotification, Slic3r::GUI::NotificationManager::UpdatedItemsInfoNotification, and Slic3r::GUI::NotificationManager::URLDownloadNotification.

507{
508 //determine line width
509 m_line_height = ImGui::CalcTextSize("A").y;
510
512 //if (m_data.level == NotificationLevel::ErrorNotificationLevel
513 // || m_data.level == NotificationLevel::WarningNotificationLevel
514 // || m_data.level == NotificationLevel::PrintInfoNotificationLevel
515 // || m_data.level == NotificationLevel::PrintInfoShortNotificationLevel) {
516 // std::string text;
517 // text = (m_data.level == NotificationLevel::ErrorNotificationLevel ? ImGui::ErrorMarker : ImGui::WarningMarker);
518 // float picture_width = ImGui::CalcTextSize(text.c_str()).x;
519 // m_left_indentation = picture_width + m_line_height / 2;
520 //}
525 }
527}

References Slic3r::GUI::NotificationManager::ErrorNotificationLevel, m_data, m_left_indentation, m_line_height, m_window_width, m_window_width_offset, and Slic3r::GUI::NotificationManager::SeriousWarningNotificationLevel.

Referenced by Slic3r::GUI::NotificationManager::ExportFinishedNotification::count_spaces(), Slic3r::GUI::NotificationManager::URLDownloadNotification::count_spaces(), and init().

Here is the caller graph for this function:

◆ ensure_ui_inited()

void Slic3r::GUI::NotificationManager::PopNotification::ensure_ui_inited ( )
protected
206{
207 if (!m_is_dark_inited) {
208 m_is_dark = wxGetApp().plater()->get_current_canvas3D()->get_dark_mode_status();
209 m_is_dark_inited = true;
210 }
211
213 m_WindowRadius = 4.0f * wxGetApp().plater()->get_current_canvas3D()->get_scale();
215 }
216}
bool m_is_dark_inited
Definition NotificationManager.hpp:576
bool m_WindowRadius_inited
Definition NotificationManager.hpp:607
bool m_is_dark
Definition NotificationManager.hpp:575

References m_is_dark, m_is_dark_inited, m_WindowRadius, and m_WindowRadius_inited.

Referenced by bbl_render_left_sign(), render_close_button(), render_minimize_button(), and use_bbl_theme().

Here is the caller graph for this function:

◆ get_bottom()

float Slic3r::GUI::NotificationManager::PopNotification::get_bottom ( ) const
inline
502{ return m_bottom_y; }
float m_bottom_y
Definition NotificationManager.hpp:652

References m_bottom_y.

◆ get_current_top()

float Slic3r::GUI::NotificationManager::PopNotification::get_current_top ( ) const
inline
504{ return m_top_y; }

References m_top_y.

◆ get_data()

const NotificationData & Slic3r::GUI::NotificationManager::PopNotification::get_data ( ) const
inline
506{ return m_data; }

References m_data.

Referenced by Slic3r::GUI::NotificationManager::activate_existing(), Slic3r::GUI::NotificationManager::UpdatedItemsInfoNotification::add_type(), and Slic3r::GUI::NotificationManager::ExportFinishedNotification::on_eject_click().

Here is the caller graph for this function:

◆ get_duration()

virtual int Slic3r::GUI::NotificationManager::PopNotification::get_duration ( )
inlineprotectedvirtual

Reimplemented in Slic3r::GUI::NotificationManager::SlicingProgressNotification.

571{ return m_data.duration; }

References m_data.

Referenced by update_state().

Here is the caller graph for this function:

◆ get_state()

EState Slic3r::GUI::NotificationManager::PopNotification::get_state ( ) const
inline
515{ return m_state; }

References m_state.

Referenced by Slic3r::GUI::NotificationManager::ProgressIndicatorNotification::update_state(), and Slic3r::GUI::NotificationManager::SlicingProgressNotification::update_state().

Here is the caller graph for this function:

◆ get_text1()

std::string Slic3r::GUI::NotificationManager::PopNotification::get_text1 ( ) const
inline
507{ return m_text1; }

References m_text1.

◆ get_top()

float Slic3r::GUI::NotificationManager::PopNotification::get_top ( ) const
inline
500{ return m_top_y; }

References m_top_y.

◆ get_type()

const NotificationType Slic3r::GUI::NotificationManager::PopNotification::get_type ( ) const
inline
505{ return m_data.type; }

References m_data.

Referenced by Slic3r::GUI::NotificationManager::activate_existing().

Here is the caller graph for this function:

◆ hide()

void Slic3r::GUI::NotificationManager::PopNotification::hide ( bool h)
1084{
1085 if (is_finished()) return;
1087}
bool is_finished() const
Definition NotificationManager.hpp:497

References Hidden, is_finished(), m_state, and Unknown.

Here is the call graph for this function:

◆ init()

void Slic3r::GUI::NotificationManager::PopNotification::init ( )
protectedvirtual

Reimplemented in Slic3r::GUI::NotificationManager::HintNotification, Slic3r::GUI::NotificationManager::OrcaSyncConflictNotification, Slic3r::GUI::NotificationManager::PluginMissingNotification, Slic3r::GUI::NotificationManager::PrintHostUploadNotification, Slic3r::GUI::NotificationManager::ProgressBarNotification, Slic3r::GUI::NotificationManager::ProgressIndicatorNotification, Slic3r::GUI::NotificationManager::SharedProfilesNotification, and Slic3r::GUI::NotificationManager::SlicingProgressNotification.

623{
624 // Do not init closing notification
625 if (is_finished())
626 return;
627
628 count_spaces();
629 count_lines();
630
631 if (m_lines_count <= 6) {
632 if (m_state == EState::Unknown) // if is default state
633 m_multiline = true;
634 }
635
639}
virtual void count_spaces()
Definition NotificationManager.cpp:506
@ Hovered
Definition NotificationManager.hpp:484
@ Shown
Definition NotificationManager.hpp:479
virtual void count_lines()
Definition NotificationManager.cpp:529

References count_lines(), count_spaces(), Hovered, is_finished(), m_lines_count, m_multiline, m_notification_start, m_state, Shown, Slic3r::GUI::GLCanvas3D::timestamp_now(), and Unknown.

Referenced by Slic3r::GUI::NotificationManager::OrcaSyncConflictNotification::init(), Slic3r::GUI::NotificationManager::PluginMissingNotification::init(), Slic3r::GUI::NotificationManager::ProgressBarNotification::init(), Slic3r::GUI::NotificationManager::ProgressIndicatorNotification::init(), Slic3r::GUI::NotificationManager::SharedProfilesNotification::init(), and Slic3r::GUI::NotificationManager::SlicingProgressNotification::init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_finished()

bool Slic3r::GUI::NotificationManager::PopNotification::is_finished ( ) const
inline

References ClosePending, Finished, and m_state.

Referenced by Slic3r::GUI::NotificationManager::PlaterWarningNotification::close(), hide(), Slic3r::GUI::NotificationManager::HintNotification::init(), init(), and next_render().

Here is the caller graph for this function:

◆ is_gray()

const bool Slic3r::GUI::NotificationManager::PopNotification::is_gray ( ) const
inline
508{ return m_is_gray; }
bool m_is_gray
Definition NotificationManager.hpp:660

References m_is_gray.

◆ is_hovered()

bool Slic3r::GUI::NotificationManager::PopNotification::is_hovered ( ) const
inline
516{ return m_state == EState::Hovered; }

References Hovered, and m_state.

◆ is_valid_delete_callback()

bool Slic3r::GUI::NotificationManager::PopNotification::is_valid_delete_callback ( )
230{
232 return true;
233 return false;
234}
DeleteCallback m_on_delete_callback
Definition NotificationManager.hpp:639

References m_on_delete_callback.

◆ next_render()

int64_t Slic3r::GUI::NotificationManager::PopNotification::next_render ( ) const
inline
514{ return is_finished() ? 0 : m_next_render; }
int64_t m_next_render
Definition NotificationManager.hpp:622

References is_finished(), and m_next_render.

Referenced by update_state().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ on_change_color_mode()

void Slic3r::GUI::NotificationManager::PopNotification::on_change_color_mode ( bool is_dark)
virtual

Reimplemented in Slic3r::GUI::NotificationManager::SlicingProgressNotification.

219{
220 m_is_dark_inited = true;
222}
static bool is_dark()
Definition TextureImportDialog.cpp:85

References is_dark(), m_is_dark, and m_is_dark_inited.

Referenced by Slic3r::GUI::NotificationManager::SlicingProgressNotification::on_change_color_mode().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ on_text_click()

bool Slic3r::GUI::NotificationManager::PopNotification::on_text_click ( )
protectedvirtual

Reimplemented in Slic3r::GUI::NotificationManager::ExportFinishedNotification, Slic3r::GUI::NotificationManager::HintNotification, and Slic3r::GUI::NotificationManager::SharedProfilesNotification.

1048{
1049 if(m_data.callback != nullptr)
1050 return m_data.callback(m_evt_handler);
1051 return false;
1052}

References m_data, and m_evt_handler.

Referenced by render_hypertext().

Here is the caller graph for this function:

◆ push_background_color()

bool Slic3r::GUI::NotificationManager::PopNotification::push_background_color ( )
protectedvirtual

Reimplemented in Slic3r::GUI::NotificationManager::PrintHostUploadNotification.

484{
485 if (m_is_gray) {
486 ImVec4 backcolor(0.7f, 0.7f, 0.7f, 0.5f);
487 push_style_color(ImGuiCol_WindowBg, backcolor, m_state == EState::FadingOut, m_current_fade_opacity);
488 return true;
489 }
491 ImVec4 backcolor = ImGui::GetStyleColorVec4(ImGuiCol_WindowBg);
492 backcolor.x += 0.3f;
493 push_style_color(ImGuiCol_WindowBg, backcolor, m_state == EState::FadingOut, m_current_fade_opacity);
494 return true;
495 }
497 ImVec4 backcolor = ImGui::GetStyleColorVec4(ImGuiCol_WindowBg);
498 backcolor.x += 0.3f;
499 backcolor.y += 0.15f;
500 push_style_color(ImGuiCol_WindowBg, backcolor, m_state == EState::FadingOut, m_current_fade_opacity);
501 return true;
502 }
503
504 return false;
505}
@ WarningNotificationLevel
Definition NotificationManager.hpp:224

References Slic3r::GUI::NotificationManager::ErrorNotificationLevel, FadingOut, m_current_fade_opacity, m_data, m_is_gray, m_state, and Slic3r::GUI::NotificationManager::WarningNotificationLevel.

Referenced by bbl_render_block_notification(), and render().

Here is the caller graph for this function:

◆ reinit()

void Slic3r::GUI::NotificationManager::PopNotification::reinit ( )
inline

References m_state, and Unknown.

◆ render()

void Slic3r::GUI::NotificationManager::PopNotification::render ( GLCanvas3D & canvas,
float initial_y,
bool move_from_overlay,
float overlay_width,
float right_margin )
virtual

Reimplemented in Slic3r::GUI::NotificationManager::SlicingProgressNotification.

295{
297 init();
298
299 if (m_state == EState::Hidden) {
300 m_top_y = initial_y - GAP_WIDTH;
301 return;
302 }
303
305 {
307 return;
308 }
309
310 Size cnv_size = canvas.get_canvas_size();
311 ImGuiWrapper& imgui = *wxGetApp().imgui();
312 ImVec2 mouse_pos = ImGui::GetMousePos();
313 float right_gap = right_margin + (move_from_overlay ? overlay_width + m_line_height * 5 : 0);
314 bool fading_pop = false;
315
316 if (m_line_height != ImGui::CalcTextSize("A").y)
317 init();
318
320
321 // top y of window
322 m_top_y = initial_y + m_window_height;
323
324 // position of upper-right corner
325 ImVec2 win_pos(1.0f * (float)cnv_size.get_width() - right_gap, 1.0f * (float)cnv_size.get_height() - m_top_y);
326 imgui.set_next_window_pos(win_pos.x, win_pos.y, ImGuiCond_Always, 1.0f, 0.0f);
327 imgui.set_next_window_size(m_window_width, m_window_height, ImGuiCond_Always);
328
329 // find if hovered FIXME: do it only in update state?
330 if (m_state == EState::Hovered) {
331 init();
332 }
333
334 if (mouse_pos.x < win_pos.x && mouse_pos.x > win_pos.x - m_window_width && mouse_pos.y > win_pos.y && mouse_pos.y < win_pos.y + m_window_height) {
335 // Uncomment if imgui window focus is needed on hover. I cant find any case.
336 //ImGui::SetNextWindowFocus();
337 set_hovered();
338 }
339
340 // color change based on fading out
341 if (m_state == EState::FadingOut) {
342 push_style_color(ImGuiCol_WindowBg, ImGui::GetStyleColorVec4(ImGuiCol_WindowBg), true, m_current_fade_opacity);
343 push_style_color(ImGuiCol_Text, ImGui::GetStyleColorVec4(ImGuiCol_Text), true, m_current_fade_opacity);
344 push_style_color(ImGuiCol_ButtonHovered, ImGui::GetStyleColorVec4(ImGuiCol_ButtonHovered), true, m_current_fade_opacity);
345 fading_pop = true;
346 }
347
348 bool bgrnd_color_pop = push_background_color();
349
350 // name of window indentifies window - has to be unique string
351 if (m_id == 0)
352 m_id = m_id_provider.allocate_id();
353 std::string name = "!!Ntfctn" + std::to_string(m_id);
354
356
357 int window_flags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse;
358 if (imgui.begin(name, window_flags)) {
359 ImVec2 win_size = ImGui::GetWindowSize();
360
361 bbl_render_left_sign(imgui, win_size.x, win_size.y, win_pos.x, win_pos.y);
362 render_left_sign(imgui);
363 render_text(imgui, win_size.x, win_size.y, win_pos.x, win_pos.y);
364 m_minimize_b_visible = false;
365 if (m_multiline && m_lines_count > 3)
366 render_minimize_button(imgui, win_pos.x, win_pos.y);
367 render_close_button(imgui, win_size.x, win_size.y, win_pos.x, win_pos.y); // ORCA draw it after minimize button since its position related to minimize button
368 }
369
370 const bool gcode_window_visible = canvas.get_canvas_type() == GLCanvas3D::ECanvasType::CanvasPreview && wxGetApp().show_gcode_window();
371 if (!gcode_window_visible)
372 {
373 ImGui::BringWindowToDisplayFront(ImGui::GetCurrentWindow());
374 }
375
376 imgui.end();
377
379
380 if (bgrnd_color_pop)
381 ImGui::PopStyleColor();
382
383 if (fading_pop)
384 ImGui::PopStyleColor(3);
385}
@ CanvasPreview
Definition GLCanvas3D.hpp:627
virtual void render_left_sign(ImGuiWrapper &imgui)
Definition NotificationManager.cpp:1000
virtual void render_minimize_button(ImGuiWrapper &imgui, const float win_pos_x, const float win_pos_y)
Definition NotificationManager.cpp:1016
virtual void render_text(ImGuiWrapper &imgui, const float win_size_x, const float win_size_y, const float win_pos_x, const float win_pos_y)
Definition NotificationManager.cpp:710
bool m_minimize_b_visible
Definition NotificationManager.hpp:664
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)
Definition NotificationManager.cpp:858
virtual void bbl_render_left_sign(ImGuiWrapper &imgui, const float win_size_x, const float win_size_y, const float win_pos_x, const float win_pos_y)
Definition NotificationManager.cpp:984

References bbl_render_left_sign(), Slic3r::GUI::ImGuiWrapper::begin(), Slic3r::GUI::GLCanvas3D::CanvasPreview, ClosePending, Slic3r::GUI::ImGuiWrapper::end(), FadingOut, Finished, GAP_WIDTH, Slic3r::GUI::GLCanvas3D::get_canvas_size(), Slic3r::GUI::GLCanvas3D::get_canvas_type(), Slic3r::GUI::Size::get_height(), Slic3r::GUI::Size::get_width(), Hidden, Hovered, Slic3r::GUI::NotificationManager::init(), m_current_fade_opacity, m_id, m_id_provider, m_line_height, m_lines_count, m_minimize_b_visible, m_multiline, m_state, m_top_y, m_window_height, m_window_width, push_background_color(), render_close_button(), render_left_sign(), render_minimize_button(), render_text(), restore_default_theme(), set_hovered(), Slic3r::GUI::ImGuiWrapper::set_next_window_pos(), Slic3r::GUI::ImGuiWrapper::set_next_window_size(), set_next_window_size(), Unknown, and use_bbl_theme().

Here is the call graph for this function:

◆ render_close_button()

void Slic3r::GUI::NotificationManager::PopNotification::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 )
protectedvirtual

Reimplemented in Slic3r::GUI::NotificationManager::ExportFinishedNotification, Slic3r::GUI::NotificationManager::HintNotification, Slic3r::GUI::NotificationManager::PluginMissingNotification, Slic3r::GUI::NotificationManager::ProgressIndicatorNotification, and Slic3r::GUI::NotificationManager::URLDownloadNotification.

859{
861 ImVec2 win_size(win_size_x, win_size_y);
862 ImVec2 win_pos(win_pos_x, win_pos_y);
863 ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(.0f, .0f, .0f, .0f));
864 ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(.0f, .0f, .0f, .0f));
865 push_style_color(ImGuiCol_Text, ImVec4(1.f, 1.f, 1.f, 1.f), m_state == EState::FadingOut, m_current_fade_opacity);
866 push_style_color(ImGuiCol_TextSelectedBg, ImVec4(0, .75f, .75f, 1.f), m_state == EState::FadingOut, m_current_fade_opacity);
867 ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(.0f, .0f, .0f, .0f));
868
869
870 std::wstring button_text;
871 button_text = m_is_dark ? ImGui::CloseNotifDarkButton : ImGui::CloseNotifButton;
872 //button_text = ImGui::PreferencesButton;
873
874 //if (ImGui::IsMouseHoveringRect(ImVec2(win_pos.x - win_size.x / 10.f, win_pos.y),
875 // ImVec2(win_pos.x, win_pos.y + win_size.y - ( m_minimize_b_visible ? 2 * m_line_height : 0)),
876 // true))
877 if (ImGui::IsMouseHoveringRect(ImVec2(win_pos.x - win_size.x / 10.f, win_pos.y), ImVec2(win_pos.x, win_pos.y + 2 * m_line_height+10),true))
878 {
879 button_text = m_is_dark ? ImGui::CloseNotifHoverDarkButton : ImGui::CloseNotifHoverButton;
880 }
881 ImVec2 button_pic_size = ImGui::CalcTextSize(into_u8(button_text).c_str());
882 ImVec2 button_size(button_pic_size.x * 1.25f, button_pic_size.y * 1.25f);
883 ImGui::SetCursorPosX(win_size.x - m_line_height * 2.75f);
884 //ImGui::SetCursorPosY(win_size.y / 2 - button_size.y);
886 ImGui::SetCursorPosY(0);
887 else
888 ImGui::SetCursorPosY(win_size.y / 2 - button_size.y);
889 if (imgui.button(button_text.c_str(), button_size.x, button_size.y))
890 {
891 close();
892 }
893
894 //invisible large button
895 ImGui::SetCursorPosX(win_size.x - m_line_height * 2.35f);
896 ImGui::SetCursorPosY(0);
897 if (imgui.button(" ", m_line_height * 2.125, win_size.y - ( m_minimize_b_visible ? 2 * m_line_height : 0)))
898 {
899 close();
900 }
901
902 ImGui::PopStyleColor(5);
903}

References Slic3r::GUI::ImGuiWrapper::button(), close(), ensure_ui_inited(), FadingOut, Slic3r::GUI::into_u8(), m_current_fade_opacity, m_is_dark, m_line_height, m_minimize_b_visible, and m_state.

Referenced by render(), Slic3r::GUI::NotificationManager::ExportFinishedNotification::render_close_button(), and Slic3r::GUI::NotificationManager::ProgressIndicatorNotification::render_close_button().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ render_hyperlink_action()

void Slic3r::GUI::NotificationManager::PopNotification::render_hyperlink_action ( ImGuiWrapper & imgui,
float text_x,
float text_y,
const std::string & text,
const char * button_id,
const std::function< void()> & on_click )
protected
824{
825 // Invisible button over the label
826 ImVec2 part_size = ImGui::CalcTextSize(text.c_str());
827 ImGui::SetCursorPosX(text_x - 4);
828 ImGui::SetCursorPosY(text_y - 5);
829 ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(.0f, .0f, .0f, .0f));
830 ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(.0f, .0f, .0f, .0f));
831 ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(.0f, .0f, .0f, .0f));
832 if (imgui.button(button_id, part_size.x + 6, part_size.y + 10) && on_click)
833 on_click();
834 ImGui::PopStyleColor(3);
835
836 // Hover color
837 ImVec4 color = m_HyperTextColor;
838 if (ImGui::IsItemHovered(ImGuiHoveredFlags_RectOnly))
839 color = m_HyperTextColorHover;
840
841 // Text
843 ImGui::SetCursorPosX(text_x);
844 ImGui::SetCursorPosY(text_y);
845 imgui.text(text.c_str());
846 ImGui::PopStyleColor();
847
848 // Underline
849 ImVec2 lineEnd = ImGui::GetItemRectMax();
850 lineEnd.y -= 2;
851 ImVec2 lineStart = lineEnd;
852 lineStart.x = ImGui::GetItemRectMin().x;
853 ImGui::GetWindowDrawList()->AddLine(lineStart, lineEnd,
854 IM_COL32((int)(color.x * 255), (int)(color.y * 255), (int)(color.z * 255),
855 (int)(color.w * 255.f * (m_state == EState::FadingOut ? m_current_fade_opacity : 1.f))));
856}
ImVec4 m_HyperTextColorHover
Definition NotificationManager.hpp:599

References Slic3r::GUI::ImGuiWrapper::button(), FadingOut, m_current_fade_opacity, m_HyperTextColor, m_HyperTextColorHover, m_state, and Slic3r::GUI::ImGuiWrapper::text().

Referenced by Slic3r::GUI::NotificationManager::SharedProfilesNotification::render_hypertext(), Slic3r::GUI::NotificationManager::OrcaSyncConflictNotification::render_text(), and Slic3r::GUI::NotificationManager::PluginMissingNotification::render_text().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ render_hypertext()

void Slic3r::GUI::NotificationManager::PopNotification::render_hypertext ( ImGuiWrapper & imgui,
const float text_x,
const float text_y,
const std::string text,
bool more = false )
protectedvirtual

Reimplemented in Slic3r::GUI::NotificationManager::SharedProfilesNotification.

763{
764 //invisible button
765 ImVec2 part_size = ImGui::CalcTextSize(text.c_str());
766 ImGui::SetCursorPosX(text_x -4);
767 ImGui::SetCursorPosY(text_y -5);
768 ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(.4f, .4f, .4f, 0.0f));
769 ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(.5f, .5f, .5f, 0.0f));
770 ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(.7f, .7f, .7f, 0.0f));
771 if (imgui.button(" ", part_size.x + 6, part_size.y + 10))
772 {
773 if (more)
774 {
775 m_multiline = true;
777 }
778 else if (on_text_click()) {
779 close();
780 }
781 }
782 ImGui::PopStyleColor(3);
783
784 //hover color
785 ImVec4 HyperColor = m_HyperTextColor;//ImVec4(150.f / 255.f, 100.f / 255.f, 0.f / 255.f, 1)
787 HyperColor = ImVec4(0.f, 0.f, 0.f, 0.4f);
789 HyperColor = ImVec4(135.f / 255.f, 43 / 255.f, 43 / 255.f, 1);
790 if (ImGui::IsItemHovered(ImGuiHoveredFlags_RectOnly))
791 {
793 HyperColor.y += 0.1f;
794 HyperColor.x += 0.2f;
795 }
797 HyperColor.y += 0.1f;
798 }
799 else {
800 HyperColor = m_HyperTextColorHover;
801 }
802 }
803
804 //text
806 ImGui::SetCursorPosX(text_x);
807 ImGui::SetCursorPosY(text_y);
808 imgui.text(text.c_str());
809 ImGui::PopStyleColor();
810
811 //underline
812 ImVec2 lineEnd = ImGui::GetItemRectMax();
813 lineEnd.y -= 2;
814 ImVec2 lineStart = lineEnd;
815 lineStart.x = ImGui::GetItemRectMin().x;
816 ImGui::GetWindowDrawList()->AddLine(lineStart, lineEnd,
817 IM_COL32((int) (HyperColor.x * 255), (int) (HyperColor.y * 255), (int) (HyperColor.z * 255),
818 (int) (HyperColor.w * 255.f * (m_state == EState::FadingOut ? m_current_fade_opacity : 1.f))));
819
820}
virtual bool on_text_click()
Definition NotificationManager.cpp:1047

References Slic3r::GUI::ImGuiWrapper::button(), close(), Slic3r::GUI::NotificationManager::ErrorNotificationLevel, FadingOut, m_current_fade_opacity, m_data, m_HyperTextColor, m_HyperTextColorHover, m_multiline, m_state, on_text_click(), Slic3r::GUI::NotificationManager::SeriousWarningNotificationLevel, set_next_window_size(), and Slic3r::GUI::ImGuiWrapper::text().

Referenced by bbl_render_block_notif_text(), Slic3r::GUI::NotificationManager::SharedProfilesNotification::render_hypertext(), Slic3r::GUI::NotificationManager::ExportFinishedNotification::render_text(), Slic3r::GUI::NotificationManager::HintNotification::render_text(), and render_text().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ render_left_sign()

void Slic3r::GUI::NotificationManager::PopNotification::render_left_sign ( ImGuiWrapper & imgui)
protectedvirtual

Reimplemented in Slic3r::GUI::NotificationManager::PrintHostUploadNotification.

1001{
1002 //if (m_data.level == NotificationLevel::ErrorNotificationLevel || m_data.level == NotificationLevel::WarningNotificationLevel) {
1003 // std::string text;
1004 // text = (m_data.level == NotificationLevel::ErrorNotificationLevel ? ImGui::ErrorMarker : ImGui::WarningMarker);
1005 // ImGui::SetCursorPosX(m_line_height / 3);
1006 // ImGui::SetCursorPosY(m_window_height / 2 - m_line_height);
1007 // imgui.text(text.c_str());
1008 //} else if (m_data.level == NotificationLevel::PrintInfoNotificationLevel || m_data.level == NotificationLevel::PrintInfoShortNotificationLevel) {
1009 // std::wstring text;
1010 // text = ImGui::InfoMarker;
1011 // ImGui::SetCursorPosX(m_line_height / 3);
1012 // ImGui::SetCursorPosY(m_window_height / 2 - m_line_height);
1013 // imgui.text(text.c_str());
1014 //}
1015}

Referenced by render().

Here is the caller graph for this function:

◆ render_minimize_button()

void Slic3r::GUI::NotificationManager::PopNotification::render_minimize_button ( ImGuiWrapper & imgui,
const float win_pos_x,
const float win_pos_y )
protectedvirtual

Reimplemented in Slic3r::GUI::NotificationManager::ExportFinishedNotification, Slic3r::GUI::NotificationManager::HintNotification, Slic3r::GUI::NotificationManager::PluginMissingNotification, and Slic3r::GUI::NotificationManager::ProgressBarNotification.

1017{
1019 ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(.0f, .0f, .0f, .0f));
1020 ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(.0f, .0f, .0f, .0f));
1021 push_style_color(ImGuiCol_ButtonActive, ImGui::GetStyleColorVec4(ImGuiCol_WindowBg), m_state == EState::FadingOut, m_current_fade_opacity);
1022 push_style_color(ImGuiCol_Text, ImVec4(1.f, 1.f, 1.f, 1.f), m_state == EState::FadingOut, m_current_fade_opacity);
1023 push_style_color(ImGuiCol_TextSelectedBg, ImVec4(0, .75f, .75f, 1.f), m_state == EState::FadingOut, m_current_fade_opacity);
1024
1025
1026 //button - if part if treggered
1027 std::wstring button_text;
1028 button_text = m_is_dark ? ImGui::MinimalizeDarkButton : ImGui::MinimalizeButton;
1029 if (ImGui::IsMouseHoveringRect(ImVec2(win_pos_x - m_window_width / 10.f, win_pos_y + m_window_height - 2 * m_line_height + 1),
1030 ImVec2(win_pos_x, win_pos_y + m_window_height),
1031 true))
1032 {
1033 button_text = m_is_dark ? ImGui::MinimalizeHoverDarkButton : ImGui::MinimalizeHoverButton;
1034 }
1035 ImVec2 button_pic_size = ImGui::CalcTextSize(into_u8(button_text).c_str());
1036 ImVec2 button_size(button_pic_size.x * 1.25f, button_pic_size.y * 1.25f);
1037 ImGui::SetCursorPosX(m_window_width - m_line_height * 1.8f);
1038 ImGui::SetCursorPosY(m_window_height - button_size.y - 5);
1039 if (imgui.button(button_text.c_str(), button_size.x, button_size.y))
1040 {
1041 m_multiline = false;
1042 }
1043
1044 ImGui::PopStyleColor(5);
1045 m_minimize_b_visible = true;
1046}

References Slic3r::GUI::ImGuiWrapper::button(), ensure_ui_inited(), FadingOut, Slic3r::GUI::into_u8(), m_current_fade_opacity, m_is_dark, m_line_height, m_minimize_b_visible, m_multiline, m_state, m_window_height, and m_window_width.

Referenced by render().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ render_text()

void Slic3r::GUI::NotificationManager::PopNotification::render_text ( ImGuiWrapper & imgui,
const float win_size_x,
const float win_size_y,
const float win_pos_x,
const float win_pos_y )
protectedvirtual

Reimplemented in Slic3r::GUI::NotificationManager::ExportFinishedNotification, Slic3r::GUI::NotificationManager::HintNotification, Slic3r::GUI::NotificationManager::OrcaSyncConflictNotification, Slic3r::GUI::NotificationManager::PluginMissingNotification, Slic3r::GUI::NotificationManager::ProgressBarNotification, and Slic3r::GUI::NotificationManager::SharedProfilesNotification.

711{
712 float x_offset = m_left_indentation;
713 int last_end = 0;
714 float starting_y = (m_lines_count == 2 ? win_size_y / 2 - m_line_height : (m_lines_count == 1 ? win_size_y / 2 - m_line_height / 2 : m_line_height / 2));
715 float shift_y = m_line_height;
716 std::string line;
717
718 for (size_t i = 0; i < (m_multiline ? m_endlines.size() : std::min(m_endlines.size(), (size_t)2)); i++) {
719 assert(m_endlines.size() > i && m_text1.size() >= m_endlines[i]);
720 line.clear();
721 ImGui::SetCursorPosX(x_offset);
722 ImGui::SetCursorPosY(starting_y + i * shift_y);
723 if (m_endlines.size() > i && m_text1.size() >= m_endlines[i]) {
724 if (i == 1 && m_endlines.size() > 2 && !m_multiline) {
725 // second line with "more" hypertext
726 line = m_text1.substr(m_endlines[0] + (m_text1[m_endlines[0]] == '\n' || m_text1[m_endlines[0]] == ' ' ? 1 : 0), m_endlines[1] - m_endlines[0] - (m_text1[m_endlines[0]] == '\n' || m_text1[m_endlines[0]] == ' ' ? 1 : 0));
727 while (ImGui::CalcTextSize(line.c_str()).x > m_window_width - m_window_width_offset - ImGui::CalcTextSize((".." + _u8L("More")).c_str()).x) {
728 line = line.substr(0, line.length() - 1);
729 }
730 line += "..";
731 }
732 else {
733 // regural line
734 line = m_text1.substr(last_end, m_endlines[i] - last_end);
735 }
736 last_end = m_endlines[i];
737 if (m_text1.size() > m_endlines[i])
738 last_end += (m_text1[m_endlines[i]] == '\n' || m_text1[m_endlines[i]] == ' ' ? 1 : 0);
739
740 if (pos_start != std::string::npos && pos_end != std::string::npos&& m_endlines[i] - line.length() >= pos_start && m_endlines[i] <= pos_end) {
742 imgui.text(line.c_str());
743 ImGui::PopStyleColor();
744 }
745 else {
746 imgui.text(line.c_str());
747 }
748 }
749 }
750 //hyperlink text
751 if (!m_multiline && m_lines_count > 2) {
752 render_hypertext(imgui, x_offset + ImGui::CalcTextSize((line + " ").c_str()).x, starting_y + shift_y, _u8L("More"), true);
753 }
754 else if (!m_hypertext.empty()) {
755 render_hypertext(imgui, x_offset + ImGui::CalcTextSize((line + (line.empty() ? "" : " ")).c_str()).x, starting_y + (m_endlines.size() - 1) * shift_y, m_hypertext);
756 }
757
758 // text2 (text after hypertext) is not rendered for regular notifications
759 // its rendering is in HintNotification::render_text
760}

References _u8L, FadingOut, m_current_fade_opacity, m_endlines, m_ErrorColor, m_hypertext, m_left_indentation, m_line_height, m_lines_count, m_multiline, m_state, m_text1, m_window_width, m_window_width_offset, pos_end, pos_start, render_hypertext(), and Slic3r::GUI::ImGuiWrapper::text().

Referenced by render(), and Slic3r::GUI::NotificationManager::ExportFinishedNotification::render_text().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reset_timer()

void Slic3r::GUI::NotificationManager::PopNotification::reset_timer ( )
inline

References m_notification_start, m_state, Shown, and Slic3r::GUI::GLCanvas3D::timestamp_now().

Here is the call graph for this function:

◆ restore_default_theme()

void Slic3r::GUI::NotificationManager::PopNotification::restore_default_theme ( )
protected
280{
281 ImGuiStyle &OldStyle = ImGui::GetStyle();
282
283 OldStyle.WindowPadding = m_DefaultTheme.mWindowPadding;
284 OldStyle.WindowRounding = m_DefaultTheme.mWindowRound;
285
286 ImGui::PopStyleColor(3);
287 ImGui::PopStyleVar();
288 //OldStyle.Colors[ImGuiCol_WindowBg] = m_DefaultTheme.mWindowBkg;
289 // OldStyle.Colors[ImGuiCol_Text] = m_DefaultTheme.mTextColor;
290 // OldStyle.Colors[ImGuiCol_Border] = m_DefaultTheme.mBorderColor;
291}
ImGUITheme m_DefaultTheme
Definition NotificationManager.hpp:593

References m_DefaultTheme.

Referenced by bbl_render_block_notification(), render(), and Slic3r::GUI::NotificationManager::SlicingProgressNotification::render().

Here is the caller graph for this function:

◆ set_delete_callback()

void Slic3r::GUI::NotificationManager::PopNotification::set_delete_callback ( DeleteCallback callback)
225{
226 m_on_delete_callback =callback;
227}

References m_on_delete_callback.

◆ set_gray()

void Slic3r::GUI::NotificationManager::PopNotification::set_gray ( bool g)
inline
509{ m_is_gray = g; }

References m_is_gray.

◆ set_hovered()

void Slic3r::GUI::NotificationManager::PopNotification::set_hovered ( )
inline

References ClosePending, Finished, Hidden, Hovered, m_state, and Unknown.

Referenced by bbl_render_block_notification(), render(), and Slic3r::GUI::NotificationManager::SlicingProgressNotification::render().

Here is the caller graph for this function:

◆ set_Multiline()

void Slic3r::GUI::NotificationManager::PopNotification::set_Multiline ( bool Multi)
inline
520{ m_multiline = Multi; }

References m_multiline.

◆ set_next_window_size()

void Slic3r::GUI::NotificationManager::PopNotification::set_next_window_size ( ImGuiWrapper & imgui)
protectedvirtual

Reimplemented in Slic3r::GUI::NotificationManager::HintNotification.

641{
643 std::max(m_lines_count, (size_t)2) * m_line_height :
644 2 * m_line_height;
645 m_window_height += 1 * m_line_height; // top and bottom
646}

References m_line_height, m_lines_count, m_multiline, and m_window_height.

Referenced by bbl_render_block_notification(), render(), and render_hypertext().

Here is the caller graph for this function:

◆ set_scale()

void Slic3r::GUI::NotificationManager::PopNotification::set_scale ( float scale)
inline
522{ m_scale = scale; }
int scale(const int val)
Definition WipeTowerDialog.cpp:58
float m_scale
Definition NotificationManager.hpp:669

References m_scale, and scale().

Here is the call graph for this function:

◆ update()

void Slic3r::GUI::NotificationManager::PopNotification::update ( const NotificationData & n)
1054{
1055 m_text1 = n.text1;
1056 m_hypertext = n.hypertext;
1057 m_text2 = n.text2;
1058 const_cast<NotificationData&>(m_data).callback = n.callback;
1059 init();
1060}

References Slic3r::GUI::NotificationManager::NotificationData::callback, Slic3r::GUI::NotificationManager::NotificationData::hypertext, Slic3r::GUI::NotificationManager::init(), m_data, m_hypertext, m_text1, m_text2, Slic3r::GUI::NotificationManager::NotificationData::text1, and Slic3r::GUI::NotificationManager::NotificationData::text2.

Referenced by Slic3r::GUI::NotificationManager::UpdatedItemsInfoNotification::add_type(), Slic3r::GUI::NotificationManager::ExportFinishedNotification::on_eject_click(), Slic3r::GUI::NotificationManager::HintNotification::retrieve_data(), Slic3r::GUI::NotificationManager::ProgressIndicatorNotification::set_status_text(), and Slic3r::GUI::NotificationManager::SlicingProgressNotification::set_status_text().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_state()

bool Slic3r::GUI::NotificationManager::PopNotification::update_state ( bool paused,
const int64_t delta )
virtual

Reimplemented in Slic3r::GUI::NotificationManager::ProgressIndicatorNotification, and Slic3r::GUI::NotificationManager::SlicingProgressNotification.

1090{
1091
1092 m_next_render = std::numeric_limits<int64_t>::max();
1093
1094 if (m_state == EState::Unknown) {
1095 init();
1096 return true;
1097 }
1098
1099 if (m_state == EState::Hidden) {
1100 return false;
1101 }
1102
1103 int64_t now = GLCanvas3D::timestamp_now();
1104
1105 // reset fade opacity for non-closing notifications or hover during fading
1108 }
1109
1110 // reset timers - hovered state is set in render
1111 if (m_state == EState::Hovered) {
1112 init();
1113 // Timers when not fading
1115 int64_t up_time = now - m_notification_start;
1116 if (up_time >= get_duration() * 1000) {
1118 m_fading_start = now;
1119 } else {
1120 m_next_render = get_duration() * 1000 - up_time;
1121 }
1122 }
1123 // Timers when fading
1124 if (m_state == EState::FadingOut && !paused) {
1125 int64_t curr_time = now - m_fading_start;
1126 int64_t next_render = FADING_OUT_TIMEOUT - delta;
1127 m_current_fade_opacity = std::clamp(1.0f - 0.001f * static_cast<float>(curr_time) / FADING_OUT_DURATION, 0.0f, 1.0f);
1128 if (m_current_fade_opacity <= 0.0f) {
1130 return true;
1131 } else if (next_render <= 20) {
1133 return true;
1134 } else {
1136 return false;
1137 }
1138 }
1139
1140 if (m_state == EState::Finished) {
1141 return true;
1142 }
1143
1146 return true;
1147 }
1148 return false;
1149}
static constexpr int FADING_OUT_TIMEOUT
Definition NotificationManager.cpp:65
static constexpr float FADING_OUT_DURATION
Definition NotificationManager.cpp:63
int64_t m_fading_start
Definition NotificationManager.hpp:617
@ NotFading
Definition NotificationManager.hpp:480
int64_t next_render() const
Definition NotificationManager.hpp:514
virtual int get_duration()
Definition NotificationManager.hpp:571

References ClosePending, FADING_OUT_DURATION, FADING_OUT_TIMEOUT, FadingOut, Finished, get_duration(), Hidden, Hovered, Slic3r::GUI::NotificationManager::init(), m_current_fade_opacity, m_fading_start, m_next_render, m_notification_start, m_state, next_render(), NotFading, Slic3r::GUI::GLCanvas3D::timestamp_now(), and Unknown.

Referenced by Slic3r::GUI::NotificationManager::ProgressIndicatorNotification::update_state(), and Slic3r::GUI::NotificationManager::SlicingProgressNotification::update_state().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ use_bbl_theme()

void Slic3r::GUI::NotificationManager::PopNotification::use_bbl_theme ( )
protected
237{
239
240 ImGuiStyle &OldStyle = ImGui::GetStyle();
241
242 m_DefaultTheme.mWindowPadding = OldStyle.WindowPadding;
243 m_DefaultTheme.mWindowBkg = OldStyle.Colors[ImGuiCol_WindowBg];
244 m_DefaultTheme.mBorderColor = OldStyle.Colors[ImGuiCol_Border];
245 m_DefaultTheme.mTextColor = OldStyle.Colors[ImGuiCol_Text];
246 m_DefaultTheme.mWindowRound = OldStyle.WindowRounding;
247
248 OldStyle.WindowPadding = ImVec2(0, 0);
249 OldStyle.WindowRounding = m_WindowRadius;
250
255 else {
256 if (m_data.use_warn_color)
258 else
260 }
261
262 //OldStyle.Colors[ImGuiCol_Border] = m_CurrentColor;
263
264 // OldStyle.Colors[ImGuiCol_WindowBg] = m_WindowBkgColor;
265 // OldStyle.Colors[ImGuiCol_Text] = m_TextColor;
266
267 m_WindowBkgColor = m_is_dark ? ImVec4(45 / 255.f, 45 / 255.f, 49 / 255.f, 1.f) : ImVec4(1, 1, 1, 1);
268 m_TextColor = m_is_dark ? ImVec4(224 / 255.f, 224 / 255.f, 224 / 255.f, 1.f) : ImVec4(.2f, .2f, .2f, 1.0f);
269 m_HyperTextColor = m_is_dark ? ImVec4(0, 0.588, 0.533, 1) : ImVec4(0, 0.588, 0.533, 1);
270 m_HyperTextColorHover = m_is_dark ? ImVec4(38.f / 255.f, 166.f / 255.f, 154.f / 255.f, 1) : ImVec4(0.f, 129.f / 255.f, 114.f / 255.f, 1); //#26A69A / #008172;
271
272 m_is_dark ? push_style_color(ImGuiCol_Border, {62 / 255.f, 62 / 255.f, 69 / 255.f, 1.f}, true, m_current_fade_opacity) : push_style_color(ImGuiCol_Border, m_CurrentColor, true, m_current_fade_opacity);
275 ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, m_WindowRadius / 4);
276}

References ensure_ui_inited(), Slic3r::GUI::NotificationManager::ErrorNotificationLevel, m_current_fade_opacity, m_CurrentColor, m_data, m_DefaultTheme, m_ErrorColor, m_HyperTextColor, m_HyperTextColorHover, m_is_dark, m_NormalColor, m_TextColor, m_WarnColor, m_WindowBkgColor, m_WindowRadius, and Slic3r::GUI::NotificationManager::WarningNotificationLevel.

Referenced by bbl_render_block_notification(), render(), and Slic3r::GUI::NotificationManager::SlicingProgressNotification::render().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ error_end

std::string Slic3r::GUI::NotificationManager::PopNotification::error_end = "</Error>"
protected

Referenced by count_lines().

◆ error_start

std::string Slic3r::GUI::NotificationManager::PopNotification::error_start = "<Error>"
protected

Referenced by count_lines().

◆ m_bottom_y

float Slic3r::GUI::NotificationManager::PopNotification::m_bottom_y { 0.0f }
protected
652{ 0.0f };

Referenced by get_bottom().

◆ m_current_fade_opacity

float Slic3r::GUI::NotificationManager::PopNotification::m_current_fade_opacity { 1.0f }
protected
623{ 1.0f };

Referenced by bbl_render_block_notif_buttons(), bbl_render_block_notif_text(), bbl_render_block_notification(), bbl_render_left_sign(), push_background_color(), Slic3r::GUI::NotificationManager::PrintHostUploadNotification::push_background_color(), render(), Slic3r::GUI::NotificationManager::SlicingProgressNotification::render(), Slic3r::GUI::NotificationManager::ProgressBarNotification::render_bar(), Slic3r::GUI::NotificationManager::SlicingProgressNotification::render_bar(), Slic3r::GUI::NotificationManager::PrintHostUploadNotification::render_cancel_button(), Slic3r::GUI::NotificationManager::ProgressIndicatorNotification::render_cancel_button(), Slic3r::GUI::NotificationManager::SlicingProgressNotification::render_cancel_button(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_cancel_button_inner(), Slic3r::GUI::NotificationManager::HintNotification::render_close_button(), render_close_button(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_close_button_inner(), Slic3r::GUI::NotificationManager::HintNotification::render_documentation_button(), Slic3r::GUI::NotificationManager::ExportFinishedNotification::render_eject_button(), render_hyperlink_action(), render_hypertext(), render_minimize_button(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_open_button_inner(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_pause_button_inner(), Slic3r::GUI::NotificationManager::HintNotification::render_preferences_button(), Slic3r::GUI::NotificationManager::SlicingProgressNotification::render_progress_close_button(), Slic3r::GUI::NotificationManager::SlicingProgressNotification::render_progress_text(), Slic3r::GUI::NotificationManager::HintNotification::render_right_arrow_button(), render_text(), Slic3r::GUI::NotificationManager::SharedProfilesNotification::render_text(), Slic3r::GUI::NotificationManager::SlicingProgressNotification::set_progress_state(), update_state(), Slic3r::GUI::NotificationManager::ProgressIndicatorNotification::update_state(), and use_bbl_theme().

◆ m_CurrentColor

ImVec4 Slic3r::GUI::NotificationManager::PopNotification::m_CurrentColor
protected

◆ m_data

◆ m_DefaultTheme

ImGUITheme Slic3r::GUI::NotificationManager::PopNotification::m_DefaultTheme
protected

◆ m_endlines

◆ m_endlines2

std::vector<size_t> Slic3r::GUI::NotificationManager::PopNotification::m_endlines2
protected

◆ m_ErrorColor

ImVec4 Slic3r::GUI::NotificationManager::PopNotification::m_ErrorColor
protected

◆ m_evt_handler

◆ m_fading_start

int64_t Slic3r::GUI::NotificationManager::PopNotification::m_fading_start { 0LL }
protected
617{ 0LL };

Referenced by update_state().

◆ m_hypertext

◆ m_HyperTextColor

◆ m_HyperTextColorHover

◆ m_id

int Slic3r::GUI::NotificationManager::PopNotification::m_id { 0 }
protected

◆ m_id_provider

◆ m_is_dark

◆ m_is_dark_inited

bool Slic3r::GUI::NotificationManager::PopNotification::m_is_dark_inited = false
protected

◆ m_is_gray

bool Slic3r::GUI::NotificationManager::PopNotification::m_is_gray { false }
protected
660{ false };

Referenced by is_gray(), push_background_color(), and set_gray().

◆ m_left_indentation

◆ m_line_height

float Slic3r::GUI::NotificationManager::PopNotification::m_line_height
protected

Referenced by bbl_render_block_notif_buttons(), bbl_render_block_notif_left_sign(), bbl_render_block_notif_text(), bbl_render_block_notification(), Slic3r::GUI::NotificationManager::ExportFinishedNotification::count_spaces(), Slic3r::GUI::NotificationManager::HintNotification::count_spaces(), count_spaces(), Slic3r::GUI::NotificationManager::PrintHostUploadNotification::count_spaces(), Slic3r::GUI::NotificationManager::UpdatedItemsInfoNotification::count_spaces(), Slic3r::GUI::NotificationManager::URLDownloadNotification::count_spaces(), render(), Slic3r::GUI::NotificationManager::SlicingProgressNotification::render(), Slic3r::GUI::NotificationManager::PrintHostUploadNotification::render_bar(), Slic3r::GUI::NotificationManager::ProgressBarNotification::render_bar(), Slic3r::GUI::NotificationManager::SlicingProgressNotification::render_bar(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_bar(), Slic3r::GUI::NotificationManager::PrintHostUploadNotification::render_cancel_button(), Slic3r::GUI::NotificationManager::ProgressIndicatorNotification::render_cancel_button(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_cancel_button_inner(), Slic3r::GUI::NotificationManager::HintNotification::render_close_button(), render_close_button(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_close_button_inner(), Slic3r::GUI::NotificationManager::HintNotification::render_documentation_button(), Slic3r::GUI::NotificationManager::ExportFinishedNotification::render_eject_button(), render_minimize_button(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_open_button_inner(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_pause_button_inner(), Slic3r::GUI::NotificationManager::HintNotification::render_preferences_button(), Slic3r::GUI::NotificationManager::SlicingProgressNotification::render_progress_text(), Slic3r::GUI::NotificationManager::HintNotification::render_right_arrow_button(), Slic3r::GUI::NotificationManager::ExportFinishedNotification::render_text(), Slic3r::GUI::NotificationManager::HintNotification::render_text(), Slic3r::GUI::NotificationManager::OrcaSyncConflictNotification::render_text(), Slic3r::GUI::NotificationManager::PluginMissingNotification::render_text(), render_text(), Slic3r::GUI::NotificationManager::ProgressBarNotification::render_text(), Slic3r::GUI::NotificationManager::SharedProfilesNotification::render_text(), Slic3r::GUI::NotificationManager::HintNotification::set_next_window_size(), and set_next_window_size().

◆ m_lines_count

◆ m_minimize_b_visible

◆ m_multiline

◆ m_next_render

int64_t Slic3r::GUI::NotificationManager::PopNotification::m_next_render { std::numeric_limits<int64_t>::max() }
protected

◆ m_NormalColor

ImVec4 Slic3r::GUI::NotificationManager::PopNotification::m_NormalColor
protected

◆ m_notification_start

◆ m_on_delete_callback

DeleteCallback Slic3r::GUI::NotificationManager::PopNotification::m_on_delete_callback
protected

◆ m_scale

float Slic3r::GUI::NotificationManager::PopNotification::m_scale = 1.0f
protected

Referenced by set_scale().

◆ m_state

EState Slic3r::GUI::NotificationManager::PopNotification::m_state { EState::Unknown }
protected

Referenced by Slic3r::GUI::NotificationManager::UpdatedItemsInfoNotification::add_type(), bbl_render_block_notif_buttons(), bbl_render_block_notif_text(), bbl_render_block_notification(), Slic3r::GUI::NotificationManager::PlaterWarningNotification::close(), close(), get_state(), hide(), Slic3r::GUI::NotificationManager::HintNotification::init(), init(), Slic3r::GUI::NotificationManager::PrintHostUploadNotification::init(), Slic3r::GUI::NotificationManager::ProgressBarNotification::init(), Slic3r::GUI::NotificationManager::ProgressIndicatorNotification::init(), Slic3r::GUI::NotificationManager::SlicingProgressNotification::init(), is_finished(), is_hovered(), push_background_color(), Slic3r::GUI::NotificationManager::PrintHostUploadNotification::push_background_color(), Slic3r::GUI::NotificationManager::PlaterWarningNotification::real_close(), reinit(), render(), Slic3r::GUI::NotificationManager::SlicingProgressNotification::render(), Slic3r::GUI::NotificationManager::PrintHostUploadNotification::render_cancel_button(), Slic3r::GUI::NotificationManager::ProgressIndicatorNotification::render_cancel_button(), Slic3r::GUI::NotificationManager::SlicingProgressNotification::render_cancel_button(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_cancel_button_inner(), Slic3r::GUI::NotificationManager::HintNotification::render_close_button(), render_close_button(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_close_button_inner(), Slic3r::GUI::NotificationManager::HintNotification::render_documentation_button(), Slic3r::GUI::NotificationManager::ExportFinishedNotification::render_eject_button(), render_hyperlink_action(), render_hypertext(), render_minimize_button(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_open_button_inner(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_pause_button_inner(), Slic3r::GUI::NotificationManager::HintNotification::render_preferences_button(), Slic3r::GUI::NotificationManager::SlicingProgressNotification::render_progress_close_button(), Slic3r::GUI::NotificationManager::SlicingProgressNotification::render_progress_text(), Slic3r::GUI::NotificationManager::HintNotification::render_right_arrow_button(), render_text(), Slic3r::GUI::NotificationManager::SharedProfilesNotification::render_text(), reset_timer(), set_hovered(), Slic3r::GUI::NotificationManager::ProgressIndicatorNotification::set_percentage(), Slic3r::GUI::NotificationManager::URLDownloadNotification::set_percentage(), Slic3r::GUI::NotificationManager::SlicingProgressNotification::set_progress_state(), Slic3r::GUI::NotificationManager::SlicingProgressNotification::set_sidebar_collapsed(), Slic3r::GUI::NotificationManager::SlicingProgressNotification::set_status_text(), Slic3r::GUI::NotificationManager::PlaterWarningNotification::show(), and update_state().

◆ m_text1

◆ m_text2

std::string Slic3r::GUI::NotificationManager::PopNotification::m_text2
protected

◆ m_TextColor

ImVec4 Slic3r::GUI::NotificationManager::PopNotification::m_TextColor
protected

Referenced by PopNotification(), and use_bbl_theme().

◆ m_top_y

float Slic3r::GUI::NotificationManager::PopNotification::m_top_y { 0.0f }
protected

◆ m_WarnColor

ImVec4 Slic3r::GUI::NotificationManager::PopNotification::m_WarnColor
protected

◆ m_window_height

◆ m_window_width

◆ m_window_width_offset

◆ m_WindowBkgColor

ImVec4 Slic3r::GUI::NotificationManager::PopNotification::m_WindowBkgColor
protected

Referenced by PopNotification(), and use_bbl_theme().

◆ m_WindowRadius

float Slic3r::GUI::NotificationManager::PopNotification::m_WindowRadius
protected

◆ m_WindowRadius_inited

bool Slic3r::GUI::NotificationManager::PopNotification::m_WindowRadius_inited = false
protected

Referenced by ensure_ui_inited().

◆ pos_end

size_t Slic3r::GUI::NotificationManager::PopNotification::pos_end = std::string::npos
protected

◆ pos_start

size_t Slic3r::GUI::NotificationManager::PopNotification::pos_start = std::string::npos
protected

The documentation for this class was generated from the following files: