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 |
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 |
|
|
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_FPU = 'fpu '; |
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 |
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 |
|
|
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; |
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); |
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 |
|
} |
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; |
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 |
|
|
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 |
|
|
715 |
– |
fpu_checkbox = new BCheckBox(BRect(10, 100, right, 115), "fpu", GetString(STR_FPU_CTRL), new BMessage(MSG_FPU)); |
716 |
– |
pane->AddChild(fpu_checkbox); |
717 |
– |
fpu_checkbox->SetValue(PrefsFindBool("fpu") ? B_CONTROL_ON : B_CONTROL_OFF); |
718 |
– |
|
770 |
|
return pane; |
771 |
|
} |
772 |
|
|
796 |
|
break; |
797 |
|
|
798 |
|
case B_ABOUT_REQUESTED: { // "About" menu item selected |
799 |
< |
char str[256]; |
749 |
< |
sprintf(str, GetString(STR_ABOUT_TEXT1), VERSION_MAJOR, VERSION_MINOR); |
750 |
< |
strcat(str, " "); |
751 |
< |
strcat(str, GetString(STR_ABOUT_TEXT2)); |
752 |
< |
BAlert *about = new BAlert(GetString(STR_WINDOW_TITLE), str, GetString(STR_OK_BUTTON)); |
753 |
< |
about->Go(); |
799 |
> |
ShowAboutWindow(); |
800 |
|
break; |
801 |
|
} |
802 |
|
|
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: |
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; |
984 |
|
PrefsReplaceInt32("modelid", 14); |
985 |
|
break; |
986 |
|
|
987 |
< |
case MSG_FPU: |
988 |
< |
PrefsReplaceBool("fpu", fpu_checkbox->Value() == B_CONTROL_ON); |
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: { |