mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-16 18:12:10 +00:00
FIX: use different ext image for different machine
jira: [STUDIO-11133] Change-Id: Ice69b4f33317e23a2c2d7b8fbdfc94402b4bba28 (cherry picked from commit a67acd8f0ced49052cfe0c4b01a5bf159b046e85)
This commit is contained in:
@@ -3262,7 +3262,7 @@ void StatusPanel::update_ams(MachineObject *obj)
|
||||
ExtderData data = obj->m_extder_data;
|
||||
|
||||
// must select a current can
|
||||
m_ams_control->UpdateAms(obj->get_printer_series_str(), ams_info, ext_info, data, dev_id, false);
|
||||
m_ams_control->UpdateAms(obj->get_printer_series_str(), obj->printer_type, ams_info, ext_info, data, dev_id, false);
|
||||
|
||||
last_tray_exist_bits = obj->tray_exist_bits;
|
||||
last_ams_exist_bits = obj->ams_exist_bits;
|
||||
|
||||
@@ -593,7 +593,7 @@ void AMSControl::ClearAms() {
|
||||
pair_id.clear();
|
||||
}
|
||||
|
||||
void AMSControl::CreateAmsDoubleNozzle()
|
||||
void AMSControl::CreateAmsDoubleNozzle(const std::string &series_name, const std::string &printer_type)
|
||||
{
|
||||
std::vector<AMSinfo> single_info_left;
|
||||
std::vector<AMSinfo> single_info_right;
|
||||
@@ -612,7 +612,7 @@ void AMSControl::CreateAmsDoubleNozzle()
|
||||
if (single_info_right.size() == 2){
|
||||
single_info_right[0].nozzle_id == MAIN_NOZZLE_ID ? m_item_ids[MAIN_NOZZLE_ID].push_back(single_info_right[0].ams_id) : m_item_ids[DEPUTY_NOZZLE_ID].push_back(single_info_right[0].ams_id);
|
||||
single_info_right[1].nozzle_id == MAIN_NOZZLE_ID ? m_item_ids[MAIN_NOZZLE_ID].push_back(single_info_right[1].ams_id) : m_item_ids[DEPUTY_NOZZLE_ID].push_back(single_info_right[1].ams_id);
|
||||
AddAms(single_info_right);
|
||||
AddAms(single_info_right, series_name, printer_type);
|
||||
AddAmsPreview(single_info_right, AMSPanelPos::RIGHT_PANEL);
|
||||
pair_id.push_back(std::make_pair(single_info_right[0].ams_id, single_info_right[1].ams_id));
|
||||
single_info_right.clear();
|
||||
@@ -623,7 +623,7 @@ void AMSControl::CreateAmsDoubleNozzle()
|
||||
if (single_info_left.size() == 2){
|
||||
single_info_left[0].nozzle_id == MAIN_NOZZLE_ID ? m_item_ids[MAIN_NOZZLE_ID].push_back(single_info_left[0].ams_id) : m_item_ids[DEPUTY_NOZZLE_ID].push_back(single_info_left[0].ams_id);
|
||||
single_info_left[1].nozzle_id == MAIN_NOZZLE_ID ? m_item_ids[MAIN_NOZZLE_ID].push_back(single_info_left[1].ams_id) : m_item_ids[DEPUTY_NOZZLE_ID].push_back(single_info_left[1].ams_id);
|
||||
AddAms(single_info_left);
|
||||
AddAms(single_info_left, series_name, printer_type);
|
||||
AddAmsPreview(single_info_left, AMSPanelPos::LEFT_PANEL);
|
||||
pair_id.push_back(std::make_pair(single_info_left[0].ams_id, single_info_left[1].ams_id));
|
||||
single_info_left.clear();
|
||||
@@ -652,7 +652,7 @@ void AMSControl::CreateAmsDoubleNozzle()
|
||||
single_info_right[1].nozzle_id == MAIN_NOZZLE_ID ? m_item_ids[MAIN_NOZZLE_ID].push_back(single_info_right[1].ams_id) : m_item_ids[DEPUTY_NOZZLE_ID].push_back(single_info_right[1].ams_id);
|
||||
pair_id.push_back(std::make_pair(single_info_right[0].ams_id, single_info_right[1].ams_id));
|
||||
}
|
||||
AddAms(single_info_right);
|
||||
AddAms(single_info_right, series_name, printer_type);
|
||||
AddAmsPreview(single_info_right, AMSPanelPos::RIGHT_PANEL);
|
||||
single_info_right.clear();
|
||||
|
||||
@@ -670,7 +670,7 @@ void AMSControl::CreateAmsDoubleNozzle()
|
||||
pair_id.push_back(std::make_pair(single_info_left[0].ams_id, single_info_left[1].ams_id));
|
||||
}
|
||||
AddAmsPreview(single_info_left, AMSPanelPos::LEFT_PANEL);
|
||||
AddAms(single_info_left);
|
||||
AddAms(single_info_left, series_name, printer_type);
|
||||
single_info_left.clear();
|
||||
|
||||
m_sizer_prv_left->Layout();
|
||||
@@ -712,7 +712,7 @@ void AMSControl::CreateAmsDoubleNozzle()
|
||||
//Thaw();
|
||||
}
|
||||
|
||||
void AMSControl::CreateAmsSingleNozzle()
|
||||
void AMSControl::CreateAmsSingleNozzle(const std::string &series_name, const std::string &printer_type)
|
||||
{
|
||||
std::vector<int>m_item_nums{0,0};
|
||||
std::vector<AMSinfo> single_info;
|
||||
@@ -747,7 +747,7 @@ void AMSControl::CreateAmsSingleNozzle()
|
||||
if (single_info.size() > 0){
|
||||
m_item_ids[DEPUTY_NOZZLE_ID].push_back(single_info[0].ams_id);
|
||||
m_item_nums[DEPUTY_NOZZLE_ID]++;
|
||||
AddAms(single_info, AMSPanelPos::LEFT_PANEL);
|
||||
AddAms(single_info, series_name, printer_type, AMSPanelPos::LEFT_PANEL);
|
||||
AddAmsPreview(single_info, AMSPanelPos::LEFT_PANEL);
|
||||
single_info.clear();
|
||||
}
|
||||
@@ -760,7 +760,7 @@ void AMSControl::CreateAmsSingleNozzle()
|
||||
|
||||
single_info.push_back(m_ext_info[0]);
|
||||
m_item_ids[MAIN_NOZZLE_ID].push_back(single_info[0].ams_id);
|
||||
AddAms(single_info, AMSPanelPos::RIGHT_PANEL);
|
||||
AddAms(single_info, series_name, printer_type, AMSPanelPos::RIGHT_PANEL);
|
||||
auto left_init_mode = findFirstMode(AMSPanelPos::LEFT_PANEL);
|
||||
auto right_init_mode = findFirstMode(AMSPanelPos::RIGHT_PANEL);
|
||||
|
||||
@@ -894,7 +894,14 @@ std::vector<AMSinfo> AMSControl::GenerateSimulateData() {
|
||||
}
|
||||
|
||||
|
||||
void AMSControl::UpdateAms(const std::string& series_name, std::vector<AMSinfo> ams_info, std::vector<AMSinfo>ext_info, ExtderData data, std::string dev_id, bool is_reset, bool test)
|
||||
void AMSControl::UpdateAms(const std::string &series_name,
|
||||
const std::string &printer_type,
|
||||
std::vector<AMSinfo> ams_info,
|
||||
std::vector<AMSinfo> ext_info,
|
||||
ExtderData data,
|
||||
std::string dev_id,
|
||||
bool is_reset,
|
||||
bool test)
|
||||
{
|
||||
if (!test){
|
||||
// update item
|
||||
@@ -925,9 +932,9 @@ void AMSControl::UpdateAms(const std::string& series_name, std::vector<AMSinfo>
|
||||
if (fresh){
|
||||
ClearAms();
|
||||
if (m_extder_data.total_extder_count >= 2){
|
||||
CreateAmsDoubleNozzle();
|
||||
CreateAmsDoubleNozzle(series_name, printer_type);
|
||||
}else{
|
||||
CreateAmsSingleNozzle();
|
||||
CreateAmsSingleNozzle(series_name, printer_type);
|
||||
}
|
||||
SetSize(wxSize(FromDIP(578), -1));
|
||||
SetMinSize(wxSize(FromDIP(578), -1));
|
||||
@@ -1127,7 +1134,7 @@ AMSRoadShowMode AMSControl::findFirstMode(AMSPanelPos pos) {
|
||||
}
|
||||
}
|
||||
|
||||
void AMSControl::createAmsPanel(wxSimplebook *parent, int &idx, std::vector<AMSinfo> infos, AMSPanelPos pos, int total_ext_num)
|
||||
void AMSControl::createAmsPanel(wxSimplebook *parent, int &idx, std::vector<AMSinfo> infos, const std::string &series_name, const std::string &printer_type, AMSPanelPos pos, int total_ext_num)
|
||||
{
|
||||
if (infos.size() <= 0) return;
|
||||
|
||||
@@ -1139,11 +1146,11 @@ void AMSControl::createAmsPanel(wxSimplebook *parent, int &idx, std::vector<AMSi
|
||||
|
||||
AmsItem* ams1 = nullptr, * ams2 = nullptr;
|
||||
ams1 = new AmsItem(book_panel, infos[0], infos[0].ams_type, pos);
|
||||
if (ams1->get_ext_image()) { ams1->get_ext_image()->setTotalExtNum(total_ext_num); }
|
||||
if (ams1->get_ext_image()) { ams1->get_ext_image()->setTotalExtNum(series_name, printer_type, total_ext_num); }
|
||||
|
||||
if (infos.size() == MAX_AMS_NUM_IN_PANEL) { //n3s and ? in a panel
|
||||
ams2 = new AmsItem(book_panel, infos[1], infos[1].ams_type, pos);
|
||||
if (ams2->get_ext_image()) { ams2->get_ext_image()->setTotalExtNum(total_ext_num); }
|
||||
if (ams2->get_ext_image()) { ams2->get_ext_image()->setTotalExtNum(series_name, printer_type, total_ext_num); }
|
||||
|
||||
if (pos == AMSPanelPos::LEFT_PANEL) {
|
||||
book_sizer->Add(ams1, 0, wxLEFT, FromDIP(4));
|
||||
@@ -1166,6 +1173,7 @@ void AMSControl::createAmsPanel(wxSimplebook *parent, int &idx, std::vector<AMSi
|
||||
auto ext_image = new AMSExtImage(book_panel, pos, &m_extder_data);
|
||||
book_sizer->Add(ams1, 0, wxLEFT, FromDIP(30));
|
||||
book_sizer->Add(ext_image, 0, wxEXPAND | wxLEFT | wxALIGN_CENTER_VERTICAL, FromDIP(30));
|
||||
ext_image->setTotalExtNum(series_name, printer_type, total_ext_num);
|
||||
m_ext_image_list[infos[0].ams_id] = ext_image;
|
||||
}
|
||||
}
|
||||
@@ -1225,24 +1233,25 @@ void AMSControl::AddAms(AMSinfo info, AMSPanelPos pos)
|
||||
//
|
||||
//}
|
||||
|
||||
void AMSControl::AddAms(std::vector<AMSinfo>single_info, AMSPanelPos pos) {
|
||||
void AMSControl::AddAms(std::vector<AMSinfo> single_info, const std::string &series_name, const std::string &printer_type, AMSPanelPos pos)
|
||||
{
|
||||
if (single_info.size() <= 0){
|
||||
return;
|
||||
}
|
||||
if (m_extder_data.total_extder_count == 2) {
|
||||
if (single_info[0].nozzle_id == MAIN_NOZZLE_ID) {
|
||||
createAmsPanel(m_simplebook_ams_right, m_right_page_index, single_info, AMSPanelPos::RIGHT_PANEL, m_extder_data.total_extder_count);
|
||||
createAmsPanel(m_simplebook_ams_right, m_right_page_index, single_info, series_name, printer_type, AMSPanelPos::RIGHT_PANEL, m_extder_data.total_extder_count);
|
||||
}
|
||||
else if (single_info[0].nozzle_id == DEPUTY_NOZZLE_ID) {
|
||||
createAmsPanel(m_simplebook_ams_left, m_left_page_index, single_info, AMSPanelPos::LEFT_PANEL, m_extder_data.total_extder_count);
|
||||
createAmsPanel(m_simplebook_ams_left, m_left_page_index, single_info, series_name, printer_type, AMSPanelPos::LEFT_PANEL, m_extder_data.total_extder_count);
|
||||
}
|
||||
}
|
||||
else if (m_extder_data.total_extder_count == 1) {
|
||||
if (pos == AMSPanelPos::RIGHT_PANEL) {
|
||||
createAmsPanel(m_simplebook_ams_right, m_right_page_index, single_info, AMSPanelPos::RIGHT_PANEL, m_extder_data.total_extder_count);
|
||||
createAmsPanel(m_simplebook_ams_right, m_right_page_index, single_info, series_name, printer_type, AMSPanelPos::RIGHT_PANEL, m_extder_data.total_extder_count);
|
||||
}
|
||||
else {
|
||||
createAmsPanel(m_simplebook_ams_left, m_left_page_index, single_info, AMSPanelPos::LEFT_PANEL, m_extder_data.total_extder_count);
|
||||
createAmsPanel(m_simplebook_ams_left, m_left_page_index, single_info, series_name, printer_type, AMSPanelPos::LEFT_PANEL, m_extder_data.total_extder_count);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ public:
|
||||
bool IsAmsInRightPanel(std::string ams_id);
|
||||
wxColour GetCanColour(std::string amsid, std::string canid);
|
||||
void createAms(wxSimplebook* parent, int& idx, AMSinfo info, AMSPanelPos pos);
|
||||
void createAmsPanel(wxSimplebook* parent, int& idx, std::vector<AMSinfo>infos, AMSPanelPos pos, int total_ext_num);
|
||||
void createAmsPanel(wxSimplebook *parent, int &idx, std::vector<AMSinfo> infos, const std::string &series_name, const std::string &printer_type, AMSPanelPos pos, int total_ext_num);
|
||||
AMSRoadShowMode findFirstMode(AMSPanelPos pos);
|
||||
|
||||
AMSModel m_ams_model{AMSModel::EXT_AMS};
|
||||
@@ -149,10 +149,17 @@ public:
|
||||
|
||||
void UpdatePassRoad(string ams_id, AMSPassRoadType type, AMSPassRoadSTEP step);
|
||||
void CreateAms();
|
||||
void CreateAmsDoubleNozzle();
|
||||
void CreateAmsSingleNozzle();
|
||||
void CreateAmsDoubleNozzle(const std::string &series_name, const std::string& printer_type);
|
||||
void CreateAmsSingleNozzle(const std::string &series_name, const std::string &printer_type);
|
||||
void ClearAms();
|
||||
void UpdateAms(const std::string& series_name, std::vector<AMSinfo> ams_info, std::vector<AMSinfo> ext_info, ExtderData data, std::string dev_id, bool is_reset = true, bool test = false);
|
||||
void UpdateAms(const std::string &series_name,
|
||||
const std::string &printer_type,
|
||||
std::vector<AMSinfo> ams_info,
|
||||
std::vector<AMSinfo> ext_info,
|
||||
ExtderData data,
|
||||
std::string dev_id,
|
||||
bool is_reset = true,
|
||||
bool test = false);
|
||||
std::vector<AMSinfo> GenerateSimulateData();
|
||||
|
||||
void AddAms(AMSinfo info, AMSPanelPos pos = AMSPanelPos::LEFT_PANEL);
|
||||
@@ -160,7 +167,7 @@ public:
|
||||
void AddAmsPreview(AMSinfo info, AMSModel type);
|
||||
//void AddExtraAms(AMSinfo info);
|
||||
|
||||
void AddAms(std::vector<AMSinfo>single_info, AMSPanelPos pos = AMSPanelPos::LEFT_PANEL);
|
||||
void AddAms(std::vector<AMSinfo> single_info, const std::string &series_name, const std::string &printer_type, AMSPanelPos pos = AMSPanelPos::LEFT_PANEL);
|
||||
void AddAmsPreview(std::vector<AMSinfo>single_info, AMSPanelPos pos);
|
||||
//void AddExtraAms(std::vector<AMSinfo>single_info);
|
||||
void SetExtruder(bool on_off, std::string ams_id, std::string slot_id);
|
||||
|
||||
@@ -581,14 +581,7 @@ AMSExtImage::AMSExtImage(wxWindow* parent, AMSPanelPos ext_pos, ExtderData *data
|
||||
}
|
||||
|
||||
m_ext_pos = ext_pos;
|
||||
m_ext_left = ScalableBitmap(this, "ext_image_left", 98);
|
||||
m_ext_right = ScalableBitmap(this, "ext_image_right", 98);
|
||||
m_ext_single_nozzle = ScalableBitmap(this, "ext_image_single_nozzle", 98);
|
||||
|
||||
m_ams_single_ext = ScalableBitmap(this, "ams_ext_image", 25);
|
||||
m_ams_ext_left = ScalableBitmap(this, "ext_image_left", 25);
|
||||
m_ams_ext_right = ScalableBitmap(this, "ext_image_right", 25);
|
||||
|
||||
createImages();
|
||||
SetBackgroundColour(StateColor::darkModeColorFor(AMS_CONTROL_DEF_LIB_BK_COLOUR));
|
||||
|
||||
Bind(wxEVT_PAINT, &AMSExtImage::paintEvent, this);
|
||||
@@ -596,17 +589,63 @@ AMSExtImage::AMSExtImage(wxWindow* parent, AMSPanelPos ext_pos, ExtderData *data
|
||||
|
||||
AMSExtImage::~AMSExtImage() {}
|
||||
|
||||
void AMSExtImage::createImages()
|
||||
{
|
||||
m_ams_ext_o_left = ScalableBitmap(this, "ams_ext_image_o_left", 25);
|
||||
m_ams_ext_o_right = ScalableBitmap(this, "ams_ext_image_o_right", 25);
|
||||
m_ams_ext_xp = ScalableBitmap(this, "ams_ext_image_xp", 25);
|
||||
m_ams_ext_n1 = ScalableBitmap(this, "ams_ext_image_n1", 25);
|
||||
m_ams_ext_n2s = ScalableBitmap(this, "ams_ext_image_n2s", 25);
|
||||
m_ams_ext_default = ScalableBitmap(this, "ams_ext_image_default", 25);
|
||||
|
||||
m_ext_o_left = ScalableBitmap(this, "ext_image_o_left", 98);
|
||||
m_ext_o_right = ScalableBitmap(this, "ext_image_o_right", 98);
|
||||
m_ext_xp = ScalableBitmap(this, "ext_image_xp", 98);
|
||||
m_ext_n1 = ScalableBitmap(this, "ext_image_n1", 98);
|
||||
m_ext_n2s = ScalableBitmap(this, "ext_image_n2s", 98);
|
||||
m_ext_default = ScalableBitmap(this, "ext_image_default", 98);
|
||||
}
|
||||
|
||||
const wxBitmap &AMSExtImage::get_bmp(const std::string &series_name, const std::string &printer_type, bool is_ams_ext, AMSPanelPos pos) const
|
||||
{
|
||||
if (MachineObject::is_series_o(series_name)) {
|
||||
if (pos == AMSPanelPos::LEFT_PANEL) {
|
||||
return is_ams_ext ? m_ams_ext_o_left.bmp() : m_ext_o_left.bmp();
|
||||
} else if (pos == AMSPanelPos::RIGHT_PANEL) {
|
||||
return is_ams_ext ? m_ams_ext_o_right.bmp() : m_ext_o_right.bmp();
|
||||
}
|
||||
} else if (MachineObject::is_series_x(series_name) || MachineObject::is_series_p(series_name)) {
|
||||
return is_ams_ext ? m_ams_ext_xp.bmp() : m_ext_xp.bmp();
|
||||
} else if (MachineObject::is_series_n(series_name)) {
|
||||
if (printer_type == "N1") {
|
||||
return is_ams_ext ? m_ams_ext_n1.bmp() : m_ext_n1.bmp();
|
||||
} else if (printer_type == "N2S") {
|
||||
return is_ams_ext ? m_ams_ext_n2s.bmp() : m_ext_n2s.bmp();
|
||||
}
|
||||
}
|
||||
|
||||
return is_ams_ext ? m_ams_ext_default.bmp() : m_ext_default.bmp();
|
||||
}
|
||||
|
||||
void AMSExtImage::msw_rescale()
|
||||
{
|
||||
//m_ams_extruder.SetSize(AMS_EXTRUDER_BITMAP_SIZE);
|
||||
//auto image = m_ams_extruder.ConvertToImage();
|
||||
m_ext_left.msw_rescale();
|
||||
m_ext_right.msw_rescale();
|
||||
m_ext_single_nozzle.msw_rescale();
|
||||
m_ams_ext_o_left.msw_rescale();
|
||||
m_ams_ext_o_right.msw_rescale();
|
||||
m_ams_ext_xp.msw_rescale();
|
||||
m_ams_ext_n1.msw_rescale();
|
||||
m_ams_ext_n2s.msw_rescale();
|
||||
m_ams_ext_default.msw_rescale();
|
||||
|
||||
m_ams_single_ext.msw_rescale();
|
||||
m_ams_ext_left.msw_rescale();
|
||||
m_ams_ext_right.msw_rescale();
|
||||
m_ext_o_left.msw_rescale();
|
||||
m_ext_o_right.msw_rescale();
|
||||
m_ext_xp.msw_rescale();
|
||||
m_ext_n1.msw_rescale();
|
||||
m_ext_n2s.msw_rescale();
|
||||
m_ext_default.msw_rescale();
|
||||
|
||||
m_ext_default.bmp();
|
||||
|
||||
Layout();
|
||||
Fit();
|
||||
@@ -622,11 +661,13 @@ void AMSExtImage::setShowAmsExt(bool show)
|
||||
}
|
||||
}
|
||||
|
||||
void AMSExtImage::setTotalExtNum(int num)
|
||||
void AMSExtImage::setTotalExtNum(const std::string &series_name, const std::string &printer_type, int num)
|
||||
{
|
||||
if (total_ext_num != num)
|
||||
if ((total_ext_num != num) || (m_series_name != series_name) || (m_printer_type_name != printer_type))
|
||||
{
|
||||
total_ext_num = num;
|
||||
m_series_name = series_name;
|
||||
m_printer_type_name = printer_type;
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
@@ -665,21 +706,8 @@ void AMSExtImage::doRender(wxDC& dc)
|
||||
|
||||
if (m_show_ams_ext)
|
||||
{
|
||||
if (total_ext_num < 2)
|
||||
{
|
||||
dc.DrawBitmap(m_ams_single_ext.bmp(), wxPoint((size.x - m_ams_single_ext.GetBmpSize().x) / 2, 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_ext_pos == AMSPanelPos::LEFT_PANEL)
|
||||
{
|
||||
dc.DrawBitmap(m_ams_ext_left.bmp(), wxPoint((size.x - m_ams_ext_left.GetBmpSize().x) / 2, 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
dc.DrawBitmap(m_ams_ext_right.bmp(), wxPoint((size.x - m_ams_ext_right.GetBmpSize().x) / 2, 0));
|
||||
}
|
||||
}
|
||||
const wxBitmap &bmp = get_bmp(m_series_name, m_printer_type_name, true, m_ext_pos);
|
||||
dc.DrawBitmap(bmp, wxPoint((size.x - ScalableBitmap::GetBmpSize(bmp).x) / 2, 0));
|
||||
|
||||
Layout();
|
||||
return;
|
||||
@@ -687,21 +715,9 @@ void AMSExtImage::doRender(wxDC& dc)
|
||||
|
||||
if (m_show_ext)
|
||||
{
|
||||
if (total_ext_num < 2)
|
||||
{
|
||||
dc.DrawBitmap(m_ext_single_nozzle.bmp(), wxPoint((size.x - m_ext_right.GetBmpSize().x) / 2, (size.y - m_ext_right.GetBmpSize().GetHeight())));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_ext_pos == AMSPanelPos::LEFT_PANEL)
|
||||
{
|
||||
dc.DrawBitmap(m_ext_left.bmp(), wxPoint((size.x - m_ext_left.GetBmpSize().x) / 2, (size.y - m_ext_right.GetBmpSize().GetHeight())));
|
||||
}
|
||||
else
|
||||
{
|
||||
dc.DrawBitmap(m_ext_right.bmp(), wxPoint((size.x - m_ext_right.GetBmpSize().x) / 2, (size.y - m_ext_right.GetBmpSize().GetHeight())));
|
||||
}
|
||||
}
|
||||
const wxBitmap &bmp = get_bmp(m_series_name, m_printer_type_name, false, m_ext_pos);
|
||||
const wxSize& bmp_size = ScalableBitmap::GetBmpSize(bmp);
|
||||
dc.DrawBitmap(bmp, wxPoint((size.x - bmp_size.x) / 2, (size.y - bmp_size.GetHeight())));
|
||||
|
||||
Layout();
|
||||
return;
|
||||
|
||||
@@ -367,19 +367,28 @@ public:
|
||||
class AMSExtImage : public wxWindow
|
||||
{
|
||||
private:
|
||||
std::string m_series_name;
|
||||
std::string m_printer_type_name;
|
||||
|
||||
bool m_show_ams_ext = false;
|
||||
bool m_show_ext = false;
|
||||
|
||||
AMSPanelPos m_ext_pos;
|
||||
int total_ext_num = 1;
|
||||
|
||||
ScalableBitmap m_ams_ext_left;
|
||||
ScalableBitmap m_ams_ext_right;
|
||||
ScalableBitmap m_ams_single_ext;
|
||||
ScalableBitmap m_ams_ext_o_left;
|
||||
ScalableBitmap m_ams_ext_o_right;
|
||||
ScalableBitmap m_ams_ext_xp;
|
||||
ScalableBitmap m_ams_ext_n1;
|
||||
ScalableBitmap m_ams_ext_n2s;
|
||||
ScalableBitmap m_ams_ext_default;
|
||||
|
||||
ScalableBitmap m_ext_left;
|
||||
ScalableBitmap m_ext_right;
|
||||
ScalableBitmap m_ext_single_nozzle;
|
||||
ScalableBitmap m_ext_o_left;
|
||||
ScalableBitmap m_ext_o_right;
|
||||
ScalableBitmap m_ext_xp;
|
||||
ScalableBitmap m_ext_n1;
|
||||
ScalableBitmap m_ext_n2s;
|
||||
ScalableBitmap m_ext_default;
|
||||
|
||||
public:
|
||||
AMSExtImage(wxWindow *parent, AMSPanelPos ext_pos = AMSPanelPos::RIGHT_PANEL, ExtderData *data = nullptr, wxWindowID id = wxID_ANY, const wxPoint &pos = wxDefaultPosition);
|
||||
@@ -387,12 +396,15 @@ public:
|
||||
|
||||
void msw_rescale();
|
||||
void setShowAmsExt(bool show);
|
||||
void setTotalExtNum(int num);
|
||||
void setTotalExtNum(const std::string &series_name, const std::string &printer_type, int num);
|
||||
|
||||
private:
|
||||
void paintEvent(wxPaintEvent &evt);
|
||||
void render(wxDC &dc);
|
||||
void doRender(wxDC &dc);
|
||||
|
||||
void createImages();
|
||||
const wxBitmap &get_bmp(const std::string &series_name, const std::string &printer_type, bool is_ams_ext, AMSPanelPos pos) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -906,6 +906,15 @@ wxSize ScalableBitmap::GetBmpSize() const
|
||||
#endif
|
||||
}
|
||||
|
||||
wxSize ScalableBitmap::GetBmpSize(const wxBitmap &bmp)
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
return bmp.GetScaledSize();
|
||||
#else
|
||||
return bmp.GetSize();
|
||||
#endif
|
||||
}
|
||||
|
||||
int ScalableBitmap::GetBmpWidth() const
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
|
||||
@@ -41,7 +41,7 @@ wxMenuItem* append_menu_radio_item(wxMenu* menu, int id, const wxString& string,
|
||||
|
||||
wxMenuItem* append_menu_check_item(wxMenu* menu, int id, const wxString& string, const wxString& description,
|
||||
std::function<void(wxCommandEvent & event)> cb, wxEvtHandler* event_handler,
|
||||
std::function<bool()> const enable_condition = []() { return true; },
|
||||
std::function<bool()> const enable_condition = []() { return true; },
|
||||
std::function<bool()> const check_condition = []() { return true; }, wxWindow* parent = nullptr);
|
||||
|
||||
void enable_menu_item(wxUpdateUIEvent& evt, std::function<bool()> const cb_condition, wxMenuItem* item, wxWindow* win);
|
||||
@@ -68,7 +68,7 @@ wxBitmap create_scaled_bitmap2(const std::string& bmp_name_in, Slic3r::GUI::Bitm
|
||||
const int px_cnt = 16, const bool grayscale = false, const bool resize = false,
|
||||
const std::vector<std::string>& array_new_color = std::vector<std::string>()); // color witch will used instead of orange
|
||||
#else
|
||||
wxBitmap create_scaled_bitmap(const std::string& bmp_name, wxWindow *win = nullptr,
|
||||
wxBitmap create_scaled_bitmap(const std::string& bmp_name, wxWindow *win = nullptr,
|
||||
const int px_cnt = 16, const bool grayscale = false, const bool resize = false);
|
||||
#endif
|
||||
|
||||
@@ -157,7 +157,7 @@ public:
|
||||
ScalableBitmap() {};
|
||||
ScalableBitmap( wxWindow *parent,
|
||||
const std::string& icon_name = "",
|
||||
const int px_cnt = 16,
|
||||
const int px_cnt = 16,
|
||||
const bool grayscale = false,
|
||||
const bool resize = false,
|
||||
const bool bitmap2 = false,
|
||||
@@ -166,6 +166,8 @@ public:
|
||||
~ScalableBitmap() {}
|
||||
|
||||
wxSize GetBmpSize() const;
|
||||
static wxSize GetBmpSize(const wxBitmap &bmp);
|
||||
|
||||
int GetBmpWidth() const;
|
||||
int GetBmpHeight() const;
|
||||
|
||||
@@ -271,7 +273,7 @@ private:
|
||||
|
||||
bool m_use_default_disabled_bitmap {false};
|
||||
|
||||
// bitmap dimensions
|
||||
// bitmap dimensions
|
||||
int m_px_cnt{ 16 };
|
||||
bool m_has_border {false};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user