2018-09-17 10:15:11 +00:00
|
|
|
#ifndef slic3r_Plater_hpp_
|
|
|
|
#define slic3r_Plater_hpp_
|
|
|
|
|
|
|
|
#include <memory>
|
2018-10-08 17:14:55 +00:00
|
|
|
#include <vector>
|
2018-10-04 09:12:55 +00:00
|
|
|
#include <boost/filesystem/path.hpp>
|
2018-09-17 10:15:11 +00:00
|
|
|
|
|
|
|
#include <wx/panel.h>
|
2018-10-09 10:41:05 +00:00
|
|
|
#include <wx/bmpcbox.h>
|
2018-09-17 10:15:11 +00:00
|
|
|
|
|
|
|
#include "Preset.hpp"
|
|
|
|
|
2019-02-19 14:15:27 +00:00
|
|
|
#include "3DScene.hpp"
|
|
|
|
#include "GLTexture.hpp"
|
|
|
|
|
2018-10-04 09:12:55 +00:00
|
|
|
class wxButton;
|
2019-04-24 23:45:00 +00:00
|
|
|
class ScalableButton;
|
2018-10-10 11:53:45 +00:00
|
|
|
class wxBoxSizer;
|
2018-10-11 13:57:09 +00:00
|
|
|
class wxGLCanvas;
|
2018-11-09 17:39:07 +00:00
|
|
|
class wxScrolledWindow;
|
2018-11-26 13:41:58 +00:00
|
|
|
class wxString;
|
2018-10-04 09:12:55 +00:00
|
|
|
|
2018-09-17 10:15:11 +00:00
|
|
|
namespace Slic3r {
|
2018-10-04 14:43:10 +00:00
|
|
|
|
|
|
|
class Model;
|
2019-02-21 10:40:56 +00:00
|
|
|
class ModelObject;
|
2018-10-11 11:22:36 +00:00
|
|
|
class Print;
|
2018-11-12 16:35:57 +00:00
|
|
|
class SLAPrint;
|
|
|
|
|
2018-09-17 10:15:11 +00:00
|
|
|
namespace GUI {
|
|
|
|
|
|
|
|
class MainFrame;
|
2018-10-03 13:14:52 +00:00
|
|
|
class ConfigOptionsGroup;
|
2018-10-04 14:43:10 +00:00
|
|
|
class ObjectManipulation;
|
2018-11-09 17:39:07 +00:00
|
|
|
class ObjectSettings;
|
2019-05-28 14:38:04 +00:00
|
|
|
class ObjectLayers;
|
2018-10-05 21:29:15 +00:00
|
|
|
class ObjectList;
|
2018-11-23 11:47:32 +00:00
|
|
|
class GLCanvas3D;
|
2018-10-03 13:14:52 +00:00
|
|
|
|
|
|
|
using t_optgroups = std::vector <std::shared_ptr<ConfigOptionsGroup>>;
|
2018-09-17 10:15:11 +00:00
|
|
|
|
2018-10-04 09:12:55 +00:00
|
|
|
class Plater;
|
2019-03-01 10:00:34 +00:00
|
|
|
enum class ActionButtonType : int;
|
2018-10-04 09:12:55 +00:00
|
|
|
|
2018-10-09 10:41:05 +00:00
|
|
|
class PresetComboBox : public wxBitmapComboBox
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
PresetComboBox(wxWindow *parent, Preset::Type preset_type);
|
|
|
|
~PresetComboBox();
|
|
|
|
|
2019-04-24 23:45:00 +00:00
|
|
|
ScalableButton* edit_btn { nullptr };
|
2019-03-18 14:10:40 +00:00
|
|
|
|
2019-03-22 14:45:51 +00:00
|
|
|
enum LabelItemType {
|
|
|
|
LABEL_ITEM_MARKER = 0x4d,
|
|
|
|
LABEL_ITEM_CONFIG_WIZARD = 0x4e
|
|
|
|
};
|
|
|
|
|
|
|
|
void set_label_marker(int item, LabelItemType label_item_type = LABEL_ITEM_MARKER);
|
2018-10-10 11:53:45 +00:00
|
|
|
void set_extruder_idx(const int extr_idx) { extruder_idx = extr_idx; }
|
|
|
|
int get_extruder_idx() const { return extruder_idx; }
|
2019-04-23 14:33:06 +00:00
|
|
|
int em_unit() const { return m_em_unit; }
|
2018-12-03 14:16:33 +00:00
|
|
|
void check_selection();
|
2018-10-09 10:41:05 +00:00
|
|
|
|
2019-04-24 23:45:00 +00:00
|
|
|
void msw_rescale();
|
2019-04-13 21:46:52 +00:00
|
|
|
|
2018-10-09 10:41:05 +00:00
|
|
|
private:
|
|
|
|
typedef std::size_t Marker;
|
|
|
|
|
|
|
|
Preset::Type preset_type;
|
|
|
|
int last_selected;
|
2018-10-10 11:53:45 +00:00
|
|
|
int extruder_idx = -1;
|
2019-04-23 14:33:06 +00:00
|
|
|
int m_em_unit;
|
2018-10-09 10:41:05 +00:00
|
|
|
};
|
|
|
|
|
2018-09-17 10:15:11 +00:00
|
|
|
class Sidebar : public wxPanel
|
|
|
|
{
|
2019-03-01 11:03:14 +00:00
|
|
|
ConfigOptionMode m_mode;
|
2018-09-17 10:15:11 +00:00
|
|
|
public:
|
2018-10-04 09:12:55 +00:00
|
|
|
Sidebar(Plater *parent);
|
2018-09-17 10:15:11 +00:00
|
|
|
Sidebar(Sidebar &&) = delete;
|
|
|
|
Sidebar(const Sidebar &) = delete;
|
|
|
|
Sidebar &operator=(Sidebar &&) = delete;
|
|
|
|
Sidebar &operator=(const Sidebar &) = delete;
|
|
|
|
~Sidebar();
|
|
|
|
|
2018-10-10 11:53:45 +00:00
|
|
|
void init_filament_combo(PresetComboBox **combo, const int extr_idx);
|
|
|
|
void remove_unused_filament_combos(const int current_extruder_count);
|
2019-04-10 07:56:32 +00:00
|
|
|
void update_all_preset_comboboxes();
|
2018-09-17 10:15:11 +00:00
|
|
|
void update_presets(Slic3r::Preset::Type preset_type);
|
2019-03-01 11:03:14 +00:00
|
|
|
void update_mode_sizer() const;
|
|
|
|
void update_reslice_btn_tooltip() const;
|
2019-04-24 23:45:00 +00:00
|
|
|
void msw_rescale();
|
2018-10-03 13:14:52 +00:00
|
|
|
|
2018-10-09 10:41:05 +00:00
|
|
|
ObjectManipulation* obj_manipul();
|
2018-10-05 21:29:15 +00:00
|
|
|
ObjectList* obj_list();
|
2018-11-09 17:39:07 +00:00
|
|
|
ObjectSettings* obj_settings();
|
2019-05-28 14:38:04 +00:00
|
|
|
ObjectLayers* obj_layers();
|
2018-11-09 17:39:07 +00:00
|
|
|
wxScrolledWindow* scrolled_panel();
|
2019-03-13 12:13:18 +00:00
|
|
|
wxPanel* presets_panel();
|
2018-10-03 13:14:52 +00:00
|
|
|
|
2019-01-15 08:31:53 +00:00
|
|
|
ConfigOptionsGroup* og_freq_chng_params(const bool is_fff);
|
2018-10-03 13:14:52 +00:00
|
|
|
wxButton* get_wiping_dialog_button();
|
2018-10-04 14:43:10 +00:00
|
|
|
void update_objects_list_extruder_column(int extruders_count);
|
2018-11-13 11:19:56 +00:00
|
|
|
void show_info_sizer();
|
2018-10-31 11:26:57 +00:00
|
|
|
void show_sliced_info_sizer(const bool show);
|
2018-10-08 17:14:55 +00:00
|
|
|
void enable_buttons(bool enable);
|
2019-03-01 10:00:34 +00:00
|
|
|
void set_btn_label(const ActionButtonType btn_type, const wxString& label) const;
|
2019-04-24 17:03:05 +00:00
|
|
|
bool show_reslice(bool show) const;
|
|
|
|
bool show_export(bool show) const;
|
|
|
|
bool show_send(bool show) const;
|
2018-10-09 10:41:05 +00:00
|
|
|
bool is_multifilament();
|
2019-03-01 11:03:14 +00:00
|
|
|
void update_mode();
|
2018-10-04 14:43:10 +00:00
|
|
|
|
2018-10-10 11:53:45 +00:00
|
|
|
std::vector<PresetComboBox*>& combos_filament();
|
2018-09-17 10:15:11 +00:00
|
|
|
private:
|
|
|
|
struct priv;
|
|
|
|
std::unique_ptr<priv> p;
|
|
|
|
};
|
|
|
|
|
|
|
|
class Plater: public wxPanel
|
|
|
|
{
|
|
|
|
public:
|
2018-12-11 09:33:11 +00:00
|
|
|
using fs_path = boost::filesystem::path;
|
|
|
|
|
2018-09-17 10:15:11 +00:00
|
|
|
Plater(wxWindow *parent, MainFrame *main_frame);
|
|
|
|
Plater(Plater &&) = delete;
|
|
|
|
Plater(const Plater &) = delete;
|
|
|
|
Plater &operator=(Plater &&) = delete;
|
|
|
|
Plater &operator=(const Plater &) = delete;
|
|
|
|
~Plater();
|
|
|
|
|
|
|
|
Sidebar& sidebar();
|
2018-10-11 11:22:36 +00:00
|
|
|
Model& model();
|
2018-12-03 12:14:28 +00:00
|
|
|
const Print& fff_print() const;
|
|
|
|
Print& fff_print();
|
|
|
|
const SLAPrint& sla_print() const;
|
|
|
|
SLAPrint& sla_print();
|
2018-09-17 10:15:11 +00:00
|
|
|
|
2019-05-14 08:30:14 +00:00
|
|
|
void new_project();
|
2018-11-15 14:27:39 +00:00
|
|
|
void load_project();
|
|
|
|
void add_model();
|
2018-11-16 08:26:41 +00:00
|
|
|
void extract_config_from_project();
|
2018-10-17 10:17:25 +00:00
|
|
|
|
2018-11-16 08:26:41 +00:00
|
|
|
void load_files(const std::vector<boost::filesystem::path>& input_files, bool load_model = true, bool load_config = true);
|
2019-01-09 09:43:17 +00:00
|
|
|
// To be called when providing a list of files to the GUI slic3r on command line.
|
|
|
|
void load_files(const std::vector<std::string>& input_files, bool load_model = true, bool load_config = true);
|
2018-09-17 10:15:11 +00:00
|
|
|
|
2018-11-21 12:32:24 +00:00
|
|
|
void update();
|
2019-05-13 16:58:56 +00:00
|
|
|
void stop_jobs();
|
2018-10-17 10:59:58 +00:00
|
|
|
void select_view(const std::string& direction);
|
2018-12-04 12:55:25 +00:00
|
|
|
void select_view_3D(const std::string& name);
|
2019-01-03 11:59:06 +00:00
|
|
|
|
2018-12-04 10:14:39 +00:00
|
|
|
// Called after the Preferences dialog is closed and the program settings are saved.
|
|
|
|
// Update the UI based on the current preferences.
|
|
|
|
void update_ui_from_settings();
|
2018-10-17 10:59:58 +00:00
|
|
|
|
2018-11-21 14:28:35 +00:00
|
|
|
void select_all();
|
2019-05-14 09:57:39 +00:00
|
|
|
void deselect_all();
|
2018-10-04 09:12:55 +00:00
|
|
|
void remove(size_t obj_idx);
|
2018-11-22 10:31:53 +00:00
|
|
|
void reset();
|
2019-05-02 11:52:13 +00:00
|
|
|
void reset_with_confirm();
|
2018-11-13 13:17:35 +00:00
|
|
|
void delete_object_from_model(size_t obj_idx);
|
2018-10-04 09:12:55 +00:00
|
|
|
void remove_selected();
|
2018-10-18 13:09:41 +00:00
|
|
|
void increase_instances(size_t num = 1);
|
|
|
|
void decrease_instances(size_t num = 1);
|
2018-10-25 19:13:45 +00:00
|
|
|
void set_number_of_copies(/*size_t num*/);
|
2018-11-21 14:47:41 +00:00
|
|
|
bool is_selection_empty() const;
|
2019-05-22 12:42:38 +00:00
|
|
|
void scale_selection_to_fit_print_volume();
|
2018-10-08 17:14:55 +00:00
|
|
|
|
2018-11-26 09:56:07 +00:00
|
|
|
void cut(size_t obj_idx, size_t instance_idx, coordf_t z, bool keep_upper = true, bool keep_lower = true, bool rotate_lower = false);
|
2018-10-18 13:13:38 +00:00
|
|
|
|
2019-02-03 09:41:14 +00:00
|
|
|
void export_gcode();
|
2019-05-02 11:46:39 +00:00
|
|
|
void export_stl(bool extended = false, bool selection_only = false);
|
2018-10-04 09:12:55 +00:00
|
|
|
void export_amf();
|
2018-11-15 14:27:39 +00:00
|
|
|
void export_3mf(const boost::filesystem::path& output_path = boost::filesystem::path());
|
2018-09-17 10:15:11 +00:00
|
|
|
void reslice();
|
2019-02-21 10:40:56 +00:00
|
|
|
void reslice_SLA_supports(const ModelObject &object);
|
2018-10-31 14:41:27 +00:00
|
|
|
void changed_object(int obj_idx);
|
2019-04-15 13:40:40 +00:00
|
|
|
void changed_objects(const std::vector<size_t>& object_idxs);
|
2019-06-26 07:48:52 +00:00
|
|
|
void schedule_background_process(bool schedule = true);
|
|
|
|
bool is_background_process_running() const;
|
|
|
|
void suppress_background_process(const bool stop_background_process) ;
|
2019-01-30 15:27:07 +00:00
|
|
|
void fix_through_netfabb(const int obj_idx, const int vol_idx = -1);
|
2018-10-04 09:12:55 +00:00
|
|
|
void send_gcode();
|
2018-10-10 11:53:45 +00:00
|
|
|
|
2019-07-02 14:42:23 +00:00
|
|
|
void take_snapshot(const std::string &snapshot_name);
|
|
|
|
void take_snapshot(const wxString &snapshot_name);
|
2019-07-04 08:45:41 +00:00
|
|
|
void undo();
|
|
|
|
void redo();
|
2019-07-02 14:42:23 +00:00
|
|
|
|
2018-10-10 11:53:45 +00:00
|
|
|
void on_extruders_change(int extruders_count);
|
2018-10-17 09:12:38 +00:00
|
|
|
void on_config_change(const DynamicPrintConfig &config);
|
2019-02-19 13:57:59 +00:00
|
|
|
// On activating the parent window.
|
|
|
|
void on_activate();
|
2018-10-11 13:57:09 +00:00
|
|
|
|
2018-12-07 16:50:48 +00:00
|
|
|
void update_object_menu();
|
|
|
|
|
2019-05-15 12:09:16 +00:00
|
|
|
wxString get_project_filename(const wxString& extension = wxEmptyString) const;
|
|
|
|
void set_project_filename(const wxString& filename);
|
|
|
|
|
2018-11-15 14:27:39 +00:00
|
|
|
bool is_export_gcode_scheduled() const;
|
|
|
|
|
2018-11-01 11:33:56 +00:00
|
|
|
int get_selected_object_idx();
|
2018-11-13 14:24:05 +00:00
|
|
|
bool is_single_full_object_selection() const;
|
2018-11-23 11:47:32 +00:00
|
|
|
GLCanvas3D* canvas3D();
|
2018-11-12 16:35:57 +00:00
|
|
|
|
2018-12-03 12:14:28 +00:00
|
|
|
PrinterTechnology printer_technology() const;
|
|
|
|
void set_printer_technology(PrinterTechnology printer_technology);
|
|
|
|
|
2019-04-10 06:40:58 +00:00
|
|
|
void copy_selection_to_clipboard();
|
|
|
|
void paste_from_clipboard();
|
|
|
|
|
2019-03-14 12:54:05 +00:00
|
|
|
bool can_delete() const;
|
|
|
|
bool can_delete_all() const;
|
|
|
|
bool can_increase_instances() const;
|
|
|
|
bool can_decrease_instances() const;
|
2019-05-13 12:27:51 +00:00
|
|
|
bool can_set_instance_to_object() const;
|
|
|
|
bool can_fix_through_netfabb() const;
|
2019-03-14 12:54:05 +00:00
|
|
|
bool can_split_to_objects() const;
|
|
|
|
bool can_split_to_volumes() const;
|
|
|
|
bool can_arrange() const;
|
|
|
|
bool can_layers_editing() const;
|
2019-06-24 11:21:05 +00:00
|
|
|
bool can_paste_from_clipboard() const;
|
|
|
|
bool can_copy_to_clipboard() const;
|
2019-07-08 08:57:35 +00:00
|
|
|
bool can_undo() const;
|
|
|
|
bool can_redo() const;
|
2019-03-14 12:54:05 +00:00
|
|
|
|
2019-04-24 23:45:00 +00:00
|
|
|
void msw_rescale();
|
2019-04-16 08:05:45 +00:00
|
|
|
|
2019-07-02 13:49:18 +00:00
|
|
|
const Camera& get_camera() const;
|
|
|
|
|
2018-09-17 10:15:11 +00:00
|
|
|
private:
|
|
|
|
struct priv;
|
|
|
|
std::unique_ptr<priv> p;
|
2019-06-26 07:48:52 +00:00
|
|
|
|
|
|
|
friend class SuppressBackgroundProcessingUpdate;
|
2018-09-17 10:15:11 +00:00
|
|
|
};
|
|
|
|
|
2019-06-26 07:48:52 +00:00
|
|
|
class SuppressBackgroundProcessingUpdate
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SuppressBackgroundProcessingUpdate();
|
|
|
|
~SuppressBackgroundProcessingUpdate();
|
|
|
|
private:
|
|
|
|
bool m_was_running;
|
|
|
|
};
|
2018-09-17 10:15:11 +00:00
|
|
|
|
|
|
|
}}
|
|
|
|
|
|
|
|
#endif
|