ENABLE_GCODE_VIEWER_AS_STATE -> Fixed collapse toolbar showing-up when presing [T] in gcode preview mode

This commit is contained in:
enricoturri1966 2020-07-29 15:40:28 +02:00
parent 0348986bda
commit 39d08441cc
4 changed files with 13 additions and 15 deletions

View file

@ -4295,8 +4295,13 @@ void GLCanvas3D::update_ui_from_settings()
} }
#endif // ENABLE_RETINA_GL #endif // ENABLE_RETINA_GL
#if ENABLE_GCODE_VIEWER_AS_STATE
if (wxGetApp().mainframe != nullptr && wxGetApp().mainframe->get_mode() != MainFrame::EMode::GCodeViewer)
wxGetApp().plater()->get_collapse_toolbar().set_enabled(wxGetApp().app_config->get("show_collapse_button") == "1");
#else
bool enable_collapse = wxGetApp().app_config->get("show_collapse_button") == "1"; bool enable_collapse = wxGetApp().app_config->get("show_collapse_button") == "1";
wxGetApp().plater()->get_collapse_toolbar().set_enabled(enable_collapse); wxGetApp().plater()->get_collapse_toolbar().set_enabled(enable_collapse);
#endif // ENABLE_GCODE_VIEWER_AS_STATE
} }

View file

@ -230,24 +230,13 @@ void GLToolbar::set_icons_size(float size)
void GLToolbar::set_scale(float scale) void GLToolbar::set_scale(float scale)
{ {
if (m_layout.scale != scale) if (m_layout.scale != scale) {
{
m_layout.scale = scale; m_layout.scale = scale;
m_layout.dirty = true; m_layout.dirty = true;
m_icons_texture_dirty = true; m_icons_texture_dirty = true;
} }
} }
bool GLToolbar::is_enabled() const
{
return m_enabled;
}
void GLToolbar::set_enabled(bool enable)
{
m_enabled = enable;//true; etFIXME
}
bool GLToolbar::add_item(const GLToolbarItem::Data& data) bool GLToolbar::add_item(const GLToolbarItem::Data& data)
{ {
GLToolbarItem* item = new GLToolbarItem(GLToolbarItem::Action, data); GLToolbarItem* item = new GLToolbarItem(GLToolbarItem::Action, data);

View file

@ -276,8 +276,8 @@ public:
void set_icons_size(float size); void set_icons_size(float size);
void set_scale(float scale); void set_scale(float scale);
bool is_enabled() const; bool is_enabled() const { return m_enabled; }
void set_enabled(bool enable); void set_enabled(bool enable) { m_enabled = enable; }
bool add_item(const GLToolbarItem::Data& data); bool add_item(const GLToolbarItem::Data& data);
bool add_separator(); bool add_separator();

View file

@ -279,8 +279,12 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S
update_ui_from_settings(); // FIXME (?) update_ui_from_settings(); // FIXME (?)
if (m_plater != nullptr) if (m_plater != nullptr) {
#if ENABLE_GCODE_VIEWER_AS_STATE
m_plater->get_collapse_toolbar().set_enabled(wxGetApp().app_config->get("show_collapse_button") == "1");
#endif // ENABLE_GCODE_VIEWER_AS_STATE
m_plater->show_action_buttons(true); m_plater->show_action_buttons(true);
}
} }
#if ENABLE_LAYOUT_NO_RESTART #if ENABLE_LAYOUT_NO_RESTART