1 |
|
/* |
2 |
|
* prefs_editor_gtk.cpp - Preferences editor, Unix implementation using GTK+ |
3 |
|
* |
4 |
< |
* Basilisk II (C) 1997-2002 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 |
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 |
+ |
struct file_req_assoc { |
73 |
+ |
file_req_assoc(GtkWidget *r, GtkWidget *e) : req(r), entry(e) {} |
74 |
+ |
GtkWidget *req; |
75 |
+ |
GtkWidget *entry; |
76 |
+ |
}; |
77 |
+ |
|
78 |
+ |
static void cb_browse_ok(GtkWidget *button, file_req_assoc *assoc) |
79 |
+ |
{ |
80 |
+ |
gchar *file = (char *)gtk_file_selection_get_filename(GTK_FILE_SELECTION(assoc->req)); |
81 |
+ |
gtk_entry_set_text(GTK_ENTRY(assoc->entry), file); |
82 |
+ |
gtk_widget_destroy(assoc->req); |
83 |
+ |
delete assoc; |
84 |
+ |
} |
85 |
+ |
|
86 |
+ |
static void cb_browse(GtkWidget *widget, void *user_data) |
87 |
+ |
{ |
88 |
+ |
GtkWidget *req = gtk_file_selection_new(GetString(STR_BROWSE_TITLE)); |
89 |
+ |
gtk_signal_connect_object(GTK_OBJECT(req), "delete_event", GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(req)); |
90 |
+ |
gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(req)->ok_button), "clicked", GTK_SIGNAL_FUNC(cb_browse_ok), new file_req_assoc(req, (GtkWidget *)user_data)); |
91 |
+ |
gtk_signal_connect_object(GTK_OBJECT(GTK_FILE_SELECTION(req)->cancel_button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(req)); |
92 |
+ |
gtk_widget_show(req); |
93 |
+ |
} |
94 |
+ |
|
95 |
+ |
static GtkWidget *make_browse_button(GtkWidget *entry) |
96 |
+ |
{ |
97 |
+ |
GtkWidget *button; |
98 |
+ |
|
99 |
+ |
button = gtk_button_new_with_label(GetString(STR_BROWSE_CTRL)); |
100 |
+ |
gtk_widget_show(button); |
101 |
+ |
gtk_signal_connect(GTK_OBJECT(button), "clicked", (GtkSignalFunc)cb_browse, (void *)entry); |
102 |
+ |
return button; |
103 |
+ |
} |
104 |
+ |
|
105 |
|
static void add_menu_item(GtkWidget *menu, int label_id, GtkSignalFunc func) |
106 |
|
{ |
107 |
|
GtkWidget *item = gtk_menu_item_new_with_label(GetString(label_id)); |
165 |
|
return table; |
166 |
|
} |
167 |
|
|
168 |
+ |
static GtkWidget *table_make_option_menu(GtkWidget *table, int row, int label_id, const opt_desc *options, int active) |
169 |
+ |
{ |
170 |
+ |
GtkWidget *label, *opt, *menu; |
171 |
+ |
|
172 |
+ |
label = gtk_label_new(GetString(label_id)); |
173 |
+ |
gtk_widget_show(label); |
174 |
+ |
gtk_table_attach(GTK_TABLE(table), label, 0, 1, row, row + 1, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4); |
175 |
+ |
|
176 |
+ |
opt = gtk_option_menu_new(); |
177 |
+ |
gtk_widget_show(opt); |
178 |
+ |
menu = gtk_menu_new(); |
179 |
+ |
|
180 |
+ |
while (options->label_id) { |
181 |
+ |
add_menu_item(menu, options->label_id, options->func); |
182 |
+ |
options++; |
183 |
+ |
} |
184 |
+ |
gtk_menu_set_active(GTK_MENU(menu), active); |
185 |
+ |
|
186 |
+ |
gtk_option_menu_set_menu(GTK_OPTION_MENU(opt), menu); |
187 |
+ |
gtk_table_attach(GTK_TABLE(table), opt, 1, 2, row, row + 1, (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), (GtkAttachOptions)0, 4, 4); |
188 |
+ |
return menu; |
189 |
+ |
} |
190 |
+ |
|
191 |
+ |
static GtkWidget *table_make_combobox(GtkWidget *table, int row, int label_id, const char *default_value, GList *glist) |
192 |
+ |
{ |
193 |
+ |
GtkWidget *label, *combo; |
194 |
+ |
char str[32]; |
195 |
+ |
|
196 |
+ |
label = gtk_label_new(GetString(label_id)); |
197 |
+ |
gtk_widget_show(label); |
198 |
+ |
gtk_table_attach(GTK_TABLE(table), label, 0, 1, row, row + 1, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4); |
199 |
+ |
|
200 |
+ |
combo = gtk_combo_new(); |
201 |
+ |
gtk_widget_show(combo); |
202 |
+ |
gtk_combo_set_popdown_strings(GTK_COMBO(combo), glist); |
203 |
+ |
|
204 |
+ |
gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo)->entry), default_value); |
205 |
+ |
gtk_table_attach(GTK_TABLE(table), combo, 1, 2, row, row + 1, (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), (GtkAttachOptions)0, 4, 4); |
206 |
+ |
|
207 |
+ |
return combo; |
208 |
+ |
} |
209 |
+ |
|
210 |
+ |
static GtkWidget *table_make_combobox(GtkWidget *table, int row, int label_id, const char *default_value, const combo_desc *options) |
211 |
+ |
{ |
212 |
+ |
GList *glist = NULL; |
213 |
+ |
while (options->label_id) { |
214 |
+ |
glist = g_list_append(glist, (void *)GetString(options->label_id)); |
215 |
+ |
options++; |
216 |
+ |
} |
217 |
+ |
|
218 |
+ |
return table_make_combobox(table, row, label_id, default_value, glist); |
219 |
+ |
} |
220 |
+ |
|
221 |
+ |
static GtkWidget *table_make_file_entry(GtkWidget *table, int row, int label_id, const char *prefs_item, bool only_dirs = false) |
222 |
+ |
{ |
223 |
+ |
GtkWidget *box, *label, *entry, *button; |
224 |
+ |
|
225 |
+ |
label = gtk_label_new(GetString(label_id)); |
226 |
+ |
gtk_widget_show(label); |
227 |
+ |
gtk_table_attach(GTK_TABLE(table), label, 0, 1, row, row + 1, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4); |
228 |
+ |
|
229 |
+ |
const char *str = PrefsFindString(prefs_item); |
230 |
+ |
if (str == NULL) |
231 |
+ |
str = ""; |
232 |
+ |
|
233 |
+ |
box = gtk_hbox_new(FALSE, 4); |
234 |
+ |
gtk_widget_show(box); |
235 |
+ |
gtk_table_attach(GTK_TABLE(table), box, 1, 2, row, row + 1, (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), (GtkAttachOptions)0, 4, 4); |
236 |
+ |
|
237 |
+ |
entry = gtk_entry_new(); |
238 |
+ |
gtk_entry_set_text(GTK_ENTRY(entry), str); |
239 |
+ |
gtk_widget_show(entry); |
240 |
+ |
gtk_box_pack_start(GTK_BOX(box), entry, TRUE, TRUE, 0); |
241 |
+ |
|
242 |
+ |
button = make_browse_button(entry); |
243 |
+ |
gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 0); |
244 |
+ |
g_object_set_data(G_OBJECT(entry), "chooser_button", button); |
245 |
+ |
return entry; |
246 |
+ |
} |
247 |
+ |
|
248 |
|
static GtkWidget *make_option_menu(GtkWidget *top, int label_id, const opt_desc *options, int active) |
249 |
|
{ |
250 |
|
GtkWidget *box, *label, *opt, *menu; |
302 |
|
return entry; |
303 |
|
} |
304 |
|
|
305 |
< |
static char *get_file_entry_path(GtkWidget *entry) |
305 |
> |
static const gchar *get_file_entry_path(GtkWidget *entry) |
306 |
|
{ |
307 |
|
#ifdef HAVE_GNOMEUI |
308 |
|
return gnome_file_entry_get_full_path(GNOME_FILE_ENTRY(entry), false); |
321 |
|
return button; |
322 |
|
} |
323 |
|
|
324 |
+ |
static GtkWidget *make_combobox(GtkWidget *top, int label_id, const char *prefs_item, const combo_desc *options) |
325 |
+ |
{ |
326 |
+ |
GtkWidget *box, *label, *combo; |
327 |
+ |
char str[32]; |
328 |
+ |
|
329 |
+ |
box = gtk_hbox_new(FALSE, 4); |
330 |
+ |
gtk_widget_show(box); |
331 |
+ |
gtk_box_pack_start(GTK_BOX(top), box, FALSE, FALSE, 0); |
332 |
+ |
|
333 |
+ |
label = gtk_label_new(GetString(label_id)); |
334 |
+ |
gtk_widget_show(label); |
335 |
+ |
gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 0); |
336 |
+ |
|
337 |
+ |
GList *glist = NULL; |
338 |
+ |
while (options->label_id) { |
339 |
+ |
glist = g_list_append(glist, (void *)GetString(options->label_id)); |
340 |
+ |
options++; |
341 |
+ |
} |
342 |
+ |
|
343 |
+ |
combo = gtk_combo_new(); |
344 |
+ |
gtk_widget_show(combo); |
345 |
+ |
gtk_combo_set_popdown_strings(GTK_COMBO(combo), glist); |
346 |
+ |
|
347 |
+ |
sprintf(str, "%d", PrefsFindInt32(prefs_item)); |
348 |
+ |
gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo)->entry), str); |
349 |
+ |
gtk_box_pack_start(GTK_BOX(box), combo, TRUE, TRUE, 0); |
350 |
+ |
|
351 |
+ |
return combo; |
352 |
+ |
} |
353 |
|
|
354 |
+ |
|
355 |
|
/* |
356 |
|
* Show preferences editor |
357 |
|
* Returns true when user clicked on "Start", false otherwise |
419 |
|
dialog = gnome_about_new( |
420 |
|
"Basilisk II", |
421 |
|
version, |
422 |
< |
"Copyright (C) 1997-2002 Christian Bauer", |
422 |
> |
"Copyright (C) 1997-2004 Christian Bauer", |
423 |
|
authors, |
424 |
|
"Basilisk II comes with ABSOLUTELY NO WARRANTY." |
425 |
|
"This is free software, and you are welcome to redistribute it" |
435 |
|
char str[512]; |
436 |
|
sprintf(str, |
437 |
|
"Basilisk II\nVersion %d.%d\n\n" |
438 |
< |
"Copyright (C) 1997-2002 Christian Bauer et al.\n" |
438 |
> |
"Copyright (C) 1997-2004 Christian Bauer et al.\n" |
439 |
|
"E-mail: Christian.Bauer@uni-mainz.de\n" |
440 |
|
"http://www.uni-mainz.de/~bauec002/B2Main.html\n\n" |
441 |
|
"Basilisk II comes with ABSOLUTELY NO\n" |
476 |
|
// Menu item descriptions |
477 |
|
static GtkItemFactoryEntry menu_items[] = { |
478 |
|
{(gchar *)GetString(STR_PREFS_MENU_FILE_GTK), NULL, NULL, 0, "<Branch>"}, |
479 |
< |
{(gchar *)GetString(STR_PREFS_ITEM_START_GTK), NULL, GTK_SIGNAL_FUNC(cb_start), 0, NULL}, |
479 |
> |
{(gchar *)GetString(STR_PREFS_ITEM_START_GTK), "<control>S", GTK_SIGNAL_FUNC(cb_start), 0, NULL}, |
480 |
|
{(gchar *)GetString(STR_PREFS_ITEM_ZAP_PRAM_GTK), NULL, GTK_SIGNAL_FUNC(mn_zap_pram), 0, NULL}, |
481 |
|
{(gchar *)GetString(STR_PREFS_ITEM_SEPL_GTK), NULL, NULL, 0, "<Separator>"}, |
482 |
|
{(gchar *)GetString(STR_PREFS_ITEM_QUIT_GTK), "<control>Q", GTK_SIGNAL_FUNC(cb_quit), 0, NULL}, |
500 |
|
GtkAccelGroup *accel_group = gtk_accel_group_new(); |
501 |
|
GtkItemFactory *item_factory = gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<main>", accel_group); |
502 |
|
gtk_item_factory_create_items(item_factory, sizeof(menu_items) / sizeof(menu_items[0]), menu_items, NULL); |
503 |
+ |
#if GTK_CHECK_VERSION(1,3,15) |
504 |
+ |
gtk_window_add_accel_group(GTK_WINDOW(win), accel_group); |
505 |
+ |
#else |
506 |
|
gtk_accel_group_attach(accel_group, GTK_OBJECT(win)); |
507 |
+ |
#endif |
508 |
|
GtkWidget *menu_bar = gtk_item_factory_get_widget(item_factory, "<main>"); |
509 |
|
gtk_widget_show(menu_bar); |
510 |
|
gtk_box_pack_start(GTK_BOX(box), menu_bar, FALSE, TRUE, 0); |
521 |
|
create_input_pane(notebook); |
522 |
|
create_serial_pane(notebook); |
523 |
|
create_memory_pane(notebook); |
524 |
+ |
create_jit_pane(notebook); |
525 |
|
|
526 |
|
static const opt_desc buttons[] = { |
527 |
|
{STR_START_BUTTON, GTK_SIGNAL_FUNC(cb_start)}, |
550 |
|
selected_volume = row; |
551 |
|
} |
552 |
|
|
400 |
– |
struct file_req_assoc { |
401 |
– |
file_req_assoc(GtkWidget *r, GtkWidget *e) : req(r), entry(e) {} |
402 |
– |
GtkWidget *req; |
403 |
– |
GtkWidget *entry; |
404 |
– |
}; |
405 |
– |
|
553 |
|
// Volume selected for addition |
554 |
|
static void add_volume_ok(GtkWidget *button, file_req_assoc *assoc) |
555 |
|
{ |
556 |
< |
char *file = gtk_file_selection_get_filename(GTK_FILE_SELECTION(assoc->req)); |
556 |
> |
gchar *file = (gchar *)gtk_file_selection_get_filename(GTK_FILE_SELECTION(assoc->req)); |
557 |
|
gtk_clist_append(GTK_CLIST(volume_list), &file); |
558 |
|
gtk_widget_destroy(assoc->req); |
559 |
|
delete assoc; |
562 |
|
// Volume selected for creation |
563 |
|
static void create_volume_ok(GtkWidget *button, file_req_assoc *assoc) |
564 |
|
{ |
565 |
< |
char *file = gtk_file_selection_get_filename(GTK_FILE_SELECTION(assoc->req)); |
565 |
> |
gchar *file = (gchar *)gtk_file_selection_get_filename(GTK_FILE_SELECTION(assoc->req)); |
566 |
|
|
567 |
< |
char *str = gtk_entry_get_text(GTK_ENTRY(assoc->entry)); |
567 |
> |
const gchar *str = gtk_entry_get_text(GTK_ENTRY(assoc->entry)); |
568 |
|
int size = atoi(str); |
569 |
|
|
570 |
|
char cmd[1024]; |
693 |
|
|
694 |
|
|
695 |
|
/* |
696 |
+ |
* "JIT Compiler" pane |
697 |
+ |
*/ |
698 |
+ |
|
699 |
+ |
static GtkWidget *w_jit_fpu; |
700 |
+ |
static GtkWidget *w_jit_atraps; |
701 |
+ |
static GtkWidget *w_jit_cache_size; |
702 |
+ |
static GtkWidget *w_jit_lazy_flush; |
703 |
+ |
static GtkWidget *w_jit_follow_const_jumps; |
704 |
+ |
|
705 |
+ |
// Set sensitivity of widgets |
706 |
+ |
static void set_jit_sensitive(void) |
707 |
+ |
{ |
708 |
+ |
const bool jit_enabled = PrefsFindBool("jit"); |
709 |
+ |
gtk_widget_set_sensitive(w_jit_fpu, jit_enabled); |
710 |
+ |
gtk_widget_set_sensitive(w_jit_cache_size, jit_enabled); |
711 |
+ |
gtk_widget_set_sensitive(w_jit_lazy_flush, jit_enabled); |
712 |
+ |
gtk_widget_set_sensitive(w_jit_follow_const_jumps, jit_enabled); |
713 |
+ |
} |
714 |
+ |
|
715 |
+ |
// "Use JIT Compiler" button toggled |
716 |
+ |
static void tb_jit(GtkWidget *widget) |
717 |
+ |
{ |
718 |
+ |
PrefsReplaceBool("jit", GTK_TOGGLE_BUTTON(widget)->active); |
719 |
+ |
set_jit_sensitive(); |
720 |
+ |
} |
721 |
+ |
|
722 |
+ |
// "Compile FPU Instructions" button toggled |
723 |
+ |
static void tb_jit_fpu(GtkWidget *widget) |
724 |
+ |
{ |
725 |
+ |
PrefsReplaceBool("jitfpu", GTK_TOGGLE_BUTTON(widget)->active); |
726 |
+ |
} |
727 |
+ |
|
728 |
+ |
// "Lazy translation cache invalidation" button toggled |
729 |
+ |
static void tb_jit_lazy_flush(GtkWidget *widget) |
730 |
+ |
{ |
731 |
+ |
PrefsReplaceBool("jitlazyflush", GTK_TOGGLE_BUTTON(widget)->active); |
732 |
+ |
} |
733 |
+ |
|
734 |
+ |
// "Translate through constant jumps (inline blocks)" button toggled |
735 |
+ |
static void tb_jit_follow_const_jumps(GtkWidget *widget) |
736 |
+ |
{ |
737 |
+ |
PrefsReplaceBool("jitinline", GTK_TOGGLE_BUTTON(widget)->active); |
738 |
+ |
} |
739 |
+ |
|
740 |
+ |
// Read settings from widgets and set preferences |
741 |
+ |
static void read_jit_settings(void) |
742 |
+ |
{ |
743 |
+ |
#if USE_JIT |
744 |
+ |
bool jit_enabled = PrefsFindBool("jit"); |
745 |
+ |
if (jit_enabled) { |
746 |
+ |
const char *str = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(w_jit_cache_size)->entry)); |
747 |
+ |
PrefsReplaceInt32("jitcachesize", atoi(str)); |
748 |
+ |
} |
749 |
+ |
#endif |
750 |
+ |
} |
751 |
+ |
|
752 |
+ |
// Create "JIT Compiler" pane |
753 |
+ |
static void create_jit_pane(GtkWidget *top) |
754 |
+ |
{ |
755 |
+ |
#if USE_JIT |
756 |
+ |
GtkWidget *box, *table, *label, *menu; |
757 |
+ |
char str[32]; |
758 |
+ |
|
759 |
+ |
box = make_pane(top, STR_JIT_PANE_TITLE); |
760 |
+ |
make_checkbox(box, STR_JIT_CTRL, "jit", GTK_SIGNAL_FUNC(tb_jit)); |
761 |
+ |
|
762 |
+ |
w_jit_fpu = make_checkbox(box, STR_JIT_FPU_CTRL, "jitfpu", GTK_SIGNAL_FUNC(tb_jit_fpu)); |
763 |
+ |
|
764 |
+ |
// Translation cache size |
765 |
+ |
static const combo_desc options[] = { |
766 |
+ |
STR_JIT_CACHE_SIZE_2MB_LAB, |
767 |
+ |
STR_JIT_CACHE_SIZE_4MB_LAB, |
768 |
+ |
STR_JIT_CACHE_SIZE_8MB_LAB, |
769 |
+ |
STR_JIT_CACHE_SIZE_16MB_LAB, |
770 |
+ |
0 |
771 |
+ |
}; |
772 |
+ |
w_jit_cache_size = make_combobox(box, STR_JIT_CACHE_SIZE_CTRL, "jitcachesize", options); |
773 |
+ |
|
774 |
+ |
// Lazy translation cache invalidation |
775 |
+ |
w_jit_lazy_flush = make_checkbox(box, STR_JIT_LAZY_CINV_CTRL, "jitlazyflush", GTK_SIGNAL_FUNC(tb_jit_lazy_flush)); |
776 |
+ |
|
777 |
+ |
// Follow constant jumps (inline basic blocks) |
778 |
+ |
w_jit_follow_const_jumps = make_checkbox(box, STR_JIT_FOLLOW_CONST_JUMPS, "jitinline", GTK_SIGNAL_FUNC(tb_jit_follow_const_jumps)); |
779 |
+ |
|
780 |
+ |
set_jit_sensitive(); |
781 |
+ |
#endif |
782 |
+ |
} |
783 |
+ |
|
784 |
+ |
/* |
785 |
|
* "SCSI" pane |
786 |
|
*/ |
787 |
|
|
837 |
|
static char fbdev_name[256]; |
838 |
|
#endif |
839 |
|
|
840 |
+ |
static GtkWidget *w_dspdevice_file, *w_mixerdevice_file; |
841 |
+ |
|
842 |
|
// Hide/show graphics widgets |
843 |
|
static void hide_show_graphics_widgets(void) |
844 |
|
{ |
885 |
|
static void mn_60hz(...) {PrefsReplaceInt32("frameskip", 1);} |
886 |
|
static void mn_dynamic(...) {PrefsReplaceInt32("frameskip", 0);} |
887 |
|
|
888 |
+ |
// Set sensitivity of widgets |
889 |
+ |
static void set_graphics_sensitive(void) |
890 |
+ |
{ |
891 |
+ |
const bool sound_enabled = !PrefsFindBool("nosound"); |
892 |
+ |
gtk_widget_set_sensitive(w_dspdevice_file, sound_enabled); |
893 |
+ |
gtk_widget_set_sensitive(w_mixerdevice_file, sound_enabled); |
894 |
+ |
} |
895 |
+ |
|
896 |
|
// "Disable Sound Output" button toggled |
897 |
|
static void tb_nosound(GtkWidget *widget) |
898 |
|
{ |
899 |
|
PrefsReplaceBool("nosound", GTK_TOGGLE_BUTTON(widget)->active); |
900 |
+ |
set_graphics_sensitive(); |
901 |
|
} |
902 |
|
|
903 |
|
// Read graphics preferences |
960 |
|
else |
961 |
|
PrefsRemoveItem("fbdevicefile"); |
962 |
|
#endif |
963 |
+ |
PrefsReplaceString("dsp", get_file_entry_path(w_dspdevice_file)); |
964 |
+ |
PrefsReplaceString("mixer", get_file_entry_path(w_mixerdevice_file)); |
965 |
|
} |
966 |
|
|
967 |
|
// Create "Graphics/Sound" pane |
1082 |
|
|
1083 |
|
make_separator(box); |
1084 |
|
make_checkbox(box, STR_NOSOUND_CTRL, "nosound", GTK_SIGNAL_FUNC(tb_nosound)); |
1085 |
+ |
w_dspdevice_file = make_file_entry(box, STR_DSPDEVICE_FILE_CTRL, "dsp"); |
1086 |
+ |
w_mixerdevice_file = make_file_entry(box, STR_MIXERDEVICE_FILE_CTRL, "mixer"); |
1087 |
+ |
|
1088 |
+ |
set_graphics_sensitive(); |
1089 |
|
|
1090 |
|
hide_show_graphics_widgets(); |
1091 |
|
} |
1101 |
|
// Set sensitivity of widgets |
1102 |
|
static void set_input_sensitive(void) |
1103 |
|
{ |
1104 |
< |
gtk_widget_set_sensitive(w_keycode_file, PrefsFindBool("keycodes")); |
1104 |
> |
const bool use_keycodes = PrefsFindBool("keycodes"); |
1105 |
> |
gtk_widget_set_sensitive(w_keycode_file, use_keycodes); |
1106 |
> |
gtk_widget_set_sensitive(GTK_WIDGET(g_object_get_data(G_OBJECT(w_keycode_file), "chooser_button")), use_keycodes); |
1107 |
|
gtk_widget_set_sensitive(w_mouse_wheel_lines, PrefsFindInt32("mousewheelmode") == 1); |
1108 |
|
} |
1109 |
|
|
1133 |
|
// Create "Input" pane |
1134 |
|
static void create_input_pane(GtkWidget *top) |
1135 |
|
{ |
1136 |
< |
GtkWidget *box, *hbox, *menu, *label; |
1136 |
> |
GtkWidget *box, *hbox, *menu, *label, *button; |
1137 |
|
GtkObject *adj; |
1138 |
|
|
1139 |
|
box = make_pane(top, STR_INPUT_PANE_TITLE); |
1140 |
|
|
1141 |
|
make_checkbox(box, STR_KEYCODES_CTRL, "keycodes", GTK_SIGNAL_FUNC(tb_keycodes)); |
1142 |
< |
w_keycode_file = make_file_entry(box, STR_KEYCODE_FILE_CTRL, "keycodefile"); |
1142 |
> |
|
1143 |
> |
hbox = gtk_hbox_new(FALSE, 4); |
1144 |
> |
gtk_widget_show(hbox); |
1145 |
> |
gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0); |
1146 |
> |
|
1147 |
> |
label = gtk_label_new(GetString(STR_KEYCODES_CTRL)); |
1148 |
> |
gtk_widget_show(label); |
1149 |
> |
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
1150 |
> |
|
1151 |
> |
const char *str = PrefsFindString("keycodefile"); |
1152 |
> |
if (str == NULL) |
1153 |
> |
str = ""; |
1154 |
> |
|
1155 |
> |
w_keycode_file = gtk_entry_new(); |
1156 |
> |
gtk_entry_set_text(GTK_ENTRY(w_keycode_file), str); |
1157 |
> |
gtk_widget_show(w_keycode_file); |
1158 |
> |
gtk_box_pack_start(GTK_BOX(hbox), w_keycode_file, TRUE, TRUE, 0); |
1159 |
> |
|
1160 |
> |
button = make_browse_button(w_keycode_file); |
1161 |
> |
gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); |
1162 |
> |
g_object_set_data(G_OBJECT(w_keycode_file), "chooser_button", button); |
1163 |
|
|
1164 |
|
make_separator(box); |
1165 |
|
|
1307 |
|
} |
1308 |
|
close(s); |
1309 |
|
} |
1310 |
+ |
#ifdef HAVE_SLIRP |
1311 |
+ |
static char s_slirp[] = "slirp"; |
1312 |
+ |
glist = g_list_append(glist, s_slirp); |
1313 |
+ |
#endif |
1314 |
|
if (glist) |
1315 |
|
g_list_sort(glist, gl_str_cmp); |
1316 |
|
else |
1400 |
|
* "Memory/Misc" pane |
1401 |
|
*/ |
1402 |
|
|
1403 |
< |
static GtkObject *w_ramsize_adj; |
1403 |
> |
static GtkWidget *w_ramsize; |
1404 |
|
static GtkWidget *w_rom_file; |
1405 |
|
|
1406 |
+ |
// "Ignore SEGV" button toggled |
1407 |
+ |
#ifdef HAVE_SIGSEGV_SKIP_INSTRUCTION |
1408 |
+ |
static void tb_ignoresegv(GtkWidget *widget) |
1409 |
+ |
{ |
1410 |
+ |
PrefsReplaceBool("ignoresegv", GTK_TOGGLE_BUTTON(widget)->active); |
1411 |
+ |
} |
1412 |
+ |
#endif |
1413 |
+ |
|
1414 |
|
// Model ID selected |
1415 |
|
static void mn_modelid_5(...) {PrefsReplaceInt32("modelid", 5);} |
1416 |
|
static void mn_modelid_14(...) {PrefsReplaceInt32("modelid", 14);} |
1425 |
|
// Read settings from widgets and set preferences |
1426 |
|
static void read_memory_settings(void) |
1427 |
|
{ |
1428 |
< |
PrefsReplaceInt32("ramsize", int(GTK_ADJUSTMENT(w_ramsize_adj)->value) << 20); |
1428 |
> |
const char *str = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(w_ramsize)->entry)); |
1429 |
> |
PrefsReplaceInt32("ramsize", atoi(str) << 20); |
1430 |
|
|
1431 |
< |
const char *str = get_file_entry_path(w_rom_file); |
1431 |
> |
str = get_file_entry_path(w_rom_file); |
1432 |
|
if (str && strlen(str)) |
1433 |
|
PrefsReplaceString("rom", str); |
1434 |
|
else |
1439 |
|
// Create "Memory/Misc" pane |
1440 |
|
static void create_memory_pane(GtkWidget *top) |
1441 |
|
{ |
1442 |
< |
GtkWidget *box, *hbox, *vbox, *hbox2, *label, *scale; |
1442 |
> |
GtkWidget *box, *hbox, *table, *label, *menu; |
1443 |
|
|
1444 |
|
box = make_pane(top, STR_MEMORY_MISC_PANE_TITLE); |
1445 |
+ |
table = make_table(box, 2, 5); |
1446 |
|
|
1447 |
< |
hbox = gtk_hbox_new(FALSE, 4); |
1448 |
< |
gtk_widget_show(hbox); |
1449 |
< |
|
1450 |
< |
label = gtk_label_new(GetString(STR_RAMSIZE_SLIDER)); |
1451 |
< |
gtk_widget_show(label); |
1452 |
< |
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
1453 |
< |
|
1454 |
< |
vbox = gtk_vbox_new(FALSE, 4); |
1455 |
< |
gtk_widget_show(vbox); |
1456 |
< |
|
1457 |
< |
gfloat min, max; |
1458 |
< |
min = 1; |
1459 |
< |
max = 1024; |
1460 |
< |
w_ramsize_adj = gtk_adjustment_new(min, min, max, 1, 16, 0); |
1461 |
< |
gtk_adjustment_set_value(GTK_ADJUSTMENT(w_ramsize_adj), PrefsFindInt32("ramsize") >> 20); |
1462 |
< |
|
1174 |
< |
scale = gtk_hscale_new(GTK_ADJUSTMENT(w_ramsize_adj)); |
1175 |
< |
gtk_widget_show(scale); |
1176 |
< |
gtk_scale_set_digits(GTK_SCALE(scale), 0); |
1177 |
< |
gtk_box_pack_start(GTK_BOX(vbox), scale, TRUE, TRUE, 0); |
1178 |
< |
|
1179 |
< |
hbox2 = gtk_hbox_new(FALSE, 4); |
1180 |
< |
gtk_widget_show(hbox2); |
1181 |
< |
|
1182 |
< |
char val[32]; |
1183 |
< |
sprintf(val, GetString(STR_RAMSIZE_FMT), int(min)); |
1184 |
< |
label = gtk_label_new(val); |
1185 |
< |
gtk_widget_show(label); |
1186 |
< |
gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0); |
1187 |
< |
|
1188 |
< |
sprintf(val, GetString(STR_RAMSIZE_FMT), int(max)); |
1189 |
< |
label = gtk_label_new(val); |
1190 |
< |
gtk_widget_show(label); |
1191 |
< |
gtk_box_pack_end(GTK_BOX(hbox2), label, FALSE, FALSE, 0); |
1192 |
< |
gtk_box_pack_start(GTK_BOX(vbox), hbox2, TRUE, TRUE, 0); |
1193 |
< |
gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 0); |
1194 |
< |
gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0); |
1447 |
> |
static const combo_desc options[] = { |
1448 |
> |
STR_RAMSIZE_2MB_LAB, |
1449 |
> |
STR_RAMSIZE_4MB_LAB, |
1450 |
> |
STR_RAMSIZE_8MB_LAB, |
1451 |
> |
STR_RAMSIZE_16MB_LAB, |
1452 |
> |
STR_RAMSIZE_32MB_LAB, |
1453 |
> |
STR_RAMSIZE_64MB_LAB, |
1454 |
> |
STR_RAMSIZE_128MB_LAB, |
1455 |
> |
STR_RAMSIZE_256MB_LAB, |
1456 |
> |
STR_RAMSIZE_512MB_LAB, |
1457 |
> |
STR_RAMSIZE_1024MB_LAB, |
1458 |
> |
0 |
1459 |
> |
}; |
1460 |
> |
char default_ramsize[10]; |
1461 |
> |
sprintf(default_ramsize, "%d", PrefsFindInt32("ramsize") >> 20); |
1462 |
> |
w_ramsize = table_make_combobox(table, 0, STR_RAMSIZE_CTRL, default_ramsize, options); |
1463 |
|
|
1464 |
|
static const opt_desc model_options[] = { |
1465 |
|
{STR_MODELID_5_LAB, GTK_SIGNAL_FUNC(mn_modelid_5)}, |
1471 |
|
case 5: active = 0; break; |
1472 |
|
case 14: active = 1; break; |
1473 |
|
} |
1474 |
< |
make_option_menu(box, STR_MODELID_CTRL, model_options, active); |
1474 |
> |
table_make_option_menu(table, 2, STR_MODELID_CTRL, model_options, active); |
1475 |
|
|
1476 |
|
#if EMULATED_68K |
1477 |
|
static const opt_desc cpu_options[] = { |
1490 |
|
case 3: active = fpu ? 3 : 2; break; |
1491 |
|
case 4: active = 4; |
1492 |
|
} |
1493 |
< |
make_option_menu(box, STR_CPU_CTRL, cpu_options, active); |
1493 |
> |
table_make_option_menu(table, 3, STR_CPU_CTRL, cpu_options, active); |
1494 |
|
#endif |
1495 |
|
|
1496 |
< |
w_rom_file = make_file_entry(box, STR_ROM_FILE_CTRL, "rom"); |
1496 |
> |
w_rom_file = table_make_file_entry(table, 4, STR_ROM_FILE_CTRL, "rom"); |
1497 |
> |
|
1498 |
> |
#ifdef HAVE_SIGSEGV_SKIP_INSTRUCTION |
1499 |
> |
make_checkbox(box, STR_IGNORESEGV_CTRL, "ignoresegv", GTK_SIGNAL_FUNC(tb_ignoresegv)); |
1500 |
> |
#endif |
1501 |
|
} |
1502 |
|
|
1503 |
|
|
1513 |
|
read_input_settings(); |
1514 |
|
read_serial_settings(); |
1515 |
|
read_memory_settings(); |
1516 |
+ |
read_jit_settings(); |
1517 |
|
} |