Package: survex
Version: 1.0.39.1
Author: Guillem Jover <guillem@debian.org>
Status: applied
Description:
 Port to wxWidgets 2.6

---
 debian/control  |    2 +-
 src/aboutdlg.cc |   48 +++++-----
 src/aven.cc     |   59 +++++++-----
 src/export.cc   |   14 ++-
 src/gfxcore.cc  |   64 +++++++------
 src/mainfrm.cc  |  283 ++++++++++++++++++++++++++++---------------------------
 src/mainfrm.h   |   10 ++-
 src/msgwx.h     |   32 ++++++
 src/printwx.cc  |   91 +++++++++---------
 9 files changed, 332 insertions(+), 271 deletions(-)
 create mode 100644 src/msgwx.h

diff --git a/debian/control b/debian/control
index 857b0c9..1f47ddd 100644
--- a/debian/control
+++ b/debian/control
@@ -3,7 +3,7 @@ Section: science
 Priority: extra
 Maintainer: Wookey <wookey@survex.com>
 Standards-Version: 3.7.2
-Build-Depends: debhelper (>= 4.2.13), libx11-dev, libxext-dev, x-dev, libwxgtk2.4-dev, dpkg-dev (>= 1.13.19)
+Build-Depends: debhelper (>= 4.2.13), libx11-dev, libxext-dev, x-dev, libwxgtk2.6-dev, dpkg-dev (>= 1.13.19)
 
 Package: survex
 Architecture: any
diff --git a/src/aboutdlg.cc b/src/aboutdlg.cc
index 09bc5e9..02bf912 100644
--- a/src/aboutdlg.cc
+++ b/src/aboutdlg.cc
@@ -5,6 +5,7 @@
 //
 //  Copyright (C) 2001-2003 Mark R. Shinwell.
 //  Copyright (C) 2001,2002,2003,2004,2005 Olly Betts
+//  Copyright (C) 2008 Guillem Jover
 //
 //  This program is free software; you can redistribute it and/or modify
 //  it under the terms of the GNU General Public License as published by
@@ -28,6 +29,7 @@
 #include "aboutdlg.h"
 #include "aven.h"
 #include "message.h"
+#include "msgwx.h"
 
 #include <stdio.h> // for popen
 
@@ -37,14 +39,14 @@ BEGIN_EVENT_TABLE(AboutDlg, wxDialog)
 END_EVENT_TABLE()
 
 AboutDlg::AboutDlg(wxWindow* parent, const wxString & icon_path) :
-    wxDialog(parent, 500, wxString::Format(msg(/*About %s*/205), APP_NAME))
+    wxDialog(parent, 500, wxString::Format(GetMsg(/*About %s*/205), wxT(APP_NAME)))
 {
     wxBoxSizer* horiz = new wxBoxSizer(wxHORIZONTAL);
     wxBoxSizer* vert = new wxBoxSizer(wxVERTICAL);
 
     if (!bitmap.Ok()) {
-	bitmap.LoadFile(icon_path + "aven-about.png", wxBITMAP_TYPE_PNG);
-	bitmap_icon.LoadFile(icon_path + "aven.png", wxBITMAP_TYPE_PNG);
+	bitmap.LoadFile(icon_path + wxT("aven-about.png"), wxBITMAP_TYPE_PNG);
+	bitmap_icon.LoadFile(icon_path + wxT("aven.png"), wxBITMAP_TYPE_PNG);
     }
     if (bitmap.Ok()) {
 	wxStaticBitmap* static_bitmap = new wxStaticBitmap(this, 501, bitmap);
@@ -53,20 +55,20 @@ AboutDlg::AboutDlg(wxWindow* parent, const wxString & icon_path) :
     }
     horiz->Add(vert, 0, wxALL, 2);
 
-    wxString id = wxString(APP_NAME" "VERSION"\n");
-    id += msg(/*Survey visualisation tool*/209);
+    wxString id = wxString(wxT(APP_NAME" "VERSION"\n"));
+    id += GetMsg(/*Survey visualisation tool*/209);
     wxBoxSizer* title = new wxBoxSizer(wxHORIZONTAL);
     if (bitmap_icon.Ok()) {
 	title->Add(new wxStaticBitmap(this, 599, bitmap_icon), 0, wxALIGN_CENTRE_VERTICAL|wxRIGHT, 8);
     }
     title->Add(new wxStaticText(this, 502, id), 0, wxALL, 2);
 
-    wxString copyright_msg = COPYRIGHT_MSG"\n"AVEN_COPYRIGHT_MSG;
-    const char * csign = msg(/*&copy;*/0);
-    if (strcmp(csign, "(C)") != 0) {
-	size_t csign_len = strlen(csign);
+    wxString copyright_msg = wxT(COPYRIGHT_MSG"\n"AVEN_COPYRIGHT_MSG);
+    wxString csign = GetMsg(/*&copy;*/0);
+    if (csign.Cmp(wxT("(C)")) != 0) {
+	size_t csign_len = csign.Len();
 	size_t i = 0;
-	while ((i = copyright_msg.find("(C)", i)) != wxString::npos) {
+	while ((i = copyright_msg.find(wxT("(C)"), i)) != wxString::npos) {
 	    copyright_msg.replace(i, 3, csign, csign_len);
 	    i += csign_len;
 	}
@@ -74,7 +76,7 @@ AboutDlg::AboutDlg(wxWindow* parent, const wxString & icon_path) :
     wxStaticText* copyright = new wxStaticText(this, 503, copyright_msg);
 
     wxString licence_str;
-    wxString l(msg(/*This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public Licence as published by the Free Software Foundation; either version 2 of the Licence, or (at your option) any later version.*/219));
+    wxString l(GetMsg(/*This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public Licence as published by the Free Software Foundation; either version 2 of the Licence, or (at your option) any later version.*/219));
     wxClientDC dc(this);
     dc.SetFont(this->GetFont());
     do {
@@ -99,7 +101,7 @@ AboutDlg::AboutDlg(wxWindow* parent, const wxString & icon_path) :
     } while (!l.empty());
 
     wxStaticText* licence = new wxStaticText(this, 504, licence_str);
-    wxButton* ok = new wxButton(this, wxID_OK, wxGetTranslation("OK"));
+    wxButton* ok = new wxButton(this, wxID_OK, wxGetTranslation(wxT("OK")));
     ok->SetDefault();
 
     vert->Add(10, 5, 0, wxTOP, 5);
@@ -109,7 +111,7 @@ AboutDlg::AboutDlg(wxWindow* parent, const wxString & icon_path) :
     vert->Add(copyright, 0, wxLEFT | wxRIGHT, 20);
     vert->Add(10, 5, 0, wxTOP, 5);
 
-    vert->Add(new wxStaticText(this, 505, msg(/*System Information:*/390)),
+    vert->Add(new wxStaticText(this, 505, GetMsg(/*System Information:*/390)),
 	      0, wxLEFT | wxRIGHT, 20);
 
 #if defined __UNIX__ && !wxCHECK_VERSION(2,5,4)
@@ -133,31 +135,31 @@ AboutDlg::AboutDlg(wxWindow* parent, const wxString & icon_path) :
 #else
     wxString info(wxGetOsDescription());
 #endif
-    info += '\n';
+    info += wxT('\n');
     info += wxVERSION_STRING;
 #ifdef __WXGTK__
 #if defined __WXGTK24__
-    info += " (GTK+ >= 2.4)";
+    info += wxT(" (GTK+ >= 2.4)");
 #elif defined __WXGTK20__
-    info += " (GTK+ >= 2.0)";
+    info += wxT(" (GTK+ >= 2.0)");
 #elif defined __WXGTK12__
-    info += " (GTK+ >= 1.2)";
+    info += wxT(" (GTK+ >= 1.2)");
 #else
-    info += " (GTK+ < 1.2)";
+    info += wxT(" (GTK+ < 1.2)");
 #endif
 #elif defined __WXMOTIF__
 #if defined __WXMOTIF20__
-    info += " (Motif >= 2.0)";
+    info += wxT(" (Motif >= 2.0)");
 #else
-    info += " (Motif < 2.0)";
+    info += wxT(" (Motif < 2.0)");
 #endif
 #elif defined __WXX11__
-    info += " (X11)";
+    info += wxT(" (X11)");
 #endif
     info += '\n';
     int bpp = wxDisplayDepth();
-    info += wxString::Format("Display Depth: %d bpp", bpp);
-    if (wxColourDisplay()) info += " (colour)";
+    info += wxString::Format(wxT("Display Depth: %d bpp"), bpp);
+    if (wxColourDisplay()) info += wxT(" (colour)");
 
     // Use a readonly multiline text edit for the system info so users can
     // easily cut and paste it into an email when reporting bugs.
diff --git a/src/aven.cc b/src/aven.cc
index 72fa60d..c8323c0 100644
--- a/src/aven.cc
+++ b/src/aven.cc
@@ -5,6 +5,7 @@
 //
 //  Copyright (C) 2001 Mark R. Shinwell.
 //  Copyright (C) 2002,2003,2004,2005 Olly Betts
+//  Copyright (C) 2008 Guillem Jover
 //
 //  This program is free software; you can redistribute it and/or modify
 //  it under the terms of the GNU General Public License as published by
@@ -30,6 +31,7 @@
 
 #include "cmdline.h"
 #include "message.h"
+#include "msgwx.h"
 
 #include <assert.h>
 #include <signal.h>
@@ -56,6 +58,15 @@ Aven::~Aven()
 
 bool Aven::OnInit()
 {
+    char **c_argv;
+
+    /* Convert from wxApp's argv to standard char **argv. */
+    c_argv = new char * [argc + 1];
+    for (int i = 0; i < argc; i++) {
+	c_argv[i] = osstrdup(wxString(argv[i]).mb_str(wxConvUTF8));
+    }
+    c_argv[argc] = NULL;
+
 #ifdef __WXMAC__
     // Tell wxMac which the About menu item is so it can be put where MacOS
     // users expect it to be.
@@ -74,19 +85,19 @@ bool Aven::OnInit()
 	memmove(argv + 1, argv + 2, argc * sizeof(char *));
     }
 #endif
-    msg_init(argv);
+    msg_init(c_argv);
 
-    const char *lang = msg_lang2 ? msg_lang2 : msg_lang;
+    wxString lang = wxString(msg_lang2 ? msg_lang2 : msg_lang, wxConvUTF8);
     if (lang) {
 	// suppress message box warnings about messages not found
 	wxLogNull logNo;
 	wxLocale *loc = new wxLocale();
-	loc->AddCatalogLookupPathPrefix(msg_cfgpth());
+	loc->AddCatalogLookupPathPrefix(wxString(msg_cfgpth(), wxConvUTF8));
 	if (!loc->Init(lang, lang, lang, TRUE, TRUE)) {
-	    if (strcmp(lang, "sk") == 0) {
+	    if (lang.Cmp(wxT("sk")) == 0) {
 	       // As of 2.2.9, wxWindows has cs but not sk - the two languages
 	       // are close, so this makes sense...
-	       loc->Init("cs", "cs", "cs", TRUE, TRUE);
+	       loc->Init(wxT("cs"), wxT("cs"), wxT("cs"), TRUE, TRUE);
 	    }
 	}
 	// The existence of the wxLocale object is enough - no need to keep a
@@ -118,12 +129,12 @@ bool Aven::OnInit()
     };
 
     cmdline_set_syntax_message("[3d file]", NULL);
-    cmdline_init(argc, argv, short_opts, long_opts, NULL, help, 0, 1);
+    cmdline_init(argc, c_argv, short_opts, long_opts, NULL, help, 0, 1);
     while (true) {
 	int opt = cmdline_getopt();
 	if (opt == EOF) break;
 	if (opt == 's') {
-	    survey = optarg;
+	    survey = wxString(optarg, wxConvUTF8);
 	}
 	if (opt == 'p') {
 	    print_and_exit = true;
@@ -164,10 +175,10 @@ bool Aven::OnInit()
     height = height * 3 / 4;
 
     // Create the main window.
-    m_Frame = new MainFrm(APP_NAME, wxPoint(x, y), wxSize(width, height));
+    m_Frame = new MainFrm(wxT(APP_NAME), wxPoint(x, y), wxSize(width, height));
 
     if (argv[optind]) {
-	m_Frame->OpenFile(wxString(argv[optind]), survey, true);
+	m_Frame->OpenFile(argv[optind], survey, true);
     }
 
     if (print_and_exit) {
@@ -194,10 +205,10 @@ Aven::GetPageSetupDialogData()
     wxConfigBase * cfg = wxConfigBase::Get();
     // These default margins were chosen by looking at all the .ppd files
     // on my machine.
-    cfg->Read("paper_margin_left", &left, 7);
-    cfg->Read("paper_margin_right", &right, 7);
-    cfg->Read("paper_margin_top", &top, 14);
-    cfg->Read("paper_margin_bottom", &bottom, 14);
+    cfg->Read(wxT("paper_margin_left"), &left, 7);
+    cfg->Read(wxT("paper_margin_right"), &right, 7);
+    cfg->Read(wxT("paper_margin_top"), &top, 14);
+    cfg->Read(wxT("paper_margin_bottom"), &bottom, 14);
     m_pageSetupData->SetMarginTopLeft(wxPoint(left, top));
     m_pageSetupData->SetMarginBottomRight(wxPoint(right, bottom));
 #endif
@@ -215,17 +226,17 @@ Aven::SetPageSetupDialogData(const wxPageSetupDialogData & psdd)
 
     // Store user specified paper margins on disk/in registry.
     wxConfigBase * cfg = wxConfigBase::Get();
-    cfg->Write("paper_margin_left", topleft.x);
-    cfg->Write("paper_margin_right", bottomright.x);
-    cfg->Write("paper_margin_top", topleft.y);
-    cfg->Write("paper_margin_bottom", bottomright.y);
+    cfg->Write(wxT("paper_margin_left"), topleft.x);
+    cfg->Write(wxT("paper_margin_right"), bottomright.x);
+    cfg->Write(wxT("paper_margin_top"), topleft.y);
+    cfg->Write(wxT("paper_margin_bottom"), bottomright.y);
     cfg->Flush();
 #endif
 }
 
 void Aven::ReportError(const wxString& msg)
 {
-    wxMessageBox(msg, APP_NAME, wxOK | wxCENTRE | wxICON_EXCLAMATION);
+    wxMessageBox(msg, wxT(APP_NAME), wxOK | wxCENTRE | wxICON_EXCLAMATION);
 }
 
 // called to report errors by message.c
@@ -234,18 +245,18 @@ aven_v_report(int severity, const char *fnm, int line, int en, va_list ap)
 {
    wxString m;
    if (fnm) {
-      m = fnm;
-      if (line) m += wxString::Format(":%d", line);
-      m += ": ";
+      m = wxString(fnm, wxConvUTF8);
+      if (line) m += wxString::Format(wxT(":%d"), line);
+      m += wxT(": ");
    }
 
    if (severity == 0) {
-      m += msg(/*warning*/4);
-      m += ": ";
+      m += GetMsg(/*warning*/4);
+      m += wxT(": ");
    }
 
    wxString s;
-   s.PrintfV(msg(en), ap);
+   s.PrintfV(GetMsg(en), ap);
    m += s;
    wxGetApp().ReportError(m);
 }
diff --git a/src/export.cc b/src/export.cc
index d63ed34..b7e741b 100644
--- a/src/export.cc
+++ b/src/export.cc
@@ -4,6 +4,7 @@
 
 /* Copyright (C) 1994-2004,2005 Olly Betts
  * Copyright (C) 2004 John Pybus (SVG Output code)
+ * Copyright (C) 2008 Guillem Jover
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -576,7 +577,7 @@ eps_header(const char *title)
    wxString name;
 #if defined(HAVE_GETPWUID) && !defined(__DJGPP__)
    struct passwd * ent = getpwuid(getuid());
-   if (ent && ent->pw_gecos[0]) name = ent->pw_gecos;
+   if (ent && ent->pw_gecos[0]) name = wxString(ent->pw_gecos, wxConvUTF8);
 #endif
    if (name.empty()) {
        name = ::wxGetUserName();
@@ -585,7 +586,7 @@ eps_header(const char *title)
        }
    }
    if (name) {
-      fprintf(fh, "%%%%For: %s\n", name.c_str());
+      fprintf(fh, "%%%%For: %s\n", (const char *)name.mb_str(wxConvUTF8));
    }
 
    fprintf(fh, "%%%%BoundingBox: %d %d %d %d\n",
@@ -949,7 +950,7 @@ Export(const wxString &fnm_out, const wxString &title, const MainFrm * mainfrm,
       for (i = 0; i < FMT_ENDMARKER; ++i) {
 	 size_t l = strlen(extensions[i]);
 	 if (len > l + 1 && fnm_out[len - l - 1] == FNM_SEP_EXT &&
-	     strcasecmp(fnm_out.c_str() + len - l, extensions[i]) == 0) {
+	     strcasecmp(fnm_out.mb_str(wxConvUTF8) + len - l, extensions[i]) == 0) {
 	    format = export_format(i);
 	    break;
 	 }
@@ -1012,7 +1013,7 @@ Export(const wxString &fnm_out, const wxString &title, const MainFrm * mainfrm,
       exit(1);
    }
 
-   fh = fopen(fnm_out.c_str(), mode);
+   fh = fopen(fnm_out.mb_str(wxConvUTF8), mode);
    if (!fh) return false;
 
    if (elevation) {
@@ -1086,7 +1087,7 @@ Export(const wxString &fnm_out, const wxString &title, const MainFrm * mainfrm,
    }
 
    /* Header */
-   header(title.c_str());
+   header(title.mb_str(wxConvUTF8));
 
    p1.x = p1.y = p1.z = 0; /* avoid compiler warning */
 
@@ -1174,7 +1175,8 @@ Export(const wxString &fnm_out, const wxString &title, const MainFrm * mainfrm,
 	     * a surface and underground survey meet to be in the
 	     * underground layer */
 	    if (labels_this_pass)
-		label(&p, (*pos)->GetText(), !(*pos)->IsUnderground());
+		label(&p, (*pos)->GetText().mb_str(wxConvUTF8),
+		      !(*pos)->IsUnderground());
 	    if (crosses_this_pass)
 		cross(&p, !(*pos)->IsUnderground());
 	}
diff --git a/src/gfxcore.cc b/src/gfxcore.cc
index 1d94de9..b5ab7ff 100644
--- a/src/gfxcore.cc
+++ b/src/gfxcore.cc
@@ -5,6 +5,7 @@
 //
 //  Copyright (C) 2000-2001, Mark R. Shinwell.
 //  Copyright (C) 2001-2003,2004,2005 Olly Betts
+//  Copyright (C) 2008 Guillem Jover
 //
 //  This program is free software; you can redistribute it and/or modify
 //  it under the terms of the GNU General Public License as published by
@@ -34,6 +35,7 @@
 #include "message.h"
 #include "useful.h"
 #include "printwx.h"
+#include "msgwx.h"
 #include "export.h"
 
 #include <wx/confbase.h>
@@ -117,7 +119,7 @@ END_EVENT_TABLE()
 
 GfxCore::GfxCore(MainFrm* parent, wxWindow* parent_win) :
     wxWindow(parent_win, 100, wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS),
-    m_Font(FONT_SIZE, wxSWISS, wxNORMAL, wxNORMAL, FALSE, "Helvetica",
+    m_Font(FONT_SIZE, wxSWISS, wxNORMAL, wxNORMAL, FALSE, wxT("Helvetica"),
 	   wxFONTENCODING_ISO8859_1),
     m_InitialisePending(false)
 {
@@ -150,8 +152,8 @@ GfxCore::GfxCore(MainFrm* parent, wxWindow* parent_win) :
     m_FixedPts = false;
     m_ExportedPts = false;
     m_Grid = false;
-    wxConfigBase::Get()->Read("metric", &m_Metric, true);
-    wxConfigBase::Get()->Read("degrees", &m_Degrees, true);
+    wxConfigBase::Get()->Read(wxT("metric"), &m_Metric, true);
+    wxConfigBase::Get()->Read(wxT("degrees"), &m_Degrees, true);
     m_here.x = DBL_MAX;
     m_there.x = DBL_MAX;
     clipping = false;
@@ -1099,18 +1101,18 @@ void GfxCore::Draw2dIndicators()
     wxCoord width, height;
     wxString str;
 
-    m_DrawDC.GetTextExtent(wxString("000"), &width, &h);
+    m_DrawDC.GetTextExtent(wxString(wxT("000")), &width, &h);
     height = m_YSize - INDICATOR_OFFSET_Y - INDICATOR_BOX_SIZE - INDICATOR_GAP - h;
 
     if (m_Compass && m_RotationOK) {
 	if (m_Degrees) {
-	    str = wxString::Format("%03d", int(m_PanAngle * 180.0 / M_PI));
+	    str = wxString::Format(wxT("%03d"), int(m_PanAngle * 180.0 / M_PI));
 	} else {
-	    str = wxString::Format("%03d", int(m_PanAngle * 200.0 / M_PI));
+	    str = wxString::Format(wxT("%03d"), int(m_PanAngle * 200.0 / M_PI));
 	}
 	m_DrawDC.GetTextExtent(str, &w, &h);
 	m_DrawDC.DrawText(str, pan_centre_x + width / 2 - w, height);
-	str = wxString(msg(/*Facing*/203));
+	str = GetMsg(/*Facing*/203);
 	m_DrawDC.GetTextExtent(str, &w, &h);
 	m_DrawDC.DrawText(str, pan_centre_x - w / 2, height - h);
     }
@@ -1122,10 +1124,10 @@ void GfxCore::Draw2dIndicators()
 	} else {
 	    angle = int(-m_TiltAngle * 200.0 / M_PI);
 	}
-	str = angle ? wxString::Format("%+03d", angle) : wxString("00");
+	str = angle ? wxString::Format(wxT("%+03d"), angle) : wxString(wxT("00"));
 	m_DrawDC.GetTextExtent(str, &w, &h);
 	m_DrawDC.DrawText(str, elev_centre_x + width / 2 - w, height);
-	str = wxString(msg(/*Elevation*/118));
+	str = GetMsg(/*Elevation*/118);
 	m_DrawDC.GetTextExtent(str, &w, &h);
 	m_DrawDC.DrawText(str, elev_centre_x - w / 2, height - h);
     }
@@ -1279,37 +1281,37 @@ wxString GfxCore::FormatLength(Double size_snap, bool scalebar)
     }
 
     if (size_snap == 0.0) {
-	str = "0";
+	str = wxT("0");
     } else if (m_Metric) {
 #ifdef SILLY_UNITS
 	if (size_snap < 1e-12) {
-	    str = wxString::Format("%.3gpm", size_snap * 1e12);
+	    str = wxString::Format(wxT("%.3gpm"), size_snap * 1e12);
 	} else if (size_snap < 1e-9) {
-	    str = wxString::Format("%.fpm", size_snap * 1e12);
+	    str = wxString::Format(wxT("%.fpm"), size_snap * 1e12);
 	} else if (size_snap < 1e-6) {
-	    str = wxString::Format("%.fnm", size_snap * 1e9);
+	    str = wxString::Format(wxT("%.fnm"), size_snap * 1e9);
 	} else if (size_snap < 1e-3) {
-	    str = wxString::Format("%.fum", size_snap * 1e6);
+	    str = wxString::Format(wxT("%.fum"), size_snap * 1e6);
 #else
 	if (size_snap < 1e-3) {
-	    str = wxString::Format("%.3gmm", size_snap * 1e3);
+	    str = wxString::Format(wxT("%.3gmm"), size_snap * 1e3);
 #endif
 	} else if (size_snap < 1e-2) {
-	    str = wxString::Format("%.fmm", size_snap * 1e3);
+	    str = wxString::Format(wxT("%.fmm"), size_snap * 1e3);
 	} else if (size_snap < 1.0) {
-	    str = wxString::Format("%.fcm", size_snap * 100.0);
+	    str = wxString::Format(wxT("%.fcm"), size_snap * 100.0);
 	} else if (size_snap < 1e3) {
-	    str = wxString::Format("%.fm", size_snap);
+	    str = wxString::Format(wxT("%.fm"), size_snap);
 #ifdef SILLY_UNITS
 	} else if (size_snap < 1e6) {
-	    str = wxString::Format("%.fkm", size_snap * 1e-3);
+	    str = wxString::Format(wxT("%.fkm"), size_snap * 1e-3);
 	} else if (size_snap < 1e9) {
-	    str = wxString::Format("%.fMm", size_snap * 1e-6);
+	    str = wxString::Format(wxT("%.fMm"), size_snap * 1e-6);
 	} else {
-	    str = wxString::Format("%.fGm", size_snap * 1e-9);
+	    str = wxString::Format(wxT("%.fGm"), size_snap * 1e-9);
 #else
 	} else {
-	    str = wxString::Format(scalebar ? "%.fkm" : "%.2fkm", size_snap * 1e-3);
+	    str = wxString::Format(scalebar ? wxT("%.fkm") : wxT("%.2fkm"), size_snap * 1e-3);
 #endif
 	}
     } else {
@@ -1317,20 +1319,20 @@ wxString GfxCore::FormatLength(Double size_snap, bool scalebar)
 	if (scalebar) {
 	    Double inches = size_snap * 12;
 	    if (inches < 1.0) {
-		str = wxString::Format("%.3gin", inches);
+		str = wxString::Format(wxT("%.3gin"), inches);
 	    } else if (size_snap < 1.0) {
-		str = wxString::Format("%.fin", inches);
+		str = wxString::Format(wxT("%.fin"), inches);
 	    } else if (size_snap < 5279.5) {
-		str = wxString::Format("%.fft", size_snap);
+		str = wxString::Format(wxT("%.fft"), size_snap);
 	    } else {
-		str = wxString::Format("%.f miles", size_snap / 5280.0);
+		str = wxString::Format(wxT("%.f miles"), size_snap / 5280.0);
 	    }
 	} else {
-	    str = wxString::Format("%.fft", size_snap);
+	    str = wxString::Format(wxT("%.fft"), size_snap);
 	}
     }
 
-    return negative ? wxString("-") + str : str;
+    return negative ? wxString(wxT("-")) + str : str;
 }
 
 void GfxCore::DrawScalebar()
@@ -1394,7 +1396,7 @@ void GfxCore::DrawScalebar()
 
     m_DrawDC.SetTextBackground(wxColour(0, 0, 0));
     m_DrawDC.SetTextForeground(TEXT_COLOUR);
-    m_DrawDC.DrawText("0", end_x, end_y - FONT_SIZE - 4);
+    m_DrawDC.DrawText(wxT("0"), end_x, end_y - FONT_SIZE - 4);
 
     int text_width, text_height;
     m_DrawDC.GetTextExtent(str, &text_width, &text_height);
@@ -2407,7 +2409,7 @@ void GfxCore::OnIndicatorsUpdate(wxUpdateUIEvent& cmd)
 void GfxCore::OnToggleMetric()
 {
     m_Metric = !m_Metric;
-    wxConfigBase::Get()->Write("metric", m_Metric);
+    wxConfigBase::Get()->Write(wxT("metric"), m_Metric);
     wxConfigBase::Get()->Flush();
     ForceRefresh();
 }
@@ -2421,7 +2423,7 @@ void GfxCore::OnToggleMetricUpdate(wxUpdateUIEvent& cmd)
 void GfxCore::OnToggleDegrees()
 {
     m_Degrees = !m_Degrees;
-    wxConfigBase::Get()->Write("degrees", m_Degrees);
+    wxConfigBase::Get()->Write(wxT("degrees"), m_Degrees);
     wxConfigBase::Get()->Flush();
     ForceRefresh();
 }
diff --git a/src/mainfrm.cc b/src/mainfrm.cc
index f848bdf..a62456d 100644
--- a/src/mainfrm.cc
+++ b/src/mainfrm.cc
@@ -6,6 +6,7 @@
 //  Copyright (C) 2000-2002 Mark R. Shinwell
 //  Copyright (C) 2001-2003,2004,2005 Olly Betts
 //  Copyright (C) 2004 Philip Underwood
+//  Copyright (C) 2008 Guillem Jover
 //
 //  This program is free software; you can redistribute it and/or modify
 //  it under the terms of the GNU General Public License as published by
@@ -34,6 +35,7 @@
 #include "img.h"
 #include "namecmp.h"
 #include "printwx.h"
+#include "msgwx.h"
 #include "filename.h"
 
 #include <wx/confbase.h>
@@ -202,7 +204,8 @@ class LabelCmp : public greater<const LabelInfo*> {
 public:
     LabelCmp(int separator_) : separator(separator_) {}
     bool operator()(const LabelInfo* pt1, const LabelInfo* pt2) {
-	return name_cmp(pt1->GetText(), pt2->GetText(), separator) < 0;
+	return name_cmp(pt1->GetText().mb_str(wxConvUTF8),
+	                pt2->GetText().mb_str(wxConvUTF8), separator) < 0;
     }
 };
 
@@ -215,7 +218,7 @@ public:
 	if (n) return n > 0;
 	wxString l1 = pt1->text.AfterLast(separator);
 	wxString l2 = pt2->text.AfterLast(separator);
-	n = name_cmp(l1, l2, separator);
+	n = name_cmp(l1.mb_str(wxConvUTF8), l2.mb_str(wxConvUTF8), separator);
 	if (n) return n < 0;
 	// Prefer non-2-nodes...
 	// FIXME; implement
@@ -224,7 +227,8 @@ public:
 	n = pt1->text.length() - pt2->text.length();
 	if (n) return n < 0;
 	// make sure that we don't ever compare different labels as equal
-	return name_cmp(pt1->text, pt2->text, separator) < 0;
+	return name_cmp(pt1->text.mb_str(wxConvUTF8),
+	                pt2->text.mb_str(wxConvUTF8), separator) < 0;
     }
 };
 
@@ -246,7 +250,7 @@ DnDFile::OnDropFiles(wxCoord, wxCoord, const wxArrayString &filenames)
     assert(filenames.GetCount() > 0);
 
     if (filenames.GetCount() != 1) {
-	wxGetApp().ReportError(msg(/*You may only view one 3d file at a time.*/336));
+	wxGetApp().ReportError(GetMsg(/*You may only view one 3d file at a time.*/336));
 	return FALSE;
     }
 
@@ -259,17 +263,17 @@ MainFrm::MainFrm(const wxString& title, const wxPoint& pos, const wxSize& size)
     wxFrame(NULL, 101, title, pos, size, wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE),
     m_Gfx(NULL), m_NumEntrances(0), m_NumFixedPts(0), m_NumExportedPts(0)
 {
-    icon_path = msg_cfgpth();
+    icon_path = wxString(msg_cfgpth(), wxConvUTF8);
     icon_path += wxCONFIG_PATH_SEPARATOR;
-    icon_path += "icons";
+    icon_path += wxT("icons");
     icon_path += wxCONFIG_PATH_SEPARATOR;
 
 #ifdef _WIN32
     // The peculiar name is so that the icon is the first in the file
     // (required by Microsoft Windows for this type of icon)
-    SetIcon(wxIcon("aaaaaAven"));
+    SetIcon(wxIcon(wxT("aaaaaAven")));
 #else
-    SetIcon(wxIcon(icon_path + "aven.png", wxBITMAP_TYPE_PNG));
+    SetIcon(wxIcon(icon_path + wxT("aven.png"), wxBITMAP_TYPE_PNG));
 #endif
 
     InitialisePensAndBrushes();
@@ -361,37 +365,37 @@ void MainFrm::CreateMenuBar()
     orientmenu->Append(menu_ORIENT_DEFAULTS, GetTabMsg(/*Restore De@fault Settings*/254));
 
     wxMenu* viewmenu = new wxMenu;
-    viewmenu->Append(menu_VIEW_SHOW_NAMES, GetTabMsg(/*Station @Names##Ctrl+N*/270), "", true);
-    viewmenu->Append(menu_VIEW_SHOW_CROSSES, GetTabMsg(/*@Crosses##Ctrl+X*/271), "", true);
-    viewmenu->Append(menu_VIEW_GRID, GetTabMsg(/*@Grid##Ctrl+G*/297), "", true);
+    viewmenu->Append(menu_VIEW_SHOW_NAMES, GetTabMsg(/*Station @Names##Ctrl+N*/270), wxT(""), true);
+    viewmenu->Append(menu_VIEW_SHOW_CROSSES, GetTabMsg(/*@Crosses##Ctrl+X*/271), wxT(""), true);
+    viewmenu->Append(menu_VIEW_GRID, GetTabMsg(/*@Grid##Ctrl+G*/297), wxT(""), true);
     viewmenu->AppendSeparator();
-    viewmenu->Append(menu_VIEW_SHOW_LEGS, GetTabMsg(/*@Underground Survey Legs##Ctrl+L*/272), "", true);
-    viewmenu->Append(menu_VIEW_SHOW_SURFACE, GetTabMsg(/*@Surface Survey Legs##Ctrl+F*/291), "", true);
+    viewmenu->Append(menu_VIEW_SHOW_LEGS, GetTabMsg(/*@Underground Survey Legs##Ctrl+L*/272), wxT(""), true);
+    viewmenu->Append(menu_VIEW_SHOW_SURFACE, GetTabMsg(/*@Surface Survey Legs##Ctrl+F*/291), wxT(""), true);
     viewmenu->AppendSeparator();
-    viewmenu->Append(menu_VIEW_SURFACE_DEPTH, GetTabMsg(/*@Altitude Colouring on Surface Surveys*/292), "", true);
-    viewmenu->Append(menu_VIEW_SURFACE_DASHED, GetTabMsg(/*@Dashed Surface Surveys*/293), "", true);
+    viewmenu->Append(menu_VIEW_SURFACE_DEPTH, GetTabMsg(/*@Altitude Colouring on Surface Surveys*/292), wxT(""), true);
+    viewmenu->Append(menu_VIEW_SURFACE_DASHED, GetTabMsg(/*@Dashed Surface Surveys*/293), wxT(""), true);
     viewmenu->AppendSeparator();
-    viewmenu->Append(menu_VIEW_SHOW_OVERLAPPING_NAMES, GetTabMsg(/*@Overlapping Names*/273), "", true);
+    viewmenu->Append(menu_VIEW_SHOW_OVERLAPPING_NAMES, GetTabMsg(/*@Overlapping Names*/273), wxT(""), true);
     viewmenu->AppendSeparator();
-    viewmenu->Append(menu_VIEW_SHOW_ENTRANCES, GetTabMsg(/*Highlight @Entrances*/294), "", true);
-    viewmenu->Append(menu_VIEW_SHOW_FIXED_PTS, GetTabMsg(/*Highlight @Fixed Points*/295), "", true);
-    viewmenu->Append(menu_VIEW_SHOW_EXPORTED_PTS, GetTabMsg(/*Highlight E@xported Points*/296), "", true);
+    viewmenu->Append(menu_VIEW_SHOW_ENTRANCES, GetTabMsg(/*Highlight @Entrances*/294), wxT(""), true);
+    viewmenu->Append(menu_VIEW_SHOW_FIXED_PTS, GetTabMsg(/*Highlight @Fixed Points*/295), wxT(""), true);
+    viewmenu->Append(menu_VIEW_SHOW_EXPORTED_PTS, GetTabMsg(/*Highlight E@xported Points*/296), wxT(""), true);
 
     wxMenu* ctlmenu = new wxMenu;
-    ctlmenu->Append(menu_CTL_REVERSE, GetTabMsg(/*@Reverse Sense##Ctrl+R*/280), "", true);
+    ctlmenu->Append(menu_CTL_REVERSE, GetTabMsg(/*@Reverse Sense##Ctrl+R*/280), wxT(""), true);
     ctlmenu->AppendSeparator();
     ctlmenu->Append(menu_CTL_CANCEL_DIST_LINE, GetTabMsg(/*@Cancel Measuring Line##Escape*/281));
     ctlmenu->AppendSeparator();
     wxMenu* indmenu = new wxMenu;
-    indmenu->Append(menu_VIEW_COMPASS, GetTabMsg(/*@Compass*/274), "", true);
-    indmenu->Append(menu_VIEW_CLINO, GetTabMsg(/*C@linometer*/275), "", true);
-    indmenu->Append(menu_VIEW_DEPTH_BAR, GetTabMsg(/*@Depth Bar*/276), "", true);
-    indmenu->Append(menu_VIEW_SCALE_BAR, GetTabMsg(/*@Scale Bar*/277), "", true);
+    indmenu->Append(menu_VIEW_COMPASS, GetTabMsg(/*@Compass*/274), wxT(""), true);
+    indmenu->Append(menu_VIEW_CLINO, GetTabMsg(/*C@linometer*/275), wxT(""), true);
+    indmenu->Append(menu_VIEW_DEPTH_BAR, GetTabMsg(/*@Depth Bar*/276), wxT(""), true);
+    indmenu->Append(menu_VIEW_SCALE_BAR, GetTabMsg(/*@Scale Bar*/277), wxT(""), true);
     ctlmenu->Append(menu_VIEW_INDICATORS, GetTabMsg(/*@Indicators*/299), indmenu);
-    ctlmenu->Append(menu_VIEW_SIDE_PANEL, GetTabMsg(/*@Side Panel*/337), "", true);
+    ctlmenu->Append(menu_VIEW_SIDE_PANEL, GetTabMsg(/*@Side Panel*/337), wxT(""), true);
     ctlmenu->AppendSeparator();
-    ctlmenu->Append(menu_VIEW_METRIC, GetTabMsg(/*@Metric*/342), "", true);
-    ctlmenu->Append(menu_VIEW_DEGREES, GetTabMsg(/*@Degrees*/343), "", true);
+    ctlmenu->Append(menu_VIEW_METRIC, GetTabMsg(/*@Metric*/342), wxT(""), true);
+    ctlmenu->Append(menu_VIEW_DEGREES, GetTabMsg(/*@Degrees*/343), wxT(""), true);
 
     wxMenu* helpmenu = new wxMenu;
     helpmenu->Append(menu_HELP_ABOUT, GetTabMsg(/*@About...*/290));
@@ -407,7 +411,7 @@ void MainFrm::CreateMenuBar()
 }
 
 // ICON must be a literal string.
-#define TOOLBAR_BITMAP(ICON) wxBitmap(icon_path + ICON".png", wxBITMAP_TYPE_PNG)
+#define TOOLBAR_BITMAP(ICON) wxBitmap(icon_path + ICON + wxT(".png"), wxBITMAP_TYPE_PNG)
 
 void MainFrm::CreateToolBar()
 {
@@ -419,31 +423,31 @@ void MainFrm::CreateToolBar()
     toolbar->SetMargins(5, 5);
 #endif
 
-    toolbar->AddTool(menu_FILE_OPEN, TOOLBAR_BITMAP("open"), "Open a 3D file for viewing");
+    toolbar->AddTool(menu_FILE_OPEN, TOOLBAR_BITMAP(wxT("open")), wxT("Open a 3D file for viewing"));
     toolbar->AddSeparator();
-    toolbar->AddTool(menu_ROTATION_TOGGLE, TOOLBAR_BITMAP("rotation"),
-		     wxNullBitmap, true, -1, -1, NULL, "Toggle rotation");
+    toolbar->AddTool(menu_ROTATION_TOGGLE, TOOLBAR_BITMAP(wxT("rotation")),
+		     wxNullBitmap, true, -1, -1, NULL, wxT("Toggle rotation"));
     toolbar->AddSeparator();
-    toolbar->AddTool(menu_ORIENT_PLAN, TOOLBAR_BITMAP("plan"), "Switch to plan view");
-    toolbar->AddTool(menu_ORIENT_ELEVATION, TOOLBAR_BITMAP("elevation"), "Switch to elevation view");
+    toolbar->AddTool(menu_ORIENT_PLAN, TOOLBAR_BITMAP(wxT("plan")), wxT("Switch to plan view"));
+    toolbar->AddTool(menu_ORIENT_ELEVATION, TOOLBAR_BITMAP(wxT("elevation")), wxT("Switch to elevation view"));
     toolbar->AddSeparator();
-    toolbar->AddTool(menu_ORIENT_DEFAULTS, TOOLBAR_BITMAP("defaults"), "Restore default view");
+    toolbar->AddTool(menu_ORIENT_DEFAULTS, TOOLBAR_BITMAP(wxT("defaults")), wxT("Restore default view"));
     toolbar->AddSeparator();
-    toolbar->AddTool(menu_VIEW_SHOW_NAMES, TOOLBAR_BITMAP("names"), wxNullBitmap, true,
-		     -1, -1, NULL, "Show station names");
-    toolbar->AddTool(menu_VIEW_SHOW_CROSSES, TOOLBAR_BITMAP("crosses"), wxNullBitmap, true,
-		     -1, -1, NULL, "Show crosses on stations");
-    toolbar->AddTool(menu_VIEW_SHOW_ENTRANCES, TOOLBAR_BITMAP("entrances"), wxNullBitmap, true,
-		     -1, -1, NULL, "Highlight entrances");
-    toolbar->AddTool(menu_VIEW_SHOW_FIXED_PTS, TOOLBAR_BITMAP("fixed-pts"), wxNullBitmap, true,
-		     -1, -1, NULL, "Highlight fixed points");
-    toolbar->AddTool(menu_VIEW_SHOW_EXPORTED_PTS, TOOLBAR_BITMAP("exported-pts"), wxNullBitmap, true,
-		     -1, -1, NULL, "Highlight exported stations");
+    toolbar->AddTool(menu_VIEW_SHOW_NAMES, TOOLBAR_BITMAP(wxT("names")), wxNullBitmap, true,
+		     -1, -1, NULL, wxT("Show station names"));
+    toolbar->AddTool(menu_VIEW_SHOW_CROSSES, TOOLBAR_BITMAP(wxT("crosses")), wxNullBitmap, true,
+		     -1, -1, NULL, wxT("Show crosses on stations"));
+    toolbar->AddTool(menu_VIEW_SHOW_ENTRANCES, TOOLBAR_BITMAP(wxT("entrances")), wxNullBitmap, true,
+		     -1, -1, NULL, wxT("Highlight entrances"));
+    toolbar->AddTool(menu_VIEW_SHOW_FIXED_PTS, TOOLBAR_BITMAP(wxT("fixed-pts")), wxNullBitmap, true,
+		     -1, -1, NULL, wxT("Highlight fixed points"));
+    toolbar->AddTool(menu_VIEW_SHOW_EXPORTED_PTS, TOOLBAR_BITMAP(wxT("exported-pts")), wxNullBitmap, true,
+		     -1, -1, NULL, wxT("Highlight exported stations"));
     toolbar->AddSeparator();
-    toolbar->AddTool(menu_VIEW_SHOW_LEGS, TOOLBAR_BITMAP("ug-legs"), wxNullBitmap, true,
-		     -1, -1, NULL, "Show underground surveys");
-    toolbar->AddTool(menu_VIEW_SHOW_SURFACE, TOOLBAR_BITMAP("surface-legs"), wxNullBitmap, true,
-		     -1, -1, NULL, "Show surface surveys");
+    toolbar->AddTool(menu_VIEW_SHOW_LEGS, TOOLBAR_BITMAP(wxT("ug-legs")), wxNullBitmap, true,
+		     -1, -1, NULL, wxT("Show underground surveys"));
+    toolbar->AddTool(menu_VIEW_SHOW_SURFACE, TOOLBAR_BITMAP(wxT("surface-legs")), wxNullBitmap, true,
+		     -1, -1, NULL, wxT("Show surface surveys"));
     toolbar->AddSeparator();
 
     toolbar->Realize();
@@ -458,23 +462,23 @@ void MainFrm::CreateSidePanel()
     wxPanel *find_panel = new wxPanel(m_Panel);
     m_Panel->Show(false);
 
-    m_FindBox = new wxTextCtrl(find_panel, -1, "");
+    m_FindBox = new wxTextCtrl(find_panel, -1, wxT(""));
     wxButton *find_button, *hide_button;
-    find_button = new wxButton(find_panel, button_FIND, msg(/*Find*/332));
+    find_button = new wxButton(find_panel, button_FIND, GetMsg(/*Find*/332));
     find_button->SetDefault();
     find_panel->SetDefaultItem(find_button);
-    hide_button = new wxButton(find_panel, button_HIDE, msg(/*Hide*/333));
+    hide_button = new wxButton(find_panel, button_HIDE, GetMsg(/*Hide*/333));
     m_RegexpCheckBox = new wxCheckBox(find_panel, -1,
-				      msg(/*Regular expression*/334));
-    m_Coords = new wxStaticText(find_panel, -1, "");
-    m_StnCoords = new wxStaticText(find_panel, -1, "");
+				      GetMsg(/*Regular expression*/334));
+    m_Coords = new wxStaticText(find_panel, -1, wxT(""));
+    m_StnCoords = new wxStaticText(find_panel, -1, wxT(""));
     //  m_MousePtr = new wxStaticText(find_panel, -1, "Mouse coordinates");
-    m_StnName = new wxStaticText(find_panel, -1, "");
-    m_StnAlt = new wxStaticText(find_panel, -1, "");
-    m_Dist1 = new wxStaticText(find_panel, -1, "");
-    m_Dist2 = new wxStaticText(find_panel, -1, "");
-    m_Dist3 = new wxStaticText(find_panel, -1, "");
-    m_Found = new wxStaticText(find_panel, -1, "");
+    m_StnName = new wxStaticText(find_panel, -1, wxT(""));
+    m_StnAlt = new wxStaticText(find_panel, -1, wxT(""));
+    m_Dist1 = new wxStaticText(find_panel, -1, wxT(""));
+    m_Dist2 = new wxStaticText(find_panel, -1, wxT(""));
+    m_Dist3 = new wxStaticText(find_panel, -1, wxT(""));
+    m_Found = new wxStaticText(find_panel, -1, wxT(""));
 
     wxBoxSizer *find_button_sizer = new wxBoxSizer(wxHORIZONTAL);
     find_button_sizer->Add(m_FindBox, 1, wxALL, 2);
@@ -563,14 +567,14 @@ bool MainFrm::LoadData(const wxString& file, wxString prefix)
 
     // Load the survey data.
 
-    img* survey = img_open_survey(file, prefix.c_str());
+    img* survey = img_open_survey(file.mb_str(wxConvUTF8), prefix.mb_str(wxConvUTF8));
     if (!survey) {
-	wxString m = wxString::Format(msg(img_error()), file.c_str());
+	wxString m = wxString::Format(GetMsg(img_error()), file.c_str());
 	wxGetApp().ReportError(m);
 	return false;
     }
 
-    m_File = survey->filename_opened;
+    m_File = wxString(survey->filename_opened, wxConvUTF8);
 
     m_Tree->DeleteAllItems();
 
@@ -636,7 +640,7 @@ bool MainFrm::LoadData(const wxString& file, wxString prefix)
 
 	    case img_LABEL: {
 		LabelInfo* label = new LabelInfo;
-		label->text = survey->label;
+		label->text = wxString(survey->label, wxConvUTF8);
 		label->x = pt.x;
 		label->y = pt.y;
 		label->z = pt.z;
@@ -675,7 +679,7 @@ bool MainFrm::LoadData(const wxString& file, wxString prefix)
 
 		img_close(survey);
 
-		wxString m = wxString::Format(msg(img_error()), file.c_str());
+		wxString m = wxString::Format(GetMsg(img_error()), file.c_str());
 		wxGetApp().ReportError(m);
 
 		return false;
@@ -687,13 +691,13 @@ bool MainFrm::LoadData(const wxString& file, wxString prefix)
     } while (result != img_STOP);
 
     separator = survey->separator;
-    m_Title = survey->title;
-    m_DateStamp = survey->datestamp;
+    m_Title = wxString(survey->title, wxConvUTF8);
+    m_DateStamp = wxString(survey->datestamp, wxConvUTF8);
     img_close(survey);
 
     // Check we've actually loaded some legs or stations!
     if (m_NumLegs == 0 && m_Labels.empty()) {
-	wxString m = wxString::Format(msg(/*No survey data in 3d file `%s'*/202), file.c_str());
+	wxString m = wxString::Format(GetMsg(/*No survey data in 3d file `%s'*/202), file.c_str());
 	wxGetApp().ReportError(m);
 	return false;
     }
@@ -752,7 +756,7 @@ bool MainFrm::LoadData(const wxString& file, wxString prefix)
 #endif
 
     // Update window title.
-    SetTitle(wxString(APP_NAME" - [") + m_File + wxString("]"));
+    SetTitle(wxString(wxT(APP_NAME" - [")) + m_File + wxT("]"));
 
     return true;
 }
@@ -764,7 +768,7 @@ void MainFrm::FillTree()
 
     // Fill the tree of stations and prefixes.
     stack<wxTreeItemId> previous_ids;
-    wxString current_prefix = "";
+    wxString current_prefix = wxT("");
     wxTreeItemId current_id = treeroot;
 
     list<LabelInfo*>::iterator pos = m_Labels.begin();
@@ -782,7 +786,7 @@ void MainFrm::FillTree()
 	else if (prefix.length() > current_prefix.length() &&
 		 prefix.StartsWith(current_prefix) &&
 		 (prefix[current_prefix.length()] == separator ||
-		  current_prefix == "")) {
+		  current_prefix == wxT(""))) {
 	    // We have, so start as many new branches as required.
 	    int current_prefix_length = current_prefix.length();
 	    current_prefix = prefix;
@@ -795,7 +799,7 @@ void MainFrm::FillTree()
 		next_dot = prefix.Find(separator);
 
 		wxString bit = next_dot == -1 ? prefix : prefix.Left(next_dot);
-		assert(bit != "");
+		assert(bit != wxT(""));
 
 		// Add the current tree ID to the stack.
 		previous_ids.push(current_id);
@@ -812,7 +816,7 @@ void MainFrm::FillTree()
 	    bool ascent_only = (prefix.length() < current_prefix.length() &&
 				current_prefix.StartsWith(prefix) &&
 				(current_prefix[prefix.length()] == separator ||
-				 prefix == ""));
+				 prefix == wxT("")));
 	    if (!ascent_only) {
 		// Find out how much of the current prefix and the new prefix
 		// are the same.
@@ -875,7 +879,7 @@ void MainFrm::FillTree()
 
 	// Now add the leaf.
 	wxString bit = label->GetText().AfterLast(separator);
-	assert(bit != "");
+	assert(bit != wxT(""));
 	wxTreeItemId id = m_Tree->AppendItem(current_id, bit);
 	m_Tree->SetItemData(id, new TreeData(label));
 	label->tree_id = id;
@@ -1045,7 +1049,7 @@ void MainFrm::OpenFile(const wxString& file, wxString survey, bool delay)
 	if (wxIsAbsolutePath(m_File)) {
 	    m_history.AddFileToHistory(m_File);
 	} else {
-	    wxString abs = wxGetCwd() + wxString(FNM_SEP_LEV) + m_File;
+	    wxString abs = wxGetCwd() + wxT(FNM_SEP_LEV) + m_File;
 	    m_history.AddFileToHistory(abs);
 	}
 	wxConfigBase *b = wxConfigBase::Get();
@@ -1089,33 +1093,34 @@ void MainFrm::OpenFile(const wxString& file, wxString survey, bool delay)
 void MainFrm::OnOpen(wxCommandEvent&)
 {
 #ifdef __WXMOTIF__
-    wxFileDialog dlg (this, wxString(msg(/*Select a 3d file to view*/206)), "", "",
-		      "*.3d", wxOPEN);
+    wxFileDialog dlg (this, GetMsg(/*Select a 3d file to view*/206),
+		      wxT(""), wxT(""), wxT("*.3d"), wxOPEN);
 #else
-    wxFileDialog dlg(this, wxString(msg(/*Select a 3d file to view*/206)), "", "",
-		     wxString::Format("%s|*.3d"
+    wxFileDialog dlg(this, wxString(GetMsg(/*Select a 3d file to view*/206)),
+		     wxT(""), wxT(""),
+		     wxString::Format(wxT("%s|*.3d")
 #ifdef FILEDIALOG_MULTIGLOBS
-				      ";*.3D"
+				      wxT(";*.3D")
 #endif
 #ifdef FILEDIALOG_MULTIGLOBS
-				      "|%s|*.plt;*.plf"
+				      wxT("|%s|*.plt;*.plf")
 #ifndef _WIN32
-				      ";*.PLT;*.PLF"
+				      wxT(";*.PLT;*.PLF")
 #endif
 #else
-				      "|%s|*.pl?" // not ideal...
+				      wxT("|%s|*.pl?") // not ideal...
 #endif
-				      "|%s|*.xyz"
+				      wxT("|%s|*.xyz")
 #ifdef FILEDIALOG_MULTIGLOBS
 #ifndef _WIN32
-				      ";*.XYZ"
+				      wxT(";*.XYZ")
 #endif
 #endif
-				      "|%s|%s",
-				      msg(/*Survex 3d files*/207),
-				      msg(/*Compass PLT files*/324),
-				      msg(/*CMAP XYZ files*/325),
-				      msg(/*All files*/208),
+				      wxT("|%s|%s"),
+				      GetMsg(/*Survex 3d files*/207).c_str(),
+				      GetMsg(/*Compass PLT files*/324).c_str(),
+				      GetMsg(/*CMAP XYZ files*/325).c_str(),
+				      GetMsg(/*All files*/208).c_str(),
 				      wxFileSelectorDefaultWildcardStr),
 		     wxOPEN);
 #endif
@@ -1139,16 +1144,16 @@ void MainFrm::OnPageSetup(wxCommandEvent&)
 
 void MainFrm::OnExport(wxCommandEvent&)
 {
-    char *baseleaf = baseleaf_from_fnm(m_File.c_str());
-    wxFileDialog dlg(this, wxString("Export as:"), "",
-		     wxString(baseleaf),
-		     "DXF files|*.dxf|SVG files|*.svg|Sketch files|*.sk|EPS files|*.eps|Compass PLT for use with Carto|*.plt",
+    char *baseleaf = baseleaf_from_fnm(m_File.mb_str(wxConvUTF8));
+    wxFileDialog dlg(this, wxT("Export as:"), wxT(""),
+		     wxString(baseleaf, wxConvUTF8),
+		     wxT("DXF files|*.dxf|SVG files|*.svg|Sketch files|*.sk|EPS files|*.eps|Compass PLT for use with Carto|*.plt"),
 		     wxSAVE|wxOVERWRITE_PROMPT);
     free(baseleaf);
     if (dlg.ShowModal() == wxID_OK) {
 	wxString fnm = dlg.GetPath();
 	if (!m_Gfx->OnExport(fnm, m_Title)) {
-	    wxGetApp().ReportError(wxString::Format("Couldn't write file `%s'", fnm.c_str()));
+	    wxGetApp().ReportError(wxString::Format(wxT("Couldn't write file `%s'"), fnm.c_str()));
 	}
     }
 }
@@ -1186,16 +1191,16 @@ void MainFrm::ClearTreeSelection()
 
 void MainFrm::ClearCoords()
 {
-    m_Coords->SetLabel("");
+    m_Coords->SetLabel(wxT(""));
 }
 
 void MainFrm::SetCoords(Double x, Double y)
 {
     wxString s;
     if (m_Gfx->m_Metric) {
-	s.Printf(msg(/*  %d E, %d N*/338), int(x), int(y));
+	s.Printf(GetMsg(/*  %d E, %d N*/338), int(x), int(y));
     } else {
-	s.Printf(msg(/*  %d E, %d N*/338),
+	s.Printf(GetMsg(/*  %d E, %d N*/338),
 		 int(x / METRES_PER_FOOT), int(y / METRES_PER_FOOT));
     }
     m_Coords->SetLabel(s);
@@ -1205,9 +1210,9 @@ void MainFrm::SetAltitude(Double z)
 {
     wxString s;
     if (m_Gfx->m_Metric) {
-	s.Printf("  %s %dm", msg(/*Altitude*/335), int(z));
+	s.Printf(wxT("  %s %dm"), GetMsg(/*Altitude*/335).c_str(), int(z));
     } else {
-	s.Printf("  %s %dft", msg(/*Altitude*/335), int(z / METRES_PER_FOOT));
+	s.Printf(wxT("  %s %dft"), GetMsg(/*Altitude*/335).c_str(), int(z / METRES_PER_FOOT));
     }
     m_Coords->SetLabel(s);
 }
@@ -1218,11 +1223,11 @@ void MainFrm::ShowInfo(const LabelInfo *label)
 
     wxString str;
     if (m_Gfx->m_Metric) {
-	str.Printf(msg(/*  %d E, %d N*/338),
+	str.Printf(GetMsg(/*  %d E, %d N*/338),
 		   int(label->x + m_Offsets.getX()),
 		   int(label->y + m_Offsets.getY()));
     } else {
-	str.Printf(msg(/*  %d E, %d N*/338),
+	str.Printf(GetMsg(/*  %d E, %d N*/338),
 		   int((label->x + m_Offsets.getX()) / METRES_PER_FOOT),
 		   int((label->y + m_Offsets.getY()) / METRES_PER_FOOT));
     }
@@ -1230,10 +1235,10 @@ void MainFrm::ShowInfo(const LabelInfo *label)
     m_StnName->SetLabel(label->text);
 
     if (m_Gfx->m_Metric) {
-	str.Printf("  %s %dm", msg(/*Altitude*/335),
+	str.Printf(wxT("  %s %dm"), GetMsg(/*Altitude*/335).c_str(),
 		   int(label->z + m_Offsets.getZ()));
     } else {
-	str.Printf("  %s %dft", msg(/*Altitude*/335),
+	str.Printf(wxT("  %s %dft"), GetMsg(/*Altitude*/335).c_str(),
 		   int((label->z + m_Offsets.getZ()) / METRES_PER_FOOT));
     }
     m_StnAlt->SetLabel(str);
@@ -1264,31 +1269,31 @@ void MainFrm::ShowInfo(const LabelInfo *label)
 	    Double brg = deg(atan2(dx, dy));
 	    if (brg < 0) brg += 360;
 
-	    str.Printf(msg(/*From %s*/339), label2->text.c_str());
+	    str.Printf(GetMsg(/*From %s*/339), label2->text.c_str());
 	    m_Dist1->SetLabel(str);
 	    if (m_Gfx->m_Metric) {
-		str.Printf(msg(/*  H %d%s, V %d%s*/340),
+		str.Printf(GetMsg(/*  H %d%s, V %d%s*/340),
 			   int(d_horiz), "m",
 			   int(dz), "m");
 	    } else {
-		str.Printf(msg(/*  H %d%s, V %d%s*/340),
-			   int(d_horiz / METRES_PER_FOOT), "ft",
-			   int(dz / METRES_PER_FOOT), "ft");
+		str.Printf(GetMsg(/*  H %d%s, V %d%s*/340),
+			   int(d_horiz / METRES_PER_FOOT), wxT("ft"),
+			   int(dz / METRES_PER_FOOT), wxT("ft"));
 	    }
 	    m_Dist2->SetLabel(str);
 	    wxString brg_unit;
 	    if (m_Gfx->m_Degrees) {
-		brg_unit = msg(/*&deg;*/344);
+		brg_unit = GetMsg(/*&deg;*/344);
 	    } else {
 		brg *= 400.0 / 360.0;
-		brg_unit = msg(/*grad*/345);
+		brg_unit = GetMsg(/*grad*/345);
 	    }
 	    if (m_Gfx->m_Metric) {
-		str.Printf(msg(/*  Dist %d%s, Brg %03d%s*/341),
-			   int(dr), "m", int(brg), brg_unit.c_str());
+		str.Printf(GetMsg(/*  Dist %d%s, Brg %03d%s*/341),
+			   int(dr), wxT("m"), int(brg), brg_unit.c_str());
 	    } else {
-		str.Printf(msg(/*  Dist %d%s, Brg %03d%s*/341),
-			   int(dr / METRES_PER_FOOT), "ft", int(brg),
+		str.Printf(GetMsg(/*  Dist %d%s, Brg %03d%s*/341),
+			   int(dr / METRES_PER_FOOT), wxT("ft"), int(brg),
 			   brg_unit.c_str());
 	    }
 	    m_Dist3->SetLabel(str);
@@ -1307,13 +1312,13 @@ void MainFrm::DisplayTreeInfo(const wxTreeItemData* item)
 	ShowInfo(l);
 	m_Gfx->SetHere(l->x, l->y, l->z);
     } else {
-	m_StnName->SetLabel("");
-	m_StnCoords->SetLabel("");
-	m_StnAlt->SetLabel("");
+	m_StnName->SetLabel(wxT(""));
+	m_StnCoords->SetLabel(wxT(""));
+	m_StnAlt->SetLabel(wxT(""));
 	m_Gfx->SetHere();
-	m_Dist1->SetLabel("");
-	m_Dist2->SetLabel("");
-	m_Dist3->SetLabel("");
+	m_Dist1->SetLabel(wxT(""));
+	m_Dist2->SetLabel(wxT(""));
+	m_Dist3->SetLabel(wxT(""));
 	m_Gfx->SetHere();
     }
 }
@@ -1330,9 +1335,9 @@ void MainFrm::TreeItemSelected(wxTreeItemData* item)
 	m_Gfx->SetThere();
     }
 
-    m_Dist1->SetLabel("");
-    m_Dist2->SetLabel("");
-    m_Dist3->SetLabel("");
+    m_Dist1->SetLabel(wxT(""));
+    m_Dist2->SetLabel(wxT(""));
+    m_Dist3->SetLabel(wxT(""));
 }
 
 void MainFrm::OnFind(wxCommandEvent&)
@@ -1357,15 +1362,15 @@ void MainFrm::OnFind(wxCommandEvent&)
 	   // ^ only special at start; $ at end.  But this is simpler...
 	   switch (ch) {
 	    case '^': case '$': case '.': case '[': case '\\':
-	      pat += '\\';
+	      pat += wxT('\\');
 	      pat += ch;
 	      break;
 	    case '*':
-	      pat += ".*";
+	      pat += wxT(".*");
               substring = false;
 	      break;
 	    case '?':
-	      pat += '.';
+	      pat += wxT('.');
               substring = false;
 	      break;
 	    default:
@@ -1381,7 +1386,7 @@ void MainFrm::OnFind(wxCommandEvent&)
 	   // ^ only special at start; $ at end.  But this is simpler...
 	   switch (ch) {
 	    case '^': case '$': case '*': case '.': case '[': case '\\':
-	      pat += '\\';
+	      pat += wxT('\\');
 	   }
 	   pat += ch;
 	}
@@ -1391,7 +1396,7 @@ void MainFrm::OnFind(wxCommandEvent&)
 
     if (!substring) {
 	// FIXME "0u" required to avoid compilation error with g++-3.0
-	if (pattern.empty() || pattern[0u] != '^') pattern = '^' + pattern;
+	if (pattern.empty() || pattern[0u] != '^') pattern = wxT('^') + pattern;
         // FIXME: this fails to cope with "\$" at the end of pattern...
 	if (pattern[pattern.size() - 1] != '$') pattern += '$';
     }
@@ -1399,7 +1404,7 @@ void MainFrm::OnFind(wxCommandEvent&)
     wxRegEx regex;
     if (!regex.Compile(pattern, re_flags)) {
 	wxString m;
-	m.Printf(msg(/*Invalid regular expression: %s*/404), pattern.c_str());
+	m.Printf(GetMsg(/*Invalid regular expression: %s*/404), pattern.c_str());
 	wxGetApp().ReportError(m);
 	return;
     }
@@ -1418,7 +1423,7 @@ void MainFrm::OnFind(wxCommandEvent&)
 	}
     }
 
-    m_Found->SetLabel(wxString::Format(msg(/*%d found*/331), found));
+    m_Found->SetLabel(wxString::Format(GetMsg(/*%d found*/331), found));
 #ifdef _WIN32
     m_Found->Refresh(); // FIXME
 #endif
@@ -1428,7 +1433,7 @@ void MainFrm::OnFind(wxCommandEvent&)
 
 #if 0
     if (!found) {
-	wxGetApp().ReportError(msg(/*No matches were found.*/328));
+	wxGetApp().ReportError(GetMsg(/*No matches were found.*/328));
     }
 #endif
 
@@ -1438,7 +1443,7 @@ void MainFrm::OnFind(wxCommandEvent&)
 void MainFrm::OnHide(wxCommandEvent&)
 {
     // Hide any search result highlights.
-    m_Found->SetLabel("");
+    m_Found->SetLabel(wxT(""));
     list<LabelInfo*>::iterator pos = m_Labels.begin();
     while (pos != m_Labels.end()) {
 	LabelInfo* label = *pos++;
@@ -1452,13 +1457,13 @@ void MainFrm::SetMouseOverStation(LabelInfo* label)
     if (label) {
 	ShowInfo(label);
     } else {
-	m_StnName->SetLabel("");
-	m_StnCoords->SetLabel("");
-	m_StnAlt->SetLabel("");
+	m_StnName->SetLabel(wxT(""));
+	m_StnCoords->SetLabel(wxT(""));
+	m_StnAlt->SetLabel(wxT(""));
 	m_Gfx->SetHere();
-	m_Dist1->SetLabel("");
-	m_Dist2->SetLabel("");
-	m_Dist3->SetLabel("");
+	m_Dist1->SetLabel(wxT(""));
+	m_Dist2->SetLabel(wxT(""));
+	m_Dist3->SetLabel(wxT(""));
     }
 }
 
diff --git a/src/mainfrm.h b/src/mainfrm.h
index f768362..22bec38 100644
--- a/src/mainfrm.h
+++ b/src/mainfrm.h
@@ -5,6 +5,7 @@
 //
 //  Copyright (C) 2000-2001, Mark R. Shinwell.
 //  Copyright (C) 2001-2003,2004,2005 Olly Betts
+//  Copyright (C) 2008 Guillem Jover
 //
 //  This program is free software; you can redistribute it and/or modify
 //  it under the terms of the GNU General Public License as published by
@@ -195,7 +196,7 @@ private:
 
     void FillTree();
     void ClearPointLists();
-    bool LoadData(const wxString& file, wxString prefix = "");
+    bool LoadData(const wxString& file, wxString prefix = wxT(""));
     void SortIntoDepthBands(list<PointInfo*>& points);
     void IntersectLineWithPlane(Double x0, Double y0, Double z0,
 				Double x1, Double y1, Double z1,
@@ -205,7 +206,10 @@ private:
     void CentreDataset(Double xmin, Double ymin, Double zmin);
 
     wxString GetTabMsg(int key) {
-	wxString x(msg(key)); x.Replace("##", "\t"); x.Replace("@", "&"); return x;
+	wxString x(msg(key), wxConvUTF8);
+	x.Replace(wxT("##"), wxT("\t"));
+	x.Replace(wxT("@"), wxT("&"));
+	return x;
     }
 
     void InitialisePensAndBrushes();
@@ -218,7 +222,7 @@ public:
     ~MainFrm();
 
     void OnMRUFile(wxCommandEvent& event);
-    void OpenFile(const wxString& file, wxString survey = "", bool delay = false);
+    void OpenFile(const wxString& file, wxString survey = wxT(""), bool delay = false);
     void OnFileOpenTerrainUpdate(wxUpdateUIEvent& event);
 
     void OnFind(wxCommandEvent& event);
diff --git a/src/msgwx.h b/src/msgwx.h
new file mode 100644
index 0000000..ca27b4e
--- /dev/null
+++ b/src/msgwx.h
@@ -0,0 +1,32 @@
+/* msgwx.h
+ * wxWindows layer for msg()
+ * Copyright (C) 2008 Guillem Jover
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef MSGWX_H
+#define MSGWX_H
+
+#include "wx.h"
+#include "message.h"
+
+inline const wxString GetMsg(int index)
+{
+    return wxString(msg(index), wxConvUTF8);
+}
+
+#endif
+
diff --git a/src/printwx.cc b/src/printwx.cc
index 1aa4e59..b0b3358 100644
--- a/src/printwx.cc
+++ b/src/printwx.cc
@@ -2,6 +2,7 @@
 /* Device dependent part of Survex wxWindows driver */
 /* Copyright (C) 1993-2003,2004,2005 Olly Betts
  * Copyright (C) 2001,2004 Philip Underwood
+ * Copyright (C) 2008 Guillem Jover
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -46,6 +47,7 @@
 #include "aven.h"
 #include "avenprcore.h"
 #include "mainfrm.h"
+#include "msgwx.h"
 #include "printwx.h"
 
 class svxPrintout : public wxPrintout {
@@ -112,19 +114,19 @@ BEGIN_EVENT_TABLE(svxPrintDlg, wxDialog)
 END_EVENT_TABLE()
 
 static wxString scales[] = {
-    "",
-    "25",
-    "50",
-    "100",
-    "250",
-    "500",
-    "1000",
-    "2500",
-    "5000",
-    "10000",
-    "25000",
-    "50000",
-    "100000"
+    wxT(""),
+    wxT("25"),
+    wxT("50"),
+    wxT("100"),
+    wxT("250"),
+    wxT("500"),
+    wxT("1000"),
+    wxT("2500"),
+    wxT("5000"),
+    wxT("10000"),
+    wxT("25000"),
+    wxT("50000"),
+    wxT("100000")
 };
 
 // there are three jobs to do here...
@@ -133,7 +135,7 @@ svxPrintDlg::svxPrintDlg(MainFrm* mainfrm_, const wxString & filename,
 			 const wxString & title, const wxString & datestamp,
 			 double angle, double tilt_angle,
 			 bool labels, bool crosses, bool legs, bool surf)
-	: wxDialog(mainfrm_, -1, wxString(msg(/*Print*/399))),
+	: wxDialog(mainfrm_, -1, GetMsg(/*Print*/399)),
 	  m_layout(wxGetApp().GetPageSetupDialogData()),
 	  m_File(filename), mainfrm(mainfrm_)
 {
@@ -141,11 +143,11 @@ svxPrintDlg::svxPrintDlg(MainFrm* mainfrm_, const wxString & filename,
     m_layout.Crosses = crosses;
     m_layout.Shots = legs;
     m_layout.Surface = surf;
-    m_layout.datestamp = osstrdup(datestamp.c_str());
+    m_layout.datestamp = osstrdup(datestamp.mb_str(wxConvUTF8));
     m_layout.rot = int(angle + .001);
     if (title.length() > 11 &&
-	title.substr(title.length() - 11) == " (extended)") {
-	m_layout.title = osstrdup(title.substr(0, title.length() - 11).c_str());
+	title.substr(title.length() - 11) == wxT(" (extended)")) {
+	m_layout.title = osstrdup(wxString(title.substr(0, title.length() - 11)).mb_str(wxConvUTF8));
 	m_layout.view = layout::EXTELEV;
 	if (m_layout.rot != 0 && m_layout.rot != 180) m_layout.rot = 0;
 	m_layout.tilt = 0;
@@ -153,7 +155,7 @@ svxPrintDlg::svxPrintDlg(MainFrm* mainfrm_, const wxString & filename,
 	// FIXME rot and tilt shouldn't be integers, but for now add a small
 	// fraction before forcing to int as otherwise plan view ends up being
 	// 89 degrees!
-	m_layout.title = osstrdup(title.c_str());
+	m_layout.title = osstrdup(title.mb_str(wxConvUTF8));
 	m_layout.tilt = int(tilt_angle + .001);
 	if (m_layout.tilt == 90) {
 	    m_layout.view = layout::PLAN;
@@ -167,14 +169,14 @@ svxPrintDlg::svxPrintDlg(MainFrm* mainfrm_, const wxString & filename,
     /* setup our print dialog*/
     wxBoxSizer* v1 = new wxBoxSizer(wxVERTICAL);
     wxBoxSizer* h1 = new wxBoxSizer(wxHORIZONTAL); // holds controls
-    wxBoxSizer* v2 = new wxStaticBoxSizer(new wxStaticBox(this, -1, msg(/*View*/255)), wxVERTICAL);
-    wxBoxSizer* v3 = new wxStaticBoxSizer(new wxStaticBox(this, -1, msg(/*Elements*/256)), wxVERTICAL);
+    wxBoxSizer* v2 = new wxStaticBoxSizer(new wxStaticBox(this, -1, GetMsg(/*View*/255)), wxVERTICAL);
+    wxBoxSizer* v3 = new wxStaticBoxSizer(new wxStaticBox(this, -1, GetMsg(/*Elements*/256)), wxVERTICAL);
     wxBoxSizer* h2 = new wxBoxSizer(wxHORIZONTAL); // holds buttons
 
     { // this isn't the "too wide" bit...
     wxStaticText* label;
-    label = new wxStaticText(this, -1, wxString(msg(/*Scale*/154)) + " 1:");
-    if (scales[0].empty()) scales[0].assign(msg(/*One page*/258));
+    label = new wxStaticText(this, -1, GetMsg(/*Scale*/154) + wxT(" 1:"));
+    if (scales[0].empty()) scales[0].assign(GetMsg(/*One page*/258));
     m_scale = new wxComboBox(this, svx_SCALE, scales[0], wxDefaultPosition,
 			     wxDefaultSize, sizeof(scales) / sizeof(scales[0]),
 			     scales);
@@ -188,18 +190,18 @@ svxPrintDlg::svxPrintDlg(MainFrm* mainfrm_, const wxString & filename,
     // Make the dummy string wider than any sane value and use that to
     // fix the width of the control so the sizers allow space for bigger
     // page layouts.
-    m_printSize = new wxStaticText(this, -1, wxString::Format(msg(/*%d pages (%dx%d)*/257), 9604, 98, 98));
+    m_printSize = new wxStaticText(this, -1, wxString::Format(GetMsg(/*%d pages (%dx%d)*/257), 9604, 98, 98));
     v2->Add(m_printSize, 0, wxALIGN_LEFT|wxALL, 5);
 
     if (m_layout.view != layout::EXTELEV) {
 	wxFlexGridSizer* anglebox = new wxFlexGridSizer(2);
 	wxStaticText * brg_label, * tilt_label;
-	brg_label = new wxStaticText(this, -1, msg(/*Bearing*/259));
+	brg_label = new wxStaticText(this, -1, GetMsg(/*Bearing*/259));
 	anglebox->Add(brg_label, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxALL, 5);
 	m_bearing = new wxSpinCtrl(this, svx_BEARING);
 	m_bearing->SetRange(0, 359);
 	anglebox->Add(m_bearing, 0, wxALIGN_CENTER|wxALL, 5);
-	tilt_label = new wxStaticText(this, -1, msg(/*Tilt angle*/263));
+	tilt_label = new wxStaticText(this, -1, GetMsg(/*Tilt angle*/263));
 	anglebox->Add(tilt_label, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxALL, 5);
 	m_tilt = new wxSpinCtrl(this,svx_TILT);
 	m_tilt->SetRange(-90, 90);
@@ -208,9 +210,9 @@ svxPrintDlg::svxPrintDlg(MainFrm* mainfrm_, const wxString & filename,
 	v2->Add(anglebox, 0, wxALIGN_LEFT|wxALL, 0);
 
 	wxBoxSizer * planelevsizer = new wxBoxSizer(wxHORIZONTAL);
-	planelevsizer->Add(new wxButton(this, svx_PLAN, "Plan"),
+	planelevsizer->Add(new wxButton(this, svx_PLAN, wxT("Plan")),
 			   0, wxALIGN_CENTRE_VERTICAL|wxALL, 5);
-	planelevsizer->Add(new wxButton(this, svx_ELEV, "Elevation"),
+	planelevsizer->Add(new wxButton(this, svx_ELEV, wxT("Elevation")),
 			   0, wxALIGN_CENTRE_VERTICAL|wxALL, 5);
 
 	v2->Add(planelevsizer, 0, wxALIGN_LEFT|wxALL, 5);
@@ -218,19 +220,19 @@ svxPrintDlg::svxPrintDlg(MainFrm* mainfrm_, const wxString & filename,
 
     h1->Add(v2, 0, wxALIGN_LEFT|wxALL, 5);
 
-    m_legs = new wxCheckBox(this, svx_LEGS, msg(/*Underground Survey Legs*/262));
+    m_legs = new wxCheckBox(this, svx_LEGS, GetMsg(/*Underground Survey Legs*/262));
     v3->Add(m_legs, 0, wxALIGN_LEFT|wxALL, 2);
-    m_surface = new wxCheckBox(this, svx_SCALEBAR, msg(/*Sur&amp;face Survey Legs*/403));
+    m_surface = new wxCheckBox(this, svx_SCALEBAR, GetMsg(/*Sur&amp;face Survey Legs*/403));
     v3->Add(m_surface, 0, wxALIGN_LEFT|wxALL, 2);
-    m_stations = new wxCheckBox(this, svx_STATIONS, msg(/*Crosses*/261));
+    m_stations = new wxCheckBox(this, svx_STATIONS, GetMsg(/*Crosses*/261));
     v3->Add(m_stations, 0, wxALIGN_LEFT|wxALL, 2);
-    m_names = new wxCheckBox(this, svx_NAMES, msg(/*Station Names*/260));
+    m_names = new wxCheckBox(this, svx_NAMES, GetMsg(/*Station Names*/260));
     v3->Add(m_names, 0, wxALIGN_LEFT|wxALL, 2);
-    m_borders = new wxCheckBox(this, svx_BORDERS, msg(/*Page Borders*/264));
+    m_borders = new wxCheckBox(this, svx_BORDERS, GetMsg(/*Page Borders*/264));
     v3->Add(m_borders, 0, wxALIGN_LEFT|wxALL, 2);
-//    m_blanks = new wxCheckBox(this, svx_BLANKS, msg(/*Blank Pages*/266));
+//    m_blanks = new wxCheckBox(this, svx_BLANKS, GetMsg(/*Blank Pages*/266));
 //    v3->Add(m_blanks, 0, wxALIGN_LEFT|wxALL, 2);
-    m_infoBox = new wxCheckBox(this, svx_INFOBOX, msg(/*Info Box*/265));
+    m_infoBox = new wxCheckBox(this, svx_INFOBOX, GetMsg(/*Info Box*/265));
     v3->Add(m_infoBox, 0, wxALIGN_LEFT|wxALL, 2);
 
     h1->Add(v3, 0, wxALIGN_LEFT|wxALL, 5);
@@ -238,11 +240,11 @@ svxPrintDlg::svxPrintDlg(MainFrm* mainfrm_, const wxString & filename,
     v1->Add(h1, 0, wxALIGN_LEFT|wxALL, 5);
 
     wxButton * but;
-    but = new wxButton(this, wxID_CANCEL, msg(/*&Cancel*/402));
+    but = new wxButton(this, wxID_CANCEL, GetMsg(/*&Cancel*/402));
     h2->Add(but, 0, wxALIGN_RIGHT|wxALL, 5);
-    but = new wxButton(this, svx_PREVIEW, msg(/*Pre&view*/401));
+    but = new wxButton(this, svx_PREVIEW, GetMsg(/*Pre&view*/401));
     h2->Add(but, 0, wxALIGN_RIGHT|wxALL, 5);
-    but = new wxButton(this, svx_PRINT, msg(/*&Print*/400));
+    but = new wxButton(this, svx_PRINT, GetMsg(/*&Print*/400));
     but->SetDefault();
     h2->Add(but, 0, wxALIGN_RIGHT|wxALL, 5);
     v1->Add(h2, 0, wxALIGN_RIGHT|wxALL, 5);
@@ -283,7 +285,7 @@ svxPrintDlg::OnPreview(wxCommandEvent&) {
     pv = new wxPrintPreview(new svxPrintout(mainfrm, &m_layout, psdd, m_File),
 			    new svxPrintout(mainfrm, &m_layout, psdd, m_File),
 			    &pd);
-    wxPreviewFrame *frame = new wxPreviewFrame(pv, mainfrm, msg(/*Print Preview*/398));
+    wxPreviewFrame *frame = new wxPreviewFrame(pv, mainfrm, GetMsg(/*Print Preview*/398));
     frame->Initialize();
 
     // Size preview frame so that all of the controlbar and canvas can be seen
@@ -347,7 +349,7 @@ svxPrintDlg::SomethingChanged() {
     RecalcBounds();
     if (m_layout.xMax >= m_layout.xMin) {
 	m_layout.pages_required();
-	m_printSize->SetLabel(wxString::Format(msg(/*%d pages (%dx%d)*/257), m_layout.pages, m_layout.pagesX, m_layout.pagesY));
+	m_printSize->SetLabel(wxString::Format(GetMsg(/*%d pages (%dx%d)*/257), m_layout.pages, m_layout.pagesX, m_layout.pagesY));
     }
 }
 
@@ -378,7 +380,7 @@ svxPrintDlg::LayoutToUI(){
 	temp << m_layout.Scale;
 	m_scale->SetValue(temp);
     } else {
-	if (scales[0].empty()) scales[0].assign(msg(/*One page*/258));
+	if (scales[0].empty()) scales[0].assign(GetMsg(/*One page*/258));
 	m_scale->SetValue(scales[0]);
     }
 }
@@ -471,7 +473,7 @@ static int fontsize, fontsize_labels;
 
 /* FIXME: allow the font to be set */
 
-static const char *fontname = "Arial", *fontname_labels = "Arial";
+static const wxString fontname = wxT("Arial"), fontname_labels = wxT("Arial");
 
 // wx <-> prcore (calls to print_page etc...)
 svxPrintout::svxPrintout(MainFrm *mainfrm_, layout *l, wxPageSetupDialogData *data,
@@ -999,7 +1001,7 @@ svxPrintout::OnPrintPage(int pageNum) {
 		if (l->Labels) {
 		    SetColour(PR_COLOUR_LABELS);
 		    MoveTo(xnew, ynew);
-		    WriteString((*label)->GetText());
+		    WriteString((*label)->GetText().mb_str(wxConvUTF8));
 		}
 	    }
 	    ++label;
@@ -1250,15 +1252,16 @@ svxPrintout::SetColour(int colourcode)
 }
 
 void
-svxPrintout::WriteString(const char *s)
+svxPrintout::WriteString(const char *cs)
 {
+    wxString s(cs, wxConvUTF8);
     double xsc, ysc;
     pdc->GetUserScale(&xsc, &ysc);
     pdc->SetUserScale(xsc * font_scaling_x, ysc * font_scaling_y);
     pdc->SetFont(*current_font);
     int w, h;
     if (cur_pass != -1) {
-	pdc->GetTextExtent("My", &w, &h);
+	pdc->GetTextExtent(wxT("My"), &w, &h);
 	pdc->DrawText(s,
 		      long(x_t / font_scaling_x),
 		      long(y_t / font_scaling_y) - h);
-- 
1.5.3.8

