2024-11-29 09:37:07 +00:00
# include "FilamentGroupPopup.hpp"
# include "GUI_App.hpp"
# include "MsgDialog.hpp"
# include "wx/dcgraph.h"
2024-12-24 02:50:53 +00:00
# include "I18N.hpp"
2025-01-08 13:14:10 +00:00
# include "PartPlate.hpp"
2024-11-29 09:37:07 +00:00
namespace Slic3r { namespace GUI {
2024-12-23 08:30:30 +00:00
static const wxColour LabelEnableColor = wxColour ( " #262E30 " ) ;
2024-12-24 02:50:53 +00:00
static const wxColour LabelDisableColor = wxColour ( " #ACACAC " ) ;
2024-12-23 08:30:30 +00:00
static const wxColour GreyColor = wxColour ( " #6B6B6B " ) ;
static const wxColour GreenColor = wxColour ( " #00AE42 " ) ;
static const wxColour BackGroundColor = wxColour ( " #FFFFFF " ) ;
2025-01-08 13:14:10 +00:00
static bool should_pop_up ( )
2024-11-29 09:37:07 +00:00
{
const auto & preset_bundle = wxGetApp ( ) . preset_bundle ;
const auto & full_config = preset_bundle - > full_config ( ) ;
const auto nozzle_diameters = full_config . option < ConfigOptionFloatsNullable > ( " nozzle_diameter " ) ;
return nozzle_diameters - > size ( ) > 1 ;
}
2025-01-08 13:14:10 +00:00
static FilamentMapMode get_prefered_map_mode ( )
2024-11-29 09:37:07 +00:00
{
const static std : : map < std : : string , int > enum_keys_map = ConfigOptionEnum < FilamentMapMode > : : get_enum_values ( ) ;
auto & app_config = wxGetApp ( ) . app_config ;
std : : string mode_str = app_config - > get ( " prefered_filament_map_mode " ) ;
auto iter = enum_keys_map . find ( mode_str ) ;
if ( iter = = enum_keys_map . end ( ) ) {
BOOST_LOG_TRIVIAL ( warning ) < < __FUNCTION__ < < boost : : format ( " Could not get prefered_filament_map_mode from app config, use AutoForFlsuh mode " ) ;
return FilamentMapMode : : fmmAutoForFlush ;
}
return FilamentMapMode ( iter - > second ) ;
}
static void set_prefered_map_mode ( FilamentMapMode mode )
{
const static std : : vector < std : : string > enum_values = ConfigOptionEnum < FilamentMapMode > : : get_enum_names ( ) ;
auto & app_config = wxGetApp ( ) . app_config ;
std : : string mode_str ;
if ( mode < enum_values . size ( ) ) mode_str = enum_values [ mode ] ;
if ( mode_str . empty ( ) ) BOOST_LOG_TRIVIAL ( warning ) < < __FUNCTION__ < < boost : : format ( " Set empty prefered_filament_map_mode to app config " ) ;
app_config - > set ( " prefered_filament_map_mode " , mode_str ) ;
}
2024-12-23 08:30:30 +00:00
FilamentGroupPopup : : FilamentGroupPopup ( wxWindow * parent ) : PopupWindow ( parent , wxBORDER_NONE | wxPU_CONTAINS_CONTROLS )
2024-11-29 09:37:07 +00:00
{
2024-12-24 02:50:53 +00:00
const wxString AutoForFlushLabel = _L ( " Filament-Saving Mode " ) ;
2025-01-21 08:27:37 +00:00
const wxString AutoForMatchLabel = _L ( " Convenience Mode " ) ;
2025-01-16 16:29:54 +00:00
const wxString ManualLabel = _L ( " Custom Mode " ) ;
2024-12-24 02:50:53 +00:00
2025-02-14 09:19:30 +00:00
const wxString AutoForFlushDetail = _L ( " Generates filament grouping for the left and right nozzles based on the most filament-saving principles to minimize waste " ) ;
const wxString AutoForMatchDetail = _L ( " Generates filament grouping for the left and right nozzles based on the printer's actual filament status, reducing the need for manual filament adjustment " ) ;
2025-01-21 08:27:37 +00:00
const wxString ManualDetail = _L ( " Manually assign filament to the left or right nozzle " ) ;
2025-01-13 02:20:31 +00:00
const wxString AutoForFlushDesp = " " ; //_L("(Post-slicing arrangement)");
2024-12-24 02:50:53 +00:00
const wxString ManualDesp = " " ;
2025-01-13 02:20:31 +00:00
const wxString AutoForMatchDesp = " " ; // _L("(Pre-slicing arrangement)");
2024-12-24 02:50:53 +00:00
2024-11-29 09:37:07 +00:00
wxBoxSizer * top_sizer = new wxBoxSizer ( wxVERTICAL ) ;
const int horizontal_margin = FromDIP ( 16 ) ;
const int vertical_margin = FromDIP ( 15 ) ;
const int vertical_padding = FromDIP ( 12 ) ;
const int ratio_spacing = FromDIP ( 4 ) ;
2024-12-23 08:30:30 +00:00
SetBackgroundColour ( BackGroundColor ) ;
2024-11-29 09:37:07 +00:00
radio_btns . resize ( ButtonType : : btCount ) ;
button_labels . resize ( ButtonType : : btCount ) ;
button_desps . resize ( ButtonType : : btCount ) ;
detail_infos . resize ( ButtonType : : btCount ) ;
2025-02-14 01:56:43 +00:00
//global_mode_tags.resize(ButtonType::btCount);
2025-01-10 04:06:59 +00:00
2024-11-29 09:37:07 +00:00
std : : vector < wxString > btn_texts = { AutoForFlushLabel , AutoForMatchLabel , ManualLabel } ;
std : : vector < wxString > btn_desps = { AutoForFlushDesp , AutoForMatchDesp , ManualDesp } ;
std : : vector < wxString > mode_details = { AutoForFlushDetail , AutoForMatchDetail , ManualDetail } ;
top_sizer - > AddSpacer ( vertical_margin ) ;
2025-01-10 04:06:59 +00:00
checked_bmp = create_scaled_bitmap ( " map_mode_on " , nullptr , 16 ) ; ;
unchecked_bmp = create_scaled_bitmap ( " map_mode_off " , nullptr , 16 ) ;
disabled_bmp = create_scaled_bitmap ( " map_mode_disabled " , nullptr , 16 ) ;
checked_hover_bmp = create_scaled_bitmap ( " map_mode_on_hovered " , nullptr , 16 ) ;
unchecked_hover_bmp = create_scaled_bitmap ( " map_mode_off_hovered " , nullptr , 16 ) ;
global_tag_bmp = create_scaled_bitmap ( " global_map_mode_tag " , nullptr , 16 ) ;
2024-11-29 09:37:07 +00:00
for ( size_t idx = 0 ; idx < ButtonType : : btCount ; + + idx ) {
wxBoxSizer * button_sizer = new wxBoxSizer ( wxHORIZONTAL ) ;
2025-01-10 04:06:59 +00:00
radio_btns [ idx ] = new wxBitmapButton ( this , wxID_ANY , unchecked_bmp , wxDefaultPosition , wxDefaultSize , wxNO_BORDER ) ;
2024-12-23 08:30:30 +00:00
radio_btns [ idx ] - > SetBackgroundColour ( BackGroundColor ) ;
2024-11-29 09:37:07 +00:00
2024-12-23 08:30:30 +00:00
button_labels [ idx ] = new Label ( this , btn_texts [ idx ] ) ;
button_labels [ idx ] - > SetBackgroundColour ( BackGroundColor ) ;
button_labels [ idx ] - > SetForegroundColour ( LabelEnableColor ) ;
button_labels [ idx ] - > SetFont ( Label : : Body_14 ) ;
2024-11-29 09:37:07 +00:00
2024-12-23 08:30:30 +00:00
button_desps [ idx ] = new Label ( this , btn_desps [ idx ] ) ;
button_desps [ idx ] - > SetBackgroundColour ( BackGroundColor ) ;
button_desps [ idx ] - > SetForegroundColour ( LabelEnableColor ) ;
2024-11-29 09:37:07 +00:00
button_desps [ idx ] - > SetFont ( Label : : Body_14 ) ;
2025-02-14 01:56:43 +00:00
#if 0
2025-01-10 04:06:59 +00:00
global_mode_tags [ idx ] = new wxBitmapButton ( this , wxID_ANY , global_tag_bmp , wxDefaultPosition , wxDefaultSize , wxNO_BORDER ) ;
global_mode_tags [ idx ] - > SetBackgroundColour ( BackGroundColor ) ;
global_mode_tags [ idx ] - > SetToolTip ( _L ( " Global settings " ) ) ;
2025-02-14 01:56:43 +00:00
# endif
2025-01-10 04:06:59 +00:00
button_sizer - > Add ( radio_btns [ idx ] , 0 , wxALIGN_CENTER ) ;
button_sizer - > AddSpacer ( ratio_spacing ) ;
button_sizer - > Add ( button_labels [ idx ] , 0 , wxALIGN_CENTER ) ;
button_sizer - > Add ( button_desps [ idx ] , 0 , wxALIGN_CENTER ) ;
2025-02-14 01:56:43 +00:00
//button_sizer->AddSpacer(ratio_spacing);
//button_sizer->Add(global_mode_tags[idx], 0, wxALIGN_CENTER);
2024-11-29 09:37:07 +00:00
wxBoxSizer * label_sizer = new wxBoxSizer ( wxHORIZONTAL ) ;
2024-12-23 08:30:30 +00:00
detail_infos [ idx ] = new Label ( this , mode_details [ idx ] ) ;
detail_infos [ idx ] - > SetBackgroundColour ( BackGroundColor ) ;
detail_infos [ idx ] - > SetForegroundColour ( GreyColor ) ;
2024-11-29 09:37:07 +00:00
detail_infos [ idx ] - > SetFont ( Label : : Body_12 ) ;
detail_infos [ idx ] - > Wrap ( FromDIP ( 320 ) ) ;
label_sizer - > AddSpacer ( radio_btns [ idx ] - > GetRect ( ) . width + ratio_spacing ) ;
label_sizer - > Add ( detail_infos [ idx ] , 1 , wxEXPAND | wxALIGN_CENTER_VERTICAL ) ;
top_sizer - > Add ( button_sizer , 0 , wxLEFT | wxRIGHT , horizontal_margin ) ;
top_sizer - > Add ( label_sizer , 0 , wxLEFT | wxRIGHT , horizontal_margin ) ;
top_sizer - > AddSpacer ( vertical_padding ) ;
2024-12-23 08:30:30 +00:00
radio_btns [ idx ] - > Bind ( wxEVT_LEFT_DOWN , [ this , idx ] ( auto & ) { OnRadioBtn ( idx ) ; } ) ;
2024-11-29 09:37:07 +00:00
2024-12-23 08:30:30 +00:00
radio_btns [ idx ] - > Bind ( wxEVT_ENTER_WINDOW , [ this , idx ] ( auto & ) { UpdateButtonStatus ( idx ) ; } ) ;
radio_btns [ idx ] - > Bind ( wxEVT_LEAVE_WINDOW , [ this ] ( auto & ) { UpdateButtonStatus ( ) ; } ) ;
2024-11-29 09:37:07 +00:00
2024-12-23 08:30:30 +00:00
button_labels [ idx ] - > Bind ( wxEVT_LEFT_DOWN , [ this , idx ] ( auto & ) { OnRadioBtn ( idx ) ; } ) ;
button_labels [ idx ] - > Bind ( wxEVT_ENTER_WINDOW , [ this , idx ] ( auto & ) { UpdateButtonStatus ( idx ) ; } ) ;
button_labels [ idx ] - > Bind ( wxEVT_LEAVE_WINDOW , [ this ] ( auto & ) { UpdateButtonStatus ( ) ; } ) ;
2024-11-29 09:37:07 +00:00
}
{
wxBoxSizer * button_sizer = new wxBoxSizer ( wxHORIZONTAL ) ;
2025-01-17 01:42:50 +00:00
auto * video_sizer = new wxBoxSizer ( wxHORIZONTAL ) ;
video_link = new wxStaticText ( this , wxID_ANY , _L ( " Video tutorial " ) ) ;
video_link - > SetBackgroundColour ( BackGroundColor ) ;
video_link - > SetForegroundColour ( GreenColor ) ;
video_link - > SetFont ( Label : : Body_12 . Underlined ( ) ) ;
video_link - > SetCursor ( wxCursor ( wxCURSOR_HAND ) ) ;
video_link - > Bind ( wxEVT_LEFT_DOWN , [ ] ( wxMouseEvent & )
{
2025-02-13 02:06:53 +00:00
bool is_zh = wxGetApp ( ) . app_config - > get ( " language " ) = = " zh_CN " ;
fs : : path video_path ;
if ( is_zh )
video_path = fs : : path ( resources_dir ( ) ) / " videos/dual_extruder_slicing_zh.mp4 " ;
else
video_path = fs : : path ( resources_dir ( ) ) / " videos/dual_extruder_slicing_en.mp4 " ;
2025-01-17 01:42:50 +00:00
wxString video_path_str = wxString : : FromUTF8 ( video_path . string ( ) ) ;
if ( wxFileExists ( video_path_str ) ) {
if ( wxLaunchDefaultApplication ( video_path_str ) ) {
BOOST_LOG_TRIVIAL ( info ) < < __FUNCTION__ < < boost : : format ( " Video is being played using the system's default player. " ) ;
} else {
BOOST_LOG_TRIVIAL ( error ) < < __FUNCTION__ < < boost : : format ( " launch system's default player failed " ) ;
}
} else {
BOOST_LOG_TRIVIAL ( error ) < < __FUNCTION__ < < boost : : format ( " Video file does not exist: %s " ) % video_path_str . ToStdString ( ) ;
}
wxGetApp ( ) . app_config - > set ( " play_slicing_video " , " false " ) ;
} ) ;
video_sizer - > Add ( video_link , 0 , wxALIGN_CENTER | wxALL , FromDIP ( 3 ) ) ;
button_sizer - > Add ( video_sizer , 0 , wxLEFT , horizontal_margin ) ;
button_sizer - > AddStretchSpacer ( ) ;
2025-01-16 16:29:54 +00:00
2025-01-23 12:59:07 +00:00
bool is_zh = wxGetApp ( ) . app_config - > get ( " language " ) = = " zh_CN " ;
std : : string wiki_path ;
if ( is_zh )
wiki_path = Slic3r : : resources_dir ( ) + " /wiki/filament_group_wiki_zh.html " ;
else
wiki_path = Slic3r : : resources_dir ( ) + " /wiki/filament_group_wiki_en.html " ;
2024-12-23 08:30:30 +00:00
auto * wiki_sizer = new wxBoxSizer ( wxHORIZONTAL ) ;
2025-01-13 02:20:31 +00:00
wiki_link = new wxStaticText ( this , wxID_ANY , _L ( " Learn more " ) ) ;
2024-12-23 08:30:30 +00:00
wiki_link - > SetBackgroundColour ( BackGroundColor ) ;
wiki_link - > SetForegroundColour ( GreenColor ) ;
2024-11-29 09:37:07 +00:00
wiki_link - > SetFont ( Label : : Body_12 . Underlined ( ) ) ;
wiki_link - > SetCursor ( wxCursor ( wxCURSOR_HAND ) ) ;
2025-01-16 16:29:54 +00:00
wiki_link - > Bind ( wxEVT_LEFT_DOWN , [ wiki_path ] ( wxMouseEvent & ) { wxLaunchDefaultBrowser ( wxString ( wiki_path . c_str ( ) ) ) ; } ) ;
2024-12-23 08:30:30 +00:00
wiki_sizer - > Add ( wiki_link , 0 , wxALIGN_CENTER | wxALL , FromDIP ( 3 ) ) ;
2024-11-29 09:37:07 +00:00
2024-12-23 08:30:30 +00:00
button_sizer - > Add ( wiki_sizer , 0 , wxLEFT , horizontal_margin ) ;
2024-11-29 09:37:07 +00:00
top_sizer - > Add ( button_sizer , 0 , wxEXPAND | wxLEFT | wxRIGHT , horizontal_margin ) ;
}
top_sizer - > AddSpacer ( vertical_margin ) ;
SetSizerAndFit ( top_sizer ) ;
m_mode = get_prefered_map_mode ( ) ;
m_timer = new wxTimer ( this ) ;
GUI : : wxGetApp ( ) . UpdateDarkUIWin ( this ) ;
2024-12-24 02:50:53 +00:00
Bind ( wxEVT_PAINT , & FilamentGroupPopup : : OnPaint , this ) ;
2024-11-29 09:37:07 +00:00
Bind ( wxEVT_TIMER , & FilamentGroupPopup : : OnTimer , this ) ;
Bind ( wxEVT_ENTER_WINDOW , & FilamentGroupPopup : : OnEnterWindow , this ) ;
Bind ( wxEVT_LEAVE_WINDOW , & FilamentGroupPopup : : OnLeaveWindow , this ) ;
}
void FilamentGroupPopup : : DrawRoundedCorner ( int radius )
{
# ifdef __WIN32__
HWND hwnd = GetHWND ( ) ;
if ( hwnd ) {
HRGN hrgn = CreateRoundRectRgn ( 0 , 0 , GetRect ( ) . GetWidth ( ) , GetRect ( ) . GetHeight ( ) , radius , radius ) ;
2025-01-10 04:06:59 +00:00
SetWindowRgn ( hwnd , hrgn , FALSE ) ;
2024-11-29 09:37:07 +00:00
SetWindowLong ( hwnd , GWL_EXSTYLE , GetWindowLong ( hwnd , GWL_EXSTYLE ) | WS_EX_LAYERED ) ;
SetLayeredWindowAttributes ( hwnd , 0 , 0 , LWA_COLORKEY ) ;
}
# endif
}
2024-12-23 08:30:30 +00:00
void FilamentGroupPopup : : Init ( )
2024-11-29 09:37:07 +00:00
{
2025-01-13 02:20:31 +00:00
const wxString AutoForMatchDesp = " " ; // _L("(Pre-slicing arrangement)");
const wxString MachineSyncTip = _L ( " (Sync with printer) " ) ;
2024-12-20 12:05:43 +00:00
2024-12-24 02:50:53 +00:00
radio_btns [ ButtonType : : btForMatch ] - > Enable ( m_connected ) ;
2024-12-23 08:30:30 +00:00
if ( m_connected ) {
2024-12-24 02:50:53 +00:00
button_labels [ ButtonType : : btForMatch ] - > SetForegroundColour ( LabelEnableColor ) ;
button_desps [ ButtonType : : btForMatch ] - > SetForegroundColour ( LabelEnableColor ) ;
detail_infos [ ButtonType : : btForMatch ] - > SetForegroundColour ( GreyColor ) ;
radio_btns [ ButtonType : : btForMatch ] - > SetBitmap ( unchecked_bmp ) ;
2024-12-20 12:05:43 +00:00
button_desps [ ButtonType : : btForMatch ] - > SetLabel ( AutoForMatchDesp ) ;
}
else {
2024-12-24 02:50:53 +00:00
button_labels [ ButtonType : : btForMatch ] - > SetForegroundColour ( LabelDisableColor ) ;
button_desps [ ButtonType : : btForMatch ] - > SetForegroundColour ( LabelDisableColor ) ;
detail_infos [ ButtonType : : btForMatch ] - > SetForegroundColour ( LabelDisableColor ) ;
radio_btns [ ButtonType : : btForMatch ] - > SetBitmap ( disabled_bmp ) ;
2024-12-20 12:05:43 +00:00
button_desps [ ButtonType : : btForMatch ] - > SetLabel ( MachineSyncTip ) ;
}
2025-01-08 13:14:10 +00:00
m_mode = GetFilamentMapMode ( ) ;
2024-12-23 08:30:30 +00:00
if ( m_mode = = fmmAutoForMatch & & ! m_connected ) {
2025-01-08 13:14:10 +00:00
SetFilamentMapMode ( fmmAutoForFlush ) ;
2024-12-20 12:05:43 +00:00
m_mode = fmmAutoForFlush ;
}
2025-02-14 01:56:43 +00:00
else if ( m_slice_all ) {
// reset the filament map mode in slice all mode
SetFilamentMapMode ( m_mode ) ;
}
2024-11-29 09:37:07 +00:00
UpdateButtonStatus ( ) ;
2025-01-11 12:51:33 +00:00
GUI : : wxGetApp ( ) . UpdateDarkUIWin ( this ) ;
2024-11-29 09:37:07 +00:00
}
2025-02-13 14:53:57 +00:00
void FilamentGroupPopup : : tryPopup ( Plater * plater , PartPlate * partplate , bool slice_all )
2024-11-29 09:37:07 +00:00
{
2025-01-08 13:14:10 +00:00
if ( should_pop_up ( ) ) {
bool connect_status = plater - > get_machine_sync_status ( ) ;
this - > partplate_ref = partplate ;
this - > plater_ref = plater ;
2025-02-13 14:53:57 +00:00
this - > m_sync_plate = true ;
this - > m_slice_all = slice_all ;
2024-12-28 08:21:29 +00:00
if ( m_active ) {
if ( m_connected ! = connect_status ) { Init ( ) ; }
m_connected = connect_status ;
ResetTimer ( ) ;
}
else {
m_connected = connect_status ;
m_active = true ;
Init ( ) ;
ResetTimer ( ) ;
2025-01-10 04:06:59 +00:00
DrawRoundedCorner ( 16 ) ;
2024-12-28 08:21:29 +00:00
PopupWindow : : Popup ( ) ;
}
2024-11-29 09:37:07 +00:00
}
}
2025-01-08 13:14:10 +00:00
FilamentMapMode FilamentGroupPopup : : GetFilamentMapMode ( ) const
{
const auto & proj_config = wxGetApp ( ) . preset_bundle - > project_config ;
if ( m_sync_plate )
return partplate_ref - > get_real_filament_map_mode ( proj_config ) ;
return plater_ref - > get_global_filament_map_mode ( ) ;
}
void FilamentGroupPopup : : SetFilamentMapMode ( const FilamentMapMode mode )
{
if ( m_sync_plate ) {
2025-02-13 14:53:57 +00:00
if ( m_slice_all ) {
auto plate_list = plater_ref - > get_partplate_list ( ) . get_plate_list ( ) ;
for ( int i = 0 ; i < plate_list . size ( ) ; + + i ) {
plate_list [ i ] - > set_filament_map_mode ( mode ) ;
}
}
else {
partplate_ref - > set_filament_map_mode ( mode ) ;
}
2025-01-08 13:14:10 +00:00
return ;
}
plater_ref - > set_global_filament_map_mode ( mode ) ;
}
2024-11-29 09:37:07 +00:00
void FilamentGroupPopup : : tryClose ( ) { StartTimer ( ) ; }
2024-12-24 02:50:53 +00:00
void FilamentGroupPopup : : OnPaint ( wxPaintEvent & )
{
DrawRoundedCorner ( 16 ) ;
}
2024-11-29 09:37:07 +00:00
void FilamentGroupPopup : : StartTimer ( ) { m_timer - > StartOnce ( 300 ) ; }
void FilamentGroupPopup : : ResetTimer ( )
{
if ( m_timer - > IsRunning ( ) ) { m_timer - > Stop ( ) ; }
}
2024-12-23 08:30:30 +00:00
void FilamentGroupPopup : : OnRadioBtn ( int idx )
2024-11-29 09:37:07 +00:00
{
2024-12-24 02:50:53 +00:00
if ( mode_list . at ( idx ) = = FilamentMapMode : : fmmAutoForMatch & & ! m_connected )
return ;
2025-01-09 12:43:01 +00:00
if ( m_mode ! = mode_list . at ( idx ) ) {
m_mode = mode_list . at ( idx ) ;
SetFilamentMapMode ( m_mode ) ;
2025-01-22 11:55:05 +00:00
plater_ref - > update ( ) ;
2025-01-09 12:43:01 +00:00
UpdateButtonStatus ( m_mode ) ;
}
2024-11-29 09:37:07 +00:00
}
void FilamentGroupPopup : : OnTimer ( wxTimerEvent & event ) { Dismiss ( ) ; }
2024-12-28 08:21:29 +00:00
void FilamentGroupPopup : : Dismiss ( ) {
m_active = false ;
PopupWindow : : Dismiss ( ) ;
m_timer - > Stop ( ) ;
}
2024-11-29 09:37:07 +00:00
void FilamentGroupPopup : : OnLeaveWindow ( wxMouseEvent & )
{
wxPoint pos = this - > ScreenToClient ( wxGetMousePosition ( ) ) ;
if ( this - > GetClientRect ( ) . Contains ( pos ) ) return ;
StartTimer ( ) ;
}
void FilamentGroupPopup : : OnEnterWindow ( wxMouseEvent & ) { ResetTimer ( ) ; }
void FilamentGroupPopup : : UpdateButtonStatus ( int hover_idx )
{
2025-01-10 04:06:59 +00:00
auto global_mode = plater_ref - > get_global_filament_map_mode ( ) ;
2024-11-29 09:37:07 +00:00
for ( int i = 0 ; i < ButtonType : : btCount ; + + i ) {
2025-02-14 01:56:43 +00:00
#if 0 // do not display global mode tag
2025-01-10 04:06:59 +00:00
if ( mode_list . at ( i ) = = global_mode )
global_mode_tags [ i ] - > Show ( ) ;
else
global_mode_tags [ i ] - > Hide ( ) ;
2025-02-14 01:56:43 +00:00
# endif
2024-12-23 08:30:30 +00:00
if ( ButtonType : : btForMatch = = i & & ! m_connected ) {
button_labels [ i ] - > SetFont ( Label : : Body_14 ) ;
continue ;
}
2024-11-29 09:37:07 +00:00
// process checked and unchecked status
if ( mode_list . at ( i ) = = m_mode ) {
if ( i = = hover_idx )
radio_btns [ i ] - > SetBitmap ( checked_hover_bmp ) ;
else
radio_btns [ i ] - > SetBitmap ( checked_bmp ) ;
button_labels [ i ] - > SetFont ( Label : : Head_14 ) ;
} else {
if ( i = = hover_idx )
radio_btns [ i ] - > SetBitmap ( unchecked_hover_bmp ) ;
else
radio_btns [ i ] - > SetBitmap ( unchecked_bmp ) ;
button_labels [ i ] - > SetFont ( Label : : Body_14 ) ;
}
}
2024-12-23 08:30:30 +00:00
Layout ( ) ;
2024-12-24 02:50:53 +00:00
Fit ( ) ;
2024-11-29 09:37:07 +00:00
}
2025-01-17 01:42:50 +00:00
} } // namespace Slic3r::GUI