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.12 by cebix, 2000-07-13T16:12:32Z vs.
Revision 1.16 by cebix, 2001-06-30T20:18:36Z

# Line 1 | Line 1
1   /*
2   *  prefs_editor_gtk.cpp - Preferences editor, Unix implementation using GTK+
3   *
4 < *  Basilisk II (C) 1997-2000 Christian Bauer
4 > *  Basilisk II (C) 1997-2001 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 226 | Line 227 | static void mn_about(...)
227   {
228          GtkWidget *dialog, *label, *button;
229  
230 <        char str[256];
231 <        sprintf(str, GetString(STR_ABOUT_TEXT1), VERSION_MAJOR, VERSION_MINOR);
232 <        strncat(str, "\n", 255);
233 <        strncat(str, GetString(STR_ABOUT_TEXT2), 255);
230 >        char str[512];
231 >        sprintf(str,
232 >                "Basilisk II\nVersion %d.%d\n\n"
233 >                "Copyright (C) 1997-2001 Christian Bauer et al.\n"
234 >                "E-mail: Christian.Bauer@uni-mainz.de\n"
235 >                "http://www.uni-mainz.de/~bauec002/B2Main.html\n\n"
236 >                "Basilisk II comes with ABSOLUTELY NO\n"
237 >                "WARRANTY. This is free software, and\n"
238 >                "you are welcome to redistribute it\n"
239 >                "under the terms of the GNU General\n"
240 >                "Public License.\n",
241 >                VERSION_MAJOR, VERSION_MINOR
242 >        );
243  
244          dialog = gtk_dialog_new();
235        gtk_widget_set_usize(GTK_WIDGET(dialog), strlen(GetString(STR_ABOUT_TEXT2)) + 200, 120);
245          gtk_window_set_title(GTK_WINDOW(dialog), GetString(STR_ABOUT_TITLE));
246          gtk_container_border_width(GTK_CONTAINER(dialog), 5);
247          gtk_widget_set_uposition(GTK_WIDGET(dialog), 100, 150);
# Line 297 | Line 306 | bool PrefsEditor(void)
306          create_volumes_pane(notebook);
307          create_scsi_pane(notebook);
308          create_graphics_pane(notebook);
309 +        create_input_pane(notebook);
310          create_serial_pane(notebook);
311          create_memory_pane(notebook);
312  
# Line 400 | Line 410 | static void cb_remove_volume(...)
410   }
411  
412   // "Boot From" selected
413 < static void mn_boot_any(...) {PrefsReplaceInt16("bootdriver", 0);}
414 < static void mn_boot_cdrom(...) {PrefsReplaceInt16("bootdriver", CDROMRefNum);}
413 > static void mn_boot_any(...) {PrefsReplaceInt32("bootdriver", 0);}
414 > static void mn_boot_cdrom(...) {PrefsReplaceInt32("bootdriver", CDROMRefNum);}
415  
416   // "No CD-ROM Driver" button toggled
417   static void tb_nocdrom(GtkWidget *widget)
# Line 464 | Line 474 | static void create_volumes_pane(GtkWidge
474                  {STR_BOOT_CDROM_LAB, GTK_SIGNAL_FUNC(mn_boot_cdrom)},
475                  {0, NULL}
476          };
477 <        int bootdriver = PrefsFindInt16("bootdriver"), active = 0;
477 >        int bootdriver = PrefsFindInt32("bootdriver"), active = 0;
478          switch (bootdriver) {
479                  case 0: active = 0; break;
480                  case CDROMRefNum: active = 1; break;
# Line 753 | Line 763 | static void create_graphics_pane(GtkWidg
763          w_fbdevice_file = make_entry(box, STR_FBDEVICE_FILE_CTRL, "fbdevicefile");
764   #endif
765  
766 +        make_separator(box);
767          make_checkbox(box, STR_NOSOUND_CTRL, "nosound", GTK_SIGNAL_FUNC(tb_nosound));
768  
769          hide_show_graphics_widgets();
# Line 760 | Line 771 | static void create_graphics_pane(GtkWidg
771  
772  
773   /*
774 + *  "Input" pane
775 + */
776 +
777 + static GtkWidget *w_keycode_file;
778 + static GtkWidget *w_mouse_wheel_lines;
779 +
780 + // Set sensitivity of widgets
781 + static void set_input_sensitive(void)
782 + {
783 +        gtk_widget_set_sensitive(w_keycode_file, PrefsFindBool("keycodes"));
784 +        gtk_widget_set_sensitive(w_mouse_wheel_lines, PrefsFindInt32("mousewheelmode") == 1);
785 + }
786 +
787 + // "Use Raw Keycodes" button toggled
788 + static void tb_keycodes(GtkWidget *widget)
789 + {
790 +        PrefsReplaceBool("keycodes", GTK_TOGGLE_BUTTON(widget)->active);
791 +        set_input_sensitive();
792 + }
793 +
794 + // "Mouse Wheel Mode" selected
795 + static void mn_wheel_page(...) {PrefsReplaceInt32("mousewheelmode", 0); set_input_sensitive();}
796 + static void mn_wheel_cursor(...) {PrefsReplaceInt32("mousewheelmode", 1); set_input_sensitive();}
797 +
798 + // Read settings from widgets and set preferences
799 + static void read_input_settings(void)
800 + {
801 +        const char *str = gtk_entry_get_text(GTK_ENTRY(w_keycode_file));
802 +        if (str && strlen(str))
803 +                PrefsReplaceString("keycodefile", str);
804 +        else
805 +                PrefsRemoveItem("keycodefile");
806 +
807 +        PrefsReplaceInt32("mousewheellines", gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(w_mouse_wheel_lines)));
808 + }
809 +
810 + // Create "Input" pane
811 + static void create_input_pane(GtkWidget *top)
812 + {
813 +        GtkWidget *box, *hbox, *menu, *label;
814 +        GtkObject *adj;
815 +
816 +        box = make_pane(top, STR_INPUT_PANE_TITLE);
817 +
818 +        make_checkbox(box, STR_KEYCODES_CTRL, "keycodes", GTK_SIGNAL_FUNC(tb_keycodes));
819 +        w_keycode_file = make_entry(box, STR_KEYCODE_FILE_CTRL, "keycodefile");
820 +
821 +        make_separator(box);
822 +
823 +        static const opt_desc options[] = {
824 +                {STR_MOUSEWHEELMODE_PAGE_LAB, GTK_SIGNAL_FUNC(mn_wheel_page)},
825 +                {STR_MOUSEWHEELMODE_CURSOR_LAB, GTK_SIGNAL_FUNC(mn_wheel_cursor)},
826 +                {0, NULL}
827 +        };
828 +        int wheelmode = PrefsFindInt32("mousewheelmode"), active = 0;
829 +        switch (wheelmode) {
830 +                case 0: active = 0; break;
831 +                case 1: active = 1; break;
832 +        }
833 +        menu = make_option_menu(box, STR_MOUSEWHEELMODE_CTRL, options, active);
834 +
835 +        hbox = gtk_hbox_new(FALSE, 4);
836 +        gtk_widget_show(hbox);
837 +        gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0);
838 +
839 +        label = gtk_label_new(GetString(STR_MOUSEWHEELLINES_CTRL));
840 +        gtk_widget_show(label);
841 +        gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
842 +
843 +        adj = gtk_adjustment_new(PrefsFindInt32("mousewheellines"), 1, 1000, 1, 5, 0);
844 +        w_mouse_wheel_lines = gtk_spin_button_new(GTK_ADJUSTMENT(adj), 0.0, 0);
845 +        gtk_widget_show(w_mouse_wheel_lines);
846 +        gtk_box_pack_start(GTK_BOX(hbox), w_mouse_wheel_lines, FALSE, FALSE, 0);
847 +
848 +        set_input_sensitive();
849 + }
850 +
851 +
852 + /*
853   *  "Serial/Network" pane
854   */
855  
# Line 864 | Line 954 | static GList *add_ether_names(void)
954   // Create "Serial/Network" pane
955   static void create_serial_pane(GtkWidget *top)
956   {
957 <        GtkWidget *box, *table, *label, *combo;
957 >        GtkWidget *box, *table, *label, *combo, *sep;
958          GList *glist = add_serial_names();
959  
960          box = make_pane(top, STR_SERIAL_NETWORK_PANE_TITLE);
961 <        table = make_table(box, 2, 3);
961 >        table = make_table(box, 2, 4);
962  
963          label = gtk_label_new(GetString(STR_SERIALA_CTRL));
964          gtk_widget_show(label);
# Line 898 | Line 988 | static void create_serial_pane(GtkWidget
988          gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 1, 2, (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), (GtkAttachOptions)0, 4, 4);
989          w_serialb = GTK_COMBO(combo)->entry;
990  
991 +        sep = gtk_hseparator_new();
992 +        gtk_widget_show(sep);
993 +        gtk_table_attach(GTK_TABLE(table), sep, 0, 2, 2, 3, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4);
994 +
995          label = gtk_label_new(GetString(STR_ETHERNET_IF_CTRL));
996          gtk_widget_show(label);
997 <        gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4);
997 >        gtk_table_attach(GTK_TABLE(table), label, 0, 1, 3, 4, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4);
998  
999          glist = add_ether_names();
1000          combo = gtk_combo_new();
# Line 910 | Line 1004 | static void create_serial_pane(GtkWidget
1004          if (str == NULL)
1005                  str = "";
1006          gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo)->entry), str);
1007 <        gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 2, 3, (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), (GtkAttachOptions)0, 4, 4);
1007 >        gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 3, 4, (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), (GtkAttachOptions)0, 4, 4);
1008          w_ether = GTK_COMBO(combo)->entry;
1009   }
1010  
# Line 921 | Line 1015 | static void create_serial_pane(GtkWidget
1015  
1016   static GtkObject *w_ramsize_adj;
1017   static GtkWidget *w_rom_file;
924 static GtkWidget *w_keycode_file;
1018  
1019   // Model ID selected
1020   static void mn_modelid_5(...) {PrefsReplaceInt32("modelid", 5);}
# Line 934 | Line 1027 | static void mn_cpu_68030(...) {PrefsRepl
1027   static void mn_cpu_68030_fpu(...) {PrefsReplaceInt32("cpu", 3); PrefsReplaceBool("fpu", true);}
1028   static void mn_cpu_68040(...) {PrefsReplaceInt32("cpu", 4); PrefsReplaceBool("fpu", true);}
1029  
937 // "Use Raw Keycodes" button toggled
938 static void tb_keycodes(GtkWidget *widget)
939 {
940        PrefsReplaceBool("keycodes", GTK_TOGGLE_BUTTON(widget)->active);
941 }
942
1030   // Read settings from widgets and set preferences
1031   static void read_memory_settings(void)
1032   {
# Line 951 | Line 1038 | static void read_memory_settings(void)
1038          else
1039                  PrefsRemoveItem("rom");
1040  
954        str = gtk_entry_get_text(GTK_ENTRY(w_keycode_file));
955        if (str && strlen(str))
956                PrefsReplaceString("keycodefile", str);
957        else
958                PrefsRemoveItem("keycodefile");
1041   }
1042  
1043   // Create "Memory/Misc" pane
1044   static void create_memory_pane(GtkWidget *top)
1045   {
1046 <        GtkWidget *box, *vbox, *hbox, *hbox2, *label, *scale, *menu;
1046 >        GtkWidget *box, *hbox, *vbox, *hbox2, *label, *scale, *menu;
1047  
1048          box = make_pane(top, STR_MEMORY_MISC_PANE_TITLE);
1049  
# Line 1036 | Line 1118 | static void create_memory_pane(GtkWidget
1118   #endif
1119  
1120          w_rom_file = make_entry(box, STR_ROM_FILE_CTRL, "rom");
1039
1040        make_checkbox(box, STR_KEYCODES_CTRL, "keycodes", GTK_SIGNAL_FUNC(tb_keycodes));
1041        w_keycode_file = make_entry(box, STR_KEYCODE_FILE_CTRL, "keycodefile");
1121   }
1122  
1123  
# Line 1051 | Line 1130 | static void read_settings(void)
1130          read_volumes_settings();
1131          read_scsi_settings();
1132          read_graphics_settings();
1133 +        read_input_settings();
1134          read_serial_settings();
1135          read_memory_settings();
1136   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines