From 37afe79c60a9da47737b3adede0daf950e0bef38 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Thu, 19 Oct 2023 09:56:58 +0200 Subject: [PATCH] EditGCodeDialog: Added new icons. + BitmapCache: Fixed replaces during SVG loading(quotation marks are redundant). --- resources/icons/custom-gcode_gcode.svg | 2 ++ resources/icons/custom-gcode_measure.svg | 1 + resources/icons/custom-gcode_object-info.svg | 1 + resources/icons/custom-gcode_single.svg | 1 + resources/icons/custom-gcode_slicing-state.svg | 1 + .../custom-gcode_slicing-state_global.svg | 3 +++ resources/icons/custom-gcode_stats.svg | 1 + resources/icons/custom-gcode_vector-index.svg | 1 + resources/icons/custom-gcode_vector.svg | 1 + src/slic3r/GUI/BitmapCache.cpp | 10 +++++----- src/slic3r/GUI/EditGCodeDialog.cpp | 18 +++++++++--------- 11 files changed, 26 insertions(+), 14 deletions(-) create mode 100644 resources/icons/custom-gcode_gcode.svg create mode 100644 resources/icons/custom-gcode_measure.svg create mode 100644 resources/icons/custom-gcode_object-info.svg create mode 100644 resources/icons/custom-gcode_single.svg create mode 100644 resources/icons/custom-gcode_slicing-state.svg create mode 100644 resources/icons/custom-gcode_slicing-state_global.svg create mode 100644 resources/icons/custom-gcode_stats.svg create mode 100644 resources/icons/custom-gcode_vector-index.svg create mode 100644 resources/icons/custom-gcode_vector.svg diff --git a/resources/icons/custom-gcode_gcode.svg b/resources/icons/custom-gcode_gcode.svg new file mode 100644 index 0000000000..38bcd21729 --- /dev/null +++ b/resources/icons/custom-gcode_gcode.svg @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/resources/icons/custom-gcode_measure.svg b/resources/icons/custom-gcode_measure.svg new file mode 100644 index 0000000000..3c13dd7cc7 --- /dev/null +++ b/resources/icons/custom-gcode_measure.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/icons/custom-gcode_object-info.svg b/resources/icons/custom-gcode_object-info.svg new file mode 100644 index 0000000000..03904c3fc6 --- /dev/null +++ b/resources/icons/custom-gcode_object-info.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/icons/custom-gcode_single.svg b/resources/icons/custom-gcode_single.svg new file mode 100644 index 0000000000..d177860bc9 --- /dev/null +++ b/resources/icons/custom-gcode_single.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/icons/custom-gcode_slicing-state.svg b/resources/icons/custom-gcode_slicing-state.svg new file mode 100644 index 0000000000..4b4bef6ecf --- /dev/null +++ b/resources/icons/custom-gcode_slicing-state.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/icons/custom-gcode_slicing-state_global.svg b/resources/icons/custom-gcode_slicing-state_global.svg new file mode 100644 index 0000000000..4f5131c699 --- /dev/null +++ b/resources/icons/custom-gcode_slicing-state_global.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/resources/icons/custom-gcode_stats.svg b/resources/icons/custom-gcode_stats.svg new file mode 100644 index 0000000000..e663965d80 --- /dev/null +++ b/resources/icons/custom-gcode_stats.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/icons/custom-gcode_vector-index.svg b/resources/icons/custom-gcode_vector-index.svg new file mode 100644 index 0000000000..4307dd7596 --- /dev/null +++ b/resources/icons/custom-gcode_vector-index.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/icons/custom-gcode_vector.svg b/resources/icons/custom-gcode_vector.svg new file mode 100644 index 0000000000..396f0e7b82 --- /dev/null +++ b/resources/icons/custom-gcode_vector.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/slic3r/GUI/BitmapCache.cpp b/src/slic3r/GUI/BitmapCache.cpp index 98b2889aa1..4d594733ef 100644 --- a/src/slic3r/GUI/BitmapCache.cpp +++ b/src/slic3r/GUI/BitmapCache.cpp @@ -410,11 +410,11 @@ wxBitmapBundle* BitmapCache::from_svg(const std::string& bitmap_name, unsigned t // map of color replaces std::map replaces; if (dark_mode) - replaces["\"#808080\""] = "\"#FFFFFF\""; + replaces["#808080"] = "#FFFFFF"; if (!new_color.empty()) - replaces["\"#ED6B21\""] = "\"" + new_color + "\""; + replaces["#ED6B21"] = new_color; - replaces["\"#ButtonBG\""] = dark_mode ? "\"#4E4E4E\"" : "\"#828282\""; + replaces["#ButtonBG"] = dark_mode ? "#4E4E4E" : "#828282"; std::string str; nsvgGetDataFromFileWithReplace(Slic3r::var(bitmap_name + ".svg").c_str(), str, replaces); @@ -468,9 +468,9 @@ wxBitmap* BitmapCache::load_svg(const std::string &bitmap_name, unsigned target_ // map of color replaces std::map replaces; if (dark_mode) - replaces["\"#808080\""] = "\"#FFFFFF\""; + replaces["#808080"] = "#FFFFFF"; if (!new_color.empty()) - replaces["\"#ED6B21\""] = "\"" + new_color + "\""; + replaces["#ED6B21"] = new_color; NSVGimage *image = nsvgParseFromFileWithReplace(Slic3r::var(bitmap_name + ".svg").c_str(), "px", 96.0f, replaces); if (image == nullptr) diff --git a/src/slic3r/GUI/EditGCodeDialog.cpp b/src/slic3r/GUI/EditGCodeDialog.cpp index 6a628f29ac..7b166d6712 100644 --- a/src/slic3r/GUI/EditGCodeDialog.cpp +++ b/src/slic3r/GUI/EditGCodeDialog.cpp @@ -159,7 +159,7 @@ void EditGCodeDialog::init_params_list(const std::string& custom_gcode_name) // Add slicing states placeholders - wxDataViewItem slicing_state = m_params_list->AppendGroup(_L("[Global] Slicing state"), "re_slice"); + wxDataViewItem slicing_state = m_params_list->AppendGroup(_L("[Global] Slicing state"), "custom-gcode_slicing-state_global"); if (!cgp_ro_slicing_states_config_def.empty()) { wxDataViewItem read_only = m_params_list->AppendSubGroup(slicing_state, _L("Read only"), "lock_closed"); for (const auto& [opt_key, def]: cgp_ro_slicing_states_config_def.options) @@ -175,7 +175,7 @@ void EditGCodeDialog::init_params_list(const std::string& custom_gcode_name) // add other universal params, which are related to slicing state if (!cgp_other_slicing_states_config_def.empty()) { - slicing_state = m_params_list->AppendGroup(_L("Slicing state"), "re_slice"); + slicing_state = m_params_list->AppendGroup(_L("Slicing state"), "custom-gcode_slicing-state"); for (const auto& [opt_key, def] : cgp_other_slicing_states_config_def.options) m_params_list->AppendParam(slicing_state, get_type(opt_key, def), opt_key); } @@ -186,7 +186,7 @@ void EditGCodeDialog::init_params_list(const std::string& custom_gcode_name) // Add print statistics subgroup if (!cgp_print_statistics_config_def.empty()) { - wxDataViewItem statistics = m_params_list->AppendGroup(_L("Print statistics"), "info"); + wxDataViewItem statistics = m_params_list->AppendGroup(_L("Print statistics"), "custom-gcode_stats"); for (const auto& [opt_key, def] : cgp_print_statistics_config_def.options) m_params_list->AppendParam(statistics, get_type(opt_key, def), opt_key); } @@ -194,7 +194,7 @@ void EditGCodeDialog::init_params_list(const std::string& custom_gcode_name) // Add objects info subgroup if (!cgp_objects_info_config_def.empty()) { - wxDataViewItem objects_info = m_params_list->AppendGroup(_L("Objects info"), "advanced_plus"); + wxDataViewItem objects_info = m_params_list->AppendGroup(_L("Objects info"), "custom-gcode_object-info"); for (const auto& [opt_key, def] : cgp_objects_info_config_def.options) m_params_list->AppendParam(objects_info, get_type(opt_key, def), opt_key); } @@ -202,7 +202,7 @@ void EditGCodeDialog::init_params_list(const std::string& custom_gcode_name) // Add dimensions subgroup if (!cgp_dimensions_config_def.empty()) { - wxDataViewItem dimensions = m_params_list->AppendGroup(_L("Dimensions"), "measure"); + wxDataViewItem dimensions = m_params_list->AppendGroup(_L("Dimensions"), "custom-gcode_measure"); for (const auto& [opt_key, def] : cgp_dimensions_config_def.options) m_params_list->AppendParam(dimensions, get_type(opt_key, def), opt_key); } @@ -220,7 +220,7 @@ void EditGCodeDialog::init_params_list(const std::string& custom_gcode_name) if (!specific_params.empty()) { // TRN: The argument is the name of currently edited custom gcode. The string starts a section of placeholders only available in this gcode. - wxDataViewItem group = m_params_list->AppendGroup(format_wxstr(_L("Specific for %1%"), custom_gcode_name), "add_gcode"); + wxDataViewItem group = m_params_list->AppendGroup(format_wxstr(_L("Specific for %1%"), custom_gcode_name), "custom-gcode_gcode"); for (const auto& opt_key : specific_params) if (custom_gcode_specific_config_def.has(opt_key)) { auto def = custom_gcode_specific_config_def.get(opt_key); @@ -389,9 +389,9 @@ void EditGCodeDialog::on_sys_color_changed() const std::map ParamsInfo { // Type BitmapName - { ParamType::Scalar, "scalar_param" }, - { ParamType::Vector, "vector_param" }, - { ParamType::FilamentVector,"vector_filament_param" }, + { ParamType::Scalar, "custom-gcode_single" }, + { ParamType::Vector, "custom-gcode_vector" }, + { ParamType::FilamentVector,"custom-gcode_vector-index" }, }; static void make_bold(wxString& str)