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:
parent
793e326264
commit
faaaaf3684
|
@ -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)
|
void IMSlider::draw_custom_label_block(const ImVec2 anchor, Type type)
|
||||||
{
|
{
|
||||||
std::string label;
|
wxString label;
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case ColorChange:
|
case ColorChange:
|
||||||
label = "Color";
|
label = _L("Color");
|
||||||
break;
|
break;
|
||||||
case PausePrint:
|
case PausePrint:
|
||||||
label = "Pause";
|
label = _L("Pause");
|
||||||
break;
|
break;
|
||||||
case ToolChange:
|
case ToolChange:
|
||||||
label = "Color";
|
label = _L("Color");
|
||||||
break;
|
break;
|
||||||
case Template:
|
case Template:
|
||||||
label = "Template";
|
label = _L("Template");
|
||||||
break;
|
break;
|
||||||
case Custom:
|
case Custom:
|
||||||
label = "Custom";
|
label = _L("Custom");
|
||||||
break;
|
break;
|
||||||
case Unknown:
|
case Unknown:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
const ImVec2 text_size = ImGui::CalcTextSize(into_u8(label).c_str());
|
||||||
const ImVec2 text_size = ImGui::CalcTextSize(label.c_str());
|
|
||||||
const ImVec2 padding = ImVec2(4, 2) * m_scale;
|
const ImVec2 padding = ImVec2(4, 2) * m_scale;
|
||||||
const ImU32 clr = IM_COL32(255, 111, 0, 255);
|
const ImU32 clr = IM_COL32(255, 111, 0, 255);
|
||||||
const float rounding = 2.0f * m_scale;
|
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 };
|
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::RenderFrame(block_pos, block_pos + block_size, clr, false, rounding);
|
||||||
ImGui::PushStyleColor(ImGuiCol_Text, { 1,1,1,1 });
|
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();
|
ImGui::PopStyleColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue