Author Topic: Unicode conversion (attention all devs)  (Read 68127 times)

Offline byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 837
Re: UNICODE: ATTENTION ALL DEVS
« Reply #45 on: August 05, 2005, 11:46:23 pm »

Code
#ifdef wxUSE_UNICODE
        formattedText << wxString(formatter.nextLine().c_str(), wxConvLocal);
#else
        formattedText << formatter.nextLine().c_str();
#endif


Hmm, wont the first form work both in unicode and non-unicode version ? In files I've changed it works. It's in headers wxstring.h:

when in Unicode:
Code
#if wxUSE_UNICODE
    // from multibyte string
  wxString(const char *psz, wxMBConv& conv, size_t nLength = npos);

when not:

Code
  wxString(const wxChar *psz, wxMBConv& WXUNUSED(conv), size_t nLength = npos)
      : wxStringBase(psz, nLength == npos ? wxStrlen(psz) : nLength) { }
(here wxChar is equal to char)

so when in non-unicode version the secondargument wil be ignored.

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: UNICODE: ATTENTION ALL DEVS
« Reply #46 on: August 05, 2005, 11:54:04 pm »
So keeping it the evil way would work for both...

Well, I'll leave it that way (with the #ifdef) so the ASCII build won't need to create a wxString object unnecessarily.

I would also like to inform you the help plugin is ready for UNICODE too, but only in HEAD.

I just tried to commit the changes to the AStyle plugin and CVS rejected, so I'll e-mail them.

I'm gonna commit the help plugin changes to HEAD though.

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: UNICODE: ATTENTION ALL DEVS
« Reply #47 on: August 06, 2005, 12:22:51 am »
~ code is tested Logically.

:? What is that supposed to mean? Anyway, I'm thinking it would be better if all the SDK changes were mailed to me personally.

Anyway guys, send me personal message (NOT mail!) for the changes in status. I'll modify the above table since i'm a webadmin, too ;-)
« Last Edit: August 06, 2005, 12:27:03 am by rickg22 »

Offline byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 837
Re: UNICODE: ATTENTION ALL DEVS
« Reply #48 on: August 06, 2005, 12:25:40 am »
My current progress :

Edited by rick - changes posted above

Will handle the rest tomorrow :)
« Last Edit: August 06, 2005, 12:29:49 am by rickg22 »

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
Re: UNICODE: ATTENTION ALL DEVS
« Reply #49 on: August 06, 2005, 01:11:32 am »
~ code is tested Logically.
:? What is that supposed to mean?
...

it means - after your edited source code module is compiling without errors or warnings,
look what is this just edited module doing and test this functionality explicitly
in the newly built codeblocks.

ie
it is the last step before sending the modified files to YOU RICK !!

we could rename this symbol to "sent to rick"  :D
« Last Edit: August 06, 2005, 01:13:50 am by tiwag »

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: UNICODE: ATTENTION ALL DEVS
« Reply #50 on: August 06, 2005, 03:22:01 am »
You could change it for "tested live"

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: UNICODE: ATTENTION ALL DEVS
« Reply #51 on: August 06, 2005, 07:56:21 am »
Um... man i think tiwag's got the most difficult part!

(i detected one or two possible flaws)
But I have a doubt. Tiwag, have you tried importing MSVC projects and Dev-Cpp projects with the modified files?

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
Re: UNICODE: ATTENTION ALL DEVS
« Reply #52 on: August 06, 2005, 10:24:02 am »
Um... man i think tiwag's got the most difficult part!

(i detected one or two possible flaws)
But I have a doubt. Tiwag, have you tried importing MSVC projects and Dev-Cpp projects with the modified files?

no that i missed till now - will do it in a few hours

just now my wife is worried about my spare-time schedule  :shock: - i have to help her a few things now  :D

Offline David Perfors

  • Developer
  • Lives here!
  • *****
  • Posts: 560
Re: UNICODE: ATTENTION ALL DEVS
« Reply #53 on: August 06, 2005, 10:49:21 am »
just now my wife is worried about my spare-time schedule  :shock: - i have to help her a few things now  :D
Yes always listen to your wife :lol: (ehm. well I think, I don't have a wife, not even a girl friend.  :( yet :lol:)
OS: winXP
Compiler: mingw
IDE: Code::Blocks SVN WX: 2.8.4 Wish list: faster code completion, easier debugging, refactoring

Offline byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 837
Re: UNICODE: ATTENTION ALL DEVS
« Reply #54 on: August 06, 2005, 11:17:54 am »
just now my wife is worried about my spare-time schedule  :shock: - i have to help her a few things now  :D
Yes always listen to your wife :lol: (ehm. well I think, I don't have a wife, not even a girl friend.  :( yet :lol:)

He he, maybe not always, husband can be right too (at least from time to time ;) ).
I haven't listen to my girlfriend much recently and now I see the results - the worst thing in the world is to have lot of spare time and nobody to share it with  :(.

BTW, progress:

Code
////////////////////////////////////////
/// byo
group 15
o    replacedlg.cpp
o    replacedlg.h
o    sanitycheck.h
o    sdk_events.cpp
o    sdk_events.h
o    searchresultslog.cpp
o    searchresultslog.h
o    selecttargetdlg.cpp
o    selecttargetdlg.h
o    settings.h
o    simplelistlog.cpp
o    simplelistlog.h
o    simpletextlog.cpp
o    simpletextlog.h

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
Re: UNICODE: ATTENTION ALL DEVS
« Reply #55 on: August 06, 2005, 12:14:46 pm »
I try to compile changed sources in both Unicode and NonUnicode versions of wxWidgets (and after that in wx2.4 and wx2.6 to make sure it will work everywhere). Unfortunately all project can't be compiled in Unicode but separate files can :)

Hi byo

what unicode library have you built ? which OS are you using ?

currently i work only in Windows,
i thought about to build a "wxMSW-2.4.2-monolithic-unicode-DLL-debug" library
for testing the CodeBlocks VERSION_1_0_UNICODE .

i would like to discuss with you how to setup the best debug-environment for our new "baby"

in the future i would like to test also in Linux,
just now i have set up an Ubunto Hoary in a VM-ware box
it runs but i'm far away from compiling and testing something...
so testing in Linuxs means "mid-term future" for me
maybe starting in October 05 ... we'll see

Offline byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 837
Re: UNICODE: ATTENTION ALL DEVS
« Reply #56 on: August 06, 2005, 03:05:29 pm »
what unicode library have you built ? which OS are you using ?

currently i work only in Windows,
i thought about to build a "wxMSW-2.4.2-monolithic-unicode-DLL-debug" library
for testing the CodeBlocks VERSION_1_0_UNICODE .

i would like to discuss with you how to setup the best debug-environment for our new "baby"

in the future i would like to test also in Linux,
just now i have set up an Ubunto Hoary in a VM-ware box
it runs but i'm far away from compiling and testing something...
so testing in Linuxs means "mid-term future" for me
maybe starting in October 05 ... we'll see


I also work on Windows, testing on wx 2.6.1 (monolithic,dll)

I tried to run on Gentoo linux (with wx 2.6.1) but can't get it working (it crashes immediately - it was even discussed somewhere on the forum). Hmm, no, I've run it on 2.4 but it doesn't store configuration or something like that (it crashes when closing stardet but before saving configuration I suppose). But it wasn't sattisfying for me since my wxSmith plugin works only under 2.6.

Hmm, there's also one thing need mentioning - when building wxWidgets in debug mode (when assertions are enabled) it shows some assertions at the beginning (something about unknown parameters - when parsing command line) and some after but I don't remember them currently.

Offline byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 837
Re: UNICODE: ATTENTION ALL DEVS
« Reply #57 on: August 06, 2005, 04:11:21 pm »
Code from group 15 sent to rickg22 - You can update my info ;)

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
NEW MACRO DEFINED!
« Reply #58 on: August 06, 2005, 10:05:23 pm »
New macro defined!

I defined a new macro in "settings.h":

_U(). Use it to convert non-literal char* strings to wxString. Use it for reading attributes from TiXmlNode's.

Code
#ifdef wxUSE_UNICODE
  #define _U(x) wxString((x),wxConvUTF8)
  #define _UU(x,y) wxString((x),y)
#else
  #define _U(x) (x)
  #define _UU(x,y) (x)
#endif
i.e.:

Code
const char* incompatible = "This is an incompatible string";
wxString compatible = _U(incompatible);

// wxString conftype = conf->Attribute("ConfigurationType"); // before
wxString conftype = _U(conf->Attribute("ConfigurationType")); // after :)

I just hope I'm not reinventing the wheel here :P
« Last Edit: August 06, 2005, 10:13:31 pm by rickg22 »

Offline byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 837
Re: NEW MACRO DEFINED!
« Reply #59 on: August 06, 2005, 11:37:48 pm »
Code
#ifdef wxUSE_UNICODE
  #define _U(x) wxString((x),wxConvUTF8)
  #define _UU(x,y) wxString((x),y)
#else
  #define _U(x) (x)
  #define _UU(x,y) (x)
#endif

I guess that we should use wxConvUTF8 by default. I've seen that Ceniza uses wxConvLocal. Which one is better ? (Perhaps we will find out when localized versions of C::B will be released ;) ).

Hmm, I shouldn't worry about it. If it will be inside settings.h, jut few seconds and it will be changed  :lol: