GCodeViewer -> Refactoring and code cleanup

This commit is contained in:
enricoturri1966 2020-04-23 15:12:40 +02:00
parent 6e2307f56d
commit 66964c44c1
8 changed files with 26 additions and 77 deletions
src/libslic3r/GCode

View file

@ -24,9 +24,6 @@ const std::string GCodeProcessor::Mm3_Per_Mm_Tag = "_PROCESSOR_MM3_PER_MM:";
const std::string GCodeProcessor::Color_Change_Tag = "_PROCESSOR_COLOR_CHANGE";
const std::string GCodeProcessor::Pause_Print_Tag = "_PROCESSOR_PAUSE_PRINT";
const std::string GCodeProcessor::Custom_Code_Tag = "_PROCESSOR_CUSTOM_CODE";
#if !ENABLE_GCODE_VIEWER_SEPARATE_PAUSE_PRINT
const std::string GCodeProcessor::End_Pause_Print_Or_Custom_Code_Tag = "_PROCESSOR_END_PAUSE_PRINT_OR_CUSTOM_CODE";
#endif // !ENABLE_GCODE_VIEWER_SEPARATE_PAUSE_PRINT
void GCodeProcessor::CachedPosition::reset()
{
@ -248,9 +245,7 @@ void GCodeProcessor::process_tags(const std::string& comment)
if (m_extruder_id == extruder_id)
{
m_cp_color.current = m_extruders_color[extruder_id];
#if ENABLE_GCODE_VIEWER_SEPARATE_PAUSE_PRINT
store_move_vertex(EMoveType::Color_change);
#endif // ENABLE_GCODE_VIEWER_SEPARATE_PAUSE_PRINT
}
}
catch (...)
@ -265,11 +260,7 @@ void GCodeProcessor::process_tags(const std::string& comment)
pos = comment.find(Pause_Print_Tag);
if (pos != comment.npos)
{
#if ENABLE_GCODE_VIEWER_SEPARATE_PAUSE_PRINT
store_move_vertex(EMoveType::Pause_Print);
#else
m_cp_color.current = UCHAR_MAX;
#endif // ENABLE_GCODE_VIEWER_SEPARATE_PAUSE_PRINT
return;
}
@ -277,25 +268,9 @@ void GCodeProcessor::process_tags(const std::string& comment)
pos = comment.find(Custom_Code_Tag);
if (pos != comment.npos)
{
#if ENABLE_GCODE_VIEWER_SEPARATE_PAUSE_PRINT
store_move_vertex(EMoveType::Custom_GCode);
#else
m_cp_color.current = UCHAR_MAX;
#endif // ENABLE_GCODE_VIEWER_SEPARATE_PAUSE_PRINT
return;
}
#if !ENABLE_GCODE_VIEWER_SEPARATE_PAUSE_PRINT
// end pause print or custom code tag
pos = comment.find(End_Pause_Print_Or_Custom_Code_Tag);
if (pos != comment.npos)
{
if (m_cp_color.current == UCHAR_MAX)
m_cp_color.current = m_extruders_color[m_extruder_id];
return;
}
#endif // !ENABLE_GCODE_VIEWER_SEPARATE_PAUSE_PRINT
}
void GCodeProcessor::process_G1(const GCodeReader::GCodeLine& line)
@ -588,10 +563,7 @@ void GCodeProcessor::process_T(const std::string& command)
else
{
m_extruder_id = id;
#if !ENABLE_GCODE_VIEWER_SEPARATE_PAUSE_PRINT
if (m_cp_color.current != UCHAR_MAX)
#endif // !ENABLE_GCODE_VIEWER_SEPARATE_PAUSE_PRINT
m_cp_color.current = m_extruders_color[id];
m_cp_color.current = m_extruders_color[id];
}
// store tool change move