2022-08-12 13:13:52 +00:00
|
|
|
#ifndef slic3r_GLGizmoText_hpp_
|
|
|
|
#define slic3r_GLGizmoText_hpp_
|
|
|
|
|
|
|
|
#include "GLGizmoBase.hpp"
|
|
|
|
#include "slic3r/GUI/3DScene.hpp"
|
2022-12-10 10:51:24 +00:00
|
|
|
#include "../GLTexture.hpp"
|
2022-08-12 13:13:52 +00:00
|
|
|
|
|
|
|
namespace Slic3r {
|
|
|
|
|
|
|
|
enum class ModelVolumeType : int;
|
2022-12-16 04:57:46 +00:00
|
|
|
class ModelVolume;
|
2022-08-12 13:13:52 +00:00
|
|
|
|
|
|
|
namespace GUI {
|
|
|
|
|
|
|
|
class GLGizmoText : public GLGizmoBase
|
|
|
|
{
|
|
|
|
private:
|
2022-12-08 03:22:22 +00:00
|
|
|
std::vector<std::string> m_avail_font_names;
|
2022-08-30 02:38:13 +00:00
|
|
|
char m_text[1024] = { 0 };
|
2022-08-12 13:13:52 +00:00
|
|
|
std::string m_font_name;
|
|
|
|
float m_font_size = 16.f;
|
|
|
|
int m_curr_font_idx = 0;
|
|
|
|
bool m_bold = true;
|
|
|
|
bool m_italic = false;
|
|
|
|
float m_thickness = 2.f;
|
2022-12-10 10:51:24 +00:00
|
|
|
float m_combo_height = 0.0f;
|
|
|
|
float m_combo_width = 0.0f;
|
|
|
|
float m_scale;
|
|
|
|
|
|
|
|
class TextureInfo {
|
|
|
|
public:
|
|
|
|
GLTexture* texture { nullptr };
|
|
|
|
int h;
|
|
|
|
int w;
|
|
|
|
int hl;
|
|
|
|
|
|
|
|
std::string font_name;
|
|
|
|
};
|
|
|
|
|
|
|
|
std::vector<TextureInfo> m_textures;
|
2022-08-12 13:13:52 +00:00
|
|
|
|
2022-12-16 04:57:46 +00:00
|
|
|
bool m_is_modify = false;
|
|
|
|
int m_object_idx;
|
|
|
|
int m_volume_idx;
|
|
|
|
|
2022-08-12 13:13:52 +00:00
|
|
|
public:
|
|
|
|
GLGizmoText(GLCanvas3D& parent, const std::string& icon_filename, unsigned int sprite_id);
|
2022-12-10 10:51:24 +00:00
|
|
|
~GLGizmoText();
|
|
|
|
|
|
|
|
void update_font_texture();
|
2022-08-12 13:13:52 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual bool on_init() override;
|
|
|
|
virtual std::string on_get_name() const override;
|
|
|
|
virtual bool on_is_activable() const override;
|
|
|
|
virtual void on_render() override;
|
|
|
|
virtual void on_render_for_picking() override;
|
2022-08-23 10:26:42 +00:00
|
|
|
void push_combo_style(const float scale);
|
2022-08-22 06:53:29 +00:00
|
|
|
void pop_combo_style();
|
2022-11-15 11:28:46 +00:00
|
|
|
void push_button_style(bool pressed);
|
|
|
|
void pop_button_style();
|
2022-08-12 13:13:52 +00:00
|
|
|
virtual void on_set_state() override;
|
|
|
|
virtual CommonGizmosDataID on_get_requirements() const override;
|
|
|
|
virtual void on_render_input_window(float x, float y, float bottom_limit);
|
2022-12-16 04:57:46 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
ModelVolume *get_selected_single_volume(int& out_object_idx, int& out_volume_idx) const;
|
|
|
|
void reset_text_info();
|
2022-08-12 13:13:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace GUI
|
|
|
|
} // namespace Slic3r
|
|
|
|
|
|
|
|
#endif // slic3r_GLGizmoText_hpp_
|