Back to index

lightning-sunbird  0.9+nobinonly
Public Types | Public Member Functions | Public Attributes | Protected Member Functions
CFormatOptionTab Class Reference

#include <CFormatOptionTab.h>

Collaboration diagram for CFormatOptionTab:
Collaboration graph
[legend]

List of all members.

Public Types

enum  { IDD = IDD_FORMAT_OPTIONS_TAB }

Public Member Functions

 CFormatOptionTab ()
 ~CFormatOptionTab ()
void GetPaperSizeInfo (short &aType, double &aWidth, double &aHeight)

Public Attributes

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
nsCOMPtr< nsIPrintSettingsm_PrintSettings
int m_PaperSizeInx

Protected Member Functions

virtual void DoDataExchange (CDataExchange *pDX)
void EnableUserDefineControls (BOOL aEnable)
int GetPaperSizeIndexFromData (short aType, double aW, double aH)
int GetPaperSizeIndex (const CString &aStr)
virtual BOOL OnInitDialog ()
afx_msg void OnCustomdrawScale (NMHDR *pNMHDR, LRESULT *pResult)
afx_msg void OnKillfocusScaleTxt ()
afx_msg void OnSelchangePaperSizeCbx ()

Detailed Description

Definition at line 46 of file CFormatOptionTab.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
IDD 

Definition at line 58 of file CFormatOptionTab.h.


Constructor & Destructor Documentation

Definition at line 39 of file CFormatOptionTab.cpp.

                                   : 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
}

Definition at line 54 of file CFormatOptionTab.cpp.

{
}

Member Function Documentation

void CFormatOptionTab::DoDataExchange ( CDataExchange *  pDX) [protected, virtual]

Definition at line 58 of file CFormatOptionTab.cpp.

{
         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
}

Definition at line 200 of file CFormatOptionTab.cpp.

{
         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);
}

Here is the caller graph for this function:

int CFormatOptionTab::GetPaperSizeIndex ( const CString &  aStr) [protected]

Definition at line 270 of file CFormatOptionTab.cpp.

{
    for (int i=0;i<gNumPaperSizes;i++) 
    {
        if (!aStr.Compare(gPaperSize[i].mDesc)) 
        {
            return i;
        }
    }
    return -1;
}

Here is the caller graph for this function:

int CFormatOptionTab::GetPaperSizeIndexFromData ( short  aType,
double  aW,
double  aH 
) [protected]

Definition at line 245 of file CFormatOptionTab.cpp.

{
    int i;
    for (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;
}
void CFormatOptionTab::GetPaperSizeInfo ( short &  aType,
double &  aWidth,
double &  aHeight 
)

Definition at line 228 of file CFormatOptionTab.cpp.

Here is the caller graph for this function:

void CFormatOptionTab::OnCustomdrawScale ( NMHDR *  pNMHDR,
LRESULT pResult 
) [protected]

Definition at line 158 of file CFormatOptionTab.cpp.

{
    CSliderCtrl* scale = (CSliderCtrl*)GetDlgItem(IDC_SCALE);
    CWnd* scaleTxt     = GetDlgItem(IDC_SCALE_TXT);
    if (scale != NULL && scaleTxt != NULL) 
    {
        CString str;
        str.Format(_T("%d"), scale->GetPos());
        scaleTxt->SetWindowText(str);
    }
         
         *pResult = 0;
}
BOOL CFormatOptionTab::OnInitDialog ( ) [protected, virtual]

Definition at line 86 of file CFormatOptionTab.cpp.

{
         CDialog::OnInitDialog();
         
    CSliderCtrl* scale = (CSliderCtrl*)GetDlgItem(IDC_SCALE);
    CWnd* scaleTxt     = GetDlgItem(IDC_SCALE_TXT);
    if (scale != NULL) 
    {
        scale->SetRange(kMinScaleRange, 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(_T("%6.2f"), paperWidth);
                hStr.Format(_T("%6.2f"), paperHeight);
                CheckRadioButton(IDC_INCHES_RD, IDC_MILLI_RD, IDC_INCHES_RD);
            } 
            else 
            {
                wStr.Format(_T("%d"), int(paperWidth));
                hStr.Format(_T("%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
}

Definition at line 187 of file CFormatOptionTab.cpp.

{
    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));
    }  
}

Here is the call graph for this function:

Definition at line 216 of file CFormatOptionTab.cpp.

{
         CComboBox* cbx = (CComboBox*)GetDlgItem(IDC_PAPER_SIZE_CBX);
    if (cbx) 
    {
        CString text;
        cbx->GetWindowText(text);
        m_PaperSizeInx = GetPaperSizeIndex(text);
        EnableUserDefineControls(gPaperSize[m_PaperSizeInx].mIsUserDefined);
    }
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 60 of file CFormatOptionTab.h.

Definition at line 64 of file CFormatOptionTab.h.

Definition at line 63 of file CFormatOptionTab.h.

Definition at line 67 of file CFormatOptionTab.h.

Definition at line 65 of file CFormatOptionTab.h.

Definition at line 59 of file CFormatOptionTab.h.

Definition at line 71 of file CFormatOptionTab.h.

Definition at line 66 of file CFormatOptionTab.h.

Definition at line 70 of file CFormatOptionTab.h.

Definition at line 61 of file CFormatOptionTab.h.

Definition at line 62 of file CFormatOptionTab.h.


The documentation for this class was generated from the following files: