incorporate BasiliskII unix gtk 2 GUI scaling changes into its SheepShaver counterpart

This commit is contained in:
rakslice 2024-11-23 17:25:43 -08:00
parent 678fffa5f5
commit 3f46296a36
3 changed files with 55 additions and 2 deletions

View File

@ -323,7 +323,8 @@ static GtkWidget *make_checkbox(GtkWidget *top, int label_id, const char *prefs_
gtk_widget_show(button);
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), PrefsFindBool(prefs_item));
g_signal_connect(button, "toggled", func, NULL);
gtk_box_pack_start(GTK_BOX(top), button, FALSE, FALSE, 0);
if (top)
gtk_box_pack_start(GTK_BOX(top), button, FALSE, FALSE, 0);
return button;
}
@ -755,6 +756,8 @@ static bool is_fbdev_dga_mode = false;
static GtkWidget *w_dspdevice_file, *w_mixerdevice_file;
static GtkWidget *mag_rate, *scale_nearest, *scale_integer;
// "Window"/"Fullscreen" video type selected
static void mn_display(GtkWidget *widget)
{
@ -801,6 +804,18 @@ static void tb_nosound(GtkWidget *widget)
set_graphics_sensitive();
}
// "Nearest" button toggled
static void tb_scale_nearest(GtkWidget *widget)
{
PrefsReplaceBool("scale_nearest", GTK_TOGGLE_BUTTON(widget)->active);
}
// "Integer Scaling" button toggled
static void tb_scale_integer(GtkWidget *widget)
{
PrefsReplaceBool("scale_integer", GTK_TOGGLE_BUTTON(widget)->active);
}
// Read and convert graphics preferences
static void parse_graphics_prefs(void)
{
@ -898,6 +913,8 @@ static void read_graphics_settings(void)
PrefsReplaceString("dsp", get_file_entry_path(w_dspdevice_file));
PrefsReplaceString("mixer", get_file_entry_path(w_mixerdevice_file));
PrefsReplaceString("mag_rate", gtk_entry_get_text(GTK_ENTRY(mag_rate)));
}
// Create "Graphics/Sound" pane
@ -905,11 +922,12 @@ static void create_graphics_pane(GtkWidget *top)
{
GtkWidget *box, *table, *label, *combo;
char str[32];
char *markup;
parse_graphics_prefs();
box = make_pane(top, STR_GRAPHICS_SOUND_PANE_TITLE);
table = make_table(box, 2, 4);
table = make_table(box, 4, 4);
label = gtk_label_new(GetString(STR_VIDEO_TYPE_CTRL));
gtk_widget_show(label);
@ -1001,6 +1019,33 @@ static void create_graphics_pane(GtkWidget *top)
w_dspdevice_file = make_file_entry(box, STR_DSPDEVICE_FILE_CTRL, "dsp");
w_mixerdevice_file = make_file_entry(box, STR_MIXERDEVICE_FILE_CTRL, "mixer");
// SDL scaling settings section
label = gtk_label_new(GetString(STR_SDL_SCALING));
markup = g_markup_printf_escaped ("<b>%s</b>", GetString(STR_SDL_SCALING));
gtk_label_set_markup(GTK_LABEL(label), markup);
gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
gtk_widget_show(label);
// attach((table), child, left_attach, right_attach, top_attach, bottom_attach, xoptions, yoptions, xpadding, ypadding)
gtk_table_attach(GTK_TABLE(table), label, 2, 4, 0, 1, (GtkAttachOptions)GTK_FILL, (GtkAttachOptions)0, 4, 4);
label = gtk_label_new(GetString(STR_SCALE_FACTOR));
gtk_widget_show(label);
gtk_table_attach(GTK_TABLE(table), label, 2, 3, 1, 2, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4);
mag_rate = gtk_entry_new();
const char *mag_rate_str = PrefsFindString("mag_rate");
if (!mag_rate_str)
mag_rate_str = "1.0";
gtk_entry_set_text(GTK_ENTRY(mag_rate), mag_rate_str);
gtk_widget_show(mag_rate);
gtk_table_attach(GTK_TABLE(table), mag_rate, 3, 4, 1, 2, (GtkAttachOptions)GTK_FILL, (GtkAttachOptions)0, 4, 4);
scale_nearest = make_checkbox(NULL, STR_SCALE_NEAREST, "scale_nearest", G_CALLBACK(tb_scale_nearest));
gtk_table_attach(GTK_TABLE(table), scale_nearest, 2, 4, 2, 3, (GtkAttachOptions)GTK_FILL, (GtkAttachOptions)0, 4, 4);
scale_integer = make_checkbox(NULL, STR_SCALE_INTEGER, "scale_integer", G_CALLBACK(tb_scale_integer));
gtk_table_attach(GTK_TABLE(table), scale_integer, 2, 4, 3, 4, (GtkAttachOptions)GTK_FILL, (GtkAttachOptions)0, 4, 4);
set_graphics_sensitive();
}

View File

@ -144,6 +144,10 @@ enum {
STR_DIRECT3D_LAB,
STR_GRAPHICS_SDL_VSYNC_CTRL,
STR_DEFAULT_LAB,
STR_SDL_SCALING,
STR_SCALE_FACTOR,
STR_SCALE_NEAREST,
STR_SCALE_INTEGER,
// Serial/Network pane
STR_SERIAL_NETWORK_PANE_TITLE = 3400,

View File

@ -154,6 +154,10 @@ user_string_def common_strings[] = {
{STR_DIRECT3D_LAB, "Direct3D"},
{STR_GRAPHICS_SDL_VSYNC_CTRL, "Vertical Sync (Software)"},
{STR_DEFAULT_LAB, "Default"},
{STR_SDL_SCALING, "Scaling (SDL)"},
{STR_SCALE_FACTOR, "Scale factor:"},
{STR_SCALE_NEAREST, "Nearest"},
{STR_SCALE_INTEGER, "Integer Scaling"},
{STR_SERIAL_NETWORK_PANE_TITLE, "Serial/Network"},
{STR_SERPORTA_CTRL, "Modem Port"},