mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-05 20:56:16 +08:00
added file filters to add dialog
This commit is contained in:
parent
404618ecca
commit
a63b3e559b
@ -114,7 +114,7 @@ sub show_error {
|
||||
|
||||
std::vector<wxString> open_model(wxWindow* parent, const Settings& settings, wxWindow* top) {
|
||||
auto dialog {new wxFileDialog((parent != nullptr ? parent : top), _("Choose one or more files") + wxString(" (STL/OBJ/AMF/3MF):"), ".", "",
|
||||
"", wxFD_OPEN | wxFD_MULTIPLE | wxFD_FILE_MUST_EXIST)};
|
||||
MODEL_WILDCARD, wxFD_OPEN | wxFD_MULTIPLE | wxFD_FILE_MUST_EXIST)};
|
||||
if (dialog->ShowModal() != wxID_OK) {
|
||||
dialog->Destroy();
|
||||
return std::vector<wxString>();
|
||||
|
@ -8,6 +8,8 @@
|
||||
|
||||
#include <wx/filename.h>
|
||||
#include <wx/stdpaths.h>
|
||||
#include <map>
|
||||
#include <utility>
|
||||
|
||||
#include "Settings.hpp"
|
||||
|
||||
@ -33,6 +35,23 @@ constexpr bool isDev = true;
|
||||
constexpr bool isDev = false;
|
||||
#endif
|
||||
|
||||
// hopefully the compiler is smart enough to figure this out
|
||||
const std::map<const std::string, const std::string> FILE_WILDCARDS {
|
||||
std::make_pair("known", "Known files (*.stl, *.obj, *.amf, *.xml, *.3mf)|*.3mf;*.3MF;*.stl;*.STL;*.obj;*.OBJ;*.amf;*.AMF;*.xml;*.XML"),
|
||||
std::make_pair("stl", "STL files (*.stl)|*.stl;*.STL"),
|
||||
std::make_pair("obj", "OBJ files (*.obj)|*.obj;*.OBJ"),
|
||||
std::make_pair("amf", "AMF files (*.amf)|*.amf;*.AMF;*.xml;*.XML"),
|
||||
std::make_pair("tmf", "3MF files (*.3mf)|*.3mf;*.3MF"),
|
||||
std::make_pair("ini", "INI files *.ini|*.ini;*.INI"),
|
||||
std::make_pair("gcode", "G-code files (*.gcode, *.gco, *.g, *.ngc)|*.gcode;*.GCODE;*.gco;*.GCO;*.g;*.G;*.ngc;*.NGC"),
|
||||
std::make_pair("svg", "SVG files *.svg|*.svg;*.SVG")
|
||||
};
|
||||
|
||||
const std::string MODEL_WILDCARD { FILE_WILDCARDS.at("known") + std::string("|") + FILE_WILDCARDS.at("stl")+ std::string("|") + FILE_WILDCARDS.at("obj") + std::string("|") + FILE_WILDCARDS.at("amf")+ std::string("|") + FILE_WILDCARDS.at("tmf")};
|
||||
const std::string STL_MODEL_WILDCARD { FILE_WILDCARDS.at("stl") };
|
||||
const std::string AMF_MODEL_WILDCARD { FILE_WILDCARDS.at("amf") };
|
||||
const std::string TMF_MODEL_WILDCARD { FILE_WILDCARDS.at("tmf") };
|
||||
|
||||
|
||||
/// Mostly useful for Linux distro maintainers, this will change where Slic3r assumes
|
||||
/// its ./var directory lives (where its art assets are).
|
||||
|
Loading…
x
Reference in New Issue
Block a user