Browse code

Replace the Sound View dialog with a wxWidgets-based one.

* Removes the one that was orignally based entirely on the DeSmuME one, while still looking most the same but cleaner.
* To accommodate this, I needed to rework how wxWidgets was initialized so the configuration dialog boxes could also work alongside this.
* Needed to add a custom wxApp to handle the above.
* This also means that the configuration dialog no longer needs the plugin's HINSTANCE passed along.
* Had to not disable wxGauge or wxToogleButton for the Sound View dialog.
* Also remove the now-unneeded enums in the XSFConfig*.cpp files.
* Sound View is still done in a thread so its event loop can run independently from the rest of the plugin.
* XSFConfig_NCSF doesn't need to be the one to start the Sound View dialog now.

Naram Qashat authored on 2021/04/10 15:19:43
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,41 @@
1
+/*
2
+ * xSF - Core wxWidgets App
3
+ * By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com]
4
+ *
5
+ * Partially based on the vio*sf framework
6
+ */
7
+
8
+#ifdef __GNUC__
9
+# pragma GCC diagnostic push
10
+# pragma GCC diagnostic ignored "-Wold-style-cast"
11
+#elif defined(__clang__)
12
+# pragma clang diagnostic push
13
+# pragma clang diagnostic ignored "-Wold-style-cast"
14
+#endif
15
+#include <wx/nativewin.h>
16
+#ifdef __GNUC__
17
+# pragma GCC diagnostic pop
18
+#elif defined(__clang__)
19
+# pragma clang diagnostic pop
20
+#endif
21
+#include "windowsh_wrapper.h"
22
+#include "XSFApp.h"
23
+#include "XSFConfig.h"
24
+#include "XSFConfigDialog.h"
25
+
26
+void XSFApp::ConfigDialog(HWND parent, XSFConfig *config)
27
+{
28
+	// NOTE: This is only good enough to make it so the dialog box isn't shown on the taskbar, it is not good enough to make the dialog modal to Winamp's preferences screen... it'll actually crash if someone changes to another section of preferences...
29
+
30
+	auto window = wxNativeContainerWindow(parent);
31
+	auto dialog = config->CreateDialogBox(&window, XSFConfig::commonName + " v" + XSFConfig::versionNumber);
32
+	dialog->Finalize();
33
+	config->InitializeConfigDialog(dialog);
34
+	if (dialog->ShowModal() == wxID_OK)
35
+	{
36
+		config->SaveConfigDialog(dialog);
37
+		config->SaveConfig();
38
+	}
39
+	dialog->Destroy();
40
+	window.Destroy();
41
+}