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

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

Inheritance diagram for Slic3r::GUI::PrintHostSendDialog:
Collaboration diagram for Slic3r::GUI::PrintHostSendDialog:

Public Member Functions

 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)
virtual ~PrintHostSendDialog ()
boost::filesystem::path filename () const
PrintHostPostUploadAction post_action () const
std::string group () const
std::string storage () const
bool switch_to_device_tab () const
virtual void EndModal (int ret) override
virtual void init ()
virtual std::map< std::string, std::string > extendedInfo () 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 update_em_unit ()
bool is_new_scale_factor () const
void rescale (const wxRect &suggested_rect)

Private Attributes

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

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

◆ PrintHostSendDialog()

Slic3r::GUI::PrintHostSendDialog::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 )
471 : MsgDialog(static_cast<wxWindow*>(wxGetApp().mainframe), _L("Send G-code to printer host"), _L("Upload to Printer Host with the following filename:"), 0) // Set style = 0 to avoid default creation of the "OK" button.
472 // All buttons will be added later in this constructor
473 , txt_filename(new wxTextCtrl(this, wxID_ANY))
474 , combo_groups(!groups.IsEmpty() ? new wxComboBox(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, groups, wxCB_READONLY) : nullptr)
475 , combo_storage(storage_names.GetCount() > 1 ? new wxComboBox(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, storage_names, wxCB_READONLY) : nullptr)
477 , m_paths(storage_paths)
479 , m_path(path)
480 , m_post_actions(post_actions)
481 , m_storage_names(storage_names)
482{
483#ifdef __APPLE__
484 txt_filename->OSXDisableAllSmartSubstitutions();
485#endif
486}
#define _L(s)
Definition OBJ.cpp:34
wxComboBox * combo_storage
Definition PrintHostDialogs.hpp:56
wxArrayString m_paths
Definition PrintHostDialogs.hpp:60
wxTextCtrl * txt_filename
Definition PrintHostDialogs.hpp:54
PrintHostPostUploadAction post_upload_action
Definition PrintHostDialogs.hpp:57
boost::filesystem::path m_path
Definition PrintHostDialogs.hpp:63
wxArrayString m_storage_names
Definition PrintHostDialogs.hpp:65
bool m_switch_to_device_tab
Definition PrintHostDialogs.hpp:61
bool switch_to_device_tab() const
Definition PrintHostDialogs.hpp:47
wxComboBox * combo_groups
Definition PrintHostDialogs.hpp:55
PrintHostPostUploadActions m_post_actions
Definition PrintHostDialogs.hpp:64
@ None
Definition PrintHost.hpp:24
MsgDialog(MsgDialog &&)=delete

References Slic3r::GUI::MsgDialog::MsgDialog(), _L, combo_groups, combo_storage, m_path, m_paths, m_post_actions, m_storage_names, m_switch_to_device_tab, post_upload_action, switch_to_device_tab(), and txt_filename.

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

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

◆ ~PrintHostSendDialog()

virtual Slic3r::GUI::PrintHostSendDialog::~PrintHostSendDialog ( )
inlinevirtual
42{}

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 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:

◆ 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::PrintHostSendDialog::EndModal ( int ret)
overridevirtual

Reimplemented in Slic3r::GUI::ElegooPrintHostSendDialog, and Slic3r::GUI::FlashforgePrintHostSendDialog.

663{
664 if (ret == wxID_OK) {
665 // Persist path and print settings
666 wxString path = txt_filename->GetValue();
667 int last_slash = path.Find('/', true);
668 if (last_slash == wxNOT_FOUND)
669 path.clear();
670 else
671 path = path.SubString(0, last_slash);
672
673 AppConfig *app_config = wxGetApp().app_config;
674 app_config->set("recent", CONFIG_KEY_PATH, into_u8(path));
675
676 if (combo_groups != nullptr) {
677 wxString group = combo_groups->GetValue();
678 app_config->set("recent", CONFIG_KEY_GROUP, into_u8(group));
679 }
680 if (combo_storage != nullptr) {
681 wxString storage = combo_storage->GetValue();
682 app_config->set("recent", CONFIG_KEY_STORAGE, into_u8(storage));
683 }
684 }
685
687}
std::string storage() const
Definition PrintHostDialogs.cpp:653
std::string group() const
Definition PrintHostDialogs.cpp:643
static const char * CONFIG_KEY_STORAGE
Definition PrintHostDialogs.cpp:468
static const char * CONFIG_KEY_GROUP
Definition PrintHostDialogs.cpp:467
static const char * CONFIG_KEY_PATH
Definition PrintHostDialogs.cpp:466
std::string into_u8(const wxString &str)
Definition GUI.cpp:549

References combo_groups, combo_storage, Slic3r::GUI::CONFIG_KEY_GROUP, Slic3r::GUI::CONFIG_KEY_PATH, Slic3r::GUI::CONFIG_KEY_STORAGE, Slic3r::GUI::DPIDialog::EndModal(), group(), Slic3r::GUI::into_u8(), Slic3r::AppConfig::set(), storage(), and txt_filename.

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

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

◆ extendedInfo()

virtual std::map< std::string, std::string > Slic3r::GUI::PrintHostSendDialog::extendedInfo ( ) const
inlinevirtual

◆ filename()

fs::path Slic3r::GUI::PrintHostSendDialog::filename ( ) const
634{
635 return into_path(txt_filename->GetValue());
636}
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()

◆ 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
644{
645 if (combo_groups == nullptr) {
646 return "";
647 } else {
648 wxString group = combo_groups->GetValue();
649 return into_u8(group);
650 }
651}

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::PrintHostSendDialog::init ( )
virtual

Reimplemented in Slic3r::GUI::CrealityPrintHostSendDialog, Slic3r::GUI::ElegooPrintHostSendDialog, and Slic3r::GUI::FlashforgePrintHostSendDialog.

488{
489 const auto& path = m_path;
490 const auto& storage_paths = m_paths;
491 const auto& post_actions = m_post_actions;
492 const auto& storage_names = m_storage_names;
493
494 const AppConfig* app_config = wxGetApp().app_config;
495
496 auto *label_dir_hint = new wxStaticText(this, wxID_ANY, _L("Use forward slashes ( / ) as a directory separator if needed."));
497 label_dir_hint->Wrap(CONTENT_WIDTH * wxGetApp().em_unit());
498
499 content_sizer->Add(txt_filename, 0, wxEXPAND);
500 content_sizer->Add(label_dir_hint);
501 content_sizer->AddSpacer(VERT_SPACING);
502
503 if (combo_groups != nullptr) {
504 // Repetier specific: Show a selection of file groups.
505 auto *label_group = new wxStaticText(this, wxID_ANY, _L("Group"));
506 content_sizer->Add(label_group);
507 content_sizer->Add(combo_groups, 0, wxBOTTOM, 2*VERT_SPACING);
508 wxString recent_group = from_u8(app_config->get("recent", CONFIG_KEY_GROUP));
509 if (! recent_group.empty())
510 combo_groups->SetValue(recent_group);
511 }
512
513 if (combo_storage != nullptr) {
514 // PrusaLink specific: User needs to choose a storage
515 auto* label_group = new wxStaticText(this, wxID_ANY, _L("Upload to storage") + ":");
516 content_sizer->Add(label_group);
517 content_sizer->Add(combo_storage, 0, wxBOTTOM, 2 * VERT_SPACING);
518 combo_storage->SetValue(storage_names.front());
519 wxString recent_storage = from_u8(app_config->get("recent", CONFIG_KEY_STORAGE));
520 if (!recent_storage.empty())
521 combo_storage->SetValue(recent_storage);
522 } else if (storage_names.GetCount() == 1){
523 // PrusaLink specific: Show which storage has been detected.
524 auto* label_group = new wxStaticText(this, wxID_ANY, _L("Upload to storage") + ": " + storage_names.front());
525 content_sizer->Add(label_group);
526 m_preselected_storage = storage_paths.front();
527 }
528
529
530 wxString recent_path = from_u8(app_config->get("recent", CONFIG_KEY_PATH));
531 if (recent_path.Length() > 0 && recent_path[recent_path.Length() - 1] != '/') {
532 recent_path += '/';
533 }
534 const auto recent_path_len = recent_path.Length();
535 recent_path += path.filename().wstring();
536 wxString stem(path.stem().wstring());
537 const auto stem_len = stem.Length();
538
539 txt_filename->SetValue(recent_path);
540
541 auto checkbox_sizer = new wxBoxSizer(wxHORIZONTAL);
542 auto checkbox = new ::CheckBox(this, wxID_APPLY);
543 checkbox->SetValue(m_switch_to_device_tab);
544 checkbox->Bind(wxEVT_TOGGLEBUTTON, [this](wxCommandEvent& e) {
545 m_switch_to_device_tab = e.IsChecked();
546 e.Skip();
547 });
548 checkbox_sizer->Add(checkbox, 0, wxALL | wxALIGN_CENTER, FromDIP(2));
549
550 auto checkbox_text = new wxStaticText(this, wxID_ANY, _L("Switch to Device tab after upload."), wxDefaultPosition, wxDefaultSize, 0);
551 checkbox_sizer->Add(checkbox_text, 0, wxALL | wxALIGN_CENTER, FromDIP(2));
552 checkbox_text->SetFont(::Label::Body_13);
553 checkbox_text->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#323A3D")));
554 content_sizer->Add(checkbox_sizer);
555 content_sizer->AddSpacer(VERT_SPACING);
556
557 if (size_t extension_start = recent_path.find_last_of('.'); extension_start != std::string::npos)
558 m_valid_suffix = recent_path.substr(extension_start);
559 // .gcode suffix control
560 auto validate_path = [this](const wxString &path) -> bool {
561 if (! path.Lower().EndsWith(m_valid_suffix.Lower())) {
562 MessageDialog msg_wingow(this, wxString::Format(_L("Upload filename doesn't end with \"%s\". Do you wish to continue?"), m_valid_suffix), wxString(SLIC3R_APP_NAME), wxYES | wxNO);
563 if (msg_wingow.ShowModal() == wxID_NO)
564 return false;
565 }
566 return true;
567 };
568
569 auto* btn_ok = add_button(wxID_OK, true, _L("Upload"));
570 btn_ok->Bind(wxEVT_BUTTON, [this, validate_path](wxCommandEvent&) {
571 if (validate_path(txt_filename->GetValue())) {
573 EndDialog(wxID_OK);
574 }
575 });
576 txt_filename->SetFocus();
577
578 // if (post_actions.has(PrintHostPostUploadAction::QueuePrint)) {
579 // auto* btn_print = add_button(wxID_ADD, false, _L("Upload to Queue"));
580 // btn_print->Bind(wxEVT_BUTTON, [this, validate_path](wxCommandEvent&) {
581 // if (validate_path(txt_filename->GetValue())) {
582 // post_upload_action = PrintHostPostUploadAction::QueuePrint;
583 // EndDialog(wxID_OK);
584 // }
585 // });
586 // }
587
588 if (post_actions.has(PrintHostPostUploadAction::StartPrint)) {
589 auto* btn_print = add_button(wxID_YES, false, _L("Upload and Print"));
590 btn_print->Bind(wxEVT_BUTTON, [this, validate_path](wxCommandEvent&) {
591 if (validate_path(txt_filename->GetValue())) {
593 EndDialog(wxID_OK);
594 }
595 });
596 }
597
598 // if (post_actions.has(PrintHostPostUploadAction::StartSimulation)) {
599 // // Using wxID_MORE as a button identifier to be different from the other buttons, wxID_MORE has no other meaning here.
600 // auto* btn_simulate = add_button(wxID_MORE, false, _L("Upload and Simulate"));
601 // btn_simulate->Bind(wxEVT_BUTTON, [this, validate_path](wxCommandEvent&) {
602 // if (validate_path(txt_filename->GetValue())) {
603 // post_upload_action = PrintHostPostUploadAction::StartSimulation;
604 // EndDialog(wxID_OK);
605 // }
606 // });
607 // }
608
609 add_button(wxID_CANCEL,false, _L("Cancel"));
610 finalize();
611
612#ifdef __linux__
613 // On Linux with GTK2 when text control lose the focus then selection (colored background) disappears but text color stay white
614 // and as a result the text is invisible with light mode
615 // see https://github.com/prusa3d/PrusaSlicer/issues/4532
616 // Workaround: Unselect text selection explicitly on kill focus
617 txt_filename->Bind(wxEVT_KILL_FOCUS, [this](wxEvent& e) {
618 e.Skip();
619 txt_filename->SetInsertionPoint(txt_filename->GetLastPosition());
620 }, txt_filename->GetId());
621#endif /* __linux__ */
622
623 Bind(wxEVT_SHOW, [=](const wxShowEvent &) {
624 // Another similar case where the function only works with EVT_SHOW + CallAfter,
625 // this time on Mac.
626 CallAfter([=]() {
627 txt_filename->SetInsertionPoint(0);
628 txt_filename->SetSelection(recent_path_len, recent_path_len + stem_len);
629 });
630 });
631}
class WXDLLIMPEXP_FWD_CORE wxStaticText
Definition ProgressDialog.hpp:30
static wxFont Body_13
Definition Label.hpp:54
int em_unit() const
Definition GUI_Utils.hpp:203
wxString m_valid_suffix
Definition PrintHostDialogs.hpp:58
wxString m_preselected_storage
Definition PrintHostDialogs.hpp:59
static wxColour darkModeColorFor(wxColour const &color)
Definition StateColor.cpp:219
wxString from_u8(const std::string &str)
Definition GUI.cpp:544
@ StartPrint
Definition PrintHost.hpp:25
wxBoxSizer * content_sizer
Definition MsgDialog.hpp:104
void finalize()
Definition MsgDialog.cpp:257

References _L, Slic3r::GUI::MsgDialog::add_button(), Label::Body_13, combo_groups, combo_storage, Slic3r::GUI::CONFIG_KEY_GROUP, Slic3r::GUI::CONFIG_KEY_PATH, Slic3r::GUI::CONFIG_KEY_STORAGE, Slic3r::GUI::MsgDialog::content_sizer, Slic3r::GUI::MsgDialog::CONTENT_WIDTH, StateColor::darkModeColorFor(), Slic3r::GUI::DPIAware< wxDialog >::em_unit(), Slic3r::GUI::MsgDialog::finalize(), Slic3r::GUI::from_u8(), Slic3r::AppConfig::get(), m_path, m_paths, m_post_actions, m_preselected_storage, m_storage_names, m_switch_to_device_tab, m_valid_suffix, Slic3r::None, post_upload_action, Slic3r::GUI::DPIAware< P >::ShowModal(), Slic3r::StartPrint, txt_filename, Slic3r::GUI::MsgDialog::VERT_SPACING, and wxStaticText.

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

Here is the call graph for this function:
Here is the caller 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; }

◆ normal_font()

◆ 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
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; }

◆ 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()

◆ storage()

std::string Slic3r::GUI::PrintHostSendDialog::storage ( ) const
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}
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
inline

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:

◆ 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 }

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
protected

◆ combo_storage

wxComboBox* Slic3r::GUI::PrintHostSendDialog::combo_storage
protected

◆ 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_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_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_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
protected

◆ m_paths

wxArrayString Slic3r::GUI::PrintHostSendDialog::m_paths
protected

◆ m_post_actions

◆ m_preselected_storage

wxString Slic3r::GUI::PrintHostSendDialog::m_preselected_storage
protected

◆ m_prev_scale_factor

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

◆ m_scale_factor

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

◆ m_storage_names

wxArrayString Slic3r::GUI::PrintHostSendDialog::m_storage_names
protected

◆ m_switch_to_device_tab

bool Slic3r::GUI::PrintHostSendDialog::m_switch_to_device_tab
protected

◆ m_valid_suffix

wxString Slic3r::GUI::PrintHostSendDialog::m_valid_suffix
protected

◆ post_upload_action

◆ txt_filename

wxTextCtrl* Slic3r::GUI::PrintHostSendDialog::txt_filename
protected

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