]> git.saurik.com Git - wxWidgets.git/commitdiff
COrrected my misapplied fix, sorry
authorJulian Smart <julian@anthemion.co.uk>
Thu, 21 May 2009 10:17:35 +0000 (10:17 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Thu, 21 May 2009 10:17:35 +0000 (10:17 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60705 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/paper.cpp

index b0865c9ebe572d9a733cee4b94bdaf50f0b90cdf..f301fd01c23b51bf2733198b5c8d418ca32c579d 100644 (file)
@@ -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.
-    const wxSize sz = GetSize(id);
-    for ( size_t i = 0; i < GetCount(); i++ )
+    typedef wxStringToPrintPaperTypeHashMap::iterator iterator;
+
+    for (iterator it = m_map->begin(), en = m_map->end(); it != en; ++it)
     {
-        wxPrintPaperType* const paperType = Item(i);
-        const 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,13 +274,15 @@ 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.
+    for ( size_t i = 0; i < GetCount(); i++ )
     {
-        wxPrintPaperType* paperType = it->second;
-        wxSize paperSize = paperType->GetSize() ;
-        if ( abs( paperSize.x - sz.x ) < 10 && abs( paperSize.y - sz.y ) < 10 )
+        wxPrintPaperType* const paperType = Item(i);
+        const wxSize paperSize = paperType->GetSize() ;
+        if ( abs(paperSize.x - sz.x) < 10 && abs(paperSize.y - sz.y) < 10 )
             return paperType;
     }