Merge remote-tracking branch 'origin/3mf_io'

This commit is contained in:
bubnikv 2018-04-04 11:05:29 +02:00
commit 261f391ee3
9 changed files with 96 additions and 29 deletions

View file

@ -686,4 +686,49 @@ ConfigOptionsGroup* get_optgroup()
return m_optgroup.get();
}
wxWindow* export_option_creator(wxWindow* parent)
{
wxPanel* panel = new wxPanel(parent, -1);
wxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
wxCheckBox* cbox = new wxCheckBox(panel, wxID_HIGHEST + 1, L("Export print config"));
sizer->AddSpacer(5);
sizer->Add(cbox, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, 5);
panel->SetSizer(sizer);
sizer->SetSizeHints(panel);
return panel;
}
void add_export_option(wxFileDialog* dlg, const std::string& format)
{
if ((dlg != nullptr) && (format == "AMF") || (format == "3MF"))
{
if (dlg->SupportsExtraControl())
dlg->SetExtraControlCreator(export_option_creator);
}
}
int get_export_option(wxFileDialog* dlg)
{
if (dlg != nullptr)
{
wxWindow* wnd = dlg->GetExtraControl();
if (wnd != nullptr)
{
wxPanel* panel = dynamic_cast<wxPanel*>(wnd);
if (panel != nullptr)
{
wxWindow* child = panel->FindWindow(wxID_HIGHEST + 1);
if (child != nullptr)
{
wxCheckBox* cbox = dynamic_cast<wxCheckBox*>(child);
if (cbox != nullptr)
return cbox->IsChecked() ? 1 : 0;
}
}
}
}
return 0;
}
} }

View file

@ -18,6 +18,7 @@ class wxArrayLong;
class wxColour;
class wxBoxSizer;
class wxFlexGridSizer;
class wxFileDialog;
namespace Slic3r {
@ -130,6 +131,8 @@ void add_frequently_changed_parameters(wxWindow* parent, wxBoxSizer* sizer, wxFl
ConfigOptionsGroup* get_optgroup();
void add_export_option(wxFileDialog* dlg, const std::string& format);
int get_export_option(wxFileDialog* dlg);
}
}