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

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

Inheritance diagram for Slic3r::GUI::MainFrame:
Collaboration diagram for Slic3r::GUI::MainFrame:

Classes

class  GLResourcesPrebuild
class  PrepareLayoutPrebuild
struct  ShortcutMenuItem
struct  FileHistory

Public Types

enum  SlicePrintEventType {
  eEventObjectUpdate = 0 , eEventPlateUpdate = 1 , eEventParamUpdate = 2 , eEventSliceUpdate = 3 ,
  eEventPrintUpdate = 4
}
enum  PrintSelectType {
  ePrintAll = 0 , ePrintPlate = 1 , eExportSlicedFile = 2 , eExportGcode = 3 ,
  eSendGcode = 4 , eSendToPrinter = 5 , eSendToPrinterAll = 6 , eUploadGcode = 7 ,
  eExportAllSlicedFile = 8 , ePrintMultiMachine = 9
}

Public Member Functions

 MainFrame ()
 ~MainFrame ()=default
void update_layout ()
void shutdown ()
Plater * plater ()
BBLTopbar * topbar ()
void update_filament_tab_ui ()
void update_title ()
void set_max_recent_count (int max)
void show_publish_button (bool show)
void update_title_colour_after_set_title ()
void show_option (bool show)
void init_tabpanel ()
void create_preset_tabs ()
void add_created_tab (Tab *panel, const std::string &bmp_name="")
bool is_active_and_shown_tab (wxPanel *panel)
void register_win32_callbacks ()
void init_menubar_as_editor ()
void init_menubar_as_gcodeviewer ()
void update_menubar ()
void open_menubar_item (const wxString &menu_name, const wxString &item_name)
void show_log_window ()
void update_ui_from_settings ()
void show_sync_dialog ()
void update_side_preset_ui ()
void on_select_default_preset (SimpleEvent &evt)
bool is_loaded () const
bool is_last_input_file () const
void reslice_now ()
void export_config ()
void load_config_file ()
bool load_config_file (const std::string &path)
void load_config (const DynamicPrintConfig &config)
void jump_to_monitor (std::string dev_id="")
void jump_to_multipage ()
bool preview_only_hint ()
void select_tab (wxPanel *panel)
void select_tab (const wxString &id=wxString())
void request_select_tab (const wxString &id)
void select_prepare_for_gl_init ()
void prebuild_pages_when_idle ()
bool Show (bool show=true) override
int get_calibration_curr_tab ()
void select_view (const std::string &direction)
void update_shortcut_labels ()
void on_config_changed (DynamicPrintConfig *cfg) const
void set_print_button_to_default (PrintSelectType select_type)
std::vector< PrintSelectType > available_print_actions () const
void select_print_action (PrintSelectType select_type)
void remember_print_select (PrintSelectType select_type)
bool get_remembered_print_select (PrintSelectType &out) const
bool can_save () const
bool can_save_as () const
bool can_upload () const
void save_project ()
bool save_project_as (const wxString &filename=wxString())
void publish_project ()
void add_to_recent_projects (const wxString &filename)
void get_recent_projects (boost::property_tree::wptree &tree, int images)
void open_recent_project (size_t file_id, wxString const &filename)
void remove_recent_project (size_t file_id, wxString const &filename)
void technology_changed ()
void run_calibration (CalibKind calib_kind)
void load_url (wxString url)
void load_printer_url (wxString url, wxString apikey="")
void load_printer_url ()
bool is_printer_view () const
void refresh_plugin_tips ()
void RunScript (wxString js)
void show_device (bool should_use_native)
void fit_tab_labels ()
bool is_prepare_or_preview_tab () const
PluginPages & plugin_pages ()
PrintHostQueueDialog * printhost_queue_dlg ()
void set_undo_redo_enabled (bool undo, bool redo)
bool get_enable_slice_status ()
bool get_enable_print_status ()
void update_side_button_style ()
void update_slice_print_status (SlicePrintEventType event, bool can_slice=true, bool can_print=true)
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 ()

Public Attributes

PA_Calibration_Dlg * m_pa_calib_dlg { nullptr }
FlowRateCalibrationDialog * m_flow_rate_calib_dlg { nullptr }
Temp_Calibration_Dlg * m_temp_calib_dlg { nullptr }
MaxVolumetricSpeed_Test_Dlg * m_vol_test_dlg { nullptr }
VFA_Test_Dlg * m_vfa_test_dlg { nullptr }
Retraction_Test_Dlg * m_retraction_calib_dlg { nullptr }
Input_Shaping_Freq_Test_Dlg * m_IS_freq_calib_dlg { nullptr }
Input_Shaping_Damp_Test_Dlg * m_IS_damp_calib_dlg { nullptr }
Cornering_Test_Dlg * m_cornering_calib_dlg { nullptr }
BBLTopbar * m_topbar { nullptr }
Plater * m_plater { nullptr }
LazyPage< MonitorPanel > * m_monitor_page { nullptr }
LazyPage< MultiMachinePage > * m_multi_machine_page { nullptr }
LazyPage< ProjectPanel > * m_project_page { nullptr }
LazyPage< CalibrationPanel > * m_calibration_page { nullptr }
LazyPage< WebViewPanel > * m_home_page { nullptr }
LazyPage< PrinterWebView > * m_printer_view_page {nullptr}
PluginPages m_plugin_pages
wxLogWindow * m_log_window { nullptr }
Notebook * m_tabpanel { nullptr }
wxBoxSizer * m_side_tools { nullptr }
ParamsPanel * m_param_panel { nullptr }
ParamsDialog * m_param_dialog { nullptr }
SettingsDialog m_settings_dialog
Lazy< DiffPresetDialog > m_diff_dialog
wxWindow * m_plater_page { nullptr }
PrintHostQueueDialog * m_printhost_queue_dlg
int m_print_select { ePrintAll }
int m_slice_select { eSliceAll }
SideButton * m_slice_btn { nullptr }
SideButton * m_slice_option_btn { nullptr }
SideButton * m_print_btn { nullptr }
SideButton * m_print_option_btn { nullptr }
SidePopup * m_slice_option_pop_up { nullptr }
FilamentGroupPopup * m_filament_group_popup { nullptr }
bool m_slice_enable { true }
bool m_print_enable { true }

Protected Member Functions

virtual void on_dpi_changed (const wxRect &suggested_rect) override
virtual void on_sys_color_changed () override

Private Types

enum  MenuItems { miExport = 0 , miSend , miMaterialTab , miPrinterTab }
enum class  ESettingsLayout { Unknown , Old , GCodeViewer }
enum  SliceSelectType { eSliceAll = 0 , eSlicePlate = 1 }

Private Member Functions

std::string get_base_name (const wxString &full_name, const char *extension=nullptr) const
std::string get_dir_name (const wxString &full_name) const
void on_presets_changed (SimpleEvent &)
void on_value_changed (wxCommandEvent &)
bool can_start_new_project () const
bool can_open_project () const
bool can_add_models () const
bool can_export_model () const
bool can_export_toolpaths () const
bool can_export_supports () const
bool can_export_gcode () const
bool can_export_all_gcode () const
bool can_print_3mf () const
bool can_send_gcode () const
bool can_slice () const
bool can_change_view () const
bool can_select () const
bool can_deselect () const
bool can_clone () const
bool can_delete () const
bool can_delete_all () const
bool can_reslice () const
DiffPresetDialog * make_diff_dialog ()
wxBoxSizer * create_side_tools ()
wxString shortcut_label (const wxString &label, Shortcut shortcut, bool accelerator)
template<typename... Args>
wxMenuItem * append_shortcut_item (wxMenu *menu, Shortcut shortcut, bool accelerator, const wxString &label, Args &&... args)
bool handle_global_shortcut (const KeyChord &chord)
void add_common_view_menu_items (wxMenu *view_menu, std::function< bool(void)> can_change_view)
wxMenu * generate_help_menu ()
void update_em_unit ()
bool is_new_scale_factor () const
void rescale (const wxRect &suggested_rect)

Private Attributes

bool m_loaded {false}
wxTimer * m_reset_title_text_colour_timer { nullptr }
IdleScheduler m_idle
bool m_prebuild_started { false }
Slic3r::GUI::MainFrame::GLResourcesPrebuild * this
Slic3r::GUI::MainFrame::PrepareLayoutPrebuild * this
std::vector< LazyBase * > m_lazy_pages
wxString m_printer_url
wxString m_printer_api_key
wxString m_qs_last_input_file = wxEmptyString
wxString m_qs_last_output_file = wxEmptyString
wxString m_last_config = wxEmptyString
wxMenuBar * m_menubar { nullptr }
wxMenu * m_calib_menu {nullptr}
bool enable_multi_machine { false }
wxMenuItem * m_menu_item_reslice_now { nullptr }
wxSizer * m_main_sizer { nullptr }
wxString m_last_selected_tab
std::vector< wxMenuItem * > m_changeable_menu_items
std::vector< ShortcutMenuItem > m_shortcut_menu_items
FileHistory m_recent_projects
ESettingsLayout m_layout { ESettingsLayout::Unknown }
bool preview_only_to_editor = false
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::MainFrame::ShortcutMenuItem

struct Slic3r::GUI::MainFrame::ShortcutMenuItem
Class Members
bool accelerator
wxMenuItem * item
wxString label
Shortcut shortcut

Member Enumeration Documentation

◆ ESettingsLayout

enum class Slic3r::GUI::MainFrame::ESettingsLayout
strongprivate
Enumerator
Unknown 
Old 
GCodeViewer 
299 {
300 //BBS GUI refactor: remove unused layout
301 Unknown,
302 Old,
303 //New,
304 //Dlg,
306 };
@ Unknown
Definition PresetBundle.hpp:42
@ GCodeViewer
Definition Process.cpp:38

◆ MenuItems

Enumerator
miExport 
miSend 
miMaterialTab 
miPrinterTab 
244 { // FFF SLA
245 miExport = 0, // Export G-code Export
246 miSend, // Send G-code Send to print
247 miMaterialTab, // Filament Settings Material Settings
248 miPrinterTab, // Different bitmap for Printer Settings
249 };
@ miMaterialTab
Definition MainFrame.hpp:247
@ miPrinterTab
Definition MainFrame.hpp:248
@ miSend
Definition MainFrame.hpp:246
@ miExport
Definition MainFrame.hpp:245

◆ PrintSelectType

Enumerator
ePrintAll 
ePrintPlate 
eExportSlicedFile 
eExportGcode 
eSendGcode 
eSendToPrinter 
eSendToPrinterAll 
eUploadGcode 
eExportAllSlicedFile 
ePrintMultiMachine 
345 {
346 ePrintAll = 0,
347 ePrintPlate = 1,
349 eExportGcode = 3,
350 eSendGcode = 4,
351 eSendToPrinter = 5,
353 eUploadGcode = 7,
356 };
@ eUploadGcode
Definition MainFrame.hpp:353
@ eSendGcode
Definition MainFrame.hpp:350
@ eExportSlicedFile
Definition MainFrame.hpp:348
@ eExportAllSlicedFile
Definition MainFrame.hpp:354
@ eSendToPrinterAll
Definition MainFrame.hpp:352
@ ePrintAll
Definition MainFrame.hpp:346
@ ePrintPlate
Definition MainFrame.hpp:347
@ ePrintMultiMachine
Definition MainFrame.hpp:355
@ eSendToPrinter
Definition MainFrame.hpp:351
@ eExportGcode
Definition MainFrame.hpp:349

◆ SlicePrintEventType

Enumerator
eEventObjectUpdate 
eEventPlateUpdate 
eEventParamUpdate 
eEventSliceUpdate 
eEventPrintUpdate 
336 {
342 };
@ eEventPlateUpdate
Definition MainFrame.hpp:338
@ eEventSliceUpdate
Definition MainFrame.hpp:340
@ eEventObjectUpdate
Definition MainFrame.hpp:337
@ eEventPrintUpdate
Definition MainFrame.hpp:341
@ eEventParamUpdate
Definition MainFrame.hpp:339

◆ SliceSelectType

Enumerator
eSliceAll 
eSlicePlate 
311 {
312 eSliceAll = 0,
313 eSlicePlate = 1,
314 };
@ eSlicePlate
Definition MainFrame.hpp:313
@ eSliceAll
Definition MainFrame.hpp:312

Constructor & Destructor Documentation

◆ MainFrame()

Slic3r::GUI::MainFrame::MainFrame ( )
401 :
402DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, BORDERLESS_FRAME_STYLE, "mainframe")
403 , m_printhost_queue_dlg(new PrintHostQueueDialog(this))
404 // BBS
406 , m_settings_dialog(this)
407 , m_idle([] { return wxGetApp().input_idle_ms(); })
408 , m_diff_dialog("compare_presets", 100, [this] { return make_diff_dialog(); })
409{
410#ifdef __WXOSX__
411 set_miniaturizable(GetHandle());
412#endif
413
414#ifdef __WXGTK__
415 m_gdkDecor = 0;
416
417 m_edge_bottom = new ResizeEdgePanel(this, ResizeEdgePanel::Bottom);
418 m_edge_left = new ResizeEdgePanel(this, ResizeEdgePanel::Left);
419 m_edge_right = new ResizeEdgePanel(this, ResizeEdgePanel::Right);
420#endif
421
422#ifdef __WXMSW__
423 if (HWND hWnd = GetHandle(); hWnd != nullptr) {
424 LONG_PTR style = GetWindowLongPtr(hWnd, GWL_STYLE);
425 if ((style & WS_CAPTION) != 0) {
426 SetWindowLongPtr(hWnd, GWL_STYLE, style & ~WS_CAPTION);
427 SetWindowPos(hWnd, nullptr, 0, 0, 0, 0,
428 SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
429 }
430 }
431#endif
432
433 if (!wxGetApp().app_config->has("user_mode")) {
434 wxGetApp().app_config->set("user_mode", "simple");
435 wxGetApp().app_config->set_bool("developer_mode", false);
436 wxGetApp().app_config->save();
437 }
438
439 wxGetApp().app_config->set_bool("internal_developer_mode", false);
440
441 wxString max_recent_count_str = wxGetApp().app_config->get("max_recent_count");
442 long max_recent_count = 18;
443 if (max_recent_count_str.ToLong(&max_recent_count))
444 set_max_recent_count((int)max_recent_count);
445
446 //reset log level
447 auto loglevel = wxGetApp().app_config->get("log_severity_level");
449
450 // BBS
451 m_recent_projects.SetMenuPathStyle(wxFH_PATH_SHOW_ALWAYS);
453
454 // Fonts were created by the DPIFrame constructor for the monitor, on which the window opened.
455 wxGetApp().update_fonts(this);
456
457#ifndef __APPLE__
458 m_topbar = new BBLTopbar(this);
459#else
460 auto panel_topbar = new wxPanel(this, wxID_ANY);
461 panel_topbar->SetBackgroundColour(wxColour(38, 46, 48));
462 auto sizer_tobar = new wxBoxSizer(wxVERTICAL);
463 panel_topbar->SetSizer(sizer_tobar);
464 panel_topbar->Layout();
465#endif
466
467 //wxAuiToolBar* toolbar = new wxAuiToolBar();
468/*
469#ifndef __WXOSX__ // Don't call SetFont under OSX to avoid name cutting in ObjectList
470 this->SetFont(this->normal_font());
471#endif
472 // Font is already set in DPIFrame constructor
473*/
474
475#ifdef __APPLE__
476 m_reset_title_text_colour_timer = new wxTimer();
477 m_reset_title_text_colour_timer->SetOwner(this);
478 Bind(wxEVT_TIMER, [this](auto& e) {
481 });
482 this->Bind(wxEVT_FULLSCREEN, [this](wxFullScreenEvent& e) {
483 set_tag_when_enter_full_screen(e.IsFullScreen());
484 if (!e.IsFullScreen()) {
488 }
489 m_mac_fullscreen = false;
490 } else {
491 m_mac_fullscreen = true;
492 }
493 auto int_event = new IntEvent(EVT_NOTICE_FULL_SCREEN_CHANGED, e.IsFullScreen() ? 1 : 0);
494 wxQueueEvent(wxGetApp().plater(), int_event);
495 e.Skip();
496 });
497#endif
498
499#ifdef __APPLE__
500 // Initialize the docker task bar icon.
501 switch (wxGetApp().get_app_mode()) {
502 default:
504 m_taskbar_icon = std::make_unique<OrcaSlicerTaskBarIcon>(wxTBI_DOCK);
505 m_taskbar_icon->SetIcon(wxIcon(Slic3r::var("OrcaSlicer-mac_256px.ico"), wxBITMAP_TYPE_ICO), "OrcaSlicer");
506 break;
508 break;
509 }
510#endif // __APPLE__
511
512 // Load the icon either from the exe, or from the ico file.
513 SetIcon(main_frame_icon(wxGetApp().get_app_mode()));
514
515 // initialize tabpanel and menubar
517 if (wxGetApp().is_gcode_viewer())
519 else
521
522 // BBS
523#if 0
524 // This is needed on Windows to fake the CTRL+# of the window menu when using the numpad
525 wxAcceleratorEntry entries[6];
526 entries[0].Set(wxACCEL_CTRL, WXK_NUMPAD1, wxID_HIGHEST + 1);
527 entries[1].Set(wxACCEL_CTRL, WXK_NUMPAD2, wxID_HIGHEST + 2);
528 entries[2].Set(wxACCEL_CTRL, WXK_NUMPAD3, wxID_HIGHEST + 3);
529 entries[3].Set(wxACCEL_CTRL, WXK_NUMPAD4, wxID_HIGHEST + 4);
530 entries[4].Set(wxACCEL_CTRL, WXK_NUMPAD5, wxID_HIGHEST + 5);
531 entries[5].Set(wxACCEL_CTRL, WXK_NUMPAD6, wxID_HIGHEST + 6);
532 wxAcceleratorTable accel(6, entries);
533 SetAcceleratorTable(accel);
534#endif // _WIN32
535
536 // BBS
537 //wxAcceleratorEntry entries[13];
538 //int index = 0;
539 //entries[index++].Set(wxACCEL_CTRL, (int)'N', wxID_HIGHEST + wxID_NEW);
540 //entries[index++].Set(wxACCEL_CTRL, (int)'O', wxID_HIGHEST + wxID_OPEN);
541 //entries[index++].Set(wxACCEL_CTRL, (int)'S', wxID_HIGHEST + wxID_SAVE);
542 //entries[index++].Set(wxACCEL_CTRL | wxACCEL_SHIFT, (int)'S', wxID_HIGHEST + wxID_SAVEAS);
543 //entries[index++].Set(wxACCEL_CTRL, (int)'X', wxID_HIGHEST + wxID_CUT);
545 //entries[index++].Set(wxACCEL_CTRL, (int)'A', wxID_HIGHEST + wxID_SELECTALL);
546 //entries[index++].Set(wxACCEL_NORMAL, (int)27 /* escape */, wxID_HIGHEST + wxID_CANCEL);
547 //entries[index++].Set(wxACCEL_CTRL, (int)'Z', wxID_HIGHEST + wxID_UNDO);
548 //entries[index++].Set(wxACCEL_CTRL, (int)'Y', wxID_HIGHEST + wxID_REDO);
549 //entries[index++].Set(wxACCEL_CTRL, (int)'C', wxID_HIGHEST + wxID_COPY);
550 //entries[index++].Set(wxACCEL_CTRL, (int)'V', wxID_HIGHEST + wxID_PASTE);
551 //entries[index++].Set(wxACCEL_CTRL, (int)'P', wxID_HIGHEST + wxID_PREFERENCES);
552 //entries[index++].Set(wxACCEL_CTRL, (int)'I', wxID_HIGHEST + wxID_FILE6);
553 //wxAcceleratorTable accel(sizeof(entries) / sizeof(entries[0]), entries);
554 //SetAcceleratorTable(accel);
555
556 //Bind(wxEVT_MENU, [this](wxCommandEvent&) { m_plater->new_project(); }, wxID_HIGHEST + wxID_NEW);
557 //Bind(wxEVT_MENU, [this](wxCommandEvent&) { m_plater->load_project(); }, wxID_HIGHEST + wxID_OPEN);
559 //Bind(wxEVT_MENU, [this](wxCommandEvent&) { if (m_plater) m_plater->save_project(); }, wxID_HIGHEST + wxID_SAVE);
560 //Bind(wxEVT_MENU, [this](wxCommandEvent&) { if (m_plater) m_plater->save_project(true); }, wxID_HIGHEST + wxID_SAVEAS);
563 //Bind(wxEVT_MENU, [this](wxCommandEvent&) {
564 // if (!can_add_models())
565 // return;
566 // if (m_plater) {
567 // m_plater->add_model();
568 // }
569 // }, wxID_HIGHEST + wxID_FILE6);
570 //Bind(wxEVT_MENU, [this](wxCommandEvent&) { m_plater->select_all(); }, wxID_HIGHEST + wxID_SELECTALL);
571 //Bind(wxEVT_MENU, [this](wxCommandEvent&) { m_plater->deselect_all(); }, wxID_HIGHEST + wxID_CANCEL);
572 //Bind(wxEVT_MENU, [this](wxCommandEvent&) {
573 // if (m_plater->is_view3D_shown())
574 // m_plater->undo();
575 // }, wxID_HIGHEST + wxID_UNDO);
576 //Bind(wxEVT_MENU, [this](wxCommandEvent&) {
577 // if (m_plater->is_view3D_shown())
578 // m_plater->redo();
579 // }, wxID_HIGHEST + wxID_REDO);
580 //Bind(wxEVT_MENU, [this](wxCommandEvent&) { m_plater->copy_selection_to_clipboard(); }, wxID_HIGHEST + wxID_COPY);
581 //Bind(wxEVT_MENU, [this](wxCommandEvent&) { m_plater->paste_from_clipboard(); }, wxID_HIGHEST + wxID_PASTE);
582 //Bind(wxEVT_MENU, [this](wxCommandEvent&) { m_plater->cut_selection_to_clipboard(); }, wxID_HIGHEST + wxID_CUT);
583 Bind(wxEVT_SIZE, [this](wxSizeEvent&) {
584 BOOST_LOG_TRIVIAL(trace) << "mainframe: size changed, is maximized = " << this->IsMaximized();
585#ifndef __APPLE__
586 if (this->IsMaximized()) {
587 m_topbar->SetWindowSize();
588 } else {
589 m_topbar->SetMaximizedSize();
590 }
591#endif
592 Refresh();
593 Layout();
594#ifdef __WXGTK__
595 update_edge_panels();
596#endif
597 wxQueueEvent(wxGetApp().plater(), new SimpleEvent(EVT_NOTICE_CHILDE_SIZE_CHANGED));
598
599 fit_tab_labels(); // ORCA on resize
600 // Restarts the idle build so a hidden Prepare page is laid out at the new size.
602 m_idle.start();
603 });
604
605 //BBS
606 Bind(EVT_SELECT_TAB, [this](wxCommandEvent& evt) {
607 m_tabpanel->SelectPageByName(evt.GetString());
608 });
609
610 Bind(EVT_SYNC_CLOUD_PRESET, &MainFrame::on_select_default_preset, this);
611
612// Bind(wxEVT_MENU,
613// [this](wxCommandEvent&)
614// {
615// PreferencesDialog dlg(this);
616// dlg.ShowModal();
617//#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
618// if (dlg.seq_top_layer_only_changed() || dlg.seq_seq_top_gcode_indices_changed())
619//#else
620// if (dlg.seq_top_layer_only_changed())
621//#endif // ENABLE_GCODE_LINES_ID_IN_H_SLIDER
622// plater()->refresh_print();
623// }, wxID_HIGHEST + wxID_PREFERENCES);
624
625
626 // set default tooltip timer in msec
627 // SetAutoPop supposedly accepts long integers but some bug doesn't allow for larger values
628 // (SetAutoPop is not available on GTK.)
629 wxToolTip::SetAutoPop(32767);
630
631 m_loaded = true;
632
633 // initialize layout
634 m_main_sizer = new wxBoxSizer(wxVERTICAL);
635 wxSizer* sizer = new wxBoxSizer(wxVERTICAL);
636#ifndef __APPLE__
637 sizer->Add(m_topbar, 0, wxEXPAND);
638#else
639 sizer->Add(panel_topbar, 0, wxEXPAND);
640#endif // __WINDOWS__
641
642
643 sizer->Add(m_main_sizer, 1, wxEXPAND);
644 SetSizerAndFit(sizer);
645 // initialize layout from config
647 sizer->SetSizeHints(this);
648
649 #ifdef __WXMSW__
650 // SetMaximize causes the window to overlap the taskbar, due to the fact this window has wxMAXIMIZE_BOX off
651 // https://forums.wxwidgets.org/viewtopic.php?t=50634
652 // Fix it here
653 this->Bind(wxEVT_MAXIMIZE, [this](auto &e) {
654 wxDisplay display(this);
655 auto size = display.GetClientArea().GetSize();
656 auto pos = display.GetClientArea().GetPosition();
657 HWND hWnd = GetHandle();
658 RECT borderThickness;
659 SetRectEmpty(&borderThickness);
660 AdjustWindowRectEx(&borderThickness, GetWindowLongPtr(hWnd, GWL_STYLE), FALSE, 0);
661 const auto max_size = size + wxSize{-borderThickness.left + borderThickness.right, -borderThickness.top + borderThickness.bottom};
662 const auto current_size = GetSize();
663 SetSize({std::min(max_size.x, current_size.x), std::min(max_size.y, current_size.y)});
664 Move(pos + wxPoint{borderThickness.left, borderThickness.top});
665 e.Skip();
666 });
667
668#endif // __WXMSW__
669
670
671 // BBS
672 Fit();
673
674 const wxSize min_size = wxGetApp().get_min_size(); //wxSize(76*wxGetApp().em_unit(), 49*wxGetApp().em_unit());
675
676 SetMinSize(min_size/*wxSize(760, 490)*/);
677 SetSize(wxSize(FromDIP(1200), FromDIP(800)));
678
679 Layout();
680
681 update_title();
682
683 // declare events
684 Bind(wxEVT_CLOSE_WINDOW, [this](wxCloseEvent& event) {
685 BOOST_LOG_TRIVIAL(info) << __FUNCTION__<< ": mainframe received close_widow event";
686 if (event.CanVeto() && m_plater->get_view3D_canvas3D()->get_gizmos_manager().is_in_editing_mode(true)) {
687 // prevents to open the save dirty project dialog
688 event.Veto();
689 BOOST_LOG_TRIVIAL(info) << __FUNCTION__<< "cancelled by gizmo in editing";
690 return;
691 }
692
693 //BBS:
694 //if (event.CanVeto() && !wxGetApp().check_and_save_current_preset_changes(_L("Application is closing"), _L("Closing Application while some presets are modified."))) {
695 // event.Veto();
696 // return;
697 //}
698 auto check = [](bool yes_or_no) {
699 if (yes_or_no)
700 return true;
701 return wxGetApp().check_and_save_current_preset_changes(_L("Closing application"), _L("Closing Application while some presets are modified."));
702 };
703
704 // BBS: close save project
705 int result;
706 if (event.CanVeto() && ((result = m_plater->close_with_confirm(check)) == wxID_CANCEL)) {
707 event.Veto();
708 BOOST_LOG_TRIVIAL(info) << __FUNCTION__<< "cancelled by close_with_confirm selection";
709 return;
710 }
711 if (event.CanVeto() && !wxGetApp().check_print_host_queue()) {
712 event.Veto();
713 return;
714 }
715
716 #if 0 // BBS
717 //if (m_plater != nullptr) {
718 // int saved_project = m_plater->save_project_if_dirty(_L("Closing Application. Current project is modified."));
719 // if (saved_project == wxID_CANCEL) {
720 // event.Veto();
721 // return;
722 // }
723 // // check unsaved changes only if project wasn't saved
724 // else if (plater()->is_project_dirty() && saved_project == wxID_NO && event.CanVeto() &&
725 // (plater()->is_presets_dirty() && !wxGetApp().check_and_save_current_preset_changes(_L("Application is closing"), _L("Closing Application while some presets are modified.")))) {
726 // event.Veto();
727 // return;
728 // }
729 //}
730 #endif
731
733 // Prevent queued selection/UI refresh work from running as normal during reset.
734 wxGetApp().set_closing(true);
735 wxGetApp().start_exit_watchdog();
736
737 m_plater->reset();
738 this->shutdown();
739 // propagate event
740
741 wxGetApp().remove_mall_system_dialog();
742 event.Skip();
743 BOOST_LOG_TRIVIAL(info) << __FUNCTION__<< ": mainframe finished process close_widow event";
744 });
745
746 //FIXME it seems this method is not called on application start-up, at least not on Windows. Why?
747 // The same applies to wxEVT_CREATE, it is not being called on startup on Windows.
748 Bind(wxEVT_ACTIVATE, [this](wxActivateEvent& event) {
749 if (m_plater != nullptr && event.GetActive())
750 m_plater->on_activate();
751 event.Skip();
752 });
753
754// OSX specific issue:
755// When we move application between Retina and non-Retina displays, The legend on a canvas doesn't redraw
756// So, redraw explicitly canvas, when application is moved
757//FIXME maybe this is useful for __WXGTK3__ as well?
758#if __APPLE__
759 Bind(wxEVT_MOVE, [](wxMoveEvent& event) {
760 wxGetApp().plater()->get_current_canvas3D()->set_as_dirty();
761 wxGetApp().plater()->get_current_canvas3D()->request_extra_frame();
762 event.Skip();
763 });
764#endif
765
766 update_ui_from_settings(); // FIXME (?)
767
768 if (m_plater != nullptr) {
769 // BBS
771
772 // BBS: backup project
773 if (wxGetApp().app_config->get("backup_switch") == "true") {
774 std::string backup_interval;
775 if (!wxGetApp().app_config->get("app", "backup_interval", backup_interval))
776 backup_interval = "10";
777 Slic3r::set_backup_interval(boost::lexical_cast<long>(backup_interval));
778 } else {
780 }
781 Slic3r::set_backup_callback([this](int action) {
782 if (action == 0) {
783 wxPostEvent(this, wxCommandEvent(EVT_BACKUP_POST));
784 }
785 else if (action == 1) {
786 if (!m_plater->up_to_date(false, true)) {
787 m_plater->export_3mf(m_plater->model().get_backup_path() + "/.3mf", SaveStrategy::Backup);
788 m_plater->up_to_date(true, true);
789 }
790 }
791 });
792 Bind(EVT_BACKUP_POST, [](wxCommandEvent& e) {
794 });
795; }
796 this->Bind(wxEVT_CHAR_HOOK, [this](wxKeyEvent &evt) {
797#ifdef __APPLE__
798 if (evt.CmdDown() && (evt.GetKeyCode() == 'H')) {
799 //call parent_menu hide behavior
800 return;}
801 if (evt.CmdDown() && (!evt.ShiftDown()) && (evt.GetKeyCode() == 'M')) {
802 this->Iconize();
803 return;
804 }
805 if (evt.CmdDown() && evt.RawControlDown() && evt.GetKeyCode() == 'F') {
806 EnableFullScreenView(true);
807 if (IsFullScreen()) {
808 ShowFullScreen(false);
809 } else {
810 ShowFullScreen(true);
811 }
812 return;}
813#endif
815 evt.Skip();
816 });
817
818 Bind(wxEVT_SHOW, [](wxShowEvent &evt) {
819 DeviceManager *manger = wxGetApp().getDeviceManager();
820 if (manger) {
821 evt.IsShown() ? manger->start_refresher() : manger->stop_refresher();
822 }
823 });
824
825#ifdef _MSW_DARK_MODE
826 wxGetApp().UpdateDarkUIWin(this);
827#endif // _MSW_DARK_MODE
828
829 wxGetApp().persist_window_geometry(this, true);
830 wxGetApp().persist_window_geometry(&m_settings_dialog, true);
831}
#define BORDERLESS_FRAME_STYLE
Definition MainFrame.cpp:394
#define _L(s)
Definition OBJ.cpp:34
#define style
Definition WipeTowerDialog.cpp:101
@ Editor
Definition GUI_App.hpp:261
@ GCodeViewer
Definition GUI_App.hpp:262
SettingsDialog m_settings_dialog
Definition MainFrame.hpp:535
void update_title()
Definition MainFrame.cpp:1389
void update_slice_print_status(SlicePrintEventType event, bool can_slice=true, bool can_print=true)
Definition MainFrame.cpp:2660
FileHistory m_recent_projects
Definition MainFrame.hpp:296
bool handle_global_shortcut(const KeyChord &chord)
Definition MainFrame.cpp:833
wxSizer * m_main_sizer
Definition MainFrame.hpp:207
void init_menubar_as_gcodeviewer()
Definition MainFrame.cpp:3861
Notebook * m_tabpanel
Definition MainFrame.hpp:530
wxTimer * m_reset_title_text_colour_timer
Definition MainFrame.hpp:152
void init_menubar_as_editor()
Definition MainFrame.cpp:2969
bool m_loaded
Definition MainFrame.hpp:151
void shutdown()
Definition MainFrame.cpp:1292
void fit_tab_labels()
Definition MainFrame.cpp:1742
void update_layout()
Definition MainFrame.cpp:1126
void set_max_recent_count(int max)
Definition MainFrame.cpp:3816
IdleScheduler m_idle
Definition MainFrame.hpp:153
DiffPresetDialog * make_diff_dialog()
Definition MainFrame.cpp:938
void on_select_default_preset(SimpleEvent &evt)
Definition MainFrame.cpp:4752
void update_ui_from_settings()
Definition MainFrame.cpp:4720
bool m_prebuild_started
Definition MainFrame.hpp:154
Plater * m_plater
Definition MainFrame.hpp:505
BBLTopbar * m_topbar
Definition MainFrame.hpp:503
Lazy< DiffPresetDialog > m_diff_dialog
Definition MainFrame.hpp:537
Plater * plater()
Definition MainFrame.hpp:363
void init_tabpanel()
Definition MainFrame.cpp:1445
PrintHostQueueDialog * m_printhost_queue_dlg
Definition MainFrame.hpp:539
static void ExitTip()
Definition MarkdownTip.cpp:318
static void Recreate(wxWindow *parent)
Definition MarkdownTip.cpp:330
void set_miniaturizable(void *window)
Definition MacDarkMode.mm:47
void set_title_colour_after_set_title(void *window)
Definition MacDarkMode.mm:72
void set_tag_when_enter_full_screen(bool isfullscreen)
Definition MacDarkMode.mm:67
DPIAware< wxFrame > DPIFrame
Definition GUI_Utils.hpp:298
static wxIcon main_frame_icon(GUI_App::EAppMode app_mode)
Definition MainFrame.cpp:367
Vec3d pos(const Pt &p)
Definition ReprojectPointsOnMesh.hpp:16
std::string var(const std::string &file_name)
Definition utils.cpp:278
void trace(unsigned int level, const char *message)
Definition utils.cpp:247
void set_backup_interval(long interval)
Definition bbs_3mf.cpp:9779
void run_backup_ui_tasks()
Definition bbs_3mf.cpp:9789
@ Backup
Definition bbs_3mf.hpp:185
void set_logging_level(unsigned int level)
Definition utils.cpp:171
void set_backup_callback(std::function< void(int)> callback)
Definition bbs_3mf.cpp:9784
unsigned int level_string_to_boost(std::string level)
Definition utils.cpp:195
bool check(ModelVolumeType volume_type)
Definition GLGizmoEmboss.cpp:515
static KeyChord from_event(const wxKeyEvent &evt)
Definition KeyChord.cpp:343

References BORDERLESS_FRAME_STYLE, m_idle, m_printhost_queue_dlg, m_recent_projects, m_settings_dialog, and this.

Referenced by Slic3r::GUI::MainFrame::GLResourcesPrebuild::GLResourcesPrebuild(), and Slic3r::GUI::MainFrame::PrepareLayoutPrebuild::PrepareLayoutPrebuild().

Here is the caller graph for this function:

◆ ~MainFrame()

Slic3r::GUI::MainFrame::~MainFrame ( )
default

Member Function Documentation

◆ add_common_view_menu_items()

void Slic3r::GUI::MainFrame::add_common_view_menu_items ( wxMenu * view_menu,
std::function< bool(void)> can_change_view )
private
2946{
2947 append_shortcut_item(view_menu, Shortcut::ViewDefault, true, _L("Default View"), _L("Default View"), [this](wxCommandEvent&) {
2948 select_view("plate");
2950 },
2951 "", nullptr, [can_change_view]() { return can_change_view(); }, this);
2952 //view_menu->AppendSeparator();
2953 //TRN To be shown in the main menu View->Top
2954 append_shortcut_item(view_menu, Shortcut::ViewTop, true, _L_CONTEXT("Top", "Camera View"), _L("Top View"), [this](wxCommandEvent&) { select_view("top"); },
2955 "", nullptr, [can_change_view]() { return can_change_view(); }, this);
2956 //TRN To be shown in the main menu View->Bottom
2957 append_shortcut_item(view_menu, Shortcut::ViewBottom, true, _L_CONTEXT("Bottom", "Camera View"), _L("Bottom View"), [this](wxCommandEvent&) { select_view("bottom"); },
2958 "", nullptr, [can_change_view]() { return can_change_view(); }, this);
2959 append_shortcut_item(view_menu, Shortcut::ViewFront, true, _L_CONTEXT("Front", "Camera View"), _L("Front View"), [this](wxCommandEvent&) { select_view("front"); },
2960 "", nullptr, [can_change_view]() { return can_change_view(); }, this);
2961 append_shortcut_item(view_menu, Shortcut::ViewRear, true, _L_CONTEXT("Rear", "Camera View"), _L("Rear View"), [this](wxCommandEvent&) { select_view("rear"); },
2962 "", nullptr, [can_change_view]() { return can_change_view(); }, this);
2963 append_shortcut_item(view_menu, Shortcut::ViewLeft, true, _L_CONTEXT("Left", "Camera View"), _L("Left View"), [this](wxCommandEvent &) { select_view("left"); },
2964 "", nullptr, [can_change_view]() { return can_change_view(); }, this);
2965 append_shortcut_item(view_menu, Shortcut::ViewRight, true, _L_CONTEXT("Right", "Camera View"), _L("Right View"), [this](wxCommandEvent &) { select_view("right"); },
2966 "", nullptr, [can_change_view]() { return can_change_view(); }, this);
2967}
void zoom_to_bed()
Definition GLCanvas3D.cpp:2345
bool can_change_view() const
Definition MainFrame.cpp:2089
wxMenuItem * append_shortcut_item(wxMenu *menu, Shortcut shortcut, bool accelerator, const wxString &label, Args &&... args)
Definition MainFrame.hpp:266
void select_view(const std::string &direction)
Definition MainFrame.cpp:4348
GLCanvas3D * get_current_canvas3D(bool exclude_preview=false)
Definition Plater.cpp:22126
@ ViewLeft
Definition Shortcuts.hpp:47
@ ViewRear
Definition Shortcuts.hpp:47
@ ViewDefault
Definition Shortcuts.hpp:47
@ ViewBottom
Definition Shortcuts.hpp:47
@ ViewFront
Definition Shortcuts.hpp:47
@ ViewRight
Definition Shortcuts.hpp:47
@ ViewTop
Definition Shortcuts.hpp:47
#define _L_CONTEXT(s, ctx)
Definition I18N.hpp:15

References _L, _L_CONTEXT, append_shortcut_item(), can_change_view(), Slic3r::GUI::Plater::get_current_canvas3D(), plater(), select_view(), Slic3r::GUI::ViewBottom, Slic3r::GUI::ViewDefault, Slic3r::GUI::ViewFront, Slic3r::GUI::ViewLeft, Slic3r::GUI::ViewRear, Slic3r::GUI::ViewRight, Slic3r::GUI::ViewTop, and Slic3r::GUI::GLCanvas3D::zoom_to_bed().

Referenced by init_menubar_as_editor(), and init_menubar_as_gcodeviewer().

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

◆ add_created_tab()

void Slic3r::GUI::MainFrame::add_created_tab ( Tab * panel,
const std::string & bmp_name = "" )
1879{
1880 panel->create_preset_tab();
1881
1882 if (panel->type() == Preset::TYPE_PLATE) {
1883 wxGetApp().tabs_list.pop_back();
1884 wxGetApp().plate_tab = panel;
1885 }
1886 // BBS: model config
1887 if (panel->type() == Preset::TYPE_MODEL) {
1888 wxGetApp().tabs_list.pop_back();
1889 wxGetApp().model_tabs_list.push_back(panel);
1890 }
1891}
@ TYPE_MODEL
Definition Preset.hpp:258
@ TYPE_PLATE
Definition Preset.hpp:256

References Slic3r::GUI::Tab::create_preset_tab(), Slic3r::GUI::Tab::type(), Slic3r::Preset::TYPE_MODEL, and Slic3r::Preset::TYPE_PLATE.

Referenced by create_preset_tabs().

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

◆ add_to_recent_projects()

void Slic3r::GUI::MainFrame::add_to_recent_projects ( const wxString & filename)
4425{
4426 if (wxFileExists(filename))
4427 {
4428 m_recent_projects.AddFileToHistory(filename);
4429 std::vector<std::string> recent_projects;
4430 size_t count = m_recent_projects.GetCount();
4431 for (size_t i = 0; i < count; ++i)
4432 {
4433 recent_projects.push_back(into_u8(m_recent_projects.GetHistoryFile(i)));
4434 }
4435 wxGetApp().app_config->set_recent_projects(recent_projects);
4436 if (WebViewPanel* home = WebViewPanel::if_built())
4437 home->SendRecentList(0);
4438 }
4439}
static unsigned int count
Definition AuxiliaryDataViewModel.cpp:246
static WebViewPanel * if_built()
Definition Lazy.hpp:183
std::string into_u8(const wxString &str)
Definition GUI.cpp:549

References count, Slic3r::GUI::LazyInstance< WebViewPanel >::if_built(), Slic3r::GUI::into_u8(), and m_recent_projects.

Here is the call graph for this function:

◆ append_shortcut_item()

template<typename... Args>
wxMenuItem * Slic3r::GUI::MainFrame::append_shortcut_item ( wxMenu * menu,
Shortcut shortcut,
bool accelerator,
const wxString & label,
Args &&... args )
inlineprivate
267 {
268 wxMenuItem* item = append_menu_item(menu, wxID_ANY, shortcut_label(label, shortcut, accelerator), std::forward<Args>(args)...);
269 m_shortcut_menu_items.push_back({ item, shortcut, label, accelerator });
270 return item;
271 }
wxString shortcut_label(const wxString &label, Shortcut shortcut, bool accelerator)
Definition MainFrame.cpp:2831
std::vector< ShortcutMenuItem > m_shortcut_menu_items
Definition MainFrame.hpp:262
wxMenuItem * append_menu_item(wxMenu *menu, int id, const wxString &string, const wxString &description, std::function< void(wxCommandEvent &event)> cb, const wxBitmap &icon, wxEvtHandler *event_handler, std::function< bool()> const cb_condition, wxWindow *parent, int insert_pos)
Definition wxExtensions.cpp:89

References append_menu_item(), m_shortcut_menu_items, and shortcut_label().

Referenced by add_common_view_menu_items(), generate_help_menu(), and init_menubar_as_editor().

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

◆ available_print_actions()

std::vector< MainFrame::PrintSelectType > Slic3r::GUI::MainFrame::available_print_actions ( ) const
2172{
2173 std::vector<PrintSelectType> actions;
2174 const auto preset_bundle = wxGetApp().preset_bundle;
2175 const bool use_printer_agents = wxGetApp().app_config->get_bool("use_printer_agents");
2176
2177 if (preset_bundle && !preset_bundle->is_bbl_vendor() && !use_printer_agents) {
2178 // ThirdParty actions
2179 actions.push_back(eSendGcode);
2180 // Orca: when the printer accepts a .gcode.3mf (the "Support 3MF as gcode" option),
2181 // also offer exporting the sliced .gcode.3mf bundle
2182 const auto* use_3mf_opt = preset_bundle->printers.get_edited_preset().config.option<ConfigOptionBool>("use_3mf");
2183 if (use_3mf_opt != nullptr && use_3mf_opt->value)
2184 actions.push_back(eExportSlicedFile);
2185 actions.push_back(eExportGcode);
2186 return actions;
2187 }
2188
2189 // Orca Slicer actions
2190 bool support_send = true;
2191 bool support_print_all = true;
2192 if (preset_bundle && !preset_bundle->use_bbl_network() && !use_printer_agents) {
2193 support_send = false; // All 3rd print hosts do not have the send options
2194
2195 const auto& cfg = preset_bundle->printers.get_edited_preset().config;
2196 const auto* host_type_opt = cfg.option<ConfigOptionEnum<PrintHostType>>("host_type");
2197 // Only simply print support uploading all plates
2198 support_print_all = host_type_opt != nullptr && host_type_opt->value == PrintHostType::htSimplyPrint;
2199 }
2200
2201 actions.push_back(ePrintPlate);
2202 if (support_print_all)
2203 actions.push_back(ePrintAll);
2204 if (support_send) {
2205 actions.push_back(eSendToPrinter);
2206 actions.push_back(eSendToPrinterAll);
2207 }
2209 actions.push_back(ePrintMultiMachine);
2210 actions.push_back(eExportSlicedFile);
2211 actions.push_back(eExportAllSlicedFile);
2212 actions.push_back(eExportGcode);
2213 return actions;
2214}
bool enable_multi_machine
Definition MainFrame.hpp:201
@ htSimplyPrint
Definition PrintConfig.hpp:119

References eExportAllSlicedFile, eExportGcode, eExportSlicedFile, enable_multi_machine, ePrintAll, ePrintMultiMachine, ePrintPlate, eSendGcode, eSendToPrinter, eSendToPrinterAll, Slic3r::htSimplyPrint, and Slic3r::ConfigOptionSingle< T >::value.

Referenced by create_side_tools(), and get_remembered_print_select().

Here is the caller graph for this function:

◆ can_add_models()

bool Slic3r::GUI::MainFrame::can_add_models ( ) const
private
1920{
1921 return (m_plater && !m_plater->is_background_process_slicing() && !m_plater->only_gcode_mode() && !m_plater->using_exported_file());
1922}

References m_plater.

Referenced by handle_global_shortcut(), and init_menubar_as_editor().

Here is the caller graph for this function:

◆ can_change_view()

bool Slic3r::GUI::MainFrame::can_change_view ( ) const
private
2090{
2091 switch (m_layout)
2092 {
2093 default: { return false; }
2094 //BBS GUI refactor: remove unused layout new/dlg
2095 case ESettingsLayout::Old: {
2096 int page_id = m_tabpanel->GetSelection();
2097 return page_id != wxNOT_FOUND && dynamic_cast<const Slic3r::GUI::Plater*>(m_tabpanel->GetPage((size_t)page_id)) != nullptr;
2098 }
2099 case ESettingsLayout::GCodeViewer: { return true; }
2100 }
2101}
@ GCodeViewer
Definition MainFrame.hpp:305
@ Old
Definition MainFrame.hpp:302
ESettingsLayout m_layout
Definition MainFrame.hpp:308
@ Plater
Definition Shortcuts.hpp:21

References GCodeViewer, m_layout, m_tabpanel, and Old.

Referenced by add_common_view_menu_items(), init_menubar_as_editor(), and init_menubar_as_gcodeviewer().

Here is the caller graph for this function:

◆ can_clone()

bool Slic3r::GUI::MainFrame::can_clone ( ) const
private
2103 {
2104 return can_select() && !m_plater->is_selection_empty();
2105}
bool can_select() const
Definition MainFrame.cpp:2107

References can_select(), and m_plater.

Referenced by init_menubar_as_editor().

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

◆ can_delete()

bool Slic3r::GUI::MainFrame::can_delete ( ) const
private
2118{
2119 return (m_plater != nullptr) && (m_tabpanel->GetSelectedPageName() == TAB_ID_PREPARE) && !m_plater->is_selection_empty();
2120}
#define TAB_ID_PREPARE
Definition MainFrame.hpp:60

References m_plater, m_tabpanel, and TAB_ID_PREPARE.

Referenced by init_menubar_as_editor().

Here is the caller graph for this function:

◆ can_delete_all()

bool Slic3r::GUI::MainFrame::can_delete_all ( ) const
private
2123{
2124 return (m_plater != nullptr) && (m_tabpanel->GetSelectedPageName() == TAB_ID_PREPARE) && !m_plater->model().objects.empty();
2125}

References m_plater, m_tabpanel, and TAB_ID_PREPARE.

Referenced by init_menubar_as_editor().

Here is the caller graph for this function:

◆ can_deselect()

bool Slic3r::GUI::MainFrame::can_deselect ( ) const
private
2113{
2114 return (m_plater != nullptr) && (m_tabpanel->GetSelectedPageName() == TAB_ID_PREPARE) && !m_plater->is_selection_empty();
2115}

References m_plater, m_tabpanel, and TAB_ID_PREPARE.

Referenced by init_menubar_as_editor().

Here is the caller graph for this function:

◆ can_export_all_gcode()

bool Slic3r::GUI::MainFrame::can_export_all_gcode ( ) const
private
2022{
2023 if (m_plater == nullptr)
2024 return false;
2025
2026 if (m_plater->model().objects.empty())
2027 return false;
2028
2029 if (m_plater->is_export_gcode_scheduled())
2030 return false;
2031
2032 // TODO:: add other filters
2033 PartPlateList& part_plate_list = m_plater->get_partplate_list();
2034 return part_plate_list.is_all_slice_results_ready_for_print();
2035}

References Slic3r::GUI::PartPlateList::is_all_slice_results_ready_for_print(), and m_plater.

Referenced by init_menubar_as_editor().

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

◆ can_export_gcode()

bool Slic3r::GUI::MainFrame::can_export_gcode ( ) const
private
2002{
2003 if (m_plater == nullptr)
2004 return false;
2005
2006 if (m_plater->model().objects.empty())
2007 return false;
2008
2009 if (m_plater->is_export_gcode_scheduled())
2010 return false;
2011
2012 // TODO:: add other filters
2013 PartPlateList &part_plate_list = m_plater->get_partplate_list();
2014 PartPlate *current_plate = part_plate_list.get_curr_plate();
2015 if (!current_plate->is_slice_result_ready_for_print())
2016 return false;
2017
2018 return true;
2019}

References Slic3r::GUI::PartPlateList::get_curr_plate(), Slic3r::GUI::PartPlate::is_slice_result_ready_for_print(), and m_plater.

Referenced by handle_global_shortcut(), and init_menubar_as_editor().

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

◆ can_export_model()

bool Slic3r::GUI::MainFrame::can_export_model ( ) const
private
1974{
1975 return (m_plater != nullptr) && !m_plater->model().objects.empty();
1976}

References m_plater.

Referenced by handle_global_shortcut(), and init_menubar_as_editor().

Here is the caller graph for this function:

◆ can_export_supports()

bool Slic3r::GUI::MainFrame::can_export_supports ( ) const
private
1984{
1985 if ((m_plater == nullptr) || (m_plater->printer_technology() != ptSLA) || m_plater->model().objects.empty())
1986 return false;
1987
1988 bool can_export = false;
1989 const PrintObjects& objects = m_plater->sla_print().objects();
1990 for (const SLAPrintObject* object : objects)
1991 {
1992 if (object->has_mesh(slaposPad) || object->has_mesh(slaposSupportTree))
1993 {
1994 can_export = true;
1995 break;
1996 }
1997 }
1998 return can_export;
1999}
std::vector< SLAPrintObject * > PrintObjects
Definition SLAPrint.hpp:374
@ ptSLA
Definition Config.hpp:233
@ slaposPad
Definition SLAPrint.hpp:48
@ slaposSupportTree
Definition SLAPrint.hpp:47

References m_plater, Slic3r::ptSLA, Slic3r::slaposPad, and Slic3r::slaposSupportTree.

◆ can_export_toolpaths()

bool Slic3r::GUI::MainFrame::can_export_toolpaths ( ) const
private
1979{
1980 return (m_plater != nullptr) && (m_plater->printer_technology() == ptFFF) && m_plater->is_preview_shown() && m_plater->is_preview_loaded() && m_plater->has_toolpaths_to_export();
1981}
@ ptFFF
Definition Config.hpp:231

References m_plater, and Slic3r::ptFFF.

Referenced by init_menubar_as_editor(), and init_menubar_as_gcodeviewer().

Here is the caller graph for this function:

◆ can_open_project()

bool Slic3r::GUI::MainFrame::can_open_project ( ) const
private
1915{
1916 return (m_plater && !m_plater->is_background_process_slicing());
1917}

References m_plater.

Referenced by init_menubar_as_editor().

Here is the caller graph for this function:

◆ can_print_3mf()

bool Slic3r::GUI::MainFrame::can_print_3mf ( ) const
private
2038{
2039 if (m_plater && !m_plater->model().objects.empty()) {
2040 //
2041 }
2042 return true;
2043}

References m_plater.

◆ can_reslice()

bool Slic3r::GUI::MainFrame::can_reslice ( ) const
private
2128{
2129 return (m_plater != nullptr) && !m_plater->model().objects.empty();
2130}

References m_plater.

◆ can_save()

bool Slic3r::GUI::MainFrame::can_save ( ) const
1925{
1926 return (m_plater != nullptr) &&
1927 !m_plater->get_view3D_canvas3D()->get_gizmos_manager().is_in_editing_mode(false) &&
1928 m_plater->is_project_dirty() && !m_plater->using_exported_file() && !m_plater->only_gcode_mode();
1929}

References m_plater.

Referenced by handle_global_shortcut(), and init_menubar_as_editor().

Here is the caller graph for this function:

◆ can_save_as()

bool Slic3r::GUI::MainFrame::can_save_as ( ) const
1932{
1933 return (m_plater != nullptr) &&
1934 !m_plater->get_view3D_canvas3D()->get_gizmos_manager().is_in_editing_mode(false) && !m_plater->using_exported_file() && !m_plater->only_gcode_mode();
1935}

References m_plater.

Referenced by handle_global_shortcut(), init_menubar_as_editor(), and Slic3r::GUI::Plater::priv::save_project_if_dirty().

Here is the caller graph for this function:

◆ can_select()

bool Slic3r::GUI::MainFrame::can_select ( ) const
private
2108{
2109 return (m_plater != nullptr) && (m_tabpanel->GetSelectedPageName() == TAB_ID_PREPARE) && !m_plater->model().objects.empty();
2110}

References m_plater, m_tabpanel, and TAB_ID_PREPARE.

Referenced by can_clone(), and init_menubar_as_editor().

Here is the caller graph for this function:

◆ can_send_gcode()

bool Slic3r::GUI::MainFrame::can_send_gcode ( ) const
private
2046{
2047 if (m_plater && !m_plater->model().objects.empty())
2048 {
2049 auto cfg = wxGetApp().preset_bundle->printers.get_edited_preset().config;
2050
2051 const auto *print_host_opt = cfg.option<ConfigOptionString>("print_host");
2052 if (! print_host_opt) return false;
2053 else return !print_host_opt->value.empty();
2054 }
2055 return true;
2056}
zaa_minimize_perimeter_height ConfigOptionString
Definition PrintConfig.hpp:1702

References m_plater, and Slic3r::ConfigOptionSingle< T >::value.

Referenced by get_enable_print_status().

Here is the caller graph for this function:

◆ can_slice()

bool Slic3r::GUI::MainFrame::can_slice ( ) const
private
2080{
2081#ifdef SUPPORT_BACKGROUND_PROCESSING
2082 bool bg_proc = wxGetApp().app_config->get("background_processing") == "1";
2083 return (m_plater != nullptr) ? !m_plater->model().objects.empty() && !bg_proc : false;
2084#else
2085 return (m_plater != nullptr) ? !m_plater->model().objects.empty() : false;
2086#endif
2087}

References m_plater.

Referenced by update_slice_print_status().

Here is the caller graph for this function:

◆ can_start_new_project()

bool Slic3r::GUI::MainFrame::can_start_new_project ( ) const
private
1906{
1907 /*return m_plater && (!m_plater->get_project_filename(".3mf").IsEmpty() ||
1908 GetTitle().StartsWith('*')||
1909 wxGetApp().has_current_preset_changes() ||
1910 !m_plater->model().objects.empty());*/
1911 return (m_plater && !m_plater->is_background_process_slicing());
1912}

References m_plater.

Referenced by init_menubar_as_editor().

Here is the caller graph for this function:

◆ can_upload()

bool Slic3r::GUI::MainFrame::can_upload ( ) const
1969{
1970 return true;
1971}

◆ create_preset_tabs()

void Slic3r::GUI::MainFrame::create_preset_tabs ( )
1854{
1855 wxGetApp().update_label_colours_from_appconfig();
1856
1857 //BBS: GUI refactor
1858 //m_param_panel = new ParamsPanel(m_tabpanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBK_LEFT | wxTAB_TRAVERSAL);
1859 m_param_dialog = new ParamsDialog(m_plater);
1860
1861 add_created_tab(new TabPrint(m_param_panel), "cog");
1862 add_created_tab(new TabPrintPlate(m_param_panel), "cog");
1863 add_created_tab(new TabPrintObject(m_param_panel), "cog");
1864 add_created_tab(new TabPrintPart(m_param_panel), "cog");
1865 add_created_tab(new TabPrintLayer(m_param_panel), "cog");
1866 add_created_tab(new TabFilament(m_param_dialog->panel()), "spool");
1867 /* BBS work around to avoid appearance bug */
1868 //add_created_tab(new TabSLAPrint(m_param_panel));
1869 //add_created_tab(new TabSLAMaterial(m_param_panel));
1870 add_created_tab(new TabPrinter(m_param_dialog->panel()), "printer");
1871
1872 m_param_panel->rebuild_panels();
1873 m_param_dialog->panel()->rebuild_panels();
1874 //m_tabpanel->AddPage(m_param_panel, "Parameters", "notebook_presets_active");
1875 //m_tabpanel->InsertPage(tpSettings, m_param_panel, _L("Parameters"), std::string("cog"));
1876}
ParamsDialog * m_param_dialog
Definition MainFrame.hpp:533
ParamsPanel * m_param_panel
Definition MainFrame.hpp:532
void add_created_tab(Tab *panel, const std::string &bmp_name="")
Definition MainFrame.cpp:1878

References add_created_tab(), m_param_dialog, m_param_panel, and m_plater.

Referenced by init_tabpanel().

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

◆ create_side_tools()

wxBoxSizer * Slic3r::GUI::MainFrame::create_side_tools ( )
private
2253{
2254 enable_multi_machine = wxGetApp().is_enable_multi_machine();
2255 int em = em_unit();
2256 wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
2257
2260
2261 auto slice_panel = new wxPanel(this,wxID_ANY,wxDefaultPosition,wxDefaultSize);
2262 auto print_panel = new wxPanel(this,wxID_ANY,wxDefaultPosition,wxDefaultSize);
2263 slice_panel->SetBackgroundColour(StateColor::darkModeColorFor(wxColour("#3B4446")));
2264 print_panel->SetBackgroundColour(StateColor::darkModeColorFor(wxColour("#3B4446")));
2265
2266 m_slice_btn = new SideButton(slice_panel, _L("Slice plate"), "");
2267 m_slice_option_btn = new SideButton(slice_panel, "", "sidebutton_dropdown", 0, 14);
2268 m_print_btn = new SideButton(print_panel, _L("Print plate"), "");
2269 m_print_option_btn = new SideButton(print_panel, "", "sidebutton_dropdown", 0, 14);
2270
2271 // Orca: restore the last used print/export action if the user opted to remember it
2272 PrintSelectType remembered_print_select;
2273 if (get_remembered_print_select(remembered_print_select)) {
2274 m_print_select = remembered_print_select;
2275 m_print_btn->SetLabel(print_select_type_label(remembered_print_select));
2276 fit_tab_labels(); // ORCA on label change
2277 }
2278
2279 auto slice_sizer = new wxBoxSizer(wxHORIZONTAL);
2280 slice_sizer->Add(m_slice_option_btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, FromDIP(1));
2281 slice_sizer->Add(m_slice_btn, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, FromDIP(1));
2282 slice_panel->SetSizer(slice_sizer);
2283
2284 auto print_sizer = new wxBoxSizer(wxHORIZONTAL);
2285 print_sizer->Add(m_print_option_btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, FromDIP(1));
2286 print_sizer->Add(m_print_btn, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, FromDIP(1));
2287 print_panel->SetSizer(print_sizer);
2288
2290 m_slice_option_btn->Enable();
2291 m_print_option_btn->Enable();
2292 //sizer->Add(FromDIP(15), 0, 0, 0, 0);
2293 sizer->Add(slice_panel);
2294 sizer->Add(FromDIP(15), 0, 0, 0, 0);
2295 sizer->Add(print_panel);
2296 sizer->Add(FromDIP(19), 0, 0, 0, 0);
2297
2298 sizer->Layout();
2299
2300 m_filament_group_popup = new FilamentGroupPopup(m_slice_btn);
2301
2302 auto try_hover_pop_up = [this]() {
2303#ifdef __APPLE__
2304 if (!IsActive()) {
2305 return;
2306 }
2307#endif
2308 wxPoint pos = m_slice_btn->ClientToScreen(wxPoint(0, 0));
2309 pos.y += m_slice_btn->GetRect().height * 1.25;
2310 pos.x -= (m_slice_option_btn->GetRect().width + FromDIP(380) * 0.6);
2311 auto curr_plate = this->m_plater->get_partplate_list().get_curr_plate();
2312 m_filament_group_popup->SetPosition(pos);
2313 m_filament_group_popup->tryPopup(m_plater, curr_plate, m_slice_select == eSliceAll);
2314 };
2315
2316#ifndef __linux__
2317// in linux plateform, the pop up will taker over the mouse event and make the slice button cannot handle click event
2318 // this pannel is used to trigger hover when button is disabled
2319 slice_panel->Bind(wxEVT_ENTER_WINDOW, [this,try_hover_pop_up](auto& event) {
2321 try_hover_pop_up();
2322 });
2323
2324 slice_panel->Bind(wxEVT_LEAVE_WINDOW, [this](auto& event) {
2325 m_filament_group_popup->tryClose();
2326 });
2327
2328 m_slice_btn->Bind(wxEVT_ENTER_WINDOW, [this, try_hover_pop_up](auto& event) {
2329 if (!m_slice_option_pop_up || !m_slice_option_pop_up->IsShown())
2330 try_hover_pop_up();
2331 });
2332
2333 m_slice_btn->Bind(wxEVT_LEAVE_WINDOW, [this](auto& event) {
2334 m_filament_group_popup->tryClose();
2335 });
2336#endif
2337
2338 m_slice_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent& event)
2339 {
2340
2341 //this->m_plater->select_view_3D("Preview");
2342 m_plater->exit_gizmo();
2343 m_plater->update(true, true);
2344
2345 bool slice = true;
2346
2347 auto curr_plate = m_plater->get_partplate_list().get_curr_plate();
2348 #ifdef __linux__
2349 PresetBundle* preset = wxGetApp().preset_bundle;
2350 bool force_show_fila_group_dlg = (preset && preset->is_bbl_vendor() && preset->get_printer_extruder_count() == 2);
2351 slice = try_pop_up_before_slice(m_slice_select == eSliceAll, m_plater, curr_plate, force_show_fila_group_dlg);
2352 #else
2353 slice = try_pop_up_before_slice(m_slice_select == eSliceAll, m_plater, curr_plate, false);
2354 #endif
2355
2356 if (slice) {
2358 wxPostEvent(m_plater, SimpleEvent(EVT_GLTOOLBAR_SLICE_ALL));
2359 else
2360 wxPostEvent(m_plater, SimpleEvent(EVT_GLTOOLBAR_SLICE_PLATE));
2361 this->m_tabpanel->SelectPageByName(TAB_ID_PREVIEW);
2362 }
2363 });
2364
2365 m_print_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent& event)
2366 {
2367 //this->m_plater->select_view_3D("Preview");
2369 {
2370 m_plater->apply_background_progress();
2371 // check valid of print
2373 m_print_btn->Enable(m_print_enable);
2374 if (m_print_enable) {
2376 wxPostEvent(m_plater, SimpleEvent(EVT_GLTOOLBAR_PRINT_ALL));
2378 wxPostEvent(m_plater, SimpleEvent(EVT_GLTOOLBAR_PRINT_PLATE));
2380 wxPostEvent(m_plater, SimpleEvent(EVT_GLTOOLBAR_PRINT_MULTI_MACHINE));
2381 }
2382 }
2383 else if (m_print_select == eExportGcode)
2384 wxPostEvent(m_plater, SimpleEvent(EVT_GLTOOLBAR_EXPORT_GCODE));
2385 else if (m_print_select == eSendGcode)
2386 wxPostEvent(m_plater, SimpleEvent(EVT_GLTOOLBAR_SEND_GCODE));
2387 else if (m_print_select == eUploadGcode)
2388 wxPostEvent(m_plater, SimpleEvent(EVT_GLTOOLBAR_UPLOAD_GCODE));
2390 wxPostEvent(m_plater, SimpleEvent(EVT_GLTOOLBAR_EXPORT_SLICED_FILE));
2392 wxPostEvent(m_plater, SimpleEvent(EVT_GLTOOLBAR_EXPORT_ALL_SLICED_FILE));
2393 else if (m_print_select == eSendToPrinter)
2394 wxPostEvent(m_plater, SimpleEvent(EVT_GLTOOLBAR_SEND_TO_PRINTER));
2396 wxPostEvent(m_plater, SimpleEvent(EVT_GLTOOLBAR_SEND_TO_PRINTER_ALL));
2397 /* else if (m_print_select == ePrintMultiMachine)
2398 wxPostEvent(m_plater, SimpleEvent(EVT_GLTOOLBAR_PRINT_MULTI_MACHINE));*/
2399 });
2400
2401 m_slice_option_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent& event)
2402 {
2404 delete m_slice_option_pop_up;
2405 m_slice_option_pop_up = new SidePopup(this);
2406 SideButton* slice_all_btn = new SideButton(m_slice_option_pop_up, _L("Slice all"), "");
2407 slice_all_btn->SetCornerRadius(0);
2408 SideButton* slice_plate_btn = new SideButton(m_slice_option_pop_up, _L("Slice plate"), "");
2409 slice_plate_btn->SetCornerRadius(0);
2410
2411 slice_all_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent&) {
2412 m_slice_btn->SetLabel(_L("Slice all"));
2415 m_slice_btn->Enable(m_slice_enable);
2416 this->Layout();
2417 fit_tab_labels(); // ORCA on label change
2419 m_slice_option_pop_up->Dismiss();
2420 });
2421
2422 slice_plate_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent&) {
2423 m_slice_btn->SetLabel(_L("Slice plate"));
2426 m_slice_btn->Enable(m_slice_enable);
2427 this->Layout();
2428 fit_tab_labels(); // ORCA on label change
2430 m_slice_option_pop_up->Dismiss();
2431 });
2432 m_slice_option_pop_up->append_button(slice_all_btn);
2433 m_slice_option_pop_up->append_button(slice_plate_btn);
2435 }
2436 );
2437
2438 m_print_option_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent& event)
2439 {
2440 SidePopup* p = new SidePopup(this);
2442 SideButton* btn = new SideButton(p, print_select_type_label(type), "");
2443 btn->SetCornerRadius(0);
2444 btn->Bind(wxEVT_BUTTON, [this, p, type](wxCommandEvent&) {
2445 select_print_action(type);
2446 p->Dismiss();
2447 });
2448 p->append_button(btn);
2449 }
2450 p->Popup(m_print_btn);
2451 }
2452 );
2453
2454 /*
2455 Button * aux_btn = new Button(this, _L("Auxiliary"));
2456 aux_btn->SetBackgroundColour(0x3B4446);
2457 aux_btn->Bind(wxEVT_BUTTON, [](auto e) {
2458 wxGetApp().sidebar().show_auxiliary_dialog();
2459 });
2460 sizer->Add(aux_btn, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, 1 * em / 10);
2461 */
2462 sizer->Add(FromDIP(19), 0, 0, 0, 0);
2463
2464 return sizer;
2465}
#define TAB_ID_PREVIEW
Definition MainFrame.hpp:61
void SetCornerRadius(double radius)
Definition SideButton.cpp:73
virtual void Popup(wxWindow *focus=NULL) wxOVERRIDE
Definition SideMenuPopup.cpp:51
void append_button(SideButton *btn)
Definition SideMenuPopup.cpp:124
int em_unit() const
Definition GUI_Utils.hpp:203
bool get_remembered_print_select(PrintSelectType &out) const
Definition MainFrame.cpp:2235
PrintSelectType
Definition MainFrame.hpp:345
bool m_slice_enable
Definition MainFrame.hpp:553
SideButton * m_print_btn
Definition MainFrame.hpp:547
std::vector< PrintSelectType > available_print_actions() const
Definition MainFrame.cpp:2171
bool get_enable_slice_status()
Definition MainFrame.cpp:2467
int m_slice_select
Definition MainFrame.hpp:543
bool get_enable_print_status()
Definition MainFrame.cpp:2518
SidePopup * m_slice_option_pop_up
Definition MainFrame.hpp:550
void select_print_action(PrintSelectType select_type)
Definition MainFrame.cpp:2216
void update_side_button_style()
Definition MainFrame.cpp:2608
int m_print_select
Definition MainFrame.hpp:542
bool m_print_enable
Definition MainFrame.hpp:554
FilamentGroupPopup * m_filament_group_popup
Definition MainFrame.hpp:552
SideButton * m_print_option_btn
Definition MainFrame.hpp:548
SideButton * m_slice_option_btn
Definition MainFrame.hpp:546
SideButton * m_slice_btn
Definition MainFrame.hpp:545
static wxColour darkModeColorFor(wxColour const &color)
Definition StateColor.cpp:219
wxString print_select_type_label(MainFrame::PrintSelectType type)
Definition MainFrame.cpp:2153
bool try_pop_up_before_slice(bool is_slice_all, Plater *plater_ref, PartPlate *partplate_ref, bool force_pop_up)
Try to pop up the filament map dialog before slicing.
Definition FilamentMapDialog.cpp:127

References _L, SidePopup::append_button(), available_print_actions(), StateColor::darkModeColorFor(), eExportAllSlicedFile, eExportGcode, eExportSlicedFile, Slic3r::GUI::DPIAware< wxFrame >::em_unit(), enable_multi_machine, ePrintAll, ePrintMultiMachine, ePrintPlate, eSendGcode, eSendToPrinter, eSendToPrinterAll, eSliceAll, eSlicePlate, eUploadGcode, fit_tab_labels(), get_enable_print_status(), get_enable_slice_status(), Slic3r::PresetBundle::get_printer_extruder_count(), get_remembered_print_select(), Slic3r::PresetBundle::is_bbl_vendor(), m_filament_group_popup, m_plater, m_print_btn, m_print_enable, m_print_option_btn, m_print_select, m_slice_btn, m_slice_enable, m_slice_option_btn, m_slice_option_pop_up, m_slice_select, m_tabpanel, SidePopup::Popup(), select_print_action(), SideButton::SetCornerRadius(), TAB_ID_PREVIEW, Slic3r::GUI::try_pop_up_before_slice(), and update_side_button_style().

Referenced by init_tabpanel().

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

◆ em_unit()

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

References m_em_unit.

Referenced by Slic3r::GUI::MainFrame::create_side_tools(), and Slic3r::GUI::MainFrame::update_side_button_style().

Here is the caller graph for this function:

◆ enable_force_rescale()

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

References m_force_rescale.

◆ export_config()

void Slic3r::GUI::MainFrame::export_config ( )
3952{
3953 ExportConfigsDialog export_configs_dlg(nullptr);
3954 export_configs_dlg.ShowModal();
3955 return;
3956
3957 // Generate a cummulative configuration for the selected print, filaments and printer.
3958 wxDirDialog dlg(this, _L("Choose a directory"),
3959 from_u8(!m_last_config.IsEmpty() ? get_dir_name(m_last_config) : wxGetApp().app_config->get_last_dir()), wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST);
3960 wxString path;
3961 if (dlg.ShowModal() == wxID_OK)
3962 path = dlg.GetPath();
3963 if (!path.IsEmpty()) {
3964 // Export the config bundle.
3965 wxGetApp().app_config->update_config_dir(into_u8(path));
3966 try {
3967 auto files = wxGetApp().preset_bundle->export_current_configs(into_u8(path), [this](std::string const & name) {
3968 ConfigsOverwriteConfirmDialog dlg(this, from_u8(name), true);
3969 int res = dlg.ShowModal();
3970 int ids[]{wxID_NO, wxID_YES, wxID_NOTOALL, wxID_YESTOALL};
3971 return std::find(ids, ids + 4, res) - ids;
3972 }, false);
3973 if (!files.empty())
3974 m_last_config = from_u8(files.back());
3975 MessageDialog dlg(this, wxString::Format(_L_PLURAL("There is %d config exported. (Only non-system configs)",
3976 "There are %d configs exported. (Only non-system configs)", files.size()), files.size()),
3977 _L("Export Result"), wxOK);
3978 dlg.ShowModal();
3979 } catch (const std::exception &ex) {
3980 show_error(this, ex.what());
3981 }
3982 }
3983}
wxString m_last_config
Definition MainFrame.hpp:196
std::string get_dir_name(const wxString &full_name) const
Definition MainFrame.cpp:4795
void show_error(wxWindow *parent, const wxString &message, bool has_code_excerpts)
Definition GUI.cpp:296
wxString from_u8(const std::string &str)
Definition GUI.cpp:544
#define _L_PLURAL(s, plural, n)
Definition I18N.hpp:96

References _L, _L_PLURAL, Slic3r::GUI::from_u8(), get_dir_name(), Slic3r::GUI::into_u8(), m_last_config, Slic3r::GUI::show_error(), and Slic3r::GUI::DPIAware< P >::ShowModal().

Referenced by init_menubar_as_editor().

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

◆ fit_tab_labels()

void Slic3r::GUI::MainFrame::fit_tab_labels ( )
1743{
1744 if (!m_tabpanel || !m_slice_option_btn) // ignore layout change while slice/print buttons not visible
1745 return;
1746
1747 auto* ctrl = m_tabpanel->GetBtnsListCtrl();
1748 auto* sizer = ctrl->GetBtnsSizer();
1749 int count = sizer->GetItemCount();
1750
1751 // Restore all
1752 for (size_t i = 1; i < count; ++i)
1753 ctrl->SetCompact(i, false);
1754 m_tabpanel->Refresh();
1755 Layout();
1756
1757 // Compact (last to first)
1758 for (size_t i = count - 1; i >= 1; --i) {
1759 int right = ScreenToClient(m_slice_option_btn->ClientToScreen({})).x;
1760 int left = sizer->GetSize().GetWidth();
1761 // The overflow button sits between the tab buttons and the side tools, so it is not free space.
1762 if (const wxWindow* overflow = ctrl->GetOverflowButton())
1763 left += overflow->GetSize().GetWidth();
1764 if (right - left - FromDIP(15) > 0) return;
1765 ctrl->SetCompact(i, true);
1766 m_tabpanel->Refresh();
1767 Layout();
1768 }
1769}
@ right
Definition MarchingSquares.hpp:190
@ left
Definition MarchingSquares.hpp:188

References count, m_slice_option_btn, and m_tabpanel.

Referenced by create_side_tools(), init_tabpanel(), on_dpi_changed(), select_print_action(), and show_device().

Here is the caller graph for this function:

◆ force_rescale()

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

References m_force_rescale.

◆ generate_help_menu()

wxMenu * Slic3r::GUI::MainFrame::generate_help_menu ( )
private
2850{
2851 wxMenu* helpMenu = new wxMenu();
2852
2853 // shortcut key
2854 append_shortcut_item(helpMenu, Shortcut::KeyboardShortcuts, false, _L("Keyboard Shortcuts"), _L("Show the list of keyboard shortcuts"),
2855 [](wxCommandEvent&) { wxGetApp().keyboard_shortcuts(ShortcutContext::Global); });
2856 // Show Beginner's Tutorial
2857 append_menu_item(helpMenu, wxID_ANY, _L("Setup Wizard"), _L("Setup Wizard"), [](wxCommandEvent &) {wxGetApp().ShowUserGuide();});
2858
2859 helpMenu->AppendSeparator();
2860
2861 // Open Config Folder
2862 append_menu_item(helpMenu, wxID_ANY, _L("Show Configuration Folder"), _L("Show Configuration Folder"),
2863 [](wxCommandEvent&) { Slic3r::GUI::desktop_open_datadir_folder(); });
2864
2865 append_menu_item(helpMenu, wxID_ANY, _L("Migrate Filament Presets"),
2866 _L("Bring back filament presets that a profile update removed from printers they were made for"),
2867 [](wxCommandEvent&) { wxGetApp().check_legacy_user_filament_presets(true); });
2868
2869 helpMenu->AppendSeparator();
2870
2871 // Troubleshoot center
2872 append_menu_item(helpMenu, wxID_ANY, _L("Troubleshoot Center"), "",
2873 [](wxCommandEvent&) { wxGetApp().troubleshoot(); });
2874
2875 append_menu_item(helpMenu, wxID_ANY, _L("Open Network Test"), _L("Open Network Test"), [](wxCommandEvent&) {
2876 NetworkTestDialog dlg(wxGetApp().mainframe);
2877 dlg.ShowModal();
2878 });
2879
2880 if (wxGetApp().is_editor())
2881 append_menu_item(helpMenu, wxID_ANY, _L("Benchmark 3D Scene"), _L("Measure how fast the 3D scene renders in Prepare and Preview"),
2882 [](wxCommandEvent&) { run_scene_benchmark(); });
2883
2884 helpMenu->AppendSeparator();
2885
2886 append_menu_item(helpMenu, wxID_ANY, _L("Show Tip of the Day"), _L("Show Tip of the Day"), [](wxCommandEvent&) {
2887 wxGetApp().plater()->get_dailytips()->open();
2888 wxGetApp().plater()->get_current_canvas3D()->set_as_dirty();
2889 });
2890
2891 // Report a bug
2892 //append_menu_item(helpMenu, wxID_ANY, _L("Report Bug(TODO)"), _L("Report a bug of OrcaSlicer"),
2893 // [](wxCommandEvent&) {
2894 // //TODO
2895 // });
2896 // Check New Version
2897 append_menu_item(helpMenu, wxID_ANY, _L("Check for Updates"), _L("Check for Updates"),
2898 [](wxCommandEvent&) {
2899 wxGetApp().check_new_version_sf(true, 1);
2900 }, "", nullptr, []() {
2901 return true;
2902 });
2903
2904 // About
2905#ifndef __APPLE__
2906 wxString about_title = wxString::Format(_L("&About %s"), SLIC3R_APP_FULL_NAME);
2907 append_menu_item(helpMenu, wxID_ANY, about_title, about_title,
2908 [](wxCommandEvent&) { Slic3r::GUI::about(); });
2909#endif
2910
2911 return helpMenu;
2912}
#define SLIC3R_APP_FULL_NAME
Definition libslic3r.h:11
void about()
Definition GUI.cpp:574
@ KeyboardShortcuts
Definition Shortcuts.hpp:51
void desktop_open_datadir_folder()
Definition GUI.cpp:580
void run_scene_benchmark()
Definition SceneBenchmark.cpp:547
@ Global
Definition Shortcuts.hpp:21

References _L, Slic3r::GUI::about(), append_menu_item(), append_shortcut_item(), Slic3r::GUI::desktop_open_datadir_folder(), Slic3r::GUI::Global, Slic3r::GUI::KeyboardShortcuts, Slic3r::GUI::run_scene_benchmark(), Slic3r::GUI::DPIAware< P >::ShowModal(), and SLIC3R_APP_FULL_NAME.

Referenced by init_menubar_as_editor(), and init_menubar_as_gcodeviewer().

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

◆ get_base_name()

std::string Slic3r::GUI::MainFrame::get_base_name ( const wxString & full_name,
const char * extension = nullptr ) const
private
4788{
4789 boost::filesystem::path filename = boost::filesystem::path(full_name.wx_str()).filename();
4790 if (extension != nullptr)
4791 filename = filename.replace_extension(extension);
4792 return filename.string();
4793}

◆ get_calibration_curr_tab()

int Slic3r::GUI::MainFrame::get_calibration_curr_tab ( )
4341 {
4342 if (CalibrationPanel* calibration = CalibrationPanel::if_built())
4343 return calibration->get_tabpanel()->GetSelection();
4344 return -1;
4345}

References Slic3r::GUI::LazyInstance< CalibrationPanel >::if_built().

Here is the call graph for this function:

◆ get_dir_name()

std::string Slic3r::GUI::MainFrame::get_dir_name ( const wxString & full_name) const
private
4796{
4797 return boost::filesystem::path(into_u8(full_name)).parent_path().string();
4798}

References Slic3r::GUI::into_u8().

Referenced by export_config(), and load_config_file().

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

◆ get_enable_print_status()

bool Slic3r::GUI::MainFrame::get_enable_print_status ( )
2519{
2520 bool enable = true;
2521
2522 PartPlateList &part_plate_list = m_plater->get_partplate_list();
2523 PartPlate *current_plate = part_plate_list.get_curr_plate();
2524 bool is_all_plates = wxGetApp().plater()->get_preview_canvas3D()->is_all_plates_selected();
2526 {
2527 if (!part_plate_list.is_all_slice_results_ready_for_print())
2528 {
2529 enable = false;
2530 }
2531 }
2532 else if (m_print_select == ePrintPlate)
2533 {
2534 if (!current_plate->is_slice_result_ready_for_print())
2535 {
2536 enable = false;
2537 }
2538 enable = enable && !is_all_plates;
2539 }
2540 else if (m_print_select == eExportGcode)
2541 {
2542 if (!current_plate->is_slice_result_valid())
2543 {
2544 enable = false;
2545 }
2546 enable = enable && !is_all_plates;
2547 }
2548 else if (m_print_select == eSendGcode)
2549 {
2550 if (!current_plate->is_slice_result_valid())
2551 enable = false;
2552 if (!can_send_gcode())
2553 enable = false;
2554 enable = enable && !is_all_plates;
2555 }
2556 else if (m_print_select == eUploadGcode)
2557 {
2558 if (!current_plate->is_slice_result_valid())
2559 enable = false;
2560 if (!can_send_gcode())
2561 enable = false;
2562 enable = enable && !is_all_plates;
2563 }
2565 {
2566 if (!current_plate->is_slice_result_ready_for_export())
2567 {
2568 enable = false;
2569 }
2570 enable = enable && !is_all_plates;
2571 }
2572 else if (m_print_select == eSendToPrinter)
2573 {
2574 if (!current_plate->is_slice_result_ready_for_print())
2575 {
2576 enable = false;
2577 }
2578 enable = enable && !is_all_plates;
2579 }
2581 {
2582 if (!part_plate_list.is_all_slice_results_ready_for_print())
2583 {
2584 enable = false;
2585 }
2586 }
2588 {
2589 if (!part_plate_list.is_all_slice_result_ready_for_export())
2590 {
2591 enable = false;
2592 }
2593 }
2595 {
2596 if (!current_plate->is_slice_result_ready_for_print())
2597 {
2598 enable = false;
2599 }
2600 enable = enable && !is_all_plates;
2601 }
2602
2603 BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": m_print_select %1%, enable= %2% ")%m_print_select %enable;
2604
2605 return enable;
2606}
bool can_send_gcode() const
Definition MainFrame.cpp:2045

References can_send_gcode(), eExportAllSlicedFile, eExportGcode, eExportSlicedFile, ePrintAll, ePrintMultiMachine, ePrintPlate, eSendGcode, eSendToPrinter, eSendToPrinterAll, eUploadGcode, Slic3r::GUI::PartPlateList::get_curr_plate(), Slic3r::GUI::PartPlateList::is_all_slice_result_ready_for_export(), Slic3r::GUI::PartPlateList::is_all_slice_results_ready_for_print(), Slic3r::GUI::PartPlate::is_slice_result_ready_for_export(), Slic3r::GUI::PartPlate::is_slice_result_ready_for_print(), Slic3r::GUI::PartPlate::is_slice_result_valid(), m_plater, and m_print_select.

Referenced by create_side_tools(), handle_global_shortcut(), select_print_action(), set_print_button_to_default(), and update_slice_print_status().

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

◆ get_enable_slice_status()

bool Slic3r::GUI::MainFrame::get_enable_slice_status ( )
2468{
2469 bool enable = true;
2470
2471 bool on_slicing = m_plater->is_background_process_slicing();
2472 if (on_slicing) {
2473 BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": on slicing, return false directly!");
2474 return false;
2475 }
2476 else if (m_plater->only_gcode_mode() || m_plater->using_exported_file()) {
2477 BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": in gcode/exported 3mf mode, return false directly!");
2478 return false;
2479 }
2480
2481 PartPlateList &part_plate_list = m_plater->get_partplate_list();
2482 PartPlate *current_plate = part_plate_list.get_curr_plate();
2483
2485 {
2486 /*if (part_plate_list.is_all_slice_results_valid())
2487 {
2488 enable = false;
2489 }
2490 else if (!part_plate_list.is_all_plates_ready_for_slice())
2491 {
2492 enable = false;
2493 }*/
2494 //always enable slice_all button
2495 enable = true;
2496 }
2497 else if (m_slice_select == eSlicePlate)
2498 {
2499 if (current_plate->is_slice_result_valid())
2500 {
2501 enable = false;
2502 }
2503 else if (!current_plate->can_slice())
2504 {
2505 enable = false;
2506 }
2507 }
2508
2509 // A mixed filament whose components were deleted, or whose components disagree in type,
2510 // cannot be resolved at slicing time. Block the slice until the user fixes it.
2511 if (enable && m_plater->sidebar().has_broken_mixed_filament())
2512 enable = false;
2513
2514 BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": m_slice_select %1%, enable= %2% ")%m_slice_select %enable;
2515 return enable;
2516}

References Slic3r::GUI::PartPlate::can_slice(), eSliceAll, eSlicePlate, Slic3r::GUI::PartPlateList::get_curr_plate(), Slic3r::GUI::PartPlate::is_slice_result_valid(), m_plater, and m_slice_select.

Referenced by create_side_tools(), and update_slice_print_status().

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

◆ get_recent_projects()

void Slic3r::GUI::MainFrame::get_recent_projects ( boost::property_tree::wptree & tree,
int images )
4506{
4507 for (size_t i = 0; i < m_recent_projects.GetCount(); ++i) {
4508 boost::property_tree::wptree item;
4509 std::wstring proj = m_recent_projects.GetHistoryFile(i).ToStdWstring();
4510 item.put(L"project_name", proj.substr(proj.find_last_of(L"/\\") + 1));
4511 item.put(L"path", proj);
4512 item.put(L"published", m_recent_projects.GetPublished(i) ? L"1" : L"0");
4513 boost::system::error_code ec;
4514 std::time_t t = boost::filesystem::last_write_time(proj, ec);
4515 if (!ec) {
4516 std::wstring time = wxDateTime(t).FormatISOCombined(' ').ToStdWstring();
4517 item.put(L"time", time);
4518 if (i <= images) {
4519 auto thumbnail = m_recent_projects.GetThumbnailUrl(i);
4520 if (!thumbnail.empty()) item.put(L"image", thumbnail);
4521 }
4522 } else {
4523 item.put(L"time", _L("File is missing"));
4524 }
4525 tree.push_back({L"", item});
4526 }
4527}
#define L(s)
Definition ExtrusionEntity.cpp:25

References _L, L, and m_recent_projects.

◆ get_remembered_print_select()

bool Slic3r::GUI::MainFrame::get_remembered_print_select ( PrintSelectType & out) const
2236{
2237 if (!wxGetApp().app_config->get_bool("remember_print_action"))
2238 return false;
2239 const std::string saved = wxGetApp().app_config->get("last_print_action");
2240 if (saved.empty())
2241 return false;
2242 // Orca: only restore an action the current printer actually offers in the dropdown
2244 if (saved == print_select_type_key(type)) {
2245 out = type;
2246 return true;
2247 }
2248 }
2249 return false;
2250}
const char * print_select_type_key(MainFrame::PrintSelectType type)
Definition MainFrame.cpp:2135

References available_print_actions().

Referenced by create_side_tools(), and set_print_button_to_default().

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

◆ handle_global_shortcut()

bool Slic3r::GUI::MainFrame::handle_global_shortcut ( const KeyChord & chord)
private
834{
835 // CHAR_HOOK runs before the focused window, so leave text-editing keys to a focused text field and
836 // the keys ImGui owns to the focused canvas.
837 wxWindow* const focus = wxWindow::FindFocus();
838 if (chord.edits_text() && focus_is_text_field(focus))
839 return false;
840 if (const ImGuiWrapper* imgui = focused_canvas_imgui(focus); imgui != nullptr && imgui->owns_key(chord))
841 return false;
842
843 const std::optional<Shortcut> shortcut = wxGetApp().shortcuts().lookup(ShortcutContext::Global, chord);
844 if (!shortcut.has_value())
845 return false;
846
847 switch (*shortcut) {
849 if (m_slice_enable) {
850 wxGetApp().plater()->update(true, true);
851 wxPostEvent(m_plater, SimpleEvent(EVT_GLTOOLBAR_SLICE_PLATE));
852 m_tabpanel->SelectPageByName(TAB_ID_PREVIEW);
853 }
854 break;
856 m_plater->apply_background_progress();
859 if (m_print_enable) {
860 if (wxGetApp().preset_bundle->use_bbl_network() || wxGetApp().app_config->get_bool("use_printer_agents"))
861 wxPostEvent(m_plater, SimpleEvent(EVT_GLTOOLBAR_PRINT_PLATE));
862 else
863 wxPostEvent(m_plater, SimpleEvent(EVT_GLTOOLBAR_SEND_GCODE));
864 }
865 return false;
867 if (can_export_gcode())
868 wxPostEvent(m_plater, SimpleEvent(EVT_GLTOOLBAR_EXPORT_SLICED_FILE));
869 return false;
872 if (!wxGetApp().app_config->get_bool("enable_speed_dial") || (chord == KeyChord{ WXK_SPACE } && focus_keeps_space(wxWindow::FindFocus())))
873 return false;
874 // Deferred out of the native key-event stack: open_speed_dial() may create a WebView and run script.
875 CallAfter([] { wxGetApp().open_speed_dial(); });
876 break;
877 case Shortcut::NewProject: m_plater->new_project(); break;
878 case Shortcut::OpenProject: m_plater->load_project(); break;
880 if (can_save_as())
881 m_plater->save_project(true);
882 break;
884 if (can_save())
885 m_plater->save_project();
886 break;
887 case Shortcut::Search:
889 m_plater->sidebar().can_search();
890 return false;
892 // Orca: Use GUI_App::open_preferences instead of direct call so windows associations are updated on exit
893 wxGetApp().open_preferences();
895 break;
897 if (can_add_models() && m_plater)
898 m_plater->add_file();
899 break;
901 if (can_export_model())
903 break;
904 case Shortcut::Quit:
905 Close(false);
906 break;
908 if (m_plater && m_plater->is_view3D_shown()) {
909 m_plater->show_view3D_labels(!m_plater->are_view3D_labels_shown());
910 m_plater->get_current_canvas3D()->post_event(SimpleEvent(wxEVT_PAINT));
911 }
912 break;
914 if (m_plater && m_plater->is_view3D_shown() && m_plater->printer_technology() == ptFFF)
915 m_plater->show_collision_volumes(!m_plater->are_collision_volumes_shown());
916 break;
918 if (m_plater) {
919 select_view("plate");
920 m_plater->get_current_canvas3D()->zoom_to_bed();
921 }
922 break;
923 case Shortcut::ViewTop: select_view("top"); break;
924 case Shortcut::ViewBottom: select_view("bottom"); break;
925 case Shortcut::ViewFront: select_view("front"); break;
926 case Shortcut::ViewRear: select_view("rear"); break;
927 case Shortcut::ViewLeft: select_view("left"); break;
928 case Shortcut::ViewRight: select_view("right"); break;
930 if (m_plater)
931 m_plater->get_current_canvas3D()->select_plate();
932 break;
933 default: return false;
934 }
935 return true;
936}
void force_set_focus()
Definition GLCanvas3D.cpp:5541
bool owns_key(const KeyChord &chord) const
Definition ImGuiWrapper.cpp:2190
bool can_export_model() const
Definition MainFrame.cpp:1973
bool is_prepare_or_preview_tab() const
Definition MainFrame.cpp:1736
bool can_export_gcode() const
Definition MainFrame.cpp:2001
bool can_save_as() const
Definition MainFrame.cpp:1931
void publish_project()
Definition MainFrame.cpp:1952
bool can_save() const
Definition MainFrame.cpp:1924
bool can_add_models() const
Definition MainFrame.cpp:1919
bool focus_keeps_space(wxWindow *focus)
Definition MainFrame.cpp:211
bool focus_is_text_field(wxWindow *focus)
Definition MainFrame.cpp:190
const ImGuiWrapper * focused_canvas_imgui(wxWindow *focus)
Definition MainFrame.cpp:200
@ Quit
Definition Shortcuts.hpp:51
@ Search
Definition Shortcuts.hpp:51
@ ViewPlate
Definition Shortcuts.hpp:47
@ ShowLabels
Definition Shortcuts.hpp:49
@ ImportModel
Definition Shortcuts.hpp:27
@ ExportSlicedFile
Definition Shortcuts.hpp:29
@ PrintPlate
Definition Shortcuts.hpp:29
@ SlicePlate
Definition Shortcuts.hpp:29
@ OpenProject
Definition Shortcuts.hpp:27
@ SpeedDial
Definition Shortcuts.hpp:53
@ Publish3mf
Definition Shortcuts.hpp:27
@ ShowCollisionVolumes
Definition Shortcuts.hpp:49
@ SaveProject
Definition Shortcuts.hpp:27
@ Preferences
Definition Shortcuts.hpp:51
@ SaveProjectAs
Definition Shortcuts.hpp:27
@ PrintHostQueue
Definition Shortcuts.hpp:29
@ NewProject
Definition Shortcuts.hpp:27

References can_add_models(), can_export_gcode(), can_export_model(), can_save(), can_save_as(), Slic3r::GUI::KeyChord::edits_text(), Slic3r::GUI::ExportSlicedFile, Slic3r::GUI::GLCanvas3D::force_set_focus(), Slic3r::GUI::Plater::get_current_canvas3D(), get_enable_print_status(), Slic3r::GUI::Global, Slic3r::GUI::ImportModel, is_prepare_or_preview_tab(), m_plater, m_print_btn, m_print_enable, m_printhost_queue_dlg, m_slice_enable, m_tabpanel, Slic3r::GUI::NewProject, Slic3r::GUI::OpenProject, Slic3r::GUI::ImGuiWrapper::owns_key(), plater(), Slic3r::GUI::Preferences, Slic3r::GUI::PrintHostQueue, Slic3r::GUI::PrintPlate, Slic3r::ptFFF, Slic3r::GUI::Publish3mf, publish_project(), Slic3r::GUI::Quit, Slic3r::GUI::SaveProject, Slic3r::GUI::SaveProjectAs, Slic3r::GUI::Search, select_view(), Slic3r::GUI::ShowCollisionVolumes, Slic3r::GUI::ShowLabels, Slic3r::GUI::SlicePlate, Slic3r::GUI::SpeedDial, TAB_ID_PREVIEW, Slic3r::GUI::ViewBottom, Slic3r::GUI::ViewDefault, Slic3r::GUI::ViewFront, Slic3r::GUI::ViewLeft, Slic3r::GUI::ViewPlate, Slic3r::GUI::ViewRear, Slic3r::GUI::ViewRight, and Slic3r::GUI::ViewTop.

Here is the call graph for this function:

◆ init_menubar_as_editor()

void Slic3r::GUI::MainFrame::init_menubar_as_editor ( )
2970{
2971#ifdef __APPLE__
2972 m_menubar = new wxMenuBar();
2973#endif
2974
2975 // File menu
2976 wxMenu* fileMenu = new wxMenu;
2977 {
2978#ifdef __APPLE__
2979 // New Window
2980 append_menu_item(fileMenu, wxID_ANY, _L("New Window"), _L("Start a new window"),
2981 [](wxCommandEvent&) { start_new_slicer(); }, "", nullptr,
2982 [this] { return m_plater != nullptr && wxGetApp().app_config->get("app", "single_instance") == "false"; }, this);
2983#endif
2984 // New Project
2985 append_shortcut_item(fileMenu, Shortcut::NewProject, true, _L("New Project"), _L("Start a new project"),
2986 [this](wxCommandEvent&) { if (m_plater) m_plater->new_project(); }, "", nullptr,
2987 [this](){return can_start_new_project(); }, this);
2988 // Open Project
2989
2990#ifndef __APPLE__
2991 append_shortcut_item(fileMenu, Shortcut::OpenProject, true, _L("Open Project") + dots, _L("Open a project file"),
2992 [this](wxCommandEvent&) { if (m_plater) m_plater->load_project(); }, "menu_open", nullptr,
2993 [this](){return can_open_project(); }, this);
2994#else
2995 append_shortcut_item(fileMenu, Shortcut::OpenProject, true, _L("Open Project") + dots, _L("Open a project file"),
2996 [this](wxCommandEvent&) { if (m_plater) m_plater->load_project(); }, "", nullptr,
2997 [this](){return can_open_project(); }, this);
2998#endif
2999
3000 // Recent Project
3001 wxMenu* recent_projects_menu = new wxMenu();
3002 wxMenuItem* recent_projects_submenu = append_submenu(fileMenu, recent_projects_menu, wxID_ANY, _L("Recent files"), "");
3003 m_recent_projects.UseMenu(recent_projects_menu);
3004 Bind(wxEVT_MENU, [this](wxCommandEvent& evt) {
3005 size_t file_id = evt.GetId() - wxID_FILE1;
3006 wxString filename = m_recent_projects.GetHistoryFile(file_id);
3007 open_recent_project(file_id, filename);
3008 }, wxID_FILE1, wxID_FILE1 + 49); // [5050, 5100)
3009
3010 std::vector<std::string> recent_projects = wxGetApp().app_config->get_recent_projects();
3011 std::reverse(recent_projects.begin(), recent_projects.end());
3012 for (const std::string& project : recent_projects)
3013 {
3014 m_recent_projects.AddFileToHistory(from_u8(project));
3015 }
3016 m_recent_projects.LoadThumbnails();
3017
3018 Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_open_project() && (m_recent_projects.GetCount() > 0)); }, recent_projects_submenu->GetId());
3019
3020 // BBS: close save project
3021#ifndef __APPLE__
3022 append_shortcut_item(fileMenu, Shortcut::SaveProject, true, _L("Save Project"), _L("Save current project to file"),
3023 [this](wxCommandEvent&) { if (m_plater) m_plater->save_project(); }, "menu_save", nullptr,
3024 [this](){return m_plater != nullptr && can_save(); }, this);
3025#else
3026 append_shortcut_item(fileMenu, Shortcut::SaveProject, true, _L("Save Project"), _L("Save current project to file"),
3027 [this](wxCommandEvent&) { if (m_plater) m_plater->save_project(); }, "", nullptr,
3028 [this](){return m_plater != nullptr && can_save(); }, this);
3029#endif
3030
3031#ifndef __APPLE__
3032 append_shortcut_item(fileMenu, Shortcut::SaveProjectAs, true, _L("Save Project as") + dots, _L("Save current project as"),
3033 [this](wxCommandEvent&) { if (m_plater) m_plater->save_project(true); }, "menu_save", nullptr,
3034 [this](){return m_plater != nullptr && can_save_as(); }, this);
3035#else
3036 append_shortcut_item(fileMenu, Shortcut::SaveProjectAs, true, _L("Save Project as") + dots, _L("Save current project as"),
3037 [this](wxCommandEvent&) { if (m_plater) m_plater->save_project(true); }, "", nullptr,
3038 [this](){return m_plater != nullptr && can_save_as(); }, this);
3039#endif
3040
3041 // BBS: publish
3042 fileMenu->AppendSeparator();
3043 auto publish_handler = [this](wxCommandEvent&) { publish_project(); };
3044
3045#ifndef __APPLE__
3046 append_shortcut_item(fileMenu, Shortcut::Publish3mf, true, _L("Publish 3MF") + dots, _L("Export a 3MF file with the selected settings embedded"),
3047 publish_handler, "menu_publish", nullptr,
3048 [this](){return can_export_model(); }, this);
3049#else
3050 append_shortcut_item(fileMenu, Shortcut::Publish3mf, true, _L("Publish 3MF") + dots, _L("Export a 3MF file with the selected settings embedded"),
3051 publish_handler, "", nullptr,
3052 [this](){return can_export_model(); }, this);
3053#endif
3054
3055
3056 fileMenu->AppendSeparator();
3057
3058 // BBS
3059 wxMenu *import_menu = new wxMenu();
3060#ifndef __APPLE__
3061 append_shortcut_item(import_menu, Shortcut::ImportModel, true, _L("Import 3MF/STL/STEP/SVG/OBJ/AMF") + dots, _L("Load a model"),
3062 [this](wxCommandEvent&) { if (m_plater) {
3063 m_plater->add_file();
3064 } }, "menu_import", nullptr,
3065 [this](){return can_add_models(); }, this);
3066#else
3067 append_shortcut_item(import_menu, Shortcut::ImportModel, true, _L("Import 3MF/STL/STEP/SVG/OBJ/AMF") + dots, _L("Load a model"),
3068 [this](wxCommandEvent&) { if (m_plater) { m_plater->add_model(); } }, "", nullptr,
3069 [this](){return can_add_models(); }, this);
3070#endif
3071 append_menu_item(import_menu, wxID_ANY, _L("Import ZIP Archive") + dots, _L("Load models contained within a ZIP archive"),
3072 [this](wxCommandEvent&) { if (m_plater) m_plater->import_zip_archive(); }, "menu_import", nullptr,
3073 [this]() { return can_add_models(); });
3074 append_menu_item(import_menu, wxID_ANY, _L("Import Configs") + dots /*+ "\t" + ctrl + "I"*/, _L("Load configs"),
3075 [this](wxCommandEvent&) { load_config_file(); }, "menu_import", nullptr,
3076 [](){return true; }, this);
3077
3078 append_submenu(fileMenu, import_menu, wxID_ANY, _L("Import"), "");
3079
3080
3081 wxMenu* export_menu = new wxMenu();
3082 // BBS export as STL
3083 append_menu_item(export_menu, wxID_ANY, _L("Export all objects as one STL") + dots, _L("Export all objects as one STL"),
3084 [this](wxCommandEvent&) { if (m_plater) m_plater->export_stl(); }, "menu_export_stl", nullptr,
3085 [this](){return can_export_model(); }, this);
3086 append_menu_item(export_menu, wxID_ANY, _L("Export all objects as STLs") + dots, _L("Export all objects as STLs"),
3087 [this](wxCommandEvent&) { if (m_plater) m_plater->export_stl(false, false, true); }, "menu_export_stl", nullptr,
3088 [this](){return can_export_model(); }, this);
3089 append_menu_item(export_menu, wxID_ANY, _L("Export all objects as one DRC") + dots, _L("Export all objects as one DRC"),
3090 [this](wxCommandEvent&) { if (m_plater) m_plater->export_stl(false, false, false, FT_DRC); }, "menu_export_stl", nullptr,
3091 [this](){return can_export_model(); }, this);
3092 append_menu_item(export_menu, wxID_ANY, _L("Export all objects as DRCs") + dots, _L("Export all objects as DRCs"),
3093 [this](wxCommandEvent&) { if (m_plater) m_plater->export_stl(false, false, true, FT_DRC); }, "menu_export_stl", nullptr,
3094 [this](){return can_export_model(); }, this);
3095 append_menu_item(export_menu, wxID_ANY, _L("Export Generic 3MF") + dots/* + "\t" + ctrl + "G"*/, _L("Export 3MF file without using some 3mf-extensions"),
3096 [this](wxCommandEvent&) { if (m_plater) m_plater->export_core_3mf(); }, "menu_export_sliced_file", nullptr,
3097 [this](){return can_export_model(); }, this);
3098 // BBS export .gcode.3mf
3099 append_shortcut_item(export_menu, Shortcut::ExportSlicedFile, true, _L("Export plate sliced file") + dots, _L("Export current sliced file"),
3100 [this](wxCommandEvent&) { if (m_plater) wxPostEvent(m_plater, SimpleEvent(EVT_GLTOOLBAR_EXPORT_SLICED_FILE)); }, "menu_export_sliced_file", nullptr,
3101 [this](){return can_export_gcode(); }, this);
3102
3103 append_menu_item(export_menu, wxID_ANY, _L("Export all plate sliced file") + dots/* + "\t" + ctrl + "G"*/, _L("Export all plate sliced file"),
3104 [this](wxCommandEvent&) { if (m_plater) wxPostEvent(m_plater, SimpleEvent(EVT_GLTOOLBAR_EXPORT_ALL_SLICED_FILE)); }, "menu_export_sliced_file", nullptr,
3105 [this]() {return can_export_all_gcode(); }, this);
3106
3107 append_menu_item(export_menu, wxID_ANY, _L("Export G-code") + dots/* + "\t" + ctrl + "G"*/, _L("Export current plate as G-code"),
3108 [this](wxCommandEvent&) { if (m_plater) m_plater->export_gcode(false); }, "menu_export_gcode", nullptr,
3109 [this]() {return can_export_gcode(); }, this);
3110
3111 append_menu_item(export_menu, wxID_ANY, _L("Export toolpaths as OBJ") + dots, _L("Export toolpaths as OBJ"),
3112 [this](wxCommandEvent&) { if (m_plater != nullptr) m_plater->export_toolpaths_to_obj(); }, "menu_export_toolpaths", nullptr,
3113 [this]() {return can_export_toolpaths(); }, this);
3114
3116 export_menu, wxID_ANY, _L("Export Preset Bundle") + dots /* + "\t" + ctrl + "E"*/, _L("Export current configuration to files"),
3117 [this](wxCommandEvent &) { export_config(); },
3118 "menu_export_config", nullptr,
3119 []() { return true; }, this);
3120
3121 append_submenu(fileMenu, export_menu, wxID_ANY, _L("Export"), "");
3122
3123 fileMenu->AppendSeparator();
3124
3125#ifndef __APPLE__
3126 append_shortcut_item(fileMenu, Shortcut::Quit, false, _L("Quit"), wxString::Format(_L("Quit")),
3127 [this](wxCommandEvent&) { Close(false); }, "menu_exit", nullptr);
3128#else
3129 append_menu_item(fileMenu, wxID_EXIT, _L("Quit"), wxString::Format(_L("Quit")),
3130 [this](wxCommandEvent&) { Close(false); }, "", nullptr);
3131#endif
3132 }
3133
3134 // Edit menu
3135 wxMenu* editMenu = nullptr;
3136 if (m_plater != nullptr)
3137 {
3138 editMenu = new wxMenu();
3139
3140 // Feeds the key to ImGui instead when ImGui has the focused canvas's keyboard, since the menu
3141 // handles its key equivalents before the canvas receives the key.
3142 auto handle_key_event = [](wxKeyEvent& evt) {
3143 const ImGuiWrapper* imgui = focused_canvas_imgui(wxWindow::FindFocus());
3144 if (imgui == nullptr || !imgui->owns_keyboard())
3145 return false;
3146 wxGetApp().imgui()->update_key_data(evt);
3147 wxGetApp().plater()->get_current_canvas3D()->render();
3148 return true;
3149 };
3150#ifndef __APPLE__
3151 // BBS undo
3152 append_shortcut_item(editMenu, Shortcut::Undo, true, _L("Undo"),
3153 _L("Undo"), [this](wxCommandEvent&) {
3154#ifdef SLIC3R_CAD
3155 if (DesignPanel* dp = shown_design_panel()) { dp->menu_undo_redo(false); return; }
3156#endif
3157 m_plater->undo(); },
3158 "menu_undo", nullptr, [this](){
3159#ifdef SLIC3R_CAD
3160 if (DesignPanel* dp = shown_design_panel()) return dp->menu_can_undo_redo(false);
3161#endif
3162 return m_plater->can_undo(); }, this);
3163 // BBS redo
3164 append_shortcut_item(editMenu, Shortcut::Redo, true, _L("Redo"),
3165 _L("Redo"), [this](wxCommandEvent&) {
3166#ifdef SLIC3R_CAD
3167 if (DesignPanel* dp = shown_design_panel()) { dp->menu_undo_redo(true); return; }
3168#endif
3169 m_plater->redo(); },
3170 "menu_redo", nullptr, [this](){
3171#ifdef SLIC3R_CAD
3172 if (DesignPanel* dp = shown_design_panel()) return dp->menu_can_undo_redo(true);
3173#endif
3174 return m_plater->can_redo(); }, this);
3175 editMenu->AppendSeparator();
3176 // BBS Cut TODO
3177 append_shortcut_item(editMenu, Shortcut::Cut, true, _L("Cut"),
3178 _L("Cut selection to clipboard"), [this](wxCommandEvent&) {m_plater->cut_selection_to_clipboard(); },
3179 "menu_cut", nullptr, [this]() {return m_plater->can_copy_to_clipboard(); }, this);
3180 // BBS Copy
3181 append_shortcut_item(editMenu, Shortcut::Copy, true, _L("Copy"),
3182 _L("Copy selection to clipboard"), [this](wxCommandEvent&) { m_plater->copy_selection_to_clipboard(); },
3183 "menu_copy", nullptr, [this](){return m_plater->can_copy_to_clipboard(); }, this);
3184 // BBS Paste
3185 append_shortcut_item(editMenu, Shortcut::Paste, true, _L("Paste"),
3186 _L("Paste clipboard"), [this](wxCommandEvent&) { m_plater->paste_from_clipboard(); },
3187 "menu_paste", nullptr, [this](){return m_plater->can_paste_from_clipboard(); }, this);
3188 // BBS Delete selected
3189 append_shortcut_item(editMenu, Shortcut::DeleteSelected, true, _L("Delete Selected"),
3190 _L("Deletes the current selection"),[this](wxCommandEvent&) { m_plater->remove_selected(); },
3191 "menu_remove", nullptr, [this](){return can_delete(); }, this);
3192 //BBS: delete all
3193 append_shortcut_item(editMenu, Shortcut::DeleteAll, true, _L("Delete All"),
3194 _L("Deletes all objects"),[this](wxCommandEvent&) { m_plater->delete_all_objects_from_model(); },
3195 "menu_remove", nullptr, [this](){return can_delete_all(); }, this);
3196 editMenu->AppendSeparator();
3197 // BBS Clone Selected
3198 append_shortcut_item(editMenu, Shortcut::CloneSelected, true, _L("Clone Selected"),
3199 _L("Clone copies of selections"),[this](wxCommandEvent&) {
3200 m_plater->clone_selection();
3201 },
3202 "menu_remove", nullptr, [this](){return can_clone(); }, this);
3203 editMenu->AppendSeparator();
3204 append_menu_item(editMenu, wxID_ANY, _L("Duplicate Current Plate"),
3205 _L("Duplicate the current plate"),[this](wxCommandEvent&) {
3206 m_plater->duplicate_plate();
3207 },
3208 "menu_remove", nullptr, [](){return true;}, this);
3209 editMenu->AppendSeparator();
3210#else
3211 // BBS undo
3212 append_shortcut_item(editMenu, Shortcut::Undo, false, _L("Undo"),
3213 _L("Undo"), [this, handle_key_event](wxCommandEvent&) {
3214 wxKeyEvent e;
3215 e.SetEventType(wxEVT_KEY_DOWN);
3216 e.SetControlDown(true);
3217 e.m_keyCode = 'Z';
3218 if (handle_key_event(e)) {
3219 return;
3220 }
3221#ifdef SLIC3R_CAD
3222 if (DesignPanel* dp = shown_design_panel()) { dp->menu_undo_redo(false); return; }
3223#endif
3224 m_plater->undo(); },
3225 "", nullptr, [this](){
3226#ifdef SLIC3R_CAD
3227 if (DesignPanel* dp = shown_design_panel()) return dp->menu_can_undo_redo(false);
3228#endif
3229 return m_plater->can_undo(); }, this);
3230 // BBS redo
3231 append_shortcut_item(editMenu, Shortcut::Redo, false, _L("Redo"),
3232 _L("Redo"), [this, handle_key_event](wxCommandEvent&) {
3233 wxKeyEvent e;
3234 e.SetEventType(wxEVT_KEY_DOWN);
3235 e.SetControlDown(true);
3236 e.m_keyCode = 'Y';
3237 if (handle_key_event(e)) {
3238 return;
3239 }
3240#ifdef SLIC3R_CAD
3241 if (DesignPanel* dp = shown_design_panel()) { dp->menu_undo_redo(true); return; }
3242#endif
3243 m_plater->redo(); },
3244 "", nullptr, [this](){
3245#ifdef SLIC3R_CAD
3246 if (DesignPanel* dp = shown_design_panel()) return dp->menu_can_undo_redo(true);
3247#endif
3248 return m_plater->can_redo(); }, this);
3249 editMenu->AppendSeparator();
3250 // BBS Cut TODO
3251 append_shortcut_item(editMenu, Shortcut::Cut, false, _L("Cut"),
3252 _L("Cut selection to clipboard"), [this, handle_key_event](wxCommandEvent&) {
3253 wxKeyEvent e;
3254 e.SetEventType(wxEVT_KEY_DOWN);
3255 e.SetControlDown(true);
3256 e.m_keyCode = 'X';
3257 if (handle_key_event(e)) {
3258 return;
3259 }
3260 m_plater->cut_selection_to_clipboard(); },
3261 "", nullptr, [this]() {return m_plater->can_copy_to_clipboard(); }, this);
3262 // BBS Copy
3263 append_shortcut_item(editMenu, Shortcut::Copy, false, _L("Copy"),
3264 _L("Copy selection to clipboard"), [this, handle_key_event](wxCommandEvent&) {
3265 wxKeyEvent e;
3266 e.SetEventType(wxEVT_KEY_DOWN);
3267 e.SetControlDown(true);
3268 e.m_keyCode = 'C';
3269 if (handle_key_event(e)) {
3270 return;
3271 }
3272 m_plater->copy_selection_to_clipboard(); },
3273 "", nullptr, [this](){return m_plater->can_copy_to_clipboard(); }, this);
3274 // BBS Paste
3275 append_shortcut_item(editMenu, Shortcut::Paste, false, _L("Paste"),
3276 _L("Paste clipboard"), [this, handle_key_event](wxCommandEvent&) {
3277 wxKeyEvent e;
3278 e.SetEventType(wxEVT_KEY_DOWN);
3279 e.SetControlDown(true);
3280 e.m_keyCode = 'V';
3281 if (handle_key_event(e)) {
3282 return;
3283 }
3284 m_plater->paste_from_clipboard(); },
3285 "", nullptr, [this](){return m_plater->can_paste_from_clipboard(); }, this);
3286#if 0
3287 // BBS Delete selected
3288 append_shortcut_item(editMenu, Shortcut::DeleteSelected, true, _L("Delete Selected"),
3289 _L("Deletes the current selection"),[this](wxCommandEvent&) {
3290 m_plater->remove_selected();
3291 },
3292 "", nullptr, [this](){return can_delete(); }, this);
3293#endif
3294 //BBS: delete all
3295 append_shortcut_item(editMenu, Shortcut::DeleteAll, true, _L("Delete All"),
3296 _L("Deletes all objects"),[this, handle_key_event](wxCommandEvent&) {
3297 wxKeyEvent e;
3298 e.SetEventType(wxEVT_KEY_DOWN);
3299 e.SetControlDown(true);
3300 e.m_keyCode = 'D';
3301 if (handle_key_event(e)) {
3302 return;
3303 }
3304 m_plater->delete_all_objects_from_model(); },
3305 "", nullptr, [this](){return can_delete_all(); }, this);
3306 editMenu->AppendSeparator();
3307 // BBS Clone Selected
3308 append_shortcut_item(editMenu, Shortcut::CloneSelected, true, _L("Clone Selected"),
3309 _L("Clone copies of selections"),[this, handle_key_event](wxCommandEvent&) {
3310 wxKeyEvent e;
3311 e.SetEventType(wxEVT_KEY_DOWN);
3312 e.SetControlDown(true);
3313 e.m_keyCode = 'M';
3314 if (handle_key_event(e)) {
3315 return;
3316 }
3317 m_plater->clone_selection();
3318 },
3319 "", nullptr, [this](){return can_clone(); }, this);
3320 editMenu->AppendSeparator();
3321 append_menu_item(editMenu, wxID_ANY, _L("Duplicate Current Plate"),
3322 _L("Duplicate the current plate"),[this](wxCommandEvent&) {
3323 m_plater->duplicate_plate();
3324 },
3325 "", nullptr, [](){return true;}, this);
3326 editMenu->AppendSeparator();
3327
3328#endif
3329
3330 // BBS Select All
3331 append_shortcut_item(editMenu, Shortcut::SelectAll, false, _L("Select All"),
3332 _L("Selects all objects"), [this, handle_key_event](wxCommandEvent&) {
3333 wxKeyEvent e;
3334 e.SetEventType(wxEVT_KEY_DOWN);
3335 e.SetControlDown(true);
3336 e.m_keyCode = 'A';
3337 if (handle_key_event(e)) {
3338 return;
3339 }
3340 m_plater->select_all(); },
3341 "", nullptr, [this](){return can_select(); }, this);
3342 // BBS Deslect All
3343 append_menu_item(editMenu, wxID_ANY, _L("Deselect All") + sep + _L_CONTEXT("Esc", "Keyboard Shortcut"),
3344 _L("Deselects all objects"), [this, handle_key_event](wxCommandEvent&) {
3345 wxKeyEvent e;
3346 e.SetEventType(wxEVT_KEY_DOWN);
3347 e.m_keyCode = WXK_ESCAPE;
3348 if (handle_key_event(e)) {
3349 return;
3350 }
3351 m_plater->deselect_all(); },
3352 "", nullptr, [this](){return can_deselect(); }, this);
3353 //editMenu->AppendSeparator();
3354 //append_menu_check_item(editMenu, wxID_ANY, _L("Show Model Mesh(TODO)"),
3355 // _L("Display triangles of models."), [this](wxCommandEvent& evt) {
3356 // wxGetApp().app_config->set_bool("show_model_mesh", evt.GetInt() == 1);
3357 // }, nullptr, [this]() {return can_select(); }, [this]() { return wxGetApp().app_config->get("show_model_mesh").compare("true") == 0; }, this);
3358 //append_menu_check_item(editMenu, wxID_ANY, _L("Show Model Shadow(TODO)"), _L("Display shadow of objects."),
3359 // [this](wxCommandEvent& evt) {
3360 // wxGetApp().app_config->set_bool("show_model_shadow", evt.GetInt() == 1);
3361 // }, nullptr, [this]() {return can_select(); }, [this]() { return wxGetApp().app_config->get("show_model_shadow").compare("true") == 0; }, this);
3362 //editMenu->AppendSeparator();
3363 //append_menu_check_item(editMenu, wxID_ANY, _L("Show Printable Box(TODO)"), _L("Display printable box."),
3364 // [this](wxCommandEvent& evt) {
3365 // wxGetApp().app_config->set_bool("show_printable_box", evt.GetInt() == 1);
3366 // }, nullptr, [this]() {return can_select(); }, [this]() { return wxGetApp().app_config->get("show_printable_box").compare("true") == 0; }, this);
3367 }
3368
3369 // BBS
3370
3371 //publish menu
3372
3373 /*if (m_plater) {
3374 publishMenu = new wxMenu();
3375 add_common_publish_menu_items(publishMenu, this);
3376 publishMenu->AppendSeparator();
3377 }*/
3378
3379 // View menu
3380 wxMenu* viewMenu = nullptr;
3381 if (m_plater) {
3382 viewMenu = new wxMenu();
3383 add_common_view_menu_items(viewMenu, std::bind(&MainFrame::can_change_view, this));
3384 viewMenu->AppendSeparator();
3385
3386 //BBS perspective view
3387 wxWindowID camera_id_base = wxWindow::NewControlId(int(wxID_CAMERA_COUNT));
3388 auto perspective_item = append_menu_radio_item(viewMenu, wxID_CAMERA_PERSPECTIVE + camera_id_base, _L("Use Perspective View"), _L("Use Perspective View"),
3389 [](wxCommandEvent&) {
3390 wxGetApp().app_config->set_bool("use_perspective_camera", true);
3391 wxGetApp().update_ui_from_settings();
3392 }, nullptr);
3393 //BBS orthogonal view
3394 auto orthogonal_item = append_menu_radio_item(viewMenu, wxID_CAMERA_ORTHOGONAL + camera_id_base, _L("Use Orthogonal View"), _L("Use Orthogonal View"),
3395 [](wxCommandEvent&) {
3396 wxGetApp().app_config->set_bool("use_perspective_camera", false);
3397 wxGetApp().update_ui_from_settings();
3398 }, nullptr);
3399 this->Bind(wxEVT_UPDATE_UI, [viewMenu, camera_id_base](wxUpdateUIEvent& evt) {
3400 if (wxGetApp().app_config->get("use_perspective_camera").compare("true") == 0)
3401 viewMenu->Check(wxID_CAMERA_PERSPECTIVE + camera_id_base, true);
3402 else
3403 viewMenu->Check(wxID_CAMERA_ORTHOGONAL + camera_id_base, true);
3404 }, perspective_item->GetId());
3405 append_menu_check_item(viewMenu, wxID_ANY, _L("Auto Perspective"), _L("Automatically switch between orthographic and perspective when changing from top/bottom/side views."),
3406 [this](wxCommandEvent&) {
3407 wxGetApp().app_config->set_bool("auto_perspective", !wxGetApp().app_config->get_bool("auto_perspective"));
3408 m_plater->get_current_canvas3D()->post_event(SimpleEvent(wxEVT_PAINT));
3409 },
3410 this, [this]() { return is_prepare_or_preview_tab(); },
3411 []() { return wxGetApp().app_config->get_bool("auto_perspective"); }, this);
3412
3413 viewMenu->AppendSeparator();
3414 wxMenuItem* gcode_window = append_menu_check_item(viewMenu, wxID_ANY, shortcut_label(_L("Show &G-code Window"), Shortcut::ToggleGcodeWindow, true), _L("Show G-code window in Preview scene."),
3415 [this](wxCommandEvent &) {
3416 wxGetApp().toggle_show_gcode_window();
3417 m_plater->get_current_canvas3D()->post_event(SimpleEvent(wxEVT_PAINT));
3418 },
3419 this, [this]() { return m_tabpanel->GetSelectedPageName() == TAB_ID_PREVIEW; },
3420 []() { return wxGetApp().show_gcode_window(); }, this);
3421 m_shortcut_menu_items.push_back({ gcode_window, Shortcut::ToggleGcodeWindow, _L("Show &G-code Window"), true });
3422
3424 viewMenu, wxID_ANY, _L("Show 3D Navigator"), _L("Show 3D navigator in Prepare and Preview scene."),
3425 [this](wxCommandEvent&) {
3426 wxGetApp().toggle_show_3d_navigator();
3427 m_plater->get_current_canvas3D()->post_event(SimpleEvent(wxEVT_PAINT));
3428 },
3429 this, [this]() { return is_prepare_or_preview_tab(); },
3430 []() { return wxGetApp().show_3d_navigator(); }, this);
3431
3432 append_menu_check_item(viewMenu, wxID_ANY, _L("Show Gridlines"), _L("Show Gridlines on plate"),
3433 [this](wxCommandEvent&) {
3434 wxGetApp().toggle_show_plate_gridlines();
3435 m_plater->get_current_canvas3D()->post_event(SimpleEvent(wxEVT_PAINT));
3436 }, this,
3437 [this]() { return is_prepare_or_preview_tab(); },
3438 []() { return wxGetApp().show_plate_gridlines(); }, this);
3439
3440 // IDEX/IQEX: toggle the per-carriage toolhead representation that appears during
3441 // G-code preview playback. Today this is the symbolic footprint box; if a future
3442 // change adds true toolhead model support (cf. printer bed models) this same toggle
3443 // governs that. Only relevant on Preview, and only meaningful when the active
3444 // printer is IDEX/IQEX — gated to keep the menu uncluttered for everyone else.
3445 append_menu_check_item(viewMenu, wxID_ANY, _L("Show IDEX/IQEX Toolhead"),
3446 _L("Show the IDEX/IQEX toolhead representation around each active nozzle in the G-code preview."),
3447 [this](wxCommandEvent&) {
3448 const bool current = wxGetApp().app_config->get("show_imex_toolhead_boxes") != "false";
3449 wxGetApp().app_config->set("show_imex_toolhead_boxes", current ? "false" : "true");
3450 m_plater->get_current_canvas3D()->post_event(SimpleEvent(wxEVT_PAINT));
3451 },
3452 this,
3453 [this]() {
3454 if (m_tabpanel->GetSelectedPageName() != TAB_ID_PREVIEW) return false;
3455 if (auto* pb = wxGetApp().preset_bundle) {
3456 auto* o = pb->printers.get_edited_preset().config.option<ConfigOptionBool>("is_imex");
3457 return o && o->value;
3458 }
3459 return false;
3460 },
3461 []() { return wxGetApp().app_config->get("show_imex_toolhead_boxes") != "false"; },
3462 this);
3463
3465 viewMenu, wxID_ANY, _L("Reset Window Layout"), _L("Reset to default window layout"),
3466 [this](wxCommandEvent&) { m_plater->reset_window_layout(); }, "", this,
3467 [this]() {
3468#ifdef SLIC3R_CAD
3469 if (shown_design_panel() != nullptr)
3470 return true;
3471#endif
3472 return is_prepare_or_preview_tab() && m_plater->is_sidebar_enabled();
3473 },
3474 this);
3475
3476 viewMenu->AppendSeparator();
3477 wxMenuItem* mouse3d_settings = append_menu_check_item(viewMenu, wxID_ANY, shortcut_label(_L("Show 3Dconnexion Settings"), Shortcut::Mouse3DSettings, true),
3478 _L("Show/Hide 3Dconnexion devices settings dialog"),
3479 [this](wxCommandEvent&) {
3480 Mouse3DController& controller = m_plater->get_mouse3d_controller();
3481 controller.show_settings_dialog(!controller.is_settings_dialog_shown());
3482 m_plater->get_current_canvas3D()->post_event(SimpleEvent(wxEVT_PAINT));
3483 },
3484 this, [this]() { return is_prepare_or_preview_tab() && m_plater->get_mouse3d_controller().can_show_settings_dialog(); },
3485 [this]() { return m_plater->get_mouse3d_controller().is_settings_dialog_shown(); }, this);
3486 m_shortcut_menu_items.push_back({ mouse3d_settings, Shortcut::Mouse3DSettings, _L("Show 3Dconnexion Settings"), true });
3487
3488 viewMenu->AppendSeparator();
3489 wxMenuItem* show_labels = append_menu_check_item(viewMenu, wxID_ANY, shortcut_label(_L("Show &Labels"), Shortcut::ShowLabels, true), _L("Show object labels in 3D scene."),
3490 [this](wxCommandEvent&) { m_plater->show_view3D_labels(!m_plater->are_view3D_labels_shown()); m_plater->get_current_canvas3D()->post_event(SimpleEvent(wxEVT_PAINT)); }, this,
3491 [this]() { return m_plater->is_view3D_shown(); }, [this]() { return m_plater->are_view3D_labels_shown(); }, this);
3492 m_shortcut_menu_items.push_back({ show_labels, Shortcut::ShowLabels, _L("Show &Labels"), true });
3493
3494 wxMenuItem* show_collision_volumes = append_menu_check_item(
3495 viewMenu, wxID_ANY, shortcut_label(_L("Show all collision volumes"), Shortcut::ShowCollisionVolumes, true),
3496 _L("Show the full height of every configured collision volume, including on an empty bed."),
3497 [this](wxCommandEvent&) { m_plater->show_collision_volumes(!m_plater->are_collision_volumes_shown()); }, this,
3498 [this]() { return m_plater->is_view3D_shown() && m_plater->printer_technology() == ptFFF; },
3499 [this]() { return m_plater->are_collision_volumes_shown(); }, this);
3500 m_shortcut_menu_items.push_back({ show_collision_volumes, Shortcut::ShowCollisionVolumes, _L("Show all collision volumes"), true });
3501
3502 append_menu_check_item(viewMenu, wxID_ANY, _L("Show &Overhang"), _L("Show object overhang highlight in 3D scene."),
3503 [this](wxCommandEvent &) {
3504 m_plater->show_view3D_overhang(!m_plater->is_view3D_overhang_shown());
3505 m_plater->get_current_canvas3D()->post_event(SimpleEvent(wxEVT_PAINT));
3506 },
3507 this, [this]() { return m_plater->is_view3D_shown(); }, [this]() { return m_plater->is_view3D_overhang_shown(); }, this);
3508
3510 viewMenu, wxID_ANY, _L("Show Selected Outline (beta)"), _L("Show outline around selected object in 3D scene."),
3511 [this](wxCommandEvent&) {
3512 wxGetApp().toggle_show_outline();
3513 m_plater->get_current_canvas3D()->post_event(SimpleEvent(wxEVT_PAINT));
3514 },
3515 this, [this]() { return m_tabpanel->GetSelectedPageName() == TAB_ID_PREPARE; },
3516 []() { return wxGetApp().show_outline(); }, this);
3517
3518 /*viewMenu->AppendSeparator();
3519 append_menu_check_item(viewMenu, wxID_ANY, _L("Show &Wireframe") + "\t" + ctrl + shift + _L("Enter"), _L("Show wireframes in 3D scene."),
3520 [this](wxCommandEvent&) { m_plater->toggle_show_wireframe(); m_plater->get_current_canvas3D()->post_event(SimpleEvent(wxEVT_PAINT)); }, this,
3521 [this]() { return m_plater->is_wireframe_enabled(); }, [this]() { return m_plater->is_show_wireframe(); }, this);*/
3522
3523 //viewMenu->AppendSeparator();
3525 //append_menu_check_item(viewMenu, wxID_ANY, _L("Show Edges(TODO)"), _L("Show Edges."),
3526 // [this](wxCommandEvent& evt) {
3527 // wxGetApp().app_config->set("show_build_edges", evt.GetInt() == 1 ? "true" : "false");
3528 // }, nullptr, [this]() {return can_select(); }, [this]() {
3529 // std::string show_build_edges = wxGetApp().app_config->get("show_build_edges");
3530 // return show_build_edges.compare("true") == 0;
3531 // }, this);
3532 }
3533
3534 wxWindowID config_id_base = wxWindow::NewControlId(int(ConfigMenuCnt));
3535 //TODO remove
3536 //auto config_wizard_name = _(ConfigWizard::name(true) + "(Debug)");
3537 //const auto config_wizard_tooltip = from_u8((boost::format(_utf8(L("Run %s"))) % config_wizard_name).str());
3538 //auto config_item = new wxMenuItem(m_topbar->GetTopMenu(), ConfigMenuWizard + config_id_base, config_wizard_name, config_wizard_tooltip);
3539#ifdef __APPLE__
3540 wxWindowID bambu_studio_id_base = wxWindow::NewControlId(int(2));
3541 wxMenu* parent_menu = m_menubar->OSXGetAppleMenu();
3542 //auto preference_item = new wxMenuItem(parent_menu, OrcaSlicerMenuPreferences + bambu_studio_id_base, _L("Preferences") + "\t" + ctrl + ",", "");
3543#else
3544 wxMenu* parent_menu = m_topbar->GetTopMenu();
3545#endif
3546
3547#ifdef __APPLE__
3548 wxString about_title = wxString::Format(_L("&About %s"), SLIC3R_APP_FULL_NAME);
3550 parent_menu, wxID_ANY, _L(about_title), "",
3551 [](wxCommandEvent &) { Slic3r::GUI::about();},
3552 "", nullptr, []() { return true; }, this, 0);
3554 parent_menu, Shortcut::Preferences, true, _L("Preferences"), "",
3555 [](wxCommandEvent &) {
3556 wxGetApp().open_preferences();
3557 },
3558 "", nullptr, []() { return true; }, this, 1);
3559 //parent_menu->Insert(1, preference_item);
3560#endif
3561 // Help menu
3562 auto helpMenu = generate_help_menu();
3563
3564#ifndef __APPLE__
3565 m_topbar->SetFileMenu(fileMenu);
3566 if (editMenu)
3567 m_topbar->AddDropDownSubMenu(editMenu, _L_CONTEXT("Edit", "Menu"));
3568 if (viewMenu)
3569 m_topbar->AddDropDownSubMenu(viewMenu, _L("View"));
3570 //BBS add Preference
3571
3573 m_topbar->GetTopMenu(), Shortcut::Preferences, true, _L("Preferences"), "",
3574 [](wxCommandEvent &) {
3575 // Orca: Use GUI_App::open_preferences instead of direct call so windows associations are updated on exit
3576 wxGetApp().open_preferences();
3577 },
3578 "", nullptr, []() { return true; }, this);
3579
3580 auto top_menu = m_topbar->GetTopMenu();
3581 top_menu->AppendSeparator();
3582
3584 top_menu, Shortcut::SpeedDial, false, _L("Open Speed Dial"), "",
3585 [](wxCommandEvent &) { wxGetApp().open_speed_dial(); },
3586 "", nullptr, []() { return true; }, this);
3587 top_menu->AppendSeparator();
3588
3590 top_menu, wxID_ANY, _L("Preset Bundle") + "\t", "",
3591 [this](wxCommandEvent &) {
3592 // Orca: Use GUI_App::open_preferences instead of direct call so windows associations are updated on exit
3593 wxGetApp().open_presetbundledialog();
3595 },
3596 "", nullptr, []() { return true; }, this);
3597
3599 top_menu, wxID_ANY, _L("Sync Presets"), _L("Pull and apply the latest presets from OrcaCloud"),
3600 [this](wxCommandEvent&) {
3601 if (!wxGetApp().is_user_login()) {
3602 MessageDialog info_dlg(this, _L("You must be logged in to sync presets from cloud."),
3603 _L("Sync Presets"), wxOK | wxICON_INFORMATION);
3604 info_dlg.ShowModal();
3605 return;
3606 }
3607 if (m_plater)
3608 m_plater->get_notification_manager()->push_notification(
3609 into_u8(_L("Syncing presets from cloud\u2026")));
3610 wxGetApp().restart_sync_user_preset();
3611 }, "", nullptr,
3612 []() {
3613 return wxGetApp().is_user_login() && !wxGetApp().app_config->get_stealth_mode();
3614 }, this);
3615
3616 top_menu->AppendSeparator();
3618 top_menu, wxID_ANY, _L("Plugins") + "\t", "",
3619 [](wxCommandEvent &) {
3620 wxGetApp().open_plugins_dialog();
3621 },
3622 "", nullptr, []() { return true; }, this);
3623
3624 //m_topbar->AddDropDownMenuItem(preference_item);
3625 //m_topbar->AddDropDownMenuItem(printer_item);
3626 //m_topbar->AddDropDownMenuItem(language_item);
3627 //m_topbar->AddDropDownMenuItem(config_item);
3628 top_menu->AppendSeparator();
3629 m_topbar->AddDropDownSubMenu(helpMenu, _L("Help"));
3630
3631 // SoftFever calibrations
3632
3633 // Temperature
3634 append_menu_item(m_topbar->GetCalibMenu(), wxID_ANY, _L("Temperature"), _L("Temperature Calibration"),
3635 [this](wxCommandEvent&) { run_calibration(CalibKind::Temperature); }, "", nullptr,
3636 [this]() {return m_plater->is_view3D_shown();; }, this);
3637
3638 // Max Volumetric Speed
3639 append_menu_item(m_topbar->GetCalibMenu(), wxID_ANY, _L("Max flowrate"), _L("Max flowrate"),
3640 [this](wxCommandEvent&) { run_calibration(CalibKind::MaxVolumetric); }, "", nullptr,
3641 [this]() {return m_plater->is_view3D_shown();; }, this);
3642
3643 // Pressure Advance
3644 append_menu_item(m_topbar->GetCalibMenu(), wxID_ANY, _L("Pressure advance"), _L("Pressure advance"),
3645 [this](wxCommandEvent&) { run_calibration(CalibKind::PressureAdvance); }, "", nullptr,
3646 [this]() {return m_plater->is_view3D_shown();; }, this);
3647
3648 // Flow rate (Wizard Dialog)
3649 append_menu_item(m_topbar->GetCalibMenu(), wxID_ANY, _L("Flow ratio"), _L("Flow Rate Calibration"),
3650 [this](wxCommandEvent&) { run_calibration(CalibKind::FlowRatio); }, "", nullptr,
3651 [this]() {return m_plater->is_view3D_shown();; }, this);
3652
3653 // Retraction
3654 append_menu_item(m_topbar->GetCalibMenu(), wxID_ANY, _L("Retraction"), _L("Retraction"),
3655 [this](wxCommandEvent&) { run_calibration(CalibKind::Retraction); }, "", nullptr,
3656 [this]() {return m_plater->is_view3D_shown();; }, this);
3657
3658 // Cornering
3659 append_menu_item(m_topbar->GetCalibMenu(), wxID_ANY, _L("Cornering"), _L("Cornering calibration"),
3660 [this](wxCommandEvent&) { run_calibration(CalibKind::Cornering); }, "", nullptr,
3661 [this]() {return m_plater->is_view3D_shown();; }, this);
3662
3663 // Input Shaping (with submenu)
3664 auto input_shaping_menu = new wxMenu();
3666 input_shaping_menu, wxID_ANY, _L("Input Shaping Frequency"), _L("Input Shaping Frequency"),
3667 [this](wxCommandEvent&) { run_calibration(CalibKind::InputShapingFreq); },
3668 "", nullptr,
3669 [this]() {return m_plater->is_view3D_shown();; }, this);
3671 input_shaping_menu, wxID_ANY, _L("Input Shaping Damping/zeta factor"), _L("Input Shaping Damping/zeta factor"),
3672 [this](wxCommandEvent&) { run_calibration(CalibKind::InputShapingDamp); },
3673 "", nullptr,
3674 [this]() {return m_plater->is_view3D_shown();; }, this);
3675 m_topbar->GetCalibMenu()->AppendSubMenu(input_shaping_menu, _L("Input Shaping"));
3676
3677 // VFA
3678 append_menu_item(m_topbar->GetCalibMenu(), wxID_ANY, _L("VFA"), _L("VFA"),
3679 [this](wxCommandEvent&) { run_calibration(CalibKind::VFA); }, "", nullptr,
3680 [this]() {return m_plater->is_view3D_shown();; }, this);
3681
3682 // help
3683 append_menu_item(m_topbar->GetCalibMenu(), wxID_ANY, _L("Calibration Guide"), _L("Calibration Guide"), [](wxCommandEvent &)
3684 { wxLaunchDefaultBrowser("https://www.orcaslicer.com/wiki/calibration_guide", wxBROWSER_NEW_WINDOW); }, "", nullptr, [this]()
3685 {return m_plater->is_view3D_shown();; }, this);
3686
3687#else
3688 // On Mac, the Apple menu ignores non-standard custom items, so add Preset Bundle to the File menu
3689 fileMenu->AppendSeparator();
3691 fileMenu, Shortcut::SpeedDial, false, _L("Open Speed Dial"), "",
3692 [](wxCommandEvent&) { wxGetApp().open_speed_dial(); },
3693 "", nullptr, []() { return true; }, this);
3695 fileMenu, wxID_ANY, _L("Preset Bundle"), "",
3696 [this](wxCommandEvent&) {
3697 wxGetApp().open_presetbundledialog();
3699 },
3700 "", nullptr, []() { return true; }, this);
3701
3703 fileMenu, wxID_ANY, _L("Sync Presets"), _L("Pull and apply the latest presets from OrcaCloud"),
3704 [this](wxCommandEvent&) {
3705 if (!wxGetApp().is_user_login()) {
3706 MessageDialog info_dlg(this, _L("You must be logged in to sync presets from cloud."),
3707 _L("Sync Presets"), wxOK | wxICON_INFORMATION);
3708 info_dlg.ShowModal();
3709 return;
3710 }
3711 if (m_plater)
3712 m_plater->get_notification_manager()->push_notification(
3713 into_u8(_L("Syncing presets from cloud\u2026")));
3714 wxGetApp().restart_sync_user_preset();
3715 }, "", nullptr,
3716 []() {
3717 return wxGetApp().is_user_login() && !wxGetApp().app_config->get_stealth_mode();
3718 }, this);
3719
3720 fileMenu->AppendSeparator();
3722 fileMenu, wxID_ANY, _L("Plugins"), "", [](wxCommandEvent&) { wxGetApp().open_plugins_dialog(); }, "", nullptr,
3723 []() { return true; }, this);
3724
3725 fileMenu->AppendSeparator();
3726
3727 m_menubar->Append(fileMenu, wxString::Format("&%s", _L("File")));
3728 if (editMenu)
3729 m_menubar->Append(editMenu, wxString::Format("&%s", _L_CONTEXT("Edit", "Menu")));
3730 if (viewMenu)
3731 m_menubar->Append(viewMenu, wxString::Format("&%s", _L("View")));
3732 /*if (publishMenu)
3733 m_menubar->Append(publishMenu, wxString::Format("&%s", _L("3D Models")));*/
3734
3735 // SoftFever calibrations
3736 auto calib_menu = new wxMenu();
3737
3738 // Temperature
3739 append_menu_item(calib_menu, wxID_ANY, _L("Temperature"), _L("Temperature"),
3740 [this](wxCommandEvent&) { run_calibration(CalibKind::Temperature); }, "", nullptr,
3741 [this]() {return m_plater->is_view3D_shown();; }, this);
3742
3743 // Max Volumetric Speed
3744 append_menu_item(calib_menu, wxID_ANY, _L("Max flowrate"), _L("Max flowrate"),
3745 [this](wxCommandEvent&) { run_calibration(CalibKind::MaxVolumetric); }, "", nullptr,
3746 [this]() {return m_plater->is_view3D_shown();; }, this);
3747
3748 // Pressure Advance
3749 append_menu_item(calib_menu, wxID_ANY, _L("Pressure advance"), _L("Pressure advance"),
3750 [this](wxCommandEvent&) { run_calibration(CalibKind::PressureAdvance); }, "", nullptr,
3751 [this]() {return m_plater->is_view3D_shown();; }, this);
3752
3753 // Flowrate (with submenu)
3754 // ORCA: Flow rate (Wizard Dialog)
3755 append_menu_item(calib_menu, wxID_ANY, _L("Flow ratio"), _L("Flow Rate Calibration"),
3756 [this](wxCommandEvent&) { run_calibration(CalibKind::FlowRatio); }, "", nullptr,
3757 [this]() {return m_plater->is_view3D_shown();; }, this);
3758
3759 // Retraction
3760 append_menu_item(calib_menu, wxID_ANY, _L("Retraction"), _L("Retraction"),
3761 [this](wxCommandEvent&) { run_calibration(CalibKind::Retraction); }, "", nullptr,
3762 [this]() {return m_plater->is_view3D_shown();; }, this);
3763
3764 // Cornering
3765 append_menu_item(calib_menu, wxID_ANY, _L("Cornering"), _L("Cornering calibration"),
3766 [this](wxCommandEvent&) { run_calibration(CalibKind::Cornering); }, "", nullptr,
3767 [this]() {return m_plater->is_view3D_shown();; }, this);
3768
3769 // Input Shaping (with submenu)
3770 auto input_shaping_menu = new wxMenu();
3772 input_shaping_menu, wxID_ANY, _L("Input Shaping Frequency"), _L("Input Shaping Frequency"),
3773 [this](wxCommandEvent&) { run_calibration(CalibKind::InputShapingFreq); },
3774 "", nullptr,
3775 [this]() {return m_plater->is_view3D_shown();; }, this);
3777 input_shaping_menu, wxID_ANY, _L("Input Shaping Damping/zeta factor"), _L("Input Shaping Damping/zeta factor"),
3778 [this](wxCommandEvent&) { run_calibration(CalibKind::InputShapingDamp); },
3779 "", nullptr,
3780 [this]() {return m_plater->is_view3D_shown();; }, this);
3781 calib_menu->AppendSubMenu(input_shaping_menu, _L("Input Shaping"));
3782
3783 // VFA
3784 append_menu_item(calib_menu, wxID_ANY, _L("VFA"), _L("VFA"),
3785 [this](wxCommandEvent&) { run_calibration(CalibKind::VFA); }, "", nullptr,
3786 [this]() {return m_plater->is_view3D_shown();; }, this);
3787 // help
3788 append_menu_item(calib_menu, wxID_ANY, _L("Calibration Guide"), _L("Calibration Guide"),
3789 [](wxCommandEvent&) { wxLaunchDefaultBrowser("https://www.orcaslicer.com/wiki/calibration_guide", wxBROWSER_NEW_WINDOW); }, "", nullptr,
3790 [this]() {return m_plater->is_view3D_shown();; }, this);
3791
3792 m_menubar->Append(calib_menu,wxString::Format("&%s", _L("Calibration")));
3793 if (helpMenu)
3794 m_menubar->Append(helpMenu, wxString::Format("&%s", _L("Help")));
3795 SetMenuBar(m_menubar);
3796
3797#endif
3798
3799#ifdef _MSW_DARK_MODE
3800 if (wxGetApp().tabs_as_menu())
3801 m_menubar->EnableTop(6, false);
3802#endif
3803
3804#ifdef __APPLE__
3805 // This fixes a bug on Mac OS where the quit command doesn't emit window close events
3806 // wx bug: https://trac.wxwidgets.org/ticket/18328
3807 wxMenu* apple_menu = m_menubar->OSXGetAppleMenu();
3808 if (apple_menu != nullptr) {
3809 apple_menu->Bind(wxEVT_MENU, [this](wxCommandEvent &) {
3810 Close();
3811 }, wxID_EXIT);
3812 }
3813#endif // __APPLE__
3814}
bool can_open_project() const
Definition MainFrame.cpp:1914
void add_common_view_menu_items(wxMenu *view_menu, std::function< bool(void)> can_change_view)
Definition MainFrame.cpp:2945
wxMenu * generate_help_menu()
Definition MainFrame.cpp:2849
bool can_export_all_gcode() const
Definition MainFrame.cpp:2021
void open_recent_project(size_t file_id, wxString const &filename)
Definition MainFrame.cpp:4529
bool can_export_toolpaths() const
Definition MainFrame.cpp:1978
bool can_deselect() const
Definition MainFrame.cpp:2112
bool can_delete() const
Definition MainFrame.cpp:2117
bool can_delete_all() const
Definition MainFrame.cpp:2122
bool can_clone() const
Definition MainFrame.cpp:2103
void load_config_file()
Definition MainFrame.cpp:3986
bool can_start_new_project() const
Definition MainFrame.cpp:1905
void run_calibration(CalibKind calib_kind)
Definition MainFrame.cpp:4654
void export_config()
Definition MainFrame.cpp:3951
wxMenuBar * m_menubar
Definition MainFrame.hpp:198
@ wxID_CAMERA_COUNT
Definition GUI_App.hpp:169
@ wxID_CAMERA_ORTHOGONAL
Definition GUI_App.hpp:168
@ wxID_CAMERA_PERSPECTIVE
Definition GUI_App.hpp:167
@ Cornering
Definition MainFrame.hpp:140
@ MaxVolumetric
Definition MainFrame.hpp:136
@ VFA
Definition MainFrame.hpp:143
@ InputShapingFreq
Definition MainFrame.hpp:141
@ FlowRatio
Definition MainFrame.hpp:138
@ PressureAdvance
Definition MainFrame.hpp:137
@ InputShapingDamp
Definition MainFrame.hpp:142
@ Retraction
Definition MainFrame.hpp:139
@ Temperature
Definition MainFrame.hpp:135
static const wxString sep
Definition MainFrame.cpp:2828
@ Undo
Definition Shortcuts.hpp:33
@ Paste
Definition Shortcuts.hpp:33
@ Mouse3DSettings
Definition Shortcuts.hpp:47
@ Redo
Definition Shortcuts.hpp:33
@ DeleteAll
Definition Shortcuts.hpp:33
@ Copy
Definition Shortcuts.hpp:33
@ SelectAll
Definition Shortcuts.hpp:31
@ DeleteSelected
Definition Shortcuts.hpp:33
@ CloneSelected
Definition Shortcuts.hpp:33
@ ToggleGcodeWindow
Definition Shortcuts.hpp:49
@ Cut
Definition Shortcuts.hpp:33
static wxString dots("...", wxConvUTF8)
@ FT_DRC
Definition GUI_App.hpp:139
void start_new_slicer(const wxString *path_to_open, bool single_instance)
Definition Process.cpp:140
@ ConfigMenuCnt
Definition GUI_App.hpp:158
wxMenuItem * append_menu_radio_item(wxMenu *menu, int id, const wxString &string, const wxString &description, std::function< void(wxCommandEvent &event)> cb, wxEvtHandler *event_handler)
Definition wxExtensions.cpp:165
wxMenuItem * append_menu_check_item(wxMenu *menu, int id, const wxString &string, const wxString &description, std::function< void(wxCommandEvent &event)> cb, wxEvtHandler *event_handler, std::function< bool()> const enable_condition, std::function< bool()> const check_condition, wxWindow *parent)
Definition wxExtensions.cpp:183
wxMenuItem * append_submenu(wxMenu *menu, wxMenu *sub_menu, int id, const wxString &string, const wxString &description, const std::string &icon, std::function< bool()> const cb_condition, wxWindow *parent, int insert_pos)
Definition wxExtensions.cpp:137

References _L, _L_CONTEXT, Slic3r::GUI::about(), add_common_view_menu_items(), append_menu_check_item(), append_menu_item(), append_menu_radio_item(), append_shortcut_item(), append_submenu(), can_add_models(), can_change_view(), can_clone(), can_delete(), can_delete_all(), can_deselect(), can_export_all_gcode(), can_export_gcode(), can_export_model(), can_export_toolpaths(), can_open_project(), can_save(), can_save_as(), can_select(), can_start_new_project(), Slic3r::GUI::CloneSelected, Slic3r::GUI::ConfigMenuCnt, Slic3r::GUI::Copy, Slic3r::GUI::Cornering, Slic3r::GUI::Cut, Slic3r::GUI::DeleteAll, Slic3r::GUI::DeleteSelected, Slic3r::GUI::dots(), export_config(), Slic3r::GUI::ExportSlicedFile, Slic3r::GUI::FlowRatio, Slic3r::GUI::GLCanvas3D::force_set_focus(), Slic3r::GUI::from_u8(), Slic3r::GUI::FT_DRC, generate_help_menu(), Slic3r::GUI::Plater::get_current_canvas3D(), Slic3r::GUI::ImportModel, Slic3r::GUI::InputShapingDamp, Slic3r::GUI::InputShapingFreq, Slic3r::GUI::into_u8(), is_prepare_or_preview_tab(), Slic3r::GUI::Mouse3DController::is_settings_dialog_shown(), load_config_file(), m_menubar, m_plater, m_recent_projects, m_shortcut_menu_items, m_tabpanel, m_topbar, Slic3r::GUI::MaxVolumetric, Slic3r::GUI::Mouse3DSettings, Slic3r::GUI::NewProject, open_recent_project(), Slic3r::GUI::OpenProject, Slic3r::GUI::ImGuiWrapper::owns_keyboard(), Slic3r::GUI::Paste, plater(), Slic3r::GUI::Preferences, Slic3r::GUI::PressureAdvance, Slic3r::ptFFF, Slic3r::GUI::Publish3mf, publish_project(), Slic3r::GUI::Quit, Slic3r::GUI::Redo, Slic3r::GUI::Retraction, run_calibration(), Slic3r::GUI::SaveProject, Slic3r::GUI::SaveProjectAs, Slic3r::GUI::SelectAll, Slic3r::GUI::sep, shortcut_label(), Slic3r::GUI::Mouse3DController::show_settings_dialog(), Slic3r::GUI::ShowCollisionVolumes, Slic3r::GUI::ShowLabels, Slic3r::GUI::DPIAware< P >::ShowModal(), SLIC3R_APP_FULL_NAME, Slic3r::GUI::SpeedDial, Slic3r::GUI::start_new_slicer(), TAB_ID_PREPARE, TAB_ID_PREVIEW, Slic3r::GUI::Temperature, Slic3r::GUI::ToggleGcodeWindow, Slic3r::GUI::Undo, Slic3r::ConfigOptionSingle< T >::value, Slic3r::GUI::VFA, Slic3r::GUI::wxID_CAMERA_COUNT, Slic3r::GUI::wxID_CAMERA_ORTHOGONAL, and Slic3r::GUI::wxID_CAMERA_PERSPECTIVE.

Here is the call graph for this function:

◆ init_menubar_as_gcodeviewer()

void Slic3r::GUI::MainFrame::init_menubar_as_gcodeviewer ( )
3862{
3863 //BBS do not show gcode viewer mebu
3864#if 0
3865 wxMenu* fileMenu = new wxMenu;
3866 {
3867 append_menu_item(fileMenu, wxID_ANY, _L("&Open G-code") + dots + "\t" + ctrl + "O", _L("Open a G-code file"),
3868 [this](wxCommandEvent&) { if (m_plater != nullptr) m_plater->load_gcode(); }, "open", nullptr,
3869 [this]() {return m_plater != nullptr; }, this);
3870#ifdef __APPLE__
3871 append_menu_item(fileMenu, wxID_ANY, _L("Re&load from Disk") + dots + "\t" + ctrl + shift + "R",
3872 _L("Reload the plater from disk"), [this](wxCommandEvent&) { m_plater->reload_gcode_from_disk(); },
3873 "", nullptr, [this]() { return !m_plater->get_last_loaded_gcode().empty(); }, this);
3874#else
3875 append_menu_item(fileMenu, wxID_ANY, _L("Re&load from Disk") + sep + "F5",
3876 _L("Reload the plater from disk"), [this](wxCommandEvent&) { m_plater->reload_gcode_from_disk(); },
3877 "", nullptr, [this]() { return !m_plater->get_last_loaded_gcode().empty(); }, this);
3878#endif // __APPLE__
3879 fileMenu->AppendSeparator();
3880 append_menu_item(fileMenu, wxID_ANY, _L("Export &Toolpaths as OBJ") + dots, _L("Export toolpaths as OBJ"),
3881 [this](wxCommandEvent&) { if (m_plater != nullptr) m_plater->export_toolpaths_to_obj(); }, "export_plater", nullptr,
3882 [this]() {return can_export_toolpaths(); }, this);
3883 append_menu_item(fileMenu, wxID_ANY, _L("Open &Slicer") + dots, _L("Open Slicer"),
3884 [](wxCommandEvent&) { start_new_slicer(); }, "", nullptr,
3885 []() {return true; }, this);
3886 fileMenu->AppendSeparator();
3887 append_menu_item(fileMenu, wxID_EXIT, _L("&Quit"), wxString::Format(_L("Quit %s"), SLIC3R_APP_NAME),
3888 [this](wxCommandEvent&) { Close(false); });
3889 }
3890
3891 // View menu
3892 wxMenu* viewMenu = nullptr;
3893 if (m_plater != nullptr) {
3894 viewMenu = new wxMenu();
3895 add_common_view_menu_items(viewMenu, std::bind(&MainFrame::can_change_view, this));
3896 }
3897
3898 // helpmenu
3899 auto helpMenu = generate_help_menu();
3900
3901 m_menubar = new wxMenuBar();
3902 m_menubar->Append(fileMenu, _L("&File"));
3903 if (viewMenu != nullptr) m_menubar->Append(viewMenu, _L("&View"));
3904 // Add additional menus from C++
3905 wxGetApp().add_config_menu(m_menubar);
3906 m_menubar->Append(helpMenu, _L("&Help"));
3907 SetMenuBar(m_menubar);
3908
3909#ifdef __APPLE__
3910 // This fixes a bug on Mac OS where the quit command doesn't emit window close events
3911 // wx bug: https://trac.wxwidgets.org/ticket/18328
3912 wxMenu* apple_menu = m_menubar->OSXGetAppleMenu();
3913 if (apple_menu != nullptr) {
3914 apple_menu->Bind(wxEVT_MENU, [this](wxCommandEvent&) {
3915 Close();
3916 }, wxID_EXIT);
3917 }
3918#endif // __APPLE__
3919#endif
3920}

References _L, add_common_view_menu_items(), append_menu_item(), can_change_view(), can_export_toolpaths(), Slic3r::GUI::dots(), generate_help_menu(), m_menubar, m_plater, Slic3r::GUI::sep, and Slic3r::GUI::start_new_slicer().

Here is the call graph for this function:

◆ init_tabpanel()

void Slic3r::GUI::MainFrame::init_tabpanel ( )
1445 {
1446 // wxNB_NOPAGETHEME: Disable Windows Vista theme for the Notebook background. The theme performance is terrible on
1447 // Windows 10 with multiple high resolution displays connected.
1448 // BBS
1449 wxBoxSizer *side_tools = create_side_tools();
1450 m_tabpanel = new Notebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, side_tools,
1451 wxNB_TOP | wxTAB_TRAVERSAL | wxNB_NOPAGETHEME);
1452 m_tabpanel->SetBackgroundColour(*wxWHITE);
1453
1454#ifndef __WXOSX__ // Don't call SetFont under OSX to avoid name cutting in ObjectList
1455 m_tabpanel->SetFont(Slic3r::GUI::wxGetApp().normal_font());
1456#endif
1457 m_tabpanel->Hide();
1458 m_settings_dialog.set_tabpanel(m_tabpanel);
1459
1460#ifdef __WXMSW__
1461 m_tabpanel->Bind(wxEVT_BOOKCTRL_PAGE_CHANGED, [this](wxBookCtrlEvent& e) {
1462#else
1463 m_tabpanel->Bind(wxEVT_NOTEBOOK_PAGE_CHANGED, [this](wxBookCtrlEvent& e) {
1464#endif
1465 //BBS
1466 wxWindow* panel = m_tabpanel->GetCurrentPage();
1467 //wxString page_text = m_tabpanel->GetPageText(sel);
1468 m_last_selected_tab = m_tabpanel->GetSelectedPageName();
1469 if (panel == m_plater) {
1471 wxPostEvent(m_plater, SimpleEvent(EVT_GLVIEWTOOLBAR_3D));
1472 m_param_panel->OnActivate();
1473 }
1474 else if (m_last_selected_tab == TAB_ID_PREVIEW) {
1475 m_plater->reset_check_status();
1476 if (!m_plater->check_ams_status(m_slice_select == eSliceAll))
1477 return;
1478 wxPostEvent(m_plater, SimpleEvent(EVT_GLVIEWTOOLBAR_PREVIEW));
1479 m_param_panel->OnActivate();
1480 }
1481 fit_tab_labels(); // ORCA on switching prepare / preview
1482 }
1483 //else if (panel == m_param_panel)
1484 // m_param_panel->OnActivate();
1485#ifdef SLIC3R_CAD
1486 else if (m_design_page != nullptr && panel == m_design_page) {
1487 // Re-sync the Design bed to the active printer: the panel is built before the
1488 // printer profile is fully applied, so its bed must refresh on activation or the
1489 // grid (true bed) spills past the stale default bed quad.
1491 }
1492#endif
1493 else if (panel == m_monitor_page) {
1494 //monitor
1495 }
1496#ifdef SLIC3R_CAD
1497 // Any page that is not Design takes the Design status line down with it — see
1498 // DesignPanel::on_tab_hidden for why the popup does not follow the page on its own.
1499 if (DesignPanel* design = DesignPanel::if_built(); design != nullptr && panel != m_design_page)
1500 design->on_tab_hidden();
1501#endif
1502#ifndef __APPLE__
1504 m_topbar->EnableUndoRedoItems();
1505 }
1506 else {
1507 m_topbar->DisableUndoRedoItems();
1508 }
1509#endif
1510#ifdef SLIC3R_CAD
1511 // Design keeps its own history, and the top bar's Undo/Redo drive it while it is shown.
1512 if (m_design_page != nullptr && panel == m_design_page)
1514#endif
1515
1516 if (panel)
1517 panel->SetFocus();
1518 });
1519
1520 if (wxGetApp().is_editor()) {
1521 m_home_page = new LazyPage<WebViewPanel>(m_tabpanel, TAB_ID_HOME, 10);
1522 m_lazy_pages.push_back(m_home_page);
1523 Bind(EVT_LOAD_URL, [this](wxCommandEvent &evt) {
1524 wxString url = evt.GetString();
1527 });
1528 m_tabpanel->AddPage(TAB_ID_HOME, m_home_page, "", "tab_home_active");
1529 m_param_panel = new ParamsPanel(m_tabpanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBK_LEFT | wxTAB_TRAVERSAL);
1530 }
1531
1532 m_plater = new Plater(this, this);
1533 m_plater->SetBackgroundColour(*wxWHITE);
1534 m_plater->Hide();
1535
1536 wxGetApp().plater_ = m_plater;
1537
1538#ifdef SLIC3R_CAD
1539 // The experimental feature is off by default, and when it is off the page is never
1540 // created, so the tab does not appear at all (the preference takes effect on the next
1541 // start, like the other feature toggles). Nor in the G-code viewer, which has no Design tab to put
1542 // it in — and no business opening a control socket onto one.
1543 if (wxGetApp().is_enable_cad_feature() && wxGetApp().is_editor()) {
1544 // Experimental and heavy enough that building it unasked would cost more than it saves.
1545 m_design_page = new LazyPage<DesignPanel>(this, TAB_ID_DESIGN, -1);
1546 m_lazy_pages.push_back(m_design_page);
1547 start_mcp_control_if_enabled(); // opens the MCP socket iff ORCA_CAD_MCP is set
1548 }
1549#endif
1550
1552
1553 //BBS add pages
1554 m_monitor_page = new LazyPage<MonitorPanel>(m_tabpanel, TAB_ID_MONITOR, 20);
1555 m_lazy_pages.push_back(m_monitor_page);
1556 m_tabpanel->AddPage(TAB_ID_MONITOR, m_monitor_page, _L("Device"), "tab_monitor_active");
1557
1558 m_printer_view_page = new LazyPage<PrinterWebView>(m_tabpanel, TAB_ID_MONITOR_WEB, 50, [this](wxWindow* parent) {
1559 auto* view = new PrinterWebView(parent);
1560 if (!m_printer_url.empty())
1561 view->load_url(m_printer_url, m_printer_api_key);
1562 return view;
1563 });
1565 Bind(EVT_LOAD_PRINTER_URL, [this](LoadPrinterViewEvent &evt) {
1566 //select_tab(MainFrame::tpMonitor);
1567 m_printer_url = evt.GetString();
1568 m_printer_api_key = evt.GetAPIkey();
1569 if (PrinterWebView* view = PrinterWebView::if_built())
1570 view->load_url(m_printer_url, m_printer_api_key);
1571 });
1572
1573 m_multi_machine_page = new LazyPage<MultiMachinePage>(m_tabpanel, TAB_ID_MULTI_DEVICE, 40);
1575 if (wxGetApp().is_enable_multi_machine()) {
1576 // TODO: change the bitmap
1577 m_tabpanel->AddPage(TAB_ID_MULTI_DEVICE, m_multi_machine_page, _L("Multi-device"), "tab_multi_active");
1578 }
1579
1580 m_project_page = new LazyPage<ProjectPanel>(m_tabpanel, TAB_ID_PROJECT, 60);
1581 m_lazy_pages.push_back(m_project_page);
1582 m_tabpanel->AddPage(TAB_ID_PROJECT, m_project_page, _L("Project"), "tab_auxiliary_active");
1583
1584 // show_device() removes this tab for printers without the Bambu device tab, and the page
1585 // then never builds its panel.
1586 m_calibration_page = new LazyPage<CalibrationPanel>(m_tabpanel, TAB_ID_CALIBRATION, 30);
1588 m_tabpanel->AddPage(TAB_ID_CALIBRATION, m_calibration_page, _L("Calibration"), "tab_calibration_active");
1589
1590 // Plugin pages are appended after the built-in tabs; their ids are namespaced
1591 // (plugin.<plugin_key>.<name>) so they can't collide with the built-in TAB_ID_* constants.
1592 m_plugin_pages.initialize(m_tabpanel);
1593
1594 if (m_plater) {
1595 // load initial config
1596 auto full_config = wxGetApp().preset_bundle->full_config();
1597 m_plater->on_config_change(full_config);
1598
1599 // Show a correct number of filament fields.
1600 // nozzle_diameter is undefined when SLA printer is selected
1601 // BBS
1602 if (full_config.has("filament_colour")) {
1603 m_plater->on_filament_count_change(full_config.option<ConfigOptionStrings>("filament_colour")->values.size());
1604 }
1605 }
1606}
#define TAB_ID_MULTI_DEVICE
Definition MainFrame.hpp:67
#define TAB_ID_HOME
Definition MainFrame.hpp:56
#define TAB_ID_MONITOR_WEB
Definition MainFrame.hpp:66
#define TAB_ID_CALIBRATION
Definition MainFrame.hpp:69
#define TAB_ID_PROJECT
Definition MainFrame.hpp:68
#define TAB_ID_MONITOR
Definition MainFrame.hpp:62
const wxFont & normal_font() const
Definition GUI_Utils.hpp:205
void on_tab_shown()
Definition DesignPanel.cpp:7330
void update_undo_redo_buttons()
Definition DesignPanel.cpp:12211
static DesignPanel * ensure()
Definition Lazy.hpp:186
wxString m_printer_url
Definition MainFrame.hpp:191
wxBoxSizer * create_side_tools()
Definition MainFrame.cpp:2252
PluginPages m_plugin_pages
Definition MainFrame.hpp:526
wxString m_last_selected_tab
Definition MainFrame.hpp:209
LazyPage< CalibrationPanel > * m_calibration_page
Definition MainFrame.hpp:523
LazyPage< ProjectPanel > * m_project_page
Definition MainFrame.hpp:521
wxString m_printer_api_key
Definition MainFrame.hpp:192
LazyPage< MonitorPanel > * m_monitor_page
Definition MainFrame.hpp:517
LazyPage< WebViewPanel > * m_home_page
Definition MainFrame.hpp:524
LazyPage< PrinterWebView > * m_printer_view_page
Definition MainFrame.hpp:525
void create_preset_tabs()
Definition MainFrame.cpp:1853
void select_tab(wxPanel *panel)
Definition MainFrame.cpp:4154
std::vector< LazyBase * > m_lazy_pages
Definition MainFrame.hpp:189
LazyPage< MultiMachinePage > * m_multi_machine_page
Definition MainFrame.hpp:520
void load_url(wxString &url)
Definition WebViewDialog.cpp:604
void start_mcp_control_if_enabled()
Definition McpControl.cpp:2285

References _L, create_preset_tabs(), create_side_tools(), Slic3r::GUI::LazyInstance< DesignPanel >::ensure(), Slic3r::GUI::LazyInstance< WebViewPanel >::ensure(), eSliceAll, fit_tab_labels(), Slic3r::GUI::LoadPrinterViewEvent::GetAPIkey(), Slic3r::GUI::LazyInstance< DesignPanel >::if_built(), Slic3r::GUI::LazyInstance< PrinterWebView >::if_built(), Slic3r::GUI::WebViewPanel::load_url(), m_calibration_page, m_home_page, m_last_selected_tab, m_lazy_pages, m_monitor_page, m_multi_machine_page, m_param_panel, m_plater, m_plugin_pages, m_printer_api_key, m_printer_url, m_printer_view_page, m_project_page, m_settings_dialog, m_slice_select, m_tabpanel, m_topbar, Slic3r::GUI::DPIAware< wxFrame >::normal_font(), Slic3r::GUI::DesignPanel::on_tab_hidden(), Slic3r::GUI::DesignPanel::on_tab_shown(), Slic3r::GUI::Plater, select_tab(), Slic3r::GUI::start_mcp_control_if_enabled(), TAB_ID_CALIBRATION, TAB_ID_HOME, TAB_ID_MONITOR, TAB_ID_MONITOR_WEB, TAB_ID_MULTI_DEVICE, TAB_ID_PREPARE, TAB_ID_PREVIEW, TAB_ID_PROJECT, Slic3r::GUI::DesignPanel::update_undo_redo_buttons(), and Slic3r::ConfigOptionVector< T >::values.

Here is the call graph for this function:

◆ is_active_and_shown_tab()

bool Slic3r::GUI::MainFrame::is_active_and_shown_tab ( wxPanel * panel)
1894{
1895 if (panel == m_param_panel)
1896 panel = m_plater;
1897 else
1898 return m_param_dialog->IsShown();
1899
1900 if (m_tabpanel->GetCurrentPage() != panel)
1901 return false;
1902 return true;
1903}

References m_param_dialog, m_param_panel, m_plater, and m_tabpanel.

◆ is_last_input_file()

bool Slic3r::GUI::MainFrame::is_last_input_file ( ) const
inline
405{ return !m_qs_last_input_file.IsEmpty(); }
wxString m_qs_last_input_file
Definition MainFrame.hpp:194

References m_qs_last_input_file.

◆ is_loaded()

bool Slic3r::GUI::MainFrame::is_loaded ( ) const
inline
404{ return m_loaded; }

References m_loaded.

◆ is_new_scale_factor()

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

References m_prev_scale_factor, and m_scale_factor.

◆ is_prepare_or_preview_tab()

bool Slic3r::GUI::MainFrame::is_prepare_or_preview_tab ( ) const
1737{
1738 const wxString tab = m_tabpanel->GetSelectedPageName();
1739 return tab == TAB_ID_PREPARE || tab == TAB_ID_PREVIEW;
1740}

References m_tabpanel, TAB_ID_PREPARE, and TAB_ID_PREVIEW.

Referenced by handle_global_shortcut(), and init_menubar_as_editor().

Here is the caller graph for this function:

◆ is_printer_view()

bool Slic3r::GUI::MainFrame::is_printer_view ( ) const
4627{ return m_tabpanel->GetSelectedPageName() == TAB_ID_MONITOR; }

References m_tabpanel, and TAB_ID_MONITOR.

◆ jump_to_monitor()

void Slic3r::GUI::MainFrame::jump_to_monitor ( std::string dev_id = "")
4280{
4281 m_tabpanel->SelectPageByName(TAB_ID_MONITOR);
4282 if (!dev_id.empty()) {
4284 }
4285}
void select_machine(std::string machine_sn)
Definition Monitor.cpp:290

References Slic3r::GUI::LazyInstance< MonitorPanel >::ensure(), m_tabpanel, Slic3r::GUI::MonitorPanel::select_machine(), and TAB_ID_MONITOR.

Here is the call graph for this function:

◆ jump_to_multipage()

void Slic3r::GUI::MainFrame::jump_to_multipage ( )
4288{
4289 if (!m_multi_machine_page->in_book())
4290 return;
4291 m_tabpanel->SelectPageByName(TAB_ID_MULTI_DEVICE);
4292 if (MultiMachinePage* page = m_multi_machine_page->ensure())
4293 page->jump_to_send_page();
4294}

References m_multi_machine_page, m_tabpanel, and TAB_ID_MULTI_DEVICE.

◆ load_config()

void Slic3r::GUI::MainFrame::load_config ( const DynamicPrintConfig & config)
4118{
4119 PrinterTechnology printer_technology = wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology();
4120 const auto *opt_printer_technology = config.option<ConfigOptionEnum<PrinterTechnology>>("printer_technology");
4121 if (opt_printer_technology != nullptr && opt_printer_technology->value != printer_technology) {
4122 printer_technology = opt_printer_technology->value;
4124 }
4125#if 0
4126 for (auto tab : wxGetApp().tabs_list)
4127 if (tab->supports_printer_technology(printer_technology)) {
4128 if (tab->type() == Slic3r::Preset::TYPE_PRINTER)
4129 static_cast<TabPrinter*>(tab)->update_pages();
4130 tab->load_config(config);
4131 }
4132 if (m_plater)
4133 m_plater->on_config_change(config);
4134#else
4135 // Load the currently selected preset into the GUI, update the preset selection box.
4136 //FIXME this is not quite safe for multi-extruder printers,
4137 // as the number of extruders is not adjusted for the vector values.
4138 // (see PresetBundle::update_multi_material_filament_presets())
4139 // Better to call PresetBundle::load_config() instead?
4140 for (auto tab : wxGetApp().tabs_list)
4141 if (tab->supports_printer_technology(printer_technology)) {
4142 // Only apply keys, which are present in the tab's config. Ignore the other keys.
4143 for (const std::string &opt_key : tab->get_config()->diff(config))
4144 // Ignore print_settings_id, printer_settings_id, filament_settings_id etc.
4145 if (! boost::algorithm::ends_with(opt_key, "_settings_id"))
4146 tab->get_config()->option(opt_key)->set(config.option(opt_key));
4147 }
4148
4149 wxGetApp().load_current_presets();
4150#endif
4151}
bool set_printer_technology(PrinterTechnology printer_technology)
Definition Plater.cpp:22162
@ TYPE_PRINTER
Definition Preset.hpp:250
static PrinterTechnology printer_technology()
Definition GUI_Factories.cpp:60
PrinterTechnology
Definition Config.hpp:229
ConfigOptionEnum< PrinterTechnology >
Definition PrintConfig.hpp:2358

References Slic3r::GUI::Tab::load_config(), m_plater, Slic3r::ConfigBase::option(), plater(), Slic3r::GUI::printer_technology(), Slic3r::GUI::Plater::set_printer_technology(), and Slic3r::Preset::TYPE_PRINTER.

Here is the call graph for this function:

◆ load_config_file() [1/2]

void Slic3r::GUI::MainFrame::load_config_file ( )
3987{
3988 //BBS do not load config file
3989 // if (!wxGetApp().check_and_save_current_preset_changes(_L("Loading profile file"), "", false))
3990 // return;
3991 wxFileDialog dlg(this, _L("Select profile to load:"),
3992 !m_last_config.IsEmpty() ? get_dir_name(m_last_config) : wxGetApp().app_config->get_last_dir(),
3993 "config.json", _L("Config files (*.json;*.zip;*.orca_printer;*.orca_bundle;*.orca_filament)|*.json;*.zip;*.orca_printer;*.orca_bundle;*.orca_filament"), wxFD_OPEN | wxFD_MULTIPLE | wxFD_FILE_MUST_EXIST);
3994 wxArrayString files;
3995 if (dlg.ShowModal() != wxID_OK)
3996 return;
3997 dlg.GetPaths(files);
3998 std::vector<std::string> cfiles;
3999 for (auto file : files) {
4000 cfiles.push_back(into_u8(file));
4001 m_last_config = file;
4002 }
4003 bool update = false;
4004 wxGetApp().preset_bundle->import_presets(cfiles, [this](std::string const & name) {
4005 ConfigsOverwriteConfirmDialog dlg(this, from_u8(name), false);
4006 int res = dlg.ShowModal();
4007 int ids[]{wxID_NO, wxID_YES, wxID_NOTOALL, wxID_YESTOALL};
4008 return std::find(ids, ids + 4, res) - ids;
4009 },
4011 *wxGetApp().app_config);
4012 if (!cfiles.empty()) {
4013 wxGetApp().app_config->update_config_dir(get_dir_name(cfiles.back()));
4014 wxGetApp().load_current_presets();
4015 BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " presets has been import,and size is" << cfiles.size();
4016 NetworkAgent* agent = wxGetApp().getAgent();
4017 if (agent) {
4018 BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " user is: " << agent->get_user_id();
4019 }
4020 }
4021 wxGetApp().preset_bundle->update_compatible(PresetSelectCompatibleType::Always);
4023 auto msg = wxString::Format(_L_PLURAL("There is %d config imported. (Only non-system and compatible configs)",
4024 "There are %d configs imported. (Only non-system and compatible configs)", cfiles.size()), cfiles.size());
4025 if(cfiles.empty())
4026 msg += _L("\nHint: Make sure you have added the corresponding printer before importing the configs.");
4027 MessageDialog dlg2(this,msg ,
4028 _L("Import result"), wxOK);
4029 dlg2.ShowModal();
4030}
void update_side_preset_ui()
Definition MainFrame.cpp:4735
@ Enable
Definition Config.hpp:245
@ Always
Definition Preset.hpp:527

References _L, _L_PLURAL, Slic3r::Always, Slic3r::Enable, Slic3r::GUI::from_u8(), get_dir_name(), Slic3r::NetworkAgent::get_user_id(), Slic3r::GUI::into_u8(), m_last_config, Slic3r::GUI::DPIAware< P >::ShowModal(), and update_side_preset_ui().

Referenced by init_menubar_as_editor().

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

◆ load_config_file() [2/2]

bool Slic3r::GUI::MainFrame::load_config_file ( const std::string & path)
4034{
4035 try {
4036 ConfigSubstitutions config_substitutions = wxGetApp().preset_bundle->load_config_file(path, ForwardCompatibilitySubstitutionRule::Enable);
4037 if (!config_substitutions.empty())
4038 show_substitutions_info(config_substitutions, path);
4039 } catch (const std::exception &ex) {
4040 show_error(this, ex.what());
4041 return false;
4042 }
4043 wxGetApp().load_current_presets();
4044 if (Plater *plater = wxGetApp().plater())
4045 plater->normalize_bed_types(false);
4046 return true;
4047}
void show_substitutions_info(const PresetsConfigSubstitutions &presets_config_substitutions)
Definition GUI.cpp:429
std::vector< ConfigSubstitution > ConfigSubstitutions
Definition Config.hpp:269

References Slic3r::Enable, plater(), Slic3r::GUI::show_error(), and Slic3r::GUI::show_substitutions_info().

Here is the call graph for this function:

◆ load_printer_url() [1/2]

void Slic3r::GUI::MainFrame::load_printer_url ( )
4599{
4600 PresetBundle &preset_bundle = *wxGetApp().preset_bundle;
4601 if (preset_bundle.use_bbl_device_tab() && !wxGetApp().app_config->get_bool("use_printer_agents"))
4602 return;
4603
4604 auto cfg = preset_bundle.printers.get_edited_preset().config;
4605 if (cfg.opt_string("print_host").empty()) {
4606 if (auto *device_manager = wxGetApp().getDeviceManager()) {
4607 auto *machine = device_manager->get_selected_machine();
4608 if (!machine) {
4609 auto machines = device_manager->get_my_machine_list(device_manager->get_current_printer_agent_id());
4610 if (machines.size() == 1)
4611 machine = machines.begin()->second;
4612 }
4613 if (machine && !machine->get_dev_ip().empty())
4614 cfg.opt_string("print_host") = machine->get_dev_ip();
4615 }
4616 }
4617 wxString url = from_u8(PrintHost::get_print_host_webui(&cfg));
4618 wxString apikey;
4619 const auto host_type = cfg.option<ConfigOptionEnum<PrintHostType>>("host_type")->value;
4620 if (cfg.has("printhost_apikey") && host_type != htSimplyPrint)
4621 apikey = cfg.opt_string("printhost_apikey");
4622 if (!url.empty()) {
4623 load_printer_url(url, apikey);
4624 }
4625}
void load_printer_url()
Definition MainFrame.cpp:4598
static std::string get_print_host_webui(DynamicPrintConfig *config)
Definition PrintHost.cpp:98

References Slic3r::Preset::config, Slic3r::GUI::from_u8(), Slic3r::PresetCollection::get_edited_preset(), Slic3r::PrintHost::get_print_host_webui(), Slic3r::htSimplyPrint, load_printer_url(), Slic3r::PresetBundle::printers, and Slic3r::PresetBundle::use_bbl_device_tab().

Referenced by load_printer_url().

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

◆ load_printer_url() [2/2]

void Slic3r::GUI::MainFrame::load_printer_url ( wxString url,
wxString apikey = "" )
4590{
4591 BOOST_LOG_TRIVIAL(trace) << "load_printer_url:" << url;
4592 auto evt = new LoadPrinterViewEvent(EVT_LOAD_PRINTER_URL, this->GetId());
4593 evt->SetString(url);
4594 evt->SetAPIkey(apikey);
4595 wxQueueEvent(this, evt);
4596}

References Slic3r::trace().

Here is the call graph for this function:

◆ load_url()

void Slic3r::GUI::MainFrame::load_url ( wxString url)
4582{
4583 BOOST_LOG_TRIVIAL(trace) << "load_url:" << url;
4584 auto evt = new wxCommandEvent(EVT_LOAD_URL, this->GetId());
4585 evt->SetString(url);
4586 wxQueueEvent(this, evt);
4587}

References Slic3r::trace().

Here is the call graph for this function:

◆ make_diff_dialog()

DiffPresetDialog * Slic3r::GUI::MainFrame::make_diff_dialog ( )
private
939{
940 auto* dialog = new DiffPresetDialog(this);
941
942 auto get_tab = [](Preset::Type type) {
943 Tab* null_tab = nullptr;
944 for (Tab* tab : wxGetApp().tabs_list)
945 if (tab->type() == type)
946 return tab;
947 return null_tab;
948 };
949
950 auto transfer = [dialog, get_tab](Preset::Type type) {
951 get_tab(type)->transfer_options(dialog->get_left_preset_name(type),
952 dialog->get_right_preset_name(type),
953 dialog->get_selected_options(type));
954 };
955
956 auto process_options = [dialog](std::function<void(Preset::Type)> process) {
957 const Preset::Type diff_dlg_type = dialog->view_type();
958 if (diff_dlg_type == Preset::TYPE_INVALID) {
959 for (const Preset::Type& type : dialog->types_list() )
960 process(type);
961 }
962 else
963 process(diff_dlg_type);
964 };
965
966 dialog->Bind(EVT_DIFF_DIALOG_TRANSFER, [process_options, transfer](SimpleEvent&) { process_options(transfer); });
967 return dialog;
968}
Type
Definition Preset.hpp:244
@ TYPE_INVALID
Definition Preset.hpp:245
bool process(std::exception_ptr &eptr)
Definition EmbossJob.cpp:1427

References Slic3r::Preset::TYPE_INVALID.

◆ normal_font()

const wxFont & Slic3r::GUI::DPIAware< wxFrame >::normal_font ( ) const
inlineinherited
205{ return m_normal_font; }

References m_normal_font.

Referenced by Slic3r::GUI::MainFrame::init_tabpanel(), and Slic3r::GUI::MainFrame::on_dpi_changed().

Here is the caller graph for this function:

◆ on_config_changed()

void Slic3r::GUI::MainFrame::on_config_changed ( DynamicPrintConfig * cfg) const
4399{
4400 if (m_plater)
4401 m_plater->on_config_change(*config); // propagate config change events to the plater
4402}

References m_plater.

◆ on_dpi_changed()

void Slic3r::GUI::MainFrame::on_dpi_changed ( const wxRect & suggested_rect)
overrideprotectedvirtual

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

2702{
2703 wxGetApp().update_fonts(this);
2704 this->SetFont(this->normal_font());
2705
2706#ifdef _MSW_DARK_MODE
2707 // update common mode sizer
2708 if (!wxGetApp().tabs_as_menu())
2709 dynamic_cast<Notebook*>(m_tabpanel)->Rescale();
2710#endif
2711
2712#ifndef __APPLE__
2713 // BBS
2714 m_topbar->Rescale();
2715#endif
2716
2717 m_tabpanel->Rescale();
2718
2720
2721 m_slice_btn->Rescale();
2722 m_print_btn->Rescale();
2723 m_slice_option_btn->Rescale();
2724 m_print_option_btn->Rescale();
2725
2726 // update Plater
2727 wxGetApp().plater()->msw_rescale();
2728
2729 // update Tabs
2730 //BBS GUI refactor: remove unused layout new/dlg
2731 //if (m_layout != ESettingsLayout::Dlg) // Do not update tabs if the Settings are in the separated dialog
2732 m_param_panel->msw_rescale();
2733 // A panel mid-build gets the pass once it is complete.
2734 ProjectPanel::when_built([](ProjectPanel& project) { project.msw_rescale(); });
2735 MonitorPanel::when_built([](MonitorPanel& monitor) { monitor.msw_rescale(); });
2736 MultiMachinePage::when_built([](MultiMachinePage& multi_machine) { multi_machine.msw_rescale(); });
2737 CalibrationPanel::when_built([](CalibrationPanel& calibration) { calibration.msw_rescale(); });
2738#ifdef SLIC3R_CAD
2739 DesignPanel::when_built([](DesignPanel& design) { design.msw_rescale(); });
2740#endif
2741
2742 // BBS
2743#if 0
2744 for (size_t id = 0; id < m_menubar->GetMenuCount(); id++)
2745 msw_rescale_menu(m_menubar->GetMenu(id));
2746#endif
2747
2748 // Workarounds for correct Window rendering after rescale
2749
2750 /* Even if Window is maximized during moving,
2751 * first of all we should imitate Window resizing. So:
2752 * 1. cancel maximization, if it was set
2753 * 2. imitate resizing
2754 * 3. set maximization, if it was set
2755 */
2756 const bool is_maximized = this->IsMaximized();
2757 if (is_maximized)
2758 this->Maximize(false);
2759
2760 /* To correct window rendering (especially redraw of a status bar)
2761 * we should imitate window resizing.
2762 */
2763 const wxSize& sz = this->GetSize();
2764 this->SetSize(sz.x + 1, sz.y + 1);
2765 this->SetSize(sz);
2766
2767 this->Maximize(is_maximized);
2768
2769 fit_tab_labels(); // ORCA
2770}
static void when_built(std::function< void(ProjectPanel &)> fn)
Definition Lazy.hpp:188
void msw_rescale_menu(wxMenu *)
Definition wxExtensions.hpp:33

References fit_tab_labels(), m_menubar, m_param_panel, m_print_btn, m_print_option_btn, m_slice_btn, m_slice_option_btn, m_tabpanel, m_topbar, Slic3r::GUI::CalibrationPanel::msw_rescale(), Slic3r::GUI::DesignPanel::msw_rescale(), Slic3r::GUI::MonitorPanel::msw_rescale(), Slic3r::GUI::MultiMachinePage::msw_rescale(), Slic3r::GUI::ProjectPanel::msw_rescale(), msw_rescale_menu(), Slic3r::GUI::DPIAware< wxFrame >::normal_font(), update_side_button_style(), Slic3r::GUI::LazyInstance< CalibrationPanel >::when_built(), Slic3r::GUI::LazyInstance< DesignPanel >::when_built(), Slic3r::GUI::LazyInstance< MonitorPanel >::when_built(), Slic3r::GUI::LazyInstance< MultiMachinePage >::when_built(), and Slic3r::GUI::LazyInstance< ProjectPanel >::when_built().

Here is the call graph for this function:

◆ on_presets_changed()

void Slic3r::GUI::MainFrame::on_presets_changed ( SimpleEvent & event)
private
4356{
4357 auto *tab = dynamic_cast<Tab*>(event.GetEventObject());
4358 wxASSERT(tab != nullptr);
4359 if (tab == nullptr) {
4360 return;
4361 }
4362
4363 // Update preset combo boxes(Print settings, Filament, Material, Printer) from their respective tabs.
4364 auto presets = tab->get_presets();
4365 if (m_plater != nullptr && presets != nullptr) {
4366
4367 // FIXME: The preset type really should be a property of Tab instead
4368 Slic3r::Preset::Type preset_type = tab->type();
4369 if (preset_type == Slic3r::Preset::TYPE_INVALID) {
4370 wxASSERT(false);
4371 return;
4372 }
4373
4374 m_plater->on_config_change(*tab->get_config());
4375
4376 m_plater->sidebar().update_presets(preset_type);
4377 }
4378}

References m_plater, and Slic3r::Preset::TYPE_INVALID.

◆ on_select_default_preset()

void Slic3r::GUI::MainFrame::on_select_default_preset ( SimpleEvent & evt)
4753{
4754 MessageDialog dialog(this,
4755 _L("Do you want to synchronize your personal data from Orca Cloud?\n"
4756 "It contains the following information:\n"
4757 "1. The Process presets\n"
4758 "2. The Filament presets\n"
4759 "3. The Printer presets"),
4760 _L("Synchronization"),
4761 wxCENTER |
4762 wxYES_DEFAULT | wxYES_NO |
4763 wxICON_INFORMATION);
4764
4765 /* get setting list */
4766 NetworkAgent* agent = wxGetApp().getAgent();
4767 switch ( dialog.ShowModal() )
4768 {
4769 case wxID_YES: {
4770 wxGetApp().app_config->set_bool("sync_user_preset", true);
4771 wxGetApp().start_sync_user_preset(true);
4772 BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " sync_user_preset: true";
4773 break;
4774 }
4775 case wxID_NO:
4776 wxGetApp().app_config->set_bool("sync_user_preset", false);
4777 wxGetApp().stop_sync_user_preset();
4778 BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " sync_user_preset: false";
4779 break;
4780 default:
4781 break;
4782 }
4783
4785}

References _L, Slic3r::GUI::DPIAware< P >::ShowModal(), and update_side_preset_ui().

Here is the call graph for this function:

◆ on_sys_color_changed()

void Slic3r::GUI::MainFrame::on_sys_color_changed ( )
overrideprotectedvirtual

Reimplemented from Slic3r::GUI::DPIAware< wxFrame >.

2773{
2774 wxBusyCursor wait;
2775
2776 // update label colors in respect to the system mode
2777 wxGetApp().init_label_colours();
2778
2779#ifndef __WINDOWS__
2780 wxGetApp().force_colors_update();
2781 wxGetApp().update_ui_from_settings();
2782#endif //__APPLE__
2783
2784#ifdef __WXMSW__
2785 wxGetApp().UpdateDarkUI(m_tabpanel);
2786 // m_statusbar->update_dark_ui();
2787#ifdef _MSW_DARK_MODE
2788 // update common mode sizer
2789 if (!wxGetApp().tabs_as_menu())
2790 dynamic_cast<Notebook*>(m_tabpanel)->Rescale();
2791#endif
2792#endif
2793
2794 if (DiffPresetDialog* dialog = DiffPresetDialog::if_built())
2795 dialog->on_sys_color_changed();
2796
2797 // BBS
2798 m_tabpanel->Rescale();
2799 m_param_panel->msw_rescale();
2800
2801 // update Plater
2802 wxGetApp().plater()->sys_color_changed();
2803 MonitorPanel::when_built([](MonitorPanel& monitor) { monitor.on_sys_color_changed(); });
2804 CalibrationPanel::when_built([](CalibrationPanel& calibration) { calibration.on_sys_color_changed(); });
2805#ifdef SLIC3R_CAD
2806 DesignPanel::when_built([](DesignPanel& design) { design.on_sys_color_changed(); });
2807#endif
2808 // update Tabs
2809 for (auto tab : wxGetApp().tabs_list)
2810 tab->sys_color_changed();
2811 for (auto tab : wxGetApp().model_tabs_list)
2812 tab->sys_color_changed();
2813 wxGetApp().plate_tab->sys_color_changed();
2814
2816
2818
2819 this->Refresh();
2820}
void sys_color_changed()
Definition GUI_Factories.cpp:2810
static void RecreateAll()
Definition WebView.cpp:526

References Slic3r::GUI::LazyInstance< DiffPresetDialog >::if_built(), m_menubar, m_param_panel, m_tabpanel, Slic3r::GUI::CalibrationPanel::on_sys_color_changed(), Slic3r::GUI::DesignPanel::on_sys_color_changed(), Slic3r::GUI::MonitorPanel::on_sys_color_changed(), WebView::RecreateAll(), Slic3r::GUI::MenuFactory::sys_color_changed(), Slic3r::GUI::LazyInstance< CalibrationPanel >::when_built(), Slic3r::GUI::LazyInstance< DesignPanel >::when_built(), and Slic3r::GUI::LazyInstance< MonitorPanel >::when_built().

Here is the call graph for this function:

◆ on_value_changed()

void Slic3r::GUI::MainFrame::on_value_changed ( wxCommandEvent & event)
private
4382{
4383 auto *tab = dynamic_cast<Tab*>(event.GetEventObject());
4384 wxASSERT(tab != nullptr);
4385 if (tab == nullptr)
4386 return;
4387
4388 auto opt_key = event.GetString();
4389 if (m_plater) {
4390 m_plater->on_config_change(*tab->get_config()); // propagate config change events to the plater
4391 if (opt_key == "extruders_count") {
4392 auto value = event.GetInt();
4393 m_plater->on_filament_count_change(value);
4394 }
4395 }
4396}

References m_plater.

◆ open_menubar_item()

void Slic3r::GUI::MainFrame::open_menubar_item ( const wxString & menu_name,
const wxString & item_name )
3835{
3836 if (m_menubar == nullptr)
3837 return;
3838 // Get menu object from menubar
3839 int menu_index = m_menubar->FindMenu(menu_name);
3840 wxMenu* menu = m_menubar->GetMenu(menu_index);
3841 if (menu == nullptr) {
3842 BOOST_LOG_TRIVIAL(error) << "Mainframe open_menubar_item function couldn't find menu: " << menu_name;
3843 return;
3844 }
3845 // Get item id from menu
3846 int item_id = menu->FindItem(item_name);
3847 if (item_id == wxNOT_FOUND)
3848 {
3849 // try adding three dots char
3850 item_id = menu->FindItem(item_name + dots);
3851 }
3852 if (item_id == wxNOT_FOUND)
3853 {
3854 BOOST_LOG_TRIVIAL(error) << "Mainframe open_menubar_item function couldn't find item: " << item_name;
3855 return;
3856 }
3857 // wxEVT_MENU will trigger item
3858 wxPostEvent((wxEvtHandler*)menu, wxCommandEvent(wxEVT_MENU, item_id));
3859}

References Slic3r::GUI::dots(), and m_menubar.

Here is the call graph for this function:

◆ open_recent_project()

void Slic3r::GUI::MainFrame::open_recent_project ( size_t file_id,
wxString const & filename )
4530{
4531 if (file_id == size_t(-1)) {
4532 file_id = m_recent_projects.FindFileInHistory(filename);
4533 }
4534 if (wxFileExists(filename)) {
4535 CallAfter([this, filename] {
4536 if (wxGetApp().can_load_project())
4537 m_plater->load_project(filename);
4538 });
4539 }
4540 else
4541 {
4542 MessageDialog msg(this, _L("The project is no longer available."), _L("Error"), wxOK | wxYES_DEFAULT);
4543 if (msg.ShowModal() == wxID_YES)
4544 {
4545 m_recent_projects.RemoveFileFromHistory(file_id);
4546 std::vector<std::string> recent_projects;
4547 size_t count = m_recent_projects.GetCount();
4548 for (size_t i = 0; i < count; ++i)
4549 {
4550 recent_projects.push_back(into_u8(m_recent_projects.GetHistoryFile(i)));
4551 }
4552 wxGetApp().app_config->set_recent_projects(recent_projects);
4553 if (WebViewPanel* home = WebViewPanel::if_built())
4554 home->SendRecentList(-1);
4555 }
4556 }
4557}

References _L, count, Slic3r::GUI::LazyInstance< WebViewPanel >::if_built(), Slic3r::GUI::into_u8(), m_plater, m_recent_projects, and Slic3r::GUI::DPIAware< P >::ShowModal().

Referenced by init_menubar_as_editor().

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

◆ plater()

Plater * Slic3r::GUI::MainFrame::plater ( )
inline
363{ return m_plater; }

References m_plater.

Referenced by add_common_view_menu_items(), handle_global_shortcut(), init_menubar_as_editor(), load_config(), load_config_file(), BBLTopbar::OnOpenProject(), BBLTopbar::OnRedo(), BBLTopbar::OnSaveProject(), BBLTopbar::OnUndo(), technology_changed(), and update_menubar().

Here is the caller graph for this function:

◆ plugin_pages()

PluginPages & Slic3r::GUI::MainFrame::plugin_pages ( )
inline
490{ return m_plugin_pages; }

References m_plugin_pages.

Referenced by Slic3r::GUI::anonymous_namespace{ActionRegistry.cpp}::PluginPageAction::run().

Here is the caller graph for this function:

◆ prebuild_pages_when_idle()

void Slic3r::GUI::MainFrame::prebuild_pages_when_idle ( )
4263{
4264 m_idle.clear();
4265 m_idle.add(m_gl_prebuild);
4266 if (m_param_panel)
4267 m_idle.add(m_param_panel->settings_page_prebuild());
4268 m_idle.add(m_prepare_layout_prebuild);
4269 for (LazyBase* page : m_lazy_pages)
4270 if (page->prebuild_order() >= 0)
4271 m_idle.add(*page);
4272 m_idle.add(m_diff_dialog);
4273 BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": prebuild queue: " << m_idle.names();
4274 m_idle.start();
4275 m_prebuild_started = true;
4276}

References m_diff_dialog, m_idle, m_lazy_pages, m_param_panel, and m_prebuild_started.

◆ prev_scale_factor()

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

References m_prev_scale_factor.

◆ preview_only_hint()

bool Slic3r::GUI::MainFrame::preview_only_hint ( )
1772{
1773 if (m_plater && (m_plater->only_gcode_mode() || (m_plater->using_exported_file()))) {
1774 BOOST_LOG_TRIVIAL(info) << boost::format("skipped tab switch from %1% to %2% in preview mode")%m_tabpanel->GetSelectedPageName() %wxString(TAB_ID_PREPARE);
1775
1776 ConfirmBeforeSendDialog confirm_dlg(this, wxID_ANY, _L("Warning"));
1777 confirm_dlg.Bind(EVT_SECONDARY_CHECK_CONFIRM, [this](wxCommandEvent& e) {
1779 });
1780 confirm_dlg.update_btn_label(_L("Yes"), _L("No"));
1781 auto filename = m_plater->get_preview_only_filename();
1782
1783 // TRN %s is a file name.
1784 confirm_dlg.update_text(wxString::Format(_L("%s will be closed before creating a new model. Do you want to continue?"), from_u8(filename)));
1785 confirm_dlg.on_show();
1787 m_plater->new_project();
1788 preview_only_to_editor = false;
1789 }
1790
1791 return false;
1792 }
1793
1794 return true;
1795}
bool preview_only_to_editor
Definition MainFrame.hpp:317

References _L, Slic3r::GUI::from_u8(), m_plater, m_tabpanel, Slic3r::GUI::ConfirmBeforeSendDialog::on_show(), preview_only_to_editor, TAB_ID_PREPARE, Slic3r::GUI::ConfirmBeforeSendDialog::update_btn_label(), and Slic3r::GUI::ConfirmBeforeSendDialog::update_text().

Referenced by update_layout().

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

◆ printhost_queue_dlg()

PrintHostQueueDialog * Slic3r::GUI::MainFrame::printhost_queue_dlg ( )
inline
504{ return m_printhost_queue_dlg; }

References m_printhost_queue_dlg.

◆ publish_project()

void Slic3r::GUI::MainFrame::publish_project ( )
1953{
1954 if (m_plater == nullptr)
1955 return;
1956 // Seed the dialog from the session selection (a remembered state or a freshly loaded
1957 // published 3MF); a null pointer means "fresh", keeping the dirty defaults.
1958 std::vector<std::string> pending_keys;
1959 std::vector<Slic3r::PublishedMaterialEntry> pending_material;
1960 const bool has_prior = m_plater->get_pending_published(pending_keys, pending_material);
1961 PublishSettingsDialog dlg(this, has_prior ? &pending_keys : nullptr, has_prior ? &pending_material : nullptr);
1962 if (dlg.ShowModal() != wxID_OK)
1963 return;
1964 m_plater->set_pending_published(dlg.GetPublishedKeys(), dlg.GetPublishedMaterialKeys());
1965 m_plater->export_published_3mf(dlg.GetPublishedKeys(), dlg.GetPublishedMaterialKeys());
1966}

References Slic3r::GUI::PublishSettingsDialog::GetPublishedKeys(), Slic3r::GUI::PublishSettingsDialog::GetPublishedMaterialKeys(), m_plater, and Slic3r::GUI::DPIAware< P >::ShowModal().

Referenced by handle_global_shortcut(), and init_menubar_as_editor().

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

◆ refresh_plugin_tips()

void Slic3r::GUI::MainFrame::refresh_plugin_tips ( )
4631{
4632 if (WebViewPanel* home = WebViewPanel::if_built())
4633 home->ShowNetpluginTip();
4634}

References Slic3r::GUI::LazyInstance< WebViewPanel >::if_built().

Here is the call graph for this function:

◆ register_win32_callbacks()

void Slic3r::GUI::MainFrame::register_win32_callbacks ( )

◆ remember_print_select()

void Slic3r::GUI::MainFrame::remember_print_select ( PrintSelectType select_type)
2228{
2229 if (!wxGetApp().app_config->get_bool("remember_print_action"))
2230 return;
2231 // AppConfig is marked dirty here and flushed by the regular autosave
2232 wxGetApp().app_config->set("last_print_action", print_select_type_key(select_type));
2233}

Referenced by select_print_action().

Here is the caller graph for this function:

◆ remove_recent_project()

void Slic3r::GUI::MainFrame::remove_recent_project ( size_t file_id,
wxString const & filename )
4560{
4561 if (file_id == size_t(-1)) {
4562 if (filename.IsEmpty())
4563 while (m_recent_projects.GetCount() > 0)
4564 m_recent_projects.RemoveFileFromHistory(0);
4565 else
4566 file_id = m_recent_projects.FindFileInHistory(filename);
4567 }
4568 if (file_id != size_t(-1))
4569 m_recent_projects.RemoveFileFromHistory(file_id);
4570 std::vector<std::string> recent_projects;
4571 size_t count = m_recent_projects.GetCount();
4572 for (size_t i = 0; i < count; ++i)
4573 {
4574 recent_projects.push_back(into_u8(m_recent_projects.GetHistoryFile(i)));
4575 }
4576 wxGetApp().app_config->set_recent_projects(recent_projects);
4577 if (WebViewPanel* home = WebViewPanel::if_built())
4578 home->SendRecentList(-1);
4579}

References count, Slic3r::GUI::LazyInstance< WebViewPanel >::if_built(), Slic3r::GUI::into_u8(), and m_recent_projects.

Here is the call graph for this function:

◆ request_select_tab()

void Slic3r::GUI::MainFrame::request_select_tab ( const wxString & id)
4335{
4336 wxCommandEvent* evt = new wxCommandEvent(EVT_SELECT_TAB);
4337 evt->SetString(id);
4338 wxQueueEvent(this, evt);
4339}

◆ rescale()

void Slic3r::GUI::DPIAware< wxFrame >::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

References m_force_rescale, m_normal_font, m_prev_scale_factor, m_scale_factor, Slic3r::GUI::DPIAware< P >::on_dpi_changed(), and Slic3r::GUI::DPIAware< P >::update_em_unit().

Here is the call graph for this function:

◆ reslice_now()

void Slic3r::GUI::MainFrame::reslice_now ( )
3931{
3932 if (m_plater)
3933 m_plater->reslice();
3934}

References m_plater.

◆ run_calibration()

void Slic3r::GUI::MainFrame::run_calibration ( CalibKind calib_kind)
4655{
4656 switch (calib_kind) {
4658 if (!m_temp_calib_dlg)
4659 m_temp_calib_dlg = new Temp_Calibration_Dlg((wxWindow*) this, wxID_ANY, m_plater);
4660 m_temp_calib_dlg->ShowModal();
4661 break;
4662 }
4664 if (!m_vol_test_dlg)
4665 m_vol_test_dlg = new MaxVolumetricSpeed_Test_Dlg((wxWindow*) this, wxID_ANY, m_plater);
4666 m_vol_test_dlg->ShowModal();
4667 break;
4668 }
4670 if (!m_pa_calib_dlg)
4671 m_pa_calib_dlg = new PA_Calibration_Dlg((wxWindow*) this, wxID_ANY, m_plater);
4672 m_pa_calib_dlg->ShowModal();
4673 break;
4674 }
4675 case CalibKind::FlowRatio: {
4676 if (!m_plater)
4677 break;
4679 m_flow_rate_calib_dlg = new FlowRateCalibrationDialog((wxWindow*) this, wxID_ANY, m_plater);
4680 m_flow_rate_calib_dlg->ShowModal();
4681 break;
4682 }
4683 case CalibKind::Retraction: {
4685 m_retraction_calib_dlg = new Retraction_Test_Dlg((wxWindow*) this, wxID_ANY, m_plater);
4686 m_retraction_calib_dlg->ShowModal();
4687 break;
4688 }
4689 case CalibKind::Cornering: {
4690 auto dlg = new Cornering_Test_Dlg((wxWindow*) this, wxID_ANY, m_plater);
4691 dlg->ShowModal();
4692 dlg->Destroy();
4693 break;
4694 }
4696 auto dlg = new Input_Shaping_Freq_Test_Dlg((wxWindow*) this, wxID_ANY, m_plater);
4697 dlg->ShowModal();
4698 dlg->Destroy();
4699 break;
4700 }
4702 auto dlg = new Input_Shaping_Damp_Test_Dlg((wxWindow*) this, wxID_ANY, m_plater);
4703 dlg->ShowModal();
4704 dlg->Destroy();
4705 break;
4706 }
4707 case CalibKind::VFA: {
4708 if (!m_vfa_test_dlg)
4709 m_vfa_test_dlg = new VFA_Test_Dlg((wxWindow*) this, wxID_ANY, m_plater);
4710 m_vfa_test_dlg->ShowModal();
4711 break;
4712 }
4713 }
4714}
Temp_Calibration_Dlg * m_temp_calib_dlg
Definition MainFrame.hpp:494
VFA_Test_Dlg * m_vfa_test_dlg
Definition MainFrame.hpp:496
FlowRateCalibrationDialog * m_flow_rate_calib_dlg
Definition MainFrame.hpp:493
Retraction_Test_Dlg * m_retraction_calib_dlg
Definition MainFrame.hpp:497
PA_Calibration_Dlg * m_pa_calib_dlg
Definition MainFrame.hpp:492
MaxVolumetricSpeed_Test_Dlg * m_vol_test_dlg
Definition MainFrame.hpp:495

References Slic3r::GUI::Cornering, Slic3r::GUI::FlowRatio, Slic3r::GUI::InputShapingDamp, Slic3r::GUI::InputShapingFreq, m_flow_rate_calib_dlg, m_pa_calib_dlg, m_plater, m_retraction_calib_dlg, m_temp_calib_dlg, m_vfa_test_dlg, m_vol_test_dlg, Slic3r::GUI::MaxVolumetric, Slic3r::GUI::PressureAdvance, Slic3r::GUI::Retraction, Slic3r::GUI::Temperature, and Slic3r::GUI::VFA.

Referenced by Slic3r::GUI::anonymous_namespace{NativeCommands.cpp}::calib_command(), and init_menubar_as_editor().

Here is the caller graph for this function:

◆ RunScript()

void Slic3r::GUI::MainFrame::RunScript ( wxString js)
4637{
4638 if (WebViewPanel* home = WebViewPanel::if_built())
4639 home->RunScript(js);
4640}

References Slic3r::GUI::LazyInstance< WebViewPanel >::if_built().

Here is the call graph for this function:

◆ save_project()

void Slic3r::GUI::MainFrame::save_project ( )
1938{
1939 save_project_as(m_plater->get_project_filename(".3mf"));
1940}
bool save_project_as(const wxString &filename=wxString())
Definition MainFrame.cpp:1942

References m_plater, and save_project_as().

Here is the call graph for this function:

◆ save_project_as()

bool Slic3r::GUI::MainFrame::save_project_as ( const wxString & filename = wxString())
1943{
1944 bool ret = (m_plater != nullptr) ? m_plater->export_3mf(into_path(filename)) : false;
1945 if (ret) {
1946// wxGetApp().update_saved_preset_from_current_preset();
1947 m_plater->reset_project_dirty_after_save();
1948 }
1949 return ret;
1950}
boost::filesystem::path into_path(const wxString &str)
Definition GUI.cpp:564

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

Referenced by save_project(), and Slic3r::GUI::Plater::priv::save_project_if_dirty().

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

◆ scale_factor()

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

References m_scale_factor.

◆ select_prepare_for_gl_init()

void Slic3r::GUI::MainFrame::select_prepare_for_gl_init ( )
4179{
4180 m_tabpanel->ChangeSelection(m_tabpanel->FindPageByName(TAB_ID_PREPARE));
4181}

References m_tabpanel, and TAB_ID_PREPARE.

◆ select_print_action()

void Slic3r::GUI::MainFrame::select_print_action ( PrintSelectType select_type)
2217{
2218 m_print_btn->SetLabel(print_select_type_label(select_type));
2219 m_print_select = select_type;
2220 remember_print_select(select_type);
2222 m_print_btn->Enable(m_print_enable);
2223 this->Layout();
2224 fit_tab_labels(); // ORCA on label change
2225}
void remember_print_select(PrintSelectType select_type)
Definition MainFrame.cpp:2227

References fit_tab_labels(), get_enable_print_status(), m_print_btn, m_print_enable, m_print_select, and remember_print_select().

Referenced by create_side_tools().

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

◆ select_tab() [1/2]

void Slic3r::GUI::MainFrame::select_tab ( const wxString & id = wxString())
4299{
4300 //bool tabpanel_was_hidden = false;
4301
4302 // Controls on page are created on active page of active tab now.
4303 // We should select/activate tab before its showing to avoid an UI-flickering
4304 auto select = [this, id](bool was_hidden) {
4305 // when id is empty, it means we should show the last selected tab
4306 //BBS GUI refactor: remove unused layout new/dlg
4307 //size_t new_selection = tab == (size_t)(-1) ? m_last_selected_tab : (m_layout == ESettingsLayout::Dlg && tab != 0) ? tab - 1 : tab;
4308 wxString new_selection = id.empty() ? m_last_selected_tab : id;
4309
4310 if (m_tabpanel->GetSelectedPageName() != new_selection)
4311 m_tabpanel->SelectPageByName(new_selection);
4312#ifdef _MSW_DARK_MODE
4313 /*if (wxGetApp().tabs_as_menu()) {
4314 if (Tab* cur_tab = dynamic_cast<Tab*>(m_tabpanel->GetPage(new_selection)))
4315 update_marker_for_tabs_menu((m_layout == ESettingsLayout::Old ? m_menubar : m_settings_dialog.menubar()), cur_tab->title(), m_layout == ESettingsLayout::Old);
4316 else if (tab == 0 && m_layout == ESettingsLayout::Old)
4317 m_plater->get_current_canvas3D()->render();
4318 }*/
4319#endif
4320 // Intentionally `id`, not `new_selection`: the fallback-to-last-tab path must not
4321 // trigger this render even when the last selected tab was Prepare.
4323 m_plater->canvas3D()->render();
4324 else if (was_hidden) {
4325 Tab* cur_tab = dynamic_cast<Tab*>(m_tabpanel->GetPageByName(new_selection));
4326 if (cur_tab)
4327 cur_tab->OnActivate();
4328 }
4329 };
4330
4331 select(false);
4332}

References m_last_selected_tab, m_layout, m_plater, m_tabpanel, Old, Slic3r::GUI::Tab::OnActivate(), and TAB_ID_PREPARE.

Here is the call graph for this function:

◆ select_tab() [2/2]

void Slic3r::GUI::MainFrame::select_tab ( wxPanel * panel)
4155{
4156 if (!panel)
4157 return;
4158 if (panel == m_param_panel) {
4159 panel = m_plater;
4160 } else if (dynamic_cast<ParamsPanel*>(panel)) {
4161 wxGetApp().params_dialog()->Popup();
4162 return;
4163 }
4164 // Not panel->GetName(): Prepare and Preview share the single m_plater window, so the
4165 // window has no one correct name. The slot -> id lookup is the only correct resolution.
4166 int page_idx = m_tabpanel->FindPage(panel);
4167 wxString page_name = (page_idx == wxNOT_FOUND) ? wxString() : m_tabpanel->GetPageName(static_cast<size_t>(page_idx));
4168 if (page_name == TAB_ID_PREPARE && m_tabpanel->GetSelectedPageName() == TAB_ID_PREVIEW)
4169 return;
4170 //BBS GUI refactor: remove unused layout new/dlg
4171 /*if (page_idx != wxNOT_FOUND && m_layout == ESettingsLayout::Dlg)
4172 page_idx++;*/
4173 select_tab(page_name);
4174}

References m_param_panel, m_plater, m_tabpanel, select_tab(), TAB_ID_PREPARE, and TAB_ID_PREVIEW.

Referenced by init_tabpanel(), select_tab(), and Slic3r::GUI::Downloader::start_download().

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

◆ select_view()

void Slic3r::GUI::MainFrame::select_view ( const std::string & direction)
4349{
4350 if (m_plater)
4351 m_plater->select_view(direction);
4352}

References m_plater.

Referenced by add_common_view_menu_items(), and handle_global_shortcut().

Here is the caller graph for this function:

◆ set_em_unit()

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

References m_em_unit.

◆ set_max_recent_count()

void Slic3r::GUI::MainFrame::set_max_recent_count ( int max)
3817{
3818 max = max < 0 ? 0 : max > 999 ? 999 : max;
3819 size_t count = m_recent_projects.GetCount();
3820 m_recent_projects.SetMaxFiles(max);
3821 if (count != m_recent_projects.GetCount()) {
3822 count = m_recent_projects.GetCount();
3823 std::vector<std::string> recent_projects;
3824 for (size_t i = 0; i < count; ++i) {
3825 recent_projects.push_back(into_u8(m_recent_projects.GetHistoryFile(i)));
3826 }
3827 wxGetApp().app_config->set_recent_projects(recent_projects);
3828 wxGetApp().app_config->save();
3829 if (WebViewPanel* home = WebViewPanel::if_built())
3830 home->SendRecentList(-1);
3831 }
3832}

References count, Slic3r::GUI::LazyInstance< WebViewPanel >::if_built(), Slic3r::GUI::into_u8(), and m_recent_projects.

Here is the call graph for this function:

◆ set_prev_scale_factor()

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

References m_prev_scale_factor.

◆ set_print_button_to_default()

void Slic3r::GUI::MainFrame::set_print_button_to_default ( PrintSelectType select_type)
4405{
4406 // Orca: keep the user's remembered print/export action instead of resetting it to the computed
4407 // default. get_remembered_print_select() already rejects anything this printer does not offer.
4408 PrintSelectType remembered;
4409 if (get_remembered_print_select(remembered))
4410 select_type = remembered;
4411
4412 if (select_type == eUploadGcode)
4413 return; // unsupported: no dropdown entry exists for this action
4414
4415 m_print_btn->SetLabel(print_select_type_label(select_type));
4416 m_print_select = select_type;
4417 // get_enable_print_status() already applies can_send_gcode() to the actions that need it
4418 if (m_print_enable)
4420 m_print_btn->Enable(m_print_enable);
4421 this->Layout();
4422}

References eUploadGcode, get_enable_print_status(), get_remembered_print_select(), m_print_btn, m_print_enable, and m_print_select.

Here is the call graph for this function:

◆ set_scale_factor()

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

References m_scale_factor.

◆ set_undo_redo_enabled()

void Slic3r::GUI::MainFrame::set_undo_redo_enabled ( bool undo,
bool redo )
1429{
1430#ifndef __APPLE__
1431 m_topbar->EnableUndoRedo(undo, redo);
1432#else
1433 (void) undo; (void) redo; // macOS has no top bar; Edit asks the tab when it opens
1434#endif
1435}

References m_topbar.

◆ shortcut_label()

wxString Slic3r::GUI::MainFrame::shortcut_label ( const wxString & label,
Shortcut shortcut,
bool accelerator )
private
2832{
2833 const ShortcutRegistry& shortcuts = wxGetApp().shortcuts();
2834 if (accelerator) {
2835 const std::string accel = shortcuts.accelerator(shortcut);
2836 if (!accel.empty())
2837 return label + " " + from_u8(accel);
2838 }
2839 const std::string text = shortcuts.display(shortcut);
2840 return text.empty() ? label : label + sep + from_u8(text);
2841}

References Slic3r::GUI::ShortcutRegistry::accelerator(), Slic3r::GUI::ShortcutRegistry::display(), Slic3r::GUI::from_u8(), and Slic3r::GUI::sep.

Referenced by append_shortcut_item(), init_menubar_as_editor(), and update_shortcut_labels().

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

◆ Show()

bool Slic3r::GUI::MainFrame::Show ( bool show = true)
override
4186{
4187 const bool changed = DPIFrame::Show(show);
4188 if (show && changed && m_tabpanel != nullptr)
4189 if (wxWindow* page = m_tabpanel->GetCurrentPage())
4190 page->Show(true);
4191 return changed;
4192}

References m_tabpanel.

Referenced by shutdown().

Here is the caller graph for this function:

◆ show_device()

void Slic3r::GUI::MainFrame::show_device ( bool should_use_native)
1609 {
1610 auto idx = -1;
1611
1612 const bool use_printer_agents = wxGetApp().app_config->get_bool("use_printer_agents");
1613
1614 // The web Device page is the extra tab printer-agents mode shows alongside the native one.
1615 // Printers that drive the native Bambu device tab have nothing to put in it, so they don't
1616 // get it — otherwise a Bambu user sees two Device tabs, one of them permanently empty.
1617 const bool want_web_device_tab = use_printer_agents && wxGetApp().preset_bundle != nullptr &&
1618 !wxGetApp().preset_bundle->use_bbl_device_tab();
1619
1620 // Remove the extra page before switching to any layout that shouldn't have it.
1621 if (!want_web_device_tab) {
1622 if ((idx = m_tabpanel->FindPageByName(TAB_ID_MONITOR_WEB)) != wxNOT_FOUND) {
1623 m_printer_view_page->Show(false);
1624 m_tabpanel->RemovePage(idx);
1625 }
1626 }
1627
1628 if (use_printer_agents) {
1629 if (!m_monitor_page->in_book()) {
1630 if ((idx = m_tabpanel->FindPage(m_printer_view_page)) != wxNOT_FOUND) {
1631 m_printer_view_page->Show(false);
1632 m_tabpanel->RemovePage(idx);
1633 }
1634 m_monitor_page->Show(false);
1635 m_tabpanel->InsertPage(m_tabpanel->PositionAfter({TAB_ID_PREVIEW}), TAB_ID_MONITOR, m_monitor_page,
1636 _L("Device"), "tab_monitor_active");
1637 }
1638
1639 if (wxGetApp().is_enable_multi_machine()) {
1640 // TODO: change the bitmap
1641 if (!m_multi_machine_page->in_book()) {
1642 m_multi_machine_page->Show(false);
1643 // Past the web Device tab when it is already there, so enabling multi-machine
1644 // later can't wedge this page between the two Device tabs.
1645 m_tabpanel->InsertPage(m_tabpanel->PositionAfter({TAB_ID_MONITOR_WEB, TAB_ID_MONITOR}),
1646 TAB_ID_MULTI_DEVICE, m_multi_machine_page, _L("Multi-device"), "tab_multi_active");
1647 }
1648 }
1649 if (!m_calibration_page->in_book()) {
1650 m_calibration_page->Show(false);
1651 m_tabpanel->InsertPage(m_tabpanel->PositionAfter({TAB_ID_PROJECT}), TAB_ID_CALIBRATION, m_calibration_page,
1652 _L("Calibration"), "tab_calibration_active");
1653 }
1654
1655 if (want_web_device_tab) {
1656 if ((idx = m_tabpanel->FindPage(m_printer_view_page)) == wxNOT_FOUND) {
1657 m_printer_view_page->Show(false);
1658 // Immediately right of the native Device tab, not at the end of the tab bar.
1659 m_tabpanel->InsertPage(m_tabpanel->PositionAfter({TAB_ID_MONITOR}), TAB_ID_MONITOR_WEB,
1660 m_printer_view_page, _L("Device (Web)"), "tab_monitor_active");
1661 } else {
1662 m_tabpanel->SetPageText(idx, _L("Device (Web)"));
1663 }
1664 }
1665
1666#ifdef _MSW_DARK_MODE
1667 wxGetApp().UpdateDarkUIWin(this);
1668#endif // _MSW_DARK_MODE
1669
1670 fit_tab_labels(); // ORCA on printer change
1671 m_plugin_pages.relayout(); // re-sync plugin tabs against the native tabs just mutated above
1673 m_idle.start();
1674 return;
1675 }
1676
1677 if (should_use_native) {
1678 if (m_monitor_page->in_book()) {
1679 fit_tab_labels(); // ORCA on printer change - same button layout
1680 return;
1681 }
1682 // Remove printer view
1683 if ((idx = m_tabpanel->FindPage(m_printer_view_page)) != wxNOT_FOUND) {
1684 m_printer_view_page->Show(false);
1685 m_tabpanel->RemovePage(idx);
1686 }
1687
1688 // Insert monitor page
1689 m_monitor_page->Show(false);
1690 m_tabpanel->InsertPage(m_tabpanel->PositionAfter({TAB_ID_PREVIEW}), TAB_ID_MONITOR, m_monitor_page,
1691 _L("Device"), "tab_monitor_active");
1692
1693 if (wxGetApp().is_enable_multi_machine()) {
1694 // TODO: change the bitmap
1695 m_multi_machine_page->Show(false);
1696 m_tabpanel->InsertPage(m_tabpanel->PositionAfter({TAB_ID_MONITOR}), TAB_ID_MULTI_DEVICE, m_multi_machine_page,
1697 _L("Multi-device"), "tab_multi_active");
1698 }
1699 m_calibration_page->Show(false);
1700 // Last of the built-in tabs, but plugin tabs already sit past it — anchor rather than
1701 // append, so its position doesn't depend on the relayout() below running afterwards.
1702 m_tabpanel->InsertPage(m_tabpanel->PositionAfter({TAB_ID_PROJECT}), TAB_ID_CALIBRATION, m_calibration_page,
1703 _L("Calibration"), "tab_calibration_active");
1704
1705#ifdef _MSW_DARK_MODE
1706 wxGetApp().UpdateDarkUIWin(this);
1707#endif // _MSW_DARK_MODE
1708
1709 } else {
1710 if (m_printer_view_page->in_book()) {
1711 fit_tab_labels(); // ORCA on printer change - same button layout
1712 return;
1713 }
1714 if ((idx = m_tabpanel->FindPage(m_calibration_page)) != wxNOT_FOUND) {
1715 m_calibration_page->Show(false);
1716 m_tabpanel->RemovePage(idx);
1717 }
1718 if ((idx = m_tabpanel->FindPage(m_multi_machine_page)) != wxNOT_FOUND) {
1719 m_multi_machine_page->Show(false);
1720 m_tabpanel->RemovePage(idx);
1721 }
1722 if ((idx = m_tabpanel->FindPage(m_monitor_page)) != wxNOT_FOUND) {
1723 m_monitor_page->Show(false);
1724 m_tabpanel->RemovePage(idx);
1725 }
1726 m_printer_view_page->Show(false);
1727 m_tabpanel->InsertPage(m_tabpanel->PositionAfter({TAB_ID_PREVIEW}), TAB_ID_MONITOR, m_printer_view_page,
1728 _L("Device"), "tab_monitor_active");
1729 }
1730 fit_tab_labels(); // ORCA on printer change
1731 m_plugin_pages.relayout(); // re-sync plugin tabs against the native tabs just mutated above
1733 m_idle.start();
1734}

References _L, fit_tab_labels(), m_calibration_page, m_idle, m_monitor_page, m_multi_machine_page, m_plugin_pages, m_prebuild_started, m_printer_view_page, m_tabpanel, TAB_ID_CALIBRATION, TAB_ID_MONITOR, TAB_ID_MONITOR_WEB, and TAB_ID_MULTI_DEVICE.

Here is the call graph for this function:

◆ show_log_window()

void Slic3r::GUI::MainFrame::show_log_window ( )
1120{
1121 m_log_window = new wxLogWindow(this, _L("Logging"), true, false);
1122 m_log_window->Show();
1123}
wxLogWindow * m_log_window
Definition MainFrame.hpp:527

References _L, and m_log_window.

◆ show_option()

void Slic3r::GUI::MainFrame::show_option ( bool show)
1408{
1409 if (!show) {
1410 if (m_slice_btn->IsShown()) {
1411 m_slice_btn->Hide();
1412 m_print_btn->Hide();
1413 m_slice_option_btn->Hide();
1414 m_print_option_btn->Hide();
1415 Layout();
1416 }
1417 } else {
1418 if (!m_slice_btn->IsShown()) {
1419 m_slice_btn->Show();
1420 m_print_btn->Show();
1421 m_slice_option_btn->Show();
1422 m_print_option_btn->Show();
1423 Layout();
1424 }
1425 }
1426}

References m_print_btn, m_print_option_btn, m_slice_btn, and m_slice_option_btn.

◆ show_publish_button()

void Slic3r::GUI::MainFrame::show_publish_button ( bool show)
1395{
1396 // m_publish_btn->Show(show);
1397 // Layout();
1398}

◆ show_sync_dialog()

void Slic3r::GUI::MainFrame::show_sync_dialog ( )
4730{
4731 SimpleEvent* evt = new SimpleEvent(EVT_SYNC_CLOUD_PRESET);
4732 wxQueueEvent(this, evt);
4733}

◆ ShowModal()

int Slic3r::GUI::DPIAware< wxFrame >::ShowModal ( )
inlineinherited
217 {
218 dialogStack.push_front(this);
219 int r = wxDialog::ShowModal();
220 dialogStack.pop_front();
221 return r;
222 }

References Slic3r::GUI::dialogStack.

◆ shutdown()

void Slic3r::GUI::MainFrame::shutdown ( )
1293{
1294 BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "MainFrame::shutdown enter";
1295 m_idle.stop();
1296 if (ProjectPanel* project = ProjectPanel::if_built())
1297 project->shutdown();
1298 m_plugin_pages.shutdown();
1299 if (m_plater != nullptr)
1300 m_plater->remove_dock_panes();
1301#ifdef SLIC3R_CAD
1302 if (DesignPanel* design = DesignPanel::if_built())
1303 design->shutdown();
1304#endif
1305#ifdef __WXGTK__
1306 // Edge panels are child windows — wxWidgets destroys them automatically.
1307 m_edge_bottom = nullptr;
1308 m_edge_left = nullptr;
1309 m_edge_right = nullptr;
1310#endif
1311 // BBS: backup
1313#ifdef _WIN32
1314 if (m_hDeviceNotify) {
1315 ::UnregisterDeviceNotification(HDEVNOTIFY(m_hDeviceNotify));
1316 m_hDeviceNotify = nullptr;
1317 }
1318 if (m_ulSHChangeNotifyRegister) {
1319 SHChangeNotifyDeregister(m_ulSHChangeNotifyRegister);
1320 m_ulSHChangeNotifyRegister = 0;
1321 }
1322#endif // _WIN32
1323
1324 if (m_plater != nullptr) {
1325 m_plater->get_ui_job_worker().cancel_all();
1326
1327 // Unbinding of wxWidgets event handling in canvases needs to be done here because on MAC,
1328 // when closing the application using Command+Q, a mouse event is triggered after this lambda is completed,
1329 // causing a crash
1330 m_plater->unbind_canvas_event_handlers();
1331
1332 // Cleanup of canvases' volumes needs to be done here or a crash may happen on some Linux Debian flavours
1333 m_plater->reset_canvas_volumes();
1334 }
1335
1336 // Weird things happen as the Paint messages are floating around the windows being destructed.
1337 // Avoid the Paint messages by hiding the main window.
1338 // Also the application closes much faster without these unnecessary screen refreshes.
1339 // In addition, there were some crashes due to the Paint events sent to already destructed windows.
1340 this->Show(false);
1341
1342 if (m_settings_dialog.IsShown())
1343 // call Close() to trigger call to lambda defined into GUI_App::persist_window_geometry()
1344 m_settings_dialog.Close();
1345
1346 if (m_plater != nullptr) {
1347 // Stop the background thread (Windows and Linux).
1348 // Disconnect from a 3DConnextion driver (OSX).
1349 m_plater->get_mouse3d_controller().shutdown();
1350 // Store the device parameter database back to appconfig.
1351 m_plater->get_mouse3d_controller().save_config(*wxGetApp().app_config);
1352 }
1353
1354 // stop agent
1355 NetworkAgent* agent = wxGetApp().getAgent();
1356 if (agent)
1357 agent->track_enable(false);
1358
1359 // Stop the background thread of the removable drive manager, so that no new updates will be sent to the Plater.
1360 //wxGetApp().removable_drive_manager()->shutdown();
1361 //stop listening for messages from other instances
1362 wxGetApp().other_instance_message_handler()->shutdown(this);
1363 // Save the slic3r.ini.Usually the ini file is saved from "on idle" callback,
1364 // but in rare cases it may not have been called yet.
1365 if(wxGetApp().app_config->dirty())
1366 wxGetApp().app_config->save();
1367// if (m_plater)
1368// m_plater->print = undef;
1369// Slic3r::GUI::deregister_on_request_update_callback();
1370
1371 // set to null tabs and a plater
1372 // to avoid any manipulations with them from App->wxEVT_IDLE after of the mainframe closing
1373 wxGetApp().tabs_list.clear();
1374 wxGetApp().model_tabs_list.clear();
1375 wxGetApp().shutdown();
1376 // BBS: why clear ?
1377 //wxGetApp().plater_ = nullptr;
1378
1379 BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "MainFrame::shutdown exit";
1380}
bool Show(bool show=true) override
Definition MainFrame.cpp:4185

References Slic3r::GUI::LazyInstance< DesignPanel >::if_built(), Slic3r::GUI::LazyInstance< ProjectPanel >::if_built(), m_idle, m_plater, m_plugin_pages, m_settings_dialog, Slic3r::set_backup_callback(), Show(), and Slic3r::NetworkAgent::track_enable().

Here is the call graph for this function:

◆ technology_changed()

void Slic3r::GUI::MainFrame::technology_changed ( )
4643{
4644 // update menu titles
4646 if (int id = m_menubar->FindMenu(pt == ptFFF ? _omitL("Material Settings") : _L("Filament settings")); id != wxNOT_FOUND)
4647 m_menubar->SetMenuLabel(id, pt == ptSLA ? _omitL("Material Settings") : _L("Filament settings"));
4648}
PrinterTechnology printer_technology() const
Definition Plater.cpp:22155
#define _omitL(s)
Definition I18N.hpp:9

References _L, _omitL, m_menubar, plater(), Slic3r::GUI::Plater::printer_technology(), Slic3r::ptFFF, and Slic3r::ptSLA.

Here is the call graph for this function:

◆ topbar()

BBLTopbar * Slic3r::GUI::MainFrame::topbar ( )
inline
366{ return m_topbar; }

References m_topbar.

◆ update_em_unit()

void Slic3r::GUI::DPIAware< wxFrame >::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 }

References m_em_unit, and m_scale_factor.

◆ update_filament_tab_ui()

void Slic3r::GUI::MainFrame::update_filament_tab_ui ( )
1383{
1384 wxGetApp().get_tab(Preset::Type::TYPE_FILAMENT)->reload_config();
1385 wxGetApp().get_tab(Preset::Type::TYPE_FILAMENT)->update_dirty();
1386 wxGetApp().get_tab(Preset::Type::TYPE_FILAMENT)->update_tab_ui();
1387}
@ TYPE_FILAMENT
Definition Preset.hpp:248

References Slic3r::Preset::TYPE_FILAMENT.

◆ update_layout()

void Slic3r::GUI::MainFrame::update_layout ( )
1127{
1128 auto restore_to_creation = [this]() {
1129 auto clean_sizer = [](wxSizer* sizer) {
1130 while (!sizer->GetChildren().IsEmpty()) {
1131 sizer->Detach(0);
1132 }
1133 };
1134
1135 // On Linux m_plater needs to be removed from m_tabpanel before to reparent it
1136 int plater_page_id = m_tabpanel->FindPage(m_plater);
1137 if (plater_page_id != wxNOT_FOUND)
1138 m_tabpanel->RemovePage(plater_page_id);
1139
1140 if (m_plater->GetParent() != this)
1141 m_plater->Reparent(this);
1142
1143 if (m_tabpanel->GetParent() != this)
1144 m_tabpanel->Reparent(this);
1145
1146 plater_page_id = (m_plater_page != nullptr) ? m_tabpanel->FindPage(m_plater_page) : wxNOT_FOUND;
1147 if (plater_page_id != wxNOT_FOUND) {
1148 m_tabpanel->DeletePage(plater_page_id);
1149 m_plater_page = nullptr;
1150 }
1151
1152 clean_sizer(m_main_sizer);
1153 clean_sizer(m_settings_dialog.GetSizer());
1154
1155 if (m_settings_dialog.IsShown())
1156 m_settings_dialog.Close();
1157
1158 m_tabpanel->Hide();
1159 m_plater->Hide();
1160
1161 Layout();
1162 };
1163
1164 //BBS GUI refactor: remove unused layout new/dlg
1165 //ESettingsLayout layout = wxGetApp().is_gcode_viewer() ? ESettingsLayout::GCodeViewer : ESettingsLayout::Old;
1167
1168 if (m_layout == layout)
1169 return;
1170
1171 wxBusyCursor busy;
1172
1173 Freeze();
1174
1175 // Remove old settings
1177 restore_to_creation();
1178
1179 ESettingsLayout old_layout = m_layout;
1180 m_layout = layout;
1181
1182 // From the very beginning the Print settings should be selected
1183 //m_last_selected_tab = m_layout == ESettingsLayout::Dlg ? TAB_ID_HOME : TAB_ID_PREPARE;
1185
1186 // Set new settings
1187 switch (m_layout)
1188 {
1190 {
1191 m_plater->Reparent(m_tabpanel);
1192 // Right after Home — or first, when there is no Home tab (PositionAfter() would
1193 // append instead, and by now the other built-in tabs are already in place).
1194 const int home_idx = m_tabpanel->FindPageByName(TAB_ID_HOME);
1195 size_t prepare_pos = (home_idx == wxNOT_FOUND) ? 0 : static_cast<size_t>(home_idx) + 1;
1196#ifdef SLIC3R_CAD
1197 // Design sits between Home and Prepare, so it goes in first and pushes Prepare along.
1198 // The page only exists when the experimental CAD feature is enabled.
1199 if (m_design_page != nullptr) {
1200 m_design_page->Reparent(m_tabpanel);
1201 m_tabpanel->InsertPage(prepare_pos++, TAB_ID_DESIGN, m_design_page, _L("Design"), "tab_design_active");
1202 }
1203#endif
1204 m_tabpanel->InsertPage(prepare_pos, TAB_ID_PREPARE, m_plater, _L("Prepare"), "tab_3d_active");
1205 m_tabpanel->InsertPage(prepare_pos + 1, TAB_ID_PREVIEW, m_plater, _L("Preview"), "tab_preview_active");
1206 m_main_sizer->Add(m_tabpanel, 1, wxEXPAND | wxTOP, 0);
1207
1208 m_tabpanel->Bind(wxCUSTOMEVT_NOTEBOOK_SEL_CHANGED, [this](wxCommandEvent& evt)
1209 {
1210 // jump to 3deditor under preview_only mode
1211 if (evt.GetId() == m_tabpanel->FindPageByName(TAB_ID_PREPARE)) {
1212 Sidebar& sidebar = GUI::wxGetApp().sidebar();
1213 if (sidebar.need_auto_sync_after_connect_printer()) {
1214 sidebar.set_need_auto_sync_after_connect_printer(false);
1215 sidebar.sync_extruder_list();
1216 }
1217
1218 m_plater->update(true);
1219
1220 if (!preview_only_hint())
1221 return;
1222 }
1223 evt.Skip();
1224 });
1225
1226 m_plater->Show();
1227 m_tabpanel->Show();
1228
1229 break;
1230 }
1232 {
1233 m_main_sizer->Add(m_plater, 1, wxEXPAND);
1234 //BBS: add bed exclude area
1235 m_plater->set_bed_shape({{0.0, 0.0}, {200.0, 0.0}, {200.0, 200.0}, {0.0, 200.0}}, {}, {}, 0.0, {}, {}, {}, {}, true);
1236 m_plater->get_collapse_toolbar().set_enabled(false);
1237 m_plater->enable_sidebar(false);
1238 m_plater->Show();
1239 break;
1240 }
1241 default:
1242 break;
1243 }
1244
1245 //BBS GUI refactor: remove unused layout new/dlg
1246//#ifdef __APPLE__
1247// // Using SetMinSize() on Mac messes up the window position in some cases
1248// // cf. https://groups.google.com/forum/#!topic/wx-users/yUKPBBfXWO0
1249// // So, if we haven't possibility to set MinSize() for the MainFrame,
1250// // set the MinSize() as a half of regular for the m_plater and m_tabpanel, when settings layout is in slNew mode
1251// // Otherwise, MainFrame will be maximized by height
1252// if (m_layout == ESettingsLayout::New) {
1253// wxSize size = wxGetApp().get_min_size();
1254// size.SetHeight(int(0.5 * size.GetHeight()));
1255// m_plater->SetMinSize(size);
1256// m_tabpanel->SetMinSize(size);
1257// }
1258//#endif
1259
1260#ifdef __APPLE__
1261 m_plater->sidebar().change_top_border_for_mode_sizer(m_layout != ESettingsLayout::Old);
1262#endif
1263
1264 Layout();
1265 Thaw();
1266}
bool preview_only_hint()
Definition MainFrame.cpp:1771
wxWindow * m_plater_page
Definition MainFrame.hpp:538
ESettingsLayout
Definition MainFrame.hpp:299
@ Unknown
Definition MainFrame.hpp:301

References _L, GCodeViewer, m_last_selected_tab, m_layout, m_main_sizer, m_plater, m_plater_page, m_settings_dialog, m_tabpanel, Slic3r::GUI::Sidebar::need_auto_sync_after_connect_printer(), Old, preview_only_hint(), Slic3r::GUI::Sidebar::set_need_auto_sync_after_connect_printer(), Slic3r::GUI::Sidebar::sync_extruder_list(), TAB_ID_HOME, TAB_ID_PREPARE, TAB_ID_PREVIEW, and Unknown.

Here is the call graph for this function:

◆ update_menubar()

void Slic3r::GUI::MainFrame::update_menubar ( )
3923{
3924 if (wxGetApp().is_gcode_viewer())
3925 return;
3926
3927 const bool is_fff = plater()->printer_technology() == ptFFF;
3928}

References plater(), Slic3r::GUI::Plater::printer_technology(), and Slic3r::ptFFF.

Here is the call graph for this function:

◆ update_shortcut_labels()

void Slic3r::GUI::MainFrame::update_shortcut_labels ( )
2844{
2845 for (const ShortcutMenuItem& entry : m_shortcut_menu_items)
2846 entry.item->SetItemLabel(shortcut_label(entry.label, entry.shortcut, entry.accelerator));
2847}
Definition MainFrame.hpp:256

References m_shortcut_menu_items, and shortcut_label().

Here is the call graph for this function:

◆ update_side_button_style()

void Slic3r::GUI::MainFrame::update_side_button_style ( )
2609{
2610 // BBS
2611 int em = em_unit();
2612
2613 /*m_slice_btn->SetLayoutStyle(1);
2614 m_slice_btn->SetTextLayout(SideButton::EHorizontalOrientation::HO_Center, FromDIP(15));
2615 m_slice_btn->SetMinSize(wxSize(-1, FromDIP(24)));
2616 m_slice_btn->SetCornerRadius(FromDIP(12));
2617 m_slice_btn->SetExtraSize(wxSize(FromDIP(38), FromDIP(10)));
2618 m_slice_btn->SetBottomColour(wxColour(0x3B4446));*/
2619 StateColor m_btn_bg_enable = StateColor(
2620 std::pair<wxColour, int>(wxColour(0, 137, 123), StateColor::Pressed),
2621 std::pair<wxColour, int>(wxColour(48, 221, 112), StateColor::Hovered),
2622 std::pair<wxColour, int>(wxColour(0, 150, 136), StateColor::Normal)
2623 );
2624
2625 // m_publish_btn->SetMinSize(wxSize(FromDIP(125), FromDIP(24)));
2626 // m_publish_btn->SetCornerRadius(FromDIP(12));
2627 // m_publish_btn->SetBackgroundColor(m_btn_bg_enable);
2628 // m_publish_btn->SetBorderColor(m_btn_bg_enable);
2629 // m_publish_btn->SetBackgroundColour(wxColour(59,68,70));
2630 // m_publish_btn->SetTextColor(StateColor::darkModeColorFor("#FFFFFE"));
2631
2632 m_slice_btn->SetTextLayout(SideButton::EHorizontalOrientation::HO_Left, FromDIP(15));
2633 m_slice_btn->SetCornerRadius(FromDIP(12));
2634 m_slice_btn->SetExtraSize(wxSize(FromDIP(38), FromDIP(10)));
2635 m_slice_btn->SetMinSize(wxSize(-1, FromDIP(24)));
2636
2638 m_slice_option_btn->SetCornerRadius(FromDIP(12));
2639 m_slice_option_btn->SetExtraSize(wxSize(FromDIP(10), FromDIP(10)));
2640 m_slice_option_btn->SetIconOffset(FromDIP(2));
2641 m_slice_option_btn->SetMinSize(wxSize(FromDIP(24), FromDIP(24)));
2642
2643 m_print_btn->SetTextLayout(SideButton::EHorizontalOrientation::HO_Left, FromDIP(15));
2644 m_print_btn->SetCornerRadius(FromDIP(12));
2645 m_print_btn->SetExtraSize(wxSize(FromDIP(38), FromDIP(10)));
2646 m_print_btn->SetMinSize(wxSize(-1, FromDIP(24)));
2647
2649 m_print_option_btn->SetCornerRadius(FromDIP(12));
2650 m_print_option_btn->SetExtraSize(wxSize(FromDIP(10), FromDIP(10)));
2651 m_print_option_btn->SetIconOffset(FromDIP(2));
2652 m_print_option_btn->SetMinSize(wxSize(FromDIP(24), FromDIP(24)));
2653
2654 // Keep panel backgrounds in sync with SideButton's darkModeColorFor(#3B4446) bottom strip
2655 auto bg = StateColor::darkModeColorFor(wxColour("#3B4446"));
2656 m_slice_btn->GetParent()->SetBackgroundColour(bg);
2657 m_print_btn->GetParent()->SetBackgroundColour(bg);
2658}
@ HO_Center
Definition SideButton.hpp:27
@ HO_Left
Definition SideButton.hpp:26
@ Hovered
Definition StateColor.hpp:20
@ Normal
Definition StateColor.hpp:16
@ Pressed
Definition StateColor.hpp:21

References StateColor::darkModeColorFor(), Slic3r::GUI::DPIAware< wxFrame >::em_unit(), SideButton::HO_Center, SideButton::HO_Left, StateColor::Hovered, m_print_btn, m_print_option_btn, m_slice_btn, m_slice_option_btn, StateColor::Normal, and StateColor::Pressed.

Referenced by create_side_tools(), and on_dpi_changed().

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

◆ update_side_preset_ui()

void Slic3r::GUI::MainFrame::update_side_preset_ui ( )
4736{
4737 // select last preset
4738 for (auto tab : wxGetApp().tabs_list) {
4739 tab->update_tab_ui();
4740 }
4741
4742 //BBS: update the preset
4743 m_plater->sidebar().update_presets(Preset::TYPE_PRINTER);
4744 m_plater->sidebar().update_presets(Preset::TYPE_FILAMENT);
4745
4746
4747 //take off multi machine
4748 if (MultiMachinePage* multi_machine = MultiMachinePage::if_built())
4749 multi_machine->clear_page();
4750}

References Slic3r::GUI::LazyInstance< MultiMachinePage >::if_built(), m_plater, Slic3r::Preset::TYPE_FILAMENT, and Slic3r::Preset::TYPE_PRINTER.

Referenced by load_config_file(), on_select_default_preset(), and Slic3r::anonymous_namespace{PluginHostPresets.cpp}::reload_local_bundle().

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

◆ update_slice_print_status()

void Slic3r::GUI::MainFrame::update_slice_print_status ( SlicePrintEventType event,
bool can_slice = true,
bool can_print = true )
2661{
2662 bool enable_print = true, enable_slice = true;
2663
2664 if (!can_slice)
2665 {
2667 enable_slice = false;
2668 }
2669 if (!can_print)
2670 enable_print = false;
2671
2672
2673 //process print logic
2674 if (enable_print)
2675 {
2676 enable_print = get_enable_print_status();
2677 }
2678
2679 //process slice logic
2680 if (enable_slice)
2681 {
2682 enable_slice = get_enable_slice_status();
2683 }
2684
2685 bool old_slice_status = m_slice_btn->IsEnabled();
2686
2687 BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(" m_slice_select %1%: can_slice= %2%, can_print %3%, enable_slice %4%, enable_print %5% ")%m_slice_select % can_slice %can_print %enable_slice %enable_print;
2688 m_print_btn->Enable(enable_print);
2689 m_slice_btn->Enable(enable_slice);
2690 m_slice_enable = enable_slice;
2691 m_print_enable = enable_print;
2692
2693 if (!old_slice_status && enable_slice)
2694 m_plater->reset_check_status();
2695
2696 if (wxGetApp().mainframe)
2697 wxGetApp().plater()->update_title_dirty_status();
2698}
bool can_slice() const
Definition MainFrame.cpp:2079

References can_slice(), eSlicePlate, get_enable_print_status(), get_enable_slice_status(), m_plater, m_print_btn, m_print_enable, m_slice_btn, m_slice_enable, and m_slice_select.

Referenced by Slic3r::GUI::Plater::priv::on_process_completed(), and Slic3r::GUI::Plater::priv::update_background_process().

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

◆ update_title()

void Slic3r::GUI::MainFrame::update_title ( )
1390{
1391 return;
1392}

Referenced by Slic3r::GUI::ProjectDirtyStateManager::update_from_presets().

Here is the caller graph for this function:

◆ update_title_colour_after_set_title()

void Slic3r::GUI::MainFrame::update_title_colour_after_set_title ( )
1401{
1402#ifdef __APPLE__
1404#endif
1405}

References Slic3r::GUI::set_title_colour_after_set_title().

Here is the call graph for this function:

◆ update_ui_from_settings()

void Slic3r::GUI::MainFrame::update_ui_from_settings ( )
4721{
4722 if (m_plater)
4723 m_plater->update_ui_from_settings();
4724 for (auto tab: wxGetApp().tabs_list)
4725 tab->update_ui_from_settings();
4726}

References m_plater.

Member Data Documentation

◆ enable_multi_machine

bool Slic3r::GUI::MainFrame::enable_multi_machine { false }
private
201{ false };

Referenced by available_print_actions(), and create_side_tools().

◆ m_calib_menu

wxMenu* Slic3r::GUI::MainFrame::m_calib_menu {nullptr}
private
200{nullptr};

◆ m_calibration_page

LazyPage<CalibrationPanel>* Slic3r::GUI::MainFrame::m_calibration_page { nullptr }
523{ nullptr };

Referenced by init_tabpanel(), and show_device().

◆ m_can_rescale

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

Referenced by DPIAware().

◆ m_changeable_menu_items

std::vector<wxMenuItem*> Slic3r::GUI::MainFrame::m_changeable_menu_items
private

◆ m_cornering_calib_dlg

Cornering_Test_Dlg* Slic3r::GUI::MainFrame::m_cornering_calib_dlg { nullptr }
500{ nullptr };

◆ m_diff_dialog

Lazy<DiffPresetDialog> Slic3r::GUI::MainFrame::m_diff_dialog

◆ m_em_unit

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

◆ m_filament_group_popup

FilamentGroupPopup* Slic3r::GUI::MainFrame::m_filament_group_popup { nullptr }

◆ m_flow_rate_calib_dlg

FlowRateCalibrationDialog* Slic3r::GUI::MainFrame::m_flow_rate_calib_dlg { nullptr }
493{ nullptr };

Referenced by run_calibration().

◆ m_force_rescale

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

Referenced by DPIAware(), enable_force_rescale(), force_rescale(), and rescale().

◆ m_home_page

LazyPage<WebViewPanel>* Slic3r::GUI::MainFrame::m_home_page { nullptr }
524{ nullptr };

Referenced by init_tabpanel().

◆ m_idle

IdleScheduler Slic3r::GUI::MainFrame::m_idle
private

◆ m_IS_damp_calib_dlg

Input_Shaping_Damp_Test_Dlg* Slic3r::GUI::MainFrame::m_IS_damp_calib_dlg { nullptr }
499{ nullptr };

◆ m_IS_freq_calib_dlg

Input_Shaping_Freq_Test_Dlg* Slic3r::GUI::MainFrame::m_IS_freq_calib_dlg { nullptr }
498{ nullptr };

◆ m_last_config

wxString Slic3r::GUI::MainFrame::m_last_config = wxEmptyString
private

Referenced by export_config(), and load_config_file().

◆ m_last_selected_tab

wxString Slic3r::GUI::MainFrame::m_last_selected_tab
private

◆ m_layout

ESettingsLayout Slic3r::GUI::MainFrame::m_layout { ESettingsLayout::Unknown }
private

◆ m_lazy_pages

std::vector<LazyBase*> Slic3r::GUI::MainFrame::m_lazy_pages
private

◆ m_loaded

bool Slic3r::GUI::MainFrame::m_loaded {false}
private
151{false};

Referenced by is_loaded().

◆ m_log_window

wxLogWindow* Slic3r::GUI::MainFrame::m_log_window { nullptr }
527{ nullptr };

Referenced by show_log_window().

◆ m_main_sizer

wxSizer* Slic3r::GUI::MainFrame::m_main_sizer { nullptr }
private
207{ nullptr };

Referenced by update_layout().

◆ m_menu_item_reslice_now

wxMenuItem* Slic3r::GUI::MainFrame::m_menu_item_reslice_now { nullptr }
private
206{ nullptr };

◆ m_menubar

wxMenuBar* Slic3r::GUI::MainFrame::m_menubar { nullptr }
private

◆ m_monitor_page

LazyPage<MonitorPanel>* Slic3r::GUI::MainFrame::m_monitor_page { nullptr }

◆ m_multi_machine_page

LazyPage<MultiMachinePage>* Slic3r::GUI::MainFrame::m_multi_machine_page { nullptr }
520{ nullptr };

Referenced by init_tabpanel(), jump_to_multipage(), and show_device().

◆ m_new_font_point_size

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

Referenced by DPIAware().

◆ m_normal_font

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

Referenced by DPIAware(), normal_font(), and rescale().

◆ m_pa_calib_dlg

PA_Calibration_Dlg* Slic3r::GUI::MainFrame::m_pa_calib_dlg { nullptr }
492{ nullptr };

Referenced by run_calibration().

◆ m_param_dialog

ParamsDialog* Slic3r::GUI::MainFrame::m_param_dialog { nullptr }
533{ nullptr };

Referenced by create_preset_tabs(), and is_active_and_shown_tab().

◆ m_param_panel

◆ m_plater

◆ m_plater_page

wxWindow* Slic3r::GUI::MainFrame::m_plater_page { nullptr }
538{ nullptr };

Referenced by update_layout().

◆ m_plugin_pages

PluginPages Slic3r::GUI::MainFrame::m_plugin_pages

◆ m_prebuild_started

bool Slic3r::GUI::MainFrame::m_prebuild_started { false }
private
154{ false };

Referenced by prebuild_pages_when_idle(), and show_device().

◆ m_prev_scale_factor

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

◆ m_print_btn

◆ m_print_enable

bool Slic3r::GUI::MainFrame::m_print_enable { true }
mutable

◆ m_print_option_btn

SideButton* Slic3r::GUI::MainFrame::m_print_option_btn { nullptr }

◆ m_print_select

int Slic3r::GUI::MainFrame::m_print_select { ePrintAll }
mutable

◆ m_printer_api_key

wxString Slic3r::GUI::MainFrame::m_printer_api_key
private

Referenced by init_tabpanel().

◆ m_printer_url

wxString Slic3r::GUI::MainFrame::m_printer_url
private

Referenced by init_tabpanel().

◆ m_printer_view_page

LazyPage<PrinterWebView>* Slic3r::GUI::MainFrame::m_printer_view_page {nullptr}
525{nullptr};

Referenced by init_tabpanel(), and show_device().

◆ m_printhost_queue_dlg

PrintHostQueueDialog* Slic3r::GUI::MainFrame::m_printhost_queue_dlg

◆ m_project_page

LazyPage<ProjectPanel>* Slic3r::GUI::MainFrame::m_project_page { nullptr }
521{ nullptr };

Referenced by init_tabpanel().

◆ m_qs_last_input_file

wxString Slic3r::GUI::MainFrame::m_qs_last_input_file = wxEmptyString
private

Referenced by is_last_input_file().

◆ m_qs_last_output_file

wxString Slic3r::GUI::MainFrame::m_qs_last_output_file = wxEmptyString
private

◆ m_recent_projects

◆ m_reset_title_text_colour_timer

wxTimer* Slic3r::GUI::MainFrame::m_reset_title_text_colour_timer { nullptr }
private
152{ nullptr };

◆ m_retraction_calib_dlg

Retraction_Test_Dlg* Slic3r::GUI::MainFrame::m_retraction_calib_dlg { nullptr }
497{ nullptr };

Referenced by run_calibration().

◆ m_scale_factor

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

◆ m_settings_dialog

SettingsDialog Slic3r::GUI::MainFrame::m_settings_dialog

◆ m_shortcut_menu_items

std::vector<ShortcutMenuItem> Slic3r::GUI::MainFrame::m_shortcut_menu_items
private

◆ m_side_tools

wxBoxSizer* Slic3r::GUI::MainFrame::m_side_tools { nullptr }
531{ nullptr };

◆ m_slice_btn

SideButton* Slic3r::GUI::MainFrame::m_slice_btn { nullptr }

◆ m_slice_enable

bool Slic3r::GUI::MainFrame::m_slice_enable { true }
mutable

◆ m_slice_option_btn

SideButton* Slic3r::GUI::MainFrame::m_slice_option_btn { nullptr }

◆ m_slice_option_pop_up

SidePopup* Slic3r::GUI::MainFrame::m_slice_option_pop_up { nullptr }
550{ nullptr };

Referenced by create_side_tools().

◆ m_slice_select

int Slic3r::GUI::MainFrame::m_slice_select { eSliceAll }
mutable

◆ m_tabpanel

◆ m_temp_calib_dlg

Temp_Calibration_Dlg* Slic3r::GUI::MainFrame::m_temp_calib_dlg { nullptr }
494{ nullptr };

Referenced by run_calibration().

◆ m_topbar

BBLTopbar* Slic3r::GUI::MainFrame::m_topbar { nullptr }

◆ m_vfa_test_dlg

VFA_Test_Dlg* Slic3r::GUI::MainFrame::m_vfa_test_dlg { nullptr }
496{ nullptr };

Referenced by run_calibration().

◆ m_vol_test_dlg

MaxVolumetricSpeed_Test_Dlg* Slic3r::GUI::MainFrame::m_vol_test_dlg { nullptr }
495{ nullptr };

Referenced by run_calibration().

◆ preview_only_to_editor

bool Slic3r::GUI::MainFrame::preview_only_to_editor = false
private

Referenced by preview_only_hint().

◆ this [1/2]

Slic3r::GUI::MainFrame::PrepareLayoutPrebuild * Slic3r::GUI::MainFrame::this
private

◆ this [2/2]

Slic3r::GUI::MainFrame::GLResourcesPrebuild * Slic3r::GUI::MainFrame::this
private

Referenced by MainFrame().


The documentation for this class was generated from the following files:
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/MainFrame.hpp
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/MainFrame.cpp