Skip to content

Commit

Permalink
Fixed an unicode bug in Mesh boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
SoftFever committed Aug 9, 2023
1 parent 362ee83 commit 637a171
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion resources/web/model/css/dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ body

.ProcessBarSelected
{
border-left-color:#00AE42;
border-left-color:#009688;
}

.Block_BKGA
Expand Down
6 changes: 3 additions & 3 deletions resources/web/model/model.css
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ body
.swiper
{
--swiper-theme-color: #ff6600;/* 设置Swiper风格 */
--swiper-navigation-color: #00AE42;/* 单独设置按钮颜色 */
--swiper-navigation-color: #009688;/* 单独设置按钮颜色 */
--swiper-navigation-size: 30px;/* 设置按钮大小 */
}

Expand Down Expand Up @@ -161,12 +161,12 @@ body

.ProcessBarSelected
{
border-left-color:#00AE42;
border-left-color:#009688;
}

.ProcessBarSelected span
{
color:#00AE42;
color:#009688;
}

#Info_ProcessBar.ProcessBarSelected img
Expand Down
4 changes: 2 additions & 2 deletions src/libslic3r/PresetBundle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1296,7 +1296,7 @@ void PresetBundle::update_selections(AppConfig &config)
if (!f_colors.empty()) {
boost::algorithm::split(filament_colors, f_colors, boost::algorithm::is_any_of(","));
}
filament_colors.resize(filament_presets.size(), "#00AE42");
filament_colors.resize(filament_presets.size(), "#FF8040");
project_config.option<ConfigOptionStrings>("filament_colour")->values = filament_colors;
std::vector<std::string> matrix;
if (config.has_printer_setting(initial_printer_profile_name, "flush_volumes_matrix")) {
Expand Down Expand Up @@ -1402,7 +1402,7 @@ void PresetBundle::load_selections(AppConfig &config, const PresetPreferences& p
if (!f_colors.empty()) {
boost::algorithm::split(filament_colors, f_colors, boost::algorithm::is_any_of(","));
}
filament_colors.resize(filament_presets.size(), "#00AE42");
filament_colors.resize(filament_presets.size(), "#FF8040");
project_config.option<ConfigOptionStrings>("filament_colour")->values = filament_colors;
std::vector<std::string> matrix;
if (config.has_printer_setting(initial_printer_profile_name, "flush_volumes_matrix")) {
Expand Down
34 changes: 17 additions & 17 deletions src/slic3r/GUI/Gizmos/GLGizmoMeshBoolean.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ void GLGizmoMeshBoolean::on_render()
}

float src_color[3] = { 1.0f, 1.0f, 1.0f };
float tool_color[3] = { 0.0f, 174.0f / 255.0f, 66.0f / 255.0f };
float tool_color[3] = { 0.0f, 150.0f / 255.0f, 136.0f / 255.0f };
m_parent.get_selection().render_bounding_box(src_bb, src_color, m_parent.get_scale());
m_parent.get_selection().render_bounding_box(tool_bb, tool_color, m_parent.get_scale());
}
Expand Down Expand Up @@ -179,10 +179,10 @@ void GLGizmoMeshBoolean::on_render_input_window(float x, float y, float bottom_l
GizmoImguiSetNextWIndowPos(x, y, ImGuiCond_Always, 0.0f, 0.0f);
GizmoImguiBegin("MeshBoolean", ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoTitleBar);

const int max_tab_length = 2 * ImGui::GetStyle().FramePadding.x + std::max(ImGui::CalcTextSize(_L("Union").c_str()).x,
std::max(ImGui::CalcTextSize(_L("Difference").c_str()).x, ImGui::CalcTextSize(_L("Intersection").c_str()).x));
const int max_cap_length = ImGui::GetStyle().WindowPadding.x + ImGui::GetStyle().ItemSpacing.x + std::max(ImGui::CalcTextSize(_L("Source Volume").c_str()).x, ImGui::CalcTextSize(_L("Tool Volume").c_str()).x);
const int select_btn_length = 2 * ImGui::GetStyle().FramePadding.x + std::max(ImGui::CalcTextSize(("1 " + _L("selected")).c_str()).x, ImGui::CalcTextSize(_L("Select").c_str()).x);
const int max_tab_length = 2 * ImGui::GetStyle().FramePadding.x + std::max(ImGui::CalcTextSize(_u8L("Union").c_str()).x,
std::max(ImGui::CalcTextSize(_u8L("Difference").c_str()).x, ImGui::CalcTextSize(_u8L("Intersection").c_str()).x));
const int max_cap_length = ImGui::GetStyle().WindowPadding.x + ImGui::GetStyle().ItemSpacing.x + std::max(ImGui::CalcTextSize(_u8L("Source Volume").c_str()).x, ImGui::CalcTextSize(_u8L("Tool Volume").c_str()).x);
const int select_btn_length = 2 * ImGui::GetStyle().FramePadding.x + std::max(ImGui::CalcTextSize(("1 " + _u8L("selected")).c_str()).x, ImGui::CalcTextSize(_u8L("Select").c_str()).x);

auto selectable = [this](const wxString& label, bool selected, const ImVec2& size_arg) {
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, { 0,0 });
Expand All @@ -195,13 +195,13 @@ void GLGizmoMeshBoolean::on_render_input_window(float x, float y, float bottom_l

if (selected || hovered) {
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.f, 1.f, 1.f, 1.0f));
ImGui::PushStyleColor(ImGuiCol_Button, { 0, 174.0f / 255.0f, 66.0f / 255.0f, 1.0f });
ImGui::PushStyleColor(ImGuiCol_ButtonActive, { 0, 174.0f / 255.0f, 66.0f / 255.0f, 1.0f });
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, { 0, 174.0f / 255.0f, 66.0f / 255.0f, 1.0f });
ImGui::PushStyleColor(ImGuiCol_Button, { 0, 150.0f / 255.0f, 136.0f / 255.0f, 1.0f });
ImGui::PushStyleColor(ImGuiCol_ButtonActive, { 0, 150.0f / 255.0f, 136.0f / 255.0f, 1.0f });
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, { 0, 150.0f / 255.0f, 136.0f / 255.0f, 1.0f });
}
else {
ImGui::PushStyleColor(ImGuiCol_ButtonActive, { 0, 174.0f / 255.0f, 66.0f / 255.0f, 1.0f });
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, { 0, 174.0f / 255.0f, 66.0f / 255.0f, 1.0f });
ImGui::PushStyleColor(ImGuiCol_ButtonActive, { 0, 150.0f / 255.0f, 136.0f / 255.0f, 1.0f });
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, { 0, 150.0f / 255.0f, 136.0f / 255.0f, 1.0f });
}

bool res = ImGui::Button(label.c_str(), size_arg);
Expand Down Expand Up @@ -240,15 +240,15 @@ void GLGizmoMeshBoolean::on_render_input_window(float x, float y, float bottom_l
};

ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 0);
if (selectable(_L("Union").c_str(), m_operation_mode == MeshBooleanOperation::Union, ImVec2(max_tab_length, 0.0f))) {
if (selectable(_u8L("Union"), m_operation_mode == MeshBooleanOperation::Union, ImVec2(max_tab_length, 0.0f))) {
m_operation_mode = MeshBooleanOperation::Union;
}
ImGui::SameLine(0, 0);
if (selectable(_L("Difference").c_str(), m_operation_mode == MeshBooleanOperation::Difference, ImVec2(max_tab_length, 0.0f))) {
if (selectable(_u8L("Difference"), m_operation_mode == MeshBooleanOperation::Difference, ImVec2(max_tab_length, 0.0f))) {
m_operation_mode = MeshBooleanOperation::Difference;
}
ImGui::SameLine(0, 0);
if (selectable(_L("Intersection").c_str(), m_operation_mode == MeshBooleanOperation::Intersection, ImVec2(max_tab_length, 0.0f))) {
if (selectable(_u8L("Intersection"), m_operation_mode == MeshBooleanOperation::Intersection, ImVec2(max_tab_length, 0.0f))) {
m_operation_mode = MeshBooleanOperation::Intersection;
}
ImGui::PopStyleVar();
Expand All @@ -257,10 +257,10 @@ void GLGizmoMeshBoolean::on_render_input_window(float x, float y, float bottom_l
std::string cap_str1 = m_operation_mode != MeshBooleanOperation::Difference ? _u8L("Part 1") : _u8L("Subtract from");
m_imgui->text(cap_str1);
ImGui::SameLine(max_cap_length);
wxString select_src_str = m_src.mv ? "1 " + _L("selected") : _L("Select");
wxString select_src_str = m_src.mv ? "1 " + _u8L("selected") : _u8L("Select");
select_src_str << "##select_source_volume";
ImGui::PushItemWidth(select_btn_length);
if (selectable(select_src_str.c_str(), m_selecting_state == MeshBooleanSelectingState::SelectSource, ImVec2(select_btn_length, 0)))
if (selectable(select_src_str, m_selecting_state == MeshBooleanSelectingState::SelectSource, ImVec2(select_btn_length, 0)))
m_selecting_state = MeshBooleanSelectingState::SelectSource;
ImGui::PopItemWidth();
if (m_src.mv) {
Expand All @@ -285,10 +285,10 @@ void GLGizmoMeshBoolean::on_render_input_window(float x, float y, float bottom_l
std::string cap_str2 = m_operation_mode != MeshBooleanOperation::Difference ? _u8L("Part 2") : _u8L("Subtract with");
m_imgui->text(cap_str2);
ImGui::SameLine(max_cap_length);
wxString select_tool_str = m_tool.mv ? "1 " + _L("selected") : _L("Select");
wxString select_tool_str = m_tool.mv ? "1 " + _u8L("selected") : _u8L("Select");
select_tool_str << "##select_tool_volume";
ImGui::PushItemWidth(select_btn_length);
if (selectable(select_tool_str.c_str(), m_selecting_state == MeshBooleanSelectingState::SelectTool, ImVec2(select_btn_length, 0)))
if (selectable(select_tool_str, m_selecting_state == MeshBooleanSelectingState::SelectTool, ImVec2(select_btn_length, 0)))
m_selecting_state = MeshBooleanSelectingState::SelectTool;
ImGui::PopItemWidth();
if (m_tool.mv) {
Expand Down

0 comments on commit 637a171

Please sign in to comment.