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.6 by gbeauche, 2005-11-20T23:59:18Z vs.
Revision 1.13 by gbeauche, 2006-04-30T21:46:31Z

# Line 32 | Line 32
32   #include "xpram.h"
33   #include "prefs.h"
34   #include "prefs_editor.h"
35 + #include "util_windows.h"
36 + #include "b2ether/inc/b2ether_hl.h"
37  
38  
39   // Global variables
# Line 52 | Line 54 | static void read_settings(void);
54  
55  
56   /*
57 + *  SheepShaver glue
58 + */
59 +
60 + #ifdef SHEEPSHAVER
61 + #define DISABLE_SCSI 1
62 + #define PROGRAM_NAME "SheepShaver"
63 + enum {
64 +        STR_WINDOW_LAB = STR_WINDOW_CTRL,
65 +        STR_FULLSCREEN_LAB = STR_FULLSCREEN_CTRL,
66 +        STR_SERIALA_CTRL = STR_SERPORTA_CTRL,
67 +        STR_SERIALB_CTRL = STR_SERPORTB_CTRL,
68 + };
69 + #else
70 + #define DISABLE_SCSI 1 /* XXX merge code from original Basilisk II for Windows */
71 + #define PROGRAM_NAME "BasiliskII"
72 + #endif
73 +
74 +
75 + /*
76   *  Utility functions
77   */
78  
# Line 97 | Line 118 | static GtkWidget *make_browse_button(Gtk
118          return button;
119   }
120  
121 < static void add_menu_item(GtkWidget *menu, int label_id, GtkSignalFunc func)
121 > static void add_menu_item(GtkWidget *menu, const char *label, GtkSignalFunc func, gpointer data = NULL)
122   {
123 <        GtkWidget *item = gtk_menu_item_new_with_label(GetString(label_id));
123 >        GtkWidget *item = gtk_menu_item_new_with_label(label);
124          gtk_widget_show(item);
125 <        gtk_signal_connect(GTK_OBJECT(item), "activate", func, NULL);
125 >        gtk_signal_connect(GTK_OBJECT(item), "activate", func, data);
126          gtk_menu_append(GTK_MENU(menu), item);
127   }
128  
129 + static void add_menu_item(GtkWidget *menu, int label_id, GtkSignalFunc func)
130 + {
131 +        add_menu_item(menu, GetString(label_id), func, NULL);
132 + }
133 +
134   static GtkWidget *make_pane(GtkWidget *notebook, int title_id)
135   {
136          GtkWidget *frame, *label, *box;
# Line 305 | Line 331 | static GtkWidget *make_checkbox(GtkWidge
331          return button;
332   }
333  
334 < static GtkWidget *make_combobox(GtkWidget *top, int label_id, const char *prefs_item, const combo_desc *options)
334 > static GtkWidget *make_combobox(GtkWidget *top, int label_id, const char *default_value, GList *glist)
335   {
336          GtkWidget *box, *label, *combo;
311        char str[32];
337  
338          box = gtk_hbox_new(FALSE, 4);
339          gtk_widget_show(box);
# Line 317 | Line 342 | static GtkWidget *make_combobox(GtkWidge
342          label = gtk_label_new(GetString(label_id));
343          gtk_widget_show(label);
344          gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 0);
320
321        GList *glist = NULL;
322        while (options->label_id) {
323                glist = g_list_append(glist, (void *)GetString(options->label_id));
324                options++;
325        }
345          
346          combo = gtk_combo_new();
347          gtk_widget_show(combo);
348          gtk_combo_set_popdown_strings(GTK_COMBO(combo), glist);
349          
350 <        sprintf(str, "%d", PrefsFindInt32(prefs_item));
332 <        gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo)->entry), str);
350 >        gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo)->entry), default_value);
351          gtk_box_pack_start(GTK_BOX(box), combo, TRUE, TRUE, 0);
352          
353          return combo;
354   }
355  
356 + static GtkWidget *make_combobox(GtkWidget *top, int label_id, const char *default_value, const combo_desc *options)
357 + {
358 +        GList *glist = NULL;
359 +        while (options->label_id) {
360 +                glist = g_list_append(glist, (void *)GetString(options->label_id));
361 +                options++;
362 +        }
363 +
364 +        return make_combobox(top, label_id, default_value, glist);
365 + }
366 +
367  
368   /*
369   *  Show preferences editor
# Line 390 | Line 419 | static void cb_about(...)
419  
420          char str[512];
421          sprintf(str,
422 <                "Basilisk II\nVersion %d.%d\n\n"
422 >                PROGRAM_NAME "\nVersion %d.%d\n\n"
423                  "Copyright (C) 1997-2005 Christian Bauer et al.\n"
424 <                "E-mail: Christian.Bauer@uni-mainz.de\n"
425 <                "http://www.uni-mainz.de/~bauec002/B2Main.html\n\n"
426 <                "Basilisk II comes with ABSOLUTELY NO\n"
424 >                "E-mail: cb@cebix.net\n"
425 > #ifdef SHEEPSHAVER
426 >                "http://sheepshaver.cebix.net/\n\n"
427 > #else
428 >                "http://basilisk.cebix.net/\n\n"
429 > #endif
430 >                PROGRAM_NAME " comes with ABSOLUTELY NO\n"
431                  "WARRANTY. This is free software, and\n"
432                  "you are welcome to redistribute it\n"
433                  "under the terms of the GNU General\n"
# Line 432 | Line 465 | static GtkItemFactoryEntry menu_items[]
465          {(gchar *)GetString(STR_HELP_ITEM_ABOUT_GTK),           "<control>H",   GTK_SIGNAL_FUNC(cb_about),              0, NULL}
466   };
467  
468 + void PrefsMigrate(void)
469 + {
470 +        // Ethernet
471 +        const char *ether = PrefsFindString("ether");
472 +        if (ether && ether[0] == '{') {
473 +                PrefsReplaceString("etherguid", ether);
474 +                PrefsReplaceString("ether", "b2ether");
475 +        }
476 +        if (PrefsFindBool("routerenabled")) {
477 +                PrefsRemoveItem("etherguid");
478 +                PrefsReplaceString("ether", "router");
479 +        }
480 + }
481 +
482   bool PrefsEditor(void)
483   {
484          // Create window
# Line 464 | Line 511 | bool PrefsEditor(void)
511          gtk_box_pack_start(GTK_BOX(box), notebook, TRUE, TRUE, 0);
512  
513          create_volumes_pane(notebook);
514 < //      create_scsi_pane(notebook); XXX not ready yet (merge scsi_windows.cpp from original B2/Win)
514 > #ifndef DISABLE_SCSI
515 >        create_scsi_pane(notebook);
516 > #endif
517          create_graphics_pane(notebook);
518          create_input_pane(notebook);
519          create_serial_pane(notebook);
# Line 490 | Line 539 | bool PrefsEditor(void)
539   *  "Volumes" pane
540   */
541  
542 < static GtkWidget *w_enableextfs, *w_extdrives;
542 > static GtkWidget *w_enableextfs, *w_extdrives, *w_cdrom_drive;
543   static GtkWidget *volume_list;
544   static int selected_volume;
545  
# Line 499 | Line 548 | static void set_volumes_sensitive(void)
548   {
549          const bool enable_extfs = PrefsFindBool("enableextfs");
550          gtk_widget_set_sensitive(w_extdrives, enable_extfs);
551 +        const bool no_cdrom = PrefsFindBool("nocdrom");
552 +        gtk_widget_set_sensitive(w_cdrom_drive, !no_cdrom);
553   }
554  
555   // Volume in list selected
# Line 589 | Line 640 | static void tb_enableextfs(GtkWidget *wi
640   static void tb_nocdrom(GtkWidget *widget)
641   {
642          PrefsReplaceBool("nocdrom", GTK_TOGGLE_BUTTON(widget)->active);
643 +        set_volumes_sensitive();
644 + }
645 +
646 + // Add names of CD-ROM devices
647 + static GList *add_cdrom_names(void)
648 + {
649 +        GList *glist = NULL;
650 +
651 +        char rootdir[4] = "X:\\";
652 +        for (char letter = 'C'; letter <= 'Z'; letter++) {
653 +                rootdir[0] = letter;
654 +                if (GetDriveType(rootdir) == DRIVE_CDROM)
655 +                        glist = g_list_append(glist, strdup(rootdir));
656 +        }
657 +
658 +        return glist;
659   }
660  
661   // "Enable polling" button toggled
# Line 609 | Line 676 | static void read_volumes_settings(void)
676                  PrefsAddString("disk", str);
677          }
678  
679 +        const char *str = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(w_cdrom_drive)->entry));
680 +        if (str && strlen(str))
681 +                PrefsReplaceString("cdrom", str);
682 +        else
683 +                PrefsRemoveItem("cdrom");
684 +
685          PrefsReplaceString("extdrives", get_file_entry_path(w_extdrives));
686   }
687  
# Line 659 | Line 732 | static void create_volumes_pane(GtkWidge
732  
733          make_checkbox(box, STR_NOCDROM_CTRL, "nocdrom", GTK_SIGNAL_FUNC(tb_nocdrom));
734  
735 +        GList *glist = add_cdrom_names();
736 +        str = const_cast<char *>(PrefsFindString("cdrom"));
737 +        if (str == NULL)
738 +                str = "";
739 +        w_cdrom_drive = make_combobox(box, STR_CDROM_DRIVE_CTRL, str, glist);
740 +
741          make_checkbox(box, STR_POLLMEDIA_CTRL, "pollmedia", GTK_SIGNAL_FUNC(tb_pollmedia));
742  
743          make_separator(box);
# Line 673 | Line 752 | static void create_volumes_pane(GtkWidge
752   *  "JIT Compiler" pane
753   */
754  
755 + #ifndef SHEEPSHAVER
756   static GtkWidget *w_jit_fpu;
757   static GtkWidget *w_jit_atraps;
758   static GtkWidget *w_jit_cache_size;
759   static GtkWidget *w_jit_lazy_flush;
760   static GtkWidget *w_jit_follow_const_jumps;
761 + #endif
762  
763   // Set sensitivity of widgets
764   static void set_jit_sensitive(void)
765   {
766 + #ifndef SHEEPSHAVER
767          const bool jit_enabled = PrefsFindBool("jit");
768          gtk_widget_set_sensitive(w_jit_fpu, jit_enabled);
769          gtk_widget_set_sensitive(w_jit_cache_size, jit_enabled);
770          gtk_widget_set_sensitive(w_jit_lazy_flush, jit_enabled);
771          gtk_widget_set_sensitive(w_jit_follow_const_jumps, jit_enabled);
772 + #endif
773   }
774  
775   // "Use JIT Compiler" button toggled
# Line 697 | Line 780 | static void tb_jit(GtkWidget *widget)
780   }
781  
782   // "Compile FPU Instructions" button toggled
783 + #ifndef SHEEPSHAVER
784   static void tb_jit_fpu(GtkWidget *widget)
785   {
786          PrefsReplaceBool("jitfpu", GTK_TOGGLE_BUTTON(widget)->active);
787   }
788 + #endif
789  
790   // "Lazy translation cache invalidation" button toggled
791 + #ifndef SHEEPSHAVER
792   static void tb_jit_lazy_flush(GtkWidget *widget)
793   {
794          PrefsReplaceBool("jitlazyflush", GTK_TOGGLE_BUTTON(widget)->active);
795   }
796 + #endif
797  
798   // "Translate through constant jumps (inline blocks)" button toggled
799 + #ifndef SHEEPSHAVER
800   static void tb_jit_follow_const_jumps(GtkWidget *widget)
801   {
802          PrefsReplaceBool("jitinline", GTK_TOGGLE_BUTTON(widget)->active);
803   }
804 + #endif
805  
806   // Read settings from widgets and set preferences
807   static void read_jit_settings(void)
# Line 720 | Line 809 | static void read_jit_settings(void)
809   #if USE_JIT
810          bool jit_enabled = PrefsFindBool("jit");
811          if (jit_enabled) {
812 + #ifndef SHEEPSHAVER
813                  const char *str = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(w_jit_cache_size)->entry));
814                  PrefsReplaceInt32("jitcachesize", atoi(str));
815 + #endif
816          }
817   #endif
818   }
819  
820 + // "Use built-in 68k DR emulator" button toggled
821 + #ifdef SHEEPSHAVER
822 + static void tb_jit_68k(GtkWidget *widget)
823 + {
824 +        PrefsReplaceBool("jit68k", GTK_TOGGLE_BUTTON(widget)->active);
825 + }
826 + #endif
827 +
828   // Create "JIT Compiler" pane
829   static void create_jit_pane(GtkWidget *top)
830   {
# Line 736 | Line 835 | static void create_jit_pane(GtkWidget *t
835          box = make_pane(top, STR_JIT_PANE_TITLE);
836          make_checkbox(box, STR_JIT_CTRL, "jit", GTK_SIGNAL_FUNC(tb_jit));
837          
838 + #ifndef SHEEPSHAVER
839          w_jit_fpu = make_checkbox(box, STR_JIT_FPU_CTRL, "jitfpu", GTK_SIGNAL_FUNC(tb_jit_fpu));
840          
841          // Translation cache size
# Line 746 | Line 846 | static void create_jit_pane(GtkWidget *t
846                  STR_JIT_CACHE_SIZE_16MB_LAB,
847                  0
848          };
849 <        w_jit_cache_size = make_combobox(box, STR_JIT_CACHE_SIZE_CTRL, "jitcachesize", options);
849 >        sprintf(str, "%d", PrefsFindInt32("jitcachesize"));
850 >        w_jit_cache_size = make_combobox(box, STR_JIT_CACHE_SIZE_CTRL, str, options);
851          
852          // Lazy translation cache invalidation
853          w_jit_lazy_flush = make_checkbox(box, STR_JIT_LAZY_CINV_CTRL, "jitlazyflush", GTK_SIGNAL_FUNC(tb_jit_lazy_flush));
854  
855          // Follow constant jumps (inline basic blocks)
856          w_jit_follow_const_jumps = make_checkbox(box, STR_JIT_FOLLOW_CONST_JUMPS, "jitinline", GTK_SIGNAL_FUNC(tb_jit_follow_const_jumps));
857 + #endif
858  
859          set_jit_sensitive();
860   #endif
861 +
862 + #ifdef SHEEPSHAVER
863 +        make_checkbox(box, STR_JIT_68K_CTRL, "jit68k", GTK_SIGNAL_FUNC(tb_jit_68k));
864 + #endif
865   }
866  
867   /*
# Line 767 | Line 873 | static GtkWidget *w_scsi[7];
873   // Read settings from widgets and set preferences
874   static void read_scsi_settings(void)
875   {
876 + #ifndef DISABLE_SCSI
877          for (int id=0; id<7; id++) {
878                  char prefs_name[32];
879                  sprintf(prefs_name, "scsi%d", id);
# Line 776 | Line 883 | static void read_scsi_settings(void)
883                  else
884                          PrefsRemoveItem(prefs_name);
885          }
886 + #endif
887   }
888  
889   // Create "SCSI" pane
890   static void create_scsi_pane(GtkWidget *top)
891   {
892 + #ifndef DISABLE_SCSI
893          GtkWidget *box;
894  
895          box = make_pane(top, STR_SCSI_PANE_TITLE);
# Line 790 | Line 899 | static void create_scsi_pane(GtkWidget *
899                  sprintf(prefs_name, "scsi%d", id);
900                  w_scsi[id] = make_file_entry(box, STR_SCSI_ID_0 + id, prefs_name);
901          }
902 + #endif
903   }
904  
905  
# Line 833 | Line 943 | static void mn_fullscreen(...)
943   {
944          display_type = DISPLAY_SCREEN;
945          hide_show_graphics_widgets();
946 +        PrefsReplaceInt32("frameskip", 1);
947   }
948  
949   // "5 Hz".."60Hz" selected
# Line 844 | Line 955 | static void mn_30hz(...) {PrefsReplaceIn
955   static void mn_60hz(...) {PrefsReplaceInt32("frameskip", 1);}
956   static void mn_dynamic(...) {PrefsReplaceInt32("frameskip", 0);}
957  
958 + // QuickDraw acceleration
959 + #ifdef SHEEPSHAVER
960 + static void tb_gfxaccel(GtkWidget *widget)
961 + {
962 +        PrefsReplaceBool("gfxaccel", GTK_TOGGLE_BUTTON(widget)->active);
963 + }
964 + #endif
965 +
966   // Set sensitivity of widgets
967   static void set_graphics_sensitive(void)
968   {
# Line 861 | Line 980 | static void tb_nosound(GtkWidget *widget
980   static void parse_graphics_prefs(void)
981   {
982          display_type = DISPLAY_WINDOW;
983 + #ifdef SHEEPSHAVER
984 +        dis_width = 640;
985 +        dis_height = 480;
986 + #else
987          dis_width = 512;
988          dis_height = 384;
989 + #endif
990  
991          const char *str = PrefsFindString("screen");
992          if (str) {
# Line 1002 | Line 1126 | static void create_graphics_pane(GtkWidg
1126          gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 3, 4, (GtkAttachOptions)GTK_FILL, (GtkAttachOptions)0, 4, 4);
1127          w_display_y = GTK_COMBO(combo)->entry;
1128  
1129 + #ifdef SHEEPSHAVER
1130 +        make_checkbox(box, STR_GFXACCEL_CTRL, "gfxaccel", GTK_SIGNAL_FUNC(tb_gfxaccel));
1131 + #endif
1132 +
1133          make_separator(box);
1134          make_checkbox(box, STR_NOSOUND_CTRL, "nosound", GTK_SIGNAL_FUNC(tb_nosound));
1135  
# Line 1214 | Line 1342 | static void create_serial_pane(GtkWidget
1342   *  "Ethernet" pane
1343   */
1344  
1217 static GtkWidget *w_ether;
1345   static GtkWidget *w_ftp_port_list, *w_tcp_port_list;
1219 static const char s_nat_router[] = "NAT/Router module";
1346  
1347   // Set sensitivity of widgets
1348   static void set_ethernet_sensitive(void)
1349   {
1350 <        const char *str = gtk_entry_get_text(GTK_ENTRY(w_ether));
1350 >        const char *str = PrefsFindString("ether");
1351  
1352 <        bool is_nat_router = strcmp(str, s_nat_router) == 0;
1353 <        gtk_widget_set_sensitive(w_ftp_port_list, is_nat_router);
1354 <        gtk_widget_set_sensitive(w_tcp_port_list, is_nat_router);
1352 >        bool is_router = str && strcmp(str, "router") == 0;
1353 >        gtk_widget_set_sensitive(w_ftp_port_list, is_router);
1354 >        gtk_widget_set_sensitive(w_tcp_port_list, is_router);
1355   }
1356  
1357   // Read settings from widgets and set preferences
1358   static void read_ethernet_settings(void)
1359   {
1360 <        const char *str = gtk_entry_get_text(GTK_ENTRY(w_ether));
1235 <        if (str && strlen(str) > 6 && strncmp(str, "NDIS: ", 6) == 0)
1236 <                PrefsReplaceString("ether", &str[6]);
1237 <        else
1238 <                PrefsRemoveItem("ether");
1360 >        const char *str = PrefsFindString("ether");
1361  
1362 <        const bool router_enabled = str && strcmp(str, s_nat_router) == 0;
1363 <        PrefsReplaceBool("routerenabled", router_enabled);
1242 <        if (router_enabled) {
1362 >        bool is_router = str && strcmp(str, "router") == 0;
1363 >        if (is_router) {
1364                  str = gtk_entry_get_text(GTK_ENTRY(w_ftp_port_list));
1365                  PrefsReplaceString("ftp_port_list", str);
1366                  str = gtk_entry_get_text(GTK_ENTRY(w_tcp_port_list));
# Line 1253 | Line 1374 | static void cb_ether_changed(...)
1374          set_ethernet_sensitive();
1375   }
1376  
1377 < // Add names of ethernet interfaces
1378 < static GList *add_ether_names(void)
1377 > // Ethernet option "None" selected
1378 > static void mn_ether_none(void)
1379   {
1380 <        GList *glist = NULL;
1381 <
1261 <        // TODO: Get list of all Ethernet interfaces
1262 < #ifdef HAVE_SLIRP
1263 <        static const char s_slirp[] = "slirp";
1264 <        glist = g_list_append(glist, (void *)s_slirp);
1265 < #endif
1266 <        glist = g_list_append(glist, (void *)s_nat_router);
1267 <        glist = g_list_append(glist, (void *)GetString(STR_NONE_LAB));
1268 <        return glist;
1380 >        PrefsRemoveItem("ether");
1381 >        PrefsRemoveItem("etherguid");
1382   }
1383  
1384 + // Ethernet option "Basilisk II Router" selected
1385 + static void mn_ether_router(void)
1386 + {
1387 +        PrefsReplaceString("ether", "router");
1388 +        PrefsRemoveItem("etherguid");
1389 + }
1390 +
1391 + // Ethernet option "Basilisk II Slirp" selected
1392 + static void mn_ether_slirp(void)
1393 + {
1394 +        PrefsReplaceString("ether", "slirp");
1395 +        PrefsRemoveItem("etherguid");
1396 + }
1397 +
1398 + // Ethernet option for Basilisk II driver selected
1399 + static void mn_ether_b2ether(GtkWidget *, const char *guid)
1400 + {
1401 +        PrefsReplaceString("ether", "b2ether");
1402 +        PrefsReplaceString("etherguid", guid);
1403 + }
1404 +
1405 + // Create ethernet interfaces menu
1406 + static int create_ether_menu(GtkWidget *menu)
1407 + {
1408 +        int active = -1;
1409 +        int n_items = 0;
1410 +        const char *ether = PrefsFindString("ether");
1411 +        const char *etherguid = PrefsFindString("etherguid");
1412 +
1413 +        add_menu_item(menu, STR_NONE_LAB, (GtkSignalFunc)mn_ether_none);
1414 +        if (ether == NULL)
1415 +                active = n_items;
1416 +        n_items++;
1417 +
1418 +        add_menu_item(menu, "Basilisk II Router", (GtkSignalFunc)mn_ether_router);
1419 +        if (ether && strcmp(ether, "router") == 0)
1420 +                active = n_items;
1421 +        n_items++;
1422 +
1423 +        add_menu_item(menu, "Basilisk II Slirp", (GtkSignalFunc)mn_ether_router);
1424 +        if (ether && strcmp(ether, "slirp") == 0)
1425 +                active = n_items;
1426 +        n_items++;
1427 +
1428 +        PacketOpenAdapter("", 0);
1429 +        {
1430 +                ULONG sz;
1431 +                char names[1024];
1432 +                sz = sizeof(names);
1433 +                if (PacketGetAdapterNames(NULL, names, &sz) == ERROR_SUCCESS) {
1434 +                        char *p = names;
1435 +                        while (*p) {
1436 +                                const char DEVICE_HEADER[] = "\\Device\\B2ether_";
1437 +                                if (strnicmp(p, DEVICE_HEADER, sizeof(DEVICE_HEADER) - 1) == 0) {
1438 +                                        LPADAPTER fd = PacketOpenAdapter(p + sizeof(DEVICE_HEADER) - 1, 0);
1439 +                                        if (fd) {
1440 +                                                char guid[256];
1441 +                                                sprintf(guid, "%s", p + sizeof(DEVICE_HEADER) - 1);
1442 +                                                const char *name = ether_guid_to_name(guid);
1443 +                                                if (name && (name = g_locale_to_utf8(name, -1, NULL, NULL, NULL))) {
1444 +                                                        add_menu_item(menu, name, (GtkSignalFunc)mn_ether_b2ether, strdup(guid));
1445 +                                                        if (etherguid && strcmp(guid, etherguid) == 0 &&
1446 +                                                                ether && strcmp(ether, "b2ether") == 0)
1447 +                                                                active = n_items;
1448 +                                                        n_items++;
1449 +                                                }
1450 +                                                PacketCloseAdapter(fd);
1451 +                                        }
1452 +                                }
1453 +                                p += strlen(p) + 1;
1454 +                        }
1455 +                }
1456 +        }
1457 +        PacketCloseAdapter(NULL);
1458 +
1459 +        return active;
1460 + }
1461  
1462   // Create "Ethernet" pane
1463   static void create_ethernet_pane(GtkWidget *top)
1464   {
1465 <        GtkWidget *box, *hbox, *table, *label, *combo, *sep, *entry;
1465 >        GtkWidget *box, *hbox, *table, *label, *sep, *entry, *opt, *menu, *item;
1466  
1467          box = make_pane(top, STR_NETWORK_PANE_TITLE);
1468          table = make_table(box, 2, 5);
# Line 1281 | Line 1471 | static void create_ethernet_pane(GtkWidg
1471          gtk_widget_show(label);
1472          gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4);
1473  
1474 <        GList *glist = add_ether_names();
1475 <        combo = gtk_combo_new();
1476 <        gtk_widget_show(combo);
1477 <        gtk_combo_set_popdown_strings(GTK_COMBO(combo), glist);
1478 <        const char *str = PrefsFindString("ether");
1479 <        if (str == NULL || str[0] == '\0') {
1480 <                if (PrefsFindBool("routerenabled"))
1481 <                        str = s_nat_router;
1482 <                else
1293 <                        str = GetString(STR_NONE_LAB);
1294 <        }
1295 <        gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo)->entry), str);
1296 <        gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 0, 1, (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), (GtkAttachOptions)0, 4, 4);
1297 <        w_ether = GTK_COMBO(combo)->entry;
1298 <        gtk_signal_connect(GTK_OBJECT(w_ether), "changed", GTK_SIGNAL_FUNC(cb_ether_changed), NULL);
1474 >        opt = gtk_option_menu_new();
1475 >        gtk_widget_show(opt);
1476 >        menu = gtk_menu_new();
1477 >        int active = create_ether_menu(menu);
1478 >        if (active >= 0)
1479 >                gtk_menu_set_active(GTK_MENU(menu), active);
1480 >        gtk_option_menu_set_menu(GTK_OPTION_MENU(opt), menu);
1481 >        gtk_table_attach(GTK_TABLE(table), opt, 1, 2, 0, 1, (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), (GtkAttachOptions)0, 4, 4);
1482 >        gtk_signal_connect(GTK_OBJECT(opt), "changed", GTK_SIGNAL_FUNC(cb_ether_changed), NULL);
1483  
1484          sep = gtk_hseparator_new();
1485          gtk_widget_show(sep);
# Line 1306 | Line 1490 | static void create_ethernet_pane(GtkWidg
1490          gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4);
1491  
1492          entry = gtk_entry_new();
1493 <        str = PrefsFindString("ftp_port_list");
1493 >        const char *str = PrefsFindString("ftp_port_list");
1494          if (str == NULL)
1495                  str = "";
1496          gtk_entry_set_text(GTK_ENTRY(entry), str);
# Line 1338 | Line 1522 | static void create_ethernet_pane(GtkWidg
1522   static GtkWidget *w_ramsize;
1523   static GtkWidget *w_rom_file;
1524  
1525 + // Don't use CPU when idle?
1526 + static void tb_idlewait(GtkWidget *widget)
1527 + {
1528 +        PrefsReplaceBool("idlewait", GTK_TOGGLE_BUTTON(widget)->active);
1529 + }
1530 +
1531   // "Ignore SEGV" button toggled
1532   #ifdef HAVE_SIGSEGV_SKIP_INSTRUCTION
1533   static void tb_ignoresegv(GtkWidget *widget)
# Line 1380 | Line 1570 | static void create_memory_pane(GtkWidget
1570          table = make_table(box, 2, 5);
1571  
1572          static const combo_desc options[] = {
1573 + #ifndef SHEEPSHAVER
1574                  STR_RAMSIZE_2MB_LAB,
1575 + #endif
1576                  STR_RAMSIZE_4MB_LAB,
1577                  STR_RAMSIZE_8MB_LAB,
1578                  STR_RAMSIZE_16MB_LAB,
# Line 1389 | Line 1581 | static void create_memory_pane(GtkWidget
1581                  STR_RAMSIZE_128MB_LAB,
1582                  STR_RAMSIZE_256MB_LAB,
1583                  STR_RAMSIZE_512MB_LAB,
1584 + #ifndef SHEEPSHAVER
1585                  STR_RAMSIZE_1024MB_LAB,
1586 + #endif
1587                  0
1588          };
1589          char default_ramsize[10];
1590          sprintf(default_ramsize, "%d", PrefsFindInt32("ramsize") >> 20);
1591          w_ramsize = table_make_combobox(table, 0, STR_RAMSIZE_CTRL, default_ramsize, options);
1592  
1593 + #ifndef SHEEPSHAVER
1594          static const opt_desc model_options[] = {
1595                  {STR_MODELID_5_LAB, GTK_SIGNAL_FUNC(mn_modelid_5)},
1596                  {STR_MODELID_14_LAB, GTK_SIGNAL_FUNC(mn_modelid_14)},
# Line 1407 | Line 1602 | static void create_memory_pane(GtkWidget
1602                  case 14: active = 1; break;
1603          }
1604          table_make_option_menu(table, 2, STR_MODELID_CTRL, model_options, active);
1605 + #endif
1606  
1607   #if EMULATED_68K
1608          static const opt_desc cpu_options[] = {
# Line 1430 | Line 1626 | static void create_memory_pane(GtkWidget
1626  
1627          w_rom_file = table_make_file_entry(table, 4, STR_ROM_FILE_CTRL, "rom");
1628  
1629 +        make_checkbox(box, STR_IDLEWAIT_CTRL, "idlewait", GTK_SIGNAL_FUNC(tb_idlewait));
1630 +
1631   #ifdef HAVE_SIGSEGV_SKIP_INSTRUCTION
1632          make_checkbox(box, STR_IGNORESEGV_CTRL, "ignoresegv", GTK_SIGNAL_FUNC(tb_ignoresegv));
1633   #endif
# Line 1460 | Line 1658 | static void read_settings(void)
1658   uint8 XPRAM[XPRAM_SIZE];
1659   void MountVolume(void *fh) { }
1660   void FileDiskLayout(loff_t size, uint8 *data, loff_t &start_byte, loff_t &real_size) { }
1661 < void WarningAlert(const char *text) { }
1661 > void recycle_write_packet(LPPACKET) { }
1662 > VOID CALLBACK packet_read_completion(DWORD, DWORD, LPOVERLAPPED) { }
1663  
1664  
1665   /*
# Line 1483 | Line 1682 | static void display_alert(int title_id,
1682          MessageBox(NULL, text, GetString(title_id), MB_OK | flags);
1683   }
1684  
1685 < static void ErrorAlert(const char *text)
1685 > void ErrorAlert(const char *text)
1686   {
1687          display_alert(STR_ERROR_ALERT_TITLE, text, MB_ICONSTOP);
1688   }
1689  
1690 + void WarningAlert(const char *text)
1691 + {
1692 +        display_alert(STR_WARNING_ALERT_TITLE, text, MB_ICONSTOP);
1693 + }
1694 +
1695  
1696   /*
1697   *  Start standalone GUI
# Line 1502 | Line 1706 | int main(int argc, char *argv[])
1706          // Read preferences
1707          PrefsInit(argc, argv);
1708  
1709 +        // Migrate preferences
1710 +        PrefsMigrate();
1711 +
1712          // Show preferences editor
1713          bool start = PrefsEditor();
1714  
1715          // Exit preferences
1716          PrefsExit();
1717  
1718 <        // Transfer control to the Basilisk II executable
1718 >        // Transfer control to the executable
1719          if (start) {
1720                  char path[_MAX_PATH];
1721                  bool ok = GetModuleFileName(NULL, path, sizeof(path)) != 0;
# Line 1518 | Line 1725 | int main(int argc, char *argv[])
1725                          *++p = '\0';
1726                          SetCurrentDirectory(path);
1727                          strcpy(b2_path, path);
1728 <                        strcat(b2_path, "BasiliskII.exe");
1728 >                        strcat(b2_path, PROGRAM_NAME);
1729 >                        strcat(b2_path, ".exe");
1730                          HINSTANCE h = ShellExecute(GetDesktopWindow(), "open",
1731                                                                             b2_path, "", path, SW_SHOWNORMAL);
1732                          if ((int)h <= 32)
1733                                  ok = false;
1734                  }
1735                  if (!ok) {
1736 <                        ErrorAlert("Coult not start BasiliskII executable");
1736 >                        ErrorAlert("Coult not start " PROGRAM_NAME " executable");
1737                          return 1;
1738                  }
1739          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines