Application Scaling for MSW: Next big step
- Added rescale() function for the most of controls - Created PrusaBitmap and PrusaButton classes like a wrap to wxBitmap and wxButton accordingly
This commit is contained in:
parent
a74c608c7a
commit
f7ddddcff5
22 changed files with 737 additions and 250 deletions
src/slic3r/GUI
|
@ -59,6 +59,8 @@ ObjectSettings::ObjectSettings(wxWindow* parent) :
|
|||
|
||||
m_settings_list_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
m_og->sizer->Add(m_settings_list_sizer, 1, wxEXPAND | wxLEFT, 5);
|
||||
|
||||
m_bmp_delete = PrusaBitmap(parent, "cross");
|
||||
}
|
||||
|
||||
void ObjectSettings::update_settings_list()
|
||||
|
@ -77,11 +79,12 @@ void ObjectSettings::update_settings_list()
|
|||
{
|
||||
auto opt_key = (line.get_options())[0].opt_id; //we assume that we have one option per line
|
||||
|
||||
auto btn = new wxBitmapButton(parent, wxID_ANY, create_scaled_bitmap(m_parent, "cross"/*"colorchange_delete_on.png"*/),
|
||||
wxDefaultPosition, wxDefaultSize, wxBORDER_NONE);
|
||||
#ifdef __WXMSW__
|
||||
btn->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
|
||||
#endif // __WXMSW__
|
||||
// auto btn = new wxBitmapButton(parent, wxID_ANY, create_scaled_bitmap(m_parent, "cross"/*"colorchange_delete_on.png"*/),
|
||||
// wxDefaultPosition, wxDefaultSize, wxBORDER_NONE);
|
||||
auto btn = new PrusaButton(parent, wxID_ANY, m_bmp_delete);
|
||||
//#ifdef __WXMSW__
|
||||
// btn->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
|
||||
//#endif // __WXMSW__
|
||||
btn->Bind(wxEVT_BUTTON, [opt_key, config, this](wxEvent &event) {
|
||||
config->erase(opt_key);
|
||||
wxGetApp().obj_list()->part_settings_changed();
|
||||
|
@ -123,7 +126,7 @@ void ObjectSettings::update_settings_list()
|
|||
continue;
|
||||
|
||||
auto optgroup = std::make_shared<ConfigOptionsGroup>(m_og->ctrl_parent(), cat.first, config, false, extra_column);
|
||||
optgroup->label_width = 15 * wxGetApp().em_unit();
|
||||
optgroup->label_width = 15;
|
||||
optgroup->sidetext_width = 5.5 * wxGetApp().em_unit();
|
||||
|
||||
optgroup->m_on_change = [](const t_config_option_key& opt_id, const boost::any& value) {
|
||||
|
@ -139,6 +142,15 @@ void ObjectSettings::update_settings_list()
|
|||
}
|
||||
optgroup->reload_config();
|
||||
m_settings_list_sizer->Add(optgroup->sizer, 0, wxEXPAND | wxALL, 0);
|
||||
|
||||
// call back for rescaling of the extracolumn control
|
||||
optgroup->rescale_extra_column = [this](wxWindow* win) {
|
||||
auto *ctrl = dynamic_cast<PrusaButton*>(win);
|
||||
if (ctrl == nullptr)
|
||||
return;
|
||||
ctrl->SetBitmap_(m_bmp_delete);
|
||||
};
|
||||
|
||||
m_og_settings.push_back(optgroup);
|
||||
|
||||
categories.push_back(cat.first);
|
||||
|
@ -163,5 +175,13 @@ void ObjectSettings::UpdateAndShow(const bool show)
|
|||
OG_Settings::UpdateAndShow(show);
|
||||
}
|
||||
|
||||
void ObjectSettings::rescale()
|
||||
{
|
||||
m_bmp_delete.rescale();
|
||||
|
||||
for (auto group : m_og_settings)
|
||||
group->rescale();
|
||||
}
|
||||
|
||||
} //namespace GUI
|
||||
} //namespace Slic3r
|
Loading…
Add table
Add a link
Reference in a new issue