Restructure: move sources to Src/, add README, update .gitignore
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
#include <vcl.h>
|
||||
#include <tchar.h>
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "AboutFormUnit.h"
|
||||
#include "GlobalUnit.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
#pragma link "PNGButton"
|
||||
#pragma link "GeneralDialogPanel"
|
||||
#pragma resource "*.dfm"
|
||||
TAboutForm *AboutForm;
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TAboutForm::TAboutForm(TComponent* Owner)
|
||||
: TForm(Owner)
|
||||
{
|
||||
Font->Color = RGB(60,43,23);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAboutForm::FormCreate(TObject *Sender)
|
||||
{
|
||||
m_lblVersion->Caption = g_strCurrentVersion;
|
||||
|
||||
int wMaj, wMin, wMod, wBld;
|
||||
sscanf( g_strCurrentVersion, "%d.%d.%d.%d", &wMaj, &wMin, &wMod, &wBld );
|
||||
|
||||
if( SOFTWARE_ID==e_Pro_Lite )
|
||||
m_lblType->Caption = L"教学版";
|
||||
else if( wMaj==0 )
|
||||
m_lblType->Caption = L"测试版";
|
||||
else
|
||||
m_lblType->Caption = L"正式版";
|
||||
|
||||
m_lblType->Left = m_lblVersion->Left + m_lblVersion->Width + 3;
|
||||
|
||||
int nOrigin, nDownload, nShare, nLocal;
|
||||
f_CS_GetStyleNumsEx( nOrigin, nDownload, nShare, nLocal );
|
||||
char strNums[64];
|
||||
sprintf( strNums, "发布/下载风格数:%d/%d", nOrigin, nDownload );
|
||||
m_lblStyleNums->Caption = strNums;
|
||||
|
||||
m_lblURL->Caption = g_strServerURL;
|
||||
|
||||
SetTransparent( this );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAboutForm::WMNCHitTest(TWMNCHitTest &Msg)
|
||||
{
|
||||
TForm::Dispatch(&Msg);
|
||||
|
||||
if( Msg.Result==HTCLIENT && Msg.YPos<Top+24 && Msg.XPos<Left+275 )
|
||||
Msg.Result = HTCAPTION;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TAboutForm::URLClick(TObject *Sender)
|
||||
{
|
||||
if( m_lblURL->Caption.Length()>0 ){
|
||||
ShellExecute(Handle,NULL, m_lblURL->Caption.c_str(), NULL,NULL,SW_SHOWNORMAL);
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TAboutForm::FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift)
|
||||
{
|
||||
switch( Key ){
|
||||
case VK_RETURN:
|
||||
case VK_ESCAPE:
|
||||
ModalResult = mrCancel;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,41 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef AboutFormUnitH
|
||||
#define AboutFormUnitH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <System.Classes.hpp>
|
||||
#include <Vcl.Controls.hpp>
|
||||
#include <Vcl.StdCtrls.hpp>
|
||||
#include <Vcl.Forms.hpp>
|
||||
#include "PNGButton.hpp"
|
||||
#include <Vcl.ExtCtrls.hpp>
|
||||
#include <Vcl.Imaging.jpeg.hpp>
|
||||
#include "GeneralDialogPanel.h"
|
||||
#include <Vcl.Imaging.pngimage.hpp>
|
||||
//---------------------------------------------------------------------------
|
||||
class TAboutForm : public TForm
|
||||
{
|
||||
__published: // IDE-managed Components
|
||||
TLabel *m_lblVersion;
|
||||
TLabel *m_lblURL;
|
||||
TLabel *m_lblStyleNums;
|
||||
TLabel *m_lblType;
|
||||
TGeneralDialogPanel *GeneralDialogPanel1;
|
||||
TImage *PNGLogo;
|
||||
TImage *PNGText;
|
||||
void __fastcall FormCreate(TObject *Sender);
|
||||
void __fastcall URLClick(TObject *Sender);
|
||||
void __fastcall FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift);
|
||||
private: // User declarations
|
||||
void __fastcall WMNCHitTest(TWMNCHitTest &Msg);
|
||||
|
||||
BEGIN_MESSAGE_MAP
|
||||
MESSAGE_HANDLER(WM_NCHITTEST, TWMNCHitTest, WMNCHitTest)
|
||||
END_MESSAGE_MAP(TForm)
|
||||
public: // User declarations
|
||||
__fastcall TAboutForm(TComponent* Owner);
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
extern PACKAGE TAboutForm *AboutForm;
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,75 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef AudStylePanelH
|
||||
#define AudStylePanelH
|
||||
|
||||
#include "StylePanel.h"
|
||||
#include "StyleSelPanel.h"
|
||||
//---------------------------------------------------------------------------
|
||||
class TAudStylePanel : public TStylePanel
|
||||
{
|
||||
private:
|
||||
bool IsCollected( UINT idLoc, UINT idStyle );
|
||||
DWORD GetStyleOptions( TPROSTYLE* info );
|
||||
void RefreshList();
|
||||
void StyleRename();
|
||||
|
||||
int m_iListType;
|
||||
int m_nBtnCount;
|
||||
bool m_bDoubleClick;
|
||||
|
||||
TTimer *m_RenameTimer;
|
||||
|
||||
protected:
|
||||
TStyleSelPanel *m_SearchPanel; //ËÑË÷Ãæ°å
|
||||
|
||||
void SetDownload( TCommonItem *pItem );
|
||||
TStyleItem* CreateInstrumentItem( TPROSTYLE* info, bool bCollected, bool bAuthority );
|
||||
TStyleItem* CreateStyleItem( TPROSTYLE* info, bool bCollected, bool bAuthority );
|
||||
void InsertStyleItem( TStyleItem* pStyItem, int index );
|
||||
TStyleItem* __fastcall AddStyleItem( TPROSTYLE* info, bool bCollected );
|
||||
|
||||
virtual void Init();
|
||||
virtual bool StartDrag();
|
||||
virtual void SetScrollTimer(TPoint ptNew){};
|
||||
virtual void PlayDemo( TCommonItem *pItem, int tempo );
|
||||
virtual void DeleteItem( TCommonItem *pItem, int iLine );
|
||||
virtual String ChargeTip( TStyleItem* pItem );
|
||||
virtual bool CanVSplit(){ return true; };
|
||||
|
||||
void __fastcall CMClick(System::TObject* Sender); //pngbutton °´ÏÂ
|
||||
void __fastcall ListTypeClick( TObject *Sender );
|
||||
void __fastcall RenameTimerProc(System::TObject* Sender);
|
||||
void __fastcall EditMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift,
|
||||
int X, int Y);
|
||||
void __fastcall EditMouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift,
|
||||
int X, int Y);
|
||||
void __fastcall EditMouseMove(TObject *Sender, TShiftState Shift, int X, int Y);
|
||||
void __fastcall EditKeyDown(TObject *Sender, WORD &Key, TShiftState Shift);
|
||||
void __fastcall EditChange(TObject *Sender);
|
||||
|
||||
virtual void __fastcall RenameTiming(int op); //ÖØÃüÃû
|
||||
virtual void __fastcall DoRename(TObject* Sender);
|
||||
virtual void __fastcall DoCollect(TObject* Sender);
|
||||
virtual void __fastcall DoubleClick(TObject* sender);
|
||||
|
||||
MESSAGE void __fastcall OnNetworkError(TMessage &msg);
|
||||
MESSAGE void __fastcall OnNetworkMessage(TMessage &msg);
|
||||
MESSAGE void __fastcall WMSize(Winapi::Messages::TWMSize &Message); //add
|
||||
MESSAGE void __fastcall UMSearchStyle(TMessage &msg);
|
||||
|
||||
BEGIN_MESSAGE_MAP
|
||||
MESSAGE_HANDLER(MSG_NETWORKERROR, TMessage, OnNetworkError)
|
||||
MESSAGE_HANDLER(MSG_NETWORKMESSAGE, TMessage, OnNetworkMessage)
|
||||
MESSAGE_HANDLER(WM_SIZE, TWMSize, WMSize) //add
|
||||
MESSAGE_HANDLER(UM_SEARCH,TMessage,UMSearchStyle);
|
||||
END_MESSAGE_MAP(TStylePanel)
|
||||
|
||||
public:
|
||||
__fastcall virtual TAudStylePanel(System::Classes::TComponent* AOwner);
|
||||
__fastcall ~TAudStylePanel();
|
||||
|
||||
void __fastcall ReloadLocalStyle( bool bShow=true );
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,388 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "GlobalUnit.h"
|
||||
#include "AudioFxFormUnit.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
#pragma link "GeneralDialogPanel"
|
||||
#pragma link "TextButton"
|
||||
#pragma link "ComboBoxComponent"
|
||||
#pragma link "PNGButton"
|
||||
#pragma link "SkinTrackBar"
|
||||
#pragma resource "*.dfm"
|
||||
|
||||
#define TIMER_INTERVAL 50
|
||||
#define FX_TOP_BOUND 24
|
||||
#define FX_BOTTOM_BOUND 24
|
||||
#define FX_LEFT_BOUND 40
|
||||
#define FX_ITEM_HEIGHT 40
|
||||
|
||||
TAudioFxForm *AudioFxForm;
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TAudioFxForm::TAudioFxForm( TComponent* Owner, int iTrk, double start, double end,
|
||||
int iInd, int iFx, int iPlugin )
|
||||
: TForm(Owner)
|
||||
{
|
||||
m_iTrack = iTrk;
|
||||
m_iInd = iInd;
|
||||
m_iFx = iFx;
|
||||
m_iPlugin = iPlugin;
|
||||
memset( m_fParam, 0, sizeof(float)*6 );
|
||||
memset( m_lstCaption, 0, sizeof(void*)*6 );
|
||||
memset( m_lstTrack, 0, sizeof(void*)*6 );
|
||||
|
||||
m_iCurrPos = 0;
|
||||
m_dblPos = 0;
|
||||
m_dblStep = TIMER_INTERVAL * (double)g_nMelodyTempo / g_nBPM / 60.0 / ( end - start );
|
||||
m_dblStart = start;
|
||||
m_dblEnd = end;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
__fastcall TAudioFxForm::~TAudioFxForm()
|
||||
{
|
||||
for( int i=0; i<6 && m_lstCaption[i]; i++ ){
|
||||
delete m_lstCaption[i];
|
||||
delete m_lstTrack[i];
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TAudioFxForm::FormClose(TObject *Sender, TCloseAction &Action)
|
||||
{
|
||||
if( m_btnStop->Visible ){
|
||||
StopClick( NULL );
|
||||
}
|
||||
|
||||
if( m_iFx>=FX_VST )
|
||||
f_MM_ShowVSTEditor( NULL, NULL, NULL, NULL, m_iTrack, m_iInd, NULL );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TAudioFxForm::PlayClick(TObject *Sender)
|
||||
{
|
||||
double dblPos = ( (double)m_tbPosition->Position / m_tbPosition->Max ) * ( m_dblEnd - m_dblStart ) + m_dblStart;
|
||||
|
||||
m_btnPlay->Visible = false;
|
||||
m_btnStop->Visible = true;
|
||||
|
||||
f_MM_Play( Handle, dblPos, TYPE_AUDIOFX|g_iSelAudio );
|
||||
SetPlayTimer( true, m_tTimer, m_tAccuracy, Handle, TIMER_INTERVAL );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TAudioFxForm::PowerClick(TObject *Sender)
|
||||
{
|
||||
m_btnPowerOn->Visible = Sender==m_btnPowerOff;
|
||||
m_btnPowerOff->Visible = !m_btnPowerOn->Visible;
|
||||
|
||||
if( m_iFx>=FX_VST )
|
||||
f_MM_AudioSetFxParam( m_iTrack, m_iInd, (void*)m_btnPowerOn->Visible, 0 );
|
||||
else
|
||||
f_MM_AudioSetFxParam( m_iTrack, m_iInd, (void*)(m_btnPowerOn->Visible ? m_fParam : NULL), 0 );
|
||||
|
||||
if( m_iInd<0 )
|
||||
m_btnOk->Enabled = m_btnPowerOn->Visible;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TAudioFxForm::StopClick(TObject *Sender)
|
||||
{
|
||||
m_btnStop->Visible = false;
|
||||
m_btnPlay->Visible = true;
|
||||
|
||||
f_MM_Stop();
|
||||
SetPlayTimer(false, m_tTimer, m_tAccuracy);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TAudioFxForm::LoopClick(TObject *Sender)
|
||||
{
|
||||
m_btnLoop->Down = !m_btnLoop->Down;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TAudioFxForm::PresetChange(TComboBoxItem *Sender, int Index)
|
||||
{
|
||||
if( m_iFx<FX_VST && m_cbPreset->DefItemIndex!=m_cbPreset->ItemsCount-1 ){
|
||||
int iFxNo = m_iFx==FX_PITCH ? MAX_FX_NUM-1 : m_iFx;
|
||||
|
||||
GetFxPreset( m_iFx, m_cbPreset->DefItemIndex, m_fParam );
|
||||
|
||||
for( int i=0; i<6 && m_lstTrack[i]; i++ ){
|
||||
m_lstTrack[i]->OnChange = NULL;
|
||||
|
||||
if( m_iFx==FX_PITCH ){
|
||||
m_lstTrack[i]->Position = (int)m_fParam[i];
|
||||
}
|
||||
else{
|
||||
int pos = Param2Pos( iFxNo, i, m_fParam[i] );
|
||||
m_lstTrack[i]->Position = pos;
|
||||
}
|
||||
|
||||
m_lstTrack[i]->Hint = IntToStr(m_lstTrack[i]->Position);
|
||||
m_lstTrack[i]->OnChange = TrackBarChange;
|
||||
}
|
||||
|
||||
if( m_btnPowerOn->Visible )
|
||||
f_MM_AudioSetFxParam( m_iTrack, m_iInd, (void*)m_fParam, 0 );
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TAudioFxForm::TrackBarChange(TObject *Sender)
|
||||
{
|
||||
TSkinTrackBar* pTrack = (TSkinTrackBar*)Sender;
|
||||
int nPos = pTrack->Position;
|
||||
pTrack->Hint = IntToStr(nPos);
|
||||
|
||||
int iFxNo = m_iFx==FX_PITCH ? MAX_FX_NUM-1 : m_iFx;
|
||||
if( m_cbPreset->DefItemIndex!=m_cbPreset->ItemsCount-1 )
|
||||
m_cbPreset->DefItemIndex = m_cbPreset->ItemsCount-1;
|
||||
|
||||
float fParam = Pos2Param( iFxNo, pTrack->Tag, nPos );
|
||||
m_fParam[pTrack->Tag] = fParam;
|
||||
|
||||
if( m_btnPowerOn->Visible )
|
||||
f_MM_AudioSetFxParam( m_iTrack, m_iInd, (void*)m_fParam, 0 );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TAudioFxForm::UMMediaTime(TMessage &Message)
|
||||
{
|
||||
m_dblPos += m_dblStep;
|
||||
m_iCurrPos = (DWORD)( m_dblPos + 0.5 );
|
||||
|
||||
if( m_iCurrPos==m_tbPosition->Position )
|
||||
return;
|
||||
|
||||
if( m_iCurrPos >= m_tbPosition->Max ){
|
||||
m_dblPos = 0;
|
||||
m_iCurrPos = 0;
|
||||
|
||||
if( m_btnLoop->Down ){
|
||||
f_MM_Play( Handle, m_dblStart, TYPE_AUDIOFX | g_iSelAudio );
|
||||
}
|
||||
else{
|
||||
StopClick( NULL );
|
||||
}
|
||||
}
|
||||
|
||||
m_tbPosition->Position = m_iCurrPos;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TAudioFxForm::PositionChange(TObject *Sender)
|
||||
{
|
||||
if( m_iCurrPos!=m_tbPosition->Position ){
|
||||
m_iCurrPos = m_tbPosition->Position;
|
||||
m_dblPos = m_iCurrPos;
|
||||
|
||||
if( m_btnStop->Visible ){
|
||||
SetPlayTimer(false, m_tTimer, m_tAccuracy);
|
||||
|
||||
double dblPos = ( (double)m_tbPosition->Position / m_tbPosition->Max ) * ( m_dblEnd - m_dblStart ) + m_dblStart;
|
||||
f_MM_Play( Handle, dblPos, TYPE_AUDIOFX | g_iSelAudio );
|
||||
|
||||
SetPlayTimer( true, m_tTimer, m_tAccuracy, Handle, TIMER_INTERVAL );
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TAudioFxForm::FormResize(TObject *Sender)
|
||||
{
|
||||
m_panShow->SetBounds( m_panShow->Left, m_panShow->Top,
|
||||
ClientWidth - 50, ClientHeight - 155 );
|
||||
|
||||
m_tbPosition->Width = m_panShow->Width;
|
||||
m_tbPosition->Top = ClientHeight - 69;
|
||||
|
||||
m_btnPlay->Top = ClientHeight - 43;
|
||||
m_btnStop->Top = m_btnPlay->Top;
|
||||
m_btnLoop->Top = m_btnPlay->Top;
|
||||
m_btnOk->Top = m_btnPlay->Top + 1;
|
||||
m_btnCancel->Top = m_btnOk->Top;
|
||||
|
||||
m_btnPowerOn->Left = ClientWidth - 66;
|
||||
m_btnPowerOff->Left = m_btnPowerOn->Left;
|
||||
m_btnCancel->Left = ClientWidth - 83;
|
||||
m_btnOk->Left = ClientWidth - 148;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TAudioFxForm::UMEditorResize(TMessage &Message)
|
||||
{
|
||||
int nWidth = Message.WParam,
|
||||
nHeight = Message.LParam;
|
||||
|
||||
if( nWidth==0 )
|
||||
nWidth = 300;
|
||||
if( nHeight==0 )
|
||||
nHeight = 150;
|
||||
|
||||
SetBounds( Left, Top, nWidth + 50, nHeight + 155 );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TAudioFxForm::FormCreate(TObject *Sender)
|
||||
{
|
||||
m_BKGPanel->Font->Size = g_szFont9;
|
||||
m_btnCancel->FontSize = g_szFont9;
|
||||
m_btnOk->FontSize = g_szFont9;
|
||||
m_cbPreset->SetFont(g_strTxtFontName, g_szFont9);
|
||||
|
||||
String strCaption = m_BKGPanel->Caption + L" - ";
|
||||
int nFormWidth = m_panShow->Width + 50,
|
||||
nFormHeight = m_panShow->Height + 155;
|
||||
|
||||
m_lblNoParams->Visible = false;
|
||||
|
||||
if( m_iInd>=0 )
|
||||
m_btnOk->Text = "È·¶¨";
|
||||
|
||||
if( m_iFx>=FX_VST ){
|
||||
m_cbPreset->AddItem( "(ĬÈÏ)" );
|
||||
m_cbPreset->DefItemIndex = 0;
|
||||
|
||||
if( m_iPlugin<0 )
|
||||
strCaption += g_lstVSTFx[m_iFx-FX_VST]->strVSTName;
|
||||
else
|
||||
strCaption += g_lstVSTFx[m_iFx-FX_VST]->aPlugins[m_iPlugin]->name;
|
||||
|
||||
int nWidth(0), nHeight(0);
|
||||
if( f_MM_ShowVSTEditor( Handle, m_panShow->Handle, &nWidth, &nHeight,
|
||||
m_iTrack, m_iInd, NULL )==S_OK ){
|
||||
if( nWidth<0 && nHeight<0 ){
|
||||
m_lblNoParams->Visible = true;
|
||||
}
|
||||
else{
|
||||
if( nWidth==0 || nHeight==0 )
|
||||
BorderStyle = bsSizeable;
|
||||
|
||||
if( nWidth==0 )
|
||||
nWidth = 300;
|
||||
if( nHeight==0 )
|
||||
nHeight = 150;
|
||||
|
||||
nFormWidth = nWidth + 50;
|
||||
nFormHeight = nHeight + 155;
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
int iFxNo = m_iFx==FX_PITCH ? MAX_FX_NUM-1 : m_iFx,
|
||||
n = GetFxParamNum( m_iFx ),
|
||||
t = FX_TOP_BOUND;
|
||||
|
||||
strCaption += g_strEffect[iFxNo];
|
||||
|
||||
int nItemCount = 0;
|
||||
for( int i=0; i<3; i++ ){
|
||||
if( strlen( g_strEffectPreset[iFxNo][i] )>0 ){
|
||||
m_cbPreset->AddItem( g_strEffectPreset[iFxNo][i] );
|
||||
nItemCount++;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
m_cbPreset->AddItem( "×Ô¶¨Òå" );
|
||||
|
||||
if( false ){
|
||||
m_cbPreset->DefItemIndex = 0;
|
||||
}
|
||||
else{
|
||||
m_cbPreset->DefItemIndex = 0;
|
||||
}
|
||||
|
||||
if( m_iInd<0 || m_iInd>=g_aAudioTracks[m_iTrack]->lstFxs.size() ){
|
||||
GetFxPreset( m_iFx, m_cbPreset->DefItemIndex, m_fParam );
|
||||
f_MM_AudioSetFxParam( m_iTrack, m_iInd, (void*)m_fParam, 0 );
|
||||
}
|
||||
else{
|
||||
TAudioFx* pFx = g_aAudioTracks[m_iTrack]->lstFxs[m_iInd];
|
||||
m_cbPreset->DefItemIndex = pFx->iPreset;
|
||||
memcpy( m_fParam, pFx->pParam, sizeof(float) * pFx->nParamSize );
|
||||
|
||||
m_btnPowerOn->Visible = !pFx->bBypass;
|
||||
m_btnPowerOff->Visible = !!pFx->bBypass;
|
||||
}
|
||||
|
||||
for( int i=0; i<n; i++ ){
|
||||
m_lstCaption[i] = new TLabel(this);
|
||||
m_lstCaption[i]->Parent = m_panShow;
|
||||
m_lstCaption[i]->Layout = tlBottom;
|
||||
m_lstCaption[i]->Font->Name = g_strTxtFontName;
|
||||
m_lstCaption[i]->Font->Size = g_szFont9;
|
||||
m_lstCaption[i]->Font->Color = RGB( 156, 170, 189 );
|
||||
m_lstCaption[i]->SetBounds( FX_LEFT_BOUND, t, 60, 18 );
|
||||
m_lstCaption[i]->Caption = g_strEffectParamName[iFxNo][i];
|
||||
m_lstCaption[i]->Caption += ":";
|
||||
|
||||
m_lstTrack[i] = new TSkinTrackBar(this);
|
||||
m_lstTrack[i]->Parent = m_panShow;
|
||||
m_lstTrack[i]->ShowHint = true;
|
||||
m_lstTrack[i]->Tag = i;
|
||||
m_lstTrack[i]->SetBounds( 104, t, 209, 18 );
|
||||
|
||||
if( m_iFx==FX_PITCH ){
|
||||
m_lstTrack[i]->Min = -36;
|
||||
m_lstTrack[i]->Max = 36;
|
||||
m_lstTrack[i]->PageSize = 12;
|
||||
m_lstTrack[i]->Position = (int)m_fParam[i];
|
||||
}
|
||||
else{
|
||||
int pos = Param2Pos( iFxNo, i, m_fParam[i] );
|
||||
m_lstTrack[i]->Position = pos;
|
||||
}
|
||||
|
||||
m_lstTrack[i]->Hint = IntToStr(m_lstTrack[i]->Position);
|
||||
m_lstTrack[i]->OnChange = TrackBarChange;
|
||||
|
||||
t += FX_ITEM_HEIGHT;
|
||||
}
|
||||
|
||||
nFormHeight = t + 155;
|
||||
}
|
||||
|
||||
m_BKGPanel->Caption = strCaption;
|
||||
SetBounds( Left, Top, nFormWidth, nFormHeight );
|
||||
|
||||
SetTransparent( this );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
int __fastcall TAudioFxForm::GetParamCount()
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
for( int i=0; i<6 && m_lstCaption[i]; i++ ){
|
||||
count++;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
int __fastcall TAudioFxForm::GetPreset()
|
||||
{
|
||||
return m_cbPreset->DefItemIndex;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
bool __fastcall TAudioFxForm::IsBypass()
|
||||
{
|
||||
return m_btnPowerOff->Visible;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TAudioFxForm::OkClick(TObject *Sender)
|
||||
{
|
||||
f_MM_SaveVSTParams( m_iTrack, m_iInd, false );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,833 @@
|
||||
object AudioFxForm: TAudioFxForm
|
||||
Left = 0
|
||||
Top = 0
|
||||
BorderIcons = []
|
||||
BorderStyle = bsNone
|
||||
ClientHeight = 238
|
||||
ClientWidth = 406
|
||||
Color = clBtnFace
|
||||
DoubleBuffered = True
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
Position = poMainFormCenter
|
||||
Scaled = False
|
||||
OnClose = FormClose
|
||||
OnCreate = FormCreate
|
||||
OnResize = FormResize
|
||||
TextHeight = 13
|
||||
object m_BKGPanel: TGeneralDialogPanel
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 406
|
||||
Height = 238
|
||||
Align = alClient
|
||||
Caption = #38899#25928
|
||||
Color = 5064257
|
||||
ParentBackground = False
|
||||
TabOrder = 0
|
||||
object m_btnPowerOff: TPNGButton
|
||||
Left = 340
|
||||
Top = 38
|
||||
Width = 39
|
||||
Height = 26
|
||||
Hint = #25171#24320#38899#25928
|
||||
ParentCustomHint = False
|
||||
ImgStates = 3
|
||||
ParentShowHint = False
|
||||
PngImg.Data = {
|
||||
89504E470D0A1A0A0000000D49484452000000750000001A080600000089A613
|
||||
33000000097048597300000B1300000B1301009A9C1800000A4D694343505068
|
||||
6F746F73686F70204943432070726F66696C65000078DA9D53775893F7163EDF
|
||||
F7650F5642D8F0B1976C81002223AC08C81059A21092006184101240C585880A
|
||||
561415119C4855C482D50A489D88E2A028B867418A885A8B555C38EE1FDCA7B5
|
||||
7D7AEFEDEDFBD7FBBCE79CE7FCCE79CF0F8011122691E6A26A003952853C3AD8
|
||||
1F8F4F48C4C9BD80021548E0042010E6CBC26705C50000F00379787E74B03FFC
|
||||
01AF6F00020070D52E2412C7E1FF83BA50265700209100E02212E70B01905200
|
||||
C82E54C81400C81800B053B3640A009400006C797C422200AA0D00ECF4493E05
|
||||
00D8A993DC1700D8A21CA908008D0100992847240240BB00605581522C02C0C2
|
||||
00A0AC40222E04C0AE018059B632470280BD0500768E58900F4060008099422C
|
||||
CC0020380200431E13CD03204C03A030D2BFE0A95F7085B8480100C0CB95CD97
|
||||
4BD23314B895D01A77F2F0E0E221E2C26CB142611729106609E4229C979B2313
|
||||
48E7034CCE0C00001AF9D1C1FE383F90E7E6E4E1E666E76CEFF4C5A2FE6BF06F
|
||||
223E21F1DFFEBC8C020400104ECFEFDA5FE5E5D60370C701B075BF6BA95B00DA
|
||||
560068DFF95D33DB09A05A0AD07AF98B7938FC401E9EA150C83C1D1C0A0B0BED
|
||||
2562A1BD30E38B3EFF33E16FE08B7EF6FC401EFEDB7AF000719A4099ADC0A383
|
||||
FD71616E76AE528EE7CB0442316EF7E723FEC7857FFD8E29D1E234B15C2C158A
|
||||
F15889B850224DC779B952914421C995E212E97F32F11F96FD0993770D00AC86
|
||||
4FC04EB607B5CB6CC07EEE01028B0E58D27600407EF32D8C1A0B910010673432
|
||||
79F7000093BFF98F402B0100CD97A4E30000BCE8185CA894174CC608000044A0
|
||||
812AB041070CC114ACC00E9CC11DBCC01702610644400C24C03C104206E4801C
|
||||
0AA11896411954C03AD804B5B0031AA0119AE110B4C131380DE7E0125C81EB70
|
||||
170660189EC218BC86090441C8081361213A8811628ED822CE0817998E042261
|
||||
48349280A420E988145122C5C872A402A9426A915D4823F22D7214398D5C40FA
|
||||
90DBC820328AFC8ABC47319481B25103D4027540B9A81F1A8AC6A073D174340F
|
||||
5D8096A26BD11AB41E3D80B6A2A7D14BE87574007D8A8E6380D1310E668CD961
|
||||
5C8C87456089581A26C71663E55835568F35631D583776151BC09E61EF082402
|
||||
8B8013EC085E8410C26C82909047584C5843A825EC23B412BA085709838431C2
|
||||
272293A84FB4257A12F9C478623AB1905846AC26EE211E219E255E270E135F93
|
||||
48240EC992E44E0A21259032490B496B48DB482DA453A43ED210699C4C26EB90
|
||||
6DC9DEE408B280AC209791B7900F904F92FBC9C3E4B7143AC588E24C09A22452
|
||||
A494124A35653FE504A59F324299A0AA51CDA99ED408AA883A9F5A496DA07650
|
||||
2F5387A91334759A25CD9B1643CBA42DA3D5D09A696769F7682FE974BA09DD83
|
||||
1E4597D097D26BE807E9E7E983F4770C0D860D83C7486228196B197B19A718B7
|
||||
192F994CA605D39799C85430D7321B9967980F986F55582AF62A7C1591CA1295
|
||||
3A9556957E95E7AA545573553FD579AA0B54AB550FAB5E567DA64655B350E3A9
|
||||
09D416ABD5A91D55BBA936AECE5277528F50CF515FA3BE5FFD82FA630DB28685
|
||||
46A08648A35463B7C6198D2116C63265F15842D6725603EB2C6B984D625BB2F9
|
||||
EC4C7605FB1B762F7B4C534373AA66AC6691669DE671CD010EC6B1E0F039D99C
|
||||
4ACE21CE0DCE7B2D032D3F2DB1D66AAD66AD7EAD37DA7ADABEDA62ED72ED16ED
|
||||
EBDAEF75709D409D2C9DF53A6D3AF77509BA36BA51BA85BADB75CFEA3ED363EB
|
||||
79E909F5CAF50EE9DDD147F56DF4A3F517EAEFD6EFD11F373034083690196C31
|
||||
3863F0CC9063E86B9869B8D1F084E1A811CB68BA91C468A3D149A327B826EE87
|
||||
67E33578173E66AC6F1C62AC34DE65DC6B3C61626932DBA4C4A4C5E4BE29CD94
|
||||
6B9A66BAD1B4D374CCCCC82CDCACD8ACC9EC8E39D59C6B9E61BED9BCDBFC8D85
|
||||
A5459CC54A8B368BC796DA967CCB05964D96F7AC98563E567956F556D7AC49D6
|
||||
5CEB2CEB6DD6576C501B579B0C9B3A9BCBB6A8AD9BADC4769B6DDF14E2148F29
|
||||
D229F5536EDA31ECFCEC0AEC9AEC06ED39F661F625F66DF6CF1DCC1C121DD63B
|
||||
743B7C727475CC766C70BCEBA4E134C3A9C4A9C3E957671B67A1739DF33517A6
|
||||
4B90CB1297769717536DA78AA76E9F7ACB95E51AEEBAD2B5D3F5A39BBB9BDCAD
|
||||
D96DD4DDCC3DC57DABFB4D2E9B1BC95DC33DEF41F4F0F758E271CCE39DA79BA7
|
||||
C2F390E72F5E765E595EFBBD1E4FB39C269ED6306DC8DBC45BE0BDCB7B603A3E
|
||||
3D65FACEE9033EC63E029F7A9F87BEA6BE22DF3DBE237ED67E997E07FC9EFB3B
|
||||
FACBFD8FF8BFE179F216F14E056001C101E501BD811A81B3036B031F049904A5
|
||||
0735058D05BB062F0C3E15420C090D591F72936FC017F21BF96333DC672C9AD1
|
||||
15CA089D155A1BFA30CC264C1ED6118E86CF08DF107E6FA6F94CE9CCB60888E0
|
||||
476C88B81F69199917F97D14292A32AA2EEA51B453747174F72CD6ACE459FB67
|
||||
BD8EF18FA98CB93BDB6AB6727667AC6A6C526C63EC9BB880B8AAB8817887F845
|
||||
F1971274132409ED89E4C4D8C43D89E37302E76C9A339CE49A54967463AEE5DC
|
||||
A2B917E6E9CECB9E773C593559907C3885981297B23FE5832042502F184FE5A7
|
||||
6E4D1D13F2849B854F45BEA28DA251B1B7B84A3C92E69D5695F638DD3B7D43FA
|
||||
68864F4675C633094F522B79911992B923F34D5644D6DEACCFD971D92D39949C
|
||||
949CA3520D6996B42BD730B728B74F662B2B930DE479E66DCA1B9387CAF7E423
|
||||
F973F3DB156C854CD1A3B452AE500E164C2FA82B785B185B78B848BD485AD433
|
||||
DF66FEEAF9230B82167CBD90B050B8B0B3D8B87859F1E022BF45BB16238B5317
|
||||
772E315D52BA647869F0D27DCB68CBB296FD50E2585255F26A79DCF28E5283D2
|
||||
A5A5432B82573495A994C9CB6EAEF45AB9631561956455EF6A97D55B567F2A17
|
||||
955FAC70ACA8AEF8B046B8E6E2574E5FD57CF5796DDADADE4AB7CAEDEB48EBA4
|
||||
EB6EACF759BFAF4ABD6A41D5D086F00DAD1BF18DE51B5F6D4ADE74A17A6AF58E
|
||||
CDB4CDCACD03356135ED5BCCB6ACDBF2A136A3F67A9D7F5DCB56FDADABB7BED9
|
||||
26DAD6BFDD777BF30E831D153BDEEF94ECBCB52B78576BBD457DF56ED2EE82DD
|
||||
8F1A621BBABFE67EDDB847774FC59E8F7BA57B07F645EFEB6A746F6CDCAFBFBF
|
||||
B2096D52368D1E483A70E59B806FDA9BED9A77B5705A2A0EC241E5C127DFA67C
|
||||
7BE350E8A1CEC3DCC3CDDF997FB7F508EB48792BD23ABF75AC2DA36DA03DA1BD
|
||||
EFE88CA39D1D5E1D47BEB7FF7EEF31E36375C7358F579EA09D283DF1F9E48293
|
||||
E3A764A79E9D4E3F3DD499DC79F74CFC996B5D515DBD6743CF9E3F1774EE4CB7
|
||||
5FF7C9F3DEE78F5DF0BC70F422F762DB25B74BAD3DAE3D477E70FDE148AF5B6F
|
||||
EB65F7CBED573CAE74F44DEB3BD1EFD37FFA6AC0D573D7F8D72E5D9F79BDEFC6
|
||||
EC1BB76E26DD1CB825BAF5F876F6ED17770AEE4CDC5D7A8F78AFFCBEDAFDEA07
|
||||
FA0FEA7FB4FEB165C06DE0F860C060CFC3590FEF0E09879EFE94FFD387E1D247
|
||||
CC47D52346238D8F9D1F1F1B0D1ABDF264CE93E1A7B2A713CFCA7E56FF79EB73
|
||||
ABE7DFFDE2FB4BCF58FCD8F00BF98BCFBFAE79A9F372EFABA9AF3AC723C71FBC
|
||||
CE793DF1A6FCADCEDB7DEFB8EFBADFC7BD1F9928FC40FE50F3D1FA63C7A7D04F
|
||||
F73EE77CFEFC2FF784F3FB25D29F33000004964944415478DAED9A5F4C144718
|
||||
C0BFBBDB8303EF3891F2C71339B1B641E8210891464B8D31312510904A09AD0F
|
||||
DA36E9030F267DF2C5475F4C4C34C698D8342D264A1AFEA835D25209518AC490
|
||||
801A0C29B1ADF45A4BEF304AE13882DC72F87DEB2EA1158FBDDB99E52EB949BE
|
||||
ECECCCC2FE32BFDD99DB99312C2C2C806B5B31AC56BA7F772054B51143C048C0
|
||||
B0C847412ED72B0531448C398C59F928CA7551C96620A9F3F3F3663C49C6B0CB
|
||||
47B38E604A0A60CC604CCAC780DC50A9180E8CCD181918369DF988C387318EF1
|
||||
08630C6342AEB362ACC3C89239AD32B35E89244ECB3C1E8C6774AE48B57F5051
|
||||
F995C7EBADD71168D9949599D9D2F963C717F0522E35D25BFB6B0F5CFFC3ED76
|
||||
AC36DB26A773ECEA95F62ACCFEAAE0D61EF8E8D4E8E868D56AB3E5E6E65EBFD2
|
||||
DEFA25663D8AD49CA2EDA5EE9CCD79ABCD067F3E1AA12ED949598C373076235B
|
||||
5B14B1D561B6472ECA43B6DE048B1504410093C90406A3110C06037716F2B610
|
||||
0C923B104511E666A789AD1CAB4614A904F74B1435DC56828397DD6E0DB29D8B
|
||||
22B646CC7E2F179520DBB564EB5A10CC66146B06A38E52832855140320060230
|
||||
33FD2FB15563D5A022D58570435A1A2EAFA0184ACACAE1D2376758345C21661F
|
||||
60E4603420DB8928623B8AD9EFE4A25DC8D66CB3A7813921517A5B8DF4B68621
|
||||
35DF55023B76EE81A6F327C36291A4CA6F6960EE39F8269F12DB2758D517ED52
|
||||
37611C44B6E351C4760CB397E4221A1A9A5252D32181A4E2DB6A32A1D830A4E6
|
||||
BD530CA5EFEE868B5F9F0E8B25287913A5B7740EA54E4D3C21B6C358D5C3446A
|
||||
D97B7B2131D1021B9D6FC2ED9B9D909A960EF707FAB4341C33A91CD85E916A5F
|
||||
97B1285540A934AEF266A3F1545C2275F2D9381BA945A5BBA0A0B044CAFBA626
|
||||
C196628771CFDF9091B541BA695FCF0D708F3E8CA4E1344BE5C8A6592A0B362E
|
||||
52E929DBF2768104D5DD79199FB62D8B5D5C7AA603CAF7544052F21A18ECEF85
|
||||
91E17BBA4AE5CCA6492A2B36E652E9E6FB2AEBA4A7ABEB8776A96CB971ABBAEE
|
||||
90F4145E6DF916FCD33E5DA4EAC016B154966CCCA5D24DAD561B34379D5D2C5B
|
||||
0E6E0D5EB3BFFE53F8CBFD3BFCDCDDA18B541DD82296CA928DB9D4839F1D81DF
|
||||
1E0E43FFEDEE9070942A6A3E06AB2D055A2F9ED745AA0E6C114B65C9C645EA72
|
||||
7D3E01FEBF4CF951A0F673828554CE6C9AA4B262E322F546471B3CF18EAD786D
|
||||
B8DF882CA47266D32495151B17A9C34383AABEA9DEDF5B09D91B73FF338EA868
|
||||
384D5239B36992CA8A8DB9D40F1B3E97A6A7AEB55D58F1DA86438D30E3F7ABBA
|
||||
7649C3452C5507B688A5B264632E55E9EF57FA96A2A78D664BD476394B1A2E62
|
||||
A93AB0452C95251B97C907E55BEA75DD8902B6F49B2C8C86D334F9C0994DD3E4
|
||||
032B366ED3840A20FD53EF3F8F11640C32B21CE0C8764A13DBE1361A2BA99CD9
|
||||
344FE8D7D41F46B6B58B6C1499EBB3C1B101D904413AEFC2B73454E23AA14FBF
|
||||
D2F25DDBC16249929E50BA118D05777ABB54776B21A46A5A7AE3C4C664E98D96
|
||||
DC5C453B2011D9680D761EC75ABFDF077DB77E02AFE7F18A7FAF66E92DBE48AE
|
||||
9E2D6616C9E3DB59D4B3C5CC7696F8C6331529D6369EC5B78886E68ABD2DA2F1
|
||||
CDDC2153CC6DE67E015E45E7AEE26F6CCA0000000049454E44AE426082}
|
||||
ShowHint = True
|
||||
Visible = False
|
||||
OnClick = PowerClick
|
||||
end
|
||||
object m_btnCancel: TTextButton
|
||||
Left = 323
|
||||
Top = 196
|
||||
Width = 56
|
||||
Height = 25
|
||||
ModalResult = mrCancel
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
Text = #21462#28040
|
||||
end
|
||||
object m_btnOk: TTextButton
|
||||
Left = 258
|
||||
Top = 196
|
||||
Width = 56
|
||||
Height = 25
|
||||
ModalResult = mrOk
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
OnClick = OkClick
|
||||
Text = #24212#29992
|
||||
end
|
||||
object m_lblPreset: TLabel
|
||||
Left = 33
|
||||
Top = 41
|
||||
Width = 24
|
||||
Height = 14
|
||||
Caption = #39044#35774
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 12429980
|
||||
Font.Height = -12
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
end
|
||||
object m_cbPreset: TComboBoxComponent
|
||||
Left = 71
|
||||
Top = 38
|
||||
Width = 98
|
||||
Height = 20
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
OnChange = PresetChange
|
||||
ShowItemCount = 5
|
||||
Parent = m_BKGPanel
|
||||
end
|
||||
object m_btnStop: TPNGButton
|
||||
Left = 23
|
||||
Top = 194
|
||||
Width = 39
|
||||
Height = 26
|
||||
Hint = #20572#27490
|
||||
ParentCustomHint = False
|
||||
ParentShowHint = False
|
||||
PngImg.Data = {
|
||||
89504E470D0A1A0A0000000D494844520000009C0000001A0806000000425135
|
||||
88000000097048597300000B1300000B1301009A9C1800000A4D694343505068
|
||||
6F746F73686F70204943432070726F66696C65000078DA9D53775893F7163EDF
|
||||
F7650F5642D8F0B1976C81002223AC08C81059A21092006184101240C585880A
|
||||
561415119C4855C482D50A489D88E2A028B867418A885A8B555C38EE1FDCA7B5
|
||||
7D7AEFEDEDFBD7FBBCE79CE7FCCE79CF0F8011122691E6A26A003952853C3AD8
|
||||
1F8F4F48C4C9BD80021548E0042010E6CBC26705C50000F00379787E74B03FFC
|
||||
01AF6F00020070D52E2412C7E1FF83BA50265700209100E02212E70B01905200
|
||||
C82E54C81400C81800B053B3640A009400006C797C422200AA0D00ECF4493E05
|
||||
00D8A993DC1700D8A21CA908008D0100992847240240BB00605581522C02C0C2
|
||||
00A0AC40222E04C0AE018059B632470280BD0500768E58900F4060008099422C
|
||||
CC0020380200431E13CD03204C03A030D2BFE0A95F7085B8480100C0CB95CD97
|
||||
4BD23314B895D01A77F2F0E0E221E2C26CB142611729106609E4229C979B2313
|
||||
48E7034CCE0C00001AF9D1C1FE383F90E7E6E4E1E666E76CEFF4C5A2FE6BF06F
|
||||
223E21F1DFFEBC8C020400104ECFEFDA5FE5E5D60370C701B075BF6BA95B00DA
|
||||
560068DFF95D33DB09A05A0AD07AF98B7938FC401E9EA150C83C1D1C0A0B0BED
|
||||
2562A1BD30E38B3EFF33E16FE08B7EF6FC401EFEDB7AF000719A4099ADC0A383
|
||||
FD71616E76AE528EE7CB0442316EF7E723FEC7857FFD8E29D1E234B15C2C158A
|
||||
F15889B850224DC779B952914421C995E212E97F32F11F96FD0993770D00AC86
|
||||
4FC04EB607B5CB6CC07EEE01028B0E58D27600407EF32D8C1A0B910010673432
|
||||
79F7000093BFF98F402B0100CD97A4E30000BCE8185CA894174CC608000044A0
|
||||
812AB041070CC114ACC00E9CC11DBCC01702610644400C24C03C104206E4801C
|
||||
0AA11896411954C03AD804B5B0031AA0119AE110B4C131380DE7E0125C81EB70
|
||||
170660189EC218BC86090441C8081361213A8811628ED822CE0817998E042261
|
||||
48349280A420E988145122C5C872A402A9426A915D4823F22D7214398D5C40FA
|
||||
90DBC820328AFC8ABC47319481B25103D4027540B9A81F1A8AC6A073D174340F
|
||||
5D8096A26BD11AB41E3D80B6A2A7D14BE87574007D8A8E6380D1310E668CD961
|
||||
5C8C87456089581A26C71663E55835568F35631D583776151BC09E61EF082402
|
||||
8B8013EC085E8410C26C82909047584C5843A825EC23B412BA085709838431C2
|
||||
272293A84FB4257A12F9C478623AB1905846AC26EE211E219E255E270E135F93
|
||||
48240EC992E44E0A21259032490B496B48DB482DA453A43ED210699C4C26EB90
|
||||
6DC9DEE408B280AC209791B7900F904F92FBC9C3E4B7143AC588E24C09A22452
|
||||
A494124A35653FE504A59F324299A0AA51CDA99ED408AA883A9F5A496DA07650
|
||||
2F5387A91334759A25CD9B1643CBA42DA3D5D09A696769F7682FE974BA09DD83
|
||||
1E4597D097D26BE807E9E7E983F4770C0D860D83C7486228196B197B19A718B7
|
||||
192F994CA605D39799C85430D7321B9967980F986F55582AF62A7C1591CA1295
|
||||
3A9556957E95E7AA545573553FD579AA0B54AB550FAB5E567DA64655B350E3A9
|
||||
09D416ABD5A91D55BBA936AECE5277528F50CF515FA3BE5FFD82FA630DB28685
|
||||
46A08648A35463B7C6198D2116C63265F15842D6725603EB2C6B984D625BB2F9
|
||||
EC4C7605FB1B762F7B4C534373AA66AC6691669DE671CD010EC6B1E0F039D99C
|
||||
4ACE21CE0DCE7B2D032D3F2DB1D66AAD66AD7EAD37DA7ADABEDA62ED72ED16ED
|
||||
EBDAEF75709D409D2C9DF53A6D3AF77509BA36BA51BA85BADB75CFEA3ED363EB
|
||||
79E909F5CAF50EE9DDD147F56DF4A3F517EAEFD6EFD11F373034083690196C31
|
||||
3863F0CC9063E86B9869B8D1F084E1A811CB68BA91C468A3D149A327B826EE87
|
||||
67E33578173E66AC6F1C62AC34DE65DC6B3C61626932DBA4C4A4C5E4BE29CD94
|
||||
6B9A66BAD1B4D374CCCCC82CDCACD8ACC9EC8E39D59C6B9E61BED9BCDBFC8D85
|
||||
A5459CC54A8B368BC796DA967CCB05964D96F7AC98563E567956F556D7AC49D6
|
||||
5CEB2CEB6DD6576C501B579B0C9B3A9BCBB6A8AD9BADC4769B6DDF14E2148F29
|
||||
D229F5536EDA31ECFCEC0AEC9AEC06ED39F661F625F66DF6CF1DCC1C121DD63B
|
||||
743B7C727475CC766C70BCEBA4E134C3A9C4A9C3E957671B67A1739DF33517A6
|
||||
4B90CB1297769717536DA78AA76E9F7ACB95E51AEEBAD2B5D3F5A39BBB9BDCAD
|
||||
D96DD4DDCC3DC57DABFB4D2E9B1BC95DC33DEF41F4F0F758E271CCE39DA79BA7
|
||||
C2F390E72F5E765E595EFBBD1E4FB39C269ED6306DC8DBC45BE0BDCB7B603A3E
|
||||
3D65FACEE9033EC63E029F7A9F87BEA6BE22DF3DBE237ED67E997E07FC9EFB3B
|
||||
FACBFD8FF8BFE179F216F14E056001C101E501BD811A81B3036B031F049904A5
|
||||
0735058D05BB062F0C3E15420C090D591F72936FC017F21BF96333DC672C9AD1
|
||||
15CA089D155A1BFA30CC264C1ED6118E86CF08DF107E6FA6F94CE9CCB60888E0
|
||||
476C88B81F69199917F97D14292A32AA2EEA51B453747174F72CD6ACE459FB67
|
||||
BD8EF18FA98CB93BDB6AB6727667AC6A6C526C63EC9BB880B8AAB8817887F845
|
||||
F1971274132409ED89E4C4D8C43D89E37302E76C9A339CE49A54967463AEE5DC
|
||||
A2B917E6E9CECB9E773C593559907C3885981297B23FE5832042502F184FE5A7
|
||||
6E4D1D13F2849B854F45BEA28DA251B1B7B84A3C92E69D5695F638DD3B7D43FA
|
||||
68864F4675C633094F522B79911992B923F34D5644D6DEACCFD971D92D39949C
|
||||
949CA3520D6996B42BD730B728B74F662B2B930DE479E66DCA1B9387CAF7E423
|
||||
F973F3DB156C854CD1A3B452AE500E164C2FA82B785B185B78B848BD485AD433
|
||||
DF66FEEAF9230B82167CBD90B050B8B0B3D8B87859F1E022BF45BB16238B5317
|
||||
772E315D52BA647869F0D27DCB68CBB296FD50E2585255F26A79DCF28E5283D2
|
||||
A5A5432B82573495A994C9CB6EAEF45AB9631561956455EF6A97D55B567F2A17
|
||||
955FAC70ACA8AEF8B046B8E6E2574E5FD57CF5796DDADADE4AB7CAEDEB48EBA4
|
||||
EB6EACF759BFAF4ABD6A41D5D086F00DAD1BF18DE51B5F6D4ADE74A17A6AF58E
|
||||
CDB4CDCACD03356135ED5BCCB6ACDBF2A136A3F67A9D7F5DCB56FDADABB7BED9
|
||||
26DAD6BFDD777BF30E831D153BDEEF94ECBCB52B78576BBD457DF56ED2EE82DD
|
||||
8F1A621BBABFE67EDDB847774FC59E8F7BA57B07F645EFEB6A746F6CDCAFBFBF
|
||||
B2096D52368D1E483A70E59B806FDA9BED9A77B5705A2A0EC241E5C127DFA67C
|
||||
7BE350E8A1CEC3DCC3CDDF997FB7F508EB48792BD23ABF75AC2DA36DA03DA1BD
|
||||
EFE88CA39D1D5E1D47BEB7FF7EEF31E36375C7358F579EA09D283DF1F9E48293
|
||||
E3A764A79E9D4E3F3DD499DC79F74CFC996B5D515DBD6743CF9E3F1774EE4CB7
|
||||
5FF7C9F3DEE78F5DF0BC70F422F762DB25B74BAD3DAE3D477E70FDE148AF5B6F
|
||||
EB65F7CBED573CAE74F44DEB3BD1EFD37FFA6AC0D573D7F8D72E5D9F79BDEFC6
|
||||
EC1BB76E26DD1CB825BAF5F876F6ED17770AEE4CDC5D7A8F78AFFCBEDAFDEA07
|
||||
FA0FEA7FB4FEB165C06DE0F860C060CFC3590FEF0E09879EFE94FFD387E1D247
|
||||
CC47D52346238D8F9D1F1F1B0D1ABDF264CE93E1A7B2A713CFCA7E56FF79EB73
|
||||
ABE7DFFDE2FB4BCF58FCD8F00BF98BCFBFAE79A9F372EFABA9AF3AC723C71FBC
|
||||
CE793DF1A6FCADCEDB7DEFB8EFBADFC7BD1F9928FC40FE50F3D1FA63C7A7D04F
|
||||
F73EE77CFEFC2FF784F3FB25D29F33000004C64944415478DAED9B7D6893471C
|
||||
C72FC9F3A45D4C8DD1698B4263EBCB3A5DDD6C1D28DABD20B88DD6971237CAFA
|
||||
C7A6C806F32F19634C6463228E21E25F1514D9F48F8EB22DA8D3B229145FAA28
|
||||
D85659F7D26DAE35424B5B37B3D898B5C99374DF4B2F9BCEDAE4FA3C777984E7
|
||||
073FEE9EE71EC827779FDC13B83BDBE8E828297F7A29C9555CEB689BA8D98E54
|
||||
904E643E2B15765F5624911A32861C66A5C6DA4CC9F64CC5B2A44486FB62A2F1
|
||||
74381CC446854B24122AAE5D480F2BD51CB0C69151649895F49A0EA217391B59
|
||||
8A9C852C90CC4739869083C86E641F32C4DADCC8E9C822C6E966CCB2820A1661
|
||||
3CFDC8DBF41AC2C530F02AE3A15C5324F7D9BD7D7797F145205C3C2D9CE7E557
|
||||
AA0FF60F0CBC9603A8FBA2A8B0F0CBEFBE6D7E8B8C89473B6CC1865AFFC91BC1
|
||||
E0EC5CB3CDF5F9FA8E1D0DD4A0FA5B1AB7D6FFEABE9E9E9E9A5CB39594949C3C
|
||||
1AF86A1BAAFD102E02E1BC18D32318D3B5B966C3989EC098BE01E14269E18A01
|
||||
192C2E2DCB351BB9D9DD45A7651FAD221F473E0FB6AF4DC4B611D573EC5619D8
|
||||
5A9DF96EA228CAD82BC36E27369B4D380B1DB7D164928E1DD1348DC4862394AD
|
||||
0A4D5D60FA03F55294BF2F5FF562AEBB8D5CBE7086B2CD43FF74A785A31DF7B3
|
||||
8906F549DA7164EC55BA1E6CFB4DC4F60EAAC7D9AD4AB07DE3724F238AAA423A
|
||||
95D8250A9784709A16275A3C4EA291BF28DB3A34B583A90FF57294DF9B48B825
|
||||
10AE332D5C0ACE4483BA04D54E6431B20E6C9F9A88ED7D549BD8AD9560FBA2C0
|
||||
3383A8CEBCD42C67A7B39C2CE1D8EC168F8D90A1F09F94ED75345D04D34DD42B
|
||||
50B69B48B84A08D73129E112F8922323C3A95F5736417FF97979F9C4A128199F
|
||||
FD9F707391F560DB6522B61DA836B25BF4757F78AA77267152E130CB391C90EE
|
||||
21C2FDC7A665FCAC3136E5A16CC9D4B869A9D92D06E1EE846E51B637D1740E4C
|
||||
3778854BD2D7722C46B44496FDE650F19D9DC49E45BFE9162E7A3742AADE6EC8
|
||||
EAD974B41ED84A5C53DC199FD32B9C04B60784F34C9FF5AF700A84A3FFE344B3
|
||||
D1FF6FDA3DC2856F0FEA126E381A25CBEA3EE4626B6BDA49F25DAE8CCFE916EE
|
||||
4E38449EE3ECB8F3E8B8A91E6FC6E7F40A27816DD2C219C966B47091A13079B6
|
||||
EE232EB62B4D1F13778127E3738608B762F33E2EB84B9F6D93269C60365DC219
|
||||
C52642B8A5FEED5C6C5703BBE5095759FF09175C7BE307D28413CCA64B38A3D8
|
||||
4408F7D4DA77B9D87E38B1579E70E57EBEF77D6760A734E104B3E912CE283611
|
||||
C23DB1662B17DB2FA71BE409B7B0FA3D2EB85F9BF748134E309B2EE18C621321
|
||||
5CC90B5BB8D87ACE1E92279C6F35DFAF21D8D2204D38C16CBA84338A4D847073
|
||||
56D473B1F55E6A94275CD1CA4D5C70FD173F97269C60365DC219C52642B89915
|
||||
7E2EB65B1D0179C2792BEAB8E0421D4DD28413CCA64B38A3D84408E75954CDC5
|
||||
16FEA9599E70AEC5EBB9E0A23F1E97269C60365DC219C52642B8C7E6AFE662FB
|
||||
FB7A8B3CE1D4F92F71C1C5AF9F92269C60365DC219C5264238D557C5C7166C95
|
||||
231C5DA2D1E6ACE282537A2F485BDA12CCA66B69CB2836114B5B5A61251FDB40
|
||||
BB9CA52D6BF1DE5ABC97BA782F32ACED49D9C5A3BE3DC9DA80993D9BB5019333
|
||||
C6DB80696D31CF9ECDDA62CE19E36D31B70ED16411D6219AC9C5788768AC6382
|
||||
137359C70427DF770F1E13B40E424F18D641688EC87410FA1FF0936827C0A298
|
||||
CF0000000049454E44AE426082}
|
||||
ShowHint = True
|
||||
Visible = False
|
||||
OnClick = StopClick
|
||||
end
|
||||
object m_btnPlay: TPNGButton
|
||||
Left = 24
|
||||
Top = 195
|
||||
Width = 39
|
||||
Height = 26
|
||||
Hint = #25773#25918
|
||||
ParentCustomHint = False
|
||||
ParentShowHint = False
|
||||
PngImg.Data = {
|
||||
89504E470D0A1A0A0000000D494844520000009C0000001A0806000000425135
|
||||
88000000097048597300000B1300000B1301009A9C1800000A4D694343505068
|
||||
6F746F73686F70204943432070726F66696C65000078DA9D53775893F7163EDF
|
||||
F7650F5642D8F0B1976C81002223AC08C81059A21092006184101240C585880A
|
||||
561415119C4855C482D50A489D88E2A028B867418A885A8B555C38EE1FDCA7B5
|
||||
7D7AEFEDEDFBD7FBBCE79CE7FCCE79CF0F8011122691E6A26A003952853C3AD8
|
||||
1F8F4F48C4C9BD80021548E0042010E6CBC26705C50000F00379787E74B03FFC
|
||||
01AF6F00020070D52E2412C7E1FF83BA50265700209100E02212E70B01905200
|
||||
C82E54C81400C81800B053B3640A009400006C797C422200AA0D00ECF4493E05
|
||||
00D8A993DC1700D8A21CA908008D0100992847240240BB00605581522C02C0C2
|
||||
00A0AC40222E04C0AE018059B632470280BD0500768E58900F4060008099422C
|
||||
CC0020380200431E13CD03204C03A030D2BFE0A95F7085B8480100C0CB95CD97
|
||||
4BD23314B895D01A77F2F0E0E221E2C26CB142611729106609E4229C979B2313
|
||||
48E7034CCE0C00001AF9D1C1FE383F90E7E6E4E1E666E76CEFF4C5A2FE6BF06F
|
||||
223E21F1DFFEBC8C020400104ECFEFDA5FE5E5D60370C701B075BF6BA95B00DA
|
||||
560068DFF95D33DB09A05A0AD07AF98B7938FC401E9EA150C83C1D1C0A0B0BED
|
||||
2562A1BD30E38B3EFF33E16FE08B7EF6FC401EFEDB7AF000719A4099ADC0A383
|
||||
FD71616E76AE528EE7CB0442316EF7E723FEC7857FFD8E29D1E234B15C2C158A
|
||||
F15889B850224DC779B952914421C995E212E97F32F11F96FD0993770D00AC86
|
||||
4FC04EB607B5CB6CC07EEE01028B0E58D27600407EF32D8C1A0B910010673432
|
||||
79F7000093BFF98F402B0100CD97A4E30000BCE8185CA894174CC608000044A0
|
||||
812AB041070CC114ACC00E9CC11DBCC01702610644400C24C03C104206E4801C
|
||||
0AA11896411954C03AD804B5B0031AA0119AE110B4C131380DE7E0125C81EB70
|
||||
170660189EC218BC86090441C8081361213A8811628ED822CE0817998E042261
|
||||
48349280A420E988145122C5C872A402A9426A915D4823F22D7214398D5C40FA
|
||||
90DBC820328AFC8ABC47319481B25103D4027540B9A81F1A8AC6A073D174340F
|
||||
5D8096A26BD11AB41E3D80B6A2A7D14BE87574007D8A8E6380D1310E668CD961
|
||||
5C8C87456089581A26C71663E55835568F35631D583776151BC09E61EF082402
|
||||
8B8013EC085E8410C26C82909047584C5843A825EC23B412BA085709838431C2
|
||||
272293A84FB4257A12F9C478623AB1905846AC26EE211E219E255E270E135F93
|
||||
48240EC992E44E0A21259032490B496B48DB482DA453A43ED210699C4C26EB90
|
||||
6DC9DEE408B280AC209791B7900F904F92FBC9C3E4B7143AC588E24C09A22452
|
||||
A494124A35653FE504A59F324299A0AA51CDA99ED408AA883A9F5A496DA07650
|
||||
2F5387A91334759A25CD9B1643CBA42DA3D5D09A696769F7682FE974BA09DD83
|
||||
1E4597D097D26BE807E9E7E983F4770C0D860D83C7486228196B197B19A718B7
|
||||
192F994CA605D39799C85430D7321B9967980F986F55582AF62A7C1591CA1295
|
||||
3A9556957E95E7AA545573553FD579AA0B54AB550FAB5E567DA64655B350E3A9
|
||||
09D416ABD5A91D55BBA936AECE5277528F50CF515FA3BE5FFD82FA630DB28685
|
||||
46A08648A35463B7C6198D2116C63265F15842D6725603EB2C6B984D625BB2F9
|
||||
EC4C7605FB1B762F7B4C534373AA66AC6691669DE671CD010EC6B1E0F039D99C
|
||||
4ACE21CE0DCE7B2D032D3F2DB1D66AAD66AD7EAD37DA7ADABEDA62ED72ED16ED
|
||||
EBDAEF75709D409D2C9DF53A6D3AF77509BA36BA51BA85BADB75CFEA3ED363EB
|
||||
79E909F5CAF50EE9DDD147F56DF4A3F517EAEFD6EFD11F373034083690196C31
|
||||
3863F0CC9063E86B9869B8D1F084E1A811CB68BA91C468A3D149A327B826EE87
|
||||
67E33578173E66AC6F1C62AC34DE65DC6B3C61626932DBA4C4A4C5E4BE29CD94
|
||||
6B9A66BAD1B4D374CCCCC82CDCACD8ACC9EC8E39D59C6B9E61BED9BCDBFC8D85
|
||||
A5459CC54A8B368BC796DA967CCB05964D96F7AC98563E567956F556D7AC49D6
|
||||
5CEB2CEB6DD6576C501B579B0C9B3A9BCBB6A8AD9BADC4769B6DDF14E2148F29
|
||||
D229F5536EDA31ECFCEC0AEC9AEC06ED39F661F625F66DF6CF1DCC1C121DD63B
|
||||
743B7C727475CC766C70BCEBA4E134C3A9C4A9C3E957671B67A1739DF33517A6
|
||||
4B90CB1297769717536DA78AA76E9F7ACB95E51AEEBAD2B5D3F5A39BBB9BDCAD
|
||||
D96DD4DDCC3DC57DABFB4D2E9B1BC95DC33DEF41F4F0F758E271CCE39DA79BA7
|
||||
C2F390E72F5E765E595EFBBD1E4FB39C269ED6306DC8DBC45BE0BDCB7B603A3E
|
||||
3D65FACEE9033EC63E029F7A9F87BEA6BE22DF3DBE237ED67E997E07FC9EFB3B
|
||||
FACBFD8FF8BFE179F216F14E056001C101E501BD811A81B3036B031F049904A5
|
||||
0735058D05BB062F0C3E15420C090D591F72936FC017F21BF96333DC672C9AD1
|
||||
15CA089D155A1BFA30CC264C1ED6118E86CF08DF107E6FA6F94CE9CCB60888E0
|
||||
476C88B81F69199917F97D14292A32AA2EEA51B453747174F72CD6ACE459FB67
|
||||
BD8EF18FA98CB93BDB6AB6727667AC6A6C526C63EC9BB880B8AAB8817887F845
|
||||
F1971274132409ED89E4C4D8C43D89E37302E76C9A339CE49A54967463AEE5DC
|
||||
A2B917E6E9CECB9E773C593559907C3885981297B23FE5832042502F184FE5A7
|
||||
6E4D1D13F2849B854F45BEA28DA251B1B7B84A3C92E69D5695F638DD3B7D43FA
|
||||
68864F4675C633094F522B79911992B923F34D5644D6DEACCFD971D92D39949C
|
||||
949CA3520D6996B42BD730B728B74F662B2B930DE479E66DCA1B9387CAF7E423
|
||||
F973F3DB156C854CD1A3B452AE500E164C2FA82B785B185B78B848BD485AD433
|
||||
DF66FEEAF9230B82167CBD90B050B8B0B3D8B87859F1E022BF45BB16238B5317
|
||||
772E315D52BA647869F0D27DCB68CBB296FD50E2585255F26A79DCF28E5283D2
|
||||
A5A5432B82573495A994C9CB6EAEF45AB9631561956455EF6A97D55B567F2A17
|
||||
955FAC70ACA8AEF8B046B8E6E2574E5FD57CF5796DDADADE4AB7CAEDEB48EBA4
|
||||
EB6EACF759BFAF4ABD6A41D5D086F00DAD1BF18DE51B5F6D4ADE74A17A6AF58E
|
||||
CDB4CDCACD03356135ED5BCCB6ACDBF2A136A3F67A9D7F5DCB56FDADABB7BED9
|
||||
26DAD6BFDD777BF30E831D153BDEEF94ECBCB52B78576BBD457DF56ED2EE82DD
|
||||
8F1A621BBABFE67EDDB847774FC59E8F7BA57B07F645EFEB6A746F6CDCAFBFBF
|
||||
B2096D52368D1E483A70E59B806FDA9BED9A77B5705A2A0EC241E5C127DFA67C
|
||||
7BE350E8A1CEC3DCC3CDDF997FB7F508EB48792BD23ABF75AC2DA36DA03DA1BD
|
||||
EFE88CA39D1D5E1D47BEB7FF7EEF31E36375C7358F579EA09D283DF1F9E48293
|
||||
E3A764A79E9D4E3F3DD499DC79F74CFC996B5D515DBD6743CF9E3F1774EE4CB7
|
||||
5FF7C9F3DEE78F5DF0BC70F422F762DB25B74BAD3DAE3D477E70FDE148AF5B6F
|
||||
EB65F7CBED573CAE74F44DEB3BD1EFD37FFA6AC0D573D7F8D72E5D9F79BDEFC6
|
||||
EC1BB76E26DD1CB825BAF5F876F6ED17770AEE4CDC5D7A8F78AFFCBEDAFDEA07
|
||||
FA0FEA7FB4FEB165C06DE0F860C060CFC3590FEF0E09879EFE94FFD387E1D247
|
||||
CC47D52346238D8F9D1F1F1B0D1ABDF264CE93E1A7B2A713CFCA7E56FF79EB73
|
||||
ABE7DFFDE2FB4BCF58FCD8F00BF98BCFBFAE79A9F372EFABA9AF3AC723C71FBC
|
||||
CE793DF1A6FCADCEDB7DEFB8EFBADFC7BD1F9928FC40FE50F3D1FA63C7A7D04F
|
||||
F73EE77CFEFC2FF784F3FB25D29F33000006DB4944415478DAED9B5B6C145518
|
||||
C7FF33B3B33BBB5DD8DEA08514684B34F000229840A284105E105120808A2682
|
||||
D110F4498C898A3E9878892646DF34F1816022C4A080968A260A4DA3D2126805
|
||||
6AA55269BB157ABFEF76BBF7F53BB3B3A49576BBBB7366B60FFB255FE6ECCCB6
|
||||
FBDB737E73CE999D33422C16C3AA071E44B6E26AE3956487454A0BA59552D1B6
|
||||
166DBF5911A50C530629FDDA36AC1D9B936C6BD63E143591614A246B4F499220
|
||||
30E12291884CAF1D942E6D2B67813544E9A31CD5B6EC356BC402CAC59495940B
|
||||
29E799CCC7383C947D946D945D94C3DA3127652165A9C6E9D498CD0A269857E3
|
||||
E9A11C62AF49B82035BCACF130AE3C93EB6C72DD8D6B7C5E122E9410CEB5F5D1
|
||||
C7BEE8E9ED7D320B5053A2B4A4E4E44F3FFE701071F15885DDB773D7EEEA0EB7
|
||||
7B71B6D9CA972DEBFAEECCA9ED546C4DE0EEDABDF7D3F6F6F6EDD966ABA8A8A8
|
||||
3E73EA9BC354EC21E1BC245C01B5E997D4A68F679B8DDAF42CB5E97E126E3821
|
||||
DC5282742FAD5C916D3674B6B5B06E79192B5216536E22B66FE710DB1E2AD66A
|
||||
BB5610DBAF56C5098BC5121F324411822018CEC2DA2D168DB2B643381C46D0EF
|
||||
656C1BE9500B310D50B992B6B7363CB239DBD586FADF6A18DB72AA9FB68470AC
|
||||
E26ECCA1465DC92A0EF1A17407B17D3687D85EA6E2F7DAAE75C456E570E6C322
|
||||
CB249D0CD144E1A2245C381C42381482CF3BC2D89EA0430DC4D445E555B4BD3E
|
||||
87845B4DC235258453E1526DD4283BAB2261AA5C297E5673AC60AD515753B189
|
||||
7229E5D3C4F6D11C627B9D8A5F6BBB1E26B613F35C4590AD36B59713937C6634
|
||||
1A41241C517B41BD6CAA705AEF160A06E0191D646CCFD0A1DF89A993CA6B69DB
|
||||
90AA7031F6BF884F14E26CE0586F9A70EBE8FF3666249C7FC287C2375E40DFB1
|
||||
D390BA8760B52971480EF13FE1CA299F25B6F7E610DBDB543CAEED62C3FDB1F9
|
||||
050B6065C2512F274924DD0C8DE59F9840D19117D177F414C49E21F56F32658B
|
||||
AAED16567BB720093736DCCFD80ED0A15A62EA4857B8A07F02AE837B3078FA67
|
||||
48FD23EA092472AA37DDC2793D63283BFE2124A7030355E7E1397E0EB6884090
|
||||
567548D1137A853381ED1EE15C850BEF0A6721E184193E87271B9BBF85270937
|
||||
3AD4A74B38DFB817A51FBF06C9A160F8421DBC55B5B046898DBE93A0B3DE740B
|
||||
E7191B41C9D177D58A6311F1FA3078A21AE10B97A1508FC2E632990E177A8533
|
||||
812D63E178B2F1166EDC3B86E20F5E81E850D4D7519F1F23D53508D735C1A64D
|
||||
17321D66B908E7FAFC08A43CC794FD0177173C5F9D85A5B50B8A6287C420336B
|
||||
545DC219CCA64B385E6C460837EF9D436A0F37398277FA305E5503A9A30F361B
|
||||
0DB319D41B17E1EC9F1C8698679FF6F84443338227CFC33E1E54E750E90C173C
|
||||
8433984D9770BCD88C104E79F30044BB32ED717F732B42E7EAA04C84D4F95D3A
|
||||
C32C17E184F70F51F76B9FF13D31BA1A0BFC520FF1FC1538249B3A4F4965B8E0
|
||||
219CC16CBA84E3C5668470C2E17D1015DBCC6C91288217AF42ACFB138A6455E7
|
||||
77A90CB35C840BBCF51C048732EB7BA3A35EC4CE5D84F3C66D2876C7AC3D0A0F
|
||||
E10C66D3251C2F3623840B1EDA09C16E9BF5BD318F0FB1DA46386EF5C2A628B3
|
||||
F6765C841B7D756F4A7089B0D4FF85A2BA9BF1C96792E0219CC16CBA84E3C566
|
||||
8470DEE7B782AE105267BB760BF97FB4CF3AE7E4225CEF4BDB0025858A1B1885
|
||||
BDE62A0A7A3CEA84D88C1ECE60365DC2F1623342B8C17D9B52136ED803DBA51B
|
||||
70F58FD38584493D9C7B3F7D1125095C3004FBA51614FFDD03BB4C7311D9BC39
|
||||
9CC16CBA84E3C56684705DBBD683BEC8CC6FA2CF52AEB5A1A07D0036E2922D26
|
||||
CEE15A9FDA80D80C6783ADE55F94347660BE688DFF626DF255AAC16CBA84E3C5
|
||||
668470EE6D6B10B34EBF8AC9DAD68DE2E63BC813E5F84960F6556AD30E82B34D
|
||||
8593FB46B0E8723B8AFC5479ECF7A40C6E8DF010CE60365DC2F1623342B89B5B
|
||||
56927053E76396410F1636DD467E80A4B36576BB8B8B700D5B57DE3D1B245F00
|
||||
0BAE776249BF9FE61B0E751299CD3B0D06B3E9128E179B11C2356F5C8E981C17
|
||||
4EF20751D0D28D45C3019AD629F10B836CDD6960F704EB37572066115148738D
|
||||
8A4E0F9C567BCABF67A5D0A8BAEEA51ACC96F1CD7BC67669CB728DAD1BE5EEB1
|
||||
385B8A73C8C9C1FBE63DBB977A6D7D19629208577B3FCABAC7E19095947F6B4B
|
||||
16FA578BF82770BDD289B27F06512858D3FEC53E59E85D9E64025BC6CB93027E
|
||||
3F9AEF7761F1CD7EE4435625CD948DF7F2A460C08F96250E94BA47902FC869DF
|
||||
4D4816D30997D602CCA8BAD234AC56163BA37986DE059826B065BC0093B13149
|
||||
12EBE1F404EF059889D5C3A228D049C3B7DEA65B80995B629E3A5B6E89799A31
|
||||
DD12F3DC43342944EE219ACC62BA8768728F0926E7CA3D269879DDDDFB9860EE
|
||||
41E8A4917B103A8D98ED41E8FF0013A48036FFAB77F70000000049454E44AE42
|
||||
6082}
|
||||
ShowHint = True
|
||||
OnClick = PlayClick
|
||||
end
|
||||
object m_btnPowerOn: TPNGButton
|
||||
Tag = 1
|
||||
Left = 340
|
||||
Top = 38
|
||||
Width = 39
|
||||
Height = 26
|
||||
Hint = #20851#38381#38899#25928
|
||||
ParentCustomHint = False
|
||||
ImgStates = 3
|
||||
ParentShowHint = False
|
||||
PngImg.Data = {
|
||||
89504E470D0A1A0A0000000D49484452000000750000001A080600000089A613
|
||||
33000000097048597300000B1300000B1301009A9C1800000A4D694343505068
|
||||
6F746F73686F70204943432070726F66696C65000078DA9D53775893F7163EDF
|
||||
F7650F5642D8F0B1976C81002223AC08C81059A21092006184101240C585880A
|
||||
561415119C4855C482D50A489D88E2A028B867418A885A8B555C38EE1FDCA7B5
|
||||
7D7AEFEDEDFBD7FBBCE79CE7FCCE79CF0F8011122691E6A26A003952853C3AD8
|
||||
1F8F4F48C4C9BD80021548E0042010E6CBC26705C50000F00379787E74B03FFC
|
||||
01AF6F00020070D52E2412C7E1FF83BA50265700209100E02212E70B01905200
|
||||
C82E54C81400C81800B053B3640A009400006C797C422200AA0D00ECF4493E05
|
||||
00D8A993DC1700D8A21CA908008D0100992847240240BB00605581522C02C0C2
|
||||
00A0AC40222E04C0AE018059B632470280BD0500768E58900F4060008099422C
|
||||
CC0020380200431E13CD03204C03A030D2BFE0A95F7085B8480100C0CB95CD97
|
||||
4BD23314B895D01A77F2F0E0E221E2C26CB142611729106609E4229C979B2313
|
||||
48E7034CCE0C00001AF9D1C1FE383F90E7E6E4E1E666E76CEFF4C5A2FE6BF06F
|
||||
223E21F1DFFEBC8C020400104ECFEFDA5FE5E5D60370C701B075BF6BA95B00DA
|
||||
560068DFF95D33DB09A05A0AD07AF98B7938FC401E9EA150C83C1D1C0A0B0BED
|
||||
2562A1BD30E38B3EFF33E16FE08B7EF6FC401EFEDB7AF000719A4099ADC0A383
|
||||
FD71616E76AE528EE7CB0442316EF7E723FEC7857FFD8E29D1E234B15C2C158A
|
||||
F15889B850224DC779B952914421C995E212E97F32F11F96FD0993770D00AC86
|
||||
4FC04EB607B5CB6CC07EEE01028B0E58D27600407EF32D8C1A0B910010673432
|
||||
79F7000093BFF98F402B0100CD97A4E30000BCE8185CA894174CC608000044A0
|
||||
812AB041070CC114ACC00E9CC11DBCC01702610644400C24C03C104206E4801C
|
||||
0AA11896411954C03AD804B5B0031AA0119AE110B4C131380DE7E0125C81EB70
|
||||
170660189EC218BC86090441C8081361213A8811628ED822CE0817998E042261
|
||||
48349280A420E988145122C5C872A402A9426A915D4823F22D7214398D5C40FA
|
||||
90DBC820328AFC8ABC47319481B25103D4027540B9A81F1A8AC6A073D174340F
|
||||
5D8096A26BD11AB41E3D80B6A2A7D14BE87574007D8A8E6380D1310E668CD961
|
||||
5C8C87456089581A26C71663E55835568F35631D583776151BC09E61EF082402
|
||||
8B8013EC085E8410C26C82909047584C5843A825EC23B412BA085709838431C2
|
||||
272293A84FB4257A12F9C478623AB1905846AC26EE211E219E255E270E135F93
|
||||
48240EC992E44E0A21259032490B496B48DB482DA453A43ED210699C4C26EB90
|
||||
6DC9DEE408B280AC209791B7900F904F92FBC9C3E4B7143AC588E24C09A22452
|
||||
A494124A35653FE504A59F324299A0AA51CDA99ED408AA883A9F5A496DA07650
|
||||
2F5387A91334759A25CD9B1643CBA42DA3D5D09A696769F7682FE974BA09DD83
|
||||
1E4597D097D26BE807E9E7E983F4770C0D860D83C7486228196B197B19A718B7
|
||||
192F994CA605D39799C85430D7321B9967980F986F55582AF62A7C1591CA1295
|
||||
3A9556957E95E7AA545573553FD579AA0B54AB550FAB5E567DA64655B350E3A9
|
||||
09D416ABD5A91D55BBA936AECE5277528F50CF515FA3BE5FFD82FA630DB28685
|
||||
46A08648A35463B7C6198D2116C63265F15842D6725603EB2C6B984D625BB2F9
|
||||
EC4C7605FB1B762F7B4C534373AA66AC6691669DE671CD010EC6B1E0F039D99C
|
||||
4ACE21CE0DCE7B2D032D3F2DB1D66AAD66AD7EAD37DA7ADABEDA62ED72ED16ED
|
||||
EBDAEF75709D409D2C9DF53A6D3AF77509BA36BA51BA85BADB75CFEA3ED363EB
|
||||
79E909F5CAF50EE9DDD147F56DF4A3F517EAEFD6EFD11F373034083690196C31
|
||||
3863F0CC9063E86B9869B8D1F084E1A811CB68BA91C468A3D149A327B826EE87
|
||||
67E33578173E66AC6F1C62AC34DE65DC6B3C61626932DBA4C4A4C5E4BE29CD94
|
||||
6B9A66BAD1B4D374CCCCC82CDCACD8ACC9EC8E39D59C6B9E61BED9BCDBFC8D85
|
||||
A5459CC54A8B368BC796DA967CCB05964D96F7AC98563E567956F556D7AC49D6
|
||||
5CEB2CEB6DD6576C501B579B0C9B3A9BCBB6A8AD9BADC4769B6DDF14E2148F29
|
||||
D229F5536EDA31ECFCEC0AEC9AEC06ED39F661F625F66DF6CF1DCC1C121DD63B
|
||||
743B7C727475CC766C70BCEBA4E134C3A9C4A9C3E957671B67A1739DF33517A6
|
||||
4B90CB1297769717536DA78AA76E9F7ACB95E51AEEBAD2B5D3F5A39BBB9BDCAD
|
||||
D96DD4DDCC3DC57DABFB4D2E9B1BC95DC33DEF41F4F0F758E271CCE39DA79BA7
|
||||
C2F390E72F5E765E595EFBBD1E4FB39C269ED6306DC8DBC45BE0BDCB7B603A3E
|
||||
3D65FACEE9033EC63E029F7A9F87BEA6BE22DF3DBE237ED67E997E07FC9EFB3B
|
||||
FACBFD8FF8BFE179F216F14E056001C101E501BD811A81B3036B031F049904A5
|
||||
0735058D05BB062F0C3E15420C090D591F72936FC017F21BF96333DC672C9AD1
|
||||
15CA089D155A1BFA30CC264C1ED6118E86CF08DF107E6FA6F94CE9CCB60888E0
|
||||
476C88B81F69199917F97D14292A32AA2EEA51B453747174F72CD6ACE459FB67
|
||||
BD8EF18FA98CB93BDB6AB6727667AC6A6C526C63EC9BB880B8AAB8817887F845
|
||||
F1971274132409ED89E4C4D8C43D89E37302E76C9A339CE49A54967463AEE5DC
|
||||
A2B917E6E9CECB9E773C593559907C3885981297B23FE5832042502F184FE5A7
|
||||
6E4D1D13F2849B854F45BEA28DA251B1B7B84A3C92E69D5695F638DD3B7D43FA
|
||||
68864F4675C633094F522B79911992B923F34D5644D6DEACCFD971D92D39949C
|
||||
949CA3520D6996B42BD730B728B74F662B2B930DE479E66DCA1B9387CAF7E423
|
||||
F973F3DB156C854CD1A3B452AE500E164C2FA82B785B185B78B848BD485AD433
|
||||
DF66FEEAF9230B82167CBD90B050B8B0B3D8B87859F1E022BF45BB16238B5317
|
||||
772E315D52BA647869F0D27DCB68CBB296FD50E2585255F26A79DCF28E5283D2
|
||||
A5A5432B82573495A994C9CB6EAEF45AB9631561956455EF6A97D55B567F2A17
|
||||
955FAC70ACA8AEF8B046B8E6E2574E5FD57CF5796DDADADE4AB7CAEDEB48EBA4
|
||||
EB6EACF759BFAF4ABD6A41D5D086F00DAD1BF18DE51B5F6D4ADE74A17A6AF58E
|
||||
CDB4CDCACD03356135ED5BCCB6ACDBF2A136A3F67A9D7F5DCB56FDADABB7BED9
|
||||
26DAD6BFDD777BF30E831D153BDEEF94ECBCB52B78576BBD457DF56ED2EE82DD
|
||||
8F1A621BBABFE67EDDB847774FC59E8F7BA57B07F645EFEB6A746F6CDCAFBFBF
|
||||
B2096D52368D1E483A70E59B806FDA9BED9A77B5705A2A0EC241E5C127DFA67C
|
||||
7BE350E8A1CEC3DCC3CDDF997FB7F508EB48792BD23ABF75AC2DA36DA03DA1BD
|
||||
EFE88CA39D1D5E1D47BEB7FF7EEF31E36375C7358F579EA09D283DF1F9E48293
|
||||
E3A764A79E9D4E3F3DD499DC79F74CFC996B5D515DBD6743CF9E3F1774EE4CB7
|
||||
5FF7C9F3DEE78F5DF0BC70F422F762DB25B74BAD3DAE3D477E70FDE148AF5B6F
|
||||
EB65F7CBED573CAE74F44DEB3BD1EFD37FFA6AC0D573D7F8D72E5D9F79BDEFC6
|
||||
EC1BB76E26DD1CB825BAF5F876F6ED17770AEE4CDC5D7A8F78AFFCBEDAFDEA07
|
||||
FA0FEA7FB4FEB165C06DE0F860C060CFC3590FEF0E09879EFE94FFD387E1D247
|
||||
CC47D52346238D8F9D1F1F1B0D1ABDF264CE93E1A7B2A713CFCA7E56FF79EB73
|
||||
ABE7DFFDE2FB4BCF58FCD8F00BF98BCFBFAE79A9F372EFABA9AF3AC723C71FBC
|
||||
CE793DF1A6FCADCEDB7DEFB8EFBADFC7BD1F9928FC40FE50F3D1FA63C7A7D04F
|
||||
F73EE77CFEFC2FF784F3FB25D29F33000004A74944415478DAED9A7F6894751C
|
||||
C7DFF7737ADDB5DDB9ED86C4769B354E6AB666D08F952328DAD85889299622A5
|
||||
A0129185445052521649482814D20F31C1107569367142FD314B6895D354722A
|
||||
6C3709DB56DD3937D676CF73777DBECF9EE7B8EAB83DF73CDFE7D91DDC173E3C
|
||||
DF7DBFCFEE5E7C5FCFF3FDDEF787259148A0EEEE7B305BE95CEFCF99AAAD1476
|
||||
0A27C51CF96A97CBCD4A710A91224A31295F45B92E27D92C4C6A2C1673D01F2E
|
||||
8A62F9EA30114C4902C504C5A87C15E486F252CCA7A8A128A7F098CCC738C628
|
||||
4628FA29AE5344E43A37858FA242E674CBCC662526715CE619A208B3BF15A9C5
|
||||
CD2DAD1F0F0D0FAF3011286DAAF0FB0F769D38BE1ED3725923DDF1E4D2659DA1
|
||||
C1C1F9B3CD16A8AABA7EF448471B65AF2AB84B972DFF606060A06DB6D9AAABAB
|
||||
3B8F741C7A99B2438AD4CAFA867B072B6B82B3CD866BFD7DAC4BAE62598A528A
|
||||
26623B9C436C4F51B65B2E0A12DB77CE396ED8ED76D86C3658AC56582C16C359
|
||||
98B7443CCEDC4114454427C719DBC354D5A74865709772A8E11632384C77BB4F
|
||||
10DB4739C4F63C65BF928B1613DB3197BB04768783C43A6035516A9CA48AA200
|
||||
511030317E83B1B553D519456A1DC19DD7D37081C7EF47705533BAD66CE5D170
|
||||
8B287B81A2926225B16DCF21B657297B402E6A24B62F3CC5F3E07016496FAB95
|
||||
BDAD5948AD6969C49D6B5AF1F5D3AF65C5224995DF52213A85B1D1BF18DB3354
|
||||
753AD7A506285611DBB61C62DB42D9FD72111B1AF6DEEA2D839349A5B7D56623
|
||||
B159480D343F8085AB5B7062F51B59B1C4256FA2F4964649EACDC81F8CED59AA
|
||||
EAE622F5AE75ED70BA5D285F1CC42F1F1E86A7AA02570E7EA3A7E1B8493580ED
|
||||
7F528B7DE549A97692CAC655A3D9D8782AA6481D0D8FF0915ABBE251D4B43682
|
||||
FA1B4C0C87E1F2FB10EE0BC1170C20118BE3FCEE2FF17BCF452D0DA75BAA816C
|
||||
BAA5F26033442A7BCA6E6B6A90A07EDABE0F7E7ADA942ECE5B5B89FA1796A3A8
|
||||
C483BEFD5D089DFCC154A906B3E992CA8B8DBB54F6E5F76D592B3D5D3FBEBB57
|
||||
2A4B376E2D79FF45B8CABDE8DEBC137FFF79C314A926B06996CA938DBB54F6A5
|
||||
734B4B70F2B9B79265E9E0D83D4D3B3661A4F7327A771E50F5D97AA59AC0A659
|
||||
2A4F36EE529B3F7F13BF9D3A8B8B9F1DCB08C7D2836F6FC0DC322FBEDDF89E29
|
||||
524D60D32C95271B7FA9FBB6A6EDF319E07FCBA41F056D0FA99E4EE8966A3C9B
|
||||
76A91CD90C91DAB36D0F2257AECD786FB673441E520D66D32595179B2152FB3B
|
||||
BF5735A76AD8B41265F5B5FF1A4754349C2EA906B3E992CA8B8DBBD447766D46
|
||||
6C4AC0A95776CD78EF639FBE8EA9C898AA7B531A4EB35413D8344BE5C9C65DAA
|
||||
D2DFCF3497624F1B5B2D51DBE5A4349C66A926B06996CA93CD90C507652ED57F
|
||||
FC74DAEE44014B9D9365D170BA161F0C66D3B5F8C08BCDB0654209D0EF833031
|
||||
89C8A55072A96B5EDD02D89C8EAC1B8D975483D9742FE837ED7829C916FE7520
|
||||
C956BAE8F66936E2ED79674FC6CF3074419FFD4AAB6E6D84D3730B2C362B6251
|
||||
411A0B2E7C725475B79641AAAEAD3783D8B86CBDB12DB705ED4B5094C23619BE
|
||||
8973BB3B10BE1C9AF1FFD56CBD1536C9D5B3E5CD2679E1388B7AB6BC39CE5238
|
||||
78A622E5DBC1B3C211D1CC5CF97744B470983B63CABBC3DCFF002BA4E7AE5B39
|
||||
17140000000049454E44AE426082}
|
||||
ShowHint = True
|
||||
OnClick = PowerClick
|
||||
end
|
||||
object m_btnLoop: TPNGButton
|
||||
Left = 68
|
||||
Top = 195
|
||||
Width = 39
|
||||
Height = 26
|
||||
Hint = #24490#29615#25773#25918
|
||||
ParentCustomHint = False
|
||||
ImgStates = 3
|
||||
ParentShowHint = False
|
||||
PngImg.Data = {
|
||||
89504E470D0A1A0A0000000D49484452000000750000001A080600000089A613
|
||||
33000000097048597300000B1300000B1301009A9C1800000A4D694343505068
|
||||
6F746F73686F70204943432070726F66696C65000078DA9D53775893F7163EDF
|
||||
F7650F5642D8F0B1976C81002223AC08C81059A21092006184101240C585880A
|
||||
561415119C4855C482D50A489D88E2A028B867418A885A8B555C38EE1FDCA7B5
|
||||
7D7AEFEDEDFBD7FBBCE79CE7FCCE79CF0F8011122691E6A26A003952853C3AD8
|
||||
1F8F4F48C4C9BD80021548E0042010E6CBC26705C50000F00379787E74B03FFC
|
||||
01AF6F00020070D52E2412C7E1FF83BA50265700209100E02212E70B01905200
|
||||
C82E54C81400C81800B053B3640A009400006C797C422200AA0D00ECF4493E05
|
||||
00D8A993DC1700D8A21CA908008D0100992847240240BB00605581522C02C0C2
|
||||
00A0AC40222E04C0AE018059B632470280BD0500768E58900F4060008099422C
|
||||
CC0020380200431E13CD03204C03A030D2BFE0A95F7085B8480100C0CB95CD97
|
||||
4BD23314B895D01A77F2F0E0E221E2C26CB142611729106609E4229C979B2313
|
||||
48E7034CCE0C00001AF9D1C1FE383F90E7E6E4E1E666E76CEFF4C5A2FE6BF06F
|
||||
223E21F1DFFEBC8C020400104ECFEFDA5FE5E5D60370C701B075BF6BA95B00DA
|
||||
560068DFF95D33DB09A05A0AD07AF98B7938FC401E9EA150C83C1D1C0A0B0BED
|
||||
2562A1BD30E38B3EFF33E16FE08B7EF6FC401EFEDB7AF000719A4099ADC0A383
|
||||
FD71616E76AE528EE7CB0442316EF7E723FEC7857FFD8E29D1E234B15C2C158A
|
||||
F15889B850224DC779B952914421C995E212E97F32F11F96FD0993770D00AC86
|
||||
4FC04EB607B5CB6CC07EEE01028B0E58D27600407EF32D8C1A0B910010673432
|
||||
79F7000093BFF98F402B0100CD97A4E30000BCE8185CA894174CC608000044A0
|
||||
812AB041070CC114ACC00E9CC11DBCC01702610644400C24C03C104206E4801C
|
||||
0AA11896411954C03AD804B5B0031AA0119AE110B4C131380DE7E0125C81EB70
|
||||
170660189EC218BC86090441C8081361213A8811628ED822CE0817998E042261
|
||||
48349280A420E988145122C5C872A402A9426A915D4823F22D7214398D5C40FA
|
||||
90DBC820328AFC8ABC47319481B25103D4027540B9A81F1A8AC6A073D174340F
|
||||
5D8096A26BD11AB41E3D80B6A2A7D14BE87574007D8A8E6380D1310E668CD961
|
||||
5C8C87456089581A26C71663E55835568F35631D583776151BC09E61EF082402
|
||||
8B8013EC085E8410C26C82909047584C5843A825EC23B412BA085709838431C2
|
||||
272293A84FB4257A12F9C478623AB1905846AC26EE211E219E255E270E135F93
|
||||
48240EC992E44E0A21259032490B496B48DB482DA453A43ED210699C4C26EB90
|
||||
6DC9DEE408B280AC209791B7900F904F92FBC9C3E4B7143AC588E24C09A22452
|
||||
A494124A35653FE504A59F324299A0AA51CDA99ED408AA883A9F5A496DA07650
|
||||
2F5387A91334759A25CD9B1643CBA42DA3D5D09A696769F7682FE974BA09DD83
|
||||
1E4597D097D26BE807E9E7E983F4770C0D860D83C7486228196B197B19A718B7
|
||||
192F994CA605D39799C85430D7321B9967980F986F55582AF62A7C1591CA1295
|
||||
3A9556957E95E7AA545573553FD579AA0B54AB550FAB5E567DA64655B350E3A9
|
||||
09D416ABD5A91D55BBA936AECE5277528F50CF515FA3BE5FFD82FA630DB28685
|
||||
46A08648A35463B7C6198D2116C63265F15842D6725603EB2C6B984D625BB2F9
|
||||
EC4C7605FB1B762F7B4C534373AA66AC6691669DE671CD010EC6B1E0F039D99C
|
||||
4ACE21CE0DCE7B2D032D3F2DB1D66AAD66AD7EAD37DA7ADABEDA62ED72ED16ED
|
||||
EBDAEF75709D409D2C9DF53A6D3AF77509BA36BA51BA85BADB75CFEA3ED363EB
|
||||
79E909F5CAF50EE9DDD147F56DF4A3F517EAEFD6EFD11F373034083690196C31
|
||||
3863F0CC9063E86B9869B8D1F084E1A811CB68BA91C468A3D149A327B826EE87
|
||||
67E33578173E66AC6F1C62AC34DE65DC6B3C61626932DBA4C4A4C5E4BE29CD94
|
||||
6B9A66BAD1B4D374CCCCC82CDCACD8ACC9EC8E39D59C6B9E61BED9BCDBFC8D85
|
||||
A5459CC54A8B368BC796DA967CCB05964D96F7AC98563E567956F556D7AC49D6
|
||||
5CEB2CEB6DD6576C501B579B0C9B3A9BCBB6A8AD9BADC4769B6DDF14E2148F29
|
||||
D229F5536EDA31ECFCEC0AEC9AEC06ED39F661F625F66DF6CF1DCC1C121DD63B
|
||||
743B7C727475CC766C70BCEBA4E134C3A9C4A9C3E957671B67A1739DF33517A6
|
||||
4B90CB1297769717536DA78AA76E9F7ACB95E51AEEBAD2B5D3F5A39BBB9BDCAD
|
||||
D96DD4DDCC3DC57DABFB4D2E9B1BC95DC33DEF41F4F0F758E271CCE39DA79BA7
|
||||
C2F390E72F5E765E595EFBBD1E4FB39C269ED6306DC8DBC45BE0BDCB7B603A3E
|
||||
3D65FACEE9033EC63E029F7A9F87BEA6BE22DF3DBE237ED67E997E07FC9EFB3B
|
||||
FACBFD8FF8BFE179F216F14E056001C101E501BD811A81B3036B031F049904A5
|
||||
0735058D05BB062F0C3E15420C090D591F72936FC017F21BF96333DC672C9AD1
|
||||
15CA089D155A1BFA30CC264C1ED6118E86CF08DF107E6FA6F94CE9CCB60888E0
|
||||
476C88B81F69199917F97D14292A32AA2EEA51B453747174F72CD6ACE459FB67
|
||||
BD8EF18FA98CB93BDB6AB6727667AC6A6C526C63EC9BB880B8AAB8817887F845
|
||||
F1971274132409ED89E4C4D8C43D89E37302E76C9A339CE49A54967463AEE5DC
|
||||
A2B917E6E9CECB9E773C593559907C3885981297B23FE5832042502F184FE5A7
|
||||
6E4D1D13F2849B854F45BEA28DA251B1B7B84A3C92E69D5695F638DD3B7D43FA
|
||||
68864F4675C633094F522B79911992B923F34D5644D6DEACCFD971D92D39949C
|
||||
949CA3520D6996B42BD730B728B74F662B2B930DE479E66DCA1B9387CAF7E423
|
||||
F973F3DB156C854CD1A3B452AE500E164C2FA82B785B185B78B848BD485AD433
|
||||
DF66FEEAF9230B82167CBD90B050B8B0B3D8B87859F1E022BF45BB16238B5317
|
||||
772E315D52BA647869F0D27DCB68CBB296FD50E2585255F26A79DCF28E5283D2
|
||||
A5A5432B82573495A994C9CB6EAEF45AB9631561956455EF6A97D55B567F2A17
|
||||
955FAC70ACA8AEF8B046B8E6E2574E5FD57CF5796DDADADE4AB7CAEDEB48EBA4
|
||||
EB6EACF759BFAF4ABD6A41D5D086F00DAD1BF18DE51B5F6D4ADE74A17A6AF58E
|
||||
CDB4CDCACD03356135ED5BCCB6ACDBF2A136A3F67A9D7F5DCB56FDADABB7BED9
|
||||
26DAD6BFDD777BF30E831D153BDEEF94ECBCB52B78576BBD457DF56ED2EE82DD
|
||||
8F1A621BBABFE67EDDB847774FC59E8F7BA57B07F645EFEB6A746F6CDCAFBFBF
|
||||
B2096D52368D1E483A70E59B806FDA9BED9A77B5705A2A0EC241E5C127DFA67C
|
||||
7BE350E8A1CEC3DCC3CDDF997FB7F508EB48792BD23ABF75AC2DA36DA03DA1BD
|
||||
EFE88CA39D1D5E1D47BEB7FF7EEF31E36375C7358F579EA09D283DF1F9E48293
|
||||
E3A764A79E9D4E3F3DD499DC79F74CFC996B5D515DBD6743CF9E3F1774EE4CB7
|
||||
5FF7C9F3DEE78F5DF0BC70F422F762DB25B74BAD3DAE3D477E70FDE148AF5B6F
|
||||
EB65F7CBED573CAE74F44DEB3BD1EFD37FFA6AC0D573D7F8D72E5D9F79BDEFC6
|
||||
EC1BB76E26DD1CB825BAF5F876F6ED17770AEE4CDC5D7A8F78AFFCBEDAFDEA07
|
||||
FA0FEA7FB4FEB165C06DE0F860C060CFC3590FEF0E09879EFE94FFD387E1D247
|
||||
CC47D52346238D8F9D1F1F1B0D1ABDF264CE93E1A7B2A713CFCA7E56FF79EB73
|
||||
ABE7DFFDE2FB4BCF58FCD8F00BF98BCFBFAE79A9F372EFABA9AF3AC723C71FBC
|
||||
CE793DF1A6FCADCEDB7DEFB8EFBADFC7BD1F9928FC40FE50F3D1FA63C7A7D04F
|
||||
F73EE77CFEFC2FF784F3FB25D29F33000005684944415478DAED9A0F4C55551C
|
||||
C7BFEF1F3C9E0FDE03111E38F99726B05149906DE89C384CC321A828EA2A6BCD
|
||||
1646850DDACC9594B3D8523337E658C35C591A30A169B491115A5B186693500A
|
||||
068F24FEFFE7C9E0BD07F43BD7FB5C0BE33DDEBBF7021B67FBED9E7BCF79F77D
|
||||
389F7BCEE19D7B64131313887A7405662AFDF66BF554C5720A25851B859A3F2A
|
||||
F9EB52A5710A2B859962843F5AF9B259C9266352C7C6C65474A2A1D0F1479584
|
||||
60B664A118A618E08F16BEA1BC290229C228FC283C25E6631C43149D148D14AD
|
||||
147D7C9996C287C2C0736A7966A9129368E279DA297AD9B94DAA6EC3C6C4FCF6
|
||||
8E8EED12023D3019FCFDBFFAB6ECD25EDC93CB1A695972CAD68BC6E6E6C09966
|
||||
0B090E6E2DB950BC89B2F536DC94ADA9C79B9A9A36CD345B6868E8C50BC58599
|
||||
946DB7490D7A2C3AA639282C7CA6D9F057631D1B92835996C297620DB115CD22
|
||||
B66D94ADE42F8513DB5537B5164AA5120A850232B91C32994C7416E66D627C9C
|
||||
B983D56A8579C4C4D85653519D4D2A83BB3D8B1A2E82C1E1DEB0BB99D8F26611
|
||||
5B3A654BF94B8F13DBD71AAD1E4A958AC4AA209750EA3849B55A2DB05A2C1836
|
||||
F533B6242ABA6E931A4570375D6938BDDE0BDE3E7A2EDF6C6CE1BED085867B84
|
||||
B23514411469C4963B8BD8DEA4EC39FE521CB17DE1A95B08959B3BD75BE5ACB7
|
||||
4E43AADEDB0B3E3EDE5CDED874C761364E2ADF4B2DE6510C0DF430B65D54F493
|
||||
4B52BDBCB4484A49407C421CD46AF7FBD7CD660B7EACBC86A2F3DFA0BF7FD099
|
||||
86B3490DA1D84D6C876711DB41CA9EE52FB1A9E1532FEF45706352A9B72A1424
|
||||
D68E548E6DCB7AAC5BBF6A12DBD51FAA5074EE925DB671CE9B95EBA566923AD8
|
||||
D7C5D8F65051A5D352B55A0D8EE5BD0D8DC60326D3301AEB9BD1DDDD477F9C8A
|
||||
7E222D878E7AC7C8C8284E9DFC1CD5553725952A32DB24A93A1FBFFB52952495
|
||||
CDAB62B3B1F9D4FA2FA903BD9DAE4B6573C7BECC67D0F0A71115E53F7320B6A4
|
||||
542A90B07115B6ED7C9ACB9F3C7A86006B24932A329B4B5285621354AA87468D
|
||||
D111B343637F64D452BCF1D68B547F1459AFE4E2AE695854A912B13925556836
|
||||
41A5BE9CB90BC6C61694955EB15B97A5E41D09D89CBA0E25E7CB515A78D9D186
|
||||
734AAA446C4E49159A4D30A9D12B23919EB59BFEE31AC3A1FD1FA3BDB5DB2EDC
|
||||
02AD078E171CC01D631BDECBCE73B4E1A62D5542B6694B15834D10A9EC4B723E
|
||||
CA80975ECB9D3735B420F7C0270E0D27EF1CDB07FF405FA4A7E588225562B669
|
||||
49158B4D30A90BFDF4C83EF202FA7B8790FF6121DA5ABAE8379275CACFBC94BD
|
||||
1DC161017057BB51A3B4A1F4CB0AD4DE68105CAA846CD3962A069BA073EAE153
|
||||
1934E9BB236BCF517ADA26ECD65F9BF804529F4FE0F27FD4187122E7EC94F55D
|
||||
99532562736A4E159A4D50A9CFBD968498D591C8CF2D46CD2FF576EBCBE53264
|
||||
1CDA89256106BCBFBF003D9DFDA2499588CD29A942B3092A7569E41264BC9B86
|
||||
EEF63E1C79FD34C668F2B7977C0DDE78286231AA2A7EB75BD715A912B1392555
|
||||
6836C1171F9ECD4CC48AB8E5B875BD119F9D28C3C8F0E8A43AEC49D3F968D1D7
|
||||
3DE4D03DFFD3704E2F3E48C0E6F4E283906C824B55D3DCB0F76032421E0E406F
|
||||
E720CA8BAB5077A3996E6CC2E29045085A66C0BA9458E87D3DF1C1AB67E8E9EC
|
||||
77E8BE42489580CD69A942B289B24CA8502AF0D48E95884F897960391B5EAA2E
|
||||
DF42E9E92B0E0D3542499580CDA5057DC6B621ED49C46F89FD7FB6EF6A515250
|
||||
39259B280BFAB6E46BD0217A4D3842C303A05EE086D6A66EEE29ACAEB84D4FCF
|
||||
DD69DF4FC8576F22B109F2EACD37408FD8B591088B08243677FCDDD8859E8E01
|
||||
5CFBBE16033D26BB9F77E4D5DBFC4B72C7D9E6CC4BF2F9ED2C8EB3CD99ED2CF3
|
||||
1BCF1C48736DE3D9FC16D1A9B9E6DE16D1F9CDDC53A639B799FB1FC0F365BD55
|
||||
01D0790000000049454E44AE426082}
|
||||
ShowHint = True
|
||||
OnClick = LoopClick
|
||||
end
|
||||
object m_panShow: TPanel
|
||||
Left = 24
|
||||
Top = 72
|
||||
Width = 356
|
||||
Height = 83
|
||||
ParentCustomHint = False
|
||||
BevelEdges = []
|
||||
BevelOuter = bvNone
|
||||
Ctl3D = False
|
||||
ParentColor = True
|
||||
ParentCtl3D = False
|
||||
ParentShowHint = False
|
||||
ShowCaption = False
|
||||
ShowHint = False
|
||||
TabOrder = 0
|
||||
object m_lblNoParams: TLabel
|
||||
Left = 39
|
||||
Top = 27
|
||||
Width = 84
|
||||
Height = 14
|
||||
Caption = #27809#26377#21487#35843#33410#21442#25968
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 12429980
|
||||
Font.Height = -12
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
end
|
||||
end
|
||||
object m_tbPosition: TSkinTrackBar
|
||||
Tag = 1
|
||||
Left = 24
|
||||
Top = 169
|
||||
Width = 356
|
||||
Height = 19
|
||||
Hint = '0'
|
||||
Caption = 'm_tbPosition'
|
||||
FullRepaint = False
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentColor = True
|
||||
ParentFont = False
|
||||
ParentShowHint = False
|
||||
ShowHint = False
|
||||
TabOrder = 1
|
||||
OnChange = PositionChange
|
||||
Max = 1000
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,76 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef AudioFxFormUnitH
|
||||
#define AudioFxFormUnitH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <System.Classes.hpp>
|
||||
#include <Vcl.Controls.hpp>
|
||||
#include <Vcl.StdCtrls.hpp>
|
||||
#include <Vcl.Forms.hpp>
|
||||
#include "GeneralDialogPanel.h"
|
||||
#include "TextButton.h"
|
||||
#include <Vcl.ExtCtrls.hpp>
|
||||
#include "ComboBoxComponent.h"
|
||||
#include "PNGButton.hpp"
|
||||
#include "SkinTrackBar.h"
|
||||
//---------------------------------------------------------------------------
|
||||
class TAudioFxForm : public TForm
|
||||
{
|
||||
__published: // IDE-managed Components
|
||||
TGeneralDialogPanel *m_BKGPanel;
|
||||
TTextButton *m_btnCancel;
|
||||
TTextButton *m_btnOk;
|
||||
TPNGButton *m_btnPlay;
|
||||
TPNGButton *m_btnStop;
|
||||
TPNGButton *m_btnPowerOn;
|
||||
TPNGButton *m_btnLoop;
|
||||
TLabel *m_lblPreset;
|
||||
TComboBoxComponent *m_cbPreset;
|
||||
TSkinTrackBar *m_tbPosition;
|
||||
TLabel *m_lblNoParams;
|
||||
TPanel *m_panShow;
|
||||
TPNGButton *m_btnPowerOff;
|
||||
void __fastcall PlayClick(TObject *Sender);
|
||||
void __fastcall PowerClick(TObject *Sender);
|
||||
void __fastcall StopClick(TObject *Sender);
|
||||
void __fastcall LoopClick(TObject *Sender);
|
||||
void __fastcall PresetChange(TComboBoxItem *Sender, int Index);
|
||||
void __fastcall PositionChange(TObject *Sender);
|
||||
void __fastcall TrackBarChange(TObject *Sender);
|
||||
void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
|
||||
void __fastcall FormResize(TObject *Sender);
|
||||
void __fastcall FormCreate(TObject *Sender);
|
||||
void __fastcall OkClick(TObject *Sender);
|
||||
private: // User declarations
|
||||
TLabel * m_lstCaption[6];
|
||||
TSkinTrackBar * m_lstTrack[6];
|
||||
float m_fParam[6];
|
||||
|
||||
int m_iFx, m_iPlugin, m_iTrack, m_iInd;
|
||||
bool m_bPowerOn;
|
||||
double m_dblStart, m_dblEnd, m_dblStep, m_dblPos;
|
||||
int m_iCurrPos;
|
||||
UINT m_tTimer, m_tAccuracy;
|
||||
|
||||
MESSAGE void __fastcall UMMediaTime(TMessage &Message);
|
||||
MESSAGE void __fastcall UMEditorResize(TMessage &Message);
|
||||
|
||||
BEGIN_MESSAGE_MAP
|
||||
MESSAGE_HANDLER(MSG_MEDIATIME, TMessage, UMMediaTime)
|
||||
MESSAGE_HANDLER(MSG_VSTEDITORRESIZE, TMessage, UMEditorResize)
|
||||
END_MESSAGE_MAP(TForm)
|
||||
|
||||
public: // User declarations
|
||||
__fastcall TAudioFxForm( TComponent* Owner, int iTrk, double start, double end,
|
||||
int iInd=-1, int iFx=-1, int iPlugin=-1 );
|
||||
__fastcall ~TAudioFxForm();
|
||||
|
||||
int __fastcall GetParamCount();
|
||||
float* __fastcall GetParams(){ return m_fParam; };
|
||||
int __fastcall GetPreset();
|
||||
bool __fastcall IsBypass();
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
extern PACKAGE TAudioFxForm *AudioFxForm;
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
@@ -0,0 +1,813 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "GlobalUnit.h"
|
||||
#include "AudioTrack.h"
|
||||
#include "Undo.h"
|
||||
#include "Project.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
|
||||
/***************************************************************************************/
|
||||
// 全局变量
|
||||
/***************************************************************************************/
|
||||
|
||||
TAudio g_Audio;
|
||||
TAudioTrackList& g_aAudioTracks = g_Audio.AudioTracks(); //全曲音频轨道(最大4组)
|
||||
int g_iSelAudio = 0; // 当前处理的音频轨
|
||||
|
||||
/***************************************************************************************/
|
||||
// TAudio类函数
|
||||
/***************************************************************************************/
|
||||
|
||||
void TAudio::CopyTrackList( int iStartBar, int nCopyBars, TAudioTrackList* lstAudio, bool bFx )
|
||||
{
|
||||
int iTrkStart = 1,
|
||||
iTrkEnd = m_lstTracks.size();
|
||||
|
||||
if( g_iPreStage==0/*iTrkEnd==iTrkStart*/ )
|
||||
iTrkStart = 0;
|
||||
|
||||
for( int i=iTrkStart; i<iTrkEnd; i++ ){
|
||||
if( !m_lstTracks[i]->lstBars.empty() )
|
||||
lstAudio->push_back( CopyTrack( i, iStartBar, nCopyBars, bFx ) );
|
||||
}
|
||||
}
|
||||
|
||||
TAudioTrack* TAudio::CopyTrack( int iTrack, int iStartBar, int nCopyBars, bool bFx, TAudioTrack* pDest )
|
||||
{
|
||||
TAudioTrack* pSrcTrack = m_lstTracks[iTrack],
|
||||
*pDestTrack = pDest ? pDest : new TAudioTrack();
|
||||
|
||||
pDestTrack->state = pSrcTrack->state;
|
||||
pDestTrack->volume = pSrcTrack->volume;
|
||||
pDestTrack->pan = pSrcTrack->pan;
|
||||
pDestTrack->gain = pSrcTrack->gain;
|
||||
|
||||
for( int i=0; i<nCopyBars; i++ ){
|
||||
pDestTrack->lstBars.push_back( new TWaveBar( pSrcTrack->lstBars[iStartBar+i] ) );
|
||||
}
|
||||
|
||||
if( bFx ){
|
||||
for( int i=0; i<pSrcTrack->lstFxs.size(); i++ )
|
||||
pDestTrack->lstFxs.push_back( new TAudioFx( pSrcTrack->lstFxs[i]) );
|
||||
}
|
||||
|
||||
return pDestTrack;
|
||||
}
|
||||
|
||||
void TAudio::ResetTracks( TAudioTrackList* lstAudio )
|
||||
{
|
||||
//处理音频
|
||||
while( m_lstTracks.size()>1 ){
|
||||
delete m_lstTracks.back();
|
||||
m_lstTracks.pop_back();
|
||||
}
|
||||
|
||||
for( int i=0; i<lstAudio->size(); i++ ){
|
||||
//替换AudioTrack
|
||||
TAudioTrack* pNewTrack = DuplicateAudioTrack( (*lstAudio)[i] );
|
||||
m_lstTracks.push_back( pNewTrack );
|
||||
|
||||
AudioEffectsSet( i+1 );
|
||||
}
|
||||
|
||||
/* if( m_lstTracks.size()>1 ){
|
||||
m_lstTracks[0]->bHide = true;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void TAudio::RestoreAudio( TOpusStageList* lstStages, TAudioTrackList* lstAudio, bool bUndo )
|
||||
{
|
||||
int iOrigStage = 0, iVarBar = 0;
|
||||
|
||||
TOpusStageList::iterator iterDest = lstStages->begin(),
|
||||
iterSrc = g_lstOpusStages.begin();
|
||||
int iDestBar(0), iSrcBar(0);//, iDVB(0), iSVB(0);
|
||||
while( iterDest!=lstStages->end() && iterSrc!=g_lstOpusStages.end() ){
|
||||
TOpusStage *pSrcStage = *iterSrc,
|
||||
*pDestStage = *iterDest;
|
||||
|
||||
if( pSrcStage->iSegType<SEGTYPE_INTRO && pDestStage->iSegType<SEGTYPE_INTRO ){
|
||||
int nBar = min( pSrcStage->aBars.size(), pDestStage->aBars.size() );
|
||||
|
||||
if( nBar==pSrcStage->aBars.size() ){
|
||||
iterSrc++;
|
||||
}
|
||||
|
||||
if( nBar==pDestStage->aBars.size() ){
|
||||
iterDest++;
|
||||
}
|
||||
|
||||
iDestBar += nBar;
|
||||
iSrcBar += nBar;
|
||||
}
|
||||
else if( pSrcStage->iSegType<SEGTYPE_INTRO && pDestStage->iSegType>=SEGTYPE_INTRO ){ //undo情况
|
||||
int nBar = pDestStage->aBars.size();
|
||||
|
||||
iDestBar += nBar;
|
||||
iSrcBar += nBar;
|
||||
iterDest++;
|
||||
}
|
||||
else if( pSrcStage->iSegType>=SEGTYPE_INTRO && pDestStage->iSegType<SEGTYPE_INTRO ){ //redo情况
|
||||
//删掉音频
|
||||
int nBar = pSrcStage->aBars.size();
|
||||
for( int i=1; i<g_aAudioTracks.size(); i++ ){
|
||||
RemoveWaveBars( i, iSrcBar, nBar );
|
||||
}
|
||||
|
||||
iterSrc++;
|
||||
}
|
||||
else if( pSrcStage->iSegType==SEGTYPE_INTRO && pDestStage->iSegType==SEGTYPE_ENDING ){//redo情况
|
||||
//删掉音频
|
||||
int nBar = pSrcStage->aBars.size();
|
||||
for( int i=1; i<g_aAudioTracks.size(); i++ ){
|
||||
RemoveWaveBars( i,iSrcBar , nBar );
|
||||
}
|
||||
|
||||
iterSrc++;
|
||||
}
|
||||
else if( pSrcStage->iSegType==SEGTYPE_ENDING && pDestStage->iSegType==SEGTYPE_INTRO ){//undo情况
|
||||
int nBar = pDestStage->aBars.size();
|
||||
|
||||
iDestBar += nBar;
|
||||
iSrcBar += nBar;
|
||||
iterDest++;
|
||||
}
|
||||
else{ //前尾奏类型相同
|
||||
//redo比较长度并插入空白或删除
|
||||
if( !bUndo ){
|
||||
if( pDestStage->aBars.size() > pSrcStage->aBars.size() ){
|
||||
int nBar = pDestStage->aBars.size() - pSrcStage->aBars.size(),
|
||||
iInsBar = iSrcBar + pSrcStage->aBars.size();
|
||||
|
||||
for( int i=1; i<g_aAudioTracks.size(); i++ ){
|
||||
InsertAudioTrack( i, iInsBar, nBar, NULL );
|
||||
}
|
||||
|
||||
iSrcBar += nBar;
|
||||
}
|
||||
else if( pDestStage->aBars.size() < pSrcStage->aBars.size() ){
|
||||
int nBar = pSrcStage->aBars.size() - pDestStage->aBars.size(),
|
||||
iDelBar = iSrcBar + pDestStage->aBars.size();
|
||||
|
||||
for( int i=1; i<g_aAudioTracks.size(); i++ ){
|
||||
RemoveWaveBars( i, iDelBar, nBar );
|
||||
}
|
||||
|
||||
iSrcBar -= nBar;
|
||||
}
|
||||
}
|
||||
|
||||
iSrcBar += pSrcStage->aBars.size();
|
||||
iDestBar += pDestStage->aBars.size();
|
||||
iterSrc++;
|
||||
iterDest++;
|
||||
}
|
||||
}
|
||||
|
||||
while( iterDest!=lstStages->end() ){ //undo情况
|
||||
int nBar = (*iterDest)->aBars.size();
|
||||
|
||||
iDestBar += nBar;
|
||||
iterDest++;
|
||||
}
|
||||
|
||||
//处理音频
|
||||
if( lstAudio ){
|
||||
for( int i=1; i<g_aAudioTracks.size(); i++ ){
|
||||
if( bUndo ){ //替换WaveBars
|
||||
TAudioTrack *pAT = g_aAudioTracks[i],
|
||||
*pSrc = (*lstAudio)[i-1];
|
||||
|
||||
RemoveWaveBars( i, 0, pAT->lstBars.size() );
|
||||
|
||||
if( pSrc ){
|
||||
for( int i=0; i<pSrc->lstBars.size(); i++ ){
|
||||
TWaveBar* pWvBar = new TWaveBar;
|
||||
memcpy( pWvBar->aVols, pSrc->lstBars[i], sizeof(DWORD)*POINTS_PER_BAR );
|
||||
pAT->lstBars.push_back( pWvBar );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TAudio::WriteProj( FILE* pFile )
|
||||
{
|
||||
int num = m_lstTracks.size();
|
||||
fwrite( &num, sizeof(int), 1, pFile );
|
||||
|
||||
for( int i=0; i<num; i++ ){
|
||||
TAudioTrack* pAT = m_lstTracks[i];
|
||||
|
||||
int nBars = pAT->lstBars.size();
|
||||
fwrite( &nBars, sizeof(int), 1, pFile );
|
||||
|
||||
// fwrite( &bHide, sizeof(BYTE), 1, pFile );
|
||||
// fwrite( &bMute, sizeof(BYTE), 1, pFile );
|
||||
fwrite( &pAT->state, sizeof(BYTE), 1, pFile );
|
||||
fwrite( &pAT->volume, sizeof(BYTE), 1, pFile );
|
||||
fwrite( &pAT->pan, sizeof(char), 1, pFile );
|
||||
fwrite( &pAT->gain, sizeof(char), 1, pFile );
|
||||
// fwrite( &iShow, sizeof(BYTE), 1, pFile );
|
||||
|
||||
int count = pAT->lstFxs.size();
|
||||
fwrite( &count, sizeof(int), 1, pFile );
|
||||
|
||||
for( int j=0; j<count; j++ ){
|
||||
TAudioFx* pFx = pAT->lstFxs[j];
|
||||
fwrite( &pFx->iFx, sizeof(int), 1, pFile );
|
||||
fwrite( &pFx->iPreset, sizeof(int), 1, pFile );
|
||||
fwrite( &pFx->bBypass, sizeof(WORD), 1, pFile );
|
||||
fwrite( &pFx->nParamSize, sizeof(WORD), 1, pFile );
|
||||
if( pFx->nParamSize>0 )
|
||||
fwrite( pFx->pParam, sizeof(float), pFx->nParamSize, pFile );
|
||||
|
||||
if( pFx->iFx >= FX_VST ){
|
||||
VSTINFO* pVST = g_lstVSTFx[pFx->iFx-FX_VST];
|
||||
DWORD uniqueID = pVST->uniqueID;
|
||||
fwrite( &uniqueID, sizeof(DWORD), 1, pFile );
|
||||
|
||||
if( pFx->iPreset>=0 ){
|
||||
uniqueID = pVST->aPlugins[pFx->iPreset]->id;
|
||||
fwrite( &uniqueID, sizeof(DWORD), 1, pFile );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int TAudio::ReadProj( FILE* pFile, DWORD dwVersion )
|
||||
{
|
||||
WORD wMajVersion = HIWORD( dwVersion ),
|
||||
wMinVersion = LOWORD( dwVersion );
|
||||
int iError = E_PROJ_NOERROR;
|
||||
|
||||
int num;
|
||||
fread( &num, sizeof(int), 1, pFile );
|
||||
|
||||
for( int i=0; i<num; i++ ){
|
||||
int nBars;
|
||||
fread( &nBars, sizeof(int), 1, pFile );
|
||||
|
||||
TAudioTrack* pAT = NULL;
|
||||
if( i==0 ){
|
||||
pAT = m_lstTracks[0];
|
||||
}
|
||||
else{
|
||||
pAT = new TAudioTrack;
|
||||
m_lstTracks.push_back( pAT );
|
||||
}
|
||||
|
||||
for( int j=0; j<nBars; j++ ){
|
||||
TWaveBar* pWvBar = new TWaveBar;
|
||||
pAT->lstBars.push_back( pWvBar );
|
||||
}
|
||||
|
||||
if( wMajVersion==5 && wMinVersion>=6 ){
|
||||
fread( &pAT->state, sizeof(BYTE), 1, pFile );
|
||||
fread( &pAT->volume, sizeof(BYTE), 1, pFile );
|
||||
fread( &pAT->pan, sizeof(char), 1, pFile );
|
||||
fread( &pAT->gain, sizeof(char), 1, pFile );
|
||||
|
||||
int count = 0;
|
||||
fread( &count, sizeof(int), 1, pFile );
|
||||
|
||||
for( int j=0; j<count; j++ ){
|
||||
int iFx, iPreset;
|
||||
WORD bBypass, nParamSize;
|
||||
float* pParam = NULL;
|
||||
bool bAdd = true;
|
||||
|
||||
fread( &iFx, sizeof(int), 1, pFile );
|
||||
fread( &iPreset, sizeof(int), 1, pFile );
|
||||
fread( &bBypass, sizeof(WORD), 1, pFile );
|
||||
fread( &nParamSize, sizeof(WORD), 1, pFile );
|
||||
if( nParamSize>0 ){
|
||||
pParam = new float[nParamSize];
|
||||
fread( pParam, sizeof(float), nParamSize, pFile );
|
||||
}
|
||||
|
||||
if( iFx >= FX_VST ){
|
||||
DWORD uniqueID = 0, pluginID = 0;
|
||||
fread( &uniqueID, sizeof(DWORD), 1, pFile );
|
||||
|
||||
if( iPreset>=0 )
|
||||
fread( &pluginID, sizeof(int), 1, pFile );
|
||||
|
||||
bAdd = false;
|
||||
for( int k=0; k<g_lstVSTFx.size(); k++ ){
|
||||
if( uniqueID==g_lstVSTFx[k]->uniqueID ){
|
||||
iFx = FX_VST + k;
|
||||
|
||||
if( iPreset<0 ){
|
||||
bAdd = true;
|
||||
}
|
||||
else{
|
||||
for( int p=0; p<g_lstVSTFx[k]->aPlugins.size(); p++ ){
|
||||
if( g_lstVSTFx[k]->aPlugins[p]->id==pluginID ){
|
||||
iPreset = p;
|
||||
bAdd = true;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( bAdd ){
|
||||
TAudioFx* pFx = new TAudioFx( iFx, iPreset, pParam, nParamSize, bBypass );
|
||||
pAT->lstFxs.push_back( pFx );
|
||||
}
|
||||
else{
|
||||
iError |= E_PROJ_INVALIDFX;
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
BYTE bHide, bMute, iShow;
|
||||
fread( &bHide, sizeof(BYTE), 1, pFile );
|
||||
fread( &bMute, sizeof(BYTE), 1, pFile );
|
||||
fread( &pAT->volume, sizeof(BYTE), 1, pFile );
|
||||
fread( &iShow, sizeof(BYTE), 1, pFile );
|
||||
|
||||
if( bHide )
|
||||
pAT->Hide();
|
||||
if( bMute )
|
||||
pAT->Mute();
|
||||
|
||||
for( int k=0; k<MAX_FX_NUM; k++ ){
|
||||
int count;
|
||||
fread(&count, sizeof(int), 1, pFile);
|
||||
|
||||
for( int j=0; j<count; j++ ){
|
||||
TEffect pAE;
|
||||
fread( &pAE.iBarStart, sizeof(int), 1, pFile );
|
||||
fread( &pAE.iPointStart, sizeof(int), 1, pFile );
|
||||
fread( &pAE.iBarEnd, sizeof(int), 1, pFile );
|
||||
fread( &pAE.iPointEnd, sizeof(int), 1, pFile );
|
||||
fread( &pAE.iPreset, sizeof(int), 1, pFile );
|
||||
fread( &pAE.bOn, sizeof(bool), 1, pFile );
|
||||
if( pAE.bOn ){
|
||||
pAE.aParams = new float[6];
|
||||
fread( pAE.aParams, sizeof(float), 6, pFile );
|
||||
}
|
||||
|
||||
if( pAE.iBarStart==0 && pAE.iBarEnd>=pAT->lstBars.size()-1 ){
|
||||
int iType = g_aAudioEffectTypes[k];
|
||||
|
||||
if( iType!=FX_PITCH ){
|
||||
int nSize = GetFxParamNum( iType );
|
||||
float* pParams = new float[nSize];
|
||||
int iPreset = pAE.iPreset;
|
||||
|
||||
int nPresetCount = GetFxPresetCount( iType );
|
||||
|
||||
if( pAE.bOn )
|
||||
memcpy( pParams, pAE.aParams, sizeof(float)*nSize );
|
||||
else{
|
||||
if( iPreset>=nPresetCount )
|
||||
iPreset = 0;
|
||||
|
||||
GetFxPreset( iType, iPreset, pParams );
|
||||
}
|
||||
|
||||
TAudioFx* pFx = new TAudioFx( iType, iPreset, pParams, nSize, !pAE.bOn );
|
||||
pAT->lstFxs.push_back( pFx );
|
||||
}
|
||||
}
|
||||
else{
|
||||
iError |= E_PROJ_INVALIDFX;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return iError;
|
||||
}
|
||||
|
||||
/***************************************************************************************/
|
||||
// 全局函数
|
||||
/***************************************************************************************/
|
||||
|
||||
TAudioTrack* NewAudioTrack( int nBar, bool bAddUndo )
|
||||
{
|
||||
TAudioTrack* pTrack = NULL;
|
||||
|
||||
if( g_aAudioTracks.size()<MAX_AUDIOTRACK ){
|
||||
pTrack = new TAudioTrack;
|
||||
g_aAudioTracks.push_back( pTrack );
|
||||
|
||||
if( g_aAudioTracks.size()>1 ){
|
||||
int iTrack = g_aAudioTracks.size()-1;
|
||||
|
||||
for( int i=0; i<nBar; i++ ){
|
||||
TWaveBar* pBar = new TWaveBar;
|
||||
pTrack->lstBars.push_back( pBar );
|
||||
}
|
||||
|
||||
if( bAddUndo ){
|
||||
f_MM_AudioNewTrack();
|
||||
|
||||
g_Undo.AddUndo( UNDO_TRKAUD_ADD, iTrack, 0, 0, NULL, NULL );
|
||||
|
||||
f_MM_AddUndoBefore( 0, NULL );
|
||||
f_MM_AddUndoAfter( 1, &iTrack );
|
||||
}
|
||||
|
||||
g_aAudioTracks[0]->Hide();
|
||||
}
|
||||
|
||||
PostMessage( Application->MainFormHandle, UM_ENABLERECORD, 0, 0 );
|
||||
}
|
||||
|
||||
return pTrack;
|
||||
}
|
||||
|
||||
void DeleteAudioTrack( int iTrack, bool bAddUndo )
|
||||
{
|
||||
if( iTrack>0 && iTrack>=g_aAudioTracks.size() )
|
||||
return;
|
||||
|
||||
int num = 1, iDelTrk = iTrack;
|
||||
TAudioTrackList* aTracks = NULL;
|
||||
// TAudioTrack* aTracks = NULL;
|
||||
|
||||
if( iTrack<0 ){
|
||||
if( g_iPreStage==0 ){
|
||||
if( g_aAudioTracks[0]->lstBars.empty() )
|
||||
return;
|
||||
else
|
||||
iDelTrk = 0;
|
||||
}
|
||||
else if( g_aAudioTracks.size()<=1 )
|
||||
return;
|
||||
}
|
||||
|
||||
if( iDelTrk<0 ){
|
||||
int nBars = g_Opus.BarCount();
|
||||
num = g_aAudioTracks.size()-1;
|
||||
|
||||
if( bAddUndo ){
|
||||
aTracks = new TAudioTrackList;
|
||||
// aTracks = new TAudioTrack[num];
|
||||
int* aTrks = new int[num];
|
||||
|
||||
for( int i=0; i<num; i++ )
|
||||
aTrks[i] = i+1;
|
||||
|
||||
f_MM_AddUndoBefore( num, aTrks );
|
||||
|
||||
delete[] aTrks;
|
||||
}
|
||||
|
||||
for( int i=num; i>0; i-- ){
|
||||
if( bAddUndo )
|
||||
// g_Audio.CopyTrack( i, 0, nBars, true, &aTracks[i-1] );
|
||||
aTracks->insert( aTracks->begin(), DuplicateAudioTrack( g_aAudioTracks[i] ));
|
||||
|
||||
f_MM_AudioDeleteTrack( i );
|
||||
delete g_aAudioTracks.back();
|
||||
g_aAudioTracks.pop_back();
|
||||
}
|
||||
}
|
||||
else{
|
||||
if( bAddUndo ){
|
||||
aTracks = new TAudioTrackList;
|
||||
|
||||
aTracks->push_back( DuplicateAudioTrack( g_aAudioTracks[iDelTrk] ));
|
||||
f_MM_AddUndoBefore( 1, &iDelTrk );
|
||||
}
|
||||
|
||||
f_MM_AudioDeleteTrack( iDelTrk );
|
||||
delete g_aAudioTracks[iDelTrk];
|
||||
|
||||
if( iDelTrk==0 )
|
||||
g_aAudioTracks[0] = new TAudioTrack;
|
||||
else
|
||||
g_aAudioTracks.erase( g_aAudioTracks.begin() + iDelTrk );
|
||||
}
|
||||
|
||||
if( bAddUndo ){
|
||||
int iUndoType = iTrack<0 ? UNDO_TRKAUD_DELALL : UNDO_TRKAUD_DEL;
|
||||
g_Undo.AddUndo( iUndoType, iDelTrk, -1, -1, (void*)aTracks, NULL );
|
||||
}
|
||||
|
||||
PostMessage( Application->MainFormHandle, UM_ENABLERECORD, 0, 0 );
|
||||
//Application->MainForm->Perform( UM_ENABLERECORD, 0, 0 );
|
||||
}
|
||||
|
||||
void DuplicateRawBars()
|
||||
{
|
||||
if( g_aAudioTracks.size()>1 || g_aAudioTracks[0]->lstBars.empty() )
|
||||
return;
|
||||
|
||||
TAudioTrack* pRaw = g_aAudioTracks[0];
|
||||
TAudioTrack* pAT = DuplicateAudioTrack( pRaw );
|
||||
|
||||
g_aAudioTracks.push_back( pAT );
|
||||
|
||||
pRaw->Hide();
|
||||
pAT->Hide(false);
|
||||
|
||||
f_MM_AudioNewTrack();
|
||||
f_MM_SetStreamVolume( 0x10+1, pAT->IsMute() ? 0.0 : ( pAT->volume / 100.0) );
|
||||
MoveAudio( 0, 0, pRaw->lstBars.size(), 1, 0, MODE_INSERT | OPT_BARS );
|
||||
|
||||
AudioEffectsSet( g_aAudioTracks.size()-1 );
|
||||
}
|
||||
|
||||
TAudioTrack* DuplicateAudioTrack( TAudioTrack* pSrc )
|
||||
{
|
||||
if( !pSrc )
|
||||
return NULL;
|
||||
|
||||
TAudioTrack* pNew = new TAudioTrack( pSrc );
|
||||
|
||||
//复制bars
|
||||
for( int i=0; i<pSrc->lstBars.size(); i++ ){
|
||||
TWaveBar* pWvBar = new TWaveBar;
|
||||
memcpy( pWvBar->aVols, pSrc->lstBars[i]->aVols, sizeof(DWORD)*POINTS_PER_BAR );
|
||||
pNew->lstBars.push_back( pWvBar );
|
||||
}
|
||||
|
||||
for( int i=0; i<pSrc->lstFxs.size(); i++ ){
|
||||
TAudioFx* pFx = new TAudioFx( pSrc->lstFxs[i] );
|
||||
pNew->lstFxs.push_back( pFx );
|
||||
}
|
||||
|
||||
return pNew;
|
||||
}
|
||||
|
||||
bool MoveAudio( int iSrcTrack, double dblStart, double dblEnd,
|
||||
int iDestTrack, double dblInsert, int iOption )
|
||||
{
|
||||
bool bMoveBars = iOption & OPT_BARS,
|
||||
bCountDown = false;
|
||||
|
||||
int iMode = iOption & 0x0F;
|
||||
int iStartBar = (int)dblStart,
|
||||
iEndBar = (int)dblEnd,
|
||||
iInsertBar = (int)dblInsert,
|
||||
iStartPoint = (int)( (dblStart-iStartBar) * POINTS_PER_BAR + 0.5 ),
|
||||
iEndPoint = (int)( (dblEnd-iEndBar) * POINTS_PER_BAR + 0.5 ),
|
||||
iInsertPoint = (int)( (dblInsert-iInsertBar) * POINTS_PER_BAR + 0.5 );
|
||||
|
||||
TAudioTrack *pSrcTrack = iSrcTrack<0 ? NULL : g_aAudioTracks[iSrcTrack],
|
||||
*pDestTrack = iDestTrack<0 ? NULL : g_aAudioTracks[iDestTrack];
|
||||
|
||||
if( bMoveBars ){ //小节操作
|
||||
int nBarCount = iEndBar - iStartBar,
|
||||
iDelBar = iStartBar;
|
||||
|
||||
if( iMode==MODE_MOVE || iMode==MODE_COPY || iMode==MODE_INSERT ){
|
||||
TWaveBarList lstCopyBars;
|
||||
|
||||
for( int i=iStartBar; i<iEndBar; i++ ){
|
||||
TWaveBar* pWvBar = new TWaveBar;
|
||||
if( pSrcTrack )
|
||||
memcpy( pWvBar->aVols, pSrcTrack->lstBars[i]->aVols,
|
||||
sizeof(DWORD)*POINTS_PER_BAR );
|
||||
|
||||
lstCopyBars.push_back( pWvBar );
|
||||
}
|
||||
|
||||
InsertWaveBars( iDestTrack, iInsertBar, lstCopyBars );
|
||||
|
||||
if( iMode==MODE_MOVE && iInsertBar<iStartBar )
|
||||
iDelBar += nBarCount;
|
||||
|
||||
f_MM_AudioMove( iDestTrack, dblInsert, iSrcTrack, dblStart, dblEnd, MODE_INSERT );
|
||||
}
|
||||
|
||||
if( iMode == MODE_DELETE || iMode == MODE_MOVE ){
|
||||
RemoveWaveBars( iSrcTrack, iDelBar, nBarCount );
|
||||
|
||||
f_MM_AudioMove( -1, 0, iSrcTrack, iDelBar, iDelBar+nBarCount, MODE_DELETE );
|
||||
}
|
||||
}
|
||||
else{ //音频操作
|
||||
if( iSrcTrack==iDestTrack && iStartBar==iInsertBar && iStartPoint==iInsertPoint ) //无需移动
|
||||
return false;
|
||||
|
||||
int nPoints = (int)( (dblEnd-dblStart) * POINTS_PER_BAR + 0.5 );
|
||||
double dblDelStart = dblStart, dblDelEnd = dblEnd;
|
||||
DWORD* aWave = iMode==MODE_ERASE ? NULL : new DWORD[nPoints];
|
||||
|
||||
if( pSrcTrack ){
|
||||
int iPoint = 0;
|
||||
|
||||
for( int i=iStartBar; i<=iEndBar; i++ ){
|
||||
int iSP = 0, iEP = POINTS_PER_BAR;
|
||||
if( i==iStartBar )
|
||||
iSP = iStartPoint;
|
||||
if( i==iEndBar )
|
||||
iEP = iEndPoint;
|
||||
|
||||
if( iEP>iSP ){
|
||||
int lenP = iEP - iSP;
|
||||
if( iMode==MODE_MOVE || iMode==MODE_COPY )
|
||||
memcpy( aWave + iPoint, pSrcTrack->lstBars[i]->aVols + iSP,
|
||||
sizeof(DWORD) * lenP );
|
||||
|
||||
if( iMode==MODE_MOVE || iMode==MODE_ERASE )
|
||||
memset( pSrcTrack->lstBars[i]->aVols + iSP, 0,
|
||||
sizeof(DWORD) * lenP );
|
||||
|
||||
iPoint += lenP;
|
||||
}
|
||||
else{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( iMode==MODE_MOVE || iMode==MODE_COPY ){
|
||||
if( iDestTrack==0 ){ //处理增加长度
|
||||
double dblMinLen = dblInsert + dblEnd - dblStart;
|
||||
if( dblMinLen > pDestTrack->lstBars.size() ){
|
||||
int nBars = (int)dblMinLen;
|
||||
if( dblMinLen - nBars > 0 )
|
||||
nBars++;
|
||||
|
||||
for( int i=pDestTrack->lstBars.size(); i<nBars; i++ ){
|
||||
TWaveBar* pWvBar = new TWaveBar;
|
||||
pDestTrack->lstBars.push_back( pWvBar );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int iPoint = 0;
|
||||
while( iPoint<nPoints ){
|
||||
int iSP = 0, iEP = POINTS_PER_BAR;
|
||||
|
||||
if( iInsertPoint>0 ){
|
||||
iSP = iInsertPoint;
|
||||
|
||||
if( iSP + nPoints - iPoint < POINTS_PER_BAR )
|
||||
iEP = iSP + nPoints - iPoint;
|
||||
}
|
||||
else if( nPoints-iPoint < POINTS_PER_BAR ){
|
||||
iEP = nPoints - iPoint;
|
||||
}
|
||||
|
||||
if( iEP > iSP ){
|
||||
int lenP = iEP - iSP;
|
||||
memcpy( pDestTrack->lstBars[iInsertBar]->aVols + iInsertPoint,
|
||||
aWave + iPoint, sizeof(DWORD) * lenP );
|
||||
|
||||
iInsertPoint = 0;
|
||||
iInsertBar++;
|
||||
iPoint += lenP;
|
||||
}
|
||||
else{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
delete[] aWave;
|
||||
}
|
||||
|
||||
f_MM_AudioMove( iDestTrack, dblInsert, iSrcTrack, dblStart, dblEnd, iMode );
|
||||
|
||||
if( g_iSelAudio==0 )
|
||||
PostMessage( Application->MainForm->Handle, UM_AUTORECOGNITION, iMode, 0 );
|
||||
}
|
||||
|
||||
return bCountDown;
|
||||
}
|
||||
|
||||
int CopyWave( int iTrack, int iStartBar, int iStartPoint,
|
||||
int iEndBar, int iEndPoint, DWORD** aWave )
|
||||
{
|
||||
bool bT2A = *aWave==NULL;
|
||||
int nSelPoints = ( iEndBar - iStartBar - 1) * POINTS_PER_BAR
|
||||
+ (POINTS_PER_BAR - iStartPoint) + iEndPoint;
|
||||
|
||||
if( bT2A ){
|
||||
*aWave = new DWORD[nSelPoints];
|
||||
}
|
||||
|
||||
TAudioTrack* pTrack = g_aAudioTracks[iTrack];
|
||||
int iPoint = 0;
|
||||
|
||||
for( int i=iStartBar; i<=iEndBar; i++ ){
|
||||
int iSP = 0, iEP = POINTS_PER_BAR;
|
||||
if( i==iStartBar )
|
||||
iSP = iStartPoint;
|
||||
if( i==iEndBar )
|
||||
iEP = iEndPoint;
|
||||
|
||||
if( iEP>iSP ){
|
||||
char *pSrc = (char*)( bT2A ? pTrack->lstBars[i]->aVols+iSP : (*aWave)+iPoint ),
|
||||
*pDest = (char*)( bT2A ? (*aWave)+iPoint : pTrack->lstBars[i]->aVols+iSP );
|
||||
|
||||
memcpy( pDest, pSrc, sizeof(DWORD) * ( iEP - iSP ));
|
||||
|
||||
iPoint += iEP - iSP;
|
||||
}
|
||||
else{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return nSelPoints;
|
||||
}
|
||||
|
||||
void RemoveWaveBars( int iTrack, int iStartBar, int nDelBars )
|
||||
{
|
||||
TAudioTrack* pTrack = g_aAudioTracks[iTrack];
|
||||
|
||||
for( int i=0; i<nDelBars; i++ ){
|
||||
delete pTrack->lstBars[iStartBar];
|
||||
pTrack->lstBars.erase( pTrack->lstBars.begin()+iStartBar );
|
||||
}
|
||||
}
|
||||
|
||||
void InsertWaveBars( int iTrack, int iInsertBar, TWaveBarList lstBars )
|
||||
{
|
||||
TAudioTrack* pTrack = g_aAudioTracks[iTrack];
|
||||
|
||||
if( pTrack->lstBars.size()>0 && iInsertBar < pTrack->lstBars.size() ){
|
||||
for( int i=lstBars.size()-1; i>=0; i-- ){
|
||||
pTrack->lstBars.insert( pTrack->lstBars.begin()+iInsertBar, lstBars[i] );
|
||||
}
|
||||
}
|
||||
else{
|
||||
for( int i=0; i<lstBars.size(); i++ ){
|
||||
pTrack->lstBars.push_back( lstBars[i] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RestoreWaveBars( int iInsBar, int nBars, DWORD* aWave )
|
||||
{
|
||||
int nPoints = nBars * POINTS_PER_BAR;
|
||||
|
||||
for( int i=1; i<g_aAudioTracks.size(); i++ ){
|
||||
DWORD* pW = aWave ? aWave + nPoints * ( i - 1 ) : NULL;
|
||||
TWaveBarList lstWaveBars;
|
||||
|
||||
for( int j=0; j<nBars; j++ ){
|
||||
TWaveBar* pWvBar = new TWaveBar;
|
||||
|
||||
if( pW )
|
||||
memcpy( pWvBar->aVols, pW + j * POINTS_PER_BAR,
|
||||
sizeof(DWORD)*POINTS_PER_BAR );
|
||||
|
||||
lstWaveBars.push_back( pWvBar );
|
||||
}
|
||||
|
||||
InsertWaveBars( i, iInsBar, lstWaveBars );
|
||||
}
|
||||
}
|
||||
|
||||
TAudioTrack* CopyAudioTrack( int iTrack, int iStartBar, int nCopyBars )
|
||||
{
|
||||
TAudioTrack* pSrcTrack = g_aAudioTracks[iTrack],
|
||||
*pDestTrack = new TAudioTrack(pSrcTrack);
|
||||
|
||||
for( int i=0; i<nCopyBars; i++ ){
|
||||
TWaveBar* pWvBar = new TWaveBar;
|
||||
memcpy( pWvBar->aVols, pSrcTrack->lstBars[iStartBar+i],
|
||||
sizeof(DWORD)*POINTS_PER_BAR );
|
||||
pDestTrack->lstBars.push_back( pWvBar );
|
||||
}
|
||||
|
||||
return pDestTrack;
|
||||
}
|
||||
|
||||
void InsertAudioTrack( int iTrack, int iInsertBar, int nBars, TAudioTrack* pSrcTrack, int iStartBar )
|
||||
{
|
||||
TAudioTrack* pDestTrack = g_aAudioTracks[iTrack];
|
||||
|
||||
if( pDestTrack->lstBars.size()>0 && iInsertBar < pDestTrack->lstBars.size() ){
|
||||
for( int i=nBars-1; i>=0; i-- ){
|
||||
TWaveBar* pWvBar = new TWaveBar;
|
||||
|
||||
if( pSrcTrack )
|
||||
memcpy( pWvBar->aVols, pSrcTrack->lstBars[iStartBar+i], sizeof(DWORD)*POINTS_PER_BAR );
|
||||
|
||||
pDestTrack->lstBars.insert( pDestTrack->lstBars.begin()+iInsertBar, pWvBar );
|
||||
}
|
||||
}
|
||||
else{
|
||||
for( int i=0; i<nBars; i++ ){
|
||||
TWaveBar* pWvBar = new TWaveBar;
|
||||
|
||||
if( pSrcTrack )
|
||||
memcpy( pWvBar->aVols, pSrcTrack->lstBars[iStartBar+i], sizeof(DWORD)*POINTS_PER_BAR );
|
||||
|
||||
pDestTrack->lstBars.push_back( pWvBar );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef AudioTrackH
|
||||
#define AudioTrackH
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#include "FxDef.h"
|
||||
#include "BaseTrack.h"
|
||||
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
|
||||
#define MODE_INIT 0
|
||||
#define MODE_CHANGE 1
|
||||
#define MODE_INSERT 2
|
||||
#define MODE_DELETE 3 //删除小节
|
||||
#define MODE_MOVE 4 //移动(小节/音频)
|
||||
#define MODE_COPY 5 //复制(小节/音频)
|
||||
#define MODE_ERASE 6 //擦除音频
|
||||
#define MODE_LOAD 7
|
||||
#define MODE_RECORD 8
|
||||
#define MODE_RELOAD 9
|
||||
#define OPT_BARS 0x10
|
||||
|
||||
#define POINTS_PER_BAR 120
|
||||
#define MAX_AUDIOTRACK 17
|
||||
|
||||
typedef struct tagWaveBar //波形小节
|
||||
{
|
||||
//每小节最多POINTS_PER_BAR个音量值
|
||||
DWORD aVols[POINTS_PER_BAR];
|
||||
|
||||
tagWaveBar()
|
||||
{
|
||||
memset( this, 0, sizeof(tagWaveBar) );
|
||||
}
|
||||
|
||||
tagWaveBar( tagWaveBar* pSrc )
|
||||
{
|
||||
memcpy( this, pSrc, sizeof(tagWaveBar));
|
||||
}
|
||||
} TWaveBar;
|
||||
|
||||
typedef vector<TWaveBar*> TWaveBarList;
|
||||
typedef vector<TAudioFx*> TAudioFxList;
|
||||
|
||||
class TAudioTrack : public TBaseTrack
|
||||
{
|
||||
public:
|
||||
TWaveBarList lstBars;
|
||||
TAudioFxList lstFxs;
|
||||
|
||||
TAudioTrack() : TBaseTrack()
|
||||
{
|
||||
}
|
||||
|
||||
TAudioTrack( TAudioTrack* pSrc ) : TBaseTrack( pSrc->state, pSrc->volume, pSrc->pan, pSrc->gain )
|
||||
{
|
||||
}
|
||||
|
||||
~TAudioTrack()
|
||||
{
|
||||
while( !lstBars.empty() ){
|
||||
delete lstBars.back();
|
||||
lstBars.pop_back();
|
||||
}
|
||||
|
||||
while( !lstFxs.empty() ){
|
||||
delete lstFxs.back();
|
||||
lstFxs.pop_back();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
typedef vector<TAudioTrack*> TAudioTrackList;
|
||||
|
||||
class TAudio
|
||||
{
|
||||
private:
|
||||
TAudioTrackList m_lstTracks;
|
||||
|
||||
public:
|
||||
TAudioTrackList& AudioTracks() { return m_lstTracks; };
|
||||
void CopyTrackList( int iStartBar, int nCopyBars, TAudioTrackList* lstAudio, bool bFx=false );
|
||||
TAudioTrack* CopyTrack( int iTrack, int iStartBar, int nCopyBars, bool bFx=false,
|
||||
TAudioTrack* pDest=NULL );
|
||||
void ResetTracks( TAudioTrackList* lstAudio );
|
||||
void RestoreAudio( TOpusStageList* lstStages, TAudioTrackList* lstAudio, bool bUndo );
|
||||
bool Empty(){ return m_lstTracks.size()==1 && m_lstTracks[0]->lstBars.empty(); };
|
||||
|
||||
void WriteProj( FILE* pFile );
|
||||
int ReadProj( FILE* pFile, DWORD dwVersion );
|
||||
|
||||
TAudio() {
|
||||
m_lstTracks.push_back( new TAudioTrack );
|
||||
};
|
||||
|
||||
~TAudio(){
|
||||
while( m_lstTracks.size()>0 ){
|
||||
delete m_lstTracks.back();
|
||||
m_lstTracks.pop_back();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
extern TAudio g_Audio;
|
||||
extern int g_iSelAudio; //当前处理的音轨
|
||||
extern TAudioTrackList& g_aAudioTracks; //全曲音频轨道(最大4组)
|
||||
|
||||
/////////////////////////////////////////////
|
||||
//兼容早期版本
|
||||
typedef struct tagEffect
|
||||
{
|
||||
int iBarStart, iBarEnd;
|
||||
int iPointStart, iPointEnd;
|
||||
bool bOn;
|
||||
int iPreset;
|
||||
float *aParams;
|
||||
tagEffect* pNext;
|
||||
|
||||
tagEffect(){
|
||||
memset( this, 0, sizeof(tagEffect) );
|
||||
iPreset = -1;
|
||||
}
|
||||
|
||||
tagEffect( tagEffect* pSrc ){
|
||||
pNext = NULL;
|
||||
iBarStart = pSrc->iBarStart;
|
||||
iBarEnd = pSrc->iBarEnd;
|
||||
iPointStart = pSrc->iPointStart;
|
||||
iPointEnd = pSrc->iPointEnd;
|
||||
iPreset = pSrc->iPreset;
|
||||
bOn = pSrc->bOn;
|
||||
if( pSrc->aParams ){
|
||||
aParams = new float[6];
|
||||
memcpy( aParams, pSrc->aParams, sizeof(float)*6 );
|
||||
}
|
||||
}
|
||||
|
||||
~tagEffect(){
|
||||
if( aParams )
|
||||
delete aParams;
|
||||
}
|
||||
}TEffect, *PTEffect;
|
||||
//
|
||||
//////////////////////////////////////////////
|
||||
/***************************************************************************************/
|
||||
// 全局函数
|
||||
/***************************************************************************************/
|
||||
TAudioTrack* NewAudioTrack( int nBar, bool bAddUndo=true );
|
||||
void DeleteAudioTrack( int iTrack, bool bAddUndo=true );
|
||||
void DuplicateRawBars();
|
||||
TAudioTrack* DuplicateAudioTrack( TAudioTrack* pSrc );
|
||||
bool MoveAudio( int iSrcTrack, double dblStart, double dblEnd,
|
||||
int iDestTrack, double dblInsert, int iOption ); //返回:是否刷新整个音轨
|
||||
//int GetShowWave( int iTrack ); //获取当前显示的音轨
|
||||
int CopyWave( int iTrack, int iStartBar, int iStartPoint,
|
||||
int iEndBar, int iEndPoint, DWORD** aWave ); //复制波形
|
||||
void RemoveWaveBars( int iTrack, int iStartBar, int nDelBars );
|
||||
void InsertWaveBars( int iTrack, int iInsertBar, TWaveBarList lstCopyBars );
|
||||
void RestoreWaveBars( int iInsBar, int nBars, DWORD* aWave );
|
||||
TAudioTrack* CopyAudioTrack( int iTrack, int iStartBar, int nCopyBars );
|
||||
void InsertAudioTrack( int iTrack, int iInsertBar, int nBars, TAudioTrack* pSrcTrack, int iStartBar=0 );
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
@@ -0,0 +1,108 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "BKGMemoUnit.h"
|
||||
#include "GlobalUnit.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
static const COLORREF
|
||||
CLR_BKG = RGB(228, 232, 237);//168, 180, 196);
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall BKGMemoUnit::TMemo::TMemo(System::Classes::TComponent* AOwner)
|
||||
: Vcl::Stdctrls::TMemo(AOwner)
|
||||
{
|
||||
ControlStyle >> csOpaque;
|
||||
|
||||
// FTransparent = true;
|
||||
m_pbmpBkg = new TBitmap();
|
||||
|
||||
//ÉèÖñÊË¢£¬ÓÃ×÷±³¾°
|
||||
m_pbmpBkg->Width = 2;
|
||||
m_pbmpBkg->Height = 2;
|
||||
|
||||
m_pbmpBkg->Canvas->Brush->Color = CLR_BKG;
|
||||
m_pbmpBkg->Canvas->Pen->Color = CLR_BKG;
|
||||
m_pbmpBkg->Canvas->Rectangle(0, 0, m_pbmpBkg->Width, m_pbmpBkg->Height);
|
||||
|
||||
Brush->Bitmap = m_pbmpBkg;
|
||||
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall BKGMemoUnit::TMemo::~TMemo()
|
||||
{
|
||||
if(m_pbmpBkg)
|
||||
delete m_pbmpBkg;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall BKGMemoUnit::TMemo::CreateWnd(void)
|
||||
{
|
||||
Vcl::Stdctrls::TMemo::CreateWnd();
|
||||
|
||||
if( FTransparent ){
|
||||
SetWindowLong( Parent->Handle, GWL_STYLE,
|
||||
GetWindowLong(Parent->Handle, GWL_STYLE) & ~WS_CLIPCHILDREN );
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall BKGMemoUnit::TMemo::CreateParams(Vcl::Controls::TCreateParams &Params)
|
||||
{
|
||||
Vcl::Stdctrls::TMemo::CreateParams( Params );
|
||||
Params.ExStyle |= WS_EX_TRANSPARENT;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall BKGMemoUnit::TMemo::Invalidate()
|
||||
{
|
||||
if( FTransparent )
|
||||
SendMessage( Handle, UM_TEINVALIDATE, 0, 0 );
|
||||
else
|
||||
Vcl::Stdctrls::TMemo::Invalidate();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall BKGMemoUnit::TMemo::WMEraseBkgnd(TWMEraseBkgnd &Message)
|
||||
{
|
||||
|
||||
if( Parent && FTransparent )
|
||||
PostMessage( Handle, UM_TEINVALIDATE, 0, 0 );
|
||||
else
|
||||
DefaultHandler( &Message );
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall BKGMemoUnit::TMemo::CNCtlColorEdit(TWMCtlColorEdit &Message)
|
||||
{
|
||||
if( FTransparent ){
|
||||
|
||||
SetBkColor(Message.ChildDC, CLR_BKG);
|
||||
// SetBkMode( Message.ChildDC, TRANSPARENT);
|
||||
Font->Size = 8;
|
||||
Message.Result = (int)Brush->Handle;
|
||||
}
|
||||
else
|
||||
DefaultHandler( &Message );
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall BKGMemoUnit::TMemo::TEInvalidate(TMessage &Message)
|
||||
{
|
||||
if( Parent && FTransparent ){
|
||||
TRect r = GetClientRect();
|
||||
TPoint& pTL = r.TopLeft();
|
||||
pTL = Parent->ScreenToClient( ClientToScreen(pTL) );
|
||||
TPoint& pBR = r.BottomRight();
|
||||
pBR = Parent->ScreenToClient( ClientToScreen(pBR) );
|
||||
|
||||
RedrawWindow( Handle, &r, 0, RDW_FRAME|RDW_INVALIDATE );
|
||||
}
|
||||
else
|
||||
Vcl::Stdctrls::TMemo::Invalidate();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#ifndef BKGMemoUnitH
|
||||
#define BKGMemoUnitH
|
||||
|
||||
#define UM_TEINVALIDATE WM_USER + 0x1003
|
||||
#include "SkinScrollBarUnit.h"
|
||||
|
||||
namespace BKGMemoUnit
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
class TMemo : public Stdctrls::TMemo
|
||||
{
|
||||
private:
|
||||
|
||||
TBitmap *m_pbmpBkg;
|
||||
bool FTransparent;
|
||||
|
||||
MESSAGE void __fastcall WMEraseBkgnd(TWMEraseBkgnd &Message);
|
||||
MESSAGE void __fastcall CNCtlColorEdit(TWMCtlColorEdit &Message);
|
||||
MESSAGE void __fastcall TEInvalidate(TMessage &Message);
|
||||
|
||||
BEGIN_MESSAGE_MAP
|
||||
MESSAGE_HANDLER(WM_ERASEBKGND, TWMEraseBkgnd, WMEraseBkgnd)
|
||||
MESSAGE_HANDLER(CN_CTLCOLOREDIT, TWMCtlColorEdit, CNCtlColorEdit)
|
||||
MESSAGE_HANDLER(UM_TEINVALIDATE, TMessage, TEInvalidate)
|
||||
END_MESSAGE_MAP(Vcl::Stdctrls::TMemo)
|
||||
|
||||
protected:
|
||||
virtual void __fastcall CreateWnd();
|
||||
virtual void __fastcall CreateParams(Vcl::Controls::TCreateParams &Params);
|
||||
|
||||
public:
|
||||
__fastcall virtual TMemo(System::Classes::TComponent* AOwner);
|
||||
__fastcall ~TMemo();
|
||||
|
||||
virtual void __fastcall Invalidate();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
using namespace BKGMemoUnit;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,197 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "GlobalUnit.h"
|
||||
#include "MidiTrack.h"
|
||||
#include "AudioTrack.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
bool IsTrackMute( int iType, int iTrack )
|
||||
{
|
||||
TBaseTrack* pBase = iType==ST_MIDI ? (TBaseTrack*)g_aMidiTracks[iTrack]
|
||||
: (TBaseTrack*)g_aAudioTracks[iTrack];
|
||||
|
||||
if( pBase->IsMute() )
|
||||
return true;
|
||||
else if( !pBase->IsSolo() ){
|
||||
for( int i=0; i<g_aMidiTracks.size(); i++ ){
|
||||
if( g_aMidiTracks[i]->IsSolo() )
|
||||
return true;
|
||||
}
|
||||
|
||||
int iATStart = g_iPreStage==0 ? 0 : 1,
|
||||
iATEnd = g_iPreStage==0 ? 1 : g_aAudioTracks.size();
|
||||
|
||||
for( int i=iATStart; i<iATEnd; i++ ){
|
||||
if( g_aAudioTracks[i]->IsSolo() )
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void SetTrackParams( bool bSolo )
|
||||
{
|
||||
vector<TBaseTrack*> aSoloTracks;
|
||||
|
||||
int iATStart = g_iPreStage==0 ? 0 : 1,
|
||||
iATEnd = g_iPreStage==0 ? 1 : g_aAudioTracks.size();
|
||||
|
||||
if( bSolo ){
|
||||
for( int i=iATStart; i<iATEnd; i++ ){
|
||||
if( g_aAudioTracks[i]->IsSolo() )
|
||||
aSoloTracks.push_back( g_aAudioTracks[i] );
|
||||
}
|
||||
for( int i=0; i<g_aMidiTracks.size(); i++ ){
|
||||
if( g_aMidiTracks[i]->IsSolo() )
|
||||
aSoloTracks.push_back( g_aMidiTracks[i] );
|
||||
}
|
||||
}
|
||||
|
||||
for( int i=iATStart; i<iATEnd; i++ ){
|
||||
TAudioTrack* pAT = g_aAudioTracks[i];
|
||||
|
||||
if( pAT->IsMute() || !aSoloTracks.empty() && !pAT->IsSolo() )
|
||||
f_MM_SetAudioTrackParam( i, 0, 0 );
|
||||
else
|
||||
f_MM_SetAudioTrackParam( i, 0, (float)(pAT->volume / 100.0) );
|
||||
|
||||
f_MM_SetAudioTrackParam( i, 1, (float)(pAT->pan / 100.0) );
|
||||
f_MM_SetAudioTrackParam( i, 2, (float)(pAT->gain / 100.0) );
|
||||
}
|
||||
for( int i=0; i<g_aMidiTracks.size(); i++ ){
|
||||
TMidiTrack* pMT = g_aMidiTracks[i];
|
||||
|
||||
if( pMT->IsMute() || !aSoloTracks.empty() && !pMT->IsSolo() )
|
||||
f_MM_SetMidiTrackParam( pMT->file, pMT->chno, 0, 0 );
|
||||
else{
|
||||
f_MM_SetMidiTrackParam( pMT->file, pMT->chno, 0, pMT->volume );
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void ChangeTrackState( int iType, int iTrack, int iState, bool& bSet, bool& bUnset )
|
||||
{
|
||||
TBaseTrack* pBaseTrk = iType==ST_AUDIO ? (TBaseTrack*)g_aAudioTracks[iTrack]
|
||||
: (TBaseTrack*)g_aMidiTracks[iTrack];
|
||||
int iATStart = g_iPreStage==0 ? 0 : 1,
|
||||
iATEnd = g_iPreStage==0 ? 1 : g_aAudioTracks.size();
|
||||
|
||||
bSet = !(pBaseTrk->state & iState);
|
||||
|
||||
vector<TBaseTrack*> aSoloTracks;
|
||||
for( int i=iATStart; i<iATEnd; i++ ){
|
||||
if( g_aAudioTracks[i]->IsSolo() )
|
||||
aSoloTracks.push_back( g_aAudioTracks[i] );
|
||||
}
|
||||
for( int i=0; i<g_aMidiTracks.size(); i++ ){
|
||||
if( g_aMidiTracks[i]->IsSolo() )
|
||||
aSoloTracks.push_back( g_aMidiTracks[i] );
|
||||
}
|
||||
|
||||
if( aSoloTracks.empty() ){
|
||||
if( iState==TRACK_MUTE ){
|
||||
if( iType==ST_AUDIO ){
|
||||
f_MM_SetAudioTrackParam( iTrack, 0, bSet ? 0 : pBaseTrk->volume / 100.0 );
|
||||
}
|
||||
else{
|
||||
TMidiTrack* pMT = (TMidiTrack*)pBaseTrk;
|
||||
f_MM_SetMidiTrackParam( pMT->file, pMT->chno, 0, bSet ? 0 : pMT->volume );
|
||||
}
|
||||
|
||||
pBaseTrk->Mute( bSet );
|
||||
}
|
||||
else{
|
||||
for( int i=iATStart; i<iATEnd; i++ ){
|
||||
if( g_aAudioTracks[i]==pBaseTrk ){
|
||||
if( pBaseTrk->IsMute() ){
|
||||
f_MM_SetAudioTrackParam( i, 0, pBaseTrk->volume / 100.0 );
|
||||
pBaseTrk->Mute( false );
|
||||
bUnset = true;
|
||||
}
|
||||
}
|
||||
else{
|
||||
f_MM_SetAudioTrackParam( i, 0, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
for( int i=0; i<g_aMidiTracks.size(); i++ ){
|
||||
TMidiTrack* pMT = g_aMidiTracks[i];
|
||||
if( pMT==pBaseTrk ){
|
||||
if( pBaseTrk->IsMute() ){
|
||||
f_MM_SetMidiTrackParam( pMT->file, pMT->chno, 0, pMT->volume );
|
||||
|
||||
pMT->Mute( false );
|
||||
bUnset = true;
|
||||
}
|
||||
}
|
||||
else{
|
||||
f_MM_SetMidiTrackParam( pMT->file, pMT->chno, 0, 0 );
|
||||
DebugPrint( "Midi mute file %d, chno %d\n", pMT->file, pMT->chno );
|
||||
}
|
||||
}
|
||||
|
||||
pBaseTrk->Solo();
|
||||
}
|
||||
}
|
||||
else if( pBaseTrk->IsSolo() ){
|
||||
if( iState==TRACK_MUTE || aSoloTracks.size()>1 ){
|
||||
if( iType==ST_AUDIO )
|
||||
f_MM_SetAudioTrackParam( iTrack, 0, 0 );
|
||||
else{
|
||||
TMidiTrack* pMT = (TMidiTrack*)pBaseTrk;
|
||||
f_MM_SetMidiTrackParam( pMT->file, pMT->chno, 0, 0 );
|
||||
}
|
||||
|
||||
if( iState==TRACK_MUTE ){
|
||||
pBaseTrk->Mute();
|
||||
bUnset = true;
|
||||
}
|
||||
}
|
||||
|
||||
if( aSoloTracks.size()==1 ){
|
||||
for( int i=iATStart; i<iATEnd; i++ ){
|
||||
if( !g_aAudioTracks[i]->IsMute() ){
|
||||
f_MM_SetAudioTrackParam( i, 0, g_aAudioTracks[i]->volume / 100.0 );
|
||||
}
|
||||
}
|
||||
for( int i=0; i<g_aMidiTracks.size(); i++ ){
|
||||
TMidiTrack* pMT = g_aMidiTracks[i];
|
||||
if( !pMT->IsMute() ){
|
||||
f_MM_SetMidiTrackParam( pMT->file, pMT->chno, 0, pMT->volume );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pBaseTrk->Solo( false );
|
||||
}
|
||||
else{
|
||||
if( iState==TRACK_MUTE ){
|
||||
pBaseTrk->Mute( bSet );
|
||||
}
|
||||
else{
|
||||
if( iType==ST_AUDIO ){
|
||||
f_MM_SetAudioTrackParam( iTrack, 0, bSet ? pBaseTrk->volume / 100.0 : 0 );
|
||||
}
|
||||
else{
|
||||
TMidiTrack* pMT = (TMidiTrack*)pBaseTrk;
|
||||
f_MM_SetMidiTrackParam( pMT->file, pMT->chno, 0, bSet ? pMT->volume : 0 );
|
||||
}
|
||||
|
||||
pBaseTrk->Solo( bSet );
|
||||
|
||||
if( bSet && pBaseTrk->IsMute() ){
|
||||
pBaseTrk->Mute( false );
|
||||
bUnset = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef BaseTrackH
|
||||
#define BaseTrackH
|
||||
//---------------------------------------------------------------------------
|
||||
#define TRACK_NORMAL 0x00
|
||||
#define TRACK_MUTE 0x01
|
||||
#define TRACK_SOLO 0x02
|
||||
#define TRACK_HIDE 0x04
|
||||
|
||||
#define ST_MIDI 0
|
||||
#define ST_AUDIO 1
|
||||
|
||||
class TBaseTrack
|
||||
{
|
||||
public:
|
||||
BYTE state;
|
||||
BYTE volume;
|
||||
char pan;
|
||||
char gain;
|
||||
|
||||
TBaseTrack()
|
||||
{
|
||||
state = TRACK_NORMAL;
|
||||
volume = 100;
|
||||
pan = gain = 0;
|
||||
};
|
||||
|
||||
TBaseTrack( BYTE s, BYTE v, char p, char g )
|
||||
{
|
||||
state = s;
|
||||
volume = v;
|
||||
pan = p;
|
||||
gain = g;
|
||||
}
|
||||
|
||||
bool IsMute(){ return state & TRACK_MUTE; };
|
||||
bool IsSolo(){ return state & TRACK_SOLO; };
|
||||
bool IsHide(){ return state & TRACK_HIDE; };
|
||||
void Mute( bool bMute=true ) { if( bMute ) state |= TRACK_MUTE; else state &= ~TRACK_MUTE; };
|
||||
void Solo( bool bSolo=true ) { if( bSolo ) state |= TRACK_SOLO; else state &= ~TRACK_SOLO; };
|
||||
void Hide( bool bHide=true ) { if( bHide ) state |= TRACK_HIDE; else state &= ~TRACK_HIDE; };
|
||||
|
||||
};
|
||||
|
||||
void SetTrackParams( bool bSolo=true ); //bSolo£ºÊÇ·ñ¿¼ÂǶÀ×à״̬
|
||||
bool IsTrackMute( int iType, int iTrack );
|
||||
void ChangeTrackState( int iType, int iTrack, int iState, bool& bSet, bool& bUnset );
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,527 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "BtnPanelUnit.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
VCTBtnPanel::iterator vc_pFindVCTBtnPanel;
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TBtnPanel::TBtnPanel(TWinControl *pTWnCtl)
|
||||
: TComponent(pTWnCtl)
|
||||
{
|
||||
m_pTWnCtl = pTWnCtl;
|
||||
|
||||
m_pAppEvents = new TApplicationEvents(this);
|
||||
m_pAppEvents->OnMessage = OnAppEvents;
|
||||
|
||||
|
||||
m_bPalEn = false;
|
||||
m_bPalLD = false;
|
||||
m_bPalRD = false;
|
||||
|
||||
m_bBtnEn = m_bBtnLD = m_bBtnRD = false;
|
||||
m_pParentBtn = NULL;
|
||||
|
||||
FLeft = FTop = FWidth = FHeight = 0;
|
||||
FEnabled = true;
|
||||
FDown = false;
|
||||
FStateEnter = true;
|
||||
FStateCount = 3;
|
||||
FBtnCurState = Bs_NORMAL;
|
||||
FTransparent = false;
|
||||
FTransparentValue = 255;
|
||||
|
||||
m_BtnCurStateBac = Bs_NORMAL;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TBtnPanel::~TBtnPanel()
|
||||
{
|
||||
SAFE_DELETE(m_pAppEvents)
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
bool __fastcall TBtnPanel::IsPtInSubtn(int XPos, int YPos)
|
||||
{
|
||||
for(vc_pFindVCTBtnPanel =m_VCSubtn.begin();
|
||||
vc_pFindVCTBtnPanel!=m_VCSubtn.end();
|
||||
vc_pFindVCTBtnPanel++ )
|
||||
{
|
||||
TRect TRectTmpSubView
|
||||
= TRect((*vc_pFindVCTBtnPanel)->Left, (*vc_pFindVCTBtnPanel)->Top,
|
||||
(*vc_pFindVCTBtnPanel)->Left+(*vc_pFindVCTBtnPanel)->Width,
|
||||
(*vc_pFindVCTBtnPanel)->Top+(*vc_pFindVCTBtnPanel)->Height);
|
||||
if( PtInRect(TRectTmpSubView, TPoint(XPos, YPos) ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
bool __fastcall TBtnPanel::IsBtnHandleAppEvent(unsigned int message, int XPos, int YPos)
|
||||
{
|
||||
if( IsPtInSubtn(XPos, YPos) ) {
|
||||
|
||||
if( Bs_NORMAL==FBtnCurState )
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TBtnPanel::OnAppEvents(tagMSG &Msg, bool &Handled)
|
||||
{
|
||||
// -----
|
||||
if( false == FEnabled ||
|
||||
false == m_pTWnCtl->Enabled ||
|
||||
(false == m_bPalEn &&
|
||||
Msg.hwnd != m_pTWnCtl->Handle) )
|
||||
return;
|
||||
|
||||
if( WM_LBUTTONDOWN == Msg.message ||
|
||||
WM_LBUTTONUP == Msg.message ||
|
||||
WM_LBUTTONDBLCLK == Msg.message ||
|
||||
WM_RBUTTONDOWN == Msg.message ||
|
||||
WM_RBUTTONUP == Msg.message ||
|
||||
WM_MOUSEMOVE == Msg.message )
|
||||
{
|
||||
|
||||
}else return;
|
||||
|
||||
// -----
|
||||
TRect rtSelf = TRect(Left, Top, Left+Width, Top+Height);
|
||||
TPoint pt = m_pTWnCtl->ScreenToClient(TPoint(Msg.pt.x, Msg.pt.y));
|
||||
|
||||
TWMMouse Message;
|
||||
Message.Msg = Msg.message;
|
||||
Message.XPos = pt.x;
|
||||
Message.YPos = pt.y;
|
||||
|
||||
if( false==IsBtnHandleAppEvent(Message.Msg, Message.XPos, Message.YPos) ) return;
|
||||
|
||||
// -----
|
||||
MsState MsStatus = Ms_NONE;
|
||||
//刚离开区域
|
||||
if( m_bPalEn && !PtInRect( rtSelf, pt ) ) {
|
||||
|
||||
if( WM_MOUSEMOVE != Msg.message ) {
|
||||
|
||||
return;
|
||||
|
||||
}else if( WM_MOUSEMOVE==Msg.message ) {
|
||||
|
||||
m_bPalEn = false;
|
||||
MsStatus = Ms_LEAVE;
|
||||
BtnHandleAppEvent(MsStatus, Message.XPos, Message.YPos);
|
||||
|
||||
return;
|
||||
}
|
||||
//已经离开了区域
|
||||
} else if(!m_bPalEn && !PtInRect( rtSelf, pt ) ) {
|
||||
|
||||
if( m_bPalLD ) { //处理拖动事件
|
||||
MsStatus = Ms_DRAG;
|
||||
BtnHandleAppEvent(MsStatus, Message.XPos, Message.YPos);
|
||||
}
|
||||
|
||||
//除了 WM_LBUTTONUP WM_RBUTTONUP 都不再处理
|
||||
if((WM_LBUTTONUP != Msg.message && WM_RBUTTONUP != Msg.message) ||
|
||||
(false==m_bPalLD && WM_LBUTTONUP == Msg.message ) || //没有按下键 不再处理
|
||||
(false==m_bPalRD && WM_RBUTTONUP == Msg.message ) )
|
||||
return;
|
||||
}
|
||||
|
||||
// -----
|
||||
switch( Msg.message )
|
||||
{
|
||||
case WM_LBUTTONDOWN:
|
||||
{
|
||||
MsStatus = Ms_LDOWN;
|
||||
m_bPalLD = true;
|
||||
|
||||
} break;
|
||||
case WM_LBUTTONUP:
|
||||
{
|
||||
if( m_bPalLD ) {
|
||||
MsStatus = Ms_LUP;
|
||||
m_bPalLD = false;
|
||||
}
|
||||
|
||||
} break;
|
||||
case WM_LBUTTONDBLCLK:
|
||||
{
|
||||
MsStatus = Ms_LLDOWN;
|
||||
|
||||
} break;
|
||||
case WM_RBUTTONDOWN:
|
||||
{
|
||||
MsStatus = Ms_RDOWN;
|
||||
m_bPalRD = true;
|
||||
|
||||
} break;
|
||||
case WM_RBUTTONUP:
|
||||
{
|
||||
if(m_bPalRD) {
|
||||
|
||||
MsStatus = Ms_RUP;
|
||||
m_bPalRD = false;
|
||||
}
|
||||
|
||||
} break;
|
||||
case WM_MOUSEMOVE:
|
||||
{
|
||||
if( m_bPalEn )
|
||||
{
|
||||
if(m_bPalLD)
|
||||
MsStatus = Ms_DRAG;
|
||||
else
|
||||
MsStatus = Ms_MOVE;
|
||||
|
||||
}else MsStatus = Ms_ENTER;
|
||||
|
||||
m_bPalEn = true;
|
||||
|
||||
} break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
if(Ms_NONE!=MsStatus ) BtnHandleAppEvent(MsStatus, Message.XPos, Message.YPos);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TBtnPanel::BtnHandleAppEvent(MsState MsSrcTmp, int XPos, int YPos)
|
||||
{
|
||||
MsState MsTmp = Ms_NONE;
|
||||
BtnState BsTmp = Bs_NONE;
|
||||
|
||||
switch( MsSrcTmp )
|
||||
{
|
||||
case Ms_LDOWN:
|
||||
{
|
||||
m_bBtnLD = true;
|
||||
BsTmp = Bs_DOWN;
|
||||
FBtnCurState = BsTmp;
|
||||
|
||||
MsTmp = Ms_LDOWN;
|
||||
|
||||
} break;
|
||||
case Ms_LLDOWN:
|
||||
{
|
||||
MsTmp = Ms_LLDOWN;
|
||||
|
||||
} break;
|
||||
case Ms_LUP:
|
||||
{
|
||||
m_bBtnLD = false;
|
||||
if( PtInRect( TRect(Left, Top, Left+Width, Top+Height),
|
||||
TPoint(XPos, YPos) ) )
|
||||
BsTmp = Bs_ENTER;
|
||||
else
|
||||
BsTmp = Bs_NORMAL;
|
||||
FBtnCurState = BsTmp;
|
||||
|
||||
MsTmp = Ms_LUP;
|
||||
|
||||
} break;
|
||||
case Ms_RDOWN:
|
||||
{
|
||||
MsTmp = Ms_RDOWN;
|
||||
|
||||
} break;
|
||||
case Ms_RUP:
|
||||
{
|
||||
MsTmp = Ms_RUP;
|
||||
|
||||
} break;
|
||||
case Ms_ENTER:
|
||||
{
|
||||
if( true!=m_bBtnLD ) {
|
||||
|
||||
m_bBtnEn = true;
|
||||
BsTmp = Bs_ENTER;
|
||||
FBtnCurState = BsTmp;
|
||||
|
||||
MsTmp = Ms_ENTER;
|
||||
}
|
||||
} break;
|
||||
case Ms_LEAVE:
|
||||
{
|
||||
if( true!=m_bBtnLD ) {
|
||||
|
||||
m_bBtnEn = false;
|
||||
BsTmp = Bs_NORMAL;
|
||||
FBtnCurState = BsTmp;
|
||||
|
||||
MsTmp = Ms_LEAVE;
|
||||
}
|
||||
|
||||
} break;
|
||||
case Ms_MOVE:
|
||||
{
|
||||
if( m_bBtnEn ) {
|
||||
|
||||
bool bIsPtInSubtn = IsPtInSubtn(XPos, YPos);
|
||||
if( bIsPtInSubtn ) {
|
||||
|
||||
m_bBtnEn = false;
|
||||
BsTmp = Bs_NORMAL;
|
||||
FBtnCurState = BsTmp;
|
||||
|
||||
MsTmp = Ms_LEAVE;
|
||||
|
||||
}else {
|
||||
|
||||
MsTmp = Ms_MOVE;
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
m_bBtnEn = true;
|
||||
BsTmp = Bs_ENTER;
|
||||
FBtnCurState = BsTmp;
|
||||
|
||||
MsTmp = Ms_ENTER;
|
||||
}
|
||||
|
||||
} break;
|
||||
case Ms_DRAG:
|
||||
{
|
||||
MsTmp = Ms_DRAG;
|
||||
|
||||
} break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
if( Ms_NONE != MsTmp ) BtnMsEvent(MsTmp, XPos, YPos);
|
||||
if( Bs_NONE != BsTmp ) BtnDrEvent(FBtnCurState, XPos, YPos);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TBtnPanel::BtnHandleState()
|
||||
{
|
||||
BtnState BtnStateTmp = this->FBtnCurState;
|
||||
if( false==m_pTWnCtl->Enabled ||
|
||||
false==FEnabled ) {
|
||||
|
||||
BtnStateTmp = Bs_DISABLE;
|
||||
|
||||
}else {
|
||||
|
||||
if( false==FStateEnter && Bs_ENTER==this->FBtnCurState )
|
||||
BtnStateTmp = Bs_NORMAL;
|
||||
|
||||
if( FDown ) BtnStateTmp = Bs_DOWN;
|
||||
|
||||
if( FStateCount<=BtnStateTmp ) BtnStateTmp = FStateCount-1;
|
||||
}
|
||||
|
||||
m_BtnCurStateBac = FBtnCurState = BtnStateTmp;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TBtnPanel::BtnDrEvent(BtnState BsTmp, int XPos, int YPos)
|
||||
{
|
||||
if( Bs_DOWN == BsTmp ||
|
||||
Bs_ENTER == BsTmp ||
|
||||
Bs_NORMAL == BsTmp )
|
||||
{
|
||||
int BtnCurStateBac = m_BtnCurStateBac;
|
||||
BtnHandleState();
|
||||
if( BtnCurStateBac==m_BtnCurStateBac ) return;
|
||||
|
||||
Paint();
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TBtnPanel::BtnMsEvent(MsState MsTmp, int XPos, int YPos)
|
||||
{
|
||||
if( Ms_LDOWN == MsTmp ||
|
||||
Ms_LUP == MsTmp ||
|
||||
Ms_LLDOWN == MsTmp ||
|
||||
Ms_RDOWN == MsTmp ||
|
||||
Ms_RUP == MsTmp ||
|
||||
Ms_ENTER == MsTmp ||
|
||||
Ms_LEAVE == MsTmp ||
|
||||
Ms_MOVE == MsTmp ||
|
||||
Ms_DRAG == MsTmp )
|
||||
{
|
||||
if( OnPanelMsEvent ) OnPanelMsEvent(MsTmp, XPos, YPos);
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TBtnPanel::AddSubPanel(TBtnPanel *pTBtnPanel)
|
||||
{
|
||||
m_VCSubtn.push_back(pTBtnPanel);
|
||||
pTBtnPanel->m_pParentBtn = this;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TBtnPanel::SetBounds(int nLeft, int nTop, int nWidth, int nHeight)
|
||||
{
|
||||
FLeft = nLeft;
|
||||
FTop = nTop;
|
||||
FWidth = nWidth;
|
||||
FHeight = nHeight;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TBtnPanel::PaintParent(TCanvas *CanvasDrawCus)
|
||||
{
|
||||
if( this->m_pParentBtn ) {
|
||||
this->m_pParentBtn->Paint(CanvasDrawCus, false);
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TBtnPanel::PaintSub(TCanvas *CanvasParent)
|
||||
{
|
||||
if( m_VCSubtn.size() ) {
|
||||
|
||||
for(vc_pFindVCTBtnPanel =m_VCSubtn.begin();
|
||||
vc_pFindVCTBtnPanel!=m_VCSubtn.end();
|
||||
vc_pFindVCTBtnPanel++ )
|
||||
{
|
||||
((TBtnPanel *)(*vc_pFindVCTBtnPanel))->Paint(CanvasParent, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TBtnPanel::Paint(TCanvas *Canvas, bool bParent)
|
||||
{
|
||||
TCanvas *CanvasDraw = Canvas;
|
||||
|
||||
TRect rtThis = TRect(this->Left, this->Top,
|
||||
this->Left+this->Width,
|
||||
this->Top +this->Height);
|
||||
|
||||
TRect rtCreate = TRect(this->m_pTWnCtl->Left, this->m_pTWnCtl->Top,
|
||||
this->m_pTWnCtl->Left+this->m_pTWnCtl->Width,
|
||||
this->m_pTWnCtl->Top +this->m_pTWnCtl->Height);
|
||||
|
||||
//自身创建
|
||||
HDC ParentDC = GetDC(this->m_pTWnCtl->Handle);
|
||||
HDC DCCreate;
|
||||
HBITMAP BmpCreate;
|
||||
TCanvas *CanvasCreate;
|
||||
if( NULL==Canvas ) {
|
||||
|
||||
DCCreate = CreateCompatibleDC(ParentDC);
|
||||
BmpCreate = CreateCompatibleBitmap(ParentDC,
|
||||
rtCreate.Width(),
|
||||
rtCreate.Height());
|
||||
SelectObject(DCCreate, BmpCreate);
|
||||
PerformEraseBackground(this->m_pTWnCtl, DCCreate);
|
||||
CanvasCreate = new TCanvas();
|
||||
CanvasCreate->Handle = DCCreate;
|
||||
|
||||
CanvasDraw = CanvasCreate;
|
||||
if( FTransparent ) {
|
||||
SetBkMode( CanvasDraw->Handle, TRANSPARENT);
|
||||
StyleServices()->DrawParentBackground(
|
||||
this->m_pTWnCtl->Handle,
|
||||
CanvasDraw->Handle,
|
||||
NULL, false, rtThis);
|
||||
}
|
||||
}
|
||||
|
||||
//绘制
|
||||
if( FPanelDrEvent )
|
||||
{
|
||||
BtnHandleState();
|
||||
|
||||
//新建绘制
|
||||
TCanvas *CanvasCusDraw = new TCanvas();
|
||||
HDC DCCusDraw;
|
||||
HBITMAP BmpCusDraw;
|
||||
DCCusDraw = CreateCompatibleDC(ParentDC);
|
||||
BmpCusDraw = CreateCompatibleBitmap(ParentDC, rtCreate.Width(),
|
||||
rtCreate.Height());
|
||||
SelectObject(DCCusDraw, BmpCusDraw);
|
||||
PerformEraseBackground(this->m_pTWnCtl, DCCusDraw);
|
||||
CanvasCusDraw->Handle = DCCusDraw;
|
||||
|
||||
if( FTransparent ) {
|
||||
|
||||
SetBkMode( CanvasCusDraw->Handle, TRANSPARENT);
|
||||
StyleServices()->DrawParentBackground(
|
||||
this->m_pTWnCtl->Handle,
|
||||
CanvasCusDraw->Handle,
|
||||
NULL, false, rtThis);
|
||||
|
||||
//parent贴图到自身区域
|
||||
if( this->m_pParentBtn ) {
|
||||
|
||||
if( true==bParent ) {
|
||||
|
||||
if( NULL==Canvas ) PaintParent(CanvasDraw);
|
||||
}
|
||||
|
||||
StretchBlt(CanvasCusDraw->Handle,
|
||||
rtThis.Left, rtThis.Top,
|
||||
rtThis.Width(), rtThis.Height(),
|
||||
CanvasDraw->Handle,
|
||||
rtThis.Left, rtThis.Top,
|
||||
rtThis.Width(), rtThis.Height(),
|
||||
SRCCOPY);
|
||||
}
|
||||
}
|
||||
|
||||
FPanelDrEvent(FBtnCurState, rtThis, CanvasCusDraw);
|
||||
|
||||
if( FTransparent ) {
|
||||
|
||||
BLENDFUNCTION BFun;
|
||||
BFun.BlendOp = AC_SRC_OVER;
|
||||
BFun.BlendFlags = 0;
|
||||
BFun.SourceConstantAlpha = FTransparentValue;
|
||||
BFun.AlphaFormat = 0;
|
||||
|
||||
::AlphaBlend( CanvasDraw->Handle,
|
||||
rtThis.Left, rtThis.Top,
|
||||
rtThis.Width(), rtThis.Height(),
|
||||
CanvasCusDraw->Handle,
|
||||
rtThis.Left, rtThis.Top,
|
||||
rtThis.Width(), rtThis.Height(),
|
||||
BFun);
|
||||
|
||||
}else{
|
||||
|
||||
StretchBlt(CanvasDraw->Handle,
|
||||
rtThis.Left, rtThis.Top,
|
||||
rtThis.Width(), rtThis.Height(),
|
||||
CanvasCusDraw->Handle,
|
||||
rtThis.Left, rtThis.Top,
|
||||
rtThis.Width(), rtThis.Height(),
|
||||
SRCCOPY);
|
||||
}
|
||||
|
||||
if( true==bParent )
|
||||
PaintSub(CanvasDraw);
|
||||
|
||||
DeleteDC(DCCusDraw);
|
||||
DeleteObject(BmpCusDraw);
|
||||
SAFE_DELETE(CanvasCusDraw)
|
||||
}
|
||||
|
||||
if( NULL==Canvas ) {
|
||||
|
||||
StretchBlt(ParentDC,
|
||||
this->Left, this->Top,
|
||||
this->Width, this->Height,
|
||||
CanvasDraw->Handle,
|
||||
this->Left, this->Top,
|
||||
this->Width, this->Height,
|
||||
SRCCOPY);
|
||||
|
||||
DeleteDC(DCCreate);
|
||||
DeleteObject(BmpCreate);
|
||||
SAFE_DELETE(CanvasCreate)
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TBtnPanel::Update(bool bEreaseBkg)
|
||||
{
|
||||
if( m_pParentBtn && bEreaseBkg ) {
|
||||
|
||||
((TBtnPanel *)m_pParentBtn)->Update(bEreaseBkg);
|
||||
|
||||
}else {
|
||||
|
||||
Paint();
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
@@ -0,0 +1,126 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef BtnPanelUnitH
|
||||
#define BtnPanelUnitH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <Vcl.AppEvnts.hpp>
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
//---------------------------------------------------------------------------
|
||||
#ifndef SAFE_DELETE(p)
|
||||
#define SAFE_DELETE(p) { if(p) { delete (p); (p)=NULL; } }
|
||||
#endif
|
||||
//---------------------------------------------------------------------------
|
||||
typedef enum{
|
||||
|
||||
Bs_NORMAL=0,
|
||||
Bs_ENTER,
|
||||
Bs_DOWN,
|
||||
Bs_DISABLE,
|
||||
Bs_NONE
|
||||
|
||||
}BtnState;
|
||||
|
||||
typedef enum{
|
||||
|
||||
Ms_LDOWN=0,
|
||||
Ms_LUP,
|
||||
Ms_LLDOWN,
|
||||
Ms_RDOWN,
|
||||
Ms_RUP,
|
||||
Ms_ENTER,
|
||||
Ms_LEAVE,
|
||||
Ms_MOVE,
|
||||
Ms_DRAG,
|
||||
Ms_NONE
|
||||
}MsState;
|
||||
//---------------------------------------------------------------------------
|
||||
class TBtnPanel;
|
||||
typedef vector<TBtnPanel *> VCTBtnPanel;
|
||||
extern VCTBtnPanel::iterator vc_pFindVCTBtnPanel;
|
||||
//---------------------------------------------------------------------------
|
||||
typedef void __fastcall (__closure *PanelMsEvent)(int MsTmp, int XPos, int YPos);
|
||||
typedef void __fastcall (__closure *PanelDrEvent)(int BsTmp, TRect TRectTmp, TCanvas *pCanvas);
|
||||
//---------------------------------------------------------------------------
|
||||
class TBtnPanel: public TComponent
|
||||
{
|
||||
|
||||
private:
|
||||
|
||||
TApplicationEvents *m_pAppEvents;
|
||||
bool m_bPalEn, m_bPalLD, m_bPalRD;
|
||||
void __fastcall OnAppEvents(tagMSG &Msg, bool &Handled);
|
||||
|
||||
TBtnPanel *m_pParentBtn;
|
||||
VCTBtnPanel m_VCSubtn;
|
||||
bool m_bBtnEn, m_bBtnLD, m_bBtnRD;
|
||||
int m_BtnCurStateBac;
|
||||
|
||||
bool __fastcall IsBtnHandleAppEvent(unsigned int message, int XPos, int YPos);
|
||||
bool __fastcall IsPtInSubtn(int XPos, int YPos);
|
||||
void __fastcall BtnHandleAppEvent(MsState MsSrcTmp, int XPos, int YPos);
|
||||
void __fastcall BtnHandleState();
|
||||
void __fastcall BtnMsEvent(MsState MsTmp, int XPos, int YPos);
|
||||
void __fastcall BtnDrEvent(BtnState BsTmp, int XPos, int YPos);
|
||||
|
||||
void __fastcall PaintParent(TCanvas *CanvasDrawCus);
|
||||
void __fastcall PaintSub(TCanvas *CanvasDraw);
|
||||
|
||||
// -----
|
||||
int FLeft, FTop, FWidth, FHeight;
|
||||
bool FEnabled;
|
||||
bool FDown;
|
||||
bool FStateEnter;
|
||||
int FStateCount;
|
||||
int FBtnCurState;
|
||||
bool FTransparent;
|
||||
BYTE FTransparentValue;
|
||||
PanelMsEvent FPanelMsEvent;
|
||||
PanelDrEvent FPanelDrEvent;
|
||||
|
||||
public:
|
||||
|
||||
TWinControl *m_pTWnCtl;
|
||||
void __fastcall SetBounds(int nLeft, int nTop, int nWidth, int nHeight);
|
||||
void __fastcall AddSubPanel(TBtnPanel *pTBtnPanel);
|
||||
void __fastcall Update(bool bEreaseBkg=true);
|
||||
void __fastcall Paint(TCanvas *Canvas=NULL, bool bParent=true);
|
||||
|
||||
__fastcall TBtnPanel(TWinControl *pTWnCtl);
|
||||
__fastcall ~TBtnPanel();
|
||||
|
||||
__published:
|
||||
|
||||
__property int Left = { read=FLeft, write=FLeft, default=0 };
|
||||
__property int Top = { read=FTop, write=FTop, default=0 };
|
||||
__property int Width = { read=FWidth, write=FWidth, default=0 };
|
||||
__property int Height = { read=FHeight, write=FHeight, default=0 };
|
||||
__property bool StateEnter = { read=FStateEnter, write=FStateEnter, default=true };
|
||||
__property bool Enabled = { read=FEnabled, write=FEnabled, default=true };
|
||||
__property bool Down = { read=FDown, write=FDown, default=false };
|
||||
__property int BtnCurState = { read=FBtnCurState,write=FBtnCurState,default=Bs_NORMAL};
|
||||
__property int StateCount = { read=FStateCount, write=FStateCount, default=3 };
|
||||
__property bool Transparent = { read=FTransparent, write=FTransparent, default=false };
|
||||
__property BYTE TransparentValue = { read=FTransparentValue, write=FTransparentValue, default=255 };
|
||||
__property PanelMsEvent OnPanelMsEvent = { read=FPanelMsEvent , write=FPanelMsEvent };
|
||||
__property PanelDrEvent OnPanelDrEvent = { read=FPanelDrEvent , write=FPanelDrEvent };
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
|
||||
/******************************************
|
||||
******************READ ME******************
|
||||
*******************************************
|
||||
@ 先触发鼠标事件,在触发绘制事件
|
||||
@ 事件坐标体系是绝对坐标;
|
||||
@ 绘制坐标体系是相对坐标;
|
||||
@ 自身重绘,子view相应重绘;
|
||||
@ 自身rect发生变化,父view相应重绘;
|
||||
@ 只画png需要设置trans
|
||||
@ StateCount-->BtnState;
|
||||
@ Ms_LLDOWN-->event no paint;
|
||||
*******************************************
|
||||
*******************************************
|
||||
*******************************************/
|
||||
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef CKBoxH
|
||||
#define CKBoxH
|
||||
#include <vcl.h>
|
||||
#include <Vcl.Imaging.pngimage.hpp>
|
||||
//---------------------------------------------------------------------------
|
||||
class PACKAGE TCKBox : public TPanel
|
||||
{
|
||||
private:
|
||||
bool FChecked;
|
||||
bool FEnabled;
|
||||
bool bMouse;
|
||||
bool FAutoBox;
|
||||
TNotifyEvent FOnChange;
|
||||
TColor FBoxColor;
|
||||
|
||||
String m_strText;
|
||||
// TLabel *m_pCaption;
|
||||
Vcl::Imaging::Pngimage::TPngImage *m_pImgCheck;
|
||||
|
||||
private:
|
||||
void __fastcall SetBoxEnabled(bool bEnabled);
|
||||
void __fastcall SetEnabled(bool bEnabled);
|
||||
void __fastcall SetChecked(bool bCheck);
|
||||
void __fastcall SetBoxColor(TColor cColor);
|
||||
TFont* __fastcall GetTextFont();
|
||||
void __fastcall SetTextFont( TFont* Value );
|
||||
// void __fastcall Clicklb(TObject *Sender);
|
||||
// TColor __fastcall ColorSub(TColor cColor,int index);
|
||||
String __fastcall GetCaption();
|
||||
void __fastcall SetCaption( String Value );
|
||||
|
||||
protected:
|
||||
virtual void __fastcall Paint(void);
|
||||
|
||||
MESSAGE void __fastcall CMMouseLeave(TWMMouse &Message);
|
||||
MESSAGE void __fastcall CMMouseEnter(TWMMouse &Message);
|
||||
MESSAGE void __fastcall WMSize(Winapi::Messages::TWMSize &Message);
|
||||
BEGIN_MESSAGE_MAP
|
||||
MESSAGE_HANDLER(CM_MOUSEENTER, TWMMouse, CMMouseEnter)
|
||||
MESSAGE_HANDLER(CM_MOUSELEAVE, TWMMouse, CMMouseLeave)
|
||||
MESSAGE_HANDLER(WM_SIZE, TWMSize, WMSize)
|
||||
END_MESSAGE_MAP(TPanel)
|
||||
public:
|
||||
DYNAMIC void __fastcall Click(void);
|
||||
|
||||
__fastcall TCKBox( TComponent* Owner );
|
||||
__fastcall ~TCKBox();
|
||||
|
||||
__published:
|
||||
__property bool Checked = { read = FChecked, write = SetChecked, default = 0 };
|
||||
__property bool Enabled = { read = FEnabled, write = SetEnabled, default = 1 };
|
||||
__property bool AutoBox = { read = FAutoBox,write = FAutoBox,default = 1};
|
||||
__property TColor BoxColor = { read = FBoxColor,write = SetBoxColor };
|
||||
__property Font = { read = GetTextFont, write = SetTextFont };
|
||||
__property TNotifyEvent OnChange = {read = FOnChange, write = FOnChange ,default = NULL};
|
||||
__property String Caption = {read = GetCaption, write = SetCaption };
|
||||
};
|
||||
#endif
|
||||
|
||||
/*
|
||||
使用说明
|
||||
1、OnChange 为当 Checked 发生改变时触发 为外部接口 也可以使用父类 TPanel 的 onClick
|
||||
2、FontSize 为 字体大小
|
||||
3、AutoBox 为 True 时:
|
||||
Box 的大小随字体高度变化
|
||||
为false 时:
|
||||
Box 的大小 随控件的 Height 变化
|
||||
4、BoxEnabled 能否使用 ,不与 TPanel 的 Enabled 冲突
|
||||
附注:
|
||||
控件 最小 Height 为 6 ;最小 Width 为 11
|
||||
|
||||
*/
|
||||
+139
@@ -0,0 +1,139 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#ifndef CapButtonH
|
||||
#define CapButtonH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <SysUtils.hpp>
|
||||
#include <Classes.hpp>
|
||||
#include <Vcl.Controls.hpp>
|
||||
#include <Vcl.Imaging.pngimage.hpp>
|
||||
#include <Vcl.Imaging.pnglang.hpp>
|
||||
#include <Vcl.Graphics.hpp>
|
||||
//---------------------------------------------------------------------------
|
||||
class PACKAGE TCapButton : public TGraphicControl
|
||||
{
|
||||
public:
|
||||
enum TModalResult{
|
||||
mrNone = System::Int8(0x0),
|
||||
mrOk = System::Int8(0x1),
|
||||
mrCancel = System::Int8(0x2),
|
||||
mrAbort = System::Int8(0x3),
|
||||
mrRetry = System::Int8(0x4),
|
||||
mrIgnore = System::Int8(0x5),
|
||||
mrYes = System::Int8(0x6),
|
||||
mrNo = System::Int8(0x7),
|
||||
mrClose = System::Int8(0x8),
|
||||
mrHelp = System::Int8(0x9),
|
||||
mrTryAgain = System::Int8(0xa),
|
||||
mrContinue = System::Int8(0xb),
|
||||
mrAll = System::Int8(0xc),
|
||||
mrNoToAll = System::Int8(0xd),
|
||||
mrYesToAll = System::Int8(0xe)
|
||||
};
|
||||
|
||||
private:
|
||||
COLORREF
|
||||
clrFrameExNormal,
|
||||
clrFrameExEnter,
|
||||
clrFrameExDisable,
|
||||
clrFrameNormal,
|
||||
clrLineNormal,
|
||||
clrRectNormal,
|
||||
clrRectDisable,
|
||||
clrCapArrowOpenBound[10],
|
||||
clrCapArrowOpenLine[4],
|
||||
clrExFrameBound[4],
|
||||
clrExFrameBoundDisable[4];
|
||||
|
||||
TColor FBorderColor;
|
||||
TColor FInterFrameColor;
|
||||
TColor FInterColor;
|
||||
|
||||
void __fastcall IniColor(int nstate);
|
||||
COLORREF __fastcall TransformColor(COLORREF icolor, int nNum=0, bool bplus=true);
|
||||
void __fastcall SetBorderColor(TColor iBorderColor);
|
||||
void __fastcall SetInterFrameColor(TColor iInterFrameColor);
|
||||
void __fastcall SetInterColor(TColor iInterColor);
|
||||
private:
|
||||
String FCaption;
|
||||
TNotifyEvent FOnMouseEnter;//on mouse enter notify event
|
||||
TNotifyEvent FOnMouseLeave;//on mouse leave notify event
|
||||
// System::Uitypes::TModalResult FModalResult;
|
||||
TModalResult FModalResult;
|
||||
|
||||
int __fastcall GetFontSize();
|
||||
|
||||
MESSAGE void __fastcall CMMouseEnter(Winapi::Messages::TMessage &Msg); // to know when mouse is entered
|
||||
MESSAGE void __fastcall CMMouseLeave(Winapi::Messages::TMessage &Msg); // to know when mouse is leaved
|
||||
|
||||
BEGIN_MESSAGE_MAP
|
||||
MESSAGE_HANDLER(CM_MOUSEENTER, TMessage, CMMouseEnter)
|
||||
MESSAGE_HANDLER(CM_MOUSELEAVE, TMessage, CMMouseLeave)
|
||||
END_MESSAGE_MAP(TGraphicControl)
|
||||
|
||||
protected:
|
||||
bool FEnablePNG; //是否加载了png格式图片背景
|
||||
bool FDown; // value to know if we painting mouse down
|
||||
int EtatBtn; // 0=Normal 1=Mouse entered 2=Pressed 3=Disabled
|
||||
int FStateCount;
|
||||
Vcl::Imaging::Pngimage::TPngImage *FPngImg; //our 4 states image
|
||||
|
||||
DYNAMIC void __fastcall MouseDown(System::Uitypes::TMouseButton Button, System::Classes::TShiftState Shift, int X, int Y);
|
||||
DYNAMIC void __fastcall MouseUp(System::Uitypes::TMouseButton Button, System::Classes::TShiftState Shift, int X, int Y);
|
||||
virtual void __fastcall SetEnabled(bool Value);
|
||||
|
||||
public:
|
||||
|
||||
__fastcall virtual TCapButton(System::Classes::TComponent* AOwner);
|
||||
__fastcall virtual ~TCapButton(void);
|
||||
|
||||
void __fastcall SetStateCount( int count );
|
||||
void __fastcall SetPngImg(Vcl::Imaging::Pngimage::TPngImage *value); // we set the png image
|
||||
void __fastcall SetDown(bool value); // to know if mouse is down or not
|
||||
void __fastcall SetEnablePNG(bool Value);// to know if customer set png img
|
||||
void __fastcall SetCaption(String Value);
|
||||
virtual void __fastcall Paint(void); // override the painting of the component
|
||||
DYNAMIC void __fastcall Click(void);
|
||||
|
||||
__published:
|
||||
|
||||
__property Action;
|
||||
__property Anchors = {default=3};
|
||||
__property bool Down = {read=FDown, write=SetDown, default=False};
|
||||
__property Enabled = {default=1};
|
||||
__property int ImgStates = {read=FStateCount, write=SetStateCount, default=4};
|
||||
// __property System::Uitypes::TModalResult ModalResult = {read=FModalResult, write=FModalResult, default=0};
|
||||
__property TModalResult ModalResult = {read=FModalResult, write=FModalResult, default=0};
|
||||
__property ParentShowHint = {default=1};
|
||||
__property Vcl::Imaging::Pngimage::TPngImage *PngImg = {read=FPngImg, write=SetPngImg};
|
||||
__property PopupMenu;
|
||||
__property ShowHint;
|
||||
__property Visible = {default=1};
|
||||
__property OnClick;
|
||||
__property OnContextPopup;
|
||||
__property OnMouseDown;
|
||||
__property OnMouseMove;
|
||||
__property OnMouseUp;
|
||||
__property System::Classes::TNotifyEvent OnMouseEnter = {read=FOnMouseEnter, write=FOnMouseEnter};
|
||||
__property System::Classes::TNotifyEvent OnMouseLeave = {read=FOnMouseLeave, write=FOnMouseLeave};
|
||||
__property bool EnablePNG = {read=FEnablePNG, write=SetEnablePNG, default=False};
|
||||
__property TColor BorderColor = {read=FBorderColor, write=SetBorderColor, default=TColor(0x83807d)};
|
||||
__property TColor InterFrameColor = {read=FInterFrameColor, write=SetInterFrameColor, default=TColor(0x302e2c)};
|
||||
__property TColor InterColor = {read=FInterColor, write=SetInterColor, default=TColor(0x58504a)};
|
||||
private:
|
||||
Vcl::Imaging::Pngimage::TPngImage *m_pPngButton, *m_pPngFoucusButton;
|
||||
Vcl::Imaging::Pngimage::TPngImage *pTmpDraw, *pTmpFoucusDraw;
|
||||
void __fastcall PaintCustomer(void);
|
||||
void __fastcall PaintCustomerText(void);
|
||||
|
||||
public:
|
||||
TRect rtCaption;
|
||||
|
||||
void __fastcall SetFontSize( int value );
|
||||
void __fastcall SetFont(String name, int size );
|
||||
|
||||
__published:
|
||||
__property String Caption = {read=FCaption, write=FCaption};
|
||||
__property int FontSize = {read=GetFontSize, write=SetFontSize, default=8};
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
@@ -0,0 +1,414 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl.h>
|
||||
#include <Vcl.Imaging.pngimage.hpp>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "GlobalUnit.h"
|
||||
#include "ChordPanel.h"
|
||||
|
||||
#define COL_HEIGHT 40
|
||||
#define COL_GAP 10
|
||||
#define MAINKEY_WIDTH 50
|
||||
#define ADJKEY_WIDTH 40
|
||||
#define CHORDTYPE_WIDTH 96
|
||||
|
||||
String u_strChordType[] = { "大三 Maj", "小三 Min", "大小七 7", "小七 Min7",
|
||||
"挂二 Sus2", "挂四 Sus4", "挂六 Sus6", "大七 Maj7" };
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
|
||||
__fastcall TChordPanel::TChordPanel(TComponent* AOwner)
|
||||
: TToolpalPanel(AOwner)
|
||||
{
|
||||
m_iType = TPTYPE_CHORD;
|
||||
m_nTextHeight = 40;
|
||||
m_iMelodyKey = 0;
|
||||
m_iMainKey = m_iChordType = -1;
|
||||
m_iAdjustKey = 0;
|
||||
m_bEnable = false;
|
||||
m_lblName = NULL;
|
||||
m_lblType = NULL;
|
||||
|
||||
m_strTitle = "和弦设置";
|
||||
AddToolBtn( 3, "imgAlphaChord", KeyModeClick, "显示英文和弦" );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TChordPanel::CreateWnd(void)
|
||||
{
|
||||
TToolpalPanel::CreateWnd();
|
||||
|
||||
m_lblName = new TLabel(this);
|
||||
m_lblName->Parent = this;
|
||||
m_lblName->Alignment = taCenter;
|
||||
m_lblName->Layout = tlCenter;
|
||||
m_lblName->AutoSize = false;
|
||||
m_lblName->SetBounds( LEFT_BOUND + COL_GAP,
|
||||
m_nTitleHeight + COL_GAP,
|
||||
MAINKEY_WIDTH + ADJKEY_WIDTH + COL_GAP,
|
||||
m_nTextHeight - COL_GAP );
|
||||
m_lblName->Font->Name = g_strTxtFontName;
|
||||
// m_lblName->Font->Size = g_szFont9;
|
||||
m_lblName->Font->Color = RGB(156, 170, 189);
|
||||
m_lblName->Caption = g_bAlphaKey ? L"和弦调号" : L"和弦级数";
|
||||
|
||||
m_lblType = new TLabel(this);
|
||||
m_lblType->Parent = this;
|
||||
m_lblType->Alignment = taCenter;
|
||||
m_lblType->Layout = tlCenter;
|
||||
m_lblType->AutoSize = false;
|
||||
m_lblType->SetBounds( m_lblName->Left + m_lblName->Width + 16,
|
||||
m_nTitleHeight + COL_GAP,
|
||||
CHORDTYPE_WIDTH,
|
||||
m_nTextHeight - COL_GAP );
|
||||
m_lblType->Font->Name = g_strTxtFontName;
|
||||
// m_lblType->Font->Size = g_szFont9;
|
||||
m_lblType->Font->Color = RGB(156, 170, 189);
|
||||
m_lblType->Caption = L"和弦类型";
|
||||
|
||||
for( int i = 0; i < 7; i++ ){
|
||||
m_aMainKeys[i] = new TTextButton(this);
|
||||
m_aMainKeys[i]->Parent = this;
|
||||
m_aMainKeys[i]->Enabled = false;
|
||||
m_aMainKeys[i]->OnClick = MainKeyClick;
|
||||
m_aMainKeys[i]->Tag = MainKeyTag( i );
|
||||
m_aMainKeys[i]->Text = g_bAlphaKey ? g_strAlphaTable[i] : g_strTable[i];
|
||||
m_aMainKeys[i]->FontName = g_strTxtFontName;
|
||||
m_aMainKeys[i]->FontSize = g_szFont12;
|
||||
m_aMainKeys[i]->SetBounds( LEFT_BOUND + COL_GAP,
|
||||
m_nTitleHeight + m_nTextHeight + i*COL_HEIGHT,
|
||||
MAINKEY_WIDTH, COL_HEIGHT );
|
||||
}
|
||||
|
||||
for( int i=0; i<2; i++ ){
|
||||
m_aAdjustKeys[i] = new TTextButton(this);
|
||||
m_aAdjustKeys[i]->Parent = this;
|
||||
m_aAdjustKeys[i]->Enabled = false;
|
||||
m_aAdjustKeys[i]->OnClick = AdjustKeyClick;
|
||||
m_aAdjustKeys[i]->Tag = i==0 ? 1 : -1;
|
||||
m_aAdjustKeys[i]->Text = i==0 ? "#" : "b";
|
||||
m_aAdjustKeys[i]->FontName = g_strTxtFontName;
|
||||
m_aAdjustKeys[i]->FontSize = g_szFont12;
|
||||
m_aAdjustKeys[i]->SetBounds( m_aMainKeys[0]->Left + m_aMainKeys[0]->Width + COL_GAP,
|
||||
m_nTitleHeight + m_nTextHeight + i*COL_HEIGHT,
|
||||
ADJKEY_WIDTH, COL_HEIGHT );
|
||||
}
|
||||
|
||||
for( int i=0; i<c_Type_Num; i++ ){
|
||||
m_aChordTypes[i] = new TTextButton(this);
|
||||
m_aChordTypes[i]->Parent = this;
|
||||
m_aChordTypes[i]->Enabled = false;
|
||||
m_aChordTypes[i]->OnClick = ChordTypeClick;
|
||||
m_aChordTypes[i]->Tag = i;
|
||||
m_aChordTypes[i]->Text = u_strChordType[i];
|
||||
m_aChordTypes[i]->FontName = g_strTxtFontName;
|
||||
m_aChordTypes[i]->FontSize = g_szFont12;
|
||||
|
||||
int h = i;
|
||||
|
||||
if( i==7 ) h = 4;
|
||||
else if( i>=4 ) h++;
|
||||
|
||||
m_aChordTypes[i]->SetBounds( m_aAdjustKeys[0]->Left + m_aAdjustKeys[0]->Width + 16,
|
||||
m_nTitleHeight + m_nTextHeight + h*COL_HEIGHT,
|
||||
CHORDTYPE_WIDTH, COL_HEIGHT );
|
||||
}
|
||||
|
||||
m_lstBtnTools[0]->Down = g_bAlphaKey;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
__fastcall TChordPanel::~TChordPanel()
|
||||
{
|
||||
for( int i = 0; i < 7; i++ ){
|
||||
SAFE_DELETE( m_aMainKeys[i] );
|
||||
}
|
||||
|
||||
for( int i=0; i<2; i++ ){
|
||||
SAFE_DELETE( m_aAdjustKeys[i] );
|
||||
m_aAdjustKeys[i] = NULL;
|
||||
}
|
||||
|
||||
for( int i=0; i<c_Type_Num; i++ ){
|
||||
SAFE_DELETE( m_aChordTypes[i] );
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TChordPanel::WMSize(Winapi::Messages::TWMSize &Message)
|
||||
{
|
||||
TToolpalPanel::WMSize( Message );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TChordPanel::SetChord( int iMainKey, int iAdjustKey, int iChordType )
|
||||
{
|
||||
if( m_iMainKey!=iMainKey ){
|
||||
if( m_iMainKey>=0 )
|
||||
m_aMainKeys[m_iMainKey]->SetDown( false );
|
||||
if( iMainKey>=0 )
|
||||
m_aMainKeys[iMainKey]->SetDown( true );
|
||||
|
||||
m_iMainKey = iMainKey;
|
||||
}
|
||||
|
||||
EnableAdjustKey( iMainKey, iAdjustKey );
|
||||
EnableChordType( iMainKey );
|
||||
m_iAdjustKey = iAdjustKey;
|
||||
|
||||
if( m_iChordType!=iChordType ){
|
||||
if( m_iChordType>=0 )
|
||||
m_aChordTypes[m_iChordType]->SetDown(false);
|
||||
|
||||
if( iChordType>=0 )
|
||||
m_aChordTypes[iChordType]->SetDown(true);
|
||||
|
||||
m_iChordType = iChordType;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TChordPanel::MainKeyClick( TObject* Sender )
|
||||
{
|
||||
int iSeries = ((TTextButton*)Sender)->Tag,
|
||||
iAdjustKey = 0,
|
||||
iChordType = 0;
|
||||
|
||||
if( iSeries==1 || iSeries==2 || iSeries==5 )
|
||||
iChordType = 1;
|
||||
else if( iSeries==6 )
|
||||
iAdjustKey = -1;
|
||||
|
||||
if( g_bAlphaKey ){
|
||||
int iKey = (iSeries<3) ? (iSeries*2) : (iSeries*2 - 1);
|
||||
iKey += m_iMelodyKey + iAdjustKey;
|
||||
|
||||
if( iKey<0 ) iKey += 12;
|
||||
else if( iKey>11 ) iKey -= 12;
|
||||
|
||||
if( iKey==1 || iKey==3 || iKey==8 || iKey==10 ) iAdjustKey = -1;
|
||||
else if( iKey==6 ) iAdjustKey = 1;
|
||||
}
|
||||
|
||||
int iMainKey = -1;
|
||||
for( int i=0; i<7; i++ ){
|
||||
if( m_aMainKeys[i]==Sender ){
|
||||
iMainKey = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( iMainKey!=m_iMainKey || iAdjustKey!=m_iAdjustKey || iChordType!=m_iChordType ){
|
||||
SetChord( iMainKey, iAdjustKey, iChordType );
|
||||
m_pContentPanel->SetSelectChord( GetChordKey(), iChordType );
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TChordPanel::AdjustKeyClick( TObject* Sender )
|
||||
{
|
||||
TTextButton* pAdjust = (TTextButton*)Sender;
|
||||
int iAdjustKey = pAdjust->Down ? 0 : pAdjust->Tag;
|
||||
|
||||
if( iAdjustKey!=m_iAdjustKey ){
|
||||
SetChord( m_iMainKey, iAdjustKey, m_iChordType );
|
||||
|
||||
m_pContentPanel->SetSelectChord( GetChordKey(), m_iChordType );
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TChordPanel::ChordTypeClick( TObject* Sender )
|
||||
{
|
||||
int iChordType = ((TTextButton*)Sender)->Tag;
|
||||
|
||||
if( iChordType!=m_iChordType ){
|
||||
SetChord( m_iMainKey, m_iAdjustKey, iChordType );
|
||||
|
||||
m_pContentPanel->SetSelectChord( GetChordKey(), iChordType );
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TChordPanel::EnableChordModify( bool bEnable, int iBarKey, int iChordKey, int iChordType )
|
||||
{
|
||||
SetMelodyKey( iBarKey );
|
||||
|
||||
int iMainKey, iAdjustKey;
|
||||
|
||||
m_pContentPanel->GetChordDispalyKey( iChordKey, iBarKey, iMainKey, iAdjustKey );
|
||||
|
||||
if( bEnable!=m_bEnable ){
|
||||
for( int i=0; i<7; i++ ){
|
||||
TTextButton * pBtn = m_aMainKeys[i];
|
||||
pBtn->Enabled = bEnable;
|
||||
pBtn->SetDown( bEnable && i==iMainKey );
|
||||
}
|
||||
|
||||
for( int i=0; i<c_Type_Num; i++ ){
|
||||
TTextButton * pBtn = m_aChordTypes[i];
|
||||
pBtn->Enabled = bEnable;
|
||||
pBtn->SetDown( bEnable && i==iChordType );
|
||||
}
|
||||
|
||||
EnableAdjustKey( bEnable ? iMainKey : 0, iAdjustKey );
|
||||
EnableChordType( bEnable ? iMainKey : -1 );
|
||||
|
||||
m_bEnable = bEnable;
|
||||
m_iMainKey = iMainKey;
|
||||
m_iAdjustKey = iAdjustKey;
|
||||
m_iChordType = iChordType;
|
||||
}
|
||||
else if( bEnable ){
|
||||
SetChord( iMainKey, iAdjustKey, iChordType );
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void TChordPanel::EnableAdjustKey( int iMainKey, int iAdjustKey )
|
||||
{
|
||||
switch( iMainKey ){
|
||||
case -1: case 0: case 4:
|
||||
m_aAdjustKeys[0]->Enabled = false;
|
||||
m_aAdjustKeys[1]->Enabled = false;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
m_aAdjustKeys[0]->Enabled = true;
|
||||
m_aAdjustKeys[1]->Enabled = false;
|
||||
break;
|
||||
|
||||
default:
|
||||
m_aAdjustKeys[0]->Enabled = false;
|
||||
m_aAdjustKeys[1]->Enabled = true;
|
||||
break;
|
||||
}
|
||||
|
||||
m_aAdjustKeys[0]->SetDown( iAdjustKey>0 );
|
||||
m_aAdjustKeys[1]->SetDown( iAdjustKey<0 );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void TChordPanel::EnableChordType( int iMainKey )
|
||||
{
|
||||
for( int i=0; i<c_Type_Num; i++ ){
|
||||
m_aChordTypes[i]->Enabled = iMainKey>=0;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
int TChordPanel::MainKeyTag( int index )
|
||||
{
|
||||
int iTag = index;
|
||||
|
||||
if( g_bAlphaKey && m_iMelodyKey>0 ){
|
||||
int iOffset = 0;
|
||||
switch( m_iMelodyKey ){
|
||||
case 1: case 2: iOffset = 1; break;
|
||||
case 3: case 4: iOffset = 2; break;
|
||||
case 5: case 6: iOffset = 3; break;
|
||||
case 7: iOffset = 4; break;
|
||||
case 8: case 9: iOffset = 5; break;
|
||||
case 10: case 11: iOffset = 6; break;
|
||||
}
|
||||
|
||||
iTag -= iOffset;
|
||||
if( iTag<0 )
|
||||
iTag += 7;
|
||||
}
|
||||
|
||||
return iTag;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TChordPanel::SetMelodyKey( int iKey )
|
||||
{
|
||||
if( m_iMelodyKey!=iKey ){
|
||||
m_iMelodyKey = iKey;
|
||||
|
||||
if( iKey>0 ){
|
||||
for( int i=0; i<7; i++ ){
|
||||
if( m_aMainKeys[i] )
|
||||
m_aMainKeys[i]->Tag = MainKeyTag( i );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
int TChordPanel::GetChordKey()
|
||||
{
|
||||
int iKey = m_iMainKey;
|
||||
|
||||
switch( m_iMainKey ){
|
||||
case 1: case 2:
|
||||
iKey = m_iMainKey * 2;
|
||||
if( m_iAdjustKey!=0 ) iKey += m_iAdjustKey;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
iKey = 5;
|
||||
if( m_iAdjustKey!=0 ) iKey += m_iAdjustKey;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
iKey = 7;
|
||||
break;
|
||||
|
||||
case 5: case 6:
|
||||
iKey = m_iMainKey * 2 - 1;
|
||||
if( m_iAdjustKey!=0 ) iKey += m_iAdjustKey;
|
||||
break;
|
||||
}
|
||||
|
||||
if( iKey>=0 && !g_bAlphaKey ){
|
||||
iKey += m_iMelodyKey;
|
||||
if( iKey>11 )
|
||||
iKey -= 12;
|
||||
}
|
||||
|
||||
return iKey;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TChordPanel::KeyModeClick(TObject *Sender)
|
||||
{
|
||||
TPNGButton* pBtn = (TPNGButton*)Sender;
|
||||
// pBtn->Down = !pBtn->Down;
|
||||
SetKeyMode( !pBtn->Down );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void TChordPanel::SetKeyMode( bool bAlpha )
|
||||
{
|
||||
if( g_bAlphaKey!= bAlpha ){
|
||||
if( m_lblName ){
|
||||
int iChordKey = GetChordKey();
|
||||
g_bAlphaKey = bAlpha;
|
||||
|
||||
for( int i = 0; i < 7; i++ ){
|
||||
m_aMainKeys[i]->Text = g_bAlphaKey ? g_strAlphaTable[i] : g_strTable[i];
|
||||
m_aMainKeys[i]->Tag = MainKeyTag( i );
|
||||
if( Visible )
|
||||
m_aMainKeys[i]->Repaint();
|
||||
}
|
||||
|
||||
if( Visible ){
|
||||
int iMainKey, iAdjustKey;
|
||||
m_pContentPanel->GetChordDispalyKey( iChordKey, m_iMelodyKey, iMainKey, iAdjustKey );
|
||||
|
||||
SetChord( iMainKey, iAdjustKey, m_iChordType );
|
||||
}
|
||||
|
||||
m_lblName->Caption = g_bAlphaKey ? L"和弦调号" : L"和弦级数";
|
||||
m_lstBtnTools[0]->Down = bAlpha;
|
||||
}
|
||||
else{
|
||||
g_bAlphaKey = bAlpha;
|
||||
}
|
||||
|
||||
m_pContentPanel->InvalidateShowBars( BAR_DATA );
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
@@ -0,0 +1,69 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ChordPanelH
|
||||
#define ChordPanelH
|
||||
|
||||
#include "ContentPanelUnit.h"
|
||||
#include "ToolpalPanel.h"
|
||||
#include "TextButton.h"
|
||||
|
||||
enum CONCORD_TYPE{
|
||||
c_Type_Maj,
|
||||
c_Type_Min,
|
||||
c_Type_Dom7,
|
||||
c_Type_Min7,
|
||||
c_Type_Sus2,
|
||||
c_Type_Sus4,
|
||||
c_Type_Sus6,
|
||||
c_Type_Maj7,
|
||||
c_Type_Num
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
class TChordPanel : public TToolpalPanel
|
||||
{
|
||||
private:
|
||||
TContentPanel* m_pContentPanel; //ÄÚÈÝÃæ°å¾ä±ú
|
||||
|
||||
TTextButton *m_aMainKeys[7],
|
||||
*m_aAdjustKeys[2],
|
||||
*m_aChordTypes[c_Type_Num];
|
||||
TLabel *m_lblName,
|
||||
*m_lblType;
|
||||
|
||||
int m_nTextHeight;
|
||||
int m_iMainKey, m_iAdjustKey, m_iChordType, m_iMelodyKey;
|
||||
bool m_bEnable;
|
||||
|
||||
void EnableAdjustKey( int iMainKey, int iAdjustKey );
|
||||
void EnableChordType( int iMainKey );
|
||||
int MainKeyTag( int index );
|
||||
int GetChordKey();
|
||||
|
||||
|
||||
void __fastcall MainKeyClick( TObject* Sender );
|
||||
void __fastcall AdjustKeyClick( TObject* Sender );
|
||||
void __fastcall ChordTypeClick( TObject* Sender );
|
||||
void __fastcall KeyModeClick( TObject* Sender );
|
||||
protected:
|
||||
MESSAGE void __fastcall WMSize(Winapi::Messages::TWMSize &Message);
|
||||
BEGIN_MESSAGE_MAP
|
||||
MESSAGE_HANDLER(WM_SIZE, TWMSize, WMSize)
|
||||
END_MESSAGE_MAP(TToolpalPanel)
|
||||
|
||||
virtual void __fastcall CreateWnd();
|
||||
|
||||
public:
|
||||
__fastcall virtual TChordPanel(System::Classes::TComponent* AOwner);
|
||||
__fastcall ~TChordPanel();
|
||||
|
||||
void SetKeyMode( bool bAlpha );
|
||||
void __fastcall SetMelodyKey( int iKey );
|
||||
void __fastcall SetContentPanel( TContentPanel* pPanel ){ m_pContentPanel=pPanel; };
|
||||
void __fastcall SetChord( int iMainKey, int iAdjustKey, int iChordType );
|
||||
void __fastcall EnableChordModify( bool bEnable, int iBarKey, int iChordKey, int iChordType );
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,427 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ComboBoxComponentH
|
||||
#define ComboBoxComponentH
|
||||
|
||||
#include <vcl.h>
|
||||
#include <SysUtils.hpp>
|
||||
#include <Classes.hpp>
|
||||
#include <Vcl.Controls.hpp>
|
||||
#include <Vcl.Imaging.pngimage.hpp>
|
||||
#include <Vcl.Imaging.pnglang.hpp>
|
||||
#include <Vcl.Graphics.hpp>
|
||||
//---------------------------------------------------------------------------
|
||||
class TDropListScrollBar;
|
||||
class TComboBoxItem;
|
||||
class TDropListView;
|
||||
class CBCapButton;
|
||||
//---------------------------------------------------------------------------
|
||||
/* 定义下拉列表项点击事件 */
|
||||
typedef void __fastcall (__closure *TItemClickEvent)(TComboBoxItem* Sender, int Index);
|
||||
|
||||
/* 下拉列表框显示风格 */
|
||||
enum DECLSPEC_DENUM TComboBoxMode : unsigned char {cbShowUp, cbShowDown};
|
||||
//typedef System::Set<ComboBox_Mode, ComboBox_Mode::cbShowUp, ComboBox_Mode::cbShowDown> TComboBoxMode;
|
||||
/* 定义下拉列表框变化事件 */
|
||||
typedef void __fastcall (__closure *TComboBoxChangeEvent)(TComboBoxItem* Sender, int Index);
|
||||
|
||||
/**************************************************************************************************/
|
||||
/**************************************************************************************************/
|
||||
class TDropListScrollBar : public TScrollBar
|
||||
{
|
||||
private:
|
||||
// int m_nTileHeight, //add by tj 2013/11/18
|
||||
int m_nThumbHeight,
|
||||
m_nThumbTop,
|
||||
m_nPreThumbTop,
|
||||
m_nDragPos,
|
||||
m_nDragPoint,
|
||||
m_iClicked,
|
||||
m_iHitPrev,
|
||||
m_nMax,
|
||||
m_nMin,
|
||||
m_nPos,
|
||||
m_nPage,
|
||||
m_nTrackPos;
|
||||
|
||||
bool m_bPause,
|
||||
m_bNotify,
|
||||
m_bDrag,
|
||||
m_bTrace;
|
||||
|
||||
TBitmap *u_pPicLineUp,
|
||||
*u_pPicLineDown;
|
||||
|
||||
TTimer *m_pTimer;
|
||||
TCanvas *m_pCanvas;
|
||||
|
||||
int HitTest( int X, int Y );
|
||||
void CalcThumbHeight();
|
||||
void CalcThumbTop();
|
||||
void DrawArrow( int iDirection, int iState );
|
||||
void DrawThumb( int iState, bool bEraseBk, int iPageUD=-1 );
|
||||
|
||||
void __fastcall TimerProc(TObject* Sender);
|
||||
|
||||
MESSAGE void __fastcall WMPaint(Winapi::Messages::TWMPaint &Message);
|
||||
MESSAGE void __fastcall WMLButtonDown(TWMMouse &Message);
|
||||
MESSAGE void __fastcall WMLButtonUp(TWMMouse &Message);
|
||||
MESSAGE void __fastcall WMLButtonDblClk(TWMMouse &Message);
|
||||
MESSAGE void __fastcall WMRButtonDown(TWMMouse &Message); //add by tj 2013/11/18
|
||||
MESSAGE void __fastcall WMRButtonUp(TWMMouse &Message); //add by tj 2013/11/18
|
||||
MESSAGE void __fastcall WMMouseMove(TWMMouse &Message);
|
||||
// MESSAGE void __fastcall CMMouseLeave(TMessage &Message); //add by tj 2013/11/25 12:35
|
||||
MESSAGE void __fastcall SBMSetScrollInfo(TMessage &Message);
|
||||
MESSAGE void __fastcall SBMGetScrollInfo(TMessage &Message);
|
||||
|
||||
BEGIN_MESSAGE_MAP
|
||||
MESSAGE_HANDLER(WM_PAINT, TWMPaint, WMPaint)
|
||||
MESSAGE_HANDLER(WM_LBUTTONDOWN, TWMLButtonDown, WMLButtonDown)
|
||||
MESSAGE_HANDLER(WM_LBUTTONUP, TWMLButtonUp, WMLButtonUp)
|
||||
MESSAGE_HANDLER(WM_LBUTTONDBLCLK, TWMLButtonDblClk, WMLButtonDblClk)
|
||||
MESSAGE_HANDLER(WM_RBUTTONDOWN, TWMRButtonDown, WMRButtonDown)
|
||||
MESSAGE_HANDLER(WM_RBUTTONUP, TWMRButtonUp, WMRButtonUp) //add by tj 2013/11/18
|
||||
MESSAGE_HANDLER(WM_MOUSEMOVE, TWMMouseMove, WMMouseMove) //add by tj 2013/11/18
|
||||
// MESSAGE_HANDLER(CM_MOUSELEAVE, TMessage, CMMouseLeave) //add by tj 2013/11/25 12:35
|
||||
MESSAGE_HANDLER(SBM_SETSCROLLINFO, TMessage, SBMSetScrollInfo)
|
||||
MESSAGE_HANDLER(SBM_GETSCROLLINFO, TMessage, SBMGetScrollInfo)
|
||||
END_MESSAGE_MAP(TScrollBar)
|
||||
|
||||
protected:
|
||||
virtual void __fastcall PaintWindow(HDC DC);
|
||||
|
||||
public:
|
||||
TWinControl *m_pWndCtrl;
|
||||
bool m_bAction;
|
||||
|
||||
__fastcall virtual TDropListScrollBar(System::Classes::TComponent* AOwner);
|
||||
__fastcall ~TDropListScrollBar();
|
||||
|
||||
void __fastcall CMMouseLeave(TObject *Sender); //add by tj 2013/11/25 12:35
|
||||
|
||||
bool IsDraging(){ return m_bDrag; };
|
||||
void __fastcall SetPosition(int Value, bool bRedraw=true);
|
||||
void __fastcall SetPageSize(int Value, bool bRedraw=true);
|
||||
void __fastcall SetRange(int AMin, int AMax, bool bRedraw=true);
|
||||
void __fastcall GetScrollRange(int* nMin, int* nMax);
|
||||
int __fastcall GetScrollPos();
|
||||
int __fastcall GetPageSize();
|
||||
};
|
||||
/**************************************************************************************************/
|
||||
/**************************************************************************************************/
|
||||
class TComboBoxItem : public TObject
|
||||
{
|
||||
private:
|
||||
int FTag;
|
||||
String FCaption;
|
||||
TItemClickEvent FOnItemClick;
|
||||
|
||||
void __fastcall SetCaption(String Caption);
|
||||
|
||||
public:
|
||||
__fastcall TComboBoxItem(String Caption, TItemClickEvent OnItemClick);
|
||||
|
||||
void __fastcall DrawItem(TCanvas *Canvas, TRect Rect, bool Selected);
|
||||
|
||||
__published:
|
||||
__property String Caption = {read = FCaption, write = FCaption};
|
||||
__property int Tag = {read = FTag, write = FTag};
|
||||
__property TItemClickEvent OnItemClicked = {read = FOnItemClick, write = FOnItemClick};
|
||||
};
|
||||
// ---------------------------------------------------------------------------
|
||||
// TDropListView
|
||||
// ---------------------------------------------------------------------------
|
||||
class TDropListView : public TWinControl
|
||||
{
|
||||
private:
|
||||
TNotifyEvent FOnHide, // 下拉列表隐藏事件
|
||||
FOnShow; // 下拉列表显示事件
|
||||
|
||||
int FItemHeight,
|
||||
FItemWidth,
|
||||
FShowItemsCount,
|
||||
FDefItemIndex;
|
||||
|
||||
TControlCanvas *m_Canvas;
|
||||
TList *m_ItemRectList,
|
||||
*m_ItemList;
|
||||
|
||||
TDropListScrollBar *m_ScrollBar;
|
||||
|
||||
HWND m_pActiveWnd;
|
||||
|
||||
int m_BeginIndex,
|
||||
m_EndIndex,
|
||||
m_CurrentItemIndex,
|
||||
m_RealShowCount,
|
||||
m_MouseX,
|
||||
m_MouseY;
|
||||
|
||||
void __fastcall CreateScrollBar();
|
||||
|
||||
void __fastcall DoItemsCountChange();
|
||||
void __fastcall DoItemClicked(int Index);
|
||||
void __fastcall DoItemSelect(int Index);
|
||||
void __fastcall DoKeyUpDown(int Index);
|
||||
void __fastcall DoShowItemsChange();
|
||||
|
||||
int __fastcall CalcListHeight();
|
||||
int __fastcall GetItemsCount();
|
||||
TRect *__fastcall GetItemRect(int Index);
|
||||
|
||||
void __fastcall SetShowItemsCount(int Value);
|
||||
|
||||
MESSAGE void __fastcall WMEraseBkgnd(TWMEraseBkgnd &Message);
|
||||
MESSAGE void __fastcall WMKeyDown(TWMKeyDown &Message);
|
||||
MESSAGE void __fastcall WMKillFocus(TMessage &Message);
|
||||
MESSAGE void __fastcall WMLButtonDown(TWMLButtonDown &Message);
|
||||
MESSAGE void __fastcall WMMouseWheel(TWMMouseWheel &Message);
|
||||
MESSAGE void __fastcall WMPaint(TWMPaint &Message);
|
||||
MESSAGE void __fastcall WMSetFocus(TMessage &Message);
|
||||
MESSAGE void __fastcall WMVScroll(TWMScroll &Message);
|
||||
|
||||
BEGIN_MESSAGE_MAP
|
||||
MESSAGE_HANDLER(WM_ERASEBKGND, TWMEraseBkgnd, WMEraseBkgnd)
|
||||
MESSAGE_HANDLER(CN_KEYDOWN, TWMKeyDown, WMKeyDown)
|
||||
MESSAGE_HANDLER(WM_KILLFOCUS, TMessage, WMKillFocus)
|
||||
MESSAGE_HANDLER(WM_LBUTTONDOWN, TWMLButtonDown, WMLButtonDown)
|
||||
MESSAGE_HANDLER(WM_MOUSEWHEEL, TWMMouseWheel, WMMouseWheel)
|
||||
MESSAGE_HANDLER(WM_PAINT, TWMPaint, WMPaint)
|
||||
MESSAGE_HANDLER(WM_SETFOCUS, TMessage, WMSetFocus)
|
||||
MESSAGE_HANDLER(WM_VSCROLL, TWMScroll, WMVScroll)
|
||||
END_MESSAGE_MAP(TWinControl)
|
||||
|
||||
protected:
|
||||
virtual void __fastcall CreateParams(TCreateParams &Params);
|
||||
virtual void __fastcall CreateWnd();
|
||||
virtual void __fastcall PaintWindow(HDC DC);
|
||||
|
||||
DYNAMIC void __fastcall MouseDown(TMouseButton Button, TShiftState Shift, int X, int Y);
|
||||
DYNAMIC void __fastcall MouseMove(TShiftState Shift, int X, int Y);
|
||||
DYNAMIC void __fastcall MouseUp(TMouseButton Button, TShiftState Shift, int X, int Y);
|
||||
|
||||
public:
|
||||
__fastcall TDropListView(TComponent *Owner);
|
||||
__fastcall ~TDropListView();
|
||||
void __fastcall AddItem(TComboBoxItem* Item);
|
||||
void __fastcall Clear();
|
||||
TComboBoxItem *__fastcall GetItem(int Index);
|
||||
void __fastcall Hide();
|
||||
void __fastcall RemoveItem(int Index);
|
||||
void __fastcall ScrollPos(int Pos);
|
||||
void __fastcall Show();
|
||||
void __fastcall SetFontSize(int sz);
|
||||
void __fastcall SetFont(String name, int sz);
|
||||
|
||||
__published:
|
||||
__property int ListHeight = {read = CalcListHeight};
|
||||
__property int ItemHeight = {write = FItemHeight, read = FItemHeight, default = 16};
|
||||
|
||||
__property TNotifyEvent OnHide = {write = FOnHide, read = FOnHide};
|
||||
__property TNotifyEvent OnShow = {write = FOnShow, read = FOnShow};
|
||||
|
||||
__property int ShowItemsCount = {write = SetShowItemsCount, read = FShowItemsCount};
|
||||
|
||||
__property int DefItemIndex = {read = FDefItemIndex, write = FDefItemIndex};
|
||||
__property int ItemsCount = {read = GetItemsCount};
|
||||
};
|
||||
/**************************************************************************************************/
|
||||
/**************************************************************************************************/
|
||||
class CBCapButton : public TGraphicControl
|
||||
{
|
||||
public:
|
||||
enum TModalResult{
|
||||
mrNone = System::Int8(0x0),
|
||||
mrOk = System::Int8(0x1),
|
||||
mrCancel = System::Int8(0x2),
|
||||
mrAbort = System::Int8(0x3),
|
||||
mrRetry = System::Int8(0x4),
|
||||
mrIgnore = System::Int8(0x5),
|
||||
mrYes = System::Int8(0x6),
|
||||
mrNo = System::Int8(0x7),
|
||||
mrClose = System::Int8(0x8),
|
||||
mrHelp = System::Int8(0x9),
|
||||
mrTryAgain = System::Int8(0xa),
|
||||
mrContinue = System::Int8(0xb),
|
||||
mrAll = System::Int8(0xc),
|
||||
mrNoToAll = System::Int8(0xd),
|
||||
mrYesToAll = System::Int8(0xe)
|
||||
};
|
||||
|
||||
private:
|
||||
COLORREF
|
||||
clrFrameExNormal,
|
||||
clrFrameExEnter,
|
||||
clrFrameExDisable,
|
||||
clrFrameNormal,
|
||||
clrLineNormal,
|
||||
clrRectNormal,
|
||||
clrRectDisable,
|
||||
clrCapArrowOpenBound[10],
|
||||
clrCapArrowOpenLine[4],
|
||||
clrExFrameBound[4],
|
||||
clrExFrameBoundDisable[4];
|
||||
|
||||
TColor FBorderColor;
|
||||
TColor FInterFrameColor;
|
||||
TColor FInterColor;
|
||||
|
||||
void __fastcall IniColor(int nstate);
|
||||
COLORREF __fastcall TransformColor(COLORREF icolor, int nNum=0, bool bplus=true);
|
||||
void __fastcall SetBorderColor(TColor iBorderColor);
|
||||
void __fastcall SetInterFrameColor(TColor iInterFrameColor);
|
||||
void __fastcall SetInterColor(TColor iInterColor);
|
||||
|
||||
TNotifyEvent FOnMouseEnter;//on mouse enter notify event
|
||||
TNotifyEvent FOnMouseLeave;//on mouse leave notify event
|
||||
|
||||
String FCaption;
|
||||
// System::Uitypes::TModalResult FModalResult;
|
||||
TModalResult FModalResult;
|
||||
|
||||
void __fastcall SetCaption(String Value);
|
||||
|
||||
MESSAGE void __fastcall CMMouseEnter(Winapi::Messages::TMessage &Msg); // to know when mouse is entered
|
||||
MESSAGE void __fastcall CMMouseLeave(Winapi::Messages::TMessage &Msg); // to know when mouse is leaved
|
||||
|
||||
BEGIN_MESSAGE_MAP
|
||||
MESSAGE_HANDLER(CM_MOUSEENTER, TMessage, CMMouseEnter)
|
||||
MESSAGE_HANDLER(CM_MOUSELEAVE, TMessage, CMMouseLeave)
|
||||
END_MESSAGE_MAP(TGraphicControl)
|
||||
|
||||
protected:
|
||||
bool FEnablePNG; //是否加载了png格式图片背景
|
||||
bool FDown; // value to know if we painting mouse down
|
||||
int EtatBtn; // 0=Normal 1=Mouse entered 2=Pressed 3=Disabled
|
||||
int FStateCount;
|
||||
Vcl::Imaging::Pngimage::TPngImage *FPngImg; //our 4 states image
|
||||
|
||||
|
||||
DYNAMIC void __fastcall MouseDown(System::Uitypes::TMouseButton Button, System::Classes::TShiftState Shift, int X, int Y);
|
||||
DYNAMIC void __fastcall MouseUp(System::Uitypes::TMouseButton Button, System::Classes::TShiftState Shift, int X, int Y);
|
||||
virtual void __fastcall SetEnabled(bool Value);
|
||||
|
||||
public:
|
||||
|
||||
__fastcall virtual CBCapButton(System::Classes::TComponent* AOwner);
|
||||
__fastcall virtual ~CBCapButton(void);
|
||||
|
||||
void __fastcall SetStateCount( int count );
|
||||
void __fastcall SetPngImg(Vcl::Imaging::Pngimage::TPngImage *value); // we set the png image
|
||||
void __fastcall SetDown(bool value); // to know if mouse is down or not
|
||||
void __fastcall SetEnablePNG(bool Value);// to know if customer set png img
|
||||
virtual void __fastcall SetFontSize( int value );
|
||||
virtual void __fastcall SetFont( String name, int sz );
|
||||
virtual void __fastcall Paint(void); // override the painting of the component
|
||||
DYNAMIC void __fastcall Click(void);
|
||||
|
||||
__published:
|
||||
|
||||
__property Action;
|
||||
__property Anchors = {default=3};
|
||||
__property bool Down = {read=FDown, write=SetDown, default=False};
|
||||
__property Enabled = {default=1};
|
||||
__property int ImgStates = {read=FStateCount, write=SetStateCount, default=4};
|
||||
// __property System::Uitypes::TModalResult ModalResult = {read=FModalResult, write=FModalResult, default=0};
|
||||
__property TModalResult ModalResult = {read=FModalResult, write=FModalResult, default=0};
|
||||
__property ParentShowHint = {default=1};
|
||||
__property Vcl::Imaging::Pngimage::TPngImage *PngImg = {read=FPngImg, write=SetPngImg};
|
||||
__property PopupMenu;
|
||||
__property ShowHint;
|
||||
__property Visible = {default=1};
|
||||
__property OnClick;
|
||||
__property OnContextPopup;
|
||||
__property OnMouseDown;
|
||||
__property OnMouseMove;
|
||||
__property OnMouseUp;
|
||||
__property System::Classes::TNotifyEvent OnMouseEnter = {read=FOnMouseEnter, write=FOnMouseEnter};
|
||||
__property System::Classes::TNotifyEvent OnMouseLeave = {read=FOnMouseLeave, write=FOnMouseLeave};
|
||||
__property bool EnablePNG = {read=FEnablePNG, write=SetEnablePNG, default=False};
|
||||
__property TColor BorderColor = {read=FBorderColor, write=SetBorderColor, default=TColor(0x83807d)};
|
||||
__property TColor InterFrameColor = {read=FInterFrameColor, write=SetInterFrameColor, default=TColor(0x302e2c)};
|
||||
__property TColor InterColor = {read=FInterColor, write=SetInterColor, default=TColor(0x58504a)};
|
||||
private:
|
||||
Vcl::Imaging::Pngimage::TPngImage *m_pPngButton, *m_pPngFoucusButton;
|
||||
Vcl::Imaging::Pngimage::TPngImage *pTmpDraw, *pTmpFoucusDraw;
|
||||
void __fastcall PaintCustomer(void);
|
||||
void __fastcall PaintCustomerText(void);
|
||||
|
||||
public:
|
||||
TRect rtCaption;
|
||||
|
||||
__published:
|
||||
__property int FontSize = {write=SetFontSize, default=8};
|
||||
__property String Caption = {read=FCaption, write=SetCaption};
|
||||
|
||||
};
|
||||
/**************************************************************************************************/
|
||||
/**************************************************************************************************/
|
||||
class PACKAGE TComboBoxComponent : public CBCapButton
|
||||
{
|
||||
private:
|
||||
TComboBoxChangeEvent FOnChange; // ComboBox变化事件
|
||||
int FItemHeight,
|
||||
FShowItemCount;
|
||||
TComboBoxMode FShowMode;
|
||||
|
||||
TDropListView *m_DropListView; // 定义下拉列表框
|
||||
bool m_IsMouseOver;
|
||||
int m_ClickStat; // .....
|
||||
|
||||
|
||||
void __fastcall DoItemClick(TComboBoxItem *Sender, int Index);
|
||||
|
||||
// 处理下拉列表隐藏、显示事件
|
||||
void __fastcall DoDropListShow(TObject *Sender);
|
||||
void __fastcall DoDropListHide(TObject *Sender);
|
||||
|
||||
int __fastcall GetDefaultItem();
|
||||
int __fastcall GetItemsCount();
|
||||
|
||||
void __fastcall SetDefaultItem(int Value);
|
||||
void __fastcall SetItemHeight(int Value);
|
||||
void __fastcall SetShowItemCount(int Value);
|
||||
void __fastcall SetShowMode(TComboBoxMode Value);
|
||||
|
||||
void __fastcall DoMouseEnter(TObject *Sender);
|
||||
void __fastcall DoMouseLeave(TObject *Sender);
|
||||
|
||||
//MESSAGE void __fastcall CMMouseEnter(TMessage &Message);
|
||||
//MESSAGE void __fastcall CMMouseLeave(TMessage &Message);
|
||||
|
||||
//BEGIN_MESSAGE_MAP
|
||||
// MESSAGE_HANDLER(CM_MOUSEENTER, TMessage, CMMouseEnter)
|
||||
// MESSAGE_HANDLER(CM_MOUSELEAVE, TMessage, CMMouseLeave)
|
||||
//END_MESSAGE_MAP(CBCapButton)
|
||||
|
||||
|
||||
protected:
|
||||
DYNAMIC void __fastcall MouseDown(TMouseButton Button, TShiftState Shift, int X, int Y);
|
||||
DYNAMIC void __fastcall MouseUp(TMouseButton Button, TShiftState Shift, int X, int Y);
|
||||
|
||||
virtual void __fastcall SetParent(TWinControl* AParent);
|
||||
public:
|
||||
__fastcall TComboBoxComponent(TComponent *Owner);
|
||||
__fastcall ~TComboBoxComponent();
|
||||
|
||||
TComboBoxItem * __fastcall AddItem(String Caption);
|
||||
void __fastcall Clear();
|
||||
void __fastcall RemoveItem(int Index);
|
||||
TComboBoxItem * __fastcall GetItem(int Index);
|
||||
virtual void __fastcall SetFontSize( int value );
|
||||
virtual void __fastcall SetFont( String name, int size );
|
||||
__property int DefItemIndex = {read = GetDefaultItem, write = SetDefaultItem};
|
||||
__property int ItemsCount = {read = GetItemsCount};
|
||||
|
||||
__published:
|
||||
__property TComboBoxChangeEvent OnChange = {read = FOnChange, write = FOnChange};
|
||||
|
||||
__property int ItemHeight = {read = FItemHeight, write = SetItemHeight, default = 20};
|
||||
__property int ShowItemCount = {read = FShowItemCount, write = SetShowItemCount, default = 10};
|
||||
__property TComboBoxMode ShowMode = {read = FShowMode, write = SetShowMode, default = cbShowDown};
|
||||
__property TWinControl* Parent = {read=FParent, write=SetParent};
|
||||
};
|
||||
/**************************************************************************************************/
|
||||
/**************************************************************************************************/
|
||||
|
||||
#endif
|
||||
+1043
File diff suppressed because it is too large
Load Diff
+247
@@ -0,0 +1,247 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#ifndef ComposeH
|
||||
#define ComposeH
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#include <vector>
|
||||
#include "ProCommon.h"
|
||||
using namespace std;
|
||||
|
||||
#define POINTS_PER_BAR 120 //每小节点数
|
||||
|
||||
#define SEGTYPE_VAR 0
|
||||
#define SEGTYPE_FILL 1
|
||||
#define SEGTYPE_INTRO 2
|
||||
#define SEGTYPE_ENDING 3
|
||||
|
||||
#define CHECK_GET 0x0000
|
||||
#define CHECK_STAGE 0x0001
|
||||
#define CHECK_TRACK 0x0002
|
||||
#define CHECK_CHORD 0x0004
|
||||
#define CHECK_KEY 0x0008
|
||||
#define CHECK_PROG 0x0010
|
||||
#define CHECK_STAGEALL 0x001F
|
||||
#define CHECK_VOL 0x0020
|
||||
#define CHECK_ALL 0x00FF
|
||||
|
||||
/***************************************************************************************/
|
||||
// 全局类定义
|
||||
/***************************************************************************************/
|
||||
// TCompose
|
||||
typedef struct tagBar0
|
||||
{
|
||||
//每小节最多POINTS_PER_BAR个音量值
|
||||
DWORD aVols[POINTS_PER_BAR];
|
||||
bool aRecording[POINTS_PER_BAR];
|
||||
TBarChords aChords;
|
||||
bool bInvalid; // 是否无效
|
||||
|
||||
tagBar0()
|
||||
{
|
||||
bInvalid = false;
|
||||
memset( this, 0, sizeof(tagBar0) );
|
||||
}
|
||||
|
||||
tagBar0( tagBar0* pSrc )
|
||||
{
|
||||
memcpy( this, pSrc, sizeof(tagBar0));
|
||||
}
|
||||
} TBarOld, *PTBarOld;
|
||||
|
||||
typedef struct tagBar
|
||||
{
|
||||
TBarChords aChords; //和弦
|
||||
char iBarKey; // 小节的调号
|
||||
char reserved[3]; // 保留字段,对齐字节
|
||||
|
||||
tagBar()
|
||||
{
|
||||
memset( this, 0, sizeof(tagBar) );
|
||||
iBarKey = -1;
|
||||
}
|
||||
|
||||
tagBar( tagBar* pSrc )
|
||||
{
|
||||
memcpy( this, pSrc, sizeof(tagBar));
|
||||
}
|
||||
} TBar, *PTBar;
|
||||
|
||||
typedef vector<TTrack*> TTrackList;
|
||||
typedef vector<TBar*> TBarList;
|
||||
|
||||
typedef struct tagOpusStage //曲式分段信息
|
||||
{
|
||||
char iSegType; //片段类型 0=VAR, 1=FILL, 2=INTRO, 3=ENDING
|
||||
char iSegNo; //最初片段号
|
||||
char iSegKey; //分段调号
|
||||
char nVol; //段落音量
|
||||
TBarList aBars; //小节列表
|
||||
TTrackList aTracks; //轨道数列表
|
||||
|
||||
tagOpusStage(){
|
||||
iSegKey = iSegType = iSegNo = -1;
|
||||
nVol = 100;
|
||||
}
|
||||
|
||||
tagOpusStage( tagOpusStage* pSrc ){
|
||||
iSegType = pSrc->iSegType;
|
||||
iSegNo = pSrc->iSegNo;
|
||||
iSegKey = pSrc->iSegKey;
|
||||
nVol = pSrc->nVol;
|
||||
}
|
||||
|
||||
~tagOpusStage(){
|
||||
while( !aBars.empty() ){
|
||||
delete aBars.back();
|
||||
aBars.pop_back();
|
||||
}
|
||||
while( !aTracks.empty() ){
|
||||
delete aTracks.back();
|
||||
aTracks.pop_back();
|
||||
}
|
||||
}
|
||||
} TOpusStage, *PTOpusStage;
|
||||
|
||||
typedef vector<TOpusStage*> TOpusStageList;
|
||||
typedef vector<TPROSTYLE*> STYLELIST;
|
||||
typedef vector<TStage*> TStageList;
|
||||
|
||||
typedef struct{
|
||||
UINT idLoc;
|
||||
UINT idStyle;
|
||||
vector<DWORD> aSegs;
|
||||
} TLocSegment;
|
||||
|
||||
typedef vector<TLocSegment*> LOCSEGLIST;
|
||||
|
||||
typedef struct{
|
||||
BYTE iBankOld;
|
||||
BYTE iBankNew;
|
||||
} TBankMap;
|
||||
|
||||
typedef vector<TBankMap*> BANKMAPLIST;
|
||||
|
||||
class TCompose
|
||||
{
|
||||
protected:
|
||||
UINT m_idLoc, m_idStyle;
|
||||
int m_nBarCount;
|
||||
|
||||
TOpusStageList m_lstStages;
|
||||
void ClearStages();
|
||||
|
||||
public:
|
||||
virtual void Clear();
|
||||
int StageCount() { return m_lstStages.size(); };
|
||||
TOpusStage* CopyStageAt( int iStage );
|
||||
TOpusStageList& StageList() { return m_lstStages; };
|
||||
virtual void Set( UINT idLoc, UINT idStyle, TOpusStageList& lstStages );
|
||||
virtual void Get( UINT& idLoc, UINT& idStyle, TOpusStageList& lstStages );
|
||||
int BarCount() { return m_nBarCount; };
|
||||
|
||||
virtual void WriteProj( LOCSEGLIST& lstLocSeg, FILE* pFile );
|
||||
virtual int ReadProj( STYLELIST& aUnsolvedStyles, FILE* pFile, DWORD dwVersion );
|
||||
void SetTempStyle( UINT idLoc, UINT idStyle, int idSet );
|
||||
void GetSpecBanks( vector<BYTE>& lstBank );
|
||||
void SetSpecBanks( BANKMAPLIST& lstMap );
|
||||
|
||||
TCompose() {
|
||||
m_idLoc = m_idStyle = -1;
|
||||
m_nBarCount = 0;
|
||||
};
|
||||
|
||||
~TCompose() {
|
||||
Clear();
|
||||
};
|
||||
};
|
||||
|
||||
class TTheme : public TCompose
|
||||
{
|
||||
private:
|
||||
bool m_bWeakup;
|
||||
int m_iKey;
|
||||
|
||||
public:
|
||||
bool Empty() { return m_lstStages.empty(); };
|
||||
bool IsWeadup() { return m_bWeakup; };
|
||||
TBar* GetFirstBar() { return m_lstStages[0]->aBars[0]; };
|
||||
int GetKey(){ return m_iKey; };
|
||||
|
||||
virtual void Clear();
|
||||
virtual void Set( UINT idLoc, UINT idStyle, TOpusStageList& lstStages );
|
||||
virtual void WriteProj( LOCSEGLIST& lstLocSeg, FILE* pFile );
|
||||
virtual int ReadProj( STYLELIST& aUnsolvedStyles, FILE* pFile, DWORD dwVersion );
|
||||
|
||||
void Build( TBarList& lstBars, vector<int>&lstStages );
|
||||
int GetFirstChord();
|
||||
int GetLastChord();
|
||||
void Set( TOpusStageList& lstStages );
|
||||
|
||||
|
||||
TTheme();
|
||||
};
|
||||
|
||||
class TOpus : public TCompose
|
||||
{
|
||||
private:
|
||||
BOOL m_bModified;
|
||||
TOpusStageList m_lstStagesBk;
|
||||
int m_iKeyBk;
|
||||
vector<DWORD> m_aStageBars;
|
||||
|
||||
public:
|
||||
TOpus();
|
||||
~TOpus();
|
||||
|
||||
virtual void Clear();
|
||||
virtual void Set( UINT idLoc, UINT idStyle, TOpusStageList& lstStages );
|
||||
virtual void WriteProj( LOCSEGLIST& lstLocSeg, FILE* pFile );
|
||||
virtual int ReadProj( STYLELIST& aUnsolvedStyles, FILE* pFile, DWORD dwVersion );
|
||||
|
||||
void ClearBackup();
|
||||
void CopyStages( int iStartBar, int iEndBar, TOpusStageList* lstStages );
|
||||
void Backup();
|
||||
void Restore();
|
||||
BOOL CheckModified( int iCheckType );
|
||||
void BuildStyleItem();
|
||||
void ChangeKey( int iBarStart, int iBarEnd, int iKey, int keys[] );
|
||||
void CountBars();
|
||||
int FindStage( int iBar, int *piFirstBar );
|
||||
int StageFirstBar( int iStage );
|
||||
int StageLastBar( int iStage );
|
||||
DWORD StageRange( int iStage );
|
||||
void InsertStage( int iIns, TOpusStage* pStage );
|
||||
void RemoveStage( int iDel );
|
||||
void CutStage( int iStage, int iCutBar );
|
||||
void ChangeStageBar( int iStage, int nBar, bool bCount );
|
||||
};
|
||||
|
||||
|
||||
/***************************************************************************************/
|
||||
// 全局变量
|
||||
/***************************************************************************************/
|
||||
extern int g_iPreStage, // 预设段落模式
|
||||
g_iMelodyKey; // 主旋律调号
|
||||
|
||||
extern float g_fMusicVolume; //伴奏音量
|
||||
extern bool g_bComposeMute; //伴奏静音
|
||||
|
||||
extern TTheme g_Theme; //主旋律对象
|
||||
extern TOpus g_Opus; //全曲对象
|
||||
extern TOpusStageList& g_lstOpusStages; //曲式结构段落表
|
||||
|
||||
extern vector<UINT> g_lstPaidStyleIDs; //当前工程本次使用已支付风格ID列表
|
||||
|
||||
/***************************************************************************************/
|
||||
// 全局函数
|
||||
/***************************************************************************************/
|
||||
|
||||
int FindStage( int iBar, int *piFirstBar=NULL );
|
||||
int FirstBar( int iStage );
|
||||
int GetBarCount();
|
||||
int GetBarKey( int iBar );
|
||||
TOpusStage* DuplicateStage( TOpusStage* pSrc );
|
||||
void ProduceTracks( TOpusStage* pStage, void* pSegItem );
|
||||
bool DiffStages( TOpusStage* pStage1, TOpusStage* pStage2, bool bPassSegNo=false,
|
||||
bool bPassFile=true );
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,326 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ContentPanelUnitH
|
||||
#define ContentPanelUnitH
|
||||
|
||||
#include "SkinScrollBarUnit.h"
|
||||
#include "ToolpalPanel.h"
|
||||
#include "StyleItem.h"
|
||||
#include "MenuUnit.h"
|
||||
#include "BaseTrack.h"
|
||||
|
||||
#define BAR_CURSOR 0x00
|
||||
#define BAR_TITLE 0x100
|
||||
#define BAR_DATA 0x200
|
||||
#define BAR_TRACK 0x400
|
||||
#define BAR_LEFT 0x1000
|
||||
#define MIN_HDR_WIDTH 120
|
||||
#define MAX_HDR_WIDTH 240
|
||||
|
||||
typedef struct tagShowTrack
|
||||
{
|
||||
BYTE type;
|
||||
BYTE index;
|
||||
BYTE iHover;
|
||||
TBaseTrack* pTrack;
|
||||
|
||||
tagShowTrack( BYTE ty, BYTE ind, TBaseTrack* p )
|
||||
{
|
||||
type = ty;
|
||||
index = ind;
|
||||
iHover = 0;
|
||||
pTrack = p;
|
||||
};
|
||||
}TShowTrack, *PTShowTrack;
|
||||
|
||||
typedef vector<TShowTrack*> TShowTrackList;
|
||||
//---------------------------------------------------------------------------
|
||||
class TContentPanel : public Extctrls::TPanel
|
||||
{
|
||||
private:
|
||||
//显示相关
|
||||
HRGN m_rgnClip;
|
||||
bool m_bVertical; //竖版/横版
|
||||
|
||||
int m_iMode, //0=音频模式 1=和弦模式 2=风格模式
|
||||
m_nRowShow,
|
||||
m_nTrackShow,
|
||||
m_nColumnNum,
|
||||
m_nRowNum,
|
||||
m_nBarNum,
|
||||
m_iBeginShowRow,
|
||||
m_iBeginShowBar,
|
||||
m_iBeginShowTrack,
|
||||
|
||||
m_nBarWidth,
|
||||
m_nBarHeight,
|
||||
m_nDataWidth,
|
||||
m_nBarDrawHeight,
|
||||
m_nRowGapHeight, //播放区
|
||||
m_nTitleHeight, //小节区
|
||||
m_nChordHeight, //和弦区
|
||||
m_nTrackHeight, //轨道区
|
||||
m_nTrkHdrWidth, //轨道头宽度
|
||||
|
||||
m_nLeftBound,
|
||||
m_nLeftOriBound,
|
||||
m_nRightBound,
|
||||
m_nTopBound,
|
||||
m_nBottomBound;
|
||||
|
||||
TShowTrackList m_aTracks; //显示的轨道
|
||||
|
||||
TSkinScrollBar *m_sbVert,
|
||||
*m_sbHoriz;
|
||||
TToolpalPanel *m_pStylePanel, //风格面板
|
||||
*m_pChordPanel, //和弦面板
|
||||
*m_pTrackPanel; //轨道面板
|
||||
|
||||
//选择相关
|
||||
int m_iSelBarStart,
|
||||
m_iSelBarEnd,
|
||||
m_iSelPointStart,
|
||||
m_iSelPointEnd,
|
||||
m_iSelTrackBar,
|
||||
m_iSelTrackPoint,
|
||||
m_iSelTrack;
|
||||
|
||||
//录音/播放相关
|
||||
bool m_bPlaying;
|
||||
int m_iPlayBar,
|
||||
m_iPlayPoint;
|
||||
TBitmap *m_imgPlayCursor,
|
||||
*m_imgMidiIcon,
|
||||
*m_imgWaveIcon;
|
||||
|
||||
TPngImage * m_imgBeatHint[4],
|
||||
*m_pngChordUp,
|
||||
*m_pngChordDown,
|
||||
*m_pngChord2,
|
||||
*m_pngChord4,
|
||||
*m_pngChord6,
|
||||
*m_pngChord7,
|
||||
*m_pngChordI,
|
||||
*m_pngChordV,
|
||||
*m_pngChordMaj,
|
||||
*m_pngChordMin,
|
||||
*m_pngChordSus;
|
||||
int m_iBeatHint,
|
||||
m_lBeatHint,
|
||||
m_tBeatHint,
|
||||
m_wBeatHint,
|
||||
m_hBeatHint;
|
||||
|
||||
//和弦相关
|
||||
int m_nChordTxtWidth,
|
||||
m_nChordTxtHeight,
|
||||
m_iMinSelBar,
|
||||
m_iMaxSelBar,
|
||||
m_iSelCellStart,
|
||||
m_iSelCellEnd;
|
||||
|
||||
//复制剪切相关
|
||||
int m_iCopyBarStart,
|
||||
m_iCopyBarEnd,
|
||||
m_iCopyCellStart,
|
||||
m_iCopyCellEnd,
|
||||
m_iCopyPointStart,
|
||||
m_iCopyPointEnd,
|
||||
m_iCopyAudio;
|
||||
bool m_bCut;
|
||||
|
||||
//拖动相关
|
||||
int m_iDropBar,
|
||||
m_iMouseDownBar,
|
||||
m_iMouseDownPoint,
|
||||
m_iDragingStage,
|
||||
m_iDragAudio; //拖动的音频轨
|
||||
bool m_bDragReady, //鼠标拖动进行选择操作
|
||||
m_bDraging,
|
||||
m_bBrush;
|
||||
TPoint ptDown;
|
||||
TCommonItem *m_pItem;
|
||||
|
||||
TTimer *m_pTimer; //自动滚屏定时器
|
||||
|
||||
TMenuPanel *m_PopupMenu; //右键菜单 //add
|
||||
TApplicationEvents *m_ApplicationEvents;
|
||||
|
||||
void ChordPaste( int key[], int type[], int len, bool bAddUndo=true );
|
||||
// void ChangeMelodyKey( int Index );
|
||||
void ChangeBarsKey( int iBarStart, int iBarEnd, int iKey, int keys[] );
|
||||
void AudioMove( int iSrcTrack, int iBarStart, int iPointStart,
|
||||
int iBarEnd, int iPointEnd, bool bCut );
|
||||
void GetBarKeys( int iBarStart, int iBarEnd, int keys[] );
|
||||
void ChangeMidiTrack( int iMT=-1, int iSBar=-1, int iEBar=-1 );
|
||||
|
||||
void ClearShowTracks();
|
||||
void ShowTrackChangeState( int iTrack, int iType );
|
||||
void ShowPlayPoint();
|
||||
|
||||
void CalcViewArea();
|
||||
bool SetScrollView( int iFirstShowBar );
|
||||
|
||||
void DrawBars();
|
||||
void DrawBarTitle( int l, int r, int t, bool bSel );
|
||||
void DrawBarData( int iBar, int iStage, int iFirstBar, int left, int top );
|
||||
void DrawTrack( int iBar, int nBarNum, int left, int top, int iTrack );
|
||||
void DrawRowWave( int iBar, int nBarNum, int left, int top, int iWave );
|
||||
void DrawRowMidi( int iBar, int nBarNum, int left, int top, int iMidi );
|
||||
void DrawChord( TRect& rcDraw, int iBarKey, int iKey, int iType );
|
||||
|
||||
//HitTest返回iHitType值 -1=无效区域 0=行间空白 1=小节栏 2=和弦区 >=3 波形区
|
||||
DWORD HitTest( int X, int Y, int& iHitType, bool bHead=false );
|
||||
|
||||
void SelectRange( int iBarStart, int iPointStart, int iBarEnd, int iPointEnd, bool bInvalid=false );
|
||||
void SelectCopyBars( int iBarStart, int iBarEnd, bool bCut=false );
|
||||
void SelectCopyCells( int iBarStart, int iCellStart, int iBarEnd, int iCellEnd );
|
||||
void SelectCopyPos( int iBarStart, int iPointStart, int iBarEnd, int iPointEnd );
|
||||
void SetDropBar( int iBar );
|
||||
void SelectRangeByWave( int iHitBar, int iHitPoint );
|
||||
|
||||
int GetCell( int iPoint );
|
||||
void GetSelectChord( int& iBarKey, int& iChordKey, int& iChordType );
|
||||
|
||||
void DrawDragImg( int mode );
|
||||
void SetScrollTimer(TPoint ptMouse, bool bVertical=true);
|
||||
void HandleDropEvent( int iState=0 );
|
||||
bool HandleHoverEvent(TPoint ptMouse);
|
||||
void HandleBrush();
|
||||
|
||||
void OnAudioEffectProcess( int iFxType );
|
||||
void OnAudioEffectAdd( int iFxType );
|
||||
void OnWMScroll(TWMScroll &Message, bool bVertical);
|
||||
|
||||
void __fastcall DoHandleMessage(MSG &Msg, bool &Handled); //鼠标消息处理
|
||||
void __fastcall TimerProc(TObject* Sender);
|
||||
void __fastcall DoubleClick(TObject* sender);
|
||||
void __fastcall DoSetSelPosStart(System::TObject* Sender);
|
||||
void __fastcall DoSetSelPosEnd(System::TObject* Sender);
|
||||
void __fastcall DoDelSelPosStart(System::TObject* Sender);
|
||||
void __fastcall DoDelSelPosEnd(System::TObject* Sender);
|
||||
void __fastcall DoAudioFxProcess(System::TObject* Sender);
|
||||
void __fastcall DoAudioVstProcess(System::TObject* Sender);
|
||||
void __fastcall DoAudioAddFx(System::TObject* Sender);
|
||||
void __fastcall DoAudioAddVst(System::TObject* Sender);
|
||||
|
||||
MESSAGE void __fastcall OnMidiSwitch(TMessage &msg);
|
||||
MESSAGE void __fastcall UMMouseMove(TWMMouse &Message);
|
||||
MESSAGE void __fastcall UMMouseUp(TWMMouse &Message);
|
||||
MESSAGE void __fastcall WMEraseBkgnd(TWMEraseBkgnd &Message);
|
||||
MESSAGE void __fastcall WMSize(TWMSize &Message);
|
||||
MESSAGE void __fastcall WMVScroll(TWMScroll &Message);
|
||||
MESSAGE void __fastcall WMHScroll(TWMScroll &Message);
|
||||
MESSAGE void __fastcall WMMouseWheel(TWMMouseWheel &Message);
|
||||
MESSAGE void __fastcall WMMouseDown(TWMMouse &Message);
|
||||
|
||||
BEGIN_MESSAGE_MAP
|
||||
MESSAGE_HANDLER(WM_ERASEBKGND, TWMEraseBkgnd, WMEraseBkgnd)
|
||||
MESSAGE_HANDLER(WM_SIZE, TWMSize, WMSize)
|
||||
MESSAGE_HANDLER(WM_VSCROLL, TWMVScroll, WMVScroll)
|
||||
MESSAGE_HANDLER(WM_HSCROLL, TWMHScroll, WMHScroll)
|
||||
MESSAGE_HANDLER(WM_MOUSEWHEEL, TWMMouseWheel, WMMouseWheel)
|
||||
MESSAGE_HANDLER(WM_LBUTTONDOWN, TWMMouse, WMMouseDown)
|
||||
MESSAGE_HANDLER(WM_RBUTTONDOWN, TWMMouse, WMMouseDown)
|
||||
MESSAGE_HANDLER(UM_MOUSEMOVE, TWMMouseMove, UMMouseMove)
|
||||
MESSAGE_HANDLER(UM_MOUSEUP, TWMMouse, UMMouseUp)
|
||||
MESSAGE_HANDLER(UM_MIDISWITCH, TMessage, OnMidiSwitch)
|
||||
END_MESSAGE_MAP(Vcl::Extctrls::TPanel)
|
||||
|
||||
protected:
|
||||
virtual void __fastcall CreateWnd();
|
||||
virtual void __fastcall Paint(void);
|
||||
|
||||
public:
|
||||
inline void SetStylePanel( TToolpalPanel* pPanel ){ m_pStylePanel=pPanel; };
|
||||
inline void SetChordPanel( TToolpalPanel* pPanel ){ m_pChordPanel=pPanel; };
|
||||
inline void SetTrackPanel( TToolpalPanel* pPanel ){ m_pTrackPanel=pPanel; };
|
||||
inline void SetPopMenu( TMenuPanel* pMenu ){ m_PopupMenu = pMenu; };
|
||||
|
||||
void InitialVars( bool bClear = false );
|
||||
inline int GetBarNum(){ return m_nBarNum; };
|
||||
void AddNewBar( int iBar );
|
||||
void ShowBeatHint( int iBeat );
|
||||
|
||||
void SetMode( int iMode );
|
||||
void SetScrollMode( bool bVertical=true );
|
||||
inline bool IsVertical() { return m_bVertical; };
|
||||
inline void Play( bool bPlay ) { m_bPlaying=bPlay; };
|
||||
inline bool IsPlaying() { return m_bPlaying; };
|
||||
void SetPlayPoint( int iBar, int iPoint );
|
||||
|
||||
int GetShowTrackId( int type, int index );
|
||||
void SelectTrack( int iTrack, int iBar, int iPoint, bool bClear=true );
|
||||
void ShowTrack( int type, int index, bool bShow );
|
||||
void DeleteTrack( int type, int index );
|
||||
|
||||
void SetSelectRange( int iStartBar, int iStartPoint, int iEndBar, int iEndPoint, bool bInvalid=false );
|
||||
void GetSelectRange( int& iStartBar, int& iStartPoint, int& iEndBar, int& iEndPoint );
|
||||
inline bool IsModifyMode() { return !(m_iSelBarStart<0 && m_iSelBarEnd<0); };
|
||||
|
||||
bool SetSelectChord( int iKey, int iChordType );
|
||||
void GetChordDispalyKey( int iKey, int iBarKey, int& iMainKey, int& iAjustKey );
|
||||
|
||||
void SelectCells( int iBarStart, int iCellStart, int iBarEnd, int iCellEnd );
|
||||
void SelectStage( int iStage );
|
||||
void SelectBars( int iStartBar, int iEndBar );
|
||||
void GetSelectBars( int& iStartBar, int& iEndBar );
|
||||
|
||||
void InvalidateBar( int iBar, int iBeginPoint, int iEndPoint, int iArea=BAR_DATA );
|
||||
void InvalidateBars( int iBarStart, int iBarEnd, int iArea=BAR_DATA );
|
||||
void InvalidateShowBars( int iArea=BAR_TITLE|BAR_DATA|BAR_TRACK );
|
||||
void InvalidateStage( int iStage, int iArea=BAR_DATA );
|
||||
void ScrollView( int nPos, bool bVertical=true, bool bRedraw=true );
|
||||
|
||||
bool ShowDragImg( bool bShow=true, int iState=0 );
|
||||
TCommonItem* GetDropItem(){ return m_pItem; };
|
||||
void SetDropItem( TCommonItem* pItem ){ m_pItem = pItem; };
|
||||
void BeginBrush( TCommonItem* pBrushItem );
|
||||
void CancelBrush();
|
||||
bool IsStyleBrush() { return m_bBrush; };
|
||||
|
||||
void Undo( bool bUndo );
|
||||
|
||||
void __fastcall OnTrackStateChanged( int iType, int iIndex, BYTE iState, bool bUnset );
|
||||
void __fastcall OnStageChanged( int iStage, int iMode );
|
||||
void __fastcall OnChangeMelodyKey( int Index );
|
||||
void __fastcall OnDirectionKey( WORD key );
|
||||
|
||||
void __fastcall DoCancelAll(System::TObject* Sender);
|
||||
void __fastcall DoSelectAll(System::TObject* Sender);
|
||||
void __fastcall DoInsertBlankBar(System::TObject* Sender);
|
||||
void __fastcall DoBarsCopy(System::TObject* Sender);
|
||||
void __fastcall DoBarsCut(System::TObject* Sender);
|
||||
void __fastcall DoBarsDelete(System::TObject* Sender);
|
||||
void __fastcall DoBarsInsert(System::TObject* Sender);
|
||||
void __fastcall DoBarsChangeKey(System::TObject* Sender);
|
||||
void __fastcall DoChordCopy(System::TObject* Sender);
|
||||
void __fastcall DoChordPaste(System::TObject* Sender);
|
||||
void __fastcall DoChordDelete(System::TObject* Sender);
|
||||
void __fastcall DoAudioDelete(System::TObject* Sender);
|
||||
void __fastcall DoAudioCopy(System::TObject* Sender);
|
||||
void __fastcall DoAudioCut(System::TObject* Sender);
|
||||
void __fastcall DoAudioPaste(System::TObject* Sender);
|
||||
void __fastcall DoAudioLoad(System::TObject* Sender);
|
||||
void __fastcall DoTrackAdd(System::TObject* Sender);
|
||||
void __fastcall DoTrackDel(System::TObject* Sender);
|
||||
void __fastcall DoTrackShow(System::TObject* Sender);
|
||||
void __fastcall DoTrackHide(System::TObject* Sender);
|
||||
void __fastcall DoTrackSave(System::TObject* Sender);
|
||||
void __fastcall DoTrackMute(System::TObject* Sender);
|
||||
void __fastcall DoTrackSolo(System::TObject* Sender);
|
||||
void __fastcall DoInsertTexture(TObject* Sender);
|
||||
void __fastcall DoDeleteTexture(TObject* Sender);
|
||||
void __fastcall DoSwitchTexture(TObject* Sender);
|
||||
void __fastcall DoSwitchFontProg(TObject* Sender);
|
||||
void __fastcall DoTrackSwitchTexture(TObject* Sender);
|
||||
void __fastcall DoTrackSwitchFontProg(TObject* Sender);
|
||||
|
||||
void __fastcall CreateEditMenu(TMenuPanel *Menu, bool bEnabled);
|
||||
void __fastcall CreateTrackMenu(TMenuPanel *Menu, bool bEnabled);
|
||||
|
||||
__fastcall virtual TContentPanel(System::Classes::TComponent* AOwner);
|
||||
__fastcall ~TContentPanel();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,53 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "CustomerSettingFormUnit.h"
|
||||
#include "GlobalUnit.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
#pragma link "GeneralDialogPanel"
|
||||
#pragma link "TextButton"
|
||||
#pragma resource "*.dfm"
|
||||
TCustomerSettingForm *CustomerSettingForm;
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TCustomerSettingForm::TCustomerSettingForm(TComponent* Owner)
|
||||
: TForm(Owner)
|
||||
{
|
||||
m_pBKGGeneralDialogPanel->Font->Size = g_szFont9;
|
||||
|
||||
m_pCSPanel = new TCustmerSettingPanel(m_pBKGGeneralDialogPanel);
|
||||
m_pCSPanel->Font->Size = g_szFont9;
|
||||
|
||||
m_pCSPanel->Parent = m_pBKGGeneralDialogPanel;
|
||||
int nHeightTmp = m_pTextButtonOK->Top - PANEL_START - PANEL_HEIGHT;
|
||||
m_pCSPanel->SetBounds( PANEL_LEFT,
|
||||
PANEL_START + nHeightTmp/2,
|
||||
Width - PANEL_LEFT - PANEL_RIGHT,
|
||||
PANEL_HEIGHT );
|
||||
|
||||
m_pTextButtonOK->FontSize = g_szFont9;
|
||||
m_pTextButtonCancel->FontSize = g_szFont9;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
__fastcall TCustomerSettingForm::~TCustomerSettingForm()
|
||||
{
|
||||
if( m_pCSPanel ){
|
||||
delete m_pCSPanel;
|
||||
m_pCSPanel = NULL;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TCustomerSettingForm::FormShow(TObject *Sender)
|
||||
{
|
||||
m_bAlphaKeyOrig = g_bAlphaKey;
|
||||
m_iSegColorOrig = g_iSegColorMode;
|
||||
|
||||
m_pCSPanel->SetContent();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
object CustomerSettingForm: TCustomerSettingForm
|
||||
Left = 0
|
||||
Top = 0
|
||||
BorderStyle = bsNone
|
||||
Caption = 'CustomerSettingForm'
|
||||
ClientHeight = 351
|
||||
ClientWidth = 433
|
||||
Color = clBtnFace
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
Font.Quality = fqClearTypeNatural
|
||||
Position = poMainFormCenter
|
||||
Scaled = False
|
||||
OnShow = FormShow
|
||||
TextHeight = 14
|
||||
object m_pBKGGeneralDialogPanel: TGeneralDialogPanel
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 433
|
||||
Height = 351
|
||||
Caption = #20559#22909#35774#32622
|
||||
Color = 5064257
|
||||
ParentBackground = False
|
||||
TabOrder = 0
|
||||
object m_pTextButtonOK: TTextButton
|
||||
Left = 149
|
||||
Top = 315
|
||||
Width = 56
|
||||
Height = 25
|
||||
ModalResult = mrYes
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
Text = #30830#23450
|
||||
end
|
||||
object m_pTextButtonCancel: TTextButton
|
||||
Left = 224
|
||||
Top = 315
|
||||
Width = 56
|
||||
Height = 25
|
||||
ModalResult = mrCancel
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
Text = #21462#28040
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,40 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef CustomerSettingFormUnitH
|
||||
#define CustomerSettingFormUnitH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <System.Classes.hpp>
|
||||
#include <Vcl.Controls.hpp>
|
||||
#include <Vcl.StdCtrls.hpp>
|
||||
#include <Vcl.Forms.hpp>
|
||||
#include "GeneralDialogPanel.h"
|
||||
#include <Vcl.ExtCtrls.hpp>
|
||||
#include "CustomerSettingPanelUnit.h"
|
||||
#include "TextButton.h"
|
||||
//---------------------------------------------------------------------------
|
||||
class TCustomerSettingForm : public TForm
|
||||
{
|
||||
|
||||
__published: // IDE-managed Components
|
||||
|
||||
TGeneralDialogPanel *m_pBKGGeneralDialogPanel;
|
||||
TTextButton *m_pTextButtonOK;
|
||||
TTextButton *m_pTextButtonCancel;
|
||||
void __fastcall FormShow(TObject *Sender);
|
||||
|
||||
private: // User declarations
|
||||
|
||||
public: // User declarations
|
||||
TCustmerSettingPanel *m_pCSPanel;
|
||||
|
||||
bool m_bAlphaKeyOrig;
|
||||
int m_iSegColorOrig;
|
||||
|
||||
__fastcall TCustomerSettingForm(TComponent* Owner);
|
||||
__fastcall ~TCustomerSettingForm();
|
||||
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
extern PACKAGE TCustomerSettingForm *CustomerSettingForm;
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
@@ -0,0 +1,420 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "CustomerSettingPanelUnit.h"
|
||||
#include "GlobalUnit.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
//---------------------------------------------------------------------------
|
||||
#define SCOLLBAR_WIDTH (14)
|
||||
#define TOP_BUTTOM (10)
|
||||
#define LEFT_RIGHT (SCOLLBAR_WIDTH + 20)
|
||||
|
||||
const static COLORREF
|
||||
CLR_TXT_HOT = RGB(171, 186, 207),
|
||||
// CLR_BKG_INTERNAL = RGB(65, 70, 77),
|
||||
CLR_BKG_INTERNAL = RGB(47, 50, 56),
|
||||
CLR_BKG_INTERNAL_LIGHT = RGB(73, 77, 86),
|
||||
CLR_CONTENT_DB_LINE_DARK = RGB(32, 35, 39),
|
||||
CLR_CONTENT_DB_LINE_LIGHT = RGB(76, 81, 87);
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
__fastcall TCustmerSettingPanel::TCustmerSettingPanel( TComponent* Owner)
|
||||
: Vcl::Extctrls::TPanel( Owner )
|
||||
{
|
||||
Color = CLR_BKG_INTERNAL;
|
||||
|
||||
m_ScrollBar = NULL;
|
||||
m_iTopLine =0;
|
||||
m_iShowLine = 1;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TCustmerSettingPanel::CreateWnd()
|
||||
{
|
||||
Vcl::Extctrls::TPanel::CreateWnd();
|
||||
|
||||
m_ckInitProject = new TCKBox(this);
|
||||
m_ckDownloadStyle = new TCKBox(this);
|
||||
m_ckPreBeat = new TCKBox(this);
|
||||
m_ckSegColor = new TCKBox(this);
|
||||
m_cbChordMode = new TComboBoxComponent(this);
|
||||
m_cbPreStage = new TComboBoxComponent(this);
|
||||
|
||||
m_ckInitProject->Parent = this;
|
||||
m_ckDownloadStyle->Parent = this;
|
||||
m_ckPreBeat->Parent = this;
|
||||
m_ckSegColor->Parent = this;
|
||||
m_cbChordMode->Parent = this;
|
||||
m_cbPreStage->Parent = this;
|
||||
|
||||
m_ckInitProject->Font->Size = g_szFont9;
|
||||
m_ckDownloadStyle->Font->Size = g_szFont9;
|
||||
m_ckPreBeat->Font->Size = g_szFont9;
|
||||
m_ckSegColor->Font->Size = g_szFont9;
|
||||
m_cbChordMode->SetFontSize(g_szFont9);
|
||||
m_cbPreStage->SetFontSize(g_szFont9);
|
||||
|
||||
m_ckInitProject->Font->Color = CLR_TXT_HOT;
|
||||
m_ckDownloadStyle->Font->Color = CLR_TXT_HOT;
|
||||
m_ckPreBeat->Font->Color = CLR_TXT_HOT;
|
||||
m_ckSegColor->Font->Color = CLR_TXT_HOT;
|
||||
|
||||
Canvas->Font->Assign(m_ckPreBeat->Font);
|
||||
|
||||
m_ckInitProject->Caption = L"启动时自动打开上次工程";
|
||||
m_ckDownloadStyle->Caption = L"自动下载风格";
|
||||
m_ckPreBeat->Caption = L"录音时使用预设风格节拍提示";
|
||||
m_ckSegColor->Caption = L"按乐器数显示段落颜色";
|
||||
|
||||
m_ckInitProject->Width = 180;
|
||||
m_ckDownloadStyle->Width = 120;
|
||||
m_ckPreBeat->Width = 180;
|
||||
m_ckSegColor->Width = 180;
|
||||
|
||||
m_cbChordMode->AddItem(L"级数");
|
||||
m_cbChordMode->AddItem(L"英文");
|
||||
m_cbChordMode->Height = 24;
|
||||
|
||||
m_cbPreStage->AddItem(L"M");
|
||||
m_cbPreStage->AddItem(L"IME");
|
||||
m_cbPreStage->AddItem(L"IMIME");
|
||||
m_cbPreStage->Height = 24;
|
||||
|
||||
m_ckInitProject->OnChange = CKBoxChange;
|
||||
m_ckDownloadStyle->OnChange = CKBoxChange;
|
||||
m_ckPreBeat->OnChange = CKBoxChange;
|
||||
m_ckSegColor->OnChange = CKBoxChange;
|
||||
m_cbChordMode->OnChange = ChordModeChange;
|
||||
m_cbPreStage->OnChange = PreStageChange;
|
||||
|
||||
if( SOFTWARE_ID==e_Pro_Lite )
|
||||
m_ckDownloadStyle->Enabled = false;
|
||||
|
||||
SetShowLine();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
__fastcall TCustmerSettingPanel::~TCustmerSettingPanel()
|
||||
{
|
||||
if( m_ScrollBar ){
|
||||
delete m_ScrollBar;
|
||||
m_ScrollBar = NULL;
|
||||
}
|
||||
|
||||
if( m_ckInitProject ){
|
||||
delete m_ckInitProject;
|
||||
m_ckInitProject = NULL;
|
||||
}
|
||||
|
||||
if( m_ckDownloadStyle ){
|
||||
delete m_ckDownloadStyle;
|
||||
m_ckDownloadStyle = NULL;
|
||||
}
|
||||
|
||||
if( m_ckPreBeat ){
|
||||
delete m_ckPreBeat;
|
||||
m_ckPreBeat = NULL;
|
||||
}
|
||||
|
||||
if( m_ckSegColor ){
|
||||
delete m_ckSegColor;
|
||||
m_ckSegColor = NULL;
|
||||
}
|
||||
|
||||
if( m_cbChordMode ){
|
||||
delete m_cbChordMode;
|
||||
m_cbChordMode = NULL;
|
||||
}
|
||||
|
||||
if( m_cbPreStage ){
|
||||
delete m_cbPreStage;
|
||||
m_cbPreStage = NULL;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TCustmerSettingPanel::WMEraseBkgnd(TWMEraseBkgnd &Message)
|
||||
{
|
||||
TRect rect = GetClientRect();
|
||||
|
||||
TCanvas* tempCanvas = new TCanvas;
|
||||
tempCanvas->Handle = Message.DC;
|
||||
|
||||
tempCanvas->Brush->Color = CLR_BKG_INTERNAL; //背景颜色
|
||||
tempCanvas->FillRect( rect );
|
||||
tempCanvas->Brush->Color = CLR_CONTENT_DB_LINE_DARK;
|
||||
tempCanvas->FrameRect( rect );
|
||||
|
||||
delete tempCanvas;
|
||||
tempCanvas = NULL;
|
||||
|
||||
// DefaultHandler( &Message );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TCustmerSettingPanel::WMVScroll(Winapi::Messages::TWMScroll &Message)
|
||||
{
|
||||
int minpos, maxpos, page, curpos;
|
||||
m_ScrollBar->GetScrollRange(&minpos, &maxpos);
|
||||
page = m_ScrollBar->GetPageSize();
|
||||
// Get the current position of scroll box.
|
||||
curpos = m_ScrollBar->GetScrollPos();
|
||||
|
||||
// Determine the new position of scroll box.
|
||||
switch (Message.ScrollCode)
|
||||
{
|
||||
case SB_TOP: // Scroll to far top.
|
||||
curpos = minpos;
|
||||
break;
|
||||
|
||||
case SB_BOTTOM: // Scroll to far bottom.
|
||||
curpos = maxpos-page+1;
|
||||
break;
|
||||
|
||||
case SB_ENDSCROLL: // End scroll.
|
||||
break;
|
||||
|
||||
case SB_LINEUP: // Scroll left.
|
||||
if (curpos > minpos)
|
||||
curpos--;
|
||||
break;
|
||||
|
||||
case SB_LINEDOWN: // Scroll right.
|
||||
if (curpos < maxpos-page+1)
|
||||
curpos++;
|
||||
break;
|
||||
|
||||
case SB_PAGEUP: // Scroll one page left.
|
||||
if (curpos > minpos)
|
||||
curpos = (minpos > curpos-page) ? minpos : curpos-page;
|
||||
//max(minpos, curpos-page);
|
||||
break;
|
||||
|
||||
case SB_PAGEDOWN: // Scroll one page right.
|
||||
if( curpos<maxpos )
|
||||
curpos = (maxpos-page+1 < curpos+page) ? maxpos-page+1 : curpos+page;
|
||||
//min(maxpos-page+1, curpos+page);
|
||||
break;
|
||||
|
||||
case SB_THUMBPOSITION: // Scroll to absolute position. nPos is the position
|
||||
curpos = Message.Pos; // of the scroll box at the end of the drag operation.
|
||||
break;
|
||||
|
||||
case SB_THUMBTRACK: // Drag scroll box to specified position. nPos is the
|
||||
curpos = Message.Pos; // position that the scroll box has been dragged to.
|
||||
break;
|
||||
}
|
||||
|
||||
// Set the new position of the thumb (scroll box).
|
||||
if( Message.ScrollBar!=m_ScrollBar->Handle ){
|
||||
m_ScrollBar->SetPosition(curpos);
|
||||
// Paint();
|
||||
}
|
||||
if( m_iTopLine != curpos ){
|
||||
m_iTopLine = curpos;
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
Message.Result = true;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TCustmerSettingPanel::WMMouseWheel(TWMMouseWheel &Message)
|
||||
{
|
||||
if( m_ScrollBar && m_ScrollBar->Visible ){
|
||||
UINT nSBCode;
|
||||
|
||||
if( Message.WheelDelta>0 ) nSBCode = SB_LINEUP;
|
||||
else nSBCode = SB_LINEDOWN;
|
||||
|
||||
Perform( WM_VSCROLL, MAKELONG(nSBCode,0), NULL );
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TCustmerSettingPanel::SetShowLine()
|
||||
{
|
||||
int totalLine = LINE_NUM;
|
||||
m_iShowLine = Height/LINE_HEIGHT;
|
||||
|
||||
if( totalLine>m_iShowLine ){
|
||||
m_ScrollBar = new TSkinScrollBar(this);
|
||||
m_ScrollBar->m_pWndCtrl = this;
|
||||
m_ScrollBar->Parent = this;
|
||||
m_ScrollBar->Height = Height-2;
|
||||
m_ScrollBar->Left = Width - m_ScrollBar->Width - 1;
|
||||
m_ScrollBar->Top = 1;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TCustmerSettingPanel::SetContent()
|
||||
{
|
||||
/* m_ckInitProject->Width = 155;
|
||||
m_ckDownloadStyle->Width = 95;
|
||||
m_ckPreBeat->Width = 180;
|
||||
*/
|
||||
m_bAutoOpenProject = g_bAutoOpenProject;
|
||||
m_bDownloadStyle = g_bAutoDownloadStyle;
|
||||
m_bPreBeat = g_bPrebeat;
|
||||
m_bAlphaKey = g_bAlphaKey;
|
||||
m_bSegColor = g_iSegColorMode==1;
|
||||
m_cPreStage = g_iPreStageDefault;
|
||||
|
||||
m_ckInitProject->Checked = m_bAutoOpenProject;
|
||||
m_ckDownloadStyle->Checked = m_bDownloadStyle;
|
||||
m_ckPreBeat->Checked = m_bPreBeat;
|
||||
m_ckSegColor->Checked = m_bSegColor;
|
||||
m_cbChordMode->DefItemIndex = g_bAlphaKey;
|
||||
m_cbPreStage->DefItemIndex = g_iPreStageDefault;
|
||||
|
||||
if(m_ScrollBar) {
|
||||
m_ScrollBar->SetRange( 0,LINE_NUM-1 );
|
||||
m_ScrollBar->SetPageSize(m_iShowLine);
|
||||
m_ScrollBar->SetPosition( m_iTopLine );
|
||||
m_ScrollBar->Visible = true;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TCustmerSettingPanel::Paint(void)
|
||||
{
|
||||
int curX = 0;
|
||||
int curY = 0;
|
||||
int contentHeight = LINE_HEIGHT;
|
||||
int contentStart = -m_iTopLine*LINE_HEIGHT;
|
||||
TSize sizeFont;
|
||||
String strText;
|
||||
|
||||
Canvas->Font->Color = CLR_TXT_HOT;
|
||||
Canvas->Brush->Style = bsClear;
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
curX = LEFT_RIGHT;
|
||||
curY = contentStart;
|
||||
m_ckInitProject->Left = curX;
|
||||
m_ckInitProject->Top = curY + (contentHeight - m_ckInitProject->Height)/2 + 2;
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
contentStart += LINE_HEIGHT;
|
||||
curY = contentStart;
|
||||
|
||||
m_ckDownloadStyle->Left = curX;
|
||||
m_ckDownloadStyle->Top = curY + (contentHeight - m_ckDownloadStyle->Height)/2;
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
contentStart += LINE_HEIGHT;
|
||||
curY = contentStart;
|
||||
|
||||
m_ckPreBeat->Left = curX;
|
||||
m_ckPreBeat->Top = curY + (contentHeight - m_ckPreBeat->Height)/2;
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
contentStart += LINE_HEIGHT;
|
||||
curY = contentStart;
|
||||
|
||||
m_ckSegColor->Left = curX;
|
||||
m_ckSegColor->Top = curY + (contentHeight - m_ckSegColor->Height)/2;
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
contentStart += LINE_HEIGHT;
|
||||
curX = LEFT_RIGHT + 5;
|
||||
|
||||
strText = L"和弦显示方式:";
|
||||
sizeFont = Canvas->TextExtent(strText);
|
||||
curY = contentStart + (contentHeight - sizeFont.Height)/2;
|
||||
Canvas->TextOutW(curX, curY, strText);
|
||||
|
||||
curX += sizeFont.Width + 10;
|
||||
curY = contentStart;
|
||||
m_cbChordMode->Left = curX;
|
||||
m_cbChordMode->Top = curY + (contentHeight - m_cbChordMode->Height)/2;
|
||||
|
||||
strText = L" * 示例:";
|
||||
sizeFont = Canvas->TextExtent(strText);
|
||||
curX += m_cbChordMode->Width + 10;
|
||||
curY = contentStart + (contentHeight - sizeFont.Height)/2;
|
||||
Canvas->TextOutW(curX, curY, strText);
|
||||
|
||||
curX += sizeFont.Width;
|
||||
|
||||
TFont *fntOld = new TFont;
|
||||
fntOld->Assign( Canvas->Font );
|
||||
|
||||
Canvas->Font->Name = "Times New Roman";
|
||||
Canvas->Font->Quality = TFontQuality::fqClearTypeNatural;
|
||||
Canvas->Font->Color = CLR_TXT_HOT;
|
||||
Canvas->Font->Style = TFontStyles()<<fsItalic<<fsBold;
|
||||
Canvas->Font->Size = g_szFont16;
|
||||
|
||||
|
||||
strText = m_bAlphaKey ? L"A" : L"VI";
|
||||
sizeFont = Canvas->TextExtent(strText);
|
||||
curY = contentStart + (contentHeight - sizeFont.Height)/2;
|
||||
Canvas->TextOutW(curX, curY, strText);
|
||||
|
||||
curX += sizeFont.Width;
|
||||
curY += 7;
|
||||
strText = L"m";
|
||||
Canvas->Font->Size = g_szFont9;
|
||||
Canvas->TextOutW(curX, curY, strText);
|
||||
|
||||
Canvas->Font->Assign( fntOld );
|
||||
delete fntOld;
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
contentStart += LINE_HEIGHT;
|
||||
curX = LEFT_RIGHT + 5;
|
||||
|
||||
strText = L"预设段落结构:";
|
||||
sizeFont = Canvas->TextExtent(strText);
|
||||
curY = contentStart + (contentHeight - sizeFont.Height)/2;
|
||||
Canvas->TextOutW(curX, curY, strText);
|
||||
|
||||
curX += sizeFont.Width + 10;
|
||||
curY = contentStart;
|
||||
m_cbPreStage->Left = curX;
|
||||
m_cbPreStage->Top = curY + (contentHeight - m_cbPreStage->Height)/2;
|
||||
|
||||
strText = L" * I-前奏、M-旋律、E-尾奏";
|
||||
sizeFont = Canvas->TextExtent(strText);
|
||||
curX += m_cbPreStage->Width + 10;
|
||||
curY = contentStart + (contentHeight - sizeFont.Height)/2;
|
||||
Canvas->TextOutW(curX, curY, strText);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TCustmerSettingPanel::CKBoxChange(TObject* Sender)
|
||||
{
|
||||
TCKBox *tmpCK = (TCKBox *)Sender;
|
||||
|
||||
if( tmpCK == m_ckInitProject )
|
||||
m_bAutoOpenProject = tmpCK->Checked;
|
||||
else if( tmpCK == m_ckDownloadStyle )
|
||||
m_bDownloadStyle = m_ckDownloadStyle->Checked;
|
||||
else if( tmpCK == m_ckPreBeat )
|
||||
m_bPreBeat = m_ckPreBeat->Checked;
|
||||
else if( tmpCK == m_ckSegColor ){
|
||||
m_bSegColor = m_ckSegColor->Checked;
|
||||
Application->MainForm->Perform( UM_PREFERCHANGED, 0, m_bSegColor ? 1 : 0 );
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TCustmerSettingPanel::ChordModeChange(TComboBoxItem* Sender, int Index)
|
||||
{
|
||||
m_bAlphaKey = Index!=0;
|
||||
this->Invalidate();
|
||||
|
||||
Application->MainForm->Perform( UM_PREFERCHANGED, 1, m_bAlphaKey );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TCustmerSettingPanel::PreStageChange(TComboBoxItem* Sender, int Index)
|
||||
{
|
||||
m_cPreStage = Index;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef CustomerSettingPanelUnitH
|
||||
#define CustomerSettingPanelUnitH
|
||||
#include "SkinScrollBarUnit.h"
|
||||
#include "CKBox.h"
|
||||
#include "ComboBoxComponent.h"
|
||||
//#include "GlobalUnit.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#define LINE_NUM (5)
|
||||
#define LINE_HEIGHT (40)
|
||||
#define PANEL_START (26)
|
||||
#define PANEL_LEFT (10)
|
||||
#define PANEL_RIGHT (PANEL_LEFT)
|
||||
#define PANEL_HEIGHT (260)
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
class TCustmerSettingPanel : public Vcl::Extctrls::TPanel
|
||||
{
|
||||
|
||||
private:
|
||||
|
||||
int m_iShowLine;
|
||||
int m_iTopLine;
|
||||
|
||||
TSkinScrollBar *m_ScrollBar;
|
||||
|
||||
TCKBox *m_ckInitProject;
|
||||
TCKBox *m_ckDownloadStyle;
|
||||
TCKBox *m_ckPreBeat;
|
||||
TCKBox *m_ckSegColor;
|
||||
|
||||
TComboBoxComponent *m_cbChordMode;
|
||||
TComboBoxComponent *m_cbPreStage;
|
||||
|
||||
void __fastcall CKBoxChange(TObject* Sender);
|
||||
void __fastcall ChordModeChange(TComboBoxItem* Sender, int Index);
|
||||
void __fastcall PreStageChange(TComboBoxItem* Sender, int Index);
|
||||
void __fastcall SetShowLine();
|
||||
|
||||
virtual void __fastcall CreateWnd();
|
||||
virtual void __fastcall Paint(void);
|
||||
|
||||
MESSAGE void __fastcall WMEraseBkgnd(TWMEraseBkgnd &Message);
|
||||
MESSAGE void __fastcall WMVScroll(Winapi::Messages::TWMScroll &Message);
|
||||
MESSAGE void __fastcall WMMouseWheel(TWMMouseWheel &Message);
|
||||
|
||||
BEGIN_MESSAGE_MAP
|
||||
MESSAGE_HANDLER(WM_ERASEBKGND, TWMEraseBkgnd, WMEraseBkgnd)
|
||||
MESSAGE_HANDLER(WM_VSCROLL, TWMVScroll, WMVScroll)
|
||||
MESSAGE_HANDLER(WM_MOUSEWHEEL, TWMMouseWheel, WMMouseWheel)
|
||||
END_MESSAGE_MAP( Vcl::Extctrls::TPanel )
|
||||
|
||||
public:
|
||||
bool m_bAutoOpenProject;
|
||||
bool m_bDownloadStyle;
|
||||
bool m_bPreBeat;
|
||||
bool m_bAlphaKey;
|
||||
bool m_bSegColor;
|
||||
char m_cPreStage;
|
||||
|
||||
void __fastcall SetContent();
|
||||
|
||||
__fastcall TCustmerSettingPanel( TComponent* Owner);
|
||||
__fastcall ~TCustmerSettingPanel();
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
@@ -0,0 +1,279 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "FavorTextureUnit.h"
|
||||
#include "GlobalUnit.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#define TCF_VERSION 0x01
|
||||
|
||||
typedef struct tTextureCollectionFileHeader{
|
||||
char head[4];
|
||||
UINT idNum;
|
||||
|
||||
tTextureCollectionFileHeader(){
|
||||
head[0] = 'T';
|
||||
head[1] = 'X';
|
||||
head[2] = 'T';
|
||||
head[3] = TCF_VERSION;
|
||||
|
||||
idNum = 0;
|
||||
}
|
||||
} TTCFHEADER; //织体收藏文件头
|
||||
|
||||
typedef struct tagFavorTexture
|
||||
{
|
||||
UINT idLoc;
|
||||
UINT idStyle;
|
||||
char segType; //片段类型
|
||||
char segNo; //片段号
|
||||
char chan; //通道号
|
||||
char iTS; //拍号
|
||||
|
||||
tagFavorTexture()
|
||||
{
|
||||
idLoc = 0;
|
||||
idStyle = 0;
|
||||
segType = segNo = chan = -1;
|
||||
};
|
||||
|
||||
tagFavorTexture( UINT loc, UINT sty, char st, char sn, char cn, char ts )
|
||||
{
|
||||
idLoc = loc;
|
||||
idStyle = sty;
|
||||
segType = st;
|
||||
segNo = sn;
|
||||
chan = cn;
|
||||
iTS = ts;
|
||||
};
|
||||
} TFavorTexture; //织体收藏项
|
||||
|
||||
typedef vector<TFavorTexture*> FAVORTXTRLIST;
|
||||
|
||||
FAVORTXTRLIST u_lstFavorTextures,
|
||||
u_lstFTSItems;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
void WriteFTSItems()
|
||||
{
|
||||
AnsiString strPath = g_strUserPath.c_str();
|
||||
strPath += L"\\profile\\dt_eerp\\colIns.daj";
|
||||
|
||||
//读取收藏列表
|
||||
FILE* fp = fopen( strPath.c_str(), "wb" );
|
||||
|
||||
if( fp ){
|
||||
TTCFHEADER header;
|
||||
header.idNum = u_lstFTSItems.size();
|
||||
|
||||
fseek( fp, 0, SEEK_SET );
|
||||
fwrite( (void*)&header, sizeof(header), 1, fp );
|
||||
|
||||
for( int i=0; i<u_lstFTSItems.size(); i++ ){
|
||||
fwrite( u_lstFTSItems[i], sizeof(TFavorTexture), 1, fp );
|
||||
}
|
||||
|
||||
fclose( fp );
|
||||
}
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void ReadFTSItems()
|
||||
{
|
||||
AnsiString strPath = g_strUserPath.c_str();
|
||||
strPath += L"\\profile\\dt_eerp\\colIns.daj";
|
||||
|
||||
//读取收藏列表
|
||||
FILE* fp = fopen( strPath.c_str(), "rb" );
|
||||
if( fp ){
|
||||
TTCFHEADER head;
|
||||
char buf[128];
|
||||
bool bChanged = false;
|
||||
|
||||
int ret = fread( (void*)buf, 1, sizeof(head), fp );
|
||||
if( ret==sizeof(head) && !strncmp( buf, (char*)&head.head, sizeof(head.head))){
|
||||
int num = ((TTCFHEADER*)buf)->idNum;
|
||||
|
||||
for( int i=0; i<num; i++ ){
|
||||
TFavorTexture* pItem = new TFavorTexture;
|
||||
fread( pItem, sizeof(TFavorTexture), 1, fp );
|
||||
|
||||
TPROSTYLE* pStyle = GetStyleInfo( pItem->idLoc, pItem->idStyle );
|
||||
if( !pStyle ){
|
||||
delete pItem;
|
||||
bChanged = true;
|
||||
}
|
||||
else{
|
||||
u_lstFTSItems.push_back( pItem );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fclose( fp );
|
||||
|
||||
if( bChanged )
|
||||
WriteFTSItems();
|
||||
}
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int FindListItem( UINT idLoc, UINT idStyle, char sType, char sNo, char cno, bool bAll )
|
||||
{
|
||||
TFavorTexture *pTemp = NULL;
|
||||
FAVORTXTRLIST& lstItems = bAll ? u_lstFTSItems : u_lstFavorTextures;
|
||||
int middle, front = 0,
|
||||
rear = lstItems.size() - 1;
|
||||
|
||||
while( front<=rear ){
|
||||
pTemp = lstItems[front];
|
||||
if( pTemp->idLoc==idLoc && pTemp->idStyle==idStyle && pTemp->segType==sType
|
||||
&& pTemp->segNo==sNo && pTemp->chan==cno )
|
||||
return front;
|
||||
|
||||
pTemp = lstItems[rear];
|
||||
if( pTemp->idLoc==idLoc && pTemp->idStyle==idStyle && pTemp->segType==sType
|
||||
&& pTemp->segNo==sNo && pTemp->chan==cno )
|
||||
return rear;
|
||||
|
||||
middle = (front+rear)/2;
|
||||
|
||||
pTemp = lstItems[middle];
|
||||
if( pTemp->idLoc==idLoc && pTemp->idStyle==idStyle && pTemp->segType==sType
|
||||
&& pTemp->segNo==sNo && pTemp->chan==cno )
|
||||
return middle;
|
||||
else if( pTemp->idLoc>idLoc || pTemp->idLoc==idLoc && pTemp->idStyle>idStyle
|
||||
|| pTemp->idLoc==idLoc && pTemp->idStyle==idStyle
|
||||
&& pTemp->segType>sType
|
||||
|| pTemp->idLoc==idLoc && pTemp->idStyle==idStyle
|
||||
&& pTemp->segType==sType
|
||||
&& pTemp->segNo>sNo
|
||||
|| pTemp->idLoc==idLoc && pTemp->idStyle==idStyle
|
||||
&& pTemp->segType==sType
|
||||
&& pTemp->segNo==sNo
|
||||
&& pTemp->chan>cno )
|
||||
front=middle+1;
|
||||
else
|
||||
rear=middle-1;
|
||||
}
|
||||
|
||||
if( front>rear ){
|
||||
return front;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void ClearFavorTextures( bool bAll )
|
||||
{
|
||||
u_lstFavorTextures.clear();
|
||||
|
||||
if( bAll ){
|
||||
for( int i=0; i<u_lstFTSItems.size(); i++ ){
|
||||
delete u_lstFTSItems[i];
|
||||
}
|
||||
|
||||
u_lstFTSItems.clear();
|
||||
}
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void GetFavorTextures()
|
||||
{
|
||||
ClearFavorTextures();
|
||||
|
||||
if( u_lstFTSItems.empty() ){
|
||||
ReadFTSItems();
|
||||
}
|
||||
|
||||
for( int i=0; i<u_lstFTSItems.size(); i++ ){
|
||||
if( u_lstFTSItems[i]->iTS==g_iMelodyTimeSignature ){
|
||||
u_lstFavorTextures.push_back( u_lstFTSItems[i] );
|
||||
}
|
||||
}
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool IsFavorTexture( UINT idLoc, UINT idStyle, char sType, char sNo, char cno )
|
||||
{
|
||||
int ind = FindListItem( idLoc, idStyle, sType, sNo, cno );
|
||||
if( ind>=0 && ind<u_lstFavorTextures.size() ){
|
||||
TFavorTexture *pTemp = u_lstFavorTextures[ind];
|
||||
|
||||
if( pTemp->idLoc==idLoc && pTemp->idStyle==idStyle && pTemp->segType==sType
|
||||
&& pTemp->segNo==sNo && pTemp->chan==cno )
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void AddFavorTextures( UINT idLoc, UINT idStyle, char sType, char sNo, char cno )
|
||||
{
|
||||
int ind = FindListItem( idLoc, idStyle, sType, sNo, cno );
|
||||
TFavorTexture * pItem = NULL;
|
||||
|
||||
if( u_lstFavorTextures.empty() || ind<0 || ind>=u_lstFavorTextures.size() ){
|
||||
pItem = new TFavorTexture( idLoc, idStyle, sType, sNo, cno, g_iMelodyTimeSignature );
|
||||
u_lstFavorTextures.push_back( pItem );
|
||||
}
|
||||
else{
|
||||
TFavorTexture * pTemp = u_lstFavorTextures[ind];
|
||||
|
||||
if( pTemp->idLoc==idLoc && pTemp->idStyle==idStyle && pTemp->segType==sType
|
||||
&& pTemp->segNo==sNo && pTemp->chan==cno )
|
||||
return; //已收藏
|
||||
else{
|
||||
pItem = new TFavorTexture( idLoc, idStyle, sType, sNo, cno, g_iMelodyTimeSignature );
|
||||
u_lstFavorTextures.insert( u_lstFavorTextures.begin()+ind, pItem);
|
||||
}
|
||||
}
|
||||
|
||||
if( pItem ){
|
||||
ind = FindListItem( idLoc, idStyle, sType, sNo, cno, true );
|
||||
u_lstFTSItems.insert( u_lstFTSItems.begin()+ind, pItem );
|
||||
|
||||
WriteFTSItems();
|
||||
}
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void DelFavorTextures( UINT idLoc, UINT idStyle, char sType, char sNo, char cno )
|
||||
{
|
||||
if( !u_lstFavorTextures.empty() ){
|
||||
int ind = FindListItem( idLoc, idStyle, sType, sNo, cno );
|
||||
|
||||
if( ind>=0 && ind<u_lstFavorTextures.size() ){
|
||||
TFavorTexture *pTemp = u_lstFavorTextures[ind];
|
||||
|
||||
if( pTemp->idLoc==idLoc && pTemp->idStyle==idStyle && pTemp->segType==sType
|
||||
&& pTemp->segNo==sNo && pTemp->chan==cno ){
|
||||
u_lstFavorTextures.erase( u_lstFavorTextures.begin()+ind );
|
||||
|
||||
ind = FindListItem( idLoc, idStyle, sType, sNo, cno, true );
|
||||
|
||||
delete u_lstFTSItems[ind];
|
||||
u_lstFTSItems.erase( u_lstFTSItems.begin()+ind );
|
||||
|
||||
WriteFTSItems();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void SetFavorTexture( UINT idLoc, UINT idStyle, char sType, char sNo, char cno, bool bSet )
|
||||
{
|
||||
if( bSet ){
|
||||
AddFavorTextures( idLoc, idStyle, sType, sNo, cno );
|
||||
}
|
||||
else{
|
||||
DelFavorTextures( idLoc, idStyle, sType, sNo, cno );
|
||||
}
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef FavorTextureUnitH
|
||||
#define FavorTextureUnitH
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
int FindListItem( UINT idLoc, UINT idStyle, char sType, char sNo, char cno, bool bAll=false );
|
||||
void ClearFavorTextures( bool bAll=false );
|
||||
void GetFavorTextures();
|
||||
void AddFavorTextures( UINT idLoc, UINT idStyle, char sType, char sNo, char cno );
|
||||
void DelFavorTextures( UINT idLoc, UINT idStyle, char sType, char sNo, char cno );
|
||||
bool IsFavorTexture( UINT idLoc, UINT idStyle, char sType, char sNo, char cno );
|
||||
void SetFavorTexture( UINT idLoc, UINT idStyle, char sType, char sNo, char cno, bool bSet=true );
|
||||
|
||||
#endif
|
||||
+1311
File diff suppressed because it is too large
Load Diff
+105
@@ -0,0 +1,105 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#ifndef FxDefH
|
||||
#define FxDefH
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#define MAX_FX_NUM 10
|
||||
#define FX_ECHO 0x00
|
||||
#define FX_DISTORTION 0x01
|
||||
#define FX_ROTATE 0x02
|
||||
#define FX_REVERB 0x03
|
||||
#define FX_COMPRESSOR 0x04
|
||||
#define FX_WAH 0x05
|
||||
#define FX_CHORUS 0x06
|
||||
#define FX_PARAMEQ 0x07
|
||||
#define FX_PHASER 0x08
|
||||
#define FX_PITCH 0x100
|
||||
//#define FX_APR 0x101
|
||||
//#define FX_VOLUME 0x102
|
||||
#define FX_VST 0x10000
|
||||
|
||||
/***************************************************************************************/
|
||||
// 全局结构定义
|
||||
/***************************************************************************************/
|
||||
#include <memory>
|
||||
typedef struct tagAudioFx
|
||||
{
|
||||
int iFx;
|
||||
int iPreset;//iPlugins
|
||||
WORD bBypass;
|
||||
WORD nParamSize;
|
||||
void* pParam;
|
||||
|
||||
tagAudioFx( int iF, int iP, void* pP, int nSize, bool bB=false ){
|
||||
iFx = iF;
|
||||
iPreset = iP;
|
||||
nParamSize = nSize;
|
||||
pParam = pP;
|
||||
bBypass = bB;
|
||||
}
|
||||
|
||||
tagAudioFx( tagAudioFx* pSrc ){
|
||||
memcpy( this, pSrc, sizeof(tagAudioFx) );
|
||||
|
||||
if( pSrc->nParamSize ){
|
||||
pParam = new float[pSrc->nParamSize];
|
||||
memcpy( pParam, pSrc->pParam, sizeof(float)*nParamSize );
|
||||
}
|
||||
}
|
||||
|
||||
~tagAudioFx(){
|
||||
if( pParam )
|
||||
delete[] pParam;
|
||||
}
|
||||
|
||||
} TAudioFx;
|
||||
|
||||
/***************************************************************************************/
|
||||
// 全局常量
|
||||
/***************************************************************************************/
|
||||
extern const char *g_strEffect[MAX_FX_NUM],
|
||||
*g_strEffectPreset[MAX_FX_NUM][3],
|
||||
*g_strEffectParamName[MAX_FX_NUM][6];
|
||||
extern const DWORD g_aAudioEffectTypes[MAX_FX_NUM]; //音效类型
|
||||
extern const float g_aEffectParamLimit[MAX_FX_NUM][6][2];//音效参数映射
|
||||
/***************************************************************************************/
|
||||
// 全局变量
|
||||
/***************************************************************************************/
|
||||
//extern PTEffect g_aAudioEffects[MAX_FX_NUM], //启用的音效
|
||||
// g_aAudioEffects_SVD[MAX_FX_NUM];//保存工程比较
|
||||
|
||||
/***************************************************************************************/
|
||||
// 全局函数
|
||||
/***************************************************************************************/
|
||||
int GetFxPresetCount( int iFxType );
|
||||
void GetFxPreset( int iFxType, int iPreset, float fParams[] );
|
||||
int GetFxParamNum( int iFxType );
|
||||
float Pos2Param( int iFx, int iParam, int Pos );
|
||||
int Param2Pos( int iFx, int iParam, float fParam );
|
||||
|
||||
HRESULT AudioApplyEffect( int iWave, int ind, TAudioFx* pFx );
|
||||
void AudioEffectsClear( int iWave, bool bApply=true );
|
||||
void AudioEffectsDefault( int iWave, bool bApply=true );
|
||||
void AudioEffectsSet( int iWave );
|
||||
|
||||
/*
|
||||
void SetAudioEffects( bool bOn=true );
|
||||
void ResetAudioEffects( int nLastBarNum=0 );
|
||||
void SortAudioEffects( int iFx=-1 );
|
||||
void ClearAudioEffects( TEffect** aEffects );
|
||||
void MoveAudioEffects( int iStartBar, int iEndBar, int iInsertBar, int iMode );
|
||||
|
||||
void AudioEffectsDefault( int iWave, bool bApply=true );
|
||||
void AudioEffectsClear( int iWave, bool bApply=true );
|
||||
bool AudioEffectsSort( int iWave, int iFx=-1 );
|
||||
void AudioEffectsSet( int iWave, bool bOn=true );
|
||||
bool AudioEffectsMove( int iSrc, double dblStart, double dblEnd, int iDest, double dblInsert, int iMode );
|
||||
|
||||
void ClearAudioEffects( TEffect* lstDest[] );
|
||||
void CopyAudioEffects( TEffect* lstDest[], TEffect* lstSrc[], double dblStart, double dblEnd );
|
||||
void InsertAudioEffetcts( TEffect* lstDest[], TEffect* lstSrc[], double dblInsert, double dblLen );
|
||||
void SortAudioEffects( TEffect** lstEffect );
|
||||
void RemoveAudioEffects( TEffect* lstEffects[], double dblStart, double dblEnd );
|
||||
TEffect* DuplicateEffects( TEffect* lstSrc );
|
||||
*/
|
||||
#endif
|
||||
@@ -0,0 +1,54 @@
|
||||
//---------------------------------------------------------------------------
|
||||
/////////////////////////////////
|
||||
////////安装 记得在生成编译包的工程和使用工程中加图片 Res\System\close.png -->L"PngImage_Close"
|
||||
/////////////////////////////////
|
||||
|
||||
#ifndef GeneralDialogPanelH
|
||||
#define GeneralDialogPanelH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <SysUtils.hpp>
|
||||
#include <Classes.hpp>
|
||||
#include <Vcl.Controls.hpp>
|
||||
#include <Vcl.ExtCtrls.hpp>
|
||||
#include <Vcl.Imaging.pngimage.hpp>
|
||||
#include <Vcl.Imaging.jpeg.hpp>
|
||||
#include <Vcl.Graphics.hpp>
|
||||
//---------------------------------------------------------------------------
|
||||
class CBTPNButton;
|
||||
#define LEN_BKG_EXTERNAL_ROUND 1
|
||||
#define LEN_BKG_EXTERNAL_FRMAE 1
|
||||
#define LEN_BKG_INTERNAL_LINE 23
|
||||
//---------------------------------------------------------------------------
|
||||
class PACKAGE TGeneralDialogPanel : public TPanel
|
||||
{
|
||||
private:
|
||||
TNotifyEvent FOnCanceled; // 关闭窗口事件
|
||||
|
||||
TPngImage *m_imgClose;
|
||||
CBTPNButton *m_btnClose;
|
||||
|
||||
void __fastcall CloseClick(TObject *Sender);
|
||||
|
||||
MESSAGE void __fastcall WMEraseBkgnd(Winapi::Messages::TWMEraseBkgnd &Message);
|
||||
MESSAGE void __fastcall WMSize(Winapi::Messages::TWMSize &Message);
|
||||
BEGIN_MESSAGE_MAP
|
||||
MESSAGE_HANDLER(WM_ERASEBKGND, TWMEraseBkgnd, WMEraseBkgnd)
|
||||
MESSAGE_HANDLER(WM_SIZE, TWMSize, WMSize)
|
||||
END_MESSAGE_MAP(Vcl::Extctrls::TPanel)
|
||||
|
||||
protected:
|
||||
|
||||
virtual void __fastcall Paint(void);
|
||||
virtual void __fastcall CreateWnd();
|
||||
DYNAMIC void __fastcall MouseDown(System::Uitypes::TMouseButton Button,
|
||||
System::Classes::TShiftState Shift, int X, int Y);
|
||||
public:
|
||||
__fastcall TGeneralDialogPanel(TComponent* Owner);
|
||||
__fastcall ~TGeneralDialogPanel();
|
||||
|
||||
__published:
|
||||
__property TNotifyEvent OnCanceled = {write = FOnCanceled, read = FOnCanceled};
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
|
||||
+2822
File diff suppressed because it is too large
Load Diff
+1630
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,483 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "HelpFormUnit.h"
|
||||
#include "GlobalUnit.h"
|
||||
#include "MessageDef.h"
|
||||
#include "MessageFormUnit.h"
|
||||
#include "ProgressFormUnit.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
#pragma link "GeneralDialogPanel"
|
||||
#pragma link "PNGButton"
|
||||
#pragma link "CapButton"
|
||||
#pragma resource "*.dfm"
|
||||
THelpForm *HelpForm;
|
||||
//---------------------------------------------------------------------------
|
||||
#define WINDOW_MAX 0
|
||||
#define WINDOW_NORMAL 1
|
||||
#define WINDOW_MIN 2
|
||||
#define WNDOW_CLOSE 3
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TTabButton::TTabButton(System::Classes::TComponent* AOwner)
|
||||
: TPNGButton( AOwner )
|
||||
{
|
||||
Caption = "";
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
__fastcall TTabButton::~TTabButton(void)
|
||||
{
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TTabButton::SetFontSize(int sz)
|
||||
{
|
||||
Canvas->Font->Size = sz;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TTabButton::Paint(void)
|
||||
{
|
||||
TPNGButton::Paint();
|
||||
|
||||
Canvas->Brush->Style = bsClear;
|
||||
Canvas->Font->Color = RGB( 184,188,189 );
|
||||
Canvas->Font->Name = g_strTxtFontName;
|
||||
Canvas->Font->Quality = TFontQuality::fqClearTypeNatural;
|
||||
// if( !strcmp( g_strTxtFontName, "微软雅黑" ) ){
|
||||
// Canvas->Font->Size = 10;
|
||||
// }
|
||||
// else{
|
||||
// Canvas->Font->Size = 9;
|
||||
// }
|
||||
|
||||
int nLength = Canvas->TextWidth( Caption );
|
||||
int nHeight = Canvas->TextHeight( Caption );
|
||||
Canvas->TextOutW( Width/2 - nLength/2 - 5,Height/2 - nHeight/2,Caption );
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
__fastcall THelpForm::THelpForm(TComponent* Owner)
|
||||
: TForm(Owner)
|
||||
{
|
||||
Window_state = WINDOW_NORMAL;
|
||||
m_nUserNoticeNum = 0;
|
||||
m_PngImage = new TPngImage();
|
||||
m_PngImage->LoadFromResourceName(int(HInstance), L"HelpPNG");
|
||||
m_PanelShow = NULL;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
void __fastcall THelpForm::FormClose(TObject *Sender, TCloseAction &Action)
|
||||
{
|
||||
PostMessage( Application->MainForm->Handle, UM_SHOWHELP, false, 0 );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
void __fastcall THelpForm::RestClick(TObject *Sender)
|
||||
{
|
||||
|
||||
SetSize( HLP_WINDOW_NORMAL );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall THelpForm::MinClick(TObject *Sender)
|
||||
{
|
||||
SetSize( HLP_WINDOW_MIN );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall THelpForm::MaxClick(TObject *Sender)
|
||||
{
|
||||
SetSize( HLP_WINDOW_MAX );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall THelpForm::SetSize( int iState )
|
||||
{
|
||||
Window_state = iState;
|
||||
|
||||
switch( iState )
|
||||
{
|
||||
case HLP_WINDOW_MAX:
|
||||
SetBounds( Application->MainForm->Left, Application->MainForm->Top + 44,
|
||||
Application->MainForm->Width, Application->MainForm->Height - 44 );
|
||||
break;
|
||||
|
||||
case HLP_WINDOW_MIN:
|
||||
SetBounds( Application->MainForm->Left + Application->MainForm->Width - 160,
|
||||
Application->MainForm->Top + Application->MainForm->Height - 34,
|
||||
150, 24 );
|
||||
break;
|
||||
|
||||
case HLP_WINDOW_NORMAL:
|
||||
SetBounds( Application->MainForm->Left + Application->MainForm->Width/2 - 389,
|
||||
Application->MainForm->Top + Application->MainForm->Height/2 - 220,
|
||||
778, 440 );
|
||||
break;
|
||||
}
|
||||
|
||||
m_btnMax->Visible = iState==HLP_WINDOW_NORMAL;
|
||||
m_btnMin->Visible = iState!= HLP_WINDOW_MIN;
|
||||
m_btnRest->Visible = iState!=HLP_WINDOW_NORMAL;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall THelpForm::FormResize(TObject *Sender)
|
||||
{
|
||||
switch( Window_state ){
|
||||
case HLP_WINDOW_MIN:
|
||||
m_lblGroupLabel->Top = 50;
|
||||
m_lblGroup->Top = 50;
|
||||
m_lblVideoLabel->Top = 50;
|
||||
m_lblVideo->Top = 50;
|
||||
m_lblUrlLabel->Top = 50;
|
||||
m_lblUrl->Top = 50;
|
||||
break;
|
||||
|
||||
case HLP_WINDOW_MAX:
|
||||
case HLP_WINDOW_NORMAL:
|
||||
m_PanelShow->SetBounds( 40, 67, Width - 80, Height - 120 );
|
||||
m_memMsg->SetBounds( 15, 15, m_PanelShow->Width - 45, 130 );
|
||||
|
||||
m_btnSubmit->Top = m_memMsg->Top + m_memMsg->Height + 5;
|
||||
m_btnSubmit->Left = m_memMsg->Left + m_memMsg->Width - m_btnSubmit->Width;
|
||||
|
||||
m_lblGroupLabel->Top = Height - 35;
|
||||
m_lblGroup->Top = m_lblGroupLabel->Top;
|
||||
m_lblVideoLabel->Top = m_lblGroupLabel->Top;
|
||||
m_lblVideo->Top = m_lblGroupLabel->Top;
|
||||
m_lblUrlLabel->Top = m_lblGroupLabel->Top;
|
||||
m_lblUrl->Top = m_lblGroupLabel->Top;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall THelpForm::FormCreate(TObject *Sender)
|
||||
{
|
||||
m_GenerPanel->Font->Size = g_szFont9;
|
||||
|
||||
for( int i=0;i<TAB_NUM;i++ ){
|
||||
m_arrTabs[i] = new TTabButton(this);
|
||||
m_arrTabs[i]->Parent = m_GenerPanel;
|
||||
m_arrTabs[i]->ImgStates = 4;
|
||||
m_arrTabs[i]->PngImg = m_PngImage;//LoadFromResourceName( int(HInstance), L"HelpPNG" );
|
||||
m_arrTabs[i]->Top = 40;
|
||||
m_arrTabs[i]->SetFontSize(g_szFont10);
|
||||
m_arrTabs[i]->OnClick = TabClick;
|
||||
m_arrTabs[i]->Tag = i;
|
||||
|
||||
if(i==2){
|
||||
m_arrTabs[i]->Left = 78;
|
||||
m_arrTabs[i]->Visible = false;
|
||||
}
|
||||
else if(i>2)
|
||||
m_arrTabs[i]->Left = 78 + 70*(i-1);
|
||||
else
|
||||
m_arrTabs[i]->Left = 78 + 70*i;
|
||||
|
||||
|
||||
|
||||
// if( i<=TAB_SW )
|
||||
// m_arrTabs[i]->OnClick = TabClick;
|
||||
// else if( i==TAB_MN )
|
||||
// m_arrTabs[i]->OnClick = HelpClick;
|
||||
// else if ( i==TAB_AB )
|
||||
// m_arrTabs[i]->OnClick = AboutClick;
|
||||
|
||||
m_arrTabs[i]->SendToBack();
|
||||
}
|
||||
|
||||
m_arrTabs[TAB_QA]->Caption = "常见问题";
|
||||
m_arrTabs[TAB_FB]->Caption = "我要提问";
|
||||
m_arrTabs[TAB_NT]->Caption = "网站消息";
|
||||
m_arrTabs[TAB_CN]->Caption = "唱作音符";
|
||||
m_arrTabs[TAB_SW]->Caption = "更多软件";
|
||||
m_arrTabs[TAB_MN]->Caption = "用户手册";
|
||||
m_arrTabs[TAB_AB]->Caption = "关于";
|
||||
m_arrTabs[TAB_QA]->Down = true;
|
||||
|
||||
m_PanelShow = new THelpPanel(this);
|
||||
m_PanelShow->Parent = this;
|
||||
m_PanelShow->Left = 40;
|
||||
m_PanelShow->Top = 67;
|
||||
m_PanelShow->Width = 697;
|
||||
m_PanelShow->Height = 320;
|
||||
m_PanelShow->OnClick = panelShowClick;
|
||||
m_PanelShow->Visible = true;
|
||||
m_PanelShow->SetTextFontSize(m_memMsg->Font->Size);
|
||||
|
||||
m_memMsg->Parent = m_PanelShow;
|
||||
m_memMsg->Left = 15;
|
||||
m_memMsg->Top = 15;
|
||||
m_memMsg->Width = m_PanelShow->Width - 45;
|
||||
m_memMsg->Height = 130;
|
||||
m_memMsg->Enabled = !g_bUpdateMandatory;
|
||||
|
||||
m_btnSubmit->Parent = m_PanelShow;
|
||||
m_btnSubmit->Left = m_memMsg->Left + m_memMsg->Width - m_btnSubmit->Width;
|
||||
m_btnSubmit->Top = m_memMsg->Top + m_memMsg->Height + 5;
|
||||
m_btnSubmit->FontSize = m_memMsg->Font->Size;
|
||||
|
||||
m_lblMsgHead->Parent = m_PanelShow;
|
||||
m_lblMsgHead->Left = m_PanelShow->Left + 15;
|
||||
m_lblMsgHead->Top = 15;
|
||||
|
||||
m_lblMsgNum->Parent = m_PanelShow;
|
||||
m_lblMsgNum->Left = m_lblMsgHead->Left + m_lblMsgHead->Width+1;
|
||||
m_lblMsgNum->Top = 15;
|
||||
|
||||
m_lblMsgMiddle->Parent = m_PanelShow;
|
||||
m_lblMsgMiddle->Left = m_lblMsgNum->Left + m_lblMsgNum->Width+1;
|
||||
m_lblMsgMiddle->Top = 15;
|
||||
|
||||
m_lblMsgURL->Parent = m_PanelShow;
|
||||
m_lblMsgURL->Left = m_lblMsgMiddle->Left + m_lblMsgMiddle->Width+1;
|
||||
m_lblMsgURL->Top = 15;
|
||||
|
||||
m_lblMsgTail->Parent = m_PanelShow;
|
||||
m_lblMsgTail->Left = m_lblMsgURL->Left + m_lblMsgURL->Width+1;
|
||||
m_lblMsgTail->Top = 15;
|
||||
|
||||
m_pImgNoticeTip = new TPngImage();
|
||||
m_pImgNoticeTip->LoadFromResourceName(int(HInstance), "NoticeBK");
|
||||
|
||||
m_PanelShow->SetMode(0);
|
||||
|
||||
SetTransparent( this );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall THelpForm::FormActivate(TObject *Sender)
|
||||
{
|
||||
// m_lblUrl->Caption = g_strServerURL;
|
||||
|
||||
// m_pbUserNoticeNum->Visible = (m_nUserNoticeNum>0);
|
||||
|
||||
m_PanelShow->InitialVars();
|
||||
m_PanelShow->SetFocus();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall THelpForm::FormDeactivate(TObject *Sender)
|
||||
{
|
||||
// m_PanelShow->SaveFirstRow();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall THelpForm::panelShowClick(TObject *Sender)
|
||||
{
|
||||
m_PanelShow->SetFocus();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall THelpForm::SetNoticeNum( int num, int iType )
|
||||
{
|
||||
// if( iType==1 && m_nUserNoticeNum!=num ){
|
||||
// m_nUserNoticeNum = num;
|
||||
//
|
||||
// m_pbUserNoticeNum->Visible = (num>0);
|
||||
// if( num>0 ){
|
||||
// m_pbUserNoticeNum->Invalidate();
|
||||
// }
|
||||
//
|
||||
// if( m_arrTabs[TAB_NT]->Down ){
|
||||
// m_lblMsgNum->Caption = m_nUserNoticeNum;
|
||||
//
|
||||
// m_lblMsgHead->Visible = (num>0);
|
||||
// m_lblMsgMiddle->Visible = (num>0);
|
||||
// m_lblMsgNum->Visible = (num>0);
|
||||
// m_lblMsgURL->Visible = (num>0);
|
||||
// m_lblMsgTail->Visible = (num>0);
|
||||
//
|
||||
// m_PanelShow->InitialVars();
|
||||
// }
|
||||
// }
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
int __fastcall THelpForm::GetNoticeNum( int iType )
|
||||
{
|
||||
if( iType!=0 )
|
||||
return m_nUserNoticeNum;
|
||||
|
||||
return 0;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall THelpForm::SetPage( int iPage )
|
||||
{
|
||||
for( int i=0; i<TAB_NUM; i++ ){
|
||||
if( i==iPage ){
|
||||
m_arrTabs[i]->Down = true;
|
||||
m_arrTabs[i]->BringToFront();
|
||||
}
|
||||
else{
|
||||
if( m_arrTabs[i]->Down )
|
||||
m_arrTabs[i]->Down = false;
|
||||
m_arrTabs[i]->SendToBack();
|
||||
}
|
||||
}
|
||||
|
||||
// m_pbUserNoticeNum->BringToFront();
|
||||
|
||||
if( iPage==TAB_NT ){
|
||||
m_lblMsgNum->Caption = m_nUserNoticeNum;
|
||||
}
|
||||
else if( iPage==TAB_FB && ( m_memMsg->Text.IsEmpty()
|
||||
|| m_memMsg->Font->Color==clGray )){
|
||||
m_bMemoHint = true;
|
||||
m_memMsg->Text = "请在此处输入您的问题";
|
||||
m_memMsg->Font->Color = clGray;
|
||||
}
|
||||
|
||||
m_lblMsgHead->Visible = (iPage==TAB_NT && m_nUserNoticeNum>0);
|
||||
m_lblMsgMiddle->Visible = (iPage==TAB_NT && m_nUserNoticeNum>0);
|
||||
m_lblMsgNum->Visible = (iPage==TAB_NT && m_nUserNoticeNum>0);
|
||||
m_lblMsgURL->Visible = (iPage==TAB_NT && m_nUserNoticeNum>0);
|
||||
m_lblMsgTail->Visible = (iPage==TAB_NT && m_nUserNoticeNum>0);
|
||||
|
||||
m_btnSubmit->Visible = (iPage==TAB_FB);
|
||||
m_memMsg->Visible = (iPage==TAB_FB);
|
||||
|
||||
m_PanelShow->SetMode( iPage );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall THelpForm::NoticeNumPaint(TObject *Sender)
|
||||
{
|
||||
TPaintBox* pPB = (TPaintBox*)Sender;
|
||||
String strText = IntToStr( m_nUserNoticeNum );
|
||||
|
||||
pPB->Canvas->Draw(0, 0, m_pImgNoticeTip);
|
||||
pPB->Canvas->Brush->Style = bsClear;
|
||||
pPB->Canvas->Font->Color = clWhite;
|
||||
|
||||
int txtWidth = pPB->Canvas->TextWidth( strText );
|
||||
int txtHeight = pPB->Canvas->TextHeight( strText );
|
||||
|
||||
pPB->Canvas->TextOut( (pPB->Width - txtWidth)/2.0+0.5,
|
||||
(pPB->Height -txtHeight)/2.0,
|
||||
strText );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall THelpForm::TabClick(TObject *Sender)
|
||||
{
|
||||
int mode = ((TTabButton*)Sender)->Tag;
|
||||
|
||||
if(mode==TAB_SW){
|
||||
PostMessage(Application->MainForm->Handle, UM_SHOWMORE, 0, 0);
|
||||
}
|
||||
else if(mode==TAB_MN){
|
||||
PostMessage(Application->MainForm->Handle, UM_OPENMANUAL, 0, 0);
|
||||
}
|
||||
else if(mode==TAB_AB){
|
||||
PostMessage(Application->MainForm->Handle, UM_SHOWABOUT, 0, 0);
|
||||
}
|
||||
else{
|
||||
SetPage( mode );
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall THelpForm::UrlClick(TObject *Sender)
|
||||
{
|
||||
if( Sender==m_lblUrl && m_lblUrl->Caption.Length()>0 ){
|
||||
ShellExecute(Handle,NULL, m_lblUrl->Caption.c_str(), NULL,NULL,SW_SHOWNORMAL);
|
||||
}
|
||||
else if( Sender==m_lblVideo ){
|
||||
ShellExecute(Handle,NULL, L"http://v.qq.com/boke/page/t/8/p/t01266qkg8p.html",
|
||||
NULL,NULL,SW_SHOWNORMAL);
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall THelpForm::SubmitClick(TObject *Sender)
|
||||
{
|
||||
TProgressForm *frmProgress = new TProgressForm(NULL);
|
||||
|
||||
int ret = frmProgress->User_SubmitQuestin( GBToUTF8(AnsiString(m_memMsg->Text.Trim().c_str()).c_str()).c_str() );
|
||||
int eExtra = frmProgress->GetOpertaionResult();
|
||||
delete frmProgress;
|
||||
|
||||
if( ret==mrOk && eExtra==0 ){
|
||||
m_PanelShow->AddFeedback( m_memMsg->Text.Trim().c_str() );
|
||||
m_memMsg->Text = "";
|
||||
}
|
||||
else if( eExtra!=0 && eExtra!=e_UserCanceled ){
|
||||
MessageForm->ShowMessage( "由于网络故障,信息提交失败。\n\n请稍后重试!",
|
||||
MB_ICONERROR|MB_OK );
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall THelpForm::MemoMsgChange(TObject *Sender)
|
||||
{
|
||||
//
|
||||
if( !m_bMemoHint && !m_memMsg->Text.Trim().IsEmpty() ){
|
||||
m_btnSubmit->Enabled = true;
|
||||
}
|
||||
else{
|
||||
m_btnSubmit->Enabled = false;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall THelpForm::MemoMsgClick(TObject *Sender)
|
||||
{
|
||||
//
|
||||
if( m_bMemoHint ){
|
||||
m_memMsg->Text = "";
|
||||
m_memMsg->Font->Color = clBlack;
|
||||
m_bMemoHint = false;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall THelpForm::MsgURLClick(TObject *Sender)
|
||||
{
|
||||
char strURL[256];
|
||||
f_CS_GetWebPageURL( URL_USERNOTICE, strURL );
|
||||
ShellExecute(Handle, NULL, ((String)strURL).c_str(), NULL, NULL, SW_SHOWNORMAL);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall THelpForm::FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift)
|
||||
{
|
||||
switch( Key ){
|
||||
case VK_ESCAPE:
|
||||
{
|
||||
PostMessage( Application->MainForm->Handle, UM_SHOWHELP, false, 0 );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall THelpForm::WMNCLButtonDown(Winapi::Messages::TWMNCLButtonDown &Message)
|
||||
{
|
||||
if( Window_state==HLP_WINDOW_NORMAL )
|
||||
TForm::Dispatch( &Message );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
void __fastcall THelpForm::GenerPanelMouseEnter(TObject *Sender)
|
||||
{
|
||||
THelpForm::SetFocus();
|
||||
Screen->Cursor = crDefault;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -0,0 +1,673 @@
|
||||
object HelpForm: THelpForm
|
||||
Left = 0
|
||||
Top = 0
|
||||
BorderIcons = []
|
||||
BorderStyle = bsNone
|
||||
ClientHeight = 440
|
||||
ClientWidth = 777
|
||||
Color = 5064257
|
||||
DoubleBuffered = True
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
Position = poMainFormCenter
|
||||
Scaled = False
|
||||
Visible = True
|
||||
OnActivate = FormActivate
|
||||
OnClose = FormClose
|
||||
OnCreate = FormCreate
|
||||
OnDeactivate = FormDeactivate
|
||||
OnKeyDown = FormKeyDown
|
||||
OnResize = FormResize
|
||||
DesignSize = (
|
||||
777
|
||||
440)
|
||||
TextHeight = 13
|
||||
object m_GenerPanel: TGeneralDialogPanel
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 777
|
||||
Height = 440
|
||||
Anchors = [akLeft, akTop, akRight, akBottom]
|
||||
BevelEdges = [beLeft, beRight]
|
||||
BevelOuter = bvNone
|
||||
Caption = #24110#21161
|
||||
Color = 5064257
|
||||
DoubleBuffered = True
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentBackground = False
|
||||
ParentDoubleBuffered = False
|
||||
ParentFont = False
|
||||
TabOrder = 0
|
||||
OnMouseEnter = GenerPanelMouseEnter
|
||||
DesignSize = (
|
||||
777
|
||||
440)
|
||||
object m_lblGroupLabel: TLabel
|
||||
Left = 77
|
||||
Top = 405
|
||||
Width = 90
|
||||
Height = 14
|
||||
Align = alCustom
|
||||
AutoSize = False
|
||||
Caption = #25216#26415#20132#27969'QQ'#32676#65306
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 12434616
|
||||
Font.Height = -12
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
end
|
||||
object m_lblGroup: TLabel
|
||||
Left = 171
|
||||
Top = 405
|
||||
Width = 63
|
||||
Height = 14
|
||||
Align = alCustom
|
||||
AutoSize = False
|
||||
Caption = '271573952'
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 12434616
|
||||
Font.Height = -12
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
Font.Quality = fqClearType
|
||||
ParentFont = False
|
||||
ShowAccelChar = False
|
||||
end
|
||||
object m_lblVideoLabel: TLabel
|
||||
Left = 545
|
||||
Top = 405
|
||||
Width = 60
|
||||
Height = 14
|
||||
Align = alCustom
|
||||
AutoSize = False
|
||||
Caption = #35270#39057#25945#31243#65306
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 12434616
|
||||
Font.Height = -12
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
end
|
||||
object m_lblVideo: TLabel
|
||||
Left = 611
|
||||
Top = 405
|
||||
Width = 59
|
||||
Height = 14
|
||||
Cursor = crHandPoint
|
||||
Align = alCustom
|
||||
AutoSize = False
|
||||
BiDiMode = bdLeftToRight
|
||||
Caption = #22312#32447#35266#30475
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 15299907
|
||||
Font.Height = -12
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
Font.Quality = fqClearType
|
||||
ParentBiDiMode = False
|
||||
ParentFont = False
|
||||
ShowAccelChar = False
|
||||
OnClick = UrlClick
|
||||
end
|
||||
object m_lblUrlLabel: TLabel
|
||||
Left = 278
|
||||
Top = 405
|
||||
Width = 72
|
||||
Height = 14
|
||||
Align = alCustom
|
||||
AutoSize = False
|
||||
BiDiMode = bdLeftToRight
|
||||
Caption = #21809#20316#32593#35770#22363#65306
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 12434616
|
||||
Font.Height = -12
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentBiDiMode = False
|
||||
ParentFont = False
|
||||
Visible = False
|
||||
end
|
||||
object m_lblUrl: TLabel
|
||||
Left = 356
|
||||
Top = 405
|
||||
Width = 157
|
||||
Height = 14
|
||||
Cursor = crHandPoint
|
||||
Align = alCustom
|
||||
AutoSize = False
|
||||
BiDiMode = bdLeftToRight
|
||||
Caption = 'http://bbs.iChangzuo.com'
|
||||
Font.Charset = GB2312_CHARSET
|
||||
Font.Color = 15299907
|
||||
Font.Height = -12
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
Font.Quality = fqClearType
|
||||
ParentBiDiMode = False
|
||||
ParentFont = False
|
||||
ShowAccelChar = False
|
||||
Visible = False
|
||||
OnClick = UrlClick
|
||||
end
|
||||
object m_btnMin: TPNGButton
|
||||
Left = 701
|
||||
Top = 6
|
||||
Width = 23
|
||||
Height = 13
|
||||
ParentCustomHint = False
|
||||
Anchors = [akTop, akRight]
|
||||
ImgStates = 3
|
||||
ParentShowHint = False
|
||||
PngImg.Data = {
|
||||
89504E470D0A1A0A0000000D49484452000000450000000D0806000000FF86A3
|
||||
28000000097048597300000B1300000B1301009A9C1800000A4D694343505068
|
||||
6F746F73686F70204943432070726F66696C65000078DA9D53775893F7163EDF
|
||||
F7650F5642D8F0B1976C81002223AC08C81059A21092006184101240C585880A
|
||||
561415119C4855C482D50A489D88E2A028B867418A885A8B555C38EE1FDCA7B5
|
||||
7D7AEFEDEDFBD7FBBCE79CE7FCCE79CF0F8011122691E6A26A003952853C3AD8
|
||||
1F8F4F48C4C9BD80021548E0042010E6CBC26705C50000F00379787E74B03FFC
|
||||
01AF6F00020070D52E2412C7E1FF83BA50265700209100E02212E70B01905200
|
||||
C82E54C81400C81800B053B3640A009400006C797C422200AA0D00ECF4493E05
|
||||
00D8A993DC1700D8A21CA908008D0100992847240240BB00605581522C02C0C2
|
||||
00A0AC40222E04C0AE018059B632470280BD0500768E58900F4060008099422C
|
||||
CC0020380200431E13CD03204C03A030D2BFE0A95F7085B8480100C0CB95CD97
|
||||
4BD23314B895D01A77F2F0E0E221E2C26CB142611729106609E4229C979B2313
|
||||
48E7034CCE0C00001AF9D1C1FE383F90E7E6E4E1E666E76CEFF4C5A2FE6BF06F
|
||||
223E21F1DFFEBC8C020400104ECFEFDA5FE5E5D60370C701B075BF6BA95B00DA
|
||||
560068DFF95D33DB09A05A0AD07AF98B7938FC401E9EA150C83C1D1C0A0B0BED
|
||||
2562A1BD30E38B3EFF33E16FE08B7EF6FC401EFEDB7AF000719A4099ADC0A383
|
||||
FD71616E76AE528EE7CB0442316EF7E723FEC7857FFD8E29D1E234B15C2C158A
|
||||
F15889B850224DC779B952914421C995E212E97F32F11F96FD0993770D00AC86
|
||||
4FC04EB607B5CB6CC07EEE01028B0E58D27600407EF32D8C1A0B910010673432
|
||||
79F7000093BFF98F402B0100CD97A4E30000BCE8185CA894174CC608000044A0
|
||||
812AB041070CC114ACC00E9CC11DBCC01702610644400C24C03C104206E4801C
|
||||
0AA11896411954C03AD804B5B0031AA0119AE110B4C131380DE7E0125C81EB70
|
||||
170660189EC218BC86090441C8081361213A8811628ED822CE0817998E042261
|
||||
48349280A420E988145122C5C872A402A9426A915D4823F22D7214398D5C40FA
|
||||
90DBC820328AFC8ABC47319481B25103D4027540B9A81F1A8AC6A073D174340F
|
||||
5D8096A26BD11AB41E3D80B6A2A7D14BE87574007D8A8E6380D1310E668CD961
|
||||
5C8C87456089581A26C71663E55835568F35631D583776151BC09E61EF082402
|
||||
8B8013EC085E8410C26C82909047584C5843A825EC23B412BA085709838431C2
|
||||
272293A84FB4257A12F9C478623AB1905846AC26EE211E219E255E270E135F93
|
||||
48240EC992E44E0A21259032490B496B48DB482DA453A43ED210699C4C26EB90
|
||||
6DC9DEE408B280AC209791B7900F904F92FBC9C3E4B7143AC588E24C09A22452
|
||||
A494124A35653FE504A59F324299A0AA51CDA99ED408AA883A9F5A496DA07650
|
||||
2F5387A91334759A25CD9B1643CBA42DA3D5D09A696769F7682FE974BA09DD83
|
||||
1E4597D097D26BE807E9E7E983F4770C0D860D83C7486228196B197B19A718B7
|
||||
192F994CA605D39799C85430D7321B9967980F986F55582AF62A7C1591CA1295
|
||||
3A9556957E95E7AA545573553FD579AA0B54AB550FAB5E567DA64655B350E3A9
|
||||
09D416ABD5A91D55BBA936AECE5277528F50CF515FA3BE5FFD82FA630DB28685
|
||||
46A08648A35463B7C6198D2116C63265F15842D6725603EB2C6B984D625BB2F9
|
||||
EC4C7605FB1B762F7B4C534373AA66AC6691669DE671CD010EC6B1E0F039D99C
|
||||
4ACE21CE0DCE7B2D032D3F2DB1D66AAD66AD7EAD37DA7ADABEDA62ED72ED16ED
|
||||
EBDAEF75709D409D2C9DF53A6D3AF77509BA36BA51BA85BADB75CFEA3ED363EB
|
||||
79E909F5CAF50EE9DDD147F56DF4A3F517EAEFD6EFD11F373034083690196C31
|
||||
3863F0CC9063E86B9869B8D1F084E1A811CB68BA91C468A3D149A327B826EE87
|
||||
67E33578173E66AC6F1C62AC34DE65DC6B3C61626932DBA4C4A4C5E4BE29CD94
|
||||
6B9A66BAD1B4D374CCCCC82CDCACD8ACC9EC8E39D59C6B9E61BED9BCDBFC8D85
|
||||
A5459CC54A8B368BC796DA967CCB05964D96F7AC98563E567956F556D7AC49D6
|
||||
5CEB2CEB6DD6576C501B579B0C9B3A9BCBB6A8AD9BADC4769B6DDF14E2148F29
|
||||
D229F5536EDA31ECFCEC0AEC9AEC06ED39F661F625F66DF6CF1DCC1C121DD63B
|
||||
743B7C727475CC766C70BCEBA4E134C3A9C4A9C3E957671B67A1739DF33517A6
|
||||
4B90CB1297769717536DA78AA76E9F7ACB95E51AEEBAD2B5D3F5A39BBB9BDCAD
|
||||
D96DD4DDCC3DC57DABFB4D2E9B1BC95DC33DEF41F4F0F758E271CCE39DA79BA7
|
||||
C2F390E72F5E765E595EFBBD1E4FB39C269ED6306DC8DBC45BE0BDCB7B603A3E
|
||||
3D65FACEE9033EC63E029F7A9F87BEA6BE22DF3DBE237ED67E997E07FC9EFB3B
|
||||
FACBFD8FF8BFE179F216F14E056001C101E501BD811A81B3036B031F049904A5
|
||||
0735058D05BB062F0C3E15420C090D591F72936FC017F21BF96333DC672C9AD1
|
||||
15CA089D155A1BFA30CC264C1ED6118E86CF08DF107E6FA6F94CE9CCB60888E0
|
||||
476C88B81F69199917F97D14292A32AA2EEA51B453747174F72CD6ACE459FB67
|
||||
BD8EF18FA98CB93BDB6AB6727667AC6A6C526C63EC9BB880B8AAB8817887F845
|
||||
F1971274132409ED89E4C4D8C43D89E37302E76C9A339CE49A54967463AEE5DC
|
||||
A2B917E6E9CECB9E773C593559907C3885981297B23FE5832042502F184FE5A7
|
||||
6E4D1D13F2849B854F45BEA28DA251B1B7B84A3C92E69D5695F638DD3B7D43FA
|
||||
68864F4675C633094F522B79911992B923F34D5644D6DEACCFD971D92D39949C
|
||||
949CA3520D6996B42BD730B728B74F662B2B930DE479E66DCA1B9387CAF7E423
|
||||
F973F3DB156C854CD1A3B452AE500E164C2FA82B785B185B78B848BD485AD433
|
||||
DF66FEEAF9230B82167CBD90B050B8B0B3D8B87859F1E022BF45BB16238B5317
|
||||
772E315D52BA647869F0D27DCB68CBB296FD50E2585255F26A79DCF28E5283D2
|
||||
A5A5432B82573495A994C9CB6EAEF45AB9631561956455EF6A97D55B567F2A17
|
||||
955FAC70ACA8AEF8B046B8E6E2574E5FD57CF5796DDADADE4AB7CAEDEB48EBA4
|
||||
EB6EACF759BFAF4ABD6A41D5D086F00DAD1BF18DE51B5F6D4ADE74A17A6AF58E
|
||||
CDB4CDCACD03356135ED5BCCB6ACDBF2A136A3F67A9D7F5DCB56FDADABB7BED9
|
||||
26DAD6BFDD777BF30E831D153BDEEF94ECBCB52B78576BBD457DF56ED2EE82DD
|
||||
8F1A621BBABFE67EDDB847774FC59E8F7BA57B07F645EFEB6A746F6CDCAFBFBF
|
||||
B2096D52368D1E483A70E59B806FDA9BED9A77B5705A2A0EC241E5C127DFA67C
|
||||
7BE350E8A1CEC3DCC3CDDF997FB7F508EB48792BD23ABF75AC2DA36DA03DA1BD
|
||||
EFE88CA39D1D5E1D47BEB7FF7EEF31E36375C7358F579EA09D283DF1F9E48293
|
||||
E3A764A79E9D4E3F3DD499DC79F74CFC996B5D515DBD6743CF9E3F1774EE4CB7
|
||||
5FF7C9F3DEE78F5DF0BC70F422F762DB25B74BAD3DAE3D477E70FDE148AF5B6F
|
||||
EB65F7CBED573CAE74F44DEB3BD1EFD37FFA6AC0D573D7F8D72E5D9F79BDEFC6
|
||||
EC1BB76E26DD1CB825BAF5F876F6ED17770AEE4CDC5D7A8F78AFFCBEDAFDEA07
|
||||
FA0FEA7FB4FEB165C06DE0F860C060CFC3590FEF0E09879EFE94FFD387E1D247
|
||||
CC47D52346238D8F9D1F1F1B0D1ABDF264CE93E1A7B2A713CFCA7E56FF79EB73
|
||||
ABE7DFFDE2FB4BCF58FCD8F00BF98BCFBFAE79A9F372EFABA9AF3AC723C71FBC
|
||||
CE793DF1A6FCADCEDB7DEFB8EFBADFC7BD1F9928FC40FE50F3D1FA63C7A7D04F
|
||||
F73EE77CFEFC2FF784F3FB25D29F330000018D4944415478DAED97CB4AC34018
|
||||
852769ED458D552BD28D5DD69550C4B50FE0C28775E103B81629B8D2A56E44BC
|
||||
D5A8BD99C4F39B3332849A964C2A54FAC3E10CB3383DF93A4D52278A22358B09
|
||||
82402F1DC8355CAF9D2962222AA422C35522C735D6D3662B23F3E7F31C138A71
|
||||
21798D942B4045AA6CAC0B13CA4B3129F4490D8C7590C8778D4C0D7ED268D0FA
|
||||
33F47AE650A4E412612C43ABF432F7D3CA4BC911617C406FF401F72303788999
|
||||
A5049CB46C0D63C8CCA1069E842285EB503503801EF4C8E27AA46005F2A07568
|
||||
8BEE71BF98922705FB900FBD400F749FFB21C156D8D7B300EEB3BFE48E925076
|
||||
DAFB073719807C4FE7E2BC09BB35B64A2CBB0935907D66917D08BB839E781121
|
||||
01AC4035645F5B64B7605DE85D4025A1B4107E6511BE0B33CBC9B7B8066D4302
|
||||
FCD422FB48C5C0EFA157151F7F9DBF81EC4B8BEC3DD83373FB7F01A50635A026
|
||||
B24F2CB28F61728AE5B47409A54A287564772CB2DB2AFEE90B94DEE2A4A8C927
|
||||
65714F19734F593C7DC63C7DB2C2FE6DFEC57B4ADE50E6FF8D36CF99E7FF3E5F
|
||||
B19A31A2907770F30000000049454E44AE426082}
|
||||
ShowHint = False
|
||||
OnClick = MinClick
|
||||
end
|
||||
object m_btnMax: TPNGButton
|
||||
Left = 728
|
||||
Top = 4
|
||||
Width = 21
|
||||
Height = 18
|
||||
ParentCustomHint = False
|
||||
Anchors = [akTop, akRight]
|
||||
ImgStates = 3
|
||||
ParentShowHint = False
|
||||
PngImg.Data = {
|
||||
89504E470D0A1A0A0000000D494844520000003F000000120806000000EC6D06
|
||||
37000000097048597300000B1300000B1301009A9C1800000A4D694343505068
|
||||
6F746F73686F70204943432070726F66696C65000078DA9D53775893F7163EDF
|
||||
F7650F5642D8F0B1976C81002223AC08C81059A21092006184101240C585880A
|
||||
561415119C4855C482D50A489D88E2A028B867418A885A8B555C38EE1FDCA7B5
|
||||
7D7AEFEDEDFBD7FBBCE79CE7FCCE79CF0F8011122691E6A26A003952853C3AD8
|
||||
1F8F4F48C4C9BD80021548E0042010E6CBC26705C50000F00379787E74B03FFC
|
||||
01AF6F00020070D52E2412C7E1FF83BA50265700209100E02212E70B01905200
|
||||
C82E54C81400C81800B053B3640A009400006C797C422200AA0D00ECF4493E05
|
||||
00D8A993DC1700D8A21CA908008D0100992847240240BB00605581522C02C0C2
|
||||
00A0AC40222E04C0AE018059B632470280BD0500768E58900F4060008099422C
|
||||
CC0020380200431E13CD03204C03A030D2BFE0A95F7085B8480100C0CB95CD97
|
||||
4BD23314B895D01A77F2F0E0E221E2C26CB142611729106609E4229C979B2313
|
||||
48E7034CCE0C00001AF9D1C1FE383F90E7E6E4E1E666E76CEFF4C5A2FE6BF06F
|
||||
223E21F1DFFEBC8C020400104ECFEFDA5FE5E5D60370C701B075BF6BA95B00DA
|
||||
560068DFF95D33DB09A05A0AD07AF98B7938FC401E9EA150C83C1D1C0A0B0BED
|
||||
2562A1BD30E38B3EFF33E16FE08B7EF6FC401EFEDB7AF000719A4099ADC0A383
|
||||
FD71616E76AE528EE7CB0442316EF7E723FEC7857FFD8E29D1E234B15C2C158A
|
||||
F15889B850224DC779B952914421C995E212E97F32F11F96FD0993770D00AC86
|
||||
4FC04EB607B5CB6CC07EEE01028B0E58D27600407EF32D8C1A0B910010673432
|
||||
79F7000093BFF98F402B0100CD97A4E30000BCE8185CA894174CC608000044A0
|
||||
812AB041070CC114ACC00E9CC11DBCC01702610644400C24C03C104206E4801C
|
||||
0AA11896411954C03AD804B5B0031AA0119AE110B4C131380DE7E0125C81EB70
|
||||
170660189EC218BC86090441C8081361213A8811628ED822CE0817998E042261
|
||||
48349280A420E988145122C5C872A402A9426A915D4823F22D7214398D5C40FA
|
||||
90DBC820328AFC8ABC47319481B25103D4027540B9A81F1A8AC6A073D174340F
|
||||
5D8096A26BD11AB41E3D80B6A2A7D14BE87574007D8A8E6380D1310E668CD961
|
||||
5C8C87456089581A26C71663E55835568F35631D583776151BC09E61EF082402
|
||||
8B8013EC085E8410C26C82909047584C5843A825EC23B412BA085709838431C2
|
||||
272293A84FB4257A12F9C478623AB1905846AC26EE211E219E255E270E135F93
|
||||
48240EC992E44E0A21259032490B496B48DB482DA453A43ED210699C4C26EB90
|
||||
6DC9DEE408B280AC209791B7900F904F92FBC9C3E4B7143AC588E24C09A22452
|
||||
A494124A35653FE504A59F324299A0AA51CDA99ED408AA883A9F5A496DA07650
|
||||
2F5387A91334759A25CD9B1643CBA42DA3D5D09A696769F7682FE974BA09DD83
|
||||
1E4597D097D26BE807E9E7E983F4770C0D860D83C7486228196B197B19A718B7
|
||||
192F994CA605D39799C85430D7321B9967980F986F55582AF62A7C1591CA1295
|
||||
3A9556957E95E7AA545573553FD579AA0B54AB550FAB5E567DA64655B350E3A9
|
||||
09D416ABD5A91D55BBA936AECE5277528F50CF515FA3BE5FFD82FA630DB28685
|
||||
46A08648A35463B7C6198D2116C63265F15842D6725603EB2C6B984D625BB2F9
|
||||
EC4C7605FB1B762F7B4C534373AA66AC6691669DE671CD010EC6B1E0F039D99C
|
||||
4ACE21CE0DCE7B2D032D3F2DB1D66AAD66AD7EAD37DA7ADABEDA62ED72ED16ED
|
||||
EBDAEF75709D409D2C9DF53A6D3AF77509BA36BA51BA85BADB75CFEA3ED363EB
|
||||
79E909F5CAF50EE9DDD147F56DF4A3F517EAEFD6EFD11F373034083690196C31
|
||||
3863F0CC9063E86B9869B8D1F084E1A811CB68BA91C468A3D149A327B826EE87
|
||||
67E33578173E66AC6F1C62AC34DE65DC6B3C61626932DBA4C4A4C5E4BE29CD94
|
||||
6B9A66BAD1B4D374CCCCC82CDCACD8ACC9EC8E39D59C6B9E61BED9BCDBFC8D85
|
||||
A5459CC54A8B368BC796DA967CCB05964D96F7AC98563E567956F556D7AC49D6
|
||||
5CEB2CEB6DD6576C501B579B0C9B3A9BCBB6A8AD9BADC4769B6DDF14E2148F29
|
||||
D229F5536EDA31ECFCEC0AEC9AEC06ED39F661F625F66DF6CF1DCC1C121DD63B
|
||||
743B7C727475CC766C70BCEBA4E134C3A9C4A9C3E957671B67A1739DF33517A6
|
||||
4B90CB1297769717536DA78AA76E9F7ACB95E51AEEBAD2B5D3F5A39BBB9BDCAD
|
||||
D96DD4DDCC3DC57DABFB4D2E9B1BC95DC33DEF41F4F0F758E271CCE39DA79BA7
|
||||
C2F390E72F5E765E595EFBBD1E4FB39C269ED6306DC8DBC45BE0BDCB7B603A3E
|
||||
3D65FACEE9033EC63E029F7A9F87BEA6BE22DF3DBE237ED67E997E07FC9EFB3B
|
||||
FACBFD8FF8BFE179F216F14E056001C101E501BD811A81B3036B031F049904A5
|
||||
0735058D05BB062F0C3E15420C090D591F72936FC017F21BF96333DC672C9AD1
|
||||
15CA089D155A1BFA30CC264C1ED6118E86CF08DF107E6FA6F94CE9CCB60888E0
|
||||
476C88B81F69199917F97D14292A32AA2EEA51B453747174F72CD6ACE459FB67
|
||||
BD8EF18FA98CB93BDB6AB6727667AC6A6C526C63EC9BB880B8AAB8817887F845
|
||||
F1971274132409ED89E4C4D8C43D89E37302E76C9A339CE49A54967463AEE5DC
|
||||
A2B917E6E9CECB9E773C593559907C3885981297B23FE5832042502F184FE5A7
|
||||
6E4D1D13F2849B854F45BEA28DA251B1B7B84A3C92E69D5695F638DD3B7D43FA
|
||||
68864F4675C633094F522B79911992B923F34D5644D6DEACCFD971D92D39949C
|
||||
949CA3520D6996B42BD730B728B74F662B2B930DE479E66DCA1B9387CAF7E423
|
||||
F973F3DB156C854CD1A3B452AE500E164C2FA82B785B185B78B848BD485AD433
|
||||
DF66FEEAF9230B82167CBD90B050B8B0B3D8B87859F1E022BF45BB16238B5317
|
||||
772E315D52BA647869F0D27DCB68CBB296FD50E2585255F26A79DCF28E5283D2
|
||||
A5A5432B82573495A994C9CB6EAEF45AB9631561956455EF6A97D55B567F2A17
|
||||
955FAC70ACA8AEF8B046B8E6E2574E5FD57CF5796DDADADE4AB7CAEDEB48EBA4
|
||||
EB6EACF759BFAF4ABD6A41D5D086F00DAD1BF18DE51B5F6D4ADE74A17A6AF58E
|
||||
CDB4CDCACD03356135ED5BCCB6ACDBF2A136A3F67A9D7F5DCB56FDADABB7BED9
|
||||
26DAD6BFDD777BF30E831D153BDEEF94ECBCB52B78576BBD457DF56ED2EE82DD
|
||||
8F1A621BBABFE67EDDB847774FC59E8F7BA57B07F645EFEB6A746F6CDCAFBFBF
|
||||
B2096D52368D1E483A70E59B806FDA9BED9A77B5705A2A0EC241E5C127DFA67C
|
||||
7BE350E8A1CEC3DCC3CDDF997FB7F508EB48792BD23ABF75AC2DA36DA03DA1BD
|
||||
EFE88CA39D1D5E1D47BEB7FF7EEF31E36375C7358F579EA09D283DF1F9E48293
|
||||
E3A764A79E9D4E3F3DD499DC79F74CFC996B5D515DBD6743CF9E3F1774EE4CB7
|
||||
5FF7C9F3DEE78F5DF0BC70F422F762DB25B74BAD3DAE3D477E70FDE148AF5B6F
|
||||
EB65F7CBED573CAE74F44DEB3BD1EFD37FFA6AC0D573D7F8D72E5D9F79BDEFC6
|
||||
EC1BB76E26DD1CB825BAF5F876F6ED17770AEE4CDC5D7A8F78AFFCBEDAFDEA07
|
||||
FA0FEA7FB4FEB165C06DE0F860C060CFC3590FEF0E09879EFE94FFD387E1D247
|
||||
CC47D52346238D8F9D1F1F1B0D1ABDF264CE93E1A7B2A713CFCA7E56FF79EB73
|
||||
ABE7DFFDE2FB4BCF58FCD8F00BF98BCFBFAE79A9F372EFABA9AF3AC723C71FBC
|
||||
CE793DF1A6FCADCEDB7DEFB8EFBADFC7BD1F9928FC40FE50F3D1FA63C7A7D04F
|
||||
F73EE77CFEFC2FF784F3FB25D29F330000029D4944415478DAED98CB4F534114
|
||||
C66F4B0BC5DA4041C4F7A2822ED8106835F11F30C68D3182AC4C342A2C5918B7
|
||||
C62D71E1529448C20AC11837C6F80F98688B61E342C52E7CE30B0D8F8278BD7E
|
||||
C7FB8D39DE78C15E6051CB245F663A9D7EF7FCCE9C195A428EE358ABD56CDBD6
|
||||
2F435058F5661C5AC2C2A17E508EEA2DCFE7C36ABC9CA7A5BC7E3F27A4E13DC1
|
||||
AFA44930155084AA52E30A9F60251009E03BB5A0C6B6C737ACBC4C62FD9A49A4
|
||||
F136E3358397A0A284AE86E2500CAA54F0BAE4CC6B09E01B340FCD4205266191
|
||||
EF9B841AEFA84A809FA7815D545EBF12EA85DF80AE9E01FF6B93003F41736A2E
|
||||
42D88D500D94E4B84AED92CDE0CC6E9A5D920067A029E82BC7F37CCF9B505351
|
||||
61F579E3A9E74C25FD91502FFCCED6B6F48B62B779FC516E17BA976A4A763841
|
||||
E80678DE0FE07900DD0726619A10022B1B9480E7F3009EBBE9251BB5E085DF03
|
||||
D327014CF7A27BAAA664D765C737435BE1792F80E741746FA1F7965B015229D5
|
||||
4C6A0D3C1F07F06CA19724A0E00BDFDCD474777464F82233EF6DC98ECEAE0BCF
|
||||
26260EF9C04B9075D01668073C6FCB6426937E78ADFFCA301F2E41C8F9AE64A2
|
||||
1267BA7BBAB2D9DC3E7A1E41F70A7A077DB6DCD28D736D2D3CC7655D2A95BA73
|
||||
EBE6C865CB3D1A05AE8B3086D8D1639DBDF97CFE303D5BD17DE1B36797833F89
|
||||
E1E45FE01B013FB804BC94E626681BE14765329D6E7F3070B57F88301F19708C
|
||||
6BEB4E9FED3E91CB8DEDA76707E1DF70AD40C9BD514BF831057FC972CFB3DC0F
|
||||
72A145B9360EF8730ABE9DF0A299B5846F80B613FE8682BF4E984905DF280900
|
||||
FC29057F9CF0AF2DF7EC1B78B94792F0CC2AF83E56D3B4AA26391E09C09F57F0
|
||||
1956F2D43AFC7AD9FBC397E785574CFB5FFED495F5979CB2FE7A5B6C32FD5A49
|
||||
FEB0592DF8D2FB49BBD2566AFFCCF80990017597BCE4EA990000000049454E44
|
||||
AE426082}
|
||||
ShowHint = False
|
||||
OnClick = MaxClick
|
||||
end
|
||||
object m_btnRest: TPNGButton
|
||||
Left = 729
|
||||
Top = 2
|
||||
Width = 22
|
||||
Height = 22
|
||||
ParentCustomHint = False
|
||||
Anchors = [akTop, akRight]
|
||||
ImgStates = 3
|
||||
ParentShowHint = False
|
||||
PngImg.Data = {
|
||||
89504E470D0A1A0A0000000D4948445200000042000000160806000000744B4A
|
||||
09000000097048597300000B1300000B1301009A9C1800000A4D694343505068
|
||||
6F746F73686F70204943432070726F66696C65000078DA9D53775893F7163EDF
|
||||
F7650F5642D8F0B1976C81002223AC08C81059A21092006184101240C585880A
|
||||
561415119C4855C482D50A489D88E2A028B867418A885A8B555C38EE1FDCA7B5
|
||||
7D7AEFEDEDFBD7FBBCE79CE7FCCE79CF0F8011122691E6A26A003952853C3AD8
|
||||
1F8F4F48C4C9BD80021548E0042010E6CBC26705C50000F00379787E74B03FFC
|
||||
01AF6F00020070D52E2412C7E1FF83BA50265700209100E02212E70B01905200
|
||||
C82E54C81400C81800B053B3640A009400006C797C422200AA0D00ECF4493E05
|
||||
00D8A993DC1700D8A21CA908008D0100992847240240BB00605581522C02C0C2
|
||||
00A0AC40222E04C0AE018059B632470280BD0500768E58900F4060008099422C
|
||||
CC0020380200431E13CD03204C03A030D2BFE0A95F7085B8480100C0CB95CD97
|
||||
4BD23314B895D01A77F2F0E0E221E2C26CB142611729106609E4229C979B2313
|
||||
48E7034CCE0C00001AF9D1C1FE383F90E7E6E4E1E666E76CEFF4C5A2FE6BF06F
|
||||
223E21F1DFFEBC8C020400104ECFEFDA5FE5E5D60370C701B075BF6BA95B00DA
|
||||
560068DFF95D33DB09A05A0AD07AF98B7938FC401E9EA150C83C1D1C0A0B0BED
|
||||
2562A1BD30E38B3EFF33E16FE08B7EF6FC401EFEDB7AF000719A4099ADC0A383
|
||||
FD71616E76AE528EE7CB0442316EF7E723FEC7857FFD8E29D1E234B15C2C158A
|
||||
F15889B850224DC779B952914421C995E212E97F32F11F96FD0993770D00AC86
|
||||
4FC04EB607B5CB6CC07EEE01028B0E58D27600407EF32D8C1A0B910010673432
|
||||
79F7000093BFF98F402B0100CD97A4E30000BCE8185CA894174CC608000044A0
|
||||
812AB041070CC114ACC00E9CC11DBCC01702610644400C24C03C104206E4801C
|
||||
0AA11896411954C03AD804B5B0031AA0119AE110B4C131380DE7E0125C81EB70
|
||||
170660189EC218BC86090441C8081361213A8811628ED822CE0817998E042261
|
||||
48349280A420E988145122C5C872A402A9426A915D4823F22D7214398D5C40FA
|
||||
90DBC820328AFC8ABC47319481B25103D4027540B9A81F1A8AC6A073D174340F
|
||||
5D8096A26BD11AB41E3D80B6A2A7D14BE87574007D8A8E6380D1310E668CD961
|
||||
5C8C87456089581A26C71663E55835568F35631D583776151BC09E61EF082402
|
||||
8B8013EC085E8410C26C82909047584C5843A825EC23B412BA085709838431C2
|
||||
272293A84FB4257A12F9C478623AB1905846AC26EE211E219E255E270E135F93
|
||||
48240EC992E44E0A21259032490B496B48DB482DA453A43ED210699C4C26EB90
|
||||
6DC9DEE408B280AC209791B7900F904F92FBC9C3E4B7143AC588E24C09A22452
|
||||
A494124A35653FE504A59F324299A0AA51CDA99ED408AA883A9F5A496DA07650
|
||||
2F5387A91334759A25CD9B1643CBA42DA3D5D09A696769F7682FE974BA09DD83
|
||||
1E4597D097D26BE807E9E7E983F4770C0D860D83C7486228196B197B19A718B7
|
||||
192F994CA605D39799C85430D7321B9967980F986F55582AF62A7C1591CA1295
|
||||
3A9556957E95E7AA545573553FD579AA0B54AB550FAB5E567DA64655B350E3A9
|
||||
09D416ABD5A91D55BBA936AECE5277528F50CF515FA3BE5FFD82FA630DB28685
|
||||
46A08648A35463B7C6198D2116C63265F15842D6725603EB2C6B984D625BB2F9
|
||||
EC4C7605FB1B762F7B4C534373AA66AC6691669DE671CD010EC6B1E0F039D99C
|
||||
4ACE21CE0DCE7B2D032D3F2DB1D66AAD66AD7EAD37DA7ADABEDA62ED72ED16ED
|
||||
EBDAEF75709D409D2C9DF53A6D3AF77509BA36BA51BA85BADB75CFEA3ED363EB
|
||||
79E909F5CAF50EE9DDD147F56DF4A3F517EAEFD6EFD11F373034083690196C31
|
||||
3863F0CC9063E86B9869B8D1F084E1A811CB68BA91C468A3D149A327B826EE87
|
||||
67E33578173E66AC6F1C62AC34DE65DC6B3C61626932DBA4C4A4C5E4BE29CD94
|
||||
6B9A66BAD1B4D374CCCCC82CDCACD8ACC9EC8E39D59C6B9E61BED9BCDBFC8D85
|
||||
A5459CC54A8B368BC796DA967CCB05964D96F7AC98563E567956F556D7AC49D6
|
||||
5CEB2CEB6DD6576C501B579B0C9B3A9BCBB6A8AD9BADC4769B6DDF14E2148F29
|
||||
D229F5536EDA31ECFCEC0AEC9AEC06ED39F661F625F66DF6CF1DCC1C121DD63B
|
||||
743B7C727475CC766C70BCEBA4E134C3A9C4A9C3E957671B67A1739DF33517A6
|
||||
4B90CB1297769717536DA78AA76E9F7ACB95E51AEEBAD2B5D3F5A39BBB9BDCAD
|
||||
D96DD4DDCC3DC57DABFB4D2E9B1BC95DC33DEF41F4F0F758E271CCE39DA79BA7
|
||||
C2F390E72F5E765E595EFBBD1E4FB39C269ED6306DC8DBC45BE0BDCB7B603A3E
|
||||
3D65FACEE9033EC63E029F7A9F87BEA6BE22DF3DBE237ED67E997E07FC9EFB3B
|
||||
FACBFD8FF8BFE179F216F14E056001C101E501BD811A81B3036B031F049904A5
|
||||
0735058D05BB062F0C3E15420C090D591F72936FC017F21BF96333DC672C9AD1
|
||||
15CA089D155A1BFA30CC264C1ED6118E86CF08DF107E6FA6F94CE9CCB60888E0
|
||||
476C88B81F69199917F97D14292A32AA2EEA51B453747174F72CD6ACE459FB67
|
||||
BD8EF18FA98CB93BDB6AB6727667AC6A6C526C63EC9BB880B8AAB8817887F845
|
||||
F1971274132409ED89E4C4D8C43D89E37302E76C9A339CE49A54967463AEE5DC
|
||||
A2B917E6E9CECB9E773C593559907C3885981297B23FE5832042502F184FE5A7
|
||||
6E4D1D13F2849B854F45BEA28DA251B1B7B84A3C92E69D5695F638DD3B7D43FA
|
||||
68864F4675C633094F522B79911992B923F34D5644D6DEACCFD971D92D39949C
|
||||
949CA3520D6996B42BD730B728B74F662B2B930DE479E66DCA1B9387CAF7E423
|
||||
F973F3DB156C854CD1A3B452AE500E164C2FA82B785B185B78B848BD485AD433
|
||||
DF66FEEAF9230B82167CBD90B050B8B0B3D8B87859F1E022BF45BB16238B5317
|
||||
772E315D52BA647869F0D27DCB68CBB296FD50E2585255F26A79DCF28E5283D2
|
||||
A5A5432B82573495A994C9CB6EAEF45AB9631561956455EF6A97D55B567F2A17
|
||||
955FAC70ACA8AEF8B046B8E6E2574E5FD57CF5796DDADADE4AB7CAEDEB48EBA4
|
||||
EB6EACF759BFAF4ABD6A41D5D086F00DAD1BF18DE51B5F6D4ADE74A17A6AF58E
|
||||
CDB4CDCACD03356135ED5BCCB6ACDBF2A136A3F67A9D7F5DCB56FDADABB7BED9
|
||||
26DAD6BFDD777BF30E831D153BDEEF94ECBCB52B78576BBD457DF56ED2EE82DD
|
||||
8F1A621BBABFE67EDDB847774FC59E8F7BA57B07F645EFEB6A746F6CDCAFBFBF
|
||||
B2096D52368D1E483A70E59B806FDA9BED9A77B5705A2A0EC241E5C127DFA67C
|
||||
7BE350E8A1CEC3DCC3CDDF997FB7F508EB48792BD23ABF75AC2DA36DA03DA1BD
|
||||
EFE88CA39D1D5E1D47BEB7FF7EEF31E36375C7358F579EA09D283DF1F9E48293
|
||||
E3A764A79E9D4E3F3DD499DC79F74CFC996B5D515DBD6743CF9E3F1774EE4CB7
|
||||
5FF7C9F3DEE78F5DF0BC70F422F762DB25B74BAD3DAE3D477E70FDE148AF5B6F
|
||||
EB65F7CBED573CAE74F44DEB3BD1EFD37FFA6AC0D573D7F8D72E5D9F79BDEFC6
|
||||
EC1BB76E26DD1CB825BAF5F876F6ED17770AEE4CDC5D7A8F78AFFCBEDAFDEA07
|
||||
FA0FEA7FB4FEB165C06DE0F860C060CFC3590FEF0E09879EFE94FFD387E1D247
|
||||
CC47D52346238D8F9D1F1F1B0D1ABDF264CE93E1A7B2A713CFCA7E56FF79EB73
|
||||
ABE7DFFDE2FB4BCF58FCD8F00BF98BCFBFAE79A9F372EFABA9AF3AC723C71FBC
|
||||
CE793DF1A6FCADCEDB7DEFB8EFBADFC7BD1F9928FC40FE50F3D1FA63C7A7D04F
|
||||
F73EE77CFEFC2FF784F3FB25D29F33000005D84944415478DACD98596C546514
|
||||
C7CFEC4B67A69556B08D1A7868AB8911A10B2856D29652048AB410E3B3FAA4AF
|
||||
FAE2032F2E212A2E0F466254822F060D04DBB2D4053586D46E208440AD0FB884
|
||||
D20296765A8AED6C9E33FD7F9D6FBEDE990E50083739F9BEB973EFFF9EFBBBE7
|
||||
9C6FB1251209BA13472C1693C6C666D75AD5B7199727607158426BC9E17058E9
|
||||
2A0DBBD6B7D2254D6FF659B63B08429C923770C23C5ADFA1392D0EC9DB456153
|
||||
5A5FCE270C100A8203109C5ADF6EB8A1C02A7DD55F7810F842568738E76273B3
|
||||
F9D8F2D0BA34C795B3221261BBCE760DED34CE990FB0E37E07B43D86A60E58D7
|
||||
9E82A6FC8E6505C12FE5E7A6100E673BC4D17FD926B35C235FCA0B0021B67BD0
|
||||
77E33FDDE1289C140857D9C2E8FF87FF4C102E00107D3FA5A2CD0A848AB249E8
|
||||
493F321F88071E5B59F937E570FC76A2F7416EFE314EEB35C10B00056C45ACFB
|
||||
738EBAABB8B9C236C6360E407A4D706B00F258772047DD65802B40A6D2405884
|
||||
75190BFF9EA3703937BA13664D10088B0402DB62D6DD97A36E1D379734185394
|
||||
5E13549A05E419ACDB9DA3EE43003BC1763D67107CE33A9AFBC52562BECF00C2
|
||||
AC090261B1CD662BE2674A44ECC67DAFD3CC57D60BA28DFFDF85FF377033CC76
|
||||
996D0420F49A200082CAF8BE63B86F3BA58AA2B4C95187FFEFC0FF8FD04CCA09
|
||||
8C6B2608B3262CD56E6CE4E64F9C5735E17E0D9409C2AC094B0484E8338C82E5
|
||||
2B2ADE968B4E9DECDB4933B91A615FA4884500E23DE86EE6660820AEE05ABD26
|
||||
88763E8004F8BE76E83E074D05380ADDA3D07D540331618248AB092525253438
|
||||
3838A70F21A909BE2C20DCF84AE26451F5EA27BAFC7E3F0503010A068374F6DC
|
||||
B9E445D5D555343D3D4D0C873C6E0FEDFEF8A357E53CEBBE03DD2644C425C098
|
||||
0684644DA8A85A75DEE3F1909897EDE2D0505277D9D2A5B311EE743AE9C0FEAF
|
||||
3721220E4377394084AD40A4D5047138140A25FBE17098C6C7C77510E5703813
|
||||
08AF8220915059BDFA98D7EB25311F5B3C1E279BDD96FC1D8D4693CE0618D2DE
|
||||
3D9FBFC63EC5597767061011446C3225565656F7BB5C2E5226BA76D6753A5D94
|
||||
903ECF393C6E37B5B77DB385750544DB0D81404D18ECEDED9354A1CACA0A4985
|
||||
12A3266403A1EAC2BD9216ECF05171B4ABF3F82BF2288E2E1F4781BDB8B85872
|
||||
DEFD4CF3B6370BF2F3E98BBD7B7600C41B195223827493680BB1EE19BBDD4EBD
|
||||
DDBF4A2D490C0C0C0424BCCA4A4B653470D637AC6FF5F97C74A8ADB519200EE6
|
||||
921A65C68BFD41E9E370D9E36B6AFA254A3A8E1C5ACFBFE3598AA51FD12020EE
|
||||
6387DBE1F04BA83112B7768479B0B965FBBB858585F4D9A79FBC2579CDBA3BA0
|
||||
6B16CB18A50A64684545D56949AB13BDDDB5949A70A9B9856F5D43E3913C8EB4
|
||||
D683079E65DD18EBEE876ED6625996E50BCBF1F0868D9BCF8E8C8C24F35A3F32
|
||||
801008522097B0C36D70F8053C5C9C76E0EB2EDADAB2EDFD0B170629128998BA
|
||||
E6F0190708C959192E4F89EEC9BE9E1A2BC0F50D8D1DA3A3A37346C4F986CF5B
|
||||
01614EA8D240486EC2E1E7F125D430282F55D4B465EB0743C3C35620CC091599
|
||||
2070DD930011256D025757DFF0ED18D7370B10592754F381283752E32F9CB79A
|
||||
62A7A5861AD658F7453810A1D484A8E0E94D4D1F86B8387FB5EF4BA92161F66B
|
||||
14297191D2A7D8763D3558F734746B28B540936B64D4CA5B5B5BF79DD7EB137F
|
||||
37C2CF09401DA34C536C8B6279231328F3482B96DAF8FD321EAEE7725E6D7DC3
|
||||
2E296A87DB5B05D45580BD8C565F74C93DB3C59275CF40B796522B4AB510F3AC
|
||||
A979AAC3C523C84F3FFEB01630553A4C50A64597397C663B741016FB0344C6F0
|
||||
A9667CFA21C553D2C5C9F73B5D4E82C32D7879B11138AECF3A9DA40D9FACDB6F
|
||||
EA8AA698E83BD86408ED3CFE4B8506621270AD97E137BBC8CA00226D42C5BA5D
|
||||
563AE2AC725EFA3D5D9D358020A12B2921E1AB6FCCA8BD0CB5C83A6FA5AB60A8
|
||||
7E5F4F572900A855A72A727337666E76D99D01C45DBDECA6D40ED50CAC79165D
|
||||
391D1940DCD51B310A84F2FD768258B0AD39E3710BB23547C6FEE7EDDEAA5B90
|
||||
CD5A8BE396376BCD8FF83F04188E95BC34C8D60000000049454E44AE426082}
|
||||
ShowHint = False
|
||||
Visible = False
|
||||
OnClick = RestClick
|
||||
end
|
||||
object m_pbUserNoticeNum: TPaintBox
|
||||
Left = 270
|
||||
Top = 36
|
||||
Width = 20
|
||||
Height = 20
|
||||
ParentCustomHint = False
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -9
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
Visible = False
|
||||
OnPaint = NoticeNumPaint
|
||||
end
|
||||
object m_btnSubmit: TTextButton
|
||||
Left = 582
|
||||
Top = 219
|
||||
Width = 83
|
||||
Height = 30
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
Visible = False
|
||||
OnClick = SubmitClick
|
||||
Text = #25552#20132
|
||||
end
|
||||
object m_lblMsgHead: TLabel
|
||||
Left = 76
|
||||
Top = 81
|
||||
Width = 30
|
||||
Height = 18
|
||||
Anchors = []
|
||||
Caption = #24744#26377
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 13158340
|
||||
Font.Height = -15
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
Font.Quality = fqClearType
|
||||
ParentFont = False
|
||||
Visible = False
|
||||
end
|
||||
object m_lblMsgNum: TLabel
|
||||
Left = 106
|
||||
Top = 81
|
||||
Width = 24
|
||||
Height = 18
|
||||
Alignment = taCenter
|
||||
Anchors = []
|
||||
AutoSize = False
|
||||
Caption = '000'
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 327893
|
||||
Font.Height = -15
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
Font.Quality = fqClearType
|
||||
ParentFont = False
|
||||
Visible = False
|
||||
end
|
||||
object m_lblMsgMiddle: TLabel
|
||||
Left = 130
|
||||
Top = 81
|
||||
Width = 105
|
||||
Height = 18
|
||||
Anchors = []
|
||||
Caption = #26465#26410#35835#28040#24687#65292#35831
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 13158340
|
||||
Font.Height = -15
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
Font.Quality = fqClearType
|
||||
ParentFont = False
|
||||
Visible = False
|
||||
end
|
||||
object m_lblMsgURL: TLabel
|
||||
Left = 238
|
||||
Top = 81
|
||||
Width = 90
|
||||
Height = 18
|
||||
Cursor = crHandPoint
|
||||
Anchors = []
|
||||
Caption = #36827#20837#20010#20154#31354#38388
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 15299907
|
||||
Font.Height = -15
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = [fsUnderline]
|
||||
Font.Quality = fqClearType
|
||||
ParentFont = False
|
||||
Visible = False
|
||||
OnClick = MsgURLClick
|
||||
end
|
||||
object m_lblMsgTail: TLabel
|
||||
Left = 330
|
||||
Top = 81
|
||||
Width = 45
|
||||
Height = 18
|
||||
Anchors = []
|
||||
Caption = #26597#38405#12290
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 13158340
|
||||
Font.Height = -15
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
Font.Quality = fqClearType
|
||||
ParentFont = False
|
||||
Visible = False
|
||||
end
|
||||
object m_memMsg: TMemo
|
||||
Left = 78
|
||||
Top = 115
|
||||
Width = 587
|
||||
Height = 130
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clGray
|
||||
Font.Height = -15
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
Font.Quality = fqClearType
|
||||
ImeName = #20013#25991'('#31616#20307') - '#25628#29399#25340#38899#36755#20837#27861
|
||||
Lines.Strings = (
|
||||
#35831#22312#27492#22788#36755#20837#24744#30340#38382#39064)
|
||||
MaxLength = 106
|
||||
ParentFont = False
|
||||
ParentShowHint = False
|
||||
ShowHint = False
|
||||
TabOrder = 0
|
||||
Visible = False
|
||||
OnChange = MemoMsgChange
|
||||
OnClick = MemoMsgClick
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,118 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef HelpFormUnitH
|
||||
#define HelpFormUnitH
|
||||
|
||||
#define HLP_WINDOW_MAX 0
|
||||
#define HLP_WINDOW_NORMAL 1
|
||||
#define HLP_WINDOW_MIN 2
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
#include <System.Classes.hpp>
|
||||
#include <Vcl.Controls.hpp>
|
||||
#include <Vcl.StdCtrls.hpp>
|
||||
#include <Vcl.Forms.hpp>
|
||||
#include <Vcl.ExtCtrls.hpp>
|
||||
#include "GeneralDialogPanel.h"
|
||||
#include "PNGButton.hpp"
|
||||
#include "MessageDef.h"
|
||||
#include "HelpPanelUnit.h"
|
||||
#include "TextButton.h"
|
||||
#include "CapButton.h"
|
||||
|
||||
#define TAB_NUM 7
|
||||
|
||||
#define TAB_QA 0
|
||||
#define TAB_FB 1
|
||||
#define TAB_NT 2
|
||||
#define TAB_CN 3
|
||||
#define TAB_SW 4
|
||||
#define TAB_MN 5
|
||||
#define TAB_AB 6
|
||||
//---------------------------------------------------------------------------
|
||||
class TTabButton : public TPNGButton
|
||||
{
|
||||
private:
|
||||
virtual void __fastcall Paint(void);
|
||||
public:
|
||||
String Caption;
|
||||
void __fastcall SetFontSize(int sz);
|
||||
__fastcall virtual TTabButton(System::Classes::TComponent* AOwner);
|
||||
__fastcall virtual ~TTabButton(void);
|
||||
};
|
||||
|
||||
|
||||
class THelpForm : public TForm
|
||||
{
|
||||
__published: // IDE-managed Components
|
||||
TGeneralDialogPanel *m_GenerPanel;
|
||||
TLabel *m_lblGroupLabel;
|
||||
TLabel *m_lblGroup;
|
||||
TLabel *m_lblVideoLabel;
|
||||
TLabel *m_lblVideo;
|
||||
TLabel *m_lblUrlLabel;
|
||||
TLabel *m_lblUrl;
|
||||
TPNGButton *m_btnMin;
|
||||
TPNGButton *m_btnMax;
|
||||
TPNGButton *m_btnRest;
|
||||
TPaintBox *m_pbUserNoticeNum;
|
||||
TMemo *m_memMsg;
|
||||
TTextButton *m_btnSubmit;
|
||||
TLabel *m_lblMsgHead;
|
||||
TLabel *m_lblMsgNum;
|
||||
TLabel *m_lblMsgMiddle;
|
||||
TLabel *m_lblMsgURL;
|
||||
TLabel *m_lblMsgTail;
|
||||
|
||||
void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
|
||||
void __fastcall RestClick(TObject *Sender);
|
||||
void __fastcall MinClick(TObject *Sender);
|
||||
void __fastcall MaxClick(TObject *Sender);
|
||||
void __fastcall FormResize(TObject *Sender);
|
||||
void __fastcall FormCreate(TObject *Sender);
|
||||
void __fastcall FormActivate(TObject *Sender);
|
||||
void __fastcall FormDeactivate(TObject *Sender);
|
||||
void __fastcall NoticeNumPaint(TObject *Sender);
|
||||
void __fastcall UrlClick(TObject *Sender);
|
||||
void __fastcall SubmitClick(TObject *Sender);
|
||||
void __fastcall MemoMsgChange(TObject *Sender);
|
||||
void __fastcall MemoMsgClick(TObject *Sender);
|
||||
void __fastcall MsgURLClick(TObject *Sender);
|
||||
void __fastcall FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift);
|
||||
void __fastcall GenerPanelMouseEnter(TObject *Sender);
|
||||
private:
|
||||
// void __fastcall AboutClick(TObject *Sender);
|
||||
// void __fastcall HelpClick(TObject *Sender);
|
||||
void __fastcall TabClick(TObject *Sender);
|
||||
void __fastcall panelShowClick(TObject *Sender);
|
||||
|
||||
private: // User declarations
|
||||
THelpPanel* m_PanelShow;
|
||||
TPngImage* m_PngImage;
|
||||
|
||||
bool m_bMemoHint;
|
||||
int m_nUserNoticeNum;
|
||||
|
||||
TTabButton* m_arrTabs[8]; //8¸ö°´Å¥µÄÖ¸Õë
|
||||
TPngImage * m_pImgNoticeTip;
|
||||
|
||||
MESSAGE void __fastcall WMNCLButtonDown(Winapi::Messages::TWMNCLButtonDown &Message);
|
||||
|
||||
BEGIN_MESSAGE_MAP
|
||||
MESSAGE_HANDLER(WM_NCLBUTTONDOWN, TWMNCLButtonDown, WMNCLButtonDown)
|
||||
END_MESSAGE_MAP(TForm)
|
||||
|
||||
public: // User declarations
|
||||
int Window_state;
|
||||
|
||||
void __fastcall SetSize( int iState );
|
||||
void __fastcall SetNoticeNum( int num, int iType ); //iTyp: 0=public, 1=user
|
||||
int __fastcall GetNoticeNum( int iType ); //iTyp: -1=all, 0=public, 1=user
|
||||
void __fastcall SetPage( int iPage );
|
||||
|
||||
__fastcall THelpForm(TComponent* Owner);
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
extern PACKAGE THelpForm *HelpForm;
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
@@ -0,0 +1,769 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#pragma hdrstop
|
||||
|
||||
#include "HelpPanelUnit.h"
|
||||
#include "GlobalUnit.h"
|
||||
|
||||
char u_strURLAndroid[256] = "/ichangzuo/File/Software/App/Ac/Android/Ac_Android.apk",
|
||||
u_strURLiOS[256] = "http://itunes.apple.com/cn/app/id928747575";
|
||||
|
||||
const static COLORREF clrEnter = RGB( 100,180,236 ),
|
||||
clrLeave = RGB( 67,117,233 );
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
|
||||
__fastcall THelpPanel::THelpPanel(TComponent* AOwner)
|
||||
: Vcl::Extctrls::TPanel(AOwner)
|
||||
{
|
||||
m_sbVert = NULL;
|
||||
|
||||
m_nLeftBound = 15;
|
||||
m_nRightBound = 48;
|
||||
m_nTopBound = 15;
|
||||
m_nBottomBound = 25;
|
||||
|
||||
m_nRowWidth = 0;
|
||||
m_nRowHight = 22;
|
||||
|
||||
m_iMode = 0;
|
||||
m_nBeginShowRow = 0;
|
||||
|
||||
for( int i=0; i<MODE_NUM; i++ ){
|
||||
m_aFirstRow[i] = m_aFirstTitle[i] = 0;
|
||||
}
|
||||
|
||||
// Canvas->Font->Size = 11; //字母字体大小
|
||||
Canvas->Font->Quality = TFontQuality::fqClearTypeNatural;
|
||||
|
||||
for( int i=0; i<SOFTWARE_NUM; i++ ){
|
||||
m_aLblSWName[i] = NULL;
|
||||
m_aLblSWLink[i] = NULL;
|
||||
}
|
||||
|
||||
m_lblCoinPage = NULL;
|
||||
m_pQRPanelAndroid = NULL;
|
||||
m_pQRPaneliOS = NULL;
|
||||
m_pQRdataAndroid = NULL;
|
||||
m_pQRdataiOS = NULL;
|
||||
|
||||
Color = RGB( 53,56,63 );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall THelpPanel::CreateWnd(void)
|
||||
{
|
||||
Vcl::Extctrls::TPanel::CreateWnd();
|
||||
|
||||
m_sbVert = new TSkinScrollBar(this);
|
||||
m_sbVert->Parent = this;
|
||||
m_sbVert->m_pWndCtrl = this;
|
||||
m_sbVert->Visible = false;
|
||||
m_sbVert->Left = Width - m_sbVert->Width - 1; //change
|
||||
m_sbVert->Top = 1;
|
||||
m_sbVert->Height = Height-2;
|
||||
m_sbVert->Visible = false;
|
||||
|
||||
CalcViewArea();
|
||||
|
||||
m_lblCoinPage = new TLabel( NULL );
|
||||
m_lblCoinPage->Visible = false;
|
||||
m_lblCoinPage->Parent = this;
|
||||
m_lblCoinPage->Font->Name = "Tahoma";
|
||||
m_lblCoinPage->Font->Size = Canvas->Font->Size;
|
||||
m_lblCoinPage->Font->Style = TFontStyles()<<fsUnderline;
|
||||
m_lblCoinPage->Font->Color = clrLeave;
|
||||
m_lblCoinPage->Caption = "官网详细说明";
|
||||
m_lblCoinPage->OnClick = LinkClick;
|
||||
m_lblCoinPage->OnMouseEnter = LinkMouseEnter;
|
||||
m_lblCoinPage->OnMouseLeave = LinkMouseLeave;
|
||||
|
||||
m_lblCoinPage->Left = m_nLeftBound + 20;
|
||||
// m_lblCoinPage->Top = 1;
|
||||
|
||||
for( int i=0; i<SOFTWARE_NUM; i++ ){
|
||||
m_aLblSWName[i] = new TLabel( NULL );
|
||||
m_aLblSWName[i]->Visible = false;
|
||||
m_aLblSWName[i]->Parent = this;
|
||||
m_aLblSWName[i]->Font->Name = g_strTxtFontName;
|
||||
m_aLblSWName[i]->Font->Color = COLOR_ANSWER;
|
||||
// if( !strcmp( g_strTxtFontName, "微软雅黑" ) )
|
||||
// m_aLblSWName[i]->Font->Size = 11;
|
||||
// else
|
||||
// m_aLblSWName[i]->Font->Size = 10;
|
||||
m_aLblSWName[i]->Font->Size = g_szFont10;
|
||||
m_aLblSWName[i]->Left = m_nLeftBound + 10;
|
||||
|
||||
if( i==0 ){
|
||||
m_aLblSWName[i]->Top = m_nTopBound + 10;
|
||||
}
|
||||
else if( i==1 ){
|
||||
m_aLblSWName[i]->Top = m_aLblSWName[i-1]->Top + 90;
|
||||
}
|
||||
else{
|
||||
m_aLblSWName[i]->Top = m_aLblSWName[i-1]->Top + 110;
|
||||
}
|
||||
|
||||
m_aLblSWLink[i] = new TLabel( NULL );
|
||||
|
||||
m_aLblSWLink[i]->Visible = false;
|
||||
m_aLblSWLink[i]->Parent = this;
|
||||
m_aLblSWLink[i]->Tag = i;
|
||||
m_aLblSWLink[i]->Font->Name = "Tahoma";
|
||||
m_aLblSWLink[i]->Font->Size = g_szFont9;
|
||||
m_aLblSWLink[i]->Font->Style = TFontStyles()<<fsUnderline;
|
||||
m_aLblSWLink[i]->Font->Color = clrLeave;
|
||||
m_aLblSWLink[i]->Caption = "官网免费下载";
|
||||
m_aLblSWLink[i]->OnClick = LinkClick;
|
||||
m_aLblSWLink[i]->OnMouseEnter = LinkMouseEnter;
|
||||
m_aLblSWLink[i]->OnMouseLeave = LinkMouseLeave;
|
||||
|
||||
m_aLblSWLink[i]->Left = 250;
|
||||
m_aLblSWLink[i]->Top = m_aLblSWName[i]->Top + 1;
|
||||
}
|
||||
|
||||
m_aLblSWName[0]->Caption = "唱作魔方 for Windows";
|
||||
m_aLblSWName[1]->Caption = "唱作魔方App for Android";
|
||||
m_aLblSWName[2]->Caption = "唱作魔方App for iOS";
|
||||
|
||||
if( f_QR_Encode ){
|
||||
char strURL[256] = "";
|
||||
f_CS_GetWebPageURL( URL_HOMEPAGE, strURL );
|
||||
strcat( strURL, u_strURLAndroid );
|
||||
|
||||
m_pQRdataAndroid = new unsigned char[100*100];
|
||||
m_pQRdataiOS = new unsigned char[100*100];
|
||||
int qrWidthA = f_QR_Encode( strURL, m_pQRdataAndroid ),
|
||||
qrWidthI = f_QR_Encode( u_strURLiOS, m_pQRdataiOS );
|
||||
|
||||
m_pQRPanelAndroid = new TQRcodePanel( NULL, "扫描下载" );
|
||||
if( m_pQRPanelAndroid ){
|
||||
m_pQRPanelAndroid->Hide();
|
||||
m_pQRPanelAndroid->Parent = this;
|
||||
m_pQRPanelAndroid->SetBounds( 350, 75, 100, 100 );
|
||||
m_pQRPanelAndroid->SetQRData( qrWidthA, m_pQRdataAndroid );
|
||||
}
|
||||
|
||||
m_pQRPaneliOS = new TQRcodePanel( NULL, "扫描下载" );
|
||||
if( m_pQRPaneliOS ){
|
||||
m_pQRPaneliOS->Hide();
|
||||
m_pQRPaneliOS->Parent = this;
|
||||
m_pQRPaneliOS->SetBounds( 350, 195, 100, 100 );
|
||||
m_pQRPaneliOS->SetQRData( qrWidthI, m_pQRdataiOS );
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
__fastcall THelpPanel::~THelpPanel()
|
||||
{
|
||||
for( int i=0; i<SOFTWARE_NUM; i++ ){
|
||||
delete m_aLblSWName[i];
|
||||
m_aLblSWName[i] = NULL;
|
||||
|
||||
delete m_aLblSWLink[i];
|
||||
m_aLblSWLink[i] = NULL;
|
||||
}
|
||||
|
||||
if( m_lblCoinPage ){
|
||||
delete m_lblCoinPage;
|
||||
m_lblCoinPage = NULL;
|
||||
}
|
||||
|
||||
if( m_pQRPanelAndroid ){
|
||||
delete m_pQRPanelAndroid;
|
||||
m_pQRPanelAndroid = NULL;
|
||||
}
|
||||
|
||||
if( m_pQRdataAndroid ){
|
||||
delete[] m_pQRdataAndroid;
|
||||
m_pQRdataAndroid = NULL;
|
||||
}
|
||||
|
||||
if( m_pQRPaneliOS ){
|
||||
delete m_pQRPaneliOS;
|
||||
m_pQRPaneliOS = NULL;
|
||||
}
|
||||
|
||||
if( m_pQRdataiOS ){
|
||||
delete[] m_pQRdataiOS;
|
||||
m_pQRdataiOS = NULL;
|
||||
}
|
||||
|
||||
if( m_sbVert )
|
||||
delete m_sbVert;
|
||||
|
||||
while( !m_lstLines.empty() ){
|
||||
delete m_lstLines[0];
|
||||
m_lstLines.erase(m_lstLines.begin());
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void THelpPanel::SetTextFontSize(int sz)
|
||||
{
|
||||
Canvas->Font->Size = sz;
|
||||
|
||||
if( m_lblCoinPage )
|
||||
m_lblCoinPage->Font->Size = sz;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void THelpPanel::InitialVars()
|
||||
{
|
||||
RefreshTextLines();
|
||||
CalcViewArea();
|
||||
Invalidate();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void THelpPanel::ScrollView( int nPos, bool bRedraw )
|
||||
{
|
||||
if( m_nBeginShowRow!=nPos ){
|
||||
m_nBeginShowRow = nPos;
|
||||
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
if( bRedraw ){
|
||||
m_sbVert->SetPosition( nPos );
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void THelpPanel::CalcViewArea()
|
||||
{
|
||||
if( !m_sbVert )
|
||||
return;
|
||||
|
||||
m_nRowNum = m_lstLines.size();
|
||||
|
||||
if( m_nRowNum>0 ){
|
||||
int iFirstRow = m_aFirstRow[m_iMode];
|
||||
if( iFirstRow<0 ){
|
||||
int iFirstTitle = m_aFirstTitle[m_iMode];
|
||||
for( iFirstRow=0; iFirstRow<m_nRowNum && iFirstTitle>0; iFirstRow++ ){
|
||||
if( m_lstLines[iFirstRow]->strText.empty() ){
|
||||
iFirstTitle--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_nBeginShowRow = iFirstRow;
|
||||
}
|
||||
|
||||
if( m_nRowNum>m_nRowShow ){ //显示滚动条
|
||||
m_sbVert->Visible = true;
|
||||
m_sbVert->SetRange( 0, m_nRowNum-1 );
|
||||
m_sbVert->SetPageSize( m_nRowShow );
|
||||
m_sbVert->SetPosition( 0 );
|
||||
|
||||
//计算显示的第一行
|
||||
|
||||
int iRowScroll = 0;
|
||||
if( m_nBeginShowRow>0 ){
|
||||
iRowScroll = min( m_nBeginShowRow, m_nRowNum-m_nRowShow );
|
||||
if( iRowScroll<0 ){
|
||||
iRowScroll = 0;
|
||||
}
|
||||
}
|
||||
|
||||
ScrollView( iRowScroll );
|
||||
}
|
||||
else{
|
||||
m_nBeginShowRow = 0;
|
||||
m_sbVert->Visible = false;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall THelpPanel::Paint()
|
||||
{
|
||||
if( m_iMode<5 && !m_lstLines.empty() ){
|
||||
int xPos = m_nLeftBound,
|
||||
yPos = m_nTopBound;
|
||||
TColor clrOld = Canvas->Font->Color;
|
||||
Canvas->Brush->Style = bsClear;
|
||||
|
||||
int flag = 0;
|
||||
for( int i=0; i<m_lstLines.size(); i++ ){
|
||||
TLineString* pLine = m_lstLines[i];
|
||||
if( pLine->flag>0 && pLine->flag!=flag ){
|
||||
flag = pLine->flag;
|
||||
if( flag==1 ){
|
||||
Canvas->Font->Color = COLOR_QUESTION;
|
||||
|
||||
if( m_iMode<2 )
|
||||
Canvas->Font->Style = TFontStyles()<<fsBold;
|
||||
}
|
||||
else{
|
||||
Canvas->Font->Color = COLOR_ANSWER;
|
||||
Canvas->Font->Style = TFontStyles();
|
||||
}
|
||||
}
|
||||
|
||||
if( i>=m_nBeginShowRow ){
|
||||
char strFlag[10];
|
||||
if( pLine->flag==1 ){
|
||||
if( m_iMode<2 )
|
||||
strcpy( strFlag, "Q:" );
|
||||
else{
|
||||
strcpy( strFlag, "△" );
|
||||
}
|
||||
|
||||
Canvas->TextOut( xPos, yPos, strFlag );
|
||||
}
|
||||
else if( pLine->flag==2 ){
|
||||
if( m_iMode<2 )
|
||||
strcpy( strFlag, "A:" );
|
||||
else{
|
||||
strcpy( strFlag, " " );
|
||||
}
|
||||
|
||||
Canvas->TextOut( xPos, yPos, strFlag );
|
||||
}
|
||||
else if(pLine->flag == 3)
|
||||
{
|
||||
strcpy( strFlag, "●" );
|
||||
Canvas->Font->Color = RGB( 207,169,207 ); //question Color
|
||||
Canvas->Font->Style = TFontStyles() << fsBold;
|
||||
Canvas->TextOut( xPos, yPos, strFlag );
|
||||
//Canvas->Font->Color = RGB(0, 0, 255);
|
||||
}
|
||||
|
||||
Canvas->TextOut( xPos+20, yPos, pLine->strText.c_str() );
|
||||
|
||||
yPos += m_nRowHight;
|
||||
}
|
||||
|
||||
if( i-m_nBeginShowRow >= m_nRowShow ){
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Canvas->Font->Color = clrOld;
|
||||
Canvas->Font->Style = TFontStyles();
|
||||
}
|
||||
|
||||
Canvas->Pen->Color = RGB( 53,56,63 );
|
||||
Canvas->MoveTo( 39 + m_iMode*70 ,0 );
|
||||
Canvas->LineTo( 39 + m_iMode*70 + 78,0 );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall THelpPanel::WMEraseBkgnd(Winapi::Messages::TWMEraseBkgnd &Message)
|
||||
{
|
||||
TCanvas* tempCanvas = new TCanvas;
|
||||
tempCanvas->Handle = Message.DC;
|
||||
TRect rect = GetClientRect();
|
||||
//绘制底图
|
||||
tempCanvas->Brush->Color = RGB( 53,56,63 );
|
||||
tempCanvas->FillRect(rect);
|
||||
|
||||
//绘制外边框
|
||||
tempCanvas->Brush->Color = RGB( 43,47,50 );
|
||||
|
||||
tempCanvas->FrameRect(rect);
|
||||
|
||||
delete tempCanvas;
|
||||
|
||||
Message.Result = true;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall THelpPanel::WMSize(Winapi::Messages::TWMSize &Message)
|
||||
{
|
||||
DefaultHandler( &Message );
|
||||
|
||||
if( m_sbVert ){
|
||||
m_sbVert->Left = Width - m_sbVert->Width - 1;
|
||||
m_sbVert->Top = 1;
|
||||
m_sbVert->Height = Height - 2;
|
||||
}
|
||||
|
||||
m_nRowWidth = Width - m_nLeftBound - m_nRightBound;
|
||||
m_nRowShow = (Height - m_nTopBound - m_nBottomBound) / m_nRowHight;
|
||||
|
||||
SaveFirstRow();
|
||||
for(int i=0; i<MODE_NUM; i++ ){
|
||||
m_aFirstRow[i] = -1; //第一行无效
|
||||
}
|
||||
|
||||
RefreshTextLines();
|
||||
CalcViewArea();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall THelpPanel::WMVScroll(Winapi::Messages::TWMScroll &Message)
|
||||
{
|
||||
int minpos, maxpos, page, curpos;
|
||||
m_sbVert->GetScrollRange(&minpos, &maxpos);
|
||||
page = m_sbVert->GetPageSize();
|
||||
// Get the current position of scroll box.
|
||||
curpos = m_sbVert->GetScrollPos();
|
||||
|
||||
// Determine the new position of scroll box.
|
||||
switch (Message.ScrollCode)
|
||||
{
|
||||
case SB_TOP: // Scroll to far top.
|
||||
curpos = minpos;
|
||||
break;
|
||||
|
||||
case SB_BOTTOM: // Scroll to far bottom.
|
||||
curpos = maxpos-page+1;
|
||||
break;
|
||||
|
||||
case SB_ENDSCROLL: // End scroll.
|
||||
break;
|
||||
|
||||
case SB_LINEUP: // Scroll left.
|
||||
if (curpos > minpos)
|
||||
curpos--;
|
||||
break;
|
||||
|
||||
case SB_LINEDOWN: // Scroll right.
|
||||
if (curpos < maxpos-page+1)
|
||||
curpos++;
|
||||
break;
|
||||
|
||||
case SB_PAGEUP: // Scroll one page left.
|
||||
if (curpos > minpos)
|
||||
curpos = (minpos > curpos-page) ? minpos : curpos-page;
|
||||
//max(minpos, curpos-page);
|
||||
break;
|
||||
|
||||
case SB_PAGEDOWN: // Scroll one page right.
|
||||
if( curpos<maxpos )
|
||||
curpos = (maxpos-page+1 < curpos+page) ? maxpos-page+1 : curpos+page;
|
||||
//min(maxpos-page+1, curpos+page);
|
||||
break;
|
||||
|
||||
case SB_THUMBPOSITION: // Scroll to absolute position. nPos is the position
|
||||
curpos = Message.Pos; // of the scroll box at the end of the drag operation.
|
||||
break;
|
||||
|
||||
case SB_THUMBTRACK: // Drag scroll box to specified position. nPos is the
|
||||
curpos = Message.Pos; // position that the scroll box has been dragged to.
|
||||
break;
|
||||
}
|
||||
|
||||
// Set the new position of the thumb (scroll box).
|
||||
if( Message.ScrollBar!=m_sbVert->Handle )
|
||||
m_sbVert->SetPosition(curpos);
|
||||
|
||||
ScrollView(curpos, FALSE);
|
||||
|
||||
Message.Result = true;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall THelpPanel::WMMouseWheel(TWMMouseWheel &Message)
|
||||
{
|
||||
if( m_sbVert->Visible ){
|
||||
UINT nSBCode;
|
||||
|
||||
if( Message.WheelDelta>0 ) nSBCode = SB_LINEUP;
|
||||
else nSBCode = SB_LINEDOWN;
|
||||
|
||||
Perform( WM_VSCROLL, MAKELONG(nSBCode,0), NULL );
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void THelpPanel::SetMode( int iMode )
|
||||
{
|
||||
if( iMode>4 )
|
||||
return;
|
||||
|
||||
if( m_iMode != iMode ){
|
||||
SaveFirstRow();
|
||||
|
||||
if( iMode==0 || iMode==3){
|
||||
m_nTopBound = 15;
|
||||
}
|
||||
else if( iMode==2 ){
|
||||
m_nTopBound = 60;
|
||||
}
|
||||
else{
|
||||
m_nTopBound = 160;
|
||||
}
|
||||
|
||||
m_nRowShow = (ClientHeight - m_nTopBound - m_nBottomBound) / m_nRowHight;
|
||||
|
||||
m_iMode = iMode;
|
||||
|
||||
RefreshTextLines();
|
||||
CalcViewArea();
|
||||
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
if( m_pQRPanelAndroid )
|
||||
m_pQRPanelAndroid->Visible = m_iMode==4;
|
||||
if( m_pQRPaneliOS )
|
||||
m_pQRPaneliOS->Visible = m_iMode==4;
|
||||
|
||||
for( int i=0; i<SOFTWARE_NUM; i++ ){
|
||||
if( m_aLblSWName[i] )
|
||||
m_aLblSWName[i]->Visible = m_iMode==4;
|
||||
if( m_aLblSWLink[i] )
|
||||
m_aLblSWLink[i]->Visible = m_iMode==4;
|
||||
}
|
||||
|
||||
m_lblCoinPage->Visible = m_iMode==3;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void THelpPanel::RefreshTextLines()
|
||||
{
|
||||
int i;
|
||||
//清空列表
|
||||
for( i=0; i<m_lstLines.size(); i++ ){
|
||||
delete m_lstLines[i];
|
||||
}
|
||||
|
||||
m_lstLines.clear();
|
||||
|
||||
//读取字符串
|
||||
int idUser = g_bLogon ? g_infoUser.accountInfo.ID : 0;
|
||||
int num = 0;
|
||||
|
||||
if( m_iMode==0 )
|
||||
f_CS_GetQnA( num, NULL, false, 0 );
|
||||
else if( m_iMode==1 )
|
||||
f_CS_GetQnA( num, NULL, true, idUser );
|
||||
else if( m_iMode==2 && idUser )
|
||||
f_CS_GetNotice( num, NULL, idUser );
|
||||
else if(m_iMode == 3)
|
||||
ReadData();
|
||||
|
||||
if( num>0 ){
|
||||
TSTRINGPAIR* arrString = new TSTRINGPAIR[num];
|
||||
bool bRevert = true;
|
||||
|
||||
if( m_iMode==0 ){
|
||||
f_CS_GetQnA( num, arrString, false, 0 );
|
||||
bRevert = false;
|
||||
}
|
||||
else if( m_iMode==1 )
|
||||
f_CS_GetQnA( num, arrString, true, idUser );
|
||||
else if( m_iMode==2 )
|
||||
f_CS_GetNotice( num, arrString, idUser );
|
||||
|
||||
for( i=(bRevert?num-1:0); bRevert?i>=0:i<num; bRevert?i--:i++ ){
|
||||
//处理提问
|
||||
wstring strQ = str2wstr( UTF8ToMBCS( arrString[i].str1 ) );
|
||||
TLineString * pLine = new TLineString;
|
||||
pLine->flag = 1; //question
|
||||
int nWidth = 0;
|
||||
int iStart = 0;
|
||||
for(int j=0; j<strQ.size(); j++ ){
|
||||
nWidth += Canvas->TextWidth( strQ[j] );
|
||||
if( nWidth>=m_nRowWidth || strQ[j]=='\n' ){
|
||||
pLine->strText = strQ.substr( iStart, j-iStart );
|
||||
|
||||
if( strQ[j]=='\n' ) j++;
|
||||
|
||||
iStart = j;
|
||||
nWidth = 0;
|
||||
|
||||
m_lstLines.push_back( pLine );
|
||||
|
||||
if( iStart<strQ.size() ){
|
||||
pLine = new TLineString;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( iStart<strQ.size() ){
|
||||
pLine->strText = strQ.substr( iStart, strQ.size()-iStart );
|
||||
m_lstLines.push_back( pLine );
|
||||
}
|
||||
|
||||
wstring strA;
|
||||
if( m_iMode==2 ){
|
||||
AnsiString strSpace= L" ";
|
||||
AnsiString anStr = arrString[i].str2;
|
||||
int pos = 0;
|
||||
while( pos = anStr.Pos( strSpace ) ){
|
||||
anStr.Delete( pos, strSpace.Length() );
|
||||
anStr.Insert( L" ", pos );
|
||||
}
|
||||
strA = str2wstr( UTF8ToMBCS( anStr.c_str() ) );
|
||||
}
|
||||
else{
|
||||
strA = str2wstr( UTF8ToMBCS( arrString[i].str2 ) );
|
||||
}
|
||||
|
||||
pLine = new TLineString;
|
||||
pLine->flag = 2; //answer
|
||||
if( strA.size()>0 ){
|
||||
nWidth = 0;
|
||||
iStart = 0;
|
||||
for(int j=0; j<strA.size(); j++ ){
|
||||
nWidth += Canvas->TextWidth( strA[j] );
|
||||
if( nWidth>=m_nRowWidth || strA[j]=='\n' ){
|
||||
pLine->strText = strA.substr( iStart, j-iStart );
|
||||
|
||||
if( strA[j]=='\n' ) j++;
|
||||
|
||||
iStart = j;
|
||||
nWidth = 0;
|
||||
|
||||
m_lstLines.push_back( pLine );
|
||||
|
||||
if( iStart<strA.size() ){
|
||||
pLine = new TLineString;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( iStart<strA.size() ){
|
||||
pLine->strText = strA.substr( iStart, strA.size()-iStart );
|
||||
m_lstLines.push_back( pLine );
|
||||
}
|
||||
}
|
||||
else{
|
||||
if( m_iMode==2 ){
|
||||
pLine->strText = L"无";
|
||||
}
|
||||
else{
|
||||
pLine->strText = L"暂时还没有答复";
|
||||
}
|
||||
m_lstLines.push_back( pLine );
|
||||
}
|
||||
|
||||
if( bRevert ? i>0 : i<num-1 ){ //break
|
||||
pLine = new TLineString;
|
||||
m_lstLines.push_back( pLine );
|
||||
}
|
||||
}
|
||||
|
||||
delete[] arrString;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void THelpPanel::AddFeedback( wstring str )
|
||||
{
|
||||
RefreshTextLines();
|
||||
m_nBeginShowRow = 0;
|
||||
CalcViewArea();
|
||||
Invalidate();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void THelpPanel::SaveFirstRow()
|
||||
{
|
||||
int iFirstRow = m_nBeginShowRow;
|
||||
int iFirstTitle = 0;
|
||||
|
||||
for( int i=0; i<m_lstLines.size() && i<=iFirstRow; i++ ){
|
||||
if( m_lstLines[i]->strText.empty() ){
|
||||
iFirstTitle++;
|
||||
}
|
||||
}
|
||||
|
||||
m_aFirstRow[m_iMode] = iFirstRow;
|
||||
m_aFirstTitle[m_iMode] = iFirstTitle;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void THelpPanel::ReadData()
|
||||
{
|
||||
String str = L"@说明:\n 唱作音符是唱作网的虚拟货币,在唱作魔方软件使用中会\
|
||||
用到唱作音符。\n@获取途径:\n 唱作音符主要来源于直接充值兑换,在唱作网的\
|
||||
活动中也可获取。\n 另外,注册用户时也会赠予一定音符。\n";
|
||||
//String(m_CharBuf);
|
||||
|
||||
wchar_t *data = str.c_str();
|
||||
|
||||
TLineString *pLine = new TLineString;
|
||||
|
||||
int nWidth = 0;
|
||||
int iStart = 0;
|
||||
|
||||
for(int i = 0; i < str.Length(); i++)
|
||||
{
|
||||
nWidth += Canvas->TextWidth(String(data[i]));
|
||||
|
||||
if( nWidth >= m_nRowWidth || data[i] == '\n' ){
|
||||
if(data[iStart] == L'@'){
|
||||
pLine->strText = (str.SubString(iStart + 2, i - iStart + 1)).c_str();
|
||||
pLine->flag = 3;
|
||||
}
|
||||
else{
|
||||
pLine->flag = 4;
|
||||
pLine->strText = (str.SubString(iStart + 1, i - iStart + 1)).c_str();
|
||||
}
|
||||
|
||||
|
||||
if(data[i] == '\n'){
|
||||
i++;
|
||||
}
|
||||
|
||||
iStart = i;
|
||||
|
||||
nWidth = 0;
|
||||
m_lstLines.push_back(pLine);
|
||||
pLine = new TLineString;
|
||||
}
|
||||
}
|
||||
|
||||
pLine->strText = (str.SubString(iStart, str.Length() - iStart + 1)).c_str();
|
||||
pLine->flag = 4;
|
||||
m_lstLines.push_back(pLine);
|
||||
|
||||
m_lblCoinPage->Top = m_nTopBound + ( m_lstLines.size() + 1 ) * m_nRowHight;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
bool THelpPanel::HasScrollBar()
|
||||
{
|
||||
return m_sbVert?m_sbVert->Visible:0;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall THelpPanel::LinkClick(TObject *Sender)
|
||||
{
|
||||
char strURL[256];
|
||||
|
||||
if( m_iMode==4 ){
|
||||
char strPage[256], os[16];
|
||||
f_CS_GetWebPageURL( URL_SOFTWARE, strPage );
|
||||
|
||||
TLabel* pLabel = (TLabel*)Sender;
|
||||
switch( pLabel->Tag ){
|
||||
case 0:
|
||||
strcpy( os, "pc" );
|
||||
break;
|
||||
case 1:
|
||||
strcpy( os, "android" );
|
||||
break;
|
||||
case 2:
|
||||
strcpy( os, "ios" );
|
||||
break;
|
||||
}
|
||||
|
||||
sprintf( strURL, "%s?id=2&os=%s", strPage, os );
|
||||
}
|
||||
else if( m_iMode==3 ){
|
||||
f_CS_GetWebPageURL( URL_COINSPEC, strURL );
|
||||
}
|
||||
|
||||
ShellExecute(Handle, NULL, ((String)strURL).c_str(), NULL, NULL, SW_SHOWNORMAL);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall THelpPanel::LinkMouseEnter(TObject *Sender)
|
||||
{
|
||||
((TLabel*)Sender)->Font->Color = clrEnter;
|
||||
Screen->Cursor = crHandPoint;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall THelpPanel::LinkMouseLeave(TObject *Sender)
|
||||
{
|
||||
((TLabel*)Sender)->Font->Color = clrLeave;
|
||||
Screen->Cursor = crDefault;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef HelpPanelUnitH
|
||||
#define HelpPanelUnitH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl.h>
|
||||
|
||||
#include <vector>
|
||||
//------------------------
|
||||
#include "SkinScrollBarUnit.h"
|
||||
#include <Vcl.Imaging.pngimage.hpp>
|
||||
#include "QRcodePanel.h"
|
||||
|
||||
#define MODE_NUM 6
|
||||
#define SOFTWARE_NUM 3
|
||||
#define COLOR_BORDER RGB(164,115,70)
|
||||
#define COLOR_QUESTION RGB( 207,169,207 )
|
||||
#define COLOR_ANSWER RGB( 249,246,229 )
|
||||
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
|
||||
typedef struct{
|
||||
wstring str1;
|
||||
wstring str2;
|
||||
} TWSPAIR;
|
||||
|
||||
typedef vector< TWSPAIR* > TWSPAIRLIST;
|
||||
|
||||
typedef struct tagLineString{
|
||||
int flag;
|
||||
wstring strText;
|
||||
|
||||
tagLineString(){
|
||||
flag = 0;
|
||||
}
|
||||
} TLineString;
|
||||
|
||||
typedef vector< TLineString* > TTEXTLINE;
|
||||
//--------
|
||||
|
||||
class THelpPanel : public Extctrls::TPanel
|
||||
{
|
||||
|
||||
private:
|
||||
TQRcodePanel *m_pQRPanelAndroid, *m_pQRPaneliOS;
|
||||
unsigned char *m_pQRdataAndroid, *m_pQRdataiOS;
|
||||
TLabel *m_aLblSWName[SOFTWARE_NUM],
|
||||
*m_aLblSWLink[SOFTWARE_NUM],
|
||||
*m_lblCoinPage;
|
||||
|
||||
TTEXTLINE m_lstLines;
|
||||
|
||||
int m_iMode; //显示模式 0=常见问题,1=我要提问,2=网站公告,3=空间消息
|
||||
int m_iLastMode; //上次显示模式
|
||||
|
||||
// char m_CharBuf[2048];
|
||||
|
||||
void CalcViewArea();
|
||||
void ReadData();
|
||||
|
||||
void __fastcall LinkClick(TObject *Sender);
|
||||
void __fastcall LinkMouseEnter(TObject *Sender);
|
||||
void __fastcall LinkMouseLeave(TObject *Sender);
|
||||
|
||||
MESSAGE void __fastcall WMEraseBkgnd(Winapi::Messages::TWMEraseBkgnd &Message);
|
||||
MESSAGE void __fastcall WMSize(Winapi::Messages::TWMSize &Message);
|
||||
MESSAGE void __fastcall WMVScroll(Winapi::Messages::TWMScroll &Message);
|
||||
MESSAGE void __fastcall WMMouseWheel(TWMMouseWheel &Message);
|
||||
|
||||
BEGIN_MESSAGE_MAP
|
||||
MESSAGE_HANDLER(WM_ERASEBKGND, TWMEraseBkgnd, WMEraseBkgnd)
|
||||
MESSAGE_HANDLER(WM_SIZE, TWMSize, WMSize)
|
||||
MESSAGE_HANDLER(WM_VSCROLL, TWMVScroll, WMVScroll)
|
||||
MESSAGE_HANDLER(WM_MOUSEWHEEL, TWMMouseWheel, WMMouseWheel)
|
||||
END_MESSAGE_MAP(Vcl::Extctrls::TPanel)
|
||||
|
||||
//protected:
|
||||
//显示相关
|
||||
int m_nRowShow,
|
||||
m_nBeginShowRow,
|
||||
m_nRowNum,
|
||||
|
||||
m_nPosFlag,
|
||||
m_nPosText,
|
||||
|
||||
/* m_iFirstRowMode0,
|
||||
m_iFirstRowMode1,
|
||||
m_iFirstQAMode0,
|
||||
m_iFirstQAMode1,
|
||||
*/
|
||||
m_aFirstRow[MODE_NUM],
|
||||
m_aFirstTitle[MODE_NUM],
|
||||
|
||||
m_nRowWidth,
|
||||
m_nRowHight,
|
||||
|
||||
m_nLeftBound,
|
||||
m_nRightBound,
|
||||
m_nTopBound,
|
||||
m_nBottomBound;
|
||||
|
||||
TSkinScrollBar *m_sbVert;
|
||||
// TMemo* m_memoMsg;
|
||||
|
||||
virtual void __fastcall CreateWnd();
|
||||
virtual void __fastcall Paint(void);
|
||||
|
||||
void RefreshTextLines();
|
||||
|
||||
public:
|
||||
void ScrollView( int nPos, bool bRedraw=true );
|
||||
void SetMode( int iMode );
|
||||
void AddFeedback( wstring str );
|
||||
void SaveFirstRow();
|
||||
void InitialVars();
|
||||
bool HasScrollBar();
|
||||
void SetTextFontSize(int sz);
|
||||
|
||||
__fastcall virtual THelpPanel(System::Classes::TComponent* AOwner);
|
||||
__fastcall ~THelpPanel();
|
||||
};
|
||||
#endif
|
||||
@@ -0,0 +1,379 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include <IdHTTP.hpp>
|
||||
#include "GlobalUnit.h"
|
||||
#include "ImgCopperExUnit.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
bool GetPicType(String &name, TMemoryStream *tmpMemoryStream, bool bBac)
|
||||
{
|
||||
bool bReturn = true;
|
||||
|
||||
tmpMemoryStream->Position = 0;
|
||||
WORD wType = 0;
|
||||
tmpMemoryStream->ReadBuffer(&wType, 2);
|
||||
|
||||
String tmpName = name;
|
||||
|
||||
if( wType==0x4D42 ){ //bmp
|
||||
|
||||
if( bBac )
|
||||
name = ChangeFileExt(name, L".bmp");
|
||||
|
||||
}else if( wType==0x5089 ){ //png
|
||||
|
||||
if( bBac )
|
||||
name = ChangeFileExt(name, L".png");
|
||||
|
||||
}else if( wType==0xD8FF ) { //jpg
|
||||
|
||||
if( bBac )
|
||||
name = ChangeFileExt(name, L".jpg");
|
||||
|
||||
}else bReturn = false;
|
||||
|
||||
if( bReturn && bBac )
|
||||
CopyFile(tmpName.c_str(), name.c_str(), false);
|
||||
|
||||
return bReturn;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
VCBMPEDGE g_VCBMPEDGE;
|
||||
TBitmap* resizableImage(TBitmap *imgDest, TRect rectDest,
|
||||
int tagSrc, String resourceNameSrc,
|
||||
UIEdgeInsets insetsSrc,
|
||||
System::Uitypes::TColor TransparentColor)
|
||||
{
|
||||
// ------judge the image is handled
|
||||
bool bFindBMPEDGE = false;
|
||||
BMPEDGE *pBMPEDGE = NULL;
|
||||
for( VCBMPEDGE::iterator vc_pFindVCBMPEDGE = g_VCBMPEDGE.begin();
|
||||
vc_pFindVCBMPEDGE != g_VCBMPEDGE.end();
|
||||
vc_pFindVCBMPEDGE++ )
|
||||
{
|
||||
if( tagSrc==(*vc_pFindVCBMPEDGE)->iTag ) {
|
||||
|
||||
pBMPEDGE = *vc_pFindVCBMPEDGE;
|
||||
bFindBMPEDGE = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// ------l r t b cl cr ct cb c cn get bitmap
|
||||
if( NULL==pBMPEDGE ) {
|
||||
|
||||
pBMPEDGE = new BMPEDGE(tagSrc, resourceNameSrc);
|
||||
pBMPEDGE->pImgLeftT = new TBitmap();
|
||||
pBMPEDGE->pImgLeftB = new TBitmap();
|
||||
pBMPEDGE->pImgRightT = new TBitmap();
|
||||
pBMPEDGE->pImgRightB = new TBitmap();
|
||||
pBMPEDGE->pImgCenterL = new TBitmap();
|
||||
pBMPEDGE->pImgCenterR = new TBitmap();
|
||||
pBMPEDGE->pImgCenterT = new TBitmap();
|
||||
pBMPEDGE->pImgCenterB = new TBitmap();
|
||||
pBMPEDGE->pImgCenter = new TBitmap();
|
||||
|
||||
pBMPEDGE->pImgBMPSrc = new TBitmap();
|
||||
pBMPEDGE->pImgBMPSrc->LoadFromResourceName(int(HInstance), resourceNameSrc);
|
||||
}
|
||||
TBitmap *imgSrc = pBMPEDGE->pImgBMPSrc;
|
||||
|
||||
// ------ l r t b cl cr ct cb c cn rect
|
||||
int iLeft, iTop, iWidth, iHeight;
|
||||
int iLeftNew, iTopNew, iWidthNew, iHeightNew;
|
||||
|
||||
iLeft = 0;
|
||||
iTop = 0;
|
||||
iWidth = imgSrc->Width;
|
||||
iHeight = imgSrc->Height;
|
||||
TRect rectSrc = TRect(0, 0, iWidth, iHeight);
|
||||
|
||||
iLeftNew = 0;
|
||||
iTopNew = 0;
|
||||
iWidthNew = rectDest.Width();
|
||||
iHeightNew = rectDest.Height();
|
||||
|
||||
|
||||
UIEdgeInsets insets;
|
||||
if( !bFindBMPEDGE ) {
|
||||
|
||||
pBMPEDGE->insetsDest.left = insetsSrc.left;
|
||||
pBMPEDGE->insetsDest.right = insetsSrc.right;
|
||||
pBMPEDGE->insetsDest.top = insetsSrc.top;
|
||||
pBMPEDGE->insetsDest.bottom = insetsSrc.bottom;
|
||||
insets = insetsSrc;
|
||||
|
||||
}else{
|
||||
|
||||
insets = pBMPEDGE->insetsDest;
|
||||
}
|
||||
int LEFTT_WIDTH = insets.left;
|
||||
int LEFTT_HEIGHT = insets.top;
|
||||
int LEFTB_WIDTH = insets.left;
|
||||
int LEFTB_HEIGHT = insets.bottom;
|
||||
int RIGHTT_WIDTH = insets.right;
|
||||
int RIGHTT_HEIGHT = insets.top;
|
||||
int RIGHTB_WIDTH = insets.right;
|
||||
int RIGHTB_HEIGHT = insets.bottom;
|
||||
|
||||
int CENTERL_WIDTH = insets.left;
|
||||
int CENTERL_HEIGHT = rectSrc.Height() - (LEFTT_HEIGHT+LEFTB_HEIGHT);
|
||||
int CENTERR_WIDTH = insets.right;
|
||||
int CENTERR_HEIGHT = iHeight - (RIGHTT_HEIGHT+RIGHTB_HEIGHT);
|
||||
int CENTERT_WIDTH = iWidth - (LEFTT_WIDTH+RIGHTT_WIDTH);
|
||||
int CENTERT_HEIGHT = insets.top;
|
||||
int CENTERB_WIDTH = iWidth - (LEFTB_WIDTH+RIGHTB_WIDTH);
|
||||
int CENTERB_HEIGHT = insets.bottom;
|
||||
|
||||
int CENTER_WIDTH = CENTERT_WIDTH;
|
||||
int CENTER_HEIGHT = iHeight - (CENTERT_HEIGHT+CENTERB_HEIGHT);
|
||||
|
||||
int CENTERL_NEW_WIDTH = insets.left;
|
||||
int CENTERL_NEW_HEIGHT = iHeightNew - (LEFTT_HEIGHT+LEFTB_HEIGHT);
|
||||
int CENTERR_NEW_WIDTH = insets.right;
|
||||
int CENTERR_NEW_HEIGHT = CENTERL_NEW_HEIGHT;
|
||||
int CENTERT_NEW_WIDTH = iWidthNew - (LEFTT_WIDTH+RIGHTT_WIDTH);
|
||||
int CENTERT_NEW_HEIGHT = insets.top;
|
||||
int CENTERB_NEW_WIDTH = CENTERT_NEW_WIDTH;
|
||||
int CENTERB_NEW_HEIGHT = insets.bottom;
|
||||
|
||||
int CENTER_NEW_WIDTH = CENTERT_NEW_WIDTH;
|
||||
int CENTER_NEW_HEIGHT = CENTERL_NEW_HEIGHT;
|
||||
|
||||
// ------ size transparent
|
||||
TBitmap *pImgLeftT = pBMPEDGE->pImgLeftT;
|
||||
TBitmap *pImgLeftB = pBMPEDGE->pImgLeftB;
|
||||
TBitmap *pImgRightT = pBMPEDGE->pImgRightT;
|
||||
TBitmap *pImgRightB = pBMPEDGE->pImgRightB;
|
||||
TBitmap *pImgCenterL = pBMPEDGE->pImgCenterL;
|
||||
TBitmap *pImgCenterR = pBMPEDGE->pImgCenterR;
|
||||
TBitmap *pImgCenterT = pBMPEDGE->pImgCenterT;
|
||||
TBitmap *pImgCenterB = pBMPEDGE->pImgCenterB;
|
||||
TBitmap *pImgCenter = pBMPEDGE->pImgCenter;
|
||||
|
||||
if( !bFindBMPEDGE ) {
|
||||
|
||||
pImgLeftT->SetSize( LEFTT_WIDTH, LEFTT_HEIGHT );
|
||||
pImgLeftB->SetSize( LEFTB_WIDTH, LEFTB_HEIGHT );
|
||||
pImgRightT->SetSize( RIGHTT_WIDTH, RIGHTT_HEIGHT );
|
||||
pImgRightB->SetSize( RIGHTB_WIDTH, RIGHTB_HEIGHT );
|
||||
pImgCenterL->SetSize( CENTERL_WIDTH, CENTERL_HEIGHT);
|
||||
pImgCenterR->SetSize( CENTERR_WIDTH, CENTERR_HEIGHT);
|
||||
pImgCenterT->SetSize( CENTERT_WIDTH, CENTERT_HEIGHT);
|
||||
pImgCenterB->SetSize( CENTERB_WIDTH, CENTERB_HEIGHT);
|
||||
pImgCenter->SetSize( CENTER_WIDTH, CENTER_HEIGHT );
|
||||
|
||||
pBMPEDGE->SetTransparent(TransparentColor);
|
||||
}
|
||||
|
||||
if( NULL==imgDest ) {
|
||||
imgDest = new TBitmap();
|
||||
imgDest->SetSize(iWidthNew, iHeightNew);
|
||||
}
|
||||
imgDest->Transparent = true;
|
||||
imgDest->TransparentColor = clWhite;
|
||||
|
||||
|
||||
// ------new bitmap
|
||||
if( !bFindBMPEDGE ) {
|
||||
// -----
|
||||
StretchBlt(pImgLeftT->Canvas->Handle, 0, 0, LEFTT_WIDTH, LEFTT_HEIGHT,
|
||||
imgSrc->Canvas->Handle, 0, 0, LEFTT_WIDTH, LEFTT_HEIGHT,
|
||||
SRCCOPY);
|
||||
StretchBlt(pImgLeftB->Canvas->Handle, 0, 0, LEFTB_WIDTH, LEFTB_HEIGHT,
|
||||
imgSrc->Canvas->Handle, 0, iHeight-LEFTB_HEIGHT, LEFTB_WIDTH, LEFTB_HEIGHT,
|
||||
SRCCOPY);
|
||||
StretchBlt(pImgRightT->Canvas->Handle, 0, 0, RIGHTT_WIDTH, RIGHTT_HEIGHT,
|
||||
imgSrc->Canvas->Handle, iWidth-RIGHTT_WIDTH, 0, RIGHTT_WIDTH, RIGHTT_HEIGHT,
|
||||
SRCCOPY);
|
||||
StretchBlt(pImgRightB->Canvas->Handle, 0, 0, RIGHTB_WIDTH, RIGHTB_HEIGHT,
|
||||
imgSrc->Canvas->Handle, iWidth-RIGHTB_WIDTH, iHeight-RIGHTB_HEIGHT, RIGHTB_WIDTH, RIGHTB_HEIGHT,
|
||||
SRCCOPY);
|
||||
|
||||
StretchBlt(pImgCenterL->Canvas->Handle, 0, 0, CENTERL_WIDTH, CENTERL_HEIGHT,
|
||||
imgSrc->Canvas->Handle, 0, LEFTT_HEIGHT, CENTERL_WIDTH, CENTERL_HEIGHT,
|
||||
SRCCOPY);
|
||||
StretchBlt(pImgCenterR->Canvas->Handle, 0, 0, CENTERR_WIDTH, CENTERR_HEIGHT,
|
||||
imgSrc->Canvas->Handle, iWidth-RIGHTT_WIDTH, RIGHTT_HEIGHT, CENTERR_WIDTH, CENTERR_HEIGHT,
|
||||
SRCCOPY);
|
||||
StretchBlt(pImgCenterT->Canvas->Handle, 0, 0, CENTERT_WIDTH, CENTERT_HEIGHT,
|
||||
imgSrc->Canvas->Handle, LEFTT_WIDTH, 0, CENTERT_WIDTH, CENTERT_HEIGHT,
|
||||
SRCCOPY);
|
||||
StretchBlt(pImgCenterB->Canvas->Handle, 0, 0, CENTERB_WIDTH, CENTERB_HEIGHT,
|
||||
imgSrc->Canvas->Handle, LEFTB_WIDTH, iHeight-LEFTB_HEIGHT, CENTERB_WIDTH, CENTERB_HEIGHT,
|
||||
SRCCOPY);
|
||||
|
||||
StretchBlt(pImgCenter->Canvas->Handle, 0, 0, CENTER_WIDTH, CENTER_HEIGHT,
|
||||
imgSrc->Canvas->Handle, LEFTT_WIDTH, LEFTT_HEIGHT, CENTER_WIDTH, CENTER_HEIGHT,
|
||||
SRCCOPY);
|
||||
}
|
||||
|
||||
// -----
|
||||
StretchBlt(imgDest->Canvas->Handle, 0, 0, LEFTT_WIDTH, LEFTT_HEIGHT,
|
||||
pImgLeftT->Canvas->Handle, 0, 0, LEFTT_WIDTH, LEFTT_HEIGHT,
|
||||
SRCCOPY);
|
||||
StretchBlt(imgDest->Canvas->Handle, 0, iHeightNew-LEFTB_HEIGHT, LEFTB_WIDTH, LEFTB_HEIGHT,
|
||||
pImgLeftB->Canvas->Handle, 0, 0, LEFTB_WIDTH, LEFTB_HEIGHT,
|
||||
SRCCOPY);
|
||||
StretchBlt(imgDest->Canvas->Handle, iWidthNew-RIGHTT_WIDTH, 0, RIGHTT_WIDTH, RIGHTT_HEIGHT,
|
||||
pImgRightT->Canvas->Handle, 0, 0, RIGHTT_WIDTH, RIGHTT_HEIGHT,
|
||||
SRCCOPY);
|
||||
StretchBlt(imgDest->Canvas->Handle, iWidthNew-RIGHTB_WIDTH, iHeightNew-RIGHTB_HEIGHT, RIGHTB_WIDTH, RIGHTB_HEIGHT,
|
||||
pImgRightB->Canvas->Handle, 0, 0, RIGHTB_WIDTH, RIGHTB_HEIGHT,
|
||||
SRCCOPY);
|
||||
|
||||
StretchBlt(imgDest->Canvas->Handle, 0, LEFTT_HEIGHT, CENTERL_NEW_WIDTH, CENTERL_NEW_HEIGHT,
|
||||
pImgCenterL->Canvas->Handle,0, 0, CENTERL_WIDTH, CENTERL_HEIGHT,
|
||||
SRCCOPY);
|
||||
StretchBlt(imgDest->Canvas->Handle, iWidthNew-RIGHTT_WIDTH, RIGHTT_HEIGHT, CENTERR_NEW_WIDTH, CENTERR_NEW_HEIGHT,
|
||||
pImgCenterR->Canvas->Handle,0, 0, CENTERR_WIDTH, CENTERR_HEIGHT,
|
||||
SRCCOPY);
|
||||
StretchBlt(imgDest->Canvas->Handle, LEFTT_WIDTH, 0, CENTERT_NEW_WIDTH, CENTERT_NEW_HEIGHT,
|
||||
pImgCenterT->Canvas->Handle,0, 0, CENTERT_WIDTH, CENTERT_HEIGHT,
|
||||
SRCCOPY);
|
||||
StretchBlt(imgDest->Canvas->Handle, LEFTT_WIDTH, iHeightNew-LEFTB_HEIGHT, CENTERB_NEW_WIDTH, CENTERB_NEW_HEIGHT,
|
||||
pImgCenterB->Canvas->Handle,0, 0, CENTERB_WIDTH, CENTERB_HEIGHT,
|
||||
SRCCOPY);
|
||||
StretchBlt(imgDest->Canvas->Handle, LEFTT_WIDTH, LEFTT_HEIGHT, CENTER_NEW_WIDTH, CENTER_NEW_HEIGHT,
|
||||
pImgCenter->Canvas->Handle, 0, 0, CENTER_WIDTH, CENTER_HEIGHT,
|
||||
SRCCOPY);
|
||||
|
||||
if( !bFindBMPEDGE ) {
|
||||
g_VCBMPEDGE.push_back(pBMPEDGE);
|
||||
}
|
||||
|
||||
return imgDest;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
TThreadMusciCover *g_pTThreadMusciCover = NULL;
|
||||
__fastcall TThreadMusciCover::TThreadMusciCover(bool CreateSuspended, TForm *Form)
|
||||
: TThread(CreateSuspended)
|
||||
{
|
||||
m_pForm = Form;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TThreadMusciCover::Execute()
|
||||
{
|
||||
TStringStream *strStream = new TStringStream(NULL, 65001);
|
||||
|
||||
String strUrl = g_strServerURL;
|
||||
strUrl += L"/index.php/Client/getUserMusicCover/userId/";
|
||||
strUrl += IntToStr(g_infoUser.accountInfo.ID);
|
||||
|
||||
String dir = MUSIC_COVER_DIR;
|
||||
String file = L"tmp";
|
||||
HRESULT result = GetUrlData(strUrl, dir, file, strStream, true, UrlDown_ImageCover);
|
||||
strUrl = strStream->DataString;
|
||||
delete strStream;
|
||||
|
||||
if( !(result==S_OK && strUrl.Length() > 1) ){
|
||||
return;
|
||||
}
|
||||
|
||||
file = MUSIC_COVER_FILE;
|
||||
if( S_OK==GetUrlData(strUrl, dir, file, NULL, false, UrlDown_ImageCover) ) {
|
||||
PostMessage(m_pForm->Handle, UM_MUSICCOVER, 0, 0 );
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
TThreadHttpPostUsrIcon *g_pTThreadHttpPostUsrIcon = NULL;
|
||||
__fastcall TThreadHttpPostUsrIcon::TThreadHttpPostUsrIcon(bool CreateSuspended, TWinControl *pWnCtrl, String strPath)
|
||||
: TThread(CreateSuspended)
|
||||
{
|
||||
m_pWnCtrl = pWnCtrl;
|
||||
m_strPath = strPath;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TThreadHttpPostUsrIcon::Execute()
|
||||
{
|
||||
String strFileName = L"";
|
||||
bool bSucess = true;
|
||||
|
||||
String strUrl = g_strServerURL;
|
||||
strUrl += L"/index.php/Client/uploadUserPortrait";
|
||||
String struserId = IntToStr(g_infoUser.accountInfo.ID);
|
||||
String strusername = g_infoUser.strUserName;
|
||||
String strpassword = g_infoUser.strPassword;
|
||||
String strCopperPath = m_strPath;
|
||||
|
||||
TIdMultiPartFormDataStream *stream = new TIdMultiPartFormDataStream();
|
||||
stream->AddFormField(L"userId", struserId);
|
||||
stream->AddFormField(L"username", strusername, L"UTF-8")->ContentTransfer = L"8bit";
|
||||
stream->AddFormField(L"password", strpassword, L"UTF-8")->ContentTransfer = L"8bit";
|
||||
stream->AddFile(L"Filedata", strCopperPath, L"image/jpg");
|
||||
|
||||
|
||||
String strResJson;
|
||||
TIdHTTP *httpPost = NULL;
|
||||
try{
|
||||
|
||||
httpPost = new TIdHTTP();
|
||||
httpPost->Request->ContentType = L"multipart/form-data;";
|
||||
strResJson = httpPost->Post(strUrl, stream);
|
||||
|
||||
}catch(Exception &e) {
|
||||
|
||||
SAFE_DELETE(httpPost);
|
||||
SAFE_DELETE(stream);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
TJSONObject *jsonOri = NULL;
|
||||
int nState = -1;
|
||||
try
|
||||
{
|
||||
jsonOri = GetJsonContext(strResJson);
|
||||
if( jsonOri!=NULL ) {
|
||||
|
||||
TJSONObject *ValueState = GetJsonValue(jsonOri, 0);
|
||||
if( ValueState!=NULL ) {
|
||||
|
||||
nState = StrToInt(ValueState->Value());
|
||||
if( 1==nState ) {
|
||||
|
||||
TJSONObject *ValueFileName = GetJsonValue(jsonOri, 1);
|
||||
if( ValueFileName!=NULL )
|
||||
strFileName = ValueFileName->Value();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SAFE_DELETE(jsonOri);
|
||||
|
||||
}catch(Exception &e){
|
||||
|
||||
SAFE_DELETE(jsonOri);
|
||||
SAFE_DELETE(httpPost);
|
||||
SAFE_DELETE(stream);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
SAFE_DELETE(httpPost);
|
||||
SAFE_DELETE(stream);
|
||||
|
||||
m_strFileName = strFileName;
|
||||
|
||||
// PostMessage(m_pWnCtrl->Handle, UM_UPLOADUSRICON, 0, 0 );
|
||||
|
||||
if( m_strFileName.Length() ) {
|
||||
|
||||
String strHeaderPath = g_strUserPath.c_str();
|
||||
strHeaderPath += L"header\\";
|
||||
strHeaderPath += strFileName;
|
||||
|
||||
CopyFile(strCopperPath.c_str(), strHeaderPath.c_str(), true);
|
||||
DeleteFile(strCopperPath);
|
||||
strcpy(g_infoUser.strIconFile, wstr2str(strFileName.c_str()).c_str());
|
||||
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
@@ -0,0 +1,126 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#ifndef ImgCopperExUnitH
|
||||
#define ImgCopperExUnitH
|
||||
#include "NotificationExUnit.h"
|
||||
|
||||
#define SAFE_DELETE(p) { if(p) { delete (p); (p)=NULL; } }
|
||||
#define MUSIC_COVER_DIR L"MusicCover\\"
|
||||
#define MUSIC_COVER_FILE L"MusicCover"
|
||||
#define MUSIC_COVER_COPPER L"MusicCoverCopper.jpg"
|
||||
//---------------------------------------------------------------------------
|
||||
bool GetPicType(String &name, TMemoryStream *tmpMemoryStream, bool bBac);
|
||||
//---------------------------------------------------------------------------
|
||||
typedef struct UIEdgeInsets {
|
||||
|
||||
int left, right, top, bottom;
|
||||
|
||||
UIEdgeInsets(int ileft, int iright, int itop, int ibottom) {
|
||||
|
||||
left = ileft;
|
||||
right = iright;
|
||||
top = itop;
|
||||
bottom = ibottom;
|
||||
}
|
||||
|
||||
UIEdgeInsets(){
|
||||
left = -1;
|
||||
right = -1;
|
||||
top = -1;
|
||||
bottom = -1;
|
||||
}
|
||||
|
||||
} UIEdgeInsets;
|
||||
|
||||
typedef struct tagUIEdgeInsetsBMP{
|
||||
|
||||
TBitmap *pImgLeftT,*pImgLeftB,*pImgRightT,*pImgRightB;
|
||||
|
||||
TBitmap *pImgCenterL, *pImgCenterR, *pImgCenterT, *pImgCenterB, *pImgCenter;
|
||||
|
||||
TBitmap *pImgBMPSrc;
|
||||
|
||||
UIEdgeInsets insetsDest;
|
||||
int iTag;
|
||||
String strResourceName;
|
||||
|
||||
tagUIEdgeInsetsBMP(int tag, String resourceName) {
|
||||
|
||||
iTag = tag;
|
||||
strResourceName = resourceName;
|
||||
pImgLeftT = pImgLeftB = pImgRightT = pImgRightB = NULL;
|
||||
pImgCenterL = pImgCenterR = pImgCenterT = pImgCenterB = pImgCenter = NULL;
|
||||
pImgBMPSrc = NULL;
|
||||
}
|
||||
|
||||
~tagUIEdgeInsetsBMP() {
|
||||
|
||||
SAFE_DELETE(pImgLeftT)
|
||||
SAFE_DELETE(pImgLeftB)
|
||||
SAFE_DELETE(pImgRightT)
|
||||
SAFE_DELETE(pImgRightB)
|
||||
|
||||
SAFE_DELETE(pImgCenterL)
|
||||
SAFE_DELETE(pImgCenterR)
|
||||
SAFE_DELETE(pImgCenterT)
|
||||
SAFE_DELETE(pImgCenterB)
|
||||
SAFE_DELETE(pImgCenter)
|
||||
|
||||
SAFE_DELETE(pImgBMPSrc)
|
||||
}
|
||||
|
||||
void SetTransparent(System::Uitypes::TColor TransparentColor) {
|
||||
|
||||
pImgLeftT->Transparent = true;
|
||||
pImgLeftT->TransparentColor = TransparentColor;
|
||||
pImgLeftB->Transparent = true;
|
||||
pImgLeftB->TransparentColor = TransparentColor;
|
||||
pImgRightT->Transparent = true;
|
||||
pImgRightT->TransparentColor = TransparentColor;
|
||||
pImgRightB->Transparent = true;
|
||||
pImgRightB->TransparentColor = TransparentColor;
|
||||
pImgCenterL->Transparent = true;
|
||||
pImgCenterL->TransparentColor = TransparentColor;
|
||||
pImgCenterR->Transparent = true;
|
||||
pImgCenterR->TransparentColor = TransparentColor;
|
||||
pImgCenterT->Transparent = true;
|
||||
pImgCenterT->TransparentColor = TransparentColor;
|
||||
pImgCenterB->Transparent = true;
|
||||
pImgCenterB->TransparentColor = TransparentColor;
|
||||
pImgCenter->Transparent = true;
|
||||
pImgCenter->TransparentColor = TransparentColor;
|
||||
}
|
||||
|
||||
}BMPEDGE;
|
||||
typedef vector<BMPEDGE*> VCBMPEDGE;
|
||||
TBitmap* resizableImage(TBitmap *imgDest, TRect rectDest,
|
||||
int tagSrc, String resourceNameSrc,
|
||||
UIEdgeInsets insetsSrc,
|
||||
System::Uitypes::TColor TransparentColor=clWhite);
|
||||
//---------------------------------------------------------------------------
|
||||
class TThreadMusciCover : public TThread
|
||||
{
|
||||
private:
|
||||
TForm *m_pForm;
|
||||
protected:
|
||||
void __fastcall Execute();
|
||||
public:
|
||||
__fastcall TThreadMusciCover(bool CreateSuspended, TForm *Form);
|
||||
};
|
||||
extern TThreadMusciCover *g_pTThreadMusciCover;
|
||||
//---------------------------------------------------------------------------
|
||||
class TThreadHttpPostUsrIcon : public TThread
|
||||
{
|
||||
private:
|
||||
TWinControl *m_pWnCtrl;
|
||||
String m_strPath;
|
||||
|
||||
protected:
|
||||
void __fastcall Execute();
|
||||
|
||||
public:
|
||||
String m_strFileName;
|
||||
__fastcall TThreadHttpPostUsrIcon(bool CreateSuspended, TWinControl *pWnCtrl, String strPath);
|
||||
};
|
||||
extern TThreadHttpPostUsrIcon *g_pTThreadHttpPostUsrIcon;
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
@@ -0,0 +1,562 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "ImgCopperFormUnit.h"
|
||||
#include "GlobalUnit.h"
|
||||
#include <System.IOUtils.hpp>
|
||||
//---------------------------------------------------------------------------
|
||||
static const COLORREF CLR_LINE_D = RGB( 18, 19, 21 ),
|
||||
CLR_LINE_L = RGB( 140, 141, 145 );
|
||||
#define TOP_LEFT 0
|
||||
#define TOP_RIGHT 1
|
||||
#define BOTTOM_LEFT 2
|
||||
#define BOTTOM_RIGHT 3
|
||||
#define TOP 4
|
||||
#define BOTTOM 5
|
||||
#define LEFT 6
|
||||
#define RIGHT 7
|
||||
#define CENTER 8
|
||||
#define SAFE_DELETE(p) { if(p) { delete (p); (p)=NULL; } }
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
#pragma link "PNGButton"
|
||||
#pragma link "GeneralDialogPanel"
|
||||
#pragma link "TextButton"
|
||||
#pragma resource "*.dfm"
|
||||
TImgCopperForm *ImgCopperForm;
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TImgCopperForm::TImgCopperForm(TComponent* Owner, TRect rtCopper, TPicture *pPicSrc)
|
||||
: TForm(Owner)
|
||||
{
|
||||
m_rtCopper = rtCopper;
|
||||
|
||||
m_pPicSrc = new TPicture();
|
||||
if(pPicSrc && pPicSrc->Graphic->Width && pPicSrc->Graphic->Height ) {
|
||||
m_pPicSrc->Assign(pPicSrc);
|
||||
}
|
||||
|
||||
m_pTBitmapLine = new TBitmap();
|
||||
m_pTBitmapLine->SetSize(4, 4);
|
||||
m_pTBitmapLine->Canvas->Brush->Style = bsClear;
|
||||
|
||||
for( int indexY=0; indexY<4; indexY++ )
|
||||
{
|
||||
bool bLine = (indexY%2==0)?true:false;
|
||||
for( int indexX=0; indexX<4; indexX++ )
|
||||
{
|
||||
bool bEven = (indexX%2==0)?true:false;
|
||||
if(bLine) bEven = !bEven;
|
||||
|
||||
m_pTBitmapLine->Canvas->Pixels[indexX][indexY] =
|
||||
(bEven==true)?CLR_LINE_D:CLR_LINE_L;
|
||||
}
|
||||
}
|
||||
|
||||
// -----
|
||||
m_bPicDown = false;
|
||||
m_nResize = 1;
|
||||
|
||||
DragAcceptFiles(this->Handle, true);
|
||||
|
||||
m_pTransSkinScollBar = new TTransSkinScollBar(m_pPanelBKG);
|
||||
m_pTransSkinScollBar->Parent = m_pPanelBKG;
|
||||
m_pTransSkinScollBar->SetBounds(0, 0, 14, 100);
|
||||
m_pTransSkinScollBar->Vertial = false;
|
||||
m_pTransSkinScollBar->ThumbWidth = 12;
|
||||
m_pTransSkinScollBar->OnChangePos = SizeChange;
|
||||
m_pTransSkinScollBar->BringToFront();
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TImgCopperForm::FormCreate(TObject *Sender)
|
||||
{
|
||||
//绘制圆角窗体
|
||||
FormResize(NULL);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TImgCopperForm::FormClose(TObject *Sender, TCloseAction &Action)
|
||||
{
|
||||
SAFE_DELETE(m_pTBitmapLine)
|
||||
SAFE_DELETE(m_pPicSrc)
|
||||
SAFE_DELETE(m_pTransSkinScollBar)
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TImgCopperForm::FormResize(TObject *Sender)
|
||||
{
|
||||
m_pPanelBKG->Width = Width;
|
||||
m_pPanelBKG->Height = Height;
|
||||
m_pPanelBKG->Left = 0;
|
||||
m_pPanelBKG->Top = 0;
|
||||
|
||||
// -----
|
||||
TRect rtBKG = TRect(1, 26, Width-1, 26+(Height-68));
|
||||
m_rtBKG = rtBKG;
|
||||
|
||||
m_pPaintBoxSrc->Left = 1;
|
||||
m_pPaintBoxSrc->Top = rtBKG.Top;
|
||||
m_pPaintBoxSrc->Width = Width-2;
|
||||
m_pPaintBoxSrc->Height = rtBKG.Height();
|
||||
|
||||
|
||||
m_rtCopperEdge.Left = rtBKG.Left+(rtBKG.Width()-m_rtCopper.Width())/2-4;
|
||||
m_rtCopperEdge.Top = rtBKG.Top+(rtBKG.Height()-m_rtCopper.Height())/2-4;
|
||||
m_rtCopperEdge.Right = m_rtCopperEdge.Left+m_rtCopper.Width()+8;
|
||||
m_rtCopperEdge.Bottom = m_rtCopperEdge.Top+m_rtCopper.Height()+8;
|
||||
|
||||
m_pTransSkinScollBar->Width = Width/3;
|
||||
m_pTransSkinScollBar->Left
|
||||
= m_pPaintBoxSrc->Left+(m_pPaintBoxSrc->Width-m_pTransSkinScollBar->Width)/2;
|
||||
m_pTransSkinScollBar->Top
|
||||
= m_pPaintBoxSrc->Top+m_pPaintBoxSrc->Height -
|
||||
m_pTransSkinScollBar->Height-8;
|
||||
HRGN hRgnSize =
|
||||
CreateRoundRectRgn( 0, 0,
|
||||
m_pTransSkinScollBar->Width+1,
|
||||
m_pTransSkinScollBar->Height+1,
|
||||
3, 3 );
|
||||
SetWindowRgn( m_pTransSkinScollBar->Handle, hRgnSize, false );
|
||||
DeleteObject( hRgnSize );
|
||||
|
||||
m_pBtnCancel->Left = Width-m_pBtnCancel->Width-10;
|
||||
m_pBtnCancel->Top = Height-m_pBtnCancel->Height-10;
|
||||
m_pBtnOk->Left = m_pBtnCancel->Left-m_pBtnOk->Width-10;
|
||||
m_pBtnOk->Top = m_pBtnCancel->Top;
|
||||
|
||||
m_btnChoose->Left = 10;
|
||||
m_btnChoose->Top =
|
||||
m_pBtnCancel->Top+(m_pBtnCancel->Height-m_btnChoose->Height)/2;
|
||||
|
||||
m_pPanelBKG->Caption = Caption;
|
||||
|
||||
SetSrcPicRect();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TImgCopperForm::SetCaption(String strCaption)
|
||||
{
|
||||
m_pPanelBKG->Caption = strCaption;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TImgCopperForm::m_pPaintBoxSrcPaint(TObject *Sender)
|
||||
{
|
||||
int nWidth = m_pPaintBoxSrc->Width;
|
||||
int nHeight = m_pPaintBoxSrc->Height;
|
||||
|
||||
// 创建一个与显示设备兼容的内存设备
|
||||
HDC BufDC = CreateCompatibleDC(m_pPaintBoxSrc->Canvas->Handle);
|
||||
// 创建一个与显示设备兼容的位图
|
||||
HBITMAP BufBitmap = CreateCompatibleBitmap(m_pPaintBoxSrc->Canvas->Handle, nWidth, nHeight);
|
||||
// 将设备与位图关联
|
||||
SelectObject(BufDC, BufBitmap);
|
||||
// CreateCompatibleBitmap创建位图后数据初始化为0,而RGB(0,0,0)则表示是黑色
|
||||
// 这里需要清除其黑色背景,使其变为透明
|
||||
PerformEraseBackground(this, BufDC);
|
||||
// 临时的Canvas,用来画图用,但它并不是必须的,可以直接使用GDI函数来画图
|
||||
TCanvas *CanvasDraw = new TCanvas();
|
||||
// 关联到内存设备
|
||||
CanvasDraw->Handle = BufDC;
|
||||
|
||||
//--------------------------------------
|
||||
CanvasDraw->Brush->Color = RGB(52, 56, 63);
|
||||
CanvasDraw->FillRect(TRect(0, 0, nWidth, nHeight));
|
||||
CanvasDraw->StretchDraw(m_rtSrc, m_pPicSrc->Graphic);
|
||||
|
||||
int iLeft, iTop, iWidth, iHeight;
|
||||
CanvasDraw->Brush->Bitmap = m_pTBitmapLine;
|
||||
|
||||
//left
|
||||
iLeft = m_rtCopperEdge.Left-m_rtBKG.Left;
|
||||
iTop = m_rtCopperEdge.Top-m_rtBKG.Top;
|
||||
iWidth = 4;
|
||||
iHeight = m_rtCopperEdge.Height();
|
||||
CanvasDraw->FillRect( TRect(iLeft, iTop, iLeft+iWidth, iTop+iHeight) );
|
||||
|
||||
//right
|
||||
iLeft = m_rtCopperEdge.Left+m_rtCopperEdge.Width()-4-m_rtBKG.Left;
|
||||
iTop = m_rtCopperEdge.Top-m_rtBKG.Top;
|
||||
iWidth = 4;
|
||||
iHeight = m_rtCopperEdge.Height();
|
||||
CanvasDraw->FillRect( TRect(iLeft, iTop, iLeft+iWidth, iTop+iHeight) );
|
||||
|
||||
//top
|
||||
iLeft = m_rtCopperEdge.Left-m_rtBKG.Left;
|
||||
iTop = m_rtCopperEdge.Top-m_rtBKG.Top;
|
||||
iWidth = m_rtCopperEdge.Width();
|
||||
iHeight = 4;
|
||||
CanvasDraw->FillRect( TRect(iLeft, iTop, iLeft+iWidth, iTop+iHeight) );
|
||||
|
||||
//bottom
|
||||
iLeft = m_rtCopperEdge.Left-m_rtBKG.Left;
|
||||
iTop = m_rtCopperEdge.Top+m_rtCopperEdge.Height()-4-m_rtBKG.Top;
|
||||
iWidth = m_rtCopperEdge.Width();
|
||||
iHeight = 4;
|
||||
CanvasDraw->FillRect( TRect(iLeft, iTop, iLeft+iWidth, iTop+iHeight) );
|
||||
|
||||
// 一次性将内存图像数据覆盖过去,因为跳过了擦除背景过程,所以避免了闪烁的问题
|
||||
BitBlt(m_pPaintBoxSrc->Canvas->Handle, 0, 0, nWidth, nHeight,
|
||||
CanvasDraw->Handle, 0, 0, SRCCOPY);
|
||||
// 释放资源
|
||||
DeleteDC(BufDC);
|
||||
DeleteObject(BufBitmap);
|
||||
SAFE_DELETE(CanvasDraw)
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TImgCopperForm::m_pPaintBoxSrcMouseDown(TObject *Sender, TMouseButton Button,
|
||||
TShiftState Shift, int X, int Y)
|
||||
{
|
||||
m_bPicDown = true;
|
||||
m_ptDown = TPoint(X, Y);
|
||||
m_rtSrcMove = m_rtSrc;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TImgCopperForm::m_pPaintBoxSrcMouseMove(TObject *Sender, TShiftState Shift,
|
||||
int X, int Y)
|
||||
{
|
||||
if( m_bPicDown ) {
|
||||
|
||||
int nLeft, nTop, nWidth, nHeight;
|
||||
|
||||
nWidth = m_rtSrcMove.Width();
|
||||
nHeight = m_rtSrcMove.Height();
|
||||
nLeft = m_rtSrcMove.Left+X-m_ptDown.X;
|
||||
nTop = m_rtSrcMove.Top+Y-m_ptDown.Y;
|
||||
|
||||
m_rtSrc.Left = nLeft;
|
||||
m_rtSrc.Top = nTop;
|
||||
m_rtSrc.Right = m_rtSrc.Left+nWidth;
|
||||
m_rtSrc.Bottom = m_rtSrc.Top+nHeight;
|
||||
|
||||
m_pPaintBoxSrcPaint(NULL);
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TImgCopperForm::m_pPaintBoxSrcMouseUp(TObject *Sender, TMouseButton Button,
|
||||
TShiftState Shift, int X, int Y)
|
||||
{
|
||||
m_bPicDown = false;
|
||||
m_rtSrcMove = m_rtSrc;
|
||||
m_pTransSkinScollBar->Invalidate();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TImgCopperForm::SizeChange(TObject *Sender)
|
||||
{
|
||||
int nSize = m_pTransSkinScollBar->SBTop + 1;
|
||||
if(m_nResize==nSize) return;
|
||||
m_nResize = nSize;
|
||||
|
||||
int nLMove, nTMove, nWMove, nHMove;
|
||||
nLMove = m_rtSrcMove.Left;
|
||||
nTMove = m_rtSrcMove.Top;
|
||||
nWMove = m_rtSrcMove.Width();
|
||||
nHMove = m_rtSrcMove.Height();
|
||||
|
||||
int nLBac, nTBac, nWBac, nHBac;
|
||||
nLBac = m_rtSrcBac.Left;
|
||||
nTBac = m_rtSrcBac.Top;
|
||||
nWBac = m_rtSrcBac.Width();
|
||||
nHBac = m_rtSrcBac.Height();
|
||||
|
||||
//方向
|
||||
int nStatusLoc;
|
||||
TPoint ptCenterSrcMove = TPoint(nLMove+nWMove/2, nTMove+nHMove/2);
|
||||
if( ptCenterSrcMove.X>m_rtSrcBac.Right &&
|
||||
ptCenterSrcMove.Y<m_rtSrcBac.Top )
|
||||
{
|
||||
nStatusLoc = TOP_RIGHT;
|
||||
|
||||
}else if( ptCenterSrcMove.X>m_rtSrcBac.Right &&
|
||||
ptCenterSrcMove.Y>m_rtSrcBac.Bottom )
|
||||
{
|
||||
nStatusLoc = BOTTOM_RIGHT;
|
||||
|
||||
}else if( ptCenterSrcMove.X<m_rtSrcBac.Left &&
|
||||
ptCenterSrcMove.Y>m_rtSrcBac.Bottom )
|
||||
{
|
||||
nStatusLoc = BOTTOM_LEFT;
|
||||
|
||||
}else if( ptCenterSrcMove.X<m_rtSrcBac.Left &&
|
||||
ptCenterSrcMove.Y<m_rtSrcBac.Top )
|
||||
{
|
||||
nStatusLoc = TOP_LEFT;
|
||||
|
||||
}else if( ptCenterSrcMove.X>m_rtSrcBac.Right &&
|
||||
ptCenterSrcMove.Y>m_rtSrcBac.Top &&
|
||||
ptCenterSrcMove.Y<m_rtSrcBac.Bottom )
|
||||
{
|
||||
nStatusLoc = RIGHT;
|
||||
|
||||
}else if( ptCenterSrcMove.X<m_rtSrcBac.Left &&
|
||||
ptCenterSrcMove.Y>m_rtSrcBac.Top &&
|
||||
ptCenterSrcMove.Y<m_rtSrcBac.Bottom )
|
||||
{
|
||||
nStatusLoc = LEFT;
|
||||
|
||||
}else if( ptCenterSrcMove.Y>m_rtSrcBac.Bottom &&
|
||||
ptCenterSrcMove.X>m_rtSrcBac.Left &&
|
||||
ptCenterSrcMove.X<m_rtSrcBac.Right )
|
||||
{
|
||||
nStatusLoc = BOTTOM;
|
||||
|
||||
}else if( ptCenterSrcMove.Y<m_rtSrcBac.Top &&
|
||||
ptCenterSrcMove.X>m_rtSrcBac.Left &&
|
||||
ptCenterSrcMove.X<m_rtSrcBac.Right )
|
||||
{
|
||||
nStatusLoc = TOP;
|
||||
|
||||
}else{
|
||||
|
||||
nStatusLoc = CENTER;
|
||||
}
|
||||
|
||||
//得到缩放焦点
|
||||
TPoint ptFocus;
|
||||
if( CENTER==nStatusLoc ) {
|
||||
|
||||
ptFocus = ptCenterSrcMove;
|
||||
|
||||
}else if( TOP_RIGHT==nStatusLoc ) {
|
||||
|
||||
ptFocus = TPoint(nLMove+nWMove/4, nTMove+nHMove*3/4);
|
||||
|
||||
}else if( BOTTOM_RIGHT==nStatusLoc ) {
|
||||
|
||||
ptFocus = TPoint(nLMove+nWMove/4, nTMove+nHMove/4);
|
||||
|
||||
}else if( BOTTOM_LEFT==nStatusLoc ) {
|
||||
|
||||
ptFocus = TPoint(nLMove+nWMove*3/4, nTMove+nHMove/4);
|
||||
|
||||
}else if( TOP_LEFT==nStatusLoc ) {
|
||||
|
||||
ptFocus = TPoint(nLMove+nWMove*3/4, nTMove+nHMove*3/4);
|
||||
|
||||
}else if( RIGHT==nStatusLoc ) {
|
||||
|
||||
ptFocus = TPoint(nLMove+nWMove/4, nTMove+nHMove/2);
|
||||
|
||||
}else if( LEFT==nStatusLoc ) {
|
||||
|
||||
ptFocus = TPoint(nLMove+nWMove*3/4, nTMove+nHMove/2);
|
||||
|
||||
}else if( BOTTOM==nStatusLoc ) {
|
||||
|
||||
ptFocus = TPoint(nLMove+nWMove/2, nTMove+nHMove/4);
|
||||
|
||||
}else if( TOP==nStatusLoc ) {
|
||||
|
||||
ptFocus = TPoint(nLMove+nWMove/2, nTMove+nHMove*3/4);
|
||||
|
||||
}
|
||||
|
||||
//进行缩放处理
|
||||
int nLSrc, nTSrc, nWSrc, nHSrc;
|
||||
nWSrc = nWBac*nSize;
|
||||
nHSrc = nHBac*nSize;
|
||||
if( CENTER==nStatusLoc ) {
|
||||
|
||||
nLSrc = ptFocus.X - nWSrc/2;
|
||||
nTSrc = ptFocus.Y - nHSrc/2;
|
||||
|
||||
}else if( TOP_RIGHT==nStatusLoc ) {
|
||||
|
||||
nLSrc = ptFocus.X - nWSrc/4;
|
||||
nTSrc = ptFocus.Y - nHSrc*3/4;
|
||||
|
||||
}else if( BOTTOM_RIGHT==nStatusLoc ) {
|
||||
|
||||
nLSrc = ptFocus.X - nWSrc/4;
|
||||
nTSrc = ptFocus.Y - nHSrc/4;
|
||||
|
||||
}else if( BOTTOM_LEFT==nStatusLoc ) {
|
||||
|
||||
nLSrc = ptFocus.X - nWSrc*3/4;
|
||||
nTSrc = ptFocus.Y - nHSrc/4;
|
||||
|
||||
}else if( TOP_LEFT==nStatusLoc ) {
|
||||
|
||||
nLSrc = ptFocus.X - nWSrc*3/4;
|
||||
nTSrc = ptFocus.Y - nHSrc*3/4;
|
||||
|
||||
}else if( RIGHT==nStatusLoc ) {
|
||||
|
||||
nLSrc = ptFocus.X - nWSrc/4;
|
||||
nTSrc = ptFocus.Y - nHSrc/2;
|
||||
|
||||
}else if( LEFT==nStatusLoc ) {
|
||||
|
||||
nLSrc = ptFocus.X - nWSrc*3/4;
|
||||
nTSrc = ptFocus.Y - nHSrc/2;
|
||||
|
||||
}else if( BOTTOM==nStatusLoc ) {
|
||||
|
||||
nLSrc = ptFocus.X - nWSrc/2;
|
||||
nTSrc = ptFocus.Y - nHSrc/4;
|
||||
|
||||
}else if( TOP==nStatusLoc ) {
|
||||
|
||||
nLSrc = ptFocus.X - nWSrc/2;
|
||||
nTSrc = ptFocus.Y - nHSrc*3/4;
|
||||
}
|
||||
|
||||
m_rtSrc.Left = nLSrc;
|
||||
m_rtSrc.Top = nTSrc;
|
||||
m_rtSrc.Right = m_rtSrc.Left+nWSrc;
|
||||
m_rtSrc.Bottom = m_rtSrc.Top+nHSrc;
|
||||
|
||||
m_pPaintBoxSrcPaint(NULL);
|
||||
|
||||
m_pTransSkinScollBar->Refresh();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TImgCopperForm::SetSrcPicRect()
|
||||
{
|
||||
int nLeft, nTop, nWidth, nHeight;
|
||||
if( m_pPicSrc ) {
|
||||
|
||||
int nWidthLarge = -1;
|
||||
int nWidthCopper = m_rtCopper.Width();
|
||||
int nHeightCopper = m_rtCopper.Height();
|
||||
nWidth = m_pPicSrc->Width;
|
||||
nHeight = m_pPicSrc->Height;
|
||||
|
||||
if( nWidth<m_rtCopper.Width() ) {
|
||||
nLeft = (nWidthCopper-nWidth)/2;
|
||||
}else{
|
||||
nWidthLarge = nWidth;
|
||||
nLeft = 0;
|
||||
nWidth = nWidthCopper;
|
||||
}
|
||||
|
||||
if( -1!=nWidthLarge ) {
|
||||
nHeight = nHeight*nWidth/nWidthLarge;
|
||||
}
|
||||
nTop = (nHeightCopper-nHeight)/2;
|
||||
|
||||
|
||||
m_rtSrc.Left = nLeft+(m_rtCopperEdge.Left-m_pPaintBoxSrc->Left)+4;
|
||||
m_rtSrc.Top = nTop+(m_rtCopperEdge.Top-m_pPaintBoxSrc->Top)+4;
|
||||
m_rtSrc.Right = m_rtSrc.Left+nWidth;
|
||||
m_rtSrc.Bottom = m_rtSrc.Top+nHeight;
|
||||
m_rtSrcBac = m_rtSrc;
|
||||
m_rtSrcMove = m_rtSrc;
|
||||
|
||||
if( -1!=nWidthLarge )
|
||||
m_pTransSkinScollBar->SBTotal = m_pPicSrc->Width*5/m_rtSrc.Width();
|
||||
else
|
||||
m_pTransSkinScollBar->SBTotal = 5;
|
||||
m_pTransSkinScollBar->SBShow = 2;
|
||||
m_pTransSkinScollBar->SBTop = 0;
|
||||
m_nResize = 1;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
bool __fastcall TImgCopperForm::SetSrcPic(String fileName)
|
||||
{
|
||||
TMemoryStream *memoryStream = new TMemoryStream();
|
||||
memoryStream->Position = 0;
|
||||
memoryStream->LoadFromFile(fileName);
|
||||
|
||||
if( !GetPicType(fileName, memoryStream, true) ){
|
||||
SAFE_DELETE(memoryStream)
|
||||
return false;
|
||||
}else {
|
||||
|
||||
TPicture *pTPicture = new TPicture();
|
||||
try{
|
||||
pTPicture->LoadFromFile(fileName);
|
||||
}catch(Exception &e){
|
||||
SAFE_DELETE(pTPicture)
|
||||
SAFE_DELETE(memoryStream)
|
||||
return false;
|
||||
}
|
||||
|
||||
if( m_pPicSrc ) {
|
||||
|
||||
m_pPicSrc->Assign(pTPicture);
|
||||
SetSrcPicRect();
|
||||
m_pPaintBoxSrcPaint(NULL);
|
||||
m_pTransSkinScollBar->Invalidate();
|
||||
SAFE_DELETE(pTPicture)
|
||||
}
|
||||
}
|
||||
|
||||
SAFE_DELETE(memoryStream)
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TImgCopperForm::WMDRopFiles (TMessage& Msg)
|
||||
{
|
||||
wchar_t wcFileName[256];
|
||||
int iCount = DragQueryFile((HDROP)Msg.WParam, 0xffffffff, wcFileName , 256);
|
||||
|
||||
for (int index=0; index<iCount; index++)
|
||||
{
|
||||
DragQueryFile((HDROP )Msg.WParam, index, wcFileName , 256);
|
||||
String fileName = wstr2str(wcFileName).c_str();
|
||||
|
||||
if( SetSrcPic(fileName) ) break;
|
||||
}
|
||||
|
||||
DragFinish((HDROP)Msg.WParam);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TImgCopperForm::m_btnChooseClick(TObject *Sender)
|
||||
{
|
||||
String strPicPath;
|
||||
|
||||
// -----
|
||||
TOpenDialog *pDlg = new TOpenDialog(NULL);
|
||||
pDlg->Title = "打开图片";
|
||||
pDlg->Options << ofFileMustExist;
|
||||
// pDlg->FileName = ExtractFileName(L"");
|
||||
// pDlg->InitialDir = ExtractFilePath(L"");
|
||||
pDlg->Filter = "jpg文件 (*.jpg)|*.JPG|png文件 (*.png)|*.PNG|bmp文件 (*.bmp)|*.BMP";
|
||||
pDlg->DefaultExt = "jpg";
|
||||
if ( pDlg->Execute(Handle) ) {
|
||||
strPicPath = pDlg->FileName.c_str();
|
||||
}
|
||||
SAFE_DELETE(pDlg);
|
||||
|
||||
if( !strPicPath.IsEmpty() ){
|
||||
SetSrcPic(strPicPath);
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TImgCopperForm::m_pBtnOkClick(TObject *Sender)
|
||||
{
|
||||
int iLeft, iTop, iWidth, iHeight;
|
||||
iLeft = 0;
|
||||
iTop = 0;
|
||||
iWidth = m_rtCopper.Width();
|
||||
iHeight = m_rtCopper.Height();
|
||||
|
||||
TBitmap *pTBitmapCopper = new TBitmap();
|
||||
pTBitmapCopper->SetSize(iWidth, iHeight);
|
||||
pTBitmapCopper->Canvas->Brush->Color = RGB(0, 0, 0);
|
||||
pTBitmapCopper->Canvas->FillRect(TRect(iLeft, iTop, iLeft+iWidth, iTop+iHeight));
|
||||
|
||||
iWidth = m_rtSrc.Width();
|
||||
iHeight = m_rtSrc.Height();
|
||||
|
||||
m_rtSrc.Left -= m_rtCopperEdge.Left-m_pPaintBoxSrc->Left+4;
|
||||
m_rtSrc.Top -= m_rtCopperEdge.Top-m_pPaintBoxSrc->Top+4;
|
||||
m_rtSrc.Right = m_rtSrc.Left+iWidth;
|
||||
m_rtSrc.Bottom = m_rtSrc.Top+iHeight;
|
||||
pTBitmapCopper->Canvas->StretchDraw(m_rtSrc, m_pPicSrc->Graphic);
|
||||
m_strCopperPath = g_strUserPath.c_str();
|
||||
m_strCopperPath += L"temp\\";
|
||||
if(!DirectoryExists(m_strCopperPath, false))
|
||||
ForceDirectories(m_strCopperPath);
|
||||
m_strCopperPath += L"copper.jpg";
|
||||
|
||||
TJPEGImage *pTJPEGImage = new TJPEGImage();
|
||||
pTJPEGImage->Assign(pTBitmapCopper);
|
||||
pTJPEGImage->SaveToFile( m_strCopperPath );
|
||||
SAFE_DELETE(pTJPEGImage);
|
||||
SAFE_DELETE(pTBitmapCopper);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
object ImgCopperForm: TImgCopperForm
|
||||
Left = 0
|
||||
Top = 0
|
||||
BorderStyle = bsNone
|
||||
Caption = #32534#36753#23553#38754
|
||||
ClientHeight = 338
|
||||
ClientWidth = 309
|
||||
Color = clBtnFace
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
Position = poMainFormCenter
|
||||
Scaled = False
|
||||
OnClose = FormClose
|
||||
OnCreate = FormCreate
|
||||
OnResize = FormResize
|
||||
TextHeight = 13
|
||||
object m_pPanelBKG: TGeneralDialogPanel
|
||||
Left = 0
|
||||
Top = 1
|
||||
Width = 309
|
||||
Height = 337
|
||||
Caption = #32534#36753#23553#38754
|
||||
Color = 5064257
|
||||
ParentBackground = False
|
||||
TabOrder = 0
|
||||
object m_pPaintBoxSrc: TPaintBox
|
||||
Left = 0
|
||||
Top = 29
|
||||
Width = 309
|
||||
Height = 252
|
||||
OnMouseDown = m_pPaintBoxSrcMouseDown
|
||||
OnMouseMove = m_pPaintBoxSrcMouseMove
|
||||
OnMouseUp = m_pPaintBoxSrcMouseUp
|
||||
OnPaint = m_pPaintBoxSrcPaint
|
||||
end
|
||||
object m_pBtnOk: TTextButton
|
||||
Left = 167
|
||||
Top = 300
|
||||
Width = 52
|
||||
Height = 25
|
||||
ModalResult = mrOk
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
OnClick = m_pBtnOkClick
|
||||
Text = #30830#23450
|
||||
end
|
||||
object m_pBtnCancel: TTextButton
|
||||
Left = 240
|
||||
Top = 300
|
||||
Width = 52
|
||||
Height = 25
|
||||
ModalResult = mrCancel
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
Text = #21462#28040
|
||||
end
|
||||
object m_btnChoose: TTextButton
|
||||
Left = 21
|
||||
Top = 300
|
||||
Width = 56
|
||||
Height = 25
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
OnClick = m_btnChooseClick
|
||||
Text = #36873#21462#22270#29255
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,79 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ImgCopperFormUnitH
|
||||
#define ImgCopperFormUnitH
|
||||
//---------------------------------------------------------------------------
|
||||
#include "ImgCopperExUnit.h"
|
||||
#include <System.Classes.hpp>
|
||||
#include <Vcl.Controls.hpp>
|
||||
#include <Vcl.StdCtrls.hpp>
|
||||
#include <Vcl.Forms.hpp>
|
||||
#include <Vcl.ExtCtrls.hpp>
|
||||
#include <Vcl.Imaging.jpeg.hpp>
|
||||
#include <Vcl.Imaging.pngimage.hpp>
|
||||
#include <Vcl.Graphics.hpp>
|
||||
#include "PNGButton.hpp"
|
||||
#include "TransSkinScrollBar.h"
|
||||
#include "GeneralDialogPanel.h"
|
||||
#include "TextButton.h"
|
||||
//---------------------------------------------------------------------------
|
||||
class TImgCopperForm : public TForm
|
||||
{
|
||||
__published: // IDE-managed Components
|
||||
TGeneralDialogPanel *m_pPanelBKG;
|
||||
TTextButton *m_pBtnOk;
|
||||
TTextButton *m_pBtnCancel;
|
||||
TPaintBox *m_pPaintBoxSrc;
|
||||
TTextButton *m_btnChoose;
|
||||
void __fastcall FormCreate(TObject *Sender);
|
||||
void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
|
||||
void __fastcall m_pPaintBoxSrcMouseMove(TObject *Sender, TShiftState Shift, int X,
|
||||
int Y);
|
||||
void __fastcall m_pPaintBoxSrcMouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift,
|
||||
int X, int Y);
|
||||
void __fastcall m_pPaintBoxSrcMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift,
|
||||
int X, int Y);
|
||||
void __fastcall m_pPaintBoxSrcPaint(TObject *Sender);
|
||||
void __fastcall m_pBtnOkClick(TObject *Sender);
|
||||
void __fastcall FormResize(TObject *Sender);
|
||||
void __fastcall m_btnChooseClick(TObject *Sender);
|
||||
|
||||
|
||||
private: // User declarations
|
||||
|
||||
TRect m_rtBKG;
|
||||
TRect m_rtCopper;
|
||||
TRect m_rtCopperEdge;
|
||||
|
||||
TBitmap *m_pTBitmapLine;
|
||||
|
||||
TPicture *m_pPicSrc;
|
||||
TRect m_rtSrc;
|
||||
TRect m_rtSrcBac;
|
||||
TRect m_rtSrcMove;
|
||||
bool m_bPicDown;
|
||||
TPoint m_ptDown;
|
||||
int m_nResize;
|
||||
TTransSkinScollBar *m_pTransSkinScollBar;
|
||||
void __fastcall SizeChange(TObject *Sender);
|
||||
|
||||
bool __fastcall SetSrcPic(String fileName);
|
||||
void __fastcall SetSrcPicRect();
|
||||
|
||||
MESSAGE void __fastcall WMDRopFiles (TMessage& Msg);
|
||||
|
||||
BEGIN_MESSAGE_MAP
|
||||
MESSAGE_HANDLER(WM_DROPFILES, TMessage, WMDRopFiles)
|
||||
END_MESSAGE_MAP(TForm)
|
||||
|
||||
public: // User declarations
|
||||
|
||||
__fastcall TImgCopperForm(TComponent* Owner, TRect rtCopper, TPicture *pPicSrc);
|
||||
|
||||
String m_strCopperPath;
|
||||
void __fastcall SetCaption(String strCaption);
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
extern PACKAGE TImgCopperForm *ImgCopperForm;
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
@@ -0,0 +1,258 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "GlobalUnit.h"
|
||||
#include "ImportFormUnit.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
#pragma link "GeneralDialogPanel"
|
||||
#pragma link "LineEdit"
|
||||
#pragma link "TextButton"
|
||||
#pragma link "ComboBoxComponent"
|
||||
#pragma link "SkinTrackBar"
|
||||
#pragma link "CapButton"
|
||||
#pragma resource "*.dfm"
|
||||
TImportForm *ImportForm;
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TImportForm::TImportForm(TComponent* Owner, String DefaultFile,
|
||||
int TS, int Tempo, int iMode)
|
||||
: TForm(Owner)
|
||||
{
|
||||
m_iMode = iMode;
|
||||
m_MediaFilePath->Text = DefaultFile;
|
||||
|
||||
MediaFilePath = DefaultFile;
|
||||
|
||||
DoFilePathChange(NULL);
|
||||
|
||||
m_RetrunValue = 0;
|
||||
|
||||
this->TS = TS;
|
||||
this->Tempo = Tempo;
|
||||
|
||||
this->m_TSTrackBar->Position = TS;
|
||||
this->m_TempoTrackBar->Position = Tempo;
|
||||
|
||||
if( iMode==1 )
|
||||
m_panGeneral->Caption = "插入音频片段";
|
||||
|
||||
for( int i=0; i<ComponentCount; i++ ){
|
||||
if(Components[i]->ClassNameIs( TLabel::ClassName() ) )
|
||||
((TLabel*)Components[i])->ControlStyle>>csOpaque;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TImportForm::DoBrows(TObject *Sender)
|
||||
{
|
||||
TOpenDialog * pDlg = new TOpenDialog(NULL);
|
||||
pDlg->Options << ofFileMustExist;
|
||||
pDlg->Title = L"打开";
|
||||
pDlg->FileName = ExtractFileName(m_MediaFilePath->Text);
|
||||
pDlg->InitialDir = ExtractFilePath(m_MediaFilePath->Text);
|
||||
|
||||
pDlg->Filter = "mp3文件 (*.mp3)|*.MP3|Wave文件 (*.wav)|*.WAV";
|
||||
|
||||
if( m_iMode==0 )
|
||||
pDlg->Filter += "|midi文件 (*.mid)|*.MID";
|
||||
|
||||
if(ExtractFileExt(m_MediaFilePath->Text).CompareIC(".mid") == 0)
|
||||
{
|
||||
pDlg->FilterIndex = 3;
|
||||
}
|
||||
else if(ExtractFileExt(m_MediaFilePath->Text).CompareIC(".wav") == 0)
|
||||
{
|
||||
pDlg->FilterIndex = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
pDlg->FilterIndex = 1;
|
||||
}
|
||||
|
||||
if(pDlg->Execute(Handle))
|
||||
{
|
||||
m_MediaFilePath->Text = pDlg->FileName;
|
||||
MediaFilePath = pDlg->FileName;
|
||||
//DoFilePathChange(NULL);
|
||||
}
|
||||
|
||||
delete pDlg;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TImportForm::DoFilePathChange(TObject *Sender)
|
||||
{
|
||||
UnicodeString var_FilePath(m_MediaFilePath->Text);
|
||||
|
||||
MediaFilePath = var_FilePath;
|
||||
|
||||
//检查文件是否存在
|
||||
if(System::Ioutils::TFile::Exists(MediaFilePath))
|
||||
m_OKButton->Enabled = true;
|
||||
else
|
||||
m_OKButton->Enabled = false;;
|
||||
|
||||
if( m_iMode==0 && ( ExtractFileExt(var_FilePath).CompareIC(".wav") == 0
|
||||
|| ExtractFileExt(var_FilePath).CompareIC(".mp3") == 0)){
|
||||
///////////
|
||||
m_panGeneral->Height = 206;
|
||||
Height = 206;
|
||||
|
||||
m_TipsLabel->Top = 162;
|
||||
m_OKButton->Top = 155;
|
||||
m_CancelButton->Top = 155;
|
||||
|
||||
m_TSTrackBar->Visible = true;
|
||||
m_TempoTrackBar->Visible = true;
|
||||
|
||||
m_TSLabel->Visible = true;
|
||||
m_TempoLabel->Visible = true;
|
||||
|
||||
m_TipsLabel->Visible = true;
|
||||
|
||||
m_ShowTempo->Visible = true;
|
||||
|
||||
ts_44->Visible = true;
|
||||
ts_34->Visible = true;
|
||||
ts_24->Visible = true;
|
||||
ts_68->Visible = true;
|
||||
|
||||
m_ShowTempoMin->Visible = true;
|
||||
m_ShowTempoMax->Visible = true;
|
||||
m_TempoUpDown->Visible = true;
|
||||
}
|
||||
else{
|
||||
m_TSTrackBar->Visible = false;
|
||||
m_TempoTrackBar->Visible = false;
|
||||
m_ShowTempo->Visible = false;
|
||||
|
||||
m_TSLabel->Visible = false;
|
||||
m_TempoLabel->Visible = false;
|
||||
|
||||
m_TipsLabel->Visible = false;
|
||||
|
||||
ts_44->Visible = false;
|
||||
ts_34->Visible = false;
|
||||
ts_24->Visible = false;
|
||||
ts_68->Visible = false;
|
||||
|
||||
m_ShowTempoMin->Visible = false;
|
||||
m_ShowTempoMax->Visible = false;
|
||||
m_TempoUpDown->Visible = false;
|
||||
|
||||
///////////
|
||||
m_panGeneral->Height = 140;
|
||||
Height = 140;
|
||||
|
||||
m_TipsLabel->Top = 96;
|
||||
m_OKButton->Top = 89;
|
||||
m_CancelButton->Top = 89;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
int __fastcall TImportForm::ShowModal()
|
||||
{
|
||||
int var_Result = TForm::ShowModal();
|
||||
|
||||
TS = m_TSTrackBar->Position;
|
||||
Tempo = m_TempoTrackBar->Position;
|
||||
MediaFilePath = m_MediaFilePath->Text;
|
||||
|
||||
return var_Result;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
void __fastcall TImportForm::DoOK(TObject *Sender)
|
||||
{
|
||||
m_RetrunValue = 1;
|
||||
Close();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
void __fastcall TImportForm::DoTempoTrackBar(TObject *Sender)
|
||||
{
|
||||
String var_Tempo(m_TempoTrackBar->Position);
|
||||
m_ShowTempo->Text = var_Tempo;
|
||||
//m_ShowTempo->Caption = var_Tempo;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TImportForm::DoTSTrackBar(TObject *Sender)
|
||||
{
|
||||
TS = m_TSTrackBar->Position;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
void __fastcall TImportForm::DoCancel(TObject *Sender)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TImportForm::DoShowTempoChange(TObject *Sender)
|
||||
{
|
||||
if(m_ShowTempo->Text == "")
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int var_Tempo = m_ShowTempo->Text.ToInt();
|
||||
|
||||
if(var_Tempo < 50/*m_TSTrackBar->Min*/ || var_Tempo > 200/*m_TSTrackBar->Max*/)
|
||||
{
|
||||
//m_ShowTempo->Text = String(m_TSTrackBar->Position);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_TempoTrackBar->Position = var_Tempo;
|
||||
m_TempoUpDown->Position = var_Tempo;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TImportForm::DoTempoUpDown(TObject *Sender, TUDBtnType Button)
|
||||
{
|
||||
if(Button == btNext)
|
||||
{
|
||||
m_TempoUpDown->Position += 1;
|
||||
m_TempoTrackBar->Position += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_TempoUpDown->Position -= 1;
|
||||
m_TempoTrackBar->Position -= 1;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TImportForm::FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift)
|
||||
{
|
||||
switch( Key ){
|
||||
case VK_RETURN:
|
||||
if(m_OKButton->Enabled)
|
||||
ModalResult = mrOk;
|
||||
break;
|
||||
|
||||
case VK_ESCAPE:
|
||||
ModalResult = mrCancel;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TImportForm::FormCreate(TObject *Sender)
|
||||
{
|
||||
m_panGeneral->Font->Size = g_szFont9;
|
||||
m_BrowsButton->FontSize = g_szFont9;
|
||||
m_OKButton->FontSize = g_szFont9;
|
||||
m_CancelButton->FontSize = g_szFont9;
|
||||
m_MediaFilePath->SetTextFont(g_strTxtFontName, g_szFont9);
|
||||
m_ShowTempo->SetTextFont(g_strTxtFontName, g_szFont9);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,286 @@
|
||||
object ImportForm: TImportForm
|
||||
Left = 0
|
||||
Top = 0
|
||||
BorderStyle = bsNone
|
||||
Caption = 'ImportForm'
|
||||
ClientHeight = 206
|
||||
ClientWidth = 410
|
||||
Color = clBtnFace
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 12569562
|
||||
Font.Height = -13
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
KeyPreview = True
|
||||
Position = poMainFormCenter
|
||||
Scaled = False
|
||||
OnCreate = FormCreate
|
||||
OnKeyDown = FormKeyDown
|
||||
TextHeight = 16
|
||||
object m_panGeneral: TGeneralDialogPanel
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 410
|
||||
Height = 206
|
||||
ParentCustomHint = False
|
||||
Caption = #23548#20837#21333#26059#24459#25991#20214
|
||||
Color = 5064257
|
||||
UseDockManager = False
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 12569562
|
||||
Font.Height = -12
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentBackground = False
|
||||
ParentFont = False
|
||||
ParentShowHint = False
|
||||
ShowHint = False
|
||||
TabOrder = 0
|
||||
object m_MediaFilePathLabel: TLabel
|
||||
Left = 29
|
||||
Top = 53
|
||||
Width = 36
|
||||
Height = 14
|
||||
Caption = #25991#20214#21517
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 14339007
|
||||
Font.Height = -12
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
end
|
||||
object m_TSLabel: TLabel
|
||||
Left = 29
|
||||
Top = 113
|
||||
Width = 24
|
||||
Height = 14
|
||||
Caption = #33410#25293
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 14339007
|
||||
Font.Height = -12
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
end
|
||||
object m_TempoLabel: TLabel
|
||||
Left = 158
|
||||
Top = 113
|
||||
Width = 24
|
||||
Height = 14
|
||||
Caption = #36895#24230
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 14339007
|
||||
Font.Height = -12
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
end
|
||||
object m_TipsLabel: TLabel
|
||||
Left = 29
|
||||
Top = 162
|
||||
Width = 132
|
||||
Height = 14
|
||||
Caption = #25552#31034#65306#35831#35774#32622#36895#24230#19982#33410#25293
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 14339007
|
||||
Font.Height = -12
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
end
|
||||
object m_BrowsButton: TTextButton
|
||||
Left = 313
|
||||
Top = 50
|
||||
Width = 60
|
||||
Height = 25
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
OnClick = DoBrows
|
||||
Text = #27983#35272
|
||||
end
|
||||
object m_CancelButton: TTextButton
|
||||
Left = 298
|
||||
Top = 157
|
||||
Width = 75
|
||||
Height = 27
|
||||
ModalResult = mrCancel
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
Text = #21462#28040
|
||||
end
|
||||
object m_OKButton: TTextButton
|
||||
Left = 217
|
||||
Top = 157
|
||||
Width = 75
|
||||
Height = 27
|
||||
ModalResult = mrOk
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
Text = #30830#23450
|
||||
end
|
||||
object ts_44: TLabel
|
||||
Left = 60
|
||||
Top = 90
|
||||
Width = 19
|
||||
Height = 16
|
||||
Caption = '4/4'
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 14339007
|
||||
Font.Height = -13
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
end
|
||||
object ts_34: TLabel
|
||||
Left = 82
|
||||
Top = 90
|
||||
Width = 19
|
||||
Height = 16
|
||||
Caption = '3/4'
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 14339007
|
||||
Font.Height = -13
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
end
|
||||
object ts_24: TLabel
|
||||
Left = 104
|
||||
Top = 90
|
||||
Width = 19
|
||||
Height = 16
|
||||
Caption = '2/4'
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 14339007
|
||||
Font.Height = -13
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
end
|
||||
object ts_68: TLabel
|
||||
Left = 127
|
||||
Top = 90
|
||||
Width = 19
|
||||
Height = 16
|
||||
Caption = '6/8'
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 14339007
|
||||
Font.Height = -13
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
end
|
||||
object m_ShowTempoMin: TLabel
|
||||
Left = 190
|
||||
Top = 90
|
||||
Width = 14
|
||||
Height = 16
|
||||
Caption = '50'
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 14339007
|
||||
Font.Height = -13
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
end
|
||||
object m_ShowTempoMax: TLabel
|
||||
Left = 295
|
||||
Top = 90
|
||||
Width = 21
|
||||
Height = 16
|
||||
Caption = '200'
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 14339007
|
||||
Font.Height = -13
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
end
|
||||
object m_MediaFilePath: TLineEdit
|
||||
Left = 80
|
||||
Top = 50
|
||||
Width = 230
|
||||
Height = 23
|
||||
OnChange = DoFilePathChange
|
||||
HintText = #35831#36873#25321#25991#20214
|
||||
NumberMax = -1
|
||||
NumberMin = -1
|
||||
Color = 15591652
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clBlack
|
||||
Font.Height = -12
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
TabOrder = 0
|
||||
end
|
||||
object m_ShowTempo: TLineEdit
|
||||
Left = 325
|
||||
Top = 110
|
||||
Width = 33
|
||||
Height = 24
|
||||
OnChange = DoShowTempoChange
|
||||
Alignment = taCenter
|
||||
NumbersOnly = True
|
||||
NumberMax = 200
|
||||
NumberMin = 50
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clBlack
|
||||
Font.Height = -11
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
TabOrder = 1
|
||||
end
|
||||
object m_TempoTrackBar: TSkinTrackBar
|
||||
Left = 187
|
||||
Top = 112
|
||||
Width = 132
|
||||
Height = 20
|
||||
Hint = '50'
|
||||
Caption = 'm_TempoTrackBar'
|
||||
FullRepaint = False
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 12569562
|
||||
Font.Height = -13
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentColor = True
|
||||
ParentFont = False
|
||||
TabOrder = 2
|
||||
OnChange = DoTempoTrackBar
|
||||
Max = 200
|
||||
Min = 50
|
||||
Position = 50
|
||||
end
|
||||
object m_TSTrackBar: TSkinTrackBar
|
||||
Left = 60
|
||||
Top = 112
|
||||
Width = 85
|
||||
Height = 20
|
||||
Hint = '2'
|
||||
Caption = 'm_TSTrackBar'
|
||||
FullRepaint = False
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 12569562
|
||||
Font.Height = -13
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentColor = True
|
||||
ParentFont = False
|
||||
TabOrder = 3
|
||||
OnChange = DoTSTrackBar
|
||||
Max = 3
|
||||
Position = 2
|
||||
end
|
||||
object m_TempoUpDown: TUpDown
|
||||
Left = 357
|
||||
Top = 111
|
||||
Width = 16
|
||||
Height = 22
|
||||
Min = 50
|
||||
Max = 200
|
||||
Position = 50
|
||||
TabOrder = 4
|
||||
OnClick = DoTempoUpDown
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,70 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ImportFormUnitH
|
||||
#define ImportFormUnitH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <System.Classes.hpp>
|
||||
#include <Vcl.Controls.hpp>
|
||||
#include <Vcl.StdCtrls.hpp>
|
||||
#include <Vcl.Forms.hpp>
|
||||
#include <Vcl.ExtCtrls.hpp>
|
||||
#include <System.IOUtils.hpp>
|
||||
#include <Vcl.ComCtrls.hpp>
|
||||
#include "GeneralDialogPanel.h"
|
||||
#include "LineEdit.h"
|
||||
#include "SkinTrackBar.h"
|
||||
#include "TextButton.h"
|
||||
#include "CapButton.h"
|
||||
#include "ComboBoxComponent.h"
|
||||
#include "UpDownUnit.h"
|
||||
//---------------------------------------------------------------------------
|
||||
class TImportForm : public TForm
|
||||
{
|
||||
__published: // IDE-managed Components
|
||||
TGeneralDialogPanel *m_panGeneral;
|
||||
TLabel *m_MediaFilePathLabel;
|
||||
TLabel *m_TSLabel;
|
||||
TLabel *m_TempoLabel;
|
||||
TLabel *m_TipsLabel;
|
||||
TTextButton *m_BrowsButton;
|
||||
TTextButton *m_CancelButton;
|
||||
TTextButton *m_OKButton;
|
||||
TLineEdit *m_MediaFilePath;
|
||||
TLabel *ts_44;
|
||||
TLabel *ts_34;
|
||||
TLabel *ts_24;
|
||||
TLabel *ts_68;
|
||||
TLineEdit *m_ShowTempo;
|
||||
TSkinTrackBar *m_TempoTrackBar;
|
||||
TSkinTrackBar *m_TSTrackBar;
|
||||
TLabel *m_ShowTempoMin;
|
||||
TLabel *m_ShowTempoMax;
|
||||
UpDownUnit::TUpDown *m_TempoUpDown;
|
||||
|
||||
void __fastcall DoBrows(TObject *Sender);
|
||||
void __fastcall DoFilePathChange(TObject *Sender);
|
||||
void __fastcall DoOK(TObject *Sender);
|
||||
void __fastcall DoCancel(TObject *Sender);
|
||||
void __fastcall DoTempoTrackBar(TObject *Sender);
|
||||
void __fastcall DoTSTrackBar(TObject *Sender);
|
||||
void __fastcall DoShowTempoChange(TObject *Sender);
|
||||
void __fastcall DoTempoUpDown(TObject *Sender, TUDBtnType Button);
|
||||
void __fastcall FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift);
|
||||
void __fastcall FormCreate(TObject *Sender);
|
||||
private: // User declarations
|
||||
int m_RetrunValue;
|
||||
int m_iMode; //0 = 导入单旋律文件 1 = 导入旋律片段
|
||||
int m_TopOk, m_TopCancel, m_TopTips, m_Height;
|
||||
public: // User declarations
|
||||
String MediaFilePath;
|
||||
int TS;
|
||||
int Tempo;
|
||||
|
||||
__fastcall TImportForm(TComponent* Owner, String DefaultFile,
|
||||
int TS=-1, int Tempo=-1, int iMode=1 );
|
||||
virtual int __fastcall ShowModal();
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
extern PACKAGE TImportForm *ImportForm;
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
@@ -0,0 +1,263 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "ImportSegmentFormUnit.h"
|
||||
#include "MessageFormUnit.h"
|
||||
|
||||
#define E_WrongMIDIFormat 0x00000001 //MIDI版本错误
|
||||
#define E_FileFormatError 0x00000002 //语法格式错误
|
||||
#define E_TSConflict 0x00000004 //节拍匹配错误
|
||||
#define E_TempoConfilict 0x00000008 //速度匹配错误
|
||||
#define E_LessBarsNum 0x00000010 //小节数不足
|
||||
#define E_MoreBarsNum 0x00000020 //小节数过多
|
||||
#define E_EmptySegment 0x00000040 //片段无有效音轨数据
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
#pragma link "ComboBoxComponent"
|
||||
#pragma link "GeneralDialogPanel"
|
||||
#pragma link "LineEdit"
|
||||
#pragma link "TextButton"
|
||||
#pragma resource "*.dfm"
|
||||
TImportSegmentForm *ImportSegmentForm;
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TImportSegmentForm::TImportSegmentForm(TComponent* Owner, TPreStylePanel* pStylePanel)
|
||||
: TForm(Owner)
|
||||
{
|
||||
m_pStylePanel = pStylePanel;
|
||||
|
||||
SetSegType();
|
||||
|
||||
SetTransparent( this );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void TImportSegmentForm::SetSegType()
|
||||
{
|
||||
int iOldIndex = m_cbSegType->DefItemIndex;
|
||||
|
||||
m_cbSegType->Clear();
|
||||
m_aParams.clear();
|
||||
|
||||
TStyleItem* pStyItem = m_pStylePanel->GetStyleItem();
|
||||
DWORD dwParam = 0;
|
||||
if( pStyItem->nSegNum[0]<8 ){
|
||||
m_cbSegType->AddItem( "伴奏" );
|
||||
m_aParams.push_back( MAKELONG(pStyItem->nSegNum[0], SEGTYPE_VAR) );
|
||||
}
|
||||
if( pStyItem->nSegNum[1]<8 ){
|
||||
m_cbSegType->AddItem( "加花" );
|
||||
m_aParams.push_back( MAKELONG(pStyItem->nSegNum[1], SEGTYPE_FILL) );
|
||||
}
|
||||
|
||||
int count = m_pStylePanel->GetIECount( 0, 0 );
|
||||
if( count < 4 ){
|
||||
m_cbSegType->AddItem( "前奏(大调)" );
|
||||
m_aParams.push_back( MAKELONG(count, SEGTYPE_INTRO) );
|
||||
}
|
||||
count = m_pStylePanel->GetIECount( 0, 1 );
|
||||
if( count < 4 ){
|
||||
m_cbSegType->AddItem( "前奏(小调)" );
|
||||
m_aParams.push_back( MAKELONG(count+4, SEGTYPE_INTRO) );
|
||||
}
|
||||
count = m_pStylePanel->GetIECount( 1, 0 );
|
||||
if( count < 4 ){
|
||||
m_cbSegType->AddItem( "尾奏(大调)" );
|
||||
m_aParams.push_back( MAKELONG(count, SEGTYPE_ENDING) );
|
||||
}
|
||||
count = m_pStylePanel->GetIECount( 1, 1 );
|
||||
if( count < 4 ){
|
||||
m_cbSegType->AddItem( "尾奏(小调)" );
|
||||
m_aParams.push_back( MAKELONG(count+4, SEGTYPE_ENDING) );
|
||||
}
|
||||
|
||||
count = m_cbSegType->ItemsCount;
|
||||
if( count>0 ){
|
||||
if( iOldIndex<0 || iOldIndex>=count )
|
||||
m_cbSegType->DefItemIndex = 0;
|
||||
else
|
||||
m_cbSegType->DefItemIndex = iOldIndex;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TImportSegmentForm::OkClick(TObject *Sender)
|
||||
{
|
||||
String strTips[] = {L"提示:请选择导入的MIDI文件和片段类型",
|
||||
L"提示:风格所含片段数已达上限",
|
||||
L"错误:所选文件不是标准MIDI(1)格式",
|
||||
L"错误:MIDI语法解析错误",
|
||||
L"错误:MIDI节拍不一致",
|
||||
L"错误:MIDI速度不一致",
|
||||
L"错误:伴奏片段不得少于2小节",
|
||||
L"错误:加花片段不得超过1小节",
|
||||
L"错误:片段不得超过16小节",
|
||||
L"错误:片段缺少有效音轨数据" };
|
||||
int iTip = 0;
|
||||
|
||||
if( m_editFileName->Text.Length()==0 ){
|
||||
m_editFileName->SetFocus();
|
||||
}
|
||||
else{
|
||||
string strName = AnsiString(m_editFileName->Text.Trim().c_str()).c_str();
|
||||
DWORD dwParam = m_aParams[m_cbSegType->DefItemIndex];
|
||||
int segType = HIWORD( dwParam ),
|
||||
segNo = LOWORD( dwParam ),
|
||||
errCode = 0;
|
||||
char tracks[16][3];
|
||||
memset( tracks, -1, sizeof(tracks) );
|
||||
TStyleItem* pStyItem = m_pStylePanel->GetStyleItem();
|
||||
|
||||
UINT idLoc = -1, idStyle = 0;
|
||||
TPROSTYLE* pStyle = pStyItem->pStyle;
|
||||
if( pStyle && pStyle->idLoc!=0 && pStyle->idLoc!=(UINT)-1 ){
|
||||
for( int i=0; i<pStyItem->aItems->Count; i++ ){
|
||||
TSegmentItem* pSeg = (TSegmentItem*)pStyItem->aItems->Items[i];
|
||||
for( int j=0; j<pSeg->aItems->Count; j++ ){
|
||||
TTrackItem* pTrk = (TTrackItem*)pSeg->aItems->Items[j];
|
||||
if( pTrk->pStyle==pStyle ){
|
||||
idLoc = pStyle->idLoc;
|
||||
idStyle = pStyle->idStyle;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int nBars = f_CM_AddTempSegment( idLoc, idStyle, (char*)strName.c_str(), g_iMelodyTimeSignature,
|
||||
g_nMelodyTempo, segType, segNo, errCode, tracks );
|
||||
|
||||
if( nBars<0 ){ //添加失败
|
||||
if( errCode & E_FileFormatError )
|
||||
iTip = 2;
|
||||
else if( errCode & E_WrongMIDIFormat )
|
||||
iTip = 3;
|
||||
else if( errCode & E_TSConflict )
|
||||
iTip = 4;
|
||||
else if( errCode & E_TempoConfilict )
|
||||
iTip = 5;
|
||||
else if( errCode & E_LessBarsNum )
|
||||
iTip = 6;
|
||||
else if( errCode & E_MoreBarsNum ){
|
||||
if( segType==SEGTYPE_FILL )
|
||||
iTip = 7;
|
||||
else
|
||||
iTip = 8;
|
||||
}
|
||||
else if( errCode & E_EmptySegment )
|
||||
iTip = 9;
|
||||
}
|
||||
else{ //添加成功
|
||||
TPROSTYLE* pTmpStyle = GetStyleInfo( -1, 0 );
|
||||
if( !pTmpStyle ){
|
||||
pTmpStyle = new TPROSTYLE;
|
||||
pTmpStyle->idLoc = -1;
|
||||
pTmpStyle->idStyle = 0;
|
||||
g_aTempStyles.push_back( pTmpStyle );
|
||||
}
|
||||
|
||||
DWORD opts = OPT_DEL | OPT_VOL | (segType<SEGTYPE_INTRO ? OPT_BRUSH : 0);
|
||||
TSegmentItem* pSegItem = new TSegmentItem( pStyItem, segType, LOWORD( dwParam ),
|
||||
opts, 0, LOWORD( dwParam ), 100 );
|
||||
|
||||
opts = OPT_DEL|OPT_FONTPROG|OPT_VOL | (segType<SEGTYPE_INTRO ? OPT_TEXTURE : 0);
|
||||
for( int i=0; i<16; i++ ){
|
||||
if( tracks[i][0]>=0 ){
|
||||
pSegItem->AddTrack( pTmpStyle, segNo,
|
||||
tracks[i][0],
|
||||
tracks[i][1],
|
||||
tracks[i][2],
|
||||
opts );
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
if( pStyle && pStyle->idLoc!=0 && pStyle->idLoc!=(UINT)-1 ){
|
||||
for( int i=0; i<pStyItem->aItems->Count; i++ ){
|
||||
TSegmentItem* pSeg = (TSegmentItem*)pStyItem->aItems->Items[i];
|
||||
for( int j=0; j<pSeg->aItems->Count; j++ ){
|
||||
TTrackItem* pTrk = (TTrackItem*)pSeg->aItems->Items[j];
|
||||
if( pTrk->pStyle==pStyle ){
|
||||
pTrk->pStyle = pTmpStyle;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( segType>=SEGTYPE_INTRO ){
|
||||
pSegItem->nBars = nBars;
|
||||
}
|
||||
|
||||
g_strSegImportPath = ExtractFilePath( m_editFileName->Text ).c_str();
|
||||
|
||||
m_pStylePanel->AddTempSegment( pSegItem );
|
||||
|
||||
SetSegType();
|
||||
|
||||
if( m_cbSegType->ItemsCount==0 ){
|
||||
iTip = 1;
|
||||
m_btnBrowse->Enabled = false;
|
||||
m_btnOk->Enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_lblTips->Font->Color = iTip<2 ? 0x00DACBBF : 0x004040FF;
|
||||
m_lblTips->Caption = strTips[iTip];
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TImportSegmentForm::BrowseClick(TObject *Sender)
|
||||
{
|
||||
TOpenDialog * pDlg = new TOpenDialog(NULL);
|
||||
pDlg->Options << ofFileMustExist;
|
||||
pDlg->Title = L"导入";
|
||||
if( m_editFileName->Text.Length()>0 ){
|
||||
pDlg->FileName = ExtractFileName(m_editFileName->Text);
|
||||
pDlg->InitialDir = ExtractFilePath(m_editFileName->Text);
|
||||
}
|
||||
else{
|
||||
pDlg->InitialDir = g_strSegImportPath.c_str();
|
||||
}
|
||||
|
||||
|
||||
pDlg->Filter = "midi文件 (*.mid)|*.MID";
|
||||
|
||||
if(pDlg->Execute(Handle)){
|
||||
m_editFileName->Text = pDlg->FileName;
|
||||
}
|
||||
|
||||
delete pDlg;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
void __fastcall TImportSegmentForm::FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift)
|
||||
{
|
||||
switch( Key ){
|
||||
case VK_RETURN:
|
||||
if(m_btnOk->Enabled)
|
||||
OkClick(NULL);
|
||||
break;
|
||||
|
||||
case VK_ESCAPE:
|
||||
ModalResult = mrCancel;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TImportSegmentForm::FormCreate(TObject *Sender)
|
||||
{
|
||||
m_panelBk->Font->Size = g_szFont9;
|
||||
m_btnBrowse->FontSize = g_szFont9;
|
||||
m_btnCancel->FontSize = g_szFont9;
|
||||
m_btnOk->FontSize = g_szFont9;
|
||||
m_cbSegType->SetFont(g_strTxtFontName, g_szFont9);
|
||||
m_editFileName->SetTextFont(g_strTxtFontName, g_szFont9);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
object ImportSegmentForm: TImportSegmentForm
|
||||
Left = 0
|
||||
Top = 0
|
||||
BorderIcons = []
|
||||
BorderStyle = bsNone
|
||||
ClientHeight = 184
|
||||
ClientWidth = 423
|
||||
Color = clBtnFace
|
||||
DoubleBuffered = True
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
KeyPreview = True
|
||||
Position = poMainFormCenter
|
||||
Scaled = False
|
||||
OnCreate = FormCreate
|
||||
OnKeyDown = FormKeyDown
|
||||
TextHeight = 13
|
||||
object m_panelBk: TGeneralDialogPanel
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 423
|
||||
Height = 184
|
||||
Align = alClient
|
||||
Caption = #23548#20837'MIDI'#29255#27573
|
||||
Color = 5064257
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentBackground = False
|
||||
ParentFont = False
|
||||
TabOrder = 0
|
||||
object m_lblFileName: TLabel
|
||||
Left = 32
|
||||
Top = 53
|
||||
Width = 61
|
||||
Height = 14
|
||||
Caption = 'MIDI'#25991#20214#65306
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 14339007
|
||||
Font.Height = -12
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
Layout = tlCenter
|
||||
end
|
||||
object m_btnBrowse: TTextButton
|
||||
Left = 325
|
||||
Top = 48
|
||||
Width = 60
|
||||
Height = 24
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
OnClick = BrowseClick
|
||||
Text = #27983#35272
|
||||
end
|
||||
object m_btnCancel: TTextButton
|
||||
Left = 310
|
||||
Top = 134
|
||||
Width = 75
|
||||
Height = 24
|
||||
ModalResult = mrCancel
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
Text = #36864#20986
|
||||
end
|
||||
object m_btnOk: TTextButton
|
||||
Left = 310
|
||||
Top = 97
|
||||
Width = 75
|
||||
Height = 24
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
OnClick = OkClick
|
||||
Text = #28155#21152
|
||||
end
|
||||
object m_lblTips: TLabel
|
||||
Left = 32
|
||||
Top = 144
|
||||
Width = 238
|
||||
Height = 14
|
||||
Caption = #25552#31034#65306#35831#36873#25321#23548#20837#30340'MIDI'#25991#20214#21644#29255#27573#31867#22411
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 14339007
|
||||
Font.Height = -12
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
ShowAccelChar = False
|
||||
Layout = tlCenter
|
||||
end
|
||||
object m_lblSegType: TLabel
|
||||
Left = 32
|
||||
Top = 100
|
||||
Width = 60
|
||||
Height = 14
|
||||
Caption = #29255#27573#31867#22411#65306
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 14339007
|
||||
Font.Height = -12
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
Layout = tlCenter
|
||||
end
|
||||
object m_cbSegType: TComboBoxComponent
|
||||
Left = 99
|
||||
Top = 97
|
||||
Width = 102
|
||||
Height = 24
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
ItemHeight = 18
|
||||
ShowItemCount = 6
|
||||
Parent = m_panelBk
|
||||
end
|
||||
object m_editFileName: TLineEdit
|
||||
Left = 97
|
||||
Top = 48
|
||||
Width = 220
|
||||
Height = 24
|
||||
NumberMax = -1
|
||||
NumberMin = -1
|
||||
TabOrder = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,52 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ImportSegmentFormUnitH
|
||||
#define ImportSegmentFormUnitH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <System.Classes.hpp>
|
||||
#include <Vcl.Controls.hpp>
|
||||
#include <Vcl.StdCtrls.hpp>
|
||||
#include <Vcl.Forms.hpp>
|
||||
|
||||
#include "GlobalUnit.h"
|
||||
#include "StyleItem.h"
|
||||
#include "ComboBoxComponent.h"
|
||||
#include "GeneralDialogPanel.h"
|
||||
#include "LineEdit.h"
|
||||
#include "TextButton.h"
|
||||
#include "PreStylePanel.h"
|
||||
#include <Vcl.ExtCtrls.hpp>
|
||||
//#include <Vcl.ExtCtrls.hpp>
|
||||
//---------------------------------------------------------------------------
|
||||
class TImportSegmentForm : public TForm
|
||||
{
|
||||
__published: // IDE-managed Components
|
||||
TLabel *m_lblFileName;
|
||||
TLabel *m_lblSegType;
|
||||
TGeneralDialogPanel *m_panelBk;
|
||||
TLineEdit *m_editFileName;
|
||||
TTextButton *m_btnBrowse;
|
||||
TTextButton *m_btnCancel;
|
||||
TTextButton *m_btnOk;
|
||||
TLabel *m_lblTips;
|
||||
TComboBoxComponent *m_cbSegType;
|
||||
void __fastcall OkClick(TObject *Sender);
|
||||
void __fastcall BrowseClick(TObject *Sender);
|
||||
void __fastcall FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift);
|
||||
void __fastcall FormCreate(TObject *Sender);
|
||||
private: // User declarations
|
||||
// TStyleItem* m_pStyItem;
|
||||
// TSegmentItem* m_pSegItem;
|
||||
TPreStylePanel* m_pStylePanel;
|
||||
vector<DWORD> m_aParams;
|
||||
|
||||
void SetSegType();
|
||||
public: // User declarations
|
||||
__fastcall TImportSegmentForm(TComponent* Owner, TPreStylePanel* pStylePanel );
|
||||
|
||||
// TSegmentItem* GetTempSegment() { return m_pSegItem; };
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
extern PACKAGE TImportSegmentForm *ImportSegmentForm;
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
@@ -0,0 +1,374 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#pragma hdrstop
|
||||
|
||||
#include "Instruments.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
|
||||
char *GM_GROUP[] = {
|
||||
"钢琴",
|
||||
"音阶打击乐器",
|
||||
"风琴",
|
||||
"吉他",
|
||||
"贝司",
|
||||
"弦乐",
|
||||
"合奏/合唱",
|
||||
"铜管",
|
||||
"簧管",
|
||||
"木管",
|
||||
"合成主音",
|
||||
"合成背景",
|
||||
"合成效果",
|
||||
"民间乐器",
|
||||
"打击乐器",
|
||||
"声音效果"
|
||||
};
|
||||
|
||||
char * GM_INSTRUMENT[] = {
|
||||
//钢琴组
|
||||
"大钢琴"
|
||||
,"明亮钢琴"
|
||||
,"电钢琴"
|
||||
,"酒吧钢琴"
|
||||
,"柔和电钢琴"
|
||||
,"合唱电钢琴"
|
||||
,"拨弦古钢琴"
|
||||
,"击弦古钢琴"
|
||||
|
||||
//打击乐器组
|
||||
,"钢片琴"
|
||||
,"钟琴"
|
||||
,"八音盒"
|
||||
,"颤音琴"
|
||||
,"马林巴"
|
||||
,"木琴"
|
||||
,"管钟"
|
||||
,"杨琴"
|
||||
|
||||
//风琴组
|
||||
,"击杆风琴"
|
||||
,"打击式风琴"
|
||||
,"摇滚风琴"
|
||||
,"教堂风琴"
|
||||
,"簧管风琴"
|
||||
,"手风琴"
|
||||
,"口琴"
|
||||
,"探戈手风琴"
|
||||
|
||||
//吉他组
|
||||
,"尼龙弦吉他"
|
||||
,"钢弦吉他"
|
||||
,"爵士电吉他"
|
||||
,"清音电吉他"
|
||||
,"闷音电吉他"
|
||||
,"过激电吉他"
|
||||
,"失真电吉他"
|
||||
,"吉他泛音"
|
||||
|
||||
//贝司组
|
||||
,"原音贝司"
|
||||
,"指弹电贝司"
|
||||
,"拨片电贝司"
|
||||
,"无品贝司"
|
||||
,"掌击贝司1"
|
||||
,"掌击贝司2"
|
||||
,"合成贝司1"
|
||||
,"合成贝司2"
|
||||
|
||||
//提琴组
|
||||
,"小提琴"
|
||||
,"中提琴"
|
||||
,"大提琴"
|
||||
,"低音大提琴"
|
||||
,"颤音弦乐组"
|
||||
,"拨奏弦乐组"
|
||||
,"竖琴"
|
||||
,"定音鼓"
|
||||
|
||||
//合奏/合唱组
|
||||
,"弦乐合奏1"
|
||||
,"弦乐合奏2"
|
||||
,"合成弦乐合奏1"
|
||||
,"合成弦乐合奏2"
|
||||
,"人声合唱(啊)"
|
||||
,"人声合唱(嘟)"
|
||||
,"合成人声"
|
||||
,"管弦乐齐奏"
|
||||
|
||||
//铜管乐器组
|
||||
,"小号"
|
||||
,"长号"
|
||||
,"大号"
|
||||
,"弱音小号"
|
||||
,"圆号"
|
||||
,"铜管组"
|
||||
,"合成铜管1"
|
||||
,"合成铜管2"
|
||||
|
||||
//簧片乐器组
|
||||
,"高音萨克斯"
|
||||
,"中音萨克斯"
|
||||
,"次中音萨克斯"
|
||||
,"低音萨克斯"
|
||||
,"双簧管"
|
||||
,"英国管"
|
||||
,"巴松(大管)"
|
||||
,"单簧管(黑管)"
|
||||
|
||||
//木管乐器组
|
||||
,"短笛"
|
||||
,"长笛"
|
||||
,"竖笛"
|
||||
,"排箫"
|
||||
,"吹瓶"
|
||||
,"日本尺八"
|
||||
,"口哨声"
|
||||
,"陶笛(洋埙)"
|
||||
|
||||
//合成主音组
|
||||
,"合成主音1(方波)"
|
||||
,"合成主音2(锯齿波)"
|
||||
,"合成主音3"
|
||||
,"合成主音4"
|
||||
,"合成主音5"
|
||||
,"合成主音6(人声)"
|
||||
,"合成主音7(平行五度)"
|
||||
,"合成主音8(贝司与主音)"
|
||||
|
||||
//合成背景组
|
||||
,"合成背景1(新时代)"
|
||||
,"合成背景2(温暖)"
|
||||
,"合成背景3"
|
||||
,"合成背景4(合唱)"
|
||||
,"合成背景5(弓弦)"
|
||||
,"合成背景6(金属)"
|
||||
,"合成背景7(光环)"
|
||||
,"合成背景8"
|
||||
|
||||
//合成效果组
|
||||
,"效果(雨声)"
|
||||
,"效果(音轨)"
|
||||
,"效果(水晶)"
|
||||
,"效果(大气)"
|
||||
,"效果(明亮)"
|
||||
,"效果(诡异)"
|
||||
,"效果(回声)"
|
||||
,"效果(科幻)"
|
||||
|
||||
//民族乐器组
|
||||
,"西塔尔"
|
||||
,"班卓琴"
|
||||
,"三昧线"
|
||||
,"十三弦筝"
|
||||
,"卡林巴"
|
||||
,"风笛"
|
||||
,"民族提琴"
|
||||
,"山奈"
|
||||
|
||||
//打击乐器组
|
||||
,"叮当铃"
|
||||
,"阿果果"
|
||||
,"钢鼓"
|
||||
,"木鱼"
|
||||
,"太鼓"
|
||||
,"通通鼓"
|
||||
,"合成鼓"
|
||||
,"钢钹"
|
||||
|
||||
//特殊音效组
|
||||
,"吉他换把杂音"
|
||||
,"呼吸声"
|
||||
,"海浪声"
|
||||
,"鸟鸣"
|
||||
,"电话铃"
|
||||
,"直升飞机"
|
||||
,"鼓掌声"
|
||||
,"枪声"
|
||||
};
|
||||
|
||||
char * LSZ_STYLTYPES[24] =
|
||||
{
|
||||
"流行",
|
||||
"民谣",
|
||||
"摇滚",
|
||||
"舞曲",
|
||||
"爵士",
|
||||
"蓝调",
|
||||
"桑巴",
|
||||
"古典",
|
||||
"圆舞曲",
|
||||
"独立",
|
||||
"乡村",
|
||||
"R&B",
|
||||
"电子",
|
||||
"小夜曲",
|
||||
"进行曲",
|
||||
"叙事曲",
|
||||
"说唱",
|
||||
"拉丁",
|
||||
"曼波",
|
||||
"雷鬼",
|
||||
"萨尔萨",
|
||||
"摇摆",
|
||||
"波萨",
|
||||
"FUNKY"
|
||||
} ;
|
||||
|
||||
char * CNS_INSTRUMENT[] = {
|
||||
//吹奏类
|
||||
"",
|
||||
"大唢呐",
|
||||
"小唢呐",
|
||||
"高笙",
|
||||
"曲笛",
|
||||
"曲笛2",
|
||||
"梆笛",
|
||||
"梆笛2",
|
||||
"巴乌",
|
||||
|
||||
//弦乐类
|
||||
"二胡",
|
||||
"高胡",
|
||||
"京胡",
|
||||
"板胡",
|
||||
|
||||
//弹奏类
|
||||
"琵琶1",
|
||||
"琵琶2",
|
||||
"阮",
|
||||
"三弦",
|
||||
"扬琴",
|
||||
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
|
||||
//打击乐
|
||||
"朝鲜鼓",
|
||||
"大鼓",
|
||||
"大鼓1",
|
||||
"大鼓2",
|
||||
"打击乐",
|
||||
"大锣",
|
||||
"风锣",
|
||||
"京戏",
|
||||
"锣",
|
||||
"铙钹镲",
|
||||
"排鼓",
|
||||
"声波",
|
||||
"象脚鼓",
|
||||
"编磬",
|
||||
"编钟"
|
||||
};
|
||||
|
||||
FONTINFO::FONTINFO()
|
||||
{
|
||||
memset( this, 0, sizeof(FONTINFO) );
|
||||
}
|
||||
|
||||
FONTINFO::FONTINFO( char* strFile, char* strFont, int nInst, FONTPRESET* setInst,
|
||||
int nDrum, FONTPRESET* setDrum )
|
||||
{
|
||||
strcpy(strFileName, strFile);
|
||||
|
||||
if( strlen(strFont) > 0 )
|
||||
strcpy(strFontName, strFont);
|
||||
else{
|
||||
char *name = strrchr( strFile, '\\' )+1,
|
||||
*ext = strrchr( strFile, '.' );
|
||||
|
||||
if( ext>name ){
|
||||
strncpy( strFontName, name, ext-name );
|
||||
strFontName[ext-name] = '\0';
|
||||
}
|
||||
else
|
||||
strcpy(strFontName, name );
|
||||
}
|
||||
|
||||
nInstCount = nInst;
|
||||
if( nInst>0 ){
|
||||
aInsts = new FONTPRESET[nInst];
|
||||
memcpy( aInsts, setInst, sizeof(FONTPRESET) * nInst );
|
||||
}
|
||||
else{
|
||||
aInsts = NULL;
|
||||
}
|
||||
|
||||
nDrumCount = nDrum;
|
||||
if( nDrum>0 ){
|
||||
aDrums = new FONTPRESET[nDrum];
|
||||
memcpy( aDrums, setDrum, sizeof(FONTPRESET) * nDrum );
|
||||
}
|
||||
else{
|
||||
aDrums = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
VSTINFO::VSTINFO()
|
||||
{
|
||||
memset( this, 0, sizeof(VSTINFO) );
|
||||
}
|
||||
|
||||
VSTINFO::VSTINFO( char* strFile, char* strEff, unsigned int id )
|
||||
{
|
||||
uniqueID = id;
|
||||
strcpy(strFileName, strFile);
|
||||
|
||||
if( strlen(strEff) > 0 && stricmp(strEff, "container") )
|
||||
strcpy(strVSTName, strEff);
|
||||
else{
|
||||
char *name = strrchr( strFile, '\\' )+1,
|
||||
*ext = strrchr( strFile, '.' );
|
||||
|
||||
if( ext>name ){
|
||||
strncpy( strVSTName, name, ext-name );
|
||||
strVSTName[ext-name] = '\0';
|
||||
}
|
||||
else
|
||||
strcpy(strVSTName, name );
|
||||
}
|
||||
}
|
||||
|
||||
VSTINFO::~VSTINFO()
|
||||
{
|
||||
while( !aPlugins.empty() ){
|
||||
delete aPlugins.back();
|
||||
aPlugins.pop_back();
|
||||
}
|
||||
}
|
||||
|
||||
char AutoTransCNS( char prog )
|
||||
{
|
||||
char ret = -1;
|
||||
|
||||
if( prog>=8 && prog<=15 )
|
||||
ret = 17;
|
||||
else if( prog>=16 && prog<=23 )
|
||||
ret = 9;//3;
|
||||
else if( prog>=40 && prog<=45 )
|
||||
ret = 9;
|
||||
else if( prog==46 )
|
||||
ret = 13;
|
||||
else if( prog==47 )
|
||||
ret = 31;
|
||||
else if( prog>=56 && prog<=63 )
|
||||
ret = 1;
|
||||
else if( prog>=64 && prog<=71 )
|
||||
ret = 4;
|
||||
else if( prog>=72 && prog<=79 )
|
||||
ret = 6;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef InstrumentsH
|
||||
#define InstrumentsH
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
struct FONTPRESET{
|
||||
char text[40];
|
||||
int id;
|
||||
};
|
||||
|
||||
class FONTINFO
|
||||
{
|
||||
public:
|
||||
char strFileName[256];
|
||||
char strFontName[80];
|
||||
FONTPRESET* aInsts;
|
||||
int nInstCount;
|
||||
FONTPRESET* aDrums;
|
||||
int nDrumCount;
|
||||
|
||||
FONTINFO();
|
||||
FONTINFO( char* strFile, char* strFont, int nInst, FONTPRESET* setInst,
|
||||
int nDrum, FONTPRESET* setDrum );
|
||||
};
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
|
||||
#define VSTeffect 1
|
||||
#define VSTinstrument 2
|
||||
#define VSTshell 4
|
||||
|
||||
struct VSTPLUGIN{
|
||||
char name[64];
|
||||
unsigned int id;
|
||||
};
|
||||
|
||||
class VSTINFO
|
||||
{
|
||||
public:
|
||||
char strFileName[256];
|
||||
char strVSTName[80];
|
||||
unsigned int uniqueID;
|
||||
vector<VSTPLUGIN*> aPlugins;
|
||||
|
||||
VSTINFO();
|
||||
VSTINFO( char* strFile, char* strEff, unsigned int id );
|
||||
~VSTINFO();
|
||||
};
|
||||
|
||||
typedef vector<FONTINFO*> FONTINFOLIST;
|
||||
typedef vector<VSTINFO*> VSTINFOLIST;
|
||||
|
||||
extern char * GM_GROUP[];
|
||||
extern char * GM_INSTRUMENT[];
|
||||
extern char * LSZ_STYLTYPES[];
|
||||
extern char * CNS_INSTRUMENT[];
|
||||
|
||||
char AutoTransCNS( char prog );
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,325 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#pragma hdrstop
|
||||
|
||||
#include "KeyBoard.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
|
||||
__fastcall TKeyBoard::TKeyBoard(TComponent* Owner)
|
||||
: Vcl::Extctrls::TPanel(Owner)
|
||||
{
|
||||
Height = 145;
|
||||
Width = 430;
|
||||
Left = 150;
|
||||
Top = 500;
|
||||
|
||||
m_pBmpWhiteDDown = new TBitmap();
|
||||
m_pBmpWhiteDDown->LoadFromResourceName(int(HInstance), "KBWhiteDDown");
|
||||
m_pBmpWhiteLDown = new TBitmap();
|
||||
m_pBmpWhiteLDown->LoadFromResourceName(int(HInstance), "KBWhiteLDown");
|
||||
m_pBmpWhiteRDown = new TBitmap();
|
||||
m_pBmpWhiteRDown->LoadFromResourceName(int(HInstance), "KBWhiteRDown");
|
||||
m_pBmpBlackDown = new TBitmap();
|
||||
m_pBmpBlackDown->LoadFromResourceName(int(HInstance), "KBBlackDown");
|
||||
m_nBlackWidth = m_pBmpBlackDown->Width;
|
||||
m_nBlackHeight = m_pBmpBlackDown->Height;
|
||||
m_nWhiteWidth = m_pBmpWhiteDDown->Width;
|
||||
m_nGroupWidth = m_nWhiteWidth * 7;
|
||||
|
||||
m_aBlackHitTest[0].x1 = 12;
|
||||
m_aBlackHitTest[0].iKey = 1;
|
||||
m_aBlackHitTest[1].x1 = 32;
|
||||
m_aBlackHitTest[1].iKey = 3;
|
||||
m_aBlackHitTest[2].x1 = 72;
|
||||
m_aBlackHitTest[2].iKey = 6;
|
||||
m_aBlackHitTest[3].x1 = 92;
|
||||
m_aBlackHitTest[3].iKey = 8;
|
||||
m_aBlackHitTest[4].x1 = 112;
|
||||
m_aBlackHitTest[4].iKey = 10;
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
m_aBlackHitTest[i].x2 = m_aBlackHitTest[i].x1 + m_pBmpBlackDown->Width;
|
||||
|
||||
m_aKey[0].xPos = -1;
|
||||
m_aKey[0].pBmp = m_pBmpWhiteRDown;
|
||||
m_aKey[1].xPos = 12;
|
||||
m_aKey[1].pBmp = m_pBmpBlackDown;
|
||||
m_aKey[2].xPos = 19;
|
||||
m_aKey[2].pBmp = m_pBmpWhiteDDown;
|
||||
m_aKey[3].xPos = 32;
|
||||
m_aKey[3].pBmp = m_pBmpBlackDown;
|
||||
m_aKey[4].xPos = 39;
|
||||
m_aKey[4].pBmp = m_pBmpWhiteLDown;
|
||||
m_aKey[5].xPos = 59;
|
||||
m_aKey[5].pBmp = m_pBmpWhiteRDown;
|
||||
m_aKey[6].xPos = 72;
|
||||
m_aKey[6].pBmp = m_pBmpBlackDown;
|
||||
m_aKey[7].xPos = 79;
|
||||
m_aKey[7].pBmp = m_pBmpWhiteDDown;
|
||||
m_aKey[8].xPos = 92;
|
||||
m_aKey[8].pBmp = m_pBmpBlackDown;
|
||||
m_aKey[9].xPos = 99;
|
||||
m_aKey[9].pBmp = m_pBmpWhiteDDown;
|
||||
m_aKey[10].xPos = 112;
|
||||
m_aKey[10].pBmp = m_pBmpBlackDown;
|
||||
m_aKey[11].xPos = 119;
|
||||
m_aKey[11].pBmp = m_pBmpWhiteLDown;
|
||||
|
||||
m_iPressGroup = m_iPressKey = -1;
|
||||
|
||||
//背景
|
||||
m_ImgBrk = new TPngImage();
|
||||
m_ImgBrk->LoadFromResourceName(int(HInstance), "KeyBoard");
|
||||
|
||||
m_imgKeyboard = new TImage(this);
|
||||
m_imgKeyboard->Parent = this;
|
||||
m_imgKeyboard->Picture->Assign(m_ImgBrk);
|
||||
m_imgKeyboard->Left = 0;
|
||||
m_imgKeyboard->Top = 0;
|
||||
m_imgKeyboard->Width = Width;
|
||||
m_imgKeyboard->Height = Height;
|
||||
|
||||
m_imgKeyboard->Visible = true;
|
||||
|
||||
//PaintBox
|
||||
m_pbKeyboard = new TPaintBox(this);
|
||||
m_pbKeyboard->Parent = this;
|
||||
m_pbKeyboard->Left = 6;
|
||||
m_pbKeyboard->Top = 19; // Will be Change!
|
||||
m_pbKeyboard->Width = 420;
|
||||
m_pbKeyboard->Height = 121;
|
||||
m_pbKeyboard->OnPaint = KeyboardPaint;
|
||||
m_pbKeyboard->OnMouseDown = KeyboardMouseDown;
|
||||
m_pbKeyboard->OnMouseEnter = KeyboardMouseEnter;
|
||||
m_pbKeyboard->OnMouseLeave = KeyboardMouseLeave;
|
||||
m_pbKeyboard->OnMouseMove = KeyboardMouseMove;
|
||||
m_pbKeyboard->OnMouseUp = KeyboardMouseUp;
|
||||
m_pbKeyboard->Visible = true;
|
||||
|
||||
//PNG Close
|
||||
m_ImgClose = new TPngImage();
|
||||
m_ImgClose->LoadFromResourceName(int(HInstance), "imgClose");
|
||||
|
||||
m_PngClose = new TPNGButton(this);
|
||||
m_PngClose->Parent = this;
|
||||
m_PngClose->OnClick = CloseClick;
|
||||
m_PngClose->ImgStates = 3;
|
||||
m_PngClose->PngImg = m_ImgClose;
|
||||
m_PngClose->Top = 0;
|
||||
m_PngClose->Left = Width - 23;
|
||||
m_PngClose->Visible = true;
|
||||
}
|
||||
|
||||
__fastcall TKeyBoard::~TKeyBoard()
|
||||
{
|
||||
delete m_PngClose;
|
||||
m_PngClose = NULL;
|
||||
|
||||
delete m_imgKeyboard;
|
||||
m_imgKeyboard = NULL;
|
||||
|
||||
delete m_pbKeyboard;
|
||||
m_pbKeyboard = NULL;
|
||||
|
||||
delete m_pBmpWhiteDDown;
|
||||
m_pBmpWhiteDDown = NULL;
|
||||
|
||||
delete m_pBmpWhiteLDown;
|
||||
m_pBmpWhiteLDown = NULL;
|
||||
|
||||
delete m_pBmpWhiteRDown;
|
||||
m_pBmpWhiteRDown = NULL;
|
||||
|
||||
delete m_pBmpBlackDown;
|
||||
m_pBmpBlackDown = NULL;
|
||||
|
||||
delete m_imgFirst;
|
||||
m_imgFirst = NULL;
|
||||
|
||||
delete m_imgSecond;
|
||||
m_imgSecond = NULL;
|
||||
|
||||
delete m_imgThird;
|
||||
m_imgThird = NULL;
|
||||
|
||||
delete m_imgForth;
|
||||
m_imgForth = NULL;
|
||||
|
||||
delete m_ImgClose; //关闭
|
||||
m_ImgClose = NULL;
|
||||
|
||||
delete m_ImgBrk; //钢琴背景
|
||||
m_ImgBrk = NULL;
|
||||
}
|
||||
|
||||
// 模拟键盘相关
|
||||
int TKeyBoard::KeyboardGetPressKey(int X, int Y) {
|
||||
short iPressKey = -1, iPressGroup = X / m_nGroupWidth;
|
||||
int xInGroup = X % m_nGroupWidth;
|
||||
|
||||
int iWhite = xInGroup / m_nWhiteWidth;
|
||||
if (iWhite < 3)
|
||||
iPressKey = iWhite * 2;
|
||||
else
|
||||
iPressKey = iWhite * 2 - 1;
|
||||
|
||||
if (Y < m_nBlackHeight) {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
if (xInGroup >= m_aBlackHitTest[i].x1 && xInGroup <
|
||||
m_aBlackHitTest[i].x2) {
|
||||
iPressKey = m_aBlackHitTest[i].iKey;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return MAKELONG(iPressKey, iPressGroup);
|
||||
}
|
||||
|
||||
|
||||
void __fastcall TKeyBoard::KeyboardPaint(TObject *Sender)
|
||||
{
|
||||
//
|
||||
if (m_bKeyDown) {
|
||||
int xPos = m_iPressGroup * m_nGroupWidth + m_aKey[m_iPressKey].xPos;
|
||||
m_pbKeyboard->Canvas->Draw(xPos, 0, m_aKey[m_iPressKey].pBmp);
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TKeyBoard::KeyboardMouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift,
|
||||
int X, int Y)
|
||||
{
|
||||
//mouseup
|
||||
if (Button == mbLeft && m_bKeyDown) {
|
||||
m_bKeyDown = false;
|
||||
|
||||
f_MM_RealTimeMIDINoteOff(m_iPressGroup*12 + m_iPressKey + 48);
|
||||
|
||||
TRect rect;
|
||||
rect.init(m_iPressGroup * m_nGroupWidth + m_aKey[m_iPressKey].xPos + 6,
|
||||
19,
|
||||
m_iPressGroup * m_nGroupWidth + m_aKey[m_iPressKey].xPos + 26,
|
||||
m_pbKeyboard->Height+19);
|
||||
|
||||
m_iPressGroup = m_iPressKey = -1;
|
||||
|
||||
InvalidateRect(m_pbKeyboard->Parent->Handle,&rect,true);
|
||||
// m_pbKeyboard->Invalidate();
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TKeyBoard::KeyboardMouseMove(TObject *Sender, TShiftState Shift, int X,
|
||||
int Y)
|
||||
{
|
||||
if (m_bKeyDown && X >= 0 && Y >= 0 && X < m_pbKeyboard->Width && Y <
|
||||
m_pbKeyboard->Height) {
|
||||
int iKey = KeyboardGetPressKey(X, Y);
|
||||
int iPressGroup = HIWORD(iKey);
|
||||
int iPressKey = LOWORD(iKey);
|
||||
|
||||
if (iPressGroup != m_iPressGroup || iPressKey != m_iPressKey) {
|
||||
HRESULT hRet = f_MM_RealTimeMIDINoteOff(m_iPressGroup * 12 + m_iPressKey + 48);
|
||||
hRet = f_MM_RealTimeMIDINoteOn( iPressGroup * 12 + iPressKey + 48);
|
||||
|
||||
TRect rect;
|
||||
|
||||
//更新原来区域
|
||||
rect.init(m_iPressGroup * m_nGroupWidth + m_aKey[m_iPressKey].xPos + 6,
|
||||
19,
|
||||
m_iPressGroup * m_nGroupWidth + m_aKey[m_iPressKey].xPos + 26,
|
||||
m_pbKeyboard->Height+19);
|
||||
|
||||
InvalidateRect(m_pbKeyboard->Parent->Handle,&rect,true);
|
||||
|
||||
m_iPressGroup = iPressGroup;
|
||||
m_iPressKey = iPressKey;
|
||||
|
||||
//更新新区域
|
||||
rect.init(m_iPressGroup * m_nGroupWidth + m_aKey[m_iPressKey].xPos + 6,
|
||||
19,
|
||||
m_iPressGroup * m_nGroupWidth + m_aKey[m_iPressKey].xPos + 26,
|
||||
m_pbKeyboard->Height+19);
|
||||
|
||||
InvalidateRect(m_pbKeyboard->Parent->Handle,&rect,true);
|
||||
|
||||
// m_pbKeyboard->Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TKeyBoard::KeyboardMouseLeave(TObject *Sender)
|
||||
{
|
||||
//
|
||||
Screen->Cursor = crDefault;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TKeyBoard::KeyboardMouseEnter(TObject *Sender)
|
||||
{
|
||||
//
|
||||
Screen->Cursor = crHandPoint;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TKeyBoard::KeyboardMouseDown(TObject *Sender, TMouseButton Button,
|
||||
TShiftState Shift, int X, int Y)
|
||||
{
|
||||
// TMouseButton Button, TShiftState Shift, int X, int Y) {
|
||||
if (Sender == m_pbKeyboard && Button == mbLeft) {
|
||||
m_bKeyDown = true;
|
||||
|
||||
int iKey = KeyboardGetPressKey(X, Y);
|
||||
int iPressGroup = HIWORD(iKey);
|
||||
int iPressKey = LOWORD(iKey);
|
||||
|
||||
if (iPressGroup != m_iPressGroup || iPressKey != m_iPressKey) {
|
||||
m_iPressGroup = iPressGroup;
|
||||
m_iPressKey = iPressKey;
|
||||
|
||||
HRESULT hRet =
|
||||
f_MM_RealTimeMIDINoteOn(m_iPressGroup * 12 + m_iPressKey + 48);
|
||||
|
||||
TRect rect;
|
||||
rect.init(m_iPressGroup * m_nGroupWidth + m_aKey[m_iPressKey].xPos + 6,
|
||||
19,
|
||||
m_iPressGroup * m_nGroupWidth + m_aKey[m_iPressKey].xPos + 26,
|
||||
m_pbKeyboard->Height+19);
|
||||
|
||||
InvalidateRect(m_pbKeyboard->Parent->Handle,&rect,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TKeyBoard::ShowKeyboard( bool bShow )
|
||||
{
|
||||
if( bShow ){
|
||||
// 创建模拟键盘设备
|
||||
HRESULT hResult = f_MM_CreateRealTimeMIDIStream( false );
|
||||
if (hResult != S_OK) {
|
||||
DebugPrint("Create realtime midi stream error.\n");
|
||||
}
|
||||
else{
|
||||
this->Show();
|
||||
}
|
||||
}
|
||||
else if( !bShow ){
|
||||
this->Hide();
|
||||
|
||||
// 释放模拟键盘设备
|
||||
HRESULT hResult = f_MM_FreeRealTimeMIDIStream();
|
||||
if (hResult != S_OK) {
|
||||
DebugPrint("Free realtime midi stream error.\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void __fastcall TKeyBoard::CloseClick(System::TObject* Sender)
|
||||
{
|
||||
// ShowKeyboard( false );
|
||||
Application->MainForm->Perform( UM_SHOW_KB, NULL, NULL );
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef KeyBoardH
|
||||
#define KeyBoardH
|
||||
#include <vcl.h>
|
||||
#include "PNGButton.hpp"
|
||||
#include "GlobalUnit.h"
|
||||
//---------------------------------------------------------------------------
|
||||
class TKeyBoard : public TPanel
|
||||
{
|
||||
|
||||
private:
|
||||
TPNGButton *m_PngClose;
|
||||
TImage *m_imgKeyboard;
|
||||
TPaintBox *m_pbKeyboard;
|
||||
|
||||
struct {
|
||||
int xPos;
|
||||
TBitmap * pBmp;
|
||||
} m_aKey[12];
|
||||
struct {
|
||||
int x1;
|
||||
int x2;
|
||||
int iKey;
|
||||
} m_aBlackHitTest[5];
|
||||
|
||||
bool m_bKeyDown;
|
||||
int m_nGroupWidth,
|
||||
m_nWhiteWidth,
|
||||
m_nBlackWidth,
|
||||
m_nBlackHeight,
|
||||
m_iPressGroup,
|
||||
m_iPressKey;
|
||||
|
||||
TBitmap * m_pBmpWhiteDDown,
|
||||
* m_pBmpWhiteLDown,
|
||||
* m_pBmpWhiteRDown,
|
||||
* m_pBmpBlackDown;
|
||||
|
||||
TPngImage * m_imgFirst,
|
||||
* m_imgSecond,
|
||||
* m_imgThird,
|
||||
* m_imgForth,
|
||||
* m_ImgClose, //¹Ø±Õ
|
||||
* m_ImgBrk; //¸ÖÇÙ±³¾°
|
||||
private:
|
||||
int KeyboardGetPressKey(int X, int Y);
|
||||
void __fastcall CloseClick(System::TObject* Sender);
|
||||
|
||||
void __fastcall KeyboardPaint(TObject *Sender);
|
||||
void __fastcall KeyboardMouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift,
|
||||
int X, int Y);
|
||||
void __fastcall KeyboardMouseMove(TObject *Sender, TShiftState Shift, int X, int Y);
|
||||
void __fastcall KeyboardMouseLeave(TObject *Sender);
|
||||
void __fastcall KeyboardMouseEnter(TObject *Sender);
|
||||
void __fastcall KeyboardMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift,
|
||||
int X, int Y);
|
||||
|
||||
public:
|
||||
void __fastcall ShowKeyboard( bool bShow );
|
||||
|
||||
__fastcall TKeyBoard(TComponent* Owner);
|
||||
__fastcall ~TKeyBoard();
|
||||
};
|
||||
#endif
|
||||
+186
@@ -0,0 +1,186 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef LineEditH
|
||||
#define LineEditH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl.h>
|
||||
//---------------------------------------------------------------------------
|
||||
class PACKAGE TLineEdit : public TWinControl
|
||||
{
|
||||
private:
|
||||
TEditCharCase FCharCase;
|
||||
TColor FBorderColor, // 边框颜色
|
||||
FShadowColor; // 阴影颜色
|
||||
TAlignment FAlignment;
|
||||
WideChar FPasswordChar;
|
||||
String FText;
|
||||
String FHintText;
|
||||
TColor FHintColor;
|
||||
bool FHideSelection,
|
||||
FNumbersOnly,
|
||||
FOEMConvert,
|
||||
FReadOnly;
|
||||
int FMaxLength,
|
||||
FNumberMax,
|
||||
FNumberMin;
|
||||
TNotifyEvent FOnChange;
|
||||
|
||||
TControlCanvas *m_Canvas;
|
||||
int m_ShadowColorArray[4]; // 阴影颜色数组
|
||||
int m_FontHeight; // 备份字体高度
|
||||
bool m_IsCreated;
|
||||
TLabel *m_HintLabel;
|
||||
TColor m_FontColor; // 备份字体颜色
|
||||
TRect m_TextRect;
|
||||
WCHAR m_TextBuf[512];
|
||||
|
||||
void __fastcall AdjustThisSize();
|
||||
|
||||
int __fastcall CalcColorValue(TColor BgColor, TColor FrColor, int Level, int Alpha);
|
||||
int __fastcall CalcFontHeight();
|
||||
void __fastcall CreateShadowColor(); // 创建阴影颜色
|
||||
|
||||
void __fastcall SetBorderColor(TColor Color);
|
||||
void __fastcall SetOnChange(TNotifyEvent OnChange);
|
||||
void __fastcall SetShadowColor(TColor Color);
|
||||
|
||||
void __fastcall ShowHintText();
|
||||
|
||||
/******************************************************************************/
|
||||
// 编辑框操作
|
||||
/******************************************************************************/
|
||||
void __fastcall DoHintLabelMouseDown(TObject *Sender,
|
||||
TMouseButton Button,
|
||||
TShiftState Shift, int X, int Y);
|
||||
|
||||
UnicodeString __fastcall GetText();
|
||||
|
||||
bool __fastcall GetCanUndo();
|
||||
int __fastcall GetSelLength();
|
||||
int __fastcall GetSelStart();
|
||||
String __fastcall GetSelText();
|
||||
|
||||
void __fastcall SetAlignment(TAlignment Value);
|
||||
void __fastcall SetCharCase(TEditCharCase Value);
|
||||
void __fastcall SetHideSelection(bool Value);
|
||||
void __fastcall SetHintText(String Value);
|
||||
void __fastcall SetHintColor(TColor Value);
|
||||
void __fastcall SetNumbersOnly(bool Value);
|
||||
void __fastcall SetOEMConvert(bool Value);
|
||||
void __fastcall SetPasswordChar(WideChar Value);
|
||||
void __fastcall SetReadOnly(bool Value);
|
||||
void __fastcall SetText(UnicodeString Value);
|
||||
|
||||
void __fastcall SetMaxLength(int Value);
|
||||
void __fastcall SetSelLength(int Value);
|
||||
void __fastcall SetSelStart(int Value);
|
||||
|
||||
void __fastcall SetNumberMax(int Value);
|
||||
void __fastcall SetNumberMin(int Value);
|
||||
/******************************************************************************/
|
||||
|
||||
MESSAGE void __fastcall CMColorChanged(TMessage &Message);
|
||||
MESSAGE void __fastcall CMFontChanged(TWMFontChange &Message);
|
||||
MESSAGE void __fastcall WMChar(TWMChar &Message);
|
||||
MESSAGE void __fastcall WMCommand(TWMCommand &Message);
|
||||
MESSAGE void __fastcall WMCtlColorEdit(TWMCtlColorEdit &Message);
|
||||
MESSAGE void __fastcall WMCtlColorStatic(TWMCtlColorStatic &Message);
|
||||
MESSAGE void __fastcall WMEraseBkgnd(TWMEraseBkgnd &Message);
|
||||
MESSAGE void __fastcall WMKeyDown(TWMKeyDown &Message);
|
||||
MESSAGE void __fastcall WMKillFocus(TWMKillFocus &Message);
|
||||
MESSAGE void __fastcall WMPaint(TWMPaint &Message);
|
||||
MESSAGE void __fastcall WMSetFocus(TWMSetFocus &Message);
|
||||
MESSAGE void __fastcall WMSize(TWMSize &Message);
|
||||
|
||||
BEGIN_MESSAGE_MAP
|
||||
MESSAGE_HANDLER(CM_COLORCHANGED, TMessage, CMColorChanged)
|
||||
MESSAGE_HANDLER(CM_FONTCHANGED, TWMFontChange, CMFontChanged)
|
||||
MESSAGE_HANDLER(CN_COMMAND, TWMCommand, WMCommand)
|
||||
MESSAGE_HANDLER(CN_CTLCOLOREDIT, TWMCtlColorEdit, WMCtlColorEdit)
|
||||
MESSAGE_HANDLER(CN_CTLCOLORSTATIC, TWMCtlColorStatic, WMCtlColorStatic)
|
||||
MESSAGE_HANDLER(WM_CHAR, TWMChar, WMChar)
|
||||
MESSAGE_HANDLER(WM_ERASEBKGND, TWMEraseBkgnd, WMEraseBkgnd)
|
||||
MESSAGE_HANDLER(WM_KEYDOWN, TWMKeyDown, WMKeyDown)
|
||||
MESSAGE_HANDLER(WM_KILLFOCUS, TWMKillFocus, WMKillFocus)
|
||||
MESSAGE_HANDLER(WM_PAINT, TWMPaint, WMPaint)
|
||||
MESSAGE_HANDLER(WM_SETFOCUS, TWMSetFocus, WMSetFocus)
|
||||
MESSAGE_HANDLER(WM_SIZE, TWMSize, WMSize)
|
||||
END_MESSAGE_MAP(TWinControl)
|
||||
|
||||
__property Hint;
|
||||
|
||||
protected:
|
||||
virtual void __fastcall CreateParams(TCreateParams &Params);
|
||||
virtual void __fastcall CreateWindowHandle(const TCreateParams &Params);
|
||||
virtual void __fastcall CreateWnd();
|
||||
|
||||
public:
|
||||
__fastcall TLineEdit(TComponent* Owner);
|
||||
__fastcall ~TLineEdit();
|
||||
|
||||
void __fastcall SetFocus();
|
||||
void __fastcall SetCursorPos(int Pos);
|
||||
void __fastcall SetTextFont(String name, int size);
|
||||
|
||||
/******************************************************************************/
|
||||
// 编辑框操作
|
||||
/******************************************************************************/
|
||||
void __fastcall Clear();
|
||||
void __fastcall ClearSelection();
|
||||
void __fastcall CopyToClipboard();
|
||||
void __fastcall CutToClipboard();
|
||||
|
||||
void __fastcall PasteFromClipboard();
|
||||
void __fastcall Undo();
|
||||
void __fastcall ClearUndo();
|
||||
void __fastcall SelectAll();
|
||||
|
||||
__property bool CanUndo = {read = GetCanUndo, nodefault};
|
||||
__property int SelLength = {read = GetSelLength, write = SetSelLength, nodefault};
|
||||
__property int SelStart = {read = GetSelStart, write = SetSelStart, nodefault};
|
||||
__property String SelText = {read = GetSelText};
|
||||
|
||||
__property AlignWithMargins = {default = false};
|
||||
__property HelpContext;
|
||||
__property HelpKeyword;
|
||||
__property HelpType;
|
||||
__property Margins;
|
||||
__property Cursor;
|
||||
/******************************************************************************/
|
||||
|
||||
__published:
|
||||
__property TColor BorderColor = {read = FBorderColor, write = SetBorderColor, default = TColor(0x5F5954)};
|
||||
__property TColor ShadowColor = {read = FShadowColor, write = SetShadowColor, default = TColor(0x4C463F)};
|
||||
|
||||
__property TNotifyEvent OnChange = {read = FOnChange, write = SetOnChange};
|
||||
|
||||
|
||||
__property TAlignment Alignment = {read = FAlignment, write = SetAlignment};
|
||||
__property TEditCharCase CharCase = {read = FCharCase, write = SetCharCase};
|
||||
|
||||
__property bool HideSelection = {read = FHideSelection, write = SetHideSelection};
|
||||
__property String HintText = {read = FHintText, write = SetHintText};
|
||||
__property TColor HintColor = {read = FHintColor, write = SetHintColor, default = TColor(0x594D43)};
|
||||
__property int MaxLength = {read = FMaxLength, write = SetMaxLength, default = 500};
|
||||
__property bool NumbersOnly = {read = FNumbersOnly, write = SetNumbersOnly};
|
||||
__property bool OEMConvert = {read = FOEMConvert, write = SetOEMConvert};
|
||||
__property WideChar PasswordChar = {read = FPasswordChar, write = SetPasswordChar};
|
||||
__property bool ReadOnly = {read = FReadOnly, write = SetReadOnly};
|
||||
|
||||
__property int NumberMax = {read = FNumberMax, write = SetNumberMax};
|
||||
__property int NumberMin = {read = FNumberMin, write = SetNumberMin};
|
||||
|
||||
__property UnicodeString Text = {read = GetText, write = SetText};
|
||||
|
||||
__property Color = {default = TColor(0xC4B4A8)};
|
||||
__property Font;
|
||||
|
||||
__property TabOrder = {default = -1};
|
||||
__property TabStop = {default = true};
|
||||
|
||||
__property OnKeyDown;
|
||||
__property OnKeyPress;
|
||||
__property OnKeyUp;
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
@@ -0,0 +1,567 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#pragma hdrstop
|
||||
|
||||
#include "ListPanel.h"
|
||||
#include "GlobalUnit.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
|
||||
#define LP_ITEM_OVER RGB(67, 73, 80)
|
||||
#define LP_ITEM_SELECTED RGB(29, 31, 35)
|
||||
#define LP_ITEM_DEF RGB(47, 50, 57)
|
||||
|
||||
#define IS_OVER 1
|
||||
#define IS_SELECTED 2
|
||||
#define IS_UNSELECTED 3
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TListPanelItem::TListPanelItem(String Caption, TListPanelItemClick OnItemClick)
|
||||
{
|
||||
FCaption = Caption;
|
||||
FOnItemClick = OnItemClick;
|
||||
Tag = 0;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TListPanelItem::DrawItem(TCanvas *Canvas, TRect Rect, int flag)
|
||||
{
|
||||
switch (flag) {
|
||||
case IS_OVER:
|
||||
Canvas->Brush->Color = LP_ITEM_OVER;
|
||||
break;
|
||||
|
||||
case IS_SELECTED:
|
||||
Canvas->Brush->Color = LP_ITEM_SELECTED;
|
||||
break;
|
||||
|
||||
default:
|
||||
Canvas->Brush->Color = LP_ITEM_DEF;
|
||||
}
|
||||
|
||||
/* 绘制背景 */
|
||||
Canvas->FillRect(Rect);
|
||||
|
||||
Canvas->Font->Color = TColor(RGB(201, 214, 229));
|
||||
|
||||
/* 绘制文字 */
|
||||
int var_TextRectTop = Rect.Top + (Rect.Height() - Canvas->TextHeight(FCaption)) / 2;
|
||||
|
||||
TRect var_TextRect(4, var_TextRectTop, Rect.Right - 4, Rect.Bottom);
|
||||
|
||||
Canvas->TextRect(var_TextRect, FCaption);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------
|
||||
#define LP_BORDER RGB(106, 111, 117)
|
||||
#define LP_BACKGRND RGB(47, 50, 57)//39, 42, 47)
|
||||
|
||||
#define LP_BORDER_HL RGB(30, 32, 36)
|
||||
#define LP_BACKGRND_HL RGB(67, 73, 80)
|
||||
|
||||
#define LP_TXT_NOR RGB(213, 221, 232)
|
||||
#define LP_TXT_DISABLE RGB(100, 108, 119)
|
||||
#define LP_BREAK RGB(100, 108, 119)
|
||||
#define LP_BOARD_FILL RGB(76, 82, 91)
|
||||
|
||||
#define MIN(x, y) ((x) < (y) ? (x) : (y))
|
||||
#define MAX(x, y) ((x) > (y) ? (x) : (y))
|
||||
|
||||
#define MARGIN 2
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TListPanel::TListPanel(TComponent *Owner) : TPanel(Owner)
|
||||
{
|
||||
// m_ItemRectList = new TList();
|
||||
m_ItemList = new TList();
|
||||
|
||||
Canvas->Font->Color = LP_TXT_NOR;
|
||||
|
||||
FItemHeight = 20;
|
||||
FSelectedItemIndex = -1;
|
||||
|
||||
m_CurrentItemIndex = -1;
|
||||
m_RealShowCount = 0;
|
||||
|
||||
m_BeginIndex = 0;
|
||||
m_EndIndex = 0;
|
||||
|
||||
m_IsLButtonDown = false;
|
||||
|
||||
m_ScrollBar = new TSkinScrollBar(NULL);
|
||||
m_ScrollBar->Visible = false;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TListPanel::~TListPanel()
|
||||
{
|
||||
/* if(m_ItemRectList)
|
||||
{
|
||||
for( int i=0; i<m_ItemRectList->Count; i++ ){
|
||||
delete m_ItemRectList->Items[i];
|
||||
}
|
||||
|
||||
m_ItemRectList->Clear();
|
||||
delete m_ItemRectList;
|
||||
m_ItemRectList = NULL;
|
||||
}
|
||||
*/
|
||||
for( int i=0; i<m_ItemList->Count; i++ ){
|
||||
delete m_ItemList->Items[i];
|
||||
}
|
||||
|
||||
m_ItemList->Clear();
|
||||
delete m_ItemList;
|
||||
m_ItemList = NULL;
|
||||
|
||||
if(m_ScrollBar)
|
||||
{
|
||||
delete m_ScrollBar;
|
||||
m_ScrollBar = NULL;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TListPanel::AddItem(TListPanelItem* Item)
|
||||
{
|
||||
m_ItemList->Add(Item);
|
||||
|
||||
/* if(HandleAllocated()) {
|
||||
Reset();
|
||||
}
|
||||
*/
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TListPanel::Clear()
|
||||
{
|
||||
for( int i=0; i<m_ItemList->Count; i++ ){
|
||||
delete m_ItemList->Items[i];
|
||||
}
|
||||
m_ItemList->Clear();
|
||||
|
||||
FSelectedItemIndex = -1;
|
||||
m_CurrentItemIndex = -1;
|
||||
|
||||
m_BeginIndex = 0;
|
||||
m_EndIndex = 0;
|
||||
|
||||
ResetScroll();
|
||||
// if(HandleAllocated()) {
|
||||
// Reset();
|
||||
|
||||
// Repaint();
|
||||
// }
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TListPanel::CreateWnd()
|
||||
{
|
||||
TPanel::CreateWnd();
|
||||
|
||||
// 设置滚动条属性
|
||||
m_ScrollBar->Height = Height - 2;
|
||||
m_ScrollBar->Top = 1;
|
||||
m_ScrollBar->Left = Width - m_ScrollBar->Width - 1;
|
||||
m_ScrollBar->Parent = this;
|
||||
m_ScrollBar->m_pWndCtrl = this;
|
||||
|
||||
//最大显示数
|
||||
m_ShowCount = (Height - 2 * MARGIN) / FItemHeight;
|
||||
|
||||
// 记录显示区域
|
||||
/* m_ItemRectList->Clear();
|
||||
m_ItemRectList->Add(new TRect(MARGIN, MARGIN, Width - MARGIN, FItemHeight + MARGIN));
|
||||
for(int i = 1; i < m_ShowCount; i++)
|
||||
{
|
||||
int var_ItemTop = i * FItemHeight + MARGIN;
|
||||
int var_ItemBottom = var_ItemTop + FItemHeight;
|
||||
|
||||
m_ItemRectList->Add(new TRect(MARGIN, var_ItemTop, Width - MARGIN, var_ItemBottom));
|
||||
}
|
||||
*/
|
||||
// 记录Item区域
|
||||
m_ItemArea = TRect(MARGIN, MARGIN, Width - MARGIN, m_ShowCount * FItemHeight + MARGIN);
|
||||
|
||||
ResetScroll();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
int __fastcall TListPanel::GetItemsCount()
|
||||
{
|
||||
if(m_ItemList)
|
||||
return m_ItemList->Count;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
//void __fastcall TListPanel::SetTextFontSize(int sz)
|
||||
//{
|
||||
// Canvas->Font->Size = sz;
|
||||
//}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TListPanel::SetTextFont(String name, int size)
|
||||
{
|
||||
Canvas->Font->Name = name;
|
||||
Canvas->Font->Size = size;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
TListPanelItem *__fastcall TListPanel::GetItem(int Index)
|
||||
{
|
||||
if(ItemsCount == 0 || Index < 0 || Index > ItemsCount)
|
||||
return NULL;
|
||||
else
|
||||
return (TListPanelItem *)m_ItemList->Items[Index];
|
||||
}
|
||||
/*/---------------------------------------------------------------------------
|
||||
TRect *__fastcall TListPanel::GetItemRect(int Index)
|
||||
{
|
||||
return (TRect *)m_ItemRectList->Items[Index];
|
||||
}
|
||||
*/
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TListPanel::MouseDown(TMouseButton Button, TShiftState Shift, int X, int Y)
|
||||
{
|
||||
TPanel::MouseDown(Button, Shift, X, Y);
|
||||
|
||||
if(m_ScrollBar->Visible && Button == 0) {
|
||||
m_IsLButtonDown = true;
|
||||
m_ScrollBar->Enabled = false;
|
||||
}
|
||||
|
||||
int areaRight = 0;
|
||||
|
||||
m_ScrollBar->Visible ? areaRight = m_ItemArea.Right - m_ScrollBar->Width - 1
|
||||
: areaRight = m_ItemArea.Right;
|
||||
|
||||
if(Button == 0 && X >= m_ItemArea.Left && X < areaRight && Y >= m_ItemArea.Top
|
||||
&& Y < m_ItemArea.Bottom && ItemsCount > 0)
|
||||
{
|
||||
int index = (Y - MARGIN) / FItemHeight + m_BeginIndex;
|
||||
|
||||
if(index < m_ItemList->Count && m_ItemList->Count != 0)
|
||||
{
|
||||
if(FSelectedItemIndex != index)
|
||||
{
|
||||
if(FSelectedItemIndex >= m_BeginIndex && FSelectedItemIndex < m_EndIndex)
|
||||
SetItemStatus(FSelectedItemIndex, IS_UNSELECTED);
|
||||
|
||||
FSelectedItemIndex = index;
|
||||
|
||||
SetItemStatus(FSelectedItemIndex, IS_SELECTED);
|
||||
}
|
||||
|
||||
GetItem(FSelectedItemIndex)->OnItemClicked(this, FSelectedItemIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TListPanel::MouseMove(TShiftState Shift, int X, int Y)
|
||||
{
|
||||
TPanel::MouseMove(Shift, X, Y);
|
||||
|
||||
if(m_IsLButtonDown) return;
|
||||
|
||||
if(m_MouseX == X && m_MouseY == Y) return;
|
||||
|
||||
m_MouseX = X;
|
||||
m_MouseY = Y;
|
||||
|
||||
int areaRight = 0, index = -1;
|
||||
|
||||
m_ScrollBar->Visible ? areaRight = m_ItemArea.Right - m_ScrollBar->Width - 1
|
||||
: areaRight = m_ItemArea.Right;
|
||||
|
||||
if(X >= m_ItemArea.Left && X < areaRight && Y >= m_ItemArea.Top
|
||||
&& Y < m_ItemArea.Bottom && ItemsCount > 0)
|
||||
{
|
||||
index = (Y - MARGIN) / FItemHeight + m_BeginIndex;
|
||||
|
||||
if(index < m_ItemList->Count && m_ItemList->Count != 0)
|
||||
{
|
||||
if(index != m_CurrentItemIndex)
|
||||
{
|
||||
/* 还原上一次选中项 */
|
||||
if(m_CurrentItemIndex >= m_BeginIndex && m_CurrentItemIndex < m_EndIndex)
|
||||
{
|
||||
m_CurrentItemIndex == FSelectedItemIndex ? SetItemStatus(m_CurrentItemIndex, IS_SELECTED)
|
||||
: SetItemStatus(m_CurrentItemIndex, IS_UNSELECTED);
|
||||
}
|
||||
/* 更新当前选择项 */
|
||||
m_CurrentItemIndex = index;
|
||||
/* 重绘选中项 */
|
||||
m_CurrentItemIndex == FSelectedItemIndex ? SetItemStatus(m_CurrentItemIndex, IS_SELECTED)
|
||||
: SetItemStatus(m_CurrentItemIndex, IS_OVER);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( ( index<0 || index>m_ItemList->Count )
|
||||
&& m_CurrentItemIndex >= m_BeginIndex
|
||||
&& m_CurrentItemIndex < m_EndIndex ){
|
||||
m_CurrentItemIndex==FSelectedItemIndex ? SetItemStatus(m_CurrentItemIndex, IS_SELECTED)
|
||||
: SetItemStatus(m_CurrentItemIndex, IS_UNSELECTED);
|
||||
m_CurrentItemIndex = -1;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TListPanel::MouseUp(TMouseButton Button, TShiftState Shift, int X, int Y)
|
||||
{
|
||||
TPanel::MouseUp(Button, Shift, X, Y);
|
||||
|
||||
if(m_ScrollBar->Visible && Button == 0) {
|
||||
m_IsLButtonDown = false;
|
||||
m_ScrollBar->Enabled = true;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TListPanel::SetItemStatus(int Index, int flag)
|
||||
{
|
||||
int var_ItemTop = ( Index - m_BeginIndex ) * FItemHeight + MARGIN;
|
||||
TRect rtDraw( MARGIN, var_ItemTop, Width - MARGIN, var_ItemTop + FItemHeight );
|
||||
|
||||
GetItem(Index)->DrawItem(Canvas, rtDraw, flag);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TListPanel::SetSelectedItemIndex(int Index)
|
||||
{
|
||||
if(FSelectedItemIndex != Index) {
|
||||
if( FSelectedItemIndex>=m_BeginIndex && FSelectedItemIndex<m_EndIndex ){
|
||||
SetItemStatus( FSelectedItemIndex-m_BeginIndex, IS_UNSELECTED );
|
||||
}
|
||||
|
||||
if( Index<0 || Index>=m_ItemList->Count ){
|
||||
FSelectedItemIndex = -1;
|
||||
}
|
||||
else{
|
||||
FSelectedItemIndex = Index;
|
||||
|
||||
int posScroll = m_BeginIndex;
|
||||
if( Index<m_BeginIndex ){
|
||||
posScroll = Index;
|
||||
}
|
||||
else if( Index>=m_EndIndex ){
|
||||
posScroll = Index - m_ShowCount + 1;
|
||||
}
|
||||
|
||||
if( posScroll==m_BeginIndex ){
|
||||
SetItemStatus( FSelectedItemIndex-m_BeginIndex, IS_SELECTED );
|
||||
}
|
||||
else if( m_ScrollBar->Visible ){
|
||||
ScrollPos( posScroll );
|
||||
m_ScrollBar->SetPosition(posScroll);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TListPanel::Paint()
|
||||
{
|
||||
Canvas->Lock();
|
||||
for(int Index = m_BeginIndex; Index < m_EndIndex; Index++)
|
||||
{
|
||||
if(Index == FSelectedItemIndex)
|
||||
SetItemStatus(Index, IS_SELECTED);
|
||||
else if(Index == m_CurrentItemIndex)
|
||||
SetItemStatus(Index, IS_OVER);
|
||||
else
|
||||
SetItemStatus(Index, IS_UNSELECTED);
|
||||
}
|
||||
|
||||
if( m_ShowCount > ItemsCount ){
|
||||
int var_Top = ItemsCount * FItemHeight + MARGIN,
|
||||
var_Bottom = var_Top + ( m_ShowCount - ItemsCount ) * FItemHeight;
|
||||
TRect rtDraw( MARGIN, var_Top, Width - MARGIN, var_Bottom );
|
||||
|
||||
Canvas->Brush->Color = LP_BACKGRND;
|
||||
Canvas->FillRect(rtDraw);
|
||||
}
|
||||
|
||||
Canvas->Unlock();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TListPanel::ResetScroll()
|
||||
{
|
||||
m_RealShowCount = MIN(ItemsCount, m_ShowCount);
|
||||
|
||||
if( FSelectedItemIndex>=0 ){
|
||||
if( FSelectedItemIndex < m_BeginIndex ){
|
||||
m_BeginIndex = FSelectedItemIndex;
|
||||
}
|
||||
else if( FSelectedItemIndex >= m_BeginIndex + m_ShowCount ){
|
||||
m_BeginIndex = FSelectedItemIndex - m_ShowCount + 1;
|
||||
}
|
||||
}
|
||||
|
||||
m_EndIndex = min( m_BeginIndex + m_RealShowCount, ItemsCount );
|
||||
|
||||
if( ItemsCount > m_ShowCount) {
|
||||
m_ScrollBar->Visible = true;
|
||||
m_ScrollBar->SetRange(0, ItemsCount - 1);
|
||||
m_ScrollBar->SetPageSize(m_ShowCount);
|
||||
m_ScrollBar->SetPosition(m_BeginIndex);
|
||||
}
|
||||
else {
|
||||
m_ScrollBar->Visible = false;
|
||||
}
|
||||
|
||||
Paint();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TListPanel::ScrollPos(int Pos)
|
||||
{
|
||||
if(Pos >= 0 && Pos < ItemsCount){
|
||||
int var_bIndex = Pos;
|
||||
int var_eIndex = Pos + m_RealShowCount;
|
||||
|
||||
if(var_eIndex > ItemsCount)
|
||||
{
|
||||
var_eIndex = ItemsCount;
|
||||
var_bIndex = var_eIndex - m_RealShowCount;
|
||||
}
|
||||
|
||||
if(var_bIndex != m_BeginIndex)
|
||||
{
|
||||
m_BeginIndex = var_bIndex;
|
||||
m_EndIndex = var_eIndex;
|
||||
|
||||
Paint();
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TListPanel::WMEraseBkgnd(TWMEraseBkgnd &Message)
|
||||
{
|
||||
TCanvas* var_BKCanvas = new TCanvas();
|
||||
var_BKCanvas->Handle = Message.DC;
|
||||
|
||||
TRect var_Rect = GetClientRect();
|
||||
|
||||
var_BKCanvas->Brush->Color = LP_BACKGRND; // 绘制底色
|
||||
var_BKCanvas->FillRect(var_Rect);
|
||||
|
||||
var_BKCanvas->Brush->Color = LP_BORDER; // 绘制边框
|
||||
var_BKCanvas->FrameRect(var_Rect);
|
||||
|
||||
delete var_BKCanvas;
|
||||
var_BKCanvas = NULL;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TListPanel::WMMouseWheel(TWMMouseWheel &Message)
|
||||
{
|
||||
UINT nSBCode;
|
||||
|
||||
if(m_IsLButtonDown) return;
|
||||
|
||||
if(Message.WheelDelta < 0)
|
||||
{
|
||||
nSBCode = SB_LINEDOWN;
|
||||
}
|
||||
else
|
||||
{
|
||||
nSBCode = SB_LINEUP;
|
||||
}
|
||||
|
||||
if(m_ScrollBar->Visible)
|
||||
Perform(WM_VSCROLL, MAKELONG(nSBCode, 0), NULL);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TListPanel::CMMouseLeave(TMessage &Message)
|
||||
{
|
||||
m_CurrentItemIndex = -1;
|
||||
|
||||
Repaint();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TListPanel::WMVScroll(TWMScroll &Message)
|
||||
{
|
||||
int minpos, maxpos, page, curpos;
|
||||
|
||||
m_ScrollBar->GetScrollRange(& minpos, & maxpos);
|
||||
|
||||
page = m_ScrollBar->GetPageSize();
|
||||
curpos = m_ScrollBar->GetScrollPos();
|
||||
|
||||
switch(Message.ScrollCode)
|
||||
{
|
||||
case SB_TOP:
|
||||
curpos = minpos;
|
||||
break;
|
||||
|
||||
case SB_BOTTOM:
|
||||
curpos = maxpos - page + 1;
|
||||
break;
|
||||
|
||||
case SB_ENDSCROLL:
|
||||
break;
|
||||
|
||||
case SB_LINEUP:
|
||||
if(curpos > minpos)
|
||||
{
|
||||
curpos--;
|
||||
}
|
||||
break;
|
||||
|
||||
case SB_LINEDOWN:
|
||||
if(curpos < maxpos - page + 1)
|
||||
{
|
||||
curpos++;
|
||||
}
|
||||
break;
|
||||
|
||||
case SB_PAGEUP:
|
||||
if(curpos > minpos)
|
||||
{
|
||||
curpos = MAX(minpos, curpos - page);
|
||||
}
|
||||
break;
|
||||
|
||||
case SB_PAGEDOWN:
|
||||
if(curpos < maxpos)
|
||||
{
|
||||
curpos = MIN(maxpos - page + 1, curpos + page);
|
||||
}
|
||||
break;
|
||||
|
||||
case SB_THUMBPOSITION:
|
||||
curpos = Message.Pos;
|
||||
break;
|
||||
|
||||
case SB_THUMBTRACK:
|
||||
curpos = Message.Pos;
|
||||
break;
|
||||
}
|
||||
|
||||
if(Message.ScrollBar != m_ScrollBar->Handle)
|
||||
{
|
||||
m_ScrollBar->SetPosition(curpos);
|
||||
}
|
||||
|
||||
ScrollPos(curpos);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
int __fastcall TListPanel::TextWidth(String text)
|
||||
{
|
||||
return Canvas->TextWidth(text);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TListPanel::WMSize(Winapi::Messages::TWMSize &Message)
|
||||
{
|
||||
DefaultHandler( &Message );
|
||||
|
||||
m_ScrollBar->Height = Height - 2;
|
||||
m_ScrollBar->Top = 1;
|
||||
m_ScrollBar->Left = Width - m_ScrollBar->Width - 1;
|
||||
|
||||
//最大显示数
|
||||
m_ShowCount = (Height - 2 * MARGIN) / FItemHeight;
|
||||
// 记录显示区域
|
||||
/* m_ItemRectList->Clear();
|
||||
m_ItemRectList->Add(new TRect(MARGIN, MARGIN, Width - MARGIN, FItemHeight + MARGIN));
|
||||
for(int i = 1; i < m_ShowCount; i++)
|
||||
{
|
||||
int var_ItemTop = i * FItemHeight + MARGIN;
|
||||
int var_ItemBottom = var_ItemTop + FItemHeight;
|
||||
|
||||
m_ItemRectList->Add(new TRect(MARGIN, var_ItemTop, Width - MARGIN, var_ItemBottom));
|
||||
}
|
||||
*/
|
||||
// 记录Item区域
|
||||
m_ItemArea = TRect(MARGIN, MARGIN, Width - MARGIN, m_ShowCount * FItemHeight + MARGIN);
|
||||
|
||||
// ResetScroll();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
+109
@@ -0,0 +1,109 @@
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ListPanelH
|
||||
#define ListPanelH
|
||||
|
||||
#include <vcl.h>
|
||||
#include "SkinScrollBarUnit.h"
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class TListPanel;
|
||||
class TListPanelItem;
|
||||
|
||||
/* 定义下拉列表项点击事件 */
|
||||
typedef void __fastcall(__closure * TListPanelItemClick)(TListPanel *Sender, int Index);
|
||||
|
||||
class TListPanelItem : public TObject {
|
||||
|
||||
private:
|
||||
int FTag;
|
||||
String FCaption;
|
||||
TListPanelItemClick FOnItemClick;
|
||||
|
||||
void __fastcall SetCaption(String Caption);
|
||||
|
||||
public:
|
||||
|
||||
__fastcall TListPanelItem(String Caption, TListPanelItemClick OnItemClick);
|
||||
|
||||
void __fastcall DrawItem(TCanvas *Canvas, TRect Rect, int flag);
|
||||
|
||||
__published:
|
||||
__property String Caption = {read = FCaption, write = FCaption};
|
||||
__property int Tag = {read = FTag, write = FTag};
|
||||
__property TListPanelItemClick OnItemClicked = {read = FOnItemClick, write = FOnItemClick};
|
||||
};
|
||||
|
||||
class TListPanel : public TPanel {
|
||||
private:
|
||||
int FItemHeight,
|
||||
FSelectedItemIndex;
|
||||
|
||||
bool m_IsLButtonDown;
|
||||
|
||||
TRect m_ItemArea;
|
||||
|
||||
TList //*m_ItemRectList,
|
||||
*m_ItemList;
|
||||
|
||||
TSkinScrollBar *m_ScrollBar;
|
||||
|
||||
int m_BeginIndex,
|
||||
m_EndIndex,
|
||||
m_CurrentItemIndex,
|
||||
m_ShowCount,
|
||||
m_RealShowCount,
|
||||
m_MouseX,
|
||||
m_MouseY,
|
||||
m_ItemWidth;
|
||||
|
||||
void __fastcall DoKeyUpDown(int Index);
|
||||
void __fastcall DoShowItemsChange();
|
||||
|
||||
void __fastcall SetItemStatus(int Index, int flag);
|
||||
void __fastcall SetSelectedItemIndex(int Index);
|
||||
|
||||
int __fastcall GetItemsCount();
|
||||
// TRect *__fastcall GetItemRect(int Index);
|
||||
|
||||
MESSAGE void __fastcall WMSize(Winapi::Messages::TWMSize &Message);
|
||||
MESSAGE void __fastcall WMEraseBkgnd(TWMEraseBkgnd &Message);
|
||||
MESSAGE void __fastcall WMMouseWheel(TWMMouseWheel &Message);
|
||||
MESSAGE void __fastcall CMMouseLeave(TMessage &Message);
|
||||
MESSAGE void __fastcall WMVScroll(TWMScroll &Message);
|
||||
|
||||
BEGIN_MESSAGE_MAP
|
||||
MESSAGE_HANDLER(WM_SIZE, TWMSize, WMSize)
|
||||
MESSAGE_HANDLER(WM_ERASEBKGND, TWMEraseBkgnd, WMEraseBkgnd)
|
||||
MESSAGE_HANDLER(WM_MOUSEWHEEL, TWMMouseWheel, WMMouseWheel)
|
||||
MESSAGE_HANDLER(CM_MOUSELEAVE, TMessage, CMMouseLeave)
|
||||
MESSAGE_HANDLER(WM_VSCROLL, TWMScroll, WMVScroll)
|
||||
END_MESSAGE_MAP(TPanel)
|
||||
|
||||
protected:
|
||||
virtual void __fastcall CreateWnd();
|
||||
virtual void __fastcall Paint();
|
||||
|
||||
DYNAMIC void __fastcall MouseDown(TMouseButton Button, TShiftState Shift, int X, int Y);
|
||||
DYNAMIC void __fastcall MouseMove(TShiftState Shift, int X, int Y);
|
||||
DYNAMIC void __fastcall MouseUp(TMouseButton Button, TShiftState Shift, int X, int Y);
|
||||
|
||||
public:
|
||||
__fastcall TListPanel(TComponent *Owner);
|
||||
__fastcall ~TListPanel();
|
||||
void __fastcall AddItem(TListPanelItem* Item);
|
||||
void __fastcall Clear();
|
||||
TListPanelItem *__fastcall GetItem(int Index);
|
||||
void __fastcall ScrollPos(int Pos);
|
||||
int __fastcall TextWidth(String text);
|
||||
void __fastcall ResetScroll();
|
||||
// void __fastcall SetTextFontSize(int sz);
|
||||
void __fastcall SetTextFont(String name, int size);
|
||||
|
||||
__published:
|
||||
__property int ItemHeight = {write = FItemHeight, read = FItemHeight, default = 16};
|
||||
__property int SelectedItemIndex = {read = FSelectedItemIndex, write = SetSelectedItemIndex};
|
||||
__property int ItemsCount = {read = GetItemsCount};
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,276 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "ListViewBase.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TListViewBase::TListViewBase(TComponent* Owner)
|
||||
: TTableView( Owner )
|
||||
{
|
||||
OnDrawBKG = DoDrawBKG;
|
||||
OnTitle = DoTitle;
|
||||
OnBottom = DoBottom;
|
||||
|
||||
OnCellHgt = DoCellHgt;
|
||||
OnClickL = DoClickL;
|
||||
OnClickLP = DoClickLP;
|
||||
OnClickR = DoClickR;
|
||||
OnClickRP = DoClickRP;
|
||||
|
||||
OnMDCell = DoMDCell;
|
||||
OnMDNum = DoMDNum;
|
||||
OnMDTop = DoMDTop;
|
||||
OnMDBottom = DoMDBottom;
|
||||
OnMDMOV = DoMDMOV;
|
||||
|
||||
FRightCellChange = false;
|
||||
OnDrawCell = DoCellDraw;
|
||||
OnCellData = DoCellData;
|
||||
OnCellLClick = DoCellLClick;
|
||||
OnCellRClick = DoCellRClick;
|
||||
OnCellLDClick = DoCellDBClick;
|
||||
|
||||
FRightIconChange = false;
|
||||
FIconChange = false;
|
||||
OnDrawIcon = DoIconDraw;
|
||||
OnIconData = DoIconData;
|
||||
OnIconsNum = DoIconsNum;
|
||||
OnIconsBounds = DoIconsBounds;
|
||||
OnIconLClick = DoIconLClick;
|
||||
OnIconRClick = DoIconRClick;
|
||||
OnIconLDClick = DoIconDBClick;
|
||||
|
||||
m_MoveTimer = new TTimer(this);
|
||||
m_MoveTimer->Enabled = false;
|
||||
m_MoveTimer->Interval = 100;
|
||||
m_MoveTimer->OnTimer = MoveTimerProc;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TListViewBase::~TListViewBase()
|
||||
{
|
||||
SAFE_DELETE(m_MoveTimer)
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TListViewBase::BtnDown(TStateBtn *pCur, TPoint pt, bool bLeft)
|
||||
{
|
||||
NULL_RETURN(pCur)
|
||||
|
||||
TStateBtn *pCurTmp = pCur;
|
||||
|
||||
if(bLeft || FRightCellChange ) {
|
||||
|
||||
TStateBtn *pBtn = NULL;
|
||||
if( pCur && pCur->m_PAR ) {
|
||||
bool bIconChange = true;
|
||||
if( !bLeft && !FRightIconChange) bIconChange = false;
|
||||
if( bIconChange ) {
|
||||
pCur->Down = true;
|
||||
pCur = pCur->m_PAR;
|
||||
}
|
||||
}
|
||||
|
||||
BTNLST::iterator lst_FBTNLST;
|
||||
for( lst_FBTNLST = m_LstBtn.begin();
|
||||
lst_FBTNLST!= m_LstBtn.end();
|
||||
lst_FBTNLST++ )
|
||||
{
|
||||
pBtn = *lst_FBTNLST;
|
||||
if( pBtn==pCur ) {
|
||||
pBtn->Down = true;
|
||||
IndSel = pBtn->Index;
|
||||
pBtn->Paint();
|
||||
}
|
||||
else if( pBtn->Down ) {
|
||||
pBtn->Down = false;
|
||||
pBtn->Enter = false;
|
||||
pBtn->Paint();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( bLeft && OnClickL ) {
|
||||
|
||||
OnClickL(pCurTmp, pt);
|
||||
}
|
||||
else if( !bLeft && OnClickR ) {
|
||||
|
||||
OnClickR(pCurTmp, pt);
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TListViewBase::BtnUp(TStateBtn *pCur, TStateBtn *pSel, TPoint pt, bool bLeft)
|
||||
{
|
||||
if( pSel && pSel->m_PAR ) {
|
||||
bool bIconChange = true;
|
||||
if( !bLeft && !FRightIconChange) bIconChange = false;
|
||||
if( bIconChange ) {
|
||||
pSel->Down = false;
|
||||
pSel->Enter = false;
|
||||
pSel->Paint();
|
||||
}
|
||||
}
|
||||
|
||||
if( bLeft && OnClickLP ) {
|
||||
OnClickLP(pCur, pt);
|
||||
}
|
||||
else if( !bLeft && OnClickRP ) {
|
||||
OnClickRP(pCur, pt);
|
||||
}
|
||||
|
||||
m_MoveTimer->Enabled = false;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TListViewBase::BtnMove(TStateBtn *pCur, TPoint pt)
|
||||
{
|
||||
TStateBtn *pCurTmp = pCur;
|
||||
|
||||
TStateBtn *pBtn = NULL;
|
||||
if( !pCur ) IndFocus = -1;
|
||||
|
||||
if( pCur!=m_BtnFocus && m_BtnFocus && m_BtnFocus->m_PAR ) {
|
||||
m_BtnFocus->Enter = false;
|
||||
m_BtnFocus->Paint();
|
||||
}
|
||||
|
||||
if( pCur && pCur->m_PAR ) {
|
||||
pCur->Enter = true;
|
||||
pCur = pCur->m_PAR;
|
||||
}
|
||||
|
||||
if( pCur!=m_BtnFocus ) {
|
||||
|
||||
BTNLST::iterator lst_FBTNLST;
|
||||
for( lst_FBTNLST = m_LstBtn.begin();
|
||||
lst_FBTNLST!= m_LstBtn.end();
|
||||
lst_FBTNLST++ )
|
||||
{
|
||||
pBtn = *lst_FBTNLST;
|
||||
if( pBtn==pCur ) {
|
||||
pBtn->Enter = true;
|
||||
IndFocus = pBtn->Index;
|
||||
pBtn->Paint();
|
||||
}
|
||||
else if( pBtn->State==Bs_ENTER ) {
|
||||
pBtn->Enter = false;
|
||||
pBtn->Paint();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( m_bLeft && OnMDMOV ) {
|
||||
OnMDMOV(m_BtnSel, pCurTmp, pt);
|
||||
}
|
||||
|
||||
m_ptTimer = pt;
|
||||
if( m_bLeft && m_BtnSel && NULL==m_BtnSel->m_PAR && (!PtInRect( m_RtContent, pt ) || pCurTmp==NULL) ) {
|
||||
if(!m_MoveTimer->Enabled)
|
||||
m_MoveTimer->Enabled = true;
|
||||
}
|
||||
else if( m_MoveTimer->Enabled ){
|
||||
m_MoveTimer->Enabled = false;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TListViewBase::MoveTimerProc(System::TObject* Sender)
|
||||
{
|
||||
if( m_ptTimer.X<0||m_ptTimer.Y<0 ) {
|
||||
SetSBPos(SBS_POS, GetCellBeg()-1);
|
||||
}
|
||||
else {
|
||||
SetSBPos(SB_LINEDOWN, GetCellBeg()+1);
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
int __fastcall TListViewBase::DoMouseWheel(TObject *Sender)
|
||||
{
|
||||
if(m_BtnFocus && m_BtnFocus->Enter) {
|
||||
m_BtnFocus->Enter = false;
|
||||
m_BtnFocus->Paint();
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
int __fastcall TListViewBase::DoMDCell(TTableView *Sender, int iCellIndex)
|
||||
{
|
||||
if( iCellIndex<0 || iCellIndex>=GetCellNum() )
|
||||
return 0;
|
||||
|
||||
TStateBtn *rowCell = (TStateBtn *)GetCellAds(iCellIndex);
|
||||
|
||||
if(!rowCell) {
|
||||
rowCell = new TStateBtn(this);
|
||||
rowCell->OnNotifyDraw = OnDrawCell;
|
||||
rowCell->OnClick = OnCellLClick;
|
||||
rowCell->OnClickR = OnCellRClick;
|
||||
rowCell->OnDBClick = OnCellLDClick;
|
||||
rowCell->Index = iCellIndex;
|
||||
|
||||
if(OnIconsNum) {
|
||||
int iconNum = OnIconsNum(rowCell);
|
||||
for(int i=0; i<iconNum; i++) {
|
||||
|
||||
TStateBtn *pBtnCol = new TStateBtn(this);
|
||||
pBtnCol->OnNotifyDraw = OnDrawIcon;
|
||||
pBtnCol->OnClick = OnIconLClick;
|
||||
pBtnCol->OnClickR = OnIconRClick;
|
||||
pBtnCol->OnDBClick = OnIconLDClick;
|
||||
pBtnCol->Index = i;
|
||||
rowCell->SetSub(pBtnCol);
|
||||
|
||||
if(!FIconChange) {
|
||||
DoIconDataAndBounds(pBtnCol);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rowCell->Index = iCellIndex;
|
||||
if( OnCellData )
|
||||
OnCellData(rowCell);
|
||||
|
||||
if(FIconChange) {
|
||||
|
||||
BTNLST *pLstSub = rowCell->GetSub();
|
||||
BTNLST::iterator lst_FBTNLST;
|
||||
for(lst_FBTNLST = pLstSub->begin();
|
||||
lst_FBTNLST != pLstSub->end();
|
||||
lst_FBTNLST++ )
|
||||
{
|
||||
DoIconDataAndBounds(*lst_FBTNLST);
|
||||
}
|
||||
}
|
||||
|
||||
if( IndSel==rowCell->Index )
|
||||
rowCell->Down = true;
|
||||
else if( rowCell->Down )
|
||||
rowCell->Down = false;
|
||||
|
||||
if( IndFocus==rowCell->Index )
|
||||
rowCell->Enter = true;
|
||||
else if( rowCell->Enter )
|
||||
rowCell->Enter = false;
|
||||
|
||||
return ((int)(rowCell));
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TListViewBase::DoIconDataAndBounds(TStateBtn *pBtnCol)
|
||||
{
|
||||
if( OnIconData )
|
||||
OnIconData(pBtnCol);
|
||||
|
||||
TRect rtBounds;
|
||||
if(OnIconsBounds) {
|
||||
OnIconsBounds(pBtnCol, rtBounds);
|
||||
pBtnCol->SetBounds(rtBounds.Left, rtBounds.Top, rtBounds.Width(), rtBounds.Height());
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TListViewBase::SetTextFontSize(int sz)
|
||||
{
|
||||
Canvas->Font->Size = sz;
|
||||
m_CanvasDr->Font->Size = sz;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ListViewBaseH
|
||||
#define ListViewBaseH
|
||||
//---------------------------------------------------------------------------
|
||||
#include "TableViewUnit.h"
|
||||
//---------------------------------------------------------------------------
|
||||
class TListViewBase: public TTableView
|
||||
{
|
||||
|
||||
private:
|
||||
|
||||
TPoint m_ptTimer;
|
||||
TTimer *m_MoveTimer;
|
||||
void __fastcall MoveTimerProc(System::TObject* Sender);
|
||||
|
||||
bool FRightCellChange;
|
||||
TNotifyDraw FOnDrawCell;
|
||||
TNotiCell FOnCellData;
|
||||
TNotifyBtn FOnCellLClick,
|
||||
FOnCellRClick,
|
||||
FOnCellLDClick;
|
||||
|
||||
bool FRightIconChange;
|
||||
bool FIconChange;
|
||||
TNotifyDraw FOnDrawIcon;
|
||||
TNotiCell FOnIconData;
|
||||
TNotiIconsNum FOnIconsNum;
|
||||
TNotiIconsBounds FOnIconsBounds;
|
||||
TNotifyBtn FOnIconLClick,
|
||||
FOnIconRClick,
|
||||
FOnIconLDClick;
|
||||
|
||||
void __fastcall DoIconDataAndBounds(TStateBtn *pBtnCol);
|
||||
|
||||
protected:
|
||||
|
||||
//TStateBtn has "Index" property connect to data
|
||||
virtual void __fastcall BtnDown(TStateBtn *pCur, TPoint pt, bool bLeft=true);
|
||||
virtual void __fastcall BtnUp(TStateBtn *pCur, TStateBtn *pSel, TPoint pt, bool bLeft=true);
|
||||
virtual void __fastcall BtnMove(TStateBtn *pCur, TPoint pt);
|
||||
|
||||
virtual void __fastcall DoDrawBKG(TPanelDB *Sender, TCanvas *pCanvas, TRect rtBKG){}
|
||||
virtual int __fastcall DoTitle(TTableView *Sender){return 0;}
|
||||
virtual int __fastcall DoBottom(TTableView *Sender){return 0;}
|
||||
|
||||
virtual int __fastcall DoCellHgt(TTableView *Sender, int iCellIndex){return 0;}
|
||||
virtual int __fastcall DoClickL(TStateBtn *Sender, TPoint pt){return 0;}
|
||||
virtual int __fastcall DoClickLP(TStateBtn *Sender, TPoint pt){return 0;}
|
||||
virtual int __fastcall DoClickR(TStateBtn *Sender, TPoint pt){return 0;}
|
||||
virtual int __fastcall DoClickRP(TStateBtn *Sender, TPoint pt){return 0;}
|
||||
|
||||
virtual int __fastcall DoMDCell(TTableView *Sender, int iCellIndex);
|
||||
virtual int __fastcall DoMDNum(TTableView *Sender){return 0;}
|
||||
virtual int __fastcall DoMDTop(TTableView *Sender){return 0;}
|
||||
virtual int __fastcall DoMDBottom(TTableView *Sender){return 0;}
|
||||
virtual int __fastcall DoMDMOV(TStateBtn *Src, TStateBtn *Des, TPoint pt){return 0;}
|
||||
|
||||
virtual int __fastcall DoCellData(TStateBtn *sender){return 0;}
|
||||
virtual void __fastcall DoCellDraw(TStateBtn *sender, int BsTmp, TRect rtTmp, TCanvas *pCanvas){}
|
||||
virtual void __fastcall DoCellLClick(TStateBtn *sender){}
|
||||
virtual void __fastcall DoCellRClick(TStateBtn *sender){}
|
||||
virtual void __fastcall DoCellDBClick(TStateBtn *sender){}
|
||||
|
||||
virtual int __fastcall DoIconData(TStateBtn *sender){return 0;}
|
||||
virtual int __fastcall DoIconsNum(TStateBtn *parent){return 0;}
|
||||
virtual int __fastcall DoIconsBounds(TStateBtn *sender, TRect &rtBounds){return 0;}
|
||||
virtual void __fastcall DoIconDraw(TStateBtn *sender, int BsTmp, TRect rtTmp, TCanvas *pCanvas){}
|
||||
virtual void __fastcall DoIconLClick(TStateBtn *sender){}
|
||||
virtual void __fastcall DoIconRClick(TStateBtn *sender){}
|
||||
virtual void __fastcall DoIconDBClick(TStateBtn *sender){}
|
||||
|
||||
virtual int __fastcall DoMouseWheel(TObject *Sender);
|
||||
|
||||
public:
|
||||
void __fastcall SetTextFontSize(int sz);
|
||||
|
||||
__fastcall TListViewBase(TComponent* Owner);
|
||||
__fastcall ~TListViewBase();
|
||||
|
||||
__published:
|
||||
|
||||
__property OnDrawBKG;
|
||||
|
||||
__property OnCellHgt;
|
||||
__property OnTitle;
|
||||
__property OnBottom;
|
||||
__property OnClickL;
|
||||
__property OnClickLP;
|
||||
__property OnClickR;
|
||||
__property OnClickRP;
|
||||
|
||||
__property OnMDCell;
|
||||
__property OnMDNum;
|
||||
__property OnMDTop;
|
||||
__property OnMDBottom;
|
||||
__property OnMDMOV;
|
||||
|
||||
__property IndFocus;
|
||||
__property IndSel;
|
||||
__property HgtSmall;
|
||||
__property OnChange;
|
||||
|
||||
__property TNotiCell OnCellData = {read=FOnCellData, write=FOnCellData };
|
||||
__property TNotifyDraw OnDrawCell = {read=FOnDrawCell, write=FOnDrawCell };
|
||||
__property TNotifyBtn OnCellLClick = {read=FOnCellLClick, write=FOnCellLClick };
|
||||
__property TNotifyBtn OnCellRClick = {read=FOnCellRClick, write=FOnCellRClick };
|
||||
__property TNotifyBtn OnCellLDClick = {read=FOnCellLDClick, write=FOnCellLDClick };
|
||||
__property bool RightCellChange = {read=FRightCellChange, write=FRightCellChange, default=false };
|
||||
|
||||
__property TNotiCell OnIconData = {read=FOnIconData, write=FOnIconData };
|
||||
__property TNotiIconsNum OnIconsNum = {read=FOnIconsNum, write=FOnIconsNum };
|
||||
__property TNotiIconsBounds OnIconsBounds = {read=FOnIconsBounds, write=FOnIconsBounds };
|
||||
__property TNotifyDraw OnDrawIcon = {read=FOnDrawIcon, write=FOnDrawIcon };
|
||||
__property TNotifyBtn OnIconLClick = {read=FOnIconLClick, write=FOnIconLClick };
|
||||
__property TNotifyBtn OnIconRClick = {read=FOnIconRClick, write=FOnIconRClick };
|
||||
__property TNotifyBtn OnIconLDClick = {read=FOnIconLDClick, write=FOnIconLDClick };
|
||||
__property bool IconChange = {read=FIconChange, write=FIconChange, default=false };
|
||||
__property bool RightIconChange = {read=FRightIconChange, write=FRightIconChange, default=false };
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,547 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
#include "ListViewMove.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
#define LINE_LEN 2
|
||||
|
||||
#define LP_ITEM_OVER RGB(67, 73, 80)
|
||||
#define LP_ITEM_SELECTED RGB(0, 0, 0)
|
||||
#define LP_ITEM_DEF RGB(39, 42, 47)
|
||||
|
||||
#define FontClolor TColor(0xBDAA9C)
|
||||
#define FramColor RGB(23, 23, 23)
|
||||
|
||||
static const COLORREF CLR_LINE_D = RGB( 18, 19, 21 ),
|
||||
CLR_LINE_L = RGB( 140, 141, 145 );
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TListViewMove::TListViewMove(TComponent* Owner)
|
||||
: TListViewBase( Owner )
|
||||
{
|
||||
m_LstData = new TList();;
|
||||
|
||||
m_pMovLine = new TBitmap();
|
||||
m_pMovLine->SetSize(LINE_LEN, LINE_LEN);
|
||||
m_pMovLine->Canvas->Brush->Style = bsClear;
|
||||
for( int indexY=0; indexY<LINE_LEN; indexY++ )
|
||||
{
|
||||
bool bLine = (indexY%2==0)?true:false;
|
||||
for( int indexX=0; indexX<LINE_LEN; indexX++ )
|
||||
{
|
||||
bool bEven = (indexX%2==0)?true:false;
|
||||
if(bLine) bEven = !bEven;
|
||||
|
||||
m_pMovLine->Canvas->Pixels[indexX][indexY] =
|
||||
(bEven==true)?CLR_LINE_D:CLR_LINE_L;
|
||||
}
|
||||
}
|
||||
m_iSrc = m_iDes = -1;
|
||||
m_pMovBmp = new TBitmap();
|
||||
m_pMovPanel = new TPanelDB(this);
|
||||
m_pMovPanel->Parent = this;
|
||||
m_pMovPanel->OnPaintBKG = DoMovPaint;
|
||||
m_pMovPanel->Visible = false;
|
||||
|
||||
RightCellChange = true;
|
||||
bMovBottom = false;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TListViewMove::~TListViewMove()
|
||||
{
|
||||
SAFE_DELETE(m_pMovLine);
|
||||
SAFE_DELETE(m_pMovBmp);
|
||||
SAFE_DELETE(m_pMovPanel);
|
||||
|
||||
NULL_RETURN(m_LstData)
|
||||
for( int i=0; i<m_LstData->Count; i++ ) {
|
||||
|
||||
DATAInfo *pInfo = (DATAInfo *)(m_LstData->Items[i]);
|
||||
SAFE_DELETE(pInfo)
|
||||
}
|
||||
m_LstData->Clear();
|
||||
SAFE_DELETE(m_LstData);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
int __fastcall TListViewMove::DoCellHgt(TTableView *Sender, int index)
|
||||
{
|
||||
return CELL_HEIGHT;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
int __fastcall TListViewMove::DoMDNum(TTableView *Sender)
|
||||
{
|
||||
NULL_RETURN0(m_LstData)
|
||||
|
||||
return m_LstData->Count;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TListViewMove::DoDrawBKG(TPanelDB *Sender, TCanvas *pCanvas, TRect rtBKG)
|
||||
{
|
||||
pCanvas->Brush->Color = LP_ITEM_DEF;
|
||||
pCanvas->FillRect(rtBKG);
|
||||
rtBKG = TRect(0, 0, Sender->Width, Sender->Height);
|
||||
pCanvas->Brush->Color = FramColor;
|
||||
pCanvas->Pen->Color = FramColor;
|
||||
pCanvas->FrameRect(rtBKG);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
int __fastcall TListViewMove::DoTitle(TTableView *Sender)
|
||||
{
|
||||
TPanelDB *pTitle = new TPanelDB(this);
|
||||
pTitle->SetBounds(0, 0, Width, 1);
|
||||
pTitle->Color = FramColor;
|
||||
return (int)pTitle;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
int __fastcall TListViewMove::DoBottom(TTableView *Sender)
|
||||
{
|
||||
TPanelDB *pBottom = new TPanelDB(this);
|
||||
pBottom->SetBounds(0, Height-1, Width, 1);
|
||||
pBottom->Color = FramColor;
|
||||
return (int)pBottom;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TListViewMove::DoCellDraw(TStateBtn *sender, int BsTmp, TRect rtTmp, TCanvas *pCanvas)
|
||||
{
|
||||
NULL_RETURN(sender)
|
||||
|
||||
DATAInfo *pInfo = (DATAInfo *)sender->m_Data;
|
||||
String strCaption = pInfo->caption;
|
||||
TSize szFont = pCanvas->TextExtent(strCaption);
|
||||
|
||||
if( Bs_NORMAL==BsTmp ) {
|
||||
pCanvas->Brush->Color = LP_ITEM_DEF;
|
||||
}else if( Bs_ENTER==BsTmp ){
|
||||
pCanvas->Brush->Color = LP_ITEM_OVER;
|
||||
}else if( Bs_DOWN==BsTmp ){
|
||||
pCanvas->Brush->Color = LP_ITEM_SELECTED;
|
||||
}
|
||||
|
||||
if( BsTmp==Bs_ENTER ||
|
||||
BsTmp==Bs_DOWN )
|
||||
{
|
||||
pCanvas->FillRect(rtTmp);
|
||||
}
|
||||
pCanvas->Brush->Style = bsClear;
|
||||
pCanvas->Font->Color = FontClolor;
|
||||
|
||||
//----´¦Àí×Ö·û¹ý³¤------
|
||||
int nBorder = 4;
|
||||
int nWidth = m_nCapWidth-nBorder*2;
|
||||
if( nWidth>0 ){
|
||||
szFont = pCanvas->TextExtent(strCaption);
|
||||
if( szFont.Width>nWidth ){
|
||||
UnicodeString strShorty = strCaption;
|
||||
while( pCanvas->TextWidth( strShorty )>nWidth ){
|
||||
strShorty = strShorty.SubString( 1, strShorty.Length()-2 );
|
||||
}
|
||||
|
||||
strCaption = strShorty;
|
||||
strCaption+="...";
|
||||
szFont = pCanvas->TextExtent(strCaption);
|
||||
}
|
||||
//-----------
|
||||
pCanvas->TextOutW( m_nCapLeft+nBorder+(nWidth-szFont.Width)/2,
|
||||
rtTmp.Top+(rtTmp.Height()-szFont.Height)/2,
|
||||
strCaption);
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
int __fastcall TListViewMove::DoCellData(TStateBtn *sender)
|
||||
{
|
||||
NULL_RETURN0(m_LstData)
|
||||
NULL_RETURN0(sender)
|
||||
|
||||
sender->SetData(m_LstData->Items[sender->Index]);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TListViewMove::DoCellDBClick(TStateBtn *sender)
|
||||
{
|
||||
NULL_RETURN(sender)
|
||||
|
||||
if(FOnItemDBLClick) {
|
||||
|
||||
DATAInfo *pInfo = (DATAInfo *)sender->m_Data;
|
||||
FOnItemDBLClick(sender->Index, pInfo->bOn);
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TListViewMove::DoIconDraw(TStateBtn *sender, int BsTmp, TRect rtTmp, TCanvas *pCanvas)
|
||||
{
|
||||
NULL_RETURN(sender)
|
||||
|
||||
TGraphic *pIMG = (TGraphic *)sender->m_Data;
|
||||
int iWidth = pIMG->Width/3;
|
||||
|
||||
int nTrans =
|
||||
BsTmp==Bs_NORMAL ? 0:
|
||||
BsTmp==Bs_ENTER ? (-iWidth):
|
||||
BsTmp==Bs_DOWN ? (-2*iWidth):(-3*iWidth);
|
||||
|
||||
if( 0==sender->Index ) {
|
||||
DATAInfo *pInfo = (DATAInfo *)(sender->m_PAR->m_Data);
|
||||
if( pInfo->bOn ) {
|
||||
pIMG = m_pImgOn;
|
||||
}
|
||||
}
|
||||
|
||||
if( Bs_NORMAL==BsTmp ||
|
||||
Bs_ENTER==BsTmp ||
|
||||
Bs_DOWN==BsTmp )
|
||||
{
|
||||
HRGN rgnClip = CreateRectRgn( rtTmp.Left, rtTmp.Top,
|
||||
rtTmp.Left+rtTmp.Width(), rtTmp.Top+rtTmp.Height() );
|
||||
|
||||
SelectClipRgn( pCanvas->Handle, rgnClip );
|
||||
pCanvas->Draw(rtTmp.Left+nTrans, rtTmp.Top, pIMG);
|
||||
SelectClipRgn( pCanvas->Handle, NULL );
|
||||
DeleteObject(rgnClip);
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
int __fastcall TListViewMove::DoIconData(TStateBtn *sender)
|
||||
{
|
||||
NULL_RETURN0(sender)
|
||||
|
||||
if( 0==sender->Index ) {
|
||||
sender->SetData(m_pImgOff);
|
||||
}
|
||||
else if(1==sender->Index) {
|
||||
sender->SetData(m_pImgDel);
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
int __fastcall TListViewMove::DoIconsNum(TStateBtn *parent)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
int __fastcall TListViewMove::DoIconsBounds(TStateBtn *sender, TRect &rtBounds)
|
||||
{
|
||||
NULL_RETURN0(sender)
|
||||
|
||||
TGraphic *pTmp = (TGraphic *)sender->m_Data;
|
||||
|
||||
int iLeft, iTop, iWidth, iHeight;
|
||||
iWidth = pTmp->Width/3;
|
||||
iHeight = pTmp->Height;
|
||||
iTop = (CELL_HEIGHT-pTmp->Height)/2;
|
||||
if( 0==sender->Index ) {
|
||||
iLeft = 5;
|
||||
m_nCapLeft = iLeft+iWidth;
|
||||
}
|
||||
else if(1==sender->Index) {
|
||||
iLeft = m_RtContent.Left + m_RtContent.Width() - pTmp->Width/3 - 5;
|
||||
m_nCapWidth = iLeft - m_nCapLeft;
|
||||
}
|
||||
|
||||
rtBounds = TRect(iLeft, iTop, iLeft+iWidth, iTop+iHeight);
|
||||
|
||||
return 0;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TListViewMove::DoIconLClick(TStateBtn *sender)
|
||||
{
|
||||
NULL_RETURN(sender)
|
||||
|
||||
TStateBtn *parent = sender->m_PAR;
|
||||
int index = parent->Index;
|
||||
|
||||
DATAInfo *pInfo = (DATAInfo *)parent->m_Data;
|
||||
bool bOn = pInfo->bOn;
|
||||
|
||||
if( 0==sender->Index ) {
|
||||
|
||||
pInfo->bOn = !bOn;
|
||||
if(FOnItemStateChange) FOnItemStateChange( index, !bOn );
|
||||
}
|
||||
else if(1==sender->Index) {
|
||||
|
||||
if(FOnItemDelete && FOnItemDelete( index, -1 ) ) {
|
||||
|
||||
DeleteItem(index);
|
||||
}
|
||||
else {
|
||||
sender->Enter = false;
|
||||
sender->Down = false;
|
||||
sender->Paint();
|
||||
TRect rt = sender->GetBounds();
|
||||
RECT rtInvalid;
|
||||
rtInvalid.left = rt.Left;
|
||||
rtInvalid.top = rt.Top;
|
||||
rtInvalid.right = rt.Right;
|
||||
rtInvalid.left = rt.Bottom;
|
||||
InvalidateRect(this->Handle, &rtInvalid, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
int __fastcall TListViewMove::DoClickL(TStateBtn *Sender, TPoint pt)
|
||||
{
|
||||
if(Sender && Sender->m_PAR)
|
||||
Sender = Sender->m_PAR;
|
||||
|
||||
m_pMovBmp->SetSize(Sender->Width, Sender->Height);
|
||||
StretchBlt(m_pMovBmp->Canvas->Handle,
|
||||
0, 0, Sender->Width, Sender->Height,
|
||||
m_CanvasDr->Handle,
|
||||
Sender->Left, Sender->Top, Sender->Width, Sender->Height,
|
||||
SRCCOPY);
|
||||
m_pMovPanel->SetBounds(Sender->Left, Sender->Top, Sender->Width, Sender->Height);
|
||||
|
||||
return 0;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
int __fastcall TListViewMove::DoClickLP(TStateBtn *Sender, TPoint pt)
|
||||
{
|
||||
if( m_iSrc!=-1 && m_iDes!=-1 ) {
|
||||
|
||||
m_pMovPanel->Visible = false;
|
||||
|
||||
if( OnItemMoveEnd && OnItemMoveEnd( m_iSrc, m_iDes ) ) {
|
||||
|
||||
if( m_iSrc<m_iDes )
|
||||
m_iDes -= 1;
|
||||
m_LstData->Move(m_iSrc, m_iDes);
|
||||
this->IndSel = m_iDes;
|
||||
this->ReloadData( GetCellBeg() );
|
||||
}
|
||||
}
|
||||
|
||||
m_iSrc = m_iDes = -1;
|
||||
Screen->Cursor = crDefault;
|
||||
bMovBottom = false;
|
||||
|
||||
return 0;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
int __fastcall TListViewMove::DoMDMOV(TStateBtn *Src, TStateBtn *Des, TPoint pt)
|
||||
{
|
||||
if( Src && NULL!=Src->m_PAR )
|
||||
return 0;
|
||||
|
||||
if(Des && Des->m_PAR)
|
||||
Des = Des->m_PAR;
|
||||
|
||||
if(Src && Des && (Src!=Des||Src->Index!=IndSel) && PtInRect( m_RtContent, pt ) ) {
|
||||
|
||||
m_iSrc = IndSel;
|
||||
m_iDes = Des->Index;
|
||||
TRect rtLine;
|
||||
rtLine.Left = Des->Left;
|
||||
rtLine.Top = Des->Top;
|
||||
rtLine.Right = Des->Left+Des->Width;
|
||||
rtLine.Bottom = Des->Top+LINE_LEN;
|
||||
Canvas->Brush->Bitmap = m_pMovLine;
|
||||
Canvas->FillRect(rtLine);
|
||||
|
||||
m_pMovPanel->Top = pt.Y;
|
||||
m_pMovPanel->Visible = true;
|
||||
|
||||
if( OnItemMoveIng ) {
|
||||
if( OnItemMoveIng( m_iSrc, m_iDes ) ) {
|
||||
Screen->Cursor = crDrag;
|
||||
}
|
||||
else {
|
||||
Screen->Cursor = crNoDrop;
|
||||
m_iDes = -1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
Screen->Cursor = crDrag;
|
||||
}
|
||||
bMovBottom = false;
|
||||
}
|
||||
else if( !bMovBottom ){
|
||||
m_iDes = -1;
|
||||
m_pMovPanel->Visible = false;
|
||||
if( -1!=m_iSrc )
|
||||
Screen->Cursor = crNoDrop;
|
||||
if(!Src && !Des) {
|
||||
Screen->Cursor = crDefault;
|
||||
m_iSrc = m_iDes = -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
int __fastcall TListViewMove::DoMDBottom(TTableView *Sender)
|
||||
{
|
||||
if( -1!=m_iSrc )
|
||||
{
|
||||
TStateBtn *Des = GetCellAds(Count-1);
|
||||
if( Des && Des->Index!=IndSel )
|
||||
{
|
||||
bMovBottom = true;
|
||||
|
||||
m_iSrc = IndSel;
|
||||
m_iDes = Des->Index+1;
|
||||
TRect rtLine;
|
||||
rtLine.Left = Des->Left;
|
||||
rtLine.Top = Des->Top+Des->Height-LINE_LEN;
|
||||
rtLine.Right = Des->Left+Des->Width;
|
||||
rtLine.Bottom = rtLine.Top+LINE_LEN;
|
||||
Canvas->Brush->Bitmap = m_pMovLine;
|
||||
Canvas->FillRect(rtLine);
|
||||
|
||||
m_pMovPanel->Top = Des->Top+Des->Height;
|
||||
m_pMovPanel->Visible = true;
|
||||
|
||||
if( OnItemMoveIng ) {
|
||||
if( OnItemMoveIng( m_iSrc, m_iDes ) ) {
|
||||
Screen->Cursor = crDrag;
|
||||
}
|
||||
else {
|
||||
Screen->Cursor = crNoDrop;
|
||||
m_iDes = -1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
Screen->Cursor = crDrag;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TListViewMove::DoMovPaint(TPanelDB *Sender, TCanvas *pCanvas, TRect rtBKG)
|
||||
{
|
||||
TPanel *panel = (TPanel *)Sender;
|
||||
TRect rtThis = TRect(0, 0, panel->Width, panel->Height);
|
||||
SetBkMode( pCanvas->Handle, TRANSPARENT);
|
||||
StyleServices()->DrawParentBackground( panel->Handle, pCanvas->Handle, NULL, false, rtThis);
|
||||
|
||||
BLENDFUNCTION BFun;
|
||||
BFun.BlendOp = AC_SRC_OVER;
|
||||
BFun.BlendFlags = 0;
|
||||
BFun.SourceConstantAlpha = 100;
|
||||
BFun.AlphaFormat = 0;
|
||||
|
||||
::AlphaBlend( pCanvas->Handle,
|
||||
0, 0, rtThis.Width(), rtThis.Height(),
|
||||
m_pMovBmp->Canvas->Handle,
|
||||
0, 0, m_pMovBmp->Width, m_pMovBmp->Height,
|
||||
BFun);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
int __fastcall TListViewMove::DoClickR(TStateBtn *Sender, TPoint pt)
|
||||
{
|
||||
NULL_RETURN0(Sender)
|
||||
|
||||
if(FOnItemRightClick && !Sender->m_PAR) {
|
||||
|
||||
DATAInfo *pInfo = (DATAInfo *)Sender->m_Data;
|
||||
FOnItemRightClick(Sender->Index, pInfo->bOn, pt);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TListViewMove::AddIcon(TPngImage *pImgDel, TPngImage *pImgOff, TPngImage *pImgOn)
|
||||
{
|
||||
m_pImgDel = pImgDel;
|
||||
m_pImgOff = pImgOff;
|
||||
m_pImgOn = pImgOn;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TListViewMove::AddItem(String caption, bool bOn, bool bPaint, int insertIndex)
|
||||
{
|
||||
NULL_RETURN(m_LstData)
|
||||
|
||||
DATAInfo *pInfo = new DATAInfo(caption, bOn);
|
||||
if( insertIndex<0 || insertIndex>m_LstData->Count )
|
||||
insertIndex = m_LstData->Count;
|
||||
if(0<=insertIndex && insertIndex<=m_LstData->Count )
|
||||
m_LstData->Insert(insertIndex, pInfo);
|
||||
|
||||
if( bPaint ) {
|
||||
|
||||
IndSel = insertIndex;
|
||||
if( IsCellVisible(insertIndex) )
|
||||
ReloadData( GetCellBeg() );
|
||||
else
|
||||
ReloadData( insertIndex );
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TListViewMove::DeleteItem(int index, bool bPaint)
|
||||
{
|
||||
NULL_RETURN(m_LstData)
|
||||
|
||||
if( 0<=index && index<m_LstData->Count ) {
|
||||
|
||||
DATAInfo *pInfo = (DATAInfo *)(m_LstData->Items[index]);
|
||||
SAFE_DELETE(pInfo)
|
||||
m_LstData->Delete(index);
|
||||
|
||||
if( bPaint ) {
|
||||
IndSel = NOSET;
|
||||
if( IsCellVisible(index) )
|
||||
ReloadData( GetCellBeg() );
|
||||
else
|
||||
ReloadData( index-1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TListViewMove::MoveItems(int srcIndex, int desIndex)
|
||||
{
|
||||
NULL_RETURN(m_LstData)
|
||||
|
||||
if(srcIndex<0) srcIndex = 0;
|
||||
else if(srcIndex>=m_LstData->Count ) {
|
||||
srcIndex = m_LstData->Count-1;
|
||||
}
|
||||
if(desIndex<0) desIndex = 0;
|
||||
else if(desIndex>=m_LstData->Count ) {
|
||||
desIndex = m_LstData->Count-1;
|
||||
}
|
||||
|
||||
if( srcIndex==desIndex ) return;
|
||||
|
||||
if( 0<=srcIndex && srcIndex<m_LstData->Count &&
|
||||
0<=desIndex && desIndex<m_LstData->Count ) {
|
||||
m_LstData->Move(srcIndex, desIndex);
|
||||
IndSel = desIndex;
|
||||
ReloadData( desIndex );
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TListViewMove::ClearAllItems()
|
||||
{
|
||||
NULL_RETURN(m_LstData)
|
||||
|
||||
for( int i=0; i<m_LstData->Count; i++ ) {
|
||||
|
||||
DATAInfo *pInfo = (DATAInfo *)(m_LstData->Items[i]);
|
||||
SAFE_DELETE(pInfo)
|
||||
}
|
||||
m_LstData->Clear();
|
||||
|
||||
this->ReloadData();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TListViewMove::SetItemState(int index, bool bOn, bool bPaint)
|
||||
{
|
||||
if( 0<=index && index<m_LstData->Count ) {
|
||||
|
||||
DATAInfo *pInfo = (DATAInfo *)(m_LstData->Items[index]);
|
||||
pInfo->bOn = bOn;
|
||||
|
||||
if( bPaint ) {
|
||||
if( IsCellVisible(index) ) ReloadData( GetCellBeg() );
|
||||
else ReloadData( index );
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
int __fastcall TListViewMove::GetItemState(int index)
|
||||
{
|
||||
if( 0<=index && index<m_LstData->Count ) {
|
||||
DATAInfo *pInfo = (DATAInfo *)(m_LstData->Items[index]);
|
||||
return pInfo->bOn;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ListViewMoveH
|
||||
#define ListViewMoveH
|
||||
//---------------------------------------------------------------------------
|
||||
#include "ListViewBase.h"
|
||||
//---------------------------------------------------------------------------
|
||||
typedef bool __fastcall (__closure *TNotifyItemClick)(int index, bool bOn);
|
||||
typedef bool __fastcall (__closure *TNotifyItemChange)(int indSrc, int indDes);
|
||||
typedef bool __fastcall (__closure *TNotifyItemClickPt)(int index, bool bOn, TPoint pt);
|
||||
#define CELL_HEIGHT 18
|
||||
typedef struct tagDataInfo{
|
||||
String caption;
|
||||
bool bOn;
|
||||
tagDataInfo(String captionTmp, bool bOnTmp){
|
||||
caption = captionTmp;
|
||||
bOn = bOnTmp ;
|
||||
}
|
||||
tagDataInfo(){
|
||||
caption = L"";
|
||||
bOn = true;
|
||||
}
|
||||
}DATAInfo;
|
||||
//---------------------------------------------------------------------------
|
||||
class TListViewMove: public TListViewBase
|
||||
{
|
||||
|
||||
private:
|
||||
|
||||
bool bMovBottom;
|
||||
TNotifyItemClick FOnItemDBLClick, FOnItemStateChange;
|
||||
TNotifyItemChange FOnItemDelete, FOnItemMoveIng, FOnItemMoveEnd;
|
||||
TNotifyItemClickPt FOnItemRightClick;
|
||||
|
||||
virtual void __fastcall DoDrawBKG(TPanelDB *Sender, TCanvas *pCanvas, TRect rtBKG);
|
||||
virtual int __fastcall DoTitle(TTableView *Sender);
|
||||
virtual int __fastcall DoBottom(TTableView *Sender);
|
||||
|
||||
virtual int __fastcall DoCellHgt(TTableView *Sender, int iCellIndex);
|
||||
virtual int __fastcall DoClickL(TStateBtn *Sender, TPoint pt);
|
||||
virtual int __fastcall DoClickLP(TStateBtn *Sender, TPoint pt);
|
||||
virtual int __fastcall DoClickR(TStateBtn *Sender, TPoint pt);
|
||||
virtual int __fastcall DoMDNum(TTableView *Sender);
|
||||
virtual int __fastcall DoMDBottom(TTableView *Sender);
|
||||
virtual int __fastcall DoMDMOV(TStateBtn *Src, TStateBtn *Des, TPoint pt);
|
||||
|
||||
virtual void __fastcall DoCellDraw(TStateBtn *sender, int BsTmp, TRect rtTmp, TCanvas *pCanvas);
|
||||
virtual int __fastcall DoCellData(TStateBtn *sender);
|
||||
virtual void __fastcall DoCellDBClick(TStateBtn *sender);
|
||||
|
||||
virtual void __fastcall DoIconDraw(TStateBtn *sender, int BsTmp, TRect rtTmp, TCanvas *pCanvas);
|
||||
virtual int __fastcall DoIconData(TStateBtn *sender);
|
||||
virtual int __fastcall DoIconsNum(TStateBtn *parent);
|
||||
virtual int __fastcall DoIconsBounds(TStateBtn *sender, TRect &rtBounds);
|
||||
virtual void __fastcall DoIconLClick(TStateBtn *sender);
|
||||
|
||||
int m_nCapLeft;
|
||||
int m_nCapWidth;
|
||||
|
||||
TList *m_LstData;
|
||||
|
||||
int m_iSrc, m_iDes;
|
||||
TBitmap *m_pMovLine;
|
||||
TBitmap *m_pMovBmp;
|
||||
TPanelDB *m_pMovPanel;
|
||||
void __fastcall DoMovPaint(TPanelDB *Sender, TCanvas *pCanvas, TRect rtBKG);
|
||||
|
||||
TPngImage *m_pImgDel;
|
||||
TPngImage *m_pImgOff;
|
||||
TPngImage *m_pImgOn;
|
||||
|
||||
public:
|
||||
|
||||
void __fastcall AddIcon(TPngImage *pImgDel, TPngImage *pImgOff, TPngImage *pImgOn);
|
||||
void __fastcall AddItem(String caption, bool bOn=true, bool bPaint=true, int insertIndex=-1);
|
||||
void __fastcall DeleteItem(int index, bool bPaint=true);
|
||||
void __fastcall MoveItems(int srcIndex, int desIndex);
|
||||
void __fastcall ClearAllItems();
|
||||
int __fastcall GetItemState(int index);
|
||||
void __fastcall SetItemState(int index, bool bOn=true, bool bPaint=true);
|
||||
|
||||
__fastcall TListViewMove(TComponent* Owner);
|
||||
__fastcall ~TListViewMove();
|
||||
|
||||
__published:
|
||||
|
||||
__property IndSel;
|
||||
__property Count;
|
||||
|
||||
__property TNotifyItemClick OnItemDBLClick = {read=FOnItemDBLClick, write=FOnItemDBLClick };
|
||||
__property TNotifyItemClickPt OnItemRightClick = {read=FOnItemRightClick, write=FOnItemRightClick };
|
||||
__property TNotifyItemClick OnItemStateChange = {read=FOnItemStateChange, write=FOnItemStateChange };
|
||||
__property TNotifyItemChange OnItemDelete = {read=FOnItemDelete, write=FOnItemDelete };
|
||||
__property TNotifyItemChange OnItemMoveIng = {read=FOnItemMoveIng, write=FOnItemMoveIng };
|
||||
__property TNotifyItemChange OnItemMoveEnd = {read=FOnItemMoveEnd, write=FOnItemMoveEnd };
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,442 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "ListViewPattern.h"
|
||||
#include "GlobalUnit.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
//---------------------------------------------------------------------------
|
||||
#define LP_ITEM_OVER RGB(67, 73, 80)
|
||||
#define LP_ITEM_SELECTED RGB(0, 0, 0)
|
||||
#define LP_ITEM_DEF RGB(39, 42, 47)
|
||||
#define CELL_HEIGHT 18
|
||||
|
||||
#define LINE_COLOR RGB(123, 123, 123)
|
||||
#define FontClolor TColor(0xBDAA9C)
|
||||
|
||||
const BYTE u_arrChordPreset[2][4][4] = { //预设和弦
|
||||
{{0,37,9,30},{0,37,20,28},{0,9,20,28},{0,17,37,30}},
|
||||
{{37,9,28,16},{37,17,20,28},{37,0,9,17},{37,28,20,16}} };
|
||||
|
||||
TPngImage *pngCol = NULL;
|
||||
TPngImage *pngUnCol = NULL;
|
||||
TPngImage *pngCharge = NULL;
|
||||
void LoadImg()
|
||||
{
|
||||
if( !pngCol ) pngCol = new TPngImage();
|
||||
if( !pngUnCol ) pngUnCol = new TPngImage();
|
||||
if( !pngCharge ) pngCharge = new TPngImage();
|
||||
|
||||
pngCol->LoadFromResourceName(int(HInstance), L"imgCollect");
|
||||
pngUnCol->LoadFromResourceName(int(HInstance), L"imgUnCollect");
|
||||
pngCharge->LoadFromResourceName(int(HInstance), L"imgStyleCharge");
|
||||
}
|
||||
void ReleaseImg()
|
||||
{
|
||||
SAFE_DELETE(pngCol);
|
||||
SAFE_DELETE(pngUnCol);
|
||||
SAFE_DELETE(pngCharge);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TListViewPattern::TListViewPattern(TComponent* Owner, bool bChan9,
|
||||
TStageList* lstStages, int iPlayBar)
|
||||
: TListViewBase( Owner )
|
||||
{
|
||||
m_nPlayIndex = -1;
|
||||
m_iFont = -1;
|
||||
m_iProg = -1;
|
||||
m_pPtInfo = NULL;
|
||||
|
||||
m_bChan9 = bChan9;
|
||||
m_iPlayBar = iPlayBar;
|
||||
m_lstStages = lstStages;
|
||||
FOnTextureChanged = NULL;
|
||||
|
||||
ShowHint = true;
|
||||
m_btnHint = NULL;
|
||||
|
||||
LoadImg();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TListViewPattern::~TListViewPattern()
|
||||
{
|
||||
ReleaseImg();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
int __fastcall TListViewPattern::DoCellHgt(TTableView *Sender, int iCellIndex)
|
||||
{
|
||||
return CELL_HEIGHT;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
int __fastcall TListViewPattern::DoMDNum(TTableView *Sender)
|
||||
{
|
||||
NULL_RETURN0(m_LstParttern)
|
||||
return m_LstParttern->size();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
int __fastcall TListViewPattern::DoCellData(TStateBtn *sender)
|
||||
{
|
||||
NULL_RETURN0(m_LstParttern)
|
||||
sender->SetData((void *)((*m_LstParttern)[sender->Index]));
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TListViewPattern::DoCellDraw(TStateBtn *sender, int BsTmp, TRect rtTmp, TCanvas *pCanvas)
|
||||
{
|
||||
TStateBtn *pBtn = (TStateBtn *)sender;
|
||||
TTextureInfo *pPtInfo = (TTextureInfo*)pBtn->m_Data;
|
||||
|
||||
if( Bs_NORMAL==BsTmp ) {
|
||||
pCanvas->Brush->Color = LP_ITEM_DEF;
|
||||
}else if( Bs_ENTER==BsTmp ){
|
||||
pCanvas->Brush->Color = LP_ITEM_OVER;
|
||||
}else if( Bs_DOWN==BsTmp ){
|
||||
pCanvas->Brush->Color = LP_ITEM_SELECTED;
|
||||
}
|
||||
|
||||
if( BsTmp==Bs_NORMAL || BsTmp==Bs_ENTER || BsTmp==Bs_DOWN ) {
|
||||
pCanvas->FillRect(rtTmp);
|
||||
|
||||
int iLeft, iTop;
|
||||
TSize sizeFont;
|
||||
String strText;
|
||||
|
||||
pCanvas->Brush->Style = bsClear;
|
||||
pCanvas->Font->Color = GetSegmentColor( pPtInfo->segType, 0, false );
|
||||
|
||||
//绘制乐器
|
||||
if( !m_bChan9 ) strText = GM_INSTRUMENT[pPtInfo->prog];
|
||||
else strText = L"GM鼓";
|
||||
sizeFont = pCanvas->TextExtent( strText );
|
||||
iLeft = LEFT_CAPTION+(WIDTH_PROG(Width)-sizeFont.Width)/2;
|
||||
iTop = rtTmp.Top+(rtTmp.Height()-sizeFont.Height)/2;
|
||||
pCanvas->TextOutW(iLeft, iTop, strText);
|
||||
pCanvas->Pen->Color = LINE_COLOR;
|
||||
pCanvas->MoveTo( LEFT_CAPTION+WIDTH_PROG(Width)+WIDTH_LINE/2 , rtTmp.Top);
|
||||
pCanvas->LineTo( LEFT_CAPTION+WIDTH_PROG(Width)+WIDTH_LINE/2, rtTmp.Bottom);
|
||||
|
||||
String oriFontName = pCanvas->Font->Name;
|
||||
pCanvas->Font->Name = "Times New Roman";
|
||||
|
||||
//绘制风格id号
|
||||
char styleID[256];
|
||||
if( pPtInfo->idLoc==0 )
|
||||
sprintf(styleID, "[%d]", pPtInfo->idStyle);
|
||||
else if( pPtInfo->idLoc==1 )
|
||||
sprintf(styleID, "[S%d]", pPtInfo->idStyle);
|
||||
else if( pPtInfo->idLoc!=(UINT)-1 )
|
||||
sprintf( styleID, "[L%d] ", LOWORD(pPtInfo->idStyle) );
|
||||
|
||||
iLeft = LEFT_STYLE(Width);
|
||||
strText = styleID;
|
||||
sizeFont = pCanvas->TextExtent( strText );
|
||||
iLeft = LEFT_STYLE(Width)+(WIDTH_STYLE(Width)-sizeFont.Width)/2;
|
||||
iTop = rtTmp.Top+(rtTmp.Height()-sizeFont.Height)/2;
|
||||
pCanvas->TextOutW(iLeft, iTop, strText);
|
||||
|
||||
pCanvas->Pen->Color = LINE_COLOR;
|
||||
pCanvas->MoveTo( LEFT_STYLE(Width)+WIDTH_STYLE(Width)+WIDTH_LINE/2 , rtTmp.Top);
|
||||
pCanvas->LineTo( LEFT_STYLE(Width)+WIDTH_STYLE(Width)+WIDTH_LINE/2 , rtTmp.Bottom);
|
||||
|
||||
//绘制伴奏类型
|
||||
char segName[256];
|
||||
sprintf(segName, "[%s-%d]", NAME_SEG[pPtInfo->segType], pPtInfo->segNo+1);
|
||||
strText = segName;
|
||||
sizeFont = pCanvas->TextExtent( strText );
|
||||
iLeft = LEFT_SEG(Width)+(WIDTH_SEG(Width)-sizeFont.Width)/2;
|
||||
iTop = rtTmp.Top+(rtTmp.Height()-sizeFont.Height)/2;
|
||||
|
||||
pCanvas->TextOutW(iLeft, iTop, strText);
|
||||
|
||||
pCanvas->Pen->Color = LINE_COLOR;
|
||||
pCanvas->MoveTo( LEFT_SEG(Width)+WIDTH_SEG(Width)+WIDTH_LINE/2 , rtTmp.Top);
|
||||
pCanvas->LineTo( LEFT_SEG(Width)+WIDTH_SEG(Width)+WIDTH_LINE/2 , rtTmp.Bottom);
|
||||
|
||||
pCanvas->Font->Name = oriFontName;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TListViewPattern::DoIconDraw(TStateBtn *sender, int BsTmp, TRect rtTmp, TCanvas *pCanvas)
|
||||
{
|
||||
TStateBtn *pBtn = (TStateBtn *)sender;
|
||||
TStateBtn *pCell = pBtn->m_PAR;
|
||||
TTextureInfo *info = (TTextureInfo*)pCell->m_Data;
|
||||
TPngImage *pIMG = NULL;
|
||||
String sHint;
|
||||
|
||||
if(sender->Index==0) {
|
||||
pIMG = info->bCollected?pngCol:pngUnCol;
|
||||
if(BsTmp==Bs_ENTER ) {
|
||||
sHint = info->bCollected ? "点击取消收藏" : "点击收藏";
|
||||
}
|
||||
}
|
||||
else if(sender->Index==1) {
|
||||
TPROSTYLE* styleInfo = GetStyleInfo( info->idLoc, info->idStyle );
|
||||
if( styleInfo && styleInfo->idLoc==0 && styleInfo->pOrigin->cost>0 ) {
|
||||
pIMG = pngCharge;
|
||||
if(BsTmp==Bs_ENTER ) {
|
||||
sHint = "收费:";
|
||||
sHint += IntToStr( styleInfo->pOrigin->cost );
|
||||
sHint += "唱作音符";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( pIMG ) {
|
||||
int iWidth = pIMG->Width/3;
|
||||
int nTrans = BsTmp==Bs_NORMAL ? 0
|
||||
: BsTmp==Bs_ENTER ? (-iWidth)
|
||||
: BsTmp==Bs_DOWN ? (-2*iWidth)
|
||||
: (-3*iWidth);
|
||||
|
||||
if( Bs_NORMAL==BsTmp || Bs_ENTER==BsTmp || Bs_DOWN==BsTmp ) {
|
||||
HRGN rgnClip = CreateRectRgn( rtTmp.Left, rtTmp.Top,
|
||||
rtTmp.Left+rtTmp.Width(), rtTmp.Top+rtTmp.Height() );
|
||||
|
||||
SelectClipRgn( pCanvas->Handle, rgnClip );
|
||||
pCanvas->Draw(rtTmp.Left+nTrans, rtTmp.Top, pIMG);
|
||||
SelectClipRgn( pCanvas->Handle, NULL );
|
||||
DeleteObject(rgnClip);
|
||||
}
|
||||
}
|
||||
|
||||
if( sHint.Length() ){
|
||||
m_btnHint = sender;
|
||||
Hint = sHint;
|
||||
}
|
||||
else if(m_btnHint==sender ){
|
||||
m_btnHint = NULL;
|
||||
Hint = "";
|
||||
Application->CancelHint();
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
int __fastcall TListViewPattern::DoIconsNum(TStateBtn *parent)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
int __fastcall TListViewPattern::DoIconsBounds(TStateBtn *sender, TRect &rtBounds)
|
||||
{
|
||||
int iLeft, iTop, iWidth, iHeight;
|
||||
|
||||
if(sender->Index==0) {
|
||||
|
||||
iLeft = Width - WIDTH_SB - WIDTH_IMG_COL;
|
||||
iTop = (CELL_HEIGHT - 15) / 2;
|
||||
iWidth = 21;
|
||||
iHeight = 15;
|
||||
}
|
||||
else if(sender->Index==1) {
|
||||
|
||||
iLeft = LEFT_SEG(Width) - WIDTH_IMG_CHARGE - 1;
|
||||
iTop = (CELL_HEIGHT - pngCharge->Height)/2;
|
||||
iWidth = pngCharge->Width/3;
|
||||
iHeight = pngCharge->Height;
|
||||
}
|
||||
|
||||
rtBounds = TRect(iLeft, iTop, iLeft+iWidth, iTop+iHeight);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TListViewPattern::DoCellLClick(TStateBtn *sender)
|
||||
{
|
||||
TStateBtn *pBtn = (TStateBtn *)sender;
|
||||
|
||||
if( m_pPtInfo!=(TTextureInfo*)pBtn->m_Data ){
|
||||
if( m_nPlayIndex!=this->IndSel )
|
||||
f_MM_Stop();
|
||||
|
||||
m_pPtInfo = (TTextureInfo *)pBtn->m_Data;
|
||||
|
||||
if( FOnTextureChanged )
|
||||
FOnTextureChanged((TObject*)m_pPtInfo);
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TListViewPattern::DoCellDBClick(TStateBtn *sender)
|
||||
{
|
||||
TTextureInfo *pPtInfo = NULL;
|
||||
|
||||
if( sender ) {
|
||||
TStateBtn *pBtn = (TStateBtn *)sender;
|
||||
pPtInfo = (TTextureInfo*)pBtn->m_Data;
|
||||
m_nPlayIndex = pBtn->Index;
|
||||
}
|
||||
else {
|
||||
pPtInfo = m_pPtInfo;
|
||||
}
|
||||
|
||||
if( pPtInfo ){
|
||||
TPROSTYLE* info = GetStyleInfo( pPtInfo->idLoc, pPtInfo->idStyle );
|
||||
if( !info )
|
||||
return;
|
||||
|
||||
int stype = pPtInfo->segType,
|
||||
sno = pPtInfo->segNo,
|
||||
iChno = -1,
|
||||
nStageNum = m_lstStages ? m_lstStages->size() : 1,
|
||||
nBarCount = 0,
|
||||
iPlayBar = m_iPlayBar,
|
||||
iFBar = -1;
|
||||
|
||||
TStage* aStages = new TStage[nStageNum];
|
||||
|
||||
for( int i=0; i<nStageNum; i++ ){
|
||||
TStage* pStage = &aStages[i];
|
||||
|
||||
if( m_lstStages ){
|
||||
TStage* pTemp = (*m_lstStages)[i];
|
||||
memcpy( pStage, pTemp, sizeof(TStage) );
|
||||
|
||||
if( pTemp->aChords ){
|
||||
pStage->aChords = new TBarChords[pTemp->nBarNum];
|
||||
memcpy( pStage->aChords, pTemp->aChords, sizeof(TBarChords)*pTemp->nBarNum );
|
||||
}
|
||||
}
|
||||
else{
|
||||
int seed = time(NULL);
|
||||
int barNum = 4;
|
||||
if( stype>=SEGTYPE_INTRO ){
|
||||
if( info->idLoc==0 ) {
|
||||
if( stype==SEGTYPE_INTRO )
|
||||
barNum = info->pOrigin->detail.aIntroBars[sno];
|
||||
else
|
||||
barNum = info->pOrigin->detail.aEndingBars[sno];
|
||||
}
|
||||
else if( info->idLoc==1 )
|
||||
barNum = info->pShare->aIEBars[stype][sno];
|
||||
else
|
||||
barNum = info->pLocal->aIEBars[stype][sno];
|
||||
}
|
||||
|
||||
pStage->nBarNum = barNum;
|
||||
|
||||
int key = g_iMelodyKey;
|
||||
if( key<0 || key>11 )
|
||||
key = seed % 12;
|
||||
|
||||
pStage->iSegKey = key;
|
||||
pStage->iSegType = stype;
|
||||
|
||||
char cType = (seed>>1) % 2;
|
||||
int iPreset = (seed>>2) % 4;
|
||||
|
||||
aStages->aChords = new TBarChords[barNum];
|
||||
for( int j=0; j<barNum; j++ ){
|
||||
char chordType = u_arrChordPreset[cType][iPreset][j] % 4;
|
||||
char chordKey = u_arrChordPreset[cType][iPreset][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;
|
||||
}
|
||||
}
|
||||
|
||||
if( pStage->iSegType==stype ){
|
||||
pStage->nTrkNum = 1;
|
||||
pStage->aTracks = new TComposeTrack;
|
||||
|
||||
TComposeTrack* pTrack = pStage->aTracks;
|
||||
|
||||
pTrack->iProg = pPtInfo->prog;
|
||||
pTrack->nVol = pPtInfo->vol;
|
||||
|
||||
if( info->idLoc==0 ){
|
||||
pTrack->iStyleLoc = 0;
|
||||
pTrack->iStyleId = info->idStyle;
|
||||
pTrack->iSegNo = sno;
|
||||
iChno = pTrack->iChanSpec = pTrack->iChanNo
|
||||
= info->pOrigin->detail.tracks[stype][sno][pPtInfo->chNo].no;
|
||||
}
|
||||
else if( info->idLoc==1 ){
|
||||
TSTYLESHARE* pShare = info->pShare;
|
||||
TSHARETRACKREF& rRef = pShare->trkRef[stype][sno][pPtInfo->chNo];
|
||||
|
||||
pTrack->iStyleLoc = 0;
|
||||
pTrack->iStyleId = rRef.idStyle;
|
||||
pTrack->iSegNo = rRef.segNo;
|
||||
iChno = pTrack->iChanSpec = pTrack->iChanNo = rRef.chan;
|
||||
}
|
||||
else{
|
||||
TSTYLELOCAL* pLocal = info->pLocal;
|
||||
TTRACKREF& rRef = pLocal->trkRef[stype][sno][pPtInfo->chNo];
|
||||
pTrack->iStyleLoc = rRef.idLoc;
|
||||
pTrack->iStyleId = rRef.idStyle;
|
||||
pTrack->iSegNo = rRef.segNo;
|
||||
iChno = pTrack->iChanSpec = pTrack->iChanNo = rRef.chan;
|
||||
}
|
||||
|
||||
if( iFBar<0 )
|
||||
iFBar = nBarCount;
|
||||
}
|
||||
|
||||
nBarCount += pStage->nBarNum;
|
||||
}
|
||||
|
||||
if( iPlayBar>=0 && iFBar>iPlayBar )
|
||||
iPlayBar = iFBar;
|
||||
|
||||
int len = 1000000;
|
||||
BYTE* data = new BYTE[len];
|
||||
HRESULT ret = f_CM_Compose( &len, data, g_iMelodyTimeSignature, g_nMelodyTempo,
|
||||
nStageNum, aStages, false, NULL, NULL );
|
||||
|
||||
if( ret==0 ){
|
||||
f_MM_LoadDemo( data, len );
|
||||
char* strFile = m_iFont==0xFF ? NULL : m_iFont<0x80 ? g_lstFonts[m_iFont]->strFileName
|
||||
: g_lstVSTi[m_iFont-0x80]->strFileName;
|
||||
f_MM_PlayDemo( NULL, iPlayBar, -1, m_iProg, m_iFont, strFile );
|
||||
}
|
||||
else
|
||||
DebugPrint( "Compose error: %d", ret );
|
||||
|
||||
delete[] data;
|
||||
|
||||
SAFE_DELETE_ARRAY(aStages);
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TListViewPattern::DoIconLClick(TStateBtn *sender)
|
||||
{
|
||||
if(sender->Index==0) {
|
||||
|
||||
TStateBtn *pBtn = (TStateBtn *)sender;
|
||||
TStateBtn *pCell = pBtn->m_PAR;
|
||||
TTextureInfo *pPtInfo = (TTextureInfo *)pCell->m_Data;
|
||||
pPtInfo->bCollected = !pPtInfo->bCollected;
|
||||
|
||||
TPROSTYLE* info = GetStyleInfo( pPtInfo->idLoc, pPtInfo->idStyle );
|
||||
char chan = info->idLoc==0 ?
|
||||
info->pOrigin->detail.tracks[pPtInfo->segType][pPtInfo->segNo][pPtInfo->chNo].no
|
||||
: info->idLoc==1 ?
|
||||
info->pShare->trkRef[pPtInfo->segType][pPtInfo->segNo][pPtInfo->chNo].chan
|
||||
: info->pLocal->trkRef[pPtInfo->segType][pPtInfo->segNo][pPtInfo->chNo].chan;
|
||||
|
||||
SetFavorTexture( pPtInfo->idLoc, pPtInfo->idStyle, pPtInfo->segType, pPtInfo->segNo,
|
||||
chan, pPtInfo->bCollected );
|
||||
// InsColSet( pInsRefTmp, pPtInfo->bCollected );
|
||||
|
||||
pBtn->Paint();
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
int __fastcall TListViewPattern::DoMouseWheel(TObject *Sender)
|
||||
{
|
||||
TListViewBase::DoMouseWheel(Sender);
|
||||
// m_Hint->ReleaseHandle();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
//void __fastcall TListViewPattern::HintTimerProc(System::TObject* Sender)
|
||||
//{
|
||||
// if( m_HintTimer )
|
||||
// m_HintTimer->Enabled = false;
|
||||
// if( m_Hint && HintStr.Length()>0 ){
|
||||
// m_Hint->ShowHintWindow( ClientToScreen(m_ptMove), HintStr );
|
||||
// }
|
||||
//}
|
||||
//// ---------------------------------------------------------------------------
|
||||
@@ -0,0 +1,101 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ListViewPatternH
|
||||
#define ListViewPatternH
|
||||
//---------------------------------------------------------------------------
|
||||
#include "ListViewBase.h"
|
||||
#include "FavorTextureUnit.h"
|
||||
#include "Compose.h"
|
||||
#include "SkinHintWindow.h"
|
||||
|
||||
#define WIDTH_LINE 4
|
||||
#define WIDTH_SB 14
|
||||
#define WIDTH_IMG_PROG 0
|
||||
#define WIDTH_IMG_COL 21
|
||||
#define WIDTH_IMG_CHARGE 21
|
||||
|
||||
#define WIDTH_AVERAGE(W) ((W-WIDTH_SB-WIDTH_IMG_PROG-WIDTH_IMG_COL-WIDTH_LINE*3)/5)
|
||||
#define WIDTH_PROG(W) (WIDTH_AVERAGE(W)*3)
|
||||
#define WIDTH_SEG(W) (WIDTH_AVERAGE(W)-6)
|
||||
#define WIDTH_STYLE(W) (WIDTH_AVERAGE(W)+6)
|
||||
|
||||
#define LEFT_CAPTION (WIDTH_IMG_PROG)
|
||||
#define LEFT_PROG (LEFT_CAPTION)
|
||||
#define LEFT_STYLE(W) (LEFT_PROG + WIDTH_PROG(W) + WIDTH_LINE)
|
||||
#define LEFT_SEG(W) (LEFT_STYLE(W) + WIDTH_STYLE(W) + WIDTH_LINE)
|
||||
#define LEFT_COL(W) (LEFT_SEG(W) + WIDTH_SEG(W) + WIDTH_LINE)
|
||||
//---------------------------------------------------------------------------
|
||||
typedef struct tagTextureInfo
|
||||
{
|
||||
// TPROSTYLE *styleInfo;
|
||||
UINT idLoc; //位置id
|
||||
UINT idStyle; //风格ID
|
||||
char segType; //片段类型
|
||||
char segNo; //片段号
|
||||
char chNo; //轨道序号 (与FavorTexture结构不同)
|
||||
char prog; //乐器号
|
||||
char vol; //音量
|
||||
bool bCollected;
|
||||
|
||||
tagTextureInfo(){
|
||||
memset( this, 0, sizeof(tagTextureInfo) );
|
||||
}
|
||||
tagTextureInfo( UINT loc, UINT sty, char type, char sNo, char cNo, char pg, char vl, bool bCol=false ){
|
||||
idLoc = loc;
|
||||
idStyle = sty;
|
||||
segType = type;
|
||||
segNo = sNo;
|
||||
chNo = cNo;
|
||||
prog = pg;
|
||||
vol = vl;
|
||||
bCollected = bCol;
|
||||
}
|
||||
}TTextureInfo, *PTTextureInfo;
|
||||
|
||||
typedef vector<TTextureInfo*> VCPtInfo;
|
||||
|
||||
class TListViewPattern: public TListViewBase
|
||||
{
|
||||
private:
|
||||
TStateBtn *m_btnHint;
|
||||
TStageList* m_lstStages;
|
||||
int m_iPlayBar;
|
||||
|
||||
virtual int __fastcall DoCellHgt(TTableView *Sender, int iCellIndex);
|
||||
virtual int __fastcall DoMDNum(TTableView *Sender);
|
||||
|
||||
virtual void __fastcall DoCellDraw(TStateBtn *sender, int BsTmp, TRect rtTmp, TCanvas *pCanvas);
|
||||
virtual int __fastcall DoCellData(TStateBtn *sender);
|
||||
virtual void __fastcall DoCellLClick(TStateBtn *sender);
|
||||
virtual void __fastcall DoCellDBClick(TStateBtn *sender);
|
||||
|
||||
virtual void __fastcall DoIconDraw(TStateBtn *sender, int BsTmp, TRect rtTmp, TCanvas *pCanvas);
|
||||
virtual int __fastcall DoIconsNum(TStateBtn *parent);
|
||||
virtual int __fastcall DoIconsBounds(TStateBtn *sender, TRect &rtBounds);
|
||||
virtual void __fastcall DoIconLClick(TStateBtn *sender);
|
||||
|
||||
int m_nPlayIndex;
|
||||
int m_iseed;
|
||||
TNotifyEvent FOnTextureChanged;
|
||||
|
||||
protected:
|
||||
|
||||
virtual int __fastcall DoMouseWheel(TObject *Sender);
|
||||
|
||||
public:
|
||||
|
||||
bool m_bChan9;
|
||||
|
||||
VCPtInfo *m_LstParttern;
|
||||
TTextureInfo *m_pPtInfo;
|
||||
char m_iFont, m_iProg;
|
||||
void __fastcall OnPartternPlay(TObject *sender);
|
||||
|
||||
__fastcall TListViewPattern(TComponent* Owner, bool bChan9=false, TStageList* lstStages=NULL, int iPlayBar=-1);
|
||||
__fastcall ~TListViewPattern();
|
||||
|
||||
__published:
|
||||
__property TNotifyEvent OnTextureChanged = {read=FOnTextureChanged, write=FOnTextureChanged };
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "ListViewText.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TListViewText::TListViewText(TComponent* Owner)
|
||||
: TListViewBase( Owner )
|
||||
{
|
||||
m_VcText = NULL;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
__fastcall TListViewText::~TListViewText()
|
||||
{
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
int __fastcall TListViewText::DoCellHgt(TTableView *Sender, int iCellIndex)
|
||||
{
|
||||
return CELL_HEIGHT;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
int __fastcall TListViewText::DoMDNum(TTableView *Sender)
|
||||
{
|
||||
if( m_VcText ) {
|
||||
int nSize = m_VcText->size();
|
||||
return m_VcText->size();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
int __fastcall TListViewText::DoCellData(TStateBtn *sender)
|
||||
{
|
||||
sender->SetData((void *)((*m_VcText)[sender->Index]));
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TListViewText::DoCellDraw(TStateBtn *sender, int BsTmp, TRect rtTmp, TCanvas *pCanvas)
|
||||
{
|
||||
TStateBtn *pBtn = (TStateBtn *)sender;
|
||||
char *strProg = (char *)pBtn->m_Data;
|
||||
|
||||
if( Bs_NORMAL==BsTmp ) {
|
||||
pCanvas->Brush->Color = LP_ITEM_DEF;
|
||||
}else if( Bs_ENTER==BsTmp ){
|
||||
pCanvas->Brush->Color = LP_ITEM_OVER;
|
||||
}else if( Bs_DOWN==BsTmp ){
|
||||
pCanvas->Brush->Color = LP_ITEM_SELECTED;
|
||||
}
|
||||
|
||||
if( BsTmp==Bs_NORMAL ||
|
||||
BsTmp==Bs_ENTER ||
|
||||
BsTmp==Bs_DOWN )
|
||||
{
|
||||
pCanvas->FillRect(rtTmp);
|
||||
|
||||
pCanvas->Brush->Style = bsClear;
|
||||
pCanvas->Font->Color = FontClolor;
|
||||
|
||||
String strCaption = strProg;
|
||||
TSize szFont = pCanvas->TextExtent(strCaption);
|
||||
// pCanvas->Font->Size = 8;
|
||||
pCanvas->TextOutW(rtTmp.Left+4,
|
||||
rtTmp.Top+(rtTmp.Height()-szFont.Height)/2,
|
||||
strCaption);
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ListViewTextH
|
||||
#define ListViewTextH
|
||||
//---------------------------------------------------------------------------
|
||||
#include "ListViewBase.h"
|
||||
|
||||
#define LP_ITEM_OVER RGB(67, 73, 80)
|
||||
#define LP_ITEM_SELECTED RGB(0, 0, 0)
|
||||
#define LP_ITEM_DEF RGB(39, 42, 47)
|
||||
|
||||
#define FontClolor TColor(0xBDAA9C)
|
||||
|
||||
#define CELL_HEIGHT 18
|
||||
//---------------------------------------------------------------------------
|
||||
class TListViewText: public TListViewBase
|
||||
{
|
||||
private:
|
||||
|
||||
virtual int __fastcall DoCellHgt(TTableView *Sender, int iCellIndex);
|
||||
virtual int __fastcall DoMDNum(TTableView *Sender);
|
||||
|
||||
virtual void __fastcall DoCellDraw(TStateBtn *sender, int BsTmp, TRect rtTmp, TCanvas *pCanvas);
|
||||
virtual int __fastcall DoCellData(TStateBtn *sender);
|
||||
|
||||
public:
|
||||
|
||||
vector<char*> *m_VcText;
|
||||
|
||||
__fastcall TListViewText(TComponent* Owner);
|
||||
__fastcall ~TListViewText();
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,520 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#include <vcl.h>
|
||||
#include <pcre.h>
|
||||
#include <stdio.h>
|
||||
#include "GlobalUnit.h"
|
||||
#pragma hdrstop
|
||||
|
||||
#include "LoginFormUnit.h"
|
||||
#include "MessageFormUnit.h"
|
||||
#include "VerifyCodeFormUnit.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
#pragma link "GeneralDialogPanel"
|
||||
#pragma link "LineEdit"
|
||||
#pragma link "TextButton"
|
||||
#pragma link "CKBox"
|
||||
#pragma resource "*.dfm"
|
||||
|
||||
TLoginForm *LoginForm = NULL;
|
||||
|
||||
const char* TLoginForm::m_pPattern[5] = {"^[_a-zA-Z0-9\\xA1-\\xFE\\.-]{3,16}$",
|
||||
"^[_a-zA-Z0-9\\.-]+@([_a-zA-Z0-9]+\\.)+[a-zA-Z0-9]{2,3}$",
|
||||
"^[\\x21-\\x7E]{3,16}$",
|
||||
"^[\\x21-\\x7E]{6,16}$",
|
||||
"^$|^1(3\\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\\d|9[0-35-9])\\d{8}$"
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
__fastcall TLoginForm::TLoginForm(TComponent* Owner)
|
||||
: TForm(Owner)
|
||||
{
|
||||
FIsLogin = true;
|
||||
// m_logPasswordEdit->PasswordChar = L'*';
|
||||
// m_regPasswordEdit->PasswordChar = L'*';
|
||||
// m_ConfirmEdit->PasswordChar = L'*';
|
||||
isEmailOrMobile = 0;
|
||||
|
||||
for( int i=0; i<ComponentCount; i++ ){
|
||||
if(Components[i]->ClassNameIs( TLabel::ClassName() ) )
|
||||
((TLabel*)Components[i])->ControlStyle>>csOpaque;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TLoginForm::FormCreate(TObject *Sender)
|
||||
{
|
||||
m_logDialogPanel->Font->Size = g_szFont9;
|
||||
m_logUserEdit->SetTextFont(g_strTxtFontName, g_szFont9);
|
||||
m_logPasswordEdit->SetTextFont(g_strTxtFontName, g_szFont9);
|
||||
m_logButton->FontSize = g_szFont9;
|
||||
|
||||
m_regDialogPanel->Font->Size = g_szFont9;
|
||||
m_regUserEdit->SetTextFont(g_strTxtFontName, g_szFont9);
|
||||
m_regPasswordEdit->SetTextFont(g_strTxtFontName, g_szFont9);
|
||||
m_VerifyEdit->SetTextFont(g_strTxtFontName, g_szFont9);
|
||||
m_ConfirmEdit->SetTextFont(g_strTxtFontName, g_szFont9);
|
||||
m_IsAutoLogin->Font->Size = g_szFont9;
|
||||
m_ckAgree->Font->Size = g_szFont9;
|
||||
m_regButton->FontSize = g_szFont9;
|
||||
m_sendButton->FontSize = g_szFont9;
|
||||
|
||||
FUserName = String(g_infoUser.strUserName);
|
||||
m_logUserEdit->Text = FUserName;
|
||||
|
||||
char strURL[256];
|
||||
f_CS_GetWebPageURL( URL_REGCODE, strURL );
|
||||
|
||||
RESTClient->BaseURL = String(strURL);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TLoginForm::FormShow(TObject *Sender)
|
||||
{
|
||||
Layout();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
bool __fastcall TLoginForm::CheckInput(const char * pText, int type)
|
||||
{
|
||||
bool bRet = false;
|
||||
pcre *pPcre = NULL;
|
||||
int nOffset = -1;
|
||||
const char *pPattern = m_pPattern[type];
|
||||
const char *pErrMsg = NULL;
|
||||
|
||||
if( NULL == (pPcre = pcre_compile(pPattern, 0, &pErrMsg, &nOffset, NULL)) ){
|
||||
printf("pcre_compile ErrMsg=%s\n", pErrMsg);
|
||||
}
|
||||
else{
|
||||
if( pcre_exec(pPcre, NULL, pText, strlen(pText), 0, NULL, 0) < 0 ){
|
||||
printf("%s doesn't match %s\n", pText, pPattern);
|
||||
}
|
||||
else{
|
||||
printf("%s matches %s\n", pText, pPattern);
|
||||
bRet = true;
|
||||
}
|
||||
|
||||
pcre_free(pPcre);
|
||||
}
|
||||
|
||||
return bRet;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TLoginForm::DoGoClick(TObject *Sender)
|
||||
{
|
||||
if(FIsLogin){
|
||||
m_logUserEdit->Text = m_logUserEdit->Text.Trim();
|
||||
m_logPasswordEdit->Text = m_logPasswordEdit->Text.Trim();
|
||||
|
||||
if(m_logUserEdit->Text.IsEmpty()){
|
||||
m_logUserEdit->SetFocus();
|
||||
}
|
||||
else if(m_logPasswordEdit->Text.IsEmpty()){
|
||||
m_logPasswordEdit->SetFocus();
|
||||
}
|
||||
else{
|
||||
bool bCheckOk = true;
|
||||
AnsiString astrUN = m_logUserEdit->Text;
|
||||
if( !CheckInput(astrUN.c_str(), 0) && !CheckInput(astrUN.c_str(), 1 )){
|
||||
m_logUserEdit->Text = "";
|
||||
m_logUserEdit->SetFocus();
|
||||
bCheckOk = false;
|
||||
}
|
||||
else{
|
||||
AnsiString astrPW = m_logPasswordEdit->Text;
|
||||
if(!CheckInput(astrPW.c_str(), 2)){
|
||||
m_logPasswordEdit->Text = "";
|
||||
m_logPasswordEdit->SetFocus();
|
||||
bCheckOk = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(bCheckOk){
|
||||
FUserName = m_logUserEdit->Text;
|
||||
FPassword = m_logPasswordEdit->Text;
|
||||
ModalResult = mrOk;
|
||||
|
||||
string strUN = AnsiString(FUserName).c_str();
|
||||
string strPW = AnsiString(FPassword).c_str();
|
||||
SetAutoLogin(FAutoLogin, strUN.c_str(), strPW.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
m_regUserEdit->Text = m_regUserEdit->Text.Trim();
|
||||
m_regPasswordEdit->Text = m_regPasswordEdit->Text.Trim();
|
||||
m_ConfirmEdit->Text = m_ConfirmEdit->Text.Trim();
|
||||
m_VerifyEdit->Text = m_VerifyEdit->Text.Trim();
|
||||
|
||||
if(m_regUserEdit->Text.IsEmpty()){
|
||||
m_regUserEdit->SetFocus();
|
||||
}
|
||||
else if(m_VerifyEdit->Text.IsEmpty()){
|
||||
m_VerifyEdit->SetFocus();
|
||||
}
|
||||
else if(m_regPasswordEdit->Text.IsEmpty()){
|
||||
m_regPasswordEdit->SetFocus();
|
||||
}
|
||||
else if(m_ConfirmEdit->Text.IsEmpty()){
|
||||
m_ConfirmEdit->SetFocus();
|
||||
}
|
||||
else{
|
||||
AnsiString astrPW = m_regPasswordEdit->Text;
|
||||
if(!CheckInput(astrPW.c_str(), 3)){
|
||||
m_regPasswordEdit->Text = "";
|
||||
m_regPasswordEdit->SetFocus();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(m_regPasswordEdit->Text.Compare(m_ConfirmEdit->Text)){
|
||||
m_ConfirmEdit->Text = "";
|
||||
m_ConfirmEdit->SetFocus();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
AnsiString astrUN = m_regUserEdit->Text;
|
||||
|
||||
if( CheckInput(astrUN.c_str(), 1) ){
|
||||
isEmailOrMobile = 1;
|
||||
}
|
||||
else if( CheckInput(astrUN.c_str(), 4) ){
|
||||
isEmailOrMobile = 2;
|
||||
}
|
||||
else{
|
||||
m_regUserEdit->Text = "";
|
||||
m_regUserEdit->SetFocus();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
this->Enabled = false;
|
||||
Screen->Cursor = crHourGlass;
|
||||
AnsiString strVerify = m_VerifyEdit->Text;
|
||||
|
||||
RESTRequest->Resource = "verifyRegCode";
|
||||
RESTRequest->Params->Clear();
|
||||
RESTRequest->Params->AddItem("username", astrUN);
|
||||
RESTRequest->Params->AddItem("verifyCode", strVerify);
|
||||
|
||||
try{
|
||||
RESTRequest->Execute();
|
||||
}
|
||||
catch (Exception &exception){
|
||||
DebugPrint("exception: %s", exception.Message );
|
||||
}
|
||||
|
||||
Screen->Cursor = crDefault;
|
||||
this->Enabled = true;
|
||||
|
||||
if(RESTResponse->StatusCode==200){
|
||||
TJSONValue *jValue = RESTResponse->JSONValue;
|
||||
if(jValue==NULL)
|
||||
return;
|
||||
|
||||
TJSONValue *jCode = jValue->FindValue("code");
|
||||
if( jCode==NULL )
|
||||
return;
|
||||
|
||||
String code = ((TJSONString*)jCode)->Value();
|
||||
if(code!="00000"){
|
||||
String msg;
|
||||
if(code=="A0213")
|
||||
msg = "注册验证码已过期";
|
||||
else if(code=="A0214")
|
||||
msg = "注册验证码错误";
|
||||
else
|
||||
msg = ((TJSONString*)jValue->FindValue("msg"))->Value();
|
||||
|
||||
MessageForm->ShowMessage( msg, MB_ICONERROR | MB_OK );
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
else{
|
||||
MessageForm->ShowMessage( RESTResponse->StatusText, MB_ICONERROR | MB_OK );
|
||||
return;
|
||||
}
|
||||
|
||||
FUserName = m_regUserEdit->Text;
|
||||
FPassword = m_regPasswordEdit->Text;
|
||||
ModalResult = mrOk;
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TLoginForm::DoSwitchClick(TObject *Sender)
|
||||
{
|
||||
FIsLogin = Sender!=(TObject*)m_logSwitchLabel;
|
||||
|
||||
Layout();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TLoginForm::DoAutoCheck(TObject *Sender)
|
||||
{
|
||||
FAutoLogin = m_IsAutoLogin->Checked;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TLoginForm::Layout()
|
||||
{
|
||||
if( FIsLogin ){
|
||||
m_logDialogPanel->Visible = true;
|
||||
m_regDialogPanel->Visible = false;
|
||||
|
||||
Height = 190;
|
||||
|
||||
if( m_logUserEdit->Text.IsEmpty() ){
|
||||
m_logUserEdit->SetFocus();
|
||||
}
|
||||
else if( m_logPasswordEdit->Text.IsEmpty() ){
|
||||
m_logPasswordEdit->SetFocus();
|
||||
}
|
||||
}
|
||||
else{
|
||||
m_logDialogPanel->Visible = false;
|
||||
m_regDialogPanel->Visible = true;
|
||||
|
||||
Height = 235;
|
||||
|
||||
m_ckAgree->Checked = true;
|
||||
m_ConfirmEdit->Text = "";
|
||||
|
||||
if( m_regUserEdit->Text.IsEmpty() ){
|
||||
m_regUserEdit->SetFocus();
|
||||
}
|
||||
else if( m_VerifyEdit->Text.IsEmpty() ){
|
||||
m_VerifyEdit->SetFocus();
|
||||
}
|
||||
else if( m_regPasswordEdit->Text.IsEmpty() ){
|
||||
m_regPasswordEdit->SetFocus();
|
||||
}
|
||||
else if( m_ConfirmEdit->Text.IsEmpty() ){
|
||||
m_ConfirmEdit->SetFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TLoginForm::SetUserName(String Value)
|
||||
{
|
||||
if(FUserName != Value){
|
||||
FUserName = Value;
|
||||
m_logUserEdit->Text = Value;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TLoginForm::SetPassWord(String Value)
|
||||
{
|
||||
if(FPassword != Value){
|
||||
FPassword = Value;
|
||||
m_logPasswordEdit->Text = Value;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TLoginForm::SetConfirm(String Value)
|
||||
{
|
||||
if(FConfirm != Value){
|
||||
FConfirm = Value;
|
||||
m_ConfirmEdit->Text = Value;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TLoginForm::SetVerify(String Value)
|
||||
{
|
||||
if(FVerify != Value){
|
||||
FVerify = Value;
|
||||
m_VerifyEdit->Text = Value;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TLoginForm::SetIsLogin(bool Value)
|
||||
{
|
||||
if(FIsLogin != Value){
|
||||
FIsLogin = Value;
|
||||
|
||||
Layout();
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TLoginForm::SetIsAntoLogin(bool Value)
|
||||
{
|
||||
if(FAutoLogin != Value){
|
||||
FAutoLogin = Value;
|
||||
m_IsAutoLogin->Checked = Value;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TLoginForm::FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift)
|
||||
{
|
||||
switch( Key ){
|
||||
case VK_RETURN:
|
||||
DoGoClick(NULL);
|
||||
break;
|
||||
|
||||
case VK_ESCAPE:
|
||||
ModalResult = mrCancel;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TLoginForm::AgreementMouseEnter(TObject *Sender)
|
||||
{
|
||||
m_lblAgreement->Font->Color = RGB(0, 255, 255);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TLoginForm::AgreementMouseLeave(TObject *Sender)
|
||||
{
|
||||
m_lblAgreement->Font->Color = RGB(0, 200, 200);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TLoginForm::AgreementClick(TObject *Sender)
|
||||
{
|
||||
char strURL[256];
|
||||
f_CS_GetWebPageURL( URL_USERAGREEMENT, strURL );
|
||||
ShellExecute(Handle, NULL, ((String)strURL).c_str(), NULL, NULL, SW_SHOWNORMAL);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TLoginForm::LinkLabelMouseEnter(TObject *Sender)
|
||||
{
|
||||
TLabel* pLabel = (TLabel*)Sender;
|
||||
pLabel->Font->Color = RGB(225, 235, 245);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TLoginForm::LinkLabelMouseLeave(TObject *Sender)
|
||||
{
|
||||
TLabel* pLabel = (TLabel*)Sender;
|
||||
pLabel->Font->Color = RGB(191,203,218);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TLoginForm::AgreeChange(TObject *Sender)
|
||||
{
|
||||
m_regButton->Enabled = m_ckAgree->Checked;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TLoginForm::DoSendClick(TObject *Sender)
|
||||
{
|
||||
// m_regUserEdit->Text = m_regUserEdit->Text.Trim();
|
||||
// if(m_regUserEdit->Text.IsEmpty()){
|
||||
// m_regUserEdit->SetFocus();
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
AnsiString astrUN = m_regUserEdit->Text;
|
||||
// if( !CheckInput(astrUN.c_str(), 1) && !CheckInput(astrUN.c_str(), 4 )){
|
||||
// m_regUserEdit->Text = "";
|
||||
// m_regUserEdit->SetFocus();
|
||||
// return;
|
||||
// }
|
||||
|
||||
String sKey, sCode;
|
||||
TVerifyCodeForm* pForm = new TVerifyCodeForm(NULL, RESTClient->BaseURL);
|
||||
if( pForm->ShowModal() == mrOk){
|
||||
sKey = pForm->GetKey();
|
||||
sCode = pForm->GetCode();
|
||||
}
|
||||
delete pForm;
|
||||
|
||||
if(sKey.Length()==0 || sCode.Length()==0)
|
||||
return;
|
||||
|
||||
this->Enabled = false;
|
||||
Screen->Cursor = crHourGlass;
|
||||
|
||||
RESTRequest->Resource = "sendRegCode";
|
||||
RESTRequest->Params->Clear();
|
||||
RESTRequest->Params->AddItem("contact", astrUN);
|
||||
RESTRequest->Params->AddItem("captchaKey", sKey);
|
||||
RESTRequest->Params->AddItem("captchaCode", sCode);
|
||||
|
||||
try{
|
||||
RESTRequest->Execute();
|
||||
}
|
||||
catch (Exception &exception){
|
||||
DebugPrint("exception: %s", exception.Message );
|
||||
}
|
||||
|
||||
Screen->Cursor = crDefault;
|
||||
this->Enabled = true;
|
||||
|
||||
if(RESTResponse->StatusCode==200){
|
||||
TJSONValue *jValue = RESTResponse->JSONValue;
|
||||
if(jValue==NULL)
|
||||
return;
|
||||
|
||||
TJSONValue *jCode = jValue->FindValue("code");
|
||||
if( jCode==NULL )
|
||||
return;
|
||||
|
||||
String code = ((TJSONString*)jCode)->Value();
|
||||
if(code=="00000"){
|
||||
m_sendButton->Text = String(CODE_INTERVAL) + "秒";
|
||||
m_sendButton->Enabled = false;
|
||||
|
||||
PostMessage(Application->MainFormHandle, UM_STARTCDTIMER, 0, 0);
|
||||
MessageForm->ShowMessage("已向 " + astrUN + " 发送注册验证码\n(15分钟内有效,请勿重复提交!)", MB_OK | MB_ICONINFORMATION);
|
||||
}
|
||||
else{
|
||||
String msg;
|
||||
if(code=="A0213")
|
||||
msg = "人机验证码已过期";
|
||||
else if(code=="A0214")
|
||||
msg = "人机验证码错误";
|
||||
else
|
||||
msg = ((TJSONString*)jValue->FindValue("msg"))->Value();
|
||||
|
||||
MessageForm->ShowMessage( msg, MB_ICONERROR | MB_OK );
|
||||
}
|
||||
}
|
||||
else{
|
||||
MessageForm->ShowMessage( RESTResponse->StatusText, MB_ICONERROR | MB_OK );
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TLoginForm::OnCDTimer(int countDown)
|
||||
{
|
||||
|
||||
if( countDown==0 ){
|
||||
m_sendButton->Text = "重新发送";
|
||||
m_sendButton->Enabled = true;
|
||||
}
|
||||
else{
|
||||
m_sendButton->Text = String(countDown) + "秒";
|
||||
m_sendButton->Enabled = false;
|
||||
}
|
||||
|
||||
m_sendButton->Invalidate();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
void __fastcall TLoginForm::ResetPassClick(TObject *Sender)
|
||||
{
|
||||
char strURL[256];
|
||||
f_CS_GetWebPageURL( URL_RESETPASS, strURL );
|
||||
ShellExecute(Handle, NULL, ((String)strURL).c_str(), NULL, NULL, SW_SHOWNORMAL);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,420 @@
|
||||
object LoginForm: TLoginForm
|
||||
Left = 0
|
||||
Top = 0
|
||||
ParentCustomHint = False
|
||||
BorderStyle = bsNone
|
||||
Caption = 'MainForm'
|
||||
ClientHeight = 235
|
||||
ClientWidth = 377
|
||||
Color = 5064257
|
||||
DoubleBuffered = True
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
KeyPreview = True
|
||||
Position = poMainFormCenter
|
||||
Scaled = False
|
||||
OnCreate = FormCreate
|
||||
OnKeyDown = FormKeyDown
|
||||
OnShow = FormShow
|
||||
TextHeight = 13
|
||||
object m_logDialogPanel: TGeneralDialogPanel
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 377
|
||||
Height = 235
|
||||
Align = alClient
|
||||
Caption = #30331#24405
|
||||
Color = 5064257
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentBackground = False
|
||||
ParentFont = False
|
||||
TabOrder = 0
|
||||
object m_logSwitchLabel: TLabel
|
||||
Left = 277
|
||||
Top = 154
|
||||
Width = 69
|
||||
Height = 19
|
||||
Cursor = crHandPoint
|
||||
Hint = #28857#20987#27880#20876#26032#29992#25143
|
||||
ParentCustomHint = False
|
||||
Alignment = taRightJustify
|
||||
Caption = #27880#20876#26032#29992#25143' '
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 14339007
|
||||
Font.Height = -13
|
||||
Font.Name = 'Microsoft YaHei UI'
|
||||
Font.Style = [fsItalic, fsUnderline]
|
||||
Font.Quality = fqClearTypeNatural
|
||||
ParentFont = False
|
||||
ParentShowHint = False
|
||||
ShowAccelChar = False
|
||||
ShowHint = True
|
||||
OnClick = DoSwitchClick
|
||||
OnMouseEnter = LinkLabelMouseEnter
|
||||
OnMouseLeave = LinkLabelMouseLeave
|
||||
end
|
||||
object m_logUserNameLabel: TLabel
|
||||
Left = 22
|
||||
Top = 41
|
||||
Width = 40
|
||||
Height = 14
|
||||
Caption = #29992#25143#21517':'
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 14339007
|
||||
Font.Height = -12
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
Font.Quality = fqClearTypeNatural
|
||||
ParentFont = False
|
||||
end
|
||||
object m_logPasswordLabel: TLabel
|
||||
Left = 198
|
||||
Top = 41
|
||||
Width = 36
|
||||
Height = 14
|
||||
Caption = #23494#30721#65306
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 14339007
|
||||
Font.Height = -12
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
Font.Quality = fqClearTypeNatural
|
||||
ParentFont = False
|
||||
end
|
||||
object m_logButton: TTextButton
|
||||
Left = 258
|
||||
Top = 103
|
||||
Width = 93
|
||||
Height = 36
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
OnClick = DoGoClick
|
||||
Text = #30331#24405
|
||||
end
|
||||
object m_lblResetPass: TLabel
|
||||
Left = 29
|
||||
Top = 154
|
||||
Width = 65
|
||||
Height = 19
|
||||
Cursor = crHandPoint
|
||||
Hint = #28857#20987#25214#22238#23494#30721
|
||||
ParentCustomHint = False
|
||||
Alignment = taRightJustify
|
||||
Caption = #24536#35760#23494#30721#65311
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 14339007
|
||||
Font.Height = -13
|
||||
Font.Name = 'Microsoft YaHei UI'
|
||||
Font.Style = [fsItalic, fsUnderline]
|
||||
Font.Quality = fqClearTypeNatural
|
||||
ParentFont = False
|
||||
ParentShowHint = False
|
||||
ShowAccelChar = False
|
||||
ShowHint = True
|
||||
OnClick = ResetPassClick
|
||||
OnMouseEnter = LinkLabelMouseEnter
|
||||
OnMouseLeave = LinkLabelMouseLeave
|
||||
end
|
||||
object m_IsAutoLogin: TCKBox
|
||||
Left = 22
|
||||
Top = 115
|
||||
Width = 80
|
||||
Height = 16
|
||||
Caption = #33258#21160#30331#24405
|
||||
Ctl3D = False
|
||||
DoubleBuffered = True
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 14339007
|
||||
Font.Height = -12
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentColor = True
|
||||
ParentCtl3D = False
|
||||
ParentDoubleBuffered = False
|
||||
ParentFont = False
|
||||
TabOrder = 2
|
||||
BoxColor = 3748912
|
||||
OnChange = DoAutoCheck
|
||||
end
|
||||
object m_logPasswordEdit: TLineEdit
|
||||
Left = 198
|
||||
Top = 58
|
||||
Width = 156
|
||||
Height = 25
|
||||
ParentCustomHint = False
|
||||
HintText = #35831#36755#20837#23494#30721
|
||||
MaxLength = 16
|
||||
PasswordChar = '*'
|
||||
NumberMax = -1
|
||||
NumberMin = -1
|
||||
Color = 15591652
|
||||
TabOrder = 1
|
||||
end
|
||||
object m_logUserEdit: TLineEdit
|
||||
Left = 21
|
||||
Top = 58
|
||||
Width = 156
|
||||
Height = 25
|
||||
ParentCustomHint = False
|
||||
HintText = #35831#36755#20837#29992#25143#21517
|
||||
MaxLength = 31
|
||||
NumberMax = -1
|
||||
NumberMin = -1
|
||||
Color = 15591652
|
||||
TabOrder = 0
|
||||
end
|
||||
end
|
||||
object m_regDialogPanel: TGeneralDialogPanel
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 377
|
||||
Height = 235
|
||||
Align = alClient
|
||||
Caption = #27880#20876
|
||||
Color = 5064257
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentBackground = False
|
||||
ParentFont = False
|
||||
TabOrder = 1
|
||||
Visible = False
|
||||
object m_regSwitchLabel: TLabel
|
||||
Left = 283
|
||||
Top = 199
|
||||
Width = 64
|
||||
Height = 19
|
||||
Cursor = crHandPoint
|
||||
Hint = #28857#20987#30331#24405
|
||||
ParentCustomHint = False
|
||||
Alignment = taCenter
|
||||
AutoSize = False
|
||||
Caption = #24050#26377#36134#25143
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 14339007
|
||||
Font.Height = -13
|
||||
Font.Name = 'Microsoft YaHei UI'
|
||||
Font.Style = [fsItalic, fsUnderline]
|
||||
Font.Quality = fqClearTypeNatural
|
||||
ParentFont = False
|
||||
ParentShowHint = False
|
||||
ShowAccelChar = False
|
||||
ShowHint = True
|
||||
OnClick = DoSwitchClick
|
||||
OnMouseEnter = LinkLabelMouseEnter
|
||||
OnMouseLeave = LinkLabelMouseLeave
|
||||
end
|
||||
object m_regUserNameLabel: TLabel
|
||||
Left = 22
|
||||
Top = 41
|
||||
Width = 40
|
||||
Height = 14
|
||||
Caption = #29992#25143#21517':'
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 14339007
|
||||
Font.Height = -12
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
Font.Quality = fqClearTypeNatural
|
||||
ParentFont = False
|
||||
end
|
||||
object m_regPasswrodLabel: TLabel
|
||||
Left = 198
|
||||
Top = 38
|
||||
Width = 36
|
||||
Height = 14
|
||||
Caption = #23494#30721#65306
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 14339007
|
||||
Font.Height = -12
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
Font.Quality = fqClearTypeNatural
|
||||
ParentFont = False
|
||||
end
|
||||
object m_ConfirmLabel: TLabel
|
||||
Left = 198
|
||||
Top = 92
|
||||
Width = 60
|
||||
Height = 14
|
||||
Caption = #30830#35748#23494#30721#65306
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 14339007
|
||||
Font.Height = -12
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
Font.Quality = fqClearTypeNatural
|
||||
ParentFont = False
|
||||
end
|
||||
object m_regButton: TTextButton
|
||||
Left = 258
|
||||
Top = 148
|
||||
Width = 93
|
||||
Height = 36
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
OnClick = DoGoClick
|
||||
Text = #27880#20876
|
||||
end
|
||||
object m_lblAgreement: TLabel
|
||||
Left = 124
|
||||
Top = 203
|
||||
Width = 72
|
||||
Height = 14
|
||||
Cursor = crHandPoint
|
||||
Hint = #28857#20987#38405#35835#29992#25143#21327#35758
|
||||
ParentCustomHint = False
|
||||
Alignment = taCenter
|
||||
BiDiMode = bdLeftToRight
|
||||
Caption = #12298#29992#25143#21327#35758#12299
|
||||
Color = 5064257
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 13158400
|
||||
Font.Height = -12
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = [fsUnderline]
|
||||
ParentBiDiMode = False
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
ParentShowHint = False
|
||||
ShowAccelChar = False
|
||||
ShowHint = True
|
||||
OnClick = AgreementClick
|
||||
OnMouseEnter = AgreementMouseEnter
|
||||
OnMouseLeave = AgreementMouseLeave
|
||||
end
|
||||
object m_sendButton: TTextButton
|
||||
Left = 25
|
||||
Top = 148
|
||||
Width = 120
|
||||
Height = 36
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
OnClick = DoSendClick
|
||||
Text = #33719#21462#27880#20876#39564#35777#30721
|
||||
end
|
||||
object m_VerifyLabel: TLabel
|
||||
Left = 23
|
||||
Top = 92
|
||||
Width = 48
|
||||
Height = 14
|
||||
Caption = #39564#35777#30721#65306
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 14339007
|
||||
Font.Height = -12
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
Font.Quality = fqClearTypeNatural
|
||||
ParentFont = False
|
||||
end
|
||||
object m_ConfirmEdit: TLineEdit
|
||||
Left = 198
|
||||
Top = 109
|
||||
Width = 156
|
||||
Height = 25
|
||||
ParentCustomHint = False
|
||||
HintText = #35831#20877#27425#36755#20837#23494#30721
|
||||
MaxLength = 16
|
||||
PasswordChar = '*'
|
||||
NumberMax = -1
|
||||
NumberMin = -1
|
||||
Color = 15591652
|
||||
TabOrder = 3
|
||||
end
|
||||
object m_regPasswordEdit: TLineEdit
|
||||
Left = 198
|
||||
Top = 58
|
||||
Width = 156
|
||||
Height = 25
|
||||
ParentCustomHint = False
|
||||
HintText = #35831#36755#20837'6-16'#20301#23494#30721
|
||||
MaxLength = 16
|
||||
PasswordChar = '*'
|
||||
NumberMax = -1
|
||||
NumberMin = -1
|
||||
Color = 15591652
|
||||
TabOrder = 2
|
||||
end
|
||||
object m_regUserEdit: TLineEdit
|
||||
Left = 21
|
||||
Top = 58
|
||||
Width = 156
|
||||
Height = 25
|
||||
ParentCustomHint = False
|
||||
HintText = #35831#36755#20837#25163#26426'/'#37038#31665
|
||||
MaxLength = 31
|
||||
NumberMax = -1
|
||||
NumberMin = -1
|
||||
Color = 15591652
|
||||
TabOrder = 0
|
||||
end
|
||||
object m_ckAgree: TCKBox
|
||||
Left = 22
|
||||
Top = 202
|
||||
Width = 97
|
||||
Height = 16
|
||||
Caption = #24050#38405#35835#24182#21516#24847
|
||||
Ctl3D = False
|
||||
DoubleBuffered = True
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 14339007
|
||||
Font.Height = -12
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentColor = True
|
||||
ParentCtl3D = False
|
||||
ParentDoubleBuffered = False
|
||||
ParentFont = False
|
||||
TabOrder = 4
|
||||
Checked = True
|
||||
BoxColor = 3748912
|
||||
end
|
||||
object m_VerifyEdit: TLineEdit
|
||||
Left = 22
|
||||
Top = 109
|
||||
Width = 156
|
||||
Height = 25
|
||||
ParentCustomHint = False
|
||||
HintText = #35831#36755#20837#27880#20876#39564#35777#30721
|
||||
MaxLength = 16
|
||||
NumbersOnly = True
|
||||
NumberMax = -1
|
||||
NumberMin = -1
|
||||
Color = 15591652
|
||||
TabOrder = 1
|
||||
end
|
||||
end
|
||||
object RESTClient: TRESTClient
|
||||
Accept = 'application/json, text/plain; q=0.9, text/html;q=0.8,'
|
||||
AcceptCharset = 'utf-8, *;q=0.8'
|
||||
ContentType = 'application/json'
|
||||
Params = <>
|
||||
SynchronizedEvents = False
|
||||
Left = 192
|
||||
Top = 168
|
||||
end
|
||||
object RESTRequest: TRESTRequest
|
||||
Client = RESTClient
|
||||
Method = rmPOST
|
||||
Params = <>
|
||||
Response = RESTResponse
|
||||
SynchronizedEvents = False
|
||||
Left = 232
|
||||
Top = 184
|
||||
end
|
||||
object RESTResponse: TRESTResponse
|
||||
ContentType = 'application/json'
|
||||
ContentEncoding = 'UTF-8'
|
||||
Left = 200
|
||||
Top = 168
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,107 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef LoginFormUnitH
|
||||
#define LoginFormUnitH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <System.Classes.hpp>
|
||||
#include <Vcl.Controls.hpp>
|
||||
#include <Vcl.StdCtrls.hpp>
|
||||
#include <Vcl.Forms.hpp>
|
||||
#include <Vcl.ExtCtrls.hpp>
|
||||
#include "GeneralDialogPanel.h"
|
||||
#include "LineEdit.h"
|
||||
#include "TextButton.h"
|
||||
#include "CKBox.h"
|
||||
#include <Data.Bind.Components.hpp>
|
||||
#include <Data.Bind.ObjectScope.hpp>
|
||||
#include <REST.Client.hpp>
|
||||
#include <REST.Types.hpp>
|
||||
#include <System.Net.HttpClient.hpp>
|
||||
#include <System.Net.URLClient.hpp>
|
||||
//---------------------------------------------------------------------------
|
||||
#define CODE_INTERVAL 120
|
||||
|
||||
class TLoginForm : public TForm
|
||||
{
|
||||
__published: // IDE-managed Components
|
||||
TGeneralDialogPanel *m_logDialogPanel;
|
||||
TLineEdit *m_logUserEdit;
|
||||
TLineEdit *m_logPasswordEdit;
|
||||
TLabel *m_logSwitchLabel;
|
||||
TLabel *m_logUserNameLabel;
|
||||
TLabel *m_logPasswordLabel;
|
||||
TCKBox *m_IsAutoLogin;
|
||||
TTextButton *m_logButton;
|
||||
TGeneralDialogPanel *m_regDialogPanel;
|
||||
TLabel *m_regSwitchLabel;
|
||||
TLabel *m_regUserNameLabel;
|
||||
TLabel *m_regPasswrodLabel;
|
||||
TLabel *m_ConfirmLabel;
|
||||
TTextButton *m_regButton;
|
||||
TLabel *m_lblAgreement;
|
||||
TTextButton *m_sendButton;
|
||||
TLabel *m_VerifyLabel;
|
||||
TLineEdit *m_ConfirmEdit;
|
||||
TLineEdit *m_regPasswordEdit;
|
||||
TLineEdit *m_regUserEdit;
|
||||
TCKBox *m_ckAgree;
|
||||
TLineEdit *m_VerifyEdit;
|
||||
TRESTClient *RESTClient;
|
||||
TRESTRequest *RESTRequest;
|
||||
TRESTResponse *RESTResponse;
|
||||
TLabel *m_lblResetPass;
|
||||
void __fastcall DoSwitchClick(TObject *Sender);
|
||||
void __fastcall DoGoClick(TObject *Sender);
|
||||
void __fastcall DoAutoCheck(TObject *Sender);
|
||||
void __fastcall DoSendClick(TObject *Sender);
|
||||
void __fastcall FormCreate(TObject *Sender);
|
||||
void __fastcall FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift);
|
||||
void __fastcall AgreementMouseEnter(TObject *Sender);
|
||||
void __fastcall AgreementMouseLeave(TObject *Sender);
|
||||
void __fastcall AgreementClick(TObject *Sender);
|
||||
void __fastcall LinkLabelMouseEnter(TObject *Sender);
|
||||
void __fastcall LinkLabelMouseLeave(TObject *Sender);
|
||||
void __fastcall AgreeChange(TObject *Sender);
|
||||
void __fastcall FormShow(TObject *Sender);
|
||||
void __fastcall ResetPassClick(TObject *Sender);
|
||||
|
||||
private: // User declarations
|
||||
bool FIsLogin,
|
||||
FAutoLogin;
|
||||
|
||||
String FUserName,
|
||||
FPassword,
|
||||
FConfirm,
|
||||
FVerify;
|
||||
|
||||
const static char *m_pPattern[5];
|
||||
|
||||
bool __fastcall CheckInput(const char * pText, int type);
|
||||
|
||||
void __fastcall Layout();
|
||||
void __fastcall SetUserName(String Value);
|
||||
void __fastcall SetPassWord(String Value);
|
||||
void __fastcall SetConfirm(String Value);
|
||||
void __fastcall SetVerify(String Value);
|
||||
void __fastcall SetIsLogin(bool Value);
|
||||
void __fastcall SetIsAntoLogin(bool Value);
|
||||
|
||||
public: // User declarations
|
||||
__fastcall TLoginForm(TComponent* Owner);
|
||||
|
||||
void __fastcall OnCDTimer(int countDown);
|
||||
|
||||
int isEmailOrMobile; // 捆绑邮箱或手机号 1=邮箱 2=手机号
|
||||
|
||||
__published:
|
||||
__property String UserName = {read = FUserName, write = SetUserName};
|
||||
__property String PassWord = {read = FPassword, write = SetPassWord};
|
||||
__property String Confirm = {read = FConfirm, write = SetConfirm};
|
||||
__property String Verify = {read = FVerify, write = SetVerify};
|
||||
__property bool IsLogin = {read = FIsLogin, write = SetIsLogin};
|
||||
__property bool IsAntoLogin = {read = FAutoLogin, write = SetIsAntoLogin};
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
extern PACKAGE TLoginForm *LoginForm;
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,327 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef MainFormUnitH
|
||||
#define MainFormUnitH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <System.Classes.hpp>
|
||||
#include <Vcl.Controls.hpp>
|
||||
#include <Vcl.StdCtrls.hpp>
|
||||
#include <Vcl.Forms.hpp>
|
||||
#include <Vcl.ExtCtrls.hpp>
|
||||
#include <Vcl.Imaging.pngimage.hpp>
|
||||
#include <Vcl.Graphics.hpp>
|
||||
#include <Vcl.Imaging.jpeg.hpp>
|
||||
|
||||
#include "PNGButton.hpp"
|
||||
#include "Capbutton.h"
|
||||
#include "MenuBar.h"
|
||||
#include "MenuUnit.h"
|
||||
#include "SkinHintWindow.h"
|
||||
#include "MicSetFormUnit.h"
|
||||
#include "SetUpFormUnit.h"
|
||||
#include "ComboBoxComponent.h"
|
||||
#include "VolumeFormUnit.h" //add by lm 14.1.7
|
||||
|
||||
#include "LineEdit.h"
|
||||
#include "KeyBoard.h"
|
||||
#include "HelpFormUnit.h"
|
||||
|
||||
#include "NotificationFormUnit.h"
|
||||
#include "TextButton.h"
|
||||
//---------------------------------------------------------------------------
|
||||
class TMainForm : public TForm
|
||||
{
|
||||
__published: // IDE-managed Components
|
||||
TPNGButton *m_btnClose;
|
||||
TPNGButton *m_btnMax;
|
||||
TPNGButton *m_btnMin;
|
||||
TPNGButton *m_btnRest;
|
||||
TPNGButton *m_btnRecord;
|
||||
TPNGButton *m_btnPlay;
|
||||
TPNGButton *m_btnStop;
|
||||
TPNGButton *m_btnPause;
|
||||
TLabel *m_lblTitle;
|
||||
TLabel *m_lblLogon;
|
||||
TPNGButton *m_tabStyle;
|
||||
TPNGButton *m_tabChord;
|
||||
TPNGButton *m_tabAudio;
|
||||
TComboBoxComponent *m_cbPreStage;
|
||||
TCapButton *m_btnTS;
|
||||
TCapButton *m_btnTempo;
|
||||
TPanel *m_panelVolLevel;
|
||||
TImage *m_imgVolLevelBk;
|
||||
TPaintBox *m_pbVolLevel;
|
||||
TComboBoxComponent *m_cbFontSelect;
|
||||
TComboBoxComponent *m_cbKey;
|
||||
TPNGButton *m_btnOpen;
|
||||
TPNGButton *m_btnSave;
|
||||
TPNGButton *m_btnUpload;
|
||||
TPNGButton *m_btnKeyboard;
|
||||
TPNGButton *m_btnVolSet;
|
||||
TImage *m_Logo;
|
||||
TPaintBox *m_pbUserNoticeNum;
|
||||
TPNGButton *m_btnExtFontOn;
|
||||
TPNGButton *m_btnExtFontOff;
|
||||
TLabel *m_lblExtFont;
|
||||
TLabel *m_lblWebsite;
|
||||
|
||||
void __fastcall FormCreate(TObject *Sender);
|
||||
void __fastcall FormResize(TObject *Sender);
|
||||
void __fastcall CloseClick(TObject *Sender);
|
||||
void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
|
||||
void __fastcall FormCloseQuery(TObject *Sender, bool &CanClose);
|
||||
void __fastcall MaxClick(TObject *Sender);
|
||||
void __fastcall MinClick(TObject *Sender);
|
||||
void __fastcall RestClick(TObject *Sender);
|
||||
void __fastcall FormMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift,
|
||||
int X, int Y);
|
||||
void __fastcall FormPaint(TObject *Sender);
|
||||
void __fastcall LogonMouseEnter(TObject *Sender);
|
||||
void __fastcall LogonMouseLeave(TObject *Sender);
|
||||
void __fastcall RecordClick(TObject *Sender);
|
||||
void __fastcall StopClick(TObject *Sender);
|
||||
void __fastcall FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift);
|
||||
void __fastcall PlayClick(TObject *Sender);
|
||||
void __fastcall PauseClick(TObject *Sender);
|
||||
void __fastcall PanelMouseMove(TObject *Sender, TShiftState Shift, int X, int Y);
|
||||
// void __fastcall PanelMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y);
|
||||
void __fastcall PanelMouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y);
|
||||
void __fastcall TabClick(TObject *Sender);
|
||||
void __fastcall PreStageChange(TComboBoxItem *Sender, int Index);
|
||||
void __fastcall VolLevelPaint(TObject *Sender);
|
||||
void __fastcall UserNameClick(TObject *Sender);
|
||||
void __fastcall FontSelectChange(TComboBoxItem *Sender, int Index);
|
||||
void __fastcall KeyChange(TComboBoxItem *Sender, int Index);
|
||||
void __fastcall OpenClick(TObject *Sender);
|
||||
void __fastcall SaveClick(TObject *Sender);
|
||||
void __fastcall UploadClick(TObject *Sender);
|
||||
void __fastcall TTClick(TObject *Sender);
|
||||
void __fastcall VolSetClick(TObject *Sender);
|
||||
void __fastcall OnKeyBoard(TObject *Sender);
|
||||
void __fastcall FormKeyUp(TObject *Sender, WORD &Key, TShiftState Shift);
|
||||
void __fastcall PlayTimeClick(TObject *Sender);
|
||||
void __fastcall DoShowNoticeNumPaint(TObject *Sender);
|
||||
void __fastcall UserNoticeNumClick(TObject *Sender);
|
||||
void __fastcall ExtFontClick(TObject *Sender);
|
||||
void __fastcall URLClick(TObject *Sender);
|
||||
void __fastcall URLMouseEnter(TObject *Sender);
|
||||
void __fastcall URLMouseLeave(TObject *Sender);
|
||||
|
||||
private: // User declarations
|
||||
TMenuBar *m_pMenuBar;
|
||||
TMenuPanel *m_pMenu,
|
||||
*m_pPopMenu;
|
||||
TVolumeForm *m_pVolumeForm;
|
||||
|
||||
TPlayTimePanel *m_pPlayTimePanel;
|
||||
TContentPanel *m_pContentPanel;
|
||||
TToolpalPanel *m_pUseStylePanel, *m_pAudStylePanel, *m_pPreStylePanel,
|
||||
*m_pChordPanel, *m_pTrackPanel;
|
||||
int m_ToolpalWidth, m_UseStyleHeight, m_PreStyleHeight;
|
||||
|
||||
TKeyBoard *m_KeyBoard; //模拟键盘 add by laq 2014.1.17
|
||||
|
||||
//录音/播放相关
|
||||
DWORD m_dwLastVol;
|
||||
int m_iStartBar,
|
||||
m_iLastStartBar,
|
||||
m_iRecordBar,
|
||||
m_nDelayPoint;
|
||||
double m_dblStartPoint,
|
||||
m_dblLastStartPoint,
|
||||
m_dblRecordPoint;
|
||||
|
||||
// bool m_bAudioModified;
|
||||
bool m_bFromFile;
|
||||
UINT m_tTimer, m_tAccuracy, m_tBeatHint;
|
||||
int m_nVolLevel; //音量等级
|
||||
|
||||
HRESULT __fastcall AutoRecognition( int iType ); //旋律识别 0=录音 1=音频导入 2=MIDI导入 3=移动
|
||||
HRESULT __fastcall AutoChords(); //自动配置和弦
|
||||
void __fastcall OnLoadMelody(TObject *Sender);
|
||||
void __fastcall SetMode( int iMode, bool bForce=false ); //设置视图模式, bForce强制刷新
|
||||
void __fastcall ChangeTT( bool bTS, int iValue );
|
||||
void __fastcall SetFont( int idFont, bool bExtFont=false, bool bAddUndo=true );
|
||||
|
||||
//倒计时定时器
|
||||
TTimer * m_pCDTimer;
|
||||
void __fastcall CDTimerProc(TObject* Sender);
|
||||
void __fastcall ClearCDTimer();
|
||||
|
||||
//保存相关
|
||||
String m_strLoadProjectName,
|
||||
m_strUploadFile;
|
||||
|
||||
void __fastcall SaveAs( int iComb );
|
||||
|
||||
//显示相关
|
||||
void __fastcall ShowPlayTime();
|
||||
void __fastcall CreateMenus();
|
||||
void __fastcall ViewLayout();
|
||||
|
||||
void __fastcall NewProject();
|
||||
void __fastcall DoLoadProject( LPCTSTR strName );
|
||||
void __fastcall AfterLoadProject();
|
||||
void __fastcall Undo( bool bUndo );
|
||||
|
||||
void __fastcall SetRecordState( bool bRecord );
|
||||
void __fastcall ShowToolPanels( int iShow );
|
||||
|
||||
bool __fastcall RecordEnabled();
|
||||
bool __fastcall CheckPayment( int iOperation );
|
||||
void __fastcall Logout(); // add by lm 14.1.17
|
||||
|
||||
int __fastcall SaveMedia( int iOperation, int iSaveOption, int iFileType, String strFileName, bool bUpload=false );
|
||||
|
||||
//帮助
|
||||
THelpForm* m_HelpForm;
|
||||
|
||||
//动态 //add by tj 2014/04/18
|
||||
TTimer *m_pNotificationGetTimer;
|
||||
void __fastcall NotificationTimerProc(TObject* Sender);
|
||||
TNotificationForm *m_pNotificationForm;
|
||||
|
||||
void __fastcall CreateParams(TCreateParams &Params);
|
||||
|
||||
void __fastcall OnCreateNewProject(TObject * Sender = NULL);
|
||||
void __fastcall OnPredefineProject(TObject * Sender = NULL);
|
||||
void __fastcall OnSaveProject(TObject *Sender=NULL);
|
||||
void __fastcall OnLoadProject(TObject *Sender=NULL);
|
||||
void __fastcall OnUserHelp(TObject *Sender=NULL);
|
||||
void __fastcall OnUserManual(TObject *Sender=NULL);
|
||||
void __fastcall OnForumVist(TObject *Sender=NULL);
|
||||
void __fastcall OnAbout(TObject *Sender=NULL);
|
||||
void __fastcall OnMicSetting(TObject *Sender=NULL);
|
||||
void __fastcall OnVSTPathSetting(TObject *Sender=NULL);
|
||||
void __fastcall OnSaveAs(TObject *Sender=NULL);// add by lm 14.1.7
|
||||
void __fastcall OnShowToolPanels(TObject *Sender=NULL);
|
||||
void __fastcall OnViewMode(TObject *Sender=NULL);
|
||||
void __fastcall OnNotification(TObject *Sender=NULL); //add by tj 2014/04/18
|
||||
void __fastcall OnCustomerSetting(TObject *Sender=NULL); //add by tj 2014/05/13
|
||||
void __fastcall OnUndo(TObject *Sender=NULL);
|
||||
void __fastcall OnRedo(TObject *Sender=NULL);
|
||||
void __fastcall OnShowMore(TObject *Sender=NULL);
|
||||
|
||||
//消息处理
|
||||
MESSAGE void __fastcall WMEraseBkgnd(Winapi::Messages::TWMEraseBkgnd &Message);
|
||||
MESSAGE void __fastcall WMNCHitTest(TWMNCHitTest &Msg);
|
||||
MESSAGE void __fastcall WMNCLButtonDown(TWMNCLButtonDown &Msg);
|
||||
MESSAGE void __fastcall WMNCRButtonDown(TWMNCRButtonDown &Msg);
|
||||
MESSAGE void __fastcall WMNCLButtonDblClk(TWMNCLButtonDblClk &Msg);
|
||||
MESSAGE void __fastcall WMWindowPosChanged(TWMWindowPosChanged &Msg);
|
||||
|
||||
MESSAGE void __fastcall OnRestoreWindow(TMessage &msg);
|
||||
MESSAGE void __fastcall OnShowMenu(TMessage &msg);
|
||||
// MESSAGE void __fastcall OnMenuCall(TMessage &msg);
|
||||
MESSAGE void __fastcall OnMenuClose(TMessage & Msg);
|
||||
MESSAGE void __fastcall OnLogin(TMessage &msg);
|
||||
MESSAGE void __fastcall OnNetworkError(TMessage &msg);
|
||||
MESSAGE void __fastcall OnNetworkMessage(TMessage &msg);
|
||||
MESSAGE void __fastcall OnLoadProjectMessage(TMessage &msg);
|
||||
MESSAGE void __fastcall OnSaveProjectMessage(TMessage &msg);
|
||||
MESSAGE void __fastcall OnNewProjectMessage(TMessage &msg);
|
||||
MESSAGE void __fastcall OnUploadMusic(TMessage & Msg);
|
||||
MESSAGE void __fastcall AcceptFiles (TMessage& Msg);
|
||||
MESSAGE void __fastcall OnShowAbout(TMessage & Msg);
|
||||
MESSAGE void __fastcall OnOpenManual(TMessage & Msg);
|
||||
MESSAGE void __fastcall OnOpenAutoProj(TMessage & Msg);
|
||||
|
||||
MESSAGE void __fastcall UMShowBrush(TMessage &msg);
|
||||
MESSAGE void __fastcall UMMediaTime(TMessage &Message);
|
||||
MESSAGE void __fastcall UMRecordComplete(TMessage &Message);
|
||||
MESSAGE void __fastcall UMRecordVolJust(TMessage &Message);
|
||||
MESSAGE void __fastcall UMPlayOver(TMessage &Message);
|
||||
MESSAGE void __fastcall UMShowPlayTime(TMessage &Message);
|
||||
MESSAGE void __fastcall UMStop(TMessage &Message);
|
||||
MESSAGE void __fastcall UMRecord(TMessage &Message);
|
||||
MESSAGE void __fastcall UMTTSetup(TMessage &Message);
|
||||
MESSAGE void __fastcall UMChangeTT(TMessage &Message);
|
||||
MESSAGE void __fastcall UMStageChanged(TMessage &Message);
|
||||
MESSAGE void __fastcall UMShowKeyBoard(TMessage &Message);
|
||||
MESSAGE void __fastcall UMShowHelp(TMessage &Message);
|
||||
MESSAGE void __fastcall UMStyleScore(TMessage &Message);
|
||||
MESSAGE void __fastcall UMNotification(TMessage & Msg); //add by tj 2014/04/18
|
||||
MESSAGE void __fastcall UMApplyStyle(TMessage &Message);
|
||||
MESSAGE void __fastcall UMSaveLocalStyle(TMessage &Message);
|
||||
MESSAGE void __fastcall UMImportSegment(TMessage &Message);
|
||||
MESSAGE void __fastcall UMUploadStyle(TMessage &Message);
|
||||
MESSAGE void __fastcall UMChangeMelodyKey(TMessage &Message);
|
||||
MESSAGE void __fastcall UMSetViewMode(TMessage &Message);
|
||||
MESSAGE void __fastcall UMEnableRecord(TMessage &Message);
|
||||
MESSAGE void __fastcall UMAudioLoad(TMessage &Message);
|
||||
MESSAGE void __fastcall UMAutoRecognition(TMessage &Message);
|
||||
MESSAGE void __fastcall UMShowVolSet(TMessage &Message);
|
||||
MESSAGE void __fastcall UMVSTPath(TMessage &Message);
|
||||
MESSAGE void __fastcall UMSetContentView(TMessage &Message);
|
||||
MESSAGE void __fastcall UMGetContentView(TMessage &Message);
|
||||
MESSAGE void __fastcall UMAudioVolChanged(TMessage &Message);
|
||||
MESSAGE void __fastcall UMPreferChanged(TMessage &Message);
|
||||
MESSAGE void __fastcall UMShowMore(TMessage &Message);
|
||||
MESSAGE void __fastcall UMStartCDTimer(TMessage &Message);
|
||||
|
||||
BEGIN_MESSAGE_MAP
|
||||
MESSAGE_HANDLER(WM_ERASEBKGND, TWMEraseBkgnd, WMEraseBkgnd)
|
||||
MESSAGE_HANDLER(WM_NCHITTEST, TWMNCHitTest, WMNCHitTest)
|
||||
MESSAGE_HANDLER(WM_NCLBUTTONDOWN, TWMNCLButtonDown, WMNCLButtonDown)
|
||||
MESSAGE_HANDLER(WM_NCRBUTTONDOWN, TWMNCRButtonDown, WMNCRButtonDown)
|
||||
MESSAGE_HANDLER(WM_NCLBUTTONDBLCLK, TWMNCLButtonDblClk, WMNCLButtonDblClk)
|
||||
MESSAGE_HANDLER(WM_WINDOWPOSCHANGED, TWMWindowPosChanged, WMWindowPosChanged)
|
||||
MESSAGE_HANDLER(WM_DROPFILES,TMessage, AcceptFiles)
|
||||
|
||||
MESSAGE_HANDLER(MSG_NETWORKERROR, TMessage, OnNetworkError)
|
||||
MESSAGE_HANDLER(MSG_NETWORKMESSAGE, TMessage, OnNetworkMessage)
|
||||
MESSAGE_HANDLER(MSG_MEDIATIME, TMessage, UMMediaTime)
|
||||
MESSAGE_HANDLER(MSG_RECORD_COMPLETE, TMessage, UMRecordComplete)
|
||||
MESSAGE_HANDLER(MSG_RECORD_VOLJUST, TMessage, UMRecordVolJust)
|
||||
MESSAGE_HANDLER(MSG_PLAY_END, TMessage, UMPlayOver)
|
||||
|
||||
MESSAGE_HANDLER(UM_RESTORE, TMessage, OnRestoreWindow)
|
||||
MESSAGE_HANDLER(UM_SHOWMENU, TMessage, OnShowMenu)
|
||||
MESSAGE_HANDLER(UM_MENUCLOSE, TMessage, OnMenuClose)
|
||||
MESSAGE_HANDLER(UM_SHOWPLAYTIME, TMessage, UMShowPlayTime)
|
||||
MESSAGE_HANDLER(UM_STOP, TMessage, UMStop)
|
||||
MESSAGE_HANDLER(UM_RECORD, TMessage, UMRecord)
|
||||
MESSAGE_HANDLER(UM_SHOWBRUSH, TMessage, UMShowBrush)
|
||||
MESSAGE_HANDLER(UM_TTSETUP, TMessage, UMTTSetup)
|
||||
MESSAGE_HANDLER(UM_CHANGETT, TMessage, UMChangeTT)
|
||||
MESSAGE_HANDLER(UM_STAGECHANGED, TMessage, UMStageChanged)
|
||||
MESSAGE_HANDLER(UM_LOGIN, TMessage, OnLogin)
|
||||
MESSAGE_HANDLER(UM_LOADPROJECT, TMessage, OnLoadProjectMessage)
|
||||
MESSAGE_HANDLER(UM_SAVEPROJECT, TMessage, OnSaveProjectMessage)
|
||||
MESSAGE_HANDLER(UM_NEWPROJECT, TMessage, OnNewProjectMessage)
|
||||
MESSAGE_HANDLER(UM_UPLOADMUSIC,TMessage,OnUploadMusic)
|
||||
MESSAGE_HANDLER(UM_SHOWABOUT,TMessage,OnShowAbout)
|
||||
MESSAGE_HANDLER(UM_OPENMANUAL,TMessage,OnOpenManual)
|
||||
MESSAGE_HANDLER(UM_SHOW_KB, TMessage, UMShowKeyBoard)
|
||||
MESSAGE_HANDLER(UM_OPENAUTOPROJ,TMessage,OnOpenAutoProj)
|
||||
MESSAGE_HANDLER(UM_SHOWHELP, TMessage, UMShowHelp)
|
||||
MESSAGE_HANDLER(UM_STYLESCORE, TMessage, UMStyleScore)
|
||||
MESSAGE_HANDLER(UM_NOTIFICATION, TMessage, UMNotification) //add by tj 2014/04/18
|
||||
MESSAGE_HANDLER(UM_APPLYSTYLE, TMessage, UMApplyStyle)
|
||||
MESSAGE_HANDLER(UM_SAVELOCALSTYLE, TMessage, UMSaveLocalStyle)
|
||||
MESSAGE_HANDLER(UM_IMPORTSEGMENT, TMessage, UMImportSegment)
|
||||
MESSAGE_HANDLER(UM_UPLOADSTYLE, TMessage, UMUploadStyle)
|
||||
MESSAGE_HANDLER(UM_CHANGEKEY, TMessage, UMChangeMelodyKey)
|
||||
MESSAGE_HANDLER(UM_SETVIEWMODE, TMessage, UMSetViewMode)
|
||||
MESSAGE_HANDLER(UM_ENABLERECORD, TMessage, UMEnableRecord)
|
||||
MESSAGE_HANDLER(UM_AUDIOLOAD, TMessage, UMAudioLoad)
|
||||
MESSAGE_HANDLER(UM_AUTORECOGNITION, TMessage, UMAutoRecognition)
|
||||
MESSAGE_HANDLER(UM_SHOW_VOLSET, TMessage, UMShowVolSet)
|
||||
MESSAGE_HANDLER(UM_VSTPATH, TMessage, UMVSTPath)
|
||||
MESSAGE_HANDLER(UM_SETCONTENTVIEW, TMessage, UMSetContentView)
|
||||
MESSAGE_HANDLER(UM_GETCONTENTVIEW, TMessage, UMGetContentView)
|
||||
MESSAGE_HANDLER(UM_AUDIOVOLCHANGED, TMessage, UMAudioVolChanged)
|
||||
MESSAGE_HANDLER(UM_PREFERCHANGED, TMessage, UMPreferChanged)
|
||||
MESSAGE_HANDLER(UM_SHOWMORE, TMessage, UMShowMore)
|
||||
MESSAGE_HANDLER(UM_STARTCDTIMER, TMessage, UMStartCDTimer)
|
||||
END_MESSAGE_MAP(TForm)
|
||||
|
||||
public: // User declarations
|
||||
__fastcall TMainForm(TComponent* Owner);
|
||||
|
||||
void __fastcall ShowErrorMessage( int err, String strOperation );
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
extern PACKAGE TMainForm *MainForm;
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
@@ -0,0 +1,126 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "GlobalUnit.h"
|
||||
#include "ManageSongFormUnit.h"
|
||||
#include "QRcodePanel.h"
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
#pragma link "PNGButton"
|
||||
#pragma link "GeneralDialogPanel"
|
||||
#pragma link "TextButton"
|
||||
#pragma resource "*.dfm"
|
||||
|
||||
TManageSongForm *ManageSongForm;
|
||||
const static COLORREF Enter = RGB( 100,180,236 ),
|
||||
Leave = RGB( 67,117,233 );
|
||||
|
||||
TQRcodePanel * QRPanel = NULL;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TManageSongForm::TManageSongForm(TComponent* Owner, bool bUpload, UINT idSong)
|
||||
: TForm(Owner)
|
||||
{
|
||||
m_pQRdata = NULL;
|
||||
char strURL[1024];
|
||||
|
||||
if( bUpload ){
|
||||
if( idSong>0 ){
|
||||
String strMsg = L"歌曲上传成功\n\n请进入网站";
|
||||
if( f_QR_Encode ){
|
||||
char strURL[256], strID[20];
|
||||
f_CS_GetWebPageURL( URL_SHAREPLAY, strURL );
|
||||
sprintf( strID, "%d", idSong );
|
||||
strcat( strURL, strID );
|
||||
|
||||
m_pQRdata = new unsigned char[100*100];
|
||||
int qrWidth = f_QR_Encode( strURL, m_pQRdata );
|
||||
QRPanel = new TQRcodePanel( NULL, "歌曲二维码" );
|
||||
if( QRPanel ){
|
||||
Width += Height;
|
||||
QRPanel->Parent = this;
|
||||
QRPanel->SetBounds( Width-Height, 0, Height, Height );
|
||||
QRPanel->SetQRData( qrWidth, m_pQRdata );
|
||||
QRPanel->Show();
|
||||
|
||||
strMsg += L"(或扫描二维码)";
|
||||
}
|
||||
}
|
||||
|
||||
strMsg += L"试听和分享";
|
||||
|
||||
f_CS_GetWebPageURL( URL_SONGPLAY, strURL );
|
||||
m_strGo = strURL;
|
||||
m_strGo += "&musicId=" + IntToStr( (int)idSong );
|
||||
|
||||
m_lbMsg->Caption = strMsg;
|
||||
}
|
||||
}
|
||||
else{
|
||||
m_lbMsg->Caption = L"您上传的未发布歌曲数量已达上限\n\n请进入网站处理";
|
||||
f_CS_GetWebPageURL( URL_SONGMANAGE, strURL );
|
||||
m_strGo = strURL;
|
||||
}
|
||||
|
||||
Font->Color = RGB(60,43,23);
|
||||
m_lbGoManage->Font->Color = Leave;
|
||||
|
||||
SetTransparent( this );
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TManageSongForm::GoManageMouseEnter(TObject *Sender)
|
||||
{
|
||||
Screen->Cursor = crHandPoint;
|
||||
m_lbGoManage->Font->Color = Enter;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TManageSongForm::GoManageMouseLeave(TObject *Sender)
|
||||
{
|
||||
Screen->Cursor = crDefault;
|
||||
m_lbGoManage->Font->Color = Leave;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TManageSongForm::GoManageClick(TObject *Sender)
|
||||
{
|
||||
// char strURL[256];
|
||||
// f_CS_GetWebPageURL( URL_SONGMANAGE, strURL );
|
||||
// ShellExecute(Handle, NULL, ((String)strURL).c_str(), NULL, NULL, SW_SHOWNORMAL);
|
||||
ShellExecute(Handle, NULL, m_strGo.c_str(), NULL, NULL, SW_SHOWNORMAL);
|
||||
|
||||
ModalResult = mrOk;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TManageSongForm::FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift)
|
||||
{
|
||||
switch( Key ){
|
||||
case VK_RETURN:
|
||||
return GoManageClick(NULL);
|
||||
break;
|
||||
|
||||
case VK_ESCAPE:
|
||||
ModalResult = mrCancel;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TManageSongForm::FormDestroy(TObject *Sender)
|
||||
{
|
||||
if( QRPanel ){
|
||||
delete QRPanel;
|
||||
QRPanel = NULL;
|
||||
}
|
||||
|
||||
if( m_pQRdata ){
|
||||
delete[] m_pQRdata;
|
||||
m_pQRdata = NULL;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,186 @@
|
||||
object ManageSongForm: TManageSongForm
|
||||
Left = 0
|
||||
Top = 0
|
||||
BorderStyle = bsNone
|
||||
Caption = 'UpdateStyleForm'
|
||||
ClientHeight = 135
|
||||
ClientWidth = 300
|
||||
Color = clBtnFace
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
KeyPreview = True
|
||||
Position = poMainFormCenter
|
||||
Scaled = False
|
||||
OnDestroy = FormDestroy
|
||||
OnKeyDown = FormKeyDown
|
||||
TextHeight = 13
|
||||
object m_pGenenalBKG: TGeneralDialogPanel
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 300
|
||||
Height = 135
|
||||
Caption = #27468#26354#19978#20256
|
||||
Color = 5064257
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentBackground = False
|
||||
ParentFont = False
|
||||
TabOrder = 0
|
||||
object m_ImgFlag: TImage
|
||||
Left = 1
|
||||
Top = 1
|
||||
Width = 28
|
||||
Height = 28
|
||||
AutoSize = True
|
||||
Picture.Data = {
|
||||
0954506E67496D61676589504E470D0A1A0A0000000D494844520000001C0000
|
||||
001C0806000000720DDF94000000097048597300000B1300000B1301009A9C18
|
||||
00000A4D6943435050686F746F73686F70204943432070726F66696C65000078
|
||||
DA9D53775893F7163EDFF7650F5642D8F0B1976C81002223AC08C81059A21092
|
||||
006184101240C585880A561415119C4855C482D50A489D88E2A028B867418A88
|
||||
5A8B555C38EE1FDCA7B57D7AEFEDEDFBD7FBBCE79CE7FCCE79CF0F8011122691
|
||||
E6A26A003952853C3AD81F8F4F48C4C9BD80021548E0042010E6CBC26705C500
|
||||
00F00379787E74B03FFC01AF6F00020070D52E2412C7E1FF83BA502657002091
|
||||
00E02212E70B01905200C82E54C81400C81800B053B3640A009400006C797C42
|
||||
2200AA0D00ECF4493E0500D8A993DC1700D8A21CA908008D0100992847240240
|
||||
BB00605581522C02C0C200A0AC40222E04C0AE018059B632470280BD0500768E
|
||||
58900F4060008099422CCC0020380200431E13CD03204C03A030D2BFE0A95F70
|
||||
85B8480100C0CB95CD974BD23314B895D01A77F2F0E0E221E2C26CB142611729
|
||||
106609E4229C979B231348E7034CCE0C00001AF9D1C1FE383F90E7E6E4E1E666
|
||||
E76CEFF4C5A2FE6BF06F223E21F1DFFEBC8C020400104ECFEFDA5FE5E5D60370
|
||||
C701B075BF6BA95B00DA560068DFF95D33DB09A05A0AD07AF98B7938FC401E9E
|
||||
A150C83C1D1C0A0B0BED2562A1BD30E38B3EFF33E16FE08B7EF6FC401EFEDB7A
|
||||
F000719A4099ADC0A383FD71616E76AE528EE7CB0442316EF7E723FEC7857FFD
|
||||
8E29D1E234B15C2C158AF15889B850224DC779B952914421C995E212E97F32F1
|
||||
1F96FD0993770D00AC864FC04EB607B5CB6CC07EEE01028B0E58D27600407EF3
|
||||
2D8C1A0B91001067343279F7000093BFF98F402B0100CD97A4E30000BCE8185C
|
||||
A894174CC608000044A0812AB041070CC114ACC00E9CC11DBCC0170261064440
|
||||
0C24C03C104206E4801C0AA11896411954C03AD804B5B0031AA0119AE110B4C1
|
||||
31380DE7E0125C81EB70170660189EC218BC86090441C8081361213A8811628E
|
||||
D822CE0817998E04226148349280A420E988145122C5C872A402A9426A915D48
|
||||
23F22D7214398D5C40FA90DBC820328AFC8ABC47319481B25103D4027540B9A8
|
||||
1F1A8AC6A073D174340F5D8096A26BD11AB41E3D80B6A2A7D14BE87574007D8A
|
||||
8E6380D1310E668CD9615C8C87456089581A26C71663E55835568F35631D5837
|
||||
76151BC09E61EF0824028B8013EC085E8410C26C82909047584C5843A825EC23
|
||||
B412BA085709838431C2272293A84FB4257A12F9C478623AB1905846AC26EE21
|
||||
1E219E255E270E135F9348240EC992E44E0A21259032490B496B48DB482DA453
|
||||
A43ED210699C4C26EB906DC9DEE408B280AC209791B7900F904F92FBC9C3E4B7
|
||||
143AC588E24C09A22452A494124A35653FE504A59F324299A0AA51CDA99ED408
|
||||
AA883A9F5A496DA076502F5387A91334759A25CD9B1643CBA42DA3D5D09A6967
|
||||
69F7682FE974BA09DD831E4597D097D26BE807E9E7E983F4770C0D860D83C748
|
||||
6228196B197B19A718B7192F994CA605D39799C85430D7321B9967980F986F55
|
||||
582AF62A7C1591CA12953A9556957E95E7AA545573553FD579AA0B54AB550FAB
|
||||
5E567DA64655B350E3A909D416ABD5A91D55BBA936AECE5277528F50CF515FA3
|
||||
BE5FFD82FA630DB2868546A08648A35463B7C6198D2116C63265F15842D67256
|
||||
03EB2C6B984D625BB2F9EC4C7605FB1B762F7B4C534373AA66AC6691669DE671
|
||||
CD010EC6B1E0F039D99C4ACE21CE0DCE7B2D032D3F2DB1D66AAD66AD7EAD37DA
|
||||
7ADABEDA62ED72ED16EDEBDAEF75709D409D2C9DF53A6D3AF77509BA36BA51BA
|
||||
85BADB75CFEA3ED363EB79E909F5CAF50EE9DDD147F56DF4A3F517EAEFD6EFD1
|
||||
1F373034083690196C313863F0CC9063E86B9869B8D1F084E1A811CB68BA91C4
|
||||
68A3D149A327B826EE8767E33578173E66AC6F1C62AC34DE65DC6B3C61626932
|
||||
DBA4C4A4C5E4BE29CD946B9A66BAD1B4D374CCCCC82CDCACD8ACC9EC8E39D59C
|
||||
6B9E61BED9BCDBFC8D85A5459CC54A8B368BC796DA967CCB05964D96F7AC9856
|
||||
3E567956F556D7AC49D65CEB2CEB6DD6576C501B579B0C9B3A9BCBB6A8AD9BAD
|
||||
C4769B6DDF14E2148F29D229F5536EDA31ECFCEC0AEC9AEC06ED39F661F625F6
|
||||
6DF6CF1DCC1C121DD63B743B7C727475CC766C70BCEBA4E134C3A9C4A9C3E957
|
||||
671B67A1739DF33517A64B90CB1297769717536DA78AA76E9F7ACB95E51AEEBA
|
||||
D2B5D3F5A39BBB9BDCADD96DD4DDCC3DC57DABFB4D2E9B1BC95DC33DEF41F4F0
|
||||
F758E271CCE39DA79BA7C2F390E72F5E765E595EFBBD1E4FB39C269ED6306DC8
|
||||
DBC45BE0BDCB7B603A3E3D65FACEE9033EC63E029F7A9F87BEA6BE22DF3DBE23
|
||||
7ED67E997E07FC9EFB3BFACBFD8FF8BFE179F216F14E056001C101E501BD811A
|
||||
81B3036B031F049904A50735058D05BB062F0C3E15420C090D591F72936FC017
|
||||
F21BF96333DC672C9AD115CA089D155A1BFA30CC264C1ED6118E86CF08DF107E
|
||||
6FA6F94CE9CCB60888E0476C88B81F69199917F97D14292A32AA2EEA51B45374
|
||||
7174F72CD6ACE459FB67BD8EF18FA98CB93BDB6AB6727667AC6A6C526C63EC9B
|
||||
B880B8AAB8817887F845F1971274132409ED89E4C4D8C43D89E37302E76C9A33
|
||||
9CE49A54967463AEE5DCA2B917E6E9CECB9E773C593559907C3885981297B23F
|
||||
E5832042502F184FE5A76E4D1D13F2849B854F45BEA28DA251B1B7B84A3C92E6
|
||||
9D5695F638DD3B7D43FA68864F4675C633094F522B79911992B923F34D5644D6
|
||||
DEACCFD971D92D39949C949CA3520D6996B42BD730B728B74F662B2B930DE479
|
||||
E66DCA1B9387CAF7E423F973F3DB156C854CD1A3B452AE500E164C2FA82B785B
|
||||
185B78B848BD485AD433DF66FEEAF9230B82167CBD90B050B8B0B3D8B87859F1
|
||||
E022BF45BB16238B5317772E315D52BA647869F0D27DCB68CBB296FD50E25852
|
||||
55F26A79DCF28E5283D2A5A5432B82573495A994C9CB6EAEF45AB96315619564
|
||||
55EF6A97D55B567F2A17955FAC70ACA8AEF8B046B8E6E2574E5FD57CF5796DDA
|
||||
DADE4AB7CAEDEB48EBA4EB6EACF759BFAF4ABD6A41D5D086F00DAD1BF18DE51B
|
||||
5F6D4ADE74A17A6AF58ECDB4CDCACD03356135ED5BCCB6ACDBF2A136A3F67A9D
|
||||
7F5DCB56FDADABB7BED926DAD6BFDD777BF30E831D153BDEEF94ECBCB52B7857
|
||||
6BBD457DF56ED2EE82DD8F1A621BBABFE67EDDB847774FC59E8F7BA57B07F645
|
||||
EFEB6A746F6CDCAFBFBFB2096D52368D1E483A70E59B806FDA9BED9A77B5705A
|
||||
2A0EC241E5C127DFA67C7BE350E8A1CEC3DCC3CDDF997FB7F508EB48792BD23A
|
||||
BF75AC2DA36DA03DA1BDEFE88CA39D1D5E1D47BEB7FF7EEF31E36375C7358F57
|
||||
9EA09D283DF1F9E48293E3A764A79E9D4E3F3DD499DC79F74CFC996B5D515DBD
|
||||
6743CF9E3F1774EE4CB75FF7C9F3DEE78F5DF0BC70F422F762DB25B74BAD3DAE
|
||||
3D477E70FDE148AF5B6FEB65F7CBED573CAE74F44DEB3BD1EFD37FFA6AC0D573
|
||||
D7F8D72E5D9F79BDEFC6EC1BB76E26DD1CB825BAF5F876F6ED17770AEE4CDC5D
|
||||
7A8F78AFFCBEDAFDEA07FA0FEA7FB4FEB165C06DE0F860C060CFC3590FEF0E09
|
||||
879EFE94FFD387E1D247CC47D52346238D8F9D1F1F1B0D1ABDF264CE93E1A7B2
|
||||
A713CFCA7E56FF79EB73ABE7DFFDE2FB4BCF58FCD8F00BF98BCFBFAE79A9F372
|
||||
EFABA9AF3AC723C71FBCCE793DF1A6FCADCEDB7DEFB8EFBADFC7BD1F9928FC40
|
||||
FE50F3D1FA63C7A7D04FF73EE77CFEFC2FF784F3FB25D29F33000002A2494441
|
||||
5478DAB5966D48536114C7CF6A4E178B0D416B9283C8704861D1CB971223308B
|
||||
46041946102408658405FB14F529A2FA10D10B0845E1100CA28822C330E88506
|
||||
5114B3342814C3953109A3D5B25ACDDBFF7877E3DEEDBE3CDBF20F7FB83BF739
|
||||
CFEFEEB9E779EEB155D7D49280AAE126B80176C1CBD2F17E3801DF83AFBF79DD
|
||||
FFD66A229B0570237C0C5E21F254D00BF808C07773053AE14BF04E4150A6AEC2
|
||||
2D00FF1001FAE06BF0EA3C618A06E000A05133A01B7E0C2F2D10A668185E0968
|
||||
5C0F381BBE016FD1CB9C723A28D1B8242B3E6B3249AEBE41332817D426405399
|
||||
C036B8C328EBCF3C37456FB667C5EDE371F26D3D67F54F5B01BCAC0672918CC0
|
||||
F367083806FB014D28C0DD70A759468140D61E002F2AC01E78F30C03C300D631
|
||||
908BE55B7A590D2515DBE9DDC34359F1A2E8045536779080784F7A1858858B21
|
||||
918CD1DE20A53C733431E7B311F21EE81649672D67E05A92F79EA5C63A5BE997
|
||||
DFAB89CDBD1DA1B2E33DA2C00D0CE403B94F64F4F8C9EDF4BDDEAF89955E7840
|
||||
9E5058141860201F614F45464F1C6CA478B3F6C42B3F7A8B5CBDAF4481D34553
|
||||
CA73898C661843D5AAD8D74525915151E002655B7086CF6A342F272FAB5ABE6D
|
||||
E7C9FEF18B082C866DE155805CD76D56195C305C38FF3425D1C27527C8F63B25
|
||||
020C01D8A200F903FB5C745DF2541D8061F5E1CD95DA6096F1B3B632EB1DF296
|
||||
700CC5AC6077000BF0851A580347608751D6E49AC5143BB54313ABD81BA29297
|
||||
EFCD604992BF89039940D62EB8EB3F03A70F6DE5875E8BC14DD361DD475D544E
|
||||
5F9B566962EEEE2754F4E1B311EC34604175C0A889DA0F9F21B90BC8475CB641
|
||||
C0CE66DE306B13EB49EEDCAA72840DA797F1BEDE4DABBE940B885B457EB7EB2D
|
||||
408FE02B24EFB7A4D1202BA05A6564D27903F24964129B244939AE5861FA0B36
|
||||
05EEF82A32C1E10000000049454E44AE426082}
|
||||
end
|
||||
object m_lbGoManage: TLabel
|
||||
Left = 112
|
||||
Top = 97
|
||||
Width = 72
|
||||
Height = 14
|
||||
Alignment = taCenter
|
||||
AutoSize = False
|
||||
Caption = #31435#21363#21069#24448
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clBlue
|
||||
Font.Height = -12
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = [fsUnderline]
|
||||
ParentFont = False
|
||||
OnClick = GoManageClick
|
||||
OnMouseEnter = GoManageMouseEnter
|
||||
OnMouseLeave = GoManageMouseLeave
|
||||
end
|
||||
object m_lbMsg: TLabel
|
||||
Left = 29
|
||||
Top = 43
|
||||
Width = 242
|
||||
Height = 40
|
||||
Alignment = taCenter
|
||||
AutoSize = False
|
||||
Caption = #27468#26354#19978#20256#32467#26524
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 13613739
|
||||
Font.Height = -11
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
Layout = tlCenter
|
||||
WordWrap = True
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,40 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef ManageSongFormUnitH
|
||||
#define ManageSongFormUnitH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <System.Classes.hpp>
|
||||
#include <Vcl.Controls.hpp>
|
||||
#include <Vcl.StdCtrls.hpp>
|
||||
#include <Vcl.Forms.hpp>
|
||||
#include <Vcl.ExtCtrls.hpp>
|
||||
#include <Vcl.Graphics.hpp>
|
||||
#include <Vcl.Imaging.pngimage.hpp>
|
||||
#include "PNGButton.hpp"
|
||||
#include "GeneralDialogPanel.h"
|
||||
#include "TextButton.h"
|
||||
//---------------------------------------------------------------------------
|
||||
class TManageSongForm : public TForm
|
||||
{
|
||||
__published: // IDE-managed Components
|
||||
TImage *m_ImgFlag;
|
||||
TLabel *m_lbMsg;
|
||||
TLabel *m_lbGoManage;
|
||||
TGeneralDialogPanel *m_pGenenalBKG;
|
||||
void __fastcall GoManageMouseEnter(TObject *Sender);
|
||||
void __fastcall GoManageMouseLeave(TObject *Sender);
|
||||
void __fastcall GoManageClick(TObject *Sender);
|
||||
void __fastcall FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift);
|
||||
void __fastcall FormDestroy(TObject *Sender);
|
||||
private:
|
||||
unsigned char * m_pQRdata;
|
||||
String m_strGo;
|
||||
public: // User declarations
|
||||
__fastcall TManageSongForm(TComponent* Owner, bool bUpload, UINT idSong=0 );
|
||||
|
||||
void SetMessage(String strMsg);
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
extern PACKAGE TManageSongForm *ManageSongForm;
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
+281
@@ -0,0 +1,281 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "MessageDef.h"
|
||||
#include "MenuBar.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
|
||||
#define STATE_NOR 0
|
||||
#define STATE_HOT 1
|
||||
#define STATE_DOWN 2
|
||||
|
||||
#define CLR_NOR RGB( 74, 80, 88 )
|
||||
#define CLR_HOT RGB( 87, 94, 104 )
|
||||
#define CLR_DOWN RGB( 39, 42, 47 )
|
||||
#define CLR_BOARD_OUT RGB( 100, 108, 119 )
|
||||
#define CLR_BOARD_IN RGB( 44, 46, 48 )
|
||||
#define CLR_BOARD_FILL RGB( 70, 73, 76 )
|
||||
|
||||
#define OFFSET_X 10
|
||||
#define OFFSET_Y 3
|
||||
|
||||
int u_Height = 0;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// TTextMenu
|
||||
__fastcall TTextMenu::TTextMenu( String caption, String shortcut, int type )
|
||||
{
|
||||
m_strCaption = caption;
|
||||
m_strShortCut = shortcut;
|
||||
iType = type;
|
||||
iState = STATE_NOR;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TTextMenu::ShowMenu( bool bShow )
|
||||
{
|
||||
TMessage msg;
|
||||
msg.WParamLo = iType;
|
||||
msg.WParamHi = bShow;
|
||||
msg.LParamLo = Left;
|
||||
msg.LParamHi = MENUBAR_TOP+u_Height;
|
||||
|
||||
Application->MainForm->Perform( UM_SHOWMENU, msg.WParam, msg.LParam );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TTextMenu::Draw( TCanvas* pCanvas )
|
||||
{
|
||||
TColor clrOldPen = pCanvas->Pen->Color,
|
||||
clrOldBrush = pCanvas->Brush->Color;
|
||||
|
||||
//刷新背景
|
||||
TRect rect( Left+1, MENUBAR_TOP+1, Left+Width, MENUBAR_TOP+u_Height );
|
||||
pCanvas->Brush->Color = iState==STATE_HOT ? CLR_HOT :
|
||||
(iState==STATE_DOWN ? CLR_DOWN : CLR_NOR );
|
||||
pCanvas->FillRect( rect );
|
||||
|
||||
if( iState!=STATE_NOR ){
|
||||
//绘制内边框
|
||||
TRect rtFrame( Left+1, MENUBAR_TOP+1, Left+Width, MENUBAR_TOP+u_Height );
|
||||
pCanvas->Brush->Color = CLR_BOARD_IN;
|
||||
pCanvas->FrameRect( rtFrame );
|
||||
|
||||
pCanvas->Pixels[Left+1][MENUBAR_TOP+1] = CLR_BOARD_FILL;
|
||||
pCanvas->Pixels[Left+Width-1][MENUBAR_TOP+1] = CLR_BOARD_FILL;
|
||||
pCanvas->Pixels[Left+Width-1][MENUBAR_TOP+u_Height-1] = CLR_BOARD_FILL;
|
||||
pCanvas->Pixels[Left+1][MENUBAR_TOP+u_Height-1] = CLR_BOARD_FILL;
|
||||
|
||||
pCanvas->Pen->Color = CLR_BOARD_OUT;
|
||||
pCanvas->Font->Color = CLR_TEXT_HOT;
|
||||
}
|
||||
else{
|
||||
pCanvas->Pen->Color = CLR_NOR;
|
||||
pCanvas->Font->Color = CLR_TEXT_NOR;
|
||||
}
|
||||
|
||||
//绘制外边框
|
||||
//上边线
|
||||
pCanvas->MoveTo( Left+3, MENUBAR_TOP );
|
||||
pCanvas->LineTo( Left+Width-2, MENUBAR_TOP );
|
||||
//左边线
|
||||
pCanvas->MoveTo( Left, MENUBAR_TOP+3 );
|
||||
pCanvas->LineTo( Left, MENUBAR_TOP+u_Height-2 );
|
||||
//下边线
|
||||
pCanvas->MoveTo( Left+3, MENUBAR_TOP+u_Height );
|
||||
pCanvas->LineTo( Left+Width-2, MENUBAR_TOP+u_Height );
|
||||
//右边线
|
||||
pCanvas->MoveTo( Left+Width, MENUBAR_TOP+3 );
|
||||
pCanvas->LineTo( Left+Width, MENUBAR_TOP+u_Height-2 );
|
||||
|
||||
pCanvas->Pen->Color = clrOldPen;
|
||||
pCanvas->Brush->Color = clrOldBrush;
|
||||
|
||||
TBrushStyle oldBS = pCanvas->Brush->Style;
|
||||
pCanvas->Brush->Style = bsClear;
|
||||
//输出文字
|
||||
// String strText = m_strCaption;
|
||||
String strText = m_strCaption + "(" + m_strShortCut + ")";
|
||||
int txtLeft = Left + OFFSET_X,
|
||||
txtTop = MENUBAR_TOP + OFFSET_Y;
|
||||
|
||||
pCanvas->TextOut( txtLeft, txtTop, strText );
|
||||
|
||||
pCanvas->Brush->Style = oldBS;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TTextMenu::Invalidate()
|
||||
{
|
||||
TRect rect( Left, MENUBAR_TOP, Left+Width, MENUBAR_TOP+u_Height );
|
||||
InvalidateRect( Application->MainForm->Handle, &rect, false );
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// TMenuBar
|
||||
__fastcall TMenuBar::TMenuBar( TComponent* Owner,TCanvas* pCanvas )
|
||||
{
|
||||
m_pCanvas = pCanvas;
|
||||
m_nMenuCount = 0;
|
||||
Width = 0;
|
||||
m_bMenuShow = false;
|
||||
m_iSelMenu = -1;
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
__fastcall TMenuBar::~TMenuBar()
|
||||
{
|
||||
while( m_nMenuCount>0 ){
|
||||
delete m_aTextMenu[--m_nMenuCount];
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
int TMenuBar::GetHeight()
|
||||
{
|
||||
return u_Height;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void TMenuBar::AddMenu( String caption, String shortcut, int iType )
|
||||
{
|
||||
String strText = caption;
|
||||
strText += "(" + shortcut + ")";
|
||||
|
||||
TSize size = m_pCanvas->TextExtent( strText );
|
||||
int w = size.Width + OFFSET_X * 2,
|
||||
h = size.Height + OFFSET_Y * 2;
|
||||
|
||||
m_aTextMenu[m_nMenuCount] = new TTextMenu( caption, shortcut, iType );
|
||||
m_aTextMenu[m_nMenuCount]->Left = MENUBAR_LEFT + Width;
|
||||
m_aTextMenu[m_nMenuCount]->Width = w;
|
||||
|
||||
if( u_Height<h ) u_Height = h;
|
||||
Width += m_aTextMenu[m_nMenuCount]->Width + 2;
|
||||
|
||||
m_nMenuCount++;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
bool __fastcall TMenuBar::HitTest( int XPos, int YPos, bool bLBDown )
|
||||
{
|
||||
bool bHit(false), bRet(false);
|
||||
|
||||
if( YPos > MENUBAR_TOP && YPos < MENUBAR_TOP + u_Height
|
||||
&& XPos > MENUBAR_LEFT && XPos < MENUBAR_LEFT + Width + OFFSET_BR + 3 ){
|
||||
for( int i=0; i<m_nMenuCount; i++ ){
|
||||
if( XPos < m_aTextMenu[i]->Left + m_aTextMenu[i]->Width
|
||||
&& XPos > m_aTextMenu[i]->Left ){
|
||||
if( bLBDown ){
|
||||
m_bMenuShow = !m_bMenuShow;
|
||||
}
|
||||
|
||||
if( m_bMenuShow ){
|
||||
if( m_aTextMenu[i]->iState!=STATE_DOWN ){
|
||||
m_aTextMenu[i]->iState = STATE_DOWN;
|
||||
m_aTextMenu[i]->Draw( m_pCanvas );
|
||||
|
||||
m_aTextMenu[i]->ShowMenu( true );
|
||||
}
|
||||
}
|
||||
else if( m_aTextMenu[i]->iState!=STATE_HOT ){
|
||||
if( m_aTextMenu[i]->iState==STATE_DOWN ){
|
||||
m_aTextMenu[m_iSelMenu]->ShowMenu( false );
|
||||
}
|
||||
|
||||
m_aTextMenu[i]->iState = STATE_HOT;
|
||||
m_aTextMenu[i]->Draw( m_pCanvas );
|
||||
}
|
||||
|
||||
if( m_iSelMenu!=i ){
|
||||
if( m_iSelMenu>=0 ){
|
||||
m_aTextMenu[m_iSelMenu]->iState = STATE_NOR;
|
||||
m_aTextMenu[m_iSelMenu]->Draw( m_pCanvas );
|
||||
|
||||
m_aTextMenu[m_iSelMenu]->ShowMenu( false );
|
||||
}
|
||||
m_iSelMenu = i;
|
||||
}
|
||||
|
||||
bHit = true;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bRet = true;
|
||||
}
|
||||
|
||||
if( !bHit && m_iSelMenu>=0 && ( !m_bMenuShow || bLBDown ) ){
|
||||
m_aTextMenu[m_iSelMenu]->iState = STATE_NOR;
|
||||
m_aTextMenu[m_iSelMenu]->Draw( m_pCanvas );
|
||||
|
||||
m_aTextMenu[m_iSelMenu]->ShowMenu( false );
|
||||
|
||||
m_iSelMenu = -1;
|
||||
|
||||
if( m_bMenuShow )
|
||||
m_bMenuShow = false;
|
||||
}
|
||||
|
||||
return bRet;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TMenuBar::DrawMenuBar()
|
||||
{
|
||||
for( int i=0; i<m_nMenuCount; i++ ){
|
||||
m_aTextMenu[i]->Draw( m_pCanvas );
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TMenuBar::Reset()
|
||||
{
|
||||
if( m_iSelMenu>=0 && m_bMenuShow ){
|
||||
m_aTextMenu[m_iSelMenu]->iState = STATE_NOR;
|
||||
m_aTextMenu[m_iSelMenu]->Draw( m_pCanvas );
|
||||
|
||||
m_aTextMenu[m_iSelMenu]->ShowMenu( false );
|
||||
|
||||
m_iSelMenu = -1;
|
||||
m_bMenuShow = false;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void TMenuBar::ShowMenu( int iType )
|
||||
{
|
||||
TPoint point;
|
||||
GetCursorPos( &point );
|
||||
point = Application->MainForm->ScreenToClient( point );
|
||||
|
||||
if( m_bMenuShow && point.Y > MENUBAR_TOP && point.Y < MENUBAR_TOP + u_Height
|
||||
&& point.X > MENUBAR_LEFT && point.X < MENUBAR_LEFT + Width + OFFSET_BR + 3 ){
|
||||
return;
|
||||
}
|
||||
|
||||
for( int i=0; i<m_nMenuCount; i++ ){
|
||||
if( m_aTextMenu[i]->iType==iType ){
|
||||
if( m_aTextMenu[i]->iState!=STATE_DOWN ){
|
||||
m_aTextMenu[i]->iState = STATE_DOWN;
|
||||
m_aTextMenu[i]->Draw( m_pCanvas );
|
||||
m_aTextMenu[i]->ShowMenu( true );
|
||||
|
||||
m_iSelMenu = i;
|
||||
m_bMenuShow = true;
|
||||
}
|
||||
}
|
||||
else{
|
||||
if( m_aTextMenu[i]->iState==STATE_DOWN ){
|
||||
m_aTextMenu[i]->iState = STATE_NOR;
|
||||
m_aTextMenu[i]->Draw( m_pCanvas );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef MenuBarH
|
||||
#define MenuBarH
|
||||
|
||||
#define MENU_POP 0
|
||||
#define MENU_FILE 1
|
||||
#define MENU_EDIT 2
|
||||
#define MENU_VIEW 3
|
||||
#define MENU_TRACK 4
|
||||
#define MENU_TOOL 5
|
||||
#define MENU_HELP 6
|
||||
#define SYS_MENU_NUM 6
|
||||
|
||||
#define MENUBAR_LEFT 50
|
||||
#define MENUBAR_TOP 4
|
||||
#define OFFSET_BR 12
|
||||
|
||||
#define CLR_TEXT_NOR RGB( 156, 170, 189 )
|
||||
#define CLR_TEXT_HOT RGB( 201, 214, 229 )
|
||||
|
||||
#include <Vcl.AppEvnts.hpp>
|
||||
//---------------------------------------------------------------------------
|
||||
class TTextMenu
|
||||
{
|
||||
private:
|
||||
String m_strCaption, m_strShortCut;
|
||||
public:
|
||||
int Left, Width, iState, iType;
|
||||
|
||||
__fastcall TTextMenu( String caption, String shortcut, int type );
|
||||
|
||||
void __fastcall Draw( TCanvas* pCanvas );
|
||||
void __fastcall ShowMenu( bool bShow );
|
||||
void __fastcall Invalidate();
|
||||
};
|
||||
|
||||
class TMenuBar
|
||||
{
|
||||
private:
|
||||
TTextMenu* m_aTextMenu[SYS_MENU_NUM];
|
||||
TCanvas* m_pCanvas;
|
||||
|
||||
int m_nMenuCount;
|
||||
bool m_bMenuShow;
|
||||
int m_iSelMenu;
|
||||
public:
|
||||
int Width;
|
||||
|
||||
__fastcall TMenuBar( TComponent* Owner,TCanvas* pCanvas );
|
||||
__fastcall ~TMenuBar();
|
||||
|
||||
void AddMenu( String caption, String shortcut, int iType );
|
||||
bool __fastcall HitTest( int XPos, int YPos, bool bLBDown=false );
|
||||
void __fastcall DrawMenuBar();
|
||||
void __fastcall Reset();
|
||||
|
||||
int GetHeight();
|
||||
void ShowMenu( int iType );
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
+1107
File diff suppressed because it is too large
Load Diff
+135
@@ -0,0 +1,135 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#ifndef MenuUnitH
|
||||
#define MenuUnitH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <Vcl.Imaging.pngimage.hpp>
|
||||
#include <Vcl.AppEvnts.hpp>
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
#define CLEAR_ALL -1
|
||||
//---------------------------------------------------------------------------
|
||||
String __fastcall CutDirString(TCanvas *ACanvas, String strDir, int nWidth);
|
||||
typedef void __fastcall (__closure *DrawItem)( TObject *Sender, TCanvas* ACanvas, const TRect &ARect );
|
||||
class TMenuPanel;
|
||||
class CMenuItem : public TObject
|
||||
{
|
||||
private:
|
||||
System::Classes::TList* FSubItems;
|
||||
|
||||
DrawItem FDrawItem;
|
||||
TNotifyEvent FOnClick;
|
||||
TPngImage* FIcon;
|
||||
|
||||
bool FEnabled;
|
||||
bool FSelected;
|
||||
bool FBreak;
|
||||
int FMenuID;
|
||||
|
||||
String FCaption;
|
||||
String FHotkey;
|
||||
CMenuItem *Parent;
|
||||
|
||||
public:
|
||||
int m_iTypeMenu;
|
||||
|
||||
__fastcall CMenuItem(String strCaption, String strHotkey, TNotifyEvent aClickEvent,
|
||||
int idMenu=-1, TPngImage *pPic=0);
|
||||
__fastcall ~CMenuItem();
|
||||
|
||||
void __fastcall AddItem( CMenuItem *Item );
|
||||
void __fastcall ClearSubItems();
|
||||
|
||||
CMenuItem* __fastcall AppendMenu( String strCaption, String strHotkey="",
|
||||
TNotifyEvent aClickEvent=NULL, int idMenu=-1,
|
||||
TPngImage *pPic=0 );
|
||||
void __fastcall CreateSubMenu( TMenuPanel* pSubMenu );
|
||||
|
||||
bool __fastcall HasSubItem() { return FSubItems->Count > 0; };
|
||||
bool __fastcall IsDrawDir() { return FCaption.Pos("\\")>0; };
|
||||
|
||||
__published:
|
||||
__property DrawItem OnDrawItem = { read=FDrawItem, write=FDrawItem };
|
||||
__property TNotifyEvent OnClick = { read=FOnClick, write=FOnClick };
|
||||
__property TPngImage* Icon = { read=FIcon, write=FIcon };
|
||||
__property String Caption = { read=FCaption, write=FCaption };
|
||||
__property String Hotkey = { read=FHotkey, write=FHotkey };
|
||||
__property bool Enabled = { read=FEnabled, write=FEnabled };
|
||||
__property bool Selected = { read=FSelected, write=FSelected };
|
||||
__property bool Break = { read=FBreak, write=FBreak };
|
||||
__property int MenuID = { read=FMenuID, write=FMenuID };
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
class TMenuPanel: public Extctrls::TPanel
|
||||
{
|
||||
private:
|
||||
// TApplicationEvents *m_AppEvent; //add by LAQ
|
||||
|
||||
//滚动菜单信息
|
||||
int m_iUpState,
|
||||
m_iDownState,
|
||||
m_iFirst;
|
||||
// TTimer *m_pTimer; //自动滚屏定时器
|
||||
|
||||
void __fastcall TimerProc(TObject* Sender);
|
||||
void __fastcall DoHandleMessage(MSG &Msg, bool &Handled); //add by LAQ
|
||||
void __fastcall HideAll();
|
||||
void __fastcall ClearAll();
|
||||
void __fastcall DrawItem( TObject *Sender, TCanvas* ACanvas, const TRect &ARect );
|
||||
void __fastcall DrawUpDown( TCanvas* ACanvas, const TRect &ARect, bool bUp );
|
||||
|
||||
protected:
|
||||
System::Classes::TList* m_Items;
|
||||
int m_ItemHeight,
|
||||
m_iType,
|
||||
m_iSelected;
|
||||
|
||||
virtual void __fastcall CreateParams(TCreateParams &Params);
|
||||
virtual void __fastcall CreateWnd();
|
||||
virtual void __fastcall Paint(void);
|
||||
|
||||
virtual void __fastcall CalRect(int X, int Y);
|
||||
virtual void __fastcall ShowSubMenu(CMenuItem *pItem, int iTop);
|
||||
virtual void __fastcall CloseMenu();
|
||||
virtual bool __fastcall IsDrawImg(){ return m_iType!=0; };
|
||||
virtual bool __fastcall IsDrawDir(){ return false; };
|
||||
|
||||
public:
|
||||
TMenuPanel *m_SubMenu,
|
||||
*m_SupMenu;
|
||||
|
||||
__fastcall TMenuPanel( TComponent* Owner=NULL, int iType=0 );
|
||||
__fastcall ~TMenuPanel();
|
||||
|
||||
static void LoadResources();
|
||||
static void FreeResources();
|
||||
|
||||
DYNAMIC void __fastcall MouseDown(System::Uitypes::TMouseButton Button,
|
||||
System::Classes::TShiftState Shift, int X, int Y);
|
||||
DYNAMIC void __fastcall MouseUp(System::Uitypes::TMouseButton Button,
|
||||
System::Classes::TShiftState Shift, int X, int Y);
|
||||
MESSAGE void __fastcall WMEraseBkgnd(Winapi::Messages::TWMEraseBkgnd &Message);
|
||||
MESSAGE void __fastcall WMMouseMove(TWMMouse &Message);
|
||||
MESSAGE void __fastcall CMMouseLeave(TMessage &Message);
|
||||
|
||||
BEGIN_MESSAGE_MAP
|
||||
MESSAGE_HANDLER(WM_ERASEBKGND, TWMEraseBkgnd, WMEraseBkgnd)
|
||||
MESSAGE_HANDLER(WM_MOUSEMOVE, TWMMouseMove, WMMouseMove)
|
||||
MESSAGE_HANDLER(CM_MOUSELEAVE, TMessage, CMMouseLeave)
|
||||
END_MESSAGE_MAP(Vcl::Extctrls::TPanel)
|
||||
|
||||
CMenuItem* __fastcall CreateMenu( String strCaption, String strHotkey="",
|
||||
TNotifyEvent aClickEvent=NULL, int idMenu=-1,
|
||||
TPngImage *pPic=0);
|
||||
void __fastcall SetMenuItems( System::Classes::TList* pItems ) { m_Items=pItems; };
|
||||
void __fastcall DeleteMenuItem(int index);
|
||||
void __fastcall ClearItems() { DeleteMenuItem(CLEAR_ALL); };
|
||||
void __fastcall Show( int X, int Y );
|
||||
|
||||
__published:
|
||||
__property int Type = { read=m_iType, write=m_iType };
|
||||
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
#ifndef MESSAGEDEF_H
|
||||
#define MESSAGEDEF_H
|
||||
|
||||
// µ×²ãÏûÏ¢
|
||||
#define MSG_PLAY_RANGE WM_USER + 0x100
|
||||
#define MSG_PLAY_END WM_USER + 0x101
|
||||
#define MSG_PLAY_FAILED WM_USER + 0x102
|
||||
#define MSG_PLAY_ABORT WM_USER + 0x104
|
||||
#define MSG_OPERATE_FAILED WM_USER + 0x105
|
||||
#define MSG_OPERATE_PERCENT WM_USER + 0x106
|
||||
#define MSG_OPERATE_COMPLETE WM_USER + 0x107
|
||||
#define MSG_RECORD_FAILED WM_USER + 0x108
|
||||
#define MSG_RECORD_COMPLETE WM_USER + 0x109
|
||||
#define MSG_RECORD_VOLJUST WM_USER + 0x10A
|
||||
#define MSG_MEASURE_0 WM_USER + 0x110
|
||||
#define MSG_MEDIATIME WM_USER + 0X115
|
||||
#define MSG_SETSCROLLPOS WM_USER + 0x120
|
||||
#define MSG_OPERATE_NEXTRANGE WM_USER + 0x121
|
||||
#define MSG_NETWORKMESSAGE WM_USER + 0x130
|
||||
#define MSG_NETWORKERROR WM_USER + 0x131
|
||||
#define MSG_VSTEDITORRESIZE WM_USER + 0x132
|
||||
#define MSG_PAYMENTCONFIRMED WM_USER + 0x133
|
||||
|
||||
// ½çÃæÏûÏ¢
|
||||
#define UM_RESTORE WM_USER + 0x1000
|
||||
#define UM_SHOWMENU WM_USER + 0x1001
|
||||
#define UM_SHOWNEXTPAGE WM_USER + 0x1002
|
||||
#define UM_TEINVALIDATE WM_USER + 0x1003
|
||||
#define UM_LOGIN WM_USER + 0x1004
|
||||
#define UM_ENABLERELOAD WM_USER + 0x1005
|
||||
#define UM_SELECTSTYLE WM_USER + 0x1006
|
||||
#define UM_LOADPROJECT WM_USER + 0x1007
|
||||
#define UM_SAVEPROJECT WM_USER + 0x1008
|
||||
#define UM_NEWPROJECT WM_USER + 0x1009
|
||||
#define UM_AUDIOEFFECT WM_USER + 0x100a
|
||||
#define UM_NEWCOMERTASK WM_USER + 0x1010
|
||||
#define UM_REFRESH_PAGE_STATE WM_USER + 0x1011
|
||||
#define UM_SAVEMUSIC WM_USER + 0x1012
|
||||
#define UM_UPLOADMUSIC WM_USER + 0x1013
|
||||
#define UM_MICSETTING WM_USER + 0x1014
|
||||
#define UM_STAGECHANGED WM_USER + 0x1100
|
||||
#define UM_SHOWABOUT WM_USER + 0x110a
|
||||
#define UM_OPENMANUAL WM_USER + 0x110b
|
||||
//#define UM_MENUCALL WM_USER + 0x110c
|
||||
#define UM_MENUCLOSE WM_USER + 0x110d
|
||||
#define UM_MOUSEMOVE WM_USER + 0x110e
|
||||
#define UM_MOUSEUP WM_USER + 0x110f
|
||||
#define UM_SHOWPLAYTIME WM_USER + 0x1110
|
||||
#define UM_SHOWBRUSH WM_USER + 0x1111
|
||||
#define UM_STOP WM_USER + 0x1112
|
||||
#define UM_TTSETUP WM_USER + 0x1113
|
||||
#define UM_CHANGETT WM_USER + 0x1114
|
||||
#define UM_SHOW_KB WM_USER + 0x1115 //add by laq
|
||||
#define UM_SEARCH WM_USER + 0x1116 //add by laq 2014.1.23
|
||||
#define UM_OPENAUTOPROJ WM_USER + 0x1117
|
||||
#define UM_HANDLEAUTOPROJ WM_USER + 0x1118
|
||||
#define UM_SHOWHELP WM_USER + 0x1119
|
||||
#define UM_SHOWMORE WM_USER + 0x111a
|
||||
#define UM_STYLESCORE WM_USER + 0x111b
|
||||
#define UM_NOTIFICATION WM_USER + 0x111c //add by tj 2014/04/18
|
||||
#define UM_APPLYSTYLE WM_USER + 0x111d
|
||||
#define UM_SAVELOCALSTYLE WM_USER + 0x111e
|
||||
#define UM_IMPORTSEGMENT WM_USER + 0x111f
|
||||
#define UM_UPLOADSTYLE WM_USER + 0x1120
|
||||
#define UM_CHANGEKEY WM_USER + 0x1121
|
||||
#define UM_SETVIEWMODE WM_USER + 0x1122
|
||||
#define UM_ENABLERECORD WM_USER + 0X1123
|
||||
#define UM_AUDIOLOAD WM_USER + 0x1124
|
||||
#define UM_AUTORECOGNITION WM_USER + 0x1125
|
||||
#define UM_MUSICCOVER WM_USER + 0x1126
|
||||
#define UM_UPLOADUSRICON WM_USER + 0x1127
|
||||
#define UM_SHOW_VOLSET WM_USER + 0x1128
|
||||
#define UM_ADDCHANNELPROG WM_USER + 0x1129
|
||||
#define UM_MIDISWITCH WM_USER + 0x1130
|
||||
#define UM_AUDIOFX WM_USER + 0x1131
|
||||
#define UM_VSTPATH WM_USER + 0x1132
|
||||
#define UM_SETCONTENTVIEW WM_USER + 0x1133
|
||||
#define UM_GETCONTENTVIEW WM_USER + 0x1134
|
||||
#define UM_AUDIOVOLCHANGED WM_USER + 0x1135
|
||||
#define UM_PREFERCHANGED WM_USER + 0x1136
|
||||
#define UM_RECORD WM_USER + 0x1137
|
||||
#define UM_STARTCDTIMER WM_USER + 0x1138
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,181 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "GlobalUnit.h"
|
||||
#include "MessageFormUnit.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
#pragma link "PNGButton"
|
||||
#pragma link "CKBox"
|
||||
#pragma link "GeneralDialogPanel"
|
||||
#pragma link "TextButton"
|
||||
#pragma resource "*.dfm"
|
||||
TMessageForm *MessageForm;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TMessageForm::TMessageForm(TComponent* Owner)
|
||||
: TForm(Owner)
|
||||
{
|
||||
m_iCheck = -1;
|
||||
|
||||
Font->Color = RGB(60,43,23);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TMessageForm::~TMessageForm()
|
||||
{
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TMessageForm::WMNCHitTest(TWMNCHitTest &Msg)
|
||||
{
|
||||
TForm::Dispatch(&Msg);
|
||||
|
||||
if( Msg.Result==HTCLIENT && Msg.YPos<Top+24 )
|
||||
Msg.Result = HTCAPTION;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
int __fastcall TMessageForm::ShowMessage( const String AMessage, int AType, const String ATitle )
|
||||
{
|
||||
if( Visible )
|
||||
return -1;
|
||||
|
||||
m_iconInformation->Visible = false;
|
||||
m_iconError->Visible = false;
|
||||
m_iconQuestion->Visible = false;
|
||||
|
||||
m_btnYes->Visible = false;
|
||||
m_btnNo->Visible = false;
|
||||
m_btnOk->Visible = false;
|
||||
m_btnCancel->Visible = false;
|
||||
|
||||
m_pbCheck->Visible = false;
|
||||
|
||||
int iIconType = AType & 0x0F0;
|
||||
if( iIconType==MB_ICONERROR ){
|
||||
m_iconError->Visible = true;
|
||||
}
|
||||
else if( iIconType==MB_ICONQUESTION ) {
|
||||
m_iconQuestion->Visible = true;
|
||||
}
|
||||
else if( iIconType==MB_ICONINFORMATION ) {
|
||||
m_iconInformation->Visible = true;
|
||||
}
|
||||
|
||||
int iButtonType = AType & 0x0F;
|
||||
if( iButtonType==MB_OK ){
|
||||
m_btnOk->Visible = true;
|
||||
m_btnOk->Left = (Width - m_btnOk->Width)/2 + 6;
|
||||
}
|
||||
else if( iButtonType==MB_OKCANCEL ){
|
||||
m_btnOk->Visible = true;
|
||||
m_btnCancel->Visible = true;
|
||||
m_btnOk->Left = (Width - (m_btnOk->Width+6)*2 )/2 + 6;
|
||||
m_btnCancel->Left = m_btnOk->Left + m_btnOk->Width + 6;
|
||||
}
|
||||
else if( iButtonType==MB_YESNO ){
|
||||
m_btnYes->Visible = true;
|
||||
m_btnNo->Visible = true;
|
||||
m_btnYes->Left = (Width - (m_btnYes->Width+6)*2 )/2 + 6;
|
||||
m_btnNo->Left = m_btnYes->Left + m_btnYes->Width + 6;
|
||||
}
|
||||
else if( iButtonType==MB_YESNOCANCEL ){
|
||||
m_btnYes->Visible = true;
|
||||
m_btnNo->Visible = true;
|
||||
m_btnCancel->Visible = true;
|
||||
m_btnYes->Left = (Width - (m_btnYes->Width+6)*3 )/2 + 6;
|
||||
m_btnNo->Left = m_btnYes->Left + m_btnYes->Width + 6;
|
||||
m_btnCancel->Left = m_btnNo->Left + m_btnNo->Width + 6;
|
||||
// m_pbCheck->Width = m_btnYes->Left - m_pbCheck->Left - 4 ; //add
|
||||
}
|
||||
|
||||
int iCheckType = AType & 0xF00;
|
||||
if( iCheckType ){
|
||||
if( iCheckType==MB_CHECKED ){
|
||||
m_pbCheck->Checked = true;
|
||||
}
|
||||
else if( iCheckType==MB_UNCHECKED ){
|
||||
m_pbCheck->Checked = false;
|
||||
}
|
||||
m_pbCheck->Show();
|
||||
}
|
||||
else{
|
||||
m_pbCheck->Hide();
|
||||
}
|
||||
|
||||
m_lblMessage->Caption = AMessage;
|
||||
|
||||
if( ATitle.Length()>0 )
|
||||
m_panGeneral->Caption = ATitle;
|
||||
else
|
||||
m_panGeneral->Caption = "Ìáʾ";
|
||||
//Ô²½Ç
|
||||
// HRGN hRgn = CreateRoundRectRgn( 0, 0, Width+1, Height+2, 20, 20 );
|
||||
// SetWindowRgn( Handle, hRgn, false );
|
||||
// DeleteObject( hRgn );
|
||||
|
||||
return ShowModal();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TMessageForm::FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift)
|
||||
{
|
||||
switch( Key ){
|
||||
case VK_RETURN:
|
||||
case ' ':
|
||||
if( m_btnYes->Visible )
|
||||
ModalResult = mrYes;
|
||||
else if( m_btnOk->Visible )
|
||||
ModalResult = mrOk;
|
||||
break;
|
||||
|
||||
case VK_ESCAPE:
|
||||
if( m_btnCancel->Visible )
|
||||
ModalResult = mrCancel;
|
||||
break;
|
||||
|
||||
case 'Y':
|
||||
if( m_btnYes->Visible )
|
||||
ModalResult = mrYes;
|
||||
break;
|
||||
|
||||
case 'N':
|
||||
if( m_btnNo->Visible )
|
||||
ModalResult = mrNo;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void _fastcall TMessageForm::SetCheckMessage( String strMessage )
|
||||
{
|
||||
if( strMessage.IsEmpty() ){
|
||||
m_pbCheck->Caption = L"²»ÔÙÌáʾ";
|
||||
}
|
||||
else{
|
||||
m_pbCheck->Caption = strMessage;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
bool TMessageForm::GetCheckState()
|
||||
{
|
||||
return m_pbCheck->Checked;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TMessageForm::FormCreate(TObject *Sender)
|
||||
{
|
||||
m_lblMessage->ControlStyle>>csOpaque;
|
||||
|
||||
m_panGeneral->Font->Size = g_szFont9;
|
||||
m_pbCheck->Font->Size = g_szFont9;
|
||||
m_btnYes->FontSize = g_szFont9;
|
||||
m_btnOk->FontSize = g_szFont9;
|
||||
m_btnNo->FontSize = g_szFont9;
|
||||
m_btnCancel->FontSize = g_szFont9;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,480 @@
|
||||
object MessageForm: TMessageForm
|
||||
Left = 0
|
||||
Top = 0
|
||||
ParentCustomHint = False
|
||||
HorzScrollBar.Visible = False
|
||||
BiDiMode = bdLeftToRight
|
||||
BorderIcons = []
|
||||
BorderStyle = bsNone
|
||||
ClientHeight = 140
|
||||
ClientWidth = 314
|
||||
Color = clBtnFace
|
||||
DoubleBuffered = True
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
KeyPreview = True
|
||||
ParentBiDiMode = False
|
||||
PopupMode = pmAuto
|
||||
Position = poScreenCenter
|
||||
Scaled = False
|
||||
ShowHint = True
|
||||
OnCreate = FormCreate
|
||||
OnKeyDown = FormKeyDown
|
||||
TextHeight = 13
|
||||
object m_panGeneral: TGeneralDialogPanel
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 314
|
||||
Height = 140
|
||||
Align = alClient
|
||||
Color = 5064257
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentBackground = False
|
||||
ParentFont = False
|
||||
TabOrder = 0
|
||||
object m_iconError: TImage
|
||||
Left = 6
|
||||
Top = 6
|
||||
Width = 28
|
||||
Height = 28
|
||||
ParentCustomHint = False
|
||||
AutoSize = True
|
||||
ParentShowHint = False
|
||||
Picture.Data = {
|
||||
0954506E67496D61676589504E470D0A1A0A0000000D494844520000001C0000
|
||||
001C0806000000720DDF94000000097048597300000B1300000B1301009A9C18
|
||||
00000A4D6943435050686F746F73686F70204943432070726F66696C65000078
|
||||
DA9D53775893F7163EDFF7650F5642D8F0B1976C81002223AC08C81059A21092
|
||||
006184101240C585880A561415119C4855C482D50A489D88E2A028B867418A88
|
||||
5A8B555C38EE1FDCA7B57D7AEFEDEDFBD7FBBCE79CE7FCCE79CF0F8011122691
|
||||
E6A26A003952853C3AD81F8F4F48C4C9BD80021548E0042010E6CBC26705C500
|
||||
00F00379787E74B03FFC01AF6F00020070D52E2412C7E1FF83BA502657002091
|
||||
00E02212E70B01905200C82E54C81400C81800B053B3640A009400006C797C42
|
||||
2200AA0D00ECF4493E0500D8A993DC1700D8A21CA908008D0100992847240240
|
||||
BB00605581522C02C0C200A0AC40222E04C0AE018059B632470280BD0500768E
|
||||
58900F4060008099422CCC0020380200431E13CD03204C03A030D2BFE0A95F70
|
||||
85B8480100C0CB95CD974BD23314B895D01A77F2F0E0E221E2C26CB142611729
|
||||
106609E4229C979B231348E7034CCE0C00001AF9D1C1FE383F90E7E6E4E1E666
|
||||
E76CEFF4C5A2FE6BF06F223E21F1DFFEBC8C020400104ECFEFDA5FE5E5D60370
|
||||
C701B075BF6BA95B00DA560068DFF95D33DB09A05A0AD07AF98B7938FC401E9E
|
||||
A150C83C1D1C0A0B0BED2562A1BD30E38B3EFF33E16FE08B7EF6FC401EFEDB7A
|
||||
F000719A4099ADC0A383FD71616E76AE528EE7CB0442316EF7E723FEC7857FFD
|
||||
8E29D1E234B15C2C158AF15889B850224DC779B952914421C995E212E97F32F1
|
||||
1F96FD0993770D00AC864FC04EB607B5CB6CC07EEE01028B0E58D27600407EF3
|
||||
2D8C1A0B91001067343279F7000093BFF98F402B0100CD97A4E30000BCE8185C
|
||||
A894174CC608000044A0812AB041070CC114ACC00E9CC11DBCC0170261064440
|
||||
0C24C03C104206E4801C0AA11896411954C03AD804B5B0031AA0119AE110B4C1
|
||||
31380DE7E0125C81EB70170660189EC218BC86090441C8081361213A8811628E
|
||||
D822CE0817998E04226148349280A420E988145122C5C872A402A9426A915D48
|
||||
23F22D7214398D5C40FA90DBC820328AFC8ABC47319481B25103D4027540B9A8
|
||||
1F1A8AC6A073D174340F5D8096A26BD11AB41E3D80B6A2A7D14BE87574007D8A
|
||||
8E6380D1310E668CD9615C8C87456089581A26C71663E55835568F35631D5837
|
||||
76151BC09E61EF0824028B8013EC085E8410C26C82909047584C5843A825EC23
|
||||
B412BA085709838431C2272293A84FB4257A12F9C478623AB1905846AC26EE21
|
||||
1E219E255E270E135F9348240EC992E44E0A21259032490B496B48DB482DA453
|
||||
A43ED210699C4C26EB906DC9DEE408B280AC209791B7900F904F92FBC9C3E4B7
|
||||
143AC588E24C09A22452A494124A35653FE504A59F324299A0AA51CDA99ED408
|
||||
AA883A9F5A496DA076502F5387A91334759A25CD9B1643CBA42DA3D5D09A6967
|
||||
69F7682FE974BA09DD831E4597D097D26BE807E9E7E983F4770C0D860D83C748
|
||||
6228196B197B19A718B7192F994CA605D39799C85430D7321B9967980F986F55
|
||||
582AF62A7C1591CA12953A9556957E95E7AA545573553FD579AA0B54AB550FAB
|
||||
5E567DA64655B350E3A909D416ABD5A91D55BBA936AECE5277528F50CF515FA3
|
||||
BE5FFD82FA630DB2868546A08648A35463B7C6198D2116C63265F15842D67256
|
||||
03EB2C6B984D625BB2F9EC4C7605FB1B762F7B4C534373AA66AC6691669DE671
|
||||
CD010EC6B1E0F039D99C4ACE21CE0DCE7B2D032D3F2DB1D66AAD66AD7EAD37DA
|
||||
7ADABEDA62ED72ED16EDEBDAEF75709D409D2C9DF53A6D3AF77509BA36BA51BA
|
||||
85BADB75CFEA3ED363EB79E909F5CAF50EE9DDD147F56DF4A3F517EAEFD6EFD1
|
||||
1F373034083690196C313863F0CC9063E86B9869B8D1F084E1A811CB68BA91C4
|
||||
68A3D149A327B826EE8767E33578173E66AC6F1C62AC34DE65DC6B3C61626932
|
||||
DBA4C4A4C5E4BE29CD946B9A66BAD1B4D374CCCCC82CDCACD8ACC9EC8E39D59C
|
||||
6B9E61BED9BCDBFC8D85A5459CC54A8B368BC796DA967CCB05964D96F7AC9856
|
||||
3E567956F556D7AC49D65CEB2CEB6DD6576C501B579B0C9B3A9BCBB6A8AD9BAD
|
||||
C4769B6DDF14E2148F29D229F5536EDA31ECFCEC0AEC9AEC06ED39F661F625F6
|
||||
6DF6CF1DCC1C121DD63B743B7C727475CC766C70BCEBA4E134C3A9C4A9C3E957
|
||||
671B67A1739DF33517A64B90CB1297769717536DA78AA76E9F7ACB95E51AEEBA
|
||||
D2B5D3F5A39BBB9BDCADD96DD4DDCC3DC57DABFB4D2E9B1BC95DC33DEF41F4F0
|
||||
F758E271CCE39DA79BA7C2F390E72F5E765E595EFBBD1E4FB39C269ED6306DC8
|
||||
DBC45BE0BDCB7B603A3E3D65FACEE9033EC63E029F7A9F87BEA6BE22DF3DBE23
|
||||
7ED67E997E07FC9EFB3BFACBFD8FF8BFE179F216F14E056001C101E501BD811A
|
||||
81B3036B031F049904A50735058D05BB062F0C3E15420C090D591F72936FC017
|
||||
F21BF96333DC672C9AD115CA089D155A1BFA30CC264C1ED6118E86CF08DF107E
|
||||
6FA6F94CE9CCB60888E0476C88B81F69199917F97D14292A32AA2EEA51B45374
|
||||
7174F72CD6ACE459FB67BD8EF18FA98CB93BDB6AB6727667AC6A6C526C63EC9B
|
||||
B880B8AAB8817887F845F1971274132409ED89E4C4D8C43D89E37302E76C9A33
|
||||
9CE49A54967463AEE5DCA2B917E6E9CECB9E773C593559907C3885981297B23F
|
||||
E5832042502F184FE5A76E4D1D13F2849B854F45BEA28DA251B1B7B84A3C92E6
|
||||
9D5695F638DD3B7D43FA68864F4675C633094F522B79911992B923F34D5644D6
|
||||
DEACCFD971D92D39949C949CA3520D6996B42BD730B728B74F662B2B930DE479
|
||||
E66DCA1B9387CAF7E423F973F3DB156C854CD1A3B452AE500E164C2FA82B785B
|
||||
185B78B848BD485AD433DF66FEEAF9230B82167CBD90B050B8B0B3D8B87859F1
|
||||
E022BF45BB16238B5317772E315D52BA647869F0D27DCB68CBB296FD50E25852
|
||||
55F26A79DCF28E5283D2A5A5432B82573495A994C9CB6EAEF45AB96315619564
|
||||
55EF6A97D55B567F2A17955FAC70ACA8AEF8B046B8E6E2574E5FD57CF5796DDA
|
||||
DADE4AB7CAEDEB48EBA4EB6EACF759BFAF4ABD6A41D5D086F00DAD1BF18DE51B
|
||||
5F6D4ADE74A17A6AF58ECDB4CDCACD03356135ED5BCCB6ACDBF2A136A3F67A9D
|
||||
7F5DCB56FDADABB7BED926DAD6BFDD777BF30E831D153BDEEF94ECBCB52B7857
|
||||
6BBD457DF56ED2EE82DD8F1A621BBABFE67EDDB847774FC59E8F7BA57B07F645
|
||||
EFEB6A746F6CDCAFBFBFB2096D52368D1E483A70E59B806FDA9BED9A77B5705A
|
||||
2A0EC241E5C127DFA67C7BE350E8A1CEC3DCC3CDDF997FB7F508EB48792BD23A
|
||||
BF75AC2DA36DA03DA1BDEFE88CA39D1D5E1D47BEB7FF7EEF31E36375C7358F57
|
||||
9EA09D283DF1F9E48293E3A764A79E9D4E3F3DD499DC79F74CFC996B5D515DBD
|
||||
6743CF9E3F1774EE4CB75FF7C9F3DEE78F5DF0BC70F422F762DB25B74BAD3DAE
|
||||
3D477E70FDE148AF5B6FEB65F7CBED573CAE74F44DEB3BD1EFD37FFA6AC0D573
|
||||
D7F8D72E5D9F79BDEFC6EC1BB76E26DD1CB825BAF5F876F6ED17770AEE4CDC5D
|
||||
7A8F78AFFCBEDAFDEA07FA0FEA7FB4FEB165C06DE0F860C060CFC3590FEF0E09
|
||||
879EFE94FFD387E1D247CC47D52346238D8F9D1F1F1B0D1ABDF264CE93E1A7B2
|
||||
A713CFCA7E56FF79EB73ABE7DFFDE2FB4BCF58FCD8F00BF98BCFBFAE79A9F372
|
||||
EFABA9AF3AC723C71FBCCE793DF1A6FCADCEDB7DEFB8EFBADFC7BD1F9928FC40
|
||||
FE50F3D1FA63C7A7D04FF73EE77CFEFC2FF784F3FB25D29F33000002F6494441
|
||||
5478DAAD964B68135114864F92B621B11AABADA4313645AAD5A25551DCA80842
|
||||
7D6010A18A0FF05110A5A80B29E84271A31B373E16BA1045ED4294FA0051F081
|
||||
A25817858A8158ADF1515BB5446B2D4963439326F13F930E4C26F34ACC0F3FB9
|
||||
33F7E47E33F79E7BE69A6AEB169001D5C29BE006B8145E387EDF0747E027F0AD
|
||||
EE2EDF07BD814C3AC0B5F04978B191A7825EC3C7007E982BD0065F82B71B04C9
|
||||
75136E02386A045805B7C14BF38489F2C35E40FBB4800EF8253CFF3F61A23EC1
|
||||
4B000D29012DF01D78438160A238A1D6019A90039BE10BE2C5EC513BB5F6CD25
|
||||
339932FE7DBEFC3B5D2B0B0AED5D434EDAFFDB9DD13F624E5263B59F062D71E9
|
||||
ED3D005E96023949BEC04E69D4F19FD5E40D97670DB8D9F35668B7F5CE237BD2
|
||||
ACFA4012FD80E7001A1181BBE12BF2A88AB112C5411F4DFC23FCAE199E9271FF
|
||||
5BF1286DC5C3C44D29A5A9DD07E04511781F5EAF14A5346D6A3A5CF9999E970E
|
||||
A975B703B882819C2CC3E3D39AA5E29449784B57DCAA09F3D922B4D7DDAD15C2
|
||||
7B7232036BD0F8A815C95377223853B53F4929DA59F59E02D611BD4958C4C0E5
|
||||
94DE7B9ABAD7534F4EACA9923AEC613A383DA037046B3503B9203FD68A5AF6D7
|
||||
4167FA6769BEE136CF3BEA2989928EBC0CE412D6A116C16B78036B3843670D5F
|
||||
4D08D12197E6CAB084A4E1DC1E548BC8254B19C8600DB9C56DD14BE9A29DA1B2
|
||||
4411DDFD5A9FB50F9F22F5B912C9DF5A671F06B12D2A452097B46679C4915F1E
|
||||
6A0C5564DC8B9813B4C5D305A04D715D552A0DEB2A804D22903FB09DD25EB55A
|
||||
7A6A5A2FDD760C086D067242C91F68236A69D83296B57E00B64B8B37676A8378
|
||||
C1656D2AA654AE80352A64256B12FA5D0A5BA5BF2826073E00CCCB0D29B00E7E
|
||||
032B6FB6FC15A3F437D12F07B276C0AD05060A455BBC503A62F0A1E9688160A7
|
||||
016B91DE503B441D80CF52FA14908FF8EBDE02D8397987D6317125A54F6E3539
|
||||
C2F81CC3D3F84CA953EF5CCA09C447455EDB553AA017F0754AEFB7985A901E50
|
||||
2AAE00AA276F40068C0C624AA55246E20AA67FC9F81007218208890000000049
|
||||
454E44AE426082}
|
||||
ShowHint = False
|
||||
end
|
||||
object m_iconInformation: TImage
|
||||
Left = 6
|
||||
Top = 6
|
||||
Width = 28
|
||||
Height = 28
|
||||
AutoSize = True
|
||||
Picture.Data = {
|
||||
0954506E67496D61676589504E470D0A1A0A0000000D494844520000001C0000
|
||||
001C0806000000720DDF94000000097048597300000B1300000B1301009A9C18
|
||||
00000A4D6943435050686F746F73686F70204943432070726F66696C65000078
|
||||
DA9D53775893F7163EDFF7650F5642D8F0B1976C81002223AC08C81059A21092
|
||||
006184101240C585880A561415119C4855C482D50A489D88E2A028B867418A88
|
||||
5A8B555C38EE1FDCA7B57D7AEFEDEDFBD7FBBCE79CE7FCCE79CF0F8011122691
|
||||
E6A26A003952853C3AD81F8F4F48C4C9BD80021548E0042010E6CBC26705C500
|
||||
00F00379787E74B03FFC01AF6F00020070D52E2412C7E1FF83BA502657002091
|
||||
00E02212E70B01905200C82E54C81400C81800B053B3640A009400006C797C42
|
||||
2200AA0D00ECF4493E0500D8A993DC1700D8A21CA908008D0100992847240240
|
||||
BB00605581522C02C0C200A0AC40222E04C0AE018059B632470280BD0500768E
|
||||
58900F4060008099422CCC0020380200431E13CD03204C03A030D2BFE0A95F70
|
||||
85B8480100C0CB95CD974BD23314B895D01A77F2F0E0E221E2C26CB142611729
|
||||
106609E4229C979B231348E7034CCE0C00001AF9D1C1FE383F90E7E6E4E1E666
|
||||
E76CEFF4C5A2FE6BF06F223E21F1DFFEBC8C020400104ECFEFDA5FE5E5D60370
|
||||
C701B075BF6BA95B00DA560068DFF95D33DB09A05A0AD07AF98B7938FC401E9E
|
||||
A150C83C1D1C0A0B0BED2562A1BD30E38B3EFF33E16FE08B7EF6FC401EFEDB7A
|
||||
F000719A4099ADC0A383FD71616E76AE528EE7CB0442316EF7E723FEC7857FFD
|
||||
8E29D1E234B15C2C158AF15889B850224DC779B952914421C995E212E97F32F1
|
||||
1F96FD0993770D00AC864FC04EB607B5CB6CC07EEE01028B0E58D27600407EF3
|
||||
2D8C1A0B91001067343279F7000093BFF98F402B0100CD97A4E30000BCE8185C
|
||||
A894174CC608000044A0812AB041070CC114ACC00E9CC11DBCC0170261064440
|
||||
0C24C03C104206E4801C0AA11896411954C03AD804B5B0031AA0119AE110B4C1
|
||||
31380DE7E0125C81EB70170660189EC218BC86090441C8081361213A8811628E
|
||||
D822CE0817998E04226148349280A420E988145122C5C872A402A9426A915D48
|
||||
23F22D7214398D5C40FA90DBC820328AFC8ABC47319481B25103D4027540B9A8
|
||||
1F1A8AC6A073D174340F5D8096A26BD11AB41E3D80B6A2A7D14BE87574007D8A
|
||||
8E6380D1310E668CD9615C8C87456089581A26C71663E55835568F35631D5837
|
||||
76151BC09E61EF0824028B8013EC085E8410C26C82909047584C5843A825EC23
|
||||
B412BA085709838431C2272293A84FB4257A12F9C478623AB1905846AC26EE21
|
||||
1E219E255E270E135F9348240EC992E44E0A21259032490B496B48DB482DA453
|
||||
A43ED210699C4C26EB906DC9DEE408B280AC209791B7900F904F92FBC9C3E4B7
|
||||
143AC588E24C09A22452A494124A35653FE504A59F324299A0AA51CDA99ED408
|
||||
AA883A9F5A496DA076502F5387A91334759A25CD9B1643CBA42DA3D5D09A6967
|
||||
69F7682FE974BA09DD831E4597D097D26BE807E9E7E983F4770C0D860D83C748
|
||||
6228196B197B19A718B7192F994CA605D39799C85430D7321B9967980F986F55
|
||||
582AF62A7C1591CA12953A9556957E95E7AA545573553FD579AA0B54AB550FAB
|
||||
5E567DA64655B350E3A909D416ABD5A91D55BBA936AECE5277528F50CF515FA3
|
||||
BE5FFD82FA630DB2868546A08648A35463B7C6198D2116C63265F15842D67256
|
||||
03EB2C6B984D625BB2F9EC4C7605FB1B762F7B4C534373AA66AC6691669DE671
|
||||
CD010EC6B1E0F039D99C4ACE21CE0DCE7B2D032D3F2DB1D66AAD66AD7EAD37DA
|
||||
7ADABEDA62ED72ED16EDEBDAEF75709D409D2C9DF53A6D3AF77509BA36BA51BA
|
||||
85BADB75CFEA3ED363EB79E909F5CAF50EE9DDD147F56DF4A3F517EAEFD6EFD1
|
||||
1F373034083690196C313863F0CC9063E86B9869B8D1F084E1A811CB68BA91C4
|
||||
68A3D149A327B826EE8767E33578173E66AC6F1C62AC34DE65DC6B3C61626932
|
||||
DBA4C4A4C5E4BE29CD946B9A66BAD1B4D374CCCCC82CDCACD8ACC9EC8E39D59C
|
||||
6B9E61BED9BCDBFC8D85A5459CC54A8B368BC796DA967CCB05964D96F7AC9856
|
||||
3E567956F556D7AC49D65CEB2CEB6DD6576C501B579B0C9B3A9BCBB6A8AD9BAD
|
||||
C4769B6DDF14E2148F29D229F5536EDA31ECFCEC0AEC9AEC06ED39F661F625F6
|
||||
6DF6CF1DCC1C121DD63B743B7C727475CC766C70BCEBA4E134C3A9C4A9C3E957
|
||||
671B67A1739DF33517A64B90CB1297769717536DA78AA76E9F7ACB95E51AEEBA
|
||||
D2B5D3F5A39BBB9BDCADD96DD4DDCC3DC57DABFB4D2E9B1BC95DC33DEF41F4F0
|
||||
F758E271CCE39DA79BA7C2F390E72F5E765E595EFBBD1E4FB39C269ED6306DC8
|
||||
DBC45BE0BDCB7B603A3E3D65FACEE9033EC63E029F7A9F87BEA6BE22DF3DBE23
|
||||
7ED67E997E07FC9EFB3BFACBFD8FF8BFE179F216F14E056001C101E501BD811A
|
||||
81B3036B031F049904A50735058D05BB062F0C3E15420C090D591F72936FC017
|
||||
F21BF96333DC672C9AD115CA089D155A1BFA30CC264C1ED6118E86CF08DF107E
|
||||
6FA6F94CE9CCB60888E0476C88B81F69199917F97D14292A32AA2EEA51B45374
|
||||
7174F72CD6ACE459FB67BD8EF18FA98CB93BDB6AB6727667AC6A6C526C63EC9B
|
||||
B880B8AAB8817887F845F1971274132409ED89E4C4D8C43D89E37302E76C9A33
|
||||
9CE49A54967463AEE5DCA2B917E6E9CECB9E773C593559907C3885981297B23F
|
||||
E5832042502F184FE5A76E4D1D13F2849B854F45BEA28DA251B1B7B84A3C92E6
|
||||
9D5695F638DD3B7D43FA68864F4675C633094F522B79911992B923F34D5644D6
|
||||
DEACCFD971D92D39949C949CA3520D6996B42BD730B728B74F662B2B930DE479
|
||||
E66DCA1B9387CAF7E423F973F3DB156C854CD1A3B452AE500E164C2FA82B785B
|
||||
185B78B848BD485AD433DF66FEEAF9230B82167CBD90B050B8B0B3D8B87859F1
|
||||
E022BF45BB16238B5317772E315D52BA647869F0D27DCB68CBB296FD50E25852
|
||||
55F26A79DCF28E5283D2A5A5432B82573495A994C9CB6EAEF45AB96315619564
|
||||
55EF6A97D55B567F2A17955FAC70ACA8AEF8B046B8E6E2574E5FD57CF5796DDA
|
||||
DADE4AB7CAEDEB48EBA4EB6EACF759BFAF4ABD6A41D5D086F00DAD1BF18DE51B
|
||||
5F6D4ADE74A17A6AF58ECDB4CDCACD03356135ED5BCCB6ACDBF2A136A3F67A9D
|
||||
7F5DCB56FDADABB7BED926DAD6BFDD777BF30E831D153BDEEF94ECBCB52B7857
|
||||
6BBD457DF56ED2EE82DD8F1A621BBABFE67EDDB847774FC59E8F7BA57B07F645
|
||||
EFEB6A746F6CDCAFBFBFB2096D52368D1E483A70E59B806FDA9BED9A77B5705A
|
||||
2A0EC241E5C127DFA67C7BE350E8A1CEC3DCC3CDDF997FB7F508EB48792BD23A
|
||||
BF75AC2DA36DA03DA1BDEFE88CA39D1D5E1D47BEB7FF7EEF31E36375C7358F57
|
||||
9EA09D283DF1F9E48293E3A764A79E9D4E3F3DD499DC79F74CFC996B5D515DBD
|
||||
6743CF9E3F1774EE4CB75FF7C9F3DEE78F5DF0BC70F422F762DB25B74BAD3DAE
|
||||
3D477E70FDE148AF5B6FEB65F7CBED573CAE74F44DEB3BD1EFD37FFA6AC0D573
|
||||
D7F8D72E5D9F79BDEFC6EC1BB76E26DD1CB825BAF5F876F6ED17770AEE4CDC5D
|
||||
7A8F78AFFCBEDAFDEA07FA0FEA7FB4FEB165C06DE0F860C060CFC3590FEF0E09
|
||||
879EFE94FFD387E1D247CC47D52346238D8F9D1F1F1B0D1ABDF264CE93E1A7B2
|
||||
A713CFCA7E56FF79EB73ABE7DFFDE2FB4BCF58FCD8F00BF98BCFBFAE79A9F372
|
||||
EFABA9AF3AC723C71FBCCE793DF1A6FCADCEDB7DEFB8EFBADFC7BD1F9928FC40
|
||||
FE50F3D1FA63C7A7D04FF73EE77CFEFC2FF784F3FB25D29F33000002A2494441
|
||||
5478DAB5966D48536114C7CF6A4E178B0D416B9283C8704861D1CB971223308B
|
||||
46041946102408658405FB14F529A2FA10D10B0845E1100CA28822C330E88506
|
||||
5114B3342814C3953109A3D5B25ACDDBFF7877E3DEEDBE3CDBF20F7FB83BF739
|
||||
CFEFEEB9E779EEB155D7D49280AAE126B80176C1CBD2F17E3801DF83AFBF79DD
|
||||
FFD66A229B0570237C0C5E21F254D00BF808C07773053AE14BF04E4150A6AEC2
|
||||
2D00FF1001FAE06BF0EA3C618A06E000A05133A01B7E0C2F2D10A668185E0968
|
||||
5C0F381BBE016FD1CB9C723A28D1B8242B3E6B3249AEBE41332817D426405399
|
||||
C036B8C328EBCF3C37456FB667C5EDE371F26D3D67F54F5B01BCAC0672918CC0
|
||||
F367083806FB014D28C0DD70A759468140D61E002F2AC01E78F30C03C300D631
|
||||
908BE55B7A590D2515DBE9DDC34359F1A2E8045536779080784F7A1858858B21
|
||||
918CD1DE20A53C733431E7B311F21EE81649672D67E05A92F79EA5C63A5BE997
|
||||
DFAB89CDBD1DA1B2E33DA2C00D0CE403B94F64F4F8C9EDF4BDDEAF89955E7840
|
||||
9E5058141860201F614F45464F1C6CA478B3F6C42B3F7A8B5CBDAF4481D34553
|
||||
CA73898C661843D5AAD8D74525915151E002655B7086CF6A342F272FAB5ABE6D
|
||||
E7C9FEF18B082C866DE155805CD76D56195C305C38FF3425D1C27527C8F63B25
|
||||
020C01D8A200F903FB5C745DF2541D8061F5E1CD95DA6096F1B3B632EB1DF296
|
||||
700CC5AC6077000BF0851A580347608751D6E49AC5143BB54313ABD81BA29297
|
||||
EFCD604992BF89039940D62EB8EB3F03A70F6DE5875E8BC14DD361DD475D544E
|
||||
5F9B566962EEEE2754F4E1B311EC34604175C0A889DA0F9F21B90BC8475CB641
|
||||
C0CE66DE306B13EB49EEDCAA72840DA797F1BEDE4DABBE940B885B457EB7EB2D
|
||||
408FE02B24EFB7A4D1202BA05A6564D27903F24964129B244939AE5861FA0B36
|
||||
05EEF82A32C1E10000000049454E44AE426082}
|
||||
end
|
||||
object m_iconQuestion: TImage
|
||||
Left = 7
|
||||
Top = 6
|
||||
Width = 28
|
||||
Height = 28
|
||||
ParentCustomHint = False
|
||||
AutoSize = True
|
||||
ParentShowHint = False
|
||||
Picture.Data = {
|
||||
0954506E67496D61676589504E470D0A1A0A0000000D494844520000001C0000
|
||||
001C0806000000720DDF94000000097048597300000B1300000B1301009A9C18
|
||||
00000A4D6943435050686F746F73686F70204943432070726F66696C65000078
|
||||
DA9D53775893F7163EDFF7650F5642D8F0B1976C81002223AC08C81059A21092
|
||||
006184101240C585880A561415119C4855C482D50A489D88E2A028B867418A88
|
||||
5A8B555C38EE1FDCA7B57D7AEFEDEDFBD7FBBCE79CE7FCCE79CF0F8011122691
|
||||
E6A26A003952853C3AD81F8F4F48C4C9BD80021548E0042010E6CBC26705C500
|
||||
00F00379787E74B03FFC01AF6F00020070D52E2412C7E1FF83BA502657002091
|
||||
00E02212E70B01905200C82E54C81400C81800B053B3640A009400006C797C42
|
||||
2200AA0D00ECF4493E0500D8A993DC1700D8A21CA908008D0100992847240240
|
||||
BB00605581522C02C0C200A0AC40222E04C0AE018059B632470280BD0500768E
|
||||
58900F4060008099422CCC0020380200431E13CD03204C03A030D2BFE0A95F70
|
||||
85B8480100C0CB95CD974BD23314B895D01A77F2F0E0E221E2C26CB142611729
|
||||
106609E4229C979B231348E7034CCE0C00001AF9D1C1FE383F90E7E6E4E1E666
|
||||
E76CEFF4C5A2FE6BF06F223E21F1DFFEBC8C020400104ECFEFDA5FE5E5D60370
|
||||
C701B075BF6BA95B00DA560068DFF95D33DB09A05A0AD07AF98B7938FC401E9E
|
||||
A150C83C1D1C0A0B0BED2562A1BD30E38B3EFF33E16FE08B7EF6FC401EFEDB7A
|
||||
F000719A4099ADC0A383FD71616E76AE528EE7CB0442316EF7E723FEC7857FFD
|
||||
8E29D1E234B15C2C158AF15889B850224DC779B952914421C995E212E97F32F1
|
||||
1F96FD0993770D00AC864FC04EB607B5CB6CC07EEE01028B0E58D27600407EF3
|
||||
2D8C1A0B91001067343279F7000093BFF98F402B0100CD97A4E30000BCE8185C
|
||||
A894174CC608000044A0812AB041070CC114ACC00E9CC11DBCC0170261064440
|
||||
0C24C03C104206E4801C0AA11896411954C03AD804B5B0031AA0119AE110B4C1
|
||||
31380DE7E0125C81EB70170660189EC218BC86090441C8081361213A8811628E
|
||||
D822CE0817998E04226148349280A420E988145122C5C872A402A9426A915D48
|
||||
23F22D7214398D5C40FA90DBC820328AFC8ABC47319481B25103D4027540B9A8
|
||||
1F1A8AC6A073D174340F5D8096A26BD11AB41E3D80B6A2A7D14BE87574007D8A
|
||||
8E6380D1310E668CD9615C8C87456089581A26C71663E55835568F35631D5837
|
||||
76151BC09E61EF0824028B8013EC085E8410C26C82909047584C5843A825EC23
|
||||
B412BA085709838431C2272293A84FB4257A12F9C478623AB1905846AC26EE21
|
||||
1E219E255E270E135F9348240EC992E44E0A21259032490B496B48DB482DA453
|
||||
A43ED210699C4C26EB906DC9DEE408B280AC209791B7900F904F92FBC9C3E4B7
|
||||
143AC588E24C09A22452A494124A35653FE504A59F324299A0AA51CDA99ED408
|
||||
AA883A9F5A496DA076502F5387A91334759A25CD9B1643CBA42DA3D5D09A6967
|
||||
69F7682FE974BA09DD831E4597D097D26BE807E9E7E983F4770C0D860D83C748
|
||||
6228196B197B19A718B7192F994CA605D39799C85430D7321B9967980F986F55
|
||||
582AF62A7C1591CA12953A9556957E95E7AA545573553FD579AA0B54AB550FAB
|
||||
5E567DA64655B350E3A909D416ABD5A91D55BBA936AECE5277528F50CF515FA3
|
||||
BE5FFD82FA630DB2868546A08648A35463B7C6198D2116C63265F15842D67256
|
||||
03EB2C6B984D625BB2F9EC4C7605FB1B762F7B4C534373AA66AC6691669DE671
|
||||
CD010EC6B1E0F039D99C4ACE21CE0DCE7B2D032D3F2DB1D66AAD66AD7EAD37DA
|
||||
7ADABEDA62ED72ED16EDEBDAEF75709D409D2C9DF53A6D3AF77509BA36BA51BA
|
||||
85BADB75CFEA3ED363EB79E909F5CAF50EE9DDD147F56DF4A3F517EAEFD6EFD1
|
||||
1F373034083690196C313863F0CC9063E86B9869B8D1F084E1A811CB68BA91C4
|
||||
68A3D149A327B826EE8767E33578173E66AC6F1C62AC34DE65DC6B3C61626932
|
||||
DBA4C4A4C5E4BE29CD946B9A66BAD1B4D374CCCCC82CDCACD8ACC9EC8E39D59C
|
||||
6B9E61BED9BCDBFC8D85A5459CC54A8B368BC796DA967CCB05964D96F7AC9856
|
||||
3E567956F556D7AC49D65CEB2CEB6DD6576C501B579B0C9B3A9BCBB6A8AD9BAD
|
||||
C4769B6DDF14E2148F29D229F5536EDA31ECFCEC0AEC9AEC06ED39F661F625F6
|
||||
6DF6CF1DCC1C121DD63B743B7C727475CC766C70BCEBA4E134C3A9C4A9C3E957
|
||||
671B67A1739DF33517A64B90CB1297769717536DA78AA76E9F7ACB95E51AEEBA
|
||||
D2B5D3F5A39BBB9BDCADD96DD4DDCC3DC57DABFB4D2E9B1BC95DC33DEF41F4F0
|
||||
F758E271CCE39DA79BA7C2F390E72F5E765E595EFBBD1E4FB39C269ED6306DC8
|
||||
DBC45BE0BDCB7B603A3E3D65FACEE9033EC63E029F7A9F87BEA6BE22DF3DBE23
|
||||
7ED67E997E07FC9EFB3BFACBFD8FF8BFE179F216F14E056001C101E501BD811A
|
||||
81B3036B031F049904A50735058D05BB062F0C3E15420C090D591F72936FC017
|
||||
F21BF96333DC672C9AD115CA089D155A1BFA30CC264C1ED6118E86CF08DF107E
|
||||
6FA6F94CE9CCB60888E0476C88B81F69199917F97D14292A32AA2EEA51B45374
|
||||
7174F72CD6ACE459FB67BD8EF18FA98CB93BDB6AB6727667AC6A6C526C63EC9B
|
||||
B880B8AAB8817887F845F1971274132409ED89E4C4D8C43D89E37302E76C9A33
|
||||
9CE49A54967463AEE5DCA2B917E6E9CECB9E773C593559907C3885981297B23F
|
||||
E5832042502F184FE5A76E4D1D13F2849B854F45BEA28DA251B1B7B84A3C92E6
|
||||
9D5695F638DD3B7D43FA68864F4675C633094F522B79911992B923F34D5644D6
|
||||
DEACCFD971D92D39949C949CA3520D6996B42BD730B728B74F662B2B930DE479
|
||||
E66DCA1B9387CAF7E423F973F3DB156C854CD1A3B452AE500E164C2FA82B785B
|
||||
185B78B848BD485AD433DF66FEEAF9230B82167CBD90B050B8B0B3D8B87859F1
|
||||
E022BF45BB16238B5317772E315D52BA647869F0D27DCB68CBB296FD50E25852
|
||||
55F26A79DCF28E5283D2A5A5432B82573495A994C9CB6EAEF45AB96315619564
|
||||
55EF6A97D55B567F2A17955FAC70ACA8AEF8B046B8E6E2574E5FD57CF5796DDA
|
||||
DADE4AB7CAEDEB48EBA4EB6EACF759BFAF4ABD6A41D5D086F00DAD1BF18DE51B
|
||||
5F6D4ADE74A17A6AF58ECDB4CDCACD03356135ED5BCCB6ACDBF2A136A3F67A9D
|
||||
7F5DCB56FDADABB7BED926DAD6BFDD777BF30E831D153BDEEF94ECBCB52B7857
|
||||
6BBD457DF56ED2EE82DD8F1A621BBABFE67EDDB847774FC59E8F7BA57B07F645
|
||||
EFEB6A746F6CDCAFBFBFB2096D52368D1E483A70E59B806FDA9BED9A77B5705A
|
||||
2A0EC241E5C127DFA67C7BE350E8A1CEC3DCC3CDDF997FB7F508EB48792BD23A
|
||||
BF75AC2DA36DA03DA1BDEFE88CA39D1D5E1D47BEB7FF7EEF31E36375C7358F57
|
||||
9EA09D283DF1F9E48293E3A764A79E9D4E3F3DD499DC79F74CFC996B5D515DBD
|
||||
6743CF9E3F1774EE4CB75FF7C9F3DEE78F5DF0BC70F422F762DB25B74BAD3DAE
|
||||
3D477E70FDE148AF5B6FEB65F7CBED573CAE74F44DEB3BD1EFD37FFA6AC0D573
|
||||
D7F8D72E5D9F79BDEFC6EC1BB76E26DD1CB825BAF5F876F6ED17770AEE4CDC5D
|
||||
7A8F78AFFCBEDAFDEA07FA0FEA7FB4FEB165C06DE0F860C060CFC3590FEF0E09
|
||||
879EFE94FFD387E1D247CC47D52346238D8F9D1F1F1B0D1ABDF264CE93E1A7B2
|
||||
A713CFCA7E56FF79EB73ABE7DFFDE2FB4BCF58FCD8F00BF98BCFBFAE79A9F372
|
||||
EFABA9AF3AC723C71FBCCE793DF1A6FCADCEDB7DEFB8EFBADFC7BD1F9928FC40
|
||||
FE50F3D1FA63C7A7D04FF73EE77CFEFC2FF784F3FB25D29F33000002FD494441
|
||||
5478DABD966B48536118C79FCDCBCA9645B5C82D2FB3ACD08A1541184444542B
|
||||
43B45148940592657E302B8DFA5064CCC022122A2B0CE94A421442902244F5A1
|
||||
A888440836E82659B32DAD2DD9DA665BCF73E63BCEC6B96D417FF8C39E9DF3BE
|
||||
BFF3BECFF35E54E1701816149940463A7409BA1C6D401BD1D3D076F428FA09BA
|
||||
DBF6B6AF57AE23950C703EFA187A9B5C47E372A1ADE83684071205D6A15BD0E9
|
||||
0A617CD1C83721F49D1220012EA3772501E2CB8DAE4068B71CB01D5DF58F3026
|
||||
9AD695087D2906A4693C27D5835A0D5054E8838C892170BA52E1E3278D1C94F2
|
||||
BA04A15FE281547D1F4024673ADD18D4EC76C246F34F0ECAF4D59106D76ECC80
|
||||
070FA74230A812837622B0221E781DBD43E8ED450B7DD07A6600B4DA90E8305E
|
||||
BC9A04071A73A4A02B10FA9C01697403E894F8B7F45941B8D9F15E12C6D4DEA1
|
||||
832B5775628FEF237033038AE6EED4C94158B3DA230B230D8FA44249D93C0809
|
||||
7F1B155016037661501AFF0615C6A31E5B4CCE7A7AA7C0AD3BD3C1A00FC09106
|
||||
076466FE896953B6A580CBAB88363020158B31FE69F6EC00584F0C46E3DF7E35
|
||||
D4D6E546F374A87E08B65A4662DA5456E583CD3E410CD8C880BF30D02A9A379E
|
||||
848032233CCB8063205030522A5E3E0A2DCD9F41A30947FF23100125D4C680C3
|
||||
10D9FD15C952FE031AEA1D31B9E5E6EB68363C7E3A59AAA99501DF60207B4691
|
||||
E6CEF173CB840FA39C3635EBB98292D11E06BC88418D1220E58C72C757F5BE3C
|
||||
E8EBCF50D27C1903D292E852D262E7F6EF50BBD7198D87BEA541A9A5404953DA
|
||||
4B731990F64F5A1A06252D935413EE34C7F97B693544CE414919F3FC605AEC8D
|
||||
C65E9F5A49EE68EDE423D0CD07D2B2E847174AB5A40A3D7CD091E894EE47582B
|
||||
FD883F0F09F60C2DFAC94900B94D9B054227BE19220524782E2E357961FD3A77
|
||||
34F67852E0C2A59962B0D71039F17D52405231FA1E7A96DC5C49E82EBA920F93
|
||||
029272205244E60441744FA58A3C2DF450EE5E4A5A0591BBCE5A90DEE0E94A78
|
||||
1B7D1E612EB197940099D2C7A182376F84D89574C201FFA7FE020AB95485E854
|
||||
32E90000000049454E44AE426082}
|
||||
ShowHint = False
|
||||
end
|
||||
object m_lblMessage: TLabel
|
||||
Left = 23
|
||||
Top = 34
|
||||
Width = 273
|
||||
Height = 65
|
||||
Alignment = taCenter
|
||||
AutoSize = False
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 12429980
|
||||
Font.Height = -11
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
ParentShowHint = False
|
||||
ShowAccelChar = False
|
||||
ShowHint = False
|
||||
Layout = tlCenter
|
||||
WordWrap = True
|
||||
end
|
||||
object m_btnYes: TTextButton
|
||||
Left = 106
|
||||
Top = 105
|
||||
Width = 52
|
||||
Height = 27
|
||||
ModalResult = mrYes
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
Text = #26159
|
||||
end
|
||||
object m_btnOk: TTextButton
|
||||
Left = 139
|
||||
Top = 105
|
||||
Width = 52
|
||||
Height = 27
|
||||
ModalResult = mrOk
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
Text = #30830#23450
|
||||
end
|
||||
object m_btnNo: TTextButton
|
||||
Left = 169
|
||||
Top = 105
|
||||
Width = 52
|
||||
Height = 27
|
||||
ModalResult = mrNo
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
Text = #21542
|
||||
end
|
||||
object m_btnCancel: TTextButton
|
||||
Left = 187
|
||||
Top = 105
|
||||
Width = 52
|
||||
Height = 27
|
||||
ModalResult = mrCancel
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
Text = #21462#28040
|
||||
end
|
||||
object m_pbCheck: TCKBox
|
||||
Left = 13
|
||||
Top = 109
|
||||
Width = 78
|
||||
Height = 13
|
||||
Caption = #19981#20877#25552#31034
|
||||
Ctl3D = False
|
||||
DoubleBuffered = True
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 12429980
|
||||
Font.Height = -11
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentColor = True
|
||||
ParentCtl3D = False
|
||||
ParentDoubleBuffered = False
|
||||
ParentFont = False
|
||||
TabOrder = 0
|
||||
AutoBox = False
|
||||
BoxColor = 3355443
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,59 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef MessageFormUnitH
|
||||
#define MessageFormUnitH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <System.Classes.hpp>
|
||||
#include <Vcl.Controls.hpp>
|
||||
#include <Vcl.StdCtrls.hpp>
|
||||
#include <Vcl.Forms.hpp>
|
||||
#include <Vcl.ExtCtrls.hpp>
|
||||
#include <Vcl.Imaging.pngimage.hpp>
|
||||
#include "PNGButton.hpp"
|
||||
#include <Vcl.Imaging.jpeg.hpp>
|
||||
#include <Vcl.Graphics.hpp>
|
||||
#include "CKBox.h"
|
||||
#include "GeneralDialogPanel.h"
|
||||
#include "TextButton.h"
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#define MB_CHECKED 0x100
|
||||
#define MB_UNCHECKED 0x200
|
||||
|
||||
class TMessageForm : public TForm
|
||||
{
|
||||
__published: // IDE-managed Components
|
||||
TImage *m_iconError;
|
||||
TImage *m_iconInformation;
|
||||
TImage *m_iconQuestion;
|
||||
TLabel *m_lblMessage;
|
||||
TCKBox *m_pbCheck;
|
||||
TGeneralDialogPanel *m_panGeneral;
|
||||
TTextButton *m_btnYes;
|
||||
TTextButton *m_btnOk;
|
||||
TTextButton *m_btnNo;
|
||||
TTextButton *m_btnCancel;
|
||||
void __fastcall FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift);
|
||||
void __fastcall FormCreate(TObject *Sender);
|
||||
|
||||
private: // User declarations
|
||||
int m_iCheck;
|
||||
|
||||
void __fastcall WMNCHitTest(TWMNCHitTest &Msg);
|
||||
|
||||
BEGIN_MESSAGE_MAP
|
||||
MESSAGE_HANDLER(WM_NCHITTEST, TWMNCHitTest, WMNCHitTest)
|
||||
END_MESSAGE_MAP(TForm)
|
||||
public: // User declarations
|
||||
__fastcall TMessageForm(TComponent* Owner);
|
||||
__fastcall ~TMessageForm();
|
||||
|
||||
void _fastcall SetCheckMessage( String strMessage );
|
||||
bool GetCheckState();
|
||||
int __fastcall ShowMessage( const String AMessage, int AType=MB_ICONINFORMATION|MB_OK, const String ATitle = "" );
|
||||
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
extern PACKAGE TMessageForm *MessageForm;
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
@@ -0,0 +1,918 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "MicSetFormUnit.h"
|
||||
#include "Instruments.h"
|
||||
#include "MessageFormUnit.h"
|
||||
|
||||
#define IO_DEVICE_WASAPI 0x10000
|
||||
#define IO_DEVICE_ASIO 0x20000
|
||||
#define IO_DEVICE_MIDI 0x40000
|
||||
#define DEVICE_DEFAULT 0x02
|
||||
#define REC_INPUT_OFF 0x10000
|
||||
|
||||
// source info structure
|
||||
typedef struct {
|
||||
char name[256];
|
||||
DWORD flags;
|
||||
} IO_CHANNEL_INFO;
|
||||
|
||||
#define CLR_TEXT_HOT RGB( 201, 214, 229 )
|
||||
#define CLR_TEXT_NOR RGB( 156, 170, 189 )
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
#pragma link "GeneralDialogPanel"
|
||||
#pragma link "TextButton"
|
||||
#pragma link "CKBox"
|
||||
#pragma resource "*.dfm"
|
||||
TMicSetForm *MicSetForm;
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TMicSetForm::TMicSetForm(TComponent* Owner)
|
||||
: TForm(Owner)
|
||||
{
|
||||
//加载图片
|
||||
Font->Color = RGB(60,43,23);
|
||||
m_iCurrPlaybackDevice = m_iCurrRecordDevice = -1;
|
||||
m_iCurrOutput = m_iCurrInput = -1;
|
||||
|
||||
m_PopupMenu = NULL;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TMicSetForm::FormCreate(TObject *Sender)
|
||||
{
|
||||
SetTransparent( this );
|
||||
|
||||
m_panGeneral->Font->Size = g_szFont9;
|
||||
|
||||
m_cbPlayDev->SetFontSize(g_szFont9);
|
||||
m_cbOutput->SetFontSize(g_szFont9);
|
||||
m_cbRecDev->SetFontSize(g_szFont9);
|
||||
m_cbInput->SetFontSize(g_szFont9);
|
||||
m_ckAuto->Font->Size = g_szFont9;
|
||||
m_ckMoniter->Font->Size = g_szFont9;
|
||||
m_rbCommon->Font->Size = g_szFont9;
|
||||
m_rbASIO->Font->Size = g_szFont8;
|
||||
m_rbWASAPI->Font->Size = g_szFont8;
|
||||
m_ckMIDI->Font->Size = g_szFont8;
|
||||
|
||||
m_btnOk->FontSize = g_szFont9;
|
||||
m_btnCanel->FontSize = g_szFont9;
|
||||
|
||||
//字体以及字体颜色修改
|
||||
m_lblVolume->Font->Color = CLR_TEXT_NOR;
|
||||
m_lblPlayback->Font->Color = CLR_TEXT_NOR;
|
||||
m_lblOutput->Font->Color = CLR_TEXT_NOR;
|
||||
m_lblRecord->Font->Color = CLR_TEXT_NOR;
|
||||
m_lblInput->Font->Color = CLR_TEXT_NOR;
|
||||
m_lblLatencyTime->Font->Color = CLR_TEXT_NOR;
|
||||
m_lblHint->Font->Color = CLR_TEXT_NOR;
|
||||
m_lblHintMsg->Font->Color = CLR_TEXT_NOR;
|
||||
m_lblLatency->Font->Color = CLR_TEXT_NOR;
|
||||
m_lblType->Font->Color = CLR_TEXT_NOR;
|
||||
|
||||
//-------------------------------选中状态判断
|
||||
m_ckAuto->Checked = g_bRecordAutoAdjust;
|
||||
m_ckMoniter->Checked = g_bRecordMoniter;
|
||||
|
||||
m_iCurrPlaybackDevice = g_iPlaybackDevice;
|
||||
m_iCurrOutput = g_iPlaybackOutput;
|
||||
m_iCurrRecordDevice = g_iRecordDevice;
|
||||
m_iCurrInput = g_iRecordInput;
|
||||
|
||||
IO_DEVICE_INFO aPbDevs[20], //播放设备
|
||||
aRcDevs[20]; //录音设备
|
||||
|
||||
int nPbDev = f_MM_GetPlaybackDeviceInfo( 20, aPbDevs );
|
||||
int nRcDev = f_MM_GetRecordDeviceInfo( 20, aRcDevs );
|
||||
|
||||
for( int i=0; i<nPbDev; i++ ){
|
||||
IO_DEVICE_INFO * pDev = new IO_DEVICE_INFO(aPbDevs[i]);
|
||||
|
||||
if( pDev->iDevice & IO_DEVICE_WASAPI )
|
||||
m_aWasapiPb.push_back( pDev );
|
||||
else if( pDev->iDevice & IO_DEVICE_ASIO )
|
||||
m_aAsioPb.push_back( pDev );
|
||||
else
|
||||
m_aCommonPb.push_back( pDev );
|
||||
}
|
||||
|
||||
for( int i=0; i<nRcDev; i++ ){
|
||||
IO_DEVICE_INFO * pDev = new IO_DEVICE_INFO(aRcDevs[i]);
|
||||
|
||||
if( pDev->iDevice & IO_DEVICE_WASAPI )
|
||||
m_aWasapiRc.push_back( pDev );
|
||||
else if( pDev->iDevice & IO_DEVICE_MIDI )
|
||||
m_aMidiRc.push_back( pDev );
|
||||
else
|
||||
m_aCommonRc.push_back( pDev );
|
||||
}
|
||||
|
||||
m_rbCommon->Enabled = !m_aCommonPb.empty();
|
||||
m_rbASIO->Enabled = !m_aAsioPb.empty();
|
||||
m_rbWASAPI->Enabled = !m_aWasapiPb.empty();
|
||||
m_ckMIDI->Enabled = !m_aMidiRc.empty();
|
||||
|
||||
int iType = m_iCurrPlaybackDevice>=0 ? (m_iCurrPlaybackDevice & 0xF0000) : -1;
|
||||
|
||||
if( m_iCurrPlaybackDevice<0 && !m_aCommonPb.empty()
|
||||
|| m_iCurrRecordDevice<0 && ( iType==0 && !m_aCommonRc.empty()
|
||||
|| iType==IO_DEVICE_WASAPI && !m_aWasapiRc.empty() ) ){
|
||||
f_MM_SetIODevice( m_iCurrPlaybackDevice, m_iCurrOutput,
|
||||
m_iCurrRecordDevice, m_iCurrInput );
|
||||
}
|
||||
|
||||
if( iType<0 )
|
||||
iType = m_iCurrPlaybackDevice>=0 ? (m_iCurrPlaybackDevice & 0xF0000) : -1;
|
||||
|
||||
m_rbCommon->Checked = iType==0;
|
||||
m_rbASIO->Checked = iType==IO_DEVICE_ASIO;
|
||||
m_rbWASAPI->Checked = iType==IO_DEVICE_WASAPI;
|
||||
m_ckMIDI->Checked = m_iCurrRecordDevice>=0 && (m_iCurrRecordDevice & IO_DEVICE_MIDI);
|
||||
|
||||
ReloadPlayDev();
|
||||
ReloadOutput();
|
||||
|
||||
ReloadRecDev();
|
||||
ReloadInput();
|
||||
|
||||
m_pTimerLatency = new TTimer(this);
|
||||
m_pTimerLatency->Enabled = false;
|
||||
m_pTimerLatency->Interval = 250;
|
||||
m_pTimerLatency->OnTimer = LatencyTimerProc;
|
||||
|
||||
m_tbVolume->Position = g_fRecordVolume * 100;
|
||||
m_tbVolume->Hint = IntToStr(m_tbVolume->Position);
|
||||
|
||||
if( m_iCurrPlaybackDevice>=0 && m_iCurrRecordDevice>=0 )
|
||||
BeginRecordTest();
|
||||
else
|
||||
m_tbVolume->Enabled = false;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TMicSetForm::FormClose(TObject *Sender, TCloseAction &Action)
|
||||
{
|
||||
BeginRecordTest( false );
|
||||
|
||||
if( m_pTimerLatency ){
|
||||
delete m_pTimerLatency;
|
||||
m_pTimerLatency = NULL;
|
||||
}
|
||||
/* if( m_PopupMenu ){
|
||||
delete m_PopupMenu;
|
||||
m_PopupMenu = NULL;
|
||||
}
|
||||
*/
|
||||
while( !m_aCommonPb.empty() ){
|
||||
delete m_aCommonPb.back();
|
||||
m_aCommonPb.pop_back();
|
||||
}
|
||||
while( !m_aCommonRc.empty() ){
|
||||
delete m_aCommonRc.back();
|
||||
m_aCommonRc.pop_back();
|
||||
}
|
||||
while( !m_aWasapiPb.empty() ){
|
||||
delete m_aWasapiPb.back();
|
||||
m_aWasapiPb.pop_back();
|
||||
}
|
||||
while( !m_aWasapiRc.empty() ){
|
||||
delete m_aWasapiRc.back();
|
||||
m_aWasapiRc.pop_back();
|
||||
}
|
||||
while( !m_aAsioPb.empty() ){
|
||||
delete m_aAsioPb.back();
|
||||
m_aAsioPb.pop_back();
|
||||
}
|
||||
while( !m_aMidiRc.empty() ){
|
||||
delete m_aMidiRc.back();
|
||||
m_aMidiRc.pop_back();
|
||||
}
|
||||
|
||||
if( ModalResult!=mrOk ){
|
||||
if( !(g_iPlaybackDevice==m_iCurrPlaybackDevice
|
||||
&& g_iRecordDevice==m_iCurrRecordDevice
|
||||
&& g_iPlaybackOutput==m_iCurrOutput
|
||||
&& g_iRecordInput==m_iCurrInput) ){
|
||||
f_MM_SetIODevice( g_iPlaybackDevice, g_iPlaybackOutput,
|
||||
g_iRecordDevice, g_iRecordInput );
|
||||
}
|
||||
|
||||
if( g_bRecordAutoAdjust!=m_ckAuto->Checked )
|
||||
f_MM_SetRecordAutoAdjust( g_bRecordAutoAdjust );
|
||||
if( g_bRecordMoniter!=m_ckMoniter->Checked )
|
||||
f_MM_SetRecordMoniter( g_bRecordMoniter );
|
||||
f_MM_SetStreamVolume( 1, g_fRecordVolume );
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void TMicSetForm::ReloadPlayDev()
|
||||
{
|
||||
m_cbPlayDev->Clear();
|
||||
|
||||
int iDevice = -1;
|
||||
|
||||
if( m_iCurrPlaybackDevice>=0 ){
|
||||
int iType = m_iCurrPlaybackDevice & 0xF0000;
|
||||
vector<IO_DEVICE_INFO*>& rDevs = iType==IO_DEVICE_WASAPI ? m_aWasapiPb
|
||||
: iType==IO_DEVICE_ASIO ? m_aAsioPb
|
||||
: m_aCommonPb;
|
||||
for( int i=0; i<rDevs.size(); i++ ){
|
||||
if( rDevs[i]->iDevice==m_iCurrPlaybackDevice )
|
||||
iDevice = m_cbPlayDev->ItemsCount;
|
||||
|
||||
if( iType==0 && !stricmp( rDevs[i]->name, "Default" ))
|
||||
m_cbPlayDev->AddItem( "系统默认设备" )->Tag = rDevs[i]->iDevice;
|
||||
else
|
||||
m_cbPlayDev->AddItem( rDevs[i]->name )->Tag = rDevs[i]->iDevice;
|
||||
}
|
||||
}
|
||||
|
||||
m_cbPlayDev->DefItemIndex = iDevice;
|
||||
m_cbPlayDev->Enabled = m_cbPlayDev->ItemsCount>0;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void TMicSetForm::ReloadRecDev()
|
||||
{
|
||||
m_cbRecDev->Clear();
|
||||
|
||||
int iDevice = -1;
|
||||
if( m_iCurrRecordDevice>=0 ){
|
||||
int iType = m_iCurrRecordDevice & 0xF0000;
|
||||
|
||||
if( iType==IO_DEVICE_ASIO ){
|
||||
for( int i=0; i<m_aAsioPb.size(); i++ ){
|
||||
if( m_aAsioPb[i]->iDevice==m_iCurrRecordDevice ){
|
||||
m_cbRecDev->AddItem( m_aAsioPb[i]->name )->Tag = m_aAsioPb[i]->iDevice;
|
||||
break;
|
||||
}
|
||||
}
|
||||
iDevice = 0;
|
||||
}
|
||||
else{
|
||||
vector<IO_DEVICE_INFO*>& rDevs = iType==IO_DEVICE_WASAPI ? m_aWasapiRc
|
||||
: iType==IO_DEVICE_MIDI ? m_aMidiRc
|
||||
: m_aCommonRc;
|
||||
for( int i=0; i<rDevs.size(); i++ ){
|
||||
if( rDevs[i]->iDevice==m_iCurrRecordDevice )
|
||||
iDevice = m_cbRecDev->ItemsCount;
|
||||
|
||||
if( iType==0 && !strcmp( rDevs[i]->name, "Default" ))
|
||||
m_cbRecDev->AddItem( "系统默认设备" )->Tag = rDevs[i]->iDevice;
|
||||
else
|
||||
m_cbRecDev->AddItem( rDevs[i]->name )->Tag = rDevs[i]->iDevice;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_cbRecDev->DefItemIndex = iDevice;
|
||||
m_cbRecDev->Enabled = m_cbRecDev->ItemsCount>0;
|
||||
if( !m_cbRecDev->Enabled )
|
||||
m_cbRecDev->Caption = "";
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void TMicSetForm::ReloadOutput()
|
||||
{
|
||||
m_cbOutput->Clear();
|
||||
|
||||
int iType = m_iCurrPlaybackDevice & 0xF0000;
|
||||
|
||||
if( iType==IO_DEVICE_ASIO ){
|
||||
m_lblASIO->Visible = true;
|
||||
|
||||
IO_CHANNEL_INFO chanInfo[20];
|
||||
int nSize = f_MM_GetPlaybackOutputInfo( 20, chanInfo );
|
||||
int iChannel = -1;
|
||||
|
||||
if( m_iCurrOutput>=0 && m_iCurrOutput<nSize)
|
||||
iChannel = m_iCurrOutput;
|
||||
else if( nSize>0 )
|
||||
iChannel = 0;
|
||||
|
||||
for( int i=0; i<nSize; i+=2 ){
|
||||
m_cbOutput->AddItem( chanInfo[i].name );
|
||||
}
|
||||
|
||||
if( iChannel>=0 )
|
||||
m_cbOutput->DefItemIndex = iChannel/2;
|
||||
|
||||
m_lblASIO->Enabled = iChannel>=0;
|
||||
m_iCurrOutput = iChannel;
|
||||
}
|
||||
else{
|
||||
m_lblASIO->Visible = false;
|
||||
|
||||
m_cbOutput->AddItem( "默认输出" );
|
||||
m_cbOutput->DefItemIndex = 0;
|
||||
}
|
||||
|
||||
m_cbOutput->Enabled = m_cbOutput->ItemsCount>0;
|
||||
if( !m_cbOutput->Enabled )
|
||||
m_cbOutput->Caption = "";
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void TMicSetForm::ReloadInput()
|
||||
{
|
||||
m_cbInput->Clear();
|
||||
|
||||
bool bMidi = m_iCurrRecordDevice>=0 && (m_iCurrRecordDevice & IO_DEVICE_MIDI);
|
||||
m_ckAuto->Visible = !bMidi;
|
||||
m_ckMoniter->Visible = !bMidi;
|
||||
|
||||
if( bMidi ){
|
||||
// m_lblLatency->Top = m_lblVolume->Top;
|
||||
// m_lblLatencyTime->Top = m_lblVolume->Top;
|
||||
// m_lblVolume->Caption = "缓冲时间:";
|
||||
m_lblInput->Caption = "乐器音色:";
|
||||
|
||||
for( int i=0; i<112; i++ ){
|
||||
m_cbInput->AddItem( GM_INSTRUMENT[i] );
|
||||
}
|
||||
|
||||
m_cbInput->DefItemIndex = m_iCurrInput;
|
||||
}
|
||||
else{
|
||||
// m_lblLatency->Top = m_lblInput->Top;
|
||||
// m_lblLatencyTime->Top = m_lblInput->Top;
|
||||
// m_lblVolume->Caption = "录音音量:";
|
||||
m_lblInput->Caption = "录音输入:";
|
||||
|
||||
int iChannel = -1;
|
||||
if( m_cbRecDev->DefItemIndex>=0 ){
|
||||
IO_CHANNEL_INFO chanInfo[20];
|
||||
int nSize = f_MM_GetRecordInputInfo( 20, chanInfo );
|
||||
|
||||
if( m_iCurrInput>=0 && m_iCurrInput<nSize){
|
||||
iChannel = m_iCurrInput;
|
||||
}
|
||||
|
||||
if( nSize>0 ){
|
||||
for( int i=0; i<nSize; i++ ){
|
||||
m_cbInput->AddItem( chanInfo[i].name );
|
||||
if( iChannel<0 ){
|
||||
iChannel = i;
|
||||
}
|
||||
}
|
||||
|
||||
if( iChannel<0 ){
|
||||
iChannel = 0;
|
||||
}
|
||||
|
||||
m_cbInput->DefItemIndex = iChannel;
|
||||
}
|
||||
else if( (m_iCurrPlaybackDevice & 0xF0000)!=IO_DEVICE_ASIO ){
|
||||
m_cbInput->AddItem( "默认输入" );
|
||||
m_cbInput->DefItemIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
m_iCurrInput = iChannel;
|
||||
}
|
||||
|
||||
m_cbInput->Enabled = m_cbInput->ItemsCount>0;
|
||||
m_tbVolume->Enabled = m_cbInput->ItemsCount>0;
|
||||
if( !m_cbInput->Enabled )
|
||||
m_cbInput->Caption = "";
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TMicSetForm::FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift)
|
||||
|
||||
{
|
||||
switch( Key ){
|
||||
case VK_RETURN:
|
||||
case ' ':
|
||||
if( m_btnOk->Visible ){
|
||||
OkClick( NULL );
|
||||
ModalResult = mrOk;
|
||||
}
|
||||
break;
|
||||
|
||||
case VK_ESCAPE:
|
||||
if( m_btnCanel->Visible ){
|
||||
ModalResult = mrCancel;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TMicSetForm::VolumeChange(TObject *Sender)
|
||||
{
|
||||
if( m_iCurrRecordDevice<0 )
|
||||
return;
|
||||
|
||||
int nPos = m_tbVolume->Position;
|
||||
m_tbVolume->Hint = IntToStr(nPos);
|
||||
|
||||
/* if( m_iCurrRecordDevice & IO_DEVICE_MIDI ){
|
||||
f_MM_SetMidiInBuffer( nPos );
|
||||
}
|
||||
else{
|
||||
*/ if( m_ckAuto->Visible && m_ckAuto->Checked ){
|
||||
m_ckAuto->Checked = false;
|
||||
f_MM_SetRecordAutoAdjust( m_ckAuto->Checked );
|
||||
}
|
||||
|
||||
f_MM_SetStreamVolume( 1, nPos/100.0 );
|
||||
// }
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TMicSetForm::LatencyTimerProc(TObject* Sender)
|
||||
{
|
||||
float fLatency = f_MM_GetLatency( true );
|
||||
char str[16];
|
||||
sprintf( str, "%.1f ms", fLatency );
|
||||
m_lblLatencyTime->Caption = str;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void TMicSetForm::BeginRecordTest(bool bStart)
|
||||
{
|
||||
if( bStart ){
|
||||
HRESULT hr = f_MM_RecordTest( Handle );
|
||||
if( hr==S_OK ){
|
||||
if( m_ckAuto->Checked ){
|
||||
m_tbVolume->OnChange = NULL;
|
||||
m_tbVolume->Position = 100;
|
||||
m_tbVolume->Hint = IntToStr(100);
|
||||
|
||||
f_MM_SetStreamVolume( 1, 1 );
|
||||
}
|
||||
|
||||
m_tbVolume->Enabled = true;
|
||||
m_tbVolume->OnChange = VolumeChange;
|
||||
m_pTimerLatency->Enabled = true;
|
||||
m_lblLatencyTime->Caption = "0.0 ms";
|
||||
}
|
||||
else{
|
||||
m_pTimerLatency->Enabled = false;
|
||||
m_tbVolume->Enabled = false;
|
||||
m_lblLatencyTime->Caption = "---- ms";
|
||||
|
||||
ShowErrorMessage( hr );
|
||||
}
|
||||
}
|
||||
else{
|
||||
m_pTimerLatency->Enabled = false;
|
||||
f_MM_Stop();
|
||||
m_tbVolume->Enabled = false;
|
||||
m_lblLatencyTime->Caption = "---- ms";
|
||||
}
|
||||
}
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
void TMicSetForm::ShowErrorMessage( int errcode )
|
||||
{
|
||||
String msg;
|
||||
|
||||
int errRec = LOWORD( errcode ),
|
||||
errPlay = HIWORD( errcode ),
|
||||
err = errRec>0 ? errRec : errPlay;
|
||||
|
||||
if( err==1 ){
|
||||
msg += L"内存空间不足。";
|
||||
}
|
||||
else{
|
||||
if(errRec>1 && m_cbInput->ItemsCount>0)
|
||||
msg += "输入";
|
||||
if(errPlay>1 && m_cbOutput->ItemsCount>0)
|
||||
msg += "输出";
|
||||
}
|
||||
|
||||
if( msg.Length()==0 )
|
||||
return;
|
||||
|
||||
if( err==46 ){
|
||||
msg += L"设备被其它程序独占。";
|
||||
}
|
||||
else if( err==37 ){
|
||||
msg += L"设备无法打开。";
|
||||
}
|
||||
else if( err==3 || err==23 ){
|
||||
msg += L"设备无效。";
|
||||
}
|
||||
else{
|
||||
msg += L"设备启动失败。";
|
||||
}
|
||||
|
||||
MessageForm->ShowMessage( msg, MB_ICONERROR | MB_OK );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TMicSetForm::OkClick(TObject *Sender)
|
||||
{
|
||||
g_iPlaybackDevice = m_iCurrPlaybackDevice;
|
||||
g_iRecordDevice = m_iCurrRecordDevice;
|
||||
g_iPlaybackOutput = m_iCurrOutput;
|
||||
g_iRecordInput = m_iCurrInput;
|
||||
|
||||
if( m_iCurrPlaybackDevice>=0 ){
|
||||
int iType = m_iCurrPlaybackDevice & 0xF0000;
|
||||
vector<IO_DEVICE_INFO*>& rDevsPb = iType==IO_DEVICE_WASAPI ? m_aWasapiPb
|
||||
: iType==IO_DEVICE_ASIO ? m_aAsioPb
|
||||
: m_aCommonPb;
|
||||
for( int i=0; i<rDevsPb.size(); i++ ){
|
||||
if( rDevsPb[i]->iDevice==m_iCurrPlaybackDevice ){
|
||||
strcpy( g_strPlaybackDevice, rDevsPb[i]->name );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( m_iCurrRecordDevice>=0 ){
|
||||
int iType = m_iCurrRecordDevice & 0xF0000;
|
||||
if( iType==IO_DEVICE_ASIO ){
|
||||
strcpy( g_strRecordDevice, g_strPlaybackDevice );
|
||||
}
|
||||
else{
|
||||
vector<IO_DEVICE_INFO*>& rDevsRc = iType==IO_DEVICE_WASAPI ? m_aWasapiRc
|
||||
: iType==IO_DEVICE_MIDI ? m_aMidiRc
|
||||
: m_aCommonRc;
|
||||
|
||||
for( int i=0; i<rDevsRc.size(); i++ ){
|
||||
if( rDevsRc[i]->iDevice==m_iCurrRecordDevice ){
|
||||
strcpy( g_strRecordDevice, rDevsRc[i]->name );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//保存所有状态
|
||||
g_fRecordVolume = m_tbVolume->Position / 100.0;
|
||||
// g_fRecordVolume = f_MM_GetStreamVolume( 1 ) / 100.0;
|
||||
g_bRecordAutoAdjust = m_ckAuto->Checked;
|
||||
g_bRecordMoniter = !(m_iCurrRecordDevice&IO_DEVICE_MIDI) && m_ckMoniter->Checked;
|
||||
f_MM_SetRecordMoniter( g_bRecordMoniter );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TMicSetForm::UMRecordVolJust(TMessage &Message)
|
||||
{
|
||||
m_tbVolume->OnChange = NULL;
|
||||
m_tbVolume->Position = (int)Message.WParam;
|
||||
m_tbVolume->Hint = IntToStr((int)Message.WParam);
|
||||
m_tbVolume->OnChange = VolumeChange;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TMicSetForm::AutoChange(TObject *Sender)
|
||||
{
|
||||
f_MM_SetRecordAutoAdjust( m_ckAuto->Checked );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TMicSetForm::MoniterChange(TObject *Sender)
|
||||
{
|
||||
f_MM_SetRecordMoniter( m_ckMoniter->Checked );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TMicSetForm::PlayDevChange(TComboBoxItem *Sender, int Index)
|
||||
{
|
||||
int iNewDev = m_cbPlayDev->GetItem(Index)->Tag;
|
||||
if( iNewDev==m_iCurrPlaybackDevice )
|
||||
return;
|
||||
|
||||
BeginRecordTest( false );
|
||||
|
||||
int iType = (m_iCurrPlaybackDevice & 0xF0000);
|
||||
int iPlayDev = iNewDev, iOutput = -1,
|
||||
iRecDev = m_iCurrRecordDevice,
|
||||
iInput = m_iCurrInput;
|
||||
|
||||
if( !m_ckMIDI->Checked && iType==IO_DEVICE_ASIO ){
|
||||
iRecDev = iNewDev;
|
||||
iInput = -1;
|
||||
}
|
||||
|
||||
Screen->Cursor = crHourGlass;
|
||||
|
||||
HRESULT hr = f_MM_SetIODevice( iPlayDev, iOutput, iRecDev, iInput );
|
||||
|
||||
m_iCurrPlaybackDevice = iPlayDev;
|
||||
m_iCurrOutput = iOutput;
|
||||
m_iCurrRecordDevice = iRecDev;
|
||||
m_iCurrInput = iInput;
|
||||
|
||||
if( iType==IO_DEVICE_ASIO ){
|
||||
ReloadOutput();
|
||||
|
||||
if( !m_ckMIDI->Checked ){
|
||||
ReloadRecDev();
|
||||
ReloadInput();
|
||||
}
|
||||
}
|
||||
|
||||
if( hr==S_OK ){
|
||||
if( m_iCurrRecordDevice>=0 )
|
||||
BeginRecordTest();
|
||||
}
|
||||
else
|
||||
ShowErrorMessage( hr );
|
||||
|
||||
m_tbVolume->Enabled = hr==S_OK;
|
||||
Screen->Cursor = crDefault;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TMicSetForm::RecDevChange(TComboBoxItem *Sender, int Index)
|
||||
{
|
||||
int iNewDev = m_cbRecDev->GetItem(Index)->Tag;
|
||||
if( iNewDev==m_iCurrRecordDevice )
|
||||
return;
|
||||
|
||||
BeginRecordTest( false );
|
||||
|
||||
int iPlayDev = m_iCurrPlaybackDevice,
|
||||
iOutput = m_iCurrOutput,
|
||||
iRecDev = iNewDev,
|
||||
iInput = (iNewDev & IO_DEVICE_MIDI) ? 0 : -1;
|
||||
|
||||
Screen->Cursor = crHourGlass;
|
||||
|
||||
HRESULT hr = f_MM_SetIODevice( iPlayDev, iOutput, iRecDev, iInput );
|
||||
|
||||
m_iCurrPlaybackDevice = iPlayDev;
|
||||
m_iCurrOutput = iOutput;
|
||||
m_iCurrRecordDevice = iRecDev;
|
||||
m_iCurrInput = iInput;
|
||||
|
||||
ReloadInput();
|
||||
|
||||
if( hr==S_OK ){
|
||||
if( m_iCurrRecordDevice>=0 )
|
||||
BeginRecordTest();
|
||||
}
|
||||
else{
|
||||
ShowErrorMessage( hr );
|
||||
}
|
||||
|
||||
m_tbVolume->Enabled = hr==S_OK;
|
||||
Screen->Cursor = crDefault;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TMicSetForm::OutputChange(TComboBoxItem *Sender, int Index)
|
||||
{
|
||||
if( !m_rbASIO->Checked )
|
||||
return;
|
||||
|
||||
int iIndex = Index * 2;
|
||||
|
||||
if( iIndex==m_iCurrOutput )
|
||||
return;
|
||||
|
||||
BeginRecordTest( false );
|
||||
|
||||
int iPlayDev = m_iCurrPlaybackDevice,
|
||||
iOutput = iIndex,
|
||||
iRecDev = m_iCurrRecordDevice,
|
||||
iInput = m_iCurrInput;
|
||||
|
||||
Screen->Cursor = crHourGlass;
|
||||
|
||||
HRESULT hr = f_MM_SetIODevice( iPlayDev, iOutput, iRecDev, iInput );
|
||||
|
||||
m_iCurrPlaybackDevice = iPlayDev;
|
||||
m_iCurrOutput = iOutput;
|
||||
m_iCurrRecordDevice = iRecDev;
|
||||
m_iCurrInput = iInput;
|
||||
|
||||
if( hr==S_OK ){
|
||||
if( m_iCurrRecordDevice>=0 )
|
||||
BeginRecordTest();
|
||||
}
|
||||
else{
|
||||
ShowErrorMessage( hr );
|
||||
}
|
||||
|
||||
m_tbVolume->Enabled = hr==S_OK;
|
||||
Screen->Cursor = crDefault;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TMicSetForm::InputChange(TComboBoxItem *Sender, int Index)
|
||||
{
|
||||
if( m_rbWASAPI->Checked && !m_ckMIDI->Checked )
|
||||
return;
|
||||
|
||||
int iInput = m_cbInput->DefItemIndex;
|
||||
if( iInput==m_iCurrInput )
|
||||
return;
|
||||
|
||||
BeginRecordTest( false );
|
||||
|
||||
int iPlayDev = m_iCurrPlaybackDevice,
|
||||
iOutput = m_iCurrOutput,
|
||||
iRecDev = m_iCurrRecordDevice;
|
||||
|
||||
Screen->Cursor = crHourGlass;
|
||||
|
||||
HRESULT hr = f_MM_SetIODevice( iPlayDev, iOutput, iRecDev, iInput );
|
||||
|
||||
m_iCurrInput = iInput;
|
||||
|
||||
if( hr==S_OK )
|
||||
BeginRecordTest();
|
||||
else{
|
||||
ShowErrorMessage( hr );
|
||||
}
|
||||
|
||||
m_tbVolume->Enabled = hr==S_OK;
|
||||
Screen->Cursor = crDefault;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TMicSetForm::DoShowPanel(TObject* Sender)
|
||||
{
|
||||
if( m_iCurrPlaybackDevice & IO_DEVICE_ASIO )
|
||||
f_MM_ShowAsioPanel();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TMicSetForm::DoRestart(TObject* Sender)
|
||||
{
|
||||
if( m_iCurrPlaybackDevice & IO_DEVICE_ASIO ){
|
||||
if( f_MM_RestartAsioDevice()==S_OK ){
|
||||
ReloadOutput();
|
||||
ReloadInput();
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TMicSetForm::MIDIInputClick(TObject *Sender)
|
||||
{
|
||||
bool bMidi = m_iCurrRecordDevice>0 && (m_iCurrRecordDevice & IO_DEVICE_MIDI);
|
||||
if( bMidi==m_ckMIDI->Checked )
|
||||
return;
|
||||
|
||||
BeginRecordTest( false );
|
||||
|
||||
int iPlayDev = m_iCurrPlaybackDevice,
|
||||
iOutput = m_iCurrOutput,
|
||||
iRecDev = -1,
|
||||
iInput = -1;
|
||||
|
||||
if( m_ckMIDI->Checked ){
|
||||
iRecDev = m_aMidiRc[0]->iDevice;
|
||||
iInput = 0;
|
||||
}
|
||||
else{
|
||||
int iPbType = m_iCurrPlaybackDevice & 0xF0000;
|
||||
|
||||
if( iPbType==IO_DEVICE_ASIO ){
|
||||
iRecDev = iPlayDev;
|
||||
}
|
||||
else{
|
||||
vector<IO_DEVICE_INFO*>& rDevsRc = iPbType==IO_DEVICE_WASAPI ? m_aWasapiRc
|
||||
: m_aCommonRc;
|
||||
|
||||
if( rDevsRc.empty() ){
|
||||
iRecDev = iPbType;
|
||||
}
|
||||
else{
|
||||
for( int i=0; i<rDevsRc.size(); i++ ){
|
||||
if( rDevsRc[i]->flags & DEVICE_DEFAULT ){
|
||||
iRecDev = rDevsRc[i]->iDevice;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Screen->Cursor = crHourGlass;
|
||||
|
||||
HRESULT hr = f_MM_SetIODevice( iPlayDev, iOutput, iRecDev, iInput );
|
||||
|
||||
m_iCurrPlaybackDevice = iPlayDev;
|
||||
m_iCurrOutput = iOutput;
|
||||
m_iCurrRecordDevice = iRecDev;
|
||||
m_iCurrInput = iInput;
|
||||
|
||||
ReloadRecDev();
|
||||
ReloadInput();
|
||||
|
||||
if( hr==S_OK ){
|
||||
if( m_iCurrRecordDevice>=0 )
|
||||
BeginRecordTest();
|
||||
}
|
||||
else{
|
||||
ShowErrorMessage( hr );
|
||||
}
|
||||
|
||||
Screen->Cursor = crDefault;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TMicSetForm::DevTypeClick(TObject *Sender)
|
||||
{
|
||||
int iTypeOld = m_iCurrPlaybackDevice & 0xF0000;
|
||||
int iType = m_rbASIO->Checked ? IO_DEVICE_ASIO
|
||||
: m_rbWASAPI->Checked ? IO_DEVICE_WASAPI
|
||||
: 0;
|
||||
|
||||
if( iType==iTypeOld )
|
||||
return;
|
||||
|
||||
BeginRecordTest( false );
|
||||
|
||||
int iPlayDev = -1, iOutput = -1,
|
||||
iRecDev = -1, iInput = -1;
|
||||
|
||||
if( m_ckMIDI->Checked ){
|
||||
iRecDev = m_iCurrRecordDevice;
|
||||
iInput = m_iCurrInput;
|
||||
}
|
||||
|
||||
if( iType==IO_DEVICE_ASIO ){
|
||||
iPlayDev = m_aAsioPb[0]->iDevice;
|
||||
|
||||
if( iRecDev<0 )
|
||||
iRecDev = iPlayDev;
|
||||
}
|
||||
else{
|
||||
vector<IO_DEVICE_INFO*>& rDevsPb = iType==IO_DEVICE_WASAPI ? m_aWasapiPb
|
||||
: iType==IO_DEVICE_ASIO ? m_aAsioPb
|
||||
: m_aCommonPb;
|
||||
for( int i=0; i<rDevsPb.size(); i++ ){
|
||||
if( rDevsPb[i]->flags & DEVICE_DEFAULT ){
|
||||
iPlayDev = rDevsPb[i]->iDevice;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( iRecDev<0 ){
|
||||
vector<IO_DEVICE_INFO*>& rDevsRc = iType==IO_DEVICE_WASAPI ? m_aWasapiRc
|
||||
: m_aCommonRc;
|
||||
|
||||
for( int i=0; i<rDevsRc.size(); i++ ){
|
||||
if( rDevsRc[i]->flags & DEVICE_DEFAULT ){
|
||||
iRecDev = rDevsRc[i]->iDevice;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Screen->Cursor = crHourGlass;
|
||||
|
||||
m_iCurrPlaybackDevice = iPlayDev;
|
||||
m_iCurrOutput = iOutput;
|
||||
|
||||
HRESULT hr = f_MM_SetIODevice( iPlayDev, iOutput, iRecDev, iInput );
|
||||
|
||||
if( iPlayDev>=0 ){
|
||||
m_iCurrPlaybackDevice = iPlayDev;
|
||||
m_iCurrOutput = iOutput;
|
||||
}
|
||||
|
||||
m_iCurrRecordDevice = iRecDev;
|
||||
m_iCurrInput = iInput;
|
||||
|
||||
ReloadPlayDev();
|
||||
ReloadOutput();
|
||||
|
||||
ReloadRecDev();
|
||||
ReloadInput();
|
||||
|
||||
if( hr==S_OK ){
|
||||
if( m_cbInput->Enabled )
|
||||
BeginRecordTest();
|
||||
}
|
||||
else
|
||||
ShowErrorMessage( hr );
|
||||
|
||||
Screen->Cursor = crDefault;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TMicSetForm::ASIOClick(TObject *Sender)
|
||||
{
|
||||
if( m_PopupMenu ){
|
||||
delete m_PopupMenu;
|
||||
m_PopupMenu = NULL;
|
||||
}
|
||||
|
||||
m_PopupMenu = new TMenuPanel();
|
||||
m_PopupMenu->Parent = this;
|
||||
|
||||
m_PopupMenu->CreateMenu( "显示面板", "", DoShowPanel );
|
||||
m_PopupMenu->CreateMenu( "重启设备", "", DoRestart );
|
||||
|
||||
m_PopupMenu->Width = m_lblASIO->Width;
|
||||
m_PopupMenu->Show( m_lblASIO->Left, m_lblASIO->Top+m_lblASIO->Height );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -0,0 +1,396 @@
|
||||
object MicSetForm: TMicSetForm
|
||||
Left = 0
|
||||
Top = 0
|
||||
BorderStyle = bsNone
|
||||
Caption = 'MicSetForm'
|
||||
ClientHeight = 324
|
||||
ClientWidth = 382
|
||||
Color = 5064257
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
Position = poMainFormCenter
|
||||
Scaled = False
|
||||
OnClose = FormClose
|
||||
OnCreate = FormCreate
|
||||
OnKeyDown = FormKeyDown
|
||||
TextHeight = 14
|
||||
object m_panGeneral: TGeneralDialogPanel
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 382
|
||||
Height = 324
|
||||
Align = alClient
|
||||
Caption = #38899#39057#35774#22791#35774#32622
|
||||
Color = 5064257
|
||||
DoubleBuffered = True
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentBackground = False
|
||||
ParentDoubleBuffered = False
|
||||
ParentFont = False
|
||||
TabOrder = 0
|
||||
object m_cbOutput: TComboBoxComponent
|
||||
Left = 89
|
||||
Top = 117
|
||||
Width = 161
|
||||
Height = 25
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
OnChange = OutputChange
|
||||
ShowItemCount = 5
|
||||
Parent = m_panGeneral
|
||||
end
|
||||
object m_lblASIO: TLabel
|
||||
Left = 250
|
||||
Top = 117
|
||||
Width = 101
|
||||
Height = 25
|
||||
Cursor = crHandPoint
|
||||
Alignment = taCenter
|
||||
AutoSize = False
|
||||
Caption = 'ASIO'#35774#22791
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clAqua
|
||||
Font.Height = -13
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = [fsBold, fsItalic]
|
||||
ParentFont = False
|
||||
Transparent = False
|
||||
Layout = tlCenter
|
||||
OnClick = ASIOClick
|
||||
end
|
||||
object m_lblVolume: TLabel
|
||||
Left = 27
|
||||
Top = 238
|
||||
Width = 60
|
||||
Height = 14
|
||||
Caption = #24405#38899#38899#37327#65306
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
end
|
||||
object m_lblPlayback: TLabel
|
||||
Left = 27
|
||||
Top = 83
|
||||
Width = 60
|
||||
Height = 14
|
||||
Caption = #25773#25918#35774#22791#65306
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
end
|
||||
object m_lblInput: TLabel
|
||||
Left = 27
|
||||
Top = 199
|
||||
Width = 60
|
||||
Height = 14
|
||||
Caption = #24405#38899#36755#20837#65306
|
||||
Color = clBtnFace
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
Transparent = True
|
||||
end
|
||||
object m_lblLatencyTime: TLabel
|
||||
Left = 291
|
||||
Top = 200
|
||||
Width = 60
|
||||
Height = 14
|
||||
ParentCustomHint = False
|
||||
Alignment = taRightJustify
|
||||
AutoSize = False
|
||||
Caption = '---- ms'
|
||||
Color = clBtnFace
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
ParentShowHint = False
|
||||
ShowAccelChar = False
|
||||
ShowHint = False
|
||||
Layout = tlCenter
|
||||
end
|
||||
object m_lblHint: TLabel
|
||||
Left = 27
|
||||
Top = 278
|
||||
Width = 36
|
||||
Height = 14
|
||||
Caption = #25552#31034#65306
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
end
|
||||
object m_lblHintMsg: TLabel
|
||||
Left = 72
|
||||
Top = 278
|
||||
Width = 108
|
||||
Height = 28
|
||||
Caption = #35831#23545#30528#40614#20811#39118#21756#21809#65292#36827#34892#35797#21548#27979#35797#12290
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
WordWrap = True
|
||||
end
|
||||
object m_lblLatency: TLabel
|
||||
Left = 266
|
||||
Top = 199
|
||||
Width = 28
|
||||
Height = 14
|
||||
Caption = #24310#36831':'
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
end
|
||||
object m_cbPlayDev: TComboBoxComponent
|
||||
Left = 89
|
||||
Top = 79
|
||||
Width = 262
|
||||
Height = 25
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
OnChange = PlayDevChange
|
||||
ShowItemCount = 5
|
||||
Parent = m_panGeneral
|
||||
end
|
||||
object m_cbInput: TComboBoxComponent
|
||||
Left = 89
|
||||
Top = 194
|
||||
Width = 161
|
||||
Height = 25
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
OnChange = InputChange
|
||||
ShowItemCount = 5
|
||||
Parent = m_panGeneral
|
||||
end
|
||||
object m_btnOk: TTextButton
|
||||
Left = 236
|
||||
Top = 278
|
||||
Width = 54
|
||||
Height = 25
|
||||
ModalResult = mrOk
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
OnClick = OkClick
|
||||
Text = #30830#23450
|
||||
end
|
||||
object m_btnCanel: TTextButton
|
||||
Left = 299
|
||||
Top = 278
|
||||
Width = 54
|
||||
Height = 25
|
||||
ModalResult = mrCancel
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
Text = #21462#28040
|
||||
end
|
||||
object m_lblOutput: TLabel
|
||||
Left = 27
|
||||
Top = 122
|
||||
Width = 60
|
||||
Height = 14
|
||||
Caption = #25773#25918#36755#20986#65306
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
end
|
||||
object m_lblRecord: TLabel
|
||||
Left = 27
|
||||
Top = 159
|
||||
Width = 60
|
||||
Height = 14
|
||||
Caption = #24405#38899#35774#22791#65306
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
end
|
||||
object m_cbRecDev: TComboBoxComponent
|
||||
Left = 89
|
||||
Top = 155
|
||||
Width = 262
|
||||
Height = 25
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
OnChange = RecDevChange
|
||||
ShowItemCount = 5
|
||||
Parent = m_panGeneral
|
||||
end
|
||||
object m_lblType: TLabel
|
||||
Left = 27
|
||||
Top = 44
|
||||
Width = 60
|
||||
Height = 14
|
||||
Caption = #35774#22791#31867#22411#65306
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
end
|
||||
object m_ckAuto: TCKBox
|
||||
Left = 241
|
||||
Top = 236
|
||||
Width = 54
|
||||
Height = 18
|
||||
Caption = #33258#21160
|
||||
Ctl3D = False
|
||||
DoubleBuffered = True
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 12429980
|
||||
Font.Height = -12
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentColor = True
|
||||
ParentCtl3D = False
|
||||
ParentDoubleBuffered = False
|
||||
ParentFont = False
|
||||
TabOrder = 0
|
||||
BoxColor = 3157548
|
||||
OnChange = AutoChange
|
||||
end
|
||||
object m_ckMoniter: TCKBox
|
||||
Left = 301
|
||||
Top = 236
|
||||
Width = 52
|
||||
Height = 18
|
||||
Caption = #30417#21548
|
||||
Ctl3D = False
|
||||
DoubleBuffered = True
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 12429980
|
||||
Font.Height = -12
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentColor = True
|
||||
ParentCtl3D = False
|
||||
ParentDoubleBuffered = False
|
||||
ParentFont = False
|
||||
TabOrder = 1
|
||||
BoxColor = 3157548
|
||||
OnChange = MoniterChange
|
||||
end
|
||||
object m_tbVolume: TSkinTrackBar
|
||||
Tag = 1
|
||||
Left = 89
|
||||
Top = 237
|
||||
Width = 142
|
||||
Height = 19
|
||||
Hint = '100'
|
||||
Caption = 'm_tbVolume'
|
||||
FullRepaint = False
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentColor = True
|
||||
ParentFont = False
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
TabOrder = 2
|
||||
Position = 100
|
||||
end
|
||||
object m_rbCommon: TRadioBtn
|
||||
Left = 91
|
||||
Top = 39
|
||||
Width = 51
|
||||
Height = 25
|
||||
Caption = #24120#35268
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 12429980
|
||||
Font.Height = -11
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
TabOrder = 3
|
||||
OnClick = DevTypeClick
|
||||
end
|
||||
object m_rbASIO: TRadioBtn
|
||||
Left = 148
|
||||
Top = 39
|
||||
Width = 51
|
||||
Height = 25
|
||||
Caption = 'ASIO'
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 12429980
|
||||
Font.Height = -11
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
TabOrder = 4
|
||||
OnClick = DevTypeClick
|
||||
end
|
||||
object m_rbWASAPI: TRadioBtn
|
||||
Left = 205
|
||||
Top = 39
|
||||
Width = 68
|
||||
Height = 25
|
||||
Caption = 'WASAPI'
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 12429980
|
||||
Font.Height = -11
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
TabOrder = 5
|
||||
OnClick = DevTypeClick
|
||||
end
|
||||
object m_ckMIDI: TCKBox
|
||||
Left = 279
|
||||
Top = 43
|
||||
Width = 71
|
||||
Height = 18
|
||||
Caption = 'MIDI'#36755#20837
|
||||
Ctl3D = False
|
||||
DoubleBuffered = False
|
||||
FullRepaint = False
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 12429980
|
||||
Font.Height = -11
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentColor = True
|
||||
ParentCtl3D = False
|
||||
ParentDoubleBuffered = False
|
||||
ParentFont = False
|
||||
TabOrder = 6
|
||||
OnClick = MIDIInputClick
|
||||
BoxColor = 3157548
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,120 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef MicSetFormUnitH
|
||||
#define MicSetFormUnitH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <System.Classes.hpp>
|
||||
#include <Vcl.Controls.hpp>
|
||||
#include <Vcl.StdCtrls.hpp>
|
||||
#include <Vcl.Forms.hpp>
|
||||
#include <Vcl.ComCtrls.hpp>
|
||||
#include <Vcl.ExtCtrls.hpp>
|
||||
|
||||
#include "GeneralDialogPanel.h"
|
||||
#include "GlobalUnit.h"
|
||||
#include "CapButton.h"
|
||||
#include "ComboBoxComponent.h"
|
||||
#include "MessageDef.h"
|
||||
#include "SkinTrackBar.h"
|
||||
#include "TextButton.h"
|
||||
#include "CKBox.h"
|
||||
#include "MenuUnit.h"
|
||||
#include "RadioBtn.h"
|
||||
|
||||
|
||||
typedef struct tagDeviceInfo{
|
||||
int iDevice;
|
||||
char name[256]; // description
|
||||
DWORD flags;
|
||||
|
||||
tagDeviceInfo(){
|
||||
memset( this, 0, sizeof(tagDeviceInfo) );
|
||||
}
|
||||
|
||||
tagDeviceInfo( tagDeviceInfo* src ){
|
||||
memcpy( this, src, sizeof(tagDeviceInfo) );
|
||||
}
|
||||
} IO_DEVICE_INFO;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
class TMicSetForm : public TForm
|
||||
{
|
||||
__published: // IDE-managed Components
|
||||
TGeneralDialogPanel *m_panGeneral;
|
||||
TLabel *m_lblVolume;
|
||||
TLabel *m_lblPlayback;
|
||||
TLabel *m_lblInput;
|
||||
TLabel *m_lblLatencyTime;
|
||||
TLabel *m_lblHint;
|
||||
TLabel *m_lblHintMsg;
|
||||
TLabel *m_lblLatency;
|
||||
TComboBoxComponent *m_cbPlayDev;
|
||||
TComboBoxComponent *m_cbOutput;
|
||||
TComboBoxComponent *m_cbRecDev;
|
||||
TComboBoxComponent *m_cbInput;
|
||||
TTextButton *m_btnOk;
|
||||
TTextButton *m_btnCanel;
|
||||
TCKBox *m_ckAuto;
|
||||
TCKBox *m_ckMoniter;
|
||||
TSkinTrackBar *m_tbVolume;
|
||||
TLabel *m_lblOutput;
|
||||
TLabel *m_lblASIO;
|
||||
TLabel *m_lblRecord;
|
||||
TLabel *m_lblType;
|
||||
TRadioBtn *m_rbCommon;
|
||||
TRadioBtn *m_rbASIO;
|
||||
TRadioBtn *m_rbWASAPI;
|
||||
TCKBox *m_ckMIDI;
|
||||
|
||||
void __fastcall VolumeChange(TObject *Sender);
|
||||
void __fastcall FormCreate(TObject *Sender);
|
||||
void __fastcall OkClick(TObject *Sender);
|
||||
void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
|
||||
void __fastcall AutoChange(TObject *Sender);
|
||||
void __fastcall MoniterChange(TObject *Sender);
|
||||
void __fastcall FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift);
|
||||
void __fastcall PlayDevChange(TComboBoxItem *Sender, int Index);
|
||||
void __fastcall InputChange(TComboBoxItem *Sender, int Index);
|
||||
void __fastcall OutputChange(TComboBoxItem *Sender, int Index);
|
||||
void __fastcall RecDevChange(TComboBoxItem *Sender, int Index);
|
||||
void __fastcall MIDIInputClick(TObject *Sender);
|
||||
void __fastcall DevTypeClick(TObject *Sender);
|
||||
void __fastcall ASIOClick(TObject *Sender);
|
||||
|
||||
|
||||
private: // User declarations
|
||||
TTimer *m_pTimerLatency; //Timer
|
||||
|
||||
TMenuPanel *m_PopupMenu; //µ¯³ö²Ëµ¥
|
||||
|
||||
int m_iCurrPlaybackDevice, m_iCurrOutput,
|
||||
m_iCurrRecordDevice, m_iCurrInput;
|
||||
vector<IO_DEVICE_INFO*> m_aCommonPb, m_aCommonRc,
|
||||
m_aWasapiPb, m_aWasapiRc,
|
||||
m_aAsioPb, m_aMidiRc;
|
||||
|
||||
void ReloadPlayDev();
|
||||
void ReloadRecDev();
|
||||
void ReloadOutput();
|
||||
void ReloadInput();
|
||||
void BeginRecordTest(bool bStart=true);
|
||||
void ShowErrorMessage( int err );
|
||||
|
||||
void __fastcall DoShowPanel(TObject* Sender);
|
||||
void __fastcall DoRestart(TObject* Sender);
|
||||
void __fastcall LatencyTimerProc(TObject* Sender); //Timer»Øµ÷º¯Êý
|
||||
void __fastcall PanelClick(String Sender,int PanelType,int MenuType);
|
||||
|
||||
MESSAGE void __fastcall UMRecordVolJust(TMessage &Message);
|
||||
BEGIN_MESSAGE_MAP
|
||||
MESSAGE_HANDLER(MSG_RECORD_VOLJUST, TMessage, UMRecordVolJust)
|
||||
END_MESSAGE_MAP(TForm)
|
||||
|
||||
public: // User declarations
|
||||
|
||||
__fastcall TMicSetForm(TComponent* Owner);
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
extern PACKAGE TMicSetForm *MicSetForm;
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
@@ -0,0 +1,571 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "GlobalUnit.h"
|
||||
#include "Compose.h"
|
||||
#include "MidiTrack.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
|
||||
/***************************************************************************************/
|
||||
// 全局变量
|
||||
/***************************************************************************************/
|
||||
TMidi g_Midi; //MIDI轨道对象
|
||||
TMidiTrackList& g_aMidiTracks = g_Midi.MidiTrackList(); //MIDI轨道列表
|
||||
int g_iSelMidiTrack = -1; //当前处理的MIDI轨道
|
||||
|
||||
/***************************************************************************************/
|
||||
// Midi类函数
|
||||
void TMidi::ClearMidiTracks()
|
||||
{
|
||||
ClearMidiTrackNotes();
|
||||
|
||||
while( !m_lstMidiTracks.empty() ){
|
||||
delete m_lstMidiTracks.back();
|
||||
m_lstMidiTracks.pop_back();
|
||||
}
|
||||
|
||||
while( !m_aChnoUsed.empty() ){
|
||||
delete m_aChnoUsed.back();
|
||||
m_aChnoUsed.pop_back();
|
||||
}
|
||||
|
||||
m_nMidiFile = 0;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void TMidi::ClearMidiTrackNotes()
|
||||
{
|
||||
for( int i=0; i<m_lstMidiTracks.size(); i++ ){
|
||||
TMidiTrack* pTrack = m_lstMidiTracks[i];
|
||||
|
||||
while( !pTrack->aNotes.empty() ){
|
||||
delete pTrack->aNotes.back();
|
||||
pTrack->aNotes.pop_back();
|
||||
}
|
||||
|
||||
pTrack->ptMin = 0xFF;
|
||||
pTrack->ptMax = 0;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
TMidiTrack* TMidi::FindMidiTrack( BYTE file, BYTE chno )
|
||||
{
|
||||
for( int i=0; i<m_lstMidiTracks.size(); i++ ){
|
||||
if( m_lstMidiTracks[i]->file==file && m_lstMidiTracks[i]->chno==chno ){
|
||||
return m_lstMidiTracks[i];
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
int TMidi::GetMidiTrackIndex( BYTE file, BYTE chno )
|
||||
{
|
||||
for( int i=0; i<m_lstMidiTracks.size(); i++ ){
|
||||
if( m_lstMidiTracks[i]->file==file
|
||||
&& m_lstMidiTracks[i]->chno==chno ){
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void TMidi::SortMidiTracks()
|
||||
{
|
||||
/* ClearMidiTracks();
|
||||
|
||||
if( !g_pUseStyle )
|
||||
return;
|
||||
|
||||
TStyleItem* pStyleItem = g_pUseStyle;
|
||||
*/
|
||||
for( int i=0; i<g_Opus.StageCount(); i++ ){
|
||||
TOpusStage* pStage = g_lstOpusStages[i];
|
||||
|
||||
for( int j=0; j<pStage->aTracks.size(); j++ ){
|
||||
TTrack* pTrk = pStage->aTracks[j];
|
||||
|
||||
// BYTE ch = ( pTrk->iBank==0xFF || pTrk->iBank<0x80 ) ? pTrk->iChanNo
|
||||
// : pTrk->iChanSpec;
|
||||
|
||||
TMidiTrack* pMT = GetValidMidiTrack( i, pTrk->iFile, pTrk->iChanSpec,
|
||||
pTrk->iBank, pTrk->iProg );
|
||||
|
||||
if( pTrk->iChanSpec!=pMT->chno || pTrk->iFile!=pMT->file ){
|
||||
pTrk->iFile = pMT->file;
|
||||
pTrk->iChanSpec = pMT->chno;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
for( int k=0; k<m_lstMidiTracks.size(); k++ ){
|
||||
TMidiTrack* pChannel = m_lstMidiTracks[k];
|
||||
|
||||
DebugPrint( "\nchan %d bank=%d chno=%d prog=%d\n", k, pChannel->bank, pChannel->chno, pChannel->prog );
|
||||
AnsiString strStages = " stages:";
|
||||
for( int m=0; m<pChannel->aStages.size(); m++ ){
|
||||
strStages += " ";
|
||||
strStages += IntToStr( pChannel->aStages[m] );
|
||||
}
|
||||
|
||||
DebugPrint( "%s\n", strStages.c_str() );
|
||||
}
|
||||
|
||||
for( int m=0; m<m_aChnoUsed.size(); m++ ){
|
||||
AnsiString strStages = "\nbank=";
|
||||
strStages += IntToStr( m_aChnoUsed[m]->bank );
|
||||
|
||||
strStages += " used:";
|
||||
|
||||
for( int n=0; n<16; n++ ){
|
||||
if( m_aChnoUsed[m]->chno & (1<<n) ){
|
||||
strStages += " ";
|
||||
strStages += IntToStr( n );
|
||||
}
|
||||
}
|
||||
|
||||
strStages += "\n";
|
||||
|
||||
DebugPrint( "%s\n", strStages.c_str() );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
TChnoUsed* TMidi::GetChnoUsed( BYTE file, BYTE bank )
|
||||
{
|
||||
TChnoUsed* pCU = NULL;
|
||||
for( int i=0; i<m_aChnoUsed.size(); i++ ){
|
||||
TChnoUsed* pChUs = m_aChnoUsed[i];
|
||||
|
||||
if( pChUs->file==file && pChUs->bank==bank ){
|
||||
pCU = pChUs;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( !pCU ){
|
||||
pCU = new TChnoUsed( bank, file );
|
||||
AddChnoUsed( pCU );
|
||||
}
|
||||
|
||||
return pCU;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
BYTE TMidi::GetValidFile( BYTE bank, BYTE chno )
|
||||
{
|
||||
WORD ch = ( 1<<chno );
|
||||
TChnoUsed* pCU = NULL;
|
||||
for( int i=0; i<m_aChnoUsed.size(); i++ ){
|
||||
TChnoUsed* pChUs = m_aChnoUsed[i];
|
||||
|
||||
if( pChUs->bank==bank && !(pChUs->chno & ch) ){
|
||||
pCU = pChUs;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( !pCU ){
|
||||
pCU = new TChnoUsed( bank, m_nMidiFile++ );
|
||||
AddChnoUsed( pCU );
|
||||
}
|
||||
|
||||
pCU->chno |= ch;
|
||||
return pCU->file;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
TMidiTrack* TMidi::GetValidMidiTrack( int iStage, BYTE file, BYTE chno, BYTE bank, BYTE prog )
|
||||
{
|
||||
vector<int> aStages;
|
||||
aStages.push_back( iStage );
|
||||
|
||||
return GetValidMidiTrack( aStages, file, chno, bank, prog );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
TMidiTrack* TMidi::GetValidMidiTrack( vector<int>& lstStages, BYTE file, BYTE chno, BYTE bank, BYTE prog )
|
||||
{
|
||||
TMidiTrack* pMidiTrack = NULL;
|
||||
vector<TMidiTrack*> aValidTracks;
|
||||
bool bVSTi = bank!=0xFF && bank>=0x80;
|
||||
|
||||
if( file!=0xFF ){
|
||||
TMidiTrack* pMT = FindMidiTrack( file, chno );
|
||||
|
||||
if( !pMT ){
|
||||
pMidiTrack = new TMidiTrack( bank, chno, prog, file );
|
||||
AddMidiTrack( pMidiTrack );
|
||||
|
||||
goto EXIT_LINE;
|
||||
}
|
||||
else if( pMT->bank==bank && (!bVSTi && ( pMT->chno==9 && chno==9
|
||||
|| pMT->chno!=9 && chno!=9
|
||||
&& pMT->prog==prog ) //GM的鼓通道或相同bank和prog
|
||||
|| bVSTi && pMT->chno==chno ) //VSTi的通道相同
|
||||
&& pMT->ValidStages( lstStages ) ){
|
||||
pMidiTrack = pMT;
|
||||
|
||||
goto EXIT_LINE;
|
||||
}
|
||||
}
|
||||
|
||||
for( int i=0; i<m_lstMidiTracks.size(); i++ ){
|
||||
TMidiTrack* pMT = m_lstMidiTracks[i];
|
||||
|
||||
if( bank==pMT->bank && (!bVSTi && ( pMT->chno==9 && chno==9
|
||||
|| pMT->chno!=9 && chno!=9
|
||||
&& pMT->prog==prog ) //GM的鼓通道或相同bank和prog
|
||||
|| bVSTi && pMT->chno==chno ) //VSTi的通道相同
|
||||
&& pMT->ValidStages( lstStages ) ){
|
||||
pMidiTrack = pMT;
|
||||
|
||||
goto EXIT_LINE;
|
||||
}
|
||||
}
|
||||
|
||||
//未找到有效MidiTrack,新建
|
||||
for( int i=0; i<m_aChnoUsed.size(); i++ ){
|
||||
if( m_aChnoUsed[i]->bank==bank ){
|
||||
TChnoUsed* pCU = m_aChnoUsed[i];
|
||||
|
||||
if( bVSTi && ( pCU->chno & (1<<chno) )) //VSTi不重设chno
|
||||
continue;
|
||||
|
||||
if( chno==9 && !(pCU->chno & 0x200) || chno!=9 && (pCU->chno & 0xFDFF)!=0xFDFF ){
|
||||
if( pCU->chno & (1<<chno) ){
|
||||
for( int n=0; n<16; n++ ){
|
||||
if( n!=9 && !(pCU->chno & (1<<n)) ){
|
||||
chno = n;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pMidiTrack = new TMidiTrack( bank, chno, prog, pCU->file );
|
||||
AddMidiTrack( pMidiTrack );
|
||||
|
||||
goto EXIT_LINE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EXIT_LINE:
|
||||
if( !pMidiTrack ){
|
||||
pMidiTrack = new TMidiTrack( bank, chno, prog, m_nMidiFile++ );
|
||||
AddMidiTrack( pMidiTrack );
|
||||
}
|
||||
|
||||
for( int i=0; i<lstStages.size(); i++ ){
|
||||
pMidiTrack->AddStage( lstStages[i] );
|
||||
}
|
||||
|
||||
return pMidiTrack;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void TMidi::AddMidiTrack( TMidiTrack* pCh, int iInd )
|
||||
{
|
||||
if( iInd>=0 && iInd<m_lstMidiTracks.size() ){
|
||||
m_lstMidiTracks.insert( m_lstMidiTracks.begin()+iInd, pCh );
|
||||
}
|
||||
else{
|
||||
m_lstMidiTracks.push_back( pCh );
|
||||
}
|
||||
|
||||
if( m_nMidiFile<=pCh->file )
|
||||
m_nMidiFile = pCh->file+1;
|
||||
|
||||
TChnoUsed* pCU = GetChnoUsed( pCh->file, pCh->bank );
|
||||
pCU->chno |= ( 1 << pCh->chno );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void TMidi::AddChnoUsed( TChnoUsed* pCU )
|
||||
{
|
||||
int m = 0;
|
||||
for( ; m<m_aChnoUsed.size(); m++ ){
|
||||
if( (char)m_aChnoUsed[m]->bank > (char)pCU->bank ){
|
||||
m_aChnoUsed.insert( m_aChnoUsed.begin()+m, pCU );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( m==m_aChnoUsed.size() )
|
||||
m_aChnoUsed.push_back( pCU );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void TMidi::DeleteMidiTrack( TMidiTrack* pCh )
|
||||
{
|
||||
for( int i=0; i<m_lstMidiTracks.size(); i++ ){
|
||||
if( pCh==m_lstMidiTracks[i] ){
|
||||
TChnoUsed* pCU = GetChnoUsed( pCh->file, pCh->bank );
|
||||
pCU->chno &= ~( 1 << pCh->chno );
|
||||
if( pCU->chno==0 )
|
||||
DeleteChnoUsed( pCU );
|
||||
|
||||
delete pCh;
|
||||
m_lstMidiTracks.erase( m_lstMidiTracks.begin() + i );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void TMidi::DeleteChnoUsed( TChnoUsed* pCU )
|
||||
{
|
||||
for( int i=0; i<m_aChnoUsed.size(); i++ ){
|
||||
if( pCU==m_aChnoUsed[i] ){
|
||||
delete pCU;
|
||||
m_aChnoUsed.erase( m_aChnoUsed.begin() + i );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void TMidi::CutStage( int iStage )
|
||||
{
|
||||
for( int i=0; i<m_lstMidiTracks.size(); i++ ){
|
||||
TMidiTrack* pMT = m_lstMidiTracks[i];
|
||||
|
||||
for( int j=pMT->aStages.size()-1; j>=0; j-- ){
|
||||
if( pMT->aStages[j]>iStage )
|
||||
pMT->aStages[j]++;
|
||||
else if( pMT->aStages[j]==iStage ){
|
||||
pMT->aStages.insert( pMT->aStages.begin()+j+1, iStage+1 );
|
||||
break;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void TMidi::InsertStage( int iStage )
|
||||
{
|
||||
for( int i=0; i<m_lstMidiTracks.size(); i++ ){
|
||||
TMidiTrack* pMT = m_lstMidiTracks[i];
|
||||
|
||||
for( int j=pMT->aStages.size()-1; j>=0; j-- ){
|
||||
if( pMT->aStages[j]>=iStage )
|
||||
pMT->aStages[j]++;
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void TMidi::RemoveStage( int iStage, bool bSort )
|
||||
{
|
||||
for( int i=0; i<m_lstMidiTracks.size(); i++ ){
|
||||
TMidiTrack* pMT = m_lstMidiTracks[i];
|
||||
|
||||
for( int j=pMT->aStages.size()-1; j>=0; j-- ){
|
||||
if( pMT->aStages[j]>iStage ){
|
||||
if( bSort )
|
||||
pMT->aStages[j]--;
|
||||
}
|
||||
else if( pMT->aStages[j]==iStage )
|
||||
pMT->aStages.erase( pMT->aStages.begin()+j );
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
int TMidi::ClearEmptyTrack()
|
||||
{
|
||||
int iFirstEmpty = -1;
|
||||
|
||||
for( int i=m_lstMidiTracks.size()-1; i>=0; i-- ){
|
||||
if( m_lstMidiTracks[i]->aStages.empty() ){
|
||||
TMidiTrack* pMT = m_lstMidiTracks[i];
|
||||
TChnoUsed* pCU = GetChnoUsed( pMT->file, pMT->bank );
|
||||
pCU->chno &= ~( 1 << pMT->chno );
|
||||
if( pCU->chno==0 )
|
||||
DeleteChnoUsed( pCU );
|
||||
|
||||
delete pMT;
|
||||
m_lstMidiTracks.erase( m_lstMidiTracks.begin() + i );
|
||||
|
||||
iFirstEmpty = i;
|
||||
}
|
||||
}
|
||||
|
||||
return iFirstEmpty;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void TMidi::ChangMidiChno( int iMT, BYTE fiNew, BYTE chNew )
|
||||
{
|
||||
TMidiTrack* pMT = m_lstMidiTracks[iMT];
|
||||
|
||||
for( int i=0; i<pMT->aStages.size(); i++ ){
|
||||
TOpusStage* pStage = g_lstOpusStages[pMT->aStages[i]];
|
||||
for( int j=0; j<pStage->aTracks.size(); j++ ){
|
||||
TTrack* pTrack = pStage->aTracks[j];
|
||||
if( pTrack->iFile==pMT->file && pTrack->iChanSpec==pMT->chno ){
|
||||
pTrack->iFile = fiNew;
|
||||
pTrack->iChanSpec = chNew;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TChnoUsed* pCU = g_Midi.GetChnoUsed( pMT->file, pMT->bank );
|
||||
pCU->chno &= ~( 1 << pMT->chno );
|
||||
pMT->file = fiNew;
|
||||
pMT->chno = chNew;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void TMidi::ChangeNotesVolume( int iMT, int iSBar, int iEBar, BYTE volume )
|
||||
{
|
||||
TMidiTrack* pMT = m_lstMidiTracks[iMT];
|
||||
int iTickS = iSBar * POINTS_PER_BAR,
|
||||
iTickE = iEBar * POINTS_PER_BAR;
|
||||
|
||||
for( int i=0; i<pMT->aNotes.size(); i++ ){
|
||||
TMidiNote* pNote = pMT->aNotes[i];
|
||||
if( pNote->tkOn < pNote->tkOff && pNote->tkOn < iTickE && pNote->tkOff > iTickS ){
|
||||
pNote->volume = volume;
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
TColor u_clrNote[64];
|
||||
void TMidi::InitNoteColor()
|
||||
{
|
||||
int clrSeed[2][3] = {{52,101,100},{162,180,180}};
|
||||
|
||||
int r0 = clrSeed[0][0],
|
||||
r1 = clrSeed[1][0],
|
||||
g0 = clrSeed[0][1],
|
||||
g1 = clrSeed[1][1],
|
||||
b0 = clrSeed[0][2],
|
||||
b1 = clrSeed[1][2];
|
||||
double dR = (r1-r0) / 64.0,
|
||||
dG = (g1-g0) / 64.0,
|
||||
dB = (b1-b0) / 64.0;
|
||||
|
||||
u_clrNote[63] = RGB( r0, g0, b0 );
|
||||
|
||||
for (int i=62; i>0; i--){
|
||||
r0 += dR;
|
||||
g0 += dG;
|
||||
b0 += dB;
|
||||
|
||||
u_clrNote[i] = RGB( r0, g0, b0 );
|
||||
}
|
||||
|
||||
u_clrNote[0] = RGB( r1, g1, b1 );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
TColor TMidi::GetNoteColor( int vol )
|
||||
{
|
||||
return u_clrNote[vol>>1];
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void TMidi::GetSpecBanks( vector<BYTE>& lstBank )
|
||||
{
|
||||
for( int i=0; i<m_lstMidiTracks.size(); i++ ){
|
||||
TMidiTrack* pMT = m_lstMidiTracks[i];
|
||||
if( pMT->bank!=0xFF ){
|
||||
bool bAdd = true;
|
||||
|
||||
for( int b=0; b<lstBank.size(); b++ ){
|
||||
if( pMT->bank==lstBank[b] ){
|
||||
bAdd = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( bAdd )
|
||||
lstBank.push_back( pMT->bank );
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void TMidi::SetSpecBanks( BANKMAPLIST& lstMap )
|
||||
{
|
||||
for( int i=0; i<m_lstMidiTracks.size(); i++ ){
|
||||
TMidiTrack* pMT = m_lstMidiTracks[i];
|
||||
if( pMT->bank!=0xFF ){
|
||||
for( int b=0; b<lstMap.size(); b++ ){
|
||||
TBankMap* pMap = lstMap[b];
|
||||
|
||||
if( pMT->bank==pMap->iBankOld ){
|
||||
pMT->bank = pMap->iBankNew;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void TMidi::WriteProj( FILE* pFile )
|
||||
{
|
||||
int num = m_lstMidiTracks.size();
|
||||
fwrite( &num, sizeof(int), 1, pFile );
|
||||
|
||||
for( int i=0; i<num; i++ ){
|
||||
TMidiTrack* pMT = m_lstMidiTracks[i];
|
||||
|
||||
fwrite( &pMT->state, sizeof(BYTE), 1, pFile );
|
||||
fwrite( &pMT->volume, sizeof(BYTE), 1, pFile );
|
||||
fwrite( &pMT->pan, sizeof(char), 1, pFile );
|
||||
fwrite( &pMT->gain, sizeof(char), 1, pFile );
|
||||
|
||||
fwrite( &pMT->bank, sizeof(BYTE), 1, pFile );
|
||||
fwrite( &pMT->chno, sizeof(BYTE), 1, pFile );
|
||||
fwrite( &pMT->prog, sizeof(BYTE), 1, pFile );
|
||||
fwrite( &pMT->file, sizeof(BYTE), 1, pFile );
|
||||
}
|
||||
}
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
int TMidi::ReadProj( FILE* pFile, DWORD dwVersion )
|
||||
{
|
||||
int num = 0;
|
||||
fread( &num, sizeof(int), 1, pFile );
|
||||
|
||||
for( int i=0; i<num; i++ ){
|
||||
TMidiTrack* pMT = new TMidiTrack;
|
||||
|
||||
fread( &pMT->state, sizeof(BYTE), 1, pFile );
|
||||
fread( &pMT->volume, sizeof(BYTE), 1, pFile );
|
||||
fread( &pMT->pan, sizeof(char), 1, pFile );
|
||||
fread( &pMT->gain, sizeof(char), 1, pFile );
|
||||
|
||||
fread( &pMT->bank, sizeof(BYTE), 1, pFile );
|
||||
fread( &pMT->chno, sizeof(BYTE), 1, pFile );
|
||||
fread( &pMT->prog, sizeof(BYTE), 1, pFile );
|
||||
fread( &pMT->file, sizeof(BYTE), 1, pFile );
|
||||
|
||||
AddMidiTrack( pMT );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
+215
@@ -0,0 +1,215 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef MidiTrackH
|
||||
#define MidiTrackH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vector>
|
||||
#include "ProCommon.h"
|
||||
using namespace std;
|
||||
#include "StyleItem.h"
|
||||
#include "BaseTrack.h"
|
||||
|
||||
/***************************************************************************************/
|
||||
// TMidi
|
||||
typedef struct tagMidiNote{
|
||||
BYTE pitch, //音高
|
||||
velocity, //力度
|
||||
volume, //音量
|
||||
rsvd;
|
||||
int tkOn, tkOff;
|
||||
|
||||
tagMidiNote( BYTE pt, BYTE vel, BYTE vol, DWORD on )
|
||||
{
|
||||
pitch = pt;
|
||||
velocity = vel;
|
||||
volume = vol;
|
||||
tkOn = on;
|
||||
tkOff = -1;
|
||||
|
||||
};
|
||||
} TMidiNote;
|
||||
|
||||
class TMidiTrack : public TBaseTrack
|
||||
{
|
||||
public:
|
||||
BYTE bank; //音源号 0xFF=全局SF2,other为指定音源
|
||||
BYTE chno; //通道号
|
||||
BYTE prog; //乐器号
|
||||
BYTE file; //文件号 处理乐器多于16种的情况
|
||||
|
||||
BYTE ptMin, ptMax; //音符范围
|
||||
|
||||
vector<int> aStages;
|
||||
vector<TMidiNote*> aNotes;
|
||||
|
||||
TMidiTrack() : TBaseTrack()
|
||||
{
|
||||
bank = chno = prog = file = 0xFF;
|
||||
};
|
||||
|
||||
TMidiTrack( BYTE bk, BYTE ch, BYTE pr, BYTE fi=0 ) : TBaseTrack()
|
||||
{
|
||||
bank = bk;
|
||||
chno = ch;
|
||||
prog = pr;
|
||||
file = fi;
|
||||
|
||||
ptMin = 0xFF;
|
||||
ptMax = 0;
|
||||
};
|
||||
|
||||
TMidiTrack( TMidiTrack* pSrc ) : TBaseTrack( pSrc->state, pSrc->volume, pSrc->pan, pSrc->gain )
|
||||
{
|
||||
bank = pSrc->bank;
|
||||
chno = pSrc->chno;
|
||||
prog = pSrc->prog;
|
||||
file = pSrc->file;
|
||||
|
||||
ptMin = 0xFF;
|
||||
ptMax = 0;
|
||||
}
|
||||
|
||||
void AddStage( int iStage )
|
||||
{
|
||||
if( aStages.empty() )
|
||||
aStages.push_back( iStage );
|
||||
else{
|
||||
for( int i=aStages.size()-1; i>=0; i-- ){
|
||||
if( aStages[i]<iStage ){
|
||||
if( i+1>=aStages.size() )
|
||||
aStages.push_back( iStage );
|
||||
else
|
||||
aStages.insert( aStages.begin()+i+1, iStage );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if( aStages[i]==iStage )
|
||||
break;
|
||||
|
||||
if( i==0 ){
|
||||
aStages.insert( aStages.begin(), iStage );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
void DelStage( int iStage )
|
||||
{
|
||||
for( int i=0; i<aStages.size(); i++ ){
|
||||
if( aStages[i]>iStage )
|
||||
break;
|
||||
|
||||
if( aStages[i]==iStage ){
|
||||
aStages.erase( aStages.begin() + i );
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
bool ValidStages( vector<int>& lstStages ) //段落可用
|
||||
{
|
||||
bool bValid = true;
|
||||
vector<int>::iterator iter1 = aStages.begin(),
|
||||
iter2 = lstStages.begin();
|
||||
while( iter1!=aStages.end() && iter2!=lstStages.end() ){
|
||||
if( *iter1 < *iter2 )
|
||||
iter1++;
|
||||
else if( *iter1 > *iter2 )
|
||||
iter2++;
|
||||
else{
|
||||
bValid = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return bValid;
|
||||
};
|
||||
|
||||
bool IsDrum()
|
||||
{
|
||||
if( !aStages.empty() ){
|
||||
TOpusStage* pStage = g_lstOpusStages[aStages[0]];
|
||||
for( int i=0; i<pStage->aTracks.size(); i++ ){
|
||||
TTrack* pTrack = pStage->aTracks[i];
|
||||
if( pTrack->iFile==file && pTrack->iChanSpec==chno && pTrack->iChanNo==9 )
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
typedef struct tagChnoUsed
|
||||
{
|
||||
WORD chno; //通道号按位占用
|
||||
BYTE file; //文件号 处理乐器多于16种的情况
|
||||
BYTE bank; //音源号 0xFF=全局SF2,other为指定音源
|
||||
|
||||
tagChnoUsed( BYTE bk, BYTE fi=0 )
|
||||
{
|
||||
bank = bk;
|
||||
file = fi;
|
||||
chno = 0;
|
||||
}
|
||||
} TChnoUsed, *PTChnoUsed;
|
||||
|
||||
typedef vector<TMidiTrack*> TMidiTrackList;
|
||||
|
||||
class TMidi
|
||||
{
|
||||
private:
|
||||
TMidiTrackList m_lstMidiTracks; //MIDI轨道列表
|
||||
vector<PTChnoUsed> m_aChnoUsed;
|
||||
int m_nMidiFile;
|
||||
|
||||
|
||||
public:
|
||||
TMidi(){m_nMidiFile = 0;};
|
||||
~TMidi(){ClearMidiTracks();};
|
||||
|
||||
TMidiTrackList& MidiTrackList() { return m_lstMidiTracks; };
|
||||
bool IsEmpty() { return m_lstMidiTracks.empty(); };
|
||||
void ClearMidiTracks();
|
||||
void ClearMidiTrackNotes();
|
||||
int ClearEmptyTrack();
|
||||
|
||||
void SortMidiTracks(); //整理channel号
|
||||
|
||||
int GetMidiTrackIndex( BYTE file, BYTE chno );
|
||||
TMidiTrack* FindMidiTrack( BYTE file, BYTE chno );
|
||||
TMidiTrack* GetValidMidiTrack( vector<int>& lstStages, BYTE file, BYTE chno, BYTE bank, BYTE prog );
|
||||
TMidiTrack* GetValidMidiTrack( int iStage, BYTE file, BYTE chno, BYTE bank, BYTE prog );
|
||||
|
||||
void CutStage( int iStage ); //分割段
|
||||
void InsertStage( int iStage ); //插入空段
|
||||
void RemoveStage( int iStage, bool bSort ); //删除段 bSort=不留空
|
||||
|
||||
TChnoUsed* GetChnoUsed( BYTE file, BYTE bank );
|
||||
void AddMidiTrack( TMidiTrack* pCh, int iInd=-1 );
|
||||
void AddChnoUsed( TChnoUsed* pCU );
|
||||
void DeleteMidiTrack( TMidiTrack* pCh );
|
||||
void DeleteChnoUsed( TChnoUsed* pCU );
|
||||
BYTE GetValidFile( BYTE bank, BYTE chno );
|
||||
void ChangMidiChno( int iMT, BYTE fiNew, BYTE chNew );
|
||||
|
||||
void InitNoteColor();
|
||||
TColor GetNoteColor( int vol );
|
||||
void ChangeNotesVolume( int iMT, int iSBar, int iEBar, BYTE volume );
|
||||
|
||||
void GetSpecBanks( vector<BYTE>& lstBank );
|
||||
void SetSpecBanks( BANKMAPLIST& lstMap );
|
||||
void WriteProj( FILE* pFile );
|
||||
int ReadProj( FILE* pFile, DWORD dwVersion );
|
||||
};
|
||||
|
||||
/***************************************************************************************/
|
||||
// 全局变量
|
||||
/***************************************************************************************/
|
||||
extern TMidi g_Midi; //MIDI轨道对象
|
||||
extern TMidiTrackList& g_aMidiTracks; //MIDI轨道列表
|
||||
extern int g_iSelMidiTrack; //当前处理的MIDI轨道
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,406 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "MultiSwitchProgFormUnit.h"
|
||||
#include "GlobalUnit.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
#pragma link "PNGButton"
|
||||
#pragma link "GeneralDialogPanel"
|
||||
#pragma link "TextButton"
|
||||
#pragma resource "*.dfm"
|
||||
TMultiSwitchProgForm *MultiSwitchProgForm;
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TMultiSwitchProgForm::TMultiSwitchProgForm(TComponent* Owner, TCommonItem *pItem)
|
||||
: TForm(Owner)
|
||||
{
|
||||
m_pItem = pItem;
|
||||
|
||||
mData = new TList();
|
||||
ItemChange = new TList();
|
||||
mCurrentItem = NULL;
|
||||
|
||||
if( pItem->iType==SEGTYPE_STYLE || pItem->iType==SEGTYPE_TRACK ){
|
||||
InitProgListPanel();
|
||||
InitInsTypePanel();
|
||||
InitInsPanel();
|
||||
|
||||
if( pItem->iType==SEGTYPE_TRACK ){
|
||||
GeneralDialogPanel->Caption = L"更换音色/乐器";
|
||||
}
|
||||
}
|
||||
|
||||
SetTransparent( this );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TMultiSwitchProgForm::~TMultiSwitchProgForm()
|
||||
{
|
||||
if(mData) {
|
||||
mData->Clear();
|
||||
delete mData;
|
||||
mData = NULL;
|
||||
}
|
||||
|
||||
if(ItemChange) {
|
||||
ItemChange->Clear();
|
||||
delete ItemChange;
|
||||
ItemChange = NULL;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TMultiSwitchProgForm::InitProgListPanel()
|
||||
{
|
||||
if( m_pItem->iType==SEGTYPE_STYLE ){
|
||||
for(int i = 0; i < m_pItem->aItems->Count; i++) {
|
||||
TSegmentItem *SegItem = (TSegmentItem *)m_pItem->aItems->Items[i];
|
||||
|
||||
for(int c = 0; c < SegItem->aItems->Count; c++) {
|
||||
TTrackItem *TrackItem = (TTrackItem *) SegItem->aItems->Items[c];
|
||||
char prog = TrackItem->pTrack->iProg,// >progCurr,
|
||||
chan = TrackItem->pTrack->iChanNo;
|
||||
|
||||
ProgListData *progData = CheckData( chan, prog );
|
||||
|
||||
if(!progData) {
|
||||
String strInst = chan==9 ? "GM鼓" : GM_INSTRUMENT[prog];
|
||||
progData = new ProgListData( strInst, prog, chan );
|
||||
if( progData->Channel==9 )
|
||||
mData->Insert( 0, progData );
|
||||
else
|
||||
mData->Add(progData);
|
||||
}
|
||||
|
||||
String strText = g_strSegment[SegItem->iType];
|
||||
strText += String("-") + (int)(SegItem->iInd+1);
|
||||
|
||||
if( SegItem->iSegType>=SEGTYPE_INTRO ){
|
||||
if( SegItem->iSegNo<4 )
|
||||
strText += " 大调" ;
|
||||
else
|
||||
strText += " 小调" ;
|
||||
}
|
||||
|
||||
progData->List->Add(new ProgItemData( strText, TrackItem));
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
TTrackItem *TrackItem = (TTrackItem *) m_pItem;
|
||||
TSegmentItem *SegItem = (TSegmentItem *)m_pItem->up;
|
||||
|
||||
char prog = TrackItem->pTrack->iProg,// >progCurr,
|
||||
chan = TrackItem->pTrack->iChanNo;
|
||||
|
||||
ProgListData *progData = CheckData( chan, prog );
|
||||
|
||||
if(!progData) {
|
||||
String strInst = chan==9 ? "GM鼓" : GM_INSTRUMENT[prog];
|
||||
progData = new ProgListData( strInst, prog, chan );
|
||||
if( progData->Channel==9 )
|
||||
mData->Insert( 0, progData );
|
||||
else
|
||||
mData->Add(progData);
|
||||
}
|
||||
|
||||
String strText = g_strSegment[SegItem->iType];
|
||||
strText += String("-") + (int)(SegItem->iInd+1);
|
||||
|
||||
if( SegItem->iSegType>=SEGTYPE_INTRO ){
|
||||
if( SegItem->iSegNo<4 )
|
||||
strText += " 大调" ;
|
||||
else
|
||||
strText += " 小调" ;
|
||||
}
|
||||
|
||||
progData->List->Add(new ProgItemData( strText, TrackItem));
|
||||
}
|
||||
|
||||
mProgListPanel = new TProgHandlePanel(this);
|
||||
mProgListPanel->Width = 160;
|
||||
mProgListPanel->Height = 225;
|
||||
mProgListPanel->Top = m_ShapeCur->Top+m_ShapeCur->Height-1;
|
||||
mProgListPanel->Left = 15;
|
||||
mProgListPanel->Parent = this;
|
||||
mProgListPanel->OnSelectedItem = DoProListSelect;
|
||||
mProgListPanel->SetTextFont(g_strTxtFontName, g_szFont9);
|
||||
|
||||
m_ShapeCur->Left = mProgListPanel->Left;
|
||||
m_ShapeCur->Width = mProgListPanel->Width;
|
||||
m_lbCurProg->Left = m_ShapeCur->Left+(m_ShapeCur->Width-m_lbCurProg->Width)/2;
|
||||
m_lbCurProg->Top = m_ShapeCur->Top+(m_ShapeCur->Height-m_lbCurProg->Height)/2;
|
||||
|
||||
for(int i = 0; i < mData->Count; i++) {
|
||||
ProgListData *data = (ProgListData *)mData->Items[i];
|
||||
|
||||
TProgHandleItem *Item = new TProgHandleItem(mProgListPanel, data->Caption);
|
||||
Item->IsUnfold = false;
|
||||
Item->Data = data;
|
||||
|
||||
for(int di = 0; di < data->List->Count; di++) {
|
||||
ProgItemData *it = (ProgItemData *)data->List->Items[di];
|
||||
|
||||
bool itemExist = false;
|
||||
|
||||
for(int dci = 0; dci < Item->ChildCount; dci++) {
|
||||
if(Item->Child(dci)->Caption == it->Caption)
|
||||
itemExist = true;
|
||||
}
|
||||
|
||||
if(!itemExist)
|
||||
new TProgHandleItem(Item, it->Caption)->Data = it;
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TMultiSwitchProgForm::InitInsTypePanel()
|
||||
{
|
||||
mInsTypePanel = new TListPanel(this);
|
||||
mInsTypePanel->Left = 190;
|
||||
mInsTypePanel->Top = m_ShapType->Top+m_ShapType->Height-1;
|
||||
mInsTypePanel->Height = 225;
|
||||
mInsTypePanel->Width = 120;
|
||||
mInsTypePanel->Parent = this;
|
||||
mInsTypePanel->SetTextFont(g_strTxtFontName, g_szFont9);
|
||||
|
||||
m_ShapType->Left = mInsTypePanel->Left;
|
||||
m_ShapType->Width = mInsTypePanel->Width;
|
||||
m_lbType->Left = m_ShapType->Left+(m_ShapType->Width-m_lbType->Width)/2;
|
||||
m_lbType->Top = m_ShapType->Top+(m_ShapType->Height-m_lbType->Height)/2;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TMultiSwitchProgForm::InitInsPanel()
|
||||
{
|
||||
mInsPanel = new TListPanel(this);
|
||||
mInsPanel->Left = 325;
|
||||
mInsPanel->Top = m_ShapeProg->Top+m_ShapeProg->Height-1;
|
||||
mInsPanel->Height = 225;
|
||||
mInsPanel->Width = 120;
|
||||
mInsPanel->Parent = this;
|
||||
mInsPanel->SetTextFont(g_strTxtFontName, g_szFont9);
|
||||
|
||||
m_ShapeProg->Left = mInsPanel->Left;
|
||||
m_ShapeProg->Width = mInsPanel->Width;
|
||||
m_lbProg->Left = m_ShapeProg->Left+(m_ShapeProg->Width-m_lbProg->Width)/2;
|
||||
m_lbProg->Top = m_ShapeProg->Top+(m_ShapeProg->Height-m_lbProg->Height)/2;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
ProgListData *TMultiSwitchProgForm::CheckData( char chan, char prog )
|
||||
{
|
||||
for(int i = 0; i < mData->Count; i++) {
|
||||
ProgListData *d = (ProgListData *) mData->Items[i];
|
||||
|
||||
if( prog==d->Prog && ( chan==9 && d->Channel==9
|
||||
|| chan!=9 && d->Channel!=9 ) ){
|
||||
return d;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TMultiSwitchProgForm::DoProListSelect(TObject *Sender)
|
||||
{
|
||||
TProgHandleItem *Item = (TProgHandleItem *)Sender;
|
||||
TProgHandleItem *CurrentItem = mCurrentItem;
|
||||
|
||||
if( Item && Item->Parent )
|
||||
Item = Item->Parent;
|
||||
|
||||
if( CurrentItem==Item )
|
||||
return;
|
||||
else
|
||||
mCurrentItem = Item;
|
||||
|
||||
if( Item==NULL ){
|
||||
mProgListPanel->DoSelectedItem( NULL );
|
||||
mInsTypePanel->Clear();
|
||||
mInsTypePanel->ResetScroll();
|
||||
mInsPanel->Clear();
|
||||
mInsPanel->ResetScroll();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
ProgListData *data = (ProgListData *)Item->Data,
|
||||
*dataOld = CurrentItem ? (ProgListData*)CurrentItem->Data : NULL;
|
||||
|
||||
int groupNew = data->Channel==9 ? 0 : ( data->Prog >> 3 ),
|
||||
groupOld = dataOld ? ( dataOld->Channel==9 ? 0 : ( dataOld->Prog >> 3 )) : -1;
|
||||
|
||||
if( dataOld==NULL || data->Channel==9 && dataOld->Channel!=9
|
||||
|| data->Channel!=9 && dataOld->Channel==9 ){
|
||||
if( dataOld ){
|
||||
mInsTypePanel->Clear();
|
||||
groupOld = -1;
|
||||
}
|
||||
|
||||
if( data->Channel==9 ){
|
||||
m_lbProg->Caption = "鼓组";
|
||||
mInsTypePanel->AddItem(new TListPanelItem("预设鼓组", DoInsTypeClick));
|
||||
}
|
||||
else{
|
||||
m_lbProg->Caption = "乐器";
|
||||
for(int i = 0; i < 16; i++) {
|
||||
mInsTypePanel->AddItem(new TListPanelItem(GM_GROUP[i], DoInsTypeClick));
|
||||
}
|
||||
}
|
||||
|
||||
mInsTypePanel->ResetScroll();
|
||||
}
|
||||
|
||||
mInsTypePanel->SelectedItemIndex = groupNew;
|
||||
|
||||
int iIndex = data->Channel==9 ? mInsPanel->SelectedItemIndex : data->Prog & 0x07;
|
||||
|
||||
if( groupOld!=groupNew ){
|
||||
mInsPanel->Clear();
|
||||
|
||||
if( data->Channel==9 ){
|
||||
FONTINFO *pFont = g_lstFonts[g_idFont];
|
||||
iIndex = -1;
|
||||
|
||||
for( int i = 0; i < pFont->nDrumCount; i++ ){
|
||||
FONTPRESET& set = pFont->aDrums[i];
|
||||
mInsPanel->AddItem( new TListPanelItem( set.text, DoInsClick ));
|
||||
|
||||
if( set.id==data->Prog ){
|
||||
iIndex = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
int base = groupNew<<3;
|
||||
for(int i = 0; i < 8; i++) {
|
||||
mInsPanel->AddItem(new TListPanelItem(GM_INSTRUMENT[base + i], DoInsClick));
|
||||
}
|
||||
}
|
||||
|
||||
mInsPanel->ResetScroll();
|
||||
}
|
||||
|
||||
mInsPanel->SelectedItemIndex = iIndex;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TMultiSwitchProgForm::DoInsTypeClick(TListPanel *Sender, int Index)
|
||||
{
|
||||
if( mCurrentItem == NULL || mInsPanel->SelectedItemIndex==Index )
|
||||
return;
|
||||
|
||||
mInsPanel->Clear();
|
||||
|
||||
ProgListData *data = (ProgListData *) mCurrentItem->Data;
|
||||
int base = Index << 3;
|
||||
|
||||
for( int i = 0; i < 8; i++ ){
|
||||
mInsPanel->AddItem(new TListPanelItem(GM_INSTRUMENT[base + i], DoInsClick));
|
||||
}
|
||||
|
||||
mInsPanel->ResetScroll();
|
||||
|
||||
if( Index==(data->Prog >> 3) )
|
||||
mInsPanel->SelectedItemIndex = data->Prog & 0x07;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TMultiSwitchProgForm::DoInsClick(TListPanel *Sender, int Index)
|
||||
{
|
||||
if( mCurrentItem == NULL )
|
||||
return;
|
||||
|
||||
ProgListData *data = (ProgListData *) mCurrentItem->Data;
|
||||
TProgHandleItem *CurrentItem = mCurrentItem;
|
||||
|
||||
if( data->Channel==9 ){
|
||||
data->Prog = g_lstFonts[g_idFont]->aDrums[Index].id;
|
||||
CurrentItem->Caption = data->Caption + L"*";
|
||||
}
|
||||
else{
|
||||
int type = mInsTypePanel->SelectedItemIndex;
|
||||
int ins = Index;
|
||||
data->Prog = ( type << 3 ) + ins;
|
||||
|
||||
if( data->ProgBak == data->Prog )
|
||||
CurrentItem->Caption = String(GM_INSTRUMENT[data->Prog]);
|
||||
else
|
||||
CurrentItem->Caption = String(GM_INSTRUMENT[data->Prog]) + L"*";
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TMultiSwitchProgForm::DoReset(TObject *Sender)
|
||||
{
|
||||
for( int i = 0; i < mProgListPanel->TopLevelItemCount; i++ ){
|
||||
TProgHandleItem *Item = mProgListPanel->GetTopLevelItem(i);
|
||||
ProgListData *data = (ProgListData *)Item->Data;
|
||||
|
||||
if( data->Prog != data->ProgBak ){
|
||||
data->Prog = data->ProgBak;
|
||||
|
||||
Item->Caption = data->Channel==9 ? data->Caption : String( GM_INSTRUMENT[data->Prog] );
|
||||
}
|
||||
}
|
||||
|
||||
DoProListSelect( NULL );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TMultiSwitchProgForm::DoOkClick(TObject *Sender)
|
||||
{
|
||||
for(int pIndex = 0; pIndex < this->mProgListPanel->TopLevelItemCount; pIndex++) {
|
||||
TProgHandleItem *pItem = mProgListPanel->GetTopLevelItem(pIndex);
|
||||
|
||||
ProgListData *pData = (ProgListData *)pItem->Data;
|
||||
|
||||
for(int cIndex = 0; cIndex < pItem->ChildCount; cIndex++) {
|
||||
TProgHandleItem *cItem = pItem->Child(cIndex);
|
||||
|
||||
ProgItemData *cData = (ProgItemData *)cItem->Data;
|
||||
|
||||
//TTrackItem *TrackItem = (TTrackItem *)cData->Item;
|
||||
|
||||
if(cItem->IsChecked) {
|
||||
for(int dIndex = 0; dIndex < pData->List->Count; dIndex++) {
|
||||
ProgItemData *itemData = (ProgItemData *)pData->List->Items[dIndex];
|
||||
if(itemData->Caption == cData->Caption) {
|
||||
TTrackItem *pTrack = (TTrackItem *)itemData->Item;
|
||||
if( pTrack->pTrack->iProg !=pData->Prog ){
|
||||
pTrack->pTrack->iProg = pData->Prog;
|
||||
ItemChange->Add(pTrack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ModalResult = mrOk;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TMultiSwitchProgForm::FormShow(TObject *Sender)
|
||||
{
|
||||
if( mProgListPanel->TopLevelItemCount>0 ){
|
||||
TProgHandleItem *pItem = mProgListPanel->GetTopLevelItem( 0 );
|
||||
mProgListPanel->DoSelectedItem( pItem );
|
||||
pItem->IsSelected = true;
|
||||
}
|
||||
else{
|
||||
mOKButton->Enabled = false;
|
||||
mResetButton->Enabled = false;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TMultiSwitchProgForm::FormCreate(TObject *Sender)
|
||||
{
|
||||
GeneralDialogPanel->Font->Name = g_strTxtFontName;
|
||||
GeneralDialogPanel->Font->Size = g_szFont9;
|
||||
|
||||
// mResetButton->FontName = g_strTxtFontName;
|
||||
mResetButton->FontSize = g_szFont9;
|
||||
// mCancelButton->FontName = g_strTxtFontName;
|
||||
mCancelButton->FontSize = g_szFont9;
|
||||
// mOKButton->FontName = g_strTxtFontName;
|
||||
mOKButton->FontSize = g_szFont9;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
object MultiSwitchProgForm: TMultiSwitchProgForm
|
||||
Left = 0
|
||||
Top = 0
|
||||
BorderStyle = bsNone
|
||||
Caption = 'MultiSwitchProgForm'
|
||||
ClientHeight = 337
|
||||
ClientWidth = 460
|
||||
Color = 5064257
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
Position = poMainFormCenter
|
||||
Scaled = False
|
||||
OnCreate = FormCreate
|
||||
OnShow = FormShow
|
||||
TextHeight = 13
|
||||
object GeneralDialogPanel: TGeneralDialogPanel
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 460
|
||||
Height = 337
|
||||
Caption = #25209#37327#26356#25442#38899#33394'/'#20048#22120
|
||||
Color = 5064257
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentBackground = False
|
||||
ParentFont = False
|
||||
TabOrder = 0
|
||||
object mResetButton: TTextButton
|
||||
Left = 206
|
||||
Top = 294
|
||||
Width = 75
|
||||
Height = 25
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
OnClick = DoReset
|
||||
Text = #37325#32622
|
||||
end
|
||||
object mCancelButton: TTextButton
|
||||
Left = 368
|
||||
Top = 294
|
||||
Width = 75
|
||||
Height = 25
|
||||
ModalResult = mrCancel
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
Text = #21462#28040
|
||||
end
|
||||
object mOKButton: TTextButton
|
||||
Left = 287
|
||||
Top = 294
|
||||
Width = 75
|
||||
Height = 25
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
OnClick = DoOkClick
|
||||
Text = #30830#23450
|
||||
end
|
||||
object m_ShapeCur: TShape
|
||||
Left = 16
|
||||
Top = 37
|
||||
Width = 160
|
||||
Height = 21
|
||||
Brush.Color = 2433053
|
||||
Pen.Color = 8092539
|
||||
end
|
||||
object m_lbCurProg: TLabel
|
||||
Left = 69
|
||||
Top = 39
|
||||
Width = 48
|
||||
Height = 14
|
||||
Caption = #24403#21069#20048#22120
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 13613739
|
||||
Font.Height = -12
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
end
|
||||
object m_ShapType: TShape
|
||||
Left = 182
|
||||
Top = 37
|
||||
Width = 120
|
||||
Height = 21
|
||||
Brush.Color = 2433053
|
||||
Pen.Color = 8092539
|
||||
end
|
||||
object m_ShapeProg: TShape
|
||||
Left = 317
|
||||
Top = 37
|
||||
Width = 120
|
||||
Height = 21
|
||||
Brush.Color = 2433053
|
||||
Pen.Color = 8092539
|
||||
end
|
||||
object m_lbProg: TLabel
|
||||
Left = 362
|
||||
Top = 39
|
||||
Width = 24
|
||||
Height = 14
|
||||
Caption = #20048#22120
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 13613739
|
||||
Font.Height = -12
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
end
|
||||
object m_lbType: TLabel
|
||||
Left = 234
|
||||
Top = 39
|
||||
Width = 24
|
||||
Height = 14
|
||||
Caption = #31867#21035
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = 13613739
|
||||
Font.Height = -12
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,105 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef MultiSwitchProgFormUnitH
|
||||
#define MultiSwitchProgFormUnitH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <System.Classes.hpp>
|
||||
#include <Vcl.Controls.hpp>
|
||||
#include <Vcl.StdCtrls.hpp>
|
||||
#include <Vcl.Forms.hpp>
|
||||
#include <Vcl.ExtCtrls.hpp>
|
||||
|
||||
#include "ProgHandlePanel.h"
|
||||
#include "PNGButton.hpp"
|
||||
#include "GeneralDialogPanel.h"
|
||||
#include "GlobalUnit.h"
|
||||
#include "StyleItem.h"
|
||||
#include "ListPanel.h"
|
||||
#include "Instruments.h"
|
||||
#include "TextButton.h"
|
||||
//---------------------------------------------------------------------------
|
||||
class ProgListData : public TObject
|
||||
{
|
||||
public:
|
||||
int Prog;
|
||||
int Channel;
|
||||
int ProgBak;
|
||||
String Caption;
|
||||
TList *List;
|
||||
|
||||
__fastcall ProgListData(String Cap, int pr, int ch) {
|
||||
Caption = Cap;
|
||||
Prog = pr;
|
||||
ProgBak = pr;
|
||||
Channel = ch;
|
||||
List = new TList();
|
||||
}
|
||||
|
||||
__fastcall ~ProgListData(){
|
||||
if(List) {
|
||||
List->Clear();
|
||||
delete List;
|
||||
List = NULL;
|
||||
}
|
||||
}
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
class ProgItemData : public TObject
|
||||
{
|
||||
public:
|
||||
String Caption;
|
||||
TCommonItem *Item;
|
||||
|
||||
__fastcall ProgItemData(String Cap, TCommonItem *it) {
|
||||
Caption = Cap;
|
||||
Item = it;
|
||||
}
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
class TMultiSwitchProgForm : public TForm
|
||||
{
|
||||
__published: // IDE-managed Components
|
||||
TGeneralDialogPanel *GeneralDialogPanel;
|
||||
TTextButton *mResetButton;
|
||||
TTextButton *mCancelButton;
|
||||
TTextButton *mOKButton;
|
||||
TLabel *m_lbCurProg;
|
||||
TShape *m_ShapeCur;
|
||||
TLabel *m_lbType;
|
||||
TShape *m_ShapType;
|
||||
TLabel *m_lbProg;
|
||||
TShape *m_ShapeProg;
|
||||
void __fastcall DoReset(TObject *Sender);
|
||||
void __fastcall DoOkClick(TObject *Sender);
|
||||
void __fastcall FormShow(TObject *Sender);
|
||||
void __fastcall FormCreate(TObject *Sender);
|
||||
private: // User declarations
|
||||
TProgHandlePanel *mProgListPanel;
|
||||
TListPanel *mInsTypePanel;
|
||||
TListPanel *mInsPanel;
|
||||
|
||||
TProgHandleItem *mCurrentItem;
|
||||
|
||||
TList *mData;
|
||||
|
||||
TCommonItem *m_pItem;
|
||||
|
||||
ProgListData *CheckData( char chan, char prog );
|
||||
|
||||
void __fastcall InitProgListPanel();
|
||||
void __fastcall InitInsTypePanel();
|
||||
void __fastcall InitInsPanel();
|
||||
|
||||
void __fastcall DoProListSelect(TObject *Sender);
|
||||
void __fastcall DoInsTypeClick(TListPanel *Sender, int Index);
|
||||
void __fastcall DoInsClick(TListPanel *Sender, int Index);
|
||||
|
||||
public: // User declarations
|
||||
TList *ItemChange;
|
||||
__fastcall TMultiSwitchProgForm(TComponent* Owner, TCommonItem *pItem);
|
||||
__fastcall ~TMultiSwitchProgForm();
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
extern PACKAGE TMultiSwitchProgForm *MultiSwitchProgForm;
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
@@ -0,0 +1,270 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "NotificationADPanelUnit.h"
|
||||
|
||||
#define PERIOD_AD ( 3*1000 )
|
||||
#define AD_SHOW_NUMBER 1
|
||||
|
||||
#define AD_CHANGE_WIDTH 10
|
||||
#define AD_CHANGE_HEIGHT 6
|
||||
#define AD_CHANGE_HEIGHT_TO_BOTTOM 5
|
||||
#define AD_CHANGE_PIC2PIC 5
|
||||
|
||||
#define AD_PIC_LEFT 0
|
||||
#define AD_PIC_TOP 0
|
||||
#define AD_PIC_WIDTH Width
|
||||
#define AD_PIC_HEIGHT (Height - AD_CHANGE_HEIGHT - 2*AD_CHANGE_HEIGHT_TO_BOTTOM)
|
||||
|
||||
const static COLORREF
|
||||
CLR_BKG = RGB(39, 42, 47);
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
|
||||
__fastcall TNotiADPanel::TNotiADPanel( TComponent* Owner, VCTJSON *VCJsonAD)
|
||||
: Vcl::Extctrls::TPanel( Owner )
|
||||
{
|
||||
m_VCJsonAD = VCJsonAD;
|
||||
m_iIndex = 0;
|
||||
|
||||
m_pADTimer = new TTimer(this);
|
||||
m_pADTimer->Enabled = false;
|
||||
m_pADTimer->Interval = PERIOD_AD;
|
||||
m_pADTimer->OnTimer = NotificationTimerProc;
|
||||
|
||||
this->BevelOuter = bvNone;
|
||||
|
||||
ParentColor = true;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
__fastcall TNotiADPanel::~TNotiADPanel()
|
||||
{
|
||||
if( m_pPaintBoxAD ) { delete m_pPaintBoxAD; m_pPaintBoxAD = NULL; }
|
||||
|
||||
vector<TUrlPaintBox *>::iterator vc_pFindADChange;
|
||||
for( vc_pFindADChange = m_pPBADChange.begin();
|
||||
vc_pFindADChange != m_pPBADChange.end();
|
||||
vc_pFindADChange++ )
|
||||
{
|
||||
if( *vc_pFindADChange ) {
|
||||
delete *vc_pFindADChange;
|
||||
*vc_pFindADChange = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
vector<TPicture *>::iterator vc_pFindPIC;
|
||||
for( vc_pFindPIC = m_vcPIC.begin();
|
||||
vc_pFindPIC != m_vcPIC.end();
|
||||
vc_pFindPIC++ )
|
||||
{
|
||||
if( *vc_pFindPIC ) {
|
||||
delete *vc_pFindPIC;
|
||||
*vc_pFindPIC = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if( m_pADTimer ) { delete m_pADTimer; m_pADTimer = NULL; }
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TNotiADPanel::CreateWnd()
|
||||
{
|
||||
Vcl::Extctrls::TPanel::CreateWnd();
|
||||
|
||||
SetAD();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TNotiADPanel::WMEraseBkgnd(TWMEraseBkgnd &Message)
|
||||
{
|
||||
TRect rect = GetClientRect();
|
||||
|
||||
TCanvas* tempCanvas = new TCanvas;
|
||||
tempCanvas->Handle = Message.DC;
|
||||
|
||||
tempCanvas->Brush->Color = CLR_BKG; //±³¾°ÑÕÉ«
|
||||
tempCanvas->FillRect( rect );
|
||||
|
||||
delete tempCanvas;
|
||||
tempCanvas = NULL;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TNotiADPanel::NotificationTimerProc(TObject* Sender)
|
||||
{
|
||||
TTimer *NotiTimer = (TTimer *)Sender;
|
||||
|
||||
int index = 0;
|
||||
int size = (*m_VCJsonAD).size();
|
||||
|
||||
if( size>AD_SHOW_NUMBER )
|
||||
{
|
||||
if( NotiTimer == m_pADTimer ) {
|
||||
m_iIndex = ( (m_iIndex+1)==size )? 0: (m_iIndex+1);
|
||||
}
|
||||
|
||||
vector<TUrlPaintBox *>::iterator vc_pFindADChange;
|
||||
bool bFind = false;
|
||||
VCTJSON::iterator vc_pFindAD;
|
||||
for( vc_pFindAD = (*m_VCJsonAD).begin(),
|
||||
vc_pFindADChange = m_pPBADChange.begin();
|
||||
vc_pFindAD != (*m_VCJsonAD).end(),
|
||||
vc_pFindADChange != m_pPBADChange.end();
|
||||
vc_pFindADChange++ )
|
||||
{
|
||||
if( index==m_iIndex ) {
|
||||
(*vc_pFindADChange)->State = 1;
|
||||
bFind = true;
|
||||
}else{
|
||||
(*vc_pFindADChange)->State = 0;
|
||||
if( !bFind ) {
|
||||
vc_pFindAD++;
|
||||
}
|
||||
}
|
||||
|
||||
(*vc_pFindADChange)->Invalidate();
|
||||
index++;
|
||||
}
|
||||
|
||||
vector<TPicture *>::iterator vc_pFindPIC = m_vcPIC.begin() + m_iIndex;
|
||||
|
||||
m_pPaintBoxAD->GraphicImg = *vc_pFindPIC;
|
||||
m_pPaintBoxAD->StrUrl = (*vc_pFindAD).strUrl;
|
||||
m_pPaintBoxAD->Invalidate();
|
||||
|
||||
}else {
|
||||
m_pADTimer->Enabled = false;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TNotiADPanel::SetAD()
|
||||
{
|
||||
int adSize = (*m_VCJsonAD).size();
|
||||
|
||||
if( adSize )
|
||||
{
|
||||
int startLoc = Width - adSize*(AD_CHANGE_WIDTH+AD_CHANGE_PIC2PIC)
|
||||
+ AD_CHANGE_PIC2PIC;
|
||||
|
||||
TUrlPaintBox *tmpPB;
|
||||
TPicture *picImg;
|
||||
VCTJSON::iterator vc_pFindAD;
|
||||
for( vc_pFindAD = (*m_VCJsonAD).begin();
|
||||
vc_pFindAD != (*m_VCJsonAD).end();
|
||||
vc_pFindAD++ )
|
||||
{
|
||||
picImg = new TPicture();
|
||||
String name = (*vc_pFindAD).strNamePic;
|
||||
picImg->LoadFromFile( (*vc_pFindAD).strNamePic );
|
||||
m_vcPIC.push_back(picImg);
|
||||
|
||||
if( adSize>1 )
|
||||
{
|
||||
tmpPB = new TUrlPaintBox(this);
|
||||
tmpPB->Parent = this;
|
||||
tmpPB->Width = AD_CHANGE_WIDTH;
|
||||
tmpPB->Height = AD_CHANGE_HEIGHT;
|
||||
tmpPB->Left = startLoc;
|
||||
tmpPB->Top = Height - AD_CHANGE_HEIGHT - AD_CHANGE_HEIGHT_TO_BOTTOM;
|
||||
tmpPB->StateCount = 2;
|
||||
|
||||
tmpPB->OnMouseEnter = ADChangeMouseEnter;
|
||||
tmpPB->OnMouseLeave = ADChangeMouseLeave;
|
||||
|
||||
if( vc_pFindAD == (*m_VCJsonAD).begin() ) {
|
||||
tmpPB->State = 1;
|
||||
}
|
||||
tmpPB->BringToFront();
|
||||
tmpPB->Visible = true;
|
||||
|
||||
startLoc += AD_CHANGE_WIDTH + AD_CHANGE_PIC2PIC;
|
||||
m_pPBADChange.push_back(tmpPB);
|
||||
}
|
||||
}
|
||||
|
||||
vc_pFindAD = (*m_VCJsonAD).begin();
|
||||
m_pPaintBoxAD = new TUrlPaintBox(this);
|
||||
m_pPaintBoxAD->Parent = this;
|
||||
m_pPaintBoxAD->Width = AD_PIC_WIDTH;
|
||||
m_pPaintBoxAD->Height = AD_PIC_HEIGHT;
|
||||
m_pPaintBoxAD->Left = AD_PIC_LEFT;
|
||||
m_pPaintBoxAD->Top = AD_PIC_TOP;
|
||||
m_pPaintBoxAD->OnMouseEnter = PaintBoxMouseEnter;
|
||||
m_pPaintBoxAD->OnMouseLeave = PaintBoxMouseLeave;
|
||||
m_pPaintBoxAD->GraphicImg = *( m_vcPIC.begin() );
|
||||
m_pPaintBoxAD->StrUrl = (*vc_pFindAD).strUrl;
|
||||
m_pPaintBoxAD->Visible = true;
|
||||
}
|
||||
|
||||
m_pADTimer->Enabled = true;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TNotiADPanel::PaintBoxMouseLeave(TObject *Sender)
|
||||
{
|
||||
int adSize = (*m_VCJsonAD).size();
|
||||
if( adSize<=1 ){
|
||||
return;
|
||||
}
|
||||
|
||||
TPoint clientPos = ScreenToClient(Mouse->CursorPos);
|
||||
TUrlPaintBox *tmpPB = (TUrlPaintBox *)Sender;
|
||||
|
||||
if( tmpPB==m_pPaintBoxAD ) {
|
||||
m_pADTimer->Enabled = true;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TNotiADPanel::PaintBoxMouseEnter(TObject *Sender)
|
||||
{
|
||||
int adSize = (*m_VCJsonAD).size();
|
||||
if( adSize<=1 ){
|
||||
return;
|
||||
}
|
||||
|
||||
TUrlPaintBox *tmpPB = (TUrlPaintBox *)Sender;
|
||||
|
||||
if( tmpPB==m_pPaintBoxAD ) {
|
||||
|
||||
m_pADTimer->Enabled = false;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TNotiADPanel::ADChangeMouseEnter(TObject *Sender)
|
||||
{
|
||||
m_pADTimer->Enabled = false;
|
||||
|
||||
TUrlPaintBox *tmpPB = (TUrlPaintBox *)Sender;
|
||||
|
||||
int index = 0;
|
||||
vector<TUrlPaintBox *>::iterator vc_pFindADChange;
|
||||
|
||||
for( vc_pFindADChange = m_pPBADChange.begin();
|
||||
vc_pFindADChange != m_pPBADChange.end();
|
||||
vc_pFindADChange++ )
|
||||
{
|
||||
if( tmpPB==*vc_pFindADChange ) {
|
||||
break;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
|
||||
if( m_iIndex != index ) {
|
||||
m_iIndex = index;
|
||||
NotificationTimerProc(NULL);
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TNotiADPanel::ADChangeMouseLeave(TObject *Sender)
|
||||
{
|
||||
m_pADTimer->Enabled = true;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef NotificationADPanelUnitH
|
||||
#define NotificationADPanelUnitH
|
||||
//---------------------------------------------------------------------------
|
||||
#include "NotificationExUnit.h"
|
||||
#include <Vcl.Imaging.pngimage.hpp>
|
||||
#include <Vcl.Imaging.pnglang.hpp>
|
||||
#include <Vcl.Graphics.hpp>
|
||||
#include "PNGButton.hpp"
|
||||
//---------------------------------------------------------------------------
|
||||
typedef vector<TUrlLabel*> VCURLLABEL;
|
||||
|
||||
class TNotiADPanel : public Vcl::Extctrls::TPanel
|
||||
{
|
||||
private:
|
||||
VCTJSON *m_VCJsonAD;
|
||||
void __fastcall SetAD();
|
||||
|
||||
int m_iIndex;
|
||||
|
||||
vector<TPicture *> m_vcPIC;
|
||||
|
||||
TUrlPaintBox *m_pPaintBoxAD;
|
||||
void __fastcall PaintBoxMouseEnter(TObject *Sender);
|
||||
void __fastcall PaintBoxMouseLeave(TObject *Sender);
|
||||
|
||||
vector<TUrlPaintBox *> m_pPBADChange;
|
||||
void __fastcall ADChangeMouseEnter(TObject *Sender);
|
||||
void __fastcall ADChangeMouseLeave(TObject *Sender);
|
||||
|
||||
TTimer *m_pADTimer;
|
||||
void __fastcall NotificationTimerProc(TObject* Sender);
|
||||
|
||||
|
||||
virtual void __fastcall CreateWnd();
|
||||
MESSAGE void __fastcall WMEraseBkgnd(TWMEraseBkgnd &Message);
|
||||
|
||||
BEGIN_MESSAGE_MAP
|
||||
MESSAGE_HANDLER(WM_ERASEBKGND, TWMEraseBkgnd, WMEraseBkgnd)
|
||||
END_MESSAGE_MAP( Vcl::Extctrls::TPanel )
|
||||
|
||||
public:
|
||||
__fastcall TNotiADPanel( TComponent* Owner, VCTJSON *VCJsonAD);
|
||||
__fastcall ~TNotiADPanel();
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
@@ -0,0 +1,535 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
#include "NotificationContentPanelUnit.h"
|
||||
|
||||
#pragma package(smart_init)
|
||||
//---------------------------------------------------------------------------
|
||||
#define SCOLLBAR_WIDTH (14)
|
||||
#define TOP_BUTTOM (10)
|
||||
#define LEFT_RIGHT (SCOLLBAR_WIDTH + 20)
|
||||
#define LINE_HEIGHT (25)
|
||||
|
||||
#define DB_NAME_LINE (2)
|
||||
#define DB_NAME_HEIGHT (DB_NAME_LINE*LINE_HEIGHT)
|
||||
#define DB_NAME_RECT_LEFT (10)
|
||||
#define DB_NAME_RECT_HEIGHT (20)
|
||||
#define DB_NAME_TEXT_LEFT (5)
|
||||
#define DB_NAME_TEXT_WIDTH (10)
|
||||
|
||||
|
||||
#define PIC_TO_LEFT (LEFT_RIGHT)
|
||||
#define PIC_HEIGHT (45)
|
||||
#define PIC_WIDTH (45)
|
||||
#define PIC_LEFT (LEFT_RIGHT)
|
||||
#define PIC_RIGHT (PIC_LEFT + PIC_WIDTH + LEFT_RIGHT)
|
||||
|
||||
#define LABEL_TO_LEFT (PIC_LEFT)
|
||||
#define LABEL_MAX_WIDTH_PIC (Width - PIC_RIGHT - LEFT_RIGHT)
|
||||
#define LABEL_MAX_WIDTH (Width - LABEL_TO_LEFT - LEFT_RIGHT)
|
||||
#define LABEL_HEIGHT (PIC_HEIGHT/2)
|
||||
|
||||
const static COLORREF
|
||||
CLR_TXT_HOT = RGB(171, 186, 207),
|
||||
CLR_CONTENT_BKG = RGB(56, 61, 67),
|
||||
CLR_CONTENT_DB_NAME_BKG = RGB(47, 50, 56),
|
||||
CLR_CONTENT_DB_NAME_FRAME = RGB(32, 35, 39),
|
||||
CLR_CONTENT_DB_LINE_DARK = RGB(32, 35, 39),
|
||||
CLR_CONTENT_DB_LINE_LIGHT = RGB(76, 81, 87);
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
__fastcall TNotiContenPanel::TNotiContenPanel( TComponent* Owner, VCTJSONDB *VCJsonContent)
|
||||
: Vcl::Extctrls::TPanel( Owner )
|
||||
{
|
||||
ParentColor = true;
|
||||
|
||||
m_VCJsonContent = VCJsonContent;
|
||||
m_ScrollBar = NULL;
|
||||
m_iTopLine =0;
|
||||
m_iShowLine = 1;
|
||||
SetContent();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TNotiContenPanel::CreateWnd()
|
||||
{
|
||||
Vcl::Extctrls::TPanel::CreateWnd();
|
||||
|
||||
SetShowLine();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
__fastcall TNotiContenPanel::~TNotiContenPanel()
|
||||
{
|
||||
if( m_ScrollBar ){
|
||||
delete m_ScrollBar;
|
||||
m_ScrollBar = NULL;
|
||||
}
|
||||
|
||||
vector<TPicture *>::iterator vc_pFindPIC;
|
||||
for( vc_pFindPIC = ItemPIC.begin();
|
||||
vc_pFindPIC != ItemPIC.end();
|
||||
vc_pFindPIC++ )
|
||||
{
|
||||
if( *vc_pFindPIC ) {
|
||||
delete *vc_pFindPIC;
|
||||
*vc_pFindPIC = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
vector<VCURLLABEL*>::iterator vc_pFindItemLabel;
|
||||
for( vc_pFindItemLabel = ItemLabel.begin();
|
||||
(vc_pFindItemLabel != ItemLabel.end());
|
||||
vc_pFindItemLabel++ )
|
||||
{
|
||||
vector<TUrlLabel*>::iterator vc_pFindLabel;
|
||||
VCURLLABEL* vcLabel = *vc_pFindItemLabel;
|
||||
|
||||
for( vc_pFindLabel = (*vcLabel).begin();
|
||||
vc_pFindLabel!= (*vcLabel).end();
|
||||
vc_pFindLabel++ )
|
||||
{
|
||||
if( *vc_pFindLabel ) {
|
||||
delete *vc_pFindLabel;
|
||||
*vc_pFindLabel = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TNotiContenPanel::WMEraseBkgnd(TWMEraseBkgnd &Message)
|
||||
{
|
||||
TRect rect = GetClientRect();
|
||||
|
||||
TCanvas* tempCanvas = new TCanvas;
|
||||
tempCanvas->Handle = Message.DC;
|
||||
|
||||
tempCanvas->Brush->Color = CLR_CONTENT_BKG; //背景颜色
|
||||
tempCanvas->FillRect( rect );
|
||||
|
||||
delete tempCanvas;
|
||||
tempCanvas = NULL;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TNotiContenPanel::WMVScroll(Winapi::Messages::TWMScroll &Message)
|
||||
{
|
||||
int minpos, maxpos, page, curpos;
|
||||
m_ScrollBar->GetScrollRange(&minpos, &maxpos);
|
||||
page = m_ScrollBar->GetPageSize();
|
||||
// Get the current position of scroll box.
|
||||
curpos = m_ScrollBar->GetScrollPos();
|
||||
|
||||
// Determine the new position of scroll box.
|
||||
switch (Message.ScrollCode)
|
||||
{
|
||||
case SB_TOP: // Scroll to far top.
|
||||
curpos = minpos;
|
||||
break;
|
||||
|
||||
case SB_BOTTOM: // Scroll to far bottom.
|
||||
curpos = maxpos-page+1;
|
||||
break;
|
||||
|
||||
case SB_ENDSCROLL: // End scroll.
|
||||
break;
|
||||
|
||||
case SB_LINEUP: // Scroll left.
|
||||
if (curpos > minpos)
|
||||
curpos--;
|
||||
break;
|
||||
|
||||
case SB_LINEDOWN: // Scroll right.
|
||||
if (curpos < maxpos-page+1)
|
||||
curpos++;
|
||||
break;
|
||||
|
||||
case SB_PAGEUP: // Scroll one page left.
|
||||
if (curpos > minpos)
|
||||
curpos = (minpos > curpos-page) ? minpos : curpos-page;
|
||||
//max(minpos, curpos-page);
|
||||
break;
|
||||
|
||||
case SB_PAGEDOWN: // Scroll one page right.
|
||||
if( curpos<maxpos )
|
||||
curpos = (maxpos-page+1 < curpos+page) ? maxpos-page+1 : curpos+page;
|
||||
//min(maxpos-page+1, curpos+page);
|
||||
break;
|
||||
|
||||
case SB_THUMBPOSITION: // Scroll to absolute position. nPos is the position
|
||||
curpos = Message.Pos; // of the scroll box at the end of the drag operation.
|
||||
break;
|
||||
|
||||
case SB_THUMBTRACK: // Drag scroll box to specified position. nPos is the
|
||||
curpos = Message.Pos; // position that the scroll box has been dragged to.
|
||||
break;
|
||||
}
|
||||
|
||||
// Set the new position of the thumb (scroll box).
|
||||
if( Message.ScrollBar!=m_ScrollBar->Handle ){
|
||||
m_ScrollBar->SetPosition(curpos);
|
||||
// Paint();
|
||||
}
|
||||
if( m_iTopLine != curpos ){
|
||||
m_iTopLine = curpos;
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
Message.Result = true;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TNotiContenPanel::WMMouseWheel(TWMMouseWheel &Message)
|
||||
{
|
||||
if( m_ScrollBar->Visible ){
|
||||
UINT nSBCode;
|
||||
|
||||
if( Message.WheelDelta>0 ) nSBCode = SB_LINEUP;
|
||||
else nSBCode = SB_LINEDOWN;
|
||||
|
||||
Perform( WM_VSCROLL, MAKELONG(nSBCode,0), NULL );
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TNotiContenPanel::SetContent()
|
||||
{
|
||||
bool bPicExist, bLabelExist;
|
||||
VCTJSONDB::iterator vc_pFindContent;
|
||||
for( vc_pFindContent = (*m_VCJsonContent).begin();
|
||||
vc_pFindContent != (*m_VCJsonContent).end();
|
||||
vc_pFindContent++)
|
||||
{
|
||||
int dbNum = 0;
|
||||
VCTJSON::iterator vc_pFindContentPIC;
|
||||
for( vc_pFindContentPIC = (*vc_pFindContent).vcContent.begin();
|
||||
vc_pFindContentPIC != (*vc_pFindContent).vcContent.end();
|
||||
vc_pFindContentPIC++)
|
||||
{
|
||||
bPicExist = bLabelExist = false;
|
||||
//===========图片信息
|
||||
TPicture *picImg = NULL;
|
||||
TUrlPaintBox *tmpPicDraw = NULL;
|
||||
String strExit = (*vc_pFindContentPIC).strNamePic;
|
||||
if( strExit.Length() ) {
|
||||
|
||||
picImg = new TPicture();
|
||||
picImg->LoadFromFile( strExit );
|
||||
bPicExist = true;
|
||||
|
||||
if( bPicExist ) {
|
||||
tmpPicDraw = new TUrlPaintBox(this);
|
||||
tmpPicDraw->Parent = this;
|
||||
tmpPicDraw->GraphicImg = picImg;
|
||||
tmpPicDraw->StrUrl = (*vc_pFindContentPIC).strUrl;
|
||||
tmpPicDraw->Visible = true;
|
||||
}
|
||||
}
|
||||
ItemPIC.push_back( picImg );
|
||||
ItemPICDraw.push_back( tmpPicDraw );
|
||||
|
||||
//===========文字信息
|
||||
VCURLLABEL *tmpVCUrlLabel = new VCURLLABEL();
|
||||
|
||||
//链接信息
|
||||
TUrlLabel *tmpLabel = CreateLabel((*vc_pFindContentPIC).strName,
|
||||
(*vc_pFindContentPIC).strUrl);
|
||||
if( tmpLabel!=NULL ) {
|
||||
tmpVCUrlLabel->push_back(tmpLabel);
|
||||
bLabelExist = true;
|
||||
}
|
||||
|
||||
//说明信息
|
||||
tmpLabel = CreateLabel((*vc_pFindContentPIC).strAuthor, L"");
|
||||
if( tmpLabel!=NULL ) {
|
||||
tmpVCUrlLabel->push_back(tmpLabel);
|
||||
bLabelExist = true;
|
||||
}
|
||||
|
||||
if( !bLabelExist) { //如果说明不存在
|
||||
ItemPIC.pop_back();
|
||||
ItemPICDraw.pop_back();
|
||||
if( picImg ) { delete picImg; picImg=NULL;};
|
||||
if( tmpPicDraw ) { delete tmpPicDraw; tmpPicDraw=NULL;};
|
||||
if( tmpVCUrlLabel ) { delete tmpVCUrlLabel; tmpVCUrlLabel=NULL;};
|
||||
}else {
|
||||
ItemLabel.push_back(tmpVCUrlLabel);
|
||||
dbNum++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//===========类型信息
|
||||
if( bLabelExist ) {
|
||||
|
||||
ItemDBName.push_back((*vc_pFindContent).strDbName);
|
||||
ItemDBNameNum.push_back(dbNum);
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
TUrlLabel* __fastcall TNotiContenPanel::CreateLabel(String caption, String url)
|
||||
{
|
||||
TUrlLabel *tmpUrlLabel;
|
||||
if( caption.Length() ) {
|
||||
tmpUrlLabel = new TUrlLabel(this);
|
||||
tmpUrlLabel->Parent = this;
|
||||
tmpUrlLabel->Caption = caption;
|
||||
tmpUrlLabel->StrUrl = url;
|
||||
}else { tmpUrlLabel=NULL; }
|
||||
|
||||
return tmpUrlLabel;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TNotiContenPanel::CutOffLabelString()
|
||||
{
|
||||
int maxPicExsit = LABEL_MAX_WIDTH_PIC;
|
||||
int maxPicNo = LABEL_MAX_WIDTH;
|
||||
int maxLabelLen;
|
||||
vector<TPicture*>::iterator vc_pFindItemPIC;
|
||||
vector<VCURLLABEL*>::iterator vc_pFindLBItem = ItemLabel.begin();
|
||||
for( vc_pFindLBItem = ItemLabel.begin(),
|
||||
vc_pFindItemPIC = ItemPIC.begin();
|
||||
vc_pFindLBItem != ItemLabel.end(),
|
||||
vc_pFindItemPIC != ItemPIC.end();
|
||||
vc_pFindLBItem++,
|
||||
vc_pFindItemPIC++)
|
||||
{
|
||||
if( (*vc_pFindItemPIC) == NULL ){
|
||||
maxLabelLen = maxPicNo;
|
||||
}else{
|
||||
maxLabelLen = maxPicExsit;
|
||||
}
|
||||
|
||||
vector<TUrlLabel*>::iterator vc_pFindLabel;
|
||||
VCURLLABEL* vcLabel = *vc_pFindLBItem;
|
||||
|
||||
for( vc_pFindLabel = (*vcLabel).begin();
|
||||
vc_pFindLabel!= (*vcLabel).end();
|
||||
vc_pFindLabel++)
|
||||
{
|
||||
String caption = (*vc_pFindLabel)->Caption;
|
||||
TSize size = Canvas->TextExtent( caption );
|
||||
int nLen = caption.Length();
|
||||
if( size.Width >= maxLabelLen )
|
||||
{
|
||||
nLen = nLen*(maxLabelLen)/size.Width;
|
||||
nLen -= 1;
|
||||
|
||||
if(nLen <= 0){
|
||||
caption = caption.SubString(0, 1);
|
||||
}else{
|
||||
caption = caption.SubString(0, nLen);
|
||||
caption += "..";
|
||||
}
|
||||
|
||||
(*vc_pFindLabel)->Caption = caption;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
int __fastcall TNotiContenPanel::GetLineNumber()
|
||||
{
|
||||
int linePIC;
|
||||
int linePICExist = (PIC_HEIGHT%LINE_HEIGHT==0)?(PIC_HEIGHT/LINE_HEIGHT):
|
||||
((PIC_HEIGHT/LINE_HEIGHT)+1);
|
||||
int lineLabel = 0;
|
||||
int lineNumber = 0;
|
||||
|
||||
vector<TPicture*>::iterator vc_pFindItemPIC;
|
||||
vector<VCURLLABEL*>::iterator vc_pFindItemLabel;
|
||||
for( vc_pFindItemLabel =ItemLabel.begin(),
|
||||
vc_pFindItemPIC = ItemPIC.begin();
|
||||
vc_pFindItemLabel != ItemLabel.end()&&
|
||||
vc_pFindItemPIC != ItemPIC.end();
|
||||
vc_pFindItemLabel++,
|
||||
vc_pFindItemPIC++)
|
||||
{
|
||||
if( (*vc_pFindItemPIC) == NULL ) {
|
||||
linePIC = 0;
|
||||
}else{
|
||||
linePIC = linePICExist;
|
||||
}
|
||||
|
||||
VCURLLABEL* vcLabel = *vc_pFindItemLabel;
|
||||
lineLabel = (*vcLabel).size();
|
||||
|
||||
int lineNumberTmp = lineNumber;
|
||||
// if( linePIC>lineLabel ) {
|
||||
// lineNumber += linePIC;
|
||||
// }else {
|
||||
// lineNumber += lineLabel;
|
||||
// }
|
||||
|
||||
lineNumber += linePICExist;
|
||||
ItemLine.push_back(lineNumber - lineNumberTmp);
|
||||
}
|
||||
|
||||
lineNumber += ItemDBName.size()*DB_NAME_LINE;
|
||||
|
||||
return lineNumber;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TNotiContenPanel::SetShowLine()
|
||||
{
|
||||
CutOffLabelString();
|
||||
|
||||
int totalLine = GetLineNumber();
|
||||
// m_iShowLine = (Height - 2*TOP_BUTTOM)/LINE_HEIGHT;
|
||||
m_iShowLine = Height/LINE_HEIGHT;
|
||||
|
||||
if( totalLine>m_iShowLine ){
|
||||
m_ScrollBar = new TSkinScrollBar(this);
|
||||
m_ScrollBar->m_pWndCtrl = this;
|
||||
m_ScrollBar->Parent = this;
|
||||
m_ScrollBar->Height = Height-2;
|
||||
// m_ScrollBar->Width = SCOLLBAR_WIDTH;
|
||||
m_ScrollBar->Left = Width - m_ScrollBar->Width - 1;
|
||||
m_ScrollBar->Top = 1;
|
||||
m_ScrollBar->SetRange( 0,totalLine-1 );
|
||||
m_ScrollBar->SetPageSize(m_iShowLine);
|
||||
m_ScrollBar->SetPosition( m_iTopLine );
|
||||
m_ScrollBar->Visible = true;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TNotiContenPanel::Paint(void)
|
||||
{
|
||||
int contentHeight = 0;
|
||||
int curX = 0;
|
||||
int curY = 0;
|
||||
int curWidth = 0;
|
||||
int curHeight = 0;
|
||||
int contentStart = -m_iTopLine*LINE_HEIGHT;
|
||||
int dbNum = 0;
|
||||
bool dbNameShow = true;
|
||||
|
||||
vector<int>::iterator vc_pFindItemDBNameNum = ItemDBNameNum.begin();
|
||||
vector<String>::iterator vc_pFindItemDBName = ItemDBName.begin();
|
||||
vector<int>::iterator vc_pFindItemLine;
|
||||
vector<TPicture*>::iterator vc_pFindItemPIC;
|
||||
vector<TUrlPaintBox*>::iterator vc_pFindItemPICDraw;
|
||||
vector<VCURLLABEL*>::iterator vc_pFindItemLabel;
|
||||
|
||||
if( vc_pFindItemDBNameNum == ItemDBNameNum.end()
|
||||
|| vc_pFindItemDBName == ItemDBName.end() )
|
||||
return;
|
||||
|
||||
for( vc_pFindItemLine = ItemLine.begin(),
|
||||
vc_pFindItemPIC = ItemPIC.begin(),
|
||||
vc_pFindItemPICDraw = ItemPICDraw.begin(),
|
||||
vc_pFindItemLabel = ItemLabel.begin();
|
||||
|
||||
(vc_pFindItemLine != ItemLine.end())&&
|
||||
(vc_pFindItemPIC != ItemPIC.end()) &&
|
||||
(vc_pFindItemPICDraw != ItemPICDraw.end()),
|
||||
(vc_pFindItemLabel != ItemLabel.end());
|
||||
|
||||
vc_pFindItemLine++,
|
||||
vc_pFindItemPIC++,
|
||||
vc_pFindItemPICDraw++,
|
||||
vc_pFindItemLabel++ )
|
||||
{
|
||||
if( dbNameShow && dbNum == 0 )
|
||||
{
|
||||
contentHeight = DB_NAME_HEIGHT;
|
||||
|
||||
//类型信息
|
||||
dbNum = (*vc_pFindItemDBNameNum) - 1;
|
||||
|
||||
TSize sizeFont = Canvas->TextExtent((*vc_pFindItemDBName));
|
||||
curX = DB_NAME_RECT_LEFT;
|
||||
curY = contentStart + contentHeight/2 - DB_NAME_RECT_HEIGHT/2;
|
||||
curWidth = sizeFont.Width;
|
||||
curHeight = DB_NAME_RECT_HEIGHT;
|
||||
|
||||
Canvas->Brush->Color = CLR_CONTENT_DB_NAME_BKG;
|
||||
Canvas->FillRect(TRect(curX, curY, curX+curWidth+DB_NAME_TEXT_WIDTH, curY+curHeight));
|
||||
Canvas->Brush->Color = CLR_CONTENT_DB_NAME_FRAME;
|
||||
Canvas->FrameRect(TRect(curX, curY,curX+curWidth+DB_NAME_TEXT_WIDTH, curY+curHeight));
|
||||
|
||||
curX = DB_NAME_RECT_LEFT + DB_NAME_TEXT_LEFT;
|
||||
curY = curY + (DB_NAME_RECT_HEIGHT - sizeFont.Height)/2;
|
||||
Canvas->Font->Color = CLR_TXT_HOT;
|
||||
Canvas->Brush->Style = bsClear;
|
||||
Canvas->TextOutW(curX, curY, (*vc_pFindItemDBName));
|
||||
|
||||
|
||||
if( vc_pFindItemDBName != ItemDBName.end() &&
|
||||
vc_pFindItemDBNameNum != ItemDBNameNum.end())
|
||||
{
|
||||
vc_pFindItemDBName++;
|
||||
vc_pFindItemDBNameNum++;
|
||||
}
|
||||
|
||||
if( vc_pFindItemDBName == ItemDBName.end() ){
|
||||
dbNameShow = false;
|
||||
}
|
||||
|
||||
contentStart += contentHeight;
|
||||
|
||||
}else {
|
||||
dbNum--;
|
||||
}
|
||||
|
||||
//图片
|
||||
contentHeight = (*vc_pFindItemLine)*LINE_HEIGHT;
|
||||
|
||||
curY = contentStart + (contentHeight - PIC_HEIGHT)/2;
|
||||
bool bPicExsit = true;
|
||||
if( (*vc_pFindItemPIC) != NULL ) {
|
||||
curX = PIC_LEFT;
|
||||
curWidth = PIC_HEIGHT;
|
||||
curHeight = PIC_WIDTH;
|
||||
(*vc_pFindItemPICDraw)->SetBounds(curX, curY, curWidth, curHeight);
|
||||
|
||||
// Canvas->StretchDraw( TRect(curX, curY, curX+curWidth, curY+curHeight),
|
||||
// (*vc_pFindItemPIC)->Graphic );
|
||||
}else{
|
||||
bPicExsit = false;
|
||||
}
|
||||
|
||||
//文字说明
|
||||
vector<TUrlLabel*>::iterator vc_pFindLabel;
|
||||
VCURLLABEL* vcLabel = *vc_pFindItemLabel;
|
||||
|
||||
// int labelStart = contentStart + (contentHeight - (*vcLabel).size()*LINE_HEIGHT)/2;
|
||||
int labelStart,lineStart;
|
||||
labelStart = lineStart = curY;
|
||||
|
||||
for( vc_pFindLabel = (*vcLabel).begin();
|
||||
vc_pFindLabel!= (*vcLabel).end();
|
||||
vc_pFindLabel++ )
|
||||
{
|
||||
// if( bPicExsit ) {
|
||||
curX = PIC_RIGHT + (LABEL_MAX_WIDTH_PIC - (*vc_pFindLabel)->Width)/2;
|
||||
// }else{
|
||||
// curX = LABEL_TO_LEFT + (LABEL_MAX_WIDTH - (*vc_pFindLabel)->Width)/2;
|
||||
// }
|
||||
|
||||
curY = labelStart + (LABEL_HEIGHT - (*vc_pFindLabel)->Height)/2;
|
||||
(*vc_pFindLabel)->Left = curX;
|
||||
(*vc_pFindLabel)->Top = curY;
|
||||
labelStart += LABEL_HEIGHT;
|
||||
}
|
||||
lineStart += PIC_HEIGHT;
|
||||
Canvas->Pen->Color = CLR_CONTENT_DB_LINE_DARK;
|
||||
Canvas->MoveTo( PIC_RIGHT, lineStart-1 );
|
||||
Canvas->LineTo( Width-LEFT_RIGHT, lineStart-1 );
|
||||
Canvas->Pen->Color = CLR_CONTENT_DB_LINE_LIGHT;
|
||||
Canvas->MoveTo( PIC_RIGHT, lineStart );
|
||||
Canvas->LineTo( Width-LEFT_RIGHT, lineStart );
|
||||
|
||||
contentStart += contentHeight;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef NotificationContentPanelUnitH
|
||||
#define NotificationContentPanelUnitH
|
||||
#include "SkinScrollBarUnit.h"
|
||||
#include "NotificationExUnit.h"
|
||||
#include "NotificationThreadUnit.h"
|
||||
//---------------------------------------------------------------------------
|
||||
typedef vector<TUrlLabel*> VCURLLABEL;
|
||||
|
||||
class TNotiContenPanel : public Vcl::Extctrls::TPanel
|
||||
{
|
||||
|
||||
private:
|
||||
VCTJSONDB *m_VCJsonContent;
|
||||
|
||||
vector<int> ItemDBNameNum; //一个名字对应的相应个数
|
||||
vector<String> ItemDBName; //类型名字说明
|
||||
vector<int> ItemLine; //一个item图片和文字占用的行数
|
||||
|
||||
vector<TPicture*> ItemPIC;
|
||||
vector<TUrlPaintBox*> ItemPICDraw;
|
||||
|
||||
vector<VCURLLABEL*> ItemLabel; //一张图片可能对应n个文字说明
|
||||
|
||||
int m_iShowLine;
|
||||
int m_iTopLine;
|
||||
|
||||
TSkinScrollBar *m_ScrollBar;
|
||||
|
||||
TUrlLabel* __fastcall CreateLabel(String caption, String url);
|
||||
void __fastcall CutOffLabelString();
|
||||
int __fastcall GetLineNumber();
|
||||
void __fastcall SetShowLine();
|
||||
void __fastcall SetContent();
|
||||
|
||||
virtual void __fastcall CreateWnd();
|
||||
virtual void __fastcall Paint(void);
|
||||
|
||||
MESSAGE void __fastcall WMEraseBkgnd(TWMEraseBkgnd &Message);
|
||||
MESSAGE void __fastcall WMVScroll(Winapi::Messages::TWMScroll &Message);
|
||||
MESSAGE void __fastcall WMMouseWheel(TWMMouseWheel &Message);
|
||||
|
||||
BEGIN_MESSAGE_MAP
|
||||
MESSAGE_HANDLER(WM_ERASEBKGND, TWMEraseBkgnd, WMEraseBkgnd)
|
||||
MESSAGE_HANDLER(WM_VSCROLL, TWMVScroll, WMVScroll)
|
||||
MESSAGE_HANDLER(WM_MOUSEWHEEL, TWMMouseWheel, WMMouseWheel)
|
||||
END_MESSAGE_MAP( Vcl::Extctrls::TPanel )
|
||||
|
||||
public:
|
||||
|
||||
__fastcall TNotiContenPanel( TComponent* Owner, VCTJSONDB *VCJsonContent);
|
||||
__fastcall ~TNotiContenPanel();
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
@@ -0,0 +1,356 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#pragma hdrstop
|
||||
#include <vcl.h>
|
||||
#include "NotificationExUnit.h"
|
||||
#include <System.IOUtils.hpp>
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
|
||||
extern wstring g_strUserPath;
|
||||
|
||||
TJSONObject* __fastcall GetJsonContext(String strContextNoti)
|
||||
{
|
||||
TJSONObject *jsonTmp = new TJSONObject();
|
||||
TBytes StringBytesTmp = TEncoding::UTF8->GetBytes(strContextNoti);
|
||||
jsonTmp = (TJSONObject *)jsonTmp->ParseJSONValue(StringBytesTmp, 0);
|
||||
|
||||
return jsonTmp;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
TJSONObject* __fastcall GetJsonValue(TJSONObject *json, int index)
|
||||
{
|
||||
if( json->Count > index ){
|
||||
String strkey = json->Get(index)->JsonString->Value();
|
||||
return (TJSONObject *)json->GetValue(strkey);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
typedef struct tagBingdingWhere{
|
||||
|
||||
IBinding *bind;
|
||||
int iWhereIs;
|
||||
|
||||
}BingdingWhere;
|
||||
|
||||
typedef vector<BingdingWhere *> VCBingding;
|
||||
VCBingding vc_Bingding;
|
||||
|
||||
void __fastcall StopURLDownload(int iWhereIs)
|
||||
{
|
||||
for(int i=0; i<vc_Bingding.size(); i++) {
|
||||
BingdingWhere *pTmp = vc_Bingding[i];
|
||||
if( iWhereIs==pTmp->iWhereIs ) {
|
||||
if( pTmp->bind ){
|
||||
pTmp->bind->Abort();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CBindCBHttpCallback::OnStartBinding(DWORD dwReserved, IBinding __RPC_FAR *pib)
|
||||
{
|
||||
pib->AddRef();
|
||||
|
||||
for(int i=0; i<vc_Bingding.size(); i++) {
|
||||
BingdingWhere *pTmp = vc_Bingding[i];
|
||||
if(pTmp->iWhereIs==iWhereIs){
|
||||
pTmp->bind->Release();
|
||||
pTmp->bind = pib;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
BingdingWhere *pWhere = new BingdingWhere();
|
||||
pWhere->bind = pib;
|
||||
pWhere->iWhereIs = iWhereIs;
|
||||
vc_Bingding.push_back(pWhere);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CBindCBHttpCallback::OnStopBinding(HRESULT hresult, LPCWSTR szError)
|
||||
{
|
||||
for(int i=0; i<vc_Bingding.size(); i++) {
|
||||
BingdingWhere *pTmp = vc_Bingding[i];
|
||||
if( iWhereIs==pTmp->iWhereIs ) {
|
||||
if( pTmp->bind ){
|
||||
pTmp->bind->Release();
|
||||
pTmp->bind = NULL;
|
||||
}
|
||||
|
||||
delete pTmp;
|
||||
vc_Bingding.erase(vc_Bingding.begin()+i);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
//**********************************************************************
|
||||
//***************************************TUrlLabel
|
||||
//**********************************************************************
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
__fastcall TUrlLabel::TUrlLabel( TComponent* Owner):
|
||||
Vcl::Stdctrls::TLabel( Owner )
|
||||
{
|
||||
FCloseForm = false;
|
||||
|
||||
Transparent = true;
|
||||
ControlStyle>>csOpaque;
|
||||
|
||||
FColorNor = CLR_TEXT_NORMAL;
|
||||
FColorEnt = CLR_TEXT_ENTER;
|
||||
FColorLea = CLR_TEXT_LEAVE;
|
||||
|
||||
Font->Color = FColorNor;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
__fastcall TUrlLabel::~TUrlLabel()
|
||||
{
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TUrlLabel::CMMouseLeave(Winapi::Messages::TMessage &Msg)
|
||||
{
|
||||
if( FStrUrl.Length() ) {
|
||||
Screen->Cursor = crDefault;
|
||||
Font->Color = FColorLea;
|
||||
}
|
||||
|
||||
if( FOnMouseLeave )
|
||||
FOnMouseLeave(this);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TUrlLabel::CMMouseEnter(Winapi::Messages::TMessage &Msg)
|
||||
{
|
||||
if( FStrUrl.Length() ) {
|
||||
Screen->Cursor = crHandPoint;
|
||||
Font->Color = FColorEnt;
|
||||
}else
|
||||
Font->Color = FColorNor;
|
||||
|
||||
if( FOnMouseEnter ) {
|
||||
FOnMouseEnter(this);
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TUrlLabel::Click()
|
||||
{
|
||||
if( StrUrl.Length() ) {
|
||||
ShellExecute(Parent->Handle, NULL, StrUrl.c_str(), NULL, NULL, SW_SHOWNORMAL);
|
||||
if(FCloseForm) {
|
||||
TCustomForm * parentForm = GetParentForm( this );
|
||||
parentForm->Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TUrlLabel::SetStrUrl(String url)
|
||||
{
|
||||
FStrUrl = url;
|
||||
if( FStrUrl.Length() ) {
|
||||
Font->Color = FColorLea;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
//**********************************************************************
|
||||
//***************************************TUrlPaintBox
|
||||
//**********************************************************************
|
||||
//---------------------------------------------------------------------------
|
||||
const COLORREF
|
||||
CLR_AD_CHANGE_NOR = RGB(63, 68, 76),
|
||||
CLR_AD_CHANGE_ENTER = RGB(94, 101, 112);
|
||||
|
||||
#define STATE_NORMAL 0
|
||||
#define STATE_ENTER 1
|
||||
|
||||
__fastcall TUrlPaintBox::TUrlPaintBox( TComponent* Owner, TPicture * graphicImg):
|
||||
Vcl::Extctrls::TPaintBox( Owner )
|
||||
{
|
||||
FCloseForm = false;
|
||||
FState = 0;
|
||||
FStateCount = 1;
|
||||
FIndex = 0;
|
||||
FGraphicImg = graphicImg;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
__fastcall TUrlPaintBox::~TUrlPaintBox()
|
||||
{
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TUrlPaintBox::Click()
|
||||
{
|
||||
if( FStrUrl.Length() ) {
|
||||
ShellExecute(Parent->Handle, NULL, FStrUrl.c_str(), NULL, NULL, SW_SHOWNORMAL);
|
||||
if(FCloseForm) {
|
||||
TCustomForm * parentForm = GetParentForm( this );
|
||||
parentForm->Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TUrlPaintBox::CMMouseEnter(Winapi::Messages::TMessage &Msg)
|
||||
{
|
||||
if( FStrUrl.Length() )
|
||||
Screen->Cursor = crHandPoint;
|
||||
|
||||
if( FOnMouseEnter )
|
||||
FOnMouseEnter(this);
|
||||
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TUrlPaintBox::CMMouseLeave(Winapi::Messages::TMessage &Msg)
|
||||
{
|
||||
if( FStrUrl.Length() )
|
||||
Screen->Cursor = crDefault;
|
||||
|
||||
if( FOnMouseLeave )
|
||||
FOnMouseLeave(this);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TUrlPaintBox::SetGraphicImg(TPicture *GraphicImg)
|
||||
{
|
||||
FGraphicImg = GraphicImg;
|
||||
this->Invalidate();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TUrlPaintBox::SetStrUrl(String strUrl)
|
||||
{
|
||||
FStrUrl = strUrl;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TUrlPaintBox::SetStateCount(int stateCount)
|
||||
{
|
||||
FStateCount = stateCount;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TUrlPaintBox::Paint()
|
||||
{
|
||||
if( GraphicImg ){
|
||||
if( 1< FStateCount )
|
||||
Canvas->Draw((-(FGraphicImg->Width/FStateCount))*FState, 0, FGraphicImg->Graphic);
|
||||
else
|
||||
Canvas->StretchDraw( TRect(0, 0, Width, Height), FGraphicImg->Graphic);
|
||||
}else{
|
||||
if( FState==STATE_NORMAL ){
|
||||
Canvas->Brush->Color = CLR_AD_CHANGE_NOR;
|
||||
}else if( FState==STATE_ENTER ){
|
||||
Canvas->Brush->Color = CLR_AD_CHANGE_ENTER;
|
||||
}
|
||||
Canvas->FillRect(TRect(0, 0, Width, Height));
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
//**********************************************************************
|
||||
//***************************************GetUrlData
|
||||
//**********************************************************************
|
||||
//---------------------------------------------------------------------------
|
||||
HRESULT GetUrlData(String url, String fileDirect, String &fileName, TStringStream *fileToSteam, bool bfileToStream, int iWhereIs)
|
||||
{
|
||||
String BasePath = g_strUserPath.c_str();
|
||||
BasePath += fileDirect;
|
||||
|
||||
fileName = BasePath + fileName;
|
||||
if(!DirectoryExists(BasePath, false))
|
||||
ForceDirectories(BasePath);
|
||||
|
||||
DeleteUrlCacheEntry(url.c_str());
|
||||
|
||||
CBindCBHttpCallback callBack;
|
||||
callBack.iWhereIs = iWhereIs;
|
||||
HRESULT result = URLDownloadToFile(NULL, url.c_str(), fileName.c_str(), 0, &callBack);
|
||||
|
||||
if( result==S_OK )
|
||||
{
|
||||
bool bfileExsit = true;
|
||||
if( !FileExists(fileName) ){
|
||||
result = S_FALSE;
|
||||
fileName = L"";
|
||||
bfileExsit = false;
|
||||
}
|
||||
|
||||
if( bfileToStream )
|
||||
{
|
||||
if( bfileExsit )
|
||||
{
|
||||
if( fileToSteam == NULL ){
|
||||
fileToSteam = new TStringStream(NULL, 65001);
|
||||
}
|
||||
|
||||
fileToSteam->LoadFromFile(fileName);
|
||||
fileToSteam->Position = 0;
|
||||
|
||||
DeleteFile(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
bool __fastcall GetPic(String &name, bool bCopy)
|
||||
{
|
||||
bool bReturn = true;
|
||||
|
||||
TMemoryStream *tmpMemoryStream = new TMemoryStream();
|
||||
tmpMemoryStream->LoadFromFile(name);
|
||||
tmpMemoryStream->Position = 0;
|
||||
WORD wType = 0;
|
||||
tmpMemoryStream->ReadBuffer(&wType, 2);
|
||||
|
||||
String tmpName = name;
|
||||
|
||||
if( wType==0x5089 ){ //png
|
||||
|
||||
name = ChangeFileExt(name, L".png");
|
||||
RenameFile(tmpName, name);
|
||||
|
||||
}else if( wType==0xD8FF ) { //jpg
|
||||
|
||||
name = ChangeFileExt(name, L".jpg");
|
||||
RenameFile(tmpName, name);
|
||||
|
||||
}else if( wType==0x4947 ){
|
||||
|
||||
name = ChangeFileExt(name, L".gif");
|
||||
RenameFile(tmpName, name);
|
||||
|
||||
}else{
|
||||
bReturn = false;
|
||||
}
|
||||
|
||||
if( tmpMemoryStream )
|
||||
delete tmpMemoryStream;
|
||||
|
||||
if( bReturn && bCopy)
|
||||
CopyFile(name.c_str(), tmpName.c_str(), true);
|
||||
|
||||
return bReturn;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,175 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef NotificationExUnitH
|
||||
#define NotificationExUnitH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <Data.DBXJSON.hpp>
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
#include <System.IOUtils.hpp>
|
||||
#include <Urlmon.h>
|
||||
#include <wininet.h>
|
||||
#pragma comment(lib, "urlmon.lib")
|
||||
#pragma comment(lib, "wininet.lib")
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
#define JSON_PIC_DERICTORY L"temp\\JSON\\"
|
||||
#define JSON_PIC_DERICTORY_AD L"AD\\"
|
||||
#define JSON_PIC_DERICTORY_CONTENT L"CONTENT\\"
|
||||
#define JSON_PIC_DERICTORY_TEXT L"TEXT\\"
|
||||
|
||||
typedef struct tagJson{
|
||||
String strName;
|
||||
String strNamePic;
|
||||
String strFileUrl;
|
||||
String strUrl;
|
||||
String strAuthor;
|
||||
}TJSON, *PTJSON;
|
||||
typedef vector<TJSON> VCTJSON;
|
||||
typedef vector<PTJSON> VCPTJSON;
|
||||
//extern VCTJSON::iterator vc_pFindAD;
|
||||
//extern VCTJSON::iterator vc_pFindNoti;
|
||||
|
||||
typedef struct tagJsonDB{ //ͬÀàÐ͵Ä
|
||||
String strDbName;
|
||||
VCTJSON vcContent;
|
||||
}TJSONDB, *PTJSONDB;
|
||||
typedef vector<TJSONDB> VCTJSONDB;
|
||||
typedef vector<PTJSONDB> VCPTJSONDB;
|
||||
|
||||
//extern VCTJSONDB::iterator vc_pFindContent;
|
||||
//extern VCTJSON::iterator vc_pFindContentPIC;
|
||||
|
||||
TJSONObject* __fastcall GetJsonContext(String strContextNoti);
|
||||
TJSONObject* __fastcall GetJsonValue(TJSONObject *json, int index);
|
||||
//---------------------------------------------------------------------------
|
||||
static const COLORREF
|
||||
CLR_TEXT_NORMAL = RGB( 156, 170, 189 ),
|
||||
CLR_TEXT_ENTER = RGB( 100, 180, 236 ),
|
||||
CLR_TEXT_LEAVE = RGB( 67, 117, 233 );
|
||||
//---------------------------------------------------------------------------
|
||||
#define UrlDown_Notification 0
|
||||
#define UrlDown_ImageCover 1
|
||||
|
||||
void __fastcall StopURLDownload(int iWhereIs=UrlDown_Notification);
|
||||
|
||||
class CBindCBHttpCallback : public IBindStatusCallback
|
||||
{
|
||||
public:
|
||||
CBindCBHttpCallback(){};
|
||||
~CBindCBHttpCallback(){};
|
||||
|
||||
STDMETHOD(OnStartBinding)(DWORD dwReserved, IBinding __RPC_FAR *pib);
|
||||
STDMETHOD(OnStopBinding)(HRESULT hresult, LPCWSTR szError);
|
||||
|
||||
STDMETHOD(OnProgress)(ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode,
|
||||
LPCWSTR wszStatusText)
|
||||
{ return E_NOTIMPL; }
|
||||
STDMETHOD(GetPriority)(LONG __RPC_FAR *pnPriority)
|
||||
{ return E_NOTIMPL; }
|
||||
STDMETHOD(OnLowResource)(DWORD reserved)
|
||||
{ return E_NOTIMPL; }
|
||||
STDMETHOD(GetBindInfo)(DWORD __RPC_FAR *grfBINDF, BINDINFO __RPC_FAR *pbindinfo)
|
||||
{ return E_NOTIMPL; }
|
||||
STDMETHOD(OnDataAvailable)(DWORD grfBSCF, DWORD dwSize, FORMATETC __RPC_FAR *pformatetc,
|
||||
STGMEDIUM __RPC_FAR *pstgmed)
|
||||
{ return E_NOTIMPL; }
|
||||
STDMETHOD(OnObjectAvailable)(REFIID riid, IUnknown __RPC_FAR *punk)
|
||||
{ return E_NOTIMPL; }
|
||||
STDMETHOD_(ULONG,AddRef)()
|
||||
{ return 0; }
|
||||
STDMETHOD_(ULONG,Release)()
|
||||
{ return 0; }
|
||||
STDMETHOD(QueryInterface)(REFIID riid, void __RPC_FAR *__RPC_FAR *ppvObject)
|
||||
{ return E_NOTIMPL; }
|
||||
|
||||
int iWhereIs;
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
class TUrlLabel : public Vcl::Stdctrls::TLabel{
|
||||
|
||||
private:
|
||||
TColor FColorNor;
|
||||
TColor FColorEnt;
|
||||
TColor FColorLea;
|
||||
|
||||
bool FCloseForm;
|
||||
String FStrUrl;
|
||||
void __fastcall SetStrUrl(String url);
|
||||
|
||||
TNotifyEvent FOnMouseEnter;//on mouse enter notify event
|
||||
TNotifyEvent FOnMouseLeave;//on mouse leave notify event
|
||||
|
||||
DYNAMIC void __fastcall Click(void);
|
||||
MESSAGE void __fastcall CMMouseEnter(Winapi::Messages::TMessage &Msg); // to know when mouse is entered
|
||||
MESSAGE void __fastcall CMMouseLeave(Winapi::Messages::TMessage &Msg); // to know when mouse is leaved
|
||||
|
||||
BEGIN_MESSAGE_MAP
|
||||
MESSAGE_HANDLER(CM_MOUSEENTER, TMessage, CMMouseEnter)
|
||||
MESSAGE_HANDLER(CM_MOUSELEAVE, TMessage, CMMouseLeave)
|
||||
END_MESSAGE_MAP(TLabel)
|
||||
public:
|
||||
__fastcall TUrlLabel( TComponent* Owner);
|
||||
__fastcall ~TUrlLabel();
|
||||
|
||||
__published:
|
||||
__property bool CloseForm = {read=FCloseForm, write=FCloseForm, default=false};
|
||||
__property String StrUrl = {read=FStrUrl, write=SetStrUrl};
|
||||
__property System::Classes::TNotifyEvent OnMouseEnter = {read=FOnMouseEnter, write=FOnMouseEnter};
|
||||
__property System::Classes::TNotifyEvent OnMouseLeave = {read=FOnMouseLeave, write=FOnMouseLeave};
|
||||
__property TColor ColorNor = {read=FColorNor, write=FColorNor, default=CLR_TEXT_NORMAL};
|
||||
__property TColor ColorEnt = {read=FColorEnt, write=FColorEnt, default=CLR_TEXT_NORMAL};
|
||||
__property TColor ColorLea = {read=FColorLea, write=FColorLea, default=CLR_TEXT_NORMAL};
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
class TUrlPaintBox : public Vcl::Extctrls::TPaintBox{
|
||||
|
||||
private:
|
||||
String FStrUrl;
|
||||
TPicture *FGraphicImg;
|
||||
bool FCloseForm;
|
||||
int FState;
|
||||
int FStateCount;
|
||||
int FIndex;
|
||||
void __fastcall SetStrGraphicName(String strGraphicName);
|
||||
void __fastcall SetGraphicImg(TPicture *GraphicImg);
|
||||
void __fastcall SetStrUrl(String strUrl);
|
||||
void __fastcall SetStateCount(int stateCount);
|
||||
|
||||
TNotifyEvent FOnMouseEnter;//on mouse enter notify event
|
||||
TNotifyEvent FOnMouseLeave;//on mouse leave notify event
|
||||
|
||||
DYNAMIC void __fastcall Click(void);
|
||||
MESSAGE void __fastcall CMMouseEnter(Winapi::Messages::TMessage &Msg); // to know when mouse is entered
|
||||
MESSAGE void __fastcall CMMouseLeave(Winapi::Messages::TMessage &Msg); // to know when mouse is leaved
|
||||
|
||||
virtual void __fastcall Paint(void);
|
||||
|
||||
BEGIN_MESSAGE_MAP
|
||||
MESSAGE_HANDLER(CM_MOUSEENTER, TMessage, CMMouseEnter)
|
||||
MESSAGE_HANDLER(CM_MOUSELEAVE, TMessage, CMMouseLeave)
|
||||
END_MESSAGE_MAP(TPaintBox)
|
||||
|
||||
public:
|
||||
__fastcall TUrlPaintBox( TComponent* Owner, TPicture * graphicImg=NULL);
|
||||
__fastcall ~TUrlPaintBox();
|
||||
|
||||
__published:
|
||||
__property bool CloseForm = {read=FCloseForm, write=FCloseForm, default=false};
|
||||
__property int State = {read=FState, write=FState, default=0};
|
||||
__property int StateCount = {read=FStateCount, write=SetStateCount, default=1};
|
||||
__property int Index = {read=FIndex, write=FIndex, default=0};
|
||||
__property TPicture *GraphicImg = {read=FGraphicImg, write=SetGraphicImg};
|
||||
__property String StrUrl = {read=FStrUrl, write=SetStrUrl};
|
||||
__property System::Classes::TNotifyEvent OnMouseEnter = {read=FOnMouseEnter, write=FOnMouseEnter};
|
||||
__property System::Classes::TNotifyEvent OnMouseLeave = {read=FOnMouseLeave, write=FOnMouseLeave};
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
bool __fastcall GetPic(String &name, bool bCopy=false);
|
||||
HRESULT GetUrlData(String url, String fileDirect, String &fileName, TStringStream *fileToSteam=NULL, bool bfileToStream=false, int iWhereIs=UrlDown_Notification);
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user