Merge branch 'dk_notifications' into master

This commit is contained in:
David Kocik 2020-09-01 15:58:56 +02:00
commit 83a6e45df5
12 changed files with 406 additions and 66 deletions

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.2.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.0" id="close_window" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px"
y="0px" viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve">
<g>
<path fill="#ED6B21" d="M80,92.83H20c-7.08,0-12.83-5.76-12.83-12.84V20c0-7.08,5.76-12.83,12.83-12.83h60
c7.08,0,12.84,5.76,12.84,12.83v60C92.83,87.08,87.08,92.83,80,92.83z M20,12.83c-3.95,0-7.17,3.21-7.17,7.17v60
c0,3.95,3.21,7.17,7.17,7.17h60c3.95,0,7.17-3.21,7.17-7.17V20c0-3.95-3.21-7.17-7.17-7.17H20z"/>
</g>
<g>
<path fill="#ED6B21" d="M70,75.67c-1.45,0-2.9-0.55-4.01-1.66l-40-40c-2.21-2.21-2.21-5.8,0-8.02s5.8-2.21,8.02,0l40,40
c2.21,2.21,2.21,5.8,0,8.02C72.9,75.12,71.45,75.67,70,75.67z"/>
</g>
<g>
<path fill="#ED6B21" d="M30,75.67c-1.45,0-2.9-0.55-4.01-1.66c-2.21-2.21-2.21-5.8,0-8.02l40-40c2.21-2.21,5.8-2.21,8.02,0
c2.21,2.21,2.21,5.8,0,8.02l-40,40C32.9,75.12,31.45,75.67,30,75.67z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -0,0 +1,66 @@
<?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_close_hover.svg"
xml:space="preserve"
enable-background="new 0 0 100 100"
viewBox="0 0 100 100"
y="0px"
x="0px"
id="close_window"
version="1.0"><metadata
id="metadata19"><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="defs17" /><sodipodi:namedview
inkscape:current-layer="close_window"
inkscape:window-maximized="1"
inkscape:window-y="-8"
inkscape:window-x="-8"
inkscape:cy="50"
inkscape:cx="50"
inkscape:zoom="10.08"
showgrid="false"
id="namedview15"
inkscape:window-height="1377"
inkscape:window-width="2560"
inkscape:pageshadow="2"
inkscape:pageopacity="0"
guidetolerance="10"
gridtolerance="10"
objecttolerance="10"
borderopacity="1"
bordercolor="#666666"
pagecolor="#ffffff" />
<g
transform="matrix(1.15,0,0,1.15,-7.50075,-7.5)"
id="g4">
<path
id="path2"
d="M 80,92.83 H 20 C 12.92,92.83 7.17,87.07 7.17,79.99 V 20 C 7.17,12.92 12.93,7.17 20,7.17 h 60 c 7.08,0 12.84,5.76 12.84,12.83 V 80 C 92.83,87.08 87.08,92.83 80,92.83 Z m -60,-80 c -3.95,0 -7.17,3.21 -7.17,7.17 v 60 c 0,3.95 3.21,7.17 7.17,7.17 h 60 c 3.95,0 7.17,-3.21 7.17,-7.17 V 20 c 0,-3.95 -3.21,-7.17 -7.17,-7.17 z"
fill="#ED6B21" />
</g>
<g
transform="matrix(1.15,0,0,1.15,-7.50075,-7.5)"
id="g8">
<path
id="path6"
d="m 70,75.67 c -1.45,0 -2.9,-0.55 -4.01,-1.66 l -40,-40 c -2.21,-2.21 -2.21,-5.8 0,-8.02 2.21,-2.22 5.8,-2.21 8.02,0 l 40,40 c 2.21,2.21 2.21,5.8 0,8.02 -1.11,1.11 -2.56,1.66 -4.01,1.66 z"
fill="#ED6B21" />
</g>
<g
transform="matrix(1.15,0,0,1.15,-7.50075,-7.5)"
id="g12">
<path
id="path10"
d="m 30,75.67 c -1.45,0 -2.9,-0.55 -4.01,-1.66 -2.21,-2.21 -2.21,-5.8 0,-8.02 l 40,-40 c 2.21,-2.21 5.8,-2.21 8.02,0 2.21,2.21 2.21,5.8 0,8.02 l -40,40 C 32.9,75.12 31.45,75.67 30,75.67 Z"
fill="#ED6B21" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -0,0 +1,71 @@
<?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="error"
x="0px"
y="0px"
viewBox="0 0 200 200"
enable-background="new 0 0 100 100"
xml:space="preserve"
sodipodi:docname="notification_error.svg"
width="200"
height="200"
inkscape:version="1.0 (4035a4fb49, 2020-05-01)"><metadata
id="metadata19"><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></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs17" /><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="namedview15"
showgrid="false"
inkscape:zoom="5.04"
inkscape:cx="117.17146"
inkscape:cy="98.609664"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="error" />
<g
id="g4"
transform="matrix(2.52,0,0,2.52,-26,-26)">
<path
fill="#ed6b21"
d="m 50,54.25 c -2.35,0 -4.25,-1.9 -4.25,-4.25 V 35 c 0,-2.35 1.9,-4.25 4.25,-4.25 2.35,0 4.25,1.9 4.25,4.25 v 15 c 0,2.35 -1.9,4.25 -4.25,4.25 z"
id="path2" />
</g>
<g
id="g8"
transform="matrix(2.52,0,0,2.52,-26,-26)">
<circle
fill="#ed6b21"
cx="50"
cy="65"
r="5"
id="circle6" />
</g>
<g
id="g12"
transform="matrix(2.52,0,0,2.52,-26,-26)">
<path
fill="#ed6b21"
d="M 50,89.25 C 28.36,89.25 10.75,71.64 10.75,50 10.75,28.36 28.36,10.75 50,10.75 71.64,10.75 89.25,28.36 89.25,50 89.25,71.64 71.64,89.25 50,89.25 Z m 0,-70 C 33.05,19.25 19.25,33.04 19.25,50 19.25,66.95 33.04,80.75 50,80.75 66.95,80.75 80.75,66.96 80.75,50 80.75,33.05 66.95,19.25 50,19.25 Z"
id="path10" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.2.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.0" id="minimalize_window" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px"
y="0px" viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve">
<g>
<path fill="#ED6B21" d="M80,92.83H20c-7.08,0-12.83-5.76-12.83-12.84V20c0-7.08,5.76-12.83,12.83-12.83h60
c7.08,0,12.84,5.76,12.84,12.83v60C92.83,87.08,87.08,92.83,80,92.83z M20,12.83c-3.95,0-7.17,3.21-7.17,7.17v60
c0,3.95,3.21,7.17,7.17,7.17h60c3.95,0,7.17-3.21,7.17-7.17V20c0-3.95-3.21-7.17-7.17-7.17H20z"/>
</g>
<g>
<path fill="#ED6B21" d="M70,75.67H30c-3.13,0-5.67-2.54-5.67-5.67v-5c0-3.13,2.54-5.67,5.67-5.67h40c3.13,0,5.67,2.54,5.67,5.67v5
C75.67,73.13,73.13,75.67,70,75.67z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 858 B

View File

@ -0,0 +1,58 @@
<?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_minimalize.svg"
xml:space="preserve"
enable-background="new 0 0 100 100"
viewBox="0 0 100 100"
y="0px"
x="0px"
id="minimalize_window"
version="1.0"><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" /></cc:Work></rdf:RDF></metadata><defs
id="defs13" /><sodipodi:namedview
inkscape:current-layer="minimalize_window"
inkscape:window-maximized="1"
inkscape:window-y="-8"
inkscape:window-x="-8"
inkscape:cy="50"
inkscape:cx="50"
inkscape:zoom="10.08"
showgrid="false"
id="namedview11"
inkscape:window-height="1377"
inkscape:window-width="2560"
inkscape:pageshadow="2"
inkscape:pageopacity="0"
guidetolerance="10"
gridtolerance="10"
objecttolerance="10"
borderopacity="1"
bordercolor="#666666"
pagecolor="#ffffff" />
<g
transform="matrix(1.15,0,0,1.15,-7.50075,-7.5)"
id="g4">
<path
id="path2"
d="M 80,92.83 H 20 C 12.92,92.83 7.17,87.07 7.17,79.99 V 20 C 7.17,12.92 12.93,7.17 20,7.17 h 60 c 7.08,0 12.84,5.76 12.84,12.83 V 80 C 92.83,87.08 87.08,92.83 80,92.83 Z m -60,-80 c -3.95,0 -7.17,3.21 -7.17,7.17 v 60 c 0,3.95 3.21,7.17 7.17,7.17 h 60 c 3.95,0 7.17,-3.21 7.17,-7.17 V 20 c 0,-3.95 -3.21,-7.17 -7.17,-7.17 z"
fill="#ed6b21" />
</g>
<g
transform="matrix(1.15,0,0,1.15,-7.50075,-7.5)"
id="g8">
<path
id="path6"
d="M 70,75.67 H 30 c -3.13,0 -5.67,-2.54 -5.67,-5.67 v -5 c 0,-3.13 2.54,-5.67 5.67,-5.67 h 40 c 3.13,0 5.67,2.54 5.67,5.67 v 5 c 0,3.13 -2.54,5.67 -5.67,5.67 z"
fill="#ed6b21" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -0,0 +1,70 @@
<?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)"
height="200"
width="200"
sodipodi:docname="notification_warning.svg"
xml:space="preserve"
enable-background="new 0 0 100 100"
viewBox="0 0 200 200"
y="0px"
x="0px"
id="warning"
version="1.0"><metadata
id="metadata19"><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></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs17" /><sodipodi:namedview
inkscape:current-layer="warning"
inkscape:window-maximized="1"
inkscape:window-y="-8"
inkscape:window-x="-8"
inkscape:cy="71.071558"
inkscape:cx="34.775892"
inkscape:zoom="3.5638182"
showgrid="false"
id="namedview15"
inkscape:window-height="1377"
inkscape:window-width="2560"
inkscape:pageshadow="2"
inkscape:pageopacity="0"
guidetolerance="10"
gridtolerance="10"
objecttolerance="10"
borderopacity="1"
bordercolor="#666666"
pagecolor="#ffffff" />
<g
transform="matrix(2.2,0,0,2.2,-9.9977389,-10)"
id="g4">
<path
id="path2"
d="M 90,89.25 H 10 C 8.48,89.25 7.08,88.44 6.32,87.13 5.56,85.82 5.55,84.2 6.31,82.89 l 40,-70 c 0.76,-1.33 2.17,-2.14 3.69,-2.14 1.53,0 2.93,0.82 3.69,2.14 l 40,70 c 0.75,1.32 0.75,2.93 -0.01,4.24 -0.76,1.32 -2.16,2.12 -3.68,2.12 z M 17.33,80.75 H 82.68 L 50,23.57 Z"
fill="#ed6b21" />
</g>
<g
transform="matrix(2.2,0,0,2.2,-9.9977389,-10)"
id="g8">
<path
id="path6"
d="m 50,59.25 c -2.35,0 -4.25,-1.9 -4.25,-4.25 V 40 c 0,-2.35 1.9,-4.25 4.25,-4.25 2.35,0 4.25,1.9 4.25,4.25 v 15 c 0,2.35 -1.9,4.25 -4.25,4.25 z"
fill="#ed6b21" />
</g>
<g
transform="matrix(2.2,0,0,2.2,-9.9977389,-10)"
id="g12">
<circle
id="circle10"
r="5"
cy="70"
cx="50"
fill="#ed6b21" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -108,17 +108,19 @@ namespace ImGui
const char ColorMarkerEnd = 0x3; // ETX
// Special ASCII characters are used here as an ikons markers
const char PrintIconMarker = 0x4;
const char PrinterIconMarker = 0x5;
const char PrinterSlaIconMarker = 0x6;
const char FilamentIconMarker = 0x7;
const char MaterialIconMarker = 0x8;
const char CloseIconMarker = 0xB;
const char CloseIconHoverMarker = 0xC;
const char TimerDotMarker = 0xE;
const char TimerDotEmptyMarker = 0xF;
const char WarningMarker = 0x10;
const char ErrorMarker = 0x11;
const char PrintIconMarker = 0x4;
const char PrinterIconMarker = 0x5;
const char PrinterSlaIconMarker = 0x6;
const char FilamentIconMarker = 0x7;
const char MaterialIconMarker = 0x8;
const char CloseIconMarker = 0xB;
const char CloseIconHoverMarker = 0xC;
// const char TimerDotMarker = 0xE;
// const char TimerDotEmptyMarker = 0xF;
const char MinimalizeMarker = 0xE;
const char MinimalizeHoverMarker = 0xF;
const char WarningMarker = 0x10;
const char ErrorMarker = 0x11;
// void MyFunction(const char* name, const MyMatrix44& v);
}

View File

@ -620,53 +620,57 @@ GLCanvas3D::WarningTexture::WarningTexture()
void GLCanvas3D::WarningTexture::activate(WarningTexture::Warning warning, bool state, const GLCanvas3D& canvas)
{
// Since we have NotificationsManager.hpp the warning textures are no loger needed.
// However i have left the infrastructure here and only commented the rendering.
// The plater warning / error notifications are added and closed from here.
std::string text;
bool error = false;
switch (warning) {
case ObjectOutside: text = L("An object outside the print area was detected."); break;
case ToolpathOutside: text = L("A toolpath outside the print area was detected."); break;
case SlaSupportsOutside: text = L("SLA supports outside the print area were detected."); break;
case SomethingNotShown: text = L("Some objects are not visible."); break;
case ObjectClashed:
text = L( "An object outside the print area was detected.\n"
"Resolve the current problem to continue slicing.");
error = true;
break;
}
if(state) {
if(error)
wxGetApp().plater()->get_notification_manager()->push_plater_error_notification(text,*(wxGetApp().plater()->get_current_canvas3D()));
else
wxGetApp().plater()->get_notification_manager()->push_plater_warning_notification(text, *(wxGetApp().plater()->get_current_canvas3D()));
} else {
if (error)
wxGetApp().plater()->get_notification_manager()->close_plater_error_notification();
else
wxGetApp().plater()->get_notification_manager()->close_plater_warning_notification(text);
}
/*
auto it = std::find(m_warnings.begin(), m_warnings.end(), warning);
if (state) {
if (it != m_warnings.end()) // this warning is already set to be shown
return;
m_warnings.emplace_back(warning);
m_warnings.push_back(warning);
std::sort(m_warnings.begin(), m_warnings.end());
std::string text;
switch (warning) {
case ObjectOutside: text = L("An object outside the print area was detected."); break;
case ToolpathOutside: text = L("A toolpath outside the print area was detected."); break;
case SlaSupportsOutside: text = L("SLA supports outside the print area were detected."); break;
case SomethingNotShown: text = L("Some objects are not visible."); break;
case ObjectClashed: wxGetApp().plater()->get_notification_manager()->push_plater_error_notification(L("An object outside the print area was detected.\n"
"Resolve the current problem to continue slicing."),
*(wxGetApp().plater()->get_current_canvas3D()));
break;
}
if (!text.empty())
wxGetApp().plater()->get_notification_manager()->push_plater_warning_notification(text, *(wxGetApp().plater()->get_current_canvas3D()));
}
else {
if (it == m_warnings.end()) // deactivating something that is not active is an easy task
return;
m_warnings.erase(it);
std::string text;
switch (warning) {
case ObjectOutside: text = L("An object outside the print area was detected."); break;
case ToolpathOutside: text = L("A toolpath outside the print area was detected."); break;
case SlaSupportsOutside: text = L("SLA supports outside the print area were detected."); break;
case SomethingNotShown: text = L("Some objects are not visibl.e"); break;
case ObjectClashed: wxGetApp().plater()->get_notification_manager()->close_plater_error_notification(); break;
}
if (!text.empty())
wxGetApp().plater()->get_notification_manager()->close_plater_warning_notification(text);
/*if (m_warnings.empty()) { // nothing remains to be shown
if (m_warnings.empty()) { // nothing remains to be shown
reset();
m_msg_text = "";// save information for rescaling
return;
}*/
}
}
/*
// Look at the end of our vector and generate proper texture.
std::string text;
bool red_colored = false;
@ -674,7 +678,7 @@ void GLCanvas3D::WarningTexture::activate(WarningTexture::Warning warning, bool
case ObjectOutside : text = L("An object outside the print area was detected"); break;
case ToolpathOutside : text = L("A toolpath outside the print area was detected"); break;
case SlaSupportsOutside : text = L("SLA supports outside the print area were detected"); break;
case SomethingNotShown : text = L("Some objects are not visible"); break;
case SomethingNotShown : text = L("Some objects are not visible when editing supports"); break;
case ObjectClashed: {
text = L("An object outside the print area was detected\n"
"Resolve the current problem to continue slicing");

View File

@ -37,17 +37,19 @@ namespace GUI {
static const std::map<const char, std::string> font_icons = {
{ImGui::PrintIconMarker , "cog" },
{ImGui::PrinterIconMarker , "printer" },
{ImGui::PrinterSlaIconMarker, "sla_printer" },
{ImGui::FilamentIconMarker , "spool" },
{ImGui::MaterialIconMarker , "resin" },
{ImGui::CloseIconMarker , "cross" },
{ImGui::CloseIconHoverMarker, "cross_focus_large" },
{ImGui::TimerDotMarker , "timer_dot" },
{ImGui::TimerDotEmptyMarker , "timer_dot_empty" },
{ImGui::WarningMarker , "flag_green" },
{ImGui::ErrorMarker , "flag_red" }
{ImGui::PrintIconMarker , "cog" },
{ImGui::PrinterIconMarker , "printer" },
{ImGui::PrinterSlaIconMarker , "sla_printer" },
{ImGui::FilamentIconMarker , "spool" },
{ImGui::MaterialIconMarker , "resin" },
{ImGui::CloseIconMarker , "notification_close" },
{ImGui::CloseIconHoverMarker , "notification_close_hover" },
//{ImGui::TimerDotMarker , "timer_dot" },
//{ImGui::TimerDotEmptyMarker , "timer_dot_empty" },
{ImGui::MinimalizeMarker , "notification_minimalize" },
{ImGui::MinimalizeHoverMarker , "notification_minimalize_hover" },
{ImGui::WarningMarker , "notification_warning" },
{ImGui::ErrorMarker , "notification_error" }
};
const ImVec4 ImGuiWrapper::COL_GREY_DARK = { 0.333f, 0.333f, 0.333f, 1.0f };

View File

@ -49,13 +49,17 @@ NotificationManager::PopNotification::PopNotification(const NotificationData &n,
, m_text2 (n.text2)
, m_evt_handler (evt_handler)
{
init();
//init();
}
NotificationManager::PopNotification::~PopNotification()
{
}
NotificationManager::PopNotification::RenderResult NotificationManager::PopNotification::render(GLCanvas3D& canvas, const float& initial_y)
{
if (!m_initialized)
{
init();
}
if (m_finished)
return RenderResult::Finished;
if (m_close_pending) {
@ -228,6 +232,7 @@ void NotificationManager::PopNotification::init()
}
m_lines_count++;
}
m_initialized = true;
}
void NotificationManager::PopNotification::set_next_window_size(ImGuiWrapper& imgui)
{
@ -492,12 +497,12 @@ void NotificationManager::PopNotification::render_minimize_button(ImGuiWrapper&
//button - if part if treggered
std::string button_text;
button_text = ImGui::CloseIconMarker;
button_text = ImGui::MinimalizeMarker;
if (ImGui::IsMouseHoveringRect(ImVec2(win_pos_x - m_window_width / 10.f, win_pos_y + m_window_height - 2 * m_line_height + 1),
ImVec2(win_pos_x, win_pos_y + m_window_height),
true))
{
button_text = ImGui::CloseIconHoverMarker;
button_text = ImGui::MinimalizeHoverMarker;
}
ImVec2 button_pic_size = ImGui::CalcTextSize(button_text.c_str());
ImVec2 button_size(button_pic_size.x * 1.25f, button_pic_size.y * 1.25f);
@ -730,16 +735,16 @@ void NotificationManager::push_slicing_complete_notification(GLCanvas3D& canvas,
{
std::string hypertext;
int time = 10;
if(large)
{
if (has_error_notification())
return;
if (large) {
hypertext = _u8L("Export G-Code.");
time = 0;
}
NotificationData data{ NotificationType::SlicingComplete, NotificationLevel::RegularNotification, time, _u8L("Slicing finished."), hypertext };
NotificationManager::SlicingCompleteLargeNotification* notification = new NotificationManager::SlicingCompleteLargeNotification(data, m_next_id++, m_evt_handler, large);
if (push_notification_data(notification, canvas, timestamp)) {
} else {
if (!push_notification_data(notification, canvas, timestamp)) {
delete notification;
}
}
@ -909,6 +914,23 @@ bool NotificationManager::find_older(NotificationManager::PopNotification* notif
return false;
}
void NotificationManager::set_in_preview(bool preview)
{
m_in_preview = preview;
for (PopNotification* notification : m_pop_notifications) {
if (notification->get_type() == NotificationType::PlaterWarning)
notification->hide(preview);
}
}
bool NotificationManager::has_error_notification()
{
for (PopNotification* notification : m_pop_notifications) {
if (notification->get_data().level == NotificationLevel::ErrorNotification)
return true;
}
return false;
}
void NotificationManager::dpi_changed()
{

View File

@ -94,6 +94,7 @@ public:
void set_gray(bool g) { m_is_gray = g; }
void set_paused(bool p) { m_paused = p; }
bool compare_text(const std::string& text);
void hide(bool h) { m_hidden = h; }
protected:
// Call after every size change
void init();
@ -120,6 +121,7 @@ public:
const NotificationData m_data;
int m_id;
bool m_initialized { false };
// Main text
std::string m_text1;
// Clickable text
@ -130,12 +132,12 @@ public:
long m_remaining_time;
bool m_counting_down;
long m_last_remaining_time;
bool m_paused{ false };
int m_countdown_frame{ 0 };
bool m_fading_out{ false };
bool m_paused { false };
int m_countdown_frame { 0 };
bool m_fading_out { false };
// total time left when fading beggins
float m_fading_time{ 0.0f };
float m_current_fade_opacity{ 1.f };
float m_fading_time { 0.0f };
float m_current_fade_opacity { 1.f };
// If hidden the notif is alive but not visible to user
bool m_hidden { false };
// m_finished = true - does not render, marked to delete
@ -230,6 +232,7 @@ public:
// finds and closes all notifications of given type
void close_notification_of_type(const NotificationType type);
void dpi_changed();
void set_in_preview(bool preview);
private:
//pushes notification into the queue of notifications that are rendered
//can be used to create custom notification
@ -238,6 +241,7 @@ private:
//finds older notification of same type and moves it to the end of queue. returns true if found
bool find_older(NotificationManager::PopNotification* notification);
void sort_notifications();
bool has_error_notification();
wxEvtHandler* m_evt_handler;
std::deque<PopNotification*> m_pop_notifications;
@ -246,6 +250,7 @@ private:
bool m_hovered { false };
//timestamps used for slining finished - notification could be gone so it needs to be stored here
std::unordered_set<int> m_used_timestamps;
bool m_in_preview;
//prepared (basic) notifications
const std::vector<NotificationData> basic_notifications = {

View File

@ -1512,7 +1512,7 @@ struct Plater::priv
GLToolbar view_toolbar;
GLToolbar collapse_toolbar;
Preview *preview;
NotificationManager* notification_manager;
NotificationManager* notification_manager { nullptr };
BackgroundSlicingProcess background_process;
bool suppressed_backround_processing_update { false };
@ -3304,6 +3304,8 @@ void Plater::priv::set_current_panel(wxPanel* panel)
// sets the canvas as dirty to force a render at the 1st idle event (wxWidgets IsShownOnScreen() is buggy and cannot be used reliably)
view3D->set_as_dirty();
view_toolbar.select_item("3D");
if(notification_manager != nullptr)
notification_manager->set_in_preview(false);
}
else if (current_panel == preview)
{
@ -3318,6 +3320,8 @@ void Plater::priv::set_current_panel(wxPanel* panel)
preview->set_as_dirty();
view_toolbar.select_item("Preview");
if (notification_manager != nullptr)
notification_manager->set_in_preview(true);
}
current_panel->SetFocusFromKbd();
@ -3481,6 +3485,10 @@ void Plater::priv::add_warning(const Slic3r::PrintStateBase::Warning& warning, s
}
void Plater::priv::actualizate_warnings(const Model& model, size_t print_oid)
{
if (model.objects.size() == 0) {
clear_warnings();
return;
}
std::vector<size_t> living_oids;
living_oids.push_back(model.id().id);
living_oids.push_back(print_oid);