mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 04:31:15 -06:00 
			
		
		
		
	WIP: G-code viewer menu, refactoring of starting a background process.
This commit is contained in:
		
							parent
							
								
									014a90b51b
								
							
						
					
					
						commit
						fd4c28ed91
					
				
					 3 changed files with 11 additions and 22 deletions
				
			
		|  | @ -195,6 +195,8 @@ set(SLIC3R_GUI_SOURCES | |||
|     Utils/Bonjour.hpp | ||||
|     Utils/PresetUpdater.cpp | ||||
|     Utils/PresetUpdater.hpp | ||||
|     Utils/Process.cpp | ||||
|     Utils/Process.hpp | ||||
|     Utils/Profile.hpp | ||||
|     Utils/UndoRedo.cpp | ||||
|     Utils/UndoRedo.hpp | ||||
|  |  | |||
|  | @ -9,7 +9,6 @@ | |||
| #include <wx/tooltip.h> | ||||
| //#include <wx/glcanvas.h>
 | ||||
| #include <wx/filename.h> | ||||
| #include <wx/stdpaths.h> | ||||
| #include <wx/debug.h> | ||||
| 
 | ||||
| #include <boost/algorithm/string/predicate.hpp> | ||||
|  | @ -31,6 +30,7 @@ | |||
| #include "I18N.hpp" | ||||
| #include "GLCanvas3D.hpp" | ||||
| #include "Plater.hpp" | ||||
| #include "../Utils/Process.hpp" | ||||
| 
 | ||||
| #include <fstream> | ||||
| #include "GUI_App.hpp" | ||||
|  | @ -40,12 +40,6 @@ | |||
| #include <shlobj.h> | ||||
| #endif // _WIN32
 | ||||
| 
 | ||||
| // For starting another PrusaSlicer instance on OSX.
 | ||||
| // Fails to compile on Windows on the build server.
 | ||||
| #ifdef __APPLE__ | ||||
|     #include <boost/process/spawn.hpp> | ||||
| #endif | ||||
| 
 | ||||
| namespace Slic3r { | ||||
| namespace GUI { | ||||
| 
 | ||||
|  | @ -1054,8 +1048,8 @@ void MainFrame::init_menubar() | |||
|         append_menu_item(fileMenu, wxID_ANY, _L("&Repair STL file") + dots, _L("Automatically repair an STL file"), | ||||
|             [this](wxCommandEvent&) { repair_stl(); }, "wrench", nullptr, | ||||
|             [this]() { return true; }, this); | ||||
| #if ENABLE_GCODE_VIEWER | ||||
|         fileMenu->AppendSeparator(); | ||||
| #if ENABLE_GCODE_VIEWER | ||||
|         append_menu_item(fileMenu, wxID_ANY, _L("&G-code preview"), _L("Switch to G-code preview mode"), | ||||
|             [this](wxCommandEvent&) { | ||||
|                 if (m_plater->model().objects.empty() || | ||||
|  | @ -1064,6 +1058,8 @@ void MainFrame::init_menubar() | |||
|                     set_mode(EMode::GCodeViewer); | ||||
|             }, "", nullptr); | ||||
| #endif // ENABLE_GCODE_VIEWER
 | ||||
|         append_menu_item(fileMenu, wxID_ANY, _L("&G-code preview") + dots, _L("Open G-code viewer"), | ||||
|             [this](wxCommandEvent&) { start_new_gcodeviewer_open_file(this); }, "", nullptr); | ||||
|         fileMenu->AppendSeparator(); | ||||
|         append_menu_item(fileMenu, wxID_EXIT, _L("&Quit"), wxString::Format(_L("Quit %s"), SLIC3R_APP_NAME), | ||||
|             [this](wxCommandEvent&) { Close(false); }); | ||||
|  | @ -1180,20 +1176,11 @@ void MainFrame::init_menubar() | |||
| 
 | ||||
|         windowMenu->AppendSeparator(); | ||||
|         append_menu_item(windowMenu, wxID_ANY, _L("Print &Host Upload Queue") + "\tCtrl+J", _L("Display the Print Host Upload Queue window"), | ||||
|             [this](wxCommandEvent&) { m_printhost_queue_dlg->Show(); }, "upload_queue", nullptr, | ||||
|             [this]() {return true; }, this); | ||||
|             [this](wxCommandEvent&) { m_printhost_queue_dlg->Show(); }, "upload_queue", nullptr, [this]() {return true; }, this); | ||||
|          | ||||
|         windowMenu->AppendSeparator(); | ||||
|         append_menu_item(windowMenu, wxID_ANY, _(L("Open new instance")) + "\tCtrl+I", _(L("Open a new PrusaSlicer instance")), | ||||
|                          [this](wxCommandEvent&) { | ||||
|                              wxString path = wxStandardPaths::Get().GetExecutablePath(); | ||||
| #ifdef __APPLE__ | ||||
|                              boost::process::spawn((const char*)path.c_str()); | ||||
| #else | ||||
|                              wxExecute(wxStandardPaths::Get().GetExecutablePath(), wxEXEC_ASYNC | wxEXEC_HIDE_CONSOLE | wxEXEC_MAKE_GROUP_LEADER); | ||||
| #endif | ||||
|                          }, "upload_queue", nullptr, | ||||
|                          [this]() {return true; }, this); | ||||
| 			[this](wxCommandEvent&) { start_new_slicer(); }, "", nullptr); | ||||
|     } | ||||
| 
 | ||||
|     // View menu
 | ||||
|  |  | |||
|  | @ -1,5 +1,5 @@ | |||
| #ifndef THREAD_HPP | ||||
| #define THREAD_HPP | ||||
| #ifndef GUI_THREAD_HPP | ||||
| #define GUI_THREAD_HPP | ||||
| 
 | ||||
| #include <utility> | ||||
| #include <boost/thread.hpp> | ||||
|  | @ -25,4 +25,4 @@ template<class Fn> inline boost::thread create_thread(Fn &&fn) | |||
| 
 | ||||
| } | ||||
| 
 | ||||
| #endif // THREAD_HPP
 | ||||
| #endif // GUI_THREAD_HPP
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 bubnikv
						bubnikv