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

Comparing BasiliskII/src/BeOS/prefs_editor_beos.cpp (file contents):
Revision 1.2 by cebix, 1999-10-19T21:33:58Z vs.
Revision 1.13 by cebix, 2004-01-12T15:29:23Z

# Line 1 | Line 1
1   /*
2   *  prefs_editor_beos.cpp - Preferences editor, BeOS implementation
3   *
4 < *  Basilisk II (C) 1997-1999 Christian Bauer
4 > *  Basilisk II (C) 1997-2004 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 33 | Line 33
33   #include "cdrom.h"
34   #include "xpram.h"
35   #include "prefs.h"
36 < #include "version.h"
36 > #include "about_window.h"
37   #include "user_strings.h"
38   #include "prefs_editor.h"
39  
# Line 80 | Line 80 | const uint32 MSG_NOSOUND = 'nosn';
80   const uint32 MSG_SER_A = 'sera';                        // "Serial/Network" pane
81   const uint32 MSG_SER_B = 'serb';
82   const uint32 MSG_ETHER = 'ethr';
83 + const uint32 MSG_UDPTUNNEL = 'udpt';
84  
85   const uint32 MSG_RAMSIZE = 'rmsz';                      // "Memory/Misc" pane
86   const uint32 MSG_MODELID_5 = 'mi05';
87   const uint32 MSG_MODELID_14 = 'mi14';
88 + const uint32 MSG_CPU_68020 = 'cpu2';
89 + const uint32 MSG_CPU_68020_FPU = 'cpf2';
90 + const uint32 MSG_CPU_68030 = 'cpu3';
91 + const uint32 MSG_CPU_68030_FPU = 'cpf3';
92 + const uint32 MSG_CPU_68040 = 'cpu4';
93  
94  
95   // RAM size slider class
# Line 216 | Line 222 | private:
222          void read_volumes_prefs(void);
223          void hide_show_graphics_ctrls(void);
224          void read_graphics_prefs(void);
225 +        void hide_show_serial_ctrls(void);
226 +        void read_serial_prefs(void);
227          void add_serial_names(BPopUpMenu *menu, uint32 msg);
228          void read_memory_prefs(void);
229  
# Line 243 | Line 251 | private:
251          BMenuField *scr_mode_menu;
252          BCheckBox *nosound_checkbox;
253          BCheckBox *ether_checkbox;
254 +        BCheckBox *udptunnel_checkbox;
255 +        NumberControl *udpport_ctrl;
256          RAMSlider *ramsize_slider;
257          PathControl *extfs_control;
258          PathControl *rom_control;
259 +        BCheckBox *fpu_checkbox;
260  
261          BFilePanel *add_volume_panel;
262          BFilePanel *create_volume_panel;
# Line 273 | Line 284 | bool PrefsEditor(void)
284   *  Preferences window constructor
285   */
286  
287 < PrefsWindow::PrefsWindow(uint32 msg) : BWindow(BRect(0, 0, 400, 269), GetString(STR_PREFS_TITLE), B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS), this_messenger(this)
287 > PrefsWindow::PrefsWindow(uint32 msg) : BWindow(BRect(0, 0, 400, 289), GetString(STR_PREFS_TITLE), B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS), this_messenger(this)
288   {
289          int i;
290          ok_message = msg;
# Line 296 | Line 307 | PrefsWindow::PrefsWindow(uint32 msg) : B
307          bar->AddItem(menu);
308          AddChild(bar);
309          SetKeyMenuBar(bar);
310 <        int mbar_height = bar->Bounds().bottom + 1;
310 >        int mbar_height = int(bar->Bounds().bottom) + 1;
311  
312          // Resize window to fit menu bar
313          ResizeBy(0, mbar_height);
# Line 419 | Line 430 | BView *PrefsWindow::create_volumes_pane(
430          menu->AddItem(new BMenuItem(GetString(STR_BOOT_ANY_LAB), new BMessage(MSG_BOOT_ANY)));
431          menu->AddItem(new BMenuItem(GetString(STR_BOOT_CDROM_LAB), new BMessage(MSG_BOOT_CDROM)));
432          pane->AddChild(menu_field);
433 <        int16 i16 = PrefsFindInt16("bootdriver");
433 >        int32 i32 = PrefsFindInt32("bootdriver");
434          BMenuItem *item;
435 <        if (i16 == 0) {
435 >        if (i32 == 0) {
436                  if ((item = menu->FindItem(GetString(STR_BOOT_ANY_LAB))) != NULL)
437                          item->SetMarked(true);
438 <        } else if (i16 == CDROMRefNum) {
438 >        } else if (i32 == CDROMRefNum) {
439                  if ((item = menu->FindItem(GetString(STR_BOOT_CDROM_LAB))) != NULL)
440                          item->SetMarked(true);
441          }
# Line 587 | Line 598 | BView *PrefsWindow::create_graphics_pane
598  
599  
600   /*
601 < *  Create "Serial Ports" pane
601 > *  Create "Serial/Network" pane
602   */
603  
604 + void PrefsWindow::hide_show_serial_ctrls(void)
605 + {
606 +        if (udptunnel_checkbox->Value() == B_CONTROL_ON) {
607 +                ether_checkbox->SetEnabled(false);
608 +                udpport_ctrl->SetEnabled(true);
609 +        } else {
610 +                ether_checkbox->SetEnabled(true);
611 +                udpport_ctrl->SetEnabled(false);
612 +        }
613 + }
614 +
615 + void PrefsWindow::read_serial_prefs(void)
616 + {
617 +        PrefsReplaceInt32("udpport", udpport_ctrl->Value());
618 + }
619 +
620   void PrefsWindow::add_serial_names(BPopUpMenu *menu, uint32 msg)
621   {
622          BSerialPort *port = new BSerialPort;
# Line 649 | Line 676 | BView *PrefsWindow::create_serial_pane(v
676          pane->AddChild(ether_checkbox);
677          ether_checkbox->SetValue(PrefsFindString("ether") ? B_CONTROL_ON : B_CONTROL_OFF);
678  
679 +        udptunnel_checkbox = new BCheckBox(BRect(10, 67, right, 72), "udptunnel", GetString(STR_UDPTUNNEL_CTRL), new BMessage(MSG_UDPTUNNEL));
680 +        pane->AddChild(udptunnel_checkbox);
681 +        udptunnel_checkbox->SetValue(PrefsFindBool("udptunnel") ? B_CONTROL_ON : B_CONTROL_OFF);
682 +
683 +        udpport_ctrl = new NumberControl(BRect(10, 87, right / 2, 105), 118, "udpport", GetString(STR_UDPPORT_CTRL), PrefsFindInt32("udpport"), NULL);
684 +        pane->AddChild(udpport_ctrl);
685 +
686 +        hide_show_serial_ctrls();
687          return pane;
688   }
689  
# Line 706 | Line 741 | BView *PrefsWindow::create_memory_pane(v
741                  item->SetMarked(true);
742          pane->AddChild(menu_field);
743  
744 <        rom_control = new PathControl(false, BRect(10, 82, right, 97), "rom", GetString(STR_ROM_FILE_CTRL), PrefsFindString("rom"), NULL);
744 >        int cpu = PrefsFindInt32("cpu");
745 >        bool fpu = PrefsFindBool("fpu");
746 >        menu = new BPopUpMenu("");
747 >        menu_field = new BMenuField(BRect(10, 82, right, 97), "cpu", GetString(STR_CPU_CTRL), menu);
748 >        menu_field->SetDivider(120);
749 >        menu->AddItem(item = new BMenuItem(GetString(STR_CPU_68020_LAB), new BMessage(MSG_CPU_68020)));
750 >        if (cpu == 2 && !fpu)
751 >                item->SetMarked(true);
752 >        menu->AddItem(item = new BMenuItem(GetString(STR_CPU_68020_FPU_LAB), new BMessage(MSG_CPU_68020_FPU)));
753 >        if (cpu == 2 && fpu)
754 >                item->SetMarked(true);
755 >        menu->AddItem(item = new BMenuItem(GetString(STR_CPU_68030_LAB), new BMessage(MSG_CPU_68030)));
756 >        if (cpu == 3 && !fpu)
757 >                item->SetMarked(true);
758 >        menu->AddItem(item = new BMenuItem(GetString(STR_CPU_68030_FPU_LAB), new BMessage(MSG_CPU_68030_FPU)));
759 >        if (cpu == 3 && fpu)
760 >                item->SetMarked(true);
761 >        menu->AddItem(item = new BMenuItem(GetString(STR_CPU_68040_LAB), new BMessage(MSG_CPU_68040)));
762 >        if (cpu == 4)
763 >                item->SetMarked(true);
764 >        pane->AddChild(menu_field);
765 >
766 >        rom_control = new PathControl(false, BRect(10, 104, right, 119), "rom", GetString(STR_ROM_FILE_CTRL), PrefsFindString("rom"), NULL);
767          rom_control->SetDivider(117);
768          pane->AddChild(rom_control);
769  
# Line 739 | Line 796 | void PrefsWindow::MessageReceived(BMessa
796                          break;
797  
798                  case B_ABOUT_REQUESTED: {       // "About" menu item selected
799 <                        char str[256];
743 <                        sprintf(str, GetString(STR_ABOUT_TEXT1), VERSION_MAJOR, VERSION_MINOR);
744 <                        strcat(str, " ");
745 <                        strcat(str, GetString(STR_ABOUT_TEXT2));
746 <                        BAlert *about = new BAlert(GetString(STR_WINDOW_TITLE), str, GetString(STR_OK_BUTTON));
747 <                        about->Go();
799 >                        ShowAboutWindow();
800                          break;
801                  }
802  
# Line 847 | Line 899 | void PrefsWindow::MessageReceived(BMessa
899                  }
900  
901                  case MSG_BOOT_ANY:
902 <                        PrefsReplaceInt16("bootdriver", 0);
902 >                        PrefsReplaceInt32("bootdriver", 0);
903                          break;
904  
905                  case MSG_BOOT_CDROM:
906 <                        PrefsReplaceInt16("bootdriver", CDROMRefNum);
906 >                        PrefsReplaceInt32("bootdriver", CDROMRefNum);
907                          break;
908  
909                  case MSG_NOCDROM:
# Line 915 | Line 967 | void PrefsWindow::MessageReceived(BMessa
967                                  PrefsRemoveItem("ether");
968                          break;
969  
970 +                case MSG_UDPTUNNEL:
971 +                        PrefsReplaceBool("udptunnel", udptunnel_checkbox->Value() == B_CONTROL_ON);
972 +                        hide_show_serial_ctrls();
973 +                        break;
974 +
975                  case MSG_RAMSIZE:
976                          PrefsReplaceInt32("ramsize", ramsize_slider->Value() * 1024 * 1024);
977                          break;
# Line 927 | Line 984 | void PrefsWindow::MessageReceived(BMessa
984                          PrefsReplaceInt32("modelid", 14);
985                          break;
986  
987 +                case MSG_CPU_68020:
988 +                        PrefsReplaceInt32("cpu", 2);
989 +                        PrefsReplaceBool("fpu", false);
990 +                        break;
991 +
992 +                case MSG_CPU_68020_FPU:
993 +                        PrefsReplaceInt32("cpu", 2);
994 +                        PrefsReplaceBool("fpu", true);
995 +                        break;
996 +
997 +                case MSG_CPU_68030:
998 +                        PrefsReplaceInt32("cpu", 3);
999 +                        PrefsReplaceBool("fpu", false);
1000 +                        break;
1001 +
1002 +                case MSG_CPU_68030_FPU:
1003 +                        PrefsReplaceInt32("cpu", 3);
1004 +                        PrefsReplaceBool("fpu", true);
1005 +                        break;
1006 +
1007 +                case MSG_CPU_68040:
1008 +                        PrefsReplaceInt32("cpu", 4);
1009 +                        PrefsReplaceBool("fpu", true);
1010 +                        break;
1011 +
1012                  default: {
1013                          // Screen mode messages
1014                          if ((msg->what & 0xffff0000) == MSG_SCREEN_MODE) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines