예제 #1
0
VSTPluginLib *CSelectPluginDlg::ScanPlugins(const mpt::PathString &path, CWnd *parent)
//------------------------------------------------------------------------------------
{
	CVstPluginManager *pManager = theApp.GetPluginManager();
	VSTPluginLib *plugLib = nullptr;
	bool update = false;

	CDialog pluginScanDlg;
	pluginScanDlg.Create(IDD_SCANPLUGINS, parent);
	pluginScanDlg.CenterWindow(parent);
	pluginScanDlg.ModifyStyle(0, WS_SYSMENU, WS_SYSMENU);
	pluginScanDlg.ShowWindow(SW_SHOW);

	FolderScanner scan(path, true);
	mpt::PathString fileName;
	int files = 0;
	while(scan.NextFile(fileName) && pluginScanDlg.IsWindowVisible())
	{
		if(!mpt::PathString::CompareNoCase(fileName.GetFileExt(), MPT_PATHSTRING(".dll")))
		{
			CWnd *text = pluginScanDlg.GetDlgItem(IDC_SCANTEXT);
			std::wstring scanStr = L"Scanning Plugin...\n" + fileName.ToWide();
			::SetWindowTextW(text->m_hWnd, scanStr.c_str());
			MSG msg;
			while(::PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
			{
				::TranslateMessage(&msg);
				::DispatchMessage(&msg);
			}

			VSTPluginLib *lib = pManager->AddPlugin(fileName, mpt::ustring(), false);
			if(lib)
			{
				update = true;
				if(!VerifyPlug(lib, parent))
				{
					pManager->RemovePlugin(lib);
				} else
				{
					plugLib = lib;
					files++;
				}
			}
		}
	}

	if(update)
	{
		// Force selection to last added plug.
		Reporting::Information(mpt::String::Print("Found %1 plugin%2.", files, files == 1 ? "" : "s").c_str(), parent);
		return plugLib;
	} else
	{
		Reporting::Error("Could not find any valid VST plugins.");
		return nullptr;
	}
}
예제 #2
0
void Languages::Translate(CDialog& dialog, UINT nResourceID)
{
    //set translated text for every know control ID
    for (int iID = 0; iID < _APS_NEXT_CONTROL_VALUE; iID++)
    {
        mapitem_t::iterator ite = m_mItems.find(iID);
        if(ite != m_mItems.end() && dialog.GetDlgItem(iID))
        {
            dialog.SetDlgItemText(iID, ite->second);
        }
    }

    //set translated text on the dialog
    mapitem_t::iterator ite = m_mItems.find(nResourceID);
    if(ite != m_mItems.end())
        dialog.SetWindowText(ite->second);
    //else
    //    TRACE(_T("Missing Item ID %d\n"), nResourceID);

    CMenu* menu = dialog.GetMenu();
    if(menu)
        Translate(*menu);
}