From daf6feac701f86f54f841024354a3c9b422f8597 Mon Sep 17 00:00:00 2001 From: Maximilian Mader Date: Thu, 26 Sep 2019 18:06:14 +0200 Subject: [PATCH] [GTK3] Make UI react to video config changes --- gtk3/main.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++ gtk3/settings.c | 52 ---------------------------------------- 2 files changed, 64 insertions(+), 52 deletions(-) diff --git a/gtk3/main.c b/gtk3/main.c index 9496053..613ee25 100644 --- a/gtk3/main.c +++ b/gtk3/main.c @@ -351,6 +351,70 @@ G_MODULE_EXPORT gboolean on_vram_viewer_tilemap(GtkWidget *widget, cairo_t *cr, return FALSE; } +G_MODULE_EXPORT void on_highpass_filter_changed(GtkWidget *w, gpointer user_data_gptr) { + config.high_pass_filter_id = (gchar *)gtk_combo_box_get_active_id(GTK_COMBO_BOX(w)); + + if (GB_is_inited(&gb)) { + GB_set_highpass_filter_mode(&gb, get_highpass_mode()); + } +} + +G_MODULE_EXPORT void on_use_integer_scaling_changed(GtkWidget *w, gpointer user_data_gptr) { + GtkCheckButton *button = GTK_CHECK_BUTTON(w); + gboolean value = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)); + config.use_integer_scaling = value; + update_viewport(); +} + +G_MODULE_EXPORT void on_keep_aspect_ratio_changed(GtkWidget *w, gpointer user_data_gptr) { + GtkCheckButton *button = GTK_CHECK_BUTTON(w); + gboolean value = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)); + config.keep_aspect_ratio = value; + update_viewport(); +} + +G_MODULE_EXPORT void on_color_correction_changed(GtkWidget *w, gpointer user_data_gptr) { + GtkComboBox *box = GTK_COMBO_BOX(w); + config.color_correction_id = (gchar *)gtk_combo_box_get_active_id(box); + + if (GB_is_inited(&gb)) { + GB_set_color_correction_mode(&gb, get_color_correction_mode()); + } +} + +G_MODULE_EXPORT void on_graphic_filter_changed(GtkWidget *w, gpointer user_data_gptr) { + GtkComboBox *box = GTK_COMBO_BOX(w); + config.shader = (gchar *)gtk_combo_box_get_active_id(box); + + init_shader_with_name(&shader, config.shader); +} + +G_MODULE_EXPORT void on_cgb_model_changed(GtkWidget *w, gpointer user_data_gptr) { + GtkComboBox *box = GTK_COMBO_BOX(w); + g_print("New value: %s\n", gtk_combo_box_get_active_id(box)); +} + +G_MODULE_EXPORT void on_sgb_model_changed(GtkWidget *w, gpointer user_data_gptr) { + GtkComboBox *box = GTK_COMBO_BOX(w); + g_print("New value: %s\n", gtk_combo_box_get_active_id(box)); +} + +G_MODULE_EXPORT void on_dmg_model_changed(GtkWidget *w, gpointer user_data_gptr) { + GtkComboBox *box = GTK_COMBO_BOX(w); + g_print("New value: %s\n", gtk_combo_box_get_active_id(box)); +} + +G_MODULE_EXPORT void on_rewind_duration_changed(GtkWidget *w, gpointer user_data_gptr) { + GtkComboBox *box = GTK_COMBO_BOX(w); + g_print("New value: %s\n", gtk_combo_box_get_active_id(box)); +} + +G_MODULE_EXPORT void on_boot_rom_location_changed(GtkWidget *w, gpointer user_data_gptr) { + GtkComboBox *box = GTK_COMBO_BOX(w); + g_print("New value: %s\n", gtk_combo_box_get_active_id(box)); +} + + // This functions gets called immediately after registration of the GApplication static void startup(GApplication *app, gpointer user_data_gptr) { UserData *user_data = user_data_gptr; diff --git a/gtk3/settings.c b/gtk3/settings.c index 81239fd..c6af238 100644 --- a/gtk3/settings.c +++ b/gtk3/settings.c @@ -248,55 +248,3 @@ void set_highpass_mode(GB_highpass_mode_t mode) { break; } } - -G_MODULE_EXPORT void on_highpass_filter_changed(GtkWidget *w, gpointer user_data_gptr) { - GtkComboBox *box = GTK_COMBO_BOX(w); - g_print("New value: %s\n", gtk_combo_box_get_active_id(box)); -} - -G_MODULE_EXPORT void on_use_integer_scaling_changed(GtkWidget *w, gpointer user_data_gptr) { - GtkCheckButton *button = GTK_CHECK_BUTTON(w); - gboolean value = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)); - config.use_integer_scaling = value; -} - -G_MODULE_EXPORT void on_keep_aspect_ratio_changed(GtkWidget *w, gpointer user_data_gptr) { - GtkCheckButton *button = GTK_CHECK_BUTTON(w); - gboolean value = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)); - config.keep_aspect_ratio = value; -} - -G_MODULE_EXPORT void on_color_correction_changed(GtkWidget *w, gpointer user_data_gptr) { - GtkComboBox *box = GTK_COMBO_BOX(w); - g_print("New value: %s\n", gtk_combo_box_get_active_id(box)); -} - -G_MODULE_EXPORT void on_graphic_filter_changed(GtkWidget *w, gpointer user_data_gptr) { - GtkComboBox *box = GTK_COMBO_BOX(w); - config.shader = (gchar *)gtk_combo_box_get_active_id(box); -} - -G_MODULE_EXPORT void on_cgb_model_changed(GtkWidget *w, gpointer user_data_gptr) { - GtkComboBox *box = GTK_COMBO_BOX(w); - g_print("New value: %s\n", gtk_combo_box_get_active_id(box)); -} - -G_MODULE_EXPORT void on_sgb_model_changed(GtkWidget *w, gpointer user_data_gptr) { - GtkComboBox *box = GTK_COMBO_BOX(w); - g_print("New value: %s\n", gtk_combo_box_get_active_id(box)); -} - -G_MODULE_EXPORT void on_dmg_model_changed(GtkWidget *w, gpointer user_data_gptr) { - GtkComboBox *box = GTK_COMBO_BOX(w); - g_print("New value: %s\n", gtk_combo_box_get_active_id(box)); -} - -G_MODULE_EXPORT void on_rewind_duration_changed(GtkWidget *w, gpointer user_data_gptr) { - GtkComboBox *box = GTK_COMBO_BOX(w); - g_print("New value: %s\n", gtk_combo_box_get_active_id(box)); -} - -G_MODULE_EXPORT void on_boot_rom_location_changed(GtkWidget *w, gpointer user_data_gptr) { - GtkComboBox *box = GTK_COMBO_BOX(w); - g_print("New value: %s\n", gtk_combo_box_get_active_id(box)); -}