Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuSanka <yusanka@gmail.com>2019-04-18 16:22:10 +0300
committerYuSanka <yusanka@gmail.com>2019-04-18 16:24:50 +0300
commitde55801e313fad0ec624f7bcfd5d9d9e1842dcd8 (patch)
treec6fb032bd236944e226f760a7089f27c54f42d73 /src/slic3r/GUI/PresetBundle.cpp
parent9cd3c594be10a92aa943f361c1b63c9a782ac5be (diff)
parent850eb86360a757eef44c5483caecb61a4c59b140 (diff)
Merge remote-tracking branch 'origin/ys_bug_fixing' into ys_msw_dpi
Diffstat (limited to 'src/slic3r/GUI/PresetBundle.cpp')
-rw-r--r--src/slic3r/GUI/PresetBundle.cpp24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/slic3r/GUI/PresetBundle.cpp b/src/slic3r/GUI/PresetBundle.cpp
index 7927006b2..7de8c99aa 100644
--- a/src/slic3r/GUI/PresetBundle.cpp
+++ b/src/slic3r/GUI/PresetBundle.cpp
@@ -1451,7 +1451,7 @@ void PresetBundle::load_default_preset_bitmaps(wxWindow *window)
this->load_compatible_bitmaps(window);
}
-void PresetBundle::update_platter_filament_ui(unsigned int idx_extruder, GUI::PresetComboBox *ui)
+void PresetBundle::update_platter_filament_ui(unsigned int idx_extruder, GUI::PresetComboBox *ui, const int em/* = 10*/)
{
if (ui == nullptr || this->printers.get_edited_preset().printer_technology() == ptSLA ||
this->filament_presets.size() <= idx_extruder )
@@ -1476,6 +1476,18 @@ void PresetBundle::update_platter_filament_ui(unsigned int idx_extruder, GUI::Pr
wxString selected_str = "";
if (!this->filaments().front().is_visible)
ui->set_label_marker(ui->Append(PresetCollection::separator(L("System presets")), wxNullBitmap));
+
+ /* It's supposed that standard size of an icon is 16px*16px for 100% scaled display.
+ * So set sizes for solid_colored icons used for filament preset
+ * and scale then in respect to em_unit value
+ */
+ const float scale_f = em * 0.1f;
+ const int icon_height = 16 * scale_f + 0.5f;
+ const int normal_icon_width = 16 * scale_f + 0.5f;
+ const int space_icon_width = 2 * scale_f + 0.5f;
+ const int wide_icon_width = 24 * scale_f + 0.5f;
+ const int thin_icon_width = 8 * scale_f + 0.5f;
+
for (int i = this->filaments().front().is_visible ? 0 : 1; i < int(this->filaments().size()); ++i) {
const Preset &preset = this->filaments.preset(i);
bool selected = this->filament_presets[idx_extruder] == preset.name;
@@ -1499,17 +1511,17 @@ void PresetBundle::update_platter_filament_ui(unsigned int idx_extruder, GUI::Pr
std::vector<wxBitmap> bmps;
if (wide_icons)
// Paint a red flag for incompatible presets.
- bmps.emplace_back(preset.is_compatible ? m_bitmapCache->mkclear(16, 16) : *m_bitmapIncompatible);
+ bmps.emplace_back(preset.is_compatible ? m_bitmapCache->mkclear(normal_icon_width, icon_height) : *m_bitmapIncompatible);
// Paint the color bars.
parse_color(filament_rgb, rgb);
- bmps.emplace_back(m_bitmapCache->mksolid(single_bar ? 24 : 16, 16, rgb));
+ bmps.emplace_back(m_bitmapCache->mksolid(single_bar ? wide_icon_width : normal_icon_width, icon_height, rgb));
if (! single_bar) {
parse_color(extruder_rgb, rgb);
- bmps.emplace_back(m_bitmapCache->mksolid(8, 16, rgb));
+ bmps.emplace_back(m_bitmapCache->mksolid(thin_icon_width, icon_height, rgb));
}
// Paint a lock at the system presets.
- bmps.emplace_back(m_bitmapCache->mkclear(2, 16));
- bmps.emplace_back((preset.is_system || preset.is_default) ? *m_bitmapLock : m_bitmapCache->mkclear(16, 16));
+ bmps.emplace_back(m_bitmapCache->mkclear(space_icon_width, icon_height));
+ bmps.emplace_back((preset.is_system || preset.is_default) ? *m_bitmapLock : m_bitmapCache->mkclear(normal_icon_width, icon_height));
// (preset.is_dirty ? *m_bitmapLockOpen : *m_bitmapLock) : m_bitmapCache->mkclear(16, 16));
bitmap = m_bitmapCache->insert(bitmap_key, bmps);
}