COrrected my misapplied fix, sorry

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60705 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2009-05-21 10:17:35 +00:00
parent 283965f0b3
commit 17547f0fe9

View File

@@ -246,16 +246,12 @@ wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(const wxString& name)
wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(wxPaperSize id) wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(wxPaperSize id)
{ {
// Take the item ordering into account so that the more common types typedef wxStringToPrintPaperTypeHashMap::iterator iterator;
// are likely to be taken into account first. This fixes problems with,
// for example, Letter reverting to A4 in the page setup dialog because for (iterator it = m_map->begin(), en = m_map->end(); it != en; ++it)
// it was wrongly translated to Note.
const wxSize sz = GetSize(id);
for ( size_t i = 0; i < GetCount(); i++ )
{ {
wxPrintPaperType* const paperType = Item(i); wxPrintPaperType* paperType = it->second;
const wxSize paperSize = paperType->GetSize() ; if (paperType->GetId() == id)
if ( abs(paperSize.x - sz.x) < 10 && abs(paperSize.y - sz.y) < 10 )
return paperType; return paperType;
} }
@@ -278,13 +274,15 @@ wxPrintPaperType *wxPrintPaperDatabase::FindPaperTypeByPlatformId(int id)
wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(const wxSize& sz) wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(const wxSize& sz)
{ {
typedef wxStringToPrintPaperTypeHashMap::iterator iterator; // 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 (iterator it = m_map->begin(), en = m_map->end(); it != en; ++it) // 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; wxPrintPaperType* const paperType = Item(i);
wxSize paperSize = paperType->GetSize() ; const wxSize paperSize = paperType->GetSize() ;
if ( abs( paperSize.x - sz.x ) < 10 && abs( paperSize.y - sz.y ) < 10 ) if ( abs(paperSize.x - sz.x) < 10 && abs(paperSize.y - sz.y) < 10 )
return paperType; return paperType;
} }