Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Manager] Refactor several wxWidgets constructors and/or inputs #6098

Open
Vulpine05 opened this issue Feb 19, 2025 · 8 comments
Open

[Manager] Refactor several wxWidgets constructors and/or inputs #6098

Vulpine05 opened this issue Feb 19, 2025 · 8 comments

Comments

@Vulpine05
Copy link
Contributor

Describe the problem

While building the Manager, several deprecation warnings occur. These are all part of wxWidgets. The warnings are:

  1. Constructor for wxFont
AccountManagerProcessingPage.cpp: In member function ‘void CAccountManagerProcessingPage::CreateControls()’:
AccountManagerProcessingPage.cpp:139:91: warning: ‘wxFont::wxFont(int, int, int, int, bool, const wxString&, wxFontEncoding)’ is deprecated: use wxFONT{FAMILY,STYLE,WEIGHT}_XXX constants [-Wdeprecated-declarations]
  139 |     m_pTitleStaticCtrl->SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, FALSE, _T("Verdana")));
  1. Constructor for wxTimerEvent
AdvancedFrame.cpp:1570:25: warning: ‘wxTimerEvent::wxTimerEvent()’ is deprecated: wxTimerEvent not supposed to be created by user code [-Wdeprecated-declarations]
 1570 |         wxTimerEvent    timerEvent;
  1. Constructor for wxPen
sg_PanelBase.cpp:70:43: warning: ‘wxPen::wxPen(const wxColour&, int, int)’ is deprecated: use wxPENSTYLE_XXX constants [-Wdeprecated-declarations]
   70 |     wxPen bgPen(*wxWHITE, 1, wxTRANSPARENT);

  1. Constructor for wxBrush
sg_PanelBase.cpp:174:49: warning: ‘wxBrush::wxBrush(const wxColour&, int)’ is deprecated: use wxBRUSHSTYLE_XXX constants [-Wdeprecated-declarations]
  174 |     wxBrush bgBrush(*wxLIGHT_GREY, wxTRANSPARENT);
  1. SetWeight for wxFontBase
ViewStatistics.cpp:1151:34: warning: ‘void wxFontBase::SetWeight(wxDeprecatedGUIConstants)’ is deprecated: use wxFONTWEIGHT_XXX constants instead of wxLIGHT/wxNORMAL/wxBOLD [-Wdeprecated-declarations]
 1151 |         m_font_standart.SetWeight(wxNORMAL);

Describe the solution you'd like

These should be updated to the current code. However, I am not sure if it is as simple as refactoring some code, see below.

Additional context

Updating these deprecations for the current version of wxWidgets shouldn't be a problem, except for the wxTimerEvent. I haven't looked at that one in detail yet but it may be a separate issue. However, do we need to keep BOINC compatible with older versions of wxWidgets? If so, then this may get trickier. the changes for the wxFont constructor were added in wxWidgets 3.1.1. If someone is building the Manager for an older OS that needs to use an older version of wxWidgets, (possibly due to a wxGTK version), then this could be trickier.

I'm not sure if the appropriate fix would be to just fix it, add preprocessor headers for each constructor to make it compatible with older versions (which seems like a lot of work and difficult to cover all possibilities), or something else.

Any input is appreciated. I would be happy to fix these deprecations as well.

@AenBleidd
Copy link
Member

For more than 2 years the minimal supported version of wxWidgets is 3.1.3 (that is by the way already 6 years old).
I see no reason to support older versions for it, so just go ahead and fix those deprecations.

@CharlieFenton
Copy link
Contributor

The Mac builld current uses wxWidgets 3.2.2. I am far more cautious about upgrading the dependent libraries, and especially wxWidgets, for the mac because of the many times updating to a newer version has broken things in the Mac Manager, and in the past at least has required patches to the wxWidgets code to work properly on the Mac.

The current Mac code patches include/wx/osx/choice.h, src/osx/choice_osx.cpp, src/osx/cocoa/choice.mm and include/wx/osx/core/private.h. You can see all the patches in the file mac_build/buildWxMac.sh.

So I feel the need to do very extensive testing any time I upgrade wxWidgets, which I don't have the time or energy to do unless absolutely necessary. As long as changes are backward compatible to wxWidgets 3.2.2, I am fine with them. Since the issues you list seem to not affect wxChoice or its derivatives, there probably should not be any problem in fixing most of them.

That said, the Simple View interface is very fragile, especially the code involving transparent backgrounds for pens and brushes, and may appear differently on different platforms (operating systems.) So if you fix those warnings, we need to make sure the Simple View is thoroughly tested on all platforms.

@Vulpine05
Copy link
Contributor Author

@CharlieFenton , I can understand the concern about causing problems in the Mac build. However, I don't think these will be an issue. The changes, for example, are changing the font family from "wxSWISS" to "wxFONTFAMILY_SWISS". I have made the changes, I just haven't built and tested it yet. For the Simple View brushes and pens, it is similar, such as changing "wxTRANSPARENT" to "wxPENSTYLE_TRANSPARENT". I don't think this should cause any issues, but you're right, we should test.

@Vulpine05
Copy link
Contributor Author

The one deprecation I am not sure what to do about is the wxTimerEvent. In AdvancedFrame.cpp, the relevant lines of code are:

wxTimerEvent timerEvent;

pView->FireOnListRender(timerEvent);

with FireOnListRender being:

void CBOINCBaseView::FireOnListRender(wxTimerEvent& event) {
OnListRender(event);
}

I am not familiar with what these functions are doing. I could use some assistance with this. For now, I am leaving this alone.

@CharlieFenton
Copy link
Contributor

changing the font family from "wxSWISS" to "wxFONTFAMILY_SWISS"
changing "wxTRANSPARENT" to "wxPENSTYLE_TRANSPARENT"

I agree, those should be no problem.

@CharlieFenton
Copy link
Contributor

I am not familiar with what these functions are doing. I could use some assistance with this. For now, I am leaving this alone.

It looks like they are just causing the main GUI window to refresh at a set interval (1 second). Do you have any idea what wxTimerEvent should be replaced by, and is the replacement available in wxWidgets 3.2.2?

@CharlieFenton
Copy link
Contributor

changing the font family from "wxSWISS" to "wxFONTFAMILY_SWISS"
changing "wxTRANSPARENT" to "wxPENSTYLE_TRANSPARENT"
I agree, those should be no problem.

That said, please check that the Simple View looks the same after the change to wxPENSTYLE_TRANSPARENT.

@Vulpine05
Copy link
Contributor Author

changing the font family from "wxSWISS" to "wxFONTFAMILY_SWISS"
changing "wxTRANSPARENT" to "wxPENSTYLE_TRANSPARENT"
I agree, those should be no problem.

That said, please check that the Simple View looks the same after the change to wxPENSTYLE_TRANSPARENT.

Will do. I can test in Windows and Linux. If you have time to take a look when I submit the PR, I would appreciate a look at the Mac build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

3 participants