ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/Frodo4/Src/Prefs_Be.h
(Generate patch)

Comparing Frodo4/Src/Prefs_Be.h (file contents):
Revision 1.2 by cebix, 2003-07-01T17:51:17Z vs.
Revision 1.5 by cebix, 2004-01-14T17:26:29Z

# Line 1 | Line 1
1   /*
2   *  Prefs_Be.h - Global preferences, Be specific stuff
3   *
4 < *  Frodo (C) 1994-1997,2002-2003 Christian Bauer
4 > *  Frodo (C) 1994-1997,2002-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 34 | Line 34 | const uint32 MSG_OK = 'okok';
34   const uint32 MSG_CANCEL = 'cncl';
35   const uint32 MSG_SPRITES_ON = 'spon';
36   const uint32 MSG_SPRITE_COLLISIONS = 'scol';
37 < const uint32 MSG_JOYSTICK_1_ON = 'joy1';
38 < const uint32 MSG_JOYSTICK_2_ON = 'joy2';
37 > const uint32 MSG_JOYSTICK_1_PORT = 'joy1';
38 > const uint32 MSG_JOYSTICK_2_PORT = 'joy2';
39   const uint32 MSG_JOYSTICK_SWAP = 'jswp';
40   const uint32 MSG_LIMIT_SPEED = 'lmit';
41   const uint32 MSG_FAST_RESET = 'frst';
# Line 44 | Line 44 | const uint32 MSG_SID_FILTERS = 'filt';
44   const uint32 MSG_DOUBLE_SCAN = 'dbls';
45   const uint32 MSG_MAP_SLASH = 'mpsl';
46   const uint32 MSG_EMUL_1541_PROC = '15pr';
47 const uint32 MSG_DRVTYPE_8 = 'drt8';
48 const uint32 MSG_DRVTYPE_9 = 'drt9';
49 const uint32 MSG_DRVTYPE_10 = 'drt:';
50 const uint32 MSG_DRVTYPE_11 = 'drt;';
47   const uint32 MSG_GETDRIVE_8 = 'gtd8';
48   const uint32 MSG_GETDRIVE_9 = 'gtd9';
49   const uint32 MSG_GETDRIVE_10 = 'gtd:';
# Line 82 | Line 78 | public:
78   private:
79          BCheckBox *make_checkbox(BRect frame, char *label, uint32 what, BView *parent);
80          NumberControl *make_number_entry(BRect frame, char *label_text, BView *parent);
85        BPopUpMenu *make_drvtype_popup(BRect frame, uint32 what, BView *parent);
81          PathControl *make_path_entry(BRect frame, char *label, BView *parent);
82          BPopUpMenu *make_sidtype_popup(BRect frame, char *label_text, uint32 what, BView *parent);
83          BPopUpMenu *make_reusize_popup(BRect frame, char *label_text, uint32 what, BView *parent);
84          BPopUpMenu *make_disptype_popup(BRect frame, char *label_text, uint32 what, BView *parent);
85 +        BPopUpMenu *make_joystick_popup(BRect frame, char *label_text, uint32 what, BView *parent);
86          void set_values(void);
87          void get_values(void);
88          void ghost_controls(void);
# Line 107 | Line 103 | private:
103          NumberControl *g_cia_cycles;
104          NumberControl *g_floppy_cycles;
105          NumberControl *g_skip_frames;
110        BPopUpMenu *g_drive_type[4];
106          PathControl *g_drive_path[4];
107          BPopUpMenu *g_sid_type;
108          BPopUpMenu *g_reu_size;
109          BPopUpMenu *g_display_type;
110 +        BPopUpMenu *g_joystick_1_port;
111 +        BPopUpMenu *g_joystick_2_port;
112          BCheckBox *g_sprites_on;
113          BCheckBox *g_sprite_collisions;
117        BCheckBox *g_joystick_1_on;
118        BCheckBox *g_joystick_2_on;
114          BCheckBox *g_joystick_swap;
115          BCheckBox *g_limit_speed;
116          BCheckBox *g_fast_reset;
# Line 259 | Line 254 | PrefsWindow::PrefsWindow(Prefs *p, bool
254          bar->AddItem(menu);
255          AddChild(bar);
256          SetKeyMenuBar(bar);
257 <        int mbar_height = bar->Frame().bottom + 1;
257 >        int mbar_height = int(bar->Frame().bottom) + 1;
258  
259          // Resize window to fit menu bar
260          ResizeBy(0, mbar_height);
# Line 271 | Line 266 | PrefsWindow::PrefsWindow(Prefs *p, bool
266          top->SetViewColor(fill_color);
267  
268          // Checkboxes
269 <        g_sprites_on = make_checkbox(BRect(10, 10, 160, 21), "Sprite display", MSG_SPRITES_ON, top);
270 <        g_sprite_collisions = make_checkbox(BRect(10, 25, 160, 36), "Sprite collisions", MSG_SPRITE_COLLISIONS, top);
271 <        g_joystick_1_on = make_checkbox(BRect(10, 40, 160, 51), "Joystick on port 1", MSG_JOYSTICK_1_ON, top);
272 <        g_joystick_2_on = make_checkbox(BRect(10, 55, 160, 66), "Joystick on port 2", MSG_JOYSTICK_2_ON, top);
273 <        g_joystick_swap = make_checkbox(BRect(10, 70, 160, 81), "Swap joysticks", MSG_JOYSTICK_SWAP, top);
274 <        g_limit_speed = make_checkbox(BRect(10, 85, 160, 96), "Limit speed", MSG_LIMIT_SPEED, top);
275 <        g_fast_reset = make_checkbox(BRect(10, 100, 160, 111), "Fast reset", MSG_FAST_RESET, top);
276 <        g_cia_irq_hack = make_checkbox(BRect(10, 115, 160, 126), "Clear CIA ICR on write", MSG_CIA_IRQ_HACK, top);
277 <        g_sid_filters = make_checkbox(BRect(10, 130, 160, 141), "SID filters", MSG_SID_FILTERS, top);
278 <        g_double_scan = make_checkbox(BRect(10, 145, 160, 156), "Doublescan lines", MSG_DOUBLE_SCAN, top);
269 >        g_sprites_on = make_checkbox(BRect(10, 10, 180, 21), "Sprite display", MSG_SPRITES_ON, top);
270 >        g_sprite_collisions = make_checkbox(BRect(10, 25, 180, 36), "Sprite collisions", MSG_SPRITE_COLLISIONS, top);
271 >        g_limit_speed = make_checkbox(BRect(10, 40, 180, 51), "Limit speed", MSG_LIMIT_SPEED, top);
272 >        g_fast_reset = make_checkbox(BRect(10, 55, 180, 66), "Fast reset", MSG_FAST_RESET, top);
273 >        g_cia_irq_hack = make_checkbox(BRect(10, 70, 180, 81), "Clear CIA ICR on write", MSG_CIA_IRQ_HACK, top);
274 >        g_sid_filters = make_checkbox(BRect(10, 85, 180, 96), "SID filters", MSG_SID_FILTERS, top);
275 >        g_double_scan = make_checkbox(BRect(10, 100, 180, 111), "Doublescan lines", MSG_DOUBLE_SCAN, top);
276 >        g_joystick_swap = make_checkbox(BRect(10, 115, 180, 126), "Swap joysticks", MSG_JOYSTICK_SWAP, top);
277 >        g_joystick_1_port = make_joystick_popup(BRect(10, 130, 180, 145), "Joystick 1", MSG_JOYSTICK_1_PORT, top);
278 >        g_joystick_2_port = make_joystick_popup(BRect(10, 150, 180, 165), "Joystick 2", MSG_JOYSTICK_2_PORT, top);
279  
280          // Number entry fields
281 <        g_normal_cycles = make_number_entry(BRect(160, 10, 390, 26), "Cycles per line (CPU)", top);
282 <        g_bad_line_cycles = make_number_entry(BRect(160, 30, 390, 46), "Cycles per Bad Line (CPU)", top);
283 <        g_cia_cycles = make_number_entry(BRect(160, 50, 390, 66), "Cycles per line (CIA)", top);
284 <        g_floppy_cycles = make_number_entry(BRect(160, 70, 390, 86), "Cycles per line (1541)", top);
285 <        g_skip_frames = make_number_entry(BRect(160, 90, 390, 106), "Draw every n-th frame", top);
281 >        g_normal_cycles = make_number_entry(BRect(180, 10, 390, 26), "Cycles per line (CPU)", top);
282 >        g_bad_line_cycles = make_number_entry(BRect(180, 30, 390, 46), "Cycles per Bad Line (CPU)", top);
283 >        g_cia_cycles = make_number_entry(BRect(180, 50, 390, 66), "Cycles per line (CIA)", top);
284 >        g_floppy_cycles = make_number_entry(BRect(180, 70, 390, 86), "Cycles per line (1541)", top);
285 >        g_skip_frames = make_number_entry(BRect(180, 90, 390, 106), "Draw every n-th frame", top);
286  
287          // Popup fields
288 <        g_display_type = make_disptype_popup(BRect(160, 110, 390, 126), "Display type", MSG_DISPLAY_TYPE, top);
289 <        g_sid_type = make_sidtype_popup(BRect(160, 130, 390, 146), "SID emulation type", MSG_SID_TYPE, top);
290 <        g_reu_size = make_reusize_popup(BRect(160, 150, 390, 166), "REU size", MSG_REU_SIZE, top);
288 >        g_display_type = make_disptype_popup(BRect(180, 110, 390, 126), "Display type", MSG_DISPLAY_TYPE, top);
289 >        g_sid_type = make_sidtype_popup(BRect(180, 130, 390, 146), "SID emulation type", MSG_SID_TYPE, top);
290 >        g_reu_size = make_reusize_popup(BRect(180, 150, 390, 166), "REU size", MSG_REU_SIZE, top);
291  
292          // Prepare on/off pictures for file panel buttons
293          BView *view = new BView(BRect(0, 0, 19, 15), "", B_FOLLOW_NONE, 0);
# Line 346 | Line 341 | PrefsWindow::PrefsWindow(Prefs *p, bool
341                  sprintf(str, "%d", i+8);
342                  g_drive_path[i] = make_path_entry(BRect(10, 14+i*20, 299, 30+i*20), str, drvbox);
343                  drvbox->AddChild(new BPictureButton(BRect(304, 16+i*20, 323, 31+i*20), "", new BPicture(*on), new BPicture(*off), new BMessage(MSG_GETDRIVE_8 + i)));
349                g_drive_type[i] = make_drvtype_popup(BRect(329, 14+i*20, 373, 30+i*20), MSG_DRVTYPE_8 + i, drvbox);
344          }
345  
346          g_map_slash = make_checkbox(BRect(10, 94, 300, 110), "Map '/'<->'\\' in filenames", MSG_MAP_SLASH, drvbox);
# Line 370 | Line 364 | PrefsWindow::PrefsWindow(Prefs *p, bool
364          save_panel->Window()->SetTitle("Frodo: Save preferences");
365          file_panel = new BFilePanel(B_OPEN_PANEL, &this_messenger, NULL, 0, false, new BMessage(MSG_DRIVE_PANEL_RETURNED));
366          file_panel->SetPanelDirectory(&AppDirectory);
367 +        file_panel->Window()->SetTitle("Frodo: Select disk image or archive file");
368          dir_panel = new BFilePanel(B_OPEN_PANEL, &this_messenger, NULL, B_DIRECTORY_NODE, false, new BMessage(MSG_DRIVE_PANEL_RETURNED));
369          dir_panel->SetPanelDirectory(&AppDirectory);
370          dir_panel->Window()->SetTitle("Frodo: Select directory");
# Line 409 | Line 404 | NumberControl *PrefsWindow::make_number_
404  
405  
406   /*
412 *  Create drive type popup menu
413 */
414
415 BPopUpMenu *PrefsWindow::make_drvtype_popup(BRect frame, uint32 what, BView *parent)
416 {
417        BPopUpMenu *popup = new BPopUpMenu("drive_type popup", true, true);
418        popup->AddItem(new BMenuItem("Dir", new BMessage(what)));
419        popup->AddItem(new BMenuItem("D64", new BMessage(what)));
420        popup->AddItem(new BMenuItem("T64", new BMessage(what)));
421        popup->SetTargetForItems(this);
422        BMenuField *menu_field = new BMenuField(frame, "drive_type", NULL, popup);
423        menu_field->SetDivider(0);
424        parent->AddChild(menu_field);
425        return popup;
426 }
427
428
429 /*
407   *  Create path entry field
408   */
409  
# Line 455 | Line 432 | BPopUpMenu *PrefsWindow::make_disptype_p
432          popup->AddItem(new BMenuItem("Screen", new BMessage(what)));
433          popup->SetTargetForItems(this);
434          BMenuField *menu_field = new BMenuField(frame, "display_type", label_text, popup);
435 <        menu_field->SetDivider(frame.Width()-55);
435 >        menu_field->SetDivider(frame.Width()-75);
436          menu_field->SetAlignment(B_ALIGN_RIGHT);
437          parent->AddChild(menu_field);
438          return popup;
# Line 473 | Line 450 | BPopUpMenu *PrefsWindow::make_sidtype_po
450          popup->AddItem(new BMenuItem("Digital", new BMessage(what)));
451          popup->SetTargetForItems(this);
452          BMenuField *menu_field = new BMenuField(frame, "sid_type", label_text, popup);
453 <        menu_field->SetDivider(frame.Width()-55);
453 >        menu_field->SetDivider(frame.Width()-75);
454          menu_field->SetAlignment(B_ALIGN_RIGHT);
455          parent->AddChild(menu_field);
456          return popup;
# Line 493 | Line 470 | BPopUpMenu *PrefsWindow::make_reusize_po
470          popup->AddItem(new BMenuItem("512K", new BMessage(what)));
471          popup->SetTargetForItems(this);
472          BMenuField *menu_field = new BMenuField(frame, "reu_size", label_text, popup);
473 <        menu_field->SetDivider(frame.Width()-55);
473 >        menu_field->SetDivider(frame.Width()-75);
474 >        menu_field->SetAlignment(B_ALIGN_RIGHT);
475 >        parent->AddChild(menu_field);
476 >        return popup;
477 > }
478 >
479 >
480 > /*
481 > *  Create joystick port popup
482 > */
483 >
484 > BPopUpMenu *PrefsWindow::make_joystick_popup(BRect frame, char *label_text, uint32 what, BView *parent)
485 > {
486 >        BPopUpMenu *popup = new BPopUpMenu("joystick popup", true, true);
487 >        popup->AddItem(new BMenuItem("None", new BMessage(what)));
488 >        popup->AddItem(new BMenuItem("Joystick Port 1", new BMessage(what)));
489 >        popup->AddItem(new BMenuItem("Joystick Port 2", new BMessage(what)));
490 >        popup->AddItem(new BMenuItem("GeekPort A", new BMessage(what)));
491 >        popup->AddItem(new BMenuItem("GeekPort B", new BMessage(what)));
492 >        popup->SetTargetForItems(this);
493 >        BMenuField *menu_field = new BMenuField(frame, "joystick", label_text, popup);
494 >        menu_field->SetDivider(60);
495          menu_field->SetAlignment(B_ALIGN_RIGHT);
496          parent->AddChild(menu_field);
497          return popup;
# Line 514 | Line 512 | void PrefsWindow::set_values(void)
512          g_floppy_cycles->SetValue(prefs->FloppyCycles);
513          g_skip_frames->SetValue(prefs->SkipFrames);
514  
515 <        for (int i=0; i<4; i++) {
518 <                g_drive_type[i]->ItemAt(prefs->DriveType[i])->SetMarked(true);
515 >        for (int i=0; i<4; i++)
516                  g_drive_path[i]->SetText(prefs->DrivePath[i]);
520        }
517  
518          g_sid_type->ItemAt(prefs->SIDType)->SetMarked(true);
519          g_reu_size->ItemAt(prefs->REUSize)->SetMarked(true);
# Line 525 | Line 521 | void PrefsWindow::set_values(void)
521  
522          g_sprites_on->SetValue(prefs->SpritesOn ? B_CONTROL_ON : B_CONTROL_OFF);
523          g_sprite_collisions->SetValue(prefs->SpriteCollisions ? B_CONTROL_ON : B_CONTROL_OFF);
524 <        g_joystick_1_on->SetValue(prefs->Joystick1On ? B_CONTROL_ON : B_CONTROL_OFF);
525 <        g_joystick_2_on->SetValue(prefs->Joystick2On ? B_CONTROL_ON : B_CONTROL_OFF);
524 >        g_joystick_1_port->ItemAt(prefs->Joystick1Port)->SetMarked(true);
525 >        g_joystick_2_port->ItemAt(prefs->Joystick2Port)->SetMarked(true);
526          g_joystick_swap->SetValue(prefs->JoystickSwap ? B_CONTROL_ON : B_CONTROL_OFF);
527          g_limit_speed->SetValue(prefs->LimitSpeed ? B_CONTROL_ON : B_CONTROL_OFF);
528          g_fast_reset->SetValue(prefs->FastReset ? B_CONTROL_ON : B_CONTROL_OFF);
# Line 615 | Line 611 | void PrefsWindow::MessageReceived(BMessa
611                          prefs->SpriteCollisions = !prefs->SpriteCollisions;
612                          break;
613  
614 <                case MSG_JOYSTICK_1_ON:
615 <                        prefs->Joystick1On = !prefs->Joystick1On;
614 >                case MSG_JOYSTICK_1_PORT:
615 >                        prefs->Joystick1Port = msg->FindInt32("index");
616                          break;
617  
618 <                case MSG_JOYSTICK_2_ON:
619 <                        prefs->Joystick2On = !prefs->Joystick2On;
618 >                case MSG_JOYSTICK_2_PORT:
619 >                        prefs->Joystick2Port = msg->FindInt32("index");
620                          break;
621  
622                  case MSG_JOYSTICK_SWAP:
# Line 668 | Line 664 | void PrefsWindow::MessageReceived(BMessa
664                          prefs->Emul1541Proc = !prefs->Emul1541Proc;
665                          break;
666  
671                case MSG_DRVTYPE_8:
672                case MSG_DRVTYPE_9:
673                case MSG_DRVTYPE_10:
674                case MSG_DRVTYPE_11:
675                        prefs->DriveType[msg->what & 3] = msg->FindInt32("index");
676                        break;
677
667                  case MSG_GETDRIVE_8:
668                  case MSG_GETDRIVE_9:
669                  case MSG_GETDRIVE_10:
670                  case MSG_GETDRIVE_11:
671                          panel_drive_num = msg->what & 3;
672 <                        file_panel->Hide();
673 <                        dir_panel->Hide();
674 <                        if (prefs->DriveType[panel_drive_num] == DRVTYPE_D64) {
675 <                                file_panel->Window()->SetTitle("Frodo: Select disk image file");
687 <                                file_panel->Show();
688 <                        } else if (prefs->DriveType[panel_drive_num] == DRVTYPE_T64) {
689 <                                file_panel->Window()->SetTitle("Frodo: Select archive file");
690 <                                file_panel->Show();
691 <                        } else
692 <                                dir_panel->Show();
672 > //                      file_panel->Hide();
673 > //                      dir_panel->Hide();
674 >                        file_panel->Show();
675 > //                      dir_panel->Show();
676                          break;
677  
678                  case MSG_DRIVE_PANEL_RETURNED:  {       // Drive path file panel returned
# Line 775 | Line 758 | bool PrefsWindow::FilterKeyDown(uint32 *
758          if (*aChar == B_ESCAPE) {
759                  // Flash Cancel button
760                  g_cancel->SetValue(B_CONTROL_ON);
761 <                snooze(100000.0);
761 >                snooze(100000);
762                  PostMessage(MSG_CANCEL);
763          }
764          return true;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines