Added a button to open purging volumes dialog directly from Plater

This commit is contained in:
Lukas Matena 2018-03-27 13:44:18 +02:00
parent 3fdd182f0c
commit 7d9e892edc

View file

@ -1,4 +1,5 @@
#include "GUI.hpp"
#include "WipeTowerDialog.hpp"
#include <assert.h>
@ -678,6 +679,32 @@ void add_frequently_changed_parameters(wxWindow* parent, wxBoxSizer* sizer, wxFl
option = Option(def, "brim");
m_optgroup->append_single_option_line(option);
Line line = { _(L("")), "" };
line.widget = [config](wxWindow* parent){
auto wiping_dialog_button = new wxButton(parent, wxID_ANY, _(L("Purging volumes"))+"\u2026", wxDefaultPosition, wxDefaultSize, wxBU_LEFT);
auto sizer = new wxBoxSizer(wxHORIZONTAL);
sizer->Add(wiping_dialog_button);
wiping_dialog_button->Bind(wxEVT_BUTTON, ([config, parent](wxCommandEvent& e)
{
std::vector<double> init_matrix = (config->option<ConfigOptionFloats>("wiping_volumes_matrix"))->values;
std::vector<double> init_extruders = (config->option<ConfigOptionFloats>("wiping_volumes_extruders"))->values;
WipingDialog dlg(parent,std::vector<float>(init_matrix.begin(),init_matrix.end()),std::vector<float>(init_extruders.begin(),init_extruders.end()));
if (dlg.ShowModal() == wxID_OK) {
std::vector<float> matrix = dlg.get_matrix();
std::vector<float> extruders = dlg.get_extruders();
(config->option<ConfigOptionFloats>("wiping_volumes_matrix"))->values = std::vector<double>(matrix.begin(),matrix.end());
(config->option<ConfigOptionFloats>("wiping_volumes_extruders"))->values = std::vector<double>(extruders.begin(),extruders.end());
}
}));
return sizer;
};
m_optgroup->append_line(line);
sizer->Add(m_optgroup->sizer, 0, wxEXPAND | wxBOTTOM | wxBottom, 1);
}