mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-08 00:01:09 +00:00
* Remove Unused Project Includes and Forward-Declare Where a Type Is Only Referenced Generated with include-what-you-use and applied conservatively. Only OrcaSlicer's own headers, the ones under src/ and tests/, are removed or forward-declared; standard-library and third-party includes are left alone. An include is removed only when both the Release and the Debug configuration leave it unused, never from inside a conditional block, and never from a file with platform-specific blocks, which only gain includes. Files whose only use of a header sits behind a feature or debug macro (libvgcode's OpenGL ES and marker code, the ARACHNE/TESTS_EXPORT_SVGS debug output) keep their includes. clonable_ptr.hpp gains #pragma once; it had no include guard and was only safe while Config.hpp was its sole includer. * Remove Unused Project Includes From Files With Platform-Specific Code A Linux include-what-you-use run cannot see the code inside _WIN32, __APPLE__ or __linux__ blocks, so its verdict is only taken where nothing the removed header declares, directly or through what it includes, is named inside those blocks. Removals also have to hold in both the Release and Debug configuration and never touch a line inside a conditional block. * Restore the libslic3r Precompiled Header and Direct Includes Lost in the Platform Pass The platform-file pass treated pchheader.hpp as an ordinary header and emptied it, and left GUI_Preview.hpp and 14 other files relying on headers they no longer reached directly. * Restore MainFrame.hpp in ParamsDialog.cpp for the Windows-Only Reparent Call * Include Headers That Files Reached Through Ones the Cleanup Removed * Drop Includes Duplicated by the Cleanup or by Main's Own Additions * Leave PreciseSeam.cpp as Main Has It After the Precise Seam Rework
212 lines
5.9 KiB
C++
212 lines
5.9 KiB
C++
#ifndef slic3r_GUI_Preview_hpp_
|
|
#define slic3r_GUI_Preview_hpp_
|
|
|
|
#include <vector>
|
|
#include "libslic3r/libslic3r.h"
|
|
#include <functional>
|
|
#include <wx/event.h>
|
|
#include <wx/panel.h>
|
|
|
|
#include "libslic3r/CustomGCode.hpp"
|
|
|
|
//BBS: add print base
|
|
|
|
#include <string>
|
|
#include <wx/window.h>
|
|
|
|
class wxDropTarget;
|
|
class wxSizeEvent;
|
|
class wxWindow;
|
|
namespace Slic3r { class PrintBase; }
|
|
namespace Slic3r { struct GCodeProcessorResult; }
|
|
|
|
class wxGLCanvas;
|
|
class wxBoxSizer;
|
|
class wxStaticText;
|
|
class wxComboBox;
|
|
class wxComboCtrl;
|
|
class wxCheckBox;
|
|
|
|
namespace Slic3r {
|
|
|
|
class DynamicPrintConfig;
|
|
class Print;
|
|
class BackgroundSlicingProcess;
|
|
class Model;
|
|
|
|
namespace GUI {
|
|
|
|
class GLCanvas3D;
|
|
class GLToolbar;
|
|
class Bed3D;
|
|
struct Camera;
|
|
class Plater;
|
|
#ifdef _WIN32
|
|
class BitmapComboBox;
|
|
#endif
|
|
|
|
class View3D : public wxPanel
|
|
{
|
|
wxGLCanvas* m_canvas_widget;
|
|
GLCanvas3D* m_canvas;
|
|
|
|
public:
|
|
View3D(wxWindow* parent, Bed3D& bed, Model* model, DynamicPrintConfig* config, BackgroundSlicingProcess* process);
|
|
virtual ~View3D();
|
|
|
|
wxGLCanvas* get_wxglcanvas() { return m_canvas_widget; }
|
|
GLCanvas3D* get_canvas3d() { return m_canvas; }
|
|
|
|
void set_as_dirty();
|
|
void bed_shape_changed();
|
|
void plates_count_changed();
|
|
|
|
void select_view(const std::string& direction);
|
|
|
|
//BBS
|
|
void select_curr_plate_all();
|
|
void select_object_from_idx(std::vector<int> &object_idxs);
|
|
void remove_curr_plate_all();
|
|
|
|
void select_all();
|
|
void deselect_all();
|
|
void exit_gizmo();
|
|
void delete_selected();
|
|
void center_selected();
|
|
void drop_selected();
|
|
void center_selected_plate(const int plate_idx);
|
|
void mirror_selection(Axis axis);
|
|
|
|
bool is_layers_editing_enabled() const;
|
|
bool is_layers_editing_allowed() const;
|
|
void enable_layers_editing(bool enable);
|
|
|
|
bool is_dragging() const;
|
|
bool is_reload_delayed() const;
|
|
|
|
void reload_scene(bool refresh_immediately, bool force_full_scene_refresh = false);
|
|
void render();
|
|
|
|
private:
|
|
bool init(wxWindow* parent, Bed3D& bed, Model* model, DynamicPrintConfig* config, BackgroundSlicingProcess* process);
|
|
};
|
|
|
|
class Preview : public wxPanel
|
|
{
|
|
wxGLCanvas* m_canvas_widget { nullptr };
|
|
GLCanvas3D* m_canvas { nullptr };
|
|
DynamicPrintConfig* m_config;
|
|
BackgroundSlicingProcess* m_process;
|
|
GCodeProcessorResult* m_gcode_result;
|
|
|
|
// Calling this function object forces Plater::schedule_background_process.
|
|
std::function<void()> m_schedule_background_process;
|
|
|
|
unsigned int m_number_extruders { 1 };
|
|
bool m_keep_current_preview_type{ false };
|
|
|
|
//bool m_loaded { false };
|
|
//BBS: add logic for preview print
|
|
const Slic3r::PrintBase* m_loaded_print { nullptr };
|
|
//BBS: add only gcode mode
|
|
bool m_only_gcode { false };
|
|
bool m_reload_paint_after_background_process_apply{false};
|
|
|
|
public:
|
|
enum class OptionType : unsigned int
|
|
{
|
|
Travel,
|
|
Wipe,
|
|
Retractions,
|
|
Unretractions,
|
|
Seams,
|
|
ToolChanges,
|
|
ColorChanges,
|
|
PausePrints,
|
|
CustomGCodes,
|
|
Shells,
|
|
ToolMarker,
|
|
Legend
|
|
};
|
|
|
|
Preview(wxWindow* parent, Bed3D& bed, Model* model, DynamicPrintConfig* config, BackgroundSlicingProcess* process,
|
|
GCodeProcessorResult* gcode_result, std::function<void()> schedule_background_process = []() {});
|
|
virtual ~Preview();
|
|
|
|
//BBS: update gcode_result
|
|
void update_gcode_result(GCodeProcessorResult* gcode_result);
|
|
|
|
wxGLCanvas* get_wxglcanvas() { return m_canvas_widget; }
|
|
GLCanvas3D* get_canvas3d() { return m_canvas; }
|
|
|
|
void set_as_dirty();
|
|
|
|
void bed_shape_changed();
|
|
void select_view(const std::string& direction);
|
|
void set_drop_target(wxDropTarget* target);
|
|
|
|
//BBS: add only gcode mode
|
|
void load_print(bool keep_z_range = false, bool only_gcode = false);
|
|
void reload_print(bool only_gcode = false);
|
|
//BBS: always load shell at preview
|
|
void load_shells(const Print& print, bool force_previewing = false);
|
|
void reset_shells();
|
|
|
|
void msw_rescale();
|
|
void sys_color_changed();
|
|
|
|
//BBS: add m_loaded_print logic
|
|
bool is_loaded() const { return (m_loaded_print != nullptr); }
|
|
//BBS
|
|
void on_tick_changed(CustomGCode::Type type);
|
|
|
|
void show_sliders(bool show = true);
|
|
void show_moves_sliders(bool show = true);
|
|
void show_layers_sliders(bool show = true);
|
|
void set_reload_paint_after_background_process_apply(bool flag) { m_reload_paint_after_background_process_apply = flag; }
|
|
bool get_reload_paint_after_background_process_apply() { return m_reload_paint_after_background_process_apply; }
|
|
|
|
private:
|
|
bool init(wxWindow* parent, Bed3D& bed, Model* model);
|
|
|
|
void bind_event_handlers();
|
|
void unbind_event_handlers();
|
|
void on_size(wxSizeEvent& evt);
|
|
// Create/Update/Reset double slider on 3dPreview
|
|
void check_layers_slider_values(std::vector<CustomGCode::Item>& ticks_from_model,
|
|
const std::vector<double>& layers_z);
|
|
|
|
void update_layers_slider(const std::vector<double>& layers_z, bool keep_z_range = false);
|
|
void update_layers_slider_mode();
|
|
//BBS: add only gcode mode
|
|
void load_print_as_fff(bool keep_z_range = false, bool only_gcode = false);
|
|
};
|
|
|
|
|
|
class AssembleView : public wxPanel
|
|
{
|
|
wxGLCanvas* m_canvas_widget{ nullptr };
|
|
GLCanvas3D* m_canvas{ nullptr };
|
|
public:
|
|
AssembleView(wxWindow* parent, Bed3D& bed, Model* model, DynamicPrintConfig* config, BackgroundSlicingProcess* process);
|
|
~AssembleView();
|
|
|
|
wxGLCanvas* get_wxglcanvas() { return m_canvas_widget; }
|
|
GLCanvas3D* get_canvas3d() { return m_canvas; }
|
|
|
|
void set_as_dirty();
|
|
void render();
|
|
|
|
bool is_reload_delayed() const;
|
|
void reload_scene(bool refresh_immediately, bool force_full_scene_refresh = false);
|
|
void select_view(const std::string& direction);
|
|
|
|
private:
|
|
bool init(wxWindow* parent, Bed3D& bed, Model* model, DynamicPrintConfig* config, BackgroundSlicingProcess* process);
|
|
};
|
|
|
|
} // namespace GUI
|
|
} // namespace Slic3r
|
|
|
|
#endif // slic3r_GUI_Preview_hpp_
|