1 |
|
/* |
2 |
|
* prefs_editor_gtk.cpp - Preferences editor, Unix implementation using GTK+ |
3 |
|
* |
4 |
< |
* Basilisk II (C) 1997-2000 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 |
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-2002 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(); |
236 |
– |
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); |
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) |
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; |
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, PrefsFindInt16("mousewheelmode") == 1); |
784 |
> |
gtk_widget_set_sensitive(w_mouse_wheel_lines, PrefsFindInt32("mousewheelmode") == 1); |
785 |
|
} |
786 |
|
|
787 |
|
// "Use Raw Keycodes" button toggled |
792 |
|
} |
793 |
|
|
794 |
|
// "Mouse Wheel Mode" selected |
795 |
< |
static void mn_wheel_page(...) {PrefsReplaceInt16("mousewheelmode", 0); set_input_sensitive();} |
796 |
< |
static void mn_wheel_cursor(...) {PrefsReplaceInt16("mousewheelmode", 1); set_input_sensitive();} |
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) |
804 |
|
else |
805 |
|
PrefsRemoveItem("keycodefile"); |
806 |
|
|
807 |
< |
PrefsReplaceInt16("mousewheellines", gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(w_mouse_wheel_lines))); |
807 |
> |
PrefsReplaceInt32("mousewheellines", gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(w_mouse_wheel_lines))); |
808 |
|
} |
809 |
|
|
810 |
|
// Create "Input" pane |
825 |
|
{STR_MOUSEWHEELMODE_CURSOR_LAB, GTK_SIGNAL_FUNC(mn_wheel_cursor)}, |
826 |
|
{0, NULL} |
827 |
|
}; |
828 |
< |
int wheelmode = PrefsFindInt16("mousewheelmode"), active = 0; |
828 |
> |
int wheelmode = PrefsFindInt32("mousewheelmode"), active = 0; |
829 |
|
switch (wheelmode) { |
830 |
|
case 0: active = 0; break; |
831 |
|
case 1: active = 1; break; |
840 |
|
gtk_widget_show(label); |
841 |
|
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
842 |
|
|
843 |
< |
adj = gtk_adjustment_new(PrefsFindInt16("mousewheellines"), 1, 1000, 1, 5, 0); |
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); |
853 |
|
* "Serial/Network" pane |
854 |
|
*/ |
855 |
|
|
856 |
< |
static GtkWidget *w_seriala, *w_serialb, *w_ether; |
856 |
> |
static GtkWidget *w_seriala, *w_serialb, *w_ether, *w_udp_port; |
857 |
> |
|
858 |
> |
// Set sensitivity of widgets |
859 |
> |
static void set_serial_sensitive(void) |
860 |
> |
{ |
861 |
> |
#if SUPPORTS_UDP_TUNNEL |
862 |
> |
gtk_widget_set_sensitive(w_ether, !PrefsFindBool("udptunnel")); |
863 |
> |
gtk_widget_set_sensitive(w_udp_port, PrefsFindBool("udptunnel")); |
864 |
> |
#endif |
865 |
> |
} |
866 |
> |
|
867 |
> |
// "Tunnel AppleTalk over IP" button toggled |
868 |
> |
static void tb_udptunnel(GtkWidget *widget) |
869 |
> |
{ |
870 |
> |
PrefsReplaceBool("udptunnel", GTK_TOGGLE_BUTTON(widget)->active); |
871 |
> |
set_serial_sensitive(); |
872 |
> |
} |
873 |
|
|
874 |
|
// Read settings from widgets and set preferences |
875 |
|
static void read_serial_settings(void) |
887 |
|
PrefsReplaceString("ether", str); |
888 |
|
else |
889 |
|
PrefsRemoveItem("ether"); |
890 |
+ |
|
891 |
+ |
#if SUPPORTS_UDP_TUNNEL |
892 |
+ |
PrefsReplaceInt32("udpport", gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(w_udp_port))); |
893 |
+ |
#endif |
894 |
|
} |
895 |
|
|
896 |
|
// Add names of serial devices |
974 |
|
// Create "Serial/Network" pane |
975 |
|
static void create_serial_pane(GtkWidget *top) |
976 |
|
{ |
977 |
< |
GtkWidget *box, *table, *label, *combo, *sep; |
978 |
< |
GList *glist = add_serial_names(); |
977 |
> |
GtkWidget *box, *hbox, *table, *label, *combo, *sep; |
978 |
> |
GtkObject *adj; |
979 |
|
|
980 |
|
box = make_pane(top, STR_SERIAL_NETWORK_PANE_TITLE); |
981 |
|
table = make_table(box, 2, 4); |
984 |
|
gtk_widget_show(label); |
985 |
|
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4); |
986 |
|
|
987 |
+ |
GList *glist = add_serial_names(); |
988 |
|
combo = gtk_combo_new(); |
989 |
|
gtk_widget_show(combo); |
990 |
|
gtk_combo_set_popdown_strings(GTK_COMBO(combo), glist); |
1027 |
|
gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo)->entry), str); |
1028 |
|
gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 3, 4, (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), (GtkAttachOptions)0, 4, 4); |
1029 |
|
w_ether = GTK_COMBO(combo)->entry; |
1030 |
+ |
|
1031 |
+ |
#if SUPPORTS_UDP_TUNNEL |
1032 |
+ |
make_checkbox(box, STR_UDPTUNNEL_CTRL, "udptunnel", GTK_SIGNAL_FUNC(tb_udptunnel)); |
1033 |
+ |
|
1034 |
+ |
hbox = gtk_hbox_new(FALSE, 4); |
1035 |
+ |
gtk_widget_show(hbox); |
1036 |
+ |
gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0); |
1037 |
+ |
|
1038 |
+ |
label = gtk_label_new(GetString(STR_UDPPORT_CTRL)); |
1039 |
+ |
gtk_widget_show(label); |
1040 |
+ |
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
1041 |
+ |
|
1042 |
+ |
adj = gtk_adjustment_new(PrefsFindInt32("udpport"), 1, 65535, 1, 5, 0); |
1043 |
+ |
w_udp_port = gtk_spin_button_new(GTK_ADJUSTMENT(adj), 0.0, 0); |
1044 |
+ |
gtk_widget_show(w_udp_port); |
1045 |
+ |
gtk_box_pack_start(GTK_BOX(hbox), w_udp_port, FALSE, FALSE, 0); |
1046 |
+ |
#endif |
1047 |
+ |
|
1048 |
+ |
set_serial_sensitive(); |
1049 |
|
} |
1050 |
|
|
1051 |
|
|
1083 |
|
// Create "Memory/Misc" pane |
1084 |
|
static void create_memory_pane(GtkWidget *top) |
1085 |
|
{ |
1086 |
< |
GtkWidget *box, *hbox, *vbox, *hbox2, *label, *scale, *menu; |
1086 |
> |
GtkWidget *box, *hbox, *vbox, *hbox2, *label, *scale; |
1087 |
|
|
1088 |
|
box = make_pane(top, STR_MEMORY_MISC_PANE_TITLE); |
1089 |
|
|