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-2001 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 |
45 |
|
static void create_volumes_pane(GtkWidget *top); |
46 |
|
static void create_scsi_pane(GtkWidget *top); |
47 |
|
static void create_graphics_pane(GtkWidget *top); |
48 |
+ |
static void create_input_pane(GtkWidget *top); |
49 |
|
static void create_serial_pane(GtkWidget *top); |
50 |
|
static void create_memory_pane(GtkWidget *top); |
51 |
|
static void read_settings(void); |
227 |
|
{ |
228 |
|
GtkWidget *dialog, *label, *button; |
229 |
|
|
230 |
< |
char str[256]; |
231 |
< |
sprintf(str, GetString(STR_ABOUT_TEXT1), VERSION_MAJOR, VERSION_MINOR); |
232 |
< |
strncat(str, "\n", 255); |
233 |
< |
strncat(str, GetString(STR_ABOUT_TEXT2), 255); |
230 |
> |
char str[512]; |
231 |
> |
sprintf(str, |
232 |
> |
"Basilisk II\nVersion %d.%d\n\n" |
233 |
> |
"Copyright (C) 1997-2001 Christian Bauer et al.\n" |
234 |
> |
"E-mail: Christian.Bauer@uni-mainz.de\n" |
235 |
> |
"http://www.uni-mainz.de/~bauec002/B2Main.html\n\n" |
236 |
> |
"Basilisk II comes with ABSOLUTELY NO\n" |
237 |
> |
"WARRANTY. This is free software, and\n" |
238 |
> |
"you are welcome to redistribute it\n" |
239 |
> |
"under the terms of the GNU General\n" |
240 |
> |
"Public License.\n", |
241 |
> |
VERSION_MAJOR, VERSION_MINOR |
242 |
> |
); |
243 |
|
|
244 |
|
dialog = gtk_dialog_new(); |
235 |
– |
gtk_widget_set_usize(GTK_WIDGET(dialog), strlen(GetString(STR_ABOUT_TEXT2)) + 200, 120); |
245 |
|
gtk_window_set_title(GTK_WINDOW(dialog), GetString(STR_ABOUT_TITLE)); |
246 |
|
gtk_container_border_width(GTK_CONTAINER(dialog), 5); |
247 |
|
gtk_widget_set_uposition(GTK_WIDGET(dialog), 100, 150); |
267 |
|
|
268 |
|
// Menu item descriptions |
269 |
|
static GtkItemFactoryEntry menu_items[] = { |
270 |
< |
{GetString(STR_PREFS_MENU_FILE_GTK), NULL, NULL, 0, "<Branch>"}, |
271 |
< |
{GetString(STR_PREFS_ITEM_START_GTK), NULL, GTK_SIGNAL_FUNC(cb_start), 0, NULL}, |
272 |
< |
{GetString(STR_PREFS_ITEM_ZAP_PRAM_GTK), NULL, GTK_SIGNAL_FUNC(mn_zap_pram), 0, NULL}, |
273 |
< |
{GetString(STR_PREFS_ITEM_SEPL_GTK), NULL, NULL, 0, "<Separator>"}, |
274 |
< |
{GetString(STR_PREFS_ITEM_QUIT_GTK), "<control>Q", GTK_SIGNAL_FUNC(cb_quit), 0, NULL}, |
275 |
< |
{GetString(STR_HELP_MENU_GTK), NULL, NULL, 0, "<LastBranch>"}, |
276 |
< |
{GetString(STR_HELP_ITEM_ABOUT_GTK), NULL, GTK_SIGNAL_FUNC(mn_about), 0, NULL} |
270 |
> |
{(gchar *)GetString(STR_PREFS_MENU_FILE_GTK), NULL, NULL, 0, "<Branch>"}, |
271 |
> |
{(gchar *)GetString(STR_PREFS_ITEM_START_GTK), NULL, GTK_SIGNAL_FUNC(cb_start), 0, NULL}, |
272 |
> |
{(gchar *)GetString(STR_PREFS_ITEM_ZAP_PRAM_GTK), NULL, GTK_SIGNAL_FUNC(mn_zap_pram), 0, NULL}, |
273 |
> |
{(gchar *)GetString(STR_PREFS_ITEM_SEPL_GTK), NULL, NULL, 0, "<Separator>"}, |
274 |
> |
{(gchar *)GetString(STR_PREFS_ITEM_QUIT_GTK), "<control>Q", GTK_SIGNAL_FUNC(cb_quit), 0, NULL}, |
275 |
> |
{(gchar *)GetString(STR_HELP_MENU_GTK), NULL, NULL, 0, "<LastBranch>"}, |
276 |
> |
{(gchar *)GetString(STR_HELP_ITEM_ABOUT_GTK), NULL, GTK_SIGNAL_FUNC(mn_about), 0, NULL} |
277 |
|
}; |
278 |
|
|
279 |
|
bool PrefsEditor(void) |
300 |
|
GtkWidget *notebook = gtk_notebook_new(); |
301 |
|
gtk_widget_show(notebook); |
302 |
|
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook), GTK_POS_TOP); |
303 |
< |
gtk_notebook_set_scrollable(GTK_NOTEBOOK(notebook), TRUE); |
303 |
> |
gtk_notebook_set_scrollable(GTK_NOTEBOOK(notebook), FALSE); |
304 |
|
gtk_box_pack_start(GTK_BOX(box), notebook, TRUE, TRUE, 0); |
305 |
|
|
306 |
|
create_volumes_pane(notebook); |
307 |
|
create_scsi_pane(notebook); |
308 |
|
create_graphics_pane(notebook); |
309 |
+ |
create_input_pane(notebook); |
310 |
|
create_serial_pane(notebook); |
311 |
|
create_memory_pane(notebook); |
312 |
|
|
328 |
|
* "Volumes" pane |
329 |
|
*/ |
330 |
|
|
331 |
< |
static GtkWidget *volume_list; |
331 |
> |
static GtkWidget *volume_list, *w_extfs; |
332 |
|
static int selected_volume; |
333 |
|
|
334 |
|
// Volume in list selected |
410 |
|
} |
411 |
|
|
412 |
|
// "Boot From" selected |
413 |
< |
static void mn_boot_any(...) {PrefsReplaceInt16("bootdriver", 0);} |
414 |
< |
static void mn_boot_cdrom(...) {PrefsReplaceInt16("bootdriver", CDROMRefNum);} |
413 |
> |
static void mn_boot_any(...) {PrefsReplaceInt32("bootdriver", 0);} |
414 |
> |
static void mn_boot_cdrom(...) {PrefsReplaceInt32("bootdriver", CDROMRefNum);} |
415 |
|
|
416 |
|
// "No CD-ROM Driver" button toggled |
417 |
|
static void tb_nocdrom(GtkWidget *widget) |
430 |
|
gtk_clist_get_text(GTK_CLIST(volume_list), i, 0, &str); |
431 |
|
PrefsAddString("disk", str); |
432 |
|
} |
433 |
+ |
|
434 |
+ |
PrefsReplaceString("extfs", gtk_entry_get_text(GTK_ENTRY(w_extfs))); |
435 |
|
} |
436 |
|
|
437 |
|
// Create "Volumes" pane |
448 |
|
gtk_widget_show(volume_list); |
449 |
|
gtk_clist_set_selection_mode(GTK_CLIST(volume_list), GTK_SELECTION_SINGLE); |
450 |
|
gtk_clist_set_shadow_type(GTK_CLIST(volume_list), GTK_SHADOW_NONE); |
451 |
+ |
gtk_clist_set_reorderable(GTK_CLIST(volume_list), true); |
452 |
|
gtk_signal_connect(GTK_OBJECT(volume_list), "select_row", GTK_SIGNAL_FUNC(cl_selected), NULL); |
453 |
|
char *str; |
454 |
|
int32 index = 0; |
467 |
|
make_button_box(box, 0, buttons); |
468 |
|
make_separator(box); |
469 |
|
|
470 |
+ |
w_extfs = make_entry(box, STR_EXTFS_CTRL, "extfs"); |
471 |
+ |
|
472 |
|
static const opt_desc options[] = { |
473 |
|
{STR_BOOT_ANY_LAB, GTK_SIGNAL_FUNC(mn_boot_any)}, |
474 |
|
{STR_BOOT_CDROM_LAB, GTK_SIGNAL_FUNC(mn_boot_cdrom)}, |
475 |
|
{0, NULL} |
476 |
|
}; |
477 |
< |
int bootdriver = PrefsFindInt16("bootdriver"), active = 0; |
477 |
> |
int bootdriver = PrefsFindInt32("bootdriver"), active = 0; |
478 |
|
switch (bootdriver) { |
479 |
|
case 0: active = 0; break; |
480 |
|
case CDROMRefNum: active = 1; break; |
535 |
|
static int display_type; |
536 |
|
static int dis_width, dis_height; |
537 |
|
|
538 |
+ |
#ifdef ENABLE_FBDEV_DGA |
539 |
+ |
static GtkWidget *w_fbdev_name, *w_fbdevice_file; |
540 |
+ |
static GtkWidget *l_fbdev_name, *l_fbdevice_file; |
541 |
+ |
static char fbdev_name[256]; |
542 |
+ |
#endif |
543 |
+ |
|
544 |
|
// Hide/show graphics widgets |
545 |
|
static void hide_show_graphics_widgets(void) |
546 |
|
{ |
547 |
|
switch (display_type) { |
548 |
|
case DISPLAY_WINDOW: |
549 |
|
gtk_widget_show(w_frameskip); gtk_widget_show(l_frameskip); |
550 |
+ |
#ifdef ENABLE_FBDEV_DGA |
551 |
+ |
gtk_widget_show(w_display_x); gtk_widget_show(l_display_x); |
552 |
+ |
gtk_widget_show(w_display_y); gtk_widget_show(l_display_y); |
553 |
+ |
gtk_widget_hide(w_fbdev_name); gtk_widget_hide(l_fbdev_name); |
554 |
+ |
#endif |
555 |
|
break; |
556 |
|
case DISPLAY_SCREEN: |
557 |
|
gtk_widget_hide(w_frameskip); gtk_widget_hide(l_frameskip); |
558 |
+ |
#ifdef ENABLE_FBDEV_DGA |
559 |
+ |
gtk_widget_hide(w_display_x); gtk_widget_hide(l_display_x); |
560 |
+ |
gtk_widget_hide(w_display_y); gtk_widget_hide(l_display_y); |
561 |
+ |
gtk_widget_show(w_fbdev_name); gtk_widget_show(l_fbdev_name); |
562 |
+ |
#endif |
563 |
|
break; |
564 |
|
} |
565 |
|
} |
585 |
|
static void mn_15hz(...) {PrefsReplaceInt32("frameskip", 4);} |
586 |
|
static void mn_30hz(...) {PrefsReplaceInt32("frameskip", 2);} |
587 |
|
static void mn_60hz(...) {PrefsReplaceInt32("frameskip", 1);} |
588 |
+ |
static void mn_dynamic(...) {PrefsReplaceInt32("frameskip", 0);} |
589 |
|
|
590 |
|
// "Disable Sound Output" button toggled |
591 |
|
static void tb_nosound(GtkWidget *widget) |
599 |
|
display_type = DISPLAY_WINDOW; |
600 |
|
dis_width = 512; |
601 |
|
dis_height = 384; |
602 |
+ |
#ifdef ENABLE_FBDEV_DGA |
603 |
+ |
fbdev_name[0] = 0; |
604 |
+ |
#endif |
605 |
|
|
606 |
|
const char *str = PrefsFindString("screen"); |
607 |
|
if (str) { |
608 |
|
if (sscanf(str, "win/%d/%d", &dis_width, &dis_height) == 2) |
609 |
|
display_type = DISPLAY_WINDOW; |
610 |
+ |
#ifdef ENABLE_FBDEV_DGA |
611 |
+ |
else if (sscanf(str, "dga/%255s", fbdev_name) == 1) |
612 |
+ |
#else |
613 |
|
else if (sscanf(str, "dga/%d/%d", &dis_width, &dis_height) == 2) |
614 |
+ |
#endif |
615 |
|
display_type = DISPLAY_SCREEN; |
616 |
|
} |
617 |
|
} |
633 |
|
sprintf(pref, "win/%d/%d", dis_width, dis_height); |
634 |
|
break; |
635 |
|
case DISPLAY_SCREEN: |
636 |
+ |
#ifdef ENABLE_FBDEV_DGA |
637 |
+ |
str = gtk_entry_get_text(GTK_ENTRY(w_fbdev_name)); |
638 |
+ |
sprintf(pref, "dga/%s", str); |
639 |
+ |
#else |
640 |
|
sprintf(pref, "dga/%d/%d", dis_width, dis_height); |
641 |
+ |
#endif |
642 |
|
break; |
643 |
|
default: |
644 |
|
PrefsRemoveItem("screen"); |
656 |
|
parse_graphics_prefs(); |
657 |
|
|
658 |
|
box = make_pane(top, STR_GRAPHICS_SOUND_PANE_TITLE); |
659 |
< |
table = make_table(box, 2, 4); |
659 |
> |
table = make_table(box, 2, 5); |
660 |
|
|
661 |
|
label = gtk_label_new(GetString(STR_VIDEO_TYPE_CTRL)); |
662 |
|
gtk_widget_show(label); |
691 |
|
add_menu_item(menu, STR_REF_15HZ_LAB, GTK_SIGNAL_FUNC(mn_15hz)); |
692 |
|
add_menu_item(menu, STR_REF_30HZ_LAB, GTK_SIGNAL_FUNC(mn_30hz)); |
693 |
|
add_menu_item(menu, STR_REF_60HZ_LAB, GTK_SIGNAL_FUNC(mn_60hz)); |
694 |
+ |
add_menu_item(menu, STR_REF_DYNAMIC_LAB, GTK_SIGNAL_FUNC(mn_dynamic)); |
695 |
|
int frameskip = PrefsFindInt32("frameskip"); |
696 |
+ |
int item = -1; |
697 |
|
switch (frameskip) { |
698 |
< |
case 12: |
699 |
< |
gtk_menu_set_active(GTK_MENU(menu), 0); |
700 |
< |
break; |
701 |
< |
case 8: |
702 |
< |
gtk_menu_set_active(GTK_MENU(menu), 1); |
703 |
< |
break; |
704 |
< |
case 6: |
659 |
< |
gtk_menu_set_active(GTK_MENU(menu), 2); |
660 |
< |
break; |
661 |
< |
case 4: |
662 |
< |
gtk_menu_set_active(GTK_MENU(menu), 3); |
663 |
< |
break; |
664 |
< |
case 2: |
665 |
< |
gtk_menu_set_active(GTK_MENU(menu), 4); |
666 |
< |
break; |
667 |
< |
case 1: |
668 |
< |
gtk_menu_set_active(GTK_MENU(menu), 5); |
669 |
< |
break; |
698 |
> |
case 12: item = 0; break; |
699 |
> |
case 8: item = 1; break; |
700 |
> |
case 6: item = 2; break; |
701 |
> |
case 4: item = 3; break; |
702 |
> |
case 2: item = 4; break; |
703 |
> |
case 1: item = 5; break; |
704 |
> |
case 0: item = 6; break; |
705 |
|
} |
706 |
+ |
if (item >= 0) |
707 |
+ |
gtk_menu_set_active(GTK_MENU(menu), item); |
708 |
|
gtk_option_menu_set_menu(GTK_OPTION_MENU(w_frameskip), menu); |
709 |
|
gtk_table_attach(GTK_TABLE(table), w_frameskip, 1, 2, 1, 2, (GtkAttachOptions)GTK_FILL, (GtkAttachOptions)0, 4, 4); |
710 |
|
|
715 |
|
combo = gtk_combo_new(); |
716 |
|
gtk_widget_show(combo); |
717 |
|
GList *glist1 = NULL; |
718 |
< |
glist1 = g_list_append(glist1, (char *)"512"); |
719 |
< |
glist1 = g_list_append(glist1, (char *)"640"); |
720 |
< |
glist1 = g_list_append(glist1, (char *)"800"); |
721 |
< |
glist1 = g_list_append(glist1, (char *)"1024"); |
722 |
< |
glist1 = g_list_append(glist1, (char *)"MAX"); |
718 |
> |
glist1 = g_list_append(glist1, (void *)GetString(STR_SIZE_512_LAB)); |
719 |
> |
glist1 = g_list_append(glist1, (void *)GetString(STR_SIZE_640_LAB)); |
720 |
> |
glist1 = g_list_append(glist1, (void *)GetString(STR_SIZE_800_LAB)); |
721 |
> |
glist1 = g_list_append(glist1, (void *)GetString(STR_SIZE_1024_LAB)); |
722 |
> |
glist1 = g_list_append(glist1, (void *)GetString(STR_SIZE_MAX_LAB)); |
723 |
|
gtk_combo_set_popdown_strings(GTK_COMBO(combo), glist1); |
724 |
|
if (dis_width) |
725 |
|
sprintf(str, "%d", dis_width); |
726 |
|
else |
727 |
< |
strcpy(str, "MAX"); |
727 |
> |
strcpy(str, GetString(STR_SIZE_MAX_LAB)); |
728 |
|
gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo)->entry), str); |
729 |
|
gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 2, 3, (GtkAttachOptions)GTK_FILL, (GtkAttachOptions)0, 4, 4); |
730 |
|
w_display_x = GTK_COMBO(combo)->entry; |
736 |
|
combo = gtk_combo_new(); |
737 |
|
gtk_widget_show(combo); |
738 |
|
GList *glist2 = NULL; |
739 |
< |
glist2 = g_list_append(glist2, (char *)"384"); |
740 |
< |
glist2 = g_list_append(glist2, (char *)"480"); |
741 |
< |
glist2 = g_list_append(glist2, (char *)"600"); |
742 |
< |
glist2 = g_list_append(glist2, (char *)"768"); |
743 |
< |
glist2 = g_list_append(glist2, (char *)"MAX"); |
739 |
> |
glist2 = g_list_append(glist2, (void *)GetString(STR_SIZE_384_LAB)); |
740 |
> |
glist2 = g_list_append(glist2, (void *)GetString(STR_SIZE_480_LAB)); |
741 |
> |
glist2 = g_list_append(glist2, (void *)GetString(STR_SIZE_600_LAB)); |
742 |
> |
glist2 = g_list_append(glist2, (void *)GetString(STR_SIZE_768_LAB)); |
743 |
> |
glist2 = g_list_append(glist2, (void *)GetString(STR_SIZE_MAX_LAB)); |
744 |
|
gtk_combo_set_popdown_strings(GTK_COMBO(combo), glist2); |
745 |
|
if (dis_height) |
746 |
|
sprintf(str, "%d", dis_height); |
747 |
|
else |
748 |
< |
strcpy(str, "MAX"); |
748 |
> |
strcpy(str, GetString(STR_SIZE_MAX_LAB)); |
749 |
|
gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo)->entry), str); |
750 |
|
gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 3, 4, (GtkAttachOptions)GTK_FILL, (GtkAttachOptions)0, 4, 4); |
751 |
|
w_display_y = GTK_COMBO(combo)->entry; |
752 |
|
|
753 |
+ |
#ifdef ENABLE_FBDEV_DGA |
754 |
+ |
l_fbdev_name = gtk_label_new(GetString(STR_FBDEV_NAME_CTRL)); |
755 |
+ |
gtk_widget_show(l_fbdev_name); |
756 |
+ |
gtk_table_attach(GTK_TABLE(table), l_fbdev_name, 0, 1, 4, 5, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4); |
757 |
+ |
|
758 |
+ |
w_fbdev_name = gtk_entry_new(); |
759 |
+ |
gtk_widget_show(w_fbdev_name); |
760 |
+ |
gtk_entry_set_text(GTK_ENTRY(w_fbdev_name), fbdev_name); |
761 |
+ |
gtk_table_attach(GTK_TABLE(table), w_fbdev_name, 1, 2, 4, 5, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4); |
762 |
+ |
|
763 |
+ |
w_fbdevice_file = make_entry(box, STR_FBDEVICE_FILE_CTRL, "fbdevicefile"); |
764 |
+ |
#endif |
765 |
+ |
|
766 |
+ |
make_separator(box); |
767 |
|
make_checkbox(box, STR_NOSOUND_CTRL, "nosound", GTK_SIGNAL_FUNC(tb_nosound)); |
768 |
|
|
769 |
|
hide_show_graphics_widgets(); |
771 |
|
|
772 |
|
|
773 |
|
/* |
774 |
+ |
* "Input" pane |
775 |
+ |
*/ |
776 |
+ |
|
777 |
+ |
static GtkWidget *w_keycode_file; |
778 |
+ |
static GtkWidget *w_mouse_wheel_lines; |
779 |
+ |
|
780 |
+ |
// Set sensitivity of widgets |
781 |
+ |
static void set_input_sensitive(void) |
782 |
+ |
{ |
783 |
+ |
gtk_widget_set_sensitive(w_keycode_file, PrefsFindBool("keycodes")); |
784 |
+ |
gtk_widget_set_sensitive(w_mouse_wheel_lines, PrefsFindInt32("mousewheelmode") == 1); |
785 |
+ |
} |
786 |
+ |
|
787 |
+ |
// "Use Raw Keycodes" button toggled |
788 |
+ |
static void tb_keycodes(GtkWidget *widget) |
789 |
+ |
{ |
790 |
+ |
PrefsReplaceBool("keycodes", GTK_TOGGLE_BUTTON(widget)->active); |
791 |
+ |
set_input_sensitive(); |
792 |
+ |
} |
793 |
+ |
|
794 |
+ |
// "Mouse Wheel Mode" selected |
795 |
+ |
static void mn_wheel_page(...) {PrefsReplaceInt32("mousewheelmode", 0); set_input_sensitive();} |
796 |
+ |
static void mn_wheel_cursor(...) {PrefsReplaceInt32("mousewheelmode", 1); set_input_sensitive();} |
797 |
+ |
|
798 |
+ |
// Read settings from widgets and set preferences |
799 |
+ |
static void read_input_settings(void) |
800 |
+ |
{ |
801 |
+ |
const char *str = gtk_entry_get_text(GTK_ENTRY(w_keycode_file)); |
802 |
+ |
if (str && strlen(str)) |
803 |
+ |
PrefsReplaceString("keycodefile", str); |
804 |
+ |
else |
805 |
+ |
PrefsRemoveItem("keycodefile"); |
806 |
+ |
|
807 |
+ |
PrefsReplaceInt32("mousewheellines", gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(w_mouse_wheel_lines))); |
808 |
+ |
} |
809 |
+ |
|
810 |
+ |
// Create "Input" pane |
811 |
+ |
static void create_input_pane(GtkWidget *top) |
812 |
+ |
{ |
813 |
+ |
GtkWidget *box, *hbox, *menu, *label; |
814 |
+ |
GtkObject *adj; |
815 |
+ |
|
816 |
+ |
box = make_pane(top, STR_INPUT_PANE_TITLE); |
817 |
+ |
|
818 |
+ |
make_checkbox(box, STR_KEYCODES_CTRL, "keycodes", GTK_SIGNAL_FUNC(tb_keycodes)); |
819 |
+ |
w_keycode_file = make_entry(box, STR_KEYCODE_FILE_CTRL, "keycodefile"); |
820 |
+ |
|
821 |
+ |
make_separator(box); |
822 |
+ |
|
823 |
+ |
static const opt_desc options[] = { |
824 |
+ |
{STR_MOUSEWHEELMODE_PAGE_LAB, GTK_SIGNAL_FUNC(mn_wheel_page)}, |
825 |
+ |
{STR_MOUSEWHEELMODE_CURSOR_LAB, GTK_SIGNAL_FUNC(mn_wheel_cursor)}, |
826 |
+ |
{0, NULL} |
827 |
+ |
}; |
828 |
+ |
int wheelmode = PrefsFindInt32("mousewheelmode"), active = 0; |
829 |
+ |
switch (wheelmode) { |
830 |
+ |
case 0: active = 0; break; |
831 |
+ |
case 1: active = 1; break; |
832 |
+ |
} |
833 |
+ |
menu = make_option_menu(box, STR_MOUSEWHEELMODE_CTRL, options, active); |
834 |
+ |
|
835 |
+ |
hbox = gtk_hbox_new(FALSE, 4); |
836 |
+ |
gtk_widget_show(hbox); |
837 |
+ |
gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0); |
838 |
+ |
|
839 |
+ |
label = gtk_label_new(GetString(STR_MOUSEWHEELLINES_CTRL)); |
840 |
+ |
gtk_widget_show(label); |
841 |
+ |
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
842 |
+ |
|
843 |
+ |
adj = gtk_adjustment_new(PrefsFindInt32("mousewheellines"), 1, 1000, 1, 5, 0); |
844 |
+ |
w_mouse_wheel_lines = gtk_spin_button_new(GTK_ADJUSTMENT(adj), 0.0, 0); |
845 |
+ |
gtk_widget_show(w_mouse_wheel_lines); |
846 |
+ |
gtk_box_pack_start(GTK_BOX(hbox), w_mouse_wheel_lines, FALSE, FALSE, 0); |
847 |
+ |
|
848 |
+ |
set_input_sensitive(); |
849 |
+ |
} |
850 |
+ |
|
851 |
+ |
|
852 |
+ |
/* |
853 |
|
* "Serial/Network" pane |
854 |
|
*/ |
855 |
|
|
892 |
|
if (strncmp(de->d_name, "ttyS", 4) == 0 || strncmp(de->d_name, "lp", 2) == 0) { |
893 |
|
#elif defined(__FreeBSD__) |
894 |
|
if (strncmp(de->d_name, "cuaa", 4) == 0 || strncmp(de->d_name, "lpt", 3) == 0) { |
895 |
+ |
#elif defined(__NetBSD__) |
896 |
+ |
if (strncmp(de->d_name, "tty0", 4) == 0 || strncmp(de->d_name, "lpt", 3) == 0) { |
897 |
|
#elif defined(sgi) |
898 |
|
if (strncmp(de->d_name, "ttyf", 4) == 0 || strncmp(de->d_name, "plp", 3) == 0) { |
899 |
|
#else |
909 |
|
if (glist) |
910 |
|
g_list_sort(glist, gl_str_cmp); |
911 |
|
else |
912 |
< |
glist = g_list_append(glist, (char *)"<none>"); |
912 |
> |
glist = g_list_append(glist, (void *)GetString(STR_NONE_LAB)); |
913 |
|
return glist; |
914 |
|
} |
915 |
|
|
929 |
|
struct ifreq req, *ifr = ifc.ifc_req; |
930 |
|
for (int i=0; i<ifc.ifc_len; i+=sizeof(ifreq), ifr++) { |
931 |
|
req = *ifr; |
932 |
< |
#if defined(__FreeBSD__) || defined(sgi) |
932 |
> |
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(sgi) |
933 |
|
if (ioctl(s, SIOCGIFADDR, &req) == 0 && (req.ifr_addr.sa_family == ARPHRD_ETHER || req.ifr_addr.sa_family == ARPHRD_ETHER+1)) { |
934 |
< |
#else |
934 |
> |
#elif defined(__linux__) |
935 |
|
if (ioctl(s, SIOCGIFHWADDR, &req) == 0 && req.ifr_hwaddr.sa_family == ARPHRD_ETHER) { |
936 |
+ |
#else |
937 |
+ |
if (false) { |
938 |
|
#endif |
939 |
|
char *str = new char[64]; |
940 |
|
strncpy(str, ifr->ifr_name, 63); |
947 |
|
if (glist) |
948 |
|
g_list_sort(glist, gl_str_cmp); |
949 |
|
else |
950 |
< |
glist = g_list_append(glist, (char *)"<none>"); |
950 |
> |
glist = g_list_append(glist, (void *)GetString(STR_NONE_LAB)); |
951 |
|
return glist; |
952 |
|
} |
953 |
|
|
954 |
|
// Create "Serial/Network" pane |
955 |
|
static void create_serial_pane(GtkWidget *top) |
956 |
|
{ |
957 |
< |
GtkWidget *box, *table, *label, *combo; |
957 |
> |
GtkWidget *box, *table, *label, *combo, *sep; |
958 |
|
GList *glist = add_serial_names(); |
959 |
|
|
960 |
|
box = make_pane(top, STR_SERIAL_NETWORK_PANE_TITLE); |
961 |
< |
table = make_table(box, 2, 3); |
961 |
> |
table = make_table(box, 2, 4); |
962 |
|
|
963 |
|
label = gtk_label_new(GetString(STR_SERIALA_CTRL)); |
964 |
|
gtk_widget_show(label); |
988 |
|
gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 1, 2, (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), (GtkAttachOptions)0, 4, 4); |
989 |
|
w_serialb = GTK_COMBO(combo)->entry; |
990 |
|
|
991 |
+ |
sep = gtk_hseparator_new(); |
992 |
+ |
gtk_widget_show(sep); |
993 |
+ |
gtk_table_attach(GTK_TABLE(table), sep, 0, 2, 2, 3, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4); |
994 |
+ |
|
995 |
|
label = gtk_label_new(GetString(STR_ETHERNET_IF_CTRL)); |
996 |
|
gtk_widget_show(label); |
997 |
< |
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4); |
997 |
> |
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 3, 4, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4); |
998 |
|
|
999 |
|
glist = add_ether_names(); |
1000 |
|
combo = gtk_combo_new(); |
1004 |
|
if (str == NULL) |
1005 |
|
str = ""; |
1006 |
|
gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo)->entry), str); |
1007 |
< |
gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 2, 3, (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), (GtkAttachOptions)0, 4, 4); |
1007 |
> |
gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 3, 4, (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), (GtkAttachOptions)0, 4, 4); |
1008 |
|
w_ether = GTK_COMBO(combo)->entry; |
1009 |
|
} |
1010 |
|
|
1015 |
|
|
1016 |
|
static GtkObject *w_ramsize_adj; |
1017 |
|
static GtkWidget *w_rom_file; |
880 |
– |
static GtkWidget *w_keycode_file; |
1018 |
|
|
1019 |
|
// Model ID selected |
1020 |
|
static void mn_modelid_5(...) {PrefsReplaceInt32("modelid", 5);} |
1021 |
|
static void mn_modelid_14(...) {PrefsReplaceInt32("modelid", 14);} |
1022 |
|
|
1023 |
< |
// "Use Raw Keycodes" button toggled |
1024 |
< |
static void tb_keycodes(GtkWidget *widget) |
1025 |
< |
{ |
1026 |
< |
PrefsReplaceBool("keycodes", GTK_TOGGLE_BUTTON(widget)->active); |
1027 |
< |
} |
1023 |
> |
// CPU/FPU type |
1024 |
> |
static void mn_cpu_68020(...) {PrefsReplaceInt32("cpu", 2); PrefsReplaceBool("fpu", false);} |
1025 |
> |
static void mn_cpu_68020_fpu(...) {PrefsReplaceInt32("cpu", 2); PrefsReplaceBool("fpu", true);} |
1026 |
> |
static void mn_cpu_68030(...) {PrefsReplaceInt32("cpu", 3); PrefsReplaceBool("fpu", false);} |
1027 |
> |
static void mn_cpu_68030_fpu(...) {PrefsReplaceInt32("cpu", 3); PrefsReplaceBool("fpu", true);} |
1028 |
> |
static void mn_cpu_68040(...) {PrefsReplaceInt32("cpu", 4); PrefsReplaceBool("fpu", true);} |
1029 |
|
|
1030 |
|
// Read settings from widgets and set preferences |
1031 |
|
static void read_memory_settings(void) |
1038 |
|
else |
1039 |
|
PrefsRemoveItem("rom"); |
1040 |
|
|
903 |
– |
str = gtk_entry_get_text(GTK_ENTRY(w_keycode_file)); |
904 |
– |
if (str && strlen(str)) |
905 |
– |
PrefsReplaceString("keycodefile", str); |
906 |
– |
else |
907 |
– |
PrefsRemoveItem("keycodefile"); |
1041 |
|
} |
1042 |
|
|
1043 |
|
// Create "Memory/Misc" pane |
1044 |
|
static void create_memory_pane(GtkWidget *top) |
1045 |
|
{ |
1046 |
< |
GtkWidget *box, *vbox, *hbox, *hbox2, *label, *scale, *opt, *menu; |
1046 |
> |
GtkWidget *box, *hbox, *vbox, *hbox2, *label, *scale; |
1047 |
|
|
1048 |
|
box = make_pane(top, STR_MEMORY_MISC_PANE_TITLE); |
1049 |
|
|
1085 |
|
gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 0); |
1086 |
|
gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0); |
1087 |
|
|
1088 |
< |
static const opt_desc options[] = { |
1088 |
> |
static const opt_desc model_options[] = { |
1089 |
|
{STR_MODELID_5_LAB, GTK_SIGNAL_FUNC(mn_modelid_5)}, |
1090 |
|
{STR_MODELID_14_LAB, GTK_SIGNAL_FUNC(mn_modelid_14)}, |
1091 |
|
{0, NULL} |
1095 |
|
case 5: active = 0; break; |
1096 |
|
case 14: active = 1; break; |
1097 |
|
} |
1098 |
< |
menu = make_option_menu(box, STR_MODELID_CTRL, options, active); |
1098 |
> |
make_option_menu(box, STR_MODELID_CTRL, model_options, active); |
1099 |
|
|
1100 |
< |
w_rom_file = make_entry(box, STR_ROM_FILE_CTRL, "rom"); |
1100 |
> |
#if EMULATED_68K |
1101 |
> |
static const opt_desc cpu_options[] = { |
1102 |
> |
{STR_CPU_68020_LAB, GTK_SIGNAL_FUNC(mn_cpu_68020)}, |
1103 |
> |
{STR_CPU_68020_FPU_LAB, GTK_SIGNAL_FUNC(mn_cpu_68020_fpu)}, |
1104 |
> |
{STR_CPU_68030_LAB, GTK_SIGNAL_FUNC(mn_cpu_68030)}, |
1105 |
> |
{STR_CPU_68030_FPU_LAB, GTK_SIGNAL_FUNC(mn_cpu_68030_fpu)}, |
1106 |
> |
{STR_CPU_68040_LAB, GTK_SIGNAL_FUNC(mn_cpu_68040)}, |
1107 |
> |
{0, NULL} |
1108 |
> |
}; |
1109 |
> |
int cpu = PrefsFindInt32("cpu"); |
1110 |
> |
bool fpu = PrefsFindBool("fpu"); |
1111 |
> |
active = 0; |
1112 |
> |
switch (cpu) { |
1113 |
> |
case 2: active = fpu ? 1 : 0; break; |
1114 |
> |
case 3: active = fpu ? 3 : 2; break; |
1115 |
> |
case 4: active = 4; |
1116 |
> |
} |
1117 |
> |
make_option_menu(box, STR_CPU_CTRL, cpu_options, active); |
1118 |
> |
#endif |
1119 |
|
|
1120 |
< |
make_checkbox(box, STR_KEYCODES_CTRL, "keycodes", GTK_SIGNAL_FUNC(tb_keycodes)); |
970 |
< |
w_keycode_file = make_entry(box, STR_KEYCODE_FILE_CTRL, "keycodefile"); |
1120 |
> |
w_rom_file = make_entry(box, STR_ROM_FILE_CTRL, "rom"); |
1121 |
|
} |
1122 |
|
|
1123 |
|
|
1130 |
|
read_volumes_settings(); |
1131 |
|
read_scsi_settings(); |
1132 |
|
read_graphics_settings(); |
1133 |
+ |
read_input_settings(); |
1134 |
|
read_serial_settings(); |
1135 |
|
read_memory_settings(); |
1136 |
|
} |