Naming of the entering/leaving snapshots is now more generic,

it uses the actual name of the gizmo. Also, the keyboard shortcut
is now appended to the name, instead of being duplicated in it.
This commit is contained in:
Lukas Matena 2021-08-27 09:04:33 +02:00
parent 4c80d9ed01
commit a4300b8e64
14 changed files with 34 additions and 20 deletions

View file

@ -232,6 +232,20 @@ void GLGizmoBase::render_input_window(float x, float y, float bottom_limit)
} }
} }
std::string GLGizmoBase::get_name(bool include_shortcut) const
{
int key = get_shortcut_key();
assert( key >= WXK_CONTROL_A && key <= WXK_CONTROL_Z);
std::string out = on_get_name();
if (include_shortcut)
out += std::string(" [") + char(int('A') + key - int(WXK_CONTROL_A)) + "]";
return out;
}
// Produce an alpha channel checksum for the red green blue components. The alpha channel may then be used to verify, whether the rgb components // Produce an alpha channel checksum for the red green blue components. The alpha channel may then be used to verify, whether the rgb components
// were not interpolated by alpha blending or multi sampling. // were not interpolated by alpha blending or multi sampling.
unsigned char picking_checksum_alpha_channel(unsigned char red, unsigned char green, unsigned char blue) unsigned char picking_checksum_alpha_channel(unsigned char red, unsigned char green, unsigned char blue)

View file

@ -120,7 +120,7 @@ public:
void load(cereal::BinaryInputArchive& ar) { m_state = On; on_load(ar); } void load(cereal::BinaryInputArchive& ar) { m_state = On; on_load(ar); }
void save(cereal::BinaryOutputArchive& ar) const { on_save(ar); } void save(cereal::BinaryOutputArchive& ar) const { on_save(ar); }
std::string get_name() const { return on_get_name(); } std::string get_name(bool include_shortcut = true) const;
int get_group_id() const { return m_group_id; } int get_group_id() const { return m_group_id; }
void set_group_id(int id) { m_group_id = id; } void set_group_id(int id) { m_group_id = id; }

View file

@ -49,7 +49,7 @@ bool GLGizmoCut::on_init()
std::string GLGizmoCut::on_get_name() const std::string GLGizmoCut::on_get_name() const
{ {
return (_L("Cut") + " [C]").ToUTF8().data(); return _u8L("Cut");
} }
void GLGizmoCut::on_set_state() void GLGizmoCut::on_set_state()

View file

@ -28,7 +28,7 @@ void GLGizmoFdmSupports::on_shutdown()
std::string GLGizmoFdmSupports::on_get_name() const std::string GLGizmoFdmSupports::on_get_name() const
{ {
return (_L("Paint-on supports") + " [L]").ToUTF8().data(); return _u8L("Paint-on supports");
} }
@ -85,7 +85,7 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l
y = std::min(y, bottom_limit - approx_height); y = std::min(y, bottom_limit - approx_height);
m_imgui->set_next_window_pos(x, y, ImGuiCond_Always); m_imgui->set_next_window_pos(x, y, ImGuiCond_Always);
m_imgui->begin(on_get_name(), ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoCollapse); m_imgui->begin(get_name(), ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoCollapse);
// First calculate width of all the texts that are could possibly be shown. We will decide set the dialog width based on that: // First calculate width of all the texts that are could possibly be shown. We will decide set the dialog width based on that:
const float clipping_slider_left = std::max(m_imgui->calc_text_size(m_desc.at("clipping_of_view")).x, const float clipping_slider_left = std::max(m_imgui->calc_text_size(m_desc.at("clipping_of_view")).x,

View file

@ -37,7 +37,7 @@ CommonGizmosDataID GLGizmoFlatten::on_get_requirements() const
std::string GLGizmoFlatten::on_get_name() const std::string GLGizmoFlatten::on_get_name() const
{ {
return (_L("Place on face") + " [F]").ToUTF8().data(); return _u8L("Place on face");
} }
bool GLGizmoFlatten::on_is_activable() const bool GLGizmoFlatten::on_is_activable() const

View file

@ -505,7 +505,7 @@ RENDER_AGAIN:
y = std::min(y, bottom_limit - approx_height); y = std::min(y, bottom_limit - approx_height);
m_imgui->set_next_window_pos(x, y, ImGuiCond_Always); m_imgui->set_next_window_pos(x, y, ImGuiCond_Always);
m_imgui->begin(on_get_name(), ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoCollapse); m_imgui->begin(get_name(), ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoCollapse);
// First calculate width of all the texts that are could possibly be shown. We will decide set the dialog width based on that: // First calculate width of all the texts that are could possibly be shown. We will decide set the dialog width based on that:
const float settings_sliders_left = const float settings_sliders_left =
@ -773,7 +773,7 @@ bool GLGizmoHollow::on_is_selectable() const
std::string GLGizmoHollow::on_get_name() const std::string GLGizmoHollow::on_get_name() const
{ {
return (_(L("Hollow and drill")) + " [H]").ToUTF8().data(); return _u8L("Hollow and drill");
} }

View file

@ -42,7 +42,7 @@ void GLGizmoMmuSegmentation::on_shutdown()
std::string GLGizmoMmuSegmentation::on_get_name() const std::string GLGizmoMmuSegmentation::on_get_name() const
{ {
// FIXME Lukas H.: Discuss and change shortcut // FIXME Lukas H.: Discuss and change shortcut
return (_L("Multimaterial painting") + " [N]").ToUTF8().data(); return _u8L("Multimaterial painting");
} }
bool GLGizmoMmuSegmentation::on_is_selectable() const bool GLGizmoMmuSegmentation::on_is_selectable() const
@ -239,7 +239,7 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
y = std::min(y, bottom_limit - approx_height); y = std::min(y, bottom_limit - approx_height);
m_imgui->set_next_window_pos(x, y, ImGuiCond_Always); m_imgui->set_next_window_pos(x, y, ImGuiCond_Always);
m_imgui->begin(on_get_name(), ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoCollapse); m_imgui->begin(get_name(), ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoCollapse);
// First calculate width of all the texts that are could possibly be shown. We will decide set the dialog width based on that: // First calculate width of all the texts that are could possibly be shown. We will decide set the dialog width based on that:
const float clipping_slider_left = std::max(m_imgui->calc_text_size(m_desc.at("clipping_of_view")).x, const float clipping_slider_left = std::max(m_imgui->calc_text_size(m_desc.at("clipping_of_view")).x,

View file

@ -52,7 +52,7 @@ bool GLGizmoMove3D::on_init()
std::string GLGizmoMove3D::on_get_name() const std::string GLGizmoMove3D::on_get_name() const
{ {
return (_L("Move") + " [M]").ToUTF8().data(); return _u8L("Move");
} }
bool GLGizmoMove3D::on_is_activable() const bool GLGizmoMove3D::on_is_activable() const

View file

@ -463,7 +463,7 @@ bool GLGizmoRotate3D::on_init()
std::string GLGizmoRotate3D::on_get_name() const std::string GLGizmoRotate3D::on_get_name() const
{ {
return (_L("Rotate") + " [R]").ToUTF8().data(); return _u8L("Rotate");
} }
bool GLGizmoRotate3D::on_is_activable() const bool GLGizmoRotate3D::on_is_activable() const

View file

@ -76,7 +76,7 @@ bool GLGizmoScale3D::on_init()
std::string GLGizmoScale3D::on_get_name() const std::string GLGizmoScale3D::on_get_name() const
{ {
return (_L("Scale") + " [S]").ToUTF8().data(); return _u8L("Scale");
} }
bool GLGizmoScale3D::on_is_activable() const bool GLGizmoScale3D::on_is_activable() const

View file

@ -48,7 +48,7 @@ bool GLGizmoSeam::on_init()
std::string GLGizmoSeam::on_get_name() const std::string GLGizmoSeam::on_get_name() const
{ {
return (_L("Seam painting") + " [P]").ToUTF8().data(); return _u8L("Seam painting");
} }
@ -79,7 +79,7 @@ void GLGizmoSeam::on_render_input_window(float x, float y, float bottom_limit)
const float approx_height = m_imgui->scaled(14.0f); const float approx_height = m_imgui->scaled(14.0f);
y = std::min(y, bottom_limit - approx_height); y = std::min(y, bottom_limit - approx_height);
m_imgui->set_next_window_pos(x, y, ImGuiCond_Always); m_imgui->set_next_window_pos(x, y, ImGuiCond_Always);
m_imgui->begin(on_get_name(), ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoCollapse); m_imgui->begin(get_name(), ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoCollapse);
// First calculate width of all the texts that are could possibly be shown. We will decide set the dialog width based on that: // First calculate width of all the texts that are could possibly be shown. We will decide set the dialog width based on that:
const float clipping_slider_left = std::max(m_imgui->calc_text_size(m_desc.at("clipping_of_view")).x, const float clipping_slider_left = std::max(m_imgui->calc_text_size(m_desc.at("clipping_of_view")).x,

View file

@ -44,7 +44,7 @@ bool GLGizmoSimplify::on_init()
std::string GLGizmoSimplify::on_get_name() const std::string GLGizmoSimplify::on_get_name() const
{ {
return (_L("Simplify")).ToUTF8().data(); return _u8L("Simplify");
} }
void GLGizmoSimplify::on_render() {} void GLGizmoSimplify::on_render() {}
@ -97,7 +97,7 @@ void GLGizmoSimplify::on_render_input_window(float x, float y, float bottom_limi
int flag = ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize | int flag = ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize |
ImGuiWindowFlags_NoCollapse; ImGuiWindowFlags_NoCollapse;
m_imgui->begin(on_get_name(), flag); m_imgui->begin(get_name(), flag);
size_t triangle_count = m_volume->mesh().its.indices.size(); size_t triangle_count = m_volume->mesh().its.indices.size();
// already reduced mesh // already reduced mesh

View file

@ -625,7 +625,7 @@ RENDER_AGAIN:
//ImGui::SetNextWindowPos(ImVec2(x, y - std::max(0.f, y+window_size.y-bottom_limit) )); //ImGui::SetNextWindowPos(ImVec2(x, y - std::max(0.f, y+window_size.y-bottom_limit) ));
//ImGui::SetNextWindowSize(ImVec2(window_size)); //ImGui::SetNextWindowSize(ImVec2(window_size));
m_imgui->begin(on_get_name(), ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoCollapse); m_imgui->begin(get_name(), ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoCollapse);
// adjust window position to avoid overlap the view toolbar // adjust window position to avoid overlap the view toolbar
float win_h = ImGui::GetWindowHeight(); float win_h = ImGui::GetWindowHeight();
@ -863,7 +863,7 @@ bool GLGizmoSlaSupports::on_is_selectable() const
std::string GLGizmoSlaSupports::on_get_name() const std::string GLGizmoSlaSupports::on_get_name() const
{ {
return (_L("SLA Support Points") + " [L]").ToUTF8().data(); return _u8L("SLA Support Points");
} }
CommonGizmosDataID GLGizmoSlaSupports::on_get_requirements() const CommonGizmosDataID GLGizmoSlaSupports::on_get_requirements() const

View file

@ -1210,13 +1210,13 @@ void GLGizmosManager::activate_gizmo(EType type)
if (! m_parent.get_gizmos_manager().is_serializing() if (! m_parent.get_gizmos_manager().is_serializing()
&& old_gizmo->wants_enter_leave_snapshots()) && old_gizmo->wants_enter_leave_snapshots())
Plater::TakeSnapshot snapshot(wxGetApp().plater(), Plater::TakeSnapshot snapshot(wxGetApp().plater(),
Slic3r::format(_utf8("Leaving %1%"), old_gizmo->get_name())); Slic3r::format(_utf8("Leaving %1%"), old_gizmo->get_name(false)));
} }
if (new_gizmo && ! m_parent.get_gizmos_manager().is_serializing() if (new_gizmo && ! m_parent.get_gizmos_manager().is_serializing()
&& new_gizmo->wants_enter_leave_snapshots()) && new_gizmo->wants_enter_leave_snapshots())
Plater::TakeSnapshot snapshot(wxGetApp().plater(), Plater::TakeSnapshot snapshot(wxGetApp().plater(),
Slic3r::format(_utf8("Entering %1%"), new_gizmo->get_name())); Slic3r::format(_utf8("Entering %1%"), new_gizmo->get_name(false)));
m_current = type; m_current = type;