Fix Compile Warnings (#5963)

* Fix calls to depreciated wxPen constructor

* Fix use of wxTimerEvent

* Fix unrecognized character escape sequence

* Fix signed/unsigned mismatch

At least as much as possible without significantly altering parts of the application

* Clean unreferenced variables

* fix mistyped namespace selector

* Update deprecated calls

* Fix preprocessor statement

* Remove empty switch statements

* Change int vector used as bool to bool vector

* Remove empty control statements and related unused code

* Change multi character constant to string constant

* Fix discarded return value

json::parse was being called on the object, rather than statically like it should be. Also, the value was not being captured.

* Rename ICON_SIZE def used by MultiMachine

By having the definition in the header, it causes issues when other files define ICON_SIZE. By renaming it to MM_ICON_SIZE, this lessens the issue. It would probably be ideal to have the definitions in the respective .cpp that use them, but it would make it less convenient to update the values if needed in the future.

* Remove unused includes

* Fix linux/macOS compilation

* Hide unused-function errors on non-Windows systems

* Disable signed/unsigned comparison mismatch error

* Remove/Disable more unused variables

Still TODO: check double for loop in Print.cpp

* Remove unused variable that was missed

* Remove unused variables in libraries in the src folder

* Apply temporary fix for subobject linkage error

* Remove/Disable last set of unused variables reported by GCC

* remove redundant for loop

* fix misspelled ifdef check

* Update message on dialog

* Fix hard-coded platform specific modifier keys

* Remove duplicate for loop

* Disable -Wmisleading-indentation warning

* disable -Wswitch warning

* Remove unused local typedefs

* Fix -Wunused-value

* Fix pragma error on Windows from subobject linkage fix

* Fix -Waddress

* Fix null conversions (-Wconversion-null)

---------

Co-authored-by: SoftFever <softfeverever@gmail.com>
This commit is contained in:
Ocraftyone 2024-07-29 09:00:26 -04:00 committed by GitHub
parent b40853af94
commit b83e16dbdd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
187 changed files with 494 additions and 1101 deletions

View file

@ -3057,7 +3057,7 @@ bool GLGizmoEmboss::choose_font_by_wxdialog()
}
#endif // ALLOW_ADD_FONT_BY_OS_SELECTOR
#if defined ALLOW_ADD_FONT_BY_FILE or defined ALLOW_DEBUG_MODE
#if defined(ALLOW_ADD_FONT_BY_FILE) || defined(ALLOW_DEBUG_MODE)
namespace priv {
static std::string get_file_name(const std::string &file_path)
{
@ -3693,7 +3693,6 @@ GuiCfg create_gui_configuration()
cfg.height_of_volume_type_selector = separator_height + line_height_with_spacing + input_height;
int max_style_image_width = static_cast<int>(std::round(cfg.max_style_name_width/2 - 2 * style.FramePadding.x));
int max_style_image_height = static_cast<int>(std::round(input_height));
cfg.max_style_image_size = Vec2i32(max_style_image_width, line_height);
cfg.face_name_size = Vec2i32(cfg.input_width, line_height_with_spacing);
cfg.face_name_texture_offset_x = cfg.face_name_size.x() + space;

View file

@ -245,17 +245,10 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l
const float gap_fill_slider_left = m_imgui->calc_text_size(m_desc.at("gap_fill")).x + m_imgui->scaled(1.5f);
const float highlight_slider_left = m_imgui->calc_text_size(m_desc.at("highlight_by_angle")).x + m_imgui->scaled(1.5f);
const float reset_button_slider_left = m_imgui->calc_text_size(m_desc.at("reset_direction")).x + m_imgui->scaled(1.5f) + ImGui::GetStyle().FramePadding.x * 2;
const float on_overhangs_only_width = m_imgui->calc_text_size(m_desc["on_overhangs_only"]).x + m_imgui->scaled(1.5f);
const float remove_btn_width = m_imgui->calc_text_size(m_desc.at("remove_all")).x + m_imgui->scaled(1.5f);
const float filter_btn_width = m_imgui->calc_text_size(m_desc.at("perform")).x + m_imgui->scaled(1.5f);
const float gap_area_txt_width = m_imgui->calc_text_size(m_desc.at("gap_area")).x + m_imgui->scaled(1.5f);
const float smart_fill_angle_txt_width = m_imgui->calc_text_size(m_desc.at("smart_fill_angle")).x + m_imgui->scaled(1.5f);
const float buttons_width = remove_btn_width + filter_btn_width + m_imgui->scaled(1.5f);
const float empty_button_width = m_imgui->calc_button_size("").x;
const float tips_width = m_imgui->calc_text_size(_L("Auto support threshold angle: ") + " 90 ").x + m_imgui->scaled(1.5f);
const float minimal_slider_width = m_imgui->scaled(4.f);
float caption_max = 0.f;
float total_text_max = 0.f;
for (const auto &t : std::array<std::string, 5>{"enforce", "block", "remove", "cursor_size", "clipping_of_view"}) {
@ -272,8 +265,6 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l
const float sliders_width = m_imgui->scaled(7.0f);
const float drag_left_width = ImGui::GetStyle().WindowPadding.x + sliders_left_width + sliders_width - space_size;
float drag_pos_times = 0.7;
ImGui::AlignTextToFramePadding();
m_imgui->text(m_desc.at("tool_type"));
std::array<wchar_t, 4> tool_ids = { ImGui::CircleButtonIcon, ImGui::SphereButtonIcon, ImGui::FillButtonIcon, ImGui::GapFillIcon };
@ -697,7 +688,6 @@ wxString GLGizmoFdmSupports::handle_snapshot_action_name(bool shift_down, GLGizm
void GLGizmoFdmSupports::init_print_instance()
{
const PrintObject* print_object = NULL;
PrintInstance print_instance = { 0 };
const Print *print = m_parent.fff_print();
if (!m_c->selection_info() || (m_print_instance.print_object))

View file

@ -138,8 +138,6 @@ void GLGizmoMeshBoolean::on_render()
BoundingBoxf3 src_bb;
BoundingBoxf3 tool_bb;
const ModelObject* mo = m_c->selection_info()->model_object();
const ModelInstance* mi = mo->instances[m_parent.get_selection().get_instance_idx()];
const Selection& selection = m_parent.get_selection();
const Selection::IndicesList& idxs = selection.get_volume_idxs();
for (unsigned int i : idxs) {
@ -163,16 +161,12 @@ void GLGizmoMeshBoolean::on_set_state()
if (m_state == EState::On) {
m_src.reset();
m_tool.reset();
bool m_diff_delete_input = false;
bool m_inter_delete_input = false;
m_operation_mode = MeshBooleanOperation::Union;
m_selecting_state = MeshBooleanSelectingState::SelectSource;
}
else if (m_state == EState::Off) {
m_src.reset();
m_tool.reset();
bool m_diff_delete_input = false;
bool m_inter_delete_input = false;
m_operation_mode = MeshBooleanOperation::Undef;
m_selecting_state = MeshBooleanSelectingState::Undef;
wxGetApp().notification_manager()->close_plater_warning_notification(warning_text);

View file

@ -403,7 +403,6 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
const float filter_btn_width = m_imgui->calc_text_size(m_desc.at("perform")).x + m_imgui->scaled(1.f);
const float buttons_width = remove_btn_width + filter_btn_width + m_imgui->scaled(1.f);
const float minimal_slider_width = m_imgui->scaled(4.f);
const float color_button_width = m_imgui->calc_text_size(std::string_view{""}).x + m_imgui->scaled(1.75f);
float caption_max = 0.f;
float total_text_max = 0.f;
@ -444,7 +443,6 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
float start_pos_x = ImGui::GetCursorPos().x;
const ImVec2 max_label_size = ImGui::CalcTextSize("99", NULL, true);
const float item_spacing = m_imgui->scaled(0.8f);
size_t n_extruder_colors = std::min((size_t)EnforcerBlockerType::ExtruderMax, m_extruders_colors.size());
for (int extruder_idx = 0; extruder_idx < n_extruder_colors; extruder_idx++) {
const ColorRGBA &extruder_color = m_extruders_colors[extruder_idx];

View file

@ -527,21 +527,10 @@ std::vector<GLGizmoPainterBase::ProjectedHeightRange> GLGizmoPainterBase::get_pr
if (m_rr.mesh_id == -1)
return hit_triangles_by_mesh;
ProjectedMousePosition mesh_hit_point = { m_rr.hit, m_rr.mesh_id, m_rr.facet };
float z_bot_world= (trafo_matrices[m_rr.mesh_id] * Vec3d(m_rr.hit(0), m_rr.hit(1), m_rr.hit(2))).z();
float z_top_world = z_bot_world+ m_cursor_height;
hit_triangles_by_mesh.push_back({ z_bot_world, m_rr.mesh_id, size_t(m_rr.facet) });
const Selection& selection = m_parent.get_selection();
const ModelObject* mo = m_c->selection_info()->model_object();
const ModelInstance* mi = mo->instances[selection.get_instance_idx()];
const Transform3d instance_trafo = m_parent.get_canvas_type() == GLCanvas3D::CanvasAssembleView ?
mi->get_assemble_transformation().get_matrix() :
mi->get_transformation().get_matrix();
const Transform3d instance_trafo_not_translate = m_parent.get_canvas_type() == GLCanvas3D::CanvasAssembleView ?
mi->get_assemble_transformation().get_matrix_no_offset() :
mi->get_transformation().get_matrix_no_offset();
for (int mesh_idx = 0; mesh_idx < part_volumes.size(); mesh_idx++) {
if (mesh_idx == m_rr.mesh_id)
continue;
@ -712,7 +701,6 @@ bool GLGizmoPainterBase::gizmo_event(SLAGizmoEventType action, const Vec2d& mous
// The mouse button click detection is enabled when there is a valid hit.
// Missing the object entirely
// shall not capture the mouse.
const bool dragging_while_painting = (action == SLAGizmoEventType::Dragging && m_button_down != Button::None);
if (mesh_idx != -1 && m_button_down == Button::None)
m_button_down = ((action == SLAGizmoEventType::LeftDown) ? Button::Left : Button::Right);
@ -1063,7 +1051,7 @@ void GLGizmoPainterBase::on_set_state()
if (m_state == On && m_old_state != On) { // the gizmo was just turned on
on_opening();
const Selection& selection = m_parent.get_selection();
// const Selection& selection = m_parent.get_selection();
//Camera& camera = wxGetApp().plater()->get_camera();
//Vec3d rotate_target = selection.get_bounding_box().center();
//rotate_target(2) = 0.f;

View file

@ -186,7 +186,7 @@ bool GLGizmosManager::init()
// Order of gizmos in the vector must match order in EType!
//BBS: GUI refactor: add obj manipulation
m_gizmos.clear();
unsigned int sprite_id = 0;
// unsigned int sprite_id = 0;
m_gizmos.emplace_back(new GLGizmoMove3D(m_parent, m_is_dark ? "toolbar_move_dark.svg" : "toolbar_move.svg", EType::Move, &m_object_manipulation));
m_gizmos.emplace_back(new GLGizmoRotate3D(m_parent, m_is_dark ? "toolbar_rotate_dark.svg" : "toolbar_rotate.svg", EType::Rotate, &m_object_manipulation));
m_gizmos.emplace_back(new GLGizmoScale3D(m_parent, m_is_dark ? "toolbar_scale_dark.svg" : "toolbar_scale.svg", EType::Scale, &m_object_manipulation));
@ -1042,11 +1042,7 @@ void GLGizmosManager::render_arrow(const GLCanvas3D& parent, EType highlighted_t
for (size_t idx : selectable_idxs)
{
if (idx == highlighted_type) {
int tex_width = m_icons_texture.get_width();
int tex_height = m_icons_texture.get_height();
unsigned int tex_id = m_arrow_texture.get_id();
float inv_tex_width = (tex_width != 0.0f) ? 1.0f / tex_width : 0.0f;
float inv_tex_height = (tex_height != 0.0f) ? 1.0f / tex_height : 0.0f;
const float left_uv = 0.0f;
const float right_uv = 1.0f;

View file

@ -591,7 +591,6 @@ void GizmoObjectManipulation::do_render_move_window(ImGuiWrapper *imgui_wrapper,
float World_size = imgui_wrapper->calc_text_size(position_title).x + space_size;
float caption_max = std::max(position_size, World_size) + 2 * space_size;
float end_text_size = imgui_wrapper->calc_text_size(this->m_new_unit_string).x;
// position
Vec3d original_position;
@ -601,8 +600,6 @@ void GizmoObjectManipulation::do_render_move_window(ImGuiWrapper *imgui_wrapper,
original_position = this->m_new_position;
Vec3d display_position = m_buffered_position;
// Rotation
Vec3d rotation = this->m_buffered_rotation;
float unit_size = imgui_wrapper->calc_text_size(MAX_SIZE).x + space_size;
int index = 1;
int index_unit = 1;
@ -708,13 +705,6 @@ void GizmoObjectManipulation::do_render_rotate_window(ImGuiWrapper *imgui_wrappe
float caption_max = std::max(position_size, World_size) + 2 * space_size;
float end_text_size = imgui_wrapper->calc_text_size(this->m_new_unit_string).x;
// position
Vec3d original_position;
if (this->m_imperial_units)
original_position = this->m_new_position * this->mm_to_in;
else
original_position = this->m_new_position;
Vec3d display_position = m_buffered_position;
// Rotation
Vec3d rotation = this->m_buffered_rotation;
@ -835,10 +825,7 @@ void GizmoObjectManipulation::do_render_scale_input_window(ImGuiWrapper* imgui_w
Vec3d scale = m_buffered_scale;
Vec3d display_size = m_buffered_size;
Vec3d display_position = m_buffered_position;
float unit_size = imgui_wrapper->calc_text_size(MAX_SIZE).x + space_size;
bool imperial_units = this->m_imperial_units;
int index = 2;
int index_unit = 1;