2022-07-27 10:13:40 +00:00
# include "PrintOptionsDialog.hpp"
# include "I18N.hpp"
2022-11-04 03:28:05 +00:00
# include "GUI_App.hpp"
2022-07-27 10:13:40 +00:00
# include "libslic3r/Utils.hpp"
2025-02-24 09:41:44 +00:00
# include "Widgets/SwitchButton.hpp"
# include "MsgDialog.hpp"
2022-07-27 10:13:40 +00:00
static const wxColour STATIC_BOX_LINE_COL = wxColour ( 238 , 238 , 238 ) ;
2022-11-14 03:03:29 +00:00
static const wxColour STATIC_TEXT_CAPTION_COL = wxColour ( 100 , 100 , 100 ) ;
2025-02-27 08:45:42 +00:00
static const wxColour STATIC_TEXT_EXPLAIN_COL = wxColour ( 100 , 100 , 100 ) ;
2022-07-27 10:13:40 +00:00
namespace Slic3r { namespace GUI {
PrintOptionsDialog : : PrintOptionsDialog ( wxWindow * parent )
: DPIDialog ( parent , wxID_ANY , _L ( " Print Options " ) , wxDefaultPosition , wxDefaultSize , wxCAPTION | wxCLOSE_BOX )
{
this - > SetDoubleBuffered ( true ) ;
std : : string icon_path = ( boost : : format ( " %1%/images/BambuStudioTitle.ico " ) % resources_dir ( ) ) . str ( ) ;
SetIcon ( wxIcon ( encode_path ( icon_path . c_str ( ) ) , wxBITMAP_TYPE_ICO ) ) ;
SetBackgroundColour ( * wxWHITE ) ;
auto m_options_sizer = create_settings_group ( this ) ;
this - > SetSizer ( m_options_sizer ) ;
this - > Layout ( ) ;
m_options_sizer - > Fit ( this ) ;
this - > Fit ( ) ;
2022-11-14 03:03:29 +00:00
m_cb_ai_monitoring - > Bind ( wxEVT_TOGGLEBUTTON , [ this ] ( wxCommandEvent & evt ) {
if ( obj ) {
int level = ai_monitoring_level_list - > GetSelection ( ) ;
std : : string lvl = sensitivity_level_to_msg_string ( ( AiMonitorSensitivityLevel ) level ) ;
if ( ! lvl . empty ( ) )
obj - > command_xcam_control_ai_monitoring ( m_cb_ai_monitoring - > GetValue ( ) , lvl ) ;
else
BOOST_LOG_TRIVIAL ( warning ) < < " print_option: lvl = " < < lvl ;
}
evt . Skip ( ) ;
} ) ;
2022-07-27 10:13:40 +00:00
m_cb_first_layer - > Bind ( wxEVT_TOGGLEBUTTON , [ this ] ( wxCommandEvent & evt ) {
if ( obj ) {
obj - > command_xcam_control_first_layer_inspector ( m_cb_first_layer - > GetValue ( ) , false ) ;
}
evt . Skip ( ) ;
} ) ;
2022-11-14 03:03:29 +00:00
m_cb_auto_recovery - > Bind ( wxEVT_TOGGLEBUTTON , [ this ] ( wxCommandEvent & evt ) {
2022-07-27 10:13:40 +00:00
if ( obj ) {
2022-11-14 03:03:29 +00:00
obj - > command_xcam_control_auto_recovery_step_loss ( m_cb_auto_recovery - > GetValue ( ) ) ;
2022-07-27 10:13:40 +00:00
}
evt . Skip ( ) ;
} ) ;
2025-02-24 09:41:44 +00:00
m_cb_open_door - > Bind ( wxEVT_TOGGLEBUTTON , [ this ] ( wxCommandEvent & evt ) {
2025-03-13 03:18:54 +00:00
if ( m_cb_open_door - > GetValue ( ) ) {
2025-02-24 09:41:44 +00:00
if ( obj ) { obj - > command_set_door_open_check ( MachineObject : : DOOR_OPEN_CHECK_ENABLE_WARNING ) ; }
2025-03-13 03:18:54 +00:00
} else {
if ( obj ) { obj - > command_set_door_open_check ( MachineObject : : DOOR_OPEN_CHECK_DISABLE ) ; }
2025-02-24 09:41:44 +00:00
}
evt . Skip ( ) ;
} ) ;
open_door_switch_board - > Bind ( wxCUSTOMEVT_SWITCH_POS , [ this ] ( wxCommandEvent & evt )
{
if ( evt . GetInt ( ) = = 0 )
{
if ( obj ) { obj - > command_set_door_open_check ( MachineObject : : DOOR_OPEN_CHECK_ENABLE_PAUSE_PRINT ) ; }
}
else if ( evt . GetInt ( ) = = 1 )
{
if ( obj ) { obj - > command_set_door_open_check ( MachineObject : : DOOR_OPEN_CHECK_ENABLE_WARNING ) ; }
}
evt . Skip ( ) ;
} ) ;
2025-02-25 02:11:42 +00:00
m_cb_save_remote_print_file_to_storage - > Bind ( wxEVT_TOGGLEBUTTON , [ this ] ( wxCommandEvent & evt )
{
if ( obj ) { obj - > command_set_save_remote_print_file_to_storage ( m_cb_save_remote_print_file_to_storage - > GetValue ( ) ) ; }
evt . Skip ( ) ;
} ) ;
2022-11-14 03:03:29 +00:00
m_cb_plate_mark - > Bind ( wxEVT_TOGGLEBUTTON , [ this ] ( wxCommandEvent & evt ) {
2022-07-27 10:13:40 +00:00
if ( obj ) {
2022-11-14 03:03:29 +00:00
obj - > command_xcam_control_buildplate_marker_detector ( m_cb_plate_mark - > GetValue ( ) ) ;
2022-07-27 10:13:40 +00:00
}
evt . Skip ( ) ;
} ) ;
2023-08-15 08:05:13 +00:00
m_cb_sup_sound - > Bind ( wxEVT_TOGGLEBUTTON , [ this ] ( wxCommandEvent & evt ) {
if ( obj ) {
obj - > command_xcam_control_allow_prompt_sound ( m_cb_sup_sound - > GetValue ( ) ) ;
}
evt . Skip ( ) ;
} ) ;
2023-09-25 07:40:24 +00:00
m_cb_filament_tangle - > Bind ( wxEVT_TOGGLEBUTTON , [ this ] ( wxCommandEvent & evt ) {
if ( obj ) {
obj - > command_xcam_control_filament_tangle_detect ( m_cb_filament_tangle - > GetValue ( ) ) ;
}
evt . Skip ( ) ;
} ) ;
2024-04-01 02:30:27 +00:00
m_cb_nozzle_blob - > Bind ( wxEVT_TOGGLEBUTTON , [ this ] ( wxCommandEvent & evt ) {
if ( obj ) {
obj - > command_nozzle_blob_detect ( m_cb_nozzle_blob - > GetValue ( ) ) ;
}
evt . Skip ( ) ;
} ) ;
2022-11-04 03:28:05 +00:00
wxGetApp ( ) . UpdateDlgDarkUI ( this ) ;
2022-07-27 10:13:40 +00:00
}
2022-11-14 03:03:29 +00:00
PrintOptionsDialog : : ~ PrintOptionsDialog ( )
{
ai_monitoring_level_list - > Disconnect ( wxEVT_COMBOBOX , wxCommandEventHandler ( PrintOptionsDialog : : set_ai_monitor_sensitivity ) , NULL , this ) ;
}
2022-07-27 10:13:40 +00:00
2022-11-14 03:03:29 +00:00
void PrintOptionsDialog : : on_dpi_changed ( const wxRect & suggested_rect )
2022-07-27 10:13:40 +00:00
{
Fit ( ) ;
}
2022-11-14 03:03:29 +00:00
void PrintOptionsDialog : : update_ai_monitor_status ( )
2022-07-27 10:13:40 +00:00
{
2022-11-14 03:03:29 +00:00
if ( m_cb_ai_monitoring - > GetValue ( ) ) {
ai_monitoring_level_list - > Enable ( ) ;
2022-07-27 10:13:40 +00:00
}
else {
2022-11-14 03:03:29 +00:00
ai_monitoring_level_list - > Disable ( ) ;
2022-07-27 10:13:40 +00:00
}
}
2022-11-14 03:03:29 +00:00
void PrintOptionsDialog : : update_options ( MachineObject * obj_ )
2022-07-27 10:13:40 +00:00
{
if ( ! obj_ ) return ;
2025-02-24 09:41:44 +00:00
2023-08-17 04:47:46 +00:00
if ( obj_ - > is_support_ai_monitoring ) {
2022-11-14 03:03:29 +00:00
text_ai_monitoring - > Show ( ) ;
m_cb_ai_monitoring - > Show ( ) ;
text_ai_monitoring_caption - > Show ( ) ;
ai_monitoring_level_list - > Show ( ) ;
line1 - > Show ( ) ;
}
else {
text_ai_monitoring - > Hide ( ) ;
m_cb_ai_monitoring - > Hide ( ) ;
text_ai_monitoring_caption - > Hide ( ) ;
ai_monitoring_level_list - > Hide ( ) ;
line1 - > Hide ( ) ;
}
2023-08-17 04:47:46 +00:00
if ( obj_ - > is_support_build_plate_marker_detect ) {
2025-03-12 04:08:05 +00:00
if ( obj_ - > m_plate_maker_detect_type = = MachineObject : : POS_CHECK & & ( text_plate_mark - > GetLabel ( ) ! = _L ( " Enable detection of build plate position " ) ) ) {
text_plate_mark - > SetLabel ( _L ( " Enable detection of build plate position " ) ) ;
text_plate_mark_caption - > SetLabel ( _L ( " The localization tag of build plate is detected, and printing is paused if the tag is not in predefined range. " ) ) ;
text_plate_mark_caption - > Wrap ( FromDIP ( 260 ) ) ;
} else if ( obj_ - > m_plate_maker_detect_type = = MachineObject : : TYPE_POS_CHECK & & ( text_plate_mark - > GetLabel ( ) ! = _L ( " Build Plate Detection " ) ) ) {
text_plate_mark - > SetLabel ( _L ( " Build Plate Detection " ) ) ;
text_plate_mark_caption - > SetLabel ( _L ( " Identifies the type and position of the build plate on the heatbed. Pausing printing if a mismatch is detected. " ) ) ;
text_plate_mark_caption - > Wrap ( FromDIP ( 260 ) ) ;
}
2022-11-14 03:03:29 +00:00
text_plate_mark - > Show ( ) ;
m_cb_plate_mark - > Show ( ) ;
text_plate_mark_caption - > Show ( ) ;
line2 - > Show ( ) ;
}
else {
text_plate_mark - > Hide ( ) ;
m_cb_plate_mark - > Hide ( ) ;
text_plate_mark_caption - > Hide ( ) ;
line2 - > Hide ( ) ;
}
2023-08-17 04:47:46 +00:00
if ( obj_ - > is_support_first_layer_inspect ) {
2022-09-02 05:12:50 +00:00
text_first_layer - > Show ( ) ;
m_cb_first_layer - > Show ( ) ;
2022-11-14 03:03:29 +00:00
line3 - > Show ( ) ;
}
else {
2022-09-02 05:12:50 +00:00
text_first_layer - > Hide ( ) ;
m_cb_first_layer - > Hide ( ) ;
2022-11-14 03:03:29 +00:00
line3 - > Hide ( ) ;
2022-09-02 05:12:50 +00:00
}
2023-08-17 04:47:46 +00:00
if ( obj_ - > is_support_auto_recovery_step_loss ) {
2022-11-14 03:03:29 +00:00
text_auto_recovery - > Show ( ) ;
m_cb_auto_recovery - > Show ( ) ;
line4 - > Show ( ) ;
}
else {
text_auto_recovery - > Hide ( ) ;
m_cb_auto_recovery - > Hide ( ) ;
line4 - > Hide ( ) ;
2022-09-02 05:12:50 +00:00
}
2023-08-15 08:05:13 +00:00
if ( obj_ - > is_support_prompt_sound ) {
text_sup_sound - > Show ( ) ;
m_cb_sup_sound - > Show ( ) ;
line5 - > Show ( ) ;
}
else {
text_sup_sound - > Hide ( ) ;
m_cb_sup_sound - > Hide ( ) ;
line5 - > Hide ( ) ;
}
2023-09-25 07:40:24 +00:00
if ( obj_ - > is_support_filament_tangle_detect ) {
text_filament_tangle - > Show ( ) ;
m_cb_filament_tangle - > Show ( ) ;
line6 - > Show ( ) ;
}
else {
text_filament_tangle - > Hide ( ) ;
m_cb_filament_tangle - > Hide ( ) ;
line6 - > Hide ( ) ;
}
2024-04-22 03:03:20 +00:00
if ( false /*obj_->is_support_nozzle_blob_detection*/ ) {
2024-04-01 02:30:27 +00:00
text_nozzle_blob - > Show ( ) ;
m_cb_nozzle_blob - > Show ( ) ;
text_nozzle_blob_caption - > Show ( ) ;
line7 - > Show ( ) ;
}
else {
text_nozzle_blob - > Hide ( ) ;
m_cb_nozzle_blob - > Hide ( ) ;
text_nozzle_blob_caption - > Hide ( ) ;
line7 - > Hide ( ) ;
}
2022-09-02 05:12:50 +00:00
2025-02-24 09:41:44 +00:00
UpdateOptionOpenDoorCheck ( obj_ ) ;
2025-02-25 02:11:42 +00:00
UpdateOptionSavePrintFileToStorage ( obj_ ) ;
2025-02-24 09:41:44 +00:00
2022-07-27 10:13:40 +00:00
this - > Freeze ( ) ;
2024-12-09 12:12:24 +00:00
2022-07-27 10:13:40 +00:00
m_cb_first_layer - > SetValue ( obj_ - > xcam_first_layer_inspector ) ;
2022-11-14 03:03:29 +00:00
m_cb_plate_mark - > SetValue ( obj_ - > xcam_buildplate_marker_detector ) ;
m_cb_auto_recovery - > SetValue ( obj_ - > xcam_auto_recovery_step_loss ) ;
2023-08-15 08:05:13 +00:00
m_cb_sup_sound - > SetValue ( obj_ - > xcam_allow_prompt_sound ) ;
2023-09-25 07:40:24 +00:00
m_cb_filament_tangle - > SetValue ( obj_ - > xcam_filament_tangle_detect ) ;
2024-04-01 02:30:27 +00:00
m_cb_nozzle_blob - > SetValue ( obj_ - > nozzle_blob_detection_enabled ) ;
2022-11-14 03:03:29 +00:00
m_cb_ai_monitoring - > SetValue ( obj_ - > xcam_ai_monitoring ) ;
for ( auto i = AiMonitorSensitivityLevel : : LOW ; i < LEVELS_NUM ; i = ( AiMonitorSensitivityLevel ) ( i + 1 ) ) {
if ( sensitivity_level_to_msg_string ( i ) = = obj_ - > xcam_ai_monitoring_sensitivity ) {
ai_monitoring_level_list - > SetSelection ( ( int ) i ) ;
break ;
}
}
update_ai_monitor_status ( ) ;
2022-07-27 10:13:40 +00:00
this - > Thaw ( ) ;
2022-12-08 02:43:54 +00:00
Layout ( ) ;
2022-07-27 10:13:40 +00:00
}
2025-02-24 09:41:44 +00:00
void PrintOptionsDialog : : UpdateOptionOpenDoorCheck ( MachineObject * obj ) {
if ( ! obj | | ! obj - > support_door_open_check ( ) ) {
m_cb_open_door - > Hide ( ) ;
text_open_door - > Hide ( ) ;
open_door_switch_board - > Hide ( ) ;
return ;
}
if ( obj - > get_door_open_check_state ( ) ! = MachineObject : : DOOR_OPEN_CHECK_DISABLE ) {
m_cb_open_door - > SetValue ( true ) ;
open_door_switch_board - > Enable ( ) ;
if ( obj - > get_door_open_check_state ( ) = = MachineObject : : DOOR_OPEN_CHECK_ENABLE_WARNING ) {
open_door_switch_board - > updateState ( " left " ) ;
open_door_switch_board - > Refresh ( ) ;
} else if ( obj - > get_door_open_check_state ( ) = = MachineObject : : DOOR_OPEN_CHECK_ENABLE_PAUSE_PRINT ) {
open_door_switch_board - > updateState ( " right " ) ;
open_door_switch_board - > Refresh ( ) ;
}
} else {
m_cb_open_door - > SetValue ( false ) ;
open_door_switch_board - > Disable ( ) ;
}
2025-03-13 03:18:54 +00:00
m_cb_open_door - > Show ( ) ;
text_open_door - > Show ( ) ;
open_door_switch_board - > Show ( ) ;
2025-02-24 09:41:44 +00:00
}
2025-02-25 02:11:42 +00:00
void PrintOptionsDialog : : UpdateOptionSavePrintFileToStorage ( MachineObject * obj )
{
if ( obj & & obj - > support_save_remote_print_file_to_storage ( ) )
{
m_cb_save_remote_print_file_to_storage - > SetValue ( obj - > get_save_remote_print_file_to_storage ( ) ) ;
}
else
{
m_cb_save_remote_print_file_to_storage - > Hide ( ) ;
text_save_remote_print_file_to_storage - > Hide ( ) ;
text_save_remote_print_file_to_storage_explain - > Hide ( ) ;
}
}
2022-07-27 10:13:40 +00:00
wxBoxSizer * PrintOptionsDialog : : create_settings_group ( wxWindow * parent )
{
2022-11-14 03:03:29 +00:00
wxBoxSizer * sizer = new wxBoxSizer ( wxVERTICAL ) ;
wxBoxSizer * line_sizer = new wxBoxSizer ( wxHORIZONTAL ) ;
2022-12-10 10:53:29 +00:00
auto m_line = new wxPanel ( this , wxID_ANY , wxDefaultPosition , wxSize ( - 1 , 1 ) , wxTAB_TRAVERSAL ) ;
m_line - > SetBackgroundColour ( wxColour ( 166 , 169 , 170 ) ) ;
sizer - > Add ( m_line , 0 , wxEXPAND , 0 ) ;
2022-11-14 03:03:29 +00:00
// ai monitoring with levels
line_sizer = new wxBoxSizer ( wxHORIZONTAL ) ;
m_cb_ai_monitoring = new CheckBox ( parent ) ;
2024-05-06 08:14:30 +00:00
text_ai_monitoring = new Label ( parent , _L ( " Enable AI monitoring of printing " ) ) ;
2022-11-14 03:03:29 +00:00
text_ai_monitoring - > SetFont ( Label : : Body_14 ) ;
2022-07-27 10:13:40 +00:00
line_sizer - > Add ( FromDIP ( 5 ) , 0 , 0 , 0 ) ;
2022-11-14 03:03:29 +00:00
line_sizer - > Add ( m_cb_ai_monitoring , 0 , wxALL | wxALIGN_CENTER_VERTICAL , FromDIP ( 5 ) ) ;
line_sizer - > Add ( text_ai_monitoring , 1 , wxALL | wxALIGN_CENTER_VERTICAL , FromDIP ( 5 ) ) ;
2022-12-10 10:53:29 +00:00
sizer - > Add ( 0 , 0 , 0 , wxTOP , FromDIP ( 18 ) ) ;
sizer - > Add ( line_sizer , 0 , wxEXPAND | wxLEFT | wxRIGHT , FromDIP ( 18 ) ) ;
2022-11-14 03:03:29 +00:00
line_sizer - > Add ( FromDIP ( 5 ) , 0 , 0 , 0 ) ;
2022-07-27 10:13:40 +00:00
line_sizer = new wxBoxSizer ( wxHORIZONTAL ) ;
2024-05-06 08:14:30 +00:00
text_ai_monitoring_caption = new Label ( parent , _L ( " Sensitivity of pausing is " ) ) ;
2022-11-14 03:03:29 +00:00
text_ai_monitoring_caption - > SetFont ( Label : : Body_14 ) ;
text_ai_monitoring_caption - > SetForegroundColour ( STATIC_TEXT_CAPTION_COL ) ;
text_ai_monitoring_caption - > Wrap ( - 1 ) ;
2022-11-14 07:13:26 +00:00
ai_monitoring_level_list = new ComboBox ( this , wxID_ANY , wxEmptyString , wxDefaultPosition , wxSize ( FromDIP ( 100 ) , - 1 ) , 0 , NULL , wxCB_READONLY ) ;
2022-11-14 03:03:29 +00:00
for ( auto i = AiMonitorSensitivityLevel : : LOW ; i < LEVELS_NUM ; i = ( AiMonitorSensitivityLevel ) ( i + 1 ) ) {
wxString level_option = sensitivity_level_to_label_string ( i ) ;
ai_monitoring_level_list - > Append ( level_option ) ;
}
2023-11-24 04:06:25 +00:00
if ( ai_monitoring_level_list - > GetCount ( ) > 0 ) {
ai_monitoring_level_list - > SetSelection ( 0 ) ;
}
2024-12-09 12:12:24 +00:00
2023-11-24 04:06:25 +00:00
2022-07-27 10:13:40 +00:00
line_sizer - > Add ( FromDIP ( 30 ) , 0 , 0 , 0 ) ;
2022-11-14 03:03:29 +00:00
line_sizer - > Add ( text_ai_monitoring_caption , 0 , wxALL | wxALIGN_CENTER_VERTICAL , FromDIP ( 5 ) ) ;
line_sizer - > Add ( ai_monitoring_level_list , 0 , wxEXPAND | wxALL , FromDIP ( 5 ) ) ;
2022-12-10 10:53:29 +00:00
sizer - > Add ( line_sizer , 0 , wxEXPAND | wxLEFT | wxRIGHT , FromDIP ( 18 ) ) ;
2022-07-27 10:13:40 +00:00
2022-11-14 03:03:29 +00:00
line1 = new StaticLine ( parent , false ) ;
line1 - > SetLineColour ( STATIC_BOX_LINE_COL ) ;
2022-12-10 10:53:29 +00:00
sizer - > Add ( line1 , 0 , wxEXPAND | wxLEFT | wxRIGHT , FromDIP ( 18 ) ) ;
2022-11-14 03:03:29 +00:00
// detection of build plate position
line_sizer = new wxBoxSizer ( wxHORIZONTAL ) ;
m_cb_plate_mark = new CheckBox ( parent ) ;
2024-05-06 08:14:30 +00:00
text_plate_mark = new Label ( parent , _L ( " Enable detection of build plate position " ) ) ;
2022-11-14 03:03:29 +00:00
text_plate_mark - > SetFont ( Label : : Body_14 ) ;
line_sizer - > Add ( FromDIP ( 5 ) , 0 , 0 , 0 ) ;
line_sizer - > Add ( m_cb_plate_mark , 0 , wxALL | wxALIGN_CENTER_VERTICAL , FromDIP ( 5 ) ) ;
line_sizer - > Add ( text_plate_mark , 1 , wxALL | wxALIGN_CENTER_VERTICAL , FromDIP ( 5 ) ) ;
2022-12-10 10:53:29 +00:00
sizer - > Add ( line_sizer , 0 , wxEXPAND | wxLEFT | wxRIGHT , FromDIP ( 18 ) ) ;
2022-11-14 03:03:29 +00:00
line_sizer - > Add ( FromDIP ( 5 ) , 0 , 0 , 0 ) ;
line_sizer = new wxBoxSizer ( wxHORIZONTAL ) ;
wxString caption_text = _L (
" The localization tag of build plate is detected, and printing is paused if the tag is not in predefined range. "
) ;
2022-11-14 07:13:26 +00:00
text_plate_mark_caption = new Label ( parent , caption_text ) ;
text_plate_mark_caption - > Wrap ( FromDIP ( 260 ) ) ;
2022-11-14 03:03:29 +00:00
text_plate_mark_caption - > SetFont ( Label : : Body_14 ) ;
text_plate_mark_caption - > SetForegroundColour ( STATIC_TEXT_CAPTION_COL ) ;
line_sizer - > Add ( FromDIP ( 30 ) , 0 , 0 , 0 ) ;
2022-12-10 10:53:29 +00:00
line_sizer - > Add ( text_plate_mark_caption , 1 , wxALL | wxALIGN_CENTER_VERTICAL , FromDIP ( 0 ) ) ;
sizer - > Add ( line_sizer , 0 , wxEXPAND | wxLEFT | wxRIGHT , FromDIP ( 18 ) ) ;
2022-11-14 03:03:29 +00:00
line2 = new StaticLine ( parent , false ) ;
line2 - > SetLineColour ( STATIC_BOX_LINE_COL ) ;
sizer - > Add ( line2 , 0 , wxEXPAND | wxLEFT | wxRIGHT , FromDIP ( 20 ) ) ;
2022-07-27 10:13:40 +00:00
2022-11-14 03:03:29 +00:00
// detection of first layer
2022-07-27 10:13:40 +00:00
line_sizer = new wxBoxSizer ( wxHORIZONTAL ) ;
m_cb_first_layer = new CheckBox ( parent ) ;
2024-05-06 08:14:30 +00:00
text_first_layer = new Label ( parent , _L ( " First Layer Inspection " ) ) ;
2022-07-27 10:13:40 +00:00
text_first_layer - > SetFont ( Label : : Body_14 ) ;
line_sizer - > Add ( FromDIP ( 5 ) , 0 , 0 , 0 ) ;
line_sizer - > Add ( m_cb_first_layer , 0 , wxALL | wxALIGN_CENTER_VERTICAL , FromDIP ( 5 ) ) ;
line_sizer - > Add ( text_first_layer , 1 , wxALL | wxALIGN_CENTER_VERTICAL , FromDIP ( 5 ) ) ;
2022-12-10 10:53:29 +00:00
sizer - > Add ( 0 , 0 , 0 , wxTOP , FromDIP ( 15 ) ) ;
sizer - > Add ( line_sizer , 0 , wxEXPAND | wxLEFT | wxRIGHT , FromDIP ( 18 ) ) ;
2022-11-14 03:03:29 +00:00
line_sizer - > Add ( FromDIP ( 5 ) , 0 , 0 , 0 ) ;
line3 = new StaticLine ( parent , false ) ;
line3 - > SetLineColour ( STATIC_BOX_LINE_COL ) ;
sizer - > Add ( line3 , 0 , wxEXPAND | wxLEFT | wxRIGHT , FromDIP ( 20 ) ) ;
// auto-recovery from step loss
line_sizer = new wxBoxSizer ( wxHORIZONTAL ) ;
m_cb_auto_recovery = new CheckBox ( parent ) ;
2024-05-06 08:14:30 +00:00
text_auto_recovery = new Label ( parent , _L ( " Auto-recovery from step loss " ) ) ;
2022-11-14 03:03:29 +00:00
text_auto_recovery - > SetFont ( Label : : Body_14 ) ;
line_sizer - > Add ( FromDIP ( 5 ) , 0 , 0 , 0 ) ;
line_sizer - > Add ( m_cb_auto_recovery , 0 , wxALL | wxALIGN_CENTER_VERTICAL , FromDIP ( 5 ) ) ;
line_sizer - > Add ( text_auto_recovery , 1 , wxALL | wxALIGN_CENTER_VERTICAL , FromDIP ( 5 ) ) ;
2022-12-10 10:53:29 +00:00
sizer - > Add ( line_sizer , 0 , wxEXPAND | wxLEFT | wxRIGHT , FromDIP ( 18 ) ) ;
2022-07-27 10:13:40 +00:00
line_sizer - > Add ( FromDIP ( 5 ) , 0 , 0 , 0 ) ;
2022-11-14 03:03:29 +00:00
line4 = new StaticLine ( parent , false ) ;
line4 - > SetLineColour ( wxColour ( 255 , 255 , 255 ) ) ;
sizer - > Add ( line4 , 0 , wxEXPAND | wxLEFT | wxRIGHT , FromDIP ( 20 ) ) ;
2025-02-24 09:41:44 +00:00
//Open Door Detection
line_sizer = new wxBoxSizer ( wxHORIZONTAL ) ;
m_cb_open_door = new CheckBox ( parent ) ;
text_open_door = new Label ( parent , _L ( " Open Door Dectection " ) ) ;
text_open_door - > SetFont ( Label : : Body_14 ) ;
open_door_switch_board = new SwitchBoard ( parent , _L ( " Notification " ) , _L ( " Pause printing " ) , wxSize ( FromDIP ( 200 ) , FromDIP ( 26 ) ) ) ;
open_door_switch_board - > Disable ( ) ;
line_sizer - > Add ( FromDIP ( 5 ) , 0 , 0 , 0 ) ;
line_sizer - > Add ( m_cb_open_door , 0 , wxALL | wxALIGN_CENTER_VERTICAL , FromDIP ( 5 ) ) ;
line_sizer - > Add ( text_open_door , 1 , wxALL | wxALIGN_CENTER_VERTICAL , FromDIP ( 5 ) ) ;
sizer - > Add ( 0 , 0 , 0 , wxTOP , FromDIP ( 15 ) ) ;
sizer - > Add ( line_sizer , 0 , wxEXPAND | wxLEFT | wxRIGHT , FromDIP ( 18 ) ) ;
sizer - > Add ( open_door_switch_board , 0 , wxLEFT , FromDIP ( 58 ) ) ;
line_sizer - > Add ( FromDIP ( 5 ) , 0 , 0 , 0 ) ;
2025-02-25 02:11:42 +00:00
//Save remote file to local storage
line_sizer = new wxBoxSizer ( wxHORIZONTAL ) ;
m_cb_save_remote_print_file_to_storage = new CheckBox ( parent ) ;
text_save_remote_print_file_to_storage = new Label ( parent , _L ( " Store Sent Files on External Storage " ) ) ;
text_save_remote_print_file_to_storage - > SetFont ( Label : : Body_14 ) ;
line_sizer - > Add ( FromDIP ( 5 ) , 0 , 0 , 0 ) ;
line_sizer - > Add ( m_cb_save_remote_print_file_to_storage , 0 , wxALL | wxALIGN_CENTER_VERTICAL , FromDIP ( 5 ) ) ;
line_sizer - > Add ( text_save_remote_print_file_to_storage , 1 , wxALL | wxALIGN_CENTER_VERTICAL , FromDIP ( 5 ) ) ;
text_save_remote_print_file_to_storage_explain = new Label ( parent , _L ( " Save the printing files initiated from Bambu Studio, Bambu Handy and MakerWorld on External Storage " ) ) ;
2025-02-27 08:45:42 +00:00
text_save_remote_print_file_to_storage_explain - > SetForegroundColour ( STATIC_TEXT_EXPLAIN_COL ) ;
2025-02-25 02:11:42 +00:00
text_save_remote_print_file_to_storage_explain - > SetFont ( Label : : Body_14 ) ;
2025-03-10 10:23:28 +00:00
text_save_remote_print_file_to_storage_explain - > Wrap ( FromDIP ( 260 ) ) ;
2025-02-25 02:11:42 +00:00
sizer - > Add ( 0 , 0 , 0 , wxTOP , FromDIP ( 15 ) ) ;
sizer - > Add ( line_sizer , 0 , wxEXPAND | wxLEFT | wxRIGHT , FromDIP ( 18 ) ) ;
sizer - > Add ( text_save_remote_print_file_to_storage_explain , 0 , wxLEFT , FromDIP ( 58 ) ) ;
line_sizer - > Add ( FromDIP ( 5 ) , 0 , 0 , 0 ) ;
2022-11-14 03:03:29 +00:00
2023-08-15 08:05:13 +00:00
//Allow prompt sound
line_sizer = new wxBoxSizer ( wxHORIZONTAL ) ;
m_cb_sup_sound = new CheckBox ( parent ) ;
2024-05-06 08:14:30 +00:00
text_sup_sound = new Label ( parent , _L ( " Allow Prompt Sound " ) ) ;
2023-08-15 08:05:13 +00:00
text_sup_sound - > SetFont ( Label : : Body_14 ) ;
line_sizer - > Add ( FromDIP ( 5 ) , 0 , 0 , 0 ) ;
line_sizer - > Add ( m_cb_sup_sound , 0 , wxALL | wxALIGN_CENTER_VERTICAL , FromDIP ( 5 ) ) ;
line_sizer - > Add ( text_sup_sound , 1 , wxALL | wxALIGN_CENTER_VERTICAL , FromDIP ( 5 ) ) ;
sizer - > Add ( 0 , 0 , 0 , wxTOP , FromDIP ( 15 ) ) ;
sizer - > Add ( line_sizer , 0 , wxEXPAND | wxLEFT | wxRIGHT , FromDIP ( 18 ) ) ;
line_sizer - > Add ( FromDIP ( 5 ) , 0 , 0 , 0 ) ;
line5 = new StaticLine ( parent , false ) ;
line5 - > SetLineColour ( STATIC_BOX_LINE_COL ) ;
sizer - > Add ( line5 , 0 , wxEXPAND | wxLEFT | wxRIGHT , FromDIP ( 20 ) ) ;
2023-09-25 07:40:24 +00:00
sizer - > Add ( 0 , 0 , 0 , wxTOP , FromDIP ( 20 ) ) ;
//filament tangle detect
line_sizer = new wxBoxSizer ( wxHORIZONTAL ) ;
m_cb_filament_tangle = new CheckBox ( parent ) ;
2024-05-06 08:14:30 +00:00
text_filament_tangle = new Label ( parent , _L ( " Filament Tangle Detect " ) ) ;
2023-09-25 07:40:24 +00:00
text_filament_tangle - > SetFont ( Label : : Body_14 ) ;
line_sizer - > Add ( FromDIP ( 5 ) , 0 , 0 , 0 ) ;
line_sizer - > Add ( m_cb_filament_tangle , 0 , wxALL | wxALIGN_CENTER_VERTICAL , FromDIP ( 5 ) ) ;
line_sizer - > Add ( text_filament_tangle , 1 , wxALL | wxALIGN_CENTER_VERTICAL , FromDIP ( 5 ) ) ;
sizer - > Add ( 0 , 0 , 0 , wxTOP , FromDIP ( 15 ) ) ;
sizer - > Add ( line_sizer , 0 , wxEXPAND | wxLEFT | wxRIGHT , FromDIP ( 18 ) ) ;
line_sizer - > Add ( FromDIP ( 5 ) , 0 , 0 , 0 ) ;
line6 = new StaticLine ( parent , false ) ;
line6 - > SetLineColour ( STATIC_BOX_LINE_COL ) ;
sizer - > Add ( line6 , 0 , wxEXPAND | wxLEFT | wxRIGHT , FromDIP ( 20 ) ) ;
2024-04-01 02:30:27 +00:00
sizer - > Add ( 0 , 0 , 0 , wxTOP , FromDIP ( 20 ) ) ;
//nozzle blob detect
line_sizer = new wxBoxSizer ( wxHORIZONTAL ) ;
m_cb_nozzle_blob = new CheckBox ( parent ) ;
2024-05-06 08:14:30 +00:00
text_nozzle_blob = new Label ( parent , _L ( " Nozzle Clumping Detection " ) ) ;
2024-04-01 02:30:27 +00:00
text_nozzle_blob - > SetFont ( Label : : Body_14 ) ;
line_sizer - > Add ( FromDIP ( 5 ) , 0 , 0 , 0 ) ;
line_sizer - > Add ( m_cb_nozzle_blob , 0 , wxALL | wxALIGN_CENTER_VERTICAL , FromDIP ( 5 ) ) ;
line_sizer - > Add ( text_nozzle_blob , 1 , wxALL | wxALIGN_CENTER_VERTICAL , FromDIP ( 5 ) ) ;
sizer - > Add ( 0 , 0 , 0 , wxTOP , FromDIP ( 15 ) ) ;
sizer - > Add ( line_sizer , 0 , wxEXPAND | wxLEFT | wxRIGHT , FromDIP ( 18 ) ) ;
line_sizer - > Add ( FromDIP ( 5 ) , 0 , 0 , 0 ) ;
line_sizer = new wxBoxSizer ( wxHORIZONTAL ) ;
wxString nozzle_blob_caption_text = _L ( " Check if the nozzle is clumping by filament or other foreign objects. " ) ;
text_nozzle_blob_caption = new Label ( parent , nozzle_blob_caption_text ) ;
text_nozzle_blob_caption - > SetFont ( Label : : Body_14 ) ;
text_nozzle_blob_caption - > Wrap ( - 1 ) ;
text_nozzle_blob_caption - > SetForegroundColour ( STATIC_TEXT_CAPTION_COL ) ;
line_sizer - > Add ( FromDIP ( 30 ) , 0 , 0 , 0 ) ;
line_sizer - > Add ( text_nozzle_blob_caption , 1 , wxALL | wxALIGN_CENTER_VERTICAL , FromDIP ( 0 ) ) ;
sizer - > Add ( line_sizer , 0 , wxEXPAND | wxLEFT | wxRIGHT , FromDIP ( 18 ) ) ;
line7 = new StaticLine ( parent , false ) ;
line7 - > SetLineColour ( STATIC_BOX_LINE_COL ) ;
sizer - > Add ( line7 , 0 , wxEXPAND | wxLEFT | wxRIGHT , FromDIP ( 20 ) ) ;
2023-08-15 08:05:13 +00:00
2024-04-22 03:03:20 +00:00
text_nozzle_blob - > Hide ( ) ;
m_cb_nozzle_blob - > Hide ( ) ;
text_nozzle_blob_caption - > Hide ( ) ;
line7 - > Hide ( ) ;
2022-11-14 03:03:29 +00:00
ai_monitoring_level_list - > Connect ( wxEVT_COMBOBOX , wxCommandEventHandler ( PrintOptionsDialog : : set_ai_monitor_sensitivity ) , NULL , this ) ;
2022-07-27 10:13:40 +00:00
return sizer ;
}
2022-11-14 03:03:29 +00:00
wxString PrintOptionsDialog : : sensitivity_level_to_label_string ( enum AiMonitorSensitivityLevel level ) {
switch ( level ) {
case LOW :
return _L ( " Low " ) ;
case MEDIUM :
return _L ( " Medium " ) ;
case HIGH :
return _L ( " High " ) ;
default :
2022-12-01 02:35:06 +00:00
return " " ;
2022-11-14 03:03:29 +00:00
}
return " " ;
}
std : : string PrintOptionsDialog : : sensitivity_level_to_msg_string ( enum AiMonitorSensitivityLevel level ) {
switch ( level ) {
case LOW :
return " low " ;
case MEDIUM :
return " medium " ;
case HIGH :
return " high " ;
default :
return " " ;
}
return " " ;
}
void PrintOptionsDialog : : set_ai_monitor_sensitivity ( wxCommandEvent & evt )
{
int level = ai_monitoring_level_list - > GetSelection ( ) ;
std : : string lvl = sensitivity_level_to_msg_string ( ( AiMonitorSensitivityLevel ) level ) ;
if ( obj & & ! lvl . empty ( ) ) {
obj - > command_xcam_control_ai_monitoring ( m_cb_ai_monitoring - > GetValue ( ) , lvl ) ;
} else {
BOOST_LOG_TRIVIAL ( warning ) < < " print_option: obj is null or lvl = " < < lvl ;
}
}
2022-07-27 10:13:40 +00:00
void PrintOptionsDialog : : update_machine_obj ( MachineObject * obj_ )
{
obj = obj_ ;
}
bool PrintOptionsDialog : : Show ( bool show )
{
2024-12-09 12:12:24 +00:00
if ( show ) {
2022-12-10 10:53:29 +00:00
wxGetApp ( ) . UpdateDlgDarkUI ( this ) ;
2024-12-09 12:12:24 +00:00
CentreOnParent ( ) ;
2022-12-10 10:53:29 +00:00
}
2022-07-27 10:13:40 +00:00
return DPIDialog : : Show ( show ) ;
}
2024-02-06 03:42:51 +00:00
PrinterPartsDialog : : PrinterPartsDialog ( wxWindow * parent )
: DPIDialog ( parent , wxID_ANY , _L ( " Printer Parts " ) , wxDefaultPosition , wxDefaultSize , wxCAPTION | wxCLOSE_BOX )
{
2024-12-09 12:12:24 +00:00
nozzle_type_map [ NozzleType : : ntHardenedSteel ] = _L ( " Hardened Steel " ) ;
nozzle_type_map [ NozzleType : : ntStainlessSteel ] = _L ( " Stainless Steel " ) ;
2024-02-06 03:42:51 +00:00
2025-01-06 08:26:29 +00:00
nozzle_flow_map [ NozzleFlowType : : S_FLOW ] = _L ( " Standard " ) ;
2024-12-09 12:12:24 +00:00
nozzle_flow_map [ NozzleFlowType : : H_FLOW ] = _L ( " High flow " ) ;
nozzle_type_selection_map [ NozzleType : : ntHardenedSteel ] = 0 ;
nozzle_type_selection_map [ NozzleType : : ntStainlessSteel ] = 1 ;
nozzle_flow_selection_map [ NozzleFlowType : : S_FLOW ] = 0 ;
nozzle_flow_selection_map [ NozzleFlowType : : H_FLOW ] = 1 ;
2024-09-10 02:11:10 +00:00
2024-02-06 03:42:51 +00:00
nozzle_stainless_diameter_map [ 0 ] = 0.2 ;
nozzle_stainless_diameter_map [ 1 ] = 0.4 ;
nozzle_hard_diameter_map [ 0 ] = 0.4 ;
nozzle_hard_diameter_map [ 1 ] = 0.6 ;
nozzle_hard_diameter_map [ 2 ] = 0.8 ;
SetBackgroundColour ( * wxWHITE ) ;
2024-09-10 02:11:10 +00:00
wxBoxSizer * sizer = new wxBoxSizer ( wxVERTICAL ) ;
wxBoxSizer * single_sizer = new wxBoxSizer ( wxVERTICAL ) ;
single_panel = new wxPanel ( this ) ;
single_panel - > SetBackgroundColour ( * wxWHITE ) ;
wxBoxSizer * multiple_sizer = new wxBoxSizer ( wxVERTICAL ) ;
multiple_panel = new wxPanel ( this ) ;
multiple_panel - > SetBackgroundColour ( * wxWHITE ) ;
2024-02-06 03:42:51 +00:00
auto m_line = new wxPanel ( this , wxID_ANY , wxDefaultPosition , wxSize ( - 1 , 1 ) , wxTAB_TRAVERSAL ) ;
m_line - > SetBackgroundColour ( wxColour ( 166 , 169 , 170 ) ) ;
2024-12-09 12:12:24 +00:00
2024-09-10 02:11:10 +00:00
/*single nozzle*/
2024-02-06 03:42:51 +00:00
//nozzle type
wxBoxSizer * line_sizer_nozzle_type = new wxBoxSizer ( wxHORIZONTAL ) ;
2024-09-10 02:11:10 +00:00
auto nozzle_type = new Label ( single_panel , _L ( " Nozzle Type " ) ) ;
2024-02-06 03:42:51 +00:00
nozzle_type - > SetFont ( Label : : Body_14 ) ;
nozzle_type - > SetMinSize ( wxSize ( FromDIP ( 180 ) , - 1 ) ) ;
nozzle_type - > SetMaxSize ( wxSize ( FromDIP ( 180 ) , - 1 ) ) ;
nozzle_type - > SetForegroundColour ( STATIC_TEXT_CAPTION_COL ) ;
nozzle_type - > Wrap ( - 1 ) ;
2024-10-26 06:30:18 +00:00
ID_NOZZLE_TYPE_CHECKBOX_SINGLE = wxNewId ( ) ;
ID_NOZZLE_TYPE_CHECKBOX_LEFT = wxNewId ( ) ;
ID_NOZZLE_TYPE_CHECKBOX_RIGHT = wxNewId ( ) ;
ID_NOZZLE_DIAMETER_CHECKBOX_SINGLE = wxNewId ( ) ;
ID_NOZZLE_DIAMETER_CHECKBOX_LEFT = wxNewId ( ) ;
ID_NOZZLE_DIAMETER_CHECKBOX_RIGHT = wxNewId ( ) ;
ID_NOZZLE_FLOW_CHECKBOX_LEFT = wxNewId ( ) ;
ID_NOZZLE_FLOW_CHECKBOX_RIGHT = wxNewId ( ) ;
2024-09-10 02:11:10 +00:00
nozzle_type_checkbox = new ComboBox ( single_panel , wxID_ANY , wxEmptyString , wxDefaultPosition , wxSize ( FromDIP ( 140 ) , - 1 ) , 0 , NULL , wxCB_READONLY ) ;
2024-12-09 12:12:24 +00:00
nozzle_type_checkbox - > Append ( nozzle_type_map [ NozzleType : : ntHardenedSteel ] ) ;
nozzle_type_checkbox - > Append ( nozzle_type_map [ NozzleType : : ntStainlessSteel ] ) ;
2024-02-06 03:42:51 +00:00
nozzle_type_checkbox - > SetSelection ( 0 ) ;
2024-12-09 12:12:24 +00:00
2024-02-06 03:42:51 +00:00
line_sizer_nozzle_type - > Add ( nozzle_type , 0 , wxALIGN_CENTER , 5 ) ;
line_sizer_nozzle_type - > Add ( 0 , 0 , 1 , wxEXPAND , 5 ) ;
line_sizer_nozzle_type - > Add ( nozzle_type_checkbox , 0 , wxALIGN_CENTER , 5 ) ;
//nozzle diameter
wxBoxSizer * line_sizer_nozzle_diameter = new wxBoxSizer ( wxHORIZONTAL ) ;
2024-09-10 02:11:10 +00:00
auto nozzle_diameter = new Label ( single_panel , _L ( " Nozzle Diameter " ) ) ;
2024-02-06 03:42:51 +00:00
nozzle_diameter - > SetFont ( Label : : Body_14 ) ;
nozzle_diameter - > SetMinSize ( wxSize ( FromDIP ( 180 ) , - 1 ) ) ;
nozzle_diameter - > SetMaxSize ( wxSize ( FromDIP ( 180 ) , - 1 ) ) ;
nozzle_diameter - > SetForegroundColour ( STATIC_TEXT_CAPTION_COL ) ;
nozzle_diameter - > Wrap ( - 1 ) ;
2024-09-10 02:11:10 +00:00
nozzle_diameter_checkbox = new ComboBox ( single_panel , wxID_ANY , wxEmptyString , wxDefaultPosition , wxSize ( FromDIP ( 140 ) , - 1 ) , 0 , NULL , wxCB_READONLY ) ;
2024-02-06 03:42:51 +00:00
line_sizer_nozzle_diameter - > Add ( nozzle_diameter , 0 , wxALIGN_CENTER , 5 ) ;
line_sizer_nozzle_diameter - > Add ( 0 , 0 , 1 , wxEXPAND , 5 ) ;
line_sizer_nozzle_diameter - > Add ( nozzle_diameter_checkbox , 0 , wxALIGN_CENTER , 5 ) ;
2024-09-10 02:11:10 +00:00
single_sizer - > Add ( m_line , 0 , wxEXPAND , 0 ) ;
single_sizer - > Add ( 0 , 0 , 0 , wxTOP , FromDIP ( 24 ) ) ;
single_sizer - > Add ( line_sizer_nozzle_type , 0 , wxALIGN_CENTER | wxLEFT | wxRIGHT , FromDIP ( 18 ) ) ;
single_sizer - > Add ( 0 , 0 , 0 , wxTOP , FromDIP ( 20 ) ) ;
single_sizer - > Add ( line_sizer_nozzle_diameter , 0 , wxALIGN_CENTER | wxLEFT | wxRIGHT , FromDIP ( 18 ) ) ;
single_sizer - > Add ( 0 , 0 , 0 , wxTOP , FromDIP ( 24 ) ) ;
2024-02-06 03:42:51 +00:00
2024-09-10 02:11:10 +00:00
single_panel - > SetSizer ( single_sizer ) ;
single_panel - > Layout ( ) ;
single_panel - > Fit ( ) ;
/*multiple nozzle*/
/*left*/
auto leftTitle = new Label ( multiple_panel , _L ( " Left Nozzle " ) ) ;
leftTitle - > SetFont ( : : Label : : Head_15 ) ;
2025-01-13 10:11:08 +00:00
leftTitle - > SetForegroundColour ( StateColor : : darkModeColorFor ( wxColour ( " #2C2C2E " ) ) ) ;
2024-09-10 02:11:10 +00:00
wxBoxSizer * multiple_left_line_sizer = new wxBoxSizer ( wxHORIZONTAL ) ;
auto multiple_left_nozzle_type = new Label ( multiple_panel , _L ( " Nozzle Type " ) ) ;
multiple_left_nozzle_type - > SetFont ( Label : : Body_14 ) ;
multiple_left_nozzle_type - > SetForegroundColour ( STATIC_TEXT_CAPTION_COL ) ;
multiple_left_nozzle_type_checkbox = new ComboBox ( multiple_panel , wxID_ANY , wxEmptyString , wxDefaultPosition , wxSize ( FromDIP ( 140 ) , - 1 ) , 0 , NULL , wxCB_READONLY ) ;
2024-12-09 12:12:24 +00:00
multiple_left_nozzle_type_checkbox - > Append ( nozzle_type_map [ NozzleType : : ntHardenedSteel ] ) ;
multiple_left_nozzle_type_checkbox - > Append ( nozzle_type_map [ NozzleType : : ntStainlessSteel ] ) ;
2024-09-10 02:11:10 +00:00
multiple_left_nozzle_type_checkbox - > SetSelection ( 0 ) ;
auto multiple_left_nozzle_diameter = new Label ( multiple_panel , _L ( " Nozzle Diameter " ) ) ;
multiple_left_nozzle_diameter - > SetFont ( Label : : Body_14 ) ;
multiple_left_nozzle_diameter - > SetForegroundColour ( STATIC_TEXT_CAPTION_COL ) ;
multiple_left_nozzle_diameter_checkbox = new ComboBox ( multiple_panel , wxID_ANY , wxEmptyString , wxDefaultPosition , wxSize ( FromDIP ( 140 ) , - 1 ) , 0 , NULL , wxCB_READONLY ) ;
auto multiple_left_nozzle_flow = new Label ( multiple_panel , _L ( " Nozzle Flow " ) ) ;
multiple_left_nozzle_flow - > SetFont ( Label : : Body_14 ) ;
multiple_left_nozzle_flow - > SetForegroundColour ( STATIC_TEXT_CAPTION_COL ) ;
multiple_left_nozzle_flow_checkbox = new ComboBox ( multiple_panel , wxID_ANY , wxEmptyString , wxDefaultPosition , wxSize ( FromDIP ( 140 ) , - 1 ) , 0 , NULL , wxCB_READONLY ) ;
2024-12-09 12:12:24 +00:00
multiple_left_nozzle_flow_checkbox - > Append ( nozzle_flow_map [ NozzleFlowType : : S_FLOW ] ) ;
multiple_left_nozzle_flow_checkbox - > Append ( nozzle_flow_map [ NozzleFlowType : : H_FLOW ] ) ;
2024-09-10 02:11:10 +00:00
multiple_left_line_sizer - > Add ( multiple_left_nozzle_type , 0 , wxALIGN_CENTER , 0 ) ;
multiple_left_line_sizer - > Add ( 0 , 0 , 0 , wxLEFT , FromDIP ( 8 ) ) ;
multiple_left_line_sizer - > Add ( multiple_left_nozzle_type_checkbox , 0 , wxALIGN_CENTER , 0 ) ;
multiple_left_line_sizer - > Add ( 0 , 0 , 0 , wxLEFT , FromDIP ( 15 ) ) ;
multiple_left_line_sizer - > Add ( multiple_left_nozzle_diameter , 0 , wxALIGN_CENTER , 0 ) ;
2025-01-21 07:17:36 +00:00
multiple_left_line_sizer - > Add ( 0 , 0 , 1 , wxLEFT , FromDIP ( 8 ) ) ;
2024-09-10 02:11:10 +00:00
multiple_left_line_sizer - > Add ( multiple_left_nozzle_diameter_checkbox , 0 , wxALIGN_CENTER , 0 ) ;
multiple_left_line_sizer - > Add ( 0 , 0 , 0 , wxLEFT , FromDIP ( 15 ) ) ;
multiple_left_line_sizer - > Add ( multiple_left_nozzle_flow , 0 , wxALIGN_CENTER , 0 ) ;
2025-01-21 07:17:36 +00:00
multiple_left_line_sizer - > Add ( 0 , 0 , 1 , wxLEFT , FromDIP ( 8 ) ) ;
2024-09-10 02:11:10 +00:00
multiple_left_line_sizer - > Add ( multiple_left_nozzle_flow_checkbox , 0 , wxALIGN_CENTER , 0 ) ;
/*right*/
auto rightTitle = new Label ( multiple_panel , _L ( " Right Nozzle " ) ) ;
rightTitle - > SetFont ( : : Label : : Head_15 ) ;
2025-01-13 10:11:08 +00:00
rightTitle - > SetForegroundColour ( StateColor : : darkModeColorFor ( wxColour ( " #2C2C2E " ) ) ) ;
2024-09-10 02:11:10 +00:00
wxBoxSizer * multiple_right_line_sizer = new wxBoxSizer ( wxHORIZONTAL ) ;
auto multiple_right_nozzle_type = new Label ( multiple_panel , _L ( " Nozzle Type " ) ) ;
multiple_right_nozzle_type - > SetFont ( Label : : Body_14 ) ;
multiple_right_nozzle_type - > SetForegroundColour ( STATIC_TEXT_CAPTION_COL ) ;
2024-10-26 06:30:18 +00:00
multiple_right_nozzle_type_checkbox = new ComboBox ( multiple_panel , ID_NOZZLE_TYPE_CHECKBOX_RIGHT , wxEmptyString , wxDefaultPosition , wxSize ( FromDIP ( 140 ) , - 1 ) , 0 , NULL , wxCB_READONLY ) ;
2024-12-09 12:12:24 +00:00
multiple_right_nozzle_type_checkbox - > Append ( nozzle_type_map [ NozzleType : : ntHardenedSteel ] ) ;
multiple_right_nozzle_type_checkbox - > Append ( nozzle_type_map [ NozzleType : : ntStainlessSteel ] ) ;
2024-09-10 02:11:10 +00:00
multiple_right_nozzle_type_checkbox - > SetSelection ( 0 ) ;
auto multiple_right_nozzle_diameter = new Label ( multiple_panel , _L ( " Nozzle Diameter " ) ) ;
multiple_right_nozzle_diameter - > SetFont ( Label : : Body_14 ) ;
multiple_right_nozzle_diameter - > SetForegroundColour ( STATIC_TEXT_CAPTION_COL ) ;
multiple_right_nozzle_diameter_checkbox = new ComboBox ( multiple_panel , wxID_ANY , wxEmptyString , wxDefaultPosition , wxSize ( FromDIP ( 140 ) , - 1 ) , 0 , NULL , wxCB_READONLY ) ;
auto multiple_right_nozzle_flow = new Label ( multiple_panel , _L ( " Nozzle Flow " ) ) ;
multiple_right_nozzle_flow - > SetFont ( Label : : Body_14 ) ;
multiple_right_nozzle_flow - > SetForegroundColour ( STATIC_TEXT_CAPTION_COL ) ;
multiple_right_nozzle_flow_checkbox = new ComboBox ( multiple_panel , wxID_ANY , wxEmptyString , wxDefaultPosition , wxSize ( FromDIP ( 140 ) , - 1 ) , 0 , NULL , wxCB_READONLY ) ;
2024-12-09 12:12:24 +00:00
multiple_right_nozzle_flow_checkbox - > Append ( nozzle_flow_map [ NozzleFlowType : : S_FLOW ] ) ;
multiple_right_nozzle_flow_checkbox - > Append ( nozzle_flow_map [ NozzleFlowType : : H_FLOW ] ) ;
2024-09-10 02:11:10 +00:00
multiple_right_line_sizer - > Add ( multiple_right_nozzle_type , 0 , wxALIGN_CENTER , 0 ) ;
multiple_right_line_sizer - > Add ( 0 , 0 , 0 , wxLEFT , FromDIP ( 8 ) ) ;
multiple_right_line_sizer - > Add ( multiple_right_nozzle_type_checkbox , 0 , wxALIGN_CENTER , 0 ) ;
multiple_right_line_sizer - > Add ( 0 , 0 , 0 , wxLEFT , FromDIP ( 15 ) ) ;
multiple_right_line_sizer - > Add ( multiple_right_nozzle_diameter , 0 , wxALIGN_CENTER , 0 ) ;
2025-01-21 07:17:36 +00:00
multiple_right_line_sizer - > Add ( 0 , 0 , 1 , wxLEFT , FromDIP ( 8 ) ) ;
2024-09-10 02:11:10 +00:00
multiple_right_line_sizer - > Add ( multiple_right_nozzle_diameter_checkbox , 0 , wxALIGN_CENTER , 0 ) ;
multiple_right_line_sizer - > Add ( 0 , 0 , 0 , wxLEFT , FromDIP ( 15 ) ) ;
multiple_right_line_sizer - > Add ( multiple_right_nozzle_flow , 0 , wxALIGN_CENTER , 0 ) ;
2025-01-21 07:17:36 +00:00
multiple_right_line_sizer - > Add ( 0 , 0 , 1 , wxLEFT , FromDIP ( 8 ) ) ;
2024-09-10 02:11:10 +00:00
multiple_right_line_sizer - > Add ( multiple_right_nozzle_flow_checkbox , 0 , wxALIGN_CENTER , 0 ) ;
multiple_sizer - > Add ( 0 , 0 , 0 , wxTOP , FromDIP ( 40 ) ) ;
multiple_sizer - > Add ( leftTitle , 0 , wxLEFT , FromDIP ( 18 ) ) ;
multiple_sizer - > Add ( multiple_left_line_sizer , 0 , wxALIGN_CENTER | wxLEFT | wxRIGHT , FromDIP ( 18 ) ) ;
2024-12-09 12:12:24 +00:00
multiple_sizer - > Add ( 0 , 0 , 0 , wxTOP , FromDIP ( 24 ) ) ;
2024-09-10 02:11:10 +00:00
multiple_sizer - > Add ( rightTitle , 0 , wxLEFT , FromDIP ( 18 ) ) ;
multiple_sizer - > Add ( multiple_right_line_sizer , 0 , wxALIGN_CENTER | wxLEFT | wxRIGHT , FromDIP ( 18 ) ) ;
multiple_sizer - > Add ( 0 , 0 , 0 , wxTOP , FromDIP ( 40 ) ) ;
multiple_panel - > SetSizer ( multiple_sizer ) ;
multiple_panel - > Layout ( ) ;
multiple_panel - > Fit ( ) ;
2024-12-09 12:12:24 +00:00
/*inset data*/
2024-09-10 02:11:10 +00:00
sizer - > Add ( single_panel , 0 , wxEXPAND , 0 ) ;
sizer - > Add ( multiple_panel , 0 , wxEXPAND , 0 ) ;
2024-02-06 03:42:51 +00:00
SetSizer ( sizer ) ;
Layout ( ) ;
Fit ( ) ;
2024-09-10 02:11:10 +00:00
single_panel - > Hide ( ) ;
2024-02-06 03:42:51 +00:00
wxGetApp ( ) . UpdateDlgDarkUI ( this ) ;
2024-10-26 06:30:18 +00:00
nozzle_type_checkbox - > Connect ( wxEVT_COMBOBOX , wxCommandEventHandler ( PrinterPartsDialog : : set_nozzle_data ) , NULL , this ) ;
nozzle_diameter_checkbox - > Connect ( wxEVT_COMBOBOX , wxCommandEventHandler ( PrinterPartsDialog : : set_nozzle_data ) , NULL , this ) ;
2024-02-06 03:42:51 +00:00
2024-10-26 06:30:18 +00:00
multiple_left_nozzle_type_checkbox - > Connect ( wxEVT_COMBOBOX , wxCommandEventHandler ( PrinterPartsDialog : : set_nozzle_data ) , NULL , this ) ;
multiple_left_nozzle_diameter_checkbox - > Connect ( wxEVT_COMBOBOX , wxCommandEventHandler ( PrinterPartsDialog : : set_nozzle_data ) , NULL , this ) ;
multiple_left_nozzle_flow_checkbox - > Connect ( wxEVT_COMBOBOX , wxCommandEventHandler ( PrinterPartsDialog : : set_nozzle_data ) , NULL , this ) ;
2024-02-06 03:42:51 +00:00
2024-10-26 06:30:18 +00:00
multiple_right_nozzle_type_checkbox - > Connect ( wxEVT_COMBOBOX , wxCommandEventHandler ( PrinterPartsDialog : : set_nozzle_data ) , NULL , this ) ;
multiple_right_nozzle_diameter_checkbox - > Connect ( wxEVT_COMBOBOX , wxCommandEventHandler ( PrinterPartsDialog : : set_nozzle_data ) , NULL , this ) ;
multiple_right_nozzle_flow_checkbox - > Connect ( wxEVT_COMBOBOX , wxCommandEventHandler ( PrinterPartsDialog : : set_nozzle_data ) , NULL , this ) ;
2024-02-06 03:42:51 +00:00
2024-10-26 06:30:18 +00:00
nozzle_type_checkbox - > SetId ( ID_NOZZLE_TYPE_CHECKBOX_SINGLE ) ;
multiple_left_nozzle_type_checkbox - > SetId ( ID_NOZZLE_TYPE_CHECKBOX_LEFT ) ;
multiple_right_nozzle_type_checkbox - > SetId ( ID_NOZZLE_TYPE_CHECKBOX_RIGHT ) ;
2024-02-06 03:42:51 +00:00
2024-10-26 06:30:18 +00:00
nozzle_diameter_checkbox - > SetId ( ID_NOZZLE_DIAMETER_CHECKBOX_SINGLE ) ;
multiple_left_nozzle_diameter_checkbox - > SetId ( ID_NOZZLE_DIAMETER_CHECKBOX_LEFT ) ;
multiple_right_nozzle_diameter_checkbox - > SetId ( ID_NOZZLE_DIAMETER_CHECKBOX_RIGHT ) ;
2024-04-22 02:27:10 +00:00
2024-10-26 06:30:18 +00:00
multiple_left_nozzle_flow_checkbox - > SetId ( ID_NOZZLE_FLOW_CHECKBOX_LEFT ) ;
multiple_right_nozzle_flow_checkbox - > SetId ( ID_NOZZLE_FLOW_CHECKBOX_RIGHT ) ;
}
2024-04-22 02:27:10 +00:00
2024-10-26 06:30:18 +00:00
PrinterPartsDialog : : ~ PrinterPartsDialog ( )
{
nozzle_type_checkbox - > Disconnect ( wxEVT_COMBOBOX , wxCommandEventHandler ( PrinterPartsDialog : : set_nozzle_data ) , NULL , this ) ;
nozzle_diameter_checkbox - > Disconnect ( wxEVT_COMBOBOX , wxCommandEventHandler ( PrinterPartsDialog : : set_nozzle_data ) , NULL , this ) ;
2024-12-09 12:12:24 +00:00
multiple_left_nozzle_type_checkbox - > Disconnect ( wxEVT_COMBOBOX , wxCommandEventHandler ( PrinterPartsDialog : : set_nozzle_data ) , NULL , this ) ;
multiple_left_nozzle_diameter_checkbox - > Disconnect ( wxEVT_COMBOBOX , wxCommandEventHandler ( PrinterPartsDialog : : set_nozzle_data ) , NULL , this ) ;
multiple_left_nozzle_flow_checkbox - > Disconnect ( wxEVT_COMBOBOX , wxCommandEventHandler ( PrinterPartsDialog : : set_nozzle_data ) , NULL , this ) ;
multiple_right_nozzle_type_checkbox - > Disconnect ( wxEVT_COMBOBOX , wxCommandEventHandler ( PrinterPartsDialog : : set_nozzle_data ) , NULL , this ) ;
multiple_right_nozzle_diameter_checkbox - > Disconnect ( wxEVT_COMBOBOX , wxCommandEventHandler ( PrinterPartsDialog : : set_nozzle_data ) , NULL , this ) ;
multiple_right_nozzle_flow_checkbox - > Disconnect ( wxEVT_COMBOBOX , wxCommandEventHandler ( PrinterPartsDialog : : set_nozzle_data ) , NULL , this ) ;
2024-02-06 03:42:51 +00:00
}
2024-10-26 06:30:18 +00:00
void PrinterPartsDialog : : set_nozzle_data ( wxCommandEvent & evt )
2024-02-06 03:42:51 +00:00
{
2024-10-26 06:30:18 +00:00
ComboBox * current_nozzle_type_combox = nullptr ;
ComboBox * current_nozzle_diameter_combox = nullptr ;
ComboBox * current_nozzle_flow_combox = nullptr ;
2024-12-09 12:12:24 +00:00
int nozzle_id = MAIN_NOZZLE_ID ;
2024-10-26 06:30:18 +00:00
2024-12-09 12:12:24 +00:00
if ( evt . GetId ( ) = = ID_NOZZLE_TYPE_CHECKBOX_SINGLE | |
evt . GetId ( ) = = ID_NOZZLE_DIAMETER_CHECKBOX_SINGLE ) {
2024-10-26 06:30:18 +00:00
current_nozzle_type_combox = nozzle_type_checkbox ;
current_nozzle_diameter_combox = nozzle_diameter_checkbox ;
2024-12-09 12:12:24 +00:00
nozzle_id = MAIN_NOZZLE_ID ;
} else if ( evt . GetId ( ) = = ID_NOZZLE_TYPE_CHECKBOX_LEFT | |
evt . GetId ( ) = = ID_NOZZLE_DIAMETER_CHECKBOX_LEFT | |
evt . GetId ( ) = = ID_NOZZLE_FLOW_CHECKBOX_LEFT ) {
current_nozzle_type_combox = multiple_left_nozzle_type_checkbox ;
current_nozzle_diameter_combox = multiple_left_nozzle_diameter_checkbox ;
current_nozzle_flow_combox = multiple_left_nozzle_flow_checkbox ;
nozzle_id = DEPUTY_NOZZLE_ID ;
} else if ( evt . GetId ( ) = = ID_NOZZLE_TYPE_CHECKBOX_RIGHT | |
evt . GetId ( ) = = ID_NOZZLE_DIAMETER_CHECKBOX_RIGHT | |
evt . GetId ( ) = = ID_NOZZLE_FLOW_CHECKBOX_RIGHT ) {
2024-10-26 06:30:18 +00:00
current_nozzle_type_combox = multiple_right_nozzle_type_checkbox ;
2024-12-09 12:12:24 +00:00
current_nozzle_diameter_combox = multiple_right_nozzle_diameter_checkbox ;
current_nozzle_flow_combox = multiple_right_nozzle_flow_checkbox ;
nozzle_id = MAIN_NOZZLE_ID ;
2024-10-26 06:30:18 +00:00
}
2024-12-09 12:12:24 +00:00
if ( obj ) {
try {
auto nozzle_type = NozzleType : : ntHardenedSteel ;
auto nozzle_diameter = 0.4f ;
auto nozzle_flow = NozzleFlowType : : NONE_FLOWTYPE ;
for ( auto sm : nozzle_type_selection_map ) {
if ( sm . second = = current_nozzle_type_combox - > GetSelection ( ) ) {
nozzle_type = sm . first ;
}
}
2024-10-26 06:30:18 +00:00
2024-12-09 12:12:24 +00:00
/*update nozzle diameter*/
if ( evt . GetId ( ) = = ID_NOZZLE_TYPE_CHECKBOX_SINGLE ) {
nozzle_diameter_checkbox - > Clear ( ) ;
std : : map < int , float > diameter_map ;
if ( nozzle_type = = NozzleType : : ntHardenedSteel ) {
diameter_map = nozzle_hard_diameter_map ;
} else if ( nozzle_type = = NozzleType : : ntStainlessSteel ) {
diameter_map = nozzle_stainless_diameter_map ;
}
for ( int i = 0 ; i < diameter_map . size ( ) ; i + + ) { nozzle_diameter_checkbox - > Append ( wxString : : Format ( _L ( " %.1f " ) , diameter_map [ i ] ) ) ; }
nozzle_diameter_checkbox - > SetSelection ( 0 ) ;
} else if ( evt . GetId ( ) = = ID_NOZZLE_TYPE_CHECKBOX_LEFT ) {
multiple_left_nozzle_diameter_checkbox - > Clear ( ) ;
std : : map < int , float > diameter_map ;
if ( nozzle_type = = NozzleType : : ntHardenedSteel ) {
diameter_map = nozzle_hard_diameter_map ;
} else if ( nozzle_type = = NozzleType : : ntStainlessSteel ) {
diameter_map = nozzle_stainless_diameter_map ;
}
for ( int i = 0 ; i < diameter_map . size ( ) ; i + + ) { multiple_left_nozzle_diameter_checkbox - > Append ( wxString : : Format ( _L ( " %.1f " ) , diameter_map [ i ] ) ) ; }
multiple_left_nozzle_diameter_checkbox - > SetSelection ( 0 ) ;
} else if ( evt . GetId ( ) = = ID_NOZZLE_TYPE_CHECKBOX_RIGHT ) {
multiple_right_nozzle_diameter_checkbox - > Clear ( ) ;
std : : map < int , float > diameter_map ;
if ( nozzle_type = = NozzleType : : ntHardenedSteel ) {
diameter_map = nozzle_hard_diameter_map ;
} else if ( nozzle_type = = NozzleType : : ntStainlessSteel ) {
diameter_map = nozzle_stainless_diameter_map ;
}
for ( int i = 0 ; i < diameter_map . size ( ) ; i + + ) { multiple_right_nozzle_diameter_checkbox - > Append ( wxString : : Format ( _L ( " %.1f " ) , diameter_map [ i ] ) ) ; }
multiple_right_nozzle_diameter_checkbox - > SetSelection ( 0 ) ;
}
2024-10-26 06:30:18 +00:00
2024-12-09 12:12:24 +00:00
nozzle_diameter = std : : stof ( current_nozzle_diameter_combox - > GetStringSelection ( ) . ToStdString ( ) ) ;
nozzle_diameter = round ( nozzle_diameter * 10 ) / 10 ;
2024-10-26 06:30:18 +00:00
2024-12-09 12:12:24 +00:00
if ( current_nozzle_flow_combox ) {
for ( auto sm : nozzle_flow_selection_map ) {
if ( sm . second = = current_nozzle_flow_combox - > GetSelection ( ) ) {
nozzle_flow = sm . first ;
}
}
2024-10-26 06:30:18 +00:00
}
2024-12-09 12:12:24 +00:00
2024-10-26 06:30:18 +00:00
if ( ! obj - > is_enable_np ) {
2024-12-09 12:12:24 +00:00
obj - > m_extder_data . extders [ MAIN_NOZZLE_ID ] . current_nozzle_diameter = nozzle_diameter ;
obj - > m_extder_data . extders [ MAIN_NOZZLE_ID ] . current_nozzle_type = nozzle_type ;
obj - > command_set_printer_nozzle ( NozzleTypeEumnToStr [ nozzle_type ] , nozzle_diameter ) ;
2024-10-26 06:30:18 +00:00
} else {
2024-12-09 12:12:24 +00:00
std : : string nozzle_data = " H " ;
if ( nozzle_flow = = NozzleFlowType : : S_FLOW ) {
nozzle_data + = " S " ;
} else if ( nozzle_flow = = NozzleFlowType : : H_FLOW ) {
nozzle_data + = " H " ;
}
if ( nozzle_type = = NozzleType : : ntStainlessSteel ) {
nozzle_data + = " 00 " ;
} else if ( nozzle_type = = NozzleType : : ntHardenedSteel ) {
nozzle_data + = " 01 " ;
}
obj - > m_extder_data . extders [ nozzle_id ] . current_nozzle_diameter = nozzle_diameter ;
obj - > m_extder_data . extders [ nozzle_id ] . current_nozzle_flow_type = nozzle_flow ;
obj - > m_extder_data . extders [ nozzle_id ] . current_nozzle_type = nozzle_type ;
obj - > command_set_printer_nozzle2 ( obj - > m_extder_data . extders [ nozzle_id ] . nozzle_id , nozzle_data , nozzle_diameter ) ;
2024-10-26 06:30:18 +00:00
}
} catch ( . . . ) { }
2024-02-06 03:42:51 +00:00
}
}
void PrinterPartsDialog : : on_dpi_changed ( const wxRect & suggested_rect )
{
Fit ( ) ;
}
void PrinterPartsDialog : : update_machine_obj ( MachineObject * obj_ )
{
2025-01-22 02:19:50 +00:00
if ( ! obj_ )
{
return ;
}
2024-02-06 03:42:51 +00:00
obj = obj_ ;
2025-01-22 02:19:50 +00:00
2025-02-15 03:24:47 +00:00
nozzle_stainless_diameter_map . clear ( ) ;
2025-01-22 02:19:50 +00:00
if ( obj - > is_series_o ( ) )
{
/*STUDIO-10089 there are only 0.2 stainless nozzle in O series*/
nozzle_stainless_diameter_map [ 0 ] = 0.2 ;
}
else
{
nozzle_stainless_diameter_map [ 0 ] = 0.2 ;
nozzle_stainless_diameter_map [ 1 ] = 0.4 ;
}
2024-02-06 03:42:51 +00:00
}
bool PrinterPartsDialog : : Show ( bool show )
{
if ( show ) {
wxGetApp ( ) . UpdateDlgDarkUI ( this ) ;
CentreOnParent ( ) ;
2024-09-10 02:11:10 +00:00
if ( obj - > m_extder_data . extders . size ( ) < = 1 ) {
single_panel - > Show ( ) ;
multiple_panel - > Hide ( ) ;
2024-04-22 02:27:10 +00:00
2024-12-09 12:12:24 +00:00
auto type = obj - > m_extder_data . extders [ MAIN_NOZZLE_ID ] . current_nozzle_type ;
auto diameter = obj - > m_extder_data . extders [ MAIN_NOZZLE_ID ] . current_nozzle_diameter ;
2024-02-06 03:42:51 +00:00
2024-09-10 02:11:10 +00:00
nozzle_diameter_checkbox - > Clear ( ) ;
2024-02-06 03:42:51 +00:00
2024-12-09 12:12:24 +00:00
if ( type = = NozzleType : : ntUndefine ) {
2024-09-10 02:11:10 +00:00
nozzle_type_checkbox - > SetValue ( wxEmptyString ) ;
nozzle_diameter_checkbox - > SetValue ( wxEmptyString ) ;
2024-05-10 11:44:12 +00:00
2024-09-10 02:11:10 +00:00
nozzle_type_checkbox - > Disable ( ) ;
nozzle_diameter_checkbox - > Disable ( ) ;
return DPIDialog : : Show ( show ) ;
} else {
nozzle_type_checkbox - > Enable ( ) ;
nozzle_diameter_checkbox - > Enable ( ) ;
2024-12-09 12:12:24 +00:00
std : : map < int , float > diameter_map ;
if ( type = = NozzleType : : ntHardenedSteel ) {
diameter_map = nozzle_hard_diameter_map ;
} else if ( type = = NozzleType : : ntStainlessSteel ) {
diameter_map = nozzle_stainless_diameter_map ;
}
for ( int i = 0 ; i < diameter_map . size ( ) ; i + + ) {
nozzle_diameter_checkbox - > Append ( wxString : : Format ( _L ( " %.1f " ) , diameter_map [ i ] ) ) ;
if ( diameter = = diameter_map [ i ] ) {
nozzle_diameter_checkbox - > SetSelection ( i ) ;
}
}
nozzle_type_checkbox - > SetSelection ( nozzle_type_selection_map [ type ] ) ;
2024-09-10 02:11:10 +00:00
}
2024-02-06 03:42:51 +00:00
2024-12-09 12:12:24 +00:00
} else {
single_panel - > Hide ( ) ;
multiple_panel - > Show ( ) ;
2024-02-06 03:42:51 +00:00
2024-12-09 12:12:24 +00:00
//left
auto type = obj - > m_extder_data . extders [ DEPUTY_NOZZLE_ID ] . current_nozzle_type ;
auto diameter = obj - > m_extder_data . extders [ DEPUTY_NOZZLE_ID ] . current_nozzle_diameter ;
auto flow_type = obj - > m_extder_data . extders [ DEPUTY_NOZZLE_ID ] . current_nozzle_flow_type ;
2025-01-09 11:56:55 +00:00
multiple_left_nozzle_type_checkbox - > Enable ( ) ;
multiple_left_nozzle_diameter_checkbox - > Enable ( ) ;
multiple_left_nozzle_flow_checkbox - > Enable ( ) ;
2024-12-09 12:12:24 +00:00
multiple_left_nozzle_diameter_checkbox - > Clear ( ) ;
2025-01-09 11:56:55 +00:00
if ( type = = NozzleType : : ntUndefine )
{
2024-12-09 12:12:24 +00:00
multiple_left_nozzle_type_checkbox - > SetValue ( wxEmptyString ) ;
multiple_left_nozzle_diameter_checkbox - > SetValue ( wxEmptyString ) ;
multiple_left_nozzle_flow_checkbox - > SetValue ( wxEmptyString ) ;
2025-01-09 11:56:55 +00:00
}
else
{
2024-12-09 12:12:24 +00:00
std : : map < int , float > diameter_map ;
2025-01-09 11:56:55 +00:00
if ( type = = NozzleType : : ntHardenedSteel )
{
2024-12-09 12:12:24 +00:00
diameter_map = nozzle_hard_diameter_map ;
2025-01-09 11:56:55 +00:00
}
else if ( type = = NozzleType : : ntStainlessSteel )
{
2024-12-09 12:12:24 +00:00
diameter_map = nozzle_stainless_diameter_map ;
}
2025-01-09 11:56:55 +00:00
for ( int i = 0 ; i < diameter_map . size ( ) ; i + + )
{
2024-12-09 12:12:24 +00:00
multiple_left_nozzle_diameter_checkbox - > Append ( wxString : : Format ( _L ( " %.1f " ) , diameter_map [ i ] ) ) ;
2025-01-09 11:56:55 +00:00
if ( diameter = = diameter_map [ i ] )
{
2024-12-09 12:12:24 +00:00
multiple_left_nozzle_diameter_checkbox - > SetSelection ( i ) ;
}
}
multiple_left_nozzle_type_checkbox - > SetSelection ( nozzle_type_selection_map [ type ] ) ;
if ( flow_type ! = NozzleFlowType : : NONE_FLOWTYPE ) { multiple_left_nozzle_flow_checkbox - > SetSelection ( nozzle_flow_selection_map [ flow_type ] ) ; }
2024-09-10 02:11:10 +00:00
}
2024-02-06 03:42:51 +00:00
2024-12-09 12:12:24 +00:00
//right
type = obj - > m_extder_data . extders [ MAIN_NOZZLE_ID ] . current_nozzle_type ;
diameter = obj - > m_extder_data . extders [ MAIN_NOZZLE_ID ] . current_nozzle_diameter ;
flow_type = obj - > m_extder_data . extders [ MAIN_NOZZLE_ID ] . current_nozzle_flow_type ;
2024-09-10 02:11:10 +00:00
2024-12-09 12:12:24 +00:00
multiple_right_nozzle_diameter_checkbox - > Clear ( ) ;
2025-01-09 11:56:55 +00:00
multiple_right_nozzle_type_checkbox - > Enable ( ) ;
multiple_right_nozzle_diameter_checkbox - > Enable ( ) ;
multiple_right_nozzle_flow_checkbox - > Enable ( ) ;
if ( type = = NozzleType : : ntUndefine )
{
2024-12-09 12:12:24 +00:00
multiple_right_nozzle_type_checkbox - > SetValue ( wxEmptyString ) ;
multiple_right_nozzle_diameter_checkbox - > SetValue ( wxEmptyString ) ;
multiple_right_nozzle_flow_checkbox - > SetValue ( wxEmptyString ) ;
2025-01-09 11:56:55 +00:00
}
else
{
2024-12-09 12:12:24 +00:00
std : : map < int , float > diameter_map ;
2025-01-09 11:56:55 +00:00
if ( type = = NozzleType : : ntHardenedSteel )
{
2024-12-09 12:12:24 +00:00
diameter_map = nozzle_hard_diameter_map ;
2025-01-13 10:11:08 +00:00
}
2025-01-09 11:56:55 +00:00
else if ( type = = NozzleType : : ntStainlessSteel )
{
2024-12-09 12:12:24 +00:00
diameter_map = nozzle_stainless_diameter_map ;
}
2025-01-09 11:56:55 +00:00
for ( int i = 0 ; i < diameter_map . size ( ) ; i + + )
{
2024-12-09 12:12:24 +00:00
multiple_right_nozzle_diameter_checkbox - > Append ( wxString : : Format ( _L ( " %.1f " ) , diameter_map [ i ] ) ) ;
2025-01-09 11:56:55 +00:00
if ( diameter = = diameter_map [ i ] )
{
2024-12-09 12:12:24 +00:00
multiple_right_nozzle_diameter_checkbox - > SetSelection ( i ) ;
}
}
multiple_right_nozzle_type_checkbox - > SetSelection ( nozzle_type_selection_map [ type ] ) ;
if ( flow_type ! = NozzleFlowType : : NONE_FLOWTYPE ) { multiple_right_nozzle_flow_checkbox - > SetSelection ( nozzle_flow_selection_map [ flow_type ] ) ; } ;
}
2024-02-06 03:42:51 +00:00
}
2025-01-09 11:56:55 +00:00
2024-09-10 02:11:10 +00:00
Layout ( ) ;
Fit ( ) ;
2024-02-06 03:42:51 +00:00
}
return DPIDialog : : Show ( show ) ;
}
2022-07-27 10:13:40 +00:00
} } // namespace Slic3r::GUI