From 27269a137c635fc0094853a8f34876d31b45a4a9 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Thu, 21 May 2009 10:17:44 +0000 Subject: [PATCH] COrrected my misapplied fix, sorry git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@60706 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/paper.cpp | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/common/paper.cpp b/src/common/paper.cpp index fb75f0f4ac..d37327687d 100644 --- a/src/common/paper.cpp +++ b/src/common/paper.cpp @@ -246,16 +246,12 @@ wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(const wxString& name) wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(wxPaperSize id) { - // Take the item ordering into account so that the more common types - // are likely to be taken into account first. This fixes problems with, - // for example, Letter reverting to A4 in the page setup dialog because - // it was wrongly translated to Note. - size_t i; - for (i = 0; i < GetCount(); i++) + typedef wxStringToPrintPaperTypeHashMap::iterator iterator; + + for (iterator it = m_map->begin(), en = m_map->end(); it != en; ++it) { - wxPrintPaperType* paperType = Item(i); - wxSize paperSize = paperType->GetSize() ; - if ( abs( paperSize.x - sz.x ) < 10 && abs( paperSize.y - sz.y ) < 10 ) + wxPrintPaperType* paperType = it->second; + if (paperType->GetId() == id) return paperType; } @@ -278,11 +274,14 @@ wxPrintPaperType *wxPrintPaperDatabase::FindPaperTypeByPlatformId(int id) wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(const wxSize& sz) { - typedef wxStringToPrintPaperTypeHashMap::iterator iterator; - - for (iterator it = m_map->begin(), en = m_map->end(); it != en; ++it) + // Take the item ordering into account so that the more common types + // are likely to be taken into account first. This fixes problems with, + // for example, Letter reverting to A4 in the page setup dialog because + // it was wrongly translated to Note. + size_t i; + for (i = 0; i < GetCount(); i++) { - wxPrintPaperType* paperType = it->second; + wxPrintPaperType* paperType = Item(i); wxSize paperSize = paperType->GetSize() ; if ( abs( paperSize.x - sz.x ) < 10 && abs( paperSize.y - sz.y ) < 10 ) return paperType;