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

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

Collaboration diagram for Slic3r::GUI::ImGuiWrapper:

Classes

struct  LastSliderStatus

Public Member Functions

 ImGuiWrapper ()
 ~ImGuiWrapper ()
void read_glsl_version ()
void set_language (const std::string &language)
void set_display_size (float w, float h)
void set_scaling (float font_size, float scale_style, float scale_both)
bool update_mouse_data (wxMouseEvent &evt)
bool update_key_data (wxKeyEvent &evt)
float get_font_size () const
float get_style_scaling () const
const ImWchar * get_glyph_ranges () const
void new_frame ()
ImDrawData * end_frame ()
void render (ImDrawData *draw_data)
float scaled (float x) const
ImVec2 scaled (float x, float y) const
ImVec2 calc_button_size (const wxString &text, const ImVec2 &button_size=ImVec2(0, 0)) const
float find_widest_text (std::vector< wxString > &text_list)
ImVec2 get_item_spacing () const
float get_slider_float_height () const
const LastSliderStatus & get_last_slider_status () const
LastSliderStatus & get_last_slider_status ()
void set_next_window_pos (float x, float y, int flag, float pivot_x=0.0f, float pivot_y=0.0f)
void set_next_window_bg_alpha (float alpha)
void set_next_window_size (float x, float y, ImGuiCond cond)
bool bbl_combo_with_filter (const char *label, const std::string &preview_value, const std::vector< std::string > &all_items, std::vector< int > *filtered_items_idx, bool *is_filtered, float item_height=0.0f)
bool bbl_input_double (const wxString &label, const double &value, const std::string &format="%0.2f")
bool bbl_slider_float (const std::string &label, float *v, float v_min, float v_max, const char *format="%.3f", float power=1.0f, bool clamp=true, const wxString &tooltip={})
bool bbl_slider_float_style (const std::string &label, float *v, float v_min, float v_max, const char *format="%.3f", float power=1.0f, bool clamp=true, const wxString &tooltip={})
bool begin (const std::string &name, int flags=0)
bool begin (const wxString &name, int flags=0)
bool begin (const std::string &name, bool *close, int flags=0)
bool begin (const wxString &name, bool *close, int flags=0)
void end ()
bool button (const wxString &label, const wxString &tooltip={})
bool bbl_button (const wxString &label, const wxString &tooltip={})
bool button (const wxString &label, float width, float height)
bool button (const wxString &label, const ImVec2 &size, bool enable)
bool glyph_button (wchar_t icon_char, ImVec2 icon_size)
bool radio_button (const wxString &label, bool active)
bool input_double (const std::string &label, const double &value, const std::string &format="%.3f")
bool input_double (const wxString &label, const double &value, const std::string &format="%.3f")
bool input_vec3 (const std::string &label, const Vec3d &value, float width, const std::string &format="%.3f")
bool checkbox (const wxString &label, bool &value)
bool bbl_checkbox (const wxString &label, bool &value)
bool bbl_radio_button (const char *label, bool active)
bool bbl_sliderin (const char *label, int *v, int v_min, int v_max, const char *format="%d", ImGuiSliderFlags flags=0)
void warning_text (const char *all_text)
void warning_text (const wxString &all_text)
void text_wrapped (const char *label, float wrap_width)
void text_wrapped (const std::string &label, float wrap_width)
void text_wrapped (const wxString &label, float wrap_width)
void tooltip (const char *label, float wrap_width)
void tooltip (const std::string &label, float wrap_width)
void tooltip (const wxString &label, float wrap_width)
void filament_group (const std::string &filament_type, const char *hex_color, unsigned char filament_id, float align_width)
std::tuple< ImVec2, bool > calculate_filament_group_text_size (const std::string &filament_type)
void sub_title (const std::string &label)
bool slider_float (const char *label, float *v, float v_min, float v_max, const char *format="%.3f", float power=1.0f, bool clamp=true)
bool slider_float (const std::string &label, float *v, float v_min, float v_max, const char *format="%.3f", float power=1.0f, bool clamp=true)
bool slider_float (const wxString &label, float *v, float v_min, float v_max, const char *format="%.3f", float power=1.0f, bool clamp=true)
bool image_button (ImTextureID user_texture_id, const ImVec2 &size, const ImVec2 &uv0=ImVec2(0.0, 0.0), const ImVec2 &uv1=ImVec2(1.0, 1.0), int frame_padding=-1, const ImVec4 &bg_col=ImVec4(0.0, 0.0, 0.0, 0.0), const ImVec4 &tint_col=ImVec4(1.0, 1.0, 1.0, 1.0), ImGuiButtonFlags flags=0)
bool image_button (const wchar_t icon, const wxString &tooltip=L"")
bool combo (const std::string &label, const std::vector< std::string > &options, int &selection, ImGuiComboFlags flags=0, float label_width=0.0f, float item_width=0.0f)
bool combo (const wxString &label, const std::vector< std::string > &options, int &selection, ImGuiComboFlags flags=0, float label_width=0.0f, float item_width=0.0f)
bool undo_redo_list (const ImVec2 &size, const bool is_undo, bool(*items_getter)(const bool, int, const char **), int &hovered, int &selected, int &mouse_wheel)
void search_list (const ImVec2 &size, bool(*items_getter)(int, const char **label, const char **tooltip), char *search_str, Search::OptionViewParameters &view_params, int &selected, bool &edited, int &mouse_wheel, bool is_localized)
void bold_text (const std::string &str)
void title (const std::string &str)
void title (const std::string &str, bool suppress_seperator)
const std::vector< std::string > get_fonts_names () const
bool push_bold_font ()
bool pop_bold_font ()
bool push_font_by_name (std::string font_name)
bool pop_font_by_name (std::string font_name)
void load_fonts_texture ()
void destroy_fonts_texture ()
void disabled_begin (bool disabled)
void disabled_end ()
bool want_mouse () const
bool want_keyboard () const
bool want_text_input () const
bool want_any_input () const
bool text_input_active () const
bool modal_popup_open () const
bool popup_open () const
void close_top_popup ()
bool owns_key (const KeyChord &chord) const
bool item_held () const
bool owns_keyboard () const
bool claim_key_event (const wxKeyEvent &evt)
void forget_key_claims ()
bool slider_optional_float (const char *label, std::optional< float > &v, float v_min, float v_max, const char *format="%.3f", float power=1.0f, bool clamp=true, const wxString &tooltip={}, bool show_edit_btn=true, float def_val=.0f)
bool slider_optional_int (const char *label, std::optional< int > &v, int v_min, int v_max, const char *format="%.3f", float power=1.0f, bool clamp=true, const wxString &tooltip={}, bool show_edit_btn=true, int def_val=0)
bool requires_extra_frame () const
void set_requires_extra_frame ()
void reset_requires_extra_frame ()
void request_frames_while_held ()
void disable_background_fadeout_animation ()
ImFontAtlasCustomRect * GetTextureCustomRect (const wchar_t &tex_id)
bool display_initialized () const

Static Public Member Functions

static ImGuiID draw_data_signature (const ImDrawData *draw_data)
static ImVec2 calc_text_size (std::string_view text, bool hide_text_after_double_hash=false, float wrap_width=-1.0f)
 Extend ImGui::CalcTextSize to use string_view.
static ImVec2 calc_text_size (const std::string &text, bool hide_text_after_double_hash=false, float wrap_width=-1.0f)
static ImVec2 calc_text_size (const wxString &text, bool hide_text_after_double_hash=false, float wrap_width=-1.0f)
static ImVec4 to_ImVec4 (const ColorRGB &color)
static void text (const char *label)
static void text (const std::string &label)
static void text (const wxString &label)
static void text_colored (const ImVec4 &color, const char *label)
static void text_colored (const ImVec4 &color, const std::string &label)
static void text_colored (const ImVec4 &color, const wxString &label)
static bool input_optional_int (const char *label, std::optional< int > &v, int step=1, int step_fast=100, ImGuiInputTextFlags flags=0, int def_val=0)
static bool input_optional_float (const char *label, std::optional< float > &v, float step=0.0f, float step_fast=0.0f, const char *format="%.3f", ImGuiInputTextFlags flags=0, float def_val=.0f)
static bool drag_optional_float (const char *label, std::optional< float > &v, float v_speed, float v_min, float v_max, const char *format, float power, float def_val=.0f)
static std::optional< ImVec2 > change_window_position (const char *window_name, bool try_to_fix)
 Change position of imgui window.
static void left_inputs ()
 Use ImGui internals to unactivate (lose focus) in input. When input is activ it can't change value by application.
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: Calculation for actual acive imgui font.
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.
static ImVec2 suggest_location (const ImVec2 &dialog_size, const Slic3r::Polygon &interest, const ImVec2 &canvas_size)
 Suggest loacation of dialog window, dependent on actual visible thing on platter like Gizmo menu size, notifications, ... To be near of polygon interest and not over it. And also not out of visible area.
static void draw (const Polygon &polygon, ImDrawList *draw_list=ImGui::GetOverlayDrawList(), ImU32 color=ImGui::GetColorU32(COL_ORANGE_LIGHT), float thickness=3.f)
 Visualization of polygon.
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.
static void draw_gradient_ramp (ImDrawList *draw_list, const ImVec2 &top_left, const ImVec2 &bottom_right, const std::vector< wxColour > &ramp)
 Fill a rect with a filament gradient ramp, one band per pixel row, ramp.front() along the bottom edge. Bands rather than one interpolated rect, because the ramp follows the slot's gradient curve and ImGui's corner interpolation could only draw a straight fade.
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).
static bool is_chars_in_ranges (const ImWchar *ranges, const char *chars_ptr)
static bool is_char_in_ranges (const ImWchar *ranges, unsigned int letter)
static ImU32 to_ImU32 (const ColorRGBA &color)
static ImVec4 to_ImVec4 (const ColorRGBA &color)
static ColorRGBA from_ImU32 (const ImU32 &color)
static ColorRGBA from_ImVec4 (const ImVec4 &color)
static void on_change_color_mode (bool is_dark)
static void push_toolbar_style (const float scale)
static void pop_toolbar_style ()
static void push_menu_style (const float scale)
static void pop_menu_style ()
static void push_common_window_style (const float scale)
static void pop_common_window_style ()
static void push_confirm_button_style ()
static void pop_confirm_button_style ()
static void push_cancel_button_style ()
static void pop_cancel_button_style ()
static void push_button_disable_style ()
static void pop_button_disable_style ()
static void push_combo_style (const float scale)
static void pop_combo_style ()
static void push_radio_style (const float scale)
static void pop_radio_style ()

Static Public Attributes

static const ImVec4 COL_GREY_DARK = { 0.333f, 0.333f, 0.333f, 1.0f }
static const ImVec4 COL_GREY_LIGHT = { 0.4f, 0.4f, 0.4f, 1.0f }
static const ImVec4 COL_ORANGE_DARK = { 0.757f, 0.404f, 0.216f, 1.0f }
static const ImVec4 COL_ORANGE_LIGHT = to_ImVec4(ColorRGBA::ORANGE())
static const ImVec4 COL_WINDOW_BACKGROUND = { 0.1f, 0.1f, 0.1f, 0.8f }
static const ImVec4 COL_BUTTON_BACKGROUND = COL_ORANGE_DARK
static const ImVec4 COL_BUTTON_HOVERED = COL_ORANGE_LIGHT
static const ImVec4 COL_BUTTON_ACTIVE = COL_BUTTON_HOVERED
static const ImVec4 COL_RED = ImVec4(1.0f, 0.0f, 0.0f, 1.0f)
static const ImVec4 COL_GREEN = ImVec4(0.0f, 1.0f, 0.0f, 1.0f)
static const ImVec4 COL_BLUE = ImVec4(0.0f, 0.0f, 1.0f, 1.0f)
static const ImVec4 COL_BLUE_LIGHT = ImVec4(0.122f, 0.557f, 0.918f, 1.0f)
static const ImVec4 COL_GREEN_LIGHT = { 0.f, 156 / 255.f, 136 / 255.f, 0.25f }
static const ImVec4 COL_HOVER = { 0.933f, 0.933f, 0.933f, 1.0f }
static const ImVec4 COL_ACTIVE = { 0.675f, 0.675f, 0.675f, 1.0f }
static const ImVec4 COL_TITLE_BG = { 0.745f, 0.745f, 0.745f, 1.0f }
static const ImVec4 COL_WINDOW_BG = { 1.000f, 1.000f, 1.000f, 1.0f }
static const ImVec4 COL_WINDOW_BG_DARK = { 45 / 255.f, 45 / 255.f, 49 / 255.f, 1.f }
static const ImVec4 COL_TOOLBAR_BG = { 250 / 255.f, 250 / 255.f, 250 / 255.f, 1.f }
static const ImVec4 COL_TOOLBAR_BG_DARK = { 57 / 255.f, 60 / 255.f, 66 / 255.f, 1.f }
static const ImVec4 COL_SEPARATOR = { 0.93f, 0.93f, 0.93f, 1.0f }
static const ImVec4 COL_SEPARATOR_DARK = { 0.24f, 0.24f, 0.27f, 1.0f }
static const ImVec4 COL_ORCA = to_ImVec4(ColorRGBA::ORCA())
static const ImVec4 COL_ORCA_DARK = { 0.f , 103 / 255.f, 91 / 255.f, 1.f }
static const ImVec4 COL_ORCA_HOVER = { 38 / 255.f, 166 / 255.f, 154 / 255.f, 1.f }
static const ImVec4 COL_ORCA_HOVER_DARK = { 0.f , 129 / 255.f, 114 / 255.f, 1.f }
static const ImVec4 COL_MODIFIED = { 253.f / 255.f, 111.f / 255.f, 40.f / 255.f, 1}
static const ImVec4 COL_WARNING = to_ImVec4(ColorRGB::WARNING())
static int TOOLBAR_WINDOW_FLAGS

Private Member Functions

void init_font (bool compress)
void init_input ()
void init_style ()
void render_draw_data (ImDrawData *draw_data)
void destroy_font ()
std::vector< unsigned char > load_svg (const std::string &bitmap_name, unsigned target_width, unsigned target_height, unsigned *outwidth, unsigned *outheight)

Static Private Member Functions

static const char * clipboard_get (void *user_data)
static void clipboard_set (void *user_data, const char *text)

Private Attributes

const ImWchar * m_glyph_ranges { nullptr }
const ImWchar * m_glyph_basic_ranges { nullptr }
bool m_font_cjk { false }
bool m_is_korean { false }
float m_font_size { 18.0 }
unsigned m_font_texture { 0 }
unsigned m_font_another_texture { 0 }
float m_style_scaling { 1.0 }
unsigned m_mouse_buttons { 0 }
bool m_disabled { false }
bool m_new_frame_open { false }
std::chrono::steady_clock::time_point m_last_frame_time {}
std::map< wchar_t, int > m_custom_glyph_rects_ids
std::string m_clipboard_text
std::map< int, bool > m_key_claims
std::optional< bool > m_char_claim
LastSliderStatus m_last_slider_status
ImFont * default_font = nullptr
ImFont * bold_font = nullptr
std::map< std::string, ImFont * > im_fonts_map
std::vector< std::string > m_fonts_names

Detailed Description

Constructor & Destructor Documentation

◆ ImGuiWrapper()

Slic3r::GUI::ImGuiWrapper::ImGuiWrapper ( )
378{
379 ImGui::CreateContext();
380
381 init_input();
382 init_style();
383
384 ImGui::GetIO().IniFilename = nullptr;
385}
void init_style()
Definition ImGuiWrapper.cpp:3257
void init_input()
Definition ImGuiWrapper.cpp:3212

References init_input(), and init_style().

Referenced by clipboard_get().

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

◆ ~ImGuiWrapper()

Slic3r::GUI::ImGuiWrapper::~ImGuiWrapper ( )
388{
389 //destroy_fonts_texture();
390 destroy_font();
391 ImGui::DestroyContext();
392}
void destroy_font()
Definition ImGuiWrapper.cpp:3511

References destroy_font().

Here is the call graph for this function:

Member Function Documentation

◆ bbl_button()

bool Slic3r::GUI::ImGuiWrapper::bbl_button ( const wxString & label,
const wxString & tooltip = {} )
970{
971 auto label_utf8 = into_u8(label);
972 const bool ret = ImGui::BBLButton(label_utf8.c_str());
973
974 if (!tooltip.IsEmpty() && ImGui::IsItemHovered()) {
975 const float max_tooltip_width = ImGui::GetFontSize() * 20.0f;
976 this->tooltip(tooltip, max_tooltip_width);
977 }
978
979 return ret;
980}
void tooltip(const char *label, float wrap_width)
Definition ImGuiWrapper.cpp:1191
std::string into_u8(const wxString &str)
Definition GUI.cpp:549

References Slic3r::GUI::into_u8(), and tooltip().

Referenced by Slic3r::GUI::IMSlider::render_go_to_layer_dialog(), and Slic3r::GUI::IMSlider::render_input_custom_gcode().

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

◆ bbl_checkbox()

bool Slic3r::GUI::ImGuiWrapper::bbl_checkbox ( const wxString & label,
bool & value )
1094{
1095 bool result;
1096 bool b_value = value;
1097 if (b_value) {
1098 ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(0.00f, 0.59f, 0.53f, 1.00f));
1099 ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, ImVec4(0.00f, 0.59f, 0.53f, 1.00f));
1100 ImGui::PushStyleColor(ImGuiCol_FrameBgActive, ImVec4(0.00f, 0.59f, 0.53f, 1.00f));
1101 }
1102 auto label_utf8 = into_u8(label);
1103 result = ImGui::BBLCheckbox(label_utf8.c_str(), &value);
1104
1105 if (b_value) { ImGui::PopStyleColor(3);}
1106 return result;
1107}

References Slic3r::GUI::into_u8().

Referenced by Slic3r::GUI::GLCanvas3D::_render_arrange_menu(), Slic3r::GUI::GizmoObjectManipulation::do_render_scale_input_window(), Slic3r::GUI::Mouse3DController::render_settings_dialog(), and Slic3r::GUI::GLCanvas3D::LayersEditing::render_variable_layer_height_dialog().

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

◆ bbl_combo_with_filter()

bool Slic3r::GUI::ImGuiWrapper::bbl_combo_with_filter ( const char * label,
const std::string & preview_value,
const std::vector< std::string > & all_items,
std::vector< int > * filtered_items_idx,
bool * is_filtered,
float item_height = 0.0f )
747{
748 ImGuiContext& g = *GImGui;
749 const ImGuiStyle& style = g.Style;
750 ImGuiWindow* window = ImGui::GetCurrentWindow();
751 if (window->SkipItems)
752 return false;
753
754 static char pattern_buffer[256] = { 0 };
755 auto simple_match = [](const char* pattern, const char* str) {
756 wxString sub_str = wxString::FromUTF8(pattern).Lower();
757 wxString main_str = wxString::FromUTF8(str).Lower();
758 return main_str.Find(sub_str);
759 };
760
761 bool is_filtering = false;
762 bool is_new_open = false;
763
764 float sz = ImGui::GetFrameHeight();
765 ImVec2 arrow_size(sz, sz);
766 ImVec2 CursorPos = window->DC.CursorPos;
767 const ImRect arrow_bb(CursorPos, CursorPos + arrow_size);
768
769 float ButtonTextAlignX = g.Style.ButtonTextAlign.x;
770 g.Style.ButtonTextAlign.x = 0;
771 ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, { sz, style.FramePadding.y});
772 ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImGui::GetStyleColorVec4(ImGuiCol_ButtonHovered));
773 if (button(preview_value + label, ImGui::CalcItemWidth(), 0))
774 {
775 ImGui::OpenPopup(label);
776 is_new_open = true;
777 }
778 g.Style.ButtonTextAlign.x = ButtonTextAlignX;
779 ImGui::PopStyleVar();
780 ImGui::PopStyleColor();
781 ImGui::BBLRenderArrow(window->DrawList, arrow_bb.Min + ImVec2(ImMax(0.0f, (arrow_size.x - g.FontSize) * 0.5f), ImMax(0.0f, (arrow_size.y - g.FontSize) * 0.5f)), ImGui::GetColorU32(ImGuiCol_Text), ImGuiDir_Down);
782
783 if (is_new_open)
784 memset(pattern_buffer, 0, IM_ARRAYSIZE(pattern_buffer));
785
786 float item_rect_width = ImGui::GetItemRectSize().x;
787 float item_rect_height = item_height ? item_height : ImGui::GetItemRectSize().y;
788 ImGui::SetNextWindowPos({ CursorPos.x, ImGui::GetItemRectMax().y + 4 * m_style_scaling });
789 ImGui::SetNextWindowSize({ item_rect_width, 0 });
790 if (ImGui::BeginPopup(label))
791 {
792 ImGuiWindow* popup_window = ImGui::GetCurrentWindow();
793
794 ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0));
795
796 ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(8.0f * m_style_scaling, item_rect_height - g.FontSize) * 0.5f);
797 wchar_t ICON_SEARCH = *pattern_buffer != '\0' ? ImGui::TextSearchCloseIcon : ImGui::TextSearchIcon;
798 const ImVec2 label_size = ImGui::CalcTextSize(into_u8(ICON_SEARCH).c_str(), nullptr, true);
799 const ImVec2 search_icon_pos(ImGui::GetItemRectMax().x - label_size.x, popup_window->DC.CursorPos.y + style.FramePadding.y);
800 ImGui::RenderText(search_icon_pos, into_u8(ICON_SEARCH).c_str());
801
802 auto temp = popup_window->DC.CursorPos;
803 popup_window->DC.CursorPos = search_icon_pos;
804 ImGui::PushStyleColor(ImGuiCol_Button, {0, 0, 0, 0});
805 ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImGui::GetStyleColorVec4(ImGuiCol_Button));
806 ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImGui::GetStyleColorVec4(ImGuiCol_Button));
807 ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImGui::GetStyleColorVec4(ImGuiCol_Button));
808 ImGui::PushStyleColor(ImGuiCol_Border, { 0, 0, 0, 0 });
809 if (button("##invisible_clear_button", label_size.x, label_size.y))
810 {
811 if (*pattern_buffer != '\0')
812 memset(pattern_buffer, 0, IM_ARRAYSIZE(pattern_buffer));
813 }
814 ImGui::PopStyleColor(5);
815 popup_window->DC.CursorPos = temp;
816
817
818 ImGui::PushItemWidth(item_rect_width);
819 if (is_new_open)
820 ImGui::SetKeyboardFocusHere();
821 ImGui::InputText("##bbl_combo_with_filter_inputText", pattern_buffer, sizeof(pattern_buffer));
822 ImGui::PopItemWidth();
823 ImGui::PopStyleVar();
824
825 if (*pattern_buffer != '\0')
826 is_filtering = true;
827
828 if (is_filtering)
829 {
830 std::vector<std::pair<int, int> > filtered_items_with_priority;// std::pair<index, priority>
831 for (int i = 0; i < all_items.size(); i++)
832 {
833 int priority = simple_match(pattern_buffer, all_items[i].c_str());
834 if (priority != wxNOT_FOUND)
835 filtered_items_with_priority.push_back({ i, priority });
836 }
837 std::sort(filtered_items_with_priority.begin(), filtered_items_with_priority.end(), [](const std::pair<int, int>& a, const std::pair<int, int>& b) {return (b.second > a.second); });
838 for (auto item : filtered_items_with_priority)
839 {
840 filtered_items_idx->push_back(item.first);
841 }
842 }
843
844 *is_filtered = is_filtering;
845
846 popup_window->DC.CursorPos.y -= 1 * m_style_scaling;
847 ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(1.0f, 1.0f) * m_style_scaling);
848 if (ImGui::BeginListBox("##bbl_combo_with_filter_listBox", { item_rect_width, item_rect_height * 7.75f})) {
849 ImGui::PopStyleVar(2);
850 return true;
851 }
852 else
853 {
854 ImGui::PopStyleVar(2);
855 ImGui::EndPopup();
856 return false;
857 }
858 }
859 else
860 return false;
861}
struct IMGUI_API ImRect
Definition IMSlider.hpp:19
#define style
Definition WipeTowerDialog.cpp:101
float m_style_scaling
Definition ImGuiWrapper.hpp:68
bool button(const wxString &label, const wxString &tooltip={})
Definition ImGuiWrapper.cpp:956

References button(), ImRect, Slic3r::GUI::into_u8(), m_style_scaling, and style.

Here is the call graph for this function:

◆ bbl_input_double()

bool Slic3r::GUI::ImGuiWrapper::bbl_input_double ( const wxString & label,
const double & value,
const std::string & format = "%0.2f" )
864{
865 //return ImGui::InputDouble(label.c_str(), const_cast<double *>(&value), 0.0f, 0.0f, format.c_str(), ImGuiInputTextFlags_CharsDecimal);
866 return ImGui::InputDouble(label.c_str(), const_cast<double *>(&value), 0.0f, 0.0f, format.c_str(), ImGuiInputTextFlags_CharsDecimal);
867}
std::string format(const char *fmt, TArgs &&... args)
Definition format.hpp:36

References Slic3r::GUI::format().

Here is the call graph for this function:

◆ bbl_radio_button()

bool Slic3r::GUI::ImGuiWrapper::bbl_radio_button ( const char * label,
bool active )
1110{
1111 bool result;
1112 bool b_value = active;
1113 if (b_value) {
1114 ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(0.00f, 0.59f, 0.53f, 1.00f));
1115 ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, ImVec4(0.00f, 0.59f, 0.53f, 1.00f));
1116 ImGui::PushStyleColor(ImGuiCol_FrameBgActive, ImVec4(0.00f, 0.59f, 0.53f, 1.00f));
1117 }
1118 result = ImGui::BBLRadioButton(label,active);
1119 if (b_value) { ImGui::PopStyleColor(3); }
1120 return result;
1121}

◆ bbl_slider_float()

bool Slic3r::GUI::ImGuiWrapper::bbl_slider_float ( const std::string & label,
float * v,
float v_min,
float v_max,
const char * format = "%.3f",
float power = 1.0f,
bool clamp = true,
const wxString & tooltip = {} )
886{
887
888 const float max_tooltip_width = ImGui::GetFontSize() * 20.0f;
889
890 // let the label string start with "##" to hide the automatic label from ImGui::SliderFloat()
891 bool label_visible = !boost::algorithm::istarts_with(label, "##");
892 std::string str_label = label_visible ? std::string("##") + std::string(label) : std::string(label);
893
894 // removes 2nd evenience of "##", if present
895 std::string::size_type pos = str_label.find("##", 2);
896 if (pos != std::string::npos)
897 str_label = str_label.substr(0, pos) + str_label.substr(pos + 2);
898
899 bool ret = ImGui::BBLSliderFloat(str_label.c_str(), v, v_min, v_max, format, power);
900
901 m_last_slider_status.hovered = ImGui::IsItemHovered();
902 m_last_slider_status.edited = ImGui::IsItemEdited();
903 m_last_slider_status.clicked = ImGui::IsItemClicked();
904 m_last_slider_status.deactivated_after_edit = ImGui::IsItemDeactivatedAfterEdit();
905
906 if (!tooltip.empty() && ImGui::IsItemHovered())
907 this->tooltip(into_u8(tooltip).c_str(), max_tooltip_width);
908
909 if (clamp)
910 *v = std::clamp(*v, v_min, v_max);
911
912 const ImGuiStyle& style = ImGui::GetStyle();
913
914 if (label_visible) {
915 // if the label is visible, hide the part of it that should be hidden
916 std::string out_label = std::string(label);
917 std::string::size_type pos = out_label.find("##");
918 if (pos != std::string::npos)
919 out_label = out_label.substr(0, pos);
920
921 ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, { 1, style.ItemSpacing.y });
922 ImGui::SameLine();
923 this->text(out_label.c_str());
924 ImGui::PopStyleVar();
925 }
926
927
928 return ret;
929}
LastSliderStatus m_last_slider_status
Definition ImGuiWrapper.hpp:450
static void text(const char *label)
Definition ImGuiWrapper.cpp:1128
Vec3d pos(const Pt &p)
Definition ReprojectPointsOnMesh.hpp:16

References Slic3r::GUI::format(), Slic3r::GUI::into_u8(), m_last_slider_status, style, text(), and tooltip().

Referenced by bbl_slider_float_style().

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

◆ bbl_slider_float_style()

bool Slic3r::GUI::ImGuiWrapper::bbl_slider_float_style ( const std::string & label,
float * v,
float v_min,
float v_max,
const char * format = "%.3f",
float power = 1.0f,
bool clamp = true,
const wxString & tooltip = {} )
870{
871 ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0f);
872 ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, ImVec4(238 / 255.0f, 238 / 255.0f, 238 / 255.0f, 0.00f));
873 ImGui::PushStyleColor(ImGuiCol_FrameBgActive, ImVec4(238 / 255.0f, 238 / 255.0f, 238 / 255.0f, 0.00f));
874 ImGui::PushStyleColor(ImGuiCol_SliderGrab, ImVec4(0.81f, 0.81f, 0.81f, 1.0f));
875 ImGui::PushStyleColor(ImGuiCol_SliderGrabActive, ImVec4(0.00f, 0.59f, 0.53f, 1.00f));
876
877 bool ret = bbl_slider_float(label, v, v_min,v_max, format, power, clamp,tooltip);
878
879 ImGui::PopStyleColor(4);
880 ImGui::PopStyleVar(1);
881
882 return ret;
883}
bool bbl_slider_float(const std::string &label, float *v, float v_min, float v_max, const char *format="%.3f", float power=1.0f, bool clamp=true, const wxString &tooltip={})
Definition ImGuiWrapper.cpp:885

References bbl_slider_float(), Slic3r::GUI::format(), and tooltip().

Referenced by Slic3r::GUI::GLCanvas3D::_render_arrange_menu(), Slic3r::GUI::GLCanvas3D::_render_assemble_control(), Slic3r::GUI::GLCanvas3D::_render_section_view_panel(), Slic3r::GUI::Mouse3DController::render_settings_dialog(), and Slic3r::GUI::GLCanvas3D::LayersEditing::render_variable_layer_height_dialog().

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

◆ bbl_sliderin()

bool Slic3r::GUI::ImGuiWrapper::bbl_sliderin ( const char * label,
int * v,
int v_min,
int v_max,
const char * format = "%d",
ImGuiSliderFlags flags = 0 )
1124{
1125 return ImGui::BBLSliderScalarIn(label, ImGuiDataType_S32, v, &v_min, &v_max, format, flags);
1126}

References Slic3r::GUI::format().

Here is the call graph for this function:

◆ begin() [1/4]

bool Slic3r::GUI::ImGuiWrapper::begin ( const std::string & name,
bool * close,
int flags = 0 )
942{
943 return ImGui::Begin(name.c_str(), close, (ImGuiWindowFlags)flags);
944}

◆ begin() [2/4]

bool Slic3r::GUI::ImGuiWrapper::begin ( const std::string & name,
int flags = 0 )
932{
933 return ImGui::Begin(name.c_str(), nullptr, (ImGuiWindowFlags)flags);
934}

Referenced by Slic3r::GUI::GLGizmoRotate3D::RotoptimzeWindow::RotoptimzeWindow(), Slic3r::GUI::GLCanvas3D::_picking_pass(), Slic3r::GUI::GLCanvas3D::_render_arrange_menu(), Slic3r::GUI::GLCanvas3D::_render_assemble_control(), Slic3r::GUI::GLCanvas3D::_render_assemble_info(), Slic3r::GUI::GLCanvas3D::_render_canvas_toolbar(), Slic3r::GUI::GLCanvas3D::_render_fps_overlay(), Slic3r::GUI::GLCanvas3D::_render_frame(), Slic3r::GUI::GLCanvas3D::_render_imex_ghost_tooltip(), Slic3r::GUI::GLCanvas3D::_render_imgui_select_plate_toolbar(), Slic3r::GUI::GLCanvas3D::_render_orient_menu(), Slic3r::GUI::GLCanvas3D::_render_paint_toolbar(), Slic3r::GUI::GLCanvas3D::_render_plate_switcher(), Slic3r::GUI::GLCanvas3D::_render_return_toolbar(), Slic3r::GUI::GLCanvas3D::_render_section_view_panel(), Slic3r::GUI::NotificationManager::PopNotification::bbl_render_block_notification(), begin(), begin(), Slic3r::GUI::GizmoObjectManipulation::do_render_move_window(), Slic3r::GUI::GizmoObjectManipulation::do_render_rotate_window(), Slic3r::GUI::GizmoObjectManipulation::do_render_scale_input_window(), Slic3r::GUI::DesignSketchTool::draw_dim_label(), Slic3r::GUI::GCodeViewer::SequentialView::GCodeWindow::render(), Slic3r::GUI::GLCanvas3D::Labels::render(), Slic3r::GUI::GLCanvas3D::Tooltip::render(), Slic3r::GUI::IMSlider::render(), Slic3r::GUI::NotificationManager::PopNotification::render(), Slic3r::GUI::NotificationManager::SlicingProgressNotification::render(), Slic3r::GUI::SketchInlineEditor::render(), Slic3r::GUI::GLCanvas3D::CenterOfMass::render_details(), Slic3r::GUI::DesignCanvas::render_hud(), Slic3r::GUI::GCodeViewer::render_legend(), Slic3r::GUI::GCodeViewer::SequentialView::Marker::render_position_window(), Slic3r::GUI::Mouse3DController::render_settings_dialog(), Slic3r::GUI::GCodeViewer::render_toolpaths(), and Slic3r::GUI::GLCanvas3D::LayersEditing::render_variable_layer_height_dialog().

Here is the caller graph for this function:

◆ begin() [3/4]

bool Slic3r::GUI::ImGuiWrapper::begin ( const wxString & name,
bool * close,
int flags = 0 )
947{
948 return begin(into_u8(name), close, flags);
949}
bool begin(const std::string &name, int flags=0)
Definition ImGuiWrapper.cpp:931

References begin(), and Slic3r::GUI::into_u8().

Here is the call graph for this function:

◆ begin() [4/4]

bool Slic3r::GUI::ImGuiWrapper::begin ( const wxString & name,
int flags = 0 )
937{
938 return begin(into_u8(name), flags);
939}

References begin(), and Slic3r::GUI::into_u8().

Here is the call graph for this function:

◆ bold_text()

void Slic3r::GUI::ImGuiWrapper::bold_text ( const std::string & str)
2032{
2033 if (bold_font){
2034 ImGui::PushFont(bold_font);
2035 text(str);
2036 ImGui::PopFont();
2037 } else {
2038 text(str);
2039 }
2040}
ImFont * bold_font
Definition ImGuiWrapper.hpp:452

References bold_font, and text().

Referenced by Slic3r::GUI::GCodeViewer::render_all_plates_stats(), and Slic3r::GUI::GCodeViewer::render_legend_color_arr_recommen().

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

◆ button() [1/3]

bool Slic3r::GUI::ImGuiWrapper::button ( const wxString & label,
const ImVec2 & size,
bool enable )
989{
990 disabled_begin(!enable);
991
992 auto label_utf8 = into_u8(label);
993 bool res = ImGui::Button(label_utf8.c_str(), size);
994
995 disabled_end();
996 return (enable) ? res : false;
997}
void disabled_end()
Definition ImGuiWrapper.cpp:2121
void disabled_begin(bool disabled)
Definition ImGuiWrapper.cpp:2110

References disabled_begin(), disabled_end(), and Slic3r::GUI::into_u8().

Here is the call graph for this function:

◆ button() [2/3]

bool Slic3r::GUI::ImGuiWrapper::button ( const wxString & label,
const wxString & tooltip = {} )
957{
958 auto label_utf8 = into_u8(label);
959 const bool ret = ImGui::Button(label_utf8.c_str());
960
961 if (!tooltip.IsEmpty() && ImGui::IsItemHovered()) {
962 const float max_tooltip_width = ImGui::GetFontSize() * 20.0f;
963 this->tooltip(tooltip, max_tooltip_width);
964 }
965
966 return ret;
967}

References Slic3r::GUI::into_u8(), and tooltip().

Referenced by Slic3r::GUI::GLGizmoRotate3D::RotoptimzeWindow::RotoptimzeWindow(), Slic3r::GUI::GLCanvas3D::_render_arrange_menu(), Slic3r::GUI::GLCanvas3D::_render_orient_menu(), Slic3r::GUI::GLCanvas3D::_render_section_view_panel(), bbl_combo_with_filter(), Slic3r::GUI::NotificationManager::PopNotification::bbl_render_block_notif_buttons(), Slic3r::GUI::GizmoObjectManipulation::do_render_move_window(), Slic3r::GUI::GizmoObjectManipulation::do_render_rotate_window(), Slic3r::GUI::GizmoObjectManipulation::do_render_scale_input_window(), Slic3r::GUI::NotificationManager::PrintHostUploadNotification::render_cancel_button(), Slic3r::GUI::NotificationManager::ProgressIndicatorNotification::render_cancel_button(), Slic3r::GUI::NotificationManager::SlicingProgressNotification::render_cancel_button(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_cancel_button_inner(), Slic3r::GUI::NotificationManager::HintNotification::render_close_button(), Slic3r::GUI::NotificationManager::PopNotification::render_close_button(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_close_button_inner(), Slic3r::GUI::DailyTipsPanel::render_controller_buttons(), Slic3r::GUI::NotificationManager::HintNotification::render_documentation_button(), Slic3r::GUI::NotificationManager::ExportFinishedNotification::render_eject_button(), Slic3r::GUI::NotificationManager::PopNotification::render_hyperlink_action(), Slic3r::GUI::NotificationManager::PopNotification::render_hypertext(), Slic3r::GUI::NotificationManager::PopNotification::render_minimize_button(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_open_button_inner(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_pause_button_inner(), Slic3r::GUI::GCodeViewer::SequentialView::Marker::render_position_window(), Slic3r::GUI::NotificationManager::HintNotification::render_preferences_button(), Slic3r::GUI::NotificationManager::SlicingProgressNotification::render_progress_close_button(), Slic3r::GUI::NotificationManager::SlicingProgressNotification::render_progress_text(), Slic3r::GUI::NotificationManager::HintNotification::render_right_arrow_button(), Slic3r::GUI::Mouse3DController::render_settings_dialog(), Slic3r::GUI::NotificationManager::SlicingProgressNotification::render_show_dailytips(), Slic3r::GUI::NotificationManager::SharedProfilesNotification::render_text(), and Slic3r::GUI::GLCanvas3D::LayersEditing::render_variable_layer_height_dialog().

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

◆ button() [3/3]

bool Slic3r::GUI::ImGuiWrapper::button ( const wxString & label,
float width,
float height )
983{
984 auto label_utf8 = into_u8(label);
985 return ImGui::Button(label_utf8.c_str(), ImVec2(width, height));
986}

References Slic3r::GUI::into_u8().

Here is the call graph for this function:

◆ calc_button_size()

ImVec2 Slic3r::GUI::ImGuiWrapper::calc_button_size ( const wxString & text,
const ImVec2 & button_size = ImVec2(0, 0) ) const
707{
708 const ImVec2 text_size = this->calc_text_size(text);
709 const ImGuiContext &g = *GImGui;
710 const ImGuiStyle &style = g.Style;
711
712 return ImGui::CalcItemSize(button_size, text_size.x + style.FramePadding.x * 2.0f, text_size.y + style.FramePadding.y * 2.0f);
713}
static ImVec2 calc_text_size(std::string_view text, bool hide_text_after_double_hash=false, float wrap_width=-1.0f)
Extend ImGui::CalcTextSize to use string_view.
Definition ImGuiWrapper.cpp:667

References calc_text_size(), style, and text().

Here is the call graph for this function:

◆ calc_text_size() [1/3]

ImVec2 Slic3r::GUI::ImGuiWrapper::calc_text_size ( const std::string & text,
bool hide_text_after_double_hash = false,
float wrap_width = -1.0f )
static
678{
679 return ImGui::CalcTextSize(text.c_str(), NULL, hide_text_after_double_hash, wrap_width);
680}

References text().

Here is the call graph for this function:

◆ calc_text_size() [2/3]

ImVec2 Slic3r::GUI::ImGuiWrapper::calc_text_size ( const wxString & text,
bool hide_text_after_double_hash = false,
float wrap_width = -1.0f )
static
685{
686 auto text_utf8 = into_u8(text);
687 ImVec2 size = ImGui::CalcTextSize(text_utf8.c_str(), NULL, hide_text_after_double_hash, wrap_width);
688
689/*#ifdef __linux__
690 size.x *= m_style_scaling;
691 size.y *= m_style_scaling;
692#endif*/
693
694 return size;
695}

References Slic3r::GUI::into_u8(), and text().

Here is the call graph for this function:

◆ calc_text_size() [3/3]

ImVec2 Slic3r::GUI::ImGuiWrapper::calc_text_size ( std::string_view text,
bool hide_text_after_double_hash = false,
float wrap_width = -1.0f )
static

◆ calculate_filament_group_text_size()

std::tuple< ImVec2, bool > Slic3r::GUI::ImGuiWrapper::calculate_filament_group_text_size ( const std::string & filament_type)
3568{
3569 ImVec2 text_size = ImGui::CalcTextSize(filament_type.c_str());
3570 float four_word_width = ImGui::CalcTextSize("ABCD").x;
3571
3572 float wrap_width = four_word_width;
3573 float line_height = ImGui::GetTextLineHeight();
3574
3575 bool is_multiline = text_size.x > wrap_width;
3576 int line_count = std::ceil(text_size.x / wrap_width);
3577 float text_height = line_count * line_height;
3578
3579 float final_width = is_multiline ? wrap_width : text_size.x;
3580 float final_height = line_count * line_height;
3581
3582 return { { final_width,final_height },is_multiline };
3583}
zaa_minimize_perimeter_height filament_type((ConfigOptionBools, filament_soluble))((ConfigOptionStrings

References Slic3r::filament_type().

Referenced by filament_group(), and Slic3r::GUI::GCodeViewer::render_legend_color_arr_recommen().

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

◆ change_window_position()

std::optional< ImVec2 > Slic3r::GUI::ImGuiWrapper::change_window_position ( const char * window_name,
bool try_to_fix )
static

Change position of imgui window.

Parameters
window_nameImGui identifier of window
output_window_offset[output] optional
try_to_fixWhen True Only move to be full visible otherwise reset position
Returns
New offset of window for function ImGui::SetNextWindowPos
2381 {
2382 ImGuiWindow *window = ImGui::FindWindowByName(window_name);
2383 // is window just created
2384 if (window == NULL)
2385 return {};
2386
2387 // position of window on screen
2388 ImVec2 position = window->Pos;
2389 ImVec2 size = window->SizeFull;
2390
2391 // screen size
2392 ImVec2 screen = ImGui::GetMainViewport()->Size;
2393
2394 std::optional<ImVec2> output_window_offset;
2395 if (position.x < 0) {
2396 if (position.y < 0)
2397 // top left
2398 output_window_offset = ImVec2(0, 0);
2399 else
2400 // only left
2401 output_window_offset = ImVec2(0, position.y);
2402 } else if (position.y < 0) {
2403 // only top
2404 output_window_offset = ImVec2(position.x, 0);
2405 } else if (screen.x < (position.x + size.x)) {
2406 if (screen.y < (position.y + size.y))
2407 // right bottom
2408 output_window_offset = ImVec2(screen.x - size.x, screen.y - size.y);
2409 else
2410 // only right
2411 output_window_offset = ImVec2(screen.x - size.x, position.y);
2412 } else if (screen.y < (position.y + size.y)) {
2413 // only bottom
2414 output_window_offset = ImVec2(position.x, screen.y - size.y);
2415 }
2416
2417 if (!try_to_fix && output_window_offset.has_value())
2418 output_window_offset = ImVec2(-1, -1); // Put on default position
2419
2420 return output_window_offset;
2421}

◆ checkbox()

bool Slic3r::GUI::ImGuiWrapper::checkbox ( const wxString & label,
bool & value )
1088{
1089 auto label_utf8 = into_u8(label);
1090 return ImGui::Checkbox(label_utf8.c_str(), &value);
1091}

References Slic3r::GUI::into_u8().

Referenced by Slic3r::GUI::GLCanvas3D::_render_orient_menu(), and search_list().

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

◆ claim_key_event()

bool Slic3r::GUI::ImGuiWrapper::claim_key_event ( const wxKeyEvent & evt)
2206{
2207 const bool claimed = owns_keyboard();
2208 const int key = evt.GetKeyCode();
2209 if (evt.GetEventType() == wxEVT_KEY_DOWN) {
2210 m_char_claim = m_key_claims.try_emplace(key, claimed).first->second;
2211 return *m_char_claim;
2212 }
2213 if (evt.GetEventType() == wxEVT_KEY_UP) {
2214 m_char_claim.reset();
2215 if (const auto press = m_key_claims.extract(key))
2216 return press.mapped();
2217 return claimed;
2218 }
2219 return std::exchange(m_char_claim, std::nullopt).value_or(claimed);
2220}
bool owns_keyboard() const
Definition ImGuiWrapper.cpp:2200
std::map< int, bool > m_key_claims
Definition ImGuiWrapper.hpp:80
std::optional< bool > m_char_claim
Definition ImGuiWrapper.hpp:82

References m_char_claim, m_key_claims, and owns_keyboard().

Here is the call graph for this function:

◆ clipboard_get()

const char * Slic3r::GUI::ImGuiWrapper::clipboard_get ( void * user_data)
staticprivate
3536{
3537 ImGuiWrapper* self = reinterpret_cast<ImGuiWrapper*>(user_data);
3538
3539 const char* res = "";
3540
3541 if (wxTheClipboard->Open()) {
3542 if (wxTheClipboard->IsSupported(wxDF_TEXT) || wxTheClipboard->IsSupported(wxDF_UNICODETEXT)) {
3543 wxTextDataObject data;
3544 wxTheClipboard->GetData(data);
3545
3546 const wxString text = data.GetText();
3547 if (text.Length() > 0) {
3548 self->m_clipboard_text = into_u8(text);
3549 res = self->m_clipboard_text.c_str();
3550 }
3551 }
3552
3553 wxTheClipboard->Close();
3554 }
3555
3556 return res;
3557}
ImGuiWrapper()
Definition ImGuiWrapper.cpp:377

References ImGuiWrapper(), Slic3r::GUI::into_u8(), m_clipboard_text, and text().

Referenced by init_input().

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

◆ clipboard_set()

void Slic3r::GUI::ImGuiWrapper::clipboard_set ( void * user_data,
const char * text )
staticprivate
3560{
3561 if (wxTheClipboard->Open()) {
3562 wxTheClipboard->SetData(new wxTextDataObject(wxString::FromUTF8(text))); // object owned by the clipboard
3563 wxTheClipboard->Close();
3564 }
3565}

References text().

Referenced by init_input().

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

◆ close_top_popup()

void Slic3r::GUI::ImGuiWrapper::close_top_popup ( )
2178{
2179 const ImVector<ImGuiPopupData>& stack = ImGui::GetCurrentContext()->OpenPopupStack;
2180 for (int level = stack.Size - 1; level >= 0; --level) {
2181 const ImGuiWindow* popup = stack[level].Window;
2182 if (!drawn_last_frame(popup))
2183 continue;
2184 if ((popup->Flags & ImGuiWindowFlags_Modal) == 0)
2185 ImGui::ClosePopupToLevel(level, true);
2186 return;
2187 }
2188}
static bool drawn_last_frame(const ImGuiWindow *popup)
Definition ImGuiWrapper.cpp:2161

References Slic3r::GUI::drawn_last_frame().

Here is the call graph for this function:

◆ combo() [1/2]

bool Slic3r::GUI::ImGuiWrapper::combo ( const std::string & label,
const std::vector< std::string > & options,
int & selection,
ImGuiComboFlags flags = 0,
float label_width = 0.0f,
float item_width = 0.0f )
1389{
1390 // this is to force the label to the left of the widget:
1391 const bool hidden_label = boost::starts_with(label, "##");
1392 if (!label.empty() && !hidden_label) {
1393 text(label);
1394 ImGui::SameLine(label_width);
1395 }
1396 ImGui::PushItemWidth(item_width);
1397
1398 int selection_out = selection;
1399 bool res = false;
1400
1401 const char *selection_str = selection < int(options.size()) && selection >= 0 ? options[selection].c_str() : "";
1402 if (ImGui::BeginCombo(hidden_label ? label.c_str() : ("##" + label).c_str(), selection_str, flags)) {
1403 for (int i = 0; i < (int)options.size(); i++) {
1404 if (ImGui::Selectable(options[i].c_str(), i == selection)) {
1405 selection_out = i;
1406 res = true;
1407 }
1408 }
1409
1410 ImGui::EndCombo();
1411 }
1412
1413 selection = selection_out;
1414 return res;
1415}

References text().

Referenced by combo().

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

◆ combo() [2/2]

bool Slic3r::GUI::ImGuiWrapper::combo ( const wxString & label,
const std::vector< std::string > & options,
int & selection,
ImGuiComboFlags flags = 0,
float label_width = 0.0f,
float item_width = 0.0f )
1384{
1385 return combo(into_u8(label), options, selection, flags, label_width, item_width);
1386}
bool combo(const std::string &label, const std::vector< std::string > &options, int &selection, ImGuiComboFlags flags=0, float label_width=0.0f, float item_width=0.0f)
Definition ImGuiWrapper.cpp:1388

References combo(), and Slic3r::GUI::into_u8().

Here is the call graph for this function:

◆ contain_all_glyphs()

bool Slic3r::GUI::ImGuiWrapper::contain_all_glyphs ( const ImFont * font,
const std::string & text )
static

Check that font ranges contain all chars in string (rendered Unicodes are stored in GlyphRanges).

Parameters
fontContain glyph ranges
textVector of character to check
Returns
True when all glyphs from text are in font ranges
2600{
2601 if (font == nullptr) return false;
2602 if (!font->IsLoaded()) return false;
2603 const ImFontConfig *fc = font->ConfigData;
2604 if (fc == nullptr) return false;
2605 if (text.empty()) return true;
2606 return is_chars_in_ranges(fc->GlyphRanges, text.c_str());
2607}
static bool is_chars_in_ranges(const ImWchar *ranges, const char *chars_ptr)
Definition ImGuiWrapper.cpp:2621

References is_chars_in_ranges(), and text().

Referenced by Slic3r::GUI::GLGizmoEmboss::draw_text_input().

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

◆ destroy_font()

void Slic3r::GUI::ImGuiWrapper::destroy_font ( )
private
3512{
3513 if (m_font_texture != 0) {
3514 ImGuiIO& io = ImGui::GetIO();
3515 io.Fonts->TexID = 0;
3517 m_font_texture = 0;
3518 }
3519}
#define glsafe(cmd)
Definition OpenGLUtils.hpp:25
unsigned m_font_texture
Definition ImGuiWrapper.hpp:66
#define glDeleteTextures
Definition gl.h:3587

References glDeleteTextures, glsafe, and m_font_texture.

Referenced by ~ImGuiWrapper(), init_font(), set_language(), and set_scaling().

Here is the caller graph for this function:

◆ destroy_fonts_texture()

void Slic3r::GUI::ImGuiWrapper::destroy_fonts_texture ( )
3521 {
3522 //if (m_font_another_texture != 0) {
3523 // if (m_new_frame_open) {
3524 // render();
3525 // }
3526 // init_font(true);
3527 // glsafe(::glDeleteTextures(1, &m_font_another_texture));
3528 // m_font_another_texture = 0;
3529 // if (!m_new_frame_open) {
3530 // new_frame();
3531 // }
3532 //}
3533}

◆ disable_background_fadeout_animation()

void Slic3r::GUI::ImGuiWrapper::disable_background_fadeout_animation ( )
2235{
2236 GImGui->DimBgRatio = 1.0f;
2237}

◆ disabled_begin()

void Slic3r::GUI::ImGuiWrapper::disabled_begin ( bool disabled)
2111{
2112 wxCHECK_RET(!m_disabled, "ImGUI: Unbalanced disabled_begin() call");
2113
2114 if (disabled) {
2115 ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
2116 ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
2117 m_disabled = true;
2118 }
2119}
bool m_disabled
Definition ImGuiWrapper.hpp:70

References m_disabled.

Referenced by Slic3r::GUI::GLGizmoRotate3D::RotoptimzeWindow::RotoptimzeWindow(), Slic3r::GUI::GLCanvas3D::_render_arrange_menu(), Slic3r::GUI::GLCanvas3D::_render_section_view_panel(), button(), Slic3r::GUI::GizmoObjectManipulation::do_render_move_window(), Slic3r::GUI::GLCanvas3D::LayersEditing::render_variable_layer_height_dialog(), Slic3r::GUI::GizmoObjectManipulation::reset_button(), and Slic3r::GUI::GizmoObjectManipulation::reset_zero_button().

Here is the caller graph for this function:

◆ disabled_end()

void Slic3r::GUI::ImGuiWrapper::disabled_end ( )

◆ display_initialized()

bool Slic3r::GUI::ImGuiWrapper::display_initialized ( ) const
3506{
3507 const ImGuiIO& io = ImGui::GetIO();
3508 return io.DisplaySize.x >= 0.0f && io.DisplaySize.y >= 0.0f;
3509}

Referenced by update_key_data(), and update_mouse_data().

Here is the caller graph for this function:

◆ drag_optional_float()

bool Slic3r::GUI::ImGuiWrapper::drag_optional_float ( const char * label,
std::optional< float > & v,
float v_speed,
float v_min,
float v_max,
const char * format,
float power,
float def_val = .0f )
static
2318{
2319 auto func = [&](float &value) {
2320 return ImGui::DragFloat(label, &value, v_speed, v_min, v_max, format, power);
2321 };
2322 std::function<bool(const float &)> is_default =
2323 [def_val](const float &value) -> bool {
2324 return std::fabs(value-def_val) <= std::numeric_limits<float>::epsilon();
2325 };
2326 return input_optional(v, func, is_default, def_val);
2327}
static bool input_optional(std::optional< T > &v, Func &f, std::function< bool(const T &)> is_default, const T &def_val)
Definition ImGuiWrapper.cpp:2260

References Slic3r::GUI::format(), and Slic3r::GUI::input_optional().

Here is the call graph for this function:

◆ draw()

void Slic3r::GUI::ImGuiWrapper::draw ( const Polygon & polygon,
ImDrawList * draw_list = ImGui::GetOverlayDrawList(),
ImU32 color = ImGui::GetColorU32(COL_ORANGE_LIGHT),
float thickness = 3.f )
static

Visualization of polygon.

Parameters
polygonDefine what to draw
draw_listDefine where to draw it
colorColor of polygon
thicknessWidth of polygon line
2553{
2554 // minimal one line consist of 2 points
2555 if (polygon.size() < 2) return;
2556 // need a place to draw
2557 if (draw_list == nullptr) return;
2558
2559 const Point *prev_point = &polygon.points.back();
2560 for (const Point &point : polygon.points) {
2561 ImVec2 p1(prev_point->x(), prev_point->y());
2562 ImVec2 p2(point.x(), point.y());
2563 draw_list->AddLine(p1, p2, color, thickness);
2564 prev_point = &point;
2565 }
2566}
Kernel::Point_3 Point
Definition MeshRepair.cpp:81

References Slic3r::MultiPoint::points, and Slic3r::MultiPoint::size().

Here is the call graph for this function:

◆ draw_cross_hair()

void Slic3r::GUI::ImGuiWrapper::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 )
static

Draw symbol of cross hair.

Parameters
positionCenter of cross hair
radiusCircle radius
colorColor of symbol
num_segmentsPrecission of circle
thicknessThickness of Line in symbol
2587 {
2588 auto draw_list = ImGui::GetOverlayDrawList();
2589 draw_list->AddCircle(position, radius, color, num_segments, thickness);
2590 auto dirs = {ImVec2{0, 1}, ImVec2{1, 0}, ImVec2{0, -1}, ImVec2{-1, 0}};
2591 for (const ImVec2 &dir : dirs) {
2592 ImVec2 start(position.x + dir.x * 0.5 * radius, position.y + dir.y * 0.5 * radius);
2593 ImVec2 end(position.x + dir.x * 1.5 * radius, position.y + dir.y * 1.5 * radius);
2594 draw_list->AddLine(start, end, color, thickness);
2595 }
2596}
void end()
Definition ImGuiWrapper.cpp:951

References end().

Referenced by Slic3r::GUI::GLGizmoEmboss::on_render_input_window(), and Slic3r::GUI::GLGizmoSVG::on_render_input_window().

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

◆ draw_data_signature()

ImGuiID Slic3r::GUI::ImGuiWrapper::draw_data_signature ( const ImDrawData * draw_data)
static
645{
646 ImGuiID hash = 0;
647 if (draw_data == nullptr)
648 return hash;
649
650 for (int i = 0; i < draw_data->CmdListsCount; ++i) {
651 const ImDrawList* list = draw_data->CmdLists[i];
652 hash = ImHashData(list->VtxBuffer.Data, list->VtxBuffer.Size * sizeof(ImDrawVert), hash);
653 hash = ImHashData(list->IdxBuffer.Data, list->IdxBuffer.Size * sizeof(ImDrawIdx), hash);
654 // ImDrawCmd has padding, and a hovered ImageButton3() differs only in TextureId.
655 for (const ImDrawCmd& cmd : list->CmdBuffer) {
656 hash = ImHashData(&cmd.ClipRect, sizeof(cmd.ClipRect), hash);
657 hash = ImHashData(&cmd.TextureId, sizeof(cmd.TextureId), hash);
658 hash = ImHashData(&cmd.VtxOffset, sizeof(cmd.VtxOffset), hash);
659 hash = ImHashData(&cmd.IdxOffset, sizeof(cmd.IdxOffset), hash);
660 hash = ImHashData(&cmd.ElemCount, sizeof(cmd.ElemCount), hash);
661 hash = ImHashData(&cmd.UserCallback, sizeof(cmd.UserCallback), hash);
662 }
663 }
664 return hash;
665}

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

Here is the caller graph for this function:

◆ draw_gradient_ramp()

void Slic3r::GUI::ImGuiWrapper::draw_gradient_ramp ( ImDrawList * draw_list,
const ImVec2 & top_left,
const ImVec2 & bottom_right,
const std::vector< wxColour > & ramp )
static

Fill a rect with a filament gradient ramp, one band per pixel row, ramp.front() along the bottom edge. Bands rather than one interpolated rect, because the ramp follows the slot's gradient curve and ImGui's corner interpolation could only draw a straight fade.

Parameters
draw_listDefine where to draw it
top_leftUpper left corner of the rect
bottom_rightLower right corner of the rect
rampColours printed, bottom of the model first
2569{
2570 if (draw_list == nullptr || ramp.empty() || bottom_right.x <= top_left.x || bottom_right.y <= top_left.y)
2571 return;
2572
2573 const int rows = std::max(1, (int) std::lround(bottom_right.y - top_left.y));
2574 const float row_h = (bottom_right.y - top_left.y) / rows;
2575 const size_t last = ramp.size() - 1;
2576 for (int r = 0; r < rows; ++r) {
2577 // Row 0 is the top of the rect and so takes the ramp's last entry, the model's top.
2578 const double t = (rows > 1) ? (double) (rows - 1 - r) / (rows - 1) : 0.5;
2579 const wxColour &c = ramp[(size_t) (t * last + 0.5)];
2580 // The bottom row snaps to the rect's edge so rounding never leaves a sliver uncovered.
2581 const float y0 = top_left.y + r * row_h;
2582 const float y1 = (r + 1 == rows) ? bottom_right.y : top_left.y + (r + 1) * row_h;
2583 draw_list->AddRectFilled({top_left.x, y0}, {bottom_right.x, y1}, IM_COL32(c.Red(), c.Green(), c.Blue(), c.Alpha()));
2584 }
2585}
size_t rows(const T &raster)
Definition MarchingSquares.hpp:171

Referenced by Slic3r::GUI::GLCanvas3D::_render_paint_toolbar(), and Slic3r::GUI::GLGizmoMmuSegmentation::draw_color_button().

Here is the caller graph for this function:

◆ end()

void Slic3r::GUI::ImGuiWrapper::end ( )
952{
953 ImGui::End();
954}

Referenced by Slic3r::GUI::GLCanvas3D::_picking_pass(), Slic3r::GUI::GLCanvas3D::_render_arrange_menu(), Slic3r::GUI::GLCanvas3D::_render_assemble_control(), Slic3r::GUI::GLCanvas3D::_render_assemble_info(), Slic3r::GUI::GLCanvas3D::_render_fps_overlay(), Slic3r::GUI::GLCanvas3D::_render_frame(), Slic3r::GUI::GLCanvas3D::_render_imex_ghost_tooltip(), Slic3r::GUI::GLCanvas3D::_render_imgui_select_plate_toolbar(), Slic3r::GUI::GLCanvas3D::_render_orient_menu(), Slic3r::GUI::GLCanvas3D::_render_paint_toolbar(), Slic3r::GUI::GLCanvas3D::_render_plate_switcher(), Slic3r::GUI::GLCanvas3D::_render_return_toolbar(), Slic3r::GUI::GLCanvas3D::_render_section_view_panel(), Slic3r::GUI::NotificationManager::PopNotification::bbl_render_block_notification(), Slic3r::GUI::GizmoObjectManipulation::do_render_move_window(), Slic3r::GUI::GizmoObjectManipulation::do_render_rotate_window(), Slic3r::GUI::GizmoObjectManipulation::do_render_scale_input_window(), draw_cross_hair(), Slic3r::GUI::DesignSketchTool::draw_dim_label(), Slic3r::GUI::GCodeViewer::SequentialView::GCodeWindow::render(), Slic3r::GUI::GLCanvas3D::Labels::render(), Slic3r::GUI::GLCanvas3D::Tooltip::render(), Slic3r::GUI::IMSlider::render(), Slic3r::GUI::NotificationManager::PopNotification::render(), Slic3r::GUI::NotificationManager::SlicingProgressNotification::render(), Slic3r::GUI::SketchInlineEditor::render(), Slic3r::GUI::GLCanvas3D::CenterOfMass::render_details(), Slic3r::GUI::DesignCanvas::render_hud(), Slic3r::GUI::GCodeViewer::SequentialView::Marker::render_position_window(), Slic3r::GUI::Mouse3DController::render_settings_dialog(), Slic3r::GUI::GCodeViewer::render_toolpaths(), and Slic3r::GUI::GLCanvas3D::LayersEditing::render_variable_layer_height_dialog().

Here is the caller graph for this function:

◆ end_frame()

ImDrawData * Slic3r::GUI::ImGuiWrapper::end_frame ( )
628{
629#ifdef __APPLE__
630 // io.ImeWindowHandle is the focused canvas' view (GLCanvas3D::on_set_focus()).
631 if (void* view = ImGui::GetIO().ImeWindowHandle)
632 mac_ime_set_active(view, ImGui::GetIO().WantTextInput);
633#endif
634 ImGui::Render();
635 m_new_frame_open = false;
636 return ImGui::GetDrawData();
637}
bool m_new_frame_open
Definition ImGuiWrapper.hpp:71
void mac_ime_set_active(void *ns_view, bool active)
Definition MacIME.mm:154

References m_new_frame_open, and Slic3r::GUI::mac_ime_set_active().

Here is the call graph for this function:

◆ escape_double_hash()

void Slic3r::GUI::ImGuiWrapper::escape_double_hash ( std::string & text)
static

Escape ## in data by add space between hashes Needed when user written text is visualized by ImGui.

Parameters
textIn/Out text to be escaped
2467{
2468 // add space between hashes
2469 const std::string search = "##";
2470 const std::string replace = "# #";
2471 size_t pos = 0;
2472 while ((pos = text.find(search, pos)) != std::string::npos)
2473 text.replace(pos, search.length(), replace);
2474}

References text().

Referenced by Slic3r::GUI::GLGizmoEmboss::draw_style_list(), and Slic3r::GUI::Emboss::StyleManager::init_trunc_names().

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

◆ filament_group()

void Slic3r::GUI::ImGuiWrapper::filament_group ( const std::string & filament_type,
const char * hex_color,
unsigned char filament_id,
float align_width )
3586{
3587 //ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0));
3588 std::string id = std::to_string(static_cast<unsigned int> (filament_id + 1));
3589 ImDrawList* draw_list = ImGui::GetWindowDrawList();
3590 static ImTextureID transparent;
3591 ImVec2 text_size = ImGui::CalcTextSize(filament_type.c_str());
3592 // BBS image sizing based on text width (DPI scaling)
3593 float img_width = ImGui::CalcTextSize("ABC").x;
3594 ImVec2 img_size = { img_width, img_width };
3595 ImVec2 id_text_size = this->calc_text_size(id);
3596 unsigned char rgba[4];
3597 rgba[3] = 0xff;
3599 std::string svg_path = "/images/outlined_rect.svg";
3600 if (rgba[3] == 0x00) {
3601 svg_path = "/images/outlined_rect_transparent.svg";
3602 }
3603 BitmapCache::load_from_svg_file_change_color(Slic3r::resources_dir() + svg_path, img_size.x, img_size.y, transparent, hex_color);
3604 ImGui::BeginGroup();
3605 {
3606 ImVec2 cursor_pos = ImGui::GetCursorScreenPos();
3607 draw_list->AddImage(transparent, cursor_pos, { cursor_pos.x + img_size.x, cursor_pos.y + img_size.y }, { 0, 0 }, { 1, 1 }, ImGui::GetColorU32(ImVec4(1.f, 1.f, 1.f, 1.f)));
3608 // image border test
3609 // draw_list->AddRect(cursor_pos, {cursor_pos.x + img_size.x, cursor_pos.y + img_size.y}, IM_COL32(0, 0, 0, 255));
3610 ImVec2 current_cursor = ImGui::GetCursorPos();
3611 ImGui::SetCursorPos({ current_cursor.x + (img_size.x - id_text_size.x) * 0.5f, current_cursor.y + (img_size.y - id_text_size.y) * 0.5f });
3612
3613 float gray = 0.299 * rgba[0] + 0.587 * rgba[1] + 0.114 * rgba[2];
3614 ImVec4 text_color = gray < 80 ? ImVec4(1.0f, 1.0f, 1.0f, 1.0f) : ImVec4(0, 0, 0, 1.0f);
3615 this->text_colored(text_color, id.c_str());
3616
3617 auto wrapped_text_info = calculate_filament_group_text_size(filament_type);
3618 ImVec2 wrapped_text_size = std::get<0>(wrapped_text_info);
3619 bool is_multiline = std::get<1>(wrapped_text_info);
3620
3621 float text_y_offset = 4.f;
3622 float text_x_offset = is_multiline ? (img_size.x - wrapped_text_size.x) * 0.5f + 2.f : (img_size.x - wrapped_text_size.x) * 0.5f + 2.f;
3623
3624 auto cursor_x_before_text = ImGui::GetCursorPosX();
3625 current_cursor = ImGui::GetCursorPos();
3626 ImGui::SetCursorPos({
3627 current_cursor.x + text_x_offset,
3628 current_cursor.y + text_y_offset
3629 });
3630
3631 if (is_multiline) {
3632 ImGui::PushTextWrapPos(ImGui::GetCursorPosX() + wrapped_text_size.x);
3633 }
3634 this->text(filament_type);
3635 if (is_multiline) {
3636 ImGui::PopTextWrapPos();
3637 }
3638 ImGui::Dummy(ImVec2(align_width, 0));
3639 ImGui::EndGroup();
3640 }
3641 //ImGui::PopStyleVar(1);
3642}
const wxColour text_color(107, 107, 107)
static bool parse_color4(const std::string &scolor, unsigned char *rgba_out)
Definition BitmapCache.cpp:559
static bool load_from_svg_file_change_color(const std::string &filename, unsigned width, unsigned height, ImTextureID &texture_id, const char *hexColor)
Definition BitmapCache.cpp:575
static void text_colored(const ImVec4 &color, const char *label)
Definition ImGuiWrapper.cpp:1157
std::tuple< ImVec2, bool > calculate_filament_group_text_size(const std::string &filament_type)
Definition ImGuiWrapper.cpp:3567
const std::string & resources_dir()
Definition utils.cpp:296

References calc_text_size(), calculate_filament_group_text_size(), Slic3r::filament_type(), Slic3r::GUI::BitmapCache::load_from_svg_file_change_color(), Slic3r::GUI::BitmapCache::parse_color4(), Slic3r::resources_dir(), text(), text_color(), and text_colored().

Referenced by Slic3r::GUI::GCodeViewer::render_legend_color_arr_recommen().

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

◆ find_widest_text()

float Slic3r::GUI::ImGuiWrapper::find_widest_text ( std::vector< wxString > & text_list)
698{
699 float width = .0f;
700 for(const wxString &text : text_list) {
701 width = std::max(width, this->calc_text_size(text).x);
702 }
703 return width;
704}
coord_t width(const BoundingBox &box)
Definition Arrange.cpp:1184

References calc_text_size(), and text().

Here is the call graph for this function:

◆ forget_key_claims()

void Slic3r::GUI::ImGuiWrapper::forget_key_claims ( )
2223{
2224 m_key_claims.clear();
2225 m_char_claim.reset();
2226}

References m_char_claim, and m_key_claims.

◆ from_ImU32()

ColorRGBA Slic3r::GUI::ImGuiWrapper::from_ImU32 ( const ImU32 & color)
static
2250{
2251 return from_ImVec4(ImGui::ColorConvertU32ToFloat4(color));
2252}
static ColorRGBA from_ImVec4(const ImVec4 &color)
Definition ImGuiWrapper.cpp:2254

References from_ImVec4().

Here is the call graph for this function:

◆ from_ImVec4()

ColorRGBA Slic3r::GUI::ImGuiWrapper::from_ImVec4 ( const ImVec4 & color)
static
2255{
2256 return { color.x, color.y, color.z, color.w };
2257}

Referenced by from_ImU32(), Slic3r::GLVolume::update_render_colors(), Slic3r::GUI::Bed3D::update_render_colors(), Slic3r::GUI::GLCanvas3D::update_render_colors(), Slic3r::GUI::GLGizmoBase::update_render_colors(), and Slic3r::GUI::PartPlate::update_render_colors().

Here is the caller graph for this function:

◆ get_font_size()

float Slic3r::GUI::ImGuiWrapper::get_font_size ( ) const
inline

◆ get_fonts_names()

const std::vector< std::string > Slic3r::GUI::ImGuiWrapper::get_fonts_names ( ) const
inline
215{ return m_fonts_names; }
std::vector< std::string > m_fonts_names
Definition ImGuiWrapper.hpp:454

References m_fonts_names.

◆ get_glyph_ranges()

const ImWchar * Slic3r::GUI::ImGuiWrapper::get_glyph_ranges ( ) const
inline
110{ return m_glyph_ranges; } // language specific
const ImWchar * m_glyph_ranges
Definition ImGuiWrapper.hpp:60

References m_glyph_ranges.

◆ get_item_spacing()

ImVec2 Slic3r::GUI::ImGuiWrapper::get_item_spacing ( ) const
716{
717 const ImGuiContext &g = *GImGui;
718 const ImGuiStyle &style = g.Style;
719 return style.ItemSpacing;
720}

References style.

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

Here is the caller graph for this function:

◆ get_last_slider_status() [1/2]

LastSliderStatus & Slic3r::GUI::ImGuiWrapper::get_last_slider_status ( )
inline
132{ return m_last_slider_status; }

References m_last_slider_status.

◆ get_last_slider_status() [2/2]

const LastSliderStatus & Slic3r::GUI::ImGuiWrapper::get_last_slider_status ( ) const
inline
131{ return m_last_slider_status; }

References m_last_slider_status.

◆ get_slider_float_height()

float Slic3r::GUI::ImGuiWrapper::get_slider_float_height ( ) const
723{
724 const ImGuiContext& g = *GImGui;
725 const ImGuiStyle& style = g.Style;
726 return g.FontSize + style.FramePadding.y * 2.0f + style.ItemSpacing.y;
727}

References style.

◆ get_style_scaling()

float Slic3r::GUI::ImGuiWrapper::get_style_scaling ( ) const
inline

◆ GetTextureCustomRect()

ImFontAtlasCustomRect * Slic3r::GUI::ImGuiWrapper::GetTextureCustomRect ( const wchar_t & tex_id)
2229{
2230 auto item = m_custom_glyph_rects_ids.find(tex_id);
2231 return (item != m_custom_glyph_rects_ids.end()) ? ImGui::GetIO().Fonts->GetCustomRectByIndex(m_custom_glyph_rects_ids[tex_id]) : nullptr;
2232}
std::map< wchar_t, int > m_custom_glyph_rects_ids
Definition ImGuiWrapper.hpp:77

References m_custom_glyph_rects_ids.

Referenced by image_button().

Here is the caller graph for this function:

◆ glyph_button()

bool Slic3r::GUI::ImGuiWrapper::glyph_button ( wchar_t icon_char,
ImVec2 icon_size )
1003{
1004 ImDrawList* draw_list = ImGui::GetWindowDrawList();
1005 ImFont* font = ImGui::GetFont();
1006 ImGuiStyle& style = ImGui::GetStyle();
1007 ImVec2 padding = style.FramePadding;
1008 float border_w = style.FrameBorderSize;
1009 float rounding = style.FrameRounding;
1010 std::string icon_str = into_u8(icon_char);
1011 const char* icon = icon_str.c_str();
1012
1013 float width = icon_size.x + (padding.x + border_w) * 2.f;
1014 float height = icon_size.y + (padding.y + border_w) * 2.f;
1015 ImVec2 rc_min = ImGui::GetCursorScreenPos();
1016 ImVec2 rc_max = ImVec2(rc_min.x + width, rc_min.y + height);
1017
1018 ImGui::Dummy(ImVec2(width, height));
1019
1020 ImGuiCol bg_color = ImGuiCol_Button;
1021 ImGuiCol border_color = ImGuiCol_Border;
1022 bool clicked = false;
1023
1024 if (ImGui::IsMouseHoveringRect(rc_min, rc_max)) {
1025 bg_color = ImGuiCol_ButtonHovered;
1026 if (ImGui::IsMouseClicked(ImGuiMouseButton_Left)) {
1027 bg_color = ImGuiCol_ButtonActive;
1028 border_color = ImGuiCol_BorderShadow;
1029 clicked = true;
1030 }
1031 }
1032
1033 draw_list->AddRectFilled(rc_min, rc_max, ImGui::GetColorU32(bg_color), rounding);
1034
1035 if (border_w > 0.f)
1036 draw_list->AddRect(rc_min, rc_max, ImGui::GetColorU32(border_color), rounding, 0, border_w);
1037
1038 ImVec2 text_pos = ImVec2(
1039 rc_min.x + (width - font->FontSize) * .5f,
1040 rc_min.y + (height - font->FontSize) * .5f
1041 );
1042 draw_list->AddText(font, font->FontSize, text_pos, ImGui::GetColorU32(ImGuiCol_Text), icon);
1043
1044 return clicked;
1045}
wxColour bg_color()
Definition SpeedDialDialog.cpp:69
coord_t height(const BoundingBox &box)
Definition Arrange.cpp:1185

References Slic3r::GUI::into_u8(), and style.

Referenced by Slic3r::GUI::GCodeViewer::SequentialView::Marker::render_position_window().

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

◆ image_button() [1/2]

bool Slic3r::GUI::ImGuiWrapper::image_button ( const wchar_t icon,
const wxString & tooltip = L"" )
1361{
1362 const ImGuiIO& io = ImGui::GetIO();
1363 const ImTextureID tex_id = io.Fonts->TexID;
1364 assert(io.Fonts->TexWidth > 0 && io.Fonts->TexHeight > 0);
1365 const float inv_tex_w = 1.0f / float(io.Fonts->TexWidth);
1366 const float inv_tex_h = 1.0f / float(io.Fonts->TexHeight);
1367 const ImFontAtlasCustomRect* const rect = GetTextureCustomRect(icon);
1368 const ImVec2 size = { float(rect->Width), float(rect->Height) };
1369 const ImVec2 uv0 = ImVec2(float(rect->X) * inv_tex_w, float(rect->Y) * inv_tex_h);
1370 const ImVec2 uv1 = ImVec2(float(rect->X + rect->Width) * inv_tex_w, float(rect->Y + rect->Height) * inv_tex_h);
1371 ImGui::PushStyleColor(ImGuiCol_Button, { 0.25f, 0.25f, 0.25f, 0.0f });
1372 ImGui::PushStyleColor(ImGuiCol_ButtonHovered, { 0.4f, 0.4f, 0.4f, 1.0f });
1373 ImGui::PushStyleColor(ImGuiCol_ButtonActive, { 0.25f, 0.25f, 0.25f, 1.0f });
1374 const bool res = image_button(tex_id, size, uv0, uv1);
1375 ImGui::PopStyleColor(3);
1376
1377 if (!tooltip.empty() && ImGui::IsItemHovered())
1378 this->tooltip(tooltip, ImGui::GetFontSize() * 20.0f);
1379
1380 return res;
1381}
bool image_button(ImTextureID user_texture_id, const ImVec2 &size, const ImVec2 &uv0=ImVec2(0.0, 0.0), const ImVec2 &uv1=ImVec2(1.0, 1.0), int frame_padding=-1, const ImVec4 &bg_col=ImVec4(0.0, 0.0, 0.0, 0.0), const ImVec4 &tint_col=ImVec4(1.0, 1.0, 1.0, 1.0), ImGuiButtonFlags flags=0)
Definition ImGuiWrapper.cpp:1344
ImFontAtlasCustomRect * GetTextureCustomRect(const wchar_t &tex_id)
Definition ImGuiWrapper.cpp:2228

References GetTextureCustomRect(), image_button(), and tooltip().

Here is the call graph for this function:

◆ image_button() [2/2]

bool Slic3r::GUI::ImGuiWrapper::image_button ( ImTextureID user_texture_id,
const ImVec2 & size,
const ImVec2 & uv0 = ImVec2(0.0, 0.0),
const ImVec2 & uv1 = ImVec2(1.0, 1.0),
int frame_padding = -1,
const ImVec4 & bg_col = ImVec4(0.0, 0.0, 0.0, 0.0),
const ImVec4 & tint_col = ImVec4(1.0, 1.0, 1.0, 1.0),
ImGuiButtonFlags flags = 0 )
1345{
1346 ImGuiContext& g = *GImGui;
1347 ImGuiWindow* window = g.CurrentWindow;
1348 if (window->SkipItems)
1349 return false;
1350
1351 // Default to using texture ID as ID. User can still push string/integer prefixes.
1352 ImGui::PushID((void*)(intptr_t)user_texture_id);
1353 const ImGuiID id = window->GetID("#image");
1354 ImGui::PopID();
1355
1356 const ImVec2 padding = (frame_padding >= 0) ? ImVec2((float)frame_padding, (float)frame_padding) : g.Style.FramePadding;
1357 return image_button_ex(id, user_texture_id, size, uv0, uv1, padding, bg_col, tint_col, flags);
1358}
static bool image_button_ex(ImGuiID id, ImTextureID texture_id, const ImVec2 &size, const ImVec2 &uv0, const ImVec2 &uv1, const ImVec2 &padding, const ImVec4 &bg_col, const ImVec4 &tint_col, ImGuiButtonFlags flags)
Definition ImGuiWrapper.cpp:1318

References Slic3r::GUI::image_button_ex().

Referenced by image_button().

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

◆ init_font()

void Slic3r::GUI::ImGuiWrapper::init_font ( bool compress)
private
2957{
2958 destroy_font();
2959
2960 ImGuiIO& io = ImGui::GetIO();
2961 io.Fonts->Clear();
2962
2963 // Create ranges of characters from m_glyph_ranges, possibly adding some OS specific special characters.
2964 ImVector<ImWchar> ranges;
2965 ImVector<ImWchar> basic_ranges;
2966 ImFontAtlas::GlyphRangesBuilder builder;
2967 builder.AddRanges(m_glyph_ranges);
2968 builder.AddRanges(ImGui::GetIO().Fonts->GetGlyphRangesDefault());
2969 builder.AddRanges(ranges_language_independent);
2970#ifdef __APPLE__
2971 if (m_font_cjk)
2972 // Apple keyboard shortcuts are only contained in the CJK fonts.
2973 builder.AddRanges(ranges_keyboard_shortcuts);
2974#endif
2975 builder.BuildRanges(&ranges); // Build the final result (ordered ranges with all the unique characters submitted)
2976
2977 io.Fonts->Flags |= ImFontAtlasFlags_NoPowerOfTwoHeight;
2978 // TexDesiredWidth will be increased adaptively below if the built height
2979 // exceeds GL_MAX_TEXTURE_SIZE. Leave it at 0 so ImGui picks the minimum
2980 // width for small glyph sets and we only widen when actually necessary.
2981 io.Fonts->TexDesiredWidth = 0;
2982
2983 ImFontConfig cfg = ImFontConfig();
2984 cfg.OversampleH = cfg.OversampleV = 1;
2985 //FIXME replace with io.Fonts->AddFontFromMemoryTTF(buf_decompressed_data, (int)buf_decompressed_size, m_font_size, nullptr, ranges.Data);
2986 //https://github.com/ocornut/imgui/issues/220
2987
2988 // Orca: temp fix for Korean font
2989 auto font_name_regular = "HarmonyOS_Sans_SC_Regular.ttf";
2990 auto font_name_bold = "HarmonyOS_Sans_SC_Bold.ttf";
2991 // The Korean and Thai fonts cover their own script and little else, so they need the
2992 // default font merged in behind them to reach the full range.
2993 bool needs_glyph_fallback = false;
2994 if(m_glyph_ranges == ImGui::GetIO().Fonts->GetGlyphRangesKorean()) {
2995 font_name_regular = "NanumGothic-Regular.ttf";
2996 font_name_bold = "NanumGothic-Bold.ttf";
2997 needs_glyph_fallback = true;
2998 } else if (m_glyph_ranges == ImGui::GetIO().Fonts->GetGlyphRangesThai()) {
2999 font_name_regular = "Sarabun-Medium.ttf";
3000 font_name_bold = "Sarabun-SemiBold.ttf";
3001 needs_glyph_fallback = true;
3002 }
3003 default_font = io.Fonts->AddFontFromFileTTF((Slic3r::resources_dir() + "/fonts/" + font_name_regular).c_str(), m_font_size, &cfg, ranges.Data);
3004 if (default_font == nullptr) {
3005 default_font = io.Fonts->AddFontDefault();
3006 if (default_font == nullptr) {
3007 throw Slic3r::RuntimeError("ImGui: Could not load deafult font");
3008 }
3009 }
3010
3011 // A merged font only supplies glyphs the font ahead of it lacks, so this fills the gaps
3012 // without restyling anything the script font already covers.
3013 if (needs_glyph_fallback) {
3014 ImFontConfig fallback_cfg = cfg;
3015 fallback_cfg.MergeMode = true;
3016 io.Fonts->AddFontFromFileTTF((Slic3r::resources_dir() + "/fonts/HarmonyOS_Sans_SC_Regular.ttf").c_str(), m_font_size, &fallback_cfg, ranges.Data);
3017 }
3018
3019 bold_font = io.Fonts->AddFontFromFileTTF((Slic3r::resources_dir() + "/fonts/" + font_name_bold).c_str(), m_font_size, &cfg, ranges.Data);
3020 if (bold_font == nullptr) {
3021 bold_font = io.Fonts->AddFontDefault();
3022 if (bold_font == nullptr) { throw Slic3r::RuntimeError("ImGui: Could not load deafult font"); }
3023 }
3024
3025 if (needs_glyph_fallback) {
3026 ImFontConfig fallback_cfg = cfg;
3027 fallback_cfg.MergeMode = true;
3028 io.Fonts->AddFontFromFileTTF((Slic3r::resources_dir() + "/fonts/HarmonyOS_Sans_SC_Bold.ttf").c_str(), m_font_size, &fallback_cfg, ranges.Data);
3029 }
3030
3031 if (m_glyph_ranges == ImGui::GetIO().Fonts->GetGlyphRangesThai()) {
3032 default_font->Scale *= 1.25f;
3033 bold_font->Scale *= 1.25f;
3034 }
3035
3036#ifdef _WIN32
3037 // Render the text a bit larger (see GLCanvas3D::_resize() and issue #3401), but only if the scale factor
3038 // for the Display is greater than 300%.
3039 if (wxGetApp().em_unit() > 30) {
3040 default_font->Scale = 1.5f;
3041 bold_font->Scale = 1.5f;
3042 }
3043#endif
3044
3045#ifdef __APPLE__
3046 ImFontConfig config;
3047 config.MergeMode = true;
3048 if (! m_font_cjk) {
3049 // Apple keyboard shortcuts are only contained in the CJK fonts.
3050 [[maybe_unused]]ImFont *font_cjk = io.Fonts->AddFontFromFileTTF((Slic3r::resources_dir() + "/fonts/HarmonyOS_Sans_SC_Regular.ttf").c_str(), m_font_size, &config, ranges_keyboard_shortcuts);
3051 assert(font_cjk != nullptr);
3052 }
3053#endif
3054
3055 float font_scale = m_font_size/15;
3056 int icon_sz = lround(16 * font_scale); // default size of icon is 16 px
3057
3058 int rect_id = io.Fonts->CustomRects.Size; // id of the rectangle added next
3059 // add rectangles for the icons to the font atlas
3060 for (auto& icon : font_icons) {
3061 m_custom_glyph_rects_ids[icon.first] =
3062 io.Fonts->AddCustomRectFontGlyph(default_font, icon.first, icon_sz, icon_sz, 3.0 * font_scale + icon_sz);
3063 }
3064 for (auto& icon : font_icons_large) {
3065 m_custom_glyph_rects_ids[icon.first] =
3066 io.Fonts->AddCustomRectFontGlyph(default_font, icon.first, icon_sz * 2, icon_sz * 2, 3.0 * font_scale + icon_sz * 2);
3067 }
3068 for (auto& icon : font_icons_extra_large) {
3069 m_custom_glyph_rects_ids[icon.first] =
3070 io.Fonts->AddCustomRectFontGlyph(default_font, icon.first, icon_sz * 4, icon_sz * 4, 3.0 * font_scale + icon_sz * 4);
3071 }
3072
3073 // Build texture atlas, widening it if the height would exceed GL_MAX_TEXTURE_SIZE.
3074 // Increasing the width allows the packing algorithm to grow more horizontally which reduces the height.
3075 io.Fonts->Build();
3076 GLint gl_max_tex_size = 0;
3077 glsafe(::glGetIntegerv(GL_MAX_TEXTURE_SIZE, &gl_max_tex_size));
3078 constexpr int max_retries = 6;
3079 for (int attempt = 0; attempt < max_retries && io.Fonts->TexHeight > gl_max_tex_size; ++attempt) {
3080 const int width = io.Fonts->TexDesiredWidth > 0 ? io.Fonts->TexDesiredWidth : io.Fonts->TexWidth;
3081 // Both dimensions share the same limit, so widening past it would only trade an
3082 // illegal height for an illegal width.
3083 if (width * 2 > gl_max_tex_size)
3084 break;
3085 io.Fonts->TexDesiredWidth = width * 2;
3086 io.Fonts->Build();
3087 }
3088 if (io.Fonts->TexHeight > gl_max_tex_size) {
3089 // Needs both a very large glyph set and a small GL_MAX_TEXTURE_SIZE.
3090 BOOST_LOG_TRIVIAL(error) << "Font atlas " << io.Fonts->TexWidth << "x" << io.Fonts->TexHeight
3091 << " does not fit GL_MAX_TEXTURE_SIZE (" << gl_max_tex_size << ")"
3092 << " after " << max_retries << " attempts; rendering may be incomplete";
3093 }
3094
3095 unsigned char* pixels;
3096 int width, height;
3097 io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height); // Load as RGBA 32-bits (75% of the memory is wasted, but default font is so small) because it is more likely to be compatible with user's existing shaders. If your ImTextureId represent a higher-level concept than just a GL texture id, consider calling GetTexDataAsAlpha8() instead to save on GPU memory.
3098 BOOST_LOG_TRIVIAL(trace) << "Build default font texture done. width: " << width << ", height: " << height;
3099
3100 auto load_icon_from_svg = [this, &io, pixels, width, &rect_id](const std::pair<const wchar_t, std::string> icon, int icon_sz) {
3101 if (const ImFontAtlas::CustomRect* rect = io.Fonts->GetCustomRectByIndex(rect_id)) {
3102 assert(rect->Width == icon_sz);
3103 assert(rect->Height == icon_sz);
3104 unsigned outwidth, outheight;
3105 std::vector<unsigned char> raw_data = load_svg(icon.second, icon_sz, icon_sz, &outwidth, &outheight);
3106 if (!raw_data.empty()) {
3107 const ImU32* pIn = (ImU32*)raw_data.data();
3108 for (unsigned y = 0; y < outheight; y++) {
3109 ImU32* pOut = (ImU32*)pixels + (rect->Y + y) * width + (rect->X);
3110 for (unsigned x = 0; x < outwidth; x++)
3111 *pOut++ = *pIn++;
3112 }
3113 }
3114 }
3115 rect_id++;
3116 };
3117
3118 // Fill rectangles from the SVG-icons
3119 for (auto icon : font_icons) {
3120 load_icon_from_svg(icon, icon_sz);
3121 }
3122
3123 icon_sz *= 2; // default size of large icon is 32 px
3124 for (auto icon : font_icons_large) {
3125 load_icon_from_svg(icon, icon_sz);
3126 }
3127
3128 icon_sz *= 2; // default size of extra large icon is 64 px
3129 for (auto icon : font_icons_extra_large) {
3130 load_icon_from_svg(icon, icon_sz);
3131 }
3132
3133 // Upload texture to graphics system
3134 GLint last_texture;
3143 else
3144 glsafe(::glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels));
3145
3146 // Store our identifier
3147 io.Fonts->TexID = (ImTextureID)(intptr_t)m_font_texture;
3148
3149 // Restore state
3150 glsafe(::glBindTexture(GL_TEXTURE_2D, last_texture));
3151}
ImFont * default_font
Definition ImGuiWrapper.hpp:451
std::vector< unsigned char > load_svg(const std::string &bitmap_name, unsigned target_width, unsigned target_height, unsigned *outwidth, unsigned *outheight)
Definition ImGuiWrapper.cpp:2660
bool m_font_cjk
Definition ImGuiWrapper.hpp:63
#define GL_MAX_TEXTURE_SIZE
Definition gl.h:1146
#define GL_TEXTURE_MIN_FILTER
Definition gl.h:1828
#define glPixelStorei
Definition gl.h:4451
GLAD_API_CALL int GLAD_GL_EXT_texture_compression_s3tc
Definition gl.h:2167
#define GL_LINEAR
Definition gl.h:930
#define glTexParameteri
Definition gl.h:4911
int GLint
Definition gl.h:2062
#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
Definition gl.h:449
#define glGetIntegerv
Definition gl.h:3873
#define glTexImage2D
Definition gl.h:4895
#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
#define GL_TEXTURE_MAG_FILTER
Definition gl.h:1822
#define GL_TEXTURE_2D
Definition gl.h:1739
#define GL_TEXTURE_BINDING_2D
Definition gl.h:1749
#define GL_UNPACK_ROW_LENGTH
Definition gl.h:1931
static const std::map< const wchar_t, std::string > font_icons_extra_large
Definition ImGuiWrapper.cpp:184
static const std::map< const wchar_t, std::string > font_icons
Definition ImGuiWrapper.cpp:77
static const ImWchar ranges_language_independent[]
Definition ImGuiWrapper.cpp:2650
static const std::map< const wchar_t, std::string > font_icons_large
Definition ImGuiWrapper.cpp:140
void trace(unsigned int level, const char *message)
Definition utils.cpp:247
int em_unit(wxWindow *win)
Definition wxExtensions.cpp:424

References bold_font, default_font, destroy_font(), em_unit(), Slic3r::GUI::font_icons, Slic3r::GUI::font_icons_extra_large, Slic3r::GUI::font_icons_large, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, GL_LINEAR, GL_MAX_TEXTURE_SIZE, GL_RGBA, GL_TEXTURE_2D, GL_TEXTURE_BINDING_2D, GL_TEXTURE_MAG_FILTER, GL_TEXTURE_MIN_FILTER, GL_UNPACK_ROW_LENGTH, GL_UNSIGNED_BYTE, GLAD_GL_EXT_texture_compression_s3tc, glBindTexture, glGenTextures, glGetIntegerv, glPixelStorei, glsafe, glTexImage2D, glTexParameteri, load_svg(), m_custom_glyph_rects_ids, m_font_cjk, m_font_size, m_font_texture, m_glyph_ranges, Slic3r::GUI::ranges_language_independent, Slic3r::resources_dir(), and Slic3r::trace().

Referenced by new_frame().

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

◆ init_input()

void Slic3r::GUI::ImGuiWrapper::init_input ( )
private
3213{
3214 ImGuiIO& io = ImGui::GetIO();
3215
3216 // Keyboard mapping. ImGui will use those indices to peek into the io.KeysDown[] array.
3217 io.KeyMap[ImGuiKey_Tab] = WXK_TAB;
3218 io.KeyMap[ImGuiKey_LeftArrow] = WXK_LEFT;
3219 io.KeyMap[ImGuiKey_RightArrow] = WXK_RIGHT;
3220 io.KeyMap[ImGuiKey_UpArrow] = WXK_UP;
3221 io.KeyMap[ImGuiKey_DownArrow] = WXK_DOWN;
3222 io.KeyMap[ImGuiKey_PageUp] = WXK_PAGEUP;
3223 io.KeyMap[ImGuiKey_PageDown] = WXK_PAGEDOWN;
3224 io.KeyMap[ImGuiKey_Home] = WXK_HOME;
3225 io.KeyMap[ImGuiKey_End] = WXK_END;
3226 io.KeyMap[ImGuiKey_Insert] = WXK_INSERT;
3227 io.KeyMap[ImGuiKey_Delete] = WXK_DELETE;
3228 io.KeyMap[ImGuiKey_Backspace] = WXK_BACK;
3229 io.KeyMap[ImGuiKey_Space] = WXK_SPACE;
3230 io.KeyMap[ImGuiKey_Enter] = WXK_RETURN;
3231 io.KeyMap[ImGuiKey_KeyPadEnter] = WXK_NUMPAD_ENTER;
3232 io.KeyMap[ImGuiKey_Escape] = WXK_ESCAPE;
3233 io.KeyMap[ImGuiKey_A] = 'A';
3234 io.KeyMap[ImGuiKey_C] = 'C';
3235 io.KeyMap[ImGuiKey_V] = 'V';
3236 io.KeyMap[ImGuiKey_X] = 'X';
3237 io.KeyMap[ImGuiKey_Y] = 'Y';
3238 io.KeyMap[ImGuiKey_Z] = 'Z';
3239
3240 // Don't let imgui special-case Mac, wxWidgets already do that
3241 io.ConfigMacOSXBehaviors = false;
3242
3243#ifdef __APPLE__
3244 // Places the input method's candidate window at the text cursor.
3245 io.ImeSetInputScreenPosFn = [](int x, int y) {
3246 if (void* view = ImGui::GetIO().ImeWindowHandle)
3247 mac_ime_set_caret(view, x, y, int(ImGui::GetFontSize()));
3248 };
3249#endif
3250
3251 // Setup clipboard interaction callbacks
3252 io.SetClipboardTextFn = clipboard_set;
3253 io.GetClipboardTextFn = clipboard_get;
3254 io.ClipboardUserData = this;
3255}
static const char * clipboard_get(void *user_data)
Definition ImGuiWrapper.cpp:3535
static void clipboard_set(void *user_data, const char *text)
Definition ImGuiWrapper.cpp:3559
void mac_ime_set_caret(void *ns_view, int x, int y, int height)
Definition MacIME.mm:177

References clipboard_get(), clipboard_set(), and Slic3r::GUI::mac_ime_set_caret().

Referenced by ImGuiWrapper().

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

◆ init_style()

void Slic3r::GUI::ImGuiWrapper::init_style ( )
private
3258{
3259 ImGuiStyle &style = ImGui::GetStyle();
3260
3261 auto set_color = [&](ImGuiCol_ entity, ImVec4 color) {
3262 style.Colors[entity] = color;
3263 };
3264
3265 //BBS modify style
3266 // Window
3267 style.WindowRounding = 0.0f;
3268 set_color(ImGuiCol_WindowBg, COL_WINDOW_BACKGROUND);
3269 set_color(ImGuiCol_TitleBgActive, COL_WINDOW_BACKGROUND);
3270
3271 // Generics
3272 set_color(ImGuiCol_FrameBg, COL_GREY_DARK);
3273 set_color(ImGuiCol_FrameBgHovered, COL_GREY_LIGHT);
3274 set_color(ImGuiCol_FrameBgActive, COL_GREY_LIGHT);
3275
3276 // Text selection
3277 set_color(ImGuiCol_TextSelectedBg, COL_ORANGE_DARK);
3278
3279 // Buttons
3280 set_color(ImGuiCol_Button, COL_BUTTON_BACKGROUND);
3281 set_color(ImGuiCol_ButtonHovered, COL_HOVER);
3282 set_color(ImGuiCol_ButtonActive, COL_ACTIVE);
3283
3284 // Checkbox
3285 set_color(ImGuiCol_CheckMark, COL_BLUE_LIGHT);
3286
3287 // ComboBox items
3288 set_color(ImGuiCol_Header, COL_ORANGE_DARK);
3289 set_color(ImGuiCol_HeaderHovered, to_ImVec4(to_rgba(ColorRGB::ORCA(), 0.50f))); // ORCA Use orca color for headers
3290 set_color(ImGuiCol_HeaderActive, to_ImVec4(to_rgba(ColorRGB::ORCA(), 0.75f))); // ORCA Use orca color for headers
3291
3292 // Slider
3293 set_color(ImGuiCol_SliderGrab, to_ImVec4(to_rgba(ColorRGB::ORCA(), 0.50f))); // ORCA Use orca color for slider thumbs
3294 set_color(ImGuiCol_SliderGrabActive, to_ImVec4(to_rgba(ColorRGB::ORCA(), 0.75f))); // ORCA Use orca color for slider thumbs
3295
3296 // Separator
3297 set_color(ImGuiCol_Separator, COL_BLUE_LIGHT);
3298
3299 // Tabs
3300 set_color(ImGuiCol_Tab, COL_ORANGE_DARK);
3301 set_color(ImGuiCol_TabHovered, COL_BLUE_LIGHT);
3302 set_color(ImGuiCol_TabActive, COL_BLUE_LIGHT);
3303 set_color(ImGuiCol_TabUnfocused, COL_GREY_DARK);
3304 set_color(ImGuiCol_TabUnfocusedActive, COL_GREY_LIGHT);
3305
3306 // Scrollbars
3307 set_color(ImGuiCol_ScrollbarGrab, COL_ORANGE_DARK);
3308 set_color(ImGuiCol_ScrollbarGrabHovered, COL_ORANGE_LIGHT);
3309 set_color(ImGuiCol_ScrollbarGrabActive, COL_ORANGE_LIGHT);
3310}
static const ColorRGB ORCA()
Definition Color.hpp:71
static const ImVec4 COL_GREY_LIGHT
Definition ImGuiWrapper.hpp:385
static const ImVec4 COL_HOVER
Definition ImGuiWrapper.hpp:399
static const ImVec4 COL_ORANGE_LIGHT
Definition ImGuiWrapper.hpp:387
static const ImVec4 COL_ACTIVE
Definition ImGuiWrapper.hpp:400
static ImVec4 to_ImVec4(const ColorRGB &color)
Definition ImGuiWrapper.cpp:1053
static const ImVec4 COL_BLUE_LIGHT
Definition ImGuiWrapper.hpp:397
static const ImVec4 COL_GREY_DARK
Definition ImGuiWrapper.hpp:384
static const ImVec4 COL_ORANGE_DARK
Definition ImGuiWrapper.hpp:386
static const ImVec4 COL_BUTTON_BACKGROUND
Definition ImGuiWrapper.hpp:389
static const ImVec4 COL_WINDOW_BACKGROUND
Definition ImGuiWrapper.hpp:388
ColorRGBA to_rgba(const ColorRGB &other_rgb)
Definition Color.cpp:407

References COL_ACTIVE, COL_BLUE_LIGHT, COL_BUTTON_BACKGROUND, COL_GREY_DARK, COL_GREY_LIGHT, COL_HOVER, COL_ORANGE_DARK, COL_ORANGE_LIGHT, COL_WINDOW_BACKGROUND, Slic3r::ColorRGB::ORCA(), style, to_ImVec4(), and Slic3r::to_rgba().

Referenced by ImGuiWrapper().

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

◆ input_double() [1/2]

bool Slic3r::GUI::ImGuiWrapper::input_double ( const std::string & label,
const double & value,
const std::string & format = "%.3f" )
1058{
1059 return ImGui::InputDouble(label.c_str(), const_cast<double*>(&value), 0.0f, 0.0f, format.c_str(), ImGuiInputTextFlags_CharsDecimal);
1060}

References Slic3r::GUI::format().

Referenced by input_double().

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

◆ input_double() [2/2]

bool Slic3r::GUI::ImGuiWrapper::input_double ( const wxString & label,
const double & value,
const std::string & format = "%.3f" )
1063{
1064 auto label_utf8 = into_u8(label);
1065 return input_double(label_utf8, value, format);
1066}
bool input_double(const std::string &label, const double &value, const std::string &format="%.3f")
Definition ImGuiWrapper.cpp:1057

References Slic3r::GUI::format(), input_double(), and Slic3r::GUI::into_u8().

Here is the call graph for this function:

◆ input_optional_float()

bool Slic3r::GUI::ImGuiWrapper::input_optional_float ( const char * label,
std::optional< float > & v,
float step = 0.0f,
float step_fast = 0.0f,
const char * format = "%.3f",
ImGuiInputTextFlags flags = 0,
float def_val = .0f )
static
2299{
2300 auto func = [&](float &value) {
2301 return ImGui::InputFloat(label, &value, step, step_fast, format, flags);
2302 };
2303 std::function<bool(const float &)> is_default =
2304 [def_val](const float &value) -> bool {
2305 return std::fabs(value-def_val) <= std::numeric_limits<float>::epsilon();
2306 };
2307 return input_optional(v, func, is_default, def_val);
2308}

References Slic3r::GUI::format(), and Slic3r::GUI::input_optional().

Here is the call graph for this function:

◆ input_optional_int()

bool Slic3r::GUI::ImGuiWrapper::input_optional_int ( const char * label,
std::optional< int > & v,
int step = 1,
int step_fast = 100,
ImGuiInputTextFlags flags = 0,
int def_val = 0 )
static
2283{
2284 auto func = [&](int &value) {
2285 return ImGui::InputInt(label, &value, step, step_fast, flags);
2286 };
2287 std::function<bool(const int &)> is_default =
2288 [def_val](const int &value) -> bool { return value == def_val; };
2289 return input_optional(v, func, is_default, def_val);
2290}

References Slic3r::GUI::input_optional().

Here is the call graph for this function:

◆ input_vec3()

bool Slic3r::GUI::ImGuiWrapper::input_vec3 ( const std::string & label,
const Vec3d & value,
float width,
const std::string & format = "%.3f" )
1069{
1070 bool value_changed = false;
1071
1072 ImGui::BeginGroup();
1073
1074 for (int i = 0; i < 3; ++i)
1075 {
1076 std::string item_label = (i == 0) ? "X" : ((i == 1) ? "Y" : "Z");
1077 ImGui::PushID(i);
1078 ImGui::PushItemWidth(width);
1079 value_changed |= ImGui::InputDouble(item_label.c_str(), const_cast<double*>(&value(i)), 0.0f, 0.0f, format.c_str());
1080 ImGui::PopID();
1081 }
1082 ImGui::EndGroup();
1083
1084 return value_changed;
1085}

References Slic3r::GUI::format().

Here is the call graph for this function:

◆ is_char_in_ranges()

bool Slic3r::GUI::ImGuiWrapper::is_char_in_ranges ( const ImWchar * ranges,
unsigned int letter )
static
2611{
2612 for (const ImWchar *range = ranges; range[0] && range[1]; range += 2) {
2613 ImWchar from = range[0];
2614 ImWchar to = range[1];
2615 if (from <= letter && letter <= to) return true;
2616 if (letter < to) return false; // ranges should be sorted
2617 }
2618 return false;
2619};
auto range(Cont &&cont)
Definition libslic3r.h:405

References Slic3r::range().

Referenced by is_chars_in_ranges().

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

◆ is_chars_in_ranges()

bool Slic3r::GUI::ImGuiWrapper::is_chars_in_ranges ( const ImWchar * ranges,
const char * chars_ptr )
static
2623{
2624 while (*chars_ptr) {
2625 unsigned int c = 0;
2626 // UTF-8 to 32-bit character need imgui_internal
2627 int c_len = ImTextCharFromUtf8(&c, chars_ptr, NULL);
2628 chars_ptr += c_len;
2629 if (c_len == 0) break;
2630 if (!is_char_in_ranges(ranges, c)) return false;
2631 }
2632 return true;
2633}
static bool is_char_in_ranges(const ImWchar *ranges, unsigned int letter)
Definition ImGuiWrapper.cpp:2609

References is_char_in_ranges().

Referenced by contain_all_glyphs().

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

◆ item_held()

bool Slic3r::GUI::ImGuiWrapper::item_held ( ) const
2196{
2197 return ImGui::GetIO().MouseDown[0] && ImGui::GetActiveID() != 0;
2198}

Referenced by owns_keyboard().

Here is the caller graph for this function:

◆ left_inputs()

void Slic3r::GUI::ImGuiWrapper::left_inputs ( )
static

Use ImGui internals to unactivate (lose focus) in input. When input is activ it can't change value by application.

2423 {
2424 ImGui::ClearActiveID();
2425}

Referenced by Slic3r::GUI::GLGizmoEmboss::set_volume_by_selection(), and Slic3r::GUI::GLGizmoSVG::set_volume_by_selection().

Here is the caller graph for this function:

◆ load_fonts_texture()

void Slic3r::GUI::ImGuiWrapper::load_fonts_texture ( )
3154{
3155 //if (m_font_another_texture == 0) {
3156 // ImGuiIO& io = ImGui::GetIO();
3157 // io.Fonts->Flags |= ImFontAtlasFlags_NoPowerOfTwoHeight;
3158 // ImFontConfig cfg = ImFontConfig();
3159 // cfg.OversampleH = cfg.OversampleV = 1;
3160 // im_fonts_map.clear(); // map<font name, ImFont*>
3161 // BOOST_LOG_TRIVIAL(info) << "init_im_font start";
3162 // for (auto sys_font : sys_fonts_map) {
3163 // boost::filesystem::path font_path(sys_font.second);
3164 // if (!boost::filesystem::exists(font_path)) {
3165 // BOOST_LOG_TRIVIAL(trace) << "load font = " << sys_font.first << ", path = " << font_path << " is not exists";
3166 // continue;
3167 // }
3168 // ImFont* im_font = io.Fonts->AddFontFromFileTTF(sys_font.second.c_str(), m_font_size, &cfg, ImGui::GetIO().Fonts->GetGlyphRangesBasic());
3169 // if (im_font == nullptr) {
3170 // BOOST_LOG_TRIVIAL(trace) << "load font = " << sys_font.first << " failed, path = " << font_path << " is not exists";
3171 // continue;
3172 // }
3173 // im_fonts_map.insert({ sys_font.first, im_font });
3174 // }
3175 // BOOST_LOG_TRIVIAL(info) << "init_im_font end";
3176
3177 // unsigned char* pixels;
3178 // int width, height;
3179 // io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height);
3180 // BOOST_LOG_TRIVIAL(trace) << "Build system fonts texture done. width: " << width << ", height: " << height;
3181
3182 // if (m_fonts_names.size() == 0) {
3183 // std::vector<std::string> to_delete_fonts;
3184 // for (auto im_font : im_fonts_map) {
3185 // if (im_font.second->Glyphs.Size < 4) { to_delete_fonts.push_back(im_font.first); }
3186 // }
3187 // for (auto to_delete_font : to_delete_fonts) {
3188 // sys_fonts_map.erase(to_delete_font);
3189 // im_fonts_map.erase(to_delete_font);
3190 // }
3191 // for (auto im_font : im_fonts_map) m_fonts_names.push_back(im_font.first);
3192 // }
3193
3194 // GLint last_texture;
3195 // glsafe(::glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture));
3196 // glsafe(::glGenTextures(1, &(m_font_another_texture)));
3197 // glsafe(::glBindTexture(GL_TEXTURE_2D, m_font_another_texture));
3198 // glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR));
3199 // glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
3200 // glsafe(::glPixelStorei(GL_UNPACK_ROW_LENGTH, 0));
3201
3202 // glsafe(::glTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels));
3203
3204 // // Store our identifier
3205 // io.Fonts->TexID = (ImTextureID)(intptr_t)m_font_another_texture;
3206
3207 // // Restore state
3208 // glsafe(::glBindTexture(GL_TEXTURE_2D, last_texture));
3209 //}
3210}

◆ load_svg()

std::vector< unsigned char > Slic3r::GUI::ImGuiWrapper::load_svg ( const std::string & bitmap_name,
unsigned target_width,
unsigned target_height,
unsigned * outwidth,
unsigned * outheight )
private
2661{
2662 std::vector<unsigned char> empty_vector;
2663
2664 NSVGimage* image = BitmapCache::nsvgParseFromFileWithReplace(Slic3r::var(bitmap_name + ".svg").c_str(), "px", 96.0f, { { "\"#808080\"", "\"#FFFFFF\"" } });
2665 if (image == nullptr)
2666 return empty_vector;
2667
2668 float svg_scale = target_height != 0 ?
2669 (float)target_height / image->height : target_width != 0 ?
2670 (float)target_width / image->width : 1;
2671
2672 int width = (int)(svg_scale * image->width + 0.5f);
2673 int height = (int)(svg_scale * image->height + 0.5f);
2674 int n_pixels = width * height;
2675 if (n_pixels <= 0) {
2676 ::nsvgDelete(image);
2677 return empty_vector;
2678 }
2679
2680 NSVGrasterizer* rast = ::nsvgCreateRasterizer();
2681 if (rast == nullptr) {
2682 ::nsvgDelete(image);
2683 return empty_vector;
2684 }
2685
2686 std::vector<unsigned char> data(n_pixels * 4, 0);
2687 ::nsvgRasterize(rast, image, 0, 0, svg_scale, data.data(), width, height, width * 4);
2688 ::nsvgDeleteRasterizer(rast);
2689 ::nsvgDelete(image);
2690
2691 *outwidth = width;
2692 *outheight = height;
2693
2694 return data;
2695}
static NSVGimage * nsvgParseFromFileWithReplace(const char *filename, const char *units, float dpi, const std::map< std::string, std::string > &replaces)
Definition BitmapCache.cpp:289
std::string var(const std::string &file_name)
Definition utils.cpp:278

References Slic3r::GUI::BitmapCache::nsvgParseFromFileWithReplace(), and Slic3r::var().

Referenced by init_font().

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

◆ modal_popup_open()

bool Slic3r::GUI::ImGuiWrapper::modal_popup_open ( ) const
2167{
2168 return drawn_last_frame(ImGui::GetTopMostPopupModal());
2169}

References Slic3r::GUI::drawn_last_frame().

Referenced by owns_key().

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

◆ new_frame()

void Slic3r::GUI::ImGuiWrapper::new_frame ( )
580{
581 if (m_new_frame_open) {
582 return;
583 }
584
585 if (m_font_texture == 0) {
586 init_font(true);
587 }
588
589 ImGuiIO& io = ImGui::GetIO();
590
591 // ORCA ImGui times button and key repeat with io.DeltaTime. At its default of 1/60 s per frame the clock
592 // counts frames, so a held +/- button repeats as fast as the canvas renders. Feed it the real frame time,
593 // capped at 1/60 s so the idle gaps of the event-driven canvas don't count as time held.
594 const auto now = std::chrono::steady_clock::now();
595 if (m_last_frame_time != std::chrono::steady_clock::time_point{}) {
596 const float dt = std::chrono::duration<float>(now - m_last_frame_time).count();
597 io.DeltaTime = std::clamp(dt, 1e-4f, 1.f / 60.f); // ImGui asserts a positive DeltaTime
598 }
599 m_last_frame_time = now;
600
601 ImGui::NewFrame();
602 m_new_frame_open = true;
603
604 // BBL: we should render the new frame first, than reset keys' status
605 // BBL: copy & paste form prusa github repo (https://github.com/prusa3d/PrusaSlicer/blob/master/src/slic3r/GUI/ImGuiWrapper.cpp#L375C5-L402C6)
606 // synchronize key states
607 // when the application loses the focus it may happen that the key up event is not processed
608
609 // Not sure if it is neccessary
610 // values from 33 to 126 are reserved for the standard ASCII characters
611 for (size_t i = 33; i <= 126; ++i) {
612 wxKeyCode keycode = static_cast<wxKeyCode>(i);
613 if (io.KeysDown[i] && keycode != WXK_NONE && !wxGetKeyState(keycode))
614 io.KeysDown[i] = false;
615 }
616
617 // special keys: delete, backspace, ...
618 for (int key : io.KeyMap) {
619 wxKeyCode keycode = static_cast<wxKeyCode>(key);
620 if (io.KeysDown[key] && keycode != WXK_NONE && !wxGetKeyState(keycode))
621 io.KeysDown[key] = false;
622 }
623
624 // BBL: end copy & paste
625}
void init_font(bool compress)
Definition ImGuiWrapper.cpp:2956
std::chrono::steady_clock::time_point m_last_frame_time
Definition ImGuiWrapper.hpp:73

References init_font(), m_font_texture, m_last_frame_time, and m_new_frame_open.

Referenced by update_key_data(), and update_mouse_data().

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

◆ on_change_color_mode()

void Slic3r::GUI::ImGuiWrapper::on_change_color_mode ( bool is_dark)
static
2701{
2703}
static bool is_dark()
Definition TextureImportDialog.cpp:85
static bool m_is_dark_mode
Definition ImGuiWrapper.cpp:2698

References is_dark(), and Slic3r::GUI::m_is_dark_mode.

Here is the call graph for this function:

◆ owns_key()

bool Slic3r::GUI::ImGuiWrapper::owns_key ( const KeyChord & chord) const
2191{
2192 return modal_popup_open() || (chord.edits_text() && text_input_active());
2193}
bool modal_popup_open() const
Definition ImGuiWrapper.cpp:2166
bool text_input_active() const
Definition ImGuiWrapper.cpp:2151

References Slic3r::GUI::KeyChord::edits_text(), modal_popup_open(), and text_input_active().

Referenced by Slic3r::GUI::MainFrame::handle_global_shortcut().

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

◆ owns_keyboard()

bool Slic3r::GUI::ImGuiWrapper::owns_keyboard ( ) const
2201{
2202 return popup_open() || item_held() || text_input_active();
2203}
bool item_held() const
Definition ImGuiWrapper.cpp:2195
bool popup_open() const
Definition ImGuiWrapper.cpp:2171

References item_held(), popup_open(), and text_input_active().

Referenced by claim_key_event(), and Slic3r::GUI::MainFrame::init_menubar_as_editor().

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

◆ pop_bold_font()

bool Slic3r::GUI::ImGuiWrapper::pop_bold_font ( )
2050 {
2051 if (bold_font) {
2052 ImGui::PopFont();
2053 return true;
2054 }
2055 else {
2056 return false;
2057 }
2058}

References bold_font.

Referenced by Slic3r::GUI::GLCanvas3D::_render_paint_toolbar(), Slic3r::GUI::DailyTipsWindow::render(), Slic3r::GUI::DailyTipsPanel::render_controller_buttons(), and Slic3r::GUI::NotificationManager::SlicingProgressNotification::render_progress_text().

Here is the caller graph for this function:

◆ pop_button_disable_style()

void Slic3r::GUI::ImGuiWrapper::pop_button_disable_style ( )
static
2903 {
2904 ImGui::PopStyleColor(3);
2905}

Referenced by Slic3r::GUI::IMSlider::render_go_to_layer_dialog(), and Slic3r::GUI::IMSlider::render_input_custom_gcode().

Here is the caller graph for this function:

◆ pop_cancel_button_style()

void Slic3r::GUI::ImGuiWrapper::pop_cancel_button_style ( )
static
2886 {
2887 ImGui::PopStyleColor(6);
2888}

Referenced by Slic3r::GUI::GLGizmoMeasure::render_dimensioning(), Slic3r::GUI::IMSlider::render_go_to_layer_dialog(), and Slic3r::GUI::IMSlider::render_input_custom_gcode().

Here is the caller graph for this function:

◆ pop_combo_style()

◆ pop_common_window_style()

void Slic3r::GUI::ImGuiWrapper::pop_common_window_style ( )
static
2839 {
2840 ImGui::PopStyleColor(14);
2841 ImGui::PopStyleVar(5);
2842}

Referenced by Slic3r::GUI::GLCanvas3D::_render_assemble_info(), Slic3r::GUI::DesignSketchTool::draw_dim_label(), Slic3r::GUI::DailyTipsPanel::pop_styles(), Slic3r::GUI::SketchInlineEditor::render(), Slic3r::GUI::GLGizmoMeasure::render_dimensioning(), and Slic3r::GUI::DesignCanvas::render_hud().

Here is the caller graph for this function:

◆ pop_confirm_button_style()

void Slic3r::GUI::ImGuiWrapper::pop_confirm_button_style ( )
static
2863 {
2864 ImGui::PopStyleColor(6);
2865}

Referenced by Slic3r::GUI::GLGizmoMeasure::render_dimensioning(), Slic3r::GUI::IMSlider::render_go_to_layer_dialog(), Slic3r::GUI::IMSlider::render_input_custom_gcode(), and Slic3r::GUI::GCodeViewer::SequentialView::Marker::render_position_window().

Here is the caller graph for this function:

◆ pop_font_by_name()

bool Slic3r::GUI::ImGuiWrapper::pop_font_by_name ( std::string font_name)
2075{
2076 auto sys_font = im_fonts_map.find(font_name);
2077 if (sys_font != im_fonts_map.end()) {
2078 ImGui::PopFont();
2079 return true;
2080 }
2081 return false;
2082}
std::map< std::string, ImFont * > im_fonts_map
Definition ImGuiWrapper.hpp:453

References im_fonts_map.

◆ pop_menu_style()

void Slic3r::GUI::ImGuiWrapper::pop_menu_style ( )
static
2788{
2789 ImGui::PopStyleColor(4);
2790 ImGui::PopStyleVar(3);
2792}
static void pop_toolbar_style()
Definition ImGuiWrapper.cpp:2757

References pop_toolbar_style().

Referenced by Slic3r::GUI::DailyTipsWindow::render(), Slic3r::GUI::IMSlider::render_go_to_layer_dialog(), Slic3r::GUI::IMSlider::render_input_custom_gcode(), and Slic3r::GUI::IMSlider::render_menu().

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

◆ pop_radio_style()

void Slic3r::GUI::ImGuiWrapper::pop_radio_style ( )
static
2951{
2952 ImGui::PopStyleColor(2);
2953 ImGui::PopStyleVar(1);
2954}

Referenced by Slic3r::GUI::GLGizmoEmboss::draw_model_type(), Slic3r::GUI::GLGizmoSVG::draw_model_type(), and Slic3r::GUI::GLGizmoCut3D::render_connectors_input_window().

Here is the caller graph for this function:

◆ pop_toolbar_style()

void Slic3r::GUI::ImGuiWrapper::pop_toolbar_style ( )
static

◆ popup_open()

bool Slic3r::GUI::ImGuiWrapper::popup_open ( ) const
2172{
2173 const ImVector<ImGuiPopupData>& stack = ImGui::GetCurrentContext()->OpenPopupStack;
2174 return std::any_of(stack.begin(), stack.end(), [](const ImGuiPopupData& popup) { return drawn_last_frame(popup.Window); });
2175}

Referenced by owns_keyboard().

Here is the caller graph for this function:

◆ push_bold_font()

bool Slic3r::GUI::ImGuiWrapper::push_bold_font ( )
2041 {
2042 if (bold_font) {
2043 ImGui::PushFont(bold_font);
2044 return true;
2045 }
2046 else {
2047 return false;
2048 }
2049}

References bold_font.

Referenced by Slic3r::GUI::GLCanvas3D::_render_paint_toolbar(), Slic3r::GUI::DailyTipsWindow::render(), Slic3r::GUI::DailyTipsPanel::render_controller_buttons(), and Slic3r::GUI::NotificationManager::SlicingProgressNotification::render_progress_text().

Here is the caller graph for this function:

◆ push_button_disable_style()

void Slic3r::GUI::ImGuiWrapper::push_button_disable_style ( )
static
2890 {
2891 if (m_is_dark_mode) {
2892 ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(54 / 255.f, 54 / 255.f, 60 / 255.f, 1.f));
2893 ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(54 / 255.f, 54 / 255.f, 60 / 255.f, 1.f));
2894 ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.f, 1.f, 1.f, 0.4f));
2895 }
2896 else {
2897 ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(206.f / 255.f, 206.f / 255.f, 206.f / 255.f, 1.f));
2898 ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(206.f / 255.f, 206.f / 255.f, 206.f / 255.f, 1.f));
2899 ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.f, 1.f, 1.f, 1.f));
2900 }
2901}

References Slic3r::GUI::m_is_dark_mode.

Referenced by Slic3r::GUI::IMSlider::render_go_to_layer_dialog(), and Slic3r::GUI::IMSlider::render_input_custom_gcode().

Here is the caller graph for this function:

◆ push_cancel_button_style()

void Slic3r::GUI::ImGuiWrapper::push_cancel_button_style ( )
static
2867 {
2868 if (m_is_dark_mode) {
2869 ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.f, 0.f, 0.f, 0.f));
2870 ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(1.f, 1.f, 1.f, 0.64f));
2871 ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(73 / 255.f, 73 / 255.f, 78 / 255.f, 1.f));
2872 ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(129 / 255.f, 129 / 255.f, 131 / 255.f, 1.f));
2873 ImGui::PushStyleColor(ImGuiCol_CheckMark, ImVec4(1.f, 1.f, 1.f, 0.64f));
2874 ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.f, 1.f, 1.f, 0.64f));
2875 }
2876 else {
2877 ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(1.f, 1.f, 1.f, 1.f));
2878 ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(38 / 255.f, 46 / 255.f, 48 / 255.f, 1.f));
2879 ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(238.f / 255.f, 238.f / 255.f, 238.f / 255.f, 1.f));
2880 ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(206.f / 255.f, 206.f / 255.f, 206.f / 255.f, 1.f));
2881 ImGui::PushStyleColor(ImGuiCol_CheckMark, ImVec4(0.f, 0.f, 0.f, 1.f));
2882 ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(38.f / 255.0f, 46.f / 255.0f, 48.f / 255.0f, 1.00f));
2883 }
2884}

References Slic3r::GUI::m_is_dark_mode.

Referenced by Slic3r::GUI::GLGizmoMeasure::render_dimensioning(), Slic3r::GUI::IMSlider::render_go_to_layer_dialog(), and Slic3r::GUI::IMSlider::render_input_custom_gcode().

Here is the caller graph for this function:

◆ push_combo_style()

void Slic3r::GUI::ImGuiWrapper::push_combo_style ( const float scale)
static
2908{
2909 if (m_is_dark_mode) {
2910 ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 1.0f * scale);
2911 ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f * scale);
2912 ImGui::PushStyleColor(ImGuiCol_PopupBg, ImGuiWrapper::COL_WINDOW_BG_DARK);
2913 ImGui::PushStyleColor(ImGuiCol_BorderActive, ImVec4(0.f, 150.f / 255.f, 136.f / 255.f, 0.6f)); // ORCA hovered item border color
2914 ImGui::PushStyleColor(ImGuiCol_HeaderHovered, {0.f, 0.f, 0.f, 0.f}); // ORCA hovered item background color
2915 ImGui::PushStyleColor(ImGuiCol_HeaderActive, COL_ORCA);
2916 ImGui::PushStyleColor(ImGuiCol_Header, ImVec4(0.f, 150.f / 255.f, 136.f / 255.f, 0.25f)); // ORCA active item background color
2917 ImGui::PushStyleColor(ImGuiCol_ScrollbarBg, ImGuiWrapper::COL_WINDOW_BG_DARK);
2918 ImGui::PushStyleColor(ImGuiCol_Button, {1.00f, 1.00f, 1.00f, 0.0f});
2919 } else {
2920 ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 1.0f * scale);
2921 ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f * scale);
2922 ImGui::PushStyleColor(ImGuiCol_PopupBg, ImGuiWrapper::COL_WINDOW_BG);
2923 ImGui::PushStyleColor(ImGuiCol_BorderActive, ImVec4(0.f, 150.f / 255.f, 136.f / 255.f, 0.6f)); // ORCA hovered item border color
2924 ImGui::PushStyleColor(ImGuiCol_HeaderHovered, {0.f, 0.f, 0.f, 0.f}); // ORCA hovered item background color
2925 ImGui::PushStyleColor(ImGuiCol_HeaderActive, COL_ORCA);
2926 ImGui::PushStyleColor(ImGuiCol_Header, ImVec4(0.f, 150.f / 255.f, 136.f / 255.f, 0.25f)); // ORCA active item background color
2927 ImGui::PushStyleColor(ImGuiCol_ScrollbarBg, ImGuiWrapper::COL_WINDOW_BG);
2928 ImGui::PushStyleColor(ImGuiCol_Button, {1.00f, 1.00f, 1.00f, 0.0f});
2929 }
2930}
int scale(const int val)
Definition WipeTowerDialog.cpp:58
static const ImVec4 COL_WINDOW_BG_DARK
Definition ImGuiWrapper.hpp:403
static const ImVec4 COL_ORCA
Definition ImGuiWrapper.hpp:408
static const ImVec4 COL_WINDOW_BG
Definition ImGuiWrapper.hpp:402

References COL_ORCA, COL_WINDOW_BG, COL_WINDOW_BG_DARK, Slic3r::GUI::m_is_dark_mode, and scale().

Referenced by Slic3r::GUI::GLCanvas3D::_render_assemble_control(), Slic3r::GUI::GizmoObjectManipulation::do_render_move_window(), Slic3r::GUI::GizmoObjectManipulation::do_render_scale_input_window(), Slic3r::GUI::GLGizmoEmboss::draw_advanced(), Slic3r::GUI::GLGizmoSVG::draw_filename(), Slic3r::GUI::GLGizmoEmboss::draw_font_list(), Slic3r::GUI::GLGizmoEmboss::draw_style_list(), Slic3r::GUI::GLGizmoTextureDisplacement::on_render_input_window(), Slic3r::GUI::GLGizmoAssembly::render_assembly_mode_combo(), Slic3r::GUI::GLGizmoBase::render_combo(), and Slic3r::GUI::GLGizmoCut3D::render_cut_mode_combo().

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

◆ push_common_window_style()

void Slic3r::GUI::ImGuiWrapper::push_common_window_style ( const float scale)
static
2794 {
2795 if (m_is_dark_mode) {
2796 ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f * scale);
2797 ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(20.0f, 10.0f) * scale);
2798 ImGui::PushStyleVar(ImGuiStyleVar_WindowTitleAlign, ImVec2(0.05f, 0.50f) * scale);
2799 ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 3.0f * scale);
2800 ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
2801 ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 1.0f, 1.0f, 0.88f)); // 1
2802 ImGui::PushStyleColor(ImGuiCol_WindowBg, ImGuiWrapper::COL_WINDOW_BG_DARK); // 2
2803 ImGui::PushStyleColor(ImGuiCol_TitleBg, ImVec4(54 / 255.0f, 54 / 255.0f, 60 / 255.0f, 1.00f)); // 3
2804 ImGui::PushStyleColor(ImGuiCol_TitleBgActive, ImVec4(54 / 255.0f, 54 / 255.0f, 60 / 255.0f, 1.00f)); // 4
2805 ImGui::PushStyleColor(ImGuiCol_Separator, ImGuiWrapper::COL_SEPARATOR_DARK); // 5
2806 ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(1.00f, 1.00f, 1.00f, 1.00f)); // 6
2807 ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.00f, 0.59f, 0.53f, 1.00f)); // 7
2808 ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0.00f, 0.59f, 0.53f, 1.00f)); // 8
2809 ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, ImVec4(84 / 255.0f, 84 / 255.0f, 90 / 255.0f, 1.00f)); // 9
2810 ImGui::PushStyleColor(ImGuiCol_FrameBgActive, ImVec4(62 / 255.0f, 62 / 255.0f, 69 / 255.0f, 1.00f)); // 10
2811 ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(238 / 255.0f, 238 / 255.0f, 238 / 255.0f, 0.00f)); // 11
2812 ImGui::PushStyleColor(ImGuiCol_CheckMark, ImVec4(1.00f, 1.00f, 1.00f, 1.00f)); // 12
2813 ImGui::PushStyleColor(ImGuiCol_TextSelectedBg, ImVec4(43 / 255.0f, 64 / 255.0f, 54 / 255.0f, 1.00f)); // 13
2814 ImGui::PushStyleColor(ImGuiCol_PlotHistogram, ImVec4(0.00f, 0.59f, 0.53f, 1.00f)); // 14
2815 }
2816 else {
2817 ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f * scale);
2818 ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(20.0f, 10.0f) * scale);
2819 ImGui::PushStyleVar(ImGuiStyleVar_WindowTitleAlign, ImVec2(0.05f, 0.50f) * scale);
2820 ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 3.0f * scale);
2821 ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
2822 ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(38 / 255.0f, 46 / 255.0f, 48 / 255.0f, 1.00f)); // 1
2823 ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(1.00f, 1.00f, 1.00f, 1.00f)); // 2
2824 ImGui::PushStyleColor(ImGuiCol_TitleBg, ImVec4(245 / 255.0f, 245 / 255.0f, 245 / 255.0f, 1.00f)); // 3
2825 ImGui::PushStyleColor(ImGuiCol_TitleBgActive, ImVec4(245 / 255.0f, 245 / 255.0f, 245 / 255.0f, 1.00f)); // 4
2826 ImGui::PushStyleColor(ImGuiCol_Separator, ImGuiWrapper::COL_SEPARATOR); // 5
2827 ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(1.00f, 1.00f, 1.00f, 1.00f)); // 6
2828 ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.00f, 0.59f, 0.53f, 1.00f)); // 7
2829 ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0.00f, 0.59f, 0.53f, 1.00f)); // 8
2830 ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, ImVec4(238 / 255.0f, 238 / 255.0f, 238 / 255.0f, 1.00f)); // 9
2831 ImGui::PushStyleColor(ImGuiCol_FrameBgActive, ImVec4(238 / 255.0f, 238 / 255.0f, 238 / 255.0f, 1.00f)); // 10
2832 ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(238 / 255.0f, 238 / 255.0f, 238 / 255.0f, 0.00f)); // 11
2833 ImGui::PushStyleColor(ImGuiCol_CheckMark, ImVec4(1.00f, 1.00f, 1.00f, 1.00f)); // 12
2834 ImGui::PushStyleColor(ImGuiCol_TextSelectedBg, ImGuiWrapper::COL_GREEN_LIGHT); // 13
2835 ImGui::PushStyleColor(ImGuiCol_PlotHistogram, ImVec4(0.00f, 0.59f, 0.53f, 1.00f)); // 14
2836 }
2837}
static const ImVec4 COL_SEPARATOR
Definition ImGuiWrapper.hpp:406
static const ImVec4 COL_GREEN_LIGHT
Definition ImGuiWrapper.hpp:398
static const ImVec4 COL_SEPARATOR_DARK
Definition ImGuiWrapper.hpp:407

References COL_GREEN_LIGHT, COL_SEPARATOR, COL_SEPARATOR_DARK, COL_WINDOW_BG_DARK, Slic3r::GUI::m_is_dark_mode, and scale().

Referenced by Slic3r::GUI::GLCanvas3D::_render_assemble_info(), Slic3r::GUI::DesignSketchTool::draw_dim_label(), Slic3r::GUI::DailyTipsPanel::push_styles(), Slic3r::GUI::SketchInlineEditor::render(), Slic3r::GUI::GLGizmoMeasure::render_dimensioning(), and Slic3r::GUI::DesignCanvas::render_hud().

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

◆ push_confirm_button_style()

void Slic3r::GUI::ImGuiWrapper::push_confirm_button_style ( )
static
2844 {
2845 if (m_is_dark_mode) {
2846 ImGui::PushStyleColor(ImGuiCol_Button, to_ImVec4(decode_color_to_float_array("#00675b")));
2847 ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.f / 255.f, 150.f / 255.f, 136.f / 255.f, 1.f));
2848 ImGui::PushStyleColor(ImGuiCol_ButtonHovered, to_ImVec4(decode_color_to_float_array("#008172")));
2849 ImGui::PushStyleColor(ImGuiCol_ButtonActive, to_ImVec4(decode_color_to_float_array("#00675b")));
2850 ImGui::PushStyleColor(ImGuiCol_CheckMark, ImVec4(1.f, 1.f, 1.f, 0.88f));
2851 ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.f, 1.f, 1.f, 0.88f));
2852 }
2853 else {
2854 ImGui::PushStyleColor(ImGuiCol_Button, to_ImVec4(decode_color_to_float_array("#009688")));
2855 ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.f / 255.f, 150.f / 255.f, 136.f / 255.f, 1.f));
2856 ImGui::PushStyleColor(ImGuiCol_ButtonHovered, to_ImVec4(decode_color_to_float_array("#26A69A")));
2857 ImGui::PushStyleColor(ImGuiCol_ButtonActive, to_ImVec4(decode_color_to_float_array("#009688")));
2858 ImGui::PushStyleColor(ImGuiCol_CheckMark, ImVec4(1.f, 1.f, 1.f, 1.f));
2859 ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.f, 1.f, 1.f, 1.f));
2860 }
2861}
static ColorRGBA decode_color_to_float_array(const std::string color)
Definition GUI_Utils.hpp:60

References Slic3r::GUI::decode_color_to_float_array(), Slic3r::GUI::m_is_dark_mode, and to_ImVec4().

Referenced by Slic3r::GUI::GLGizmoMeasure::render_dimensioning(), Slic3r::GUI::IMSlider::render_go_to_layer_dialog(), Slic3r::GUI::IMSlider::render_input_custom_gcode(), and Slic3r::GUI::GCodeViewer::SequentialView::Marker::render_position_window().

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

◆ push_font_by_name()

bool Slic3r::GUI::ImGuiWrapper::push_font_by_name ( std::string font_name)
2060{
2061 auto sys_font = im_fonts_map.find(font_name);
2062 if (sys_font != im_fonts_map.end()) {
2063 ImFont* font = sys_font->second;
2064 if (font && font->ContainerAtlas && font->Glyphs.Size > 4)
2065 ImGui::PushFont(font);
2066 else {
2067 ImGui::PushFont(default_font);
2068 }
2069 return true;
2070 }
2071 return false;
2072}

References default_font, and im_fonts_map.

◆ push_menu_style()

void Slic3r::GUI::ImGuiWrapper::push_menu_style ( const float scale)
static
2765{
2766 if (m_is_dark_mode) {
2768 ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(10.0f, 10.0f) * scale);
2769 ImGui::PushStyleVar(ImGuiStyleVar_PopupRounding, 4.0f * scale);
2770 ImGui::PushStyleVar(ImGuiStyleVar_PopupBorderSize, 0.0f);
2771 ImGui::PushStyleColor(ImGuiCol_PopupBg, ImGuiWrapper::COL_WINDOW_BG_DARK);
2772 ImGui::PushStyleColor(ImGuiCol_Header, ImVec4(0.00f, 0.59f, 0.53f, 1.0f));
2773 ImGui::PushStyleColor(ImGuiCol_HeaderHovered, ImVec4(0.00f, 0.59f, 0.53f, 1.0f));
2774 ImGui::PushStyleColor(ImGuiCol_HeaderActive, ImVec4(0.00f, 0.59f, 0.53f, 1.0f));
2775 }
2776 else {
2778 ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(10.0f, 10.0f) * scale);
2779 ImGui::PushStyleVar(ImGuiStyleVar_PopupRounding, 4.0f * scale);
2780 ImGui::PushStyleVar(ImGuiStyleVar_PopupBorderSize, 0.0f);
2781 ImGui::PushStyleColor(ImGuiCol_PopupBg, ImGuiWrapper::COL_WINDOW_BG);
2782 ImGui::PushStyleColor(ImGuiCol_Header, ImVec4(0.00f, 0.59f, 0.53f, 1.0f));
2783 ImGui::PushStyleColor(ImGuiCol_HeaderHovered, ImVec4(0.00f, 0.59f, 0.53f, 1.0f));
2784 ImGui::PushStyleColor(ImGuiCol_HeaderActive, ImVec4(0.00f, 0.59f, 0.53f, 1.0f));
2785 }
2786}
static void push_toolbar_style(const float scale)
Definition ImGuiWrapper.cpp:2705

References COL_WINDOW_BG, COL_WINDOW_BG_DARK, Slic3r::GUI::m_is_dark_mode, push_toolbar_style(), and scale().

Referenced by Slic3r::GUI::DailyTipsWindow::render(), Slic3r::GUI::IMSlider::render_go_to_layer_dialog(), Slic3r::GUI::IMSlider::render_input_custom_gcode(), and Slic3r::GUI::IMSlider::render_menu().

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

◆ push_radio_style()

void Slic3r::GUI::ImGuiWrapper::push_radio_style ( const float scale)
static
2939{
2940 ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(1.5f, 1.5f) * scale); // ORCA ensure icon size stays consistent
2941 if (m_is_dark_mode) {
2942 ImGui::PushStyleColor(ImGuiCol_CheckMark, to_ImVec4(decode_color_to_float_array("#009688"))); // ORCA use orca color for radio buttons
2943 ImGui::PushStyleColor(ImGuiCol_Border , to_ImVec4(decode_color_to_float_array("#949494"))); // ORCA match border color
2944 } else {
2945 ImGui::PushStyleColor(ImGuiCol_CheckMark, to_ImVec4(decode_color_to_float_array("#009688"))); // ORCA use orca color for radio buttons
2946 ImGui::PushStyleColor(ImGuiCol_Border , to_ImVec4(decode_color_to_float_array("#7C8282"))); // ORCA match border color
2947 }
2948}

References Slic3r::GUI::decode_color_to_float_array(), Slic3r::GUI::m_is_dark_mode, scale(), and to_ImVec4().

Referenced by Slic3r::GUI::GLGizmoEmboss::draw_model_type(), Slic3r::GUI::GLGizmoSVG::draw_model_type(), and Slic3r::GUI::GLGizmoCut3D::render_connectors_input_window().

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

◆ push_toolbar_style()

void Slic3r::GUI::ImGuiWrapper::push_toolbar_style ( const float scale)
static
2706{
2707 if (m_is_dark_mode) {
2708 ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f * scale);
2709 ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(20.0f, 10.0f) * scale);
2710 ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 3.0f * scale);
2711 ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
2712 ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 2.0f * scale);
2713 ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(10.0f, 10.0f) * scale);
2714 ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 1.0f, 1.0f, 0.88f)); // 1
2715 ImGui::PushStyleColor(ImGuiCol_WindowBg, ImGuiWrapper::COL_WINDOW_BG_DARK); // 2
2716 ImGui::PushStyleColor(ImGuiCol_TitleBg, ImGuiWrapper::COL_TITLE_BG); // 3
2717 ImGui::PushStyleColor(ImGuiCol_TitleBgActive, ImGuiWrapper::COL_TITLE_BG); // 4
2718 ImGui::PushStyleColor(ImGuiCol_Separator, ImGuiWrapper::COL_SEPARATOR_DARK); // 5
2719 ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(62 / 255.0f, 62 / 255.0f, 69 / 255.0f, 1.00f)); // 6
2720 ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(73 / 255.0f, 73 / 255.0f, 78 / 255.0f, 1.00f)); // 7
2721 ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(73 / 255.0f, 73 / 255.0f, 78 / 255.0f, 1.00f)); // 8
2722 ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, ImVec4(84 / 255.0f, 84 / 255.0f, 90 / 255.0f, 1.00f)); // 9
2723 ImGui::PushStyleColor(ImGuiCol_FrameBgActive, ImVec4(62 / 255.0f, 62 / 255.0f, 69 / 255.0f, 1.00f)); // 10
2724 ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(238 / 255.0f, 238 / 255.0f, 238 / 255.0f, 0.00f)); // 11
2725 ImGui::PushStyleColor(ImGuiCol_TextSelectedBg, ImVec4(43 / 255.0f, 64 / 255.0f, 54 / 255.0f, 1.00f)); // 12
2726 ImGui::PushStyleColor(ImGuiCol_CheckMark, ImVec4(1.00f, 1.00f, 1.00f, 1.00f)); // 13
2727 ImGui::PushStyleColor(ImGuiCol_ScrollbarGrab, ImVec4(0.42f, 0.42f, 0.42f, 1.00f)); // 14
2728 ImGui::PushStyleColor(ImGuiCol_ScrollbarGrabHovered, ImVec4(0.93f, 0.93f, 0.93f, 1.00f)); // 15
2729 ImGui::PushStyleColor(ImGuiCol_ScrollbarGrabActive, ImVec4(0.93f, 0.93f, 0.93f, 1.00f)); // 16
2730 }
2731 else {
2732 ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f * scale);
2733 ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(20.0f, 10.0f) * scale);
2734 ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 3.0f * scale);
2735 ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
2736 ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 2.0f * scale);
2737 ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(10.0f, 10.0f) * scale);
2738 ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(50 / 255.0f, 58 / 255.0f, 61 / 255.0f, 1.00f)); // 1
2739 ImGui::PushStyleColor(ImGuiCol_WindowBg, ImGuiWrapper::COL_WINDOW_BG); // 2
2740 ImGui::PushStyleColor(ImGuiCol_TitleBg, ImGuiWrapper::COL_TITLE_BG); // 3
2741 ImGui::PushStyleColor(ImGuiCol_TitleBgActive, ImGuiWrapper::COL_TITLE_BG); // 4
2742 ImGui::PushStyleColor(ImGuiCol_Separator, ImGuiWrapper::COL_SEPARATOR); // 5
2743 ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(1.00f, 1.00f, 1.00f, 1.00f)); // 6
2744 ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImGuiWrapper::COL_HOVER); // 7
2745 ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, ImVec4(238 / 255.0f, 238 / 255.0f, 238 / 255.0f, 1.00f)); // 8
2746 ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(172 / 255.0f, 172 / 255.0f, 172 / 255.0f, 1.00f)); // 9
2747 ImGui::PushStyleColor(ImGuiCol_FrameBgActive, ImVec4(238 / 255.0f, 238 / 255.0f, 238 / 255.0f, 1.00f)); // 10
2748 ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(238 / 255.0f, 238 / 255.0f, 238 / 255.0f, 0.00f)); // 11
2749 ImGui::PushStyleColor(ImGuiCol_TextSelectedBg, COL_GREEN_LIGHT); // 12
2750 ImGui::PushStyleColor(ImGuiCol_CheckMark, ImVec4(1.00f, 1.00f, 1.00f, 1.00f));//13
2751 ImGui::PushStyleColor(ImGuiCol_ScrollbarGrab, ImVec4(0.42f, 0.42f, 0.42f, 1.00f));
2752 ImGui::PushStyleColor(ImGuiCol_ScrollbarGrabHovered, ImVec4(0.93f, 0.93f, 0.93f, 1.00f));
2753 ImGui::PushStyleColor(ImGuiCol_ScrollbarGrabActive, ImVec4(0.93f, 0.93f, 0.93f, 1.00f));
2754 }
2755}
static const ImVec4 COL_TITLE_BG
Definition ImGuiWrapper.hpp:401

References COL_GREEN_LIGHT, COL_HOVER, COL_SEPARATOR, COL_SEPARATOR_DARK, COL_TITLE_BG, COL_WINDOW_BG, COL_WINDOW_BG_DARK, Slic3r::GUI::m_is_dark_mode, and scale().

Referenced by Slic3r::GUI::GLCanvas3D::_render_arrange_menu(), Slic3r::GUI::GLCanvas3D::_render_assemble_control(), Slic3r::GUI::GLCanvas3D::_render_orient_menu(), Slic3r::GUI::GLCanvas3D::_render_section_view_panel(), Slic3r::GUI::GizmoObjectManipulation::do_render_move_window(), Slic3r::GUI::GizmoObjectManipulation::do_render_rotate_window(), Slic3r::GUI::GizmoObjectManipulation::do_render_scale_input_window(), 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::GLGizmoSVG::on_render_input_window(), Slic3r::GUI::GLGizmoTextureDisplacement::on_render_input_window(), push_menu_style(), Slic3r::GUI::Mouse3DController::render_settings_dialog(), and Slic3r::GUI::GLCanvas3D::LayersEditing::render_variable_layer_height_dialog().

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

◆ radio_button()

bool Slic3r::GUI::ImGuiWrapper::radio_button ( const wxString & label,
bool active )
1048{
1049 auto label_utf8 = into_u8(label);
1050 return ImGui::RadioButton(label_utf8.c_str(), active);
1051}

References Slic3r::GUI::into_u8().

Here is the call graph for this function:

◆ read_glsl_version()

void Slic3r::GUI::ImGuiWrapper::read_glsl_version ( )

◆ render()

void Slic3r::GUI::ImGuiWrapper::render ( ImDrawData * draw_data)
640{
641 render_draw_data(draw_data);
642}
void render_draw_data(ImDrawData *draw_data)
Definition ImGuiWrapper.cpp:3312

References render_draw_data().

Here is the call graph for this function:

◆ render_draw_data()

void Slic3r::GUI::ImGuiWrapper::render_draw_data ( ImDrawData * draw_data)
private
3313{
3314 if (draw_data == nullptr || draw_data->CmdListsCount == 0)
3315 return;
3316
3317 GLShaderProgram* shader = wxGetApp().get_shader("imgui");
3318 if (shader == nullptr)
3319 return;
3320
3321 // Avoid rendering when minimized, scale coordinates for retina displays (screen coordinates != framebuffer coordinates)
3322 ImGuiIO& io = ImGui::GetIO();
3323 const int fb_width = (int)(draw_data->DisplaySize.x * io.DisplayFramebufferScale.x);
3324 const int fb_height = (int)(draw_data->DisplaySize.y * io.DisplayFramebufferScale.y);
3325 if (fb_width == 0 || fb_height == 0)
3326 return;
3327
3328 GLShaderProgram* curr_shader = wxGetApp().get_current_shader();
3329 if (curr_shader != nullptr)
3330 curr_shader->stop_using();
3331
3332 shader->start_using();
3333
3334 // Backup GL state
3335 GLenum last_active_texture; glsafe(::glGetIntegerv(GL_ACTIVE_TEXTURE, (GLint*)&last_active_texture));
3336 GLuint last_program; glsafe(::glGetIntegerv(GL_CURRENT_PROGRAM, (GLint*)&last_program));
3337 GLuint last_texture; glsafe(::glGetIntegerv(GL_TEXTURE_BINDING_2D, (GLint*)&last_texture));
3338 GLuint last_array_buffer; glsafe(::glGetIntegerv(GL_ARRAY_BUFFER_BINDING, (GLint*)&last_array_buffer));
3339 GLuint last_vertex_array_object = 0;
3340#if !SLIC3R_OPENGL_ES
3341 if (OpenGLManager::get_gl_info().is_core_profile())
3342#endif // !SLIC3R_OPENGL_ES
3343 glsafe(::glGetIntegerv(GL_VERTEX_ARRAY_BINDING, (GLint*)&last_vertex_array_object));
3344 GLint last_viewport[4]; glsafe(::glGetIntegerv(GL_VIEWPORT, last_viewport));
3345 GLint last_scissor_box[4]; glsafe(::glGetIntegerv(GL_SCISSOR_BOX, last_scissor_box));
3346 GLenum last_blend_src_rgb; glsafe(::glGetIntegerv(GL_BLEND_SRC_RGB, (GLint*)&last_blend_src_rgb));
3347 GLenum last_blend_dst_rgb; glsafe(::glGetIntegerv(GL_BLEND_DST_RGB, (GLint*)&last_blend_dst_rgb));
3348 GLenum last_blend_src_alpha; glsafe(::glGetIntegerv(GL_BLEND_SRC_ALPHA, (GLint*)&last_blend_src_alpha));
3349 GLenum last_blend_dst_alpha; glsafe(::glGetIntegerv(GL_BLEND_DST_ALPHA, (GLint*)&last_blend_dst_alpha));
3350 GLenum last_blend_equation_rgb; glsafe(::glGetIntegerv(GL_BLEND_EQUATION_RGB, (GLint*)&last_blend_equation_rgb));
3351 GLenum last_blend_equation_alpha; glsafe(::glGetIntegerv(GL_BLEND_EQUATION_ALPHA, (GLint*)&last_blend_equation_alpha));
3352 GLboolean last_enable_blend = ::glIsEnabled(GL_BLEND);
3353 GLboolean last_enable_cull_face = ::glIsEnabled(GL_CULL_FACE);
3354 GLboolean last_enable_depth_test = ::glIsEnabled(GL_DEPTH_TEST);
3355 GLboolean last_enable_stencil_test = ::glIsEnabled(GL_STENCIL_TEST);
3356 GLboolean last_enable_scissor_test = ::glIsEnabled(GL_SCISSOR_TEST);
3357
3358 // set new GL state
3367
3368 // Setup viewport, orthographic projection matrix
3369 // Our visible imgui space lies from draw_data->DisplayPos (top left) to draw_data->DisplayPos+data_data->DisplaySize (bottom right). DisplayPos is (0,0) for single viewport apps.
3370 glsafe(::glViewport(0, 0, (GLsizei)fb_width, (GLsizei)fb_height));
3371 const float L = draw_data->DisplayPos.x;
3372 const float R = draw_data->DisplayPos.x + draw_data->DisplaySize.x;
3373 const float T = draw_data->DisplayPos.y;
3374 const float B = draw_data->DisplayPos.y + draw_data->DisplaySize.y;
3375
3376 Matrix4f ortho_projection;
3377 ortho_projection <<
3378 2.0f / (R - L), 0.0f, 0.0f, (R + L) / (L - R),
3379 0.0f, 2.0f / (T - B), 0.0f, (T + B) / (B - T),
3380 0.0f, 0.0f, -1.0f, 0.0f,
3381 0.0f, 0.0f, 0.0f, 1.0f;
3382
3383 shader->set_uniform("Texture", 0);
3384 shader->set_uniform("ProjMtx", ortho_projection);
3385
3386 const uint8_t stage = 0;
3387 shader->set_uniform("s_texture", stage);
3388
3389 // Will project scissor/clipping rectangles into framebuffer space
3390 const ImVec2 clip_off = draw_data->DisplayPos; // (0,0) unless using multi-viewports
3391 const ImVec2 clip_scale = draw_data->FramebufferScale; // (1,1) unless using retina display which are often (2,2)
3392
3393 // Render command lists
3394 for (int n = 0; n < draw_data->CmdListsCount; ++n) {
3395 const ImDrawList* cmd_list = draw_data->CmdLists[n];
3396 const ImDrawVert* vtx_buffer = cmd_list->VtxBuffer.Data;
3397 const ImDrawIdx* idx_buffer = cmd_list->IdxBuffer.Data;
3398 const GLsizeiptr vtx_buffer_size = (GLsizeiptr)cmd_list->VtxBuffer.Size * (int)sizeof(ImDrawVert);
3399 const GLsizeiptr idx_buffer_size = (GLsizeiptr)cmd_list->IdxBuffer.Size * (int)sizeof(ImDrawIdx);
3400
3401 GLuint vao_id = 0;
3402#if !SLIC3R_OPENGL_ES
3403 if (OpenGLManager::get_gl_info().is_core_profile()) {
3404#endif // !SLIC3R_OPENGL_ES
3405 glsafe(::glGenVertexArrays(1, &vao_id));
3406 glsafe(::glBindVertexArray(vao_id));
3407#if !SLIC3R_OPENGL_ES
3408 }
3409#endif // !SLIC3R_OPENGL_ES
3410
3411 GLuint vbo_id;
3412 glsafe(::glGenBuffers(1, &vbo_id));
3414 glsafe(::glBufferData(GL_ARRAY_BUFFER, vtx_buffer_size, vtx_buffer, GL_STATIC_DRAW));
3415
3416 GLuint ibo_id;
3417 glsafe(::glGenBuffers(1, &ibo_id));
3419 glsafe(::glBufferData(GL_ELEMENT_ARRAY_BUFFER, idx_buffer_size, idx_buffer, GL_STATIC_DRAW));
3420
3421 const int position_id = shader->get_attrib_location("Position");
3422 if (position_id != -1) {
3423 glsafe(::glVertexAttribPointer(position_id, 2, GL_FLOAT, GL_FALSE, sizeof(ImDrawVert), (const void*)IM_OFFSETOF(ImDrawVert, pos)));
3424 glsafe(::glEnableVertexAttribArray(position_id));
3425 }
3426 const int uv_id = shader->get_attrib_location("UV");
3427 if (uv_id != -1) {
3428 glsafe(::glVertexAttribPointer(uv_id, 2, GL_FLOAT, GL_FALSE, sizeof(ImDrawVert), (const void*)IM_OFFSETOF(ImDrawVert, uv)));
3430 }
3431 const int color_id = shader->get_attrib_location("Color");
3432 if (color_id != -1) {
3433 glsafe(::glVertexAttribPointer(color_id, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(ImDrawVert), (const void*)IM_OFFSETOF(ImDrawVert, col)));
3435 }
3436
3437 for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; ++cmd_i) {
3438 const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
3439 if (pcmd->UserCallback)
3440 // User callback (registered via ImDrawList::AddCallback)
3441 pcmd->UserCallback(cmd_list, pcmd);
3442 else {
3443 // Project scissor/clipping rectangles into framebuffer space
3444 const ImVec2 clip_min((pcmd->ClipRect.x - clip_off.x) * clip_scale.x, (pcmd->ClipRect.y - clip_off.y) * clip_scale.y);
3445 const ImVec2 clip_max((pcmd->ClipRect.z - clip_off.x) * clip_scale.x, (pcmd->ClipRect.w - clip_off.y) * clip_scale.y);
3446 if (clip_max.x <= clip_min.x || clip_max.y <= clip_min.y)
3447 continue;
3448
3449 // Apply scissor/clipping rectangle (Y is inverted in OpenGL)
3450 glsafe(::glScissor((int)clip_min.x, (int)(fb_height - clip_max.y), (int)(clip_max.x - clip_min.x), (int)(clip_max.y - clip_min.y)));
3451
3452 // Bind texture, Draw
3454 glsafe(::glBindTexture(GL_TEXTURE_2D, (GLuint)(intptr_t)pcmd->GetTexID()));
3455 glsafe(::glDrawElements(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, (void*)(intptr_t)(pcmd->IdxOffset * sizeof(ImDrawIdx))));
3456 }
3457 }
3458
3459 if (position_id != -1)
3461 if (uv_id != -1)
3463 if (color_id != -1)
3465
3468
3469 glsafe(::glDeleteBuffers(1, &ibo_id));
3470 glsafe(::glDeleteBuffers(1, &vbo_id));
3471#if !SLIC3R_OPENGL_ES
3472 if (OpenGLManager::get_gl_info().is_core_profile()) {
3473#endif // !SLIC3R_OPENGL_ES
3474 if (vao_id > 0)
3475 glsafe(::glDeleteVertexArrays(1, &vao_id));
3476#if !SLIC3R_OPENGL_ES
3477 }
3478#endif // !SLIC3R_OPENGL_ES
3479 }
3480
3481 // Restore modified GL state
3482 glsafe(::glBindTexture(GL_TEXTURE_2D, last_texture));
3483 glsafe(::glActiveTexture(last_active_texture));
3484#if !SLIC3R_OPENGL_ES
3485 if (OpenGLManager::get_gl_info().is_core_profile())
3486#endif // !SLIC3R_OPENGL_ES
3487 glsafe(::glBindVertexArray(last_vertex_array_object));
3488 glsafe(::glBindBuffer(GL_ARRAY_BUFFER, last_array_buffer));
3489 glsafe(::glBlendEquationSeparate(last_blend_equation_rgb, last_blend_equation_alpha));
3490 glsafe(::glBlendFuncSeparate(last_blend_src_rgb, last_blend_dst_rgb, last_blend_src_alpha, last_blend_dst_alpha));
3491 if (last_enable_blend) glsafe(::glEnable(GL_BLEND)); else glsafe(::glDisable(GL_BLEND));
3492 if (last_enable_cull_face) glsafe(::glEnable(GL_CULL_FACE)); else glsafe(::glDisable(GL_CULL_FACE));
3493 if (last_enable_depth_test) glsafe(::glEnable(GL_DEPTH_TEST)); else glsafe(::glDisable(GL_DEPTH_TEST));
3494 if (last_enable_stencil_test) glsafe(::glEnable(GL_STENCIL_TEST)); else glsafe(::glDisable(GL_STENCIL_TEST));
3495 if (last_enable_scissor_test) glsafe(::glEnable(GL_SCISSOR_TEST)); else glsafe(::glDisable(GL_SCISSOR_TEST));
3496 glsafe(::glViewport(last_viewport[0], last_viewport[1], (GLsizei)last_viewport[2], (GLsizei)last_viewport[3]));
3497 glsafe(::glScissor(last_scissor_box[0], last_scissor_box[1], (GLsizei)last_scissor_box[2], (GLsizei)last_scissor_box[3]));
3498
3499 shader->stop_using();
3500
3501 if (curr_shader != nullptr)
3502 curr_shader->start_using();
3503}
#define L(s)
Definition ExtrusionEntity.cpp:25
static const GLInfo & get_gl_info()
Definition OpenGLManager.hpp:106
#define GL_TRUE
Definition gl.h:1892
#define glDisableVertexAttribArray
Definition gl.h:3613
#define GL_TEXTURE0
Definition gl.h:1705
#define glGenBuffers
Definition gl.h:3769
#define GL_BLEND_DST_ALPHA
Definition gl.h:278
#define glDeleteVertexArrays
Definition gl.h:3591
#define glBlendFuncSeparate
Definition gl.h:3327
#define GL_CURRENT_PROGRAM
Definition gl.h:508
#define GL_BLEND_EQUATION_RGB
Definition gl.h:282
#define GL_UNSIGNED_SHORT
Definition gl.h:1975
#define glBindBuffer
Definition gl.h:3267
#define glEnable
Definition gl.h:3667
khronos_ssize_t GLsizeiptr
Definition gl.h:2095
#define glBindVertexArray
Definition gl.h:3307
#define GL_DEPTH_TEST
Definition gl.h:574
#define glBlendEquation
Definition gl.h:3317
#define GL_STENCIL_TEST
Definition gl.h:1664
#define GL_SRC_ALPHA
Definition gl.h:1621
#define glDeleteBuffers
Definition gl.h:3563
#define glScissor
Definition gl.h:4717
#define GL_ARRAY_BUFFER_BINDING
Definition gl.h:239
#define GL_TRIANGLES
Definition gl.h:1887
#define GL_UNSIGNED_INT
Definition gl.h:1940
#define GL_FLOAT
Definition gl.h:660
#define glEnableVertexAttribArray
Definition gl.h:3673
#define GL_ACTIVE_TEXTURE
Definition gl.h:204
#define GL_ARRAY_BUFFER
Definition gl.h:238
#define glGenVertexArrays
Definition gl.h:3791
unsigned int GLenum
Definition gl.h:2054
#define GL_VIEWPORT
Definition gl.h:2021
#define glDrawElements
Definition gl.h:3633
#define GL_BLEND_EQUATION_ALPHA
Definition gl.h:281
#define glVertexAttribPointer
Definition gl.h:5315
#define GL_CULL_FACE
Definition gl.h:500
int GLsizei
Definition gl.h:2065
#define glBufferData
Definition gl.h:3339
unsigned char GLboolean
Definition gl.h:2055
#define GL_BLEND
Definition gl.h:275
unsigned int GLuint
Definition gl.h:2063
#define GL_ONE_MINUS_SRC_ALPHA
Definition gl.h:1239
#define GL_ONE
Definition gl.h:1232
#define glViewport
Definition gl.h:5333
#define GL_STATIC_DRAW
Definition gl.h:1633
#define GL_FALSE
Definition gl.h:648
#define GL_SCISSOR_TEST
Definition gl.h:1550
#define glIsEnabled
Definition gl.h:4165
#define GL_BLEND_DST_RGB
Definition gl.h:279
#define GL_ELEMENT_ARRAY_BUFFER
Definition gl.h:636
#define glDisable
Definition gl.h:3607
#define GL_SCISSOR_BOX
Definition gl.h:1549
#define GL_BLEND_SRC_RGB
Definition gl.h:285
#define glBlendEquationSeparate
Definition gl.h:3319
#define glActiveTexture
Definition gl.h:3245
#define GL_BLEND_SRC_ALPHA
Definition gl.h:284
#define GL_FUNC_ADD
Definition gl.h:766
#define GL_VERTEX_ARRAY_BINDING
Definition gl.h:1989
Eigen::Matrix< float, 4, 4, Eigen::DontAlign > Matrix4f
Definition Point.hpp:87

References Slic3r::GLShaderProgram::get_attrib_location(), Slic3r::GUI::OpenGLManager::get_gl_info(), GL_ACTIVE_TEXTURE, GL_ARRAY_BUFFER, GL_ARRAY_BUFFER_BINDING, GL_BLEND, GL_BLEND_DST_ALPHA, GL_BLEND_DST_RGB, GL_BLEND_EQUATION_ALPHA, GL_BLEND_EQUATION_RGB, GL_BLEND_SRC_ALPHA, GL_BLEND_SRC_RGB, GL_CULL_FACE, GL_CURRENT_PROGRAM, GL_DEPTH_TEST, GL_ELEMENT_ARRAY_BUFFER, GL_FALSE, GL_FLOAT, GL_FUNC_ADD, GL_ONE, GL_ONE_MINUS_SRC_ALPHA, GL_SCISSOR_BOX, GL_SCISSOR_TEST, GL_SRC_ALPHA, GL_STATIC_DRAW, GL_STENCIL_TEST, GL_TEXTURE0, GL_TEXTURE_2D, GL_TEXTURE_BINDING_2D, GL_TRIANGLES, GL_TRUE, GL_UNSIGNED_BYTE, GL_UNSIGNED_INT, GL_UNSIGNED_SHORT, GL_VERTEX_ARRAY_BINDING, GL_VIEWPORT, glActiveTexture, glBindBuffer, glBindTexture, glBindVertexArray, glBlendEquation, glBlendEquationSeparate, glBlendFuncSeparate, glBufferData, glDeleteBuffers, glDeleteVertexArrays, glDisable, glDisableVertexAttribArray, glDrawElements, glEnable, glEnableVertexAttribArray, glGenBuffers, glGenVertexArrays, glGetIntegerv, glIsEnabled, glsafe, glScissor, glVertexAttribPointer, glViewport, L, Slic3r::GLShaderProgram::set_uniform(), Slic3r::GLShaderProgram::start_using(), and Slic3r::GLShaderProgram::stop_using().

Referenced by render().

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

◆ request_frames_while_held()

void Slic3r::GUI::ImGuiWrapper::request_frames_while_held ( )
inline
370 {
371 if (ImGui::IsItemActive() && ImGui::IsMouseDown(ImGuiMouseButton_Left))
373 }
void set_requires_extra_frame()
Definition ImGuiWrapper.hpp:365

References set_requires_extra_frame().

Here is the call graph for this function:

◆ requires_extra_frame()

bool Slic3r::GUI::ImGuiWrapper::requires_extra_frame ( ) const
inline
364{ return m_requires_extra_frame; }

◆ reset_requires_extra_frame()

void Slic3r::GUI::ImGuiWrapper::reset_requires_extra_frame ( )
inline
366{ m_requires_extra_frame = false; }

◆ scaled() [1/2]

◆ scaled() [2/2]

ImVec2 Slic3r::GUI::ImGuiWrapper::scaled ( float x,
float y ) const
inline
120{ return ImVec2(x * m_font_size, y * m_font_size); }

References m_font_size.

◆ search_list()

void Slic3r::GUI::ImGuiWrapper::search_list ( const ImVec2 & size,
bool(* items_getter )(int, const char **label, const char **tooltip),
char * search_str,
Search::OptionViewParameters & view_params,
int & selected,
bool & edited,
int & mouse_wheel,
bool is_localized )
1906{
1907 int& hovered_id = view_params.hovered_id;
1908 // ImGui::ListBoxHeader("", size);
1909 {
1910 // rewrote part of function to add a TextInput instead of label Text
1911 ImGuiContext& g = *GImGui;
1912 ImGuiWindow* window = ImGui::GetCurrentWindow();
1913 if (window->SkipItems)
1914 return ;
1915
1916 const ImGuiStyle& style = g.Style;
1917
1918 // Size default to hold ~7 items. Fractional number of items helps seeing that we can scroll down/up without looking at scrollbar.
1919 ImVec2 size = ImGui::CalcItemSize(size_, ImGui::CalcItemWidth(), ImGui::GetTextLineHeightWithSpacing() * 7.4f + style.ItemSpacing.y);
1920 ImRect frame_bb(window->DC.CursorPos, ImVec2(window->DC.CursorPos.x + size.x, window->DC.CursorPos.y + size.y));
1921
1922 ImRect bb(frame_bb.Min, frame_bb.Max);
1923 window->DC.LastItemRect = bb; // Forward storage for ListBoxFooter.. dodgy.
1924 g.NextItemData.ClearFlags();
1925
1926 if (!ImGui::IsRectVisible(bb.Min, bb.Max))
1927 {
1928 ImGui::ItemSize(bb.GetSize(), style.FramePadding.y);
1929 ImGui::ItemAdd(bb, 0, &frame_bb);
1930 return ;
1931 }
1932
1933 ImGui::BeginGroup();
1934
1935 const ImGuiID id = ImGui::GetID(search_str);
1936 ImVec2 search_size = ImVec2(size.x, ImGui::GetTextLineHeightWithSpacing() + style.ItemSpacing.y);
1937
1938 if (!ImGui::IsAnyItemFocused() && !ImGui::IsAnyItemActive() && !ImGui::IsMouseClicked(0))
1939 ImGui::SetKeyboardFocusHere(0);
1940
1941 // The press on Esc key invokes editing of InputText (removes last changes)
1942 // So we should save previous value...
1943 std::string str = search_str;
1944 ImGui::InputTextEx("", NULL, search_str, 40, search_size, ImGuiInputTextFlags_AutoSelectAll, NULL, NULL);
1945 edited = ImGui::IsItemEdited();
1946 if (edited)
1947 hovered_id = 0;
1948
1949 process_key_down(ImGuiKey_Escape, [&selected, search_str, str]() {
1950 // use 9999 to mark selection as a Esc key
1951 selected = 9999;
1952 // ... and when Esc key was pressed, than revert search_str value
1953 strcpy(search_str, str.c_str());
1954 });
1955
1956 ImGui::BeginChildFrame(id, frame_bb.GetSize());
1957 }
1958
1959 int i = 0;
1960 const char* item_text;
1961 const char* tooltip;
1962 int mouse_hovered = -1;
1963
1964 while (items_getter(i, &item_text, &tooltip))
1965 {
1966 selectable(item_text, i == hovered_id);
1967
1968 if (ImGui::IsItemHovered()) {
1969 ImGui::SetTooltip("%s", /*item_text*/tooltip);
1970 hovered_id = -1;
1971 mouse_hovered = i;
1972 }
1973
1974 if (ImGui::IsItemClicked())
1975 selected = i;
1976 i++;
1977 }
1978
1979 // Process mouse wheel
1980 if (mouse_hovered > 0)
1981 process_mouse_wheel(mouse_wheel);
1982
1983 // process Up/DownArrows and Enter
1984 process_key_down(ImGuiKey_UpArrow, [&hovered_id, mouse_hovered]() {
1985 if (mouse_hovered > 0)
1986 scroll_up();
1987 else {
1988 if (hovered_id > 0)
1989 --hovered_id;
1990 scroll_y(hovered_id);
1991 }
1992 });
1993
1994 process_key_down(ImGuiKey_DownArrow, [&hovered_id, mouse_hovered, i]() {
1995 if (mouse_hovered > 0)
1996 scroll_down();
1997 else {
1998 if (hovered_id < 0)
1999 hovered_id = 0;
2000 else if (hovered_id < i - 1)
2001 ++hovered_id;
2002 scroll_y(hovered_id);
2003 }
2004 });
2005
2006 process_key_down(ImGuiKey_Enter, [&selected, hovered_id]() {
2007 selected = hovered_id;
2008 });
2009
2010 ImGui::ListBoxFooter();
2011
2012 auto check_box = [&edited, this](const wxString& label, bool& check) {
2013 ImGui::SameLine();
2014 bool ch = check;
2015 checkbox(label, ch);
2016 if (ImGui::IsItemClicked()) {
2017 check = !check;
2018 edited = true;
2019 }
2020 };
2021
2022 ImGui::AlignTextToFramePadding();
2023
2024 // add checkboxes for show/hide Categories and Groups
2025 //text(_L("Use for search")+":");
2026 //check_box(_L("Category"), view_params.category);
2027 //if (is_localized)
2028 // check_box(_L("Search in English"), view_params.english);
2029}
bool checkbox(const wxString &label, bool &value)
Definition ImGuiWrapper.cpp:1087
static void scroll_down()
Definition ImGuiWrapper.cpp:1430
static void scroll_y(int hover_id)
Definition ImGuiWrapper.cpp:1868
static void process_key_down(ImGuiKey imgui_key, std::function< void()> f)
Definition ImGuiWrapper.cpp:1893
static bool selectable(const char *label, bool selected, ImGuiSelectableFlags flags=0, const ImVec2 &size_arg=ImVec2(0, 0), bool *out_hovered=nullptr)
Definition ImGuiWrapper.cpp:1484
static void scroll_up()
Definition ImGuiWrapper.cpp:1418
static void process_mouse_wheel(int &mouse_wheel)
Definition ImGuiWrapper.cpp:1441
bool check(ModelVolumeType volume_type)
Definition GLGizmoEmboss.cpp:515

References checkbox(), Slic3r::Search::OptionViewParameters::hovered_id, ImRect, Slic3r::GUI::process_key_down(), Slic3r::GUI::process_mouse_wheel(), Slic3r::GUI::scroll_down(), Slic3r::GUI::scroll_up(), Slic3r::GUI::scroll_y(), Slic3r::GUI::selectable(), style, and tooltip().

Here is the call graph for this function:

◆ set_display_size()

void Slic3r::GUI::ImGuiWrapper::set_display_size ( float w,
float h )
477{
478 ImGuiIO& io = ImGui::GetIO();
479 io.DisplaySize = ImVec2(w, h);
480 io.DisplayFramebufferScale = ImVec2(1.0f, 1.0f);
481}

◆ set_language()

void Slic3r::GUI::ImGuiWrapper::set_language ( const std::string & language)
395{
396 if (m_new_frame_open) {
397 // ImGUI internally locks the font between NewFrame() and EndFrame()
398 // NewFrame() might've been called here because of input from the 3D scene;
399 // call EndFrame()
400 ImGui::EndFrame();
401 m_new_frame_open = false;
402 }
403
404 const ImWchar *ranges = nullptr;
405 size_t idx = language.find('_');
406 std::string lang = (idx == std::string::npos) ? language : language.substr(0, idx);
407 static const ImWchar ranges_latin2[] =
408 {
409 0x0020, 0x00FF, // Basic Latin + Latin Supplement
410 0x0100, 0x017F, // Latin Extended-A
411 0,
412 };
413 static const ImWchar ranges_turkish[] = {
414 0x0020, 0x01FF, // Basic Latin + Latin Supplement
415 0x0100, 0x017F, // Latin Extended-A
416 0x0180, 0x01FF, // Turkish
417 0,
418 };
419 static const ImWchar ranges_vietnamese[] =
420 {
421 0x0020, 0x00FF, // Basic Latin
422 0x0102, 0x0103,
423 0x0110, 0x0111,
424 0x0128, 0x0129,
425 0x0168, 0x0169,
426 0x01A0, 0x01A1,
427 0x01AF, 0x01B0,
428 0x1EA0, 0x1EF9,
429 0,
430 };
431 m_font_cjk = false;
432 m_is_korean = false;
433 if (lang == "cs" || lang == "pl") {
434 ranges = ranges_latin2;
435 } else if (lang == "ru" || lang == "uk") {
436 ranges = ImGui::GetIO().Fonts->GetGlyphRangesCyrillic(); // Default + about 400 Cyrillic characters
437 } else if (lang == "tr") {
438 ranges = ranges_turkish;
439 } else if (lang == "vi") {
440 ranges = ranges_vietnamese;
441 } else if (lang == "ja") {
442 ranges = ImGui::GetIO().Fonts->GetGlyphRangesJapanese(); // Default + Hiragana, Katakana, Half-Width, Selection of 1946 Ideographs
443 m_font_cjk = true;
444 } else if (lang == "ko") {
445 ranges = ImGui::GetIO().Fonts->GetGlyphRangesKorean(); // Default + Korean characters
446 m_font_cjk = true;
447 m_is_korean = true;
448 } else if (lang == "zh") {
449 ranges = (language == "zh_TW") ?
450 // Traditional Chinese
451 // Default + Half-Width + Japanese Hiragana/Katakana + full set of about 21000 CJK Unified Ideographs
452 ImGui::GetIO().Fonts->GetGlyphRangesChineseFull() :
453 // Simplified Chinese
454 // Default + Half-Width + Japanese Hiragana/Katakana + set of 2500 CJK Unified Ideographs for common simplified Chinese
455 ImGui::GetIO().Fonts->GetGlyphRangesChineseSimplifiedCommon();
456 m_font_cjk = true;
457 } else if (lang == "th") {
458 ranges = ImGui::GetIO().Fonts->GetGlyphRangesThai(); // Default + Thai characters
459 }
460 else if (lang == "en") {
461 ranges = ImGui::GetIO().Fonts->GetGlyphRangesEnglish(); // Basic Latin
462 }
463 else{
464 ranges = ImGui::GetIO().Fonts->GetGlyphRangesOthers();
465 }
466
467 if (ranges != m_glyph_ranges) {
468 m_glyph_ranges = ranges;
469 //destroy_fonts_texture();
470 destroy_font();
471 }
472
473 m_glyph_basic_ranges = ImGui::GetIO().Fonts->GetGlyphRangesBasic();
474}
const ImWchar * m_glyph_basic_ranges
Definition ImGuiWrapper.hpp:61
bool m_is_korean
Definition ImGuiWrapper.hpp:64

References destroy_font(), m_font_cjk, m_glyph_basic_ranges, m_glyph_ranges, m_is_korean, and m_new_frame_open.

Here is the call graph for this function:

◆ set_next_window_bg_alpha()

void Slic3r::GUI::ImGuiWrapper::set_next_window_bg_alpha ( float alpha)
736{
737 ImGui::SetNextWindowBgAlpha(alpha);
738}

Referenced by Slic3r::GUI::DesignSketchTool::draw_dim_label().

Here is the caller graph for this function:

◆ set_next_window_pos()

void Slic3r::GUI::ImGuiWrapper::set_next_window_pos ( float x,
float y,
int flag,
float pivot_x = 0.0f,
float pivot_y = 0.0f )
730{
731 ImGui::SetNextWindowPos(ImVec2(x, y), (ImGuiCond)flag, ImVec2(pivot_x, pivot_y));
732 ImGui::SetNextWindowSize(ImVec2(0.0, 0.0));
733}

Referenced by Slic3r::GUI::GLCanvas3D::_render_arrange_menu(), Slic3r::GUI::GLCanvas3D::_render_assemble_control(), Slic3r::GUI::GLCanvas3D::_render_assemble_info(), Slic3r::GUI::GLCanvas3D::_render_canvas_toolbar(), Slic3r::GUI::GLCanvas3D::_render_imex_ghost_tooltip(), Slic3r::GUI::GLCanvas3D::_render_imgui_select_plate_toolbar(), Slic3r::GUI::GLCanvas3D::_render_orient_menu(), Slic3r::GUI::GLCanvas3D::_render_paint_toolbar(), Slic3r::GUI::GLCanvas3D::_render_plate_switcher(), Slic3r::GUI::GLCanvas3D::_render_return_toolbar(), Slic3r::GUI::NotificationManager::PopNotification::bbl_render_block_notification(), Slic3r::GUI::GizmoObjectManipulation::do_render_move_window(), Slic3r::GUI::GizmoObjectManipulation::do_render_rotate_window(), Slic3r::GUI::GizmoObjectManipulation::do_render_scale_input_window(), Slic3r::GUI::DesignSketchTool::draw_dim_label(), Slic3r::GUI::GCodeViewer::SequentialView::GCodeWindow::render(), Slic3r::GUI::GLCanvas3D::Labels::render(), Slic3r::GUI::GLCanvas3D::Tooltip::render(), Slic3r::GUI::IMSlider::render(), Slic3r::GUI::NotificationManager::PopNotification::render(), Slic3r::GUI::NotificationManager::SlicingProgressNotification::render(), Slic3r::GUI::SketchInlineEditor::render(), Slic3r::GUI::GLCanvas3D::CenterOfMass::render_details(), Slic3r::GUI::DesignCanvas::render_hud(), Slic3r::GUI::GCodeViewer::render_legend(), Slic3r::GUI::GCodeViewer::SequentialView::Marker::render_position_window(), Slic3r::GUI::Mouse3DController::render_settings_dialog(), Slic3r::GUI::GCodeViewer::render_toolpaths(), and Slic3r::GUI::GLCanvas3D::LayersEditing::render_variable_layer_height_dialog().

Here is the caller graph for this function:

◆ set_next_window_size()

void Slic3r::GUI::ImGuiWrapper::set_next_window_size ( float x,
float y,
ImGuiCond cond )
741{
742 ImGui::SetNextWindowSize(ImVec2(x, y), cond);
743}

Referenced by Slic3r::GUI::GLCanvas3D::_render_imgui_select_plate_toolbar(), Slic3r::GUI::GLCanvas3D::_render_plate_switcher(), Slic3r::GUI::GLCanvas3D::_render_return_toolbar(), Slic3r::GUI::NotificationManager::PopNotification::bbl_render_block_notification(), and Slic3r::GUI::NotificationManager::PopNotification::render().

Here is the caller graph for this function:

◆ set_requires_extra_frame()

void Slic3r::GUI::ImGuiWrapper::set_requires_extra_frame ( )
inline

◆ set_scaling()

void Slic3r::GUI::ImGuiWrapper::set_scaling ( float font_size,
float scale_style,
float scale_both )
484{
485 font_size *= scale_both;
486 scale_style *= scale_both;
487
488 if (m_font_size == font_size && m_style_scaling == scale_style) {
489 return;
490 }
491
492 m_font_size = font_size;
493
494 ImGui::GetStyle().ScaleAllSizes(scale_style / m_style_scaling);
495 m_style_scaling = scale_style;
496
497 //destroy_fonts_texture();
498 destroy_font();
499}

References destroy_font(), m_font_size, and m_style_scaling.

Here is the call graph for this function:

◆ slider_float() [1/3]

bool Slic3r::GUI::ImGuiWrapper::slider_float ( const char * label,
float * v,
float v_min,
float v_max,
const char * format = "%.3f",
float power = 1.0f,
bool clamp = true )
1299{
1300 bool ret = ImGui::SliderFloat(label, v, v_min, v_max, format, power);
1301 if (clamp)
1302 *v = std::clamp(*v, v_min, v_max);
1303 return ret;
1304}

References Slic3r::GUI::format().

Referenced by Slic3r::GUI::GCodeViewer::render_overlay(), Slic3r::GUI::GCodeViewer::render_toolpaths(), slider_float(), slider_float(), slider_optional_float(), and slider_optional_int().

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

◆ slider_float() [2/3]

bool Slic3r::GUI::ImGuiWrapper::slider_float ( const std::string & label,
float * v,
float v_min,
float v_max,
const char * format = "%.3f",
float power = 1.0f,
bool clamp = true )
1307{
1308 return this->slider_float(label.c_str(), v, v_min, v_max, format, power, clamp);
1309}
bool slider_float(const char *label, float *v, float v_min, float v_max, const char *format="%.3f", float power=1.0f, bool clamp=true)
Definition ImGuiWrapper.cpp:1298

References Slic3r::GUI::format(), and slider_float().

Here is the call graph for this function:

◆ slider_float() [3/3]

bool Slic3r::GUI::ImGuiWrapper::slider_float ( const wxString & label,
float * v,
float v_min,
float v_max,
const char * format = "%.3f",
float power = 1.0f,
bool clamp = true )
1312{
1313 auto label_utf8 = into_u8(label);
1314 return this->slider_float(label_utf8.c_str(), v, v_min, v_max, format, power, clamp);
1315}

References Slic3r::GUI::format(), Slic3r::GUI::into_u8(), and slider_float().

Here is the call graph for this function:

◆ slider_optional_float()

bool Slic3r::GUI::ImGuiWrapper::slider_optional_float ( const char * label,
std::optional< float > & v,
float v_min,
float v_max,
const char * format = "%.3f",
float power = 1.0f,
bool clamp = true,
const wxString & tooltip = {},
bool show_edit_btn = true,
float def_val = .0f )
2339{
2340 auto func = [&](float &value) {
2341 return slider_float(label, &value, v_min, v_max, format, power, clamp, tooltip, show_edit_btn);
2342 };
2343 std::function<bool(const float &)> is_default =
2344 [def_val](const float &value) -> bool {
2345 return std::fabs(value - def_val) <= std::numeric_limits<float>::epsilon();
2346 };
2347 return input_optional(v, func, is_default, def_val);
2348}

References Slic3r::GUI::format(), Slic3r::GUI::input_optional(), slider_float(), and tooltip().

Here is the call graph for this function:

◆ slider_optional_int()

bool Slic3r::GUI::ImGuiWrapper::slider_optional_int ( const char * label,
std::optional< int > & v,
int v_min,
int v_max,
const char * format = "%.3f",
float power = 1.0f,
bool clamp = true,
const wxString & tooltip = {},
bool show_edit_btn = true,
int def_val = 0 )
2360{
2361 std::optional<float> val;
2362 if (v.has_value()) val = static_cast<float>(*v);
2363 auto func = [&](float &value) {
2364 return slider_float(label, &value, v_min, v_max, format, power, clamp, tooltip, show_edit_btn);
2365 };
2366 std::function<bool(const float &)> is_default =
2367 [def_val](const float &value) -> bool {
2368 return std::fabs(value - def_val) < 0.9f;
2369 };
2370
2371 float default_value = static_cast<float>(def_val);
2372 if (input_optional(val, func, is_default, default_value)) {
2373 if (val.has_value())
2374 v = static_cast<int>(std::round(*val));
2375 else
2376 v.reset();
2377 return true;
2378 } else return false;
2379}

References Slic3r::GUI::format(), Slic3r::GUI::input_optional(), slider_float(), and tooltip().

Here is the call graph for this function:

◆ sub_title()

void Slic3r::GUI::ImGuiWrapper::sub_title ( const std::string & label)
3645{
3646 ImDrawList *draw_list = ImGui::GetWindowDrawList();
3647 text_colored(ImVec4(1.0f, 1.0f, 1.0f, 0.5f), label);
3648 ImGui::SameLine();
3649 ImVec2 cursor_pos = ImGui::GetCursorScreenPos();
3650 float available_width = ImGui::GetContentRegionAvail().x;
3651 draw_list->AddLine(ImVec2(cursor_pos.x, cursor_pos.y + 8.0f), ImVec2(cursor_pos.x + available_width, cursor_pos.y + 8.0f), IM_COL32(255, 255, 255, 100));
3652 ImGui::NewLine();
3653}

References text_colored().

Here is the call graph for this function:

◆ suggest_location()

ImVec2 Slic3r::GUI::ImGuiWrapper::suggest_location ( const ImVec2 & dialog_size,
const Slic3r::Polygon & interest,
const ImVec2 & canvas_size )
static

Suggest loacation of dialog window, dependent on actual visible thing on platter like Gizmo menu size, notifications, ... To be near of polygon interest and not over it. And also not out of visible area.

Parameters
dialog_sizeDefine width and height of diaog window
interestArea of interest. Result should be close to it
canvas_sizeAvailable space a.k.a GLCanvas3D::get_current_canvas3D()
Returns
Suggestion for dialog offest
2479{
2480 // IMPROVE 1: do not select place over menu
2481 // BoundingBox top_menu;
2482 // GLGizmosManager &gizmo_mng = canvas->get_gizmos_manager();
2483 // BoundingBox side_menu; // gizmo_mng.get_size();
2484 // BoundingBox left_bottom_menu; // is permanent?
2485 // NotificationManager *notify_mng = plater->get_notification_manager();
2486 // BoundingBox notifications; // notify_mng->get_size();
2487 // m_window_width, m_window_height + position
2488
2489 // IMPROVE 2: use polygon of interest not only bounding box
2490 BoundingBox bb(interest.points);
2491 Point center = bb.center(); // interest.centroid();
2492
2493 // area size
2494 Point window_center(canvas_size.x / 2, canvas_size.y / 2);
2495
2496 // mov on side
2497 Point bb_half_size = (bb.max - bb.min) / 2 + Point(1,1);
2498 Point diff_center = window_center - center;
2499 Vec2d diff_norm(diff_center.x() / (double) bb_half_size.x(),
2500 diff_center.y() / (double) bb_half_size.y());
2501 if (diff_norm.x() > 1.) diff_norm.x() = 1.;
2502 if (diff_norm.x() < -1.) diff_norm.x() = -1.;
2503 if (diff_norm.y() > 1.) diff_norm.y() = 1.;
2504 if (diff_norm.y() < -1.) diff_norm.y() = -1.;
2505
2506 Vec2d abs_diff(abs(diff_norm.x()), abs(diff_norm.y()));
2507 if (abs_diff.x() < 1. && abs_diff.y() < 1.) {
2508 if (abs_diff.x() > abs_diff.y())
2509 diff_norm.x() = (diff_norm.x() < 0.) ? (-1.) : 1.;
2510 else
2511 diff_norm.y() = (diff_norm.y() < 0.) ? (-1.) : 1.;
2512 }
2513
2514 Point half_dialog_size(dialog_size.x / 2., dialog_size.y / 2.);
2515 Point move_size = bb_half_size + half_dialog_size;
2516 Point offseted_center = center - half_dialog_size;
2517 Vec2d offset(offseted_center.x() + diff_norm.x() * move_size.x(),
2518 offseted_center.y() + diff_norm.y() * move_size.y());
2519
2520 // move offset close to center
2521 Points window_polygon = {offset.cast<coord_t>(),
2522 Point(offset.x(), offset.y() + dialog_size.y),
2523 Point(offset.x() + dialog_size.x,
2524 offset.y() + dialog_size.y),
2525 Point(offset.x() + dialog_size.x, offset.y())};
2526 // check that position by Bounding box is not intersecting
2527 assert(Slic3r::intersection(interest, Polygon(window_polygon)).empty());
2528
2529 double allowed_space = 10; // in px
2530 double allowed_space_sq = allowed_space * allowed_space;
2531 Vec2d move_vec = (center - (offset.cast<coord_t>() + half_dialog_size))
2532 .cast<double>();
2533 Vec2d result_move(0, 0);
2534 do {
2535 move_vec = move_vec / 2.;
2536 Point move_point = (move_vec + result_move).cast<coord_t>();
2537 Points moved_polygon = window_polygon; // copy
2538 for (Point &p : moved_polygon) p += move_point;
2539 if (Slic3r::intersection(interest, Polygon(moved_polygon)).empty())
2540 result_move += move_vec;
2541
2542 } while (move_vec.squaredNorm() >= allowed_space_sq);
2543 offset += result_move;
2544
2545 return ImVec2(offset.x(), offset.y());
2546}
Points points
Definition MultiPoint.hpp:22
int64_t coord_t
Definition libslic3r.h:48
void center(ExPolygonsWithIds &e)
Definition Emboss.cpp:1382
Slic3r::Polygons intersection(const Slic3r::Polygon &subject, const Slic3r::Polygon &clip, ApplySafetyOffset do_safety_offset)
Definition ClipperUtils.cpp:769
Slic3r::Polygons offset(const Slic3r::Polygon &polygon, const float delta, JoinType joinType, double miterLimit)
Definition ClipperUtils.cpp:582
std::vector< Point, PointsAllocator< Point > > Points
Definition Point.hpp:73
Eigen::Matrix< double, 2, 1, Eigen::DontAlign > Vec2d
Definition Point.hpp:67
auto cast(const BoundingBoxBase< Tin > &b)
Definition BoundingBox.hpp:299
bool empty(const BoundingBoxBase< PointType, PointsType > &bb)
Definition BoundingBox.hpp:273
Slic3r::Polygon Polygon
Definition Emboss.cpp:101

References Slic3r::cast(), Slic3r::BoundingBoxBase< PointType, APointsType >::center(), Slic3r::center(), Slic3r::empty(), Slic3r::intersection(), Slic3r::BoundingBoxBase< PointType, APointsType >::max, Slic3r::BoundingBoxBase< PointType, APointsType >::min, Slic3r::offset(), and Slic3r::MultiPoint::points.

Referenced by anonymous_namespace{GLGizmoEmboss.cpp}::calc_fine_position().

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

◆ text() [1/3]

void Slic3r::GUI::ImGuiWrapper::text ( const char * label)
static
1129{
1130 ImGui::Text("%s", label);
1131}

Referenced by Slic3r::GUI::GLCanvas3D::_picking_pass(), Slic3r::GUI::GLCanvas3D::_render_arrange_menu(), Slic3r::GUI::GLCanvas3D::_render_assemble_control(), Slic3r::GUI::GLCanvas3D::_render_fps_overlay(), Slic3r::GUI::GLCanvas3D::_render_frame(), Slic3r::GUI::GLCanvas3D::_render_imex_ghost_tooltip(), Slic3r::GUI::GLCanvas3D::_render_section_view_panel(), Slic3r::GUI::NotificationManager::PopNotification::bbl_render_block_notif_left_sign(), Slic3r::GUI::NotificationManager::PopNotification::bbl_render_block_notif_text(), bbl_slider_float(), bold_text(), calc_button_size(), calc_text_size(), calc_text_size(), calc_text_size(), clipboard_get(), clipboard_set(), combo(), contain_all_glyphs(), Slic3r::GUI::GizmoObjectManipulation::do_render_move_window(), Slic3r::GUI::GizmoObjectManipulation::do_render_rotate_window(), Slic3r::GUI::GizmoObjectManipulation::do_render_scale_input_window(), Slic3r::GUI::GLGizmoSVG::draw_depth(), Slic3r::GUI::DesignSketchTool::draw_dim_label(), Slic3r::GUI::GLGizmoEmboss::draw_font_list_line(), Slic3r::GUI::GLGizmoSVG::draw_use_surface(), escape_double_hash(), filament_group(), find_widest_text(), Slic3r::GUI::GCodeViewer::SequentialView::GCodeWindow::render(), Slic3r::GUI::GLCanvas3D::Labels::render(), Slic3r::GUI::SketchInlineEditor::render(), Slic3r::GUI::GCodeViewer::render_all_plates_stats(), Slic3r::GUI::NotificationManager::PrintHostUploadNotification::render_bar(), Slic3r::GUI::NotificationManager::ProgressBarNotification::render_bar(), Slic3r::GUI::NotificationManager::SlicingProgressNotification::render_bar(), Slic3r::GUI::NotificationManager::URLDownloadNotification::render_bar(), Slic3r::GUI::NotificationManager::PrintHostUploadNotification::render_cancel_button(), Slic3r::GUI::GizmoObjectManipulation::render_combo(), Slic3r::GUI::DailyTipsPanel::render_controller_buttons(), Slic3r::GUI::GLCanvas3D::CenterOfMass::render_details(), Slic3r::GUI::NotificationManager::HintNotification::render_documentation_button(), Slic3r::GUI::NotificationManager::ExportFinishedNotification::render_eject_button(), Slic3r::GUI::IMSlider::render_go_to_layer_dialog(), Slic3r::GUI::NotificationManager::PopNotification::render_hyperlink_action(), Slic3r::GUI::NotificationManager::PopNotification::render_hypertext(), Slic3r::GUI::IMSlider::render_input_custom_gcode(), Slic3r::GUI::GCodeViewer::render_legend(), Slic3r::GUI::GCodeViewer::render_legend_color_arr_recommen(), Slic3r::GUI::GCodeViewer::SequentialView::Marker::render_position_window(), Slic3r::GUI::NotificationManager::HintNotification::render_preferences_button(), Slic3r::GUI::NotificationManager::SlicingProgressNotification::render_progress_text(), Slic3r::GUI::NotificationManager::HintNotification::render_right_arrow_button(), Slic3r::GUI::Mouse3DController::render_settings_dialog(), Slic3r::GUI::DailyTipsDataRenderer::render_text(), Slic3r::GUI::NotificationManager::ExportFinishedNotification::render_text(), Slic3r::GUI::NotificationManager::HintNotification::render_text(), Slic3r::GUI::NotificationManager::OrcaSyncConflictNotification::render_text(), Slic3r::GUI::NotificationManager::PluginMissingNotification::render_text(), Slic3r::GUI::NotificationManager::PopNotification::render_text(), Slic3r::GUI::NotificationManager::ProgressBarNotification::render_text(), Slic3r::GUI::NotificationManager::SharedProfilesNotification::render_text(), Slic3r::GUI::GCodeViewer::render_toolpaths(), Slic3r::GUI::GLCanvas3D::LayersEditing::render_variable_layer_height_dialog(), Slic3r::GUI::GLGizmoEmboss::revertible(), text(), text(), text_wrapped(), title(), title(), trunc(), and warning_text().

◆ text() [2/3]

void Slic3r::GUI::ImGuiWrapper::text ( const std::string & label)
static
1134{
1135 ImGuiWrapper::text(label.c_str());
1136}

References text().

Here is the call graph for this function:

◆ text() [3/3]

void Slic3r::GUI::ImGuiWrapper::text ( const wxString & label)
static
1139{
1140 auto label_utf8 = into_u8(label);
1141 ImGuiWrapper::text(label_utf8.c_str());
1142}

References Slic3r::GUI::into_u8(), and text().

Here is the call graph for this function:

◆ text_colored() [1/3]

◆ text_colored() [2/3]

void Slic3r::GUI::ImGuiWrapper::text_colored ( const ImVec4 & color,
const std::string & label )
static
1163{
1164 ImGuiWrapper::text_colored(color, label.c_str());
1165}

References text_colored().

Here is the call graph for this function:

◆ text_colored() [3/3]

void Slic3r::GUI::ImGuiWrapper::text_colored ( const ImVec4 & color,
const wxString & label )
static
1168{
1169 auto label_utf8 = into_u8(label);
1170 ImGuiWrapper::text_colored(color, label_utf8.c_str());
1171}

References Slic3r::GUI::into_u8(), and text_colored().

Here is the call graph for this function:

◆ text_input_active()

bool Slic3r::GUI::ImGuiWrapper::text_input_active ( ) const
2152{
2153 // An active InputText requests text input in each frame that draws it, and NewFrame() moves the
2154 // request into io.WantTextInput.
2155 const ImGuiContext& g = *ImGui::GetCurrentContext();
2156 return g.WithinFrameScope ? g.IO.WantTextInput : g.WantTextInputNextFrame == 1;
2157}

Referenced by owns_key(), and owns_keyboard().

Here is the caller graph for this function:

◆ text_wrapped() [1/3]

void Slic3r::GUI::ImGuiWrapper::text_wrapped ( const char * label,
float wrap_width )
1174{
1175 ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + wrap_width);
1176 this->text(label);
1177 ImGui::PopTextWrapPos();
1178}

References text().

Referenced by Slic3r::GUI::GCodeViewer::render_legend_color_arr_recommen(), Slic3r::GUI::DailyTipsDataRenderer::render_text(), text_wrapped(), and text_wrapped().

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

◆ text_wrapped() [2/3]

void Slic3r::GUI::ImGuiWrapper::text_wrapped ( const std::string & label,
float wrap_width )
1181{
1182 this->text_wrapped(label.c_str(), wrap_width);
1183}
void text_wrapped(const char *label, float wrap_width)
Definition ImGuiWrapper.cpp:1173

References text_wrapped().

Here is the call graph for this function:

◆ text_wrapped() [3/3]

void Slic3r::GUI::ImGuiWrapper::text_wrapped ( const wxString & label,
float wrap_width )
1186{
1187 auto label_utf8 = into_u8(label);
1188 this->text_wrapped(label_utf8.c_str(), wrap_width);
1189}

References Slic3r::GUI::into_u8(), and text_wrapped().

Here is the call graph for this function:

◆ title() [1/2]

void Slic3r::GUI::ImGuiWrapper::title ( const std::string & str)
2085{
2086 if (bold_font){
2087 ImGui::PushFont(bold_font);
2088 text(str);
2089 ImGui::PopFont();
2090 } else {
2091 text(str);
2092 }
2093 ImGui::Separator();
2094}

References bold_font, and text().

Referenced by Slic3r::GUI::GCodeViewer::render_all_plates_stats().

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

◆ title() [2/2]

void Slic3r::GUI::ImGuiWrapper::title ( const std::string & str,
bool suppress_seperator )
2097{
2098 if (bold_font) {
2099 ImGui::PushFont(bold_font);
2100 text(str);
2101 ImGui::PopFont();
2102 } else {
2103 text(str);
2104 }
2105 if (!suppress_seperator) {
2106 ImGui::Separator();
2107 }
2108}

References bold_font, and text().

Here is the call graph for this function:

◆ to_ImU32()

ImU32 Slic3r::GUI::ImGuiWrapper::to_ImU32 ( const ColorRGBA & color)
static
2240{
2241 return ImGui::GetColorU32({ color.r(), color.g(), color.b(), color.a() });
2242}

References Slic3r::ColorRGBA::a(), Slic3r::ColorRGBA::b(), Slic3r::ColorRGBA::g(), and Slic3r::ColorRGBA::r().

Referenced by Slic3r::GUI::add_swatch(), Slic3r::GUI::GLGizmoMmuSegmentation::draw_color_button(), Slic3r::GUI::IMSlider::draw_colored_band(), Slic3r::GUI::DesignSketchTool::draw_dim_label(), Slic3r::GUI::IMSlider::render_add_menu(), Slic3r::GUI::GLGizmoCut3D::render_cut_plane_input_window(), Slic3r::GUI::GLGizmoMeasure::render_dimensioning(), Slic3r::GUI::IMSlider::render_edit_menu(), Slic3r::GUI::render_extruders_combo(), and Slic3r::GUI::GCodeViewer::render_legend().

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

◆ to_ImVec4() [1/2]

◆ to_ImVec4() [2/2]

ImVec4 Slic3r::GUI::ImGuiWrapper::to_ImVec4 ( const ColorRGBA & color)
static
2245{
2246 return { color.r(), color.g(), color.b(), color.a() };
2247}

References Slic3r::ColorRGBA::a(), Slic3r::ColorRGBA::b(), Slic3r::ColorRGBA::g(), and Slic3r::ColorRGBA::r().

Here is the call graph for this function:

◆ tooltip() [1/3]

void Slic3r::GUI::ImGuiWrapper::tooltip ( const char * label,
float wrap_width )
1192{
1193 ImGui::BeginTooltip();
1194 ImGui::PushTextWrapPos(wrap_width);
1195 ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.00f, 1.00f, 1.00f, 1.00f));
1196 ImGui::TextUnformatted(label);
1197 ImGui::PopStyleColor(1);
1198 ImGui::PopTextWrapPos();
1199 ImGui::EndTooltip();
1200}

Referenced by Slic3r::GUI::GLCanvas3D::_render_canvas_toolbar(), Slic3r::GUI::GLCanvas3D::_render_paint_toolbar(), Slic3r::GUI::GLCanvas3D::_render_plate_switcher(), bbl_button(), bbl_slider_float(), bbl_slider_float_style(), button(), Slic3r::GUI::GizmoObjectManipulation::do_render_move_window(), Slic3r::GUI::GizmoObjectManipulation::do_render_rotate_window(), Slic3r::GUI::GizmoObjectManipulation::do_render_scale_input_window(), image_button(), search_list(), slider_optional_float(), slider_optional_int(), and tooltip().

Here is the caller graph for this function:

◆ tooltip() [2/3]

void Slic3r::GUI::ImGuiWrapper::tooltip ( const std::string & label,
float wrap_width )
1202 {
1203 tooltip(label.c_str(), wrap_width);
1204}

References tooltip().

Here is the call graph for this function:

◆ tooltip() [3/3]

void Slic3r::GUI::ImGuiWrapper::tooltip ( const wxString & label,
float wrap_width )
1207{
1208 ImGui::BeginTooltip();
1209 ImGui::PushTextWrapPos(wrap_width);
1210 ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.00f, 1.00f, 1.00f, 1.00f));
1211 ImGui::TextUnformatted(label.ToUTF8().data());
1212 ImGui::PopStyleColor(1);
1213 ImGui::PopTextWrapPos();
1214 ImGui::EndTooltip();
1215}

◆ trunc()

std::string Slic3r::GUI::ImGuiWrapper::trunc ( const std::string & text,
float width,
const char * tail = " .." )
static

Truncate text by ImGui draw function to specific width NOTE 1: ImGui must be initialized NOTE 2: Calculation for actual acive imgui font.

Parameters
textText to be truncated
widthMaximal width before truncate
tailString puted on end of text to be visible truncation
Returns
Truncated text
2430{
2431 float text_width = ImGui::CalcTextSize(text.c_str()).x;
2432 if (text_width < width) return text;
2433 float tail_width = ImGui::CalcTextSize(tail).x;
2434 assert(width > tail_width);
2435 if (width <= tail_width) return "Error: Can't add tail and not be under wanted width.";
2436 float allowed_width = width - tail_width;
2437
2438 // guess approx count of letter
2439 float average_letter_width = calc_text_size(std::string_view("n")).x; // average letter width
2440 unsigned count_letter = static_cast<unsigned>(allowed_width / average_letter_width);
2441
2442 std::string_view text_ = text;
2443 std::string_view result_text = text_.substr(0, count_letter);
2444 text_width = calc_text_size(result_text).x;
2445 if (text_width < allowed_width) {
2446 // increase letter count
2447 while (count_letter < text.length()) {
2448 ++count_letter;
2449 std::string_view act_text = text_.substr(0, count_letter);
2450 text_width = calc_text_size(act_text).x;
2451 if (text_width > allowed_width) break;
2452 result_text = act_text;
2453 }
2454 } else {
2455 // decrease letter count
2456 while (count_letter > 1) {
2457 --count_letter;
2458 result_text = text_.substr(0, count_letter);
2459 text_width = calc_text_size(result_text).x;
2460 if (text_width < allowed_width) break;
2461 }
2462 }
2463 return std::string(result_text) + tail;
2464}

References calc_text_size(), and text().

Referenced by Slic3r::GUI::GLGizmoSVG::draw_filename(), Slic3r::GUI::GLGizmoEmboss::draw_style_list(), Slic3r::GUI::Emboss::StyleManager::init_trunc_names(), and anonymous_namespace{GLGizmoEmboss.cpp}::init_truncated_names().

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

◆ undo_redo_list()

bool Slic3r::GUI::ImGuiWrapper::undo_redo_list ( const ImVec2 & size,
const bool is_undo,
bool(* items_getter )(const bool, int, const char **),
int & hovered,
int & selected,
int & mouse_wheel )
1451{
1452 bool is_hovered = false;
1453 ImGui::ListBoxHeader("", size);
1454
1455 int i=0;
1456 const char* item_text;
1457 while (items_getter(is_undo, i, &item_text)) {
1458 ImGui::Selectable(item_text, i < hovered);
1459
1460 if (ImGui::IsItemHovered()) {
1461 ImGui::SetTooltip("%s", item_text);
1462 hovered = i;
1463 is_hovered = true;
1464 }
1465
1466 if (ImGui::IsItemClicked())
1467 selected = i;
1468 i++;
1469 }
1470
1471 if (is_hovered)
1472 process_mouse_wheel(mouse_wheel);
1473
1474 ImGui::ListBoxFooter();
1475 return is_hovered;
1476}
@ hovered
Definition GLGizmoEmboss.cpp:223

References Slic3r::GUI::process_mouse_wheel().

Here is the call graph for this function:

◆ update_key_data()

bool Slic3r::GUI::ImGuiWrapper::update_key_data ( wxKeyEvent & evt)
532{
533 if (! display_initialized()) {
534 return false;
535 }
536
537 ImGuiIO& io = ImGui::GetIO();
538
539 if (evt.GetEventType() == wxEVT_CHAR) {
540 // Char event
541 const auto key = evt.GetUnicodeKey();
542 // THE MEASUREMENT THAT CANNOT LIE. This is the ONLY place in the application where ImGui
543 // is ever handed a character, so an ImGui text field that stays empty while reporting
544 // itself active has exactly two possible causes, and this line separates them: no output
545 // at all means the wxEVT_CHAR never reached the GL canvas (a focus problem, upstream of
546 // ImGui entirely), while output with unicode=0 means the character arrived empty and is
547 // being dropped right here.
548 //
549 // It lives here rather than on the canvas because a probe bound on the canvas CANNOT
550 // answer this: GLCanvas3D::on_char is bound later than any constructor-time probe, wx
551 // runs handlers in reverse bind order, and on_char returns without Skip() whenever this
552 // function returns true — so such a probe stays silent whether or not the key arrived.
553 // A day was lost to reading that silence as evidence.
554 if (std::getenv("ORCA_CAD_UXTRACE")) {
555 fprintf(stderr, "[UX] imgui_char unicode=%d keycode=%d want_text=%d\n",
556 (int) key, evt.GetKeyCode(), (int) io.WantTextInput);
557 fflush(stderr);
558 }
559 if (key != 0) {
560 io.AddInputCharacter(key);
561 }
562 } else {
563 // Key up/down event
564 int key = evt.GetKeyCode();
565 wxCHECK_MSG(key >= 0 && key < IM_ARRAYSIZE(io.KeysDown), false, "Received invalid key code");
566
567 io.KeysDown[key] = evt.GetEventType() == wxEVT_KEY_DOWN;
568 io.KeyShift = evt.ShiftDown();
569 io.KeyCtrl = evt.ControlDown();
570 io.KeyAlt = evt.AltDown();
571 io.KeySuper = evt.MetaDown();
572 }
573 bool ret = want_keyboard() || want_text_input();
574 if (ret)
575 new_frame();
576 return ret;
577}
bool want_text_input() const
Definition ImGuiWrapper.cpp:2140
bool display_initialized() const
Definition ImGuiWrapper.cpp:3505
void new_frame()
Definition ImGuiWrapper.cpp:579
bool want_keyboard() const
Definition ImGuiWrapper.cpp:2135

References display_initialized(), new_frame(), want_keyboard(), and want_text_input().

Here is the call graph for this function:

◆ update_mouse_data()

bool Slic3r::GUI::ImGuiWrapper::update_mouse_data ( wxMouseEvent & evt)
502{
503 if (! display_initialized()) {
504 return false;
505 }
506
507 ImGuiIO& io = ImGui::GetIO();
508 io.MousePos = ImVec2((float)evt.GetX(), (float)evt.GetY());
509 io.MouseDown[0] = evt.LeftIsDown();
510 io.MouseDown[1] = evt.RightIsDown();
511 io.MouseDown[2] = evt.MiddleIsDown();
512 // Replaces a modifier left held when its key-up was sent to another window.
513 io.KeyCtrl = evt.ControlDown();
514 io.KeyShift = evt.ShiftDown();
515 io.KeyAlt = evt.AltDown();
516 io.KeySuper = evt.MetaDown();
517 // Only a vertical wheel event with a direction is a wheel step. A macOS trackpad reports sideways motion
518 // as separate horizontal events, and its wheel events often carry a rotation of 0: wx truncates the
519 // sub-pixel deltas to whole ones and passes on events with no delta at all. Read as vertical steps,
520 // either kind scrolls against the gesture, and scrolling up bounces back and forth.
521 if (evt.GetWheelAxis() == wxMOUSE_WHEEL_VERTICAL && evt.GetWheelRotation() != 0)
522 io.MouseWheel = evt.GetWheelRotation() > 0 ? 1.f : -1.f;
523 unsigned buttons = (evt.LeftIsDown() ? 1 : 0) | (evt.RightIsDown() ? 2 : 0) | (evt.MiddleIsDown() ? 4 : 0);
524 m_mouse_buttons = buttons;
525
526 if (want_mouse())
527 new_frame();
528 return want_mouse();
529}
bool want_mouse() const
Definition ImGuiWrapper.cpp:2130
unsigned m_mouse_buttons
Definition ImGuiWrapper.hpp:69

References display_initialized(), m_mouse_buttons, new_frame(), want_mouse(), and Slic3r::GUI::wxMouseEvent.

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

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

◆ want_any_input()

bool Slic3r::GUI::ImGuiWrapper::want_any_input ( ) const
2146{
2147 const auto io = ImGui::GetIO();
2148 return io.WantCaptureMouse || io.WantCaptureKeyboard || io.WantTextInput;
2149}

◆ want_keyboard()

bool Slic3r::GUI::ImGuiWrapper::want_keyboard ( ) const
2136{
2137 return ImGui::GetIO().WantCaptureKeyboard;
2138}

Referenced by update_key_data().

Here is the caller graph for this function:

◆ want_mouse()

bool Slic3r::GUI::ImGuiWrapper::want_mouse ( ) const
2131{
2132 return ImGui::GetIO().WantCaptureMouse;
2133}

Referenced by update_mouse_data().

Here is the caller graph for this function:

◆ want_text_input()

bool Slic3r::GUI::ImGuiWrapper::want_text_input ( ) const
2141{
2142 return ImGui::GetIO().WantTextInput;
2143}

Referenced by update_key_data().

Here is the caller graph for this function:

◆ warning_text() [1/2]

void Slic3r::GUI::ImGuiWrapper::warning_text ( const char * all_text)
1145{
1146 ImGui::PushStyleColor(ImGuiCol_Text, ImGuiWrapper::COL_WARNING);
1147 this->text(label);
1148 ImGui::PopStyleColor();
1149}
static const ImVec4 COL_WARNING
Definition ImGuiWrapper.hpp:413

References COL_WARNING, and text().

Here is the call graph for this function:

◆ warning_text() [2/2]

void Slic3r::GUI::ImGuiWrapper::warning_text ( const wxString & all_text)
1152{
1153 auto label_utf8 = into_u8(all_text);
1154 warning_text(label_utf8.c_str());
1155}
static const std::string warning_text
Definition GLGizmoMeshBoolean.cpp:44

References Slic3r::GUI::into_u8(), and Slic3r::GUI::warning_text.

Here is the call graph for this function:

Member Data Documentation

◆ bold_font

ImFont* Slic3r::GUI::ImGuiWrapper::bold_font = nullptr
private

◆ COL_ACTIVE

const ImVec4 Slic3r::GUI::ImGuiWrapper::COL_ACTIVE = { 0.675f, 0.675f, 0.675f, 1.0f }
static

◆ COL_BLUE

const ImVec4 Slic3r::GUI::ImGuiWrapper::COL_BLUE = ImVec4(0.0f, 0.0f, 1.0f, 1.0f)
static

◆ COL_BLUE_LIGHT

const ImVec4 Slic3r::GUI::ImGuiWrapper::COL_BLUE_LIGHT = ImVec4(0.122f, 0.557f, 0.918f, 1.0f)
static

Referenced by init_style().

◆ COL_BUTTON_ACTIVE

const ImVec4 Slic3r::GUI::ImGuiWrapper::COL_BUTTON_ACTIVE = COL_BUTTON_HOVERED
static

◆ COL_BUTTON_BACKGROUND

const ImVec4 Slic3r::GUI::ImGuiWrapper::COL_BUTTON_BACKGROUND = COL_ORANGE_DARK
static

◆ COL_BUTTON_HOVERED

const ImVec4 Slic3r::GUI::ImGuiWrapper::COL_BUTTON_HOVERED = COL_ORANGE_LIGHT
static

◆ COL_GREEN

const ImVec4 Slic3r::GUI::ImGuiWrapper::COL_GREEN = ImVec4(0.0f, 1.0f, 0.0f, 1.0f)
static

◆ COL_GREEN_LIGHT

const ImVec4 Slic3r::GUI::ImGuiWrapper::COL_GREEN_LIGHT = { 0.f, 156 / 255.f, 136 / 255.f, 0.25f }
static

◆ COL_GREY_DARK

const ImVec4 Slic3r::GUI::ImGuiWrapper::COL_GREY_DARK = { 0.333f, 0.333f, 0.333f, 1.0f }
static

◆ COL_GREY_LIGHT

const ImVec4 Slic3r::GUI::ImGuiWrapper::COL_GREY_LIGHT = { 0.4f, 0.4f, 0.4f, 1.0f }
static

◆ COL_HOVER

const ImVec4 Slic3r::GUI::ImGuiWrapper::COL_HOVER = { 0.933f, 0.933f, 0.933f, 1.0f }
static

Referenced by init_style(), and push_toolbar_style().

◆ COL_MODIFIED

◆ COL_ORANGE_DARK

◆ COL_ORANGE_LIGHT

◆ COL_ORCA

◆ COL_ORCA_DARK

const ImVec4 Slic3r::GUI::ImGuiWrapper::COL_ORCA_DARK = { 0.f , 103 / 255.f, 91 / 255.f, 1.f }
static

◆ COL_ORCA_HOVER

const ImVec4 Slic3r::GUI::ImGuiWrapper::COL_ORCA_HOVER = { 38 / 255.f, 166 / 255.f, 154 / 255.f, 1.f }
static

◆ COL_ORCA_HOVER_DARK

const ImVec4 Slic3r::GUI::ImGuiWrapper::COL_ORCA_HOVER_DARK = { 0.f , 129 / 255.f, 114 / 255.f, 1.f }
static

◆ COL_RED

const ImVec4 Slic3r::GUI::ImGuiWrapper::COL_RED = ImVec4(1.0f, 0.0f, 0.0f, 1.0f)
static

◆ COL_SEPARATOR

const ImVec4 Slic3r::GUI::ImGuiWrapper::COL_SEPARATOR = { 0.93f, 0.93f, 0.93f, 1.0f }
static

◆ COL_SEPARATOR_DARK

const ImVec4 Slic3r::GUI::ImGuiWrapper::COL_SEPARATOR_DARK = { 0.24f, 0.24f, 0.27f, 1.0f }
static

◆ COL_TITLE_BG

const ImVec4 Slic3r::GUI::ImGuiWrapper::COL_TITLE_BG = { 0.745f, 0.745f, 0.745f, 1.0f }
static

Referenced by push_toolbar_style().

◆ COL_TOOLBAR_BG

◆ COL_TOOLBAR_BG_DARK

const ImVec4 Slic3r::GUI::ImGuiWrapper::COL_TOOLBAR_BG_DARK = { 57 / 255.f, 60 / 255.f, 66 / 255.f, 1.f }
static

◆ COL_WARNING

◆ COL_WINDOW_BACKGROUND

◆ COL_WINDOW_BG

◆ COL_WINDOW_BG_DARK

const ImVec4 Slic3r::GUI::ImGuiWrapper::COL_WINDOW_BG_DARK = { 45 / 255.f, 45 / 255.f, 49 / 255.f, 1.f }
static

◆ default_font

ImFont* Slic3r::GUI::ImGuiWrapper::default_font = nullptr
private

Referenced by init_font(), and push_font_by_name().

◆ im_fonts_map

std::map<std::string, ImFont*> Slic3r::GUI::ImGuiWrapper::im_fonts_map
private

◆ m_char_claim

std::optional<bool> Slic3r::GUI::ImGuiWrapper::m_char_claim
private

◆ m_clipboard_text

std::string Slic3r::GUI::ImGuiWrapper::m_clipboard_text
private

Referenced by clipboard_get().

◆ m_custom_glyph_rects_ids

std::map<wchar_t, int> Slic3r::GUI::ImGuiWrapper::m_custom_glyph_rects_ids
private

Referenced by GetTextureCustomRect(), and init_font().

◆ m_disabled

bool Slic3r::GUI::ImGuiWrapper::m_disabled { false }
private
70{ false };

Referenced by disabled_begin(), and disabled_end().

◆ m_font_another_texture

unsigned Slic3r::GUI::ImGuiWrapper::m_font_another_texture { 0 }
private
67{ 0 };

◆ m_font_cjk

bool Slic3r::GUI::ImGuiWrapper::m_font_cjk { false }
private
63{ false };

Referenced by init_font(), and set_language().

◆ m_font_size

float Slic3r::GUI::ImGuiWrapper::m_font_size { 18.0 }
private
65{ 18.0 };

Referenced by get_font_size(), init_font(), scaled(), scaled(), and set_scaling().

◆ m_font_texture

unsigned Slic3r::GUI::ImGuiWrapper::m_font_texture { 0 }
private
66{ 0 };

Referenced by destroy_font(), init_font(), and new_frame().

◆ m_fonts_names

std::vector<std::string> Slic3r::GUI::ImGuiWrapper::m_fonts_names
private

Referenced by get_fonts_names().

◆ m_glyph_basic_ranges

const ImWchar* Slic3r::GUI::ImGuiWrapper::m_glyph_basic_ranges { nullptr }
private
61{ nullptr };

Referenced by set_language().

◆ m_glyph_ranges

const ImWchar* Slic3r::GUI::ImGuiWrapper::m_glyph_ranges { nullptr }
private
60{ nullptr };

Referenced by get_glyph_ranges(), init_font(), and set_language().

◆ m_is_korean

bool Slic3r::GUI::ImGuiWrapper::m_is_korean { false }
private
64{ false };

Referenced by set_language().

◆ m_key_claims

std::map<int, bool> Slic3r::GUI::ImGuiWrapper::m_key_claims
private

◆ m_last_frame_time

std::chrono::steady_clock::time_point Slic3r::GUI::ImGuiWrapper::m_last_frame_time {}
private
73{};

Referenced by new_frame().

◆ m_last_slider_status

LastSliderStatus Slic3r::GUI::ImGuiWrapper::m_last_slider_status
private

◆ m_mouse_buttons

unsigned Slic3r::GUI::ImGuiWrapper::m_mouse_buttons { 0 }
private
69{ 0 };

Referenced by update_mouse_data().

◆ m_new_frame_open

bool Slic3r::GUI::ImGuiWrapper::m_new_frame_open { false }
private
71{ false };

Referenced by end_frame(), new_frame(), and set_language().

◆ m_style_scaling

float Slic3r::GUI::ImGuiWrapper::m_style_scaling { 1.0 }
private

◆ TOOLBAR_WINDOW_FLAGS

int Slic3r::GUI::ImGuiWrapper::TOOLBAR_WINDOW_FLAGS
static
Initial value:
= ImGuiWindowFlags_AlwaysAutoResize
| ImGuiWindowFlags_NoMove
| ImGuiWindowFlags_NoResize
| ImGuiWindowFlags_NoCollapse
| ImGuiWindowFlags_NoTitleBar

Referenced by Slic3r::GUI::GizmoObjectManipulation::do_render_move_window(), Slic3r::GUI::GizmoObjectManipulation::do_render_rotate_window(), and Slic3r::GUI::GizmoObjectManipulation::do_render_scale_input_window().


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