зеркало из https://github.com/mozilla/pjs.git
Implementing a better setup dialog
Bug 154239 r=chak rs=alecf
This commit is contained in:
Родитель
c24ad2f77d
Коммит
252faecf0e
|
@ -26,6 +26,7 @@
|
|||
*
|
||||
* Contributor(s):
|
||||
* Chak Nanga <chak@netscape.com>
|
||||
* Rod Spears <rods@netscape.com>
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
|
@ -59,10 +60,7 @@
|
|||
#include "BrowserImpl.h"
|
||||
#include "BrowserFrm.h"
|
||||
#include "Dialogs.h"
|
||||
|
||||
// Print Includes
|
||||
#include "PrintProgressDialog.h"
|
||||
#include "PrintSetupDialog.h"
|
||||
#include "CPageSetupPropSheet.h"
|
||||
|
||||
// Mozilla Includes
|
||||
#include "nsIWidget.h"
|
||||
|
@ -123,6 +121,7 @@ BEGIN_MESSAGE_MAP(CBrowserView, CWnd)
|
|||
ON_UPDATE_COMMAND_UI(ID_EDIT_COPY, OnUpdateCopy)
|
||||
ON_UPDATE_COMMAND_UI(ID_EDIT_PASTE, OnUpdatePaste)
|
||||
ON_UPDATE_COMMAND_UI(ID_FILE_PRINT, OnUpdateFilePrint)
|
||||
ON_UPDATE_COMMAND_UI(ID_FILE_PRINTSETUP, OnUpdatePrintSetup)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
@ -140,8 +139,6 @@ CBrowserView::CBrowserView()
|
|||
mbDocumentLoading = PR_FALSE;
|
||||
|
||||
m_pFindDlg = NULL;
|
||||
m_pPrintProgressDlg = NULL;
|
||||
|
||||
m_bUrlBarClipOp = FALSE;
|
||||
m_bCurrentlyPrinting = FALSE;
|
||||
|
||||
|
@ -980,21 +977,12 @@ void CBrowserView::OnFilePrint()
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
m_PrintSettings->SetShowPrintProgress(PR_FALSE);
|
||||
CPrintProgressDialog dlg(mWebBrowser, m_PrintSettings);
|
||||
|
||||
nsCOMPtr<nsIURI> currentURI;
|
||||
nsresult rv = mWebNav->GetCurrentURI(getter_AddRefs(currentURI));
|
||||
if(NS_SUCCEEDED(rv) || currentURI)
|
||||
nsCOMPtr<nsIWebBrowserPrint> print(do_GetInterface(mWebBrowser));
|
||||
if(print)
|
||||
{
|
||||
nsCAutoString path;
|
||||
currentURI->GetPath(path);
|
||||
dlg.SetURI(path.get());
|
||||
print->Print(m_PrintSettings, nsnull);
|
||||
}
|
||||
m_bCurrentlyPrinting = TRUE;
|
||||
dlg.DoModal();
|
||||
m_bCurrentlyPrinting = FALSE;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1037,24 +1025,6 @@ void CBrowserView::OnFilePrintPreview()
|
|||
}
|
||||
}
|
||||
|
||||
static float GetFloatFromStr(const char* aStr, float aMaxVal = 1.0)
|
||||
{
|
||||
float val;
|
||||
sscanf(aStr, "%f", &val);
|
||||
if (val <= aMaxVal) {
|
||||
return val;
|
||||
} else {
|
||||
return 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
static PRUnichar* GetUnicodeFromCString(const CString& aStr)
|
||||
{
|
||||
nsString str;
|
||||
str.AssignWithConversion(LPCSTR(aStr));
|
||||
return ToNewUnicode(str);
|
||||
}
|
||||
|
||||
void CBrowserView::OnFilePrintSetup()
|
||||
{
|
||||
nsCOMPtr<nsIWebBrowserPrint> print(do_GetInterface(mWebBrowser));
|
||||
|
@ -1066,50 +1036,14 @@ void CBrowserView::OnFilePrintSetup()
|
|||
return;
|
||||
}
|
||||
}
|
||||
CPrintSetupDialog dlg(m_PrintSettings);
|
||||
if (dlg.DoModal() == IDOK && m_PrintSettings != NULL) {
|
||||
m_PrintSettings->SetMarginTop(GetFloatFromStr(dlg.m_TopMargin));
|
||||
m_PrintSettings->SetMarginLeft(GetFloatFromStr(dlg.m_LeftMargin));
|
||||
m_PrintSettings->SetMarginRight(GetFloatFromStr(dlg.m_RightMargin));
|
||||
m_PrintSettings->SetMarginBottom(GetFloatFromStr(dlg.m_BottomMargin));
|
||||
CPageSetupPropSheet propSheet(_T("Page Setup"), this);
|
||||
|
||||
m_PrintSettings->SetScaling(double(dlg.m_Scaling) / 100.0);
|
||||
m_PrintSettings->SetPrintBGColors(dlg.m_PrintBGColors);
|
||||
m_PrintSettings->SetPrintBGColors(dlg.m_PrintBGImages);
|
||||
|
||||
short type;
|
||||
double width;
|
||||
double height;
|
||||
dlg.GetPaperSizeInfo(type, width, height);
|
||||
m_PrintSettings->SetPaperSizeType(type);
|
||||
m_PrintSettings->SetPaperWidth(width);
|
||||
m_PrintSettings->SetPaperHeight(height);
|
||||
|
||||
PRUnichar* uStr;
|
||||
uStr = GetUnicodeFromCString(dlg.m_HeaderLeft);
|
||||
m_PrintSettings->SetHeaderStrLeft(uStr);
|
||||
if (uStr != nsnull) nsMemory::Free(uStr);
|
||||
|
||||
uStr = GetUnicodeFromCString(dlg.m_HeaderMiddle);
|
||||
m_PrintSettings->SetHeaderStrCenter(uStr);
|
||||
if (uStr != nsnull) nsMemory::Free(uStr);
|
||||
|
||||
uStr = GetUnicodeFromCString(dlg.m_HeaderRight);
|
||||
m_PrintSettings->SetHeaderStrRight(uStr);
|
||||
if (uStr != nsnull) nsMemory::Free(uStr);
|
||||
|
||||
uStr = GetUnicodeFromCString(dlg.m_FooterLeft);
|
||||
m_PrintSettings->SetFooterStrLeft(uStr);
|
||||
if (uStr != nsnull) nsMemory::Free(uStr);
|
||||
|
||||
uStr = GetUnicodeFromCString(dlg.m_FooterMiddle);
|
||||
m_PrintSettings->SetFooterStrCenter(uStr);
|
||||
if (uStr != nsnull) nsMemory::Free(uStr);
|
||||
|
||||
uStr = GetUnicodeFromCString(dlg.m_FooterRight);
|
||||
m_PrintSettings->SetFooterStrRight(uStr);
|
||||
if (uStr != nsnull) nsMemory::Free(uStr);
|
||||
propSheet.SetPrintSettingsValues(m_PrintSettings);
|
||||
|
||||
int status = propSheet.DoModal();
|
||||
if (status == IDOK)
|
||||
{
|
||||
propSheet.GetPrintSettingsValues(m_PrintSettings);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1120,6 +1054,12 @@ void CBrowserView::OnUpdateFilePrint(CCmdUI* pCmdUI)
|
|||
pCmdUI->Enable(!m_bCurrentlyPrinting);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void CBrowserView::OnUpdatePrintSetup(CCmdUI* pCmdUI)
|
||||
{
|
||||
pCmdUI->Enable(!m_bCurrentlyPrinting && !m_InPrintPreview);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Called from the busy state related methods in the
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
*
|
||||
* Contributor(s):
|
||||
* Chak Nanga <chak@netscape.com>
|
||||
* Rod Spears <rods@netscape.com>
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
|
@ -182,6 +183,7 @@ protected:
|
|||
afx_msg void OnFilePrintPreview();
|
||||
afx_msg void OnFilePrintSetup();
|
||||
afx_msg void OnUpdateFilePrint(CCmdUI* pCmdUI);
|
||||
afx_msg void OnUpdatePrintSetup(CCmdUI* pCmdUI);
|
||||
afx_msg LRESULT OnFindMsg(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg void OnViewFrameSource();
|
||||
afx_msg void OnOpenFrameInNewWindow();
|
||||
|
|
|
@ -0,0 +1,77 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: Mozilla-sample-code 1.0
|
||||
*
|
||||
* Copyright (c) 2002 Netscape Communications Corporation and
|
||||
* other contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this Mozilla sample software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
* persons to whom the Software is furnished to do so, subject to the
|
||||
* following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Rod Spears <rods@netscape.com>
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#if !defined(AFX_CCUSTOMPROMPTDIALOG_H__6C159F14_88A7_465F_993B_76B03D670DE5__INCLUDED_)
|
||||
#define AFX_CCUSTOMPROMPTDIALOG_H__6C159F14_88A7_465F_993B_76B03D670DE5__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
// CCustomPromptDialog.h : header file
|
||||
//
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CCustomPromptDialog dialog
|
||||
|
||||
class CCustomPromptDialog : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
CCustomPromptDialog(CWnd* pParent = NULL); // standard constructor
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CCustomPromptDialog)
|
||||
enum { IDD = IDD_CUSTOM_PROMPT_DIALOG };
|
||||
CString m_CustomText;
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CCustomPromptDialog)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CCustomPromptDialog)
|
||||
// NOTE: the ClassWizard will add member functions here
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_CUSTOMPROMPTDIALOG_H__6C159F14_88A7_465F_993B_76B03D670DE5__INCLUDED_)
|
|
@ -0,0 +1,279 @@
|
|||
// FormatOptionTab.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "mfcembed.h"
|
||||
#include "CFormatOptionTab.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
typedef struct {
|
||||
char* mDesc;
|
||||
short mUnit;
|
||||
double mWidth;
|
||||
double mHeight;
|
||||
BOOL mIsUserDefined;
|
||||
} PaperSizes;
|
||||
|
||||
static const PaperSizes gPaperSize[] = {
|
||||
{"Letter (8.5 x 11.0)", nsIPrintSettings::kPaperSizeInches, 8.5, 11.0, FALSE},
|
||||
{"Legal (8.5 x 14.0)", nsIPrintSettings::kPaperSizeInches, 8.5, 14.0, FALSE},
|
||||
{"A4 (210 x 297mm)", nsIPrintSettings::kPaperSizeMillimeters, 210.0, 297.0, FALSE},
|
||||
{"User Defined", nsIPrintSettings::kPaperSizeInches, 8.5, 11.0, TRUE}
|
||||
};
|
||||
static const int gNumPaperSizes = 4;
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CFormatOptionTab property page
|
||||
|
||||
IMPLEMENT_DYNCREATE(CFormatOptionTab, CPropertyPage)
|
||||
|
||||
CFormatOptionTab::CFormatOptionTab() : CPropertyPage(CFormatOptionTab::IDD)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CFormatOptionTab)
|
||||
m_PaperSize = -1;
|
||||
m_BGColors = FALSE;
|
||||
m_Scaling = 0;
|
||||
m_ScalingText = _T("");
|
||||
m_PaperHeight = 0.0;
|
||||
m_PaperWidth = 0.0;
|
||||
m_DoInches = -1;
|
||||
m_BGImages = FALSE;
|
||||
m_IsLandScape = FALSE;
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
CFormatOptionTab::~CFormatOptionTab()
|
||||
{
|
||||
}
|
||||
|
||||
void CFormatOptionTab::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CPropertyPage::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CFormatOptionTab)
|
||||
DDX_CBIndex(pDX, IDC_PAPER_SIZE_CBX, m_PaperSize);
|
||||
DDX_Check(pDX, IDC_PRT_BGCOLORS, m_BGColors);
|
||||
DDX_Slider(pDX, IDC_SCALE, m_Scaling);
|
||||
DDX_Text(pDX, IDC_SCALE_TXT, m_ScalingText);
|
||||
DDX_Text(pDX, IDC_UD_PAPER_HGT, m_PaperHeight);
|
||||
DDX_Text(pDX, IDC_UD_PAPER_WDTH, m_PaperWidth);
|
||||
DDX_Radio(pDX, IDC_INCHES_RD, m_DoInches);
|
||||
DDX_Check(pDX, IDC_PRT_BGIMAGES, m_BGImages);
|
||||
DDX_Radio(pDX, IDC_PRT_PORTRAIT_RD, m_IsLandScape);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CFormatOptionTab, CPropertyPage)
|
||||
//{{AFX_MSG_MAP(CFormatOptionTab)
|
||||
ON_NOTIFY(NM_CUSTOMDRAW, IDC_SCALE, OnCustomdrawScale)
|
||||
ON_EN_KILLFOCUS(IDC_SCALE_TXT, OnKillfocusScaleTxt)
|
||||
ON_CBN_SELCHANGE(IDC_PAPER_SIZE_CBX, OnSelchangePaperSizeCbx)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CFormatOptionTab message handlers
|
||||
|
||||
BOOL CFormatOptionTab::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
CSliderCtrl* scale = (CSliderCtrl*)GetDlgItem(IDC_SCALE);
|
||||
CWnd* scaleTxt = GetDlgItem(IDC_SCALE_TXT);
|
||||
if (scale != NULL)
|
||||
{
|
||||
scale->SetRange(50, 100);
|
||||
scale->SetBuddy(scaleTxt, FALSE);
|
||||
scale->SetTicFreq(10);
|
||||
}
|
||||
|
||||
CComboBox* cbx = (CComboBox*)GetDlgItem(IDC_PAPER_SIZE_CBX);
|
||||
if (cbx != NULL)
|
||||
{
|
||||
// First Initialize the Combobox
|
||||
for (int i=0;i<gNumPaperSizes;i++)
|
||||
{
|
||||
cbx->AddString(gPaperSize[i].mDesc);
|
||||
}
|
||||
short unit;
|
||||
double paperWidth = 0.0;
|
||||
double paperHeight = 0.0;
|
||||
m_PrintSettings->GetPaperSizeType(&unit);
|
||||
m_PrintSettings->GetPaperWidth(&paperWidth);
|
||||
m_PrintSettings->GetPaperHeight(&paperHeight);
|
||||
|
||||
m_PaperSizeInx = GetPaperSizeIndexFromData(unit, paperWidth, paperHeight);
|
||||
if (m_PaperSizeInx == -1)
|
||||
{ // couldn't find a match
|
||||
m_PaperSizeInx = 0;
|
||||
unit = gPaperSize[m_PaperSizeInx].mUnit;
|
||||
paperWidth = gPaperSize[m_PaperSizeInx].mWidth;
|
||||
paperHeight = gPaperSize[m_PaperSizeInx].mHeight;
|
||||
}
|
||||
|
||||
cbx->SetCurSel(m_PaperSizeInx);
|
||||
|
||||
EnableUserDefineControls(gPaperSize[m_PaperSizeInx].mIsUserDefined);
|
||||
|
||||
if (gPaperSize[m_PaperSizeInx].mIsUserDefined)
|
||||
{
|
||||
CString wStr;
|
||||
CString hStr;
|
||||
if (unit == nsIPrintSettings::kPaperSizeInches)
|
||||
{
|
||||
wStr.Format("%6.2f", paperWidth);
|
||||
hStr.Format("%6.2f", paperHeight);
|
||||
CheckRadioButton(IDC_INCHES_RD, IDC_MILLI_RD, IDC_INCHES_RD);
|
||||
}
|
||||
else
|
||||
{
|
||||
wStr.Format("%d", int(paperWidth));
|
||||
hStr.Format("%d", int(paperHeight));
|
||||
CheckRadioButton(IDC_INCHES_RD, IDC_MILLI_RD, IDC_MILLI_RD);
|
||||
}
|
||||
CWnd* widthTxt = GetDlgItem(IDC_UD_PAPER_WDTH);
|
||||
CWnd* heightTxt = GetDlgItem(IDC_UD_PAPER_HGT);
|
||||
widthTxt->SetWindowText(wStr);
|
||||
heightTxt->SetWindowText(hStr);
|
||||
}
|
||||
else
|
||||
{
|
||||
CheckRadioButton(IDC_INCHES_RD, IDC_MILLI_RD, IDC_INCHES_RD);
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
void CFormatOptionTab::OnCustomdrawScale(NMHDR* pNMHDR, LRESULT* pResult)
|
||||
{
|
||||
CSliderCtrl* scale = (CSliderCtrl*)GetDlgItem(IDC_SCALE);
|
||||
CWnd* scaleTxt = GetDlgItem(IDC_SCALE_TXT);
|
||||
if (scale != NULL && scaleTxt != NULL)
|
||||
{
|
||||
CString str;
|
||||
str.Format("%d", scale->GetPos());
|
||||
scaleTxt->SetWindowText(str);
|
||||
}
|
||||
|
||||
*pResult = 0;
|
||||
}
|
||||
|
||||
static int GetIntFromStr(const char* aStr, int aMinVal = 50, int aMaxVal = 100)
|
||||
{
|
||||
int val = aMinVal;
|
||||
sscanf(aStr, "%d", &val);
|
||||
if (val < aMinVal)
|
||||
{
|
||||
return aMinVal;
|
||||
}
|
||||
else if (val > aMaxVal)
|
||||
{
|
||||
return aMaxVal;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
void CFormatOptionTab::OnKillfocusScaleTxt()
|
||||
{
|
||||
CSliderCtrl* scale = (CSliderCtrl*)GetDlgItem(IDC_SCALE);
|
||||
CWnd* scaleTxt = GetDlgItem(IDC_SCALE_TXT);
|
||||
if (scale != NULL && scaleTxt != NULL)
|
||||
{
|
||||
CString str;
|
||||
scaleTxt->GetWindowText(str);
|
||||
scale->SetPos(GetIntFromStr(str));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CFormatOptionTab::EnableUserDefineControls(BOOL aEnable)
|
||||
{
|
||||
CWnd* cntrl = GetDlgItem(IDC_UD_WIDTH_LBL);
|
||||
cntrl->EnableWindow(aEnable);
|
||||
cntrl = GetDlgItem(IDC_UD_HEIGHT_LBL);
|
||||
cntrl->EnableWindow(aEnable);
|
||||
cntrl = GetDlgItem(IDC_UD_PAPER_WDTH);
|
||||
cntrl->EnableWindow(aEnable);
|
||||
cntrl = GetDlgItem(IDC_UD_PAPER_HGT);
|
||||
cntrl->EnableWindow(aEnable);
|
||||
cntrl = GetDlgItem(IDC_INCHES_RD);
|
||||
cntrl->EnableWindow(aEnable);
|
||||
cntrl = GetDlgItem(IDC_MILLI_RD);
|
||||
cntrl->EnableWindow(aEnable);
|
||||
}
|
||||
|
||||
void CFormatOptionTab::OnSelchangePaperSizeCbx()
|
||||
{
|
||||
CComboBox* cbx = (CComboBox*)GetDlgItem(IDC_PAPER_SIZE_CBX);
|
||||
if (cbx)
|
||||
{
|
||||
CString text;
|
||||
cbx->GetWindowText(text);
|
||||
m_PaperSizeInx = GetPaperSizeIndex(text);
|
||||
EnableUserDefineControls(gPaperSize[m_PaperSizeInx].mIsUserDefined);
|
||||
}
|
||||
}
|
||||
|
||||
void CFormatOptionTab::GetPaperSizeInfo(short& aUnit, double& aWidth, double& aHeight)
|
||||
{
|
||||
if (gPaperSize[m_PaperSizeInx].mIsUserDefined)
|
||||
{
|
||||
aUnit = m_DoInches == 0?nsIPrintSettings::kPaperSizeInches:nsIPrintSettings::kPaperSizeMillimeters;
|
||||
aWidth = m_PaperWidth;
|
||||
aHeight = m_PaperHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
aUnit = gPaperSize[m_PaperSizeInx].mUnit;
|
||||
aWidth = gPaperSize[m_PaperSizeInx].mWidth;
|
||||
aHeight = gPaperSize[m_PaperSizeInx].mHeight;
|
||||
}
|
||||
}
|
||||
|
||||
// Search for Sizes in Pape Size Data
|
||||
int CFormatOptionTab::GetPaperSizeIndexFromData(short aUnit, double aW, double aH)
|
||||
{
|
||||
for (int i=0;i<gNumPaperSizes;i++)
|
||||
{
|
||||
if (gPaperSize[i].mUnit == aUnit &&
|
||||
gPaperSize[i].mWidth == aW &&
|
||||
gPaperSize[i].mHeight == aH)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
// find the first user defined
|
||||
for ( i=0;i<gNumPaperSizes;i++)
|
||||
{
|
||||
if (gPaperSize[i].mIsUserDefined)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int CFormatOptionTab::GetPaperSizeIndex(const CString& aStr)
|
||||
{
|
||||
for (int i=0;i<gNumPaperSizes;i++)
|
||||
{
|
||||
if (!aStr.Compare(gPaperSize[i].mDesc))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: Mozilla-sample-code 1.0
|
||||
*
|
||||
* Copyright (c) 2002 Netscape Communications Corporation and
|
||||
* other contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this Mozilla sample software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
* persons to whom the Software is furnished to do so, subject to the
|
||||
* following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Rod Spears <rods@netscape.com>
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#if !defined(AFX_CFORMATOPTIONTAB_H__F7BDB355_9202_440A_8478_165AD3FC2F41__INCLUDED_)
|
||||
#define AFX_CFORMATOPTIONTAB_H__F7BDB355_9202_440A_8478_165AD3FC2F41__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
// CFormatOptionTab.h : header file
|
||||
//
|
||||
|
||||
#include "nsIPrintSettings.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CFormatOptionTab dialog
|
||||
|
||||
class CFormatOptionTab : public CPropertyPage
|
||||
{
|
||||
DECLARE_DYNCREATE(CFormatOptionTab)
|
||||
|
||||
// Construction
|
||||
public:
|
||||
CFormatOptionTab();
|
||||
~CFormatOptionTab();
|
||||
void GetPaperSizeInfo(short& aType, double& aWidth, double& aHeight);
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CFormatOptionTab)
|
||||
enum { IDD = IDD_FORMAT_OPTIONS_TAB };
|
||||
int m_PaperSize;
|
||||
BOOL m_BGColors;
|
||||
int m_Scaling;
|
||||
CString m_ScalingText;
|
||||
int m_DoInches;
|
||||
BOOL m_BGImages;
|
||||
double m_PaperHeight;
|
||||
double m_PaperWidth;
|
||||
BOOL m_IsLandScape;
|
||||
//}}AFX_DATA
|
||||
|
||||
nsCOMPtr<nsIPrintSettings> m_PrintSettings;
|
||||
int m_PaperSizeInx;
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generate virtual function overrides
|
||||
//{{AFX_VIRTUAL(CFormatOptionTab)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
void EnableUserDefineControls(BOOL aEnable);
|
||||
int GetPaperSizeIndexFromData(short aType, double aW, double aH);
|
||||
int GetPaperSizeIndex(const CString& aStr);
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CFormatOptionTab)
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnCustomdrawScale(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnKillfocusScaleTxt();
|
||||
afx_msg void OnSelchangePaperSizeCbx();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_CFORMATOPTIONTAB_H__F7BDB355_9202_440A_8478_165AD3FC2F41__INCLUDED_)
|
|
@ -0,0 +1,169 @@
|
|||
// MarginHeaderFooter.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "mfcembed.h"
|
||||
#include "CMarginHeaderFooter.h"
|
||||
#include "CCustomPromptDialog.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
static char* sCBXTitles[] = {"--Blank--", "Title", "URL", "Date/Time", "Page #", "Page # of #", "Custom...", NULL};
|
||||
static char* sCBXValues[] = {"", "&T", "&U", "&D", "&P", "&PT", "", NULL};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMarginHeaderFooter property page
|
||||
|
||||
IMPLEMENT_DYNCREATE(CMarginHeaderFooter, CPropertyPage)
|
||||
|
||||
CMarginHeaderFooter::CMarginHeaderFooter() : CPropertyPage(CMarginHeaderFooter::IDD)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CMarginHeaderFooter)
|
||||
m_BottomMarginText = _T("");
|
||||
m_LeftMarginText = _T("");
|
||||
m_RightMarginText = _T("");
|
||||
m_TopMarginText = _T("");
|
||||
//}}AFX_DATA_INIT
|
||||
|
||||
m_FooterLeftText = _T("");
|
||||
m_FooterCenterText = _T("");
|
||||
m_FooterRightText = _T("");
|
||||
m_HeaderLeftText = _T("");
|
||||
m_HeaderCenterText = _T("");
|
||||
m_HeaderRightText = _T("");
|
||||
}
|
||||
|
||||
CMarginHeaderFooter::~CMarginHeaderFooter()
|
||||
{
|
||||
}
|
||||
|
||||
void CMarginHeaderFooter::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CPropertyPage::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CMarginHeaderFooter)
|
||||
DDX_Text(pDX, IDC_BOTTOM_MARGIN_TXT, m_BottomMarginText);
|
||||
DDX_Text(pDX, IDC_LEFT_MARGIN_TXT, m_LeftMarginText);
|
||||
DDX_Text(pDX, IDC_RIGHT_MARGIN_TXT, m_RightMarginText);
|
||||
DDX_Text(pDX, IDC_TOP_MARGIN_TXT, m_TopMarginText);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CMarginHeaderFooter, CPropertyPage)
|
||||
//{{AFX_MSG_MAP(CMarginHeaderFooter)
|
||||
ON_CBN_SELCHANGE(IDC_FTR_LEFT_CMBX, OnEditchangeFTRLeft)
|
||||
ON_CBN_SELCHANGE(IDC_FTR_CENTER_CMBX, OnEditchangeFTRCenter)
|
||||
ON_CBN_SELCHANGE(IDC_FTR_RIGHT_CMBX, OnEditchangeFTRRight)
|
||||
ON_CBN_SELCHANGE(IDC_HDR_LEFT_CMBX, OnEditchangeHDRLeft)
|
||||
ON_CBN_SELCHANGE(IDC_HDR_CENTER_CMBX, OnEditchangeHDRCenter)
|
||||
ON_CBN_SELCHANGE(IDC_HDR_RIGHT_CMBX, OnEditchangeHDRRight)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMarginHeaderFooter message handlers
|
||||
|
||||
void CMarginHeaderFooter::SetComboboxValue(int aId, const char* aItem)
|
||||
{
|
||||
CComboBox* cbx = (CComboBox*)GetDlgItem(aId);
|
||||
if (cbx)
|
||||
{
|
||||
int inx = 0;
|
||||
while (sCBXValues[inx] != NULL)
|
||||
{
|
||||
if (!strcmp(sCBXValues[inx], aItem))
|
||||
{
|
||||
cbx->SetCurSel(inx);
|
||||
return;
|
||||
}
|
||||
inx++;
|
||||
}
|
||||
cbx->SetCurSel(inx-1);
|
||||
}
|
||||
}
|
||||
|
||||
void CMarginHeaderFooter::AddCBXItem(int aId, const char* aItem)
|
||||
{
|
||||
CComboBox* cbx = (CComboBox*)GetDlgItem(aId);
|
||||
if (cbx)
|
||||
{
|
||||
cbx->AddString(aItem);
|
||||
}
|
||||
}
|
||||
|
||||
BOOL CMarginHeaderFooter::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
int inx = 0;
|
||||
while (sCBXTitles[inx] != NULL)
|
||||
{
|
||||
AddCBXItem(IDC_HDR_LEFT_CMBX, sCBXTitles[inx]);
|
||||
AddCBXItem(IDC_HDR_CENTER_CMBX, sCBXTitles[inx]);
|
||||
AddCBXItem(IDC_HDR_RIGHT_CMBX, sCBXTitles[inx]);
|
||||
AddCBXItem(IDC_FTR_LEFT_CMBX, sCBXTitles[inx]);
|
||||
AddCBXItem(IDC_FTR_CENTER_CMBX, sCBXTitles[inx]);
|
||||
AddCBXItem(IDC_FTR_RIGHT_CMBX, sCBXTitles[inx]);
|
||||
inx++;
|
||||
}
|
||||
SetComboboxValue(IDC_HDR_LEFT_CMBX, LPCSTR(m_HeaderLeftText));
|
||||
SetComboboxValue(IDC_HDR_CENTER_CMBX, LPCSTR(m_HeaderCenterText));
|
||||
SetComboboxValue(IDC_HDR_RIGHT_CMBX, LPCSTR(m_HeaderRightText));
|
||||
SetComboboxValue(IDC_FTR_LEFT_CMBX, LPCSTR(m_FooterLeftText));
|
||||
SetComboboxValue(IDC_FTR_CENTER_CMBX, LPCSTR(m_FooterCenterText));
|
||||
SetComboboxValue(IDC_FTR_RIGHT_CMBX, LPCSTR(m_FooterRightText));
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
void CMarginHeaderFooter::SetCombobox(int aId, CString& aText)
|
||||
{
|
||||
CComboBox* cbx = (CComboBox*)GetDlgItem(aId);
|
||||
int inx = cbx->GetCurSel();
|
||||
if (inx == 6)
|
||||
{
|
||||
CCustomPromptDialog prompt(this);
|
||||
prompt.m_CustomText = aText;
|
||||
if(prompt.DoModal() == IDOK)
|
||||
{
|
||||
aText = prompt.m_CustomText;
|
||||
}
|
||||
} else {
|
||||
aText = sCBXValues[inx];
|
||||
}
|
||||
}
|
||||
|
||||
void CMarginHeaderFooter::OnEditchangeFTRLeft()
|
||||
{
|
||||
SetCombobox(IDC_FTR_LEFT_CMBX, m_FooterLeftText);
|
||||
}
|
||||
|
||||
void CMarginHeaderFooter::OnEditchangeFTRCenter()
|
||||
{
|
||||
SetCombobox(IDC_FTR_CENTER_CMBX, m_FooterCenterText);
|
||||
}
|
||||
|
||||
void CMarginHeaderFooter::OnEditchangeFTRRight()
|
||||
{
|
||||
SetCombobox(IDC_FTR_CENTER_CMBX, m_FooterCenterText);
|
||||
}
|
||||
|
||||
void CMarginHeaderFooter::OnEditchangeHDRLeft()
|
||||
{
|
||||
SetCombobox(IDC_HDR_LEFT_CMBX, m_HeaderLeftText);
|
||||
}
|
||||
|
||||
void CMarginHeaderFooter::OnEditchangeHDRCenter()
|
||||
{
|
||||
SetCombobox(IDC_HDR_CENTER_CMBX, m_HeaderCenterText);
|
||||
}
|
||||
|
||||
void CMarginHeaderFooter::OnEditchangeHDRRight()
|
||||
{
|
||||
SetCombobox(IDC_HDR_CENTER_CMBX, m_HeaderCenterText);
|
||||
}
|
|
@ -0,0 +1,99 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: Mozilla-sample-code 1.0
|
||||
*
|
||||
* Copyright (c) 2002 Netscape Communications Corporation and
|
||||
* other contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this Mozilla sample software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
* persons to whom the Software is furnished to do so, subject to the
|
||||
* following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Rod Spears <rods@netscape.com>
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#if !defined(AFX_CMARGINHEADERFOOTER_H__A95A9A17_692E_425B_8B70_419C24DDE6BC__INCLUDED_)
|
||||
#define AFX_CMARGINHEADERFOOTER_H__A95A9A17_692E_425B_8B70_419C24DDE6BC__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
// CMarginHeaderFooter.h : header file
|
||||
//
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMarginHeaderFooter dialog
|
||||
|
||||
class CMarginHeaderFooter : public CPropertyPage
|
||||
{
|
||||
DECLARE_DYNCREATE(CMarginHeaderFooter)
|
||||
|
||||
// Construction
|
||||
public:
|
||||
CMarginHeaderFooter();
|
||||
~CMarginHeaderFooter();
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CMarginHeaderFooter)
|
||||
enum { IDD = IDD_HEADERFOOTER_TAB };
|
||||
CString m_BottomMarginText;
|
||||
CString m_LeftMarginText;
|
||||
CString m_RightMarginText;
|
||||
CString m_TopMarginText;
|
||||
//}}AFX_DATA
|
||||
|
||||
CString m_FooterLeftText;
|
||||
CString m_FooterCenterText;
|
||||
CString m_FooterRightText;
|
||||
CString m_HeaderLeftText;
|
||||
CString m_HeaderCenterText;
|
||||
CString m_HeaderRightText;
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generate virtual function overrides
|
||||
//{{AFX_VIRTUAL(CMarginHeaderFooter)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
void SetCombobox(int aId, CString& aText);
|
||||
void SetComboboxValue(int aId, const char* aValue);
|
||||
void AddCBXItem(int aId, const char* aItem);
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CMarginHeaderFooter)
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnEditchangeFTRLeft();
|
||||
afx_msg void OnEditchangeFTRCenter();
|
||||
afx_msg void OnEditchangeFTRRight();
|
||||
afx_msg void OnEditchangeHDRLeft();
|
||||
afx_msg void OnEditchangeHDRCenter();
|
||||
afx_msg void OnEditchangeHDRRight();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_MARGINHEADERFOOTER_H__A95A9A17_692E_425B_8B70_419C24DDE6BC__INCLUDED_)
|
|
@ -0,0 +1,224 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: Mozilla-sample-code 1.0
|
||||
*
|
||||
* Copyright (c) 2002 Netscape Communications Corporation and
|
||||
* other contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this Mozilla sample software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
* persons to whom the Software is furnished to do so, subject to the
|
||||
* following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Rod Spears <rods@netscape.com>
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
// CPageSetupPropSheet.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "resource.h"
|
||||
#include "CPageSetupPropSheet.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CPageSetupPropSheet
|
||||
|
||||
IMPLEMENT_DYNAMIC(CPageSetupPropSheet, CPropertySheet)
|
||||
|
||||
CPageSetupPropSheet::CPageSetupPropSheet(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)
|
||||
:CPropertySheet(nIDCaption, pParentWnd, iSelectPage)
|
||||
{
|
||||
AddControlPages();
|
||||
}
|
||||
|
||||
CPageSetupPropSheet::CPageSetupPropSheet(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
|
||||
:CPropertySheet(pszCaption, pParentWnd, iSelectPage)
|
||||
{
|
||||
AddControlPages();
|
||||
}
|
||||
|
||||
CPageSetupPropSheet::~CPageSetupPropSheet()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CPageSetupPropSheet, CPropertySheet)
|
||||
//{{AFX_MSG_MAP(CPageSetupPropSheet)
|
||||
// NOTE - the ClassWizard will add and remove mapping macros here.
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CPageSetupPropSheet message handlers
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void CPageSetupPropSheet::AddControlPages()
|
||||
{
|
||||
m_psh.dwFlags &= ~PSH_HASHELP; // Lose the Help button
|
||||
AddPage(&m_FormatOptionTab);
|
||||
AddPage(&m_MarginHeaderFooterTab);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
static float GetFloatFromStr(const char* aStr, float aMaxVal = 1.0)
|
||||
{
|
||||
float val;
|
||||
sscanf(aStr, "%f", &val);
|
||||
if (val <= aMaxVal)
|
||||
{
|
||||
return val;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
static PRUnichar* GetUnicodeFromCString(const CString& aStr)
|
||||
{
|
||||
nsString str;
|
||||
str.AssignWithConversion(LPCSTR(aStr));
|
||||
return ToNewUnicode(str);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void CPageSetupPropSheet::SetPrintSettingsValues(nsIPrintSettings* aPrintSettings)
|
||||
{
|
||||
m_FormatOptionTab.m_PrintSettings = aPrintSettings;
|
||||
|
||||
if (aPrintSettings != NULL)
|
||||
{
|
||||
double top, left, right, bottom;
|
||||
aPrintSettings->GetMarginTop(&top);
|
||||
aPrintSettings->GetMarginLeft(&left);
|
||||
aPrintSettings->GetMarginRight(&right);
|
||||
aPrintSettings->GetMarginBottom(&bottom);
|
||||
|
||||
char buf[16];
|
||||
sprintf(buf, "%5.2f", top);
|
||||
m_MarginHeaderFooterTab.m_TopMarginText = buf;
|
||||
sprintf(buf, "%5.2f", left);
|
||||
m_MarginHeaderFooterTab.m_LeftMarginText = buf;
|
||||
sprintf(buf, "%5.2f", right);
|
||||
m_MarginHeaderFooterTab.m_RightMarginText = buf;
|
||||
sprintf(buf, "%5.2f", bottom);
|
||||
m_MarginHeaderFooterTab.m_BottomMarginText = buf;
|
||||
|
||||
PRInt32 orientation;
|
||||
aPrintSettings->GetOrientation(&orientation);
|
||||
m_FormatOptionTab.m_IsLandScape = orientation != nsIPrintSettings::kPortraitOrientation;
|
||||
|
||||
double scaling;
|
||||
aPrintSettings->GetScaling(&scaling);
|
||||
m_FormatOptionTab.m_Scaling = int(scaling * 100.0);
|
||||
|
||||
PRBool boolVal;
|
||||
aPrintSettings->GetPrintBGColors(&boolVal);
|
||||
m_FormatOptionTab.m_BGColors = boolVal == PR_TRUE;
|
||||
aPrintSettings->GetPrintBGImages(&boolVal);
|
||||
m_FormatOptionTab.m_BGImages = boolVal == PR_TRUE;
|
||||
|
||||
PRUnichar* uStr;
|
||||
aPrintSettings->GetHeaderStrLeft(&uStr);
|
||||
m_MarginHeaderFooterTab.m_HeaderLeftText = NS_LossyConvertUCS2toASCII(uStr).get();
|
||||
if (uStr != nsnull) nsMemory::Free(uStr);
|
||||
|
||||
aPrintSettings->GetHeaderStrCenter(&uStr);
|
||||
m_MarginHeaderFooterTab.m_HeaderCenterText = NS_LossyConvertUCS2toASCII(uStr).get();
|
||||
if (uStr != nsnull) nsMemory::Free(uStr);
|
||||
|
||||
aPrintSettings->GetHeaderStrRight(&uStr);
|
||||
m_MarginHeaderFooterTab.m_HeaderRightText = NS_LossyConvertUCS2toASCII(uStr).get();
|
||||
if (uStr != nsnull) nsMemory::Free(uStr);
|
||||
|
||||
aPrintSettings->GetFooterStrLeft(&uStr);
|
||||
m_MarginHeaderFooterTab.m_FooterLeftText = NS_LossyConvertUCS2toASCII(uStr).get();
|
||||
if (uStr != nsnull) nsMemory::Free(uStr);
|
||||
|
||||
aPrintSettings->GetFooterStrCenter(&uStr);
|
||||
m_MarginHeaderFooterTab.m_FooterCenterText = NS_LossyConvertUCS2toASCII(uStr).get();
|
||||
if (uStr != nsnull) nsMemory::Free(uStr);
|
||||
|
||||
aPrintSettings->GetFooterStrRight(&uStr);
|
||||
m_MarginHeaderFooterTab.m_FooterRightText = NS_LossyConvertUCS2toASCII(uStr).get();
|
||||
if (uStr != nsnull) nsMemory::Free(uStr);
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void CPageSetupPropSheet::GetPrintSettingsValues(nsIPrintSettings* aPrintSettings)
|
||||
{
|
||||
|
||||
if (!aPrintSettings) return;
|
||||
|
||||
aPrintSettings->SetScaling(double(m_FormatOptionTab.m_Scaling) / 100.0);
|
||||
aPrintSettings->SetPrintBGColors(m_FormatOptionTab.m_BGColors);
|
||||
aPrintSettings->SetPrintBGImages(m_FormatOptionTab.m_BGImages);
|
||||
|
||||
PRInt32 orientation = m_FormatOptionTab.m_IsLandScape?
|
||||
nsIPrintSettings::kLandscapeOrientation:nsIPrintSettings::kPortraitOrientation;
|
||||
aPrintSettings->SetOrientation(orientation);
|
||||
|
||||
short type;
|
||||
double width;
|
||||
double height;
|
||||
m_FormatOptionTab.GetPaperSizeInfo(type, width, height);
|
||||
aPrintSettings->SetPaperSizeType(nsIPrintSettings::kPaperSizeDefined);
|
||||
aPrintSettings->SetPaperSizeUnit(type);
|
||||
aPrintSettings->SetPaperWidth(width);
|
||||
aPrintSettings->SetPaperHeight(height);
|
||||
|
||||
aPrintSettings->SetMarginTop(GetFloatFromStr(m_MarginHeaderFooterTab.m_TopMarginText));
|
||||
aPrintSettings->SetMarginLeft(GetFloatFromStr(m_MarginHeaderFooterTab.m_LeftMarginText));
|
||||
aPrintSettings->SetMarginRight(GetFloatFromStr(m_MarginHeaderFooterTab.m_RightMarginText));
|
||||
aPrintSettings->SetMarginBottom(GetFloatFromStr(m_MarginHeaderFooterTab.m_BottomMarginText));
|
||||
|
||||
PRUnichar* uStr;
|
||||
uStr = GetUnicodeFromCString(m_MarginHeaderFooterTab.m_HeaderLeftText);
|
||||
aPrintSettings->SetHeaderStrLeft(uStr);
|
||||
if (uStr != nsnull) nsMemory::Free(uStr);
|
||||
|
||||
uStr = GetUnicodeFromCString(m_MarginHeaderFooterTab.m_HeaderCenterText);
|
||||
aPrintSettings->SetHeaderStrCenter(uStr);
|
||||
if (uStr != nsnull) nsMemory::Free(uStr);
|
||||
|
||||
uStr = GetUnicodeFromCString(m_MarginHeaderFooterTab.m_HeaderRightText);
|
||||
aPrintSettings->SetHeaderStrRight(uStr);
|
||||
if (uStr != nsnull) nsMemory::Free(uStr);
|
||||
|
||||
uStr = GetUnicodeFromCString(m_MarginHeaderFooterTab.m_FooterLeftText);
|
||||
aPrintSettings->SetFooterStrLeft(uStr);
|
||||
if (uStr != nsnull) nsMemory::Free(uStr);
|
||||
|
||||
uStr = GetUnicodeFromCString(m_MarginHeaderFooterTab.m_FooterCenterText);
|
||||
aPrintSettings->SetFooterStrCenter(uStr);
|
||||
if (uStr != nsnull) nsMemory::Free(uStr);
|
||||
|
||||
uStr = GetUnicodeFromCString(m_MarginHeaderFooterTab.m_FooterRightText);
|
||||
aPrintSettings->SetFooterStrRight(uStr);
|
||||
if (uStr != nsnull) nsMemory::Free(uStr);
|
||||
}
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: Mozilla-sample-code 1.0
|
||||
*
|
||||
* Copyright (c) 2002 Netscape Communications Corporation and
|
||||
* other contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this Mozilla sample software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
* persons to whom the Software is furnished to do so, subject to the
|
||||
* following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Rod Spears <rods@netscape.com>
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#if !defined(AFX_CPAGESETUPPROPSHEET_H__E8A6D703_7EAD_4729_8FBA_9E0515AB9822__INCLUDED_)
|
||||
#define AFX_CPAGESETUPPROPSHEET_H__E8A6D703_7EAD_4729_8FBA_9E0515AB9822__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
// CPageSetupPropSheet.h : header file
|
||||
//
|
||||
#include "CFormatOptionTab.h"
|
||||
#include "CMarginHeaderFooter.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CPageSetupPropSheet
|
||||
|
||||
class CPageSetupPropSheet : public CPropertySheet
|
||||
{
|
||||
DECLARE_DYNAMIC(CPageSetupPropSheet)
|
||||
|
||||
// Construction
|
||||
public:
|
||||
CPageSetupPropSheet(UINT nIDCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
|
||||
CPageSetupPropSheet(LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
|
||||
|
||||
void SetPrintSettingsValues(nsIPrintSettings* aPrintSettings);
|
||||
void GetPrintSettingsValues(nsIPrintSettings* aPrintSettings);
|
||||
|
||||
protected:
|
||||
void AddControlPages(void);
|
||||
|
||||
// Attributes
|
||||
public:
|
||||
CFormatOptionTab m_FormatOptionTab;
|
||||
CMarginHeaderFooter m_MarginHeaderFooterTab;
|
||||
|
||||
// Operations
|
||||
public:
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CPageSetupPropSheet)
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
virtual ~CPageSetupPropSheet();
|
||||
|
||||
// Generated message map functions
|
||||
protected:
|
||||
//{{AFX_MSG(CPageSetupPropSheet)
|
||||
// NOTE - the ClassWizard will add and remove member functions here.
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_CPAGESETUPPROPSHEET_H__E8A6D703_7EAD_4729_8FBA_9E0515AB9822__INCLUDED_)
|
|
@ -62,6 +62,10 @@ REQUIRES = \
|
|||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
CCustomPromptDialog.cpp \
|
||||
CMarginHeaderFooter.cpp \
|
||||
CFormatOptionTab.cpp \
|
||||
CPageSetupPropSheet.cpp \
|
||||
MfcEmbed.cpp \
|
||||
BrowserFrm.cpp \
|
||||
EditorFrm.cpp \
|
||||
|
@ -75,9 +79,7 @@ CPPSRCS = \
|
|||
ProfilesDlg.cpp \
|
||||
winEmbedFileLocProvider.cpp \
|
||||
MostRecentUrls.cpp \
|
||||
PrintProgressDialog.cpp \
|
||||
Preferences.cpp \
|
||||
PrintSetupDialog.cpp \
|
||||
StdAfx.cpp \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -407,17 +407,6 @@ BEGIN
|
|||
PUSHBUTTON "Cancel",IDCANCEL,182,23,50,14
|
||||
END
|
||||
|
||||
IDD_PRINT_PROGRESS_DIALOG DIALOG DISCARDABLE 0, 0, 294, 55
|
||||
STYLE DS_SYSMODAL | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE |
|
||||
WS_CAPTION
|
||||
CAPTION "Printing..."
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
PUSHBUTTON "Cancel",IDCANCEL,122,34,50,14
|
||||
LTEXT "Document:",IDC_PPD_DOC_TITLE_STATIC,7,7,36,8
|
||||
LTEXT "",IDC_PPD_DOC_TXT,43,7,244,8
|
||||
END
|
||||
|
||||
IDD_PREFS_START_PAGE DIALOG DISCARDABLE 0, 0, 284, 150
|
||||
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
|
||||
CAPTION "Startup"
|
||||
|
@ -435,58 +424,93 @@ BEGIN
|
|||
EDITTEXT IDC_EDIT_HOMEPAGE,53,95,211,14,ES_AUTOHSCROLL
|
||||
END
|
||||
|
||||
IDD_PRINTSETUP_DIALOG DIALOG DISCARDABLE 0, 0, 328, 183
|
||||
IDD_PRINTSETUP_DIALOG DIALOG DISCARDABLE 0, 0, 328, 175
|
||||
STYLE DS_SYSMODAL | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Page Setup"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
COMBOBOX IDC_PAPER_SIZE_CBX,26,16,81,67,CBS_DROPDOWNLIST |
|
||||
DEFPUSHBUTTON "OK",IDOK,7,154,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,271,154,50,14
|
||||
CONTROL "Tab1",IDC_PRINTSETUP_TAB_CTRL,"SysTabControl32",0x0,7,7,
|
||||
314,125
|
||||
END
|
||||
|
||||
IDD_HEADERFOOTER_TAB DIALOG DISCARDABLE 0, 0, 319, 106
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Margins & Headers/Footers"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
GROUPBOX "Headers and Footers",IDC_STATIC,7,38,229,56
|
||||
RTEXT "Left",IDC_STATIC,30,65,13,8
|
||||
RTEXT "Center",IDC_STATIC,104,65,22,8
|
||||
RTEXT "Right",IDC_STATIC,187,65,18,8
|
||||
EDITTEXT IDC_TOP_MARGIN_TXT,39,15,40,14,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_LEFT_MARGIN_TXT,112,15,40,14,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_BOTTOM_MARGIN_TXT,185,15,40,14,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_RIGHT_MARGIN_TXT,258,15,40,14,ES_AUTOHSCROLL
|
||||
GROUPBOX "Margins",IDC_STATIC,7,7,302,26
|
||||
LTEXT "Left:",IDC_STATIC,95,17,15,8
|
||||
LTEXT "Top:",IDC_STATIC,22,17,16,8
|
||||
LTEXT "Right:",IDC_STATIC,236,17,20,8
|
||||
LTEXT "Bottom:",IDC_STATIC,158,17,25,8
|
||||
COMBOBOX IDC_FTR_LEFT_CMBX,13,76,57,70,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
EDITTEXT IDC_UD_PAPER_WDTH,33,33,40,14,ES_AUTOHSCROLL |
|
||||
COMBOBOX IDC_FTR_CENTER_CMBX,92,76,57,70,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_FTR_RIGHT_CMBX,171,76,57,70,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_HDR_LEFT_CMBX,13,49,57,70,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_HDR_CENTER_CMBX,92,50,57,70,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_HDR_RIGHT_CMBX,171,50,57,70,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
END
|
||||
|
||||
IDD_FORMAT_OPTIONS_TAB DIALOG DISCARDABLE 0, 0, 321, 126
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Format & Options"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
CONTROL "&Portait",IDC_PRT_PORTRAIT_RD,"Button",
|
||||
BS_AUTORADIOBUTTON | WS_GROUP,14,16,36,10
|
||||
CONTROL "&Landscape",IDC_PRT_LANDSCAPE_RD,"Button",
|
||||
BS_AUTORADIOBUTTON,56,16,51,10
|
||||
COMBOBOX IDC_PAPER_SIZE_CBX,26,40,81,67,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_GROUP | WS_TABSTOP
|
||||
EDITTEXT IDC_UD_PAPER_WDTH,33,57,40,14,ES_AUTOHSCROLL |
|
||||
WS_DISABLED
|
||||
EDITTEXT IDC_UD_PAPER_HGT,106,33,40,14,ES_AUTOHSCROLL |
|
||||
EDITTEXT IDC_UD_PAPER_HGT,106,57,40,14,ES_AUTOHSCROLL |
|
||||
WS_DISABLED
|
||||
CONTROL "Inches",IDC_INCHES_RD,"Button",BS_AUTORADIOBUTTON |
|
||||
WS_DISABLED | WS_GROUP,13,52,37,10
|
||||
WS_DISABLED | WS_GROUP,13,76,37,10
|
||||
CONTROL "Millimeters",IDC_MILLI_RD,"Button",BS_AUTORADIOBUTTON |
|
||||
WS_DISABLED,53,52,48,10
|
||||
WS_DISABLED,53,76,48,10
|
||||
CONTROL "Slider1",IDC_SCALE,"msctls_trackbar32",TBS_AUTOTICKS |
|
||||
TBS_BOTH | WS_TABSTOP,9,81,100,19
|
||||
EDITTEXT IDC_SCALE_TXT,110,86,19,14,ES_AUTOHSCROLL
|
||||
TBS_BOTH | WS_TABSTOP,163,42,100,19
|
||||
EDITTEXT IDC_SCALE_TXT,264,47,19,14,ES_AUTOHSCROLL
|
||||
CONTROL "Print Background C&olors",IDC_PRT_BGCOLORS,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,8,107,92,10
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,10,100,92,10
|
||||
CONTROL "Print Background &Images",IDC_PRT_BGIMAGES,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,8,118,95,10
|
||||
EDITTEXT IDC_TOP_MARGIN_TXT,39,140,40,14,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_LEFT_MARGIN_TXT,112,140,40,14,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_BOTTOM_MARGIN_TXT,185,140,40,14,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_RIGHT_MARGIN_TXT,258,140,40,14,ES_AUTOHSCROLL
|
||||
DEFPUSHBUTTON "OK",IDOK,7,162,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,271,162,50,14
|
||||
GROUPBOX "Margins",IDC_STATIC,7,132,302,26
|
||||
LTEXT "Left:",IDC_STATIC,95,142,15,8
|
||||
LTEXT "Top:",IDC_STATIC,22,142,16,8
|
||||
LTEXT "Right:",IDC_STATIC,236,143,20,8
|
||||
LTEXT "Bottom:",IDC_STATIC,158,142,25,8
|
||||
GROUPBOX "Scaling",IDC_STATIC,7,70,148,34
|
||||
LTEXT "Size:",IDC_STATIC,10,17,16,8
|
||||
GROUPBOX "Paper Size",IDC_STATIC,7,7,147,57
|
||||
LTEXT "Width:",IDC_UD_WIDTH_LBL,10,36,22,8,WS_DISABLED
|
||||
LTEXT "Height:",IDC_UD_HEIGHT_LBL,81,36,24,8,WS_DISABLED
|
||||
GROUPBOX "Header",IDC_STATIC,161,7,147,60
|
||||
LTEXT "Left:",IDC_STATIC,172,19,15,8
|
||||
EDITTEXT IDC_HDR_LEFT_TXT,187,17,117,14,ES_AUTOHSCROLL
|
||||
LTEXT "Middle:",IDC_STATIC,163,36,24,8
|
||||
EDITTEXT IDC_HDR_MID_TXT,187,33,117,14,ES_AUTOHSCROLL
|
||||
LTEXT "Right:",IDC_STATIC,167,51,20,8
|
||||
EDITTEXT IDC_HDR_RIGHT_TXT,187,49,117,14,ES_AUTOHSCROLL
|
||||
GROUPBOX "Footer",IDC_STATIC,161,69,147,60
|
||||
LTEXT "Left:",IDC_STATIC,172,81,15,8
|
||||
EDITTEXT IDC_FTR_LEFT_TXT,187,79,117,14,ES_AUTOHSCROLL
|
||||
LTEXT "Middle:",IDC_STATIC,163,97,24,8
|
||||
EDITTEXT IDC_FTR_MID_TXT,187,95,117,14,ES_AUTOHSCROLL
|
||||
LTEXT "Right:",IDC_STATIC,167,113,20,8
|
||||
EDITTEXT IDC_FTR_RIGHT_TXT,187,111,117,14,ES_AUTOHSCROLL
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,124,100,95,10
|
||||
GROUPBOX "Scaling",IDC_STATIC,161,31,148,34
|
||||
LTEXT "Size:",IDC_STATIC,10,41,16,8
|
||||
GROUPBOX "Format",IDC_STATIC,7,31,147,57
|
||||
LTEXT "Width:",IDC_UD_WIDTH_LBL,10,60,22,8,WS_DISABLED
|
||||
LTEXT "Height:",IDC_UD_HEIGHT_LBL,81,60,24,8,WS_DISABLED
|
||||
GROUPBOX "Options",IDC_STATIC,7,90,213,25
|
||||
GROUPBOX "Orientation",IDC_STATIC,7,7,104,22
|
||||
END
|
||||
|
||||
IDD_CUSTOM_PROMPT_DIALOG DIALOG DISCARDABLE 0, 0, 232, 49
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Custom"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
EDITTEXT IDC_PROMPT_TEXT,35,7,135,14,ES_AUTOHSCROLL
|
||||
DEFPUSHBUTTON "OK",IDOK,175,7,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,175,24,50,14
|
||||
LTEXT "Custom:",IDC_STATIC,7,8,26,8
|
||||
END
|
||||
|
||||
|
||||
|
@ -573,20 +597,36 @@ BEGIN
|
|||
BOTTOMMARGIN, 69
|
||||
END
|
||||
|
||||
IDD_PRINT_PROGRESS_DIALOG, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 287
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 48
|
||||
END
|
||||
|
||||
IDD_PRINTSETUP_DIALOG, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 321
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 176
|
||||
BOTTOMMARGIN, 168
|
||||
END
|
||||
|
||||
IDD_HEADERFOOTER_TAB, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 312
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 99
|
||||
END
|
||||
|
||||
IDD_FORMAT_OPTIONS_TAB, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 314
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 119
|
||||
END
|
||||
|
||||
IDD_CUSTOM_PROMPT_DIALOG, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 225
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 42
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
|
|
@ -1,119 +0,0 @@
|
|||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: Mozilla-sample-code 1.0
|
||||
#
|
||||
# Copyright (c) 2002 Netscape Communications Corporation and
|
||||
# other contributors
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||
# copy of this Mozilla sample software and associated documentation files
|
||||
# (the "Software"), to deal in the Software without restriction, including
|
||||
# without limitation the rights to use, copy, modify, merge, publish,
|
||||
# distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
# persons to whom the Software is furnished to do so, subject to the
|
||||
# following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included
|
||||
# in all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
# DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH=..\..\..
|
||||
REQUIRES = \
|
||||
xpcom \
|
||||
string \
|
||||
necko \
|
||||
webBrowser_core \
|
||||
widget \
|
||||
docshell \
|
||||
dom \
|
||||
uriloader \
|
||||
embed_base \
|
||||
webshell \
|
||||
shistory \
|
||||
pref \
|
||||
profile \
|
||||
find \
|
||||
gfx \
|
||||
windowwatcher \
|
||||
layout \
|
||||
webbrowserpersist \
|
||||
composer \
|
||||
commandhandler \
|
||||
$(NULL)
|
||||
|
||||
DIRS=components \
|
||||
$(NULL)
|
||||
|
||||
MAKE_OBJ_TYPE = EXE
|
||||
|
||||
MODULE = mfcembed
|
||||
PROGRAM = .\$(OBJDIR)\$(MODULE).exe
|
||||
RESFILE = $(MODULE).res
|
||||
|
||||
LINCS = -Icomponents \
|
||||
$(NULL)
|
||||
|
||||
#
|
||||
# Control the default heap size.
|
||||
# This is the heap returned by GetProcessHeap().
|
||||
# As we use the CRT heap, the default size is too large and wastes VM.
|
||||
#
|
||||
# The default heap size is 1MB on Win32.
|
||||
# The heap will grow if need be.
|
||||
#
|
||||
# Set it to 256k. See bug 127069.
|
||||
#
|
||||
LLFLAGS=$(LLFLAGS) /HEAP:0x40000
|
||||
|
||||
|
||||
OBJS = \
|
||||
.\$(OBJDIR)\MfcEmbed.obj \
|
||||
.\$(OBJDIR)\BrowserFrm.obj \
|
||||
.\$(OBJDIR)\EditorFrm.obj \
|
||||
.\$(OBJDIR)\BrowserFrameGlue.obj \
|
||||
.\$(OBJDIR)\BrowserView.obj \
|
||||
.\$(OBJDIR)\BrowserImpl.obj \
|
||||
.\$(OBJDIR)\BrowserImplWebPrgrsLstnr.obj \
|
||||
.\$(OBJDIR)\BrowserImplCtxMenuLstnr.obj \
|
||||
.\$(OBJDIR)\Dialogs.obj \
|
||||
.\$(OBJDIR)\ProfileMgr.obj \
|
||||
.\$(OBJDIR)\ProfilesDlg.obj \
|
||||
.\$(OBJDIR)\winEmbedFileLocProvider.obj \
|
||||
.\$(OBJDIR)\MostRecentUrls.obj \
|
||||
.\$(OBJDIR)\PrintProgressDialog.obj \
|
||||
.\$(OBJDIR)\Preferences.obj \
|
||||
.\$(OBJDIR)\PrintSetupDialog.obj \
|
||||
.\$(OBJDIR)\StdAfx.obj \
|
||||
$(NULL)
|
||||
|
||||
LLIBS= \
|
||||
$(DIST)\lib\baseembed_s.lib \
|
||||
$(DIST)\lib\gkgfx.lib \
|
||||
$(DIST)\lib\xpcom.lib \
|
||||
$(DIST)\lib\mfcEmbedComponents.lib \
|
||||
$(LIBNSPR) \
|
||||
$(NULL)
|
||||
|
||||
LCFLAGS = /D "_AFXDLL" /D "USE_SINGLE_SIGN_ON"
|
||||
LLFLAGS = $(LLFLAGS) -SUBSYSTEM:windows
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
libs:: $(PROGRAM)
|
||||
$(MAKE_INSTALL) $(PROGRAM) $(DIST)\bin
|
||||
$(MAKE_INSTALL) mfcembed.htm $(DIST)\bin
|
||||
|
||||
clobber_all::
|
||||
$(RM) $(DIST)\bin\$(MODULE).exe
|
||||
$(RM) $(DIST)\bin\mfcembed.htm
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by MfcEmbed.rc
|
||||
// Used by mfcembed.rc
|
||||
//
|
||||
#define IDD_ABOUTBOX 100
|
||||
#define ID_TOOLBAR_UPDATE 101
|
||||
|
@ -18,7 +18,6 @@
|
|||
#define IDD_PROFILE_NEW 138
|
||||
#define IDD_PROFILE_RENAME 139
|
||||
#define IDD_FINDDLG 140
|
||||
#define IDD_PRINT_PROGRESS_DIALOG 141
|
||||
#define IDD_PREFS_START_PAGE 142
|
||||
#define IDR_SECURITY_LOCK 143
|
||||
#define IDR_SECURITY_UNLOCK 144
|
||||
|
@ -32,6 +31,9 @@
|
|||
#define IDS_VIEW_FRAME_SOURCE 153
|
||||
#define IDS_OPEN_FRAME_IN_NEW_WINDOW 154
|
||||
#define IDR_CTXMENU_EDITOR 155
|
||||
#define IDD_HEADERFOOTER_TAB 156
|
||||
#define IDD_FORMAT_OPTIONS_TAB 157
|
||||
#define IDD_CUSTOM_PROMPT_DIALOG 159
|
||||
#define ID_URL_BAR 1001
|
||||
#define ID_PROG_BAR 1002
|
||||
#define IDC_PROMPT_ANSWER 1003
|
||||
|
@ -74,13 +76,23 @@
|
|||
#define IDC_HDR_RIGHT_TXT 1041
|
||||
#define IDC_WRAP_AROUND 1042
|
||||
#define IDC_FTR_LEFT_TXT 1042
|
||||
#define IDC_TAB1 1042
|
||||
#define IDC_PRINTSETUP_TAB_CTRL 1042
|
||||
#define IDC_SEARCH_BACKWARDS 1043
|
||||
#define IDC_FTR_MID_TXT 1043
|
||||
#define IDC_FTR_RIGHT_TXT 1044
|
||||
#define IDC_FIND_EDIT 1152
|
||||
#define IDC_RADIO_BLANK_PAGE 1153
|
||||
#define IDC_RADIO_HOME_PAGE 1154
|
||||
#define IDC_EDIT_HOMEPAGE 1155
|
||||
#define IDC_FTR_LEFT_CMBX 1045
|
||||
#define IDC_FTR_CENTER_CMBX 1047
|
||||
#define IDC_FTR_RIGHT_CMBX 1048
|
||||
#define IDC_HDR_LEFT_CMBX 1049
|
||||
#define IDC_HDR_CENTER_CMBX 1050
|
||||
#define IDC_HDR_RIGHT_CMBX 1051
|
||||
#define IDC_FIND_EDIT 1052
|
||||
#define IDC_RADIO_BLANK_PAGE 1053
|
||||
#define IDC_RADIO_HOME_PAGE 1054
|
||||
#define IDC_EDIT_HOMEPAGE 1055
|
||||
#define IDC_PRT_PORTRAIT_RD 1056
|
||||
#define IDC_PRT_LANDSCAPE_RD 1057
|
||||
#define ID_NAV_BACK 32773
|
||||
#define ID_NAV_FORWARD 32774
|
||||
#define ID_NAV_HOME 32775
|
||||
|
@ -126,9 +138,9 @@
|
|||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_3D_CONTROLS 1
|
||||
#define _APS_NEXT_RESOURCE_VALUE 156
|
||||
#define _APS_NEXT_RESOURCE_VALUE 160
|
||||
#define _APS_NEXT_COMMAND_VALUE 32813
|
||||
#define _APS_NEXT_CONTROL_VALUE 1042
|
||||
#define _APS_NEXT_CONTROL_VALUE 1058
|
||||
#define _APS_NEXT_SYMED_VALUE 102
|
||||
#endif
|
||||
#endif
|
||||
|
|
Загрузка…
Ссылка в новой задаче