1st installment of svg icons for toolbars and gizmos

This commit is contained in:
Enrico Turri 2019-02-26 09:56:23 +01:00
commit 0f683a6a1e
34 changed files with 1629 additions and 374 deletions

View file

@ -125,7 +125,11 @@ enum class SLAGizmoEventType {
Dragging,
Delete,
SelectAll,
ShiftUp
ShiftUp,
ApplyChanges,
DiscardChanges,
AutomaticGeneration,
ManualEditing
};
@ -631,6 +635,10 @@ private:
class Gizmos
{
public:
#if ENABLE_SVG_ICONS
static const float Default_Icons_Size;
#endif // ENABLE_SVG_ICONS
enum EType : unsigned char
{
Undefined,
@ -647,11 +655,21 @@ private:
bool m_enabled;
typedef std::map<EType, GLGizmoBase*> GizmosMap;
GizmosMap m_gizmos;
#if ENABLE_SVG_ICONS
mutable GLTexture m_icons_texture;
mutable bool m_icons_texture_dirty;
#else
ItemsIconsTexture m_icons_texture;
#endif // ENABLE_SVG_ICONS
BackgroundTexture m_background_texture;
EType m_current;
#if ENABLE_SVG_ICONS
float m_overlay_icons_size;
float m_overlay_scale;
#else
float m_overlay_icons_scale;
#endif // ENABLE_SVG_ICONS
float m_overlay_border;
float m_overlay_gap_y;
@ -664,6 +682,9 @@ private:
bool is_enabled() const;
void set_enabled(bool enable);
#if ENABLE_SVG_ICONS
void set_overlay_icon_size(float size);
#endif // ENABLE_SVG_ICONS
void set_overlay_scale(float scale);
std::string update_hover_state(const GLCanvas3D& canvas, const Vec2d& mouse_pos, const Selection& selection);
@ -713,15 +734,19 @@ private:
#endif // not ENABLE_IMGUI
private:
void _reset();
void reset();
void _render_overlay(const GLCanvas3D& canvas, const Selection& selection) const;
void _render_current_gizmo(const Selection& selection) const;
void do_render_overlay(const GLCanvas3D& canvas, const Selection& selection) const;
void do_render_current_gizmo(const Selection& selection) const;
float _get_total_overlay_height() const;
float _get_total_overlay_width() const;
float get_total_overlay_height() const;
float get_total_overlay_width() const;
GLGizmoBase* _get_current() const;
GLGizmoBase* get_current() const;
#if ENABLE_SVG_ICONS
bool generate_icons_texture() const;
#endif // ENABLE_SVG_ICONS
};
struct SlaCap
@ -1092,7 +1117,9 @@ private:
bool _is_any_volume_outside() const;
#if !ENABLE_SVG_ICONS
void _resize_toolbars() const;
#endif // !ENABLE_SVG_ICONS
static std::vector<float> _parse_colors(const std::vector<std::string>& colors);