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
187 changed files with 494 additions and 1101 deletions

View File

@@ -137,7 +137,7 @@ void AMSrefresh::create(wxWindow *parent, wxWindowID id, const wxPoint &pos, con
wxWindow::Create(parent, id, pos, size, wxBORDER_NONE);
SetBackgroundColour(AMS_CONTROL_DEF_BLOCK_BK_COLOUR);
Bind(wxEVT_TIMER, &AMSrefresh::on_timer, this);
Bind(wxEVT_TIMER, [this](wxTimerEvent&) { on_timer(); });
Bind(wxEVT_PAINT, &AMSrefresh::paintEvent, this);
Bind(wxEVT_ENTER_WINDOW, &AMSrefresh::OnEnterWindow, this);
Bind(wxEVT_LEAVE_WINDOW, &AMSrefresh::OnLeaveWindow, this);
@@ -166,14 +166,14 @@ void AMSrefresh::create(wxWindow *parent, wxWindowID id, const wxPoint &pos, con
m_playing_timer = new wxTimer();
m_playing_timer->SetOwner(this);
wxPostEvent(this, wxTimerEvent());
on_timer();
SetSize(AMS_REFRESH_SIZE);
SetMinSize(AMS_REFRESH_SIZE);
SetMaxSize(AMS_REFRESH_SIZE);
}
void AMSrefresh::on_timer(wxTimerEvent &event)
void AMSrefresh::on_timer()
{
//if (m_rotation_angle >= m_rfid_bitmap_list.size()) {
// m_rotation_angle = 0;
@@ -472,7 +472,7 @@ void AMSextruder::doRender(wxDC& dc)
{
//m_current_colur =
wxSize size = GetSize();
dc.SetPen(wxPen(AMS_CONTROL_GRAY500, 2, wxSOLID));
dc.SetPen(wxPen(AMS_CONTROL_GRAY500, 2, wxPENSTYLE_SOLID));
dc.SetBrush(wxBrush(*wxTRANSPARENT_BRUSH));
if (!m_none_ams_mode) {
@@ -484,24 +484,24 @@ void AMSextruder::doRender(wxDC& dc)
if (m_vams_loading) {
if (m_current_colur.Alpha() == 0) { dc.SetPen(wxPen(*wxWHITE, 6, wxSOLID)); }
else { dc.SetPen(wxPen(m_current_colur, 6, wxSOLID)); }
if (m_current_colur.Alpha() == 0) { dc.SetPen(wxPen(*wxWHITE, 6, wxPENSTYLE_SOLID)); }
else { dc.SetPen(wxPen(m_current_colur, 6, wxPENSTYLE_SOLID)); }
dc.DrawRoundedRectangle(-size.x / 2, size.y * 0.1, size.x, size.y, 4);
if ((m_current_colur == *wxWHITE || m_current_colur.Alpha() == 0) && !wxGetApp().dark_mode()) {
dc.SetPen(wxPen(AMS_CONTROL_DEF_BLOCK_BK_COLOUR, 1, wxSOLID));
dc.SetPen(wxPen(AMS_CONTROL_DEF_BLOCK_BK_COLOUR, 1, wxPENSTYLE_SOLID));
dc.DrawRoundedRectangle(-size.x / 2 - FromDIP(3), size.y * 0.1 + FromDIP(3), size.x, size.y, 3);
dc.DrawRoundedRectangle(-size.x / 2 + FromDIP(3), size.y * 0.1 - FromDIP(3), size.x, size.y, 5);
}
}
if (m_ams_loading && !m_none_ams_mode) {
if (m_current_colur.Alpha() == 0) {dc.SetPen(wxPen(*wxWHITE, 6, wxSOLID));}
else {dc.SetPen(wxPen(m_current_colur, 6, wxSOLID));}
if (m_current_colur.Alpha() == 0) {dc.SetPen(wxPen(*wxWHITE, 6, wxPENSTYLE_SOLID));}
else {dc.SetPen(wxPen(m_current_colur, 6, wxPENSTYLE_SOLID));}
dc.DrawLine(size.x / 2, -1, size.x / 2, size.y * 0.6 - 1);
if ((m_current_colur == *wxWHITE || m_current_colur.Alpha() == 0) && !wxGetApp().dark_mode()) {
dc.SetPen(wxPen(AMS_CONTROL_DEF_BLOCK_BK_COLOUR, 1, wxSOLID));
dc.SetPen(wxPen(AMS_CONTROL_DEF_BLOCK_BK_COLOUR, 1, wxPENSTYLE_SOLID));
dc.DrawLine(size.x / 2 - FromDIP(4), -1, size.x / 2 - FromDIP(3), size.y * 0.6 - 1);
dc.DrawLine(size.x / 2 + FromDIP(3), -1, size.x / 2 + FromDIP(3), size.y * 0.6 - 1);
}
@@ -509,12 +509,12 @@ void AMSextruder::doRender(wxDC& dc)
}
else {
if (m_ams_loading) {
if (m_current_colur.Alpha() == 0) { dc.SetPen(wxPen(*wxWHITE, 6, wxSOLID)); }
else { dc.SetPen(wxPen(m_current_colur, 6, wxSOLID)); }
if (m_current_colur.Alpha() == 0) { dc.SetPen(wxPen(*wxWHITE, 6, wxPENSTYLE_SOLID)); }
else { dc.SetPen(wxPen(m_current_colur, 6, wxPENSTYLE_SOLID)); }
dc.DrawLine(size.x / 2, -1, size.x / 2, size.y * 0.6 - 1);
if ((m_current_colur == *wxWHITE || m_current_colur.Alpha() == 0) && !wxGetApp().dark_mode()) {
dc.SetPen(wxPen(AMS_CONTROL_DEF_BLOCK_BK_COLOUR, 1, wxSOLID));
dc.SetPen(wxPen(AMS_CONTROL_DEF_BLOCK_BK_COLOUR, 1, wxPENSTYLE_SOLID));
dc.DrawLine(size.x / 2 - FromDIP(4), -1, size.x / 2 - FromDIP(3), size.y * 0.6 - 1);
dc.DrawLine(size.x / 2 + FromDIP(3), -1, size.x / 2 + FromDIP(3), size.y * 0.6 - 1);
}
@@ -587,18 +587,18 @@ void AMSVirtualRoad::doRender(wxDC& dc)
wxSize size = GetSize();
if (m_vams_loading) {
if (m_current_color.Alpha() == 0) { dc.SetPen(wxPen(*wxWHITE, 6, wxSOLID)); }
else { dc.SetPen(wxPen(m_current_color, 6, wxSOLID)); }
if (m_current_color.Alpha() == 0) { dc.SetPen(wxPen(*wxWHITE, 6, wxPENSTYLE_SOLID)); }
else { dc.SetPen(wxPen(m_current_color, 6, wxPENSTYLE_SOLID)); }
}
else {
dc.SetPen(wxPen(AMS_CONTROL_GRAY500, 2, wxSOLID));
dc.SetPen(wxPen(AMS_CONTROL_GRAY500, 2, wxPENSTYLE_SOLID));
}
dc.SetBrush(wxBrush(*wxTRANSPARENT_BRUSH));
dc.DrawRoundedRectangle(size.x / 2, -size.y / 1.1 + FromDIP(1), size.x, size.y, 4);
if ((m_current_color == *wxWHITE || m_current_color.Alpha() == 0) && !wxGetApp().dark_mode()) {
dc.SetPen(wxPen(AMS_CONTROL_DEF_BLOCK_BK_COLOUR, 1, wxSOLID));
dc.SetPen(wxPen(AMS_CONTROL_DEF_BLOCK_BK_COLOUR, 1, wxPENSTYLE_SOLID));
dc.DrawRoundedRectangle(size.x / 2 - FromDIP(3), -size.y / 1.1 + FromDIP(4), size.x, size.y, 5);
dc.DrawRoundedRectangle(size.x / 2 + FromDIP(3), -size.y / 1.1 - FromDIP(2), size.x, size.y, 3);
}
@@ -988,11 +988,11 @@ void AMSLib::render_extra_lib(wxDC& dc)
//draw road
dc.SetPen(wxPen(AMS_CONTROL_GRAY500, 2, wxSOLID));
dc.SetPen(wxPen(AMS_CONTROL_GRAY500, 2, wxPENSTYLE_SOLID));
dc.SetBrush(wxBrush(*wxTRANSPARENT_BRUSH));
if (m_pass_road) {
dc.SetPen(wxPen(m_info.material_colour, 6, wxSOLID));
dc.SetPen(wxPen(m_info.material_colour, 6, wxPENSTYLE_SOLID));
}
if (m_can_index == 0 || m_can_index == 3) {
@@ -1114,9 +1114,9 @@ void AMSLib::render_generic_lib(wxDC &dc)
// selected
if (m_selected) {
dc.SetPen(wxPen(tmp_lib_colour, 2, wxSOLID));
dc.SetPen(wxPen(tmp_lib_colour, 2, wxPENSTYLE_SOLID));
if (tmp_lib_colour.Alpha() == 0) {
dc.SetPen(wxPen(wxColour(tmp_lib_colour.Red(), tmp_lib_colour.Green(),tmp_lib_colour.Blue(),128), 2, wxSOLID));
dc.SetPen(wxPen(wxColour(tmp_lib_colour.Red(), tmp_lib_colour.Green(),tmp_lib_colour.Blue(),128), 2, wxPENSTYLE_SOLID));
}
dc.SetBrush(wxBrush(*wxTRANSPARENT_BRUSH));
if (m_radius == 0) {
@@ -1131,7 +1131,7 @@ void AMSLib::render_generic_lib(wxDC &dc)
}
if (!m_selected && m_hover) {
dc.SetPen(wxPen(AMS_CONTROL_BRAND_COLOUR, 2, wxSOLID));
dc.SetPen(wxPen(AMS_CONTROL_BRAND_COLOUR, 2, wxPENSTYLE_SOLID));
dc.SetBrush(wxBrush(*wxTRANSPARENT_BRUSH));
if (m_radius == 0) {
dc.DrawRectangle(0, 0, size.x, size.y);
@@ -1144,7 +1144,7 @@ void AMSLib::render_generic_lib(wxDC &dc)
dc.SetBrush(wxBrush(tmp_lib_colour));
}
else {
dc.SetPen(wxPen(tmp_lib_colour, 1, wxSOLID));
dc.SetPen(wxPen(tmp_lib_colour, 1, wxPENSTYLE_SOLID));
dc.SetBrush(wxBrush(tmp_lib_colour));
}
@@ -1230,7 +1230,7 @@ void AMSLib::render_generic_lib(wxDC &dc)
dc.SetBrush(wxBrush(tmp_lib_colour));
}
else {
dc.SetPen(wxPen(tmp_lib_colour, 1, wxSOLID));
dc.SetPen(wxPen(tmp_lib_colour, 1, wxPENSTYLE_SOLID));
dc.SetBrush(wxBrush(tmp_lib_colour));
}
}
@@ -1260,7 +1260,7 @@ void AMSLib::render_generic_lib(wxDC &dc)
#endif
}
if (tmp_lib_colour.Red() > 238 && tmp_lib_colour.Green() > 238 && tmp_lib_colour.Blue() > 238) {
dc.SetPen(wxPen(wxColour(130, 129, 128), 1, wxSOLID));
dc.SetPen(wxPen(wxColour(130, 129, 128), 1, wxPENSTYLE_SOLID));
dc.SetBrush(wxBrush(*wxTRANSPARENT_BRUSH));
dc.DrawLine(FromDIP(4), FromDIP(4) + top, size.x - FromDIP(4), FromDIP(4) + top);
}
@@ -1268,10 +1268,10 @@ void AMSLib::render_generic_lib(wxDC &dc)
else {
dc.SetBrush(wxBrush(*wxTRANSPARENT_BRUSH));
if (tmp_lib_colour.Red() > 238 && tmp_lib_colour.Green() > 238 && tmp_lib_colour.Blue() > 238) {
dc.SetPen(wxPen(wxColour(130, 129, 128), 2, wxSOLID));
dc.SetPen(wxPen(wxColour(130, 129, 128), 2, wxPENSTYLE_SOLID));
}
else {
dc.SetPen(wxPen(tmp_lib_colour, 2, wxSOLID));
dc.SetPen(wxPen(tmp_lib_colour, 2, wxPENSTYLE_SOLID));
}
#ifdef __APPLE__
@@ -1285,7 +1285,7 @@ void AMSLib::render_generic_lib(wxDC &dc)
}
//border
dc.SetPen(wxPen(wxColour(130, 130, 128), 1, wxSOLID));
dc.SetPen(wxPen(wxColour(130, 130, 128), 1, wxPENSTYLE_SOLID));
dc.SetBrush(wxBrush(*wxTRANSPARENT_BRUSH));
#ifdef __APPLE__
dc.DrawRoundedRectangle(FromDIP(4), FromDIP(4), size.x - FromDIP(7), size.y - FromDIP(7), m_radius);
@@ -1371,7 +1371,6 @@ AMSRoad::AMSRoad(wxWindow *parent, wxWindowID id, Caninfo info, int canindex, in
m_info = info;
m_canindex = canindex;
// road type
auto mode = AMSRoadMode::AMS_ROAD_MODE_END;
if (m_canindex == 0 && maxcan == 1) {
m_rode_mode = AMSRoadMode::AMS_ROAD_MODE_NONE;
} else if (m_canindex == 0 && maxcan > 1) {
@@ -1492,7 +1491,7 @@ void AMSRoad::doRender(wxDC &dc)
{
wxSize size = GetSize();
dc.SetPen(wxPen(m_road_def_color, 2, wxSOLID));
dc.SetPen(wxPen(m_road_def_color, 2, wxPENSTYLE_SOLID));
dc.SetBrush(wxBrush(*wxTRANSPARENT_BRUSH));
// left mode
if (m_rode_mode == AMSRoadMode::AMS_ROAD_MODE_LEFT) { dc.DrawRoundedRectangle(-10, -10, size.x / 2 + 10, size.y * 0.6 + 10, 4); }
@@ -1535,8 +1534,8 @@ void AMSRoad::doRender(wxDC &dc)
// mode none
// if (m_pass_rode_mode.size() == 1 && m_pass_rode_mode[0] == AMSPassRoadMode::AMS_ROAD_MODE_NONE) return;
if (m_road_color.Alpha() == 0) {dc.SetPen(wxPen(*wxWHITE, m_passroad_width, wxSOLID));}
else {dc.SetPen(wxPen(m_road_color, m_passroad_width, wxSOLID));}
if (m_road_color.Alpha() == 0) {dc.SetPen(wxPen(*wxWHITE, m_passroad_width, wxPENSTYLE_SOLID));}
else {dc.SetPen(wxPen(m_road_color, m_passroad_width, wxPENSTYLE_SOLID));}
dc.SetBrush(wxBrush(*wxTRANSPARENT_BRUSH));
@@ -1563,7 +1562,7 @@ void AMSRoad::doRender(wxDC &dc)
// end mode
if (m_rode_mode == AMSRoadMode::AMS_ROAD_MODE_END || m_rode_mode == AMSRoadMode::AMS_ROAD_MODE_END_ONLY) {
dc.SetPen(wxPen(m_road_def_color, 2, wxSOLID));
dc.SetPen(wxPen(m_road_def_color, 2, wxPENSTYLE_SOLID));
dc.SetBrush(wxBrush(m_road_def_color));
dc.DrawRoundedRectangle(size.x * 0.37 / 2, size.y * 0.6 - size.y / 6, size.x * 0.63, size.y / 3, m_radius);
}
@@ -2244,7 +2243,7 @@ void AmsCans::doRender(wxDC& dc)
// A1
dc.SetPen(wxPen(AMS_CONTROL_GRAY500, 2, wxSOLID));
dc.SetPen(wxPen(AMS_CONTROL_GRAY500, 2, wxPENSTYLE_SOLID));
dc.SetBrush(wxBrush(*wxTRANSPARENT_BRUSH));
try
@@ -2285,32 +2284,32 @@ void AmsCans::doRender(wxDC& dc)
if (!m_road_canid.empty()) {
if (m_road_canid == "0") {
dc.SetPen(wxPen(m_road_colour, passroad_width, wxSOLID));
dc.SetPen(wxPen(m_road_colour, passroad_width, wxPENSTYLE_SOLID));
dc.DrawLine(a1_left, FromDIP(30), a1_left, a1_top);
dc.DrawLine(a1_left, a1_top, end_top, a1_top);
}
if (m_road_canid == "1") {
dc.SetPen(wxPen(m_road_colour, passroad_width, wxSOLID));
dc.SetPen(wxPen(m_road_colour, passroad_width, wxPENSTYLE_SOLID));
dc.DrawLine(a2_left, FromDIP(160), a2_left, a2_top);
dc.DrawLine(a2_left, a2_top, end_top, a2_top);
}
if (m_road_canid == "2") {
dc.SetPen(wxPen(m_road_colour, passroad_width, wxSOLID));
dc.SetPen(wxPen(m_road_colour, passroad_width, wxPENSTYLE_SOLID));
dc.DrawLine(a3_left, FromDIP(160), a3_left, a3_top);
dc.DrawLine(a3_left, a3_top, end_top, a3_top);
}
if (m_road_canid == "3") {
dc.SetPen(wxPen(m_road_colour, passroad_width, wxSOLID));
dc.SetPen(wxPen(m_road_colour, passroad_width, wxPENSTYLE_SOLID));
dc.DrawLine(a4_left, FromDIP(30), a4_left, a4_top);
dc.DrawLine(a4_left, a4_top, end_top, a4_top);
}
}
//to Extruder
dc.SetPen(wxPen(AMS_CONTROL_GRAY500, 2, wxSOLID));
dc.SetPen(wxPen(AMS_CONTROL_GRAY500, 2, wxPENSTYLE_SOLID));
dc.SetBrush(wxBrush(*wxTRANSPARENT_BRUSH));
dc.DrawLine(end_top, a1_top, end_top, size.y);
@@ -2318,19 +2317,19 @@ void AmsCans::doRender(wxDC& dc)
if (!m_road_canid.empty()) {
if (!m_road_canid.empty()) {
if (m_road_canid == "0") {
dc.SetPen(wxPen(m_road_colour, passroad_width, wxSOLID));
dc.SetPen(wxPen(m_road_colour, passroad_width, wxPENSTYLE_SOLID));
dc.DrawLine(end_top, a1_top, end_top, size.y);
}
else if (m_road_canid == "1") {
dc.SetPen(wxPen(m_road_colour, passroad_width, wxSOLID));
dc.SetPen(wxPen(m_road_colour, passroad_width, wxPENSTYLE_SOLID));
dc.DrawLine(end_top, a2_top, end_top, size.y);
}
else if (m_road_canid == "2") {
dc.SetPen(wxPen(m_road_colour, passroad_width, wxSOLID));
dc.SetPen(wxPen(m_road_colour, passroad_width, wxPENSTYLE_SOLID));
dc.DrawLine(end_top, a3_top, end_top, size.y);
}
else if (m_road_canid == "3") {
dc.SetPen(wxPen(m_road_colour, passroad_width, wxSOLID));
dc.SetPen(wxPen(m_road_colour, passroad_width, wxPENSTYLE_SOLID));
dc.DrawLine(end_top, a4_top, end_top, size.y);
}
}
@@ -3100,7 +3099,6 @@ void AMSControl::SetClibrationLink(wxString link)
void AMSControl::PlayRridLoading(wxString amsid, wxString canid)
{
AmsCansHash::iterator iter = m_ams_cans_list.begin();
auto count_item_index = 0;
for (auto i = 0; i < m_ams_cans_list.GetCount(); i++) {
AmsCansWindow *cans = m_ams_cans_list[i];
@@ -3112,7 +3110,6 @@ void AMSControl::PlayRridLoading(wxString amsid, wxString canid)
void AMSControl::StopRridLoading(wxString amsid, wxString canid)
{
AmsCansHash::iterator iter = m_ams_cans_list.begin();
auto count_item_index = 0;
for (auto i = 0; i < m_ams_cans_list.GetCount(); i++) {
AmsCansWindow *cans = m_ams_cans_list[i];