FIX: Change label from string to wxString

jira: STUDIO-4853
Change label from string to wxString so that it can be translated into
Chinese.

Signed-off-by: wenjie.guo <wenjie.guo@bambulab.com>
Change-Id: Ice79264a1ff65f9ce2639317dde37a1cfa9b0551
This commit is contained in:
wenjie.guo 2023-10-24 17:45:11 +08:00 committed by Lane.Wei
parent 793e326264
commit faaaaf3684
1 changed files with 8 additions and 9 deletions

View File

@ -619,31 +619,30 @@ void IMSlider::draw_colored_band(const ImRect& groove, const ImRect& slideable_r
void IMSlider::draw_custom_label_block(const ImVec2 anchor, Type type)
{
std::string label;
wxString label;
switch (type)
{
case ColorChange:
label = "Color";
label = _L("Color");
break;
case PausePrint:
label = "Pause";
label = _L("Pause");
break;
case ToolChange:
label = "Color";
label = _L("Color");
break;
case Template:
label = "Template";
label = _L("Template");
break;
case Custom:
label = "Custom";
label = _L("Custom");
break;
case Unknown:
break;
default:
break;
}
const ImVec2 text_size = ImGui::CalcTextSize(label.c_str());
const ImVec2 text_size = ImGui::CalcTextSize(into_u8(label).c_str());
const ImVec2 padding = ImVec2(4, 2) * m_scale;
const ImU32 clr = IM_COL32(255, 111, 0, 255);
const float rounding = 2.0f * m_scale;
@ -651,7 +650,7 @@ void IMSlider::draw_custom_label_block(const ImVec2 anchor, Type type)
ImVec2 block_size = { text_size.x + padding.x * 2, text_size.y + padding.y * 2 };
ImGui::RenderFrame(block_pos, block_pos + block_size, clr, false, rounding);
ImGui::PushStyleColor(ImGuiCol_Text, { 1,1,1,1 });
ImGui::RenderText(block_pos + padding, label.c_str());
ImGui::RenderText(block_pos + padding, into_u8(label).c_str());
ImGui::PopStyleColor();
}