And so says Reed Hedges on 05/09/05 09:44...
> Has anyone else been hacking on Terangreal to build in unicode mode?
actually, I have (see the thread "can't compile ter'angreal from cvs").
With help from Peter and a lot of back-bending over wx documentation,
this is what I came up with.  I didn't submit a patch earlier because
it's now segfaulting to me - but vostest segfaults identically, so it's
probably not wxRelated().

best,
                                               Lalo Martins
--
      So many of our dreams at first seem impossible,
       then they seem improbable, and then, when we
       summon the will, they soon become inevitable.
--
http://www.exoweb.net/                  mailto:[EMAIL PROTECTED]
GNU: never give up freedom                 http://www.gnu.org/
? +build
? Makefile.in
? aclocal.m4
? autom4te.cache
? config.guess
? config.sub
? configure
? depcomp
? install-sh
? ltmain.sh
? missing
? unicode.diff
? vos-browser-config.h.in
? apps/Makefile.in
? apps/terangreal/Makefile.in
Index: apps/terangreal/ter_mainframe.cc
===================================================================
RCS file: /home/cvsroot/vos-browser/apps/terangreal/ter_mainframe.cc,v
retrieving revision 1.8
diff -u -r1.8 ter_mainframe.cc
--- apps/terangreal/ter_mainframe.cc	13 Aug 2005 21:00:41 -0000	1.8
+++ apps/terangreal/ter_mainframe.cc	5 Sep 2005 02:36:23 -0000
@@ -115,8 +115,8 @@
     mb->Append(winmenu, wxT("Windows"));
 
     wxMenu* helpmenu = new wxMenu();
-    helpmenu->Append(wxID_ABOUT, "About...");
-    helpmenu->Append(wxID_HELP, "Help...");
+    helpmenu->Append(wxID_ABOUT, wxT("About..."));
+    helpmenu->Append(wxID_HELP, wxT("Help..."));
     mb->Append(helpmenu, wxT("Help"));
 
     SetMenuBar(mb);
