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

Comparing BasiliskII/src/Windows/prefs_editor_gtk.cpp (file contents):
Revision 1.8 by gbeauche, 2005-11-27T23:51:47Z vs.
Revision 1.9 by gbeauche, 2005-11-29T20:54:57Z

# Line 323 | Line 323 | static GtkWidget *make_checkbox(GtkWidge
323          return button;
324   }
325  
326 < static GtkWidget *make_combobox(GtkWidget *top, int label_id, const char *prefs_item, const combo_desc *options)
326 > static GtkWidget *make_combobox(GtkWidget *top, int label_id, const char *default_value, GList *glist)
327   {
328          GtkWidget *box, *label, *combo;
329        char str[32];
329  
330          box = gtk_hbox_new(FALSE, 4);
331          gtk_widget_show(box);
# Line 335 | Line 334 | static GtkWidget *make_combobox(GtkWidge
334          label = gtk_label_new(GetString(label_id));
335          gtk_widget_show(label);
336          gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 0);
338
339        GList *glist = NULL;
340        while (options->label_id) {
341                glist = g_list_append(glist, (void *)GetString(options->label_id));
342                options++;
343        }
337          
338          combo = gtk_combo_new();
339          gtk_widget_show(combo);
340          gtk_combo_set_popdown_strings(GTK_COMBO(combo), glist);
341          
342 <        sprintf(str, "%d", PrefsFindInt32(prefs_item));
350 <        gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo)->entry), str);
342 >        gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo)->entry), default_value);
343          gtk_box_pack_start(GTK_BOX(box), combo, TRUE, TRUE, 0);
344          
345          return combo;
346   }
347  
348 + static GtkWidget *make_combobox(GtkWidget *top, int label_id, const char *default_value, const combo_desc *options)
349 + {
350 +        GList *glist = NULL;
351 +        while (options->label_id) {
352 +                glist = g_list_append(glist, (void *)GetString(options->label_id));
353 +                options++;
354 +        }
355 +
356 +        return make_combobox(top, label_id, default_value, glist);
357 + }
358 +
359  
360   /*
361   *  Show preferences editor
# Line 512 | Line 515 | bool PrefsEditor(void)
515   *  "Volumes" pane
516   */
517  
518 < static GtkWidget *w_enableextfs, *w_extdrives;
518 > static GtkWidget *w_enableextfs, *w_extdrives, *w_cdrom_drive;
519   static GtkWidget *volume_list;
520   static int selected_volume;
521  
# Line 521 | Line 524 | static void set_volumes_sensitive(void)
524   {
525          const bool enable_extfs = PrefsFindBool("enableextfs");
526          gtk_widget_set_sensitive(w_extdrives, enable_extfs);
527 +        const bool no_cdrom = PrefsFindBool("nocdrom");
528 +        gtk_widget_set_sensitive(w_cdrom_drive, !no_cdrom);
529   }
530  
531   // Volume in list selected
# Line 611 | Line 616 | static void tb_enableextfs(GtkWidget *wi
616   static void tb_nocdrom(GtkWidget *widget)
617   {
618          PrefsReplaceBool("nocdrom", GTK_TOGGLE_BUTTON(widget)->active);
619 +        set_volumes_sensitive();
620 + }
621 +
622 + // Add names of CD-ROM devices
623 + static GList *add_cdrom_names(void)
624 + {
625 +        GList *glist = NULL;
626 +
627 +        char rootdir[4] = "X:\\";
628 +        for (char letter = 'C'; letter <= 'Z'; letter++) {
629 +                rootdir[0] = letter;
630 +                if (GetDriveType(rootdir) == DRIVE_CDROM)
631 +                        glist = g_list_append(glist, strdup(rootdir));
632 +        }
633 +
634 +        return glist;
635   }
636  
637   // "Enable polling" button toggled
# Line 631 | Line 652 | static void read_volumes_settings(void)
652                  PrefsAddString("disk", str);
653          }
654  
655 +        const char *str = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(w_cdrom_drive)->entry));
656 +        if (str && strlen(str))
657 +                PrefsReplaceString("cdrom", str);
658 +        else
659 +                PrefsRemoveItem("cdrom");
660 +
661          PrefsReplaceString("extdrives", get_file_entry_path(w_extdrives));
662   }
663  
# Line 681 | Line 708 | static void create_volumes_pane(GtkWidge
708  
709          make_checkbox(box, STR_NOCDROM_CTRL, "nocdrom", GTK_SIGNAL_FUNC(tb_nocdrom));
710  
711 +        GList *glist = add_cdrom_names();
712 +        str = const_cast<char *>(PrefsFindString("cdrom"));
713 +        if (str == NULL)
714 +                str = "";
715 +        w_cdrom_drive = make_combobox(box, STR_CDROM_DRIVE_CTRL, str, glist);
716 +
717          make_checkbox(box, STR_POLLMEDIA_CTRL, "pollmedia", GTK_SIGNAL_FUNC(tb_pollmedia));
718  
719          make_separator(box);
# Line 789 | Line 822 | static void create_jit_pane(GtkWidget *t
822                  STR_JIT_CACHE_SIZE_16MB_LAB,
823                  0
824          };
825 <        w_jit_cache_size = make_combobox(box, STR_JIT_CACHE_SIZE_CTRL, "jitcachesize", options);
825 >        sprintf(str, "%d", PrefsFindInt32("jitcachesize"));
826 >        w_jit_cache_size = make_combobox(box, STR_JIT_CACHE_SIZE_CTRL, str, options);
827          
828          // Lazy translation cache invalidation
829          w_jit_lazy_flush = make_checkbox(box, STR_JIT_LAZY_CINV_CTRL, "jitlazyflush", GTK_SIGNAL_FUNC(tb_jit_lazy_flush));

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines