mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-11-02 20:51:23 -07:00 
			
		
		
		
	NEW:add some new changes for send print job
1. change tray id like to A1, B1, C1, D1 2. can change the name of the project that is sent 3. add ams mapping instructions Change-Id: If301f4051f640157a53d6927a0ddf2facf4961b4
This commit is contained in:
		
							parent
							
								
									06ac3f73a6
								
							
						
					
					
						commit
						46dc96fddf
					
				
					 15 changed files with 567 additions and 21 deletions
				
			
		| 
						 | 
				
			
			@ -379,11 +379,12 @@ std::vector<TrayData> AmsMapingPopup::parse_ams_mapping(std::map<std::string, Am
 | 
			
		|||
void AmsMapingPopup::add_ams_mapping(std::vector<TrayData> tray_data)
 | 
			
		||||
{ 
 | 
			
		||||
    auto sizer_mapping_list = new wxBoxSizer(wxHORIZONTAL);
 | 
			
		||||
 | 
			
		||||
    for (auto i = 0; i < tray_data.size(); i++) {
 | 
			
		||||
        wxBoxSizer *sizer_mapping_item   = new wxBoxSizer(wxVERTICAL);
 | 
			
		||||
 | 
			
		||||
        // set number
 | 
			
		||||
        auto number = new wxStaticText(this, wxID_ANY, wxString::Format("%02d",tray_data[i].id + 1), wxDefaultPosition, wxDefaultSize, 0);
 | 
			
		||||
        auto number = new wxStaticText(this, wxID_ANY, wxGetApp().transition_tridid(tray_data[i].id), wxDefaultPosition, wxDefaultSize, 0);
 | 
			
		||||
        number->SetFont(::Label::Body_13);
 | 
			
		||||
        number->SetForegroundColour(wxColour(0X6B, 0X6B, 0X6B));
 | 
			
		||||
        number->Wrap(-1);
 | 
			
		||||
| 
						 | 
				
			
			@ -476,9 +477,11 @@ void AmsMapingPopup::paintEvent(wxPaintEvent &evt)
 | 
			
		|||
 | 
			
		||||
void MappingItem::send_event(int fliament_id) 
 | 
			
		||||
{
 | 
			
		||||
    auto number = wxGetApp().transition_tridid(m_tray_data.id);
 | 
			
		||||
    wxCommandEvent event(EVT_SET_FINISH_MAPPING);
 | 
			
		||||
    event.SetInt(m_tray_data.id);
 | 
			
		||||
    wxString param = wxString::Format("%d|%d|%d|%02d|%d", m_coloul.Red(), m_coloul.Green(), m_coloul.Blue(), m_tray_data.id + 1, fliament_id);
 | 
			
		||||
 | 
			
		||||
    wxString param = wxString::Format("%d|%d|%d|%s|%d", m_coloul.Red(), m_coloul.Green(), m_coloul.Blue(), number, fliament_id);
 | 
			
		||||
    event.SetString(param);
 | 
			
		||||
    event.SetEventObject(this->GetParent()->GetParent());
 | 
			
		||||
    wxPostEvent(this->GetParent()->GetParent(), event);
 | 
			
		||||
| 
						 | 
				
			
			@ -655,4 +658,107 @@ void AmsMapingTipPopup::OnDismiss() {}
 | 
			
		|||
bool AmsMapingTipPopup::ProcessLeftDown(wxMouseEvent &event) { 
 | 
			
		||||
    return wxPopupTransientWindow::ProcessLeftDown(event); }
 | 
			
		||||
 | 
			
		||||
AmsTutorialPopup::AmsTutorialPopup(wxWindow* parent)
 | 
			
		||||
:wxPopupTransientWindow(parent, wxBORDER_NONE)
 | 
			
		||||
{
 | 
			
		||||
    Bind(wxEVT_PAINT, &AmsTutorialPopup::paintEvent, this);
 | 
			
		||||
    SetBackgroundColour(*wxWHITE);
 | 
			
		||||
 | 
			
		||||
    wxBoxSizer* sizer_main;
 | 
			
		||||
    sizer_main = new wxBoxSizer(wxVERTICAL);
 | 
			
		||||
 | 
			
		||||
    text_title = new Label(this, Label::Head_14, _L("Config which AMS slot should be used for a filament used in the print job"));
 | 
			
		||||
    text_title->SetSize(wxSize(FromDIP(350), -1));
 | 
			
		||||
    text_title->Wrap(FromDIP(350));
 | 
			
		||||
    sizer_main->Add(text_title, 0, wxALIGN_CENTER | wxTOP, 18);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    sizer_main->Add(0, 0, 0, wxTOP, 30);
 | 
			
		||||
 | 
			
		||||
    wxBoxSizer* sizer_top;
 | 
			
		||||
    sizer_top = new wxBoxSizer(wxHORIZONTAL);
 | 
			
		||||
 | 
			
		||||
    img_top = new wxStaticBitmap(this, wxID_ANY, create_scaled_bitmap("ams_item_examples", this, 30), wxDefaultPosition, wxSize(FromDIP(50), FromDIP(30)), 0);
 | 
			
		||||
    sizer_top->Add(img_top, 0, wxALIGN_CENTER, 0);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    sizer_top->Add(0, 0, 0, wxLEFT, 10);
 | 
			
		||||
 | 
			
		||||
    wxBoxSizer* sizer_top_tips = new wxBoxSizer(wxVERTICAL);
 | 
			
		||||
    wxBoxSizer* sizer_tip_top = new wxBoxSizer(wxHORIZONTAL);
 | 
			
		||||
 | 
			
		||||
    arrows_top = new wxStaticBitmap(this, wxID_ANY, create_scaled_bitmap("ams_arrow", this, 8), wxDefaultPosition, wxSize(FromDIP(24), FromDIP(8)), 0);
 | 
			
		||||
    sizer_tip_top->Add(arrows_top, 0, wxALIGN_CENTER, 0);
 | 
			
		||||
 | 
			
		||||
    tip_top = new wxStaticText(this, wxID_ANY, _L("Filament used in this print job"), wxDefaultPosition, wxDefaultSize, 0);
 | 
			
		||||
    tip_top->SetForegroundColour(wxColour("#686868"));
 | 
			
		||||
    
 | 
			
		||||
    sizer_tip_top->Add(tip_top, 0, wxALL, 0);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    sizer_top_tips->Add(sizer_tip_top, 0, wxEXPAND, 0);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    sizer_top_tips->Add(0, 0, 0, wxTOP, 6);
 | 
			
		||||
 | 
			
		||||
    wxBoxSizer* sizer_tip_bottom = new wxBoxSizer(wxHORIZONTAL);
 | 
			
		||||
 | 
			
		||||
    arrows_bottom = new wxStaticBitmap(this, wxID_ANY, create_scaled_bitmap("ams_arrow", this, 8), wxDefaultPosition, wxSize(FromDIP(24), FromDIP(8)), 0);
 | 
			
		||||
    tip_bottom = new wxStaticText(this, wxID_ANY, _L("AMS slot used for this filament"), wxDefaultPosition, wxDefaultSize, 0);
 | 
			
		||||
    tip_bottom->SetForegroundColour(wxColour("#686868"));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    sizer_tip_bottom->Add(arrows_bottom, 0, wxALIGN_CENTER, 0);
 | 
			
		||||
    sizer_tip_bottom->Add(tip_bottom, 0, wxALL, 0);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    sizer_top_tips->Add(sizer_tip_bottom, 0, wxEXPAND, 0);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    sizer_top->Add(sizer_top_tips, 0, wxALIGN_CENTER, 0);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    wxBoxSizer* sizer_middle = new wxBoxSizer(wxHORIZONTAL);
 | 
			
		||||
 | 
			
		||||
    img_middle= new wxStaticBitmap(this, wxID_ANY, create_scaled_bitmap("ams_item_examples", this, 30), wxDefaultPosition, wxSize(FromDIP(50), FromDIP(30)), 0);
 | 
			
		||||
    sizer_middle->Add(img_middle, 0, wxALIGN_CENTER, 0);
 | 
			
		||||
 | 
			
		||||
    tip_middle = new wxStaticText(this, wxID_ANY, _L("Click to select AMS slot manually"), wxDefaultPosition, wxDefaultSize, 0);
 | 
			
		||||
    tip_middle->SetForegroundColour(wxColour("#686868"));
 | 
			
		||||
    sizer_middle->Add(0, 0, 0,wxLEFT, 15);
 | 
			
		||||
    sizer_middle->Add(tip_middle, 0, wxALIGN_CENTER, 0);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    sizer_main->Add(sizer_top, 0, wxLEFT, 40);
 | 
			
		||||
    sizer_main->Add(0, 0, 0, wxTOP, 10);
 | 
			
		||||
    sizer_main->Add(sizer_middle, 0, wxLEFT, 40);
 | 
			
		||||
    sizer_main->Add(0, 0, 0, wxTOP, 10);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    img_botton = new wxStaticBitmap(this, wxID_ANY, create_scaled_bitmap("ams_mapping_examples", this, 87), wxDefaultPosition, wxDefaultSize, 0);
 | 
			
		||||
    sizer_main->Add(img_botton, 0, wxLEFT | wxRIGHT, 40);
 | 
			
		||||
    sizer_main->Add(0, 0, 0, wxTOP, 12);
 | 
			
		||||
 | 
			
		||||
    SetSizer(sizer_main);
 | 
			
		||||
    Layout();
 | 
			
		||||
    Fit();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AmsTutorialPopup::paintEvent(wxPaintEvent& evt)
 | 
			
		||||
{
 | 
			
		||||
    wxPaintDC dc(this);
 | 
			
		||||
    dc.SetPen(wxColour(0xAC, 0xAC, 0xAC));
 | 
			
		||||
    dc.SetBrush(*wxTRANSPARENT_BRUSH);
 | 
			
		||||
    dc.DrawRoundedRectangle(0, 0, GetSize().x, GetSize().y, 0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AmsTutorialPopup::OnDismiss() {}
 | 
			
		||||
 | 
			
		||||
bool AmsTutorialPopup::ProcessLeftDown(wxMouseEvent& event) {
 | 
			
		||||
    return wxPopupTransientWindow::ProcessLeftDown(event);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}} // namespace Slic3r::GUI
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -158,6 +158,27 @@ public:
 | 
			
		|||
    wxStaticText *   m_tip_disable_ams;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class AmsTutorialPopup : public wxPopupTransientWindow
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    Label* text_title;
 | 
			
		||||
    wxStaticBitmap* img_top;
 | 
			
		||||
    wxStaticBitmap* arrows_top;
 | 
			
		||||
    wxStaticText* tip_top;
 | 
			
		||||
    wxStaticBitmap* arrows_bottom;
 | 
			
		||||
    wxStaticText* tip_bottom;
 | 
			
		||||
    wxStaticBitmap* img_middle;
 | 
			
		||||
    wxStaticText* tip_middle;
 | 
			
		||||
    wxStaticBitmap* img_botton;
 | 
			
		||||
 | 
			
		||||
    AmsTutorialPopup(wxWindow* parent);
 | 
			
		||||
    ~AmsTutorialPopup() {};
 | 
			
		||||
 | 
			
		||||
    void paintEvent(wxPaintEvent& evt);
 | 
			
		||||
    virtual void OnDismiss() wxOVERRIDE;
 | 
			
		||||
    virtual bool ProcessLeftDown(wxMouseEvent& event) wxOVERRIDE;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
wxDECLARE_EVENT(EVT_SET_FINISH_MAPPING, wxCommandEvent);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3129,6 +3129,14 @@ void GUI_App::load_gcode(wxWindow* parent, wxString& input_file) const
 | 
			
		|||
        input_file = dialog.GetPath();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
wxString GUI_App::transition_tridid(int trid_id)
 | 
			
		||||
{
 | 
			
		||||
    wxString maping_dict[8] = { "A", "B", "C", "D", "E", "F", "G" };
 | 
			
		||||
    int id_index = ceil(trid_id / 4);
 | 
			
		||||
    int id_suffix = (trid_id + 1) % 4 == 0 ? 4 : (trid_id + 1) % 4;
 | 
			
		||||
    return wxString::Format("%s%d", maping_dict[id_index], id_suffix);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//BBS
 | 
			
		||||
void GUI_App::request_login(bool show_user_info)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -364,6 +364,7 @@ public:
 | 
			
		|||
    void            import_model(wxWindow *parent, wxArrayString& input_files) const;
 | 
			
		||||
    void            load_gcode(wxWindow* parent, wxString& input_file) const;
 | 
			
		||||
 | 
			
		||||
    wxString transition_tridid(int trid_id);
 | 
			
		||||
    void            ShowUserGuide();
 | 
			
		||||
    void            ShowDownNetPluginDlg();
 | 
			
		||||
    void            ShowUserLogin();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -146,7 +146,8 @@ void PrintJob::process()
 | 
			
		|||
 | 
			
		||||
    BBL::PrintParams params;
 | 
			
		||||
    params.dev_id = m_dev_id;
 | 
			
		||||
    params.project_name = project_name;
 | 
			
		||||
    //params.project_name = project_name;
 | 
			
		||||
    params.project_name = m_project_name + ".gcode.3mf";
 | 
			
		||||
    params.preset_name = wxGetApp().preset_bundle->prints.get_selected_preset_name();
 | 
			
		||||
    params.filename = job_data._3mf_path.string();
 | 
			
		||||
    params.config_filename = job_data._3mf_config_path.string();
 | 
			
		||||
| 
						 | 
				
			
			@ -339,4 +340,9 @@ void PrintJob::finalize() {
 | 
			
		|||
    Job::finalize();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void PrintJob::set_project_name(std::string name)
 | 
			
		||||
{
 | 
			
		||||
    m_project_name = name;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
}} // namespace Slic3r::GUI
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -37,7 +37,7 @@ protected:
 | 
			
		|||
public:
 | 
			
		||||
    PrintJob(std::shared_ptr<ProgressIndicator> pri, Plater *plater, std::string dev_id = "");
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    std::string m_project_name;
 | 
			
		||||
    std::string m_dev_ip;
 | 
			
		||||
    std::string m_access_code;
 | 
			
		||||
    std::string task_bed_type;
 | 
			
		||||
| 
						 | 
				
			
			@ -75,6 +75,7 @@ public:
 | 
			
		|||
    wxString get_http_error_msg(unsigned int status, std::string body);
 | 
			
		||||
    void process() override;
 | 
			
		||||
    void finalize() override;
 | 
			
		||||
    void set_project_name(std::string name);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
}} // namespace Slic3r::GUI
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -150,9 +150,7 @@ void SendJob::process()
 | 
			
		|||
 | 
			
		||||
    BBL::PrintParams params;
 | 
			
		||||
    params.dev_id = m_dev_id;
 | 
			
		||||
    //params.project_name = wxGetApp().plater()->get_project_name().ToUTF8().data();
 | 
			
		||||
    params.project_name = wxGetApp().plater()->get_project_name().utf8_string();
 | 
			
		||||
 | 
			
		||||
    params.project_name = m_project_name + ".gcode.3mf";
 | 
			
		||||
    params.preset_name = wxGetApp().preset_bundle->prints.get_selected_preset_name();
 | 
			
		||||
    params.filename = job_data._3mf_path.string();
 | 
			
		||||
    params.config_filename = job_data._3mf_config_path.string();
 | 
			
		||||
| 
						 | 
				
			
			@ -327,4 +325,9 @@ void SendJob::finalize() {
 | 
			
		|||
    Job::finalize();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SendJob::set_project_name(std::string name)
 | 
			
		||||
{
 | 
			
		||||
    m_project_name = name;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
}} // namespace Slic3r::GUI
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -30,7 +30,7 @@ protected:
 | 
			
		|||
public:
 | 
			
		||||
    SendJob(std::shared_ptr<ProgressIndicator> pri, Plater *plater, std::string dev_id = "");
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    std::string m_project_name;
 | 
			
		||||
    std::string m_dev_ip;
 | 
			
		||||
    std::string m_access_code;
 | 
			
		||||
    std::string task_bed_type;
 | 
			
		||||
| 
						 | 
				
			
			@ -53,6 +53,7 @@ public:
 | 
			
		|||
    void process() override;
 | 
			
		||||
    void on_success(std::function<void()> success);
 | 
			
		||||
    void finalize() override;
 | 
			
		||||
    void set_project_name(std::string name);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
}}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -922,6 +922,7 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater)
 | 
			
		|||
    , m_plater(plater), m_export_3mf_cancel(false)
 | 
			
		||||
    , m_mapping_popup(AmsMapingPopup(this))
 | 
			
		||||
    , m_mapping_tip_popup(AmsMapingTipPopup(this))
 | 
			
		||||
    , m_mapping_tutorial_popup(AmsTutorialPopup(this))
 | 
			
		||||
{
 | 
			
		||||
#ifdef __WINDOWS__
 | 
			
		||||
    SetDoubleBuffered(true);
 | 
			
		||||
| 
						 | 
				
			
			@ -954,6 +955,73 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater)
 | 
			
		|||
    m_scrollable_region       = new wxPanel(m_scrollable_view, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
 | 
			
		||||
    m_sizer_scrollable_region = new wxBoxSizer(wxVERTICAL); 
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    //rename normal
 | 
			
		||||
    m_rename_switch_panel = new wxSimplebook(m_scrollable_region);
 | 
			
		||||
    m_rename_switch_panel->SetSize(wxSize(FromDIP(420), FromDIP(25)));
 | 
			
		||||
    m_rename_switch_panel->SetMinSize(wxSize(FromDIP(420), FromDIP(25)));
 | 
			
		||||
    m_rename_switch_panel->SetMaxSize(wxSize(FromDIP(420), FromDIP(25)));
 | 
			
		||||
 | 
			
		||||
    m_rename_normal_panel = new wxPanel(m_rename_switch_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
 | 
			
		||||
    m_rename_normal_panel->SetBackgroundColour(*wxWHITE);
 | 
			
		||||
    rename_sizer_v = new wxBoxSizer(wxVERTICAL);
 | 
			
		||||
    rename_sizer_h = new wxBoxSizer(wxHORIZONTAL);
 | 
			
		||||
 | 
			
		||||
    m_rename_text = new wxStaticText(m_rename_normal_panel, wxID_ANY, wxT("MyLabel"), wxDefaultPosition, wxDefaultSize, 0);
 | 
			
		||||
    m_rename_text->SetFont(::Label::Body_13);
 | 
			
		||||
    m_rename_text->SetMaxSize(wxSize(FromDIP(390), -1));
 | 
			
		||||
    m_rename_button = new Button(m_rename_normal_panel, "", "ams_editable", wxBORDER_NONE, FromDIP(10));
 | 
			
		||||
    m_rename_button->SetBackgroundColor(*wxWHITE);
 | 
			
		||||
    m_rename_button->SetBackgroundColour(*wxWHITE);
 | 
			
		||||
 | 
			
		||||
    rename_sizer_h->Add(m_rename_text, 0, wxALIGN_CENTER, 0);
 | 
			
		||||
    rename_sizer_h->Add(m_rename_button, 0, wxALIGN_CENTER, 0);
 | 
			
		||||
    rename_sizer_v->Add(rename_sizer_h, 1, wxALIGN_CENTER, 0);
 | 
			
		||||
    m_rename_normal_panel->SetSizer(rename_sizer_v);
 | 
			
		||||
    m_rename_normal_panel->Layout();
 | 
			
		||||
    rename_sizer_v->Fit(m_rename_normal_panel);
 | 
			
		||||
 | 
			
		||||
    //rename edit
 | 
			
		||||
    auto m_rename_edit_panel = new wxPanel(m_rename_switch_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
 | 
			
		||||
    m_rename_edit_panel->SetBackgroundColour(*wxWHITE);
 | 
			
		||||
    auto rename_edit_sizer_v = new wxBoxSizer(wxVERTICAL);
 | 
			
		||||
 | 
			
		||||
    m_rename_input = new ::TextInput(m_rename_edit_panel, wxEmptyString, wxEmptyString, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER);
 | 
			
		||||
    m_rename_input->GetTextCtrl()->SetFont(::Label::Body_13);
 | 
			
		||||
    m_rename_input->SetSize(wxSize(FromDIP(380), FromDIP(24)));
 | 
			
		||||
    m_rename_input->SetMinSize(wxSize(FromDIP(380), FromDIP(24)));
 | 
			
		||||
    m_rename_input->SetMaxSize(wxSize(FromDIP(380), FromDIP(24)));
 | 
			
		||||
    rename_edit_sizer_v->Add(m_rename_input, 1, wxALIGN_CENTER, 0);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    m_rename_edit_panel->SetSizer(rename_edit_sizer_v);
 | 
			
		||||
    m_rename_edit_panel->Layout();
 | 
			
		||||
    rename_edit_sizer_v->Fit(m_rename_edit_panel);
 | 
			
		||||
 | 
			
		||||
    m_rename_input->Bind(wxEVT_TEXT_ENTER, &SelectMachineDialog::on_rename_enter, this);
 | 
			
		||||
    m_rename_button->Bind(wxEVT_BUTTON, &SelectMachineDialog::on_rename_click, this);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    m_rename_switch_panel->AddPage(m_rename_normal_panel, wxEmptyString, true);
 | 
			
		||||
    m_rename_switch_panel->AddPage(m_rename_edit_panel, wxEmptyString, false);
 | 
			
		||||
 | 
			
		||||
    Bind(wxEVT_CHAR_HOOK, [this](wxKeyEvent& e) {
 | 
			
		||||
        if (e.GetKeyCode() == WXK_ESCAPE) {
 | 
			
		||||
            if (m_rename_switch_panel->GetSelection() == 0) {
 | 
			
		||||
                e.Skip();
 | 
			
		||||
            }
 | 
			
		||||
            else {
 | 
			
		||||
                m_rename_switch_panel->SetSelection(0);
 | 
			
		||||
                m_rename_text->SetLabel(m_current_project_name);
 | 
			
		||||
                m_rename_normal_panel->Layout();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            e.Skip();
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    m_panel_image = new wxPanel(m_scrollable_region, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
 | 
			
		||||
    m_panel_image->SetBackgroundColour(m_colour_def_color);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -983,7 +1051,38 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater)
 | 
			
		|||
    m_sizer_basic_time->Add(m_stext_weight, 0, wxALL, FromDIP(5));
 | 
			
		||||
    m_sizer_basic->Add(m_sizer_basic_time, 0, wxALIGN_CENTER, 0);
 | 
			
		||||
 | 
			
		||||
    m_sizer_material = new wxGridSizer(0, 4, 0, 0);
 | 
			
		||||
    auto m_sizer_material_area = new wxBoxSizer(wxHORIZONTAL);
 | 
			
		||||
 | 
			
		||||
    wxBoxSizer* m_sizer_material_tips = new wxBoxSizer(wxHORIZONTAL);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    auto img_amsmapping_tip = new wxStaticBitmap(m_scrollable_region, wxID_ANY, create_scaled_bitmap("enable_ams", this, 16), wxDefaultPosition, wxSize(FromDIP(16), FromDIP(16)), 0);
 | 
			
		||||
    m_sizer_material_tips->Add(img_amsmapping_tip, 0, wxALIGN_CENTER | wxLEFT, FromDIP(5));
 | 
			
		||||
 | 
			
		||||
    img_amsmapping_tip->Bind(wxEVT_ENTER_WINDOW, [this, img_amsmapping_tip](auto& e) {
 | 
			
		||||
        wxPoint img_pos = img_amsmapping_tip->ClientToScreen(wxPoint(0, 0));
 | 
			
		||||
        wxPoint popup_pos(img_pos.x, img_pos.y + img_amsmapping_tip->GetRect().height);
 | 
			
		||||
        m_mapping_tutorial_popup.Position(popup_pos, wxSize(0, 0));
 | 
			
		||||
        m_mapping_tutorial_popup.Popup();
 | 
			
		||||
 | 
			
		||||
        if (m_mapping_tutorial_popup.ClientToScreen(wxPoint(0, 0)).y < img_pos.y) {
 | 
			
		||||
            m_mapping_tutorial_popup.Dismiss();
 | 
			
		||||
            popup_pos = wxPoint(img_pos.x, img_pos.y - m_mapping_tutorial_popup.GetRect().height);
 | 
			
		||||
            m_mapping_tutorial_popup.Position(popup_pos, wxSize(0, 0));
 | 
			
		||||
            m_mapping_tutorial_popup.Popup();
 | 
			
		||||
        }
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
    img_amsmapping_tip->Bind(wxEVT_LEAVE_WINDOW, [this](wxMouseEvent& e) {
 | 
			
		||||
        m_mapping_tutorial_popup.Dismiss();
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    m_sizer_material = new wxGridSizer(0, 4, 0, FromDIP(5));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    m_sizer_material_area->Add(m_sizer_material_tips, 0, wxALIGN_CENTER|wxLEFT, FromDIP(8));
 | 
			
		||||
    m_sizer_material_area->Add(m_sizer_material, 0, wxLEFT, FromDIP(15));
 | 
			
		||||
 | 
			
		||||
    m_statictext_ams_msg = new wxStaticText(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER_HORIZONTAL);
 | 
			
		||||
    m_statictext_ams_msg->SetFont(::Label::Body_13);
 | 
			
		||||
| 
						 | 
				
			
			@ -1120,11 +1219,13 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater)
 | 
			
		|||
    Bind(EVT_PRINT_JOB_CANCEL, &SelectMachineDialog::on_print_job_cancel, this);
 | 
			
		||||
    Bind(EVT_SET_FINISH_MAPPING, &SelectMachineDialog::on_set_finish_mapping, this);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    m_sizer_scrollable_region->Add(m_rename_switch_panel, 0, wxALIGN_CENTER_HORIZONTAL, 0);
 | 
			
		||||
    m_sizer_scrollable_region->Add(0, 0, 0, wxTOP, FromDIP(8));
 | 
			
		||||
    m_sizer_scrollable_region->Add(m_panel_image, 0, wxALIGN_CENTER_HORIZONTAL, 0);
 | 
			
		||||
    m_sizer_scrollable_region->Add(0, 0, 0, wxTOP, FromDIP(10));
 | 
			
		||||
    m_sizer_scrollable_region->Add(m_sizer_basic, 0, wxALIGN_CENTER_HORIZONTAL, 0);
 | 
			
		||||
    m_sizer_scrollable_region->Add(m_sizer_material, 0, wxALIGN_CENTER_HORIZONTAL);
 | 
			
		||||
    //m_sizer_scrollable_region->Add(m_sizer_material, 0, wxALIGN_CENTER_HORIZONTAL, 0);
 | 
			
		||||
    m_sizer_scrollable_region->Add(m_sizer_material_area, 0, wxLEFT, FromDIP(10));
 | 
			
		||||
 | 
			
		||||
    m_scrollable_region->SetSizer(m_sizer_scrollable_region);
 | 
			
		||||
    m_scrollable_region->Layout();
 | 
			
		||||
| 
						 | 
				
			
			@ -1342,7 +1443,8 @@ void SelectMachineDialog::sync_ams_mapping_result(std::vector<FilamentInfo> &res
 | 
			
		|||
                wxColour ams_col;
 | 
			
		||||
 | 
			
		||||
                if (f->tray_id >= 0) {
 | 
			
		||||
                    ams_id = wxString::Format("%02d", f->tray_id + 1);
 | 
			
		||||
                    ams_id = wxGetApp().transition_tridid(f->tray_id);
 | 
			
		||||
                    //ams_id = wxString::Format("%02d", f->tray_id + 1);
 | 
			
		||||
                } else {
 | 
			
		||||
                    ams_id = "-";
 | 
			
		||||
                }
 | 
			
		||||
| 
						 | 
				
			
			@ -1936,6 +2038,8 @@ void SelectMachineDialog::on_ok()
 | 
			
		|||
    m_print_job->m_dev_ip      = obj_->dev_ip;
 | 
			
		||||
    m_print_job->m_access_code = obj_->access_code;
 | 
			
		||||
    m_print_job->connection_type = obj_->connection_type();
 | 
			
		||||
    m_print_job->set_project_name(m_current_project_name.utf8_string());
 | 
			
		||||
 | 
			
		||||
    if (obj_->is_support_ams_mapping()) {
 | 
			
		||||
        m_print_job->task_ams_mapping = ams_mapping_array;
 | 
			
		||||
        m_print_job->task_ams_mapping_info = ams_mapping_info;
 | 
			
		||||
| 
						 | 
				
			
			@ -2150,6 +2254,60 @@ void SelectMachineDialog::update_user_printer()
 | 
			
		|||
    BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "for send task, current printer id =  " << m_printer_last_select << std::endl;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SelectMachineDialog::on_rename_click(wxCommandEvent& event)
 | 
			
		||||
{
 | 
			
		||||
    m_rename_input->GetTextCtrl()->SetValue(m_current_project_name);
 | 
			
		||||
    m_rename_switch_panel->SetSelection(1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SelectMachineDialog::on_rename_enter(wxCommandEvent& event)
 | 
			
		||||
{
 | 
			
		||||
    auto     new_file_name = m_rename_input->GetTextCtrl()->GetValue();
 | 
			
		||||
    auto     m_valid_type = Valid;
 | 
			
		||||
    wxString info_line;
 | 
			
		||||
 | 
			
		||||
    const char* unusable_symbols = "<>[]:/\\|?*\"";
 | 
			
		||||
 | 
			
		||||
    const std::string unusable_suffix = PresetCollection::get_suffix_modified(); //"(modified)";
 | 
			
		||||
    for (size_t i = 0; i < std::strlen(unusable_symbols); i++) {
 | 
			
		||||
        if (new_file_name.find_first_of(unusable_symbols[i]) != std::string::npos) {
 | 
			
		||||
            info_line = _L("Name is invalid;") + "\n" + _L("illegal characters:") + " " + unusable_symbols;
 | 
			
		||||
            m_valid_type = NoValid;
 | 
			
		||||
            break;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (m_valid_type == Valid && new_file_name.find(unusable_suffix) != std::string::npos) {
 | 
			
		||||
        info_line = _L("Name is invalid;") + "\n" + _L("illegal suffix:") + "\n\t" + from_u8(PresetCollection::get_suffix_modified());
 | 
			
		||||
        m_valid_type = NoValid;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (m_valid_type == Valid && new_file_name.empty()) {
 | 
			
		||||
        info_line = _L("The name is not allowed to be empty.");
 | 
			
		||||
        m_valid_type = NoValid;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (m_valid_type == Valid && new_file_name.find_first_of(' ') == 0) {
 | 
			
		||||
        info_line = _L("The name is not allowed to start with space character.");
 | 
			
		||||
        m_valid_type = NoValid;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (m_valid_type == Valid && new_file_name.find_last_of(' ') == new_file_name.length() - 1) {
 | 
			
		||||
        info_line = _L("The name is not allowed to end with space character.");
 | 
			
		||||
        m_valid_type = NoValid;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (m_valid_type != Valid) {
 | 
			
		||||
        MessageDialog msg_wingow(nullptr, info_line, "", wxICON_WARNING | wxOK);
 | 
			
		||||
        if (msg_wingow.ShowModal() == wxOK) { return; }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    m_current_project_name = new_file_name;
 | 
			
		||||
    m_rename_switch_panel->SetSelection(0);
 | 
			
		||||
    m_rename_text->SetLabel(m_current_project_name);
 | 
			
		||||
    m_rename_normal_panel->Layout();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SelectMachineDialog::update_printer_combobox(wxCommandEvent &event)
 | 
			
		||||
{
 | 
			
		||||
    show_status(PrintDialogStatus::PrintStatusInit);
 | 
			
		||||
| 
						 | 
				
			
			@ -2454,6 +2612,20 @@ wxImage *SelectMachineDialog::LoadImageFromBlob(const unsigned char *data, int s
 | 
			
		|||
 | 
			
		||||
void SelectMachineDialog::set_default()
 | 
			
		||||
{
 | 
			
		||||
    //project name
 | 
			
		||||
    m_rename_switch_panel->SetSelection(0);
 | 
			
		||||
    wxString filename = m_plater->get_export_gcode_filename("", false);
 | 
			
		||||
 | 
			
		||||
    if (filename.empty()) {
 | 
			
		||||
        filename = m_plater->get_export_gcode_filename("", true);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fs::path filename_path(filename.c_str());
 | 
			
		||||
    m_current_project_name = wxString::FromUTF8(filename_path.filename().string());
 | 
			
		||||
    m_rename_text->SetLabelText(m_current_project_name);
 | 
			
		||||
    m_rename_normal_panel->Layout();
 | 
			
		||||
   
 | 
			
		||||
 | 
			
		||||
    //clear combobox
 | 
			
		||||
    m_list.clear();
 | 
			
		||||
    m_comboBox_printer->Clear();
 | 
			
		||||
| 
						 | 
				
			
			@ -2520,8 +2692,6 @@ void SelectMachineDialog::set_default()
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    // material info
 | 
			
		||||
    
 | 
			
		||||
    //auto        extruders1 = m_plater->get_partplate_list().get_curr_plate()->get_extruders();
 | 
			
		||||
    auto        extruders = wxGetApp().plater()->get_preview_canvas3D()->get_gcode_viewer().get_plater_extruder();
 | 
			
		||||
    BitmapCache bmcache;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -2536,7 +2706,6 @@ void SelectMachineDialog::set_default()
 | 
			
		|||
 | 
			
		||||
    m_sizer_material->Clear();
 | 
			
		||||
    m_materialList.clear();
 | 
			
		||||
 | 
			
		||||
    m_filaments.clear();
 | 
			
		||||
 | 
			
		||||
    for (auto i = 0; i < extruders.size(); i++) {
 | 
			
		||||
| 
						 | 
				
			
			@ -2548,6 +2717,16 @@ void SelectMachineDialog::set_default()
 | 
			
		|||
        auto          colour_rgb = wxColour((int) rgb[0], (int) rgb[1], (int) rgb[2]);
 | 
			
		||||
        if (extruder >= materials.size() || extruder < 0 || extruder >= display_materials.size())
 | 
			
		||||
            continue;
 | 
			
		||||
 | 
			
		||||
       /* if (m_materialList.size() == 0) {
 | 
			
		||||
            auto tips_panel = new wxPanel(m_scrollable_region, wxID_ANY);
 | 
			
		||||
            tips_panel->SetSize(wxSize(60,40));
 | 
			
		||||
            tips_panel->SetMinSize(wxSize(60,40));
 | 
			
		||||
            tips_panel->SetMaxSize(wxSize(60,40));
 | 
			
		||||
            tips_panel->SetBackgroundColour(*wxRED);
 | 
			
		||||
            m_sizer_material->Add(tips_panel, 0, wxALL, FromDIP(4));
 | 
			
		||||
        }*/
 | 
			
		||||
 | 
			
		||||
        MaterialItem *item = new MaterialItem(m_scrollable_region, colour_rgb, _L(display_materials[extruder]));
 | 
			
		||||
        m_sizer_material->Add(item, 0, wxALL, FromDIP(4));
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -292,6 +292,14 @@ protected:
 | 
			
		|||
    wxPanel *     m_line_materia{nullptr};
 | 
			
		||||
    wxStaticText *m_stext_printer_title{nullptr};
 | 
			
		||||
 | 
			
		||||
    wxBoxSizer* rename_sizer_v{ nullptr };
 | 
			
		||||
    wxBoxSizer* rename_sizer_h{ nullptr };
 | 
			
		||||
    wxStaticText* m_rename_text{nullptr};
 | 
			
		||||
    TextInput* m_rename_input{nullptr};
 | 
			
		||||
    Button* m_rename_button{nullptr};
 | 
			
		||||
    wxPanel* m_rename_normal_panel{nullptr};
 | 
			
		||||
    wxSimplebook* m_rename_switch_panel{nullptr};
 | 
			
		||||
 | 
			
		||||
    wxStaticText *m_statictext_ams_msg{nullptr};
 | 
			
		||||
    wxStaticText * m_statictext_printer_msg{nullptr};
 | 
			
		||||
    wxStaticBitmap* m_staticbitmap {nullptr};
 | 
			
		||||
| 
						 | 
				
			
			@ -380,7 +388,8 @@ protected:
 | 
			
		|||
    wxButton *                   m_button_cancel{nullptr};
 | 
			
		||||
    AmsMapingPopup               m_mapping_popup{nullptr};
 | 
			
		||||
    AmsMapingTipPopup            m_mapping_tip_popup{nullptr};
 | 
			
		||||
 | 
			
		||||
    AmsTutorialPopup             m_mapping_tutorial_popup{nullptr};
 | 
			
		||||
    wxString                     m_current_project_name;
 | 
			
		||||
    std::string                  m_print_info;
 | 
			
		||||
    int                          timeout_count = 0;
 | 
			
		||||
    bool                         is_timeout();
 | 
			
		||||
| 
						 | 
				
			
			@ -395,6 +404,9 @@ protected:
 | 
			
		|||
    std::shared_ptr<PrintJob> m_print_job;
 | 
			
		||||
 | 
			
		||||
    // Virtual event handlers, overide them in your derived class
 | 
			
		||||
    void                     on_rename_click(wxCommandEvent &event);
 | 
			
		||||
    void                     on_rename_enter(wxCommandEvent &event);
 | 
			
		||||
 | 
			
		||||
    void                     update_printer_combobox(wxCommandEvent &event);
 | 
			
		||||
    void                     on_cancel(wxCloseEvent &event);
 | 
			
		||||
    void                     on_ok_btn(wxCommandEvent &event);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -31,6 +31,7 @@ wxDEFINE_EVENT(EVT_UPDATE_USER_MACHINE_LIST, wxCommandEvent);
 | 
			
		|||
wxDEFINE_EVENT(EVT_PRINT_JOB_CANCEL, wxCommandEvent);
 | 
			
		||||
wxDEFINE_EVENT(EVT_SEND_JOB_SUCCESS, wxCommandEvent);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void SendToPrinterDialog::stripWhiteSpace(std::string& str)
 | 
			
		||||
{
 | 
			
		||||
    if (str == "") { return; }
 | 
			
		||||
| 
						 | 
				
			
			@ -70,6 +71,72 @@ wxString SendToPrinterDialog::format_text(wxString &m_msg)
 | 
			
		|||
	return out_txt;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SendToPrinterDialog::on_kill_focus(wxFocusEvent& event)
 | 
			
		||||
{
 | 
			
		||||
    if (m_rename_switch_panel->GetSelection() == 1) {
 | 
			
		||||
        m_rename_switch_panel->SetSelection(0);
 | 
			
		||||
        m_rename_text->SetLabel(m_current_project_name);
 | 
			
		||||
        m_rename_normal_panel->Layout();
 | 
			
		||||
        
 | 
			
		||||
    }
 | 
			
		||||
    event.Skip();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SendToPrinterDialog::on_rename_click(wxCommandEvent& event)
 | 
			
		||||
{
 | 
			
		||||
    m_rename_input->GetTextCtrl()->SetValue(m_current_project_name);
 | 
			
		||||
    m_rename_switch_panel->SetSelection(1);
 | 
			
		||||
    m_rename_input->GetTextCtrl()->SetFocus();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SendToPrinterDialog::on_rename_enter(wxCommandEvent& event)
 | 
			
		||||
{
 | 
			
		||||
    auto     new_file_name = m_rename_input->GetTextCtrl()->GetValue();
 | 
			
		||||
    auto     m_valid_type = Valid;
 | 
			
		||||
    wxString info_line;
 | 
			
		||||
 | 
			
		||||
    const char* unusable_symbols = "<>[]:/\\|?*\"";
 | 
			
		||||
 | 
			
		||||
    const std::string unusable_suffix = PresetCollection::get_suffix_modified(); //"(modified)";
 | 
			
		||||
    for (size_t i = 0; i < std::strlen(unusable_symbols); i++) {
 | 
			
		||||
        if (new_file_name.find_first_of(unusable_symbols[i]) != std::string::npos) {
 | 
			
		||||
            info_line = _L("Name is invalid;") + "\n" + _L("illegal characters:") + " " + unusable_symbols;
 | 
			
		||||
            m_valid_type = NoValid;
 | 
			
		||||
            break;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (m_valid_type == Valid && new_file_name.find(unusable_suffix) != std::string::npos) {
 | 
			
		||||
        info_line = _L("Name is invalid;") + "\n" + _L("illegal suffix:") + "\n\t" + from_u8(PresetCollection::get_suffix_modified());
 | 
			
		||||
        m_valid_type = NoValid;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (m_valid_type == Valid && new_file_name.empty()) {
 | 
			
		||||
        info_line = _L("The name is not allowed to be empty.");
 | 
			
		||||
        m_valid_type = NoValid;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (m_valid_type == Valid && new_file_name.find_first_of(' ') == 0) {
 | 
			
		||||
        info_line = _L("The name is not allowed to start with space character.");
 | 
			
		||||
        m_valid_type = NoValid;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (m_valid_type == Valid && new_file_name.find_last_of(' ') == new_file_name.length() - 1) {
 | 
			
		||||
        info_line = _L("The name is not allowed to end with space character.");
 | 
			
		||||
        m_valid_type = NoValid;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (m_valid_type != Valid) {
 | 
			
		||||
        MessageDialog msg_wingow(nullptr, info_line, "", wxICON_WARNING | wxOK);
 | 
			
		||||
        if (msg_wingow.ShowModal() == wxOK) { return; }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    m_current_project_name = new_file_name;
 | 
			
		||||
    m_rename_switch_panel->SetSelection(0);
 | 
			
		||||
    m_rename_text->SetLabel(m_current_project_name);
 | 
			
		||||
    m_rename_normal_panel->Layout();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
SendToPrinterDialog::SendToPrinterDialog(Plater *plater)
 | 
			
		||||
    : DPIDialog(static_cast<wxWindow *>(wxGetApp().mainframe), wxID_ANY, _L("Send to Printer"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX)
 | 
			
		||||
    , m_plater(plater), m_export_3mf_cancel(false)
 | 
			
		||||
| 
						 | 
				
			
			@ -237,20 +304,86 @@ SendToPrinterDialog::SendToPrinterDialog(Plater *plater)
 | 
			
		|||
	m_scrollable_region->SetSizer(m_sizer_scrollable_region);
 | 
			
		||||
	m_scrollable_region->Layout();
 | 
			
		||||
 | 
			
		||||
    //file name
 | 
			
		||||
    //rename normal
 | 
			
		||||
    m_rename_switch_panel = new wxSimplebook(this);
 | 
			
		||||
    m_rename_switch_panel->SetSize(wxSize(FromDIP(420), FromDIP(25)));
 | 
			
		||||
    m_rename_switch_panel->SetMinSize(wxSize(FromDIP(420), FromDIP(25)));
 | 
			
		||||
    m_rename_switch_panel->SetMaxSize(wxSize(FromDIP(420), FromDIP(25)));
 | 
			
		||||
 | 
			
		||||
    m_rename_normal_panel = new wxPanel(m_rename_switch_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
 | 
			
		||||
    m_rename_normal_panel->SetBackgroundColour(*wxWHITE);
 | 
			
		||||
    rename_sizer_v = new wxBoxSizer(wxVERTICAL);
 | 
			
		||||
    rename_sizer_h = new wxBoxSizer(wxHORIZONTAL);
 | 
			
		||||
 | 
			
		||||
    m_rename_text = new wxStaticText(m_rename_normal_panel, wxID_ANY, wxT("MyLabel"), wxDefaultPosition, wxDefaultSize, 0);
 | 
			
		||||
    m_rename_text->SetFont(::Label::Body_13);
 | 
			
		||||
    m_rename_text->SetMaxSize(wxSize(FromDIP(390), -1));
 | 
			
		||||
    m_rename_button = new Button(m_rename_normal_panel, "", "ams_editable", wxBORDER_NONE, FromDIP(10));
 | 
			
		||||
    m_rename_button->SetBackgroundColor(*wxWHITE);
 | 
			
		||||
    m_rename_button->SetBackgroundColour(*wxWHITE);
 | 
			
		||||
 | 
			
		||||
    rename_sizer_h->Add(m_rename_text, 0, wxALIGN_CENTER, 0);
 | 
			
		||||
    rename_sizer_h->Add(m_rename_button, 0, wxALIGN_CENTER, 0);
 | 
			
		||||
    rename_sizer_v->Add(rename_sizer_h, 1, wxALIGN_CENTER, 0);
 | 
			
		||||
    m_rename_normal_panel->SetSizer(rename_sizer_v);
 | 
			
		||||
    m_rename_normal_panel->Layout();
 | 
			
		||||
    rename_sizer_v->Fit(m_rename_normal_panel);
 | 
			
		||||
 | 
			
		||||
    //rename edit
 | 
			
		||||
    auto m_rename_edit_panel = new wxPanel(m_rename_switch_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
 | 
			
		||||
    m_rename_edit_panel->SetBackgroundColour(*wxWHITE);
 | 
			
		||||
    auto rename_edit_sizer_v = new wxBoxSizer(wxVERTICAL);
 | 
			
		||||
 | 
			
		||||
    m_rename_input = new ::TextInput(m_rename_edit_panel, wxEmptyString, wxEmptyString, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER);
 | 
			
		||||
    m_rename_input->GetTextCtrl()->SetFont(::Label::Body_13);
 | 
			
		||||
    m_rename_input->SetSize(wxSize(FromDIP(380), FromDIP(24)));
 | 
			
		||||
    m_rename_input->SetMinSize(wxSize(FromDIP(380), FromDIP(24)));
 | 
			
		||||
    m_rename_input->SetMaxSize(wxSize(FromDIP(380), FromDIP(24)));
 | 
			
		||||
    rename_edit_sizer_v->Add(m_rename_input, 1, wxALIGN_CENTER, 0);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    m_rename_edit_panel->SetSizer(rename_edit_sizer_v);
 | 
			
		||||
    m_rename_edit_panel->Layout();
 | 
			
		||||
    rename_edit_sizer_v->Fit(m_rename_edit_panel);
 | 
			
		||||
 | 
			
		||||
    m_rename_input->GetTextCtrl()->Bind(wxEVT_KILL_FOCUS,  &SendToPrinterDialog::on_kill_focus, this);
 | 
			
		||||
    m_rename_input->Bind(wxEVT_TEXT_ENTER, &SendToPrinterDialog::on_rename_enter, this);
 | 
			
		||||
    m_rename_button->Bind(wxEVT_BUTTON, &SendToPrinterDialog::on_rename_click, this);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    m_rename_switch_panel->AddPage(m_rename_normal_panel, wxEmptyString, true);
 | 
			
		||||
    m_rename_switch_panel->AddPage(m_rename_edit_panel, wxEmptyString, false);
 | 
			
		||||
 | 
			
		||||
    Bind(wxEVT_CHAR_HOOK, [this](wxKeyEvent& e) {
 | 
			
		||||
        if (e.GetKeyCode() == WXK_ESCAPE) {
 | 
			
		||||
            if (m_rename_switch_panel->GetSelection() == 0) {
 | 
			
		||||
                e.Skip();
 | 
			
		||||
            }
 | 
			
		||||
            else {
 | 
			
		||||
                m_rename_switch_panel->SetSelection(0);
 | 
			
		||||
                m_rename_text->SetLabel(m_current_project_name);
 | 
			
		||||
                m_rename_normal_panel->Layout();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            e.Skip();
 | 
			
		||||
        }
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    m_sizer_main->Add(m_line_top, 0, wxEXPAND, 0);
 | 
			
		||||
    m_sizer_main->Add(0, 0, 0, wxTOP, FromDIP(22));
 | 
			
		||||
    m_sizer_main->Add(m_scrollable_region, 0, wxALIGN_CENTER_HORIZONTAL, 0);
 | 
			
		||||
    m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(8));
 | 
			
		||||
    m_sizer_main->Add(m_rename_switch_panel, 0, wxALIGN_CENTER_HORIZONTAL, 0);
 | 
			
		||||
    m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(8));
 | 
			
		||||
    m_sizer_main->Add(m_line_materia, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(30));
 | 
			
		||||
    m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(14));
 | 
			
		||||
    m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(15));
 | 
			
		||||
    m_sizer_main->Add(m_sizer_printer, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(30));
 | 
			
		||||
    m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(5));
 | 
			
		||||
    m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(8));
 | 
			
		||||
    m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(13));
 | 
			
		||||
    m_sizer_main->Add(m_statictext_printer_msg, 0, wxALIGN_CENTER_HORIZONTAL, 0);
 | 
			
		||||
    m_sizer_main->Add(0, 1, 0, wxTOP, FromDIP(20));
 | 
			
		||||
    m_sizer_main->Add(0, 1, 0, wxTOP, FromDIP(12));
 | 
			
		||||
    m_sizer_main->Add(0, 1, 0, wxTOP, FromDIP(32));
 | 
			
		||||
    m_sizer_main->Add(m_line_schedule, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(30));
 | 
			
		||||
    m_sizer_main->Add(m_simplebook, 0, wxALIGN_CENTER_HORIZONTAL, 0);
 | 
			
		||||
    m_sizer_main->Add(m_sizer_bottom, 0, wxALIGN_CENTER_HORIZONTAL);
 | 
			
		||||
| 
						 | 
				
			
			@ -485,6 +618,7 @@ void SendToPrinterDialog::on_ok(wxCommandEvent &event)
 | 
			
		|||
    m_send_job->connection_type     = obj_->connection_type();
 | 
			
		||||
    m_send_job->cloud_print_only    = true;
 | 
			
		||||
    m_send_job->has_sdcard          = obj_->has_sdcard();
 | 
			
		||||
    m_send_job->set_project_name(m_current_project_name.utf8_string());
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    m_send_job->on_success([this]() {
 | 
			
		||||
| 
						 | 
				
			
			@ -896,6 +1030,19 @@ void SendToPrinterDialog::on_dpi_changed(const wxRect &suggested_rect)
 | 
			
		|||
 | 
			
		||||
void SendToPrinterDialog::set_default()
 | 
			
		||||
{
 | 
			
		||||
    //project name
 | 
			
		||||
    m_rename_switch_panel->SetSelection(0);
 | 
			
		||||
    wxString filename = m_plater->get_export_gcode_filename("", false);
 | 
			
		||||
 | 
			
		||||
    if (filename.empty()) {
 | 
			
		||||
        filename = m_plater->get_export_gcode_filename("", true);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fs::path filename_path(filename.c_str());
 | 
			
		||||
    m_current_project_name = wxString::FromUTF8(filename_path.filename().string());
 | 
			
		||||
    m_rename_text->SetLabelText(m_current_project_name);
 | 
			
		||||
    m_rename_normal_panel->Layout();
 | 
			
		||||
 | 
			
		||||
    enable_prepare_mode = true;
 | 
			
		||||
    prepare_mode();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -60,6 +60,14 @@ private:
 | 
			
		|||
	wxColour m_colour_bold_color{ wxColour(38, 46, 48) };
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
	wxString m_current_project_name;
 | 
			
		||||
    wxBoxSizer* rename_sizer_v{ nullptr };
 | 
			
		||||
    wxBoxSizer* rename_sizer_h{ nullptr };
 | 
			
		||||
    wxStaticText* m_rename_text{ nullptr };
 | 
			
		||||
    TextInput* m_rename_input{ nullptr };
 | 
			
		||||
    Button* m_rename_button{ nullptr };
 | 
			
		||||
    wxPanel* m_rename_normal_panel{ nullptr };
 | 
			
		||||
    wxSimplebook* m_rename_switch_panel{ nullptr };
 | 
			
		||||
	Plater* m_plater{ nullptr };
 | 
			
		||||
	wxPanel* m_line_top{ nullptr };
 | 
			
		||||
	wxPanel* m_panel_image{ nullptr };
 | 
			
		||||
| 
						 | 
				
			
			@ -98,6 +106,9 @@ protected:
 | 
			
		|||
	wxPanel* m_scrollable_region;
 | 
			
		||||
	wxBoxSizer* m_sizer_scrollable_region;
 | 
			
		||||
 | 
			
		||||
    void                     on_kill_focus(wxFocusEvent& event);
 | 
			
		||||
    void                     on_rename_click(wxCommandEvent& event);
 | 
			
		||||
    void                     on_rename_enter(wxCommandEvent& event);
 | 
			
		||||
 | 
			
		||||
	void stripWhiteSpace(std::string& str);
 | 
			
		||||
	wxString format_text(wxString& m_msg);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue