From 6167aba18ff8d7b51e2880709bf51919cc8e74d0 Mon Sep 17 00:00:00 2001
From: Paulo Henrique Silva <ph.silva@gmail.com>
Date: Sat, 3 Jan 2015 17:58:05 -0200
Subject: [PATCH] Force OS X to show filter combo on open dialogs

---
 common/pgm_base.cpp                             |  4 ++++
 patches/wxwidgets-3.0.2_macosx_filedialog.patch | 15 +++++++++++++++
 2 files changed, 19 insertions(+)
 create mode 100644 patches/wxwidgets-3.0.2_macosx_filedialog.patch

diff --git a/common/pgm_base.cpp b/common/pgm_base.cpp
index b11d7ff..f5b3a93 100644
--- a/common/pgm_base.cpp
+++ b/common/pgm_base.cpp
@@ -37,6 +37,7 @@
 #include <wx/filename.h>
 #include <wx/snglinst.h>
 #include <wx/stdpaths.h>
+#include <wx/sysopt.h>
 
 #include <pgm_base.h>
 #include <wxstruct.h>
@@ -347,6 +348,9 @@ const wxString& PGM_BASE::GetEditorName()
 
 bool PGM_BASE::initPgm()
 {
+    // ask OS X to show filte filters on Open dialog for plugin disambiguation.
+    wxSystemOptions::SetOption(wxOSX_FILEDIALOG_ALWAYS_SHOW_TYPES, 1);
+
     wxFileName pgm_name( App().argv[0] );
 
     wxConfigBase::DontCreateOnDemand();
diff --git a/patches/wxwidgets-3.0.2_macosx_filedialog.patch b/patches/wxwidgets-3.0.2_macosx_filedialog.patch
new file mode 100644
index 0000000..31ff8f1
--- /dev/null
+++ b/patches/wxwidgets-3.0.2_macosx_filedialog.patch
@@ -0,0 +1,15 @@
+--- src/osx/cocoa/filedlg.mm  2014-06-24 18:43:01.000000000 -0300
++++ src/osx/cocoa/filedlg.mm  2015-01-03 17:26:48.000000000 -0200
+@@ -679,6 +679,12 @@
+         {
+             panel = oPanel;
+             result = wxID_OK;
++
++            if (m_filterChoice)
++            {
++                m_filterIndex = m_filterChoice->GetSelection();
++            }
++
+             NSArray* filenames = [oPanel filenames];
+             for ( size_t i = 0 ; i < [filenames count] ; ++ i )
+             {
-- 
2.2.0

