mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-24 19:32:18 +00:00
Merge branch 'main' into dev/bbl-network-upd
# Conflicts: # src/slic3r/GUI/Widgets/AMSControl.cpp
This commit is contained in:
@@ -406,9 +406,9 @@ void CameraPopup::update(bool vcamera_streaming)
|
||||
wxString CameraPopup::to_resolution_label_string(CameraResolution resolution) {
|
||||
switch (resolution) {
|
||||
case RESOLUTION_720P:
|
||||
return _L("720p");
|
||||
return "720p";
|
||||
case RESOLUTION_1080P:
|
||||
return _L("1080p");
|
||||
return "1080p";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ void ConfigManipulation::check_nozzle_recommended_temperature_range(DynamicPrint
|
||||
wxString msg_text;
|
||||
bool need_check = false;
|
||||
if (temperature_range_low < 190 || temperature_range_high > 300) {
|
||||
msg_text += _L("The recommended minimum temperature is less than 190 degree or the recommended maximum temperature is greater than 300 degree.\n");
|
||||
msg_text += _L("The recommended minimum temperature is less than 190°C or the recommended maximum temperature is greater than 300°C.\n");
|
||||
need_check = true;
|
||||
}
|
||||
if (temperature_range_low > temperature_range_high) {
|
||||
@@ -630,7 +630,7 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, co
|
||||
toggle_line("bridge_no_support", !support_is_normal_tree);
|
||||
|
||||
// This is only supported for auto normal tree
|
||||
toggle_line("support_critical_regions_only", is_auto(support_type) && support_is_normal_tree);
|
||||
toggle_line("support_critical_regions_only", is_auto(support_type) && support_is_tree);
|
||||
|
||||
for (auto el : { "support_interface_spacing", "support_interface_filament",
|
||||
"support_interface_loop_pattern", "support_bottom_interface_spacing" })
|
||||
|
||||
@@ -1448,7 +1448,7 @@ PageTemperatures::PageTemperatures(ConfigWizard *parent)
|
||||
|
||||
auto *sizer_extr = new wxFlexGridSizer(3, 5, 5);
|
||||
auto *text_extr = new wxStaticText(this, wxID_ANY, _L("Extrusion Temperature:"));
|
||||
auto *unit_extr = new wxStaticText(this, wxID_ANY, _L("°C"));
|
||||
auto *unit_extr = new wxStaticText(this, wxID_ANY, "°C");
|
||||
sizer_extr->AddGrowableCol(0, 1);
|
||||
sizer_extr->Add(text_extr, 0, wxALIGN_CENTRE_VERTICAL);
|
||||
sizer_extr->Add(spin_extr);
|
||||
@@ -1462,7 +1462,7 @@ PageTemperatures::PageTemperatures(ConfigWizard *parent)
|
||||
|
||||
auto *sizer_bed = new wxFlexGridSizer(3, 5, 5);
|
||||
auto *text_bed = new wxStaticText(this, wxID_ANY, _L("Bed Temperature:"));
|
||||
auto *unit_bed = new wxStaticText(this, wxID_ANY, _L("°C"));
|
||||
auto *unit_bed = new wxStaticText(this, wxID_ANY, "°C");
|
||||
sizer_bed->AddGrowableCol(0, 1);
|
||||
sizer_bed->Add(text_bed, 0, wxALIGN_CENTRE_VERTICAL);
|
||||
sizer_bed->Add(spin_bed);
|
||||
|
||||
@@ -1727,7 +1727,7 @@ void Choice::msw_rescale()
|
||||
|
||||
void ColourPicker::BUILD()
|
||||
{
|
||||
auto size = wxSize(def_width() * m_em_unit, wxDefaultCoord);
|
||||
auto size = wxSize(def_width_wider() * m_em_unit, -1); // ORCA match color picker width
|
||||
if (m_opt.height >= 0) size.SetHeight(m_opt.height*m_em_unit);
|
||||
if (m_opt.width >= 0) size.SetWidth(m_opt.width*m_em_unit);
|
||||
|
||||
@@ -1750,7 +1750,24 @@ void ColourPicker::BUILD()
|
||||
// // recast as a wxWindow to fit the calling convention
|
||||
window = dynamic_cast<wxWindow*>(temp);
|
||||
|
||||
temp->Bind(wxEVT_COLOURPICKER_CHANGED, ([this](wxCommandEvent e) { on_change_field(); }), temp->GetId());
|
||||
temp->Bind(wxEVT_COLOURPICKER_CHANGED, ([this,temp](wxCommandEvent e) {
|
||||
#ifdef __WXMSW__
|
||||
draw_bmp_btn(temp, temp->GetColour());
|
||||
#endif
|
||||
on_change_field();
|
||||
}), temp->GetId());
|
||||
|
||||
// ORCA reset value to default on right click. previously no way to switch back on windows
|
||||
temp->GetPickerCtrl()->Bind(wxEVT_RIGHT_DOWN, [this, temp](wxMouseEvent e){
|
||||
#ifdef __WXMSW__
|
||||
temp->SetColour(wxTransparentColour);
|
||||
draw_bmp_btn(temp, wxTransparentColour);
|
||||
#else
|
||||
set_undef_value(temp);
|
||||
#endif
|
||||
on_change_field();
|
||||
e.Skip();
|
||||
});
|
||||
|
||||
temp->SetToolTip(get_tooltip_text(clr_str));
|
||||
}
|
||||
@@ -1782,17 +1799,69 @@ void ColourPicker::set_undef_value(wxColourPickerCtrl* field)
|
||||
btn->SetBitmapLabel(bmp);
|
||||
}
|
||||
|
||||
// ORCA match style with button on windows
|
||||
void ColourPicker::draw_bmp_btn(wxColourPickerCtrl* field, wxColour color)
|
||||
{
|
||||
wxButton* btn = dynamic_cast<wxButton*>(field->GetPickerCtrl());
|
||||
|
||||
if (!btn->GetBitmap().IsOk()) return;
|
||||
btn->SetWindowStyle(wxBORDER_NONE); // ORCA just in case to prevent any overflow
|
||||
btn->SetBackgroundColour(*wxWHITE);
|
||||
wxGetApp().UpdateDarkUI(btn);
|
||||
|
||||
auto create_bitmap = [btn](const wxColour& picker_color,const wxColour& bg_color, bool focus) -> wxBitmap {
|
||||
wxSize btn_sz = btn->GetSize();
|
||||
wxImage image(btn_sz);
|
||||
image.InitAlpha();
|
||||
memset(image.GetAlpha(), 0, image.GetWidth() * image.GetHeight());
|
||||
wxBitmap bmp(std::move(image));
|
||||
wxMemoryDC dc(bmp);
|
||||
if (!dc.IsOk()) return bmp;
|
||||
wxGCDC dc2(dc); // just use wxGCDC since bitmap button only used for windows
|
||||
|
||||
dc2.SetPen(focus ? wxPen(wxColour(StateColor::darkModeColorFor(wxColour("#009688"))), 1) : *wxTRANSPARENT_PEN);
|
||||
dc2.SetBrush(wxBrush(StateColor::darkModeColorFor(bg_color)));
|
||||
dc2.DrawRoundedRectangle(btn->GetRect(), btn->FromDIP(4));
|
||||
|
||||
int padding = btn->FromDIP(5);
|
||||
dc2.SetPen(*wxTRANSPARENT_PEN);
|
||||
if (picker_color != wxTransparentColour){ // Draw color
|
||||
dc2.SetBrush(wxBrush(picker_color));
|
||||
dc2.DrawRectangle(wxRect(padding, padding, btn_sz.x - 2 * padding, btn_sz.y - 2 * padding));
|
||||
} else { // Draw Pick text
|
||||
// Label::Body_14 rendered much bolder with wxGCDC
|
||||
dc2.SetFont(wxFont(11, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));
|
||||
wxString text = _L("Pick") + " " + dots;
|
||||
wxSize text_sz = dc2.GetTextExtent(text);
|
||||
dc2.SetTextForeground(StateColor::darkModeColorFor(wxColour("#262E30")));
|
||||
dc2.DrawText(text, (btn_sz.x - text_sz.x) / 2, (btn_sz.y - text_sz.y) / 2);
|
||||
}
|
||||
dc.SelectObject(wxNullBitmap);
|
||||
return bmp;
|
||||
};
|
||||
|
||||
btn->SetBitmap( create_bitmap(color, wxColour("#DFDFDF"), false)); // Normal
|
||||
btn->SetBitmapFocus( create_bitmap(color, wxColour("#DFDFDF"), true )); // Focus
|
||||
btn->SetBitmapCurrent( create_bitmap(color, wxColour("#D4D4D4"), false)); // Hover
|
||||
}
|
||||
|
||||
void ColourPicker::set_value(const boost::any& value, bool change_event)
|
||||
{
|
||||
m_disable_change_event = !change_event;
|
||||
const wxString clr_str(boost::any_cast<wxString>(value));
|
||||
auto field = dynamic_cast<wxColourPickerCtrl*>(window);
|
||||
|
||||
wxColour clr(clr_str);
|
||||
if (clr_str.IsEmpty() || !clr.IsOk())
|
||||
set_undef_value(field);
|
||||
else
|
||||
#ifdef __WXMSW__
|
||||
wxColour clr = (clr_str.IsEmpty() || !clr.IsOk()) ? wxTransparentColour : clr_str;
|
||||
field->SetColour(clr);
|
||||
draw_bmp_btn(field, clr);
|
||||
#else
|
||||
wxColour clr(clr_str);
|
||||
if (clr_str.IsEmpty() || !clr.IsOk())
|
||||
set_undef_value(field);
|
||||
else
|
||||
field->SetColour(clr);
|
||||
#endif
|
||||
|
||||
m_disable_change_event = false;
|
||||
}
|
||||
@@ -1814,7 +1883,7 @@ void ColourPicker::msw_rescale()
|
||||
Field::msw_rescale();
|
||||
|
||||
wxColourPickerCtrl* field = dynamic_cast<wxColourPickerCtrl*>(window);
|
||||
auto size = wxSize(def_width() * m_em_unit, wxDefaultCoord);
|
||||
auto size = wxSize(def_width_wider() * m_em_unit, -1); // ORCA match color picker width with parameters
|
||||
if (m_opt.height >= 0)
|
||||
size.SetHeight(m_opt.height * m_em_unit);
|
||||
else if (parent_is_custom_ctrl && opt_height > 0)
|
||||
@@ -1825,16 +1894,23 @@ void ColourPicker::msw_rescale()
|
||||
else
|
||||
field->SetMinSize(size);
|
||||
|
||||
if (field->GetColour() == wxTransparentColour)
|
||||
set_undef_value(field);
|
||||
#ifdef __WXMSW__
|
||||
draw_bmp_btn(field, field->GetColour());
|
||||
#else
|
||||
if (field->GetColour() == wxTransparentColour)
|
||||
set_undef_value(field);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void ColourPicker::sys_color_changed()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if (wxWindow* win = this->getWindow())
|
||||
if (wxColourPickerCtrl* picker = dynamic_cast<wxColourPickerCtrl*>(win))
|
||||
wxGetApp().UpdateDarkUI(picker->GetPickerCtrl(), true);
|
||||
if (wxWindow* win = this->getWindow())
|
||||
if (wxColourPickerCtrl* picker = dynamic_cast<wxColourPickerCtrl*>(win)){
|
||||
wxGetApp().UpdateDarkUI(picker->GetPickerCtrl(), true);
|
||||
draw_bmp_btn(picker, picker->GetColour());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -468,6 +468,7 @@ class ColourPicker : public Field {
|
||||
using Field::Field;
|
||||
|
||||
void set_undef_value(wxColourPickerCtrl* field);
|
||||
void draw_bmp_btn(wxColourPickerCtrl* field, wxColour color);
|
||||
public:
|
||||
ColourPicker(const ConfigOptionDef& opt, const t_config_option_key& id) : Field(opt, id) {}
|
||||
ColourPicker(wxWindow* parent, const ConfigOptionDef& opt, const t_config_option_key& id) : Field(parent, opt, id) {}
|
||||
|
||||
@@ -4867,8 +4867,8 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
|
||||
}
|
||||
|
||||
// ORCA use % symbol for percentage and use "Usage" for "Used filaments"
|
||||
offsets = calculate_offsets({ {_u8L("Line Type"), labels}, {_u8L("Time"), times}, {_u8L("%"), percents}, {"", used_filaments_length}, {"", used_filaments_weight}, {_u8L("Display"), {""}}}, icon_size);
|
||||
append_headers({{_u8L("Line Type"), offsets[0]}, {_u8L("Time"), offsets[1]}, {_u8L("%"), offsets[2]}, {_u8L("Usage"), offsets[3]}, {_u8L("Display"), offsets[5]}});
|
||||
offsets = calculate_offsets({ {_u8L("Line Type"), labels}, {_u8L("Time"), times}, {"%", percents}, {"", used_filaments_length}, {"", used_filaments_weight}, {_u8L("Display"), {""}}}, icon_size);
|
||||
append_headers({{_u8L("Line Type"), offsets[0]}, {_u8L("Time"), offsets[1]}, {"%", offsets[2]}, {_u8L("Usage"), offsets[3]}, {_u8L("Display"), offsets[5]}});
|
||||
break;
|
||||
}
|
||||
case EViewType::Height: { imgui.title(_u8L("Layer Height (mm)")); break; }
|
||||
|
||||
@@ -262,7 +262,7 @@ std::string GLGizmoCut3D::get_tooltip() const
|
||||
|
||||
if (tooltip.empty() && (m_hover_id == X || m_hover_id == Y || m_hover_id == CutPlaneZRotation)) {
|
||||
std::string axis = m_hover_id == X ? "X" : m_hover_id == Y ? "Y" : "Z";
|
||||
return axis + ": " + format(float(rad2deg(m_angle)), 1) + _u8L("°");
|
||||
return axis + ": " + format(float(rad2deg(m_angle)), 1) + "°";
|
||||
}
|
||||
|
||||
return tooltip;
|
||||
@@ -2541,7 +2541,7 @@ bool GLGizmoCut3D::render_angle_input(const std::string& label, float& in_val, c
|
||||
float val = rad2deg(in_val);
|
||||
const float old_val = val;
|
||||
|
||||
const std::string format = "%.0f " + _u8L("°");
|
||||
const std::string format = "%.0f°";
|
||||
m_imgui->bbl_slider_float_style("##angle_" + label, &val, min_val, max_val, format.c_str(), 1.f, true, from_u8(label));
|
||||
|
||||
ImGui::SameLine(left_width);
|
||||
|
||||
@@ -2108,7 +2108,7 @@ void GLGizmoMeasure::show_face_face_assembly_senior()
|
||||
m_buffered_around_center = 0;
|
||||
}
|
||||
ImGui::SameLine(rotate_around_center_size + m_space_size + m_input_size_max + m_space_size / 2.0f);
|
||||
m_imgui->text(_L("°"));
|
||||
m_imgui->text("°");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -343,7 +343,7 @@ void GLGizmoSimplify::on_render_input_window(float x, float y, float bottom_limi
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing,ImVec2(10,20));
|
||||
if (is_worker_running) { // apply or preview
|
||||
// draw progress bar
|
||||
std::string progress_text = GUI::format(_L("%1%"), std::to_string(progress)) + "%%";
|
||||
std::string progress_text = GUI::format("%1%", std::to_string(progress)) + "%%";
|
||||
ImVec2 progress_size(bottom_left_width - space_size, 0.0f);
|
||||
ImGui::BBLProgressBar2(progress / 100., progress_size);
|
||||
ImGui::SameLine();
|
||||
|
||||
@@ -972,7 +972,7 @@ void GLGizmoText::on_render_input_window(float x, float y, float bottom_limit)
|
||||
|
||||
//ImGui::SameLine();
|
||||
//ImGui::AlignTextToFramePadding();
|
||||
//m_imgui->text(_L("Status:"));
|
||||
//m_imgui->text(_L("Status") + ": ");
|
||||
//float status_cap = m_imgui->calc_text_size(_L("Status:")).x + space_size + ImGui::GetStyle().WindowPadding.x;
|
||||
//ImGui::SameLine();
|
||||
//m_imgui->text(m_is_modify ? _L("Modify") : _L("Add"));
|
||||
|
||||
@@ -1034,7 +1034,7 @@ void GizmoObjectManipulation::do_render_rotate_window(ImGuiWrapper *imgui_wrappe
|
||||
is_relative_input = true;
|
||||
}
|
||||
ImGui::SameLine(caption_max + (++index_unit) * unit_size + (++index) * space_size);
|
||||
imgui_wrapper->text(_L("°"));
|
||||
imgui_wrapper->text("°");
|
||||
m_buffered_rotation = rotation;
|
||||
if (is_relative_input) {
|
||||
m_last_rotate_type = RotateType::Relative;
|
||||
@@ -1091,7 +1091,7 @@ void GizmoObjectManipulation::do_render_rotate_window(ImGuiWrapper *imgui_wrappe
|
||||
is_absolute_input = true;
|
||||
}
|
||||
ImGui::SameLine(caption_max + (++index_unit) * unit_size + (++index) * space_size);
|
||||
imgui_wrapper->text(_L("°"));
|
||||
imgui_wrapper->text("°");
|
||||
m_buffered_absolute_rotation = absolute_rotation;
|
||||
if (is_absolute_input) {
|
||||
m_last_rotate_type = RotateType::Absolute;
|
||||
@@ -1247,7 +1247,7 @@ void GizmoObjectManipulation::do_render_scale_input_window(ImGuiWrapper* imgui_w
|
||||
ImGui::PushItemWidth(unit_size);
|
||||
ImGui::BBLInputDouble(label_scale_values[0][2], &scale[2], 0.0f, 0.0f, "%.2f");
|
||||
ImGui::SameLine(caption_max + (++index_unit) *unit_size + (++index) * space_size);
|
||||
imgui_wrapper->text(_L("%"));
|
||||
imgui_wrapper->text("%");
|
||||
if (scale.x() > 0 && scale.y() > 0 && scale.z() > 0) {
|
||||
m_buffered_scale = scale;
|
||||
}
|
||||
|
||||
@@ -535,7 +535,7 @@ void PrinterPartsDialog::set_nozzle_type(wxCommandEvent& evt)
|
||||
nozzle_diameter_checkbox->Clear();
|
||||
for (int i = 0; i < diameter_list.size(); i++)
|
||||
{
|
||||
nozzle_diameter_checkbox->Append(wxString::Format(_L("%.1f"), diameter_list[i]));
|
||||
nozzle_diameter_checkbox->Append(wxString::Format("%.1f", diameter_list[i]));
|
||||
}
|
||||
nozzle_diameter_checkbox->SetSelection(0);
|
||||
|
||||
@@ -618,7 +618,7 @@ bool PrinterPartsDialog::Show(bool show)
|
||||
|
||||
for (int i = 0; i < diameter_list.size(); i++)
|
||||
{
|
||||
nozzle_diameter_checkbox->Append( wxString::Format(_L("%.1f"), diameter_list[i]));
|
||||
nozzle_diameter_checkbox->Append( wxString::Format("%.1f", diameter_list[i]));
|
||||
if (diameter_list[i] == diameter) {
|
||||
nozzle_diameter_checkbox->SetSelection(i);
|
||||
}
|
||||
|
||||
@@ -333,12 +333,12 @@ void PrintingTaskPanel::create_panel(wxWindow* parent)
|
||||
sizer_percent_icon->Add(0, 0, 1, wxEXPAND, 0);
|
||||
|
||||
|
||||
m_staticText_progress_percent = new wxStaticText(penel_text, wxID_ANY, L("0"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
m_staticText_progress_percent = new wxStaticText(penel_text, wxID_ANY, "0", wxDefaultPosition, wxDefaultSize, 0);
|
||||
m_staticText_progress_percent->SetFont(::Label::Head_18);
|
||||
m_staticText_progress_percent->SetMaxSize(wxSize(-1, FromDIP(20)));
|
||||
m_staticText_progress_percent->SetForegroundColour(wxColour(0, 150, 136));
|
||||
|
||||
m_staticText_progress_percent_icon = new wxStaticText(penel_text, wxID_ANY, L("%"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
m_staticText_progress_percent_icon = new wxStaticText(penel_text, wxID_ANY, "%", wxDefaultPosition, wxDefaultSize, 0);
|
||||
m_staticText_progress_percent_icon->SetFont(::Label::Body_11);
|
||||
m_staticText_progress_percent_icon->SetMaxSize(wxSize(-1, FromDIP(13)));
|
||||
m_staticText_progress_percent_icon->SetForegroundColour(wxColour(0, 150, 136));
|
||||
@@ -1270,7 +1270,7 @@ wxBoxSizer *StatusBasePanel::create_misc_control(wxWindow *parent)
|
||||
|
||||
/* create speed control */
|
||||
m_switch_speed = new ImageSwitchButton(parent, m_bitmap_speed_active, m_bitmap_speed);
|
||||
m_switch_speed->SetLabels(_L("100%"), _L("100%"));
|
||||
m_switch_speed->SetLabels("100%", "100%");
|
||||
m_switch_speed->SetMinSize(MISC_BUTTON_2FAN_SIZE);
|
||||
m_switch_speed->SetMaxSize(MISC_BUTTON_2FAN_SIZE);
|
||||
m_switch_speed->SetPadding(FromDIP(3));
|
||||
@@ -1403,7 +1403,7 @@ void StatusBasePanel::reset_temp_misc_control()
|
||||
m_tempCtrl_bed->Enable(true);
|
||||
|
||||
// reset misc control
|
||||
m_switch_speed->SetLabels(_L("100%"), _L("100%"));
|
||||
m_switch_speed->SetLabels("100%", "100%");
|
||||
m_switch_speed->SetValue(false);
|
||||
m_switch_lamp->SetLabels(_L("Lamp"), _L("Lamp"));
|
||||
m_switch_lamp->SetValue(false);
|
||||
@@ -3392,7 +3392,7 @@ void StatusPanel::axis_ctrl_e_hint(bool up_down)
|
||||
{
|
||||
if (ctrl_e_hint_dlg == nullptr) {
|
||||
ctrl_e_hint_dlg = new SecondaryCheckDialog(this->GetParent(), wxID_ANY, _L("Warning"), SecondaryCheckDialog::ButtonStyle::CONFIRM_AND_CANCEL, wxDefaultPosition, wxDefaultSize, wxCLOSE_BOX | wxCAPTION, true);
|
||||
ctrl_e_hint_dlg->update_text(_L("Please heat the nozzle to above 170 degree before loading or unloading filament."));
|
||||
ctrl_e_hint_dlg->update_text(_L("Please heat the nozzle to above 170°C before loading or unloading filament."));
|
||||
ctrl_e_hint_dlg->show_again_config_text = std::string("not_show_ectrl_hint");
|
||||
}
|
||||
if (up_down) {
|
||||
|
||||
@@ -251,7 +251,7 @@ StepMeshDialog::StepMeshDialog(wxWindow* parent, Slic3r::Step& file, double line
|
||||
wxBoxSizer* mesh_face_number_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxStaticText *mesh_face_number_title = new wxStaticText(this, wxID_ANY, _L("Number of triangular facets") + ": ");
|
||||
mesh_face_number_title->SetForegroundColour(StateColor::darkModeColorFor(FONT_COLOR));
|
||||
mesh_face_number_text = new wxStaticText(this, wxID_ANY, _L("0"));
|
||||
mesh_face_number_text = new wxStaticText(this, wxID_ANY, "0");
|
||||
mesh_face_number_text->SetForegroundColour(StateColor::darkModeColorFor(FONT_COLOR));
|
||||
mesh_face_number_text->SetMinSize(wxSize(FromDIP(150), -1));
|
||||
mesh_face_number_sizer->Add(mesh_face_number_title, 0, wxALIGN_LEFT);
|
||||
|
||||
@@ -3585,7 +3585,7 @@ void TabFilament::build()
|
||||
optgroup->append_single_option_line("filament_multitool_ramming_flow");
|
||||
|
||||
page = add_options_page(L("Dependencies"), "advanced");
|
||||
optgroup = page->new_optgroup(L("Profile dependencies"), "param_profile_dependencies");
|
||||
optgroup = page->new_optgroup(L("Compatible printers"), "param_dependencies_printers");
|
||||
create_line_with_widget(optgroup.get(), "compatible_printers", "", [this](wxWindow* parent) {
|
||||
return compatible_widget_create(parent, m_compatible_printers);
|
||||
});
|
||||
@@ -3594,6 +3594,7 @@ void TabFilament::build()
|
||||
option.opt.full_width = true;
|
||||
optgroup->append_single_option_line(option);
|
||||
|
||||
optgroup = page->new_optgroup(L("Compatible process profiles"), "param_dependencies_presets");
|
||||
create_line_with_widget(optgroup.get(), "compatible_prints", "", [this](wxWindow* parent) {
|
||||
return compatible_widget_create(parent, m_compatible_prints);
|
||||
});
|
||||
@@ -5921,10 +5922,14 @@ void Tab::create_line_with_widget(ConfigOptionsGroup* optgroup, const std::strin
|
||||
// Return a callback to create a Tab widget to mark the preferences as compatible / incompatible to the current printer.
|
||||
wxSizer* Tab::compatible_widget_create(wxWindow* parent, PresetDependencies &deps)
|
||||
{
|
||||
deps.checkbox = new wxCheckBox(parent, wxID_ANY, _(L("All")));
|
||||
deps.checkbox->SetFont(Slic3r::GUI::wxGetApp().normal_font());
|
||||
deps.checkbox = new ::CheckBox(parent, wxID_ANY);
|
||||
wxGetApp().UpdateDarkUI(deps.checkbox, false, true);
|
||||
|
||||
deps.checkbox_title = new wxStaticText(parent, wxID_ANY, _L("All"));
|
||||
deps.checkbox_title->SetFont(Label::Body_14);
|
||||
deps.checkbox_title->SetForegroundColour(wxColour("#363636"));
|
||||
wxGetApp().UpdateDarkUI(deps.checkbox_title, false, true);
|
||||
|
||||
// ORCA modernize button style
|
||||
Button* btn = new Button(parent, _(L("Set")) + " " + dots);
|
||||
btn->SetFont(Label::Body_14);
|
||||
@@ -5948,18 +5953,43 @@ wxSizer* Tab::compatible_widget_create(wxWindow* parent, PresetDependencies &dep
|
||||
|
||||
auto sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
sizer->Add((deps.checkbox), 0, wxALIGN_CENTER_VERTICAL);
|
||||
sizer->Add((deps.checkbox_title), 0, wxALIGN_CENTER_VERTICAL);
|
||||
sizer->Add(new wxStaticText(parent, wxID_ANY, " ")); // weirdly didnt apply AddSpacer or wxRIGHT border
|
||||
sizer->Add((deps.btn), 0, wxALIGN_CENTER_VERTICAL);
|
||||
|
||||
deps.checkbox->Bind(wxEVT_CHECKBOX, ([this, &deps](wxCommandEvent e)
|
||||
{
|
||||
deps.btn->Enable(! deps.checkbox->GetValue());
|
||||
auto on_toggle = [this, &deps](const bool &state){
|
||||
deps.checkbox->SetValue(state);
|
||||
deps.btn->Enable(!state);
|
||||
// All printers have been made compatible with this preset.
|
||||
if (deps.checkbox->GetValue())
|
||||
if (state)
|
||||
this->load_key_value(deps.key_list, std::vector<std::string> {});
|
||||
this->get_field(deps.key_condition)->toggle(deps.checkbox->GetValue());
|
||||
this->get_field(deps.key_condition)->toggle(state);
|
||||
this->update_changed_ui();
|
||||
}) );
|
||||
};
|
||||
|
||||
deps.checkbox_title->Bind(wxEVT_LEFT_DOWN,([this, &deps, on_toggle](wxMouseEvent e) {
|
||||
if (e.GetEventType() == wxEVT_LEFT_DCLICK) return;
|
||||
on_toggle(!deps.checkbox->GetValue());
|
||||
e.Skip();
|
||||
}));
|
||||
|
||||
deps.checkbox_title->Bind(wxEVT_LEFT_DCLICK,([this, &deps, on_toggle](wxMouseEvent e) {
|
||||
on_toggle(!deps.checkbox->GetValue());
|
||||
e.Skip();
|
||||
}));
|
||||
|
||||
deps.checkbox->Bind(wxEVT_TOGGLEBUTTON, ([this, on_toggle](wxCommandEvent e) {
|
||||
on_toggle(e.IsChecked());
|
||||
e.Skip();
|
||||
}), deps.checkbox->GetId());
|
||||
|
||||
if (deps.checkbox){
|
||||
bool is_empty = m_config->option<ConfigOptionStrings>(deps.key_list)->values.empty();
|
||||
deps.checkbox->SetValue(is_empty);
|
||||
deps.btn->Enable(!is_empty);
|
||||
}
|
||||
|
||||
/*
|
||||
if (m_compatible_printers.checkbox) {
|
||||
bool is_empty = m_config->option<ConfigOptionStrings>("compatible_printers")->values.empty();
|
||||
m_compatible_printers.checkbox->SetValue(is_empty);
|
||||
@@ -5971,6 +6001,7 @@ wxSizer* Tab::compatible_widget_create(wxWindow* parent, PresetDependencies &dep
|
||||
m_compatible_prints.checkbox->SetValue(is_empty);
|
||||
is_empty ? m_compatible_prints.btn->Disable() : m_compatible_prints.btn->Enable();
|
||||
}
|
||||
*/
|
||||
|
||||
deps.btn->Bind(wxEVT_BUTTON, ([this, parent, &deps](wxCommandEvent e)
|
||||
{
|
||||
|
||||
@@ -164,7 +164,8 @@ protected:
|
||||
|
||||
struct PresetDependencies {
|
||||
Preset::Type type = Preset::TYPE_INVALID;
|
||||
wxCheckBox *checkbox = nullptr;
|
||||
::CheckBox* checkbox = nullptr;
|
||||
wxStaticText* checkbox_title = nullptr;
|
||||
Button *btn = nullptr;
|
||||
std::string key_list; // "compatible_printers"
|
||||
std::string key_condition;
|
||||
|
||||
@@ -796,7 +796,7 @@ void AMSLib::render_extra_text(wxDC& dc)
|
||||
auto tsize = dc.GetMultiLineTextExtent("?");
|
||||
auto pot = wxPoint(0, 0);
|
||||
pot = wxPoint((libsize.x - tsize.x) / 2 + FromDIP(2), (libsize.y - tsize.y) / 2 - FromDIP(5));
|
||||
dc.DrawText(L("?"), pot);
|
||||
dc.DrawText("?", pot);
|
||||
}
|
||||
else {
|
||||
auto tsize = dc.GetMultiLineTextExtent(m_info.material_name);
|
||||
@@ -840,9 +840,9 @@ void AMSLib::render_extra_text(wxDC& dc)
|
||||
}
|
||||
|
||||
if (m_info.material_state == AMSCanType::AMS_CAN_TYPE_EMPTY) {
|
||||
auto tsize = dc.GetMultiLineTextExtent(_L("/"));
|
||||
auto tsize = dc.GetMultiLineTextExtent("/");
|
||||
auto pot = wxPoint((libsize.x - tsize.x) / 2 + FromDIP(2), (libsize.y - tsize.y) / 2 + FromDIP(3));
|
||||
dc.DrawText(_L("/"), pot);
|
||||
dc.DrawText("/", pot);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -895,7 +895,7 @@ void AMSLib::render_generic_text(wxDC &dc)
|
||||
else {
|
||||
pot = wxPoint((libsize.x - tsize.x) / 2, (libsize.y - tsize.y) / 2 + FromDIP(3));
|
||||
}
|
||||
dc.DrawText(L("?"), pot);
|
||||
dc.DrawText("?", pot);
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user