ENH: refine dual extruder related UI details
jira: new Change-Id: I63dd6278f3e7d22336482dba0f178150ebe55f1d
This commit is contained in:
parent
8b8b6bdec8
commit
73c05eee3b
|
@ -1361,18 +1361,41 @@ void MenuFactory::create_cut_cutter_menu()
|
|||
append_menu_item_change_type(menu);
|
||||
}
|
||||
|
||||
void MenuFactory::create_filament_action_menu()
|
||||
void MenuFactory::create_filament_action_menu(bool init)
|
||||
{
|
||||
wxMenu *menu = &m_filament_action_menu;
|
||||
|
||||
append_menu_item(
|
||||
menu, wxID_ANY, _L("Edit"), "", [](wxCommandEvent &) {
|
||||
plater()->sidebar().edit_filament(); }, "", nullptr,
|
||||
[]() { return true; }, m_parent);
|
||||
append_menu_item(
|
||||
menu, wxID_ANY, _L("Delete"), _L("Delete this filament"), [](wxCommandEvent &) {
|
||||
plater()->sidebar().delete_filament(-2); }, "menu_delete", nullptr,
|
||||
[]() { return plater()->sidebar().combos_filament().size() > 1; }, m_parent);
|
||||
if (init) {
|
||||
append_menu_item(
|
||||
menu, wxID_ANY, _L("Edit"), "", [](wxCommandEvent&) {
|
||||
plater()->sidebar().edit_filament(); }, "", nullptr,
|
||||
[]() { return true; }, m_parent);
|
||||
}
|
||||
|
||||
const int item_id = menu->FindItem(_L("Change to"));
|
||||
if (item_id != wxNOT_FOUND)
|
||||
menu->Destroy(item_id);
|
||||
|
||||
wxMenu* sub_menu = new wxMenu();
|
||||
std::vector<wxBitmap*> icons = get_extruder_color_icons(true);
|
||||
int filaments_cnt = icons.size();
|
||||
for (int i = 0; i < filaments_cnt; i++) {
|
||||
auto preset = wxGetApp().preset_bundle->filaments.find_preset(wxGetApp().preset_bundle->filament_presets[i]);
|
||||
wxString item_name = preset ? from_u8(preset->label(false)) : wxString::Format(_L("Filament %d"), i + 1);
|
||||
|
||||
append_menu_item(sub_menu, wxID_ANY, item_name, "",
|
||||
[i](wxCommandEvent&) { plater()->sidebar().change_filament(-2, i); }, *icons[i], menu,
|
||||
[]() { return true; }, m_parent);
|
||||
}
|
||||
append_submenu(menu, sub_menu, wxID_ANY, _L("Change to"), "", "",
|
||||
[filaments_cnt]() { return filaments_cnt > 1; }, m_parent, 1);
|
||||
|
||||
if (init) {
|
||||
append_menu_item(
|
||||
menu, wxID_ANY, _L("Delete"), _L("Delete this filament"), [](wxCommandEvent&) {
|
||||
plater()->sidebar().delete_filament(-2); }, "menu_delete", nullptr,
|
||||
[]() { return plater()->sidebar().combos_filament().size() > 1; }, m_parent);
|
||||
}
|
||||
}
|
||||
|
||||
//BBS: add part plate related logic
|
||||
|
@ -1478,7 +1501,7 @@ void MenuFactory::init(wxWindow* parent)
|
|||
//BBS: add part plate related logic
|
||||
create_plate_menu();
|
||||
|
||||
create_filament_action_menu();
|
||||
create_filament_action_menu(true);
|
||||
|
||||
// create "Instance to Object" menu item
|
||||
append_menu_item_instance_to_object(&m_instance_menu);
|
||||
|
@ -1657,7 +1680,10 @@ wxMenu* MenuFactory::assemble_multi_selection_menu()
|
|||
return menu;
|
||||
}
|
||||
|
||||
wxMenu *MenuFactory::filament_action_menu() { return &m_filament_action_menu; }
|
||||
wxMenu *MenuFactory::filament_action_menu() {
|
||||
create_filament_action_menu(false);
|
||||
return &m_filament_action_menu;
|
||||
}
|
||||
|
||||
|
||||
//BBS: add partplate related logic
|
||||
|
|
|
@ -134,7 +134,7 @@ private:
|
|||
void create_bbl_assemble_part_menu();
|
||||
void create_cut_cutter_menu();
|
||||
|
||||
void create_filament_action_menu();
|
||||
void create_filament_action_menu(bool init);
|
||||
|
||||
wxMenu* append_submenu_add_generic(wxMenu* menu, ModelVolumeType type);
|
||||
void append_menu_item_add_svg(wxMenu *menu, ModelVolumeType type, bool is_submenu_item = true);
|
||||
|
|
|
@ -605,17 +605,20 @@ class AMSCountPopupWindow : public PopupWindow
|
|||
{
|
||||
public:
|
||||
AMSCountPopupWindow(wxWindow * parent, wxStaticText *text, int index)
|
||||
: PopupWindow(parent, wxBORDER_SIMPLE)
|
||||
: PopupWindow(parent, wxBORDER_NONE)
|
||||
{
|
||||
auto msg = new wxStaticText(this, wxID_ANY, _L("Please set the number of ams installed on the this extrusion head."));
|
||||
msg->SetFont(Label::Body_14);
|
||||
msg->SetForegroundColour(0x6B6B6B);
|
||||
msg->Wrap(FromDIP(240));
|
||||
auto img4 = new ScalableButton(this, wxID_ANY, "ams_4_tray", {}, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER, false, 44);
|
||||
auto img1 = new ScalableButton(this, wxID_ANY, "ams_1_tray", {}, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER, false, 44);
|
||||
auto txt4 = new wxStaticText(this, wxID_ANY, _L("AMS(4 colors)"));
|
||||
txt4->SetFont(Label::Body_14);
|
||||
txt4->SetForegroundColour(0x6B6B6B);
|
||||
auto txt1 = new wxStaticText(this, wxID_ANY, _L("AMS(single color)"));
|
||||
txt1->SetFont(Label::Body_14);
|
||||
txt1->SetForegroundColour(0x6B6B6B);
|
||||
int ams4 = 0, ams1 = 0;
|
||||
GetAMSCount(index, ams4, ams1);
|
||||
auto val4 = new SpinInput(this, {}, {}, wxDefaultPosition, {FromDIP(60), -1}, 0, 0, 4, ams4);
|
||||
|
@ -646,6 +649,13 @@ public:
|
|||
Layout();
|
||||
Fit();
|
||||
|
||||
Bind(wxEVT_PAINT, [this](wxPaintEvent& evt) {
|
||||
wxPaintDC dc(this);
|
||||
dc.SetPen(wxColour(0xEEEEEE));
|
||||
dc.SetBrush(*wxTRANSPARENT_BRUSH);
|
||||
dc.DrawRoundedRectangle(0, 0, GetSize().x, GetSize().y, 0);
|
||||
});
|
||||
|
||||
SetBackgroundColour(*wxWHITE);
|
||||
wxGetApp().UpdateDarkUIWin(this);
|
||||
}
|
||||
|
@ -955,9 +965,9 @@ Sidebar::Sidebar(Plater *parent)
|
|||
auto printer_tab = dynamic_cast<TabPrinter*>(wxGetApp().get_tab(Preset::TYPE_PRINTER));
|
||||
printer_tab->set_extruder_volume_type(index, NozzleVolumeType(intptr_t(nozzle_type_list->GetClientData(evt.GetInt()))));
|
||||
});
|
||||
nozzle_sizer->Add(nozzle_title, 2, wxLEFT | wxALIGN_CENTER_VERTICAL, FromDIP(10));
|
||||
nozzle_sizer->Add(nozzle_type_list, 3, wxLEFT | wxEXPAND, FromDIP(10));
|
||||
static_box_sizer->Add(nozzle_sizer, 0, wxTOP | wxEXPAND, FromDIP(5));
|
||||
nozzle_sizer->Add(nozzle_title, 2, wxLEFT | wxALIGN_CENTER_VERTICAL, FromDIP(8));
|
||||
nozzle_sizer->Add(nozzle_type_list, 3, wxLEFT | wxEXPAND);
|
||||
static_box_sizer->Add(nozzle_sizer, 0, wxEXPAND);
|
||||
// AMS count
|
||||
wxBoxSizer * ams_count_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxStaticText *ams_count_title = new wxStaticText(static_box, wxID_ANY, _L("AMS"));
|
||||
|
@ -977,10 +987,10 @@ Sidebar::Sidebar(Plater *parent)
|
|||
window->Popup();
|
||||
});
|
||||
ams_count_edit->SetBackgroundColour(*wxWHITE);
|
||||
ams_count_sizer->Add(ams_count_title, 2, wxLEFT | wxALIGN_CENTER_VERTICAL, FromDIP(10));
|
||||
ams_count_sizer->Add(ams_count_text, 1, wxLEFT | wxEXPAND, FromDIP(10));
|
||||
ams_count_sizer->Add(ams_count_edit, 2, wxLEFT | wxEXPAND, FromDIP(10));
|
||||
static_box_sizer->Add(ams_count_sizer, 0, wxTOP | wxBOTTOM | wxEXPAND, FromDIP(5));
|
||||
ams_count_sizer->Add(ams_count_title, 2, wxLEFT | wxALIGN_CENTER_VERTICAL, FromDIP(8));
|
||||
ams_count_sizer->Add(ams_count_text, 1, wxLEFT | wxEXPAND);
|
||||
ams_count_sizer->Add(ams_count_edit, 2, wxLEFT | wxEXPAND);
|
||||
static_box_sizer->Add(ams_count_sizer, 0, wxTOP | wxEXPAND, FromDIP(8));
|
||||
p->m_dual_extruder_sizer->Add(static_box_sizer, 1, wxEXPAND);
|
||||
return std::make_pair(nozzle_type_list, ams_count_text);
|
||||
};
|
||||
|
@ -998,16 +1008,22 @@ Sidebar::Sidebar(Plater *parent)
|
|||
extruder_btn->SetFont(Label::Body_8);
|
||||
extruder_btn->SetToolTip(_L("Synchronize nozzle information and the number of AMS"));
|
||||
extruder_btn->SetCornerRadius(0);
|
||||
extruder_btn->SetBorderColor(0xE4E4E4);
|
||||
StateColor extruder_btn_bg_col(std::pair<wxColour, int>(wxColour(0xCECECE), StateColor::Pressed),
|
||||
std::pair<wxColour, int>(wxColour(0xF8F8F8), StateColor::Hovered),
|
||||
std::pair<wxColour, int>(wxColour(0xF8F8F8), StateColor::Normal));
|
||||
StateColor extruder_btn_bd_col(std::pair<wxColour, int>(wxColour(0x00AE42), StateColor::Pressed),
|
||||
std::pair<wxColour, int>(wxColour(0x00AE42), StateColor::Hovered),
|
||||
std::pair<wxColour, int>(wxColour(0xEEEEEE), StateColor::Normal));
|
||||
extruder_btn->SetBackgroundColor(extruder_btn_bg_col);
|
||||
extruder_btn->SetBorderColor(extruder_btn_bd_col);
|
||||
extruder_btn->SetPaddingSize({FromDIP(6), FromDIP(12)});
|
||||
extruder_btn->SetMinSize({FromDIP(48), FromDIP(68)});
|
||||
extruder_btn->SetMinSize({FromDIP(48), FromDIP(68)});
|
||||
extruder_btn->SetMaxSize({FromDIP(48), FromDIP(82)});
|
||||
extruder_btn->SetMaxSize({FromDIP(48), FromDIP(68)});
|
||||
extruder_btn->SetVertical();
|
||||
extruder_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) { p->sync_extruder_list(); });
|
||||
p->m_extruder_sync = extruder_btn;
|
||||
p->m_dual_extruder_sizer->Add(FromDIP(2), 0);
|
||||
p->m_dual_extruder_sizer->Add(extruder_btn, 0, wxEXPAND);
|
||||
p->m_dual_extruder_sizer->Add(extruder_btn, 0, wxTOP | wxEXPAND, FromDIP(6));
|
||||
p->m_dual_extruder_sizer->Add(FromDIP(10), 0);
|
||||
|
||||
vsizer_printer->Add(p->m_dual_extruder_sizer, 0, wxEXPAND | wxTOP, FromDIP(5));
|
||||
|
@ -1700,8 +1716,7 @@ void Sidebar::msw_rescale()
|
|||
|
||||
p->m_extruder_sync->SetPaddingSize({FromDIP(6), FromDIP(12)});
|
||||
p->m_extruder_sync->SetMinSize({FromDIP(48), FromDIP(68)});
|
||||
p->m_extruder_sync->SetMinSize({FromDIP(48), FromDIP(68)});
|
||||
p->m_extruder_sync->SetMaxSize({FromDIP(48), FromDIP(82)});
|
||||
p->m_extruder_sync->SetMaxSize({FromDIP(48), FromDIP(68)});
|
||||
p->m_extruder_sync->Rescale();
|
||||
#if 0
|
||||
if (p->mode_sizer)
|
||||
|
|
|
@ -109,7 +109,7 @@ wxMenuItem* append_menu_item(wxMenu* menu, int id, const wxString& string, const
|
|||
}
|
||||
|
||||
wxMenuItem* append_submenu(wxMenu* menu, wxMenu* sub_menu, int id, const wxString& string, const wxString& description, const std::string& icon,
|
||||
std::function<bool()> const cb_condition, wxWindow* parent)
|
||||
std::function<bool()> const cb_condition, wxWindow* parent, int insert_pos)
|
||||
{
|
||||
if (id == wxID_ANY)
|
||||
id = wxNewId();
|
||||
|
@ -123,7 +123,10 @@ wxMenuItem* append_submenu(wxMenu* menu, wxMenu* sub_menu, int id, const wxStrin
|
|||
#endif /* __WXMSW__ */
|
||||
}
|
||||
|
||||
menu->Append(item);
|
||||
if (insert_pos == wxNOT_FOUND)
|
||||
menu->Append(item);
|
||||
else
|
||||
menu->Insert(insert_pos, item);
|
||||
|
||||
if (parent) {
|
||||
parent->Bind(wxEVT_UPDATE_UI, [cb_condition, item, parent](wxUpdateUIEvent& evt) {
|
||||
|
|
|
@ -34,7 +34,7 @@ wxMenuItem* append_menu_item(wxMenu* menu, int id, const wxString& string, const
|
|||
|
||||
wxMenuItem* append_submenu(wxMenu* menu, wxMenu* sub_menu, int id, const wxString& string, const wxString& description,
|
||||
const std::string& icon = "",
|
||||
std::function<bool()> const cb_condition = []() { return true; }, wxWindow* parent = nullptr);
|
||||
std::function<bool()> const cb_condition = []() { return true; }, wxWindow* parent = nullptr, int insert_pos = wxNOT_FOUND);
|
||||
|
||||
wxMenuItem* append_menu_radio_item(wxMenu* menu, int id, const wxString& string, const wxString& description,
|
||||
std::function<void(wxCommandEvent& event)> cb, wxEvtHandler* event_handler);
|
||||
|
|
Loading…
Reference in New Issue