NEW: set bed type for partplate

Change-Id: I876e24fb424b16eeb674313c7e0e03a228bc4b35
Signed-off-by: Stone Li <stone.li@bambulab.com>
This commit is contained in:
Stone Li 2022-11-08 09:34:59 +08:00 committed by Lane.Wei
parent 9f4a2c0c1c
commit 3b25d02eea
14 changed files with 1011 additions and 68 deletions

View file

@ -128,6 +128,7 @@
#include "PhysicalPrinterDialog.hpp"
#include "PrintHostDialogs.hpp"
#include "SetBedTypeDialog.hpp"
using boost::optional;
namespace fs = boost::filesystem;
@ -5209,6 +5210,10 @@ void Plater::priv::on_select_bed_type(wxCommandEvent &evt)
// update app_config
AppConfig *app_config = wxGetApp().app_config;
app_config->set("curr_bed_type", std::to_string(int(bed_type)));
// update render
view3D->get_canvas3d()->render();
preview->msw_rescale();
}
}
}
@ -10571,6 +10576,25 @@ int Plater::select_plate_by_hover_id(int hover_id, bool right_click)
take_snapshot("lock partplate");
ret = p->partplate_list.lock_plate(plate_index, !p->partplate_list.is_locked(plate_index));
}
else if ((action == 5)&&(!right_click))
{
//set the plate type
ret = select_plate(plate_index);
if (!ret) {
SetBedTypeDialog dlg(this, wxID_ANY, _L("Select bed type"));
dlg.sync_bed_type(p->partplate_list.get_curr_plate()->get_bed_type());
dlg.Bind(EVT_SET_BED_TYPE_CONFIRM, [this, plate_index](wxCommandEvent& e) {
auto type = (BedType)(e.GetInt());
p->partplate_list.get_curr_plate()->set_bed_type(type);
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format("select bed type %1% for plate %2% at plate side")%type %plate_index;
});
dlg.ShowModal();
}
else {
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << "can not select plate %1%" << plate_index;
ret = -1;
}
}
else
{
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << "invalid action %1%, with right_click=%2%" << action << right_click;