172 |
|
// Path-entry BTextControl |
173 |
|
class PathControl : public BTextControl { |
174 |
|
public: |
175 |
< |
PathControl(BRect frame, const char *name, const char *label, const char *text, BMessage *message) : BTextControl(frame, name, label, text, message) |
175 |
> |
PathControl(bool dir_ctrl_, BRect frame, const char *name, const char *label, const char *text, BMessage *message) : BTextControl(frame, name, label, text, message), dir_ctrl(dir_ctrl_) |
176 |
|
{ |
177 |
|
for (int c=0; c<' '; c++) |
178 |
|
if (c != B_BACKSPACE && c != B_LEFT_ARROW && c != B_RIGHT_ARROW) |
187 |
|
|
188 |
|
// Look for dropped refs |
189 |
|
if (msg->FindRef("refs", &the_ref) == B_NO_ERROR) { |
190 |
< |
if (the_entry.SetTo(&the_ref) == B_NO_ERROR && the_entry.IsFile()) { |
190 |
> |
if (the_entry.SetTo(&the_ref) == B_NO_ERROR && (dir_ctrl&& the_entry.IsDirectory() || !dir_ctrl && the_entry.IsFile())) { |
191 |
|
BPath the_path; |
192 |
|
the_entry.GetPath(&the_path); |
193 |
|
SetText(the_path.Path()); |
199 |
|
} else |
200 |
|
BTextControl::MessageReceived(msg); |
201 |
|
} |
202 |
+ |
|
203 |
+ |
private: |
204 |
+ |
bool dir_ctrl; |
205 |
|
}; |
206 |
|
|
207 |
|
|
213 |
|
virtual void MessageReceived(BMessage *msg); |
214 |
|
|
215 |
|
private: |
216 |
+ |
void read_volumes_prefs(void); |
217 |
|
void hide_show_graphics_ctrls(void); |
218 |
|
void read_graphics_prefs(void); |
219 |
|
void add_serial_names(BPopUpMenu *menu, uint32 msg); |
244 |
|
BCheckBox *nosound_checkbox; |
245 |
|
BCheckBox *ether_checkbox; |
246 |
|
RAMSlider *ramsize_slider; |
247 |
+ |
PathControl *extfs_control; |
248 |
|
PathControl *rom_control; |
249 |
|
|
250 |
|
BFilePanel *add_volume_panel; |
384 |
|
* Create "Volumes" pane |
385 |
|
*/ |
386 |
|
|
387 |
+ |
void PrefsWindow::read_volumes_prefs(void) |
388 |
+ |
{ |
389 |
+ |
PrefsReplaceString("extfs", extfs_control->Text()); |
390 |
+ |
} |
391 |
+ |
|
392 |
|
BView *PrefsWindow::create_volumes_pane(void) |
393 |
|
{ |
394 |
|
BView *pane = new BView(BRect(0, 0, top_frame.right-20, top_frame.bottom-80), GetString(STR_VOLUMES_PANE_TITLE), B_FOLLOW_NONE, B_WILL_DRAW); |
408 |
|
pane->AddChild(new BButton(BRect(pane->Bounds().right/3, 118, pane->Bounds().right*2/3, 138), "create_volume", GetString(STR_CREATE_VOLUME_BUTTON), new BMessage(MSG_CREATE_VOLUME))); |
409 |
|
pane->AddChild(new BButton(BRect(pane->Bounds().right*2/3, 118, pane->Bounds().right-11, 138), "remove_volume", GetString(STR_REMOVE_VOLUME_BUTTON), new BMessage(MSG_REMOVE_VOLUME))); |
410 |
|
|
411 |
+ |
extfs_control = new PathControl(true, BRect(10, 145, right, 160), "extfs", GetString(STR_EXTFS_CTRL), PrefsFindString("extfs"), NULL); |
412 |
+ |
extfs_control->SetDivider(90); |
413 |
+ |
pane->AddChild(extfs_control); |
414 |
+ |
|
415 |
|
BMenuField *menu_field; |
416 |
|
BPopUpMenu *menu = new BPopUpMenu(""); |
417 |
< |
menu_field = new BMenuField(BRect(10, 145, right, 160), "bootdriver", GetString(STR_BOOTDRIVER_CTRL), menu); |
417 |
> |
menu_field = new BMenuField(BRect(10, 165, right, 180), "bootdriver", GetString(STR_BOOTDRIVER_CTRL), menu); |
418 |
|
menu_field->SetDivider(90); |
419 |
|
menu->AddItem(new BMenuItem(GetString(STR_BOOT_ANY_LAB), new BMessage(MSG_BOOT_ANY))); |
420 |
|
menu->AddItem(new BMenuItem(GetString(STR_BOOT_CDROM_LAB), new BMessage(MSG_BOOT_CDROM))); |
429 |
|
item->SetMarked(true); |
430 |
|
} |
431 |
|
|
432 |
< |
nocdrom_checkbox = new BCheckBox(BRect(10, 165, right, 180), "nocdrom", GetString(STR_NOCDROM_CTRL), new BMessage(MSG_NOCDROM)); |
432 |
> |
nocdrom_checkbox = new BCheckBox(BRect(10, 185, right, 200), "nocdrom", GetString(STR_NOCDROM_CTRL), new BMessage(MSG_NOCDROM)); |
433 |
|
pane->AddChild(nocdrom_checkbox); |
434 |
|
nocdrom_checkbox->SetValue(PrefsFindBool("nocdrom") ? B_CONTROL_ON : B_CONTROL_OFF); |
435 |
|
|
706 |
|
item->SetMarked(true); |
707 |
|
pane->AddChild(menu_field); |
708 |
|
|
709 |
< |
rom_control = new PathControl(BRect(10, 82, right, 97), "rom", GetString(STR_ROM_FILE_CTRL), PrefsFindString("rom"), NULL); |
709 |
> |
rom_control = new PathControl(false, BRect(10, 82, right, 97), "rom", GetString(STR_ROM_FILE_CTRL), PrefsFindString("rom"), NULL); |
710 |
|
rom_control->SetDivider(117); |
711 |
|
pane->AddChild(rom_control); |
712 |
|
|
722 |
|
{ |
723 |
|
switch (msg->what) { |
724 |
|
case MSG_OK: { // "Start" button clicked |
725 |
+ |
read_volumes_prefs(); |
726 |
|
read_memory_prefs(); |
727 |
|
read_graphics_prefs(); |
728 |
|
SavePrefs(); |