2018-09-18 11:35:05 +00:00
|
|
|
#ifndef slic3r_GUI_Preview_hpp_
|
|
|
|
#define slic3r_GUI_Preview_hpp_
|
|
|
|
|
|
|
|
#include <wx/panel.h>
|
|
|
|
#include "../../libslic3r/Point.hpp"
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
class wxNotebook;
|
|
|
|
class wxGLCanvas;
|
|
|
|
class wxBoxSizer;
|
|
|
|
class wxStaticText;
|
|
|
|
class wxChoice;
|
|
|
|
class wxComboCtrl;
|
|
|
|
class wxCheckBox;
|
2018-10-05 21:29:15 +00:00
|
|
|
class PrusaDoubleSlider;
|
2018-09-18 11:35:05 +00:00
|
|
|
|
|
|
|
namespace Slic3r {
|
|
|
|
|
|
|
|
class DynamicPrintConfig;
|
|
|
|
class Print;
|
2018-11-22 14:29:59 +00:00
|
|
|
class BackgroundSlicingProcess;
|
2018-09-18 11:35:05 +00:00
|
|
|
class GCodePreviewData;
|
|
|
|
|
|
|
|
namespace GUI {
|
|
|
|
|
2018-11-23 11:47:32 +00:00
|
|
|
class GLCanvas3D;
|
|
|
|
|
2018-09-18 11:35:05 +00:00
|
|
|
class Preview : public wxPanel
|
|
|
|
{
|
2018-11-23 11:47:32 +00:00
|
|
|
wxGLCanvas* m_canvas_widget;
|
|
|
|
GLCanvas3D* m_canvas;
|
2018-09-18 11:35:05 +00:00
|
|
|
wxBoxSizer* m_double_slider_sizer;
|
|
|
|
wxStaticText* m_label_view_type;
|
|
|
|
wxChoice* m_choice_view_type;
|
|
|
|
wxStaticText* m_label_show_features;
|
|
|
|
wxComboCtrl* m_combochecklist_features;
|
|
|
|
wxCheckBox* m_checkbox_travel;
|
|
|
|
wxCheckBox* m_checkbox_retractions;
|
|
|
|
wxCheckBox* m_checkbox_unretractions;
|
|
|
|
wxCheckBox* m_checkbox_shells;
|
|
|
|
|
|
|
|
DynamicPrintConfig* m_config;
|
2018-11-22 14:29:59 +00:00
|
|
|
BackgroundSlicingProcess* m_process;
|
2018-09-18 11:35:05 +00:00
|
|
|
GCodePreviewData* m_gcode_preview_data;
|
|
|
|
|
2018-11-12 14:35:58 +00:00
|
|
|
// Calling this function object forces Plater::schedule_background_process.
|
|
|
|
std::function<void()> m_schedule_background_process;
|
|
|
|
|
2018-09-18 11:35:05 +00:00
|
|
|
unsigned int m_number_extruders;
|
|
|
|
std::string m_preferred_color_mode;
|
|
|
|
|
|
|
|
bool m_loaded;
|
|
|
|
bool m_enabled;
|
|
|
|
bool m_force_sliders_full_range;
|
|
|
|
|
2018-10-05 21:29:15 +00:00
|
|
|
PrusaDoubleSlider* m_slider {nullptr};
|
|
|
|
|
2018-09-18 11:35:05 +00:00
|
|
|
public:
|
2018-11-22 14:29:59 +00:00
|
|
|
Preview(wxNotebook* notebook, DynamicPrintConfig* config, BackgroundSlicingProcess* process, GCodePreviewData* gcode_preview_data, std::function<void()> schedule_background_process = [](){});
|
2018-09-18 11:35:05 +00:00
|
|
|
virtual ~Preview();
|
|
|
|
|
2018-11-23 11:47:32 +00:00
|
|
|
wxGLCanvas* get_wxglcanvas() { return m_canvas_widget; }
|
2018-10-03 12:25:35 +00:00
|
|
|
|
2018-09-18 11:35:05 +00:00
|
|
|
void set_number_extruders(unsigned int number_extruders);
|
|
|
|
void reset_gcode_preview_data();
|
|
|
|
void set_canvas_as_dirty();
|
|
|
|
void set_enabled(bool enabled);
|
|
|
|
void set_bed_shape(const Pointfs& shape);
|
|
|
|
void select_view(const std::string& direction);
|
2018-11-23 11:47:32 +00:00
|
|
|
void set_viewport_from_scene(GLCanvas3D* canvas);
|
|
|
|
void set_viewport_into_scene(GLCanvas3D* canvas);
|
2018-09-18 11:35:05 +00:00
|
|
|
void set_drop_target(wxDropTarget* target);
|
|
|
|
|
|
|
|
void load_print();
|
|
|
|
void reload_print(bool force = false);
|
|
|
|
void refresh_print();
|
2018-10-03 09:34:39 +00:00
|
|
|
|
2018-09-18 11:35:05 +00:00
|
|
|
private:
|
2018-11-22 14:29:59 +00:00
|
|
|
bool init(wxNotebook* notebook, DynamicPrintConfig* config, BackgroundSlicingProcess* process, GCodePreviewData* gcode_preview_data);
|
2018-09-18 11:35:05 +00:00
|
|
|
|
|
|
|
void bind_event_handlers();
|
|
|
|
void unbind_event_handlers();
|
|
|
|
|
|
|
|
void show_hide_ui_elements(const std::string& what);
|
|
|
|
|
|
|
|
void reset_sliders();
|
2018-11-26 15:17:59 +00:00
|
|
|
void update_sliders(const std::vector<double>& layers_z);
|
2018-09-18 11:35:05 +00:00
|
|
|
|
|
|
|
void on_size(wxSizeEvent& evt);
|
|
|
|
void on_choice_view_type(wxCommandEvent& evt);
|
|
|
|
void on_combochecklist_features(wxCommandEvent& evt);
|
|
|
|
void on_checkbox_travel(wxCommandEvent& evt);
|
|
|
|
void on_checkbox_retractions(wxCommandEvent& evt);
|
|
|
|
void on_checkbox_unretractions(wxCommandEvent& evt);
|
|
|
|
void on_checkbox_shells(wxCommandEvent& evt);
|
2018-10-05 21:29:15 +00:00
|
|
|
|
|
|
|
// Create/Update/Reset double slider on 3dPreview
|
|
|
|
void create_double_slider();
|
2018-11-26 15:17:59 +00:00
|
|
|
void update_double_slider(const std::vector<double>& layers_z, bool force_sliders_full_range);
|
|
|
|
void fill_slider_values(std::vector<std::pair<int, double>> &values,
|
2018-10-05 21:29:15 +00:00
|
|
|
const std::vector<double> &layers_z);
|
2018-11-27 14:36:31 +00:00
|
|
|
void set_double_slider_thumbs( const std::vector<double> &layers_z,
|
2018-10-05 21:29:15 +00:00
|
|
|
const double z_low,
|
|
|
|
const double z_high);
|
|
|
|
void reset_double_slider();
|
|
|
|
// update DoubleSlider after keyDown in canvas
|
|
|
|
void update_double_slider_from_canvas(wxKeyEvent& event);
|
2018-11-26 14:16:35 +00:00
|
|
|
|
|
|
|
void load_print_as_fff();
|
|
|
|
void load_print_as_sla();
|
2018-11-27 13:50:57 +00:00
|
|
|
|
|
|
|
void on_sliders_scroll_changed(wxEvent& event);
|
|
|
|
|
2018-09-18 11:35:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace GUI
|
|
|
|
} // namespace Slic3r
|
|
|
|
|
|
|
|
#endif // slic3r_GUI_Preview_hpp_
|