Revert "Fix Compile Warnings (#5963)"

This reverts commit b83e16dbdd.

Found regressions like auto orientation didn't work anymore after this change, revert it
This commit is contained in:
SoftFever 2024-08-12 00:00:20 +08:00
parent 0286c36f42
commit 7082e945b1
184 changed files with 1091 additions and 461 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, [this](wxTimerEvent&) { on_timer(); });
Bind(wxEVT_TIMER, &AMSrefresh::on_timer, this);
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);
on_timer();
wxPostEvent(this, wxTimerEvent());
SetSize(AMS_REFRESH_SIZE);
SetMinSize(AMS_REFRESH_SIZE);
SetMaxSize(AMS_REFRESH_SIZE);
}
void AMSrefresh::on_timer()
void AMSrefresh::on_timer(wxTimerEvent &event)
{
//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, wxPENSTYLE_SOLID));
dc.SetPen(wxPen(AMS_CONTROL_GRAY500, 2, wxSOLID));
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, wxPENSTYLE_SOLID)); }
else { dc.SetPen(wxPen(m_current_colur, 6, wxPENSTYLE_SOLID)); }
if (m_current_colur.Alpha() == 0) { dc.SetPen(wxPen(*wxWHITE, 6, wxSOLID)); }
else { dc.SetPen(wxPen(m_current_colur, 6, wxSOLID)); }
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, wxPENSTYLE_SOLID));
dc.SetPen(wxPen(AMS_CONTROL_DEF_BLOCK_BK_COLOUR, 1, wxSOLID));
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, wxPENSTYLE_SOLID));}
else {dc.SetPen(wxPen(m_current_colur, 6, wxPENSTYLE_SOLID));}
if (m_current_colur.Alpha() == 0) {dc.SetPen(wxPen(*wxWHITE, 6, wxSOLID));}
else {dc.SetPen(wxPen(m_current_colur, 6, wxSOLID));}
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, wxPENSTYLE_SOLID));
dc.SetPen(wxPen(AMS_CONTROL_DEF_BLOCK_BK_COLOUR, 1, wxSOLID));
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, wxPENSTYLE_SOLID)); }
else { dc.SetPen(wxPen(m_current_colur, 6, wxPENSTYLE_SOLID)); }
if (m_current_colur.Alpha() == 0) { dc.SetPen(wxPen(*wxWHITE, 6, wxSOLID)); }
else { dc.SetPen(wxPen(m_current_colur, 6, wxSOLID)); }
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, wxPENSTYLE_SOLID));
dc.SetPen(wxPen(AMS_CONTROL_DEF_BLOCK_BK_COLOUR, 1, wxSOLID));
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, wxPENSTYLE_SOLID)); }
else { dc.SetPen(wxPen(m_current_color, 6, wxPENSTYLE_SOLID)); }
if (m_current_color.Alpha() == 0) { dc.SetPen(wxPen(*wxWHITE, 6, wxSOLID)); }
else { dc.SetPen(wxPen(m_current_color, 6, wxSOLID)); }
}
else {
dc.SetPen(wxPen(AMS_CONTROL_GRAY500, 2, wxPENSTYLE_SOLID));
dc.SetPen(wxPen(AMS_CONTROL_GRAY500, 2, wxSOLID));
}
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, wxPENSTYLE_SOLID));
dc.SetPen(wxPen(AMS_CONTROL_DEF_BLOCK_BK_COLOUR, 1, wxSOLID));
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, wxPENSTYLE_SOLID));
dc.SetPen(wxPen(AMS_CONTROL_GRAY500, 2, wxSOLID));
dc.SetBrush(wxBrush(*wxTRANSPARENT_BRUSH));
if (m_pass_road) {
dc.SetPen(wxPen(m_info.material_colour, 6, wxPENSTYLE_SOLID));
dc.SetPen(wxPen(m_info.material_colour, 6, wxSOLID));
}
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, wxPENSTYLE_SOLID));
dc.SetPen(wxPen(tmp_lib_colour, 2, wxSOLID));
if (tmp_lib_colour.Alpha() == 0) {
dc.SetPen(wxPen(wxColour(tmp_lib_colour.Red(), tmp_lib_colour.Green(),tmp_lib_colour.Blue(),128), 2, wxPENSTYLE_SOLID));
dc.SetPen(wxPen(wxColour(tmp_lib_colour.Red(), tmp_lib_colour.Green(),tmp_lib_colour.Blue(),128), 2, wxSOLID));
}
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, wxPENSTYLE_SOLID));
dc.SetPen(wxPen(AMS_CONTROL_BRAND_COLOUR, 2, wxSOLID));
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, wxPENSTYLE_SOLID));
dc.SetPen(wxPen(tmp_lib_colour, 1, wxSOLID));
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, wxPENSTYLE_SOLID));
dc.SetPen(wxPen(tmp_lib_colour, 1, wxSOLID));
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, wxPENSTYLE_SOLID));
dc.SetPen(wxPen(wxColour(130, 129, 128), 1, wxSOLID));
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, wxPENSTYLE_SOLID));
dc.SetPen(wxPen(wxColour(130, 129, 128), 2, wxSOLID));
}
else {
dc.SetPen(wxPen(tmp_lib_colour, 2, wxPENSTYLE_SOLID));
dc.SetPen(wxPen(tmp_lib_colour, 2, wxSOLID));
}
#ifdef __APPLE__
@ -1285,7 +1285,7 @@ void AMSLib::render_generic_lib(wxDC &dc)
}
//border
dc.SetPen(wxPen(wxColour(130, 130, 128), 1, wxPENSTYLE_SOLID));
dc.SetPen(wxPen(wxColour(130, 130, 128), 1, wxSOLID));
dc.SetBrush(wxBrush(*wxTRANSPARENT_BRUSH));
#ifdef __APPLE__
dc.DrawRoundedRectangle(FromDIP(4), FromDIP(4), size.x - FromDIP(7), size.y - FromDIP(7), m_radius);
@ -1371,6 +1371,7 @@ 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) {
@ -1491,7 +1492,7 @@ void AMSRoad::doRender(wxDC &dc)
{
wxSize size = GetSize();
dc.SetPen(wxPen(m_road_def_color, 2, wxPENSTYLE_SOLID));
dc.SetPen(wxPen(m_road_def_color, 2, wxSOLID));
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); }
@ -1534,8 +1535,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, wxPENSTYLE_SOLID));}
else {dc.SetPen(wxPen(m_road_color, m_passroad_width, wxPENSTYLE_SOLID));}
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));}
dc.SetBrush(wxBrush(*wxTRANSPARENT_BRUSH));
@ -1562,7 +1563,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, wxPENSTYLE_SOLID));
dc.SetPen(wxPen(m_road_def_color, 2, wxSOLID));
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);
}
@ -2243,7 +2244,7 @@ void AmsCans::doRender(wxDC& dc)
// A1
dc.SetPen(wxPen(AMS_CONTROL_GRAY500, 2, wxPENSTYLE_SOLID));
dc.SetPen(wxPen(AMS_CONTROL_GRAY500, 2, wxSOLID));
dc.SetBrush(wxBrush(*wxTRANSPARENT_BRUSH));
try
@ -2284,32 +2285,32 @@ void AmsCans::doRender(wxDC& dc)
if (!m_road_canid.empty()) {
if (m_road_canid == "0") {
dc.SetPen(wxPen(m_road_colour, passroad_width, wxPENSTYLE_SOLID));
dc.SetPen(wxPen(m_road_colour, passroad_width, wxSOLID));
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, wxPENSTYLE_SOLID));
dc.SetPen(wxPen(m_road_colour, passroad_width, wxSOLID));
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, wxPENSTYLE_SOLID));
dc.SetPen(wxPen(m_road_colour, passroad_width, wxSOLID));
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, wxPENSTYLE_SOLID));
dc.SetPen(wxPen(m_road_colour, passroad_width, wxSOLID));
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, wxPENSTYLE_SOLID));
dc.SetPen(wxPen(AMS_CONTROL_GRAY500, 2, wxSOLID));
dc.SetBrush(wxBrush(*wxTRANSPARENT_BRUSH));
dc.DrawLine(end_top, a1_top, end_top, size.y);
@ -2317,19 +2318,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, wxPENSTYLE_SOLID));
dc.SetPen(wxPen(m_road_colour, passroad_width, wxSOLID));
dc.DrawLine(end_top, a1_top, end_top, size.y);
}
else if (m_road_canid == "1") {
dc.SetPen(wxPen(m_road_colour, passroad_width, wxPENSTYLE_SOLID));
dc.SetPen(wxPen(m_road_colour, passroad_width, wxSOLID));
dc.DrawLine(end_top, a2_top, end_top, size.y);
}
else if (m_road_canid == "2") {
dc.SetPen(wxPen(m_road_colour, passroad_width, wxPENSTYLE_SOLID));
dc.SetPen(wxPen(m_road_colour, passroad_width, wxSOLID));
dc.DrawLine(end_top, a3_top, end_top, size.y);
}
else if (m_road_canid == "3") {
dc.SetPen(wxPen(m_road_colour, passroad_width, wxPENSTYLE_SOLID));
dc.SetPen(wxPen(m_road_colour, passroad_width, wxSOLID));
dc.DrawLine(end_top, a4_top, end_top, size.y);
}
}
@ -3099,6 +3100,7 @@ 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];
@ -3110,6 +3112,7 @@ 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];

View file

@ -175,7 +175,7 @@ public:
void PlayLoading();
void StopLoading();
void create(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size);
void on_timer();
void on_timer(wxTimerEvent &event);
void OnEnterWindow(wxMouseEvent &evt);
void OnLeaveWindow(wxMouseEvent &evt);
void OnClick(wxMouseEvent &evt);

View file

@ -24,7 +24,7 @@ static wxWindow *GetScrollParent(wxWindow *pWindow)
wxWindow *pWin = pWindow;
while (pWin->GetParent()) {
auto pWin2 = pWin->GetParent();
if (dynamic_cast<wxScrollHelper *>(pWin2))
if (auto top = dynamic_cast<wxScrollHelper *>(pWin2))
return dynamic_cast<wxWindow *>(pWin);
pWin = pWin2;
}

View file

@ -112,7 +112,7 @@ void Fan::render(wxDC& dc)
void Fan::doRender(wxDC& dc)
{
// auto rpm = wxT("rpm");
auto rpm = wxT("rpm");
wxSize size = GetSize();
dc.DrawBitmap(m_bitmap_bk.bmp(), wxPoint(0,0));

View file

@ -108,6 +108,7 @@ void ImageSwitchButton::render(wxDC& dc)
wxSize size = GetSize();
wxSize szIcon;
wxSize szContent = textSize;
ScalableBitmap &icon = GetValue() ? m_on : m_off;
int content_height = icon.GetBmpHeight() + textSize.y + m_padding;
@ -267,6 +268,7 @@ void FanSwitchButton::render(wxDC& dc)
wxSize size = GetSize();
wxSize szIcon;
wxSize szContent = textSize;
ScalableBitmap& icon = GetValue() ? m_on : m_off;
//int content_height = icon.GetBmpHeight() + textSize.y + m_padding;

View file

@ -1,4 +1,5 @@
#include "RoundedRectangle.hpp"
#include "../wxExtensions.hpp"
#include <wx/dcgraph.h>
#include <wx/dcclient.h>

View file

@ -205,6 +205,8 @@ void SpinInput::messureSize()
if (size.y < h) {
size.y = h;
}
wxSize minSize = size;
minSize.x = GetMinWidth();
StaticBox::SetSize(size);
SetMinSize(size);
wxSize btnSize = {14, (size.y - 4) / 2};

View file

@ -322,6 +322,7 @@ void StepIndicator::doRender(wxDC &dc)
dc.DrawEllipse(circleX - radius, circleY - radius, radius * 2, radius * 2);
// Draw content ( icon or text ) in circle
if (disabled) {
wxSize sz = bmp_ok.GetBmpSize();
dc.DrawBitmap(bmp_ok.bmp(), circleX - radius, circleY - radius);
} else {
dc.SetFont(font_tip);

View file

@ -412,6 +412,7 @@ void TempInput::render(wxDC &dc)
/*if (!text.IsEmpty()) {
}*/
wxSize textSize = text_ctrl->GetSize();
if (align_right) {
if (pt.x + labelSize.x > size.x) text = wxControl::Ellipsize(text, dc, wxELLIPSIZE_END, size.x - pt.x);
pt.y = (size.y - labelSize.y) / 2;

View file

@ -373,7 +373,7 @@ bool WebView::RunScript(wxWebView *webView, wxString const &javascript)
}, NULL);
return true;
#endif
} catch (std::exception&) {
} catch (std::exception &e) {
return false;
}
}