Sophie

Sophie

distrib > Mandriva > 2011.0 > i586 > by-pkgid > f53c6fc016b4649afd106d82f7232fba > files > 41

cmmusic-debug-1.5-3mdv2011.0.i586.rpm

/*! @file
********************************************************************************
<PRE>
Module       : CMMusic
file	     : 
function	 : 
author       : fedorawang
ver	         : v1.5
--------------------------------------------------------------------------------
Copyright    : GPL(General Public License)
--------------------------------------------------------------------------------
</PRE>
*******************************************************************************/
#ifndef UIMGR_H_
#define UIMGR_H_

#include "IManager.h"
#include "LrcMgr.h"
#include "PluginMgr.h"
#include "FileMgr.h"
#include "Helper.h"

#define STD_HEG	7
#define STD_WID	40
#define WIN_CNT	5

#define IDYES	0x00
#define IDNO		0x01
enum EUICmd
{
	eUCNone,
	eUCPrev,
	eUCNext,
	eUCPlay,
	eUCStop,
	eUCMute,
	eUCList,
	eUCMode,
	eUCLrcd,
	eUCPlus,
	eUCKeyMode,
	eUCAbout,
	eUCClrItem,
	eUCUpItem,
	eUCDnItem,
	eUCAddItem,
	eUCDelItem
};
class CUIMgr : public CManager
{
public:
	typedef struct _MENUITEM
	{
		std::string strName;
		std::string strPath;
	}MENUITEM,*LPMENUITEM;
	typedef struct _DELAYEVENT
	{
		std::string strEvent;
		std::string strParam;
	}DELAYEVENT,*LPDELAYEVENT;
public:
	CUIMgr();
	virtual ~CUIMgr();
public:
	virtual int OnMsg(const char* lpszMsg,WPARAM wParam,LPARAM lParam);
	virtual int SendMgrMsg(const char* lpszMsg,WPARAM wParam,LPARAM lParam);
public:
	void PaintLoop();
	void InputLoop();
private:
	void Layout();
	void MouseHint(MEVENT* event);
	void Command(int nCmd);
	void SaveList(const char* lpszFile = NULL);
	void CreateListMenu(WINDOW* win,const char* lpszFile);
	void DestroyListMenu(bool bClear = true);
	void DestroyFileMenu();
	void CreateModeMenu(WINDOW* win);
	void CreateMsgMenu(WINDOW* win);
	void CreatePluginMenu(WINDOW* win);
	//0 means music,1 means list
	void CreateFileMenu(WINDOW* win);
	void MenuToSel(int nSel);
	bool CheckAutoNext();
	void PrintLrc(const char* lpszStr);
	void PrintPlugin(const char* lpszStr);
	void RefreshLrc(float fPos,bool bForce = false);
	void ClearLrc();
	void ReSize(bool bForce = false);
	void PrintAbout();
	std::string Float2Time(float fTotalSec);
	std::string GetLrcPath(const char* lpszFile,int nType);
	int MsgBox(const char* lpszCaption,const char* lpszMsg,int nType = 0);
	int getch2(int& ch);
	void DelayRun();
	attr_t GetLrcLight();
	static void* LoopProc(void* pData);
private:
	WINDOW *m_wins[WIN_CNT];
	PANEL *m_panels[WIN_CNT];
	
	MENU *m_menu;
	ITEM **m_items;
	
	MENU *m_modemenu;
	ITEM **m_modeitems;
	
	MENU *m_plusmenu;
	ITEM **m_plusitems;
	
	MENU *m_filemenu;
	ITEM **m_fileitems;
	
	MENU *m_msgmenu;
	ITEM **m_msgitems;
	
	CLrcMgr m_LrcMgr;
	CPluginMgr m_PluginMgr;
	CFileMgr m_FileMgr;
	
	std::vector<MENUITEM> m_vctMenu;
	std::vector<DELAYEVENT> m_vctDelayEvent;
	std::string m_strMode[5];
	std::string m_strMsgItem[2];
	std::string m_strLrcDir;
	std::string m_strInfo;
	std::string m_strName;
	std::string m_strMsgCaption;
	std::string m_strMsgInfo;
	
	time_t m_tSTime;
	time_t m_tRTime;
	
	float m_fTLen;
	float m_fTPos;
	int m_nLastLrcIndex;
	
	bool m_bRun;
	bool m_bPainLock;
	bool m_bPluginLock;
	bool m_bModeLock;
	bool m_bFileLock;
	bool m_bAboutLock;
	bool m_bMsgBoxLock;
	bool m_bPlaying;
	int m_nCurSel;
	int m_nCurMode;
	int m_nLINES;
	int m_nCOLS;
	bool m_bPause;
	int m_nVolum;
	int m_nFileType;
	int m_nLrcLight;
	int m_nKeyMode;
	bool m_bTipScr;
};

#endif /*UIMGR_H_*/