void CConfigAppearance::SelectColorScheme(const COLOR_SCHEME *pColorScheme)
{
	CComboBox *pFontList = static_cast<CComboBox*>(GetDlgItem(IDC_FONT));
	CComboBox *pFontSizeList = static_cast<CComboBox*>(GetDlgItem(IDC_FONT_SIZE));

	SetColor(COL_BACKGROUND, pColorScheme->BACKGROUND);
	SetColor(COL_BACKGROUND_HILITE, pColorScheme->BACKGROUND_HILITE);
	SetColor(COL_BACKGROUND_HILITE2, pColorScheme->BACKGROUND_HILITE2);
	SetColor(COL_PATTERN_TEXT, pColorScheme->TEXT_NORMAL);
	SetColor(COL_PATTERN_TEXT_HILITE, pColorScheme->TEXT_HILITE);
	SetColor(COL_PATTERN_TEXT_HILITE2, pColorScheme->TEXT_HILITE2);
	SetColor(COL_PATTERN_INSTRUMENT, pColorScheme->TEXT_INSTRUMENT);
	SetColor(COL_PATTERN_VOLUME, pColorScheme->TEXT_VOLUME);
	SetColor(COL_PATTERN_EFF_NUM, pColorScheme->TEXT_EFFECT);
	SetColor(COL_SELECTION, pColorScheme->SELECTION);
	SetColor(COL_CURSOR, pColorScheme->CURSOR);
	SetColor(COL_CURRENT_ROW_NORMAL, pColorScheme->ROW_NORMAL);		// // //
	SetColor(COL_CURRENT_ROW_EDIT, pColorScheme->ROW_EDIT);
	SetColor(COL_CURRENT_ROW_PLAYING, pColorScheme->ROW_PLAYING);

	m_strFont = pColorScheme->FONT_FACE;
	m_iFontSize = pColorScheme->FONT_SIZE;
	pFontList->SelectString(0, m_strFont.data());
	pFontSizeList->SelectString(0, FormattedW(L"%i", m_iFontSize));
}
BOOL CConfigSound::OnInitDialog()
{
	CPropertyPage::OnInitDialog();

	CComboBox *pSampleRate	= static_cast<CComboBox*>(GetDlgItem(IDC_SAMPLE_RATE));
	CComboBox *pSampleSize	= static_cast<CComboBox*>(GetDlgItem(IDC_SAMPLE_SIZE));
	CComboBox *pDevices		= static_cast<CComboBox*>(GetDlgItem(IDC_DEVICES));
	
	CSliderCtrl *pBufSlider			  = static_cast<CSliderCtrl*>(GetDlgItem(IDC_BUF_LENGTH));
	CSliderCtrl *pBassSlider		  = static_cast<CSliderCtrl*>(GetDlgItem(IDC_BASS_FREQ));
	CSliderCtrl *pTrebleSliderFreq	  = static_cast<CSliderCtrl*>(GetDlgItem(IDC_TREBLE_FREQ));
	CSliderCtrl *pTrebleSliderDamping = static_cast<CSliderCtrl*>(GetDlgItem(IDC_TREBLE_DAMP));
	CSliderCtrl *pVolumeSlider		  = static_cast<CSliderCtrl*>(GetDlgItem(IDC_VOLUME));

	// Set ranges
	pBufSlider->SetRange(1, MAX_BUFFER_LEN);
	pBassSlider->SetRange(16, 4000);
	pTrebleSliderFreq->SetRange(20, 20000);
	pTrebleSliderDamping->SetRange(0, 90);
	pVolumeSlider->SetRange(0, 100);

	CSettings *pSettings = theApp.GetSettings();

	// Read settings
	switch (pSettings->Sound.iSampleRate) {
		case 11025: pSampleRate->SelectString(0, _T("11 025 Hz")); break;
		case 22050: pSampleRate->SelectString(0, _T("22 050 Hz")); break;
		case 44100: pSampleRate->SelectString(0, _T("44 100 Hz")); break;
		case 48000: pSampleRate->SelectString(0, _T("48 000 Hz")); break;
		case 96000: pSampleRate->SelectString(0, _T("96 000 Hz")); break;
	}

	switch (pSettings->Sound.iSampleSize) {
		case 16: pSampleSize->SelectString(0, _T("16 bit")); break;
		case 8:	 pSampleSize->SelectString(0, _T("8 bit")); break;
	}

	pBufSlider->SetPos(pSettings->Sound.iBufferLength);
	pBassSlider->SetPos(pSettings->Sound.iBassFilter);
	pTrebleSliderFreq->SetPos(pSettings->Sound.iTrebleFilter);
	pTrebleSliderDamping->SetPos(pSettings->Sound.iTrebleDamping);
	pVolumeSlider->SetPos(pSettings->Sound.iMixVolume);

	UpdateTexts();

	CDSound *pDSound = theApp.GetSoundGenerator()->GetSoundInterface();
	const int iCount = pDSound->GetDeviceCount();

	for (int i = 0; i < iCount; ++i)
		pDevices->AddString(pDSound->GetDeviceName(i));

	pDevices->SetCurSel(pSettings->Sound.iDevice);

	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}
Exemple #3
0
BOOL CExpandLimitsDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	CComboBox *List = (CComboBox*)GetDlgItem(IDC_EXCLUDELIST);

	size_t ListSize = 0;
	const char* FirstString;

	// Add the strings to the list box.
	std::list<CScrollLimits>::const_iterator curNode;
	for (curNode = m_World->GetScrollLimits().begin(); curNode != m_World->GetScrollLimits().end(); ++curNode)
	{
		List->AddString(curNode->ScriptName);
		if(ListSize == 0)
			FirstString = curNode->ScriptName;

		++ListSize;
	}

	// Set the default selection.
	if(ListSize)
	{
		List->SelectString(-1, FirstString);
		m_ExcludeSelected = 0;
	}


	List = (CComboBox*)GetDlgItem(IDC_INCLUDELIST);

	ListSize = 0;

	// Add the strings to the list box.
	for (curNode = m_World->GetScrollLimits().begin(); curNode != m_World->GetScrollLimits().end(); ++curNode)
	{
		List->AddString(curNode->ScriptName);
		if(ListSize == 0)
			FirstString = curNode->ScriptName;

		++ListSize;
	}

	// Set the default selection.
	if(ListSize)
	{
		List->SelectString(-1, FirstString);
		m_IncludeSelected = 0;
	}
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
void CInstrumentEditorN163Wave::SelectInstrument(std::shared_ptr<CInstrument> pInst)
{
	m_pInstrument = std::dynamic_pointer_cast<CInstrumentN163>(pInst);
	ASSERT(m_pInstrument);

	CComboBox *pSizeBox = static_cast<CComboBox*>(GetDlgItem(IDC_WAVE_SIZE));
	CComboBox *pPosBox = static_cast<CComboBox*>(GetDlgItem(IDC_WAVE_POS));

	pSizeBox->SelectString(0, MakeIntString(m_pInstrument->GetWaveSize()));
	FillPosBox(m_pInstrument->GetWaveSize());
	pPosBox->SetWindowText(MakeIntString(m_pInstrument->GetWavePos()));

	/*
	if (m_pInstrument->GetAutoWavePos()) {
		CheckDlgButton(IDC_POSITION, 1);
		GetDlgItem(IDC_WAVE_POS)->EnableWindow(FALSE);
	}
	else {
		CheckDlgButton(IDC_POSITION, 0);
		GetDlgItem(IDC_WAVE_POS)->EnableWindow(TRUE);
	}
	*/

	if (m_pWaveEditor) {
		m_pWaveEditor->SetInstrument(m_pInstrument);
		m_pWaveEditor->SetLength(m_pInstrument->GetWaveSize());
	}

	m_iWaveIndex = 0;

	PopulateWaveBox();
}
Exemple #5
0
BOOL CFileDialogEx::OnInitDialog() 
{
	CFileDialog::OnInitDialog();
	
	// The edit box
	HWND editBox = ::GetDlgItem (*(this->GetParent ()), edt1);

	// The combo box
	CComboBox combo;
	combo.Attach (::GetDlgItem (*this, IDC_DIRLIST));

	// Insert the strings
	char text[512];
	text[0] = 0;
	HKEY hKey;
	DWORD type = REG_SZ;
	DWORD size;
	if (RegCreateKey (HKEY_CURRENT_USER, _RegistryPath.c_str (), &hKey) == ERROR_SUCCESS)
	{
		uint i;
		for (i=0; i<PATH_REMEBERED_SIZE; i++)
		{
			size = 512;
			if (RegQueryValueEx (hKey, toString (i).c_str (), 0, &type, (LPBYTE)text, &size) == ERROR_SUCCESS)
				combo.InsertString (-1, text);
		}
		if (m_ofn.lpstrInitialDir)
			combo.SelectString (-1, m_ofn.lpstrInitialDir);
	}

	combo.Detach ();

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
LRESULT CPrefsLanguageDlg::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
    CComboBox langList = GetDlgItem(IDC_LANGUAGE_LIST);

    for (int i = 0; i < g_numLanguages; i++)
    {
        int index = langList.AddString(languageCodes[i].name);
        langList.SetItemData(index, i);
    }

    // Set currently selected language
    {
        for (int i = 0; i < g_numLanguages; i++)
        {
            ASSERT(0);
#if 0
            if (wcscmp(languageCodes[i].code, m_pPrefs->m_systemLanguage.c_str()) == 0)
                break;
#endif
        }

        if (i < g_numLanguages)
        {
            langList.SelectString(-1, languageCodes[i].name);
        }
    }

    CheckRadioButton(IDC_SYSTEM_SUBTITLES, IDC_SYSTEM_SUBTITLES+1, IDC_SYSTEM_SUBTITLES+m_pPrefs->m_systemOverdubOrSubtitle);

    CheckDlgButton(IDC_SYSTEM_CAPTIONS, m_pPrefs->m_systemCaptions);
    CheckDlgButton(IDC_SYSTEM_AUDIODESC, m_pPrefs->m_systemAudioDesc);

    return 1;  // Let the system set the focus
}
Exemple #7
0
//
// Helper utility to initialize a combo box from an array of text
//
static void initComboBox(CComboBox &b, const TCHAR *list[], int count, const TCHAR *initial)
{
    b.Clear();
    for (int i = 0; i < count; i += 2)
        //The odd index are the display text, the even index are the keys
        b.SetItemDataPtr(b.AddString(list[i + 1]), (void *)(list[i]));
    b.SelectString(0, initial);
}
BOOL CConfigAppearance::OnInitDialog()
{
	CPropertyPage::OnInitDialog();

	const CSettings *pSettings = theApp.GetSettings();
	m_strFont = pSettings->Appearance.strFont;		// // //

	CDC *pDC = GetDC();
	if (pDC != NULL) {
		LOGFONTW LogFont = { };		// // //
		LogFont.lfCharSet = ANSI_CHARSET;
		EnumFontFamiliesExW(pDC->m_hDC, &LogFont, (FONTENUMPROC)EnumFontFamExProc, (LPARAM)this, 0);
		ReleaseDC(pDC);
	}

	CComboBox *pFontSizeList = static_cast<CComboBox*>(GetDlgItem(IDC_FONT_SIZE));
	CComboBox *pItemsBox = static_cast<CComboBox*>(GetDlgItem(IDC_COL_ITEM));

	for (int i = 0; i < COLOR_ITEM_COUNT; ++i) {
		pItemsBox->AddString(conv::to_wide(COLOR_ITEMS[i]).data());
	}

	pItemsBox->SelectString(0, conv::to_wide(COLOR_ITEMS[0]).data());

	m_iSelectedItem = 0;

	m_iColors[COL_BACKGROUND]			= pSettings->Appearance.iColBackground;
	m_iColors[COL_BACKGROUND_HILITE]	= pSettings->Appearance.iColBackgroundHilite;
	m_iColors[COL_BACKGROUND_HILITE2]	= pSettings->Appearance.iColBackgroundHilite2;
	m_iColors[COL_PATTERN_TEXT]			= pSettings->Appearance.iColPatternText;
	m_iColors[COL_PATTERN_TEXT_HILITE]	= pSettings->Appearance.iColPatternTextHilite;
	m_iColors[COL_PATTERN_TEXT_HILITE2]	= pSettings->Appearance.iColPatternTextHilite2;
	m_iColors[COL_PATTERN_INSTRUMENT]	= pSettings->Appearance.iColPatternInstrument;
	m_iColors[COL_PATTERN_VOLUME]		= pSettings->Appearance.iColPatternVolume;
	m_iColors[COL_PATTERN_EFF_NUM]		= pSettings->Appearance.iColPatternEffect;
	m_iColors[COL_SELECTION]			= pSettings->Appearance.iColSelection;
	m_iColors[COL_CURSOR]				= pSettings->Appearance.iColCursor;
	m_iColors[COL_CURRENT_ROW_NORMAL]	= pSettings->Appearance.iColCurrentRowNormal;		// // //
	m_iColors[COL_CURRENT_ROW_EDIT]		= pSettings->Appearance.iColCurrentRowEdit;
	m_iColors[COL_CURRENT_ROW_PLAYING]	= pSettings->Appearance.iColCurrentRowPlaying;

	m_iFontSize	= pSettings->Appearance.iFontSize;		// // //

	m_bPatternColors = pSettings->Appearance.bPatternColor;		// // //
	m_bDisplayFlats = pSettings->Appearance.bDisplayFlats;		// // //

	pItemsBox = static_cast<CComboBox*>(GetDlgItem(IDC_SCHEME));

	for (auto *scheme : COLOR_SCHEMES)
		pItemsBox->AddString(scheme->NAME);

	for (int pt : FONT_SIZES)		// // //
		pFontSizeList->AddString(conv::to_wide(conv::from_int(pt)).data());
	pFontSizeList->SetWindowTextW(conv::to_wide(conv::from_int(m_iFontSize)).data());

	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}
BOOL CSplitKeyboardDlg::OnInitDialog()
{
	CComboBox *pCombo;
	const auto pDoc = CFamiTrackerDoc::GetDoc();

	pCombo = static_cast<CComboBox*>(GetDlgItem(IDC_COMBO_SPLIT_NOTE));
	for (auto n : KEY_NAME)
		pCombo->AddString(conv::to_wide(n).data());
	pCombo->SetCurSel(m_iSplitNote != -1 ? (value_cast(ft0cc::doc::pitch_from_midi(m_iSplitNote)) - 1) : 0);

	pCombo = static_cast<CComboBox*>(GetDlgItem(IDC_COMBO_SPLIT_OCTAVE));
	for (int i = 0; i < OCTAVE_RANGE; ++i)
		pCombo->AddString(conv::to_wide(conv::from_int(i)).data());
	pCombo->SetCurSel(m_iSplitNote != -1 ? ft0cc::doc::oct_from_midi(m_iSplitNote) : 3);

	pCombo = static_cast<CComboBox*>(GetDlgItem(IDC_COMBO_SPLIT_CHAN));
	pCombo->AddString(KEEP_INST_STRING);
	pCombo->SetCurSel(0);
	auto *pSCS = FTEnv.GetSoundChipService();
	int i = 0;
	pDoc->GetModule()->GetChannelOrder().ForeachChannel([&] (stChannelID ch) {
		pCombo->AddString(conv::to_wide(pSCS->GetChannelFullName(ch)).data());
		if (m_iSplitChannel == ch)
			pCombo->SetCurSel(i + 1);
		++i;
	});

	pCombo = static_cast<CComboBox*>(GetDlgItem(IDC_COMBO_SPLIT_INST));
	pCombo->AddString(KEEP_INST_STRING);
	pDoc->GetModule()->GetInstrumentManager()->VisitInstruments([&] (const CInstrument &, std::size_t i) {
		pCombo->AddString(conv::to_wide(conv::from_int_hex(i, 2)).data());
	});
	if (pCombo->SelectString(-1, FormattedW(L"%02X", m_iSplitInstrument)) == CB_ERR)
		pCombo->SelectString(-1, KEEP_INST_STRING);

	pCombo = static_cast<CComboBox*>(GetDlgItem(IDC_COMBO_SPLIT_TRSP));
	for (int j = -MAX_TRANSPOSE; j <= MAX_TRANSPOSE; ++j)
		pCombo->AddString(FormattedW(L"%+d", j));
	pCombo->SelectString(-1, FormattedW(L"%+d", m_iSplitTranspose));

	CheckDlgButton(IDC_CHECK_SPLIT_ENABLE, m_bSplitEnable ? BST_CHECKED : BST_UNCHECKED);
	OnBnClickedCheckSplitEnable();

	return CDialog::OnInitDialog();
}
void CLogClassFilterEditDlg::SetLogClass(int comboID, UINT c)
{
	CComboBox combo = (HWND)GetDlgItem(comboID);
	CStringW desc = helper::GetLogLevelDescription(c);
	if (combo.SelectString(0, desc) == CB_ERR)
	{
		combo.SetWindowText(desc);
	}
}
void CEndDialog::OnOK()
{
	// TODO: Add your specialized code here and/or call the base class
	CComboBox * chComboBox = (CComboBox *)GetDlgItem(IDC_CMB_END_POINT);
	CComboBox * parComboBox = (CComboBox *)GetParent()->GetDlgItem(IDC_CMB_END_POINT);
	int nIndx = chComboBox->GetCurSel();
	CString tmp;
	chComboBox->GetLBText(nIndx, tmp);
	parComboBox->SelectString(nIndx, tmp);
	CDialog::OnOK();
}
void CConfigAppearance::AddFontName(std::wstring_view Name)		// // //
{
	if (Name.size() >= LF_FACESIZE)		// // //
		return;

	CComboBox *pFontList = static_cast<CComboBox*>(GetDlgItem(IDC_FONT));

	pFontList->AddString(Name.data());

	if (m_strFont == Name)
		pFontList->SelectString(0, Name.data());
}
void CFcFontBar::SetSelectedFontName(const CString& SelectString, BOOL bEnable) 
{
	CComboBox* pCb = (CComboBox*)GetDlgItem(ID_FORMAT_FONTNAME);
	ASSERT_VALID(pCb);

	if (SelectString.GetLength() > 0)
		pCb->SelectString(-1, SelectString);
	else
		pCb->SetCurSel(-1);

	pCb->EnableWindow(bEnable);
}
Exemple #14
0
// **************************************************************************
// DoDataExchange ()
//
// Description:
//	This method is called by the framework to exchange and validate dialog data.
//
// Parameters:
//  CDataExchange	*pDX	A pointer to a CDataExchange object.
//
// Returns:
//  void
// **************************************************************************
void CKItemPropertiesDlg::DoDataExchange (CDataExchange *pDX)
	{
	// Perform default processing:
	CDialog::DoDataExchange (pDX);

	// Exchange data between controls and associated member variables:
	//{{AFX_DATA_MAP(CKItemPropertiesDlg)
	DDX_Text (pDX, IDC_ACCESSPATH, m_strAccessPath);
	DDX_Check (pDX, IDC_ACTIVE, m_bActive);
	DDX_Text (pDX, IDC_ITEMID, m_strItemID);
	//}}AFX_DATA_MAP

	// Get pointer to data type combo box:
	CComboBox *pCombo = (CComboBox *)GetDlgItem (IDC_DATATYPE);
	CString strType;

	// If not save and validate, use member vaiable value to make
	// data type combo box selection:
	if (!pDX->m_bSaveAndValidate)
		{
		CString strType;

		switch (m_vtDataType & ~VT_ARRAY)
			{
			case VT_BOOL:	strType = _T("Boolean");	break;
			case VT_UI1:	strType = _T("Byte");		break;
			case VT_I1:		strType = _T("Char");		break;
			case VT_UI2:	strType = _T("Word");		break;
			case VT_I2:		strType = _T("Short");		break;
			case VT_UI4:	strType = _T("DWord");		break;
			case VT_I4:		strType = _T("Long");		break;
			case VT_R4:		strType = _T("Float");		break;
			case VT_R8:		strType = _T("Double");		break;
			case VT_BSTR:	strType = _T("String");		break;
			default:		strType = _T("Native");		break;
			}

		// Update array flag data:
		if ((m_vtDataType & VT_ARRAY) != 0)
			strType += _T(" Array");
		
		// Select data type:
		pCombo->SelectString (-1, strType);
		}

	// else transfer data type combo box index to vartype member variable:
	else
		{
		pCombo->GetLBText (pCombo->GetCurSel (), strType);
		m_vtDataType = VartypeFromString (strType);
		}
	}	
void CInstrumentEditorN163Wave::SelectInstrument(int Instrument)
{
	m_pInstrument = (CInstrumentN163*)GetDocument()->GetInstrument(Instrument);

	CComboBox *pSizeBox = (CComboBox*)GetDlgItem(IDC_WAVE_SIZE);
	CComboBox *pPosBox = (CComboBox*)GetDlgItem(IDC_WAVE_POS);

	CString SizeStr;
	SizeStr.Format(_T("%i"), m_pInstrument->GetWaveSize());
	pSizeBox->SelectString(0, SizeStr);

	FillPosBox(m_pInstrument->GetWaveSize());

	CString PosStr;
	PosStr.Format(_T("%i"), m_pInstrument->GetWavePos());
	pPosBox->SetWindowText(PosStr);

	/*
	if (m_pInstrument->GetAutoWavePos()) {
		CheckDlgButton(IDC_POSITION, 1);
		GetDlgItem(IDC_WAVE_POS)->EnableWindow(FALSE);
	}
	else {
		CheckDlgButton(IDC_POSITION, 0);
		GetDlgItem(IDC_WAVE_POS)->EnableWindow(TRUE);
	}
	*/

	if (m_pWaveEditor) {
		m_pWaveEditor->SetInstrument(m_pInstrument);
		m_pWaveEditor->SetLength(m_pInstrument->GetWaveSize());
	}

	CSpinButtonCtrl *pIndexSpin = (CSpinButtonCtrl*)GetDlgItem(IDC_INDEX_SPIN);
	CSpinButtonCtrl *pWavesSpin = (CSpinButtonCtrl*)GetDlgItem(IDC_WAVES_SPIN);

	int WaveCount = m_pInstrument->GetWaveCount();

	pIndexSpin->SetRange(0, WaveCount - 1);
	pIndexSpin->SetPos(0);
	pWavesSpin->SetPos(WaveCount - 1);

	m_iWaveIndex = 0;
}
void CSTWSelectTmplPage::OnSelchangeComboTemplate() 
{
	CString s;
	CComboBox* pCmb = (CComboBox*) GetDlgItem (IDC_COMBO_TEMPLATE);
	pCmb->GetLBText (pCmb->GetCurSel (), s);

	// Check whether template has been modified
	// and if so, ask user whether to safe template
	CStyleTemplateWizard* pWiz = (CStyleTemplateWizard*) GetParent ();
	CStyleTemplates& tmpl = ((CCdCoverCreator2App*) AfxGetApp ())->GetTemplates ();

	if (pWiz->m_pTemplate != NULL)
	{
		CStyleTemplate t;

		if (tmpl.LoadTemplate (pWiz->m_pTemplate->GetName (), &t))
			if (*pWiz->m_pTemplate != t)
				if (AfxMessageBox (IDS_SAVETEMPLATE, MB_ICONQUESTION | MB_YESNO) == IDYES)
				{
					tmpl.StoreTemplate (*pWiz->m_pTemplate);

					if (t.GetName ().IsEmpty ())
					{
						// name is empty: a new template has been created
						// insert name into combo box
						pCmb->AddString (pWiz->m_pTemplate->GetName ());
						pCmb->SelectString (-1, s);
					}
				}
	}

	// switch to newly selected template
	if (!s.IsEmpty ())
	{
		if (pWiz->m_pTemplate == NULL)
			pWiz->m_pTemplate = new CStyleTemplate ();

		tmpl.LoadTemplate (s, pWiz->m_pTemplate);

		if (::IsWindow (pWiz->m_wndPreview.GetSafeHwnd ()))
			pWiz->m_wndPreview.InvalidateRect (NULL);
	}
}
Exemple #17
0
BOOL CBerkeleyView::OnInitDialog()
{
	CDialogEx::OnInitDialog();

	// TODO:  Add extra initialization here
	CComboBox* pBox = (CComboBox*)GetDlgItem(IDC_DATA_TYPE);
	pBox->AddString(_T("String"));
	pBox->SetItemData(0, DataDecoder::eDTString);
	pBox->AddString(_T("Bitmap"));
	pBox->SetItemData(0, DataDecoder::eDTBitmap);
	pBox->AddString(_T("LZ"));
	pBox->SetItemData(0, DataDecoder::eDTLZ);
	pBox->AddString(_T("RLE"));
	pBox->SetItemData(0, DataDecoder::eDTRLE);

	pBox->SelectString(0, _T("String"));
	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}
Exemple #18
0
CComboBox* CMySuperGrid::ShowList(int nItem, int nCol, CStringList *lstItems)
{
	CString strFind = GetItemText(nItem, nCol);

	//basic code start
	CRect rect;
	int offset = 0;
	// Make sure that the item is visible
	if( !EnsureVisible(nItem, TRUE)) return NULL;
	GetSubItemRect(nItem, nCol, LVIR_BOUNDS, rect);
	// Now scroll if we need to expose the column
	CRect rcClient;
	GetClientRect(rcClient);
	if( offset + rect.left < 0 || offset + rect.left > rcClient.right )
	{
		CSize size;
		size.cx = offset + rect.left;
		size.cy = 0;
		Scroll(size);
		rect.left -= size.cx;
	}
	
	rect.left += offset;	
	rect.right = rect.left + GetColumnWidth(nCol);
	if(rect.right > rcClient.right) 
	   rect.right = rcClient.right;
	//basic code end

	rect.bottom += 10 * rect.Height();//dropdown area
	
	DWORD dwStyle =  WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL|CBS_DROPDOWNLIST | CBS_DISABLENOSCROLL;
	CComboBox *pList = new CComboInListView(nItem, nCol, lstItems);
	pList->Create(dwStyle, rect, this, IDC_COMBOBOXINLISTVIEW);
	pList->ModifyStyleEx(0,WS_EX_CLIENTEDGE);//can we tell at all
	pList->SetHorizontalExtent(CalcHorzExtent(pList, lstItems));
	pList->ShowDropDown();
	pList->SelectString(-1, strFind.GetBuffer(1));
	// The returned pointer should not be saved
	return pList;
}
int CXTPSyntaxEditPropertiesPageFont::GetLBText(CComboBox& comboBox, CString& csItemText)
{
	UpdateData();

	if (!::IsWindow(comboBox.m_hWnd))
		return CB_ERR;

	int iCurSel = comboBox.GetCurSel();
	if (iCurSel == CB_ERR)
		return CB_ERR;

	comboBox.GetLBText(iCurSel, csItemText);

	if (!csItemText.IsEmpty())
	{
		if (comboBox.SelectString(-1, csItemText) == CB_ERR)
			comboBox.SetWindowText(csItemText);

		return iCurSel;
	}

	return CB_ERR;
}
Exemple #20
0
// populate an identity control with the list of identities, select the identity
// passed if set, otherwise select the default identity (if set)
void PopulateIdentityComboCtrl(CComboBox &IdentityCtrl, UserIdentity *pSelectIdentity /* = NULL */)
{
  int itemnum;
  
  char *selectname = NULL;

  UserIdentity *pIdentity;

  UserIdentity *pDefaultIdentity = g_pPrefs->FindIdentityByDescripton(STRINGPREF(PREF_sDefaultIdentity));
  if (pDefaultIdentity)
  {
    itemnum = IdentityCtrl.AddString(pDefaultIdentity->m_Description);
    IdentityCtrl.SetItemDataPtr(itemnum,pDefaultIdentity);
    selectname = pDefaultIdentity->m_Description; // select this one, unless we're supposed to select something else...
  }

  for (int i = 0 ; i < g_pPrefs->m_UserIdentitiesList.GetSize() ; i++ )
  {
    pIdentity = g_pPrefs->m_UserIdentitiesList[i];

    // check we've not already added this one.
    if (pIdentity != pDefaultIdentity)
    {
      itemnum = IdentityCtrl.AddString(pIdentity->m_Description);
      IdentityCtrl.SetItemDataPtr(itemnum,pIdentity);
      // select this one?
      if (pSelectIdentity && pSelectIdentity->m_Description && stricmp(pIdentity->m_Description,pSelectIdentity->m_Description) == 0)
        selectname = pIdentity->m_Description;
    }
  }

  if (selectname) // this should always be set, as we can't get to the connect dialog without an identity...
    IdentityCtrl.SelectString(0,selectname);
  else
    IdentityCtrl.SetCurSel(0);
}
void CChunkMergeDlg::OnDefaultReloaddirectories()
{
	logMessage(NCU_MSG_TYPE_INFO, "scanning directories...");

	//  re-scan templates
	CComboBox*	pCBox = (CComboBox*) GetDlgItem(IDC_COMBO_TEMPLATE);
	CString		pathTmpl(glConfig._pathTemplate.c_str());
	set<string> directories;

	//  reset selection box
	pCBox->ResetContent();

	//  parse directory
	parseDir(pathTmpl, directories, false);

	//  in case of existing data
	if (directories.size() > 0)
	{
		//  add files to selection box
		for (set<string>::iterator tIter = directories.begin(); tIter != directories.end(); tIter++)
		{
			if ((*tIter).rfind(".nif") == string::npos)		continue;
			pCBox->AddString(CString((*tIter).c_str()));
		}
		pCBox->SelectString(-1, CString(glConfig._lastTemplate.c_str()));

		//  make sure one entry is selected
		GetDlgItem(IDC_COMBO_TEMPLATE) ->GetWindowTextW(pathTmpl);
		if (pathTmpl.IsEmpty())
		{
			pCBox->SetCurSel(0);
		}

		//  reset last choosen template
		GetDlgItem(IDC_COMBO_TEMPLATE)->GetWindowTextW(pathTmpl);
		glConfig._lastTemplate = CStringA(pathTmpl).GetString();
	}

	//  re-load material
	glMaterialList.initializeMaterialMap(glConfig._pathNifXML);

	map<string, NifUtlMaterial>		mapMap(glMaterialList.getMaterialMap());
	short							t     (0);
	short							selIdx(0);

	pCBox = (CComboBox*) GetDlgItem(IDC_COMBO_COLLMAT);

	for (map<string, NifUtlMaterial>::iterator pIter = mapMap.begin(); pIter != mapMap.end(); pIter++, t++)
	{
		pCBox->InsertString  (t, CString(pIter->second._name.c_str()));
		pCBox->SetItemDataPtr(t, (void*) (pIter->second._code));

		if (pIter->second._code == ((unsigned int) glConfig._collMaterial))
		{
			selIdx = t;
		}
	}
	pCBox->SetCurSel(selIdx);

	//  add messages from material list
	vector<string>  userMessages(glMaterialList.getUserMessages());

	for (vector<string>::iterator texIter = userMessages.begin(); texIter != userMessages.end(); texIter++)
	{
		logMessage(NCU_MSG_TYPE_INFO, texIter->c_str());
	}

	logMessage(NCU_MSG_TYPE_INFO, "scan done.");
}
//-----  BroadcastEvent()  ----------------------------------------------------
BOOL CFormChunkMergeView::BroadcastEvent(WORD event, void* pParameter)
{
	switch (event)
	{
		case IBCE_CHANGED_SETTINGS:
		{
			//  set settings from configuration
			Configuration*	pConfig (Configuration::getInstance());
			CComboBox*		pCBox   ((CComboBox*) GetDlgItem(IDC_CB_TEMPLATE));
			set<string>		tDirList(pConfig->getDirListTemplates());
			CString			tmpPath (pConfig->_cmDefaultTemplate.c_str());

			//- templates
			LogMessageObject::LogMessage(NCU_MSG_TYPE_INFO, "Adding templates");
			pCBox->ResetContent();
			for (auto pIter(tDirList.begin()), pEnd(tDirList.end()); pIter != pEnd; ++pIter)
			{
				if (pIter->rfind(".nif") == string::npos)		continue;
				pCBox->AddString(CString(pIter->c_str()));
				LogMessageObject::LogMessage(NCU_MSG_TYPE_SUB_INFO, "added: %s", pIter->c_str());
			}
			pCBox->SelectString(-1, CString(tmpPath));
			pCBox->GetWindowText(tmpPath);
			if (tmpPath.IsEmpty())		pCBox->SetCurSel(0);
			LogMessageObject::LogMessage(NCU_MSG_TYPE_INFO, "templates found: %d", tDirList.size());

			//- materials
			pCBox = (CComboBox*) GetDlgItem(IDC_CB_MAT_SINGLE);
			map<string, NifUtlMaterial>		matMap(NifUtlMaterialList::getInstance()->getMaterialMap());
			short							tIdx  (0);
			short							selIdx(0);

			//  add materials to combo box
			for (auto pIter(matMap.begin()), pEnd(matMap.end()); pIter != pEnd; ++pIter, ++tIdx)
			{
				pCBox->InsertString  (tIdx, CString(pIter->second._name.c_str()));
				pCBox->SetItemDataPtr(tIdx, (void*) (pIter->second._code));

				if (pIter->second._code == pConfig->_cmMatSingleType)
				{
					selIdx = tIdx;
				}
			}
			pCBox->SetCurSel(selIdx);

			//  material flags
			int		selItem(pConfig->_cmMatHandling + IDC_RD_MAT_SINGLE);

			((CButton*) GetDlgItem(IDC_RD_MAT_SINGLE))    ->SetCheck(selItem == IDC_RD_MAT_SINGLE);
			((CButton*) GetDlgItem(IDC_RD_MAT_NITRISHAPE))->SetCheck(selItem == IDC_RD_MAT_NITRISHAPE);
			((CButton*) GetDlgItem(IDC_RD_MAT_DEFINE))    ->SetCheck(selItem == IDC_RD_MAT_DEFINE);
			GetDlgItem(IDC_CB_MAT_SINGLE)->EnableWindow(selItem == IDC_RD_MAT_SINGLE);
			GetDlgItem(IDC_BT_MAT_DEFINE)->EnableWindow(selItem == IDC_RD_MAT_DEFINE);

			//  collision flags
			selItem = pConfig->_cmCollHandling + IDC_RD_COLL_CDATA;
			((CButton*) GetDlgItem(IDC_RD_COLL_CDATA))->SetCheck(selItem == IDC_RD_COLL_CDATA);
			((CButton*) GetDlgItem(IDC_RD_COLL_FBACK))->SetCheck(selItem == IDC_RD_COLL_FBACK);
			((CButton*) GetDlgItem(IDC_RD_COLL_MESH)) ->SetCheck(selItem == IDC_RD_COLL_MESH);

			//  other flags
			((CButton*) GetDlgItem(IDC_RD_COLL_LOCAL))  ->SetCheck(pConfig->_cmMergeColl   ? BST_UNCHECKED : BST_CHECKED);
			((CButton*) GetDlgItem(IDC_RD_COLL_GLOBAL)) ->SetCheck(pConfig->_cmMergeColl   ? BST_CHECKED   : BST_UNCHECKED);
			((CButton*) GetDlgItem(IDC_CK_REORDER_TRIS))->SetCheck(pConfig->_cmReorderTris ? BST_CHECKED   : BST_UNCHECKED);

			break;
		}

		case IBCE_SET_TOOLTIPP:
		{
			_toolTipCtrl.Activate(Configuration::getInstance()->_showToolTipps);
			break;
		}
	}  //  switch (event)

	return TRUE;
}
Exemple #23
0
BOOL CID3v2Page1::OnInitDialog() 
{
	CPropertyPage::OnInitDialog();

	// Translations
	SetWindowText( theApp.Translate( "ID3v2Page1", "Caption" ));
	SetDlgItemText( IDC_ITEM1 , theApp.Translate( "ID3v2Page1", "Item1" ));
	SetDlgItemText( IDC_ITEM2 , theApp.Translate( "ID3v2Page1", "Item2" ));
	SetDlgItemText( IDC_ITEM3 , theApp.Translate( "ID3v2Page1", "Item3" ));
	SetDlgItemText( IDC_ITEM4 , theApp.Translate( "ID3v2Page1", "Item4" ));
	SetDlgItemText( IDC_ITEM5 , theApp.Translate( "ID3v2Page1", "Item5" ));
	SetDlgItemText( IDC_ITEM6 , theApp.Translate( "ID3v2Page1", "Item6" ));
	SetDlgItemText( IDC_ITEM7 , theApp.Translate( "ID3v2Page1", "Item7" ));
	SetDlgItemText( IDC_ITEM8 , theApp.Translate( "ID3v2Page1", "Item8" ));
	SetDlgItemText( IDC_ITEM9 , theApp.Translate( "ID3v2Page1", "Item9" ));
	SetDlgItemText( IDC_BT_NORMALIZE , theApp.Translate( "ID3v2Page1", "Item10" ));
	SetDlgItemText( IDC_CHECK_RENAME , theApp.Translate( "ID3v2Page1", "Item11" ));


	theApp.BeginWaitCursor();


	// Artists
	m_comboArtist.SubclassDlgItem( IDC_LIST_ARTIST , this );
	m_imagelistComboArtist.Create( 16, 16, IDB_SMALL_ICONS );
	m_imagelistComboArtist.SetOverlayImage( 1, 1 );
	m_comboArtist.SetImageList( &m_imagelistComboArtist );


	m_comboArtist.FillWithList( m_pListArtist->GetList( m_pMapArtist) , ICON_ARTIST , ICON_ARTIST );
	m_comboArtist.SelectItem( m_strArtist );

	// Album
	m_comboAlbum.SubclassDlgItem( IDC_LIST_ALBUM , this );
	m_imagelistComboAlbum.Create( 16, 16, IDB_SMALL_ICONS );
	m_imagelistComboAlbum.SetOverlayImage( 1, 1 );
	m_comboAlbum.SetImageList( &m_imagelistComboAlbum );
	OnDropdownListAlbum();
	m_comboAlbum.SelectItem( m_strAlbum );
	
	// Tracknums
	CComboBox* pCBox = (CComboBox*) GetDlgItem(IDC_LIST_TRACKNUM);
	for( int i = 0 ; i < NB_TRACKNUMS ; i++ )
	{
		pCBox->AddString( g_tracknums[i] );
	}

	// Ratings
	pCBox = (CComboBox*) GetDlgItem(IDC_LIST_RATING);
	for(  i = 0 ; i < NUM_RATING ; i++ )
	{
		int nIndex = pCBox->AddString( _gszRating[i] );
		pCBox->SetItemData ( nIndex , i );
	}

	if( ( m_nRating < NUM_RATING ) && ( m_nRating >= 0 ))
	{
		pCBox->SelectString( -1 , _gszRating[ m_nRating ] );
	}

	// Genres

	m_comboGenre.SubclassDlgItem( IDC_CMB_GENRE , this );
	m_imagelistComboGenre.Create( 16, 16, IDB_ID3V1 );
	m_imagelistComboGenre.SetOverlayImage( 1, 1 );

	m_comboGenre.SetImageList( &m_imagelistComboGenre );
	m_comboGenre.InitStorage( 200 , 2000 ); 

	if( theApp.m_bWriteId3v1Tags )
	{
		// ID3v1 genres
		m_comboGenre.FillWithList( m_pListGenre->GetList( _gszGenre , NUM_GENRE ), ICON_ID3V1 , ICON_ID3V1 );
	}
	// Add custom genres
	POSITION pos = m_pMapGenre->GetStartPosition();
	while( pos != NULL )
	{
		CGenre* pGenre;
		CString strGenre;
		m_pMapGenre->GetNextAssoc( pos, strGenre, (CObject*&)pGenre );
		ASSERT( pGenre->IsKindOf( RUNTIME_CLASS( CGenre ) ) );
		if( !( theApp.m_bWriteId3v1Tags  && CMp3File::IsV1Genre( strGenre ))) 
		{
			m_comboGenre.AddSortedItem( strGenre , 0 , 0 );
		}
	}
	m_comboGenre.SelectItem( m_strGenre );


	// Automatic renaming
	CButton* pCheck = (CButton*) GetDlgItem(IDC_CHECK_RENAME);
	if( m_bRenameAvailable )
	{
		pCheck->EnableWindow( TRUE );
		CheckDlgButton( IDC_CHECK_RENAME , theApp.m_bAutoRename );
	}

	theApp.EndWaitCursor();

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Exemple #24
0
void CDbeventView::OnInitialUpdate() 
{
    CView::OnInitialUpdate();
    CDbeventDoc* pDoc        = (CDbeventDoc*)GetDocument();
    CSplitterWnd*  pSplitter = (CSplitterWnd*)GetParent ();
    CDbeventFrame* pFrame    = (CDbeventFrame*)pSplitter->GetParent();
    
    ASSERT (pDoc);

    // toolbar caption according to doc caption
    CString docTitle = pDoc->GetTitle();
    pFrame->GetDialogBar()->SetWindowText(docTitle);

    if (pDoc->IsLoadedDoc()) {
      // frame window placement
      BOOL bResult = pFrame->SetWindowPlacement(pDoc->GetWPLJ());
      ASSERT (bResult);

      // splitbar placement
      int cxCur = pDoc->GetSplitterCxCur();
      int cxMin = pDoc->GetSplitterCxMin();
      pSplitter->SetColumnInfo(0, cxCur, cxMin);
      pSplitter->RecalcLayout();

      // set full state of all toolbars in the frame
      CDockState& ToolbarsState = pDoc->GetToolbarState();
      pFrame->SetDockState(ToolbarsState);
    
      // Set frame toolbar visibility state according to load info
      if (pDoc->m_bToolbarVisible)
        SetToolbarVisible(pFrame, TRUE);      // force immediate update
      else
        SetToolbarInvisible(pFrame, TRUE);    // force immediate update
    }
    else
    {
        //
        // The left pane (Register DBEvent pane) is 30% of the Frame Client erea.
        CRect rcClient;
        pFrame->GetClientRect (rcClient);
        pSplitter->SetColumnInfo(0, (int) (0.3 * (double)rcClient.Width()), 10);
        pSplitter->RecalcLayout();
    }
    //
    // Initialize the MaxLine Edit Box
    CuDbeDlgBar* pDlgBar = pFrame->GetDialogBar ();
    CEdit* pEdit = pDlgBar->GetEditMaxLine();
    if (pEdit && IsWindow (pEdit->m_hWnd))
    {
        CString strFormat;
        strFormat.Format ("%d", pDoc->m_nMaxLine);
        pEdit->SetLimitText  (4);
        pEdit->SetWindowText (strFormat);
    }
    //
    // Initialize the Sys DBEvent Check Box.
    CButton* pButton = pDlgBar->GetSysDBEventButton ();
    pButton->SetCheck (pDoc->m_bSysDBEvent);
    //
    // Initialize the Popup On Raise Check Box.
    pButton = pDlgBar->GetPopupButton ();
    pButton->SetCheck (pDoc->m_bPopupOnRaise);
    //
    // Initialize the Clear First Check Box.
    pButton = pDlgBar->GetClearFirstButton ();
    pButton->SetCheck (pDoc->m_bClearFirst);

    //
    // Initialize the ComboBox of Databases.
    CString strNone;
    CComboBox* pCombo =  pDlgBar->GetComboDatabase ();
    if (strNone.LoadString (IDS_DATABASE_NONE) == 0)
        strNone = "<None>";
    pCombo->AddString (strNone);
    if (pDoc->m_strDBName == "" || pDoc->m_strDBName == strNone)
    {
        pCombo->SetCurSel (0);
        return;
    }
    pCombo->AddString (pDoc->m_strDBName);
    pCombo->SelectString (-1, pDoc->m_strDBName);
}
Exemple #25
0
void CNifConvertDlg::OnDefaultReloaddirectories()
{
	logMessage(NCU_MSG_TYPE_INFO, "scanning directories...");

	//  re-scan texture path
	CComboBox*	pCBox = (CComboBox*) GetDlgItem(IDC_COMBO_TEXTURE);
	CString		pathTmpl(glConfig._pathSkyrim.c_str());
	set<string> directories;

	//  reset selection box
	pCBox->ResetContent();

	//  add subdirectory
	pathTmpl += "\\Data\\Textures";

	//  parse directory
	parseDir(pathTmpl, directories);

	//  in case of existing data
	if (directories.size() > 0)
	{
		//  add files to selection box
		for (set<string>::iterator tIter = directories.begin(); tIter != directories.end(); tIter++)
		{
			pCBox->AddString(CString((*tIter).c_str()) + _T("\\"));
		}
		pCBox->SelectString(-1, CString(glConfig._lastTexture.c_str()));

		//  make sure one entry is selected
		GetDlgItem(IDC_COMBO_TEXTURE) ->GetWindowTextW(pathTmpl);
		if (pathTmpl.IsEmpty())
		{
			pCBox->SetCurSel(0);
		}

		//  reset last choosen template
		GetDlgItem(IDC_COMBO_TEXTURE)->GetWindowTextW(pathTmpl);
		glConfig._lastTexture = CStringA(pathTmpl).GetString();
	}

	//  re-scan templates
	pCBox    = (CComboBox*) GetDlgItem(IDC_COMBO_TEMPLATE);
	pathTmpl = glConfig._pathTemplate.c_str();
	directories.clear();

	//  reset selection box
	pCBox->ResetContent();

	//  parse directory
	parseDir(pathTmpl, directories, false);

	//  in case of existing data
	if (directories.size() > 0)
	{
		//  add files to selection box
		for (set<string>::iterator tIter = directories.begin(); tIter != directories.end(); tIter++)
		{
			if ((*tIter).rfind(".nif") == string::npos)		continue;
			pCBox->AddString(CString((*tIter).c_str()));
		}
		pCBox->SelectString(-1, CString(glConfig._lastTemplate.c_str()));

		//  make sure one entry is selected
		GetDlgItem(IDC_COMBO_TEMPLATE) ->GetWindowTextW(pathTmpl);
		if (pathTmpl.IsEmpty())
		{
			pCBox->SetCurSel(0);
		}

		//  reset last choosen template
		GetDlgItem(IDC_COMBO_TEMPLATE)->GetWindowTextW(pathTmpl);
		glConfig._lastTemplate = CStringA(pathTmpl).GetString();
	}

	logMessage(NCU_MSG_TYPE_INFO, "scan done.");
}