File wildcards now include an extension of a file provided

as a default. This is useful for the G-code or SLA export,
as one may chose his own file extension for the export file.
This commit is contained in:
bubnikv 2018-12-06 17:32:49 +01:00
parent ce6937c725
commit fbbfcf70d3
5 changed files with 38 additions and 26 deletions
src/slic3r/GUI

View file

@ -446,7 +446,7 @@ void MainFrame::quick_slice(const int qs)
if (!(qs & qsReslice)) {
auto dlg = new wxFileDialog(this, _(L("Choose a file to slice (STL/OBJ/AMF/3MF/PRUSA):")),
wxGetApp().app_config->get_last_dir(), "",
file_wildcards[FT_MODEL], wxFD_OPEN | wxFD_FILE_MUST_EXIST);
file_wildcards(FT_MODEL), wxFD_OPEN | wxFD_FILE_MUST_EXIST);
if (dlg->ShowModal() != wxID_OK) {
dlg->Destroy();
return;
@ -505,7 +505,7 @@ void MainFrame::quick_slice(const int qs)
// output_file = ~s / \.[gG][cC][oO][dD][eE]$ / .svg /;
auto dlg = new wxFileDialog(this, _(L("Save ")) + (qs & qsExportSVG ? _(L("SVG")) : _(L("G-code"))) + _(L(" file as:")),
wxGetApp().app_config->get_last_output_dir(get_dir_name(output_file)), get_base_name(input_file),
qs & qsExportSVG ? file_wildcards[FT_SVG] : file_wildcards[FT_GCODE],
qs & qsExportSVG ? file_wildcards(FT_SVG) : file_wildcards(FT_GCODE),
wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
if (dlg->ShowModal() != wxID_OK) {
dlg->Destroy();
@ -574,7 +574,7 @@ void MainFrame::repair_stl()
{
auto dlg = new wxFileDialog(this, _(L("Select the STL file to repair:")),
wxGetApp().app_config->get_last_dir(), "",
file_wildcards[FT_STL], wxFD_OPEN | wxFD_FILE_MUST_EXIST);
file_wildcards(FT_STL), wxFD_OPEN | wxFD_FILE_MUST_EXIST);
if (dlg->ShowModal() != wxID_OK) {
dlg->Destroy();
return;
@ -588,7 +588,7 @@ void MainFrame::repair_stl()
// output_file = ~s / \.[sS][tT][lL]$ / _fixed.obj / ;
auto dlg = new wxFileDialog( this, L("Save OBJ file (less prone to coordinate errors than STL) as:"),
get_dir_name(output_file), get_base_name(output_file),
file_wildcards[FT_OBJ], wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
file_wildcards(FT_OBJ), wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
if (dlg->ShowModal() != wxID_OK) {
dlg->Destroy();
return /*undef*/;
@ -618,7 +618,7 @@ void MainFrame::export_config()
auto dlg = new wxFileDialog(this, _(L("Save configuration as:")),
!m_last_config.IsEmpty() ? get_dir_name(m_last_config) : wxGetApp().app_config->get_last_dir(),
!m_last_config.IsEmpty() ? get_base_name(m_last_config) : "config.ini",
file_wildcards[FT_INI], wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
file_wildcards(FT_INI), wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
wxString file;
if (dlg->ShowModal() == wxID_OK)
file = dlg->GetPath();
@ -669,7 +669,7 @@ void MainFrame::export_configbundle()
auto dlg = new wxFileDialog(this, _(L("Save presets bundle as:")),
!m_last_config.IsEmpty() ? get_dir_name(m_last_config) : wxGetApp().app_config->get_last_dir(),
"Slic3r_config_bundle.ini",
file_wildcards[FT_INI], wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
file_wildcards(FT_INI), wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
wxString file;
if (dlg->ShowModal() == wxID_OK)
file = dlg->GetPath();
@ -695,7 +695,7 @@ void MainFrame::load_configbundle(wxString file/* = wxEmptyString, const bool re
if (file.IsEmpty()) {
auto dlg = new wxFileDialog(this, _(L("Select configuration to load:")),
!m_last_config.IsEmpty() ? get_dir_name(m_last_config) : wxGetApp().app_config->get_last_dir(),
"config.ini", file_wildcards[FT_INI], wxFD_OPEN | wxFD_FILE_MUST_EXIST);
"config.ini", file_wildcards(FT_INI), wxFD_OPEN | wxFD_FILE_MUST_EXIST);
if (dlg->ShowModal() != wxID_OK)
return;
file = dlg->GetPath();