mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-12-05 16:51:07 -07:00
FIX: dark mode 3rd printer bed display
1.fix custom bed render grid inappropriately 2.optimize: do not init toolbar every time switch dark mode Change-Id: I354496c6c982d9f72b22629f6973a79d65189dda
This commit is contained in:
parent
daf4b4ef74
commit
a9c180df24
7 changed files with 107 additions and 4 deletions
|
|
@ -166,6 +166,10 @@ GLGizmoBase::GLGizmoBase(GLCanvas3D& parent, const std::string& icon_filename, u
|
|||
m_cylinder.init_from(its_make_cylinder(1., 1., 2 * PI / 24.));
|
||||
}
|
||||
|
||||
void GLGizmoBase::set_icon_filename(const std::string &filename) {
|
||||
m_icon_filename = filename;
|
||||
}
|
||||
|
||||
void GLGizmoBase::set_hover_id(int id)
|
||||
{
|
||||
if (m_grabbers.empty() || (id < (int)m_grabbers.size()))
|
||||
|
|
|
|||
|
|
@ -151,6 +151,8 @@ public:
|
|||
|
||||
const std::string& get_icon_filename() const { return m_icon_filename; }
|
||||
|
||||
void set_icon_filename(const std::string& filename);
|
||||
|
||||
bool is_activable() const { return on_is_activable(); }
|
||||
bool is_selectable() const { return on_is_selectable(); }
|
||||
CommonGizmosDataID get_requirements() const { return on_get_requirements(); }
|
||||
|
|
|
|||
|
|
@ -120,6 +120,51 @@ size_t GLGizmosManager::get_gizmo_idx_from_mouse(const Vec2d& mouse_pos) const
|
|||
return Undefined;
|
||||
}
|
||||
|
||||
void GLGizmosManager::switch_gizmos_icon_filename()
|
||||
{
|
||||
m_background_texture.metadata.filename = m_is_dark ? "toolbar_background_dark.png" : "toolbar_background.png";
|
||||
m_background_texture.metadata.left = 16;
|
||||
m_background_texture.metadata.top = 16;
|
||||
m_background_texture.metadata.right = 16;
|
||||
m_background_texture.metadata.bottom = 16;
|
||||
if (!m_background_texture.metadata.filename.empty())
|
||||
m_background_texture.texture.load_from_file(resources_dir() + "/images/" + m_background_texture.metadata.filename, false, GLTexture::SingleThreaded, false);
|
||||
|
||||
for (auto& gizmo : m_gizmos) {
|
||||
gizmo->on_change_color_mode(m_is_dark);
|
||||
switch (gizmo->get_sprite_id())
|
||||
{
|
||||
case(EType::Move):
|
||||
gizmo->set_icon_filename(m_is_dark ? "toolbar_move_dark.svg" : "toolbar_move.svg");
|
||||
break;
|
||||
case(EType::Rotate):
|
||||
gizmo->set_icon_filename(m_is_dark ? "toolbar_rotate_dark.svg" : "toolbar_rotate.svg");
|
||||
break;
|
||||
case(EType::Scale):
|
||||
gizmo->set_icon_filename(m_is_dark ? "toolbar_scale_dark.svg" : "toolbar_scale.svg");
|
||||
break;
|
||||
case(EType::Flatten):
|
||||
gizmo->set_icon_filename(m_is_dark ? "toolbar_flatten_dark.svg" : "toolbar_flatten.svg");
|
||||
break;
|
||||
case(EType::Cut):
|
||||
gizmo->set_icon_filename(m_is_dark ? "toolbar_cut_dark.svg" : "toolbar_cut.svg");
|
||||
break;
|
||||
case(EType::FdmSupports):
|
||||
gizmo->set_icon_filename(m_is_dark ? "toolbar_support_dark.svg" : "toolbar_support.svg");
|
||||
break;
|
||||
case(EType::Seam):
|
||||
gizmo->set_icon_filename(m_is_dark ? "toolbar_seam_dark.svg" : "toolbar_seam.svg");
|
||||
break;
|
||||
case(EType::Text):
|
||||
gizmo->set_icon_filename(m_is_dark ? "toolbar_text_dark.svg" : "toolbar_text.svg");
|
||||
break;
|
||||
case(EType::MmuSegmentation):
|
||||
gizmo->set_icon_filename(m_is_dark ? "mmu_segmentation_dark.svg" : "mmu_segmentation.svg");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool GLGizmosManager::init()
|
||||
{
|
||||
bool result = init_icon_textures();
|
||||
|
|
|
|||
|
|
@ -163,6 +163,8 @@ public:
|
|||
|
||||
explicit GLGizmosManager(GLCanvas3D& parent);
|
||||
|
||||
void switch_gizmos_icon_filename();
|
||||
|
||||
bool init();
|
||||
|
||||
bool init_icon_textures();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue