From f5bd05d20d23cef9ce2a381503cc7a33e4cc22ef Mon Sep 17 00:00:00 2001 From: Hanif Koh Date: Wed, 7 Oct 2026 01:38:53 +0800 Subject: [PATCH] Stop Exporting Names Through Usings in GUI and Voronoi Headers Each of these headers put a using or namespace alias at global or namespace scope, which every includer inherited: - BBLTopbar.hpp: "using namespace Slic3r::GUI;" at global scope, reached through MainFrame.hpp. Seven source files used GUI names unqualified outside the namespace because of it, one of them as "::RadioBox". - IMSlider.hpp and TickCode.hpp: "using namespace CustomGCode;" inside Slic3r. - ProjectTask.hpp, Jobs/PrintJob.hpp and ConfigWizard_private.hpp: "namespace fs = boost::filesystem;". PresetBundle.cpp and GUI_App.cpp had no alias of their own. - VoronoiUtils.hpp: "using VD = Slic3r::Geometry::VoronoiDiagram;" at global scope. The headers now spell the names out. Source files that used them get the qualifier, or a using of their own where there are many uses. --- src/libslic3r/Geometry/Voronoi.cpp | 1 + src/libslic3r/Geometry/VoronoiUtils.cpp | 1 + src/libslic3r/Geometry/VoronoiUtils.hpp | 30 ++++++++++----------- src/libslic3r/MultiMaterialSegmentation.cpp | 1 + src/libslic3r/PresetBundle.cpp | 2 ++ src/libslic3r/ProjectTask.hpp | 6 ++--- src/slic3r/GUI/BBLTopbar.cpp | 1 + src/slic3r/GUI/BBLTopbar.hpp | 2 -- src/slic3r/GUI/BackgroundSlicingProcess.cpp | 4 +-- src/slic3r/GUI/ConfigWizard_private.hpp | 4 +-- src/slic3r/GUI/GCodeViewer.cpp | 10 +++---- src/slic3r/GUI/GLCanvas3D.cpp | 4 +-- src/slic3r/GUI/GUI_App.cpp | 1 + src/slic3r/GUI/GUI_Preview.cpp | 2 +- src/slic3r/GUI/IMSlider.cpp | 2 ++ src/slic3r/GUI/IMSlider.hpp | 25 +++++++++-------- src/slic3r/GUI/Jobs/PrintJob.hpp | 8 +++--- src/slic3r/GUI/Plater.cpp | 6 ++--- src/slic3r/GUI/PresetComboBoxes.cpp | 2 +- src/slic3r/GUI/PrintHostDialogs.cpp | 4 +-- src/slic3r/GUI/TickCode.cpp | 3 +++ src/slic3r/GUI/TickCode.hpp | 17 ++++++------ src/slic3r/Utils/SimplyPrint.cpp | 2 +- src/slic3r/plugin/host/PluginHostUi.cpp | 24 ++++++++--------- 24 files changed, 81 insertions(+), 81 deletions(-) diff --git a/src/libslic3r/Geometry/Voronoi.cpp b/src/libslic3r/Geometry/Voronoi.cpp index 7d59e2d2b8..31f9f974a7 100644 --- a/src/libslic3r/Geometry/Voronoi.cpp +++ b/src/libslic3r/Geometry/Voronoi.cpp @@ -16,6 +16,7 @@ namespace Slic3r::Geometry { +using VD = VoronoiDiagram; using PolygonsSegmentIndexConstIt = std::vector::const_iterator; using LinesIt = Lines::iterator; using ColoredLinesConstIt = ColoredLines::const_iterator; diff --git a/src/libslic3r/Geometry/VoronoiUtils.cpp b/src/libslic3r/Geometry/VoronoiUtils.cpp index d0ad07cc7e..305e9128ef 100644 --- a/src/libslic3r/Geometry/VoronoiUtils.cpp +++ b/src/libslic3r/Geometry/VoronoiUtils.cpp @@ -20,6 +20,7 @@ namespace Slic3r::Geometry { +using VD = VoronoiDiagram; using PolygonsSegmentIndexConstIt = std::vector::const_iterator; using LinesIt = Lines::iterator; using ColoredLinesIt = ColoredLines::iterator; diff --git a/src/libslic3r/Geometry/VoronoiUtils.hpp b/src/libslic3r/Geometry/VoronoiUtils.hpp index d9b15fd839..13c2492bf9 100644 --- a/src/libslic3r/Geometry/VoronoiUtils.hpp +++ b/src/libslic3r/Geometry/VoronoiUtils.hpp @@ -10,8 +10,6 @@ #include "libslic3r/Point.hpp" #include "libslic3r/libslic3r.h" -using VD = Slic3r::Geometry::VoronoiDiagram; - namespace Slic3r::Geometry { // Represent trapezoid Voronoi cell around segment. @@ -19,8 +17,8 @@ template struct SegmentCellRange { const PT source_segment_start_point; // The start point of the source segment of this cell. const PT source_segment_end_point; // The end point of the source segment of this cell. - const VD::edge_type *edge_begin = nullptr; // The edge of the Voronoi diagram where the loop around the cell starts. - const VD::edge_type *edge_end = nullptr; // The edge of the Voronoi diagram where the loop around the cell ends. + const VoronoiDiagram::edge_type *edge_begin = nullptr; // The edge of the Voronoi diagram where the loop around the cell starts. + const VoronoiDiagram::edge_type *edge_end = nullptr; // The edge of the Voronoi diagram where the loop around the cell ends. SegmentCellRange() = delete; explicit SegmentCellRange(const PT &source_segment_start_point, const PT &source_segment_end_point) @@ -34,8 +32,8 @@ template struct SegmentCellRange template struct PointCellRange { const PT source_point; // The source point of this cell. - const VD::edge_type *edge_begin = nullptr; // The edge of the Voronoi diagram where the loop around the cell starts. - const VD::edge_type *edge_end = nullptr; // The edge of the Voronoi diagram where the loop around the cell ends. + const VoronoiDiagram::edge_type *edge_begin = nullptr; // The edge of the Voronoi diagram where the loop around the cell starts. + const VoronoiDiagram::edge_type *edge_end = nullptr; // The edge of the Voronoi diagram where the loop around the cell ends. PointCellRange() = delete; explicit PointCellRange(const PT &source_point) : source_point(source_point) {} @@ -46,20 +44,20 @@ template struct PointCellRange class VoronoiUtils { public: - static Vec2i64 to_point(const VD::vertex_type *vertex); + static Vec2i64 to_point(const VoronoiDiagram::vertex_type *vertex); - static Vec2i64 to_point(const VD::vertex_type &vertex); + static Vec2i64 to_point(const VoronoiDiagram::vertex_type &vertex); - static bool is_finite(const VD::vertex_type &vertex); + static bool is_finite(const VoronoiDiagram::vertex_type &vertex); - static VD::vertex_type make_rotated_vertex(VD::vertex_type &vertex, double angle); + static VoronoiDiagram::vertex_type make_rotated_vertex(VoronoiDiagram::vertex_type &vertex, double angle); template static typename boost::polygon::enable_if< typename boost::polygon::gtl_if::value_type>::type>::type>::type, typename std::iterator_traits::reference>::type - get_source_segment(const VD::cell_type &cell, SegmentIterator segment_begin, SegmentIterator segment_end); + get_source_segment(const VoronoiDiagram::cell_type &cell, SegmentIterator segment_begin, SegmentIterator segment_end); template static typename boost::polygon::enable_if< @@ -73,7 +71,7 @@ public: typename boost::polygon::gtl_if::value_type>::type>::type>::type, Arachne::PolygonsPointIndex>::type - get_source_point_index(const VD::cell_type &cell, SegmentIterator segment_begin, SegmentIterator segment_end); + get_source_point_index(const VoronoiDiagram::cell_type &cell, SegmentIterator segment_begin, SegmentIterator segment_end); /** * Discretize a parabola based on (approximate) step size. @@ -113,7 +111,7 @@ public: typename boost::polygon::geometry_concept::value_type>::type>::type>::type, Geometry::SegmentCellRange< typename boost::polygon::segment_point_type::value_type>::type>>::type - compute_segment_cell_range(const VD::cell_type &cell, SegmentIterator segment_begin, SegmentIterator segment_end); + compute_segment_cell_range(const VoronoiDiagram::cell_type &cell, SegmentIterator segment_begin, SegmentIterator segment_end); /** * Compute the range of line segments that surround a cell of the skeletal @@ -140,19 +138,19 @@ public: typename boost::polygon::geometry_concept::value_type>::type>::type>::type, Geometry::PointCellRange< typename boost::polygon::segment_point_type::value_type>::type>>::type - compute_point_cell_range(const VD::cell_type &cell, SegmentIterator segment_begin, SegmentIterator segment_end); + compute_point_cell_range(const VoronoiDiagram::cell_type &cell, SegmentIterator segment_begin, SegmentIterator segment_end); template static bool is_in_range(double value) { return double(std::numeric_limits::lowest()) <= value && value <= double(std::numeric_limits::max()); } - template static bool is_in_range(const VD::vertex_type &vertex) + template static bool is_in_range(const VoronoiDiagram::vertex_type &vertex) { return VoronoiUtils::is_finite(vertex) && is_in_range(vertex.x()) && is_in_range(vertex.y()); } - template static bool is_in_range(const VD::edge_type &edge) + template static bool is_in_range(const VoronoiDiagram::edge_type &edge) { if (edge.vertex0() == nullptr || edge.vertex1() == nullptr) return false; diff --git a/src/libslic3r/MultiMaterialSegmentation.cpp b/src/libslic3r/MultiMaterialSegmentation.cpp index b7dfd6a160..d2f76e7e66 100644 --- a/src/libslic3r/MultiMaterialSegmentation.cpp +++ b/src/libslic3r/MultiMaterialSegmentation.cpp @@ -63,6 +63,7 @@ namespace Slic3r { enum class EnforcerBlockerType : int8_t; } namespace Slic3r { using boost::polygon::voronoi_diagram; +using VD = Geometry::VoronoiDiagram; static inline Point mk_point(const Voronoi::VD::vertex_type *point) { return {coord_t(point->x()), coord_t(point->y())}; } diff --git a/src/libslic3r/PresetBundle.cpp b/src/libslic3r/PresetBundle.cpp index eb8321e4bd..4897c90ebc 100644 --- a/src/libslic3r/PresetBundle.cpp +++ b/src/libslic3r/PresetBundle.cpp @@ -80,6 +80,8 @@ #include #include +namespace fs = boost::filesystem; + // Mark string for localization and translate. #define L(s) Slic3r::I18N::translate(s) diff --git a/src/libslic3r/ProjectTask.hpp b/src/libslic3r/ProjectTask.hpp index 47eaa37dcc..64c4ddc447 100644 --- a/src/libslic3r/ProjectTask.hpp +++ b/src/libslic3r/ProjectTask.hpp @@ -11,8 +11,6 @@ #include #include -namespace fs = boost::filesystem; - namespace Slic3r { class BBLProject; @@ -208,7 +206,7 @@ public: std::string task_profile_id; /* profile id*/ std::string task_name; /* task name, generally filename as task name */ std::string task_file; /* local full file path of 3mf or gcode */ - fs::path task_path; /* local path of 3mf or gcode */ + boost::filesystem::path task_path; /* local path of 3mf or gcode */ std::string task_gcode_in_3mf; /* gcode in 3mf */ std::string task_create_time; /* time created by cloud */ std::string task_thumbnail_url; /* url of task thumbnail */ @@ -326,7 +324,7 @@ public: std::string project_url_md5; /* md5 of project url file */ std::string project_name; std::string project_3mf_file; - fs::path project_path; + boost::filesystem::path project_path; std::string project_content; std::string project_country_code; diff --git a/src/slic3r/GUI/BBLTopbar.cpp b/src/slic3r/GUI/BBLTopbar.cpp index 40f6457ae4..eb85b9413b 100644 --- a/src/slic3r/GUI/BBLTopbar.cpp +++ b/src/slic3r/GUI/BBLTopbar.cpp @@ -41,6 +41,7 @@ #define TOPBAR_TITLE_WIDTH 300 using namespace Slic3r; +using namespace Slic3r::GUI; enum CUSTOM_ID { diff --git a/src/slic3r/GUI/BBLTopbar.hpp b/src/slic3r/GUI/BBLTopbar.hpp index 3d71a56e4c..bad0727452 100644 --- a/src/slic3r/GUI/BBLTopbar.hpp +++ b/src/slic3r/GUI/BBLTopbar.hpp @@ -18,8 +18,6 @@ class wxMouseCaptureLostEvent; class wxMouseEvent; class wxWindow; -using namespace Slic3r::GUI; - class CenteredTitle : public wxControl { public: diff --git a/src/slic3r/GUI/BackgroundSlicingProcess.cpp b/src/slic3r/GUI/BackgroundSlicingProcess.cpp index e9417782db..50c69f40dc 100644 --- a/src/slic3r/GUI/BackgroundSlicingProcess.cpp +++ b/src/slic3r/GUI/BackgroundSlicingProcess.cpp @@ -218,7 +218,7 @@ std::string BackgroundSlicingProcess::output_filepath_for_project(const boost::f void BackgroundSlicingProcess::process_fff() { assert(m_print == m_fff_print); - PresetBundle& preset_bundle = *wxGetApp().preset_bundle; + PresetBundle& preset_bundle = *GUI::wxGetApp().preset_bundle; m_fff_print->is_BBL_printer() = preset_bundle.is_bbl_vendor(); // BBS: add the logic to process from an existed gcode file if (m_print->finished()) { @@ -727,7 +727,7 @@ StringObjectException BackgroundSlicingProcess::validate(std::vectoris_BBL_printer() = wxGetApp().preset_bundle->is_bbl_vendor(); + m_fff_print->is_BBL_printer() = GUI::wxGetApp().preset_bundle->is_bbl_vendor(); return m_print->validate(warnings, collison_polygons, height_polygons); } diff --git a/src/slic3r/GUI/ConfigWizard_private.hpp b/src/slic3r/GUI/ConfigWizard_private.hpp index a1f9b61b00..5f7720ab84 100644 --- a/src/slic3r/GUI/ConfigWizard_private.hpp +++ b/src/slic3r/GUI/ConfigWizard_private.hpp @@ -43,8 +43,6 @@ #include -namespace fs = boost::filesystem; - namespace Slic3r { namespace GUI { @@ -88,7 +86,7 @@ struct Bundle // cache or its profile JSONs, whichever is usable. // Returns false if not loaded. Reason for that is logged as boost::log error. //BBS: set BBL as default - bool load(fs::path dir, const std::string &vendor_name, bool is_in_resources, bool is_bbl_bundle = false); + bool load(boost::filesystem::path dir, const std::string &vendor_name, bool is_in_resources, bool is_bbl_bundle = false); const std::string& vendor_id() const { return vendor_profile->id; } }; diff --git a/src/slic3r/GUI/GCodeViewer.cpp b/src/slic3r/GUI/GCodeViewer.cpp index 6c56e4fa54..2a2616c701 100644 --- a/src/slic3r/GUI/GCodeViewer.cpp +++ b/src/slic3r/GUI/GCodeViewer.cpp @@ -3622,7 +3622,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv if (extruder_id + 1 != static_cast(item.extruder)) continue; - if (item.type != ColorChange) + if (item.type != CustomGCode::ColorChange) continue; if (!zs_built) { @@ -4789,10 +4789,10 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv ImGui::SameLine(); switch (custom_gcode.type) { - case PausePrint: imgui.text(cgcode_pause_str); break; - case Template: imgui.text(cgcode_template_str); break; - case ToolChange: imgui.text(cgcode_toolchange_str); break; - case Custom: imgui.text(cgcode_custom_str); break; + case CustomGCode::PausePrint: imgui.text(cgcode_pause_str); break; + case CustomGCode::Template: imgui.text(cgcode_template_str); break; + case CustomGCode::ToolChange: imgui.text(cgcode_toolchange_str); break; + case CustomGCode::Custom: imgui.text(cgcode_custom_str); break; default: imgui.text(cgcode_unknown_str); break; } ImGui::SameLine(max_len); diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index e9724f41ed..7aee146a31 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -184,12 +184,12 @@ static Slic3r::ColorRGBA DEFAULT_BG_LIGHT_COLOR_DARK = { 0.329f, 0.329f, 0.353f, static Slic3r::ColorRGBA ERROR_BG_LIGHT_COLOR = { 0.753f, 0.192f, 0.039f, 1.0f }; static Slic3r::ColorRGBA ERROR_BG_LIGHT_COLOR_DARK = { 0.753f, 0.192f, 0.039f, 1.0f }; -void GLCanvas3D::update_render_colors() +void Slic3r::GUI::GLCanvas3D::update_render_colors() { DEFAULT_BG_LIGHT_COLOR = ImGuiWrapper::from_ImVec4(RenderColor::colors[RenderCol_3D_Background]); } -void GLCanvas3D::load_render_colors() +void Slic3r::GUI::GLCanvas3D::load_render_colors() { RenderColor::colors[RenderCol_3D_Background] = ImGuiWrapper::to_ImVec4(DEFAULT_BG_LIGHT_COLOR); } diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 62e780afef..bc589dce6e 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -309,6 +309,7 @@ typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS2)( #include #endif +namespace fs = boost::filesystem; using namespace std::literals; namespace pt = boost::property_tree; diff --git a/src/slic3r/GUI/GUI_Preview.cpp b/src/slic3r/GUI/GUI_Preview.cpp index 1968df996f..fd477cf767 100644 --- a/src/slic3r/GUI/GUI_Preview.cpp +++ b/src/slic3r/GUI/GUI_Preview.cpp @@ -396,7 +396,7 @@ void Preview::sys_color_changed() // m_layers_slider->sys_color_changed(); } -void Preview::on_tick_changed(Type type) +void Preview::on_tick_changed(CustomGCode::Type type) { //if (type == Type::PausePrint) { // m_schedule_background_process(); diff --git a/src/slic3r/GUI/IMSlider.cpp b/src/slic3r/GUI/IMSlider.cpp index ce2aa2ecba..762b0c6082 100644 --- a/src/slic3r/GUI/IMSlider.cpp +++ b/src/slic3r/GUI/IMSlider.cpp @@ -46,6 +46,8 @@ namespace Slic3r { +using namespace CustomGCode; + namespace GUI { // equal to 25 mm2 diff --git a/src/slic3r/GUI/IMSlider.hpp b/src/slic3r/GUI/IMSlider.hpp index 9df84a7a75..4f02167669 100644 --- a/src/slic3r/GUI/IMSlider.hpp +++ b/src/slic3r/GUI/IMSlider.hpp @@ -20,7 +20,6 @@ struct IMGUI_API ImRect; namespace Slic3r { -using namespace CustomGCode; class PrintObject; class Layer; @@ -89,8 +88,8 @@ public: void SetSliderValues(const std::vector &values); void SetSliderAlternateValues(const std::vector &values) { m_alternate_values = values; } - Info GetTicksValues() const; - void SetTicksValues(const Info &custom_gcode_per_print_z); + CustomGCode::Info GetTicksValues() const; + void SetTicksValues(const CustomGCode::Info &custom_gcode_per_print_z); void SetLayersTimes(const std::vector &layers_times, float total_time); void SetLayersTimes(const std::vector &layers_times); @@ -98,8 +97,8 @@ public: void SetDrawMode(DrawMode mode) { m_draw_mode = mode; } //BBS void SetExtraStyle(long style) { m_extra_style = style; } - void SetManipulationMode(Mode mode) { m_mode = mode; } - Mode GetManipulationMode() const { return m_mode; } + void SetManipulationMode(CustomGCode::Mode mode) { m_mode = mode; } + CustomGCode::Mode GetManipulationMode() const { return m_mode; } void SetModeAndOnlyExtruder(const bool is_one_extruder_printed_model, const int only_extruder, bool can_change_color); void SetExtruderColors(const std::vector &extruder_colors); @@ -117,8 +116,8 @@ public: void UseDefaultColors(bool def_colors_on) { m_ticks.set_default_colors(def_colors_on); } void on_mouse_wheel(wxMouseEvent& evt); - void post_ticks_changed_event(Type type = Unknown); - bool check_ticks_changed_event(Type type); + void post_ticks_changed_event(CustomGCode::Type type = CustomGCode::Unknown); + bool check_ticks_changed_event(CustomGCode::Type type); bool switch_one_layer_mode(); void show_go_to_layer(bool show) { m_show_go_to_layer_dialog = show; } @@ -130,9 +129,9 @@ public: bool is_need_post_tick_event() { return m_is_need_post_tick_changed_event; } void reset_post_tick_event(bool val = false) { m_is_need_post_tick_changed_event = val; - m_tick_change_event_type = Type::Unknown; + m_tick_change_event_type = CustomGCode::Type::Unknown; } - Type get_post_tick_event_type() { return m_tick_change_event_type; } + CustomGCode::Type get_post_tick_event_type() { return m_tick_change_event_type; } float m_scale = 1.0; void set_scale(float scale = 1.0); @@ -143,7 +142,7 @@ public: protected: void add_custom_gcode(std::string custom_gcode); - void add_code_as_tick(Type type, int selected_extruder = -1); + void add_code_as_tick(CustomGCode::Type type, int selected_extruder = -1); void delete_tick(const TickCode& tick); void do_go_to_layer(size_t layer_number); //menu void correct_lower_value(); @@ -156,7 +155,7 @@ protected: void render_edit_menu(const TickCode& tick); //menu void draw_background_and_groove(const ImRect& bg_rect, const ImRect& groove); void draw_colored_band(const ImRect& groove, const ImRect& slideable_region); - void draw_custom_label_block(const ImVec2 anchor, Type type); + void draw_custom_label_block(const ImVec2 anchor, CustomGCode::Type type); void draw_ticks(const ImRect& slideable_region); void draw_tick_on_mouse_position(const ImRect& slideable_region); void show_tooltip(const TickCode& tick); //menu @@ -217,7 +216,7 @@ private: void *m_delete_icon_id; DrawMode m_draw_mode = dmRegular; - Mode m_mode = SingleExtruder; + CustomGCode::Mode m_mode = CustomGCode::SingleExtruder; int m_only_extruder = -1; long m_style; @@ -232,7 +231,7 @@ private: bool m_can_change_color; std::string m_print_obj_idxs; bool m_is_need_post_tick_changed_event { false }; - Type m_tick_change_event_type; + CustomGCode::Type m_tick_change_event_type; std::vector m_alternate_values; diff --git a/src/slic3r/GUI/Jobs/PrintJob.hpp b/src/slic3r/GUI/Jobs/PrintJob.hpp index 4207824471..150635cfb1 100644 --- a/src/slic3r/GUI/Jobs/PrintJob.hpp +++ b/src/slic3r/GUI/Jobs/PrintJob.hpp @@ -12,8 +12,6 @@ #include "Job.hpp" #include "slic3r/GUI/DeviceCore/DevStorage.h" -namespace fs = boost::filesystem; - namespace Slic3r { namespace GUI { @@ -26,9 +24,9 @@ class PrintPrepareData public: bool is_from_plater = true; int plate_idx; - fs::path _3mf_path; - fs::path _3mf_config_path; - fs::path _temp_path; + boost::filesystem::path _3mf_path; + boost::filesystem::path _3mf_config_path; + boost::filesystem::path _temp_path; PrintPrepareData() { plate_idx = 0; } diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index c2b0e6f0a9..034a5e6d5d 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -8111,13 +8111,13 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_TAB, [this](SimpleEvent&) { select_next_view_3D(); }); preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_COLLAPSE_SIDEBAR, [this](SimpleEvent&) { this->q->collapse_sidebar(!this->q->is_sidebar_collapsed()); }); preview->get_wxglcanvas()->Bind(EVT_CUSTOMEVT_TICKSCHANGED, [this](wxCommandEvent& event) { - Type tick_event_type = (Type)event.GetInt(); + CustomGCode::Type tick_event_type = (CustomGCode::Type)event.GetInt(); Model& model = wxGetApp().plater()->model(); //BBS: replace model custom gcode with current plate custom gcode model.plates_custom_gcodes[model.curr_plate_index] = preview->get_canvas3d()->get_gcode_viewer().get_layers_slider()->GetTicksValues(); // BBS set to invalid state only - if (tick_event_type == Type::ToolChange || tick_event_type == Type::Custom || tick_event_type == Type::Template || tick_event_type == Type::PausePrint) { + if (tick_event_type == CustomGCode::Type::ToolChange || tick_event_type == CustomGCode::Type::Custom || tick_event_type == CustomGCode::Type::Template || tick_event_type == CustomGCode::Type::PausePrint) { PartPlate *plate = this->q->get_partplate_list().get_curr_plate(); if (plate) { plate->update_slice_result_valid_state(false); @@ -20544,7 +20544,7 @@ void Plater::on_filaments_delete(size_t num_filaments, size_t filament_id, int r // update customize gcode for (auto item = p->model.plates_custom_gcodes.begin(); item != p->model.plates_custom_gcodes.end(); ++item) { - auto iter = std::remove_if(item->second.gcodes.begin(), item->second.gcodes.end(), [filament_id](const Item& gcode_item) { + auto iter = std::remove_if(item->second.gcodes.begin(), item->second.gcodes.end(), [filament_id](const CustomGCode::Item& gcode_item) { return (gcode_item.type == CustomGCode::Type::ToolChange && gcode_item.extruder == filament_id + 1); }); if (replace_filament_id == -1) diff --git a/src/slic3r/GUI/PresetComboBoxes.cpp b/src/slic3r/GUI/PresetComboBoxes.cpp index 29e34d98a0..bd6b5f229c 100644 --- a/src/slic3r/GUI/PresetComboBoxes.cpp +++ b/src/slic3r/GUI/PresetComboBoxes.cpp @@ -2177,7 +2177,7 @@ void GUI::CalibrateFilamentComboBox::OnSelect(wxCommandEvent &evt) wxPostEvent(m_parent, e); } -void PlaterPresetComboBox::sys_color_changed() +void GUI::PlaterPresetComboBox::sys_color_changed() { PresetComboBox::sys_color_changed(); if (clr_picker) { diff --git a/src/slic3r/GUI/PrintHostDialogs.cpp b/src/slic3r/GUI/PrintHostDialogs.cpp index ee7d14552c..2e8047cf72 100644 --- a/src/slic3r/GUI/PrintHostDialogs.cpp +++ b/src/slic3r/GUI/PrintHostDialogs.cpp @@ -1752,8 +1752,8 @@ void ElegooPrintHostSendDialog::init() { } { - auto radioBoxA = new ::RadioBox(this); - auto radioBoxB = new ::RadioBox(this); + auto radioBoxA = new RadioBox(this); + auto radioBoxB = new RadioBox(this); if (m_BedType == BedType::btPC) radioBoxB->SetValue(true); else diff --git a/src/slic3r/GUI/TickCode.cpp b/src/slic3r/GUI/TickCode.cpp index 92997095b6..c8ad170862 100644 --- a/src/slic3r/GUI/TickCode.cpp +++ b/src/slic3r/GUI/TickCode.cpp @@ -6,6 +6,9 @@ #include namespace Slic3r { + +using namespace CustomGCode; + namespace GUI { std::string TickCodeInfo::get_color_for_tick(TickCode tick, Type type, const int extruder) { diff --git a/src/slic3r/GUI/TickCode.hpp b/src/slic3r/GUI/TickCode.hpp index e8cb848d76..e75ecc7a22 100644 --- a/src/slic3r/GUI/TickCode.hpp +++ b/src/slic3r/GUI/TickCode.hpp @@ -7,7 +7,6 @@ #include namespace Slic3r { -using namespace CustomGCode; namespace GUI { struct TickCode @@ -16,7 +15,7 @@ struct TickCode bool operator>(const TickCode& other) const { return other.tick < this->tick; } int tick = 0; - Type type = ColorChange; + CustomGCode::Type type = CustomGCode::ColorChange; int extruder = 0; std::string color; std::string extra; @@ -31,22 +30,22 @@ class TickCodeInfo std::vector* m_colors{ nullptr };// reference to IMSlider::m_extruder_colors - std::string get_color_for_tick(TickCode tick, Type type, const int extruder); + std::string get_color_for_tick(TickCode tick, CustomGCode::Type type, const int extruder); public: std::set ticks{}; - Mode mode = Undef; + CustomGCode::Mode mode = CustomGCode::Undef; bool empty() const { return ticks.empty(); } void set_pause_print_msg(const std::string& message) { pause_print_msg = message; } - bool add_tick(const int tick, Type type, int extruder, double print_z); + bool add_tick(const int tick, CustomGCode::Type type, int extruder, double print_z); bool edit_tick(std::set::iterator it, double print_z); - void switch_code(Type type_from, Type type_to); - bool switch_code_for_tick(std::set::iterator it, Type type_to, const int extruder); - void erase_all_ticks_with_code(Type type); + void switch_code(CustomGCode::Type type_from, CustomGCode::Type type_to); + bool switch_code_for_tick(std::set::iterator it, CustomGCode::Type type_to, const int extruder); + void erase_all_ticks_with_code(CustomGCode::Type type); - bool has_tick_with_code(Type type); + bool has_tick_with_code(CustomGCode::Type type); bool has_tick(int tick); void suppress_plus(bool suppress) { m_suppress_plus = suppress; } diff --git a/src/slic3r/Utils/SimplyPrint.cpp b/src/slic3r/Utils/SimplyPrint.cpp index 5c68878986..ff6860a244 100644 --- a/src/slic3r/Utils/SimplyPrint.cpp +++ b/src/slic3r/Utils/SimplyPrint.cpp @@ -115,7 +115,7 @@ static void set_auth(Http& http, const std::string& access_token) { http.header( static bool should_open_in_external_browser() { - const auto& app = wxGetApp(); + const auto& app = GUI::wxGetApp(); if (app.preset_bundle->use_bbl_device_tab()) { // When using bbl device tab, we always need to open external browser diff --git a/src/slic3r/plugin/host/PluginHostUi.cpp b/src/slic3r/plugin/host/PluginHostUi.cpp index 54de1df0d6..46d46b402f 100644 --- a/src/slic3r/plugin/host/PluginHostUi.cpp +++ b/src/slic3r/plugin/host/PluginHostUi.cpp @@ -565,7 +565,7 @@ void progress_close(int id) }); } -void plater_notification(NotificationManager::NotificationLevel notification_level, const std::string& text, +void plater_notification(GUI::NotificationManager::NotificationLevel notification_level, const std::string& text, const std::string& hypertext, py::object on_click) { const std::string plugin_key = PluginAuditManager::instance().current_plugin(); @@ -600,7 +600,7 @@ void plater_notification(NotificationManager::NotificationLevel notification_lev } run_on_ui_blocking([notification_level, text, hypertext, callback = std::move(callback)]() mutable { - wxGetApp().plater()->get_notification_manager()->push_notification(NotificationType::CustomNotification, notification_level, text, + GUI::wxGetApp().plater()->get_notification_manager()->push_notification(GUI::NotificationType::CustomNotification, notification_level, text, hypertext, std::move(callback)); }); } @@ -713,16 +713,16 @@ void PluginHostUi::RegisterBindings(pybind11::module_& host) py::arg("maximum") = 100, py::arg("style") = wxPD_APP_MODAL | wxPD_AUTO_HIDE, "Create a native progress dialog and return a ProgressDialog handle."); - py::enum_(ui, "NotificationLevel") - .value("ProgressBarNotificationLevel", NotificationManager::NotificationLevel::ProgressBarNotificationLevel) - .value("HintNotificationLevel", NotificationManager::NotificationLevel::HintNotificationLevel) - .value("RegularNotificationLevel", NotificationManager::NotificationLevel::RegularNotificationLevel) - .value("PrintInfoNotificationLevel", NotificationManager::NotificationLevel::PrintInfoNotificationLevel) - .value("PrintInfoShortNotificationLevel", NotificationManager::NotificationLevel::PrintInfoShortNotificationLevel) - .value("ImportantNotificationLevel", NotificationManager::NotificationLevel::ImportantNotificationLevel) - .value("WarningNotificationLevel", NotificationManager::NotificationLevel::WarningNotificationLevel) - .value("SeriousWarningNotificationLevel", NotificationManager::NotificationLevel::SeriousWarningNotificationLevel) - .value("ErrorNotificationLevel", NotificationManager::NotificationLevel::ErrorNotificationLevel) + py::enum_(ui, "NotificationLevel") + .value("ProgressBarNotificationLevel", GUI::NotificationManager::NotificationLevel::ProgressBarNotificationLevel) + .value("HintNotificationLevel", GUI::NotificationManager::NotificationLevel::HintNotificationLevel) + .value("RegularNotificationLevel", GUI::NotificationManager::NotificationLevel::RegularNotificationLevel) + .value("PrintInfoNotificationLevel", GUI::NotificationManager::NotificationLevel::PrintInfoNotificationLevel) + .value("PrintInfoShortNotificationLevel", GUI::NotificationManager::NotificationLevel::PrintInfoShortNotificationLevel) + .value("ImportantNotificationLevel", GUI::NotificationManager::NotificationLevel::ImportantNotificationLevel) + .value("WarningNotificationLevel", GUI::NotificationManager::NotificationLevel::WarningNotificationLevel) + .value("SeriousWarningNotificationLevel", GUI::NotificationManager::NotificationLevel::SeriousWarningNotificationLevel) + .value("ErrorNotificationLevel", GUI::NotificationManager::NotificationLevel::ErrorNotificationLevel) .export_values(); ui.def("push_notification", &plater_notification, py::arg("notification_level"), py::arg("text"),