ENH: enable pop up when slice btn is disabled
1. Enable hover and pop up even if slice btn is disabled. Always trigger background process schedule jira: NONE Signed-off-by: xun.zhang <xun.zhang@bambulab.com> Change-Id: Ie9c63c952eeb0f8a7611dd9929e656360609d11a
This commit is contained in:
parent
f2060935fc
commit
9340b4f89e
|
@ -281,11 +281,12 @@ void FilamentGroupPopup::OnRadioBtn(int idx)
|
|||
{
|
||||
if (mode_list.at(idx) == FilamentMapMode::fmmAutoForMatch && !m_connected)
|
||||
return;
|
||||
m_mode = mode_list.at(idx);
|
||||
|
||||
SetFilamentMapMode(m_mode);
|
||||
|
||||
UpdateButtonStatus(m_mode);
|
||||
if (m_mode != mode_list.at(idx)) {
|
||||
m_mode = mode_list.at(idx);
|
||||
SetFilamentMapMode(m_mode);
|
||||
plater_ref->schedule_background_process();
|
||||
UpdateButtonStatus(m_mode);
|
||||
}
|
||||
}
|
||||
|
||||
void FilamentGroupPopup::OnTimer(wxTimerEvent &event) { Dismiss(); }
|
||||
|
|
|
@ -1576,26 +1576,62 @@ wxBoxSizer* MainFrame::create_side_tools()
|
|||
m_slice_select = eSlicePlate;
|
||||
m_print_select = ePrintPlate;
|
||||
|
||||
m_slice_btn = new SideButton(this, _L("Slice plate"), "");
|
||||
m_slice_option_btn = new SideButton(this, "", "sidebutton_dropdown", 0, FromDIP(14));
|
||||
m_print_btn = new SideButton(this, _L("Print plate"), "");
|
||||
m_print_option_btn = new SideButton(this, "", "sidebutton_dropdown", 0, FromDIP(14));
|
||||
auto slice_panel = new wxPanel(this,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxTRANSPARENT_WINDOW);
|
||||
auto print_panel = new wxPanel(this,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxTRANSPARENT_WINDOW);
|
||||
|
||||
m_slice_btn = new SideButton(slice_panel, _L("Slice plate"), "");
|
||||
m_slice_option_btn = new SideButton(slice_panel, "", "sidebutton_dropdown", 0, FromDIP(14));
|
||||
m_print_btn = new SideButton(print_panel, _L("Print plate"), "");
|
||||
m_print_option_btn = new SideButton(print_panel, "", "sidebutton_dropdown", 0, FromDIP(14));
|
||||
|
||||
auto slice_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
slice_sizer->Add(m_slice_option_btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, FromDIP(1));
|
||||
slice_sizer->Add(m_slice_btn, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, FromDIP(1));
|
||||
slice_panel->SetSizer(slice_sizer);
|
||||
|
||||
auto print_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
print_sizer->Add(m_print_option_btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, FromDIP(1));
|
||||
print_sizer->Add(m_print_btn, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, FromDIP(1));
|
||||
print_panel->SetSizer(print_sizer);
|
||||
|
||||
update_side_button_style();
|
||||
m_slice_option_btn->Enable();
|
||||
m_print_option_btn->Enable();
|
||||
sizer->Add(FromDIP(15), 0, 0, 0, 0);
|
||||
sizer->Add(m_slice_option_btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, FromDIP(1));
|
||||
sizer->Add(m_slice_btn, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, FromDIP(1));
|
||||
sizer->Add(slice_panel);
|
||||
sizer->Add(FromDIP(15), 0, 0, 0, 0);
|
||||
sizer->Add(m_print_option_btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, FromDIP(1));
|
||||
sizer->Add(m_print_btn, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, FromDIP(1));
|
||||
sizer->Add(print_panel);
|
||||
sizer->Add(FromDIP(19), 0, 0, 0, 0);
|
||||
|
||||
sizer->Layout();
|
||||
|
||||
m_filament_group_popup = new FilamentGroupPopup(m_slice_btn);
|
||||
|
||||
auto try_hover_pop_up = [this]() {
|
||||
wxPoint pos = m_slice_btn->ClientToScreen(wxPoint(0, 0));
|
||||
pos.y += m_slice_btn->GetRect().height * 1.25;
|
||||
pos.x -= (m_slice_option_btn->GetRect().width + FromDIP(380) * 0.6);
|
||||
auto curr_plate = this->m_plater->get_partplate_list().get_curr_plate();
|
||||
m_filament_group_popup->SetPosition(pos);
|
||||
m_filament_group_popup->tryPopup(m_plater, curr_plate, m_slice_select == eSliceAll);
|
||||
};
|
||||
|
||||
slice_panel->Bind(wxEVT_ENTER_WINDOW, [this,try_hover_pop_up](auto& event) {
|
||||
try_hover_pop_up();
|
||||
});
|
||||
|
||||
slice_panel->Bind(wxEVT_LEAVE_WINDOW, [this](auto& event) {
|
||||
m_filament_group_popup->tryClose();
|
||||
});
|
||||
|
||||
m_slice_btn->Bind(wxEVT_ENTER_WINDOW, [this,try_hover_pop_up](auto& event) {
|
||||
try_hover_pop_up();
|
||||
});
|
||||
|
||||
m_slice_btn->Bind(wxEVT_LEAVE_WINDOW, [this](auto& event) {
|
||||
m_filament_group_popup->tryClose();
|
||||
});
|
||||
|
||||
m_slice_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent& event)
|
||||
{
|
||||
m_plater->reset_check_status();
|
||||
|
@ -1620,22 +1656,6 @@ wxBoxSizer* MainFrame::create_side_tools()
|
|||
}
|
||||
});
|
||||
|
||||
m_slice_btn->Bind(wxEVT_ENTER_WINDOW, [this](wxMouseEvent& event) {
|
||||
wxPoint pos = m_slice_btn->ClientToScreen(wxPoint(0, 0));
|
||||
pos.y += m_slice_btn->GetRect().height * 1.25;
|
||||
pos.x -= (m_slice_option_btn->GetRect().width + FromDIP(380) * 0.6);
|
||||
|
||||
auto curr_plate=this->m_plater->get_partplate_list().get_curr_plate();
|
||||
|
||||
m_filament_group_popup->SetPosition(pos);
|
||||
m_filament_group_popup->tryPopup(m_plater,curr_plate, m_slice_select == eSliceAll);
|
||||
});
|
||||
|
||||
m_slice_btn->Bind(wxEVT_LEAVE_WINDOW, [this](auto& event) {
|
||||
m_filament_group_popup->tryClose();
|
||||
});
|
||||
|
||||
|
||||
m_print_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent& event)
|
||||
{
|
||||
//this->m_plater->select_view_3D("Preview");
|
||||
|
|
Loading…
Reference in New Issue