OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::GUI::FlashforgePrintHostSendDialog Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/PrintHostDialogs.hpp>

Inheritance diagram for Slic3r::GUI::FlashforgePrintHostSendDialog:
Collaboration diagram for Slic3r::GUI::FlashforgePrintHostSendDialog:

Classes

struct  MappingRow

Public Member Functions

 FlashforgePrintHostSendDialog (const boost::filesystem::path &path, PrintHostPostUploadActions post_actions, const wxArrayString &groups, const wxArrayString &storage_paths, const wxArrayString &storage_names, bool switch_to_device_tab, const Slic3r::Flashforge *host, bool supports_material_station, std::vector< Slic3r::FlashforgeMaterialSlot > slots, const std::vector< FilamentInfo > &project_filaments)
virtual void init () override
virtual void EndModal (int ret) override
virtual std::map< std::string, std::string > extendedInfo () const override
boost::filesystem::path filename () const
PrintHostPostUploadAction post_action () const
std::string group () const
std::string storage () const
bool switch_to_device_tab () const
void show_dsa_button (wxString const &title={})
bool get_checkbox_state ()
virtual void on_dpi_changed (const wxRect &suggested_rect)
void SetButtonLabel (wxWindowID btn_id, const wxString &label, bool set_focus=false)
void AddButton (wxWindowID btn_id, const wxString &label, bool set_focus=false)
float scale_factor () const
float prev_scale_factor () const
void set_scale_factor (float v)
void set_prev_scale_factor (float v)
void set_em_unit (int v)
bool force_rescale () const
int em_unit () const
const wxFont & normal_font () const
void enable_force_rescale ()
int ShowModal ()

Protected Types

enum  {
  BORDER = 20 , LOGO_SPACING = 25 , LOGO_GAP = 20 , CONTENT_WIDTH = 242 ,
  CONTENT_MAX_HEIGHT = 60 , BTN_SPACING = 20 , VERT_SPACING = 15
}

Protected Member Functions

Button * add_button (wxWindowID btn_id, bool set_focus=false, const wxString &label=wxString())
Button * get_button (wxWindowID btn_id)
void apply_style (long style)
void finalize ()
virtual void on_sys_color_changed ()

Protected Attributes

wxTextCtrl * txt_filename
wxComboBox * combo_groups
wxComboBox * combo_storage
PrintHostPostUploadAction post_upload_action
wxString m_valid_suffix
wxString m_preselected_storage
wxArrayString m_paths
bool m_switch_to_device_tab
boost::filesystem::path m_path
PrintHostPostUploadActions m_post_actions
wxArrayString m_storage_names
wxFont boldfont
wxBoxSizer * content_sizer
wxBoxSizer * btn_sizer
wxBoxSizer * m_dsa_sizer
wxStaticBitmap * logo
MsgButtonsHash m_buttons
CheckBox * m_checkbox_dsa {nullptr}
wxString m_forward_str

Private Member Functions

void load_slots ()
bool ensure_slots_loaded (bool force_reload=false)
void rebuild_mapping_rows ()
void auto_assign_mappings ()
void refresh_mapping_card (MappingRow &row)
void sync_mapping_section_visibility ()
const Slic3r::FlashforgeMaterialSlot * find_slot_by_id (const std::string &slot_id_text) const
const FilamentInfo * find_filament_by_tool_id (int tool_id) const
bool slot_matches_filament (const Slic3r::FlashforgeMaterialSlot &slot, const FilamentInfo &filament) const
bool validate_before_close ()
std::string normalize_material (const std::string &material) const
wxColour to_wx_colour (const std::string &color) const
void update_em_unit ()
bool is_new_scale_factor () const
void rescale (const wxRect &suggested_rect)

Private Attributes

const Slic3r::Flashforge * m_host {nullptr}
std::vector< FilamentInfo > m_project_filaments
std::vector< Slic3r::FlashforgeMaterialSlot > m_slots
std::vector< MappingRow > m_mapping_rows
wxBoxSizer * m_flashforge_options_sizer {nullptr}
wxBoxSizer * m_mapping_section_sizer {nullptr}
wxWrapSizer * m_mapping_wrap_sizer {nullptr}
wxStaticText * m_status_text {nullptr}
::CheckBox * m_checkbox_leveling {nullptr}
::CheckBox * m_checkbox_timelapse {nullptr}
::CheckBox * m_checkbox_ifs {nullptr}
bool m_leveling_before_print {true}
bool m_time_lapse_video {false}
bool m_use_material_station {false}
bool m_supports_material_station {false}
bool m_slots_loaded {false}
const char * CONFIG_KEY_LEVELING = "flashforge_leveling_before_print"
const char * CONFIG_KEY_TIMELAPSE = "flashforge_timelapse_video"
const char * CONFIG_KEY_IFS = "flashforge_use_material_station"
float m_scale_factor
int m_em_unit
wxFont m_normal_font
float m_prev_scale_factor
bool m_can_rescale
bool m_force_rescale
int m_new_font_point_size

Detailed Description


Class Documentation

◆ Slic3r::GUI::FlashforgePrintHostSendDialog::MappingRow

struct Slic3r::GUI::FlashforgePrintHostSendDialog::MappingRow
Class Members
wxWindow * card {nullptr}
int tool_id {-1}

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protectedinherited
Enumerator
BORDER 
LOGO_SPACING 
LOGO_GAP 
CONTENT_WIDTH 
CONTENT_MAX_HEIGHT 
BTN_SPACING 
VERT_SPACING 
85 {
86 BORDER = 20,
87 LOGO_SPACING = 25,
88 LOGO_GAP = 20,
89 CONTENT_WIDTH = 242,
90 CONTENT_MAX_HEIGHT = 60,//TO
91 BTN_SPACING = 20,
92 VERT_SPACING = 15,//TO
93 };
@ CONTENT_WIDTH
Definition MsgDialog.hpp:89
@ LOGO_GAP
Definition MsgDialog.hpp:88
@ VERT_SPACING
Definition MsgDialog.hpp:92
@ BORDER
Definition MsgDialog.hpp:86
@ CONTENT_MAX_HEIGHT
Definition MsgDialog.hpp:90
@ BTN_SPACING
Definition MsgDialog.hpp:91
@ LOGO_SPACING
Definition MsgDialog.hpp:87

Constructor & Destructor Documentation

◆ FlashforgePrintHostSendDialog()

Slic3r::GUI::FlashforgePrintHostSendDialog::FlashforgePrintHostSendDialog ( const boost::filesystem::path & path,
PrintHostPostUploadActions post_actions,
const wxArrayString & groups,
const wxArrayString & storage_paths,
const wxArrayString & storage_names,
bool switch_to_device_tab,
const Slic3r::Flashforge * host,
bool supports_material_station,
std::vector< Slic3r::FlashforgeMaterialSlot > slots,
const std::vector< FilamentInfo > & project_filaments )
699 : PrintHostSendDialog(path, post_actions, groups, storage_paths, storage_names, switch_to_device_tab)
700 , m_host(host)
701 , m_slots(std::move(slots))
702 , m_project_filaments(project_filaments)
703{
704 m_supports_material_station = supports_material_station;
705 m_slots_loaded = !m_slots.empty();
706}
bool m_supports_material_station
Definition PrintHostDialogs.hpp:278
const Slic3r::Flashforge * m_host
Definition PrintHostDialogs.hpp:264
std::vector< FilamentInfo > m_project_filaments
Definition PrintHostDialogs.hpp:265
bool m_slots_loaded
Definition PrintHostDialogs.hpp:279
std::vector< Slic3r::FlashforgeMaterialSlot > m_slots
Definition PrintHostDialogs.hpp:266
bool switch_to_device_tab() const
Definition PrintHostDialogs.hpp:47
PrintHostSendDialog(const boost::filesystem::path &path, PrintHostPostUploadActions post_actions, const wxArrayString &groups, const wxArrayString &storage_paths, const wxArrayString &storage_names, bool switch_to_device_tab)
Definition PrintHostDialogs.cpp:470

References Slic3r::GUI::PrintHostSendDialog::PrintHostSendDialog(), m_host, m_project_filaments, m_slots, m_slots_loaded, m_supports_material_station, and Slic3r::GUI::PrintHostSendDialog::switch_to_device_tab().

Here is the call graph for this function:

Member Function Documentation

◆ add_button()

Button * Slic3r::GUI::MsgDialog::add_button ( wxWindowID btn_id,
bool set_focus = false,
const wxString & label = wxString() )
protectedinherited
185{
186 Button* btn = new Button(this, label, "", 0, 0, btn_id);
187 /* ORCA not required since all buttons has same size and Rescale re applies its style
188 ButtonSizeType type;
189
190 if (label.length() < 5) {
191 type = ButtonSizeNormal;
192 btn->SetMinSize(MSG_DIALOG_BUTTON_SIZE); // ?????
193 }
194 else if (label.length() >= 5 && label.length() < 8) {
195 type = ButtonSizeMiddle;
196 btn->SetMinSize(MSG_DIALOG_MIDDLE_BUTTON_SIZE);
197 }
198 else if (label.length() >= 8 && label.length() < 12) {
199 type = ButtonSizeMiddle;
200 btn->SetMinSize(MSG_DIALOG_LONG_BUTTON_SIZE);
201 } else {
202 type = ButtonSizeLong;
203 btn->SetMinSize(MSG_DIALOG_LONGER_BUTTON_SIZE);
204 }
205 */
206
207 if (btn_id == wxID_OK || btn_id == wxID_YES || btn_id == wxFORWARD) {
209 }
210
211 if (btn_id == wxID_CANCEL || btn_id == wxID_NO) {
213 }
214
215 if (set_focus)
216 btn->SetFocus();
217 btn_sizer->Add(btn, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, FromDIP(ButtonProps::ChoiceButtonGap()));
218 btn->Bind(wxEVT_BUTTON, [this, btn_id](wxCommandEvent&) { EndModal(btn_id); });
219
220 MsgButton *mb = new MsgButton;
221 ButtonData *bd = new ButtonData;
222
223 bd->button = btn;
224 //bd->type = type;
225
226 // m_buttons.size() is a size_t, which does not match the %d conversion
227 mb->id = wxString(std::to_string(m_buttons.size()));
228 mb->buttondata = bd;
229 m_buttons[ wxString(std::to_string(m_buttons.size()))] = mb;
230 return btn;
231};
static const wxColour bd
Definition AxisCtrlButton.cpp:25
@ Confirm
Definition Button.hpp:25
@ Regular
Definition Button.hpp:24
@ Choice
Definition Button.hpp:33
static int ChoiceButtonGap()
Definition Button.hpp:19
void SetStyle(const ButtonStyle style, const ButtonType type)
Definition Button.cpp:200
void EndModal(int retCode) override
Definition GUI_Utils.hpp:305
MsgButtonsHash m_buttons
Definition MsgDialog.hpp:108
wxBoxSizer * btn_sizer
Definition MsgDialog.hpp:105

References bd, btn_sizer, Slic3r::GUI::MsgButton::buttondata, Choice, ButtonProps::ChoiceButtonGap(), Confirm, Slic3r::GUI::DPIDialog::EndModal(), Slic3r::GUI::MsgButton::id, m_buttons, Regular, and Button::SetStyle().

Referenced by Slic3r::GUI::ConfigsOverwriteConfirmDialog::ConfigsOverwriteConfirmDialog(), Slic3r::GUI::DownloadDialog::DownloadDialog(), Slic3r::GUI::MsgUpdateForced::MsgUpdateForced(), AddButton(), apply_style(), Slic3r::GUI::ElegooPrintHostSendDialog::init(), Slic3r::GUI::FlashforgePrintHostSendDialog::init(), and Slic3r::GUI::PrintHostSendDialog::init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AddButton()

void Slic3r::GUI::MsgDialog::AddButton ( wxWindowID btn_id,
const wxString & label,
bool set_focus = false )
inlineinherited
82{ add_button(btn_id, set_focus, label); }
Button * add_button(wxWindowID btn_id, bool set_focus=false, const wxString &label=wxString())
Definition MsgDialog.cpp:184

References add_button().

Referenced by Slic3r::GUI::PrintOptionsDialog::PrintOptionsDialog(), Slic3r::GUI::wgtDeviceNozzleRackNozzleItem::OnBtnNozzleStatus(), and Slic3r::GUI::wgtDeviceNozzleRackHotendUpdate::OnStatusIconClick().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ apply_style()

void Slic3r::GUI::MsgDialog::apply_style ( long style)
protectedinherited
238{
239 if (style & wxFORWARD)
240 add_button(wxFORWARD, true, _L("Go to") + " " + m_forward_str);
241 if (style & wxOK) {
242 if (style & wxFORWARD) { add_button(wxID_CANCEL, false, _L("Later")); }
243 else {
244 add_button(wxID_OK, true, _L("OK"));
245 }
246 }
247 if (style & wxYES) add_button(wxID_YES, true, _L("Yes"));
248 if (style & wxNO) add_button(wxID_NO, false,_L("No"));
249 if (style & wxCANCEL) add_button(wxID_CANCEL, false, _L("Cancel"));
250
251 logo->SetBitmap( create_scaled_bitmap(style & wxAPPLY ? "completed" :
252 style & wxICON_WARNING ? "exclamation" : // ORCA "exclamation" used for dialogs "obj_warning" used for 16x16 areas
253 style & wxICON_INFORMATION ? "info" :
254 style & wxICON_QUESTION ? "question" : "OrcaSlicer", this, 64, style & wxICON_ERROR));
255}
#define _L(s)
Definition OBJ.cpp:34
#define style
Definition WipeTowerDialog.cpp:101
wxStaticBitmap * logo
Definition MsgDialog.hpp:107
wxString m_forward_str
Definition MsgDialog.hpp:110
wxBitmap create_scaled_bitmap(const std::string &bmp_name_in, wxWindow *win, const int px_cnt, const bool grayscale, const std::string &new_color, const bool menu_bitmap, const bool resize, const bool bitmap2, const std::vector< std::string > &array_new_color)
Definition wxExtensions.cpp:448

References _L, add_button(), create_scaled_bitmap(), logo, m_forward_str, and style.

Referenced by MsgDialog().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ auto_assign_mappings()

void Slic3r::GUI::FlashforgePrintHostSendDialog::auto_assign_mappings ( )
private
1009{
1010 for (size_t idx = 0; idx < m_project_filaments.size() && idx < m_mapping_rows.size(); ++idx) {
1011 auto& filament = m_project_filaments[idx];
1012 auto* card = as_ff_map_widget(m_mapping_rows[idx].card);
1013 if (card == nullptr)
1014 continue;
1015
1016 const wxColour filament_color = to_wx_colour(filament.color);
1017 const Slic3r::FlashforgeMaterialSlot* best_slot = nullptr;
1018 long long best_distance = std::numeric_limits<long long>::max();
1019
1020 for (const auto& slot : m_slots) {
1021 if (!slot.has_filament || !slot_matches_filament(slot, filament))
1022 continue;
1023
1024 const long long distance = color_distance_sq(filament_color, to_wx_colour(slot.material_color));
1025 if (best_slot == nullptr || distance < best_distance) {
1026 best_slot = &slot;
1027 best_distance = distance;
1028 }
1029 }
1030
1031 if (best_slot != nullptr)
1032 card->set_slot_selection(best_slot->slot_id, to_wx_colour(best_slot->material_color));
1033 else
1034 card->reset_slot();
1035
1037 }
1038}
bool slot_matches_filament(const Slic3r::FlashforgeMaterialSlot &slot, const FilamentInfo &filament) const
Definition PrintHostDialogs.cpp:1093
std::vector< MappingRow > m_mapping_rows
Definition PrintHostDialogs.hpp:267
void refresh_mapping_card(MappingRow &row)
Definition PrintHostDialogs.cpp:1040
wxColour to_wx_colour(const std::string &color) const
Definition PrintHostDialogs.cpp:1171
static FlashforgeMaterialMapWidget * as_ff_map_widget(wxWindow *window)
Definition PrintHostDialogs.cpp:459
long long color_distance_sq(const wxColour &lhs, const wxColour &rhs)
Definition PrintHostDialogs.cpp:101
float distance(SpiralVase::SpiralPoint a, SpiralVase::SpiralPoint b)
Definition SpiralVase.cpp:19
std::string material_color
Definition Flashforge.hpp:22
int slot_id
Definition Flashforge.hpp:19

References auto_assign_mappings(), m_mapping_rows, m_project_filaments, m_slots, Slic3r::FlashforgeMaterialSlot::material_color, refresh_mapping_card(), Slic3r::FlashforgeMaterialSlot::slot_id, slot_matches_filament(), and to_wx_colour().

Referenced by auto_assign_mappings().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ em_unit()

int Slic3r::GUI::DPIAware< wxDialog >::em_unit ( ) const
inlineinherited
203{ return m_em_unit; }
Definition GUI_Utils.hpp:107

Referenced by Slic3r::GUI::AuxiliaryDialog::AuxiliaryDialog(), Slic3r::GUI::CopyrightsDialog::CopyrightsDialog(), Slic3r::GUI::DesignTextDialog::DesignTextDialog(), Slic3r::GUI::EditGCodeDialog::EditGCodeDialog(), Slic3r::GUI::FileArchiveDialog::FileArchiveDialog(), Slic3r::GUI::MsgNoUpdates::MsgNoUpdates(), Slic3r::GUI::MsgUpdateForced::MsgUpdateForced(), Slic3r::GUI::OAuthDialog::OAuthDialog(), Slic3r::GUI::ParamsDialog::ParamsDialog(), Slic3r::GUI::PhysicalPrinterDialog::PhysicalPrinterDialog(), Slic3r::GUI::SettingsDialog::SettingsDialog(), anonymous_namespace{3DPrinterOS.cpp}::TokenAuthDialog::TokenAuthDialog(), anonymous_namespace{3DPrinterOS.cpp}::UploadOptionsDialog::UploadOptionsDialog(), Slic3r::GUI::PublishSettingsDialog::add_row_ui(), Slic3r::GUI::DiffPresetDialog::complete_dialog_creation(), Slic3r::GUI::DiffPresetDialog::create_edit_sizer(), Slic3r::GUI::DiffPresetDialog::create_presets_sizer(), Slic3r::GUI::DiffPresetDialog::create_tree(), Slic3r::GUI::ElegooPrintHostSendDialog::init(), Slic3r::GUI::FlashforgePrintHostSendDialog::init(), Slic3r::GUI::PrintHostSendDialog::init(), Slic3r::GUI::AboutDialog::on_dpi_changed(), Slic3r::GUI::AuxiliaryDialog::on_dpi_changed(), Slic3r::GUI::BedShapeDialog::on_dpi_changed(), Slic3r::GUI::ConfigWizard::on_dpi_changed(), Slic3r::GUI::CopyrightsDialog::on_dpi_changed(), Slic3r::GUI::DiffPresetDialog::on_dpi_changed(), Slic3r::GUI::EditGCodeDialog::on_dpi_changed(), Slic3r::GUI::FileArchiveDialog::on_dpi_changed(), Slic3r::GUI::OAuthDialog::on_dpi_changed(), Slic3r::GUI::ObjectTableDialog::on_dpi_changed(), Slic3r::GUI::ParamsDialog::on_dpi_changed(), Slic3r::GUI::PhysicalPrinterDialog::on_dpi_changed(), Slic3r::GUI::PrintHostQueueDialog::on_dpi_changed(), Slic3r::GUI::PurgeModeDialog::on_dpi_changed(), Slic3r::GUI::SavePresetDialog::on_dpi_changed(), Slic3r::GUI::SendSystemInfoDialog::on_dpi_changed(), Slic3r::GUI::SettingsDialog::on_dpi_changed(), and Slic3r::GUI::UnsavedChangesDialog::on_dpi_changed().

Here is the caller graph for this function:

◆ enable_force_rescale()

void Slic3r::GUI::DPIAware< wxDialog >::enable_force_rescale ( )
inlineinherited
206{ m_force_rescale = true; }

◆ EndModal()

void Slic3r::GUI::FlashforgePrintHostSendDialog::EndModal ( int ret)
overridevirtual

Reimplemented from Slic3r::GUI::PrintHostSendDialog.

879{
880 if (ret == wxID_OK) {
881 AppConfig* app_config = wxGetApp().app_config;
882 app_config->set("recent", CONFIG_KEY_LEVELING, m_leveling_before_print ? "1" : "0");
883 app_config->set("recent", CONFIG_KEY_TIMELAPSE, m_time_lapse_video ? "1" : "0");
884 app_config->set("recent", CONFIG_KEY_IFS, m_use_material_station ? "1" : "0");
885 }
886
888}
const char * CONFIG_KEY_LEVELING
Definition PrintHostDialogs.hpp:281
bool m_time_lapse_video
Definition PrintHostDialogs.hpp:276
bool m_leveling_before_print
Definition PrintHostDialogs.hpp:275
bool m_use_material_station
Definition PrintHostDialogs.hpp:277
const char * CONFIG_KEY_TIMELAPSE
Definition PrintHostDialogs.hpp:282
const char * CONFIG_KEY_IFS
Definition PrintHostDialogs.hpp:283
virtual void EndModal(int ret) override
Definition PrintHostDialogs.cpp:662

References CONFIG_KEY_IFS, CONFIG_KEY_LEVELING, CONFIG_KEY_TIMELAPSE, Slic3r::GUI::PrintHostSendDialog::EndModal(), m_leveling_before_print, m_time_lapse_video, m_use_material_station, and Slic3r::AppConfig::set().

Here is the call graph for this function:

◆ ensure_slots_loaded()

bool Slic3r::GUI::FlashforgePrintHostSendDialog::ensure_slots_loaded ( bool force_reload = false)
private
960{
961 if (!force_reload && (m_slots_loaded || !m_supports_material_station))
962 return m_slots_loaded;
963
964 if (m_status_text != nullptr)
965 m_status_text->SetLabel(_L("Loading IFS slots from printer..."));
966
967 wxBusyCursor wait;
968 load_slots();
969 return m_slots_loaded;
970}
wxStaticText * m_status_text
Definition PrintHostDialogs.hpp:271
void load_slots()
Definition PrintHostDialogs.cpp:930

References _L, load_slots(), m_slots_loaded, m_status_text, and m_supports_material_station.

Referenced by init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ extendedInfo()

std::map< std::string, std::string > Slic3r::GUI::FlashforgePrintHostSendDialog::extendedInfo ( ) const
overridevirtual

Reimplemented from Slic3r::GUI::PrintHostSendDialog.

891{
892 json mappings = json::array();
893 int mapped_count = 0;
894
896 for (const auto& row : m_mapping_rows) {
897 auto* card = as_ff_map_widget(row.card);
898 if (card == nullptr || row.tool_id < 0)
899 continue;
900
901 const int slot_id = card->selected_slot_id();
902 if (slot_id <= 0)
903 continue;
904
905 const auto filament_it = std::find_if(m_project_filaments.begin(), m_project_filaments.end(), [&](const FilamentInfo& item) { return item.id == row.tool_id; });
906 const auto slot_it = std::find_if(m_slots.begin(), m_slots.end(), [&](const FlashforgeMaterialSlot& slot) { return slot.slot_id == slot_id; });
907 if (filament_it == m_project_filaments.end() || slot_it == m_slots.end())
908 continue;
909
910 mappings.push_back({
911 {"toolId", filament_it->id},
912 {"slotId", slot_it->slot_id},
913 {"materialName", slot_it->material_name},
914 {"toolMaterialColor", filament_it->color},
915 {"slotMaterialColor", slot_it->material_color}
916 });
917 ++mapped_count;
918 }
919 }
920
921 return {
922 {"levelingBeforePrint", m_leveling_before_print ? "1" : "0"},
923 {"timeLapseVideo", m_time_lapse_video ? "1" : "0"},
924 {"useMatlStation", m_use_material_station ? "1" : "0"},
925 {"gcodeToolCnt", std::to_string(mapped_count)},
926 {"materialMappings", mappings.dump()}
927 };
928}
nlohmann::json json
Definition AssembleList.cpp:42

References m_leveling_before_print, m_mapping_rows, m_project_filaments, m_slots, m_time_lapse_video, and m_use_material_station.

◆ filename()

fs::path Slic3r::GUI::PrintHostSendDialog::filename ( ) const
inherited
634{
635 return into_path(txt_filename->GetValue());
636}
wxTextCtrl * txt_filename
Definition PrintHostDialogs.hpp:54
boost::filesystem::path into_path(const wxString &str)
Definition GUI.cpp:564

References Slic3r::GUI::into_path(), and txt_filename.

Referenced by Slic3r::GUI::FlashforgePrintHostSendDialog::init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ finalize()

◆ find_filament_by_tool_id()

const FilamentInfo * Slic3r::GUI::FlashforgePrintHostSendDialog::find_filament_by_tool_id ( int tool_id) const
private
1088{
1089 const auto filament_it = std::find_if(m_project_filaments.begin(), m_project_filaments.end(), [&](const FilamentInfo& filament) { return filament.id == tool_id; });
1090 return filament_it == m_project_filaments.end() ? nullptr : &(*filament_it);
1091}

References find_filament_by_tool_id(), and m_project_filaments.

Referenced by find_filament_by_tool_id(), refresh_mapping_card(), and validate_before_close().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ find_slot_by_id()

const Slic3r::FlashforgeMaterialSlot * Slic3r::GUI::FlashforgePrintHostSendDialog::find_slot_by_id ( const std::string & slot_id_text) const
private
1082{
1083 const auto slot_it = std::find_if(m_slots.begin(), m_slots.end(), [&](const FlashforgeMaterialSlot& slot) { return std::to_string(slot.slot_id) == slot_id_text; });
1084 return slot_it == m_slots.end() ? nullptr : &(*slot_it);
1085}

References find_slot_by_id(), and m_slots.

Referenced by find_slot_by_id(), refresh_mapping_card(), and validate_before_close().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ force_rescale()

bool Slic3r::GUI::DPIAware< wxDialog >::force_rescale ( ) const
inlineinherited
201{ return m_force_rescale; }

◆ get_button()

Button * Slic3r::GUI::MsgDialog::get_button ( wxWindowID btn_id)
protectedinherited
233 {
234 return static_cast<Button*>(FindWindowById(btn_id, this));
235}

Referenced by Slic3r::GUI::MsgUpdateForced::MsgUpdateForced(), and SetButtonLabel().

Here is the caller graph for this function:

◆ get_checkbox_state()

bool Slic3r::GUI::MsgDialog::get_checkbox_state ( )
inherited

◆ group()

std::string Slic3r::GUI::PrintHostSendDialog::group ( ) const
inherited
644{
645 if (combo_groups == nullptr) {
646 return "";
647 } else {
648 wxString group = combo_groups->GetValue();
649 return into_u8(group);
650 }
651}
std::string group() const
Definition PrintHostDialogs.cpp:643
wxComboBox * combo_groups
Definition PrintHostDialogs.hpp:55
std::string into_u8(const wxString &str)
Definition GUI.cpp:549

References combo_groups, group(), and Slic3r::GUI::into_u8().

Referenced by EndModal(), and group().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ init()

void Slic3r::GUI::FlashforgePrintHostSendDialog::init ( )
overridevirtual

Reimplemented from Slic3r::GUI::PrintHostSendDialog.

709{
710 const AppConfig* app_config = wxGetApp().app_config;
711 const auto& path = m_path;
712
713 std::string leveling = app_config->get("recent", CONFIG_KEY_LEVELING);
714 if (!leveling.empty())
715 m_leveling_before_print = leveling == "1";
716
717 std::string timelapse = app_config->get("recent", CONFIG_KEY_TIMELAPSE);
718 if (!timelapse.empty())
719 m_time_lapse_video = timelapse == "1";
720
721 // Flashforge local printing should default to IFS enabled when supported.
722 // We don't revive an old stale "0" here.
724 if (m_supports_material_station && !app_config->has("recent", CONFIG_KEY_IFS))
725 const_cast<AppConfig*>(app_config)->set("recent", CONFIG_KEY_IFS, "1");
726
727 this->SetMinSize(wxSize(560, 420));
728
729 auto* label_dir_hint = new wxStaticText(this, wxID_ANY, _L("Use forward slashes ( / ) as a directory separator if needed."));
730 label_dir_hint->Wrap(CONTENT_WIDTH * wxGetApp().em_unit());
731 content_sizer->Add(txt_filename, 0, wxEXPAND);
732 content_sizer->Add(label_dir_hint);
733 content_sizer->AddSpacer(VERT_SPACING);
734
735 wxString recent_path = from_u8(app_config->get("recent", CONFIG_KEY_PATH));
736 if (recent_path.Length() > 0 && recent_path[recent_path.Length() - 1] != '/')
737 recent_path += '/';
738 const auto recent_path_len = recent_path.Length();
739 recent_path += path.filename().wstring();
740 wxString stem(path.stem().wstring());
741 const auto stem_len = stem.Length();
742 txt_filename->SetValue(recent_path);
743
744 {
745 auto checkbox_sizer = new wxBoxSizer(wxHORIZONTAL);
746 auto checkbox = new ::CheckBox(this, wxID_APPLY);
747 checkbox->SetValue(m_switch_to_device_tab);
748 checkbox->Bind(wxEVT_TOGGLEBUTTON, [this](wxCommandEvent& e) {
749 auto* source = dynamic_cast<::CheckBox*>(e.GetEventObject());
750 if (source != nullptr)
751 source->SetValue(e.IsChecked());
752 m_switch_to_device_tab = e.IsChecked();
753 e.Skip();
754 });
755 checkbox_sizer->Add(checkbox, 0, wxALL | wxALIGN_CENTER, FromDIP(2));
756
757 auto checkbox_text = new wxStaticText(this, wxID_ANY, _L("Switch to Device tab after upload."));
758 checkbox_text->SetFont(::Label::Body_13);
759 checkbox_text->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#323A3D")));
760 checkbox_sizer->Add(checkbox_text, 0, wxALL | wxALIGN_CENTER, FromDIP(2));
761 content_sizer->Add(checkbox_sizer);
762 content_sizer->AddSpacer(VERT_SPACING);
763 }
764
765 m_flashforge_options_sizer = new wxBoxSizer(wxVERTICAL);
766
767 auto add_option_checkbox = [this](wxBoxSizer* parent, const wxString& label, bool value, std::function<void(bool)> setter, ::CheckBox** out = nullptr) {
768 auto row = new wxBoxSizer(wxHORIZONTAL);
769 auto checkbox = new ::CheckBox(this);
770 checkbox->SetValue(value);
771 checkbox->Bind(wxEVT_TOGGLEBUTTON, [setter](wxCommandEvent& e) {
772 auto* source = dynamic_cast<::CheckBox*>(e.GetEventObject());
773 if (source != nullptr)
774 source->SetValue(e.IsChecked());
775 setter(e.IsChecked());
776 e.Skip();
777 });
778 row->Add(checkbox, 0, wxALL | wxALIGN_CENTER, FromDIP(2));
779
780 auto text = new wxStaticText(this, wxID_ANY, label);
781 text->SetFont(::Label::Body_13);
782 text->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#323A3D")));
783 row->Add(text, 0, wxALL | wxALIGN_CENTER, FromDIP(2));
784 parent->Add(row);
785 parent->AddSpacer(FromDIP(6));
786
787 if (out != nullptr)
788 *out = checkbox;
789 };
790
791 add_option_checkbox(m_flashforge_options_sizer, _L("Leveling before print"), m_leveling_before_print,
792 [this](bool checked) { m_leveling_before_print = checked; }, &m_checkbox_leveling);
793 add_option_checkbox(m_flashforge_options_sizer, _L("Time-lapse"), m_time_lapse_video,
794 [this](bool checked) { m_time_lapse_video = checked; }, &m_checkbox_timelapse);
795 add_option_checkbox(m_flashforge_options_sizer, _L("Enable IFS"), m_use_material_station,
796 [this](bool checked) {
797 m_use_material_station = checked;
798 if (checked) {
801 }
803 }, &m_checkbox_ifs);
804
806 m_checkbox_ifs->Enable(false);
807
808 m_status_text = new wxStaticText(this, wxID_ANY, wxEmptyString);
810 m_flashforge_options_sizer->Add(m_status_text, 0, wxTOP | wxBOTTOM, FromDIP(4));
811
812 m_mapping_section_sizer = new wxBoxSizer(wxVERTICAL);
813 m_mapping_wrap_sizer = new wxWrapSizer(wxHORIZONTAL, wxWRAPSIZER_DEFAULT_FLAGS);
814 m_mapping_section_sizer->Add(m_mapping_wrap_sizer, 0, wxTOP | wxALIGN_LEFT, FromDIP(10));
816
817 content_sizer->Add(m_flashforge_options_sizer, 0, wxEXPAND);
818
820 m_status_text->SetLabel(wxString::Format(_L_PLURAL("Detected %d IFS slot on printer.", "Detected %d IFS slots on printer.", m_slots.size()),
821 static_cast<int>(m_slots.size())));
822 else
823 m_status_text->SetLabel(_L("This printer does not report a material station."));
824
827
828 if (size_t extension_start = recent_path.find_last_of('.'); extension_start != std::string::npos)
829 m_valid_suffix = recent_path.substr(extension_start);
830
831 auto validate_path = [this](const wxString& filename) -> bool {
832 if (!filename.Lower().EndsWith(m_valid_suffix.Lower())) {
833 MessageDialog msg_wingow(this, wxString::Format(_L("Upload filename doesn't end with \"%s\". Do you wish to continue?"), m_valid_suffix),
834 wxString(SLIC3R_APP_NAME), wxYES | wxNO);
835 if (msg_wingow.ShowModal() == wxID_NO)
836 return false;
837 }
838 return validate_before_close();
839 };
840
841 auto* btn_ok = add_button(wxID_OK, true, _L("Upload"));
842 btn_ok->Bind(wxEVT_BUTTON, [this, validate_path](wxCommandEvent&) {
843 if (validate_path(txt_filename->GetValue())) {
845 EndDialog(wxID_OK);
846 }
847 });
848
850 auto* btn_print = add_button(wxID_YES, false, _L("Upload and Print"));
851 btn_print->Bind(wxEVT_BUTTON, [this, validate_path](wxCommandEvent&) {
852 if (validate_path(txt_filename->GetValue())) {
854 EndDialog(wxID_OK);
855 }
856 });
857 }
858
859 add_button(wxID_CANCEL, false, _L("Cancel"));
860 finalize();
861 txt_filename->SetFocus();
862
863#ifdef __linux__
864 txt_filename->Bind(wxEVT_KILL_FOCUS, [this](wxEvent& e) {
865 e.Skip();
866 txt_filename->SetInsertionPoint(txt_filename->GetLastPosition());
867 }, txt_filename->GetId());
868#endif /* __linux__ */
869
870 Bind(wxEVT_SHOW, [=](const wxShowEvent&) {
871 CallAfter([=]() {
872 txt_filename->SetInsertionPoint(0);
873 txt_filename->SetSelection(recent_path_len, recent_path_len + stem_len);
874 });
875 });
876}
class WXDLLIMPEXP_FWD_CORE wxStaticText
Definition ProgressDialog.hpp:30
static wxFont Body_13
Definition Label.hpp:54
static wxFont Body_12
Definition Label.hpp:55
int em_unit() const
Definition GUI_Utils.hpp:203
bool validate_before_close()
Definition PrintHostDialogs.cpp:1103
bool ensure_slots_loaded(bool force_reload=false)
Definition PrintHostDialogs.cpp:959
::CheckBox * m_checkbox_ifs
Definition PrintHostDialogs.hpp:274
::CheckBox * m_checkbox_timelapse
Definition PrintHostDialogs.hpp:273
void sync_mapping_section_visibility()
Definition PrintHostDialogs.cpp:1066
::CheckBox * m_checkbox_leveling
Definition PrintHostDialogs.hpp:272
wxBoxSizer * m_mapping_section_sizer
Definition PrintHostDialogs.hpp:269
wxWrapSizer * m_mapping_wrap_sizer
Definition PrintHostDialogs.hpp:270
wxBoxSizer * m_flashforge_options_sizer
Definition PrintHostDialogs.hpp:268
void rebuild_mapping_rows()
Definition PrintHostDialogs.cpp:972
wxString m_valid_suffix
Definition PrintHostDialogs.hpp:58
PrintHostPostUploadAction post_upload_action
Definition PrintHostDialogs.hpp:57
boost::filesystem::path filename() const
Definition PrintHostDialogs.cpp:633
boost::filesystem::path m_path
Definition PrintHostDialogs.hpp:63
bool m_switch_to_device_tab
Definition PrintHostDialogs.hpp:61
PrintHostPostUploadActions m_post_actions
Definition PrintHostDialogs.hpp:64
static wxColour darkModeColorFor(wxColour const &color)
Definition StateColor.cpp:219
static const char * CONFIG_KEY_PATH
Definition PrintHostDialogs.cpp:466
wxString from_u8(const std::string &str)
Definition GUI.cpp:544
@ None
Definition PrintHost.hpp:24
@ StartPrint
Definition PrintHost.hpp:25
void set(id object, const void *key, id value)
Definition MacIME.mm:24
#define _L_PLURAL(s, plural, n)
Definition I18N.hpp:96
wxBoxSizer * content_sizer
Definition MsgDialog.hpp:104
void finalize()
Definition MsgDialog.cpp:257

References _L, _L_PLURAL, Slic3r::GUI::MsgDialog::add_button(), Label::Body_12, Label::Body_13, CONFIG_KEY_IFS, CONFIG_KEY_LEVELING, Slic3r::GUI::CONFIG_KEY_PATH, CONFIG_KEY_TIMELAPSE, Slic3r::GUI::MsgDialog::content_sizer, Slic3r::GUI::MsgDialog::CONTENT_WIDTH, StateColor::darkModeColorFor(), Slic3r::GUI::DPIAware< wxDialog >::em_unit(), ensure_slots_loaded(), Slic3r::GUI::PrintHostSendDialog::filename(), Slic3r::GUI::MsgDialog::finalize(), Slic3r::GUI::from_u8(), Slic3r::AppConfig::get(), Slic3r::AppConfig::has(), m_checkbox_ifs, m_checkbox_leveling, m_checkbox_timelapse, m_flashforge_options_sizer, m_leveling_before_print, m_mapping_section_sizer, m_mapping_wrap_sizer, Slic3r::GUI::PrintHostSendDialog::m_path, Slic3r::GUI::PrintHostSendDialog::m_post_actions, m_slots, m_status_text, m_supports_material_station, Slic3r::GUI::PrintHostSendDialog::m_switch_to_device_tab, m_time_lapse_video, m_use_material_station, Slic3r::GUI::PrintHostSendDialog::m_valid_suffix, Slic3r::None, Slic3r::GUI::PrintHostSendDialog::post_upload_action, rebuild_mapping_rows(), Slic3r::GUI::DPIAware< P >::ShowModal(), Slic3r::StartPrint, sync_mapping_section_visibility(), Slic3r::GUI::PrintHostSendDialog::txt_filename, validate_before_close(), Slic3r::GUI::MsgDialog::VERT_SPACING, and wxStaticText.

Here is the call graph for this function:

◆ is_new_scale_factor()

bool Slic3r::GUI::DPIAware< wxDialog >::is_new_scale_factor ( ) const
inlineprivateinherited
262{ return fabs(m_scale_factor - m_prev_scale_factor) > 0.001; }

◆ load_slots()

void Slic3r::GUI::FlashforgePrintHostSendDialog::load_slots ( )
private
931{
932 m_slots.clear();
933 m_slots_loaded = false;
935
936 if (m_host == nullptr) {
937 m_status_text->SetLabel(_L("Flashforge host is not available."));
938 return;
939 }
940
941 wxString msg;
942 bool supports_material_station = false;
943 if (!m_host->fetch_material_slots(m_slots, &supports_material_station, msg)) {
944 m_status_text->SetLabel(msg.empty() ? _L("Unable to read IFS slots from printer.") : msg);
945 return;
946 }
947
948 m_supports_material_station = supports_material_station;
949 m_slots_loaded = !m_slots.empty();
951
953 m_status_text->SetLabel(wxString::Format(_L_PLURAL("Detected %d IFS slot on printer.", "Detected %d IFS slots on printer.", m_slots.size()),
954 static_cast<int>(m_slots.size())));
955 else
956 m_status_text->SetLabel(_L("This printer does not report a material station."));
957}

References _L, _L_PLURAL, m_host, m_slots, m_slots_loaded, m_status_text, m_supports_material_station, and m_use_material_station.

Referenced by ensure_slots_loaded().

Here is the caller graph for this function:

◆ normal_font()

◆ normalize_material()

std::string Slic3r::GUI::FlashforgePrintHostSendDialog::normalize_material ( const std::string & material) const
private
1137{
1138 std::string normalized = boost::to_upper_copy(material);
1139 normalized.erase(std::remove_if(normalized.begin(), normalized.end(), [](unsigned char ch) { return !std::isalnum(ch); }), normalized.end());
1140
1141 if (normalized.empty())
1142 return {};
1143
1144 if (normalized.find("SILK") != std::string::npos)
1145 return "SILK";
1146
1147 if (normalized.find("PLA") != std::string::npos && normalized.find("CF") != std::string::npos)
1148 return "PLACF";
1149 if (normalized.find("PETG") != std::string::npos && normalized.find("CF") != std::string::npos)
1150 return "PETGCF";
1151
1152 if (normalized == "PLA" || normalized == "PLA+" || normalized == "PLAPLUS")
1153 return "PLA";
1154 if (normalized.find("PLA") != std::string::npos)
1155 return "PLA";
1156
1157 if (normalized == "ABS" || normalized.find("ABS") != std::string::npos)
1158 return "ABS";
1159 if (normalized == "ASA" || normalized.find("ASA") != std::string::npos)
1160 return "ABS";
1161
1162 if (normalized.find("PETG") != std::string::npos)
1163 return "PETG";
1164
1165 if (normalized.find("TPU") != std::string::npos || normalized.find("TPE") != std::string::npos || normalized.find("FLEX") != std::string::npos)
1166 return "TPU";
1167
1168 return normalized;
1169}

References normalize_material().

Referenced by normalize_material(), and slot_matches_filament().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ on_dpi_changed()

void Slic3r::GUI::MsgDialog::on_dpi_changed ( const wxRect & suggested_rect)
virtualinherited

Implements Slic3r::GUI::DPIAware< wxDialog >.

150 {
151 if (m_buttons.size() > 0) {
152 MsgButtonsHash::iterator i = m_buttons.begin();
153
154 while (i != m_buttons.end()) {
155 MsgButton *bd = i->second;
156 /* ORCA not required since all buttons has same size and Rescale re applies its style
157 wxSize bsize;
158
159
160 switch (bd->buttondata->type) {
161 case ButtonSizeNormal:bsize = MSG_DIALOG_BUTTON_SIZE;break;
162 case ButtonSizeMiddle: bsize = MSG_DIALOG_MIDDLE_BUTTON_SIZE; break;
163 case ButtonSizeLong: bsize = MSG_DIALOG_LONG_BUTTON_SIZE; break;
164 default: break;
165 }
166
167 bd->buttondata->button->SetMinSize(bsize);
168 */
169 bd->buttondata->button->Rescale();
170 i++;
171 }
172 }
173 }

References bd, and m_buttons.

◆ on_sys_color_changed()

◆ post_action()

PrintHostPostUploadAction Slic3r::GUI::PrintHostSendDialog::post_action ( ) const
inherited
639{
640 return post_upload_action;
641}

References post_upload_action.

◆ prev_scale_factor()

float Slic3r::GUI::DPIAware< wxDialog >::prev_scale_factor ( ) const
inlineinherited
196{ return m_prev_scale_factor; }

◆ rebuild_mapping_rows()

void Slic3r::GUI::FlashforgePrintHostSendDialog::rebuild_mapping_rows ( )
private
973{
974 if (m_mapping_wrap_sizer == nullptr)
975 return;
976
977 m_mapping_wrap_sizer->Clear(true);
978 m_mapping_rows.clear();
979
980 if (m_project_filaments.empty()) {
981 m_mapping_wrap_sizer->Add(new wxStaticText(this, wxID_ANY, _L("Slice the plate first to get project material information.")), 0, wxALL, FromDIP(2));
982 return;
983 }
984
985 for (const auto& filament : m_project_filaments) {
986 auto* card = new FlashforgeMaterialMapWidget(this, filament.id, to_wx_colour(filament.color), from_u8(filament.get_display_filament_type()),
987 [this](FlashforgeMaterialMapWidget* changed_card) {
988 if (changed_card == nullptr)
989 return;
990 for (auto& row : m_mapping_rows) {
991 if (row.card == changed_card) {
992 refresh_mapping_card(row);
993 break;
994 }
995 }
996 });
997 m_mapping_wrap_sizer->Add(card, 0, wxRIGHT | wxBOTTOM | wxFIXED_MINSIZE, FromDIP(10));
998
999 MappingRow row;
1000 row.tool_id = filament.id;
1001 row.card = card;
1002 m_mapping_rows.push_back(row);
1003 }
1004
1006}
void auto_assign_mappings()
Definition PrintHostDialogs.cpp:1008
int tool_id
Definition PrintHostDialogs.hpp:246

References _L, Slic3r::GUI::FlashforgePrintHostSendDialog::MappingRow::card, Slic3r::GUI::from_u8(), m_mapping_rows, m_mapping_wrap_sizer, m_project_filaments, to_wx_colour(), Slic3r::GUI::FlashforgePrintHostSendDialog::MappingRow::tool_id, and wxStaticText.

Referenced by init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ refresh_mapping_card()

void Slic3r::GUI::FlashforgePrintHostSendDialog::refresh_mapping_card ( MappingRow & row)
private
1041{
1042 auto* card = as_ff_map_widget(row.card);
1043 if (card == nullptr)
1044 return;
1045
1046 const auto* filament = find_filament_by_tool_id(row.tool_id);
1047 card->set_enable_mapping(m_use_material_station);
1048 card->update_popup_slots(m_slots, [this, filament](const FlashforgeMaterialSlot& slot) {
1049 return filament != nullptr && slot_matches_filament(slot, *filament);
1050 });
1051
1052 if (card->selected_slot_id() <= 0) {
1053 card->reset_slot();
1054 return;
1055 }
1056
1057 const auto* slot = find_slot_by_id(std::to_string(card->selected_slot_id()));
1058 if (slot == nullptr) {
1059 card->reset_slot();
1060 return;
1061 }
1062
1063 card->set_slot_selection(slot->slot_id, to_wx_colour(slot->material_color));
1064}
const FilamentInfo * find_filament_by_tool_id(int tool_id) const
Definition PrintHostDialogs.cpp:1087
const Slic3r::FlashforgeMaterialSlot * find_slot_by_id(const std::string &slot_id_text) const
Definition PrintHostDialogs.cpp:1081

References Slic3r::GUI::FlashforgePrintHostSendDialog::MappingRow::card, find_filament_by_tool_id(), find_slot_by_id(), m_slots, m_use_material_station, Slic3r::FlashforgeMaterialSlot::material_color, refresh_mapping_card(), Slic3r::FlashforgeMaterialSlot::slot_id, slot_matches_filament(), to_wx_colour(), and Slic3r::GUI::FlashforgePrintHostSendDialog::MappingRow::tool_id.

Referenced by auto_assign_mappings(), and refresh_mapping_card().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rescale()

void Slic3r::GUI::DPIAware< wxDialog >::rescale ( const wxRect & suggested_rect)
inlineprivateinherited
265 {
266 this->Freeze();
267
268 m_force_rescale = false;
269
270 // set normal application font as a current window font
271 m_normal_font = this->GetFont();
272
274
275 // rescale missed controls sizes and images
277
278 this->Layout();
279 this->Thaw();
280
281 // reset previous scale factor from current scale factor value
283 }
virtual void on_dpi_changed(const wxRect &suggested_rect)=0
void update_em_unit()
Definition GUI_Utils.hpp:249

◆ scale_factor()

float Slic3r::GUI::DPIAware< wxDialog >::scale_factor ( ) const
inlineinherited
195{ return m_scale_factor; }

◆ set_em_unit()

void Slic3r::GUI::DPIAware< wxDialog >::set_em_unit ( int v)
inlineinherited
200{ m_em_unit = v; }

◆ set_prev_scale_factor()

void Slic3r::GUI::DPIAware< wxDialog >::set_prev_scale_factor ( float v)
inlineinherited

◆ set_scale_factor()

void Slic3r::GUI::DPIAware< wxDialog >::set_scale_factor ( float v)
inlineinherited
198{ m_scale_factor = v; }

◆ SetButtonLabel()

void Slic3r::GUI::MsgDialog::SetButtonLabel ( wxWindowID btn_id,
const wxString & label,
bool set_focus = false )
inherited
176{
177 if (Button* btn = get_button(btn_id)) {
178 btn->SetLabel(label);
179 if (set_focus)
180 btn->SetFocus();
181 }
182}
Button * get_button(wxWindowID btn_id)
Definition MsgDialog.cpp:233

References get_button().

Referenced by Slic3r::GUI::MixedFilamentWarningDialog::MixedFilamentWarningDialog(), Slic3r::GUI::ConfigManipulation::check_layer_height(), Slic3r::GUI::FanControlNew::check_printing_state(), Slic3r::GUI::FanOperate::check_printing_state(), Slic3r::DevNozzleRack::CtrlRackReadAll(), Slic3r::DevNozzleRack::CtrlRackUpgrade(), Slic3r::GUI::ObjectList::del_from_cut_object(), Slic3r::GUI::Plater::priv::delete_object_from_model(), Slic3r::GUI::Field::get_value_by_opt_type(), Slic3r::GUI::GUI_App::handle_web_request(), Slic3r::GUI::ConfigManipulation::layer_height_out_of_range_dialog(), Slic3r::GUI::Plater::priv::load_files(), Slic3r::GUI::StatusPanel::on_lamp_switch(), Slic3r::GUI::TextureImportDialog::on_mesh_repair_decision_required(), Slic3r::GUI::Tab::on_value_change(), Slic3r::GUI::AMSSettingTypePanel::OnAmsTypeChanged(), Slic3r::GUI::run_scene_benchmark(), Slic3r::GUI::FanControlPopupNew::UpdatePartSubMode(), and Slic3r::GUI::Tab::validate_filament_temperature_pairs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ show_dsa_button()

void Slic3r::GUI::MsgDialog::show_dsa_button ( wxString const & title = {})
inherited
112{
113 m_checkbox_dsa = new CheckBox(this);
114 m_dsa_sizer->Add(m_checkbox_dsa, 0, wxALIGN_CENTER);
115 m_checkbox_dsa->Bind(wxEVT_TOGGLEBUTTON, [this](wxCommandEvent& e) {
116 auto event = wxCommandEvent(EVT_CHECKBOX_CHANGE);
117 event.SetInt(m_checkbox_dsa->GetValue()?1:0);
118 event.SetEventObject(this);
119 wxPostEvent(this, event);
120 e.Skip();
121 });
122
123 auto m_text_dsa = new wxStaticText(this, wxID_ANY, title.IsEmpty() ? _L("Don't show again") : title, wxDefaultPosition, wxDefaultSize, 0);
124 auto on_toggle = [this]() {
125 m_checkbox_dsa->SetValue(!m_checkbox_dsa->GetValue());
126 wxCommandEvent ev(wxEVT_TOGGLEBUTTON, m_checkbox_dsa->GetId());
127 ev.SetEventObject(m_checkbox_dsa);
128 m_checkbox_dsa->GetEventHandler()->ProcessEvent(ev);
129 };
130 m_text_dsa->Bind(wxEVT_LEFT_DOWN, [on_toggle](wxMouseEvent& e) {if(!e.LeftDClick()) on_toggle();});
131 m_text_dsa->Bind(wxEVT_LEFT_DCLICK, [on_toggle](wxMouseEvent& e) {on_toggle();});
132
133 m_dsa_sizer->Add(m_text_dsa, 0, wxALL | wxALIGN_CENTER, FromDIP(2));
134 m_dsa_sizer->AddSpacer(FromDIP(10)); // spacing after checkbox
135 m_text_dsa->SetFont(::Label::Body_13);
136 m_text_dsa->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#323A3D")));
137 btn_sizer->Layout();
138 Fit();
139}
wxMouseEvent
Definition CameraPopup.cpp:47
wxBoxSizer * m_dsa_sizer
Definition MsgDialog.hpp:106

References _L, Label::Body_13, btn_sizer, StateColor::darkModeColorFor(), m_checkbox_dsa, m_dsa_sizer, Slic3r::GUI::wxMouseEvent, and wxStaticText.

Referenced by Slic3r::DevNozzleRack::CheckRackMoveWarningDlg(), Slic3r::GUI::Plater::close_with_confirm(), Slic3r::GUI::confirm_create_decompose_missing_components(), Slic3r::DevNozzleRack::CtrlRackUpgrade(), Slic3r::GUI::ObjectList::layers_editing(), Slic3r::GUI::Plater::priv::load_files(), Slic3r::GUI::Plater::priv::on_action_layersediting(), Slic3r::GUI::RichMessageDialog::ShowModal(), Slic3r::GUI::MediaPlayCtrl::ToggleStream(), and Slic3r::GUI::ConfigManipulation::update_print_fff_config().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ShowModal()

◆ slot_matches_filament()

bool Slic3r::GUI::FlashforgePrintHostSendDialog::slot_matches_filament ( const Slic3r::FlashforgeMaterialSlot & slot,
const FilamentInfo & filament ) const
private
1094{
1095 if (!slot.has_filament)
1096 return false;
1097
1098 const std::string project_material = normalize_material(!filament.type.empty() ? filament.type : filament.get_display_filament_type());
1099 const std::string slot_material = normalize_material(slot.material_name);
1100 return !project_material.empty() && !slot_material.empty() && project_material == slot_material;
1101}
std::string normalize_material(const std::string &material) const
Definition PrintHostDialogs.cpp:1136
bool has_filament
Definition Flashforge.hpp:20
std::string material_name
Definition Flashforge.hpp:21

References Slic3r::FlashforgeMaterialSlot::has_filament, Slic3r::FlashforgeMaterialSlot::material_name, normalize_material(), slot_matches_filament(), and Slic3r::FilamentGroupUtils::FilamentInfo::type.

Referenced by auto_assign_mappings(), refresh_mapping_card(), slot_matches_filament(), and validate_before_close().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ storage()

std::string Slic3r::GUI::PrintHostSendDialog::storage ( ) const
inherited
654{
655 if (!combo_storage)
656 return GUI::format("%1%", m_preselected_storage);
657 if (combo_storage->GetSelection() < 0 || combo_storage->GetSelection() >= int(m_paths.size()))
658 return {};
659 return into_u8(m_paths[combo_storage->GetSelection()]);
660}
wxComboBox * combo_storage
Definition PrintHostDialogs.hpp:56
wxArrayString m_paths
Definition PrintHostDialogs.hpp:60
wxString m_preselected_storage
Definition PrintHostDialogs.hpp:59
std::string format(const char *fmt, TArgs &&... args)
Definition format.hpp:36

References combo_storage, Slic3r::GUI::format(), Slic3r::GUI::into_u8(), m_paths, and m_preselected_storage.

Referenced by EndModal().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ switch_to_device_tab()

bool Slic3r::GUI::PrintHostSendDialog::switch_to_device_tab ( ) const
inlineinherited

References m_switch_to_device_tab.

Referenced by Slic3r::GUI::CrealityPrintHostSendDialog::CrealityPrintHostSendDialog(), Slic3r::GUI::ElegooPrintHostSendDialog::ElegooPrintHostSendDialog(), Slic3r::GUI::FlashforgePrintHostSendDialog::FlashforgePrintHostSendDialog(), and PrintHostSendDialog().

Here is the caller graph for this function:

◆ sync_mapping_section_visibility()

void Slic3r::GUI::FlashforgePrintHostSendDialog::sync_mapping_section_visibility ( )
private
1067{
1068 if (m_mapping_section_sizer == nullptr)
1069 return;
1070
1072 if (wxSizer* sizer = GetSizer(); sizer != nullptr) {
1073 sizer->Layout();
1074 sizer->Fit(this);
1075 SetMinSize(GetBestSize());
1076 }
1077 Layout();
1078 Fit();
1079}

References m_mapping_section_sizer, m_supports_material_station, m_use_material_station, and sync_mapping_section_visibility().

Referenced by init(), and sync_mapping_section_visibility().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ to_wx_colour()

wxColour Slic3r::GUI::FlashforgePrintHostSendDialog::to_wx_colour ( const std::string & color) const
private
1172{
1173 wxColour wx_color(from_u8(color));
1174 if (wx_color.IsOk())
1175 return wx_color;
1176
1177 std::string normalized = boost::trim_copy(color);
1178 if (boost::istarts_with(normalized, "0x"))
1179 normalized = normalized.substr(2);
1180 if (!normalized.empty() && normalized.front() == '#')
1181 normalized.erase(normalized.begin());
1182
1183 if (normalized.size() == 8) {
1184 auto hex_to_byte = [](char hi, char lo) -> int {
1185 auto hex_val = [](char c) -> int {
1186 if (c >= '0' && c <= '9') return c - '0';
1187 if (c >= 'a' && c <= 'f') return c - 'a' + 10;
1188 if (c >= 'A' && c <= 'F') return c - 'A' + 10;
1189 return -1;
1190 };
1191 const int h = hex_val(hi);
1192 const int l = hex_val(lo);
1193 return (h < 0 || l < 0) ? -1 : h * 16 + l;
1194 };
1195
1196 const int r = hex_to_byte(normalized[0], normalized[1]);
1197 const int g = hex_to_byte(normalized[2], normalized[3]);
1198 const int b = hex_to_byte(normalized[4], normalized[5]);
1199 const int a = hex_to_byte(normalized[6], normalized[7]);
1200 if (r >= 0 && g >= 0 && b >= 0 && a >= 0)
1201 return wxColour(r, g, b, a);
1202 }
1203
1204 if (normalized.size() == 6) {
1205 wx_color = wxColour("#" + from_u8(normalized));
1206 if (wx_color.IsOk())
1207 return wx_color;
1208 }
1209
1210 return wxColour("#999999");
1211}

References Slic3r::from_u8(), and to_wx_colour().

Referenced by auto_assign_mappings(), rebuild_mapping_rows(), refresh_mapping_card(), and to_wx_colour().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_em_unit()

void Slic3r::GUI::DPIAware< wxDialog >::update_em_unit ( )
inlineprivateinherited
250 {
251 // Linux specific issue : get_dpi_for_window(this) still doesn't responce to the Display's scale in new wxWidgets(3.1.3).
252 // So, calculate the m_em_unit value from the font size, as before
253#if !defined(__WXGTK__)
255#else
256 // initialize default width_unit according to the width of the one symbol ("m") of the currently active font of this window.
257 m_em_unit = std::max<size_t>(10, this->GetTextExtent("m").x - 1);
258#endif // __WXGTK__
259 }

◆ validate_before_close()

bool Slic3r::GUI::FlashforgePrintHostSendDialog::validate_before_close ( )
private
1104{
1105 if (!m_use_material_station && m_project_filaments.size() > 1) {
1106 show_error(this, _L("This plate uses multiple materials. Enable IFS and assign each tool to a printer slot."));
1107 return false;
1108 }
1109
1111 return true;
1112
1113 for (const auto& row : m_mapping_rows) {
1114 auto* card = as_ff_map_widget(row.card);
1115 if (card == nullptr || !card->is_slot_selected()) {
1116 show_error(this, _L("Each project material must be assigned to an IFS slot before printing."));
1117 return false;
1118 }
1119
1120 const auto* slot = find_slot_by_id(std::to_string(card->selected_slot_id()));
1121 const auto* filament = find_filament_by_tool_id(row.tool_id);
1122 if (slot == nullptr || filament == nullptr || !slot->has_filament) {
1123 show_error(this, _L("Each project material must be assigned to a loaded IFS slot before printing."));
1124 return false;
1125 }
1126
1127 if (!slot_matches_filament(*slot, *filament)) {
1128 show_error(this, _L("Each project material must match the material loaded in the selected IFS slot."));
1129 return false;
1130 }
1131 }
1132
1133 return true;
1134}
void show_error(wxWindow *parent, const wxString &message, bool has_code_excerpts)
Definition GUI.cpp:296

References _L, find_filament_by_tool_id(), find_slot_by_id(), m_mapping_rows, m_project_filaments, m_use_material_station, Slic3r::GUI::show_error(), slot_matches_filament(), and validate_before_close().

Referenced by init(), and validate_before_close().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ boldfont

wxFont Slic3r::GUI::MsgDialog::boldfont
protectedinherited

◆ btn_sizer

wxBoxSizer* Slic3r::GUI::MsgDialog::btn_sizer
protectedinherited

◆ combo_groups

wxComboBox* Slic3r::GUI::PrintHostSendDialog::combo_groups
protectedinherited

◆ combo_storage

wxComboBox* Slic3r::GUI::PrintHostSendDialog::combo_storage
protectedinherited

◆ CONFIG_KEY_IFS

const char* Slic3r::GUI::FlashforgePrintHostSendDialog::CONFIG_KEY_IFS = "flashforge_use_material_station"
private

Referenced by EndModal(), and init().

◆ CONFIG_KEY_LEVELING

const char* Slic3r::GUI::FlashforgePrintHostSendDialog::CONFIG_KEY_LEVELING = "flashforge_leveling_before_print"
private

Referenced by EndModal(), and init().

◆ CONFIG_KEY_TIMELAPSE

const char* Slic3r::GUI::FlashforgePrintHostSendDialog::CONFIG_KEY_TIMELAPSE = "flashforge_timelapse_video"
private

Referenced by EndModal(), and init().

◆ content_sizer

◆ logo

wxStaticBitmap* Slic3r::GUI::MsgDialog::logo
protectedinherited

◆ m_buttons

MsgButtonsHash Slic3r::GUI::MsgDialog::m_buttons
protectedinherited

◆ m_can_rescale

bool Slic3r::GUI::DPIAware< wxDialog >::m_can_rescale
privateinherited
235{ true };

◆ m_checkbox_dsa

CheckBox* Slic3r::GUI::MsgDialog::m_checkbox_dsa {nullptr}
protectedinherited

◆ m_checkbox_ifs

::CheckBox* Slic3r::GUI::FlashforgePrintHostSendDialog::m_checkbox_ifs {nullptr}
private
274{nullptr};

Referenced by init().

◆ m_checkbox_leveling

::CheckBox* Slic3r::GUI::FlashforgePrintHostSendDialog::m_checkbox_leveling {nullptr}
private
272{nullptr};

Referenced by init().

◆ m_checkbox_timelapse

::CheckBox* Slic3r::GUI::FlashforgePrintHostSendDialog::m_checkbox_timelapse {nullptr}
private
273{nullptr};

Referenced by init().

◆ m_dsa_sizer

wxBoxSizer* Slic3r::GUI::MsgDialog::m_dsa_sizer
protectedinherited

Referenced by MsgDialog(), and show_dsa_button().

◆ m_em_unit

int Slic3r::GUI::DPIAware< wxDialog >::m_em_unit
privateinherited

◆ m_flashforge_options_sizer

wxBoxSizer* Slic3r::GUI::FlashforgePrintHostSendDialog::m_flashforge_options_sizer {nullptr}
private
268{nullptr};

Referenced by init().

◆ m_force_rescale

bool Slic3r::GUI::DPIAware< wxDialog >::m_force_rescale
privateinherited
236{ false };

◆ m_forward_str

wxString Slic3r::GUI::MsgDialog::m_forward_str
protectedinherited

Referenced by MsgDialog(), and apply_style().

◆ m_host

const Slic3r::Flashforge* Slic3r::GUI::FlashforgePrintHostSendDialog::m_host {nullptr}
private
264{nullptr};

Referenced by FlashforgePrintHostSendDialog(), and load_slots().

◆ m_leveling_before_print

bool Slic3r::GUI::FlashforgePrintHostSendDialog::m_leveling_before_print {true}
private
275{true};

Referenced by EndModal(), extendedInfo(), and init().

◆ m_mapping_rows

std::vector<MappingRow> Slic3r::GUI::FlashforgePrintHostSendDialog::m_mapping_rows
private

◆ m_mapping_section_sizer

wxBoxSizer* Slic3r::GUI::FlashforgePrintHostSendDialog::m_mapping_section_sizer {nullptr}
private
269{nullptr};

Referenced by init(), and sync_mapping_section_visibility().

◆ m_mapping_wrap_sizer

wxWrapSizer* Slic3r::GUI::FlashforgePrintHostSendDialog::m_mapping_wrap_sizer {nullptr}
private
270{nullptr};

Referenced by init(), and rebuild_mapping_rows().

◆ m_new_font_point_size

int Slic3r::GUI::DPIAware< wxDialog >::m_new_font_point_size
privateinherited

◆ m_normal_font

wxFont Slic3r::GUI::DPIAware< wxDialog >::m_normal_font
privateinherited

◆ m_path

boost::filesystem::path Slic3r::GUI::PrintHostSendDialog::m_path
protectedinherited

◆ m_paths

wxArrayString Slic3r::GUI::PrintHostSendDialog::m_paths
protectedinherited

◆ m_post_actions

◆ m_preselected_storage

wxString Slic3r::GUI::PrintHostSendDialog::m_preselected_storage
protectedinherited

◆ m_prev_scale_factor

float Slic3r::GUI::DPIAware< wxDialog >::m_prev_scale_factor
privateinherited

◆ m_project_filaments

std::vector<FilamentInfo> Slic3r::GUI::FlashforgePrintHostSendDialog::m_project_filaments
private

◆ m_scale_factor

float Slic3r::GUI::DPIAware< wxDialog >::m_scale_factor
privateinherited

◆ m_slots

std::vector<Slic3r::FlashforgeMaterialSlot> Slic3r::GUI::FlashforgePrintHostSendDialog::m_slots
private

◆ m_slots_loaded

bool Slic3r::GUI::FlashforgePrintHostSendDialog::m_slots_loaded {false}
private

◆ m_status_text

wxStaticText* Slic3r::GUI::FlashforgePrintHostSendDialog::m_status_text {nullptr}
private
271{nullptr};

Referenced by ensure_slots_loaded(), init(), and load_slots().

◆ m_storage_names

wxArrayString Slic3r::GUI::PrintHostSendDialog::m_storage_names
protectedinherited

◆ m_supports_material_station

bool Slic3r::GUI::FlashforgePrintHostSendDialog::m_supports_material_station {false}
private

◆ m_switch_to_device_tab

bool Slic3r::GUI::PrintHostSendDialog::m_switch_to_device_tab
protectedinherited

◆ m_time_lapse_video

bool Slic3r::GUI::FlashforgePrintHostSendDialog::m_time_lapse_video {false}
private
276{false};

Referenced by EndModal(), extendedInfo(), and init().

◆ m_use_material_station

bool Slic3r::GUI::FlashforgePrintHostSendDialog::m_use_material_station {false}
private

◆ m_valid_suffix

wxString Slic3r::GUI::PrintHostSendDialog::m_valid_suffix
protectedinherited

◆ post_upload_action

◆ txt_filename

wxTextCtrl* Slic3r::GUI::PrintHostSendDialog::txt_filename
protectedinherited

The documentation for this class was generated from the following files: