From edeca4d9d66ce4ef51eae3f18dc165c21be612ee Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 24 May 2018 18:11:45 +0200 Subject: [PATCH] Use wxVector instead of wxArrayInt in wxHtmlDCRenderer No real changes, just prefer standard-like template class to the legacy wx one. --- include/wx/html/htmprint.h | 3 ++- src/html/htmprint.cpp | 14 +++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/include/wx/html/htmprint.h b/include/wx/html/htmprint.h index 7edfa808db..e2462ceaf5 100644 --- a/include/wx/html/htmprint.h +++ b/include/wx/html/htmprint.h @@ -20,6 +20,7 @@ #include "wx/print.h" #include "wx/printdlg.h" +#include "wx/vector.h" #include // INT_MAX @@ -188,7 +189,7 @@ private: private: int m_NumPages; - wxArrayInt m_PageBreaks; + wxVector m_PageBreaks; wxString m_Document, m_BasePath; bool m_BasePathIsDir; diff --git a/src/html/htmprint.cpp b/src/html/htmprint.cpp index 199f89b835..703fe6387a 100644 --- a/src/html/htmprint.cpp +++ b/src/html/htmprint.cpp @@ -388,19 +388,19 @@ bool wxHtmlPrintout::OnPrintPage(int page) void wxHtmlPrintout::GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo) { *minPage = 1; - if ( m_NumPages >= (signed)m_PageBreaks.GetCount()-1) + if ( m_NumPages >= (signed)m_PageBreaks.size()-1) *maxPage = m_NumPages; else - *maxPage = (signed)m_PageBreaks.GetCount()-1; + *maxPage = (signed)m_PageBreaks.size()-1; *selPageFrom = 1; - *selPageTo = (signed)m_PageBreaks.GetCount()-1; + *selPageTo = (signed)m_PageBreaks.size()-1; } bool wxHtmlPrintout::HasPage(int pageNum) { - return pageNum > 0 && (unsigned)pageNum < m_PageBreaks.GetCount(); + return pageNum > 0 && (unsigned)pageNum < m_PageBreaks.size(); } @@ -480,11 +480,11 @@ void wxHtmlPrintout::CountPages() m_NumPages = 0; - m_PageBreaks.Clear(); + m_PageBreaks.clear(); for ( int pos = 0; pos != wxNOT_FOUND; ) { - m_PageBreaks.Add( pos); + m_PageBreaks.push_back(pos); pos = m_Renderer.FindNextPageBreak(pos); } } @@ -550,7 +550,7 @@ wxString wxHtmlPrintout::TranslateHeader(const wxString& instr, int page) num.Printf(wxT("%i"), page); r.Replace(wxT("@PAGENUM@"), num); - num.Printf(wxT("%lu"), (unsigned long)(m_PageBreaks.GetCount() - 1)); + num.Printf(wxT("%lu"), (unsigned long)(m_PageBreaks.size() - 1)); r.Replace(wxT("@PAGESCNT@"), num); #if wxUSE_DATETIME