diff --git a/src/PrusaSlicer.cpp b/src/PrusaSlicer.cpp index e5c6689be..a28fa3104 100644 --- a/src/PrusaSlicer.cpp +++ b/src/PrusaSlicer.cpp @@ -53,6 +53,8 @@ #include "slic3r/GUI/3DScene.hpp" #include "slic3r/GUI/InstanceCheck.hpp" #include "slic3r/GUI/AppConfig.hpp" + #include "slic3r/GUI/MainFrame.hpp" + #include "slic3r/GUI/Plater.hpp" #endif /* SLIC3R_GUI */ using namespace Slic3r; diff --git a/src/libslic3r/Fill/FillBase.hpp b/src/libslic3r/Fill/FillBase.hpp index 083cb86ce..2e9b64735 100644 --- a/src/libslic3r/Fill/FillBase.hpp +++ b/src/libslic3r/Fill/FillBase.hpp @@ -11,13 +11,13 @@ #include "../libslic3r.h" #include "../BoundingBox.hpp" -#include "../PrintConfig.hpp" #include "../Utils.hpp" namespace Slic3r { class ExPolygon; class Surface; +enum InfillPattern : int; class InfillFailedException : public std::runtime_error { public: diff --git a/src/libslic3r/Model.cpp b/src/libslic3r/Model.cpp index 0f1c346a6..19973cb9b 100644 --- a/src/libslic3r/Model.cpp +++ b/src/libslic3r/Model.cpp @@ -455,24 +455,19 @@ bool Model::looks_like_imperial_units() const if (this->objects.size() == 0) return false; - stl_vertex size = this->objects[0]->get_object_stl_stats().size; + for (ModelObject* obj : this->objects) + if (obj->get_object_stl_stats().volume < 9.0) // 9 = 3*3*3; + return true; - for (ModelObject* o : this->objects) { - auto sz = o->get_object_stl_stats().size; - - if (size[0] < sz[0]) size[0] = sz[0]; - if (size[1] < sz[1]) size[1] = sz[1]; - if (size[2] < sz[2]) size[2] = sz[2]; - } - - return (size[0] < 3 && size[1] < 3 && size[2] < 3); + return false; } void Model::convert_from_imperial_units() { double in_to_mm = 25.4; - for (ModelObject* o : this->objects) - o->scale_mesh_after_creation(Vec3d(in_to_mm, in_to_mm, in_to_mm)); + for (ModelObject* obj : this->objects) + if (obj->get_object_stl_stats().volume < 9.0) // 9 = 3*3*3; + obj->scale_mesh_after_creation(Vec3d(in_to_mm, in_to_mm, in_to_mm)); } void Model::adjust_min_z() @@ -1273,6 +1268,27 @@ void ModelObject::split(ModelObjectPtrs* new_objects) return; } +void ModelObject::merge() +{ + if (this->volumes.size() == 1) { + // We can't merge meshes if there's just one volume + return; + } + + TriangleMesh mesh; + + for (ModelVolume* volume : volumes) + if (!volume->mesh().empty()) + mesh.merge(volume->mesh()); + mesh.repair(); + + this->clear_volumes(); + ModelVolume* vol = this->add_volume(mesh); + + if (!vol) + return; +} + // Support for non-uniform scaling of instances. If an instance is rotated by angles, which are not multiples of ninety degrees, // then the scaling in world coordinate system is not representable by the Geometry::Transformation structure. // This situation is solved by baking in the instance transformation into the mesh vertices. diff --git a/src/libslic3r/Model.hpp b/src/libslic3r/Model.hpp index f7b63bff4..e5930fb8a 100644 --- a/src/libslic3r/Model.hpp +++ b/src/libslic3r/Model.hpp @@ -287,6 +287,7 @@ public: bool needed_repair() const; ModelObjectPtrs cut(size_t instance, coordf_t z, bool keep_upper = true, bool keep_lower = true, bool rotate_lower = false); // Note: z is in world coordinates void split(ModelObjectPtrs* new_objects); + void merge(); // Support for non-uniform scaling of instances. If an instance is rotated by angles, which are not multiples of ninety degrees, // then the scaling in world coordinate system is not representable by the Geometry::Transformation structure. // This situation is solved by baking in the instance transformation into the mesh vertices. diff --git a/src/libslic3r/ModelArrange.cpp b/src/libslic3r/ModelArrange.cpp index 85aa25a5f..230b04de5 100644 --- a/src/libslic3r/ModelArrange.cpp +++ b/src/libslic3r/ModelArrange.cpp @@ -1,4 +1,6 @@ #include "ModelArrange.hpp" + +#include #include "MTUtils.hpp" namespace Slic3r { diff --git a/src/libslic3r/ModelArrange.hpp b/src/libslic3r/ModelArrange.hpp index d65b0fd6d..afe146d43 100644 --- a/src/libslic3r/ModelArrange.hpp +++ b/src/libslic3r/ModelArrange.hpp @@ -1,11 +1,14 @@ #ifndef MODELARRANGE_HPP #define MODELARRANGE_HPP -#include #include namespace Slic3r { +class Model; +class ModelInstance; +using ModelInstancePtrs = std::vector; + using arrangement::ArrangePolygon; using arrangement::ArrangePolygons; using arrangement::ArrangeParams; diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 10ff8086c..4fc3d2d27 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -33,7 +33,7 @@ enum PrintHostType { htOctoPrint, htDuet, htFlashAir, htAstroBox }; -enum InfillPattern { +enum InfillPattern : int { ipRectilinear, ipMonotonous, ipGrid, ipTriangles, ipStars, ipCubic, ipLine, ipConcentric, ipHoneycomb, ip3DHoneycomb, ipGyroid, ipHilbertCurve, ipArchimedeanChords, ipOctagramSpiral, ipCount, }; diff --git a/src/libslic3r/Slicing.hpp b/src/libslic3r/Slicing.hpp index 95cf6891b..2fd609b2c 100644 --- a/src/libslic3r/Slicing.hpp +++ b/src/libslic3r/Slicing.hpp @@ -11,7 +11,6 @@ #include "libslic3r.h" #include "Utils.hpp" -#include "PrintConfig.hpp" namespace Slic3r { @@ -19,6 +18,7 @@ namespace Slic3r class PrintConfig; class PrintObjectConfig; class ModelObject; +class DynamicPrintConfig; // Parameters to guide object slicing and support generation. // The slicing parameters account for a raft and whether the 1st object layer is printed with a normal or a bridging flow diff --git a/src/slic3r/CMakeLists.txt b/src/slic3r/CMakeLists.txt index 5d47f9758..d1227f3c2 100644 --- a/src/slic3r/CMakeLists.txt +++ b/src/slic3r/CMakeLists.txt @@ -95,8 +95,6 @@ set(SLIC3R_GUI_SOURCES GUI/GUI_ObjectSettings.hpp GUI/GUI_ObjectLayers.cpp GUI/GUI_ObjectLayers.hpp - GUI/LambdaObjectDialog.cpp - GUI/LambdaObjectDialog.hpp GUI/MeshUtils.cpp GUI/MeshUtils.hpp GUI/Tab.cpp diff --git a/src/slic3r/GUI/BackgroundSlicingProcess.cpp b/src/slic3r/GUI/BackgroundSlicingProcess.cpp index 32b7b8365..c6d2323de 100644 --- a/src/slic3r/GUI/BackgroundSlicingProcess.cpp +++ b/src/slic3r/GUI/BackgroundSlicingProcess.cpp @@ -1,6 +1,7 @@ #include "BackgroundSlicingProcess.hpp" #include "GUI_App.hpp" #include "GUI.hpp" +#include "MainFrame.hpp" #include #include @@ -36,6 +37,7 @@ #include "RemovableDriveManager.hpp" #include "slic3r/Utils/Thread.hpp" +#include "slic3r/GUI/Plater.hpp" namespace Slic3r { diff --git a/src/slic3r/GUI/BedShapeDialog.cpp b/src/slic3r/GUI/BedShapeDialog.cpp index 4357a371a..f08b1a379 100644 --- a/src/slic3r/GUI/BedShapeDialog.cpp +++ b/src/slic3r/GUI/BedShapeDialog.cpp @@ -1,4 +1,6 @@ #include "BedShapeDialog.hpp" +#include "GUI_App.hpp" +#include "OptionsGroup.hpp" #include #include diff --git a/src/slic3r/GUI/BedShapeDialog.hpp b/src/slic3r/GUI/BedShapeDialog.hpp index bf12cc893..b583eca4a 100644 --- a/src/slic3r/GUI/BedShapeDialog.hpp +++ b/src/slic3r/GUI/BedShapeDialog.hpp @@ -3,7 +3,7 @@ // The bed shape dialog. // The dialog opens from Print Settins tab->Bed Shape : Set... -#include "OptionsGroup.hpp" +#include "GUI_Utils.hpp" #include "2DBed.hpp" #include "I18N.hpp" @@ -13,6 +13,8 @@ namespace Slic3r { namespace GUI { +class ConfigOptionsGroup; + using ConfigOptionsGroupShp = std::shared_ptr; class BedShapePanel : public wxPanel { diff --git a/src/slic3r/GUI/ConfigWizard.cpp b/src/slic3r/GUI/ConfigWizard.cpp index e242033d9..18d8bb312 100644 --- a/src/slic3r/GUI/ConfigWizard.cpp +++ b/src/slic3r/GUI/ConfigWizard.cpp @@ -27,6 +27,7 @@ #include "libslic3r/Utils.hpp" #include "GUI.hpp" +#include "GUI_App.hpp" #include "GUI_Utils.hpp" #include "slic3r/Config/Snapshot.hpp" #include "slic3r/Utils/PresetUpdater.hpp" diff --git a/src/slic3r/GUI/ConfigWizard_private.hpp b/src/slic3r/GUI/ConfigWizard_private.hpp index 49993bfb1..4fa9c472f 100644 --- a/src/slic3r/GUI/ConfigWizard_private.hpp +++ b/src/slic3r/GUI/ConfigWizard_private.hpp @@ -24,6 +24,9 @@ #include "AppConfig.hpp" #include "PresetBundle.hpp" #include "BedShapeDialog.hpp" +#include "GUI.hpp" +#include "wxExtensions.hpp" + namespace fs = boost::filesystem; diff --git a/src/slic3r/GUI/DoubleSlider.cpp b/src/slic3r/GUI/DoubleSlider.cpp index 3374863b8..45e242709 100644 --- a/src/slic3r/GUI/DoubleSlider.cpp +++ b/src/slic3r/GUI/DoubleSlider.cpp @@ -8,6 +8,7 @@ #endif // ENABLE_GCODE_VIEWER #include "GUI.hpp" #include "GUI_App.hpp" +#include "Plater.hpp" #include "I18N.hpp" #include "ExtruderSequenceDialog.hpp" #include "libslic3r/Print.hpp" diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp index 4c7419cea..3a06c3056 100644 --- a/src/slic3r/GUI/Field.cpp +++ b/src/slic3r/GUI/Field.cpp @@ -3,6 +3,8 @@ #include "I18N.hpp" #include "Field.hpp" #include "wxExtensions.hpp" +#include "Plater.hpp" +#include "MainFrame.hpp" #include "libslic3r/PrintConfig.hpp" diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 2b12a8a61..e5dcdd776 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -25,6 +25,8 @@ #include "slic3r/GUI/OpenGLManager.hpp" #include "slic3r/GUI/3DBed.hpp" #include "slic3r/GUI/Camera.hpp" +#include "slic3r/GUI/Plater.hpp" +#include "slic3r/GUI/MainFrame.hpp" #include "GUI_App.hpp" #include "GUI_ObjectList.hpp" diff --git a/src/slic3r/GUI/GLCanvas3D.hpp b/src/slic3r/GUI/GLCanvas3D.hpp index 6551066a9..bba87d07a 100644 --- a/src/slic3r/GUI/GLCanvas3D.hpp +++ b/src/slic3r/GUI/GLCanvas3D.hpp @@ -5,7 +5,6 @@ #include #include -#include "3DScene.hpp" #include "GLToolbar.hpp" #include "Event.hpp" #include "Selection.hpp" diff --git a/src/slic3r/GUI/GLSelectionRectangle.cpp b/src/slic3r/GUI/GLSelectionRectangle.cpp index d1d2b89f1..d7f3f7a3a 100644 --- a/src/slic3r/GUI/GLSelectionRectangle.cpp +++ b/src/slic3r/GUI/GLSelectionRectangle.cpp @@ -3,6 +3,7 @@ #include "3DScene.hpp" #include "GLCanvas3D.hpp" #include "GUI_App.hpp" +#include "Plater.hpp" #include diff --git a/src/slic3r/GUI/GLToolbar.cpp b/src/slic3r/GUI/GLToolbar.cpp index 603cfc3ad..59401b11a 100644 --- a/src/slic3r/GUI/GLToolbar.cpp +++ b/src/slic3r/GUI/GLToolbar.cpp @@ -6,6 +6,7 @@ #include "slic3r/GUI/GLCanvas3D.hpp" #include "slic3r/GUI/GUI_App.hpp" #include "slic3r/GUI/Camera.hpp" +#include "slic3r/GUI/Plater.hpp" #include #include diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 4c53a5b94..3c000f62e 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -37,6 +37,8 @@ #include "AppConfig.hpp" #include "PresetBundle.hpp" #include "3DScene.hpp" +#include "MainFrame.hpp" +#include "Plater.hpp" #include "../Utils/PresetUpdater.hpp" #include "../Utils/PrintHost.hpp" diff --git a/src/slic3r/GUI/GUI_App.hpp b/src/slic3r/GUI/GUI_App.hpp index fdb10ff60..4ddaef844 100644 --- a/src/slic3r/GUI/GUI_App.hpp +++ b/src/slic3r/GUI/GUI_App.hpp @@ -3,8 +3,7 @@ #include #include -#include "libslic3r/PrintConfig.hpp" -#include "MainFrame.hpp" +#include "Preset.hpp" #include "ImGuiWrapper.hpp" #include "ConfigWizard.hpp" #include "OpenGLManager.hpp" @@ -30,11 +29,21 @@ class PresetBundle; class PresetUpdater; class ModelObject; class PrintHostJobQueue; - +class Model; namespace GUI{ class RemovableDriveManager; class OtherInstanceMessageHandler; +class MainFrame; +class Sidebar; +class ObjectManipulation; +class ObjectSettings; +class ObjectList; +class ObjectLayers; +class Plater; + + + enum FileType { FT_STL, diff --git a/src/slic3r/GUI/GUI_ObjectLayers.cpp b/src/slic3r/GUI/GUI_ObjectLayers.cpp index cd65f69fc..b1a5512d4 100644 --- a/src/slic3r/GUI/GUI_ObjectLayers.cpp +++ b/src/slic3r/GUI/GUI_ObjectLayers.cpp @@ -2,9 +2,11 @@ #include "GUI_ObjectList.hpp" #include "OptionsGroup.hpp" +#include "GUI_App.hpp" #include "PresetBundle.hpp" #include "libslic3r/Model.hpp" #include "GLCanvas3D.hpp" +#include "Plater.hpp" #include diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index 35ec2e485..a468c9f93 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -4,13 +4,13 @@ #include "GUI_ObjectLayers.hpp" #include "GUI_App.hpp" #include "I18N.hpp" +#include "Plater.hpp" #include "OptionsGroup.hpp" #include "PresetBundle.hpp" #include "Tab.hpp" #include "wxExtensions.hpp" #include "libslic3r/Model.hpp" -#include "LambdaObjectDialog.hpp" #include "GLCanvas3D.hpp" #include "Selection.hpp" @@ -1781,6 +1781,22 @@ void ObjectList::append_menu_items_convert_unit(wxMenu* menu) [](wxCommandEvent&) { wxGetApp().plater()->convert_unit(false); }, "", menu); } +void ObjectList::append_menu_item_merge_to_multipart_object(wxMenu* menu) +{ + menu->AppendSeparator(); + append_menu_item(menu, wxID_ANY, _L("Merge"), _L("Merge objects to the one multipart object"), + [this](wxCommandEvent&) { merge(true); }, "", menu, + [this]() { return this->can_merge_to_multipart_object(); }, wxGetApp().plater()); +} + +void ObjectList::append_menu_item_merge_to_single_object(wxMenu* menu) +{ + menu->AppendSeparator(); + append_menu_item(menu, wxID_ANY, _L("Merge"), _L("Merge objects to the one single object"), + [this](wxCommandEvent&) { merge(false); }, "", menu, + [this]() { return this->can_merge_to_single_object(); }, wxGetApp().plater()); +} + void ObjectList::create_object_popupmenu(wxMenu *menu) { #ifdef __WXOSX__ @@ -1795,6 +1811,10 @@ void ObjectList::create_object_popupmenu(wxMenu *menu) // Split object to parts append_menu_item_split(menu); +// menu->AppendSeparator(); + + // Merge multipart object to the single object +// append_menu_item_merge_to_single_object(menu); menu->AppendSeparator(); // Layers Editing for object @@ -2365,6 +2385,107 @@ void ObjectList::split() changed_object(obj_idx); } +void ObjectList::merge(bool to_multipart_object) +{ + // merge selected objects to the multipart object + if (to_multipart_object) + { + std::vector obj_idxs; + wxDataViewItemArray sels; + GetSelections(sels); + assert(!sels.IsEmpty()); + + for (wxDataViewItem item : sels) { + const ItemType type = m_objects_model->GetItemType(item); + assert(type & (itObject/* | itInstance*/)); + obj_idxs.emplace_back(type & itObject ? m_objects_model->GetIdByItem(item) : + m_objects_model->GetIdByItem(m_objects_model->GetTopParent(item))); + } + std::sort(obj_idxs.begin(), obj_idxs.end()); + obj_idxs.erase(std::unique(obj_idxs.begin(), obj_idxs.end()), obj_idxs.end()); + + if (obj_idxs.size() <= 1) + return; + + Plater::TakeSnapshot snapshot(wxGetApp().plater(), _L("Merge")); + + Model* model = (*m_objects)[0]->get_model(); + ModelObject* new_object = model->add_object(); + new_object->name = _u8L("Merged"); + DynamicPrintConfig* new_config = &new_object->config; + + const Vec3d& main_offset = (*m_objects)[0]->instances[0]->get_offset(); + + for (int obj_idx : obj_idxs) + { + ModelObject* object = (*m_objects)[obj_idx]; + Vec3d offset = object->instances[0]->get_offset(); + + if (object->id() == (*m_objects)[0]->id()) + new_object->add_instance(*object->instances[0]); + auto new_opt_keys = new_config->keys(); + + const DynamicPrintConfig& from_config = object->config; + auto opt_keys = from_config.keys(); + + // merge settings + for (auto& opt_key : opt_keys) { + if (find(new_opt_keys.begin(), new_opt_keys.end(), opt_key) == new_opt_keys.end()) { + const ConfigOption* option = from_config.option(opt_key); + if (!option) { + // if current option doesn't exist in prints.get_edited_preset(), + // get it from default config values + option = DynamicPrintConfig::new_from_defaults_keys({ opt_key })->option(opt_key); + } + new_config->set_key_value(opt_key, option->clone()); + } + } + + // merge volumes + for (const ModelVolume* volume : object->volumes) { + ModelVolume* new_volume = new_object->add_volume(*volume); + Vec3d vol_offset = offset - main_offset + new_volume->get_offset(); + new_volume->set_offset(vol_offset); + } + // save extruder value if it was set + if (object->volumes.size() == 1 && find(opt_keys.begin(), opt_keys.end(), "extruder") != opt_keys.end()) { + ModelVolume* volume = new_object->volumes.back(); + const ConfigOption* option = from_config.option("extruder"); + if (option) + volume->config.set_key_value("extruder", option->clone()); + } + + // merge layers + for (const auto& range : object->layer_config_ranges) + new_object->layer_config_ranges.emplace(range); + } + // remove selected objects + remove(); + // Add new object(merged) to the object_list + add_object_to_list(m_objects->size() - 1); + } + // merge all parts to the one single object + // all part's settings will be lost + else + { + wxDataViewItem item = GetSelection(); + if (!item) + return; + const int obj_idx = m_objects_model->GetIdByItem(item); + if (obj_idx == -1) + return; + + Plater::TakeSnapshot snapshot(wxGetApp().plater(), _L("Merge all parts to the one single object")); + + ModelObject* model_object = (*m_objects)[obj_idx]; + model_object->merge(); + + m_objects_model->DeleteVolumeChildren(item); + + changed_object(obj_idx); + } +} + void ObjectList::layers_editing() { const Selection& selection = scene_selection(); @@ -2490,6 +2611,31 @@ bool ObjectList::can_split_instances() return selection.is_multiple_full_instance() || selection.is_single_full_instance(); } +bool ObjectList::can_merge_to_multipart_object() const +{ + wxDataViewItemArray sels; + GetSelections(sels); + if (sels.IsEmpty()) + return false; + + // should be selected just objects + for (wxDataViewItem item : sels) + if (!(m_objects_model->GetItemType(item) & (itObject/* | itInstance*/))) + return false; + + return true; +} + +bool ObjectList::can_merge_to_single_object() const +{ + int obj_idx = get_selected_obj_idx(); + if (obj_idx < 0) + return false; + + // selected object should be multipart + return (*m_objects)[obj_idx]->volumes.size() > 1; +} + // NO_PARAMETERS function call means that changed object index will be determine from Selection() void ObjectList::changed_object(const int obj_idx/* = -1*/) const { @@ -4111,6 +4257,7 @@ void ObjectList::show_multi_selection_menu() }, wxGetApp().plater()); append_menu_items_convert_unit(menu); + append_menu_item_merge_to_multipart_object(menu); wxGetApp().plater()->PopupMenu(menu); } diff --git a/src/slic3r/GUI/GUI_ObjectList.hpp b/src/slic3r/GUI/GUI_ObjectList.hpp index 0924d4216..4490ec5e9 100644 --- a/src/slic3r/GUI/GUI_ObjectList.hpp +++ b/src/slic3r/GUI/GUI_ObjectList.hpp @@ -254,6 +254,8 @@ public: void append_menu_item_delete(wxMenu* menu); void append_menu_item_scale_selection_to_fit_print_volume(wxMenu* menu); void append_menu_items_convert_unit(wxMenu* menu); + void append_menu_item_merge_to_multipart_object(wxMenu *menu); + void append_menu_item_merge_to_single_object(wxMenu *menu); void create_object_popupmenu(wxMenu *menu); void create_sla_object_popupmenu(wxMenu*menu); void create_part_popupmenu(wxMenu*menu); @@ -277,6 +279,7 @@ public: void del_layers_from_object(const int obj_idx); bool del_subobject_from_object(const int obj_idx, const int idx, const int type); void split(); + void merge(bool to_multipart_object); void layers_editing(); wxDataViewItem add_layer_root_item(const wxDataViewItem obj_item); @@ -287,6 +290,8 @@ public: bool is_splittable(); bool selected_instances_of_same_object(); bool can_split_instances(); + bool can_merge_to_multipart_object() const; + bool can_merge_to_single_object() const; wxPoint get_mouse_position_in_control() const { return wxGetMousePosition() - this->GetScreenPosition(); } wxBoxSizer* get_sizer() {return m_sizer;} diff --git a/src/slic3r/GUI/GUI_ObjectManipulation.cpp b/src/slic3r/GUI/GUI_ObjectManipulation.cpp index 6a9e2ddc1..2c35fc316 100644 --- a/src/slic3r/GUI/GUI_ObjectManipulation.cpp +++ b/src/slic3r/GUI/GUI_ObjectManipulation.cpp @@ -4,11 +4,14 @@ #include "GLCanvas3D.hpp" #include "OptionsGroup.hpp" +#include "GUI_App.hpp" #include "wxExtensions.hpp" #include "PresetBundle.hpp" #include "libslic3r/Model.hpp" #include "libslic3r/Geometry.hpp" #include "Selection.hpp" +#include "Plater.hpp" +#include "MainFrame.hpp" #include #include "slic3r/Utils/FixModelByWin10.hpp" diff --git a/src/slic3r/GUI/GUI_ObjectSettings.cpp b/src/slic3r/GUI/GUI_ObjectSettings.cpp index 1447e0768..ef78123a4 100644 --- a/src/slic3r/GUI/GUI_ObjectSettings.cpp +++ b/src/slic3r/GUI/GUI_ObjectSettings.cpp @@ -2,8 +2,10 @@ #include "GUI_ObjectList.hpp" #include "OptionsGroup.hpp" +#include "GUI_App.hpp" #include "wxExtensions.hpp" #include "PresetBundle.hpp" +#include "Plater.hpp" #include "libslic3r/Model.hpp" #include diff --git a/src/slic3r/GUI/GUI_Preview.cpp b/src/slic3r/GUI/GUI_Preview.cpp index ea437a215..c673292ef 100644 --- a/src/slic3r/GUI/GUI_Preview.cpp +++ b/src/slic3r/GUI/GUI_Preview.cpp @@ -12,6 +12,7 @@ #include "GLCanvas3D.hpp" #include "PresetBundle.hpp" #include "DoubleSlider.hpp" +#include "Plater.hpp" #include #include diff --git a/src/slic3r/GUI/Gizmos/GLGizmoCut.cpp b/src/slic3r/GUI/Gizmos/GLGizmoCut.cpp index 9382579ea..17c10f485 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoCut.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoCut.cpp @@ -12,6 +12,7 @@ #include #include "slic3r/GUI/GUI_App.hpp" +#include "slic3r/GUI/Plater.hpp" namespace Slic3r { diff --git a/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.cpp b/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.cpp index e90f76fc4..97e2ffed2 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.cpp @@ -8,6 +8,7 @@ #include "slic3r/GUI/GUI_App.hpp" #include "slic3r/GUI/PresetBundle.hpp" #include "slic3r/GUI/Camera.hpp" +#include "slic3r/GUI/Plater.hpp" #include "libslic3r/Model.hpp" diff --git a/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp b/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp index 712311e81..268a15df3 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp @@ -3,6 +3,7 @@ #include "slic3r/GUI/GLCanvas3D.hpp" #include "slic3r/GUI/Camera.hpp" #include "slic3r/GUI/Gizmos/GLGizmosCommon.hpp" +#include "slic3r/GUI/MainFrame.hpp" #include diff --git a/src/slic3r/GUI/Gizmos/GLGizmosCommon.cpp b/src/slic3r/GUI/Gizmos/GLGizmosCommon.cpp index e35750fa0..9dd9c6565 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmosCommon.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmosCommon.cpp @@ -6,6 +6,7 @@ #include "libslic3r/SLAPrint.hpp" #include "slic3r/GUI/GUI_App.hpp" #include "slic3r/GUI/Camera.hpp" +#include "slic3r/GUI/Plater.hpp" #include diff --git a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp index 324c50011..355927fb1 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp @@ -6,6 +6,7 @@ #include "slic3r/GUI/GUI_App.hpp" #include "slic3r/GUI/GUI_ObjectManipulation.hpp" #include "slic3r/GUI/PresetBundle.hpp" +#include "slic3r/GUI/Plater.hpp" #include "slic3r/Utils/UndoRedo.hpp" #include "slic3r/GUI/Gizmos/GLGizmoMove.hpp" diff --git a/src/slic3r/GUI/InstanceCheck.cpp b/src/slic3r/GUI/InstanceCheck.cpp index 4470876c7..d5ecbcd0f 100644 --- a/src/slic3r/GUI/InstanceCheck.cpp +++ b/src/slic3r/GUI/InstanceCheck.cpp @@ -1,5 +1,10 @@ #include "GUI_App.hpp" #include "InstanceCheck.hpp" +#include "Plater.hpp" + +#ifdef _WIN32 + #include "MainFrame.hpp" +#endif #include "libslic3r/Utils.hpp" #include "libslic3r/Config.hpp" diff --git a/src/slic3r/GUI/LambdaObjectDialog.cpp b/src/slic3r/GUI/LambdaObjectDialog.cpp deleted file mode 100644 index 63c8d329c..000000000 --- a/src/slic3r/GUI/LambdaObjectDialog.cpp +++ /dev/null @@ -1,200 +0,0 @@ -#include "LambdaObjectDialog.hpp" - -#include -#include -#include "OptionsGroup.hpp" -#include "I18N.hpp" - -namespace Slic3r -{ -namespace GUI -{ - -LambdaObjectDialog::LambdaObjectDialog(wxWindow* parent, - const wxString type_name): - m_type_name(type_name) -{ - Create(parent, wxID_ANY, _(L("Lambda Object")), - parent->GetScreenPosition(), wxDefaultSize, - wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER); - - // instead of double dim[3] = { 1.0, 1.0, 1.0 }; - object_parameters.dim[0] = 1.0; - object_parameters.dim[1] = 1.0; - object_parameters.dim[2] = 1.0; - - sizer = new wxBoxSizer(wxVERTICAL); - - // modificator options - if (m_type_name == wxEmptyString) { - m_modificator_options_book = new wxChoicebook( this, wxID_ANY, wxDefaultPosition, - wxDefaultSize, wxCHB_TOP); - sizer->Add(m_modificator_options_book, 1, wxEXPAND | wxALL, 10); - } - else { - m_panel = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize); - sizer->Add(m_panel, 1, wxEXPAND | wxALL, 10); - } - - ConfigOptionDef def; - def.width = 70; - auto optgroup = init_modificator_options_page(_(L("Box"))); - if (optgroup) { - optgroup->m_on_change = [this](t_config_option_key opt_key, boost::any value) { - int opt_id = opt_key == "l" ? 0 : - opt_key == "w" ? 1 : - opt_key == "h" ? 2 : -1; - if (opt_id < 0) return; - object_parameters.dim[opt_id] = boost::any_cast(value); - }; - - def.type = coFloat; - def.set_default_value(new ConfigOptionFloat{ 1.0 }); - def.label = L("Length"); - Option option(def, "l"); - optgroup->append_single_option_line(option); - - def.label = L("Width"); - option = Option(def, "w"); - optgroup->append_single_option_line(option); - - def.label = L("Height"); - option = Option(def, "h"); - optgroup->append_single_option_line(option); - } - - optgroup = init_modificator_options_page(_(L("Cylinder"))); - if (optgroup) { - optgroup->m_on_change = [this](t_config_option_key opt_key, boost::any value) { - int val = boost::any_cast(value); - if (opt_key == "cyl_r") - object_parameters.cyl_r = val; - else if (opt_key == "cyl_h") - object_parameters.cyl_h = val; - else return; - }; - - def.type = coInt; - def.set_default_value(new ConfigOptionInt{ 1 }); - def.label = L("Radius"); - auto option = Option(def, "cyl_r"); - optgroup->append_single_option_line(option); - - def.label = L("Height"); - option = Option(def, "cyl_h"); - optgroup->append_single_option_line(option); - } - - optgroup = init_modificator_options_page(_(L("Sphere"))); - if (optgroup) { - optgroup->m_on_change = [this](t_config_option_key opt_key, boost::any value) { - if (opt_key == "sph_rho") - object_parameters.sph_rho = boost::any_cast(value); - else return; - }; - - def.type = coFloat; - def.set_default_value(new ConfigOptionFloat{ 1.0 }); - def.label = L("Rho"); - auto option = Option(def, "sph_rho"); - optgroup->append_single_option_line(option); - } - - optgroup = init_modificator_options_page(_(L("Slab"))); - if (optgroup) { - optgroup->m_on_change = [this](t_config_option_key opt_key, boost::any value) { - double val = boost::any_cast(value); - if (opt_key == "slab_z") - object_parameters.slab_z = val; - else if (opt_key == "slab_h") - object_parameters.slab_h = val; - else return; - }; - - def.type = coFloat; - def.set_default_value(new ConfigOptionFloat{ 1.0 }); - def.label = L("Height"); - auto option = Option(def, "slab_h"); - optgroup->append_single_option_line(option); - - def.label = L("Initial Z"); - option = Option(def, "slab_z"); - optgroup->append_single_option_line(option); - } - - Bind(wxEVT_CHOICEBOOK_PAGE_CHANGED, ([this](wxCommandEvent e) - { - auto page_idx = m_modificator_options_book->GetSelection(); - if (page_idx < 0) return; - switch (page_idx) - { - case 0: - object_parameters.type = LambdaTypeBox; - break; - case 1: - object_parameters.type = LambdaTypeCylinder; - break; - case 2: - object_parameters.type = LambdaTypeSphere; - break; - case 3: - object_parameters.type = LambdaTypeSlab; - break; - default: - break; - } - })); - - const auto button_sizer = CreateStdDialogButtonSizer(wxOK | wxCANCEL); - - wxButton* btn_OK = static_cast(FindWindowById(wxID_OK, this)); - btn_OK->Bind(wxEVT_BUTTON, [this](wxCommandEvent&) { - // validate user input - if (!CanClose())return; - EndModal(wxID_OK); - Destroy(); - }); - - wxButton* btn_CANCEL = static_cast(FindWindowById(wxID_CANCEL, this)); - btn_CANCEL->Bind(wxEVT_BUTTON, [this](wxCommandEvent&) { - // validate user input - if (!CanClose())return; - EndModal(wxID_CANCEL); - Destroy(); - }); - - sizer->Add(button_sizer, 0, wxALIGN_CENTER_HORIZONTAL | wxBOTTOM, 10); - - SetSizer(sizer); - sizer->Fit(this); - sizer->SetSizeHints(this); -} - -// Called from the constructor. -// Create a panel for a rectangular / circular / custom bed shape. -ConfigOptionsGroupShp LambdaObjectDialog::init_modificator_options_page(const wxString& title) -{ - if (!m_type_name.IsEmpty() && m_type_name != title) - return nullptr; - - auto panel = m_type_name.IsEmpty() ? new wxPanel(m_modificator_options_book) : m_panel; - - ConfigOptionsGroupShp optgroup; - optgroup = std::make_shared(panel, _(L("Add")) + " " +title + " " +dots); - optgroup->label_width = 100; - - m_optgroups.push_back(optgroup); - - if (m_type_name.IsEmpty()) { - panel->SetSizerAndFit(optgroup->sizer); - m_modificator_options_book->AddPage(panel, title); - } - else - panel->SetSizer(optgroup->sizer); - - return optgroup; -} - - -} //namespace GUI -} //namespace Slic3r diff --git a/src/slic3r/GUI/LambdaObjectDialog.hpp b/src/slic3r/GUI/LambdaObjectDialog.hpp deleted file mode 100644 index 5bc2d19a5..000000000 --- a/src/slic3r/GUI/LambdaObjectDialog.hpp +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef slic3r_LambdaObjectDialog_hpp_ -#define slic3r_LambdaObjectDialog_hpp_ - -#include -#include - -#include -#include -#include - -class wxPanel; - -namespace Slic3r -{ -namespace GUI -{ -enum LambdaTypeIDs{ - LambdaTypeBox, - LambdaTypeCylinder, - LambdaTypeSphere, - LambdaTypeSlab -}; - -struct OBJECT_PARAMETERS -{ - LambdaTypeIDs type = LambdaTypeBox; - double dim[3];// = { 1.0, 1.0, 1.0 }; - int cyl_r = 1; - int cyl_h = 1; - double sph_rho = 1.0; - double slab_h = 1.0; - double slab_z = 0.0; -}; -class ConfigOptionsGroup; -using ConfigOptionsGroupShp = std::shared_ptr; -class LambdaObjectDialog : public wxDialog -{ - wxChoicebook* m_modificator_options_book = nullptr; - std::vector m_optgroups; - wxString m_type_name; - wxPanel* m_panel = nullptr; -public: - LambdaObjectDialog(wxWindow* parent, - const wxString type_name = wxEmptyString); - ~LambdaObjectDialog() {} - - bool CanClose() { return true; } // ??? - OBJECT_PARAMETERS& ObjectParameters() { return object_parameters; } - - ConfigOptionsGroupShp init_modificator_options_page(const wxString& title); - - // Note whether the window was already closed, so a pending update is not executed. - bool m_already_closed = false; - OBJECT_PARAMETERS object_parameters; - wxBoxSizer* sizer = nullptr; -}; -} //namespace GUI -} //namespace Slic3r -#endif //slic3r_LambdaObjectDialog_hpp_ diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index 20b713bca..d8a799eb2 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -29,6 +29,7 @@ #include "InstanceCheck.hpp" #include "I18N.hpp" #include "GLCanvas3D.hpp" +#include "Plater.hpp" #include #include "GUI_App.hpp" diff --git a/src/slic3r/GUI/MainFrame.hpp b/src/slic3r/GUI/MainFrame.hpp index 43375d344..3b64be9bc 100644 --- a/src/slic3r/GUI/MainFrame.hpp +++ b/src/slic3r/GUI/MainFrame.hpp @@ -12,7 +12,6 @@ #include #include "GUI_Utils.hpp" -#include "Plater.hpp" #include "Event.hpp" class wxNotebook; @@ -27,6 +26,8 @@ namespace GUI class Tab; class PrintHostQueueDialog; +class Plater; +class MainFrame; enum QuickSlice { diff --git a/src/slic3r/GUI/Mouse3DController.cpp b/src/slic3r/GUI/Mouse3DController.cpp index 8f80f6847..baa9356b6 100644 --- a/src/slic3r/GUI/Mouse3DController.cpp +++ b/src/slic3r/GUI/Mouse3DController.cpp @@ -6,6 +6,7 @@ #include "PresetBundle.hpp" #include "AppConfig.hpp" #include "GLCanvas3D.hpp" +#include "Plater.hpp" #include diff --git a/src/slic3r/GUI/OptionsGroup.cpp b/src/slic3r/GUI/OptionsGroup.cpp index fa94e6321..819c214a8 100644 --- a/src/slic3r/GUI/OptionsGroup.cpp +++ b/src/slic3r/GUI/OptionsGroup.cpp @@ -1,5 +1,7 @@ #include "OptionsGroup.hpp" #include "ConfigExceptions.hpp" +#include "Plater.hpp" +#include "GUI_App.hpp" #include #include @@ -100,6 +102,36 @@ const t_field& OptionsGroup::build_field(const t_config_option_key& id, const Co return field; } +OptionsGroup::OptionsGroup( wxWindow* _parent, const wxString& title, + bool is_tab_opt /* = false */, + column_t extra_clmn /* = nullptr */) : + m_parent(_parent), title(title), + m_show_modified_btns(is_tab_opt), + staticbox(title!=""), extra_column(extra_clmn) +{ + if (staticbox) { + stb = new wxStaticBox(_parent, wxID_ANY, _(title)); + if (!wxOSX) stb->SetBackgroundStyle(wxBG_STYLE_PAINT); + stb->SetFont(wxOSX ? wxGetApp().normal_font() : wxGetApp().bold_font()); + } else + stb = nullptr; + sizer = (staticbox ? new wxStaticBoxSizer(stb, wxVERTICAL) : new wxBoxSizer(wxVERTICAL)); + auto num_columns = 1U; + if (label_width != 0) num_columns++; + if (extra_column != nullptr) num_columns++; + m_grid_sizer = new wxFlexGridSizer(0, num_columns, 1,0); + static_cast(m_grid_sizer)->SetFlexibleDirection(wxBOTH/*wxHORIZONTAL*/); + static_cast(m_grid_sizer)->AddGrowableCol(label_width == 0 ? 0 : !extra_column ? 1 : 2 ); +#if 0//#ifdef __WXGTK__ + m_panel = new wxPanel( _parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + sizer->Fit(m_panel); + sizer->Add(m_panel, 0, wxEXPAND | wxALL, wxOSX||!staticbox ? 0: 5); +#else + sizer->Add(m_grid_sizer, 0, wxEXPAND | wxALL, wxOSX||!staticbox ? 0: 5); +#endif /* __WXGTK__ */ + +} + void OptionsGroup::add_undo_buttuns_to_sizer(wxSizer* sizer, const t_field& field) { if (!m_show_modified_btns) { diff --git a/src/slic3r/GUI/OptionsGroup.hpp b/src/slic3r/GUI/OptionsGroup.hpp index 9fbb28339..2e6f9aa0f 100644 --- a/src/slic3r/GUI/OptionsGroup.hpp +++ b/src/slic3r/GUI/OptionsGroup.hpp @@ -11,7 +11,6 @@ #include "libslic3r/PrintConfig.hpp" #include "Field.hpp" -#include "GUI_App.hpp" #include "I18N.hpp" // Translate the ifdef @@ -171,32 +170,7 @@ public: } OptionsGroup( wxWindow* _parent, const wxString& title, bool is_tab_opt = false, - column_t extra_clmn = nullptr) : - m_parent(_parent), title(title), - m_show_modified_btns(is_tab_opt), - staticbox(title!=""), extra_column(extra_clmn) { - if (staticbox) { - stb = new wxStaticBox(_parent, wxID_ANY, _(title)); - if (!wxOSX) stb->SetBackgroundStyle(wxBG_STYLE_PAINT); - stb->SetFont(wxOSX ? wxGetApp().normal_font() : wxGetApp().bold_font()); - } else - stb = nullptr; - sizer = (staticbox ? new wxStaticBoxSizer(stb, wxVERTICAL) : new wxBoxSizer(wxVERTICAL)); - auto num_columns = 1U; - if (label_width != 0) num_columns++; - if (extra_column != nullptr) num_columns++; - m_grid_sizer = new wxFlexGridSizer(0, num_columns, 1,0); - static_cast(m_grid_sizer)->SetFlexibleDirection(wxBOTH/*wxHORIZONTAL*/); - static_cast(m_grid_sizer)->AddGrowableCol(label_width == 0 ? 0 : !extra_column ? 1 : 2 ); -#if 0//#ifdef __WXGTK__ - m_panel = new wxPanel( _parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - sizer->Fit(m_panel); - sizer->Add(m_panel, 0, wxEXPAND | wxALL, wxOSX||!staticbox ? 0: 5); -#else - sizer->Add(m_grid_sizer, 0, wxEXPAND | wxALL, wxOSX||!staticbox ? 0: 5); -#endif /* __WXGTK__ */ - - } + column_t extra_clmn = nullptr); wxGridSizer* get_grid_sizer() { return m_grid_sizer; } diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 9286580b1..a7e029636 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -2320,9 +2320,9 @@ std::vector Plater::priv::load_files(const std::vector& input_ if (imperial_units) convert_from_imperial_units(model); else if (model.looks_like_imperial_units()) { - wxMessageDialog msg_dlg(q, _L( - "This model looks like saved in inches.\n" - "Should I consider this model as a saved in inches and convert it?") + "\n", + wxMessageDialog msg_dlg(q, format_wxstr(_L( + "Some object(s) in file %s looks like saved in inches.\n" + "Should I consider them as a saved in inches and convert them?"), from_path(filename)) + "\n", _L("Saved in inches object detected"), wxICON_WARNING | wxYES | wxNO); if (msg_dlg.ShowModal() == wxID_YES) convert_from_imperial_units(model); diff --git a/src/slic3r/GUI/Preferences.cpp b/src/slic3r/GUI/Preferences.cpp index bb189cf26..35f2ee429 100644 --- a/src/slic3r/GUI/Preferences.cpp +++ b/src/slic3r/GUI/Preferences.cpp @@ -1,6 +1,7 @@ #include "Preferences.hpp" #include "AppConfig.hpp" #include "OptionsGroup.hpp" +#include "GUI_App.hpp" #include "I18N.hpp" namespace Slic3r { @@ -364,4 +365,4 @@ void PreferencesDialog::create_settings_mode_widget() } // GUI -} // Slic3r \ No newline at end of file +} // Slic3r diff --git a/src/slic3r/GUI/Search.cpp b/src/slic3r/GUI/Search.cpp index a94b776a1..968589985 100644 --- a/src/slic3r/GUI/Search.cpp +++ b/src/slic3r/GUI/Search.cpp @@ -10,6 +10,7 @@ #include "libslic3r/PrintConfig.hpp" #include "GUI_App.hpp" +#include "Plater.hpp" #include "Tab.hpp" #include "PresetBundle.hpp" diff --git a/src/slic3r/GUI/Search.hpp b/src/slic3r/GUI/Search.hpp index 45a96034a..9701e6808 100644 --- a/src/slic3r/GUI/Search.hpp +++ b/src/slic3r/GUI/Search.hpp @@ -228,11 +228,11 @@ public: // implementation of base class virtuals to define model - virtual unsigned int GetColumnCount() const wxOVERRIDE { return colMax; } - virtual wxString GetColumnType(unsigned int col) const wxOVERRIDE; - virtual void GetValueByRow(wxVariant& variant, unsigned int row, unsigned int col) const wxOVERRIDE; - virtual bool GetAttrByRow(unsigned int row, unsigned int col, wxDataViewItemAttr& attr) const wxOVERRIDE { return true; } - virtual bool SetValueByRow(const wxVariant& variant, unsigned int row, unsigned int col) wxOVERRIDE { return false; } + virtual unsigned int GetColumnCount() const override { return colMax; } + virtual wxString GetColumnType(unsigned int col) const override; + virtual void GetValueByRow(wxVariant& variant, unsigned int row, unsigned int col) const override; + virtual bool GetAttrByRow(unsigned int row, unsigned int col, wxDataViewItemAttr& attr) const override { return true; } + virtual bool SetValueByRow(const wxVariant& variant, unsigned int row, unsigned int col) override { return false; } }; diff --git a/src/slic3r/GUI/Selection.cpp b/src/slic3r/GUI/Selection.cpp index 682d9e2b9..add09a59d 100644 --- a/src/slic3r/GUI/Selection.cpp +++ b/src/slic3r/GUI/Selection.cpp @@ -9,6 +9,7 @@ #include "GUI_ObjectList.hpp" #include "Gizmos/GLGizmoBase.hpp" #include "Camera.hpp" +#include "Plater.hpp" #include "libslic3r/Model.hpp" diff --git a/src/slic3r/GUI/SysInfoDialog.cpp b/src/slic3r/GUI/SysInfoDialog.cpp index 74b94e1eb..3bd0fcf9f 100644 --- a/src/slic3r/GUI/SysInfoDialog.cpp +++ b/src/slic3r/GUI/SysInfoDialog.cpp @@ -3,6 +3,7 @@ #include "3DScene.hpp" #include "GUI.hpp" #include "../Utils/UndoRedo.hpp" +#include "Plater.hpp" #include diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 3b78b2c9a..dd412a0de 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -32,6 +32,8 @@ #include "GUI_App.hpp" #include "GUI_ObjectList.hpp" #include "ConfigWizard.hpp" +#include "Plater.hpp" +#include "MainFrame.hpp" #include "format.hpp" namespace Slic3r { @@ -3582,6 +3584,18 @@ void Tab::set_tooltips_text() "Click to reset current value to the last saved preset.")); } +Page::Page(wxWindow* parent, const wxString& title, const int iconID, const std::vector& mode_bmp_cache) : + m_parent(parent), + m_title(title), + m_iconID(iconID), + m_mode_bitmap_cache(mode_bmp_cache) +{ + Create(m_parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL); + m_vsizer = new wxBoxSizer(wxVERTICAL); + m_item_color = &wxGetApp().get_label_clr_default(); + SetSizer(m_vsizer); +} + void Page::reload_config() { for (auto group : m_optgroups) diff --git a/src/slic3r/GUI/Tab.hpp b/src/slic3r/GUI/Tab.hpp index 36b4a61ea..5805809bf 100644 --- a/src/slic3r/GUI/Tab.hpp +++ b/src/slic3r/GUI/Tab.hpp @@ -33,11 +33,12 @@ #include "Event.hpp" #include "wxExtensions.hpp" #include "ConfigManipulation.hpp" +#include "Preset.hpp" +#include "OptionsGroup.hpp" namespace Slic3r { namespace GUI { - // Single Tab page containing a{ vsizer } of{ optgroups } // package Slic3r::GUI::Tab::Page; using ConfigOptionsGroupShp = std::shared_ptr; @@ -49,17 +50,8 @@ class Page : public wxScrolledWindow wxBoxSizer* m_vsizer; bool m_show = true; public: - Page(wxWindow* parent, const wxString& title, const int iconID, const std::vector& mode_bmp_cache) : - m_parent(parent), - m_title(title), - m_iconID(iconID), - m_mode_bitmap_cache(mode_bmp_cache) - { - Create(m_parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL); - m_vsizer = new wxBoxSizer(wxVERTICAL); - m_item_color = &wxGetApp().get_label_clr_default(); - SetSizer(m_vsizer); - } + Page(wxWindow* parent, const wxString& title, const int iconID, + const std::vector& mode_bmp_cache); ~Page() {} bool m_is_modified_values{ false }; diff --git a/src/slic3r/GUI/wxExtensions.cpp b/src/slic3r/GUI/wxExtensions.cpp index 7dadffb5b..74d790df8 100644 --- a/src/slic3r/GUI/wxExtensions.cpp +++ b/src/slic3r/GUI/wxExtensions.cpp @@ -13,6 +13,7 @@ #include "GUI_ObjectList.hpp" #include "I18N.hpp" #include "GUI_Utils.hpp" +#include "Plater.hpp" #include "../Utils/MacDarkMode.hpp" #ifndef __WXGTK__// msw_menuitem_bitmaps is used for MSW and OSX diff --git a/src/slic3r/Utils/PresetUpdater.cpp b/src/slic3r/Utils/PresetUpdater.cpp index b86775c88..c32613c46 100644 --- a/src/slic3r/Utils/PresetUpdater.cpp +++ b/src/slic3r/Utils/PresetUpdater.cpp @@ -25,6 +25,7 @@ #include "slic3r/GUI/UpdateDialogs.hpp" #include "slic3r/GUI/ConfigWizard.hpp" #include "slic3r/GUI/GUI_App.hpp" +#include "slic3r/GUI/Plater.hpp" #include "slic3r/GUI/format.hpp" #include "slic3r/Utils/Http.hpp" #include "slic3r/Config/Version.hpp"