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.9 by cebix, 1999-10-28T15:33:15Z vs.
Revision 1.14 by cebix, 2001-01-04T19:50:22Z

# Line 1 | Line 1
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-2000 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
# Line 45 | Line 45 | static bool start_clicked = true;      // Ret
45   static void create_volumes_pane(GtkWidget *top);
46   static void create_scsi_pane(GtkWidget *top);
47   static void create_graphics_pane(GtkWidget *top);
48 + static void create_input_pane(GtkWidget *top);
49   static void create_serial_pane(GtkWidget *top);
50   static void create_memory_pane(GtkWidget *top);
51   static void read_settings(void);
# Line 297 | Line 298 | bool PrefsEditor(void)
298          create_volumes_pane(notebook);
299          create_scsi_pane(notebook);
300          create_graphics_pane(notebook);
301 +        create_input_pane(notebook);
302          create_serial_pane(notebook);
303          create_memory_pane(notebook);
304  
# Line 400 | Line 402 | static void cb_remove_volume(...)
402   }
403  
404   // "Boot From" selected
405 < static void mn_boot_any(...) {PrefsReplaceInt16("bootdriver", 0);}
406 < static void mn_boot_cdrom(...) {PrefsReplaceInt16("bootdriver", CDROMRefNum);}
405 > static void mn_boot_any(...) {PrefsReplaceInt32("bootdriver", 0);}
406 > static void mn_boot_cdrom(...) {PrefsReplaceInt32("bootdriver", CDROMRefNum);}
407  
408   // "No CD-ROM Driver" button toggled
409   static void tb_nocdrom(GtkWidget *widget)
# Line 464 | Line 466 | static void create_volumes_pane(GtkWidge
466                  {STR_BOOT_CDROM_LAB, GTK_SIGNAL_FUNC(mn_boot_cdrom)},
467                  {0, NULL}
468          };
469 <        int bootdriver = PrefsFindInt16("bootdriver"), active = 0;
469 >        int bootdriver = PrefsFindInt32("bootdriver"), active = 0;
470          switch (bootdriver) {
471                  case 0: active = 0; break;
472                  case CDROMRefNum: active = 1; break;
# Line 525 | Line 527 | static GtkWidget *l_frameskip, *l_displa
527   static int display_type;
528   static int dis_width, dis_height;
529  
530 < #if ENABLE_FBDEV_DGA
530 > #ifdef ENABLE_FBDEV_DGA
531   static GtkWidget *w_fbdev_name, *w_fbdevice_file;
532   static GtkWidget *l_fbdev_name, *l_fbdevice_file;
533   static char fbdev_name[256];
# Line 537 | Line 539 | static void hide_show_graphics_widgets(v
539          switch (display_type) {
540                  case DISPLAY_WINDOW:
541                          gtk_widget_show(w_frameskip); gtk_widget_show(l_frameskip);
542 < #if ENABLE_FBDEV_DGA
542 > #ifdef ENABLE_FBDEV_DGA
543                          gtk_widget_show(w_display_x); gtk_widget_show(l_display_x);
544                          gtk_widget_show(w_display_y); gtk_widget_show(l_display_y);
545                          gtk_widget_hide(w_fbdev_name); gtk_widget_hide(l_fbdev_name);
# Line 545 | Line 547 | static void hide_show_graphics_widgets(v
547                          break;
548                  case DISPLAY_SCREEN:
549                          gtk_widget_hide(w_frameskip); gtk_widget_hide(l_frameskip);
550 < #if ENABLE_FBDEV_DGA
550 > #ifdef ENABLE_FBDEV_DGA
551                          gtk_widget_hide(w_display_x); gtk_widget_hide(l_display_x);
552                          gtk_widget_hide(w_display_y); gtk_widget_hide(l_display_y);
553                          gtk_widget_show(w_fbdev_name); gtk_widget_show(l_fbdev_name);
# Line 575 | Line 577 | static void mn_10hz(...) {PrefsReplaceIn
577   static void mn_15hz(...) {PrefsReplaceInt32("frameskip", 4);}
578   static void mn_30hz(...) {PrefsReplaceInt32("frameskip", 2);}
579   static void mn_60hz(...) {PrefsReplaceInt32("frameskip", 1);}
580 + static void mn_dynamic(...) {PrefsReplaceInt32("frameskip", 0);}
581  
582   // "Disable Sound Output" button toggled
583   static void tb_nosound(GtkWidget *widget)
# Line 588 | Line 591 | static void parse_graphics_prefs(void)
591          display_type = DISPLAY_WINDOW;
592          dis_width = 512;
593          dis_height = 384;
594 < #if ENABLE_FBDEV_DGA
594 > #ifdef ENABLE_FBDEV_DGA
595          fbdev_name[0] = 0;
596   #endif
597  
# Line 596 | Line 599 | static void parse_graphics_prefs(void)
599          if (str) {
600                  if (sscanf(str, "win/%d/%d", &dis_width, &dis_height) == 2)
601                          display_type = DISPLAY_WINDOW;
602 < #if ENABLE_FBDEV_DGA
602 > #ifdef ENABLE_FBDEV_DGA
603                  else if (sscanf(str, "dga/%255s", fbdev_name) == 1)
604   #else
605                  else if (sscanf(str, "dga/%d/%d", &dis_width, &dis_height) == 2)
# Line 622 | Line 625 | static void read_graphics_settings(void)
625                          sprintf(pref, "win/%d/%d", dis_width, dis_height);
626                          break;
627                  case DISPLAY_SCREEN:
628 < #if ENABLE_FBDEV_DGA
628 > #ifdef ENABLE_FBDEV_DGA
629                          str = gtk_entry_get_text(GTK_ENTRY(w_fbdev_name));
630                          sprintf(pref, "dga/%s", str);
631   #else
# Line 680 | Line 683 | static void create_graphics_pane(GtkWidg
683          add_menu_item(menu, STR_REF_15HZ_LAB, GTK_SIGNAL_FUNC(mn_15hz));
684          add_menu_item(menu, STR_REF_30HZ_LAB, GTK_SIGNAL_FUNC(mn_30hz));
685          add_menu_item(menu, STR_REF_60HZ_LAB, GTK_SIGNAL_FUNC(mn_60hz));
686 +        add_menu_item(menu, STR_REF_DYNAMIC_LAB, GTK_SIGNAL_FUNC(mn_dynamic));
687          int frameskip = PrefsFindInt32("frameskip");
688 +        int item = -1;
689          switch (frameskip) {
690 <                case 12:
691 <                        gtk_menu_set_active(GTK_MENU(menu), 0);
692 <                        break;
693 <                case 8:
694 <                        gtk_menu_set_active(GTK_MENU(menu), 1);
695 <                        break;
696 <                case 6:
692 <                        gtk_menu_set_active(GTK_MENU(menu), 2);
693 <                        break;
694 <                case 4:
695 <                        gtk_menu_set_active(GTK_MENU(menu), 3);
696 <                        break;
697 <                case 2:
698 <                        gtk_menu_set_active(GTK_MENU(menu), 4);
699 <                        break;
700 <                case 1:
701 <                        gtk_menu_set_active(GTK_MENU(menu), 5);
702 <                        break;
690 >                case 12: item = 0; break;
691 >                case 8: item = 1; break;
692 >                case 6: item = 2; break;
693 >                case 4: item = 3; break;
694 >                case 2: item = 4; break;
695 >                case 1: item = 5; break;
696 >                case 0: item = 6; break;
697          }
698 +        if (item >= 0)
699 +                gtk_menu_set_active(GTK_MENU(menu), item);
700          gtk_option_menu_set_menu(GTK_OPTION_MENU(w_frameskip), menu);
701          gtk_table_attach(GTK_TABLE(table), w_frameskip, 1, 2, 1, 2, (GtkAttachOptions)GTK_FILL, (GtkAttachOptions)0, 4, 4);
702  
# Line 746 | Line 742 | static void create_graphics_pane(GtkWidg
742          gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 3, 4, (GtkAttachOptions)GTK_FILL, (GtkAttachOptions)0, 4, 4);
743          w_display_y = GTK_COMBO(combo)->entry;
744  
745 < #if ENABLE_FBDEV_DGA
745 > #ifdef ENABLE_FBDEV_DGA
746          l_fbdev_name = gtk_label_new(GetString(STR_FBDEV_NAME_CTRL));
747          gtk_widget_show(l_fbdev_name);
748          gtk_table_attach(GTK_TABLE(table), l_fbdev_name, 0, 1, 4, 5, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4);
# Line 759 | Line 755 | static void create_graphics_pane(GtkWidg
755          w_fbdevice_file = make_entry(box, STR_FBDEVICE_FILE_CTRL, "fbdevicefile");
756   #endif
757  
758 +        make_separator(box);
759          make_checkbox(box, STR_NOSOUND_CTRL, "nosound", GTK_SIGNAL_FUNC(tb_nosound));
760  
761          hide_show_graphics_widgets();
# Line 766 | Line 763 | static void create_graphics_pane(GtkWidg
763  
764  
765   /*
766 + *  "Input" pane
767 + */
768 +
769 + static GtkWidget *w_keycode_file;
770 + static GtkWidget *w_mouse_wheel_lines;
771 +
772 + // Set sensitivity of widgets
773 + static void set_input_sensitive(void)
774 + {
775 +        gtk_widget_set_sensitive(w_keycode_file, PrefsFindBool("keycodes"));
776 +        gtk_widget_set_sensitive(w_mouse_wheel_lines, PrefsFindInt32("mousewheelmode") == 1);
777 + }
778 +
779 + // "Use Raw Keycodes" button toggled
780 + static void tb_keycodes(GtkWidget *widget)
781 + {
782 +        PrefsReplaceBool("keycodes", GTK_TOGGLE_BUTTON(widget)->active);
783 +        set_input_sensitive();
784 + }
785 +
786 + // "Mouse Wheel Mode" selected
787 + static void mn_wheel_page(...) {PrefsReplaceInt32("mousewheelmode", 0); set_input_sensitive();}
788 + static void mn_wheel_cursor(...) {PrefsReplaceInt32("mousewheelmode", 1); set_input_sensitive();}
789 +
790 + // Read settings from widgets and set preferences
791 + static void read_input_settings(void)
792 + {
793 +        const char *str = gtk_entry_get_text(GTK_ENTRY(w_keycode_file));
794 +        if (str && strlen(str))
795 +                PrefsReplaceString("keycodefile", str);
796 +        else
797 +                PrefsRemoveItem("keycodefile");
798 +
799 +        PrefsReplaceInt32("mousewheellines", gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(w_mouse_wheel_lines)));
800 + }
801 +
802 + // Create "Input" pane
803 + static void create_input_pane(GtkWidget *top)
804 + {
805 +        GtkWidget *box, *hbox, *menu, *label;
806 +        GtkObject *adj;
807 +
808 +        box = make_pane(top, STR_INPUT_PANE_TITLE);
809 +
810 +        make_checkbox(box, STR_KEYCODES_CTRL, "keycodes", GTK_SIGNAL_FUNC(tb_keycodes));
811 +        w_keycode_file = make_entry(box, STR_KEYCODE_FILE_CTRL, "keycodefile");
812 +
813 +        make_separator(box);
814 +
815 +        static const opt_desc options[] = {
816 +                {STR_MOUSEWHEELMODE_PAGE_LAB, GTK_SIGNAL_FUNC(mn_wheel_page)},
817 +                {STR_MOUSEWHEELMODE_CURSOR_LAB, GTK_SIGNAL_FUNC(mn_wheel_cursor)},
818 +                {0, NULL}
819 +        };
820 +        int wheelmode = PrefsFindInt32("mousewheelmode"), active = 0;
821 +        switch (wheelmode) {
822 +                case 0: active = 0; break;
823 +                case 1: active = 1; break;
824 +        }
825 +        menu = make_option_menu(box, STR_MOUSEWHEELMODE_CTRL, options, active);
826 +
827 +        hbox = gtk_hbox_new(FALSE, 4);
828 +        gtk_widget_show(hbox);
829 +        gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0);
830 +
831 +        label = gtk_label_new(GetString(STR_MOUSEWHEELLINES_CTRL));
832 +        gtk_widget_show(label);
833 +        gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
834 +
835 +        adj = gtk_adjustment_new(PrefsFindInt32("mousewheellines"), 1, 1000, 1, 5, 0);
836 +        w_mouse_wheel_lines = gtk_spin_button_new(GTK_ADJUSTMENT(adj), 0.0, 0);
837 +        gtk_widget_show(w_mouse_wheel_lines);
838 +        gtk_box_pack_start(GTK_BOX(hbox), w_mouse_wheel_lines, FALSE, FALSE, 0);
839 +
840 +        set_input_sensitive();
841 + }
842 +
843 +
844 + /*
845   *  "Serial/Network" pane
846   */
847  
# Line 870 | Line 946 | static GList *add_ether_names(void)
946   // Create "Serial/Network" pane
947   static void create_serial_pane(GtkWidget *top)
948   {
949 <        GtkWidget *box, *table, *label, *combo;
949 >        GtkWidget *box, *table, *label, *combo, *sep;
950          GList *glist = add_serial_names();
951  
952          box = make_pane(top, STR_SERIAL_NETWORK_PANE_TITLE);
953 <        table = make_table(box, 2, 3);
953 >        table = make_table(box, 2, 4);
954  
955          label = gtk_label_new(GetString(STR_SERIALA_CTRL));
956          gtk_widget_show(label);
# Line 904 | Line 980 | static void create_serial_pane(GtkWidget
980          gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 1, 2, (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), (GtkAttachOptions)0, 4, 4);
981          w_serialb = GTK_COMBO(combo)->entry;
982  
983 +        sep = gtk_hseparator_new();
984 +        gtk_widget_show(sep);
985 +        gtk_table_attach(GTK_TABLE(table), sep, 0, 2, 2, 3, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4);
986 +
987          label = gtk_label_new(GetString(STR_ETHERNET_IF_CTRL));
988          gtk_widget_show(label);
989 <        gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4);
989 >        gtk_table_attach(GTK_TABLE(table), label, 0, 1, 3, 4, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4);
990  
991          glist = add_ether_names();
992          combo = gtk_combo_new();
# Line 916 | Line 996 | static void create_serial_pane(GtkWidget
996          if (str == NULL)
997                  str = "";
998          gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo)->entry), str);
999 <        gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 2, 3, (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), (GtkAttachOptions)0, 4, 4);
999 >        gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 3, 4, (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), (GtkAttachOptions)0, 4, 4);
1000          w_ether = GTK_COMBO(combo)->entry;
1001   }
1002  
# Line 927 | Line 1007 | static void create_serial_pane(GtkWidget
1007  
1008   static GtkObject *w_ramsize_adj;
1009   static GtkWidget *w_rom_file;
930 static GtkWidget *w_keycode_file;
1010  
1011   // Model ID selected
1012   static void mn_modelid_5(...) {PrefsReplaceInt32("modelid", 5);}
# Line 940 | Line 1019 | static void mn_cpu_68030(...) {PrefsRepl
1019   static void mn_cpu_68030_fpu(...) {PrefsReplaceInt32("cpu", 3); PrefsReplaceBool("fpu", true);}
1020   static void mn_cpu_68040(...) {PrefsReplaceInt32("cpu", 4); PrefsReplaceBool("fpu", true);}
1021  
943 // "Use Raw Keycodes" button toggled
944 static void tb_keycodes(GtkWidget *widget)
945 {
946        PrefsReplaceBool("keycodes", GTK_TOGGLE_BUTTON(widget)->active);
947 }
948
1022   // Read settings from widgets and set preferences
1023   static void read_memory_settings(void)
1024   {
# Line 957 | Line 1030 | static void read_memory_settings(void)
1030          else
1031                  PrefsRemoveItem("rom");
1032  
960        str = gtk_entry_get_text(GTK_ENTRY(w_keycode_file));
961        if (str && strlen(str))
962                PrefsReplaceString("keycodefile", str);
963        else
964                PrefsRemoveItem("keycodefile");
1033   }
1034  
1035   // Create "Memory/Misc" pane
1036   static void create_memory_pane(GtkWidget *top)
1037   {
1038 <        GtkWidget *box, *vbox, *hbox, *hbox2, *label, *scale, *menu;
1038 >        GtkWidget *box, *hbox, *vbox, *hbox2, *label, *scale, *menu;
1039  
1040          box = make_pane(top, STR_MEMORY_MISC_PANE_TITLE);
1041  
# Line 1021 | Line 1089 | static void create_memory_pane(GtkWidget
1089          }
1090          make_option_menu(box, STR_MODELID_CTRL, model_options, active);
1091  
1092 + #if EMULATED_68K
1093          static const opt_desc cpu_options[] = {
1094                  {STR_CPU_68020_LAB, GTK_SIGNAL_FUNC(mn_cpu_68020)},
1095                  {STR_CPU_68020_FPU_LAB, GTK_SIGNAL_FUNC(mn_cpu_68020_fpu)},
# Line 1038 | Line 1107 | static void create_memory_pane(GtkWidget
1107                  case 4: active = 4;
1108          }
1109          make_option_menu(box, STR_CPU_CTRL, cpu_options, active);
1110 + #endif
1111  
1112          w_rom_file = make_entry(box, STR_ROM_FILE_CTRL, "rom");
1043
1044        make_checkbox(box, STR_KEYCODES_CTRL, "keycodes", GTK_SIGNAL_FUNC(tb_keycodes));
1045        w_keycode_file = make_entry(box, STR_KEYCODE_FILE_CTRL, "keycodefile");
1113   }
1114  
1115  
# Line 1055 | Line 1122 | static void read_settings(void)
1122          read_volumes_settings();
1123          read_scsi_settings();
1124          read_graphics_settings();
1125 +        read_input_settings();
1126          read_serial_settings();
1127          read_memory_settings();
1128   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines