Removed a bunch of compile warnings

This commit is contained in:
Enrico Turri 2019-09-04 09:47:00 +02:00
parent 6befe7099b
commit 6bbc97f24d
6 changed files with 37 additions and 51 deletions

View file

@ -901,11 +901,11 @@ bool GLCanvas3D::LegendTexture::generate(const GCodePreviewData& preview_data, c
// Disabling ClearType works, but the font returned is very different (much thicker) from the default.
// msw_disable_cleartype(font);
bool cleartype = is_font_cleartype(font);
// bool cleartype = is_font_cleartype(font);
#else
// select default font
wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).Scale(scale_gl);
bool cleartype = false;
// bool cleartype = false;
#endif /* __WXMSW__ */
memDC.SetFont(font);
@ -1330,13 +1330,13 @@ void GLCanvas3D::toggle_model_objects_visibility(bool visible, const ModelObject
void GLCanvas3D::update_instance_printable_state_for_object(const size_t obj_idx)
{
ModelObject* model_object = m_model->objects[obj_idx];
for (int inst_idx = 0; inst_idx < model_object->instances.size(); inst_idx++)
for (int inst_idx = 0; inst_idx < (int)model_object->instances.size(); ++inst_idx)
{
ModelInstance* instance = model_object->instances[inst_idx];
for (GLVolume* volume : m_volumes.volumes)
{
if ((volume->object_idx() == obj_idx) && (volume->instance_idx() == inst_idx))
if ((volume->object_idx() == (int)obj_idx) && (volume->instance_idx() == inst_idx))
volume->printable = instance->printable;
}
}
@ -1672,7 +1672,7 @@ void GLCanvas3D::ensure_on_bed(unsigned int object_idx)
for (GLVolume* volume : m_volumes.volumes)
{
if ((volume->object_idx() == object_idx) && !volume->is_modifier)
if ((volume->object_idx() == (int)object_idx) && !volume->is_modifier)
{
double min_z = volume->transformed_convex_hull_bounding_box().min(2);
std::pair<int, int> instance = std::make_pair(volume->object_idx(), volume->instance_idx());
@ -1968,8 +1968,8 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
}
}
// stores the current volumes count
size_t volumes_count = m_volumes.volumes.size();
// // stores the current volumes count
// size_t volumes_count = m_volumes.volumes.size();
for (size_t istep = 0; istep < sla_steps.size(); ++istep)
if (!instances[istep].empty())
@ -1978,7 +1978,7 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
// Shift-up all volumes of the object so that it has the right elevation with respect to the print bed
for (GLVolume* volume : m_volumes.volumes)
if (volume->object_idx() < m_model->objects.size() && m_model->objects[volume->object_idx()]->instances[volume->instance_idx()]->is_printable())
if (volume->object_idx() < (int)m_model->objects.size() && m_model->objects[volume->object_idx()]->instances[volume->instance_idx()]->is_printable())
volume->set_sla_shift_z(shift_zs[volume->object_idx()]);
}
@ -3733,7 +3733,7 @@ bool GLCanvas3D::_init_undoredo_toolbar()
item.right.render_callback = [this](float left, float right, float, float) { if (m_canvas != nullptr) _render_undo_redo_stack(true, 0.5f * (left + right)); };
item.enabling_callback = [this]()->bool {
bool can_undo = wxGetApp().plater()->can_undo();
unsigned int id = m_undoredo_toolbar.get_item_id("undo");
int id = m_undoredo_toolbar.get_item_id("undo");
std::string curr_additional_tooltip;
m_undoredo_toolbar.get_additional_tooltip(id, curr_additional_tooltip);
@ -3765,7 +3765,7 @@ bool GLCanvas3D::_init_undoredo_toolbar()
item.right.render_callback = [this](float left, float right, float, float) { if (m_canvas != nullptr) _render_undo_redo_stack(false, 0.5f * (left + right)); };
item.enabling_callback = [this]()->bool {
bool can_redo = wxGetApp().plater()->can_redo();
unsigned int id = m_undoredo_toolbar.get_item_id("redo");
int id = m_undoredo_toolbar.get_item_id("redo");
std::string curr_additional_tooltip;
m_undoredo_toolbar.get_additional_tooltip(id, curr_additional_tooltip);
@ -3908,7 +3908,7 @@ void GLCanvas3D::_picking_pass() const
m_gizmos.set_hover_id(-1);
}
else
m_gizmos.set_hover_id(inside && volume_id <= GLGizmoBase::BASE_ID ? (GLGizmoBase::BASE_ID - volume_id) : -1);
m_gizmos.set_hover_id(inside && volume_id <= (int)GLGizmoBase::BASE_ID ? ((int)GLGizmoBase::BASE_ID - volume_id) : -1);
_update_volumes_hover_state();
}
@ -4858,7 +4858,7 @@ void GLCanvas3D::_load_wipe_tower_toolpaths(const std::vector<std::string>& str_
ctxt.print = print;
ctxt.tool_colors = tool_colors.empty() ? nullptr : &tool_colors;
if (print->wipe_tower_data().priming && print->config().single_extruder_multi_material_priming)
for (int i=0; i<print->wipe_tower_data().priming.get()->size(); ++i)
for (int i=0; i<(int)print->wipe_tower_data().priming.get()->size(); ++i)
ctxt.priming.emplace_back(print->wipe_tower_data().priming.get()->at(i));
if (print->wipe_tower_data().final_purge)
ctxt.final.emplace_back(*print->wipe_tower_data().final_purge.get());
@ -5037,7 +5037,7 @@ void GLCanvas3D::_load_gcode_extrusion_paths(const GCodePreviewData& preview_dat
}
case GCodePreviewData::Extrusion::ColorPrint:
{
const size_t color_cnt = tool_colors.size() / 4;
int color_cnt = (int)tool_colors.size() / 4;
int val = int(value);
while (val >= color_cnt)

View file

@ -641,11 +641,9 @@ public:
void start_keeping_dirty() { m_keep_dirty = true; }
void stop_keeping_dirty() { m_keep_dirty = false; }
unsigned int get_main_toolbar_item_id(const std::string& name) const { return m_main_toolbar.get_item_id(name); }
void force_main_toolbar_left_action(unsigned int item_id) { m_main_toolbar.force_left_action(item_id, *this); }
void force_main_toolbar_right_action(unsigned int item_id) { m_main_toolbar.force_right_action(item_id, *this); }
void get_undoredo_toolbar_additional_tooltip(unsigned int item_id, std::string& text) { return m_undoredo_toolbar.get_additional_tooltip(item_id, text); }
void set_undoredo_toolbar_additional_tooltip(unsigned int item_id, const std::string& text) { m_undoredo_toolbar.set_additional_tooltip(item_id, text); }
int get_main_toolbar_item_id(const std::string& name) const { return m_main_toolbar.get_item_id(name); }
void force_main_toolbar_left_action(int item_id) { m_main_toolbar.force_left_action(item_id, *this); }
void force_main_toolbar_right_action(int item_id) { m_main_toolbar.force_right_action(item_id, *this); }
bool has_toolpaths_to_export() const;
void export_toolpaths_to_obj(const char* filename) const;

View file

@ -359,9 +359,7 @@ bool GLCanvas3DManager::init(GLCanvas3D& canvas)
void GLCanvas3DManager::detect_multisample(int* attribList)
{
int wxVersion = wxMAJOR_VERSION * 10000 + wxMINOR_VERSION * 100 + wxRELEASE_NUMBER;
const AppConfig* app_config = GUI::get_app_config();
bool enable_multisample = wxVersion >= 30003;
s_multisample = (enable_multisample && wxGLCanvas::IsDisplaySupported(attribList)) ? MS_Enabled : MS_Disabled;
// Alternative method: it was working on previous version of wxWidgets but not with the latest, at least on Windows
// s_multisample = enable_multisample && wxGLCanvas::IsExtensionSupported("WGL_ARB_multisample");

View file

@ -56,7 +56,7 @@ bool GLTexture::Compressor::unsent_compressed_data_available() const
{
if (m_levels.empty())
return false;
// Querying the atomic m_num_levels_compressed value synchronizes processor caches, so that the dat of m_levels modified by the worker thread are accessible to the calling thread.
// Querying the atomic m_num_levels_compressed value synchronizes processor caches, so that the data of m_levels modified by the worker thread are accessible to the calling thread.
unsigned int num_compressed = m_num_levels_compressed;
for (unsigned int i = 0; i < num_compressed; ++ i)
if (! m_levels[i].sent_to_gpu && ! m_levels[i].compressed_data.empty())
@ -89,8 +89,8 @@ void GLTexture::Compressor::send_compressed_data_to_gpu()
}
glsafe(::glBindTexture(GL_TEXTURE_2D, 0));
if (num_compressed == (unsigned int)m_levels.size())
// Finalize the worker thread, close it.
if (num_compressed == (int)m_levels.size())
// Finalize the worker thread, close it.
this->reset();
}

View file

@ -345,9 +345,9 @@ bool GLToolbar::is_any_item_pressed() const
return false;
}
unsigned int GLToolbar::get_item_id(const std::string& name) const
int GLToolbar::get_item_id(const std::string& name) const
{
for (unsigned int i = 0; i < (unsigned int)m_items.size(); ++i)
for (int i = 0; i < (int)m_items.size(); ++i)
{
if (m_items[i]->get_name() == name)
return i;
@ -356,19 +356,9 @@ unsigned int GLToolbar::get_item_id(const std::string& name) const
return -1;
}
void GLToolbar::force_left_action(unsigned int item_id, GLCanvas3D& parent)
void GLToolbar::get_additional_tooltip(int item_id, std::string& text)
{
do_action(GLToolbarItem::Left, item_id, parent, false);
}
void GLToolbar::force_right_action(unsigned int item_id, GLCanvas3D& parent)
{
do_action(GLToolbarItem::Right, item_id, parent, false);
}
void GLToolbar::get_additional_tooltip(unsigned int item_id, std::string& text)
{
if (item_id < (unsigned int)m_items.size())
if ((0 <= item_id) && (item_id < (int)m_items.size()))
{
GLToolbarItem* item = m_items[item_id];
if (item != nullptr)
@ -381,9 +371,9 @@ void GLToolbar::get_additional_tooltip(unsigned int item_id, std::string& text)
text = L("");
}
void GLToolbar::set_additional_tooltip(unsigned int item_id, const std::string& text)
void GLToolbar::set_additional_tooltip(int item_id, const std::string& text)
{
if (item_id < (unsigned int)m_items.size())
if ((0 <= item_id) && (item_id < (int)m_items.size()))
{
GLToolbarItem* item = m_items[item_id];
if (item != nullptr)
@ -466,7 +456,7 @@ bool GLToolbar::on_mouse(wxMouseEvent& evt, GLCanvas3D& parent)
if ((item_id != -2) && !m_items[item_id]->is_separator() && ((m_pressed_toggable_id == -1) || (m_items[item_id]->get_last_action_type() == GLToolbarItem::Left)))
{
// mouse is inside an icon
do_action(GLToolbarItem::Left, (unsigned int)item_id, parent, true);
do_action(GLToolbarItem::Left, item_id, parent, true);
parent.set_as_dirty();
}
}
@ -483,7 +473,7 @@ bool GLToolbar::on_mouse(wxMouseEvent& evt, GLCanvas3D& parent)
if ((item_id != -2) && !m_items[item_id]->is_separator() && ((m_pressed_toggable_id == -1) || (m_items[item_id]->get_last_action_type() == GLToolbarItem::Right)))
{
// mouse is inside an icon
do_action(GLToolbarItem::Right, (unsigned int)item_id, parent, true);
do_action(GLToolbarItem::Right, item_id, parent, true);
parent.set_as_dirty();
}
}
@ -556,11 +546,11 @@ float GLToolbar::get_main_size() const
return size * m_layout.scale;
}
void GLToolbar::do_action(GLToolbarItem::EActionType type, unsigned int item_id, GLCanvas3D& parent, bool check_hover)
void GLToolbar::do_action(GLToolbarItem::EActionType type, int item_id, GLCanvas3D& parent, bool check_hover)
{
if ((m_pressed_toggable_id == -1) || (m_pressed_toggable_id == item_id))
{
if (item_id < (unsigned int)m_items.size())
if ((0 <= item_id) && (item_id < (int)m_items.size()))
{
GLToolbarItem* item = m_items[item_id];
if ((item != nullptr) && !item->is_separator() && (!check_hover || item->is_hovered()))
@ -1246,7 +1236,7 @@ bool GLToolbar::update_items_enabled_state()
{
bool ret = false;
for (unsigned int i = 0; i < (unsigned int)m_items.size(); ++i)
for (int i = 0; i < (int)m_items.size(); ++i)
{
GLToolbarItem* item = m_items[i];
ret |= item->update_enabled_state();

View file

@ -254,7 +254,7 @@ private:
MouseCapture m_mouse_capture;
std::string m_tooltip;
unsigned int m_pressed_toggable_id;
int m_pressed_toggable_id;
public:
GLToolbar(EType type, const std::string& name);
@ -293,15 +293,15 @@ public:
bool is_any_item_pressed() const;
unsigned int get_item_id(const std::string& name) const;
int get_item_id(const std::string& name) const;
void force_left_action(unsigned int item_id, GLCanvas3D& parent);
void force_right_action(unsigned int item_id, GLCanvas3D& parent);
void force_left_action(int item_id, GLCanvas3D& parent) { do_action(GLToolbarItem::Left, item_id, parent, false); }
void force_right_action(int item_id, GLCanvas3D& parent) { do_action(GLToolbarItem::Right, item_id, parent, false); }
const std::string& get_tooltip() const { return m_tooltip; }
void get_additional_tooltip(unsigned int item_id, std::string& text);
void set_additional_tooltip(unsigned int item_id, const std::string& text);
void get_additional_tooltip(int item_id, std::string& text);
void set_additional_tooltip(int item_id, const std::string& text);
// returns true if any item changed its state
bool update_items_state();
@ -317,7 +317,7 @@ private:
float get_height_horizontal() const;
float get_height_vertical() const;
float get_main_size() const;
void do_action(GLToolbarItem::EActionType type, unsigned int item_id, GLCanvas3D& parent, bool check_hover);
void do_action(GLToolbarItem::EActionType type, int item_id, GLCanvas3D& parent, bool check_hover);
std::string update_hover_state(const Vec2d& mouse_pos, GLCanvas3D& parent);
std::string update_hover_state_horizontal(const Vec2d& mouse_pos, GLCanvas3D& parent);
std::string update_hover_state_vertical(const Vec2d& mouse_pos, GLCanvas3D& parent);