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-2005 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 create_jit_pane(GtkWidget *top); |
56 |
|
static void read_settings(void); |
57 |
|
|
58 |
|
|
65 |
|
GtkSignalFunc func; |
66 |
|
}; |
67 |
|
|
68 |
+ |
struct combo_desc { |
69 |
+ |
int label_id; |
70 |
+ |
}; |
71 |
+ |
|
72 |
|
static void add_menu_item(GtkWidget *menu, int label_id, GtkSignalFunc func) |
73 |
|
{ |
74 |
|
GtkWidget *item = gtk_menu_item_new_with_label(GetString(label_id)); |
159 |
|
return menu; |
160 |
|
} |
161 |
|
|
162 |
< |
static GtkWidget *make_entry(GtkWidget *top, int label_id, const char *prefs_item) |
162 |
> |
static GtkWidget *make_file_entry(GtkWidget *top, int label_id, const char *prefs_item, bool only_dirs = false) |
163 |
|
{ |
164 |
|
GtkWidget *box, *label, *entry; |
165 |
|
|
171 |
|
gtk_widget_show(label); |
172 |
|
gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 0); |
173 |
|
|
164 |
– |
entry = gtk_entry_new(); |
165 |
– |
gtk_widget_show(entry); |
174 |
|
const char *str = PrefsFindString(prefs_item); |
175 |
|
if (str == NULL) |
176 |
|
str = ""; |
177 |
+ |
|
178 |
+ |
#ifdef HAVE_GNOMEUI |
179 |
+ |
entry = gnome_file_entry_new(NULL, GetString(label_id)); |
180 |
+ |
if (only_dirs) |
181 |
+ |
gnome_file_entry_set_directory(GNOME_FILE_ENTRY(entry), true); |
182 |
+ |
gtk_entry_set_text(GTK_ENTRY(gnome_file_entry_gtk_entry(GNOME_FILE_ENTRY(entry))), str); |
183 |
+ |
#else |
184 |
+ |
entry = gtk_entry_new(); |
185 |
|
gtk_entry_set_text(GTK_ENTRY(entry), str); |
186 |
+ |
#endif |
187 |
+ |
gtk_widget_show(entry); |
188 |
|
gtk_box_pack_start(GTK_BOX(box), entry, TRUE, TRUE, 0); |
189 |
|
return entry; |
190 |
|
} |
191 |
|
|
192 |
+ |
static const gchar *get_file_entry_path(GtkWidget *entry) |
193 |
+ |
{ |
194 |
+ |
#ifdef HAVE_GNOMEUI |
195 |
+ |
return gnome_file_entry_get_full_path(GNOME_FILE_ENTRY(entry), false); |
196 |
+ |
#else |
197 |
+ |
return gtk_entry_get_text(GTK_ENTRY(entry)); |
198 |
+ |
#endif |
199 |
+ |
} |
200 |
+ |
|
201 |
|
static GtkWidget *make_checkbox(GtkWidget *top, int label_id, const char *prefs_item, GtkSignalFunc func) |
202 |
|
{ |
203 |
|
GtkWidget *button = gtk_check_button_new_with_label(GetString(label_id)); |
208 |
|
return button; |
209 |
|
} |
210 |
|
|
211 |
+ |
static GtkWidget *make_combobox(GtkWidget *top, int label_id, const char *prefs_item, const combo_desc *options) |
212 |
+ |
{ |
213 |
+ |
GtkWidget *box, *label, *combo; |
214 |
+ |
char str[32]; |
215 |
+ |
|
216 |
+ |
box = gtk_hbox_new(FALSE, 4); |
217 |
+ |
gtk_widget_show(box); |
218 |
+ |
gtk_box_pack_start(GTK_BOX(top), box, FALSE, FALSE, 0); |
219 |
+ |
|
220 |
+ |
label = gtk_label_new(GetString(label_id)); |
221 |
+ |
gtk_widget_show(label); |
222 |
+ |
gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 0); |
223 |
|
|
224 |
+ |
GList *glist = NULL; |
225 |
+ |
while (options->label_id) { |
226 |
+ |
glist = g_list_append(glist, (void *)GetString(options->label_id)); |
227 |
+ |
options++; |
228 |
+ |
} |
229 |
+ |
|
230 |
+ |
combo = gtk_combo_new(); |
231 |
+ |
gtk_widget_show(combo); |
232 |
+ |
gtk_combo_set_popdown_strings(GTK_COMBO(combo), glist); |
233 |
+ |
|
234 |
+ |
sprintf(str, "%d", PrefsFindInt32(prefs_item)); |
235 |
+ |
gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo)->entry), str); |
236 |
+ |
gtk_box_pack_start(GTK_BOX(box), combo, TRUE, TRUE, 0); |
237 |
+ |
|
238 |
+ |
return combo; |
239 |
+ |
} |
240 |
+ |
|
241 |
+ |
|
242 |
|
/* |
243 |
|
* Show preferences editor |
244 |
|
* Returns true when user clicked on "Start", false otherwise |
281 |
|
// "About" selected |
282 |
|
static void mn_about(...) |
283 |
|
{ |
284 |
< |
GtkWidget *dialog, *label, *button; |
284 |
> |
GtkWidget *dialog; |
285 |
> |
|
286 |
> |
#ifdef HAVE_GNOMEUI |
287 |
> |
|
288 |
> |
char version[32]; |
289 |
> |
sprintf(version, "Version %d.%d", VERSION_MAJOR, VERSION_MINOR); |
290 |
> |
const char *authors[] = { |
291 |
> |
"Christian Bauer", |
292 |
> |
"Orlando Bassotto", |
293 |
> |
"Gwenolé Beauchesne", |
294 |
> |
"Marc Chabanas", |
295 |
> |
"Marc Hellwig", |
296 |
> |
"Biill Huey", |
297 |
> |
"Brian J. Johnson", |
298 |
> |
"Jürgen Lachmann", |
299 |
> |
"Samuel Lander", |
300 |
> |
"David Lawrence", |
301 |
> |
"Lauri Pesonen", |
302 |
> |
"Bernd Schmidt", |
303 |
> |
"and others", |
304 |
> |
NULL |
305 |
> |
}; |
306 |
> |
dialog = gnome_about_new( |
307 |
> |
"Basilisk II", |
308 |
> |
version, |
309 |
> |
"Copyright (C) 1997-2004 Christian Bauer", |
310 |
> |
authors, |
311 |
> |
"Basilisk II comes with ABSOLUTELY NO WARRANTY." |
312 |
> |
"This is free software, and you are welcome to redistribute it" |
313 |
> |
"under the terms of the GNU General Public License.", |
314 |
> |
NULL |
315 |
> |
); |
316 |
> |
gnome_dialog_set_parent(GNOME_DIALOG(dialog), GTK_WINDOW(win)); |
317 |
> |
|
318 |
> |
#else |
319 |
> |
|
320 |
> |
GtkWidget *label, *button; |
321 |
|
|
322 |
< |
char str[256]; |
323 |
< |
sprintf(str, GetString(STR_ABOUT_TEXT1), VERSION_MAJOR, VERSION_MINOR); |
324 |
< |
strncat(str, "\n", 255); |
325 |
< |
strncat(str, GetString(STR_ABOUT_TEXT2), 255); |
322 |
> |
char str[512]; |
323 |
> |
sprintf(str, |
324 |
> |
"Basilisk II\nVersion %d.%d\n\n" |
325 |
> |
"Copyright (C) 1997-2004 Christian Bauer et al.\n" |
326 |
> |
"E-mail: Christian.Bauer@uni-mainz.de\n" |
327 |
> |
"http://www.uni-mainz.de/~bauec002/B2Main.html\n\n" |
328 |
> |
"Basilisk II comes with ABSOLUTELY NO\n" |
329 |
> |
"WARRANTY. This is free software, and\n" |
330 |
> |
"you are welcome to redistribute it\n" |
331 |
> |
"under the terms of the GNU General\n" |
332 |
> |
"Public License.\n", |
333 |
> |
VERSION_MAJOR, VERSION_MINOR |
334 |
> |
); |
335 |
|
|
336 |
|
dialog = gtk_dialog_new(); |
235 |
– |
gtk_widget_set_usize(GTK_WIDGET(dialog), strlen(GetString(STR_ABOUT_TEXT2)) + 200, 120); |
337 |
|
gtk_window_set_title(GTK_WINDOW(dialog), GetString(STR_ABOUT_TITLE)); |
338 |
|
gtk_container_border_width(GTK_CONTAINER(dialog), 5); |
339 |
|
gtk_widget_set_uposition(GTK_WIDGET(dialog), 100, 150); |
348 |
|
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->action_area), button, FALSE, FALSE, 0); |
349 |
|
GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); |
350 |
|
gtk_widget_grab_default(button); |
351 |
+ |
|
352 |
+ |
#endif |
353 |
+ |
|
354 |
|
gtk_widget_show(dialog); |
355 |
|
} |
356 |
|
|
362 |
|
|
363 |
|
// Menu item descriptions |
364 |
|
static GtkItemFactoryEntry menu_items[] = { |
365 |
< |
{GetString(STR_PREFS_MENU_FILE_GTK), NULL, NULL, 0, "<Branch>"}, |
366 |
< |
{GetString(STR_PREFS_ITEM_START_GTK), NULL, GTK_SIGNAL_FUNC(cb_start), 0, NULL}, |
367 |
< |
{GetString(STR_PREFS_ITEM_ZAP_PRAM_GTK), NULL, GTK_SIGNAL_FUNC(mn_zap_pram), 0, NULL}, |
368 |
< |
{GetString(STR_PREFS_ITEM_SEPL_GTK), NULL, NULL, 0, "<Separator>"}, |
369 |
< |
{GetString(STR_PREFS_ITEM_QUIT_GTK), "<control>Q", GTK_SIGNAL_FUNC(cb_quit), 0, NULL}, |
370 |
< |
{GetString(STR_HELP_MENU_GTK), NULL, NULL, 0, "<LastBranch>"}, |
371 |
< |
{GetString(STR_HELP_ITEM_ABOUT_GTK), NULL, GTK_SIGNAL_FUNC(mn_about), 0, NULL} |
365 |
> |
{(gchar *)GetString(STR_PREFS_MENU_FILE_GTK), NULL, NULL, 0, "<Branch>"}, |
366 |
> |
{(gchar *)GetString(STR_PREFS_ITEM_START_GTK), NULL, GTK_SIGNAL_FUNC(cb_start), 0, NULL}, |
367 |
> |
{(gchar *)GetString(STR_PREFS_ITEM_ZAP_PRAM_GTK), NULL, GTK_SIGNAL_FUNC(mn_zap_pram), 0, NULL}, |
368 |
> |
{(gchar *)GetString(STR_PREFS_ITEM_SEPL_GTK), NULL, NULL, 0, "<Separator>"}, |
369 |
> |
{(gchar *)GetString(STR_PREFS_ITEM_QUIT_GTK), "<control>Q", GTK_SIGNAL_FUNC(cb_quit), 0, NULL}, |
370 |
> |
{(gchar *)GetString(STR_HELP_MENU_GTK), NULL, NULL, 0, "<LastBranch>"}, |
371 |
> |
{(gchar *)GetString(STR_HELP_ITEM_ABOUT_GTK), NULL, GTK_SIGNAL_FUNC(mn_about), 0, NULL} |
372 |
|
}; |
373 |
|
|
374 |
|
bool PrefsEditor(void) |
387 |
|
GtkAccelGroup *accel_group = gtk_accel_group_new(); |
388 |
|
GtkItemFactory *item_factory = gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<main>", accel_group); |
389 |
|
gtk_item_factory_create_items(item_factory, sizeof(menu_items) / sizeof(menu_items[0]), menu_items, NULL); |
390 |
+ |
#if GTK_CHECK_VERSION(1,3,15) |
391 |
+ |
gtk_window_add_accel_group(GTK_WINDOW(win), accel_group); |
392 |
+ |
#else |
393 |
|
gtk_accel_group_attach(accel_group, GTK_OBJECT(win)); |
394 |
+ |
#endif |
395 |
|
GtkWidget *menu_bar = gtk_item_factory_get_widget(item_factory, "<main>"); |
396 |
|
gtk_widget_show(menu_bar); |
397 |
|
gtk_box_pack_start(GTK_BOX(box), menu_bar, FALSE, TRUE, 0); |
399 |
|
GtkWidget *notebook = gtk_notebook_new(); |
400 |
|
gtk_widget_show(notebook); |
401 |
|
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook), GTK_POS_TOP); |
402 |
< |
gtk_notebook_set_scrollable(GTK_NOTEBOOK(notebook), TRUE); |
402 |
> |
gtk_notebook_set_scrollable(GTK_NOTEBOOK(notebook), FALSE); |
403 |
|
gtk_box_pack_start(GTK_BOX(box), notebook, TRUE, TRUE, 0); |
404 |
|
|
405 |
|
create_volumes_pane(notebook); |
406 |
|
create_scsi_pane(notebook); |
407 |
|
create_graphics_pane(notebook); |
408 |
+ |
create_input_pane(notebook); |
409 |
|
create_serial_pane(notebook); |
410 |
|
create_memory_pane(notebook); |
411 |
+ |
create_jit_pane(notebook); |
412 |
|
|
413 |
|
static const opt_desc buttons[] = { |
414 |
|
{STR_START_BUTTON, GTK_SIGNAL_FUNC(cb_start)}, |
428 |
|
* "Volumes" pane |
429 |
|
*/ |
430 |
|
|
431 |
< |
static GtkWidget *volume_list; |
431 |
> |
static GtkWidget *volume_list, *w_extfs; |
432 |
|
static int selected_volume; |
433 |
|
|
434 |
|
// Volume in list selected |
446 |
|
// Volume selected for addition |
447 |
|
static void add_volume_ok(GtkWidget *button, file_req_assoc *assoc) |
448 |
|
{ |
449 |
< |
char *file = gtk_file_selection_get_filename(GTK_FILE_SELECTION(assoc->req)); |
449 |
> |
gchar *file = (gchar *)gtk_file_selection_get_filename(GTK_FILE_SELECTION(assoc->req)); |
450 |
|
gtk_clist_append(GTK_CLIST(volume_list), &file); |
451 |
|
gtk_widget_destroy(assoc->req); |
452 |
|
delete assoc; |
455 |
|
// Volume selected for creation |
456 |
|
static void create_volume_ok(GtkWidget *button, file_req_assoc *assoc) |
457 |
|
{ |
458 |
< |
char *file = gtk_file_selection_get_filename(GTK_FILE_SELECTION(assoc->req)); |
458 |
> |
gchar *file = (gchar *)gtk_file_selection_get_filename(GTK_FILE_SELECTION(assoc->req)); |
459 |
|
|
460 |
< |
char *str = gtk_entry_get_text(GTK_ENTRY(assoc->entry)); |
460 |
> |
const gchar *str = gtk_entry_get_text(GTK_ENTRY(assoc->entry)); |
461 |
|
int size = atoi(str); |
462 |
|
|
463 |
|
char cmd[1024]; |
510 |
|
} |
511 |
|
|
512 |
|
// "Boot From" selected |
513 |
< |
static void mn_boot_any(...) {PrefsReplaceInt16("bootdriver", 0);} |
514 |
< |
static void mn_boot_cdrom(...) {PrefsReplaceInt16("bootdriver", CDROMRefNum);} |
513 |
> |
static void mn_boot_any(...) {PrefsReplaceInt32("bootdriver", 0);} |
514 |
> |
static void mn_boot_cdrom(...) {PrefsReplaceInt32("bootdriver", CDROMRefNum);} |
515 |
|
|
516 |
|
// "No CD-ROM Driver" button toggled |
517 |
|
static void tb_nocdrom(GtkWidget *widget) |
530 |
|
gtk_clist_get_text(GTK_CLIST(volume_list), i, 0, &str); |
531 |
|
PrefsAddString("disk", str); |
532 |
|
} |
533 |
+ |
|
534 |
+ |
PrefsReplaceString("extfs", get_file_entry_path(w_extfs)); |
535 |
|
} |
536 |
|
|
537 |
|
// Create "Volumes" pane |
548 |
|
gtk_widget_show(volume_list); |
549 |
|
gtk_clist_set_selection_mode(GTK_CLIST(volume_list), GTK_SELECTION_SINGLE); |
550 |
|
gtk_clist_set_shadow_type(GTK_CLIST(volume_list), GTK_SHADOW_NONE); |
551 |
+ |
gtk_clist_set_reorderable(GTK_CLIST(volume_list), true); |
552 |
|
gtk_signal_connect(GTK_OBJECT(volume_list), "select_row", GTK_SIGNAL_FUNC(cl_selected), NULL); |
553 |
|
char *str; |
554 |
|
int32 index = 0; |
555 |
< |
while ((str = (char *)PrefsFindString("disk", index++)) != NULL) |
555 |
> |
while ((str = const_cast<char *>(PrefsFindString("disk", index++))) != NULL) |
556 |
|
gtk_clist_append(GTK_CLIST(volume_list), &str); |
557 |
|
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scroll), volume_list); |
558 |
|
gtk_box_pack_start(GTK_BOX(box), scroll, TRUE, TRUE, 0); |
567 |
|
make_button_box(box, 0, buttons); |
568 |
|
make_separator(box); |
569 |
|
|
570 |
+ |
w_extfs = make_file_entry(box, STR_EXTFS_CTRL, "extfs", true); |
571 |
+ |
|
572 |
|
static const opt_desc options[] = { |
573 |
|
{STR_BOOT_ANY_LAB, GTK_SIGNAL_FUNC(mn_boot_any)}, |
574 |
|
{STR_BOOT_CDROM_LAB, GTK_SIGNAL_FUNC(mn_boot_cdrom)}, |
575 |
|
{0, NULL} |
576 |
|
}; |
577 |
< |
int bootdriver = PrefsFindInt16("bootdriver"), active = 0; |
577 |
> |
int bootdriver = PrefsFindInt32("bootdriver"), active = 0; |
578 |
|
switch (bootdriver) { |
579 |
|
case 0: active = 0; break; |
580 |
|
case CDROMRefNum: active = 1; break; |
586 |
|
|
587 |
|
|
588 |
|
/* |
589 |
+ |
* "JIT Compiler" pane |
590 |
+ |
*/ |
591 |
+ |
|
592 |
+ |
static GtkWidget *w_jit_fpu; |
593 |
+ |
static GtkWidget *w_jit_atraps; |
594 |
+ |
static GtkWidget *w_jit_cache_size; |
595 |
+ |
static GtkWidget *w_jit_lazy_flush; |
596 |
+ |
static GtkWidget *w_jit_follow_const_jumps; |
597 |
+ |
|
598 |
+ |
// Set sensitivity of widgets |
599 |
+ |
static void set_jit_sensitive(void) |
600 |
+ |
{ |
601 |
+ |
const bool jit_enabled = PrefsFindBool("jit"); |
602 |
+ |
gtk_widget_set_sensitive(w_jit_fpu, jit_enabled); |
603 |
+ |
gtk_widget_set_sensitive(w_jit_cache_size, jit_enabled); |
604 |
+ |
gtk_widget_set_sensitive(w_jit_lazy_flush, jit_enabled); |
605 |
+ |
gtk_widget_set_sensitive(w_jit_follow_const_jumps, jit_enabled); |
606 |
+ |
} |
607 |
+ |
|
608 |
+ |
// "Use JIT Compiler" button toggled |
609 |
+ |
static void tb_jit(GtkWidget *widget) |
610 |
+ |
{ |
611 |
+ |
PrefsReplaceBool("jit", GTK_TOGGLE_BUTTON(widget)->active); |
612 |
+ |
set_jit_sensitive(); |
613 |
+ |
} |
614 |
+ |
|
615 |
+ |
// "Compile FPU Instructions" button toggled |
616 |
+ |
static void tb_jit_fpu(GtkWidget *widget) |
617 |
+ |
{ |
618 |
+ |
PrefsReplaceBool("jitfpu", GTK_TOGGLE_BUTTON(widget)->active); |
619 |
+ |
} |
620 |
+ |
|
621 |
+ |
// "Lazy translation cache invalidation" button toggled |
622 |
+ |
static void tb_jit_lazy_flush(GtkWidget *widget) |
623 |
+ |
{ |
624 |
+ |
PrefsReplaceBool("jitlazyflush", GTK_TOGGLE_BUTTON(widget)->active); |
625 |
+ |
} |
626 |
+ |
|
627 |
+ |
// "Translate through constant jumps (inline blocks)" button toggled |
628 |
+ |
static void tb_jit_follow_const_jumps(GtkWidget *widget) |
629 |
+ |
{ |
630 |
+ |
PrefsReplaceBool("jitinline", GTK_TOGGLE_BUTTON(widget)->active); |
631 |
+ |
} |
632 |
+ |
|
633 |
+ |
// Read settings from widgets and set preferences |
634 |
+ |
static void read_jit_settings(void) |
635 |
+ |
{ |
636 |
+ |
#if USE_JIT |
637 |
+ |
bool jit_enabled = PrefsFindBool("jit"); |
638 |
+ |
if (jit_enabled) { |
639 |
+ |
const char *str = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(w_jit_cache_size)->entry)); |
640 |
+ |
PrefsReplaceInt32("jitcachesize", atoi(str)); |
641 |
+ |
} |
642 |
+ |
#endif |
643 |
+ |
} |
644 |
+ |
|
645 |
+ |
// Create "JIT Compiler" pane |
646 |
+ |
static void create_jit_pane(GtkWidget *top) |
647 |
+ |
{ |
648 |
+ |
#if USE_JIT |
649 |
+ |
GtkWidget *box, *table, *label, *menu; |
650 |
+ |
char str[32]; |
651 |
+ |
|
652 |
+ |
box = make_pane(top, STR_JIT_PANE_TITLE); |
653 |
+ |
make_checkbox(box, STR_JIT_CTRL, "jit", GTK_SIGNAL_FUNC(tb_jit)); |
654 |
+ |
|
655 |
+ |
w_jit_fpu = make_checkbox(box, STR_JIT_FPU_CTRL, "jitfpu", GTK_SIGNAL_FUNC(tb_jit_fpu)); |
656 |
+ |
|
657 |
+ |
// Translation cache size |
658 |
+ |
static const combo_desc options[] = { |
659 |
+ |
STR_JIT_CACHE_SIZE_2MB_LAB, |
660 |
+ |
STR_JIT_CACHE_SIZE_4MB_LAB, |
661 |
+ |
STR_JIT_CACHE_SIZE_8MB_LAB, |
662 |
+ |
STR_JIT_CACHE_SIZE_16MB_LAB, |
663 |
+ |
0 |
664 |
+ |
}; |
665 |
+ |
w_jit_cache_size = make_combobox(box, STR_JIT_CACHE_SIZE_CTRL, "jitcachesize", options); |
666 |
+ |
|
667 |
+ |
// Lazy translation cache invalidation |
668 |
+ |
w_jit_lazy_flush = make_checkbox(box, STR_JIT_LAZY_CINV_CTRL, "jitlazyflush", GTK_SIGNAL_FUNC(tb_jit_lazy_flush)); |
669 |
+ |
|
670 |
+ |
// Follow constant jumps (inline basic blocks) |
671 |
+ |
w_jit_follow_const_jumps = make_checkbox(box, STR_JIT_FOLLOW_CONST_JUMPS, "jitinline", GTK_SIGNAL_FUNC(tb_jit_follow_const_jumps)); |
672 |
+ |
|
673 |
+ |
set_jit_sensitive(); |
674 |
+ |
#endif |
675 |
+ |
} |
676 |
+ |
|
677 |
+ |
/* |
678 |
|
* "SCSI" pane |
679 |
|
*/ |
680 |
|
|
686 |
|
for (int id=0; id<7; id++) { |
687 |
|
char prefs_name[32]; |
688 |
|
sprintf(prefs_name, "scsi%d", id); |
689 |
< |
const char *str = gtk_entry_get_text(GTK_ENTRY(w_scsi[id])); |
689 |
> |
const char *str = get_file_entry_path(w_scsi[id]); |
690 |
|
if (str && strlen(str)) |
691 |
|
PrefsReplaceString(prefs_name, str); |
692 |
|
else |
704 |
|
for (int id=0; id<7; id++) { |
705 |
|
char prefs_name[32]; |
706 |
|
sprintf(prefs_name, "scsi%d", id); |
707 |
< |
w_scsi[id] = make_entry(box, STR_SCSI_ID_0 + id, prefs_name); |
707 |
> |
w_scsi[id] = make_file_entry(box, STR_SCSI_ID_0 + id, prefs_name); |
708 |
|
} |
709 |
|
} |
710 |
|
|
724 |
|
static int display_type; |
725 |
|
static int dis_width, dis_height; |
726 |
|
|
727 |
+ |
#ifdef ENABLE_FBDEV_DGA |
728 |
+ |
static GtkWidget *w_fbdev_name, *w_fbdevice_file; |
729 |
+ |
static GtkWidget *l_fbdev_name, *l_fbdevice_file; |
730 |
+ |
static char fbdev_name[256]; |
731 |
+ |
#endif |
732 |
+ |
|
733 |
+ |
static GtkWidget *w_dspdevice_file, *w_mixerdevice_file; |
734 |
+ |
|
735 |
|
// Hide/show graphics widgets |
736 |
|
static void hide_show_graphics_widgets(void) |
737 |
|
{ |
738 |
|
switch (display_type) { |
739 |
|
case DISPLAY_WINDOW: |
740 |
|
gtk_widget_show(w_frameskip); gtk_widget_show(l_frameskip); |
741 |
+ |
#ifdef ENABLE_FBDEV_DGA |
742 |
+ |
gtk_widget_show(w_display_x); gtk_widget_show(l_display_x); |
743 |
+ |
gtk_widget_show(w_display_y); gtk_widget_show(l_display_y); |
744 |
+ |
gtk_widget_hide(w_fbdev_name); gtk_widget_hide(l_fbdev_name); |
745 |
+ |
#endif |
746 |
|
break; |
747 |
|
case DISPLAY_SCREEN: |
748 |
|
gtk_widget_hide(w_frameskip); gtk_widget_hide(l_frameskip); |
749 |
+ |
#ifdef ENABLE_FBDEV_DGA |
750 |
+ |
gtk_widget_hide(w_display_x); gtk_widget_hide(l_display_x); |
751 |
+ |
gtk_widget_hide(w_display_y); gtk_widget_hide(l_display_y); |
752 |
+ |
gtk_widget_show(w_fbdev_name); gtk_widget_show(l_fbdev_name); |
753 |
+ |
#endif |
754 |
|
break; |
755 |
|
} |
756 |
|
} |
776 |
|
static void mn_15hz(...) {PrefsReplaceInt32("frameskip", 4);} |
777 |
|
static void mn_30hz(...) {PrefsReplaceInt32("frameskip", 2);} |
778 |
|
static void mn_60hz(...) {PrefsReplaceInt32("frameskip", 1);} |
779 |
+ |
static void mn_dynamic(...) {PrefsReplaceInt32("frameskip", 0);} |
780 |
+ |
|
781 |
+ |
// Set sensitivity of widgets |
782 |
+ |
static void set_graphics_sensitive(void) |
783 |
+ |
{ |
784 |
+ |
const bool sound_enabled = !PrefsFindBool("nosound"); |
785 |
+ |
gtk_widget_set_sensitive(w_dspdevice_file, sound_enabled); |
786 |
+ |
gtk_widget_set_sensitive(w_mixerdevice_file, sound_enabled); |
787 |
+ |
} |
788 |
|
|
789 |
|
// "Disable Sound Output" button toggled |
790 |
|
static void tb_nosound(GtkWidget *widget) |
791 |
|
{ |
792 |
|
PrefsReplaceBool("nosound", GTK_TOGGLE_BUTTON(widget)->active); |
793 |
+ |
set_graphics_sensitive(); |
794 |
|
} |
795 |
|
|
796 |
|
// Read graphics preferences |
799 |
|
display_type = DISPLAY_WINDOW; |
800 |
|
dis_width = 512; |
801 |
|
dis_height = 384; |
802 |
+ |
#ifdef ENABLE_FBDEV_DGA |
803 |
+ |
fbdev_name[0] = 0; |
804 |
+ |
#endif |
805 |
|
|
806 |
|
const char *str = PrefsFindString("screen"); |
807 |
|
if (str) { |
808 |
|
if (sscanf(str, "win/%d/%d", &dis_width, &dis_height) == 2) |
809 |
|
display_type = DISPLAY_WINDOW; |
810 |
+ |
#ifdef ENABLE_FBDEV_DGA |
811 |
+ |
else if (sscanf(str, "dga/%255s", fbdev_name) == 1) |
812 |
+ |
#else |
813 |
|
else if (sscanf(str, "dga/%d/%d", &dis_width, &dis_height) == 2) |
814 |
+ |
#endif |
815 |
|
display_type = DISPLAY_SCREEN; |
816 |
|
} |
817 |
|
} |
833 |
|
sprintf(pref, "win/%d/%d", dis_width, dis_height); |
834 |
|
break; |
835 |
|
case DISPLAY_SCREEN: |
836 |
+ |
#ifdef ENABLE_FBDEV_DGA |
837 |
+ |
str = gtk_entry_get_text(GTK_ENTRY(w_fbdev_name)); |
838 |
+ |
sprintf(pref, "dga/%s", str); |
839 |
+ |
#else |
840 |
|
sprintf(pref, "dga/%d/%d", dis_width, dis_height); |
841 |
+ |
#endif |
842 |
|
break; |
843 |
|
default: |
844 |
|
PrefsRemoveItem("screen"); |
845 |
|
return; |
846 |
|
} |
847 |
|
PrefsReplaceString("screen", pref); |
848 |
+ |
|
849 |
+ |
#ifdef ENABLE_FBDEV_DGA |
850 |
+ |
str = get_file_entry_path(w_fbdevice_file); |
851 |
+ |
if (str && strlen(str)) |
852 |
+ |
PrefsReplaceString("fbdevicefile", str); |
853 |
+ |
else |
854 |
+ |
PrefsRemoveItem("fbdevicefile"); |
855 |
+ |
#endif |
856 |
+ |
PrefsReplaceString("dsp", get_file_entry_path(w_dspdevice_file)); |
857 |
+ |
PrefsReplaceString("mixer", get_file_entry_path(w_mixerdevice_file)); |
858 |
|
} |
859 |
|
|
860 |
|
// Create "Graphics/Sound" pane |
866 |
|
parse_graphics_prefs(); |
867 |
|
|
868 |
|
box = make_pane(top, STR_GRAPHICS_SOUND_PANE_TITLE); |
869 |
< |
table = make_table(box, 2, 4); |
869 |
> |
table = make_table(box, 2, 5); |
870 |
|
|
871 |
|
label = gtk_label_new(GetString(STR_VIDEO_TYPE_CTRL)); |
872 |
|
gtk_widget_show(label); |
901 |
|
add_menu_item(menu, STR_REF_15HZ_LAB, GTK_SIGNAL_FUNC(mn_15hz)); |
902 |
|
add_menu_item(menu, STR_REF_30HZ_LAB, GTK_SIGNAL_FUNC(mn_30hz)); |
903 |
|
add_menu_item(menu, STR_REF_60HZ_LAB, GTK_SIGNAL_FUNC(mn_60hz)); |
904 |
+ |
add_menu_item(menu, STR_REF_DYNAMIC_LAB, GTK_SIGNAL_FUNC(mn_dynamic)); |
905 |
|
int frameskip = PrefsFindInt32("frameskip"); |
906 |
+ |
int item = -1; |
907 |
|
switch (frameskip) { |
908 |
< |
case 12: |
909 |
< |
gtk_menu_set_active(GTK_MENU(menu), 0); |
910 |
< |
break; |
911 |
< |
case 8: |
912 |
< |
gtk_menu_set_active(GTK_MENU(menu), 1); |
913 |
< |
break; |
914 |
< |
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; |
908 |
> |
case 12: item = 0; break; |
909 |
> |
case 8: item = 1; break; |
910 |
> |
case 6: item = 2; break; |
911 |
> |
case 4: item = 3; break; |
912 |
> |
case 2: item = 4; break; |
913 |
> |
case 1: item = 5; break; |
914 |
> |
case 0: item = 6; break; |
915 |
|
} |
916 |
+ |
if (item >= 0) |
917 |
+ |
gtk_menu_set_active(GTK_MENU(menu), item); |
918 |
|
gtk_option_menu_set_menu(GTK_OPTION_MENU(w_frameskip), menu); |
919 |
|
gtk_table_attach(GTK_TABLE(table), w_frameskip, 1, 2, 1, 2, (GtkAttachOptions)GTK_FILL, (GtkAttachOptions)0, 4, 4); |
920 |
|
|
925 |
|
combo = gtk_combo_new(); |
926 |
|
gtk_widget_show(combo); |
927 |
|
GList *glist1 = NULL; |
928 |
< |
glist1 = g_list_append(glist1, (char *)"512"); |
929 |
< |
glist1 = g_list_append(glist1, (char *)"640"); |
930 |
< |
glist1 = g_list_append(glist1, (char *)"800"); |
931 |
< |
glist1 = g_list_append(glist1, (char *)"1024"); |
932 |
< |
glist1 = g_list_append(glist1, (char *)"MAX"); |
928 |
> |
glist1 = g_list_append(glist1, (void *)GetString(STR_SIZE_512_LAB)); |
929 |
> |
glist1 = g_list_append(glist1, (void *)GetString(STR_SIZE_640_LAB)); |
930 |
> |
glist1 = g_list_append(glist1, (void *)GetString(STR_SIZE_800_LAB)); |
931 |
> |
glist1 = g_list_append(glist1, (void *)GetString(STR_SIZE_1024_LAB)); |
932 |
> |
glist1 = g_list_append(glist1, (void *)GetString(STR_SIZE_MAX_LAB)); |
933 |
|
gtk_combo_set_popdown_strings(GTK_COMBO(combo), glist1); |
934 |
|
if (dis_width) |
935 |
|
sprintf(str, "%d", dis_width); |
936 |
|
else |
937 |
< |
strcpy(str, "MAX"); |
937 |
> |
strcpy(str, GetString(STR_SIZE_MAX_LAB)); |
938 |
|
gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo)->entry), str); |
939 |
|
gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 2, 3, (GtkAttachOptions)GTK_FILL, (GtkAttachOptions)0, 4, 4); |
940 |
|
w_display_x = GTK_COMBO(combo)->entry; |
946 |
|
combo = gtk_combo_new(); |
947 |
|
gtk_widget_show(combo); |
948 |
|
GList *glist2 = NULL; |
949 |
< |
glist2 = g_list_append(glist2, (char *)"384"); |
950 |
< |
glist2 = g_list_append(glist2, (char *)"480"); |
951 |
< |
glist2 = g_list_append(glist2, (char *)"600"); |
952 |
< |
glist2 = g_list_append(glist2, (char *)"768"); |
953 |
< |
glist2 = g_list_append(glist2, (char *)"MAX"); |
949 |
> |
glist2 = g_list_append(glist2, (void *)GetString(STR_SIZE_384_LAB)); |
950 |
> |
glist2 = g_list_append(glist2, (void *)GetString(STR_SIZE_480_LAB)); |
951 |
> |
glist2 = g_list_append(glist2, (void *)GetString(STR_SIZE_600_LAB)); |
952 |
> |
glist2 = g_list_append(glist2, (void *)GetString(STR_SIZE_768_LAB)); |
953 |
> |
glist2 = g_list_append(glist2, (void *)GetString(STR_SIZE_MAX_LAB)); |
954 |
|
gtk_combo_set_popdown_strings(GTK_COMBO(combo), glist2); |
955 |
|
if (dis_height) |
956 |
|
sprintf(str, "%d", dis_height); |
957 |
|
else |
958 |
< |
strcpy(str, "MAX"); |
958 |
> |
strcpy(str, GetString(STR_SIZE_MAX_LAB)); |
959 |
|
gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo)->entry), str); |
960 |
|
gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 3, 4, (GtkAttachOptions)GTK_FILL, (GtkAttachOptions)0, 4, 4); |
961 |
|
w_display_y = GTK_COMBO(combo)->entry; |
962 |
|
|
963 |
+ |
#ifdef ENABLE_FBDEV_DGA |
964 |
+ |
l_fbdev_name = gtk_label_new(GetString(STR_FBDEV_NAME_CTRL)); |
965 |
+ |
gtk_widget_show(l_fbdev_name); |
966 |
+ |
gtk_table_attach(GTK_TABLE(table), l_fbdev_name, 0, 1, 4, 5, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4); |
967 |
+ |
|
968 |
+ |
w_fbdev_name = gtk_entry_new(); |
969 |
+ |
gtk_widget_show(w_fbdev_name); |
970 |
+ |
gtk_entry_set_text(GTK_ENTRY(w_fbdev_name), fbdev_name); |
971 |
+ |
gtk_table_attach(GTK_TABLE(table), w_fbdev_name, 1, 2, 4, 5, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4); |
972 |
+ |
|
973 |
+ |
w_fbdevice_file = make_file_entry(box, STR_FBDEVICE_FILE_CTRL, "fbdevicefile"); |
974 |
+ |
#endif |
975 |
+ |
|
976 |
+ |
make_separator(box); |
977 |
|
make_checkbox(box, STR_NOSOUND_CTRL, "nosound", GTK_SIGNAL_FUNC(tb_nosound)); |
978 |
+ |
w_dspdevice_file = make_file_entry(box, STR_DSPDEVICE_FILE_CTRL, "dsp"); |
979 |
+ |
w_mixerdevice_file = make_file_entry(box, STR_MIXERDEVICE_FILE_CTRL, "mixer"); |
980 |
+ |
|
981 |
+ |
set_graphics_sensitive(); |
982 |
|
|
983 |
|
hide_show_graphics_widgets(); |
984 |
|
} |
985 |
|
|
986 |
|
|
987 |
|
/* |
988 |
+ |
* "Input" pane |
989 |
+ |
*/ |
990 |
+ |
|
991 |
+ |
static GtkWidget *w_keycode_file; |
992 |
+ |
static GtkWidget *w_mouse_wheel_lines; |
993 |
+ |
|
994 |
+ |
// Set sensitivity of widgets |
995 |
+ |
static void set_input_sensitive(void) |
996 |
+ |
{ |
997 |
+ |
gtk_widget_set_sensitive(w_keycode_file, PrefsFindBool("keycodes")); |
998 |
+ |
gtk_widget_set_sensitive(w_mouse_wheel_lines, PrefsFindInt32("mousewheelmode") == 1); |
999 |
+ |
} |
1000 |
+ |
|
1001 |
+ |
// "Use Raw Keycodes" button toggled |
1002 |
+ |
static void tb_keycodes(GtkWidget *widget) |
1003 |
+ |
{ |
1004 |
+ |
PrefsReplaceBool("keycodes", GTK_TOGGLE_BUTTON(widget)->active); |
1005 |
+ |
set_input_sensitive(); |
1006 |
+ |
} |
1007 |
+ |
|
1008 |
+ |
// "Mouse Wheel Mode" selected |
1009 |
+ |
static void mn_wheel_page(...) {PrefsReplaceInt32("mousewheelmode", 0); set_input_sensitive();} |
1010 |
+ |
static void mn_wheel_cursor(...) {PrefsReplaceInt32("mousewheelmode", 1); set_input_sensitive();} |
1011 |
+ |
|
1012 |
+ |
// Read settings from widgets and set preferences |
1013 |
+ |
static void read_input_settings(void) |
1014 |
+ |
{ |
1015 |
+ |
const char *str = get_file_entry_path(w_keycode_file); |
1016 |
+ |
if (str && strlen(str)) |
1017 |
+ |
PrefsReplaceString("keycodefile", str); |
1018 |
+ |
else |
1019 |
+ |
PrefsRemoveItem("keycodefile"); |
1020 |
+ |
|
1021 |
+ |
PrefsReplaceInt32("mousewheellines", gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(w_mouse_wheel_lines))); |
1022 |
+ |
} |
1023 |
+ |
|
1024 |
+ |
// Create "Input" pane |
1025 |
+ |
static void create_input_pane(GtkWidget *top) |
1026 |
+ |
{ |
1027 |
+ |
GtkWidget *box, *hbox, *menu, *label; |
1028 |
+ |
GtkObject *adj; |
1029 |
+ |
|
1030 |
+ |
box = make_pane(top, STR_INPUT_PANE_TITLE); |
1031 |
+ |
|
1032 |
+ |
make_checkbox(box, STR_KEYCODES_CTRL, "keycodes", GTK_SIGNAL_FUNC(tb_keycodes)); |
1033 |
+ |
w_keycode_file = make_file_entry(box, STR_KEYCODE_FILE_CTRL, "keycodefile"); |
1034 |
+ |
|
1035 |
+ |
make_separator(box); |
1036 |
+ |
|
1037 |
+ |
static const opt_desc options[] = { |
1038 |
+ |
{STR_MOUSEWHEELMODE_PAGE_LAB, GTK_SIGNAL_FUNC(mn_wheel_page)}, |
1039 |
+ |
{STR_MOUSEWHEELMODE_CURSOR_LAB, GTK_SIGNAL_FUNC(mn_wheel_cursor)}, |
1040 |
+ |
{0, NULL} |
1041 |
+ |
}; |
1042 |
+ |
int wheelmode = PrefsFindInt32("mousewheelmode"), active = 0; |
1043 |
+ |
switch (wheelmode) { |
1044 |
+ |
case 0: active = 0; break; |
1045 |
+ |
case 1: active = 1; break; |
1046 |
+ |
} |
1047 |
+ |
menu = make_option_menu(box, STR_MOUSEWHEELMODE_CTRL, options, active); |
1048 |
+ |
|
1049 |
+ |
hbox = gtk_hbox_new(FALSE, 4); |
1050 |
+ |
gtk_widget_show(hbox); |
1051 |
+ |
gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0); |
1052 |
+ |
|
1053 |
+ |
label = gtk_label_new(GetString(STR_MOUSEWHEELLINES_CTRL)); |
1054 |
+ |
gtk_widget_show(label); |
1055 |
+ |
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
1056 |
+ |
|
1057 |
+ |
adj = gtk_adjustment_new(PrefsFindInt32("mousewheellines"), 1, 1000, 1, 5, 0); |
1058 |
+ |
w_mouse_wheel_lines = gtk_spin_button_new(GTK_ADJUSTMENT(adj), 0.0, 0); |
1059 |
+ |
gtk_widget_show(w_mouse_wheel_lines); |
1060 |
+ |
gtk_box_pack_start(GTK_BOX(hbox), w_mouse_wheel_lines, FALSE, FALSE, 0); |
1061 |
+ |
|
1062 |
+ |
set_input_sensitive(); |
1063 |
+ |
} |
1064 |
+ |
|
1065 |
+ |
|
1066 |
+ |
/* |
1067 |
|
* "Serial/Network" pane |
1068 |
|
*/ |
1069 |
|
|
1070 |
< |
static GtkWidget *w_seriala, *w_serialb, *w_ether; |
1070 |
> |
static GtkWidget *w_seriala, *w_serialb, *w_ether, *w_udp_port; |
1071 |
> |
|
1072 |
> |
// Set sensitivity of widgets |
1073 |
> |
static void set_serial_sensitive(void) |
1074 |
> |
{ |
1075 |
> |
#if SUPPORTS_UDP_TUNNEL |
1076 |
> |
gtk_widget_set_sensitive(w_ether, !PrefsFindBool("udptunnel")); |
1077 |
> |
gtk_widget_set_sensitive(w_udp_port, PrefsFindBool("udptunnel")); |
1078 |
> |
#endif |
1079 |
> |
} |
1080 |
> |
|
1081 |
> |
// "Tunnel AppleTalk over IP" button toggled |
1082 |
> |
static void tb_udptunnel(GtkWidget *widget) |
1083 |
> |
{ |
1084 |
> |
PrefsReplaceBool("udptunnel", GTK_TOGGLE_BUTTON(widget)->active); |
1085 |
> |
set_serial_sensitive(); |
1086 |
> |
} |
1087 |
|
|
1088 |
|
// Read settings from widgets and set preferences |
1089 |
|
static void read_serial_settings(void) |
1101 |
|
PrefsReplaceString("ether", str); |
1102 |
|
else |
1103 |
|
PrefsRemoveItem("ether"); |
1104 |
+ |
|
1105 |
+ |
#if SUPPORTS_UDP_TUNNEL |
1106 |
+ |
PrefsReplaceInt32("udpport", gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(w_udp_port))); |
1107 |
+ |
#endif |
1108 |
|
} |
1109 |
|
|
1110 |
|
// Add names of serial devices |
1126 |
|
if (strncmp(de->d_name, "ttyS", 4) == 0 || strncmp(de->d_name, "lp", 2) == 0) { |
1127 |
|
#elif defined(__FreeBSD__) |
1128 |
|
if (strncmp(de->d_name, "cuaa", 4) == 0 || strncmp(de->d_name, "lpt", 3) == 0) { |
1129 |
+ |
#elif defined(__NetBSD__) |
1130 |
+ |
if (strncmp(de->d_name, "tty0", 4) == 0 || strncmp(de->d_name, "lpt", 3) == 0) { |
1131 |
|
#elif defined(sgi) |
1132 |
|
if (strncmp(de->d_name, "ttyf", 4) == 0 || strncmp(de->d_name, "plp", 3) == 0) { |
1133 |
|
#else |
1143 |
|
if (glist) |
1144 |
|
g_list_sort(glist, gl_str_cmp); |
1145 |
|
else |
1146 |
< |
glist = g_list_append(glist, (char *)"<none>"); |
1146 |
> |
glist = g_list_append(glist, (void *)GetString(STR_NONE_LAB)); |
1147 |
|
return glist; |
1148 |
|
} |
1149 |
|
|
1163 |
|
struct ifreq req, *ifr = ifc.ifc_req; |
1164 |
|
for (int i=0; i<ifc.ifc_len; i+=sizeof(ifreq), ifr++) { |
1165 |
|
req = *ifr; |
1166 |
< |
#if defined(__FreeBSD__) || defined(sgi) |
1166 |
> |
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(sgi) |
1167 |
|
if (ioctl(s, SIOCGIFADDR, &req) == 0 && (req.ifr_addr.sa_family == ARPHRD_ETHER || req.ifr_addr.sa_family == ARPHRD_ETHER+1)) { |
1168 |
< |
#else |
1168 |
> |
#elif defined(__linux__) |
1169 |
|
if (ioctl(s, SIOCGIFHWADDR, &req) == 0 && req.ifr_hwaddr.sa_family == ARPHRD_ETHER) { |
1170 |
+ |
#else |
1171 |
+ |
if (false) { |
1172 |
|
#endif |
1173 |
|
char *str = new char[64]; |
1174 |
|
strncpy(str, ifr->ifr_name, 63); |
1178 |
|
} |
1179 |
|
close(s); |
1180 |
|
} |
1181 |
+ |
#ifdef HAVE_SLIRP |
1182 |
+ |
static char s_slirp[] = "slirp"; |
1183 |
+ |
glist = g_list_append(glist, s_slirp); |
1184 |
+ |
#endif |
1185 |
|
if (glist) |
1186 |
|
g_list_sort(glist, gl_str_cmp); |
1187 |
|
else |
1188 |
< |
glist = g_list_append(glist, (char *)"<none>"); |
1188 |
> |
glist = g_list_append(glist, (void *)GetString(STR_NONE_LAB)); |
1189 |
|
return glist; |
1190 |
|
} |
1191 |
|
|
1192 |
|
// Create "Serial/Network" pane |
1193 |
|
static void create_serial_pane(GtkWidget *top) |
1194 |
|
{ |
1195 |
< |
GtkWidget *box, *table, *label, *combo; |
1196 |
< |
GList *glist = add_serial_names(); |
1195 |
> |
GtkWidget *box, *hbox, *table, *label, *combo, *sep; |
1196 |
> |
GtkObject *adj; |
1197 |
|
|
1198 |
|
box = make_pane(top, STR_SERIAL_NETWORK_PANE_TITLE); |
1199 |
< |
table = make_table(box, 2, 3); |
1199 |
> |
table = make_table(box, 2, 4); |
1200 |
|
|
1201 |
|
label = gtk_label_new(GetString(STR_SERIALA_CTRL)); |
1202 |
|
gtk_widget_show(label); |
1203 |
|
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4); |
1204 |
|
|
1205 |
+ |
GList *glist = add_serial_names(); |
1206 |
|
combo = gtk_combo_new(); |
1207 |
|
gtk_widget_show(combo); |
1208 |
|
gtk_combo_set_popdown_strings(GTK_COMBO(combo), glist); |
1227 |
|
gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 1, 2, (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), (GtkAttachOptions)0, 4, 4); |
1228 |
|
w_serialb = GTK_COMBO(combo)->entry; |
1229 |
|
|
1230 |
+ |
sep = gtk_hseparator_new(); |
1231 |
+ |
gtk_widget_show(sep); |
1232 |
+ |
gtk_table_attach(GTK_TABLE(table), sep, 0, 2, 2, 3, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4); |
1233 |
+ |
|
1234 |
|
label = gtk_label_new(GetString(STR_ETHERNET_IF_CTRL)); |
1235 |
|
gtk_widget_show(label); |
1236 |
< |
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4); |
1236 |
> |
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 3, 4, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4); |
1237 |
|
|
1238 |
|
glist = add_ether_names(); |
1239 |
|
combo = gtk_combo_new(); |
1243 |
|
if (str == NULL) |
1244 |
|
str = ""; |
1245 |
|
gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo)->entry), str); |
1246 |
< |
gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 2, 3, (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), (GtkAttachOptions)0, 4, 4); |
1246 |
> |
gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 3, 4, (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), (GtkAttachOptions)0, 4, 4); |
1247 |
|
w_ether = GTK_COMBO(combo)->entry; |
1248 |
+ |
|
1249 |
+ |
#if SUPPORTS_UDP_TUNNEL |
1250 |
+ |
make_checkbox(box, STR_UDPTUNNEL_CTRL, "udptunnel", GTK_SIGNAL_FUNC(tb_udptunnel)); |
1251 |
+ |
|
1252 |
+ |
hbox = gtk_hbox_new(FALSE, 4); |
1253 |
+ |
gtk_widget_show(hbox); |
1254 |
+ |
gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0); |
1255 |
+ |
|
1256 |
+ |
label = gtk_label_new(GetString(STR_UDPPORT_CTRL)); |
1257 |
+ |
gtk_widget_show(label); |
1258 |
+ |
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
1259 |
+ |
|
1260 |
+ |
adj = gtk_adjustment_new(PrefsFindInt32("udpport"), 1, 65535, 1, 5, 0); |
1261 |
+ |
w_udp_port = gtk_spin_button_new(GTK_ADJUSTMENT(adj), 0.0, 0); |
1262 |
+ |
gtk_widget_show(w_udp_port); |
1263 |
+ |
gtk_box_pack_start(GTK_BOX(hbox), w_udp_port, FALSE, FALSE, 0); |
1264 |
+ |
#endif |
1265 |
+ |
|
1266 |
+ |
set_serial_sensitive(); |
1267 |
|
} |
1268 |
|
|
1269 |
|
|
1273 |
|
|
1274 |
|
static GtkObject *w_ramsize_adj; |
1275 |
|
static GtkWidget *w_rom_file; |
1276 |
< |
static GtkWidget *w_keycode_file; |
1276 |
> |
|
1277 |
> |
// "Ignore SEGV" button toggled |
1278 |
> |
#ifdef HAVE_SIGSEGV_SKIP_INSTRUCTION |
1279 |
> |
static void tb_ignoresegv(GtkWidget *widget) |
1280 |
> |
{ |
1281 |
> |
PrefsReplaceBool("ignoresegv", GTK_TOGGLE_BUTTON(widget)->active); |
1282 |
> |
} |
1283 |
> |
#endif |
1284 |
|
|
1285 |
|
// Model ID selected |
1286 |
|
static void mn_modelid_5(...) {PrefsReplaceInt32("modelid", 5);} |
1287 |
|
static void mn_modelid_14(...) {PrefsReplaceInt32("modelid", 14);} |
1288 |
|
|
1289 |
< |
// "Use Raw Keycodes" button toggled |
1290 |
< |
static void tb_keycodes(GtkWidget *widget) |
1291 |
< |
{ |
1292 |
< |
PrefsReplaceBool("keycodes", GTK_TOGGLE_BUTTON(widget)->active); |
1293 |
< |
} |
1289 |
> |
// CPU/FPU type |
1290 |
> |
static void mn_cpu_68020(...) {PrefsReplaceInt32("cpu", 2); PrefsReplaceBool("fpu", false);} |
1291 |
> |
static void mn_cpu_68020_fpu(...) {PrefsReplaceInt32("cpu", 2); PrefsReplaceBool("fpu", true);} |
1292 |
> |
static void mn_cpu_68030(...) {PrefsReplaceInt32("cpu", 3); PrefsReplaceBool("fpu", false);} |
1293 |
> |
static void mn_cpu_68030_fpu(...) {PrefsReplaceInt32("cpu", 3); PrefsReplaceBool("fpu", true);} |
1294 |
> |
static void mn_cpu_68040(...) {PrefsReplaceInt32("cpu", 4); PrefsReplaceBool("fpu", true);} |
1295 |
|
|
1296 |
|
// Read settings from widgets and set preferences |
1297 |
|
static void read_memory_settings(void) |
1298 |
|
{ |
1299 |
|
PrefsReplaceInt32("ramsize", int(GTK_ADJUSTMENT(w_ramsize_adj)->value) << 20); |
1300 |
|
|
1301 |
< |
const char *str = gtk_entry_get_text(GTK_ENTRY(w_rom_file)); |
1301 |
> |
const char *str = get_file_entry_path(w_rom_file); |
1302 |
|
if (str && strlen(str)) |
1303 |
|
PrefsReplaceString("rom", str); |
1304 |
|
else |
1305 |
|
PrefsRemoveItem("rom"); |
1306 |
|
|
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"); |
1307 |
|
} |
1308 |
|
|
1309 |
|
// Create "Memory/Misc" pane |
1310 |
|
static void create_memory_pane(GtkWidget *top) |
1311 |
|
{ |
1312 |
< |
GtkWidget *box, *vbox, *hbox, *hbox2, *label, *scale, *opt, *menu; |
1312 |
> |
GtkWidget *box, *hbox, *vbox, *hbox2, *label, *scale; |
1313 |
|
|
1314 |
|
box = make_pane(top, STR_MEMORY_MISC_PANE_TITLE); |
1315 |
|
|
1351 |
|
gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 0); |
1352 |
|
gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0); |
1353 |
|
|
1354 |
< |
static const opt_desc options[] = { |
1354 |
> |
static const opt_desc model_options[] = { |
1355 |
|
{STR_MODELID_5_LAB, GTK_SIGNAL_FUNC(mn_modelid_5)}, |
1356 |
|
{STR_MODELID_14_LAB, GTK_SIGNAL_FUNC(mn_modelid_14)}, |
1357 |
|
{0, NULL} |
1361 |
|
case 5: active = 0; break; |
1362 |
|
case 14: active = 1; break; |
1363 |
|
} |
1364 |
< |
menu = make_option_menu(box, STR_MODELID_CTRL, options, active); |
1364 |
> |
make_option_menu(box, STR_MODELID_CTRL, model_options, active); |
1365 |
|
|
1366 |
< |
w_rom_file = make_entry(box, STR_ROM_FILE_CTRL, "rom"); |
1366 |
> |
#if EMULATED_68K |
1367 |
> |
static const opt_desc cpu_options[] = { |
1368 |
> |
{STR_CPU_68020_LAB, GTK_SIGNAL_FUNC(mn_cpu_68020)}, |
1369 |
> |
{STR_CPU_68020_FPU_LAB, GTK_SIGNAL_FUNC(mn_cpu_68020_fpu)}, |
1370 |
> |
{STR_CPU_68030_LAB, GTK_SIGNAL_FUNC(mn_cpu_68030)}, |
1371 |
> |
{STR_CPU_68030_FPU_LAB, GTK_SIGNAL_FUNC(mn_cpu_68030_fpu)}, |
1372 |
> |
{STR_CPU_68040_LAB, GTK_SIGNAL_FUNC(mn_cpu_68040)}, |
1373 |
> |
{0, NULL} |
1374 |
> |
}; |
1375 |
> |
int cpu = PrefsFindInt32("cpu"); |
1376 |
> |
bool fpu = PrefsFindBool("fpu"); |
1377 |
> |
active = 0; |
1378 |
> |
switch (cpu) { |
1379 |
> |
case 2: active = fpu ? 1 : 0; break; |
1380 |
> |
case 3: active = fpu ? 3 : 2; break; |
1381 |
> |
case 4: active = 4; |
1382 |
> |
} |
1383 |
> |
make_option_menu(box, STR_CPU_CTRL, cpu_options, active); |
1384 |
> |
#endif |
1385 |
|
|
1386 |
< |
make_checkbox(box, STR_KEYCODES_CTRL, "keycodes", GTK_SIGNAL_FUNC(tb_keycodes)); |
1387 |
< |
w_keycode_file = make_entry(box, STR_KEYCODE_FILE_CTRL, "keycodefile"); |
1386 |
> |
w_rom_file = make_file_entry(box, STR_ROM_FILE_CTRL, "rom"); |
1387 |
> |
|
1388 |
> |
#ifdef HAVE_SIGSEGV_SKIP_INSTRUCTION |
1389 |
> |
make_checkbox(box, STR_IGNORESEGV_CTRL, "ignoresegv", GTK_SIGNAL_FUNC(tb_ignoresegv)); |
1390 |
> |
#endif |
1391 |
|
} |
1392 |
|
|
1393 |
|
|
1400 |
|
read_volumes_settings(); |
1401 |
|
read_scsi_settings(); |
1402 |
|
read_graphics_settings(); |
1403 |
+ |
read_input_settings(); |
1404 |
|
read_serial_settings(); |
1405 |
|
read_memory_settings(); |
1406 |
+ |
read_jit_settings(); |
1407 |
|
} |