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-2002 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 |
28 |
|
#include <net/if.h> |
29 |
|
#include <net/if_arp.h> |
30 |
|
|
31 |
+ |
#ifdef HAVE_GNOMEUI |
32 |
+ |
#include <gnome.h> |
33 |
+ |
#endif |
34 |
+ |
|
35 |
|
#include "user_strings.h" |
36 |
|
#include "version.h" |
37 |
|
#include "cdrom.h" |
49 |
|
static void create_volumes_pane(GtkWidget *top); |
50 |
|
static void create_scsi_pane(GtkWidget *top); |
51 |
|
static void create_graphics_pane(GtkWidget *top); |
52 |
+ |
static void create_input_pane(GtkWidget *top); |
53 |
|
static void create_serial_pane(GtkWidget *top); |
54 |
|
static void create_memory_pane(GtkWidget *top); |
55 |
|
static void read_settings(void); |
154 |
|
return menu; |
155 |
|
} |
156 |
|
|
157 |
< |
static GtkWidget *make_entry(GtkWidget *top, int label_id, const char *prefs_item) |
157 |
> |
static GtkWidget *make_file_entry(GtkWidget *top, int label_id, const char *prefs_item, bool only_dirs = false) |
158 |
|
{ |
159 |
|
GtkWidget *box, *label, *entry; |
160 |
|
|
166 |
|
gtk_widget_show(label); |
167 |
|
gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 0); |
168 |
|
|
164 |
– |
entry = gtk_entry_new(); |
165 |
– |
gtk_widget_show(entry); |
169 |
|
const char *str = PrefsFindString(prefs_item); |
170 |
|
if (str == NULL) |
171 |
|
str = ""; |
172 |
+ |
|
173 |
+ |
#ifdef HAVE_GNOMEUI |
174 |
+ |
entry = gnome_file_entry_new(NULL, GetString(label_id)); |
175 |
+ |
if (only_dirs) |
176 |
+ |
gnome_file_entry_set_directory(GNOME_FILE_ENTRY(entry), true); |
177 |
+ |
gtk_entry_set_text(GTK_ENTRY(gnome_file_entry_gtk_entry(GNOME_FILE_ENTRY(entry))), str); |
178 |
+ |
#else |
179 |
+ |
entry = gtk_entry_new(); |
180 |
|
gtk_entry_set_text(GTK_ENTRY(entry), str); |
181 |
+ |
#endif |
182 |
+ |
gtk_widget_show(entry); |
183 |
|
gtk_box_pack_start(GTK_BOX(box), entry, TRUE, TRUE, 0); |
184 |
|
return entry; |
185 |
|
} |
186 |
|
|
187 |
+ |
static char *get_file_entry_path(GtkWidget *entry) |
188 |
+ |
{ |
189 |
+ |
#ifdef HAVE_GNOMEUI |
190 |
+ |
return gnome_file_entry_get_full_path(GNOME_FILE_ENTRY(entry), false); |
191 |
+ |
#else |
192 |
+ |
return gtk_entry_get_text(GTK_ENTRY(entry)); |
193 |
+ |
#endif |
194 |
+ |
} |
195 |
+ |
|
196 |
|
static GtkWidget *make_checkbox(GtkWidget *top, int label_id, const char *prefs_item, GtkSignalFunc func) |
197 |
|
{ |
198 |
|
GtkWidget *button = gtk_check_button_new_with_label(GetString(label_id)); |
246 |
|
// "About" selected |
247 |
|
static void mn_about(...) |
248 |
|
{ |
249 |
< |
GtkWidget *dialog, *label, *button; |
249 |
> |
GtkWidget *dialog; |
250 |
|
|
251 |
< |
char str[256]; |
252 |
< |
sprintf(str, GetString(STR_ABOUT_TEXT1), VERSION_MAJOR, VERSION_MINOR); |
253 |
< |
strncat(str, "\n", 255); |
254 |
< |
strncat(str, GetString(STR_ABOUT_TEXT2), 255); |
251 |
> |
#ifdef HAVE_GNOMEUI |
252 |
> |
|
253 |
> |
char version[32]; |
254 |
> |
sprintf(version, "Version %d.%d", VERSION_MAJOR, VERSION_MINOR); |
255 |
> |
const char *authors[] = { |
256 |
> |
"Christian Bauer", |
257 |
> |
"Orlando Bassotto", |
258 |
> |
"Gwenolé Beauchesne", |
259 |
> |
"Marc Chabanas", |
260 |
> |
"Marc Hellwig", |
261 |
> |
"Biill Huey", |
262 |
> |
"Brian J. Johnson", |
263 |
> |
"Jürgen Lachmann", |
264 |
> |
"Samuel Lander", |
265 |
> |
"David Lawrence", |
266 |
> |
"Lauri Pesonen", |
267 |
> |
"Bernd Schmidt", |
268 |
> |
"and others", |
269 |
> |
NULL |
270 |
> |
}; |
271 |
> |
dialog = gnome_about_new( |
272 |
> |
"Basilisk II", |
273 |
> |
version, |
274 |
> |
"Copyright (C) 1997-2002 Christian Bauer", |
275 |
> |
authors, |
276 |
> |
"Basilisk II comes with ABSOLUTELY NO WARRANTY." |
277 |
> |
"This is free software, and you are welcome to redistribute it" |
278 |
> |
"under the terms of the GNU General Public License.", |
279 |
> |
NULL |
280 |
> |
); |
281 |
> |
gnome_dialog_set_parent(GNOME_DIALOG(dialog), GTK_WINDOW(win)); |
282 |
> |
|
283 |
> |
#else |
284 |
> |
|
285 |
> |
GtkWidget *label, *button; |
286 |
> |
|
287 |
> |
char str[512]; |
288 |
> |
sprintf(str, |
289 |
> |
"Basilisk II\nVersion %d.%d\n\n" |
290 |
> |
"Copyright (C) 1997-2002 Christian Bauer et al.\n" |
291 |
> |
"E-mail: Christian.Bauer@uni-mainz.de\n" |
292 |
> |
"http://www.uni-mainz.de/~bauec002/B2Main.html\n\n" |
293 |
> |
"Basilisk II comes with ABSOLUTELY NO\n" |
294 |
> |
"WARRANTY. This is free software, and\n" |
295 |
> |
"you are welcome to redistribute it\n" |
296 |
> |
"under the terms of the GNU General\n" |
297 |
> |
"Public License.\n", |
298 |
> |
VERSION_MAJOR, VERSION_MINOR |
299 |
> |
); |
300 |
|
|
301 |
|
dialog = gtk_dialog_new(); |
235 |
– |
gtk_widget_set_usize(GTK_WIDGET(dialog), strlen(GetString(STR_ABOUT_TEXT2)) + 200, 120); |
302 |
|
gtk_window_set_title(GTK_WINDOW(dialog), GetString(STR_ABOUT_TITLE)); |
303 |
|
gtk_container_border_width(GTK_CONTAINER(dialog), 5); |
304 |
|
gtk_widget_set_uposition(GTK_WIDGET(dialog), 100, 150); |
313 |
|
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->action_area), button, FALSE, FALSE, 0); |
314 |
|
GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); |
315 |
|
gtk_widget_grab_default(button); |
316 |
+ |
|
317 |
+ |
#endif |
318 |
+ |
|
319 |
|
gtk_widget_show(dialog); |
320 |
|
} |
321 |
|
|
366 |
|
create_volumes_pane(notebook); |
367 |
|
create_scsi_pane(notebook); |
368 |
|
create_graphics_pane(notebook); |
369 |
+ |
create_input_pane(notebook); |
370 |
|
create_serial_pane(notebook); |
371 |
|
create_memory_pane(notebook); |
372 |
|
|
470 |
|
} |
471 |
|
|
472 |
|
// "Boot From" selected |
473 |
< |
static void mn_boot_any(...) {PrefsReplaceInt16("bootdriver", 0);} |
474 |
< |
static void mn_boot_cdrom(...) {PrefsReplaceInt16("bootdriver", CDROMRefNum);} |
473 |
> |
static void mn_boot_any(...) {PrefsReplaceInt32("bootdriver", 0);} |
474 |
> |
static void mn_boot_cdrom(...) {PrefsReplaceInt32("bootdriver", CDROMRefNum);} |
475 |
|
|
476 |
|
// "No CD-ROM Driver" button toggled |
477 |
|
static void tb_nocdrom(GtkWidget *widget) |
491 |
|
PrefsAddString("disk", str); |
492 |
|
} |
493 |
|
|
494 |
< |
PrefsReplaceString("extfs", gtk_entry_get_text(GTK_ENTRY(w_extfs))); |
494 |
> |
PrefsReplaceString("extfs", get_file_entry_path(w_extfs)); |
495 |
|
} |
496 |
|
|
497 |
|
// Create "Volumes" pane |
512 |
|
gtk_signal_connect(GTK_OBJECT(volume_list), "select_row", GTK_SIGNAL_FUNC(cl_selected), NULL); |
513 |
|
char *str; |
514 |
|
int32 index = 0; |
515 |
< |
while ((str = (char *)PrefsFindString("disk", index++)) != NULL) |
515 |
> |
while ((str = const_cast<char *>(PrefsFindString("disk", index++))) != NULL) |
516 |
|
gtk_clist_append(GTK_CLIST(volume_list), &str); |
517 |
|
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scroll), volume_list); |
518 |
|
gtk_box_pack_start(GTK_BOX(box), scroll, TRUE, TRUE, 0); |
527 |
|
make_button_box(box, 0, buttons); |
528 |
|
make_separator(box); |
529 |
|
|
530 |
< |
w_extfs = make_entry(box, STR_EXTFS_CTRL, "extfs"); |
530 |
> |
w_extfs = make_file_entry(box, STR_EXTFS_CTRL, "extfs", true); |
531 |
|
|
532 |
|
static const opt_desc options[] = { |
533 |
|
{STR_BOOT_ANY_LAB, GTK_SIGNAL_FUNC(mn_boot_any)}, |
534 |
|
{STR_BOOT_CDROM_LAB, GTK_SIGNAL_FUNC(mn_boot_cdrom)}, |
535 |
|
{0, NULL} |
536 |
|
}; |
537 |
< |
int bootdriver = PrefsFindInt16("bootdriver"), active = 0; |
537 |
> |
int bootdriver = PrefsFindInt32("bootdriver"), active = 0; |
538 |
|
switch (bootdriver) { |
539 |
|
case 0: active = 0; break; |
540 |
|
case CDROMRefNum: active = 1; break; |
557 |
|
for (int id=0; id<7; id++) { |
558 |
|
char prefs_name[32]; |
559 |
|
sprintf(prefs_name, "scsi%d", id); |
560 |
< |
const char *str = gtk_entry_get_text(GTK_ENTRY(w_scsi[id])); |
560 |
> |
const char *str = get_file_entry_path(w_scsi[id]); |
561 |
|
if (str && strlen(str)) |
562 |
|
PrefsReplaceString(prefs_name, str); |
563 |
|
else |
575 |
|
for (int id=0; id<7; id++) { |
576 |
|
char prefs_name[32]; |
577 |
|
sprintf(prefs_name, "scsi%d", id); |
578 |
< |
w_scsi[id] = make_entry(box, STR_SCSI_ID_0 + id, prefs_name); |
578 |
> |
w_scsi[id] = make_file_entry(box, STR_SCSI_ID_0 + id, prefs_name); |
579 |
|
} |
580 |
|
} |
581 |
|
|
595 |
|
static int display_type; |
596 |
|
static int dis_width, dis_height; |
597 |
|
|
598 |
< |
#if ENABLE_FBDEV_DGA |
598 |
> |
#ifdef ENABLE_FBDEV_DGA |
599 |
|
static GtkWidget *w_fbdev_name, *w_fbdevice_file; |
600 |
|
static GtkWidget *l_fbdev_name, *l_fbdevice_file; |
601 |
|
static char fbdev_name[256]; |
607 |
|
switch (display_type) { |
608 |
|
case DISPLAY_WINDOW: |
609 |
|
gtk_widget_show(w_frameskip); gtk_widget_show(l_frameskip); |
610 |
< |
#if ENABLE_FBDEV_DGA |
610 |
> |
#ifdef ENABLE_FBDEV_DGA |
611 |
|
gtk_widget_show(w_display_x); gtk_widget_show(l_display_x); |
612 |
|
gtk_widget_show(w_display_y); gtk_widget_show(l_display_y); |
613 |
|
gtk_widget_hide(w_fbdev_name); gtk_widget_hide(l_fbdev_name); |
615 |
|
break; |
616 |
|
case DISPLAY_SCREEN: |
617 |
|
gtk_widget_hide(w_frameskip); gtk_widget_hide(l_frameskip); |
618 |
< |
#if ENABLE_FBDEV_DGA |
618 |
> |
#ifdef ENABLE_FBDEV_DGA |
619 |
|
gtk_widget_hide(w_display_x); gtk_widget_hide(l_display_x); |
620 |
|
gtk_widget_hide(w_display_y); gtk_widget_hide(l_display_y); |
621 |
|
gtk_widget_show(w_fbdev_name); gtk_widget_show(l_fbdev_name); |
645 |
|
static void mn_15hz(...) {PrefsReplaceInt32("frameskip", 4);} |
646 |
|
static void mn_30hz(...) {PrefsReplaceInt32("frameskip", 2);} |
647 |
|
static void mn_60hz(...) {PrefsReplaceInt32("frameskip", 1);} |
648 |
+ |
static void mn_dynamic(...) {PrefsReplaceInt32("frameskip", 0);} |
649 |
|
|
650 |
|
// "Disable Sound Output" button toggled |
651 |
|
static void tb_nosound(GtkWidget *widget) |
659 |
|
display_type = DISPLAY_WINDOW; |
660 |
|
dis_width = 512; |
661 |
|
dis_height = 384; |
662 |
< |
#if ENABLE_FBDEV_DGA |
662 |
> |
#ifdef ENABLE_FBDEV_DGA |
663 |
|
fbdev_name[0] = 0; |
664 |
|
#endif |
665 |
|
|
667 |
|
if (str) { |
668 |
|
if (sscanf(str, "win/%d/%d", &dis_width, &dis_height) == 2) |
669 |
|
display_type = DISPLAY_WINDOW; |
670 |
< |
#if ENABLE_FBDEV_DGA |
670 |
> |
#ifdef ENABLE_FBDEV_DGA |
671 |
|
else if (sscanf(str, "dga/%255s", fbdev_name) == 1) |
672 |
|
#else |
673 |
|
else if (sscanf(str, "dga/%d/%d", &dis_width, &dis_height) == 2) |
693 |
|
sprintf(pref, "win/%d/%d", dis_width, dis_height); |
694 |
|
break; |
695 |
|
case DISPLAY_SCREEN: |
696 |
< |
#if ENABLE_FBDEV_DGA |
696 |
> |
#ifdef ENABLE_FBDEV_DGA |
697 |
|
str = gtk_entry_get_text(GTK_ENTRY(w_fbdev_name)); |
698 |
|
sprintf(pref, "dga/%s", str); |
699 |
|
#else |
705 |
|
return; |
706 |
|
} |
707 |
|
PrefsReplaceString("screen", pref); |
708 |
+ |
|
709 |
+ |
#ifdef ENABLE_FBDEV_DGA |
710 |
+ |
str = get_file_entry_path(w_fbdevice_file); |
711 |
+ |
if (str && strlen(str)) |
712 |
+ |
PrefsReplaceString("fbdevicefile", str); |
713 |
+ |
else |
714 |
+ |
PrefsRemoveItem("fbdevicefile"); |
715 |
+ |
#endif |
716 |
|
} |
717 |
|
|
718 |
|
// Create "Graphics/Sound" pane |
759 |
|
add_menu_item(menu, STR_REF_15HZ_LAB, GTK_SIGNAL_FUNC(mn_15hz)); |
760 |
|
add_menu_item(menu, STR_REF_30HZ_LAB, GTK_SIGNAL_FUNC(mn_30hz)); |
761 |
|
add_menu_item(menu, STR_REF_60HZ_LAB, GTK_SIGNAL_FUNC(mn_60hz)); |
762 |
+ |
add_menu_item(menu, STR_REF_DYNAMIC_LAB, GTK_SIGNAL_FUNC(mn_dynamic)); |
763 |
|
int frameskip = PrefsFindInt32("frameskip"); |
764 |
+ |
int item = -1; |
765 |
|
switch (frameskip) { |
766 |
< |
case 12: |
767 |
< |
gtk_menu_set_active(GTK_MENU(menu), 0); |
768 |
< |
break; |
769 |
< |
case 8: |
770 |
< |
gtk_menu_set_active(GTK_MENU(menu), 1); |
771 |
< |
break; |
772 |
< |
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; |
766 |
> |
case 12: item = 0; break; |
767 |
> |
case 8: item = 1; break; |
768 |
> |
case 6: item = 2; break; |
769 |
> |
case 4: item = 3; break; |
770 |
> |
case 2: item = 4; break; |
771 |
> |
case 1: item = 5; break; |
772 |
> |
case 0: item = 6; break; |
773 |
|
} |
774 |
+ |
if (item >= 0) |
775 |
+ |
gtk_menu_set_active(GTK_MENU(menu), item); |
776 |
|
gtk_option_menu_set_menu(GTK_OPTION_MENU(w_frameskip), menu); |
777 |
|
gtk_table_attach(GTK_TABLE(table), w_frameskip, 1, 2, 1, 2, (GtkAttachOptions)GTK_FILL, (GtkAttachOptions)0, 4, 4); |
778 |
|
|
818 |
|
gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 3, 4, (GtkAttachOptions)GTK_FILL, (GtkAttachOptions)0, 4, 4); |
819 |
|
w_display_y = GTK_COMBO(combo)->entry; |
820 |
|
|
821 |
< |
#if ENABLE_FBDEV_DGA |
821 |
> |
#ifdef ENABLE_FBDEV_DGA |
822 |
|
l_fbdev_name = gtk_label_new(GetString(STR_FBDEV_NAME_CTRL)); |
823 |
|
gtk_widget_show(l_fbdev_name); |
824 |
|
gtk_table_attach(GTK_TABLE(table), l_fbdev_name, 0, 1, 4, 5, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4); |
828 |
|
gtk_entry_set_text(GTK_ENTRY(w_fbdev_name), fbdev_name); |
829 |
|
gtk_table_attach(GTK_TABLE(table), w_fbdev_name, 1, 2, 4, 5, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4); |
830 |
|
|
831 |
< |
w_fbdevice_file = make_entry(box, STR_FBDEVICE_FILE_CTRL, "fbdevicefile"); |
831 |
> |
w_fbdevice_file = make_file_entry(box, STR_FBDEVICE_FILE_CTRL, "fbdevicefile"); |
832 |
|
#endif |
833 |
|
|
834 |
+ |
make_separator(box); |
835 |
|
make_checkbox(box, STR_NOSOUND_CTRL, "nosound", GTK_SIGNAL_FUNC(tb_nosound)); |
836 |
|
|
837 |
|
hide_show_graphics_widgets(); |
839 |
|
|
840 |
|
|
841 |
|
/* |
842 |
+ |
* "Input" pane |
843 |
+ |
*/ |
844 |
+ |
|
845 |
+ |
static GtkWidget *w_keycode_file; |
846 |
+ |
static GtkWidget *w_mouse_wheel_lines; |
847 |
+ |
|
848 |
+ |
// Set sensitivity of widgets |
849 |
+ |
static void set_input_sensitive(void) |
850 |
+ |
{ |
851 |
+ |
gtk_widget_set_sensitive(w_keycode_file, PrefsFindBool("keycodes")); |
852 |
+ |
gtk_widget_set_sensitive(w_mouse_wheel_lines, PrefsFindInt32("mousewheelmode") == 1); |
853 |
+ |
} |
854 |
+ |
|
855 |
+ |
// "Use Raw Keycodes" button toggled |
856 |
+ |
static void tb_keycodes(GtkWidget *widget) |
857 |
+ |
{ |
858 |
+ |
PrefsReplaceBool("keycodes", GTK_TOGGLE_BUTTON(widget)->active); |
859 |
+ |
set_input_sensitive(); |
860 |
+ |
} |
861 |
+ |
|
862 |
+ |
// "Mouse Wheel Mode" selected |
863 |
+ |
static void mn_wheel_page(...) {PrefsReplaceInt32("mousewheelmode", 0); set_input_sensitive();} |
864 |
+ |
static void mn_wheel_cursor(...) {PrefsReplaceInt32("mousewheelmode", 1); set_input_sensitive();} |
865 |
+ |
|
866 |
+ |
// Read settings from widgets and set preferences |
867 |
+ |
static void read_input_settings(void) |
868 |
+ |
{ |
869 |
+ |
const char *str = get_file_entry_path(w_keycode_file); |
870 |
+ |
if (str && strlen(str)) |
871 |
+ |
PrefsReplaceString("keycodefile", str); |
872 |
+ |
else |
873 |
+ |
PrefsRemoveItem("keycodefile"); |
874 |
+ |
|
875 |
+ |
PrefsReplaceInt32("mousewheellines", gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(w_mouse_wheel_lines))); |
876 |
+ |
} |
877 |
+ |
|
878 |
+ |
// Create "Input" pane |
879 |
+ |
static void create_input_pane(GtkWidget *top) |
880 |
+ |
{ |
881 |
+ |
GtkWidget *box, *hbox, *menu, *label; |
882 |
+ |
GtkObject *adj; |
883 |
+ |
|
884 |
+ |
box = make_pane(top, STR_INPUT_PANE_TITLE); |
885 |
+ |
|
886 |
+ |
make_checkbox(box, STR_KEYCODES_CTRL, "keycodes", GTK_SIGNAL_FUNC(tb_keycodes)); |
887 |
+ |
w_keycode_file = make_file_entry(box, STR_KEYCODE_FILE_CTRL, "keycodefile"); |
888 |
+ |
|
889 |
+ |
make_separator(box); |
890 |
+ |
|
891 |
+ |
static const opt_desc options[] = { |
892 |
+ |
{STR_MOUSEWHEELMODE_PAGE_LAB, GTK_SIGNAL_FUNC(mn_wheel_page)}, |
893 |
+ |
{STR_MOUSEWHEELMODE_CURSOR_LAB, GTK_SIGNAL_FUNC(mn_wheel_cursor)}, |
894 |
+ |
{0, NULL} |
895 |
+ |
}; |
896 |
+ |
int wheelmode = PrefsFindInt32("mousewheelmode"), active = 0; |
897 |
+ |
switch (wheelmode) { |
898 |
+ |
case 0: active = 0; break; |
899 |
+ |
case 1: active = 1; break; |
900 |
+ |
} |
901 |
+ |
menu = make_option_menu(box, STR_MOUSEWHEELMODE_CTRL, options, active); |
902 |
+ |
|
903 |
+ |
hbox = gtk_hbox_new(FALSE, 4); |
904 |
+ |
gtk_widget_show(hbox); |
905 |
+ |
gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0); |
906 |
+ |
|
907 |
+ |
label = gtk_label_new(GetString(STR_MOUSEWHEELLINES_CTRL)); |
908 |
+ |
gtk_widget_show(label); |
909 |
+ |
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
910 |
+ |
|
911 |
+ |
adj = gtk_adjustment_new(PrefsFindInt32("mousewheellines"), 1, 1000, 1, 5, 0); |
912 |
+ |
w_mouse_wheel_lines = gtk_spin_button_new(GTK_ADJUSTMENT(adj), 0.0, 0); |
913 |
+ |
gtk_widget_show(w_mouse_wheel_lines); |
914 |
+ |
gtk_box_pack_start(GTK_BOX(hbox), w_mouse_wheel_lines, FALSE, FALSE, 0); |
915 |
+ |
|
916 |
+ |
set_input_sensitive(); |
917 |
+ |
} |
918 |
+ |
|
919 |
+ |
|
920 |
+ |
/* |
921 |
|
* "Serial/Network" pane |
922 |
|
*/ |
923 |
|
|
924 |
< |
static GtkWidget *w_seriala, *w_serialb, *w_ether; |
924 |
> |
static GtkWidget *w_seriala, *w_serialb, *w_ether, *w_udp_port; |
925 |
> |
|
926 |
> |
// Set sensitivity of widgets |
927 |
> |
static void set_serial_sensitive(void) |
928 |
> |
{ |
929 |
> |
#if SUPPORTS_UDP_TUNNEL |
930 |
> |
gtk_widget_set_sensitive(w_ether, !PrefsFindBool("udptunnel")); |
931 |
> |
gtk_widget_set_sensitive(w_udp_port, PrefsFindBool("udptunnel")); |
932 |
> |
#endif |
933 |
> |
} |
934 |
> |
|
935 |
> |
// "Tunnel AppleTalk over IP" button toggled |
936 |
> |
static void tb_udptunnel(GtkWidget *widget) |
937 |
> |
{ |
938 |
> |
PrefsReplaceBool("udptunnel", GTK_TOGGLE_BUTTON(widget)->active); |
939 |
> |
set_serial_sensitive(); |
940 |
> |
} |
941 |
|
|
942 |
|
// Read settings from widgets and set preferences |
943 |
|
static void read_serial_settings(void) |
955 |
|
PrefsReplaceString("ether", str); |
956 |
|
else |
957 |
|
PrefsRemoveItem("ether"); |
958 |
+ |
|
959 |
+ |
#if SUPPORTS_UDP_TUNNEL |
960 |
+ |
PrefsReplaceInt32("udpport", gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(w_udp_port))); |
961 |
+ |
#endif |
962 |
|
} |
963 |
|
|
964 |
|
// Add names of serial devices |
1042 |
|
// Create "Serial/Network" pane |
1043 |
|
static void create_serial_pane(GtkWidget *top) |
1044 |
|
{ |
1045 |
< |
GtkWidget *box, *table, *label, *combo; |
1046 |
< |
GList *glist = add_serial_names(); |
1045 |
> |
GtkWidget *box, *hbox, *table, *label, *combo, *sep; |
1046 |
> |
GtkObject *adj; |
1047 |
|
|
1048 |
|
box = make_pane(top, STR_SERIAL_NETWORK_PANE_TITLE); |
1049 |
< |
table = make_table(box, 2, 3); |
1049 |
> |
table = make_table(box, 2, 4); |
1050 |
|
|
1051 |
|
label = gtk_label_new(GetString(STR_SERIALA_CTRL)); |
1052 |
|
gtk_widget_show(label); |
1053 |
|
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4); |
1054 |
|
|
1055 |
+ |
GList *glist = add_serial_names(); |
1056 |
|
combo = gtk_combo_new(); |
1057 |
|
gtk_widget_show(combo); |
1058 |
|
gtk_combo_set_popdown_strings(GTK_COMBO(combo), glist); |
1077 |
|
gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 1, 2, (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), (GtkAttachOptions)0, 4, 4); |
1078 |
|
w_serialb = GTK_COMBO(combo)->entry; |
1079 |
|
|
1080 |
+ |
sep = gtk_hseparator_new(); |
1081 |
+ |
gtk_widget_show(sep); |
1082 |
+ |
gtk_table_attach(GTK_TABLE(table), sep, 0, 2, 2, 3, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4); |
1083 |
+ |
|
1084 |
|
label = gtk_label_new(GetString(STR_ETHERNET_IF_CTRL)); |
1085 |
|
gtk_widget_show(label); |
1086 |
< |
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4); |
1086 |
> |
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 3, 4, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4); |
1087 |
|
|
1088 |
|
glist = add_ether_names(); |
1089 |
|
combo = gtk_combo_new(); |
1093 |
|
if (str == NULL) |
1094 |
|
str = ""; |
1095 |
|
gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo)->entry), str); |
1096 |
< |
gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 2, 3, (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), (GtkAttachOptions)0, 4, 4); |
1096 |
> |
gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 3, 4, (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), (GtkAttachOptions)0, 4, 4); |
1097 |
|
w_ether = GTK_COMBO(combo)->entry; |
1098 |
+ |
|
1099 |
+ |
#if SUPPORTS_UDP_TUNNEL |
1100 |
+ |
make_checkbox(box, STR_UDPTUNNEL_CTRL, "udptunnel", GTK_SIGNAL_FUNC(tb_udptunnel)); |
1101 |
+ |
|
1102 |
+ |
hbox = gtk_hbox_new(FALSE, 4); |
1103 |
+ |
gtk_widget_show(hbox); |
1104 |
+ |
gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0); |
1105 |
+ |
|
1106 |
+ |
label = gtk_label_new(GetString(STR_UDPPORT_CTRL)); |
1107 |
+ |
gtk_widget_show(label); |
1108 |
+ |
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
1109 |
+ |
|
1110 |
+ |
adj = gtk_adjustment_new(PrefsFindInt32("udpport"), 1, 65535, 1, 5, 0); |
1111 |
+ |
w_udp_port = gtk_spin_button_new(GTK_ADJUSTMENT(adj), 0.0, 0); |
1112 |
+ |
gtk_widget_show(w_udp_port); |
1113 |
+ |
gtk_box_pack_start(GTK_BOX(hbox), w_udp_port, FALSE, FALSE, 0); |
1114 |
+ |
#endif |
1115 |
+ |
|
1116 |
+ |
set_serial_sensitive(); |
1117 |
|
} |
1118 |
|
|
1119 |
|
|
1123 |
|
|
1124 |
|
static GtkObject *w_ramsize_adj; |
1125 |
|
static GtkWidget *w_rom_file; |
930 |
– |
static GtkWidget *w_keycode_file; |
1126 |
|
|
1127 |
|
// Model ID selected |
1128 |
|
static void mn_modelid_5(...) {PrefsReplaceInt32("modelid", 5);} |
1135 |
|
static void mn_cpu_68030_fpu(...) {PrefsReplaceInt32("cpu", 3); PrefsReplaceBool("fpu", true);} |
1136 |
|
static void mn_cpu_68040(...) {PrefsReplaceInt32("cpu", 4); PrefsReplaceBool("fpu", true);} |
1137 |
|
|
943 |
– |
// "Use Raw Keycodes" button toggled |
944 |
– |
static void tb_keycodes(GtkWidget *widget) |
945 |
– |
{ |
946 |
– |
PrefsReplaceBool("keycodes", GTK_TOGGLE_BUTTON(widget)->active); |
947 |
– |
} |
948 |
– |
|
1138 |
|
// Read settings from widgets and set preferences |
1139 |
|
static void read_memory_settings(void) |
1140 |
|
{ |
1141 |
|
PrefsReplaceInt32("ramsize", int(GTK_ADJUSTMENT(w_ramsize_adj)->value) << 20); |
1142 |
|
|
1143 |
< |
const char *str = gtk_entry_get_text(GTK_ENTRY(w_rom_file)); |
1143 |
> |
const char *str = get_file_entry_path(w_rom_file); |
1144 |
|
if (str && strlen(str)) |
1145 |
|
PrefsReplaceString("rom", str); |
1146 |
|
else |
1147 |
|
PrefsRemoveItem("rom"); |
1148 |
|
|
960 |
– |
str = gtk_entry_get_text(GTK_ENTRY(w_keycode_file)); |
961 |
– |
if (str && strlen(str)) |
962 |
– |
PrefsReplaceString("keycodefile", str); |
963 |
– |
else |
964 |
– |
PrefsRemoveItem("keycodefile"); |
1149 |
|
} |
1150 |
|
|
1151 |
|
// Create "Memory/Misc" pane |
1152 |
|
static void create_memory_pane(GtkWidget *top) |
1153 |
|
{ |
1154 |
< |
GtkWidget *box, *vbox, *hbox, *hbox2, *label, *scale, *menu; |
1154 |
> |
GtkWidget *box, *hbox, *vbox, *hbox2, *label, *scale; |
1155 |
|
|
1156 |
|
box = make_pane(top, STR_MEMORY_MISC_PANE_TITLE); |
1157 |
|
|
1205 |
|
} |
1206 |
|
make_option_menu(box, STR_MODELID_CTRL, model_options, active); |
1207 |
|
|
1208 |
+ |
#if EMULATED_68K |
1209 |
|
static const opt_desc cpu_options[] = { |
1210 |
|
{STR_CPU_68020_LAB, GTK_SIGNAL_FUNC(mn_cpu_68020)}, |
1211 |
|
{STR_CPU_68020_FPU_LAB, GTK_SIGNAL_FUNC(mn_cpu_68020_fpu)}, |
1223 |
|
case 4: active = 4; |
1224 |
|
} |
1225 |
|
make_option_menu(box, STR_CPU_CTRL, cpu_options, active); |
1226 |
+ |
#endif |
1227 |
|
|
1228 |
< |
w_rom_file = make_entry(box, STR_ROM_FILE_CTRL, "rom"); |
1043 |
< |
|
1044 |
< |
make_checkbox(box, STR_KEYCODES_CTRL, "keycodes", GTK_SIGNAL_FUNC(tb_keycodes)); |
1045 |
< |
w_keycode_file = make_entry(box, STR_KEYCODE_FILE_CTRL, "keycodefile"); |
1228 |
> |
w_rom_file = make_file_entry(box, STR_ROM_FILE_CTRL, "rom"); |
1229 |
|
} |
1230 |
|
|
1231 |
|
|
1238 |
|
read_volumes_settings(); |
1239 |
|
read_scsi_settings(); |
1240 |
|
read_graphics_settings(); |
1241 |
+ |
read_input_settings(); |
1242 |
|
read_serial_settings(); |
1243 |
|
read_memory_settings(); |
1244 |
|
} |