ENH:Add numerical display in AMS control
jira: STUDIO-10432 Change-Id: I504e38612b09513247462974b4d34b331a5d3240
This commit is contained in:
parent
0deb17f43e
commit
3f51f72a66
|
@ -402,12 +402,13 @@ void MaterialSyncItem::render(wxDC &dc)
|
|||
if (mcolor.Alpha() == 0) { material_name_colour = wxColour(0x26, 0x2E, 0x30); }
|
||||
dc.SetTextForeground(material_name_colour);
|
||||
|
||||
if (dc.GetTextExtent(m_material_name).x > GetSize().x - 10) {
|
||||
auto full_text = m_material_index + " " + m_material_name;
|
||||
if (dc.GetTextExtent(full_text).x > GetSize().x - 10) {
|
||||
dc.SetFont(::Label::Body_10);
|
||||
}
|
||||
|
||||
auto material_txt_size = dc.GetTextExtent(m_material_name);
|
||||
dc.DrawText(m_material_name, wxPoint((GetSize().x - material_txt_size.x) / 2, ((float) GetSize().y * 2 / 5 - material_txt_size.y) / 2));
|
||||
auto material_txt_size = dc.GetTextExtent(full_text);
|
||||
dc.DrawText(full_text, wxPoint((GetSize().x - material_txt_size.x) / 2, ((float) GetSize().y * 2 / 5 - material_txt_size.y) / 2));
|
||||
int real_left_offset = get_real_offset();
|
||||
if (m_match) {
|
||||
dc.SetTextForeground(StateColor::darkModeColorFor(wxColour(0x26, 0x2E, 0x30)));
|
||||
|
@ -539,6 +540,10 @@ void MaterialSyncItem::doRender(wxDC &dc)
|
|||
//not draw m_ams_not_match
|
||||
}
|
||||
|
||||
void MaterialSyncItem::set_material_index_str(std::string str) {
|
||||
m_material_index = str;
|
||||
}
|
||||
|
||||
AmsMapingPopup::AmsMapingPopup(wxWindow *parent, bool use_in_sync_dialog) :
|
||||
PopupWindow(parent, wxBORDER_NONE), m_use_in_sync_dialog(use_in_sync_dialog)
|
||||
{
|
||||
|
|
|
@ -124,6 +124,10 @@ public:
|
|||
int get_real_offset();
|
||||
void render(wxDC &dc) override;
|
||||
void doRender(wxDC &dc) override;
|
||||
void set_material_index_str(std::string str);
|
||||
|
||||
private:
|
||||
std::string m_material_index;
|
||||
};
|
||||
|
||||
class MappingItem : public wxPanel
|
||||
|
|
|
@ -3817,6 +3817,7 @@ void SyncAmsInfoDialog::reset_and_sync_ams_list()
|
|||
m_filaments_map = wxGetApp().plater()->get_partplate_list().get_curr_plate()->get_real_filament_maps(project_config);
|
||||
}
|
||||
auto contronal_index = 0;
|
||||
int item_index = 1;
|
||||
bool is_first_row = true;
|
||||
for (auto i = 0; i < extruders.size(); i++) {
|
||||
auto extruder = extruders[i] - 1;
|
||||
|
@ -3861,6 +3862,9 @@ void SyncAmsInfoDialog::reset_and_sync_ams_list()
|
|||
item = new MaterialSyncItem(m_filament_panel, colour_rgb, _L(display_materials[extruder]));
|
||||
m_sizer_ams_mapping->Add(item, 0, wxALL, FromDIP(5));
|
||||
}
|
||||
item->set_material_index_str(std::to_string(item_index));
|
||||
item_index++;
|
||||
|
||||
contronal_index++;
|
||||
item->Bind(wxEVT_LEFT_UP, [this, item, materials, extruder](wxMouseEvent &e) {});
|
||||
item->Bind(wxEVT_LEFT_DOWN, [this, item, materials, extruder](wxMouseEvent &e) {
|
||||
|
@ -4008,6 +4012,7 @@ void SyncAmsInfoDialog::generate_override_fix_ams_list()
|
|||
m_filaments_map = wxGetApp().plater()->get_partplate_list().get_curr_plate()->get_real_filament_maps(project_config);
|
||||
}
|
||||
auto contronal_index = 0;
|
||||
int item_index = 1;
|
||||
bool is_first_row = true;
|
||||
for (auto i = 0; i < extruders.size(); i++) {
|
||||
auto extruder = extruders[i] - 1;
|
||||
|
@ -4051,6 +4056,8 @@ void SyncAmsInfoDialog::generate_override_fix_ams_list()
|
|||
item = new MaterialSyncItem(m_fix_filament_panel, colour_rgb, _L(display_materials[extruder]));
|
||||
m_fix_sizer_ams_mapping->Add(item, 0, wxALL, FromDIP(5));
|
||||
}
|
||||
item->set_material_index_str(std::to_string(item_index));
|
||||
item_index++;
|
||||
contronal_index++;
|
||||
item->allow_paint_dropdown(false);
|
||||
|
||||
|
|
Loading…
Reference in New Issue