1 |
|
/* |
2 |
|
* prefs_editor_beos.cpp - Preferences editor, BeOS implementation |
3 |
|
* |
4 |
< |
* Basilisk II (C) 1997-2000 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'; |
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; |
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 |
|
|
796 |
|
break; |
797 |
|
|
798 |
|
case B_ABOUT_REQUESTED: { // "About" menu item selected |
799 |
< |
char str[256]; |
771 |
< |
sprintf(str, GetString(STR_ABOUT_TEXT1), VERSION_MAJOR, VERSION_MINOR); |
772 |
< |
strcat(str, " "); |
773 |
< |
strcat(str, GetString(STR_ABOUT_TEXT2)); |
774 |
< |
BAlert *about = new BAlert(GetString(STR_WINDOW_TITLE), str, GetString(STR_OK_BUTTON)); |
775 |
< |
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; |