diff options
author | Enrico Turri <enricoturri@seznam.cz> | 2018-12-06 14:37:39 +0300 |
---|---|---|
committer | Enrico Turri <enricoturri@seznam.cz> | 2018-12-06 14:37:39 +0300 |
commit | 8d78b23c7878e7880be6047eb7c6453dab570f96 (patch) | |
tree | 3342ab0bac825937649a78069090418cf5e90e3e /src/slic3r | |
parent | c908a4674ab1667de51e55675619a378483dc664 (diff) |
Removal of tabs from plater -> Fixed buttons update when switching between views using keyboard
Diffstat (limited to 'src/slic3r')
-rw-r--r-- | src/slic3r/GUI/GLCanvas3D.cpp | 2 | ||||
-rw-r--r-- | src/slic3r/GUI/GLToolbar.cpp | 14 | ||||
-rw-r--r-- | src/slic3r/GUI/GLToolbar.hpp | 2 | ||||
-rw-r--r-- | src/slic3r/GUI/MainFrame.cpp | 4 | ||||
-rw-r--r-- | src/slic3r/GUI/Plater.cpp | 8 |
5 files changed, 22 insertions, 8 deletions
diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 2b9022bf9..05ec54b12 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -4985,7 +4985,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) // updates view toolbar overlay if (tooltip.empty() && (m_view_toolbar != nullptr)) { - tooltip = m_view_toolbar->update_hover_state(m_mouse.position, *this); + tooltip = m_view_toolbar->update_hover_state(m_mouse.position, *this); if (!tooltip.empty()) m_dirty = true; } diff --git a/src/slic3r/GUI/GLToolbar.cpp b/src/slic3r/GUI/GLToolbar.cpp index c06c0fa7b..d3bd54d56 100644 --- a/src/slic3r/GUI/GLToolbar.cpp +++ b/src/slic3r/GUI/GLToolbar.cpp @@ -939,7 +939,7 @@ int GLRadioToolbar::contains_mouse(const Vec2d& mouse_pos, const GLCanvas3D& par return -1; } -std::string GLRadioToolbar::update_hover_state(const Vec2d& mouse_pos, const GLCanvas3D& parent) +std::string GLRadioToolbar::update_hover_state(const Vec2d& mouse_pos, GLCanvas3D& parent) { float zoom = parent.get_camera_zoom(); float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f; @@ -967,7 +967,10 @@ std::string GLRadioToolbar::update_hover_state(const Vec2d& mouse_pos, const GLC case GLRadioToolbarItem::Normal: { if (inside) + { item->set_state(GLRadioToolbarItem::Hover); + parent.set_as_dirty(); + } break; } @@ -976,14 +979,20 @@ std::string GLRadioToolbar::update_hover_state(const Vec2d& mouse_pos, const GLC if (inside) tooltip = item->get_tooltip(); else + { item->set_state(GLRadioToolbarItem::Normal); + parent.set_as_dirty(); + } break; } case GLRadioToolbarItem::Pressed: { if (inside) + { item->set_state(GLRadioToolbarItem::HoverPressed); + parent.set_as_dirty(); + } break; } @@ -992,7 +1001,10 @@ std::string GLRadioToolbar::update_hover_state(const Vec2d& mouse_pos, const GLC if (inside) tooltip = item->get_tooltip(); else + { item->set_state(GLRadioToolbarItem::Pressed); + parent.set_as_dirty(); + } break; } diff --git a/src/slic3r/GUI/GLToolbar.hpp b/src/slic3r/GUI/GLToolbar.hpp index 85e606583..7eab518f7 100644 --- a/src/slic3r/GUI/GLToolbar.hpp +++ b/src/slic3r/GUI/GLToolbar.hpp @@ -268,7 +268,7 @@ public: // returns the id of the item under the given mouse position or -1 if none int contains_mouse(const Vec2d& mouse_pos, const GLCanvas3D& parent) const; - std::string update_hover_state(const Vec2d& mouse_pos, const GLCanvas3D& parent); + std::string update_hover_state(const Vec2d& mouse_pos, GLCanvas3D& parent); void do_action(unsigned int item_id, GLCanvas3D& parent); diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index e07c447c1..74c28cb6b 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -345,9 +345,9 @@ void MainFrame::init_menubar() if (m_plater) { windowMenu->AppendSeparator(); wxMenuItem* item_3d = append_menu_item(windowMenu, wxID_ANY, L("3D\tCtrl+5"), L("Show the 3D editing view"), - [this](wxCommandEvent&) { m_plater->select_view_3D("3D"); }, ""); + [this](wxCommandEvent&) { m_plater->select_view_3D("3D"); }, ""); wxMenuItem* item_preview = append_menu_item(windowMenu, wxID_ANY, L("Preview\tCtrl+6"), L("Show the 3D slices preview"), - [this](wxCommandEvent&) { m_plater->select_view_3D("Preview"); }, ""); + [this](wxCommandEvent&) { m_plater->select_view_3D("Preview"); }, ""); Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_change_view()); }, item_3d->GetId()); Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_change_view()); }, item_preview->GetId()); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 20a985928..663054cba 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -1295,6 +1295,8 @@ void Plater::priv::select_view_3D(const std::string& name) set_current_panel(view3D); else if (name == "Preview") set_current_panel(preview); + + view_toolbar.set_selection(name); } #else void Plater::priv::select_view(const std::string& direction) @@ -2482,14 +2484,14 @@ void Plater::priv::init_view_toolbar() GLRadioToolbarItem::Data item; - item.name = "3d"; + item.name = "3D"; item.tooltip = GUI::L_str("3D editor view"); item.sprite_id = 0; item.action_event = EVT_GLVIEWTOOLBAR_3D; if (!view_toolbar.add_item(item)) return; - item.name = "preview"; + item.name = "Preview"; item.tooltip = GUI::L_str("Preview"); item.sprite_id = 1; item.action_event = EVT_GLVIEWTOOLBAR_PREVIEW; @@ -2499,7 +2501,7 @@ void Plater::priv::init_view_toolbar() view3D->set_view_toolbar(&view_toolbar); preview->set_view_toolbar(&view_toolbar); - view_toolbar.set_selection("3d"); + view_toolbar.set_selection("3D"); } #endif // ENABLE_REMOVE_TABS_FROM_PLATER |