MCPcopy Create free account
hub / github.com/bbbradsmith/nsfplay / OnInitDialog

Method OnInitDialog

nsfplug_ui/NSFTrackDialog.cpp:485–545  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

483}
484
485BOOL NSFTrackDialog::OnInitDialog()
486{
487 __super::OnInitDialog();
488
489 HICON hIcon = AfxGetApp()->LoadIcon(IDI_NSF);
490 SetIcon(hIcon, TRUE);
491
492 char *cname[] = { "Track ", "Vol", " Freq", "Key", "Oct", "Tone", "Wave", NULL };
493
494 m_pDCtrk = m_trkinfo.GetDC();
495 for(int i=0; cname[i]!=NULL; i++)
496 m_trkinfo.InsertColumn(i,cname[i],(i==0||i==6)?LVCFMT_LEFT:LVCFMT_RIGHT,i==6?68:m_pDCtrk->GetTextExtent(cname[i]).cx+12+(i?0:12),i);
497 m_trkinfo.SetExtendedStyle(LVS_EX_CHECKBOXES|LVS_EX_HEADERDRAGDROP|LVS_EX_DOUBLEBUFFER);
498 m_trkinfo.SetBkColor(RGB(0,0,0));
499 m_trkinfo.SetTextColor(RGB(0,212,0));
500 m_trkinfo.SetTextBkColor(RGB(0,0,0));
501
502 m_keydlg.Create(m_keydlg.IDD,this);
503 m_keydlg.ShowWindow(SW_SHOW);
504
505 m_speed.SetRange(1,8);
506 m_speed.SetTicFreq(1);
507 m_speed.SetPageSize(1);
508 m_speed.SetLineSize(1);
509
510 CRect rect, rect2;
511 GetClientRect(&rect);
512 GetWindowRect(&rect2);
513 int min_height = rect2.Height()-rect.Height();
514 int min_width = rect2.Width()-rect.Width();
515 m_keydlg.GetWindowRect(&rect);
516 min_height += rect.Height();
517 min_width += m_keydlg.MinWidth();
518 SetWindowPos(NULL,0,0,min_width,256,SWP_NOMOVE|SWP_NOZORDER);
519 LocateDialogItems();
520
521 // setup colors
522 for (int i=0; i < NES_CHANNEL_MAX; ++i)
523 {
524 int t = pm->cf->channel_track[i];
525 std::string sc = pm->cf->GetChannelConfig(i,"COL").GetStr();
526 int c = read_color(sc.c_str());
527 //DEBUG_OUT("Channel %02d colour: %06X (%s)\n", i, c, pm->cf->channel_name[i]);
528 if (c >= 0 && c <= 0xFFFFFF) keyColMap[t] = c;
529 }
530 {
531 std::string sc = pm->cf->GetValue("5B_ENVELOPE_COL").GetStr();
532 int c = read_color(sc.c_str());
533 //DEBUG_OUT("5B envelope colour: %06X\n", c);
534 if (c >= 0 && c <= 0xFFFFFF) keyColMap[NSFPlayer::FME7_TRK3] = c;
535 }
536 {
537 std::string sc = pm->cf->GetValue("5B_NOISE_COL").GetStr();
538 int c = read_color(sc.c_str());
539 //DEBUG_OUT("5B noise colour: %06X\n", c);
540 if (c >= 0 && c <= 0xFFFFFF) keyColMap[NSFPlayer::FME7_TRK4] = c;
541 }
542

Callers

nothing calls this directly

Calls 3

read_colorFunction · 0.85
GetStrMethod · 0.80
MinWidthMethod · 0.45

Tested by

no test coverage detected