mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 16:57:53 -06:00
imgui: Refactor font size, font initialization
This commit is contained in:
parent
32a49d1468
commit
88cc93cdc9
4 changed files with 48 additions and 41 deletions
|
@ -18,9 +18,6 @@ namespace GUI {
|
|||
|
||||
class ImGuiWrapper
|
||||
{
|
||||
typedef std::map<std::string, ImFont*> FontsMap;
|
||||
|
||||
FontsMap m_fonts;
|
||||
const ImWchar *m_glyph_ranges;
|
||||
float m_font_size;
|
||||
unsigned m_font_texture;
|
||||
|
@ -31,22 +28,27 @@ class ImGuiWrapper
|
|||
std::string m_clipboard_text;
|
||||
|
||||
public:
|
||||
ImGuiWrapper(float font_size);
|
||||
ImGuiWrapper();
|
||||
~ImGuiWrapper();
|
||||
|
||||
void read_glsl_version();
|
||||
|
||||
void set_language(const std::string &language);
|
||||
void set_display_size(float w, float h);
|
||||
void set_font_size(float font_size);
|
||||
void set_style_scaling(float scaling);
|
||||
bool update_mouse_data(wxMouseEvent &evt);
|
||||
bool update_key_data(wxKeyEvent &evt);
|
||||
|
||||
float get_font_size() const { return m_font_size; }
|
||||
float get_style_scaling() const { return m_style_scaling; }
|
||||
|
||||
void new_frame();
|
||||
void render();
|
||||
|
||||
float scaled(float x) const { return x * m_font_size * m_style_scaling; }
|
||||
ImVec2 scaled_vec(float x, float y) const { return ImVec2(x * m_font_size * m_style_scaling, y * m_font_size * m_style_scaling); }
|
||||
|
||||
void set_next_window_pos(float x, float y, int flag);
|
||||
void set_next_window_bg_alpha(float alpha);
|
||||
|
||||
|
@ -64,6 +66,8 @@ public:
|
|||
void text(const wxString &label);
|
||||
bool combo(const wxString& label, const std::vector<std::string>& options, int& selection); // Use -1 to not mark any option as selected
|
||||
|
||||
ImVec2 calc_text_size(const wxString &text);
|
||||
|
||||
void disabled_begin(bool disabled);
|
||||
void disabled_end();
|
||||
|
||||
|
@ -73,15 +77,12 @@ public:
|
|||
bool want_any_input() const;
|
||||
|
||||
private:
|
||||
void init_default_font();
|
||||
void create_device_objects();
|
||||
void create_fonts_texture();
|
||||
void init_font();
|
||||
void init_input();
|
||||
void init_style();
|
||||
void render_draw_data(ImDrawData *draw_data);
|
||||
bool display_initialized() const;
|
||||
void destroy_device_objects();
|
||||
void destroy_fonts_texture();
|
||||
void destroy_font();
|
||||
|
||||
static const char* clipboard_get(void* user_data);
|
||||
static void clipboard_set(void* user_data, const char* text);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue