Fix volume icons

This commit is contained in:
Filip Sykala - NTB T15p 2022-08-31 16:40:56 +02:00
parent 9cefc74e3d
commit aaf59dc580
2 changed files with 7 additions and 9 deletions

View File

@ -1724,22 +1724,21 @@ wxBitmapBundle ObjectDataViewModel::GetVolumeIcon(
{ {
const std::vector<wxBitmapBundle*>& bitmaps = node.is_text_volume() ? m_text_volume_bmps : m_volume_bmps; const std::vector<wxBitmapBundle*>& bitmaps = node.is_text_volume() ? m_text_volume_bmps : m_volume_bmps;
if (warning_icon_name.empty()) if (warning_icon_name.empty())
return *m_volume_bmps[static_cast<int>(node.GetType())]; return *bitmaps[static_cast<int>(node.GetVolumeType())];
std::string scaled_bitmap_name = warning_icon_name + std::to_string(node.GetType()); std::string scaled_bitmap_name = warning_icon_name +
std::to_string(node.GetType()) +
(node.is_text_volume() ?"text": "");
scaled_bitmap_name += "-em" + std::to_string(wxGetApp().em_unit()) + (wxGetApp().dark_mode() ? "-dm" : "-lm"); scaled_bitmap_name += "-em" + std::to_string(wxGetApp().em_unit()) + (wxGetApp().dark_mode() ? "-dm" : "-lm");
// TODO: usi text bitmap // TODO: use scale cache
wxBitmapBundle *bmp = m_bitmap_cache->find_bndl(scaled_bitmap_name); wxBitmapBundle *bmp = m_bitmap_cache->find_bndl(scaled_bitmap_name);
if (bmp == nullptr) { if (bmp == nullptr) {
std::vector<wxBitmapBundle*> bmps; std::vector<wxBitmapBundle*> bmps;
bmps.emplace_back(&GetWarningBitmap(warning_icon_name)); bmps.emplace_back(&GetWarningBitmap(warning_icon_name));
bmps.emplace_back(m_volume_bmps[static_cast<int>(node.GetType())]); bmps.emplace_back(bitmaps[static_cast<int>(node.GetVolumeType())]);
bmp = m_bitmap_cache->insert_bndl(scaled_bitmap_name, bmps); bmp = m_bitmap_cache->insert_bndl(scaled_bitmap_name, bmps);
} }
return *bmp; return *bmp;
} }

View File

@ -190,7 +190,7 @@ public:
InfoItemType GetInfoItemType() const { return m_info_item_type; } InfoItemType GetInfoItemType() const { return m_info_item_type; }
void SetIdx(const int& idx); void SetIdx(const int& idx);
int GetIdx() const { return m_idx; } int GetIdx() const { return m_idx; }
ModelVolumeType GetVolumeType() { return m_volume_type; } ModelVolumeType GetVolumeType() const { return m_volume_type; }
t_layer_height_range GetLayerRange() const { return m_layer_range; } t_layer_height_range GetLayerRange() const { return m_layer_range; }
wxString GetExtruder() { return m_extruder; } wxString GetExtruder() { return m_extruder; }
PrintIndicator IsPrintable() const { return m_printable; } PrintIndicator IsPrintable() const { return m_printable; }
@ -237,7 +237,6 @@ public:
bool update_settings_digest(const std::vector<std::string>& categories); bool update_settings_digest(const std::vector<std::string>& categories);
int volume_type() const { return int(m_volume_type); } int volume_type() const { return int(m_volume_type); }
bool is_text_volume() const { return m_is_text_volume; } bool is_text_volume() const { return m_is_text_volume; }
void msw_rescale();
void sys_color_changed(); void sys_color_changed();
#ifndef NDEBUG #ifndef NDEBUG