Re: [vos-d] Re: Terangreal and Unicode?

2005-09-06 Thread Reed Hedges
Lalo Martins wrote:
 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.  

  void TerWxMainFrame::setStatus(const std::string s)
  {
 -status-SetLabel(s.c_str());
 +status-SetLabel(wxString(s.c_str(), *wxConvCurrent));
...
 -nickentry-SetValue(avatar-getNick().c_str());
 +nickentry-SetValue(wxString(avatar-getNick().c_str(),
*wxConvCurrent));


Why use wxConvCurrent instead of wxConvUTF8?  I got the impression from
the wx docs that wxConvCurrent depends on the (GUI) platform, so on a
unicode platform you'd be telling it your strings from VOS were unicode,
when they aren't.  I only read the wx docs with a normal depth, no
backwards bending, maybe I am wrong :)

...

 +avatar-getObject3D()-setOrientationHT(atof(rotx-GetValue().mb_str()),
 +atof(roty-GetValue().mb_str()),
 +atof(rotz-GetValue().mb_str()),
 +atof(rotr-GetValue().mb_str()));

I think these ought to be .mb_str(wxConvUTF8()) ?



Reed


___
vos-d mailing list
vos-d@interreality.org
http://www.interreality.org/cgi-bin/mailman/listinfo/vos-d


[vos-d] Re: Terangreal and Unicode?

2005-09-04 Thread Lalo Martins
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 -	1.8
+++ apps/terangreal/ter_mainframe.cc	5 Sep 2005 02:36:23 -
@@ -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 -	1.2
+++ apps/terangreal/ter_prefs.cc	5 Sep 2005 02:36:23 -
@@ -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 {
 vRefA3DL::Model m = meta_castA3DL::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());
-