Start PrusaSlicer in gcode viewer mode when dragging and dropping a .gcode file on the application icon
This commit is contained in:
parent
0435993309
commit
11d8a2ad8e
3 changed files with 29 additions and 2 deletions
|
@ -154,6 +154,17 @@ int CLI::run(int argc, char **argv)
|
|||
|
||||
// Read input file(s) if any.
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
#if ENABLE_GCODE_DRAG_AND_DROP_GCODE_FILES
|
||||
for (const std::string& file : m_input_files) {
|
||||
std::string ext = boost::filesystem::path(file).extension().string();
|
||||
if (boost::filesystem::path(file).extension().string() == ".gcode") {
|
||||
if (boost::filesystem::exists(file)) {
|
||||
start_as_gcodeviewer = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // ENABLE_GCODE_DRAG_AND_DROP_GCODE_FILES
|
||||
if (!start_as_gcodeviewer) {
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
for (const std::string& file : m_input_files) {
|
||||
|
|
|
@ -59,5 +59,6 @@
|
|||
#define ENABLE_GCODE_VIEWER_STATISTICS (0 && ENABLE_GCODE_VIEWER)
|
||||
#define ENABLE_GCODE_VIEWER_DATA_CHECKING (0 && ENABLE_GCODE_VIEWER)
|
||||
#define ENABLE_GCODE_VIEWER_TASKBAR_ICON (0 && ENABLE_GCODE_VIEWER)
|
||||
#define ENABLE_GCODE_DRAG_AND_DROP_GCODE_FILES (1 && ENABLE_GCODE_VIEWER)
|
||||
|
||||
#endif // _prusaslicer_technologies_h_
|
||||
|
|
|
@ -89,10 +89,26 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S
|
|||
// Load the icon either from the exe, or from the ico file.
|
||||
#if _WIN32
|
||||
{
|
||||
|
||||
#if ENABLE_GCODE_DRAG_AND_DROP_GCODE_FILES
|
||||
switch (wxGetApp().get_app_mode())
|
||||
{
|
||||
default:
|
||||
case GUI_App::EAppMode::Editor:
|
||||
{
|
||||
SetIcon(wxIcon(Slic3r::var("PrusaSlicer.ico"), wxBITMAP_TYPE_ICO));
|
||||
break;
|
||||
}
|
||||
case GUI_App::EAppMode::GCodeViewer:
|
||||
{
|
||||
SetIcon(wxIcon(Slic3r::var("PrusaSlicer-gcodeviewer.ico"), wxBITMAP_TYPE_ICO));
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
TCHAR szExeFileName[MAX_PATH];
|
||||
GetModuleFileName(nullptr, szExeFileName, MAX_PATH);
|
||||
SetIcon(wxIcon(szExeFileName, wxBITMAP_TYPE_ICO));
|
||||
#endif // ENABLE_GCODE_DRAG_AND_DROP_GCODE_FILES
|
||||
}
|
||||
#else
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
|
@ -1965,7 +1981,6 @@ SettingsDialog::SettingsDialog(MainFrame* mainframe)
|
|||
// Load the icon either from the exe, or from the ico file.
|
||||
#if _WIN32
|
||||
{
|
||||
|
||||
TCHAR szExeFileName[MAX_PATH];
|
||||
GetModuleFileName(nullptr, szExeFileName, MAX_PATH);
|
||||
SetIcon(wxIcon(szExeFileName, wxBITMAP_TYPE_ICO));
|
||||
|
|
Loading…
Reference in a new issue