From a8610f990eb47eadbf67fc7ae2381ff32a18a213 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Tue, 26 Feb 2019 12:56:13 +0100 Subject: Automatic generation of variants of icons for toolbars and gizmos --- src/slic3r/GUI/GLToolbar.cpp | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'src/slic3r/GUI/GLToolbar.cpp') diff --git a/src/slic3r/GUI/GLToolbar.cpp b/src/slic3r/GUI/GLToolbar.cpp index 5f5350299..144662c3f 100644 --- a/src/slic3r/GUI/GLToolbar.cpp +++ b/src/slic3r/GUI/GLToolbar.cpp @@ -124,8 +124,15 @@ GLToolbar::Layout::Layout() { } +#if ENABLE_SVG_ICONS +GLToolbar::GLToolbar(GLToolbar::EType type, const std::string& name) +#else GLToolbar::GLToolbar(GLToolbar::EType type) +#endif // ENABLE_SVG_ICONS : m_type(type) +#if ENABLE_SVG_ICONS + , m_name(name) +#endif // ENABLE_SVG_ICONS , m_enabled(false) #if ENABLE_SVG_ICONS , m_icons_texture_dirty(true) @@ -1231,7 +1238,25 @@ bool GLToolbar::generate_icons_texture() const filenames.push_back(path + icon_filename); } - bool res = m_icons_texture.load_from_svg_files_as_sprites_array(filenames, GLToolbarItem::Num_States, (unsigned int)(m_layout.icons_size * m_layout.scale)); + std::vector> states; + if (m_name == "Top") + { + states.push_back(std::make_pair(1, false)); + states.push_back(std::make_pair(0, false)); + states.push_back(std::make_pair(2, false)); + states.push_back(std::make_pair(0, false)); + states.push_back(std::make_pair(0, false)); + } + else if (m_name == "View") + { + states.push_back(std::make_pair(1, false)); + states.push_back(std::make_pair(1, true)); + states.push_back(std::make_pair(1, false)); + states.push_back(std::make_pair(0, false)); + states.push_back(std::make_pair(1, true)); + } + + bool res = m_icons_texture.load_from_svg_files_as_sprites_array(filenames, states, (unsigned int)(m_layout.icons_size * m_layout.scale)); if (res) m_icons_texture_dirty = false; -- cgit v1.2.3