📄 cursoroptionsdlg.cpp
字号:
// RenderSoft CamStudio
//
// Copyright 2001 RenderSoft Software & Web Publishing
//
//
// CursorOptionsDlg.cpp : implementation file
//
#include "stdafx.h"
#include "vscap.h"
//#include <stdio.h>
#include "CursorOptionsDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//Internal Vars..should put into class header
CFileDialog *iconFileDlg;
HCURSOR previewcursor = NULL;
HCURSOR loadcursor;
HCURSOR customcursor;
int customsel;
int recordcursor;
int cursortype;
int highlightcursor;
int highlightsize;
int highlightshape;
COLORREF highlightcolor;
int initpaint=TRUE;
//extern CFileDialog *iconFileDlg;
extern HCURSOR g_loadcursor;
extern HCURSOR g_customcursor;
extern int g_customsel;
extern int g_recordcursor;
extern int g_cursortype;
extern int g_highlightcursor;
extern int g_highlightsize;
extern int g_highlightshape;
extern COLORREF g_highlightcolor;
extern CString cursordir;
extern CString g_cursorFilePath;
DWORD icon_info[] = {
IDI_CUSTOMICON_CONTEXTHELP,
IDI_CUSTOMICON_MAGNIFY,
IDI_CUSTOMICON_NODRAG,
IDI_CUSTOMICON_SPLITBARH,
IDI_CUSTOMICON_SPLITBARV,
IDI_CUSTOMICON_TOPOFTABLE,
IDI_CUSTOMICON_BOOK1,
IDI_CUSTOMICON_BOOK2,
IDI_CUSTOMICON_CLIP1,
IDI_CUSTOMICON_CLIP2,
IDI_CUSTOMICON_CLOCK1,
IDI_CUSTOMICON_CLOCK2,
IDI_CUSTOMICON_CARDFILE1,
IDI_CUSTOMICON_CARDFILE2,
IDI_CUSTOMICON_DISK1,
IDI_CUSTOMICON_DISK2,
IDI_CUSTOMICON_FILES1,
IDI_CUSTOMICON_FILES2,
IDI_CUSTOMICON_FOLDER2,
IDI_CUSTOMICON_FOLDER1,
IDI_CUSTOMICON_MAIL1,
IDI_CUSTOMICON_MAIL2,
IDI_CUSTOMICON_NOTE1,
IDI_CUSTOMICON_NOTE2,
IDI_CUSTOMICON_PEN1,
IDI_CUSTOMICON_PEN2,
IDI_CUSTOMICON_PENCIL1,
IDI_CUSTOMICON_PENCIL2,
IDI_CUSTOMICON_PHONE1,
IDI_CUSTOMICON_PHONE2,
IDI_CUSTOMICON_POINT1,
IDI_CUSTOMICON_POINT2,
IDI_CUSTOMICON_SERCURITY,
IDI_CUSTOMICON_SECURITY2
};
/////////////////////////////////////////////////////////////////////////////
// CCursorOptionsDlg dialog
CCursorOptionsDlg::CCursorOptionsDlg(CWnd* pParent /*=NULL*/)
: CDialog(CCursorOptionsDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CCursorOptionsDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CCursorOptionsDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CCursorOptionsDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CCursorOptionsDlg, CDialog)
//{{AFX_MSG_MAP(CCursorOptionsDlg)
ON_BN_CLICKED(IDC_RADIO1, OnRadio1)
ON_BN_CLICKED(IDC_RADIO2, OnRadio2)
ON_BN_CLICKED(IDC_CURSOR1, OnCursor1)
ON_BN_CLICKED(IDC_CURSOR2, OnCursor2)
ON_BN_CLICKED(IDC_CURSOR3, OnCursor3)
ON_BN_CLICKED(IDC_FILECURSOR, OnFilecursor)
ON_CBN_SELCHANGE(IDC_CUSTOMCURSOR, OnSelchangeCustomcursor)
ON_CBN_SELCHANGE(IDC_HIGHLIGHTSHAPE, OnSelchangeHighlightshape)
ON_BN_CLICKED(IDC_HIGHLIGHTCOLOR, OnHighlightcolor)
ON_BN_CLICKED(IDC_HIGHLIGHTCURSOR, OnHighlightcursor)
ON_WM_HSCROLL()
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCursorOptionsDlg message handlers
void CCursorOptionsDlg::OnRadio1()
{
// TODO: Add your control notification handler code here
recordcursor = 0;
((CButton *) GetDlgItem(IDC_RADIO1))->SetCheck(TRUE);
((CButton *) GetDlgItem(IDC_RADIO2))->SetCheck(FALSE);
((CButton *) GetDlgItem(IDC_CURSOR1))->EnableWindow(FALSE);
((CButton *) GetDlgItem(IDC_CURSOR2))->EnableWindow(FALSE);
((CButton *) GetDlgItem(IDC_CURSOR3))->EnableWindow(FALSE);
((CButton *) GetDlgItem(IDC_CUSTOMCURSOR))->EnableWindow(FALSE);
((CButton *) GetDlgItem(IDC_FILECURSOR))->EnableWindow(FALSE);
RefreshPreviewCursor();
}
void CCursorOptionsDlg::OnRadio2()
{
// TODO: Add your control notification handler code here
recordcursor = 1;
((CButton *) GetDlgItem(IDC_RADIO1))->SetCheck(FALSE);
((CButton *) GetDlgItem(IDC_RADIO2))->SetCheck(TRUE);
((CButton *) GetDlgItem(IDC_CURSOR1))->EnableWindow(TRUE);
((CButton *) GetDlgItem(IDC_CURSOR2))->EnableWindow(TRUE);
((CButton *) GetDlgItem(IDC_CURSOR3))->EnableWindow(TRUE);
if (cursortype == 0) {
((CButton *) GetDlgItem(IDC_CUSTOMCURSOR))->EnableWindow(FALSE);
((CButton *) GetDlgItem(IDC_FILECURSOR))->EnableWindow(FALSE);
}
else if (cursortype == 1) {
((CButton *) GetDlgItem(IDC_CUSTOMCURSOR))->EnableWindow(TRUE);
((CButton *) GetDlgItem(IDC_FILECURSOR))->EnableWindow(FALSE);
}
else {
((CButton *) GetDlgItem(IDC_CUSTOMCURSOR))->EnableWindow(FALSE);
((CButton *) GetDlgItem(IDC_FILECURSOR))->EnableWindow(TRUE);
}
RefreshPreviewCursor();
}
void CCursorOptionsDlg::OnCursor1()
{
// TODO: Add your control notification handler code here
cursortype = 0;
((CButton *) GetDlgItem(IDC_CURSOR1))->SetCheck(TRUE);
((CButton *) GetDlgItem(IDC_CURSOR2))->SetCheck(FALSE);
((CButton *) GetDlgItem(IDC_CURSOR3))->SetCheck(FALSE);
((CButton *) GetDlgItem(IDC_CUSTOMCURSOR))->EnableWindow(FALSE);
((CButton *) GetDlgItem(IDC_FILECURSOR))->EnableWindow(FALSE);
RefreshPreviewCursor();
}
void CCursorOptionsDlg::OnCursor2()
{
// TODO: Add your control notification handler code here
cursortype = 1;
((CButton *) GetDlgItem(IDC_CURSOR1))->SetCheck(FALSE);
((CButton *) GetDlgItem(IDC_CURSOR2))->SetCheck(TRUE);
((CButton *) GetDlgItem(IDC_CURSOR3))->SetCheck(FALSE);
((CButton *) GetDlgItem(IDC_CUSTOMCURSOR))->EnableWindow(TRUE);
((CButton *) GetDlgItem(IDC_FILECURSOR))->EnableWindow(FALSE);
RefreshPreviewCursor();
}
void CCursorOptionsDlg::OnCursor3()
{
// TODO: Add your control notification handler code here
cursortype = 2;
((CButton *) GetDlgItem(IDC_CURSOR1))->SetCheck(FALSE);
((CButton *) GetDlgItem(IDC_CURSOR2))->SetCheck(FALSE);
((CButton *) GetDlgItem(IDC_CURSOR3))->SetCheck(TRUE);
((CButton *) GetDlgItem(IDC_CUSTOMCURSOR))->EnableWindow(FALSE);
((CButton *) GetDlgItem(IDC_FILECURSOR))->EnableWindow(TRUE);
RefreshPreviewCursor();
}
BOOL CCursorOptionsDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
customsel = g_customsel;
recordcursor = g_recordcursor;
cursortype = g_cursortype;
highlightcursor = g_highlightcursor;
highlightsize = g_highlightsize;
highlightshape = g_highlightshape;
highlightcolor = g_highlightcolor;
loadcursor = g_loadcursor;
customcursor = g_customcursor;
HICON loadFileIcon= LoadIcon(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDI_ICON1));
((CButton *) GetDlgItem(IDC_FILECURSOR))->SetIcon(loadFileIcon);
//Highlight UI
((CSliderCtrl *) GetDlgItem(IDC_HIGHLIGHTSIZE))->EnableWindow(TRUE);
((CComboBox *) GetDlgItem(IDC_HIGHLIGHTSHAPE))->EnableWindow(TRUE);
((CStatic *) GetDlgItem(IDC_STATIC_SIZE))->EnableWindow(TRUE);
((CStatic *) GetDlgItem(IDC_STATIC_SHAPE))->EnableWindow(TRUE);
((CStatic *) GetDlgItem(IDC_STATIC_HALFSIZE))->EnableWindow(TRUE);
((CSliderCtrl *) GetDlgItem(IDC_HIGHLIGHTSIZE))->SetRange(1,128,TRUE);
((CSliderCtrl *) GetDlgItem(IDC_HIGHLIGHTSIZE))->SetPos(highlightsize);
((CComboBox *) GetDlgItem(IDC_HIGHLIGHTSHAPE))->SetCurSel(highlightshape);
((CButton *) GetDlgItem(IDC_HIGHLIGHTCURSOR))->SetCheck(highlightcursor);
//RefreshHighlight doesn't work in init dialog....so defer this to OnPaint
initpaint=TRUE;
//RefreshHighlight();
if (highlightcursor) {
((CSliderCtrl *) GetDlgItem(IDC_HIGHLIGHTSIZE))->EnableWindow(TRUE);
((CComboBox *) GetDlgItem(IDC_HIGHLIGHTSHAPE))->EnableWindow(TRUE);
((CButton *) GetDlgItem(IDC_HIGHLIGHTCOLOR))->EnableWindow(TRUE);
((CStatic *) GetDlgItem(IDC_STATIC_SIZE))->EnableWindow(TRUE);
((CStatic *) GetDlgItem(IDC_STATIC_SHAPE))->EnableWindow(TRUE);
((CStatic *) GetDlgItem(IDC_STATIC_HALFSIZE))->EnableWindow(TRUE);
}
else {
((CSliderCtrl *) GetDlgItem(IDC_HIGHLIGHTSIZE))->EnableWindow(FALSE);
((CComboBox *) GetDlgItem(IDC_HIGHLIGHTSHAPE))->EnableWindow(FALSE);
((CButton *) GetDlgItem(IDC_HIGHLIGHTCOLOR))->EnableWindow(FALSE);
((CStatic *) GetDlgItem(IDC_STATIC_SIZE))->EnableWindow(FALSE);
((CStatic *) GetDlgItem(IDC_STATIC_SHAPE))->EnableWindow(FALSE);
((CStatic *) GetDlgItem(IDC_STATIC_HALFSIZE))->EnableWindow(FALSE);
}
//Highlight UI
((CButton *) GetDlgItem(IDC_CURSOR1))->EnableWindow(TRUE);
((CButton *) GetDlgItem(IDC_CURSOR2))->EnableWindow(TRUE);
((CButton *) GetDlgItem(IDC_CURSOR3))->EnableWindow(TRUE);
((CButton *) GetDlgItem(IDC_CUSTOMCURSOR))->EnableWindow(TRUE);
((CButton *) GetDlgItem(IDC_FILECURSOR))->EnableWindow(TRUE);
((CComboBox *) GetDlgItem(IDC_CUSTOMCURSOR))->SetCurSel(customsel);
RefreshPreviewCursor();
if (cursortype==0) {
((CButton *) GetDlgItem(IDC_CURSOR1))->SetCheck(TRUE);
((CButton *) GetDlgItem(IDC_CURSOR2))->SetCheck(FALSE);
((CButton *) GetDlgItem(IDC_CURSOR3))->SetCheck(FALSE);
((CButton *) GetDlgItem(IDC_CUSTOMCURSOR))->EnableWindow(FALSE);
((CButton *) GetDlgItem(IDC_FILECURSOR))->EnableWindow(FALSE);
}
else if (cursortype==1) {
((CButton *) GetDlgItem(IDC_CURSOR1))->SetCheck(FALSE);
((CButton *) GetDlgItem(IDC_CURSOR2))->SetCheck(TRUE);
((CButton *) GetDlgItem(IDC_CURSOR3))->SetCheck(FALSE);
((CButton *) GetDlgItem(IDC_CUSTOMCURSOR))->EnableWindow(TRUE);
((CButton *) GetDlgItem(IDC_FILECURSOR))->EnableWindow(FALSE);
}
else {
((CButton *) GetDlgItem(IDC_CURSOR1))->SetCheck(FALSE);
((CButton *) GetDlgItem(IDC_CURSOR2))->SetCheck(FALSE);
((CButton *) GetDlgItem(IDC_CURSOR3))->SetCheck(TRUE);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -