PrintInfoNotificationLevel with icon

This commit is contained in:
David Kocik 2021-10-01 15:02:31 +02:00
parent 68de2a49a3
commit 29aab3a426
11 changed files with 103 additions and 18 deletions

View File

@ -0,0 +1,72 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.0"
id="Layer_1"
x="0px"
y="0px"
viewBox="0 0 16 16"
enable-background="new 0 0 16 16"
xml:space="preserve"
sodipodi:docname="notification_info.svg"
inkscape:version="1.0 (4035a4fb49, 2020-05-01)"><metadata
id="metadata34"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
id="defs32" /><sodipodi:namedview
inkscape:document-rotation="0"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="2560"
inkscape:window-height="1377"
id="namedview30"
showgrid="false"
inkscape:zoom="63"
inkscape:cx="9.1772719"
inkscape:cy="7.5427608"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="Layer_1" />
<path
style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke-width:0.015873"
d="m 5.0758562,12.956344 -2.995572,-1.996026 -3e-6,-2.9920641 -3e-6,-2.9920635 2.999543,-1.9986482 2.9995439,-1.99864812 2.9995429,1.99864812 2.999544,1.9986482 v 2.9920635 2.9920641 l -2.995619,1.996031 c -1.64759,1.097818 -2.9991701,1.99603 -3.0035114,1.996027 -0.00434,-3e-6 -1.3559005,-0.898217 -3.0034654,-1.996032 z M 10.586352,12.087933 13.079365,10.429835 13.07891,7.9569809 13.078456,5.4841269 10.579608,3.8192828 8.0807599,2.1544387 5.5803665,3.8192828 3.0799732,5.4841269 l -3.04e-4,2.4726796 -3.04e-4,2.4726795 2.4880951,1.65688 c 1.3684524,0.911284 2.4965964,1.657507 2.5069867,1.658273 0.01039,7.66e-4 1.1407475,-0.744751 2.511905,-1.656706 z"
id="path875" /><text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:40px;line-height:1.25;font-family:sans-serif;fill:#ffffff;fill-opacity:1;stroke:none;"
x="6.9523811"
y="10.841269"
id="text881"><tspan
sodipodi:role="line"
id="tspan879"
x="6.9523811"
y="10.841269"
style="font-size:8px;fill:#ffffff;fill-opacity:1;">i</tspan></text><path
style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke-width:0.015873"
d="M 7.6852084,8.6538719 V 6.4792687 H 8.0502877 8.4153671 V 8.6538719 10.828475 H 8.0502877 7.6852084 Z"
id="path883" /><path
style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke-width:0.015873"
d="M 7.6375893,5.3602211 V 4.9872052 H 8.0502877 8.4629862 V 5.3602211 5.733237 H 8.0502877 7.6375893 Z"
id="path885" /><path
style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke-width:0.015873"
d="M 5.0770415,12.945679 2.0820338,10.951771 V 7.9695094 4.9872476 L 5.0793998,2.9889613 8.0767658,0.99067485 11.071463,2.9833368 14.066161,4.9759987 V 7.96609 10.956181 l -2.989292,1.991703 c -1.644111,1.095436 -2.992786,1.991702 -2.997056,1.991702 -0.00427,0 -1.3555173,-0.897258 -3.0027715,-1.993907 z m 3.8501097,0.252104 C 9.3772519,12.90093 10.496135,12.158896 11.413559,11.548818 l 1.668043,-1.109232 3.9e-5,-2.4841268 3.8e-5,-2.484127 L 10.579605,3.8075241 8.0775303,2.1437159 5.5718455,3.8141032 3.0661607,5.4844905 v 2.4743839 2.4743846 l 2.1785715,1.447852 c 2.9131306,1.936032 2.8100528,1.86842 2.8387731,1.862029 0.013905,-0.0031 0.3935453,-0.248505 0.8436459,-0.545357 z"
id="path889" /><path
style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke-width:0.015873"
d="M 7.6852084,8.6538719 V 6.4792687 H 8.0502877 8.4153671 V 8.6538719 10.828475 H 8.0502877 7.6852084 Z"
id="path891" /><path
style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke-width:0.015873"
d="M 7.6375893,5.3602211 V 4.9872052 H 8.0502877 8.4629861 V 5.3602211 5.733237 H 8.0502877 7.6375893 Z"
id="path893" /></svg>

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

@ -149,10 +149,11 @@ namespace ImGui
const wchar_t CustomSupportsMarker = 0x1D; const wchar_t CustomSupportsMarker = 0x1D;
const wchar_t CustomSeamMarker = 0x1E; const wchar_t CustomSeamMarker = 0x1E;
const wchar_t MmuSegmentationMarker = 0x1F; const wchar_t MmuSegmentationMarker = 0x1F;
// Do not forget use following letters only in wstring
const wchar_t DocumentationButton = 0x2600; const wchar_t DocumentationButton = 0x2600;
const wchar_t DocumentationHoverButton = 0x2601; const wchar_t DocumentationHoverButton = 0x2601;
const wchar_t ClippyMarker = 0x2602; const wchar_t ClippyMarker = 0x2602;
const wchar_t InfoMarker = 0x2603;
// void MyFunction(const char* name, const MyMatrix44& v); // void MyFunction(const char* name, const MyMatrix44& v);
} }

View File

@ -727,7 +727,7 @@ void Preview::update_layers_slider(const std::vector<double>& layers_z, bool kee
if( bottom_area - top_area > delta_area) { if( bottom_area - top_area > delta_area) {
NotificationManager *notif_mngr = wxGetApp().plater()->get_notification_manager(); NotificationManager *notif_mngr = wxGetApp().plater()->get_notification_manager();
notif_mngr->push_notification( notif_mngr->push_notification(
NotificationType::SignDetected, NotificationManager::NotificationLevel::RegularNotificationLevel, NotificationType::SignDetected, NotificationManager::NotificationLevel::PrintInfoNotificationLevel,
_u8L("NOTE:") + "\n" + _u8L("Sliced object looks like the sign") + "\n", _u8L("NOTE:") + "\n" + _u8L("Sliced object looks like the sign") + "\n",
_u8L("Apply auto color change to print"), _u8L("Apply auto color change to print"),
[this](wxEvtHandler*) { [this](wxEvtHandler*) {

View File

@ -23,7 +23,7 @@ static inline void show_notification_extruders_limit_exceeded()
wxGetApp() wxGetApp()
.plater() .plater()
->get_notification_manager() ->get_notification_manager()
->push_notification(NotificationType::MmSegmentationExceededExtrudersLimit, NotificationManager::NotificationLevel::RegularNotificationLevel, ->push_notification(NotificationType::MmSegmentationExceededExtrudersLimit, NotificationManager::NotificationLevel::PrintInfoNotificationLevel,
GUI::format(_L("Your printer has more extruders than the multi-material painting gizmo supports. For this reason, only the " GUI::format(_L("Your printer has more extruders than the multi-material painting gizmo supports. For this reason, only the "
"first %1% extruders will be able to be used for painting."), GLGizmoMmuSegmentation::EXTRUDERS_LIMIT)); "first %1% extruders will be able to be used for painting."), GLGizmoMmuSegmentation::EXTRUDERS_LIMIT));
} }

View File

@ -363,7 +363,7 @@ void GLGizmoSimplify::on_set_state()
auto notification_manager = wxGetApp().plater()->get_notification_manager(); auto notification_manager = wxGetApp().plater()->get_notification_manager();
notification_manager->push_notification( notification_manager->push_notification(
NotificationType::CustomNotification, NotificationType::CustomNotification,
NotificationManager::NotificationLevel::RegularNotificationLevel, NotificationManager::NotificationLevel::PrintInfoNotificationLevel,
_u8L("ERROR: Wait until Simplification ends or Cancel process.")); _u8L("ERROR: Wait until Simplification ends or Cancel process."));
return; return;
} }

View File

@ -192,7 +192,7 @@ bool GLGizmosManager::check_gizmos_closed_except(EType type) const
if (get_current_type() != type && get_current_type() != Undefined) { if (get_current_type() != type && get_current_type() != Undefined) {
wxGetApp().plater()->get_notification_manager()->push_notification( wxGetApp().plater()->get_notification_manager()->push_notification(
NotificationType::CustomSupportsAndSeamRemovedAfterRepair, NotificationType::CustomSupportsAndSeamRemovedAfterRepair,
NotificationManager::NotificationLevel::RegularNotificationLevel, NotificationManager::NotificationLevel::PrintInfoNotificationLevel,
_u8L("ERROR: Please close all manipulators available from " _u8L("ERROR: Please close all manipulators available from "
"the left toolbar first")); "the left toolbar first"));
return false; return false;

View File

@ -1012,7 +1012,7 @@ void NotificationManager::HintNotification::retrieve_data(bool new_hint/* = true
if(hint_data != nullptr) if(hint_data != nullptr)
{ {
NotificationData nd { NotificationType::DidYouKnowHint, NotificationData nd { NotificationType::DidYouKnowHint,
NotificationLevel::RegularNotificationLevel, NotificationLevel::HintNotificationLevel,
0, 0,
hint_data->text, hint_data->text,
hint_data->hypertext, nullptr, hint_data->hypertext, nullptr,

View File

@ -48,6 +48,7 @@ static const std::map<const wchar_t, std::string> font_icons = {
{ImGui::RightArrowHoverButton , "notification_right_hover" }, {ImGui::RightArrowHoverButton , "notification_right_hover" },
{ImGui::PreferencesButton , "notification_preferences" }, {ImGui::PreferencesButton , "notification_preferences" },
{ImGui::PreferencesHoverButton , "notification_preferences_hover"}, {ImGui::PreferencesHoverButton , "notification_preferences_hover"},
}; };
static const std::map<const wchar_t, std::string> font_icons_large = { static const std::map<const wchar_t, std::string> font_icons_large = {
{ImGui::CloseNotifButton , "notification_close" }, {ImGui::CloseNotifButton , "notification_close" },
@ -65,6 +66,8 @@ static const std::map<const wchar_t, std::string> font_icons_large = {
{ImGui::VarLayerHeightMarker , "layers" }, {ImGui::VarLayerHeightMarker , "layers" },
{ImGui::DocumentationButton , "notification_documentation" }, {ImGui::DocumentationButton , "notification_documentation" },
{ImGui::DocumentationHoverButton, "notification_documentation_hover"}, {ImGui::DocumentationHoverButton, "notification_documentation_hover"},
{ImGui::InfoMarker , "notification_info" },
}; };
static const std::map<const wchar_t, std::string> font_icons_extra_large = { static const std::map<const wchar_t, std::string> font_icons_extra_large = {

View File

@ -43,10 +43,10 @@ const NotificationManager::NotificationData NotificationManager::basic_notificat
}, },
{NotificationType::NewAppAvailable, NotificationLevel::ImportantNotificationLevel, 20, _u8L("New version is available."), _u8L("See Releases page."), [](wxEvtHandler* evnthndlr) { {NotificationType::NewAppAvailable, NotificationLevel::ImportantNotificationLevel, 20, _u8L("New version is available."), _u8L("See Releases page."), [](wxEvtHandler* evnthndlr) {
wxGetApp().open_browser_with_warning_dialog("https://github.com/prusa3d/PrusaSlicer/releases"); return true; }}, wxGetApp().open_browser_with_warning_dialog("https://github.com/prusa3d/PrusaSlicer/releases"); return true; }},
{NotificationType::EmptyColorChangeCode, NotificationLevel::ObjectInfoNotificationLevel, 10, {NotificationType::EmptyColorChangeCode, NotificationLevel::PrintInfoNotificationLevel, 10,
_u8L("You have just added a G-code for color change, but its value is empty.\n" _u8L("You have just added a G-code for color change, but its value is empty.\n"
"To export the G-code correctly, check the \"Color Change G-code\" in \"Printer Settings > Custom G-code\"") }, "To export the G-code correctly, check the \"Color Change G-code\" in \"Printer Settings > Custom G-code\"") },
{NotificationType::EmptyAutoColorChange, NotificationLevel::ObjectInfoNotificationLevel, 10, {NotificationType::EmptyAutoColorChange, NotificationLevel::PrintInfoNotificationLevel, 10,
_u8L("No color change event was added to the print. The print does not look like a sign.") }, _u8L("No color change event was added to the print. The print does not look like a sign.") },
{NotificationType::DesktopIntegrationSuccess, NotificationLevel::RegularNotificationLevel, 10, {NotificationType::DesktopIntegrationSuccess, NotificationLevel::RegularNotificationLevel, 10,
_u8L("Desktop integration was successful.") }, _u8L("Desktop integration was successful.") },
@ -276,7 +276,9 @@ void NotificationManager::PopNotification::count_spaces()
m_line_height = ImGui::CalcTextSize("A").y; m_line_height = ImGui::CalcTextSize("A").y;
m_left_indentation = m_line_height; m_left_indentation = m_line_height;
if (m_data.level == NotificationLevel::ErrorNotificationLevel || m_data.level == NotificationLevel::WarningNotificationLevel) { if (m_data.level == NotificationLevel::ErrorNotificationLevel
|| m_data.level == NotificationLevel::WarningNotificationLevel
|| m_data.level == NotificationLevel::PrintInfoNotificationLevel) {
std::string text; std::string text;
text = (m_data.level == NotificationLevel::ErrorNotificationLevel ? ImGui::ErrorMarker : ImGui::WarningMarker); text = (m_data.level == NotificationLevel::ErrorNotificationLevel ? ImGui::ErrorMarker : ImGui::WarningMarker);
float picture_width = ImGui::CalcTextSize(text.c_str()).x; float picture_width = ImGui::CalcTextSize(text.c_str()).x;
@ -511,6 +513,12 @@ void NotificationManager::PopNotification::render_left_sign(ImGuiWrapper& imgui)
ImGui::SetCursorPosX(m_line_height / 3); ImGui::SetCursorPosX(m_line_height / 3);
ImGui::SetCursorPosY(m_window_height / 2 - m_line_height); ImGui::SetCursorPosY(m_window_height / 2 - m_line_height);
imgui.text(text.c_str()); imgui.text(text.c_str());
} else if (m_data.level == NotificationLevel::PrintInfoNotificationLevel) {
std::wstring text;
text = ImGui::InfoMarker;
ImGui::SetCursorPosX(m_line_height / 3);
ImGui::SetCursorPosY(m_window_height / 2 - m_line_height);
imgui.text(text.c_str());
} }
} }
void NotificationManager::PopNotification::render_minimize_button(ImGuiWrapper& imgui, const float win_pos_x, const float win_pos_y) void NotificationManager::PopNotification::render_minimize_button(ImGuiWrapper& imgui, const float win_pos_x, const float win_pos_y)
@ -1604,7 +1612,7 @@ void NotificationManager::close_slicing_error_notification(const std::string& te
} }
void NotificationManager::push_simplify_suggestion_notification(const std::string& text, ObjectID object_id, const std::string& hypertext/* = ""*/, std::function<bool(wxEvtHandler*)> callback/* = std::function<bool(wxEvtHandler*)>()*/) void NotificationManager::push_simplify_suggestion_notification(const std::string& text, ObjectID object_id, const std::string& hypertext/* = ""*/, std::function<bool(wxEvtHandler*)> callback/* = std::function<bool(wxEvtHandler*)>()*/)
{ {
NotificationData data{ NotificationType::SimplifySuggestion, NotificationLevel::ObjectInfoNotificationLevel, 10, text, hypertext, callback }; NotificationData data{ NotificationType::SimplifySuggestion, NotificationLevel::PrintInfoNotificationLevel, 10, text, hypertext, callback };
auto notification = std::make_unique<NotificationManager::ObjectIDNotification>(data, m_id_provider, m_evt_handler); auto notification = std::make_unique<NotificationManager::ObjectIDNotification>(data, m_id_provider, m_evt_handler);
notification->object_id = object_id; notification->object_id = object_id;
push_notification_data(std::move(notification), 0); push_notification_data(std::move(notification), 0);
@ -1914,7 +1922,7 @@ void NotificationManager::push_updated_item_info_notification(InfoItemType type)
} }
} }
NotificationData data{ NotificationType::UpdatedItemsInfo, NotificationLevel::ObjectInfoNotificationLevel, 10, "" }; NotificationData data{ NotificationType::UpdatedItemsInfo, NotificationLevel::PrintInfoNotificationLevel, 10, "" };
auto notification = std::make_unique<NotificationManager::UpdatedItemsInfoNotification>(data, m_id_provider, m_evt_handler, type); auto notification = std::make_unique<NotificationManager::UpdatedItemsInfoNotification>(data, m_id_provider, m_evt_handler, type);
if (push_notification_data(std::move(notification), 0)) { if (push_notification_data(std::move(notification), 0)) {
(dynamic_cast<UpdatedItemsInfoNotification*>(m_pop_notifications.back().get()))->add_type(type); (dynamic_cast<UpdatedItemsInfoNotification*>(m_pop_notifications.back().get()))->add_type(type);

View File

@ -122,7 +122,7 @@ public:
// "Good to know" notification, usually but not always with a quick fade-out. // "Good to know" notification, usually but not always with a quick fade-out.
RegularNotificationLevel, RegularNotificationLevel,
// Regular level notifiaction containing info about objects or print. Has Icon. // Regular level notifiaction containing info about objects or print. Has Icon.
ObjectInfoNotificationLevel, PrintInfoNotificationLevel,
// Information notification without a fade-out or with a longer fade-out. // Information notification without a fade-out or with a longer fade-out.
ImportantNotificationLevel, ImportantNotificationLevel,
// Warning, no fade-out. // Warning, no fade-out.
@ -704,13 +704,14 @@ private:
size_t get_standart_duration(NotificationLevel level) size_t get_standart_duration(NotificationLevel level)
{ {
switch (level) { switch (level) {
case NotificationLevel::RegularNotificationLevel: return 20;
case NotificationLevel::ErrorNotificationLevel: return 0; case NotificationLevel::ErrorNotificationLevel: return 0;
case NotificationLevel::WarningNotificationLevel: return 0; case NotificationLevel::WarningNotificationLevel: return 0;
case NotificationLevel::ImportantNotificationLevel: return 0; case NotificationLevel::ImportantNotificationLevel: return 0;
case NotificationLevel::ProgressBarNotificationLevel: return 2; case NotificationLevel::ProgressBarNotificationLevel: return 2;
case NotificationLevel::RegularNotificationLevel: return 10;
case NotificationLevel::PrintInfoNotificationLevel: return 10;
case NotificationLevel::HintNotificationLevel: return 300; case NotificationLevel::HintNotificationLevel: return 300;
case NotificationLevel::ObjectInfoNotificationLevel: return 20;
default: return 10; default: return 10;
} }
} }

View File

@ -2346,7 +2346,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
for (std::string& name : names) for (std::string& name : names)
notif_text += "\n - " + name; notif_text += "\n - " + name;
notification_manager->push_notification(NotificationType::CustomNotification, notification_manager->push_notification(NotificationType::CustomNotification,
NotificationManager::NotificationLevel::RegularNotificationLevel, notif_text); NotificationManager::NotificationLevel::PrintInfoNotificationLevel, notif_text);
} }
} }
@ -2910,7 +2910,7 @@ void Plater::priv::split_object()
// If we splited object which is contain some parts/modifiers then all non-solid parts (modifiers) were deleted // If we splited object which is contain some parts/modifiers then all non-solid parts (modifiers) were deleted
if (current_model_object->volumes.size() > 1 && current_model_object->volumes.size() != new_objects.size()) if (current_model_object->volumes.size() > 1 && current_model_object->volumes.size() != new_objects.size())
notification_manager->push_notification(NotificationType::CustomNotification, notification_manager->push_notification(NotificationType::CustomNotification,
NotificationManager::NotificationLevel::RegularNotificationLevel, NotificationManager::NotificationLevel::PrintInfoNotificationLevel,
_u8L("All non-solid parts (modifiers) were deleted")); _u8L("All non-solid parts (modifiers) were deleted"));
Plater::TakeSnapshot snapshot(q, _L("Split to Objects")); Plater::TakeSnapshot snapshot(q, _L("Split to Objects"));
@ -6425,7 +6425,7 @@ void Plater::clear_before_change_mesh(int obj_idx)
// snapshot_time is captured by copy so the lambda knows where to undo/redo to. // snapshot_time is captured by copy so the lambda knows where to undo/redo to.
get_notification_manager()->push_notification( get_notification_manager()->push_notification(
NotificationType::CustomSupportsAndSeamRemovedAfterRepair, NotificationType::CustomSupportsAndSeamRemovedAfterRepair,
NotificationManager::NotificationLevel::RegularNotificationLevel, NotificationManager::NotificationLevel::PrintInfoNotificationLevel,
_u8L("Custom supports, seams and multimaterial painting were " _u8L("Custom supports, seams and multimaterial painting were "
"removed after repairing the mesh.")); "removed after repairing the mesh."));
// _u8L("Undo the repair"), // _u8L("Undo the repair"),