@@ -124,7 +124,7 @@
 
 void TerWxMainFrame::constructHelp()
 {
-    helpdialog = new wxDialog(0 , -1, "wxTer'Angreal Keys",
+    helpdialog = new wxDialog(0 , -1, wxT("wxTer'Angreal Keys"),
                             wxDefaultPosition, wxSize(520, 220));
     int w, h;
     helpdialog->GetClientSize(&w, &h);
@@ -147,7 +147,7 @@
 
 void TerWxMainFrame::constructAbout()
 {
-    aboutdialog = new wxDialog(0 , -1, "About wxTer'Angreal",
+    aboutdialog = new wxDialog(0 , -1, wxT("About wxTer'Angreal"),
                                wxDefaultPosition, wxSize(500, 200));
     int w, h;
     aboutdialog->GetClientSize(&w, &h);
@@ -580,7 +580,7 @@
 
 void TerWxMainFrame::setStatus(const std::string& s)
 {
-    status->SetLabel(s.c_str());
+    status->SetLabel(wxString(s.c_str(), *wxConvCurrent));
 }
 
 void TerWxMainFrame::warpAvatarHome(wxCommandEvent&)
Index: apps/terangreal/ter_prefs.cc
===================================================================
RCS file: /home/cvsroot/vos-browser/apps/terangreal/ter_prefs.cc,v
retrieving revision 1.2
diff -u -r1.2 ter_prefs.cc
--- apps/terangreal/ter_prefs.cc	9 Mar 2005 08:13:24 -0000	1.2
+++ apps/terangreal/ter_prefs.cc	5 Sep 2005 02:36:23 -0000
@@ -83,16 +83,16 @@
 {
     try {
         avatar.assign(ta, true);
-        nickentry->SetValue(avatar->getNick().c_str());
+        nickentry->SetValue(wxString(avatar->getNick().c_str(), *wxConvCurrent));
 
         double x, y, z, r;
 
         avatar->getObject3D()->getOrientationHT(x, y, z, r);
 
-        rotx->SetValue(wxString::Format("%f", x));
-        roty->SetValue(wxString::Format("%f", y));
-        rotz->SetValue(wxString::Format("%f", z));
-        rotr->SetValue(wxString::Format("%f", r));
+        rotx->SetValue(wxString::Format(wxT("%f"), x));
+	roty->SetValue(wxString::Format(wxT("%f"), y));
+	rotz->SetValue(wxString::Format(wxT("%f"), z));
+	rotr->SetValue(wxString::Format(wxT("%f"), r));
     } catch(std::runtime_error) {
     }
 }
@@ -105,57 +105,56 @@
 void TerPrefs::setNick(wxCommandEvent&)
 {
     try {
-#if wxUSE_UNICODE
-        avatar->setNick(nickentry->GetValue().mb_str().data());
-#else
         avatar->setNick(nickentry->GetValue().mb_str());
-#endif
     } catch(std::runtime_error e) {
         LOG("terprefs", 3, "Exception setting nick: " << e.what());
-        wxMessageBox(e.what(), wxT(""), wxICON_EXCLAMATION, this);
+        wxMessageBox(wxString(e.what(), *wxConvCurrent),
+		     wxT(""), wxICON_EXCLAMATION, this);
     }
 }
 
 void TerPrefs::setAvatarModel(wxCommandEvent&)
 {
-    wxString sel = wxFileSelector("Please select an avatar to load", "", "",
-                                  "",
-                                  "Quake MD2 (*.md2)|*.md2|3D Studio (*.3ds)|*.3ds",
+    wxString sel = wxFileSelector(wxT("Please select an avatar to load"),
+				  wxT(""), wxT(""), wxT(""),
+                                  wxT("Quake MD2 (*.md2)|*.md2|3D Studio (*.3ds)|*.3ds"),
                                   wxOPEN | wxFILE_MUST_EXIST);
     if(!sel.empty()) {
         try {
             vRef<A3DL::Model> m = meta_cast<A3DL::Model>(avatar->getObject3D());
-            m->setModelToFile(sel.c_str());
+            m->setModelToFile(sel.mb_str());
         } catch(std::runtime_error& e) {
             LOG("terprefs", 3, "Exception setting avatar model: " << e.what());
-            wxMessageBox(e.what(), wxT(""), wxICON_EXCLAMATION, this);
+            wxMessageBox(wxString(e.what(), *wxConvCurrent),
+			 wxT(""), wxICON_EXCLAMATION, this);
         }
     }
 }
 
 void TerPrefs::setAvatarSkin(wxCommandEvent&)
 {
-    wxString sel = wxFileSelector("Please select a skin to load", "", "",
-                                  "",
-                                  "GIF (*.gif)|*.gif|PNG (*.png)|*.png|JPG (*.jpg)|*.jpg|JPEG (*.jpeg)|*.jpeg",
+    wxString sel = wxFileSelector(wxT("Please select a skin to load"),
+				  wxT(""), wxT(""), wxT(""),
+				  wxT("GIF (*.gif)|*.gif|PNG (*.png)|*.png|JPG (*.jpg)|*.jpg|JPEG (*.jpeg)|*.jpeg"),
                                   wxOPEN | wxFILE_MUST_EXIST);
     if(!sel.empty()) {
         try {
             A3DL::TextureIterator ti = avatar->getObject3D()->getMaterial()->getTextureLayers();
-            (*ti)->setImageToFile(sel.c_str(), "");
+            (*ti)->setImageToFile(sel.mb_str(), "");
         } catch(std::runtime_error& e) {
             LOG("terprefs", 3, "Exception setting avatar skin: " << e.what());
-            wxMessageBox(e.what(), wxT(""), wxICON_EXCLAMATION, this);
+            wxMessageBox(wxString(e.what(), *wxConvCurrent),
+			 wxT(""), wxICON_EXCLAMATION, this);
         }
     }
 }
 
 void TerPrefs::setHardOrientation(wxCommandEvent&)
 {
-    avatar->getObject3D()->setOrientationHT(atof(rotx->GetValue().c_str()),
-                                            atof(roty->GetValue().c_str()),
-                                            atof(rotz->GetValue().c_str()),
-                                            atof(rotr->GetValue().c_str()));
+    avatar->getObject3D()->setOrientationHT(atof(rotx->GetValue().mb_str()),
+                                            atof(roty->GetValue().mb_str()),
+                                            atof(rotz->GetValue().mb_str()),
+                                            atof(rotr->GetValue().mb_str()));
 
 }
 
@@ -164,19 +163,15 @@
     double x, y, z, r;
     avatar->getObject3D()->getOrientationHT(x, y, z, r);
 
-    if(x != atof(rotx->GetValue().c_str())
-       || y != atof(roty->GetValue().c_str())
-       || z != atof(rotz->GetValue().c_str())
-       || r != atof(rotr->GetValue().c_str()))
+    if(x != atof(rotx->GetValue().mb_str())
+       || y != atof(roty->GetValue().mb_str())
+       || z != atof(rotz->GetValue().mb_str())
+       || r != atof(rotr->GetValue().mb_str()))
     {
         setHardOrientation(e);
     }
 
-#if wxUSE_UNICODE
-    if(avatar->getNick() != std::string(nickentry->GetValue().mb_str().data()))
-#else
     if(avatar->getNick() != std::string(nickentry->GetValue().mb_str()))
-#endif
     {
         setNick(e);
     }
Index: apps/terangreal/ter_progmeter.hh
===================================================================
RCS file: /home/cvsroot/vos-browser/apps/terangreal/ter_progmeter.hh,v
retrieving revision 1.1
diff -u -r1.1 ter_progmeter.hh
--- apps/terangreal/ter_progmeter.hh	11 Jun 2005 22:13:48 -0000	1.1
+++ apps/terangreal/ter_progmeter.hh	5 Sep 2005 02:36:23 -0000
@@ -19,7 +19,7 @@
                        const wxSize& size = wxDefaultSize,
                        long style = wxGA_HORIZONTAL,
                        const wxValidator& validator = wxDefaultValidator,
-                       const wxString& name = "gauge");
+                       const wxString& name = wxT("gauge"));
 
     ~TerWxProgressMeter();
 
Index: apps/terangreal/ter_tabentry.cc
===================================================================
RCS file: /home/cvsroot/vos-browser/apps/terangreal/ter_tabentry.cc,v
retrieving revision 1.1
diff -u -r1.1 ter_tabentry.cc
--- apps/terangreal/ter_tabentry.cc	28 Feb 2005 05:22:17 -0000	1.1
+++ apps/terangreal/ter_tabentry.cc	5 Sep 2005 02:36:24 -0000
@@ -105,7 +105,7 @@
 void TabEntry::onChatEnter(wxCommandEvent&)
 {
     try {
-        avatar->sayToChannel(entrybox->GetValue().c_str());
+	avatar->sayToChannel(entrybox->GetValue().mb_str());
     } catch(std::runtime_error& e) {
         LOG("tabentry", 1, "whoops " << e.what());
         wxMessageBox(wxT("Error speaking to channel"),
_______________________________________________
vos-d mailing list
vos-d@interreality.org
http://www.interreality.org/cgi-bin/mailman/listinfo/vos-d

Reply via email to