diff --git a/resources/icons/edit_gcode.svg b/resources/icons/edit_gcode.svg
new file mode 100644
index 000000000..694e106cc
--- /dev/null
+++ b/resources/icons/edit_gcode.svg
@@ -0,0 +1,15 @@
+
+
+
diff --git a/resources/icons/edit_uni.svg b/resources/icons/edit_uni.svg
new file mode 100644
index 000000000..f7b1673a6
--- /dev/null
+++ b/resources/icons/edit_uni.svg
@@ -0,0 +1,20 @@
+
+
+
diff --git a/resources/icons/pause_print.svg b/resources/icons/pause_print.svg
new file mode 100644
index 000000000..a905b1ea1
--- /dev/null
+++ b/resources/icons/pause_print.svg
@@ -0,0 +1,18 @@
+
+
+
diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp
index 381bd3e66..8afeecb1e 100644
--- a/src/libslic3r/GCode.cpp
+++ b/src/libslic3r/GCode.cpp
@@ -1868,11 +1868,16 @@ void GCode::process_layer(
// colorprint_change = true;
// }
std::string custom_code = "";
+ std::string pause_print_msg = "";
int m600_before_extruder = -1;
while (!m_custom_g_code_heights.empty() && m_custom_g_code_heights.front().height-EPSILON < layer.print_z) {
custom_code = m_custom_g_code_heights.front().gcode;
if (custom_code == ColorChangeCode && m_custom_g_code_heights.front().extruder > 0)
m600_before_extruder = m_custom_g_code_heights.front().extruder - 1;
+
+ if (custom_code == PausePrintCode)
+ pause_print_msg = m_custom_g_code_heights.front().color;
+
m_custom_g_code_heights.erase(m_custom_g_code_heights.begin());
colorprint_change = true;
}
@@ -1903,6 +1908,7 @@ void GCode::process_layer(
if (!single_material_print && m600_before_extruder >= 0 && first_extruder_id != m600_before_extruder
// && !MMU1
) {
+ //! FIXME_in_fw show message during print pause
gcode += "M601\n"; // pause print
gcode += "M117 Change filament for Extruder " + std::to_string(m600_before_extruder) + "\n";
}
@@ -1915,6 +1921,9 @@ void GCode::process_layer(
{
// add tag for analyzer
gcode += "; " + GCodeAnalyzer::Pause_Print_Tag + "\n";
+ //! FIXME_in_fw show message during print pause
+ if (!pause_print_msg.empty())
+ gcode += "M117 " + pause_print_msg + "\n";
// add tag for time estimator
//gcode += "; " + GCodeTimeEstimator::Pause_Print_Tag + "\n";
}
diff --git a/src/libslic3r/Model.hpp b/src/libslic3r/Model.hpp
index 21b5896e0..c2942a4ea 100644
--- a/src/libslic3r/Model.hpp
+++ b/src/libslic3r/Model.hpp
@@ -772,7 +772,8 @@ public:
std::string gcode;
int extruder; // 0 - "gcode" will be applied for whole print
// else - "gcode" will be applied only for "extruder" print
- std::string color;
+ std::string color; // if gcode is equal to PausePrintCode,
+ // this field is used for save a short message shown on Printer display
};
std::vector custom_gcode_per_height;
diff --git a/src/slic3r/GUI/wxExtensions.cpp b/src/slic3r/GUI/wxExtensions.cpp
index 532eaa551..720f2a8d7 100644
--- a/src/slic3r/GUI/wxExtensions.cpp
+++ b/src/slic3r/GUI/wxExtensions.cpp
@@ -27,6 +27,7 @@
#include "../Utils/MacDarkMode.hpp"
using Slic3r::GUI::from_u8;
+using Slic3r::GUI::into_u8;
wxDEFINE_EVENT(wxCUSTOMEVT_TICKSCHANGED, wxEvent);
wxDEFINE_EVENT(wxCUSTOMEVT_LAST_VOLUME_IS_DELETED, wxCommandEvent);
@@ -2321,6 +2322,7 @@ DoubleSlider::DoubleSlider( wxWindow *parent,
m_cog_icon_dim = int((float)m_bmp_cog.bmp().GetSize().x / scale_factor);
m_selection = ssUndef;
+ m_pause_print_msg = _utf8(L("Place bearings in slots and resume"));
// slider events
Bind(wxEVT_PAINT, &DoubleSlider::OnPaint, this);
@@ -2795,7 +2797,7 @@ void DoubleSlider::draw_ticks(wxDC& dc)
// Draw icon for "Pause print" or "Custom Gcode"
if (tick.gcode != Slic3r::ColorChangeCode && tick.gcode != Slic3r::ExtruderChangeCode)
{
- wxBitmap icon = create_scaled_bitmap(nullptr, tick.gcode == Slic3r::PausePrintCode ? "pause_add.png" : "add_gcode");
+ wxBitmap icon = create_scaled_bitmap(nullptr, tick.gcode == Slic3r::PausePrintCode ? "pause_print" : "edit_gcode");
wxCoord x_draw, y_draw;
is_horizontal() ? x_draw = pos - 0.5 * m_tick_icon_dim : y_draw = pos - 0.5 * m_tick_icon_dim;
@@ -3084,19 +3086,17 @@ wxString DoubleSlider::get_tooltip(IconFocus icon_focus)
{
const int tick = m_selection == ssLower ? m_lower_value : m_higher_value;
const auto tick_code_it = m_ticks_.find(tick);
- tooltip = tick_code_it == m_ticks_.end() ? (m_state == msSingleExtruder ? //_(L("Add color change")) :
+ tooltip = tick_code_it == m_ticks_.end() ? (m_state == msSingleExtruder ?
_(L("For add color change use left mouse button click")) :
_(L("For add change extruder use left mouse button click"))) + "\n" +
_(L("For add another code use right mouse button click")) :
- // tick_code_it->gcode == Slic3r::ColorChangeCode ? _(L("Delete color change")) :
- tick_code_it->gcode == Slic3r::ColorChangeCode ? ( m_state == msSingleExtruder ? //_(L("Delete color change")) :
+ tick_code_it->gcode == Slic3r::ColorChangeCode ? ( m_state == msSingleExtruder ?
_(L("For Delete color change use left mouse button click\n"
"For Edit color use right mouse button click")) :
from_u8((boost::format(_utf8(L("Delete color change for Extruder %1%"))) % tick_code_it->extruder).str()) ):
- tick_code_it->gcode == Slic3r::PausePrintCode ? _(L("Delete pause")) :
- tick_code_it->gcode == Slic3r::ExtruderChangeCode ? //( m_state == msSingleExtruder ? _(L("Delete color change")) :
- from_u8((boost::format(_utf8(L("Delete extruder change to \"%1%\""))) % tick_code_it->extruder).str()) /*) */:
- // from_u8((boost::format(_utf8(L("Delete \"%1%\" code"))) % tick_code_it->gcode).str());
+// tick_code_it->gcode == Slic3r::PausePrintCode ? _(L("Delete pause")) :
+ tick_code_it->gcode == Slic3r::ExtruderChangeCode ?
+ from_u8((boost::format(_utf8(L("Delete extruder change to \"%1%\""))) % tick_code_it->extruder).str()) :
from_u8((boost::format(_utf8(L("For Delete \"%1%\" code use left mouse button click\n"
"For Edit \"%1%\" code use right mouse button click"))) % tick_code_it->gcode ).str());
}
@@ -3373,7 +3373,7 @@ void DoubleSlider::OnRightDown(wxMouseEvent& event)
m_show_context_menu = true;
return;
}
- if (it->gcode != Slic3r::ExtruderChangeCode && it->gcode != Slic3r::PausePrintCode)
+ if (it->gcode != Slic3r::ExtruderChangeCode)
{
// show "Edit" and "Delete" menu on OnRightUp()
m_show_edit_menu = true;
@@ -3459,10 +3459,10 @@ void DoubleSlider::OnRightUp(wxMouseEvent& event)
if (m_state != msMultiExtruder)
append_menu_item(&menu, wxID_ANY, _(L("Add pause print")) + " (M601)", "",
- [this](wxCommandEvent&) { add_code(Slic3r::PausePrintCode); }, "pause_add.png", &menu);
+ [this](wxCommandEvent&) { add_code(Slic3r::PausePrintCode); }, "pause_print", &menu);
append_menu_item(&menu, wxID_ANY, _(L("Add custom G-code")), "",
- [this](wxCommandEvent&) { add_code(""); }, "add_gcode", &menu);
+ [this](wxCommandEvent&) { add_code(""); }, "edit_gcode", &menu);
Slic3r::GUI::wxGetApp().plater()->PopupMenu(&menu);
@@ -3474,10 +3474,14 @@ void DoubleSlider::OnRightUp(wxMouseEvent& event)
std::set::iterator it = m_ticks_.find(m_selection == ssLower ? m_lower_value : m_higher_value);
const bool is_color_change = it->gcode == Slic3r::ColorChangeCode;
- append_menu_item(&menu, wxID_ANY, is_color_change ? _(L("Edit color")) : _(L("Edit custom G-code")), "",
- [this](wxCommandEvent&) { edit_tick(); }, "change_extruder", &menu);
+ append_menu_item(&menu, wxID_ANY, it->gcode == Slic3r::ColorChangeCode ? _(L("Edit color")) :
+ it->gcode == Slic3r::PausePrintCode ? _(L("Edit pause print message")) :
+ _(L("Edit custom G-code")), "",
+ [this](wxCommandEvent&) { edit_tick(); }, "edit_uni", &menu);
- append_menu_item(&menu, wxID_ANY, it->gcode == Slic3r::ColorChangeCode ? _(L("Delete color change")) : _(L("Delete custom G-code")), "",
+ append_menu_item(&menu, wxID_ANY, it->gcode == Slic3r::ColorChangeCode ? _(L("Delete color change")) :
+ it->gcode == Slic3r::PausePrintCode ? _(L("Delete pause print")) :
+ _(L("Delete custom G-code")), "",
[this](wxCommandEvent&) { action_tick(taDel); }, "colorchange_delete_off.png", &menu);
Slic3r::GUI::wxGetApp().plater()->PopupMenu(&menu);
@@ -3521,6 +3525,20 @@ static std::string get_custom_code(const std::string& code_in, double height)
return dlg.GetValue().ToStdString();
}
+static std::string get_pause_print_msg(const std::string& msg_in, double height)
+{
+ wxString msg_text = from_u8(_utf8(L("Enter short message shown on Printer display during pause print"))) + " :";
+ wxString msg_header = from_u8((boost::format(_utf8(L("Message for pause print on current layer (%1% mm)."))) % height).str());
+
+ // get custom gcode
+ wxTextEntryDialog dlg(nullptr, msg_text, msg_header, from_u8(msg_in),
+ wxTextEntryDialogStyle);
+ if (dlg.ShowModal() != wxID_OK || dlg.GetValue().IsEmpty())
+ return "";
+
+ return into_u8(dlg.GetValue());
+}
+
void DoubleSlider::add_code(std::string code, int selected_extruder/* = -1*/)
{
const int tick = m_selection == ssLower ? m_lower_value : m_higher_value;
@@ -3553,6 +3571,13 @@ void DoubleSlider::add_code(std::string code, int selected_extruder/* = -1*/)
if (color.empty())
return;
}
+ else if (code == Slic3r::PausePrintCode)
+ {
+ /* PausePrintCode doesn't need a color, so
+ * this field is used for save a short message shown on Printer display
+ * */
+ m_pause_print_msg = color = get_pause_print_msg(m_pause_print_msg, m_values[tick]);
+ }
else if (code.empty())
{
m_custom_gcode = code = get_custom_code(m_custom_gcode, m_values[tick]);
@@ -3586,6 +3611,8 @@ void DoubleSlider::edit_tick()
std::string edited_value;
if (it->gcode == Slic3r::ColorChangeCode)
edited_value = get_new_color(it->color);
+ else if (it->gcode == Slic3r::PausePrintCode)
+ edited_value = get_pause_print_msg(it->color, m_values[it->tick]);
else
edited_value = get_custom_code(it->gcode, m_values[it->tick]);
@@ -3593,7 +3620,7 @@ void DoubleSlider::edit_tick()
return;
TICK_CODE changed_tick = *it;
- if (it->gcode == Slic3r::ColorChangeCode) {
+ if (it->gcode == Slic3r::ColorChangeCode || it->gcode == Slic3r::PausePrintCode) {
if (it->color == edited_value)
return;
changed_tick.color = edited_value;
diff --git a/src/slic3r/GUI/wxExtensions.hpp b/src/slic3r/GUI/wxExtensions.hpp
index 612cd6236..c1bf82821 100644
--- a/src/slic3r/GUI/wxExtensions.hpp
+++ b/src/slic3r/GUI/wxExtensions.hpp
@@ -927,6 +927,7 @@ private:
bool m_suppress_add_code = false;
ManipulationState m_state = msSingleExtruder;
std::string m_custom_gcode = "";
+ std::string m_pause_print_msg;
int m_current_extruder = -1;
wxRect m_rect_lower_thumb;