Files
2026-06-13 00:05:19 +08:00

184 lines
5.0 KiB
C++

//---------------------------------------------------------------------------
#ifndef StyleItemH
#define StyleItemH
//---------------------------------------------------------------------------
#include "ProCommon.h"
#define SEGTYPE_STYLE -1
#define SEGTYPE_SEGMENT 0x00
#define SEGTYPE_TRACK 0x04
#define COL_FOLD 0x01
#define COL_MUTE 0x01
#define COL_TEXT 0x02
#define COL_OPT 0x04
#define COL_UNDO 0x100
#define OPT_DEL 0x01
#define OPT_DOWNLOAD 0x02
#define OPT_VOL 0x04
#define OPT_BRUSH 0x08
#define OPT_FONTPROG 0x10
#define OPT_TEXTURE 0x20
#define OPT_COLLECT 0x40 //add by laq
#define OPT_SCORE 0x80
#define OPT_SAVE 0x100
#define OPT_IMPORT 0x200
#define OPT_UPLOAD 0x400
#define OPT_CHARGE 0x800
#define OPT_NUM 12
#define OPT_COL_NUM 5
#define GAP_X 4
#define OPTION_HEIGHT 18
#define OPTION_WIDTH 21
#define STATE_FOCUS 0x01
#define STATE_SELECTED 0x02
#define STATE_UNFOLD 0x04
#define STATE_COLLECTED 0x08
#define STATE_MUTED 0x10
#define STATE_UNLOAD 0x20
#define STATE_LOADING 0x40
#define STATE_HOVER 0x80
class TStyleItem;
class TCommonItem
{
public:
WORD dwState; //Focus/Fold/Mute/Selected
char iType; //STYLE/VAR/FILL/INTRO/ENDING/TRACK
WORD iFocusCol; //Fold/文本/删除/还原/音量/音色
System::Classes::TList* aOptions;
System::Classes::TList* aItems;
TCommonItem *prev, *next, *up;
__fastcall TCommonItem();
__fastcall TCommonItem( char iType, DWORD opts=0 );
__fastcall ~TCommonItem();
virtual void __fastcall DrawItem( TCanvas* Canvas, TRect Rect, WORD iCol );
virtual short __fastcall GetColume( int X );
virtual void ClearSubItems();
virtual String GetCaption(){ return ""; };
virtual void AddStyleId( String& strText ){};
virtual char GetSegType(){ return -1; };
virtual char GetSegNo(){ return -1; };
virtual bool IsMute(){ return false; };
virtual void SetMute( bool bSet ){};
virtual COLORREF TextColor();
virtual String HintText(){ return ""; };
virtual bool IsCollected(){ return false; };
DWORD GetOption( int iCol );
void RemoveSubItem( TCommonItem* pSub );
// bool StyleChanged();
bool IsUnfold();
bool IsSelected();
int GetOnlineState();
void SetOnlineState( int iState );
TStyleItem* GetStyleItem();
void __fastcall SetFocus( WORD iCol );
void __fastcall SetUnfold( bool bSet );
void __fastcall Select( bool bSet );
void __fastcall SetHover( bool bSet );
// void __fastcall SetCollect( bool bSet );
};
class TTrackItem : public TCommonItem
{
public:
TPROSTYLE* pStyle; //所属风格信息
TTrack* pTrack;
bool bOwnTrack;
__fastcall TTrackItem();
__fastcall TTrackItem( TCommonItem* pUpItem, TPROSTYLE* info, char stype, char sno,
char ch, char prog, char vol, DWORD opts );
__fastcall TTrackItem( TCommonItem* pUpItem, TPROSTYLE* info, TTrack* pTrk,
DWORD opts, bool bOwn );
__fastcall ~TTrackItem();
void StyleId2Str( String& strText );
virtual String GetCaption();
virtual void AddStyleId( String& strText );
virtual char GetSegType();
virtual char GetSegNo();
virtual bool IsMute();
virtual COLORREF TextColor();
virtual String HintText();
virtual bool IsCollected();
virtual void SetMute( bool bSet );
};
class TSegmentItem : public TCommonItem
{
public:
char iSegType;
char iSegNo;
char iInd;
char volume;
int nBars;
bool bAutoSpec;
bool aChanUsed[16];
__fastcall TSegmentItem();
__fastcall TSegmentItem( TCommonItem* pUpItem, char stype, char sno, DWORD opts,
int bars, char ind, char vol, bool bSpec=true );
TTrackItem* __fastcall AddTrack( TPROSTYLE* info, TTrack* pTrack, DWORD opts, bool bOwn, int iInd=-1 );
TTrackItem* __fastcall AddTrack( TPROSTYLE* info, char sno, char ch, char prog, char vol, DWORD opts );
TTrackItem* __fastcall AddTrack( TPROSTYLE* info, char sn, char tn, DWORD opts, bool bAddLocal );
virtual void ClearSubItems();
virtual char GetSegType(){ return iSegType; };
virtual char GetSegNo(){ return iSegNo; };
virtual String GetCaption();
virtual COLORREF TextColor();
void DeleteTrack( TCommonItem* pTrack );
bool IsChanUsed( char ch ){ return aChanUsed[ch]; };
char GetIndType();
};
class TStyleItem : public TCommonItem
{
public:
TPROSTYLE* pStyle; //原始风格信息
int nBars;
int nSegNum[4];
__fastcall TStyleItem();
__fastcall TStyleItem( TPROSTYLE* info, DWORD opts );
TSegmentItem* __fastcall AddSegment( char stype, char sno, DWORD opts, int bars=0,
char ind=-1, char vol=100, bool bAutoSpec=true );
virtual String GetCaption();
virtual void AddStyleId( String& strText );
virtual String HintText();
virtual bool IsCollected();
void InsertSegment( int ind, TSegmentItem* pSeg, int bars );
void DeleteSegment( TCommonItem* pSeg );
void SetDownload();
void SetImport(); //设置导入MIDI片段
void SetUpload(); //设置上传发布标志
void SetCharge( bool bSet ); //设置收费标记
};
typedef vector<TTrackItem*> TTrackItemList;
typedef vector<TSegmentItem*> TSegmentList;
String GetProgName( BYTE iBank, BYTE iChan, BYTE iProg );
extern TStyleItem *g_pPreStyle,
*g_pUseStyle;
#endif