2015-12-04 20:25:45 +00:00
|
|
|
#ifndef slic3r_GUI_hpp_
|
|
|
|
#define slic3r_GUI_hpp_
|
|
|
|
|
2017-11-02 15:21:34 +00:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
2018-01-07 17:41:40 +00:00
|
|
|
#include "Config.hpp"
|
2018-06-15 23:21:25 +00:00
|
|
|
#include "GUI_ObjectParts.hpp"
|
2017-11-02 15:21:34 +00:00
|
|
|
|
2018-06-07 20:10:23 +00:00
|
|
|
#include <wx/intl.h>
|
|
|
|
#include <wx/string.h>
|
|
|
|
|
2017-12-04 09:48:40 +00:00
|
|
|
class wxApp;
|
2018-02-07 10:37:15 +00:00
|
|
|
class wxWindow;
|
2017-12-04 09:48:40 +00:00
|
|
|
class wxFrame;
|
|
|
|
class wxMenuBar;
|
|
|
|
class wxNotebook;
|
2018-02-02 11:38:35 +00:00
|
|
|
class wxComboCtrl;
|
2018-02-07 16:13:52 +00:00
|
|
|
class wxString;
|
2018-02-08 09:58:13 +00:00
|
|
|
class wxArrayString;
|
|
|
|
class wxArrayLong;
|
2018-03-02 08:08:11 +00:00
|
|
|
class wxColour;
|
2018-03-09 16:17:51 +00:00
|
|
|
class wxBoxSizer;
|
2018-03-09 17:34:30 +00:00
|
|
|
class wxFlexGridSizer;
|
2018-04-03 20:07:59 +00:00
|
|
|
class wxButton;
|
2018-03-22 12:49:48 +00:00
|
|
|
class wxFileDialog;
|
2018-05-18 09:39:49 +00:00
|
|
|
class wxStaticBitmap;
|
2018-05-24 14:57:35 +00:00
|
|
|
class wxFont;
|
2017-12-04 09:48:40 +00:00
|
|
|
|
2017-12-22 10:50:28 +00:00
|
|
|
namespace Slic3r {
|
|
|
|
|
|
|
|
class PresetBundle;
|
2018-01-05 14:11:33 +00:00
|
|
|
class PresetCollection;
|
2018-01-03 09:12:42 +00:00
|
|
|
class AppConfig;
|
2018-04-16 14:52:11 +00:00
|
|
|
class PresetUpdater;
|
2018-01-07 17:41:40 +00:00
|
|
|
class DynamicPrintConfig;
|
2018-01-23 10:37:19 +00:00
|
|
|
class TabIface;
|
2018-06-22 10:27:56 +00:00
|
|
|
class _3DScene;
|
2017-12-22 10:50:28 +00:00
|
|
|
|
2018-06-20 16:33:46 +00:00
|
|
|
#define _(s) Slic3r::GUI::I18N::translate((s))
|
|
|
|
|
|
|
|
namespace GUI { namespace I18N {
|
|
|
|
inline wxString translate(const char *s) { return wxGetTranslation(wxString(s, wxConvUTF8)); }
|
|
|
|
inline wxString translate(const wchar_t *s) { return wxGetTranslation(s); }
|
|
|
|
inline wxString translate(const std::string &s) { return wxGetTranslation(wxString(s.c_str(), wxConvUTF8)); }
|
|
|
|
inline wxString translate(const std::wstring &s) { return wxGetTranslation(s.c_str()); }
|
|
|
|
} }
|
2018-06-07 20:10:23 +00:00
|
|
|
|
2018-02-23 08:16:35 +00:00
|
|
|
// !!! If you needed to translate some wxString,
|
|
|
|
// !!! please use _(L(string))
|
|
|
|
// !!! _() - is a standard wxWidgets macro to translate
|
|
|
|
// !!! L() is used only for marking localizable string
|
|
|
|
// !!! It will be used in "xgettext" to create a Locating Message Catalog.
|
|
|
|
#define L(s) s
|
|
|
|
|
2018-02-22 10:34:41 +00:00
|
|
|
//! macro used to localization, return wxScopedCharBuffer
|
|
|
|
//! With wxConvUTF8 explicitly specify that the source string is already in UTF-8 encoding
|
2018-02-23 08:16:35 +00:00
|
|
|
#define _CHB(s) wxGetTranslation(wxString(s, wxConvUTF8)).utf8_str()
|
2018-02-07 16:13:52 +00:00
|
|
|
|
2018-02-28 14:39:20 +00:00
|
|
|
// Minimal buffer length for translated string (char buf[MIN_BUF_LENGTH_FOR_L])
|
2018-03-02 08:08:11 +00:00
|
|
|
#define MIN_BUF_LENGTH_FOR_L 512
|
2018-02-28 14:39:20 +00:00
|
|
|
|
2017-12-22 10:50:28 +00:00
|
|
|
namespace GUI {
|
|
|
|
|
2018-01-05 14:11:33 +00:00
|
|
|
class Tab;
|
2018-03-12 15:52:21 +00:00
|
|
|
class ConfigOptionsGroup;
|
2018-01-30 11:13:55 +00:00
|
|
|
// Map from an file_type name to full file wildcard name.
|
|
|
|
typedef std::map<std::string, std::string> t_file_wild_card;
|
|
|
|
inline t_file_wild_card& get_file_wild_card() {
|
|
|
|
static t_file_wild_card FILE_WILDCARDS;
|
|
|
|
if (FILE_WILDCARDS.empty()){
|
2018-07-09 14:42:31 +00:00
|
|
|
FILE_WILDCARDS["known"] = "Known files (*.stl, *.obj, *.amf, *.xml, *.prusa)|*.stl;*.STL;*.obj;*.OBJ;*.amf;*.AMF;*.xml;*.XML;*.prusa;*.PRUSA";
|
|
|
|
FILE_WILDCARDS["stl"] = "STL files (*.stl)|*.stl;*.STL";
|
|
|
|
FILE_WILDCARDS["obj"] = "OBJ files (*.obj)|*.obj;*.OBJ";
|
|
|
|
FILE_WILDCARDS["amf"] = "AMF files (*.amf)|*.zip.amf;*.amf;*.AMF;*.xml;*.XML";
|
|
|
|
FILE_WILDCARDS["3mf"] = "3MF files (*.3mf)|*.3mf;*.3MF;";
|
|
|
|
FILE_WILDCARDS["prusa"] = "Prusa Control files (*.prusa)|*.prusa;*.PRUSA";
|
|
|
|
FILE_WILDCARDS["ini"] = "INI files *.ini|*.ini;*.INI";
|
2018-01-30 11:13:55 +00:00
|
|
|
FILE_WILDCARDS["gcode"] = "G-code files (*.gcode, *.gco, *.g, *.ngc)|*.gcode;*.GCODE;*.gco;*.GCO;*.g;*.G;*.ngc;*.NGC";
|
2018-07-09 14:42:31 +00:00
|
|
|
FILE_WILDCARDS["svg"] = "SVG files *.svg|*.svg;*.SVG";
|
2018-01-30 11:13:55 +00:00
|
|
|
}
|
|
|
|
return FILE_WILDCARDS;
|
|
|
|
}
|
2015-12-04 20:25:45 +00:00
|
|
|
|
|
|
|
void disable_screensaver();
|
|
|
|
void enable_screensaver();
|
2016-04-13 18:45:44 +00:00
|
|
|
bool debugged();
|
|
|
|
void break_to_debugger();
|
2015-12-04 20:25:45 +00:00
|
|
|
|
2017-12-04 09:48:40 +00:00
|
|
|
// Passing the wxWidgets GUI classes instantiated by the Perl part to C++.
|
|
|
|
void set_wxapp(wxApp *app);
|
|
|
|
void set_main_frame(wxFrame *main_frame);
|
|
|
|
void set_tab_panel(wxNotebook *tab_panel);
|
2018-02-20 07:58:46 +00:00
|
|
|
void set_app_config(AppConfig *app_config);
|
2018-03-09 16:17:51 +00:00
|
|
|
void set_preset_bundle(PresetBundle *preset_bundle);
|
2018-04-16 14:52:11 +00:00
|
|
|
void set_preset_updater(PresetUpdater *updater);
|
2018-06-22 10:27:56 +00:00
|
|
|
void set_3DScene(_3DScene *scene);
|
2018-05-17 12:07:50 +00:00
|
|
|
void set_objects_from_perl( wxWindow* parent,
|
|
|
|
wxBoxSizer *frequently_changed_parameters_sizer,
|
2018-05-17 08:46:32 +00:00
|
|
|
wxBoxSizer *expert_mode_part_sizer,
|
|
|
|
wxBoxSizer *scrolled_window_sizer,
|
2018-05-27 20:12:01 +00:00
|
|
|
wxButton *btn_export_gcode,
|
2018-05-17 08:46:32 +00:00
|
|
|
wxButton *btn_export_stl,
|
|
|
|
wxButton *btn_reslice,
|
|
|
|
wxButton *btn_print,
|
2018-05-18 09:39:49 +00:00
|
|
|
wxButton *btn_send_gcode,
|
|
|
|
wxStaticBitmap *manifold_warning_icon);
|
2018-05-17 12:07:50 +00:00
|
|
|
void set_show_print_info(bool show);
|
2018-05-18 09:39:49 +00:00
|
|
|
void set_show_manifold_warning_icon(bool show);
|
2018-07-04 10:38:34 +00:00
|
|
|
void set_objects_list_sizer(wxBoxSizer *objects_list_sizer);
|
2017-12-04 09:48:40 +00:00
|
|
|
|
2018-06-15 23:21:25 +00:00
|
|
|
AppConfig* get_app_config();
|
|
|
|
wxApp* get_app();
|
|
|
|
PresetBundle* get_preset_bundle();
|
|
|
|
wxFrame* get_main_frame();
|
2018-07-04 06:54:30 +00:00
|
|
|
wxNotebook * get_tab_panel();
|
2018-04-09 12:41:55 +00:00
|
|
|
|
2018-04-30 12:20:33 +00:00
|
|
|
const wxColour& get_label_clr_modified();
|
|
|
|
const wxColour& get_label_clr_sys();
|
|
|
|
const wxColour& get_label_clr_default();
|
2018-04-09 12:41:55 +00:00
|
|
|
unsigned get_colour_approx_luma(const wxColour &colour);
|
2018-04-30 12:20:33 +00:00
|
|
|
void set_label_clr_modified(const wxColour& clr);
|
|
|
|
void set_label_clr_sys(const wxColour& clr);
|
2017-12-04 09:48:40 +00:00
|
|
|
|
2018-05-24 14:57:35 +00:00
|
|
|
const wxFont& small_font();
|
|
|
|
const wxFont& bold_font();
|
|
|
|
|
2018-06-14 13:33:42 +00:00
|
|
|
void open_model(wxWindow *parent, wxArrayString& input_files);
|
|
|
|
|
2018-06-15 23:21:25 +00:00
|
|
|
wxWindow* get_right_panel();
|
2018-07-04 10:38:34 +00:00
|
|
|
const size_t& label_width();
|
2018-06-13 14:39:33 +00:00
|
|
|
|
2018-05-04 14:04:43 +00:00
|
|
|
extern void add_menus(wxMenuBar *menu, int event_preferences_changed, int event_language_change);
|
2018-04-11 10:21:15 +00:00
|
|
|
|
|
|
|
// This is called when closing the application, when loading a config file or when starting the config wizard
|
|
|
|
// to notify the user whether he is aware that some preset changes will be lost.
|
|
|
|
extern bool check_unsaved_changes();
|
2018-02-22 10:12:29 +00:00
|
|
|
|
2018-04-24 16:06:42 +00:00
|
|
|
// Checks if configuration wizard needs to run, calls config_wizard if so.
|
|
|
|
// Returns whether the Wizard ran.
|
|
|
|
extern bool config_wizard_startup(bool app_config_exists);
|
2018-04-16 14:52:11 +00:00
|
|
|
|
|
|
|
// Opens the configuration wizard, returns true if wizard is finished & accepted.
|
2018-04-24 16:06:42 +00:00
|
|
|
// The run_reason argument is actually ConfigWizard::RunReason, but int is used here because of Perl.
|
|
|
|
extern void config_wizard(int run_reason);
|
2018-03-13 11:39:57 +00:00
|
|
|
|
2018-02-22 10:12:29 +00:00
|
|
|
// Create "Preferences" dialog after selecting menu "Preferences" in Perl part
|
2018-04-11 10:21:15 +00:00
|
|
|
extern void open_preferences_dialog(int event_preferences);
|
2018-02-22 10:12:29 +00:00
|
|
|
|
2017-12-22 10:50:28 +00:00
|
|
|
// Create a new preset tab (print, filament and printer),
|
2018-03-15 17:06:26 +00:00
|
|
|
void create_preset_tabs(bool no_controller, int event_value_change, int event_presets_changed);
|
2018-01-23 10:37:19 +00:00
|
|
|
TabIface* get_preset_tab_iface(char *name);
|
|
|
|
|
2017-12-04 09:48:40 +00:00
|
|
|
// add it at the end of the tab panel.
|
2018-03-09 16:17:51 +00:00
|
|
|
void add_created_tab(Tab* panel);
|
2018-01-07 17:41:40 +00:00
|
|
|
// Change option value in config
|
2018-04-13 10:35:04 +00:00
|
|
|
void change_opt_value(DynamicPrintConfig& config, const t_config_option_key& opt_key, const boost::any& value, int opt_index = 0);
|
2017-12-22 10:50:28 +00:00
|
|
|
|
2018-06-06 08:52:19 +00:00
|
|
|
// Update UI / Tabs to reflect changes in the currently loaded presets
|
|
|
|
void load_current_presets();
|
|
|
|
|
2018-04-13 10:35:04 +00:00
|
|
|
void show_error(wxWindow* parent, const wxString& message);
|
2018-04-30 12:31:57 +00:00
|
|
|
void show_error_id(int id, const std::string& message); // For Perl
|
2018-04-13 10:35:04 +00:00
|
|
|
void show_info(wxWindow* parent, const wxString& message, const wxString& title);
|
|
|
|
void warning_catcher(wxWindow* parent, const wxString& message);
|
2017-12-22 10:50:28 +00:00
|
|
|
|
2018-02-08 09:58:13 +00:00
|
|
|
// load language saved at application config
|
|
|
|
bool load_language();
|
|
|
|
// save language at application config
|
2018-02-12 07:57:32 +00:00
|
|
|
void save_language();
|
2018-02-08 09:58:13 +00:00
|
|
|
// get list of installed languages
|
|
|
|
void get_installed_languages(wxArrayString & names, wxArrayLong & identifiers);
|
|
|
|
// select language from the list of installed languages
|
|
|
|
bool select_language(wxArrayString & names, wxArrayLong & identifiers);
|
2018-05-21 12:49:31 +00:00
|
|
|
// update right panel of the Plater according to view mode
|
|
|
|
void update_mode();
|
2017-12-04 09:48:40 +00:00
|
|
|
|
2018-02-09 10:04:34 +00:00
|
|
|
std::vector<Tab *>& get_tabs_list();
|
|
|
|
bool checked_tab(Tab* tab);
|
|
|
|
void delete_tab_from_list(Tab* tab);
|
2017-12-04 09:48:40 +00:00
|
|
|
|
2018-02-02 11:38:35 +00:00
|
|
|
// Creates a wxCheckListBoxComboPopup inside the given wxComboCtrl, filled with the given text and items.
|
|
|
|
// Items are all initialized to the given value.
|
|
|
|
// Items must be separated by '|', for example "Item1|Item2|Item3", and so on.
|
|
|
|
void create_combochecklist(wxComboCtrl* comboCtrl, std::string text, std::string items, bool initial_value);
|
|
|
|
|
|
|
|
// Returns the current state of the items listed in the wxCheckListBoxComboPopup contained in the given wxComboCtrl,
|
|
|
|
// encoded inside an int.
|
|
|
|
int combochecklist_get_flags(wxComboCtrl* comboCtrl);
|
|
|
|
|
2018-02-22 10:34:41 +00:00
|
|
|
// Return translated std::string as a wxString
|
2018-03-06 08:44:53 +00:00
|
|
|
wxString L_str(const std::string &str);
|
2018-02-22 10:34:41 +00:00
|
|
|
// Return wxString from std::string in UTF8
|
2018-03-06 08:44:53 +00:00
|
|
|
wxString from_u8(const std::string &str);
|
2018-02-22 10:34:41 +00:00
|
|
|
|
2018-06-12 17:15:03 +00:00
|
|
|
void add_expert_mode_part( wxWindow* parent, wxBoxSizer* sizer,
|
2018-07-24 10:15:36 +00:00
|
|
|
Model &model,
|
2018-06-12 17:15:03 +00:00
|
|
|
int event_object_selection_changed,
|
2018-07-04 06:54:30 +00:00
|
|
|
int event_object_settings_changed,
|
2018-07-26 08:59:03 +00:00
|
|
|
int event_remove_object,
|
|
|
|
int event_update_scene);
|
2018-03-09 17:34:30 +00:00
|
|
|
void add_frequently_changed_parameters(wxWindow* parent, wxBoxSizer* sizer, wxFlexGridSizer* preset_sizer);
|
2018-05-17 08:46:32 +00:00
|
|
|
// Update view mode according to selected menu
|
|
|
|
void update_mode();
|
2018-06-15 23:21:25 +00:00
|
|
|
bool is_expert_mode();
|
2018-03-09 17:34:30 +00:00
|
|
|
|
2018-06-15 23:21:25 +00:00
|
|
|
ConfigOptionsGroup* get_optgroup(size_t i);
|
|
|
|
std::vector <std::shared_ptr<ConfigOptionsGroup>>& get_optgroups();
|
2018-04-03 20:07:59 +00:00
|
|
|
wxButton* get_wiping_dialog_button();
|
2018-03-12 15:52:21 +00:00
|
|
|
|
2018-03-22 12:49:48 +00:00
|
|
|
void add_export_option(wxFileDialog* dlg, const std::string& format);
|
|
|
|
int get_export_option(wxFileDialog* dlg);
|
2018-04-09 15:03:37 +00:00
|
|
|
|
2018-06-11 16:24:13 +00:00
|
|
|
// Returns the dimensions of the screen on which the main frame is displayed
|
|
|
|
void get_current_screen_size(unsigned &width, unsigned &height);
|
|
|
|
|
2018-04-09 15:03:37 +00:00
|
|
|
// Display an About dialog
|
2018-05-21 19:04:03 +00:00
|
|
|
extern void about();
|
|
|
|
// Ask the destop to open the datadir using the default file explorer.
|
|
|
|
extern void desktop_open_datadir_folder();
|
2018-04-09 15:03:37 +00:00
|
|
|
|
|
|
|
} // namespace GUI
|
|
|
|
} // namespace Slic3r
|
2015-12-04 20:25:45 +00:00
|
|
|
|
|
|
|
#endif
|