bed exclude area, change thumbnails to PNG, printer webview
This commit is contained in:
QIDI TECH
2023-12-26 15:25:38 +08:00
parent 5079fb72f8
commit 8ef002af7e
17 changed files with 305 additions and 87 deletions

View File

@@ -205,6 +205,10 @@ void AppConfig::set_defaults()
if (get("sys_menu_enabled").empty())
set("sys_menu_enabled", "1");
//B45
if (get("machine_list_minification").empty())
set("machine_list_minification", "1");
#endif // _WIN32
// Remove legacy window positions/sizes

View File

@@ -1146,15 +1146,14 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
// Unit tests or command line slicing may not define "thumbnails" or "thumbnails_format".
// If "thumbnails_format" is not defined, export to PNG.
//B3
// if (const auto [thumbnails, thumbnails_format] = std::make_pair(
// print.full_print_config().option<ConfigOptionPoints>("thumbnails"),
// print.full_print_config().option<ConfigOptionEnum<GCodeThumbnailsFormat>>("thumbnails_format"));
// thumbnails)
// GCodeThumbnails::export_thumbnails_to_file(
// thumbnail_cb, thumbnails->values, thumbnails_format ? thumbnails_format->value : GCodeThumbnailsFormat::PNG,
// [&file](const char* sz) { file.write(sz); },
// [&print]() { print.throw_if_canceled(); });
if (const auto [thumbnails, thumbnails_format] = std::make_pair(
print.full_print_config().option<ConfigOptionPoints>("thumbnails"),
print.full_print_config().option<ConfigOptionEnum<GCodeThumbnailsFormat>>("thumbnails_format"));
thumbnails)
GCodeThumbnails::export_thumbnails_to_file(
thumbnail_cb, thumbnails->values, thumbnails_format ? thumbnails_format->value : GCodeThumbnailsFormat::PNG,
[&file](const char* sz) { file.write(sz); },
[&print]() { print.throw_if_canceled(); });
// Write notes (content of the Print Settings tab -> Notes)
{
@@ -1528,15 +1527,6 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
if (print.m_print_statistics.total_toolchanges > 0)
file.write_format("; total toolchanges = %i\n", print.m_print_statistics.total_toolchanges);
file.write_format(";%s\n", GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Estimated_Printing_Time_Placeholder).c_str());
//B3
if (const auto [thumbnails, thumbnails_format] = std::make_pair(
print.full_print_config().option<ConfigOptionPoints>("thumbnails"),
print.full_print_config().option<ConfigOptionEnum<GCodeThumbnailsFormat>>("thumbnails_format"));
thumbnails)
GCodeThumbnails::export_thumbnails_to_file(
thumbnail_cb, thumbnails->values, thumbnails_format ? thumbnails_format->value : GCodeThumbnailsFormat::PNG,
[&file](const char* sz) { file.write(sz); },
[&print]() { print.throw_if_canceled(); });
// Append full config, delimited by two 'phony' configuration keys qidislicer_config = begin and qidislicer_config = end.
// The delimiters are structured as configuration key / value pairs to be parsable by older versions of QIDISlicer G-code viewer.
{

View File

@@ -545,6 +545,8 @@ static std::vector<std::string> s_Preset_printer_options {
"default_print_profile", "inherits",
"remaining_times", "silent_mode",
"machine_limits_usage", "thumbnails", "thumbnails_format",
//Y18
"bed_exclude_area",
//Y16
"chamber_temperature", "auxiliary_fan", "chamber_fan"
};
@@ -1349,6 +1351,8 @@ static const std::set<std::string> independent_from_extruder_number_options = {
"gcode_substitutions",
"post_process",
"thumbnails",
//Y18
"bed_exclude_area",
};
bool PresetCollection::is_independent_from_extruder_number_option(const std::string& opt_key)

View File

@@ -60,6 +60,8 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n
"autoemit_temperature_commands",
"avoid_crossing_perimeters",
"avoid_crossing_perimeters_max_detour",
//Y18
"bed_exclude_area",
"bed_shape",
"bed_temperature",
"before_layer_gcode",

View File

@@ -259,6 +259,15 @@ void PrintConfigDef::init_common_params()
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionPoints{ Vec2d(0, 0), Vec2d(200, 0), Vec2d(200, 200), Vec2d(0, 200) });
//Y18
def = this->add("bed_exclude_area", coPoints);
def->label = L("Bed exclude area");
def->tooltip = L("Unprintable area in XY plane. For example, X1 Series printers use the front left corner to cut filament during filament change. "
"The area is expressed as polygon by points in following format: \"XxY, XxY, ...\"");
def->mode = comExpert;
def->gui_type = ConfigOptionDef::GUIType::one_string;
def->set_default_value(new ConfigOptionPoints{ Vec2d(0, 0) });
def = this->add("bed_custom_texture", coString);
def->label = L("Bed custom texture");
def->mode = comAdvanced;

