ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Unix/prefs_editor_gtk.cpp
(Generate patch)

Comparing BasiliskII/src/Unix/prefs_editor_gtk.cpp (file contents):
Revision 1.22 by gbeauche, 2002-05-12T11:10:50Z vs.
Revision 1.23 by gbeauche, 2002-09-17T16:06:37Z

# Line 52 | Line 52 | static void create_graphics_pane(GtkWidg
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  
# Line 64 | Line 65 | struct opt_desc {
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));
# Line 203 | Line 208 | static GtkWidget *make_checkbox(GtkWidge
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
# Line 369 | Line 404 | bool PrefsEditor(void)
404          create_input_pane(notebook);
405          create_serial_pane(notebook);
406          create_memory_pane(notebook);
407 +        create_jit_pane(notebook);
408  
409          static const opt_desc buttons[] = {
410                  {STR_START_BUTTON, GTK_SIGNAL_FUNC(cb_start)},
# Line 546 | Line 582 | static void create_volumes_pane(GtkWidge
582  
583  
584   /*
585 + *  "JIT Compiler" pane
586 + */
587 +
588 + static GtkWidget *w_jit_fpu;
589 + static GtkWidget *w_jit_atraps;
590 + static GtkWidget *w_jit_cache_size;
591 + static GtkWidget *w_jit_lazy_flush;
592 +
593 + // Set sensitivity of widgets
594 + static void set_jit_sensitive(void)
595 + {
596 +        const bool jit_enabled = PrefsFindBool("jit");
597 +        gtk_widget_set_sensitive(w_jit_fpu, jit_enabled);
598 +        gtk_widget_set_sensitive(w_jit_cache_size, jit_enabled);
599 +        gtk_widget_set_sensitive(w_jit_lazy_flush, jit_enabled);
600 + }
601 +
602 + // "Use JIT Compiler" button toggled
603 + static void tb_jit(GtkWidget *widget)
604 + {
605 +        PrefsReplaceBool("jit", GTK_TOGGLE_BUTTON(widget)->active);
606 +        set_jit_sensitive();
607 + }
608 +
609 + // "Compile FPU Instructions" button toggled
610 + static void tb_jit_fpu(GtkWidget *widget)
611 + {
612 +        PrefsReplaceBool("jitfpu", GTK_TOGGLE_BUTTON(widget)->active);
613 + }
614 +
615 + // "Lazy translation cache invalidation" button toggled
616 + static void tb_jit_lazy_flush(GtkWidget *widget)
617 + {
618 +        PrefsReplaceBool("jitlazyflush", GTK_TOGGLE_BUTTON(widget)->active);
619 + }
620 +
621 + // Read settings from widgets and set preferences
622 + static void read_jit_settings(void)
623 + {
624 + #if USE_JIT
625 +        bool jit_enabled = PrefsFindBool("jit");
626 +        if (jit_enabled) {
627 +                const char *str = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(w_jit_cache_size)->entry));
628 +                PrefsReplaceInt32("jitcachesize", atoi(str));
629 +        }
630 + #endif
631 + }
632 +
633 + // Create "JIT Compiler" pane
634 + static void create_jit_pane(GtkWidget *top)
635 + {
636 + #if USE_JIT
637 +        GtkWidget *box, *table, *label, *menu;
638 +        char str[32];
639 +        
640 +        box = make_pane(top, STR_JIT_PANE_TITLE);
641 +        make_checkbox(box, STR_JIT_CTRL, "jit", GTK_SIGNAL_FUNC(tb_jit));
642 +        
643 +        w_jit_fpu = make_checkbox(box, STR_JIT_FPU_CTRL, "jitfpu", GTK_SIGNAL_FUNC(tb_jit_fpu));
644 +        
645 +        // Translation cache size
646 +        static const combo_desc options[] = {
647 +                STR_JIT_CACHE_SIZE_2MB_LAB,
648 +                STR_JIT_CACHE_SIZE_4MB_LAB,
649 +                STR_JIT_CACHE_SIZE_8MB_LAB,
650 +                STR_JIT_CACHE_SIZE_16MB_LAB,
651 +                0
652 +        };
653 +        w_jit_cache_size = make_combobox(box, STR_JIT_CACHE_SIZE_CTRL, "jitcachesize", options);
654 +        
655 +        // Lazy translation cache invalidation
656 +        w_jit_lazy_flush = make_checkbox(box, STR_JIT_LAZY_CINV_CTRL, "jitlazyflush", GTK_SIGNAL_FUNC(tb_jit_lazy_flush));
657 +        
658 +        set_jit_sensitive();
659 + #endif
660 + }
661 +
662 + /*
663   *  "SCSI" pane
664   */
665  
# Line 1253 | Line 1367 | static void read_settings(void)
1367          read_input_settings();
1368          read_serial_settings();
1369          read_memory_settings();
1370 +        read_jit_settings();
1371   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines