Moved the Fileds from the Page object to the respective OptionGroups
for performance reasons. Disabled clearing of background for most of the static texts and Fields stored into OptionGrops.
This commit is contained in:
parent
60260c26be
commit
2f9e6cf887
@ -36,7 +36,9 @@ void Field::PostInitialize()
|
|||||||
m_Undo_to_sys_btn = new MyButton(m_parent, wxID_ANY, "", wxDefaultPosition,wxDefaultSize, wxBU_EXACTFIT | wxNO_BORDER);
|
m_Undo_to_sys_btn = new MyButton(m_parent, wxID_ANY, "", wxDefaultPosition,wxDefaultSize, wxBU_EXACTFIT | wxNO_BORDER);
|
||||||
if (wxMSW) {
|
if (wxMSW) {
|
||||||
m_Undo_btn->SetBackgroundColour(color);
|
m_Undo_btn->SetBackgroundColour(color);
|
||||||
|
m_Undo_btn->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||||
m_Undo_to_sys_btn->SetBackgroundColour(color);
|
m_Undo_to_sys_btn->SetBackgroundColour(color);
|
||||||
|
m_Undo_to_sys_btn->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||||
}
|
}
|
||||||
m_Undo_btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent) { on_back_to_initial_value(); }));
|
m_Undo_btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent) { on_back_to_initial_value(); }));
|
||||||
m_Undo_to_sys_btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent) { on_back_to_sys_value(); }));
|
m_Undo_to_sys_btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent) { on_back_to_sys_value(); }));
|
||||||
@ -257,6 +259,7 @@ void TextCtrl::BUILD() {
|
|||||||
|
|
||||||
const long style = m_opt.multiline ? wxTE_MULTILINE : wxTE_PROCESS_ENTER/*0*/;
|
const long style = m_opt.multiline ? wxTE_MULTILINE : wxTE_PROCESS_ENTER/*0*/;
|
||||||
auto temp = new wxTextCtrl(m_parent, wxID_ANY, text_value, wxDefaultPosition, size, style);
|
auto temp = new wxTextCtrl(m_parent, wxID_ANY, text_value, wxDefaultPosition, size, style);
|
||||||
|
temp->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||||
#ifdef __WXOSX__
|
#ifdef __WXOSX__
|
||||||
temp->OSXDisableAllSmartSubstitutions();
|
temp->OSXDisableAllSmartSubstitutions();
|
||||||
#endif // __WXOSX__
|
#endif // __WXOSX__
|
||||||
@ -372,6 +375,7 @@ void CheckBox::BUILD() {
|
|||||||
false;
|
false;
|
||||||
|
|
||||||
auto temp = new wxCheckBox(m_parent, wxID_ANY, wxString(""), wxDefaultPosition, size);
|
auto temp = new wxCheckBox(m_parent, wxID_ANY, wxString(""), wxDefaultPosition, size);
|
||||||
|
temp->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||||
temp->SetValue(check_value);
|
temp->SetValue(check_value);
|
||||||
if (m_opt.readonly) temp->Disable();
|
if (m_opt.readonly) temp->Disable();
|
||||||
|
|
||||||
@ -429,6 +433,7 @@ void SpinCtrl::BUILD() {
|
|||||||
|
|
||||||
auto temp = new wxSpinCtrl(m_parent, wxID_ANY, text_value, wxDefaultPosition, size,
|
auto temp = new wxSpinCtrl(m_parent, wxID_ANY, text_value, wxDefaultPosition, size,
|
||||||
0|wxTE_PROCESS_ENTER, min_val, max_val, default_value);
|
0|wxTE_PROCESS_ENTER, min_val, max_val, default_value);
|
||||||
|
temp->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||||
|
|
||||||
#ifndef __WXOSX__
|
#ifndef __WXOSX__
|
||||||
// #ys_FIXME_KILL_FOCUS
|
// #ys_FIXME_KILL_FOCUS
|
||||||
@ -502,6 +507,7 @@ void Choice::BUILD() {
|
|||||||
temp = new wxComboBox(m_parent, wxID_ANY, wxString(""), wxDefaultPosition, size);
|
temp = new wxComboBox(m_parent, wxID_ANY, wxString(""), wxDefaultPosition, size);
|
||||||
else
|
else
|
||||||
temp = new wxComboBox(m_parent, wxID_ANY, wxString(""), wxDefaultPosition, size, 0, NULL, wxCB_READONLY);
|
temp = new wxComboBox(m_parent, wxID_ANY, wxString(""), wxDefaultPosition, size, 0, NULL, wxCB_READONLY);
|
||||||
|
temp->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||||
|
|
||||||
// recast as a wxWindow to fit the calling convention
|
// recast as a wxWindow to fit the calling convention
|
||||||
window = dynamic_cast<wxWindow*>(temp);
|
window = dynamic_cast<wxWindow*>(temp);
|
||||||
@ -774,6 +780,7 @@ void ColourPicker::BUILD()
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto temp = new wxColourPickerCtrl(m_parent, wxID_ANY, clr, wxDefaultPosition, size);
|
auto temp = new wxColourPickerCtrl(m_parent, wxID_ANY, clr, wxDefaultPosition, size);
|
||||||
|
temp->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||||
|
|
||||||
// // recast as a wxWindow to fit the calling convention
|
// // recast as a wxWindow to fit the calling convention
|
||||||
window = dynamic_cast<wxWindow*>(temp);
|
window = dynamic_cast<wxWindow*>(temp);
|
||||||
@ -808,10 +815,17 @@ void PointCtrl::BUILD()
|
|||||||
|
|
||||||
x_textctrl = new wxTextCtrl(m_parent, wxID_ANY, X, wxDefaultPosition, field_size, wxTE_PROCESS_ENTER);
|
x_textctrl = new wxTextCtrl(m_parent, wxID_ANY, X, wxDefaultPosition, field_size, wxTE_PROCESS_ENTER);
|
||||||
y_textctrl = new wxTextCtrl(m_parent, wxID_ANY, Y, wxDefaultPosition, field_size, wxTE_PROCESS_ENTER);
|
y_textctrl = new wxTextCtrl(m_parent, wxID_ANY, Y, wxDefaultPosition, field_size, wxTE_PROCESS_ENTER);
|
||||||
|
x_textctrl->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||||
|
y_textctrl->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||||
|
|
||||||
temp->Add(new wxStaticText(m_parent, wxID_ANY, "x : "), 0, wxALIGN_CENTER_VERTICAL, 0);
|
auto static_text_x = new wxStaticText(m_parent, wxID_ANY, "x : ");
|
||||||
|
auto static_text_y = new wxStaticText(m_parent, wxID_ANY, " y : ");
|
||||||
|
static_text_x->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||||
|
static_text_y->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||||
|
|
||||||
|
temp->Add(static_text_x, 0, wxALIGN_CENTER_VERTICAL, 0);
|
||||||
temp->Add(x_textctrl);
|
temp->Add(x_textctrl);
|
||||||
temp->Add(new wxStaticText(m_parent, wxID_ANY, " y : "), 0, wxALIGN_CENTER_VERTICAL, 0);
|
temp->Add(static_text_y, 0, wxALIGN_CENTER_VERTICAL, 0);
|
||||||
temp->Add(y_textctrl);
|
temp->Add(y_textctrl);
|
||||||
|
|
||||||
// x_textctrl->Bind(wxEVT_TEXT, ([this](wxCommandEvent e) { on_change_field(); }), x_textctrl->GetId());
|
// x_textctrl->Bind(wxEVT_TEXT, ([this](wxCommandEvent e) { on_change_field(); }), x_textctrl->GetId());
|
||||||
@ -880,6 +894,7 @@ void StaticText::BUILD()
|
|||||||
|
|
||||||
const wxString legend(static_cast<const ConfigOptionString*>(m_opt.default_value)->value);
|
const wxString legend(static_cast<const ConfigOptionString*>(m_opt.default_value)->value);
|
||||||
auto temp = new wxStaticText(m_parent, wxID_ANY, legend, wxDefaultPosition, size, wxST_ELLIPSIZE_MIDDLE);
|
auto temp = new wxStaticText(m_parent, wxID_ANY, legend, wxDefaultPosition, size, wxST_ELLIPSIZE_MIDDLE);
|
||||||
|
temp->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||||
temp->SetFont(wxGetApp().bold_font());
|
temp->SetFont(wxGetApp().bold_font());
|
||||||
|
|
||||||
// // recast as a wxWindow to fit the calling convention
|
// // recast as a wxWindow to fit the calling convention
|
||||||
@ -903,10 +918,12 @@ void SliderCtrl::BUILD()
|
|||||||
m_slider = new wxSlider(m_parent, wxID_ANY, def_val * m_scale,
|
m_slider = new wxSlider(m_parent, wxID_ANY, def_val * m_scale,
|
||||||
min * m_scale, max * m_scale,
|
min * m_scale, max * m_scale,
|
||||||
wxDefaultPosition, size);
|
wxDefaultPosition, size);
|
||||||
|
m_slider->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||||
wxSize field_size(40, -1);
|
wxSize field_size(40, -1);
|
||||||
|
|
||||||
m_textctrl = new wxTextCtrl(m_parent, wxID_ANY, wxString::Format("%d", m_slider->GetValue()/m_scale),
|
m_textctrl = new wxTextCtrl(m_parent, wxID_ANY, wxString::Format("%d", m_slider->GetValue()/m_scale),
|
||||||
wxDefaultPosition, field_size);
|
wxDefaultPosition, field_size);
|
||||||
|
m_textctrl->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||||
|
|
||||||
temp->Add(m_slider, 1, wxEXPAND | wxALIGN_CENTER_VERTICAL, 0);
|
temp->Add(m_slider, 1, wxEXPAND | wxALIGN_CENTER_VERTICAL, 0);
|
||||||
temp->Add(m_textctrl, 0, wxALIGN_CENTER_VERTICAL, 0);
|
temp->Add(m_textctrl, 0, wxALIGN_CENTER_VERTICAL, 0);
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include <wx/dir.h>
|
#include <wx/dir.h>
|
||||||
#include <wx/wupdlock.h>
|
#include <wx/wupdlock.h>
|
||||||
#include <wx/filefn.h>
|
#include <wx/filefn.h>
|
||||||
|
#include <wx/sysopt.h>
|
||||||
|
|
||||||
#include "libslic3r/Utils.hpp"
|
#include "libslic3r/Utils.hpp"
|
||||||
#include "libslic3r/Model.hpp"
|
#include "libslic3r/Model.hpp"
|
||||||
@ -98,6 +99,8 @@ bool GUI_App::OnInit()
|
|||||||
SetAppName("Slic3rPE-alpha");
|
SetAppName("Slic3rPE-alpha");
|
||||||
SetAppDisplayName("Slic3r Prusa Edition");
|
SetAppDisplayName("Slic3r Prusa Edition");
|
||||||
|
|
||||||
|
// wxSystemOptions::SetOption("msw.staticbox.optimized-paint", 0);
|
||||||
|
|
||||||
// Slic3r::debugf "wxWidgets version %s, Wx version %s\n", wxVERSION_STRING, wxVERSION;
|
// Slic3r::debugf "wxWidgets version %s, Wx version %s\n", wxVERSION_STRING, wxVERSION;
|
||||||
|
|
||||||
// Set the Slic3r data directory at the Slic3r XS module.
|
// Set the Slic3r data directory at the Slic3r XS module.
|
||||||
|
@ -23,18 +23,18 @@ const t_field& OptionsGroup::build_field(const t_config_option_key& id, const Co
|
|||||||
// is the normal type.
|
// is the normal type.
|
||||||
if (opt.gui_type.compare("select") == 0) {
|
if (opt.gui_type.compare("select") == 0) {
|
||||||
} else if (opt.gui_type.compare("select_open") == 0) {
|
} else if (opt.gui_type.compare("select_open") == 0) {
|
||||||
m_fields.emplace(id, std::move(Choice::Create<Choice>(parent(), opt, id)));
|
m_fields.emplace(id, std::move(Choice::Create<Choice>(this->ctrl_parent(), opt, id)));
|
||||||
} else if (opt.gui_type.compare("color") == 0) {
|
} else if (opt.gui_type.compare("color") == 0) {
|
||||||
m_fields.emplace(id, std::move(ColourPicker::Create<ColourPicker>(parent(), opt, id)));
|
m_fields.emplace(id, std::move(ColourPicker::Create<ColourPicker>(this->ctrl_parent(), opt, id)));
|
||||||
} else if (opt.gui_type.compare("f_enum_open") == 0 ||
|
} else if (opt.gui_type.compare("f_enum_open") == 0 ||
|
||||||
opt.gui_type.compare("i_enum_open") == 0 ||
|
opt.gui_type.compare("i_enum_open") == 0 ||
|
||||||
opt.gui_type.compare("i_enum_closed") == 0) {
|
opt.gui_type.compare("i_enum_closed") == 0) {
|
||||||
m_fields.emplace(id, std::move(Choice::Create<Choice>(parent(), opt, id)));
|
m_fields.emplace(id, std::move(Choice::Create<Choice>(this->ctrl_parent(), opt, id)));
|
||||||
} else if (opt.gui_type.compare("slider") == 0) {
|
} else if (opt.gui_type.compare("slider") == 0) {
|
||||||
m_fields.emplace(id, std::move(SliderCtrl::Create<SliderCtrl>(parent(), opt, id)));
|
m_fields.emplace(id, std::move(SliderCtrl::Create<SliderCtrl>(this->ctrl_parent(), opt, id)));
|
||||||
} else if (opt.gui_type.compare("i_spin") == 0) { // Spinctrl
|
} else if (opt.gui_type.compare("i_spin") == 0) { // Spinctrl
|
||||||
} else if (opt.gui_type.compare("legend") == 0) { // StaticText
|
} else if (opt.gui_type.compare("legend") == 0) { // StaticText
|
||||||
m_fields.emplace(id, std::move(StaticText::Create<StaticText>(parent(), opt, id)));
|
m_fields.emplace(id, std::move(StaticText::Create<StaticText>(this->ctrl_parent(), opt, id)));
|
||||||
} else {
|
} else {
|
||||||
switch (opt.type) {
|
switch (opt.type) {
|
||||||
case coFloatOrPercent:
|
case coFloatOrPercent:
|
||||||
@ -44,21 +44,21 @@ const t_field& OptionsGroup::build_field(const t_config_option_key& id, const Co
|
|||||||
case coPercents:
|
case coPercents:
|
||||||
case coString:
|
case coString:
|
||||||
case coStrings:
|
case coStrings:
|
||||||
m_fields.emplace(id, std::move(TextCtrl::Create<TextCtrl>(parent(), opt, id)));
|
m_fields.emplace(id, std::move(TextCtrl::Create<TextCtrl>(this->ctrl_parent(), opt, id)));
|
||||||
break;
|
break;
|
||||||
case coBool:
|
case coBool:
|
||||||
case coBools:
|
case coBools:
|
||||||
m_fields.emplace(id, std::move(CheckBox::Create<CheckBox>(parent(), opt, id)));
|
m_fields.emplace(id, std::move(CheckBox::Create<CheckBox>(this->ctrl_parent(), opt, id)));
|
||||||
break;
|
break;
|
||||||
case coInt:
|
case coInt:
|
||||||
case coInts:
|
case coInts:
|
||||||
m_fields.emplace(id, std::move(SpinCtrl::Create<SpinCtrl>(parent(), opt, id)));
|
m_fields.emplace(id, std::move(SpinCtrl::Create<SpinCtrl>(this->ctrl_parent(), opt, id)));
|
||||||
break;
|
break;
|
||||||
case coEnum:
|
case coEnum:
|
||||||
m_fields.emplace(id, std::move(Choice::Create<Choice>(parent(), opt, id)));
|
m_fields.emplace(id, std::move(Choice::Create<Choice>(this->ctrl_parent(), opt, id)));
|
||||||
break;
|
break;
|
||||||
case coPoints:
|
case coPoints:
|
||||||
m_fields.emplace(id, std::move(PointCtrl::Create<PointCtrl>(parent(), opt, id)));
|
m_fields.emplace(id, std::move(PointCtrl::Create<PointCtrl>(this->ctrl_parent(), opt, id)));
|
||||||
break;
|
break;
|
||||||
case coNone: break;
|
case coNone: break;
|
||||||
default:
|
default:
|
||||||
@ -119,7 +119,7 @@ void OptionsGroup::append_line(const Line& line, wxStaticText** full_Label/* = n
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (line.widget != nullptr) {
|
if (line.widget != nullptr) {
|
||||||
sizer->Add(line.widget(m_parent), 0, wxEXPAND | wxALL, wxOSX ? 0 : 15);
|
sizer->Add(line.widget(this->ctrl_parent()), 0, wxEXPAND | wxALL, wxOSX ? 0 : 15);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -167,7 +167,7 @@ void OptionsGroup::append_line(const Line& line, wxStaticText** full_Label/* = n
|
|||||||
|
|
||||||
// if we have an extra column, build it
|
// if we have an extra column, build it
|
||||||
if (extra_column)
|
if (extra_column)
|
||||||
grid_sizer->Add(extra_column(parent(), line), 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 3);
|
grid_sizer->Add(extra_column(this->ctrl_parent(), line), 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 3);
|
||||||
|
|
||||||
// Build a label if we have it
|
// Build a label if we have it
|
||||||
wxStaticText* label=nullptr;
|
wxStaticText* label=nullptr;
|
||||||
@ -179,18 +179,21 @@ void OptionsGroup::append_line(const Line& line, wxStaticText** full_Label/* = n
|
|||||||
// Text is properly aligned only when Ellipsize is checked.
|
// Text is properly aligned only when Ellipsize is checked.
|
||||||
label_style |= staticbox ? 0 : wxST_ELLIPSIZE_END;
|
label_style |= staticbox ? 0 : wxST_ELLIPSIZE_END;
|
||||||
#endif /* __WXGTK__ */
|
#endif /* __WXGTK__ */
|
||||||
label = new wxStaticText(parent(), wxID_ANY, line.label + (line.label.IsEmpty() ? "" : ": "),
|
label = new wxStaticText(this->ctrl_parent(), wxID_ANY, line.label + (line.label.IsEmpty() ? "" : ": "),
|
||||||
wxDefaultPosition, wxSize(label_width, -1), label_style);
|
wxDefaultPosition, wxSize(label_width, -1), label_style);
|
||||||
|
label->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||||
label->SetFont(label_font);
|
label->SetFont(label_font);
|
||||||
label->Wrap(label_width); // avoid a Linux/GTK bug
|
label->Wrap(label_width); // avoid a Linux/GTK bug
|
||||||
if (!line.near_label_widget)
|
if (!line.near_label_widget)
|
||||||
grid_sizer->Add(label, 0, (staticbox ? 0 : wxALIGN_RIGHT | wxRIGHT) | wxALIGN_CENTER_VERTICAL, line.label.IsEmpty() ? 0 : 5);
|
grid_sizer->Add(label, 0, (staticbox ? 0 : wxALIGN_RIGHT | wxRIGHT) | wxALIGN_CENTER_VERTICAL, line.label.IsEmpty() ? 0 : 5);
|
||||||
|
else if (line.near_label_widget && line.label.IsEmpty())
|
||||||
|
grid_sizer->Add(line.near_label_widget(this->ctrl_parent()), 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 7);
|
||||||
else {
|
else {
|
||||||
// If we're here, we have some widget near the label
|
// If we're here, we have some widget near the label
|
||||||
// so we need a horizontal sizer to arrange these things
|
// so we need a horizontal sizer to arrange these things
|
||||||
auto sizer = new wxBoxSizer(wxHORIZONTAL);
|
auto sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
grid_sizer->Add(sizer, 0, wxEXPAND | (staticbox ? wxALL : wxBOTTOM | wxTOP | wxLEFT), staticbox ? 0 : 1);
|
grid_sizer->Add(sizer, 0, wxEXPAND | (staticbox ? wxALL : wxBOTTOM | wxTOP | wxLEFT), staticbox ? 0 : 1);
|
||||||
sizer->Add(line.near_label_widget(parent()), 0, wxRIGHT, 7);
|
sizer->Add(line.near_label_widget(this->ctrl_parent()), 0, wxRIGHT, 7);
|
||||||
sizer->Add(label, 0, (staticbox ? 0 : wxALIGN_RIGHT | wxRIGHT) | wxALIGN_CENTER_VERTICAL, 5);
|
sizer->Add(label, 0, (staticbox ? 0 : wxALIGN_RIGHT | wxRIGHT) | wxALIGN_CENTER_VERTICAL, 5);
|
||||||
}
|
}
|
||||||
if (line.label_tooltip.compare("") != 0)
|
if (line.label_tooltip.compare("") != 0)
|
||||||
@ -201,7 +204,7 @@ void OptionsGroup::append_line(const Line& line, wxStaticText** full_Label/* = n
|
|||||||
*full_Label = label; // Initiate the pointer to the control of the full label, if we need this one.
|
*full_Label = label; // Initiate the pointer to the control of the full label, if we need this one.
|
||||||
// If there's a widget, build it and add the result to the sizer.
|
// If there's a widget, build it and add the result to the sizer.
|
||||||
if (line.widget != nullptr) {
|
if (line.widget != nullptr) {
|
||||||
auto wgt = line.widget(parent());
|
auto wgt = line.widget(this->ctrl_parent());
|
||||||
// If widget doesn't have label, don't use border
|
// If widget doesn't have label, don't use border
|
||||||
grid_sizer->Add(wgt, 0, wxEXPAND | wxBOTTOM | wxTOP, (wxOSX || line.label.IsEmpty()) ? 0 : 5);
|
grid_sizer->Add(wgt, 0, wxEXPAND | wxBOTTOM | wxTOP, (wxOSX || line.label.IsEmpty()) ? 0 : 5);
|
||||||
return;
|
return;
|
||||||
@ -237,7 +240,8 @@ void OptionsGroup::append_line(const Line& line, wxStaticText** full_Label/* = n
|
|||||||
wxString str_label = (option.label == "Top" || option.label == "Bottom") ?
|
wxString str_label = (option.label == "Top" || option.label == "Bottom") ?
|
||||||
_CTX(option.label, "Layers") :
|
_CTX(option.label, "Layers") :
|
||||||
_(option.label);
|
_(option.label);
|
||||||
label = new wxStaticText(parent(), wxID_ANY, str_label + ": ", wxDefaultPosition, wxDefaultSize);
|
label = new wxStaticText(this->ctrl_parent(), wxID_ANY, str_label + ": ", wxDefaultPosition, wxDefaultSize);
|
||||||
|
label->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||||
label->SetFont(label_font);
|
label->SetFont(label_font);
|
||||||
sizer_tmp->Add(label, 0, /*wxALIGN_RIGHT |*/ wxALIGN_CENTER_VERTICAL, 0);
|
sizer_tmp->Add(label, 0, /*wxALIGN_RIGHT |*/ wxALIGN_CENTER_VERTICAL, 0);
|
||||||
}
|
}
|
||||||
@ -262,8 +266,9 @@ void OptionsGroup::append_line(const Line& line, wxStaticText** full_Label/* = n
|
|||||||
|
|
||||||
// add sidetext if any
|
// add sidetext if any
|
||||||
if (option.sidetext != "") {
|
if (option.sidetext != "") {
|
||||||
auto sidetext = new wxStaticText( parent(), wxID_ANY, _(option.sidetext), wxDefaultPosition,
|
auto sidetext = new wxStaticText( this->ctrl_parent(), wxID_ANY, _(option.sidetext), wxDefaultPosition,
|
||||||
wxSize(sidetext_width, -1)/*wxDefaultSize*/, wxALIGN_LEFT);
|
wxSize(sidetext_width, -1)/*wxDefaultSize*/, wxALIGN_LEFT);
|
||||||
|
sidetext->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||||
sidetext->SetFont(sidetext_font);
|
sidetext->SetFont(sidetext_font);
|
||||||
sizer_tmp->Add(sidetext, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, 4);
|
sizer_tmp->Add(sidetext, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, 4);
|
||||||
field->set_side_text_ptr(sidetext);
|
field->set_side_text_ptr(sidetext);
|
||||||
@ -271,7 +276,7 @@ void OptionsGroup::append_line(const Line& line, wxStaticText** full_Label/* = n
|
|||||||
|
|
||||||
// add side widget if any
|
// add side widget if any
|
||||||
if (opt.side_widget != nullptr) {
|
if (opt.side_widget != nullptr) {
|
||||||
sizer_tmp->Add(opt.side_widget(parent())/*!.target<wxWindow>()*/, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, 1); //! requires verification
|
sizer_tmp->Add(opt.side_widget(this->ctrl_parent())/*!.target<wxWindow>()*/, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, 1); //! requires verification
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opt.opt_id != option_set.back().opt_id) //! istead of (opt != option_set.back())
|
if (opt.opt_id != option_set.back().opt_id) //! istead of (opt != option_set.back())
|
||||||
@ -287,11 +292,11 @@ void OptionsGroup::append_line(const Line& line, wxStaticText** full_Label/* = n
|
|||||||
// extra widget for non-staticbox option group (like for the frequently used parameters on the sidebar) should be wxALIGN_RIGHT
|
// extra widget for non-staticbox option group (like for the frequently used parameters on the sidebar) should be wxALIGN_RIGHT
|
||||||
const auto v_sizer = new wxBoxSizer(wxVERTICAL);
|
const auto v_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
sizer->Add(v_sizer, 1, wxEXPAND);
|
sizer->Add(v_sizer, 1, wxEXPAND);
|
||||||
v_sizer->Add(extra_widget(parent()), 0, wxALIGN_RIGHT);
|
v_sizer->Add(extra_widget(this->ctrl_parent()), 0, wxALIGN_RIGHT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sizer->Add(extra_widget(parent())/*!.target<wxWindow>()*/, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, 4); //! requires verification
|
sizer->Add(extra_widget(this->ctrl_parent())/*!.target<wxWindow>()*/, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, 4); //! requires verification
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,6 +112,10 @@ public:
|
|||||||
}
|
}
|
||||||
#endif /* __WXGTK__ */
|
#endif /* __WXGTK__ */
|
||||||
|
|
||||||
|
wxWindow* ctrl_parent() const {
|
||||||
|
return this->stb ? (wxWindow*)this->stb : this->parent();
|
||||||
|
}
|
||||||
|
|
||||||
void append_line(const Line& line, wxStaticText** full_Label = nullptr);
|
void append_line(const Line& line, wxStaticText** full_Label = nullptr);
|
||||||
Line create_single_option_line(const Option& option) const;
|
Line create_single_option_line(const Option& option) const;
|
||||||
void append_single_option_line(const Option& option) { append_line(create_single_option_line(option)); }
|
void append_single_option_line(const Option& option) { append_line(create_single_option_line(option)); }
|
||||||
@ -161,8 +165,10 @@ public:
|
|||||||
staticbox(title!=""), extra_column(extra_clmn) {
|
staticbox(title!=""), extra_column(extra_clmn) {
|
||||||
if (staticbox) {
|
if (staticbox) {
|
||||||
stb = new wxStaticBox(_parent, wxID_ANY, title);
|
stb = new wxStaticBox(_parent, wxID_ANY, title);
|
||||||
|
stb->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||||
stb->SetFont(wxGetApp().bold_font());
|
stb->SetFont(wxGetApp().bold_font());
|
||||||
}
|
} else
|
||||||
|
stb = nullptr;
|
||||||
sizer = (staticbox ? new wxStaticBoxSizer(stb, wxVERTICAL) : new wxBoxSizer(wxVERTICAL));
|
sizer = (staticbox ? new wxStaticBoxSizer(stb, wxVERTICAL) : new wxBoxSizer(wxVERTICAL));
|
||||||
auto num_columns = 1U;
|
auto num_columns = 1U;
|
||||||
if (label_width != 0) num_columns++;
|
if (label_width != 0) num_columns++;
|
||||||
|
@ -58,6 +58,13 @@ Tab::Tab(wxNotebook* parent, const wxString& title, const char* name) :
|
|||||||
wxGetApp().tabs_list.push_back(this);
|
wxGetApp().tabs_list.push_back(this);
|
||||||
|
|
||||||
m_em_unit = wxGetApp().em_unit();
|
m_em_unit = wxGetApp().em_unit();
|
||||||
|
|
||||||
|
Bind(wxEVT_SIZE, ([this](wxSizeEvent &evt) {
|
||||||
|
for (auto page : m_pages)
|
||||||
|
if (! page.get()->IsShown())
|
||||||
|
page->layout_valid = false;
|
||||||
|
evt.Skip();
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tab::set_type()
|
void Tab::set_type()
|
||||||
@ -74,7 +81,7 @@ void Tab::set_type()
|
|||||||
void Tab::create_preset_tab()
|
void Tab::create_preset_tab()
|
||||||
{
|
{
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
// SetDoubleBuffered(true);
|
SetDoubleBuffered(true);
|
||||||
#endif //__WINDOWS__
|
#endif //__WINDOWS__
|
||||||
|
|
||||||
m_preset_bundle = wxGetApp().preset_bundle;
|
m_preset_bundle = wxGetApp().preset_bundle;
|
||||||
@ -293,6 +300,11 @@ Slic3r::GUI::PageShp Tab::add_options_page(const wxString& title, const std::str
|
|||||||
auto panel = this;
|
auto panel = this;
|
||||||
#endif
|
#endif
|
||||||
PageShp page(new Page(panel, title, icon_idx));
|
PageShp page(new Page(panel, title, icon_idx));
|
||||||
|
// page->SetBackgroundStyle(wxBG_STYLE_SYSTEM);
|
||||||
|
#ifdef __WINDOWS__
|
||||||
|
// page->SetDoubleBuffered(true);
|
||||||
|
#endif //__WINDOWS__
|
||||||
|
|
||||||
page->SetScrollbars(1, 20, 1, 2);
|
page->SetScrollbars(1, 20, 1, 2);
|
||||||
page->Hide();
|
page->Hide();
|
||||||
m_hsizer->Add(page.get(), 1, wxEXPAND | wxLEFT, 5);
|
m_hsizer->Add(page.get(), 1, wxEXPAND | wxLEFT, 5);
|
||||||
@ -318,7 +330,7 @@ void Tab::OnActivate()
|
|||||||
|
|
||||||
void Tab::update_labels_colour()
|
void Tab::update_labels_colour()
|
||||||
{
|
{
|
||||||
Freeze();
|
// Freeze();
|
||||||
//update options "decoration"
|
//update options "decoration"
|
||||||
for (const auto opt : m_options_list)
|
for (const auto opt : m_options_list)
|
||||||
{
|
{
|
||||||
@ -345,7 +357,7 @@ void Tab::update_labels_colour()
|
|||||||
if (field == nullptr) continue;
|
if (field == nullptr) continue;
|
||||||
field->set_label_colour_force(color);
|
field->set_label_colour_force(color);
|
||||||
}
|
}
|
||||||
Thaw();
|
// Thaw();
|
||||||
|
|
||||||
auto cur_item = m_treectrl->GetFirstVisibleItem();
|
auto cur_item = m_treectrl->GetFirstVisibleItem();
|
||||||
while (cur_item) {
|
while (cur_item) {
|
||||||
@ -389,7 +401,7 @@ void Tab::update_changed_ui()
|
|||||||
for (auto opt_key : dirty_options) m_options_list[opt_key] &= ~osInitValue;
|
for (auto opt_key : dirty_options) m_options_list[opt_key] &= ~osInitValue;
|
||||||
for (auto opt_key : nonsys_options) m_options_list[opt_key] &= ~osSystemValue;
|
for (auto opt_key : nonsys_options) m_options_list[opt_key] &= ~osSystemValue;
|
||||||
|
|
||||||
Freeze();
|
// Freeze();
|
||||||
//update options "decoration"
|
//update options "decoration"
|
||||||
for (const auto opt : m_options_list)
|
for (const auto opt : m_options_list)
|
||||||
{
|
{
|
||||||
@ -439,7 +451,7 @@ void Tab::update_changed_ui()
|
|||||||
field->set_undo_to_sys_tooltip(sys_tt);
|
field->set_undo_to_sys_tooltip(sys_tt);
|
||||||
field->set_label_colour(color);
|
field->set_label_colour(color);
|
||||||
}
|
}
|
||||||
Thaw();
|
// Thaw();
|
||||||
|
|
||||||
wxTheApp->CallAfter([this]() {
|
wxTheApp->CallAfter([this]() {
|
||||||
update_changed_tree_ui();
|
update_changed_tree_ui();
|
||||||
@ -686,16 +698,16 @@ void Tab::load_config(const DynamicPrintConfig& config)
|
|||||||
// Reload current $self->{config} (aka $self->{presets}->edited_preset->config) into the UI fields.
|
// Reload current $self->{config} (aka $self->{presets}->edited_preset->config) into the UI fields.
|
||||||
void Tab::reload_config()
|
void Tab::reload_config()
|
||||||
{
|
{
|
||||||
Freeze();
|
// Freeze();
|
||||||
for (auto page : m_pages)
|
for (auto page : m_pages)
|
||||||
page->reload_config();
|
page->reload_config();
|
||||||
Thaw();
|
// Thaw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tab::update_visibility()
|
void Tab::update_visibility()
|
||||||
{
|
{
|
||||||
const ConfigOptionMode mode = wxGetApp().get_mode();
|
const ConfigOptionMode mode = wxGetApp().get_mode();
|
||||||
Freeze();
|
// Freeze();
|
||||||
|
|
||||||
for (auto page : m_pages)
|
for (auto page : m_pages)
|
||||||
page->update_visibility(mode);
|
page->update_visibility(mode);
|
||||||
@ -705,7 +717,7 @@ void Tab::update_visibility()
|
|||||||
m_mode_sizer->SetMode(mode);
|
m_mode_sizer->SetMode(mode);
|
||||||
|
|
||||||
Layout();
|
Layout();
|
||||||
Thaw();
|
// Thaw();
|
||||||
|
|
||||||
// to update tree items color
|
// to update tree items color
|
||||||
// wxTheApp->CallAfter([this]() {
|
// wxTheApp->CallAfter([this]() {
|
||||||
@ -1180,7 +1192,7 @@ void TabPrint::update()
|
|||||||
// return; // ! TODO Let delete this part of code after a common aplication testing
|
// return; // ! TODO Let delete this part of code after a common aplication testing
|
||||||
|
|
||||||
m_update_cnt++;
|
m_update_cnt++;
|
||||||
Freeze();
|
// Freeze();
|
||||||
|
|
||||||
double fill_density = m_config->option<ConfigOptionPercent>("fill_density")->value;
|
double fill_density = m_config->option<ConfigOptionPercent>("fill_density")->value;
|
||||||
|
|
||||||
@ -1391,7 +1403,7 @@ void TabPrint::update()
|
|||||||
m_recommended_thin_wall_thickness_description_line->SetText(
|
m_recommended_thin_wall_thickness_description_line->SetText(
|
||||||
from_u8(PresetHints::recommended_thin_wall_thickness(*m_preset_bundle)));
|
from_u8(PresetHints::recommended_thin_wall_thickness(*m_preset_bundle)));
|
||||||
|
|
||||||
Thaw();
|
// Thaw();
|
||||||
m_update_cnt--;
|
m_update_cnt--;
|
||||||
|
|
||||||
if (m_update_cnt==0)
|
if (m_update_cnt==0)
|
||||||
@ -1566,7 +1578,7 @@ void TabFilament::update()
|
|||||||
return; // ys_FIXME
|
return; // ys_FIXME
|
||||||
|
|
||||||
m_update_cnt++;
|
m_update_cnt++;
|
||||||
Freeze();
|
// Freeze();
|
||||||
wxString text = from_u8(PresetHints::cooling_description(m_presets->get_edited_preset()));
|
wxString text = from_u8(PresetHints::cooling_description(m_presets->get_edited_preset()));
|
||||||
m_cooling_description_line->SetText(text);
|
m_cooling_description_line->SetText(text);
|
||||||
text = from_u8(PresetHints::maximum_volumetric_flow_description(*m_preset_bundle));
|
text = from_u8(PresetHints::maximum_volumetric_flow_description(*m_preset_bundle));
|
||||||
@ -1580,7 +1592,7 @@ void TabFilament::update()
|
|||||||
|
|
||||||
for (auto el : { "min_fan_speed", "disable_fan_first_layers" })
|
for (auto el : { "min_fan_speed", "disable_fan_first_layers" })
|
||||||
get_field(el)->toggle(fan_always_on);
|
get_field(el)->toggle(fan_always_on);
|
||||||
Thaw();
|
// Thaw();
|
||||||
m_update_cnt--;
|
m_update_cnt--;
|
||||||
|
|
||||||
if (m_update_cnt == 0)
|
if (m_update_cnt == 0)
|
||||||
@ -2261,7 +2273,7 @@ void TabPrinter::update()
|
|||||||
|
|
||||||
void TabPrinter::update_fff()
|
void TabPrinter::update_fff()
|
||||||
{
|
{
|
||||||
Freeze();
|
// Freeze();
|
||||||
|
|
||||||
bool en;
|
bool en;
|
||||||
auto serial_speed = get_field("serial_speed");
|
auto serial_speed = get_field("serial_speed");
|
||||||
@ -2360,7 +2372,7 @@ void TabPrinter::update_fff()
|
|||||||
(have_multiple_extruders && toolchange_retraction);
|
(have_multiple_extruders && toolchange_retraction);
|
||||||
}
|
}
|
||||||
|
|
||||||
Thaw();
|
// Thaw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabPrinter::update_sla()
|
void TabPrinter::update_sla()
|
||||||
@ -2674,7 +2686,7 @@ void Tab::OnTreeSelChange(wxTreeEvent& event)
|
|||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
std::unique_ptr<wxWindowUpdateLocker> no_updates(new wxWindowUpdateLocker(this));
|
std::unique_ptr<wxWindowUpdateLocker> no_updates(new wxWindowUpdateLocker(this));
|
||||||
#else
|
#else
|
||||||
wxWindowUpdateLocker noUpdates(this);
|
// wxWindowUpdateLocker noUpdates(this);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (m_pages.empty())
|
if (m_pages.empty())
|
||||||
@ -2694,17 +2706,22 @@ void Tab::OnTreeSelChange(wxTreeEvent& event)
|
|||||||
if (page == nullptr) return;
|
if (page == nullptr) return;
|
||||||
|
|
||||||
for (auto& el : m_pages)
|
for (auto& el : m_pages)
|
||||||
|
// if (el.get()->IsShown()) {
|
||||||
el.get()->Hide();
|
el.get()->Hide();
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
no_updates.reset(nullptr);
|
no_updates.reset(nullptr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
update_undo_buttons();
|
||||||
page->Show();
|
page->Show();
|
||||||
|
// if (! page->layout_valid) {
|
||||||
|
page->layout_valid = true;
|
||||||
m_hsizer->Layout();
|
m_hsizer->Layout();
|
||||||
Refresh();
|
Refresh();
|
||||||
|
// }
|
||||||
update_undo_buttons();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tab::OnKeyDown(wxKeyEvent& event)
|
void Tab::OnKeyDown(wxKeyEvent& event)
|
||||||
@ -3040,6 +3057,7 @@ ConfigOptionsGroupShp Page::new_optgroup(const wxString& title, int noncommon_la
|
|||||||
}
|
}
|
||||||
// auto bmp = new wxStaticBitmap(parent, wxID_ANY, bmp_name.empty() ? wxNullBitmap : wxBitmap(from_u8(var(bmp_name)), wxBITMAP_TYPE_PNG));
|
// auto bmp = new wxStaticBitmap(parent, wxID_ANY, bmp_name.empty() ? wxNullBitmap : wxBitmap(from_u8(var(bmp_name)), wxBITMAP_TYPE_PNG));
|
||||||
auto bmp = new wxStaticBitmap(parent, wxID_ANY, bmp_name.empty() ? wxNullBitmap : create_scaled_bitmap(bmp_name));
|
auto bmp = new wxStaticBitmap(parent, wxID_ANY, bmp_name.empty() ? wxNullBitmap : create_scaled_bitmap(bmp_name));
|
||||||
|
bmp->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||||
return bmp;
|
return bmp;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -65,6 +65,9 @@ public:
|
|||||||
bool m_is_modified_values{ false };
|
bool m_is_modified_values{ false };
|
||||||
bool m_is_nonsys_values{ true };
|
bool m_is_nonsys_values{ true };
|
||||||
|
|
||||||
|
// Delayed layout after resizing the main window.
|
||||||
|
bool layout_valid = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::vector <ConfigOptionsGroupShp> m_optgroups;
|
std::vector <ConfigOptionsGroupShp> m_optgroups;
|
||||||
DynamicPrintConfig* m_config;
|
DynamicPrintConfig* m_config;
|
||||||
|
Loading…
Reference in New Issue
Block a user