From e8be7b2ecd3a21676af73805f96157f37418f8e5 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Tue, 9 Nov 2021 17:00:57 +0100 Subject: [PATCH] Implemented possibility to show resin colors from the Plater (Bottles with resin are colored now in preset combobox) + Added nsvgParseFromFileWithReplace() to replace some colors before parsing from SVG file + Thumbnails are saved with selected resin color in SL1 or SL1S files + "white" folder is deleted from "icons" now. THere is no needed anymore. --- resources/icons/editor_menu.svg | 6 +- resources/icons/preview_menu.svg | 32 +++---- resources/icons/white/add_copies.svg | 19 ---- resources/icons/white/add_modifier.svg | 13 --- resources/icons/white/add_negative.svg | 15 --- resources/icons/white/add_part.svg | 19 ---- resources/icons/white/advanced+wrench.svg | 43 --------- resources/icons/white/advanced_plus.svg | 24 ----- resources/icons/white/cog.svg | 17 ---- resources/icons/white/colorchange_add_m.svg | 20 ---- resources/icons/white/compare.svg | 30 ------ resources/icons/white/cooling.svg | 25 ----- resources/icons/white/copy_menu.svg | 37 -------- resources/icons/white/delete.svg | 22 ----- resources/icons/white/delete_all_menu.svg | 31 ------ resources/icons/white/dot.svg | 8 -- resources/icons/white/dot_small.svg | 8 -- resources/icons/white/drop_to_bed.svg | 15 --- resources/icons/white/edit_gcode.svg | 15 --- resources/icons/white/edit_layers_all.svg | 25 ----- resources/icons/white/edit_layers_some.svg | 14 --- resources/icons/white/edit_uni.svg | 20 ---- resources/icons/white/editor_menu.svg | 20 ---- resources/icons/white/equal.svg | 15 --- resources/icons/white/error_tick.svg | 12 --- .../icons/white/exclamation_manifold.svg | 17 ---- resources/icons/white/exit.svg | 13 --- resources/icons/white/export_config.svg | 20 ---- .../icons/white/export_config_bundle.svg | 50 ---------- resources/icons/white/export_gcode.svg | 14 --- resources/icons/white/export_plate.svg | 15 --- resources/icons/white/export_plater.svg | 12 --- resources/icons/white/export_to_sd.svg | 22 ----- resources/icons/white/extruder+funnel.svg | 15 --- resources/icons/white/eye_closed.svg | 13 --- resources/icons/white/eye_open.svg | 11 --- resources/icons/white/flag_green.svg | 10 -- resources/icons/white/flag_red.svg | 10 -- resources/icons/white/funnel.svg | 15 --- resources/icons/white/hollowing.svg | 51 ---------- resources/icons/white/import_config.svg | 25 ----- .../icons/white/import_config_bundle.svg | 61 ------------ resources/icons/white/import_plate.svg | 38 -------- resources/icons/white/import_plater.svg | 17 ---- resources/icons/white/infill.svg | 35 ------- resources/icons/white/info.svg | 71 -------------- resources/icons/white/layers.svg | 27 ------ resources/icons/white/lock2_closed.svg | 10 -- resources/icons/white/lock_closed.svg | 10 -- resources/icons/white/lock_closed_f.svg | 10 -- resources/icons/white/lock_open_sys.svg | 11 --- resources/icons/white/machine+cog.svg | 30 ------ resources/icons/white/mirroring_off.svg | 23 ----- resources/icons/white/mirroring_on.svg | 23 ----- resources/icons/white/note.svg | 25 ----- resources/icons/white/notes.svg | 25 ----- resources/icons/white/number_of_copies.svg | 29 ------ resources/icons/white/open.svg | 11 --- resources/icons/white/output+page_white.svg | 20 ---- resources/icons/white/pad.svg | 83 ---------------- resources/icons/white/paste_menu.svg | 27 ------ resources/icons/white/pause_print.svg | 18 ---- resources/icons/white/plater.svg | 12 --- resources/icons/white/preview_menu.svg | 48 ---------- resources/icons/white/printer.svg | 14 --- resources/icons/white/re_slice.svg | 19 ---- resources/icons/white/redo_menu.svg | 13 --- resources/icons/white/remove_copies.svg | 15 --- resources/icons/white/remove_menu.svg | 44 --------- resources/icons/white/resin.svg | 10 -- resources/icons/white/save.svg | 25 ----- resources/icons/white/search.svg | 4 - resources/icons/white/set_separate_obj.svg | 29 ------ resources/icons/white/skirt+brim.svg | 15 --- resources/icons/white/sla_printer.svg | 14 --- resources/icons/white/split_object_SMALL.svg | 19 ---- resources/icons/white/split_parts_SMALL.svg | 18 ---- resources/icons/white/spool.svg | 21 ----- resources/icons/white/support.svg | 94 ------------------- resources/icons/white/support_blocker.svg | 48 ---------- resources/icons/white/support_enforcer.svg | 19 ---- resources/icons/white/switch_presets.svg | 52 ---------- resources/icons/white/test.svg | 37 -------- resources/icons/white/time.svg | 16 ---- resources/icons/white/undo_menu.svg | 13 --- resources/icons/white/upload_queue.svg | 29 ------ resources/icons/white/wrench.svg | 20 ---- src/libslic3r/PrintConfig.cpp | 4 +- src/nanosvg/nanosvg.h | 24 ++++- src/slic3r/GUI/3DScene.cpp | 12 +-- src/slic3r/GUI/BitmapCache.cpp | 51 +++------- src/slic3r/GUI/BitmapCache.hpp | 2 +- src/slic3r/GUI/Field.cpp | 2 +- src/slic3r/GUI/GLCanvas3D.cpp | 2 +- src/slic3r/GUI/ImGuiWrapper.cpp | 10 +- src/slic3r/GUI/Plater.cpp | 6 -- src/slic3r/GUI/PresetComboBoxes.cpp | 14 ++- src/slic3r/GUI/PresetComboBoxes.hpp | 2 +- src/slic3r/GUI/wxExtensions.cpp | 32 ++++++- src/slic3r/GUI/wxExtensions.hpp | 4 +- 100 files changed, 109 insertions(+), 2126 deletions(-) delete mode 100644 resources/icons/white/add_copies.svg delete mode 100644 resources/icons/white/add_modifier.svg delete mode 100644 resources/icons/white/add_negative.svg delete mode 100644 resources/icons/white/add_part.svg delete mode 100644 resources/icons/white/advanced+wrench.svg delete mode 100644 resources/icons/white/advanced_plus.svg delete mode 100644 resources/icons/white/cog.svg delete mode 100644 resources/icons/white/colorchange_add_m.svg delete mode 100644 resources/icons/white/compare.svg delete mode 100644 resources/icons/white/cooling.svg delete mode 100644 resources/icons/white/copy_menu.svg delete mode 100644 resources/icons/white/delete.svg delete mode 100644 resources/icons/white/delete_all_menu.svg delete mode 100644 resources/icons/white/dot.svg delete mode 100644 resources/icons/white/dot_small.svg delete mode 100644 resources/icons/white/drop_to_bed.svg delete mode 100644 resources/icons/white/edit_gcode.svg delete mode 100644 resources/icons/white/edit_layers_all.svg delete mode 100644 resources/icons/white/edit_layers_some.svg delete mode 100644 resources/icons/white/edit_uni.svg delete mode 100644 resources/icons/white/editor_menu.svg delete mode 100644 resources/icons/white/equal.svg delete mode 100644 resources/icons/white/error_tick.svg delete mode 100644 resources/icons/white/exclamation_manifold.svg delete mode 100644 resources/icons/white/exit.svg delete mode 100644 resources/icons/white/export_config.svg delete mode 100644 resources/icons/white/export_config_bundle.svg delete mode 100644 resources/icons/white/export_gcode.svg delete mode 100644 resources/icons/white/export_plate.svg delete mode 100644 resources/icons/white/export_plater.svg delete mode 100644 resources/icons/white/export_to_sd.svg delete mode 100644 resources/icons/white/extruder+funnel.svg delete mode 100644 resources/icons/white/eye_closed.svg delete mode 100644 resources/icons/white/eye_open.svg delete mode 100644 resources/icons/white/flag_green.svg delete mode 100644 resources/icons/white/flag_red.svg delete mode 100644 resources/icons/white/funnel.svg delete mode 100644 resources/icons/white/hollowing.svg delete mode 100644 resources/icons/white/import_config.svg delete mode 100644 resources/icons/white/import_config_bundle.svg delete mode 100644 resources/icons/white/import_plate.svg delete mode 100644 resources/icons/white/import_plater.svg delete mode 100644 resources/icons/white/infill.svg delete mode 100644 resources/icons/white/info.svg delete mode 100644 resources/icons/white/layers.svg delete mode 100644 resources/icons/white/lock2_closed.svg delete mode 100644 resources/icons/white/lock_closed.svg delete mode 100644 resources/icons/white/lock_closed_f.svg delete mode 100644 resources/icons/white/lock_open_sys.svg delete mode 100644 resources/icons/white/machine+cog.svg delete mode 100644 resources/icons/white/mirroring_off.svg delete mode 100644 resources/icons/white/mirroring_on.svg delete mode 100644 resources/icons/white/note.svg delete mode 100644 resources/icons/white/notes.svg delete mode 100644 resources/icons/white/number_of_copies.svg delete mode 100644 resources/icons/white/open.svg delete mode 100644 resources/icons/white/output+page_white.svg delete mode 100644 resources/icons/white/pad.svg delete mode 100644 resources/icons/white/paste_menu.svg delete mode 100644 resources/icons/white/pause_print.svg delete mode 100644 resources/icons/white/plater.svg delete mode 100644 resources/icons/white/preview_menu.svg delete mode 100644 resources/icons/white/printer.svg delete mode 100644 resources/icons/white/re_slice.svg delete mode 100644 resources/icons/white/redo_menu.svg delete mode 100644 resources/icons/white/remove_copies.svg delete mode 100644 resources/icons/white/remove_menu.svg delete mode 100644 resources/icons/white/resin.svg delete mode 100644 resources/icons/white/save.svg delete mode 100644 resources/icons/white/search.svg delete mode 100644 resources/icons/white/set_separate_obj.svg delete mode 100644 resources/icons/white/skirt+brim.svg delete mode 100644 resources/icons/white/sla_printer.svg delete mode 100644 resources/icons/white/split_object_SMALL.svg delete mode 100644 resources/icons/white/split_parts_SMALL.svg delete mode 100644 resources/icons/white/spool.svg delete mode 100644 resources/icons/white/support.svg delete mode 100644 resources/icons/white/support_blocker.svg delete mode 100644 resources/icons/white/support_enforcer.svg delete mode 100644 resources/icons/white/switch_presets.svg delete mode 100644 resources/icons/white/test.svg delete mode 100644 resources/icons/white/time.svg delete mode 100644 resources/icons/white/undo_menu.svg delete mode 100644 resources/icons/white/upload_queue.svg delete mode 100644 resources/icons/white/wrench.svg diff --git a/resources/icons/editor_menu.svg b/resources/icons/editor_menu.svg index 223efda0f..253bd907d 100644 --- a/resources/icons/editor_menu.svg +++ b/resources/icons/editor_menu.svg @@ -4,15 +4,15 @@ viewBox="0 0 128 128" enable-background="new 0 0 128 128" xml:space="preserve"> - - + - diff --git a/resources/icons/preview_menu.svg b/resources/icons/preview_menu.svg index 725caf7b8..9af677d3e 100644 --- a/resources/icons/preview_menu.svg +++ b/resources/icons/preview_menu.svg @@ -4,40 +4,40 @@ viewBox="0 0 128 128" enable-background="new 0 0 128 128" xml:space="preserve"> - - - - + - - - - + - - - - + - - - + - - - - - - - - - - - - - - - diff --git a/resources/icons/white/add_modifier.svg b/resources/icons/white/add_modifier.svg deleted file mode 100644 index 09c3ce27d..000000000 --- a/resources/icons/white/add_modifier.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - diff --git a/resources/icons/white/add_negative.svg b/resources/icons/white/add_negative.svg deleted file mode 100644 index 0173d1f0d..000000000 --- a/resources/icons/white/add_negative.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - diff --git a/resources/icons/white/add_part.svg b/resources/icons/white/add_part.svg deleted file mode 100644 index f4ee11432..000000000 --- a/resources/icons/white/add_part.svg +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - diff --git a/resources/icons/white/advanced+wrench.svg b/resources/icons/white/advanced+wrench.svg deleted file mode 100644 index 5e878cb3c..000000000 --- a/resources/icons/white/advanced+wrench.svg +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/resources/icons/white/advanced_plus.svg b/resources/icons/white/advanced_plus.svg deleted file mode 100644 index db532ec4b..000000000 --- a/resources/icons/white/advanced_plus.svg +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - diff --git a/resources/icons/white/cog.svg b/resources/icons/white/cog.svg deleted file mode 100644 index 773e4d65d..000000000 --- a/resources/icons/white/cog.svg +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - diff --git a/resources/icons/white/colorchange_add_m.svg b/resources/icons/white/colorchange_add_m.svg deleted file mode 100644 index 2266560da..000000000 --- a/resources/icons/white/colorchange_add_m.svg +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/resources/icons/white/compare.svg b/resources/icons/white/compare.svg deleted file mode 100644 index 7eafebfde..000000000 --- a/resources/icons/white/compare.svg +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - diff --git a/resources/icons/white/cooling.svg b/resources/icons/white/cooling.svg deleted file mode 100644 index 29bd04c36..000000000 --- a/resources/icons/white/cooling.svg +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/resources/icons/white/copy_menu.svg b/resources/icons/white/copy_menu.svg deleted file mode 100644 index d660aab6a..000000000 --- a/resources/icons/white/copy_menu.svg +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/resources/icons/white/delete.svg b/resources/icons/white/delete.svg deleted file mode 100644 index 91d5ce74c..000000000 --- a/resources/icons/white/delete.svg +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/resources/icons/white/delete_all_menu.svg b/resources/icons/white/delete_all_menu.svg deleted file mode 100644 index 5d825c424..000000000 --- a/resources/icons/white/delete_all_menu.svg +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/resources/icons/white/dot.svg b/resources/icons/white/dot.svg deleted file mode 100644 index 90fbaf7fb..000000000 --- a/resources/icons/white/dot.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - diff --git a/resources/icons/white/dot_small.svg b/resources/icons/white/dot_small.svg deleted file mode 100644 index 74df44208..000000000 --- a/resources/icons/white/dot_small.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - diff --git a/resources/icons/white/drop_to_bed.svg b/resources/icons/white/drop_to_bed.svg deleted file mode 100644 index 76243f897..000000000 --- a/resources/icons/white/drop_to_bed.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - diff --git a/resources/icons/white/edit_gcode.svg b/resources/icons/white/edit_gcode.svg deleted file mode 100644 index 85836c0b4..000000000 --- a/resources/icons/white/edit_gcode.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - diff --git a/resources/icons/white/edit_layers_all.svg b/resources/icons/white/edit_layers_all.svg deleted file mode 100644 index efb7d609f..000000000 --- a/resources/icons/white/edit_layers_all.svg +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - diff --git a/resources/icons/white/edit_layers_some.svg b/resources/icons/white/edit_layers_some.svg deleted file mode 100644 index 585a8df2f..000000000 --- a/resources/icons/white/edit_layers_some.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - diff --git a/resources/icons/white/edit_uni.svg b/resources/icons/white/edit_uni.svg deleted file mode 100644 index 661924763..000000000 --- a/resources/icons/white/edit_uni.svg +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - diff --git a/resources/icons/white/editor_menu.svg b/resources/icons/white/editor_menu.svg deleted file mode 100644 index 649d2c40f..000000000 --- a/resources/icons/white/editor_menu.svg +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/resources/icons/white/equal.svg b/resources/icons/white/equal.svg deleted file mode 100644 index febbb4c5f..000000000 --- a/resources/icons/white/equal.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - diff --git a/resources/icons/white/error_tick.svg b/resources/icons/white/error_tick.svg deleted file mode 100644 index f3de981f0..000000000 --- a/resources/icons/white/error_tick.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - diff --git a/resources/icons/white/exclamation_manifold.svg b/resources/icons/white/exclamation_manifold.svg deleted file mode 100644 index a18590167..000000000 --- a/resources/icons/white/exclamation_manifold.svg +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/resources/icons/white/exit.svg b/resources/icons/white/exit.svg deleted file mode 100644 index e5aebcfc2..000000000 --- a/resources/icons/white/exit.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - diff --git a/resources/icons/white/export_config.svg b/resources/icons/white/export_config.svg deleted file mode 100644 index 22f8ebe1a..000000000 --- a/resources/icons/white/export_config.svg +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - diff --git a/resources/icons/white/export_config_bundle.svg b/resources/icons/white/export_config_bundle.svg deleted file mode 100644 index 99bd62b6c..000000000 --- a/resources/icons/white/export_config_bundle.svg +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/resources/icons/white/export_gcode.svg b/resources/icons/white/export_gcode.svg deleted file mode 100644 index 39f5225cb..000000000 --- a/resources/icons/white/export_gcode.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - diff --git a/resources/icons/white/export_plate.svg b/resources/icons/white/export_plate.svg deleted file mode 100644 index 18159d2a8..000000000 --- a/resources/icons/white/export_plate.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - diff --git a/resources/icons/white/export_plater.svg b/resources/icons/white/export_plater.svg deleted file mode 100644 index e71b38a0a..000000000 --- a/resources/icons/white/export_plater.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - diff --git a/resources/icons/white/export_to_sd.svg b/resources/icons/white/export_to_sd.svg deleted file mode 100644 index ebeacb905..000000000 --- a/resources/icons/white/export_to_sd.svg +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - diff --git a/resources/icons/white/extruder+funnel.svg b/resources/icons/white/extruder+funnel.svg deleted file mode 100644 index de6b227da..000000000 --- a/resources/icons/white/extruder+funnel.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - diff --git a/resources/icons/white/eye_closed.svg b/resources/icons/white/eye_closed.svg deleted file mode 100644 index 0cdd16ae0..000000000 --- a/resources/icons/white/eye_closed.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - diff --git a/resources/icons/white/eye_open.svg b/resources/icons/white/eye_open.svg deleted file mode 100644 index 1b320da07..000000000 --- a/resources/icons/white/eye_open.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - diff --git a/resources/icons/white/flag_green.svg b/resources/icons/white/flag_green.svg deleted file mode 100644 index 8479d0e9a..000000000 --- a/resources/icons/white/flag_green.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - diff --git a/resources/icons/white/flag_red.svg b/resources/icons/white/flag_red.svg deleted file mode 100644 index a9b1cf8fe..000000000 --- a/resources/icons/white/flag_red.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - diff --git a/resources/icons/white/funnel.svg b/resources/icons/white/funnel.svg deleted file mode 100644 index b8a3408a7..000000000 --- a/resources/icons/white/funnel.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - diff --git a/resources/icons/white/hollowing.svg b/resources/icons/white/hollowing.svg deleted file mode 100644 index 77f50b6b8..000000000 --- a/resources/icons/white/hollowing.svg +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/resources/icons/white/import_config.svg b/resources/icons/white/import_config.svg deleted file mode 100644 index 001277f73..000000000 --- a/resources/icons/white/import_config.svg +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/resources/icons/white/import_config_bundle.svg b/resources/icons/white/import_config_bundle.svg deleted file mode 100644 index c16cd7b3c..000000000 --- a/resources/icons/white/import_config_bundle.svg +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/resources/icons/white/import_plate.svg b/resources/icons/white/import_plate.svg deleted file mode 100644 index 7f888e3d7..000000000 --- a/resources/icons/white/import_plate.svg +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - -]> - - - - - - - - - - - - - - - - - - - - diff --git a/resources/icons/white/import_plater.svg b/resources/icons/white/import_plater.svg deleted file mode 100644 index 1dc5aae6e..000000000 --- a/resources/icons/white/import_plater.svg +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/resources/icons/white/infill.svg b/resources/icons/white/infill.svg deleted file mode 100644 index 086043099..000000000 --- a/resources/icons/white/infill.svg +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/resources/icons/white/info.svg b/resources/icons/white/info.svg deleted file mode 100644 index db227aa32..000000000 --- a/resources/icons/white/info.svg +++ /dev/null @@ -1,71 +0,0 @@ - -image/svg+xml - - - - - - - - - - diff --git a/resources/icons/white/layers.svg b/resources/icons/white/layers.svg deleted file mode 100644 index cd71fab3a..000000000 --- a/resources/icons/white/layers.svg +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/resources/icons/white/lock2_closed.svg b/resources/icons/white/lock2_closed.svg deleted file mode 100644 index 726c850a1..000000000 --- a/resources/icons/white/lock2_closed.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - diff --git a/resources/icons/white/lock_closed.svg b/resources/icons/white/lock_closed.svg deleted file mode 100644 index 1665dc9a0..000000000 --- a/resources/icons/white/lock_closed.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - diff --git a/resources/icons/white/lock_closed_f.svg b/resources/icons/white/lock_closed_f.svg deleted file mode 100644 index 412c93c16..000000000 --- a/resources/icons/white/lock_closed_f.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - diff --git a/resources/icons/white/lock_open_sys.svg b/resources/icons/white/lock_open_sys.svg deleted file mode 100644 index c1aa64aec..000000000 --- a/resources/icons/white/lock_open_sys.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - diff --git a/resources/icons/white/machine+cog.svg b/resources/icons/white/machine+cog.svg deleted file mode 100644 index ec49265b8..000000000 --- a/resources/icons/white/machine+cog.svg +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - diff --git a/resources/icons/white/mirroring_off.svg b/resources/icons/white/mirroring_off.svg deleted file mode 100644 index 2011d8f1b..000000000 --- a/resources/icons/white/mirroring_off.svg +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/resources/icons/white/mirroring_on.svg b/resources/icons/white/mirroring_on.svg deleted file mode 100644 index 1773b78ad..000000000 --- a/resources/icons/white/mirroring_on.svg +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/resources/icons/white/note.svg b/resources/icons/white/note.svg deleted file mode 100644 index 07c2a14cf..000000000 --- a/resources/icons/white/note.svg +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/resources/icons/white/notes.svg b/resources/icons/white/notes.svg deleted file mode 100644 index 25de4191e..000000000 --- a/resources/icons/white/notes.svg +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/resources/icons/white/number_of_copies.svg b/resources/icons/white/number_of_copies.svg deleted file mode 100644 index 7c9d78a80..000000000 --- a/resources/icons/white/number_of_copies.svg +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/resources/icons/white/open.svg b/resources/icons/white/open.svg deleted file mode 100644 index 0ea9ecdb2..000000000 --- a/resources/icons/white/open.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - diff --git a/resources/icons/white/output+page_white.svg b/resources/icons/white/output+page_white.svg deleted file mode 100644 index 083874003..000000000 --- a/resources/icons/white/output+page_white.svg +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - diff --git a/resources/icons/white/pad.svg b/resources/icons/white/pad.svg deleted file mode 100644 index cddb2da02..000000000 --- a/resources/icons/white/pad.svg +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/resources/icons/white/paste_menu.svg b/resources/icons/white/paste_menu.svg deleted file mode 100644 index 465c2faf0..000000000 --- a/resources/icons/white/paste_menu.svg +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - diff --git a/resources/icons/white/pause_print.svg b/resources/icons/white/pause_print.svg deleted file mode 100644 index 73f747fff..000000000 --- a/resources/icons/white/pause_print.svg +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/resources/icons/white/plater.svg b/resources/icons/white/plater.svg deleted file mode 100644 index d637a5e7e..000000000 --- a/resources/icons/white/plater.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - diff --git a/resources/icons/white/preview_menu.svg b/resources/icons/white/preview_menu.svg deleted file mode 100644 index 98095359c..000000000 --- a/resources/icons/white/preview_menu.svg +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/resources/icons/white/printer.svg b/resources/icons/white/printer.svg deleted file mode 100644 index d94f6fd5c..000000000 --- a/resources/icons/white/printer.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - diff --git a/resources/icons/white/re_slice.svg b/resources/icons/white/re_slice.svg deleted file mode 100644 index b8d7dc727..000000000 --- a/resources/icons/white/re_slice.svg +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - diff --git a/resources/icons/white/redo_menu.svg b/resources/icons/white/redo_menu.svg deleted file mode 100644 index 749f49a42..000000000 --- a/resources/icons/white/redo_menu.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - diff --git a/resources/icons/white/remove_copies.svg b/resources/icons/white/remove_copies.svg deleted file mode 100644 index 5b277e45e..000000000 --- a/resources/icons/white/remove_copies.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - diff --git a/resources/icons/white/remove_menu.svg b/resources/icons/white/remove_menu.svg deleted file mode 100644 index 59360a33f..000000000 --- a/resources/icons/white/remove_menu.svg +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - diff --git a/resources/icons/white/resin.svg b/resources/icons/white/resin.svg deleted file mode 100644 index 81abfae0c..000000000 --- a/resources/icons/white/resin.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - diff --git a/resources/icons/white/save.svg b/resources/icons/white/save.svg deleted file mode 100644 index 3349a42dd..000000000 --- a/resources/icons/white/save.svg +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/resources/icons/white/search.svg b/resources/icons/white/search.svg deleted file mode 100644 index 679bb30f7..000000000 --- a/resources/icons/white/search.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/resources/icons/white/set_separate_obj.svg b/resources/icons/white/set_separate_obj.svg deleted file mode 100644 index de083c1c9..000000000 --- a/resources/icons/white/set_separate_obj.svg +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/resources/icons/white/skirt+brim.svg b/resources/icons/white/skirt+brim.svg deleted file mode 100644 index 684e177d2..000000000 --- a/resources/icons/white/skirt+brim.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - diff --git a/resources/icons/white/sla_printer.svg b/resources/icons/white/sla_printer.svg deleted file mode 100644 index 3d47e7da6..000000000 --- a/resources/icons/white/sla_printer.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - diff --git a/resources/icons/white/split_object_SMALL.svg b/resources/icons/white/split_object_SMALL.svg deleted file mode 100644 index 4795cab51..000000000 --- a/resources/icons/white/split_object_SMALL.svg +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - diff --git a/resources/icons/white/split_parts_SMALL.svg b/resources/icons/white/split_parts_SMALL.svg deleted file mode 100644 index eba846c17..000000000 --- a/resources/icons/white/split_parts_SMALL.svg +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - diff --git a/resources/icons/white/spool.svg b/resources/icons/white/spool.svg deleted file mode 100644 index 7c9fbab97..000000000 --- a/resources/icons/white/spool.svg +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/resources/icons/white/support.svg b/resources/icons/white/support.svg deleted file mode 100644 index 52b7c6b40..000000000 --- a/resources/icons/white/support.svg +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/resources/icons/white/support_blocker.svg b/resources/icons/white/support_blocker.svg deleted file mode 100644 index 17401e2ab..000000000 --- a/resources/icons/white/support_blocker.svg +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/resources/icons/white/support_enforcer.svg b/resources/icons/white/support_enforcer.svg deleted file mode 100644 index 0de2dc6a7..000000000 --- a/resources/icons/white/support_enforcer.svg +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - diff --git a/resources/icons/white/switch_presets.svg b/resources/icons/white/switch_presets.svg deleted file mode 100644 index efcc3670c..000000000 --- a/resources/icons/white/switch_presets.svg +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/resources/icons/white/test.svg b/resources/icons/white/test.svg deleted file mode 100644 index 639bbbde8..000000000 --- a/resources/icons/white/test.svg +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/resources/icons/white/time.svg b/resources/icons/white/time.svg deleted file mode 100644 index d014286b5..000000000 --- a/resources/icons/white/time.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - diff --git a/resources/icons/white/undo_menu.svg b/resources/icons/white/undo_menu.svg deleted file mode 100644 index 4e2b69a60..000000000 --- a/resources/icons/white/undo_menu.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - diff --git a/resources/icons/white/upload_queue.svg b/resources/icons/white/upload_queue.svg deleted file mode 100644 index 710e2be89..000000000 --- a/resources/icons/white/upload_queue.svg +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/resources/icons/white/wrench.svg b/resources/icons/white/wrench.svg deleted file mode 100644 index 714c5a82a..000000000 --- a/resources/icons/white/wrench.svg +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index e165c731f..39c033df6 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -3164,11 +3164,11 @@ void PrintConfigDef::init_sla_params() // SLA Material settings. - def = this->add("material_colour", coStrings); + def = this->add("material_colour", coString); def->label = L("Color"); def->tooltip = L("This is only used in the Slic3r interface as a visual help."); def->gui_type = ConfigOptionDef::GUIType::color; - def->set_default_value(new ConfigOptionStrings{ "#29B2B2" }); + def->set_default_value(new ConfigOptionString("#29B2B2")); def = this->add("material_type", coString); def->label = L("SLA material type"); diff --git a/src/nanosvg/nanosvg.h b/src/nanosvg/nanosvg.h index b9063213e..4eaff9dad 100644 --- a/src/nanosvg/nanosvg.h +++ b/src/nanosvg/nanosvg.h @@ -165,6 +165,11 @@ typedef struct NSVGimage // Parses SVG file from a file, returns SVG image as paths. NSVGimage* nsvgParseFromFile(const char* filename, const char* units, float dpi); +// Parses SVG file from a file, returns SVG image as paths. +// And makes replases befor parsing +// replace_map containes old_value->new_value +NSVGimage* nsvgParseFromFileWithReplace(const char* filename, const char* units, float dpi, const std::map& replace_map); + // Parses SVG file from a null terminated string, returns SVG image as paths. // Important note: changes the string. NSVGimage* nsvgParse(char* input, const char* units, float dpi); @@ -189,6 +194,8 @@ void nsvgDelete(NSVGimage* image); #include #include +#include + #define NSVG_PI (3.14159265358979323846264338327f) #define NSVG_KAPPA90 (0.5522847493f) // Length proportional to radius of a cubic bezier handle for 90deg arcs. @@ -2901,6 +2908,12 @@ NSVGimage* nsvgParse(char* input, const char* units, float dpi) NSVGimage* nsvgParseFromFile(const char* filename, const char* units, float dpi) { + return nsvgParseFromFileWithReplace(filename, units, dpi, { {} }); +} + +NSVGimage* nsvgParseFromFileWithReplace(const char* filename, const char* units, float dpi, const std::map& replaces) +{ + std::string str; FILE* fp = NULL; size_t size; char* data = NULL; @@ -2916,9 +2929,16 @@ NSVGimage* nsvgParseFromFile(const char* filename, const char* units, float dpi) if (fread(data, 1, size, fp) != size) goto error; data[size] = '\0'; // Must be null terminated. fclose(fp); - image = nsvgParse(data, units, dpi); - free(data); + if(replaces.empty()) + image = nsvgParse(data, units, dpi); + else { + str.assign(data); + for (auto val : replaces) + boost::replace_all(str, val.first, val.second); + image = nsvgParse(str.data(), units, dpi); + } + free(data); return image; error: diff --git a/src/slic3r/GUI/3DScene.cpp b/src/slic3r/GUI/3DScene.cpp index 6e7174baf..6bceaec09 100644 --- a/src/slic3r/GUI/3DScene.cpp +++ b/src/slic3r/GUI/3DScene.cpp @@ -1136,15 +1136,11 @@ void GLVolumeCollection::update_colors_by_extruder(const DynamicPrintConfig* con if (static_cast(config->opt_int("printer_technology")) == ptSLA) { - const ConfigOptionStrings* resin_clr = dynamic_cast(config->option("material_colour")); - if (resin_clr == nullptr) - return; - assert(resin_clr->values.size() == 1); - colors.resize(1); - - const std::string& txt_color = config->opt_string("material_colour", 0); - if (Slic3r::GUI::BitmapCache::parse_color(txt_color, rgb)) + const std::string& txt_color = config->opt_string("material_colour"); + if (Slic3r::GUI::BitmapCache::parse_color(txt_color, rgb)) { + colors.resize(1); colors[0].set(txt_color, rgb); + } } else { diff --git a/src/slic3r/GUI/BitmapCache.cpp b/src/slic3r/GUI/BitmapCache.cpp index 2c756c3b9..749fc5ef2 100644 --- a/src/slic3r/GUI/BitmapCache.cpp +++ b/src/slic3r/GUI/BitmapCache.cpp @@ -261,51 +261,28 @@ wxBitmap* BitmapCache::load_png(const std::string &bitmap_name, unsigned width, } wxBitmap* BitmapCache::load_svg(const std::string &bitmap_name, unsigned target_width, unsigned target_height, - const bool grayscale/* = false*/, const bool dark_mode/* = false*/) + const bool grayscale/* = false*/, const bool dark_mode/* = false*/, const std::string& new_color /*= ""*/) { std::string bitmap_key = bitmap_name + ( target_height !=0 ? "-h" + std::to_string(target_height) : "-w" + std::to_string(target_width)) + (m_scale != 1.0f ? "-s" + float_to_string_decimal_point(m_scale) : "") - + (grayscale ? "-gs" : ""); + + (dark_mode ? "-dm" : "") + + (grayscale ? "-gs" : "") + + new_color; - /* For the Dark mode of any platform, we should draw icons in respect to OS background - * Note: All standard(regular) icons are collected in "icons" folder, - * SVG-icons, which have "Dark mode" variant, are collected in "icons/white" folder - */ - std::string folder; + auto it = m_map.find(bitmap_key); + if (it != m_map.end()) + return it->second; + + // map of color replaces + std::map replaces; if (dark_mode) - { -#ifdef __WXMSW__ - folder = "white\\"; -#else - folder = "white/"; -#endif - auto it = m_map.find(folder + bitmap_key); - if (it != m_map.end()) - return it->second; - // It's expensive to check if the bitmap exists every time, but otherwise: - // For the case, when application was started in Light mode and then switched to the Dark, - // we will never get a white bitmaps, if check m_map.find(bitmap_key) - // before boost::filesystem::exists(var(folder + bitmap_name + ".svg")) - if (!boost::filesystem::exists(var(folder + bitmap_name + ".svg"))) { - folder.clear(); - - it = m_map.find(bitmap_key); - if (it != m_map.end()) - return it->second; - } + replaces["#808080"] = "#FFFFFF"; + if (!new_color.empty()) + replaces["#ED6B21"] = new_color; - bitmap_key = folder + bitmap_key; - } - else - { - auto it = m_map.find(bitmap_key); - if (it != m_map.end()) - return it->second; - } - - NSVGimage *image = ::nsvgParseFromFile(Slic3r::var(folder + bitmap_name + ".svg").c_str(), "px", 96.0f); + NSVGimage *image = ::nsvgParseFromFileWithReplace(Slic3r::var(bitmap_name + ".svg").c_str(), "px", 96.0f, replaces); if (image == nullptr) return nullptr; diff --git a/src/slic3r/GUI/BitmapCache.hpp b/src/slic3r/GUI/BitmapCache.hpp index 8147de996..5fa8643b5 100644 --- a/src/slic3r/GUI/BitmapCache.hpp +++ b/src/slic3r/GUI/BitmapCache.hpp @@ -33,7 +33,7 @@ public: // Load png from resources/icons. bitmap_key is given without the .png suffix. Bitmap will be rescaled to provided height/width if nonzero. wxBitmap* load_png(const std::string &bitmap_key, unsigned width = 0, unsigned height = 0, const bool grayscale = false); // Load svg from resources/icons. bitmap_key is given without the .svg suffix. SVG will be rasterized to provided height/width. - wxBitmap* load_svg(const std::string &bitmap_key, unsigned width = 0, unsigned height = 0, const bool grayscale = false, const bool dark_mode = false); + wxBitmap* load_svg(const std::string &bitmap_key, unsigned width = 0, unsigned height = 0, const bool grayscale = false, const bool dark_mode = false, const std::string& new_color = ""); wxBitmap mksolid(size_t width, size_t height, unsigned char r, unsigned char g, unsigned char b, unsigned char transparency, bool suppress_scaling = false, size_t border_width = 0, bool dark_mode = false); wxBitmap mksolid(size_t width, size_t height, const unsigned char rgb[3], bool suppress_scaling = false, size_t border_width = 0, bool dark_mode = false) { return mksolid(width, height, rgb[0], rgb[1], rgb[2], wxALPHA_OPAQUE, suppress_scaling, border_width, dark_mode); } diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp index 52a03eabf..0a5635630 100644 --- a/src/slic3r/GUI/Field.cpp +++ b/src/slic3r/GUI/Field.cpp @@ -1320,7 +1320,7 @@ void ColourPicker::BUILD() if (m_opt.width >= 0) size.SetWidth(m_opt.width*m_em_unit); // Validate the color - wxString clr_str(m_opt.get_default_value()->get_at(m_opt_idx)); + wxString clr_str(m_opt.type == coString ? m_opt.get_default_value()->value : m_opt.get_default_value()->get_at(m_opt_idx)); wxColour clr(clr_str); if (clr_str.IsEmpty() || !clr.IsOk()) { clr = wxTransparentColour; diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 1c8a362c0..90e67cd8a 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -4197,7 +4197,7 @@ void GLCanvas3D::_render_thumbnail_internal(ThumbnailData& thumbnail_data, const shader->set_uniform("emission_factor", 0.0f); for (GLVolume* vol : visible_volumes) { - shader->set_uniform("uniform_color", (vol->printable && !vol->is_outside) ? orange : gray); + shader->set_uniform("uniform_color", (vol->printable && !vol->is_outside) ? (current_printer_technology() == ptSLA ? vol->color : orange) : gray); // the volume may have been deactivated by an active gizmo bool is_active = vol->is_active; vol->is_active = true; diff --git a/src/slic3r/GUI/ImGuiWrapper.cpp b/src/slic3r/GUI/ImGuiWrapper.cpp index 32fe71f67..08e53b829 100644 --- a/src/slic3r/GUI/ImGuiWrapper.cpp +++ b/src/slic3r/GUI/ImGuiWrapper.cpp @@ -1017,15 +1017,7 @@ std::vector ImGuiWrapper::load_svg(const std::string& bitmap_name { std::vector empty_vector; -#ifdef __WXMSW__ - std::string folder = "white\\"; -#else - std::string folder = "white/"; -#endif - if (!boost::filesystem::exists(Slic3r::var(folder + bitmap_name + ".svg"))) - folder.clear(); - - NSVGimage* image = ::nsvgParseFromFile(Slic3r::var(folder + bitmap_name + ".svg").c_str(), "px", 96.0f); + NSVGimage* image = ::nsvgParseFromFileWithReplace(Slic3r::var(bitmap_name + ".svg").c_str(), "px", 96.0f, { { "#808080", "#FFFFFF" } }); if (image == nullptr) return empty_vector; diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index fe8c72fea..ca4e3e057 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -6221,14 +6221,8 @@ void Plater::on_config_change(const DynamicPrintConfig &config) continue; } } - if (opt_key == "material_colour") { update_scheduled = true; // update should be scheduled (for update 3DScene) - - // update material color in full config - std::vector material_colors = { config.opt_string("material_colour", (unsigned)0) }; - p->config->option("material_colour")->values = material_colors; - continue; } p->config->set_key_value(opt_key, config.option(opt_key)->clone()); diff --git a/src/slic3r/GUI/PresetComboBoxes.cpp b/src/slic3r/GUI/PresetComboBoxes.cpp index 5da359458..acae695d2 100644 --- a/src/slic3r/GUI/PresetComboBoxes.cpp +++ b/src/slic3r/GUI/PresetComboBoxes.cpp @@ -419,7 +419,7 @@ wxString PresetComboBox::separator(const std::string& label) wxBitmap* PresetComboBox::get_bmp( std::string bitmap_key, bool wide_icons, const std::string& main_icon_name, bool is_compatible/* = true*/, bool is_system/* = false*/, bool is_single_bar/* = false*/, - std::string filament_rgb/* = ""*/, std::string extruder_rgb/* = ""*/) + const std::string& filament_rgb/* = ""*/, const std::string& extruder_rgb/* = ""*/, const std::string& material_rgb/* = ""*/) { // If the filament preset is not compatible and there is a "red flag" icon loaded, show it left // to the filament color image. @@ -431,6 +431,7 @@ wxBitmap* PresetComboBox::get_bmp( std::string bitmap_key, bool wide_icons, con bool dark_mode = wxGetApp().dark_mode(); if (dark_mode) bitmap_key += ",dark"; + bitmap_key += material_rgb; wxBitmap* bmp = bitmap_cache().find(bitmap_key); if (bmp == nullptr) { @@ -457,7 +458,10 @@ wxBitmap* PresetComboBox::get_bmp( std::string bitmap_key, bool wide_icons, con { // Paint the color bars. bmps.emplace_back(bitmap_cache().mkclear(thin_space_icon_width, icon_height)); - bmps.emplace_back(create_scaled_bitmap(main_icon_name)); + if (m_type == Preset::TYPE_SLA_MATERIAL) + bmps.emplace_back(create_scaled_bitmap(main_icon_name, this, 16, false, material_rgb)); + else + bmps.emplace_back(create_scaled_bitmap(main_icon_name)); // Paint a lock at the system presets. bmps.emplace_back(bitmap_cache().mkclear(wide_space_icon_width, icon_height)); } @@ -789,7 +793,7 @@ void PlaterPresetComboBox::update() if (!preset.is_visible || (!preset.is_compatible && !is_selected)) continue; - std::string bitmap_key, filament_rgb, extruder_rgb; + std::string bitmap_key, filament_rgb, extruder_rgb, material_rgb; std::string bitmap_type_name = bitmap_key = m_type == Preset::TYPE_PRINTER && preset.printer_technology() == ptSLA ? "sla_printer" : m_main_bitmap_name; bool single_bar = false; @@ -803,10 +807,12 @@ void PlaterPresetComboBox::update() bitmap_key += single_bar ? filament_rgb : filament_rgb + extruder_rgb; } + else if (m_type == Preset::TYPE_SLA_MATERIAL) + material_rgb = is_selected ? m_preset_bundle->sla_materials.get_edited_preset().config.opt_string("material_colour") : preset.config.opt_string("material_colour"); wxBitmap* bmp = get_bmp(bitmap_key, wide_icons, bitmap_type_name, preset.is_compatible, preset.is_system || preset.is_default, - single_bar, filament_rgb, extruder_rgb); + single_bar, filament_rgb, extruder_rgb, material_rgb); assert(bmp); const std::string name = preset.alias.empty() ? preset.name : preset.alias; diff --git a/src/slic3r/GUI/PresetComboBoxes.hpp b/src/slic3r/GUI/PresetComboBoxes.hpp index f6a6eb3e8..654f836c5 100644 --- a/src/slic3r/GUI/PresetComboBoxes.hpp +++ b/src/slic3r/GUI/PresetComboBoxes.hpp @@ -122,7 +122,7 @@ protected: wxBitmap* get_bmp( std::string bitmap_key, bool wide_icons, const std::string& main_icon_name, bool is_compatible = true, bool is_system = false, bool is_single_bar = false, - std::string filament_rgb = "", std::string extruder_rgb = ""); + const std::string& filament_rgb = "", const std::string& extruder_rgb = "", const std::string& material_rgb = ""); wxBitmap* get_bmp( std::string bitmap_key, const std::string& main_icon_name, const std::string& next_icon_name, bool is_enabled = true, bool is_compatible = true, bool is_system = false); diff --git a/src/slic3r/GUI/wxExtensions.cpp b/src/slic3r/GUI/wxExtensions.cpp index 5e703a37b..8aead7a7c 100644 --- a/src/slic3r/GUI/wxExtensions.cpp +++ b/src/slic3r/GUI/wxExtensions.cpp @@ -419,7 +419,7 @@ int mode_icon_px_size() wxBitmap create_menu_bitmap(const std::string& bmp_name) { - return create_scaled_bitmap(bmp_name, nullptr, 16, false, true); + return create_scaled_bitmap(bmp_name, nullptr, 16, false, "", true); } // win is used to get a correct em_unit value @@ -429,6 +429,7 @@ wxBitmap create_scaled_bitmap( const std::string& bmp_name_in, wxWindow *win/* = nullptr*/, const int px_cnt/* = 16*/, const bool grayscale/* = false*/, + const std::string& new_color/* = std::string()*/, // color witch will used instead of orange const bool menu_bitmap/* = false*/) { static Slic3r::GUI::BitmapCache cache; @@ -446,7 +447,7 @@ wxBitmap create_scaled_bitmap( const std::string& bmp_name_in, Slic3r::GUI::wxGetApp().dark_mode(); // Try loading an SVG first, then PNG if SVG is not found: - wxBitmap *bmp = cache.load_svg(bmp_name, width, height, grayscale, dark_mode); + wxBitmap *bmp = cache.load_svg(bmp_name, width, height, grayscale, dark_mode, new_color); if (bmp == nullptr) { bmp = cache.load_png(bmp_name, width, height, grayscale); } @@ -459,6 +460,33 @@ wxBitmap create_scaled_bitmap( const std::string& bmp_name_in, return *bmp; } +wxBitmap create_scaled_bitmap(const std::string& bmp_name_in, + const std::string& new_color, // color witch will used instead of orange + wxWindow* win, + const int px_cnt/* = 16*/, + const bool grayscale/* = false*/) +{ + static Slic3r::GUI::BitmapCache cache; + + unsigned int width = 0; + unsigned int height = (unsigned int)(em_unit(win) * px_cnt * 0.1f + 0.5f); + + std::string bmp_name = bmp_name_in; + auto it = boost::find_last(bmp_name, ".png"); + assert(it == bmp_name.end()); // this function works just with SVGs + + bool dark_mode = Slic3r::GUI::wxGetApp().dark_mode(); + + // Try loading an SVG first, then PNG if SVG is not found: + wxBitmap* bmp = cache.load_svg(bmp_name, width, height, grayscale, dark_mode, new_color); + if (bmp == nullptr) { + // Neither SVG nor PNG has been found, raise error + throw Slic3r::RuntimeError("Could not load bitmap: " + bmp_name); + } + + return *bmp; +} + std::vector get_extruder_color_icons(bool thin_icon/* = false*/) { static Slic3r::GUI::BitmapCache bmp_cache; diff --git a/src/slic3r/GUI/wxExtensions.hpp b/src/slic3r/GUI/wxExtensions.hpp index 25876bd23..f78621a5c 100644 --- a/src/slic3r/GUI/wxExtensions.hpp +++ b/src/slic3r/GUI/wxExtensions.hpp @@ -51,7 +51,9 @@ int mode_icon_px_size(); wxBitmap create_menu_bitmap(const std::string& bmp_name); wxBitmap create_scaled_bitmap(const std::string& bmp_name, wxWindow *win = nullptr, - const int px_cnt = 16, const bool grayscale = false, const bool menu_bitmap = false); + const int px_cnt = 16, const bool grayscale = false, + const std::string& new_color = std::string(), // color witch will used instead of orange + const bool menu_bitmap = false); std::vector get_extruder_color_icons(bool thin_icon = false);