NEW: re-add printable_area config

Jira: STUDIO-4052

Change-Id: I31d1bbeba3adaf612bbef5e90d1be182c629e212
This commit is contained in:
liz.li 2023-09-12 20:48:44 +08:00 committed by Lane.Wei
parent 05a9eba217
commit 3cc423c191
3 changed files with 21 additions and 12 deletions

View file

@ -188,15 +188,16 @@ void BedShapePanel::build_panel(const ConfigOptionPoints& default_pt, const Conf
auto optgroup = init_shape_options_page(BedShape::get_name(BedShape::PageType::Rectangle));
BedShape::append_option_line(optgroup, BedShape::Parameter::RectSize);
BedShape::append_option_line(optgroup, BedShape::Parameter::RectOrigin);
// BBS hide
//BedShape::append_option_line(optgroup, BedShape::Parameter::RectOrigin);
activate_options_page(optgroup);
optgroup = init_shape_options_page(BedShape::get_name(BedShape::PageType::Circle));
// BBS hide
/* optgroup = init_shape_options_page(BedShape::get_name(BedShape::PageType::Circle));
BedShape::append_option_line(optgroup, BedShape::Parameter::Diameter);
activate_options_page(optgroup);
optgroup = init_shape_options_page(BedShape::get_name(BedShape::PageType::Custom));
Line line{ "", "" };
line.full_width = 1;
line.widget = [this](wxWindow* parent) {
@ -214,15 +215,19 @@ void BedShapePanel::build_panel(const ConfigOptionPoints& default_pt, const Conf
return sizer;
};
optgroup->append_line(line);
activate_options_page(optgroup);
activate_options_page(optgroup);*/
wxPanel* texture_panel = init_texture_panel();
wxPanel* model_panel = init_model_panel();
// BBS hide
texture_panel->Hide();
model_panel->Hide();
Bind(wxEVT_CHOICEBOOK_PAGE_CHANGED, ([this](wxCommandEvent& e) { update_shape(); }));
// right pane with preview canvas
m_canvas = new Bed_2D(this);
m_canvas->SetMinSize({ FromDIP(320), FromDIP(320) });
m_canvas->Bind(wxEVT_PAINT, [this](wxPaintEvent& e) { m_canvas->repaint(m_shape); });
m_canvas->Bind(wxEVT_SIZE, [this](wxSizeEvent& e) { m_canvas->Refresh(); });
@ -483,8 +488,9 @@ void BedShapePanel::update_shape()
try { rect_size = boost::any_cast<Vec2d>(opt_group->get_value("rect_size")); }
catch (const std::exception& /* e */) { return; }
try { rect_origin = boost::any_cast<Vec2d>(opt_group->get_value("rect_origin")); }
catch (const std::exception & /* e */) { return; }
// BBS
//try { rect_origin = boost::any_cast<Vec2d>(opt_group->get_value("rect_origin")); }
//catch (const std::exception & /* e */) { return; }
auto x = rect_size(0);
auto y = rect_size(1);

View file

@ -42,6 +42,7 @@
#include "Widgets/TabCtrl.hpp"
#include "MarkdownTip.hpp"
#include "Search.hpp"
#include "BedShapeDialog.hpp"
#ifdef WIN32
#include <commctrl.h>
@ -2983,9 +2984,10 @@ void TabPrinter::build_fff()
auto page = add_options_page(L("Basic information"), "printer");
auto optgroup = page->new_optgroup(L("Printable space")/*, L"param_printable_space"*/);
//create_line_with_widget(optgroup.get(), "printable_area", "custom-svg-and-png-bed-textures_124612", [this](wxWindow* parent) {
// return create_bed_shape_widget(parent);
//});
create_line_with_widget(optgroup.get(), "printable_area", "custom-svg-and-png-bed-textures_124612", [this](wxWindow* parent) {
return create_bed_shape_widget(parent);
});
Option option = optgroup->get_option("bed_exclude_area");
option.opt.full_width = true;
optgroup->append_single_option_line(option);
@ -3672,6 +3674,7 @@ void TabPrinter::toggle_options()
// toggle_option("change_filament_gcode", have_multiple_extruders);
//}
if (m_active_page->title() == "Basic information") {
toggle_line("printable_area", !is_BBL_printer);
toggle_option("single_extruder_multi_material", have_multiple_extruders);
//BBS: gcode_flavore of BBL printer can't be edited and changed
toggle_option("gcode_flavor", !is_BBL_printer);
@ -4896,7 +4899,7 @@ wxSizer* Tab::compatible_widget_create(wxWindow* parent, PresetDependencies &dep
}
// Return a callback to create a TabPrinter widget to edit bed shape
/*wxSizer* TabPrinter::create_bed_shape_widget(wxWindow* parent)
wxSizer* TabPrinter::create_bed_shape_widget(wxWindow* parent)
{
ScalableButton* btn = new ScalableButton(parent, wxID_ANY, "printer", " " + _(L("Set")) + " " + dots,
wxDefaultSize, wxDefaultPosition, wxBU_LEFT | wxBU_EXACTFIT, true);
@ -4926,7 +4929,7 @@ wxSizer* Tab::compatible_widget_create(wxWindow* parent, PresetDependencies &dep
}
return sizer;
}*/
}
void TabPrinter::cache_extruder_cnt()
{

View file

@ -594,7 +594,7 @@ public:
void msw_rescale() override;
bool supports_printer_technology(const PrinterTechnology /* tech */) const override { return true; }
//wxSizer* create_bed_shape_widget(wxWindow* parent);
wxSizer* create_bed_shape_widget(wxWindow* parent);
void cache_extruder_cnt();
bool apply_extruder_cnt_from_cache();
};