diff --git a/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp b/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp
index 90325e2117..7bf9635a4d 100644
--- a/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp
+++ b/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp
@@ -137,6 +137,14 @@ GLGizmoEmboss::GLGizmoEmboss(GLCanvas3D &parent)
// Private namespace with helper function for create volume
namespace priv {
+
+///
+/// Check if volume type is possible use for new text volume
+///
+/// Type
+/// True when allowed otherwise false
+static bool is_valid(ModelVolumeType volume_type);
+
///
/// Prepare data for emboss
///
@@ -146,8 +154,6 @@ namespace priv {
/// Base data for emboss text
static DataBase create_emboss_data_base(const std::string &text, StyleManager &style_manager, std::shared_ptr> &cancel);
-static bool is_valid(ModelVolumeType volume_type);
-
///
/// Start job for add new volume to object with given transformation
///
@@ -200,6 +206,7 @@ static void find_closest_volume(const Selection &selection,
/// Screen coordinat, where to create new object laying on bed
static void start_create_object_job(DataBase &emboss_data, const Vec2d &coor);
+// Loaded icons enum
// Have to match order of files in function GLGizmoEmboss::init_icons()
enum class IconType : unsigned {
rename = 0,
@@ -218,21 +225,13 @@ enum class IconType : unsigned {
};
// Define rendered version of icon
enum class IconState : unsigned { activable = 0, hovered /*1*/, disabled /*2*/ };
+// selector for icon by enum
const IconManager::Icon &get_icon(const IconManager::VIcons& icons, IconType type, IconState state);
+// short call of Slic3r::GUI::button
bool draw_button(const IconManager::VIcons& icons, IconType type, bool disable = false);
} // namespace priv
-bool priv::is_valid(ModelVolumeType volume_type){
- if (volume_type == ModelVolumeType::MODEL_PART ||
- volume_type == ModelVolumeType::NEGATIVE_VOLUME ||
- volume_type == ModelVolumeType::PARAMETER_MODIFIER)
- return true;
-
- BOOST_LOG_TRIVIAL(error) << "Can't create embossed volume with this type: " << (int)volume_type;
- return false;
-}
-
void GLGizmoEmboss::create_volume(ModelVolumeType volume_type, const Vec2d& mouse_pos)
{
if (!priv::is_valid(volume_type)) return;
@@ -350,7 +349,7 @@ namespace priv {
/// Get transformation to world
/// - use fix after store to 3mf when exists
///
-///
+/// Scene volume
/// To identify MovelVolume with fix transformation
///
static Transform3d world_matrix(const GLVolume *gl_volume, const Model *model);
@@ -544,26 +543,6 @@ static void draw_mouse_offset(const std::optional &offset)
}
#endif // SHOW_OFFSET_DURING_DRAGGING
-namespace priv {
-static void draw_cross_hair(const ImVec2 &position,
- float radius = 16.f,
- ImU32 color = ImGui::GetColorU32(ImVec4(1.f, 1.f, 1.f, .75f)),
- int num_segments = 0,
- float thickness = 4.f);
-} // namespace priv
-
-void priv::draw_cross_hair(const ImVec2 &position, float radius, ImU32 color, int num_segments, float thickness)
-{
- auto draw_list = ImGui::GetOverlayDrawList();
- draw_list->AddCircle(position, radius, color, num_segments, thickness);
- auto dirs = {ImVec2{0, 1}, ImVec2{1, 0}, ImVec2{0, -1}, ImVec2{-1, 0}};
- for (const ImVec2 &dir : dirs) {
- ImVec2 start(position.x + dir.x * 0.5 * radius, position.y + dir.y * 0.5 * radius);
- ImVec2 end(position.x + dir.x * 1.5 * radius, position.y + dir.y * 1.5 * radius);
- draw_list->AddLine(start, end, color, thickness);
- }
-}
-
void GLGizmoEmboss::on_render_input_window(float x, float y, float bottom_limit)
{
set_volume_by_selection();
@@ -610,7 +589,7 @@ void GLGizmoEmboss::on_render_input_window(float x, float y, float bottom_limit)
ImVec4(1.f, .3f, .3f, .75f)
); // Warning color
const float radius = 16.f;
- priv::draw_cross_hair(center, radius, color);
+ ImGuiWrapper::draw_cross_hair(center, radius, color);
}
#ifdef SHOW_FINE_POSITION
@@ -3519,6 +3498,16 @@ std::string GLGizmoEmboss::get_file_name(const std::string &file_path)
// priv namespace implementation
///////////////
+bool priv::is_valid(ModelVolumeType volume_type)
+{
+ if (volume_type == ModelVolumeType::MODEL_PART || volume_type == ModelVolumeType::NEGATIVE_VOLUME ||
+ volume_type == ModelVolumeType::PARAMETER_MODIFIER)
+ return true;
+
+ BOOST_LOG_TRIVIAL(error) << "Can't create embossed volume with this type: " << (int) volume_type;
+ return false;
+}
+
DataBase priv::create_emboss_data_base(const std::string &text, StyleManager &style_manager, std::shared_ptr>& cancel)
{
// create volume_name
diff --git a/src/slic3r/GUI/ImGuiWrapper.cpp b/src/slic3r/GUI/ImGuiWrapper.cpp
index 6057570518..55bf576028 100644
--- a/src/slic3r/GUI/ImGuiWrapper.cpp
+++ b/src/slic3r/GUI/ImGuiWrapper.cpp
@@ -1514,6 +1514,17 @@ void ImGuiWrapper::draw(
}
}
+void ImGuiWrapper::draw_cross_hair(const ImVec2 &position, float radius, ImU32 color, int num_segments, float thickness) {
+ auto draw_list = ImGui::GetOverlayDrawList();
+ draw_list->AddCircle(position, radius, color, num_segments, thickness);
+ auto dirs = {ImVec2{0, 1}, ImVec2{1, 0}, ImVec2{0, -1}, ImVec2{-1, 0}};
+ for (const ImVec2 &dir : dirs) {
+ ImVec2 start(position.x + dir.x * 0.5 * radius, position.y + dir.y * 0.5 * radius);
+ ImVec2 end(position.x + dir.x * 1.5 * radius, position.y + dir.y * 1.5 * radius);
+ draw_list->AddLine(start, end, color, thickness);
+ }
+}
+
bool ImGuiWrapper::contain_all_glyphs(const ImFont *font,
const std::string &text)
{
diff --git a/src/slic3r/GUI/ImGuiWrapper.hpp b/src/slic3r/GUI/ImGuiWrapper.hpp
index 56b5daee66..077bf568de 100644
--- a/src/slic3r/GUI/ImGuiWrapper.hpp
+++ b/src/slic3r/GUI/ImGuiWrapper.hpp
@@ -199,6 +199,20 @@ public:
ImU32 color = ImGui::GetColorU32(COL_ORANGE_LIGHT),
float thickness = 3.f);
+ ///
+ /// Draw symbol of cross hair
+ ///
+ /// Center of cross hair
+ /// Circle radius
+ /// Color of symbol
+ /// Precission of circle
+ /// Thickness of Line in symbol
+ static void draw_cross_hair(const ImVec2 &position,
+ float radius = 16.f,
+ ImU32 color = ImGui::GetColorU32(ImVec4(1.f, 1.f, 1.f, .75f)),
+ int num_segments = 0,
+ float thickness = 4.f);
+
///
/// Check that font ranges contain all chars in string
/// (rendered Unicodes are stored in GlyphRanges)