Choose font by wxWidgetDialog

This commit is contained in:
Filip Sykala 2021-09-09 19:36:51 +02:00
parent 578abe4cce
commit 9d52ceee44
6 changed files with 317 additions and 109 deletions

View file

@ -4,11 +4,14 @@
// Include GLGizmoBase.hpp before I18N.hpp as it includes some libigl code,
// which overrides our localization "L" macro.
#include "GLGizmoBase.hpp"
#include "GLGizmosCommon.hpp"
#include "admesh/stl.h" // indexed_triangle_set
#include <optional>
#include <memory>
#include "libslic3r/Emboss.hpp"
#include "libslic3r/Point.hpp"
namespace Slic3r {
class ModelVolume;
@ -19,6 +22,8 @@ class GLGizmoEmboss : public GLGizmoBase
public:
GLGizmoEmboss(GLCanvas3D& parent, const std::string& icon_filename, unsigned int sprite_id);
virtual ~GLGizmoEmboss();
// pseudo virtual function, no inheritance
virtual bool gizmo_event(SLAGizmoEventType action, const Vec2d& mouse_position, bool shift_down, bool alt_down, bool control_down);
protected:
virtual bool on_init() override;
virtual std::string on_get_name() const override;
@ -27,7 +32,7 @@ protected:
virtual void on_render_input_window(float x, float y, float bottom_limit) override;
virtual bool on_is_activable() const override;
virtual bool on_is_selectable() const override { return true; }
virtual void on_set_state() override;
virtual void on_set_state() override;
private:
void process();
@ -42,7 +47,8 @@ private:
// so the change takes effect. (info by GLGizmoFdmSupports.hpp)
struct GuiCfg
{
const size_t max_font_name = 20; // count characters
GuiCfg() = default;
};
std::optional<GuiCfg> m_gui_cfg;
@ -50,14 +56,28 @@ private:
size_t m_font_selected;// index to m_font_list
std::optional<Emboss::Font> m_font;
Emboss::Glyphs m_font_glyph_cache;
size_t m_text_size;
std::unique_ptr<char[]> m_text;
Emboss::FontProp m_font_prop;
// text position
struct Orientation
{
Vec3f origin = Vec3f(0.f, 0.f, 0.f);
Vec3f normal = Vec3f(0.f, 0.f, 1.f);
Vec3f up = Vec3f(0.f, 1.f, 0.f);
Orientation() = default;
};
Orientation m_orientation;
float m_scale;
float m_emboss;
// actual volume
ModelVolume *m_volume;
};
} // namespace GUI