📄 videooptions.cpp
字号:
// RenderSoft CamStudio
//
// Copyright 2001 RenderSoft Software & Web Publishing
//
//
// VideoOptions.cpp : implementation file
//
#include "stdafx.h"
#include "vscap.h"
#include "VideoOptions.h"
#include <mmsystem.h>
#include <vfw.h>
#include <stdio.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern int timelapse;
extern int frames_per_second;
extern int keyFramesEvery;
extern int compquality;
extern DWORD compfccHandler;
extern ICINFO * compressor_info;
extern int num_compressor;
extern int selected_compressor;
extern CString strCodec;
/////////////////////////////////////////////////////////////////////////////
// CVideoOptions dialog
CVideoOptions::CVideoOptions(CWnd* pParent /*=NULL*/)
: CDialog(CVideoOptions::IDD, pParent)
{
//{{AFX_DATA_INIT(CVideoOptions)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CVideoOptions::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CVideoOptions)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CVideoOptions, CDialog)
//{{AFX_MSG_MAP(CVideoOptions)
ON_WM_HSCROLL()
ON_BN_CLICKED(ID_ABOUT, OnAbout)
ON_CBN_SELCHANGE(IDC_COMPRESSORS, OnSelchangeCompressors)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CVideoOptions message handlers
void CVideoOptions::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
// TODO: Add your message handler code here and/or call default
int quality;
CString qualitystr;
quality = ((CSliderCtrl *) GetDlgItem(IDC_QUALITY_SLIDER))->GetPos();
qualitystr.Format("%d",quality);
((CStatic *) GetDlgItem(IDC_QUALITY))->SetWindowText(qualitystr);
CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
}
void CVideoOptions::OnOK()
{
// TODO: Add extra validation here
CString fps;
CString keyframes;
CString timelp;
CString qualitystr;
int own_timelapse;
int own_frames_per_second;
int own_keyFramesEvery;
int quality;
((CEdit *) GetDlgItem(IDC_FPS))->GetWindowText(fps);
((CEdit *) GetDlgItem(IDC_KEYFRAMES))->GetWindowText(keyframes);
((CEdit *) GetDlgItem(IDC_KEYFRAMES2))->GetWindowText(timelp);
((CStatic *) GetDlgItem(IDC_QUALITY))->GetWindowText(qualitystr);
//Can into local variables first
sscanf(LPCTSTR(fps),"%d",&own_frames_per_second);
sscanf(LPCTSTR(keyframes),"%d",&own_keyFramesEvery);
sscanf(LPCTSTR(timelp),"%d",&own_timelapse);
sscanf(LPCTSTR(qualitystr),"%d",&quality);
if (own_timelapse<0) {
MessageBox("Timelapse for each frame cannot be less than 0 milliseconds.","Note",MB_OK);
return;
}
if (own_timelapse>7200000) {
MessageBox("Timelapse for each frame cannot be more than 7200000 milliseconds (2 hours).","Note",MB_OK);
return;
}
if ((own_keyFramesEvery<1) || (own_keyFramesEvery>200)) {
char tempstr[300];
sprintf(tempstr,"Key frames cannot be set for every %d frames. Please enter a value in the range 1 to 200.",own_keyFramesEvery);
MessageBox(tempstr,"Note",MB_OK);
return;
}
if ((own_frames_per_second<1) || (own_frames_per_second>200)) {
char tempstr[300];
sprintf(tempstr,"Playback Rate cannot be set to %d frames per second. Please enter a value in the range 1 to 200.",own_frames_per_second);
MessageBox(tempstr,"Note",MB_OK);
return;
}
//Verification Passed..Setting Global Values
timelapse = own_timelapse;
frames_per_second =own_frames_per_second;
keyFramesEvery =own_keyFramesEvery;
compquality = quality * 100;
int sel = ((CComboBox *) GetDlgItem(IDC_COMPRESSORS))->GetCurSel();
if (sel != CB_ERR) {
compfccHandler = compressor_info[sel].fccHandler;
strCodec = CString(compressor_info[sel].szDescription);
selected_compressor = sel;
}
//else
// selected_compressor = -1;
CDialog::OnOK();
}
BOOL CVideoOptions::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
CString fps;
CString keyframes;
CString timelp;
CString qualitystr;
int quality;
quality = compquality/100;
fps.Format("%d",frames_per_second);
keyframes.Format("%d",keyFramesEvery);
timelp.Format("%d",timelapse);
qualitystr.Format("%d",quality);
((CEdit *) GetDlgItem(IDC_FPS))->SetWindowText(fps);
((CEdit *) GetDlgItem(IDC_KEYFRAMES))->SetWindowText(keyframes);
((CEdit *) GetDlgItem(IDC_KEYFRAMES2))->SetWindowText(timelp);
((CStatic *) GetDlgItem(IDC_QUALITY))->SetWindowText(qualitystr);
((CSliderCtrl *) GetDlgItem(IDC_QUALITY_SLIDER))->SetRange(1,100,TRUE);
((CSliderCtrl *) GetDlgItem(IDC_QUALITY_SLIDER))->SetPos(quality);
if (num_compressor>0) {
int sel = -1;
for (int i=0; i<num_compressor;i++) {
CString cname(compressor_info[i].szDescription);
((CComboBox *) GetDlgItem(IDC_COMPRESSORS))->AddString(cname);
if (compfccHandler == compressor_info[i].fccHandler) {
sel = i;
}
}
if (sel == -1)
{
sel = 0;
compfccHandler = compressor_info[sel].fccHandler;
}
((CComboBox *) GetDlgItem(IDC_COMPRESSORS))->SetCurSel(sel);
RefreshCompressorButtons();
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CVideoOptions::RefreshCompressorButtons()
{
int sel = ((CComboBox *) GetDlgItem(IDC_COMPRESSORS))->GetCurSel();
if (sel != CB_ERR) {
HIC hic = ICOpen(compressor_info[sel].fccType, compressor_info[sel].fccHandler, ICMODE_QUERY);
if (hic) {
if (ICQueryAbout(hic))
((CButton *) GetDlgItem(ID_ABOUT))->EnableWindow(TRUE);
else
((CButton *) GetDlgItem(ID_ABOUT))->EnableWindow(FALSE);
//if (ICQueryConfigure(hic))
// ((CButton *) GetDlgItem(ID_CONFIGURE))->EnableWindow(TRUE);
//else
// ((CButton *) GetDlgItem(ID_CONFIGURE))->EnableWindow(FALSE);
ICClose(hic);
}
}
}
void CVideoOptions::OnAbout()
{
// TODO: Add your control notification handler code here
int sel = ((CComboBox *) GetDlgItem(IDC_COMPRESSORS))->GetCurSel();
if (sel != CB_ERR) {
HIC hic = ICOpen(compressor_info[sel].fccType, compressor_info[sel].fccHandler, ICMODE_QUERY);
if (hic) {
ICAbout(hic,m_hWnd);
ICClose(hic);
}
}
}
void CVideoOptions::OnSelchangeCompressors()
{
// TODO: Add your control notification handler code here
RefreshCompressorButtons();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -