Skip to content
Permalink
Browse files

wx: Replace a bunch of wx 2.8 macros with the wx 3.x versions.

  • Loading branch information...
arcum42 committed May 12, 2019
1 parent 5d4ae31 commit 2941fd9b87b4bb4605f7eb020ee9fad5047703c5
@@ -33,7 +33,7 @@ namespace Threading
//
class WaitForTaskDialog : public wxDialogWithHelpers
{
DECLARE_DYNAMIC_CLASS_NO_COPY(WaitForTaskDialog)
wxDECLARE_DYNAMIC_CLASS_NO_COPY(WaitForTaskDialog);

typedef wxDialogWithHelpers _parent;

@@ -68,7 +68,7 @@ class SynchronousActionState
//
class pxSimpleEvent : public wxEvent
{
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(pxSimpleEvent)
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(pxSimpleEvent);

public:
explicit pxSimpleEvent(int evtid = 0)
@@ -94,7 +94,7 @@ wxDECLARE_EVENT(pxEvt_InvokeAction, pxActionEvent);

class pxActionEvent : public wxEvent
{
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(pxActionEvent)
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(pxActionEvent);

protected:
SynchronousActionState *m_state;
@@ -121,8 +121,8 @@ class pxActionEvent : public wxEvent
virtual void _DoInvokeEvent();

protected:
// Extending classes should implement this method to perfoem whatever action it is
// the event is supposed to do. :) Thread affinity is garaunteed to be the Main/UI
// Extending classes should implement this method to perform whatever action it is
// the event is supposed to do. :) Thread affinity is guaranteed to be the Main/UI
// thread, and exceptions will be handled automatically.
//
// Exception note: exceptions are passed back to the thread that posted the event
@@ -166,7 +166,7 @@ class pxExceptionEvent : public pxActionEvent

class pxSynchronousCommandEvent : public wxCommandEvent
{
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(pxSynchronousCommandEvent)
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(pxSynchronousCommandEvent);

protected:
SynchronousActionState *m_sync;
@@ -199,7 +199,7 @@ wxDECLARE_EVENT(pxEvt_SynchronousCommand, pxSynchronousCommandEvent);
class BaseMessageBoxEvent : public pxActionEvent
{
typedef pxActionEvent _parent;
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(BaseMessageBoxEvent)
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(BaseMessageBoxEvent);

protected:
wxString m_Content;
@@ -374,7 +374,7 @@ class MsgButtons
class pxMessageBoxEvent : public BaseMessageBoxEvent
{
typedef BaseMessageBoxEvent _parent;
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(pxMessageBoxEvent)
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(pxMessageBoxEvent);

protected:
wxString m_Title;
@@ -399,7 +399,7 @@ class pxMessageBoxEvent : public BaseMessageBoxEvent
class pxAssertionEvent : public BaseMessageBoxEvent
{
typedef BaseMessageBoxEvent _parent;
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(pxAssertionEvent)
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(pxAssertionEvent);

protected:
wxString m_Stacktrace;
@@ -67,7 +67,7 @@ class wxAppWithHelpers : public wxApp
{
typedef wxApp _parent;

DECLARE_DYNAMIC_CLASS(wxAppWithHelpers)
wxDECLARE_DYNAMIC_CLASS(wxAppWithHelpers);

protected:
wxEventList m_IdleEventQueue;
@@ -501,7 +501,7 @@ class pxDialogCreationFlags
class wxDialogWithHelpers : public wxDialog
{
typedef wxDialog _parent;
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDialogWithHelpers)
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDialogWithHelpers);

protected:
bool m_hasContextHelp;
@@ -565,7 +565,7 @@ class wxDialogWithHelpers : public wxDialog
//
class wxPanelWithHelpers : public wxPanel
{
DECLARE_DYNAMIC_CLASS_NO_COPY(wxPanelWithHelpers)
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxPanelWithHelpers);

public:
wxPanelWithHelpers(wxWindow *parent, wxOrientation orient, const wxString &staticBoxLabel);
@@ -24,7 +24,7 @@ wxDEFINE_EVENT(pxEvt_ThreadedTaskComplete, wxCommandEvent);
// --------------------------------------------------------------------------------------
// WaitForTaskDialog Implementations
// --------------------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(WaitForTaskDialog, wxDialogWithHelpers)
wxIMPLEMENT_DYNAMIC_CLASS(WaitForTaskDialog, wxDialogWithHelpers);

Threading::WaitForTaskDialog::WaitForTaskDialog(const wxString &title, const wxString &heading)
: wxDialogWithHelpers(NULL, _("Waiting for tasks..."))
@@ -25,7 +25,7 @@ wxDEFINE_EVENT(pxEvt_DeleteThread, wxCommandEvent);
wxDEFINE_EVENT(pxEvt_InvokeAction, pxActionEvent);
wxDEFINE_EVENT(pxEvt_SynchronousCommand, pxSynchronousCommandEvent);

IMPLEMENT_DYNAMIC_CLASS(pxSimpleEvent, wxEvent)
wxIMPLEMENT_DYNAMIC_CLASS(pxSimpleEvent, wxEvent);

ConsoleLogSource_App::ConsoleLogSource_App()
{
@@ -115,7 +115,7 @@ void SynchronousActionState::PostResult()
// pxActionEvent Implementations
// --------------------------------------------------------------------------------------

IMPLEMENT_DYNAMIC_CLASS(pxActionEvent, wxEvent)
wxIMPLEMENT_DYNAMIC_CLASS(pxActionEvent, wxEvent);

pxActionEvent::pxActionEvent(SynchronousActionState *sema, int msgtype)
: wxEvent(0, msgtype)
@@ -156,7 +156,7 @@ void pxActionEvent::SetException(BaseException *ex)
// --------------------------------------------------------------------------------------
// pxSynchronousCommandEvent
// --------------------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(pxSynchronousCommandEvent, wxCommandEvent)
wxIMPLEMENT_DYNAMIC_CLASS(pxSynchronousCommandEvent, wxCommandEvent);

pxSynchronousCommandEvent::pxSynchronousCommandEvent(SynchronousActionState *sema, wxEventType commandType, int winid)
: wxCommandEvent(pxEvt_SynchronousCommand, winid)
@@ -221,7 +221,7 @@ void pxSynchronousCommandEvent::SetException(BaseException *ex)
//
class pxRpcEvent : public pxActionEvent
{
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(pxRpcEvent)
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(pxRpcEvent);

typedef pxActionEvent _parent;

@@ -263,7 +263,7 @@ class pxRpcEvent : public pxActionEvent
}
};

IMPLEMENT_DYNAMIC_CLASS(pxRpcEvent, pxActionEvent)
wxIMPLEMENT_DYNAMIC_CLASS(pxRpcEvent, pxActionEvent);

// --------------------------------------------------------------------------------------
// pxExceptionEvent implementations
@@ -288,7 +288,7 @@ void pxExceptionEvent::InvokeEvent()
// would mean checking only one list of events per idle event, instead of two. (ie, ping
// events can be appended to the idle event list, instead of into their own custom list).
//
IMPLEMENT_DYNAMIC_CLASS(wxAppWithHelpers, wxApp)
wxIMPLEMENT_DYNAMIC_CLASS(wxAppWithHelpers, wxApp);


// Posts a method to the main thread; non-blocking. Post occurs even when called from the
@@ -109,7 +109,7 @@ bool pxDialogExists(const wxString &name)

wxDEFINE_EVENT(pxEvt_OnDialogCreated, wxCommandEvent);

IMPLEMENT_DYNAMIC_CLASS(wxDialogWithHelpers, wxDialog)
wxIMPLEMENT_DYNAMIC_CLASS(wxDialogWithHelpers, wxDialog);

wxDialogWithHelpers::wxDialogWithHelpers()
{
@@ -368,7 +368,7 @@ int wxDialogWithHelpers::GetCharHeight() const
// wxPanelWithHelpers Implementations
// --------------------------------------------------------------------------------------

IMPLEMENT_DYNAMIC_CLASS(wxPanelWithHelpers, wxPanel)
wxIMPLEMENT_DYNAMIC_CLASS(wxPanelWithHelpers, wxPanel);

void wxPanelWithHelpers::Init()
{
@@ -697,7 +697,7 @@ class Pcsx2App : public wxAppWithHelpers
};


DECLARE_APP(Pcsx2App)
wxDECLARE_APP(Pcsx2App);

// --------------------------------------------------------------------------------------
// s* macros! ['s' stands for 'shortcut']
@@ -131,7 +131,7 @@ class SysExecEvent_AppPluginManager : public SysExecEvent
class LoadSinglePluginEvent : public pxActionEvent
{
typedef pxActionEvent _parent;
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(LoadSinglePluginEvent)
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(LoadSinglePluginEvent);

protected:
wxString m_filename;
@@ -161,7 +161,7 @@ class LoadSinglePluginEvent : public pxActionEvent
class SinglePluginMethodEvent : public pxActionEvent
{
typedef pxActionEvent _parent;
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(SinglePluginMethodEvent)
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(SinglePluginMethodEvent);

protected:
PluginsEnum_t m_pid;
@@ -186,8 +186,8 @@ class SinglePluginMethodEvent : public pxActionEvent
}
};

IMPLEMENT_DYNAMIC_CLASS( LoadSinglePluginEvent, pxActionEvent );
IMPLEMENT_DYNAMIC_CLASS( SinglePluginMethodEvent, pxActionEvent );
wxIMPLEMENT_DYNAMIC_CLASS( LoadSinglePluginEvent, pxActionEvent );
wxIMPLEMENT_DYNAMIC_CLASS( SinglePluginMethodEvent, pxActionEvent );

// --------------------------------------------------------------------------------------
// AppCorePlugins
@@ -64,7 +64,7 @@
#include <wx/osx/private.h> // needed to implement the app!
#endif

IMPLEMENT_APP(Pcsx2App)
wxIMPLEMENT_APP(Pcsx2App);

std::unique_ptr<AppConfig> g_Conf;

@@ -232,7 +232,7 @@ void Pcsx2App::PostMenuAction( MenuIdentifiers menu_id ) const
class Pcsx2AppMethodEvent : public pxActionEvent
{
typedef pxActionEvent _parent;
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(Pcsx2AppMethodEvent)
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(Pcsx2AppMethodEvent);

protected:
FnPtr_Pcsx2App m_Method;
@@ -272,7 +272,7 @@ class Pcsx2AppMethodEvent : public pxActionEvent
};


IMPLEMENT_DYNAMIC_CLASS( Pcsx2AppMethodEvent, pxActionEvent )
wxIMPLEMENT_DYNAMIC_CLASS( Pcsx2AppMethodEvent, pxActionEvent );

#ifdef __WXMSW__
extern int TranslateVKToWXK( u32 keysym );
@@ -114,7 +114,7 @@ class BaseApplicableDialog
: public wxDialogWithHelpers
, public IApplyState
{
DECLARE_DYNAMIC_CLASS_NO_COPY(BaseApplicableDialog)
wxDECLARE_DYNAMIC_CLASS_NO_COPY(BaseApplicableDialog);

public:
BaseApplicableDialog() {}
@@ -226,7 +226,7 @@ class BaseApplicableConfigPanel_SpecificConfig : public BaseApplicableConfigPane

class ApplicableWizardPage : public wxWizardPageSimple, public IApplyState
{
DECLARE_DYNAMIC_CLASS_NO_COPY(ApplicableWizardPage)
wxDECLARE_DYNAMIC_CLASS_NO_COPY(ApplicableWizardPage);

public:
ApplicableWizardPage(
@@ -17,10 +17,10 @@
#include "BreakpointWindow.h"


BEGIN_EVENT_TABLE(BreakpointWindow, wxDialog)
wxBEGIN_EVENT_TABLE(BreakpointWindow, wxDialog)
EVT_RADIOBUTTON(wxID_ANY, BreakpointWindow::onRadioChange)
EVT_BUTTON(wxID_OK, BreakpointWindow::onButtonOk)
END_EVENT_TABLE()
wxEND_EVENT_TABLE()


BreakpointWindow::BreakpointWindow( wxWindow* parent, DebugInterface* _cpu )
@@ -27,7 +27,7 @@ class BreakpointWindow : public wxDialog
void initBreakpoint(u32 _address);
void addBreakpoint();

DECLARE_EVENT_TABLE()
wxDECLARE_EVENT_TABLE();
protected:
void onRadioChange(wxCommandEvent& evt);
void onButtonOk(wxCommandEvent& evt);
@@ -32,7 +32,7 @@
#include "Resources/Breakpoint_Active.h"
#include "Resources/Breakpoint_Inactive.h"

BEGIN_EVENT_TABLE(CtrlDisassemblyView, wxWindow)
wxBEGIN_EVENT_TABLE(CtrlDisassemblyView, wxWindow)
EVT_PAINT(CtrlDisassemblyView::paintEvent)
EVT_MOUSEWHEEL(CtrlDisassemblyView::mouseEvent)
EVT_LEFT_DOWN(CtrlDisassemblyView::mouseEvent)
@@ -49,7 +49,7 @@ BEGIN_EVENT_TABLE(CtrlDisassemblyView, wxWindow)
EVT_SIZE(CtrlDisassemblyView::sizeEvent)
EVT_SET_FOCUS(CtrlDisassemblyView::focusEvent)
EVT_KILL_FOCUS(CtrlDisassemblyView::focusEvent)
END_EVENT_TABLE()
wxEND_EVENT_TABLE()

enum DisassemblyMenuIdentifiers
{
@@ -49,7 +49,7 @@ class CtrlDisassemblyView: public wxWindow
void gotoAddress(u32 addr);
void gotoPc() { gotoAddress(cpu->getPC()); };
void scrollStepping(u32 newPc);
DECLARE_EVENT_TABLE()
wxDECLARE_EVENT_TABLE();
private:
void drawBranchLine(wxDC& dc, std::map<u32,int>& addressPositions, BranchLine& line);
void render(wxDC& dc);
@@ -25,7 +25,7 @@
#include <wx/clipbrd.h>


BEGIN_EVENT_TABLE(CtrlMemView, wxWindow)
wxBEGIN_EVENT_TABLE(CtrlMemView, wxWindow)
EVT_PAINT(CtrlMemView::paintEvent)
EVT_MOUSEWHEEL(CtrlMemView::mouseEvent)
EVT_LEFT_DOWN(CtrlMemView::mouseEvent)
@@ -40,7 +40,7 @@ BEGIN_EVENT_TABLE(CtrlMemView, wxWindow)
EVT_SCROLLWIN_LINEDOWN(CtrlMemView::scrollbarEvent)
EVT_SCROLLWIN_PAGEUP(CtrlMemView::scrollbarEvent)
EVT_SCROLLWIN_PAGEDOWN(CtrlMemView::scrollbarEvent)
END_EVENT_TABLE()
wxEND_EVENT_TABLE()

enum MemoryViewMenuIdentifiers
{
@@ -33,7 +33,7 @@ class CtrlMemView: public wxWindow
void gotoAddress(u32 address, bool pushInHistory = false);
void updateReference(u32 address);

DECLARE_EVENT_TABLE()
wxDECLARE_EVENT_TABLE();
private:
void render(wxDC& dc);
int hexGroupPositionFromIndex(int idx);
@@ -21,14 +21,14 @@
#include "AppConfig.h"
#include "DisassemblyDialog.h"

BEGIN_EVENT_TABLE(CtrlRegisterList, wxWindow)
wxBEGIN_EVENT_TABLE(CtrlRegisterList, wxWindow)
EVT_SIZE(CtrlRegisterList::sizeEvent)
EVT_LEFT_DOWN(CtrlRegisterList::mouseEvent)
EVT_RIGHT_DOWN(CtrlRegisterList::mouseEvent)
EVT_RIGHT_UP(CtrlRegisterList::mouseEvent)
EVT_MOTION(CtrlRegisterList::mouseEvent)
EVT_KEY_DOWN(CtrlRegisterList::keydownEvent)
END_EVENT_TABLE()
wxEND_EVENT_TABLE()

enum DisassemblyMenuIdentifiers
{
@@ -30,7 +30,7 @@ class CtrlRegisterList: public wxScrolledWindow
void onPopupClick(wxCommandEvent& evt);
void sizeEvent(wxSizeEvent& evt);
void redraw();
DECLARE_EVENT_TABLE()
wxDECLARE_EVENT_TABLE();

virtual wxSize GetMinClientSize() const
{
@@ -18,14 +18,14 @@
#include "BreakpointWindow.h"
#include "DebugEvents.h"

BEGIN_EVENT_TABLE(GenericListView, wxWindow)
wxBEGIN_EVENT_TABLE(GenericListView, wxWindow)
EVT_SIZE(GenericListView::sizeEvent)
EVT_KEY_DOWN(GenericListView::keydownEvent)
EVT_RIGHT_DOWN(GenericListView::mouseEvent)
EVT_RIGHT_UP(GenericListView::mouseEvent)
EVT_LEFT_DCLICK(GenericListView::mouseEvent)
EVT_LIST_ITEM_RIGHT_CLICK(wxID_ANY,GenericListView::listEvent)
END_EVENT_TABLE()
wxEND_EVENT_TABLE()

GenericListView::GenericListView(wxWindow* parent, GenericListViewColumn* columns, int columnCount)
: wxListView(parent,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxLC_VIRTUAL|wxLC_REPORT|wxLC_SINGLE_SEL|wxNO_BORDER)
@@ -33,7 +33,7 @@ class GenericListView: public wxListView
GenericListView(wxWindow* parent, GenericListViewColumn* columns, int columnCount);
void update();

DECLARE_EVENT_TABLE()
wxDECLARE_EVENT_TABLE();
protected:
void sizeEvent(wxSizeEvent& evt);
void keydownEvent(wxKeyEvent& evt);
Oops, something went wrong.

8 comments on commit 2941fd9

@arcum42

This comment has been minimized.

Copy link
Contributor Author

replied May 12, 2019

See: https://wiki.wxwidgets.org/Updating_to_the_Latest_Version_of_wxWidgets

Note that I only went over the one table of macros. There's other stuff listed here, like all the wxT() and _T()'s in the code now being unnecessary. I'm guessing only enough changes to get things to work were done when we moved to 3.0...

@gregory38

This comment has been minimized.

Copy link
Contributor

replied May 12, 2019

Yes I only did the "enough" part. Besides I kept 2.8 compatibility.

@arcum42

This comment has been minimized.

Copy link
Contributor Author

replied May 12, 2019

Makes sense, since at the time, I'm sure 3.0 was new, and we'd still be dealing with some distributions with 2.8. And I'll admit, I'm not sure I really want to touch the whole wxT part. (And that is how you generally approach these things. You do enough to get it working, then later down the line, you go back and fix up the rest...)

These days, I figure it's been out since 2013, and 3.2 is supposed to be sometime this year. Probably a decent time to look at it.

@gregory38

This comment has been minimized.

Copy link
Contributor

replied May 12, 2019

Yeah. Unfortunately due to lib32 migration is often slow.

If it can help. You can build wx without the 2.8 compatibility layer. As the layer will be disabled by default on 3.2, it could be nice to take care of them. Maybe job was already done, I don't remember.

Then you can also build wx git without 3.0 so you know what will need to be done in the future.

@arcum42

This comment has been minimized.

Copy link
Contributor Author

replied May 12, 2019

There is that. That may get worse, too. I wasn't thrilled to note that I can't update my 32-bit Ubuntu chroot past the version it's on.

Right now I'm seeing what clang-tidy can do with the code. Though, admittedly, I'm generating the json file then running run-clang-tidy directly on it, so not quite the way set up in build.sh...

@gregory38

This comment has been minimized.

Copy link
Contributor

replied May 12, 2019

Clang tidy from build.sh is maybe an old way

@arcum42

This comment has been minimized.

Copy link
Contributor Author

replied May 12, 2019

I'm specifically using -fix with it, and I remember when I was trying the way in build.sh, I was having trouble with it applying fixes multiple times on the same file, probably because of the parallelization.

Ubuntu's also a little strange about clang, and I'm having to explicitly tell it where clang-apply-replacements is. I'm just running:
run-clang-tidy -header-filter='.' -clang-apply-replacements-binary=/usr/bin/clang-apply-replacements-5.0 -checks='-,modernize-replace-auto-ptr' -fix

over and over with different checks.

Maybe I should add an option into build.sh to just generate the json but not run clang-tidy, to make things easier...

@gregory38

This comment has been minimized.

Copy link
Contributor

replied May 12, 2019

Don't bother too much with an option. Dump json and echo the way to use it.
Clang tidy is only run once a blue moon

Please sign in to comment.
You can’t perform that action at this time.