Refactoring - Shared members of GLCanvas3D as references instead of pointers

This commit is contained in:
Enrico Turri 2019-03-07 11:49:00 +01:00
parent b5217918cf
commit fc70b73f45
9 changed files with 97 additions and 193 deletions

View file

@ -28,7 +28,7 @@ namespace GUI {
class GLCanvas3D;
class GLToolbar;
class Bed3D;
class Camera;
struct Camera;
class View3D : public wxPanel
{
@ -44,17 +44,12 @@ class View3D : public wxPanel
BackgroundSlicingProcess* m_process;
public:
View3D(wxWindow* parent, Model* model, DynamicPrintConfig* config, BackgroundSlicingProcess* process);
View3D(wxWindow* parent, Bed3D& bed, Camera& camera, GLToolbar& view_toolbar, Model* model, DynamicPrintConfig* config, BackgroundSlicingProcess* process);
virtual ~View3D();
wxGLCanvas* get_wxglcanvas() { return m_canvas_widget; }
GLCanvas3D* get_canvas3d() { return m_canvas; }
void set_bed(Bed3D* bed);
void set_camera(Camera* camera);
void set_view_toolbar(GLToolbar* toolbar);
void set_as_dirty();
void bed_shape_changed();
@ -78,7 +73,7 @@ public:
void render();
private:
bool init(wxWindow* parent, Model* model, DynamicPrintConfig* config, BackgroundSlicingProcess* process);
bool init(wxWindow* parent, Bed3D& bed, Camera& camera, GLToolbar& view_toolbar, Model* model, DynamicPrintConfig* config, BackgroundSlicingProcess* process);
};
class Preview : public wxPanel
@ -111,17 +106,12 @@ class Preview : public wxPanel
PrusaDoubleSlider* m_slider {nullptr};
public:
Preview(wxWindow* parent, DynamicPrintConfig* config, BackgroundSlicingProcess* process, GCodePreviewData* gcode_preview_data, std::function<void()> schedule_background_process = [](){});
Preview(wxWindow* parent, Bed3D& bed, Camera& camera, GLToolbar& view_toolbar, DynamicPrintConfig* config, BackgroundSlicingProcess* process, GCodePreviewData* gcode_preview_data, std::function<void()> schedule_background_process = [](){});
virtual ~Preview();
wxGLCanvas* get_wxglcanvas() { return m_canvas_widget; }
GLCanvas3D* get_canvas3d() { return m_canvas; }
void set_bed(Bed3D* bed);
void set_camera(Camera* camera);
void set_view_toolbar(GLToolbar* toolbar);
void set_number_extruders(unsigned int number_extruders);
void set_canvas_as_dirty();
void set_enabled(bool enabled);
@ -134,7 +124,7 @@ public:
void refresh_print();
private:
bool init(wxWindow* parent, DynamicPrintConfig* config, BackgroundSlicingProcess* process, GCodePreviewData* gcode_preview_data);
bool init(wxWindow* parent, Bed3D& bed, Camera& camera, GLToolbar& view_toolbar, DynamicPrintConfig* config, BackgroundSlicingProcess* process, GCodePreviewData* gcode_preview_data);
void bind_event_handlers();
void unbind_event_handlers();