First prototype of adding of UI for frequently changed parameters

This commit is contained in:
YuSanka 2018-03-09 18:34:30 +01:00
parent d5e136a6d5
commit e8adbd7303
4 changed files with 45 additions and 0 deletions

View File

@ -394,6 +394,7 @@ sub new {
}
my $frequently_changed_parameters_sizer = Wx::BoxSizer->new(wxHORIZONTAL);
Slic3r::GUI::add_frequently_changed_parameters($self, $frequently_changed_parameters_sizer, $presets);
my $object_info_sizer;
{

View File

@ -604,4 +604,40 @@ wxWindow *get_widget_by_id(int id)
return window;
}
void add_frequently_changed_parameters(wxWindow* parent, wxBoxSizer* sizer, wxFlexGridSizer* preset_sizer)
{
DynamicPrintConfig* config = &g_PresetBundle->prints.get_edited_preset().config;
m_optgroup = std::make_shared<ConfigOptionsGroup>(parent, "", config);
//preset_sizer->RecalcSizes();
const wxArrayInt& ar = preset_sizer->GetColWidths();
m_optgroup->label_width = 90;//ar.IsEmpty() ? 90 : ar.front();
m_optgroup->m_on_change = [](t_config_option_key opt_key, boost::any value){
int i=0;// m_values[opt_key] = boost::any_cast<bool>(value) ? "1" : "0";
};
m_optgroup->append_single_option_line("fill_density");
ConfigOptionDef def;
def.label = L("Support");
def.type = coString;
def.gui_type = "select_open";
def.tooltip = L("Select what kind of support do you need");
def.enum_labels.push_back(L("None"));
def.enum_labels.push_back(L("Support on build plate only"));
def.enum_labels.push_back(L("Everywhere"));
def.default_value = new ConfigOptionString(L("None"));
Option option(def, "support");
m_optgroup->append_single_option_line(option);
def.label = L("Brim");
def.type = coBool;
def.tooltip = L("This flag enables the brim that will be printed around each object on the first layer.");
def.default_value = new ConfigOptionBool{ false }; // 1;
def.gui_type = "";
option = Option(def, "brim");
m_optgroup->append_single_option_line(option);
sizer->Add(m_optgroup->sizer, 0, wxEXPAND | wxBOTTOM | wxBottom, 1);
}
} }

View File

@ -17,6 +17,7 @@ class wxArrayString;
class wxArrayLong;
class wxColour;
class wxBoxSizer;
class wxFlexGridSizer;
namespace Slic3r {
@ -127,6 +128,8 @@ wxString from_u8(const std::string &str);
wxWindow *get_widget_by_id(int id);
void add_frequently_changed_parameters(wxWindow* parent, wxBoxSizer* sizer, wxFlexGridSizer* preset_sizer);
}
}

View File

@ -62,3 +62,8 @@ void open_preferences_dialog(int preferences_event)
void set_preset_bundle(PresetBundle *preset_bundle)
%code%{ Slic3r::GUI::set_preset_bundle(preset_bundle); %};
void add_frequently_changed_parameters(SV *ui_parent, SV *ui_sizer, SV *ui_p_sizer)
%code%{ Slic3r::GUI::add_frequently_changed_parameters((wxWindow*)wxPli_sv_2_object(aTHX_ ui_parent, "Wx::Window"),
(wxBoxSizer*)wxPli_sv_2_object(aTHX_ ui_sizer, "Wx::BoxSizer"),
(wxFlexGridSizer*)wxPli_sv_2_object(aTHX_ ui_p_sizer, "Wx::FlexGridSizer")); %};