View File

@@ -774,6 +774,8 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE(
((ConfigOptionBool, avoid_crossing_perimeters))
((ConfigOptionFloatOrPercent, avoid_crossing_perimeters_max_detour))
((ConfigOptionPoints, bed_shape))
//Y18
((ConfigOptionPoints, bed_exclude_area))
((ConfigOptionInts, bed_temperature))
//Y16
((ConfigOptionBool, chamber_temperature))

View File

@@ -374,10 +374,20 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true
if (x_str.ToDouble(&x) && thumbnail.HasMoreTokens()) {
wxString y_str = thumbnail.GetNextToken();
if (y_str.ToDouble(&y) && !thumbnail.HasMoreTokens()) {
if (0 < x && x < 1000 && 0 < y && y < 1000) {
out_values.push_back(Vec2d(x, y));
continue;
//Y18
if (m_opt_id == "bed_exclude_area") {
if (0 <= x && x <= 1000 && 0 <= y && y <= 1000) {
out_values.push_back(Vec2d(x, y));
continue;
}
}
else{
if (0 < x && x < 1000 && 0 < y && y < 1000) {
out_values.push_back(Vec2d(x, y));
continue;
}
}
out_of_range_val = true;
break;
}

View File

@@ -4895,7 +4895,8 @@ void GLCanvas3D::_render_thumbnail_internal(ThumbnailData& thumbnail_data, const
return;
if (thumbnail_params.transparent_background)
glsafe(::glClearColor(0.0f, 0.0f, 0.0f, 0.0f));
//Y18
glsafe(::glClearColor(1.0f, 1.0f, 1.0f, 1.0f));
glsafe(::glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));
glsafe(::glEnable(GL_DEPTH_TEST));

View File

@@ -203,7 +203,7 @@ void change_opt_value(DynamicPrintConfig& config, const t_config_option_key& opt
}
break;
case coPoints:{
if (opt_key == "bed_shape" || opt_key == "thumbnails") {
if (opt_key == "bed_shape" || opt_key == "bed_exclude_area" || opt_key == "thumbnails") {
config.option<ConfigOptionPoints>(opt_key)->values = boost::any_cast<std::vector<Vec2d>>(value);
break;
}

View File

@@ -2241,7 +2241,7 @@ void GLGizmoCut3D::render_shortcuts()
if (m_show_shortcuts)
for (const auto&shortcut : m_shortcuts ){
m_imgui->text_colored(ImGuiWrapper::COL_ORANGE_LIGHT, shortcut.first);
m_imgui->text_colored(ImGuiWrapper::COL_BLUE_LIGHT, shortcut.first);
ImGui::SameLine(m_shortcut_label_width);
m_imgui->text(shortcut.second);
}
@@ -2271,7 +2271,7 @@ void GLGizmoCut3D::render_connectors_input_window(CutConnectors &connectors)
// render_connect_mode_radio_button(CutConnectorMode::Manual);
ImGui::AlignTextToFramePadding();
m_imgui->text_colored(ImGuiWrapper::COL_ORANGE_LIGHT, m_labels_map["Connectors"]);
m_imgui->text_colored(ImGuiWrapper::COL_BLUE_LIGHT, m_labels_map["Connectors"]);
m_imgui->disabled_begin(connectors.empty());
ImGui::SameLine(m_label_width);
@@ -2359,7 +2359,7 @@ void GLGizmoCut3D::render_build_size()
ImGui::AlignTextToFramePadding();
m_imgui->text(_L("Build Volume"));
ImGui::SameLine();
m_imgui->text_colored(ImGuiWrapper::COL_ORANGE_LIGHT, size);
m_imgui->text_colored(ImGuiWrapper::COL_BLUE_LIGHT, size);
}
void GLGizmoCut3D::reset_cut_plane()
@@ -2623,7 +2623,7 @@ void GLGizmoCut3D::render_cut_plane_input_window(CutConnectors &connectors)
ImGui::AlignTextToFramePadding();
ImGuiWrapper::text(wxString(ImGui::InfoMarkerSmall));
ImGui::SameLine();
ImGuiWrapper::text_colored(ImGuiWrapper::COL_ORANGE_LIGHT,
ImGuiWrapper::text_colored(ImGuiWrapper::COL_BLUE_LIGHT,
get_wraped_wxString(_L("Hold SHIFT key to draw a cut line"), 40));
ImGui::Separator();
@@ -2675,7 +2675,7 @@ void GLGizmoCut3D::render_cut_plane_input_window(CutConnectors &connectors)
else if (mode == CutMode::cutTongueAndGroove) {
m_is_slider_editing_done = false;
ImGui::Separator();
ImGuiWrapper::text_colored(ImGuiWrapper::COL_ORANGE_LIGHT, m_labels_map["Groove"] + ": ");
ImGuiWrapper::text_colored(ImGuiWrapper::COL_BLUE_LIGHT, m_labels_map["Groove"] + ": ");
render_groove_float_input(m_labels_map["Depth"], m_groove.depth, m_groove.depth_init, m_groove.depth_tolerance);
render_groove_float_input(m_labels_map["Width"], m_groove.width, m_groove.width_init, m_groove.width_tolerance);
render_groove_angle_input(m_labels_map["Flap Angle"], m_groove.flaps_angle, m_groove.flaps_angle_init, 30.f, 120.f);

View File

@@ -251,6 +251,7 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S
return;
}
this->shutdown();
m_printer_view->StopAllThread();
// propagate event
event.Skip();
});
@@ -2178,7 +2179,13 @@ void MainFrame::select_tab(size_t tab/* = size_t(-1)*/)
Preset *preset = wxGetApp().preset_bundle->printers.find_preset(preset_name);
if (preset != nullptr) {
std::string model_id = preset->config.opt_string("printer_model");
std::string model_id;
if (preset != nullptr) {
if ((preset->config.opt_string("printer_model").empty()))
model_id = "X-MAX 3";
else
model_id = preset->config.opt_string("printer_model");
}
preset_data.push_back({wxString::FromUTF8(it->get_full_name(preset_name)).Lower(), wxString::FromUTF8(preset_name),
wxString::FromUTF8(it->get_full_name(preset_name)), ph_printers.is_selected(it, preset_name),

View File

@@ -946,6 +946,8 @@ boost::any ConfigOptionsGroup::get_config_value(const DynamicPrintConfig& config
case coPoints:
if (opt_key == "bed_shape")
ret = config.option<ConfigOptionPoints>(opt_key)->values;
else if (opt_key == "bed_exclude_area")
ret = get_thumbnails_string(config.option<ConfigOptionPoints>(opt_key)->values);
else if (opt_key == "thumbnails")
ret = get_thumbnails_string(config.option<ConfigOptionPoints>(opt_key)->values);
else

View File

@@ -5723,7 +5723,7 @@ void Plater::calib_pa_tower(const double StartPA, double EndPA, double PAStep)
// Change End Gcode
//new_config.set_key_value("seam_position", new ConfigOptionEnum(spRear));
//new_config.set_key_value("perimeter_generator", new ConfigOptionEnum(PerimeterGeneratorType::Classic));
pa_end_gcode = "M900 K{int(layer_z / 5) * " + double_to_str(PAStep) + "}\n" + pa_end_gcode;
pa_end_gcode = "M900 K{int(layer_z / 5) * " + double_to_str(PAStep) + " + " + double_to_str(StartPA) + "}\n" + pa_end_gcode;
new_config.set_key_value("before_layer_gcode", new ConfigOptionString(pa_end_gcode));
//tab_print->load_config(new_config);
tab_printer->load_config(new_config);

View File

@@ -28,20 +28,46 @@ wxBEGIN_EVENT_TABLE(MachineListButton, wxButton) EVT_PAINT(MachineListButton::On
wxEND_EVENT_TABLE()
//B45
void MachineListButton::OnPaint(wxPaintEvent &event)
{
wxPaintDC dc(this);
//m_bitmap = get_bmp_bundle("X-MAX 3_thumbnail", 80)->GetBitmapFor(this);
//w13
wxRect rect = GetClientRect();
dc.SetPen(wxPen(wxColour(30, 30, 32)));
if (mouseOnButton) {
//dc.SetPen(wxPen(wxColour(110, 110, 110)));
dc.SetBrush(wxBrush(wxColour(100, 100, 105)));
dc.DrawRoundedRectangle(rect, 5);
} else {
//dc.SetPen(wxPen(wxColour(110, 110, 110)));
dc.SetBrush(wxBrush(wxColour(67, 67, 71)));
dc.DrawRoundedRectangle(rect, 5);
}
if (m_isSelected) {
//dc.SetPen(wxPen(wxColour(110, 110, 110)));
dc.SetBrush(wxBrush(wxColour(100, 100, 105)));
dc.DrawRoundedRectangle(rect, 5);
}
if (mousePressed) {
dc.SetPen(wxPen(wxColour(110, 110, 110)));
dc.SetBrush(wxBrush(wxColour(109, 109, 113)));
dc.DrawRoundedRectangle(rect, 5);
}
if (m_isSimpleMode) {
dc.SetFont(wxFont(15, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD));
dc.SetTextForeground(wxColour(230, 230, 230));
dc.DrawText(m_name_text, 10 , 10);
//wxSize textSize = dc.GetTextExtent(m_name_text);
//int x = (dc.GetSize().GetWidth() - textSize.GetWidth()) / 2;
//int y = (dc.GetSize().GetHeight() - textSize.GetHeight()) / 2;
//dc.DrawText(m_name_text, x, y);
} else {
dc.DrawBitmap(m_bitmap, 10, (GetSize().GetHeight() - m_bitmap.GetHeight()) / 2, true);
@@ -71,28 +97,38 @@ void MachineListButton::OnPaint(wxPaintEvent &event)
void MachineListButton::OnMouseEnter(wxMouseEvent &event)
{
SetBackgroundColour(wxColour(100, 100, 105));
//w13
mouseOnButton = true;
//SetBackgroundColour(wxColour(100, 100, 105));
Refresh();
Update();
}
void MachineListButton::OnMouseLeave(wxMouseEvent &event)
{
if (m_isSelected)
//w13
mouseOnButton = false;
/* if (m_isSelected)
SetBackgroundColour(wxColour(100, 100, 105));
else
SetBackgroundColour(wxColour(67, 67, 71));
SetBackgroundColour(wxColour(100, 100, 105)); */
Refresh();
Update();
}
void MachineListButton::OnMouseLeftDown(wxMouseEvent &event)
{
SetBackgroundColour(wxColour(120, 120, 125));
//w13
mousePressed = true;
SetBackgroundColour(wxColour(30, 30, 32));
Refresh();
}
void MachineListButton::OnMouseLeftUp(wxMouseEvent &event)
{
SetBackgroundColour(wxColour(100, 100, 105));
//w13
mousePressed = false;
//SetBackgroundColour(wxColour(100, 100, 105));
if (m_handlerl) {
m_handlerl(event);
}
@@ -111,13 +147,18 @@ PrinterWebView::PrinterWebView(wxWindow *parent)
int leftsizerWidth = 210;
#endif
topsizer = new wxBoxSizer(wxHORIZONTAL);
leftScrolledWindow = new wxScrolledWindow(this, wxID_ANY);
leftScrolledWindow->SetBackgroundColour(wxColour(45, 45, 48));
leftScrolledWindow = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL | wxVSCROLL);
// leftScrolledWindow->ShowScrollbars(wxSHOW_SB_NEVER, wxSHOW_SB_NEVER);
leftScrolledWindow->SetBackgroundColour(wxColour(30, 30, 32));
leftsizer = new wxBoxSizer(wxVERTICAL);
wxFont font(wxFontInfo().Bold());
wxPanel *buttonPanel = new wxPanel(this, wxID_ANY);
buttonPanel->SetBackgroundColour(wxColour(30, 30, 32));
wxBoxSizer *buttonSizer = new wxBoxSizer(wxVERTICAL);
leftallsizer = new wxBoxSizer(wxVERTICAL);
wxBoxSizer *titlesizer = new wxBoxSizer(wxHORIZONTAL);
text_static = new wxStaticText(leftScrolledWindow, wxID_ANY, "MACHINE LIST", wxDefaultPosition, wxDefaultSize);
text_static = new wxStaticText(buttonPanel, wxID_ANY, "MACHINE LIST", wxDefaultPosition, wxDefaultSize);
text_static->SetForegroundColour(wxColour(255, 255, 255));
text_static->SetFont(wxFont(wxFontInfo(18).Bold()));
#if defined __linux__
@@ -129,51 +170,54 @@ PrinterWebView::PrinterWebView(wxWindow *parent)
titlesizer->AddStretchSpacer();
wxBoxSizer *buttonsizer = new wxBoxSizer(wxHORIZONTAL);
//wxBU_EXACTFIT wxBORDER_NONE
m_isSimpleMode = wxGetApp().app_config->get_bool("machine_list_minification");
buttonPanel->SetSizer(buttonSizer);
//w13
#if defined(__WIN32__) || defined(__WXMAC__)
wxButton *add_button = new wxButton(leftScrolledWindow, wxID_ANY, "", wxDefaultPosition, wxSize(20, 20), wxBORDER_NONE);
add_button->SetBackgroundColour(wxColour(100, 100, 105));
//add_button->SetForegroundColour(leftScrolledWindow->GetBackgroundColour());
MyRoundButton *add_button = new MyRoundButton(buttonPanel, wxID_ANY, "", "add_machine_list", wxDefaultPosition, wxSize(20, 20),
wxBORDER_NONE);
add_button->SetBackgroundColour(wxColour(30, 30, 32));
add_button->SetMinSize(wxSize(40, -1));
add_button->SetBitmap(*get_bmp_bundle("add_machine_list", 20));
buttonsizer->Add(add_button, wxSizerFlags().Align(wxALIGN_LEFT).CenterVertical().Border(wxALL, 2));
add_button->Bind(wxEVT_BUTTON, &PrinterWebView::OnAddButtonClick, this);
wxButton *delete_button = new wxButton(leftScrolledWindow, wxID_ANY, "", wxDefaultPosition, wxSize(20, 20), wxBORDER_NONE);
delete_button->SetBackgroundColour(wxColour(100, 100, 105));
//delete_button->SetForegroundColour(leftScrolledWindow->GetBackgroundColour());
MyRoundButton *delete_button = new MyRoundButton(buttonPanel, wxID_ANY, "", "delete_machine_list", wxDefaultPosition,
wxSize(20, 20), wxBORDER_NONE);
delete_button->SetBackgroundColour(wxColour(30, 30, 32));
delete_button->SetMinSize(wxSize(40, -1));
delete_button->SetBitmap(*get_bmp_bundle("delete_machine_list", 20));
buttonsizer->Add(delete_button, wxSizerFlags().Align(wxALIGN_LEFT).CenterVertical().Border(wxALL, 2));
delete_button->Bind(wxEVT_BUTTON, &PrinterWebView::OnDeleteButtonClick, this);
wxButton *edit_button = new wxButton(leftScrolledWindow, wxID_ANY, "", wxDefaultPosition, wxSize(20, 20), wxBORDER_NONE);
edit_button->SetBackgroundColour(wxColour(100, 100, 105));
//edit_button->SetForegroundColour(leftScrolledWindow->GetBackgroundColour());
MyRoundButton *edit_button = new MyRoundButton(buttonPanel, wxID_ANY, "", "edit_machine_list", wxDefaultPosition, wxSize(20, 20),
wxBORDER_NONE);
edit_button->SetBackgroundColour(wxColour(30, 30, 32));
edit_button->SetMinSize(wxSize(40, -1));
edit_button->SetBitmap(*get_bmp_bundle("edit_machine_list", 20));
buttonsizer->Add(edit_button, wxSizerFlags().Align(wxALIGN_LEFT).CenterVertical().Border(wxALL, 2));
edit_button->Bind(wxEVT_BUTTON, &PrinterWebView::OnEditButtonClick, this);
wxButton *refresh_button = new wxButton(leftScrolledWindow, wxID_ANY, "", wxDefaultPosition, wxSize(20, 20), wxBORDER_NONE);
refresh_button->SetBackgroundColour(wxColour(100, 100, 105));
//refresh_button->SetForegroundColour(leftScrolledWindow->GetBackgroundColour());
MyRoundButton *refresh_button = new MyRoundButton(buttonPanel, wxID_ANY, "", "refresh-line", wxDefaultPosition, wxSize(20, 20),
wxBORDER_NONE);
refresh_button->SetBackgroundColour(wxColour(30, 30, 32));
refresh_button->SetMinSize(wxSize(40, -1));
refresh_button->SetBitmap(*get_bmp_bundle("refresh-line", 20));
buttonsizer->Add(refresh_button, wxSizerFlags().Align(wxALIGN_LEFT).CenterVertical().Border(wxALL, 2));
refresh_button->Bind(wxEVT_BUTTON, &PrinterWebView::OnRightButtonClick, this);
arrow_button = new wxButton(leftScrolledWindow, wxID_ANY, "", wxDefaultPosition, wxSize(20, 20), wxBORDER_NONE);
arrow_button = new wxButton(buttonPanel, wxID_ANY, "", wxDefaultPosition, wxSize(20, 20), wxBORDER_NONE);
arrow_button->SetFont(font);
arrow_button->SetBackgroundColour(leftScrolledWindow->GetBackgroundColour());
arrow_button->SetForegroundColour(leftScrolledWindow->GetBackgroundColour());
arrow_button->SetBackgroundColour(buttonPanel->GetBackgroundColour());
arrow_button->SetForegroundColour(buttonPanel->GetBackgroundColour());
arrow_button->SetMinSize(wxSize(40, -1));
if (m_isSimpleMode)
arrow_button->SetBitmap(*get_bmp_bundle("arrow-right-s-line", 20));
else
arrow_button->SetBitmap(*get_bmp_bundle("arrow-left-s-line", 20));
titlesizer->Add(arrow_button, wxSizerFlags().Align(wxALIGN_LEFT).CenterVertical().Border(wxALL, 2));
arrow_button->Bind(wxEVT_BUTTON, &PrinterWebView::OnLeftButtonClick, this);
@@ -182,8 +226,13 @@ PrinterWebView::PrinterWebView(wxWindow *parent)
titlesizer->Layout();
buttonsizer->Layout();
leftsizer->Add(titlesizer, wxSizerFlags().Expand().Align(wxALIGN_TOP).Border(wxALL, 0));
leftsizer->Add(buttonsizer, wxSizerFlags().Expand().Align(wxALIGN_TOP).Border(wxALL, 0));
buttonSizer->Add(titlesizer, wxSizerFlags(0).Expand().Align(wxALIGN_TOP).Border(wxALL, 0));
buttonSizer->Add(buttonsizer, wxSizerFlags(1).Expand().Align(wxALIGN_TOP).Border(wxALL, 0));
buttonPanel->Layout();
leftsizer->SetMinSize(wxSize(300, -1));
//leftsizer->Add(titlesizer, wxSizerFlags().Expand().Align(wxALIGN_TOP).Border(wxALL, 0));
//leftsizer->Add(buttonsizer, wxSizerFlags().Expand().Align(wxALIGN_TOP).Border(wxALL, 0));
leftsizer->Layout();
leftScrolledWindow->SetSizer(leftsizer);
@@ -199,7 +248,10 @@ PrinterWebView::PrinterWebView(wxWindow *parent)
SetSizer(topsizer);
topsizer->Add(leftScrolledWindow, wxSizerFlags(0).Expand());
leftallsizer->Add(buttonPanel, wxSizerFlags(0).Expand());
leftallsizer->Add(leftScrolledWindow, wxSizerFlags(1).Expand());
topsizer->Add(leftallsizer, wxSizerFlags(0).Expand());
topsizer->Add(m_browser, wxSizerFlags(1).Expand().Border(wxALL, 0));
// Zoom
@@ -219,6 +271,18 @@ PrinterWebView::PrinterWebView(wxWindow *parent)
//Connect the idle events
Bind(wxEVT_CLOSE_WINDOW, &PrinterWebView::OnClose, this);
if (m_isSimpleMode) {
arrow_button->SetBitmap(*get_bmp_bundle("arrow-right-s-line", 20));
leftsizer->SetMinSize(wxSize(190, -1));
leftScrolledWindow->SetMinSize(wxSize(190, -1));
text_static->SetFont(wxFont(wxFontInfo(12).Bold()));
leftsizer->Layout();
leftScrolledWindow->Layout();
buttonSizer->Layout();
topsizer->Layout();
}
}
@@ -258,7 +322,15 @@ void PrinterWebView::AddButton(const wxString & devi
#else
customButton->SetSize(wxSize(200, -1));
#endif
customButton->SetSimpleMode(false);
if (m_isSimpleMode) {
customButton->SetBitmap(*get_bmp_bundle(std::string("X-MAX 3_thumbnail"), 30));
customButton->SetSimpleMode(m_isSimpleMode);
customButton->SetSize(wxSize(180, -1));
} else {
customButton->SetBitmap(*get_bmp_bundle(std::string("X-MAX 3_thumbnail"), 80));
customButton->SetSimpleMode(m_isSimpleMode);
customButton->SetSize(wxSize(300, -1));
}
leftsizer->Add(customButton, wxSizerFlags().Border(wxALL, 1).Expand());
leftsizer->Layout();
@@ -292,6 +364,19 @@ void PrinterWebView::AddButton(const wxString & devi
}
}
//B45
void PrinterWebView::StopAllThread()
{
// BOOST_LOG_TRIVIAL(error) << " Stop";
if (m_buttons.empty()) {
BOOST_LOG_TRIVIAL(info) << " empty";
} else {
for (MachineListButton *button : m_buttons) {
button->StopStatusThread();
}
}
}
// B45
void PrinterWebView::UnSelectedButton()
@@ -336,11 +421,13 @@ void PrinterWebView::SetButtons(std::vector<MachineListButton *> buttons) { m_bu
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " End";
}
//B45
void PrinterWebView::OnLeftButtonClick(wxCommandEvent &event)
{
m_isSimpleMode = !m_isSimpleMode;
if (!m_isSimpleMode) {
wxGetApp().app_config->set("machine_list_minification","0");
leftsizer->SetMinSize(wxSize(300, -1));
leftScrolledWindow->SetMinSize(wxSize(300, -1));
arrow_button->SetBitmap(*get_bmp_bundle("arrow-left-s-line", 20));
@@ -353,14 +440,15 @@ void PrinterWebView::OnLeftButtonClick(wxCommandEvent &event)
}
}
else {
wxGetApp().app_config->set("machine_list_minification", "1");
arrow_button->SetBitmap(*get_bmp_bundle("arrow-right-s-line", 20));
leftsizer->SetMinSize(wxSize(210, -1));
leftScrolledWindow->SetMinSize(wxSize(210, -1));
leftsizer->SetMinSize(wxSize(190, -1));
leftScrolledWindow->SetMinSize(wxSize(190, -1));
text_static->SetFont(wxFont(wxFontInfo(12).Bold()));
for (MachineListButton *button : m_buttons) {
button->SetBitmap(*get_bmp_bundle(std::string("X-MAX 3_thumbnail"), 30));
button->SetSimpleMode(m_isSimpleMode);
button->SetSize(wxSize(200, -1));
button->SetSize(wxSize(180, -1));
}
}
@@ -370,14 +458,17 @@ void PrinterWebView::OnLeftButtonClick(wxCommandEvent &event)
leftScrolledWindow->Layout();
topsizer->Layout();
//UpdateLayout();
UpdateLayout();
}
//B45
void PrinterWebView::OnRightButtonClick(wxCommandEvent &event)
{
for (MachineListButton *button : m_buttons) {
button->ResumeStatusThread();
}
//w13
Refresh();
}
void PrinterWebView::OnAddButtonClick(wxCommandEvent &event)
@@ -403,6 +494,9 @@ void PrinterWebView::OnAddButtonClick(wxCommandEvent &event)
Preset * preset = wxGetApp().preset_bundle->printers.find_preset(preset_name);
std::string model_id = "X-MAX 3";
if (preset != nullptr) {
if ((preset->config.opt_string("printer_model").empty()))
model_id = "X-MAX 3";
else
model_id = preset->config.opt_string("printer_model");
}
@@ -424,8 +518,10 @@ void PrinterWebView::OnAddButtonClick(wxCommandEvent &event)
true, cfg_t);
load_url(formattedHost);
UpdateLayout();
Refresh();
//w13
//Refresh();
}
Refresh();
}
void PrinterWebView::OnDeleteButtonClick(wxCommandEvent &event) {
@@ -443,9 +539,12 @@ void PrinterWebView::OnDeleteButtonClick(wxCommandEvent &event) {
#else
msg += _L("Are you sure you want to delete ") + (button->getLabel()) + _L("printer?");
#endif
if (MessageDialog(this, msg, _L("Delete Physical Printer"), wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION).ShowModal() != wxID_YES)
return ;
//w13
if (MessageDialog(this, msg, _L("Delete Physical Printer"), wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION).ShowModal() !=
wxID_YES) {
Refresh();
return;
}
button->StopStatusThread();
preset_bundle.physical_printers.select_printer((button->getLabel()).ToStdString());
@@ -476,13 +575,14 @@ void PrinterWebView::OnDeleteButtonClick(wxCommandEvent &event) {
}
UpdateLayout();
Refresh();
//Refresh();
break;
}
}
if (m_handlerl) {
m_handlerl(event);
}
Refresh();
}
void PrinterWebView::OnEditButtonClick(wxCommandEvent &event) {
@@ -519,11 +619,13 @@ void PrinterWebView::OnEditButtonClick(wxCommandEvent &event) {
button->SetBitMap(get_bmp_bundle(std::string(Machine_Name.mb_str()), 80)->GetBitmapFor(this));
UpdateLayout();
Refresh();
//w13
//Refresh();
}
break;
}
}
Refresh();
}
@@ -565,7 +667,10 @@ void PrinterWebView::OnScriptMessage(wxWebViewEvent &evt)
void PrinterWebView::UpdateLayout()
{
//leftScrolledWindow->SetVirtualSize(leftsizer->GetMinSize());
wxSize size = leftsizer->GetSize();
int height = size.GetHeight();
int Width = size.GetWidth();
leftScrolledWindow->SetVirtualSize(Width, height);
leftsizer->Layout();
leftScrolledWindow->Layout();
@@ -580,6 +685,20 @@ void PrinterWebView::UpdateLayout()
}
}
void PrinterWebView::OnScrollup(wxScrollWinEvent &event)
{
height -= 5;
leftScrolledWindow->Scroll(0, height);
UpdateLayout();
event.Skip();
}
void PrinterWebView::OnScrolldown(wxScrollWinEvent &event)
{
height += 5;
leftScrolledWindow->Scroll(0, height);
UpdateLayout();
event.Skip();
}
void PrinterWebView::OnScroll(wxScrollWinEvent &event)
{
@@ -592,8 +711,9 @@ void PrinterWebView::load_url(wxString& url)
{
// this->Show();
// this->Raise();
if (m_browser == nullptr)
if (m_browser == nullptr || m_web == url)
return;
m_web = url;
m_browser->LoadURL(url);
url.Remove(0, 7);
@@ -639,7 +759,25 @@ void PrinterWebView::RunScript(const wxString &javascript)
WebView::RunScript(m_browser, javascript);
}
//w13
void MyRoundButton::OnPaint(wxPaintEvent &evt)
{
wxPaintDC dc(this);
wxRect rect = GetClientRect();
dc.SetPen(wxPen(wxColour(110, 110, 110)));
dc.SetBrush(wxBrush(wxColour(85, 85, 90)));
dc.DrawRoundedRectangle(rect, 5);
wxBitmap m_bitmap_state = get_bmp_bundle(m_name.ToStdString(), 20)->GetBitmapFor(this);
int imgWidth = m_bitmap_state.GetWidth();
int imgHeight = m_bitmap_state.GetHeight();
int x = (rect.GetWidth() - imgWidth) / 2;
int y = (rect.GetHeight() - imgHeight) / 2;
dc.DrawBitmap(m_bitmap_state, x, y);
}
void MyRoundButton::OnFocusEvent(wxFocusEvent &evt)
{
Refresh();
evt.Skip();
}
} // GUI
} // Slic3r

View File

@@ -58,10 +58,11 @@ public:
{
full_label = fullname;
m_isSelected = isSelected;
//w13
if (isSelected)
SetBackgroundColour(wxColour(100, 100, 105));
SetBackgroundColour(wxColour(30, 30, 32));
else
SetBackgroundColour(wxColour(67, 67, 71));
SetBackgroundColour(wxColour(30, 30, 32));
//Bind(wxEVT_BUTTON, &MachineListButton::OnMouseLeftUp, this);
}
@@ -110,10 +111,11 @@ public:
void SetSelect(bool isselectd)
{
m_isSelected = isselectd;
if (m_isSelected)
//w13
/* if (m_isSelected)
SetBackgroundColour(wxColour(100, 100, 105));
else
SetBackgroundColour(wxColour(67, 67, 71));
SetBackgroundColour(wxColour(67, 67, 71)); */
Refresh();
}
bool GetSelected() { return m_isSelected;}
@@ -135,6 +137,9 @@ public:
m_stopThread = true;
if (m_statusThread.joinable()) {
m_statusThread.join();
} else {
m_statusThread.detach();
std::terminate();
}
}
void OnPaint(wxPaintEvent &event);
@@ -185,7 +190,9 @@ public:
}
private:
//w13
bool mousePressed = false;
bool mouseOnButton;
std::atomic<bool> m_stopThread{false};
std::atomic<bool> m_pauseThread{false};
@@ -230,6 +237,8 @@ public:
void OnScriptMessage(wxWebViewEvent &evt);
void UpdateLayout();
void OnScroll(wxScrollWinEvent &event);
void OnScrollup(wxScrollWinEvent &event);
void OnScrolldown(wxScrollWinEvent &event);
void SetUpdateHandler(const std::function<void(wxCommandEvent &)> &handler) { m_handlerl = handler; }
void SetDeleteHandler(const std::function<void(wxCommandEvent &)> &handler) { m_delete_handlerl = handler; }
@@ -248,6 +257,7 @@ public:
void DeleteButton();
void PauseButton();
void ResumeButton();
void StopAllThread();
void UnSelectedButton();
std::vector<MachineListButton *> GetButton() { return m_buttons; };
@@ -263,6 +273,8 @@ private:
wxStaticText * text_static;
int height = 0;
wxString m_web;
std::function<void(wxCommandEvent &)> m_handlerl;
std::function<void(wxCommandEvent &)> m_delete_handlerl;
@@ -278,7 +290,37 @@ private:
// DECLARE_EVENT_TABLE()
};
//w13
class MyRoundButton : public wxButton
{
public:
wxString m_name;
MyRoundButton(wxWindow * parent,
wxWindowID id = wxID_ANY,
const wxString &label = "",
const wxString &name = "",
const wxPoint & pos = wxDefaultPosition,
const wxSize & size = wxDefaultSize,
long style = 0)
: wxButton(parent, id, label, pos, size, style), m_name(name)
{
//w13
//SetBackgroundColour(wxColour(100, 100, 105));
//SetMinSize(wxSize(40, -1));
Bind(wxEVT_PAINT, &MyRoundButton::OnPaint, this);
Bind(wxEVT_SET_FOCUS, &MyRoundButton::OnFocusEvent, this);
Bind(wxEVT_KILL_FOCUS, &MyRoundButton::OnFocusEvent, this);
}
void OnFocusEvent(wxFocusEvent &evt);
void OnPaint(wxPaintEvent &evt);
private:
void DrawRoundedRect(wxDC &dc, wxRect rect, int radius){
dc.DrawRoundedRectangle(rect, radius);
}
};
} // GUI

View File

@@ -2516,6 +2516,10 @@ void TabPrinter::build_fff()
return create_bed_shape_widget(parent);
});
//Y18
Option option = optgroup->get_option("bed_exclude_area");
option.opt.full_width = true;
optgroup->append_single_option_line(option);
optgroup->append_single_option_line("max_print_height");
optgroup->append_single_option_line("z_offset");
@@ -2528,7 +2532,7 @@ void TabPrinter::build_fff()
def.min = 1;
def.max = 256;
def.mode = comExpert;
Option option(def, "extruders_count");
option = Option(def, "extruders_count");
optgroup->append_single_option_line(option);
optgroup->append_single_option_line("single_extruder_multi_material");

View File

@@ -1209,6 +1209,9 @@ static wxString get_string_value(std::string opt_key, const DynamicPrintConfig&
BedShape shape(*config.option<ConfigOptionPoints>(opt_key));
return shape.get_full_name_with_params();
}
//Y18
if (opt_key == "bed_exclude_area")
return get_thumbnails_string(config.option<ConfigOptionPoints>(opt_key)->values);
if (opt_key == "thumbnails")
return get_thumbnails_string(config.option<ConfigOptionPoints>(opt_key)->values);