GLToolbar::m_imgui_hovered_pos replaced with GLCanvas3D::m_imgui_undo_redo_hovered_pos
This commit is contained in:
parent
14dad5039a
commit
1b5ab100bd
3 changed files with 6 additions and 8 deletions
|
@ -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),
|
imgui->begin(wxString::Format(_(L("%s Stack")), stack_name),
|
||||||
ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse);
|
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;
|
int selected = -1;
|
||||||
const float em = static_cast<float>(wxGetApp().em_unit());
|
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))
|
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
|
else
|
||||||
m_toolbar.set_imgui_hovered_pos(-1);
|
m_imgui_undo_redo_hovered_pos = -1;
|
||||||
|
|
||||||
if (selected >= 0)
|
if (selected >= 0)
|
||||||
is_undo ? wxGetApp().plater()->undo_to(selected) : wxGetApp().plater()->redo_to(selected);
|
is_undo ? wxGetApp().plater()->undo_to(selected) : wxGetApp().plater()->redo_to(selected);
|
||||||
|
@ -3684,7 +3684,7 @@ bool GLCanvas3D::_init_toolbar()
|
||||||
#endif // ENABLE_SVG_ICONS
|
#endif // ENABLE_SVG_ICONS
|
||||||
item.tooltip = _utf8(L("Undo")) + " [" + GUI::shortkey_ctrl_prefix() + "Z]";
|
item.tooltip = _utf8(L("Undo")) + " [" + GUI::shortkey_ctrl_prefix() + "Z]";
|
||||||
item.sprite_id = 11;
|
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.visibility_callback = []()->bool { return true; };
|
||||||
item.enabled_state_callback = [this]()->bool { return wxGetApp().plater()->can_undo(); } ;
|
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)); };
|
item.render_callback = [this](float left, float right, float, float) { if (m_canvas != nullptr) _render_undo_redo_stack(true, 0.5f * (left + right)); };
|
||||||
|
|
|
@ -488,6 +488,8 @@ private:
|
||||||
RenderStats m_render_stats;
|
RenderStats m_render_stats;
|
||||||
#endif // ENABLE_RENDER_STATISTICS
|
#endif // ENABLE_RENDER_STATISTICS
|
||||||
|
|
||||||
|
int m_imgui_undo_redo_hovered_pos{ -1 };
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GLCanvas3D(wxGLCanvas* canvas, Bed3D& bed, Camera& camera, GLToolbar& view_toolbar);
|
GLCanvas3D(wxGLCanvas* canvas, Bed3D& bed, Camera& camera, GLToolbar& view_toolbar);
|
||||||
~GLCanvas3D();
|
~GLCanvas3D();
|
||||||
|
|
|
@ -252,7 +252,6 @@ private:
|
||||||
|
|
||||||
MouseCapture m_mouse_capture;
|
MouseCapture m_mouse_capture;
|
||||||
std::string m_tooltip;
|
std::string m_tooltip;
|
||||||
int m_imgui_hovered_pos { -1 };
|
|
||||||
unsigned int m_pressed_toggable_id;
|
unsigned int m_pressed_toggable_id;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -312,9 +311,6 @@ public:
|
||||||
|
|
||||||
bool on_mouse(wxMouseEvent& evt, GLCanvas3D& parent);
|
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:
|
private:
|
||||||
void calc_layout() const;
|
void calc_layout() const;
|
||||||
float get_width_horizontal() const;
|
float get_width_horizontal() const;
|
||||||
|
|
Loading…
Reference in a new issue