Fix some bugs

This commit is contained in:
sunsets
2024-01-03 15:39:59 +08:00
parent c6f7bed17e
commit 8a3b753bb1
7 changed files with 50 additions and 40 deletions

View File

@@ -385,17 +385,11 @@ std::string AppConfig::load(const std::string &path)
//B7
// if (ini_ver) {
// m_orig_version = *ini_ver;
if (ini_ver) {
m_orig_version = *ini_ver;
// // Make 1.40.0 alphas compare well
// ini_ver->set_metadata(boost::none);
// ini_ver->set_prerelease(boost::none);
// m_legacy_datadir = ini_ver < Semver(1, 40, 0);
// }
ini_ver->set_metadata(boost::none);
ini_ver->set_prerelease(boost::none);
m_legacy_datadir = ini_ver < Semver(1, 40, 0);
}
// Legacy conversion
if (m_mode == EAppMode::Editor) {

View File

@@ -1329,12 +1329,12 @@ void GCodeGenerator::_do_export(Print& print, GCodeOutputStream &file, Thumbnail
// Write end commands to file.
file.write(this->retract_and_wipe());
////B38
//{
// std::string gcode;
// m_writer.add_object_change_labels(gcode);
// file.write(gcode);
//}
//B38 //B46
{
std::string gcode;
m_writer.add_object_change_labels(gcode);
file.write(gcode);
}
file.write(m_writer.set_fan(0));
@@ -2374,24 +2374,25 @@ void GCodeGenerator::process_layer_single_object(
m_avoid_crossing_perimeters.use_external_mp_once();
m_last_obj_copy = this_object_copy;
this->set_origin(unscale(offset));
// gcode += m_label_objects.start_object(print_instance.print_object.instances()[print_instance.instance_id],
// GCode::LabelObjects::IncludeName::No);
if ((this->config().gcode_label_objects) != LabelObjectsStyle::Disabled ) {
for (const PrintObject *po : print_object.print()->objects())
if (po == &print_object)
break;
else
++ object_id;
//B38 //B41
if (this->config().gcode_flavor == gcfKlipper) {
//B38 //B41 //B46
const LabelData &label = m_label_data.at(&print_instance.print_object.instances()[print_instance.instance_id]);
if ((this->config().gcode_label_objects) == LabelObjectsStyle::Octoprint)
gcode += std::string("; printing object ") + label.name + "\n";
else if ((this->config().gcode_label_objects) == LabelObjectsStyle::Firmware) {
if (this->config().gcode_flavor == gcfKlipper) {
m_writer.set_object_start_str(std::string("EXCLUDE_OBJECT_START NAME=") + label.name + "\n");
} else if (this->config().gcode_flavor == gcfMarlinFirmware || this->config().gcode_flavor == gcfMarlinLegacy ||
this->config().gcode_flavor == gcfRepRapFirmware) {
const LabelData &label = m_label_data.at(&print_instance.print_object.instances()[print_instance.instance_id]);
gcode += std::string("M486 S") + std::to_string(label.unique_id) + "\n";
}
else {
const LabelData &label = m_label_data.at(&print_instance.print_object.instances()[print_instance.instance_id]);
gcode += std::string("; printing object ") + label.name + "\n";
}
}
}
@@ -2573,21 +2574,22 @@ void GCodeGenerator::process_layer_single_object(
}
if (!first && ((this->config().gcode_label_objects) != LabelObjectsStyle::Disabled)) {
//B38 //B41
//B38 //B41 //B46
const LabelData &label = m_label_data.at(&print_instance.print_object.instances()[print_instance.instance_id]);
if ((this->config().gcode_label_objects) == LabelObjectsStyle::Octoprint)
gcode += std::string("; stop printing object ") + label.name + "\n";
else if ((this->config().gcode_label_objects) == LabelObjectsStyle::Firmware) {
if (this->config().gcode_flavor == gcfKlipper) {
if (!m_writer.is_object_start_str_empty()) {
m_writer.set_object_start_str("");
} else {
const LabelData &label = m_label_data.at(&print_instance.print_object.instances()[print_instance.instance_id]);
m_writer.set_object_end_str(std::string("EXCLUDE_OBJECT_END NAME=") + label.name + "\n");
}
} else if (this->config().gcode_flavor == gcfMarlinFirmware || this->config().gcode_flavor == gcfMarlinLegacy ||
this->config().gcode_flavor == gcfRepRapFirmware) {
gcode += std::string("M486 S-1\n");
}
else {
const LabelData &label = m_label_data.at(&print_instance.print_object.instances()[print_instance.instance_id]);
gcode += std::string("; stop printing object ") + label.name + "\n";
}
}
@@ -2723,8 +2725,6 @@ std::optional<std::string> GCodeGenerator::get_helical_layer_change_gcode(
if (!this->last_pos_defined()) {
return std::nullopt;
}
//B38
//m_writer.add_object_change_labels(gcode);
const double circle_radius{2};
const unsigned n_gon_points_count{16};
@@ -2781,6 +2781,8 @@ std::string GCodeGenerator::change_layer(
const std::string comment{"move to next layer (" + std::to_string(m_layer_index) + ")"};
//B38 //B46
m_writer.add_object_change_labels(gcode);
bool do_helical_layer_change{
!spiral_vase_enabled
&& print_z > previous_layer_z
@@ -3080,7 +3082,8 @@ std::string GCodeGenerator::_extrude(
gcode += this->travel_to(path.front().point, path_attr.role, comment);
}
//B38
//B38 //B46
m_writer.add_object_change_labels(gcode);
// compensate retraction
gcode += this->unretract();
@@ -3661,6 +3664,8 @@ std::string GCodeGenerator::travel_to(const Point &point, ExtrusionRole role, st
m_wipe.reset_path();
}
//B38 //B46
m_writer.add_object_change_labels(wipe_retract_gcode);
this->m_avoid_crossing_perimeters.reset_once_modifiers();
const unsigned extruder_id = this->m_writer.extruder()->id();

View File

@@ -1643,7 +1643,7 @@ PageReloadFromDisk::PageReloadFromDisk(ConfigWizard* parent)
PageFilesAssociation::PageFilesAssociation(ConfigWizard* parent)
: ConfigWizardPage(parent, _L("Files association"), _L("Files association"))
{
//Y
//Y //B47
cb_3mf = new wxCheckBox(this, wxID_ANY, _L("Associate .3mf files to QIDISlicer"));
cb_stl = new wxCheckBox(this, wxID_ANY, _L("Associate .stl files to QIDISlicer"));
cb_step = new wxCheckBox(this, wxID_ANY, _L("Associate .step/.stp files to QIDISlicer"));
@@ -1651,6 +1651,7 @@ PageFilesAssociation::PageFilesAssociation(ConfigWizard* parent)
append(cb_3mf);
append(cb_stl);
append(cb_step);
// append(cb_gcode);
}
#endif // _WIN32

View File

@@ -7862,6 +7862,7 @@ void GLCanvas3D::GizmoHighlighter::blink()
invalidate();
}
//B48
#if ENABLE_BINARIZED_GCODE_DEBUG_WINDOW
void GLCanvas3D::show_binary_gcode_debug_window()
{
@@ -7875,7 +7876,7 @@ void GLCanvas3D::show_binary_gcode_debug_window()
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
imgui.text_colored(ImGuiWrapper::COL_ORANGE_LIGHT, "File metadata compression");
imgui.text_colored(ImGuiWrapper::COL_BLUE_LIGHT, "File metadata compression");
ImGui::TableSetColumnIndex(1);
std::vector<std::string> options = { "None", "Deflate", "heatshrink 11,4", "heatshrink 12,4" };
int option_id = (int)binarizer_config.compression.file_metadata;
@@ -7884,7 +7885,7 @@ void GLCanvas3D::show_binary_gcode_debug_window()
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
imgui.text_colored(ImGuiWrapper::COL_ORANGE_LIGHT, "Printer metadata compression");
imgui.text_colored(ImGuiWrapper::COL_BLUE_LIGHT, "Printer metadata compression");
ImGui::TableSetColumnIndex(1);
option_id = (int)binarizer_config.compression.printer_metadata;
if (imgui.combo(std::string("##printer_metadata_compression"), options, option_id, ImGuiComboFlags_HeightLargest, 0.0f, 175.0f))
@@ -7892,7 +7893,7 @@ void GLCanvas3D::show_binary_gcode_debug_window()
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
imgui.text_colored(ImGuiWrapper::COL_ORANGE_LIGHT, "Print metadata compression");
imgui.text_colored(ImGuiWrapper::COL_BLUE_LIGHT, "Print metadata compression");
ImGui::TableSetColumnIndex(1);
option_id = (int)binarizer_config.compression.print_metadata;
if (imgui.combo(std::string("##print_metadata_compression"), options, option_id, ImGuiComboFlags_HeightLargest, 0.0f, 175.0f))
@@ -7900,7 +7901,7 @@ void GLCanvas3D::show_binary_gcode_debug_window()
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
imgui.text_colored(ImGuiWrapper::COL_ORANGE_LIGHT, "Slicer metadata compression");
imgui.text_colored(ImGuiWrapper::COL_BLUE_LIGHT, "Slicer metadata compression");
ImGui::TableSetColumnIndex(1);
option_id = (int)binarizer_config.compression.slicer_metadata;
if (imgui.combo(std::string("##slicer_metadata_compression"), options, option_id, ImGuiComboFlags_HeightLargest, 0.0f, 175.0f))
@@ -7908,7 +7909,7 @@ void GLCanvas3D::show_binary_gcode_debug_window()
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
imgui.text_colored(ImGuiWrapper::COL_ORANGE_LIGHT, "GCode compression");
imgui.text_colored(ImGuiWrapper::COL_BLUE_LIGHT, "GCode compression");
ImGui::TableSetColumnIndex(1);
option_id = (int)binarizer_config.compression.gcode;
if (imgui.combo(std::string("##gcode_compression"), options, option_id, ImGuiComboFlags_HeightLargest, 0.0f, 175.0f))
@@ -7916,7 +7917,7 @@ void GLCanvas3D::show_binary_gcode_debug_window()
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
imgui.text_colored(ImGuiWrapper::COL_ORANGE_LIGHT, "GCode encoding");
imgui.text_colored(ImGuiWrapper::COL_BLUE_LIGHT, "GCode encoding");
ImGui::TableSetColumnIndex(1);
options = { "None", "MeatPack", "MeatPack Comments" };
option_id = (int)binarizer_config.gcode_encoding;
@@ -7925,7 +7926,7 @@ void GLCanvas3D::show_binary_gcode_debug_window()
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
imgui.text_colored(ImGuiWrapper::COL_ORANGE_LIGHT, "Metadata encoding");
imgui.text_colored(ImGuiWrapper::COL_BLUE_LIGHT, "Metadata encoding");
ImGui::TableSetColumnIndex(1);
options = { "INI" };
option_id = (int)binarizer_config.metadata_encoding;
@@ -7934,7 +7935,7 @@ void GLCanvas3D::show_binary_gcode_debug_window()
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
imgui.text_colored(ImGuiWrapper::COL_ORANGE_LIGHT, "Checksum type");
imgui.text_colored(ImGuiWrapper::COL_BLUE_LIGHT, "Checksum type");
ImGui::TableSetColumnIndex(1);
options = { "None", "CRC32" };
option_id = (int)binarizer_config.checksum;

View File

@@ -70,8 +70,9 @@ MsgDialog::MsgDialog(wxWindow *parent, const wxString &title, const wxString &he
main_sizer->Add(topsizer, 1, wxEXPAND);
main_sizer->Add(new StaticLine(this), 0, wxEXPAND | wxLEFT | wxRIGHT, HORIZ_SPACING);
main_sizer->Add(btn_sizer, 0, wxALL | wxEXPAND, VERT_SPACING);
if (style & wxOK)
add_button(wxID_OK, true);
//B50
// if (style & wxOK)
// add_button(wxID_OK, true);
if (title != "App Update available") {
apply_style(style);
}

View File

@@ -387,11 +387,14 @@ void SpinInput::onTextLostFocus(wxEvent &event)
event.Skip();
}
//B49
void SpinInput::onTextEnter(wxCommandEvent &event)
{
long value;
if (!text_ctrl->GetValue().ToLong(&value))
if (!text_ctrl->GetValue().ToLong(&value)) {
value = val;
text_ctrl->SetValue(wxString::FromDouble(value));
}
if (value != val) {
SetValue(value);
@@ -584,12 +587,16 @@ void SpinInputDouble::onTextLostFocus(wxEvent &event)
event.Skip();
}
//B49
void SpinInputDouble::onTextEnter(wxCommandEvent &event)
{
double value;
if (!text_ctrl->GetValue().ToDouble(&value))
if (!text_ctrl->GetValue().ToDouble(&value)) {
val = value;
wxString str_val = wxString::FromDouble(value, digits);
text_ctrl->SetValue(str_val);
}
if (!Slic3r::is_approx(value, val)) {
SetValue(value);
sendSpinEvent();

View File

@@ -1,8 +1,9 @@
#ifndef slic3r_UI_Colors_hpp_
#define slic3r_UI_Colors_hpp_
//B48
static const int clr_border_normal = 0x646464;//0xDBDBDB;
static const int clr_border_hovered = 0xED6B21;//0x00AE42;
static const int clr_border_hovered = 0x4479FB;//0x00AE42;
static const int clr_border_disabled = 0x646464;//0xDBDBDB;
static const int clr_background_normal_light = 0xFFFFFF;