1 |
|
/* |
2 |
|
* prefs_editor_gtk.cpp - Preferences editor, Unix implementation using GTK+ |
3 |
|
* |
4 |
< |
* Basilisk II (C) 1997-1999 Christian Bauer |
4 |
> |
* Basilisk II (C) 1997-2000 Christian Bauer |
5 |
|
* |
6 |
|
* This program is free software; you can redistribute it and/or modify |
7 |
|
* it under the terms of the GNU General Public License as published by |
525 |
|
static int display_type; |
526 |
|
static int dis_width, dis_height; |
527 |
|
|
528 |
< |
#if ENABLE_FBDEV_DGA |
528 |
> |
#ifdef ENABLE_FBDEV_DGA |
529 |
|
static GtkWidget *w_fbdev_name, *w_fbdevice_file; |
530 |
|
static GtkWidget *l_fbdev_name, *l_fbdevice_file; |
531 |
|
static char fbdev_name[256]; |
537 |
|
switch (display_type) { |
538 |
|
case DISPLAY_WINDOW: |
539 |
|
gtk_widget_show(w_frameskip); gtk_widget_show(l_frameskip); |
540 |
< |
#if ENABLE_FBDEV_DGA |
540 |
> |
#ifdef ENABLE_FBDEV_DGA |
541 |
|
gtk_widget_show(w_display_x); gtk_widget_show(l_display_x); |
542 |
|
gtk_widget_show(w_display_y); gtk_widget_show(l_display_y); |
543 |
|
gtk_widget_hide(w_fbdev_name); gtk_widget_hide(l_fbdev_name); |
545 |
|
break; |
546 |
|
case DISPLAY_SCREEN: |
547 |
|
gtk_widget_hide(w_frameskip); gtk_widget_hide(l_frameskip); |
548 |
< |
#if ENABLE_FBDEV_DGA |
548 |
> |
#ifdef ENABLE_FBDEV_DGA |
549 |
|
gtk_widget_hide(w_display_x); gtk_widget_hide(l_display_x); |
550 |
|
gtk_widget_hide(w_display_y); gtk_widget_hide(l_display_y); |
551 |
|
gtk_widget_show(w_fbdev_name); gtk_widget_show(l_fbdev_name); |
575 |
|
static void mn_15hz(...) {PrefsReplaceInt32("frameskip", 4);} |
576 |
|
static void mn_30hz(...) {PrefsReplaceInt32("frameskip", 2);} |
577 |
|
static void mn_60hz(...) {PrefsReplaceInt32("frameskip", 1);} |
578 |
+ |
static void mn_dynamic(...) {PrefsReplaceInt32("frameskip", 0);} |
579 |
|
|
580 |
|
// "Disable Sound Output" button toggled |
581 |
|
static void tb_nosound(GtkWidget *widget) |
589 |
|
display_type = DISPLAY_WINDOW; |
590 |
|
dis_width = 512; |
591 |
|
dis_height = 384; |
592 |
< |
#if ENABLE_FBDEV_DGA |
592 |
> |
#ifdef ENABLE_FBDEV_DGA |
593 |
|
fbdev_name[0] = 0; |
594 |
|
#endif |
595 |
|
|
597 |
|
if (str) { |
598 |
|
if (sscanf(str, "win/%d/%d", &dis_width, &dis_height) == 2) |
599 |
|
display_type = DISPLAY_WINDOW; |
600 |
< |
#if ENABLE_FBDEV_DGA |
600 |
> |
#ifdef ENABLE_FBDEV_DGA |
601 |
|
else if (sscanf(str, "dga/%255s", fbdev_name) == 1) |
602 |
|
#else |
603 |
|
else if (sscanf(str, "dga/%d/%d", &dis_width, &dis_height) == 2) |
623 |
|
sprintf(pref, "win/%d/%d", dis_width, dis_height); |
624 |
|
break; |
625 |
|
case DISPLAY_SCREEN: |
626 |
< |
#if ENABLE_FBDEV_DGA |
626 |
> |
#ifdef ENABLE_FBDEV_DGA |
627 |
|
str = gtk_entry_get_text(GTK_ENTRY(w_fbdev_name)); |
628 |
|
sprintf(pref, "dga/%s", str); |
629 |
|
#else |
681 |
|
add_menu_item(menu, STR_REF_15HZ_LAB, GTK_SIGNAL_FUNC(mn_15hz)); |
682 |
|
add_menu_item(menu, STR_REF_30HZ_LAB, GTK_SIGNAL_FUNC(mn_30hz)); |
683 |
|
add_menu_item(menu, STR_REF_60HZ_LAB, GTK_SIGNAL_FUNC(mn_60hz)); |
684 |
+ |
add_menu_item(menu, STR_REF_DYNAMIC_LAB, GTK_SIGNAL_FUNC(mn_dynamic)); |
685 |
|
int frameskip = PrefsFindInt32("frameskip"); |
686 |
+ |
int item = -1; |
687 |
|
switch (frameskip) { |
688 |
< |
case 12: |
689 |
< |
gtk_menu_set_active(GTK_MENU(menu), 0); |
690 |
< |
break; |
691 |
< |
case 8: |
692 |
< |
gtk_menu_set_active(GTK_MENU(menu), 1); |
693 |
< |
break; |
694 |
< |
case 6: |
692 |
< |
gtk_menu_set_active(GTK_MENU(menu), 2); |
693 |
< |
break; |
694 |
< |
case 4: |
695 |
< |
gtk_menu_set_active(GTK_MENU(menu), 3); |
696 |
< |
break; |
697 |
< |
case 2: |
698 |
< |
gtk_menu_set_active(GTK_MENU(menu), 4); |
699 |
< |
break; |
700 |
< |
case 1: |
701 |
< |
gtk_menu_set_active(GTK_MENU(menu), 5); |
702 |
< |
break; |
688 |
> |
case 12: item = 0; break; |
689 |
> |
case 8: item = 1; break; |
690 |
> |
case 6: item = 2; break; |
691 |
> |
case 4: item = 3; break; |
692 |
> |
case 2: item = 4; break; |
693 |
> |
case 1: item = 5; break; |
694 |
> |
case 0: item = 6; break; |
695 |
|
} |
696 |
+ |
if (item >= 0) |
697 |
+ |
gtk_menu_set_active(GTK_MENU(menu), item); |
698 |
|
gtk_option_menu_set_menu(GTK_OPTION_MENU(w_frameskip), menu); |
699 |
|
gtk_table_attach(GTK_TABLE(table), w_frameskip, 1, 2, 1, 2, (GtkAttachOptions)GTK_FILL, (GtkAttachOptions)0, 4, 4); |
700 |
|
|
740 |
|
gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 3, 4, (GtkAttachOptions)GTK_FILL, (GtkAttachOptions)0, 4, 4); |
741 |
|
w_display_y = GTK_COMBO(combo)->entry; |
742 |
|
|
743 |
< |
#if ENABLE_FBDEV_DGA |
743 |
> |
#ifdef ENABLE_FBDEV_DGA |
744 |
|
l_fbdev_name = gtk_label_new(GetString(STR_FBDEV_NAME_CTRL)); |
745 |
|
gtk_widget_show(l_fbdev_name); |
746 |
|
gtk_table_attach(GTK_TABLE(table), l_fbdev_name, 0, 1, 4, 5, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4); |
927 |
|
static void mn_modelid_5(...) {PrefsReplaceInt32("modelid", 5);} |
928 |
|
static void mn_modelid_14(...) {PrefsReplaceInt32("modelid", 14);} |
929 |
|
|
930 |
< |
// "FPU Emulation" button toggled |
931 |
< |
static void tb_fpu(GtkWidget *widget) |
932 |
< |
{ |
933 |
< |
PrefsReplaceBool("fpu", GTK_TOGGLE_BUTTON(widget)->active); |
934 |
< |
} |
930 |
> |
// CPU/FPU type |
931 |
> |
static void mn_cpu_68020(...) {PrefsReplaceInt32("cpu", 2); PrefsReplaceBool("fpu", false);} |
932 |
> |
static void mn_cpu_68020_fpu(...) {PrefsReplaceInt32("cpu", 2); PrefsReplaceBool("fpu", true);} |
933 |
> |
static void mn_cpu_68030(...) {PrefsReplaceInt32("cpu", 3); PrefsReplaceBool("fpu", false);} |
934 |
> |
static void mn_cpu_68030_fpu(...) {PrefsReplaceInt32("cpu", 3); PrefsReplaceBool("fpu", true);} |
935 |
> |
static void mn_cpu_68040(...) {PrefsReplaceInt32("cpu", 4); PrefsReplaceBool("fpu", true);} |
936 |
|
|
937 |
|
// "Use Raw Keycodes" button toggled |
938 |
|
static void tb_keycodes(GtkWidget *widget) |
1003 |
|
gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 0); |
1004 |
|
gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0); |
1005 |
|
|
1006 |
< |
static const opt_desc options[] = { |
1006 |
> |
static const opt_desc model_options[] = { |
1007 |
|
{STR_MODELID_5_LAB, GTK_SIGNAL_FUNC(mn_modelid_5)}, |
1008 |
|
{STR_MODELID_14_LAB, GTK_SIGNAL_FUNC(mn_modelid_14)}, |
1009 |
|
{0, NULL} |
1013 |
|
case 5: active = 0; break; |
1014 |
|
case 14: active = 1; break; |
1015 |
|
} |
1016 |
< |
menu = make_option_menu(box, STR_MODELID_CTRL, options, active); |
1016 |
> |
make_option_menu(box, STR_MODELID_CTRL, model_options, active); |
1017 |
|
|
1018 |
< |
w_rom_file = make_entry(box, STR_ROM_FILE_CTRL, "rom"); |
1018 |
> |
#if EMULATED_68K |
1019 |
> |
static const opt_desc cpu_options[] = { |
1020 |
> |
{STR_CPU_68020_LAB, GTK_SIGNAL_FUNC(mn_cpu_68020)}, |
1021 |
> |
{STR_CPU_68020_FPU_LAB, GTK_SIGNAL_FUNC(mn_cpu_68020_fpu)}, |
1022 |
> |
{STR_CPU_68030_LAB, GTK_SIGNAL_FUNC(mn_cpu_68030)}, |
1023 |
> |
{STR_CPU_68030_FPU_LAB, GTK_SIGNAL_FUNC(mn_cpu_68030_fpu)}, |
1024 |
> |
{STR_CPU_68040_LAB, GTK_SIGNAL_FUNC(mn_cpu_68040)}, |
1025 |
> |
{0, NULL} |
1026 |
> |
}; |
1027 |
> |
int cpu = PrefsFindInt32("cpu"); |
1028 |
> |
bool fpu = PrefsFindBool("fpu"); |
1029 |
> |
active = 0; |
1030 |
> |
switch (cpu) { |
1031 |
> |
case 2: active = fpu ? 1 : 0; break; |
1032 |
> |
case 3: active = fpu ? 3 : 2; break; |
1033 |
> |
case 4: active = 4; |
1034 |
> |
} |
1035 |
> |
make_option_menu(box, STR_CPU_CTRL, cpu_options, active); |
1036 |
> |
#endif |
1037 |
|
|
1038 |
< |
make_checkbox(box, STR_FPU_CTRL, "fpu", GTK_SIGNAL_FUNC(tb_fpu)); |
1038 |
> |
w_rom_file = make_entry(box, STR_ROM_FILE_CTRL, "rom"); |
1039 |
|
|
1040 |
|
make_checkbox(box, STR_KEYCODES_CTRL, "keycodes", GTK_SIGNAL_FUNC(tb_keycodes)); |
1041 |
|
w_keycode_file = make_entry(box, STR_KEYCODE_FILE_CTRL, "keycodefile"); |