diff --git a/resources/gallery/system/OTHER_recycling_symbol.png b/resources/gallery/system/OTHER_recycling_symbol.png deleted file mode 100644 index 7dde19458..000000000 Binary files a/resources/gallery/system/OTHER_recycling_symbol.png and /dev/null differ diff --git a/resources/gallery/system/PETG_recycling_symbol.png b/resources/gallery/system/PETG_recycling_symbol.png deleted file mode 100644 index 1c985814e..000000000 Binary files a/resources/gallery/system/PETG_recycling_symbol.png and /dev/null differ diff --git a/resources/gallery/system/box.png b/resources/gallery/system/box.png deleted file mode 100644 index 6df18fbc1..000000000 Binary files a/resources/gallery/system/box.png and /dev/null differ diff --git a/resources/gallery/system/cylinder.png b/resources/gallery/system/cylinder.png deleted file mode 100644 index 07feae2e8..000000000 Binary files a/resources/gallery/system/cylinder.png and /dev/null differ diff --git a/resources/gallery/system/pyramid.png b/resources/gallery/system/pyramid.png deleted file mode 100644 index 5db425f69..000000000 Binary files a/resources/gallery/system/pyramid.png and /dev/null differ diff --git a/resources/gallery/system/sphere.png b/resources/gallery/system/sphere.png deleted file mode 100644 index c3853d68d..000000000 Binary files a/resources/gallery/system/sphere.png and /dev/null differ diff --git a/resources/gallery/system/OTHER_recycling_symbol.stl b/resources/shapes/OTHER_recycling_symbol.stl similarity index 100% rename from resources/gallery/system/OTHER_recycling_symbol.stl rename to resources/shapes/OTHER_recycling_symbol.stl diff --git a/resources/gallery/system/PETG_recycling_symbol.stl b/resources/shapes/PETG_recycling_symbol.stl similarity index 100% rename from resources/gallery/system/PETG_recycling_symbol.stl rename to resources/shapes/PETG_recycling_symbol.stl diff --git a/resources/gallery/system/box.stl b/resources/shapes/box.stl similarity index 100% rename from resources/gallery/system/box.stl rename to resources/shapes/box.stl diff --git a/resources/gallery/system/bunny.stl b/resources/shapes/bunny.stl similarity index 100% rename from resources/gallery/system/bunny.stl rename to resources/shapes/bunny.stl diff --git a/resources/gallery/system/cylinder.stl b/resources/shapes/cylinder.stl similarity index 100% rename from resources/gallery/system/cylinder.stl rename to resources/shapes/cylinder.stl diff --git a/resources/gallery/system/pyramid.stl b/resources/shapes/pyramid.stl similarity index 100% rename from resources/gallery/system/pyramid.stl rename to resources/shapes/pyramid.stl diff --git a/resources/gallery/system/sphere.stl b/resources/shapes/sphere.stl similarity index 100% rename from resources/gallery/system/sphere.stl rename to resources/shapes/sphere.stl diff --git a/src/PrusaSlicer.cpp b/src/PrusaSlicer.cpp index 45072b107..04df43496 100644 --- a/src/PrusaSlicer.cpp +++ b/src/PrusaSlicer.cpp @@ -661,7 +661,7 @@ bool CLI::setup(int argc, char **argv) set_resources_dir(path_resources.string()); set_var_dir((path_resources / "icons").string()); set_local_dir((path_resources / "localization").string()); - set_gallery_dir((path_resources / "gallery").string()); + set_sys_shapes_dir((path_resources / "shapes").string()); // Parse all command line options into a DynamicConfig. // If any option is unsupported, print usage and abort immediately. diff --git a/src/libslic3r/PresetBundle.cpp b/src/libslic3r/PresetBundle.cpp index 6f0b2e4d3..b2e35fa2e 100644 --- a/src/libslic3r/PresetBundle.cpp +++ b/src/libslic3r/PresetBundle.cpp @@ -159,6 +159,7 @@ void PresetBundle::setup_directories() data_dir, data_dir / "vendor", data_dir / "cache", + data_dir / "shapes", #ifdef SLIC3R_PROFILE_USE_PRESETS_SUBDIR // Store the print/filament/printer presets into a "presets" directory. data_dir / "presets", diff --git a/src/libslic3r/Utils.hpp b/src/libslic3r/Utils.hpp index 5c3ed684a..330f05ec8 100644 --- a/src/libslic3r/Utils.hpp +++ b/src/libslic3r/Utils.hpp @@ -46,9 +46,9 @@ void set_local_dir(const std::string &path); const std::string& localization_dir(); // Set a path with shapes gallery files. -void set_gallery_dir(const std::string &path); -// Return a full path to the gallery directory. -const std::string& gallery_dir(); +void set_sys_shapes_dir(const std::string &path); +// Return a full path to the system shapes gallery directory. +const std::string& sys_shapes_dir(); // Set a path with preset files. void set_data_dir(const std::string &path); diff --git a/src/libslic3r/utils.cpp b/src/libslic3r/utils.cpp index f40e7de89..8f1cf07f2 100644 --- a/src/libslic3r/utils.cpp +++ b/src/libslic3r/utils.cpp @@ -175,16 +175,16 @@ const std::string& localization_dir() return g_local_dir; } -static std::string g_gallery_dir; +static std::string g_sys_shapes_dir; -void set_gallery_dir(const std::string &dir) +void set_sys_shapes_dir(const std::string &dir) { - g_gallery_dir = dir; + g_sys_shapes_dir = dir; } -const std::string& gallery_dir() +const std::string& sys_shapes_dir() { - return g_gallery_dir; + return g_sys_shapes_dir; } // Translate function callback, to call wxWidgets translate function to convert non-localized UTF8 string to a localized one. diff --git a/src/slic3r/GUI/GalleryDialog.cpp b/src/slic3r/GUI/GalleryDialog.cpp index 73f2c42e6..adc21ed0b 100644 --- a/src/slic3r/GUI/GalleryDialog.cpp +++ b/src/slic3r/GUI/GalleryDialog.cpp @@ -160,7 +160,7 @@ static void add_lock(wxImage& image) #ifdef __APPLE__ lock_sz /= mac_max_scaling_factor(); #endif - wxBitmap bmp = create_scaled_bitmap("lock", nullptr, 22); + wxBitmap bmp = create_scaled_bitmap("lock", nullptr, lock_sz); wxImage lock_image = bmp.ConvertToImage(); if (!lock_image.IsOk() || lock_image.GetWidth() == 0 || lock_image.GetHeight() == 0) @@ -214,12 +214,14 @@ static void add_default_image(wxImageList* img_list, bool is_system) static fs::path get_dir(bool sys_dir) { - return fs::absolute(fs::path(gallery_dir()) / (sys_dir ? "system" : "custom")).make_preferred(); + if (sys_dir) + return fs::absolute(fs::path(sys_shapes_dir())).make_preferred(); + return fs::absolute(fs::path(data_dir()) / "shapes").make_preferred(); } static bool custom_exists() { - return fs::exists(fs::absolute(fs::path(gallery_dir()) / "custom").make_preferred()); + return fs::exists(get_dir(false)); } static std::string get_dir_path(bool sys_dir) @@ -382,20 +384,22 @@ void GalleryDialog::add_custom_shapes(wxEvent& event) void GalleryDialog::del_custom_shapes(wxEvent& event) { - auto dest_dir = get_dir(false); + auto custom_dir = get_dir(false); - for (const Item& item : m_selected_items) { - std::string filename = item.name + ".stl"; - - if (!fs::exists(dest_dir / filename)) - continue; + auto remove_file = [custom_dir](const std::string& name) { + if (!fs::exists(custom_dir / name)) + return; try { - fs::remove(dest_dir / filename); + fs::remove(custom_dir / name); } catch (fs::filesystem_error const& e) { std::cerr << e.what() << '\n'; - return; } + }; + + for (const Item& item : m_selected_items) { + remove_file(item.name + ".stl"); + remove_file(item.name + ".png"); } update();