Switch over the null plugins dialog code to use wxWidgets instead of gtk on Linux. (#3420)

* Make the other null plugins use the same functions, and convert PS2Eext.h  to use wx.
This commit is contained in:
arcum42 2020-05-30 13:31:52 -07:00 committed by GitHub
parent 2a9451fed5
commit 8023183999
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 49 deletions

View File

@ -32,8 +32,8 @@
#elif defined(__unix__)
#include <gtk/gtk.h>
#include <cstring>
#include <wx/msgdlg.h>
#define EXPORT_C_(type) extern "C" __attribute__((stdcall, externally_visible, visibility("default"))) type
@ -203,7 +203,6 @@ struct PluginConf
};
#if defined(__unix__)
static void SysMessage(const char *fmt, ...)
{
va_list list;
@ -216,44 +215,8 @@ static void SysMessage(const char *fmt, ...)
if (msg[strlen(msg) - 1] == '\n')
msg[strlen(msg) - 1] = 0;
GtkWidget *dialog;
dialog = gtk_message_dialog_new(NULL,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
GTK_BUTTONS_OK,
"%s", msg);
gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog);
}
static void __forceinline set_logging(GtkToggleButton *check, int &log)
{
log = gtk_toggle_button_get_active(check);
}
static void __forceinline PluginNullConfigure(std::string desc, int &log)
{
GtkWidget *dialog, *label, *check_box;
/* Create the widgets */
dialog = gtk_dialog_new();
label = gtk_label_new(desc.c_str());
check_box = gtk_check_button_new_with_label("Logging");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_box), (log != 0));
/* Ensure that the dialog box is destroyed when the user clicks ok, and that we get the check box value. */
g_signal_connect(check_box, "toggled", G_CALLBACK(set_logging), &log);
/* Add all our widgets, and show everything we've added to the dialog. */
gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), label);
gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), check_box);
gtk_dialog_add_button(GTK_DIALOG(dialog), "Ok", 0);
gtk_widget_show_all(dialog);
gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog);
wxMessageDialog dialog(nullptr, msg, "Info", wxOK);
dialog.ShowModal();
}
#define ENTRY_POINT /* We don't need no stinkin' entry point! */

View File

@ -21,6 +21,7 @@ using namespace std;
#include "GS.h"
#include "Config.h"
#include "null/config.inl"
extern string s_strIniPath;
PluginConf Ini;
@ -33,7 +34,7 @@ void CFGabout()
void CFGconfigure()
{
LoadConfig();
PluginNullConfigure("Since this is a null plugin, all that is really configurable is logging.", conf.Log);
ConfigureLogging();
SaveConfig();
}
@ -42,7 +43,7 @@ void LoadConfig()
const std::string iniFile(s_strIniPath + "/GSNull.ini");
if (!Ini.Open(iniFile, READ_FILE)) {
printf("failed to open %s\n", iniFile.c_str());
g_plugin_log.WriteLn("failed to open %s", iniFile.c_str());
SaveConfig(); //save and return
return;
}
@ -56,7 +57,7 @@ void SaveConfig()
const std::string iniFile(s_strIniPath + "/GSNull.ini");
if (!Ini.Open(iniFile, WRITE_FILE)) {
printf("failed to open %s\n", iniFile.c_str());
g_plugin_log.WriteLn("failed to open %s", iniFile.c_str());
return;
}

View File

@ -19,6 +19,7 @@
#include <string>
#include "Pad.h"
#include "null/config.inl"
extern std::string s_strIniPath;
PluginConf Ini;
@ -33,7 +34,7 @@ EXPORT_C_(void)
PADconfigure()
{
LoadConfig();
PluginNullConfigure("Since this is a null plugin, all that is really configurable is logging.", conf.Log);
ConfigureLogging();
SaveConfig();
}
@ -42,7 +43,7 @@ void LoadConfig()
const std::string iniFile(s_strIniPath + "/Padnull.ini");
if (!Ini.Open(iniFile, READ_FILE)) {
printf("failed to open %s\n", iniFile.c_str());
g_plugin_log.WriteLn("failed to open %s", iniFile.c_str());
SaveConfig(); //save and return
return;
}
@ -56,7 +57,7 @@ void SaveConfig()
const std::string iniFile(s_strIniPath + "/Padnull.ini");
if (!Ini.Open(iniFile, WRITE_FILE)) {
printf("failed to open %s\n", iniFile.c_str());
g_plugin_log.WriteLn("failed to open %s", iniFile.c_str());
return;
}

View File

@ -16,6 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
#include "PadLinux.h"
Display *GSdsp;

View File

@ -18,6 +18,7 @@
#include "Config.h"
#include "SPU2.h"
#include "null/config.inl"
using namespace std;
extern string s_strIniPath;
@ -27,7 +28,7 @@ EXPORT_C_(void)
SPU2configure()
{
LoadConfig();
PluginNullConfigure("Since this is a null plugin, all that is really configurable is logging.", conf.Log);
ConfigureLogging();
SaveConfig();
}
@ -43,7 +44,7 @@ void LoadConfig()
const std::string iniFile(s_strIniPath + "/Spu2null.ini");
if (!Ini.Open(iniFile, READ_FILE)) {
printf("failed to open %s\n", iniFile.c_str());
g_plugin_log.WriteLn("failed to open %s", iniFile.c_str());
SaveConfig(); //save and return
return;
}
@ -57,7 +58,7 @@ void SaveConfig()
const std::string iniFile(s_strIniPath + "/Spu2null.ini");
if (!Ini.Open(iniFile, WRITE_FILE)) {
printf("failed to open %s\n", iniFile.c_str());
g_plugin_log.WriteLn("failed to open %s", iniFile.c_str());
return;
}