Fix "grey" machine limits field for export.

supermerill/SuperSlicer#1960
This commit is contained in:
supermerill 2021-12-06 19:47:06 +01:00
parent ed3edaadf2
commit daae6832a1

View File

@ -4033,49 +4033,77 @@ void TabPrinter::update_machine_limits_description(const MachineLimitsUsage usag
//update fields used
//no need to worry for "silent" version, as it's only for marlin.
if (usage == MachineLimitsUsage::EmitToGCode) {
wxColour greay_color(128, 128, 128);
wxColour grey_color(128, 128, 128);
wxColour black_color = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
Field* field;
std::vector<std::string> axes{ "x", "y", "z", "e" };
if (std::set<uint8_t>{gcfKlipper, gcfMach3, gcfMachinekit, gcfMakerWare, gcfSailfish, gcfTeacup}.count(flavor) > 0)
wxColour color = (std::set<uint8_t>{gcfKlipper, gcfMach3, gcfMachinekit, gcfMakerWare, gcfSailfish, gcfTeacup}.count(flavor) > 0) ? grey_color : black_color;
for (const std::string& axis : axes) {
field = m_active_page->get_field("machine_max_feedrate_" + axis, 0);
if (field) dynamic_cast<wxTextCtrl*>(field->getWindow())->SetForegroundColour(greay_color);
if (field) dynamic_cast<wxTextCtrl*>(field->getWindow())->SetForegroundColour(color);
}
if (std::set<uint8_t>{gcfKlipper, gcfSmoothie, gcfMach3, gcfMachinekit, gcfMakerWare, gcfSailfish, gcfTeacup}.count(flavor) > 0)
color = (std::set<uint8_t>{gcfKlipper, gcfSmoothie, gcfMach3, gcfMachinekit, gcfMakerWare, gcfSailfish, gcfTeacup}.count(flavor) > 0) ? grey_color : black_color;
for (const std::string& axis : axes) {
field = m_active_page->get_field("machine_max_acceleration_" + axis, 0);
if (field) dynamic_cast<wxTextCtrl*>(field->getWindow())->SetForegroundColour(greay_color);
if (field) dynamic_cast<wxTextCtrl*>(field->getWindow())->SetForegroundColour(color);
}
if (std::set<uint8_t>{gcfSmoothie, gcfMach3, gcfMachinekit, gcfMakerWare, gcfSailfish, gcfTeacup}.count(flavor) > 0)
color = (std::set<uint8_t>{gcfSmoothie, gcfMach3, gcfMachinekit, gcfMakerWare, gcfSailfish, gcfTeacup}.count(flavor) > 0) ? grey_color : black_color;
{
field = m_active_page->get_field("machine_max_acceleration_extruding", 0);
if (field) dynamic_cast<wxTextCtrl*>(field->getWindow())->SetForegroundColour(greay_color);
if (field) dynamic_cast<wxTextCtrl*>(field->getWindow())->SetForegroundColour(color);
}
if (flavor != gcfMarlin)
color = (flavor != gcfMarlin) ? grey_color : black_color;
{
field = m_active_page->get_field("machine_max_acceleration_retracting", 0);
if (field) dynamic_cast<wxTextCtrl*>(field->getWindow())->SetForegroundColour(greay_color);
if (field) dynamic_cast<wxTextCtrl*>(field->getWindow())->SetForegroundColour(color);
}
if (std::set<uint8_t>{gcfSmoothie, gcfMach3, gcfMachinekit, gcfMakerWare, gcfSailfish, gcfTeacup}.count(flavor) > 0)
color = (std::set<uint8_t>{gcfSmoothie, gcfMach3, gcfMachinekit, gcfMakerWare, gcfSailfish, gcfTeacup}.count(flavor) > 0) ? grey_color : black_color;
{
field = m_active_page->get_field("machine_max_acceleration_travel", 0);
if (field) dynamic_cast<wxTextCtrl*>(field->getWindow())->SetForegroundColour(greay_color);
if (field) dynamic_cast<wxTextCtrl*>(field->getWindow())->SetForegroundColour(color);
}
if (std::set<uint8_t>{gcfKlipper, gcfMach3, gcfMachinekit, gcfMakerWare, gcfSailfish, gcfTeacup}.count(flavor) > 0)
color = (std::set<uint8_t>{gcfKlipper, gcfMach3, gcfMachinekit, gcfMakerWare, gcfSailfish, gcfTeacup}.count(flavor) > 0) ? grey_color : black_color;
for (const std::string& axis : axes) {
field = m_active_page->get_field("machine_max_jerk_" + axis, 0);
if (field) dynamic_cast<wxTextCtrl*>(field->getWindow())->SetForegroundColour(greay_color);
if (field) dynamic_cast<wxTextCtrl*>(field->getWindow())->SetForegroundColour(color);
}
if (flavor != gcfMarlin && flavor != gcfRepRap)
color = (flavor != gcfMarlin && flavor != gcfRepRap) ? grey_color : black_color;
{
field = m_active_page->get_field("machine_min_extruding_rate", 0);
if (field) dynamic_cast<wxTextCtrl*>(field->getWindow())->SetForegroundColour(greay_color);
if (field) dynamic_cast<wxTextCtrl*>(field->getWindow())->SetForegroundColour(color);
}
if (flavor != gcfMarlin)
color = (flavor != gcfMarlin) ? grey_color : black_color;
{
field = m_active_page->get_field("machine_min_travel_rate", 0);
if (field) dynamic_cast<wxTextCtrl*>(field->getWindow())->SetForegroundColour(greay_color);
if (field) dynamic_cast<wxTextCtrl*>(field->getWindow())->SetForegroundColour(color);
}
} else {
Field* field;
std::vector<std::string> axes{ "x", "y", "z", "e" };
const wxColour color = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
for (const std::string& axis : axes) {
field = m_active_page->get_field("machine_max_feedrate_" + axis, 0);
if (field) dynamic_cast<wxTextCtrl*>(field->getWindow())->SetForegroundColour(color);
}
for (const std::string& axis : axes) {
field = m_active_page->get_field("machine_max_acceleration_" + axis, 0);
if (field) dynamic_cast<wxTextCtrl*>(field->getWindow())->SetForegroundColour(color);
}
field = m_active_page->get_field("machine_max_acceleration_extruding", 0);
if (field) dynamic_cast<wxTextCtrl*>(field->getWindow())->SetForegroundColour(color);
field = m_active_page->get_field("machine_max_acceleration_retracting", 0);
if (field) dynamic_cast<wxTextCtrl*>(field->getWindow())->SetForegroundColour(color);
field = m_active_page->get_field("machine_max_acceleration_travel", 0);
if (field) dynamic_cast<wxTextCtrl*>(field->getWindow())->SetForegroundColour(color);
for (const std::string& axis : axes) {
field = m_active_page->get_field("machine_max_jerk_" + axis, 0);
if (field) dynamic_cast<wxTextCtrl*>(field->getWindow())->SetForegroundColour(color);
}
field = m_active_page->get_field("machine_min_extruding_rate", 0);
if (field) dynamic_cast<wxTextCtrl*>(field->getWindow())->SetForegroundColour(color);
field = m_active_page->get_field("machine_min_travel_rate", 0);
if (field) dynamic_cast<wxTextCtrl*>(field->getWindow())->SetForegroundColour(color);
}
}