Files
StyleTools/Src/HarmonyFormUnit.cpp
2026-09-13 11:54:43 +08:00

783 lines
20 KiB
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// ---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "HarmonyFormUnit.h"
#include "Instruments.h"
#include "GlobalUnit.h"
// ---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
const BYTE u_arrChordPreset[2][4] = { {0,20,28,0}, {37,9,17,37} }; //预置大小调和弦
THarmonyForm *HarmonyForm;
// ---------------------------------------------------------------------------
__fastcall THarmonyForm::THarmonyForm(TComponent* Owner, UINT idLoc, UINT idStyle)
: TForm(Owner)
{
m_pPopMenu = NULL;
m_iAccTypeFlg = -1;
m_bPlayAcc = m_bPlayComp = false;
m_bIsSave = false;
m_idLoc = idLoc;
m_idStyle = idStyle;
m_iPlayAccIndex = m_iPlayCompIndex = -1;
}
// ---------------------------------------------------------------------------
void __fastcall THarmonyForm::FormClose(TObject *Sender, TCloseAction &Action)
{
f_MM_Stop();
f_MM_LoadDemo( NULL, 0 );
if (m_bIsSave) {
ModalResult = mrOk;
}
if( m_pPopMenu ){
m_pPopMenu->CloseMenu();
delete m_pPopMenu;
}
}
// ---------------------------------------------------------------------------
void __fastcall THarmonyForm::FormActivate(TObject *Sender)
{
memset( info, 0, 4*8*2*2 );
int ret = f_CM_GetSegmentInfo( m_idLoc, m_idStyle, info );
if( ret!=0 )
return;
if( !g_bRecreator ){
memset( check, 0, 2*4*2*5*2*sizeof(UINT) );
ret = f_CM_CompareStyle( m_idLoc, m_idStyle, check, NULL );
}
for( int s=0; s<4; s++ ){
for (int n=0; n<8; n++) {
if( info[s][n][0][0]==0 && info[s][n][1][0]==0 )
break;
bool bWarn = false;
if( g_bRecreator ){ //比较大小调tracks
char trkMaj[16][3], trkMin[16][3];
memset( trkMaj, 0, 16*3 );
memset( trkMin, 0, 16*3 );
int num1 = f_CM_GetTracksInfo( m_idLoc, m_idStyle, s, n, 0, trkMaj );
int num2 = f_CM_GetTracksInfo( m_idLoc, m_idStyle, s, n, 1, trkMin );
if( num1!=num2 ){
bWarn = true;
}
else{
for( int i=0; i<num1; i++ ){
bool bDiff = true;
for( int j=0; j<num2; j++ ){
if( trkMin[j][0]==trkMaj[i][0] ){
if( trkMin[j][1]==trkMaj[i][1] )
bDiff = false;
break;
}
}
if( bDiff ){
bWarn = true;
break;
}
}
}
}
for( int c=0; c<2; c++ ){
if( s>=2 || c==0 || g_bRecreator ){
DWORD param = ( s<<16 ) + ( n<<8 ) + c;
String strValue = s==0 ? "伴奏" : s==1 ? "加花" : s==2 ? "前奏" : "尾奏";
strValue += IntToStr(n + 1);
strValue += c==0 ? " 大调 ( " : " 小调 ( ";
strValue += IntToStr( info[s][n][c][0] );
strValue += " bars ";
strValue += IntToStr( info[s][n][c][1] );
strValue += " trks )";
if( g_bRecreator ){
if( !bWarn && info[s][n][1-c][0]!=info[s][n][c][0] )
bWarn = true;
}
else if( s>=2 ){ //检查IE是否与其它风格相同
if( check[s-2][n][c][0][0]>0 )
bWarn = true;
}
if( bWarn ){
param += 1<<24;
}
m_plstAcc->Items->AddObject(strValue, (TObject*)param );
}
}
}
}
if( g_bRecreator ){
m_plstAccPrm->Height = m_plstAcc->Height;
m_lstCheck->Visible = false;
}
}
// ---------------------------------------------------------------------------
void __fastcall THarmonyForm::m_plstAccClick(TObject *Sender)
{
if( m_plstAccPrm->Items->Count>0 )
m_plstAccPrm->Items->Clear();
if( m_lstCheck->Items->Count>0 )
m_lstCheck->Items->Clear();
TListBox * pLst = m_plstAcc;
int iHotIndex = pLst->ItemIndex;
if( ( m_bPlayAcc || m_bPlayComp ) && m_iPlayAccIndex!=iHotIndex ){
PlayClick(NULL);
}
if( iHotIndex<0 )
return;
DWORD param = (DWORD)pLst->Items->Objects[iHotIndex];
char s = HIWORD( param ) & 0xFF,
n = LOWORD( param ) >> 8,
c = param & 0xFF;
int p = 1-c;
char track[16][3], trkp[16][3];
memset( track, 0, 16*3 );
memset( trkp, 0, 16*3 );
int num1 = f_CM_GetTracksInfo( m_idLoc, m_idStyle, s, n, c, track ),
num2 = g_bRecreator ? f_CM_GetTracksInfo( m_idLoc, m_idStyle, s, n, p, trkp ) : 0;
for( int i=0; i<num1; i++ ){
char buff[512];
bool bDrum = ( track[i][0]==9 );
sprintf( buff, "ch%02d %s", track[i][0]+1, bDrum ? "鼓组" : GM_INSTRUMENT[track[i][1]] );
String strTrack = buff;
if( bDrum )
strTrack += IntToStr( track[i][1] );
bool bDiff = g_bRecreator;
if( g_bRecreator ){
for( int j=0; j<num2; j++ ){
if( trkp[j][0]==track[i][0] ){
if( trkp[j][1]==track[i][1] )
bDiff = false;
break;
}
}
}
DWORD value = (bDiff<<24) + (track[i][0]<<16) + (track[i][1]<<8) + track[i][2];
int ind = m_plstAccPrm->Items->AddObject( strTrack, (TObject*)value );
m_plstAccPrm->Checked[ind] = true;
}
if( !g_bRecreator ){
if( m_lstCheck->Items->Count>0 )
m_lstCheck->Items->Clear();
if( s>=2 ){
int seg = s-2;
for( int i=0; i<5; i++ ){
if( check[seg][n][c][i][0]>0 ){
TPROSTYLE * pOriStyle = new TPROSTYLE;
pOriStyle->pOrigin = new TSTYLEORIGIN;
f_CM_GetStyleInfo( 0, check[seg][n][c][i][0], pOriStyle );
char buff[512];
WORD poss = LOWORD(check[seg][n][c][i][1]);
char sO = ( check[seg][n][c][i][1] & 0xFF0000 ) >> 16,
nO = ( check[seg][n][c][i][1] & 0xFF000000 ) >> 24;
// 85% [162]摇动的旋律 前奏1大调
sprintf( buff, "[%d]%s %s%d %s",
check[seg][n][c][i][0],
UFF8ToMBCS(pOriStyle->pOrigin->detail.strStyleName).c_str(),
sO==2 ? "前奏" : "尾奏",
nO,
c==0 ? "大调" : "小调" );
m_lstCheck->Items->AddObject( buff, (TObject*)poss );
}
else
break;
}
}
}
}
// ---------------------------------------------------------------------------
void __fastcall THarmonyForm::m_plstAccPrmClickCheck(TObject *Sender)
{
if( !m_bPlayAcc )
return;
// Here we can set the harmony's paramater
TCheckListBox * pChLst = (TCheckListBox*)Sender;
DWORD param = (DWORD)pChLst->Items->Objects[pChLst->ItemIndex];
bool bMute = !pChLst->Checked[pChLst->ItemIndex];
char chan = HIWORD(param) & 0xFF,
vol = bMute ? 0 : (LOWORD(param) & 0xFF);
param = (DWORD)m_plstAcc->Items->Objects[m_plstAcc->ItemIndex];
char s = HIWORD( param ) & 0xFF,
n = LOWORD( param ) >> 8,
c = param & 0xFF;
int iEndBar = 4;
if( s>=SEGTYPE_INTRO ){
iEndBar = info[s][n][c][0];
}
f_MM_SetTrackEvent( MIDI_EVENT_VOLUME, 0, iEndBar, chan, vol, -1 );
}
// ---------------------------------------------------------------------------
int THarmonyForm::GetAccIndexByName(const String strAccName)
{
int iRet = -1;
AnsiString strTmp = strAccName.Trim();
if (strTmp == L"")
return iRet;
for (int index = 0; index < MAX_PATH; index++) {
if (0 == strcmp(GM_INSTRUMENT[index], strTmp.c_str())) {
iRet = index;
break;
}
}
return iRet;
}
// ---------------------------------------------------------------------------
void __fastcall THarmonyForm::PlayClick(TObject *Sender)
{
if( m_bPlayAcc || m_bPlayComp ){
f_MM_Stop();
f_MM_LoadDemo( NULL, 0 );
m_btnPlay->Caption = "试听";
m_bPlayAcc = m_bPlayComp = false;
m_iPlayAccIndex = m_iPlayCompIndex = -1;
}
else{
int iHotIndex = m_plstAcc->ItemIndex;
if (iHotIndex < 0)
return;
int iChkIndex = m_lstCheck->ItemIndex;
if( iChkIndex>=0 )
PlayCompDemo( iHotIndex, iChkIndex );
else
PlayAccDemo( iHotIndex );
}
}
// ---------------------------------------------------------------------------
void __fastcall THarmonyForm::OnSaveHarmParamClick(TObject *Sender)
{
m_bIsSave = true;
ModalResult = mrOk;
}
// ---------------------------------------------------------------------------
void __fastcall THarmonyForm::m_plstAccDblClick(TObject *Sender)
{
if( m_bPlayAcc || m_bPlayComp )
PlayClick(NULL);
int iHotIndex = m_plstAcc->ItemIndex;
if (iHotIndex < 0)
return;
PlayAccDemo( iHotIndex );
}
// ---------------------------------------------------------------------------
void __fastcall THarmonyForm::m_plstAccDrawItem(TWinControl *Control, int Index, TRect &Rect,
TOwnerDrawState State)
{
TListBox* pList = (TListBox*)Control;
DWORD param = (DWORD) pList->Items->Objects[Index];
char s = HIWORD( param ) & 0xFF,
q = HIWORD( param ) >> 8,
n = LOWORD( param ) >> 8,
c = param & 0xFF;
TRect rcDraw = Rect;
pList->Canvas->Brush->Color = g_clrSegment[s][n];
pList->Canvas->FillRect( rcDraw );
if( State.Contains(odSelected) ){
pList->Canvas->Brush->Color = clRed;
pList->Canvas->FrameRect( rcDraw );
}
else{
//绘制下边框
if( c==0 )
pList->Canvas->Pen->Color = clWhite;
else
pList->Canvas->Pen->Color = clSilver;
pList->Canvas->MoveTo( rcDraw.left, rcDraw.bottom-1 );
pList->Canvas->LineTo( rcDraw.right, rcDraw.bottom-1 );
}
String strText = pList->Items->Strings[Index];
pList->Canvas->Brush->Style = bsClear;
pList->Canvas->Font->Color = clBlack;
pList->Canvas->TextOut( rcDraw.left+5, rcDraw.top+1, strText );
if( q!=0 ){
pList->Canvas->TextOut( rcDraw.right-20, rcDraw.top+1, L"?" );
}
}
//---------------------------------------------------------------------------
void __fastcall THarmonyForm::m_plstAccPrmDrawItem(TWinControl *Control, int Index, TRect &Rect,
TOwnerDrawState State)
{
TCheckListBox* pList = (TCheckListBox*)Control;
DWORD param = (DWORD) pList->Items->Objects[Index];
bool bDiff = HIWORD(param) & 0xFF00;
pList->Canvas->Brush->Color = clWhite;
pList->Canvas->FillRect( Rect );
if( State.Contains(odSelected) ){
pList->Canvas->DrawFocusRect( Rect );
}
String strText = pList->Items->Strings[Index];
pList->Canvas->Brush->Style = bsClear;
if( bDiff )
pList->Canvas->Font->Color = clRed;
else
pList->Canvas->Font->Color = clBlack;
pList->Canvas->TextOut( Rect.left+5, Rect.top+3, strText );
}
//---------------------------------------------------------------------------
void __fastcall THarmonyForm::ProgramMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift,
int X, int Y)
{
TCheckListBox* pList = (TCheckListBox*)Sender;
int iSelIndex = pList->ItemAtPos(TPoint(X,Y),true);
if( iSelIndex<0 ){
pList->ItemIndex = -1;
m_plstAcc->SetFocus();
return;
}
else{
pList->ItemIndex = iSelIndex;
}
if( Button==mbRight && g_bRecreator ){
DWORD param = (DWORD)pList->Items->Objects[iSelIndex];
char chan = HIWORD(param) & 0xFF;
if( chan==9 || pList->Items->Count==1 )
return;
if( !m_pPopMenu ){
m_pPopMenu = new TPopupMenu(NULL);
TMenuItem* pMenuItem = new TMenuItem(m_pPopMenu);
//pMenuItem->Enabled = true;
pMenuItem->Caption = L"删除";
pMenuItem->OnClick = OnDeleteTrack;
m_pPopMenu->Items->Add(pMenuItem);
}
TPoint point(X,Y);
point = pList->ClientToScreen(point);
m_pPopMenu->Tag = chan;
m_pPopMenu->Popup( point.X, point.Y );
}
}
//---------------------------------------------------------------------------
void __fastcall THarmonyForm::OnDeleteTrack(TObject *Sender)
{
char chan = m_pPopMenu->Tag;
if( chan<0 )
return;
int iHotIndex = m_plstAcc->ItemIndex;
if (iHotIndex < 0)
return;
DWORD param = (DWORD)m_plstAcc->Items->Objects[iHotIndex];
char s = HIWORD( param ) & 0xFF,
q = HIWORD( param ) >> 8,
n = LOWORD( param ) >> 8,
c = param & 0xFF;
int ret = f_CM_DeleteTrack( m_idStyle, s, n, c, chan );
if( ret==0 ){
info[s][n][c][1]--;
int p = 1 - c;
char q = 0;
if( info[s][n][p][0]!=info[s][n][c][0] || info[s][n][p][1]!=info[s][n][c][1] )
q = 1;
if( q==0 ){
char trkMaj[16][3], trkMin[16][3];
memset( trkMaj, 0, 16*3 );
memset( trkMin, 0, 16*3 );
int num1 = f_CM_GetTracksInfo( m_idLoc, m_idStyle, s, n, 0, trkMaj );
int num2 = f_CM_GetTracksInfo( m_idLoc, m_idStyle, s, n, 1, trkMin );
if( num1!=num2 ){
q = 1;
}
else{
for( int i=0; i<num1; i++ ){
bool bDiff = true;
for( int j=0; j<num2; j++ ){
if( trkMin[j][0]==trkMaj[i][0] ){
if( trkMin[j][1]==trkMaj[i][1] )
bDiff = false;
break;
}
}
if( bDiff ){
q = 1;
break;
}
}
}
}
String strValue = s==0 ? "伴奏" : s==1 ? "加花" : s==2 ? "前奏" : "尾奏";
strValue += IntToStr(n + 1);
strValue += c==0 ? " 大调 ( " : " 小调 ( ";
strValue += IntToStr( info[s][n][c][0] );
strValue += " bars ";
strValue += IntToStr( info[s][n][c][1] );
strValue += " trks )";
DWORD param = ( s<<16 ) + ( n<<8 ) + c;
if( q>0 ) param += 1<<24;
m_plstAcc->Items->Strings[iHotIndex] = strValue;
m_plstAcc->Items->Objects[iHotIndex] = (TObject*)param;
param = ( s<<16 ) + ( n<<8 ) + p;
if( q>0 ) param += 1<<24;
int iPair = c==0 ? iHotIndex+1 : iHotIndex-1;
m_plstAcc->Items->Objects[iPair] = (TObject*)param;
m_plstAcc->Invalidate();
m_plstAccClick(NULL);
}
}
//---------------------------------------------------------------------------
void __fastcall THarmonyForm::ListCheckDblClick(TObject *Sender)
{
if( m_bPlayAcc || m_bPlayComp )
PlayClick(NULL);
int iHotIndex = m_plstAcc->ItemIndex;
if( iHotIndex<0 )
return;
int iChkIndex = m_lstCheck->ItemIndex;
if( iChkIndex<0 )
return;
PlayCompDemo( iHotIndex, iChkIndex );
}
//---------------------------------------------------------------------------
void THarmonyForm::PlayAccDemo( int index )
{
DWORD param = (DWORD)m_plstAcc->Items->Objects[index];
char s = HIWORD( param ) & 0xFF,
n = LOWORD( param ) >> 8,
c = param & 0xFF;
if( s!=-1 ){
TStage* aStages = NULL;
int nStageNum = 0;
int barNum = 4;
if( s>=SEGTYPE_INTRO ){
barNum = info[s][n][c][0];
}
nStageNum = 1;
aStages = new TStage[1];
aStages->iSegType = s;
aStages->nBarNum = barNum;
int trkNum = m_plstAccPrm->Items->Count;
aStages->nTrkNum = trkNum;
aStages->aTracks = new TTrack[trkNum];
for( int i=0; i<trkNum; i++ ){
aStages->aTracks[i].iStyleLoc = m_idLoc;
aStages->aTracks[i].iStyleId = m_idStyle;
if( s>=SEGTYPE_INTRO ){
aStages->aTracks[i].iSegNo = n + (( c + 1) << 4);
}
else
aStages->aTracks[i].iSegNo = n;
DWORD paramT = (DWORD) m_plstAccPrm->Items->Objects[i];
char chan = HIWORD(paramT) & 0xFF,
prog = LOWORD(paramT) >> 8,
vol = LOWORD(paramT) & 0xFF;
bool bMute = !m_plstAccPrm->Checked[i];
aStages->aTracks[i].iChanNo = chan;
aStages->aTracks[i].iChanSpec = chan;
aStages->aTracks[i].iProg = prog;
aStages->aTracks[i].nVol = bMute ? 0 : vol;
}
if( s<=SEGTYPE_FILL ){
aStages->aChords = new TBarChords[barNum];
for( int j=0; j<barNum; j++ ){
char chordType = u_arrChordPreset[c][j] % 4;
char chordKey = u_arrChordPreset[c][j] / 4;
aStages->aChords[j].iKey[0]
= aStages->aChords[j].iKey[1]
= aStages->aChords[j].iKey[2]
= aStages->aChords[j].iKey[3] = chordKey;
aStages->aChords[j].iType[0]
= aStages->aChords[j].iType[1]
= aStages->aChords[j].iType[2]
= aStages->aChords[j].iType[3] = chordType;
}
}
int len = 1000000;
BYTE* data = new BYTE[len];
int ret = f_CM_Compose( &len, data, g_iMelodyTimeSignature, g_nMelodyTempo,
nStageNum, aStages, false, NULL, NULL );
if( ret==0 ){
f_MM_LoadDemo( data, len );
f_MM_PlayDemo( Handle, -1, -1, -1, -1, NULL );
m_btnPlay->Caption = "停止";
m_bPlayAcc = true;
m_iPlayAccIndex = index;
}
else{
String strError = L"获取风格试听数据失败,错误码:" + IntToStr(ret);
OutputDebugString(strError.c_str());
}
delete data;
}
}
//---------------------------------------------------------------------------
void THarmonyForm::PlayCompDemo( int iAcc, int iCheck )
{
DWORD param = (DWORD)m_plstAcc->Items->Objects[iAcc];
char s = HIWORD( param ) & 0xFF,
n = LOWORD( param ) >> 8,
c = param & 0xFF;
if( s>=2 ){
UINT idStyle = check[s-2][n][c][iCheck][0];
if( idStyle==0 )
return;
TPROSTYLE* pStyle = new TPROSTYLE;
pStyle->pOrigin = new TSTYLEORIGIN;
if( f_CM_GetStyleInfo( 0, idStyle, pStyle )!=0 )
return;
char sO = ( check[s-2][n][c][iCheck][1] & 0xFF0000 ) >> 16,
nO = ( check[s-2][n][c][iCheck][1] & 0xFF000000 ) >> 24;
int sn = nO;
if( c>0 ){
sn += 4;
}
TSTYLEDETAIL& detail = pStyle->pOrigin->detail;
int barNum = (s==2) ? detail.aIntroBars[sn]
: detail.aEndingBars[sn];
TStage* aStages = NULL;
int nStageNum = 0;
nStageNum = 1;
aStages = new TStage[1];
aStages->iSegType = s;
aStages->nBarNum = barNum;
int trkNum = 0;
for( trkNum=0; trkNum<16 && detail.tracks[s][sn][trkNum].no>=0; trkNum++ );
aStages->nTrkNum = trkNum;
aStages->aTracks = new TTrack[trkNum];
for( int i=0; i<trkNum; i++ ){
aStages->aTracks[i].iStyleLoc = pStyle->idLoc;
aStages->aTracks[i].iStyleId = pStyle->idStyle;
aStages->aTracks[i].iSegNo = nO + (( c + 1) << 4);
aStages->aTracks[i].iChanNo = aStages->aTracks[i].iChanSpec =
detail.tracks[s][sn][i].no;
aStages->aTracks[i].iProg = detail.tracks[s][sn][i].prog;
aStages->aTracks[i].nVol = detail.tracks[s][sn][i].vol;
}
delete pStyle;
int len = 1000000;
BYTE* data = new BYTE[len];
int ret = f_CM_Compose( &len, data, g_iMelodyTimeSignature, g_nMelodyTempo,
nStageNum, aStages, false, NULL, NULL );
if( ret==0 ){
f_MM_LoadDemo( data, len );
f_MM_PlayDemo( Handle, -1, -1, -1, -1, NULL );
m_btnPlay->Caption = "停止";
m_bPlayComp = true;
m_iPlayAccIndex = iAcc;
m_iPlayCompIndex = iCheck;
}
else{
String strError = L"获取风格试听数据失败,错误码:" + IntToStr(ret);
OutputDebugString(strError.c_str());
}
delete data;
}
}
//---------------------------------------------------------------------------
void __fastcall THarmonyForm::ListCheckClick(TObject *Sender)
{
int index = m_lstCheck->ItemIndex;
if( m_bPlayComp && m_iPlayCompIndex!=index ){
PlayClick(NULL);
}
}
//---------------------------------------------------------------------------
void __fastcall THarmonyForm::ListCheckDrawItem(TWinControl *Control, int Index, TRect &Rect,
TOwnerDrawState State)
{
TListBox* pList = (TListBox*)Control;
WORD poss = (WORD) pList->Items->Objects[Index];
char buff[20];
sprintf( buff, "%6d%%", poss );
TRect rcDraw = Rect;
int n = (poss-20)/10;
if( n>7 ) n=7;
pList->Canvas->Brush->Color = g_clrSegment[0][n];
pList->Canvas->FillRect( rcDraw );
if( State.Contains(odSelected) ){
pList->Canvas->Brush->Color = clRed;
pList->Canvas->FrameRect( rcDraw );
}
else{
//绘制下边框
pList->Canvas->Brush->Color = clSilver;
pList->Canvas->FrameRect( rcDraw );
}
String strText = pList->Items->Strings[Index];
pList->Canvas->Brush->Style = bsClear;
pList->Canvas->Font->Color = clBlack;
pList->Canvas->TextOut( rcDraw.left+5, rcDraw.top+3, strText );
pList->Canvas->TextOut( rcDraw.right-40, rcDraw.top+3, buff );
}
//---------------------------------------------------------------------------
void __fastcall THarmonyForm::ListCheckMouseDown(TObject *Sender, TMouseButton Button,
TShiftState Shift, int X, int Y)
{
TListBox* pList = (TListBox*)Sender;
int iSelIndex = pList->ItemAtPos(TPoint(X,Y),true);
if( iSelIndex<0 ){
pList->ItemIndex = -1;
m_plstAcc->SetFocus();
return;
}
}
//---------------------------------------------------------------------------
void __fastcall THarmonyForm::ListAccMouseDown(TObject *Sender, TMouseButton Button,
TShiftState Shift, int X, int Y)
{
TListBox* pList = (TListBox*)Sender;
int iSelIndex = pList->ItemAtPos(TPoint(X,Y),true);
if( iSelIndex<0 ){
pList->ItemIndex = -1;
m_plstAcc->SetFocus();
return;
}
}
//---------------------------------------------------------------------------
void __fastcall THarmonyForm::FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift)
{
switch( Key ){
case ' '://VK_RETURN:
if( m_plstAccPrm->ItemIndex==-1 )
PlayClick(NULL);
break;
case VK_ESCAPE:
ModalResult = mrCancel;
break;
}
}
//---------------------------------------------------------------------------