diff --git a/resources/icons/PrusaSlicer_logo.svg b/resources/icons/PrusaSlicer_logo.svg new file mode 100644 index 000000000..927c3e70b --- /dev/null +++ b/resources/icons/PrusaSlicer_logo.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/resources/icons/Slic3r_logo.png b/resources/icons/Slic3r_logo.png new file mode 100644 index 000000000..9c278f6f0 Binary files /dev/null and b/resources/icons/Slic3r_logo.png differ diff --git a/resources/icons/SuperSlicer-console.ico b/resources/icons/SuperSlicer-console.ico new file mode 100644 index 000000000..7d168c874 Binary files /dev/null and b/resources/icons/SuperSlicer-console.ico differ diff --git a/resources/icons/SuperSlicer-gcodeviewer.ico b/resources/icons/SuperSlicer-gcodeviewer.ico new file mode 100644 index 000000000..01ed65b6a Binary files /dev/null and b/resources/icons/SuperSlicer-gcodeviewer.ico differ diff --git a/resources/icons/SuperSlicer-gcodeviewer_128px.png b/resources/icons/SuperSlicer-gcodeviewer_128px.png new file mode 100644 index 000000000..a84ff5281 Binary files /dev/null and b/resources/icons/SuperSlicer-gcodeviewer_128px.png differ diff --git a/resources/icons/SuperSlicer-gcodeviewer_192px.png b/resources/icons/SuperSlicer-gcodeviewer_192px.png new file mode 100644 index 000000000..d0b6b0742 Binary files /dev/null and b/resources/icons/SuperSlicer-gcodeviewer_192px.png differ diff --git a/resources/icons/SuperSlicer-gcodeviewer_32px.png b/resources/icons/SuperSlicer-gcodeviewer_32px.png new file mode 100644 index 000000000..40d7a46fc Binary files /dev/null and b/resources/icons/SuperSlicer-gcodeviewer_32px.png differ diff --git a/resources/icons/SuperSlicer.icns b/resources/icons/SuperSlicer.icns new file mode 100644 index 000000000..04a2be211 Binary files /dev/null and b/resources/icons/SuperSlicer.icns differ diff --git a/resources/icons/SuperSlicer.ico b/resources/icons/SuperSlicer.ico new file mode 100644 index 000000000..9a92bb103 Binary files /dev/null and b/resources/icons/SuperSlicer.ico differ diff --git a/resources/icons/SuperSlicer.png b/resources/icons/SuperSlicer.png new file mode 100644 index 000000000..d480dc881 Binary files /dev/null and b/resources/icons/SuperSlicer.png differ diff --git a/resources/icons/SuperSlicer_128px.png b/resources/icons/SuperSlicer_128px.png new file mode 100644 index 000000000..006e95f51 Binary files /dev/null and b/resources/icons/SuperSlicer_128px.png differ diff --git a/resources/icons/SuperSlicer_192px.png b/resources/icons/SuperSlicer_192px.png new file mode 100644 index 000000000..2e08916fc Binary files /dev/null and b/resources/icons/SuperSlicer_192px.png differ diff --git a/resources/icons/SuperSlicer_192px_transparent.png b/resources/icons/SuperSlicer_192px_transparent.png new file mode 100644 index 000000000..8b7165a60 Binary files /dev/null and b/resources/icons/SuperSlicer_192px_transparent.png differ diff --git a/resources/icons/SuperSlicer_32px.png b/resources/icons/SuperSlicer_32px.png new file mode 100644 index 000000000..9fb42e6f7 Binary files /dev/null and b/resources/icons/SuperSlicer_32px.png differ diff --git a/resources/icons/prusa_slicer_logo.svg b/resources/icons/SuperSlicer_logo.svg similarity index 100% rename from resources/icons/prusa_slicer_logo.svg rename to resources/icons/SuperSlicer_logo.svg diff --git a/resources/icons/printer_cog.svg b/resources/icons/printer_cog.svg new file mode 100644 index 000000000..5e8230fd4 --- /dev/null +++ b/resources/icons/printer_cog.svg @@ -0,0 +1,114 @@ + + + +image/svg+xml + + + + + + + + + + \ No newline at end of file diff --git a/resources/icons/spool_cog.svg b/resources/icons/spool_cog.svg new file mode 100644 index 000000000..fa5823588 --- /dev/null +++ b/resources/icons/spool_cog.svg @@ -0,0 +1,121 @@ + + + +image/svg+xml + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/icons/super_slicer_logo.svg b/resources/icons/super_slicer_logo.svg deleted file mode 100644 index 44dde1114..000000000 --- a/resources/icons/super_slicer_logo.svg +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - - - diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1ec5caa81..bc1ed142b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -148,8 +148,11 @@ if (WIN32) if (MINGW) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -municode") endif() + + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libslic3r/libslic3r_version.h.in ${CMAKE_CURRENT_BINARY_DIR}/libslic3r_version.h @ONLY) add_executable(Slic3r_app_gui WIN32 PrusaSlicer_app_msvc.cpp ${CMAKE_CURRENT_BINARY_DIR}/Slic3r.rc) + target_include_directories(Slic3r_app_gui PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) # Generate debug symbols even in release mode. if(MSVC) target_link_options(Slic3r_app_gui PUBLIC "$<$:/DEBUG>") @@ -160,23 +163,25 @@ if (WIN32) target_link_libraries(Slic3r_app_gui PRIVATE boost_headeronly) add_executable(Slic3r_app_console PrusaSlicer_app_msvc.cpp ${CMAKE_CURRENT_BINARY_DIR}/Slic3r.rc) + target_include_directories(Slic3r_app_console PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) # Generate debug symbols even in release mode. if (MSVC) target_link_options(Slic3r_app_console PUBLIC "$<$:/DEBUG>") endif () target_compile_definitions(Slic3r_app_console PRIVATE -DSLIC3R_WRAPPER_CONSOLE) add_dependencies(Slic3r_app_console Slic3r) - set_target_properties(Slic3r_app_console PROPERTIES OUTPUT_NAME "slic3r_console") + set_target_properties(Slic3r_app_console PROPERTIES OUTPUT_NAME "@SLIC3R_APP_CMD@_console") target_link_libraries(Slic3r_app_console PRIVATE boost_headeronly) - add_executable(PrusaSlicer_app_gcodeviewer WIN32 PrusaSlicer_app_msvc.cpp ${CMAKE_CURRENT_BINARY_DIR}/PrusaSlicer-gcodeviewer.rc) + add_executable(PrusaSlicer_app_gcodeviewer WIN32 PrusaSlicer_app_msvc.cpp ${CMAKE_CURRENT_BINARY_DIR}/gcodeviewer.rc ${CMAKE_CURRENT_BINARY_DIR}/libslic3r_version.h) + target_include_directories(PrusaSlicer_app_gcodeviewer PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) # Generate debug symbols even in release mode. if (MSVC) target_link_options(PrusaSlicer_app_gcodeviewer PUBLIC "$<$:/DEBUG>") endif () target_compile_definitions(PrusaSlicer_app_gcodeviewer PRIVATE -DSLIC3R_WRAPPER_NOCONSOLE -DSLIC3R_WRAPPER_GCODEVIEWER) add_dependencies(PrusaSlicer_app_gcodeviewer Slic3r) - set_target_properties(PrusaSlicer_app_gcodeviewer PROPERTIES OUTPUT_NAME "prusa-gcodeviewer") + set_target_properties(PrusaSlicer_app_gcodeviewer PROPERTIES OUTPUT_NAME "@GCODEVIEWER_APP_CMD@") target_link_libraries(PrusaSlicer_app_gcodeviewer PRIVATE boost_headeronly) endif () diff --git a/src/PrusaSlicer.cpp b/src/PrusaSlicer.cpp index 9f0cda32b..fa6bf6708 100644 --- a/src/PrusaSlicer.cpp +++ b/src/PrusaSlicer.cpp @@ -671,7 +671,7 @@ void CLI::print_help(bool include_print_options, PrinterTechnology printer_techn << " (without GUI support)" #endif /* SLIC3R_GUI */ << std::endl - << "https://github.com/supermerill/SuperSlicer" << std::endl << std::endl + << "https://github.com/" << SLIC3R_GITHUB << std::endl << std::endl << "Usage: superslicer [ ACTIONS ] [ TRANSFORM ] [ OPTIONS ] [ file.stl ... ]" << std::endl << std::endl << "Actions:" << std::endl; diff --git a/src/PrusaSlicer_app_msvc.cpp b/src/PrusaSlicer_app_msvc.cpp index 6031b4a43..336503587 100644 --- a/src/PrusaSlicer_app_msvc.cpp +++ b/src/PrusaSlicer_app_msvc.cpp @@ -6,6 +6,7 @@ #include #include #include +#include "libslic3r/libslic3r_version.h" @@ -286,7 +287,7 @@ int wmain(int argc, wchar_t **argv) // printf("Loading Slic3r library: %S\n", path_to_slic3r); HINSTANCE hInstance_Slic3r = LoadLibraryExW(path_to_slic3r, nullptr, 0); if (hInstance_Slic3r == nullptr) { - printf("Slic3r.dll was not loaded, error code: %d\n", GetLastError()); + printf(SLIC3R_APP_NAME ".dll was not loaded, error code: %d\n", GetLastError()); return -1; } diff --git a/src/libslic3r/AppConfig.cpp b/src/libslic3r/AppConfig.cpp index 6790486a9..d97f44176 100644 --- a/src/libslic3r/AppConfig.cpp +++ b/src/libslic3r/AppConfig.cpp @@ -24,7 +24,7 @@ namespace Slic3r { static const std::string VENDOR_PREFIX = "vendor:"; static const std::string MODEL_PREFIX = "model:"; -static const std::string VERSION_CHECK_URL = "https://api.github.com/repos/slic3r/Slic3r/releases"; +static const std::string VERSION_CHECK_URL = "https://api.github.com/repos/" SLIC3R_GITHUB "/releases"; const std::string AppConfig::SECTION_FILAMENTS = "filaments"; const std::string AppConfig::SECTION_MATERIALS = "sla_materials"; diff --git a/src/libslic3r/GCode/GCodeProcessor.cpp b/src/libslic3r/GCode/GCodeProcessor.cpp index 4d6d2df54..9e002c69b 100644 --- a/src/libslic3r/GCode/GCodeProcessor.cpp +++ b/src/libslic3r/GCode/GCodeProcessor.cpp @@ -863,7 +863,7 @@ void GCodeProcessor::process_file(const std::string& filename, bool apply_postpr } }); - // if the gcode was produced by Slic3r, + // if the gcode was produced by this slicer, // extract the config from it try { if (m_producer == EProducer::PrusaSlicer || m_producer == EProducer::SuperSlicer || m_producer == EProducer::Slic3rPE || m_producer == EProducer::Slic3r) { diff --git a/src/libslic3r/libslic3r.h b/src/libslic3r/libslic3r.h index 65a519b3f..a5e8f98dd 100644 --- a/src/libslic3r/libslic3r.h +++ b/src/libslic3r/libslic3r.h @@ -2,9 +2,6 @@ #define _libslic3r_h_ #include "libslic3r_version.h" -#define GCODEVIEWER_APP_NAME "PrusaSlicer G-code Viewer" -#define GCODEVIEWER_APP_KEY "PrusaSlicerGcodeViewer" -#define GCODEVIEWER_BUILD_ID std::string("PrusaSlicer G-code Viewer-") + std::string(SLIC3R_VERSION) + std::string("-UNKNOWN") // this needs to be included early for MSVC (listing it in Build.PL is not enough) #include diff --git a/src/libslic3r/libslic3r_version.h.in b/src/libslic3r/libslic3r_version.h.in index c93610c2e..c5de9cd02 100644 --- a/src/libslic3r/libslic3r_version.h.in +++ b/src/libslic3r/libslic3r_version.h.in @@ -4,8 +4,20 @@ #define SLIC3R_APP_NAME "@SLIC3R_APP_NAME@" #define SLIC3R_APP_WNAME L"@SLIC3R_APP_NAME@" #define SLIC3R_APP_KEY "@SLIC3R_APP_KEY@" +#define SLIC3R_APP_CMD "@SLIC3R_APP_CMD@" +#define SLIC3R_APP_WCMD L"@SLIC3R_APP_CMD@" #define SLIC3R_VERSION "@SLIC3R_VERSION@" #define SLIC3R_VERSION_FULL "@SLIC3R_VERSION_FULL@" #define SLIC3R_BUILD_ID "@SLIC3R_BUILD_ID@" +#define GCODEVIEWER_APP_NAME "@GCODEVIEWER_APP_NAME@" +#define GCODEVIEWER_APP_KEY "@GCODEVIEWER_APP_KEY@" +#define GCODEVIEWER_APP_CMD "@GCODEVIEWER_APP_CMD@" +#define GCODEVIEWER_APP_WCMD L"@GCODEVIEWER_APP_CMD@" +#define GCODEVIEWER_BUILD_ID GCODEVIEWER_APP_NAME "-" SLIC3R_VERSION "-UNKNOWN" + +#define SLIC3R_BASED_ON "@SLIC3R_BASED_ON@" +#define SLIC3R_GITHUB "@SLIC3R_GITHUB@" +#define SLIC3R_INTRO "@SLIC3R_INTRO@" + #endif /* __SLIC3R_VERSION_H */ diff --git a/src/platform/msw/PrusaSlicer-gcodeviewer.rc.in b/src/platform/msw/gcodeviewer.rc.in similarity index 100% rename from src/platform/msw/PrusaSlicer-gcodeviewer.rc.in rename to src/platform/msw/gcodeviewer.rc.in diff --git a/src/slic3r/GUI/AboutDialog.cpp b/src/slic3r/GUI/AboutDialog.cpp index 33ac4def7..b7b4137ec 100644 --- a/src/slic3r/GUI/AboutDialog.cpp +++ b/src/slic3r/GUI/AboutDialog.cpp @@ -81,6 +81,8 @@ CopyrightsDialog::CopyrightsDialog() void CopyrightsDialog::fill_entries() { m_entries = { + { "Slic3r" , "2021 Slic3r" , "https://github.com/slic3r/slic3r" }, + { "Prusaslicer" , "2021 PrusaResearch" , "https://github.com/prusa3d/PrusaSlicer" }, { "wxWidgets" , "2019 wxWidgets" , "https://www.wxwidgets.org/" }, { "OpenGL" , "1997-2019 The Khronos Group Inc" , "https://www.opengl.org/" }, { "GNU gettext" , "1998, 2019 Free Software Foundation, Inc." , "https://www.gnu.org/software/gettext/" }, @@ -266,7 +268,7 @@ AboutDialog::AboutDialog() // TRN "Slic3r _is licensed under the_ License" const std::string is_lecensed_str = _utf8(L("is licensed under the")); const std::string license_str = _utf8(L("GNU Affero General Public License, version 3")); - const std::string based_on_str = _utf8(L("")); + const std::string based_on_str = _utf8(L(SLIC3R_INTRO)); const std::string contributors_str = _utf8(L("Contributions by Henrik Brix Andersen, Nicolas Dandrimont, Mark Hindess, Petr Ledvina, Joseph Lenox, Y. Sapir, Mike Sheldrake, Vojtech Bubnik, Durand Rémi and numerous others.")); const auto text = from_u8( (boost::format( diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp index 8a4e3ac3e..1ecc94bd4 100644 --- a/src/slic3r/GUI/Field.cpp +++ b/src/slic3r/GUI/Field.cpp @@ -112,16 +112,18 @@ void Field::PostInitialize() BUILD(); // For the mode, when settings are in non-modal dialog, neither dialog nor tabpanel doesn't receive wxEVT_KEY_UP event, when some field is selected. - // So, like a workaround check wxEVT_KEY_UP event for the Filed and switch between tabs if Ctrl+(1-4) was pressed + // So, like a workaround check wxEVT_KEY_UP event for the Filed and switch between tabs if Ctrl+(1-6) was pressed if (getWindow()) getWindow()->Bind(wxEVT_KEY_UP, [](wxKeyEvent& evt) { if ((evt.GetModifiers() & wxMOD_CONTROL) != 0) { - int tab_id = -1; - switch (evt.GetKeyCode()) { - case '1': { tab_id = 0; break; } - case '2': { tab_id = 1; break; } - case '3': { tab_id = 2; break; } - case '4': { tab_id = 3; break; } + MainFrame::ETabType tab_id = MainFrame::ETabType::Any; + switch (evt.GetKeyCode()) { + case '1': { tab_id = MainFrame::ETabType::Plater3D; break; } + case '2': { tab_id = MainFrame::ETabType::PlaterPreview; break; } + case '3': { tab_id = MainFrame::ETabType::PlaterGcode; break; } + case '4': { tab_id = MainFrame::ETabType::PrintSettings; break; } + case '5': { tab_id = MainFrame::ETabType::FilamentSettings; break; } + case '6': { tab_id = MainFrame::ETabType::PrintSettings; break; } #ifdef __APPLE__ case 'f': #else /* __APPLE__ */ @@ -130,9 +132,11 @@ void Field::PostInitialize() case 'F': { wxGetApp().plater()->search(false); break; } default: break; } - if (tab_id >= 0) + if (tab_id < MainFrame::ETabType::Any) wxGetApp().mainframe->select_tab(tab_id); - if (tab_id > 0) + if (wxGetApp().mainframe->get_layout() == MainFrame::ESettingsLayout::Tabs + || wxGetApp().mainframe->get_layout() == MainFrame::ESettingsLayout::Old + || tab_id >= MainFrame::ETabType::PrintSettings) // tab panel should be focused for correct navigation between tabs wxGetApp().tab_panel()->SetFocus(); } diff --git a/src/slic3r/GUI/GCodeViewer.cpp b/src/slic3r/GUI/GCodeViewer.cpp index 47de3e301..e5676c12d 100644 --- a/src/slic3r/GUI/GCodeViewer.cpp +++ b/src/slic3r/GUI/GCodeViewer.cpp @@ -706,7 +706,7 @@ void GCodeViewer::export_toolpaths_to_obj(const char* filename) const } fprintf(fp, "# G-Code Toolpaths Materials\n"); - fprintf(fp, "# Generated by %s based on Slic3r\n", SLIC3R_BUILD_ID); + fprintf(fp, "# Generated by " SLIC3R_BUILD_ID " " SLIC3R_BASED_ON "\n"); unsigned int colors_count = 1; for (const Color& color : colors) { @@ -726,7 +726,7 @@ void GCodeViewer::export_toolpaths_to_obj(const char* filename) const } fprintf(fp, "# G-Code Toolpaths\n"); - fprintf(fp, "# Generated by %s based on Slic3r\n", SLIC3R_BUILD_ID); + fprintf(fp, "# Generated by " SLIC3R_BUILD_ID " " SLIC3R_BASED_ON "\n"); fprintf(fp, "\nmtllib ./%s\n", mat_filename.filename().string().c_str()); // get vertices data from vertex buffer on gpu diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index f0b86598f..b4040ee86 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -3873,9 +3873,9 @@ void GLCanvas3D::msw_rescale() void GLCanvas3D::update_tooltip_for_settings_item_in_main_toolbar() { std::string new_tooltip = _u8L("Switch to Settings") + - "\n" + "[" + GUI::shortkey_ctrl_prefix() + "2] - " + _u8L("Print Settings Tab") + - "\n" + "[" + GUI::shortkey_ctrl_prefix() + "3] - " + (m_process->current_printer_technology() == ptFFF ? _u8L("Filament Settings Tab") : _u8L("Material Settings Tab")) + - "\n" + "[" + GUI::shortkey_ctrl_prefix() + "4] - " + _u8L("Printer Settings Tab") ; + "\n" + "[" + GUI::shortkey_ctrl_prefix() + "4] - " + _u8L("Print Settings Tab") + + "\n" + "[" + GUI::shortkey_ctrl_prefix() + "5] - " + (m_process->current_printer_technology() == ptFFF ? _u8L("Filament Settings Tab") : _u8L("Material Settings Tab")) + + "\n" + "[" + GUI::shortkey_ctrl_prefix() + "6] - " + _u8L("Printer Settings Tab") ; m_main_toolbar.set_tooltip(get_main_toolbar_item_id("settings"), new_tooltip); } @@ -4613,14 +4613,14 @@ bool GLCanvas3D::_init_main_toolbar() item.name = "settings"; item.icon_filename = "settings.svg"; - item.tooltip = _u8L("Switch to Settings") + "\n" + "[" + GUI::shortkey_ctrl_prefix() + "2] - " + _u8L("Print Settings Tab") + - "\n" + "[" + GUI::shortkey_ctrl_prefix() + "3] - " + (m_process->current_printer_technology() == ptFFF ? _u8L("Filament Settings Tab") : _u8L("Material Settings Tab")) + - "\n" + "[" + GUI::shortkey_ctrl_prefix() + "4] - " + _u8L("Printer Settings Tab") ; + item.tooltip = _u8L("Switch to Settings") + "\n" + "[" + GUI::shortkey_ctrl_prefix() + "4] - " + _u8L("Print Settings Tab") + + "\n" + "[" + GUI::shortkey_ctrl_prefix() + "5] - " + (m_process->current_printer_technology() == ptFFF ? _u8L("Filament Settings Tab") : _u8L("Material Settings Tab")) + + "\n" + "[" + GUI::shortkey_ctrl_prefix() + "6] - " + _u8L("Printer Settings Tab") ; item.sprite_id = 10; item.enabling_callback = GLToolbarItem::Default_Enabling_Callback; item.visibility_callback = [this]() { return (wxGetApp().app_config->get("new_settings_layout_mode") == "1" || wxGetApp().app_config->get("dlg_settings_layout_mode") == "1"); }; - item.left.action_callback = [this]() { wxGetApp().mainframe->select_tab(); }; + item.left.action_callback = [this]() { wxGetApp().mainframe->select_tab(MainFrame::ETabType::LastSettings); }; if (!m_main_toolbar.add_item(item)) return false; diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 5f3152abf..43e6eb382 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -191,7 +191,7 @@ public: BitmapCache bmp_cache; int logo_size = lround(width * 0.25); //uint32_t color = color_from_hex(Slic3r::GUI::wxGetApp().app_config->get("color_dark")); //uncomment if you also want to modify the icon color - wxBitmap logo_bmp = *bmp_cache.load_svg(wxGetApp().is_editor() ? "super_slicer_logo" : "add_gcode", logo_size, logo_size/*, color*/); + wxBitmap logo_bmp = *bmp_cache.load_svg(wxGetApp().is_editor() ? SLIC3R_APP_KEY "_logo" : "add_gcode", logo_size, logo_size/*, color*/); wxCoord margin = int(m_scale * 20); @@ -253,7 +253,8 @@ private: version = _L("Version") + " " + std::string(SLIC3R_VERSION_FULL); // credits infornation - credits = title + " " + _L("is licensed under the") + " " + _L("GNU Affero General Public License, version 3") + "\n\n" + + credits = _L(SLIC3R_INTRO) + "\n\n" + + title + " " + _L("is licensed under the") + " " + _L("GNU Affero General Public License, version 3") + "\n\n" + _L("Contributions by Vojtech Bubnik, Enrico Turri, Durand Remi, Oleksandra Iushchenko, Tamas Meszaros, Lukas Matena, Vojtech Kral, David Kocik and numerous others.") + "\n\n" + _L("Artwork model by Durand Remi"); @@ -825,7 +826,7 @@ bool GUI_App::on_init_inner() } // create splash screen with updated bmp - scrn = new SplashScreen(bmp.IsOk() ? bmp : create_scaled_bitmap("super_slicer_logo", nullptr, 400), + scrn = new SplashScreen(bmp.IsOk() ? bmp : create_scaled_bitmap( SLIC3R_APP_KEY "_logo", nullptr, 400), wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_TIMEOUT, 4000, splashscreen_pos); #ifndef __linux__ wxYield(); @@ -904,7 +905,7 @@ bool GUI_App::on_init_inner() mainframe = new MainFrame(); // hide settings tabs after first Layout if (is_editor()) - mainframe->select_tab(size_t(0)); + mainframe->select_tab(MainFrame::ETabType::LastPlater); sidebar().obj_list()->init_objects(); // propagate model objects to object list // update_mode(); // !!! do that later @@ -1172,7 +1173,7 @@ void GUI_App::recreate_GUI(const wxString& msg_name) mainframe = new MainFrame(); if (is_editor()) // hide settings tabs after first Layout - mainframe->select_tab(size_t(0)); + mainframe->select_tab(MainFrame::ETabType::LastPlater); // Propagate model objects to object list. sidebar().obj_list()->init_objects(); SetTopWindow(mainframe); @@ -1524,7 +1525,7 @@ bool GUI_App::load_language(wxString language, bool initial) // Get the active language from PrusaSlicer.ini, or empty string if the key does not exist. language = app_config->get("translation_language"); if (! language.empty()) - BOOST_LOG_TRIVIAL(trace) << boost::format("translation_language provided by Slic3r.ini: %1%") % language; + BOOST_LOG_TRIVIAL(trace) << boost::format("translation_language provided by " SLIC3R_APP_NAME ".ini: %1%") % language; // Get the system language. { @@ -1805,7 +1806,7 @@ void GUI_App::add_config_menu(wxMenuBar *menu) // hide full main_sizer for mainFrame mainframe->GetSizer()->Show(false); mainframe->update_layout(); - mainframe->select_tab(size_t(0)); + mainframe->select_tab(MainFrame::ETabType::LastPlater); } break; } diff --git a/src/slic3r/GUI/KBShortcutsDialog.cpp b/src/slic3r/GUI/KBShortcutsDialog.cpp index 178e0003a..aafc3ff20 100644 --- a/src/slic3r/GUI/KBShortcutsDialog.cpp +++ b/src/slic3r/GUI/KBShortcutsDialog.cpp @@ -97,12 +97,12 @@ void KBShortcutsDialog::fill_shortcuts() #endif // __APPLE__ { ctrl + "F", L("Search") }, // Window - { ctrl + "1", L("Select Plater Tab") }, - { ctrl + "2", L("Select Print Settings Tab") }, - { ctrl + "3", L("Select Filament Settings Tab") }, - { ctrl + "4", L("Select Printer Settings Tab") }, - { ctrl + "5", L("Switch to 3D") }, - { ctrl + "6", L("Switch to Preview") }, + { ctrl + "1", L("Select 3d editor Tab") }, + { ctrl + "2", L("Select Layer Preview Tab") }, + { ctrl + "3", L("Select Gcode preview Tab") }, + { ctrl + "4", L("Select Print Settings Tab") }, + { ctrl + "5", L("Select Filament Settings Tab") }, + { ctrl + "6", L("Select Printer Settings Tab") }, { ctrl + "J", L("Print host upload queue") }, { ctrl + "Shift+" + "I", L("Open new instance") }, // View diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index a22d19c5a..c051f4a85 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -94,12 +94,12 @@ static wxIcon main_frame_icon(GUI_App::EAppMode app_mode) if (len > 0 && len < MAX_PATH) { path.erase(path.begin() + len, path.end()); if (app_mode == GUI_App::EAppMode::GCodeViewer) { - // Only in case the slicer was started with --gcodeviewer parameter try to load the icon from prusa-gcodeviewer.exe + // Only in case the slicer was started with --gcodeviewer parameter try to load the icon from gcodeviewer.exe // Otherwise load it from the exe. - for (const std::wstring_view exe_name : { std::wstring_view(L"superslicer.exe"), std::wstring_view(L"superslicer_console.exe") }) + for (const std::wstring_view exe_name : { std::wstring_view(SLIC3R_APP_WCMD L".exe"), std::wstring_view(SLIC3R_APP_WCMD L"_console.exe") }) if (boost::iends_with(path, exe_name)) { path.erase(path.end() - exe_name.size(), path.end()); - path += L"prusa-gcodeviewer.exe"; + path += GCODEVIEWER_APP_WCMD L".exe"; break; } } @@ -131,11 +131,11 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S default: case GUI_App::EAppMode::Editor: m_taskbar_icon = std::make_unique(wxTBI_DOCK); - m_taskbar_icon->SetIcon(wxIcon(Slic3r::var("Slic3r_128px.png"), wxBITMAP_TYPE_PNG), "Slic3r"); + m_taskbar_icon->SetIcon(wxIcon(Slic3r::var("Slic3r_128px.png"), wxBITMAP_TYPE_PNG), SLIC3R_APP_NAME); break; case GUI_App::EAppMode::GCodeViewer: m_taskbar_icon = std::make_unique(wxTBI_DOCK); - m_taskbar_icon->SetIcon(wxIcon(Slic3r::var("PrusaSlicer-gcodeviewer_128px.png"), wxBITMAP_TYPE_PNG), "G-code Viewer"); + m_taskbar_icon->SetIcon(wxIcon(Slic3r::var("PrusaSlicer-gcodeviewer_128px.png"), wxBITMAP_TYPE_PNG), GCODEVIEWER_APP_NAME); break; } #endif // __APPLE__ @@ -150,7 +150,7 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S m_statusbar->embed(this); m_statusbar->set_status_text(_L("Version") + " " + SLIC3R_VERSION + - _L("Remember to check for updates at https://slic3r.org/download")); + _L("Remember to check for updates at https://github.com/" SLIC3R_GITHUB "/releases")); // initialize tabpanel and menubar init_tabpanel(); @@ -262,6 +262,8 @@ void MainFrame::update_layout() }; // On Linux m_plater needs to be removed from m_tabpanel before to reparent it + //clear if previous was old + m_tabpanel_stop_event = true; int plater_page_id = m_tabpanel->FindPage(m_plater); if (plater_page_id != wxNOT_FOUND) m_tabpanel->RemovePage(plater_page_id); @@ -273,24 +275,33 @@ void MainFrame::update_layout() if (m_plater->GetParent() != this) m_plater->Reparent(this); - while(m_tabpanel->GetPage(0)->GetChildren().size() == 0) - m_tabpanel->DeletePage(0); - - for (size_t i = 0; i < m_tabpanel->GetPageCount(); i++) { + for (int i = 0; i < m_tabpanel->GetPageCount(); i++) { m_tabpanel->SetPageImage(i, -1); } m_tabpanel->SetImageList(nullptr); //clear - + if (m_tabpanel->GetParent() != this) m_tabpanel->Reparent(this); + //clear if previous was hidden plater_page_id = (m_plater_page != nullptr) ? m_tabpanel->FindPage(m_plater_page) : wxNOT_FOUND; if (plater_page_id != wxNOT_FOUND) { m_tabpanel->DeletePage(plater_page_id); m_plater_page = nullptr; } + //clear if previous was tabs + for (int i = 0; i < m_tabpanel->GetPageCount(); i++) + if (m_tabpanel->GetPage(i)->GetChildren().empty() && m_tabpanel->GetPage(i)->GetSizer()->GetItemCount() > 0) { + clean_sizer(m_tabpanel->GetPage(i)->GetSizer()); + } + if (m_tabpanel->GetPage(0)->GetChildren().size() == 0 && m_tabpanel->GetPage(1)->GetChildren().size() == 0 && m_tabpanel->GetPage(2)->GetChildren().size() == 0) { + m_tabpanel->DeletePage(2); + m_tabpanel->DeletePage(1); + m_tabpanel->DeletePage(0); + } + clean_sizer(m_main_sizer); clean_sizer(m_settings_dialog.GetSizer()); @@ -298,18 +309,19 @@ void MainFrame::update_layout() m_settings_dialog.Close(); m_tabpanel->Hide(); + m_tabpanel_stop_event = false; m_plater->Hide(); m_plater->enable_view_toolbar(true); m_plater->set_force_preview(Preview::ForceState::NoForce); - m_plater->process_done_callback([this](int) {}); Layout(); }; ESettingsLayout layout = wxGetApp().is_gcode_viewer() ? ESettingsLayout::GCodeViewer : - (wxGetApp().app_config->get("old_settings_layout_mode") == "1" ? ESettingsLayout::Old : - wxGetApp().app_config->get("new_settings_layout_mode") == "1" ? ESettingsLayout::New : - wxGetApp().app_config->get("dlg_settings_layout_mode") == "1" ? ESettingsLayout::Dlg : ESettingsLayout::Old); + (wxGetApp().app_config->get("old_settings_layout_mode") == "1" ? ESettingsLayout::Old : + wxGetApp().app_config->get("tab_settings_layout_mode") == "1" ? ESettingsLayout::Tabs : + wxGetApp().app_config->get("new_settings_layout_mode") == "1" ? ESettingsLayout::Hidden : + wxGetApp().app_config->get("dlg_settings_layout_mode") == "1" ? ESettingsLayout::Dlg : ESettingsLayout::Tabs); if (m_layout == layout) return; @@ -337,8 +349,11 @@ void MainFrame::update_layout() m_layout = layout; + m_layerpreview_menu_item->Enable(m_layout == ESettingsLayout::Tabs || m_layout == ESettingsLayout::Old); + // From the very beginning the Print settings should be selected - m_last_selected_tab = m_layout == ESettingsLayout::Dlg ? 0 : 1; + m_last_selected_setting_tab = 0; + m_last_selected_plater_tab = 999; // Set new settings switch (m_layout) @@ -346,37 +361,67 @@ void MainFrame::update_layout() case ESettingsLayout::Unknown: { break; - } - case ESettingsLayout::Old: + }case ESettingsLayout::Old: { // don't use view_toolbar here m_plater->enable_view_toolbar(false); - m_plater->process_done_callback([this](int process_state) { - //note: this won't call wxEVT_NOTEBOOK_PAGE_CHANGED and it's intended as the process_done caller will update the panel itself. - if (m_tabpanel->GetSelection() != process_state && m_tabpanel->GetSelection() < 3) - { - //m_plater->Hide(); - m_tabpanel->GetCurrentPage()->GetSizer()->Clear(); - m_plater->Reparent(m_tabpanel->GetPage(process_state)); - m_tabpanel->GetPage(process_state)->GetSizer()->Add(m_plater, 1, wxEXPAND); - m_tabpanel->SetSelection(process_state); - m_plater->Show(); - } - }); + //layout + m_plater->Reparent(m_tabpanel); + m_tabpanel->InsertPage(0, m_plater, _L("Plater")); + m_main_sizer->Add(m_tabpanel, 1, wxEXPAND); // icons for ESettingsLayout::Old wxImageList* img_list = nullptr; int icon_size = 0; try { icon_size = atoi(wxGetApp().app_config->get("tab_icon_size").c_str()); } - catch (const std::exception& e) {} - if(icon_size >= 8) - for (std::string icon_name : {"editor_menu", "layers", "preview_menu", "cog"}) { + catch (std::exception e) {} + if (icon_size >= 8) { + std::initializer_list icon_list = { "plater", "cog", "spool_cog", "printer_cog" }; + if (icon_size < 16) + icon_list = { "plater", "cog", "spool", "printer" }; + for (std::string icon_name : icon_list) { const wxBitmap& bmp = create_scaled_bitmap(icon_name, this, icon_size); if (img_list == nullptr) img_list = new wxImageList(bmp.GetWidth(), bmp.GetHeight()); img_list->Add(bmp); } + } + m_tabpanel->AssignImageList(img_list); + if (icon_size >= 8) + { + m_tabpanel->SetPageImage(0, 0); + m_tabpanel->SetPageImage(1, 1); + m_tabpanel->SetPageImage(2, 2); + m_tabpanel->SetPageImage(3, 3); + } + // show + m_plater->Show(); + m_tabpanel->Show(); + break; + } + case ESettingsLayout::Tabs: + { + // don't use view_toolbar here + m_plater->enable_view_toolbar(false); + // icons for ESettingsLayout::Tabs + wxImageList* img_list = nullptr; + int icon_size = 0; + try { + icon_size = atoi(wxGetApp().app_config->get("tab_icon_size").c_str()); + } + catch (std::exception e) {} + if (icon_size >= 8) { + std::initializer_list icon_list = { "editor_menu", "layers", "preview_menu", "cog", "spool_cog", "printer_cog" }; + if (icon_size < 16) + icon_list = { "editor_menu", "layers", "preview_menu", "cog", "spool", "printer" }; + for (std::string icon_name : icon_list) { + const wxBitmap& bmp = create_scaled_bitmap(icon_name, this, icon_size); + if (img_list == nullptr) + img_list = new wxImageList(bmp.GetWidth(), bmp.GetHeight()); + img_list->Add(bmp); + } + } m_tabpanel->AssignImageList(img_list); m_tabpanel->InsertPage(0, new wxPanel(m_tabpanel), _L("3D view")); m_tabpanel->InsertPage(1, new wxPanel(m_tabpanel), _L("Sliced preview")); @@ -390,17 +435,18 @@ void MainFrame::update_layout() m_tabpanel->SetPageImage(1, 1); m_tabpanel->SetPageImage(2, 2); m_tabpanel->SetPageImage(3, 3); - m_tabpanel->SetPageImage(4, 3); - m_tabpanel->SetPageImage(5, 3); + m_tabpanel->SetPageImage(4, 4); + m_tabpanel->SetPageImage(5, 5); } m_plater->Reparent(m_tabpanel->GetPage(0)); m_tabpanel->GetPage(0)->GetSizer()->Add(m_plater, 1, wxEXPAND); + m_tabpanel->ChangeSelection(0); m_main_sizer->Add(m_tabpanel, 1, wxEXPAND); m_plater->Show(); m_tabpanel->Show(); break; } - case ESettingsLayout::New: + case ESettingsLayout::Hidden: { m_main_sizer->Add(m_plater, 1, wxEXPAND); m_tabpanel->Hide(); @@ -466,7 +512,7 @@ void MainFrame::update_layout() // // So, if we haven't possibility to set MinSize() for the MainFrame, // // set the MinSize() as a half of regular for the m_plater and m_tabpanel, when settings layout is in slNew mode // // Otherwise, MainFrame will be maximized by height -// if (m_layout == ESettingsLayout::New) { +// if (m_layout == ESettingsLayout::Hidden) { // wxSize size = wxGetApp().get_min_size(); // size.SetHeight(int(0.5 * size.GetHeight())); // m_plater->SetMinSize(size); @@ -475,7 +521,7 @@ void MainFrame::update_layout() //#endif #ifdef __APPLE__ - m_plater->sidebar().change_top_border_for_mode_sizer(m_layout != ESettingsLayout::Old); + m_plater->sidebar().change_top_border_for_mode_sizer(m_layout != ESettingsLayout::Tabs && m_layout != ESettingsLayout::Old); #endif Layout(); @@ -582,7 +628,9 @@ void MainFrame::update_title() } } - title += wxString(SLIC3R_APP_NAME) + " " + wxString(SLIC3R_VERSION) ; + title += wxString(SLIC3R_APP_NAME) + "_" + wxString(SLIC3R_VERSION) ; + if (wxGetApp().is_editor() && !has_name) + title += (" " + _L(SLIC3R_BASED_ON)); SetTitle(title); } @@ -600,6 +648,8 @@ void MainFrame::init_tabpanel() m_tabpanel->Bind(wxEVT_NOTEBOOK_PAGE_CHANGED, [this](wxEvent&) { + if (m_tabpanel_stop_event) + return; wxWindow* panel = m_tabpanel->GetCurrentPage(); Tab* tab = dynamic_cast(panel); @@ -607,19 +657,43 @@ void MainFrame::init_tabpanel() if (panel == nullptr || (tab != nullptr && !tab->supports_printer_technology(m_plater->printer_technology()))) return; - auto& tabs_list = wxGetApp().tabs_list; - int last_selected_tab = m_last_selected_tab; + std::vector& tabs_list = wxGetApp().tabs_list; + int last_selected_plater_tab = m_last_selected_plater_tab; + int last_selected_setting_tab = m_last_selected_setting_tab; if (tab && std::find(tabs_list.begin(), tabs_list.end(), tab) != tabs_list.end()) { // On GTK, the wxEVT_NOTEBOOK_PAGE_CHANGED event is triggered // before the MainFrame is fully set up. tab->OnActivate(); - m_last_selected_tab = m_tabpanel->GetSelection(); + if (this->m_layout == ESettingsLayout::Tabs) + last_selected_setting_tab = m_tabpanel->GetSelection() - 3; + if (this->m_layout == ESettingsLayout::Dlg) + last_selected_setting_tab = m_tabpanel->GetSelection(); + else + last_selected_setting_tab = m_tabpanel->GetSelection() - 1; } - else if (this->m_layout == ESettingsLayout::Old) { - //m_plater->Hide(); + else if (this->m_layout == ESettingsLayout::Tabs) { + if (last_selected_plater_tab == m_tabpanel->GetSelection()) { + std::cout << "Page changed to the same one (" << m_last_selected_plater_tab << ") no need to do anything\n"; + return; + } + bool need_freeze = !this->IsFrozen(); + if(need_freeze) Freeze(); + std::cout << "I switched to tab " << m_tabpanel->GetSelection() << " and so i need to change the panel position & content\n"; + size_t new_tab = m_tabpanel->GetSelection(); + + size_t max = 0; + for (int i = 0; i < 3; i++) + max = std::max(max, m_tabpanel->GetPage(i)->GetSizer()->GetItemCount()); + std::cout << " 1 - hide & clear the sizers: " << max << "->"; for(int i=0;i<3;i++) m_tabpanel->GetPage(i)->GetSizer()->Clear(); + max = 0; + for (int i = 0; i < 3; i++) + max = std::max(max, m_tabpanel->GetPage(i)->GetSizer()->GetItemCount()); + std::cout << max << "\n"; + m_plater->Reparent(m_tabpanel->GetCurrentPage()); + std::cout << " 2 - change parent from tab " << m_last_selected_plater_tab << " to tab " << m_tabpanel->GetSelection() << "\n"; if (m_tabpanel->GetSelection() == 0) this->m_plater->select_view_3D("3D"); else if (m_tabpanel->GetSelection() == 1) { @@ -638,10 +712,24 @@ void MainFrame::init_tabpanel() }else this->m_plater->select_view_3D("Preview"); } + std::cout << " 3 - redraw\n"; + std::cout << " 4 - add to new sizer: " << m_tabpanel->GetCurrentPage()->GetSizer()->GetItemCount() << "->"; m_tabpanel->GetCurrentPage()->GetSizer()->Add(m_plater, 1, wxEXPAND); + std::cout << m_tabpanel->GetCurrentPage()->GetSizer()->GetItemCount() << "\n"; m_plater->Show(); - }else - select_tab(size_t(0)); // select Plater + std::cout << "End of change for the panel position & content, tab is "<< m_tabpanel->GetSelection() <<"\n"; + m_last_selected_plater_tab = m_tabpanel->GetSelection(); + + if (need_freeze) Thaw(); +#ifdef __APPLE__ + m_tabpanel->ChangeSelection(new_tab); + m_tabpanel->Refresh(); + std::cout << "Macos: force tab selection to "<< new_tab <<" : " << m_tabpanel->GetSelection() << "\n"; +#endif + } else { + select_tab(MainFrame::ETabType::LastPlater); // select Plater + m_last_selected_plater_tab = 999; + } }); m_plater = new Plater(this, this); @@ -753,7 +841,7 @@ bool MainFrame::is_active_and_shown_tab(Tab* tab) if (m_layout == ESettingsLayout::Dlg) return m_settings_dialog.IsShown(); - if (m_layout == ESettingsLayout::New) + if (m_layout == ESettingsLayout::Hidden) return m_main_sizer->IsShown(m_tabpanel); return true; @@ -854,9 +942,10 @@ bool MainFrame::can_change_view() const switch (m_layout) { default: { return false; } - case ESettingsLayout::New: { return m_plater->IsShown(); } + case ESettingsLayout::Hidden: { return m_plater->IsShown(); } case ESettingsLayout::Dlg: { return true; } - case ESettingsLayout::Old: { + case ESettingsLayout::Old: + case ESettingsLayout::Tabs: { int page_id = m_tabpanel->GetSelection(); return page_id != wxNOT_FOUND && dynamic_cast(m_tabpanel->GetPage((size_t)page_id)) != nullptr; } @@ -965,25 +1054,29 @@ static const wxString sep_space = ""; static wxMenu* generate_help_menu() { wxMenu* helpMenu = new wxMenu(); - append_menu_item(helpMenu, wxID_ANY, _L("Slic3r Releases"), _L("Open the Slic3r releases page in your browser"), + append_menu_item(helpMenu, wxID_ANY, _L(SLIC3R_APP_NAME " Releases"), _L("Open the Slic3r releases page in your browser"), [](wxCommandEvent&) { wxLaunchDefaultBrowser("https://slic3r.org/download/"); }); - append_menu_item(helpMenu, wxID_ANY, _L("Slic3r manual"), _L("Open the Slic3r manual in your browser"), - [](wxCommandEvent&) { wxLaunchDefaultBrowser("http://manual.slic3r.org"); }); - append_menu_item(helpMenu, wxID_ANY, _L("Slic3r wiki"), _L("Open the Slic3r wiki in your browser"), + append_menu_item(helpMenu, wxID_ANY, _L(SLIC3R_APP_NAME " wiki", _L("Open the Slic3r wiki in your browser"), [](wxCommandEvent&) { wxLaunchDefaultBrowser("http://github.com/slic3r/Slic3r/wiki"); }); - append_menu_item(helpMenu, wxID_ANY, _L("Slic3r website"), _L("Open the Slic3r website in your browser"), + append_menu_item(helpMenu, wxID_ANY, _L(SLIC3R_APP_NAME " website"), _L("Open the Slic3r website in your browser"), [](wxCommandEvent&) { wxLaunchDefaultBrowser("http://slic3r.org"); }); //# my $versioncheck = $self->_append_menu_item($helpMenu, "Check for &Updates...", "Check for new Slic3r versions", sub{ //# wxTheApp->check_version(1); //# }); //# $versioncheck->Enable(wxTheApp->have_version_check); + append_menu_item(helpMenu, wxID_ANY, wxString::Format(_L("Slic3r Manual")), + wxString::Format(_L("Open the Slic3r Manual in your browser")), + // [this](wxCommandEvent&) { wxGetApp().open_web_page_localized("http://manual.slic3r.org"); }); + // append_menu_item(helpMenu, wxID_ANY, wxString::Format(_L("%s &Manual"), SLIC3R_APP_NAME), + // wxString::Format(_L("Open the %s manual in your browser"), SLIC3R_APP_NAME), + [](wxCommandEvent&) { wxLaunchDefaultBrowser("http://manual.slic3r.org/"); }); helpMenu->AppendSeparator(); append_menu_item(helpMenu, wxID_ANY, _L("System &Info"), _L("Show system information"), [](wxCommandEvent&) { wxGetApp().system_info(); }); append_menu_item(helpMenu, wxID_ANY, _L("Show &Configuration Folder"), _L("Show user configuration folder (datadir)"), [](wxCommandEvent&) { Slic3r::GUI::desktop_open_datadir_folder(); }); append_menu_item(helpMenu, wxID_ANY, _L("Report an I&ssue"), wxString::Format(_L("Report an issue on %s"), SLIC3R_APP_NAME), - [](wxCommandEvent&) { wxLaunchDefaultBrowser("http://github.com/slic3r/Slic3r/issues/new"); }); + [](wxCommandEvent&) { wxLaunchDefaultBrowser("http://github.com/" SLIC3R_GITHUB "/issues/new"); }); if (wxGetApp().is_editor()) append_menu_item(helpMenu, wxID_ANY, wxString::Format(_L("&About %s"), SLIC3R_APP_NAME), _L("Show about dialog"), @@ -1259,31 +1352,28 @@ void MainFrame::init_menubar_as_editor() auto windowMenu = new wxMenu(); { if (m_plater) { - append_menu_item(windowMenu, wxID_HIGHEST + 1, _L("&Plater Tab") + "\tCtrl+1", _L("Show the plater"), - [this](wxCommandEvent&) { select_tab(size_t(0)); }, "plater", nullptr, + append_menu_item(windowMenu, wxID_HIGHEST + 1, _L("3D &Plater Tab") + "\tCtrl+1", _L("Show the editor of the input models"), + [this](wxCommandEvent&) { select_tab(ETabType::Plater3D); }, "editor_menu", nullptr, + []() {return true; }, this); + m_layerpreview_menu_item = append_menu_item(windowMenu, wxID_HIGHEST + 2, _L("Layer previe&w Tab") + "\tCtrl+2", _L("Show the layers from the slicing process"), + [this](wxCommandEvent&) { select_tab(ETabType::PlaterPreview); }, "layers", nullptr, + []() {return true; }, this); + append_menu_item(windowMenu, wxID_HIGHEST + 3, _L("GCode Pre&view Tab") + "\tCtrl+3", _L("Show the preview of the gcode output"), + [this](wxCommandEvent&) { select_tab(ETabType::PlaterGcode); }, "preview_menu", nullptr, []() {return true; }, this); windowMenu->AppendSeparator(); } - append_menu_item(windowMenu, wxID_HIGHEST + 2, _L("P&rint Settings Tab") + "\tCtrl+2", _L("Show the print settings"), - [this/*, tab_offset*/](wxCommandEvent&) { select_tab(1); }, "cog", nullptr, + append_menu_item(windowMenu, wxID_HIGHEST + 4, _L("P&rint Settings Tab") + "\tCtrl+4", _L("Show the print settings"), + [this/*, tab_offset*/](wxCommandEvent&) { select_tab(ETabType::PrintSettings); }, "cog", nullptr, []() {return true; }, this); - wxMenuItem* item_material_tab = append_menu_item(windowMenu, wxID_HIGHEST + 3, _L("&Filament Settings Tab") + "\tCtrl+3", _L("Show the filament settings"), - [this/*, tab_offset*/](wxCommandEvent&) { select_tab(2); }, "spool", nullptr, + wxMenuItem* item_material_tab = append_menu_item(windowMenu, wxID_HIGHEST + 5, _L("&Filament Settings Tab") + "\tCtrl+5", _L("Show the filament settings"), + [this/*, tab_offset*/](wxCommandEvent&) { select_tab(ETabType::FilamentSettings); }, "spool", nullptr, []() {return true; }, this); m_changeable_menu_items.push_back(item_material_tab); - wxMenuItem* item_printer_tab = append_menu_item(windowMenu, wxID_HIGHEST + 4, _L("Print&er Settings Tab") + "\tCtrl+4", _L("Show the printer settings"), - [this/*, tab_offset*/](wxCommandEvent&) { select_tab(3); }, "printer", nullptr, + wxMenuItem* item_printer_tab = append_menu_item(windowMenu, wxID_HIGHEST + 6, _L("Print&er Settings Tab") + "\tCtrl+6", _L("Show the printer settings"), + [this/*, tab_offset*/](wxCommandEvent&) { select_tab(ETabType::PrinterSettings); }, "printer", nullptr, []() {return true; }, this); m_changeable_menu_items.push_back(item_printer_tab); - if (m_plater) { - windowMenu->AppendSeparator(); - append_menu_item(windowMenu, wxID_HIGHEST + 5, _L("3&D") + "\tCtrl+5", _L("Show the 3D editing view"), - [this](wxCommandEvent&) { m_plater->select_view_3D("3D"); }, "editor_menu", nullptr, - [this](){return can_change_view(); }, this); - append_menu_item(windowMenu, wxID_HIGHEST + 6, _L("Pre&view") + "\tCtrl+6", _L("Show the 3D slices preview"), - [this](wxCommandEvent&) { m_plater->select_view_3D("Preview"); }, "preview_menu", nullptr, - [this](){return can_change_view(); }, this); - } windowMenu->AppendSeparator(); append_menu_item(windowMenu, wxID_ANY, _L("Print &Host Upload Queue") + "\tCtrl+J", _L("Display the Print Host Upload Queue window"), @@ -1771,13 +1861,16 @@ void MainFrame::select_tab(Tab* tab) { if (!tab) return; - int page_idx = m_tabpanel->FindPage(tab); - if (page_idx != wxNOT_FOUND && m_layout == ESettingsLayout::Dlg) - page_idx++; - select_tab(size_t(page_idx)); + std::vector& tabs_list = wxGetApp().tabs_list; + std::vector::iterator it_tab = std::find(tabs_list.begin(), tabs_list.end(), tab); + if (it_tab != tabs_list.end()) { + select_tab((ETabType)((uint8_t)ETabType::PrintSettings + uint8_t(it_tab - tabs_list.begin()))); + } + + select_tab(ETabType::LastSettings); } -void MainFrame::select_tab(size_t tab/* = size_t(-1)*/) +void MainFrame::select_tab(ETabType tab /* = Any*/, bool keep_tab_type) { bool tabpanel_was_hidden = false; @@ -1785,7 +1878,26 @@ void MainFrame::select_tab(size_t tab/* = size_t(-1)*/) // We should select/activate tab before its showing to avoid an UI-flickering auto select = [this, tab](bool was_hidden) { // when tab == -1, it means we should show the last selected tab - size_t new_selection = tab == (size_t)(-1) ? m_last_selected_tab : (m_layout == ESettingsLayout::Dlg && tab != 0) ? tab - 1 : tab; + size_t new_selection = 0; + if (tab <= ETabType::LastPlater) { + //select plater + new_selection = (uint8_t)tab; + if (tab == ETabType::LastPlater) + new_selection = m_last_selected_plater_tab > 2 ? 0 : m_last_selected_plater_tab; + if (m_layout != ESettingsLayout::Tabs) + new_selection = 0; + + } else if (tab <= ETabType::LastSettings) { + //select setting + new_selection = (uint8_t)tab - (uint8_t)ETabType::PrintSettings; + if (tab == ETabType::LastSettings) + new_selection = m_last_selected_setting_tab > 2 ? 0 : m_last_selected_setting_tab; + //push to the correct position + if (m_layout == ESettingsLayout::Tabs) + new_selection = m_last_selected_setting_tab + 3; + else if (m_layout != ESettingsLayout::Dlg) + new_selection = new_selection + 1; + } if (m_tabpanel->GetSelection() != (int)new_selection) m_tabpanel->SetSelection(new_selection); @@ -1796,8 +1908,20 @@ void MainFrame::select_tab(size_t tab/* = size_t(-1)*/) } }; + if (m_layout != ESettingsLayout::Tabs) { + if (tab == ETabType::Plater3D || (tab == ETabType::LastPlater && m_last_selected_plater_tab == 0)) { + m_plater->select_view_3D("3D"); + } else if (tab == ETabType::PlaterPreview || (tab == ETabType::LastPlater && m_last_selected_plater_tab == 1)) { + m_plater->select_view_3D("Preview"); + } else if (tab == ETabType::PlaterGcode || (tab == ETabType::LastPlater && m_last_selected_plater_tab == 2)) { + m_plater->select_view_3D("Preview"); + } + } + if (m_layout == ESettingsLayout::Dlg) { - if (tab==0) { + if (keep_tab_type) + return; + if (tab <= ETabType::LastPlater) { if (m_settings_dialog.IsShown()) this->SetFocus(); // plater should be focused for correct navigation inside search window @@ -1828,21 +1952,35 @@ void MainFrame::select_tab(size_t tab/* = size_t(-1)*/) } #endif } - else if (m_layout == ESettingsLayout::New) { - m_main_sizer->Show(m_plater, tab == 0); + else if (m_layout == ESettingsLayout::Hidden) { + if (keep_tab_type && m_tabpanel->GetSelection()>0) + return; + m_main_sizer->Show(m_plater, tab <= ETabType::LastPlater); tabpanel_was_hidden = !m_main_sizer->IsShown(m_tabpanel); select(tabpanel_was_hidden); - m_main_sizer->Show(m_tabpanel, tab != 0); + m_main_sizer->Show(m_tabpanel, tab > ETabType::LastPlater); // plater should be focused for correct navigation inside search window - if (tab == 0 && m_plater->canvas3D()->is_search_pressed()) + if (tab <= ETabType::LastPlater && m_plater->canvas3D()->is_search_pressed()) m_plater->SetFocus(); Layout(); } + else if (m_layout == ESettingsLayout::Old) { + if (keep_tab_type && m_tabpanel->GetSelection() > 0) + return; + else + select(false); + } + else if (m_layout == ESettingsLayout::Tabs) { + if (keep_tab_type && ( (m_tabpanel->GetSelection() >=3 && tab <= ETabType::LastPlater) || (m_tabpanel->GetSelection() < 3 && tab > ETabType::LastPlater))) + return; + else + select(false); + } else select(false); - // When we run application in ESettingsLayout::New or ESettingsLayout::Dlg mode, tabpanel is hidden from the very beginning + // When we run application in ESettingsLayout::Hidden or ESettingsLayout::Dlg mode, tabpanel is hidden from the very beginning // and as a result Tab::update_changed_tree_ui() function couldn't update m_is_nonsys_values values, // which are used for update TreeCtrl and "revert_buttons". // So, force the call of this function for Tabs, if tab panel was hidden @@ -2000,10 +2138,12 @@ SettingsDialog::SettingsDialog(MainFrame* mainframe) auto key_up_handker = [this](wxKeyEvent& evt) { if ((evt.GetModifiers() & wxMOD_CONTROL) != 0) { switch (evt.GetKeyCode()) { - case '1': { m_main_frame->select_tab(size_t(0)); break; } - case '2': { m_main_frame->select_tab(1); break; } - case '3': { m_main_frame->select_tab(2); break; } - case '4': { m_main_frame->select_tab(3); break; } + case '1': { m_main_frame->select_tab(MainFrame::ETabType::Plater3D); break; } + case '2': { m_main_frame->select_tab(MainFrame::ETabType::Plater3D); break; } + case '3': { m_main_frame->select_tab(MainFrame::ETabType::PlaterGcode); break; } + case '4': { m_main_frame->select_tab(MainFrame::ETabType::PrintSettings); break; } + case '5': { m_main_frame->select_tab(MainFrame::ETabType::FilamentSettings); break; } + case '6': { m_main_frame->select_tab(MainFrame::ETabType::PrinterSettings); break; } #ifdef __APPLE__ case 'f': #else /* __APPLE__ */ diff --git a/src/slic3r/GUI/MainFrame.hpp b/src/slic3r/GUI/MainFrame.hpp index 9504376b4..45813c1ed 100644 --- a/src/slic3r/GUI/MainFrame.hpp +++ b/src/slic3r/GUI/MainFrame.hpp @@ -81,7 +81,8 @@ class MainFrame : public DPIFrame - size_t m_last_selected_tab; + size_t m_last_selected_plater_tab; + size_t m_last_selected_setting_tab; std::string get_base_name(const wxString &full_name, const char *extension = nullptr) const; std::string get_dir_name(const wxString &full_name) const; @@ -117,17 +118,36 @@ class MainFrame : public DPIFrame // vector of a MenuBar items changeable in respect to printer technology std::vector m_changeable_menu_items; + wxMenuItem* m_layerpreview_menu_item; wxFileHistory m_recent_projects; +public: + enum class ESettingsLayout { Unknown, Old, - New, + Tabs, + Hidden, Dlg, GCodeViewer }; + + enum class ETabType : uint8_t + { + Plater3D, + PlaterPreview, + PlaterGcode, + LastPlater, + PrintSettings, + FilamentSettings, + PrinterSettings, + LastSettings, + Any + }; + +private: ESettingsLayout m_layout{ ESettingsLayout::Unknown }; @@ -136,6 +156,7 @@ protected: virtual void on_sys_color_changed() override; public: + MainFrame(); ~MainFrame() = default; @@ -162,7 +183,7 @@ public: void update_ui_from_settings(bool apply_free_camera_correction = true); bool is_loaded() const { return m_loaded; } bool is_last_input_file() const { return !m_qs_last_input_file.IsEmpty(); } - bool is_dlg_layout() const { return m_layout == ESettingsLayout::Dlg; } + ESettingsLayout get_layout() const { return m_layout; } void quick_slice(const int qs = qsUndef); void reslice_now(); @@ -177,8 +198,9 @@ public: void load_config(const DynamicPrintConfig& config); // Select tab in m_tabpanel // When tab == -1, will be selected last selected tab + // 0 = a plater tab, 1 = print setting, 2 = filament settign, 3 = printer setting void select_tab(Tab* tab); - void select_tab(size_t tab = size_t(-1)); + void select_tab(ETabType tab = ETabType::Any, bool keep_tab_type = false); void select_view(const std::string& direction); // Propagate changed configuration from the Tab to the Plater and save changes to the AppConfig void on_config_changed(DynamicPrintConfig* cfg) const ; @@ -189,6 +211,7 @@ public: Plater* m_plater { nullptr }; wxNotebook* m_tabpanel { nullptr }; + bool m_tabpanel_stop_event = false; SettingsDialog m_settings_dialog; wxWindow* m_plater_page{ nullptr }; wxProgressDialog* m_progress_dialog { nullptr }; diff --git a/src/slic3r/GUI/NotificationManager.hpp b/src/slic3r/GUI/NotificationManager.hpp index 8d085e389..de7204038 100644 --- a/src/slic3r/GUI/NotificationManager.hpp +++ b/src/slic3r/GUI/NotificationManager.hpp @@ -474,7 +474,7 @@ private: {NotificationType::PresetUpdateAvailable, NotificationLevel::ImportantNotification, 20, _u8L("Configuration update is available."), _u8L("See more."), [](wxEvtHandler* evnthndlr){ if (evnthndlr != nullptr) wxPostEvent(evnthndlr, PresetUpdateAvailableClickedEvent(EVT_PRESET_UPDATE_AVAILABLE_CLICKED)); return true; }}, {NotificationType::NewAppAvailable, NotificationLevel::ImportantNotification, 20, _u8L("New version is available."), _u8L("See Releases page."), [](wxEvtHandler* evnthndlr){ - wxLaunchDefaultBrowser("https://github.com/slic3r/Slic3r/releases"); return true; }}, + wxLaunchDefaultBrowser("https://github.com/" SLIC3R_GITHUB "/releases"); return true; }}, {NotificationType::EmptyColorChangeCode, NotificationLevel::RegularNotification, 10, _u8L("You have just added a G-code for color change, but its value is empty.\n" "To export the G-code correctly, check the \"Color Change G-code\" in \"Printer Settings > Custom G-code\"") }, diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index b54f6548a..8de7209a7 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -992,7 +992,7 @@ void Sidebar::jump_to_option(size_t selected) wxGetApp().get_tab(opt.type)->activate_option(boost::nowide::narrow(opt.opt_key), boost::nowide::narrow(opt.category)); // Switch to the Settings NotePad -// wxGetApp().mainframe->select_tab(); +// wxGetApp().mainframe->select_tab(MainFrame::ETabType::LastSettings); } ObjectManipulation* Sidebar::obj_manipul() @@ -3095,14 +3095,14 @@ unsigned int Plater::priv::update_background_process(bool force_validation, bool } //update tab if needed - if (invalidated != Print::ApplyStatus::APPLY_STATUS_UNCHANGED && process_done_callback) + if (invalidated != Print::ApplyStatus::APPLY_STATUS_UNCHANGED) { if (this->preview->can_display_gcode()) - process_done_callback(2); + main_frame->select_tab(MainFrame::ETabType::PlaterGcode, true); else if (this->preview->can_display_volume()) - process_done_callback(1); + main_frame->select_tab(MainFrame::ETabType::PlaterPreview, true); else - process_done_callback(0); + main_frame->select_tab(MainFrame::ETabType::Plater3D, true); } return return_state; } @@ -3708,7 +3708,7 @@ void Plater::priv::on_slicing_update(SlicingStatusEvent &evt) void Plater::priv::on_slicing_completed(wxCommandEvent & evt) { notification_manager->push_slicing_complete_notification(evt.GetInt(), is_sidebar_collapsed()); - process_done_callback(1); + main_frame->select_tab(MainFrame::ETabType::PlaterPreview); switch (this->printer_technology) { case ptFFF: this->update_fff_scene(); @@ -3788,7 +3788,7 @@ void Plater::priv::on_process_completed(SlicingProcessCompletedEvent &evt) this->background_process.stop(); this->statusbar()->reset_cancel_callback(); this->statusbar()->stop_busy(); - process_done_callback(2); + main_frame->select_tab(MainFrame::ETabType::PlaterGcode); // Reset the "export G-code path" name, so that the automatic background processing will be enabled again. this->background_process.reset_export(); @@ -4281,7 +4281,7 @@ bool Plater::priv::init_view_toolbar() item.name = "3D"; item.icon_filename = "editor.svg"; - item.tooltip = _utf8(L("3D editor view")) + " [" + GUI::shortkey_ctrl_prefix() + "5]"; + item.tooltip = _utf8(L("3D editor view")) + " [" + GUI::shortkey_ctrl_prefix() + "1]"; item.sprite_id = 0; item.left.action_callback = [this]() { if (this->q != nullptr) wxPostEvent(this->q, SimpleEvent(EVT_GLVIEWTOOLBAR_3D)); }; if (!view_toolbar.add_item(item)) @@ -4289,7 +4289,7 @@ bool Plater::priv::init_view_toolbar() item.name = "Preview"; item.icon_filename = "preview.svg"; - item.tooltip = _utf8(L("Preview")) + " [" + GUI::shortkey_ctrl_prefix() + "6]"; + item.tooltip = _utf8(L("Preview")) + " [" + GUI::shortkey_ctrl_prefix() + "3]"; item.sprite_id = 1; item.left.action_callback = [this]() { if (this->q != nullptr) wxPostEvent(this->q, SimpleEvent(EVT_GLVIEWTOOLBAR_PREVIEW)); }; if (!view_toolbar.add_item(item)) @@ -5238,9 +5238,6 @@ Preview::ForceState Plater::get_force_preview() { return p->preview->get_force_state(); } -void Plater::process_done_callback(std::function process_done_callback) { - p->process_done_callback = process_done_callback; -} bool Plater::is_preview_shown() const { return p->is_preview_shown(); } bool Plater::is_preview_loaded() const { return p->is_preview_loaded(); } diff --git a/src/slic3r/GUI/Plater.hpp b/src/slic3r/GUI/Plater.hpp index 6949f89fb..87fe4e2d1 100644 --- a/src/slic3r/GUI/Plater.hpp +++ b/src/slic3r/GUI/Plater.hpp @@ -169,7 +169,6 @@ public: void select_view_3D(const std::string& name); void set_force_preview(Preview::ForceState force); Preview::ForceState get_force_preview(); - void process_done_callback(std::function process_done_callback); bool is_preview_shown() const; bool is_preview_loaded() const; diff --git a/src/slic3r/GUI/Preferences.cpp b/src/slic3r/GUI/Preferences.cpp index 780d858c2..56df9be00 100644 --- a/src/slic3r/GUI/Preferences.cpp +++ b/src/slic3r/GUI/Preferences.cpp @@ -590,22 +590,24 @@ void PreferencesDialog::create_settings_mode_widget() _L("Settings in non-modal window") }; auto app_config = get_app_config(); - int selection = app_config->get("old_settings_layout_mode") == "1" ? 0 : - app_config->get("new_settings_layout_mode") == "1" ? 1 : - app_config->get("dlg_settings_layout_mode") == "1" ? 2 : 0; + int selection = app_config->get("tab_settings_layout_mode") == "1" ? 0 : + app_config->get("old_settings_layout_mode") == "1" ? 1 : + app_config->get("new_settings_layout_mode") == "1" ? 2 : + app_config->get("dlg_settings_layout_mode") == "1" ? 3 : 1; wxWindow* parent = m_optgroup_gui->parent(); m_layout_mode_box = new wxRadioBox(parent, wxID_ANY, _L("Layout Options"), wxDefaultPosition, wxDefaultSize, - WXSIZEOF(choices), choices, 3, wxRA_SPECIFY_ROWS); + WXSIZEOF(choices), choices, 4, wxRA_SPECIFY_ROWS); m_layout_mode_box->SetFont(wxGetApp().normal_font()); m_layout_mode_box->SetSelection(selection); m_layout_mode_box->Bind(wxEVT_RADIOBOX, [this](wxCommandEvent& e) { int selection = e.GetSelection(); - m_values["old_settings_layout_mode"] = boost::any_cast(selection == 0) ? "1" : "0"; - m_values["new_settings_layout_mode"] = boost::any_cast(selection == 1) ? "1" : "0"; - m_values["dlg_settings_layout_mode"] = boost::any_cast(selection == 2) ? "1" : "0"; + m_values["tab_settings_layout_mode"] = boost::any_cast(selection == 0) ? "1" : "0"; + m_values["old_settings_layout_mode"] = boost::any_cast(selection == 1) ? "1" : "0"; + m_values["new_settings_layout_mode"] = boost::any_cast(selection == 2) ? "1" : "0"; + m_values["dlg_settings_layout_mode"] = boost::any_cast(selection == 3) ? "1" : "0"; }); auto sizer = new wxBoxSizer(wxHORIZONTAL); diff --git a/src/slic3r/GUI/PresetComboBoxes.cpp b/src/slic3r/GUI/PresetComboBoxes.cpp index 8dd35a591..d42853dfd 100644 --- a/src/slic3r/GUI/PresetComboBoxes.cpp +++ b/src/slic3r/GUI/PresetComboBoxes.cpp @@ -696,7 +696,7 @@ bool PlaterPresetComboBox::switch_to_tab() wxGetApp().tab_panel()->SetSelection(page_id); // Switch to Settings NotePad - wxGetApp().mainframe->select_tab(); + wxGetApp().mainframe->select_tab(MainFrame::ETabType::LastSettings); return true; } diff --git a/src/slic3r/GUI/UnsavedChangesDialog.cpp b/src/slic3r/GUI/UnsavedChangesDialog.cpp index 007c25e72..052fa6b60 100644 --- a/src/slic3r/GUI/UnsavedChangesDialog.cpp +++ b/src/slic3r/GUI/UnsavedChangesDialog.cpp @@ -559,7 +559,7 @@ UnsavedChangesDialog::UnsavedChangesDialog(Preset::Type type, PresetCollection* const std::string& def_action = wxGetApp().app_config->get(m_app_config_key); if (def_action == "none") { - if (wxGetApp().mainframe->is_dlg_layout() && wxGetApp().mainframe->m_settings_dialog.HasFocus()) + if (wxGetApp().mainframe->get_layout() == MainFrame::ESettingsLayout::Dlg && wxGetApp().mainframe->m_settings_dialog.HasFocus()) this->SetPosition(wxGetApp().mainframe->m_settings_dialog.GetPosition()); this->CenterOnScreen(); } diff --git a/src/slic3r/GUI/UpdateDialogs.cpp b/src/slic3r/GUI/UpdateDialogs.cpp index 9b70fe8ac..20f148130 100644 --- a/src/slic3r/GUI/UpdateDialogs.cpp +++ b/src/slic3r/GUI/UpdateDialogs.cpp @@ -25,9 +25,9 @@ namespace Slic3r { namespace GUI { -static const char* URL_CHANGELOG = "https://files.prusa3d.com/?latest=slicer-stable&lng=%1%"; -static const char* URL_DOWNLOAD = "https://slic3r.org/download/"; -static const char* URL_DEV = "https://github.com/slic3r/Slic3r/releases/tag/version_%1%"; +static const char* URL_CHANGELOG = "https://github.com/" SLIC3R_GITHUB "/releases"; +static const char* URL_DOWNLOAD = "https://github.com/" SLIC3R_GITHUB "/releases"; +static const char* URL_DEV = "https://github.com/" SLIC3R_GITHUB "/releases/tag/version_%1%"; static const std::string CONFIG_UPDATE_WIKI_URL("https://github.com/prusa3d/PrusaSlicer/wiki/Slic3r-PE-1.40-configuration-update"); @@ -285,7 +285,6 @@ MsgDataLegacy::MsgDataLegacy() : content_sizer->AddSpacer(VERT_SPACING); auto *text2 = new wxStaticText(this, wxID_ANY, _(L("For more information please visit Prusa wiki page:"))); - static const wxString url("https://github.com/prusa3d/PrusaSlicer/wiki/Slic3r-PE-1.40-configuration-update"); // The wiki page name is intentionally not localized: auto *link = new wxHyperlinkCtrl(this, wxID_ANY, wxString::Format("%s 1.40 configuration update", SLIC3R_APP_NAME), CONFIG_UPDATE_WIKI_URL); content_sizer->Add(text2); diff --git a/src/slic3r/Utils/Process.cpp b/src/slic3r/Utils/Process.cpp index 06da87ad7..31f32e30e 100644 --- a/src/slic3r/Utils/Process.cpp +++ b/src/slic3r/Utils/Process.cpp @@ -39,7 +39,7 @@ static void start_new_slicer_or_gcodeviewer(const NewSlicerInstanceType instance wxString path; wxFileName::SplitPath(wxStandardPaths::Get().GetExecutablePath(), &path, nullptr, nullptr, wxPATH_NATIVE); path += "\\"; - path += (instance_type == NewSlicerInstanceType::Slicer) ? "superslicer.exe" : "prusa-gcodeviewer.exe"; + path += (instance_type == NewSlicerInstanceType::Slicer) ? SLIC3R_APP_CMD ".exe" : GCODEVIEWER_APP_CMD ".exe"; std::vector args; args.reserve(4); args.emplace_back(path.wc_str()); @@ -62,9 +62,9 @@ static void start_new_slicer_or_gcodeviewer(const NewSlicerInstanceType instance { // Maybe one day we will be able to run PrusaGCodeViewer, but for now the Apple notarization // process refuses Apps with multiple binaries and Vojtech does not know any workaround. - // ((instance_type == NewSlicerInstanceType::Slicer) ? "PrusaSlicer" : "PrusaGCodeViewer"); - // Just run PrusaSlicer and give it a --gcodeviewer parameter. - bin_path = bin_path.parent_path() / "PrusaSlicer"; + // ((instance_type == NewSlicerInstanceType::Slicer) ? SLIC3R_APP_NAME : GCODEVIEWER_APP_NAME); + // Just run the slicer and give it a --gcodeviewer parameter. + bin_path = bin_path.parent_path() / SLIC3R_APP_NAME; // On Apple the wxExecute fails, thus we use boost::process instead. BOOST_LOG_TRIVIAL(info) << "Trying to spawn a new slicer \"" << bin_path.string() << "\""; try { @@ -109,7 +109,7 @@ static void start_new_slicer_or_gcodeviewer(const NewSlicerInstanceType instance std::string my_path; if (args.empty()) { // Binary path was not set to the AppImage in the Linux specific block above, call the application directly. - my_path = (bin_path.parent_path() / ((instance_type == NewSlicerInstanceType::Slicer) ? "superslicer" : "prusa-gcodeviewer")).string(); + my_path = (bin_path.parent_path() / ((instance_type == NewSlicerInstanceType::Slicer) ? SLIC3R_APP_CMD : GCODEVIEWER_APP_CMD)).string(); args.emplace_back(my_path.c_str()); } std::string to_open; diff --git a/version.inc b/version.inc index cfbff43fe..221303f62 100644 --- a/version.inc +++ b/version.inc @@ -8,3 +8,12 @@ set(SLIC3R_VERSION_FULL "2.0.00.0") set(SLIC3R_BUILD_ID "Slic3r_${SLIC3R_VERSION_FULL}") set(SLIC3R_RC_VERSION "2,0,00,0") set(SLIC3R_RC_VERSION_DOTS "${SLIC3R_VERSION_FULL}") + + +set(GCODEVIEWER_APP_NAME "G-code Viewer") +set(GCODEVIEWER_APP_KEY "GCodeViewer") +set(GCODEVIEWER_APP_CMD "gcodeviewer") + +set(SLIC3R_BASED_ON "") +set(SLIC3R_GITHUB "slic3r/Slic3r") +set(SLIC3R_INTRO "Slic3r contains sizable contributions from Prusa Research. Original work by Alessandro Ranellucci and the RepRap community.")