PrusaSlicer-NonPlainar/src/slic3r/GUI/GUI_App.hpp

102 lines
3.0 KiB
C++
Raw Normal View History

2018-09-20 06:40:22 +00:00
#ifndef slic3r_GUI_App_hpp_
#define slic3r_GUI_App_hpp_
#include <string>
// #include <vector>
#include "PrintConfig.hpp"
2018-09-20 06:40:22 +00:00
// #include "../../libslic3r/Utils.hpp"
// #include "GUI.hpp"
#include <wx/app.h>
#include <mutex>
#include <stack>
class wxMenuItem;
class wxMenuBar;
2018-09-20 06:40:22 +00:00
class wxTopLevelWindow;
class wxNotebook;
2018-09-20 06:40:22 +00:00
namespace Slic3r {
class AppConfig;
class PresetBundle;
class PresetUpdater;
namespace GUI
{
enum ConfigMenuIDs {
ConfigMenuWizard,
ConfigMenuSnapshots,
ConfigMenuTakeSnapshot,
ConfigMenuUpdate,
ConfigMenuPreferences,
ConfigMenuModeSimple,
ConfigMenuModeExpert,
ConfigMenuLanguage,
ConfigMenuFlashFirmware,
ConfigMenuCnt,
};
2018-09-20 06:40:22 +00:00
class MainFrame;
class Tab;
2018-09-20 06:40:22 +00:00
class GUI_App : public wxApp
{
bool no_plater{ true };
bool app_conf_exists{ false };
// Lock to guard the callback stack
std::mutex callback_register;
// callbacks registered to run during idle event.
std::stack<std::function<void()>> m_cb{};
public:
bool OnInit() override;
GUI_App() : wxApp() {}
void recreate_GUI();
void system_info();
2018-09-20 11:12:35 +00:00
void open_model(wxWindow *parent, wxArrayString& input_files);
2018-09-20 06:40:22 +00:00
static bool catch_error(std::function<void()> cb,
// wxMessageDialog* message_dialog,
const std::string& err);
// void notify(/*message*/);
void update_ui_from_settings();
void CallAfter(std::function<void()> cb);
wxMenuItem* append_menu_item( wxMenu* menu,
int id,
const wxString& string,
const wxString& description,
const std::string& icon,
std::function<void(wxCommandEvent& event)> cb,
wxItemKind kind = wxITEM_NORMAL);
wxMenuItem* append_submenu( wxMenu* menu,
wxMenu* sub_menu,
int id,
const wxString& string,
const wxString& description,
const std::string& icon);
void save_window_pos(wxTopLevelWindow* window, const std::string& name);
void restore_window_pos(wxTopLevelWindow* window, const std::string& name);
bool load_language();
ConfigMenuIDs get_view_mode();
void add_config_menu(wxMenuBar *menu);
bool check_unsaved_changes();
// Tab* get_tab(const std::string& name);
2018-09-20 06:40:22 +00:00
AppConfig* app_config{ nullptr };
PresetBundle* preset_bundle{ nullptr };
PresetUpdater* preset_updater{ nullptr };
MainFrame* mainframe{ nullptr };
wxNotebook* tab_panel() const ;
std::vector<Tab *> tabs_list;
2018-09-20 06:40:22 +00:00
};
DECLARE_APP(GUI_App)
2018-09-20 06:40:22 +00:00
} // GUI
} //Slic3r
#endif // slic3r_GUI_App_hpp_