GLToolbar::m_imgui_hovered_pos replaced with GLCanvas3D::m_imgui_undo_redo_hovered_pos

This commit is contained in:
Enrico Turri 2019-07-10 14:08:14 +02:00
parent 14dad5039a
commit 1b5ab100bd
3 changed files with 6 additions and 8 deletions

View file

@ -3482,14 +3482,14 @@ void GLCanvas3D::_render_undo_redo_stack(const bool is_undo, float pos_x)
imgui->begin(wxString::Format(_(L("%s Stack")), stack_name),
ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse);
int hovered = m_toolbar.get_imgui_hovered_pos();
int hovered = m_imgui_undo_redo_hovered_pos;
int selected = -1;
const float em = static_cast<float>(wxGetApp().em_unit());
if (imgui->undo_redo_list(ImVec2(12 * em, 20 * em), is_undo, &string_getter, hovered, selected))
m_toolbar.set_imgui_hovered_pos(hovered);
m_imgui_undo_redo_hovered_pos = hovered;
else
m_toolbar.set_imgui_hovered_pos(-1);
m_imgui_undo_redo_hovered_pos = -1;
if (selected >= 0)
is_undo ? wxGetApp().plater()->undo_to(selected) : wxGetApp().plater()->redo_to(selected);
@ -3684,7 +3684,7 @@ bool GLCanvas3D::_init_toolbar()
#endif // ENABLE_SVG_ICONS
item.tooltip = _utf8(L("Undo")) + " [" + GUI::shortkey_ctrl_prefix() + "Z]";
item.sprite_id = 11;
item.action_callback = [this]() { if (m_canvas != nullptr) m_toolbar.set_imgui_hovered_pos(-1); };
item.action_callback = [this]() { m_imgui_undo_redo_hovered_pos = -1; };
item.visibility_callback = []()->bool { return true; };
item.enabled_state_callback = [this]()->bool { return wxGetApp().plater()->can_undo(); } ;
item.render_callback = [this](float left, float right, float, float) { if (m_canvas != nullptr) _render_undo_redo_stack(true, 0.5f * (left + right)); };

View file

@ -488,6 +488,8 @@ private:
RenderStats m_render_stats;
#endif // ENABLE_RENDER_STATISTICS
int m_imgui_undo_redo_hovered_pos{ -1 };
public:
GLCanvas3D(wxGLCanvas* canvas, Bed3D& bed, Camera& camera, GLToolbar& view_toolbar);
~GLCanvas3D();

View file

@ -252,7 +252,6 @@ private:
MouseCapture m_mouse_capture;
std::string m_tooltip;
int m_imgui_hovered_pos { -1 };
unsigned int m_pressed_toggable_id;
public:
@ -312,9 +311,6 @@ public:
bool on_mouse(wxMouseEvent& evt, GLCanvas3D& parent);
void set_imgui_hovered_pos(int pos = -1) { m_imgui_hovered_pos = pos; }
int get_imgui_hovered_pos() const { return m_imgui_hovered_pos; }
private:
void calc_layout() const;
float get_width_horizontal() const;