//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "VSTPluginFormUnit.h"
#include "GlobalUnit.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "GeneralDialogPanel"
#pragma link "TextButton"
#pragma resource "*.dfm"
TVSTPluginForm *VSTPluginForm;
//---------------------------------------------------------------------------
__fastcall TVSTPluginForm::TVSTPluginForm(TComponent* Owner, VSTINFO* pVST)
	: TForm(Owner)
{
	m_pVST = pVST;
	m_iSel = -1;
	m_lvPlugins = NULL;
}
//---------------------------------------------------------------------------

void __fastcall TVSTPluginForm::FormCreate(TObject *Sender)
{
	m_BKGPanel->Font->Size = g_szFont9;
	m_btnCancel->FontSize = g_szFont9;
	m_btnOk->FontSize = g_szFont9;

	m_lvPlugins = new TListPanel(this);
	m_lvPlugins->Parent = m_panFont;// m_BKGPanel;
	m_lvPlugins->Align = alClient;
	m_lvPlugins->SetTextFont(g_strTxtFontName, g_szFont9);
//	m_lvPlugins->SetBounds( 27, 63, 246, 250 );

	for( int i=0; i<m_pVST->aPlugins.size(); i++ ){
		VSTPLUGIN* pPlugin = m_pVST->aPlugins[i];
		TListPanelItem* pItem = new TListPanelItem( pPlugin->name, OnItemClick );
		pItem->Tag = pPlugin->id;
		m_lvPlugins->AddItem( pItem );
	}
}
//---------------------------------------------------------------------------

void __fastcall TVSTPluginForm::OnItemClick(TListPanel *Sender, int Index)
{
	m_iSel = Index;
	m_btnOk->Enabled = m_iSel>=0;
}
//---------------------------------------------------------------------------
