FamiTrackerModulePropertiesDialog::FamiTrackerModulePropertiesDialog(CFamiTrackerDoc* pDoc, QWidget *parent) : QDialog(parent), ui(new Ui::FamiTrackerModulePropertiesDialog) { int idx; CString TrackTitle; ui->setupUi(this); m_pDocument = pDoc; CChannelMap* pChannelMap = theApp.GetChannelMap(); for ( idx = 0; idx < pChannelMap->GetChipCount(); idx++ ) { #ifdef UNICODE ui->expansionSound->addItem(QString::fromWCharArray(pChannelMap->GetChipName(idx))); #else ui->expansionSound->addItem(QString(pChannelMap->GetChipName(idx))); #endif ui->expansionSound->setItemData(idx,pChannelMap->GetChipIdent(idx)); } tracksModel = new QStringListModel(); QStringList songs; for ( idx = 0; idx < pDoc->GetTrackCount(); idx++ ) { TrackTitle.Format(TRACK_FORMAT, idx+1, pDoc->GetTrackTitle(idx)); songs.append(TrackTitle); } tracksModel->setStringList(songs); ui->tracks->setModel(tracksModel); ui->expansionSound->setCurrentIndex(pChannelMap->GetChipIndex(pDoc->GetExpansionChip())); if ( pChannelMap->GetChipIdent(pDoc->GetExpansionChip()) == SNDCHIP_N163) { ui->channelsN163->setEnabled(true); } else { ui->channelsN163->setEnabled(false); } ui->vibratoStyle->setCurrentIndex(m_pDocument->GetVibratoStyle()); updateButtons(); }
BOOL CModulePropertiesDlg::OnInitDialog() { CDialog::OnInitDialog(); // Get active document CFrameWnd *pFrameWnd = static_cast<CFrameWnd*>(GetParent()); m_pDocument = static_cast<CFamiTrackerDoc*>(pFrameWnd->GetActiveDocument()); CListCtrl *pSongList = static_cast<CListCtrl*>(GetDlgItem(IDC_SONGLIST)); pSongList->InsertColumn(0, _T("Songs"), 0, 150); pSongList->SendMessage(LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT); FillSongList(); // Expansion chips CComboBox *pChipBox = static_cast<CComboBox*>(GetDlgItem(IDC_EXPANSION)); int ExpChip = m_pDocument->GetExpansionChip(); CChannelMap *pChannelMap = theApp.GetChannelMap(); for (int i = 0; i < pChannelMap->GetChipCount(); ++i) pChipBox->AddString(pChannelMap->GetChipName(i)); pChipBox->SetCurSel(pChannelMap->GetChipIndex(ExpChip)); // Vibrato CComboBox *pVibratoBox = static_cast<CComboBox*>(GetDlgItem(IDC_VIBRATO)); pVibratoBox->SetCurSel((m_pDocument->GetVibratoStyle() == VIBRATO_NEW) ? 0 : 1); // Namco channel count CSliderCtrl *pChanSlider = static_cast<CSliderCtrl*>(GetDlgItem(IDC_CHANNELS)); pChanSlider->SetRange(1, 8); CString channelsStr; channelsStr.LoadString(IDS_PROPERTIES_CHANNELS); if (ExpChip == SNDCHIP_N163) { int Channels = m_pDocument->GetNamcoChannels(); pChanSlider->SetPos(Channels); pChanSlider->EnableWindow(TRUE); channelsStr.AppendFormat(_T(" %i"), Channels); } else { pChanSlider->SetPos(0); pChanSlider->EnableWindow(FALSE); channelsStr.Append(_T(" N/A")); } SetDlgItemText(IDC_CHANNELS_NR, channelsStr); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }