Added prototype of an "Undo to system" button
This commit is contained in:
parent
a41e55a773
commit
c3ec40c3cc
@ -483,8 +483,8 @@ sub new {
|
||||
$right_sizer->Add($print_info_sizer, 0, wxEXPAND, 0);
|
||||
# Callback for showing / hiding the print info box.
|
||||
$self->{"print_info_box_show"} = sub {
|
||||
if ($right_sizer->IsShown(4) != $_[0]) {
|
||||
$right_sizer->Show(4, $_[0]);
|
||||
if ($right_sizer->IsShown(5) != $_[0]) {
|
||||
$right_sizer->Show(5, $_[0]);
|
||||
$self->Layout
|
||||
}
|
||||
};
|
||||
|
@ -19,12 +19,17 @@ namespace Slic3r { namespace GUI {
|
||||
}
|
||||
|
||||
void Field::PostInitialize(){
|
||||
m_Undo_btn = new wxButton(m_parent, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT | wxNO_BORDER);
|
||||
// use bouth of temporary_icons till don't have "undo_icon"
|
||||
auto color = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
|
||||
if (wxMSW) m_Undo_btn->SetBackgroundColour(color);
|
||||
m_Undo_btn = new wxButton(m_parent, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT | wxNO_BORDER);
|
||||
m_Undo_to_sys_btn = new wxButton(m_parent, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT | wxNO_BORDER);
|
||||
if (wxMSW) {
|
||||
m_Undo_btn->SetBackgroundColour(color);
|
||||
m_Undo_to_sys_btn->SetBackgroundColour(color);
|
||||
}
|
||||
m_Undo_btn->SetBitmap(wxBitmap(from_u8(var("bullet_white.png")), wxBITMAP_TYPE_PNG));
|
||||
m_Undo_btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent){ on_back_to_initial_value(); }));
|
||||
m_Undo_to_sys_btn->SetBitmap(wxBitmap(from_u8(var("bullet_white.png")), wxBITMAP_TYPE_PNG));
|
||||
m_Undo_to_sys_btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent){ /*on_back_to_initial_value()*/; }));
|
||||
|
||||
BUILD();
|
||||
}
|
||||
|
@ -89,6 +89,7 @@ public:
|
||||
|
||||
wxStaticText* m_Label = nullptr;
|
||||
wxButton* m_Undo_btn = nullptr;
|
||||
wxButton* m_Undo_to_sys_btn = nullptr;
|
||||
|
||||
/// Fires the enable or disable function, based on the input.
|
||||
inline void toggle(bool en) { en ? enable() : disable(); }
|
||||
|
@ -82,7 +82,10 @@ const t_field& OptionsGroup::build_field(const t_config_option_key& id, const Co
|
||||
if (!this->m_disabled)
|
||||
this->back_to_initial_value(opt_id);
|
||||
};
|
||||
if (!m_is_tab_opt) field->m_Undo_btn->Hide();
|
||||
if (!m_is_tab_opt) {
|
||||
field->m_Undo_btn->Hide();
|
||||
field->m_Undo_to_sys_btn->Hide();
|
||||
}
|
||||
|
||||
// assign function objects for callbacks, etc.
|
||||
return field;
|
||||
@ -112,6 +115,7 @@ void OptionsGroup::append_line(const Line& line) {
|
||||
const auto& option = option_set.front();
|
||||
const auto& field = build_field(option);
|
||||
|
||||
sizer->Add(field->m_Undo_to_sys_btn);
|
||||
sizer->Add(field->m_Undo_btn);
|
||||
if (is_window_field(field))
|
||||
sizer->Add(field->getWindow(), 0, wxEXPAND | wxALL, wxOSX ? 0 : 5);
|
||||
@ -149,6 +153,7 @@ void OptionsGroup::append_line(const Line& line) {
|
||||
const auto& option = option_set.front();
|
||||
const auto& field = build_field(option, label);
|
||||
|
||||
sizer->Add(field->m_Undo_to_sys_btn, 0, wxALIGN_CENTER_VERTICAL);
|
||||
sizer->Add(field->m_Undo_btn, 0, wxALIGN_CENTER_VERTICAL);
|
||||
if (is_window_field(field))
|
||||
sizer->Add(field->getWindow(), 0, (option.opt.full_width ? wxEXPAND : 0) |
|
||||
@ -177,6 +182,7 @@ void OptionsGroup::append_line(const Line& line) {
|
||||
// add field
|
||||
const Option& opt_ref = opt;
|
||||
auto& field = build_field(opt_ref, label);
|
||||
sizer->Add(field->m_Undo_to_sys_btn, 0, wxALIGN_CENTER_VERTICAL);
|
||||
sizer->Add(field->m_Undo_btn, 0, wxALIGN_CENTER_VERTICAL, 0);
|
||||
is_sizer_field(field) ?
|
||||
sizer->Add(field->getSizer(), 0, wxALIGN_CENTER_VERTICAL, 0) :
|
||||
|
@ -191,6 +191,7 @@ void Tab::update_changed_ui()
|
||||
field->m_Label->SetForegroundColour(*get_modified_label_clr());
|
||||
field->m_Label->Refresh(true);
|
||||
}
|
||||
// use bouth of temporary_icons till don't have "undo_icon"
|
||||
field->m_Undo_btn->SetBitmap(wxBitmap(from_u8(wxMSW ? var("action_undo.png") : var("arrow_undo.png")), wxBITMAP_TYPE_PNG));
|
||||
field->m_is_modified_value = true;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user