From e86f149cbd0ccb09b4477fb44c87ea39517199ad Mon Sep 17 00:00:00 2001 From: YuSanka Date: Thu, 20 Sep 2018 13:12:35 +0200 Subject: [PATCH] Moved back open_model to GUI_App --- src/slic3r/GUI/GUI.cpp | 2 +- src/slic3r/GUI/GUI_App.cpp | 30 ++++++++++++++++-------------- src/slic3r/GUI/GUI_App.hpp | 1 + 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/slic3r/GUI/GUI.cpp b/src/slic3r/GUI/GUI.cpp index 4201e33f7..80362533f 100644 --- a/src/slic3r/GUI/GUI.cpp +++ b/src/slic3r/GUI/GUI.cpp @@ -545,7 +545,7 @@ void add_menus(wxMenuBar *menu, int event_preferences_changed, int event_languag } void open_model(wxWindow *parent, wxArrayString& input_files){ - auto dialog = new wxFileDialog(parent ? parent : GetTopWindow(), + auto dialog = new wxFileDialog(parent /*? parent : GetTopWindow()*/, _(L("Choose one or more files (STL/OBJ/AMF/3MF/PRUSA):")), g_AppConfig->get_last_dir(), "", MODEL_WILDCARD, wxFD_OPEN | wxFD_MULTIPLE | wxFD_FILE_MUST_EXIST); diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 2c1930a11..f1fa29e14 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include "Utils.hpp" #include "GUI.hpp" @@ -222,20 +223,21 @@ void GUI_App::update_ui_from_settings(){ mainframe->update_ui_from_settings(); } -// wxArrayString GUI::open_model(wxWindow* window){ -// auto dialog = new wxFileDialog(window ? window : GetTopWindow(), -// _(L("Choose one or more files (STL/OBJ/AMF/3MF/PRUSA):")), -// app_config->get_last_dir(), "", get_model_wildcard(), -// wxFD_OPEN | wxFD_MULTIPLE | wxFD_FILE_MUST_EXIST); -// if (dialog->ShowModal() != wxID_OK) { -// dialog->Destroy; -// return; -// } -// wxArrayString input_files; -// dialog->GetPaths(input_files); -// dialog->Destroy(); -// return input_files; -// } + +void GUI_App::open_model(wxWindow *parent, wxArrayString& input_files) +{ + auto dialog = new wxFileDialog(parent ? parent : GetTopWindow(), + _(L("Choose one or more files (STL/OBJ/AMF/3MF/PRUSA):")), + app_config->get_last_dir(), "", + MODEL_WILDCARD, wxFD_OPEN | wxFD_MULTIPLE | wxFD_FILE_MUST_EXIST); + if (dialog->ShowModal() != wxID_OK) { + dialog->Destroy(); + return; + } + + dialog->GetPaths(input_files); + dialog->Destroy(); +} void GUI_App::CallAfter(std::function cb) { diff --git a/src/slic3r/GUI/GUI_App.hpp b/src/slic3r/GUI/GUI_App.hpp index 874c63fde..6f09f03a9 100644 --- a/src/slic3r/GUI/GUI_App.hpp +++ b/src/slic3r/GUI/GUI_App.hpp @@ -42,6 +42,7 @@ public: void recreate_GUI(); void system_info(); + void open_model(wxWindow *parent, wxArrayString& input_files); static bool catch_error(std::function cb, // wxMessageDialog* message_dialog, const std::string& err);