mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 12:41:20 -06:00 
			
		
		
		
	pa works
This commit is contained in:
		
							parent
							
								
									0bf74c97c3
								
							
						
					
					
						commit
						1df89650e9
					
				
					 10 changed files with 82 additions and 81 deletions
				
			
		|  | @ -244,8 +244,10 @@ void BBLTopbar::Init(wxFrame* parent) | |||
| 
 | ||||
|     this->AddSpacer(FromDIP(10)); | ||||
| 
 | ||||
|     wxBitmap calib_bitmap = create_scaled_bitmap("ams_readonly", nullptr, TOPBAR_ICON_SIZE); | ||||
|     m_redo_item = this->AddTool(ID_CALIB, "", calib_bitmap); | ||||
|     wxBitmap calib_bitmap = create_scaled_bitmap("calib_sf", nullptr, TOPBAR_ICON_SIZE); | ||||
|     wxBitmap calib_bitmap_inactive = create_scaled_bitmap("calib_sf_inactive", nullptr, TOPBAR_ICON_SIZE); | ||||
|     m_calib_item = this->AddTool(ID_CALIB, "Calibration", calib_bitmap); | ||||
|     m_calib_item->SetDisabledBitmap(calib_bitmap_inactive); | ||||
| 
 | ||||
|     this->AddSpacer(FromDIP(10)); | ||||
|     this->AddStretchSpacer(1); | ||||
|  | @ -304,7 +306,7 @@ void BBLTopbar::Init(wxFrame* parent) | |||
|     this->Bind(wxEVT_MENU_CLOSE, &BBLTopbar::OnMenuClose, this); | ||||
|     this->Bind(wxEVT_AUITOOLBAR_TOOL_DROPDOWN, &BBLTopbar::OnFileToolItem, this, ID_TOP_FILE_MENU); | ||||
|     this->Bind(wxEVT_AUITOOLBAR_TOOL_DROPDOWN, &BBLTopbar::OnDropdownToolItem, this, ID_TOP_DROPDOWN_MENU); | ||||
|     this->Bind(wxEVT_AUITOOLBAR_TOOL_DROPDOWN, &BBLTopbar::OnDropdownToolItem, this, ID_CALIB); | ||||
|     this->Bind(wxEVT_AUITOOLBAR_TOOL_DROPDOWN, &BBLTopbar::OnCalibToolItem, this, ID_CALIB); | ||||
|     this->Bind(wxEVT_AUITOOLBAR_TOOL_DROPDOWN, &BBLTopbar::OnIconize, this, wxID_ICONIZE_FRAME); | ||||
|     this->Bind(wxEVT_AUITOOLBAR_TOOL_DROPDOWN, &BBLTopbar::OnFullScreen, this, wxID_MAXIMIZE_FRAME); | ||||
|     this->Bind(wxEVT_AUITOOLBAR_TOOL_DROPDOWN, &BBLTopbar::OnCloseFrame, this, wxID_CLOSE_FRAME); | ||||
|  | @ -360,17 +362,19 @@ void BBLTopbar::OnRedo(wxAuiToolBarEvent& event) | |||
|     plater->redo(); | ||||
| } | ||||
| 
 | ||||
| void BBLTopbar::EnableUndoRedoItems() | ||||
| void BBLTopbar::Enable3DEditorItems() | ||||
| { | ||||
|     this->EnableTool(m_undo_item->GetId(), true); | ||||
|     this->EnableTool(m_redo_item->GetId(), true); | ||||
|     this->EnableTool(m_calib_item->GetId(), true); | ||||
|     Refresh(); | ||||
| } | ||||
| 
 | ||||
| void BBLTopbar::DisableUndoRedoItems() | ||||
| void BBLTopbar::Disable3DEditorItems() | ||||
| { | ||||
|     this->EnableTool(m_undo_item->GetId(), false); | ||||
|     this->EnableTool(m_redo_item->GetId(), false); | ||||
|     this->EnableTool(m_calib_item->GetId(), false); | ||||
|     Refresh(); | ||||
| } | ||||
| 
 | ||||
|  | @ -423,6 +427,11 @@ wxMenu* BBLTopbar::GetTopMenu() | |||
|     return &m_top_menu; | ||||
| } | ||||
| 
 | ||||
| wxMenu* BBLTopbar::GetCalibMenu() | ||||
| { | ||||
|     return &m_calib_menu; | ||||
| } | ||||
| 
 | ||||
| void BBLTopbar::SetTitle(wxString title) | ||||
| { | ||||
|     wxGCDC dc(this); | ||||
|  | @ -598,7 +607,8 @@ void BBLTopbar::OnCalibToolItem(wxAuiToolBarEvent& evt) | |||
|     tb->SetToolSticky(evt.GetId(), true); | ||||
| 
 | ||||
|     if (!m_skip_popup_calib_menu) { | ||||
|         PopupMenu(&m_calib_menu, wxPoint(FromDIP(1), this->GetSize().GetHeight() - 2)); | ||||
|         auto rec = this->GetToolRect(ID_CALIB); | ||||
|         PopupMenu(&m_calib_menu, wxPoint(rec.GetLeft(), this->GetSize().GetHeight() - 2)); | ||||
|     } | ||||
|     else { | ||||
|         m_skip_popup_calib_menu = false; | ||||
|  |  | |||
|  | @ -43,13 +43,14 @@ public: | |||
|     void SetFileMenu(wxMenu* file_menu); | ||||
|     void AddDropDownSubMenu(wxMenu* sub_menu, const wxString& title); | ||||
|     void AddDropDownMenuItem(wxMenuItem* menu_item); | ||||
|     wxMenu *GetTopMenu(); | ||||
|     wxMenu* GetTopMenu(); | ||||
|     wxMenu *GetCalibMenu(); | ||||
|     void SetTitle(wxString title); | ||||
|     void SetMaximizedSize(); | ||||
|     void SetWindowSize(); | ||||
| 
 | ||||
|     void EnableUndoRedoItems(); | ||||
|     void DisableUndoRedoItems(); | ||||
|     void Enable3DEditorItems(); | ||||
|     void Disable3DEditorItems(); | ||||
| 
 | ||||
|     void SaveNormalRect(); | ||||
| 
 | ||||
|  | @ -61,7 +62,7 @@ private: | |||
|     wxPoint m_delta; | ||||
|     wxMenu m_top_menu; | ||||
|     wxMenu* m_file_menu; | ||||
|     wxMenu* m_calib_menu; | ||||
|     wxMenu m_calib_menu; | ||||
|     wxAuiToolBarItem* m_title_item; | ||||
|     wxAuiToolBarItem* m_account_item; | ||||
|     wxAuiToolBarItem* m_model_store_item; | ||||
|  | @ -69,6 +70,7 @@ private: | |||
|     wxAuiToolBarItem *m_publish_item; | ||||
|     wxAuiToolBarItem* m_undo_item; | ||||
|     wxAuiToolBarItem* m_redo_item; | ||||
|     wxAuiToolBarItem* m_calib_item; | ||||
|     wxAuiToolBarItem* maximize_btn; | ||||
| 
 | ||||
|     wxBitmap m_publish_bitmap; | ||||
|  |  | |||
|  | @ -32,8 +32,6 @@ wxDEFINE_EVENT(EVT_GLTOOLBAR_PRINT_SELECT, SimpleEvent); | |||
| wxDEFINE_EVENT(EVT_GLTOOLBAR_SEND_TO_PRINTER, SimpleEvent); | ||||
| wxDEFINE_EVENT(EVT_GLTOOLBAR_SEND_TO_PRINTER_ALL, SimpleEvent); | ||||
| 
 | ||||
| //SoftFever: goodie bag
 | ||||
| wxDEFINE_EVENT(EVT_GLTOOLBAR_PA_CALIB, SimpleEvent); | ||||
| 
 | ||||
| wxDEFINE_EVENT(EVT_GLTOOLBAR_ADD, SimpleEvent); | ||||
| wxDEFINE_EVENT(EVT_GLTOOLBAR_DELETE, SimpleEvent); | ||||
|  |  | |||
|  | @ -32,8 +32,6 @@ wxDECLARE_EVENT(EVT_GLTOOLBAR_PRINT_SELECT, SimpleEvent); | |||
| wxDECLARE_EVENT(EVT_GLTOOLBAR_SEND_TO_PRINTER, SimpleEvent); | ||||
| wxDECLARE_EVENT(EVT_GLTOOLBAR_SEND_TO_PRINTER_ALL, SimpleEvent); | ||||
| 
 | ||||
| //SoftFever: goodie bag event
 | ||||
| wxDECLARE_EVENT(EVT_GLTOOLBAR_PA_CALIB, SimpleEvent); | ||||
| 
 | ||||
| wxDECLARE_EVENT(EVT_GLTOOLBAR_ADD, SimpleEvent); | ||||
| wxDECLARE_EVENT(EVT_GLTOOLBAR_DELETE, SimpleEvent); | ||||
|  |  | |||
|  | @ -831,7 +831,6 @@ void MainFrame::show_option(bool show) | |||
|             m_print_btn->Hide(); | ||||
|             m_slice_option_btn->Hide(); | ||||
|             m_print_option_btn->Hide(); | ||||
|             m_goodie_bag_btn->Hide(); | ||||
|             Layout(); | ||||
|         } | ||||
|     } else { | ||||
|  | @ -840,7 +839,6 @@ void MainFrame::show_option(bool show) | |||
|             m_print_btn->Show(); | ||||
|             m_slice_option_btn->Show(); | ||||
|             m_print_option_btn->Show(); | ||||
|             m_goodie_bag_btn->Show(); | ||||
|             Layout(); | ||||
|         } | ||||
|     } | ||||
|  | @ -906,10 +904,10 @@ void MainFrame::init_tabpanel() | |||
| 
 | ||||
| #ifndef __APPLE__ | ||||
|         if (sel == tp3DEditor) { | ||||
|             m_topbar->EnableUndoRedoItems(); | ||||
|             m_topbar->Enable3DEditorItems(); | ||||
|         } | ||||
|         else { | ||||
|             m_topbar->DisableUndoRedoItems(); | ||||
|             m_topbar->Disable3DEditorItems(); | ||||
|         } | ||||
| #endif | ||||
| 
 | ||||
|  | @ -1356,16 +1354,13 @@ wxBoxSizer* MainFrame::create_side_tools() | |||
|     m_slice_select = eSlicePlate; | ||||
|     m_print_select = ePrintPlate; | ||||
| 
 | ||||
|     m_goodie_bag_btn = new SideButton(this, _L("Goodiebag"), ""); | ||||
|     m_slice_btn = new SideButton(this, _L("Slice"), ""); | ||||
|     m_slice_option_btn = new SideButton(this, "", "sidebutton_dropdown", 0, FromDIP(14)); | ||||
|     m_print_btn = new SideButton(this, _L("Print"), ""); | ||||
|     m_print_option_btn = new SideButton(this, "", "sidebutton_dropdown", 0, FromDIP(14)); | ||||
| 
 | ||||
|     update_side_button_style(); | ||||
|     m_goodie_bag_btn->Enable(); | ||||
|     m_print_option_btn->Enable(); | ||||
|     sizer->Add(m_goodie_bag_btn, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, FromDIP(1)); | ||||
|     sizer->Add(FromDIP(15), 0, 0, 0, 0); | ||||
|      | ||||
|     m_slice_option_btn->Enable(); | ||||
|  | @ -1379,33 +1374,6 @@ wxBoxSizer* MainFrame::create_side_tools() | |||
| 
 | ||||
|     sizer->Layout(); | ||||
| 
 | ||||
|     m_goodie_bag_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent& event) | ||||
|         { | ||||
|             SidePopup* p = new SidePopup(this); | ||||
|             SideButton* calib_pa_btn = new SideButton(p, _L("Calibrate PA"), ""); | ||||
|             calib_pa_btn->SetCornerRadius(0); | ||||
|             //SideButton* send_file_btn = new SideButton(p, _L("send file"), "");
 | ||||
|             //send_file_btn->SetCornerRadius(0);
 | ||||
| 
 | ||||
|             calib_pa_btn->Bind(wxEVT_BUTTON, [this, p](wxCommandEvent&) { | ||||
|                 //this->m_plater->select_view_3D("Preview");
 | ||||
|                 m_plater->update(); | ||||
|                 wxPostEvent(m_plater, SimpleEvent(EVT_GLTOOLBAR_PA_CALIB)); | ||||
| 
 | ||||
|                 this->m_tabpanel->SetSelection(tpPreview); | ||||
|                 }); | ||||
| 
 | ||||
|             //send_file_btn->Bind(wxEVT_BUTTON, [this, p](wxCommandEvent&) {
 | ||||
|             //    //this->m_plater->select_view_3D("Preview");
 | ||||
|             //    wxPostEvent(m_plater, SimpleEvent(EVT_GLTOOLBAR_SEND_GCODE_FILE));
 | ||||
| 
 | ||||
|             //    });
 | ||||
|             p->append_button(calib_pa_btn); | ||||
|             //p->append_button(send_file_btn);
 | ||||
|             p->Popup(m_goodie_bag_btn); | ||||
|         } | ||||
|     ); | ||||
| 
 | ||||
|     m_slice_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent& event) | ||||
|         { | ||||
|             //this->m_plater->select_view_3D("Preview");
 | ||||
|  | @ -1738,13 +1706,6 @@ void MainFrame::update_side_button_style() | |||
| { | ||||
|     // BBS
 | ||||
|     int em = em_unit(); | ||||
| 
 | ||||
|     m_goodie_bag_btn->SetLayoutStyle(1); | ||||
|     m_goodie_bag_btn->SetTextLayout(SideButton::EHorizontalOrientation::HO_Center, FromDIP(15)); | ||||
|     m_goodie_bag_btn->SetMinSize(wxSize(-1, FromDIP(24))); | ||||
|     m_goodie_bag_btn->SetCornerRadius(FromDIP(12)); | ||||
|     m_goodie_bag_btn->SetExtraSize(wxSize(FromDIP(38), FromDIP(10))); | ||||
|     m_goodie_bag_btn->SetBottomColour(wxColour(0x3B4446)); | ||||
|      | ||||
|     m_slice_btn->SetLayoutStyle(1); | ||||
|     /*m_slice_btn->SetLayoutStyle(1);
 | ||||
|  | @ -1830,7 +1791,6 @@ void MainFrame::on_dpi_changed(const wxRect& suggested_rect) | |||
| 
 | ||||
|     update_side_button_style(); | ||||
| 
 | ||||
|     m_goodie_bag_btn->Rescale(); | ||||
|     m_slice_btn->Rescale(); | ||||
|     m_print_btn->Rescale(); | ||||
|     m_slice_option_btn->Rescale(); | ||||
|  | @ -2499,6 +2459,9 @@ void MainFrame::init_menubar_as_editor() | |||
|     //m_topbar->AddDropDownMenuItem(language_item);
 | ||||
|     //m_topbar->AddDropDownMenuItem(config_item);
 | ||||
|     m_topbar->AddDropDownSubMenu(helpMenu, _L("Help")); | ||||
|     append_menu_item(m_topbar->GetCalibMenu(), wxID_ANY, _L("Pressure advance"), _L("Calibrate PA"), | ||||
|         [this](wxCommandEvent&) { if (m_plater) m_plater->calib_pa(); }, "", nullptr, | ||||
|         [this]() {return m_plater->is_view3D_shown();; }, this); | ||||
| #else | ||||
|     m_menubar->Append(fileMenu, wxString::Format("&%s", _L("File"))); | ||||
|     if (editMenu) | ||||
|  |  | |||
|  | @ -355,7 +355,6 @@ public: | |||
|     // BBS
 | ||||
|     mutable int m_print_select{ ePrintAll }; | ||||
|     mutable int m_slice_select{ eSliceAll }; | ||||
|     SideButton* m_goodie_bag_btn{ nullptr }; | ||||
|     SideButton* m_slice_btn{ nullptr }; | ||||
|     SideButton* m_slice_option_btn{ nullptr }; | ||||
|     SideButton* m_print_btn{ nullptr }; | ||||
|  |  | |||
|  | @ -2032,7 +2032,6 @@ struct Plater::priv | |||
|     //BBS: GUI refactor: GLToolbar
 | ||||
|     void on_action_open_project(SimpleEvent&); | ||||
|     void on_action_slice_plate(SimpleEvent&); | ||||
|     void on_action_calib_pa(SimpleEvent&); | ||||
|     void on_action_slice_all(SimpleEvent&); | ||||
|     void on_action_publish(wxCommandEvent &evt); | ||||
|     void on_action_print_plate(SimpleEvent&); | ||||
|  | @ -2442,7 +2441,6 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) | |||
|         q->Bind(EVT_GLVIEWTOOLBAR_PREVIEW, [q](SimpleEvent&) { q->select_view_3D("Preview", false); }); | ||||
|         q->Bind(EVT_GLTOOLBAR_SLICE_PLATE, &priv::on_action_slice_plate, this); | ||||
|         q->Bind(EVT_GLTOOLBAR_SLICE_ALL, &priv::on_action_slice_all, this); | ||||
|         q->Bind(EVT_GLTOOLBAR_PA_CALIB, &priv::on_action_calib_pa, this); | ||||
|         q->Bind(EVT_GLTOOLBAR_PRINT_PLATE, &priv::on_action_print_plate, this); | ||||
|         q->Bind(EVT_GLTOOLBAR_SELECT_SLICED_PLATE, &priv::on_action_select_sliced_plate, this); | ||||
|         q->Bind(EVT_GLTOOLBAR_PRINT_ALL, &priv::on_action_print_all, this); | ||||
|  | @ -5996,28 +5994,6 @@ void Plater::priv::on_action_slice_plate(SimpleEvent&) | |||
|     } | ||||
| } | ||||
| 
 | ||||
| //BBS: GUI refactor: slice plate
 | ||||
| void Plater::priv::on_action_calib_pa(SimpleEvent&) | ||||
| { | ||||
|     if (q != nullptr) { | ||||
|         BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << ":received calib pa event\n" ; | ||||
|         const auto calib_pa_name = "PressureAdvanceTest-SF"; | ||||
|         if (get_project_name() != calib_pa_name) { | ||||
|             q->new_project(false,false,calib_pa_name); | ||||
|             q->add_model(false, Slic3r::resources_dir() + "/calib/sf_placeholder.stl"); | ||||
|             q->select_view_3D("3D"); | ||||
|         } | ||||
| 
 | ||||
|         background_process.fff_print()->is_calib_mode() = true; | ||||
|         //BBS update extruder params and speed table before slicing
 | ||||
|         Plater::setExtruderParams(Slic3r::Model::extruderParamsMap); | ||||
|         Plater::setPrintSpeedTable(Slic3r::Model::printSpeedMap); | ||||
|         m_slice_all = false; | ||||
|         q->reslice(); | ||||
|         q->select_view_3D("Preview"); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| //BBS: GUI refactor: slice all
 | ||||
| void Plater::priv::on_action_slice_all(SimpleEvent&) | ||||
| { | ||||
|  | @ -7889,6 +7865,26 @@ void Plater::add_model(bool imperial_units/* = false*/,  std::string fname/* = " | |||
|     } | ||||
| } | ||||
| 
 | ||||
| void Plater::calib_pa() { | ||||
|     const auto calib_pa_name = "PressureAdvanceTest-SF"; | ||||
|     if (get_project_name() != calib_pa_name) { | ||||
|         new_project(false, false, calib_pa_name); | ||||
|         add_model(false, Slic3r::resources_dir() + "/calib/sf_placeholder.stl"); | ||||
|         wxGetApp().mainframe->select_tab(size_t(MainFrame::tp3DEditor)); | ||||
| 
 | ||||
|         //select_view_3D("3D");
 | ||||
|     } | ||||
| 
 | ||||
|     p->background_process.fff_print()->is_calib_mode() = true; | ||||
|     //BBS update extruder params and speed table before slicing
 | ||||
|     Plater::setExtruderParams(Slic3r::Model::extruderParamsMap); | ||||
|     Plater::setPrintSpeedTable(Slic3r::Model::printSpeedMap); | ||||
|     p->m_slice_all = false; | ||||
|     reslice(); | ||||
|     wxGetApp().mainframe->select_tab(size_t(MainFrame::tp3DEditor)); | ||||
|     select_view_3D("Preview"); | ||||
| } | ||||
| 
 | ||||
| void Plater::import_sl1_archive() | ||||
| { | ||||
|     if (!p->m_ui_jobs.is_any_running()) | ||||
|  |  | |||
|  | @ -225,6 +225,9 @@ public: | |||
|     void reload_gcode_from_disk(); | ||||
|     void refresh_print(); | ||||
| 
 | ||||
|     // SoftFever
 | ||||
|     void calib_pa(); | ||||
| 
 | ||||
|     //BBS: add only gcode mode
 | ||||
|     bool only_gcode_mode() { return m_only_gcode; } | ||||
|     void set_only_gcode(bool only_gcode) { m_only_gcode = only_gcode; } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 SoftFever
						SoftFever