summaryrefslogtreecommitdiff
path: root/win
diff options
context:
space:
mode:
authorleo2002-08-26 22:19:31 +0000
committerleo2002-08-26 22:19:31 +0000
commitbba1312ba7867934c8bfbfa6c968d2b35fb1fe51 (patch)
tree347e36d00b96d03cdfeca9a30e5bd21c06cbb5b1 /win
parent72813923fd865a336687977169dd5868e79e0547 (diff)
Added an option to print the total pages on the header.
git-svn-id: http://svn.leocad.org/trunk@299 c7d43263-9d01-0410-8a33-9dba5d9f93d6
Diffstat (limited to 'win')
-rw-r--r--win/Cadview.cpp19
-rw-r--r--win/Cadview.h2
-rw-r--r--win/Print.cpp4
3 files changed, 17 insertions, 8 deletions
diff --git a/win/Cadview.cpp b/win/Cadview.cpp
index 5c19b33..32ae15e 100644
--- a/win/Cadview.cpp
+++ b/win/Cadview.cpp
@@ -448,13 +448,13 @@ void CCADView::OnPrint(CDC* pDC, CPrintInfo* pInfo)
pDC->SetTextAlign (TA_TOP|TA_LEFT|TA_NOUPDATECP);
rc.top -= pDC->GetDeviceCaps(LOGPIXELSY)*theApp.GetProfileInt("Default","Margin Top", 50)/200;
rc.bottom += pDC->GetDeviceCaps(LOGPIXELSY)*theApp.GetProfileInt("Default","Margin Bottom", 50)/200;
- PrintHeader(FALSE, pDC->GetSafeHdc(), rc, pInfo->m_nCurPage, FALSE);
- PrintHeader(TRUE, pDC->GetSafeHdc(), rc, pInfo->m_nCurPage, FALSE);
+ PrintHeader(FALSE, pDC->GetSafeHdc(), rc, pInfo->m_nCurPage, pInfo->GetMaxPage(), FALSE);
+ PrintHeader(TRUE, pDC->GetSafeHdc(), rc, pInfo->m_nCurPage, pInfo->GetMaxPage(), FALSE);
SelectObject(pDC->m_hDC, OldFont);
DeleteObject(font);
}
-void CCADView::PrintHeader(BOOL bFooter, HDC hDC, CRect rc, UINT page, BOOL bCatalog)
+void CCADView::PrintHeader(BOOL bFooter, HDC hDC, CRect rc, UINT nCurPage, UINT nMaxPage, BOOL bCatalog)
{
CString str,tmp;
UINT nFormat = DT_CENTER;
@@ -492,7 +492,7 @@ void CCADView::PrintHeader(BOOL bFooter, HDC hDC, CRect rc, UINT page, BOOL bCat
{
tmp = str.Left (r);
if (bCatalog)
- tmp += "LeoCAD Parts Catalog";
+ tmp += "LeoCAD Pieces Catalog";
else
tmp += project->m_strTitle;
tmp += str.Right(str.GetLength()-r-2);
@@ -533,7 +533,16 @@ void CCADView::PrintHeader(BOOL bFooter, HDC hDC, CRect rc, UINT page, BOOL bCat
while ((r = str.Find("&P")) != -1)
{
char buf[5];
- sprintf (buf, "%d", page);
+ sprintf (buf, "%d", nCurPage);
+ tmp = str.Left (r);
+ tmp += buf;
+ tmp += str.Right(str.GetLength()-r-2);
+ str = tmp;
+ }
+ while ((r = str.Find("&O")) != -1)
+ {
+ char buf[5];
+ sprintf (buf, "%d", nMaxPage);
tmp = str.Left (r);
tmp += buf;
tmp += str.Right(str.GetLength()-r-2);
diff --git a/win/Cadview.h b/win/Cadview.h
index 80861a9..148bf36 100644
--- a/win/Cadview.h
+++ b/win/Cadview.h
@@ -18,7 +18,7 @@ protected: // create from serialization only
// Attributes
public:
CCADDoc* GetDocument();
- void PrintHeader(BOOL bFooter, HDC hDC, CRect rc, UINT page, BOOL bCatalog);
+ void PrintHeader(BOOL bFooter, HDC hDC, CRect rc, UINT nCurPage, UINT nMaxPage, BOOL bCatalog);
// Operations
public:
diff --git a/win/Print.cpp b/win/Print.cpp
index 122bd92..6799913 100644
--- a/win/Print.cpp
+++ b/win/Print.cpp
@@ -350,8 +350,8 @@ static void PrintCatalogThread (CWnd* pParent, CFrameWnd* pMainFrame)
CRect r2 = rectDraw;
r2.top -= GetDeviceCaps(PD->m_pd.hDC, LOGPIXELSY)*theApp.GetProfileInt("Default","Margin Top", 50)/200;
r2.bottom += GetDeviceCaps(PD->m_pd.hDC, LOGPIXELSY)*theApp.GetProfileInt("Default","Margin Bottom", 50)/200;
- pView->PrintHeader(FALSE, PD->m_pd.hDC, r2, nCurPage, TRUE);
- pView->PrintHeader(TRUE, PD->m_pd.hDC, r2, nCurPage, TRUE);
+ pView->PrintHeader(FALSE, PD->m_pd.hDC, r2, nCurPage, nEndPage, TRUE);
+ pView->PrintHeader(TRUE, PD->m_pd.hDC, r2, nCurPage, nEndPage, TRUE);
if (EndPage(PD->m_pd.hDC) < 0 || !_AfxAbortProc(PD->m_pd.hDC, 0))
{