Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer
This commit is contained in:
commit
286a81b6ff
3 changed files with 28 additions and 0 deletions
|
@ -1649,6 +1649,29 @@ bool GUI_App::OnExceptionInMainLoop()
|
|||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
// This callback is called from wxEntry()->wxApp::CallOnInit()->NSApplication run
|
||||
// that is, before GUI_App::OnInit(), so we have a chance to switch GUI_App
|
||||
// to a G-code viewer.
|
||||
void GUI_App::OSXStoreOpenFiles(const wxArrayString &fileNames)
|
||||
{
|
||||
wxArrayString other_files;
|
||||
std::vector<wxString> gcode_files;
|
||||
const std::regex pattern_gcode_drop(".*[.](gcode|g)", std::regex::icase);
|
||||
for (const auto& filename : fileNames) {
|
||||
boost::filesystem::path path(into_path(filename));
|
||||
if (std::regex_match(path.string(), pattern_gcode_drop))
|
||||
gcode_files.emplace_back(filename);
|
||||
else
|
||||
other_files.Add(filename);
|
||||
}
|
||||
if (! gcode_files.empty()) {
|
||||
// Drag & Dropping a G-code onto PrusaSlicer. Switch PrusaSlicer to G-code viewer mode.
|
||||
//FIXME Switch application to G-code viewer mode?
|
||||
wxMessageBox("PrusaSlicer on early startup", wxString::Format("Switching to G-code viewer for %s", gcode_files.front()), wxICON_INFORMATION);
|
||||
m_app_mode = EAppMode::GCodeViewer;
|
||||
}
|
||||
wxApp::OSXStoreOpenFiles(other_files);
|
||||
}
|
||||
void GUI_App::MacNewFile()
|
||||
{
|
||||
m_mac_initialized = true;
|
||||
|
@ -1675,9 +1698,12 @@ void GUI_App::MacOpenFiles(const wxArrayString &fileNames)
|
|||
start_new_gcodeviewer(&filename);
|
||||
} else if (! gcode_files.empty()) {
|
||||
assert(! m_mac_initialized);
|
||||
assert(m_app_mode == EAppMode::GCodeViewer);
|
||||
// Drag & Dropping a G-code onto PrusaSlicer. Switch PrusaSlicer to G-code viewer mode.
|
||||
//FIXME Switch application to G-code viewer mode?
|
||||
wxMessageBox("PrusaSlicer on startup", wxString::Format("Switching to G-code viewer for %s", gcode_files.front()), wxICON_INFORMATION);
|
||||
// Load the G-code into the G-code viewer.
|
||||
this->plater()->load_gcode(paths.front());
|
||||
}
|
||||
m_mac_initialized = true;
|
||||
}
|
||||
|
|
|
@ -250,6 +250,7 @@ public:
|
|||
virtual bool OnExceptionInMainLoop() override;
|
||||
|
||||
#ifdef __APPLE__
|
||||
void OSXStoreOpenFiles(const wxArrayString &files) override;
|
||||
// Called if there is no file to open.
|
||||
void MacNewFile();
|
||||
// wxWidgets override to get an event on open files.
|
||||
|
|
|
@ -177,6 +177,7 @@ void GLGizmoPainterBase::render_cursor_circle() const
|
|||
|
||||
glsafe(::glPopAttrib());
|
||||
glsafe(::glPopMatrix());
|
||||
glsafe(::glEnable(GL_DEPTH_TEST));
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue