Fixed of the warnings.

+ Some small bug-fixing related to the system colors change on MacOS ("Set..." buttons didn't respect to the system color change)
This commit is contained in:
YuSanka 2021-07-19 15:46:50 +02:00
parent d3ddb1cfa8
commit 888a5e3084
7 changed files with 16 additions and 27 deletions

View File

@ -14,9 +14,10 @@ namespace GUI {
Bed_2D::Bed_2D(wxWindow* parent) :
wxPanel(parent, wxID_ANY, wxDefaultPosition, wxSize(25 * wxGetApp().em_unit(), -1), wxTAB_TRAVERSAL)
{
SetBackgroundStyle(wxBG_STYLE_PAINT); // to avoid assert message after wxAutoBufferedPaintDC
#ifdef __APPLE__
m_user_drawn_background = false;
#else
SetBackgroundStyle(wxBG_STYLE_PAINT); // to avoid assert message after wxAutoBufferedPaintDC
#endif /*__APPLE__*/
}

View File

@ -267,7 +267,7 @@ void BitmapComboBox::Rescale()
// we need to refill control with new bitmaps
const wxString selection = this->GetValue();
std::vector<wxString> items;
for (int i = 0; i < GetCount(); i++)
for (size_t i = 0; i < GetCount(); i++)
items.push_back(GetString(i));
this->Clear();

View File

@ -179,8 +179,8 @@ static void add_lock(wxImage& image)
size_t beg_x = width - lock_width;
size_t beg_y = height - lock_height;
for (size_t x = 0; x < lock_width; ++x) {
for (size_t y = 0; y < lock_height; ++y) {
for (size_t x = 0; x < (size_t)lock_width; ++x) {
for (size_t y = 0; y < (size_t)lock_height; ++y) {
const size_t lock_idx = (x + y * lock_width);
if (lock_a_data && lock_a_data[lock_idx] == 0)
continue;

View File

@ -747,6 +747,10 @@ void ConfigOptionsGroup::sys_color_changed()
wxGetApp().UpdateDarkUI(extra_col);
}
if (custom_ctrl)
wxGetApp().UpdateDarkUI(custom_ctrl);
#endif
auto update = [](wxSizer* sizer) {
for (wxSizerItem* item : sizer->GetChildren())
if (item->IsWindow()) {
@ -768,10 +772,6 @@ void ConfigOptionsGroup::sys_color_changed()
update(line.extra_widget_sizer);
}
if (custom_ctrl)
wxGetApp().UpdateDarkUI(custom_ctrl);
#endif
// update undo buttons : rescale bitmaps
for (const auto& field : m_fields)
field.second->sys_color_changed();

View File

@ -709,29 +709,12 @@ void TabPrinter::msw_rescale()
{
Tab::msw_rescale();
// rescale missed options_groups
const std::vector<PageShp>& pages = m_printer_technology == ptFFF ? m_pages_sla : m_pages_fff;
for (auto page : pages)
page->msw_rescale();
if (m_reset_to_filament_color)
m_reset_to_filament_color->msw_rescale();
Layout();
}
void TabPrinter::sys_color_changed()
{
Tab::sys_color_changed();
// update missed options_groups
const std::vector<PageShp>& pages = m_printer_technology == ptFFF ? m_pages_sla : m_pages_fff;
for (auto page : pages)
page->sys_color_changed();
Layout();
}
void TabSLAMaterial::init_options_list()
{
if (!m_options_list.empty())

View File

@ -485,7 +485,6 @@ public:
void on_preset_loaded() override;
void init_options_list() override;
void msw_rescale() override;
void sys_color_changed() override;
#if ENABLE_PROJECT_DIRTY_STATE
bool supports_printer_technology(const PrinterTechnology /* tech */) const override { return true; }
#else

View File

@ -889,6 +889,8 @@ bool ScalableButton::SetBitmap_(const std::string& bmp_name)
wxBitmap bmp = create_scaled_bitmap(m_current_icon_name, m_parent, m_px_cnt);
SetBitmap(bmp);
SetBitmapCurrent(bmp);
SetBitmapPressed(bmp);
SetBitmapFocus(bmp);
if (m_use_default_disabled_bitmap)
SetBitmapDisabled(create_scaled_bitmap(m_current_icon_name, m_parent, m_px_cnt, true));
return true;
@ -920,7 +922,11 @@ void ScalableButton::msw_rescale()
Slic3r::GUI::wxGetApp().UpdateDarkUI(this, m_has_border);
if (!m_current_icon_name.empty()) {
SetBitmap(create_scaled_bitmap(m_current_icon_name, m_parent, m_px_cnt));
wxBitmap bmp = create_scaled_bitmap(m_current_icon_name, m_parent, m_px_cnt);
SetBitmap(bmp);
SetBitmapCurrent(bmp);
SetBitmapPressed(bmp);
SetBitmapFocus(bmp);
if (!m_disabled_icon_name.empty())
SetBitmapDisabled(create_scaled_bitmap(m_disabled_icon_name, m_parent, m_px_cnt));
else if (m_use_default_disabled_bitmap)