OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::GUI::GLGizmoEmboss Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/Gizmos/GLGizmoEmboss.hpp>

Inheritance diagram for Slic3r::GUI::GLGizmoEmboss:
Collaboration diagram for Slic3r::GUI::GLGizmoEmboss:

Classes

struct  Facenames
struct  GuiCfg

Public Types

enum class  EGrabberExtension {
  None = 0 , PosX = 1 << 0 , NegX = 1 << 1 , PosY = 1 << 2 ,
  NegY = 1 << 3 , PosZ = 1 << 4 , NegZ = 1 << 5
}
enum  EState { Off , On , Num_States }

Public Member Functions

 GLGizmoEmboss (GLCanvas3D &parent, const std::string &icon_filename, unsigned int sprite_id)
bool create_volume (ModelVolumeType volume_type, const Vec2d &mouse_pos)
 Create new embossed text volume by type on position of mouse.
bool create_volume (ModelVolumeType volume_type)
 Create new text without given position.
void on_shortcut_key ()
 Handle pressing of shortcut.
bool do_mirror (size_t axis)
 Mirroring from object manipulation panel !! Emboss gizmo must be active.
bool init ()
void load (cereal::BinaryInputArchive &ar)
void save (cereal::BinaryOutputArchive &ar) const
std::string get_name (bool include_shortcut=true) const
EState get_state () const
void set_state (EState state)
std::optional< Shortcut > shortcut () const
const std::string & get_icon_filename () const
void set_icon_filename (const std::string &filename)
bool is_activable () const
bool is_selectable () const
CommonGizmosDataID get_requirements () const
virtual bool render_follows_cursor () const
void set_common_data_pool (CommonGizmosDataPool *ptr)
virtual bool apply_clipping_plane ()
unsigned int get_sprite_id () const
int get_hover_id () const
void set_hover_id (int id)
bool is_dragging () const
bool update_items_state ()
void render ()
void render_input_window (float x, float y, float bottom_limit)
virtual void on_change_color_mode (bool is_dark)
virtual std::string get_tooltip () const
 Mouse tooltip text.
int get_count ()
std::string get_gizmo_name ()
void register_raycasters_for_picking ()
void unregister_raycasters_for_picking ()
virtual bool is_in_editing_mode () const
virtual bool is_selection_rectangle_dragging () const

Static Public Member Functions

static bool re_emboss (const ModelVolume &text, std::shared_ptr< std::atomic< bool > > job_cancel=nullptr)
 Call on change inside of object conatining projected volume.
static void update_render_colors ()
static void load_render_colors ()

Static Public Attributes

static const unsigned int BASE_ID = 255 * 255 * 254
static const unsigned int GRABBER_ELEMENTS_MAX_COUNT = 7
static float INV_ZOOM = 1.0f
static ColorRGBA DEFAULT_BASE_COLOR = { 0.625f, 0.625f, 0.625f, 1.0f }
static ColorRGBA DEFAULT_DRAG_COLOR = { 1.0f, 1.0f, 1.0f, 1.0f }
static ColorRGBA DEFAULT_HIGHLIGHT_COLOR = {1.0f, 0.38f, 0.0f, 1.0f}
static std::array< ColorRGBA, 3 > AXES_COLOR
static std::array< ColorRGBA, 3 > AXES_HOVER_COLOR
static ColorRGBA CONSTRAINED_COLOR = {0.5f, 0.5f, 0.5f, 1.0f}
static ColorRGBA FLATTEN_COLOR = {0.96f, 0.93f, 0.93f, 0.5f}
static ColorRGBA FLATTEN_HOVER_COLOR = {1.0f, 1.0f, 1.0f, 0.75f}
static ColorRGBA GRABBER_NORMAL_COL = {1.0f, 1.0f, 1.0f, 1.0f}
static ColorRGBA GRABBER_HOVER_COL = {0.863f, 0.125f, 0.063f, 1.0f}
static ColorRGBA GRABBER_UNIFORM_COL = {0, 1.0, 1.0, 1.0f}
static ColorRGBA GRABBER_UNIFORM_HOVER_COL = {0, 0.7, 0.7, 1.0f}

Protected Member Functions

bool on_init () override
std::string on_get_name () const override
void on_render () override
void on_register_raycasters_for_picking () override
void on_unregister_raycasters_for_picking () override
void on_render_input_window (float x, float y, float bottom_limit) override
void on_set_state () override
void data_changed (bool is_serializing) override
 Is called when data (Selection) is changed.
void on_set_hover_id () override
void on_enable_grabber (unsigned int id) override
void on_disable_grabber (unsigned int id) override
void on_start_dragging () override
void on_stop_dragging () override
void on_dragging (const UpdateData &data) override
void push_button_style (bool pressed)
void pop_button_style ()
bool on_mouse (const wxMouseEvent &mouse_event) override
 Rotate by text on dragging rotate grabers.
bool wants_enter_leave_snapshots () const override
std::string get_gizmo_entering_text () const override
std::string get_gizmo_leaving_text () const override
std::string get_action_snapshot_name () const override
bool render_combo (const std::string &label, const std::vector< std::string > &lines, int &selection_idx, float label_width, float item_width)
void render_cross_mark (const Vec3f &target, bool is_single=false)
virtual void on_load (cereal::BinaryInputArchive &ar)
virtual void on_save (cereal::BinaryOutputArchive &ar) const
virtual bool on_is_activable () const
virtual bool on_is_selectable () const
virtual CommonGizmosDataID on_get_requirements () const
bool GizmoImguiBegin (const std::string &name, int flags)
void GizmoImguiEnd ()
void GizmoImguiSetNextWIndowPos (float &x, float y, int flag, float pivot_x=0.0f, float pivot_y=0.0f)
void GizmoImguiSetNextWIndowPos (float &x, float y, float w, float h, int flag, float pivot_x=0.0f, float pivot_y=0.0f)
void register_grabbers_for_picking ()
void unregister_grabbers_for_picking ()
void render_grabbers (const BoundingBoxf3 &box) const
void render_grabbers (float size) const
void render_grabbers (size_t first, size_t last, float size, bool force_hover) const
std::string format (float value, unsigned int decimals) const
void set_dirty ()
bool use_grabbers (const wxMouseEvent &mouse_event)
 function which Set up m_dragging and call functions on_start_dragging / on_dragging / on_stop_dragging
void do_stop_dragging (bool perform_mouse_cleanup)

Protected Attributes

GLCanvas3D & m_parent
int m_group_id
EState m_state
std::optional< Shortcut > m_shortcut
std::string m_icon_filename
unsigned int m_sprite_id
int m_hover_id { -1 }
bool m_dragging { false }
std::vector< Grabber > m_grabbers
ImGuiWrapper * m_imgui
bool m_first_input_window_render { true }
CommonGizmosDataPool * m_c { nullptr }
bool m_is_dark_mode = false
float last_input_window_width = 0

Private Member Functions

void volume_transformation_changing ()
void volume_transformation_changed ()
bool init_create (ModelVolumeType volume_type)
void set_volume_by_selection ()
void reset_volume ()
bool is_changed_from_default_style ()
void reset_to_default_style ()
bool process (bool make_snapshot=true)
void close ()
void draw_window (float x, float y)
void draw_text_input ()
void draw_model_type ()
void draw_style_list ()
void draw_delete_style_button ()
void draw_style_rename_popup ()
void draw_style_rename_button ()
void draw_style_save_button (bool is_modified)
void draw_style_save_as_popup ()
void draw_style_add_button ()
void init_font_name_texture ()
void draw_font_list_line ()
void draw_font_list ()
void draw_height (bool use_inch)
void draw_depth (bool use_inch)
bool set_height ()
bool draw_italic_button ()
bool draw_bold_button ()
void draw_advanced ()
bool select_facename (const wxString &facename)
template<typename T>
bool rev_input_mm (const std::string &name, T &value, const T *default_value, const std::string &undo_tooltip, T step, T step_fast, const char *format, bool use_inch, const std::optional< float > &scale) const
template<typename T>
bool rev_input (const std::string &name, T &value, const T *default_value, const std::string &undo_tooltip, T step, T step_fast, const char *format, ImGuiInputTextFlags flags=0) const
 Reversible input float with option to restor default value TODO: make more general, static and move to ImGuiWrapper.
bool rev_checkbox (const std::string &name, bool &value, const bool *default_value, const std::string &undo_tooltip) const
bool rev_slider (const std::string &name, std::optional< int > &value, const std::optional< int > *default_value, const std::string &undo_tooltip, int v_min, int v_max, const std::string &format, const wxString &tooltip) const
bool rev_slider (const std::string &name, std::optional< float > &value, const std::optional< float > *default_value, const std::string &undo_tooltip, float v_min, float v_max, const std::string &format, const wxString &tooltip) const
bool rev_slider (const std::string &name, float &value, const float *default_value, const std::string &undo_tooltip, float v_min, float v_max, const std::string &format, const wxString &tooltip) const
template<typename T, typename Draw>
bool revertible (const std::string &name, T &value, const T *default_value, const std::string &undo_tooltip, float undo_offset, Draw draw) const
bool on_mouse_for_rotation (const wxMouseEvent &mouse_event)
bool on_mouse_for_translate (const wxMouseEvent &mouse_event)
void on_mouse_change_selection (const wxMouseEvent &mouse_event)
void create_notification_not_valid_font (const TextConfiguration &tc)
void create_notification_not_valid_font (const std::string &text)
void remove_notification_not_valid_font ()
void reinit_text_lines (unsigned count_lines=0)
void calculate_scale ()
void init_icons ()

Static Private Member Functions

static EmbossStyles create_default_styles ()

Private Attributes

bool m_is_unknown_font = false
std::unique_ptr< const GuiCfg > m_gui_cfg
bool m_is_advanced_edit_style = false
Emboss::StyleManager m_style_manager
std::unique_ptr< Facenames > m_face_names
std::string m_text
bool m_keep_up = true
ModelVolume * m_volume = nullptr
ObjectID m_volume_id
bool m_text_contain_unknown_glyph = false
std::shared_ptr< std::atomic< bool > > m_job_cancel = nullptr
TextLinesModel m_text_lines
GLGizmoRotate m_rotate_gizmo
std::optional< float > m_rotate_start_angle
std::optional< SurfaceDrag > m_surface_drag
RaycastManager m_raycast_manager
std::optional< float > m_scale_height
std::optional< float > m_scale_depth
IconManager m_icon_manager
IconManager::VIcons m_icons
std::vector< std::pair< wxString, wxString > > m_shortcuts
bool m_dirty { false }
int count = 0

Static Private Attributes

static const std::string M_ICON_FILENAME

Detailed Description

Member Enumeration Documentation

◆ EGrabberExtension

enum class Slic3r::GUI::GLGizmoBase::EGrabberExtension
stronginherited
Enumerator
None 
PosX 
NegX 
PosY 
NegY 
PosZ 
NegZ 
74 {
75 None = 0,
76 PosX = 1 << 0,
77 NegX = 1 << 1,
78 PosY = 1 << 2,
79 NegY = 1 << 3,
80 PosZ = 1 << 4,
81 NegZ = 1 << 5,
82 };
@ PosX
Definition PrintConfig.hpp:350
@ NegY
Definition PrintConfig.hpp:351
@ NegX
Definition PrintConfig.hpp:351
@ PosY
Definition PrintConfig.hpp:350
@ NegZ
Definition PrintConfig.hpp:351
@ PosZ
Definition PrintConfig.hpp:350
@ None
Definition SketchEngine.hpp:180

◆ EState

Enumerator
Off 
On 
Num_States 
126 {
127 Off,
128 On,
130 };
@ On
Definition GLGizmoBase.hpp:128
@ Num_States
Definition GLGizmoBase.hpp:129
@ Off
Definition GLGizmoBase.hpp:127

Constructor & Destructor Documentation

◆ GLGizmoEmboss()

GLGizmoEmboss::GLGizmoEmboss ( GLCanvas3D & parent,
const std::string & icon_filename,
unsigned int sprite_id )
explicit
358 : GLGizmoBase(parent, icon_filename, sprite_id)
359 , m_gui_cfg(nullptr)
360 , m_style_manager(m_imgui->get_glyph_ranges(), create_default_styles)
361 , m_face_names(std::make_unique<Facenames>())
362 , m_rotate_gizmo(parent, GLGizmoRotate::Axis::Z) // grab id = 2 (Z axis)
363{
364 m_rotate_gizmo.set_group_id(0);
365 m_rotate_gizmo.set_force_local_coordinate(true);
366 // to use https://fontawesome.com/ (copy & paste) unicode symbols from web
367 // paste HEX unicode into notepad move cursor after unicode press [alt] + [x]
368}
ImGuiWrapper * m_imgui
Definition GLGizmoBase.hpp:153
GLGizmoBase(GLCanvas3D &parent, const std::string &icon_filename, unsigned int sprite_id)
Definition GLGizmoBase.cpp:327
static EmbossStyles create_default_styles()
Definition GLGizmoEmboss.cpp:1072
Emboss::StyleManager m_style_manager
Definition GLGizmoEmboss.hpp:188
GLGizmoRotate m_rotate_gizmo
Definition GLGizmoEmboss.hpp:219
std::unique_ptr< Facenames > m_face_names
Definition GLGizmoEmboss.hpp:192
std::unique_ptr< const GuiCfg > m_gui_cfg
Definition GLGizmoEmboss.hpp:182
@ Z
Definition GLGizmoRotate.hpp:36

References Slic3r::GUI::GLGizmoBase::GLGizmoBase(), create_default_styles(), m_face_names, m_gui_cfg, Slic3r::GUI::GLGizmoBase::m_imgui, m_rotate_gizmo, m_style_manager, Slic3r::make_unique(), and Slic3r::Z.

Here is the call graph for this function:

Member Function Documentation

◆ apply_clipping_plane()

virtual bool Slic3r::GUI::GLGizmoBase::apply_clipping_plane ( )
inlinevirtualinherited
195{ return true; }

Referenced by Slic3r::GUI::GLCanvas3D::_render_objects(), and Slic3r::GUI::GLCanvas3D::get_raycaster_clipping_plane().

Here is the caller graph for this function:

◆ calculate_scale()

void GLGizmoEmboss::calculate_scale ( )
private
1411 {
1412 Transform3d to_world = m_parent.get_selection().get_first_volume()->world_matrix();
1413 auto to_world_linear = to_world.linear();
1414 auto calc = [&to_world_linear](const Vec3d &axe, std::optional<float>& scale)->bool {
1415 Vec3d axe_world = to_world_linear * axe;
1416 double norm_sq = axe_world.squaredNorm();
1417 if (is_approx(norm_sq, 1.)) {
1418 if (scale.has_value())
1419 scale.reset();
1420 else
1421 return false;
1422 } else {
1423 scale = sqrt(norm_sq);
1424 }
1425 return true;
1426 };
1427
1428 bool exist_change = calc(Vec3d::UnitY(), m_scale_height);
1429 exist_change |= calc(Vec3d::UnitZ(), m_scale_depth);
1430
1431 // Change of scale has to change font imgui font size
1432 if (exist_change)
1433 m_style_manager.clear_imgui_font();
1434}
bool exist_change(const T &value, const T *default_value)
Definition GLGizmoEmboss.cpp:2571
int scale(const int val)
Definition WipeTowerDialog.cpp:58
GLCanvas3D & m_parent
Definition GLGizmoBase.hpp:143
std::optional< float > m_scale_depth
Definition GLGizmoEmboss.hpp:232
std::optional< float > m_scale_height
Definition GLGizmoEmboss.hpp:231
Eigen::Matrix< double, 3, 1, Eigen::DontAlign > Vec3d
Definition Point.hpp:68
Eigen::Transform< double, 3, Eigen::Affine, Eigen::DontAlign > Transform3d
Definition Point.hpp:96
constexpr bool is_approx(Number value, Number test_value, Number precision=EPSILON)
Definition libslic3r.h:320

References exist_change(), Slic3r::is_approx(), Slic3r::GUI::GLGizmoBase::m_parent, m_scale_depth, m_scale_height, m_style_manager, and scale().

Referenced by on_mouse_for_translate(), set_volume_by_selection(), and volume_transformation_changed().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ close()

void GLGizmoEmboss::close ( )
private
1468{
1469 // remove volume when text is empty
1470 if (m_volume != nullptr &&
1471 m_volume->text_configuration.has_value() &&
1473 Plater &p = *wxGetApp().plater();
1474 // is the text object?
1475 if (m_volume->is_the_only_one_part()) {
1476 // delete whole object
1477 p.remove(m_parent.get_selection().get_object_idx());
1478 } else {
1479 // delete text volume
1480 p.remove_selected();
1481 }
1482 }
1483
1484 // close gizmo == open it again
1485 auto& mng = m_parent.get_gizmos_manager();
1486 if (mng.get_current_type() == GLGizmosManager::Emboss)
1487 mng.open_gizmo(GLGizmosManager::Emboss);
1488}
std::string m_text
Definition GLGizmoEmboss.hpp:195
ModelVolume * m_volume
Definition GLGizmoEmboss.hpp:202
@ Emboss
Definition GLGizmosManager.hpp:99
void remove(size_t obj_idx)
Definition Plater.cpp:19185
void remove_selected()
Definition Plater.cpp:19267
@ Plater
Definition Shortcuts.hpp:21
bool is_text_empty(std::string_view text)
Definition GLGizmoEmboss.cpp:1437

References Slic3r::GUI::GLGizmosManager::Emboss, Slic3r::GUI::GLGizmoBase::m_parent, m_text, m_volume, Slic3r::GUI::Plater::remove(), and Slic3r::GUI::Plater::remove_selected().

Referenced by data_changed(), on_mouse_change_selection(), and on_render_input_window().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_default_styles()

EmbossStyles GLGizmoEmboss::create_default_styles ( )
staticprivate
1073{
1074 wxFontEnumerator::InvalidateCache();
1075 wxArrayString facenames = wxFontEnumerator::GetFacenames(Facenames::encoding);
1076
1077 wxFont wx_font_normal = *wxNORMAL_FONT;
1078#ifdef __APPLE__
1079 // Set normal font to helvetica when possible
1080 for (const wxString &facename : facenames) {
1081 if (facename.IsSameAs("Helvetica")) {
1082 wx_font_normal = wxFont(wxFontInfo().FaceName(facename).Encoding(Facenames::encoding));
1083 break;
1084 }
1085 }
1086#endif // __APPLE__
1087
1088 // https://docs.wxwidgets.org/3.0/classwx_font.html
1089 // Predefined objects/pointers: wxNullFont, wxNORMAL_FONT, wxSMALL_FONT, wxITALIC_FONT, wxSWISS_FONT
1090 EmbossStyles styles = {
1091 WxFontUtils::create_emboss_style(wx_font_normal, _u8L("NORMAL")), // wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)
1092 WxFontUtils::create_emboss_style(*wxSMALL_FONT, _u8L("SMALL")), // A font using the wxFONTFAMILY_SWISS family and 2 points smaller than wxNORMAL_FONT.
1093 WxFontUtils::create_emboss_style(*wxITALIC_FONT, _u8L("ITALIC")), // A font using the wxFONTFAMILY_ROMAN family and wxFONTSTYLE_ITALIC style and of the same size of wxNORMAL_FONT.
1094 WxFontUtils::create_emboss_style(*wxSWISS_FONT, _u8L("SWISS")), // A font identic to wxNORMAL_FONT except for the family used which is wxFONTFAMILY_SWISS.
1095 WxFontUtils::create_emboss_style(wxFont(10, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD), _u8L("MODERN")),
1096 };
1097
1098 // Not all predefined font for wx must be valid TTF, but at least one style must be loadable
1099 styles.erase(std::remove_if(styles.begin(), styles.end(), [](const EmbossStyle& style) {
1100 wxFont wx_font = WxFontUtils::create_wxFont(style);
1101
1102 // check that face name is setabled
1103 if (style.prop.face_name.has_value()) {
1104 wxString face_name = wxString::FromUTF8(style.prop.face_name->c_str());
1105 wxFont wx_font_temp;
1106 if (!wx_font_temp.SetFaceName(face_name))
1107 return true;
1108 }
1109
1110 // Check that exsit valid TrueType Font for wx font
1111 return WxFontUtils::create_font_file(wx_font) == nullptr;
1112 }),styles.end()
1113 );
1114
1115 // No valid style in defult list
1116 // at least one style must contain loadable font
1117 if (styles.empty()) {
1118 wxFont wx_font;
1119 for (const wxString &face : facenames) {
1120 wx_font = wxFont(face);
1121 if (WxFontUtils::create_font_file(wx_font) != nullptr)
1122 break;
1123 wx_font = wxFont(); // NotOk
1124 }
1125
1126 if (wx_font.IsOk()) {
1127 // use first alphabetic sorted installed font
1128 styles.push_back(WxFontUtils::create_emboss_style(wx_font, _u8L("First font")));
1129 } else {
1130 // On current OS is not installed any correct TTF font
1131 // use font packed with OrcaSlicer
1132 std::string font_path = Slic3r::resources_dir() + "/fonts/HarmonyOS_Sans_SC_Regular.ttf";
1133 styles.push_back(EmbossStyle{_u8L("Default font"), font_path, EmbossStyle::Type::file_path});
1134 }
1135 }
1137 return styles;
1138}
#define style
Definition WipeTowerDialog.cpp:101
static std::unique_ptr< Slic3r::Emboss::FontFile > create_font_file(const wxFont &font)
Definition WxFontUtils.cpp:93
static EmbossStyle create_emboss_style(const wxFont &font, const std::string &name="")
Definition WxFontUtils.cpp:133
std::vector< EmbossStyle > EmbossStyles
Definition TextConfiguration.hpp:168
const std::string & resources_dir()
Definition utils.cpp:296
void add_style_for_default_text(EmbossStyles &styles)
Definition GLGizmoEmboss.cpp:542
#define _u8L(s)
Definition I18N.hpp:11
@ file_path
Definition TextConfiguration.hpp:148
static const wxFontEncoding encoding
Definition GLGizmoEmboss.cpp:259

References _u8L, Slic3r::GUI::WxFontUtils::create_emboss_style(), Slic3r::GUI::WxFontUtils::create_font_file(), anonymous_namespace{GLGizmoEmboss.cpp}::Facenames::encoding, and style.

Referenced by GLGizmoEmboss(), and re_emboss().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_notification_not_valid_font() [1/2]

void GLGizmoEmboss::create_notification_not_valid_font ( const std::string & text)
private
3329 {
3330 // not neccessary, but for sure that old notification doesnt exist
3333 m_is_unknown_font = true;
3334
3337 auto notification_manager = wxGetApp().plater()->get_notification_manager();
3338 notification_manager->push_notification(type, level, text);
3339}
bool m_is_unknown_font
Definition GLGizmoEmboss.hpp:176
void remove_notification_not_valid_font()
Definition GLGizmoEmboss.cpp:3341
@ WarningNotificationLevel
Definition NotificationManager.hpp:224
@ UnknownFont
Definition NotificationManager.hpp:147

References m_is_unknown_font, remove_notification_not_valid_font(), Slic3r::GUI::UnknownFont, and Slic3r::GUI::NotificationManager::WarningNotificationLevel.

Here is the call graph for this function:

◆ create_notification_not_valid_font() [2/2]

void GLGizmoEmboss::create_notification_not_valid_font ( const TextConfiguration & tc)
private
3306{
3307 const EmbossStyle &es = m_style_manager.get_style();
3308 const auto &face_name_opt = es.prop.face_name;
3309 const std::string &face_name_3mf = tc.style.prop.face_name.value_or(tc.style.path);
3310
3311 std::optional<std::string> face_name_by_wx;
3312 if (!face_name_opt.has_value()) {
3313 const wxFont& wx_font = m_style_manager.get_wx_font();
3314 if (wx_font.IsOk()) {
3315 wxString wx_face_name = wx_font.GetFaceName();
3316 if (!wx_face_name.empty())
3317 face_name_by_wx = std::string(wx_face_name.ToUTF8().data());
3318 }
3319 }
3320 const std::string &face_name = face_name_opt.value_or(face_name_by_wx.value_or(es.path));
3321 std::string text =
3322 GUI::format(_L("Can't load exactly same font (\"%1%\"). "
3323 "Application selected a similar one (\"%2%\"). "
3324 "You have to specify font for enable edit text."),
3325 face_name_3mf, face_name);
3327}
#define _L(s)
Definition OBJ.cpp:34
void create_notification_not_valid_font(const TextConfiguration &tc)
Definition GLGizmoEmboss.cpp:3304
std::string format(const char *fmt, TArgs &&... args)
Definition format.hpp:36
FontProp prop
Definition TextConfiguration.hpp:131
std::string path
Definition TextConfiguration.hpp:124
std::optional< std::string > face_name
Definition TextConfiguration.hpp:68
EmbossStyle style
Definition TextConfiguration.hpp:178

References _L, create_notification_not_valid_font(), Slic3r::FontProp::face_name, Slic3r::GUI::format(), m_style_manager, Slic3r::EmbossStyle::path, Slic3r::EmbossStyle::prop, and Slic3r::TextConfiguration::style.

Referenced by create_notification_not_valid_font(), on_render_input_window(), and set_volume_by_selection().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_volume() [1/2]

bool GLGizmoEmboss::create_volume ( ModelVolumeType volume_type)

Create new text without given position.

Parameters
volume_typeObject part / Negative volume / Modifier
383{
384 if (!init_create(volume_type))
385 return false;
386
387 // NOTE: change style manager - be carefull with order changes
389 CreateVolumeParams input = create_input(m_parent, m_style_manager.get_style(), m_raycast_manager, volume_type);
390 return start_create_volume_without_position(input, std::move(base));
391}
std::shared_ptr< std::atomic< bool > > m_job_cancel
Definition GLGizmoEmboss.hpp:212
RaycastManager m_raycast_manager
Definition GLGizmoEmboss.hpp:228
bool init_create(ModelVolumeType volume_type)
Definition GLGizmoEmboss.cpp:562
TextLinesModel m_text_lines
Definition GLGizmoEmboss.hpp:215
std::unique_ptr< DataBase > DataBasePtr
Definition EmbossJob.hpp:105
bool start_create_volume_without_position(CreateVolumeParams &input, DataBasePtr data)
Same as previous function but without mouse position Need to suggest position or put near the selecti...
Definition EmbossJob.cpp:616
std::unique_ptr< DataBase > create_emboss_data_base(const std::string &text, StyleManager &style_manager, TextLinesModel &text_lines, const Selection &selection, ModelVolumeType type, std::shared_ptr< std::atomic< bool > > &cancel)
Prepare data for emboss.
Definition GLGizmoEmboss.cpp:3468
CreateVolumeParams create_input(GLCanvas3D &canvas, const StyleManager::Style &style, RaycastManager &raycaster, ModelVolumeType volume_type)
Definition GLGizmoEmboss.cpp:3521

References init_create(), m_job_cancel, Slic3r::GUI::GLGizmoBase::m_parent, m_raycast_manager, m_style_manager, m_text, m_text_lines, and Slic3r::GUI::Emboss::start_create_volume_without_position().

Here is the call graph for this function:

◆ create_volume() [2/2]

bool GLGizmoEmboss::create_volume ( ModelVolumeType volume_type,
const Vec2d & mouse_pos )

Create new embossed text volume by type on position of mouse.

Parameters
volume_typeObject part / Negative volume / Modifier
mouse_posDefine position of new volume
371{
372 if (!init_create(volume_type))
373 return false;
374
375 // NOTE: change style manager - be carefull with order changes
377 CreateVolumeParams input = create_input(m_parent, m_style_manager.get_style(), m_raycast_manager, volume_type);
378 return start_create_volume(input, std::move(base), mouse_pos);
379}
bool start_create_volume(CreateVolumeParams &input, DataBasePtr data, const Vec2d &mouse_pos)
Create new volume on position of mouse cursor.
Definition EmbossJob.cpp:601

References init_create(), m_job_cancel, Slic3r::GUI::GLGizmoBase::m_parent, m_raycast_manager, m_style_manager, m_text, m_text_lines, and Slic3r::GUI::Emboss::start_create_volume().

Referenced by Slic3r::GUI::add_volume_with_gizmo(), and on_shortcut_key().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ data_changed()

void GLGizmoEmboss::data_changed ( bool is_serializing)
overrideprotectedvirtual

Is called when data (Selection) is changed.

Reimplemented from Slic3r::GUI::GLGizmoBase.

1050 {
1052 if (!is_serializing && m_volume == nullptr)
1053 close();
1054}
void close()
Definition GLGizmoEmboss.cpp:1467
void set_volume_by_selection()
Definition GLGizmoEmboss.cpp:1233

References close(), m_volume, and set_volume_by_selection().

Here is the call graph for this function:

◆ do_mirror()

bool GLGizmoEmboss::do_mirror ( size_t axis)

Mirroring from object manipulation panel !! Emboss gizmo must be active.

Parameters
axisAxis for mirroring must be one of {0,1,2}
Returns
True on success start job otherwise False
457{
458 // is valid input
459 assert(axis < 3);
460 if (axis >= 3)
461 return false;
462
463 // is gizmo opened and initialized?
464 assert(m_parent.get_gizmos_manager().get_current_type() == GLGizmosManager::Emboss);
465 if (m_parent.get_gizmos_manager().get_current_type() != GLGizmosManager::Emboss)
466 return false;
467
468 const std::optional<TextConfiguration> &tc = m_volume->text_configuration;
469 assert(tc.has_value());
470 bool is_per_glyph = tc.has_value()? tc->style.prop.per_glyph : false;
471
472 const std::optional<EmbossShape> &es = m_volume->emboss_shape;
473 assert(es.has_value());
474 bool use_surface = es.has_value()? es->projection.use_surface : false;
475 if (!use_surface && !is_per_glyph) {
476 // do normal mirror with fix matrix
477 Selection &selection = m_parent.get_selection();
478 selection.setup_cache();
479
480 auto selection_mirror_fnc = [&selection, &axis]() { selection.mirror((Axis) axis, get_drag_transformation_type(selection)); };
481 selection_transform(selection, selection_mirror_fnc);
482
483 m_parent.do_mirror(L("Set Mirror"));
484 wxGetApp().obj_manipul()->UpdateAndShow(true);
485 return true;
486 }
487
488 Vec3d scale = Vec3d::Ones();
489 scale[axis] = -1.;
490
491 Transform3d tr = m_volume->get_matrix();
492 if (es.has_value()) {
493 const std::optional<Transform3d> &fix_tr = es->fix_3mf_tr;
494 if (fix_tr.has_value())
495 tr = tr * (fix_tr->inverse());
496 }
497
498 // mirror
499 tr = tr * Eigen::Scaling(scale);
500
501 if (is_per_glyph) {
502 // init textlines before mirroring on mirrored text volume transformation
504 m_text_lines.init(tr, volumes, m_style_manager, m_text_lines.get_lines().size());
505 }
506
507 m_volume->set_transformation(tr);
508 // setting to volume is not visible for user(not GLVolume)
509 // NOTE: Staff around volume transformation change is done in job finish
510 return process();
511}
#define L(s)
Definition ExtrusionEntity.cpp:25
bool process(bool make_snapshot=true)
Definition GLGizmoEmboss.cpp:1440
void mirror(Axis axis, TransformationType transformation_type)
Definition Selection.cpp:1708
void setup_cache()
Definition Selection.cpp:1238
void selection_transform(Selection &selection, const std::function< void()> &selection_transformation_fnc)
Wrap function around selection transformation to apply fix transformation Fix transformation is neede...
Definition SurfaceDrag.cpp:307
@ Selection
Definition Shortcuts.hpp:72
TransformationType get_drag_transformation_type(const Selection &selection)
Distiguish between object and volume Differ in possible transformation type.
Definition SurfaceDrag.cpp:450
std::vector< ModelVolume * > ModelVolumePtrs
Definition Model.hpp:139
Axis
Definition libslic3r.h:140
ModelVolumePtrs prepare_volumes_to_slice(const ModelVolume &mv)
Definition GLGizmoEmboss.cpp:436

References Slic3r::GUI::GLGizmosManager::Emboss, Slic3r::GUI::get_drag_transformation_type(), L, Slic3r::GUI::GLGizmoBase::m_parent, m_style_manager, m_text_lines, m_volume, Slic3r::GUI::Selection::mirror(), process(), scale(), Slic3r::GUI::selection_transform(), and Slic3r::GUI::Selection::setup_cache().

Here is the call graph for this function:

◆ do_stop_dragging()

