Work in progress: Good bye, Perl Threads!

This commit is contained in:
bubnikv 2018-03-23 11:41:20 +01:00
parent 86b79f89ad
commit e931f75010
31 changed files with 833 additions and 1069 deletions

View file

@ -47,6 +47,8 @@
#include "Preferences.hpp"
#include "PresetBundle.hpp"
#include "../../libslic3r/Print.hpp"
namespace Slic3r { namespace GUI {
#if __APPLE__
@ -172,6 +174,7 @@ void break_to_debugger()
wxApp *g_wxApp = nullptr;
wxFrame *g_wxMainFrame = nullptr;
wxNotebook *g_wxTabPanel = nullptr;
wxPanel *g_wxPlater = nullptr;
AppConfig *g_AppConfig = nullptr;
PresetBundle *g_PresetBundle= nullptr;
@ -197,6 +200,11 @@ void set_tab_panel(wxNotebook *tab_panel)
g_wxTabPanel = tab_panel;
}
void set_plater(wxPanel *plater)
{
g_wxPlater = plater;
}
void set_app_config(AppConfig *app_config)
{
g_AppConfig = app_config;
@ -507,6 +515,18 @@ void warning_catcher(wxWindow* parent, wxString message){
msg->ShowModal();
}
// Assign a Lambda to the print object to emit a wxWidgets Command with the provided ID
// to deliver a progress status message.
void set_print_callback_event(Print *print, int id)
{
print->set_status_callback([id](int percent, const std::string &message){
wxCommandEvent event(id);
event.SetInt(percent);
event.SetString(message);
wxQueueEvent(g_wxMainFrame, event.Clone());
});
}
wxApp* get_app(){
return g_wxApp;
}