1.3 updates
This commit is contained in:
parent
e32ba2d80d
commit
42d34dfa8b
13 changed files with 627 additions and 725 deletions
131
CB32.clw
131
CB32.clw
|
|
@ -2,13 +2,13 @@
|
||||||
|
|
||||||
[General Info]
|
[General Info]
|
||||||
Version=1
|
Version=1
|
||||||
LastClass=CCB32View
|
LastClass=CPMerge
|
||||||
LastTemplate=CPropertyPage
|
LastTemplate=CDialog
|
||||||
NewFileInclude1=#include "stdafx.h"
|
NewFileInclude1=#include "stdafx.h"
|
||||||
NewFileInclude2=#include "cb32.h"
|
NewFileInclude2=#include "cb32.h"
|
||||||
LastPage=0
|
LastPage=0
|
||||||
|
|
||||||
ClassCount=25
|
ClassCount=26
|
||||||
Class1=CMainFrame
|
Class1=CMainFrame
|
||||||
Class2=CPropAdd
|
Class2=CPropAdd
|
||||||
Class3=CPropInfo
|
Class3=CPropInfo
|
||||||
|
|
@ -25,32 +25,34 @@ Class13=CFindDlg
|
||||||
Class14=CTBComboBox
|
Class14=CTBComboBox
|
||||||
Class15=CComboToolBar
|
Class15=CComboToolBar
|
||||||
|
|
||||||
ResourceCount=15
|
ResourceCount=16
|
||||||
Resource1=IDD_PPAGE
|
Resource1=IDD_COLPAGE
|
||||||
Resource2=IDR_CONTEXTMENU
|
Resource2=IDD_GETNEW
|
||||||
Resource3=IDD_ABOUTBOX
|
Resource3=IDD_NPAGE
|
||||||
Resource4=IDD_COLPAGE
|
Resource4=IDD_PPAGE
|
||||||
Resource5=IDD_CONVERT
|
Resource5=IDD_SETPAGE
|
||||||
Resource6=IDR_MAINFRAME
|
Resource6=IDD_ABOUTBOX
|
||||||
Resource7=IDD_SETPAGE
|
Resource7=IDD_CONVERT
|
||||||
Resource8=IDR_TRAYMENU
|
Resource8=IDR_TRAYMENU
|
||||||
Resource9=IDD_APAGE
|
Resource9=IDD_OPAGE
|
||||||
Resource10=IDD_OPAGE
|
Resource10=IDD_APAGE
|
||||||
Class16=CProgDlg
|
Class16=CProgDlg
|
||||||
Class17=CSetPage
|
Class17=CSetPage
|
||||||
Class18=CDefPage
|
Class18=CDefPage
|
||||||
Class19=CColPage
|
Class19=CColPage
|
||||||
Class20=CPrefPage
|
Class20=CPrefPage
|
||||||
Resource11=IDD_CPAGE
|
Resource11=IDD_ORDPAGE
|
||||||
Resource12=IDD_GETNEW
|
Resource12=IDR_CONTEXTMENU
|
||||||
Resource13=IDD_ORDPAGE
|
Resource13=IDD_CPAGE
|
||||||
Class21=CGetNew
|
Class21=CGetNew
|
||||||
Class22=CPropComp
|
Class22=CPropComp
|
||||||
Class23=CMyHeaderCtrl
|
Class23=CMyHeaderCtrl
|
||||||
Class24=CHyperLink
|
Class24=CHyperLink
|
||||||
Resource14=IDD_FIND
|
Resource14=IDD_PMERGE
|
||||||
Class25=COrdPage
|
Class25=COrdPage
|
||||||
Resource15=IDD_NPAGE
|
Resource15=IDD_FIND
|
||||||
|
Class26=CPMerge
|
||||||
|
Resource16=IDR_MAINFRAME
|
||||||
|
|
||||||
[CLS:CMainFrame]
|
[CLS:CMainFrame]
|
||||||
Type=0
|
Type=0
|
||||||
|
|
@ -220,7 +222,7 @@ Command1=ID_ENTRY_COPY
|
||||||
Command2=ID_EDIT_FIND
|
Command2=ID_EDIT_FIND
|
||||||
Command3=ID_FILE_NEW
|
Command3=ID_FILE_NEW
|
||||||
Command4=ID_FILE_OPEN
|
Command4=ID_FILE_OPEN
|
||||||
Command5=ID_FILE_PRINT
|
Command5=ID_FILE_PRINT_MERGE
|
||||||
Command6=ID_FILE_SAVE
|
Command6=ID_FILE_SAVE
|
||||||
Command7=ID_EDIT_PASTE
|
Command7=ID_EDIT_PASTE
|
||||||
Command8=ID_EDIT_UNDO
|
Command8=ID_EDIT_UNDO
|
||||||
|
|
@ -269,33 +271,34 @@ Command5=ID_IMPORT_CSV
|
||||||
Command6=ID_IMPORT_TAB
|
Command6=ID_IMPORT_TAB
|
||||||
Command7=ID_EXPORT_CSV
|
Command7=ID_EXPORT_CSV
|
||||||
Command8=ID_EXPORT_TAB
|
Command8=ID_EXPORT_TAB
|
||||||
Command9=ID_FILE_MRU_FILE1
|
Command9=ID_FILE_PRINT_MERGE
|
||||||
Command10=ID_APP_EXIT
|
Command10=ID_FILE_MRU_FILE1
|
||||||
Command11=ID_EDIT_FIND
|
Command11=ID_APP_EXIT
|
||||||
Command12=ID_VIEW_FIND_NEXT
|
Command12=ID_EDIT_FIND
|
||||||
Command13=ID_APP_PREFS
|
Command13=ID_VIEW_FIND_NEXT
|
||||||
Command14=ID_ENTRY_ADD
|
Command14=ID_APP_PREFS
|
||||||
Command15=ID_ENTRY_EDIT
|
Command15=ID_ENTRY_ADD
|
||||||
Command16=ID_ENTRY_DELETE
|
Command16=ID_ENTRY_EDIT
|
||||||
Command17=ID_ENTRY_COPY
|
Command17=ID_ENTRY_DELETE
|
||||||
Command18=ID_DIAL_HOME
|
Command18=ID_ENTRY_COPY
|
||||||
Command19=ID_DIAL_WORK
|
Command19=ID_DIAL_HOME
|
||||||
Command20=ID_DIAL_PAGER
|
Command20=ID_DIAL_WORK
|
||||||
Command21=ID_DIAL_FAX
|
Command21=ID_DIAL_PAGER
|
||||||
Command22=ID_DIAL_CELL
|
Command22=ID_DIAL_FAX
|
||||||
Command23=ID_EMAIL_ADD1
|
Command23=ID_DIAL_CELL
|
||||||
Command24=ID_EMAIL_ADD2
|
Command24=ID_EMAIL_ADD1
|
||||||
Command25=ID_URL1
|
Command25=ID_EMAIL_ADD2
|
||||||
Command26=ID_URL2
|
Command26=ID_URL1
|
||||||
Command27=ID_VIEW_TOOLBAR
|
Command27=ID_URL2
|
||||||
Command28=ID_VIEW_STATUS_BAR
|
Command28=ID_VIEW_TOOLBAR
|
||||||
Command29=ID_VIEW_FLATBAR
|
Command29=ID_VIEW_STATUS_BAR
|
||||||
Command30=ID_VIEW_WNDPOS
|
Command30=ID_VIEW_FLATBAR
|
||||||
Command31=ID_VIEW_COLSET
|
Command31=ID_VIEW_WNDPOS
|
||||||
Command32=ID_VIEW_COLPOS
|
Command32=ID_VIEW_COLSET
|
||||||
Command33=ID_HELP_INDEX
|
Command33=ID_VIEW_COLPOS
|
||||||
Command34=ID_APP_ABOUT
|
Command34=ID_HELP_INDEX
|
||||||
CommandCount=34
|
Command35=ID_APP_ABOUT
|
||||||
|
CommandCount=35
|
||||||
|
|
||||||
[DLG:IDD_CONVERT]
|
[DLG:IDD_CONVERT]
|
||||||
Type=1
|
Type=1
|
||||||
|
|
@ -442,7 +445,7 @@ HeaderFile=FindDlg.h
|
||||||
ImplementationFile=FindDlg.cpp
|
ImplementationFile=FindDlg.cpp
|
||||||
BaseClass=CDialog
|
BaseClass=CDialog
|
||||||
Filter=D
|
Filter=D
|
||||||
LastObject=IDC_FCOMBO
|
LastObject=CFindDlg
|
||||||
VirtualFilter=dWC
|
VirtualFilter=dWC
|
||||||
|
|
||||||
[CLS:CTBComboBox]
|
[CLS:CTBComboBox]
|
||||||
|
|
@ -766,3 +769,37 @@ Filter=D
|
||||||
VirtualFilter=idWC
|
VirtualFilter=idWC
|
||||||
LastObject=IDC_RESETCOL
|
LastObject=IDC_RESETCOL
|
||||||
|
|
||||||
|
[DLG:IDD_PMERGE]
|
||||||
|
Type=1
|
||||||
|
Class=CPMerge
|
||||||
|
ControlCount=20
|
||||||
|
Control1=IDC_PMTEMPLATE,combobox,1344340227
|
||||||
|
Control2=IDC_PMNEW,button,1342242816
|
||||||
|
Control3=IDC_PMDELETE,button,1342242816
|
||||||
|
Control4=IDC_PMHEAD,button,1342242816
|
||||||
|
Control5=IDC_PMBODY,button,1342242816
|
||||||
|
Control6=IDC_PMFOOT,button,1342242816
|
||||||
|
Control7=IDC_PM_FILE,edit,1350631552
|
||||||
|
Control8=IDC_PMBROW_FILE,button,1342242816
|
||||||
|
Control9=IDC_PM_EDIT,edit,1350631552
|
||||||
|
Control10=IDC_PMBROW_EDIT,button,1342242816
|
||||||
|
Control11=IDC_PM_VIEW,edit,1350631552
|
||||||
|
Control12=IDC_PMBROW_VIEW,button,1342242816
|
||||||
|
Control13=IDC_PMLAUNCH,button,1342242819
|
||||||
|
Control14=IDOK,button,1342242817
|
||||||
|
Control15=IDCANCEL,button,1342242816
|
||||||
|
Control16=IDC_STATIC,button,1342177287
|
||||||
|
Control17=IDC_STATIC,button,1342177287
|
||||||
|
Control18=IDC_STATIC,static,1342308352
|
||||||
|
Control19=IDC_STATIC,static,1342308352
|
||||||
|
Control20=IDC_STATIC,static,1342308352
|
||||||
|
|
||||||
|
[CLS:CPMerge]
|
||||||
|
Type=0
|
||||||
|
HeaderFile=PMerge.h
|
||||||
|
ImplementationFile=PMerge.cpp
|
||||||
|
BaseClass=CDialog
|
||||||
|
Filter=D
|
||||||
|
LastObject=IDC_PMBROW_VIEW
|
||||||
|
VirtualFilter=dWC
|
||||||
|
|
||||||
|
|
|
||||||
14
CB32.cpp
14
CB32.cpp
|
|
@ -49,13 +49,15 @@ CCB32App theApp;
|
||||||
BOOL CCB32App::InitInstance()
|
BOOL CCB32App::InitInstance()
|
||||||
{
|
{
|
||||||
// find the location of the exe from Help File Path
|
// find the location of the exe from Help File Path
|
||||||
CString sHelp, sIni;
|
CString szHelp, szPath;
|
||||||
sHelp = m_pszHelpFilePath;
|
szHelp = m_pszHelpFilePath;
|
||||||
sIni = sHelp.Left(sHelp.ReverseFind('.'));
|
szPath = szHelp.Left(szHelp.ReverseFind('.')) + ".INI";
|
||||||
sIni += ".INI";
|
|
||||||
free((void*)m_pszProfileName);
|
free((void*)m_pszProfileName);
|
||||||
m_pszProfileName = _tcsdup((LPCSTR)sIni);
|
m_pszProfileName = _tcsdup((LPCSTR)szPath);
|
||||||
|
// set global path to self
|
||||||
|
szPath = szHelp.Left(szHelp.ReverseFind('\\')) + '\\';
|
||||||
|
m_pszPathToExe = _tcsdup((LPCSTR)szPath);
|
||||||
|
|
||||||
#ifdef _AFXDLL
|
#ifdef _AFXDLL
|
||||||
Enable3dControls(); // Call this when using MFC in a shared DLL
|
Enable3dControls(); // Call this when using MFC in a shared DLL
|
||||||
#else
|
#else
|
||||||
|
|
|
||||||
2
CB32.h
2
CB32.h
|
|
@ -32,6 +32,8 @@ public:
|
||||||
virtual BOOL OnIdle(LONG lCount);
|
virtual BOOL OnIdle(LONG lCount);
|
||||||
CCB32App();
|
CCB32App();
|
||||||
|
|
||||||
|
CString m_pszPathToExe;
|
||||||
|
|
||||||
// Operations
|
// Operations
|
||||||
public:
|
public:
|
||||||
void UpdateIniFileWithDocPath(LPCTSTR lpszPathName);
|
void UpdateIniFileWithDocPath(LPCTSTR lpszPathName);
|
||||||
|
|
|
||||||
49
CB32.rc
49
CB32.rc
|
|
@ -164,6 +164,14 @@ BEGIN
|
||||||
TOPMARGIN, 7
|
TOPMARGIN, 7
|
||||||
BOTTOMMARGIN, 162
|
BOTTOMMARGIN, 162
|
||||||
END
|
END
|
||||||
|
|
||||||
|
IDD_PMERGE, DIALOG
|
||||||
|
BEGIN
|
||||||
|
LEFTMARGIN, 7
|
||||||
|
RIGHTMARGIN, 195
|
||||||
|
TOPMARGIN, 7
|
||||||
|
BOTTOMMARGIN, 182
|
||||||
|
END
|
||||||
END
|
END
|
||||||
#endif // APSTUDIO_INVOKED
|
#endif // APSTUDIO_INVOKED
|
||||||
|
|
||||||
|
|
@ -179,7 +187,7 @@ BEGIN
|
||||||
"F", ID_EDIT_FIND, VIRTKEY, CONTROL, NOINVERT
|
"F", ID_EDIT_FIND, VIRTKEY, CONTROL, NOINVERT
|
||||||
"N", ID_FILE_NEW, VIRTKEY, CONTROL, NOINVERT
|
"N", ID_FILE_NEW, VIRTKEY, CONTROL, NOINVERT
|
||||||
"O", ID_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT
|
"O", ID_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT
|
||||||
"P", ID_FILE_PRINT, VIRTKEY, CONTROL, NOINVERT
|
"P", ID_FILE_PRINT_MERGE, VIRTKEY, CONTROL, NOINVERT
|
||||||
"S", ID_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT
|
"S", ID_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT
|
||||||
"V", ID_EDIT_PASTE, VIRTKEY, CONTROL, NOINVERT
|
"V", ID_EDIT_PASTE, VIRTKEY, CONTROL, NOINVERT
|
||||||
VK_BACK, ID_EDIT_UNDO, VIRTKEY, ALT, NOINVERT
|
VK_BACK, ID_EDIT_UNDO, VIRTKEY, ALT, NOINVERT
|
||||||
|
|
@ -764,6 +772,38 @@ BEGIN
|
||||||
PUSHBUTTON "Reset",IDC_RESETCOL,168,98,50,14
|
PUSHBUTTON "Reset",IDC_RESETCOL,168,98,50,14
|
||||||
END
|
END
|
||||||
|
|
||||||
|
IDD_PMERGE DIALOG DISCARDABLE 0, 0, 202, 189
|
||||||
|
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||||
|
CAPTION "Print Merge"
|
||||||
|
FONT 8, "MS Sans Serif"
|
||||||
|
BEGIN
|
||||||
|
COMBOBOX IDC_PMTEMPLATE,13,21,104,88,CBS_DROPDOWNLIST | CBS_SORT |
|
||||||
|
WS_VSCROLL | WS_TABSTOP
|
||||||
|
PUSHBUTTON "New",IDC_PMNEW,13,43,50,14
|
||||||
|
PUSHBUTTON "Delete",IDC_PMDELETE,67,43,50,14
|
||||||
|
PUSHBUTTON "Header",IDC_PMHEAD,132,20,50,14
|
||||||
|
PUSHBUTTON "Body",IDC_PMBODY,132,36,50,14
|
||||||
|
PUSHBUTTON "Footer",IDC_PMFOOT,132,52,50,14
|
||||||
|
EDITTEXT IDC_PM_FILE,13,79,160,12,ES_AUTOHSCROLL
|
||||||
|
PUSHBUTTON "...",IDC_PMBROW_FILE,178,79,11,12
|
||||||
|
EDITTEXT IDC_PM_EDIT,13,106,160,12,ES_AUTOHSCROLL
|
||||||
|
PUSHBUTTON "...",IDC_PMBROW_EDIT,178,106,11,12
|
||||||
|
EDITTEXT IDC_PM_VIEW,13,133,160,12,ES_AUTOHSCROLL
|
||||||
|
PUSHBUTTON "...",IDC_PMBROW_VIEW,178,133,11,12
|
||||||
|
CONTROL "Launch File/Viewer Automatically",IDC_PMLAUNCH,"Button",
|
||||||
|
BS_AUTOCHECKBOX | WS_TABSTOP,40,149,121,10
|
||||||
|
DEFPUSHBUTTON "OK",IDOK,90,168,50,14
|
||||||
|
PUSHBUTTON "Cancel",IDCANCEL,145,168,50,14
|
||||||
|
GROUPBOX "Template ",IDC_STATIC,7,3,188,160
|
||||||
|
GROUPBOX "Edit ",IDC_STATIC,125,10,63,62
|
||||||
|
LTEXT "Output File: (include extension)",IDC_STATIC,13,68,100,
|
||||||
|
8
|
||||||
|
LTEXT "Editor: (must accept filename on commandline)",
|
||||||
|
IDC_STATIC,13,95,149,8
|
||||||
|
LTEXT "Viewer: (leave blank for default system viewer)",
|
||||||
|
IDC_STATIC,13,121,148,8
|
||||||
|
END
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
|
|
@ -834,6 +874,8 @@ BEGIN
|
||||||
MENUITEM "&Tab Delimited", ID_EXPORT_TAB
|
MENUITEM "&Tab Delimited", ID_EXPORT_TAB
|
||||||
END
|
END
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
|
MENUITEM "Print Merge\tCtrl+P", ID_FILE_PRINT_MERGE
|
||||||
|
MENUITEM SEPARATOR
|
||||||
MENUITEM "Recent File", ID_FILE_MRU_FILE1, GRAYED
|
MENUITEM "Recent File", ID_FILE_MRU_FILE1, GRAYED
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
MENUITEM "E&xit", ID_APP_EXIT
|
MENUITEM "E&xit", ID_APP_EXIT
|
||||||
|
|
@ -1113,6 +1155,7 @@ BEGIN
|
||||||
ID_ENTRY_EDIT "Edit the Current Address\nEdit"
|
ID_ENTRY_EDIT "Edit the Current Address\nEdit"
|
||||||
ID_ENTRY_DELETE "Delete the Current Address\nDelete"
|
ID_ENTRY_DELETE "Delete the Current Address\nDelete"
|
||||||
ID_ENTRY_COPY "Copy the Current Address\nCopy"
|
ID_ENTRY_COPY "Copy the Current Address\nCopy"
|
||||||
|
ID_FILE_PRINT_MERGE "Generate a Print Merge file\nPrint Merge"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRINGTABLE DISCARDABLE
|
STRINGTABLE DISCARDABLE
|
||||||
|
|
@ -1198,6 +1241,10 @@ BEGIN
|
||||||
IDS_COLSAVE "Column widths have been saved."
|
IDS_COLSAVE "Column widths have been saved."
|
||||||
IDS_POSSAVE "Column positions have been saved."
|
IDS_POSSAVE "Column positions have been saved."
|
||||||
IDS_PREFS "Preferences"
|
IDS_PREFS "Preferences"
|
||||||
|
IDS_PRN_PAGE_FORMAT "Page: %2d"
|
||||||
|
IDS_MISSTMPL "One of the template files appears to be missing. Please check the TMPL directory to ensure the 4 required files (.TPL, .HED, .BOD, .FOT) are present."
|
||||||
|
IDS_OFN_OUT "Type New Filename or Choose Existing File"
|
||||||
|
IDS_OFN_EXE "Select Executable File"
|
||||||
END
|
END
|
||||||
|
|
||||||
#endif // English (U.S.) resources
|
#endif // English (U.S.) resources
|
||||||
|
|
|
||||||
10
CB32Doc.cpp
10
CB32Doc.cpp
|
|
@ -218,7 +218,7 @@ BOOL CCB32Doc::FileImport(CString fileName, char* whitesp, char* breakch)
|
||||||
CConvertDlg convertDlg;
|
CConvertDlg convertDlg;
|
||||||
if (inFile.ReadString(strLine,511)!=NULL)
|
if (inFile.ReadString(strLine,511)!=NULL)
|
||||||
{
|
{
|
||||||
newline = strstr(strLine, "\n");
|
newline = _tcsstr(strLine, "\n");
|
||||||
strpos = newline - strLine;
|
strpos = newline - strLine;
|
||||||
if (strpos != NULL)
|
if (strpos != NULL)
|
||||||
strLine[strpos]='\0';
|
strLine[strpos]='\0';
|
||||||
|
|
@ -386,7 +386,7 @@ BOOL CCB32Doc::FileImport(CString fileName, char* whitesp, char* breakch)
|
||||||
int z=0, next=0;
|
int z=0, next=0;
|
||||||
BOOL addexpr = FALSE;
|
BOOL addexpr = FALSE;
|
||||||
|
|
||||||
CExpr *expr = new CExpr("contact");
|
CExpr *expr = new CExpr(_T("contact"));
|
||||||
inList.RemoveAll();
|
inList.RemoveAll();
|
||||||
|
|
||||||
while(parser(0,strToken,sizeof(strLine),strLine,whitesp,breakch,
|
while(parser(0,strToken,sizeof(strLine),strLine,whitesp,breakch,
|
||||||
|
|
@ -402,7 +402,7 @@ BOOL CCB32Doc::FileImport(CString fileName, char* whitesp, char* breakch)
|
||||||
if (convertDlg.m_xlname>0 && convertDlg.m_xlname<z)
|
if (convertDlg.m_xlname>0 && convertDlg.m_xlname<z)
|
||||||
{
|
{
|
||||||
posIndex = inList.FindIndex(convertDlg.m_xlname-1);
|
posIndex = inList.FindIndex(convertDlg.m_xlname-1);
|
||||||
expr->AddAttributeValueString("LastName", inList.GetAt(posIndex));
|
expr->AddAttributeValueString(_T("LastName"), inList.GetAt(posIndex));
|
||||||
addexpr = TRUE;
|
addexpr = TRUE;
|
||||||
}
|
}
|
||||||
if (convertDlg.m_xfname>0 && convertDlg.m_xfname<z)
|
if (convertDlg.m_xfname>0 && convertDlg.m_xfname<z)
|
||||||
|
|
@ -804,7 +804,7 @@ BOOL CCB32Doc::FileExport(CString fileName, char* breakch)
|
||||||
// add firstline identifier
|
// add firstline identifier
|
||||||
db.ClearDatabase();
|
db.ClearDatabase();
|
||||||
CExpr *expr = new CExpr("contact");
|
CExpr *expr = new CExpr("contact");
|
||||||
expr->AddAttributeValueString("LastName", "LASTNAME");
|
expr->AddAttributeValueString(_T("LastName"), _T("LASTNAME"));
|
||||||
expr->AddAttributeValueString("FirstName", "FIRSTNAME");
|
expr->AddAttributeValueString("FirstName", "FIRSTNAME");
|
||||||
expr->AddAttributeValueString("MiddleInitial", "MI");
|
expr->AddAttributeValueString("MiddleInitial", "MI");
|
||||||
expr->AddAttributeValueString("Title", "TITLE");
|
expr->AddAttributeValueString("Title", "TITLE");
|
||||||
|
|
@ -861,7 +861,7 @@ BOOL CCB32Doc::FileExport(CString fileName, char* breakch)
|
||||||
|
|
||||||
if (convertDlg.m_xlname>0)
|
if (convertDlg.m_xlname>0)
|
||||||
{
|
{
|
||||||
expr->GetAttributeValue("LastName", strTemp);
|
expr->GetAttributeValue(_T("LastName"), strTemp);
|
||||||
dataArray.SetAtGrow(convertDlg.m_xlname, strTemp);
|
dataArray.SetAtGrow(convertDlg.m_xlname, strTemp);
|
||||||
}
|
}
|
||||||
if (convertDlg.m_xfname>0)
|
if (convertDlg.m_xfname>0)
|
||||||
|
|
|
||||||
805
CB32View.cpp
805
CB32View.cpp
|
|
@ -17,6 +17,7 @@
|
||||||
#include "FindDlg.h"
|
#include "FindDlg.h"
|
||||||
#include "GetNew.h"
|
#include "GetNew.h"
|
||||||
#include "PrefPage.h"
|
#include "PrefPage.h"
|
||||||
|
#include "PMerge.h"
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
#define new DEBUG_NEW
|
#define new DEBUG_NEW
|
||||||
|
|
@ -24,17 +25,6 @@
|
||||||
static char THIS_FILE[] = __FILE__;
|
static char THIS_FILE[] = __FILE__;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define HEADER_HEIGHT 2
|
|
||||||
#define FOOTER_HEIGHT 2
|
|
||||||
#define LEFT_MARGIN 4
|
|
||||||
#define RIGHT_MARGIN 4
|
|
||||||
#define TOP_MARGIN 1
|
|
||||||
#define BOTTOM_MARGIN 1
|
|
||||||
#define GAP 1
|
|
||||||
#define HIGHLIGHT_NORMAL 1
|
|
||||||
#define HIGHLIGHT_ALLCOLUMNS 2
|
|
||||||
#define HIGHLIGHT_ROW 3
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// CCB32View
|
// CCB32View
|
||||||
|
|
||||||
|
|
@ -87,6 +77,7 @@ BEGIN_MESSAGE_MAP(CCB32View, CListView)
|
||||||
ON_COMMAND(ID_VIEW_COLPOS, OnViewColpos)
|
ON_COMMAND(ID_VIEW_COLPOS, OnViewColpos)
|
||||||
ON_COMMAND(ID_ENTRY_COPY, OnEntryCopy)
|
ON_COMMAND(ID_ENTRY_COPY, OnEntryCopy)
|
||||||
ON_UPDATE_COMMAND_UI(ID_ENTRY_COPY, OnUpdateEntryCopy)
|
ON_UPDATE_COMMAND_UI(ID_ENTRY_COPY, OnUpdateEntryCopy)
|
||||||
|
ON_COMMAND(ID_FILE_PRINT_MERGE, OnFilePrintMerge)
|
||||||
//}}AFX_MSG_MAP
|
//}}AFX_MSG_MAP
|
||||||
// Standard printing commands
|
// Standard printing commands
|
||||||
ON_COMMAND(ID_FILE_PRINT, CListView::OnFilePrint)
|
ON_COMMAND(ID_FILE_PRINT, CListView::OnFilePrint)
|
||||||
|
|
@ -99,7 +90,7 @@ END_MESSAGE_MAP()
|
||||||
|
|
||||||
CCB32View::CCB32View()
|
CCB32View::CCB32View()
|
||||||
{
|
{
|
||||||
m_nHighlight = 1;
|
//m_nHighlight = 1;
|
||||||
m_iFirst = 0;
|
m_iFirst = 0;
|
||||||
m_pFindDialog = new CFindDlg;
|
m_pFindDialog = new CFindDlg;
|
||||||
m_headerctrl.SetCallback( this, (void (CWnd::*)(int, int))DragColumn );
|
m_headerctrl.SetCallback( this, (void (CWnd::*)(int, int))DragColumn );
|
||||||
|
|
@ -132,9 +123,6 @@ void CCB32View::OnDraw(CDC* pDC)
|
||||||
{
|
{
|
||||||
CCB32Doc* pDoc = GetDocument();
|
CCB32Doc* pDoc = GetDocument();
|
||||||
ASSERT_VALID(pDoc);
|
ASSERT_VALID(pDoc);
|
||||||
|
|
||||||
// TODO: add draw code for native data here
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCB32View::OnInitialUpdate()
|
void CCB32View::OnInitialUpdate()
|
||||||
|
|
@ -150,6 +138,7 @@ void CCB32View::OnInitialUpdate()
|
||||||
|
|
||||||
// Add items to the list view.
|
// Add items to the list view.
|
||||||
CListCtrl& ctlList = (CListCtrl&) GetListCtrl();
|
CListCtrl& ctlList = (CListCtrl&) GetListCtrl();
|
||||||
|
|
||||||
FreeItems();
|
FreeItems();
|
||||||
ctlList.DeleteAllItems();
|
ctlList.DeleteAllItems();
|
||||||
ctlList.SetBkColor(GetSysColor(COLOR_WINDOW));
|
ctlList.SetBkColor(GetSysColor(COLOR_WINDOW));
|
||||||
|
|
@ -288,648 +277,176 @@ void CCB32View::DrawItemText(CDC* pDC, CString text, CRect rect,
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// CCB32View printing
|
// CCB32View printing
|
||||||
|
|
||||||
BOOL CCB32View::OnPreparePrinting(CPrintInfo* pInfo)
|
BOOL CCB32View::OnPreparePrinting(CPrintInfo* pInfo)
|
||||||
{
|
{
|
||||||
// default preparation
|
// default preparation
|
||||||
return DoPreparePrinting(pInfo);
|
return DoPreparePrinting(pInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCB32View::OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo)
|
void CCB32View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
|
||||||
{
|
{
|
||||||
CListCtrl& ctlList = (CListCtrl&) GetListCtrl();
|
// nada
|
||||||
|
|
||||||
TEXTMETRIC tm;
|
|
||||||
CDC *pCurrentDC;
|
|
||||||
|
|
||||||
// OnBeginPrinting() is called after the user has committed to
|
|
||||||
// printing by OK'ing the Print dialog, and after the framework
|
|
||||||
// has created a CDC object for the printer or the preview view.
|
|
||||||
|
|
||||||
// This is the right opportunity to set up the page range.
|
|
||||||
// Given the CDC object, we can determine how many rows will
|
|
||||||
// fit on a page, so we can in turn determine how many printed
|
|
||||||
// pages represent the entire document.
|
|
||||||
|
|
||||||
ASSERT(pDC && pInfo);
|
|
||||||
if (!pDC || !pInfo) return;
|
|
||||||
|
|
||||||
int nMaxRowCount = ctlList.GetItemCount();
|
|
||||||
if (!nMaxRowCount) return;
|
|
||||||
|
|
||||||
// Get a DC for the current window (will be a screen DC for print previewing)
|
|
||||||
VERIFY(pCurrentDC = GetDC()); /* will have dimensions of the client area */
|
|
||||||
if (!pCurrentDC) return;
|
|
||||||
|
|
||||||
CSize PaperPixelsPerInch(pDC->GetDeviceCaps(LOGPIXELSX),
|
|
||||||
pDC->GetDeviceCaps(LOGPIXELSY));
|
|
||||||
CSize ScreenPixelsPerInch(pCurrentDC->GetDeviceCaps(LOGPIXELSX),
|
|
||||||
pCurrentDC->GetDeviceCaps(LOGPIXELSY));
|
|
||||||
|
|
||||||
// Create the printer font
|
|
||||||
int nFontSize = -9;
|
|
||||||
CString strFontName = _T("Times New Roman");
|
|
||||||
|
|
||||||
nFontSize = MulDiv(nFontSize, PaperPixelsPerInch.cy, ScreenPixelsPerInch.cy);
|
|
||||||
m_PrinterFont.CreateFont(nFontSize, 0,0,0, FW_NORMAL, 0,0,0, DEFAULT_CHARSET,
|
|
||||||
OUT_CHARACTER_PRECIS, CLIP_CHARACTER_PRECIS,
|
|
||||||
DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE,
|
|
||||||
strFontName);
|
|
||||||
|
|
||||||
CFont *pOldFont = pDC->SelectObject(&m_PrinterFont);
|
|
||||||
|
|
||||||
// Get the average character width (in ListCtrl units)
|
|
||||||
pCurrentDC->GetTextMetrics(&tm);
|
|
||||||
m_nCharWidth = tm.tmAveCharWidth;
|
|
||||||
m_nCharWidth = MulDiv(m_nCharWidth, PaperPixelsPerInch.cy,
|
|
||||||
ScreenPixelsPerInch.cy);
|
|
||||||
|
|
||||||
int nMargins = (LEFT_MARGIN+RIGHT_MARGIN)*m_nCharWidth;
|
|
||||||
|
|
||||||
// Scale the x axis to the ListCtrl's device units
|
|
||||||
CRect rc;
|
|
||||||
ctlList.GetItemRect(0, &rc, LVIR_BOUNDS);
|
|
||||||
m_nRowHeight = rc.Height();
|
|
||||||
m_nRowHeight = MulDiv(m_nRowHeight, PaperPixelsPerInch.cy,
|
|
||||||
ScreenPixelsPerInch.cy);
|
|
||||||
|
|
||||||
// Get the page size
|
|
||||||
CSize LogicalPageSize;
|
|
||||||
CSize PaperSize(pDC->GetDeviceCaps(HORZRES),
|
|
||||||
pDC->GetDeviceCaps(VERTRES));
|
|
||||||
LogicalPageSize.cx = rc.Width()+nMargins;
|
|
||||||
LogicalPageSize.cy = MulDiv(LogicalPageSize.cx, PaperSize.cy,
|
|
||||||
PaperSize.cx);
|
|
||||||
|
|
||||||
pDC->SetMapMode(MM_ANISOTROPIC);
|
|
||||||
pDC->SetWindowExt(LogicalPageSize);
|
|
||||||
pDC->SetViewportExt(PaperSize);
|
|
||||||
|
|
||||||
/* This should set the preview DC's extents so preview works. It don't work! :(
|
|
||||||
if (pInfo->m_bPreview) {
|
|
||||||
CSize PreviewPageSize = PaperSize;
|
|
||||||
PreviewPageSize.cx = MulDiv(PaperSize.cx, ScreenPixelsPerInch.cx,
|
|
||||||
PaperPixelsPerInch.cx);
|
|
||||||
PreviewPageSize.cy = MulDiv(PaperSize.cy, ScreenPixelsPerInch.cy,
|
|
||||||
PaperPixelsPerInch.cy);
|
|
||||||
|
|
||||||
SetWindowExtEx(pDC->m_hAttribDC, LogicalPageSize.cx, LogicalPageSize.cy, NULL);
|
|
||||||
SetViewportExtEx(pDC->m_hAttribDC, PreviewPageSize.cx, PreviewPageSize.cy, NULL);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Calculate the number of rows per page
|
|
||||||
m_nRowsPerPage = LogicalPageSize.cy / m_nRowHeight;
|
|
||||||
m_nRowsPerPage -= (HEADER_HEIGHT+FOOTER_HEIGHT + 2*GAP); // Header and footer
|
|
||||||
m_nRowsPerPage -= 1; // List control header
|
|
||||||
int nMaxPage = nMaxRowCount/m_nRowsPerPage + 1;
|
|
||||||
|
|
||||||
pInfo->SetMaxPage(nMaxPage);
|
|
||||||
pInfo->m_nCurPage = 1; // start printing at page# 1
|
|
||||||
|
|
||||||
ReleaseDC(pCurrentDC);
|
|
||||||
pDC->SelectObject(pOldFont);
|
|
||||||
|
|
||||||
/* old code
|
|
||||||
|
|
||||||
// OnBeginPrinting() is called after the user has committed to
|
|
||||||
// printing by OK'ing the Print dialog, and after the framework
|
|
||||||
// has created a CDC object for the printer or the preview view.
|
|
||||||
// This is the right opportunity to set up the page range.
|
|
||||||
// Given the CDC object, we can determine how many rows will
|
|
||||||
// fit on a page, so we can in turn determine how many printed
|
|
||||||
// pages represent the entire document.
|
|
||||||
if(NULL == pDC || NULL == pInfo)
|
|
||||||
return;
|
|
||||||
int nMaxRowCount = ctlList.GetItemCount();
|
|
||||||
if(!nMaxRowCount)
|
|
||||||
return;
|
|
||||||
|
|
||||||
//let us do all dimesions in ListControl units (Device) rather than
|
|
||||||
//printer device units. Since we have more control on them
|
|
||||||
CDC *pCtlDC = GetDC();
|
|
||||||
if(NULL == pCtlDC)
|
|
||||||
return;
|
|
||||||
TEXTMETRIC tm;
|
|
||||||
pCtlDC->GetTextMetrics(&tm);
|
|
||||||
m_nCharWidth = tm.tmAveCharWidth;
|
|
||||||
pDC->SetMapMode(MM_ANISOTROPIC);
|
|
||||||
CRect rc;
|
|
||||||
ctlList.GetItemRect(0, &rc, LVIR_BOUNDS);
|
|
||||||
m_nRowHeight = rc.Height();
|
|
||||||
int nMargins = (LEFT_MARGIN+RIGHT_MARGIN)*m_nCharWidth;
|
|
||||||
|
|
||||||
//this will optimize the column widths. If we have more column than
|
|
||||||
//screen width and horizontal scroll on List control
|
|
||||||
//this will reduce the column widths proportonately to fit all of them
|
|
||||||
//on the page. If we have fewer column all the column
|
|
||||||
//widths will increased propertionately.
|
|
||||||
pDC->SetWindowExt(rc.Width() + nMargins, pCtlDC->GetDeviceCaps(LOGPIXELSX));
|
|
||||||
pDC->SetViewportExt(pDC->GetDeviceCaps(HORZRES),pDC->GetDeviceCaps(LOGPIXELSX));
|
|
||||||
double d = (double)pDC->GetDeviceCaps(LOGPIXELSY)/(double)pCtlDC->GetDeviceCaps(LOGPIXELSY);
|
|
||||||
ReleaseDC(pCtlDC);
|
|
||||||
nMargins = (int)(m_nRowHeight*d);
|
|
||||||
int nPageHeight = pDC->GetDeviceCaps(VERTRES);
|
|
||||||
m_nRowsPerPage = nPageHeight/nMargins; //nMargins reused
|
|
||||||
m_nRowsPerPage -= (HEADER_HEIGHT+FOOTER_HEIGHT);
|
|
||||||
m_nRowsPerPage -= 1; //adjustment for list control header
|
|
||||||
int nMaxPage = nMaxRowCount/m_nRowsPerPage + 1;
|
|
||||||
pInfo->SetMaxPage(nMaxPage);
|
|
||||||
pInfo->m_nCurPage = 1; // start printing at page# 1
|
|
||||||
|
|
||||||
*/ // old code
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCB32View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
|
void CCB32View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
|
||||||
{
|
{
|
||||||
m_PrinterFont.DeleteObject();
|
// nada
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCB32View::OnPrint(CDC* pDC, CPrintInfo* pInfo)
|
void CCB32View::OnFilePrintMerge()
|
||||||
{
|
{
|
||||||
CListCtrl& ctlList = (CListCtrl&) GetListCtrl();
|
CPMerge pmDlg;
|
||||||
|
|
||||||
if (!pDC || !pInfo) return;
|
if (pmDlg.DoModal() == IDOK) {
|
||||||
|
CString myTmpl = theApp.GetProfileString(_T("Print"),_T("Template"),NULL);
|
||||||
CFont *pOldFont = pDC->SelectObject(&m_PrinterFont);
|
if (!myTmpl.IsEmpty()) {
|
||||||
|
CFileStatus fsTest;
|
||||||
// Draw as many rows as will fit on the printed page.
|
CFile tFile;
|
||||||
// Clip the printed page so that there is no partially shown
|
CString myFile = theApp.m_pszPathToExe + "TMPL\\" + myTmpl;
|
||||||
// row at the bottom of the page (the same row which will be fully
|
if (tFile.GetStatus(myFile+".tpl", fsTest) &&
|
||||||
// shown at the top of the next page).
|
tFile.GetStatus(myFile+".hed", fsTest) &&
|
||||||
int nStartRow = 0;
|
tFile.GetStatus(myFile+".bod", fsTest) &&
|
||||||
int nEndRow = 0;
|
tFile.GetStatus(myFile+".fot", fsTest)) {
|
||||||
int nMaxRowCount = ctlList.GetItemCount();
|
// theMeat.
|
||||||
|
PrintMerge(myFile);
|
||||||
nStartRow = (pInfo->m_nCurPage - 1)*m_nRowsPerPage;
|
// Launch?
|
||||||
nEndRow = nStartRow+m_nRowsPerPage;
|
if (GetPrivateProfileInt("Template","Launch",0, myFile+".tpl")) {
|
||||||
if(nEndRow > nMaxRowCount)
|
char chTmpOut[_MAX_PATH], chTmpView[_MAX_PATH];
|
||||||
nEndRow = nMaxRowCount;
|
// Output file?
|
||||||
|
GetPrivateProfileString("Template","Output",NULL,
|
||||||
pDC->SetWindowOrg(-LEFT_MARGIN*m_nCharWidth, 0);
|
chTmpOut, sizeof(chTmpOut), myFile+".tpl");
|
||||||
CRect rcPage(pInfo->m_rectDraw);
|
// Viewer?
|
||||||
|
GetPrivateProfileString("Template","Viewer",NULL,
|
||||||
// Header
|
chTmpView, sizeof(chTmpView), myFile+".tpl");
|
||||||
pInfo->m_rectDraw.top = 0;
|
if (tFile.GetStatus(chTmpOut, fsTest)) {
|
||||||
pInfo->m_rectDraw.left = 0;
|
if (chTmpView[0] == NULL)
|
||||||
pInfo->m_rectDraw.right = rcPage.right - (LEFT_MARGIN+RIGHT_MARGIN)*m_nCharWidth;
|
ShellExecute(NULL,_T("open"),chTmpOut,NULL,NULL,SW_SHOW);
|
||||||
pInfo->m_rectDraw.bottom = HEADER_HEIGHT*m_nRowHeight;
|
else
|
||||||
PrintHeader(pDC, pInfo);
|
ShellExecute(NULL,_T("open"),chTmpView,chTmpOut,NULL,SW_SHOW);
|
||||||
pDC->OffsetWindowOrg(0, -HEADER_HEIGHT*m_nRowHeight);
|
}
|
||||||
|
}
|
||||||
// Gap between header and List control heading
|
} else {
|
||||||
pDC->OffsetWindowOrg(0, -GAP*m_nRowHeight);
|
AfxMessageBox(IDS_MISSTMPL, MB_OK | MB_ICONSTOP);
|
||||||
|
}
|
||||||
// Print the header control.
|
|
||||||
CRect HeaderCtrlrc;
|
|
||||||
m_headerctrl.GetClientRect(&HeaderCtrlrc);
|
|
||||||
pInfo->m_rectDraw.bottom = HeaderCtrlrc.Height();
|
|
||||||
PrintColumnHeadings(pDC, pInfo);
|
|
||||||
//pDC->OffsetWindowOrg(0, -HeaderCtrlrc.Height());
|
|
||||||
|
|
||||||
// Print the list control
|
|
||||||
DRAWITEMSTRUCT DrawItemStruct;
|
|
||||||
DrawItemStruct.hDC = pDC->m_hDC;
|
|
||||||
for(int i = nStartRow; i < nEndRow; i++) {
|
|
||||||
DrawItemStruct.itemID = i;
|
|
||||||
DrawItem(&DrawItemStruct);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Footer
|
|
||||||
pInfo->m_rectDraw.bottom = FOOTER_HEIGHT*m_nRowHeight;
|
|
||||||
pDC->SetWindowOrg(-LEFT_MARGIN*m_nCharWidth,
|
|
||||||
-rcPage.bottom + pInfo->m_rectDraw.bottom);
|
|
||||||
PrintFooter(pDC, pInfo);
|
|
||||||
|
|
||||||
// SetWindowOrg back for next page
|
|
||||||
pDC->SetWindowOrg(0,0);
|
|
||||||
pDC->SelectObject(pOldFont);
|
|
||||||
|
|
||||||
/* old code
|
|
||||||
|
|
||||||
if(NULL == pDC || NULL == pInfo)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Draw as many rows as will fit on the printed page.
|
|
||||||
// Clip the printed page so that there is no partially shown
|
|
||||||
// row at the bottom of the page (the same row which will be fully
|
|
||||||
// shown at the top of the next page).
|
|
||||||
int nStartRow = 0;
|
|
||||||
int nEndRow = 0;
|
|
||||||
int nMaxRowCount = ctlList.GetItemCount();
|
|
||||||
nStartRow = (pInfo->m_nCurPage - 1)*m_nRowsPerPage;
|
|
||||||
nEndRow = nStartRow+m_nRowsPerPage;
|
|
||||||
if(nEndRow > nMaxRowCount)
|
|
||||||
nEndRow = nMaxRowCount;
|
|
||||||
|
|
||||||
//create bold font for header and footer
|
|
||||||
CFont *pOldFont = NULL;
|
|
||||||
CFont BoldFont;
|
|
||||||
LOGFONT lf;
|
|
||||||
pOldFont = GetFont();
|
|
||||||
pOldFont->GetLogFont(&lf);
|
|
||||||
lf.lfWeight = FW_BOLD;
|
|
||||||
BoldFont.CreateFontIndirect(&lf);
|
|
||||||
pOldFont = pDC->SelectObject(&BoldFont);
|
|
||||||
int nPrevBkMode = pDC->SetBkMode(TRANSPARENT);
|
|
||||||
|
|
||||||
//print the header
|
|
||||||
PrintHeader(pDC, pInfo);
|
|
||||||
|
|
||||||
//Print the footer
|
|
||||||
PrintFooter(pDC, pInfo);
|
|
||||||
pDC->SetBkMode(nPrevBkMode);
|
|
||||||
pDC->SelectObject(pOldFont);
|
|
||||||
BoldFont.DeleteObject();
|
|
||||||
|
|
||||||
//Set origin to print header and Header control. Keep Y position at 0 to
|
|
||||||
//print header information
|
|
||||||
//Change Y position of origin to print List control header
|
|
||||||
//Adjust the List control origin to start printing after page margins
|
|
||||||
pDC->SetWindowOrg(-1*(LEFT_MARGIN*m_nCharWidth), -1*HEADER_HEIGHT*m_nRowHeight);
|
|
||||||
|
|
||||||
//send a message to Header control to print itsef. There is little scope to improve printing header.
|
|
||||||
//I have m_HeaderCtrl in my class. If not take by HeaderCtrl = GetDlgItem(0);
|
|
||||||
m_headerctrl.SendMessage(WM_PAINT, (WPARAM)pDC->m_hDC);
|
|
||||||
|
|
||||||
//Chage window position to take care of ListControl Horizontal scrolling.
|
|
||||||
//if List control is scrolled to left horizontally the above window origin
|
|
||||||
//will not start painting from first column, instead it starts painting from
|
|
||||||
//first visible column, because rcBounds etc are will have -ve left value
|
|
||||||
//Same thing with vertical scrolling also
|
|
||||||
CRect rcBounds;
|
|
||||||
ctlList.GetItemRect(nStartRow, &rcBounds, LVIR_BOUNDS);
|
|
||||||
|
|
||||||
//offset top margin of rcBounds by ListControl header
|
|
||||||
CRect rc;
|
|
||||||
m_headerctrl.GetClientRect(&rc);
|
|
||||||
rcBounds.OffsetRect(0, -rc.Height());
|
|
||||||
pDC->OffsetWindowOrg(rcBounds.left, rcBounds.top);
|
|
||||||
|
|
||||||
//start printing rows
|
|
||||||
for(int i = nStartRow; i < nEndRow; i++)
|
|
||||||
DrawRow(pDC, i);
|
|
||||||
|
|
||||||
//SetWindowOrg back for next page
|
|
||||||
pDC->SetWindowOrg(0,0);
|
|
||||||
return;
|
|
||||||
|
|
||||||
*/ // old code
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCB32View::PrintColumnHeadings(CDC *pDC, CPrintInfo *pInfo)
|
|
||||||
{
|
|
||||||
CListCtrl& ctlList = (CListCtrl&) GetListCtrl();
|
|
||||||
|
|
||||||
int nColumns = m_headerctrl.GetItemCount();
|
|
||||||
//int nColumns = GetNumColumns();
|
|
||||||
//CHeaderCtrl *pHeader = GetHeaderCtrl();
|
|
||||||
int offset = pDC->GetTextExtent(_T(" "), 1 ).cx;
|
|
||||||
|
|
||||||
CFont *pOldFont = pDC->SelectObject(&m_PrinterFont);
|
|
||||||
|
|
||||||
// Get the bounds of the header control
|
|
||||||
CRect rc;
|
|
||||||
m_headerctrl.GetClientRect(rc);
|
|
||||||
rc.bottom = m_nRowHeight;
|
|
||||||
|
|
||||||
// Setup our HD_ITEM to get text, width and format
|
|
||||||
TCHAR buf[256];
|
|
||||||
HD_ITEM hditem;
|
|
||||||
hditem.mask = HDI_TEXT | HDI_FORMAT | HDI_WIDTH;
|
|
||||||
hditem.pszText = buf;
|
|
||||||
hditem.cchTextMax = 255;
|
|
||||||
|
|
||||||
rc.right = 0;
|
|
||||||
for (int i = 0; i < nColumns; i++)
|
|
||||||
{
|
|
||||||
// Get the column text and format and width
|
|
||||||
m_headerctrl.GetItem(i, &hditem);
|
|
||||||
//pHeader->GetItem(i, &hditem);
|
|
||||||
rc.left = rc.right;
|
|
||||||
rc.right += hditem.cxy;
|
|
||||||
|
|
||||||
// Workout the justification for the column heading
|
|
||||||
UINT uFormat = DT_SINGLELINE | DT_NOPREFIX | DT_VCENTER;
|
|
||||||
if (hditem.fmt & HDF_CENTER) uFormat |= DT_CENTER;
|
|
||||||
else if( hditem.fmt & HDF_RIGHT) uFormat |= DT_RIGHT;
|
|
||||||
else uFormat |= DT_LEFT;
|
|
||||||
|
|
||||||
// Draw the column heading
|
|
||||||
CRect rcLabel(rc);
|
|
||||||
rcLabel.DeflateRect(offset, 0);
|
|
||||||
pDC->DrawText(buf,-1, rcLabel, uFormat);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Draw a border around the header control
|
|
||||||
// NOTE: CDC::Rectangle doesn't draw to the edges of the bounding rectangle
|
|
||||||
CBrush* pOldBrush = (CBrush*) pDC->SelectStockObject(NULL_BRUSH);
|
|
||||||
CPen* pOldPen = (CPen*) pDC->SelectStockObject(BLACK_PEN);
|
|
||||||
|
|
||||||
rc.left = 0; rc.right++; rc.bottom++;
|
|
||||||
pDC->Rectangle(rc);
|
|
||||||
|
|
||||||
pDC->SelectObject(pOldBrush);
|
|
||||||
pDC->SelectObject(pOldPen);
|
|
||||||
pDC->SelectObject(pOldFont);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCB32View::PrintHeader(CDC *pDC, CPrintInfo *pInfo)
|
|
||||||
{
|
|
||||||
CRect rc(pInfo->m_rectDraw);
|
|
||||||
CString sTemp;
|
|
||||||
CFont BoldFont;
|
|
||||||
LOGFONT lf;
|
|
||||||
|
|
||||||
//create bold font for header and footer
|
|
||||||
m_PrinterFont.GetLogFont(&lf);
|
|
||||||
lf.lfWeight = FW_BOLD;
|
|
||||||
BoldFont.CreateFontIndirect(&lf);
|
|
||||||
|
|
||||||
CFont *pNormalFont = pDC->SelectObject(&BoldFont);
|
|
||||||
int nPrevBkMode = pDC->SetBkMode(TRANSPARENT);
|
|
||||||
|
|
||||||
//print App title on top right margin
|
|
||||||
sTemp.LoadString(AFX_IDS_APP_TITLE);
|
|
||||||
pDC->DrawText(sTemp, &rc,
|
|
||||||
DT_RIGHT | DT_SINGLELINE | DT_NOPREFIX | DT_VCENTER);
|
|
||||||
|
|
||||||
pDC->SetBkMode(nPrevBkMode);
|
|
||||||
pDC->SelectObject(pNormalFont);
|
|
||||||
BoldFont.DeleteObject();
|
|
||||||
|
|
||||||
pDC->MoveTo(rc.left, rc.bottom);
|
|
||||||
pDC->LineTo(rc.right, rc.bottom);
|
|
||||||
|
|
||||||
/* old code
|
|
||||||
CRect rc(pInfo->m_rectDraw);
|
|
||||||
CString sTemp;
|
|
||||||
|
|
||||||
//Print App title
|
|
||||||
rc.left += LEFT_MARGIN*m_nCharWidth;
|
|
||||||
rc.right -= RIGHT_MARGIN*m_nCharWidth;
|
|
||||||
rc.bottom = rc.top+m_nRowHeight;
|
|
||||||
|
|
||||||
//print App title on top right margin
|
|
||||||
sTemp.LoadString(AFX_IDS_APP_TITLE);
|
|
||||||
pDC->DrawText(sTemp, &rc, DT_RIGHT | DT_SINGLELINE | DT_NOPREFIX | DT_VCENTER);
|
|
||||||
|
|
||||||
//print Header. One row for each string
|
|
||||||
for (int pos = 0; pos<arLabel.GetSize(); pos++)
|
|
||||||
{
|
|
||||||
sTemp = arLabel[pos];
|
|
||||||
pDC->DrawText(sTemp, &rc, DT_LEFT | DT_SINGLELINE | DT_NOPREFIX | DT_VCENTER);
|
|
||||||
rc.OffsetRect(0, m_nRowHeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
*/ // old code
|
|
||||||
}
|
|
||||||
|
|
||||||
//print footer with a line and date, and page number
|
|
||||||
void CCB32View::PrintFooter(CDC *pDC, CPrintInfo *pInfo)
|
|
||||||
{
|
|
||||||
CRect rc(pInfo->m_rectDraw);
|
|
||||||
CFont BoldFont;
|
|
||||||
LOGFONT lf;
|
|
||||||
|
|
||||||
//draw line
|
|
||||||
pDC->MoveTo(rc.left, rc.top);
|
|
||||||
pDC->LineTo(rc.right, rc.top);
|
|
||||||
|
|
||||||
//create bold font for header and footer
|
|
||||||
m_PrinterFont.GetLogFont(&lf);
|
|
||||||
lf.lfWeight = FW_BOLD;
|
|
||||||
BoldFont.CreateFontIndirect(&lf);
|
|
||||||
|
|
||||||
CFont *pNormalFont = pDC->SelectObject(&BoldFont);
|
|
||||||
int nPrevBkMode = pDC->SetBkMode(TRANSPARENT);
|
|
||||||
|
|
||||||
//draw page number
|
|
||||||
CString sTemp ;
|
|
||||||
rc.OffsetRect(0, m_nRowHeight/2);
|
|
||||||
sTemp.Format(IDS_PRINT_PAGE_TITLE, pInfo->m_nCurPage, pInfo->GetMaxPage());
|
|
||||||
pDC->DrawText(sTemp,-1,rc,
|
|
||||||
DT_LEFT | DT_SINGLELINE | DT_NOPREFIX | DT_NOCLIP | DT_VCENTER);
|
|
||||||
|
|
||||||
CTime t = CTime::GetCurrentTime();
|
|
||||||
sTemp = t.Format("%c");
|
|
||||||
pDC->DrawText(sTemp,-1,rc,
|
|
||||||
DT_RIGHT | DT_SINGLELINE | DT_NOPREFIX | DT_NOCLIP | DT_VCENTER);
|
|
||||||
|
|
||||||
pDC->SetBkMode(nPrevBkMode);
|
|
||||||
pDC->SelectObject(pNormalFont);
|
|
||||||
BoldFont.DeleteObject();
|
|
||||||
|
|
||||||
/* old code
|
|
||||||
CRect rc(pInfo->m_rectDraw);
|
|
||||||
|
|
||||||
//draw line
|
|
||||||
rc.left += LEFT_MARGIN*m_nCharWidth;
|
|
||||||
rc.right -= RIGHT_MARGIN*m_nCharWidth;
|
|
||||||
rc.top = rc.bottom - FOOTER_HEIGHT*m_nRowHeight;
|
|
||||||
rc.bottom = rc.top + m_nRowHeight;
|
|
||||||
pDC->MoveTo(rc.left, rc.top);
|
|
||||||
pDC->LineTo(rc.right, rc.top);
|
|
||||||
|
|
||||||
//draw page number
|
|
||||||
CString sTemp ;
|
|
||||||
rc.OffsetRect(0, m_nRowHeight/2);
|
|
||||||
sTemp.Format(IDS_PRINT_PAGE_TITLE, pInfo->m_nCurPage);
|
|
||||||
pDC->DrawText(sTemp,-1,rc, DT_LEFT | DT_SINGLELINE | DT_NOPREFIX | DT_NOCLIP | DT_VCENTER);
|
|
||||||
CTime t = CTime::GetCurrentTime();
|
|
||||||
sTemp = t.Format("%c");
|
|
||||||
pDC->DrawText(sTemp,-1,rc, DT_RIGHT | DT_SINGLELINE | DT_NOPREFIX | DT_NOCLIP | DT_VCENTER);
|
|
||||||
|
|
||||||
*/ // old code
|
|
||||||
}
|
|
||||||
|
|
||||||
//this is drawing code copied RowList sample and from www.codeguru.com site
|
|
||||||
int CCB32View::DrawRow(CDC *pDC, int nItem)
|
|
||||||
{
|
|
||||||
CListCtrl& ctlList = (CListCtrl&) GetListCtrl();
|
|
||||||
|
|
||||||
CImageList *pImageList = NULL;
|
|
||||||
CFont *pOldFont = NULL;
|
|
||||||
CFont BoldFont;
|
|
||||||
CString sLabel;
|
|
||||||
UINT dtFlags = DT_SINGLELINE|DT_NOPREFIX|DT_VCENTER;
|
|
||||||
int nSaveDC = pDC->SaveDC();
|
|
||||||
if(!pDC->IsPrinting())
|
|
||||||
dtFlags |= (DT_NOCLIP | DT_END_ELLIPSIS); //no clip because we add ellipsis at the end
|
|
||||||
|
|
||||||
// get item data
|
|
||||||
LV_ITEM lvi;
|
|
||||||
lvi.mask = LVIF_IMAGE | LVIF_STATE | LVIF_INDENT;
|
|
||||||
lvi.iItem=nItem;
|
|
||||||
lvi.iSubItem=0;
|
|
||||||
lvi.stateMask=0xFFFF; // get all state flags
|
|
||||||
ctlList.GetItem(&lvi);
|
|
||||||
BOOL bHighlight = ((lvi.state & LVIS_DROPHILITED) || ((lvi.state & LVIS_SELECTED)
|
|
||||||
&& ((GetFocus() == this) || (GetStyle() & LVS_SHOWSELALWAYS))));
|
|
||||||
|
|
||||||
//Get rectangles for painting
|
|
||||||
CRect rcBounds, rcLabel, rcIcon;
|
|
||||||
ctlList.GetItemRect(nItem, rcBounds, LVIR_BOUNDS);
|
|
||||||
ctlList.GetItemRect(nItem, rcLabel, LVIR_LABEL);
|
|
||||||
ctlList.GetItemRect(nItem, rcIcon, LVIR_ICON);
|
|
||||||
CRect rcCol(rcBounds);
|
|
||||||
CRect rcWnd;
|
|
||||||
sLabel = ctlList.GetItemText(nItem, 0);
|
|
||||||
|
|
||||||
//Label offset
|
|
||||||
int offset = pDC->GetTextExtent(_T(" "), 1).cx;
|
|
||||||
CRect rcHighlight;
|
|
||||||
int nExt = 0;
|
|
||||||
switch(m_nHighlight)
|
|
||||||
{
|
|
||||||
case HIGHLIGHT_NORMAL:
|
|
||||||
nExt = pDC->GetOutputTextExtent(sLabel).cx + offset;
|
|
||||||
rcHighlight = rcLabel;
|
|
||||||
if(rcLabel.left + nExt < rcLabel.right)
|
|
||||||
rcHighlight.right = rcLabel.left + nExt;
|
|
||||||
break;
|
|
||||||
case HIGHLIGHT_ALLCOLUMNS:
|
|
||||||
rcHighlight = rcBounds;
|
|
||||||
rcHighlight.left = rcLabel.left;
|
|
||||||
break;
|
|
||||||
case HIGHLIGHT_ROW:
|
|
||||||
GetClientRect(&rcWnd);
|
|
||||||
rcHighlight = rcBounds;
|
|
||||||
rcHighlight.left = rcLabel.left;
|
|
||||||
rcHighlight.right = rcWnd.right;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
rcHighlight.left = rcLabel.left;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
//draw highlight. printing may not be required
|
|
||||||
if(bHighlight)
|
|
||||||
{
|
|
||||||
pDC->SetTextColor(::GetSysColor(COLOR_HIGHLIGHTTEXT));
|
|
||||||
pDC->SetBkColor(::GetSysColor(COLOR_HIGHLIGHT));
|
|
||||||
pDC->FillRect(rcHighlight, &CBrush(::GetSysColor(COLOR_HIGHLIGHT)));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
pDC->SetBkColor(::GetSysColor(COLOR_WINDOW));
|
|
||||||
pDC->FillRect(rcHighlight, &CBrush(::GetSysColor(COLOR_WINDOW)));
|
|
||||||
}
|
|
||||||
|
|
||||||
//set clip region
|
|
||||||
rcCol.right = rcCol.left + ctlList.GetColumnWidth(0);
|
|
||||||
|
|
||||||
//Nice to have regions but they are not working on printer DC we may need
|
|
||||||
//to take get device caps to support regions. Does not seems to help much now
|
|
||||||
//CRgn rgn;
|
|
||||||
//rgn.CreateRectRgnIndirect(&rcCol);
|
|
||||||
//pDC->SelectClipRgn(&rgn);
|
|
||||||
//rgn.DeleteObject();
|
|
||||||
|
|
||||||
//Draw state icon
|
|
||||||
if(lvi.state & LVIS_STATEIMAGEMASK)
|
|
||||||
{
|
|
||||||
int nImage = ((lvi.state & LVIS_STATEIMAGEMASK) >> 12) - 1;
|
|
||||||
pImageList = ctlList.GetImageList(LVSIL_STATE);
|
|
||||||
//offset the state image icon indent levels.
|
|
||||||
nExt = rcCol.left + lvi.iIndent*rcIcon.Width(); //nExt reused
|
|
||||||
if(pImageList)
|
|
||||||
pImageList->Draw(pDC, nImage, CPoint(nExt, rcCol.top), ILD_TRANSPARENT);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Draw Normal and overlay icon
|
|
||||||
pImageList = ctlList.GetImageList(LVSIL_SMALL); //assuming printing in report mode only
|
|
||||||
if(pImageList)
|
|
||||||
{
|
|
||||||
UINT nOvlImageMask = lvi.state & LVIS_OVERLAYMASK;
|
|
||||||
pImageList->Draw(pDC, lvi.iImage, CPoint(rcIcon.left, rcIcon.top),
|
|
||||||
(bHighlight?ILD_BLEND50:0)|ILD_TRANSPARENT|nOvlImageMask);
|
|
||||||
}
|
|
||||||
|
|
||||||
//if state image mask is on and indent is 0 then consider it as Server row
|
|
||||||
if((lvi.state & LVIS_STATEIMAGEMASK) && !lvi.iIndent)
|
|
||||||
{
|
|
||||||
//create bold font
|
|
||||||
LOGFONT lf;
|
|
||||||
pOldFont = GetFont();;
|
|
||||||
pOldFont->GetLogFont(&lf);
|
|
||||||
lf.lfWeight = FW_BOLD;
|
|
||||||
BoldFont.CreateFontIndirect(&lf);
|
|
||||||
pOldFont = pDC->SelectObject(&BoldFont);
|
|
||||||
rcLabel.right = rcBounds.right; //draw server name to full row width
|
|
||||||
}
|
|
||||||
|
|
||||||
//Draw item label
|
|
||||||
rcLabel.left += offset/2;
|
|
||||||
rcLabel.right -= offset;
|
|
||||||
dtFlags |= DT_LEFT;
|
|
||||||
pDC->DrawText(sLabel, rcLabel, dtFlags);
|
|
||||||
if((lvi.state & LVIS_STATEIMAGEMASK) && !lvi.iIndent)
|
|
||||||
{
|
|
||||||
pOldFont = pDC->SelectObject(pOldFont);
|
|
||||||
BoldFont.DeleteObject();
|
|
||||||
|
|
||||||
//focus rect if required
|
|
||||||
if(lvi.state & LVIS_FOCUSED && (GetFocus() == this))
|
|
||||||
pDC->DrawFocusRect(rcHighlight);
|
|
||||||
pDC->RestoreDC(nSaveDC);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Draw labels for remaining columns
|
|
||||||
LV_COLUMN lvc;
|
|
||||||
lvc.mask = LVCF_FMT|LVCF_WIDTH;
|
|
||||||
if(m_nHighlight == HIGHLIGHT_NORMAL)
|
|
||||||
{
|
|
||||||
pDC->SetTextColor(::GetSysColor(COLOR_WINDOWTEXT));
|
|
||||||
pDC->SetBkColor(::GetSysColor(COLOR_WINDOW));
|
|
||||||
}
|
|
||||||
rcBounds.right = rcHighlight.right > rcBounds.right ? rcHighlight.right:rcBounds.right;
|
|
||||||
|
|
||||||
//Nice to have regions but they are not working on printer DC we may need
|
|
||||||
//to take get device caps to support regions. Does not seems to help much now
|
|
||||||
//rgn.CreateRectRgnIndirect(&rcBounds);
|
|
||||||
//pDC->SelectClipRgn(&rgn);
|
|
||||||
//rgn.DeleteObject();
|
|
||||||
|
|
||||||
for(int nColumn = 1; ctlList.GetColumn(nColumn, &lvc); nColumn++)
|
|
||||||
{
|
|
||||||
rcCol.left = rcCol.right;
|
|
||||||
rcCol.right += lvc.cx;
|
|
||||||
|
|
||||||
//draw background if needed
|
|
||||||
if(m_nHighlight == HIGHLIGHT_NORMAL)
|
|
||||||
pDC->FillRect(rcCol, &CBrush(::GetSysColor(COLOR_WINDOW)));
|
|
||||||
sLabel = ctlList.GetItemText(nItem, nColumn);
|
|
||||||
if(sLabel.IsEmpty())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
//Get the text justification
|
|
||||||
UINT nJustify = DT_LEFT;
|
|
||||||
switch(lvc.fmt & LVCFMT_JUSTIFYMASK)
|
|
||||||
{
|
|
||||||
case LVCFMT_RIGHT:
|
|
||||||
nJustify = DT_RIGHT;
|
|
||||||
break;
|
|
||||||
case LVCFMT_CENTER:
|
|
||||||
nJustify = DT_CENTER;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
rcLabel = rcCol;
|
}
|
||||||
rcLabel.left += offset;
|
}
|
||||||
rcLabel.right -= offset;
|
|
||||||
dtFlags &= ~DT_RIGHT;
|
BOOL CCB32View::PrintMerge(CString strTemplate)
|
||||||
dtFlags &= ~DT_CENTER;
|
{
|
||||||
dtFlags |= nJustify;
|
CListCtrl& ctlList = (CListCtrl&) GetListCtrl();
|
||||||
pDC->DrawText(sLabel, -1, rcLabel, dtFlags);
|
CWaitCursor wait;
|
||||||
|
|
||||||
|
CFile iFile;
|
||||||
|
CFileException e;
|
||||||
|
CString fileName;
|
||||||
|
char cBuffer[4096];
|
||||||
|
|
||||||
|
// open input body and read contents
|
||||||
|
fileName.Format("%s", strTemplate + ".bod");
|
||||||
|
if (!iFile.Open(fileName, CFile::modeRead |
|
||||||
|
CFile::shareDenyWrite, &e)) {
|
||||||
|
AfxThrowFileException(e.m_cause, e.m_lOsError, fileName);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
UINT uLen = iFile.Read(cBuffer, sizeof(cBuffer));
|
||||||
|
if (!uLen) {
|
||||||
|
AfxThrowFileException(e.m_cause, e.m_lOsError, fileName);
|
||||||
|
iFile.Close();
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
cBuffer[uLen] = '\0';
|
||||||
|
iFile.Close();
|
||||||
|
|
||||||
|
// open body output for writing
|
||||||
|
fileName.Empty();
|
||||||
|
fileName.Format("%s", strTemplate + ".out");
|
||||||
|
if (!iFile.Open(fileName, CFile::modeCreate | CFile::modeWrite |
|
||||||
|
CFile::shareDenyWrite, &e)) {
|
||||||
|
AfxThrowFileException(e.m_cause, e.m_lOsError, fileName);
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//focus rect if required
|
// parse and write body
|
||||||
if(lvi.state & LVIS_FOCUSED && (GetFocus() == this))
|
CString strBuffer;
|
||||||
pDC->DrawFocusRect(rcHighlight);
|
CStringArray *pItem;
|
||||||
pDC->RestoreDC(nSaveDC);
|
int iCount = ctlList.GetItemCount();
|
||||||
return 0;
|
for(int i=0; i<iCount; i++) {
|
||||||
|
strBuffer.Format("%s", cBuffer);
|
||||||
|
pItem = (CStringArray*) ctlList.GetItemData(i);
|
||||||
|
strBuffer = Sub("@LASTNAME@", pItem->GetAt(0), strBuffer);
|
||||||
|
strBuffer = Sub("@FIRSTNAME@", pItem->GetAt(1), strBuffer);
|
||||||
|
strBuffer = Sub("@MIDINIT@", pItem->GetAt(2), strBuffer);
|
||||||
|
strBuffer = Sub("@TITLE@", pItem->GetAt(3), strBuffer);
|
||||||
|
strBuffer = Sub("@ADDRESS1@", pItem->GetAt(4), strBuffer);
|
||||||
|
strBuffer = Sub("@ADDRESS2@", pItem->GetAt(5), strBuffer);
|
||||||
|
strBuffer = Sub("@CITY@", pItem->GetAt(6), strBuffer);
|
||||||
|
strBuffer = Sub("@COUNTRY@", pItem->GetAt(7), strBuffer);
|
||||||
|
strBuffer = Sub("@STATE@", pItem->GetAt(8), strBuffer);
|
||||||
|
strBuffer = Sub("@ZIPCODE@", pItem->GetAt(9), strBuffer);
|
||||||
|
strBuffer = Sub("@COMPANY@", pItem->GetAt(10), strBuffer);
|
||||||
|
strBuffer = Sub("@DEPARTMENT@", pItem->GetAt(11), strBuffer);
|
||||||
|
strBuffer = Sub("@POSITION@", pItem->GetAt(12), strBuffer);
|
||||||
|
strBuffer = Sub("@MANAGER@", pItem->GetAt(13), strBuffer);
|
||||||
|
strBuffer = Sub("@ADDITIONAL1@", pItem->GetAt(14), strBuffer);
|
||||||
|
strBuffer = Sub("@ADDITIONAL2@", pItem->GetAt(15), strBuffer);
|
||||||
|
strBuffer = Sub("@HOMEPHONE@", pItem->GetAt(16), strBuffer);
|
||||||
|
strBuffer = Sub("@HOMEEXT@", pItem->GetAt(17), strBuffer);
|
||||||
|
strBuffer = Sub("@WORKPHONE@", pItem->GetAt(18), strBuffer);
|
||||||
|
strBuffer = Sub("@WORKEXT", pItem->GetAt(19), strBuffer);
|
||||||
|
strBuffer = Sub("@CELLPHONE@", pItem->GetAt(20), strBuffer);
|
||||||
|
strBuffer = Sub("@CELLEXT@", pItem->GetAt(21), strBuffer);
|
||||||
|
strBuffer = Sub("@PAGER@", pItem->GetAt(22), strBuffer);
|
||||||
|
strBuffer = Sub("@PAGERCARD@", pItem->GetAt(23), strBuffer);
|
||||||
|
strBuffer = Sub("@PAGEREXT@", pItem->GetAt(24), strBuffer);
|
||||||
|
strBuffer = Sub("@FAXPHONE@", pItem->GetAt(25), strBuffer);
|
||||||
|
strBuffer = Sub("@FAXEXT@", pItem->GetAt(26), strBuffer);
|
||||||
|
strBuffer = Sub("@EMAIL1@", pItem->GetAt(27), strBuffer);
|
||||||
|
strBuffer = Sub("@EMAIL2@", pItem->GetAt(28), strBuffer);
|
||||||
|
strBuffer = Sub("@WEB1@", pItem->GetAt(29), strBuffer);
|
||||||
|
strBuffer = Sub("@WEB2@", pItem->GetAt(30), strBuffer);
|
||||||
|
strBuffer = Sub("@NOTES@", Sub("<p>","\x0d\x0a",
|
||||||
|
pItem->GetAt(31)), strBuffer);
|
||||||
|
iFile.Write(strBuffer, strBuffer.GetLength());
|
||||||
|
}
|
||||||
|
iFile.Close();
|
||||||
|
|
||||||
|
// open output file
|
||||||
|
char chTmp[_MAX_PATH];
|
||||||
|
GetPrivateProfileString("Template","Output",strTemplate+".tmp",
|
||||||
|
chTmp, sizeof(chTmp), strTemplate+".tpl");
|
||||||
|
fileName.Empty();
|
||||||
|
fileName.Format("%s", chTmp);
|
||||||
|
if (!iFile.Open(fileName, CFile::modeCreate | CFile::modeWrite |
|
||||||
|
CFile::shareDenyWrite, &e)) {
|
||||||
|
AfxThrowFileException(e.m_cause, e.m_lOsError, fileName);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// read in .hed, .out, .fot and write to .rtf
|
||||||
|
char *files[3] = {".hed",".out",".fot"};
|
||||||
|
CFile tFile;
|
||||||
|
CString tName;
|
||||||
|
for (int z=0; z<3; z++) {
|
||||||
|
cBuffer[0] = '\0';
|
||||||
|
tName.Format("%s", strTemplate + files[z]);
|
||||||
|
if (!tFile.Open(tName, CFile::modeRead |
|
||||||
|
CFile::shareDenyWrite, &e)) {
|
||||||
|
AfxThrowFileException(e.m_cause, e.m_lOsError, fileName);
|
||||||
|
iFile.Close();
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
uLen = tFile.Read(cBuffer, sizeof(cBuffer));
|
||||||
|
while (uLen) {
|
||||||
|
cBuffer[uLen+1] = '\0';
|
||||||
|
iFile.Write(cBuffer, uLen);
|
||||||
|
uLen = tFile.Read(cBuffer, sizeof(cBuffer));
|
||||||
|
}
|
||||||
|
tFile.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
iFile.Close();
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
@ -1409,7 +926,7 @@ BOOL CCB32View::AddDocItemToListView(CExpr* expr)
|
||||||
|
|
||||||
// Initialize the CStringArray structure's fields.
|
// Initialize the CStringArray structure's fields.
|
||||||
CString sText;
|
CString sText;
|
||||||
if(expr->GetAttributeValue("LastName", sText))
|
if(expr->GetAttributeValue(_T("LastName"), sText))
|
||||||
pItem->SetAt(0, sText);
|
pItem->SetAt(0, sText);
|
||||||
if(expr->GetAttributeValue("FirstName", sText))
|
if(expr->GetAttributeValue("FirstName", sText))
|
||||||
pItem->SetAt(1, sText);
|
pItem->SetAt(1, sText);
|
||||||
|
|
@ -1660,7 +1177,7 @@ int CALLBACK CCB32View::CompareFuncDec (LPARAM lParam1, LPARAM lParam2,
|
||||||
|
|
||||||
BOOL CCB32View::MakeExpr(CExpr* expr, CStringArray* pItem)
|
BOOL CCB32View::MakeExpr(CExpr* expr, CStringArray* pItem)
|
||||||
{
|
{
|
||||||
expr->AddAttributeValueString("LastName", pItem->GetAt(0));
|
expr->AddAttributeValueString(_T("LastName"), pItem->GetAt(0));
|
||||||
expr->AddAttributeValueString("FirstName", pItem->GetAt(1));
|
expr->AddAttributeValueString("FirstName", pItem->GetAt(1));
|
||||||
expr->AddAttributeValueString("MiddleInitial", pItem->GetAt(2));
|
expr->AddAttributeValueString("MiddleInitial", pItem->GetAt(2));
|
||||||
expr->AddAttributeValueString("Title", pItem->GetAt(3));
|
expr->AddAttributeValueString("Title", pItem->GetAt(3));
|
||||||
|
|
@ -1711,7 +1228,7 @@ void CCB32View::MakeDatabase()
|
||||||
// db.ClearDatabase();
|
// db.ClearDatabase();
|
||||||
for (int i=0; i<iNumItems; i++)
|
for (int i=0; i<iNumItems; i++)
|
||||||
{
|
{
|
||||||
CExpr *expr = new CExpr("contact");
|
CExpr *expr = new CExpr(_T("contact"));
|
||||||
pItem = (CStringArray*) ctlList.GetItemData(i);
|
pItem = (CStringArray*) ctlList.GetItemData(i);
|
||||||
MakeExpr(expr, pItem);
|
MakeExpr(expr, pItem);
|
||||||
db.Append(expr);
|
db.Append(expr);
|
||||||
|
|
@ -1734,7 +1251,7 @@ void CCB32View::AddDatabase()
|
||||||
{
|
{
|
||||||
CExpr *expr = (CExpr *)node->Data();
|
CExpr *expr = (CExpr *)node->Data();
|
||||||
CString strType = expr->Functor();
|
CString strType = expr->Functor();
|
||||||
if (strType == "contact")
|
if (strType == _T("contact"))
|
||||||
{
|
{
|
||||||
if (!AddDocItemToListView (expr))
|
if (!AddDocItemToListView (expr))
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
13
CB32View.h
13
CB32View.h
|
|
@ -35,12 +35,6 @@ protected:
|
||||||
int nSortedCol;
|
int nSortedCol;
|
||||||
BOOL bSortAscending;
|
BOOL bSortAscending;
|
||||||
|
|
||||||
int m_nCharWidth;
|
|
||||||
int m_nRowHeight;
|
|
||||||
int m_nRowsPerPage;
|
|
||||||
int m_nHighlight;
|
|
||||||
CFont m_PrinterFont;
|
|
||||||
|
|
||||||
// Operations
|
// Operations
|
||||||
public:
|
public:
|
||||||
void MakeDatabase();
|
void MakeDatabase();
|
||||||
|
|
@ -61,7 +55,6 @@ public:
|
||||||
virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
|
virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
|
||||||
virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
|
virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
|
||||||
virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
|
virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
|
||||||
virtual void OnPrint(CDC* pDC, CPrintInfo* pInfo);
|
|
||||||
//}}AFX_VIRTUAL
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
// Implementation
|
// Implementation
|
||||||
|
|
@ -95,10 +88,7 @@ protected:
|
||||||
void SaveColPos();
|
void SaveColPos();
|
||||||
void SetupColumns();
|
void SetupColumns();
|
||||||
|
|
||||||
void PrintColumnHeadings(CDC *pDC, CPrintInfo *pInfo);
|
BOOL PrintMerge(CString strTemplate);
|
||||||
void PrintHeader(CDC *pDC, CPrintInfo *pInfo);
|
|
||||||
void PrintFooter(CDC *pDC, CPrintInfo *pInfo);
|
|
||||||
int DrawRow(CDC *pDC, int nItem);
|
|
||||||
|
|
||||||
// Generated message map functions
|
// Generated message map functions
|
||||||
protected:
|
protected:
|
||||||
|
|
@ -148,6 +138,7 @@ protected:
|
||||||
afx_msg void OnViewColpos();
|
afx_msg void OnViewColpos();
|
||||||
afx_msg void OnEntryCopy();
|
afx_msg void OnEntryCopy();
|
||||||
afx_msg void OnUpdateEntryCopy(CCmdUI* pCmdUI);
|
afx_msg void OnUpdateEntryCopy(CCmdUI* pCmdUI);
|
||||||
|
afx_msg void OnFilePrintMerge();
|
||||||
//}}AFX_MSG
|
//}}AFX_MSG
|
||||||
DECLARE_MESSAGE_MAP()
|
DECLARE_MESSAGE_MAP()
|
||||||
void ChangeListCtrlStyle(long lStyle, BOOL bSetBit);
|
void ChangeListCtrlStyle(long lStyle, BOOL bSetBit);
|
||||||
|
|
|
||||||
15
Cb32.dsp
15
Cb32.dsp
|
|
@ -129,13 +129,6 @@ InputPath=.\hlp\CB32.hpj
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\CB32.rc
|
SOURCE=.\CB32.rc
|
||||||
|
|
||||||
!IF "$(CFG)" == "CB32 - Win32 Release"
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "CB32 - Win32 Debug"
|
|
||||||
|
|
||||||
!ENDIF
|
|
||||||
|
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
|
@ -191,6 +184,10 @@ SOURCE=.\Parser.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\PMerge.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\PrefPage.cpp
|
SOURCE=.\PrefPage.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
@ -296,6 +293,10 @@ SOURCE=.\Parser.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\PMerge.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\PrefPage.h
|
SOURCE=.\PrefPage.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
|
||||||
3
Cb32.dsw
3
Cb32.dsw
|
|
@ -11,6 +11,9 @@ Package=<5>
|
||||||
|
|
||||||
Package=<4>
|
Package=<4>
|
||||||
{{{
|
{{{
|
||||||
|
Begin Project Dependency
|
||||||
|
Project_Dep_Name cexpr
|
||||||
|
End Project Dependency
|
||||||
}}}
|
}}}
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
|
||||||
223
PMerge.cpp
Normal file
223
PMerge.cpp
Normal file
|
|
@ -0,0 +1,223 @@
|
||||||
|
// PMerge.cpp : implementation file
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "cb32.h"
|
||||||
|
#include "PMerge.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#undef THIS_FILE
|
||||||
|
static char THIS_FILE[] = __FILE__;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CPMerge dialog
|
||||||
|
|
||||||
|
|
||||||
|
CPMerge::CPMerge(CWnd* pParent /*=NULL*/)
|
||||||
|
: CDialog(CPMerge::IDD, pParent)
|
||||||
|
{
|
||||||
|
//{{AFX_DATA_INIT(CPMerge)
|
||||||
|
m_pmLaunch = FALSE;
|
||||||
|
//}}AFX_DATA_INIT
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CPMerge::DoDataExchange(CDataExchange* pDX)
|
||||||
|
{
|
||||||
|
CDialog::DoDataExchange(pDX);
|
||||||
|
//{{AFX_DATA_MAP(CPMerge)
|
||||||
|
DDX_Control(pDX, IDC_PMLAUNCH, m_cLaunch);
|
||||||
|
DDX_Control(pDX, IDC_PM_VIEW, m_pmcView);
|
||||||
|
DDX_Control(pDX, IDC_PM_FILE, m_pmcFile);
|
||||||
|
DDX_Control(pDX, IDC_PM_EDIT, m_pmcEdit);
|
||||||
|
DDX_Control(pDX, IDC_PMTEMPLATE, m_pmTemplate);
|
||||||
|
DDX_Check(pDX, IDC_PMLAUNCH, m_pmLaunch);
|
||||||
|
//}}AFX_DATA_MAP
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CPMerge, CDialog)
|
||||||
|
//{{AFX_MSG_MAP(CPMerge)
|
||||||
|
ON_CBN_SELCHANGE(IDC_PMTEMPLATE, OnSelchangePmtemplate)
|
||||||
|
ON_CBN_SELENDOK(IDC_PMTEMPLATE, OnSelendokPmtemplate)
|
||||||
|
ON_BN_CLICKED(IDC_PMBROW_EDIT, OnPmbrowEdit)
|
||||||
|
ON_BN_CLICKED(IDC_PMBROW_FILE, OnPmbrowFile)
|
||||||
|
ON_BN_CLICKED(IDC_PMBROW_VIEW, OnPmbrowView)
|
||||||
|
//}}AFX_MSG_MAP
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CPMerge message handlers
|
||||||
|
|
||||||
|
BOOL CPMerge::OnInitDialog()
|
||||||
|
{
|
||||||
|
CDialog::OnInitDialog();
|
||||||
|
|
||||||
|
CString strTpl = theApp.m_pszPathToExe + "TMPL\\*.TPL";
|
||||||
|
WIN32_FIND_DATA fileData;
|
||||||
|
HANDLE hFind = FindFirstFile(strTpl, &fileData);
|
||||||
|
if (hFind != INVALID_HANDLE_VALUE) {
|
||||||
|
CString szTemp = fileData.cFileName;
|
||||||
|
szTemp = szTemp.Left(szTemp.ReverseFind('.'));
|
||||||
|
CString myFile = theApp.m_pszPathToExe + "TMPL\\" + szTemp;
|
||||||
|
if (TestForTemplate(myFile))
|
||||||
|
m_pmTemplate.AddString(szTemp);
|
||||||
|
|
||||||
|
while (FindNextFile(hFind, &fileData)) {
|
||||||
|
szTemp = fileData.cFileName;
|
||||||
|
szTemp = szTemp.Left(szTemp.ReverseFind('.'));
|
||||||
|
myFile = theApp.m_pszPathToExe + "TMPL\\" + szTemp;
|
||||||
|
if (TestForTemplate(myFile))
|
||||||
|
m_pmTemplate.AddString(szTemp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FindClose(hFind);
|
||||||
|
|
||||||
|
// change to search for last template
|
||||||
|
strTpl = theApp.GetProfileString(_T("Print"),_T("Template"),NULL);
|
||||||
|
if (!strTpl.IsEmpty())
|
||||||
|
m_pmTemplate.SetCurSel(m_pmTemplate.FindString(-1, strTpl));
|
||||||
|
else
|
||||||
|
m_pmTemplate.SetCurSel(0);
|
||||||
|
|
||||||
|
LoadTemplateData();
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPMerge::OnOK()
|
||||||
|
{
|
||||||
|
if (m_pmTemplate.GetCount() > 0) {
|
||||||
|
SaveTemplateData();
|
||||||
|
CString myTmpl;
|
||||||
|
m_pmTemplate.GetLBText(m_pmTemplate.GetCurSel(),myTmpl);
|
||||||
|
theApp.WriteProfileString(_T("Print"),_T("Template"),myTmpl);
|
||||||
|
}
|
||||||
|
|
||||||
|
CDialog::OnOK();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPMerge::LoadTemplateData()
|
||||||
|
{
|
||||||
|
if (m_pmTemplate.GetCount() > 0) {
|
||||||
|
CString myTmpl;
|
||||||
|
char chTmp[_MAX_PATH];
|
||||||
|
|
||||||
|
m_pmTemplate.GetLBText(m_pmTemplate.GetCurSel(),myTmpl);
|
||||||
|
|
||||||
|
GetPrivateProfileString("Template","Editor",NULL,chTmp,sizeof(chTmp),
|
||||||
|
theApp.m_pszPathToExe+"TMPL\\"+ myTmpl+".tpl");
|
||||||
|
m_pmcEdit.SetWindowText(chTmp);
|
||||||
|
|
||||||
|
GetPrivateProfileString("Template","Output",NULL,chTmp,sizeof(chTmp),
|
||||||
|
theApp.m_pszPathToExe+"TMPL\\"+ myTmpl+".tpl");
|
||||||
|
m_pmcFile.SetWindowText(chTmp);
|
||||||
|
|
||||||
|
GetPrivateProfileString("Template","Viewer",NULL,chTmp,sizeof(chTmp),
|
||||||
|
theApp.m_pszPathToExe+"TMPL\\"+ myTmpl+".tpl");
|
||||||
|
m_pmcView.SetWindowText(chTmp);
|
||||||
|
|
||||||
|
m_pmLaunch = GetPrivateProfileInt("Template","Launch",0,
|
||||||
|
theApp.m_pszPathToExe+"TMPL\\"+ myTmpl+".tpl");
|
||||||
|
m_cLaunch.SetCheck((m_pmLaunch)?1:0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPMerge::SaveTemplateData()
|
||||||
|
{
|
||||||
|
if (m_pmTemplate.GetCount() > 0) {
|
||||||
|
CString myTmpl;
|
||||||
|
char chTmp[_MAX_PATH];
|
||||||
|
|
||||||
|
m_pmTemplate.GetLBText(m_pmTemplate.GetCurSel(),myTmpl);
|
||||||
|
UpdateData(TRUE);
|
||||||
|
|
||||||
|
m_pmcEdit.GetWindowText(chTmp, sizeof(chTmp));
|
||||||
|
WritePrivateProfileString("Template","Editor",chTmp,
|
||||||
|
theApp.m_pszPathToExe+"TMPL\\"+ myTmpl+".tpl");
|
||||||
|
|
||||||
|
m_pmcFile.GetWindowText(chTmp, sizeof(chTmp));
|
||||||
|
WritePrivateProfileString("Template","Output",chTmp,
|
||||||
|
theApp.m_pszPathToExe+"TMPL\\"+ myTmpl+".tpl");
|
||||||
|
|
||||||
|
m_pmcView.GetWindowText(chTmp, sizeof(chTmp));
|
||||||
|
WritePrivateProfileString("Template","Viewer",chTmp,
|
||||||
|
theApp.m_pszPathToExe+"TMPL\\"+ myTmpl+".tpl");
|
||||||
|
|
||||||
|
sprintf(chTmp,"%d",(m_pmLaunch)?'1':'0');
|
||||||
|
WritePrivateProfileString("Template","Launch",chTmp,
|
||||||
|
theApp.m_pszPathToExe+"TMPL\\"+ myTmpl+".tpl");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CPMerge::TestForTemplate(CString strTName)
|
||||||
|
{
|
||||||
|
CFileStatus fsTest;
|
||||||
|
CFile tFile;
|
||||||
|
if (tFile.GetStatus(strTName+".tpl", fsTest) &&
|
||||||
|
tFile.GetStatus(strTName+".hed", fsTest) &&
|
||||||
|
tFile.GetStatus(strTName+".bod", fsTest) &&
|
||||||
|
tFile.GetStatus(strTName+".fot", fsTest))
|
||||||
|
return TRUE;
|
||||||
|
else
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPMerge::OnSelchangePmtemplate()
|
||||||
|
{
|
||||||
|
SaveTemplateData();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPMerge::OnSelendokPmtemplate()
|
||||||
|
{
|
||||||
|
LoadTemplateData();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPMerge::OnPmbrowEdit()
|
||||||
|
{
|
||||||
|
CFileDialog FileDlg(TRUE, NULL, NULL,
|
||||||
|
OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST,
|
||||||
|
TEXT("All Files (*.*)|*.*||"),
|
||||||
|
AfxGetMainWnd());
|
||||||
|
|
||||||
|
CString strTemp;
|
||||||
|
strTemp.LoadString(IDS_OFN_EXE);
|
||||||
|
FileDlg.m_ofn.lpstrTitle = strTemp;
|
||||||
|
if (FileDlg.DoModal() == IDOK) {
|
||||||
|
CString fileName = FileDlg.GetPathName();
|
||||||
|
m_pmcEdit.SetWindowText(fileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPMerge::OnPmbrowFile()
|
||||||
|
{
|
||||||
|
CFileDialog FileDlg(FALSE, NULL, NULL, OFN_HIDEREADONLY |
|
||||||
|
OFN_OVERWRITEPROMPT | OFN_NOTESTFILECREATE,
|
||||||
|
TEXT("All Files (*.*)|*.*||"), AfxGetMainWnd());
|
||||||
|
|
||||||
|
CString strTemp;
|
||||||
|
strTemp.LoadString(IDS_OFN_OUT);
|
||||||
|
FileDlg.m_ofn.lpstrTitle = strTemp;
|
||||||
|
if (FileDlg.DoModal() == IDOK) {
|
||||||
|
CString fileName = FileDlg.GetPathName();
|
||||||
|
m_pmcFile.SetWindowText(fileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPMerge::OnPmbrowView()
|
||||||
|
{
|
||||||
|
CFileDialog FileDlg(TRUE, NULL, NULL,
|
||||||
|
OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST,
|
||||||
|
TEXT("All Files (*.*)|*.*||"),
|
||||||
|
AfxGetMainWnd());
|
||||||
|
|
||||||
|
CString strTemp;
|
||||||
|
strTemp.LoadString(IDS_OFN_EXE);
|
||||||
|
FileDlg.m_ofn.lpstrTitle = strTemp;
|
||||||
|
if (FileDlg.DoModal() == IDOK) {
|
||||||
|
CString fileName = FileDlg.GetPathName();
|
||||||
|
m_pmcView.SetWindowText(fileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
60
PMerge.h
Normal file
60
PMerge.h
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
#if !defined(AFX_PMERGE_H__3AC42F52_D7CA_11D1_B01A_000000000000__INCLUDED_)
|
||||||
|
#define AFX_PMERGE_H__3AC42F52_D7CA_11D1_B01A_000000000000__INCLUDED_
|
||||||
|
|
||||||
|
#if _MSC_VER >= 1000
|
||||||
|
#pragma once
|
||||||
|
#endif // _MSC_VER >= 1000
|
||||||
|
// PMerge.h : header file
|
||||||
|
//
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CPMerge dialog
|
||||||
|
|
||||||
|
class CPMerge : public CDialog
|
||||||
|
{
|
||||||
|
// Construction
|
||||||
|
public:
|
||||||
|
CPMerge(CWnd* pParent = NULL); // standard constructor
|
||||||
|
|
||||||
|
// Dialog Data
|
||||||
|
//{{AFX_DATA(CPMerge)
|
||||||
|
enum { IDD = IDD_PMERGE };
|
||||||
|
CButton m_cLaunch;
|
||||||
|
CEdit m_pmcView;
|
||||||
|
CEdit m_pmcFile;
|
||||||
|
CEdit m_pmcEdit;
|
||||||
|
CComboBox m_pmTemplate;
|
||||||
|
BOOL m_pmLaunch;
|
||||||
|
//}}AFX_DATA
|
||||||
|
|
||||||
|
|
||||||
|
// Overrides
|
||||||
|
// ClassWizard generated virtual function overrides
|
||||||
|
//{{AFX_VIRTUAL(CPMerge)
|
||||||
|
protected:
|
||||||
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||||
|
//}}AFX_VIRTUAL
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
protected:
|
||||||
|
void LoadTemplateData();
|
||||||
|
void SaveTemplateData();
|
||||||
|
BOOL TestForTemplate(CString strTName);
|
||||||
|
|
||||||
|
// Generated message map functions
|
||||||
|
//{{AFX_MSG(CPMerge)
|
||||||
|
virtual BOOL OnInitDialog();
|
||||||
|
virtual void OnOK();
|
||||||
|
afx_msg void OnSelchangePmtemplate();
|
||||||
|
afx_msg void OnSelendokPmtemplate();
|
||||||
|
afx_msg void OnPmbrowEdit();
|
||||||
|
afx_msg void OnPmbrowFile();
|
||||||
|
afx_msg void OnPmbrowView();
|
||||||
|
//}}AFX_MSG
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
#endif // !defined(AFX_PMERGE_H__3AC42F52_D7CA_11D1_B01A_000000000000__INCLUDED_)
|
||||||
25
Resource.h
25
Resource.h
|
|
@ -23,6 +23,7 @@
|
||||||
#define IDD_FIND 137
|
#define IDD_FIND 137
|
||||||
#define IDS_COUNTRY 137
|
#define IDS_COUNTRY 137
|
||||||
#define IDS_STATE 138
|
#define IDS_STATE 138
|
||||||
|
#define IDD_PMERGE 138
|
||||||
#define IDD_COLPAGE 139
|
#define IDD_COLPAGE 139
|
||||||
#define IDS_ZIPCODE 139
|
#define IDS_ZIPCODE 139
|
||||||
#define IDS_COMP 140
|
#define IDS_COMP 140
|
||||||
|
|
@ -71,6 +72,10 @@
|
||||||
#define IDS_COLSAVE 178
|
#define IDS_COLSAVE 178
|
||||||
#define IDS_POSSAVE 179
|
#define IDS_POSSAVE 179
|
||||||
#define IDS_PREFS 180
|
#define IDS_PREFS 180
|
||||||
|
#define IDS_PRN_PAGE_FORMAT 181
|
||||||
|
#define IDS_MISSTMPL 182
|
||||||
|
#define IDS_OFN_OUT 183
|
||||||
|
#define IDS_OFN_EXE 184
|
||||||
#define IDC_FNAME 1000
|
#define IDC_FNAME 1000
|
||||||
#define IDC_SETPOS 1000
|
#define IDC_SETPOS 1000
|
||||||
#define IDC_STATIC1 1001
|
#define IDC_STATIC1 1001
|
||||||
|
|
@ -109,30 +114,43 @@
|
||||||
#define IDC_MYWEB 1012
|
#define IDC_MYWEB 1012
|
||||||
#define IDC_XFAX 1013
|
#define IDC_XFAX 1013
|
||||||
#define IDC_EMAIL2 1013
|
#define IDC_EMAIL2 1013
|
||||||
|
#define IDC_PMHEAD 1013
|
||||||
#define IDC_XEMAIL2 1014
|
#define IDC_XEMAIL2 1014
|
||||||
#define IDC_PAGERC 1014
|
#define IDC_PAGERC 1014
|
||||||
|
#define IDC_PMBODY 1014
|
||||||
#define IDC_XWEB1 1015
|
#define IDC_XWEB1 1015
|
||||||
#define IDC_WEB1 1015
|
#define IDC_WEB1 1015
|
||||||
|
#define IDC_PMFOOT 1015
|
||||||
#define IDC_XWEB2 1016
|
#define IDC_XWEB2 1016
|
||||||
#define IDC_FAX 1016
|
#define IDC_FAX 1016
|
||||||
|
#define IDC_PMNEW 1016
|
||||||
#define IDC_MI 1017
|
#define IDC_MI 1017
|
||||||
#define IDC_XPOSN 1017
|
#define IDC_XPOSN 1017
|
||||||
|
#define IDC_PMDELETE 1017
|
||||||
#define IDC_XSTATE 1018
|
#define IDC_XSTATE 1018
|
||||||
#define IDC_WEB2 1018
|
#define IDC_WEB2 1018
|
||||||
|
#define IDC_PM_FILE 1018
|
||||||
#define IDC_XCELL 1019
|
#define IDC_XCELL 1019
|
||||||
#define IDC_CELLULAR 1019
|
#define IDC_CELLULAR 1019
|
||||||
|
#define IDC_PMBROW_FILE 1019
|
||||||
#define IDC_TITLE 1020
|
#define IDC_TITLE 1020
|
||||||
#define IDC_XCOMP 1020
|
#define IDC_XCOMP 1020
|
||||||
|
#define IDC_PM_EDIT 1020
|
||||||
#define IDC_XZIP 1021
|
#define IDC_XZIP 1021
|
||||||
#define IDC_HPHONEX 1021
|
#define IDC_HPHONEX 1021
|
||||||
|
#define IDC_PMBROW_EDIT 1021
|
||||||
#define IDC_XCELLX 1022
|
#define IDC_XCELLX 1022
|
||||||
#define IDC_NOTES 1022
|
#define IDC_NOTES 1022
|
||||||
|
#define IDC_PMTEMPLATE 1022
|
||||||
#define IDC_XFAXX 1023
|
#define IDC_XFAXX 1023
|
||||||
#define IDC_WPHONEX 1023
|
#define IDC_WPHONEX 1023
|
||||||
|
#define IDC_PM_VIEW 1023
|
||||||
#define IDC_XEMAIL1 1024
|
#define IDC_XEMAIL1 1024
|
||||||
#define IDC_PAGERX 1024
|
#define IDC_PAGERX 1024
|
||||||
|
#define IDC_PMBROW_VIEW 1024
|
||||||
#define IDC_XNOTES 1025
|
#define IDC_XNOTES 1025
|
||||||
#define IDC_FAXX 1025
|
#define IDC_FAXX 1025
|
||||||
|
#define IDC_PMLAUNCH 1025
|
||||||
#define IDC_XDEPT 1026
|
#define IDC_XDEPT 1026
|
||||||
#define IDC_CELLULARX 1026
|
#define IDC_CELLULARX 1026
|
||||||
#define IDC_XMGR 1027
|
#define IDC_XMGR 1027
|
||||||
|
|
@ -275,6 +293,7 @@
|
||||||
#define ID_ENTRY_EDIT 32774
|
#define ID_ENTRY_EDIT 32774
|
||||||
#define ID_ENTRY_DELETE 32775
|
#define ID_ENTRY_DELETE 32775
|
||||||
#define ID_ENTRY_COPY 32776
|
#define ID_ENTRY_COPY 32776
|
||||||
|
#define ID_FILE_PRINT_MERGE 32780
|
||||||
#define ID_FILE_IMPORT 32803
|
#define ID_FILE_IMPORT 32803
|
||||||
#define ID_IMPORT_CSV 32804
|
#define ID_IMPORT_CSV 32804
|
||||||
#define ID_IMPORT_TAB 32805
|
#define ID_IMPORT_TAB 32805
|
||||||
|
|
@ -307,9 +326,9 @@
|
||||||
#ifdef APSTUDIO_INVOKED
|
#ifdef APSTUDIO_INVOKED
|
||||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
#define _APS_3D_CONTROLS 1
|
#define _APS_3D_CONTROLS 1
|
||||||
#define _APS_NEXT_RESOURCE_VALUE 137
|
#define _APS_NEXT_RESOURCE_VALUE 139
|
||||||
#define _APS_NEXT_COMMAND_VALUE 32780
|
#define _APS_NEXT_COMMAND_VALUE 32781
|
||||||
#define _APS_NEXT_CONTROL_VALUE 1013
|
#define _APS_NEXT_CONTROL_VALUE 1026
|
||||||
#define _APS_NEXT_SYMED_VALUE 101
|
#define _APS_NEXT_SYMED_VALUE 101
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
2
StdAfx.h
2
StdAfx.h
|
|
@ -19,7 +19,7 @@
|
||||||
#ifndef _AFX_NO_AFXCMN_SUPPORT
|
#ifndef _AFX_NO_AFXCMN_SUPPORT
|
||||||
#include <afxcmn.h> // MFC support for Windows Common Controls
|
#include <afxcmn.h> // MFC support for Windows Common Controls
|
||||||
#endif // _AFX_NO_AFXCMN_SUPPORT
|
#endif // _AFX_NO_AFXCMN_SUPPORT
|
||||||
|
#include <afxtempl.h>
|
||||||
|
|
||||||
//{{AFX_INSERT_LOCATION}}
|
//{{AFX_INSERT_LOCATION}}
|
||||||
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||||
|
|
|
||||||
Reference in a new issue