diff -r a823baea47d8 -r ce3621d75112 configure.in
--- a/configure.in	Sun Aug 11 16:57:28 2013 +0300
+++ b/configure.in	Sun Aug 11 19:53:00 2013 +0300
@@ -95,7 +95,7 @@
   AM_OPTIONS_WXCONFIG
 
   MIN_WX_VERSION="2.8.12"
-  AM_PATH_WXCONFIG($MIN_WX_VERSION, wxWin=1, , [aui,xrc,adv,core,xml,net,base], [--unicode=yes --universal=no])
+  WX_CONFIG_CHECK($MIN_WX_VERSION, wxWin=1, , [aui,html,xrc,adv,core,xml,net,base], [--unicode=yes --universal=no])
   if test "$wxWin" != 1; then
     AC_MSG_ERROR([
         wxWidgets must be installed on your system
@@ -111,8 +111,8 @@
         equivalent variable and wxWidgets version is $MIN_WX_VERSION or above.
     ])
   fi
-  if test "$wx_config_major_version" -gt "2" || test "$wx_config_minor_version" -gt "8"; then
-    AC_MSG_ERROR([You need to use wxWidgets 2.8.x to compile this program.])
+  if test "$wx_config_major_version" -gt "2" || test "$wx_config_minor_version" -gt "9"; then
+    AC_MSG_ERROR([You need to use wxWidgets 2.9.x to compile this program.])
   fi
 
   # --universal=no doesn't work correctly, it still accepts universal builds. Reject it manually here.
diff -r a823baea47d8 -r ce3621d75112 m4/wxwin.m4
--- a/m4/wxwin.m4	Sun Aug 11 16:57:28 2013 +0300
+++ b/m4/wxwin.m4	Sun Aug 11 19:53:00 2013 +0300
@@ -1,13 +1,49 @@
+dnl ---------------------------------------------------------------------------
+dnl Author:          wxWidgets development team,
+dnl                  Francesco Montorsi,
+dnl                  Bob McCown (Mac-testing)
+dnl Creation date:   24/11/2001
+dnl RCS-ID:          $Id$
+dnl ---------------------------------------------------------------------------
+
+dnl ===========================================================================
+dnl Table of Contents of this macro file:
+dnl -------------------------------------
+dnl
+dnl SECTION A: wxWidgets main macros
+dnl  - WX_CONFIG_OPTIONS
+dnl  - WX_CONFIG_CHECK
+dnl  - WXRC_CHECK
+dnl  - WX_STANDARD_OPTIONS
+dnl  - WX_CONVERT_STANDARD_OPTIONS_TO_WXCONFIG_FLAGS
+dnl  - WX_DETECT_STANDARD_OPTION_VALUES
+dnl
+dnl SECTION B: wxWidgets-related utilities
+dnl  - WX_LIKE_LIBNAME
+dnl  - WX_ARG_ENABLE_YESNOAUTO
+dnl  - WX_ARG_WITH_YESNOAUTO
+dnl
+dnl SECTION C: messages to the user
+dnl  - WX_STANDARD_OPTIONS_SUMMARY_MSG
+dnl  - WX_STANDARD_OPTIONS_SUMMARY_MSG_BEGIN
+dnl  - WX_STANDARD_OPTIONS_SUMMARY_MSG_END
+dnl  - WX_BOOLOPT_SUMMARY
+dnl
+dnl The special "WX_DEBUG_CONFIGURE" variable can be set to 1 to enable extra
+dnl debug output on stdout from these macros.
+dnl ===========================================================================
+
+
 dnl ---------------------------------------------------------------------------
 dnl Macros for wxWidgets detection. Typically used in configure.in as:
 dnl
 dnl     AC_ARG_ENABLE(...)
 dnl     AC_ARG_WITH(...)
 dnl        ...
-dnl     AM_OPTIONS_WXCONFIG
+dnl     WX_CONFIG_OPTIONS
 dnl        ...
 dnl        ...
-dnl     AM_PATH_WXCONFIG(2.6.0, wxWin=1)
+dnl     WX_CONFIG_CHECK([2.6.0], [wxWin=1])
 dnl     if test "$wxWin" != 1; then
 dnl        AC_MSG_ERROR([
 dnl                wxWidgets must be installed on your system
@@ -24,16 +60,46 @@
 dnl     CFLAGS="$CFLAGS $WX_CFLAGS_ONLY"
 dnl
 dnl     LIBS="$LIBS $WX_LIBS"
+dnl
+dnl If you want to support standard --enable-debug/unicode/shared options, you
+dnl may do the following:
+dnl
+dnl     ...
+dnl     AC_CANONICAL_SYSTEM
+dnl
+dnl     # define configure options
+dnl     WX_CONFIG_OPTIONS
+dnl     WX_STANDARD_OPTIONS([debug,unicode,shared,toolkit,wxshared])
+dnl
+dnl     # basic configure checks
+dnl     ...
+dnl
+dnl     # we want to always have DEBUG==WX_DEBUG and UNICODE==WX_UNICODE
+dnl     WX_DEBUG=$DEBUG
+dnl     WX_UNICODE=$UNICODE
+dnl
+dnl     WX_CONVERT_STANDARD_OPTIONS_TO_WXCONFIG_FLAGS
+dnl     WX_CONFIG_CHECK([2.8.0], [wxWin=1],,[html,core,net,base],[$WXCONFIG_FLAGS])
+dnl     WX_DETECT_STANDARD_OPTION_VALUES
+dnl
+dnl     # write the output files
+dnl     AC_CONFIG_FILES([Makefile ...])
+dnl     AC_OUTPUT
+dnl
+dnl     # optional: just to show a message to the user
+dnl     WX_STANDARD_OPTIONS_SUMMARY_MSG
+dnl
 dnl ---------------------------------------------------------------------------
 
+
 dnl ---------------------------------------------------------------------------
-dnl AM_OPTIONS_WXCONFIG
+dnl WX_CONFIG_OPTIONS
 dnl
 dnl adds support for --wx-prefix, --wx-exec-prefix, --with-wxdir and
 dnl --wx-config command line options
 dnl ---------------------------------------------------------------------------
 
-AC_DEFUN([AM_OPTIONS_WXCONFIG],
+AC_DEFUN([WX_CONFIG_OPTIONS],
 [
     AC_ARG_WITH(wxdir,
                 [  --with-wxdir=PATH       Use uninstalled version of wxWidgets in PATH],
@@ -76,7 +142,7 @@
 ])
 
 dnl ---------------------------------------------------------------------------
-dnl AM_PATH_WXCONFIG(VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND
+dnl WX_CONFIG_CHECK(VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND
 dnl                  [, WX-LIBS [, ADDITIONAL-WX-CONFIG-FLAGS]]]])
 dnl
 dnl Test for wxWidgets, and define WX_C*FLAGS, WX_LIBS and WX_LIBS_STATIC
@@ -86,23 +152,23 @@
 dnl case the macro won't even waste time on tests for its existence.
 dnl
 dnl Optional WX-LIBS argument contains comma- or space-separated list of
-dnl wxWidgets libraries to link against (it may include contrib libraries). If
-dnl it is not specified then WX_LIBS and WX_LIBS_STATIC will contain flags to
-dnl link with all of the core wxWidgets libraries.
+dnl wxWidgets libraries to link against. If it is not specified then WX_LIBS
+dnl and WX_LIBS_STATIC will contain flags to link with all of the core
+dnl wxWidgets libraries.
 dnl
 dnl Optional ADDITIONAL-WX-CONFIG-FLAGS argument is appended to wx-config
 dnl invocation command in present. It can be used to fine-tune lookup of
 dnl best wxWidgets build available.
 dnl
 dnl Example use:
-dnl   AM_PATH_WXCONFIG([2.6.0], [wxWin=1], [wxWin=0], [html,core,net]
+dnl   WX_CONFIG_CHECK([2.6.0], [wxWin=1], [wxWin=0], [html,core,net]
 dnl                    [--unicode --debug])
 dnl ---------------------------------------------------------------------------
 
 dnl
 dnl Get the cflags and libraries from the wx-config script
 dnl
-AC_DEFUN([AM_PATH_WXCONFIG],
+AC_DEFUN([WX_CONFIG_CHECK],
 [
   dnl do we have wx-config name: it can be wx-config or wxd-config or ...
   if test x${WX_CONFIG_NAME+set} != xset ; then
@@ -145,7 +211,9 @@
       AC_MSG_CHECKING([for wxWidgets version >= $min_wx_version ($5)])
     fi
 
-    WX_CONFIG_WITH_ARGS="$WX_CONFIG_PATH $wx_config_args $5 $4"
+    dnl don't add the libraries ($4) to this variable as this would result in
+    dnl an error when it's used with --version below
+    WX_CONFIG_WITH_ARGS="$WX_CONFIG_PATH $wx_config_args $5"
 
     WX_VERSION=`$WX_CONFIG_WITH_ARGS --version 2>/dev/null`
     wx_config_major_version=`echo $WX_VERSION | \
@@ -167,16 +235,15 @@
                               [$wx_requested_micro_version])
 
     if test -n "$wx_ver_ok"; then
-
       AC_MSG_RESULT(yes (version $WX_VERSION))
-      WX_LIBS=`$WX_CONFIG_WITH_ARGS --libs`
+      WX_LIBS=`$WX_CONFIG_WITH_ARGS --libs $4`
 
       dnl is this even still appropriate?  --static is a real option now
       dnl and WX_CONFIG_WITH_ARGS is likely to contain it if that is
       dnl what the user actually wants, making this redundant at best.
       dnl For now keep it in case anyone actually used it in the past.
       AC_MSG_CHECKING([for wxWidgets static library])
-      WX_LIBS_STATIC=`$WX_CONFIG_WITH_ARGS --static --libs 2>/dev/null`
+      WX_LIBS_STATIC=`$WX_CONFIG_WITH_ARGS --static --libs $4 2>/dev/null`
       if test "x$WX_LIBS_STATIC" = "x"; then
         AC_MSG_RESULT(no)
       else
@@ -221,7 +288,7 @@
 
       if test "x$wx_has_cppflags" = x ; then
          dnl no choice but to define all flags like CFLAGS
-         WX_CFLAGS=`$WX_CONFIG_WITH_ARGS --cflags`
+         WX_CFLAGS=`$WX_CONFIG_WITH_ARGS --cflags $4`
          WX_CPPFLAGS=$WX_CFLAGS
          WX_CXXFLAGS=$WX_CFLAGS
 
@@ -229,9 +296,9 @@
          WX_CXXFLAGS_ONLY=$WX_CFLAGS
       else
          dnl we have CPPFLAGS included in CFLAGS included in CXXFLAGS
-         WX_CPPFLAGS=`$WX_CONFIG_WITH_ARGS --cppflags`
-         WX_CXXFLAGS=`$WX_CONFIG_WITH_ARGS --cxxflags`
-         WX_CFLAGS=`$WX_CONFIG_WITH_ARGS --cflags`
+         WX_CPPFLAGS=`$WX_CONFIG_WITH_ARGS --cppflags $4`
+         WX_CXXFLAGS=`$WX_CONFIG_WITH_ARGS --cxxflags $4`
+         WX_CFLAGS=`$WX_CONFIG_WITH_ARGS --cflags $4`
 
          WX_CFLAGS_ONLY=`echo $WX_CFLAGS | sed "s@^$WX_CPPFLAGS *@@"`
          WX_CXXFLAGS_ONLY=`echo $WX_CXXFLAGS | sed "s@^$WX_CFLAGS *@@"`
@@ -254,7 +321,32 @@
        WX_LIBS=""
        WX_LIBS_STATIC=""
        WX_RESCOMP=""
-       ifelse([$3], , :, [$3])
+
+       if test ! -z "$5"; then
+
+          wx_error_message="
+    The configuration you asked for $PACKAGE_NAME requires a wxWidgets
+    build with the following settings:
+        $5
+    but such build is not available.
+
+    To see the wxWidgets builds available on this system, please use
+    'wx-config --list' command. To use the default build, returned by
+    'wx-config --selected-config', use the options with their 'auto'
+    default values."
+
+       fi
+
+       wx_error_message="
+    The requested wxWidgets build couldn't be found.
+    $wx_error_message
+
+    If you still get this error, then check that 'wx-config' is
+    in path, the directory where wxWidgets libraries are installed
+    (returned by 'wx-config --libs' command) is in LD_LIBRARY_PATH
+    or equivalent variable and wxWidgets version is $1 or above."
+
+       ifelse([$3], , AC_MSG_ERROR([$wx_error_message]), [$3])
 
     fi
   else
@@ -279,6 +371,15 @@
   AC_SUBST(WX_LIBS_STATIC)
   AC_SUBST(WX_VERSION)
   AC_SUBST(WX_RESCOMP)
+
+  dnl need to export also WX_VERSION_MINOR and WX_VERSION_MAJOR symbols
+  dnl to support wxpresets bakefiles (we export also WX_VERSION_MICRO for completeness):
+  WX_VERSION_MAJOR="$wx_config_major_version"
+  WX_VERSION_MINOR="$wx_config_minor_version"
+  WX_VERSION_MICRO="$wx_config_micro_version"
+  AC_SUBST(WX_VERSION_MAJOR)
+  AC_SUBST(WX_VERSION_MINOR)
+  AC_SUBST(WX_VERSION_MICRO)
 ])
 
 dnl ---------------------------------------------------------------------------
@@ -288,9 +389,9 @@
 dnl     AC_ARG_ENABLE(...)
 dnl     AC_ARG_WITH(...)
 dnl        ...
-dnl     AM_OPTIONS_WXCONFIG
+dnl     WX_CONFIG_OPTIONS
 dnl        ...
-dnl     AM_PATH_WXCONFIG(2.6.0, wxWin=1)
+dnl     WX_CONFIG_CHECK(2.6.0, wxWin=1)
 dnl     if test "$wxWin" != 1; then
 dnl        AC_MSG_ERROR([
 dnl                wxWidgets must be installed on your system
@@ -303,7 +404,7 @@
 dnl        ])
 dnl     fi
 dnl
-dnl     AM_PATH_WXRC([HAVE_WXRC=1], [HAVE_WXRC=0])
+dnl     WXRC_CHECK([HAVE_WXRC=1], [HAVE_WXRC=0])
 dnl     if test "x$HAVE_WXRC" != x1; then
 dnl         AC_MSG_ERROR([
 dnl                The wxrc program was not installed or not found.
@@ -319,23 +420,21 @@
 dnl     LDFLAGS="$LDFLAGS $WX_LIBS"
 dnl ---------------------------------------------------------------------------
 
-
-
 dnl ---------------------------------------------------------------------------
-dnl AM_PATH_WXRC([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
+dnl WXRC_CHECK([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
 dnl
 dnl Test for wxWidgets' wxrc program for creating either C++, Python or XRS
 dnl resources.  The variable WXRC will be set and substituted in the configure
 dnl script and Makefiles.
 dnl
 dnl Example use:
-dnl   AM_PATH_WXRC([wxrc=1], [wxrc=0])
+dnl   WXRC_CHECK([wxrc=1], [wxrc=0])
 dnl ---------------------------------------------------------------------------
 
 dnl
 dnl wxrc program from the wx-config script
 dnl
-AC_DEFUN([AM_PATH_WXRC],
+AC_DEFUN([WXRC_CHECK],
 [
   AC_ARG_VAR([WXRC], [Path to wxWidget's wxrc resource compiler])
 
@@ -364,3 +463,598 @@
     AC_SUBST(WXRC)
   fi
 ])
+
+dnl ---------------------------------------------------------------------------
+dnl WX_LIKE_LIBNAME([output-var] [prefix], [name])
+dnl
+dnl Sets the "output-var" variable to the name of a library named with same
+dnl wxWidgets rule.
+dnl E.g. for output-var=='lib', name=='test', prefix='mine', sets
+dnl      the $lib variable to:
+dnl          'mine_gtk2ud_test-2.8'
+dnl      if WX_PORT=gtk2, WX_UNICODE=1, WX_DEBUG=1 and WX_RELEASE=28
+dnl ---------------------------------------------------------------------------
+AC_DEFUN([WX_LIKE_LIBNAME],
+    [
+        wx_temp="$2""_""$WX_PORT"
+
+        dnl add the [u][d] string
+        if test "$WX_UNICODE" = "1"; then
+            wx_temp="$wx_temp""u"
+        fi
+        if test "$WX_DEBUG" = "1"; then
+            wx_temp="$wx_temp""d"
+        fi
+
+        dnl complete the name of the lib
+        wx_temp="$wx_temp""_""$3""-$WX_VERSION_MAJOR.$WX_VERSION_MINOR"
+
+        dnl save it in the user's variable
+        $1=$wx_temp
+    ])
+
+dnl ---------------------------------------------------------------------------
+dnl WX_ARG_ENABLE_YESNOAUTO/WX_ARG_WITH_YESNOAUTO
+dnl
+dnl Two little custom macros which define the ENABLE/WITH configure arguments.
+dnl Macro arguments:
+dnl $1 = the name of the --enable / --with  feature
+dnl $2 = the name of the variable associated
+dnl $3 = the description of that feature
+dnl $4 = the default value for that feature
+dnl $5 = additional action to do in case option is given with "yes" value
+dnl ---------------------------------------------------------------------------
+AC_DEFUN([WX_ARG_ENABLE_YESNOAUTO],
+         [AC_ARG_ENABLE($1,
+            AC_HELP_STRING([--enable-$1], [$3 (default is $4)]),
+            [], [enableval="$4"])
+
+            dnl Show a message to the user about this option
+            AC_MSG_CHECKING([for the --enable-$1 option])
+            if test "$enableval" = "yes" ; then
+                AC_MSG_RESULT([yes])
+                $2=1
+                $5
+            elif test "$enableval" = "no" ; then
+                AC_MSG_RESULT([no])
+                $2=0
+            elif test "$enableval" = "auto" ; then
+                AC_MSG_RESULT([will be automatically detected])
+                $2="auto"
+            else
+                AC_MSG_ERROR([
+    Unrecognized option value (allowed values: yes, no, auto)
+                ])
+            fi
+         ])
+
+AC_DEFUN([WX_ARG_WITH_YESNOAUTO],
+         [AC_ARG_WITH($1,
+            AC_HELP_STRING([--with-$1], [$3 (default is $4)]),
+            [], [withval="$4"])
+
+            dnl Show a message to the user about this option
+            AC_MSG_CHECKING([for the --with-$1 option])
+            if test "$withval" = "yes" ; then
+                AC_MSG_RESULT([yes])
+                $2=1
+                $5
+            dnl NB: by default we don't allow --with-$1=no option
+            dnl     since it does not make much sense !
+            elif test "$6" = "1" -a "$withval" = "no" ; then
+                AC_MSG_RESULT([no])
+                $2=0
+            elif test "$withval" = "auto" ; then
+                AC_MSG_RESULT([will be automatically detected])
+                $2="auto"
+            else
+                AC_MSG_ERROR([
+    Unrecognized option value (allowed values: yes, auto)
+                ])
+            fi
+         ])
+
+
+dnl ---------------------------------------------------------------------------
+dnl WX_STANDARD_OPTIONS([options-to-add])
+dnl
+dnl Adds to the configure script one or more of the following options:
+dnl   --enable-[debug|unicode|shared|wxshared|wxdebug]
+dnl   --with-[gtk|msw|motif|x11|mac|dfb]
+dnl   --with-wxversion
+dnl Then checks for their presence and eventually set the DEBUG, UNICODE, SHARED,
+dnl PORT, WX_SHARED, WX_DEBUG, variables to one of the "yes", "no", "auto" values.
+dnl
+dnl Note that e.g. UNICODE != WX_UNICODE; the first is the value of the
+dnl --enable-unicode option (in boolean format) while the second indicates
+dnl if wxWidgets was built in Unicode mode (and still is in boolean format).
+dnl ---------------------------------------------------------------------------
+AC_DEFUN([WX_STANDARD_OPTIONS],
+        [
+
+        dnl the following lines will expand to WX_ARG_ENABLE_YESNOAUTO calls if and only if
+        dnl the $1 argument contains respectively the debug,unicode or shared options.
+
+        dnl be careful here not to set debug flag if only "wxdebug" was specified
+        ifelse(regexp([$1], [\bdebug]), [-1],,
+               [WX_ARG_ENABLE_YESNOAUTO([debug], [DEBUG], [Build in debug mode], [auto])])
+
+        ifelse(index([$1], [unicode]), [-1],,
+               [WX_ARG_ENABLE_YESNOAUTO([unicode], [UNICODE], [Build in Unicode mode], [auto])])
+
+        ifelse(regexp([$1], [\bshared]), [-1],,
+               [WX_ARG_ENABLE_YESNOAUTO([shared], [SHARED], [Build as shared library], [auto])])
+
+        dnl WX_ARG_WITH_YESNOAUTO cannot be used for --with-toolkit since it's an option
+        dnl which must be able to accept the auto|gtk1|gtk2|msw|... values
+        ifelse(index([$1], [toolkit]), [-1],,
+               [
+                AC_ARG_WITH([toolkit],
+                            AC_HELP_STRING([--with-toolkit],
+                                           [Build against a specific wxWidgets toolkit (default is auto)]),
+                            [], [withval="auto"])
+
+                dnl Show a message to the user about this option
+                AC_MSG_CHECKING([for the --with-toolkit option])
+                if test "$withval" = "auto" ; then
+                    AC_MSG_RESULT([will be automatically detected])
+                    TOOLKIT="auto"
+                else
+                    TOOLKIT="$withval"
+
+                    dnl PORT must be one of the allowed values
+                    if test "$TOOLKIT" != "gtk1" -a "$TOOLKIT" != "gtk2" -a \
+                            "$TOOLKIT" != "msw" -a "$TOOLKIT" != "motif" -a \
+                            "$TOOLKIT" != "osx_carbon" -a "$TOOLKIT" != "osx_cocoa" -a \
+                            "$TOOLKIT" != "dfb" -a "$TOOLKIT" != "x11"; then
+                        AC_MSG_ERROR([
+    Unrecognized option value (allowed values: auto, gtk1, gtk2, msw, motif, osx_carbon, osx_cocoa, dfb, x11)
+                        ])
+                    fi
+
+                    AC_MSG_RESULT([$TOOLKIT])
+                fi
+               ])
+
+        dnl ****** IMPORTANT *******
+        dnl   Unlike for the UNICODE setting, you can build your program in
+        dnl   shared mode against a static build of wxWidgets. Thus we have the
+        dnl   following option which allows these mixtures. E.g.
+        dnl
+        dnl      ./configure --disable-shared --with-wxshared
+        dnl
+        dnl   will build your library in static mode against the first available
+        dnl   shared build of wxWidgets.
+        dnl
+        dnl   Note that's not possible to do the viceversa:
+        dnl
+        dnl      ./configure --enable-shared --without-wxshared
+        dnl
+        dnl   Doing so you would try to build your library in shared mode against a static
+        dnl   build of wxWidgets. This is not possible (you would mix PIC and non PIC code) !
+        dnl   A check for this combination of options is in WX_DETECT_STANDARD_OPTION_VALUES
+        dnl   (where we know what 'auto' should be expanded to).
+        dnl
+        dnl   If you try to build something in ANSI mode against a UNICODE build
+        dnl   of wxWidgets or in RELEASE mode against a DEBUG build of wxWidgets,
+        dnl   then at best you'll get ton of linking errors !
+        dnl ************************
+
+        ifelse(index([$1], [wxshared]), [-1],,
+               [
+                WX_ARG_WITH_YESNOAUTO(
+                    [wxshared], [WX_SHARED],
+                    [Force building against a shared build of wxWidgets, even if --disable-shared is given],
+                    [auto], [], [1])
+               ])
+
+        dnl Just like for SHARED and WX_SHARED it may happen that some adventurous
+        dnl peoples will want to mix a wxWidgets release build with a debug build of
+        dnl his app/lib. So, we have both DEBUG and WX_DEBUG variables.
+        ifelse(index([$1], [wxdebug]), [-1],,
+               [
+                WX_ARG_WITH_YESNOAUTO(
+                    [wxdebug], [WX_DEBUG],
+                    [Force building against a debug build of wxWidgets, even if --disable-debug is given],
+                    [auto], [], [1])
+               ])
+
+        dnl WX_ARG_WITH_YESNOAUTO cannot be used for --with-wxversion since it's an option
+        dnl which accepts the "auto|2.6|2.7|2.8|2.9|3.0" etc etc values
+        ifelse(index([$1], [wxversion]), [-1],,
+               [
+                AC_ARG_WITH([wxversion],
+                            AC_HELP_STRING([--with-wxversion],
+                                           [Build against a specific version of wxWidgets (default is auto)]),
+                            [], [withval="auto"])
+
+                dnl Show a message to the user about this option
+                AC_MSG_CHECKING([for the --with-wxversion option])
+                if test "$withval" = "auto" ; then
+                    AC_MSG_RESULT([will be automatically detected])
+                    WX_RELEASE="auto"
+                else
+
+                    wx_requested_major_version=`echo $withval | \
+                        sed 's/\([[0-9]]*\).\([[0-9]]*\).*/\1/'`
+                    wx_requested_minor_version=`echo $withval | \
+                        sed 's/\([[0-9]]*\).\([[0-9]]*\).*/\2/'`
+
+                    dnl both vars above must be exactly 1 digit
+                    if test "${#wx_requested_major_version}" != "1" -o \
+                            "${#wx_requested_minor_version}" != "1" ; then
+                        AC_MSG_ERROR([
+    Unrecognized option value (allowed values: auto, 2.6, 2.7, 2.8, 2.9, 3.0)
+                        ])
+                    fi
+
+                    WX_RELEASE="$wx_requested_major_version"".""$wx_requested_minor_version"
+                    AC_MSG_RESULT([$WX_RELEASE])
+                fi
+               ])
+
+        if test "$WX_DEBUG_CONFIGURE" = "1"; then
+            echo "[[dbg]] DEBUG: $DEBUG, WX_DEBUG: $WX_DEBUG"
+            echo "[[dbg]] UNICODE: $UNICODE, WX_UNICODE: $WX_UNICODE"
+            echo "[[dbg]] SHARED: $SHARED, WX_SHARED: $WX_SHARED"
+            echo "[[dbg]] TOOLKIT: $TOOLKIT, WX_TOOLKIT: $WX_TOOLKIT"
+            echo "[[dbg]] VERSION: $VERSION, WX_RELEASE: $WX_RELEASE"
+        fi
+    ])
+
+
+dnl ---------------------------------------------------------------------------
+dnl WX_CONVERT_STANDARD_OPTIONS_TO_WXCONFIG_FLAGS
+dnl
+dnl Sets the WXCONFIG_FLAGS string using the SHARED,DEBUG,UNICODE variable values
+dnl which are different from "auto".
+dnl Thus this macro needs to be called only once all options have been set.
+dnl ---------------------------------------------------------------------------
+AC_DEFUN([WX_CONVERT_STANDARD_OPTIONS_TO_WXCONFIG_FLAGS],
+        [
+        if test "$WX_SHARED" = "1" ; then
+            WXCONFIG_FLAGS="--static=no "
+        elif test "$WX_SHARED" = "0" ; then
+            WXCONFIG_FLAGS="--static=yes "
+        fi
+
+        if test "$WX_DEBUG" = "1" ; then
+            WXCONFIG_FLAGS="$WXCONFIG_FLAGS""--debug=yes "
+        elif test "$WX_DEBUG" = "0" ; then
+            WXCONFIG_FLAGS="$WXCONFIG_FLAGS""--debug=no "
+        fi
+
+        dnl The user should have set WX_UNICODE=UNICODE
+        if test "$WX_UNICODE" = "1" ; then
+            WXCONFIG_FLAGS="$WXCONFIG_FLAGS""--unicode=yes "
+        elif test "$WX_UNICODE" = "0" ; then
+            WXCONFIG_FLAGS="$WXCONFIG_FLAGS""--unicode=no "
+        fi
+
+        if test "$TOOLKIT" != "auto" ; then
+            WXCONFIG_FLAGS="$WXCONFIG_FLAGS""--toolkit=$TOOLKIT "
+        fi
+
+        if test "$WX_RELEASE" != "auto" ; then
+            WXCONFIG_FLAGS="$WXCONFIG_FLAGS""--version=$WX_RELEASE "
+        fi
+
+        dnl strip out the last space of the string
+        WXCONFIG_FLAGS=${WXCONFIG_FLAGS% }
+
+        if test "$WX_DEBUG_CONFIGURE" = "1"; then
+            echo "[[dbg]] WXCONFIG_FLAGS: $WXCONFIG_FLAGS"
+        fi
+    ])
+
+
+dnl ---------------------------------------------------------------------------
+dnl _WX_SELECTEDCONFIG_CHECKFOR([RESULTVAR], [STRING], [MSG]
+dnl                             [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
+dnl
+dnl Outputs the given MSG. Then searches the given STRING in the wxWidgets
+dnl additional CPP flags and put the result of the search in WX_$RESULTVAR
+dnl also adding the "yes" or "no" message result to MSG.
+dnl ---------------------------------------------------------------------------
+AC_DEFUN([_WX_SELECTEDCONFIG_CHECKFOR],
+        [
+        if test "$$1" = "auto" ; then
+
+            dnl The user does not have particular preferences for this option;
+            dnl so we will detect the wxWidgets relative build setting and use it
+            AC_MSG_CHECKING([$3])
+
+            dnl set WX_$1 variable to 1 if the $WX_SELECTEDCONFIG contains the $2
+            dnl string or to 0 otherwise.
+            dnl NOTE: 'expr match STRING REGEXP' cannot be used since on Mac it
+            dnl       doesn't work; we use 'expr STRING : REGEXP' instead
+            WX_$1=$(expr "$WX_SELECTEDCONFIG" : ".*$2.*")
+
+            if test "$WX_$1" != "0"; then
+                WX_$1=1
+                AC_MSG_RESULT([yes])
+                ifelse([$4], , :, [$4])
+            else
+                WX_$1=0
+                AC_MSG_RESULT([no])
+                ifelse([$5], , :, [$5])
+            fi
+        else
+
+            dnl Use the setting given by the user
+            WX_$1=$$1
+        fi
+    ])
+
+dnl ---------------------------------------------------------------------------
+dnl WX_DETECT_STANDARD_OPTION_VALUES
+dnl
+dnl Detects the values of the following variables:
+dnl 1) WX_RELEASE
+dnl 2) WX_UNICODE
+dnl 3) WX_DEBUG
+dnl 4) WX_SHARED    (and also WX_STATIC)
+dnl 5) WX_PORT
+dnl from the previously selected wxWidgets build; this macro in fact must be
+dnl called *after* calling the WX_CONFIG_CHECK macro.
+dnl
+dnl Note that the WX_VERSION_MAJOR, WX_VERSION_MINOR symbols are already set
+dnl by WX_CONFIG_CHECK macro
+dnl ---------------------------------------------------------------------------
+AC_DEFUN([WX_DETECT_STANDARD_OPTION_VALUES],
+        [
+        dnl IMPORTANT: WX_VERSION contains all three major.minor.micro digits,
+        dnl            while WX_RELEASE only the major.minor ones.
+        WX_RELEASE="$WX_VERSION_MAJOR""$WX_VERSION_MINOR"
+        if test $WX_RELEASE -lt 26 ; then
+
+            AC_MSG_ERROR([
+    Cannot detect the wxWidgets configuration for the selected wxWidgets build
+    since its version is $WX_VERSION < 2.6.0; please install a newer
+    version of wxWidgets.
+                         ])
+        fi
+
+        dnl The wx-config we are using understands the "--selected_config"
+        dnl option which returns an easy-parseable string !
+        WX_SELECTEDCONFIG=$($WX_CONFIG_WITH_ARGS --selected_config)
+
+        if test "$WX_DEBUG_CONFIGURE" = "1"; then
+            echo "[[dbg]] Using wx-config --selected-config"
+            echo "[[dbg]] WX_SELECTEDCONFIG: $WX_SELECTEDCONFIG"
+        fi
+
+
+        dnl we could test directly for WX_SHARED with a line like:
+        dnl    _WX_SELECTEDCONFIG_CHECKFOR([SHARED], [shared],
+        dnl                                [if wxWidgets was built in SHARED mode])
+        dnl but wx-config --selected-config DOES NOT outputs the 'shared'
+        dnl word when wx was built in shared mode; it rather outputs the
+        dnl 'static' word when built in static mode.
+        if test $WX_SHARED = "1"; then
+            STATIC=0
+        elif test $WX_SHARED = "0"; then
+            STATIC=1
+        elif test $WX_SHARED = "auto"; then
+            STATIC="auto"
+        fi
+
+        dnl Now set the WX_UNICODE, WX_DEBUG, WX_STATIC variables
+        _WX_SELECTEDCONFIG_CHECKFOR([UNICODE], [unicode],
+                                    [if wxWidgets was built with UNICODE enabled])
+        _WX_SELECTEDCONFIG_CHECKFOR([DEBUG], [debug],
+                                    [if wxWidgets was built in DEBUG mode])
+        _WX_SELECTEDCONFIG_CHECKFOR([STATIC], [static],
+                                    [if wxWidgets was built in STATIC mode])
+
+        dnl init WX_SHARED from WX_STATIC
+        if test "$WX_STATIC" != "0"; then
+            WX_SHARED=0
+        else
+            WX_SHARED=1
+        fi
+
+        AC_SUBST(WX_UNICODE)
+        AC_SUBST(WX_DEBUG)
+        AC_SUBST(WX_SHARED)
+
+        dnl detect the WX_PORT to use
+        if test "$TOOLKIT" = "auto" ; then
+
+            dnl The user does not have particular preferences for this option;
+            dnl so we will detect the wxWidgets relative build setting and use it
+            AC_MSG_CHECKING([which wxWidgets toolkit was selected])
+
+            WX_GTKPORT1=$(expr "$WX_SELECTEDCONFIG" : ".*gtk1.*")
+            WX_GTKPORT2=$(expr "$WX_SELECTEDCONFIG" : ".*gtk2.*")
+            WX_MSWPORT=$(expr "$WX_SELECTEDCONFIG" : ".*msw.*")
+            WX_MOTIFPORT=$(expr "$WX_SELECTEDCONFIG" : ".*motif.*")
+            WX_OSXCOCOAPORT=$(expr "$WX_SELECTEDCONFIG" : ".*osx_cocoa.*")
+            WX_OSXCARBONPORT=$(expr "$WX_SELECTEDCONFIG" : ".*osx_carbon.*")
+            WX_X11PORT=$(expr "$WX_SELECTEDCONFIG" : ".*x11.*")
+            WX_DFBPORT=$(expr "$WX_SELECTEDCONFIG" : ".*dfb.*")
+
+            WX_PORT="unknown"
+            if test "$WX_GTKPORT1" != "0"; then WX_PORT="gtk1"; fi
+            if test "$WX_GTKPORT2" != "0"; then WX_PORT="gtk2"; fi
+            if test "$WX_MSWPORT" != "0"; then WX_PORT="msw"; fi
+            if test "$WX_MOTIFPORT" != "0"; then WX_PORT="motif"; fi
+            if test "$WX_OSXCOCOAPORT" != "0"; then WX_PORT="osx_cocoa"; fi
+            if test "$WX_OSXCARBONPORT" != "0"; then WX_PORT="osx_carbon"; fi
+            if test "$WX_X11PORT" != "0"; then WX_PORT="x11"; fi
+            if test "$WX_DFBPORT" != "0"; then WX_PORT="dfb"; fi
+
+            dnl NOTE: backward-compatible check for wx2.8; in wx2.9 the mac
+            dnl       ports are called 'osx_cocoa' and 'osx_carbon' (see above)
+            WX_MACPORT=$(expr "$WX_SELECTEDCONFIG" : ".*mac.*")
+            if test "$WX_MACPORT" != "0"; then WX_PORT="mac"; fi
+
+            dnl check at least one of the WX_*PORT has been set !
+
+            if test "$WX_PORT" = "unknown" ; then
+                AC_MSG_ERROR([
+        Cannot detect the currently installed wxWidgets port !
+        Please check your 'wx-config --cxxflags'...
+                            ])
+            fi
+
+            AC_MSG_RESULT([$WX_PORT])
+        else
+
+            dnl Use the setting given by the user
+            if test -z "$TOOLKIT" ; then
+                WX_PORT=$TOOLKIT
+            else
+                dnl try with PORT
+                WX_PORT=$PORT
+            fi
+        fi
+
+        AC_SUBST(WX_PORT)
+
+        if test "$WX_DEBUG_CONFIGURE" = "1"; then
+            echo "[[dbg]] Values of all WX_* options after final detection:"
+            echo "[[dbg]] WX_DEBUG: $WX_DEBUG"
+            echo "[[dbg]] WX_UNICODE: $WX_UNICODE"
+            echo "[[dbg]] WX_SHARED: $WX_SHARED"
+            echo "[[dbg]] WX_RELEASE: $WX_RELEASE"
+            echo "[[dbg]] WX_PORT: $WX_PORT"
+        fi
+
+        dnl Avoid problem described in the WX_STANDARD_OPTIONS which happens when
+        dnl the user gives the options:
+        dnl      ./configure --enable-shared --without-wxshared
+        dnl or just do
+        dnl      ./configure --enable-shared
+        dnl but there is only a static build of wxWidgets available.
+        if test "$WX_SHARED" = "0" -a "$SHARED" = "1"; then
+            AC_MSG_ERROR([
+    Cannot build shared library against a static build of wxWidgets !
+    This error happens because the wxWidgets build which was selected
+    has been detected as static while you asked to build $PACKAGE_NAME
+    as shared library and this is not possible.
+    Use the '--disable-shared' option to build $PACKAGE_NAME
+    as static library or '--with-wxshared' to use wxWidgets as shared library.
+                         ])
+        fi
+
+        dnl now we can finally update the DEBUG,UNICODE,SHARED options
+        dnl to their final values if they were set to 'auto'
+        if test "$DEBUG" = "auto"; then
+            DEBUG=$WX_DEBUG
+        fi
+        if test "$UNICODE" = "auto"; then
+            UNICODE=$WX_UNICODE
+        fi
+        if test "$SHARED" = "auto"; then
+            SHARED=$WX_SHARED
+        fi
+        if test "$TOOLKIT" = "auto"; then
+            TOOLKIT=$WX_PORT
+        fi
+
+        dnl in case the user needs a BUILD=debug/release var...
+        if test "$DEBUG" = "1"; then
+            BUILD="debug"
+        elif test "$DEBUG" = "0" -o "$DEBUG" = ""; then
+            BUILD="release"
+        fi
+
+        dnl respect the DEBUG variable adding the optimize/debug flags
+        dnl NOTE: the CXXFLAGS are merged together with the CPPFLAGS so we
+        dnl       don't need to set them, too
+        if test "$DEBUG" = "1"; then
+            CXXFLAGS="$CXXFLAGS -g -O0"
+            CFLAGS="$CFLAGS -g -O0"
+        else
+            CXXFLAGS="$CXXFLAGS -O2"
+            CFLAGS="$CFLAGS -O2"
+        fi
+    ])
+
+dnl ---------------------------------------------------------------------------
+dnl WX_BOOLOPT_SUMMARY([name of the boolean variable to show summary for],
+dnl                   [what to print when var is 1],
+dnl                   [what to print when var is 0])
+dnl
+dnl Prints $2 when variable $1 == 1 and prints $3 when variable $1 == 0.
+dnl This macro mainly exists just to make configure.ac scripts more readable.
+dnl
+dnl NOTE: you need to use the [" my message"] syntax for 2nd and 3rd arguments
+dnl       if you want that m4 avoid to throw away the spaces prefixed to the
+dnl       argument value.
+dnl ---------------------------------------------------------------------------
+AC_DEFUN([WX_BOOLOPT_SUMMARY],
+        [
+        if test "x$$1" = "x1" ; then
+            echo $2
+        elif test "x$$1" = "x0" ; then
+            echo $3
+        else
+            echo "$1 is $$1"
+        fi
+    ])
+
+dnl ---------------------------------------------------------------------------
+dnl WX_STANDARD_OPTIONS_SUMMARY_MSG
+dnl
+dnl Shows a summary message to the user about the WX_* variable contents.
+dnl This macro is used typically at the end of the configure script.
+dnl ---------------------------------------------------------------------------
+AC_DEFUN([WX_STANDARD_OPTIONS_SUMMARY_MSG],
+        [
+        echo
+        echo "  The wxWidgets build which will be used by $PACKAGE_NAME $PACKAGE_VERSION"
+        echo "  has the following settings:"
+        WX_BOOLOPT_SUMMARY([WX_DEBUG],   ["  - DEBUG build"],  ["  - RELEASE build"])
+        WX_BOOLOPT_SUMMARY([WX_UNICODE], ["  - UNICODE mode"], ["  - ANSI mode"])
+        WX_BOOLOPT_SUMMARY([WX_SHARED],  ["  - SHARED mode"],  ["  - STATIC mode"])
+        echo "  - VERSION: $WX_VERSION"
+        echo "  - PORT: $WX_PORT"
+    ])
+
+
+dnl ---------------------------------------------------------------------------
+dnl WX_STANDARD_OPTIONS_SUMMARY_MSG_BEGIN, WX_STANDARD_OPTIONS_SUMMARY_MSG_END
+dnl
+dnl Like WX_STANDARD_OPTIONS_SUMMARY_MSG macro but these two macros also gives info
+dnl about the configuration of the package which used the wxpresets.
+dnl
+dnl Typical usage:
+dnl    WX_STANDARD_OPTIONS_SUMMARY_MSG_BEGIN
+dnl    echo "   - Package setting 1: $SETTING1"
+dnl    echo "   - Package setting 2: $SETTING1"
+dnl    ...
+dnl    WX_STANDARD_OPTIONS_SUMMARY_MSG_END
+dnl
+dnl ---------------------------------------------------------------------------
+AC_DEFUN([WX_STANDARD_OPTIONS_SUMMARY_MSG_BEGIN],
+        [
+        echo
+        echo " ----------------------------------------------------------------"
+        echo "  Configuration for $PACKAGE_NAME $PACKAGE_VERSION successfully completed."
+        echo "  Summary of main configuration settings for $PACKAGE_NAME:"
+        WX_BOOLOPT_SUMMARY([DEBUG], ["  - DEBUG build"], ["  - RELEASE build"])
+        WX_BOOLOPT_SUMMARY([UNICODE], ["  - UNICODE mode"], ["  - ANSI mode"])
+        WX_BOOLOPT_SUMMARY([SHARED], ["  - SHARED mode"], ["  - STATIC mode"])
+    ])
+
+AC_DEFUN([WX_STANDARD_OPTIONS_SUMMARY_MSG_END],
+        [
+        WX_STANDARD_OPTIONS_SUMMARY_MSG
+        echo
+        echo "  Now, just run make."
+        echo " ----------------------------------------------------------------"
+        echo
+    ])
+
+
+dnl ---------------------------------------------------------------------------
+dnl Deprecated macro wrappers
+dnl ---------------------------------------------------------------------------
+
+AC_DEFUN([AM_OPTIONS_WXCONFIG], [WX_CONFIG_OPTIONS])
+AC_DEFUN([AM_PATH_WXCONFIG], [
+    WX_CONFIG_CHECK([$1],[$2],[$3],[$4],[$5])
+])
+AC_DEFUN([AM_PATH_WXRC], [WXRC_CHECK([$1],[$2])])
diff -r a823baea47d8 -r ce3621d75112 src/engine/local_path.cpp
--- a/src/engine/local_path.cpp	Sun Aug 11 16:57:28 2013 +0300
+++ b/src/engine/local_path.cpp	Sun Aug 11 19:53:00 2013 +0300
@@ -48,6 +48,7 @@
 
 	wxChar* out;
 	wxChar* start;
+	wxStringBuffer* buffer = 0;
 	if (*in == '\\')
 	{
 		// possibly UNC
@@ -59,7 +60,8 @@
 			return false;
 		}
 
-		start = m_path.GetWriteBuf(path.Len() + 2);
+		buffer = new wxStringBuffer(m_path, path.Len() + 2);
+		start = *buffer;
 		out = start;
 		*out++ = '\\';
 		*out++ = '\\';
@@ -77,7 +79,7 @@
 		{
 			// not a valid UNC path
 			*start = 0;
-			m_path.UngetWriteBuf( 0 );
+			delete buffer;
 			return false;
 		}
 
@@ -87,21 +89,22 @@
 	{
 		// Regular path
 
-		start = m_path.GetWriteBuf(path.Len() + 2);
+		buffer = new wxStringBuffer(m_path, path.Len() + 2);
+		start = *buffer;
 		out = start;
 		*out++ = *in++;
 
 		if (*in++ != ':')
 		{
 			*start = 0;
-			m_path.UngetWriteBuf( 0 );
+			delete buffer;
 			return false;
 		}
 		*out++ = ':';
 		if (*in != '/' && *in != '\\' && *in)
 		{
 			*start = 0;
-			m_path.UngetWriteBuf( 0 );
+			delete buffer;
 			return false;
 		}
 		*out++ = path_separator;
@@ -120,8 +123,13 @@
 		return false;
 	}
 
+#if wxCHECK_VERSION(2, 9, 0)
+	wxStringBuffer* buffer = new wxStringBuffer(m_path, path.Len() + 2);
+	wxChar* out = *buffer;
+#else
 	wxChar* start = m_path.GetWriteBuf(path.Len() + 2);
 	wxChar* out = start;
+#endif
 
 	*out++ = '/';
 	segments.push_back(out);
@@ -210,9 +218,13 @@
 	}
 
 	*out = 0;
-
+#if !wxCHECK_VERSION(2, 9, 0)
 	m_path.UngetWriteBuf( out - start );
-
+#else
+	if (buffer != 0) {
+		delete buffer;
+	}
+#endif
 	::Coalesce(m_path);
 
 	return true;
diff -r a823baea47d8 -r ce3621d75112 src/engine/logging.cpp
--- a/src/engine/logging.cpp	Sun Aug 11 16:57:28 2013 +0300
+++ b/src/engine/logging.cpp	Sun Aug 11 19:53:00 2013 +0300
@@ -51,6 +51,38 @@
 	}
 }
 
+#if wxCHECK_VERSION(2, 9, 0)
+void CLogging::LogMessage(MessageType nMessageType, const wxChar *msgFormat, int value1) const 
+{ 
+        LogMessage(nMessageType, msgFormat, (const char*)(wxString() << value1).c_str()); 
+} 
+
+void CLogging::LogMessage(MessageType nMessageType, const wxChar *msgFormat, int value1, wxCStrData value2) const 
+{ 
+        LogMessage(nMessageType, msgFormat, (const char*)(wxString() << value1).c_str(), value2.AsWChar()); 
+} 
+
+void CLogging::LogMessage(MessageType nMessageType, const wxChar *msgFormat, int value1, wxCStrData value2, wxCStrData value3) const 
+{ 
+        LogMessage(nMessageType, msgFormat, (const char*)(wxString() << value1).c_str(), value2.AsWChar(), value3.AsWChar()); 
+} 
+
+void CLogging::LogMessage(MessageType nMessageType, const wxChar *msgFormat, wxCStrData value1) const 
+{ 
+        LogMessage(nMessageType, msgFormat, value1.AsWChar()); 
+} 
+
+void CLogging::LogMessage(MessageType nMessageType, const wxChar *msgFormat, wxCStrData value1, wxCStrData value2) const 
+{ 
+        LogMessage(nMessageType, msgFormat, value1.AsWChar(), value2.AsWChar()); 
+}
+
+void CLogging::LogMessage(MessageType nMessageType, const wxChar *msgFormat, wxCStrData value1, wxCStrData value2, wxCStrData value3, wxCStrData value4) const 
+{ 
+        LogMessage(nMessageType, msgFormat, value1.AsWChar(), value2.AsWChar(), value3.AsWChar(), value4.AsWChar()); 
+}
+#endif 
+
 void CLogging::LogMessage(MessageType nMessageType, const wxChar *msgFormat, ...) const
 {
 	InitLogFile();
diff -r a823baea47d8 -r ce3621d75112 src/engine/logging_private.h
--- a/src/engine/logging_private.h	Sun Aug 11 16:57:28 2013 +0300
+++ b/src/engine/logging_private.h	Sun Aug 11 19:53:00 2013 +0300
@@ -6,6 +6,15 @@
 public:
 	CLogging(CFileZillaEnginePrivate *pEngine);
 	virtual ~CLogging();
+	
+#if wxCHECK_VERSION(2, 9, 0) 
+	void LogMessage(MessageType nMessageType, const wxChar *msgFormat, int value1) const; 
+	void LogMessage(MessageType nMessageType, const wxChar *msgFormat, int value1, wxCStrData value2) const;
+	void LogMessage(MessageType nMessageType, const wxChar *msgFormat, int value1, wxCStrData value2, wxCStrData value3) const;
+	void LogMessage(MessageType nMessageType, const wxChar *msgFormat, wxCStrData value1) const; 
+	void LogMessage(MessageType nMessageType, const wxChar *msgFormat, wxCStrData value1, wxCStrData value2) const; 
+	void LogMessage(MessageType nMessageType, const wxChar *msgFormat, wxCStrData value1, wxCStrData value2, wxCStrData value3, wxCStrData value4) const; 
+#endif 
 
 	void LogMessage(MessageType nMessageType, const wxChar *msgFormat, ...) const;
 	void LogMessageRaw(MessageType nMessageType, const wxChar *msg) const;
diff -r a823baea47d8 -r ce3621d75112 src/engine/misc.cpp
--- a/src/engine/misc.cpp	Sun Aug 11 16:57:28 2013 +0300
+++ b/src/engine/misc.cpp	Sun Aug 11 19:53:00 2013 +0300
@@ -365,9 +365,19 @@
 {
 	for (size_t i = 0; i < str.Len(); i++)
 	{
+#if wxCHECK_VERSION(2, 9, 0)
+		char c;
+		str.GetChar(i).GetAsChar(&c);
+		if (c >= 'A' && c <= 'Z')
+		{
+			c += 32;
+			str.SetChar(i, wxUniChar(c));
+		}
+#else
 		wxChar& c = str[i];
 		if (c >= 'A' && c <= 'Z')
 			c += 32;
+#endif
 	}
 }
 
diff -r a823baea47d8 -r ce3621d75112 src/engine/server.cpp
--- a/src/engine/server.cpp	Sun Aug 11 16:57:28 2013 +0300
+++ b/src/engine/server.cpp	Sun Aug 11 19:53:00 2013 +0300
@@ -12,13 +12,13 @@
 };
 
 static const t_protocolInfo protocolInfos[] = {
-	{ FTP,          _T("ftp"),    false, 21,  true,  wxTRANSLATE("FTP - File Transfer Protocol with optional encryption"),                 true  },
+	{ FTP,          _T("ftp"),    false, 21,  true,  _T("FTP - File Transfer Protocol with optional encryption"),                 true  },
 	{ SFTP,         _T("sftp"),   true,  22,  false, _T("SFTP - SSH File Transfer Protocol"),                              false },
 	{ HTTP,         _T("http"),   true,  80,  false, _T("HTTP - Hypertext Transfer Protocol"),                             true  },
-	{ HTTPS,        _T("https"),  true, 443,  true,  wxTRANSLATE("HTTPS - HTTP over TLS"),                                 true  },
-	{ FTPS,         _T("ftps"),   true, 990,  true,  wxTRANSLATE("FTPS - FTP over implicit TLS/SSL"),                      true  },
-	{ FTPES,        _T("ftpes"),  true,  21,  true,  wxTRANSLATE("FTPES - FTP over explicit TLS/SSL"),                     true  },
-	{ INSECURE_FTP, _T("ftp"),    false, 21,  true,  wxTRANSLATE("FTP - Insecure File Transfer Protocol"), true  },
+	{ HTTPS,        _T("https"),  true, 443,  true,  _T("HTTPS - HTTP over TLS"),                                 true  },
+	{ FTPS,         _T("ftps"),   true, 990,  true,  _T("FTPS - FTP over implicit TLS/SSL"),                      true  },
+	{ FTPES,        _T("ftpes"),  true,  21,  true,  _T("FTPES - FTP over explicit TLS/SSL"),                     true  },
+	{ INSECURE_FTP, _T("ftp"),    false, 21,  true,  _T("FTP - Insecure File Transfer Protocol"), true  },
 	{ UNKNOWN,      _T(""),       false, 21,  false, _T("") }
 };
 
diff -r a823baea47d8 -r ce3621d75112 src/engine/serverpath.cpp
--- a/src/engine/serverpath.cpp	Sun Aug 11 16:57:28 2013 +0300
+++ b/src/engine/serverpath.cpp	Sun Aug 11 19:53:00 2013 +0300
@@ -276,8 +276,13 @@
 		len += iter->Length() + 2 + INTLENGTH;
 
 	wxString safepath;
+#if wxCHECK_VERSION(2, 9, 0)
+	wxStringBuffer* buffer = new wxStringBuffer(safepath, len);
+	wxChar* t = *buffer;
+#else
 	wxChar* start = safepath.GetWriteBuf(len);
 	wxChar* t = start;
+#endif
 
 	t = fast_sprint_number(t, m_type);
 	*(t++) = ' ';
@@ -299,8 +304,11 @@
 		t += iter->size();
 	}
 	*t = 0;
-
+#if !wxCHECK_VERSION(2, 9, 0)
 	safepath.UngetWriteBuf( t - start );
+#else
+	delete buffer;
+#endif
 	safepath.Shrink();
 
 	return safepath;
diff -r a823baea47d8 -r ce3621d75112 src/engine/socket.cpp
--- a/src/engine/socket.cpp	Sun Aug 11 16:57:28 2013 +0300
+++ b/src/engine/socket.cpp	Sun Aug 11 19:53:00 2013 +0300
@@ -1273,7 +1273,7 @@
 	}
 }
 
-#define ERRORDECL(c, desc) { c, _T(#c), wxTRANSLATE(desc) },
+#define ERRORDECL(c, desc) { c, _T(#c), _T(desc) },
 
 struct Error_table
 {
diff -r a823baea47d8 -r ce3621d75112 src/engine/string_coalescer.cpp
--- a/src/engine/string_coalescer.cpp	Sun Aug 11 16:57:28 2013 +0300
+++ b/src/engine/string_coalescer.cpp	Sun Aug 11 19:53:00 2013 +0300
@@ -66,7 +66,11 @@
 	{
 		// wxString is CoW, yet it doesn't even do this fast pointer
 		// comparison in it's less and/or equal operator(s).
+#if wxCHECK_VERSION(2, 9, 0)
+		return lhs == rhs;
+#else
 		return lhs.c_str() == rhs.c_str() || lhs == rhs;
+#endif
 	}
 };
 
diff -r a823baea47d8 -r ce3621d75112 src/include/libfilezilla.h
--- a/src/include/libfilezilla.h	Sun Aug 11 16:57:28 2013 +0300
+++ b/src/include/libfilezilla.h	Sun Aug 11 19:53:00 2013 +0300
@@ -21,6 +21,10 @@
 #include <wx/datetime.h>
 #include <wx/event.h>
 #include <wx/string.h>
+#if wxCHECK_VERSION(2, 9, 0)
+#include <wx/translation.h>
+#include <wx/dcclient.h>
+#endif
 
 #include <list>
 #include <vector>
diff -r a823baea47d8 -r ce3621d75112 src/interface/FileZilla.cpp
--- a/src/interface/FileZilla.cpp	Sun Aug 11 16:57:28 2013 +0300
+++ b/src/interface/FileZilla.cpp	Sun Aug 11 19:53:00 2013 +0300
@@ -265,7 +265,7 @@
 			COptions::Get()->SetOption(OPTION_LANGUAGE, _T(""));
 		}
 #else
-		if (!pInfo || !SetLocale(pInfo->Language))
+		if (pInfo && !pInfo->Description.IsEmpty())
 		{
 			if (pInfo && pInfo->Description)
 				wxMessageBox(wxString::Format(_("Failed to set language to %s (%s), using default system language"), pInfo->Description.c_str(), language.c_str()), _("Failed to change language"), wxICON_EXCLAMATION);
@@ -803,7 +803,7 @@
 	if (!found)
 	{
 		wxMessageBox(wxString::Format(_("%s could not be found. Without this component of FileZilla, SFTP will not work.\n\nPossible solutions:\n- Make sure %s is in a directory listed in your PATH environment variable.\n- Set the full path to %s in the FZ_FZSFTP environment variable."), program.c_str(), program.c_str(), program.c_str()),
-			_("File not found"), wxICON_ERROR);
+			_("File not found"), wxICON_ERROR | wxOK);
 		executable.clear();
 	}
 #endif
diff -r a823baea47d8 -r ce3621d75112 src/interface/Mainfrm.cpp
--- a/src/interface/Mainfrm.cpp	Sun Aug 11 16:57:28 2013 +0300
+++ b/src/interface/Mainfrm.cpp	Sun Aug 11 19:53:00 2013 +0300
@@ -754,14 +754,19 @@
 			// Do a crude approach: Drop everything unexpected...
 			for (unsigned int i = 0; i < version.Len(); i++)
 			{
+#if wxCHECK_VERSION(2, 9, 0)
+				char c;
+				version.GetChar(i).GetAsChar(&c);
+#else
 				wxChar& c = version[i];
+#endif
 				if ((version[i] >= '0' && version[i] <= '9') ||
 					(version[i] >= 'a' && version[i] <= 'z') ||
 					(version[i] >= 'A' && version[i] <= 'Z') ||
 					version[i] == '-' || version[i] == '.' ||
 					version[i] == '_')
 				{
-					url += c;
+					url.Append(c);
 				}
 			}
 		}
@@ -779,7 +784,11 @@
 			{
 				pStatusBar->Show(show);
 				wxSizeEvent evt;
+#if wxCHECK_VERSION(2, 9, 0)
+				controls->pLocalListViewPanel->ProcessWindowEvent(evt);
+#else
 				controls->pLocalListViewPanel->ProcessEvent(evt);
+#endif
 			}
 		}
 		if (controls && controls->pRemoteListViewPanel)
@@ -789,7 +798,11 @@
 			{
 				pStatusBar->Show(show);
 				wxSizeEvent evt;
+#if wxCHECK_VERSION(2, 9, 0)
+				controls->pRemoteListViewPanel->ProcessWindowEvent(evt);
+#else
 				controls->pRemoteListViewPanel->ProcessEvent(evt);
+#endif
 			}
 		}
 	}
diff -r a823baea47d8 -r ce3621d75112 src/interface/QueueView.cpp
--- a/src/interface/QueueView.cpp	Sun Aug 11 16:57:28 2013 +0300
+++ b/src/interface/QueueView.cpp	Sun Aug 11 19:53:00 2013 +0300
@@ -3419,9 +3419,13 @@
 	const wxChar replace = COptions::Get()->GetOption(OPTION_INVALID_CHAR_REPLACE)[0];
 
 	wxString result;
-
+#if wxCHECK_VERSION(2, 9, 0)
+	wxStringBuffer* buffer = new wxStringBuffer(result, filename.Len() + 1);
+	wxChar* buf = *buffer;
+#else
 	wxChar* start = result.GetWriteBuf(filename.Len() + 1);
 	wxChar* buf = start;
+#endif
 
 	const wxChar* p = filename.c_str();
 	while (*p)
@@ -3456,9 +3460,11 @@
 		p++;
 	}
 	*buf = 0;
-
+#if wxCHECK_VERSION(2, 9, 0)
+	delete buffer;
+#else
 	result.UngetWriteBuf( buf - start );
-
+#endif
 	return result;
 }
 
diff -r a823baea47d8 -r ce3621d75112 src/interface/RemoteTreeView.cpp
--- a/src/interface/RemoteTreeView.cpp	Sun Aug 11 16:57:28 2013 +0300
+++ b/src/interface/RemoteTreeView.cpp	Sun Aug 11 19:53:00 2013 +0300
@@ -350,7 +350,7 @@
 	SetItemImages(parent, false);
 
 #ifndef __WXMSW__
-	m_freezeCount--;
+	Thaw();
 #endif
 	if (!modified)
 		SafeSelectItem(parent);
diff -r a823baea47d8 -r ce3621d75112 src/interface/StatusView.cpp
--- a/src/interface/StatusView.cpp	Sun Aug 11 16:57:28 2013 +0300
+++ b/src/interface/StatusView.cpp	Sun Aug 11 19:53:00 2013 +0300
@@ -58,7 +58,7 @@
 	{
 		wxWindow* parent = GetParent();
 		event.SetEventObject(parent);
-		parent->ProcessEvent(event);
+		parent->GetEventHandler()->ProcessEvent(event);
 	}
 #else
 	void OnKeyDown(wxKeyEvent& event)
@@ -76,7 +76,7 @@
 		navEvent.SetDirection(!event.ShiftDown());
 		navEvent.SetFromTab(true);
 		navEvent.ResumePropagation(1);
-		parent->ProcessEvent(navEvent);
+		parent->GetEventHandler()->ProcessEvent(navEvent);
 	}
 #endif
 };
diff -r a823baea47d8 -r ce3621d75112 src/interface/aui_notebook_ex.cpp
--- a/src/interface/aui_notebook_ex.cpp	Sun Aug 11 16:57:28 2013 +0300
+++ b/src/interface/aui_notebook_ex.cpp	Sun Aug 11 19:53:00 2013 +0300
@@ -3,7 +3,16 @@
 #include "aui_notebook_ex.h"
 #include <wx/dcmirror.h>
 
+#if wxCHECK_VERSION(2, 9, 0)
+wxColor wxAuiStepColour(const wxColor& c, int ialpha)
+{	
+	wxColor* result = new wxColor(c);
+	result->ChangeLightness(ialpha);
+	return *result;
+}
+#else
 wxColor wxAuiStepColour(const wxColor& c, int ialpha);
+#endif
 
 #ifdef __WXMSW__
 #define TABCOLOUR wxSYS_COLOUR_3DFACE
@@ -184,9 +193,6 @@
 		}
 	}
 
-#ifdef __WXGTK__
-	virtual GdkWindow* GetGDKWindow() const { return m_original_dc->GetGDKWindow(); }
-#endif
 protected:
 	int m_gradient_called;
 	int m_rectangle_called;
@@ -215,9 +221,15 @@
 	virtual wxAuiTabArt* Clone()
 	{
 		wxAuiTabArtEx *art = new wxAuiTabArtEx(m_pNotebook, m_bottom, m_data);
+#if wxCHECK_VERSION(2, 9, 0)
+		art->SetNormalFont(m_normalFont);
+		art->SetSelectedFont(m_selectedFont);
+		art->SetMeasuringFont(m_measuringFont);
+#else
 		art->SetNormalFont(m_normal_font);
 		art->SetSelectedFont(m_selected_font);
 		art->SetMeasuringFont(m_measuring_font);
+#endif
 		return art;
 	}
 
@@ -257,12 +269,21 @@
 						 int* x_extent)
 	{
 #ifndef __WXMAC__
+#if wxCHECK_VERSION(2, 9, 0)
+		m_baseColour = wxSystemSettings::GetColour(TABCOLOUR);
+#else
 		m_base_colour = wxSystemSettings::GetColour(TABCOLOUR);
 #endif
+#endif
 		if (!pane.active)
 		{
+#if wxCHECK_VERSION(2, 9, 0)
+			if (m_baseColour.Red() + m_baseColour.Green() + m_baseColour.Blue() >= 384)
+				m_baseColour = wxColour( m_baseColour.Red() * 0.95, m_baseColour.Green() * 0.95, m_baseColour.Blue() * 0.95 );
+#else
 			if (m_base_colour.Red() + m_base_colour.Green() + m_base_colour.Blue() >= 384)
 				m_base_colour = wxColour( m_base_colour.Red() * 0.95, m_base_colour.Green() * 0.95, m_base_colour.Blue() * 0.95 );
+#endif
 
 			dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
 			if (m_pNotebook->Highlighted(m_pNotebook->GetPageIndex(pane.window)))
@@ -270,27 +291,49 @@
 				if (!m_fonts_initialized)
 				{
 					m_fonts_initialized = true;
+#if wxCHECK_VERSION(2, 9, 0)
+					m_original_normal_font = m_normalFont;
+					m_highlighted_font = m_normalFont;
+#else
 					m_original_normal_font = m_normal_font;
 					m_highlighted_font = m_normal_font;
+#endif
 					m_highlighted_font.SetWeight(wxFONTWEIGHT_BOLD);
 					m_highlighted_font.SetStyle(wxFONTSTYLE_ITALIC);
 				}
+#if wxCHECK_VERSION(2, 9, 0)
+				m_normalFont = m_highlighted_font;
+#else
 				m_normal_font = m_highlighted_font;
+#endif
 			}
 			else if (m_fonts_initialized)
+#if wxCHECK_VERSION(2, 9, 0)
+				m_normalFont = m_original_normal_font;
+#else
 				m_normal_font = m_original_normal_font;
+#endif
 		}
-
+#if wxCHECK_VERSION(2, 9, 0)
+		CFilterDC filter_dc(dc, pane.active ? 1 : 0, (m_tabCtrlHeight % 2) != 0, m_bottom);
+		wxAuiGenericTabArt::DrawTab(*((wxDC*)&filter_dc), wnd, pane, in_rect, close_button_state, out_tab_rect, out_button_rect, x_extent);
+		m_baseColour = wxSystemSettings::GetColour(TABCOLOUR);
+#else
 		CFilterDC filter_dc(dc, pane.active ? 1 : 0, (m_tab_ctrl_height % 2) != 0, m_bottom);
 		wxAuiDefaultTabArt::DrawTab(*((wxDC*)&filter_dc), wnd, pane, in_rect, close_button_state, out_tab_rect, out_button_rect, x_extent);
-
 		m_base_colour = wxSystemSettings::GetColour(TABCOLOUR);
+#endif
 	}
 
 	virtual void DrawBackground(wxDC& dc, wxWindow* wnd, const wxRect& rect)
 	{
+#if wxCHECK_VERSION(2, 9, 0)
+		CFilterDC filter_dc(dc, 2, (m_tabCtrlHeight % 2) != 0, m_bottom);
+		wxAuiGenericTabArt::DrawBackground(*((wxDC*)&filter_dc), wnd, rect);
+#else
 		CFilterDC filter_dc(dc, 2, (m_tab_ctrl_height % 2) != 0, m_bottom);
 		wxAuiDefaultTabArt::DrawBackground(*((wxDC*)&filter_dc), wnd, rect);
+#endif
 	}
 protected:
 	wxAuiNotebookEx* m_pNotebook;
diff -r a823baea47d8 -r ce3621d75112 src/interface/commandqueue.cpp
--- a/src/interface/commandqueue.cpp	Sun Aug 11 16:57:28 2013 +0300
+++ b/src/interface/commandqueue.cpp	Sun Aug 11 19:53:00 2013 +0300
@@ -289,7 +289,7 @@
 
 	wxCommandEvent evt(fzEVT_GRANTEXCLUSIVEENGINEACCESS);
 	evt.SetId(m_requestId);
-	m_pMainFrame->GetQueue()->AddPendingEvent(evt);
+	m_pMainFrame->GetQueue()->GetEventHandler()->AddPendingEvent(evt);
 }
 
 CFileZillaEngine* CCommandQueue::GetEngineExclusive(int requestId)
diff -r a823baea47d8 -r ce3621d75112 src/interface/filezilla.h
--- a/src/interface/filezilla.h	Sun Aug 11 16:57:28 2013 +0300
+++ b/src/interface/filezilla.h	Sun Aug 11 19:53:00 2013 +0300
@@ -71,5 +71,6 @@
 #include <wx/toolbar.h>
 #include <wx/treectrl.h>
 #include <wx/xrc/xmlres.h>
+#include <wx/xml/xml.h>
 
 #endif
diff -r a823baea47d8 -r ce3621d75112 src/interface/import.cpp
--- a/src/interface/import.cpp	Sun Aug 11 16:57:28 2013 +0300
+++ b/src/interface/import.cpp	Sun Aug 11 19:53:00 2013 +0300
@@ -146,7 +146,7 @@
 			return _T("");
 		int number = (pass[i] - '0') * 100 +
 						(pass[i + 1] - '0') * 10 +
-						pass[i + 2] - '0';
+						(pass[i + 2] - '0');
 		wxChar c = number ^ key[(i / 3 + pos) % strlen(key)];
 		output += c;
 	}
diff -r a823baea47d8 -r ce3621d75112 src/interface/netconfwizard.cpp
--- a/src/interface/netconfwizard.cpp	Sun Aug 11 16:57:28 2013 +0300
+++ b/src/interface/netconfwizard.cpp	Sun Aug 11 19:53:00 2013 +0300
@@ -777,7 +777,12 @@
 			wxString hexIP = ip;
 			for (unsigned int i = 0; i < hexIP.Length(); i++)
 			{
+#if wxCHECK_VERSION(2, 9, 0)
+				char c;
+				hexIP.GetChar(i).GetAsChar(&c);
+#else
 				wxChar& c = hexIP[i];
+#endif
 				if (c == '.')
 					c = '-';
 				else
diff -r a823baea47d8 -r ce3621d75112 src/interface/queue.cpp
--- a/src/interface/queue.cpp	Sun Aug 11 16:57:28 2013 +0300
+++ b/src/interface/queue.cpp	Sun Aug 11 19:53:00 2013 +0300
@@ -1310,7 +1310,7 @@
 	}
 	else
 	{
-		if (m_folderScanCount)
+		if (m_folderScanCount && m_fileCount > 0)
 			str.Printf(m_title + _T(" (0+)"), m_fileCount);
 		else
 			str = m_title;
@@ -1442,7 +1442,11 @@
 void CQueueViewBase::OnNavigationKey(wxNavigationKeyEvent& event)
 {
 	event.SetEventObject(m_pQueue);
+#if wxCHECK_VERSION(2, 9, 0)
+	m_pQueue->ProcessWindowEvent(event);
+#else
 	m_pQueue->ProcessEvent(event);
+#endif
 }
 
 void CQueueViewBase::OnChar(wxKeyEvent& event)
diff -r a823baea47d8 -r ce3621d75112 src/interface/queue_storage.cpp
--- a/src/interface/queue_storage.cpp	Sun Aug 11 16:57:28 2013 +0300
+++ b/src/interface/queue_storage.cpp	Sun Aug 11 19:53:00 2013 +0300
@@ -135,7 +135,11 @@
 	{
 		// wxString is CoW, yet it doesn't even do this fast pointer
 		// comparison in it's less and/or equal operator(s).
+#if wxCHECK_VERSION(2, 9, 0)
+		return (const char*)lhs.c_str() == (const char*)rhs.c_str() || lhs == rhs;
+#else
 		return lhs.c_str() == rhs.c_str() || lhs == rhs;
+#endif
 	}
 };
 
@@ -544,9 +548,11 @@
 extern "C" {
 static void custom_free(void* v)
 {
-#ifdef __WXMSW__
+#if defined(__WXMSW__)
+#if !wxCHECK_VERSION(2, 9, 0)
 	wxStringData* data = reinterpret_cast<wxStringData*>(v) - 1;
 	data->Unlock();
+#endif
 #else
 	char* s = reinterpret_cast<char*>(v);
 	delete [] s;
@@ -557,11 +563,16 @@
 bool CQueueStorage::Impl::Bind(sqlite3_stmt* statement, int index, const wxString& value)
 {
 #ifdef __WXMSW__
+#if wxCHECK_VERSION(2, 9, 0)
+	char* data = value.char_str();
+	return sqlite3_bind_text16(statement, index, data, value.length(), custom_free) == SQLITE_OK;
+#else
 	// Increase string reference and pass the data to sqlite with a custom deallocator that
 	// reduces the reference once sqlite is done with it.
 	wxStringData* data = reinterpret_cast<wxStringData*>(const_cast<wxChar*>(value.c_str())) - 1;
 	data->Lock();
 	return sqlite3_bind_text16(statement, index, data + 1, data->nDataLength * 2, custom_free) == SQLITE_OK;
+#endif
 #else
 	char* out = new char[value.size() * 2];
 	size_t outlen = utf16_.FromWChar(out, value.size() * 2, value.c_str(), value.size());
@@ -814,9 +825,18 @@
 	int len = sqlite3_column_bytes16(statement, index);
 	if (text)
 	{
+#if wxCHECK_VERSION(2, 9, 0)
+		wxStringBuffer* buffer = new wxStringBuffer(ret, len);
+		wxChar* out = *buffer;
+#else
 		wxChar* out = ret.GetWriteBuf( len );
+#endif
 		int outlen = utf16_.ToWChar( out, len, text, len );
+#if wxCHECK_VERSION(2, 9, 0)
+		delete buffer;
+#else
 		ret.UngetWriteBuf( outlen );
+#endif
 		if (shrink)
 			ret.Shrink();
 	}
diff -r a823baea47d8 -r ce3621d75112 src/interface/quickconnectbar.cpp
--- a/src/interface/quickconnectbar.cpp	Sun Aug 11 16:57:28 2013 +0300
+++ b/src/interface/quickconnectbar.cpp	Sun Aug 11 19:53:00 2013 +0300
@@ -222,12 +222,12 @@
 	if (event.GetDirection() && event.GetEventObject() == XRCCTRL(*this, "ID_QUICKCONNECT_DROPDOWN", wxButton))
 	{
 		event.SetEventObject(this);
-		GetParent()->ProcessEvent(event);
+		GetParent()->GetEventHandler()->ProcessEvent(event);
 	}
 	else if (!event.GetDirection() && event.GetEventObject() == m_pHost)
 	{
 		event.SetEventObject(this);
-		GetParent()->ProcessEvent(event);
+		GetParent()->GetEventHandler()->ProcessEvent(event);
 	}
 	else
 		event.Skip();
diff -r a823baea47d8 -r ce3621d75112 src/interface/resources/settings.xrc
--- a/src/interface/resources/settings.xrc	Sun Aug 11 16:57:28 2013 +0300
+++ b/src/interface/resources/settings.xrc	Sun Aug 11 19:53:00 2013 +0300
@@ -427,7 +427,7 @@
               </object>
               <cols>1</cols>
               <vgap>3</vgap>
-              <rows>2</rows>
+              <rows>3</rows>
             </object>
             <flag>wxLEFT|wxRIGHT|wxBOTTOM</flag>
             <border>4</border>
@@ -632,9 +632,9 @@
               <object class="sizeritem">
                 <object class="wxListCtrl" name="ID_KEYS">
                   <style>wxLC_REPORT|wxSUNKEN_BORDER</style>
+									<size>400,-1</size>
                 </object>
-                <option>1</option>
-                <flag>wxGROW</flag>
+                <flag>wxSHAPED</flag>
               </object>
               <vgap>5</vgap>
               <growablecols>0</growablecols>
@@ -1363,7 +1363,7 @@
           <object class="sizeritem">
             <object class="wxFlexGridSizer">
               <cols>2</cols>
-              <rows>2</rows>
+              <rows>3</rows>
               <object class="sizeritem">
                 <object class="wxStaticText">
                   <label>&amp;Theme:</label>
@@ -2076,7 +2076,6 @@
                   </object>
                   <growablecols>1</growablecols>
                 </object>
-                <flag>wxGROW</flag>
                 <minsize>400,0</minsize>
               </object>
               <growablecols>0</growablecols>
diff -r a823baea47d8 -r ce3621d75112 src/interface/settings/optionspage_dateformatting.cpp
--- a/src/interface/settings/optionspage_dateformatting.cpp	Sun Aug 11 16:57:28 2013 +0300
+++ b/src/interface/settings/optionspage_dateformatting.cpp	Sun Aug 11 19:53:00 2013 +0300
@@ -16,7 +16,7 @@
 	const wxString& dateFormat = m_pOptions->GetOption(OPTION_DATE_FORMAT);
 	if (dateFormat == _T("1"))
 		SetRCheck(XRCID("ID_DATEFORMAT_ISO"), true, failure);
-	else if (dateFormat[0] == '2')
+	else if (!dateFormat.IsEmpty() && dateFormat[0] == '2')
 	{
 		SetRCheck(XRCID("ID_DATEFORMAT_CUSTOM"), true, failure);
 		SetText(XRCID("ID_CUSTOM_DATEFORMAT"), dateFormat.Mid(1), failure);
@@ -27,7 +27,7 @@
 	const wxString& timeFormat = m_pOptions->GetOption(OPTION_TIME_FORMAT);
 	if (timeFormat == _T("1"))
 		SetRCheck(XRCID("ID_TIMEFORMAT_ISO"), true, failure);
-	else if (timeFormat[0] == '2')
+	else if (!timeFormat.IsEmpty() && timeFormat[0] == '2')
 	{
 		SetRCheck(XRCID("ID_TIMEFORMAT_CUSTOM"), true, failure);
 		SetText(XRCID("ID_CUSTOM_TIMEFORMAT"), timeFormat.Mid(1), failure);
diff -r a823baea47d8 -r ce3621d75112 src/interface/sitemanager.cpp
--- a/src/interface/sitemanager.cpp	Sun Aug 11 16:57:28 2013 +0300
+++ b/src/interface/sitemanager.cpp	Sun Aug 11 19:53:00 2013 +0300
@@ -516,6 +516,8 @@
 
 bool CSiteManager::GetBookmarks(wxString sitePath, std::list<wxString> &bookmarks)
 {
+	if (sitePath.IsEmpty())
+		return false;
 	wxChar c = sitePath[0];
 	if (c != '0' && c != '1')
 		return false;
diff -r a823baea47d8 -r ce3621d75112 src/interface/statusbar.cpp
--- a/src/interface/statusbar.cpp	Sun Aug 11 16:57:28 2013 +0300
+++ b/src/interface/statusbar.cpp	Sun Aug 11 19:53:00 2013 +0300
@@ -153,10 +153,10 @@
 void wxStatusBarEx::SetStatusText(const wxString& text, int number /*=0*/)
 {
 	// Basically identical to the wx one, but not calling Update
-	wxString oldText = m_statusStrings[number];
+	wxString oldText = GetStatusText(number);
 	if (oldText != text)
 	{
-		m_statusStrings[number] = text;
+		wxStatusBar::SetStatusText(text, number);
 
 		wxRect rect;
 		GetFieldRect(number, rect);
diff -r a823baea47d8 -r ce3621d75112 src/interface/timeformatting.cpp
--- a/src/interface/timeformatting.cpp	Sun Aug 11 16:57:28 2013 +0300
+++ b/src/interface/timeformatting.cpp	Sun Aug 11 19:53:00 2013 +0300
@@ -23,7 +23,7 @@
 
 		if (dateFormat == _T("1"))
 			m_dateFormat = _T("%Y-%m-%d");
-		else if (dateFormat[0] == '2')
+		else if (!dateFormat.IsEmpty() && dateFormat[0] == '2')
 			m_dateFormat = dateFormat.Mid(1);
 		else
 			m_dateFormat = _T("%x");
@@ -33,7 +33,7 @@
 
 		if (timeFormat == _T("1"))
 			m_dateTimeFormat += _T("%H:%M");
-		else if (timeFormat[0] == '2')
+		else if (!timeFormat.IsEmpty() && timeFormat[0] == '2')
 			m_dateTimeFormat += timeFormat.Mid(1);
 		else
 			m_dateTimeFormat += _T("%X");
diff -r a823baea47d8 -r ce3621d75112 src/interface/viewheader.cpp
--- a/src/interface/viewheader.cpp	Sun Aug 11 16:57:28 2013 +0300
+++ b/src/interface/viewheader.cpp	Sun Aug 11 19:53:00 2013 +0300
@@ -67,7 +67,7 @@
 		navEvent.SetDirection(!event.ShiftDown());
 		navEvent.SetFromTab(true);
 		navEvent.ResumePropagation(1);
-		m_parent->ProcessEvent(navEvent);
+		m_parent->GetEventHandler()->ProcessEvent(navEvent);
 	}
 
 	void OnChar(wxKeyEvent& event)
diff -r a823baea47d8 -r ce3621d75112 src/interface/wrapengine.cpp
--- a/src/interface/wrapengine.cpp	Sun Aug 11 16:57:28 2013 +0300
+++ b/src/interface/wrapengine.cpp	Sun Aug 11 19:53:00 2013 +0300
@@ -234,24 +234,24 @@
 	bool containsURL = false;
 	for (int i = 0; i <= strLen; i++)
 	{
-		if ((text[i] == ':' && text[i + 1] == '/' && text[i + 2] == '/') || // absolute
-			(text[i] == '/' && (!i || text[i - 1] == ' '))) // relative
+		if ((i < strLen - 2 && text[i] == ':' && text[i + 1] == '/' && text[i + 2] == '/') || // absolute
+			(i < strLen && text[i] == '/' && (!i || text[i - 1] == ' '))) // relative
 		{
 			url = true;
 			containsURL = true;
 		}
-		if (text[i] != ' ' && text[i] != 0)
+		if (i < strLen && text[i] != ' ')
 		{
 			// If url, wrap on slashes and ampersands, but not first slash of something://
 			if (!url ||
-				 ((text[i] != '/' || text[i + 1] == '/') && (text[i] != '&' || text[i + 1] == '&') && text[i] != '?'))
+				 ((i < strLen - 1 && (text[i] != '/' || text[i + 1] == '/')) && (i < strLen - 1 && (text[i] != '&' || text[i + 1] == '&')) && text[i] != '?'))
 			continue;
 		}
 
 		wxString segment;
 		if (wrapAfter == -1)
 		{
-			if (text[i] == '/' || text[i] == '?' || text[i] == '&')
+			if (i < strLen && (text[i] == '/' || text[i] == '?' || text[i] == '&'))
 				segment = text.Mid(start, i - start + 1);
 			else
 				segment = text.Mid(start, i - start);
@@ -259,7 +259,7 @@
 		}
 		else
 		{
-			if (text[i] == '/' || text[i] == '?' || text[i] == '&')
+			if (i < strLen && (text[i] == '/' || text[i] == '?' || text[i] == '&'))
 				segment = text.Mid(wrapAfter + 1, i - wrapAfter);
 			else
 				segment = text.Mid(wrapAfter + 1, i - wrapAfter - 1);
@@ -274,7 +274,7 @@
 			if (wrappedText != _T(""))
 				wrappedText += _T("\n");
 			wrappedText += text.Mid(start, wrapAfter - start);
-			if (text[wrapAfter] != ' ' && text[wrapAfter] != '\0')
+			if (wrapAfter < strLen && text[wrapAfter] != ' ' && text[wrapAfter] != '\0')
 				wrappedText += text[wrapAfter];
 
 			if (width + spaceWidth >= (int)maxLength)
@@ -304,7 +304,7 @@
 			if (wrappedText != _T(""))
 				wrappedText += _T("\n");
 			wrappedText += text.Mid(start, i - start);
-			if (text[i] != ' ' && text[i] != '\0')
+			if (i < strLen && text[i] != ' ' && text[i] != '\0')
 				wrappedText += text[i];
 			start = i + 1;
 			wrapAfter = -1;
@@ -318,7 +318,7 @@
 			wrapAfter = i;
 		}
 
-		if (text[i] == ' ')
+		if (i < strLen && text[i] == ' ')
 			url = false;
 	}
 	if (start < strLen)
