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'; |
87 |
|
BPopUpMenu *make_sidtype_popup(BRect frame, char *label_text, uint32 what, BView *parent); |
88 |
|
BPopUpMenu *make_reusize_popup(BRect frame, char *label_text, uint32 what, BView *parent); |
89 |
|
BPopUpMenu *make_disptype_popup(BRect frame, char *label_text, uint32 what, BView *parent); |
90 |
+ |
BPopUpMenu *make_joystick_popup(BRect frame, char *label_text, uint32 what, BView *parent); |
91 |
|
void set_values(void); |
92 |
|
void get_values(void); |
93 |
|
void ghost_controls(void); |
108 |
|
NumberControl *g_cia_cycles; |
109 |
|
NumberControl *g_floppy_cycles; |
110 |
|
NumberControl *g_skip_frames; |
110 |
– |
BPopUpMenu *g_drive_type[4]; |
111 |
|
PathControl *g_drive_path[4]; |
112 |
+ |
BPopUpMenu *g_drive_type[4]; |
113 |
|
BPopUpMenu *g_sid_type; |
114 |
|
BPopUpMenu *g_reu_size; |
115 |
|
BPopUpMenu *g_display_type; |
116 |
+ |
BPopUpMenu *g_joystick_1_port; |
117 |
+ |
BPopUpMenu *g_joystick_2_port; |
118 |
|
BCheckBox *g_sprites_on; |
119 |
|
BCheckBox *g_sprite_collisions; |
117 |
– |
BCheckBox *g_joystick_1_on; |
118 |
– |
BCheckBox *g_joystick_2_on; |
120 |
|
BCheckBox *g_joystick_swap; |
121 |
|
BCheckBox *g_limit_speed; |
122 |
|
BCheckBox *g_fast_reset; |
260 |
|
bar->AddItem(menu); |
261 |
|
AddChild(bar); |
262 |
|
SetKeyMenuBar(bar); |
263 |
< |
int mbar_height = bar->Frame().bottom + 1; |
263 |
> |
int mbar_height = int(bar->Frame().bottom) + 1; |
264 |
|
|
265 |
|
// Resize window to fit menu bar |
266 |
|
ResizeBy(0, mbar_height); |
272 |
|
top->SetViewColor(fill_color); |
273 |
|
|
274 |
|
// Checkboxes |
275 |
< |
g_sprites_on = make_checkbox(BRect(10, 10, 160, 21), "Sprite display", MSG_SPRITES_ON, top); |
276 |
< |
g_sprite_collisions = make_checkbox(BRect(10, 25, 160, 36), "Sprite collisions", MSG_SPRITE_COLLISIONS, top); |
277 |
< |
g_joystick_1_on = make_checkbox(BRect(10, 40, 160, 51), "Joystick on port 1", MSG_JOYSTICK_1_ON, top); |
278 |
< |
g_joystick_2_on = make_checkbox(BRect(10, 55, 160, 66), "Joystick on port 2", MSG_JOYSTICK_2_ON, top); |
279 |
< |
g_joystick_swap = make_checkbox(BRect(10, 70, 160, 81), "Swap joysticks", MSG_JOYSTICK_SWAP, top); |
280 |
< |
g_limit_speed = make_checkbox(BRect(10, 85, 160, 96), "Limit speed", MSG_LIMIT_SPEED, top); |
281 |
< |
g_fast_reset = make_checkbox(BRect(10, 100, 160, 111), "Fast reset", MSG_FAST_RESET, top); |
282 |
< |
g_cia_irq_hack = make_checkbox(BRect(10, 115, 160, 126), "Clear CIA ICR on write", MSG_CIA_IRQ_HACK, top); |
283 |
< |
g_sid_filters = make_checkbox(BRect(10, 130, 160, 141), "SID filters", MSG_SID_FILTERS, top); |
284 |
< |
g_double_scan = make_checkbox(BRect(10, 145, 160, 156), "Doublescan lines", MSG_DOUBLE_SCAN, top); |
275 |
> |
g_sprites_on = make_checkbox(BRect(10, 10, 180, 21), "Sprite display", MSG_SPRITES_ON, top); |
276 |
> |
g_sprite_collisions = make_checkbox(BRect(10, 25, 180, 36), "Sprite collisions", MSG_SPRITE_COLLISIONS, top); |
277 |
> |
g_limit_speed = make_checkbox(BRect(10, 40, 180, 51), "Limit speed", MSG_LIMIT_SPEED, top); |
278 |
> |
g_fast_reset = make_checkbox(BRect(10, 55, 180, 66), "Fast reset", MSG_FAST_RESET, top); |
279 |
> |
g_cia_irq_hack = make_checkbox(BRect(10, 70, 180, 81), "Clear CIA ICR on write", MSG_CIA_IRQ_HACK, top); |
280 |
> |
g_sid_filters = make_checkbox(BRect(10, 85, 180, 96), "SID filters", MSG_SID_FILTERS, top); |
281 |
> |
g_double_scan = make_checkbox(BRect(10, 100, 180, 111), "Doublescan lines", MSG_DOUBLE_SCAN, top); |
282 |
> |
g_joystick_swap = make_checkbox(BRect(10, 115, 180, 126), "Swap joysticks", MSG_JOYSTICK_SWAP, top); |
283 |
> |
g_joystick_1_port = make_joystick_popup(BRect(10, 130, 180, 145), "Joystick 1", MSG_JOYSTICK_1_PORT, top); |
284 |
> |
g_joystick_2_port = make_joystick_popup(BRect(10, 150, 180, 165), "Joystick 2", MSG_JOYSTICK_2_PORT, top); |
285 |
|
|
286 |
|
// Number entry fields |
287 |
< |
g_normal_cycles = make_number_entry(BRect(160, 10, 390, 26), "Cycles per line (CPU)", top); |
288 |
< |
g_bad_line_cycles = make_number_entry(BRect(160, 30, 390, 46), "Cycles per Bad Line (CPU)", top); |
289 |
< |
g_cia_cycles = make_number_entry(BRect(160, 50, 390, 66), "Cycles per line (CIA)", top); |
290 |
< |
g_floppy_cycles = make_number_entry(BRect(160, 70, 390, 86), "Cycles per line (1541)", top); |
291 |
< |
g_skip_frames = make_number_entry(BRect(160, 90, 390, 106), "Draw every n-th frame", top); |
287 |
> |
g_normal_cycles = make_number_entry(BRect(180, 10, 390, 26), "Cycles per line (CPU)", top); |
288 |
> |
g_bad_line_cycles = make_number_entry(BRect(180, 30, 390, 46), "Cycles per Bad Line (CPU)", top); |
289 |
> |
g_cia_cycles = make_number_entry(BRect(180, 50, 390, 66), "Cycles per line (CIA)", top); |
290 |
> |
g_floppy_cycles = make_number_entry(BRect(180, 70, 390, 86), "Cycles per line (1541)", top); |
291 |
> |
g_skip_frames = make_number_entry(BRect(180, 90, 390, 106), "Draw every n-th frame", top); |
292 |
|
|
293 |
|
// Popup fields |
294 |
< |
g_display_type = make_disptype_popup(BRect(160, 110, 390, 126), "Display type", MSG_DISPLAY_TYPE, top); |
295 |
< |
g_sid_type = make_sidtype_popup(BRect(160, 130, 390, 146), "SID emulation type", MSG_SID_TYPE, top); |
296 |
< |
g_reu_size = make_reusize_popup(BRect(160, 150, 390, 166), "REU size", MSG_REU_SIZE, top); |
294 |
> |
g_display_type = make_disptype_popup(BRect(180, 110, 390, 126), "Display type", MSG_DISPLAY_TYPE, top); |
295 |
> |
g_sid_type = make_sidtype_popup(BRect(180, 130, 390, 146), "SID emulation type", MSG_SID_TYPE, top); |
296 |
> |
g_reu_size = make_reusize_popup(BRect(180, 150, 390, 166), "REU size", MSG_REU_SIZE, top); |
297 |
|
|
298 |
|
// Prepare on/off pictures for file panel buttons |
299 |
|
BView *view = new BView(BRect(0, 0, 19, 15), "", B_FOLLOW_NONE, 0); |
456 |
|
popup->AddItem(new BMenuItem("Screen", new BMessage(what))); |
457 |
|
popup->SetTargetForItems(this); |
458 |
|
BMenuField *menu_field = new BMenuField(frame, "display_type", label_text, popup); |
459 |
< |
menu_field->SetDivider(frame.Width()-55); |
459 |
> |
menu_field->SetDivider(frame.Width()-75); |
460 |
|
menu_field->SetAlignment(B_ALIGN_RIGHT); |
461 |
|
parent->AddChild(menu_field); |
462 |
|
return popup; |
474 |
|
popup->AddItem(new BMenuItem("Digital", new BMessage(what))); |
475 |
|
popup->SetTargetForItems(this); |
476 |
|
BMenuField *menu_field = new BMenuField(frame, "sid_type", label_text, popup); |
477 |
< |
menu_field->SetDivider(frame.Width()-55); |
477 |
> |
menu_field->SetDivider(frame.Width()-75); |
478 |
|
menu_field->SetAlignment(B_ALIGN_RIGHT); |
479 |
|
parent->AddChild(menu_field); |
480 |
|
return popup; |
494 |
|
popup->AddItem(new BMenuItem("512K", new BMessage(what))); |
495 |
|
popup->SetTargetForItems(this); |
496 |
|
BMenuField *menu_field = new BMenuField(frame, "reu_size", label_text, popup); |
497 |
< |
menu_field->SetDivider(frame.Width()-55); |
497 |
> |
menu_field->SetDivider(frame.Width()-75); |
498 |
> |
menu_field->SetAlignment(B_ALIGN_RIGHT); |
499 |
> |
parent->AddChild(menu_field); |
500 |
> |
return popup; |
501 |
> |
} |
502 |
> |
|
503 |
> |
|
504 |
> |
/* |
505 |
> |
* Create joystick port popup |
506 |
> |
*/ |
507 |
> |
|
508 |
> |
BPopUpMenu *PrefsWindow::make_joystick_popup(BRect frame, char *label_text, uint32 what, BView *parent) |
509 |
> |
{ |
510 |
> |
BPopUpMenu *popup = new BPopUpMenu("joystick popup", true, true); |
511 |
> |
popup->AddItem(new BMenuItem("None", new BMessage(what))); |
512 |
> |
popup->AddItem(new BMenuItem("Joystick Port 1", new BMessage(what))); |
513 |
> |
popup->AddItem(new BMenuItem("Joystick Port 2", new BMessage(what))); |
514 |
> |
popup->AddItem(new BMenuItem("GeekPort A", new BMessage(what))); |
515 |
> |
popup->AddItem(new BMenuItem("GeekPort B", new BMessage(what))); |
516 |
> |
popup->SetTargetForItems(this); |
517 |
> |
BMenuField *menu_field = new BMenuField(frame, "joystick", label_text, popup); |
518 |
> |
menu_field->SetDivider(60); |
519 |
|
menu_field->SetAlignment(B_ALIGN_RIGHT); |
520 |
|
parent->AddChild(menu_field); |
521 |
|
return popup; |
547 |
|
|
548 |
|
g_sprites_on->SetValue(prefs->SpritesOn ? B_CONTROL_ON : B_CONTROL_OFF); |
549 |
|
g_sprite_collisions->SetValue(prefs->SpriteCollisions ? B_CONTROL_ON : B_CONTROL_OFF); |
550 |
< |
g_joystick_1_on->SetValue(prefs->Joystick1On ? B_CONTROL_ON : B_CONTROL_OFF); |
551 |
< |
g_joystick_2_on->SetValue(prefs->Joystick2On ? B_CONTROL_ON : B_CONTROL_OFF); |
550 |
> |
g_joystick_1_port->ItemAt(prefs->Joystick1Port)->SetMarked(true); |
551 |
> |
g_joystick_2_port->ItemAt(prefs->Joystick2Port)->SetMarked(true); |
552 |
|
g_joystick_swap->SetValue(prefs->JoystickSwap ? B_CONTROL_ON : B_CONTROL_OFF); |
553 |
|
g_limit_speed->SetValue(prefs->LimitSpeed ? B_CONTROL_ON : B_CONTROL_OFF); |
554 |
|
g_fast_reset->SetValue(prefs->FastReset ? B_CONTROL_ON : B_CONTROL_OFF); |
637 |
|
prefs->SpriteCollisions = !prefs->SpriteCollisions; |
638 |
|
break; |
639 |
|
|
640 |
< |
case MSG_JOYSTICK_1_ON: |
641 |
< |
prefs->Joystick1On = !prefs->Joystick1On; |
640 |
> |
case MSG_JOYSTICK_1_PORT: |
641 |
> |
prefs->Joystick1Port = msg->FindInt32("index"); |
642 |
|
break; |
643 |
|
|
644 |
< |
case MSG_JOYSTICK_2_ON: |
645 |
< |
prefs->Joystick2On = !prefs->Joystick2On; |
644 |
> |
case MSG_JOYSTICK_2_PORT: |
645 |
> |
prefs->Joystick2Port = msg->FindInt32("index"); |
646 |
|
break; |
647 |
|
|
648 |
|
case MSG_JOYSTICK_SWAP: |
797 |
|
if (*aChar == B_ESCAPE) { |
798 |
|
// Flash Cancel button |
799 |
|
g_cancel->SetValue(B_CONTROL_ON); |
800 |
< |
snooze(100000.0); |
800 |
> |
snooze(100000); |
801 |
|
PostMessage(MSG_CANCEL); |
802 |
|
} |
803 |
|
return true; |