CriticalDlg.cpp
上传用户:tuheem
上传日期:2007-05-01
资源大小:21889k
文件大小:3k
- // CriticalDlg.cpp : implementation file
- //
- #include "stdafx.h"
- #include "XvidQuantsParser.h"
- #include "CriticalDlg.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CCriticalDlg dialog
- CCriticalDlg::CCriticalDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CCriticalDlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CCriticalDlg)
- m_criticalq = 0;
- //}}AFX_DATA_INIT
- }
- void CCriticalDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CCriticalDlg)
- DDX_Control(pDX, IDC_LIST_CRITICAL, m_listcritical);
- DDX_Text(pDX, IDC_EDIT_CRITICALQ, m_criticalq);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CCriticalDlg, CDialog)
- //{{AFX_MSG_MAP(CCriticalDlg)
- ON_BN_CLICKED(IDC_BUTTON_FETCH, OnButtonFetch)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CCriticalDlg message handlers
- //------------------------------------------------------------------------------------------------
- void CCriticalDlg::Init(CXvid::QUANTS *quants, int nframes)
- {
- nbframes = nframes;
- qarray = quants;
- }
- //------------------------------------------------------------------------------------------------
- BOOL CCriticalDlg::OnInitDialog()
- {
- CDialog::OnInitDialog();
-
- m_listcritical.InsertColumn(0, "Frame",LVCFMT_CENTER, 55);
- m_listcritical.InsertColumn(1, "Type", LVCFMT_CENTER, 40);
- m_listcritical.InsertColumn(2, "Quantizer", LVCFMT_CENTER, 75);
- m_listcritical.InsertColumn(3, "Framesize (bytes)",LVCFMT_LEFT, 125);
-
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- //------------------------------------------------------------------------------------------------
- void CCriticalDlg::OnButtonFetch()
- {
- char index[7], value[3], fsize[9];
- int count = 0;
- UpdateData(TRUE);
- m_listcritical.DeleteAllItems();
- for (int i=0; i<nbframes; i++)
- {
- if (qarray[i].qvalue>m_criticalq)
- {
- sprintf(index, "%d", i);
- sprintf(value, "%dx", qarray[i].qvalue);
- sprintf(fsize, "%d", qarray[i].framesize);
- m_listcritical.InsertItem (count, index);
- if (qarray[i].isIFrame) m_listcritical.SetItemText(count, 1, "IF");
- else m_listcritical.SetItemText(count, 1, "PF");
- m_listcritical.SetItemText(count, 2, value);
- m_listcritical.SetItemText(count, 3, fsize);
- count++;
- }
- }
- if (count == 0)
- {
- AfxMessageBox("No frames above specified quantizer.nSee the Global Quantization: Maximum value.", MB_ICONINFORMATION);
- }
- }