Calibratioon

This commit is contained in:
sunsets
2023-08-25 09:36:16 +08:00
parent a867b747e6
commit e452f65575
46 changed files with 3884 additions and 2 deletions

View File

@@ -795,6 +795,56 @@ void ScalableBitmap::sys_color_changed()
m_bmp = *get_bmp_bundle(m_icon_name, m_px_cnt);
}
//B34
// win is used to get a correct em_unit value
// It's important for bitmaps of dialogs.
// if win == nullptr, em_unit value of MainFrame will be used
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*/,
const bool resize /* = false*/)
{
static Slic3r::GUI::BitmapCache cache;
unsigned int width = 0;
unsigned int height = (unsigned int) (win->FromDIP(px_cnt) + 0.5f);
std::string bmp_name = bmp_name_in;
boost::replace_last(bmp_name, ".png", "");
bool dark_mode =
#ifdef _WIN32
menu_bitmap ? Slic3r::GUI::check_dark_mode() :
#endif
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) {
bmp = cache.load_png(bmp_name, width, height, grayscale);
}
if (bmp == nullptr) {
// Neither SVG nor PNG has been found, raise error
throw Slic3r::RuntimeError("Could not load bitmap: " + bmp_name);
}
return *bmp;
}
//B34
void ScalableBitmap::msw_rescale()
{
m_bmp = create_scaled_bitmap(m_icon_name, m_parent, m_px_cnt, m_grayscale, std::string(), false, m_resize);
}
// ----------------------------------------------------------------------------
// QIDIButton
// ----------------------------------------------------------------------------