⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wndgraph.h

📁 完整的MP3播放器源码
💻 H
字号:
#if !defined(AFX_WNDGRAPH_H__36F72CC7_D0AB_11D2_B9C5_00600815B1D4__INCLUDED_)
#define AFX_WNDGRAPH_H__36F72CC7_D0AB_11D2_B9C5_00600815B1D4__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// WndGraph.h : header file
//

/////////////////////////////////////////////////////////////////////////////
// CWndGraph window
#define CLOSETO(x,y,z)		(abs(x-y) <= z)
#define MAX_BUFF			12800

class CWndGraph : public CWnd
{
// Construction
public: 
	CWndGraph();
    ~CWndGraph()
    {
        ::DeleteCriticalSection(&CWndGraph::m_cs);
    }
    // Attributes
public:

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CWndGraph)
	//}}AFX_VIRTUAL

// Implementation
public:// sttics

  	static BOOL     RegisterGraphClass();
    static int      PainterThread(void* pData);
    static          Ecs(){::EnterCriticalSection(&m_cs);}
    static          Xcs(){::LeaveCriticalSection(&m_cs);}


   	void    SetSampleAttr(int bits, int stereo,int bps);
	void    ReleasePaint();
	inline void CWndGraph::AddSample(WORD wData)
    {
        static noduloDiv = 0;
        if(m_lastLen > MAX_BUFF)
            return;
        if((++noduloDiv % m_stepIn) == 0)
        {
            *(m_pSwitchIn+m_lastLen++) = wData;
        }
    }

    
	void    Update();
    BOOL    CreateWndw(UINT id, CWnd* pParent);
    void    SetBkColor(COLORREF clrBack);

    static LPCSTR   m_pWndNameG;
    static          CRITICAL_SECTION    m_cs;
    HANDLE          m_hLeavePaint;
    HANDLE          m_hthread;
    HANDLE          m_halive;


	// Generated message map functions
protected:
	//{{AFX_MSG(CWndGraph)
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnDestroy();
	afx_msg void OnPaint();
	afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
	afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
private:
    // scalation
    void    Move(CDC* pdc,int x, int y, COLORREF clrf)
    {
        if(m_mode == 0 )
             pdc->MoveTo(x,y);
        else if(x>=10)
        {
            
            pdc->MoveTo(x,0);
            pdc->LineTo(x,y);
            pdc->LineTo(x+7,y);
            pdc->LineTo(x+7,0);
        }
            
    
    }
    void    Line(CDC* pdc,int x, int y,bool bs = false)
    {
         if(m_mode == 0 )
            pdc->LineTo(x,y);
        
    }


    void    CoordonateIt(CDC* pDC,bool berase = false);
    void    GridIt(CDC *pDC);
    BOOL    CreatePens();
    void    CloseThreadsStuff();
    BOOL    UseThreads();
    typedef enum{NONE,XYH,YH,GH,SSY,SSX,SZ}E_MHOK;
private:
	void    DrawBuffers(CDC* pDC,BOOL bLastBuff = FALSE);
	BOOL    CreateBuffers();
    void    DoFft(WORD* pInBuff, int length);
//Gdi's
    RECT       m_rt;
    HDC        m_hdc;
    CDC*    m_pCDC;
    CPen    m_delPen;
    CPen    m_gridPen;
    CPen    m_axisPen;
    CPen    m_grapgPen;
    E_MHOK  m_iHooked;
    
// colors
    
    COLORREF    m_graphColor;
    COLORREF    m_gridClr;
    COLORREF    m_axisClr;
    COLORREF   m_backColor;
// coord
    
    int         m_xMax, m_yMax,m_xMin,m_yMin;
    int         m_grdStepy, m_grdStepx;
	int			m_framesPerBuf;
	int			m_updateTime;
//
    BOOL        m_slow;
    int         m_xcur, m_ycur;	
    
    BOOL        m_bDown;
//    
    
    
    

    int         m_sampleLen;
    int         m_viewscale;

    int         m_yWndScale,m_xWndScale;
    int         m_xOrigin,m_yOrigin;

    int         m_yWndEx;
    int         m_ymaxUser;    
    int         m_yScaleMouse;
	int			m_lastTime;


    int         m_lastLen; 
    int         m_stepDefault;
    int         m_stepIn;

    WORD*       m_pBDisp;
	WORD*		m_Buff1;
    WORD*		m_Buff2;
    BOOL        m_Loading;
    int         m_l1;
    int         m_l2;
    WORD*		m_pSwitchIn;
    WORD*		m_pSwitchOut;
    WORD*		m_pSwitch;
    WORD*		m_grapPtsBackBuff;
    int         m_bps;
    int         m_sleep;
	int			m_active;
    int         m_mode;
    int         m_stepy;

    int         m_grphStep;
    int         m_fftStep;
    CFont*       m_font;
    TCHAR       m_strStep[32];


    CButton     m_cb;
};

/////////////////////////////////////////////////////////////////////////////


//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.


#endif // !defined(AFX_WNDGRAPH_H__36F72CC7_D0AB_11D2_B9C5_00600815B1D4__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -