ENH: optimize the auto-calc button position
Signed-off-by: yifan.wu <yifan.wu@bambulab.com> Change-Id: I8e7be08048305b5e519400e2b35a0ebaf0f21ba7
This commit is contained in:
parent
ebec542112
commit
5c9c72ee72
|
@ -98,18 +98,6 @@ wxBoxSizer* WipingDialog::create_btn_sizer(long flags)
|
||||||
std::pair<wxColour, int>(wxColour(255, 255, 255), StateColor::Normal)
|
std::pair<wxColour, int>(wxColour(255, 255, 255), StateColor::Normal)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (flags & wxRESET) {
|
|
||||||
Button* calc_btn = new Button(this, _L("Auto-Calc"));
|
|
||||||
calc_btn->SetMinSize(wxSize(FromDIP(75), FromDIP(24)));
|
|
||||||
calc_btn->SetCornerRadius(FromDIP(12));
|
|
||||||
calc_btn->SetBackgroundColor(ok_btn_bg);
|
|
||||||
calc_btn->SetBorderColor(ok_btn_bd);
|
|
||||||
calc_btn->SetTextColor(wxColour("#FFFFFE"));
|
|
||||||
calc_btn->SetFocus();
|
|
||||||
calc_btn->SetId(wxID_RESET);
|
|
||||||
btn_sizer->Add(calc_btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, BTN_GAP);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flags & wxOK) {
|
if (flags & wxOK) {
|
||||||
Button* ok_btn = new Button(this, _L("OK"));
|
Button* ok_btn = new Button(this, _L("OK"));
|
||||||
ok_btn->SetMinSize(BTN_SIZE);
|
ok_btn->SetMinSize(BTN_SIZE);
|
||||||
|
@ -144,7 +132,32 @@ WipingDialog::WipingDialog(wxWindow* parent, const std::vector<float>& matrix, c
|
||||||
this->SetBackgroundColour(*wxWHITE);
|
this->SetBackgroundColour(*wxWHITE);
|
||||||
this->SetMinSize(wxSize(MIN_WIPING_DIALOG_WIDTH, -1));
|
this->SetMinSize(wxSize(MIN_WIPING_DIALOG_WIDTH, -1));
|
||||||
|
|
||||||
m_panel_wiping = new WipingPanel(this, matrix, extruders, extruder_colours, nullptr, extra_flush_volume, flush_multiplier);
|
// BBS
|
||||||
|
StateColor calc_btn_bg(
|
||||||
|
std::pair<wxColour, int>(wxColour(27, 136, 68), StateColor::Pressed),
|
||||||
|
std::pair<wxColour, int>(wxColour(61, 203, 115), StateColor::Hovered),
|
||||||
|
std::pair<wxColour, int>(wxColour(0, 174, 66), StateColor::Normal)
|
||||||
|
);
|
||||||
|
|
||||||
|
StateColor calc_btn_bd(
|
||||||
|
std::pair<wxColour, int>(wxColour(0, 174, 66), StateColor::Normal)
|
||||||
|
);
|
||||||
|
|
||||||
|
StateColor calc_btn_text(
|
||||||
|
std::pair<wxColour, int>(wxColour(255, 255, 255), StateColor::Normal)
|
||||||
|
);
|
||||||
|
|
||||||
|
Button* calc_btn = new Button(this, _L("Auto-Calc"));
|
||||||
|
calc_btn->SetMinSize(wxSize(FromDIP(75), FromDIP(24)));
|
||||||
|
calc_btn->SetCornerRadius(FromDIP(12));
|
||||||
|
calc_btn->SetBackgroundColor(calc_btn_bg);
|
||||||
|
calc_btn->SetBorderColor(calc_btn_bd);
|
||||||
|
calc_btn->SetTextColor(calc_btn_text);
|
||||||
|
calc_btn->SetFocus();
|
||||||
|
calc_btn->SetId(wxID_RESET);
|
||||||
|
calc_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent&) { m_panel_wiping->calc_flushing_volumes(); });
|
||||||
|
|
||||||
|
m_panel_wiping = new WipingPanel(this, matrix, extruders, extruder_colours, calc_btn, extra_flush_volume, flush_multiplier);
|
||||||
|
|
||||||
auto main_sizer = new wxBoxSizer(wxVERTICAL);
|
auto main_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
|
||||||
|
@ -155,7 +168,7 @@ WipingDialog::WipingDialog(wxWindow* parent, const std::vector<float>& matrix, c
|
||||||
|
|
||||||
main_sizer->Add(m_panel_wiping, 1, wxEXPAND | wxALL, 0);
|
main_sizer->Add(m_panel_wiping, 1, wxEXPAND | wxALL, 0);
|
||||||
|
|
||||||
auto btn_sizer = create_btn_sizer(wxOK | wxCANCEL | wxRESET);
|
auto btn_sizer = create_btn_sizer(wxOK | wxCANCEL);
|
||||||
main_sizer->Add(btn_sizer, 0, wxBOTTOM | wxRIGHT | wxEXPAND, BTN_GAP);
|
main_sizer->Add(btn_sizer, 0, wxBOTTOM | wxRIGHT | wxEXPAND, BTN_GAP);
|
||||||
SetSizer(main_sizer);
|
SetSizer(main_sizer);
|
||||||
main_sizer->SetSizeHints(this);
|
main_sizer->SetSizeHints(this);
|
||||||
|
@ -172,9 +185,6 @@ WipingDialog::WipingDialog(wxWindow* parent, const std::vector<float>& matrix, c
|
||||||
this->FindWindowById(wxID_CANCEL, this)->Bind(wxEVT_BUTTON, [this](wxCommandEvent&) { EndModal(wxCANCEL); });
|
this->FindWindowById(wxID_CANCEL, this)->Bind(wxEVT_BUTTON, [this](wxCommandEvent&) { EndModal(wxCANCEL); });
|
||||||
|
|
||||||
}
|
}
|
||||||
if (this->FindWindowById(wxID_RESET, this)) {
|
|
||||||
this->FindWindowById(wxID_RESET, this)->Bind(wxEVT_BUTTON, [this](wxCommandEvent&) { m_panel_wiping->calc_flushing_volumes(); });
|
|
||||||
}
|
|
||||||
this->Bind(wxEVT_CLOSE_WINDOW, [this](wxCloseEvent& e) { EndModal(wxCANCEL); });
|
this->Bind(wxEVT_CLOSE_WINDOW, [this](wxCloseEvent& e) { EndModal(wxCANCEL); });
|
||||||
this->Bind(wxEVT_CHAR_HOOK, [this](wxKeyEvent& e) {
|
this->Bind(wxEVT_CHAR_HOOK, [this](wxKeyEvent& e) {
|
||||||
if (e.GetKeyCode() == WXK_ESCAPE) {
|
if (e.GetKeyCode() == WXK_ESCAPE) {
|
||||||
|
@ -223,14 +233,10 @@ void WipingPanel::create_panels(wxWindow* parent, const int num) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// This panel contains all control widgets for both simple and advanced mode (these reside in separate sizers)
|
// This panel contains all control widgets for both simple and advanced mode (these reside in separate sizers)
|
||||||
WipingPanel::WipingPanel(wxWindow* parent, const std::vector<float>& matrix, const std::vector<float>& extruders, const std::vector<std::string>& extruder_colours, wxButton* widget_button,
|
WipingPanel::WipingPanel(wxWindow* parent, const std::vector<float>& matrix, const std::vector<float>& extruders, const std::vector<std::string>& extruder_colours, Button* calc_button,
|
||||||
int extra_flush_volume, float flush_multiplier)
|
int extra_flush_volume, float flush_multiplier)
|
||||||
: wxPanel(parent,wxID_ANY, wxDefaultPosition, wxDefaultSize/*,wxBORDER_RAISED*/), m_min_flush_volume(extra_flush_volume), m_max_flush_volume(800)
|
: wxPanel(parent,wxID_ANY, wxDefaultPosition, wxDefaultSize/*,wxBORDER_RAISED*/), m_min_flush_volume(extra_flush_volume), m_max_flush_volume(800)
|
||||||
{
|
{
|
||||||
// BBS: toggle button is removed
|
|
||||||
//m_widget_button = widget_button; // pointer to the button in parent dialog
|
|
||||||
//m_widget_button->Bind(wxEVT_BUTTON,[this](wxCommandEvent&){ toggle_advanced(true); });
|
|
||||||
|
|
||||||
m_number_of_extruders = (int)(sqrt(matrix.size())+0.001);
|
m_number_of_extruders = (int)(sqrt(matrix.size())+0.001);
|
||||||
|
|
||||||
for (const std::string& color : extruder_colours) {
|
for (const std::string& color : extruder_colours) {
|
||||||
|
@ -323,6 +329,7 @@ WipingPanel::WipingPanel(wxWindow* parent, const std::vector<float>& matrix, con
|
||||||
auto info_str = new wxStaticText(m_page_advanced, wxID_ANY, _(L("Flushing volume (mm³) for each filament pair.")), wxDefaultPosition, wxDefaultSize, 0);
|
auto info_str = new wxStaticText(m_page_advanced, wxID_ANY, _(L("Flushing volume (mm³) for each filament pair.")), wxDefaultPosition, wxDefaultSize, 0);
|
||||||
info_str->SetForegroundColour(g_text_color);
|
info_str->SetForegroundColour(g_text_color);
|
||||||
m_sizer_advanced->Add(info_str, 0, wxEXPAND | wxLEFT, TEXT_BEG_PADDING);
|
m_sizer_advanced->Add(info_str, 0, wxEXPAND | wxLEFT, TEXT_BEG_PADDING);
|
||||||
|
m_sizer_advanced->Add(calc_button, 0, wxALIGN_RIGHT | wxRIGHT, TEXT_BEG_PADDING);
|
||||||
m_sizer_advanced->AddSpacer(BTN_SIZE.y);
|
m_sizer_advanced->AddSpacer(BTN_SIZE.y);
|
||||||
|
|
||||||
// BBS: for tunning flush volumes
|
// BBS: for tunning flush volumes
|
||||||
|
@ -591,9 +598,6 @@ void WipingPanel::calc_flushing_volumes()
|
||||||
return support_option->get_at(0);
|
return support_option->get_at(0);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Calculate flush volumes for flush_multiplier 1.0
|
|
||||||
m_flush_multiplier_ebox->SetValue("1.0");
|
|
||||||
|
|
||||||
for (int from_idx = 0; from_idx < m_colours.size(); from_idx++) {
|
for (int from_idx = 0; from_idx < m_colours.size(); from_idx++) {
|
||||||
const wxColour& from = m_colours[from_idx];
|
const wxColour& from = m_colours[from_idx];
|
||||||
bool is_from_support = is_support_filament(from_idx);
|
bool is_from_support = is_support_filament(from_idx);
|
||||||
|
|
|
@ -7,9 +7,12 @@
|
||||||
#include <wx/checkbox.h>
|
#include <wx/checkbox.h>
|
||||||
#include <wx/msgdlg.h>
|
#include <wx/msgdlg.h>
|
||||||
|
|
||||||
|
class Button;
|
||||||
|
|
||||||
class WipingPanel : public wxPanel {
|
class WipingPanel : public wxPanel {
|
||||||
public:
|
public:
|
||||||
WipingPanel(wxWindow* parent, const std::vector<float>& matrix, const std::vector<float>& extruders, const std::vector<std::string>& extruder_colours, wxButton* widget_button,
|
// BBS
|
||||||
|
WipingPanel(wxWindow* parent, const std::vector<float>& matrix, const std::vector<float>& extruders, const std::vector<std::string>& extruder_colours, Button* calc_button,
|
||||||
int extra_flush_volume, float flush_multiplier);
|
int extra_flush_volume, float flush_multiplier);
|
||||||
std::vector<float> read_matrix_values();
|
std::vector<float> read_matrix_values();
|
||||||
std::vector<float> read_extruders_values();
|
std::vector<float> read_extruders_values();
|
||||||
|
|
Loading…
Reference in New Issue