Update of /cvsroot/audacity/lib-src/FileDialog/win
In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv6653/win

Modified Files:
        FileDialogPrivate.cpp 
Log Message:
Fix filtering on Windows 7.


Index: FileDialogPrivate.cpp
===================================================================
RCS file: /cvsroot/audacity/lib-src/FileDialog/win/FileDialogPrivate.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- FileDialogPrivate.cpp       13 Nov 2009 05:21:43 -0000      1.18
+++ FileDialogPrivate.cpp       19 Jan 2010 09:08:39 -0000      1.19
@@ -75,6 +75,9 @@
 // standard dialog size
 static wxRect gs_rectDialog(0, 0, 428, 266);
 
+// true to use custom filtering code (anything less than Win7)
+static bool gs_customFilter = true;
+
 // ============================================================================
 // implementation
 // ============================================================================
@@ -226,14 +229,14 @@
             EnableWindow(hwndDialog, TRUE);
             SetFocus(w);
          }
-         else if (CDN_SELCHANGE == (pNotifyCode->hdr).code)
+         else if (CDN_SELCHANGE == (pNotifyCode->hdr).code && gs_customFilter)
          {
             OPENFILENAME *ofn = (OPENFILENAME *)
             GetWindowLongPtr(hDlg, GWLP_USERDATA);
             FileDialog *me = (FileDialog *) ofn->lCustData;
             me->FilterFiles(hDlg, false);
          }
-         else if (CDN_TYPECHANGE == (pNotifyCode->hdr).code)
+         else if (CDN_TYPECHANGE == (pNotifyCode->hdr).code && gs_customFilter)
          {
             OPENFILENAME *ofn = (OPENFILENAME *)
             GetWindowLongPtr(hDlg, GWLP_USERDATA);
@@ -625,7 +628,8 @@
    wxZeroMemory(of);
    
    // Allow Places bar to show on supported platforms
-   if ( wxGetOsVersion() == wxOS_WINDOWS_NT )
+   int major, minor;
+   if ( wxGetOsVersion(&major, &minor) == wxOS_WINDOWS_NT )
    {
       of.lStructSize       = sizeof(OPENFILENAME);
    }
@@ -690,13 +694,17 @@
    
    wxASSERT_MSG( items > 0 , wxT("empty wildcard list") );
    
+   // We do not use the custom filter code on Windows 7 or higher since it now
+   // handles filters larger than 260 characters.
+   gs_customFilter = (major < 6 || minor < 1);
+
    wxString filterBuffer;
    
    for (i = 0; i < items ; i++)
    {
       filterBuffer += wildDescriptions[i];
       filterBuffer += wxT("|");
-      filterBuffer += wxT("*.*");
+      filterBuffer += (gs_customFilter ? wxT("*.*") : m_FilterGroups[i]);
       filterBuffer += wxT("|");
    }
    


------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Audacity-cvs mailing list
Audacity-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to