📄 options.cpp
字号:
// Options.cpp : implementation file
//
#include "stdafx.h"
#include "Text2PDF.h"
#include "Options.h"
#include "CommonDef.h"
#include "pdflib.hpp"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// COptions dialog
COptions::COptions(CWnd* pParent /*=NULL*/)
: CDialog(COptions::IDD, pParent)
{
//{{AFX_DATA_INIT(COptions)
m_Bottom = MARGIN_BOTTOM;
m_Left = MARGIN_LEFT;
m_Right = MARGIN_RIGHT;
m_Top = MARGIN_TOP;
m_PageSizePoints = _T("");
m_Launch = FALSE;
//}}AFX_DATA_INIT
}
void COptions::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(COptions)
DDX_Control(pDX, IDC_PAGE_SIZE, m_PageSize);
DDX_Control(pDX, IDC_OPEN_MODE, m_OpenMode);
DDX_Control(pDX, IDC_OPEN_ACTION, m_OpenAction);
DDX_Control(pDX, IDC_EFFECT, m_Effect);
DDX_Text(pDX, IDC_BOTTOM, m_Bottom);
DDV_MinMaxFloat(pDX, m_Bottom, 0.f, 100.f);
DDX_Text(pDX, IDC_LEFT, m_Left);
DDV_MinMaxFloat(pDX, m_Left, 0.f, 100.f);
DDX_Text(pDX, IDC_RIGHT, m_Right);
DDV_MinMaxFloat(pDX, m_Right, 0.f, 100.f);
DDX_Text(pDX, IDC_TOP, m_Top);
DDV_MinMaxFloat(pDX, m_Top, 0.f, 100.f);
DDX_Text(pDX, IDC_PAGE_SIZE_POINTS, m_PageSizePoints);
DDX_Check(pDX, IDC_LAUNCH_PDF, m_Launch);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(COptions, CDialog)
//{{AFX_MSG_MAP(COptions)
ON_CBN_SELCHANGE(IDC_PAGE_SIZE, OnSelchangePageSize)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// COptions message handlers
BOOL COptions::OnInitDialog()
{
CDialog::OnInitDialog();
m_Bottom=PageSpec.Bottom;
m_Top=PageSpec.Top;
m_Left=PageSpec.Left;
m_Right=PageSpec.Right;
m_Launch=PageSpec.Launch;
m_OpenAction.SetCurSel(PageSpec.OpenAction);
m_OpenMode.SetCurSel(PageSpec.OpenMode);
m_PageSize.SetCurSel(PageSpec.PageSize);
m_Effect.SetCurSel(PageSpec.Effect);
OnSelchangePageSize();
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void COptions::SetParameter(struct _PageSpec _pageSpec)
{
PageSpec=_pageSpec;
}
struct _PageSpec COptions::GetParameter()
{
return PageSpec;
}
void COptions::OnOK()
{
UpdateData(TRUE);
PageSpec.Bottom=m_Bottom;
PageSpec.Left=m_Left;
PageSpec.Right=m_Right;
PageSpec.Top=m_Top;
PageSpec.Launch=m_Launch;
PageSpec.Effect=m_Effect.GetCurSel();
PageSpec.OpenAction=m_OpenAction.GetCurSel();
PageSpec.OpenMode=m_OpenMode.GetCurSel();
PageSpec.PageSize=m_PageSize.GetCurSel();
CDialog::OnOK();
}
void COptions::OnSelchangePageSize()
{
switch (m_PageSize.GetCurSel())
{
case 0: //A0
m_PageSizePoints.Format(SIZE_POINT_STR, a0_width, a0_height);
break;
case 1: //A1
m_PageSizePoints.Format(SIZE_POINT_STR, a1_width, a1_height);
break;
case 2: //A2
m_PageSizePoints.Format(SIZE_POINT_STR, a2_width, a2_height);
break;
case 3: //A3
m_PageSizePoints.Format(SIZE_POINT_STR, a3_width, a3_height);
break;
case 4: //A4
m_PageSizePoints.Format(SIZE_POINT_STR, a4_width, a4_height);
break;
case 5: //A5
m_PageSizePoints.Format(SIZE_POINT_STR, a5_width, a5_height);
break;
case 6: //A6
m_PageSizePoints.Format(SIZE_POINT_STR, a6_width, a6_height);
break;
case 7: //B5
m_PageSizePoints.Format(SIZE_POINT_STR, b5_width, b5_height);
break;
case 8: //letter
m_PageSizePoints.Format(SIZE_POINT_STR, letter_width, letter_height);
break;
case 9: //legal
m_PageSizePoints.Format(SIZE_POINT_STR, legal_width, legal_height);
break;
case 10: //ledger
m_PageSizePoints.Format(SIZE_POINT_STR, ledger_width, ledger_height);
break;
}
UpdateData(FALSE);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -