]> git.saurik.com Git - wxWidgets.git/blobdiff - src/unix/fontenum.cpp
don't skip first/last node when pressing down/up arrow after opening the menu with...
[wxWidgets.git] / src / unix / fontenum.cpp
index a1d374896eee08ef33c08ab9ca2fa7124d2c5d7e..63bcf5c4fccfa7a144b5c91ccb0a5a8a220d1194 100644 (file)
 #include "wx/defs.h"
 #include "wx/dynarray.h"
 #include "wx/string.h"
 #include "wx/defs.h"
 #include "wx/dynarray.h"
 #include "wx/string.h"
+#include "wx/regex.h"
 #include "wx/utils.h"
 
 #include "wx/fontmap.h"
 #include "wx/fontenum.h"
 #include "wx/fontutil.h"
 
 #include "wx/utils.h"
 
 #include "wx/fontmap.h"
 #include "wx/fontenum.h"
 #include "wx/fontutil.h"
 
+#ifdef __VMS__ // Xlib.h for VMS is not (yet) compatible with C++
+               // The resulting warnings are switched off here
+#pragma message disable nosimpint
+#endif
 #include <X11/Xlib.h>
 #include <X11/Xlib.h>
+#ifdef __VMS__
+#pragma message enable nosimpint
+#endif
 
 // ----------------------------------------------------------------------------
 // private functions
 
 // ----------------------------------------------------------------------------
 // private functions
@@ -66,11 +74,13 @@ static char **CreateFontList(wxChar spacing,
     wxNativeEncodingInfo info;
     wxGetNativeFontEncoding(encoding, &info);
 
     wxNativeEncodingInfo info;
     wxGetNativeFontEncoding(encoding, &info);
 
+#if wxUSE_FONTMAP
     if ( !wxTestFontEncoding(info) )
     {
         // ask font mapper for a replacement
         (void)wxTheFontMapper->GetAltForEncoding(encoding, &info);
     }
     if ( !wxTestFontEncoding(info) )
     {
         // ask font mapper for a replacement
         (void)wxTheFontMapper->GetAltForEncoding(encoding, &info);
     }
+#endif // wxUSE_FONTMAP
 
     wxString pattern;
     pattern.Printf(wxT("-*-*-*-*-*-*-*-*-*-*-%c-*-%s-%s"),
 
     wxString pattern;
     pattern.Printf(wxT("-*-*-*-*-*-*-*-*-*-*-%c-*-%s-%s"),
@@ -86,12 +96,20 @@ static bool ProcessFamiliesFromFontList(wxFontEnumerator *This,
                                         char **fonts,
                                         int nFonts)
 {
                                         char **fonts,
                                         int nFonts)
 {
+#if wxUSE_REGEX
+    wxRegEx re(wxT("^(-[^-]*){14}$"), wxRE_NOSUB);
+#endif // wxUSE_REGEX
+
     // extract the list of (unique) font families
     wxSortedArrayString families;
     for ( int n = 0; n < nFonts; n++ )
     {
         char *font = fonts[n];
     // extract the list of (unique) font families
     wxSortedArrayString families;
     for ( int n = 0; n < nFonts; n++ )
     {
         char *font = fonts[n];
+#if wxUSE_REGEX
+        if ( !re.Matches(font) )
+#else // !wxUSE_REGEX
         if ( !wxString(font).Matches(wxT("-*-*-*-*-*-*-*-*-*-*-*-*-*-*")) )
         if ( !wxString(font).Matches(wxT("-*-*-*-*-*-*-*-*-*-*-*-*-*-*")) )
+#endif // wxUSE_REGEX/!wxUSE_REGEX
         {
             // it's not a full font name (probably an alias)
             continue;
         {
             // it's not a full font name (probably an alias)
             continue;