diff --git a/resources/icons/notification_left.svg b/resources/icons/notification_left.svg deleted file mode 100644 index 688f9a32b..000000000 --- a/resources/icons/notification_left.svg +++ /dev/null @@ -1,68 +0,0 @@ -<?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.1" - id="Layer_1" - x="0px" - y="0px" - viewBox="0 0 800 800" - style="enable-background:new 0 0 800 800;" - xml:space="preserve" - sodipodi:docname="notification_left.svg" - inkscape:version="1.0 (4035a4fb49, 2020-05-01)"><metadata - id="metadata15"><rdf:RDF><cc:Work - rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs - id="defs13" /><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="3840" - inkscape:window-height="2066" - id="namedview11" - showgrid="false" - inkscape:zoom="1.26" - inkscape:cx="400" - inkscape:cy="396.42857" - inkscape:window-x="-11" - inkscape:window-y="-11" - inkscape:window-maximized="1" - inkscape:current-layer="Layer_1" /> -<style - type="text/css" - id="style2"> - .st0{fill:#ED6B21;} -</style> - -<path - style="stroke-width:0.85" - class="st0" - d="m 296.747,391.51434 155.295,-116.96 v 233.75 l -155.295,-116.79 m -66.64,0 c 0,6.12 2.72,12.155 8.16,16.235 l 229.5,172.635 c 13.43,10.115 32.555,0.51 32.555,-16.235 v -345.355 c 0,-16.745 -19.125,-26.35 -32.555,-16.235 l -229.5,172.805 c -5.44,3.995 -8.16,10.03 -8.16,16.15 z" - id="path6" /> -<g - id="g4" - transform="matrix(0.9775,0,0,0.9775,53.547,53.54775)"> - <path - id="path2" - class="st0" - d="M 597.2,701.3 H 110.6 C 53.2,701.3 6.5,654.6 6.5,597.2 V 110.6 C 6.5,53.2 53.2,6.5 110.6,6.5 h 486.6 c 57.4,0 104.1,46.7 104.1,104.1 v 486.6 c 0,57.4 -46.7,104.1 -104.1,104.1 z M 110.6,52.4 c -32,0 -58.2,26 -58.2,58.2 v 486.6 c 0,32 26,58.2 58.2,58.2 h 486.6 c 32,0 58.2,-26 58.2,-58.2 V 110.6 c 0,-32 -26,-58.2 -58.2,-58.2 z" /> -</g> -<path - style="fill:#ed6b21;fill-opacity:1;stroke-width:0.674603" - d="m 150.65676,738.12999 c -12.4717,-1.39663 -26.66772,-5.94192 -37.84321,-12.11671 -17.754551,-9.80992 -33.768844,-26.68981 -42.418124,-44.71089 -5.985061,-12.4701 -8.760227,-23.35456 -9.821918,-38.52249 -0.48061,-6.8663 -0.640464,-87.42616 -0.497289,-250.61508 0.195544,-222.88027 0.294923,-240.94223 1.356742,-246.58759 4.2349,-22.51562 13.68014,-40.62012 29.200931,-55.97194 14.237938,-14.082924 31.958648,-23.427941 52.602238,-27.739791 5.87892,-1.227937 14.00696,-1.268146 256.3492,-1.268146 h 250.27778 l 7.08334,1.561512 c 21.30688,4.697075 36.90336,13.216072 51.96052,28.381502 14.67865,14.784203 23.1932,30.350373 27.76125,50.752683 l 1.56791,7.00271 v 250.95239 c 0,242.72256 -0.0418,251.15149 -1.26428,257.0238 -9.30592,44.69034 -45.18963,77.43352 -89.75566,81.90028 -9.17898,0.92002 -488.33076,0.87927 -496.55943,-0.0425 z M 652.87275,692.49 c 19.93824,-6.17834 34.6922,-21.42493 40.00111,-41.33675 l 1.51306,-5.67494 V 399.58544 153.69259 l -1.52571,-5.73412 c -5.66288,-21.28292 -21.4158,-36.89778 -42.2051,-41.83523 -5.63965,-1.33941 -7.66026,-1.3488 -253.17948,-1.17613 l -247.49447,0.17405 -4.72222,1.5953 c -18.05932,6.10093 -31.7315,19.23923 -37.4918,36.0278 -1.04762,3.05333 -2.22128,7.52472 -2.60813,9.93642 -0.47859,2.9836 -0.705,81.91876 -0.70847,246.99889 -0.005,218.14117 0.10226,243.1829 1.05916,248.25397 4.27172,22.63802 22.24346,40.86392 44.80877,45.4425 3.58848,0.72811 49.16893,0.87009 250.95237,0.78171 l 246.56747,-0.10801 z" - id="path17" /><path - style="fill:#ed6b21;fill-opacity:1;stroke-width:0.674603" - d="m 497.7111,573.23025 c -2.0645,4.13129 -4.8303,6.86895 -9.4092,9.31331 -3.4365,1.8345 -12.8201,1.79343 -16.5278,-0.0723 -3.224,-1.6224 -232.72361,-174.17372 -235.79014,-177.28102 -3.35765,-3.4022 -4.88322,-7.0012 -5.23218,-12.3432 -0.27168,-4.159 -0.0718,-5.3292 1.51379,-8.8624 1.00474,-2.2388 2.78734,-4.9734 3.96132,-6.0768 4.28582,-4.0281 232.27571,-175.2581 235.54571,-176.9048 4.6586,-2.3458 12.1025,-2.3876 16.5293,-0.093 3.8749,2.0088 7.8054,5.7435 9.6703,9.1887 l 1.4607,2.6984 0.1736,178.1462 0.1736,178.14615 z M 452.042,274.55434 c -1.0035,0.061 -154.9901,116.4878 -154.9901,117.1854 0,0.7118 154.0259,116.84801 154.9901,116.86316 0.2783,0.004 0.5059,-52.66166 0.5059,-117.03566 0,-64.374 -0.2276,-117.0298 -0.5059,-117.0129 z" - id="path19" /></svg> diff --git a/resources/icons/notification_left_hover.svg b/resources/icons/notification_left_hover.svg deleted file mode 100644 index 66046ee50..000000000 --- a/resources/icons/notification_left_hover.svg +++ /dev/null @@ -1,68 +0,0 @@ -<?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" - inkscape:version="1.0 (4035a4fb49, 2020-05-01)" - sodipodi:docname="notification_left_hover.svg" - xml:space="preserve" - style="enable-background:new 0 0 800 800;" - viewBox="0 0 800 800" - y="0px" - x="0px" - id="Layer_1" - version="1.1"><metadata - id="metadata15"><rdf:RDF><cc:Work - rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs - id="defs13" /><sodipodi:namedview - inkscape:current-layer="Layer_1" - inkscape:window-maximized="1" - inkscape:window-y="-11" - inkscape:window-x="-11" - inkscape:cy="396.42857" - inkscape:cx="400" - inkscape:zoom="1.26" - showgrid="false" - id="namedview11" - inkscape:window-height="2066" - inkscape:window-width="3840" - inkscape:pageshadow="2" - inkscape:pageopacity="0" - guidetolerance="10" - gridtolerance="10" - objecttolerance="10" - borderopacity="1" - bordercolor="#666666" - pagecolor="#ffffff" - inkscape:document-rotation="0" /> -<style - id="style2" - type="text/css"> - .st0{fill:#ED6B21;} -</style> - -<path - id="path6" - d="m 276.19955,389.92021 186.354,-140.352 v 280.5 l -186.354,-140.148 m -79.968,0 c 0,7.344 3.264,14.586 9.792,19.482 l 275.4,207.162 c 16.116,12.138 39.066,0.612 39.066,-19.482 v -414.426 c 0,-20.094 -22.95,-31.62 -39.066,-19.482 l -275.4,207.366 c -6.528,4.794 -9.792,12.036 -9.792,19.38 z" - class="st0" - style="stroke-width:1.02" /> -<g - transform="matrix(1.173,0,0,1.173,-15.64045,-15.6397)" - id="g4"> - <path - d="M 597.2,701.3 H 110.6 C 53.2,701.3 6.5,654.6 6.5,597.2 V 110.6 C 6.5,53.2 53.2,6.5 110.6,6.5 h 486.6 c 57.4,0 104.1,46.7 104.1,104.1 v 486.6 c 0,57.4 -46.7,104.1 -104.1,104.1 z M 110.6,52.4 c -32,0 -58.2,26 -58.2,58.2 v 486.6 c 0,32 26,58.2 58.2,58.2 h 486.6 c 32,0 58.2,-26 58.2,-58.2 V 110.6 c 0,-32 -26,-58.2 -58.2,-58.2 z" - class="st0" - id="path2" /> -</g> -<path - id="path17" - d="M 100.89126,805.85899 C 85.925222,804.18303 68.889998,798.72868 55.47941,791.31894 34.173949,779.54703 14.956797,759.29116 4.5776612,737.66587 -2.604412,722.70175 -5.9346112,709.6404 -7.2086404,691.43888 -7.7853724,683.19932 -7.9771972,586.52749 -7.8053872,390.70078 -7.5707344,123.24446 -7.4514796,101.57011 -6.1772968,94.795676 -1.0954168,67.776932 10.238871,46.051532 28.86382,27.629348 45.949346,10.729839 67.214198,-0.4841812 91.986506,-5.6584012 99.04121,-7.1319256 108.79486,-7.1801764 399.60555,-7.1801764 h 300.33333 l 8.50001,1.8738144 c 25.56826,5.63649 44.28403,15.859286 62.35262,34.057802 17.61438,17.741044 27.83184,36.420448 33.3135,60.90322 l 1.8815,8.403252 V 399.20078 c 0,291.26707 -0.0502,301.38179 -1.51714,308.42856 -11.1671,53.62841 -54.22756,92.92022 -107.70679,98.28034 -11.01478,1.10402 -585.99691,1.05512 -595.87132,-0.051 z M 703.55045,751.091 c 23.92589,-7.41401 41.63064,-25.70992 48.00133,-49.6041 l 1.81567,-6.80993 V 399.60553 104.53411 L 751.5366,97.653164 C 744.74115,72.11366 725.83764,53.375828 700.89048,47.450888 694.1229,45.843596 691.69817,45.832328 397.07511,46.039532 l -296.99337,0.20886 -5.666662,1.91436 c -21.671184,7.321116 -38.0778,23.087076 -44.99016,43.23336 -1.257144,3.663996 -2.665536,9.029668 -3.129756,11.923708 -0.574308,3.58032 -0.846,98.30251 -0.850164,296.39866 -0.006,261.76941 0.122712,291.81948 1.270992,297.90477 5.126064,27.16562 26.692152,49.0367 53.77052,54.531 4.30618,0.87373 59.00272,1.04411 301.14285,0.93805 l 295.88096,-0.12961 z" - style="fill:#ed6b21;fill-opacity:1;stroke-width:0.809524" /><path - style="fill:#ed6b21;fill-opacity:1;stroke-width:0.809524" - d="m 517.35644,607.97927 c -2.47732,4.95755 -5.79632,8.24274 -11.29098,11.17597 -4.12378,2.2014 -15.3841,2.15212 -19.83334,-0.0868 -3.86886,-1.94688 -279.26835,-209.0085 -282.94818,-212.7372 -4.02918,-4.08265 -5.85987,-8.40144 -6.27862,-14.81191 -0.32601,-4.99079 -0.0862,-6.39496 1.81655,-10.63477 1.20569,-2.68663 3.34481,-5.96811 4.75358,-7.29219 5.14299,-4.83375 278.73085,-210.30981 282.65486,-212.28577 5.59033,-2.81501 14.52301,-2.86511 19.83515,-0.11124 4.64982,2.41053 9.36643,6.89221 11.60431,11.02636 l 1.75284,3.23809 0.20834,213.77545 0.20835,213.77542 z M 462.55355,249.56821 c -1.2042,0.0733 -185.9881,139.7853 -185.9881,140.62241 0,0.85421 184.8311,140.21766 185.9881,140.23584 0.33393,0.005 0.60714,-63.19404 0.60714,-140.44285 0,-77.2488 -0.27321,-140.43574 -0.60714,-140.4154 z" - id="path19" /></svg> diff --git a/src/imgui/imconfig.h b/src/imgui/imconfig.h index 6416e1fc2..dfb314d3c 100644 --- a/src/imgui/imconfig.h +++ b/src/imgui/imconfig.h @@ -139,12 +139,19 @@ namespace ImGui const char EjectHoverButton = 0x13; const char CancelButton = 0x14; const char CancelHoverButton = 0x15; - const char LeftArrowButton = 0x16; - const char LeftArrowHoverButton = 0x17; + const char VarLayerHeightMarker = 0x16; + const char RightArrowButton = 0x18; const char RightArrowHoverButton = 0x19; const char PreferencesButton = 0x1A; const char PreferencesHoverButton = 0x1B; + const char SinkingObjectMarker = 0x1C; + const char CustomSupportsMarker = 0x1D; + const char CustomSeamMarker = 0x1E; + const char MmuSegmentationMarker = 0x1F; + + + // void MyFunction(const char* name, const MyMatrix44& v); } diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index a4bfd3f46..c06e90c91 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -20,6 +20,7 @@ #include "GLCanvas3D.hpp" #include "Selection.hpp" #include "format.hpp" +#include "NotificationManager.hpp" #include <boost/algorithm/string.hpp> #include <wx/progdlg.h> @@ -2568,6 +2569,8 @@ void ObjectList::update_info_items(size_t obj_idx) if (! shows && should_show) { m_objects_model->AddInfoChild(item_obj, type); Expand(item_obj); + wxGetApp().notification_manager()->push_updated_item_info_notification(type); + } else if (shows && ! should_show) { Unselect(item); diff --git a/src/slic3r/GUI/HintNotification.cpp b/src/slic3r/GUI/HintNotification.cpp index e94858d3f..fe4f3c9ab 100644 --- a/src/slic3r/GUI/HintNotification.cpp +++ b/src/slic3r/GUI/HintNotification.cpp @@ -218,7 +218,7 @@ void NotificationManager::HintNotification::count_spaces() std::string text; - text = ImGui::LeftArrowButton; // TODO change to left arrow + text = ImGui::WarningMarker; float picture_width = ImGui::CalcTextSize(text.c_str()).x; m_left_indentation = picture_width + m_line_height / 2; diff --git a/src/slic3r/GUI/ImGuiWrapper.cpp b/src/slic3r/GUI/ImGuiWrapper.cpp index e389d268c..79e34ba85 100644 --- a/src/slic3r/GUI/ImGuiWrapper.cpp +++ b/src/slic3r/GUI/ImGuiWrapper.cpp @@ -58,8 +58,12 @@ static const std::map<const char, std::string> font_icons_large = { {ImGui::ErrorMarker , "notification_error" }, {ImGui::CancelButton , "notification_cancel" }, {ImGui::CancelHoverButton , "notification_cancel_hover" }, - {ImGui::LeftArrowButton , "notification_left" }, - {ImGui::LeftArrowHoverButton , "notification_left_hover" }, + {ImGui::SinkingObjectMarker , "move" }, + {ImGui::CustomSupportsMarker , "fdm_supports" }, + {ImGui::CustomSeamMarker , "seam" }, + {ImGui::MmuSegmentationMarker , "move" }, + {ImGui::VarLayerHeightMarker , "layers" }, + }; const ImVec4 ImGuiWrapper::COL_GREY_DARK = { 0.333f, 0.333f, 0.333f, 1.0f }; diff --git a/src/slic3r/GUI/NotificationManager.cpp b/src/slic3r/GUI/NotificationManager.cpp index 48d7f5de8..61b5d8f43 100644 --- a/src/slic3r/GUI/NotificationManager.cpp +++ b/src/slic3r/GUI/NotificationManager.cpp @@ -5,6 +5,7 @@ #include "ImGuiWrapper.hpp" #include "PrintHostDialogs.hpp" #include "wxExtensions.hpp" +#include "ObjectDataViewModel.hpp" #include "libslic3r/Config.hpp" #include "../Utils/PrintHost.hpp" #include "libslic3r/Config.hpp" @@ -1058,8 +1059,37 @@ void NotificationManager::PrintHostUploadNotification::render_cancel_button(ImGu ImGui::PopStyleColor(); ImGui::PopStyleColor(); ImGui::PopStyleColor(); - } +//------UpdatedItemsInfoNotification------- +void NotificationManager::UpdatedItemsInfoNotification::count_spaces() +{ + //determine line width + m_line_height = ImGui::CalcTextSize("A").y; + + std::string text; + text = ImGui::WarningMarker; + float picture_width = ImGui::CalcTextSize(text.c_str()).x; + m_left_indentation = picture_width + m_line_height / 2; + + m_window_width_offset = m_left_indentation + m_line_height * 3.f; + m_window_width = m_line_height * 25; +} +void NotificationManager::UpdatedItemsInfoNotification::render_left_sign(ImGuiWrapper& imgui) +{ + std::string text; + switch (m_info_item_type) { + case InfoItemType::CustomSupports: text = ImGui::CustomSupportsMarker; break; + case InfoItemType::CustomSeam: text = ImGui::CustomSeamMarker; break; + case InfoItemType::MmuSegmentation: text = ImGui::MmuSegmentationMarker; break; + case InfoItemType::VariableLayerHeight: text = ImGui::VarLayerHeightMarker; break; + case InfoItemType::Sinking: text = ImGui::SinkingObjectMarker; break; + default: break; + } + ImGui::SetCursorPosX(m_line_height / 3); + ImGui::SetCursorPosY(m_window_height / 2 - m_line_height); + imgui.text(text.c_str()); +} + //------NotificationManager-------- NotificationManager::NotificationManager(wxEvtHandler* evt_handler) : m_evt_handler(evt_handler) @@ -1087,9 +1117,11 @@ void NotificationManager::push_notification(NotificationType type, { int duration = 0; switch (level) { - case NotificationLevel::RegularNotification: duration = 10; break; - case NotificationLevel::ErrorNotification: break; - case NotificationLevel::ImportantNotification: break; + case NotificationLevel::RegularNotification: duration = 10; break; + case NotificationLevel::ErrorNotification: break; + case NotificationLevel::WarningNotification: break; + case NotificationLevel::ImportantNotification: break; + case NotificationLevel::ProgressBarNotification: break; default: assert(false); return; @@ -1324,6 +1356,23 @@ void NotificationManager::push_hint_notification() NotificationData data{ NotificationType::DidYouKnowHint, NotificationLevel::RegularNotification, 0, "" }; push_notification_data(std::make_unique<NotificationManager::HintNotification>(data, m_id_provider, m_evt_handler), 0); } + +void NotificationManager::push_updated_item_info_notification(InfoItemType type) +{ + std::string text = _utf8("Object(s) were loaded with "); + switch (type) { + case InfoItemType::CustomSupports: text += _utf8("custom supports."); break; + case InfoItemType::CustomSeam: text += _utf8("custom seam."); break; + case InfoItemType::MmuSegmentation: text += _utf8("MMU segmentation."); break; + case InfoItemType::VariableLayerHeight: text += _utf8("variable layer height."); break; + case InfoItemType::Sinking: text = _utf8("Partially sinking object(s) were loaded."); break; + default: text.clear(); break; + } + if (!text.empty()) { + NotificationData data{ NotificationType::UpdatedItemsInfo, NotificationLevel::RegularNotification, 10, text }; + push_notification_data(std::make_unique<NotificationManager::UpdatedItemsInfoNotification>(data, m_id_provider, m_evt_handler, type), 0); + } +} bool NotificationManager::push_notification_data(const NotificationData& notification_data, int timestamp) { return push_notification_data(std::make_unique<PopNotification>(notification_data, m_id_provider, m_evt_handler), timestamp); diff --git a/src/slic3r/GUI/NotificationManager.hpp b/src/slic3r/GUI/NotificationManager.hpp index 81599b68f..2c5c85b19 100644 --- a/src/slic3r/GUI/NotificationManager.hpp +++ b/src/slic3r/GUI/NotificationManager.hpp @@ -29,6 +29,7 @@ wxDECLARE_EVENT(EVT_PRESET_UPDATE_AVAILABLE_CLICKED, PresetUpdateAvailableClicke class GLCanvas3D; class ImGuiWrapper; +enum class InfoItemType; enum class NotificationType { @@ -92,7 +93,10 @@ enum class NotificationType // Notification that a printer has more extruders than are supported by MM Gizmo/segmentation. MmSegmentationExceededExtrudersLimit, // Did you know Notification appearing on startup with arrows to change hint - DidYouKnowHint + DidYouKnowHint, + // Shows when ObjectList::update_info_items finds information that should be stressed to the user + // Might contain logo taken from gizmos + UpdatedItemsInfo }; class NotificationManager @@ -166,6 +170,7 @@ public: void upload_job_notification_show_error(int id, const std::string& filename, const std::string& host); // Hint (did you know) notification void push_hint_notification(); + void push_updated_item_info_notification(InfoItemType type); // Close old notification ExportFinished. void new_export_began(bool on_removable); // finds ExportFinished notification and closes it if it was to removable device @@ -488,6 +493,20 @@ private: long m_hover_time { 0 }; }; + class UpdatedItemsInfoNotification : public PopNotification + { + public: + UpdatedItemsInfoNotification(const NotificationData& n, NotificationIDProvider& id_provider, wxEvtHandler* evt_handler, InfoItemType info_item_type) + : PopNotification(n, id_provider, evt_handler) + , m_info_item_type(info_item_type) + { + } + void count_spaces() override; + protected: + void render_left_sign(ImGuiWrapper& imgui) override; + InfoItemType m_info_item_type; + }; + // in HintNotification.hpp class HintNotification; @@ -516,7 +535,7 @@ private: // Timestamp of last rendering int64_t m_last_render { 0LL }; // Notification types that can be shown multiple types at once (compared by text) - const std::vector<NotificationType> m_multiple_types = { NotificationType::CustomNotification, NotificationType::PlaterWarning, NotificationType::ProgressBar, NotificationType::PrintHostUpload }; + const std::vector<NotificationType> m_multiple_types = { NotificationType::CustomNotification, NotificationType::PlaterWarning, NotificationType::ProgressBar, NotificationType::PrintHostUpload, NotificationType::UpdatedItemsInfo }; //prepared (basic) notifications static const NotificationData basic_notifications[]; };