void Slic3r::GUI::GLGizmoBase::do_stop_dragging ( bool perform_mouse_cleanup)
protectedinherited
494{
495 for (auto& grabber : m_grabbers) grabber.dragging = false;
496 m_dragging = false;
497
498 // NOTE: This should be part of GLCanvas3D
499 // Reset hover_id when leave window
500 if (perform_mouse_cleanup) m_parent.mouse_up_cleanup();
501
503
504 // There is prediction that after draggign, data are changed
505 // Data are updated twice also by canvas3D::reload_scene.
506 // Should be fixed.
507 m_parent.get_gizmos_manager().update_data();
508
509 wxGetApp().obj_manipul()->set_dirty();
510
511 // Let the plater know that the dragging finished, so a delayed
512 // refresh of the scene with the background processing data should
513 // be performed.
514 m_parent.post_event(SimpleEvent(EVT_GLCANVAS_MOUSE_DRAGGING_FINISHED));
515 // updates camera target constraints
516 m_parent.refresh_camera_scene_box();
517}
bool m_dragging
Definition GLGizmoBase.hpp:151
std::vector< Grabber > m_grabbers
Definition GLGizmoBase.hpp:152
virtual void on_stop_dragging()
Definition GLGizmoBase.hpp:254

References m_dragging, m_grabbers, m_parent, and on_stop_dragging().

Referenced by use_grabbers().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ draw_advanced()

void GLGizmoEmboss::draw_advanced ( )
private
2835{
2836 const auto &ff = m_style_manager.get_font_file_with_cache();
2837 if (!ff.has_value()) {
2838 ImGui::Text("%s", _u8L("Advanced options cannot be changed for the selected font.\n"
2839 "Select another font.").c_str());
2840 return;
2841 }
2842
2843 FontProp &font_prop = m_style_manager.get_font_prop();
2844 const FontFile::Info &font_info = get_font_info(*ff.font_file, font_prop);
2845#ifdef SHOW_FONT_FILE_PROPERTY
2846 ImGui::SameLine();
2847 int cache_size = ff.has_value()? (int)ff.cache->size() : 0;
2848 std::string ff_property =
2849 "ascent=" + std::to_string(font_info.ascent) +
2850 ", descent=" + std::to_string(font_info.descent) +
2851 ", lineGap=" + std::to_string(font_info.linegap) +
2852 ", unitPerEm=" + std::to_string(font_info.unit_per_em) +
2853 ", cache(" + std::to_string(cache_size) + " glyphs)";
2854 if (font_file->infos.size() > 1) {
2855 unsigned int collection = current_prop.collection_number.value_or(0);
2856 ff_property += ", collect=" + std::to_string(collection+1) + "/" + std::to_string(font_file->infos.size());
2857 }
2858 m_imgui->text_colored(ImGuiWrapper::COL_GREY_DARK, ff_property);
2859#endif // SHOW_FONT_FILE_PROPERTY
2860
2861 ImGui::Spacing();
2862
2863 auto &tr = m_gui_cfg->translations;
2864
2865 const StyleManager::Style *stored_style = nullptr;
2866 if (m_style_manager.exist_stored_style())
2867 stored_style = m_style_manager.get_stored_style();
2868
2869 bool is_the_only_one_part = m_volume->is_the_only_one_part();
2870 bool can_use_surface = (m_volume->emboss_shape->projection.use_surface)? true : // already used surface must have option to uncheck
2871 !is_the_only_one_part;
2872 m_imgui->disabled_begin(!can_use_surface);
2873 const bool *def_use_surface = stored_style ?
2874 &stored_style->projection.use_surface : nullptr;
2875 StyleManager::Style &current_style = m_style_manager.get_style();
2876 bool &use_surface = current_style.projection.use_surface;
2877 if (rev_checkbox(tr.use_surface, use_surface, def_use_surface,
2878 _u8L("Revert using of model surface."))) {
2879 if (use_surface)
2880 // when using surface distance is not used
2881 current_style.distance.reset();
2882 process();
2883 }
2884 m_imgui->disabled_end(); // !can_use_surface
2885
2886 bool &per_glyph = font_prop.per_glyph;
2887 bool can_use_per_glyph = (per_glyph) ? true : // already used surface must have option to uncheck
2888 !is_the_only_one_part;
2889 m_imgui->disabled_begin(!can_use_per_glyph);
2890 const bool *def_per_glyph = stored_style ? &stored_style->prop.per_glyph : nullptr;
2891 if (rev_checkbox(tr.per_glyph, per_glyph, def_per_glyph,
2892 _u8L("Revert Transformation per glyph."))) {
2893 if (per_glyph && !m_text_lines.is_init())
2895 process();
2896 } else if (ImGui::IsItemHovered()) {
2897 if (per_glyph) {
2898 m_imgui->tooltip(_u8L("Set global orientation for whole text."), m_gui_cfg->max_tooltip_width);
2899 } else {
2900 m_imgui->tooltip(_u8L("Set position and orientation per glyph."), m_gui_cfg->max_tooltip_width);
2901 if (!m_text_lines.is_init())
2903 }
2904 } else if (!per_glyph && m_text_lines.is_init())
2905 m_text_lines.reset();
2906 m_imgui->disabled_end(); // !can_use_per_glyph
2907
2908 auto draw_align = [&align = font_prop.align, input_offset = m_gui_cfg->advanced_input_offset, &icons = m_icons, &m_imgui = m_imgui, &m_gui_cfg = m_gui_cfg]() {
2909 bool is_change = false;
2910 ImGui::SameLine(input_offset);
2912 else if (draw_button(icons, IconType::align_horizontal_left)) { align.first=FontProp::HorizontalAlign::left; is_change = true; }
2913 else if (ImGui::IsItemHovered()) m_imgui->tooltip(_u8L_CONTEXT(L_CONTEXT("Left", "Alignment"), "Alignment"), m_gui_cfg->max_tooltip_width);
2914 ImGui::SameLine();
2916 else if (draw_button(icons, IconType::align_horizontal_center)) { align.first=FontProp::HorizontalAlign::center; is_change = true; }
2917 else if (ImGui::IsItemHovered()) m_imgui->tooltip(_u8L_CONTEXT(L_CONTEXT("Center", "Alignment"), "Alignment"), m_gui_cfg->max_tooltip_width);
2918 ImGui::SameLine();
2920 else if (draw_button(icons, IconType::align_horizontal_right)) { align.first=FontProp::HorizontalAlign::right; is_change = true; }
2921 else if (ImGui::IsItemHovered()) m_imgui->tooltip(_u8L_CONTEXT(L_CONTEXT("Right", "Alignment"), "Alignment"), m_gui_cfg->max_tooltip_width);
2922
2923 ImGui::SameLine(0, ImGui::GetStyle().ItemSpacing.x * 2.f); // ORCA use wider spacing for separation between horizontal / vertical alignment
2924
2926 else if (draw_button(icons, IconType::align_vertical_top)) { align.second=FontProp::VerticalAlign::top; is_change = true; }
2927 else if (ImGui::IsItemHovered()) m_imgui->tooltip(_u8L_CONTEXT(L_CONTEXT("Top", "Alignment"), "Alignment"), m_gui_cfg->max_tooltip_width);
2928 ImGui::SameLine();
2930 else if (draw_button(icons, IconType::align_vertical_center)) { align.second=FontProp::VerticalAlign::center; is_change = true; }
2931 else if (ImGui::IsItemHovered()) m_imgui->tooltip(_u8L_CONTEXT(L_CONTEXT("Middle", "Alignment"), "Alignment"), m_gui_cfg->max_tooltip_width);
2932 ImGui::SameLine();
2934 else if (draw_button(icons, IconType::align_vertical_bottom)) { align.second=FontProp::VerticalAlign::bottom; is_change = true; }
2935 else if (ImGui::IsItemHovered()) m_imgui->tooltip(_u8L_CONTEXT(L_CONTEXT("Bottom", "Alignment"), "Alignment"), m_gui_cfg->max_tooltip_width);
2936 return is_change;
2937 };
2938 const FontProp::Align * def_align = stored_style ? &stored_style->prop.align : nullptr;
2939 if (revertible(tr.alignment, font_prop.align, def_align, _u8L("Revert alignment."), 0.0f, draw_align)) {
2940 if (font_prop.per_glyph)
2941 reinit_text_lines(m_text_lines.get_lines().size());
2942 // TODO: move with text in finalize to not change position
2943 process();
2944 }
2945
2946 // TRN EmbossGizmo: font units
2947 std::string units = _u8L("points");
2948 std::string units_fmt = "%.0f " + units;
2949
2950 // input gap between characters
2951 auto def_char_gap = stored_style ?
2952 &stored_style->prop.char_gap : nullptr;
2953
2954 bool exist_change = false;
2955 int half_ascent = font_info.ascent / 2;
2956 int min_char_gap = -half_ascent;
2957 int max_char_gap = half_ascent;
2958 FontProp &current_prop = current_style.prop;
2959 if (rev_slider(tr.char_gap, current_prop.char_gap, def_char_gap, _u8L("Revert gap between characters"),
2960 min_char_gap, max_char_gap, units_fmt, _L("Distance between characters"))){
2961 // Condition prevent recalculation when insertint out of limits value by imgui input
2962 const std::optional<int> &volume_char_gap = m_volume->text_configuration->style.prop.char_gap;
2963 if (!apply(current_prop.char_gap, limits.char_gap) ||
2964 !volume_char_gap.has_value() || volume_char_gap != current_prop.char_gap) {
2965 // char gap is stored inside of imgui font atlas
2966 m_style_manager.clear_imgui_font();
2967 exist_change = true;
2968 }
2969 }
2970 bool last_change = false;
2971 if (m_imgui->get_last_slider_status().deactivated_after_edit)
2972 last_change = true;
2973
2974 // input gap between lines
2975 bool is_multiline = get_count_lines(m_volume->text_configuration->text) > 1; // TODO: cache count lines
2976 m_imgui->disabled_begin(!is_multiline);
2977 auto def_line_gap = stored_style ?
2978 &stored_style->prop.line_gap : nullptr;
2979 int min_line_gap = -half_ascent;
2980 int max_line_gap = half_ascent;
2981 if (rev_slider(tr.line_gap, current_prop.line_gap, def_line_gap, _u8L("Revert gap between lines"),
2982 min_line_gap, max_line_gap, units_fmt, _L("Distance between lines"))){
2983 // Condition prevent recalculation when insertint out of limits value by imgui input
2984 const std::optional<int> &volume_line_gap = m_volume->text_configuration->style.prop.line_gap;
2985 if (!apply(current_prop.line_gap, limits.line_gap) ||
2986 !volume_line_gap.has_value() || volume_line_gap != current_prop.line_gap) {
2987 // line gap is planed to be stored inside of imgui font atlas
2988 m_style_manager.clear_imgui_font();
2989 if (font_prop.per_glyph)
2990 reinit_text_lines(m_text_lines.get_lines().size());
2991 exist_change = true;
2992 }
2993 }
2994 if (m_imgui->get_last_slider_status().deactivated_after_edit)
2995 last_change = true;
2996 m_imgui->disabled_end(); // !is_multiline
2997
2998 // input boldness
2999 auto def_boldness = stored_style ?
3000 &stored_style->prop.boldness : nullptr;
3001 int min_boldness = static_cast<int>(font_info.ascent * limits.boldness.gui.min);
3002 int max_boldness = static_cast<int>(font_info.ascent * limits.boldness.gui.max);
3003 if (rev_slider(tr.boldness, current_prop.boldness, def_boldness, _u8L("Undo boldness"),
3004 min_boldness, max_boldness, units_fmt, _L("Tiny / Wide glyphs"))){
3005 const std::optional<float> &volume_boldness = m_volume->text_configuration->style.prop.boldness;
3006 if (!apply(current_prop.boldness, limits.boldness.values) ||
3007 !volume_boldness.has_value() || volume_boldness != current_prop.boldness)
3008 exist_change = true;
3009 }
3010 if (m_imgui->get_last_slider_status().deactivated_after_edit)
3011 last_change = true;
3012
3013 // input italic
3014 auto def_skew = stored_style ?
3015 &stored_style->prop.skew : nullptr;
3016 if (rev_slider(tr.skew_ration, current_prop.skew, def_skew, _u8L("Undo letter's skew"),
3017 limits.skew.gui.min, limits.skew.gui.max, "%.2f", _L("Italic strength ratio"))){
3018 const std::optional<float> &volume_skew = m_volume->text_configuration->style.prop.skew;
3019 if (!apply(current_prop.skew, limits.skew.values) ||
3020 !volume_skew.has_value() ||volume_skew != current_prop.skew)
3021 exist_change = true;
3022 }
3023 if (m_imgui->get_last_slider_status().deactivated_after_edit)
3024 last_change = true;
3025
3026 // input surface distance
3027 bool allowe_surface_distance = !use_surface && !m_volume->is_the_only_one_part();
3028 std::optional<float> &distance = current_style.distance;
3029 float prev_distance = distance.value_or(.0f);
3030 float min_distance = static_cast<float>(-2 * current_style.projection.depth);
3031 float max_distance = static_cast<float>(2 * current_style.projection.depth);
3032 auto def_distance = stored_style ?
3033 &stored_style->distance : nullptr;
3034 m_imgui->disabled_begin(!allowe_surface_distance);
3035 bool use_inch = wxGetApp().app_config->get_bool("use_inches");
3036 const std::string undo_move_tooltip = _u8L("Undo translation");
3037 const wxString move_tooltip = _L("Distance of the center of the text to the model surface.");
3038 bool is_moved = false;
3039 if (use_inch) {
3040 std::optional<float> distance_inch;
3041 if (distance.has_value()) distance_inch = (*distance * GizmoObjectManipulation::mm_to_in);
3042 std::optional<float> def_distance_inch;
3043 if (def_distance != nullptr) {
3044 if (def_distance->has_value()) def_distance_inch = GizmoObjectManipulation::mm_to_in * (*(*def_distance));
3045 def_distance = &def_distance_inch;
3046 }
3047 min_distance *= GizmoObjectManipulation::mm_to_in;
3048 max_distance *= GizmoObjectManipulation::mm_to_in;
3049 if (rev_slider(tr.from_surface, distance_inch, def_distance, undo_move_tooltip, min_distance, max_distance, "%.3f in", move_tooltip)) {
3050 if (distance_inch.has_value()) {
3052 } else {
3053 distance.reset();
3054 }
3055 is_moved = true;
3056 }
3057 } else {
3058 if (rev_slider(tr.from_surface, distance, def_distance, undo_move_tooltip,
3059 min_distance, max_distance, "%.2f mm", move_tooltip)) is_moved = true;
3060 }
3061
3062 if (is_moved){
3063 if (font_prop.per_glyph){
3064 process(false);
3065 } else {
3066 do_local_z_move(m_parent.get_selection(), distance.value_or(.0f) - prev_distance);
3067 }
3068 }
3069
3070 // Apply move to model(backend)
3071 if (m_imgui->get_last_slider_status().deactivated_after_edit) {
3072 m_parent.do_move(move_snapshot_name);
3073 if (font_prop.per_glyph)
3074 process();
3075 }
3076
3077 m_imgui->disabled_end(); // allowe_surface_distance
3078
3079 // slider for Clockwise angle in degress
3080 // stored angle is optional CCW and in radians
3081 // Convert stored value to degress
3082 // minus create clockwise roation from CCW
3083 float angle = current_style.angle.value_or(0.f);
3084 float angle_deg = static_cast<float>(-angle * 180 / M_PI);
3085 float def_angle_deg_val =
3086 (!stored_style || !stored_style->angle.has_value()) ?
3087 0.f : (*stored_style->angle * -180 / M_PI);
3088 float* def_angle_deg = stored_style ?
3089 &def_angle_deg_val : nullptr;
3090 if (rev_slider(tr.rotation, angle_deg, def_angle_deg, _u8L("Undo rotation"),
3091 limits.angle.min, limits.angle.max, u8"%.2f °",
3092 _L("Rotate text Clockwise."))) {
3093 // convert back to radians and CCW
3094 double angle_rad = -angle_deg * M_PI / 180.0;
3095 Geometry::to_range_pi_pi(angle_rad);
3096
3097 double diff_angle = angle_rad - angle;
3098 do_local_z_rotate(m_parent.get_selection(), diff_angle);
3099
3100 // calc angle after rotation
3101 const Selection &selection = m_parent.get_selection();
3102 const GLVolume *gl_volume = get_selected_gl_volume(selection);
3103 assert(gl_volume != nullptr);
3104 assert(m_style_manager.is_active_font());
3105 if (m_style_manager.is_active_font() && gl_volume != nullptr)
3106 m_style_manager.get_style().angle = calc_angle(selection);
3107
3108 if (font_prop.per_glyph)
3109 reinit_text_lines(m_text_lines.get_lines().size());
3110
3111 // recalculate for surface cut
3112 if (use_surface || font_prop.per_glyph)
3113 process(false);
3114 }
3115
3116 // Apply rotation on model (backend)
3117 if (m_imgui->get_last_slider_status().deactivated_after_edit) {
3118 m_parent.do_rotate(rotation_snapshot_name);
3119
3120 // recalculate for surface cut
3121 if (use_surface || font_prop.per_glyph)
3122 process();
3123 }
3124
3125 // Keep up - lock button icon
3126 if (!m_volume->is_the_only_one_part()) {
3127 ImGui::SameLine(m_gui_cfg->lock_offset);
3128 const IconManager::Icon &icon = get_icon(m_icons, m_keep_up ? IconType::lock : IconType::unlock, IconState::activable);
3129 const IconManager::Icon &icon_hover = get_icon(m_icons, m_keep_up ? IconType::lock_bold : IconType::unlock_bold, IconState::activable);
3130 const IconManager::Icon &icon_disable = get_icon(m_icons, m_keep_up ? IconType::lock : IconType::unlock, IconState::disabled);
3131 if (button(icon, icon_hover, icon_disable))
3133
3134 if (ImGui::IsItemHovered())
3135 m_imgui->tooltip(m_keep_up?
3136 _u8L("Unlock the text's rotation when moving text along the object's surface."):
3137 _u8L("Lock the text's rotation when moving text along the object's surface.")
3138 , m_gui_cfg->max_tooltip_width);
3139 }
3140
3141 // when more collection add selector
3142 if (ff.font_file->infos.size() > 1) {
3143 ImGui::AlignTextToFramePadding();
3144 ImGui::Text("%s", tr.collection.c_str());
3145 ImGui::SameLine(m_gui_cfg->advanced_input_offset);
3146 ImGui::SetNextItemWidth(m_gui_cfg->input_width);
3147 unsigned int selected = current_prop.collection_number.value_or(0);
3148 std::string tooltip = "";
3150 if (ImGui::BBLBeginCombo("## Font collection", std::to_string(selected).c_str())) {
3151 for (unsigned int i = 0; i < ff.font_file->infos.size(); ++i) {
3152 ImGui::PushID(1 << (10 + i));
3153 bool is_selected = (i == selected);
3154 if (ImGui::BBLSelectable(std::to_string(i).c_str(), is_selected)) {
3155 if (i == 0) current_prop.collection_number.reset();
3156 else current_prop.collection_number = i;
3157 exist_change = true;
3158 last_change = true;
3159 }
3160 ImGui::PopID();
3161 }
3162 ImGui::EndCombo();
3163 } else if (ImGui::IsItemHovered()) {
3164 tooltip = _u8L("Select from True Type Collection.");
3165 }
3167 if (!tooltip.empty())
3168 m_imgui->tooltip(tooltip, m_gui_cfg->max_tooltip_width);
3169 }
3170
3171 if (exist_change || last_change) {
3172 m_style_manager.clear_glyphs_cache();
3173 if (font_prop.per_glyph)
3175 else
3176 m_text_lines.reset();
3177 process(last_change);
3178 }
3179
3180 if (ImGui::Button(_u8L("Set text to face camera").c_str())) {
3181 assert(get_selected_volume(m_parent.get_selection()) == m_volume);
3182 const Camera &cam = wxGetApp().plater()->get_camera();
3183 auto wanted_up_limit = m_keep_up ? std::optional<double>(UP_LIMIT) : std::optional<double>{};
3184 if (face_selected_volume_to_camera(cam, m_parent, wanted_up_limit))
3185 volume_transformation_changed();
3186 } else if (ImGui::IsItemHovered()) {
3187 m_imgui->tooltip(_u8L("Orient the text towards the camera."), m_gui_cfg->max_tooltip_width);
3188 }
3189
3190 //ImGui::SameLine(); if (ImGui::Button("Re-emboss")) GLGizmoEmboss::re_emboss(*m_volume);
3191
3192#ifdef ALLOW_DEBUG_MODE
3193 ImGui::Text("family = %s", (current_prop.family.has_value() ?
3194 current_prop.family->c_str() :
3195 " --- "));
3196 ImGui::Text("face name = %s", (current_prop.face_name.has_value() ?
3197 current_prop.face_name->c_str() :
3198 " --- "));
3199 ImGui::Text("style = %s",
3200 (current_prop.style.has_value() ? current_prop.style->c_str() :
3201 " --- "));
3202 ImGui::Text("weight = %s", (current_prop.weight.has_value() ?
3203 current_prop.weight->c_str() :
3204 " --- "));
3205
3206 std::string descriptor = style.path;
3207 ImGui::Text("descriptor = %s", descriptor.c_str());
3208#endif // ALLOW_DEBUG_MODE
3209}
#define L_CONTEXT(s, context)
Definition DesignOffer.hpp:17
#define M_PI
Definition ExtrusionSimulator.cpp:31
IconManager::VIcons m_icons
Definition GLGizmoEmboss.hpp:237
bool m_keep_up
Definition GLGizmoEmboss.hpp:198
bool rev_slider(const std::string &name, std::optional< int > &value, const std::optional< int > *default_value, const std::string &undo_tooltip, int v_min, int v_max, const std::string &format, const wxString &tooltip) const
Definition GLGizmoEmboss.cpp:2771
bool rev_checkbox(const std::string &name, bool &value, const bool *default_value, const std::string &undo_tooltip) const
Definition GLGizmoEmboss.cpp:2696
void reinit_text_lines(unsigned count_lines=0)
Definition GLGizmoEmboss.cpp:1229
bool revertible(const std::string &name, T &value, const T *default_value, const std::string &undo_tooltip, float undo_offset, Draw draw) const
Definition GLGizmoEmboss.cpp:2587
static const double mm_to_in
Definition GizmoObjectManipulation.hpp:31
static const double in_to_mm
Definition GizmoObjectManipulation.hpp:30
static void pop_combo_style()
Definition ImGuiWrapper.cpp:2932
static void push_combo_style(const float scale)
Definition ImGuiWrapper.cpp:2907
static const ImVec4 COL_GREY_DARK
Definition ImGuiWrapper.hpp:384
unsigned get_count_lines(const std::wstring &ws)
Sum of character ' '.
Definition Emboss.cpp:1437
const FontFile::Info & get_font_info(const FontFile &font, const FontProp &prop)
getter of font info by collection defined in prop
Definition Emboss.cpp:1273
bool face_selected_volume_to_camera(const Camera &camera, GLCanvas3D &canvas, const std::optional< double > &wanted_up_limit)
Apply camera direction for emboss direction.
Definition SurfaceDrag.cpp:329
@ Camera
Definition Shortcuts.hpp:72
void do_local_z_rotate(Selection &selection, double relative_angle)
Rotation around z Axis(emboss direction).
Definition SurfaceDrag.cpp:406
ModelVolume * get_selected_volume(const Selection &selection)
Definition Selection.cpp:3406
constexpr double UP_LIMIT
Definition SurfaceDrag.hpp:56
void draw(const IconManager::Icon &icon, const ImVec2 &size, const ImVec4 &tint_col, const ImVec4 &border_col)
Draw imgui image with icon.
Definition IconManager.cpp:373
void do_local_z_move(Selection &selection, double relative_move)
Translation along local z Axis (emboss direction).
Definition SurfaceDrag.cpp:438
GLVolume * get_selected_gl_volume(const GLCanvas3D &canvas)
Definition GLCanvas3D.cpp:13003
bool button(const IconManager::Icon &activ, const IconManager::Icon &hover, const IconManager::Icon &disable, bool disabled)
Use icon as button with 3 states activ hover and disabled.
Definition IconManager.cpp:418
std::optional< float > calc_angle(const Selection &selection)
Calculate up vector angle.
Definition SurfaceDrag.cpp:259
void to_range_pi_pi(T &angle)
Definition Geometry.hpp:331
float distance(SpiralVase::SpiralPoint a, SpiralVase::SpiralPoint b)
Definition SpiralVase.cpp:19
double angle(const Eigen::MatrixBase< Derived > &v1, const Eigen::MatrixBase< Derived2 > &v2)
Definition Point.hpp:138
static bool apply(std::optional< T > &val, const MinMax< T > &limit)
Definition Point.hpp:738
const IconManager::Icon & get_icon(const IconManager::VIcons &icons, IconType type, IconState state)
Definition GLGizmoEmboss.cpp:3422
bool draw_button(const IconManager::VIcons &icons, IconType type, bool disable=false)
Definition GLGizmoEmboss.cpp:3425
static const struct anonymous_namespace{GLGizmoEmboss.cpp}::Limits limits
@ align_horizontal_left
Definition GLGizmoEmboss.cpp:213
@ align_vertical_center
Definition GLGizmoEmboss.cpp:217
@ align_vertical_top
Definition GLGizmoEmboss.cpp:216
@ unlock_bold
Definition GLGizmoEmboss.cpp:212
@ unlock
Definition GLGizmoEmboss.cpp:211
@ align_horizontal_right
Definition GLGizmoEmboss.cpp:215
@ align_vertical_bottom
Definition GLGizmoEmboss.cpp:218
@ lock_bold
Definition GLGizmoEmboss.cpp:210
@ align_horizontal_center
Definition GLGizmoEmboss.cpp:214
@ lock
Definition GLGizmoEmboss.cpp:209
@ disabled
Definition GLGizmoEmboss.cpp:223
@ activable
Definition GLGizmoEmboss.cpp:223
@ hovered
Definition GLGizmoEmboss.cpp:223
#define _u8L_CONTEXT(s, ctx)
Definition I18N.hpp:16
bool use_surface
Definition EmbossShape.hpp:27
double depth
Definition EmbossShape.hpp:23
int linegap
Definition Emboss.hpp:81
int unit_per_em
Definition Emboss.hpp:84
int ascent
Definition Emboss.hpp:81
int descent
Definition Emboss.hpp:81
std::optional< float > boldness
Definition TextConfiguration.hpp:34
std::optional< std::string > style
Definition TextConfiguration.hpp:69
@ bottom
Definition TextConfiguration.hpp:50
@ center
Definition TextConfiguration.hpp:50
@ top
Definition TextConfiguration.hpp:50
std::optional< int > char_gap
Definition TextConfiguration.hpp:25
@ right
Definition TextConfiguration.hpp:49
@ left
Definition TextConfiguration.hpp:49
@ center
Definition TextConfiguration.hpp:49
std::optional< float > skew
Definition TextConfiguration.hpp:39
Align align
Definition TextConfiguration.hpp:54
std::pair< HorizontalAlign, VerticalAlign > Align
Definition TextConfiguration.hpp:51
std::optional< unsigned int > collection_number
Definition TextConfiguration.hpp:43
std::optional< std::string > weight
Definition TextConfiguration.hpp:70
bool per_glyph
Definition TextConfiguration.hpp:46
std::optional< int > line_gap
Definition TextConfiguration.hpp:29
std::optional< std::string > family
Definition TextConfiguration.hpp:67
std::optional< float > distance
Definition EmbossStyleManager.hpp:204
EmbossProjection projection
Definition EmbossStyleManager.hpp:199
std::optional< float > angle
Definition EmbossStyleManager.hpp:210

References _L, _u8L, _u8L_CONTEXT, anonymous_namespace{GLGizmoEmboss.cpp}::activable, Slic3r::FontProp::align, anonymous_namespace{GLGizmoEmboss.cpp}::align_horizontal_center, anonymous_namespace{GLGizmoEmboss.cpp}::align_horizontal_left, anonymous_namespace{GLGizmoEmboss.cpp}::align_horizontal_right, anonymous_namespace{GLGizmoEmboss.cpp}::align_vertical_bottom, anonymous_namespace{GLGizmoEmboss.cpp}::align_vertical_center, anonymous_namespace{GLGizmoEmboss.cpp}::align_vertical_top, Slic3r::angle(), Slic3r::GUI::Emboss::StyleManager::Style::angle, Slic3r::apply(), Slic3r::Emboss::FontFile::Info::ascent, Slic3r::FontProp::boldness, Slic3r::FontProp::bottom, Slic3r::GUI::button(), Slic3r::GUI::calc_angle(), Slic3r::FontProp::center, Slic3r::FontProp::char_gap, Slic3r::GUI::ImGuiWrapper::COL_GREY_DARK, Slic3r::FontProp::collection_number, Slic3r::EmbossProjection::depth, Slic3r::Emboss::FontFile::Info::descent, anonymous_namespace{GLGizmoEmboss.cpp}::disabled, Slic3r::GUI::Emboss::StyleManager::Style::distance, Slic3r::GUI::do_local_z_move(), Slic3r::GUI::do_local_z_rotate(), Slic3r::GUI::draw(), exist_change(), Slic3r::FontProp::face_name, Slic3r::GUI::face_selected_volume_to_camera(), Slic3r::FontProp::family, Slic3r::Emboss::get_count_lines(), Slic3r::Emboss::get_font_info(), Slic3r::GUI::get_selected_gl_volume(), Slic3r::GUI::get_selected_volume(), anonymous_namespace{GLGizmoEmboss.cpp}::hovered, Slic3r::GUI::GizmoObjectManipulation::in_to_mm, L_CONTEXT, Slic3r::FontProp::left, Slic3r::FontProp::line_gap, Slic3r::Emboss::FontFile::Info::linegap, anonymous_namespace{GLGizmoEmboss.cpp}::lock, anonymous_namespace{GLGizmoEmboss.cpp}::lock_bold, m_gui_cfg, m_icons, Slic3r::GUI::GLGizmoBase::m_imgui, m_keep_up, Slic3r::GUI::GLGizmoBase::m_parent, M_PI, m_style_manager, m_text_lines, m_volume, Slic3r::GUI::GizmoObjectManipulation::mm_to_in, Slic3r::FontProp::per_glyph, Slic3r::GUI::ImGuiWrapper::pop_combo_style(), process(), Slic3r::GUI::Emboss::StyleManager::Style::projection, Slic3r::EmbossStyle::prop, Slic3r::GUI::ImGuiWrapper::push_combo_style(), reinit_text_lines(), rev_checkbox(), rev_slider(), revertible(), Slic3r::FontProp::right, Slic3r::FontProp::skew, Slic3r::FontProp::style, style, Slic3r::Geometry::to_range_pi_pi(), Slic3r::FontProp::top, Slic3r::Emboss::FontFile::Info::unit_per_em, anonymous_namespace{GLGizmoEmboss.cpp}::unlock, anonymous_namespace{GLGizmoEmboss.cpp}::unlock_bold, Slic3r::GUI::UP_LIMIT, Slic3r::EmbossProjection::use_surface, volume_transformation_changed(), and Slic3r::FontProp::weight.

Referenced by draw_window().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ draw_bold_button()

bool GLGizmoEmboss::draw_bold_button ( )
private
2524 {
2525 const wxFont &wx_font = m_style_manager.get_wx_font();
2526 const auto& ff = m_style_manager.get_font_file_with_cache();
2527 if (!wx_font.IsOk() || !ff.has_value()) {
2529 return false;
2530 }
2531
2532 std::optional<float> &boldness = m_style_manager.get_font_prop().boldness;
2533 bool is_font_bold = boldness.has_value() || WxFontUtils::is_bold(wx_font);
2534 if (is_font_bold) {
2535 // unset bold
2538 boldness.reset();
2539 if (wx_font.GetWeight() != wxFontWeight::wxFONTWEIGHT_NORMAL) {
2540 wxFont new_wx_font = wx_font; // copy
2541 new_wx_font.SetWeight(wxFontWeight::wxFONTWEIGHT_NORMAL);
2542 if(!m_style_manager.set_wx_font(new_wx_font))
2543 return false;
2544 }
2545 return true;
2546 }
2547 if (ImGui::IsItemHovered())
2548 m_imgui->tooltip(_u8L("Unset bold"), m_gui_cfg->max_tooltip_width);
2549 } else {
2550 // set bold
2552 wxFont new_wx_font = wx_font; // copy
2553 auto new_ff = WxFontUtils::set_bold(new_wx_font, *ff.font_file);
2554 if (new_ff != nullptr) {
2555 if(!m_style_manager.set_wx_font(new_wx_font, std::move(new_ff)))
2556 return false;
2557 } else {
2558 // bold font can't be loaded
2559 // set up boldness
2560 boldness = 20.f;
2561 //font_file->cache.empty();
2562 }
2563 return true;
2564 }
2565 if (ImGui::IsItemHovered())
2566 m_imgui->tooltip(_u8L("Set bold"), m_gui_cfg->max_tooltip_width);
2567 }
2568 return false;
2569}
static bool is_bold(const wxFont &font)
Definition WxFontUtils.cpp:304
static std::unique_ptr< Slic3r::Emboss::FontFile > set_bold(wxFont &font, const Slic3r::Emboss::FontFile &font_file)
Set boldness into wx font When bolded font is same as original return nullptr. To not load font file ...
Definition WxFontUtils.cpp:368
bool clickable(const IconManager::Icon &icon, const IconManager::Icon &icon_hover)
Draw icon which change on hover.
Definition IconManager.cpp:399
@ bold
Definition GLGizmoEmboss.cpp:204
@ unbold
Definition GLGizmoEmboss.cpp:205

References _u8L, anonymous_namespace{GLGizmoEmboss.cpp}::bold, Slic3r::GUI::clickable(), anonymous_namespace{GLGizmoEmboss.cpp}::disabled, Slic3r::GUI::draw(), anonymous_namespace{GLGizmoEmboss.cpp}::hovered, Slic3r::GUI::WxFontUtils::is_bold(), m_gui_cfg, m_icons, Slic3r::GUI::GLGizmoBase::m_imgui, m_style_manager, Slic3r::GUI::WxFontUtils::set_bold(), and anonymous_namespace{GLGizmoEmboss.cpp}::unbold.

Referenced by draw_font_list_line().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ draw_delete_style_button()

void GLGizmoEmboss::draw_delete_style_button ( )
private
2270 {
2271 bool is_stored = m_style_manager.exist_stored_style();
2272 bool is_last = m_style_manager.get_styles().size() == 1;
2273 bool can_delete = is_stored && !is_last;
2274
2275 if (draw_button(m_icons, IconType::erase, !can_delete)) {
2276 std::string style_name = m_style_manager.get_style().name; // copy
2277 wxString dialog_title = _L("Remove style");
2278 size_t next_style_index = std::numeric_limits<size_t>::max();
2279 Plater *plater = wxGetApp().plater();
2280 bool exist_change = false;
2281 while (true) {
2282 // NOTE: can't use previous loaded activ index -> erase could change index
2283 size_t active_index = m_style_manager.get_style_index();
2284 next_style_index = (active_index > 0) ? active_index - 1 :
2285 active_index + 1;
2286
2287 if (next_style_index >= m_style_manager.get_styles().size()) {
2288 MessageDialog msg(plater, _L("Can't remove the last existing style."), dialog_title, wxICON_ERROR | wxOK);
2289 msg.ShowModal();
2290 break;
2291 }
2292
2293 // IMPROVE: add function can_load?
2294 // clean unactivable styles
2295 if (!m_style_manager.load_style(next_style_index)) {
2296 m_style_manager.erase(next_style_index);
2297 exist_change = true;
2298 continue;
2299 }
2300
2301 wxString message = GUI::format_wxstr(_L("Are you sure you want to permanently remove the \"%1%\" style?"), style_name);
2302 MessageDialog msg(plater, message, dialog_title, wxICON_WARNING | wxYES | wxNO);
2303 if (msg.ShowModal() == wxID_YES) {
2304 // delete style
2305 m_style_manager.erase(active_index);
2306 exist_change = true;
2307 process();
2308 } else {
2309 // load back style
2310 m_style_manager.load_style(active_index);
2311 }
2312 break;
2313 }
2314 if (exist_change)
2315 m_style_manager.store_styles_to_app_config(wxGetApp().app_config);
2316 }
2317
2318 if (ImGui::IsItemHovered()) {
2319 const std::string &style_name = m_style_manager.get_style().name;
2320 std::string tooltip;
2321 if (can_delete) tooltip = GUI::format(_L("Delete \"%1%\" style."), style_name);
2322 else if (is_last) tooltip = GUI::format(_L("Can't delete \"%1%\". It is last style."), style_name);
2323 else/*if(!is_stored)*/ tooltip = GUI::format(_L("Can't delete temporary style \"%1%\"."), style_name);
2324 m_imgui->tooltip(tooltip, m_gui_cfg->max_tooltip_width);
2325 }
2326}
wxString format_wxstr(const char *fmt, TArgs &&... args)
Definition format.hpp:22
static Plater * plater()
Definition GUI_Factories.cpp:400
@ erase
Definition GLGizmoEmboss.cpp:198

References _L, anonymous_namespace{GLGizmoEmboss.cpp}::erase, exist_change(), Slic3r::GUI::format(), Slic3r::GUI::format_wxstr(), m_gui_cfg, m_icons, Slic3r::GUI::GLGizmoBase::m_imgui, m_style_manager, Slic3r::GUI::plater(), process(), and Slic3r::GUI::DPIAware< P >::ShowModal().

Referenced by draw_style_list().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ draw_depth()

void GLGizmoEmboss::draw_depth ( bool use_inch)
private
2754{
2755 double &value = m_style_manager.get_style().projection.depth;
2756 const StyleManager::Style * stored_style = m_style_manager.get_stored_style();
2757 const double *stored = ((stored_style!=nullptr)? &stored_style->projection.depth : nullptr);
2758 const std::string revert_emboss_depth = _u8L("Revert embossed depth.");
2759 const char *size_format = ((use_inch) ? "%.3f in" : "%.2f mm");
2760 const std::string name = m_gui_cfg->translations.depth;
2761 if (rev_input_mm(name, value, stored, revert_emboss_depth, 0.1, 1., size_format, use_inch, m_scale_depth)){
2762 // size can't be zero or negative
2763 apply(value, limits.emboss);
2764
2765 // only different value need process
2766 if(!is_approx(value, m_volume->emboss_shape->projection.depth))
2767 process();
2768 }
2769}
bool rev_input_mm(const std::string &name, T &value, const T *default_value, const std::string &undo_tooltip, T step, T step_fast, const char *format, bool use_inch, const std::optional< float > &scale) const
Definition GLGizmoEmboss.cpp:2659

References _u8L, Slic3r::apply(), Slic3r::EmbossProjection::depth, Slic3r::is_approx(), m_gui_cfg, m_scale_depth, m_style_manager, m_volume, process(), Slic3r::GUI::Emboss::StyleManager::Style::projection, and rev_input_mm().

Referenced by draw_window().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ draw_font_list()

void GLGizmoEmboss::draw_font_list ( )
private
1894{
1896 ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f));
1897 ImGui::PushStyleVar(ImGuiStyleVar_PopupRounding, 4.0f * m_gui_cfg->screen_scale);
1898
1899 wxString tooltip_name = "";
1900
1901 // Set partial
1902 wxString actual_face_name;
1903 if (m_style_manager.is_active_font()) {
1904 const wxFont &wx_font = m_style_manager.get_wx_font();
1905 if (wx_font.IsOk())
1906 actual_face_name = wx_font.GetFaceName();
1907 }
1908 // name of actual selected font
1909 const char * selected = (!actual_face_name.empty()) ?
1910 (const char *)actual_face_name.c_str() : " --- ";
1911
1912 // Do not remove font face during enumeration
1913 // When deletation of font appear this variable is set
1914 std::optional<size_t> del_index;
1915
1916 ImGui::SetNextItemWidth(2 * m_gui_cfg->input_width);
1917 std::vector<int> filtered_items_idx;
1918 bool is_filtered = false;
1919 if (m_imgui->bbl_combo_with_filter("##Combo_Font", selected, m_face_names->faces_names,
1920 &filtered_items_idx, &is_filtered, m_imgui->scaled(32.f / 15.f))) {
1921 bool set_selection_focus = false;
1922 if (!m_face_names->is_init) {
1924 set_selection_focus = true;
1925 }
1926
1927 if (!m_face_names->has_truncated_names)
1929
1930 if (m_face_names->texture_id == 0)
1932
1933 int show_items_count = is_filtered ? filtered_items_idx.size() : m_face_names->faces.size();
1934
1935 ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0));
1936 ImGui::PushStyleVar(ImGuiStyleVar_ItemInnerSpacing, ImVec2(0, 0));
1937 ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 0);
1938 ImGui::PushStyleVar(ImGuiStyleVar_SelectableTextAlign, ImVec2(0.0f, 0.5f)); // vertically align label
1939
1940 for (int i = 0; i < show_items_count; i++) {
1941 int idx = is_filtered ? filtered_items_idx[i] : i;
1942 FaceName &face = m_face_names->faces[idx];
1943 const wxString &wx_face_name = face.wx_name;
1944
1945 ImGui::PushID(idx);
1946 ScopeGuard sg([]() { ImGui::PopID(); });
1947 bool is_selected = (actual_face_name == wx_face_name);
1948 ImVec2 selectable_size(0, m_imgui->scaled(32.f / 15.f));
1949 ImGuiSelectableFlags flags = 0;
1950 if (ImGui::BBLSelectable(face.name_truncated.c_str(), is_selected, flags, selectable_size)) {
1951 if (!select_facename(wx_face_name)) {
1952 del_index = idx;
1953 MessageDialog(wxGetApp().plater(), GUI::format_wxstr(_L("Font \"%1%\" can't be selected."), wx_face_name));
1954 } else {
1955 ImGui::CloseCurrentPopup();
1956 }
1957 }
1958 // tooltip as full name of font face
1959 if (ImGui::IsItemHovered())
1960 tooltip_name = wx_face_name;
1961
1962 if (is_selected) {
1963 ImGui::SetItemDefaultFocus();
1964 }
1965
1966 // on first draw set focus on selected font
1967 if (set_selection_focus && is_selected)
1968 ImGui::SetScrollHereY();
1969 ::draw_font_preview(face, m_text, *m_face_names, *m_gui_cfg, ImGui::IsItemVisible());
1970 }
1971
1972 ImGui::PopStyleVar(4); // ImGuiStyleVar_ItemSpacing, ImGuiStyleVar_ItemInnerSpacing, ImGuiStyleVar_FrameRounding, ImGuiStyleVar_SelectableTextAlign
1973 ImGui::EndListBox();
1974 ImGui::EndPopup();
1975 } else if (m_face_names->is_init) {
1976 // Just one after close combo box
1977 // free texture and set id to zero
1978 m_face_names->is_init = false;
1979 // cancel all process for generation of texture
1980 for (FaceName &face : m_face_names->faces)
1981 if (face.cancel != nullptr)
1982 face.cancel->store(true);
1983 glsafe(::glDeleteTextures(1, &m_face_names->texture_id));
1984 m_face_names->texture_id = 0;
1985 }
1986
1987 // delete unloadable face name when try to use
1988 if (del_index.has_value()) {
1989 auto face = m_face_names->faces.begin() + (*del_index);
1990 std::vector<wxString>& bad = m_face_names->bad;
1991 // sorted insert into bad fonts
1992 auto it = std::upper_bound(bad.begin(), bad.end(), face->wx_name);
1993 bad.insert(it, face->wx_name);
1994 m_face_names->faces.erase(face);
1995 m_face_names->faces_names.erase(m_face_names->faces_names.begin() + (*del_index));
1996 // update cached file
1998 }
1999
2000#ifdef ALLOW_ADD_FONT_BY_FILE
2001 ImGui::SameLine();
2002 // select font file by file browser
2004 if (choose_true_type_file()) {
2005 process();
2006 }
2007 } else if (ImGui::IsItemHovered())
2008 ImGui::SetTooltip("Add file with font(.ttf, .ttc)");
2009#endif // ALLOW_ADD_FONT_BY_FILE
2010
2011#ifdef ALLOW_ADD_FONT_BY_OS_SELECTOR
2012 ImGui::SameLine();
2014 if (choose_font_by_wxdialog()) {
2015 process();
2016 }
2017 } else if (ImGui::IsItemHovered())
2018 ImGui::SetTooltip("Open dialog for choose from fonts.");
2019#endif // ALLOW_ADD_FONT_BY_OS_SELECTOR
2020
2021 ImGui::PopStyleVar(2);
2023
2024 if (!tooltip_name.IsEmpty())
2025 m_imgui->tooltip(tooltip_name, m_gui_cfg->max_tooltip_width);
2026}
#define glsafe(cmd)
Definition OpenGLUtils.hpp:25
void init_font_name_texture()
Definition GLGizmoEmboss.cpp:1741
bool select_facename(const wxString &facename)
Definition GLGizmoEmboss.cpp:1773
#define glDeleteTextures
Definition gl.h:3587
void init_face_names(Facenames &facenames)
Definition GLGizmoEmboss.cpp:3622
void init_truncated_names(Facenames &face_names, float max_width)
Definition GLGizmoEmboss.cpp:3613
@ system_selector
Definition GLGizmoEmboss.cpp:206
@ open_file
Definition GLGizmoEmboss.cpp:207
bool store(const Facenames &facenames)
Definition GLGizmoEmboss.cpp:3560

References _L, Slic3r::GUI::format_wxstr(), glDeleteTextures, glsafe, init_font_name_texture(), m_face_names, m_gui_cfg, Slic3r::GUI::GLGizmoBase::m_imgui, m_style_manager, m_text, anonymous_namespace{GLGizmoEmboss.cpp}::open_file, Slic3r::GUI::plater(), Slic3r::GUI::ImGuiWrapper::pop_combo_style(), process(), Slic3r::GUI::ImGuiWrapper::push_combo_style(), select_facename(), and anonymous_namespace{GLGizmoEmboss.cpp}::system_selector.

Referenced by draw_font_list_line().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ draw_font_list_line()

void GLGizmoEmboss::draw_font_list_line ( )
private
1828{
1829 ImGui::AlignTextToFramePadding();
1830
1831 bool exist_stored_style = m_style_manager.exist_stored_style();
1832 bool exist_change_in_font = m_style_manager.is_font_changed();
1833 const std::string& font_text = m_gui_cfg->translations.font;
1834 if (exist_change_in_font || !exist_stored_style)
1835 ImGuiWrapper::text_colored(ImGuiWrapper::COL_MODIFIED, font_text); // ORCA match color
1836 else
1837 ImGuiWrapper::text(font_text);
1838
1839 ImGui::SameLine(m_gui_cfg->input_offset);
1840
1842
1843 bool exist_change = false;
1844 if (!m_is_unknown_font) {
1845 ImGui::SameLine();
1846 if (draw_italic_button())
1847 exist_change = true;
1848 ImGui::SameLine();
1849 if (draw_bold_button())
1850 exist_change = true;
1851 } else {
1852 // when exist unknown font add confirmation button
1853 ImGui::SameLine();
1854 // Apply for actual selected font
1855 if (ImGui::Button(_u8L("Apply").c_str()))
1856 exist_change = true;
1857 }
1858
1859 EmbossStyle &style = m_style_manager.get_style();
1861 if (exist_change_in_font == false) {
1862 ImGui::PushStyleVar(ImGuiStyleVar_Alpha, 0.0f);
1863 m_imgui->disabled_begin(true);
1864 }
1865
1866 ImGui::SameLine();
1867 if (Slic3r::GUI::button(r_icon, r_icon, r_icon)) { // ORCA draw bottom with same orange color
1868 const EmbossStyle *stored_style = m_style_manager.get_stored_style();
1869
1870 style.path = stored_style->path;
1871 style.prop.boldness = stored_style->prop.boldness;
1872 style.prop.skew = stored_style->prop.skew;
1873
1874 wxFont new_wx_font = WxFontUtils::load_wxFont(style.path);
1875 if (new_wx_font.IsOk() && m_style_manager.set_wx_font(new_wx_font))
1876 exist_change = true;
1877 } else if (ImGui::IsItemHovered())
1878 m_imgui->tooltip(_u8L("Revert font changes."), m_gui_cfg->max_tooltip_width);
1879
1880 if (exist_change_in_font == false) {
1881 ImGui::PopStyleVar();
1882 m_imgui->disabled_end();
1883 }
1884
1885 if (exist_change) {
1886 m_style_manager.clear_glyphs_cache();
1887 if (m_style_manager.get_font_prop().per_glyph)
1888 reinit_text_lines(m_text_lines.get_lines().size());
1889 process();
1890 }
1891}
void draw_font_list()
Definition GLGizmoEmboss.cpp:1893
bool draw_italic_button()
Definition GLGizmoEmboss.cpp:2477
bool draw_bold_button()
Definition GLGizmoEmboss.cpp:2524
static void text_colored(const ImVec4 &color, const char *label)
Definition ImGuiWrapper.cpp:1157
static const ImVec4 COL_MODIFIED
Definition ImGuiWrapper.hpp:412
static void text(const char *label)
Definition ImGuiWrapper.cpp:1128
static wxFont load_wxFont(const std::string &font_descriptor)
Definition WxFontUtils.cpp:190
@ undo
Definition GLGizmoEmboss.cpp:201

References _u8L, Slic3r::FontProp::boldness, Slic3r::GUI::button(), Slic3r::GUI::ImGuiWrapper::COL_MODIFIED, draw_bold_button(), draw_font_list(), draw_italic_button(), exist_change(), anonymous_namespace{GLGizmoEmboss.cpp}::hovered, Slic3r::GUI::WxFontUtils::load_wxFont(), m_gui_cfg, m_icons, Slic3r::GUI::GLGizmoBase::m_imgui, m_is_unknown_font, m_style_manager, m_text_lines, Slic3r::EmbossStyle::path, process(), Slic3r::EmbossStyle::prop, reinit_text_lines(), Slic3r::FontProp::skew, style, Slic3r::GUI::ImGuiWrapper::text(), Slic3r::GUI::ImGuiWrapper::text_colored(), and anonymous_namespace{GLGizmoEmboss.cpp}::undo.

Referenced by draw_window().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ draw_height()

void GLGizmoEmboss::draw_height ( bool use_inch)
private
2741{
2742 float &value = m_style_manager.get_font_prop().size_in_mm;
2743 const EmbossStyle* stored_style = m_style_manager.get_stored_style();
2744 const float *stored = (stored_style != nullptr)? &stored_style->prop.size_in_mm : nullptr;
2745 const char *size_format = use_inch ? "%.2f in" : "%.1f mm";
2746 const std::string revert_text_size = _u8L("Revert text size.");
2747 const std::string& name = m_gui_cfg->translations.height;
2748 if (rev_input_mm(name, value, stored, revert_text_size, 0.1f, 1.f, size_format, use_inch, m_scale_height))
2749 if (set_height())
2750 process();
2751}
bool set_height()
Definition GLGizmoEmboss.cpp:2710
float size_in_mm
Definition TextConfiguration.hpp:63

References _u8L, m_gui_cfg, m_scale_height, m_style_manager, process(), Slic3r::EmbossStyle::prop, rev_input_mm(), set_height(), and Slic3r::FontProp::size_in_mm.

Referenced by draw_window().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ draw_italic_button()

bool GLGizmoEmboss::draw_italic_button ( )
private
2478{
2479 const wxFont &wx_font = m_style_manager.get_wx_font();
2480 const auto& ff = m_style_manager.get_font_file_with_cache();
2481 if (!wx_font.IsOk() || !ff.has_value()) {
2483 return false;
2484 }
2485
2486 std::optional<float> &skew = m_style_manager.get_font_prop().skew;
2487 bool is_font_italic = skew.has_value() || WxFontUtils::is_italic(wx_font);
2488 if (is_font_italic) {
2489 // unset italic
2492 skew.reset();
2493 if (wx_font.GetStyle() != wxFontStyle::wxFONTSTYLE_NORMAL) {
2494 wxFont new_wx_font = wx_font; // copy
2495 new_wx_font.SetStyle(wxFontStyle::wxFONTSTYLE_NORMAL);
2496 if(!m_style_manager.set_wx_font(new_wx_font))
2497 return false;
2498 }
2499 return true;
2500 }
2501 if (ImGui::IsItemHovered())
2502 m_imgui->tooltip(_u8L("Unset italic"), m_gui_cfg->max_tooltip_width);
2503 } else {
2504 // set italic
2506 wxFont new_wx_font = wx_font; // copy
2507 auto new_ff = WxFontUtils::set_italic(new_wx_font, *ff.font_file);
2508 if (new_ff != nullptr) {
2509 if(!m_style_manager.set_wx_font(new_wx_font, std::move(new_ff)))
2510 return false;
2511 } else {
2512 // italic font doesn't exist
2513 // add skew when wxFont can't set it
2514 skew = 0.2f;
2515 }
2516 return true;
2517 }
2518 if (ImGui::IsItemHovered())
2519 m_imgui->tooltip(_u8L("Set italic"), m_gui_cfg->max_tooltip_width);
2520 }
2521 return false;
2522}
static std::unique_ptr< Slic3r::Emboss::FontFile > set_italic(wxFont &font, const Slic3r::Emboss::FontFile &prev_font_file)
Set italic into wx font When italic font is same as original return nullptr. To not load font file tw...
Definition WxFontUtils.cpp:343
static bool is_italic(const wxFont &font)
Definition WxFontUtils.cpp:298
@ italic
Definition GLGizmoEmboss.cpp:202
@ unitalic
Definition GLGizmoEmboss.cpp:203

References _u8L, Slic3r::GUI::clickable(), anonymous_namespace{GLGizmoEmboss.cpp}::disabled, Slic3r::GUI::draw(), anonymous_namespace{GLGizmoEmboss.cpp}::hovered, Slic3r::GUI::WxFontUtils::is_italic(), anonymous_namespace{GLGizmoEmboss.cpp}::italic, m_gui_cfg, m_icons, Slic3r::GUI::GLGizmoBase::m_imgui, m_style_manager, Slic3r::GUI::WxFontUtils::set_italic(), and anonymous_namespace{GLGizmoEmboss.cpp}::unitalic.

Referenced by draw_font_list_line().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ draw_model_type()

void GLGizmoEmboss::draw_model_type ( )
private
2029{
2030 ImGui::Spacing();
2031
2032 bool is_last_solid_part = m_volume->is_the_only_one_part();
2033 std::string title = _u8L("Operation");
2034 if (is_last_solid_part) {
2035 ImVec4 color{.5f, .5f, .5f, 1.f};
2036 m_imgui->text_colored(color, title.c_str());
2037 } else {
2038 ImGui::Text("%s", title.c_str());
2039 }
2040
2041 std::optional<ModelVolumeType> new_type;
2045 ModelVolumeType type = m_volume->type();
2046
2047 //TRN EmbossOperation
2048 float minimum_spacing_x = 8.0f;
2049 float minimum_offset_x = ImGui::GetCursorPosX() + minimum_spacing_x;
2050 float offset_x = std::max(m_gui_cfg->input_offset, minimum_offset_x);
2051 ImGui::SameLine();
2052
2053 ImGuiWrapper::push_radio_style(m_parent.get_scale()); // ORCA
2054 if (ImGui::RadioButton(_u8L("Join").c_str(), type == part))
2055 new_type = part;
2056 else if (ImGui::IsItemHovered())
2057 m_imgui->tooltip(_u8L("Click to change text into object part."), m_gui_cfg->max_tooltip_width);
2058
2059 ImGui::SameLine();
2060 std::string last_solid_part_hint = _u8L("You can't change a type of the last solid part of the object.");
2061 if (ImGui::RadioButton(_u8L_CONTEXT(L_CONTEXT("Cut", "EmbossOperation"), "EmbossOperation").c_str(), type == negative))
2062 new_type = negative;
2063 else if (ImGui::IsItemHovered()) {
2064 if (is_last_solid_part)
2065 m_imgui->tooltip(last_solid_part_hint, m_gui_cfg->max_tooltip_width);
2066 else if (type != negative)
2067 m_imgui->tooltip(_u8L("Click to change part type into negative volume."), m_gui_cfg->max_tooltip_width);
2068 }
2069
2070 // In simple mode are not modifiers
2071 if (wxGetApp().plater()->printer_technology() != ptSLA && wxGetApp().get_mode() != ConfigOptionMode::comSimple) {
2072 ImGui::SameLine();
2073 if (ImGui::RadioButton(_u8L("Modifier").c_str(), type == modifier))
2074 new_type = modifier;
2075 else if (ImGui::IsItemHovered()) {
2076 if (is_last_solid_part)
2077 m_imgui->tooltip(last_solid_part_hint, m_gui_cfg->max_tooltip_width);
2078 else if (type != modifier)
2079 m_imgui->tooltip(_u8L("Click to change part type into modifier."), m_gui_cfg->max_tooltip_width);
2080 }
2081 }
2083
2084 if (m_volume != nullptr && new_type.has_value() && !is_last_solid_part) {
2085 GUI_App &app = wxGetApp();
2086 Plater * plater = app.plater();
2087 Plater::TakeSnapshot snapshot(plater, _u8L("Change Text Type"), UndoRedo::SnapshotType::GizmoAction);
2088 m_volume->set_type(*new_type);
2089
2090 bool is_volume_move_inside = (type == part);
2091 bool is_volume_move_outside = (*new_type == part);
2092 // Update volume position when switch (from part) or (into part)
2093 if ((is_volume_move_inside || is_volume_move_outside))
2094 process();
2095
2096 // inspiration in ObjectList::set_volume_type()
2097 // how to view correct side panel with objects
2098 ObjectList *obj_list = app.obj_list();
2099 wxDataViewItemArray sel = obj_list->reorder_volumes_and_get_selection(
2101 [volume = m_volume](const ModelVolume *vol) { return vol == volume; });
2102 if (!sel.IsEmpty()) obj_list->select_item(sel.front());
2103
2104 // NOTE: on linux, function reorder_volumes_and_get_selection call GLCanvas3D::reload_scene(refresh_immediately = false)
2105 // which discard m_volume pointer and set it to nullptr also selection is cleared so gizmo is automaticaly closed
2106 auto &mng = m_parent.get_gizmos_manager();
2107 if (mng.get_current_type() != GLGizmosManager::Emboss)
2108 mng.open_gizmo(GLGizmosManager::Emboss);
2109 // TODO: select volume back - Ask @Sasa
2110 }
2111}
ObjectList * obj_list()
Definition GUI_App.cpp:9699
Plater * plater()
Definition GUI_App.cpp:9709
static void pop_radio_style()
Definition ImGuiWrapper.cpp:2950
static void push_radio_style(const float scale)
Definition ImGuiWrapper.cpp:2938
wxDataViewItemArray reorder_volumes_and_get_selection(int obj_idx, std::function< bool(const ModelVolume *)> add_to_selection=nullptr)
Definition GUI_ObjectList.cpp:6986
int get_selected_obj_idx() const
Definition GUI_ObjectList.cpp:727
void select_item(const wxDataViewItem &item)
Definition GUI_ObjectList.cpp:5269
static PrinterTechnology printer_technology()
Definition GUI_Factories.cpp:60
static ObjectList * obj_list()
Definition GUI_Factories.cpp:405
@ ObjectList
Definition Shortcuts.hpp:21
@ GizmoAction
Definition UndoRedo.hpp:36
@ comSimple
Definition Config.hpp:222
ModelVolumeType
Definition Model.hpp:355
@ PARAMETER_MODIFIER
Definition Model.hpp:359
@ MODEL_PART
Definition Model.hpp:357
@ NEGATIVE_VOLUME
Definition Model.hpp:358
@ ptSLA
Definition Config.hpp:233

References _u8L, _u8L_CONTEXT, Slic3r::comSimple, Slic3r::GUI::GLGizmosManager::Emboss, Slic3r::UndoRedo::GizmoAction, L_CONTEXT, m_gui_cfg, Slic3r::GUI::GLGizmoBase::m_imgui, Slic3r::GUI::GLGizmoBase::m_parent, m_volume, Slic3r::MODEL_PART, Slic3r::NEGATIVE_VOLUME, Slic3r::GUI::GUI_App::obj_list(), Slic3r::GUI::obj_list(), Slic3r::PARAMETER_MODIFIER, Slic3r::GUI::GUI_App::plater(), Slic3r::GUI::plater(), Slic3r::GUI::ImGuiWrapper::pop_radio_style(), Slic3r::GUI::printer_technology(), process(), Slic3r::ptSLA, and Slic3r::GUI::ImGuiWrapper::push_radio_style().

Referenced by draw_window().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ draw_style_add_button()

void GLGizmoEmboss::draw_style_add_button ( )
private
2236{
2237 bool only_add_style = !m_style_manager.exist_stored_style();
2238 bool can_add = true;
2239 if (only_add_style &&
2240 m_volume->text_configuration->style.type != WxFontUtils::get_current_type())
2241 can_add = false;
2242
2243 std::string title = _u8L("Save as new style");
2244 const char *popup_id = title.c_str();
2245 // save as new style
2246 ImGui::SameLine();
2247 if (draw_button(m_icons, IconType::add, !can_add)) {
2248 if (!m_style_manager.exist_stored_style()) {
2249 m_style_manager.store_styles_to_app_config(wxGetApp().app_config);
2250 } else {
2251 ImGui::OpenPopup(popup_id);
2252 }
2253 } else if (ImGui::IsItemHovered()) {
2254 if (!can_add) {
2255 m_imgui->tooltip(_u8L("Only valid font can be added to style."), m_gui_cfg->max_tooltip_width);
2256 } else if (only_add_style) {
2257 m_imgui->tooltip(_u8L("Add style to my list."), m_gui_cfg->max_tooltip_width);
2258 } else {
2259 m_imgui->tooltip(_u8L("Save as new style."), m_gui_cfg->max_tooltip_width);
2260 }
2261 }
2262
2263 if (ImGui::BeginPopupModal(popup_id, nullptr, ImGuiWindowFlags_AlwaysAutoResize)) {
2264 m_imgui->disable_background_fadeout_animation();
2266 ImGui::EndPopup();
2267 }
2268}
void draw_style_save_as_popup()
Definition GLGizmoEmboss.cpp:2197
static EmbossStyle::Type get_current_type()
Definition WxFontUtils.cpp:120
@ add
Definition GLGizmoEmboss.cpp:199

References _u8L, anonymous_namespace{GLGizmoEmboss.cpp}::add, draw_style_save_as_popup(), Slic3r::GUI::WxFontUtils::get_current_type(), m_gui_cfg, m_icons, Slic3r::GUI::GLGizmoBase::m_imgui, m_style_manager, and m_volume.

Referenced by draw_style_list().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ draw_style_list()

void GLGizmoEmboss::draw_style_list ( )
private
2328 {
2329 if (!m_style_manager.is_active_font()) return;
2330
2331 const StyleManager::Style *stored_style = nullptr;
2332 bool is_stored = m_style_manager.exist_stored_style();
2333 if (is_stored)
2334 stored_style = m_style_manager.get_stored_style();
2335 const StyleManager::Style &current_style = m_style_manager.get_style();
2336 bool is_changed = (stored_style)? !(*stored_style == current_style) : true;
2337 bool is_modified = is_stored && is_changed;
2338
2339 const float &max_style_name_width = m_gui_cfg->max_style_name_width;
2340 std::string &trunc_name = m_style_manager.get_truncated_name();
2341 if (trunc_name.empty()) {
2342 // generate trunc name
2343 std::string current_name = current_style.name;
2345 trunc_name = ImGuiWrapper::trunc(current_name, max_style_name_width);
2346 }
2347
2348 ImGui::AlignTextToFramePadding();
2349
2350 std::string title = _u8L("Style");
2351 if (m_style_manager.exist_stored_style())
2352 ImGui::Text("%s", title.c_str());
2353 else
2354 ImGui::TextColored(ImGuiWrapper::COL_ORCA, "%s", title.c_str());
2355
2356 ImGui::SameLine(m_gui_cfg->input_offset);
2357
2358 ImGui::SetNextItemWidth(2 * m_gui_cfg->input_width);
2359 auto add_text_modify = [&is_modified](const std::string& name) {
2360 if (!is_modified) return name;
2361 return name + Preset::suffix_modified();
2362 };
2363 std::optional<size_t> selected_style_index;
2364 std::string tooltip = "";
2366 if (ImGui::BBLBeginCombo("##style_selector", add_text_modify(trunc_name).c_str())) {
2367 m_style_manager.init_style_images(m_gui_cfg->max_style_image_size, m_text);
2368 m_style_manager.init_trunc_names(max_style_name_width);
2369 std::optional<std::pair<size_t,size_t>> swap_indexes;
2370
2371 ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0));
2372 ImGui::PushStyleVar(ImGuiStyleVar_ItemInnerSpacing, ImVec2(0, 0));
2373 ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 0);
2374 ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0));
2375 ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
2376 ImGui::PushStyleVar(ImGuiStyleVar_SelectableTextAlign, ImVec2(0.0f, 0.5f)); // vertically align label
2377
2378 const StyleManager::Styles &styles = m_style_manager.get_styles();
2379 for (const StyleManager::Style &style : styles) {
2380 size_t index = &style - &styles.front();
2381 const std::string &actual_style_name = style.name;
2382 ImGui::PushID(actual_style_name.c_str());
2383 bool is_selected = (index == m_style_manager.get_style_index());
2384
2385 ImVec2 selectable_size(0, m_imgui->scaled(32.f / 15.f)); // 0.0f -> calculated during draw
2386 // allow click delete button
2387 ImGuiSelectableFlags_ flags = ImGuiSelectableFlags_AllowItemOverlap;
2388 if (ImGui::BBLSelectable(style.truncated_name.c_str(), is_selected, flags, selectable_size)) {
2389 selected_style_index = index;
2390 } else if (ImGui::IsItemHovered())
2391 tooltip = actual_style_name;
2392
2393 // reorder items
2394 if (ImGui::IsItemActive() && !ImGui::IsItemHovered()) {
2395 if (ImGui::GetMouseDragDelta(0).y < 0.f) {
2396 if (index > 0)
2397 swap_indexes = {index, index - 1};
2398 } else if ((index + 1) < styles.size())
2399 swap_indexes = {index, index + 1};
2400 if (swap_indexes.has_value())
2401 ImGui::ResetMouseDragDelta();
2402 }
2403
2404 const std::optional<StyleManager::StyleImage> &img = style.image;
2405 // draw style name
2406 if (img.has_value()) {
2407 ImGui::SameLine(max_style_name_width);
2408 ImVec4 tint_color = ImGui::GetStyleColorVec4(ImGuiCol_Text);
2409 ImGui::Image(img->texture_id, img->tex_size, img->uv0, img->uv1, tint_color);
2410 }
2411
2412 ImGui::PopID();
2413 }
2414 if (swap_indexes.has_value())
2415 m_style_manager.swap(swap_indexes->first,
2416 swap_indexes->second);
2417
2418 // ImGuiStyleVar_ItemSpacing, ImGuiStyleVar_ItemInnerSpacing, ImGuiStyleVar_FrameRounding,
2419 // ImGuiStyleVar_WindowPadding, ImGuiStyleVar_FramePadding, ImGuiStyleVar_SelectableTextAlign
2420 ImGui::PopStyleVar(6);
2421 ImGui::EndCombo();
2422 } else {
2423 // do not keep in memory style images when no combo box open
2424 m_style_manager.free_style_images();
2425 if (ImGui::IsItemHovered()) {
2426 std::string style_name = add_text_modify(current_style.name);
2427 tooltip = is_modified?
2428 GUI::format(_L("Modified style \"%1%\""), current_style.name):
2429 GUI::format(_L("Current style is \"%1%\""), current_style.name);
2430 }
2431 }
2433 if (!tooltip.empty())
2434 m_imgui->tooltip(tooltip, m_gui_cfg->max_tooltip_width);
2435
2436 // Check whether user wants lose actual style modification
2437 if (selected_style_index.has_value() && is_modified) {
2438 const std::string & style_name = m_style_manager.get_styles()[*selected_style_index].name;
2439 wxString message = GUI::format_wxstr(_L("Changing style to \"%1%\" will discard current style modification.\n\nWould you like to continue anyway?"), style_name);
2440 MessageDialog not_loaded_style_message(nullptr, message, _L("Warning"), wxICON_WARNING | wxYES | wxNO);
2441 if (not_loaded_style_message.ShowModal() != wxID_YES)
2442 selected_style_index.reset();
2443 }
2444
2445 // selected style from combo box
2446 if (selected_style_index.has_value()) {
2447 const StyleManager::Style &style = m_style_manager.get_styles()[*selected_style_index];
2448 // create copy to be able do fix transformation only when successfully load style
2449 StyleManager::Style cur_s = current_style; // copy
2450 StyleManager::Style new_s = style; // copy
2451 if (m_style_manager.load_style(*selected_style_index)) {
2452 ::fix_transformation(cur_s, new_s, m_parent);
2453 process();
2454 } else {
2455 wxString title = _L("Not valid style.");
2456 wxString message = GUI::format_wxstr(_L("Style \"%1%\" can't be used and will be removed from a list."), style.name);
2457 MessageDialog not_loaded_style_message(nullptr, message, title, wxOK);
2458 not_loaded_style_message.ShowModal();
2459 m_style_manager.erase(*selected_style_index);
2460 }
2461 }
2462
2463 ImGui::SameLine();
2465
2466 ImGui::SameLine();
2467 draw_style_save_button(is_modified);
2468
2469 ImGui::SameLine();
2471
2472 // delete button
2473 ImGui::SameLine();
2475}
std::vector< Style > Styles
Definition EmbossStyleManager.hpp:226
std::string format(float value, unsigned int decimals) const
Definition GLGizmoBase.cpp:519
void draw_style_rename_button()
Definition GLGizmoEmboss.cpp:2159
void draw_style_add_button()
Definition GLGizmoEmboss.cpp:2235
void draw_style_save_button(bool is_modified)
Definition GLGizmoEmboss.cpp:2179
void draw_delete_style_button()
Definition GLGizmoEmboss.cpp:2270
static void escape_double_hash(std::string &text)
Escape ## in data by add space between hashes Needed when user written text is visualized by ImGui.
Definition ImGuiWrapper.cpp:2466
static std::string trunc(const std::string &text, float width, const char *tail=" ..")
Truncate text by ImGui draw function to specific width NOTE 1: ImGui must be initialized NOTE 2: Calc...
Definition ImGuiWrapper.cpp:2427
static const ImVec4 COL_ORCA
Definition ImGuiWrapper.hpp:408
static const std::string & suffix_modified()
Definition Preset.cpp:505
std::string name
Definition TextConfiguration.hpp:120

References _L, _u8L, Slic3r::GUI::ImGuiWrapper::COL_ORCA, draw_delete_style_button(), draw_style_add_button(), draw_style_rename_button(), draw_style_save_button(), Slic3r::GUI::ImGuiWrapper::escape_double_hash(), Slic3r::GUI::format(), Slic3r::GUI::format_wxstr(), m_gui_cfg, Slic3r::GUI::GLGizmoBase::m_imgui, Slic3r::GUI::GLGizmoBase::m_parent, m_style_manager, m_text, Slic3r::EmbossStyle::name, Slic3r::GUI::ImGuiWrapper::pop_combo_style(), process(), Slic3r::GUI::ImGuiWrapper::push_combo_style(), Slic3r::GUI::DPIAware< P >::ShowModal(), style, Slic3r::Preset::suffix_modified(), and Slic3r::GUI::ImGuiWrapper::trunc().

Referenced by draw_window().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ draw_style_rename_button()

void GLGizmoEmboss::draw_style_rename_button ( )
private
2160{
2161 bool can_rename = m_style_manager.exist_stored_style();
2162 std::string title = _u8L("Rename style");
2163 const char * popup_id = title.c_str();
2164 if (draw_button(m_icons, IconType::rename, !can_rename)) {
2165 assert(m_style_manager.get_stored_style());
2166 ImGui::OpenPopup(popup_id);
2167 }
2168 else if (ImGui::IsItemHovered()) {
2169 if (can_rename) m_imgui->tooltip(_u8L("Rename current style."), m_gui_cfg->max_tooltip_width);
2170 else m_imgui->tooltip(_u8L("Can't rename temporary style."), m_gui_cfg->max_tooltip_width);
2171 }
2172 if (ImGui::BeginPopupModal(popup_id, 0, ImGuiWindowFlags_AlwaysAutoResize)) {
2173 m_imgui->disable_background_fadeout_animation();
2175 ImGui::EndPopup();
2176 }
2177}
void draw_style_rename_popup()
Definition GLGizmoEmboss.cpp:2113
@ rename
Definition GLGizmoEmboss.cpp:197

References _u8L, draw_style_rename_popup(), m_gui_cfg, m_icons, Slic3r::GUI::GLGizmoBase::m_imgui, m_style_manager, and anonymous_namespace{GLGizmoEmboss.cpp}::rename.

Referenced by draw_style_list().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ draw_style_rename_popup()

void GLGizmoEmboss::draw_style_rename_popup ( )
private
2113 {
2114 std::string& new_name = m_style_manager.get_style().name;
2115 const std::string &old_name = m_style_manager.get_stored_style()->name;
2116 std::string text_in_popup = GUI::format(_L("Rename style (%1%) for embossing text"), old_name) + ": ";
2117 ImGui::Text("%s", text_in_popup.c_str());
2118
2119 bool is_unique = (new_name == old_name) || // could be same as before rename
2120 m_style_manager.is_unique_style_name(new_name);
2121
2122 bool allow_change = false;
2123 if (new_name.empty()) {
2125 }else if (!is_unique) {
2127 } else {
2128 ImGui::NewLine();
2129 allow_change = true;
2130 }
2131
2132 bool store = false;
2133 ImGuiInputTextFlags flags = ImGuiInputTextFlags_EnterReturnsTrue;
2134 if (ImGui::InputText("##rename style", &new_name, flags) && allow_change) store = true;
2135 if (m_imgui->button(_L("OK"), ImVec2(0.f, 0.f), allow_change)) store = true;
2136 ImGui::SameLine();
2137 if (ImGui::Button(_u8L("Cancel").c_str())) {
2138 new_name = old_name;
2139 ImGui::CloseCurrentPopup();
2140 }
2141
2142 if (store) {
2143 // rename style in all objects and volumes
2144 for (const ModelObject *mo :wxGetApp().plater()->model().objects) {
2145 for (ModelVolume *mv : mo->volumes) {
2146 if (!mv->text_configuration.has_value()) continue;
2147 std::string& name = mv->text_configuration->style.name;
2148 if (name != old_name) continue;
2149 name = new_name;
2150 }
2151 }
2152
2153 m_style_manager.rename(new_name);
2154 m_style_manager.store_styles_to_app_config();
2155 ImGui::CloseCurrentPopup();
2156 }
2157}
static const ImVec4 COL_ORANGE_DARK
Definition ImGuiWrapper.hpp:386
std::optional< TextConfiguration > text_configuration
Definition Model.hpp:1015
bool is_unique(const Points &points)
Definition Triangulation.cpp:67

References _L, _u8L, Slic3r::GUI::ImGuiWrapper::COL_ORANGE_DARK, Slic3r::GUI::format(), Slic3r::GUI::GLGizmoBase::m_imgui, m_style_manager, Slic3r::GUI::plater(), Slic3r::GUI::ImGuiWrapper::text_colored(), and Slic3r::ModelVolume::text_configuration.

Referenced by draw_style_rename_button().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ draw_style_save_as_popup()

void GLGizmoEmboss::draw_style_save_as_popup ( )
private
2197 {
2198 ImGui::Text("%s", (_u8L("New name of style") +": ").c_str());
2199
2200 // use name inside of volume configuration as temporary new name
2201 std::string &new_name = m_volume->text_configuration->style.name;
2202 bool is_unique = m_style_manager.is_unique_style_name(new_name);
2203 bool allow_change = false;
2204 if (new_name.empty()) {
2206 }else if (!is_unique) {
2208 } else {
2209 ImGui::NewLine();
2210 allow_change = true;
2211 }
2212
2213 bool save_style = false;
2214 ImGuiInputTextFlags flags = ImGuiInputTextFlags_EnterReturnsTrue;
2215 if (ImGui::InputText("##save as style", &new_name, flags))
2216 save_style = true;
2217
2218 if (m_imgui->button(_L("OK"), ImVec2(0.f, 0.f), allow_change))
2219 save_style = true;
2220
2221 ImGui::SameLine();
2222 if (ImGui::Button(_u8L("Cancel").c_str())){
2223 // write original name to volume TextConfiguration
2224 new_name = m_style_manager.get_style().name;
2225 ImGui::CloseCurrentPopup();
2226 }
2227
2228 if (save_style && allow_change) {
2229 m_style_manager.add_style(new_name);
2230 m_style_manager.store_styles_to_app_config();
2231 ImGui::CloseCurrentPopup();
2232 }
2233}

References _L, _u8L, Slic3r::GUI::ImGuiWrapper::COL_ORANGE_DARK, Slic3r::GUI::GLGizmoBase::m_imgui, m_style_manager, m_volume, and Slic3r::GUI::ImGuiWrapper::text_colored().

Referenced by draw_style_add_button().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ draw_style_save_button()

void GLGizmoEmboss::draw_style_save_button ( bool is_modified)
private
2180{
2181 if (draw_button(m_icons, IconType::save, !is_modified)) {
2182 // save styles to app config
2183 m_style_manager.store_styles_to_app_config();
2184 }else if (ImGui::IsItemHovered()) {
2185 std::string tooltip;
2186 if (!m_style_manager.exist_stored_style()) {
2187 tooltip = _u8L("First Add style to list.");
2188 } else if (is_modified) {
2189 tooltip = GUI::format(_L("Save %1% style"), m_style_manager.get_style().name);
2190 } else {
2191 tooltip = _u8L("No changes to save.");
2192 }
2193 m_imgui->tooltip(tooltip, m_gui_cfg->max_tooltip_width);
2194 }
2195}
@ save
Definition GLGizmoEmboss.cpp:200

References _L, _u8L, Slic3r::GUI::format(), m_gui_cfg, m_icons, Slic3r::GUI::GLGizmoBase::m_imgui, m_style_manager, and anonymous_namespace{GLGizmoEmboss.cpp}::save.

Referenced by draw_style_list().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ draw_text_input()

void GLGizmoEmboss::draw_text_input ( )
private
1634{
1635 auto create_range_text_prep = [&mng = m_style_manager, &text = m_text, &exist_unknown = m_text_contain_unknown_glyph]() {
1636 auto& ff = mng.get_font_file_with_cache();
1637 assert(ff.has_value());
1638 const auto &cn = mng.get_font_prop().collection_number;
1639 unsigned int font_index = (cn.has_value()) ? *cn : 0;
1640 return create_range_text(text, *ff.font_file, font_index, &exist_unknown);
1641 };
1642
1643 double scale = m_scale_height.has_value() ? *m_scale_height : 1.;
1644 ImFont *imgui_font = m_style_manager.get_imgui_font();
1645 if (imgui_font == nullptr) {
1646 // try create new imgui font
1647 double screen_scale = wxDisplay(wxGetApp().plater()).GetScaleFactor();
1648 double imgui_scale = scale * screen_scale;
1649 m_style_manager.create_imgui_font(create_range_text_prep(), imgui_scale);
1650 imgui_font = m_style_manager.get_imgui_font();
1651 }
1652 bool exist_font =
1653 imgui_font != nullptr &&
1654 imgui_font->IsLoaded() &&
1655 imgui_font->Scale > 0.f &&
1656 imgui_font->ContainerAtlas != nullptr;
1657 // NOTE: Symbol fonts doesn't have atlas
1658 // when their glyph range is out of language character range
1659 if (exist_font) ImGui::PushFont(imgui_font);
1660
1661 // show warning about incorrectness view of font
1662 std::string warning_tool_tip;
1663 if (!exist_font) {
1664 warning_tool_tip = _u8L("The text cannot be written using the selected font. Please try choosing a different font.");
1665 } else {
1666 auto append_warning = [&warning_tool_tip](std::string t) {
1667 if (!warning_tool_tip.empty())
1668 warning_tool_tip += "\n";
1669 warning_tool_tip += t;
1670 };
1671 if (is_text_empty(m_text))
1672 append_warning(_u8L("Embossed text cannot contain only white spaces."));
1674 append_warning(_u8L("Text contains character glyph (represented by '?') unknown by font."));
1675
1676 const FontProp &prop = m_style_manager.get_font_prop();
1677 if (prop.skew.has_value()) append_warning(_u8L("Text input doesn't show font skew."));
1678 if (prop.boldness.has_value()) append_warning(_u8L("Text input doesn't show font boldness."));
1679 if (prop.line_gap.has_value()) append_warning(_u8L("Text input doesn't show gap between lines."));
1680 auto &ff = m_style_manager.get_font_file_with_cache();
1681 float imgui_size = StyleManager::get_imgui_font_size(prop, *ff.font_file, scale);
1682 if (imgui_size > StyleManager::max_imgui_font_size)
1683 append_warning(_u8L("Too tall, diminished font height inside text input."));
1684 if (imgui_size < StyleManager::min_imgui_font_size)
1685 append_warning(_u8L("Too small, enlarged font height inside text input."));
1686 bool is_multiline = m_text_lines.get_lines().size() > 1;
1687 if (is_multiline && (prop.align.first == FontProp::HorizontalAlign::center || prop.align.first == FontProp::HorizontalAlign::right))
1688 append_warning(_u8L("Text doesn't show current horizontal alignment."));
1689 }
1690
1691 // flag for extend font ranges if neccessary
1692 // ranges can't be extend during font is activ(pushed)
1693 std::string range_text;
1694 ImVec2 input_size(m_gui_cfg->text_size.x, m_gui_cfg->text_size.y);
1695 const ImGuiInputTextFlags flags = ImGuiInputTextFlags_AllowTabInput | ImGuiInputTextFlags_AutoSelectAll;
1696 if (ImGui::InputTextMultiline("##Text", &m_text, input_size, flags)) {
1697 if (m_style_manager.get_font_prop().per_glyph) {
1698 unsigned count_lines = get_count_lines(m_text);
1699 if (count_lines != m_text_lines.get_lines().size())
1700 // Necesarry to initialize count by given number (differ from stored in volume at the moment)
1701 reinit_text_lines(count_lines);
1702 }
1703 process();
1704 range_text = create_range_text_prep();
1705 }
1706
1707 if (exist_font) ImGui::PopFont();
1708
1709 // warning tooltip has to be with default font
1710 if (!warning_tool_tip.empty()) {
1711 // Multiline input has hidden window for scrolling
1712 const ImGuiWindow *input = ImGui::GetCurrentWindow()->DC.ChildWindows.front();
1713 const ImGuiStyle &style = ImGui::GetStyle();
1714 float scrollbar_width = (input->ScrollbarY) ? style.ScrollbarSize : 0.f;
1715 float scrollbar_height = (input->ScrollbarX) ? style.ScrollbarSize : 0.f;
1716
1717 if (ImGui::IsItemHovered())
1718 m_imgui->tooltip(warning_tool_tip, m_gui_cfg->max_tooltip_width);
1719
1720 ImVec2 cursor = ImGui::GetCursorPos();
1721 float width = ImGui::GetContentRegionAvailWidth();
1722 const ImVec2& padding = style.FramePadding;
1723 ImVec2 icon_pos(width - m_gui_cfg->icon_width - scrollbar_width + padding.x,
1724 cursor.y - 2 * m_gui_cfg->icon_width - scrollbar_height - 2*padding.y); // ORCA fix vertical position
1725
1726 ImGui::SetCursorPos(icon_pos);
1728 ImGui::SetCursorPos(cursor);
1729 }
1730
1731 // NOTE: must be after ImGui::font_pop()
1732 // -> imgui_font has to be unused
1733 // IMPROVE: only extend not clear
1734 // Extend font ranges
1735 if (!range_text.empty() &&
1736 !ImGuiWrapper::contain_all_glyphs(imgui_font, range_text) )
1737 m_style_manager.clear_imgui_font();
1738}
static float get_imgui_font_size(const FontProp &prop, const Slic3r::Emboss::FontFile &file, double scale)
Definition EmbossStyleManager.cpp:448
static float min_imgui_font_size
Definition EmbossStyleManager.hpp:233
static float max_imgui_font_size
Definition EmbossStyleManager.hpp:234
bool m_text_contain_unknown_glyph
Definition GLGizmoEmboss.hpp:209
static bool contain_all_glyphs(const ImFont *font, const std::string &text)
Check that font ranges contain all chars in string (rendered Unicodes are stored in GlyphRanges).
Definition ImGuiWrapper.cpp:2598
std::string create_range_text(const std::string &text, const FontFile &font, unsigned int font_index, bool *exist_unknown=nullptr)
Create unique character set from string with filtered from text with only character from font.
Definition Emboss.cpp:1529
coord_t width(const BoundingBox &box)
Definition Arrange.cpp:1184
@ exclamation
Definition GLGizmoEmboss.cpp:208

References _u8L, Slic3r::FontProp::align, Slic3r::FontProp::boldness, Slic3r::FontProp::center, Slic3r::GUI::ImGuiWrapper::contain_all_glyphs(), Slic3r::Emboss::create_range_text(), Slic3r::GUI::draw(), anonymous_namespace{GLGizmoEmboss.cpp}::exclamation, Slic3r::Emboss::get_count_lines(), Slic3r::GUI::Emboss::StyleManager::get_imgui_font_size(), anonymous_namespace{GLGizmoEmboss.cpp}::hovered, Slic3r::FontProp::line_gap, m_gui_cfg, m_icons, Slic3r::GUI::GLGizmoBase::m_imgui, m_scale_height, m_style_manager, m_text, m_text_contain_unknown_glyph, m_text_lines, Slic3r::GUI::Emboss::StyleManager::max_imgui_font_size, Slic3r::GUI::Emboss::StyleManager::min_imgui_font_size, Slic3r::GUI::plater(), process(), reinit_text_lines(), Slic3r::FontProp::right, scale(), Slic3r::FontProp::skew, and style.

Referenced by draw_window().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ draw_window()

void GLGizmoEmboss::draw_window ( float x,
float y )
private
1491{
1492#ifdef ALLOW_DEBUG_MODE
1493 if (ImGui::Button("re-process")) process();
1494#endif // ALLOW_DEBUG_MODE
1495
1496 // Setter of indent must be befor disable !!!
1497 ImGui::PushStyleVar(ImGuiStyleVar_IndentSpacing, m_gui_cfg->indent);
1498 ScopeGuard indent_sc([](){ ImGui::PopStyleVar(/*ImGuiStyleVar_IndentSpacing*/); });
1499
1500 // Disable all except selection of font, when open text from 3mf with unknown font
1501 m_imgui->disabled_begin(m_is_unknown_font);
1502 ScopeGuard unknown_font_sc([imgui = m_imgui]() { imgui->disabled_end(/*m_is_unknown_font*/); });
1503
1505
1506 // subtract 4.0f to counteract weird additional spacing/padding of the revert buttons
1507 ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(10.0f, 10.0f - 4.0f));
1508 ScopeGuard spacing_sc([](){ ImGui::PopStyleVar(/*ImGuiStyleVar_ItemSpacing*/); });
1509
1511
1512 // When unknown font is inside .3mf only font selection is allowed
1513 m_imgui->disabled_end(/*m_is_unknown_font*/);
1515 m_imgui->disabled_begin(m_is_unknown_font);
1516
1517 bool use_inch = wxGetApp().app_config->get_bool("use_inches");
1518 draw_height(use_inch);
1519 draw_depth(use_inch);
1520
1521 ImGui::Spacing();
1522
1523 // close advanced style property when unknown font is selected
1525 ImGui::SetNextTreeNodeOpen(false);
1526
1527 // ImGui Bug: After switching to another window and switching back, clicking the text doesnt open/close the TreeNode anymore
1528 ImGuiTreeNodeFlags flags = ImGuiTreeNodeFlags_SpanAvailWidth | ImGuiTreeNodeFlags_FramePadding;
1529 if (ImGui::TreeNodeEx(_u8L("Advanced").c_str(), flags)) {
1532 m_imgui->set_requires_extra_frame();
1533 } else {
1534 draw_advanced();
1535 }
1536 ImGui::TreePop();
1537 } else if (m_is_advanced_edit_style) {
1539 m_imgui->set_requires_extra_frame();
1540 }
1541
1542 ImGui::Spacing();
1543
1544 // Do not select volume type, when it is text object
1545 if (!m_volume->is_the_only_one_part()) {
1546 ImGui::Separator();
1548 }
1549
1550 ImGui::Spacing();
1551 ImGui::Separator();
1552 ImGui::Spacing();
1553 float f_scale = m_parent.get_gizmos_manager().get_layout_scale();
1554 ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(6.0f, 4.0f * f_scale));
1555
1557
1558 ImGui::SameLine();
1559 m_imgui->disabled_begin(is_changed_from_default_style());
1560 if (m_imgui->button(_L("Reset"), _L("Reset all options except the text and operation"))) {
1562 }
1563 m_imgui->disabled_end();
1564
1565 ImGui::SameLine();
1567
1568 if (m_imgui->button(_L("Done"))) {
1569 m_parent.reset_all_gizmos();
1570 }
1571
1572 ImGui::PopStyleVar(1); // ImGuiStyleVar_FramePadding
1573
1574#ifdef SHOW_WX_FONT_DESCRIPTOR
1575 if (is_selected_style)
1576 m_imgui->text_colored(ImGuiWrapper::COL_GREY_DARK, m_style_manager.get_style().path);
1577#endif // SHOW_WX_FONT_DESCRIPTOR
1578
1579#ifdef SHOW_CONTAIN_3MF_FIX
1580 if (m_volume!=nullptr &&
1581 m_volume->text_configuration.has_value() &&
1582 m_volume->text_configuration->fix_3mf_tr.has_value()) {
1583 ImGui::SameLine();
1584 m_imgui->text_colored(ImGuiWrapper::COL_GREY_DARK, ".3mf");
1585 if (ImGui::IsItemHovered()) {
1586 Transform3d &fix = *m_volume->text_configuration->fix_3mf_tr;
1587 std::stringstream ss;
1588 ss << fix.matrix();
1589 std::string filename = (m_volume->source.input_file.empty())? "unknown.3mf" :
1590 m_volume->source.input_file + ".3mf";
1591 ImGui::SetTooltip("Text configuation contain \n"
1592 "Fix Transformation Matrix \n"
1593 "%s\n"
1594 "loaded from \"%s\" file.",
1595 ss.str().c_str(), filename.c_str()
1596 );
1597 }
1598 }
1599#endif // SHOW_CONTAIN_3MF_FIX
1600#ifdef SHOW_ICONS_TEXTURE
1601 auto &t = m_icons_texture;
1602 ImGui::Image((void *) t.get_id(), ImVec2(t.get_width(), t.get_height()));
1603#endif //SHOW_ICONS_TEXTURE
1604#ifdef SHOW_IMGUI_ATLAS
1605 const auto &atlas = m_style_manager.get_atlas();
1606 ImGui::Image(atlas.TexID, ImVec2(atlas.TexWidth, atlas.TexHeight));
1607#endif // SHOW_IMGUI_ATLAS
1608
1609#ifdef ALLOW_OPEN_NEAR_VOLUME
1610 ImGui::SameLine();
1611 if (ImGui::Checkbox("##ALLOW_OPEN_NEAR_VOLUME", &m_allow_open_near_volume)) {
1612 if (m_allow_open_near_volume)
1613 m_set_window_offset = calc_fine_position(m_parent.get_selection(), get_minimal_window_size(), m_parent.get_canvas_size());
1614 } else if (ImGui::IsItemHovered()) {
1615 ImGui::SetTooltip("%s", ((m_allow_open_near_volume) ?
1616 "Fix settings position":
1617 "Allow floating window near text").c_str());
1618 }
1619#endif // ALLOW_FLOAT_WINDOW
1620 }
bool is_changed_from_default_style()
Definition GLGizmoEmboss.cpp:1387
void draw_text_input()
Definition GLGizmoEmboss.cpp:1633
void draw_depth(bool use_inch)
Definition GLGizmoEmboss.cpp:2753
void draw_style_list()
Definition GLGizmoEmboss.cpp:2328
bool m_is_advanced_edit_style
Definition GLGizmoEmboss.hpp:185
void draw_font_list_line()
Definition GLGizmoEmboss.cpp:1827
void draw_height(bool use_inch)
Definition GLGizmoEmboss.cpp:2740
void draw_advanced()
Definition GLGizmoEmboss.cpp:2834
std::vector< std::pair< wxString, wxString > > m_shortcuts
Definition GLGizmoEmboss.hpp:244
void draw_model_type()
Definition GLGizmoEmboss.cpp:2028
void reset_to_default_style()
Definition GLGizmoEmboss.cpp:1396
void begin_right_aligned_buttons(const std::vector< wxString > &labels)
Definition GLGizmoUtils.cpp:135
void render_tooltip_button(ImGuiWrapper *imgui_wrapper, const GLCanvas3D &canvas, const std::vector< std::pair< wxString, wxString > > &shortcuts, float x, float y)
Definition GLGizmoUtils.cpp:48
ImVec2 calc_fine_position(const Selection &selection, const ImVec2 &windows_size, const Size &canvas_size)
Move window for edit emboss text near to embossed object NOTE: embossed object must be selected.
Definition GLGizmoEmboss.cpp:3530

References _L, _u8L, Slic3r::GUI::GLGizmoUtils::begin_right_aligned_buttons(), Slic3r::GUI::ImGuiWrapper::COL_GREY_DARK, draw_advanced(), draw_depth(), draw_font_list_line(), draw_height(), draw_model_type(), draw_style_list(), draw_text_input(), is_changed_from_default_style(), m_gui_cfg, Slic3r::GUI::GLGizmoBase::m_imgui, m_is_advanced_edit_style, m_is_unknown_font, Slic3r::GUI::GLGizmoBase::m_parent, m_shortcuts, m_style_manager, m_volume, process(), Slic3r::GUI::GLGizmoUtils::render_tooltip_button(), and reset_to_default_style().

Referenced by on_render_input_window().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ format()

std::string Slic3r::GUI::GLGizmoBase::format ( float value,
unsigned int decimals ) const
protectedinherited

◆ get_action_snapshot_name()

std::string GLGizmoEmboss::get_action_snapshot_name ( ) const
overrideprotectedvirtual

Reimplemented from Slic3r::GUI::GLGizmoBase.

807{ return _u8L("Embossing actions"); }

References _u8L.

◆ get_count()

int Slic3r::GUI::GLGizmoBase::get_count ( )
inlineinherited
224{ return ++count; }
int count
Definition GLGizmoBase.hpp:294

References count.

◆ get_gizmo_entering_text()

std::string GLGizmoEmboss::get_gizmo_entering_text ( ) const
overrideprotectedvirtual

Reimplemented from Slic3r::GUI::GLGizmoBase.

805{ return _u8L("Enter emboss gizmo"); }

References _u8L.

◆ get_gizmo_leaving_text()

std::string GLGizmoEmboss::get_gizmo_leaving_text ( ) const
overrideprotectedvirtual

Reimplemented from Slic3r::GUI::GLGizmoBase.

806{ return _u8L("Leave emboss gizmo"); }

References _u8L.

◆ get_gizmo_name()

std::string Slic3r::GUI::GLGizmoBase::get_gizmo_name ( )
inlineinherited
225{ return on_get_name(); }
virtual std::string on_get_name() const =0

References on_get_name().

Here is the call graph for this function:

◆ get_hover_id()

int Slic3r::GUI::GLGizmoBase::get_hover_id ( ) const
inlineinherited
206{ return m_hover_id; }
int m_hover_id
Definition GLGizmoBase.hpp:150

References m_hover_id.

Referenced by Slic3r::GUI::GLCanvas3D::_scene_cache_key(), Slic3r::GUI::GLGizmosManager::grabber_contains_mouse(), Slic3r::GUI::GLGizmoBrimEars::on_mouse(), Slic3r::GUI::GLGizmoCut3D::on_mouse(), Slic3r::GUI::GLGizmoMeshBoolean::on_mouse(), and Slic3r::GUI::GLGizmoPainterBase::on_mouse().

Here is the caller graph for this function:

◆ get_icon_filename()

const std::string & Slic3r::GUI::GLGizmoBase::get_icon_filename ( ) const
inlineinherited
180{ return m_icon_filename; }
std::string m_icon_filename
Definition GLGizmoBase.hpp:148

References m_icon_filename.

◆ get_name()

std::string Slic3r::GUI::GLGizmoBase::get_name ( bool include_shortcut = true) const
inherited
545{
546 const std::string name = on_get_name();
547 return include_shortcut && m_shortcut.has_value() ? wxGetApp().shortcuts().with_key(name, *m_shortcut) : name;
548}
std::optional< Shortcut > m_shortcut
Definition GLGizmoBase.hpp:147

References m_shortcut, and on_get_name().

Referenced by Slic3r::GUI::GLGizmoAssembly::on_render_input_window(), Slic3r::GUI::GLGizmoBrimEars::on_render_input_window(), Slic3r::GUI::GLGizmoCut3D::on_render_input_window(), Slic3r::GUI::GLGizmoEmboss::on_render_input_window(), Slic3r::GUI::GLGizmoFdmSupports::on_render_input_window(), Slic3r::GUI::GLGizmoFuzzySkin::on_render_input_window(), Slic3r::GUI::GLGizmoMeasure::on_render_input_window(), Slic3r::GUI::GLGizmoMmuSegmentation::on_render_input_window(), Slic3r::GUI::GLGizmoSeam::on_render_input_window(), Slic3r::GUI::GLGizmoTextureDisplacement::on_render_input_window(), and Slic3r::GUI::GLGizmosManager::update_hover_state().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_requirements()

CommonGizmosDataID Slic3r::GUI::GLGizmoBase::get_requirements ( ) const
inlineinherited
186{ return on_get_requirements(); }
virtual CommonGizmosDataID on_get_requirements() const
Definition GLGizmoBase.hpp:248

References on_get_requirements().

Here is the call graph for this function:

◆ get_sprite_id()

unsigned int Slic3r::GUI::GLGizmoBase::get_sprite_id ( ) const
inlineinherited
204{ return m_sprite_id; }
unsigned int m_sprite_id
Definition GLGizmoBase.hpp:149

References m_sprite_id.

Referenced by Slic3r::GUI::GLGizmosManager::do_render_overlay().

Here is the caller graph for this function:

◆ get_state()

EState Slic3r::GUI::GLGizmoBase::get_state ( ) const
inlineinherited

◆ get_tooltip()

virtual std::string Slic3r::GUI::GLGizmoBase::get_tooltip ( ) const
inlinevirtualinherited

Mouse tooltip text.

Returns
Text to be visible in mouse tooltip

Reimplemented in Slic3r::GUI::GLGizmoCut3D, Slic3r::GUI::GLGizmoMove3D, Slic3r::GUI::GLGizmoRotate3D, Slic3r::GUI::GLGizmoRotate, and Slic3r::GUI::GLGizmoScale3D.

222{ return ""; }

Referenced by Slic3r::GUI::GLGizmosManager::get_tooltip().

Here is the caller graph for this function:

◆ GizmoImguiBegin()

◆ GizmoImguiEnd()

◆ GizmoImguiSetNextWIndowPos() [1/2]

void Slic3r::GUI::GLGizmoBase::GizmoImguiSetNextWIndowPos ( float & x,
float y,
float w,
float h,
int flag,
float pivot_x = 0.0f,
float pivot_y = 0.0f )
protectedinherited
384{
385 if (abs(w) > 0.01f) {
386 if (x + w > m_parent.get_canvas_size().get_width()) {
387 if (w > m_parent.get_canvas_size().get_width()) {
388 x = 0;
389 } else {
390 x = m_parent.get_canvas_size().get_width() - w;
391 }
392 }
393 }
394
395 m_imgui->set_next_window_pos(x, y, flag, pivot_x, pivot_y);
396}

References m_imgui, and m_parent.

◆ GizmoImguiSetNextWIndowPos() [2/2]

void Slic3r::GUI::GLGizmoBase::GizmoImguiSetNextWIndowPos ( float & x,
float y,
int flag,
float pivot_x = 0.0f,
float pivot_y = 0.0f )
protectedinherited

◆ init()

bool Slic3r::GUI::GLGizmoBase::init ( )
inlineinherited
168{ return on_init(); }
virtual bool on_init()=0

References on_init().

Here is the call graph for this function:

◆ init_create()

bool GLGizmoEmboss::init_create ( ModelVolumeType volume_type)
private
563{
564 // check valid volume type
565 if (!check(volume_type)){
566 BOOST_LOG_TRIVIAL(error) << "Can't create embossed volume with this type: " << (int) volume_type;
567 return false;
568 }
569
570 if (!is_activable()) {
571 BOOST_LOG_TRIVIAL(error) << "Can't create text. Gizmo is not activabled.";
572 return false;
573 }
574
575 // Check can't be inside is_activable() cause crash
576 // steps to reproduce: start App -> key 't' -> key 'delete'
577 if (wxGetApp().obj_list()->has_selected_cut_object()) {
578 BOOST_LOG_TRIVIAL(error) << "Can't create text on cut object";
579 return false;
580 }
581
582 m_style_manager.discard_style_changes();
583
584 // set default text, in English when the active font cannot write its translation
585 m_text = _u8L(default_text);
586 if (m_style_manager.is_active_font() && !can_write(m_style_manager, m_text))
588 return true;
589}
bool is_activable() const
Definition GLGizmoBase.hpp:184
bool can_write(StyleManager &style_manager, const std::string &text)
Definition GLGizmoEmboss.cpp:525
const char *const default_text
Definition GLGizmoEmboss.cpp:522
bool check(ModelVolumeType volume_type)
Definition GLGizmoEmboss.cpp:515

References _u8L, Slic3r::GUI::GLGizmoBase::is_activable(), m_style_manager, m_text, and Slic3r::GUI::obj_list().

Referenced by create_volume(), and create_volume().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ init_font_name_texture()

void GLGizmoEmboss::init_font_name_texture ( )
private
1741 {
1742 Timer t("init_font_name_texture");
1743 // check if already exists
1744 GLuint &id = m_face_names->texture_id;
1745 if (id != 0) return;
1746 // create texture for font
1747 GLenum target = GL_TEXTURE_2D;
1748 glsafe(::glGenTextures(1, &id));
1749 glsafe(::glBindTexture(target, id));
1752 const Vec2i32 &size = m_gui_cfg->face_name_size;
1753 GLint w = size.x(), h = m_face_names->count_cached_textures * size.y();
1754 std::vector<unsigned char> data(4*w * h, {0});
1755 const GLenum format = GL_RGBA, type = GL_UNSIGNED_BYTE;
1756 const GLint level = 0, internal_format = GL_RGBA, border = 0;
1757 glsafe(::glTexImage2D(target, level, internal_format, w, h, border, format, type, data.data()));
1758
1759 // bind default texture
1760 GLuint no_texture_id = 0;
1761 glsafe(::glBindTexture(target, no_texture_id));
1762
1763 // clear info about creation of texture - no one is initialized yet
1764 for (FaceName &face : m_face_names->faces) {
1765 face.cancel = nullptr;
1766 face.is_created = nullptr;
1767 }
1768
1769 // Prepare filtration cache
1770 //m_face_names->hide = std::vector<bool>(m_face_names->faces.size(), {false});
1771}
#define GL_TEXTURE_MIN_FILTER
Definition gl.h:1828
#define glTexParameteri
Definition gl.h:4911
int GLint
Definition gl.h:2062
#define glTexImage2D
Definition gl.h:4895
#define GL_NEAREST
Definition gl.h:1200
unsigned int GLenum
Definition gl.h:2054
#define GL_UNSIGNED_BYTE
Definition gl.h:1937
#define glGenTextures
Definition gl.h:3787
#define glBindTexture
Definition gl.h:3299
#define GL_RGBA
Definition gl.h:1493
unsigned int GLuint
Definition gl.h:2063
#define GL_TEXTURE_MAG_FILTER
Definition gl.h:1822
#define GL_TEXTURE_2D
Definition gl.h:1739
Eigen::Matrix< int32_t, 2, 1, Eigen::DontAlign > Vec2i32
Definition Point.hpp:57

References Slic3r::GUI::GLGizmoBase::format(), GL_NEAREST, GL_RGBA, GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_TEXTURE_MIN_FILTER, GL_UNSIGNED_BYTE, glBindTexture, glGenTextures, glsafe, glTexImage2D, glTexParameteri, m_face_names, and m_gui_cfg.

Referenced by draw_font_list().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ init_icons()

void GLGizmoEmboss::init_icons ( )
private
3351{
3352 // icon order has to match the enum IconType
3353 std::vector<std::string> filenames{
3354 "edit_button.svg",
3355 "delete.svg",
3356 "add_copies.svg",
3357 "save.svg",
3358 "undo.svg",
3359 "make_italic.svg",
3360 "make_unitalic.svg",
3361 "make_bold.svg",
3362 "make_unbold.svg",
3363 "search.svg",
3364 "open.svg",
3365 "obj_warning.svg", // ORCA: use obj_warning instead exclamation. exclamation is not compatible with low res
3366 "lock_closed.svg", // lock,
3367 "lock_closed_f.svg",// lock_bold,
3368 "lock_open.svg", // unlock,
3369 "lock_open_f.svg", // unlock_bold,
3370 "align_horizontal_left.svg",
3371 "align_horizontal_center.svg",
3372 "align_horizontal_right.svg",
3373 "align_vertical_top.svg",
3374 "align_vertical_center.svg",
3375 "align_vertical_bottom.svg"
3376 };
3377 assert(filenames.size() == static_cast<size_t>(IconType::_count));
3378 std::string path = resources_dir() + "/images/";
3379 for (std::string &filename : filenames) filename = path + filename;
3380
3381 ImVec2 size(m_gui_cfg->icon_width, m_gui_cfg->icon_width);
3383 m_icons = m_icon_manager.init(filenames, size, type);
3384}
IconManager m_icon_manager
Definition GLGizmoEmboss.hpp:236
@ color_wite_gray
Definition IconManager.hpp:33
@ _count
Definition GLGizmoEmboss.cpp:220

References anonymous_namespace{GLGizmoEmboss.cpp}::_count, Slic3r::GUI::IconManager::color_wite_gray, m_gui_cfg, m_icon_manager, m_icons, and Slic3r::resources_dir().

Referenced by on_render_input_window().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_activable()

bool Slic3r::GUI::GLGizmoBase::is_activable ( ) const
inlineinherited
184{ return on_is_activable(); }
virtual bool on_is_activable() const
Definition GLGizmoBase.hpp:246

References on_is_activable().

Referenced by Slic3r::GUI::GLGizmosManager::activate_gizmo(), Slic3r::GUI::GLGizmosManager::do_render_overlay(), Slic3r::GUI::GLGizmoEmboss::init_create(), and Slic3r::GUI::GLGizmosManager::update_hover_state().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_changed_from_default_style()

bool GLGizmoEmboss::is_changed_from_default_style ( )
private
1388{
1389 int default_index = 0;
1390 const StyleManager::Style& default_style = m_style_manager.get_styles()[default_index];
1391 const StyleManager::Style& current_style = m_style_manager.get_style();
1392
1393 return default_style == current_style;
1394}

References m_style_manager.

Referenced by draw_window().

Here is the caller graph for this function:

◆ is_dragging()

bool Slic3r::GUI::GLGizmoBase::is_dragging ( ) const
inlineinherited
209{ return m_dragging; }

References m_dragging.

Referenced by Slic3r::GUI::GLGizmoCut3D::gizmo_event(), Slic3r::GUI::GLGizmoEmboss::on_mouse_for_translate(), and Slic3r::GUI::GLGizmoSVG::on_mouse_for_translate().

Here is the caller graph for this function:

◆ is_in_editing_mode()

virtual bool Slic3r::GUI::GLGizmoBase::is_in_editing_mode ( ) const
inlinevirtualinherited

Reimplemented in Slic3r::GUI::GLGizmoCut3D.

235{ return false; }

Referenced by Slic3r::GUI::GLGizmosManager::on_key().

Here is the caller graph for this function:

◆ is_selectable()

bool Slic3r::GUI::GLGizmoBase::is_selectable ( ) const
inlineinherited
185{ return on_is_selectable(); }
virtual bool on_is_selectable() const
Definition GLGizmoBase.hpp:247

References on_is_selectable().

Here is the call graph for this function:

◆ is_selection_rectangle_dragging()

virtual bool Slic3r::GUI::GLGizmoBase::is_selection_rectangle_dragging ( ) const
inlinevirtualinherited

Reimplemented in Slic3r::GUI::GLGizmoBrimEars, and Slic3r::GUI::GLGizmoCut3D.

236{ return false; }

◆ load()

void Slic3r::GUI::GLGizmoBase::load ( cereal::BinaryInputArchive & ar)
inlineinherited
170{ m_state = On; on_load(ar); }
virtual void on_load(cereal::BinaryInputArchive &ar)
Definition GLGizmoBase.hpp:241

References m_state, On, and on_load().

Here is the call graph for this function:

◆ load_render_colors()

void Slic3r::GUI::GLGizmoBase::load_render_colors ( )
staticinherited
93{
99}
@ RenderCol_Grabber_Y
Definition GUI_Colors.hpp:27
@ RenderCol_Flatten_Plane
Definition GUI_Colors.hpp:29
@ RenderCol_Grabber_X
Definition GUI_Colors.hpp:26
@ RenderCol_Grabber_Z
Definition GUI_Colors.hpp:28
@ RenderCol_Flatten_Plane_Hover
Definition GUI_Colors.hpp:30
static ColorRGBA FLATTEN_COLOR
Definition GLGizmoBase.hpp:63
static std::array< ColorRGBA, 3 > AXES_COLOR
Definition GLGizmoBase.hpp:60
static ColorRGBA FLATTEN_HOVER_COLOR
Definition GLGizmoBase.hpp:64
static ImVec4 to_ImVec4(const ColorRGB &color)
Definition ImGuiWrapper.cpp:1053
static ImVec4 colors[RenderCol_Count]
Definition GUI_Colors.hpp:40

References AXES_COLOR, Slic3r::RenderColor::colors, FLATTEN_COLOR, FLATTEN_HOVER_COLOR, RenderCol_Flatten_Plane, RenderCol_Flatten_Plane_Hover, RenderCol_Grabber_X, RenderCol_Grabber_Y, RenderCol_Grabber_Z, and Slic3r::GUI::ImGuiWrapper::to_ImVec4().

Referenced by Slic3r::GUI::GLCanvas3D::init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ on_change_color_mode()

virtual void Slic3r::GUI::GLGizmoBase::on_change_color_mode ( bool is_dark)
inlinevirtualinherited
static bool is_dark()
Definition TextureImportDialog.cpp:85
bool m_is_dark_mode
Definition GLGizmoBase.hpp:157

References is_dark(), and m_is_dark_mode.

Here is the call graph for this function:

◆ on_disable_grabber()

void Slic3r::GUI::GLGizmoEmboss::on_disable_grabber ( unsigned int id)
inlineoverrideprotectedvirtual

Reimplemented from Slic3r::GUI::GLGizmoBase.

89{ m_rotate_gizmo.disable_grabber(); }

References m_rotate_gizmo.

◆ on_dragging()

void GLGizmoEmboss::on_dragging ( const UpdateData & data)
overrideprotectedvirtual

Reimplemented from Slic3r::GUI::GLGizmoBase.

1070{ m_rotate_gizmo.dragging(data); }

References m_rotate_gizmo.

◆ on_enable_grabber()

void Slic3r::GUI::GLGizmoEmboss::on_enable_grabber ( unsigned int id)
inlineoverrideprotectedvirtual

Reimplemented from Slic3r::GUI::GLGizmoBase.

88{ m_rotate_gizmo.enable_grabber(); }

References m_rotate_gizmo.

◆ on_get_name()

std::string GLGizmoEmboss::on_get_name ( ) const
overrideprotectedvirtual

Implements Slic3r::GUI::GLGizmoBase.

830{ return _u8L("Emboss"); }

References _u8L.

◆ on_get_requirements()

virtual CommonGizmosDataID Slic3r::GUI::GLGizmoBase::on_get_requirements ( ) const
inlineprotectedvirtualinherited

Reimplemented in Slic3r::GUI::GLGizmoBrimEars, Slic3r::GUI::GLGizmoCut3D, Slic3r::GUI::GLGizmoFlatten, Slic3r::GUI::GLGizmoMeshBoolean, Slic3r::GUI::GLGizmoPainterBase, and Slic3r::GUI::GLGizmoSimplify.

248{ return CommonGizmosDataID(0); }
CommonGizmosDataID
Definition GLGizmosCommon.hpp:72

Referenced by get_requirements().

Here is the caller graph for this function:

◆ on_init()

bool GLGizmoEmboss::on_init ( )
overrideprotectedvirtual

Implements Slic3r::GUI::GLGizmoBase.

810{
811 m_rotate_gizmo.init();
812 ColorRGBA gray_color(.6f, .6f, .6f, .3f);
813 m_rotate_gizmo.set_highlight_color(gray_color);
814
815 // NOTE: It has special handling in GLGizmosManager::handle_shortcut
817
818 m_shortcuts = {
819 {_L("Drag"), _L("Position on surface")}
820 };
821
822 // initialize text styles
823 m_style_manager.init(wxGetApp().app_config);
824
825 // Set rotation gizmo upwardrotate
826 m_rotate_gizmo.set_angle(PI / 2);
827 return true;
828}
static constexpr double PI
Definition libslic3r.h:81
@ GizmoEmboss
Definition Shortcuts.hpp:41

References _L, Slic3r::GUI::GizmoEmboss, m_rotate_gizmo, Slic3r::GUI::GLGizmoBase::m_shortcut, m_shortcuts, m_style_manager, and PI.

◆ on_is_activable()

virtual bool Slic3r::GUI::GLGizmoBase::on_is_activable ( ) const
inlineprotectedvirtualinherited

◆ on_is_selectable()

virtual bool Slic3r::GUI::GLGizmoBase::on_is_selectable ( ) const
inlineprotectedvirtualinherited

Reimplemented in Slic3r::GUI::GLGizmoCut3D, Slic3r::GUI::GLGizmoMmuSegmentation, Slic3r::GUI::GLGizmoPainterBase, Slic3r::GUI::GLGizmoSimplify, and Slic3r::GUI::GLGizmoSVG.

247{ return true; }

Referenced by is_selectable().

Here is the caller graph for this function:

◆ on_load()

virtual void Slic3r::GUI::GLGizmoBase::on_load ( cereal::BinaryInputArchive & ar)
inlineprotectedvirtualinherited

Reimplemented in Slic3r::GUI::GLGizmoBrimEars, Slic3r::GUI::GLGizmoCut3D, Slic3r::GUI::GLGizmoMeshBoolean, and Slic3r::GUI::GLGizmoPainterBase.

241{}

Referenced by load().

Here is the caller graph for this function:

◆ on_mouse()

bool GLGizmoEmboss::on_mouse ( const wxMouseEvent & mouse_event)
overrideprotectedvirtual

Rotate by text on dragging rotate grabers.

Parameters
mouse_eventInformation about mouse
Returns
Propagete normaly return false.

Reimplemented from Slic3r::GUI::GLGizmoBase.

740{
741 // not selected volume
742 if (m_volume == nullptr ||
743 get_model_volume(m_volume_id, m_parent.get_selection().get_model()->objects) == nullptr ||
744 !m_volume->text_configuration.has_value()) return false;
745
746 if (on_mouse_for_rotation(mouse_event)) return true;
747 if (on_mouse_for_translate(mouse_event)) return true;
748 on_mouse_change_selection(mouse_event);
749 return false;
750}
bool on_mouse_for_translate(const wxMouseEvent &mouse_event)
Definition GLGizmoEmboss.cpp:610
ObjectID m_volume_id
Definition GLGizmoEmboss.hpp:206
void on_mouse_change_selection(const wxMouseEvent &mouse_event)
Definition GLGizmoEmboss.cpp:653
bool on_mouse_for_rotation(const wxMouseEvent &mouse_event)
Definition GLGizmoEmboss.cpp:591
static ModelVolume * get_model_volume(const Selection &selection, Model &model)
Definition GLGizmoBrimEars.cpp:66

References Slic3r::GUI::get_model_volume(), Slic3r::GUI::GLGizmoBase::m_parent, m_volume, m_volume_id, on_mouse_change_selection(), on_mouse_for_rotation(), on_mouse_for_translate(), and Slic3r::GUI::wxMouseEvent.

Here is the call graph for this function:

◆ on_mouse_change_selection()

void GLGizmoEmboss::on_mouse_change_selection ( const wxMouseEvent & mouse_event)
private
654{
655 static bool was_dragging = true;
656 // The left up may be the end of a drag that started on the gizmo floating window (e.g. selecting
657 // text in the input field). Such a release is not a click on the scene and must not close the gizmo.
658 // (The flag is only set for left up events, so right up behavior is unchanged.)
659 if ((mouse_event.LeftUp() || mouse_event.RightUp()) && !was_dragging && !m_parent.is_mouse_left_up_ignored()) {
660 // is hovered volume closest hovered?
661 int hovered_idx = m_parent.get_first_hover_volume_idx();
662 if (hovered_idx < 0)
663 // unselect object
664 return close();
665
666 const GLVolumePtrs &gl_volumes = m_parent.get_volumes().volumes;
667 auto hovered_idx_ = static_cast<size_t>(hovered_idx);
668 if (hovered_idx_ >= gl_volumes.size())
669 return close();
670
671 const GLVolume *gl_volume = gl_volumes[hovered_idx_];
672 if (gl_volume == nullptr)
673 return close();
674
675 const ModelVolume *volume = get_model_volume(*gl_volume, m_parent.get_model()->objects);
676 if (volume == nullptr || !volume->text_configuration.has_value())
677 // select volume without text configuration
678 return close();
679
680 // Reselection of text to another text
681 }
682 was_dragging = mouse_event.Dragging();
683
684 // Hook When click on object for reselection must be on event left down not up
685 if (mouse_event.LeftDown()) {
686 // is hovered volume closest hovered?
687 int hovered_idx = m_parent.get_first_hover_volume_idx();
688 if (hovered_idx < 0)
689 // Potentionaly move with camera (drag)
690 return;
691
692 const GLVolumePtrs &gl_volumes = m_parent.get_volumes().volumes;
693 auto hovered_idx_ = static_cast<size_t>(hovered_idx);
694 if (hovered_idx_ >= gl_volumes.size())
695 return;
696 const GLVolume *gl_volume = gl_volumes[hovered_idx_];
697 if (gl_volume == nullptr)
698 return;
699 const ModelVolume *volume = get_model_volume(*gl_volume, m_parent.get_model()->objects);
700 if (volume == nullptr)
701 return;
702
703 if (volume->text_configuration.has_value())
704 return; // Reselection of text to another text
705
706 // select volume without text configuration
707 return close();
708 }
709
710 // Hook When drag with scene by right mouse button
711 // object it is selected after drag scene !!
712 if (mouse_event.RightDown()) {
713 // is hovered volume closest hovered?
714 int hovered_idx = m_parent.get_first_hover_volume_idx();
715 if (hovered_idx < 0)
716 // Potentionaly move with camera (drag)
717 return;
718
719 const GLVolumePtrs &gl_volumes = m_parent.get_volumes().volumes;
720 auto hovered_idx_ = static_cast<size_t>(hovered_idx);
721 if (hovered_idx_ >= gl_volumes.size())
722 return;
723 const GLVolume *gl_volume = gl_volumes[hovered_idx_];
724 if (gl_volume == nullptr)
725 return;
726 const ModelVolume *volume = get_model_volume(*gl_volume, m_parent.get_model()->objects);
727 if (volume == nullptr)
728 return;
729
730 // is actual selected?
731 if (m_volume->id() == volume->id())
732 return;
733
734 // select volume without text configuration
735 return close();
736 }
737}
ObjectID id() const
Definition ObjectID.hpp:69
std::vector< GLVolume * > GLVolumePtrs
Definition 3DScene.hpp:412

References close(), Slic3r::GUI::get_model_volume(), Slic3r::ObjectBase::id(), Slic3r::GUI::GLGizmoBase::m_parent, m_volume, Slic3r::ModelVolume::text_configuration, and Slic3r::GUI::wxMouseEvent.

Referenced by on_mouse().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ on_mouse_for_rotation()

bool GLGizmoEmboss::on_mouse_for_rotation ( const wxMouseEvent & mouse_event)
private
592{
593 if (mouse_event.Moving()) return false;
594
595 bool used = use_grabbers(mouse_event);
596 if (!m_dragging) return used;
597
598 if (mouse_event.Dragging()) {
599 // check that style is activ
600 assert(m_style_manager.is_active_font());
601 if (!m_style_manager.is_active_font())
602 return used;
603
604 std::optional<float> &angle_opt = m_style_manager.get_style().angle;
605 dragging_rotate_gizmo(m_rotate_gizmo.get_angle(), angle_opt, m_rotate_start_angle, m_parent.get_selection());
606 }
607 return used;
608}
bool use_grabbers(const wxMouseEvent &mouse_event)
function which Set up m_dragging and call functions on_start_dragging / on_dragging / on_stop_draggin...
Definition GLGizmoBase.cpp:444
std::optional< float > m_rotate_start_angle
Definition GLGizmoEmboss.hpp:221
void dragging_rotate_gizmo(double gizmo_angle, std::optional< float > &current_angle, std::optional< float > &start_angle, Selection &selection)
On dragging rotate gizmo func Transform GLVolume from selection.
Definition SurfaceDrag.cpp:457

References Slic3r::GUI::dragging_rotate_gizmo(), Slic3r::GUI::GLGizmoBase::m_dragging, Slic3r::GUI::GLGizmoBase::m_parent, m_rotate_gizmo, m_rotate_start_angle, m_style_manager, Slic3r::GUI::GLGizmoBase::use_grabbers(), and Slic3r::GUI::wxMouseEvent.

Referenced by on_mouse().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ on_mouse_for_translate()

bool GLGizmoEmboss::on_mouse_for_translate ( const wxMouseEvent & mouse_event)
private
611{
612 // exist selected volume?
613 if (m_volume == nullptr)
614 return false;
615
616 const Camera &camera = wxGetApp().plater()->get_camera();
617 bool was_dragging = m_surface_drag.has_value();
618 bool res = on_mouse_surface_drag(mouse_event, camera, m_surface_drag, m_parent, m_raycast_manager, UP_LIMIT);
619 bool is_dragging = m_surface_drag.has_value();
620
621 // End with surface dragging?
622 if (was_dragging && !is_dragging)
624
625 // Start with dragging
626 else if (!was_dragging && is_dragging) {
627 // Cancel job to prevent interuption of dragging (duplicit result)
628 if (m_job_cancel != nullptr)
629 m_job_cancel->store(true);
630 }
631
632 // during drag
633 else if (was_dragging && is_dragging) {
634 // update scale of selected volume --> should be approx the same
636
637 // Recalculate angle for GUI
638 if (!m_keep_up) {
639 const Selection &selection = m_parent.get_selection();
640 const GLVolume *gl_volume = get_selected_gl_volume(selection);
641 assert(gl_volume != nullptr);
642 assert(m_style_manager.is_active_font());
643 if (gl_volume == nullptr || !m_style_manager.is_active_font())
644 return res;
645 m_style_manager.get_style().angle = calc_angle(selection);
646 }
647
649 }
650 return res;
651}
bool is_dragging() const
Definition GLGizmoBase.hpp:209
void volume_transformation_changed()
Definition GLGizmoEmboss.cpp:763
std::optional< SurfaceDrag > m_surface_drag
Definition GLGizmoEmboss.hpp:224
void volume_transformation_changing()
Definition GLGizmoEmboss.cpp:752
void calculate_scale()
Definition GLGizmoEmboss.cpp:1411
bool on_mouse_surface_drag(const wxMouseEvent &mouse_event, const Camera &camera, std::optional< SurfaceDrag > &surface_drag, GLCanvas3D &canvas, RaycastManager &raycast_manager, const std::optional< double > &up_limit)
Mouse event handler, when move(drag&drop) volume over model surface NOTE: Dragged volume has to be se...
Definition SurfaceDrag.cpp:100

References Slic3r::GUI::calc_angle(), calculate_scale(), Slic3r::GUI::get_selected_gl_volume(), Slic3r::GUI::GLGizmoBase::is_dragging(), m_job_cancel, m_keep_up, Slic3r::GUI::GLGizmoBase::m_parent, m_raycast_manager, m_style_manager, m_surface_drag, m_volume, Slic3r::GUI::on_mouse_surface_drag(), Slic3r::GUI::UP_LIMIT, volume_transformation_changed(), volume_transformation_changing(), and Slic3r::GUI::wxMouseEvent.

Referenced by on_mouse().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ on_register_raycasters_for_picking()

void GLGizmoEmboss::on_register_raycasters_for_picking ( )
overrideprotectedvirtual

Reimplemented from Slic3r::GUI::GLGizmoBase.

867 {
868 m_rotate_gizmo.register_raycasters_for_picking();
869}

References m_rotate_gizmo.

◆ on_render()

void GLGizmoEmboss::on_render ( )
overrideprotectedvirtual

Implements Slic3r::GUI::GLGizmoBase.

832 {
833 // no volume selected
834 const Selection &selection = m_parent.get_selection();
835 if (m_volume == nullptr ||
836 get_model_volume(m_volume_id, selection.get_model()->objects) == nullptr)
837 return;
838 if (selection.is_empty()) return;
839
840 // prevent get local coordinate system on multi volumes
841 if (!selection.is_single_volume_or_modifier() &&
842 !selection.is_single_volume_instance()) return;
843
844 const GLVolume *gl_volume_ptr = m_parent.get_selection().get_first_volume();
845 if (gl_volume_ptr == nullptr) return;
846
847 if (m_text_lines.is_init()) {
848 const Transform3d& tr = gl_volume_ptr->world_matrix();
849 const auto &fix = m_volume->emboss_shape->fix_3mf_tr;
850 if (fix.has_value())
851 m_text_lines.render(tr * fix->inverse());
852 else
853 m_text_lines.render(tr);
854 }
855
856 bool is_surface_dragging = m_surface_drag.has_value();
857 bool is_parent_dragging = m_parent.is_mouse_dragging();
858 // Do NOT render rotation grabbers when dragging object
859 bool is_rotate_by_grabbers = m_dragging;
860 if (is_rotate_by_grabbers ||
861 (!is_surface_dragging && !is_parent_dragging)) {
863 m_rotate_gizmo.render();
864 }
865}
Transform3d world_matrix() const
Definition 3DScene.cpp:447
bool is_single_volume_instance() const
Definition Selection.hpp:292
Model * get_model() const
Definition Selection.hpp:219
bool is_empty() const
Definition Selection.hpp:272
bool is_single_volume_or_modifier() const
Definition Selection.hpp:291
ModelObjectPtrs objects
Definition Model.hpp:1702
#define GL_DEPTH_BUFFER_BIT
Definition gl.h:558
#define glClear
Definition gl.h:3357

References Slic3r::GUI::Selection::get_model(), Slic3r::GUI::get_model_volume(), GL_DEPTH_BUFFER_BIT, glClear, glsafe, Slic3r::GUI::Selection::is_empty(), Slic3r::GUI::Selection::is_single_volume_instance(), Slic3r::GUI::Selection::is_single_volume_or_modifier(), Slic3r::GUI::GLGizmoBase::m_dragging, Slic3r::GUI::GLGizmoBase::m_parent, m_rotate_gizmo, m_surface_drag, m_text_lines, m_volume, m_volume_id, Slic3r::Model::objects, and Slic3r::GLVolume::world_matrix().

Here is the call graph for this function:

◆ on_render_input_window()

void GLGizmoEmboss::on_render_input_window ( float x,
float y,
float bottom_limit )
overrideprotectedvirtual

Reimplemented from Slic3r::GUI::GLGizmoBase.

930{
931 assert(m_volume != nullptr);
932 // Do not render window for not selected text volume
933 if (m_volume == nullptr ||
934 get_model_volume(m_volume_id, m_parent.get_selection().get_model()->objects) == nullptr ||
935 !m_volume->text_configuration.has_value()) {
936 // This closing could lead to bad behavior of undo/redo stack when unselection create snapshot before close
937 close();
938 return;
939 }
940
941 // Not known situation when could happend this is only for sure
942 if (!m_is_unknown_font && !m_style_manager.is_active_font())
943 create_notification_not_valid_font(_u8L("No active font in style. Select correct one."));
944 else if (!m_is_unknown_font && !m_style_manager.get_wx_font().IsOk())
945 create_notification_not_valid_font(_u8L("WxFont is not loaded properly."));
946
947 double screen_scale = wxDisplay(wxGetApp().plater()).GetScaleFactor();
948
949 // Orca
951 ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(4.0, 5.0) * screen_scale);
952 ImGui::PushStyleVar(ImGuiStyleVar_ScrollbarSize, 4.0f * screen_scale);
953
954 // Configuration creation
955 if (m_gui_cfg == nullptr || // Exist configuration - first run
956 m_gui_cfg->screen_scale != screen_scale ||// change of DPI
957 m_gui_cfg->dark_mode != m_is_dark_mode // change of dark mode
958 ) {
959 // Create cache for gui offsets
960 ::GuiCfg cfg = create_gui_configuration();
961 cfg.screen_scale = screen_scale;
962 cfg.dark_mode = m_is_dark_mode;
963
964 GuiCfg gui_cfg{std::move(cfg)};
965 m_gui_cfg = std::make_unique<const GuiCfg>(std::move(gui_cfg));
966
967 // change resolution regenerate icons
968 init_icons();
969 m_style_manager.clear_imgui_font();
970 }
971
972 // Draw origin position of text during dragging
973 if (m_surface_drag.has_value()) {
974 ImVec2 mouse_pos = ImGui::GetMousePos();
975 ImVec2 center(
976 mouse_pos.x + m_surface_drag->mouse_offset.x(),
977 mouse_pos.y + m_surface_drag->mouse_offset.y());
978 ImU32 color = ImGui::GetColorU32(
979 m_surface_drag->exist_hit ?
980 ImVec4(1.f, 1.f, 1.f, .75f) : // transparent white
981 ImVec4(1.f, .3f, .3f, .75f)
982 ); // Warning color
983 const float radius = 16.f;
985 }
986
987#ifdef SHOW_FINE_POSITION
988 draw_fine_position(m_parent.get_selection(), m_parent.get_canvas_size(), min_window_size);
989#endif // SHOW_FINE_POSITION
990#ifdef DRAW_PLACE_TO_ADD_TEXT
991 draw_place_to_add_text();
992#endif // DRAW_PLACE_TO_ADD_TEXT
993#ifdef SHOW_OFFSET_DURING_DRAGGING
994 draw_mouse_offset(m_dragging_mouse_offset);
995#endif // SHOW_OFFSET_DURING_DRAGGING
996
997 static float last_y = 0.0f;
998 static float last_h = 0.0f;
999
1000 // adjust window position to avoid overlap the view toolbar
1001 const float win_h = ImGui::GetWindowHeight();
1002 y = std::min(y, bottom_limit - win_h);
1003 GizmoImguiSetNextWIndowPos(x, y, ImGuiCond_Always, 0.0f, 0.0f);
1004 if (last_h != win_h || last_y != y) {
1005 // ask canvas for another frame to render the window in the correct position
1006 m_imgui->set_requires_extra_frame();
1007 if (last_h != win_h)
1008 last_h = win_h;
1009 if (last_y != y)
1010 last_y = y;
1011 }
1012
1013 GizmoImguiBegin(get_name(), ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoTitleBar);
1014
1015 draw_window(x, y);
1016
1017 GizmoImguiEnd();
1018
1019 // Orca
1020 ImGui::PopStyleVar(2);
1022}
std::string get_name(bool include_shortcut=true) const
Definition GLGizmoBase.cpp:544
void GizmoImguiEnd()
Definition GLGizmoBase.cpp:372
bool GizmoImguiBegin(const std::string &name, int flags)
Definition GLGizmoBase.cpp:367
void init_icons()
Definition GLGizmoEmboss.cpp:3350
void draw_window(float x, float y)
Definition GLGizmoEmboss.cpp:1490
static void push_toolbar_style(const float scale)
Definition ImGuiWrapper.cpp:2705
static void pop_toolbar_style()
Definition ImGuiWrapper.cpp:2757
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)
Draw symbol of cross hair.
Definition ImGuiWrapper.cpp:2587
void center(ExPolygonsWithIds &e)
Definition Emboss.cpp:1382
GuiCfg create_gui_configuration()
Definition GLGizmoEmboss.cpp:3798
Definition GLGizmoEmboss.cpp:355

References _u8L, Slic3r::center(), close(), create_notification_not_valid_font(), Slic3r::GUI::ImGuiWrapper::draw_cross_hair(), draw_window(), Slic3r::GUI::get_model_volume(), Slic3r::GUI::GLGizmoBase::get_name(), Slic3r::GUI::GLGizmoBase::GizmoImguiBegin(), Slic3r::GUI::GLGizmoBase::GizmoImguiEnd(), Slic3r::GUI::GLGizmoBase::GizmoImguiSetNextWIndowPos(), init_icons(), m_gui_cfg, Slic3r::GUI::GLGizmoBase::m_imgui, Slic3r::GUI::GLGizmoBase::m_is_dark_mode, m_is_unknown_font, Slic3r::GUI::GLGizmoBase::m_parent, m_style_manager, m_surface_drag, m_volume, m_volume_id, Slic3r::GUI::plater(), Slic3r::GUI::ImGuiWrapper::pop_toolbar_style(), and Slic3r::GUI::ImGuiWrapper::push_toolbar_style().

Here is the call graph for this function:

◆ on_save()

virtual void Slic3r::GUI::GLGizmoBase::on_save ( cereal::BinaryOutputArchive & ar) const
inlineprotectedvirtualinherited

Reimplemented in Slic3r::GUI::GLGizmoBrimEars, Slic3r::GUI::GLGizmoCut3D, Slic3r::GUI::GLGizmoMeshBoolean, and Slic3r::GUI::GLGizmoPainterBase.

242{}

Referenced by save().

Here is the caller graph for this function:

◆ on_set_hover_id()

void Slic3r::GUI::GLGizmoEmboss::on_set_hover_id ( )
inlineoverrideprotectedvirtual

◆ on_set_state()

void GLGizmoEmboss::on_set_state ( )
overrideprotectedvirtual

Reimplemented from Slic3r::GUI::GLGizmoBase.

1025{
1026 // enable / disable bed from picking
1027 // Rotation gizmo must work through bed
1028 m_parent.set_raycaster_gizmos_on_top(m_state == GLGizmoBase::On);
1029
1030 m_rotate_gizmo.set_state(m_state);
1031
1032 // Closing gizmo. e.g. selecting another one
1033 if (m_state == GLGizmoBase::Off) {
1034 // refuse outgoing during text preview
1035 reset_volume();
1036 // Store order and last activ index into app.ini
1037 // TODO: what to do when can't store into file?
1038 m_style_manager.store_styles_to_app_config(false);
1040 } else if (m_state == GLGizmoBase::On) {
1041 // to reload fonts from system, when install new one
1042 wxFontEnumerator::InvalidateCache();
1043
1044 // Immediately after set state On is called function data_changed(),
1045 // where one could distiguish undo/redo serialization from opening by letter 'T'
1046 // set_volume_by_selection();
1047 }
1048}
void reset_volume()
Definition GLGizmoEmboss.cpp:1346

References Slic3r::GUI::GLGizmoBase::m_parent, m_rotate_gizmo, Slic3r::GUI::GLGizmoBase::m_state, m_style_manager, Slic3r::GUI::GLGizmoBase::Off, Slic3r::GUI::GLGizmoBase::On, remove_notification_not_valid_font(), and reset_volume().

Here is the call graph for this function:

◆ on_shortcut_key()

void GLGizmoEmboss::on_shortcut_key ( )

Handle pressing of shortcut.

394 {
396 if (m_volume == nullptr) {
397 // No volume to select from selection so create volume.
398 // NOTE: After finish job for creation emboss Text volume,
399 // GLGizmoEmboss will be opened
401 }
402 else {
403 // shortcut is pressed when text is selected soo start edit it.
404 auto& mng = m_parent.get_gizmos_manager();
405 if (mng.get_current_type() != GLGizmosManager::Emboss)
406 mng.open_gizmo(GLGizmosManager::Emboss);
407 }
408}
bool create_volume(ModelVolumeType volume_type, const Vec2d &mouse_pos)
Create new embossed text volume by type on position of mouse.
Definition GLGizmoEmboss.cpp:370

References create_volume(), Slic3r::GUI::GLGizmosManager::Emboss, Slic3r::GUI::GLGizmoBase::m_parent, m_volume, Slic3r::MODEL_PART, and set_volume_by_selection().

Here is the call graph for this function:

◆ on_start_dragging()

void GLGizmoEmboss::on_start_dragging ( )
overrideprotectedvirtual

Reimplemented from Slic3r::GUI::GLGizmoBase.

1056{ m_rotate_gizmo.start_dragging(); }

References m_rotate_gizmo.

◆ on_stop_dragging()

void GLGizmoEmboss::on_stop_dragging ( )
overrideprotectedvirtual

Reimplemented from Slic3r::GUI::GLGizmoBase.

1058{
1059 m_rotate_gizmo.stop_dragging();
1060
1061 // This is fast fix for second try to rotate
1062 // When fixing, move grabber above text (not on side)
1063 m_rotate_gizmo.set_angle(PI/2);
1064
1065 // apply rotation
1066 m_parent.do_rotate(rotation_snapshot_name);
1067 m_rotate_start_angle.reset();
1069}

References Slic3r::GUI::GLGizmoBase::m_parent, m_rotate_gizmo, m_rotate_start_angle, PI, and volume_transformation_changed().

Here is the call graph for this function:

◆ on_unregister_raycasters_for_picking()

void GLGizmoEmboss::on_unregister_raycasters_for_picking ( )
overrideprotectedvirtual

Reimplemented from Slic3r::GUI::GLGizmoBase.

870 {
871 m_rotate_gizmo.unregister_raycasters_for_picking();
872}

References m_rotate_gizmo.

◆ pop_button_style()

void GLGizmoEmboss::pop_button_style ( )
protected
1823{
1824 ImGui::PopStyleColor(4);
1825}

◆ process()

bool GLGizmoEmboss::process ( bool make_snapshot = true)
private
1441{
1442 // no volume is selected -> selection from right panel
1443 assert(m_volume != nullptr);
1444 if (m_volume == nullptr) return false;
1445
1446 // without text there is nothing to emboss
1447 if (is_text_empty(m_text)) return false;
1448
1449 // exist loaded font file?
1450 if (!m_style_manager.is_active_font()) return false;
1451
1452 const Selection& selection = m_parent.get_selection();
1454 DataUpdate data{std::move(base), m_volume->id(), make_snapshot};
1455
1456 // check valid count of text lines
1457 assert(data.base->text_lines.empty() || data.base->text_lines.size() == get_count_lines(m_text));
1458
1459 if (!start_update_volume(std::move(data), *m_volume, selection, m_raycast_manager))
1460 return false;
1461
1462 // notification is removed befor object is changed by job
1464 return true;
1465}
Slic3r::Emboss::TextLines text_lines
Definition EmbossJob.hpp:71
bool start_update_volume(DataUpdate &&data, const ModelVolume &volume, const Selection &selection, RaycastManager &raycaster)
Start job for update embossed volume.
Definition EmbossJob.cpp:671
DataBasePtr base
Definition EmbossJob.hpp:113

References Slic3r::GUI::Emboss::DataUpdate::base, Slic3r::Emboss::get_count_lines(), m_job_cancel, Slic3r::GUI::GLGizmoBase::m_parent, m_raycast_manager, m_style_manager, m_text, m_text_lines, m_volume, remove_notification_not_valid_font(), Slic3r::GUI::Emboss::start_update_volume(), and Slic3r::GUI::Emboss::DataBase::text_lines.

Referenced by do_mirror(), draw_advanced(), draw_delete_style_button(), draw_depth(), draw_font_list(), draw_font_list_line(), draw_height(), draw_model_type(), draw_style_list(), draw_text_input(), draw_window(), reset_to_default_style(), select_facename(), and volume_transformation_changed().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ push_button_style()

void GLGizmoEmboss::push_button_style ( bool pressed)
protected
1790{
1791 if (m_is_dark_mode) {
1792 if (pressed) {
1793 ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(43 / 255.f, 64 / 255.f, 54 / 255.f, 1.f));
1794 ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(43 / 255.f, 64 / 255.f, 54 / 255.f, 1.f));
1795 ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(43 / 255.f, 64 / 255.f, 54 / 255.f, 1.f));
1796 ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.f, 174 / 255.f, 66 / 255.f, 1.f));
1797 }
1798 else {
1799 ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(45.f / 255.f, 45.f / 255.f, 49.f / 255.f, 1.f));
1800 ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(84 / 255.f, 84 / 255.f, 90 / 255.f, 1.f));
1801 ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(84 / 255.f, 84 / 255.f, 90 / 255.f, 1.f));
1802 ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(45.f / 255.f, 45.f / 255.f, 49.f / 255.f, 1.f));
1803 }
1804 }
1805 else {
1806 if (pressed) {
1807 ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(219 / 255.f, 253 / 255.f, 231 / 255.f, 1.f));
1808 ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(219 / 255.f, 253 / 255.f, 231 / 255.f, 1.f));
1809 ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(219 / 255.f, 253 / 255.f, 231 / 255.f, 1.f));
1810 ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.f, 174 / 255.f, 66 / 255.f, 1.f));
1811 }
1812 else {
1813 ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(1.f, 1.f, 1.f, 1.f));
1814 ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(238 / 255.f, 238 / 255.f, 238 / 255.f, 1.f));
1815 ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(238 / 255.f, 238 / 255.f, 238 / 255.f, 1.f));
1816 ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(1.f, 1.f, 1.f, 1.f));
1817 }
1818
1819 }
1820}

References Slic3r::GUI::GLGizmoBase::m_is_dark_mode.

◆ re_emboss()

bool GLGizmoEmboss::re_emboss ( const ModelVolume & text,
std::shared_ptr< std::atomic< bool > > job_cancel = nullptr )
static

Call on change inside of object conatining projected volume.

Parameters
job_cancelWay to stop re_emboss job
Returns
True on success otherwise False
411{
412 assert(text_volume.text_configuration.has_value());
413 assert(text_volume.emboss_shape.has_value());
414 if (!text_volume.text_configuration.has_value() ||
415 !text_volume.emboss_shape.has_value())
416 return false; // not valid text volume to re emboss
417 const TextConfiguration &tc = *text_volume.text_configuration;
418 const EmbossShape &es = *text_volume.emboss_shape;
419 const ImWchar* ranges = ImGui::GetIO().Fonts->GetGlyphRangesDefault();
420
421 StyleManager style_manager(ranges, create_default_styles);
422 StyleManager::Style style{tc.style, es.projection};
423 if (!style_manager.load_style(style))
424 return false; // can't load font
425
426 TextLinesModel text_lines;
427 const Selection &selection = wxGetApp().plater()->canvas3D()->get_selection();
428 DataBasePtr base = create_emboss_data_base(tc.text, style_manager, text_lines, selection, text_volume.type(), job_cancel);
429 DataUpdate data{std::move(base), text_volume.id(), false};
430
431 RaycastManager raycast_manager; // Nothing is cached now, so It need to create raycasters
432 return start_update_volume(std::move(data), text_volume, selection, raycast_manager);
433}
EmbossProjection projection
Definition EmbossShape.hpp:80
std::string text
Definition TextConfiguration.hpp:181

References create_default_styles(), Slic3r::ModelVolume::emboss_shape, Slic3r::ObjectBase::id(), Slic3r::GUI::Emboss::StyleManager::load_style(), Slic3r::EmbossShape::projection, Slic3r::GUI::Emboss::start_update_volume(), Slic3r::TextConfiguration::style, style, Slic3r::TextConfiguration::text, Slic3r::ModelVolume::text_configuration, and Slic3r::ModelVolume::type().

Here is the call graph for this function:

◆ register_grabbers_for_picking()

void Slic3r::GUI::GLGizmoBase::register_grabbers_for_picking ( )
protectedinherited
399{
400 for (size_t i = 0; i < m_grabbers.size(); ++i) {
401 m_grabbers[i].register_raycasters_for_picking((m_group_id >= 0) ? m_group_id : i);
402 }
403}
int m_group_id
Definition GLGizmoBase.hpp:145

References m_grabbers, and m_group_id.

Referenced by register_raycasters_for_picking().

Here is the caller graph for this function:

◆ register_raycasters_for_picking()

void Slic3r::GUI::GLGizmoBase::register_raycasters_for_picking ( )
inlineinherited
void register_grabbers_for_picking()
Definition GLGizmoBase.cpp:398
virtual void on_register_raycasters_for_picking()
Definition GLGizmoBase.hpp:267

References on_register_raycasters_for_picking(), and register_grabbers_for_picking().

Referenced by Slic3r::GUI::GLGizmosManager::activate_gizmo(), and Slic3r::GUI::GLCanvas3D::reload_scene().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reinit_text_lines()

void GLGizmoEmboss::reinit_text_lines ( unsigned count_lines = 0)
private
1229 {
1230 init_text_lines(m_text_lines, m_parent.get_selection(), m_style_manager, count_lines);
1231}
void init_text_lines(TextLinesModel &text_lines, const Selection &selection, StyleManager &style_manager, unsigned count_lines=0)
Definition GLGizmoEmboss.cpp:1187

References Slic3r::GUI::GLGizmoBase::m_parent, m_style_manager, and m_text_lines.

Referenced by draw_advanced(), draw_font_list_line(), draw_text_input(), set_height(), and set_volume_by_selection().

Here is the caller graph for this function:

◆ remove_notification_not_valid_font()

void GLGizmoEmboss::remove_notification_not_valid_font ( )
private
3342{
3343 if (!m_is_unknown_font) return;
3344 m_is_unknown_font = false;
3346 auto notification_manager = wxGetApp().plater()->get_notification_manager();
3347 notification_manager->close_notification_of_type(type);
3348}

References m_is_unknown_font, and Slic3r::GUI::UnknownFont.

Referenced by create_notification_not_valid_font(), on_set_state(), process(), reset_volume(), and set_volume_by_selection().

Here is the caller graph for this function:

◆ render()

void Slic3r::GUI::GLGizmoBase::render ( )
inlineinherited
214{ on_render(); }
virtual void on_render()=0

References on_render().

Here is the call graph for this function:

◆ render_combo()

bool Slic3r::GUI::GLGizmoBase::render_combo ( const std::string & label,
const std::vector< std::string > & lines,
int & selection_idx,
float label_width,
float item_width )
protectedinherited
227{
229 ImGui::AlignTextToFramePadding();
230 m_imgui->text(label);
231 ImGui::SameLine(label_width);
232 ImGui::PushItemWidth(item_width);
233
234 size_t selection_out = selection_idx;
235
236 const char *selected_str = (selection_idx >= 0 && selection_idx < int(lines.size())) ? lines[selection_idx].c_str() : "";
237 if (ImGui::BBLBeginCombo(("##" + label).c_str(), selected_str, 0)) {
238 for (size_t line_idx = 0; line_idx < lines.size(); ++line_idx) {
239 ImGui::PushID(int(line_idx));
240 if (ImGui::Selectable("", line_idx == selection_idx)) selection_out = line_idx;
241
242 ImGui::SameLine();
243 ImGui::Text("%s", lines[line_idx].c_str());
244 ImGui::PopID();
245 }
246
247 ImGui::EndCombo();
248 }
249
250 bool is_changed = selection_idx != selection_out;
251 selection_idx = selection_out;
252
253 //if (is_changed) update_connector_shape();
255
256 return is_changed;
257}

References m_imgui, m_parent, Slic3r::GUI::ImGuiWrapper::pop_combo_style(), and Slic3r::GUI::ImGuiWrapper::push_combo_style().

Referenced by Slic3r::GUI::GLGizmoAssembly::render_assembly_mode_combo(), and Slic3r::GUI::GLGizmoCut3D::render_connectors_input_window().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ render_cross_mark()

void Slic3r::GUI::GLGizmoBase::render_cross_mark ( const Vec3f & target,
bool is_single = false )
protectedinherited
260{
261 const float half_length = 4.0f;
262
263 // ORCA: OpenGL Core Profile
264#if !SLIC3R_OPENGL_ES
265 if (!OpenGLManager::get_gl_info().is_core_profile())
266 glsafe(::glLineWidth(2.0f));
267#endif // !SLIC3R_OPENGL_ES
268
269 auto render_line = [](const Vec3f& p1, const Vec3f& p2, const ColorRGBA& color) {
270 GLModel::Geometry init_data;
272 init_data.color = color;
273 init_data.reserve_vertices(2);
274 init_data.reserve_indices(2);
275
276 // vertices
277 init_data.add_vertex(p1);
278 init_data.add_vertex(p2);
279
280 // indices
281 init_data.add_line(0, 1);
282
283 GLModel model;
284 model.init_from(std::move(init_data));
285 model.render();
286 };
287
288 // draw line for x axis
289 if (!is_single) {
290 render_line(
291 {target(0) - half_length, target(1), target(2)},
292 {target(0) + half_length, target(1), target(2)},
293 ColorRGBA::X()); // ORCA match axis colors
294 }
295 else {
296 render_line(
297 {target(0), target(1), target(2)},
298 {target(0) + half_length, target(1), target(2)},
299 ColorRGBA::X()); // ORCA match axis colors
300 }
301 // draw line for y axis
302 if (!is_single) {
303 render_line(
304 {target(0), target(1) - half_length, target(2)},
305 {target(0), target(1) + half_length, target(2)},
306 ColorRGBA::Y()); // ORCA match axis colors
307 } else {
308 render_line(
309 {target(0), target(1), target(2)},
310 {target(0), target(1) + half_length, target(2)},
311 ColorRGBA::Y()); // ORCA match axis colors
312 }
313 // draw line for z axis
314 if (!is_single) {
315 render_line(
316 {target(0), target(1), target(2) - half_length},
317 {target(0), target(1), target(2) + half_length},
318 ColorRGBA::Z()); // ORCA match axis colors
319 } else {
320 render_line(
321 {target(0), target(1), target(2)},
322 {target(0), target(1), target(2) + half_length},
323 ColorRGBA::Z()); // ORCA match axis colors
324 }
325}
static const ColorRGBA Y()
Definition Color.hpp:146
static const ColorRGBA X()
Definition Color.hpp:145
static const ColorRGBA Z()
Definition Color.hpp:147
static const GLInfo & get_gl_info()
Definition OpenGLManager.hpp:106
#define glLineWidth
Definition gl.h:4215
Eigen::Matrix< float, 3, 1, Eigen::DontAlign > Vec3f
Definition Point.hpp:65

References Slic3r::GUI::GLModel::Geometry::add_line(), Slic3r::GUI::GLModel::Geometry::add_vertex(), Slic3r::GUI::GLModel::Geometry::color, Slic3r::GUI::GLModel::Geometry::format, Slic3r::GUI::OpenGLManager::get_gl_info(), glLineWidth, glsafe, Slic3r::GUI::GLModel::init_from(), Slic3r::GUI::GLModel::Geometry::Lines, Slic3r::GUI::GLModel::Geometry::P3, Slic3r::GUI::GLModel::render(), Slic3r::GUI::GLModel::Geometry::reserve_indices(), Slic3r::GUI::GLModel::Geometry::reserve_vertices(), Slic3r::ColorRGBA::X(), Slic3r::ColorRGBA::Y(), and Slic3r::ColorRGBA::Z().

Referenced by Slic3r::GUI::GLGizmoMove3D::on_render().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ render_follows_cursor()

virtual bool Slic3r::GUI::GLGizmoBase::render_follows_cursor ( ) const
inlinevirtualinherited

Reimplemented in Slic3r::GUI::GLGizmoBrimEars, Slic3r::GUI::GLGizmoMeasure, and Slic3r::GUI::GLGizmoPainterBase.

189{ return false; }

Referenced by Slic3r::GUI::GLCanvas3D::_is_scene_cacheable().

Here is the caller graph for this function:

◆ render_grabbers() [1/3]

void Slic3r::GUI::GLGizmoBase::render_grabbers ( const BoundingBoxf3 & box) const
protectedinherited
413{
414#if ENABLE_FIXED_GRABBER
416#else
417 render_grabbers((float)((box.size().x() + box.size().y() + box.size().z()) / 3.0));
418#endif
419}
void render_grabbers(const BoundingBoxf3 &box) const
Definition GLGizmoBase.cpp:412
static const float FixedGrabberSize
Definition GLGizmoBase.hpp:90

References Slic3r::GUI::GLGizmoBase::Grabber::FixedGrabberSize, render_grabbers(), and Slic3r::BoundingBox3Base< PointType >::size().

Referenced by Slic3r::GUI::GLGizmoMove3D::on_render(), Slic3r::GUI::GLGizmoScale3D::on_render(), Slic3r::GUI::GLGizmoRotate::render_grabber(), render_grabbers(), and render_grabbers().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ render_grabbers() [2/3]

void Slic3r::GUI::GLGizmoBase::render_grabbers ( float size) const
protectedinherited
422{
423 render_grabbers(0, m_grabbers.size() - 1, size, false);
424}

References m_grabbers, and render_grabbers().

Here is the call graph for this function:

◆ render_grabbers() [3/3]

void Slic3r::GUI::GLGizmoBase::render_grabbers ( size_t first,
size_t last,
float size,
bool force_hover ) const
protectedinherited
427{
428 GLShaderProgram* shader = wxGetApp().get_shader("gouraud_light");
429 if (shader == nullptr)
430 return;
431 shader->start_using();
432 shader->set_uniform("emission_factor", 0.1f);
434 for (size_t i = first; i <= last; ++i) {
435 if (m_grabbers[i].enabled)
436 m_grabbers[i].render(force_hover ? true : m_hover_id == (int)i, size);
437 }
439 shader->stop_using();
440}
#define glEnable
Definition gl.h:3667
#define GL_CULL_FACE
Definition gl.h:500
#define glDisable
Definition gl.h:3607

References GL_CULL_FACE, glDisable, glEnable, glsafe, m_grabbers, m_hover_id, Slic3r::GLShaderProgram::set_uniform(), Slic3r::GLShaderProgram::start_using(), and Slic3r::GLShaderProgram::stop_using().

Here is the call graph for this function:

◆ render_input_window()

void Slic3r::GUI::GLGizmoBase::render_input_window ( float x,
float y,
float bottom_limit )
inherited
529{
530 on_render_input_window(x, y, bottom_limit);
532 // imgui windows that don't have an initial size needs to be processed once to get one
533 // and are not rendered in the first frame
534 // so, we forces to render another frame the first time the imgui window is shown
535 // https://github.com/ocornut/imgui/issues/2949
536 m_parent.set_as_dirty();
537 m_parent.request_extra_frame();
539 }
540}
virtual void on_render_input_window(float x, float y, float bottom_limit)
Definition GLGizmoBase.hpp:258
bool m_first_input_window_render
Definition GLGizmoBase.hpp:154

References m_first_input_window_render, m_parent, and on_render_input_window().

Here is the call graph for this function:

◆ reset_to_default_style()

void GLGizmoEmboss::reset_to_default_style ( )
private
1397{
1398 int default_index = 0;
1399 const StyleManager::Style& current_style = m_style_manager.get_style();
1400 const StyleManager::Style& default_style = m_style_manager.get_styles()[default_index];
1401
1402 StyleManager::Style cur_s = current_style; // copy
1403 StyleManager::Style new_s = default_style; // copy
1404
1405 if (m_style_manager.load_style(default_index)) {
1406 ::fix_transformation(cur_s, new_s, m_parent);
1407 process();
1408 }
1409}

References Slic3r::GUI::GLGizmoBase::m_parent, m_style_manager, and process().

Referenced by draw_window().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reset_volume()

void GLGizmoEmboss::reset_volume ( )
private
1347{
1348 if (m_volume == nullptr)
1349 return; // already reseted
1350
1351 m_volume = nullptr;
1352 m_volume_id.id = 0;
1353
1354 // No more need of current notification
1356}

References m_volume, m_volume_id, and remove_notification_not_valid_font().

Referenced by on_set_state(), and set_volume_by_selection().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rev_checkbox()

bool GLGizmoEmboss::rev_checkbox ( const std::string & name,
bool & value,
const bool * default_value,
const std::string & undo_tooltip ) const
private
2700{
2701 // draw offseted input
2702 auto draw_offseted_input = [this, &offset = m_gui_cfg->advanced_input_offset, &name, &value](){
2703 ImGui::SameLine(offset);
2704 return m_imgui->bbl_checkbox(wxString::FromUTF8("##" + name), value);
2705 };
2706 return revertible(name, value, default_value, undo_tooltip,
2707 0.0f, draw_offseted_input);
2708}
Slic3r::Polygons offset(const Slic3r::Polygon &polygon, const float delta, JoinType joinType, double miterLimit)
Definition ClipperUtils.cpp:582

References m_gui_cfg, Slic3r::GUI::GLGizmoBase::m_imgui, Slic3r::offset(), and revertible().

Referenced by draw_advanced().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rev_input()

template<typename T>
bool GLGizmoEmboss::rev_input ( const std::string & name,
T & value,
const T * default_value,
const std::string & undo_tooltip,
T step,
T step_fast,
const char * format,
ImGuiInputTextFlags flags = 0 ) const
private

Reversible input float with option to restor default value TODO: make more general, static and move to ImGuiWrapper.

Returns
True when value changed otherwise FALSE.
2643{
2644 // draw offseted input
2645 auto draw_offseted_input = [this, &offset = m_gui_cfg->input_offset, &width = m_gui_cfg->input_width,
2646 &name, &value, &step, &step_fast, format, flags](){
2647 ImGui::SameLine(offset);
2648 ImGui::SetNextItemWidth(width);
2649 bool changed = imgui_input(("##" + name).c_str(),
2650 &value, step, step_fast, format, flags);
2651 m_imgui->request_frames_while_held(); // ORCA auto-repeat of the +/- buttons
2652 return changed;
2653 };
2654 return revertible(name, value, default_value, undo_tooltip,
2655 0.0f, draw_offseted_input);
2656}
bool imgui_input(const char *label, T *v, T step, T step_fast, const char *format, ImGuiInputTextFlags flags)
void step(Coord &crd, const Dir d, const long n=1)
Definition MarchingSquares.hpp:213

References Slic3r::GUI::GLGizmoBase::format(), imgui_input(), m_gui_cfg, Slic3r::GUI::GLGizmoBase::m_imgui, Slic3r::offset(), and revertible().

Referenced by rev_input_mm().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rev_input_mm()

template<typename T>
bool GLGizmoEmboss::rev_input_mm ( const std::string & name,
T & value,
const T * default_value,
const std::string & undo_tooltip,
T step,
T step_fast,
const char * format,
bool use_inch,
const std::optional< float > & scale ) const
private
2668{
2669 // _variable which temporary keep value
2670 T value_ = value;
2671 T default_value_;
2672 if (use_inch) {
2673 // calc value in inch
2675 if (default_value_ptr) {
2676 default_value_ = GizmoObjectManipulation::mm_to_in * (*default_value_ptr);
2677 default_value_ptr = &default_value_;
2678 }
2679 }
2680 if (scale.has_value())
2681 value_ *= *scale;
2682 bool use_correction = use_inch || scale.has_value();
2683 if (rev_input(name, use_correction ? value_ : value, default_value_ptr, undo_tooltip, step, step_fast, format)) {
2684 if (use_correction) {
2685 value = value_;
2686 if (use_inch)
2688 if (scale.has_value())
2689 value /= *scale;
2690 }
2691 return true;
2692 }
2693 return false;
2694}
bool rev_input(const std::string &name, T &value, const T *default_value, const std::string &undo_tooltip, T step, T step_fast, const char *format, ImGuiInputTextFlags flags=0) const
Reversible input float with option to restor default value TODO: make more general,...
Definition GLGizmoEmboss.cpp:2641

References Slic3r::GUI::GLGizmoBase::format(), Slic3r::GUI::GizmoObjectManipulation::in_to_mm, Slic3r::GUI::GizmoObjectManipulation::mm_to_in, rev_input(), and scale().

Referenced by draw_depth(), and draw_height().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rev_slider() [1/3]

bool GLGizmoEmboss::rev_slider ( const std::string & name,
float & value,
const float * default_value,
const std::string & undo_tooltip,
float v_min,
float v_max,
const std::string & format,
const wxString & tooltip ) const
private
2821{
2822 auto draw_slider_float = [&]() -> bool {
2823 float slider_offset = m_gui_cfg->advanced_input_offset;
2824 float slider_width = m_gui_cfg->input_width;
2825 ImGui::SameLine(slider_offset);
2826 ImGui::SetNextItemWidth(slider_width);
2827 return m_imgui->slider_float("##" + name, &value, v_min, v_max,
2828 format.c_str(), 1.f, false, tooltip);
2829 };
2830 return revertible(name, value, default_value,
2831 undo_tooltip, 0.0f, draw_slider_float);
2832}

References Slic3r::GUI::GLGizmoBase::format(), m_gui_cfg, Slic3r::GUI::GLGizmoBase::m_imgui, and revertible().

Here is the call graph for this function:

◆ rev_slider() [2/3]

bool GLGizmoEmboss::rev_slider ( const std::string & name,
std::optional< float > & value,
const std::optional< float > * default_value,
const std::string & undo_tooltip,
float v_min,
float v_max,
const std::string & format,
const wxString & tooltip ) const
private
2800{
2801 auto draw_slider_optional_float = [&]() -> bool {
2802 float slider_offset = m_gui_cfg->advanced_input_offset;
2803 float slider_width = m_gui_cfg->input_width;
2804 ImGui::SameLine(slider_offset);
2805 ImGui::SetNextItemWidth(slider_width);
2806 return m_imgui->slider_optional_float(("##" + name).c_str(), value,
2807 v_min, v_max, format.c_str(), 1.f, false, tooltip);
2808 };
2809 return revertible(name, value, default_value,
2810 undo_tooltip, 0.0f, draw_slider_optional_float);
2811}

References Slic3r::GUI::GLGizmoBase::format(), m_gui_cfg, Slic3r::GUI::GLGizmoBase::m_imgui, and revertible().

Here is the call graph for this function:

◆ rev_slider() [3/3]

bool GLGizmoEmboss::rev_slider ( const std::string & name,
std::optional< int > & value,
const std::optional< int > * default_value,
const std::string & undo_tooltip,
int v_min,
int v_max,
const std::string & format,
const wxString & tooltip ) const
private
2779{
2780 auto draw_slider_optional_int = [&]() -> bool {
2781 float slider_offset = m_gui_cfg->advanced_input_offset;
2782 float slider_width = m_gui_cfg->input_width;
2783 ImGui::SameLine(slider_offset);
2784 ImGui::SetNextItemWidth(slider_width);
2785 return m_imgui->slider_optional_int( ("##" + name).c_str(), value,
2786 v_min, v_max, format.c_str(), 1.f, false, tooltip);
2787 };
2788 return revertible(name, value, default_value,
2789 undo_tooltip, 0.0f, draw_slider_optional_int);
2790}

References Slic3r::GUI::GLGizmoBase::format(), m_gui_cfg, Slic3r::GUI::GLGizmoBase::m_imgui, and revertible().

Referenced by draw_advanced().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ revertible()

template<typename T, typename Draw>
bool GLGizmoEmboss::revertible ( const std::string & name,
T & value,
const T * default_value,
const std::string & undo_tooltip,
float undo_offset,
Draw draw ) const
private
2593{
2594 ImGui::AlignTextToFramePadding();
2595 bool changed_from_default = exist_change(value, default_value);
2596 if (changed_from_default || default_value == nullptr)
2597 ImGuiWrapper::text_colored(ImGuiWrapper::COL_MODIFIED, name); // ORCA Match color
2598 else
2599 ImGuiWrapper::text(name);
2600
2601 bool changed = draw();
2602
2603 if (changed_from_default == false) {
2604 ImGui::PushStyleVar(ImGuiStyleVar_Alpha, 0.0f);
2605 m_imgui->disabled_begin(true);
2606 }
2607
2608 // render revert changes button
2610 ImGuiWindow *window = ImGui::GetCurrentWindow();
2611 float prev_x = window->DC.CursorPosPrevLine.x;
2612 ImGui::SameLine(undo_offset); // change cursor postion
2613 if (Slic3r::GUI::button(r_icon, r_icon, r_icon)) { // ORCA draw bottom with same orange color
2614 value = *default_value;
2615
2616 // !! Fix to detect change of value after revert of float-slider
2617 m_imgui->get_last_slider_status().deactivated_after_edit = true;
2618
2619 return true;
2620 } else if (ImGui::IsItemHovered())
2621 m_imgui->tooltip(undo_tooltip, m_gui_cfg->max_tooltip_width);
2622
2623 if (undo_offset != 0.0f)
2624 window->DC.CursorPosPrevLine.x = prev_x; // set back previous position
2625
2626 if (changed_from_default == false) {
2627 ImGui::PopStyleVar();
2628 m_imgui->disabled_end();
2629 }
2630
2631 return changed;
2632}

References Slic3r::GUI::button(), Slic3r::GUI::ImGuiWrapper::COL_MODIFIED, Slic3r::GUI::draw(), exist_change(), anonymous_namespace{GLGizmoEmboss.cpp}::hovered, m_gui_cfg, m_icons, Slic3r::GUI::GLGizmoBase::m_imgui, Slic3r::GUI::ImGuiWrapper::text(), Slic3r::GUI::ImGuiWrapper::text_colored(), and anonymous_namespace{GLGizmoEmboss.cpp}::undo.

Referenced by draw_advanced(), rev_checkbox(), rev_input(), rev_slider(), rev_slider(), and rev_slider().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ save()

void Slic3r::GUI::GLGizmoBase::save ( cereal::BinaryOutputArchive & ar) const
inlineinherited
171{ on_save(ar); }
virtual void on_save(cereal::BinaryOutputArchive &ar) const
Definition GLGizmoBase.hpp:242

References on_save().

Here is the call graph for this function:

◆ select_facename()

bool GLGizmoEmboss::select_facename ( const wxString & facename)
private
1774{
1775 if (!wxFontEnumerator::IsValidFacename(facename)) return false;
1776 // Select font
1777 wxFont wx_font(wxFontInfo().FaceName(facename).Encoding(Facenames::encoding));
1778 if (!wx_font.IsOk()) return false;
1779#ifdef USE_PIXEL_SIZE_IN_WX_FONT
1780 // wx font could change source file by size of font
1781 int point_size = static_cast<int>(m_style_manager.get_font_prop().size_in_mm);
1782 wx_font.SetPointSize(point_size);
1783#endif // USE_PIXEL_SIZE_IN_WX_FONT
1784 if (!m_style_manager.set_wx_font(wx_font)) return false;
1785 process();
1786 return true;
1787}

References anonymous_namespace{GLGizmoEmboss.cpp}::Facenames::encoding, m_style_manager, and process().

Referenced by draw_font_list().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_common_data_pool()

void Slic3r::GUI::GLGizmoBase::set_common_data_pool ( CommonGizmosDataPool * ptr)
inlineinherited
193{ m_c = ptr; }
CommonGizmosDataPool * m_c
Definition GLGizmoBase.hpp:155

References m_c.

◆ set_dirty()

void Slic3r::GUI::GLGizmoBase::set_dirty ( )
protectedinherited
524 {
525 m_dirty = true;
526}
bool m_dirty
Definition GLGizmoBase.hpp:293

References m_dirty.

Referenced by Slic3r::GUI::GLGizmoCut3D::process_cut_line(), and Slic3r::GUI::GLGizmoSimplify::request_rerender().

Here is the caller graph for this function:

◆ set_height()

bool GLGizmoEmboss::set_height ( )
private
2710 {
2711 float &value = m_style_manager.get_font_prop().size_in_mm;
2712
2713 // size can't be zero or negative
2714 apply(value, limits.size_in_mm);
2715
2716 if (m_volume == nullptr || !m_volume->text_configuration.has_value()) {
2717 assert(false);
2718 return false;
2719 }
2720
2721 // only different value need process
2722 if (is_approx(value, m_volume->text_configuration->style.prop.size_in_mm))
2723 return false;
2724
2725 if (m_style_manager.get_font_prop().per_glyph)
2726 reinit_text_lines(m_text_lines.get_lines().size());
2727
2728#ifdef USE_PIXEL_SIZE_IN_WX_FONT
2729 // store font size into path serialization
2730 const wxFont &wx_font = m_style_manager.get_wx_font();
2731 if (wx_font.IsOk()) {
2732 wxFont wx_font_new = wx_font; // copy
2733 wx_font_new.SetPointSize(static_cast<int>(value));
2734 m_style_manager.set_wx_font(wx_font_new);
2735 }
2736#endif
2737 return true;
2738}

References Slic3r::apply(), Slic3r::is_approx(), m_style_manager, m_text_lines, m_volume, and reinit_text_lines().

Referenced by draw_height().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_hover_id()

void Slic3r::GUI::GLGizmoBase::set_hover_id ( int id)
inherited
348{
349 // do not change hover id during dragging
350 assert(!m_dragging);
351
352 // allow empty grabbers when not using grabbers but use hover_id - flatten, rotate
353// if (!m_grabbers.empty() && id >= (int) m_grabbers.size())
354// return;
355
356 m_hover_id = id;
358}
virtual void on_set_hover_id()
Definition GLGizmoBase.hpp:245

References m_dragging, m_hover_id, and on_set_hover_id().

Referenced by Slic3r::GUI::GLGizmoRotate3D::on_set_hover_id().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_icon_filename()

void Slic3r::GUI::GLGizmoBase::set_icon_filename ( const std::string & filename)
inherited
343 {
344 m_icon_filename = filename;
345}

References m_icon_filename.

◆ set_state()

void Slic3r::GUI::GLGizmoBase::set_state ( EState state)
inlineinherited
176{ m_state = state; on_set_state(); }
virtual void on_set_state()
Definition GLGizmoBase.hpp:244

References m_state, and on_set_state().

Referenced by Slic3r::GUI::GLGizmosManager::activate_gizmo().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_volume_by_selection()

void GLGizmoEmboss::set_volume_by_selection ( )
private
1234{
1235 const Selection &selection = m_parent.get_selection();
1236 const GLVolume *gl_volume = get_selected_gl_volume(selection);
1237 if (gl_volume == nullptr)
1238 return reset_volume();
1239
1240 const ModelObjectPtrs &objects = m_parent.get_model()->objects;
1241 ModelVolume *volume = get_model_volume(*gl_volume, objects);
1242 if (volume == nullptr)
1243 return reset_volume();
1244
1245 // is same volume as actual selected?
1246 if (volume->id() == m_volume_id &&
1247 m_volume != nullptr &&
1248 volume->text_configuration->style == m_volume->text_configuration->style)
1249 return;
1250
1251 // for changed volume notification is NOT valid
1253
1254 // Do not use focused input value when switch volume(it must swith value)
1255 if (m_volume != nullptr && m_volume != volume) // when update volume it changed id BUT not pointer
1257
1258 // Is selected volume text volume?
1259 const std::optional<TextConfiguration> &tc_opt = volume->text_configuration;
1260 if (!tc_opt.has_value())
1261 return reset_volume();
1262
1263 // Emboss shape must be setted
1264 assert(volume->emboss_shape.has_value());
1265 if (!volume->emboss_shape.has_value())
1266 return;
1267
1268 const TextConfiguration &tc = *tc_opt;
1269 const EmbossStyle &style = tc.style;
1270
1271 std::optional<wxString> installed_name = get_installed_face_name(style.prop.face_name, *m_face_names);
1272
1273 wxFont wx_font;
1274 // load wxFont from same OS when font name is installed
1275 if (style.type == WxFontUtils::get_current_type() && installed_name.has_value())
1276 wx_font = WxFontUtils::load_wxFont(style.path);
1277
1278 // Flag that is selected same font
1279 bool is_exact_font = true;
1280 // Different OS or try found on same OS
1281 if (!wx_font.IsOk()) {
1282 is_exact_font = false;
1283 // Try create similar wx font by FontFamily
1285 if (installed_name.has_value() && !installed_name->empty())
1286 is_exact_font = wx_font.SetFaceName(*installed_name);
1287
1288 // Have to use some wxFont
1289 if (!wx_font.IsOk())
1290 wx_font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
1291 }
1292 assert(wx_font.IsOk());
1293
1294 // Load style to style manager
1295 const auto &styles = m_style_manager.get_styles();
1296 auto has_same_name = [&name = style.name](const StyleManager::Style &style_item) { return style_item.name == name; };
1297
1298 StyleManager::Style style_{style}; // copy
1299 style_.projection = volume->emboss_shape->projection;
1300 style_.angle = calc_angle(selection);
1301 style_.distance = calc_distance(*gl_volume, m_raycast_manager, m_parent);
1302
1303 if (auto it = std::find_if(styles.begin(), styles.end(), has_same_name);
1304 it == styles.end()) {
1305 // style was not found
1306 m_style_manager.load_style(style_, wx_font);
1307 } else {
1308 // style name is in styles list
1309 size_t style_index = it - styles.begin();
1310 if (!m_style_manager.load_style(style_index)) {
1311 // can`t load stored style
1312 m_style_manager.erase(style_index);
1313 m_style_manager.load_style(style_, wx_font);
1314 } else {
1315 // stored style is loaded, now set modification of style
1316 m_style_manager.get_style() = style_;
1317 m_style_manager.set_wx_font(wx_font);
1318 }
1319 }
1320
1321 if (!is_exact_font)
1323
1324 // cancel previous job
1325 if (m_job_cancel != nullptr) {
1326 m_job_cancel->store(true);
1327 m_job_cancel = nullptr;
1328 }
1329
1330 m_text = tc.text;
1331 m_volume = volume;
1332 m_volume_id = volume->id();
1333
1334 if (tc.style.prop.per_glyph)
1336
1337 // Calculate current angle of up vector
1338 assert(m_style_manager.is_active_font());
1339 if (m_style_manager.is_active_font())
1340 m_style_manager.get_style().angle = calc_angle(selection);
1341
1342 // calculate scale for height and depth inside of scaled object instance
1343 calculate_scale();
1344}
static void left_inputs()
Use ImGui internals to unactivate (lose focus) in input. When input is activ it can't change value by...
Definition ImGuiWrapper.cpp:2423
static wxFont create_wxFont(const EmbossStyle &style)
Definition WxFontUtils.cpp:232
std::optional< EmbossShape > emboss_shape
Definition Model.hpp:1019
std::optional< float > calc_distance(const GLVolume &gl_volume, RaycastManager &raycaster, GLCanvas3D &canvas)
Calculate distance by ray to surface of object in emboss direction.
Definition SurfaceDrag.cpp:198
std::vector< ModelObject * > ModelObjectPtrs
Definition CutUtils.hpp:13
std::optional< wxString > get_installed_face_name(const std::optional< std::string > &face_name_opt, ::Facenames &face_names)
Check installed fonts whether optional face name exist in installed fonts.
Definition GLGizmoEmboss.cpp:1148

References Slic3r::GUI::Emboss::StyleManager::Style::angle, Slic3r::GUI::calc_angle(), Slic3r::GUI::calc_distance(), calculate_scale(), create_notification_not_valid_font(), Slic3r::GUI::WxFontUtils::create_wxFont(), Slic3r::GUI::Emboss::StyleManager::Style::distance, Slic3r::ModelVolume::emboss_shape, Slic3r::GUI::WxFontUtils::get_current_type(), Slic3r::GUI::get_model_volume(), Slic3r::GUI::get_selected_gl_volume(), Slic3r::ObjectBase::id(), Slic3r::GUI::ImGuiWrapper::left_inputs(), Slic3r::GUI::WxFontUtils::load_wxFont(), m_face_names, m_job_cancel, Slic3r::GUI::GLGizmoBase::m_parent, m_raycast_manager, m_style_manager, m_text, m_volume, m_volume_id, Slic3r::FontProp::per_glyph, Slic3r::GUI::Emboss::StyleManager::Style::projection, Slic3r::EmbossStyle::prop, reinit_text_lines(), remove_notification_not_valid_font(), reset_volume(), Slic3r::TextConfiguration::style, style, Slic3r::TextConfiguration::text, and Slic3r::ModelVolume::text_configuration.

Referenced by data_changed(), and on_shortcut_key().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ shortcut()

std::optional< Shortcut > Slic3r::GUI::GLGizmoBase::shortcut ( ) const
inlineinherited
178{ return m_shortcut; }

References m_shortcut.

Referenced by Slic3r::GUI::GLGizmoFdmSupports::on_tool_shortcut(), Slic3r::GUI::GLGizmoMmuSegmentation::on_tool_shortcut(), Slic3r::GUI::GLGizmoPainterBase::on_tool_shortcut(), and Slic3r::GUI::GLGizmoSeam::on_tool_shortcut().

Here is the caller graph for this function:

◆ unregister_grabbers_for_picking()

void Slic3r::GUI::GLGizmoBase::unregister_grabbers_for_picking ( )
protectedinherited
406{
407 for (size_t i = 0; i < m_grabbers.size(); ++i) {
408 m_grabbers[i].unregister_raycasters_for_picking();
409 }
410}

References m_grabbers.

Referenced by unregister_raycasters_for_picking().

Here is the caller graph for this function:

◆ unregister_raycasters_for_picking()

void Slic3r::GUI::GLGizmoBase::unregister_raycasters_for_picking ( )
inlineinherited
virtual void on_unregister_raycasters_for_picking()
Definition GLGizmoBase.hpp:268
void unregister_grabbers_for_picking()
Definition GLGizmoBase.cpp:405

References on_unregister_raycasters_for_picking(), and unregister_grabbers_for_picking().

Referenced by Slic3r::GUI::GLGizmosManager::activate_gizmo(), and Slic3r::GUI::GLCanvas3D::reload_scene().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_items_state()

bool Slic3r::GUI::GLGizmoBase::update_items_state ( )
inherited
361{
362 bool res = m_dirty;
363 m_dirty = false;
364 return res;
365}

References m_dirty.

◆ update_render_colors()

void Slic3r::GUI::GLGizmoBase::update_render_colors ( )
staticinherited

References AXES_COLOR, Slic3r::RenderColor::colors, FLATTEN_COLOR, FLATTEN_HOVER_COLOR, Slic3r::GUI::ImGuiWrapper::from_ImVec4(), RenderCol_Flatten_Plane, RenderCol_Flatten_Plane_Hover, RenderCol_Grabber_X, RenderCol_Grabber_Y, and RenderCol_Grabber_Z.

Referenced by Slic3r::GUI::GLCanvas3D::_render_style_editor().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ use_grabbers()

bool Slic3r::GUI::GLGizmoBase::use_grabbers ( const wxMouseEvent & mouse_event)
protectedinherited

function which Set up m_dragging and call functions on_start_dragging / on_dragging / on_stop_dragging

Parameters
mouse_eventKeep information about mouse click
Returns
same as on_mouse
444 {
445 bool is_dragging_finished = false;
446 if (mouse_event.Moving()) {
447 // it should not happen but for sure
448 assert(!m_dragging);
449 if (m_dragging) is_dragging_finished = true;
450 else return false;
451 }
452
453 if (mouse_event.LeftDown()) {
454 Selection &selection = m_parent.get_selection();
455 if (!selection.is_empty() && m_hover_id != -1 /* &&
456 (m_grabbers.empty() || m_hover_id < static_cast<int>(m_grabbers.size()))*/) {
457 selection.setup_cache();
458
459 m_dragging = true;
460 for (auto &grabber : m_grabbers) grabber.dragging = false;
461// if (!m_grabbers.empty() && m_hover_id < int(m_grabbers.size()))
462// m_grabbers[m_hover_id].dragging = true;
463
465
466 // Let the plater know that the dragging started
467 m_parent.post_event(SimpleEvent(EVT_GLCANVAS_MOUSE_DRAGGING_STARTED));
468 m_parent.set_as_dirty();
469 return true;
470 }
471 } else if (m_dragging) {
472 // when mouse cursor leave window than finish actual dragging operation
473 bool is_leaving = mouse_event.Leaving() && !m_parent.has_mouse_capture(); // ORCA keep tracking mouse position while drag active and cursor not in window bounds
474 if (mouse_event.Dragging()) {
475 Point mouse_coord(mouse_event.GetX(), mouse_event.GetY());
476 auto ray = m_parent.mouse_ray(mouse_coord);
477 UpdateData data(ray, mouse_coord);
478
479 on_dragging(data);
480
481 wxGetApp().obj_manipul()->set_dirty();
482 m_parent.set_as_dirty();
483 return true;
484 }
485 else if (mouse_event.LeftUp() || is_leaving || is_dragging_finished) {
486 do_stop_dragging(is_leaving);
487 return true;
488 }
489 }
490 return false;
491}
virtual void on_dragging(const UpdateData &data)
Definition GLGizmoBase.hpp:255
virtual void on_start_dragging()
Definition GLGizmoBase.hpp:253
void do_stop_dragging(bool perform_mouse_cleanup)
Definition GLGizmoBase.cpp:493
Kernel::Point_3 Point
Definition MeshRepair.cpp:81
Definition GLGizmoBase.hpp:133

References do_stop_dragging(), Slic3r::GUI::Selection::is_empty(), m_dragging, m_grabbers, m_hover_id, m_parent, on_dragging(), on_start_dragging(), Slic3r::GUI::Selection::setup_cache(), and Slic3r::GUI::wxMouseEvent.

Referenced by Slic3r::GUI::GLGizmoBrimEars::on_mouse(), Slic3r::GUI::GLGizmoCut3D::on_mouse(), Slic3r::GUI::GLGizmoMove3D::on_mouse(), Slic3r::GUI::GLGizmoRotate3D::on_mouse(), Slic3r::GUI::GLGizmoRotate::on_mouse(), Slic3r::GUI::GLGizmoScale3D::on_mouse(), Slic3r::GUI::GLGizmoEmboss::on_mouse_for_rotation(), and Slic3r::GUI::GLGizmoSVG::on_mouse_for_rotation().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ volume_transformation_changed()

void GLGizmoEmboss::volume_transformation_changed ( )
private
764{
765 if (m_volume == nullptr ||
766 !m_volume->text_configuration.has_value() ||
767 !m_volume->emboss_shape.has_value() ||
768 !m_style_manager.is_active_font()) {
769 assert(false);
770 return;
771 }
772
773 if (!m_keep_up) {
774 // Re-Calculate current angle of up vector
775 m_style_manager.get_style().angle = calc_angle(m_parent.get_selection());
776 } else {
777 // angle should be the same
778 assert(is_approx(m_style_manager.get_style().angle, calc_angle(m_parent.get_selection())));
779 }
780
781 const TextConfiguration &tc = *m_volume->text_configuration;
782 const EmbossShape &es = *m_volume->emboss_shape;
783
784 bool per_glyph = tc.style.prop.per_glyph;
785 if (per_glyph)
786 init_text_lines(m_text_lines, m_parent.get_selection(), m_style_manager, m_text_lines.get_lines().size());
787
788 bool use_surface = es.projection.use_surface;
789
790 // Update surface by new position
791 if (use_surface || per_glyph)
792 process();
793 else {
794 // inform slicing process that model changed
795 // SLA supports, processing
796 // ensure on bed
797 wxGetApp().plater()->changed_object(*m_volume->get_object());
798 }
799
800 // Show correct value of height & depth inside of inputs
802}

References Slic3r::GUI::calc_angle(), calculate_scale(), Slic3r::is_approx(), m_keep_up, Slic3r::GUI::GLGizmoBase::m_parent, m_style_manager, m_text_lines, m_volume, Slic3r::FontProp::per_glyph, process(), Slic3r::EmbossShape::projection, Slic3r::EmbossStyle::prop, Slic3r::TextConfiguration::style, and Slic3r::EmbossProjection::use_surface.

Referenced by draw_advanced(), on_mouse_for_translate(), and on_stop_dragging().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ volume_transformation_changing()

void GLGizmoEmboss::volume_transformation_changing ( )
private
753{
754 if (m_volume == nullptr || !m_volume->text_configuration.has_value()) {
755 assert(false);
756 return;
757 }
758 const FontProp &prop = m_volume->text_configuration->style.prop;
759 if (prop.per_glyph)
760 init_text_lines(m_text_lines, m_parent.get_selection(), m_style_manager, m_text_lines.get_lines().size());
761}

References Slic3r::GUI::GLGizmoBase::m_parent, m_style_manager, m_text_lines, m_volume, and Slic3r::FontProp::per_glyph.

Referenced by on_mouse_for_translate().

Here is the caller graph for this function:

◆ wants_enter_leave_snapshots()

bool GLGizmoEmboss::wants_enter_leave_snapshots ( ) const
overrideprotectedvirtual

Reimplemented from Slic3r::GUI::GLGizmoBase.

804{ return true; }

Member Data Documentation

◆ AXES_COLOR

◆ AXES_HOVER_COLOR

std::array< ColorRGBA, 3 > Slic3r::GUI::GLGizmoBase::AXES_HOVER_COLOR
staticinherited
Initial value:
= {{
{ColorRGBA::X().r() * 1.2f, ColorRGBA::X().g() * 1.4f, ColorRGBA::X().b() * 1.4f, 1.0f},
{ColorRGBA::Y().r() * 1.2f, ColorRGBA::Y().g() * 1.2f, ColorRGBA::Y().b() * 1.2f, 1.0f},
{ColorRGBA::Z().r() * 1.2f, ColorRGBA::Z().g() * 1.2f, ColorRGBA::Z().b() * 1.2f, 1.0f},
}}
float b() const
Definition Color.hpp:107
float r() const
Definition Color.hpp:105
float g() const
Definition Color.hpp:106

Referenced by Slic3r::GUI::GLGizmoMove3D::on_render(), Slic3r::GUI::GLGizmoRotate::on_render(), and Slic3r::GUI::GLGizmoScale3D::update_grabbers_data().

◆ BASE_ID

const unsigned int Slic3r::GUI::GLGizmoBase::BASE_ID = 255 * 255 * 254
staticinherited

◆ CONSTRAINED_COLOR

ColorRGBA Slic3r::GUI::GLGizmoBase::CONSTRAINED_COLOR = {0.5f, 0.5f, 0.5f, 1.0f}
staticinherited

◆ count

◆ DEFAULT_BASE_COLOR

ColorRGBA Slic3r::GUI::GLGizmoBase::DEFAULT_BASE_COLOR = { 0.625f, 0.625f, 0.625f, 1.0f }
staticinherited

◆ DEFAULT_DRAG_COLOR

ColorRGBA Slic3r::GUI::GLGizmoBase::DEFAULT_DRAG_COLOR = { 1.0f, 1.0f, 1.0f, 1.0f }
staticinherited

◆ DEFAULT_HIGHLIGHT_COLOR

ColorRGBA Slic3r::GUI::GLGizmoBase::DEFAULT_HIGHLIGHT_COLOR = {1.0f, 0.38f, 0.0f, 1.0f}
staticinherited

◆ FLATTEN_COLOR

ColorRGBA Slic3r::GUI::GLGizmoBase::FLATTEN_COLOR = {0.96f, 0.93f, 0.93f, 0.5f}
staticinherited

◆ FLATTEN_HOVER_COLOR

ColorRGBA Slic3r::GUI::GLGizmoBase::FLATTEN_HOVER_COLOR = {1.0f, 1.0f, 1.0f, 0.75f}
staticinherited

◆ GRABBER_ELEMENTS_MAX_COUNT

const unsigned int Slic3r::GUI::GLGizmoBase::GRABBER_ELEMENTS_MAX_COUNT = 7
staticinherited

◆ GRABBER_HOVER_COL

ColorRGBA Slic3r::GUI::GLGizmoBase::GRABBER_HOVER_COL = {0.863f, 0.125f, 0.063f, 1.0f}
staticinherited

◆ GRABBER_NORMAL_COL

ColorRGBA Slic3r::GUI::GLGizmoBase::GRABBER_NORMAL_COL = {1.0f, 1.0f, 1.0f, 1.0f}
staticinherited

◆ GRABBER_UNIFORM_COL

ColorRGBA Slic3r::GUI::GLGizmoBase::GRABBER_UNIFORM_COL = {0, 1.0, 1.0, 1.0f}
staticinherited

◆ GRABBER_UNIFORM_HOVER_COL

ColorRGBA Slic3r::GUI::GLGizmoBase::GRABBER_UNIFORM_HOVER_COL = {0, 0.7, 0.7, 1.0f}
staticinherited

◆ INV_ZOOM

◆ last_input_window_width

float Slic3r::GUI::GLGizmoBase::last_input_window_width = 0
protectedinherited

◆ m_c

CommonGizmosDataPool* Slic3r::GUI::GLGizmoBase::m_c { nullptr }
protectedinherited
155{ nullptr };

Referenced by Slic3r::GUI::GLGizmoTextureDisplacement::apply_projection_frame(), Slic3r::GUI::GLGizmoTextureDisplacement::bake(), Slic3r::GUI::GLGizmoTextureDisplacement::capture_view_projection(), Slic3r::GUI::GLGizmoCut3D::check_and_update_connectors_state(), Slic3r::GUI::GLGizmoBrimEars::data_changed(), Slic3r::GUI::GLGizmoCut3D::data_changed(), Slic3r::GUI::GLGizmoMmuSegmentation::data_changed(), Slic3r::GUI::GLGizmoPainterBase::data_changed(), Slic3r::GUI::GLGizmoCut3D::dragging_connector(), Slic3r::GUI::GLGizmoMeshBoolean::generate_new_volume(), Slic3r::GUI::GLGizmoPainterBase::get_clipping_plane_data(), Slic3r::GUI::GLGizmoPainterBase::get_clipping_plane_in_volume_coordinates(), Slic3r::GUI::GLGizmoBrimEars::get_config_options(), Slic3r::GUI::GLGizmoPainterBase::get_projected_height_range(), Slic3r::GUI::GLGizmoPainterBase::get_projected_mouse_positions(), Slic3r::GUI::GLGizmoFdmSupports::get_selection_support_threshold_angle(), Slic3r::GUI::GLGizmoBrimEars::gizmo_event(), Slic3r::GUI::GLGizmoCut3D::gizmo_event(), Slic3r::GUI::GLGizmoMeshBoolean::gizmo_event(), Slic3r::GUI::GLGizmoPainterBase::gizmo_event(), Slic3r::GUI::GLGizmoCut3D::has_valid_contour(), Slic3r::GUI::GLGizmoSimplify::init_model(), Slic3r::GUI::GLGizmoMmuSegmentation::init_model_triangle_selectors(), Slic3r::GUI::GLGizmoFdmSupports::init_print_instance(), Slic3r::GUI::GLGizmoBrimEars::is_mesh_point_clipped(), Slic3r::GUI::GLGizmoPainterBase::is_mesh_point_clipped(), Slic3r::GUI::GLGizmoCut3D::is_outside_of_cut_contour(), Slic3r::GUI::GLGizmoFlatten::is_plane_update_necessary(), Slic3r::GUI::GLGizmoPainterBase::mesh_trafo_matrices(), Slic3r::GUI::GLGizmoFdmSupports::need_regenerate_support_volumes(), Slic3r::GUI::GLGizmoMeshBoolean::on_get_requirements(), Slic3r::GUI::GLGizmoMeshBoolean::on_load(), Slic3r::GUI::GLGizmoTextureDisplacement::on_mouse_adjust_texture(), Slic3r::GUI::GLGizmoCut3D::on_register_raycasters_for_picking(), Slic3r::GUI::GLGizmoBrimEars::on_render(), Slic3r::GUI::GLGizmoMeshBoolean::on_render(), Slic3r::GUI::GLGizmoBrimEars::on_render_input_window(), Slic3r::GUI::GLGizmoCut3D::on_render_input_window(), Slic3r::GUI::GLGizmoFdmSupports::on_render_input_window(), Slic3r::GUI::GLGizmoFuzzySkin::on_render_input_window(), Slic3r::GUI::GLGizmoMmuSegmentation::on_render_input_window(), Slic3r::GUI::GLGizmoSeam::on_render_input_window(), Slic3r::GUI::GLGizmoTextureDisplacement::on_render_input_window(), Slic3r::GUI::GLGizmoCut3D::on_set_state(), Slic3r::GUI::GLGizmoFdmSupports::on_set_state(), Slic3r::GUI::GLGizmoMmuSegmentation::on_set_state(), Slic3r::GUI::GLGizmoSeam::on_set_state(), Slic3r::GUI::GLGizmoTextureDisplacement::preview_part(), Slic3r::GUI::GLGizmoCut3D::process_contours(), Slic3r::GUI::GLGizmoCut3D::process_selection_rectangle(), Slic3r::GUI::GLGizmoCut3D::put_connectors_on_cut_plane(), Slic3r::GUI::GLGizmoTextureDisplacement::queue_prepare(), Slic3r::GUI::GLGizmoBrimEars::reload_cache(), Slic3r::GUI::GLGizmoMmuSegmentation::remap_filament_assignments(), Slic3r::GUI::GLGizmoTextureDisplacement::render_adjust_texture_gizmo(), Slic3r::GUI::GLGizmoCut3D::render_clipper_cut(), Slic3r::GUI::GLGizmoCut3D::render_connectors(), Slic3r::GUI::GLGizmoCut3D::render_debug_input_window(), Slic3r::GUI::GLGizmoPainterBase::render_follows_cursor(), Slic3r::GUI::GLGizmoTextureDisplacement::render_island_overlay(), Slic3r::GUI::GLGizmoTextureDisplacement::render_paint_overlay(), Slic3r::GUI::GLGizmoTextureDisplacement::render_painted_colors(), Slic3r::GUI::GLGizmoFdmSupports::render_painter_gizmo(), Slic3r::GUI::GLGizmoFuzzySkin::render_painter_gizmo(), Slic3r::GUI::GLGizmoMmuSegmentation::render_painter_gizmo(), Slic3r::GUI::GLGizmoSeam::render_painter_gizmo(), Slic3r::GUI::GLGizmoTextureDisplacement::render_painter_gizmo(), Slic3r::GUI::GLGizmoBrimEars::render_points(), Slic3r::GUI::GLGizmoTextureDisplacement::render_preview_mesh(), Slic3r::GUI::GLGizmoTextureDisplacement::render_seam_overlay(), Slic3r::GUI::GLGizmoTextureDisplacement::render_shaded_preview_mesh(), Slic3r::GUI::GLGizmoTextureDisplacement::render_subdivide_preview(), Slic3r::GUI::GLGizmoPainterBase::render_triangles(), Slic3r::GUI::GLGizmoTextureDisplacement::render_uvcheck_mesh(), Slic3r::GUI::GLGizmoTextureDisplacement::render_wireframe_overlay(), Slic3r::GUI::GLGizmoCut3D::reset_connectors(), Slic3r::GUI::GLGizmoFdmSupports::run_thread(), Slic3r::GUI::GLGizmoTextureDisplacement::seam_edge_at(), Slic3r::GUI::GLGizmoTextureDisplacement::seam_vertex_at(), Slic3r::GUI::GLGizmoFdmSupports::select_facets_by_angle(), Slic3r::GUI::GLGizmoTextureDisplacement::select_visible_faces(), Slic3r::GUI::GLGizmoTextureDisplacement::select_whole_model(), Slic3r::GUI::GLGizmoBrimEars::set_brim_data(), set_common_data_pool(), Slic3r::GUI::GLGizmoCut3D::set_connectors_editing(), Slic3r::GUI::GLGizmoTextureDisplacement::shaded_preview_ready(), Slic3r::GUI::GLGizmoTextureDisplacement::smooth_model(), Slic3r::GUI::GLGizmoTextureDisplacement::subdivide_model(), Slic3r::GUI::GLGizmoTextureDisplacement::swap_layer_slots(), Slic3r::GUI::GLGizmoCut3D::switch_to_mode(), Slic3r::GUI::GLGizmoTextureDisplacement::texture_parts(), Slic3r::GUI::GLGizmoTextureDisplacement::texture_volume(), Slic3r::GUI::GLGizmoTextureDisplacement::texture_volume_raycaster_index(), Slic3r::GUI::GLGizmoCut3D::unproject_on_cut_plane(), Slic3r::GUI::GLGizmoBrimEars::unproject_on_mesh(), Slic3r::GUI::GLGizmoBrimEars::unproject_on_mesh2(), Slic3r::GUI::GLGizmoCut3D::update_bb(), Slic3r::GUI::GLGizmoCut3D::update_clipper(), Slic3r::GUI::GLGizmoFdmSupports::update_from_model_object(), Slic3r::GUI::GLGizmoFuzzySkin::update_from_model_object(), Slic3r::GUI::GLGizmoSeam::update_from_model_object(), Slic3r::GUI::GLGizmoTextureDisplacement::update_from_model_object(), Slic3r::GUI::GLGizmoBrimEars::update_model_object(), Slic3r::GUI::GLGizmoFdmSupports::update_model_object(), Slic3r::GUI::GLGizmoFuzzySkin::update_model_object(), Slic3r::GUI::GLGizmoMmuSegmentation::update_model_object(), Slic3r::GUI::GLGizmoSeam::update_model_object(), Slic3r::GUI::GLGizmoTextureDisplacement::update_model_object(), Slic3r::GUI::GLGizmoFlatten::update_planes(), Slic3r::GUI::GLGizmoPainterBase::update_raycast_cache(), and Slic3r::GUI::GLGizmoCut3D::update_raycasters_for_picking_transform().

◆ m_dirty

bool Slic3r::GUI::GLGizmoBase::m_dirty { false }
privateinherited
293{ false };

Referenced by set_dirty(), and update_items_state().

◆ m_dragging

◆ m_face_names

std::unique_ptr<Facenames> Slic3r::GUI::GLGizmoEmboss::m_face_names
private

◆ m_first_input_window_render

bool Slic3r::GUI::GLGizmoBase::m_first_input_window_render { true }
protectedinherited
154{ true };

Referenced by render_input_window().

◆ m_grabbers

◆ m_group_id

int Slic3r::GUI::GLGizmoBase::m_group_id
protectedinherited

◆ m_gui_cfg

◆ m_hover_id

int Slic3r::GUI::GLGizmoBase::m_hover_id { -1 }
protectedinherited
150{ -1 };

Referenced by Slic3r::GUI::GLGizmoScale3D::calc_ratio(), Slic3r::GUI::GLGizmoScale3D::do_scale_along_axis(), Slic3r::GUI::GLGizmoScale3D::do_scale_uniform(), Slic3r::GUI::GLGizmoCut3D::dragging_connector(), Slic3r::GUI::GLGizmoCut3D::dragging_grabber_move(), Slic3r::GUI::GLGizmoCut3D::dragging_grabber_rotation(), get_hover_id(), Slic3r::GUI::GLGizmoCut3D::get_tooltip(), Slic3r::GUI::GLGizmoMove3D::get_tooltip(), Slic3r::GUI::GLGizmoRotate::get_tooltip(), Slic3r::GUI::GLGizmoScale3D::get_tooltip(), Slic3r::GUI::GLGizmoBrimEars::gizmo_event(), Slic3r::GUI::GLGizmoCut3D::gizmo_event(), Slic3r::GUI::GLGizmoCut3D::is_selection_changed(), Slic3r::GUI::GLGizmoBrimEars::on_dragging(), Slic3r::GUI::GLGizmoCut3D::on_dragging(), Slic3r::GUI::GLGizmoMove3D::on_dragging(), Slic3r::GUI::GLGizmoRotate3D::on_dragging(), Slic3r::GUI::GLGizmoScale3D::on_dragging(), Slic3r::GUI::GLGizmoCut3D::on_mouse(), Slic3r::GUI::GLGizmoFlatten::on_mouse(), Slic3r::GUI::GLGizmoMeasure::on_mouse(), Slic3r::GUI::GLGizmoFlatten::on_render(), Slic3r::GUI::GLGizmoMeasure::on_render(), Slic3r::GUI::GLGizmoMove3D::on_render(), Slic3r::GUI::GLGizmoRotate3D::on_render(), Slic3r::GUI::GLGizmoRotate::on_render(), Slic3r::GUI::GLGizmoScale3D::on_render(), Slic3r::GUI::GLGizmoBrimEars::on_set_hover_id(), Slic3r::GUI::GLGizmoEmboss::on_set_hover_id(), Slic3r::GUI::GLGizmoRotate3D::on_set_hover_id(), Slic3r::GUI::GLGizmoSVG::on_set_hover_id(), Slic3r::GUI::GLGizmoMeasure::on_set_state(), Slic3r::GUI::GLGizmoBrimEars::on_start_dragging(), Slic3r::GUI::GLGizmoCut3D::on_start_dragging(), Slic3r::GUI::GLGizmoMove3D::on_start_dragging(), Slic3r::GUI::GLGizmoRotate3D::on_start_dragging(), Slic3r::GUI::GLGizmoScale3D::on_start_dragging(), Slic3r::GUI::GLGizmoBrimEars::on_stop_dragging(), Slic3r::GUI::GLGizmoCut3D::on_stop_dragging(), Slic3r::GUI::GLGizmoRotate3D::on_stop_dragging(), Slic3r::GUI::GLGizmoCut3D::render_connectors(), Slic3r::GUI::GLGizmoCut3D::render_cut_plane_grabbers(), Slic3r::GUI::GLGizmoCut3D::render_flip_plane_button(), render_grabbers(), Slic3r::GUI::GLGizmoBrimEars::render_points(), set_hover_id(), Slic3r::GUI::GLGizmoMeasure::show_selection_ui(), Slic3r::GUI::GLGizmoScale3D::update_grabbers_data(), and use_grabbers().

◆ M_ICON_FILENAME

const std::string Slic3r::GUI::GLGizmoEmboss::M_ICON_FILENAME
staticprivate

◆ m_icon_filename

std::string Slic3r::GUI::GLGizmoBase::m_icon_filename
protectedinherited

◆ m_icon_manager

IconManager Slic3r::GUI::GLGizmoEmboss::m_icon_manager
private

Referenced by init_icons().

◆ m_icons

◆ m_imgui

ImGuiWrapper* Slic3r::GUI::GLGizmoBase::m_imgui
protectedinherited

Referenced by GLGizmoBase(), Slic3r::GUI::GLGizmoEmboss::GLGizmoEmboss(), Slic3r::GUI::GLGizmoCut3D::add_horizontal_scaled_interval(), Slic3r::GUI::GLGizmoCut3D::add_vertical_scaled_interval(), Slic3r::GUI::GLGizmoSimplify::create_gui_cfg(), Slic3r::GUI::GLGizmoEmboss::draw_advanced(), Slic3r::GUI::GLGizmoEmboss::draw_bold_button(), Slic3r::GUI::GLGizmoEmboss::draw_delete_style_button(), Slic3r::GUI::GLGizmoSVG::draw_depth(), Slic3r::GUI::GLGizmoSVG::draw_distance(), Slic3r::GUI::GLGizmoSVG::draw_filename(), Slic3r::GUI::GLGizmoEmboss::draw_font_list(), Slic3r::GUI::GLGizmoEmboss::draw_font_list_line(), Slic3r::GUI::GLGizmoEmboss::draw_italic_button(), Slic3r::GUI::GLGizmoSVG::draw_mirroring(), Slic3r::GUI::GLGizmoEmboss::draw_model_type(), Slic3r::GUI::GLGizmoSVG::draw_model_type(), Slic3r::GUI::GLGizmoSVG::draw_rotation(), Slic3r::GUI::GLGizmoSVG::draw_size(), Slic3r::GUI::GLGizmoEmboss::draw_style_add_button(), Slic3r::GUI::GLGizmoEmboss::draw_style_list(), Slic3r::GUI::GLGizmoEmboss::draw_style_rename_button(), Slic3r::GUI::GLGizmoEmboss::draw_style_rename_popup(), Slic3r::GUI::GLGizmoEmboss::draw_style_save_as_popup(), Slic3r::GUI::GLGizmoEmboss::draw_style_save_button(), Slic3r::GUI::GLGizmoEmboss::draw_text_input(), Slic3r::GUI::GLGizmoSVG::draw_use_surface(), Slic3r::GUI::GLGizmoEmboss::draw_window(), GizmoImguiBegin(), GizmoImguiEnd(), GizmoImguiSetNextWIndowPos(), Slic3r::GUI::GLGizmoCut3D::init_input_window_data(), Slic3r::GUI::GLGizmoMeasure::on_mouse(), Slic3r::GUI::GLGizmoAssembly::on_render_input_window(), Slic3r::GUI::GLGizmoBrimEars::on_render_input_window(), Slic3r::GUI::GLGizmoEmboss::on_render_input_window(), Slic3r::GUI::GLGizmoFdmSupports::on_render_input_window(), Slic3r::GUI::GLGizmoFuzzySkin::on_render_input_window(), Slic3r::GUI::GLGizmoMeasure::on_render_input_window(), Slic3r::GUI::GLGizmoMeshBoolean::on_render_input_window(), Slic3r::GUI::GLGizmoMmuSegmentation::on_render_input_window(), Slic3r::GUI::GLGizmoMove3D::on_render_input_window(), Slic3r::GUI::GLGizmoRotate3D::on_render_input_window(), Slic3r::GUI::GLGizmoScale3D::on_render_input_window(), Slic3r::GUI::GLGizmoSeam::on_render_input_window(), Slic3r::GUI::GLGizmoSimplify::on_render_input_window(), Slic3r::GUI::GLGizmoSVG::on_render_input_window(), Slic3r::GUI::GLGizmoTextureDisplacement::on_render_input_window(), Slic3r::GUI::GLGizmoTextureDisplacement::panel_tooltip(), Slic3r::GUI::GLGizmoCut3D::render_angle_input(), Slic3r::GUI::GLGizmoCut3D::render_build_size(), Slic3r::GUI::GLGizmoCut3D::render_color_marker(), render_combo(), Slic3r::GUI::GLGizmoCut3D::render_connectors_input_window(), Slic3r::GUI::GLGizmoCut3D::render_cut_mode_combo(), Slic3r::GUI::GLGizmoCut3D::render_cut_plane_input_window(), Slic3r::GUI::GLGizmoCut3D::render_debug_input_window(), Slic3r::GUI::GLGizmoTextureDisplacement::render_debug_stage_panel(), Slic3r::GUI::GLGizmoMeasure::render_dimensioning(), Slic3r::GUI::GLGizmoCut3D::render_double_input(), Slic3r::GUI::GLGizmoMmuSegmentation::render_filament_remap_ui(), Slic3r::GUI::GLGizmoCut3D::render_flip_plane_button(), Slic3r::GUI::GLGizmoCut3D::render_groove_float_input(), Slic3r::GUI::GLGizmoCut3D::render_groove_int_input(), Slic3r::GUI::GLGizmoCut3D::render_groove_two_float_input(), Slic3r::GUI::GLGizmoTextureDisplacement::render_image_adjust_window(), Slic3r::GUI::GLGizmoAssembly::render_input_window_warning(), Slic3r::GUI::GLGizmoCut3D::render_input_window_warning(), Slic3r::GUI::GLGizmoCut3D::render_move_center_input(), Slic3r::GUI::GLGizmoCut3D::render_reset_button(), Slic3r::GUI::GLGizmoCut3D::render_slider_input(), Slic3r::GUI::GLGizmoCut3D::render_slider_two_input(), Slic3r::GUI::GLGizmoCut3D::render_snap_specific_input(), Slic3r::GUI::GLGizmoTextureDisplacement::render_texture_library_popup(), Slic3r::GUI::GLGizmoTextureDisplacement::render_tip_media(), Slic3r::GUI::GLGizmoCut3D::render_tooltip_button(), Slic3r::GUI::GLGizmoFdmSupports::render_tooltip_button(), Slic3r::GUI::GLGizmoFuzzySkin::render_tooltip_button(), Slic3r::GUI::GLGizmoMmuSegmentation::render_tooltip_button(), Slic3r::GUI::GLGizmoPainterBase::render_triangles(), Slic3r::GUI::GLGizmoEmboss::rev_checkbox(), Slic3r::GUI::GLGizmoEmboss::rev_input(), Slic3r::GUI::GLGizmoEmboss::rev_slider(), Slic3r::GUI::GLGizmoEmboss::rev_slider(), Slic3r::GUI::GLGizmoEmboss::rev_slider(), Slic3r::GUI::GLGizmoEmboss::revertible(), Slic3r::GUI::GLGizmoMeasure::show_distance_xyz_ui(), Slic3r::GUI::GLGizmoMeasure::show_face_face_assembly_common(), Slic3r::GUI::GLGizmoMeasure::show_face_face_assembly_senior(), and Slic3r::GUI::GLGizmoMeasure::show_selection_ui().

◆ m_is_advanced_edit_style

bool Slic3r::GUI::GLGizmoEmboss::m_is_advanced_edit_style = false
private

Referenced by draw_window().

◆ m_is_dark_mode

◆ m_is_unknown_font

bool Slic3r::GUI::GLGizmoEmboss::m_is_unknown_font = false
private

◆ m_job_cancel

std::shared_ptr<std::atomic<bool> > Slic3r::GUI::GLGizmoEmboss::m_job_cancel = nullptr
private

◆ m_keep_up

bool Slic3r::GUI::GLGizmoEmboss::m_keep_up = true
private

◆ m_parent

GLCanvas3D& Slic3r::GUI::GLGizmoBase::m_parent
protectedinherited

Referenced by GLGizmoBase(), Slic3r::GUI::GLGizmoCut3D::add_connector(), Slic3r::GUI::GLGizmoTextureDisplacement::add_texture_layer(), Slic3r::GUI::GLGizmoCut3D::apply_color_clip_plane_colors(), Slic3r::GUI::GLGizmoTextureDisplacement::apply_projection_frame(), Slic3r::GUI::GLGizmoSimplify::apply_simplify(), Slic3r::GUI::GLGizmoTextureDisplacement::apply_view_mode(), Slic3r::GUI::GLGizmoBrimEars::auto_generate(), Slic3r::GUI::GLGizmoTextureDisplacement::bake(), Slic3r::GUI::GLGizmoCut3D::bounding_box(), Slic3r::GUI::GLGizmoPainterBase::bounding_box(), Slic3r::GUI::GLGizmoEmboss::calculate_scale(), Slic3r::GUI::GLGizmoSVG::calculate_scale(), Slic3r::GUI::GLGizmoTextureDisplacement::capture_view_projection(), Slic3r::GUI::GLGizmoMove3D::change_cs_by_selection(), Slic3r::GUI::GLGizmoScale3D::change_cs_by_selection(), Slic3r::GUI::GLGizmoEmboss::close(), Slic3r::GUI::GLGizmoSimplify::close(), Slic3r::GUI::GLGizmoSVG::close(), Slic3r::GUI::GLGizmoTextureDisplacement::close_image_adjust(), Slic3r::GUI::GLGizmoEmboss::create_volume(), Slic3r::GUI::GLGizmoEmboss::create_volume(), Slic3r::GUI::GLGizmoSVG::create_volume(), Slic3r::GUI::GLGizmoSVG::create_volume(), Slic3r::GUI::GLGizmoSVG::create_volume(), Slic3r::GUI::GLGizmoSVG::create_volume(), Slic3r::GUI::GLGizmoFlatten::data_changed(), Slic3r::GUI::GLGizmoMeasure::data_changed(), Slic3r::GUI::GLGizmoMove3D::data_changed(), Slic3r::GUI::GLGizmoPainterBase::data_changed(), Slic3r::GUI::GLGizmoRotate3D::data_changed(), Slic3r::GUI::GLGizmoScale3D::data_changed(), Slic3r::GUI::GLGizmoCut3D::delete_selected_connectors(), Slic3r::GUI::GLGizmoEmboss::do_mirror(), do_stop_dragging(), Slic3r::GUI::GLGizmoEmboss::draw_advanced(), Slic3r::GUI::GLGizmoSVG::draw_distance(), Slic3r::GUI::GLGizmoSVG::draw_face_the_camera(), Slic3r::GUI::GLGizmoSVG::draw_filename(), Slic3r::GUI::GLGizmoSVG::draw_mirroring(), Slic3r::GUI::GLGizmoEmboss::draw_model_type(), Slic3r::GUI::GLGizmoSVG::draw_model_type(), Slic3r::GUI::GLGizmoSVG::draw_rotation(), Slic3r::GUI::GLGizmoSVG::draw_size(), Slic3r::GUI::GLGizmoEmboss::draw_style_list(), Slic3r::GUI::GLGizmoEmboss::draw_window(), Slic3r::GUI::GLGizmoTextureDisplacement::ease_wheel_scroll(), Slic3r::GUI::GLGizmoBrimEars::find_single(), Slic3r::GUI::GLGizmoBrimEars::first_layer_slicer(), Slic3r::GUI::GLGizmoMeshBoolean::generate_new_volume(), Slic3r::GUI::GLGizmoPainterBase::get_projected_height_range(), Slic3r::GUI::GLGizmoMove3D::get_tooltip(), Slic3r::GUI::GLGizmoScale3D::get_tooltip(), Slic3r::GUI::GLGizmoBrimEars::gizmo_event(), Slic3r::GUI::GLGizmoMeasure::gizmo_event(), Slic3r::GUI::GLGizmoMeshBoolean::gizmo_event(), Slic3r::GUI::GLGizmoPainterBase::gizmo_event(), GizmoImguiSetNextWIndowPos(), Slic3r::GUI::GLGizmoCut3D::has_valid_groove(), Slic3r::GUI::GLGizmoSimplify::init_model(), Slic3r::GUI::GLGizmoMeasure::init_plane_glmodel(), Slic3r::GUI::GLGizmoFdmSupports::init_print_instance(), Slic3r::GUI::GLGizmoPainterBase::mesh_trafo_matrices(), Slic3r::GUI::GLGizmoTextureDisplacement::move_texture_layer(), Slic3r::GUI::GLGizmoMove3D::on_dragging(), Slic3r::GUI::GLGizmoAssembly::on_is_activable(), Slic3r::GUI::GLGizmoBrimEars::on_is_activable(), Slic3r::GUI::GLGizmoCut3D::on_is_activable(), Slic3r::GUI::GLGizmoFlatten::on_is_activable(), Slic3r::GUI::GLGizmoMeasure::on_is_activable(), Slic3r::GUI::GLGizmoMeshBoolean::on_is_activable(), Slic3r::GUI::GLGizmoMmuSegmentation::on_is_activable(), Slic3r::GUI::GLGizmoMove3D::on_is_activable(), Slic3r::GUI::GLGizmoPainterBase::on_is_activable(), Slic3r::GUI::GLGizmoRotate3D::on_is_activable(), Slic3r::GUI::GLGizmoScale3D::on_is_activable(), Slic3r::GUI::GLGizmoSimplify::on_is_activable(), Slic3r::GUI::GLGizmoTextureDisplacement::on_is_activable(), Slic3r::GUI::GLGizmoTextureDisplacement::on_island_edited(), Slic3r::GUI::GLGizmoCut3D::on_load(), Slic3r::GUI::GLGizmoBrimEars::on_mouse(), Slic3r::GUI::GLGizmoCut3D::on_mouse(), Slic3r::GUI::GLGizmoEmboss::on_mouse(), Slic3r::GUI::GLGizmoFlatten::on_mouse(), Slic3r::GUI::GLGizmoMeasure::on_mouse(), Slic3r::GUI::GLGizmoPainterBase::on_mouse(), Slic3r::GUI::GLGizmoRotate3D::on_mouse(), Slic3r::GUI::GLGizmoScale3D::on_mouse(), Slic3r::GUI::GLGizmoSVG::on_mouse(), Slic3r::GUI::GLGizmoTextureDisplacement::on_mouse_adjust_texture(), Slic3r::GUI::GLGizmoEmboss::on_mouse_change_selection(), Slic3r::GUI::GLGizmoEmboss::on_mouse_for_rotation(), Slic3r::GUI::GLGizmoSVG::on_mouse_for_rotation(), Slic3r::GUI::GLGizmoEmboss::on_mouse_for_translate(), Slic3r::GUI::GLGizmoSVG::on_mouse_for_translate(), Slic3r::GUI::GLGizmoTextureDisplacement::on_mouse_seam(), Slic3r::GUI::GLGizmoFdmSupports::on_opening(), Slic3r::GUI::GLGizmoCut3D::on_register_raycasters_for_picking(), Slic3r::GUI::GLGizmoFlatten::on_register_raycasters_for_picking(), Slic3r::GUI::GLGizmoMove3D::on_register_raycasters_for_picking(), Slic3r::GUI::GLGizmoRotate3D::on_register_raycasters_for_picking(), Slic3r::GUI::GLGizmoScale3D::on_register_raycasters_for_picking(), Slic3r::GUI::GLGizmoBrimEars::on_render(), Slic3r::GUI::GLGizmoCut3D::on_render(), Slic3r::GUI::GLGizmoEmboss::on_render(), Slic3r::GUI::GLGizmoFlatten::on_render(), Slic3r::GUI::GLGizmoMeasure::on_render(), Slic3r::GUI::GLGizmoMeshBoolean::on_render(), Slic3r::GUI::GLGizmoMove3D::on_render(), Slic3r::GUI::GLGizmoRotate::on_render(), Slic3r::GUI::GLGizmoSimplify::on_render(), Slic3r::GUI::GLGizmoSVG::on_render(), Slic3r::GUI::GLGizmoAssembly::on_render_input_window(), Slic3r::GUI::GLGizmoBrimEars::on_render_input_window(), Slic3r::GUI::GLGizmoCut3D::on_render_input_window(), Slic3r::GUI::GLGizmoEmboss::on_render_input_window(), Slic3r::GUI::GLGizmoFdmSupports::on_render_input_window(), Slic3r::GUI::GLGizmoFuzzySkin::on_render_input_window(), Slic3r::GUI::GLGizmoMeasure::on_render_input_window(), Slic3r::GUI::GLGizmoMeshBoolean::on_render_input_window(), Slic3r::GUI::GLGizmoMmuSegmentation::on_render_input_window(), Slic3r::GUI::GLGizmoSeam::on_render_input_window(), Slic3r::GUI::GLGizmoSimplify::on_render_input_window(), Slic3r::GUI::GLGizmoSVG::on_render_input_window(), Slic3r::GUI::GLGizmoTextureDisplacement::on_render_input_window(), Slic3r::GUI::GLGizmoCut3D::on_set_state(), Slic3r::GUI::GLGizmoEmboss::on_set_state(), Slic3r::GUI::GLGizmoMeasure::on_set_state(), Slic3r::GUI::GLGizmoMmuSegmentation::on_set_state(), Slic3r::GUI::GLGizmoPainterBase::on_set_state(), Slic3r::GUI::GLGizmoSimplify::on_set_state(), Slic3r::GUI::GLGizmoSVG::on_set_state(), Slic3r::GUI::GLGizmoEmboss::on_shortcut_key(), Slic3r::GUI::GLGizmoFdmSupports::on_shutdown(), Slic3r::GUI::GLGizmoFuzzySkin::on_shutdown(), Slic3r::GUI::GLGizmoMmuSegmentation::on_shutdown(), Slic3r::GUI::GLGizmoSeam::on_shutdown(), Slic3r::GUI::GLGizmoTextureDisplacement::on_shutdown(), Slic3r::GUI::GLGizmoMove3D::on_start_dragging(), Slic3r::GUI::GLGizmoRotate::on_start_dragging(), Slic3r::GUI::GLGizmoEmboss::on_stop_dragging(), Slic3r::GUI::GLGizmoMove3D::on_stop_dragging(), Slic3r::GUI::GLGizmoRotate3D::on_stop_dragging(), Slic3r::GUI::GLGizmoScale3D::on_stop_dragging(), Slic3r::GUI::GLGizmoSVG::on_stop_dragging(), Slic3r::GUI::GLGizmoBrimEars::on_unregister_raycasters_for_picking(), Slic3r::GUI::GLGizmoCut3D::on_unregister_raycasters_for_picking(), Slic3r::GUI::GLGizmoFlatten::on_unregister_raycasters_for_picking(), Slic3r::GUI::GLGizmoMove3D::on_unregister_raycasters_for_picking(), Slic3r::GUI::GLGizmoRotate3D::on_unregister_raycasters_for_picking(), Slic3r::GUI::GLGizmoScale3D::on_unregister_raycasters_for_picking(), Slic3r::GUI::GLGizmoTextureDisplacement::on_uv_command(), Slic3r::GUI::GLGizmoTextureDisplacement::panel_tooltip(), Slic3r::GUI::GLGizmoCut3D::perform_cut(), Slic3r::GUI::GLGizmoEmboss::process(), Slic3r::GUI::GLGizmoSVG::process(), Slic3r::GUI::GLGizmoCut3D::process_contours(), Slic3r::GUI::GLGizmoCut3D::process_cut_line(), Slic3r::GUI::GLGizmoTextureDisplacement::queue_prepare(), Slic3r::GUI::GLGizmoTextureDisplacement::queue_preview_job(), Slic3r::GUI::GLGizmoBrimEars::register_single_mesh_pick(), Slic3r::GUI::GLGizmoMeasure::register_single_mesh_pick(), Slic3r::GUI::GLGizmoEmboss::reinit_text_lines(), Slic3r::GUI::GLGizmoMmuSegmentation::remap_filament_assignments(), Slic3r::GUI::GLGizmoTextureDisplacement::remove_texture_layer(), Slic3r::GUI::GLGizmoTextureDisplacement::render_adjust_texture_gizmo(), Slic3r::GUI::GLGizmoMove3D::render_align_preview(), Slic3r::GUI::GLGizmoAssembly::render_assembly_mode_combo(), render_combo(), Slic3r::GUI::GLGizmoCut3D::render_connectors_input_window(), Slic3r::GUI::GLGizmoPainterBase::render_cursor(), Slic3r::GUI::GLGizmoPainterBase::render_cursor_circle(), Slic3r::GUI::GLGizmoPainterBase::render_cursor_height_range(), Slic3r::GUI::GLGizmoCut3D::render_cut_mode_combo(), Slic3r::GUI::GLGizmoCut3D::render_cut_plane_input_window(), Slic3r::GUI::GLGizmoMeasure::render_dimensioning(), Slic3r::GUI::GLGizmoMeasure::render_follows_cursor(), Slic3r::GUI::GLGizmoPainterBase::render_follows_cursor(), Slic3r::GUI::GLGizmoTextureDisplacement::render_image_adjust_window(), render_input_window(), Slic3r::GUI::GLGizmoTextureDisplacement::render_island_overlay(), Slic3r::GUI::GLGizmoTextureDisplacement::render_paint_overlay(), Slic3r::GUI::GLGizmoTextureDisplacement::render_painted_colors(), Slic3r::GUI::GLGizmoFdmSupports::render_painter_gizmo(), Slic3r::GUI::GLGizmoFuzzySkin::render_painter_gizmo(), Slic3r::GUI::GLGizmoMmuSegmentation::render_painter_gizmo(), Slic3r::GUI::GLGizmoSeam::render_painter_gizmo(), Slic3r::GUI::GLGizmoTextureDisplacement::render_painter_gizmo(), Slic3r::GUI::GLGizmoTextureDisplacement::render_preview_mesh(), Slic3r::GUI::GLGizmoTextureDisplacement::render_seam_overlay(), Slic3r::GUI::GLGizmoTextureDisplacement::render_shaded_preview_mesh(), Slic3r::GUI::GLGizmoTextureDisplacement::render_subdivide_preview(), Slic3r::GUI::GLGizmoTextureDisplacement::render_texture_library_popup(), Slic3r::GUI::GLGizmoTextureDisplacement::render_tip_media(), Slic3r::GUI::GLGizmoCut3D::render_tooltip_button(), Slic3r::GUI::GLGizmoFdmSupports::render_tooltip_button(), Slic3r::GUI::GLGizmoFuzzySkin::render_tooltip_button(), Slic3r::GUI::GLGizmoMmuSegmentation::render_tooltip_button(), Slic3r::GUI::GLGizmoPainterBase::render_triangles(), Slic3r::GUI::GLGizmoTextureDisplacement::render_uvcheck_mesh(), Slic3r::GUI::GLGizmoTextureDisplacement::render_wireframe_overlay(), Slic3r::GUI::GLGizmoSimplify::request_rerender(), Slic3r::GUI::GLGizmoCut3D::reset_cut_plane(), Slic3r::GUI::GLGizmoEmboss::reset_to_default_style(), Slic3r::GUI::GLGizmoTextureDisplacement::run_stage_debug(), Slic3r::GUI::GLGizmoFdmSupports::run_thread(), Slic3r::GUI::GLGizmoTextureDisplacement::run_uv_command(), Slic3r::GUI::GLGizmoTextureDisplacement::seam_edge_at(), Slic3r::GUI::GLGizmoTextureDisplacement::seam_vertex_at(), Slic3r::GUI::GLGizmoFdmSupports::select_facets_by_angle(), Slic3r::GUI::GLGizmoTextureDisplacement::select_visible_faces(), Slic3r::GUI::GLGizmoTextureDisplacement::select_whole_model(), Slic3r::GUI::GLGizmoCut3D::set_connectors_editing(), Slic3r::GUI::GLGizmoMeasure::set_distance(), Slic3r::GUI::GLGizmoTextureDisplacement::set_layer_texture(), Slic3r::GUI::GLGizmoMeasure::set_parallel_distance(), Slic3r::GUI::GLGizmoMeasure::set_to_around_center_of_faces(), Slic3r::GUI::GLGizmoMeasure::set_to_parallel(), Slic3r::GUI::GLGizmoMeasure::set_to_reverse_rotation(), Slic3r::GUI::GLGizmoEmboss::set_volume_by_selection(), Slic3r::GUI::GLGizmoSVG::set_volume_by_selection(), Slic3r::GUI::GLGizmoCut3D::set_volumes_picking_state(), Slic3r::GUI::GLGizmoTextureDisplacement::show_debug_stage(), Slic3r::GUI::GLGizmoTextureDisplacement::show_projector(), Slic3r::GUI::GLGizmoTextureDisplacement::smooth_model(), Slic3r::GUI::GLGizmoTextureDisplacement::subdivide_model(), Slic3r::GUI::GLGizmoCut3D::toggle_model_objects_visibility(), Slic3r::GUI::GLGizmoCut3D::transformed_bounding_box(), Slic3r::GUI::GLGizmoBrimEars::unproject_on_mesh(), Slic3r::GUI::GLGizmoCut3D::update_bb(), Slic3r::GUI::GLGizmoBrimEars::update_cache_radius(), Slic3r::GUI::GLGizmoCut3D::update_clipper(), Slic3r::GUI::GLGizmoPainterBase::update_contours(), Slic3r::GUI::GLGizmoScale3D::update_grabbers_data(), Slic3r::GUI::GLGizmoTextureDisplacement::update_image_adjust_preview(), Slic3r::GUI::GLGizmoBrimEars::update_model_object(), Slic3r::GUI::GLGizmoFdmSupports::update_model_object(), Slic3r::GUI::GLGizmoFuzzySkin::update_model_object(), Slic3r::GUI::GLGizmoMmuSegmentation::update_model_object(), Slic3r::GUI::GLGizmoSeam::update_model_object(), Slic3r::GUI::GLGizmoTextureDisplacement::update_model_object(), Slic3r::GUI::GLGizmoPainterBase::update_raycast_cache(), Slic3r::GUI::GLGizmoBrimEars::update_raycasters(), use_grabbers(), Slic3r::GUI::GLGizmoEmboss::volume_transformation_changed(), Slic3r::GUI::GLGizmoSVG::volume_transformation_changed(), and Slic3r::GUI::GLGizmoEmboss::volume_transformation_changing().

◆ m_raycast_manager

RaycastManager Slic3r::GUI::GLGizmoEmboss::m_raycast_manager
private

◆ m_rotate_gizmo

◆ m_rotate_start_angle

std::optional<float> Slic3r::GUI::GLGizmoEmboss::m_rotate_start_angle
private

◆ m_scale_depth

std::optional<float> Slic3r::GUI::GLGizmoEmboss::m_scale_depth
private

Referenced by calculate_scale(), and draw_depth().

◆ m_scale_height

std::optional<float> Slic3r::GUI::GLGizmoEmboss::m_scale_height
private

◆ m_shortcut

◆ m_shortcuts

std::vector<std::pair<wxString, wxString> > Slic3r::GUI::GLGizmoEmboss::m_shortcuts
private

Referenced by draw_window(), and on_init().

◆ m_sprite_id

unsigned int Slic3r::GUI::GLGizmoBase::m_sprite_id
protectedinherited

Referenced by GLGizmoBase(), and get_sprite_id().

◆ m_state

◆ m_style_manager

◆ m_surface_drag

std::optional<SurfaceDrag> Slic3r::GUI::GLGizmoEmboss::m_surface_drag
private

◆ m_text

std::string Slic3r::GUI::GLGizmoEmboss::m_text
private

◆ m_text_contain_unknown_glyph

bool Slic3r::GUI::GLGizmoEmboss::m_text_contain_unknown_glyph = false
private

Referenced by draw_text_input().

◆ m_text_lines

◆ m_volume

◆ m_volume_id

ObjectID Slic3r::GUI::GLGizmoEmboss::m_volume_id
private

The documentation for this class was generated from the following files: