NEW:[STUDIO-4063] auto calculate flushing volumes
jira: STUDIO-4063 Change-Id: If8db1375bc8c17d4c86307c1c93a717f6c0df05a
This commit is contained in:
parent
042e6bf991
commit
9a193fbfea
|
@ -241,6 +241,10 @@ void AppConfig::set_defaults()
|
|||
if (get("show_daily_tips").empty()) {
|
||||
set_bool("show_daily_tips", true);
|
||||
}
|
||||
//true is auto calculate
|
||||
if (get("auto_calculate").empty()) {
|
||||
set_bool("auto_calculate", true);
|
||||
}
|
||||
|
||||
if (get("show_home_page").empty()) {
|
||||
set_bool("show_home_page", true);
|
||||
|
|
|
@ -806,6 +806,7 @@ Sidebar::Sidebar(Plater *parent)
|
|||
wxGetApp().plater()->on_filaments_change(filament_count);
|
||||
wxGetApp().get_tab(Preset::TYPE_PRINT)->update();
|
||||
wxGetApp().preset_bundle->export_selections(*wxGetApp().app_config);
|
||||
auto_calc_flushing_volumes(filament_count - 1);
|
||||
});
|
||||
p->m_bpButton_add_filament = add_btn;
|
||||
|
||||
|
@ -1745,6 +1746,78 @@ std::string& Sidebar::get_search_line()
|
|||
return p->searcher.search_string();
|
||||
}
|
||||
|
||||
void Sidebar::auto_calc_flushing_volumes(const int modify_id) {
|
||||
auto& project_config = wxGetApp().preset_bundle->project_config;
|
||||
auto& printer_config = wxGetApp().preset_bundle->printers.get_edited_preset().config;
|
||||
const std::vector<double>& init_matrix = (project_config.option<ConfigOptionFloats>("flush_volumes_matrix"))->values;
|
||||
const std::vector<double>& init_extruders = (project_config.option<ConfigOptionFloats>("flush_volumes_vector"))->values;
|
||||
ConfigOption* extra_flush_volume_opt = printer_config.option("nozzle_volume");
|
||||
int extra_flush_volume = extra_flush_volume_opt ? (int)extra_flush_volume_opt->getFloat() : 0;
|
||||
ConfigOptionFloat* flush_multi_opt = project_config.option<ConfigOptionFloat>("flush_multiplier");
|
||||
float flush_multiplier = flush_multi_opt ? flush_multi_opt->getFloat() : 1.f;
|
||||
vector<double> matrix = init_matrix;
|
||||
int m_min_flush_volume = extra_flush_volume;
|
||||
int m_max_flush_volume = Slic3r::g_max_flush_volume;
|
||||
unsigned int m_number_of_extruders = (int)(sqrt(init_matrix.size()) + 0.001);
|
||||
const std::vector<std::string> extruder_colours = wxGetApp().plater()->get_extruder_colors_from_plater_config();
|
||||
vector<wxColour> m_colours;
|
||||
for (const std::string& color : extruder_colours) {
|
||||
m_colours.push_back(wxColor(color));
|
||||
}
|
||||
if (modify_id >= 0 && modify_id < m_colours.size()) {
|
||||
for (int i = 0; i < m_colours.size(); ++i) {
|
||||
int from_idx = i;
|
||||
if (from_idx != modify_id) {
|
||||
const wxColour& from = m_colours[from_idx];
|
||||
bool is_from_support = is_support_filament(from_idx);
|
||||
const wxColour& to = m_colours[modify_id];
|
||||
bool is_to_support = is_support_filament(modify_id);
|
||||
int flushing_volume = 0;
|
||||
if (is_to_support) {
|
||||
flushing_volume = Slic3r::g_flush_volume_to_support;
|
||||
}
|
||||
else {
|
||||
const wxColour& to = m_colours[modify_id];
|
||||
Slic3r::FlushVolCalculator calculator(m_min_flush_volume, m_max_flush_volume);
|
||||
flushing_volume = calculator.calc_flush_vol(from.Alpha(), from.Red(), from.Green(), from.Blue(), to.Alpha(), to.Red(), to.Green(), to.Blue());
|
||||
if (is_from_support) {
|
||||
flushing_volume = std::max(Slic3r::g_min_flush_volume_from_support, flushing_volume);
|
||||
}
|
||||
}
|
||||
matrix[m_number_of_extruders * from_idx + modify_id] = flushing_volume;
|
||||
}
|
||||
int to_idx = i;
|
||||
if (to_idx != modify_id) {
|
||||
const wxColour& from = m_colours[modify_id];
|
||||
bool is_from_support = is_support_filament(modify_id);
|
||||
const wxColour& to = m_colours[to_idx];
|
||||
bool is_to_support = is_support_filament(to_idx);
|
||||
int flushing_volume = 0;
|
||||
if (is_to_support) {
|
||||
flushing_volume = Slic3r::g_flush_volume_to_support;
|
||||
}
|
||||
else {
|
||||
const wxColour& to = m_colours[to_idx];
|
||||
Slic3r::FlushVolCalculator calculator(m_min_flush_volume, m_max_flush_volume);
|
||||
flushing_volume = calculator.calc_flush_vol(from.Alpha(), from.Red(), from.Green(), from.Blue(), to.Alpha(), to.Red(), to.Green(), to.Blue());
|
||||
if (is_from_support) {
|
||||
flushing_volume = std::max(Slic3r::g_min_flush_volume_from_support, flushing_volume);
|
||||
}
|
||||
}
|
||||
matrix[m_number_of_extruders * modify_id + to_idx] = flushing_volume;
|
||||
}
|
||||
}
|
||||
}
|
||||
(project_config.option<ConfigOptionFloats>("flush_volumes_matrix"))->values = std::vector<double>(matrix.begin(), matrix.end());
|
||||
|
||||
|
||||
wxGetApp().preset_bundle->export_selections(*wxGetApp().app_config);
|
||||
|
||||
wxGetApp().plater()->update_project_dirty_from_presets();
|
||||
wxPostEvent(this, SimpleEvent(EVT_SCHEDULE_BACKGROUND_PROCESS, this));
|
||||
}
|
||||
|
||||
|
||||
// Plater::DropTarget
|
||||
|
||||
class PlaterDropTarget : public wxFileDropTarget
|
||||
|
@ -5801,6 +5874,7 @@ void Plater::priv::on_select_preset(wxCommandEvent &evt)
|
|||
plate_object.emplace_back(obj_idxs);
|
||||
}
|
||||
|
||||
bool flag = is_support_filament(idx);
|
||||
//! Because of The MSW and GTK version of wxBitmapComboBox derived from wxComboBox,
|
||||
//! but the OSX version derived from wxOwnerDrawnCombo.
|
||||
//! So, to get selected string we do
|
||||
|
@ -5816,8 +5890,11 @@ void Plater::priv::on_select_preset(wxCommandEvent &evt)
|
|||
wxGetApp().plater()->update_project_dirty_from_presets();
|
||||
wxGetApp().preset_bundle->export_selections(*wxGetApp().app_config);
|
||||
dynamic_filament_list.update();
|
||||
bool flag_is_change = is_support_filament(idx);
|
||||
if (flag != flag_is_change) {
|
||||
sidebar->auto_calc_flushing_volumes(idx);
|
||||
}
|
||||
}
|
||||
|
||||
bool select_preset = !combo->selection_is_changed_according_to_physical_printers();
|
||||
// TODO: ?
|
||||
if (preset_type == Preset::TYPE_FILAMENT && sidebar->is_multifilament()) {
|
||||
|
@ -6567,6 +6644,10 @@ void Plater::priv::on_filament_color_changed(wxCommandEvent &event)
|
|||
{
|
||||
//q->update_all_plate_thumbnails(true);
|
||||
//q->get_preview_canvas3D()->update_plate_thumbnails();
|
||||
if (wxGetApp().app_config->get("auto_calculate") == "true") {
|
||||
int modify_id = event.GetInt();
|
||||
sidebar->auto_calc_flushing_volumes(modify_id);
|
||||
}
|
||||
}
|
||||
|
||||
void Plater::priv::install_network_plugin(wxCommandEvent &event)
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "libslic3r/Model.hpp"
|
||||
#include "libslic3r/PrintBase.hpp"
|
||||
#include "libslic3r/Calib.hpp"
|
||||
#include "libslic3r/FlushVolCalc.hpp"
|
||||
|
||||
#define FILAMENT_SYSTEM_COLORS_NUM 16
|
||||
|
||||
|
@ -157,7 +158,7 @@ public:
|
|||
void update_ui_from_settings();
|
||||
bool show_object_list(bool show) const;
|
||||
void finish_param_edit();
|
||||
|
||||
void auto_calc_flushing_volumes(const int modify_id);
|
||||
#ifdef _MSW_DARK_MODE
|
||||
void show_mode_sizer(bool show);
|
||||
#endif
|
||||
|
|
|
@ -628,7 +628,7 @@ wxBoxSizer *PreferencesDialog::create_item_checkbox(wxString title, wxWindow *pa
|
|||
checkbox_title->SetFont(::Label::Body_13);
|
||||
|
||||
auto size = checkbox_title->GetTextExtent(title);
|
||||
checkbox_title->SetMinSize(wxSize(size.x + FromDIP(4), -1));
|
||||
checkbox_title->SetMinSize(wxSize(size.x + FromDIP(5), -1));
|
||||
checkbox_title->Wrap(-1);
|
||||
m_sizer_checkbox->Add(checkbox_title, 0, wxALIGN_CENTER | wxALL, 3);
|
||||
|
||||
|
@ -840,6 +840,19 @@ PreferencesDialog::PreferencesDialog(wxWindow *parent, wxWindowID id, const wxSt
|
|||
SetBackgroundColour(*wxWHITE);
|
||||
create();
|
||||
wxGetApp().UpdateDlgDarkUI(this);
|
||||
Bind(wxEVT_CLOSE_WINDOW, [this](wxCloseEvent& event) {
|
||||
try {
|
||||
NetworkAgent* agent = GUI::wxGetApp().getAgent();
|
||||
if (agent) {
|
||||
json j;
|
||||
std::string value;
|
||||
value = wxGetApp().app_config->get("auto_calculate");
|
||||
j["auto_flushing"] = value;
|
||||
agent->track_event("preferences_changed", j.dump());
|
||||
}
|
||||
} catch(...) {}
|
||||
Destroy();
|
||||
});
|
||||
}
|
||||
|
||||
void PreferencesDialog::create()
|
||||
|
@ -979,7 +992,7 @@ wxWindow* PreferencesDialog::create_general_page()
|
|||
auto item_mouse_zoom_settings = create_item_checkbox(_L("Zoom to mouse position"), page, _L("Zoom in towards the mouse pointer's position in the 3D view, rather than the 2D window center."), 50, "zoom_to_mouse");
|
||||
|
||||
auto item_hints = create_item_checkbox(_L("Show \"Tip of the day\" notification after start"), page, _L("If enabled, useful hints are displayed at startup."), 50, "show_hints");
|
||||
|
||||
auto item_calc_mode = create_item_checkbox(_L("Flushing volumes: Auto-calculate everytime the color changed."), page, _L("If enabled, auto-calculate everytime the color changed."), 50, "auto_calculate");
|
||||
auto title_presets = create_item_title(_L("Presets"), page, _L("Presets"));
|
||||
auto item_user_sync = create_item_checkbox(_L("Auto sync user presets(Printer/Filament/Process)"), page, _L("User Sync"), 50, "sync_user_preset");
|
||||
auto item_system_sync = create_item_checkbox(_L("Update built-in Presets automatically."), page, _L("System Sync"), 50, "sync_system_preset");
|
||||
|
@ -1036,6 +1049,7 @@ wxWindow* PreferencesDialog::create_general_page()
|
|||
sizer_page->Add(item_currency, 0, wxTOP, FromDIP(3));
|
||||
sizer_page->Add(item_mouse_zoom_settings, 0, wxTOP, FromDIP(3));
|
||||
sizer_page->Add(item_hints, 0, wxTOP, FromDIP(3));
|
||||
sizer_page->Add(item_calc_mode, 0, wxTOP, FromDIP(3));
|
||||
sizer_page->Add(title_presets, 0, wxTOP | wxEXPAND, FromDIP(20));
|
||||
sizer_page->Add(item_user_sync, 0, wxTOP, FromDIP(3));
|
||||
sizer_page->Add(item_system_sync, 0, wxTOP, FromDIP(3));
|
||||
|
|
|
@ -247,6 +247,7 @@ int PresetComboBox::update_ams_color()
|
|||
wxGetApp().plater()->on_config_change(new_cfg);
|
||||
//trigger the filament color changed
|
||||
wxCommandEvent *evt = new wxCommandEvent(EVT_FILAMENT_COLOR_CHANGED);
|
||||
evt->SetInt(m_filament_idx);
|
||||
wxQueueEvent(wxGetApp().plater(), evt);
|
||||
return idx;
|
||||
}
|
||||
|
@ -698,6 +699,7 @@ PlaterPresetComboBox::PlaterPresetComboBox(wxWindow *parent, Preset::Type preset
|
|||
wxGetApp().plater()->on_config_change(cfg_new);
|
||||
|
||||
wxCommandEvent *evt = new wxCommandEvent(EVT_FILAMENT_COLOR_CHANGED);
|
||||
evt->SetInt(m_filament_idx);
|
||||
wxQueueEvent(wxGetApp().plater(), evt);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include <wx/sizer.h>
|
||||
|
||||
|
||||
using namespace Slic3r::GUI;
|
||||
|
||||
int scale(const int val) { return val * Slic3r::GUI::wxGetApp().em_unit() / 10; }
|
||||
|
@ -31,9 +32,11 @@ static const wxColour g_text_color = wxColour(107, 107, 107, 255);
|
|||
#define ROW_END_PADDING FromDIP(21)
|
||||
#define BTN_SIZE wxSize(FromDIP(58), FromDIP(24))
|
||||
#define BTN_GAP FromDIP(20)
|
||||
#define TEXT_BEG_PADDING FromDIP(41)
|
||||
#define TEXT_BEG_PADDING FromDIP(30)
|
||||
#define MAX_FLUSH_VALUE 999
|
||||
#define MIN_WIPING_DIALOG_WIDTH FromDIP(400)
|
||||
#define MIN_WIPING_DIALOG_WIDTH FromDIP(300)
|
||||
#define TIP_MESSAGES_PADDING FromDIP(8)
|
||||
|
||||
|
||||
static void update_ui(wxWindow* window)
|
||||
{
|
||||
|
@ -136,6 +139,36 @@ wxBoxSizer* WipingDialog::create_btn_sizer(long flags)
|
|||
return btn_sizer;
|
||||
|
||||
}
|
||||
|
||||
wxBoxSizer* WipingPanel::create_calc_btn_sizer(wxWindow* parent) {
|
||||
auto btn_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
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, 254), StateColor::Normal)
|
||||
);
|
||||
|
||||
Button* calc_btn = new Button(parent, _L("Re-calculate"));
|
||||
calc_btn->SetFont(Label::Body_13);
|
||||
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();
|
||||
btn_sizer->Add(calc_btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, BTN_GAP);
|
||||
calc_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent&) { calc_flushing_volumes(); });
|
||||
|
||||
return btn_sizer;
|
||||
}
|
||||
void WipingDialog::on_dpi_changed(const wxRect &suggested_rect)
|
||||
{
|
||||
for (auto button_item : m_button_list)
|
||||
|
@ -168,21 +201,30 @@ WipingDialog::WipingDialog(wxWindow* parent, const std::vector<float>& matrix, c
|
|||
wxDefaultSize,
|
||||
wxDEFAULT_DIALOG_STYLE /* | wxRESIZE_BORDER*/)
|
||||
{
|
||||
std::string icon_path = (boost::format("%1%/images/BambuStudioTitle.ico") % Slic3r::resources_dir()).str();
|
||||
SetIcon(wxIcon(Slic3r::encode_path(icon_path.c_str()), wxBITMAP_TYPE_ICO));
|
||||
|
||||
SetBackgroundColour(*wxWHITE);
|
||||
|
||||
auto m_line_top = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(-1, 1));
|
||||
m_line_top->SetBackgroundColour(wxColour(166, 169, 170));
|
||||
|
||||
this->SetBackgroundColour(*wxWHITE);
|
||||
this->SetMinSize(wxSize(MIN_WIPING_DIALOG_WIDTH, -1));
|
||||
|
||||
|
||||
m_panel_wiping = new WipingPanel(this, matrix, extruders, extruder_colours, nullptr, extra_flush_volume, flush_multiplier);
|
||||
|
||||
auto main_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
main_sizer->Add(m_line_top, 0, wxEXPAND, 0);
|
||||
|
||||
// set min sizer width according to extruders count
|
||||
auto sizer_width = (int)((sqrt(matrix.size()) + 2.8)*ITEM_WIDTH());
|
||||
sizer_width = sizer_width > MIN_WIPING_DIALOG_WIDTH ? sizer_width : MIN_WIPING_DIALOG_WIDTH;
|
||||
main_sizer->SetMinSize(wxSize(sizer_width, -1));
|
||||
|
||||
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);
|
||||
SetSizer(main_sizer);
|
||||
main_sizer->SetSizeHints(this);
|
||||
|
@ -199,9 +241,13 @@ WipingDialog::WipingDialog(wxWindow* parent, const std::vector<float>& matrix, c
|
|||
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_CHAR_HOOK, [this](wxKeyEvent& e) {
|
||||
if (e.GetKeyCode() == WXK_ESCAPE) {
|
||||
|
@ -236,6 +282,7 @@ void WipingPanel::create_panels(wxWindow* parent, const int num) {
|
|||
for (unsigned int j = 0; j < num; ++j) {
|
||||
edit_boxes[j][i]->Reparent(panel);
|
||||
edit_boxes[j][i]->SetBackgroundColour(panel->GetBackgroundColour());
|
||||
edit_boxes[j][i]->SetFont(::Label::Body_14);
|
||||
sizer->AddSpacer(EDIT_BOXES_GAP);
|
||||
sizer->Add(edit_boxes[j][i], 0, wxALIGN_CENTER_VERTICAL, 0);
|
||||
}
|
||||
|
@ -259,7 +306,8 @@ WipingPanel::WipingPanel(wxWindow* parent, const std::vector<float>& matrix, con
|
|||
//Slic3r::GUI::BitmapCache::parse_color(color, rgb);
|
||||
m_colours.push_back(wxColor(color));
|
||||
}
|
||||
|
||||
auto sizer_width = (int)((sqrt(matrix.size())) * ITEM_WIDTH() + (sqrt(matrix.size()) + 1) * HEADER_BEG_PADDING);
|
||||
sizer_width = sizer_width > MIN_WIPING_DIALOG_WIDTH ? sizer_width : MIN_WIPING_DIALOG_WIDTH;
|
||||
// Create two switched panels with their own sizers
|
||||
m_sizer_simple = new wxBoxSizer(wxVERTICAL);
|
||||
m_sizer_advanced = new wxBoxSizer(wxVERTICAL);
|
||||
|
@ -319,6 +367,31 @@ WipingPanel::WipingPanel(wxWindow* parent, const std::vector<float>& matrix, con
|
|||
}
|
||||
|
||||
// BBS
|
||||
m_sizer_advanced->AddSpacer(FromDIP(10));
|
||||
tip_message_panel = new wxPanel(m_page_advanced, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
|
||||
tip_message_panel->SetBackgroundColour(wxColour(238, 238, 238));
|
||||
auto message_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
auto hyperlink_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
tip_message_panel->SetSizer(message_sizer);
|
||||
{
|
||||
wxString message = _L("Studio would re-calculate your flushing volumes everytime the filaments color changed. You could disable the auto-calculate in Bambu Studio > Preferences");
|
||||
m_tip_message_label = new Label(tip_message_panel, wxEmptyString);
|
||||
wxClientDC dc(tip_message_panel);
|
||||
wxString multiline_message;
|
||||
m_tip_message_label->split_lines(dc, sizer_width, message, multiline_message);
|
||||
m_tip_message_label->SetLabel(multiline_message);
|
||||
m_tip_message_label->SetFont(Label::Body_13);
|
||||
message_sizer->Add(m_tip_message_label, 0, wxEXPAND | wxALL, TIP_MESSAGES_PADDING);
|
||||
}
|
||||
m_sizer_advanced->Add(tip_message_panel, 0, wxEXPAND | wxRIGHT | wxLEFT, TABLE_BORDER);
|
||||
bool is_show = wxGetApp().app_config->get("auto_calculate") == "true";
|
||||
tip_message_panel->Show(is_show);
|
||||
m_sizer_advanced->AddSpacer(FromDIP(10));
|
||||
auto calc_btn_sizer = create_calc_btn_sizer(m_page_advanced);
|
||||
m_sizer_advanced->Add(calc_btn_sizer, 0, wxEXPAND | wxLEFT, FromDIP(30));
|
||||
|
||||
//m_sizer_advanced->AddSpacer(FromDIP(10));
|
||||
m_sizer_advanced->AddSpacer(FromDIP(5));
|
||||
header_line_panel = new wxPanel(m_page_advanced, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
|
||||
header_line_panel->SetBackgroundColour(wxColour(238, 238, 238));
|
||||
auto header_line_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
@ -335,28 +408,15 @@ WipingPanel::WipingPanel(wxWindow* parent, const std::vector<float>& matrix, con
|
|||
header_line_sizer->Add(icon, 0, wxALIGN_CENTER_VERTICAL | wxTOP | wxBOTTOM, HEADER_VERT_PADDING);
|
||||
}
|
||||
header_line_sizer->AddSpacer(HEADER_END_PADDING);
|
||||
|
||||
m_sizer_advanced->Add(header_line_panel, 0, wxEXPAND | wxTOP | wxRIGHT | wxLEFT, TABLE_BORDER);
|
||||
|
||||
|
||||
m_sizer_advanced->Add(header_line_panel, 0, wxEXPAND | wxRIGHT | wxLEFT, TABLE_BORDER);
|
||||
|
||||
create_panels(m_page_advanced, m_number_of_extruders);
|
||||
|
||||
m_sizer_advanced->AddSpacer(BTN_SIZE.y);
|
||||
//m_sizer_advanced->AddSpacer(BTN_SIZE.y);
|
||||
|
||||
// BBS: for tunning flush volumes
|
||||
{
|
||||
wxBoxSizer* param_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
wxStaticText* flush_multiplier_title = new wxStaticText(m_page_advanced, wxID_ANY, _L("Multiplier"));
|
||||
param_sizer->Add(flush_multiplier_title);
|
||||
param_sizer->AddSpacer(FromDIP(5));
|
||||
m_flush_multiplier_ebox = new wxTextCtrl(m_page_advanced, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(FromDIP(50), -1), wxTE_PROCESS_ENTER);
|
||||
char flush_multi_str[32] = { 0 };
|
||||
snprintf(flush_multi_str, sizeof(flush_multi_str), "%.2f", flush_multiplier);
|
||||
m_flush_multiplier_ebox->SetValue(flush_multi_str);
|
||||
param_sizer->Add(m_flush_multiplier_ebox);
|
||||
param_sizer->AddStretchSpacer(1);
|
||||
m_sizer_advanced->Add(param_sizer, 0, wxEXPAND | wxLEFT, TEXT_BEG_PADDING);
|
||||
|
||||
auto multi_desc_label = new wxStaticText(m_page_advanced, wxID_ANY, _(L("Flushing volume (mm³) for each filament pair.")), wxDefaultPosition, wxDefaultSize, 0);
|
||||
multi_desc_label->SetForegroundColour(g_text_color);
|
||||
m_sizer_advanced->Add(multi_desc_label, 0, wxEXPAND | wxLEFT, TEXT_BEG_PADDING);
|
||||
|
@ -386,10 +446,23 @@ WipingPanel::WipingPanel(wxWindow* parent, const std::vector<float>& matrix, con
|
|||
this->update_warning_texts();
|
||||
e.Skip();
|
||||
};
|
||||
m_flush_multiplier_ebox->Bind(wxEVT_TEXT_ENTER, on_apply_text_modify);
|
||||
m_flush_multiplier_ebox->Bind(wxEVT_KILL_FOCUS, on_apply_text_modify);
|
||||
|
||||
m_sizer_advanced->AddSpacer(10);
|
||||
|
||||
wxBoxSizer* param_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxStaticText* flush_multiplier_title = new wxStaticText(m_page_advanced, wxID_ANY, _L("Multiplier"));
|
||||
param_sizer->Add(flush_multiplier_title, 0, wxALIGN_CENTER | wxALL, 0);
|
||||
param_sizer->AddSpacer(FromDIP(5));
|
||||
m_flush_multiplier_ebox = new wxTextCtrl(m_page_advanced, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(FromDIP(50), -1), wxTE_PROCESS_ENTER);
|
||||
char flush_multi_str[32] = { 0 };
|
||||
snprintf(flush_multi_str, sizeof(flush_multi_str), "%.2f", flush_multiplier);
|
||||
m_flush_multiplier_ebox->SetValue(flush_multi_str);
|
||||
param_sizer->Add(m_flush_multiplier_ebox, 0, wxALIGN_CENTER | wxALL, 0);
|
||||
param_sizer->AddStretchSpacer(1);
|
||||
m_sizer_advanced->Add(param_sizer, 0, wxEXPAND | wxLEFT, TEXT_BEG_PADDING);
|
||||
|
||||
m_flush_multiplier_ebox->Bind(wxEVT_TEXT_ENTER, on_apply_text_modify);
|
||||
m_flush_multiplier_ebox->Bind(wxEVT_KILL_FOCUS, on_apply_text_modify);
|
||||
}
|
||||
this->update_warning_texts();
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
#include <wx/textctrl.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/msgdlg.h>
|
||||
|
||||
class Button;
|
||||
class Label;
|
||||
|
||||
class WipingPanel : public wxPanel {
|
||||
public:
|
||||
|
@ -22,6 +22,7 @@ public:
|
|||
void create_panels(wxWindow* parent, const int num);
|
||||
void calc_flushing_volumes();
|
||||
void msw_rescale();
|
||||
wxBoxSizer* create_calc_btn_sizer(wxWindow* parent);
|
||||
|
||||
float get_flush_multiplier()
|
||||
{
|
||||
|
@ -46,11 +47,14 @@ private:
|
|||
wxPanel* m_page_simple = nullptr;
|
||||
wxPanel* m_page_advanced = nullptr;
|
||||
wxPanel* header_line_panel = nullptr;
|
||||
wxPanel* tip_message_panel = nullptr;
|
||||
wxBoxSizer* m_sizer = nullptr;
|
||||
wxBoxSizer* m_sizer_simple = nullptr;
|
||||
wxBoxSizer* m_sizer_advanced = nullptr;
|
||||
wxGridSizer* m_gridsizer_advanced = nullptr;
|
||||
wxButton* m_widget_button = nullptr;
|
||||
Label* m_tip_message_label = nullptr;
|
||||
|
||||
std::vector<wxButton *> icon_list1;
|
||||
std::vector<wxButton *> icon_list2;
|
||||
|
||||
|
@ -74,9 +78,8 @@ public:
|
|||
int extra_flush_volume, float flush_multiplier);
|
||||
std::vector<float> get_matrix() const { return m_output_matrix; }
|
||||
std::vector<float> get_extruders() const { return m_output_extruders; }
|
||||
|
||||
wxBoxSizer* create_btn_sizer(long flags);
|
||||
|
||||
|
||||
float get_flush_multiplier()
|
||||
{
|
||||
if (m_panel_wiping == nullptr)
|
||||
|
|
Loading…
Reference in New Issue