From e4db172a3b318df9aff178eb6c5da149d56e0859 Mon Sep 17 00:00:00 2001
From: =?utf8?q?W=C5=82odzimierz=20Skiba?= <abx@abx.art.pl>
Date: Wed, 26 Apr 2006 08:21:31 +0000
Subject: [PATCH] Include wx/log.h according to precompiled headers of wx/wx.h
 (with other minor cleaning).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38920 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 src/cocoa/combobox.mm                  |   2 +-
 src/common/bmpbase.cpp                 |   8 +-
 src/common/cmndata.cpp                 |   7 +-
 src/common/colourcmn.cpp               |   6 +-
 src/common/config.cpp                  |   2 +-
 src/common/dynlib.cpp                  |  12 +-
 src/common/fileconf.cpp                |   2 +-
 src/common/filefn.cpp                  |   3 +-
 src/common/filesys.cpp                 |  43 ++--
 src/common/gdicmn.cpp                  |   8 +-
 src/common/geometry.cpp                |  13 +-
 src/common/imagpnm.cpp                 |   4 +-
 src/common/log.cpp                     |   5 +-
 src/common/memory.cpp                  |   6 +-
 src/common/mimecmn.cpp                 |   2 +-
 src/common/module.cpp                  |   2 +-
 src/common/msgout.cpp                  |   6 +-
 src/common/socket.cpp                  |   2 +-
 src/common/zstream.cpp                 |   2 +-
 src/generic/buttonbar.cpp              |  22 +-
 src/generic/dcpsg.cpp                  |   2 +-
 src/generic/dirctrlg.cpp               |   2 +-
 src/generic/dragimgg.cpp               |   3 +-
 src/generic/mdig.cpp                   |   6 +-
 src/generic/notebook.cpp               |   2 +-
 src/generic/timer.cpp                  |   9 +-
 src/gtk/app.cpp                        |  12 +-
 src/gtk/clipbrd.cpp                    |  34 ++-
 src/gtk/control.cpp                    |   9 +-
 src/gtk/dataobj.cpp                    |   9 +-
 src/gtk/dataview.cpp                   |  11 +-
 src/gtk/dcclient.cpp                   |   8 +-
 src/gtk/dnd.cpp                        |   2 +-
 src/gtk/font.cpp                       |  10 +-
 src/gtk/gnome/gprint.cpp               |  23 +-
 src/gtk/gnome/gvfs.cpp                 |  15 +-
 src/gtk/listbox.cpp                    |   2 +-
 src/gtk/menu.cpp                       |   2 +-
 src/gtk/notebook.cpp                   |   2 +-
 src/gtk/radiobox.cpp                   |   5 +-
 src/gtk/region.cpp                     |   8 +-
 src/gtk/taskbar.cpp                    |   8 +-
 src/gtk/textctrl.cpp                   |   2 +-
 src/gtk/threadno.cpp                   |   8 +-
 src/gtk/threadsgi.cpp                  |   9 +-
 src/gtk/toplevel.cpp                   |   6 +-
 src/gtk/treegtk.cpp                    |  23 +-
 src/gtk/utilsgtk.cpp                   |   2 +-
 src/gtk/utilsres.cpp                   |   2 +-
 src/gtk/window.cpp                     |   2 +-
 src/gtk1/app.cpp                       |   2 +-
 src/gtk1/clipbrd.cpp                   |  17 +-
 src/gtk1/control.cpp                   |   7 +-
 src/gtk1/dataobj.cpp                   |   9 +-
 src/gtk1/dcclient.cpp                  |   8 +-
 src/gtk1/dnd.cpp                       |   2 +-
 src/gtk1/font.cpp                      |  10 +-
 src/gtk1/menu.cpp                      |   2 +-
 src/gtk1/notebook.cpp                  |   2 +-
 src/gtk1/radiobox.cpp                  |   5 +-
 src/gtk1/region.cpp                    |   9 +-
 src/gtk1/textctrl.cpp                  |   2 +-
 src/gtk1/threadno.cpp                  |  10 +-
 src/gtk1/threadsgi.cpp                 |   8 +-
 src/gtk1/toplevel.cpp                  |   6 +-
 src/gtk1/treegtk.cpp                   |  23 +-
 src/gtk1/utilsgtk.cpp                  |   2 +-
 src/gtk1/utilsres.cpp                  |   2 +-
 src/gtk1/window.cpp                    |   2 +-
 src/html/helpdata.cpp                  |   1 -
 src/html/m_image.cpp                   |   2 +-
 src/html/winpars.cpp                   |   2 +-
 src/mac/carbon/app.cpp                 |   2 +-
 src/mac/carbon/bitmap.cpp              |   8 +-
 src/mac/carbon/cfsocket.cpp            |   2 +-
 src/mac/carbon/clipbrd.cpp             |   2 +-
 src/mac/carbon/dataobj.cpp             |   2 +-
 src/mac/carbon/dc.cpp                  |  30 ++-
 src/mac/carbon/dccg.cpp                |  24 +-
 src/mac/carbon/dcclient.cpp            |  26 +-
 src/mac/carbon/fontdlgosx.mm           |   2 +-
 src/mac/carbon/glcanvas.cpp            |  95 +++----
 src/mac/carbon/listbox.cpp             |   5 +-
 src/mac/carbon/menu.cpp                |  13 +-
 src/mac/carbon/mimetmac.cpp            |   2 +-
 src/mac/carbon/notebmac.cpp            |   2 +-
 src/mac/carbon/sound.cpp               |   2 +-
 src/mac/carbon/window.cpp              |  10 +-
 src/mac/classic/app.cpp                |   2 +-
 src/mac/classic/bitmap.cpp             |   7 +-
 src/mac/classic/clipbrd.cpp            |   2 +-
 src/mac/classic/dataobj.cpp            |   2 +-
 src/mac/classic/dc.cpp                 |  30 ++-
 src/mac/classic/glcanvas.cpp           |  11 +-
 src/mac/classic/listbox.cpp            |   5 +-
 src/mac/classic/mdi.cpp                |  51 ++--
 src/mac/classic/menu.cpp               |  18 +-
 src/mac/classic/mimetmac.cpp           |   2 +-
 src/mac/classic/notebmac.cpp           |   2 +-
 src/mac/classic/utilsexc.cpp           |  42 +--
 src/mac/classic/window.cpp             |   8 +-
 src/mac/corefoundation/hid.cpp         |   2 +-
 src/mac/corefoundation/hidjoystick.cpp | 342 ++++++++++++++++---------
 src/mgl/bitmap.cpp                     |   2 +-
 src/mgl/cursor.cpp                     |   2 +-
 src/mgl/dc.cpp                         |   2 +-
 src/mgl/font.cpp                       |   8 +-
 src/mgl/fontutil.cpp                   |   2 +-
 src/mgl/utils.cpp                      |   2 +-
 src/mgl/window.cpp                     |   2 +-
 src/motif/app.cpp                      |   2 +-
 src/motif/dcclient.cpp                 |   6 +-
 src/motif/dnd.cpp                      |   2 +-
 src/motif/frame.cpp                    |   6 +-
 src/motif/listbox.cpp                  |   5 +-
 src/motif/menu.cpp                     |   6 +-
 src/motif/window.cpp                   |   2 +-
 src/msdos/mimetype.cpp                 |   2 +-
 src/msdos/utilsdos.cpp                 |   2 +-
 src/msw/bitmap.cpp                     |   2 +-
 src/msw/clipbrd.cpp                    |   8 +-
 src/msw/dcclient.cpp                   |   2 +-
 src/msw/dialog.cpp                     |   1 -
 src/msw/dragimag.cpp                   |   2 +-
 src/msw/fontdlg.cpp                    |   2 +-
 src/msw/frame.cpp                      |   2 +-
 src/msw/imaglist.cpp                   |   2 +-
 src/msw/iniconf.cpp                    |   2 +-
 src/msw/listbox.cpp                    |   3 +-
 src/msw/mediactrl.cpp                  |  21 +-
 src/msw/mediactrl_am.cpp               |  21 +-
 src/msw/mediactrl_wmp10.cpp            |  19 +-
 src/msw/menuitem.cpp                   |   9 +-
 src/msw/mimetype.cpp                   |   2 +-
 src/msw/notebook.cpp                   |  18 +-
 src/msw/ole/access.cpp                 |  12 +-
 src/msw/ole/automtn.cpp                |   7 +-
 src/msw/ole/dropsrc.cpp                |   8 +-
 src/msw/ole/droptgt.cpp                |  10 +-
 src/msw/ole/oleutils.cpp               |   8 +-
 src/msw/printwin.cpp                   |   2 +-
 src/msw/regconf.cpp                    |  32 +--
 src/msw/registry.cpp                   |   2 +-
 src/msw/statbr95.cpp                   |   3 +-
 src/msw/treectrl.cpp                   |   5 +-
 src/msw/window.cpp                     |   7 +-
 src/os2/app.cpp                        |   5 +-
 src/os2/bitmap.cpp                     |   5 +-
 src/os2/checklst.cpp                   |   5 +-
 src/os2/clipbrd.cpp                    |   6 +-
 src/os2/dcclient.cpp                   |   2 +-
 src/os2/dcprint.cpp                    |   2 +-
 src/os2/dialog.cpp                     |  16 +-
 src/os2/evtloop.cpp                    |  51 ++--
 src/os2/frame.cpp                      |   1 -
 src/os2/iniconf.cpp                    |   3 +-
 src/os2/listbox.cpp                    |   6 +-
 src/os2/menuitem.cpp                   |   8 +-
 src/os2/mimetype.cpp                   |   2 +-
 src/os2/notebook.cpp                   |  13 +-
 src/os2/statline.cpp                   |   9 +-
 src/os2/thread.cpp                     |   2 +-
 src/os2/timer.cpp                      |   2 +-
 src/os2/treectrl.cpp                   |   5 +-
 src/os2/utils.cpp                      |  27 +-
 src/os2/utilsexc.cpp                   |   3 +-
 src/os2/window.cpp                     |   7 +-
 src/palmos/bitmap.cpp                  |   6 +-
 src/palmos/clipbrd.cpp                 |   6 +-
 src/palmos/dcclient.cpp                |   2 +-
 src/palmos/dialog.cpp                  |   4 +-
 src/palmos/dragimag.cpp                |   2 +-
 src/palmos/fontdlg.cpp                 |   5 +-
 src/palmos/frame.cpp                   |   5 +-
 src/palmos/imaglist.cpp                |   3 +-
 src/palmos/listbox.cpp                 |   6 +-
 src/palmos/menuitem.cpp                |   5 +-
 src/palmos/printpalm.cpp               |   2 +-
 src/palmos/statbrpalm.cpp              |   3 +-
 src/palmos/statline.cpp                |   8 +-
 src/palmos/treectrl.cpp                |   4 +-
 src/palmos/window.cpp                  |   7 +-
 src/univ/ctrlrend.cpp                  |   6 +-
 src/univ/scrolbar.cpp                  |   6 +-
 src/univ/toolbar.cpp                   |  16 +-
 src/univ/winuniv.cpp                   |   8 +-
 src/unix/dialup.cpp                    |   2 +-
 src/unix/displayx11.cpp                |   2 +-
 src/unix/mediactrl.cpp                 |  21 +-
 src/unix/mimetype.cpp                  |   2 +-
 src/unix/taskbarx11.cpp                |   6 +-
 src/unix/threadpsx.cpp                 |   2 +-
 src/unix/utilsunx.cpp                  |   2 +-
 src/unix/utilsx11.cpp                  |   6 +-
 src/x11/app.cpp                        |   3 +-
 src/x11/bitmap.cpp                     |   6 +-
 src/x11/clipbrd.cpp                    |  81 +++---
 src/x11/dataobj.cpp                    |   6 +-
 src/x11/dnd.cpp                        |   2 +-
 src/x11/glcanvas.cpp                   |   6 +-
 src/x11/popupwin.cpp                   |   7 +-
 src/x11/region.cpp                     |   6 +-
 src/x11/reparent.cpp                   |   8 +-
 src/x11/textctrl.cpp                   |   2 +-
 src/x11/window.cpp                     |  12 +-
 src/xml/xml.cpp                        |   2 +-
 src/xrc/xh_chckl.cpp                   |   2 +-
 src/xrc/xh_choicbk.cpp                 |   5 +-
 src/xrc/xh_dlg.cpp                     |   2 +-
 src/xrc/xh_frame.cpp                   |   2 +-
 src/xrc/xh_listbk.cpp                  |   5 +-
 src/xrc/xh_mdi.cpp                     |   2 +-
 src/xrc/xh_notbk.cpp                   |   5 +-
 src/xrc/xh_sizer.cpp                   |   6 +-
 src/xrc/xh_split.cpp                   |   6 +-
 src/xrc/xh_statbar.cpp                 |   3 +-
 src/xrc/xh_treebk.cpp                  |   5 +-
 src/xrc/xh_unkwn.cpp                   |   8 +-
 src/xrc/xh_wizrd.cpp                   |   8 +-
 src/xrc/xmlres.cpp                     |   2 +-
 220 files changed, 1184 insertions(+), 891 deletions(-)

diff --git a/src/cocoa/combobox.mm b/src/cocoa/combobox.mm
index fcfed2c0a5..47619d7d27 100644
--- a/src/cocoa/combobox.mm
+++ b/src/cocoa/combobox.mm
@@ -80,6 +80,7 @@
 
 #ifndef WX_PRECOMP
     #include "wx/window.h"
+    #include "wx/log.h"
 #endif // WX_PRECOMP
 
 #include "wx/cocoa/ObjcPose.h"
@@ -160,7 +161,6 @@ void wxCocoaNSComboBox::DisassociateNSComboBox(WX_NSComboBox cocoaNSComboBox)
 
 #include "wx/app.h"
 #include "wx/combobox.h"
-#include "wx/log.h"
 
 #include "wx/cocoa/autorelease.h"
 #include "wx/cocoa/string.h"
diff --git a/src/common/bmpbase.cpp b/src/common/bmpbase.cpp
index 1090664724..af1e4c3450 100644
--- a/src/common/bmpbase.cpp
+++ b/src/common/bmpbase.cpp
@@ -21,11 +21,15 @@
     defined(__WXMOTIF__) || \
     defined(__WXX11__)
 
+#include "wx/bitmap.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif // WX_PRECOMP
+
 #include "wx/utils.h"
 #include "wx/palette.h"
-#include "wx/bitmap.h"
 #include "wx/icon.h"
-#include "wx/log.h"
 #include "wx/image.h"
 #include "wx/module.h"
 
diff --git a/src/common/cmndata.cpp b/src/common/cmndata.cpp
index c7b4dbf77b..1e3ca85951 100644
--- a/src/common/cmndata.cpp
+++ b/src/common/cmndata.cpp
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        cmndata.cpp
+// Name:        src/common/cmndata.cpp
 // Purpose:     Common GDI data
 // Author:      Julian Smart
 // Modified by:
@@ -24,16 +24,17 @@
     #pragma hdrstop
 #endif
 
+#include "wx/cmndata.h"
+
 #ifndef WX_PRECOMP
     #include <stdio.h>
     #include "wx/string.h"
     #include "wx/utils.h"
     #include "wx/app.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/gdicmn.h"
-#include "wx/cmndata.h"
-#include "wx/log.h"
 #include "wx/prntbase.h"
 #include "wx/printdlg.h"
 
diff --git a/src/common/colourcmn.cpp b/src/common/colourcmn.cpp
index efd9cad890..4c7d7c088f 100644
--- a/src/common/colourcmn.cpp
+++ b/src/common/colourcmn.cpp
@@ -19,9 +19,11 @@
 
 #include "wx/colour.h"
 
-#include "wx/gdicmn.h"
-#include "wx/log.h"
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
 
+#include "wx/gdicmn.h"
 
 
 // ============================================================================
diff --git a/src/common/config.cpp b/src/common/config.cpp
index 62c14b2414..0e176f4f89 100644
--- a/src/common/config.cpp
+++ b/src/common/config.cpp
@@ -28,9 +28,9 @@
 
 #ifndef WX_PRECOMP
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif //WX_PRECOMP
 
-#include "wx/log.h"
 #include "wx/arrstr.h"
 
 #if wxUSE_CONFIG && ((wxUSE_FILE && wxUSE_TEXTFILE) || wxUSE_CONFIG_NATIVE)
diff --git a/src/common/dynlib.cpp b/src/common/dynlib.cpp
index e51fbcf72b..099ac32589 100644
--- a/src/common/dynlib.cpp
+++ b/src/common/dynlib.cpp
@@ -24,15 +24,19 @@
 #include  "wx/wxprec.h"
 
 #ifdef __BORLANDC__
-  #pragma hdrstop
+    #pragma hdrstop
 #endif
 
 #if wxUSE_DYNLIB_CLASS
 
 #include "wx/dynlib.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/intl.h"
+    #include "wx/log.h"
+#endif //WX_PRECOMP
+
 #include "wx/filefn.h"
-#include "wx/intl.h"
-#include "wx/log.h"
 #include "wx/utils.h"
 #include "wx/filename.h"        // for SplitPath()
 #include "wx/app.h"
@@ -245,7 +249,7 @@ wxString wxDynamicLibrary::CanonicalizePluginName(const wxString& name,
     {
         wxAppTraits *traits = wxAppConsole::GetInstance() ?
                               wxAppConsole::GetInstance()->GetTraits() : NULL;
-        wxCHECK_MSG( traits, _T(""),
+        wxCHECK_MSG( traits, wxEmptyString,
                      _("can't query for GUI plugins name in console applications") );
         suffix = traits->GetToolkitInfo().shortName;
     }
diff --git a/src/common/fileconf.cpp b/src/common/fileconf.cpp
index 2e4468252f..983212f6cb 100644
--- a/src/common/fileconf.cpp
+++ b/src/common/fileconf.cpp
@@ -27,11 +27,11 @@
     #include  "wx/dynarray.h"
     #include  "wx/string.h"
     #include  "wx/intl.h"
+    #include  "wx/log.h"
 #endif  //WX_PRECOMP
 
 #include  "wx/app.h"
 #include  "wx/file.h"
-#include  "wx/log.h"
 #include  "wx/textfile.h"
 #include  "wx/memtext.h"
 #include  "wx/config.h"
diff --git a/src/common/filefn.cpp b/src/common/filefn.cpp
index 81f3e18eb1..4403c83db9 100644
--- a/src/common/filefn.cpp
+++ b/src/common/filefn.cpp
@@ -26,6 +26,7 @@
 
 #ifndef WX_PRECOMP
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/utils.h"
@@ -52,8 +53,6 @@
     #include  "wx/mac/private.h"  // includes mac headers
 #endif
 
-#include "wx/log.h"
-
 #ifdef __WINDOWS__
     #include "wx/msw/private.h"
     #include "wx/msw/mslu.h"
diff --git a/src/common/filesys.cpp b/src/common/filesys.cpp
index e06b3d8077..65cc39f1c0 100644
--- a/src/common/filesys.cpp
+++ b/src/common/filesys.cpp
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        filesys.cpp
+// Name:        src/common/filesys.cpp
 // Purpose:     wxFileSystem class - interface for opening files
 // Author:      Vaclav Slavik
 // Copyright:   (c) 1999 Vaclav Slavik
@@ -10,18 +10,22 @@
 #include "wx/wxprec.h"
 
 #ifdef __BORLANDC__
-#pragma hdrstop
+    #pragma hdrstop
 #endif
 
 
 #if wxUSE_FILESYSTEM
 
+#include "wx/filesys.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/wfstream.h"
 #include "wx/module.h"
-#include "wx/filesys.h"
 #include "wx/mimetype.h"
 #include "wx/filename.h"
-#include "wx/log.h"
 
 
 //--------------------------------------------------------------------------------
@@ -36,7 +40,7 @@ wxString wxFileSystemHandler::GetMimeTypeFromExt(const wxString& location)
     wxString ext, mime;
     wxString loc = GetRightLocation(location);
     wxChar c;
-    int l = loc.Length(), l2;
+    int l = loc.length(), l2;
 
     l2 = l;
     for (int i = l-1; i >= 0; i--)
@@ -120,7 +124,7 @@ wxString wxFileSystemHandler::GetMimeTypeFromExt(const wxString& location)
 wxString wxFileSystemHandler::GetProtocol(const wxString& location) const
 {
     wxString s = wxEmptyString;
-    int i, l = location.Length();
+    int i, l = location.length();
     bool fnd = false;
 
     for (i = l-1; (i >= 0) && ((location[i] != wxT('#')) || (!fnd)); i--) {
@@ -137,7 +141,7 @@ wxString wxFileSystemHandler::GetLeftLocation(const wxString& location) const
     int i;
     bool fnd = false;
 
-    for (i = location.Length()-1; i >= 0; i--) {
+    for (i = location.length()-1; i >= 0; i--) {
         if ((location[i] == wxT(':')) && (i != 1 /*win: C:\path*/)) fnd = true;
         else if (fnd && (location[i] == wxT('#'))) return location.Left(i);
     }
@@ -146,7 +150,7 @@ wxString wxFileSystemHandler::GetLeftLocation(const wxString& location) const
 
 wxString wxFileSystemHandler::GetRightLocation(const wxString& location) const
 {
-    int i, l = location.Length();
+    int i, l = location.length();
     int l2 = l + 1;
 
     for (i = l-1;
@@ -163,7 +167,7 @@ wxString wxFileSystemHandler::GetRightLocation(const wxString& location) const
 wxString wxFileSystemHandler::GetAnchor(const wxString& location) const
 {
     wxChar c;
-    int l = location.Length();
+    int l = location.length();
 
     for (int i = l-1; i >= 0; i--) {
         c = location[i];
@@ -256,7 +260,7 @@ static wxString MakeCorrectPath(const wxString& path)
     wxString r;
     int i, j, cnt;
 
-    cnt = p.Length();
+    cnt = p.length();
     for (i = 0; i < cnt; i++)
       if (p.GetChar(i) == wxT('\\')) p.GetWritableChar(i) = wxT('/'); // Want to be windows-safe
 
@@ -275,7 +279,7 @@ static wxString MakeCorrectPath(const wxString& path)
         r << p.GetChar(i);
         if (p.GetChar(i) == wxT('/') && p.GetChar(i-1) == wxT('.') && p.GetChar(i-2) == wxT('.'))
         {
-            for (j = r.Length() - 2; j >= 0 && r.GetChar(j) != wxT('/') && r.GetChar(j) != wxT(':'); j--) {}
+            for (j = r.length() - 2; j >= 0 && r.GetChar(j) != wxT('/') && r.GetChar(j) != wxT(':'); j--) {}
             if (j >= 0 && r.GetChar(j) != wxT(':'))
             {
                 for (j = j - 1; j >= 0 && r.GetChar(j) != wxT('/') && r.GetChar(j) != wxT(':'); j--) {}
@@ -298,13 +302,13 @@ void wxFileSystem::ChangePathTo(const wxString& location, bool is_dir)
 
     if (is_dir)
     {
-        if (m_Path.Length() > 0 && m_Path.Last() != wxT('/') && m_Path.Last() != wxT(':'))
+        if (m_Path.length() > 0 && m_Path.Last() != wxT('/') && m_Path.Last() != wxT(':'))
             m_Path << wxT('/');
     }
 
     else
     {
-        for (i = m_Path.Length()-1; i >= 0; i--)
+        for (i = m_Path.length()-1; i >= 0; i--)
         {
             if (m_Path[(unsigned int) i] == wxT('/'))
             {
@@ -326,7 +330,7 @@ void wxFileSystem::ChangePathTo(const wxString& location, bool is_dir)
         }
         if (pathpos == -1)
         {
-            for (i = 0; i < (int) m_Path.Length(); i++)
+            for (i = 0; i < (int) m_Path.length(); i++)
             {
                 if (m_Path[(unsigned int) i] == wxT(':'))
                 {
@@ -334,7 +338,7 @@ void wxFileSystem::ChangePathTo(const wxString& location, bool is_dir)
                     break;
                 }
             }
-            if (i == (int) m_Path.Length())
+            if (i == (int) m_Path.length())
                 m_Path = wxEmptyString;
         }
         else
@@ -354,7 +358,7 @@ wxFSFile* wxFileSystem::OpenFile(const wxString& location)
     wxFSFile *s = NULL;
     wxList::compatibility_iterator node;
 
-    ln = loc.Length();
+    ln = loc.length();
     meta = 0;
     for (i = 0; i < ln; i++)
     {
@@ -411,7 +415,7 @@ wxString wxFileSystem::FindFirst(const wxString& spec, int flags)
 
     m_FindFileHandler = NULL;
 
-    for (int i = spec2.Length()-1; i >= 0; i--)
+    for (int i = spec2.length()-1; i >= 0; i--)
         if (spec2[(unsigned int) i] == wxT('\\')) spec2.GetWritableChar(i) = wxT('/'); // Want to be windows-safe
 
     node = m_Handlers.GetFirst();
@@ -491,7 +495,7 @@ wxFileName wxFileSystem::URLToFileName(const wxString& url)
     }
     else if ( (url.Find(wxT("file://")) == 0) &&
               (path.Find(wxT('/')) != wxNOT_FOUND) &&
-              (path.Length() > 1) && (path[1u] != wxT(':')) )
+              (path.length() > 1) && (path[1u] != wxT(':')) )
     {
         path = wxT("//") + path;
     }
@@ -555,6 +559,3 @@ IMPLEMENT_DYNAMIC_CLASS(wxFileSystemModule, wxModule)
 
 #endif
   // wxUSE_FILESYSTEM
-
-
-
diff --git a/src/common/gdicmn.cpp b/src/common/gdicmn.cpp
index f1521cac76..d04a4b4f42 100644
--- a/src/common/gdicmn.cpp
+++ b/src/common/gdicmn.cpp
@@ -20,8 +20,13 @@
 #pragma hdrstop
 #endif
 
-#include "wx/event.h"
 #include "wx/gdicmn.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
+#include "wx/event.h"
 #include "wx/brush.h"
 #include "wx/pen.h"
 #include "wx/bitmap.h"
@@ -35,7 +40,6 @@
 #include "wx/settings.h"
 #include "wx/hashmap.h"
 
-#include "wx/log.h"
 #include <string.h>
 
 #ifdef __WXMOTIF__
diff --git a/src/common/geometry.cpp b/src/common/geometry.cpp
index db4ff7c671..362b1aee50 100644
--- a/src/common/geometry.cpp
+++ b/src/common/geometry.cpp
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        common/geometry.cpp
+// Name:        src/common/geometry.cpp
 // Purpose:     Common Geometry Classes
 // Author:      Stefan Csomor
 // Modified by:
@@ -12,17 +12,20 @@
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
-
 #ifdef __BORLANDC__
-#pragma hdrstop
+    #pragma hdrstop
 #endif
 
 #if wxUSE_GEOMETRY
 
-#include "wx/log.h"
+#include "wx/geometry.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include <string.h>
 
-#include "wx/geometry.h"
 #include "wx/datstrm.h"
 
 //
diff --git a/src/common/imagpnm.cpp b/src/common/imagpnm.cpp
index 15b611ee64..4c1a6205c9 100644
--- a/src/common/imagpnm.cpp
+++ b/src/common/imagpnm.cpp
@@ -20,9 +20,9 @@
 
 #ifndef WX_PRECOMP
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
-#include "wx/log.h"
 #include "wx/txtstrm.h"
 
 //-----------------------------------------------------------------------------
@@ -184,4 +184,4 @@ bool wxPNMHandler::DoCanRead( wxInputStream& stream )
 
 #endif // wxUSE_STREAMS
 
-#endif // wxUSE_PNM
+#endif // wxUSE_IMAGE && wxUSE_PNM
diff --git a/src/common/log.cpp b/src/common/log.cpp
index 252c6b09bb..d7a7e7e895 100644
--- a/src/common/log.cpp
+++ b/src/common/log.cpp
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        log.cpp
+// Name:        src/common/log.cpp
 // Purpose:     Assorted wxLogXXX functions, and wxLog (sink for logs)
 // Author:      Vadim Zeitlin
 // Modified by:
@@ -28,6 +28,7 @@
 
 // wxWidgets
 #ifndef WX_PRECOMP
+    #include "wx/log.h"
     #include "wx/app.h"
     #include "wx/arrstr.h"
     #include "wx/intl.h"
@@ -36,7 +37,6 @@
 
 #include "wx/apptrait.h"
 #include "wx/file.h"
-#include "wx/log.h"
 #include "wx/msgout.h"
 #include "wx/textfile.h"
 #include "wx/thread.h"
@@ -833,4 +833,3 @@ const wxChar *wxSysErrorMsg(unsigned long nErrCode)
 }
 
 #endif // wxUSE_LOG
-
diff --git a/src/common/memory.cpp b/src/common/memory.cpp
index 7c062d71a7..acd63dcde9 100644
--- a/src/common/memory.cpp
+++ b/src/common/memory.cpp
@@ -18,17 +18,19 @@
 
 #if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
 
+#include "wx/memory.h"
+
 #ifndef WX_PRECOMP
     #include "wx/utils.h"
     #include "wx/app.h"
     #include "wx/hash.h"
+    #include "wx/log.h"
 #endif
 
 #if wxUSE_THREADS
     #include "wx/thread.h"
 #endif
 
-#include "wx/log.h"
 #include <stdlib.h>
 
 #include "wx/ioswrap.h"
@@ -54,8 +56,6 @@
 
 #endif
 
-#include "wx/memory.h"
-
 #if wxUSE_THREADS && defined(__WXDEBUG__)
 #define USE_THREADSAFE_MEMORY_ALLOCATION 1
 #else
diff --git a/src/common/mimecmn.cpp b/src/common/mimecmn.cpp
index 44f0fbe108..27d4b8d429 100644
--- a/src/common/mimecmn.cpp
+++ b/src/common/mimecmn.cpp
@@ -33,10 +33,10 @@
     #include "wx/dynarray.h"
     #include "wx/string.h"
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif //WX_PRECOMP
 
 #include "wx/module.h"
-#include "wx/log.h"
 #include "wx/file.h"
 #include "wx/iconloc.h"
 #include "wx/confbase.h"
diff --git a/src/common/module.cpp b/src/common/module.cpp
index aebe228545..961d478d93 100644
--- a/src/common/module.cpp
+++ b/src/common/module.cpp
@@ -21,9 +21,9 @@
 #ifndef WX_PRECOMP
     #include "wx/hash.h"
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
-#include "wx/log.h"
 #include "wx/listimpl.cpp"
 
 #define TRACE_MODULE _T("module")
diff --git a/src/common/msgout.cpp b/src/common/msgout.cpp
index b0c10d92b3..2ed2037f4c 100755
--- a/src/common/msgout.cpp
+++ b/src/common/msgout.cpp
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        common/msgout.cpp
+// Name:        src/common/msgout.cpp
 // Purpose:     wxMessageOutput implementation
 // Author:      Mattia Barbon
 // Modified by:
@@ -29,6 +29,7 @@
     #include "wx/ffile.h"
     #include "wx/app.h"
     #include "wx/intl.h"
+    #include "wx/log.h"
     #if wxUSE_GUI
         #include "wx/msgdlg.h"
     #endif // wxUSE_GUI
@@ -36,8 +37,6 @@
 
 #include "wx/msgout.h"
 #include "wx/apptrait.h"
-#include "wx/log.h"
-
 #include <stdarg.h>
 #include <stdio.h>
 
@@ -221,4 +220,3 @@ void wxMessageOutputMessageBox::Printf(const wxChar* format, ...)
 }
 
 #endif // wxUSE_GUI
-
diff --git a/src/common/socket.cpp b/src/common/socket.cpp
index 65eb47d404..43a51d19a1 100644
--- a/src/common/socket.cpp
+++ b/src/common/socket.cpp
@@ -28,6 +28,7 @@
     #include "wx/object.h"
     #include "wx/string.h"
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/app.h"
@@ -35,7 +36,6 @@
 #include "wx/timer.h"
 #include "wx/utils.h"
 #include "wx/module.h"
-#include "wx/log.h"
 #include "wx/event.h"
 
 #include "wx/sckaddr.h"
diff --git a/src/common/zstream.cpp b/src/common/zstream.cpp
index f3b4ffc4dd..3dc3214091 100644
--- a/src/common/zstream.cpp
+++ b/src/common/zstream.cpp
@@ -22,10 +22,10 @@
 
 #ifndef WX_PRECOMP
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/utils.h"
-#include "wx/log.h"
 
 // normally, the compiler options should contain -I../zlib, but it is
 // apparently not the case for all MSW makefiles and so, unless we use
diff --git a/src/generic/buttonbar.cpp b/src/generic/buttonbar.cpp
index c0f98169c9..b03090fb68 100644
--- a/src/generic/buttonbar.cpp
+++ b/src/generic/buttonbar.cpp
@@ -6,7 +6,7 @@
 // Created:     2006-04-13
 // Id:          $Id$
 // Copyright:   (c) Julian Smart, Robert Roebling, Vadim Zeitlin,
-//              SciTech Software, Inc. 
+//              SciTech Software, Inc.
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
@@ -28,15 +28,16 @@
 // Currently, only for Mac as a toolbar replacement.
 #if defined(__WXMAC__) && wxUSE_TOOLBAR && wxUSE_BMPBUTTON
 
+#include "wx/generic/buttonbar.h"
+
 #ifndef WX_PRECOMP
     #include "wx/utils.h"
     #include "wx/app.h"
+    #include "wx/log.h"
 #endif
 
-#include "wx/generic/buttonbar.h"
 #include "wx/frame.h"
 #include "wx/image.h"
-#include "wx/log.h"
 #include "wx/settings.h"
 #include "wx/dcclient.h"
 
@@ -62,7 +63,7 @@ public:
         m_x = m_y = wxDefaultCoord;
         m_width =
         m_height = 0;
-        
+
         m_button = NULL;
     }
 
@@ -118,7 +119,7 @@ void wxButtonToolBar::Init()
 
     m_labelMargin = 2;
     m_labelHeight = 0;
-    
+
     SetMargins(8, 2);
     SetToolPacking(8);
 }
@@ -347,10 +348,10 @@ bool wxButtonToolBar::Realize()
 {
     if ( !wxToolBarBase::Realize() )
         return false;
-    
+
     m_needsLayout = true;
     DoLayout();
-    
+
     SetBestSize(wxSize(m_maxWidth, m_maxHeight));
 
     return true;
@@ -378,7 +379,7 @@ void wxButtonToolBar::DoLayout()
 
         tool->m_x = x;
         tool->m_y = y;
-        
+
         if (tool->IsButton())
         {
             if (!tool->GetButton())
@@ -387,14 +388,14 @@ void wxButtonToolBar::DoLayout()
                                                                wxBU_AUTODRAW|wxBORDER_NONE);
                 if (!tool->GetShortHelp().IsEmpty())
                     bmpButton->SetLabel(tool->GetShortHelp());
-                
+
                 tool->SetButton(bmpButton);
             }
             else
             {
                 tool->GetButton()->Move(wxPoint(tool->m_x, tool->m_y));
             }
-            
+
             int w = widthTool;
             if (tool->GetButton())
             {
@@ -553,4 +554,3 @@ void wxButtonToolBar::OnLeftUp(wxMouseEvent& event)
 }
 
 #endif // wxUSE_TOOLBAR && wxUSE_BMPBUTTON
-
diff --git a/src/generic/dcpsg.cpp b/src/generic/dcpsg.cpp
index 86d9c8ac68..a0617a7b5c 100644
--- a/src/generic/dcpsg.cpp
+++ b/src/generic/dcpsg.cpp
@@ -21,13 +21,13 @@
 
 #ifndef WX_PRECOMP
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif // WX_PRECOMP
 
 #include "wx/dcmemory.h"
 #include "wx/utils.h"
 #include "wx/app.h"
 #include "wx/image.h"
-#include "wx/log.h"
 #include "wx/prntbase.h"
 #include "wx/generic/prntdlgg.h"
 #include "wx/paper.h"
diff --git a/src/generic/dirctrlg.cpp b/src/generic/dirctrlg.cpp
index eeef7d9129..a29d5809e4 100644
--- a/src/generic/dirctrlg.cpp
+++ b/src/generic/dirctrlg.cpp
@@ -23,6 +23,7 @@
 #ifndef WX_PRECOMP
     #include "wx/hash.h"
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/module.h"
@@ -37,7 +38,6 @@
 #include "wx/gdicmn.h"
 #include "wx/imaglist.h"
 #include "wx/icon.h"
-#include "wx/log.h"
 #include "wx/sizer.h"
 #include "wx/tokenzr.h"
 #include "wx/dir.h"
diff --git a/src/generic/dragimgg.cpp b/src/generic/dragimgg.cpp
index f171e14767..b40140c453 100644
--- a/src/generic/dragimgg.cpp
+++ b/src/generic/dragimgg.cpp
@@ -35,10 +35,9 @@
     #include "wx/dcmemory.h"
     #include "wx/settings.h"
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
-#include "wx/log.h"
-
 #define wxUSE_IMAGE_IN_DRAGIMAGE 1
 
 #if wxUSE_IMAGE_IN_DRAGIMAGE
diff --git a/src/generic/mdig.cpp b/src/generic/mdig.cpp
index b1e79b5969..4f002030ea 100644
--- a/src/generic/mdig.cpp
+++ b/src/generic/mdig.cpp
@@ -24,13 +24,15 @@
     #pragma hdrstop
 #endif
 
+#include "wx/generic/mdig.h"
+
 #ifndef WX_PRECOMP
     #include "wx/panel.h"
     #include "wx/menu.h"
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif //WX_PRECOMP
 
-#include "wx/generic/mdig.h"
 #include "wx/stockitem.h"
 
 enum MDI_MENU_ID
@@ -399,7 +401,6 @@ wxGenericMDIChildFrame::wxGenericMDIChildFrame( wxGenericMDIParentFrame *parent,
     Create( parent, id, title, wxDefaultPosition, size, style, name );
 }
 
-#include "wx/log.h"
 wxGenericMDIChildFrame::~wxGenericMDIChildFrame()
 {
     wxGenericMDIParentFrame *pParentFrame = GetMDIParentFrame();
@@ -812,4 +813,3 @@ IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame, wxGenericMDIChildFrame)
 IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxGenericMDIClientWindow)
 
 #endif
-
diff --git a/src/generic/notebook.cpp b/src/generic/notebook.cpp
index 8eab2fc19d..c5e67adbe2 100644
--- a/src/generic/notebook.cpp
+++ b/src/generic/notebook.cpp
@@ -30,9 +30,9 @@
 
 #ifndef WX_PRECOMP
     #include "wx/string.h"
+    #include "wx/log.h"
 #endif
 
-#include  "wx/log.h"
 #include  "wx/settings.h"
 #include  "wx/generic/imaglist.h"
 #include  "wx/dcclient.h"
diff --git a/src/generic/timer.cpp b/src/generic/timer.cpp
index a67016706f..92b513ef35 100644
--- a/src/generic/timer.cpp
+++ b/src/generic/timer.cpp
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        mgl/timer.cpp
+// Name:        src/generic/timer.cpp
 // Purpose:     wxTimer implementation
 // Author:      Vaclav Slavik
 // Id:          $Id$
@@ -20,11 +20,14 @@
 //     is in wxEventLoop::Dispatch().
 // ----------------------------------------------------------------------------
 
+#if wxUSE_TIMER
+
 #include "wx/timer.h"
 
-#if wxUSE_TIMER
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
 
-#include "wx/log.h"
 #include "wx/module.h"
 
 // ----------------------------------------------------------------------------
diff --git a/src/gtk/app.cpp b/src/gtk/app.cpp
index aeeb7ee8c0..d7eb518add 100644
--- a/src/gtk/app.cpp
+++ b/src/gtk/app.cpp
@@ -20,11 +20,11 @@
 
 #ifndef WX_PRECOMP
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/gdicmn.h"
 #include "wx/utils.h"
-#include "wx/log.h"
 #include "wx/memory.h"
 #include "wx/font.h"
 #include "wx/settings.h"
@@ -257,7 +257,7 @@ static gint wxapp_idle_callback( gpointer WXUNUSED(data) )
 #if wxUSE_THREADS
         wxMutexLocker lock(gs_idleTagsMutex);
 #endif
-        g_isIdle = TRUE;
+        g_isIdle = true;
         wxTheApp->m_idleTag = 0;
     }
 
@@ -348,7 +348,7 @@ static gint wxapp_poll_func( GPollFD *ufds, guint nfds, gint timeout )
     gdk_threads_enter();
 
     wxMutexGuiLeave();
-    g_mainThreadLocked = TRUE;
+    g_mainThreadLocked = true;
 
     // we rely on the fact that glib GPollFD struct is really just pollfd but
     // I wonder how wise is this in the long term (VZ)
@@ -428,7 +428,7 @@ wxApp::wxApp()
 #endif // __WXDEBUG__
 
     m_idleTag = 0;
-    g_isIdle = TRUE;
+    g_isIdle = true;
     wxapp_install_idle_handler();
 
 #if wxUSE_THREADS
@@ -664,7 +664,7 @@ bool wxApp::Initialize(int& argc, wxChar **argv)
         return false;
     }
 
-    wxSetDetectableAutoRepeat( TRUE );
+    wxSetDetectableAutoRepeat( true );
 
 #if wxUSE_INTL
     wxFont::SetDefaultEncoding(wxLocale::GetSystemEncoding());
@@ -702,6 +702,6 @@ void wxApp::RemoveIdleTag()
     {
         g_source_remove( wxTheApp->m_idleTag );
         wxTheApp->m_idleTag = 0;
-        g_isIdle = TRUE;
+        g_isIdle = true;
     }
 }
diff --git a/src/gtk/clipbrd.cpp b/src/gtk/clipbrd.cpp
index cca926b36a..228ecfcf59 100644
--- a/src/gtk/clipbrd.cpp
+++ b/src/gtk/clipbrd.cpp
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        gtk/clipbrd.cpp
+// Name:        src/gtk/clipbrd.cpp
 // Purpose:
 // Author:      Robert Roebling
 // Id:          $Id$
@@ -10,23 +10,19 @@
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
+#if wxUSE_CLIPBOARD
+
 #include "wx/clipbrd.h"
 
-#if wxUSE_CLIPBOARD
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
 
 #include "wx/dataobj.h"
 #include "wx/utils.h"
-#include "wx/log.h"
 
 #include "wx/gtk/private.h"
 
-//-----------------------------------------------------------------------------
-// thread system
-//-----------------------------------------------------------------------------
-
-#if wxUSE_THREADS
-#endif
-
 //-----------------------------------------------------------------------------
 // data
 //-----------------------------------------------------------------------------
@@ -120,8 +116,8 @@ targets_selection_received( GtkWidget *WXUNUSED(widget),
 
             if (format == clipboard->m_targetRequested)
             {
-                clipboard->m_waiting = FALSE;
-                clipboard->m_formatSupported = TRUE;
+                clipboard->m_waiting = false;
+                clipboard->m_formatSupported = true;
                 return;
             }
         }
@@ -184,7 +180,7 @@ selection_received( GtkWidget *WXUNUSED(widget),
 
     data_object->SetData( format, (size_t) selection_data->length, (const char*) selection_data->data );
 
-    wxTheClipboard->m_formatSupported = TRUE;
+    wxTheClipboard->m_formatSupported = true;
     clipboard->m_waiting = FALSE;
 }
 }
@@ -197,20 +193,20 @@ extern "C" {
 static gint
 selection_clear_clip( GtkWidget *WXUNUSED(widget), GdkEventSelection *event )
 {
-    if (!wxTheClipboard) return TRUE;
+    if (!wxTheClipboard) return true;
 
     if (event->selection == GDK_SELECTION_PRIMARY)
     {
-        wxTheClipboard->m_ownsPrimarySelection = FALSE;
+        wxTheClipboard->m_ownsPrimarySelection = false;
     }
     else
     if (event->selection == g_clipboardAtom)
     {
-        wxTheClipboard->m_ownsClipboard = FALSE;
+        wxTheClipboard->m_ownsClipboard = false;
     }
     else
     {
-        wxTheClipboard->m_waiting = FALSE;
+        wxTheClipboard->m_waiting = false;
         return FALSE;
     }
 
@@ -227,7 +223,7 @@ selection_clear_clip( GtkWidget *WXUNUSED(widget), GdkEventSelection *event )
         }
     }
 
-    wxTheClipboard->m_waiting = FALSE;
+    wxTheClipboard->m_waiting = false;
     return TRUE;
 }
 }
@@ -382,7 +378,7 @@ void wxClipboard::Clear()
         //  it, clear_selection is called which will set m_data to zero
         if (gdk_selection_owner_get( g_clipboardAtom ) == m_clipboardWidget->window)
         {
-            m_waiting = TRUE;
+            m_waiting = true;
 
             gtk_selection_owner_set( (GtkWidget*) NULL, g_clipboardAtom,
                                      (guint32) GDK_CURRENT_TIME );
diff --git a/src/gtk/control.cpp b/src/gtk/control.cpp
index 4368959b6c..cc203cb561 100644
--- a/src/gtk/control.cpp
+++ b/src/gtk/control.cpp
@@ -12,8 +12,12 @@
 
 #if wxUSE_CONTROLS
 
-#include "wx/log.h"
 #include "wx/control.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/fontutil.h"
 #include "wx/settings.h"
 #include "wx/gtk/private.h"
@@ -126,7 +130,7 @@ GtkWidget* wxControl::GTKCreateFrame(const wxString& label)
     GtkWidget* framewidget = gtk_frame_new(NULL);
     gtk_frame_set_label_widget(GTK_FRAME(framewidget), labelwidget);
 
-    return framewidget; //note that the label is already set so you'll 
+    return framewidget; //note that the label is already set so you'll
                         //only need to call wxControl::SetLabel afterwards
 }
 
@@ -363,4 +367,3 @@ wxControl::GetDefaultAttributesFromGTKWidget(wxGtkWidgetNewFromAdj_t widget_new,
 }
 
 #endif // wxUSE_CONTROLS
-
diff --git a/src/gtk/dataobj.cpp b/src/gtk/dataobj.cpp
index 00b429c0b4..b1a0e714b5 100644
--- a/src/gtk/dataobj.cpp
+++ b/src/gtk/dataobj.cpp
@@ -1,5 +1,5 @@
 ///////////////////////////////////////////////////////////////////////////////
-// Name:        dataobj.cpp
+// Name:        src/gtk/dataobj.cpp
 // Purpose:     wxDataObject class
 // Author:      Robert Roebling
 // Id:          $Id$
@@ -10,15 +10,18 @@
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
+#if wxUSE_DATAOBJ
+
 #include "wx/dataobj.h"
 
-#if wxUSE_DATAOBJ
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
 
 #include "wx/app.h"
 #include "wx/debug.h"
 #include "wx/mstream.h"
 #include "wx/image.h"
-#include "wx/log.h"
 #include "wx/uri.h"
 
 #include <gdk/gdk.h>
diff --git a/src/gtk/dataview.cpp b/src/gtk/dataview.cpp
index 6ae875695c..76be4d0a35 100644
--- a/src/gtk/dataview.cpp
+++ b/src/gtk/dataview.cpp
@@ -16,12 +16,15 @@
 
 #ifndef wxUSE_GENERICDATAVIEWCTRL
 
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/stockitem.h"
 #include "wx/dcclient.h"
 #include "wx/calctrl.h"
 #include "wx/popupwin.h"
 #include "wx/sizer.h"
-#include "wx/log.h"
 
 #include "wx/gtk/private.h"
 #include "wx/gtk/win_gtk.h"
@@ -1349,17 +1352,17 @@ wxDataViewColumn::wxDataViewColumn( const wxString &title, wxDataViewCell *cell,
     GtkTreeViewColumn *column = gtk_tree_view_column_new();
 
     gtk_tree_view_column_set_title( column, wxGTK_CONV(title) );
-    
+
     if (sizing == wxDATAVIEW_COL_WIDTH_FIXED)
         gtk_tree_view_column_set_sizing( column, GTK_TREE_VIEW_COLUMN_FIXED );
     else if (sizing == wxDATAVIEW_COL_WIDTH_GROW)
         gtk_tree_view_column_set_sizing( column, GTK_TREE_VIEW_COLUMN_GROW_ONLY );
     else
         gtk_tree_view_column_set_sizing( column, GTK_TREE_VIEW_COLUMN_AUTOSIZE );
-        
+
     if (fixed_width > 0)
         gtk_tree_view_column_set_fixed_width( column, fixed_width );
-    
+
     gtk_tree_view_column_pack_start( column, renderer, TRUE );
 
     gtk_tree_view_column_set_cell_data_func( column, renderer,
diff --git a/src/gtk/dcclient.cpp b/src/gtk/dcclient.cpp
index 62e70ce5d6..6df12003f0 100644
--- a/src/gtk/dcclient.cpp
+++ b/src/gtk/dcclient.cpp
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        gtk/dcclient.cpp
+// Name:        src/gtk/dcclient.cpp
 // Purpose:
 // Author:      Robert Roebling
 // RCS-ID:      $Id$
@@ -15,10 +15,14 @@
 #endif
 
 #include "wx/dcclient.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/dcmemory.h"
 #include "wx/image.h"
 #include "wx/module.h"
-#include "wx/log.h"
 #include "wx/fontutil.h"
 
 #include "wx/gtk/win_gtk.h"
diff --git a/src/gtk/dnd.cpp b/src/gtk/dnd.cpp
index 14cee77258..b847b0b8ef 100644
--- a/src/gtk/dnd.cpp
+++ b/src/gtk/dnd.cpp
@@ -16,12 +16,12 @@
 
 #ifndef WX_PRECOMP
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/window.h"
 #include "wx/app.h"
 #include "wx/gdicmn.h"
-#include "wx/log.h"
 #include "wx/utils.h"
 
 #include "wx/gtk/private.h"
diff --git a/src/gtk/font.cpp b/src/gtk/font.cpp
index 30330dd02d..10183aa014 100644
--- a/src/gtk/font.cpp
+++ b/src/gtk/font.cpp
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        gtk/font.cpp
+// Name:        src/gtk/font.cpp
 // Purpose:
 // Author:      Robert Roebling
 // Id:          $Id$
@@ -19,10 +19,14 @@
 #include "wx/wxprec.h"
 
 #include "wx/font.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/fontutil.h"
 #include "wx/cmndata.h"
 #include "wx/utils.h"
-#include "wx/log.h"
 #include "wx/gdicmn.h"
 #include "wx/tokenzr.h"
 #include "wx/settings.h"
@@ -424,7 +428,7 @@ int wxFont::GetPointSize() const
 
 wxString wxFont::GetFaceName() const
 {
-    wxCHECK_MSG( Ok(), wxT(""), wxT("invalid font") );
+    wxCHECK_MSG( Ok(), wxEmptyString, wxT("invalid font") );
 
 #if wxUSE_PANGO
     return M_FONTDATA->HasNativeFont() ? M_FONTDATA->m_nativeFontInfo.GetFaceName()
diff --git a/src/gtk/gnome/gprint.cpp b/src/gtk/gnome/gprint.cpp
index 2f93b67ba7..8c09929a65 100644
--- a/src/gtk/gnome/gprint.cpp
+++ b/src/gtk/gnome/gprint.cpp
@@ -19,13 +19,16 @@
 
 #if wxUSE_LIBGNOMEPRINT
 
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/math.h"
 #include "wx/fontutil.h"
 #include "wx/gtk/private.h"
 #include "wx/module.h"
 #include "wx/dynlib.h"
 #include "wx/dcmemory.h"
-#include "wx/log.h"
 #include "wx/icon.h"
 
 #include <libgnomeprint/gnome-print.h>
@@ -1160,7 +1163,7 @@ void wxGnomePrintDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width,
     }
 }
 
-void wxGnomePrintDC::makeEllipticalPath(wxCoord x, wxCoord y, 
+void wxGnomePrintDC::makeEllipticalPath(wxCoord x, wxCoord y,
                                         wxCoord width, wxCoord height)
 {
     double r = 4 * (sqrt (2) - 1) / 3;
@@ -1170,22 +1173,22 @@ void wxGnomePrintDC::makeEllipticalPath(wxCoord x, wxCoord y,
             halfHR = r * halfH;
     wxCoord halfWI = (wxCoord) halfW,
             halfHI = (wxCoord) halfH;
-            
+
     gs_lgp->gnome_print_newpath( m_gpc );
-    
+
     // Approximate an ellipse using four cubic splines, clockwise from 0 deg */
     gs_lgp->gnome_print_moveto( m_gpc,
-                XLOG2DEV(x + width), 
+                XLOG2DEV(x + width),
                 YLOG2DEV(y + halfHI) );
     gs_lgp->gnome_print_curveto( m_gpc,
                 XLOG2DEV(x + width),
                 YLOG2DEV(y + (wxCoord) rint (halfH + halfHR)),
-                XLOG2DEV(x + (wxCoord) rint(halfW + halfWR)), 
+                XLOG2DEV(x + (wxCoord) rint(halfW + halfWR)),
                 YLOG2DEV(y + height),
-                XLOG2DEV(x + halfWI), 
+                XLOG2DEV(x + halfWI),
                 YLOG2DEV(y + height) );
     gs_lgp->gnome_print_curveto( m_gpc,
-                XLOG2DEV(x + (wxCoord) rint(halfW - halfWR)), 
+                XLOG2DEV(x + (wxCoord) rint(halfW - halfWR)),
                 YLOG2DEV(y + height),
                 XLOG2DEV(x),
                 YLOG2DEV(y + (wxCoord) rint (halfH + halfHR)),
@@ -1202,7 +1205,7 @@ void wxGnomePrintDC::makeEllipticalPath(wxCoord x, wxCoord y,
                 XLOG2DEV(x + width),
                 YLOG2DEV(y + (wxCoord) rint(halfH - halfHR)),
                 XLOG2DEV(x + width), YLOG2DEV(y + halfHI) );
-                
+
     gs_lgp->gnome_print_closepath(m_gpc);
 }
 
@@ -1534,7 +1537,7 @@ void wxGnomePrintDC::SetPen( const wxPen& pen )
         case wxSHORT_DASH:    gs_lgp->gnome_print_setdash( m_gpc, 2, short_dashed, 0 ); break;
         case wxLONG_DASH:     gs_lgp->gnome_print_setdash( m_gpc, 2, wxCoord_dashed, 0 ); break;
         case wxDOT_DASH:      gs_lgp->gnome_print_setdash( m_gpc, 4, dotted_dashed, 0 );  break;
-        case wxUSER_DASH: 
+        case wxUSER_DASH:
         {
             // It may be noted that libgnomeprint between at least
             // versions 2.8.0 and 2.12.1 makes a copy of the dashes
diff --git a/src/gtk/gnome/gvfs.cpp b/src/gtk/gnome/gvfs.cpp
index db197126e2..aa25c84098 100644
--- a/src/gtk/gnome/gvfs.cpp
+++ b/src/gtk/gnome/gvfs.cpp
@@ -19,11 +19,14 @@
 
 #if wxUSE_MIMETYPE && wxUSE_LIBGNOMEVFS
 
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/mimetype.h"
 #include "wx/gtk/private.h"
 #include "wx/module.h"
 #include "wx/dynlib.h"
-#include "wx/log.h"
 
 #include <libgnomevfs/gnome-vfs-mime-handlers.h>
 
@@ -62,7 +65,7 @@ public:
         (), (), FALSE )
     wxDL_METHOD_DEFINE( void, gnome_vfs_shutdown,
         (), (), /**/ )
-        
+
     wxDL_METHOD_DEFINE( GnomeVFSResult, gnome_vfs_mime_set_icon,
         (const char *mime_type, const char *filename), (mime_type, filename), GNOME_VFS_OK )
 };
@@ -98,7 +101,7 @@ void wxGnomeVFSLibrary::InitializeMethods()
 
     wxDL_METHOD_LOAD( m_gnome_vfs_lib, gnome_vfs_init, success )
     wxDL_METHOD_LOAD( m_gnome_vfs_lib, gnome_vfs_shutdown, success )
-    
+
     m_ok = true;
 }
 
@@ -125,7 +128,7 @@ bool wxGnomeVFSMimeTypesManagerImpl::DoAssociation(const wxString& strType,
                        const wxString& strDesc)
 {
     int nIndex = AddToMimeData(strType, strIcon, entry, strExtensions, strDesc, true);
-    
+
     if ( nIndex == wxNOT_FOUND )
         return false;
 
@@ -134,7 +137,7 @@ bool wxGnomeVFSMimeTypesManagerImpl::DoAssociation(const wxString& strType,
         // User modificationt to the MIME database
         // are not supported :-)
     }
-        
+
     return false;
 }
 
@@ -168,7 +171,7 @@ void wxGnomeVFSModule::OnExit()
 {
     if (gs_lgvfs->IsOk())
         gs_lgvfs->gnome_vfs_shutdown();
-        
+
     delete gs_lgvfs;
 }
 
diff --git a/src/gtk/listbox.cpp b/src/gtk/listbox.cpp
index 6df91cf93f..82f03469c6 100644
--- a/src/gtk/listbox.cpp
+++ b/src/gtk/listbox.cpp
@@ -18,13 +18,13 @@
 #ifndef WX_PRECOMP
     #include "wx/dynarray.h"
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/arrstr.h"
 #include "wx/utils.h"
 #include "wx/checklst.h"
 #include "wx/settings.h"
-#include "wx/log.h"
 #include "wx/gtk/private.h"
 #include "wx/gtk/treeentry_gtk.h"
 
diff --git a/src/gtk/menu.cpp b/src/gtk/menu.cpp
index aa3a7bee52..6a60ddb0b4 100644
--- a/src/gtk/menu.cpp
+++ b/src/gtk/menu.cpp
@@ -14,9 +14,9 @@
 
 #ifndef WX_PRECOMP
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
-#include "wx/log.h"
 #include "wx/app.h"
 #include "wx/bitmap.h"
 
diff --git a/src/gtk/notebook.cpp b/src/gtk/notebook.cpp
index 1e29e55f49..9d5cf1a053 100644
--- a/src/gtk/notebook.cpp
+++ b/src/gtk/notebook.cpp
@@ -16,12 +16,12 @@
 
 #ifndef WX_PRECOMP
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/panel.h"
 #include "wx/utils.h"
 #include "wx/imaglist.h"
-#include "wx/log.h"
 #include "wx/bitmap.h"
 #include "wx/fontutil.h"
 
diff --git a/src/gtk/radiobox.cpp b/src/gtk/radiobox.cpp
index 86778400df..63622d81c1 100644
--- a/src/gtk/radiobox.cpp
+++ b/src/gtk/radiobox.cpp
@@ -14,9 +14,12 @@
 
 #include "wx/radiobox.h"
 
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/dialog.h"
 #include "wx/frame.h"
-#include "wx/log.h"
 
 #include "wx/gtk/private.h"
 #include <gdk/gdkkeysyms.h>
diff --git a/src/gtk/region.cpp b/src/gtk/region.cpp
index 71cc667463..4db9d7755f 100644
--- a/src/gtk/region.cpp
+++ b/src/gtk/region.cpp
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        gtk/region.cpp
+// Name:        src/gtk/region.cpp
 // Purpose:
 // Author:      Robert Roebling
 // Modified:    VZ at 05.10.00: use AllocExclusive(), comparison fixed
@@ -19,8 +19,11 @@
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/region.h"
-#include "wx/log.h"
 #include "wx/gtk/private.h"
 
 
@@ -524,4 +527,3 @@ wxRect wxRegionIterator::GetRect() const
 
     return r;
 }
-
diff --git a/src/gtk/taskbar.cpp b/src/gtk/taskbar.cpp
index 8861bd816c..9d9232d7c9 100644
--- a/src/gtk/taskbar.cpp
+++ b/src/gtk/taskbar.cpp
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////
-// File:        taskbar.cpp
+// File:        src/gtk/taskbar.cpp
 // Purpose:     wxTaskBarIcon (src/unix/taskbarx11.cpp) helper for GTK2
 // Author:      Vaclav Slavik
 // Modified by:
@@ -13,7 +13,11 @@
 #include "wx/wxprec.h"
 
 #include "wx/gtk/taskbarpriv.h"
-#include "wx/log.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/frame.h"
 #include "wx/menu.h"
 
diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp
index 7705302842..3b3cd28c2d 100644
--- a/src/gtk/textctrl.cpp
+++ b/src/gtk/textctrl.cpp
@@ -14,10 +14,10 @@
 
 #ifndef WX_PRECOMP
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/utils.h"
-#include "wx/log.h"
 #include "wx/math.h"
 #include "wx/settings.h"
 #include "wx/panel.h"
diff --git a/src/gtk/threadno.cpp b/src/gtk/threadno.cpp
index deb4a9251c..50e012ad3b 100644
--- a/src/gtk/threadno.cpp
+++ b/src/gtk/threadno.cpp
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        thread.cpp
+// Name:        src/gtk/thread.cpp
 // Purpose:     Solaris thread support
 // Author:      Guilhem Lavaux
 // Modified by:
@@ -13,9 +13,13 @@
 #include "wx/wxprec.h"
 
 #include "wx/thread.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/wx.h"
 #include "wx/module.h"
-#include "wx/log.h"
 
 wxMutex::wxMutex()
 {
diff --git a/src/gtk/threadsgi.cpp b/src/gtk/threadsgi.cpp
index 204b4e4663..bfbdec4d7a 100644
--- a/src/gtk/threadsgi.cpp
+++ b/src/gtk/threadsgi.cpp
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        threadsgi.cpp
+// Name:        src/gtk/threadsgi.cpp
 // Purpose:     wxThread (SGI) Implementation
 // Author:      Original from Wolfram Gloger/Guilhem Lavaux
 // Modified by:
@@ -13,6 +13,11 @@
 #include "wx/wxprec.h"
 
 #include "wx/thread.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include <stdio.h>
 #include <unistd.h>
 
@@ -21,7 +26,6 @@
 #include <sys/prctl.h>
 #include "wx/module.h"
 #include "wx/utils.h"
-#include "wx/log.h"
 
 #include "gdk/gdk.h"
 #include "gtk/gtk.h"
@@ -266,4 +270,3 @@ void wxThreadModule::OnExit()
     wxThreadGuiExit();
     delete wxMainMutex;
 }
-
diff --git a/src/gtk/toplevel.cpp b/src/gtk/toplevel.cpp
index 627bc9e3de..904220c40b 100644
--- a/src/gtk/toplevel.cpp
+++ b/src/gtk/toplevel.cpp
@@ -23,7 +23,11 @@
 #endif
 
 #include "wx/toplevel.h"
-#include "wx/log.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/dialog.h"
 #include "wx/control.h"
 #include "wx/app.h"
diff --git a/src/gtk/treegtk.cpp b/src/gtk/treegtk.cpp
index d5c5ddff1d..3eedd17486 100644
--- a/src/gtk/treegtk.cpp
+++ b/src/gtk/treegtk.cpp
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        treectrl.cpp
+// Name:        src/gtk/treectrl.cpp
 // Purpose:     wxTreeCtrl
 // Author:      Denis Pershin
 // Modified by:
@@ -13,16 +13,16 @@
 #include "wx/wxprec.h"
 
 #ifdef __BORLANDC__
-#pragma hdrstop
+    #pragma hdrstop
 #endif
 
 #ifndef WX_PRECOMP
-#include "wx/wx.h"
+    #include "wx/wx.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/gtk/treectrl.h"
 #include "wx/textctrl.h"
-#include "wx/log.h"
 
 #include <gtk/gtk.h>
 
@@ -186,16 +186,17 @@ void wxTreeCtrl::SetStateImageList(wxImageList *imageList) {
   m_imageListState = imageList;
 }
 
-wxString wxTreeCtrl::GetItemText(const wxTreeItemId &item) const {
-  char *t;
+wxString wxTreeCtrl::GetItemText(const wxTreeItemId &item) const
+{
+    char *t;
 
-  if (!item.IsOk())
-    return wxString("");
+    if (!item.IsOk())
+        return wxEmptyString;
 
-  GtkLabel *l = GTK_LABEL(gtk_object_get_data(GTK_OBJECT((GtkTreeItem *)item), "w_label"));
-  gtk_label_get(l, &t);
+    GtkLabel *l = GTK_LABEL(gtk_object_get_data(GTK_OBJECT((GtkTreeItem *)item), "w_label"));
+    gtk_label_get(l, &t);
 
-  return t;
+    return t;
 }
 
 int wxTreeCtrl::GetItemImage(const wxTreeItemId& item) const {
diff --git a/src/gtk/utilsgtk.cpp b/src/gtk/utilsgtk.cpp
index 1a65822ba3..f615293ba2 100644
--- a/src/gtk/utilsgtk.cpp
+++ b/src/gtk/utilsgtk.cpp
@@ -15,10 +15,10 @@
 #ifndef WX_PRECOMP
     #include "wx/string.h"
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/apptrait.h"
-#include "wx/log.h"
 
 #include "wx/process.h"
 
diff --git a/src/gtk/utilsres.cpp b/src/gtk/utilsres.cpp
index 1b97063219..ea43bbd03f 100644
--- a/src/gtk/utilsres.cpp
+++ b/src/gtk/utilsres.cpp
@@ -15,9 +15,9 @@
 #ifndef WX_PRECOMP
     #include "wx/list.h"
     #include "wx/string.h"
+    #include "wx/log.h"
 #endif
 
-#include "wx/log.h"
 #include "wx/config.h"
 #include "wx/app.h"
 
diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp
index 40b265aa84..230cf90c46 100644
--- a/src/gtk/window.cpp
+++ b/src/gtk/window.cpp
@@ -18,6 +18,7 @@
 
 #ifndef WX_PRECOMP
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/dcclient.h"
@@ -52,7 +53,6 @@
 #include "wx/menu.h"
 #include "wx/statusbr.h"
 #include "wx/settings.h"
-#include "wx/log.h"
 #include "wx/fontutil.h"
 
 #ifdef __WXDEBUG__
diff --git a/src/gtk1/app.cpp b/src/gtk1/app.cpp
index 5858c7570c..9c6a6f9937 100644
--- a/src/gtk1/app.cpp
+++ b/src/gtk1/app.cpp
@@ -20,11 +20,11 @@
 
 #ifndef WX_PRECOMP
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/gdicmn.h"
 #include "wx/utils.h"
-#include "wx/log.h"
 #include "wx/memory.h"
 #include "wx/font.h"
 #include "wx/settings.h"
diff --git a/src/gtk1/clipbrd.cpp b/src/gtk1/clipbrd.cpp
index 9f06257b3d..02f3374010 100644
--- a/src/gtk1/clipbrd.cpp
+++ b/src/gtk1/clipbrd.cpp
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        gtk/clipbrd.cpp
+// Name:        src/gtk1/clipbrd.cpp
 // Purpose:
 // Author:      Robert Roebling
 // Id:          $Id$
@@ -10,25 +10,21 @@
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
+#if wxUSE_CLIPBOARD
+
 #include "wx/clipbrd.h"
 
-#if wxUSE_CLIPBOARD
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
 
 #include "wx/dataobj.h"
 #include "wx/utils.h"
-#include "wx/log.h"
 
 #include <glib.h>
 #include <gdk/gdk.h>
 #include <gtk/gtk.h>
 
-//-----------------------------------------------------------------------------
-// thread system
-//-----------------------------------------------------------------------------
-
-#if wxUSE_THREADS
-#endif
-
 //-----------------------------------------------------------------------------
 // data
 //-----------------------------------------------------------------------------
@@ -642,4 +638,3 @@ bool wxClipboard::GetData( wxDataObject& data )
 
 #endif
   // wxUSE_CLIPBOARD
-
diff --git a/src/gtk1/control.cpp b/src/gtk1/control.cpp
index 8917ed25db..d77a65f4e8 100644
--- a/src/gtk1/control.cpp
+++ b/src/gtk1/control.cpp
@@ -12,8 +12,12 @@
 
 #if wxUSE_CONTROLS
 
-#include "wx/log.h"
 #include "wx/control.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/fontutil.h"
 #include "wx/settings.h"
 #include "wx/gtk1/private.h"
@@ -260,4 +264,3 @@ wxControl::GetDefaultAttributesFromGTKWidget(wxGtkWidgetNewFromAdj_t widget_new,
 }
 
 #endif // wxUSE_CONTROLS
-
diff --git a/src/gtk1/dataobj.cpp b/src/gtk1/dataobj.cpp
index 7fdc0744fb..241ac078a0 100644
--- a/src/gtk1/dataobj.cpp
+++ b/src/gtk1/dataobj.cpp
@@ -1,5 +1,5 @@
 ///////////////////////////////////////////////////////////////////////////////
-// Name:        dataobj.cpp
+// Name:        src/gtk1/dataobj.cpp
 // Purpose:     wxDataObject class
 // Author:      Robert Roebling
 // Id:          $Id$
@@ -10,15 +10,18 @@
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
+#if wxUSE_DATAOBJ
+
 #include "wx/dataobj.h"
 
-#if wxUSE_DATAOBJ
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
 
 #include "wx/app.h"
 #include "wx/debug.h"
 #include "wx/mstream.h"
 #include "wx/image.h"
-#include "wx/log.h"
 #include "wx/uri.h"
 
 #include <gdk/gdk.h>
diff --git a/src/gtk1/dcclient.cpp b/src/gtk1/dcclient.cpp
index 9e8c3de0e7..b326e0d152 100644
--- a/src/gtk1/dcclient.cpp
+++ b/src/gtk1/dcclient.cpp
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        gtk/dcclient.cpp
+// Name:        src/gtk1/dcclient.cpp
 // Purpose:
 // Author:      Robert Roebling
 // RCS-ID:      $Id$
@@ -15,10 +15,14 @@
 #endif
 
 #include "wx/dcclient.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/dcmemory.h"
 #include "wx/image.h"
 #include "wx/module.h"
-#include "wx/log.h"
 #include "wx/fontutil.h"
 
 #include "wx/gtk1/win_gtk.h"
diff --git a/src/gtk1/dnd.cpp b/src/gtk1/dnd.cpp
index 29094ff240..f1c5971ae6 100644
--- a/src/gtk1/dnd.cpp
+++ b/src/gtk1/dnd.cpp
@@ -16,9 +16,9 @@
 
 #ifndef WX_PRECOMP
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
-#include "wx/log.h"
 #include "wx/window.h"
 #include "wx/app.h"
 #include "wx/gdicmn.h"
diff --git a/src/gtk1/font.cpp b/src/gtk1/font.cpp
index def79ff7fa..4014c067a6 100644
--- a/src/gtk1/font.cpp
+++ b/src/gtk1/font.cpp
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        gtk/font.cpp
+// Name:        src/gtk/font.cpp
 // Purpose:
 // Author:      Robert Roebling
 // Id:          $Id$
@@ -19,10 +19,14 @@
 #include "wx/wxprec.h"
 
 #include "wx/font.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/fontutil.h"
 #include "wx/cmndata.h"
 #include "wx/utils.h"
-#include "wx/log.h"
 #include "wx/gdicmn.h"
 #include "wx/tokenzr.h"
 #include "wx/settings.h"
@@ -546,7 +550,7 @@ int wxFont::GetPointSize() const
 
 wxString wxFont::GetFaceName() const
 {
-    wxCHECK_MSG( Ok(), wxT(""), wxT("invalid font") );
+    wxCHECK_MSG( Ok(), wxEmptyString, wxT("invalid font") );
 
 #if wxUSE_PANGO
     return M_FONTDATA->HasNativeFont() ? M_FONTDATA->m_nativeFontInfo.GetFaceName()
diff --git a/src/gtk1/menu.cpp b/src/gtk1/menu.cpp
index 502346ec53..edde839bcf 100644
--- a/src/gtk1/menu.cpp
+++ b/src/gtk1/menu.cpp
@@ -14,9 +14,9 @@
 
 #ifndef WX_PRECOMP
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
-#include "wx/log.h"
 #include "wx/app.h"
 #include "wx/bitmap.h"
 
diff --git a/src/gtk1/notebook.cpp b/src/gtk1/notebook.cpp
index 6cad559cbd..d5b0887776 100644
--- a/src/gtk1/notebook.cpp
+++ b/src/gtk1/notebook.cpp
@@ -16,12 +16,12 @@
 
 #ifndef WX_PRECOMP
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/panel.h"
 #include "wx/utils.h"
 #include "wx/imaglist.h"
-#include "wx/log.h"
 #include "wx/bitmap.h"
 #include "wx/fontutil.h"
 
diff --git a/src/gtk1/radiobox.cpp b/src/gtk1/radiobox.cpp
index 8b980c12f7..83252b6c37 100644
--- a/src/gtk1/radiobox.cpp
+++ b/src/gtk1/radiobox.cpp
@@ -14,9 +14,12 @@
 
 #include "wx/radiobox.h"
 
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/dialog.h"
 #include "wx/frame.h"
-#include "wx/log.h"
 
 #include "wx/gtk1/private.h"
 #include <gdk/gdkkeysyms.h>
diff --git a/src/gtk1/region.cpp b/src/gtk1/region.cpp
index 2e212047d1..f0eadcdc00 100644
--- a/src/gtk1/region.cpp
+++ b/src/gtk1/region.cpp
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        gtk/region.cpp
+// Name:        src/gtk1/region.cpp
 // Purpose:
 // Author:      Robert Roebling
 // Modified:    VZ at 05.10.00: use AllocExclusive(), comparison fixed
@@ -20,7 +20,11 @@
 #include "wx/wxprec.h"
 
 #include "wx/region.h"
-#include "wx/log.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/gtk1/private.h"
 
 
@@ -568,4 +572,3 @@ wxRect wxRegionIterator::GetRect() const
 
     return r;
 }
-
diff --git a/src/gtk1/textctrl.cpp b/src/gtk1/textctrl.cpp
index e472846bb0..36ac27ffd4 100644
--- a/src/gtk1/textctrl.cpp
+++ b/src/gtk1/textctrl.cpp
@@ -14,10 +14,10 @@
 
 #ifndef WX_PRECOMP
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/utils.h"
-#include "wx/log.h"
 #include "wx/math.h"
 #include "wx/settings.h"
 #include "wx/panel.h"
diff --git a/src/gtk1/threadno.cpp b/src/gtk1/threadno.cpp
index deb4a9251c..67d932e80a 100644
--- a/src/gtk1/threadno.cpp
+++ b/src/gtk1/threadno.cpp
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        thread.cpp
+// Name:        src/gtk1/thread.cpp
 // Purpose:     Solaris thread support
 // Author:      Guilhem Lavaux
 // Modified by:
@@ -13,9 +13,13 @@
 #include "wx/wxprec.h"
 
 #include "wx/thread.h"
-#include "wx/wx.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/wx.h"
+    #include "wx/log.h"
+#endif
+
 #include "wx/module.h"
-#include "wx/log.h"
 
 wxMutex::wxMutex()
 {
diff --git a/src/gtk1/threadsgi.cpp b/src/gtk1/threadsgi.cpp
index 204b4e4663..914ad1ef37 100644
--- a/src/gtk1/threadsgi.cpp
+++ b/src/gtk1/threadsgi.cpp
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        threadsgi.cpp
+// Name:        src/gtk1/threadsgi.cpp
 // Purpose:     wxThread (SGI) Implementation
 // Author:      Original from Wolfram Gloger/Guilhem Lavaux
 // Modified by:
@@ -13,6 +13,11 @@
 #include "wx/wxprec.h"
 
 #include "wx/thread.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include <stdio.h>
 #include <unistd.h>
 
@@ -21,7 +26,6 @@
 #include <sys/prctl.h>
 #include "wx/module.h"
 #include "wx/utils.h"
-#include "wx/log.h"
 
 #include "gdk/gdk.h"
 #include "gtk/gtk.h"
diff --git a/src/gtk1/toplevel.cpp b/src/gtk1/toplevel.cpp
index 460cae59ad..414790ab21 100644
--- a/src/gtk1/toplevel.cpp
+++ b/src/gtk1/toplevel.cpp
@@ -23,7 +23,11 @@
 #endif
 
 #include "wx/toplevel.h"
-#include "wx/log.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/dialog.h"
 #include "wx/control.h"
 #include "wx/app.h"
diff --git a/src/gtk1/treegtk.cpp b/src/gtk1/treegtk.cpp
index 91e52b964c..325c74f345 100644
--- a/src/gtk1/treegtk.cpp
+++ b/src/gtk1/treegtk.cpp
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        treectrl.cpp
+// Name:        src/gtk1/treectrl.cpp
 // Purpose:     wxTreeCtrl
 // Author:      Denis Pershin
 // Modified by:
@@ -13,16 +13,16 @@
 #include "wx/wxprec.h"
 
 #ifdef __BORLANDC__
-#pragma hdrstop
+    #pragma hdrstop
 #endif
 
 #ifndef WX_PRECOMP
-#include "wx/wx.h"
+    #include "wx/wx.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/gtk1/treectrl.h"
 #include "wx/textctrl.h"
-#include "wx/log.h"
 
 #include <gtk/gtk.h>
 
@@ -186,16 +186,17 @@ void wxTreeCtrl::SetStateImageList(wxImageList *imageList) {
   m_imageListState = imageList;
 }
 
-wxString wxTreeCtrl::GetItemText(const wxTreeItemId &item) const {
-  char *t;
+wxString wxTreeCtrl::GetItemText(const wxTreeItemId &item) const
+{
+    char *t;
 
-  if (!item.IsOk())
-    return wxString("");
+    if (!item.IsOk())
+        return wxEmptyString;
 
-  GtkLabel *l = GTK_LABEL(gtk_object_get_data(GTK_OBJECT((GtkTreeItem *)item), "w_label"));
-  gtk_label_get(l, &t);
+    GtkLabel *l = GTK_LABEL(gtk_object_get_data(GTK_OBJECT((GtkTreeItem *)item), "w_label"));
+    gtk_label_get(l, &t);
 
-  return t;
+    return t;
 }
 
 int wxTreeCtrl::GetItemImage(const wxTreeItemId& item) const {
diff --git a/src/gtk1/utilsgtk.cpp b/src/gtk1/utilsgtk.cpp
index c9d478b428..56fb435d13 100644
--- a/src/gtk1/utilsgtk.cpp
+++ b/src/gtk1/utilsgtk.cpp
@@ -15,10 +15,10 @@
 #ifndef WX_PRECOMP
     #include "wx/string.h"
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/apptrait.h"
-#include "wx/log.h"
 
 #include "wx/process.h"
 
diff --git a/src/gtk1/utilsres.cpp b/src/gtk1/utilsres.cpp
index 1bd989f80b..b04e3af62e 100644
--- a/src/gtk1/utilsres.cpp
+++ b/src/gtk1/utilsres.cpp
@@ -15,9 +15,9 @@
 #ifndef WX_PRECOMP
     #include "wx/list.h"
     #include "wx/string.h"
+    #include "wx/log.h"
 #endif
 
-#include "wx/log.h"
 #include "wx/config.h"
 #include "wx/app.h"
 
diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp
index 0d8838061d..d5a37d77f8 100644
--- a/src/gtk1/window.cpp
+++ b/src/gtk1/window.cpp
@@ -18,6 +18,7 @@
 
 #ifndef WX_PRECOMP
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/dcclient.h"
@@ -49,7 +50,6 @@
 #include "wx/menu.h"
 #include "wx/statusbr.h"
 #include "wx/settings.h"
-#include "wx/log.h"
 #include "wx/fontutil.h"
 
 #ifdef __WXDEBUG__
diff --git a/src/html/helpdata.cpp b/src/html/helpdata.cpp
index 5acac76914..531b8a8fee 100644
--- a/src/html/helpdata.cpp
+++ b/src/html/helpdata.cpp
@@ -31,7 +31,6 @@
 #include "wx/busyinfo.h"
 #include "wx/encconv.h"
 #include "wx/fontmap.h"
-#include "wx/log.h"
 #include "wx/html/htmlpars.h"
 #include "wx/html/htmldefs.h"
 #include "wx/html/htmlfilt.h"
diff --git a/src/html/m_image.cpp b/src/html/m_image.cpp
index a81f2c1023..624356dcb3 100644
--- a/src/html/m_image.cpp
+++ b/src/html/m_image.cpp
@@ -21,6 +21,7 @@
     #include "wx/scrolwin.h"
     #include "wx/timer.h"
     #include "wx/dcmemory.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/html/forcelnk.h"
@@ -29,7 +30,6 @@
 
 #include "wx/image.h"
 #include "wx/gifdecod.h"
-#include "wx/log.h"
 #include "wx/artprov.h"
 #include "wx/math.h"
 
diff --git a/src/html/winpars.cpp b/src/html/winpars.cpp
index e702952b46..97c4c92d40 100644
--- a/src/html/winpars.cpp
+++ b/src/html/winpars.cpp
@@ -18,13 +18,13 @@
 #ifndef WXPRECOMP
     #include "wx/intl.h"
     #include "wx/dc.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/html/htmldefs.h"
 #include "wx/html/winpars.h"
 #include "wx/html/htmlwin.h"
 #include "wx/fontmap.h"
-#include "wx/log.h"
 #include "wx/settings.h"
 #include "wx/uri.h"
 
diff --git a/src/mac/carbon/app.cpp b/src/mac/carbon/app.cpp
index b7082817a0..8338c41618 100644
--- a/src/mac/carbon/app.cpp
+++ b/src/mac/carbon/app.cpp
@@ -15,6 +15,7 @@
 
 #ifndef WX_PRECOMP
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/window.h"
@@ -30,7 +31,6 @@
 #include "wx/dc.h"
 #include "wx/dialog.h"
 #include "wx/msgdlg.h"
-#include "wx/log.h"
 #include "wx/module.h"
 #include "wx/memory.h"
 #include "wx/tooltip.h"
diff --git a/src/mac/carbon/bitmap.cpp b/src/mac/carbon/bitmap.cpp
index 89f0d0e127..2d354a3f2a 100644
--- a/src/mac/carbon/bitmap.cpp
+++ b/src/mac/carbon/bitmap.cpp
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        bitmap.cpp
+// Name:        src/mac/carbon/bitmap.cpp
 // Purpose:     wxBitmap
 // Author:      Stefan Csomor
 // Modified by:
@@ -12,8 +12,12 @@
 #include "wx/wxprec.h"
 
 #include "wx/bitmap.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/icon.h"
-#include "wx/log.h"
 #include "wx/image.h"
 #include "wx/metafile.h"
 #include "wx/xpmdecod.h"
diff --git a/src/mac/carbon/cfsocket.cpp b/src/mac/carbon/cfsocket.cpp
index d99f05a012..531c538a34 100644
--- a/src/mac/carbon/cfsocket.cpp
+++ b/src/mac/carbon/cfsocket.cpp
@@ -23,6 +23,7 @@
     #include "wx/object.h"
     #include "wx/string.h"
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/app.h"
@@ -30,7 +31,6 @@
 #include "wx/timer.h"
 #include "wx/utils.h"
 #include "wx/module.h"
-#include "wx/log.h"
 #include "wx/event.h"
 
 #include "wx/sckaddr.h"
diff --git a/src/mac/carbon/clipbrd.cpp b/src/mac/carbon/clipbrd.cpp
index f884aae4f7..c5f05871f0 100644
--- a/src/mac/carbon/clipbrd.cpp
+++ b/src/mac/carbon/clipbrd.cpp
@@ -18,6 +18,7 @@
 
 #ifndef WX_PRECOMP
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/app.h"
@@ -25,7 +26,6 @@
 #include "wx/bitmap.h"
 #include "wx/utils.h"
 #include "wx/metafile.h"
-#include "wx/log.h"
 
 #ifndef __DARWIN__
 #include <Scrap.h>
diff --git a/src/mac/carbon/dataobj.cpp b/src/mac/carbon/dataobj.cpp
index f572edfe55..3ace48bcd8 100644
--- a/src/mac/carbon/dataobj.cpp
+++ b/src/mac/carbon/dataobj.cpp
@@ -18,9 +18,9 @@
 
 #ifndef WX_PRECOMP
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
-#include "wx/log.h"
 #include "wx/dcmemory.h"
 #include "wx/mstream.h"
 #include "wx/image.h"
diff --git a/src/mac/carbon/dc.cpp b/src/mac/carbon/dc.cpp
index b3e3ef106a..46d1b080b6 100644
--- a/src/mac/carbon/dc.cpp
+++ b/src/mac/carbon/dc.cpp
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        dc.cpp
+// Name:        src/mac/carbon/dc.cpp
 // Purpose:     wxDC class
 // Author:      Stefan Csomor
 // Modified by:
@@ -14,13 +14,17 @@
 #include "wx/dc.h"
 
 #if !wxMAC_USE_CORE_GRAPHICS
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/app.h"
 #include "wx/mac/uma.h"
 #include "wx/dcmemory.h"
 #include "wx/dcprint.h"
 #include "wx/region.h"
 #include "wx/image.h"
-#include "wx/log.h"
 
 #ifdef __MSL__
     #if __MSL__ >= 0x6000
@@ -1008,7 +1012,7 @@ void wxDC::DoDrawPolygon(int n, wxPoint points[],
 
     if ( m_brush.GetStyle() == wxTRANSPARENT && m_pen.GetStyle() == wxTRANSPARENT )
         return ;
-    
+
     wxMacFastPortSetter helper(this) ;
 
     wxCoord x1, x2 , y1 , y2 ;
@@ -1147,7 +1151,7 @@ void wxDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
     // CMB: draw nothing if transformed w or h is 0
     if (ww == 0 || hh == 0)
         return;
-    
+
     // CMB: handle -ve width and/or height
     if (ww < 0)
     {
@@ -1473,7 +1477,7 @@ void wxDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y,
     // TODO: support text background color (only possible by hand, ATSUI does not support it)
     wxCHECK_RET( Ok(), wxT("wxDC::DoDrawRotatedText - invalid DC") );
 
-    if ( str.Length() == 0 )
+    if ( str.empty() )
         return ;
 
     wxMacFastPortSetter helper(this) ;
@@ -1490,7 +1494,7 @@ void wxDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y,
 
     OSStatus status = noErr ;
     ATSUTextLayout atsuLayout ;
-    UniCharCount chars = str.Length() ;
+    UniCharCount chars = str.length() ;
     UniChar* ubuf = NULL ;
 
 #if SIZEOF_WCHAR_T == 4
@@ -1734,9 +1738,9 @@ bool wxDC::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) con
     wxCHECK_MSG(Ok(), false, wxT("wxDC::DoGetPartialTextExtents - invalid DC"));
 
     widths.Empty();
-    widths.Add(0, text.Length());
+    widths.Add(0, text.length());
 
-    if (text.Length() == 0)
+    if (text.length() == 0)
         return false;
 
     wxMacFastPortSetter helper(this) ;
@@ -1754,7 +1758,7 @@ bool wxDC::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) con
         // fonts, please change it.  Currently it is measuring from the
         // beginning of the string for each succeeding substring, which is much
         // slower than this should be.
-        for (size_t i=0; i<text.Length(); i++)
+        for (size_t i=0; i<text.length(); i++)
         {
             wxString str(text.Left(i + 1));
             Point bounds = {0, 0};
@@ -1781,7 +1785,7 @@ bool wxDC::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) con
         // Copy to widths, starting at measurements[1]
         // NOTE: this doesn't take into account any multi-byte characters
         // in buff, it probably should...
-        for (size_t i=0; i<text.Length(); i++)
+        for (size_t i=0; i<text.length(); i++)
             widths[i] = XDEV2LOGREL(measurements[i + 1]);
 
         delete [] measurements;
@@ -2162,13 +2166,13 @@ void wxDC::MacInstallBrush() const
                     Pattern whiteColor ;
                     ::BackPat(GetQDGlobalsWhite(&whiteColor));
                     ::SetThemePen( m_brush.MacGetTheme() , wxDisplayDepth() , true ) ;
-                }   
+                }
             break ;
-        
+
             default :
                 ::PenPat(GetQDGlobalsBlack(&blackColor));
                 break ;
-                
+
         }
     }
     else if (m_brush.IsHatch())
diff --git a/src/mac/carbon/dccg.cpp b/src/mac/carbon/dccg.cpp
index 5512b97eac..7557864d65 100755
--- a/src/mac/carbon/dccg.cpp
+++ b/src/mac/carbon/dccg.cpp
@@ -1,12 +1,12 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        dc.cpp
+// Name:        src/mac/carbon/dccg.cpp
 // Purpose:     wxDC class
 // Author:      Stefan Csomor
 // Modified by:
 // Created:     01/02/97
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:       wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #include "wx/wxprec.h"
@@ -15,13 +15,16 @@
 
 #if wxMAC_USE_CORE_GRAPHICS
 
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/app.h"
 #include "wx/mac/uma.h"
 #include "wx/dcmemory.h"
 #include "wx/dcprint.h"
 #include "wx/region.h"
 #include "wx/image.h"
-#include "wx/log.h"
 
 
 #ifdef __MSL__
@@ -1720,14 +1723,14 @@ void wxDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y,
     wxCHECK_RET( Ok(), wxT("wxDC(cg)::DoDrawRotatedText - invalid DC") );
     wxCHECK_RET( m_macATSUIStyle != NULL, wxT("wxDC(cg)::DoDrawRotatedText - no valid font set") );
 
-    if ( str.Length() == 0 )
+    if ( str.length() == 0 )
         return ;
     if ( m_logicalFunction != wxCOPY )
         return ;
 
     OSStatus status = noErr ;
     ATSUTextLayout atsuLayout ;
-    UniCharCount chars = str.Length() ;
+    UniCharCount chars = str.length() ;
     UniChar* ubuf = NULL ;
 
 #if SIZEOF_WCHAR_T == 4
@@ -1885,14 +1888,14 @@ void wxDC::DoGetTextExtent( const wxString &str, wxCoord *width, wxCoord *height
         MacInstallFont() ;
     }
 
-    if ( str.Length() == 0 )
+    if ( str.empty() )
         return ;
 
     wxCHECK_RET( m_macATSUIStyle != NULL, wxT("wxDC(cg)::DoGetTextExtent - no valid font set") ) ;
 
     OSStatus status = noErr ;
     ATSUTextLayout atsuLayout ;
-    UniCharCount chars = str.Length() ;
+    UniCharCount chars = str.length() ;
     UniChar* ubuf = NULL ;
 
 #if SIZEOF_WCHAR_T == 4
@@ -1957,13 +1960,13 @@ bool wxDC::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) con
     wxCHECK_MSG( Ok(), false, wxT("wxDC(cg)::DoGetPartialTextExtents - invalid DC") );
 
     widths.Empty();
-    widths.Add(0, text.Length());
+    widths.Add(0, text.length());
 
-    if (text.Length() == 0)
+    if (text.empty())
         return false;
 
     ATSUTextLayout atsuLayout ;
-    UniCharCount chars = text.Length() ;
+    UniCharCount chars = text.length() ;
     UniChar* ubuf = NULL ;
 
 #if SIZEOF_WCHAR_T == 4
@@ -2198,4 +2201,3 @@ wxCoord wxDCBase::LogicalToDeviceYRel(wxCoord y) const
 }
 
 #endif // wxMAC_USE_CORE_GRAPHICS
-
diff --git a/src/mac/carbon/dcclient.cpp b/src/mac/carbon/dcclient.cpp
index 7f14f9b53a..24e5d95e30 100644
--- a/src/mac/carbon/dcclient.cpp
+++ b/src/mac/carbon/dcclient.cpp
@@ -1,17 +1,22 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        dcclient.cpp
+// Name:        src/mac/carbon/dcclient.cpp
 // Purpose:     wxClientDC class
 // Author:      Stefan Csomor
 // Modified by:
 // Created:     01/02/97
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:       wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #include "wx/wxprec.h"
 
 #include "wx/dcclient.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/dcmemory.h"
 #include "wx/region.h"
 #include "wx/window.h"
@@ -19,7 +24,6 @@
 #include "wx/settings.h"
 #include "wx/math.h"
 #include "wx/mac/private.h"
-#include "wx/log.h"
 
 //-----------------------------------------------------------------------------
 // constants
@@ -42,7 +46,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxWindowDC)
 #include "wx/mac/uma.h"
 #include "wx/notebook.h"
 #include "wx/tabctrl.h"
-    
+
 
 static wxBrush MacGetBackgroundBrush( wxWindow* window )
 {
@@ -83,11 +87,11 @@ static wxBrush MacGetBackgroundBrush( wxWindow* window )
                 extent.top-- ;
                 extent.right = x + size.x ;
                 extent.bottom = y + size.y ;
-                bkdBrush.MacSetThemeBackground( kThemeBackgroundTabPane , (WXRECTPTR) &extent ) ; 
+                bkdBrush.MacSetThemeBackground( kThemeBackgroundTabPane , (WXRECTPTR) &extent ) ;
                 break ;
             }
-            
-            parent = parent->GetParent() ;  
+
+            parent = parent->GetParent() ;
         }
     }
 
@@ -99,14 +103,14 @@ static wxBrush MacGetBackgroundBrush( wxWindow* window )
 #endif
 
     return bkdBrush ;
-}    
+}
 
-wxWindowDC::wxWindowDC() 
+wxWindowDC::wxWindowDC()
 {
     m_window = NULL ;
 }
 
-wxWindowDC::wxWindowDC(wxWindow *window) 
+wxWindowDC::wxWindowDC(wxWindow *window)
 {
     m_window = window ;
     wxTopLevelWindowMac* rootwindow = window->MacGetTopLevelWindow() ;
@@ -137,7 +141,7 @@ wxWindowDC::wxWindowDC(wxWindow *window)
         // situations
         m_macLocalOrigin.x = x ;
         m_macLocalOrigin.y = y ;
-        
+
         m_graphicContext = new wxMacCGContext( (CGrafPtr) m_macPort ) ;
         m_graphicContext->SetPen( m_pen ) ;
         m_graphicContext->SetBrush( m_brush ) ;
diff --git a/src/mac/carbon/fontdlgosx.mm b/src/mac/carbon/fontdlgosx.mm
index 043439c64f..fe90214386 100644
--- a/src/mac/carbon/fontdlgosx.mm
+++ b/src/mac/carbon/fontdlgosx.mm
@@ -23,11 +23,11 @@
 
 #ifndef WX_PRECOMP
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/cmndata.h"
 #include "wx/fontutil.h"
-#include "wx/log.h"
 
 // ============================================================================
 // implementation
diff --git a/src/mac/carbon/glcanvas.cpp b/src/mac/carbon/glcanvas.cpp
index e64e4c01e3..f5e7c59eb0 100644
--- a/src/mac/carbon/glcanvas.cpp
+++ b/src/mac/carbon/glcanvas.cpp
@@ -1,30 +1,31 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        glcanvas.cpp
+// Name:        src/mac/carbon/glcanvas.cpp
 // Purpose:     wxGLCanvas, for using OpenGL with wxWidgets under Macintosh
 // Author:      Stefan Csomor
 // Modified by:
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:       wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #include "wx/wxprec.h"
 
 #if defined(__BORLANDC__)
-#pragma hdrstop
+    #pragma hdrstop
 #endif
 
 #if wxUSE_GLCANVAS
 
+#include "wx/glcanvas.h"
+
 #ifndef WX_PRECOMP
-#include "wx/frame.h"
+    #include "wx/frame.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/settings.h"
-#include "wx/log.h"
 
-#include "wx/glcanvas.h"
 #include "wx/mac/uma.h"
 
 // DLL options compatibility check:
@@ -42,12 +43,12 @@ wxGLContext::wxGLContext(
                          )
 {
     m_window = win;
-    
+
     m_drawable = (AGLDrawable) UMAGetWindowPort(MAC_WXHWND(win->MacGetTopLevelWindowRef()));
-    
+
     m_glContext = aglCreateContext(fmt, other ? other->m_glContext : NULL);
     wxCHECK_RET( m_glContext, wxT("Couldn't create OpenGl context") );
-    
+
     GLboolean b;
     b = aglSetDrawable(m_glContext, m_drawable);
     wxCHECK_RET( b, wxT("Couldn't bind OpenGl context") );
@@ -145,14 +146,14 @@ wxGLCanvas::~wxGLCanvas()
 static AGLPixelFormat ChoosePixelFormat(const int *attribList)
 {
     GLint data[512];
-    GLint defaultAttribs[] = { AGL_RGBA, 
-        AGL_DOUBLEBUFFER, 
-        AGL_MINIMUM_POLICY, 
+    GLint defaultAttribs[] = { AGL_RGBA,
+        AGL_DOUBLEBUFFER,
+        AGL_MINIMUM_POLICY,
         AGL_DEPTH_SIZE, 1,  // use largest available depth buffer
-        AGL_RED_SIZE, 1, 
-        AGL_GREEN_SIZE, 1, 
-        AGL_BLUE_SIZE, 1, 
-        AGL_ALPHA_SIZE, 0, 
+        AGL_RED_SIZE, 1,
+        AGL_GREEN_SIZE, 1,
+        AGL_BLUE_SIZE, 1,
+        AGL_ALPHA_SIZE, 0,
         AGL_NONE };
     GLint *attribs;
     if (!attribList)
@@ -162,7 +163,7 @@ static AGLPixelFormat ChoosePixelFormat(const int *attribList)
     else
     {
         int arg=0, p=0;
-        
+
         data[p++] = AGL_MINIMUM_POLICY; // make _SIZE tags behave more like GLX
         while( (attribList[arg]!=0) && (p<512) )
         {
@@ -185,9 +186,9 @@ static AGLPixelFormat ChoosePixelFormat(const int *attribList)
                 data[p++]=AGL_BLUE_SIZE; data[p++]=attribList[arg++]; break;
             case WX_GL_MIN_ALPHA:
                 data[p++]=AGL_ALPHA_SIZE; data[p++]=attribList[arg++]; break;
-            case WX_GL_DEPTH_SIZE: 
+            case WX_GL_DEPTH_SIZE:
                 data[p++]=AGL_DEPTH_SIZE; data[p++]=attribList[arg++]; break;
-            case WX_GL_STENCIL_SIZE: 
+            case WX_GL_STENCIL_SIZE:
                 data[p++]=AGL_STENCIL_SIZE; data[p++]=attribList[arg++]; break;
             case WX_GL_MIN_ACCUM_RED:
                 data[p++]=AGL_ACCUM_RED_SIZE; data[p++]=attribList[arg++]; break;
@@ -200,12 +201,12 @@ static AGLPixelFormat ChoosePixelFormat(const int *attribList)
             default:
                 break;
             }
-        }       
-        data[p] = 0; 
-        
+        }
+        data[p] = 0;
+
         attribs = data;
     }
-    
+
     return aglChoosePixelFormat(NULL, 0, attribs);
 }
 
@@ -216,14 +217,14 @@ bool wxGLCanvas::Create(wxWindow *parent, const wxGLContext *shared, wxWindowID
     m_macCanvasIsShown = false ;
     m_glContext = 0 ;
     wxWindow::Create( parent, id, pos, size, style, name );
-    
+
     AGLPixelFormat fmt = ChoosePixelFormat(attribList);
     wxCHECK_MSG( fmt, false, wxT("Couldn't create OpenGl pixel format") );
-    
+
     m_glContext = new wxGLContext(fmt, this, palette, shared);
     m_macCanvasIsShown = true ;
     aglDestroyPixelFormat(fmt);
-    
+
     return true;
 }
 
@@ -245,30 +246,30 @@ void wxGLCanvas::SetViewport()
     // adjust glViewport to just this window
     int x = 0 ;
     int y = 0 ;
-    
+
     wxWindow* iter = this ;
     while( iter->GetParent() )
     {
-    	iter = iter->GetParent() ;
+        iter = iter->GetParent() ;
     }
-    
+
     if ( iter && iter->IsTopLevel() )
     {
-	    MacClientToRootWindow( &x , &y ) ;
-	    int width, height;
-	    GetClientSize(& width, & height);
-	    Rect bounds ;
-	    GetWindowPortBounds( MAC_WXHWND(MacGetTopLevelWindowRef()) , &bounds ) ;
-	    GLint parms[4] ;
-	    parms[0] = x ;
-	    parms[1] = bounds.bottom - bounds.top - ( y + height ) ;
-	    parms[2] = width ;
-	    parms[3] = height ;
-	    
-	    if ( !m_macCanvasIsShown )
-	    	parms[0] += 20000 ;
-	    aglSetInteger( m_glContext->m_glContext , AGL_BUFFER_RECT , parms ) ;
-   	}
+        MacClientToRootWindow( &x , &y ) ;
+        int width, height;
+        GetClientSize(& width, & height);
+        Rect bounds ;
+        GetWindowPortBounds( MAC_WXHWND(MacGetTopLevelWindowRef()) , &bounds ) ;
+        GLint parms[4] ;
+        parms[0] = x ;
+        parms[1] = bounds.bottom - bounds.top - ( y + height ) ;
+        parms[2] = width ;
+        parms[3] = height ;
+
+        if ( !m_macCanvasIsShown )
+            parms[0] += 20000 ;
+        aglSetInteger( m_glContext->m_glContext , AGL_BUFFER_RECT , parms ) ;
+   }
 }
 
 void wxGLCanvas::OnSize(wxSizeEvent& event)
@@ -312,11 +313,11 @@ void wxGLCanvas::SetColour(const wxChar *colour)
         m_glContext->SetColour(colour);
 }
 
-bool wxGLCanvas::Show(bool show) 
+bool wxGLCanvas::Show(bool show)
 {
     if ( !wxWindow::Show( show ) )
         return FALSE ;
-/*        
+/*
     if ( !show )
     {
         if ( m_macCanvasIsShown )
@@ -337,7 +338,7 @@ bool wxGLCanvas::Show(bool show)
     return TRUE ;
 }
 
-void wxGLCanvas::MacVisibilityChanged() 
+void wxGLCanvas::MacVisibilityChanged()
 {
     if ( !MacIsReallyShown() )
     {
diff --git a/src/mac/carbon/listbox.cpp b/src/mac/carbon/listbox.cpp
index 3d6eac95da..ace8cfff04 100644
--- a/src/mac/carbon/listbox.cpp
+++ b/src/mac/carbon/listbox.cpp
@@ -13,16 +13,17 @@
 
 #if wxUSE_LISTBOX
 
+#include "wx/listbox.h"
+
 #ifndef WX_PRECOMP
     #include "wx/dynarray.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/app.h"
-#include "wx/listbox.h"
 #include "wx/button.h"
 #include "wx/settings.h"
 #include "wx/toplevel.h"
-#include "wx/log.h"
 
 #include "wx/utils.h"
 
diff --git a/src/mac/carbon/menu.cpp b/src/mac/carbon/menu.cpp
index 931f25c3fd..b73db78b20 100644
--- a/src/mac/carbon/menu.cpp
+++ b/src/mac/carbon/menu.cpp
@@ -1,12 +1,12 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        menu.cpp
+// Name:        src/mac/carbon/menu.cpp
 // Purpose:     wxMenu, wxMenuBar, wxMenuItem
 // Author:      Stefan Csomor
 // Modified by:
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:       wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 // ============================================================================
@@ -18,8 +18,13 @@
 
 #include "wx/wxprec.h"
 
-#include "wx/app.h"
 #include "wx/menu.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
+#include "wx/app.h"
 #include "wx/menuitem.h"
 #include "wx/window.h"
 #include "wx/log.h"
@@ -198,7 +203,7 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
                 UMAInsertMenuItem(MAC_WXHMENU(m_hMenu), wxT("a"), wxFont::GetDefaultEncoding(), pos);
                 pos += 1 ;
             }
-            
+
             SetMenuItemCommandID( MAC_WXHMENU(m_hMenu) , pos , wxIdToMacCommand ( pItem->GetId() ) ) ;
             SetMenuItemRefCon( MAC_WXHMENU(m_hMenu) , pos , (UInt32) pItem ) ;
             pItem->UpdateItemText() ;
diff --git a/src/mac/carbon/mimetmac.cpp b/src/mac/carbon/mimetmac.cpp
index f157c63c3c..173f3d5f55 100644
--- a/src/mac/carbon/mimetmac.cpp
+++ b/src/mac/carbon/mimetmac.cpp
@@ -38,13 +38,13 @@
     #include "wx/dynarray.h"
     #include "wx/string.h"
     #include "wx/intl.h"
+    #include "wx/log.h"
 
     #if wxUSE_GUI
         #include "wx/icon.h"
     #endif
 #endif
 
-#include "wx/log.h"
 #include "wx/file.h"
 #include "wx/confbase.h"
 
diff --git a/src/mac/carbon/notebmac.cpp b/src/mac/carbon/notebmac.cpp
index 26decfafb2..a14cbd6f7f 100644
--- a/src/mac/carbon/notebmac.cpp
+++ b/src/mac/carbon/notebmac.cpp
@@ -17,11 +17,11 @@
 
 #ifndef WX_PRECOMP
     #include "wx/string.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/app.h"
 #include "wx/string.h"
-#include "wx/log.h"
 #include "wx/imaglist.h"
 #include "wx/image.h"
 #include "wx/mac/uma.h"
diff --git a/src/mac/carbon/sound.cpp b/src/mac/carbon/sound.cpp
index 01c41c4b50..c04f765f72 100644
--- a/src/mac/carbon/sound.cpp
+++ b/src/mac/carbon/sound.cpp
@@ -20,9 +20,9 @@
     #include "wx/object.h"
     #include "wx/string.h"
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
-#include "wx/log.h"
 #include "wx/file.h"
 #include "wx/timer.h"
 
diff --git a/src/mac/carbon/window.cpp b/src/mac/carbon/window.cpp
index 46f90f8732..e2d732fab8 100644
--- a/src/mac/carbon/window.cpp
+++ b/src/mac/carbon/window.cpp
@@ -11,8 +11,13 @@
 
 #include "wx/wxprec.h"
 
-#include "wx/menu.h"
 #include "wx/window.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
+#include "wx/menu.h"
 #include "wx/dc.h"
 #include "wx/dcclient.h"
 #include "wx/utils.h"
@@ -30,7 +35,6 @@
 #include "wx/statusbr.h"
 #include "wx/menuitem.h"
 #include "wx/spinctrl.h"
-#include "wx/log.h"
 #include "wx/geometry.h"
 #include "wx/textctrl.h"
 
@@ -514,7 +518,7 @@ pascal OSStatus wxMacUnicodeTextEventHandler( EventHandlerCallRef handler , Even
 
         uniChars = new wchar_t[ numChars ] ;
         GetEventParameter( event, kEventParamTextInputSendText, typeUnicodeText, NULL, dataSize , NULL , charBuf ) ;
-		charBuf[ numChars - 1 ] = 0;
+        charBuf[ numChars - 1 ] = 0;
 #if SIZEOF_WCHAR_T == 2
         uniChars = (wchar_t*) charBuf ;
         memcpy( uniChars , charBuf , numChars * 2 ) ;
diff --git a/src/mac/classic/app.cpp b/src/mac/classic/app.cpp
index a0c2589571..bbce9ec769 100644
--- a/src/mac/classic/app.cpp
+++ b/src/mac/classic/app.cpp
@@ -19,6 +19,7 @@
 
 #ifndef WX_PRECOMP
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/window.h"
@@ -34,7 +35,6 @@
 #include "wx/dc.h"
 #include "wx/dialog.h"
 #include "wx/msgdlg.h"
-#include "wx/log.h"
 #include "wx/module.h"
 #include "wx/memory.h"
 #include "wx/tooltip.h"
diff --git a/src/mac/classic/bitmap.cpp b/src/mac/classic/bitmap.cpp
index 952bb1101a..d91980f7f8 100644
--- a/src/mac/classic/bitmap.cpp
+++ b/src/mac/classic/bitmap.cpp
@@ -16,8 +16,12 @@
 #endif
 
 #include "wx/bitmap.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/icon.h"
-#include "wx/log.h"
 #include "wx/image.h"
 #include "wx/xpmdecod.h"
 
@@ -1433,4 +1437,3 @@ void wxBitmap::UseAlpha()
     // mask in UngetRawData()
     M_BITMAPDATA->m_hasAlpha = true;
 }
-
diff --git a/src/mac/classic/clipbrd.cpp b/src/mac/classic/clipbrd.cpp
index 146534dfd2..a413f827a7 100644
--- a/src/mac/classic/clipbrd.cpp
+++ b/src/mac/classic/clipbrd.cpp
@@ -15,6 +15,7 @@
 
 #ifndef WX_PRECOMP
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/app.h"
@@ -22,7 +23,6 @@
 #include "wx/bitmap.h"
 #include "wx/utils.h"
 #include "wx/metafile.h"
-#include "wx/log.h"
 
 #ifndef __DARWIN__
 #include <Scrap.h>
diff --git a/src/mac/classic/dataobj.cpp b/src/mac/classic/dataobj.cpp
index 1e2bd14fd4..0c26a14a5b 100644
--- a/src/mac/classic/dataobj.cpp
+++ b/src/mac/classic/dataobj.cpp
@@ -25,9 +25,9 @@
 
 #ifndef WX_PRECOMP
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
-#include "wx/log.h"
 #include "wx/dataobj.h"
 #include "wx/mstream.h"
 #include "wx/image.h"
diff --git a/src/mac/classic/dc.cpp b/src/mac/classic/dc.cpp
index 733afcaa0f..57d4a7a48f 100644
--- a/src/mac/classic/dc.cpp
+++ b/src/mac/classic/dc.cpp
@@ -1,22 +1,28 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        dc.cpp
+// Name:        src/mac/classic/dc.cpp
 // Purpose:     wxDC class
 // Author:      Stefan Csomor
 // Modified by:
 // Created:     01/02/97
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:       wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
+#include "wx/wxprec.h"
+
 #include "wx/dc.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/app.h"
 #include "wx/mac/uma.h"
 #include "wx/dcmemory.h"
 #include "wx/dcprint.h"
 #include "wx/region.h"
 #include "wx/image.h"
-#include "wx/log.h"
 
 #if __MSL__ >= 0x6000
 namespace std {}
@@ -1349,7 +1355,7 @@ void  wxDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y,
         return;
     }
 
-    if ( str.Length() == 0 )
+    if ( str.length() == 0 )
         return ;
 
     wxMacFastPortSetter helper(this) ;
@@ -1363,9 +1369,9 @@ void  wxDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y,
     }
     OSStatus status = noErr ;
     ATSUTextLayout atsuLayout ;
-    UniCharCount chars = str.Length() ;
+    UniCharCount chars = str.length() ;
 #if wxUSE_UNICODE
-    status = ::ATSUCreateTextLayoutWithTextPtr( (UniCharArrayPtr) (const wxChar*) str , 0 , str.Length() , str.Length() , 1 ,
+    status = ::ATSUCreateTextLayoutWithTextPtr( (UniCharArrayPtr) (const wxChar*) str , 0 , str.length() , str.length() , 1 ,
         &chars , (ATSUStyle*) &m_macATSUIStyle , &atsuLayout ) ;
 #else
     wxWCharBuffer wchar = str.wc_str( wxConvLocal ) ;
@@ -1454,7 +1460,7 @@ void  wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y)
     {
         ::TextMode( srcCopy ) ;
     }
-    int length = strtext.Length() ;
+    int length = strtext.length() ;
 
     int laststop = 0 ;
     int i = 0 ;
@@ -1604,7 +1610,7 @@ void  wxDC::DoGetTextExtent( const wxString &strtext, wxCoord *width, wxCoord *h
         *descent =YDEV2LOGREL( fi.descent );
     if ( externalLeading )
         *externalLeading = YDEV2LOGREL( fi.leading ) ;
-    int length = strtext.Length() ;
+    int length = strtext.length() ;
 
     int laststop = 0 ;
     int i = 0 ;
@@ -1687,9 +1693,9 @@ bool wxDC::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) con
     wxCHECK_MSG(Ok(), false, wxT("Invalid DC"));
 
     widths.Empty();
-    widths.Add(0, text.Length());
+    widths.Add(0, text.length());
 
-    if (text.Length() == 0)
+    if (text.length() == 0)
         return false;
 
     wxMacFastPortSetter helper(this) ;
@@ -1706,7 +1712,7 @@ bool wxDC::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) con
         // fonts, please change it.  Currently it is measuring from the
         // begining of the string for each succeding substring, which is much
         // slower than this should be.
-        for (size_t i=0; i<text.Length(); i++)
+        for (size_t i=0; i<text.length(); i++)
         {
             wxString str(text.Left(i+1));
             Point bounds = {0,0};
@@ -1732,7 +1738,7 @@ bool wxDC::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) con
         // Copy to widths, starting at measurements[1]
         // NOTE: this doesn't take into account any multi-byte characters
         // in buff, it probabkly should...
-        for (size_t i=0; i<text.Length(); i++)
+        for (size_t i=0; i<text.length(); i++)
             widths[i] = XDEV2LOGREL(measurements[i+1]);
 
         delete [] measurements;
diff --git a/src/mac/classic/glcanvas.cpp b/src/mac/classic/glcanvas.cpp
index bd326659bd..e7e8c3f4ab 100644
--- a/src/mac/classic/glcanvas.cpp
+++ b/src/mac/classic/glcanvas.cpp
@@ -6,25 +6,26 @@
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:       wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #include "wx/wxprec.h"
 
 #if defined(__BORLANDC__)
-#pragma hdrstop
+    #pragma hdrstop
 #endif
 
 #if wxUSE_GLCANVAS
 
+#include "wx/glcanvas.h"
+
 #ifndef WX_PRECOMP
-#include "wx/frame.h"
+    #include "wx/frame.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/settings.h"
-#include "wx/log.h"
 
-#include "wx/glcanvas.h"
 #include "wx/mac/uma.h"
 
 // DLL options compatibility check:
diff --git a/src/mac/classic/listbox.cpp b/src/mac/classic/listbox.cpp
index 0289796b70..f194f47c69 100644
--- a/src/mac/classic/listbox.cpp
+++ b/src/mac/classic/listbox.cpp
@@ -13,16 +13,17 @@
 
 #if wxUSE_LISTBOX
 
+#include "wx/listbox.h"
+
 #ifndef WX_PRECOMP
     #include "wx/dynarray.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/app.h"
-#include "wx/listbox.h"
 #include "wx/button.h"
 #include "wx/settings.h"
 #include "wx/toplevel.h"
-#include "wx/log.h"
 
 #include "wx/utils.h"
 
diff --git a/src/mac/classic/mdi.cpp b/src/mac/classic/mdi.cpp
index dae283d79f..2603ac21dd 100644
--- a/src/mac/classic/mdi.cpp
+++ b/src/mac/classic/mdi.cpp
@@ -1,18 +1,24 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        mdi.cpp
+// Name:        src/mac/classic/mdi.cpp
 // Purpose:     MDI classes
 // Author:      Stefan Csomor
 // Modified by:
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:       wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
+#include "wx/wxprec.h"
+
 #include "wx/mdi.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/menu.h"
 #include "wx/settings.h"
-#include "wx/log.h"
 
 #include "wx/mac/private.h"
 #include "wx/mac/uma.h"
@@ -67,7 +73,7 @@ bool wxMDIParentFrame::Create(wxWindow *parent,
 {
     m_clientWindow = NULL;
     m_currentChild = NULL;
-    
+
     // this style can be used to prevent a window from having the standard MDI
     // "Window" menu
     if ( style & wxFRAME_NO_WINDOW_MENU )
@@ -78,7 +84,7 @@ bool wxMDIParentFrame::Create(wxWindow *parent,
     else // normal case: we have the window menu, so construct it
     {
         m_windowMenu = new wxMenu;
-        
+
         m_windowMenu->Append(IDM_WINDOWCASCADE, wxT("&Cascade"));
         m_windowMenu->Append(IDM_WINDOWTILEHOR, wxT("Tile &Horizontally"));
         m_windowMenu->Append(IDM_WINDOWTILEVERT, wxT("Tile &Vertically"));
@@ -86,12 +92,12 @@ bool wxMDIParentFrame::Create(wxWindow *parent,
         m_windowMenu->Append(IDM_WINDOWICONS, wxT("&Arrange Icons"));
         m_windowMenu->Append(IDM_WINDOWNEXT, wxT("&Next"));
     }
-    
+
     wxFrame::Create( parent , id , title , pos , size , style , name ) ;
     m_parentFrameActive = TRUE;
-    
+
     OnCreateClient();
-    
+
     return TRUE;
 }
 
@@ -104,15 +110,15 @@ wxMDIParentFrame::~wxMDIParentFrame()
 #endif
 #if wxUSE_STATUSBAR
     m_frameStatusBar = NULL;
-#endif    
+#endif
     m_clientWindow = NULL ;
-    
+
     if (m_windowMenu)
     {
         delete m_windowMenu;
         m_windowMenu = (wxMenu*) NULL;
     }
-    
+
     if ( m_clientWindow )
     {
         delete m_clientWindow;
@@ -195,7 +201,7 @@ wxMDIClientWindow *wxMDIParentFrame::OnCreateClient()
 void wxMDIParentFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
 {
     // TODO
-    
+
     // Propagate the event to the non-top-level children
     wxFrame::OnSysColourChanged(event);
 }
@@ -245,19 +251,19 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
                              const wxString& name)
 {
     SetName(name);
-    
+
     if ( id > -1 )
         m_windowId = id;
     else
         m_windowId = (int)NewControlId();
-    
+
     if (parent) parent->AddChild(this);
-    
+
     MacCreateRealWindow( title, pos , size , MacRemoveBordersFromStyle(style) , name ) ;
-    
+
     m_macWindowBackgroundTheme = kThemeBrushDocumentWindowBackground ;
     SetThemeWindowBackground( (WindowRef) m_macWindow , m_macWindowBackgroundTheme , false ) ;
-    
+
     wxModelessWindows.Append(this);
     return FALSE;
 }
@@ -275,7 +281,7 @@ wxMDIChildFrame::~wxMDIChildFrame()
 #endif
 #if wxUSE_STATUSBAR
     m_frameStatusBar = NULL;
-#endif    
+#endif
 }
 
 void wxMDIChildFrame::SetMenuBar(wxMenuBar *menu_bar)
@@ -299,7 +305,7 @@ void wxMDIChildFrame::MacActivate(long timestamp, bool activating)
         }
         else if((mdiparent->m_currentChild==this) || !s_macDeactivateWindow)
             mdiparent->wxFrame::MacActivate(timestamp,activating);
-        
+
         if(mdiparent->m_currentChild && mdiparent->m_currentChild!=this)
             mdiparent->m_currentChild->wxFrame::MacActivate(timestamp,false);
         mdiparent->m_currentChild = this;
@@ -362,15 +368,15 @@ wxMDIClientWindow::~wxMDIClientWindow()
 
 bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style)
 {
-    
+
     m_windowId = (int)NewControlId();
-    
+
     if ( parent )
     {
         parent->AddChild(this);
     }
     m_backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE);
-    
+
     wxModelessWindows.Append(this);
     return TRUE;
 }
@@ -385,4 +391,3 @@ void wxMDIClientWindow::DoGetClientSize(int *x, int *y) const
 void wxMDIClientWindow::OnScroll(wxScrollEvent& event)
 {
 }
-
diff --git a/src/mac/classic/menu.cpp b/src/mac/classic/menu.cpp
index ab63be2f36..8e4c0163c6 100644
--- a/src/mac/classic/menu.cpp
+++ b/src/mac/classic/menu.cpp
@@ -1,12 +1,12 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        menu.cpp
+// Name:        src/mac/classic/menu.cpp
 // Purpose:     wxMenu, wxMenuBar, wxMenuItem
 // Author:      Stefan Csomor
 // Modified by:
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:       wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 // ============================================================================
@@ -16,11 +16,17 @@
 // wxWidgets headers
 // -----------------
 
-#include "wx/app.h"
+#include "wx/wxprec.h"
+
 #include "wx/menu.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
+#include "wx/app.h"
 #include "wx/menuitem.h"
 #include "wx/window.h"
-#include "wx/log.h"
 #include "wx/utils.h"
 #include "wx/frame.h"
 
@@ -71,7 +77,7 @@ void wxMenu::Init()
     }
 
     // if we have a title, insert it in the beginning of the menu
-    if ( !!m_title )
+    if ( !m_title.empty() )
     {
         Append(idMenuTitle, m_title) ;
         AppendSeparator() ;
@@ -870,5 +876,3 @@ wxMenuItem *wxMenuBar::FindItem(int id, wxMenu **itemMenu) const
 
     return item;
 }
-
-
diff --git a/src/mac/classic/mimetmac.cpp b/src/mac/classic/mimetmac.cpp
index fa8a5fc51b..6636261d9a 100644
--- a/src/mac/classic/mimetmac.cpp
+++ b/src/mac/classic/mimetmac.cpp
@@ -22,13 +22,13 @@
     #include "wx/dynarray.h"
     #include "wx/string.h"
     #include "wx/intl.h"
+    #include "wx/log.h"
     #if wxUSE_GUI
         #include "wx/icon.h"
     #endif
 #endif //WX_PRECOMP
 
 
-#include "wx/log.h"
 #include "wx/file.h"
 #include "wx/confbase.h"
 
diff --git a/src/mac/classic/notebmac.cpp b/src/mac/classic/notebmac.cpp
index 02c1dd5501..ed9c0cf22f 100644
--- a/src/mac/classic/notebmac.cpp
+++ b/src/mac/classic/notebmac.cpp
@@ -23,10 +23,10 @@
 
 #ifndef WX_PRECOMP
     #include "wx/string.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/app.h"
-#include "wx/log.h"
 #include "wx/imaglist.h"
 #include "wx/image.h"
 #include "wx/mac/uma.h"
diff --git a/src/mac/classic/utilsexc.cpp b/src/mac/classic/utilsexc.cpp
index d6d411d046..0645d04a5f 100644
--- a/src/mac/classic/utilsexc.cpp
+++ b/src/mac/classic/utilsexc.cpp
@@ -1,16 +1,22 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        utilsexec.cpp
+// Name:        src/mac/classic/utilsexec.cpp
 // Purpose:     Execution-related utilities
 // Author:      Stefan Csomor
 // Modified by: David Elliott
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:       wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#include "wx/log.h"
+#include "wx/wxprec.h"
+
 #include "wx/utils.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #ifdef __DARWIN__
 #include "wx/unix/execute.h"
 #include <unistd.h>
@@ -133,20 +139,20 @@ long wxExecute(const wxString& command, int flags, wxProcess *WXUNUSED(handler))
 #ifdef __DARWIN__
 void wxMAC_MachPortEndProcessDetect(CFMachPortRef port, void *data)
 {
-	wxEndProcessData *proc_data = (wxEndProcessData*)data;
-	wxLogDebug(wxT("Wow.. this actually worked!"));
-	int status = 0;
-	int rc = waitpid(abs(proc_data->pid), &status, WNOHANG);
-	if(!rc)
-	{
-		wxLogDebug(wxT("Mach port was invalidated, but process hasn't terminated!"));
-		return;
-	}
-	if((rc != -1) && WIFEXITED(status))
-		proc_data->exitcode = WEXITSTATUS(status);
-	else
-		proc_data->exitcode = -1;
-	wxHandleProcessTermination(proc_data);
+    wxEndProcessData *proc_data = (wxEndProcessData*)data;
+    wxLogDebug(wxT("Wow.. this actually worked!"));
+    int status = 0;
+    int rc = waitpid(abs(proc_data->pid), &status, WNOHANG);
+    if(!rc)
+    {
+        wxLogDebug(wxT("Mach port was invalidated, but process hasn't terminated!"));
+        return;
+    }
+    if((rc != -1) && WIFEXITED(status))
+        proc_data->exitcode = WEXITSTATUS(status);
+    else
+        proc_data->exitcode = -1;
+    wxHandleProcessTermination(proc_data);
 }
 
 int wxAddProcessCallbackForPid(wxEndProcessData *proc_data, int pid)
@@ -208,7 +214,7 @@ int wxAddProcessCallbackForPid(wxEndProcessData *proc_data, int pid)
         wxLogDebug(wxT("Couldn't create runloopsource"));
         return -1;
     }
-    
+
     CFRelease(CFMachPortForProcess);
 
     CFRunLoopAddSource(CFRunLoopGetCurrent(),runloopsource,kCFRunLoopDefaultMode);
diff --git a/src/mac/classic/window.cpp b/src/mac/classic/window.cpp
index e067f9975a..86acdb173e 100644
--- a/src/mac/classic/window.cpp
+++ b/src/mac/classic/window.cpp
@@ -11,8 +11,13 @@
 
 #include "wx/wxprec.h"
 
-#include "wx/menu.h"
 #include "wx/window.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
+#include "wx/menu.h"
 #include "wx/dc.h"
 #include "wx/dcclient.h"
 #include "wx/utils.h"
@@ -33,7 +38,6 @@
 #include "wx/statusbr.h"
 #include "wx/menuitem.h"
 #include "wx/spinctrl.h"
-#include "wx/log.h"
 #include "wx/geometry.h"
 
 #if wxUSE_CARET
diff --git a/src/mac/corefoundation/hid.cpp b/src/mac/corefoundation/hid.cpp
index e4577b1c98..e052ab5063 100644
--- a/src/mac/corefoundation/hid.cpp
+++ b/src/mac/corefoundation/hid.cpp
@@ -32,9 +32,9 @@
 #ifndef WX_PRECOMP
     #include "wx/dynarray.h"
     #include "wx/string.h"
+    #include "wx/log.h"
 #endif
 
-#include "wx/log.h"
 #include "wx/mac/corefoundation/cfstring.h"
 
 #include "wx/utils.h"
diff --git a/src/mac/corefoundation/hidjoystick.cpp b/src/mac/corefoundation/hidjoystick.cpp
index 7b42508e18..d3017da77c 100644
--- a/src/mac/corefoundation/hidjoystick.cpp
+++ b/src/mac/corefoundation/hidjoystick.cpp
@@ -1,12 +1,12 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        joystick.cpp
+// Name:        src/mac/corefoundation/joystick.cpp
 // Purpose:     wxJoystick class
 // Author:      Ryan Norton
 // Modified by:
 // Created:     2/13/2005
 // RCS-ID:      $Id$
 // Copyright:   (c) Ryan Norton
-// Licence:       wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 //===========================================================================
@@ -30,8 +30,12 @@
 //---------------------------------------------------------------------------
 // Includes
 //---------------------------------------------------------------------------
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/event.h"       //joystick wxEvents
-#include "wx/log.h"         //logging...
 #include "wx/joystick.h"    //...
 #include "wx/thread.h"      //wxThread for polling thread/ wxCriticalSection
 #include "wx/window.h"      //for wxWindow to "capture" joystick
@@ -52,7 +56,7 @@
 #define wxJS_MAX_AXES       10 /*max number of axes*/
 #define wxJS_MAX_BUTTONS    40 /*max number of buttons*/
 
-enum 
+enum
 {
     //These are positions within the cookie array
     //in wxHIDJoystick that the cookies that store the axis' are
@@ -72,13 +76,13 @@ class wxHIDJoystick : public wxHIDDevice
 public:
     wxHIDJoystick();
     ~wxHIDJoystick();
-    
-	bool Create(int nWhich);
-	virtual void BuildCookies(CFArrayRef Array);
-	void MakeCookies(CFArrayRef Array);
+
+    bool Create(int nWhich);
+    virtual void BuildCookies(CFArrayRef Array);
+    void MakeCookies(CFArrayRef Array);
     IOHIDElementCookie* GetCookies();
     IOHIDQueueInterface** GetQueue();
-    
+
     int  m_nXMax, m_nYMax, m_nZMax, m_nRudderMax, m_nUMax, m_nVMax,
          m_nXMin, m_nYMin, m_nZMin, m_nRudderMin, m_nUMin, m_nVMin;
 
@@ -94,7 +98,7 @@ public:
     wxJoystickThread(wxHIDJoystick* hid, int joystick);
     void* Entry();
     static void HIDCallback(void* target, IOReturn res, void* context, void* sender);
-    
+
 private:
     wxHIDJoystick*       m_hid;
     int       m_joystick;
@@ -119,9 +123,9 @@ private:
 void wxGetIntFromCFDictionary(CFTypeRef cfDict, CFStringRef key, int* pOut)
 {
         CFNumberGetValue(
-          (CFNumberRef) CFDictionaryGetValue((CFDictionaryRef) cfDict, 
-                                              key), 
-		                kCFNumberIntType, pOut);
+          (CFNumberRef) CFDictionaryGetValue((CFDictionaryRef) cfDict,
+                                              key),
+                        kCFNumberIntType, pOut);
 }
 
 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@@ -161,7 +165,7 @@ wxJoystick::wxJoystick(int joystick)
 //---------------------------------------------------------------------------
 // wxJoystick Destructor
 //
-// Releases the capture of the thread, deletes it, and deletes 
+// Releases the capture of the thread, deletes it, and deletes
 // the native implementation.
 //---------------------------------------------------------------------------
 wxJoystick::~wxJoystick()
@@ -169,7 +173,7 @@ wxJoystick::~wxJoystick()
     ReleaseCapture();
     if (m_thread)
         m_thread->Delete();  // It's detached so it will delete itself
-        
+
     if (m_hid)
         delete m_hid;
 }
@@ -178,7 +182,7 @@ wxJoystick::~wxJoystick()
 // wxJoystick::Get[XXX]Position
 //
 // Returns the value of an axis that was polled from the thread. In the
-// case of GetPosition returns the X and Y values in a wxPoint 
+// case of GetPosition returns the X and Y values in a wxPoint
 //---------------------------------------------------------------------------
 wxPoint wxJoystick::GetPosition() const
 {
@@ -193,7 +197,7 @@ int wxJoystick::GetZPosition() const
     return 0;
 }
 int wxJoystick::GetRudderPosition() const
-{	
+{
     if (m_thread)
         return m_thread->m_axe[wxJS_AXIS_RUDDER];
     return 0;
@@ -231,27 +235,35 @@ int wxJoystick::GetButtonState() const
 // if the native implementation doesn't exist (in constructor)
 //---------------------------------------------------------------------------
 bool wxJoystick::IsOk() const
-{	
-    return m_hid != NULL;	
+{
+    return m_hid != NULL;
 }
-    
+
 //---------------------------------------------------------------------------
 // wxJoystick::Get[XXX](Id/Name)
 //
 // Simple accessors to the native HID implementation
 //---------------------------------------------------------------------------
 int wxJoystick::GetManufacturerId() const
-{	return m_hid->m_nManufacturerId;				}
+{
+    return m_hid->m_nManufacturerId;
+}
+
 int wxJoystick::GetProductId() const
-{	return m_hid->m_nProductId;				}
+{
+    return m_hid->m_nProductId;
+}
+
 wxString wxJoystick::GetProductName() const
-{	return m_hid->m_szProductName;				}
+{
+    return m_hid->m_szProductName;
+}
 
 //---------------------------------------------------------------------------
 // wxJoystick::GetNumberButtons
 // wxJoystick::GetNumberAxes
 //
-// Queries the joystick for an active number of buttons/axes. 
+// Queries the joystick for an active number of buttons/axes.
 //
 // In the native HID implementation, the cookies:
 // 0-40     are the buttons of the joystick
@@ -262,25 +274,25 @@ wxString wxJoystick::GetProductName() const
 int wxJoystick::GetNumberButtons() const
 {
     int nCount = 0;
-    
+
     for(int nIndex = 0; nIndex < 40; ++nIndex)
     {
         if(m_hid->HasElement(nIndex))
             ++nCount;
     }
-    
+
     return nCount;
 }
 int wxJoystick::GetNumberAxes() const
 {
     int nCount = 0;
-    
+
     for(int nIndex = 40; nIndex < 50; ++nIndex)
     {
         if(m_hid->HasElement(nIndex))
             ++nCount;
     }
-    
+
     return nCount;
 }
 
@@ -292,10 +304,10 @@ int wxJoystick::GetNumberAxes() const
 // identifiers.
 //---------------------------------------------------------------------------
 int wxJoystick::GetNumberJoysticks()
-{    
-    return 
+{
+    return
         wxHIDDevice::GetCount(kHIDPage_GenericDesktop, kHIDUsage_GD_Joystick) +
-        wxHIDDevice::GetCount(kHIDPage_GenericDesktop, kHIDUsage_GD_GamePad);   
+        wxHIDDevice::GetCount(kHIDPage_GenericDesktop, kHIDUsage_GD_GamePad);
 }
 
 //---------------------------------------------------------------------------
@@ -339,30 +351,64 @@ bool wxJoystick::ReleaseCapture()
 // axis doesn't exist.
 //---------------------------------------------------------------------------
 int wxJoystick::GetXMin() const
-{	return m_hid->m_nXMin;	}
+{
+    return m_hid->m_nXMin;
+}
+
 int wxJoystick::GetYMin() const
-{	return m_hid->m_nYMin;	}
+{
+    return m_hid->m_nYMin;
+}
+
 int wxJoystick::GetZMin() const
-{	return m_hid->m_nZMin;	}
+{
+    return m_hid->m_nZMin;
+}
+
 int wxJoystick::GetRudderMin() const
-{	return m_hid->m_nRudderMin;	}
+{
+    return m_hid->m_nRudderMin;
+}
+
 int wxJoystick::GetUMin() const
-{	return m_hid->m_nUMin;	}
+{
+    return m_hid->m_nUMin;
+}
+
 int wxJoystick::GetVMin() const
-{	return m_hid->m_nVMin;	}
+{
+    return m_hid->m_nVMin;
+}
 
 int wxJoystick::GetXMax() const
-{	return m_hid->m_nXMax;	}
+{
+    return m_hid->m_nXMax;
+}
+
 int wxJoystick::GetYMax() const
-{	return m_hid->m_nYMax;	}
+{
+    return m_hid->m_nYMax;
+}
+
 int wxJoystick::GetZMax() const
-{	return m_hid->m_nZMax;	}
+{
+    return m_hid->m_nZMax;
+}
+
 int wxJoystick::GetRudderMax() const
-{	return m_hid->m_nRudderMax;	}
+{
+    return m_hid->m_nRudderMax;
+}
+
 int wxJoystick::GetUMax() const
-{	return m_hid->m_nUMax;	}
+{
+    return m_hid->m_nUMax;
+}
+
 int wxJoystick::GetVMax() const
-{	return m_hid->m_nVMax;	}
+{
+    return m_hid->m_nVMax;
+}
 
 //---------------------------------------------------------------------------
 // wxJoystick::Get[XXX]
@@ -371,13 +417,24 @@ int wxJoystick::GetVMax() const
 // what the linux port has.
 //---------------------------------------------------------------------------
 int wxJoystick::GetMaxButtons() const
-{	return wxJS_MAX_BUTTONS; 	}
+{
+    return wxJS_MAX_BUTTONS;
+}
+
 int wxJoystick::GetMaxAxes() const
-{	return wxJS_MAX_AXES; 	}
+{
+    return wxJS_MAX_AXES;
+}
+
 int wxJoystick::GetPollingMin() const
-{	return 10;	}
+{
+    return 10;
+}
+
 int wxJoystick::GetPollingMax() const
-{	return 1000;	}
+{
+    return 1000;
+}
 
 //---------------------------------------------------------------------------
 // wxJoystick::Has[XXX]
@@ -386,31 +443,61 @@ int wxJoystick::GetPollingMax() const
 // when enumerating the cookies of the joystick device
 //---------------------------------------------------------------------------
 bool wxJoystick::HasZ() const
-{	return m_hid->HasElement(wxJS_AXIS_Z);	}
+{
+    return m_hid->HasElement(wxJS_AXIS_Z);
+}
+
 bool wxJoystick::HasRudder() const
-{	return m_hid->HasElement(wxJS_AXIS_RUDDER);	}
+{
+    return m_hid->HasElement(wxJS_AXIS_RUDDER);
+}
+
 bool wxJoystick::HasU() const
-{	return m_hid->HasElement(wxJS_AXIS_U);	}
+{
+    return m_hid->HasElement(wxJS_AXIS_U);
+}
+
 bool wxJoystick::HasV() const
-{	return m_hid->HasElement(wxJS_AXIS_V);	}
+{
+    return m_hid->HasElement(wxJS_AXIS_V);
+}
 
 //---------------------------------------------------------------------------
 // UNSUPPORTED
 //---------------------------------------------------------------------------
 int wxJoystick::GetPOVPosition() const
-{	return -1;				}
+{
+    return -1;
+}
+
 int wxJoystick::GetPOVCTSPosition() const
-{	return -1;				}
+{
+    return -1;
+}
+
 int wxJoystick::GetMovementThreshold() const
-{	return 0;				}
+{
+    return 0;
+}
+
 void wxJoystick::SetMovementThreshold(int threshold)
-{							}
+{
+}
+
 bool wxJoystick::HasPOV() const
-{	return false;	}
+{
+    return false;
+}
+
 bool wxJoystick::HasPOV4Dir() const
-{	return false;	}
+{
+    return false;
+}
+
 bool wxJoystick::HasPOVCTS() const
-{	return false;	}
+{
+    return false;
+}
 
 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 //
@@ -420,7 +507,7 @@ bool wxJoystick::HasPOVCTS() const
 
 //---------------------------------------------------------------------------
 // wxHIDJoystick ctor
-// 
+//
 // Initializes the min/max members
 //---------------------------------------------------------------------------
 wxHIDJoystick::wxHIDJoystick() :
@@ -447,19 +534,19 @@ wxHIDJoystick::~wxHIDJoystick()
 bool wxHIDJoystick::Create(int nWhich)
 {
     int nJoysticks = GetCount(kHIDPage_GenericDesktop, kHIDUsage_GD_Joystick);
-    
+
     if (nWhich <= nJoysticks)
-        return wxHIDDevice::Create(kHIDPage_GenericDesktop, 
-                                   kHIDUsage_GD_Joystick, 
+        return wxHIDDevice::Create(kHIDPage_GenericDesktop,
+                                   kHIDUsage_GD_Joystick,
                                    nWhich);
     else
         nWhich -= nJoysticks;
-    
+
     int nGamePads = GetCount(kHIDPage_GenericDesktop, kHIDUsage_GD_GamePad);
-    
+
     if (nWhich <= nGamePads)
-        return wxHIDDevice::Create(kHIDPage_GenericDesktop, 
-                                   kHIDUsage_GD_GamePad, 
+        return wxHIDDevice::Create(kHIDPage_GenericDesktop,
+                                   kHIDUsage_GD_GamePad,
                                    nWhich);
     else
     return false;
@@ -472,20 +559,20 @@ bool wxHIDJoystick::Create(int nWhich)
 // Sets up the cookies for the HID device (called from Create) - as
 // mentioned 0-40 are the buttons and 40-50 are the axes.
 //
-// MakeCookies is just a recursive function for each array within 
+// MakeCookies is just a recursive function for each array within
 // BuildCookies.
 //---------------------------------------------------------------------------
 void wxHIDJoystick::BuildCookies(CFArrayRef Array)
 {
-	InitCookies(50, true);
+    InitCookies(50, true);
 
     //
     // I wasted two hours of my life on this line :(
     // accidently removed it during some source cleaning...
     //
     MakeCookies(Array);
-    
-    //paranoid debugging stuff    
+
+    //paranoid debugging stuff
 #if 0
     for(int i = 0; i < 50; ++i)
         wxPrintf(wxT("\nVAL #%i:[%i]"), i, m_pCookies[i]);
@@ -494,12 +581,12 @@ void wxHIDJoystick::BuildCookies(CFArrayRef Array)
 
 void wxHIDJoystick::MakeCookies(CFArrayRef Array)
 {
-	int i, nUsage, nPage;
+    int i, nUsage, nPage;
 
-	for (i = 0; i < CFArrayGetCount(Array); ++i)
+    for (i = 0; i < CFArrayGetCount(Array); ++i)
     {
         const void* ref = CFDictionaryGetValue(
-                (CFDictionaryRef)CFArrayGetValueAtIndex(Array, i), 
+                (CFDictionaryRef)CFArrayGetValueAtIndex(Array, i),
                 CFSTR(kIOHIDElementKey)
                                               );
 
@@ -510,22 +597,22 @@ void wxHIDJoystick::MakeCookies(CFArrayRef Array)
         else
         {
             CFNumberGetValue(
-			    (CFNumberRef) 
-			        CFDictionaryGetValue( 
-			            (CFDictionaryRef) CFArrayGetValueAtIndex(Array, i),
-			            CFSTR(kIOHIDElementUsageKey)
-			                            ), 
-		        kCFNumberIntType, 
-				&nUsage    );
-			
+                (CFNumberRef)
+                    CFDictionaryGetValue(
+                        (CFDictionaryRef) CFArrayGetValueAtIndex(Array, i),
+                        CFSTR(kIOHIDElementUsageKey)
+                                        ),
+                kCFNumberIntType,
+                &nUsage    );
+
             CFNumberGetValue(
-			    (CFNumberRef) 
-			        CFDictionaryGetValue(
-			            (CFDictionaryRef) CFArrayGetValueAtIndex(Array, i), 
-			            CFSTR(kIOHIDElementUsagePageKey)
-			                            ), 
-				kCFNumberIntType, 
-				&nPage     );
+                (CFNumberRef)
+                    CFDictionaryGetValue(
+                        (CFDictionaryRef) CFArrayGetValueAtIndex(Array, i),
+                        CFSTR(kIOHIDElementUsagePageKey)
+                                        ),
+                kCFNumberIntType,
+                &nPage     );
 
 #if 0
             wxLogSysError(wxT("[%i][%i]"), nUsage, nPage);
@@ -539,28 +626,28 @@ void wxHIDJoystick::MakeCookies(CFArrayRef Array)
                 {
                     case kHIDUsage_GD_X:
                         AddCookieInQueue(CFArrayGetValueAtIndex(Array, i), wxJS_AXIS_X);
-                        wxGetIntFromCFDictionary(CFArrayGetValueAtIndex(Array, i), 
+                        wxGetIntFromCFDictionary(CFArrayGetValueAtIndex(Array, i),
                                                  CFSTR(kIOHIDElementMaxKey),
                                                  &m_nXMax);
-                        wxGetIntFromCFDictionary(CFArrayGetValueAtIndex(Array, i), 
+                        wxGetIntFromCFDictionary(CFArrayGetValueAtIndex(Array, i),
                                                  CFSTR(kIOHIDElementMinKey),
                                                  &m_nXMin);
-                        break;                    
+                        break;
                     case kHIDUsage_GD_Y:
                         AddCookieInQueue(CFArrayGetValueAtIndex(Array, i), wxJS_AXIS_Y);
-                        wxGetIntFromCFDictionary(CFArrayGetValueAtIndex(Array, i), 
+                        wxGetIntFromCFDictionary(CFArrayGetValueAtIndex(Array, i),
                                                  CFSTR(kIOHIDElementMaxKey),
                                                  &m_nYMax);
-                        wxGetIntFromCFDictionary(CFArrayGetValueAtIndex(Array, i), 
+                        wxGetIntFromCFDictionary(CFArrayGetValueAtIndex(Array, i),
                                                  CFSTR(kIOHIDElementMinKey),
                                                  &m_nYMin);
                         break;
                     case kHIDUsage_GD_Z:
                         AddCookieInQueue(CFArrayGetValueAtIndex(Array, i), wxJS_AXIS_Z);
-                        wxGetIntFromCFDictionary(CFArrayGetValueAtIndex(Array, i), 
+                        wxGetIntFromCFDictionary(CFArrayGetValueAtIndex(Array, i),
                                                  CFSTR(kIOHIDElementMaxKey),
                                                  &m_nZMax);
-                        wxGetIntFromCFDictionary(CFArrayGetValueAtIndex(Array, i), 
+                        wxGetIntFromCFDictionary(CFArrayGetValueAtIndex(Array, i),
                                                  CFSTR(kIOHIDElementMinKey),
                                                  &m_nZMin);
                         break;
@@ -572,15 +659,15 @@ void wxHIDJoystick::MakeCookies(CFArrayRef Array)
             {
                 //rudder...
                 AddCookieInQueue(CFArrayGetValueAtIndex(Array, i), wxJS_AXIS_RUDDER );
-                wxGetIntFromCFDictionary(CFArrayGetValueAtIndex(Array, i), 
+                wxGetIntFromCFDictionary(CFArrayGetValueAtIndex(Array, i),
                                          CFSTR(kIOHIDElementMaxKey),
                                          &m_nRudderMax);
-                wxGetIntFromCFDictionary(CFArrayGetValueAtIndex(Array, i), 
+                wxGetIntFromCFDictionary(CFArrayGetValueAtIndex(Array, i),
                                          CFSTR(kIOHIDElementMinKey),
                                          &m_nRudderMin);
             }
         }
-	}
+    }
 }
 
 //---------------------------------------------------------------------------
@@ -589,9 +676,9 @@ void wxHIDJoystick::MakeCookies(CFArrayRef Array)
 // Simple accessors so that the HID callback and the thread procedure
 // can access members from wxHIDDevice (our parent here).
 //---------------------------------------------------------------------------
-IOHIDElementCookie* wxHIDJoystick::GetCookies() 
+IOHIDElementCookie* wxHIDJoystick::GetCookies()
 {   return m_pCookies;  }
-IOHIDQueueInterface** wxHIDJoystick::GetQueue() 
+IOHIDQueueInterface** wxHIDJoystick::GetQueue()
 {   return m_ppQueue;   }
 
 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@@ -637,16 +724,16 @@ void* wxJoystickThread::Entry()
         wxLogSysError(wxT("Couldn't create async event source"));
         return NULL;
     }
-    
+
     wxASSERT(pRLSource != NULL);
 
     //attach runloop source to main run loop in thread
     CFRunLoopRef pRL = CFRunLoopGetCurrent();
     CFRunLoopAddSource(pRL, pRLSource, kCFRunLoopDefaultMode);
     wxASSERT( CFRunLoopContainsSource(pRL, pRLSource, kCFRunLoopDefaultMode) );
-          
 
-    if( (*m_hid->GetQueue())->setEventCallout(m_hid->GetQueue(), 
+
+    if( (*m_hid->GetQueue())->setEventCallout(m_hid->GetQueue(),
           wxJoystickThread::HIDCallback, this, this) != kIOReturnSuccess )
     {
         wxLogSysError(wxT("Could not set event callout for queue"));
@@ -660,7 +747,7 @@ void* wxJoystickThread::Entry()
     }
 
     double dTime;
-    
+
     while(true)
     {
         if (TestDestroy())
@@ -674,16 +761,16 @@ void* wxJoystickThread::Entry()
         //true just "handles and returns" - false forces it to stay the time
         //amount
 #if 1
-        CFRunLoopRunInMode(kCFRunLoopDefaultMode, dTime, true);          
+        CFRunLoopRunInMode(kCFRunLoopDefaultMode, dTime, true);
 #else
         IOReturn ret = NULL;
         HIDCallback(this, ret, this, this);
         Sleep(3000);
 #endif
     }
-    
+
     wxASSERT( CFRunLoopContainsSource(pRL, pRLSource, kCFRunLoopDefaultMode) );
-    
+
     CFRunLoopRemoveSource(pRL, pRLSource, kCFRunLoopDefaultMode);
     CFRelease(pRLSource);
 
@@ -698,7 +785,7 @@ void* wxJoystickThread::Entry()
 // This is where the REAL dirty work gets done.
 //
 // 1) Loops through each event the queue has recieved
-// 2) First, checks if the thread that is running the loop for 
+// 2) First, checks if the thread that is running the loop for
 //    the polling has ended - if so it breaks out
 // 3) Next, it checks if there was an error getting this event from
 //    the HID queue, if there was, it logs an error and returns
@@ -708,7 +795,7 @@ void* wxJoystickThread::Entry()
 // 5) Sends the event to the polling window (if any)
 // 6) Gets the next event and goes back to (1)
 //---------------------------------------------------------------------------
-/*static*/ void wxJoystickThread::HIDCallback(void* target, IOReturn res, 
+/*static*/ void wxJoystickThread::HIDCallback(void* target, IOReturn res,
                                               void* context, void* sender)
 {
     IOHIDEventStruct hidevent;
@@ -716,13 +803,13 @@ void* wxJoystickThread::Entry()
     IOReturn ret;
     wxJoystickThread* pThis = (wxJoystickThread*) context;
     wxHIDJoystick* m_hid = pThis->m_hid;
-    
+
     //Get the "first" event from the queue
     //bogustime tells it we don't care at what time to start
     //where it gets the next from
-    ret = (*m_hid->GetQueue())->getNextEvent(m_hid->GetQueue(), 
+    ret = (*m_hid->GetQueue())->getNextEvent(m_hid->GetQueue(),
                     &hidevent, bogustime, 0);
-    
+
     while (ret != kIOReturnUnderrun)
     {
         if (pThis->TestDestroy())
@@ -732,10 +819,10 @@ void* wxJoystickThread::Entry()
         {
             wxLogSysError(wxString::Format(wxT("wxJoystick Error:[%i]"), ret));
             return;
-        }	
-            
+        }
+
         wxJoystickEvent wxevent;
-        
+
         //Find the cookie that changed
         int nIndex = 0;
         IOHIDElementCookie* pCookies = m_hid->GetCookies();
@@ -743,20 +830,20 @@ void* wxJoystickThread::Entry()
         {
             if(hidevent.elementCookie == pCookies[nIndex])
                 break;
-                
+
             ++nIndex;
-        } 
-        
+        }
+
         //debugging stuff
 #if 0
-        if(nIndex == 50) 
+        if(nIndex == 50)
         {
             wxLogSysError(wxString::Format(wxT("wxJoystick Out Of Bounds Error")));
             break;
-        }	
+        }
 #endif
 
-        //is the cookie a button?    
+        //is the cookie a button?
         if (nIndex < 40)
         {
             if (hidevent.value)
@@ -790,14 +877,14 @@ void* wxJoystickThread::Entry()
             pThis->m_axe[2] = hidevent.value;
         }
         else
-            wxevent.SetEventType(wxEVT_JOY_MOVE);            
+            wxevent.SetEventType(wxEVT_JOY_MOVE);
 
         Nanoseconds timestamp = AbsoluteToNanoseconds(hidevent.timestamp);
-        
+
         wxULongLong llTime(timestamp.hi, timestamp.lo);
-        
+
         llTime /= 1000000;
-        
+
         wxevent.SetTimestamp(llTime.GetValue());
         wxevent.SetJoystick(pThis->m_joystick);
         wxevent.SetButtonState(pThis->m_buttons);
@@ -806,12 +893,11 @@ void* wxJoystickThread::Entry()
         wxevent.SetEventObject(pThis->m_catchwin);
 
         if (pThis->m_catchwin)
-            pThis->m_catchwin->AddPendingEvent(wxevent);            
+            pThis->m_catchwin->AddPendingEvent(wxevent);
 
-        ret = (*m_hid->GetQueue())->getNextEvent(m_hid->GetQueue(), 
+        ret = (*m_hid->GetQueue())->getNextEvent(m_hid->GetQueue(),
                     &hidevent, bogustime, 0);
     }
 }
 
 #endif // wxUSE_JOYSTICK && defined(__DARWIN__)
-
diff --git a/src/mgl/bitmap.cpp b/src/mgl/bitmap.cpp
index 89014b388e..e65eabae6d 100644
--- a/src/mgl/bitmap.cpp
+++ b/src/mgl/bitmap.cpp
@@ -17,6 +17,7 @@
 
 #ifndef WX_PRECOMP
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/icon.h"
@@ -24,7 +25,6 @@
 #include "wx/image.h"
 #include "wx/dcmemory.h"
 #include "wx/utils.h"
-#include "wx/log.h"
 #include "wx/image.h"
 #include "wx/xpmdecod.h"
 
diff --git a/src/mgl/cursor.cpp b/src/mgl/cursor.cpp
index 97e4f7c7e2..d678b261ee 100644
--- a/src/mgl/cursor.cpp
+++ b/src/mgl/cursor.cpp
@@ -18,11 +18,11 @@
 
 #ifndef WX_PRECOMP
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/module.h"
 #include "wx/utils.h"
-#include "wx/log.h"
 #include "wx/hashmap.h"
 
 #include "wx/mgl/private.h"
diff --git a/src/mgl/dc.cpp b/src/mgl/dc.cpp
index c3026cb75e..d26d4684f6 100644
--- a/src/mgl/dc.cpp
+++ b/src/mgl/dc.cpp
@@ -26,13 +26,13 @@
 #ifndef WX_PRECOMP
     #include "wx/dc.h"
     #include "wx/dcmemory.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/fontutil.h"
 #include "wx/encinfo.h"
 #include "wx/fontmap.h"
 #include "wx/mgl/private.h"
-#include "wx/log.h"
 
 #include <string.h>
 #include <mgraph.hpp>
diff --git a/src/mgl/font.cpp b/src/mgl/font.cpp
index b47e45b322..d619798ed0 100644
--- a/src/mgl/font.cpp
+++ b/src/mgl/font.cpp
@@ -22,10 +22,14 @@
 #endif
 
 #include "wx/font.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/fontutil.h"
 #include "wx/cmndata.h"
 #include "wx/utils.h"
-#include "wx/log.h"
 #include "wx/gdicmn.h"
 #include "wx/tokenzr.h"
 #include "wx/settings.h"
@@ -184,7 +188,7 @@ struct font_t *wxFont::GetMGLfont_t(float scale, bool antialiased)
             old->DecRef();
     }
 
-    wxMGLFontInstance *instance = 
+    wxMGLFontInstance *instance =
         M_FONTDATA->m_library->GetFontInstance(this, scale, antialiased);
 
     return instance->GetMGLfont_t();
diff --git a/src/mgl/fontutil.cpp b/src/mgl/fontutil.cpp
index f096ee1547..5e202b2c75 100644
--- a/src/mgl/fontutil.cpp
+++ b/src/mgl/fontutil.cpp
@@ -17,9 +17,9 @@
 
 #ifndef WX_PRECOMP
     #include "wx/hash.h"
+    #include "wx/log.h"
 #endif
 
-#include "wx/log.h"
 #include "wx/fontutil.h"
 #include "wx/encinfo.h"
 #include "wx/fontmap.h"
diff --git a/src/mgl/utils.cpp b/src/mgl/utils.cpp
index 415af9a973..7bd3338d3b 100644
--- a/src/mgl/utils.cpp
+++ b/src/mgl/utils.cpp
@@ -19,10 +19,10 @@
 #ifndef WX_PRECOMP
     #include "wx/string.h"
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/apptrait.h"
-#include "wx/log.h"
 #include "wx/process.h"
 
 #include <stdarg.h>
diff --git a/src/mgl/window.cpp b/src/mgl/window.cpp
index e172402295..db89438703 100644
--- a/src/mgl/window.cpp
+++ b/src/mgl/window.cpp
@@ -34,13 +34,13 @@
     #include "wx/app.h"
     #include "wx/panel.h"
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #if wxUSE_DRAG_AND_DROP
     #include "wx/dnd.h"
 #endif
 
-#include "wx/log.h"
 #include "wx/sysopt.h"
 #include "wx/mgl/private.h"
 #include "wx/dcscreen.h"
diff --git a/src/motif/app.cpp b/src/motif/app.cpp
index 61fb696597..5ed71e7572 100644
--- a/src/motif/app.cpp
+++ b/src/motif/app.cpp
@@ -22,12 +22,12 @@
 #ifndef WX_PRECOMP
     #include "wx/hash.h"
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/utils.h"
 #include "wx/module.h"
 #include "wx/memory.h"
-#include "wx/log.h"
 #include "wx/evtloop.h"
 
 #if wxUSE_THREADS
diff --git a/src/motif/dcclient.cpp b/src/motif/dcclient.cpp
index 2c22186df2..c68155bd6c 100644
--- a/src/motif/dcclient.cpp
+++ b/src/motif/dcclient.cpp
@@ -40,11 +40,15 @@
 #include "wx/wxprec.h"
 
 #include "wx/dcclient.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/dcmemory.h"
 #include "wx/window.h"
 #include "wx/app.h"
 #include "wx/image.h"
-#include "wx/log.h"
 #include "wx/math.h"
 
 #ifdef __VMS__
diff --git a/src/motif/dnd.cpp b/src/motif/dnd.cpp
index 20b664b8df..5606dea151 100644
--- a/src/motif/dnd.cpp
+++ b/src/motif/dnd.cpp
@@ -16,13 +16,13 @@
 
 #ifndef WX_PRECOMP
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/window.h"
 #include "wx/app.h"
 #include "wx/gdicmn.h"
 #include "wx/utils.h"
-#include "wx/log.h"
 
 #include <X11/Xlib.h>
 
diff --git a/src/motif/frame.cpp b/src/motif/frame.cpp
index 562720af2d..2b8b45d396 100644
--- a/src/motif/frame.cpp
+++ b/src/motif/frame.cpp
@@ -27,12 +27,16 @@
 #endif
 
 #include "wx/frame.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/statusbr.h"
 #include "wx/toolbar.h"
 #include "wx/menu.h"
 #include "wx/settings.h"
 #include "wx/utils.h"
-#include "wx/log.h"
 #include "wx/app.h"
 #include "wx/icon.h"
 
diff --git a/src/motif/listbox.cpp b/src/motif/listbox.cpp
index 23bd098612..1158c22fe0 100644
--- a/src/motif/listbox.cpp
+++ b/src/motif/listbox.cpp
@@ -14,8 +14,11 @@
 
 #if wxUSE_LISTBOX
 
+#include "wx/listbox.h"
+
 #ifndef WX_PRECOMP
     #include "wx/dynarray.h"
+    #include "wx/log.h"
 #endif
 
 #ifdef __VMS
@@ -23,9 +26,7 @@
 #define XtDisplay XTDISPLAY
 #endif
 
-#include "wx/listbox.h"
 #include "wx/settings.h"
-#include "wx/log.h"
 #include "wx/utils.h"
 #include "wx/arrstr.h"
 
diff --git a/src/motif/menu.cpp b/src/motif/menu.cpp
index 21d7a88ac0..1f508801cd 100644
--- a/src/motif/menu.cpp
+++ b/src/motif/menu.cpp
@@ -21,8 +21,12 @@
 #include "wx/wxprec.h"
 
 #include "wx/menu.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/menuitem.h"
-#include "wx/log.h"
 #include "wx/utils.h"
 #include "wx/app.h"
 #include "wx/frame.h"
diff --git a/src/motif/window.cpp b/src/motif/window.cpp
index 7eab9dcd37..b9df787ce5 100644
--- a/src/motif/window.cpp
+++ b/src/motif/window.cpp
@@ -28,6 +28,7 @@
 
 #ifndef WX_PRECOMP
     #include "wx/hash.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/menu.h"
@@ -42,7 +43,6 @@
 #include "wx/scrolwin.h"
 #include "wx/module.h"
 #include "wx/menuitem.h"
-#include "wx/log.h"
 #include "wx/evtloop.h"
 
 #if  wxUSE_DRAG_AND_DROP
diff --git a/src/msdos/mimetype.cpp b/src/msdos/mimetype.cpp
index 76e2e53686..0be46cd73d 100644
--- a/src/msdos/mimetype.cpp
+++ b/src/msdos/mimetype.cpp
@@ -24,12 +24,12 @@
     #include "wx/dynarray.h"
     #include "wx/string.h"
     #include "wx/intl.h"
+    #include "wx/log.h"
     #if wxUSE_GUI
         #include "wx/icon.h"
     #endif
 #endif //WX_PRECOMP
 
-#include "wx/log.h"
 #include "wx/file.h"
 #include "wx/confbase.h"
 
diff --git a/src/msdos/utilsdos.cpp b/src/msdos/utilsdos.cpp
index d20fc302d8..2507bc711c 100644
--- a/src/msdos/utilsdos.cpp
+++ b/src/msdos/utilsdos.cpp
@@ -20,10 +20,10 @@
 #ifndef WX_PRECOMP
     #include "wx/string.h"
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/apptrait.h"
-#include "wx/log.h"
 #include "wx/process.h"
 #include "wx/confbase.h"        // for wxExpandEnvVars()
 #include "wx/app.h"
diff --git a/src/msw/bitmap.cpp b/src/msw/bitmap.cpp
index ebcaac1652..789fc53acf 100644
--- a/src/msw/bitmap.cpp
+++ b/src/msw/bitmap.cpp
@@ -34,10 +34,10 @@
     #include "wx/dcmemory.h"
     #include "wx/bitmap.h"
     #include "wx/icon.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/msw/private.h"
-#include "wx/log.h"
 
 #if wxUSE_WXDIB
 #include "wx/msw/dib.h"
diff --git a/src/msw/clipbrd.cpp b/src/msw/clipbrd.cpp
index 23cd2cce07..59d6f2fcb0 100644
--- a/src/msw/clipbrd.cpp
+++ b/src/msw/clipbrd.cpp
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        clipbrd.cpp
+// Name:        src/msw/clipbrd.cpp
 // Purpose:     Clipboard functionality
 // Author:      Julian Smart
 // Modified by:
@@ -26,6 +26,8 @@
 
 #if wxUSE_CLIPBOARD
 
+#include "wx/clipbrd.h"
+
 #ifndef WX_PRECOMP
     #include "wx/object.h"
     #include "wx/event.h"
@@ -34,14 +36,13 @@
     #include "wx/bitmap.h"
     #include "wx/utils.h"
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #if wxUSE_METAFILE
     #include "wx/metafile.h"
 #endif
 
-#include "wx/log.h"
-#include "wx/clipbrd.h"
 
 #include <string.h>
 
@@ -931,4 +932,3 @@ bool wxClipboard::GetData( wxDataObject& data )
 }
 
 #endif // wxUSE_CLIPBOARD
-
diff --git a/src/msw/dcclient.cpp b/src/msw/dcclient.cpp
index 080af680d2..890f27dffd 100644
--- a/src/msw/dcclient.cpp
+++ b/src/msw/dcclient.cpp
@@ -28,9 +28,9 @@
 
 #ifndef WX_PRECOMP
     #include "wx/string.h"
+    #include "wx/log.h"
 #endif
 
-#include "wx/log.h"
 #include "wx/window.h"
 
 #include "wx/msw/private.h"
diff --git a/src/msw/dialog.cpp b/src/msw/dialog.cpp
index b01e767cfb..c34f333ba5 100644
--- a/src/msw/dialog.cpp
+++ b/src/msw/dialog.cpp
@@ -36,7 +36,6 @@
 #endif
 
 #include "wx/msw/private.h"
-#include "wx/log.h"
 #include "wx/evtloop.h"
 #include "wx/ptr_scpd.h"
 
diff --git a/src/msw/dragimag.cpp b/src/msw/dragimag.cpp
index fa0cb61a72..01e42a155d 100644
--- a/src/msw/dragimag.cpp
+++ b/src/msw/dragimag.cpp
@@ -34,10 +34,10 @@
     #include "wx/dcmemory.h"
     #include "wx/settings.h"
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/msw/private.h"
-#include "wx/log.h"
 #include "wx/frame.h"
 #include "wx/image.h"
 
diff --git a/src/msw/fontdlg.cpp b/src/msw/fontdlg.cpp
index d0bcd12089..7011de08ea 100644
--- a/src/msw/fontdlg.cpp
+++ b/src/msw/fontdlg.cpp
@@ -29,13 +29,13 @@
 #ifndef WX_PRECOMP
     #include "wx/utils.h"
     #include "wx/dialog.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/fontdlg.h"
 #include "wx/msw/wrapcdlg.h"
 
 #include "wx/cmndata.h"
-#include "wx/log.h"
 #include "wx/math.h"
 
 #include <stdlib.h>
diff --git a/src/msw/frame.cpp b/src/msw/frame.cpp
index 1f06b6cefe..1d7e46da63 100644
--- a/src/msw/frame.cpp
+++ b/src/msw/frame.cpp
@@ -34,6 +34,7 @@
     #include "wx/dcclient.h"
     #include "wx/mdi.h"
     #include "wx/panel.h"
+    #include "wx/log.h"
 #endif // WX_PRECOMP
 
 #include "wx/msw/private.h"
@@ -58,7 +59,6 @@
 #endif // wxUSE_TOOLBAR
 
 #include "wx/menuitem.h"
-#include "wx/log.h"
 
 #ifdef __WXUNIVERSAL__
     #include "wx/univ/theme.h"
diff --git a/src/msw/imaglist.cpp b/src/msw/imaglist.cpp
index 69e7c27e11..7a42766424 100644
--- a/src/msw/imaglist.cpp
+++ b/src/msw/imaglist.cpp
@@ -31,11 +31,11 @@
     #include "wx/string.h"
     #include "wx/dcmemory.h"
     #include "wx/intl.h"
+    #include "wx/log.h"
 
     #include <stdio.h>
 #endif
 
-#include "wx/log.h"
 #include "wx/image.h"
 
 #include "wx/msw/imaglist.h"
diff --git a/src/msw/iniconf.cpp b/src/msw/iniconf.cpp
index 5761d72e19..6c0617bb2f 100644
--- a/src/msw/iniconf.cpp
+++ b/src/msw/iniconf.cpp
@@ -27,9 +27,9 @@
     #include  "wx/event.h"
     #include  "wx/app.h"
     #include  "wx/utils.h"
+    #include  "wx/log.h"
 #endif  //WX_PRECOMP
 
-#include  "wx/log.h"
 #include  "wx/config.h"
 #include  "wx/file.h"
 
diff --git a/src/msw/listbox.cpp b/src/msw/listbox.cpp
index f5c67dba29..e9e500591e 100644
--- a/src/msw/listbox.cpp
+++ b/src/msw/listbox.cpp
@@ -26,6 +26,7 @@
     #include "wx/font.h"
     #include "wx/dc.h"
     #include "wx/utils.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/window.h"
@@ -33,8 +34,6 @@
 
 #include <windowsx.h>
 
-#include "wx/log.h"
-
 #if wxUSE_OWNER_DRAWN
     #include  "wx/ownerdrw.h"
 #endif
diff --git a/src/msw/mediactrl.cpp b/src/msw/mediactrl.cpp
index d99997daed..4ecc52bd13 100644
--- a/src/msw/mediactrl.cpp
+++ b/src/msw/mediactrl.cpp
@@ -27,23 +27,17 @@
 #include "wx/wxprec.h"
 
 #ifdef __BORLANDC__
-#pragma hdrstop
+    #pragma hdrstop
 #endif
 
-//---------------------------------------------------------------------------
-// MediaCtrl include
-//---------------------------------------------------------------------------
+#if wxUSE_MEDIACTRL
+
 #include "wx/mediactrl.h"
 
-//---------------------------------------------------------------------------
-// Compilation guard
-//---------------------------------------------------------------------------
-#if wxUSE_MEDIACTRL
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
 
-//---------------------------------------------------------------------------
-// WX Includes
-//---------------------------------------------------------------------------
-#include "wx/log.h"         // wxLogDebug
 #include "wx/math.h"        // log10 & pow
 #include "wx/msw/private.h" // user info and wndproc setting/getting
 #include "wx/dcclient.h"
@@ -4179,7 +4173,4 @@ void wxQTMediaEvtHandler::OnEraseBackground(wxEraseEvent& evt)
 #include "wx/html/forcelnk.h"
 FORCE_LINK_ME(basewxmediabackends)
 
-//---------------------------------------------------------------------------
-//  End wxMediaCtrl Compilation Guard and this file
-//---------------------------------------------------------------------------
 #endif //wxUSE_MEDIACTRL
diff --git a/src/msw/mediactrl_am.cpp b/src/msw/mediactrl_am.cpp
index 52644f1bc8..72e4008b9a 100644
--- a/src/msw/mediactrl_am.cpp
+++ b/src/msw/mediactrl_am.cpp
@@ -47,7 +47,7 @@
 #include "wx/wxprec.h"
 
 #ifdef __BORLANDC__
-#pragma hdrstop
+    #pragma hdrstop
 #endif
 
 // disable "cast truncates constant value" for VARIANT_BOOL values
@@ -56,20 +56,14 @@
 #pragma warning (disable:4310)
 #endif
 
-//---------------------------------------------------------------------------
-// MediaCtrl include
-//---------------------------------------------------------------------------
+#if wxUSE_MEDIACTRL
+
 #include "wx/mediactrl.h"
 
-//---------------------------------------------------------------------------
-// Compilation guard
-//---------------------------------------------------------------------------
-#if wxUSE_MEDIACTRL
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
 
-//---------------------------------------------------------------------------
-// WX Includes
-//---------------------------------------------------------------------------
-#include "wx/log.h"         // wxLogDebug
 #include "wx/math.h"        // log10 & pow
 #include "wx/msw/private.h" // user info and wndproc setting/getting
 #include "wx/dcclient.h"
@@ -2263,7 +2257,4 @@ void wxAMMediaEvtHandler::OnActiveX(wxActiveXEvent& event)
 #include "wx/html/forcelnk.h"
 FORCE_LINK_ME(wxmediabackend_am)
 
-//---------------------------------------------------------------------------
-//  End wxMediaCtrl Compilation Guard and this file
-//---------------------------------------------------------------------------
 #endif // wxUSE_MEDIACTRL
diff --git a/src/msw/mediactrl_wmp10.cpp b/src/msw/mediactrl_wmp10.cpp
index e1f8e1d088..2dc26fdbdf 100644
--- a/src/msw/mediactrl_wmp10.cpp
+++ b/src/msw/mediactrl_wmp10.cpp
@@ -50,20 +50,14 @@
 #pragma hdrstop
 #endif
 
-//---------------------------------------------------------------------------
-// MediaCtrl include
-//---------------------------------------------------------------------------
+#if wxUSE_MEDIACTRL
+
 #include "wx/mediactrl.h"
 
-//---------------------------------------------------------------------------
-// Compilation guard
-//---------------------------------------------------------------------------
-#if wxUSE_MEDIACTRL
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
 
-//---------------------------------------------------------------------------
-// WX Includes
-//---------------------------------------------------------------------------
-#include "wx/log.h"         // wxLogDebug
 #include "wx/msw/private.h" // user info and wndproc setting/getting
 #include "wx/msw/ole/activex.h" // wxActiveXContainer - COM-specific stuff
 
@@ -1515,7 +1509,4 @@ bool MyApp::OnInit()
 
 #endif // WMP mobile 9 hacks
 
-//---------------------------------------------------------------------------
-//  End wxMediaCtrl Compilation Guard and this file
-//---------------------------------------------------------------------------
 #endif // wxUSE_MEDIACTRL
diff --git a/src/msw/menuitem.cpp b/src/msw/menuitem.cpp
index 6c0d6cf358..085dc6e47f 100644
--- a/src/msw/menuitem.cpp
+++ b/src/msw/menuitem.cpp
@@ -1,5 +1,5 @@
 ///////////////////////////////////////////////////////////////////////////////
-// Name:        menuitem.cpp
+// Name:        src/msw/menuitem.cpp
 // Purpose:     wxMenuItem implementation
 // Author:      Vadim Zeitlin
 // Modified by:
@@ -26,6 +26,8 @@
 
 #if wxUSE_MENUS
 
+#include "wx/menu.h"
+
 #ifndef WX_PRECOMP
     #include "wx/font.h"
     #include "wx/bitmap.h"
@@ -33,12 +35,11 @@
     #include "wx/font.h"
     #include "wx/window.h"
     #include "wx/accel.h"
-    #include "wx/menu.h"
     #include "wx/string.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/menuitem.h"
-#include "wx/log.h"
 
 #if wxUSE_ACCEL
     #include "wx/accel.h"
@@ -399,7 +400,7 @@ void wxMenuItem::SetText(const wxString& text)
         info.cbSize = sizeof(info);
         info.fMask = MIIM_TYPE;
         info.fType = MFT_STRING;
-        info.cch = text.Length();
+        info.cch = text.length();
         info.dwTypeData = (LPTSTR) data ;
         if ( !::SetMenuItemInfo(hMenu, id, FALSE, & info) )
         {
diff --git a/src/msw/mimetype.cpp b/src/msw/mimetype.cpp
index 7e78e570da..4720084cba 100644
--- a/src/msw/mimetype.cpp
+++ b/src/msw/mimetype.cpp
@@ -24,13 +24,13 @@
     #include "wx/dynarray.h"
     #include "wx/string.h"
     #include "wx/intl.h"
+    #include "wx/log.h"
     #if wxUSE_GUI
         #include "wx/icon.h"
         #include "wx/msgdlg.h"
     #endif
 #endif //WX_PRECOMP
 
-#include "wx/log.h"
 #include "wx/file.h"
 #include "wx/iconloc.h"
 #include "wx/confbase.h"
diff --git a/src/msw/notebook.cpp b/src/msw/notebook.cpp
index 80f2fc7030..2cca530065 100644
--- a/src/msw/notebook.cpp
+++ b/src/msw/notebook.cpp
@@ -18,17 +18,17 @@
 
 #if wxUSE_NOTEBOOK
 
-// wxWidgets
+#include  "wx/notebook.h"
+
 #ifndef WX_PRECOMP
-  #include  "wx/string.h"
-  #include  "wx/dc.h"
+    #include  "wx/string.h"
+    #include  "wx/dc.h"
+    #include  "wx/log.h"
 #endif  // WX_PRECOMP
 
-#include  "wx/log.h"
 #include  "wx/imaglist.h"
 #include  "wx/event.h"
 #include  "wx/control.h"
-#include  "wx/notebook.h"
 #include  "wx/app.h"
 #include  "wx/sysopt.h"
 #include  "wx/dcclient.h"
@@ -275,7 +275,7 @@ bool wxNotebook::Create(wxWindow *parent,
         style |= wxBORDER_SUNKEN;
 #endif
 
-#if !wxUSE_UXTHEME 
+#if !wxUSE_UXTHEME
     // ComCtl32 notebook tabs simply don't work unless they're on top if we have uxtheme, we can
     // work around it later (after control creation), but if we don't have uxtheme, we have to clear
     // those styles
@@ -345,14 +345,14 @@ bool wxNotebook::Create(wxWindow *parent,
         // create backing store
         UpdateBgBrush();
     }
-    
+
     // comctl32.dll 6.0 doesn't support non-top tabs with visual styles (the
     // control is simply not rendered correctly), so we disable themes
     // if possible, otherwise we simply clear the styles.
     // It's probably not possible to have UXTHEME without ComCtl32 6 or better, but lets
     // check it anyway.
     const int verComCtl32 = wxApp::GetComCtl32Version();
-    if ( verComCtl32 == 600 ) 
+    if ( verComCtl32 == 600 )
     {
         // check if we use themes at all -- if we don't, we're still okay
         if ( wxUxThemeEngine::GetIfActive() && (style & (wxBK_BOTTOM|wxBK_LEFT|wxBK_RIGHT)))
@@ -861,7 +861,7 @@ void wxNotebook::OnPaint(wxPaintEvent& WXUNUSED(event))
     HBRUSH hbr = (HBRUSH)m_hbrBackground;
 #else
     HBRUSH hbr = 0;
-#endif    
+#endif
     wxBrush brush;
     if ( !hbr )
     {
diff --git a/src/msw/ole/access.cpp b/src/msw/ole/access.cpp
index 56f871eece..e168dda881 100644
--- a/src/msw/ole/access.cpp
+++ b/src/msw/ole/access.cpp
@@ -24,15 +24,15 @@
   #pragma hdrstop
 #endif
 
-#ifndef WX_PRECOMP
-    #include "wx/window.h"
-#endif
-
 #if wxUSE_OLE && wxUSE_ACCESSIBILITY
 
-#include "wx/log.h"
 #include "wx/access.h"
 
+#ifndef WX_PRECOMP
+    #include "wx/window.h"
+    #include "wx/log.h"
+#endif
+
 #include "wx/msw/wrapwin.h"
 
 // for some compilers, the entire ole2.h must be included, not only oleauto.h
@@ -1991,4 +1991,4 @@ wxAccSelectionFlags wxConvertFromWindowsSelFlag(int sel)
 }
 
 
-#endif  //USE_ACCESSIBILITY
+#endif  // wxUSE_OLE && wxUSE_ACCESSIBILITY
diff --git a/src/msw/ole/automtn.cpp b/src/msw/ole/automtn.cpp
index 548ac661a8..28464845af 100644
--- a/src/msw/ole/automtn.cpp
+++ b/src/msw/ole/automtn.cpp
@@ -20,8 +20,11 @@
 // With Borland C++, all samples crash if this is compiled in.
 #if wxUSE_OLE && !(defined(__BORLANDC__) && (__BORLANDC__ < 0x520)) && !defined(__CYGWIN10__)
 
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #define _FORCENAMELESSUNION
-#include "wx/log.h"
 #include "wx/msw/private.h"
 #include "wx/msw/ole/oleutils.h"
 #include "wx/msw/ole/automtn.h"
@@ -88,7 +91,7 @@ bool wxAutomationObject::Invoke(const wxString& member, int action,
     {
         // Use dot notation to get the next object
         wxString member2(nonConstMember.Left((size_t) ch));
-        wxString rest(nonConstMember.Right(nonConstMember.Length() - ch - 1));
+        wxString rest(nonConstMember.Right(nonConstMember.length() - ch - 1));
         wxAutomationObject obj;
         if (!GetObject(obj, member2))
             return false;
diff --git a/src/msw/ole/dropsrc.cpp b/src/msw/ole/dropsrc.cpp
index 91dcb37866..90f89d419e 100644
--- a/src/msw/ole/dropsrc.cpp
+++ b/src/msw/ole/dropsrc.cpp
@@ -24,13 +24,13 @@
   #pragma hdrstop
 #endif
 
+#if wxUSE_OLE && wxUSE_DRAG_AND_DROP
+
 #ifndef WX_PRECOMP
     #include "wx/window.h"
+    #include "wx/log.h"
 #endif
 
-#if wxUSE_OLE && wxUSE_DRAG_AND_DROP
-
-#include "wx/log.h"
 #include "wx/dnd.h"
 
 #include "wx/msw/private.h"
@@ -245,4 +245,4 @@ bool wxDropSource::GiveFeedback(wxDragResult effect)
     }
 }
 
-#endif  //USE_DRAG_AND_DROP
+#endif  // wxUSE_OLE && wxUSE_DRAG_AND_DROP
diff --git a/src/msw/ole/droptgt.cpp b/src/msw/ole/droptgt.cpp
index e3d3791d26..1301f08d47 100644
--- a/src/msw/ole/droptgt.cpp
+++ b/src/msw/ole/droptgt.cpp
@@ -21,13 +21,16 @@
 #include "wx/wxprec.h"
 
 #if defined(__BORLANDC__)
-#pragma hdrstop
+    #pragma hdrstop
 #endif
 
 #if wxUSE_OLE && wxUSE_DRAG_AND_DROP
 
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/msw/private.h"
-#include "wx/log.h"
 
 #ifdef __WXWINCE__
     #include <winreg.h>
@@ -544,5 +547,4 @@ static DWORD ConvertDragResultToEffect(wxDragResult result)
     }
 }
 
-#endif
- // wxUSE_DRAG_AND_DROP
+#endif // wxUSE_OLE && wxUSE_DRAG_AND_DROP
diff --git a/src/msw/ole/oleutils.cpp b/src/msw/ole/oleutils.cpp
index 6c9e409042..058f4afd87 100644
--- a/src/msw/ole/oleutils.cpp
+++ b/src/msw/ole/oleutils.cpp
@@ -21,13 +21,15 @@
 #include "wx/wxprec.h"
 
 #if defined(__BORLANDC__)
-#pragma hdrstop
+    #pragma hdrstop
 #endif
 
-#include  "wx/log.h"
-
 #if wxUSE_OLE
 
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #ifndef __CYGWIN10__
 
 #include "wx/msw/private.h"
diff --git a/src/msw/printwin.cpp b/src/msw/printwin.cpp
index a8e3297d5a..82fcaf46d8 100644
--- a/src/msw/printwin.cpp
+++ b/src/msw/printwin.cpp
@@ -36,12 +36,12 @@
     #include "wx/app.h"
     #include "wx/msgdlg.h"
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/msw/printwin.h"
 #include "wx/dcprint.h"
 #include "wx/printdlg.h"
-#include "wx/log.h"
 #include "wx/msw/private.h"
 
 #include <stdlib.h>
diff --git a/src/msw/regconf.cpp b/src/msw/regconf.cpp
index 4684ba9188..1c9892c0b9 100644
--- a/src/msw/regconf.cpp
+++ b/src/msw/regconf.cpp
@@ -1,5 +1,5 @@
 ///////////////////////////////////////////////////////////////////////////////
-// Name:        msw/regconf.cpp
+// Name:        src/msw/regconf.cpp
 // Purpose:
 // Author:      Vadim Zeitlin
 // Modified by:
@@ -13,21 +13,21 @@
 #include "wx/wxprec.h"
 
 #ifdef __BORLANDC__
-#pragma hdrstop
+    #pragma hdrstop
 #endif
 
+#if wxUSE_CONFIG
+
+#include "wx/config.h"
+
 #ifndef WX_PRECOMP
-  #include  "wx/string.h"
-  #include  "wx/intl.h"
+    #include  "wx/string.h"
+    #include  "wx/intl.h"
+    #include "wx/log.h"
 #endif //WX_PRECOMP
 
 #include "wx/event.h"
 #include "wx/app.h"
-#include "wx/log.h"
-
-#if wxUSE_CONFIG
-
-#include "wx/config.h"
 
 #include "wx/msw/registry.h"
 #include "wx/msw/regconf.h"
@@ -76,9 +76,9 @@ wxRegConfig::wxRegConfig(const wxString& appName, const wxString& vendorName,
   // the convention is to put the programs keys under <vendor>\<appname>
   // (but it can be overriden by specifying the pathes explicitly in strLocal
   // and/or strGlobal)
-  if ( strLocal.IsEmpty() || (strGlobal.IsEmpty() && bDoUseGlobal) )
+  if ( strLocal.empty() || (strGlobal.empty() && bDoUseGlobal) )
   {
-    if ( vendorName.IsEmpty() )
+    if ( vendorName.empty() )
     {
       if ( wxTheApp )
         strRoot = wxTheApp->GetVendorName();
@@ -89,12 +89,12 @@ wxRegConfig::wxRegConfig(const wxString& appName, const wxString& vendorName,
     }
 
     // no '\\' needed if no vendor name
-    if ( !strRoot.IsEmpty() )
+    if ( !strRoot.empty() )
     {
       strRoot += '\\';
     }
 
-    if ( appName.IsEmpty() )
+    if ( appName.empty() )
     {
       wxCHECK_RET( wxTheApp, wxT("No application name in wxRegConfig ctor!") );
       strRoot << wxTheApp->GetAppName();
@@ -106,7 +106,7 @@ wxRegConfig::wxRegConfig(const wxString& appName, const wxString& vendorName,
   }
   //else: we don't need to do all the complicated stuff above
 
-  wxString str = strLocal.IsEmpty() ? strRoot : strLocal;
+  wxString str = strLocal.empty() ? strRoot : strLocal;
 
   // as we're going to change the name of these keys fairly often and as
   // there are only few of wxRegConfig objects (usually 1), we can allow
@@ -122,7 +122,7 @@ wxRegConfig::wxRegConfig(const wxString& appName, const wxString& vendorName,
 
   if ( bDoUseGlobal )
   {
-    str = strGlobal.IsEmpty() ? strRoot : strGlobal;
+    str = strGlobal.empty() ? strRoot : strGlobal;
 
     m_keyGlobalRoot.ReserveMemoryForName(MEMORY_PREALLOC);
     m_keyGlobal.ReserveMemoryForName(MEMORY_PREALLOC);
@@ -171,7 +171,7 @@ void wxRegConfig::SetPath(const wxString& strPath)
 
         // because GetPath() returns "" when we're at root, we must understand
         // empty string as "/"
-        if ( strPath.IsEmpty() || (strPath[0] == wxCONFIG_PATH_SEPARATOR) ) {
+        if ( strPath.empty() || (strPath[0] == wxCONFIG_PATH_SEPARATOR) ) {
             // absolute path
             wxSplitPath(aParts, strPath);
         }
diff --git a/src/msw/registry.cpp b/src/msw/registry.cpp
index d0d050f6f2..f35ecd279c 100644
--- a/src/msw/registry.cpp
+++ b/src/msw/registry.cpp
@@ -22,9 +22,9 @@
 #ifndef WX_PRECOMP
     #include "wx/string.h"
     #include  "wx/intl.h"
+    #include  "wx/log.h"
 #endif
 
-#include  "wx/log.h"
 #include  "wx/file.h"
 #include  "wx/wfstream.h"
 
diff --git a/src/msw/statbr95.cpp b/src/msw/statbr95.cpp
index 9099fb4b2b..3c774a2457 100644
--- a/src/msw/statbr95.cpp
+++ b/src/msw/statbr95.cpp
@@ -25,10 +25,9 @@
     #include "wx/settings.h"
     #include "wx/dcclient.h"
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
-#include "wx/log.h"
-
 #include "wx/msw/private.h"
 #include <windowsx.h>
 
diff --git a/src/msw/treectrl.cpp b/src/msw/treectrl.cpp
index b6d787a4a3..67f82e9bbd 100644
--- a/src/msw/treectrl.cpp
+++ b/src/msw/treectrl.cpp
@@ -26,8 +26,11 @@
 
 #if wxUSE_TREECTRL
 
+#include "wx/treectrl.h"
+
 #ifndef WX_PRECOMP
     #include "wx/dynarray.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/msw/private.h"
@@ -42,10 +45,8 @@
 #define wxUSE_COMCTL32_SAFELY 0
 
 #include "wx/app.h"
-#include "wx/log.h"
 #include "wx/imaglist.h"
 #include "wx/settings.h"
-#include "wx/treectrl.h"
 #include "wx/msw/dragimag.h"
 
 // macros to hide the cast ugliness
diff --git a/src/msw/window.cpp b/src/msw/window.cpp
index 416e52c751..2591047c61 100644
--- a/src/msw/window.cpp
+++ b/src/msw/window.cpp
@@ -24,9 +24,10 @@
     #pragma hdrstop
 #endif
 
+#include "wx/window.h"
+
 #ifndef WX_PRECOMP
     #include "wx/msw/wrapwin.h"
-    #include "wx/window.h"
     #include "wx/accel.h"
     #include "wx/menu.h"
     #include "wx/dc.h"
@@ -44,6 +45,7 @@
     #include "wx/statbox.h"
     #include "wx/sizer.h"
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #if wxUSE_OWNER_DRAWN && !defined(__WXUNIVERSAL__)
@@ -71,7 +73,6 @@
 #endif
 
 #include "wx/menuitem.h"
-#include "wx/log.h"
 
 #include "wx/msw/private.h"
 
@@ -87,8 +88,6 @@
     #include "wx/spinctrl.h"
 #endif // wxUSE_SPINCTRL
 
-#include "wx/log.h"
-
 #include "wx/textctrl.h"
 #include "wx/notebook.h"
 #include "wx/listctrl.h"
diff --git a/src/os2/app.cpp b/src/os2/app.cpp
index 050117d47f..7cf9125bc2 100644
--- a/src/os2/app.cpp
+++ b/src/os2/app.cpp
@@ -12,10 +12,11 @@
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
+#include "wx/app.h"
+
 #ifndef WX_PRECOMP
     #include "wx/dynarray.h"
     #include "wx/frame.h"
-    #include "wx/app.h"
     #include "wx/utils.h"
     #include "wx/gdicmn.h"
     #include "wx/pen.h"
@@ -31,9 +32,9 @@
     #include "wx/icon.h"
     #include "wx/stdpaths.h"
     #include "wx/filename.h"
+    #include "wx/log.h"
 #endif
 
-#include "wx/log.h"
 #include "wx/module.h"
 
 #include "wx/os2/private.h"
diff --git a/src/os2/bitmap.cpp b/src/os2/bitmap.cpp
index f60d0f7c9b..6c4cb2fd22 100644
--- a/src/os2/bitmap.cpp
+++ b/src/os2/bitmap.cpp
@@ -12,6 +12,8 @@
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
+#include "wx/bitmap.h"
+
 #ifndef WX_PRECOMP
     #include <stdio.h>
 
@@ -20,12 +22,11 @@
     #include "wx/app.h"
     #include "wx/palette.h"
     #include "wx/dcmemory.h"
-    #include "wx/bitmap.h"
     #include "wx/icon.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/os2/private.h"
-#include "wx/log.h"
 
 #include "wx/image.h"
 #include "wx/xpmdecod.h"
diff --git a/src/os2/checklst.cpp b/src/os2/checklst.cpp
index 7d5566b912..692eafb574 100644
--- a/src/os2/checklst.cpp
+++ b/src/os2/checklst.cpp
@@ -18,8 +18,11 @@
 
 #if wxUSE_CHECKLISTBOX && wxUSE_OWNER_DRAWN
 
+#include "wx/checklst.h"
+
 #ifndef WX_PRECOMP
     #include "wx/object.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/colour.h"
@@ -31,8 +34,6 @@
 #include "wx/settings.h"
 #include "wx/dcmemory.h"
 #include "wx/dcscreen.h"
-#include "wx/checklst.h"
-#include "wx/log.h"
 
 #define INCL_PM
 #include <os2.h>
diff --git a/src/os2/clipbrd.cpp b/src/os2/clipbrd.cpp
index a3691d7e0f..5c05cdc294 100644
--- a/src/os2/clipbrd.cpp
+++ b/src/os2/clipbrd.cpp
@@ -14,6 +14,8 @@
 
 #if wxUSE_CLIPBOARD
 
+#include "wx/clipbrd.h"
+
 #ifndef WX_PRECOMP
     #include "wx/object.h"
     #include "wx/event.h"
@@ -22,15 +24,13 @@
     #include "wx/bitmap.h"
     #include "wx/utils.h"
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #if wxUSE_METAFILE
     #include "wx/metafile.h"
 #endif
 
-#include "wx/log.h"
-#include "wx/clipbrd.h"
-
 #include <string.h>
 
 #include "wx/os2/private.h"
diff --git a/src/os2/dcclient.cpp b/src/os2/dcclient.cpp
index 24de249cc2..c313cb51d2 100644
--- a/src/os2/dcclient.cpp
+++ b/src/os2/dcclient.cpp
@@ -24,9 +24,9 @@
 
 #ifndef WX_PRECOMP
     #include "wx/string.h"
+    #include "wx/log.h"
 #endif
 
-#include "wx/log.h"
 #include "wx/window.h"
 #include "wx/app.h"
 
diff --git a/src/os2/dcprint.cpp b/src/os2/dcprint.cpp
index 655622d16f..edd3969173 100644
--- a/src/os2/dcprint.cpp
+++ b/src/os2/dcprint.cpp
@@ -25,9 +25,9 @@
     #include "wx/app.h"
     #include "wx/math.h"
     #include "wx/string.h"
+    #include "wx/log.h"
 #endif
 
-#include "wx/log.h"
 #include "wx/window.h"
 #include "wx/os2/private.h"
 
diff --git a/src/os2/dialog.cpp b/src/os2/dialog.cpp
index 06f4e62c67..99e6b11d2c 100644
--- a/src/os2/dialog.cpp
+++ b/src/os2/dialog.cpp
@@ -12,18 +12,18 @@
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
-#ifndef WX_PRECOMP
 #include "wx/dialog.h"
-#include "wx/utils.h"
-#include "wx/frame.h"
-#include "wx/app.h"
-#include "wx/settings.h"
-#include "wx/intl.h"
-#include "wx/log.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/utils.h"
+    #include "wx/frame.h"
+    #include "wx/app.h"
+    #include "wx/settings.h"
+    #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/os2/private.h"
-#include "wx/log.h"
 #include "wx/evtloop.h"
 #include "wx/ptr_scpd.h"
 
diff --git a/src/os2/evtloop.cpp b/src/os2/evtloop.cpp
index 8ed9c42574..08f615fe50 100644
--- a/src/os2/evtloop.cpp
+++ b/src/os2/evtloop.cpp
@@ -1,5 +1,5 @@
 ///////////////////////////////////////////////////////////////////////////////
-// Name:        os2/evtloop.cpp
+// Name:        src/os2/evtloop.cpp
 // Purpose:     implements wxEventLoop for PM
 // Author:      Vadim Zeitlin
 // Modified by:
@@ -28,10 +28,10 @@
     #include "wx/window.h"
     #include "wx/app.h"
     #include "wx/timer.h"
+    #include "wx/log.h"
 #endif //WX_PRECOMP
 
 #include "wx/evtloop.h"
-#include "wx/log.h"
 #include "wx/tooltip.h"
 #include "wx/ptr_scpd.h"
 
@@ -164,11 +164,11 @@ bool wxEventLoopImpl::PreProcessMessage(QMSG *pMsg)
            {
                if((bRc = pWnd->OS2TranslateMessage((WXMSG*)pMsg)) == TRUE)
                    break;
-	    // stop at first top level window, i.e. don't try to process the
-	    // key strokes originating in a dialog using the accelerators of
-	    // the parent frame - this doesn't make much sense
-	    if ( pWnd->IsTopLevel() )
-	        break;
+               // stop at first top level window, i.e. don't try to process the
+               // key strokes originating in a dialog using the accelerators of
+               // the parent frame - this doesn't make much sense
+               if ( pWnd->IsTopLevel() )
+                   break;
            }
 
             if(!bRc)    // untranslated, should restore original value
@@ -259,20 +259,20 @@ int wxEventLoop::Run()
         // generate and process idle events for as long as we don't have
         // anything else to do
         while ( !Pending() && m_impl->SendIdleMessage() )
-	{
-	    wxTheApp->HandleSockets();
-	    wxMilliSleep(10);
-	}
+        {
+            wxTheApp->HandleSockets();
+            wxMilliSleep(10);
+        }
 
         wxTheApp->HandleSockets();
         if (Pending())
-	{
-	    if ( !Dispatch() )
-	    {
-		// we got WM_QUIT
-		break;
-	    }
-	}
+        {
+            if ( !Dispatch() )
+            {
+                // we got WM_QUIT
+                break;
+            }
+        }
         else
             wxMilliSleep(10);
     }
@@ -301,7 +301,7 @@ bool wxEventLoop::Pending() const
 
 bool wxEventLoop::Dispatch()
 {
-    wxCHECK_MSG( IsRunning(), FALSE, _T("can't call Dispatch() if not running") );
+    wxCHECK_MSG( IsRunning(), false, _T("can't call Dispatch() if not running") );
 
     QMSG msg;
     BOOL bRc = ::WinGetMsg(vHabmain, &msg, (HWND) NULL, 0, 0);
@@ -309,14 +309,14 @@ bool wxEventLoop::Dispatch()
     if ( bRc == 0 )
     {
         // got WM_QUIT
-        return FALSE;
+        return false;
     }
 
 #if wxUSE_THREADS
     wxASSERT_MSG( wxThread::IsMain(),
                   wxT("only the main thread can process Windows messages") );
 
-    static bool s_hadGuiLock = TRUE;
+    static bool s_hadGuiLock = true;
     static wxMsgArray s_aSavedMessages;
 
     // if a secondary thread owning the mutex is doing GUI calls, save all
@@ -324,7 +324,7 @@ bool wxEventLoop::Dispatch()
     // it will lead to recursive library calls (and we're not reentrant)
     if ( !wxGuiOwnedByMainThread() )
     {
-        s_hadGuiLock = FALSE;
+        s_hadGuiLock = false;
 
         // leave out WM_COMMAND messages: too dangerous, sometimes
         // the message will be processed twice
@@ -333,7 +333,7 @@ bool wxEventLoop::Dispatch()
             s_aSavedMessages.Add(msg);
         }
 
-        return TRUE;
+        return true;
     }
     else
     {
@@ -344,7 +344,7 @@ bool wxEventLoop::Dispatch()
         //       messages normally - expect some things to break...
         if ( !s_hadGuiLock )
         {
-            s_hadGuiLock = TRUE;
+            s_hadGuiLock = true;
 
             size_t count = s_aSavedMessages.Count();
             for ( size_t n = 0; n < count; n++ )
@@ -360,6 +360,5 @@ bool wxEventLoop::Dispatch()
 
     m_impl->ProcessMessage(&msg);
 
-    return TRUE;
+    return true;
 }
-
diff --git a/src/os2/frame.cpp b/src/os2/frame.cpp
index f8c4e9d11a..d04ed2f8f8 100644
--- a/src/os2/frame.cpp
+++ b/src/os2/frame.cpp
@@ -43,7 +43,6 @@
 #endif // wxUSE_TOOLBAR
 
 #include "wx/menuitem.h"
-#include "wx/log.h"
 
 // ----------------------------------------------------------------------------
 // globals
diff --git a/src/os2/iniconf.cpp b/src/os2/iniconf.cpp
index db81983a3a..d2212870c4 100644
--- a/src/os2/iniconf.cpp
+++ b/src/os2/iniconf.cpp
@@ -21,10 +21,9 @@
     #include  "wx/event.h"
     #include  "wx/app.h"
     #include  "wx/utils.h"
+    #include  "wx/log.h"
 #endif  //WX_PRECOMP
 
-#include  "wx/log.h"
-
 #include  "wx/config.h"
 
 #include  "wx/os2/iniconf.h"
diff --git a/src/os2/listbox.cpp b/src/os2/listbox.cpp
index eea8872b6b..11e6a92bc7 100644
--- a/src/os2/listbox.cpp
+++ b/src/os2/listbox.cpp
@@ -14,9 +14,10 @@
 
 #if wxUSE_LISTBOX
 
+#include "wx/listbox.h"
+
 #ifndef WX_PRECOMP
     #include "wx/dynarray.h"
-    #include "wx/listbox.h"
     #include "wx/settings.h"
     #include "wx/brush.h"
     #include "wx/font.h"
@@ -24,6 +25,7 @@
     #include "wx/dcscreen.h"
     #include "wx/utils.h"
     #include "wx/scrolwin.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/window.h"
@@ -32,8 +34,6 @@
 #define INCL_M
 #include <os2.h>
 
-#include "wx/log.h"
-
 #if wxUSE_OWNER_DRAWN
     #include  "wx/ownerdrw.h"
 #endif
diff --git a/src/os2/menuitem.cpp b/src/os2/menuitem.cpp
index 27302245d3..06ea4c8185 100644
--- a/src/os2/menuitem.cpp
+++ b/src/os2/menuitem.cpp
@@ -1,5 +1,5 @@
 ///////////////////////////////////////////////////////////////////////////////
-// Name:        menuitem.cpp
+// Name:        src/os2/menuitem.cpp
 // Purpose:     wxMenuItem implementation
 // Author:      David Webster
 // Modified by:
@@ -16,6 +16,8 @@
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
+#include "wx/menuitem.h"
+
 #ifndef WX_PRECOMP
     #include "wx/font.h"
     #include "wx/bitmap.h"
@@ -25,11 +27,9 @@
     #include "wx/accel.h"
     #include "wx/menu.h"
     #include "wx/string.h"
+    #include "wx/log.h"
 #endif
 
-#include "wx/menuitem.h"
-#include "wx/log.h"
-
 #if wxUSE_ACCEL
     #include "wx/accel.h"
 #endif // wxUSE_ACCEL
diff --git a/src/os2/mimetype.cpp b/src/os2/mimetype.cpp
index e512298a93..69cec9db89 100644
--- a/src/os2/mimetype.cpp
+++ b/src/os2/mimetype.cpp
@@ -20,6 +20,7 @@
     #include "wx/dynarray.h"
     #include "wx/string.h"
     #include "wx/intl.h"
+    #include "wx/log.h"
     #if wxUSE_GUI
         #include "wx/icon.h"
     #endif
@@ -30,7 +31,6 @@
 #define INCL_WIN
 #include <os2.h>
 
-#include "wx/log.h"
 #include "wx/file.h"
 #include "wx/iconloc.h"
 #include "wx/confbase.h"
diff --git a/src/os2/notebook.cpp b/src/os2/notebook.cpp
index ee9b6810eb..b0765dd8e8 100644
--- a/src/os2/notebook.cpp
+++ b/src/os2/notebook.cpp
@@ -14,19 +14,20 @@
 
 #if wxUSE_NOTEBOOK
 
+#include  "wx/notebook.h"
+
 // wxWidgets
 #ifndef WX_PRECOMP
-  #include "wx/app.h"
-  #include "wx/dcclient.h"
-  #include "wx/string.h"
-  #include "wx/settings.h"
+    #include "wx/app.h"
+    #include "wx/dcclient.h"
+    #include "wx/string.h"
+    #include "wx/settings.h"
+    #include  "wx/log.h"
 #endif  // WX_PRECOMP
 
-#include  "wx/log.h"
 #include  "wx/imaglist.h"
 #include  "wx/event.h"
 #include  "wx/control.h"
-#include  "wx/notebook.h"
 
 #include  "wx/os2/private.h"
 
diff --git a/src/os2/statline.cpp b/src/os2/statline.cpp
index ab764d8dce..e9663eebf9 100644
--- a/src/os2/statline.cpp
+++ b/src/os2/statline.cpp
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        msw/statline.cpp
+// Name:        src/os2/statline.cpp
 // Purpose:     OS2 version of wxStaticLine class
 // Author:      David Webster
 // Created:     10/23/99
@@ -19,12 +19,15 @@
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
+#if wxUSE_STATLINE
+
 #include "wx/statline.h"
 
-#if wxUSE_STATLINE
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
 
 #include "wx/os2/private.h"
-#include "wx/log.h"
 
 // ============================================================================
 // implementation
diff --git a/src/os2/thread.cpp b/src/os2/thread.cpp
index e1dd0bf7d4..33cb46646d 100644
--- a/src/os2/thread.cpp
+++ b/src/os2/thread.cpp
@@ -22,13 +22,13 @@
 
 #ifndef WX_PRECOMP
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif //WX_PRECOMP
 
 #include "wx/app.h"
 #include "wx/apptrait.h"
 #include "wx/module.h"
 #include "wx/utils.h"
-#include "wx/log.h"
 
 #include <stdio.h>
 
diff --git a/src/os2/timer.cpp b/src/os2/timer.cpp
index 72d7b1cdf2..9036f7d5aa 100644
--- a/src/os2/timer.cpp
+++ b/src/os2/timer.cpp
@@ -18,10 +18,10 @@
     #include "wx/event.h"
     #include "wx/app.h"
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/os2/private.h"
-#include "wx/log.h"
 
 #include "wx/timer.h"
 
diff --git a/src/os2/treectrl.cpp b/src/os2/treectrl.cpp
index da60f7a692..f95caad05b 100644
--- a/src/os2/treectrl.cpp
+++ b/src/os2/treectrl.cpp
@@ -26,17 +26,18 @@
 
 #if wxUSE_TREECTRL
 
+#include "wx/treectrl.h"
+
 #ifndef WX_PRECOMP
     #include "wx/dynarray.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/os2/private.h"
 
 #include "wx/app.h"
-#include "wx/log.h"
 #include "wx/imaglist.h"
 #include "wx/settings.h"
-#include "wx/os2/treectrl.h"
 
 // a macro to hide the ugliness of nested casts
 #define HITEM(item)     (HTREEITEM)(WXHTREEITEM)(item)
diff --git a/src/os2/utils.cpp b/src/os2/utils.cpp
index 20da3f30ba..00698431ff 100644
--- a/src/os2/utils.cpp
+++ b/src/os2/utils.cpp
@@ -12,10 +12,12 @@
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
+#include "wx/utils.h"
+
 #ifndef WX_PRECOMP
-    #include "wx/utils.h"
     #include "wx/app.h"
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif  //WX_PRECOMP
 
 #include "wx/os2/private.h"
@@ -26,7 +28,6 @@
 #include <dirent.h>
 #endif
 
-#include "wx/log.h"
 
 #include <io.h>
 
@@ -135,19 +136,17 @@ int wxKill(long         lPid,
 //
 // Execute a program in an Interactive Shell
 //
-bool wxShell(
-  const wxString&                   rCommand
-)
+bool wxShell( const wxString& rCommand )
 {
-    wxChar*                         zShell = _T("CMD.EXE");
-    wxString                        sInputs;
-    STARTDATA                       SData = {0};
-    PSZ                             PgmTitle = "Command Shell";
-    APIRET                          rc;
-    PID                             vPid = 0;
-    ULONG                           ulSessID = 0;
-    UCHAR                           achObjBuf[256] = {0}; //error data if DosStart fails
-    RESULTCODES                     vResult;
+    wxChar*     zShell = _T("CMD.EXE");
+    wxString    sInputs;
+    STARTDATA   SData = {0};
+    PSZ         PgmTitle = "Command Shell";
+    APIRET      rc;
+    PID         vPid = 0;
+    ULONG       ulSessID = 0;
+    UCHAR       achObjBuf[256] = {0}; //error data if DosStart fails
+    RESULTCODES vResult;
 
     SData.Length   = sizeof(STARTDATA);
     SData.Related  = SSF_RELATED_INDEPENDENT;
diff --git a/src/os2/utilsexc.cpp b/src/os2/utilsexc.cpp
index 909da35a3a..36cb21733e 100644
--- a/src/os2/utilsexc.cpp
+++ b/src/os2/utilsexc.cpp
@@ -16,10 +16,9 @@
     #include "wx/utils.h"
     #include "wx/app.h"
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
-#include "wx/log.h"
-
 #include "wx/process.h"
 
 #include "wx/os2/private.h"
diff --git a/src/os2/window.cpp b/src/os2/window.cpp
index d49aaf21a1..72bebe9bee 100644
--- a/src/os2/window.cpp
+++ b/src/os2/window.cpp
@@ -14,11 +14,12 @@
 //
 #include "wx/wxprec.h"
 
+#include "wx/window.h"
+
 #ifndef WX_PRECOMP
     #define INCL_DOS
     #define INCL_PM
     #include <os2.h>
-    #include "wx/window.h"
     #include "wx/accel.h"
     #include "wx/menu.h"
     #include "wx/dc.h"
@@ -44,6 +45,7 @@
     #include "wx/toolbar.h"
     #include "wx/settings.h"
     #include "wx/intl.h"
+    #include "wx/log.h"
     #include <stdio.h>
 #endif
 
@@ -56,7 +58,6 @@
 #endif
 
 #include "wx/menuitem.h"
-#include "wx/log.h"
 
 #include "wx/os2/private.h"
 
@@ -72,8 +73,6 @@
     #include "wx/caret.h"
 #endif // wxUSE_CARET
 
-#include "wx/log.h"
-
 
 #include "wx/textctrl.h"
 
diff --git a/src/palmos/bitmap.cpp b/src/palmos/bitmap.cpp
index ae71f142b8..b24f6d23f5 100644
--- a/src/palmos/bitmap.cpp
+++ b/src/palmos/bitmap.cpp
@@ -24,6 +24,8 @@
     #pragma hdrstop
 #endif
 
+#include "wx/bitmap.h"
+
 #ifndef WX_PRECOMP
     #include <stdio.h>
 
@@ -32,12 +34,10 @@
     #include "wx/app.h"
     #include "wx/palette.h"
     #include "wx/dcmemory.h"
-    #include "wx/bitmap.h"
     #include "wx/icon.h"
+    #include "wx/log.h"
 #endif
 
-#include "wx/log.h"
-
 #if wxUSE_WXDIB
 #include "wx/palmos/dib.h"
 #endif
diff --git a/src/palmos/clipbrd.cpp b/src/palmos/clipbrd.cpp
index 8cc26b6813..a60d984fd1 100644
--- a/src/palmos/clipbrd.cpp
+++ b/src/palmos/clipbrd.cpp
@@ -26,6 +26,8 @@
 
 #if wxUSE_CLIPBOARD
 
+#include "wx/clipbrd.h"
+
 #ifndef WX_PRECOMP
     #include "wx/object.h"
     #include "wx/event.h"
@@ -34,15 +36,13 @@
     #include "wx/bitmap.h"
     #include "wx/utils.h"
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #if wxUSE_METAFILE
     #include "wx/metafile.h"
 #endif
 
-#include "wx/log.h"
-#include "wx/clipbrd.h"
-
 #include <string.h>
 
 #include "wx/palmos/private.h"
diff --git a/src/palmos/dcclient.cpp b/src/palmos/dcclient.cpp
index 8a07a7b2ce..1269dcb586 100644
--- a/src/palmos/dcclient.cpp
+++ b/src/palmos/dcclient.cpp
@@ -28,9 +28,9 @@
 
 #ifndef WX_PRECOMP
     #include "wx/string.h"
+    #include "wx/log.h"
 #endif
 
-#include "wx/log.h"
 #include "wx/window.h"
 
 // ----------------------------------------------------------------------------
diff --git a/src/palmos/dialog.cpp b/src/palmos/dialog.cpp
index 4538f533ec..248a539145 100644
--- a/src/palmos/dialog.cpp
+++ b/src/palmos/dialog.cpp
@@ -24,8 +24,9 @@
     #pragma hdrstop
 #endif
 
+#include "wx/dialog.h"
+
 #ifndef WX_PRECOMP
-    #include "wx/dialog.h"
     #include "wx/utils.h"
     #include "wx/frame.h"
     #include "wx/app.h"
@@ -34,7 +35,6 @@
     #include "wx/log.h"
 #endif
 
-#include "wx/log.h"
 #include "wx/evtloop.h"
 #include "wx/ptr_scpd.h"
 
diff --git a/src/palmos/dragimag.cpp b/src/palmos/dragimag.cpp
index 06340720e1..67688416f8 100644
--- a/src/palmos/dragimag.cpp
+++ b/src/palmos/dragimag.cpp
@@ -34,9 +34,9 @@
     #include "wx/dcmemory.h"
     #include "wx/settings.h"
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
-#include "wx/log.h"
 #include "wx/frame.h"
 #include "wx/image.h"
 
diff --git a/src/palmos/fontdlg.cpp b/src/palmos/fontdlg.cpp
index e6c238f90e..2b494dc2e0 100644
--- a/src/palmos/fontdlg.cpp
+++ b/src/palmos/fontdlg.cpp
@@ -26,17 +26,18 @@
 
 #if wxUSE_FONTDLG
 
+#include "wx/fontdlg.h"
+
 #ifndef WX_PRECOMP
     #include "wx/utils.h"
     #include "wx/dialog.h"
     #include "wx/math.h"
+    #include "wx/log.h"
 #endif
 
-#include "wx/fontdlg.h"
 #include "wx/palmos/private.h"
 
 #include "wx/cmndata.h"
-#include "wx/log.h"
 
 #include <stdlib.h>
 #include <string.h>
diff --git a/src/palmos/frame.cpp b/src/palmos/frame.cpp
index c660adb68e..8d2f51ee16 100644
--- a/src/palmos/frame.cpp
+++ b/src/palmos/frame.cpp
@@ -24,8 +24,9 @@
     #pragma hdrstop
 #endif
 
+#include "wx/frame.h"
+
 #ifndef WX_PRECOMP
-    #include "wx/frame.h"
     #include "wx/app.h"
     #include "wx/menu.h"
     #include "wx/utils.h"
@@ -34,6 +35,7 @@
     #include "wx/dcclient.h"
     #include "wx/mdi.h"
     #include "wx/panel.h"
+    #include "wx/log.h"
 #endif // WX_PRECOMP
 
 #if wxUSE_STATUSBAR
@@ -46,7 +48,6 @@
 #endif // wxUSE_TOOLBAR
 
 #include "wx/menuitem.h"
-#include "wx/log.h"
 
 #ifdef __WXUNIVERSAL__
     #include "wx/univ/theme.h"
diff --git a/src/palmos/imaglist.cpp b/src/palmos/imaglist.cpp
index 1a8d5c5df9..1616e05e2d 100644
--- a/src/palmos/imaglist.cpp
+++ b/src/palmos/imaglist.cpp
@@ -31,10 +31,9 @@
     #include "wx/string.h"
     #include "wx/dcmemory.h"
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
-#include "wx/log.h"
-
 #include "wx/palmos/imaglist.h"
 #include "wx/palmos/private.h"
 
diff --git a/src/palmos/listbox.cpp b/src/palmos/listbox.cpp
index a1655ba2ec..6876e0668f 100644
--- a/src/palmos/listbox.cpp
+++ b/src/palmos/listbox.cpp
@@ -18,21 +18,21 @@
 
 #if wxUSE_LISTBOX
 
+#include "wx/listbox.h"
+
 #ifndef WX_PRECOMP
     #include "wx/dynarray.h"
-    #include "wx/listbox.h"
     #include "wx/settings.h"
     #include "wx/brush.h"
     #include "wx/font.h"
     #include "wx/dc.h"
     #include "wx/utils.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/window.h"
 #include "wx/palmos/private.h"
 
-#include "wx/log.h"
-
 #if wxUSE_OWNER_DRAWN
     #include  "wx/ownerdrw.h"
 #endif
diff --git a/src/palmos/menuitem.cpp b/src/palmos/menuitem.cpp
index bc01bac3d4..f0dc626bdd 100644
--- a/src/palmos/menuitem.cpp
+++ b/src/palmos/menuitem.cpp
@@ -26,6 +26,8 @@
 
 #if wxUSE_MENUS
 
+#include "wx/menu.h"
+
 #ifndef WX_PRECOMP
     #include "wx/font.h"
     #include "wx/bitmap.h"
@@ -33,12 +35,11 @@
     #include "wx/font.h"
     #include "wx/window.h"
     #include "wx/accel.h"
-    #include "wx/menu.h"
     #include "wx/string.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/menuitem.h"
-#include "wx/log.h"
 
 #if wxUSE_ACCEL
     #include "wx/accel.h"
diff --git a/src/palmos/printpalm.cpp b/src/palmos/printpalm.cpp
index 1ff991aa29..747c6c16fb 100644
--- a/src/palmos/printpalm.cpp
+++ b/src/palmos/printpalm.cpp
@@ -36,12 +36,12 @@
     #include "wx/app.h"
     #include "wx/msgdlg.h"
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/palmos/printpalm.h"
 #include "wx/dcprint.h"
 #include "wx/printdlg.h"
-#include "wx/log.h"
 #include "wx/palmos/private.h"
 
 // ---------------------------------------------------------------------------
diff --git a/src/palmos/statbrpalm.cpp b/src/palmos/statbrpalm.cpp
index ec0cdb9048..679433f1b9 100644
--- a/src/palmos/statbrpalm.cpp
+++ b/src/palmos/statbrpalm.cpp
@@ -25,10 +25,9 @@
     #include "wx/settings.h"
     #include "wx/dcclient.h"
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
-#include "wx/log.h"
-
 #include <StatusBar.h>
 
 // ----------------------------------------------------------------------------
diff --git a/src/palmos/statline.cpp b/src/palmos/statline.cpp
index 8af952e431..eeed178c84 100644
--- a/src/palmos/statline.cpp
+++ b/src/palmos/statline.cpp
@@ -24,12 +24,15 @@
     #pragma hdrstop
 #endif
 
+#if wxUSE_STATLINE
+
 #include "wx/statline.h"
 
-#if wxUSE_STATLINE
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
 
 #include "wx/palmos/private.h"
-#include "wx/log.h"
 
 #ifndef SS_SUNKEN
     #define SS_SUNKEN 0x00001000L
@@ -119,4 +122,3 @@ WXDWORD wxStaticLine::MSWGetStyle(long style, WXDWORD *exstyle) const
 }
 
 #endif // wxUSE_STATLINE
-
diff --git a/src/palmos/treectrl.cpp b/src/palmos/treectrl.cpp
index f8aa33d8a9..45246666e2 100644
--- a/src/palmos/treectrl.cpp
+++ b/src/palmos/treectrl.cpp
@@ -26,14 +26,16 @@
 
 #if wxUSE_TREECTRL
 
+#include "wx/treectrl.h"
+
 #ifndef WX_PRECOMP
     #include "wx/dynarray.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/palmos/private.h"
 
 #include "wx/app.h"
-#include "wx/log.h"
 #include "wx/imaglist.h"
 #include "wx/settings.h"
 
diff --git a/src/palmos/window.cpp b/src/palmos/window.cpp
index 39f2c7019b..f87ff65b7f 100644
--- a/src/palmos/window.cpp
+++ b/src/palmos/window.cpp
@@ -24,8 +24,9 @@
     #pragma hdrstop
 #endif
 
+#include "wx/window.h"
+
 #ifndef WX_PRECOMP
-    #include "wx/window.h"
     #include "wx/accel.h"
     #include "wx/menu.h"
     #include "wx/dc.h"
@@ -42,6 +43,7 @@
     #include "wx/settings.h"
     #include "wx/statbox.h"
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #if wxUSE_OWNER_DRAWN && !defined(__WXUNIVERSAL__)
@@ -59,7 +61,6 @@
 #endif
 
 #include "wx/menuitem.h"
-#include "wx/log.h"
 
 #if wxUSE_TOOLTIPS
     #include "wx/tooltip.h"
@@ -73,8 +74,6 @@
     #include "wx/spinctrl.h"
 #endif // wxUSE_SPINCTRL
 
-#include "wx/log.h"
-
 #include "wx/textctrl.h"
 #include "wx/notebook.h"
 #include "wx/listctrl.h"
diff --git a/src/univ/ctrlrend.cpp b/src/univ/ctrlrend.cpp
index 6f13810965..5a803f20a0 100644
--- a/src/univ/ctrlrend.cpp
+++ b/src/univ/ctrlrend.cpp
@@ -1,5 +1,5 @@
 ///////////////////////////////////////////////////////////////////////////////
-// Name:        univ/ctrlrend.cpp
+// Name:        src/univ/ctrlrend.cpp
 // Purpose:     wxControlRenderer implementation
 // Author:      Vadim Zeitlin
 // Modified by:
@@ -31,17 +31,17 @@
     #include "wx/listbox.h"
     #include "wx/scrolbar.h"
     #include "wx/dc.h"
+    #include "wx/log.h"
 #endif // WX_PRECOMP
 
 #include "wx/image.h"
-#include "wx/log.h"
 
 #include "wx/univ/theme.h"
 #include "wx/univ/renderer.h"
 #include "wx/univ/colschem.h"
 
 #if wxUSE_GAUGE
-#include "wx/gauge.h"
+    #include "wx/gauge.h"
 #endif
 
 // ============================================================================
diff --git a/src/univ/scrolbar.cpp b/src/univ/scrolbar.cpp
index 7cdc4e9676..1acda84783 100644
--- a/src/univ/scrolbar.cpp
+++ b/src/univ/scrolbar.cpp
@@ -25,12 +25,13 @@
 
 #if wxUSE_SCROLLBAR
 
+#include "wx/scrolbar.h"
+
 #ifndef WX_PRECOMP
     #include "wx/timer.h"
-
     #include "wx/dcclient.h"
-    #include "wx/scrolbar.h"
     #include "wx/validate.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/univ/scrtimer.h"
@@ -38,7 +39,6 @@
 #include "wx/univ/renderer.h"
 #include "wx/univ/inphand.h"
 #include "wx/univ/theme.h"
-#include "wx/log.h"
 
 #define WXDEBUG_SCROLLBAR
 
diff --git a/src/univ/toolbar.cpp b/src/univ/toolbar.cpp
index 66e6b21623..a284182dd5 100644
--- a/src/univ/toolbar.cpp
+++ b/src/univ/toolbar.cpp
@@ -27,17 +27,18 @@
 
 #if wxUSE_TOOLBAR
 
+#include "wx/toolbar.h"
+
 #ifndef WX_PRECOMP
     #include "wx/utils.h"
     #include "wx/app.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/univ/renderer.h"
 
 #include "wx/frame.h"
-#include "wx/toolbar.h"
 #include "wx/image.h"
-#include "wx/log.h"
 
 // ----------------------------------------------------------------------------
 // constants
@@ -649,14 +650,14 @@ bool wxToolBar::PerformAction(const wxControlAction& action,
         PerformAction( wxACTION_BUTTON_RELEASE, numArg );
 
         PerformAction( wxACTION_BUTTON_CLICK, numArg );
-                        
-        // Write by Danny Raynor to change state again.                
+
+        // Write by Danny Raynor to change state again.
         // Check button still pressed or not
         if( tool->IsInverted() )
-        {        
-            PerformAction( wxACTION_TOOLBAR_RELEASE, numArg );      
+        {
+            PerformAction( wxACTION_TOOLBAR_RELEASE, numArg );
         }
-    
+
         // Set mouse leave toolbar button range (If still in the range,
         // toolbar button would get focus again
         PerformAction( wxACTION_TOOLBAR_LEAVE, numArg );
@@ -882,4 +883,3 @@ bool wxStdToolbarInputHandler::HandleActivation(wxInputConsumer *consumer,
 }
 
 #endif // wxUSE_TOOLBAR
-
diff --git a/src/univ/winuniv.cpp b/src/univ/winuniv.cpp
index 4892f9d8eb..bfcc9870fb 100644
--- a/src/univ/winuniv.cpp
+++ b/src/univ/winuniv.cpp
@@ -1,5 +1,5 @@
 ///////////////////////////////////////////////////////////////////////////////
-// Name:        univ/window.cpp
+// Name:        src/univ/window.cpp
 // Purpose:     implementation of extra wxWindow methods for wxUniv port
 // Author:      Vadim Zeitlin
 // Modified by:
@@ -24,18 +24,19 @@
     #pragma hdrstop
 #endif
 
+#include "wx/window.h"
+
 #ifndef WX_PRECOMP
     #include "wx/app.h"
-    #include "wx/window.h"
     #include "wx/dcclient.h"
     #include "wx/dcmemory.h"
     #include "wx/event.h"
     #include "wx/scrolbar.h"
     #include "wx/menu.h"
     #include "wx/frame.h"
+    #include "wx/log.h"
 #endif // WX_PRECOMP
 
-#include "wx/log.h"
 #include "wx/univ/colschem.h"
 #include "wx/univ/renderer.h"
 #include "wx/univ/theme.h"
@@ -1364,4 +1365,3 @@ WXLRESULT wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lPar
 }
 
 #endif // __WXMSW__
-
diff --git a/src/unix/dialup.cpp b/src/unix/dialup.cpp
index 2b39c34e0b..db1ad16b3b 100644
--- a/src/unix/dialup.cpp
+++ b/src/unix/dialup.cpp
@@ -19,13 +19,13 @@
 #ifndef  WX_PRECOMP
     #include "wx/string.h"
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif // !PCH
 
 #include "wx/event.h"
 #include "wx/timer.h"
 #include "wx/filefn.h"
 #include "wx/utils.h"
-#include "wx/log.h"
 #include "wx/ffile.h"
 #include "wx/process.h"
 #include "wx/app.h"
diff --git a/src/unix/displayx11.cpp b/src/unix/displayx11.cpp
index 53dba8c959..1d71c7f038 100644
--- a/src/unix/displayx11.cpp
+++ b/src/unix/displayx11.cpp
@@ -34,10 +34,10 @@
     #include "wx/string.h"
     #include "wx/utils.h"
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif /* WX_PRECOMP */
 
 #include "wx/display_impl.h"
-#include "wx/log.h"
 
 /* These must be included after the wx files.  Otherwise the Data macro in
  * Xlibint.h conflicts with a function declaration in wx/list.h.  */
diff --git a/src/unix/mediactrl.cpp b/src/unix/mediactrl.cpp
index 3edabd669f..3aa6a5a345 100644
--- a/src/unix/mediactrl.cpp
+++ b/src/unix/mediactrl.cpp
@@ -12,10 +12,10 @@
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
-#include "wx/mediactrl.h"
-
 #if wxUSE_MEDIACTRL
 
+#include "wx/mediactrl.h"
+
 #if wxUSE_GSTREAMER
 
 #include <gst/gst.h>                // main gstreamer header
@@ -28,7 +28,10 @@
 #   include <gst/gconf/gconf.h>        // gstreamer glib configuration
 #endif
 
-#include "wx/log.h"                 // wxLogDebug/wxLogSysError/wxLogTrace
+#ifndef  WX_PRECOMP
+    #include "wx/log.h"             // wxLogDebug/wxLogSysError/wxLogTrace
+#endif
+
 #include "wx/app.h"                 // wxTheApp->argc, wxTheApp->argv
 #include "wx/thread.h"              // wxMutex/wxMutexLocker
 #include "wx/timer.h"               // wxTimer
@@ -1033,7 +1036,7 @@ bool wxGStreamerMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent,
         if(error)
         {
             wxLogSysError(wxT("Could not initialize GStreamer\n")
-                          wxT("Error Message:%s"), 
+                          wxT("Error Message:%s"),
                           (const wxChar*) wxConvUTF8.cMB2WX(error->message)
                          );
             g_error_free(error);
@@ -1051,7 +1054,7 @@ bool wxGStreamerMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent,
 
 #ifdef __WXGTK__
     // We handle our own GTK expose events
-    m_ctrl->m_noExpose = TRUE;
+    m_ctrl->m_noExpose = true;
 #endif
 
     if( !m_ctrl->wxControl::Create(parent, id, pos, size,
@@ -1196,11 +1199,11 @@ bool wxGStreamerMediaBackend::Load(const wxURI& location)
 
         //Workaround GstURI leading "//" problem and make sure it leads
         //with that
-        return DoLoad(wxString(wxT("file://")) + 
-                      uristring.Right(uristring.Length() - 5)
+        return DoLoad(wxString(wxT("file://")) +
+                      uristring.Right(uristring.length() - 5)
                      );
     }
-    else 
+    else
         return DoLoad(location.BuildURI());
 }
 
@@ -1357,7 +1360,7 @@ wxMediaState wxGStreamerMediaBackend::GetState()
 // NB: whether we have paused or not and keep track of the time after the
 // NB: pause and whenever the user seeks while paused
 // NB:
-// 
+//
 // THREAD-UNSAFE, at least if not paused. Requires media to be at least paused.
 //-----------------------------------------------------------------------------
 wxLongLong wxGStreamerMediaBackend::GetPosition()
diff --git a/src/unix/mimetype.cpp b/src/unix/mimetype.cpp
index ab1cd8db14..5b108a6733 100644
--- a/src/unix/mimetype.cpp
+++ b/src/unix/mimetype.cpp
@@ -44,9 +44,9 @@
     #include "wx/dynarray.h"
     #include "wx/string.h"
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
-#include "wx/log.h"
 #include "wx/file.h"
 #include "wx/confbase.h"
 
diff --git a/src/unix/taskbarx11.cpp b/src/unix/taskbarx11.cpp
index 10373179fb..b6ec00f160 100644
--- a/src/unix/taskbarx11.cpp
+++ b/src/unix/taskbarx11.cpp
@@ -22,12 +22,16 @@
 #include "wx/wxprec.h"
 
 #include "wx/taskbar.h"
+
+#ifndef  WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/frame.h"
 #include "wx/bitmap.h"
 #include "wx/statbmp.h"
 #include "wx/sizer.h"
 #include "wx/dcclient.h"
-#include "wx/log.h"
 #include "wx/image.h"
 
 #ifdef __VMS
diff --git a/src/unix/threadpsx.cpp b/src/unix/threadpsx.cpp
index 503b086214..6d2db0b956 100644
--- a/src/unix/threadpsx.cpp
+++ b/src/unix/threadpsx.cpp
@@ -31,11 +31,11 @@
 #ifndef WX_PRECOMP
     #include "wx/dynarray.h"
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/module.h"
 #include "wx/utils.h"
-#include "wx/log.h"
 #include "wx/timer.h"
 #include "wx/stopwatch.h"
 
diff --git a/src/unix/utilsunx.cpp b/src/unix/utilsunx.cpp
index 869ae2b555..4315f74546 100644
--- a/src/unix/utilsunx.cpp
+++ b/src/unix/utilsunx.cpp
@@ -23,9 +23,9 @@
 #ifndef WX_PRECOMP
     #include "wx/string.h"
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
-#include "wx/log.h"
 #include "wx/app.h"
 #include "wx/apptrait.h"
 
diff --git a/src/unix/utilsx11.cpp b/src/unix/utilsx11.cpp
index b07ce15991..a410c64770 100644
--- a/src/unix/utilsx11.cpp
+++ b/src/unix/utilsx11.cpp
@@ -15,10 +15,14 @@
 #include "wx/wxprec.h"
 
 #include "wx/unix/utilsx11.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/iconbndl.h"
 #include "wx/image.h"
 #include "wx/icon.h"
-#include "wx/log.h"
 
 #ifdef __VMS
 #pragma message disable nosimpint
diff --git a/src/x11/app.cpp b/src/x11/app.cpp
index cbdac795e7..8215157322 100644
--- a/src/x11/app.cpp
+++ b/src/x11/app.cpp
@@ -17,6 +17,7 @@
 #ifndef WX_PRECOMP
     #include "wx/hash.h"
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/frame.h"
@@ -24,10 +25,8 @@
 #include "wx/gdicmn.h"
 #include "wx/icon.h"
 #include "wx/dialog.h"
-#include "wx/log.h"
 #include "wx/module.h"
 #include "wx/memory.h"
-#include "wx/log.h"
 #include "wx/evtloop.h"
 #include "wx/timer.h"
 #include "wx/filename.h"
diff --git a/src/x11/bitmap.cpp b/src/x11/bitmap.cpp
index 811f226b93..d3709d73d9 100644
--- a/src/x11/bitmap.cpp
+++ b/src/x11/bitmap.cpp
@@ -13,8 +13,12 @@
 #include "wx/wxprec.h"
 
 #include "wx/bitmap.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/icon.h"
-#include "wx/log.h"
 #include "wx/image.h"
 #include "wx/app.h"
 #if wxUSE_NANOX
diff --git a/src/x11/clipbrd.cpp b/src/x11/clipbrd.cpp
index ee100b5bcf..479e96dff7 100644
--- a/src/x11/clipbrd.cpp
+++ b/src/x11/clipbrd.cpp
@@ -1,20 +1,26 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        clipbrd.cpp
+// Name:        src/x11/clipbrd.cpp
 // Purpose:     Clipboard functionality
 // Author:      Robert Roebling
-// Created:     
+// Created:
 // RCS-ID:      $Id$
 // Copyright:   (c) Robert Roebling
-// Licence:   	wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#include "wx/clipbrd.h"
+// for compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
 
 #if wxUSE_CLIPBOARD
 
+#include "wx/clipbrd.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/dataobj.h"
 #include "wx/utils.h"
-#include "wx/log.h"
 
 #include "wx/x11/private.h"
 
@@ -108,7 +114,7 @@ targets_selection_received( GtkWidget *WXUNUSED(widget),
             if (format == clipboard->m_targetRequested)
             {
                 clipboard->m_waiting = FALSE;
-                clipboard->m_formatSupported = TRUE;
+                clipboard->m_formatSupported = true;
                 return;
             }
         }
@@ -168,7 +174,7 @@ selection_received( GtkWidget *WXUNUSED(widget),
 
     data_object->SetData( format, (size_t) selection_data->length, (const char*) selection_data->data );
 
-    wxTheClipboard->m_formatSupported = TRUE;
+    wxTheClipboard->m_formatSupported = true;
     clipboard->m_waiting = FALSE;
 }
 
@@ -292,7 +298,7 @@ wxClipboard::wxClipboard()
     if (!g_clipboardAtom) g_clipboardAtom = XInternAtom( (Display*) wxGetDisplay(), "CLIPBOARD", False );
     if (!g_targetsAtom) g_targetsAtom = XInternAtom( (Display*) wxGetDisplay(), "TARGETS", False );
 #endif
-    
+
     m_formatSupported = FALSE;
     m_targetRequested = 0;
 
@@ -320,7 +326,7 @@ void wxClipboard::Clear()
 #if 0
         if (gdk_selection_owner_get( g_clipboardAtom ) == m_clipboardWidget->window)
         {
-            m_waiting = TRUE;
+            m_waiting = true;
 
             gtk_selection_owner_set( (GtkWidget*) NULL, g_clipboardAtom,
                                      (guint32) GDK_CURRENT_TIME );
@@ -330,7 +336,7 @@ void wxClipboard::Clear()
 
         if (gdk_selection_owner_get( GDK_SELECTION_PRIMARY ) == m_clipboardWidget->window)
         {
-            m_waiting = TRUE;
+            m_waiting = true;
 
             gtk_selection_owner_set( (GtkWidget*) NULL, GDK_SELECTION_PRIMARY,
                                      (guint32) GDK_CURRENT_TIME );
@@ -351,16 +357,16 @@ void wxClipboard::Clear()
     }
 
     m_targetRequested = 0;
-    m_formatSupported = FALSE;
+    m_formatSupported = false;
 }
 
 bool wxClipboard::Open()
 {
-    wxCHECK_MSG( !m_open, FALSE, wxT("clipboard already open") );
+    wxCHECK_MSG( !m_open, false, wxT("clipboard already open") );
 
-    m_open = TRUE;
+    m_open = true;
 
-    return TRUE;
+    return true;
 }
 
 bool wxClipboard::SetData( wxDataObject *data )
@@ -462,7 +468,7 @@ bool wxClipboard::IsOpened() const
 bool wxClipboard::IsSupported( const wxDataFormat& format )
 {
     /* reentrance problems */
-    if (m_waiting) return FALSE;
+    if (m_waiting) return false;
 
     /* store requested format to be asked for by callbacks */
     m_targetRequested = format;
@@ -473,19 +479,19 @@ bool wxClipboard::IsSupported( const wxDataFormat& format )
                 format.GetId().c_str() );
 #endif
 
-    wxCHECK_MSG( m_targetRequested, FALSE, wxT("invalid clipboard format") );
+    wxCHECK_MSG( m_targetRequested, false, wxT("invalid clipboard format") );
 
-    m_formatSupported = FALSE;
+    m_formatSupported = false;
 
     /* perform query. this will set m_formatSupported to
-       TRUE if m_targetRequested is supported.
+       true if m_targetRequested is supported.
        also, we have to wait for the "answer" from the
        clipboard owner which is an asynchronous process.
-       therefore we set m_waiting = TRUE here and wait
+       therefore we set m_waiting = true here and wait
        until the callback "targets_selection_received"
-       sets it to FALSE */
+       sets it to false */
 
-    m_waiting = TRUE;
+    m_waiting = true;
 
 #if 0
     gtk_selection_convert( m_targetsWidget,
@@ -497,14 +503,14 @@ bool wxClipboard::IsSupported( const wxDataFormat& format )
     while (m_waiting) gtk_main_iteration();
 #endif
 
-    if (!m_formatSupported) return FALSE;
+    if (!m_formatSupported) return false;
 
-    return TRUE;
+    return true;
 }
 
 bool wxClipboard::GetData( wxDataObject& data )
 {
-    wxCHECK_MSG( m_open, FALSE, wxT("clipboard not open") );
+    wxCHECK_MSG( m_open, false, wxT("clipboard not open") );
 
     /* get formats from wxDataObjects */
     wxDataFormat *array = new wxDataFormat[ data.GetFormatCount() ];
@@ -523,19 +529,19 @@ bool wxClipboard::GetData( wxDataObject& data )
         /* store requested format to be asked for by callbacks */
         m_targetRequested = format;
 
-        wxCHECK_MSG( m_targetRequested, FALSE, wxT("invalid clipboard format") );
+        wxCHECK_MSG( m_targetRequested, false, wxT("invalid clipboard format") );
 
-        m_formatSupported = FALSE;
+        m_formatSupported = false;
 
        /* perform query. this will set m_formatSupported to
-          TRUE if m_targetRequested is supported.
+          true if m_targetRequested is supported.
           also, we have to wait for the "answer" from the
           clipboard owner which is an asynchronous process.
-          therefore we set m_waiting = TRUE here and wait
+          therefore we set m_waiting = true here and wait
           until the callback "targets_selection_received"
           sets it to FALSE */
 
-        m_waiting = TRUE;
+        m_waiting = true;
 
 #if 0
         gtk_selection_convert( m_targetsWidget,
@@ -555,21 +561,21 @@ bool wxClipboard::GetData( wxDataObject& data )
         /* store requested format to be asked for by callbacks */
         m_targetRequested = format;
 
-        wxCHECK_MSG( m_targetRequested, FALSE, wxT("invalid clipboard format") );
+        wxCHECK_MSG( m_targetRequested, false, wxT("invalid clipboard format") );
 
         /* start query */
-        m_formatSupported = FALSE;
+        m_formatSupported = false;
 
         /* ask for clipboard contents.  this will set
-           m_formatSupported to TRUE if m_targetRequested
+           m_formatSupported to true if m_targetRequested
            is supported.
            also, we have to wait for the "answer" from the
            clipboard owner which is an asynchronous process.
-           therefore we set m_waiting = TRUE here and wait
+           therefore we set m_waiting = true here and wait
            until the callback "targets_selection_received"
-           sets it to FALSE */
+           sets it to false */
 
-        m_waiting = TRUE;
+        m_waiting = true;
 
         wxLogTrace( TRACE_CLIPBOARD,
                     wxT("wxClipboard::GetData: format found, start convert") );
@@ -589,7 +595,7 @@ bool wxClipboard::GetData( wxDataObject& data )
 
         /* return success */
         delete[] array;
-        return TRUE;
+        return true;
     }
 
     wxLogTrace( TRACE_CLIPBOARD,
@@ -597,9 +603,8 @@ bool wxClipboard::GetData( wxDataObject& data )
 
     /* return failure */
     delete[] array;
-    return FALSE;
+    return false;
 }
 
 #endif
   // wxUSE_CLIPBOARD
-
diff --git a/src/x11/dataobj.cpp b/src/x11/dataobj.cpp
index 4fee19a527..bd4b3defcc 100644
--- a/src/x11/dataobj.cpp
+++ b/src/x11/dataobj.cpp
@@ -13,10 +13,14 @@
 #if wxUSE_DATAOBJ
 
 #include "wx/dataobj.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/mstream.h"
 #include "wx/app.h"
 #include "wx/image.h"
-#include "wx/log.h"
 
 #include "wx/utils.h"
 #include "wx/x11/private.h"
diff --git a/src/x11/dnd.cpp b/src/x11/dnd.cpp
index 7589082fc5..b49f27f66f 100644
--- a/src/x11/dnd.cpp
+++ b/src/x11/dnd.cpp
@@ -20,13 +20,13 @@
 
 #ifndef WX_PRECOMP
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/window.h"
 #include "wx/app.h"
 #include "wx/gdicmn.h"
 #include "wx/utils.h"
-#include "wx/log.h"
 
 #include <X11/Xlib.h>
 
diff --git a/src/x11/glcanvas.cpp b/src/x11/glcanvas.cpp
index 9ab1474b9c..1ecdd96f84 100644
--- a/src/x11/glcanvas.cpp
+++ b/src/x11/glcanvas.cpp
@@ -20,9 +20,13 @@
 #if wxUSE_GLCANVAS
 
 #include "wx/glcanvas.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/utils.h"
 #include "wx/app.h"
-#include "wx/log.h"
 
 #ifdef __VMS
 # pragma message disable nosimpint
diff --git a/src/x11/popupwin.cpp b/src/x11/popupwin.cpp
index 125130fcd2..c0c7825226 100644
--- a/src/x11/popupwin.cpp
+++ b/src/x11/popupwin.cpp
@@ -12,9 +12,12 @@
 
 #if wxUSE_POPUPWIN
 
-#include "wx/log.h"
-
 #include "wx/popupwin.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/app.h"
 #include "wx/settings.h"
 
diff --git a/src/x11/region.cpp b/src/x11/region.cpp
index 518af38e74..dd487ea50f 100644
--- a/src/x11/region.cpp
+++ b/src/x11/region.cpp
@@ -12,8 +12,12 @@
 #include "wx/wxprec.h"
 
 #include "wx/region.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/gdicmn.h"
-#include "wx/log.h"
 
 #ifdef __VMS__
 #pragma message disable nosimpint
diff --git a/src/x11/reparent.cpp b/src/x11/reparent.cpp
index 4d0cb919a9..be8dbe5324 100644
--- a/src/x11/reparent.cpp
+++ b/src/x11/reparent.cpp
@@ -27,8 +27,12 @@
 #if !wxUSE_NANOX
 
 #include "wx/x11/reparent.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/evtloop.h"
-#include "wx/log.h"
 #include "wx/app.h"
 #include "wx/timer.h"
 
@@ -284,4 +288,4 @@ WXWindow wxReparenter::FindAClientWindow(WXWindow window, const wxString& name)
     } return (WXWindow) result;
 }
 
-#endif
+#endif // !wxUSE_NANOX
diff --git a/src/x11/textctrl.cpp b/src/x11/textctrl.cpp
index fc3a12b2fb..96d2ea1e5e 100644
--- a/src/x11/textctrl.cpp
+++ b/src/x11/textctrl.cpp
@@ -14,10 +14,10 @@
 
 #ifndef WX_PRECOMP
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/utils.h"
-#include "wx/log.h"
 #include "wx/settings.h"
 #include "wx/panel.h"
 #include "wx/clipbrd.h"
diff --git a/src/x11/window.cpp b/src/x11/window.cpp
index 6409d158f5..dccd24f2e9 100644
--- a/src/x11/window.cpp
+++ b/src/x11/window.cpp
@@ -16,10 +16,6 @@
     #pragma hdrstop
 #endif
 
-#ifndef WX_PRECOMP
-    #include "wx/hash.h"
-#endif
-
 // ============================================================================
 // declarations
 // ============================================================================
@@ -28,6 +24,13 @@
 // headers
 // ----------------------------------------------------------------------------
 
+#include "wx/window.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/hash.h"
+    #include "wx/log.h"
+#endif
+
 #include "wx/menu.h"
 #include "wx/dc.h"
 #include "wx/dcclient.h"
@@ -45,7 +48,6 @@
 #include "wx/scrolbar.h"
 #include "wx/module.h"
 #include "wx/menuitem.h"
-#include "wx/log.h"
 #include "wx/fontutil.h"
 #include "wx/univ/renderer.h"
 
diff --git a/src/xml/xml.cpp b/src/xml/xml.cpp
index cd33a3a68e..28b83e829b 100644
--- a/src/xml/xml.cpp
+++ b/src/xml/xml.cpp
@@ -21,12 +21,12 @@
 
 #ifndef WX_PRECOMP
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/wfstream.h"
 #include "wx/datstrm.h"
 #include "wx/zstream.h"
-#include "wx/log.h"
 #include "wx/strconv.h"
 
 #include "expat.h" // from Expat
diff --git a/src/xrc/xh_chckl.cpp b/src/xrc/xh_chckl.cpp
index c72b37c77a..067f3cf7c0 100644
--- a/src/xrc/xh_chckl.cpp
+++ b/src/xrc/xh_chckl.cpp
@@ -21,10 +21,10 @@
 
 #ifndef WX_PRECOMP
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/checklst.h"
-#include "wx/log.h"
 
 IMPLEMENT_DYNAMIC_CLASS(wxCheckListBoxXmlHandler, wxXmlResourceHandler)
 
diff --git a/src/xrc/xh_choicbk.cpp b/src/xrc/xh_choicbk.cpp
index 48a00b3044..871332f8df 100644
--- a/src/xrc/xh_choicbk.cpp
+++ b/src/xrc/xh_choicbk.cpp
@@ -19,7 +19,10 @@
 
 #include "wx/xrc/xh_choicbk.h"
 
-#include "wx/log.h"
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/choicebk.h"
 #include "wx/imaglist.h"
 #include "wx/sizer.h"
diff --git a/src/xrc/xh_dlg.cpp b/src/xrc/xh_dlg.cpp
index c75f55019a..95a930b86c 100644
--- a/src/xrc/xh_dlg.cpp
+++ b/src/xrc/xh_dlg.cpp
@@ -21,11 +21,11 @@
 
 #ifndef WX_PRECOMP
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/dialog.h"
 #include "wx/frame.h"
-#include "wx/log.h"
 
 IMPLEMENT_DYNAMIC_CLASS(wxDialogXmlHandler, wxXmlResourceHandler)
 
diff --git a/src/xrc/xh_frame.cpp b/src/xrc/xh_frame.cpp
index dc6d8fc298..5e6e91995c 100644
--- a/src/xrc/xh_frame.cpp
+++ b/src/xrc/xh_frame.cpp
@@ -21,11 +21,11 @@
 
 #ifndef WX_PRECOMP
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/frame.h"
 #include "wx/dialog.h" // to get wxDEFAULT_DIALOG_STYLE
-#include "wx/log.h"
 
 IMPLEMENT_DYNAMIC_CLASS(wxFrameXmlHandler, wxXmlResourceHandler)
 
diff --git a/src/xrc/xh_listbk.cpp b/src/xrc/xh_listbk.cpp
index c0d9742a6a..f75ae9f883 100644
--- a/src/xrc/xh_listbk.cpp
+++ b/src/xrc/xh_listbk.cpp
@@ -19,7 +19,10 @@
 
 #include "wx/xrc/xh_listbk.h"
 
-#include "wx/log.h"
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/listbook.h"
 #include "wx/imaglist.h"
 #include "wx/sizer.h"
diff --git a/src/xrc/xh_mdi.cpp b/src/xrc/xh_mdi.cpp
index 9cb9ee2e7c..35c9cae13a 100644
--- a/src/xrc/xh_mdi.cpp
+++ b/src/xrc/xh_mdi.cpp
@@ -21,11 +21,11 @@
 
 #ifndef WX_PRECOMP
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/mdi.h"
 #include "wx/dialog.h" // to get wxDEFAULT_DIALOG_STYLE
-#include "wx/log.h"
 
 IMPLEMENT_DYNAMIC_CLASS(wxMdiXmlHandler, wxXmlResourceHandler)
 
diff --git a/src/xrc/xh_notbk.cpp b/src/xrc/xh_notbk.cpp
index 15efb8fca0..0c7df45439 100644
--- a/src/xrc/xh_notbk.cpp
+++ b/src/xrc/xh_notbk.cpp
@@ -19,7 +19,10 @@
 
 #include "wx/xrc/xh_notbk.h"
 
-#include "wx/log.h"
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/notebook.h"
 #include "wx/imaglist.h"
 #include "wx/sizer.h"
diff --git a/src/xrc/xh_sizer.cpp b/src/xrc/xh_sizer.cpp
index 3d059fbf44..8d6d219261 100644
--- a/src/xrc/xh_sizer.cpp
+++ b/src/xrc/xh_sizer.cpp
@@ -18,9 +18,13 @@
 #if wxUSE_XRC
 
 #include "wx/xrc/xh_sizer.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/sizer.h"
 #include "wx/gbsizer.h"
-#include "wx/log.h"
 #include "wx/statbox.h"
 #include "wx/notebook.h"
 #include "wx/panel.h"
diff --git a/src/xrc/xh_split.cpp b/src/xrc/xh_split.cpp
index f9e89a36bd..f1dc831246 100644
--- a/src/xrc/xh_split.cpp
+++ b/src/xrc/xh_split.cpp
@@ -18,8 +18,12 @@
 #if wxUSE_XRC
 
 #include "wx/xrc/xh_split.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/splitter.h"
-#include "wx/log.h"
 
 IMPLEMENT_DYNAMIC_CLASS(wxSplitterWindowXmlHandler, wxXmlResourceHandler)
 
diff --git a/src/xrc/xh_statbar.cpp b/src/xrc/xh_statbar.cpp
index c49c0c33a4..a678ea9495 100644
--- a/src/xrc/xh_statbar.cpp
+++ b/src/xrc/xh_statbar.cpp
@@ -21,11 +21,10 @@
 
 #ifndef WX_PRECOMP
     #include "wx/string.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/frame.h"
-#include "wx/log.h"
-
 #include "wx/statusbr.h"
 
 IMPLEMENT_DYNAMIC_CLASS(wxStatusBarXmlHandler, wxXmlResourceHandler)
diff --git a/src/xrc/xh_treebk.cpp b/src/xrc/xh_treebk.cpp
index b2394c6dcf..8f2fdaedf3 100644
--- a/src/xrc/xh_treebk.cpp
+++ b/src/xrc/xh_treebk.cpp
@@ -19,9 +19,12 @@
 
 #include "wx/xrc/xh_treebk.h"
 
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/treebook.h"
 #include "wx/imaglist.h"
-#include "wx/log.h"
 
 IMPLEMENT_DYNAMIC_CLASS(wxTreebookXmlHandler, wxXmlResourceHandler)
 
diff --git a/src/xrc/xh_unkwn.cpp b/src/xrc/xh_unkwn.cpp
index c60fd51170..a7b7beaf44 100644
--- a/src/xrc/xh_unkwn.cpp
+++ b/src/xrc/xh_unkwn.cpp
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        xh_unkwn.cpp
+// Name:        src/xrc/xh_unkwn.cpp
 // Purpose:     XRC resource for unknown widget
 // Author:      Vaclav Slavik
 // Created:     2000/09/09
@@ -18,8 +18,12 @@
 #if wxUSE_XRC
 
 #include "wx/xrc/xh_unkwn.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/window.h"
-#include "wx/log.h"
 #include "wx/sizer.h"
 #include "wx/panel.h"
 
diff --git a/src/xrc/xh_wizrd.cpp b/src/xrc/xh_wizrd.cpp
index fd49ef89f7..6efb06635a 100644
--- a/src/xrc/xh_wizrd.cpp
+++ b/src/xrc/xh_wizrd.cpp
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        xh_wizrd.cpp
+// Name:        src/xrc/xh_wizrd.cpp
 // Purpose:     XRC resource for wxWizard
 // Author:      Vaclav Slavik
 // Created:     2003/03/01
@@ -18,7 +18,11 @@
 #if wxUSE_XRC && wxUSE_WIZARDDLG
 
 #include "wx/xrc/xh_wizrd.h"
-#include "wx/log.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+#endif
+
 #include "wx/wizard.h"
 
 IMPLEMENT_DYNAMIC_CLASS(wxWizardXmlHandler, wxXmlResourceHandler)
diff --git a/src/xrc/xmlres.cpp b/src/xrc/xmlres.cpp
index 3b4ddb5fb6..ea902a5407 100644
--- a/src/xrc/xmlres.cpp
+++ b/src/xrc/xmlres.cpp
@@ -21,6 +21,7 @@
 
 #ifndef WX_PRECOMP
     #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
 #ifndef __WXWINCE__
@@ -33,7 +34,6 @@
 #include "wx/wfstream.h"
 #include "wx/filesys.h"
 #include "wx/filename.h"
-#include "wx/log.h"
 #include "wx/tokenzr.h"
 #include "wx/fontenum.h"
 #include "wx/module.h"
-- 
2.47.2