Merge remote-tracking branch 'origin/ys_msw_dpi'

This commit is contained in:
YuSanka 2019-04-24 23:09:50 +02:00
commit be60f0a53c
51 changed files with 1742 additions and 477 deletions

View file

@ -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()->changed_object();
@ -123,8 +126,8 @@ 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->sidetext_width = 5.5 * wxGetApp().em_unit();
optgroup->label_width = 15;
optgroup->sidetext_width = 5.5;
optgroup->m_on_change = [](const t_config_option_key& opt_id, const boost::any& value) {
wxGetApp().obj_list()->changed_object(); };
@ -134,11 +137,20 @@ void ObjectSettings::update_settings_list()
if (opt == "extruder")
continue;
Option option = optgroup->get_option(opt);
option.opt.width = 12 * wxGetApp().em_unit();
option.opt.width = 12;
optgroup->append_single_option_line(option);
}
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_item = [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