// include the platform-specific version of the class
 // ----------------------------------------------------------------------------
 
-// NB: test for __UNIX__ before __WXMAC__ as under Darwin we want to use the
-//     Unix code (and otherwise __UNIX__ wouldn't be defined)
+// NB:  test for __UNIX__ before __WXMAC__ as under Darwin we want to use the
+//      Unix code (and otherwise __UNIX__ wouldn't be defined)
+// ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port
 #if defined(__WXPALMOS__)
     #include "wx/palmos/apptbase.h"
-#elif defined(__WXMSW__)
+#elif defined(__WIN32__)
     #include "wx/msw/apptbase.h"
 #elif defined(__UNIX__) && !defined(__EMX__)
     #include "wx/unix/apptbase.h"
 // include the platform-specific version of the classes above
 // ----------------------------------------------------------------------------
 
+// ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port
 #if defined(__WXPALMOS__)
     #include "wx/palmos/apptrait.h"
-#elif defined(__WXMSW__)
+#elif defined(__WIN32__)
     #include "wx/msw/apptrait.h"
 #elif defined(__UNIX__) && !defined(__EMX__)
     #include "wx/unix/apptrait.h"
 
     it always returns false in other cases.
  */
 #ifdef __cplusplus
-    #if defined(__WXMAC__) || defined(__WXMSW__)
+    /* ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port */
+    #if defined(__WXMAC__) || defined(__WIN32__)
         extern bool WXDLLIMPEXP_BASE wxIsDebuggerRunning();
     #else /*  !Mac */
         inline bool wxIsDebuggerRunning() { return false; }
 
             NASTY HACK because the gethostname in sys/unistd.h which the gnu
             stl includes and wx builds with by default clash with each other
             (windows version 2nd param is int, sys/unistd.h version is unsigned
-            int).  
+            int).
           */
 #        define gethostname gethostnameHACK
 #        include <unistd.h>
 #endif /* __WXPALMOS__ */
 
 
-#if defined(__WXMSW__)
+/* ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port */
+#if defined(__WIN32__)
 
 /*  the keywords needed for WinMain() declaration */
 #ifndef WXFAR
 typedef long            WXLRESULT;
 #endif
 
-#if !defined(__WIN32__) || defined(__GNUWIN32__) || defined(__WXMICROWIN__)
+#if defined(__GNUWIN32__) || defined(__WXMICROWIN__)
 typedef int             (*WXFARPROC)();
 #else
 typedef int             (__stdcall *WXFARPROC)();
 #endif
-#endif /*  __WXMSW__ */
+#endif /*  __WIN32__ */
 
 
 #if defined(__WXPM__) || defined(__EMX__)
 
 #pragma interface "propdlg.h"
 #endif
 
+#include "wx/defs.h"
+
+#if wxUSE_BOOKCTRL
+
 class WXDLLEXPORT wxBookCtrlBase;
 
 //-----------------------------------------------------------------------------
     DECLARE_EVENT_TABLE()
 };
 
+#endif // wxUSE_BOOKCTRL
+
 #endif // _WX_PROPDLG_H_
 
 
     EVT_FIND_CLOSE(wxID_ANY, MyFrame::OnFindDialog)
 #endif // wxUSE_FINDREPLDLG
 
+#if USE_SETTINGS_DIALOG
     EVT_MENU(DIALOGS_PROPERTY_SHEET,                MyFrame::OnPropertySheet)
+#endif
+
     EVT_MENU(DIALOGS_REQUEST,                       MyFrame::OnRequestUserAttention)
 
     EVT_MENU(wxID_EXIT,                             MyFrame::OnExit)
     file_menu->Append(wxID_ANY,_T("&Modal/Modeless"),modal_menu);
 #endif // USE_MODAL_PRESENTATION
 
+#if USE_SETTINGS_DIALOG
     file_menu->Append(DIALOGS_PROPERTY_SHEET, _T("&Property Sheet Dialog\tCtrl-P"));
+#endif
+
     file_menu->Append(DIALOGS_REQUEST, _T("&Request user attention\tCtrl-R"));
 
     file_menu->AppendSeparator();
        : wxFrame(parent, wxID_ANY, title)
 {
     SetIcon(sample_xpm);
-    
+
 #if USE_MODAL_PRESENTATION
     m_dialog = (MyModelessDialog *)NULL;
 #endif // USE_MODAL_PRESENTATION
 }
 #endif // wxUSE_STARTUP_TIPS
 
+#if USE_SETTINGS_DIALOG
 void MyFrame::OnPropertySheet(wxCommandEvent& WXUNUSED(event))
 {
     SettingsDialog dialog(this);
     dialog.ShowModal();
 }
+#endif // USE_SETTINGS_DIALOG
 
 void MyFrame::OnRequestUserAttention(wxCommandEvent& WXUNUSED(event))
 {
 
 #endif // USE_MODAL_PRESENTATION
 
+#if USE_SETTINGS_DIALOG
 // ----------------------------------------------------------------------------
 // SettingsDialog
 // ----------------------------------------------------------------------------
 {
     SetExtraStyle(wxDIALOG_EX_CONTEXTHELP|wxWS_EX_VALIDATE_RECURSIVELY);
 
-    Create(win, -1, _("Preferences"), wxDefaultPosition, wxDefaultSize,
+    Create(win, wxID_ANY, _("Preferences"), wxDefaultPosition, wxDefaultSize,
         wxDEFAULT_DIALOG_STYLE
 #ifndef __WXWINCE__
         |wxRESIZE_BORDER
-#endif        
+#endif
     );
     CreateButtons(wxOK|wxCANCEL|wxHELP);
 
 
 #if wxUSE_SPINCTRL
     wxSpinCtrl* spinCtrl12 = new wxSpinCtrl(panel, ID_AUTO_SAVE_MINS, wxEmptyString,
-        wxDefaultPosition, wxSize(40, -1), wxSP_ARROW_KEYS, 1, 60, 1);
+        wxDefaultPosition, wxSize(40, wxDefaultCoord), wxSP_ARROW_KEYS, 1, 60, 1);
 #endif
-    
+
     itemSizer12->Add(checkBox12, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5);
 #if wxUSE_SPINCTRL
     itemSizer12->Add(spinCtrl12, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5);
     item0->Add(itemSizer12, 0, wxGROW|wxALL, 0);
 
     //// TOOLTIPS
-    
+
     wxBoxSizer* itemSizer8 = new wxBoxSizer( wxHORIZONTAL );
     wxCheckBox* checkBox6 = new wxCheckBox(panel, ID_SHOW_TOOLTIPS, _("Show &tooltips"), wxDefaultPosition, wxDefaultSize);
     itemSizer8->Add(checkBox6, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5);
 
     panel->SetSizer(topSizer);
     topSizer->Fit(panel);
-    
+
     return panel;
 }
 
     wxArrayString backgroundStyleChoices;
     backgroundStyleChoices.Add(wxT("Colour"));
     backgroundStyleChoices.Add(wxT("Image"));
-    wxStaticBox* staticBox3 = new wxStaticBox(panel, -1, _("Background style:"));
+    wxStaticBox* staticBox3 = new wxStaticBox(panel, wxID_ANY, _("Background style:"));
 
     wxBoxSizer* styleSizer = new wxStaticBoxSizer( staticBox3, wxVERTICAL );
     item0->Add(styleSizer, 0, wxGROW|wxALL, 5);
 #if wxUSE_SPINCTRL
     //// FONT SIZE SELECTION
 
-    wxStaticBox* staticBox1 = new wxStaticBox(panel, -1, _("Tile font size:"));
+    wxStaticBox* staticBox1 = new wxStaticBox(panel, wxID_ANY, _("Tile font size:"));
     wxBoxSizer* itemSizer5 = new wxStaticBoxSizer( staticBox1, wxHORIZONTAL );
 
     wxSpinCtrl* spinCtrl = new wxSpinCtrl(panel, ID_FONT_SIZE, wxEmptyString, wxDefaultPosition,
-        wxSize(80, -1));
+        wxSize(80, wxDefaultCoord));
     itemSizer5->Add(spinCtrl, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
 
     item0->Add(itemSizer5, 0, wxGROW|wxLEFT|wxRIGHT, 5);
 
     panel->SetSizer(topSizer);
     topSizer->Fit(panel);
-    
+
     return panel;
 }
 
+#endif // USE_SETTINGS_DIALOG
 
 
 // Turn USE_MODAL_PRESENTATION to 0 if there is any reason for not presenting difference
 // between modal and modeless dialogs (ie. not implemented it in your port yet)
-#if defined(__SMARTPHONE__)
+#if defined(__SMARTPHONE__) || !wxUSE_BOOKCTRL
     #define USE_MODAL_PRESENTATION 0
 #else
     #define USE_MODAL_PRESENTATION 1
 #endif
 
 
+// Turn USE_SETTINGS_DIALOG to 0 if supported
+#if wxUSE_BOOKCTRL
+    #define USE_SETTINGS_DIALOG 1
+#else
+    #define USE_SETTINGS_DIALOG 0
+#endif
+
+
 // Define a new application type
 class MyApp: public wxApp
 {
 
 #endif // USE_MODAL_PRESENTATION
 
+#if USE_SETTINGS_DIALOG
 // Property sheet dialog
 class SettingsDialog: public wxPropertySheetDialog
 {
 DECLARE_EVENT_TABLE()
 };
 
+#endif // USE_SETTINGS_DIALOG
+
 // Define a new frame type
 class MyFrame: public wxFrame
 {
 
     menuMenu->AppendSeparator();
     menuMenu->Append(Menu_Menu_GetInfo, _T("Get menu item in&fo\tAlt-F"),
                      _T("Show the state of the last menu item"));
+#if wxUSE_TEXTDLG
     menuMenu->Append(Menu_Menu_SetLabel, _T("Set menu item label\tAlt-L"),
                      _T("Set the label of a menu item"));
+#endif
 #if wxUSE_TEXTDLG
     menuMenu->AppendSeparator();
     menuMenu->Append(Menu_Menu_FindItem, _T("Find menu item from label"),
 
 #if USE_LOG_WINDOW
     // create the log text window
-    m_textctrl = new wxTextCtrl(this, wxID_ANY, _T(""),
+    m_textctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString,
                                 wxDefaultPosition, wxDefaultSize,
                                 wxTE_MULTILINE);
     m_textctrl->SetEditable(false);
                      (
                         _T("Enter label to search for: "),
                         _T("Find menu"),
-                        _T(""),
+                        wxEmptyString,
                         this
                      );
 
 
     menu->Insert(0, wxMenuItem::New(menu, Menu_Dummy_Fourth,
                                     _T("Fourth dummy item\tCtrl-F4")));
-    menu->Insert(1, wxMenuItem::New(menu, wxID_SEPARATOR, _T("")));
+    menu->Insert(1, wxMenuItem::New(menu, wxID_SEPARATOR));
 }
 
 void MyFrame::OnEnableMenuItem(wxCommandEvent& WXUNUSED(event))
                      (
                         _T("Enter label to search for: "),
                         _T("Find menu item"),
-                        _T(""),
+                        wxEmptyString,
                         this
                      );
 
 
     ART(wxART_TICK_MARK,                           tick)
     ART(wxART_CROSS_MARK,                          cross)
 
-    ART(wxART_FILE_SAVE,                           filesave)  
-    ART(wxART_FILE_SAVE_AS,                        filesaveas)        
+    ART(wxART_FILE_SAVE,                           filesave)
+    ART(wxART_FILE_SAVE_AS,                        filesaveas)
     ART(wxART_COPY,                                copy)
     ART(wxART_CUT,                                 cut)
     ART(wxART_PASTE,                               paste)
     ART(wxART_FIND,                                find)
     ART(wxART_FIND_AND_REPLACE,                    findrepl)
     ART(wxART_NEW,                                 new)
-       
-        
+
+
     return wxNullBitmap;
 }
 
             }
         }
     }
+#else
+    wxUnusedVar(client);
+    wxUnusedVar(reqSize);
 #endif // wxUSE_IMAGE
 
     return bmp;
 
 #include <stdarg.h>
 #include <stdio.h>
 
-#if defined(__WXMSW__)
+#if defined(__WINDOWS__)
     #include "wx/msw/private.h"
 #endif
 #ifdef __WXMAC__
 
 
 #if wxUSE_WCHAR_T
 
-#ifdef __WXMSW__
-    #include "wx/msw/private.h"
-#endif
-
 #ifdef __WINDOWS__
+    #include "wx/msw/private.h"
     #include "wx/msw/missing.h"
 #endif
 
 #ifdef __UNIX__
 
 // ----------------------------------------------------------------------------
-// wxConvBrokenFileNames 
+// wxConvBrokenFileNames
 // ----------------------------------------------------------------------------
 
 wxConvBrokenFileNames::wxConvBrokenFileNames(const wxChar *charset)
 
 
 bool wxLaunchDefaultBrowser(const wxString& url)
 {
+    bool success = true;
+
     wxString finalurl = url;
 
     //if it isn't a full url, try appending http:// to it
         // Windows sometimes doesn't open the browser correctly when using mime
         // types, so do ShellExecute - i.e. start <url> (from James Carroll)
         nResult = (int) (*lpShellExecute)(NULL, NULL, finalurl.c_str(),
-                                                       NULL, wxT(""), SW_SHOWNORMAL);
+                                          NULL, wxT(""), SW_SHOWNORMAL);
         // Unload Shell32.dll
         ::FreeLibrary(hShellDll);
 #else
         if ( cmd.empty() || wxExecute(cmd + wxT(" ") + finalurl) == -1)
             return false;
     }
-     
+
 
 #else // !wxUSE_MIMETYPE && !(WXMSW && wxUSE_NATIVE_CONFIG)
 
-        return false;
+    success = false;
 
 #endif
 
     //success - hopefully
-    return true;
+    return success;
 }
 
 // ----------------------------------------------------------------------------
 
 
 #include "wx/defs.h"
 
+#if wxUSE_BOOKCTRL
+
 #ifndef WX_PRECOMP
     #include "wx/button.h"
     #include "wx/sizer.h"
     EVT_ACTIVATE(wxPropertySheetDialog::OnActivate)
 END_EVENT_TABLE()
 
-bool wxPropertySheetDialog::Create(wxWindow* parent, wxWindowID id, const wxString& title, 
+bool wxPropertySheetDialog::Create(wxWindow* parent, wxWindowID id, const wxString& title,
                                        const wxPoint& pos, const wxSize& sz, long style,
                                        const wxString& name)
 {
     if (!wxDialog::Create(parent, id, title, pos, sz, style|wxCLIP_CHILDREN, name))
         return false;
-    
+
     wxBoxSizer *topSizer = new wxBoxSizer( wxVERTICAL );
     SetSizer(topSizer);
 
     // of the dialog (the choicebook).
     if (event.GetActive())
     {
-        wxChoicebook* choiceBook = wxDynamicCast(GetBookCtrl(), wxChoicebook);     
+        wxChoicebook* choiceBook = wxDynamicCast(GetBookCtrl(), wxChoicebook);
         if (choiceBook)
             choiceBook->SetFocus();
     }
         event.Skip();
 }
 
+#endif // wxUSE_BOOKCTRL
 
 #include "wx/dir.h"
 #include "wx/filefn.h"          // for wxDirExists()
 
-#ifdef __WXMSW__
+#ifdef __WINDOWS__
     #include "wx/msw/private.h"
 #endif
 
 
 
 #endif // wxUSE_BASE
 
-#if wxUSE_GUI
+#if wxUSE_GUI && defined(__WXMSW__)
 
 // ----------------------------------------------------------------------------
 // Windows-specific wxEntry
 
 #endif // !NOMAIN
 
-#endif // wxUSE_GUI
+#endif // wxUSE_GUI && __WXMSW__
 
 // ----------------------------------------------------------------------------
 // global HINSTANCE
 
   }
   else {
     strKey = strKey.After(REG_SEPARATOR);
-    if ( !strKey.IsEmpty() && strKey.Last() == REG_SEPARATOR )
+    if ( !strKey.empty() && strKey.Last() == REG_SEPARATOR )
       strKey.Truncate(strKey.Len() - 1);
   }
 
         : m_strKey(keyParent.m_strKey)
 {
   // combine our name with parent's to get the full name
-  if ( !m_strKey.IsEmpty() &&
-       (strKey.IsEmpty() || strKey[0] != REG_SEPARATOR) ) {
+  if ( !m_strKey.empty() &&
+       (strKey.empty() || strKey[0] != REG_SEPARATOR) ) {
       m_strKey += REG_SEPARATOR;
   }
 
   //     next line!
   m_strKey.clear();
   m_strKey += keyParent.m_strKey;
-  if ( !strKey.IsEmpty() && strKey[0] != REG_SEPARATOR )
+  if ( !strKey.empty() && strKey[0] != REG_SEPARATOR )
     m_strKey += REG_SEPARATOR;
   m_strKey += strKey;
 
   StdKey key = GetStdKeyFromHkey((WXHKEY) m_hRootKey);
   wxString str = bShortPrefix ? aStdKeys[key].szShortName
                               : aStdKeys[key].szName;
-  if ( !m_strKey.IsEmpty() )
+  if ( !m_strKey.empty() )
     str << _T("\\") << m_strKey;
 
   return str;
 
 bool wxRegKey::Rename(const wxChar *szNewName)
 {
-    wxCHECK_MSG( !m_strKey.IsEmpty(), false, _T("registry hives can't be renamed") );
+    wxCHECK_MSG( !m_strKey.empty(), false, _T("registry hives can't be renamed") );
 
     if ( !Exists() ) {
         wxLogError(_("Registry key '%s' does not exist, cannot rename it."),
     if ( inSameHive ) {
         // rename the key to the new name under the same parent
         wxString strKey = m_strKey.BeforeLast(REG_SEPARATOR);
-        if ( !strKey.IsEmpty() ) {
+        if ( !strKey.empty() ) {
             // don't add '\\' in the start if strFullNewName is empty
             strKey += REG_SEPARATOR;
         }
   // prevent a buggy program from erasing one of the root registry keys or an
   // immediate subkey (i.e. one which doesn't have '\\' inside) of any other
   // key except HKCR (HKCR has some "deleteable" subkeys)
-  if ( m_strKey.IsEmpty() ||
+  if ( m_strKey.empty() ||
        ((m_hRootKey != (WXHKEY) aStdKeys[HKCR].hkey) &&
         (m_strKey.Find(REG_SEPARATOR) == wxNOT_FOUND)) ) {
       wxLogError(_("Registry key '%s' is needed for normal system operation,\ndeleting it will leave your system in unusable state:\noperation aborted."),
 // exporting registry keys to file
 // ----------------------------------------------------------------------------
 
+#if wxUSE_STREAMS
+
 // helper functions for writing ASCII strings (even in Unicode build)
 static inline bool WriteAsciiChar(wxOutputStream& ostr, char ch)
 {
     return ostr.IsOk();
 }
 
+#endif // wxUSE_STREAMS
+
 bool wxRegKey::Export(const wxString& filename) const
 {
+#if wxUSE_FFILE && wxUSE_STREAMS
     if ( wxFile::Exists(filename) )
     {
         wxLogError(_("Exporting registry key: file \"%s\" already exists and won't be overwritten."),
     wxFFileOutputStream ostr(filename, _T("w"));
 
     return ostr.Ok() && Export(ostr);
+#else
+    wxUnusedVar(filename);
+    return false;
+#endif
 }
 
+#if wxUSE_STREAMS
 bool wxRegKey::Export(wxOutputStream& ostr) const
 {
     // write out the header
 
     return DoExport(ostr);
 }
+#endif // wxUSE_STREAMS
 
 static
 wxString
     return rhs;
 }
 
+#if wxUSE_STREAMS
+
 bool wxRegKey::DoExportValue(wxOutputStream& ostr, const wxString& name) const
 {
     // first examine the value type: if it's unsupported, simply skip it
     return true;
 }
 
+#endif // wxUSE_STREAMS
+
 // ============================================================================
 // implementation of global private functions
 // ============================================================================
 
 void RemoveTrailingSeparator(wxString& str)
 {
-  if ( !str.IsEmpty() && str.Last() == REG_SEPARATOR )
+  if ( !str.empty() && str.Last() == REG_SEPARATOR )
     str.Truncate(str.Len() - 1);
 }
 
 
 
 bool wxIsDebuggerRunning()
 {
+#if wxUSE_DYNLIB_CLASS
     // IsDebuggerPresent() is not available under Win95, so load it dynamically
     wxDynamicLibrary dll(_T("kernel32.dll"), wxDL_VERBATIM);
 
     }
 
     return (*(IsDebuggerPresent_t)dll.GetSymbol(_T("IsDebuggerPresent")))() != 0;
+#else
+    return false;
+#endif
 }
 
 // ----------------------------------------------------------------------------
 
         <install-to>$(BINDIR)</install-to>
     </exe>
 
-    <exe id="tex2rtf_gui" template="wx_util" template_append="wx_append"
-         cond="USE_GUI=='1'">
+    <exe id="tex2rtf_gui" template="wx_util"
+                          template_append="wx_append"
+                          cond="USE_GUI=='1'">
         <sources>$(TEX2RTF_SRC)</sources>
         <wx-lib>html</wx-lib>
         <wx-lib>core</wx-lib>
 
 
 void Tex2RTFYield(bool force)
 {
-#ifdef __WXMSW__
+#ifdef __WINDOWS__
     static int yieldCount = 0;
 
     if (isSync)
         yieldCount = 10;
     }
     yieldCount --;
+#else
+    wxUnusedVar(force);
 #endif
 }