Added a wxMessageDialog as an alternative to the ImGui modal, in case it turns out not good enough
This commit is contained in:
parent
ac8f9ab3dc
commit
d1529296c6
2 changed files with 25 additions and 4 deletions
|
@ -2277,15 +2277,29 @@ RENDER_AGAIN:
|
||||||
bool generate = m_imgui->button(_(L("Auto-generate points")));
|
bool generate = m_imgui->button(_(L("Auto-generate points")));
|
||||||
|
|
||||||
if (generate) {
|
if (generate) {
|
||||||
|
#if SLAGIZMO_IMGUI_MODAL
|
||||||
ImGui::OpenPopup(_(L("Warning")));
|
ImGui::OpenPopup(_(L("Warning")));
|
||||||
m_show_modal = true;
|
m_show_modal = true;
|
||||||
force_refresh = true;
|
force_refresh = true;
|
||||||
|
#else
|
||||||
|
wxMessageDialog dlg(GUI::wxGetApp().plater(), _(L(
|
||||||
|
"Autogeneration will erase all currently assigned points.\n\n"
|
||||||
|
"Are you sure you want to do it?\n"
|
||||||
|
)), _(L("Warning")), wxICON_WARNING | wxYES | wxNO);
|
||||||
|
if (dlg.ShowModal() == wxID_YES) {
|
||||||
|
m_model_object->sla_support_points.clear();
|
||||||
|
m_editing_mode_cache.clear();
|
||||||
|
wxGetApp().plater()->reslice();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#if SLAGIZMO_IMGUI_MODAL
|
||||||
if (m_show_modal) {
|
if (m_show_modal) {
|
||||||
if (ImGui::BeginPopupModal(_(L("Warning")), &m_show_modal/*, ImGuiWindowFlags_NoDecoration*/))
|
if (ImGui::BeginPopupModal(_(L("Warning")), &m_show_modal/*, ImGuiWindowFlags_NoDecoration*/))
|
||||||
{
|
{
|
||||||
m_imgui->text(_(L("This will erase all your manual changes.")));
|
m_imgui->text(_(L("Autogeneration will erase all currently assigned points.")));
|
||||||
|
m_imgui->text("");
|
||||||
|
m_imgui->text(_(L("Are you sure you want to do it?")));
|
||||||
|
|
||||||
if (m_imgui->button(_(L("Continue"))))
|
if (m_imgui->button(_(L("Continue"))))
|
||||||
{
|
{
|
||||||
|
@ -2307,7 +2321,7 @@ RENDER_AGAIN:
|
||||||
if (!m_show_modal)
|
if (!m_show_modal)
|
||||||
force_refresh = true;
|
force_refresh = true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
bool editing_clicked = m_imgui->button("Editing");
|
bool editing_clicked = m_imgui->button("Editing");
|
||||||
if (editing_clicked) {
|
if (editing_clicked) {
|
||||||
|
@ -2370,10 +2384,12 @@ void GLGizmoSlaSupports::on_set_state()
|
||||||
if (m_state == Off) {
|
if (m_state == Off) {
|
||||||
m_parent.toggle_model_objects_visibility(true);
|
m_parent.toggle_model_objects_visibility(true);
|
||||||
m_editing_mode = false;
|
m_editing_mode = false;
|
||||||
|
#if SLAGIZMO_IMGUI_MODAL
|
||||||
if (m_show_modal) {
|
if (m_show_modal) {
|
||||||
m_show_modal = false;
|
m_show_modal = false;
|
||||||
on_render_input_window(0,0,m_parent.get_selection()); // this is necessary to allow ImGui to terminate the modal dialog correctly
|
on_render_input_window(0,0,m_parent.get_selection()); // this is necessary to allow ImGui to terminate the modal dialog correctly
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -437,6 +437,9 @@ protected:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define SLAGIZMO_IMGUI_MODAL 1
|
||||||
class GLGizmoSlaSupports : public GLGizmoBase
|
class GLGizmoSlaSupports : public GLGizmoBase
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
@ -493,7 +496,9 @@ private:
|
||||||
Vec2d m_selection_rectangle_start_corner;
|
Vec2d m_selection_rectangle_start_corner;
|
||||||
Vec2d m_selection_rectangle_end_corner;
|
Vec2d m_selection_rectangle_end_corner;
|
||||||
bool m_ignore_up_event = false;
|
bool m_ignore_up_event = false;
|
||||||
|
#if SLAGIZMO_IMGUI_MODAL
|
||||||
bool m_show_modal = false;
|
bool m_show_modal = false;
|
||||||
|
#endif
|
||||||
int m_canvas_width;
|
int m_canvas_width;
|
||||||
int m_canvas_height;
|
int m_canvas_height;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue